Skip to content

Commit e2da1ba

Browse files
authored
feat: persist external session origins (#3103)
Persist immutable external-session provenance, expose bounded durable import history through Runtime Host, and project authoritative recovery state in Desktop. Generated-by: Codex
1 parent 7bb776b commit e2da1ba

28 files changed

Lines changed: 2111 additions & 88 deletions
Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
import assert from 'node:assert/strict';
2+
import test from 'node:test';
3+
import type { SessionSummary } from '@maka/core/session';
4+
import {
5+
projectDesktopExternalSessionCatalogItem,
6+
} from '../../preload/external-session-catalog.js';
7+
import { projectDesktopSessionSummary } from '../../shared/desktop-session-projection.js';
8+
import { desktopSessionKey } from '../../shared/runtime-host-identity.js';
9+
10+
test('projects imported Session ids into the same Desktop identity space as Session summaries', () => {
11+
const host = { hostId: 'host-a' };
12+
const catalogItem = projectDesktopExternalSessionCatalogItem(host, {
13+
id: 'source-1',
14+
name: 'Source',
15+
cwd: '/external',
16+
importState: {
17+
importedCount: 1,
18+
importedSessionIds: ['imported-1'],
19+
isImporting: false,
20+
},
21+
});
22+
const summary = projectDesktopSessionSummary(
23+
{
24+
...host,
25+
profileId: 'profile-a',
26+
profileName: 'Profile A',
27+
profileKind: 'remote',
28+
},
29+
session('imported-1'),
30+
);
31+
32+
assert.deepEqual(catalogItem.importState.importedSessionIds, [
33+
desktopSessionKey({ hostId: host.hostId, sessionId: 'imported-1' }),
34+
]);
35+
assert.equal(catalogItem.importState.importedSessionIds[0], summary.id);
36+
});
37+
38+
function session(id: string): SessionSummary {
39+
return {
40+
id,
41+
name: 'Imported',
42+
isFlagged: false,
43+
isArchived: false,
44+
labels: [],
45+
hasUnread: false,
46+
status: 'active',
47+
backend: 'ai-sdk',
48+
llmConnectionSlug: 'default',
49+
connectionLocked: false,
50+
model: 'gpt-5',
51+
permissionMode: 'ask',
52+
};
53+
}

0 commit comments

Comments
 (0)