Imported chats keep their clean title (drop the source machine prefix)

This commit is contained in:
Agent committed 2026-10-21 19:30:06 +00:00
1 parent 2e699a061f
commit bf827d6c96
1 file changed
+3
+3
View File
@@ -435,6 +435,9 @@ export function apply(ctx, config = {}) {
await handle.close() await handle.close()
} }
await sc().create(where.workspaceId ? { sessionId, workspaceId: where.workspaceId } : { sessionId, cwd: where.cwd }) await sc().create(where.workspaceId ? { sessionId, workspaceId: where.workspaceId } : { sessionId, cwd: where.cwd })
// The inherited title may carry the source machine's name ("ai-pc: …"); keep the clean one.
const clean = origin?.title && stripDevicePrefix(origin.title, [origin.device, origin.deviceName])
if (clean) { try { await sc().rename({ sessionId, title: clean }) } catch (e) { log.debug?.(`dsh-remote: rename imported session: ${e.message}`) } }
ledger.patch(sessionId, { origin: { ...origin, baseSeq, baseCommit: ss.commitId(events, baseSeq), importedAt: Date.now() } }) ledger.patch(sessionId, { origin: { ...origin, baseSeq, baseCommit: ss.commitId(events, baseSeq), importedAt: Date.now() } })
notify({ type: 'sessions' }) notify({ type: 'sessions' })
return { sessionId, cwd: where.cwd, workspaceId: where.workspaceId || null } return { sessionId, cwd: where.cwd, workspaceId: where.workspaceId || null }