diff --git a/index.js b/index.js index 3df15bd..8c910d8 100644 --- a/index.js +++ b/index.js @@ -435,6 +435,9 @@ export function apply(ctx, config = {}) { await handle.close() } 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() } }) notify({ type: 'sessions' }) return { sessionId, cwd: where.cwd, workspaceId: where.workspaceId || null }