@adhdev/daemon-core 0.9.52 → 0.9.54
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/commands/handler.d.ts +2 -0
- package/dist/git/git-commands.d.ts +86 -0
- package/dist/git/git-diff.d.ts +17 -0
- package/dist/git/git-executor.d.ts +34 -0
- package/dist/git/git-monitor.d.ts +57 -0
- package/dist/git/git-snapshot-store.d.ts +50 -0
- package/dist/git/git-status.d.ts +19 -0
- package/dist/git/git-summary.d.ts +10 -0
- package/dist/git/git-types.d.ts +113 -0
- package/dist/git/index.d.ts +14 -0
- package/dist/index.d.ts +2 -1
- package/dist/index.js +1611 -392
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +1584 -389
- package/dist/index.mjs.map +1 -1
- package/dist/shared-types.d.ts +7 -1
- package/dist/status/builders.d.ts +2 -0
- package/dist/status/snapshot.d.ts +2 -0
- package/node_modules/@adhdev/session-host-core/package.json +1 -1
- package/package.json +1 -1
- package/src/commands/chat-commands.ts +31 -4
- package/src/commands/handler.ts +9 -1
- package/src/config/chat-history.ts +11 -3
- package/src/git/git-commands.ts +385 -0
- package/src/git/git-diff.ts +303 -0
- package/src/git/git-executor.ts +268 -0
- package/src/git/git-monitor.ts +194 -0
- package/src/git/git-snapshot-store.ts +238 -0
- package/src/git/git-status.ts +193 -0
- package/src/git/git-summary.ts +43 -0
- package/src/git/git-types.ts +153 -0
- package/src/git/index.ts +72 -0
- package/src/index.ts +4 -0
- package/src/shared-types.ts +33 -1
- package/src/status/builders.ts +26 -4
- package/src/status/snapshot.ts +10 -2
|
@@ -0,0 +1,153 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ADHDev Git surface types.
|
|
3
|
+
*
|
|
4
|
+
* Runtime-free type definitions shared by daemon-core, cloud/standalone
|
|
5
|
+
* transports, and web-core. Git state is daemon-owned product truth; do not
|
|
6
|
+
* infer these values from agent transcripts in frontend code.
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
export type GitFailureReason =
|
|
10
|
+
| 'not_git_repo'
|
|
11
|
+
| 'git_not_installed'
|
|
12
|
+
| 'timeout'
|
|
13
|
+
| 'path_outside_repo'
|
|
14
|
+
| 'dirty_index_required'
|
|
15
|
+
| 'conflict'
|
|
16
|
+
| 'invalid_args'
|
|
17
|
+
| 'git_command_failed';
|
|
18
|
+
|
|
19
|
+
export interface GitRepoIdentity {
|
|
20
|
+
workspace: string;
|
|
21
|
+
repoRoot: string | null;
|
|
22
|
+
isGitRepo: boolean;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
export interface GitRepoStatus extends GitRepoIdentity {
|
|
26
|
+
branch: string | null;
|
|
27
|
+
headCommit: string | null;
|
|
28
|
+
headMessage: string | null;
|
|
29
|
+
upstream: string | null;
|
|
30
|
+
ahead: number;
|
|
31
|
+
behind: number;
|
|
32
|
+
staged: number;
|
|
33
|
+
modified: number;
|
|
34
|
+
untracked: number;
|
|
35
|
+
deleted: number;
|
|
36
|
+
renamed: number;
|
|
37
|
+
hasConflicts: boolean;
|
|
38
|
+
conflictFiles: string[];
|
|
39
|
+
stashCount: number;
|
|
40
|
+
lastCheckedAt: number;
|
|
41
|
+
error?: string;
|
|
42
|
+
reason?: GitFailureReason;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
export type GitFileChangeStatus =
|
|
46
|
+
| 'added'
|
|
47
|
+
| 'modified'
|
|
48
|
+
| 'deleted'
|
|
49
|
+
| 'renamed'
|
|
50
|
+
| 'copied'
|
|
51
|
+
| 'untracked'
|
|
52
|
+
| 'conflict';
|
|
53
|
+
|
|
54
|
+
export interface GitFileChange {
|
|
55
|
+
path: string;
|
|
56
|
+
oldPath?: string;
|
|
57
|
+
status: GitFileChangeStatus;
|
|
58
|
+
staged: boolean;
|
|
59
|
+
insertions: number;
|
|
60
|
+
deletions: number;
|
|
61
|
+
binary?: boolean;
|
|
62
|
+
truncated?: boolean;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
export interface GitDiffSummary extends GitRepoIdentity {
|
|
66
|
+
files: GitFileChange[];
|
|
67
|
+
totalInsertions: number;
|
|
68
|
+
totalDeletions: number;
|
|
69
|
+
truncated: boolean;
|
|
70
|
+
lastCheckedAt: number;
|
|
71
|
+
error?: string;
|
|
72
|
+
reason?: GitFailureReason;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
export type GitSnapshotReason =
|
|
76
|
+
| 'session_baseline'
|
|
77
|
+
| 'before_user_input_dispatch'
|
|
78
|
+
| 'before_agent_work'
|
|
79
|
+
| 'after_agent_work'
|
|
80
|
+
| 'manual';
|
|
81
|
+
|
|
82
|
+
export interface GitSnapshot {
|
|
83
|
+
id: string;
|
|
84
|
+
workspace: string;
|
|
85
|
+
repoRoot: string;
|
|
86
|
+
sessionId?: string;
|
|
87
|
+
turnId?: string;
|
|
88
|
+
reason: GitSnapshotReason;
|
|
89
|
+
status: GitRepoStatus;
|
|
90
|
+
diffSummary: GitDiffSummary;
|
|
91
|
+
createdAt: number;
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
export interface GitSnapshotCompareSummary {
|
|
95
|
+
beforeSnapshotId: string;
|
|
96
|
+
afterSnapshotId: string;
|
|
97
|
+
workspace: string;
|
|
98
|
+
repoRoot: string;
|
|
99
|
+
changedFiles: number;
|
|
100
|
+
addedFiles: string[];
|
|
101
|
+
modifiedFiles: string[];
|
|
102
|
+
deletedFiles: string[];
|
|
103
|
+
renamedFiles: Array<{ oldPath: string; path: string }>;
|
|
104
|
+
untrackedFiles: string[];
|
|
105
|
+
conflictFiles: string[];
|
|
106
|
+
totalInsertions: number;
|
|
107
|
+
totalDeletions: number;
|
|
108
|
+
hasConflicts: boolean;
|
|
109
|
+
currentStatus: GitRepoStatus;
|
|
110
|
+
summaryText: string;
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
export interface GitCompactSummary {
|
|
114
|
+
isGitRepo: boolean;
|
|
115
|
+
repoRoot: string | null;
|
|
116
|
+
branch: string | null;
|
|
117
|
+
dirty: boolean;
|
|
118
|
+
changedFiles: number;
|
|
119
|
+
ahead: number;
|
|
120
|
+
behind: number;
|
|
121
|
+
hasConflicts: boolean;
|
|
122
|
+
lastCheckedAt: number;
|
|
123
|
+
error?: string;
|
|
124
|
+
reason?: GitFailureReason;
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
export interface WorkspaceGitSubscriptionParams {
|
|
128
|
+
workspace: string;
|
|
129
|
+
includeDiffSummary?: boolean;
|
|
130
|
+
intervalMs?: number;
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
export interface GitWorkspaceUpdate {
|
|
134
|
+
topic: 'workspace.git';
|
|
135
|
+
key: string;
|
|
136
|
+
workspace: string;
|
|
137
|
+
status: GitRepoStatus;
|
|
138
|
+
diffSummary?: GitDiffSummary;
|
|
139
|
+
seq: number;
|
|
140
|
+
timestamp: number;
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
export type GitCommandName =
|
|
144
|
+
| 'git_status'
|
|
145
|
+
| 'git_diff_summary'
|
|
146
|
+
| 'git_diff_file'
|
|
147
|
+
| 'git_snapshot_create'
|
|
148
|
+
| 'git_snapshot_compare'
|
|
149
|
+
| 'git_log'
|
|
150
|
+
| 'git_checkpoint'
|
|
151
|
+
| 'git_stash_push'
|
|
152
|
+
| 'git_stash_pop'
|
|
153
|
+
| 'git_checkout_files';
|
package/src/git/index.ts
ADDED
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
export type {
|
|
2
|
+
GitCommandName,
|
|
3
|
+
GitCompactSummary,
|
|
4
|
+
GitDiffSummary,
|
|
5
|
+
GitFailureReason,
|
|
6
|
+
GitFileChange,
|
|
7
|
+
GitFileChangeStatus,
|
|
8
|
+
GitRepoIdentity,
|
|
9
|
+
GitRepoStatus,
|
|
10
|
+
GitSnapshot,
|
|
11
|
+
GitSnapshotCompareSummary,
|
|
12
|
+
GitSnapshotReason,
|
|
13
|
+
GitWorkspaceUpdate,
|
|
14
|
+
WorkspaceGitSubscriptionParams,
|
|
15
|
+
} from './git-types.js';
|
|
16
|
+
|
|
17
|
+
export {
|
|
18
|
+
GitCommandError,
|
|
19
|
+
isPathInside,
|
|
20
|
+
normalizeGitOutput,
|
|
21
|
+
resolveGitRepository,
|
|
22
|
+
runGit,
|
|
23
|
+
} from './git-executor.js';
|
|
24
|
+
export type { GitCommandResult as GitExecutorCommandResult, GitExecutorOptions, RunGitOptions } from './git-executor.js';
|
|
25
|
+
|
|
26
|
+
export { getGitRepoStatus, parsePorcelainV2Status } from './git-status.js';
|
|
27
|
+
export type { GitStatusOptions } from './git-status.js';
|
|
28
|
+
|
|
29
|
+
export { getGitDiffSummary, getGitFileDiff } from './git-diff.js';
|
|
30
|
+
export type { GitDiffOptions, GitFileDiffResult } from './git-diff.js';
|
|
31
|
+
|
|
32
|
+
export { createGitCompactSummary, summarizeGitStatus } from './git-summary.js';
|
|
33
|
+
|
|
34
|
+
export {
|
|
35
|
+
compareGitSnapshots,
|
|
36
|
+
createGitSnapshotStore,
|
|
37
|
+
InMemoryGitSnapshotStore,
|
|
38
|
+
} from './git-snapshot-store.js';
|
|
39
|
+
export type {
|
|
40
|
+
GitDiffSummaryProvider,
|
|
41
|
+
GitSnapshotCreateInput,
|
|
42
|
+
GitSnapshotListQuery,
|
|
43
|
+
GitSnapshotStore,
|
|
44
|
+
GitSnapshotStoreOptions,
|
|
45
|
+
GitStatusProvider,
|
|
46
|
+
MaybePromise,
|
|
47
|
+
} from './git-snapshot-store.js';
|
|
48
|
+
|
|
49
|
+
export {
|
|
50
|
+
createGitWorkspaceMonitor,
|
|
51
|
+
DEFAULT_GIT_WORKSPACE_POLL_INTERVAL_MS,
|
|
52
|
+
GitWorkspaceMonitor,
|
|
53
|
+
MIN_GIT_WORKSPACE_POLL_INTERVAL_MS,
|
|
54
|
+
normalizeGitWorkspaceSubscriptionParams,
|
|
55
|
+
} from './git-monitor.js';
|
|
56
|
+
export type {
|
|
57
|
+
GitWorkspaceCacheEntry,
|
|
58
|
+
GitWorkspaceMonitorOptions,
|
|
59
|
+
GitWorkspaceSubscription,
|
|
60
|
+
GitWorkspaceUpdateListener,
|
|
61
|
+
NormalizedWorkspaceGitSubscriptionParams,
|
|
62
|
+
NormalizeGitWorkspaceSubscriptionOptions,
|
|
63
|
+
} from './git-monitor.js';
|
|
64
|
+
|
|
65
|
+
export { createDefaultGitCommandServices, handleGitCommand, isGitCommandName } from './git-commands.js';
|
|
66
|
+
export type {
|
|
67
|
+
GitCommandResult,
|
|
68
|
+
GitCommandServices,
|
|
69
|
+
GitFileDiff,
|
|
70
|
+
GitLogEntry,
|
|
71
|
+
GitLogResult,
|
|
72
|
+
} from './git-commands.js';
|
package/src/index.ts
CHANGED
|
@@ -44,6 +44,7 @@ export type {
|
|
|
44
44
|
SessionHostDiagnosticsSubscriptionParams,
|
|
45
45
|
SessionModalSubscriptionParams,
|
|
46
46
|
DaemonMetadataSubscriptionParams,
|
|
47
|
+
WorkspaceGitSubscriptionParams,
|
|
47
48
|
SessionChatTailUpdate,
|
|
48
49
|
MachineRuntimeUpdate,
|
|
49
50
|
SessionHostDiagnosticsUpdate,
|
|
@@ -81,6 +82,9 @@ export type {
|
|
|
81
82
|
ExtensionProviderState,
|
|
82
83
|
} from './shared-types.js';
|
|
83
84
|
|
|
85
|
+
// ── Git Surface ──
|
|
86
|
+
export * from './git/index.js';
|
|
87
|
+
|
|
84
88
|
// These types live in shared-types-extra.ts — imported directly because
|
|
85
89
|
// rollup-dts cannot resolve re-exports from shared-types.ts for them.
|
|
86
90
|
import type { RuntimeWriteOwner as _RuntimeWriteOwner } from './shared-types-extra.js';
|
package/src/shared-types.ts
CHANGED
|
@@ -44,6 +44,34 @@ export type { ProviderErrorReason } from './providers/provider-instance.js';
|
|
|
44
44
|
import type { ActiveChatData as _ActiveChatData, ProviderErrorReason as _ProviderErrorReason } from './providers/provider-instance.js';
|
|
45
45
|
import type { WorkspaceEntry } from './config/workspaces.js';
|
|
46
46
|
import type { ProviderResumeCapability } from './providers/contracts.js';
|
|
47
|
+
import type {
|
|
48
|
+
GitCompactSummary,
|
|
49
|
+
GitDiffSummary,
|
|
50
|
+
GitFailureReason,
|
|
51
|
+
GitRepoIdentity,
|
|
52
|
+
GitRepoStatus,
|
|
53
|
+
GitSnapshot,
|
|
54
|
+
GitSnapshotCompareSummary,
|
|
55
|
+
GitSnapshotReason,
|
|
56
|
+
GitWorkspaceUpdate,
|
|
57
|
+
WorkspaceGitSubscriptionParams,
|
|
58
|
+
} from './git/git-types.js';
|
|
59
|
+
|
|
60
|
+
export type {
|
|
61
|
+
GitCommandName,
|
|
62
|
+
GitCompactSummary,
|
|
63
|
+
GitDiffSummary,
|
|
64
|
+
GitFailureReason,
|
|
65
|
+
GitFileChange,
|
|
66
|
+
GitFileChangeStatus,
|
|
67
|
+
GitRepoIdentity,
|
|
68
|
+
GitRepoStatus,
|
|
69
|
+
GitSnapshot,
|
|
70
|
+
GitSnapshotCompareSummary,
|
|
71
|
+
GitSnapshotReason,
|
|
72
|
+
GitWorkspaceUpdate,
|
|
73
|
+
WorkspaceGitSubscriptionParams,
|
|
74
|
+
} from './git/git-types.js';
|
|
47
75
|
|
|
48
76
|
export interface SessionActiveChatData extends Omit<_ActiveChatData, 'messages'> {
|
|
49
77
|
messages?: _ActiveChatData['messages'];
|
|
@@ -178,7 +206,7 @@ export interface SessionHostDiagnosticsSnapshot {
|
|
|
178
206
|
recentTransitions: SessionHostRuntimeTransition[];
|
|
179
207
|
}
|
|
180
208
|
|
|
181
|
-
export type TransportTopic = 'session.chat_tail' | 'session.runtime_output' | 'machine.runtime' | 'session_host.diagnostics' | 'session.modal' | 'daemon.metadata';
|
|
209
|
+
export type TransportTopic = 'session.chat_tail' | 'session.runtime_output' | 'machine.runtime' | 'session_host.diagnostics' | 'session.modal' | 'daemon.metadata' | 'workspace.git';
|
|
182
210
|
|
|
183
211
|
export interface SessionChatTailSubscriptionParams extends ReadChatCursor {
|
|
184
212
|
targetSessionId: string;
|
|
@@ -272,6 +300,7 @@ export interface TopicUpdateEnvelopeMap {
|
|
|
272
300
|
'session_host.diagnostics': SessionHostDiagnosticsUpdate;
|
|
273
301
|
'session.modal': SessionModalUpdate;
|
|
274
302
|
'daemon.metadata': DaemonMetadataUpdate;
|
|
303
|
+
'workspace.git': GitWorkspaceUpdate;
|
|
275
304
|
}
|
|
276
305
|
|
|
277
306
|
export type TopicUpdateEnvelope = TopicUpdateEnvelopeMap[TransportTopic];
|
|
@@ -283,6 +312,7 @@ export interface SubscribeRequestMap {
|
|
|
283
312
|
'session_host.diagnostics': SessionHostDiagnosticsSubscriptionParams;
|
|
284
313
|
'session.modal': SessionModalSubscriptionParams;
|
|
285
314
|
'daemon.metadata': DaemonMetadataSubscriptionParams;
|
|
315
|
+
'workspace.git': WorkspaceGitSubscriptionParams;
|
|
286
316
|
}
|
|
287
317
|
|
|
288
318
|
export type SubscribeRequest =
|
|
@@ -327,6 +357,7 @@ export interface SessionEntry {
|
|
|
327
357
|
status: SessionStatus;
|
|
328
358
|
title: string;
|
|
329
359
|
workspace?: string | null;
|
|
360
|
+
git?: GitCompactSummary;
|
|
330
361
|
runtimeKey?: string;
|
|
331
362
|
runtimeDisplayName?: string;
|
|
332
363
|
runtimeWorkspaceLabel?: string;
|
|
@@ -378,6 +409,7 @@ export interface CompactSessionEntry {
|
|
|
378
409
|
status: SessionStatus;
|
|
379
410
|
title: string;
|
|
380
411
|
workspace: string | null;
|
|
412
|
+
git?: GitCompactSummary;
|
|
381
413
|
cdpConnected?: boolean;
|
|
382
414
|
runtimeKey?: string;
|
|
383
415
|
runtimeDisplayName?: string;
|
package/src/status/builders.ts
CHANGED
|
@@ -9,6 +9,7 @@
|
|
|
9
9
|
*/
|
|
10
10
|
|
|
11
11
|
import type { DaemonCdpManager } from '../cdp/manager.js';
|
|
12
|
+
import type { GitCompactSummary } from '../git/git-types.js';
|
|
12
13
|
import type { SessionEntry, SessionCapability } from '../shared-types.js';
|
|
13
14
|
import type {
|
|
14
15
|
IdeProviderState,
|
|
@@ -34,6 +35,7 @@ export type SessionEntryProfile = 'full' | 'live' | 'metadata';
|
|
|
34
35
|
|
|
35
36
|
export interface SessionEntryBuildOptions {
|
|
36
37
|
profile?: SessionEntryProfile;
|
|
38
|
+
getGitSummaryForWorkspace?: (workspace: string) => GitCompactSummary | null | undefined;
|
|
37
39
|
}
|
|
38
40
|
|
|
39
41
|
function getActiveChatOptions(profile: SessionEntryProfile): NormalizeActiveChatOptions {
|
|
@@ -53,6 +55,14 @@ function shouldIncludeRuntimeMetadata(profile: SessionEntryProfile): boolean {
|
|
|
53
55
|
return true;
|
|
54
56
|
}
|
|
55
57
|
|
|
58
|
+
function getGitSummaryForWorkspace(
|
|
59
|
+
workspace: string | null | undefined,
|
|
60
|
+
options: SessionEntryBuildOptions,
|
|
61
|
+
): GitCompactSummary | undefined {
|
|
62
|
+
if (!workspace) return undefined;
|
|
63
|
+
return options.getGitSummaryForWorkspace?.(workspace) || undefined;
|
|
64
|
+
}
|
|
65
|
+
|
|
56
66
|
// ─── CDP Manager lookup helpers ──────────────────────
|
|
57
67
|
|
|
58
68
|
/**
|
|
@@ -150,6 +160,8 @@ function buildIdeWorkspaceSession(
|
|
|
150
160
|
const controlValues = normalizeProviderStateControlValues(state.controlValues);
|
|
151
161
|
const includeSessionMetadata = shouldIncludeSessionMetadata(profile);
|
|
152
162
|
const includeSessionControls = shouldIncludeSessionControls(profile);
|
|
163
|
+
const workspace = state.workspace || null;
|
|
164
|
+
const git = getGitSummaryForWorkspace(workspace, options);
|
|
153
165
|
const title = activeChat?.title || state.name;
|
|
154
166
|
return {
|
|
155
167
|
id: state.instanceId || state.type,
|
|
@@ -162,7 +174,8 @@ function buildIdeWorkspaceSession(
|
|
|
162
174
|
activeModal: activeChat?.activeModal || null,
|
|
163
175
|
}),
|
|
164
176
|
title,
|
|
165
|
-
workspace
|
|
177
|
+
workspace,
|
|
178
|
+
...(git && { git }),
|
|
166
179
|
activeChat,
|
|
167
180
|
...(summaryMetadata && { summaryMetadata }),
|
|
168
181
|
...(includeSessionMetadata && { capabilities: state.sessionCapabilities || IDE_SESSION_CAPABILITIES }),
|
|
@@ -188,6 +201,8 @@ function buildExtensionAgentSession(
|
|
|
188
201
|
const controlValues = normalizeProviderStateControlValues(ext.controlValues);
|
|
189
202
|
const includeSessionMetadata = shouldIncludeSessionMetadata(profile);
|
|
190
203
|
const includeSessionControls = shouldIncludeSessionControls(profile);
|
|
204
|
+
const workspace = parent.workspace || null;
|
|
205
|
+
const git = getGitSummaryForWorkspace(workspace, options);
|
|
191
206
|
return {
|
|
192
207
|
id: ext.instanceId || `${parent.instanceId}:${ext.type}`,
|
|
193
208
|
parentId: parent.instanceId || parent.type,
|
|
@@ -200,7 +215,8 @@ function buildExtensionAgentSession(
|
|
|
200
215
|
activeModal: activeChat?.activeModal || null,
|
|
201
216
|
}),
|
|
202
217
|
title: activeChat?.title || ext.name,
|
|
203
|
-
workspace
|
|
218
|
+
workspace,
|
|
219
|
+
...(git && { git }),
|
|
204
220
|
activeChat,
|
|
205
221
|
...(summaryMetadata && { summaryMetadata }),
|
|
206
222
|
...(includeSessionMetadata && { capabilities: ext.sessionCapabilities || EXTENSION_SESSION_CAPABILITIES }),
|
|
@@ -249,6 +265,8 @@ function buildCliSession(state: CliProviderState, options: SessionEntryBuildOpti
|
|
|
249
265
|
const includeSessionMetadata = shouldIncludeSessionMetadata(profile);
|
|
250
266
|
const includeRuntimeMetadata = shouldIncludeRuntimeMetadata(profile);
|
|
251
267
|
const includeSessionControls = shouldIncludeSessionControls(profile);
|
|
268
|
+
const workspace = state.workspace || null;
|
|
269
|
+
const git = getGitSummaryForWorkspace(workspace, options);
|
|
252
270
|
return {
|
|
253
271
|
id: state.instanceId,
|
|
254
272
|
parentId: null,
|
|
@@ -261,7 +279,8 @@ function buildCliSession(state: CliProviderState, options: SessionEntryBuildOpti
|
|
|
261
279
|
activeModal: activeChat?.activeModal || null,
|
|
262
280
|
}),
|
|
263
281
|
title: activeChat?.title || state.name,
|
|
264
|
-
workspace
|
|
282
|
+
workspace,
|
|
283
|
+
...(git && { git }),
|
|
265
284
|
...(includeRuntimeMetadata && {
|
|
266
285
|
runtimeKey: state.runtime?.runtimeKey,
|
|
267
286
|
runtimeDisplayName: state.runtime?.displayName,
|
|
@@ -297,6 +316,8 @@ function buildAcpSession(state: AcpProviderState, options: SessionEntryBuildOpti
|
|
|
297
316
|
const controlValues = normalizeProviderStateControlValues(state.controlValues);
|
|
298
317
|
const includeSessionMetadata = shouldIncludeSessionMetadata(profile);
|
|
299
318
|
const includeSessionControls = shouldIncludeSessionControls(profile);
|
|
319
|
+
const workspace = state.workspace || null;
|
|
320
|
+
const git = getGitSummaryForWorkspace(workspace, options);
|
|
300
321
|
return {
|
|
301
322
|
id: state.instanceId,
|
|
302
323
|
parentId: null,
|
|
@@ -308,7 +329,8 @@ function buildAcpSession(state: AcpProviderState, options: SessionEntryBuildOpti
|
|
|
308
329
|
activeModal: activeChat?.activeModal || null,
|
|
309
330
|
}),
|
|
310
331
|
title: activeChat?.title || state.name,
|
|
311
|
-
workspace
|
|
332
|
+
workspace,
|
|
333
|
+
...(git && { git }),
|
|
312
334
|
activeChat,
|
|
313
335
|
...(summaryMetadata && { summaryMetadata }),
|
|
314
336
|
...(includeSessionMetadata && { capabilities: ACP_SESSION_CAPABILITIES }),
|
package/src/status/snapshot.ts
CHANGED
|
@@ -15,6 +15,7 @@ import { getHostMemorySnapshot } from '../system/host-memory.js';
|
|
|
15
15
|
import { getTerminalBackendRuntimeStatus } from '../cli-adapters/terminal-screen.js';
|
|
16
16
|
import { LOG } from '../logging/logger.js';
|
|
17
17
|
import type { DaemonCdpManager } from '../cdp/manager.js';
|
|
18
|
+
import type { GitCompactSummary } from '../git/git-types.js';
|
|
18
19
|
import { buildSessionEntries, isCdpConnected, type SessionEntryProfile } from './builders.js';
|
|
19
20
|
import { LIVE_STATUS_ACTIVE_CHAT_OPTIONS, normalizeActiveChatData } from './normalize.js';
|
|
20
21
|
import type { ProviderState } from '../providers/provider-instance.js';
|
|
@@ -64,6 +65,7 @@ export interface StatusSnapshotOptions {
|
|
|
64
65
|
p2p?: StatusReportPayload['p2p'];
|
|
65
66
|
machineNickname?: string | null;
|
|
66
67
|
profile?: SessionEntryProfile;
|
|
68
|
+
getGitSummaryForWorkspace?: (workspace: string) => GitCompactSummary | null | undefined;
|
|
67
69
|
}
|
|
68
70
|
|
|
69
71
|
export type StatusSnapshot = StatusReportPayload;
|
|
@@ -390,7 +392,10 @@ export function buildStatusSnapshot(options: StatusSnapshotOptions): StatusSnaps
|
|
|
390
392
|
const unreadSourceSessions = buildSessionEntries(
|
|
391
393
|
options.allStates,
|
|
392
394
|
options.cdpManagers,
|
|
393
|
-
{
|
|
395
|
+
{
|
|
396
|
+
profile: 'full',
|
|
397
|
+
getGitSummaryForWorkspace: options.getGitSummaryForWorkspace,
|
|
398
|
+
},
|
|
394
399
|
);
|
|
395
400
|
const sessions = profile === 'full'
|
|
396
401
|
? unreadSourceSessions
|
|
@@ -399,7 +404,10 @@ export function buildStatusSnapshot(options: StatusSnapshotOptions): StatusSnaps
|
|
|
399
404
|
: buildSessionEntries(
|
|
400
405
|
options.allStates,
|
|
401
406
|
options.cdpManagers,
|
|
402
|
-
{
|
|
407
|
+
{
|
|
408
|
+
profile,
|
|
409
|
+
getGitSummaryForWorkspace: options.getGitSummaryForWorkspace,
|
|
410
|
+
},
|
|
403
411
|
);
|
|
404
412
|
const sessionsById = new Map(sessions.map((session) => [session.id, session]));
|
|
405
413
|
for (const sourceSession of unreadSourceSessions) {
|