Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .nvmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
22
3 changes: 3 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@
"freshell": "dist/server/cli/index.js"
},
"main": "dist/electron/electron/entry.js",
"engines": {
"node": ">=22.5.0"
},
"scripts": {
"predev": "cross-env PORT=3002 tsx scripts/precheck.ts",
"preserve": "tsx scripts/precheck.ts",
Expand Down
6 changes: 5 additions & 1 deletion server/coding-cli/providers/codex.ts
Original file line number Diff line number Diff line change
Expand Up @@ -328,7 +328,11 @@ export function parseCodexSessionContent(content: string): ParsedSessionMeta {
if (ideRequest) {
title = extractTitleFromMessage(ideRequest, 200)
} else if (!isSystemContext(text)) {
title = extractTitleFromMessage(text, 200)
// Strip image markup tags so titles show the actual user request
const cleaned = text.replace(/<\/?image[^>]*>/g, '').trim()
if (cleaned) {
title = extractTitleFromMessage(cleaned, 200)
}
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion server/coding-cli/providers/opencode.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ export class OpencodeProvider implements CodingCliProvider {
try {
sqlite = await import('node:sqlite')
} catch {
logger.debug({ provider: this.name }, 'node:sqlite unavailable (requires Node 22.5+); skipping OpenCode sessions')
logger.warn({ provider: this.name, nodeVersion: process.version }, 'node:sqlite unavailable — OpenCode sessions will not appear. Upgrade to Node 22.5+ to enable.')
return []
}

Expand Down
18 changes: 16 additions & 2 deletions server/coding-cli/session-indexer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -940,14 +940,28 @@ export class CodingCliSessionIndexer {
enabledSet: Set<string>,
seenCacheKeys: Set<string>,
): Promise<void> {
// Collect all file-based entries for enrichment.
// Collect all file-based entries for enrichment. Files the lightweight scan couldn't
// parse (e.g. Codex with 14KB first lines) use file mtime as the recency estimate.
const statCache = new Map<string, number>()
const candidates: Array<{ provider: CodingCliProvider; filePath: string; cacheKey: string; lastActivityAt: number; isSubagent: boolean }> = []
for (const [provider, files] of filesByProvider) {
if (!enabledSet.has(provider.name)) continue
for (const filePath of files) {
const cacheKey = normalizeFilePath(filePath)
const cached = this.fileCache.get(cacheKey)
const lastActivityAt = cached?.baseSession?.lastActivityAt ?? 0
let lastActivityAt = cached?.baseSession?.lastActivityAt ?? cached?.mtimeMs ?? 0
if (lastActivityAt === 0) {
// No cache entry — file wasn't parseable from 4KB. Use mtime for sorting.
try {
let mtime = statCache.get(cacheKey)
if (mtime === undefined) {
const stat = await fsp.stat(filePath)
mtime = stat.mtimeMs || stat.mtime.getTime()
statCache.set(cacheKey, mtime)
}
lastActivityAt = mtime
} catch { /* file may have been deleted */ }
}
const isSubagent = cached?.baseSession?.isSubagent ?? isSubagentSession(filePath)
candidates.push({ provider, filePath, cacheKey, lastActivityAt, isSubagent })
}
Expand Down
5 changes: 3 additions & 2 deletions server/coding-cli/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -308,8 +308,9 @@ async function resolveCommonDirFromGitFile(gitdir: string): Promise<string> {
export function isSystemContext(text: string): boolean {
const trimmed = text.trim()
if (!trimmed) return false
// XML-wrapped system context: <system_context>, <environment_context>, <INSTRUCTIONS>, etc.
if (/^<[a-zA-Z_][\w_-]*[>\s]/.test(trimmed)) return true
// XML-wrapped system context injected by coding CLIs. Uses an allowlist of known system
// context tag names to avoid false-positives on user content like <image>, <file>, <analysis>.
if (/^<(environment_context|system_context|system|context|INSTRUCTIONS|user_instructions|permissions|collaboration_mode|skills_instructions)[>\s]/i.test(trimmed)) return true
// Instruction file headers: "# AGENTS.md instructions for...", "# System", "# Instructions"
if (/^#\s*(AGENTS|Instructions?|System)/i.test(trimmed)) return true
// Bracketed agent mode instructions: [SUGGESTION MODE: ...], [REVIEW MODE: ...]
Expand Down
Loading