@adhdev/daemon-core 0.9.53 → 0.9.55
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/boot/daemon-lifecycle.d.ts +5 -0
- package/dist/cli-adapters/provider-cli-adapter.d.ts +1 -0
- package/dist/cli-adapters/provider-cli-config.d.ts +1 -0
- package/dist/cli-adapters/provider-cli-shared.d.ts +2 -0
- package/dist/commands/handler.d.ts +7 -0
- package/dist/git/git-commands.d.ts +139 -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 +16 -0
- package/dist/git/turn-snapshot-tracker.d.ts +16 -0
- package/dist/index.d.ts +2 -1
- package/dist/index.js +1772 -386
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +1744 -383
- package/dist/index.mjs.map +1 -1
- package/dist/providers/contracts.d.ts +2 -0
- 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/boot/daemon-lifecycle.ts +6 -0
- package/src/cli-adapters/provider-cli-adapter.ts +19 -0
- package/src/cli-adapters/provider-cli-config.d.ts +1 -0
- package/src/cli-adapters/provider-cli-config.ts +2 -0
- package/src/cli-adapters/provider-cli-shared.d.ts +2 -0
- package/src/cli-adapters/provider-cli-shared.ts +2 -0
- package/src/commands/handler.ts +25 -1
- package/src/git/git-commands.ts +582 -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 +154 -0
- package/src/git/index.ts +75 -0
- package/src/git/turn-snapshot-tracker.ts +31 -0
- package/src/index.ts +4 -0
- package/src/providers/contracts.d.ts +8 -0
- package/src/providers/contracts.ts +2 -0
- package/src/providers/provider-schema.ts +1 -0
- package/src/shared-types.ts +33 -1
- package/src/status/builders.ts +26 -4
- package/src/status/snapshot.ts +10 -2
|
@@ -52,6 +52,11 @@ export interface DaemonInitConfig {
|
|
|
52
52
|
statusInstanceId?: string;
|
|
53
53
|
statusVersion?: string;
|
|
54
54
|
statusDaemonMode?: boolean;
|
|
55
|
+
/** Fired before send_chat is dispatched — used for turn snapshot hooks */
|
|
56
|
+
onBeforeSendChat?: (params: {
|
|
57
|
+
workspace: string;
|
|
58
|
+
sessionId: string;
|
|
59
|
+
}) => void;
|
|
55
60
|
}
|
|
56
61
|
export interface DaemonComponents {
|
|
57
62
|
providerLoader: ProviderLoader;
|
|
@@ -136,6 +136,7 @@ export declare class ProviderCliAdapter implements CliAdapter {
|
|
|
136
136
|
private readonly sendDelayMs;
|
|
137
137
|
private readonly sendKey;
|
|
138
138
|
private readonly submitStrategy;
|
|
139
|
+
private readonly requirePromptEchoBeforeSubmit;
|
|
139
140
|
private static readonly SCRIPT_STATUS_DEBOUNCE_MS;
|
|
140
141
|
constructor(provider: CliProviderModule, workingDir: string, extraArgs?: string[], transportFactory?: PtyTransportFactory);
|
|
141
142
|
/** Inject CLI scripts after construction (e.g. when resolved by ProviderLoader) */
|
|
@@ -27,6 +27,7 @@ export interface ResolvedCliAdapterConfig {
|
|
|
27
27
|
sendDelayMs: number;
|
|
28
28
|
sendKey: string;
|
|
29
29
|
submitStrategy: 'wait_for_echo' | 'immediate';
|
|
30
|
+
requirePromptEchoBeforeSubmit: boolean;
|
|
30
31
|
providerResolutionMeta: ProviderResolutionMeta;
|
|
31
32
|
}
|
|
32
33
|
export declare function resolveCliAdapterConfig(provider: CliProviderModule): ResolvedCliAdapterConfig;
|
|
@@ -123,6 +123,8 @@ export interface CliProviderModule {
|
|
|
123
123
|
sendDelayMs?: number;
|
|
124
124
|
sendKey?: string;
|
|
125
125
|
submitStrategy?: 'wait_for_echo' | 'immediate';
|
|
126
|
+
/** Require the typed prompt to be visible on the PTY screen before sending Enter. */
|
|
127
|
+
requirePromptEchoBeforeSubmit?: boolean;
|
|
126
128
|
/** Allow sending another prompt while the CLI is still generating so users can intervene mid-turn. */
|
|
127
129
|
allowInputDuringGeneration?: boolean;
|
|
128
130
|
/** When provider-owned, daemon treats provider parser output as canonical transcript authority. */
|
|
@@ -18,6 +18,7 @@ import type { DaemonAgentStreamManager } from '../agent-stream/index.js';
|
|
|
18
18
|
import type { CliAdapter } from '../cli-adapter-types.js';
|
|
19
19
|
import { ChatHistoryWriter } from '../config/chat-history.js';
|
|
20
20
|
import type { SessionRegistry, SessionRuntimeTarget } from '../sessions/registry.js';
|
|
21
|
+
import { type GitCommandServices } from '../git/git-commands.js';
|
|
21
22
|
export interface CommandResult {
|
|
22
23
|
success: boolean;
|
|
23
24
|
[key: string]: unknown;
|
|
@@ -32,6 +33,12 @@ export interface CommandContext {
|
|
|
32
33
|
sessionRegistry?: SessionRegistry;
|
|
33
34
|
onProviderSettingChanged?: (providerType: string, key: string, value: any) => Promise<void> | void;
|
|
34
35
|
onProviderSourceConfigChanged?: () => Promise<void> | void;
|
|
36
|
+
gitCommandServices?: GitCommandServices;
|
|
37
|
+
/** Fired synchronously before send_chat is dispatched; fire-and-forget for callers */
|
|
38
|
+
onBeforeSendChat?: (params: {
|
|
39
|
+
workspace: string;
|
|
40
|
+
sessionId: string;
|
|
41
|
+
}) => void;
|
|
35
42
|
}
|
|
36
43
|
/**
|
|
37
44
|
* Shared helpers interface — passed to sub-module command functions
|
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
import type { GitCommandName, GitDiffSummary, GitFailureReason, GitRepoIdentity, GitRepoStatus, GitSnapshot, GitSnapshotCompareSummary, GitSnapshotReason } from './git-types.js';
|
|
2
|
+
export interface GitFileDiff extends GitRepoIdentity {
|
|
3
|
+
path: string;
|
|
4
|
+
oldPath?: string;
|
|
5
|
+
staged?: boolean;
|
|
6
|
+
diff: string;
|
|
7
|
+
binary?: boolean;
|
|
8
|
+
truncated?: boolean;
|
|
9
|
+
lastCheckedAt: number;
|
|
10
|
+
}
|
|
11
|
+
export interface GitLogEntry {
|
|
12
|
+
commit: string;
|
|
13
|
+
message: string;
|
|
14
|
+
authorName?: string;
|
|
15
|
+
authorEmail?: string;
|
|
16
|
+
authoredAt?: number;
|
|
17
|
+
committedAt?: number;
|
|
18
|
+
}
|
|
19
|
+
export interface GitLogResult extends GitRepoIdentity {
|
|
20
|
+
entries: GitLogEntry[];
|
|
21
|
+
limit: number;
|
|
22
|
+
truncated: boolean;
|
|
23
|
+
lastCheckedAt: number;
|
|
24
|
+
}
|
|
25
|
+
export interface GitCheckpointResult extends GitRepoIdentity {
|
|
26
|
+
commit: string;
|
|
27
|
+
message: string;
|
|
28
|
+
lastCheckedAt: number;
|
|
29
|
+
}
|
|
30
|
+
export interface GitStashPushResult extends GitRepoIdentity {
|
|
31
|
+
stashRef: string;
|
|
32
|
+
message: string;
|
|
33
|
+
lastCheckedAt: number;
|
|
34
|
+
}
|
|
35
|
+
export interface GitCommandServices {
|
|
36
|
+
getStatus?: (params: {
|
|
37
|
+
workspace: string;
|
|
38
|
+
}) => Promise<GitRepoStatus> | GitRepoStatus;
|
|
39
|
+
getDiffSummary?: (params: {
|
|
40
|
+
workspace: string;
|
|
41
|
+
staged?: boolean;
|
|
42
|
+
}) => Promise<GitDiffSummary> | GitDiffSummary;
|
|
43
|
+
getDiffFile?: (params: {
|
|
44
|
+
workspace: string;
|
|
45
|
+
path: string;
|
|
46
|
+
staged?: boolean;
|
|
47
|
+
}) => Promise<GitFileDiff> | GitFileDiff;
|
|
48
|
+
createSnapshot?: (params: {
|
|
49
|
+
workspace: string;
|
|
50
|
+
reason: GitSnapshotReason;
|
|
51
|
+
sessionId?: string;
|
|
52
|
+
turnId?: string;
|
|
53
|
+
}) => Promise<GitSnapshot> | GitSnapshot;
|
|
54
|
+
compareSnapshots?: (params: {
|
|
55
|
+
workspace: string;
|
|
56
|
+
beforeSnapshotId: string;
|
|
57
|
+
afterSnapshotId: string;
|
|
58
|
+
}) => Promise<GitSnapshotCompareSummary> | GitSnapshotCompareSummary;
|
|
59
|
+
getLog?: (params: {
|
|
60
|
+
workspace: string;
|
|
61
|
+
limit: number;
|
|
62
|
+
path?: string;
|
|
63
|
+
since?: string;
|
|
64
|
+
until?: string;
|
|
65
|
+
}) => Promise<GitLogResult> | GitLogResult;
|
|
66
|
+
checkpoint?: (params: {
|
|
67
|
+
workspace: string;
|
|
68
|
+
message: string;
|
|
69
|
+
includeUntracked?: boolean;
|
|
70
|
+
}) => Promise<GitCheckpointResult> | GitCheckpointResult;
|
|
71
|
+
stashPush?: (params: {
|
|
72
|
+
workspace: string;
|
|
73
|
+
message: string;
|
|
74
|
+
includeUntracked?: boolean;
|
|
75
|
+
}) => Promise<GitStashPushResult> | GitStashPushResult;
|
|
76
|
+
stashPop?: (params: {
|
|
77
|
+
workspace: string;
|
|
78
|
+
stashRef?: string;
|
|
79
|
+
}) => Promise<void>;
|
|
80
|
+
checkoutFiles?: (params: {
|
|
81
|
+
workspace: string;
|
|
82
|
+
paths: string[];
|
|
83
|
+
}) => Promise<{
|
|
84
|
+
checkedOut: string[];
|
|
85
|
+
}>;
|
|
86
|
+
getRemoteUrl?: (params: {
|
|
87
|
+
workspace: string;
|
|
88
|
+
remote?: string;
|
|
89
|
+
}) => Promise<{
|
|
90
|
+
remoteUrl: string;
|
|
91
|
+
remote: string;
|
|
92
|
+
}>;
|
|
93
|
+
}
|
|
94
|
+
type GitCommandFailure = {
|
|
95
|
+
success: false;
|
|
96
|
+
reason: GitFailureReason;
|
|
97
|
+
error: string;
|
|
98
|
+
};
|
|
99
|
+
type GitCommandSuccess = {
|
|
100
|
+
success: true;
|
|
101
|
+
status: GitRepoStatus;
|
|
102
|
+
} | {
|
|
103
|
+
success: true;
|
|
104
|
+
diffSummary: GitDiffSummary;
|
|
105
|
+
} | {
|
|
106
|
+
success: true;
|
|
107
|
+
diff: GitFileDiff;
|
|
108
|
+
} | {
|
|
109
|
+
success: true;
|
|
110
|
+
snapshot: GitSnapshot;
|
|
111
|
+
} | {
|
|
112
|
+
success: true;
|
|
113
|
+
compare: GitSnapshotCompareSummary;
|
|
114
|
+
} | {
|
|
115
|
+
success: true;
|
|
116
|
+
log: GitLogResult;
|
|
117
|
+
} | {
|
|
118
|
+
success: true;
|
|
119
|
+
checkpoint: GitCheckpointResult;
|
|
120
|
+
} | {
|
|
121
|
+
success: true;
|
|
122
|
+
stash: GitStashPushResult;
|
|
123
|
+
} | {
|
|
124
|
+
success: true;
|
|
125
|
+
stashPopped: true;
|
|
126
|
+
} | {
|
|
127
|
+
success: true;
|
|
128
|
+
checkedOut: string[];
|
|
129
|
+
} | {
|
|
130
|
+
success: true;
|
|
131
|
+
remoteUrl: string;
|
|
132
|
+
remote: string;
|
|
133
|
+
};
|
|
134
|
+
export type GitCommandResult = GitCommandSuccess | GitCommandFailure;
|
|
135
|
+
export declare function createDefaultGitCommandServices(): GitCommandServices;
|
|
136
|
+
export declare function isGitCommandName(command: string): command is GitCommandName;
|
|
137
|
+
export declare function handleGitCommand(command: GitCommandName, args: any, services?: GitCommandServices): Promise<GitCommandResult>;
|
|
138
|
+
export declare function handleGitCommand(command: string, args: any, services?: GitCommandServices): Promise<GitCommandResult>;
|
|
139
|
+
export {};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { GitDiffSummary } from './git-types.js';
|
|
2
|
+
export interface GitDiffOptions {
|
|
3
|
+
timeoutMs?: number;
|
|
4
|
+
maxFiles?: number;
|
|
5
|
+
maxBytes?: number;
|
|
6
|
+
}
|
|
7
|
+
export interface GitFileDiffResult {
|
|
8
|
+
workspace: string;
|
|
9
|
+
repoRoot: string;
|
|
10
|
+
isGitRepo: true;
|
|
11
|
+
path: string;
|
|
12
|
+
diff: string;
|
|
13
|
+
truncated: boolean;
|
|
14
|
+
lastCheckedAt: number;
|
|
15
|
+
}
|
|
16
|
+
export declare function getGitDiffSummary(workspace: string, options?: GitDiffOptions): Promise<GitDiffSummary>;
|
|
17
|
+
export declare function getGitFileDiff(workspace: string, filePath: string, options?: GitDiffOptions): Promise<GitFileDiffResult>;
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import type { GitFailureReason, GitRepoIdentity } from './git-types.js';
|
|
2
|
+
export interface GitExecutorOptions {
|
|
3
|
+
timeoutMs?: number;
|
|
4
|
+
maxBuffer?: number;
|
|
5
|
+
}
|
|
6
|
+
export interface RunGitOptions extends GitExecutorOptions {
|
|
7
|
+
cwd?: string;
|
|
8
|
+
}
|
|
9
|
+
export interface GitCommandResult {
|
|
10
|
+
stdout: string;
|
|
11
|
+
stderr: string;
|
|
12
|
+
}
|
|
13
|
+
export declare class GitCommandError extends Error {
|
|
14
|
+
readonly reason: GitFailureReason;
|
|
15
|
+
readonly stdout: string;
|
|
16
|
+
readonly stderr: string;
|
|
17
|
+
readonly exitCode?: number | string;
|
|
18
|
+
readonly signal?: NodeJS.Signals | string;
|
|
19
|
+
readonly argv?: string[];
|
|
20
|
+
readonly cwd?: string;
|
|
21
|
+
constructor(reason: GitFailureReason, message: string, details?: {
|
|
22
|
+
stdout?: unknown;
|
|
23
|
+
stderr?: unknown;
|
|
24
|
+
exitCode?: number | string;
|
|
25
|
+
signal?: NodeJS.Signals | string;
|
|
26
|
+
argv?: readonly string[];
|
|
27
|
+
cwd?: string;
|
|
28
|
+
cause?: unknown;
|
|
29
|
+
});
|
|
30
|
+
}
|
|
31
|
+
export declare function resolveGitRepository(workspace: string, options?: GitExecutorOptions): Promise<GitRepoIdentity>;
|
|
32
|
+
export declare function runGit(repoOrWorkspace: GitRepoIdentity | string, argv: readonly string[], options?: RunGitOptions): Promise<GitCommandResult>;
|
|
33
|
+
export declare function normalizeGitOutput(value: unknown): string;
|
|
34
|
+
export declare function isPathInside(parent: string, child: string): boolean;
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import type { GitCompactSummary, GitDiffSummary, GitRepoStatus, GitWorkspaceUpdate, WorkspaceGitSubscriptionParams } from './git-types.js';
|
|
2
|
+
import type { GitDiffSummaryProvider, GitStatusProvider } from './git-snapshot-store.js';
|
|
3
|
+
export declare const DEFAULT_GIT_WORKSPACE_POLL_INTERVAL_MS = 5000;
|
|
4
|
+
export declare const MIN_GIT_WORKSPACE_POLL_INTERVAL_MS = 1000;
|
|
5
|
+
export interface NormalizeGitWorkspaceSubscriptionOptions {
|
|
6
|
+
defaultIntervalMs?: number;
|
|
7
|
+
minIntervalMs?: number;
|
|
8
|
+
}
|
|
9
|
+
export interface NormalizedWorkspaceGitSubscriptionParams extends Required<WorkspaceGitSubscriptionParams> {
|
|
10
|
+
}
|
|
11
|
+
export interface GitWorkspaceCacheEntry {
|
|
12
|
+
key: string;
|
|
13
|
+
workspace: string;
|
|
14
|
+
status: GitRepoStatus;
|
|
15
|
+
diffSummary?: GitDiffSummary;
|
|
16
|
+
compactSummary: GitCompactSummary;
|
|
17
|
+
seq: number;
|
|
18
|
+
timestamp: number;
|
|
19
|
+
}
|
|
20
|
+
export type GitWorkspaceUpdateListener = (update: GitWorkspaceUpdate, cacheEntry: GitWorkspaceCacheEntry) => void;
|
|
21
|
+
export interface GitWorkspaceMonitorOptions {
|
|
22
|
+
getStatus?: GitStatusProvider;
|
|
23
|
+
getDiffSummary?: GitDiffSummaryProvider;
|
|
24
|
+
now?: () => number;
|
|
25
|
+
minIntervalMs?: number;
|
|
26
|
+
defaultIntervalMs?: number;
|
|
27
|
+
keyPrefix?: string;
|
|
28
|
+
}
|
|
29
|
+
export interface GitWorkspaceSubscription {
|
|
30
|
+
params: NormalizedWorkspaceGitSubscriptionParams;
|
|
31
|
+
refresh(): Promise<GitWorkspaceUpdate>;
|
|
32
|
+
getCached(): GitWorkspaceCacheEntry | undefined;
|
|
33
|
+
dispose(): void;
|
|
34
|
+
}
|
|
35
|
+
export declare function normalizeGitWorkspaceSubscriptionParams(params: WorkspaceGitSubscriptionParams, options?: NormalizeGitWorkspaceSubscriptionOptions): NormalizedWorkspaceGitSubscriptionParams;
|
|
36
|
+
export declare class GitWorkspaceMonitor {
|
|
37
|
+
private readonly getStatusProvider;
|
|
38
|
+
private readonly getDiffSummaryProvider;
|
|
39
|
+
private readonly now;
|
|
40
|
+
private readonly minIntervalMs;
|
|
41
|
+
private readonly defaultIntervalMs;
|
|
42
|
+
private readonly keyPrefix;
|
|
43
|
+
private readonly cache;
|
|
44
|
+
private readonly listeners;
|
|
45
|
+
private seq;
|
|
46
|
+
constructor(options?: GitWorkspaceMonitorOptions);
|
|
47
|
+
refresh(params: string | WorkspaceGitSubscriptionParams): Promise<GitWorkspaceUpdate>;
|
|
48
|
+
poll(params: string | WorkspaceGitSubscriptionParams): Promise<GitWorkspaceUpdate>;
|
|
49
|
+
getCached(workspace: string): GitWorkspaceCacheEntry | undefined;
|
|
50
|
+
getCompactSummary(workspace: string): GitCompactSummary | undefined;
|
|
51
|
+
onUpdate(listener: GitWorkspaceUpdateListener): () => void;
|
|
52
|
+
createSubscription(params: WorkspaceGitSubscriptionParams, listener?: GitWorkspaceUpdateListener): GitWorkspaceSubscription;
|
|
53
|
+
normalize(params: WorkspaceGitSubscriptionParams): NormalizedWorkspaceGitSubscriptionParams;
|
|
54
|
+
private keyForWorkspace;
|
|
55
|
+
private emit;
|
|
56
|
+
}
|
|
57
|
+
export declare function createGitWorkspaceMonitor(options?: GitWorkspaceMonitorOptions): GitWorkspaceMonitor;
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import type { GitDiffSummary, GitRepoStatus, GitSnapshot, GitSnapshotCompareSummary, GitSnapshotReason } from './git-types.js';
|
|
2
|
+
export type MaybePromise<T> = T | Promise<T>;
|
|
3
|
+
export type GitStatusProvider = (workspace: string) => MaybePromise<GitRepoStatus>;
|
|
4
|
+
export type GitDiffSummaryProvider = (workspace: string, status: GitRepoStatus) => MaybePromise<GitDiffSummary>;
|
|
5
|
+
export interface GitSnapshotStoreOptions {
|
|
6
|
+
capacity?: number;
|
|
7
|
+
getStatus?: GitStatusProvider;
|
|
8
|
+
getDiffSummary?: GitDiffSummaryProvider;
|
|
9
|
+
now?: () => number;
|
|
10
|
+
idPrefix?: string;
|
|
11
|
+
}
|
|
12
|
+
export interface GitSnapshotCreateInput {
|
|
13
|
+
workspace: string;
|
|
14
|
+
reason: GitSnapshotReason;
|
|
15
|
+
sessionId?: string;
|
|
16
|
+
turnId?: string;
|
|
17
|
+
getStatus?: GitStatusProvider;
|
|
18
|
+
getDiffSummary?: GitDiffSummaryProvider;
|
|
19
|
+
}
|
|
20
|
+
export interface GitSnapshotListQuery {
|
|
21
|
+
workspace?: string;
|
|
22
|
+
sessionId?: string;
|
|
23
|
+
limit?: number;
|
|
24
|
+
}
|
|
25
|
+
export interface GitSnapshotStore {
|
|
26
|
+
create(input: GitSnapshotCreateInput): Promise<GitSnapshot>;
|
|
27
|
+
get(id: string): GitSnapshot | undefined;
|
|
28
|
+
compare(beforeSnapshotId: string, afterSnapshotId: string): GitSnapshotCompareSummary;
|
|
29
|
+
list(query?: GitSnapshotListQuery): GitSnapshot[];
|
|
30
|
+
clear(): void;
|
|
31
|
+
}
|
|
32
|
+
export declare function compareGitSnapshots(before: GitSnapshot, after: GitSnapshot): GitSnapshotCompareSummary;
|
|
33
|
+
export declare class InMemoryGitSnapshotStore implements GitSnapshotStore {
|
|
34
|
+
private readonly snapshots;
|
|
35
|
+
private readonly order;
|
|
36
|
+
private readonly capacity;
|
|
37
|
+
private readonly now;
|
|
38
|
+
private readonly idPrefix;
|
|
39
|
+
private readonly getStatusProvider?;
|
|
40
|
+
private readonly getDiffSummaryProvider?;
|
|
41
|
+
private counter;
|
|
42
|
+
constructor(options?: GitSnapshotStoreOptions);
|
|
43
|
+
create(input: GitSnapshotCreateInput): Promise<GitSnapshot>;
|
|
44
|
+
get(id: string): GitSnapshot | undefined;
|
|
45
|
+
compare(beforeSnapshotId: string, afterSnapshotId: string): GitSnapshotCompareSummary;
|
|
46
|
+
list(query?: GitSnapshotListQuery): GitSnapshot[];
|
|
47
|
+
clear(): void;
|
|
48
|
+
private enforceCapacity;
|
|
49
|
+
}
|
|
50
|
+
export declare function createGitSnapshotStore(options?: GitSnapshotStoreOptions): GitSnapshotStore;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { GitRepoStatus } from './git-types.js';
|
|
2
|
+
export interface GitStatusOptions {
|
|
3
|
+
timeoutMs?: number;
|
|
4
|
+
}
|
|
5
|
+
export declare function getGitRepoStatus(workspace: string, options?: GitStatusOptions): Promise<GitRepoStatus>;
|
|
6
|
+
interface ParsedPorcelainStatus {
|
|
7
|
+
branch: string | null;
|
|
8
|
+
upstream: string | null;
|
|
9
|
+
ahead: number;
|
|
10
|
+
behind: number;
|
|
11
|
+
staged: number;
|
|
12
|
+
modified: number;
|
|
13
|
+
untracked: number;
|
|
14
|
+
deleted: number;
|
|
15
|
+
renamed: number;
|
|
16
|
+
conflictFiles: string[];
|
|
17
|
+
}
|
|
18
|
+
export declare function parsePorcelainV2Status(output: string): ParsedPorcelainStatus;
|
|
19
|
+
export {};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { GitCompactSummary, GitDiffSummary, GitRepoStatus } from './git-types.js';
|
|
2
|
+
/**
|
|
3
|
+
* Build the small Git shape suitable for session lists and topic summaries.
|
|
4
|
+
*
|
|
5
|
+
* This helper intentionally preserves non-git/error information as plain fields
|
|
6
|
+
* instead of turning expected states (for example `not_git_repo`) into alarming
|
|
7
|
+
* derived messages.
|
|
8
|
+
*/
|
|
9
|
+
export declare function createGitCompactSummary(status: GitRepoStatus, diffSummary?: GitDiffSummary): GitCompactSummary;
|
|
10
|
+
export declare const summarizeGitStatus: typeof createGitCompactSummary;
|
|
@@ -0,0 +1,113 @@
|
|
|
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
|
+
export type GitFailureReason = 'not_git_repo' | 'git_not_installed' | 'timeout' | 'path_outside_repo' | 'dirty_index_required' | 'conflict' | 'invalid_args' | 'git_command_failed';
|
|
9
|
+
export interface GitRepoIdentity {
|
|
10
|
+
workspace: string;
|
|
11
|
+
repoRoot: string | null;
|
|
12
|
+
isGitRepo: boolean;
|
|
13
|
+
}
|
|
14
|
+
export interface GitRepoStatus extends GitRepoIdentity {
|
|
15
|
+
branch: string | null;
|
|
16
|
+
headCommit: string | null;
|
|
17
|
+
headMessage: string | null;
|
|
18
|
+
upstream: string | null;
|
|
19
|
+
ahead: number;
|
|
20
|
+
behind: number;
|
|
21
|
+
staged: number;
|
|
22
|
+
modified: number;
|
|
23
|
+
untracked: number;
|
|
24
|
+
deleted: number;
|
|
25
|
+
renamed: number;
|
|
26
|
+
hasConflicts: boolean;
|
|
27
|
+
conflictFiles: string[];
|
|
28
|
+
stashCount: number;
|
|
29
|
+
lastCheckedAt: number;
|
|
30
|
+
error?: string;
|
|
31
|
+
reason?: GitFailureReason;
|
|
32
|
+
}
|
|
33
|
+
export type GitFileChangeStatus = 'added' | 'modified' | 'deleted' | 'renamed' | 'copied' | 'untracked' | 'conflict';
|
|
34
|
+
export interface GitFileChange {
|
|
35
|
+
path: string;
|
|
36
|
+
oldPath?: string;
|
|
37
|
+
status: GitFileChangeStatus;
|
|
38
|
+
staged: boolean;
|
|
39
|
+
insertions: number;
|
|
40
|
+
deletions: number;
|
|
41
|
+
binary?: boolean;
|
|
42
|
+
truncated?: boolean;
|
|
43
|
+
}
|
|
44
|
+
export interface GitDiffSummary extends GitRepoIdentity {
|
|
45
|
+
files: GitFileChange[];
|
|
46
|
+
totalInsertions: number;
|
|
47
|
+
totalDeletions: number;
|
|
48
|
+
truncated: boolean;
|
|
49
|
+
lastCheckedAt: number;
|
|
50
|
+
error?: string;
|
|
51
|
+
reason?: GitFailureReason;
|
|
52
|
+
}
|
|
53
|
+
export type GitSnapshotReason = 'session_baseline' | 'before_user_input_dispatch' | 'before_agent_work' | 'after_agent_work' | 'manual';
|
|
54
|
+
export interface GitSnapshot {
|
|
55
|
+
id: string;
|
|
56
|
+
workspace: string;
|
|
57
|
+
repoRoot: string;
|
|
58
|
+
sessionId?: string;
|
|
59
|
+
turnId?: string;
|
|
60
|
+
reason: GitSnapshotReason;
|
|
61
|
+
status: GitRepoStatus;
|
|
62
|
+
diffSummary: GitDiffSummary;
|
|
63
|
+
createdAt: number;
|
|
64
|
+
}
|
|
65
|
+
export interface GitSnapshotCompareSummary {
|
|
66
|
+
beforeSnapshotId: string;
|
|
67
|
+
afterSnapshotId: string;
|
|
68
|
+
workspace: string;
|
|
69
|
+
repoRoot: string;
|
|
70
|
+
changedFiles: number;
|
|
71
|
+
addedFiles: string[];
|
|
72
|
+
modifiedFiles: string[];
|
|
73
|
+
deletedFiles: string[];
|
|
74
|
+
renamedFiles: Array<{
|
|
75
|
+
oldPath: string;
|
|
76
|
+
path: string;
|
|
77
|
+
}>;
|
|
78
|
+
untrackedFiles: string[];
|
|
79
|
+
conflictFiles: string[];
|
|
80
|
+
totalInsertions: number;
|
|
81
|
+
totalDeletions: number;
|
|
82
|
+
hasConflicts: boolean;
|
|
83
|
+
currentStatus: GitRepoStatus;
|
|
84
|
+
summaryText: string;
|
|
85
|
+
}
|
|
86
|
+
export interface GitCompactSummary {
|
|
87
|
+
isGitRepo: boolean;
|
|
88
|
+
repoRoot: string | null;
|
|
89
|
+
branch: string | null;
|
|
90
|
+
dirty: boolean;
|
|
91
|
+
changedFiles: number;
|
|
92
|
+
ahead: number;
|
|
93
|
+
behind: number;
|
|
94
|
+
hasConflicts: boolean;
|
|
95
|
+
lastCheckedAt: number;
|
|
96
|
+
error?: string;
|
|
97
|
+
reason?: GitFailureReason;
|
|
98
|
+
}
|
|
99
|
+
export interface WorkspaceGitSubscriptionParams {
|
|
100
|
+
workspace: string;
|
|
101
|
+
includeDiffSummary?: boolean;
|
|
102
|
+
intervalMs?: number;
|
|
103
|
+
}
|
|
104
|
+
export interface GitWorkspaceUpdate {
|
|
105
|
+
topic: 'workspace.git';
|
|
106
|
+
key: string;
|
|
107
|
+
workspace: string;
|
|
108
|
+
status: GitRepoStatus;
|
|
109
|
+
diffSummary?: GitDiffSummary;
|
|
110
|
+
seq: number;
|
|
111
|
+
timestamp: number;
|
|
112
|
+
}
|
|
113
|
+
export type GitCommandName = 'git_status' | 'git_diff_summary' | 'git_diff_file' | 'git_snapshot_create' | 'git_snapshot_compare' | 'git_log' | 'git_checkpoint' | 'git_stash_push' | 'git_stash_pop' | 'git_checkout_files' | 'git_remote_url';
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export type { GitCommandName, GitCompactSummary, GitDiffSummary, GitFailureReason, GitFileChange, GitFileChangeStatus, GitRepoIdentity, GitRepoStatus, GitSnapshot, GitSnapshotCompareSummary, GitSnapshotReason, GitWorkspaceUpdate, WorkspaceGitSubscriptionParams, } from './git-types.js';
|
|
2
|
+
export { GitCommandError, isPathInside, normalizeGitOutput, resolveGitRepository, runGit, } from './git-executor.js';
|
|
3
|
+
export type { GitCommandResult as GitExecutorCommandResult, GitExecutorOptions, RunGitOptions } from './git-executor.js';
|
|
4
|
+
export { getGitRepoStatus, parsePorcelainV2Status } from './git-status.js';
|
|
5
|
+
export type { GitStatusOptions } from './git-status.js';
|
|
6
|
+
export { getGitDiffSummary, getGitFileDiff } from './git-diff.js';
|
|
7
|
+
export type { GitDiffOptions, GitFileDiffResult } from './git-diff.js';
|
|
8
|
+
export { createGitCompactSummary, summarizeGitStatus } from './git-summary.js';
|
|
9
|
+
export { compareGitSnapshots, createGitSnapshotStore, InMemoryGitSnapshotStore, } from './git-snapshot-store.js';
|
|
10
|
+
export type { GitDiffSummaryProvider, GitSnapshotCreateInput, GitSnapshotListQuery, GitSnapshotStore, GitSnapshotStoreOptions, GitStatusProvider, MaybePromise, } from './git-snapshot-store.js';
|
|
11
|
+
export { createGitWorkspaceMonitor, DEFAULT_GIT_WORKSPACE_POLL_INTERVAL_MS, GitWorkspaceMonitor, MIN_GIT_WORKSPACE_POLL_INTERVAL_MS, normalizeGitWorkspaceSubscriptionParams, } from './git-monitor.js';
|
|
12
|
+
export type { GitWorkspaceCacheEntry, GitWorkspaceMonitorOptions, GitWorkspaceSubscription, GitWorkspaceUpdateListener, NormalizedWorkspaceGitSubscriptionParams, NormalizeGitWorkspaceSubscriptionOptions, } from './git-monitor.js';
|
|
13
|
+
export { createDefaultGitCommandServices, handleGitCommand, isGitCommandName } from './git-commands.js';
|
|
14
|
+
export type { GitCommandResult, GitCommandServices, GitFileDiff, GitLogEntry, GitLogResult, } from './git-commands.js';
|
|
15
|
+
export { TurnSnapshotTracker } from './turn-snapshot-tracker.js';
|
|
16
|
+
export type { TurnCompletedCallback } from './turn-snapshot-tracker.js';
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Tracks agent session status transitions and fires snapshot callbacks on turn completion.
|
|
3
|
+
* "Busy" = streaming | waiting_approval
|
|
4
|
+
* "Completed" = idle | error (transition from busy)
|
|
5
|
+
*/
|
|
6
|
+
export type TurnCompletedCallback = (params: {
|
|
7
|
+
sessionId: string;
|
|
8
|
+
workspace: string;
|
|
9
|
+
}) => void;
|
|
10
|
+
export declare class TurnSnapshotTracker {
|
|
11
|
+
private lastStatus;
|
|
12
|
+
private onTurnCompleted;
|
|
13
|
+
constructor(onTurnCompleted: TurnCompletedCallback);
|
|
14
|
+
record(sessionId: string, status: string, workspace: string | null | undefined): void;
|
|
15
|
+
forget(sessionId: string): void;
|
|
16
|
+
}
|
package/dist/index.d.ts
CHANGED
|
@@ -4,7 +4,8 @@
|
|
|
4
4
|
* Core logic for daemon: CDP, Provider, IDE detection, CLI/ACP adapters and more.
|
|
5
5
|
*/
|
|
6
6
|
export type { ChatBubbleState, ChatMessage, ExtensionInfo, CommandResult as CoreCommandResult, ProviderConfig, DaemonEvent, StatusResponse, SystemInfo, DetectedIde, ProviderInfo, AgentEntry, } from './types.js';
|
|
7
|
-
export type { SessionEntry, CompactSessionEntry, CompactDaemonEntry, CloudDaemonSummaryEntry, DashboardBootstrapDaemonEntry, VersionUpdateReason, CloudStatusReportPayload, DaemonStatusEventPayload, DashboardStatusEventPayload, SessionTransport, SessionKind, SessionCapability, AgentSessionStream, ReadChatCursor, ReadChatSyncMode, ReadChatSyncResult, TransportTopic, SessionChatTailSubscriptionParams, SessionRuntimeOutputSubscriptionParams, MachineRuntimeSubscriptionParams, SessionHostDiagnosticsSubscriptionParams, SessionModalSubscriptionParams, DaemonMetadataSubscriptionParams, SessionChatTailUpdate, MachineRuntimeUpdate, SessionHostDiagnosticsUpdate, SessionModalUpdate, DaemonMetadataUpdate, TopicUpdateEnvelope, SubscribeRequest, UnsubscribeRequest, StandaloneWsStatusPayload, AvailableProviderInfo, AcpConfigOption, AcpMode, ProviderControlSchema, StatusReportPayload, MachineInfo, SessionHostDiagnosticsSnapshot, SessionHostRecord, SessionHostWriteOwner, SessionHostAttachedClient, SessionHostLogEntry, SessionHostRequestTrace, SessionHostRuntimeTransition, DetectedIdeInfo, WorkspaceEntry, ProviderSummaryItem, ProviderSummaryMetadata, ProviderState, ProviderStatus, ProviderErrorReason, SessionActiveChatData, ActiveChatData, IdeProviderState, CliProviderState, AcpProviderState, ExtensionProviderState, } from './shared-types.js';
|
|
7
|
+
export type { SessionEntry, CompactSessionEntry, CompactDaemonEntry, CloudDaemonSummaryEntry, DashboardBootstrapDaemonEntry, VersionUpdateReason, CloudStatusReportPayload, DaemonStatusEventPayload, DashboardStatusEventPayload, SessionTransport, SessionKind, SessionCapability, AgentSessionStream, ReadChatCursor, ReadChatSyncMode, ReadChatSyncResult, TransportTopic, SessionChatTailSubscriptionParams, SessionRuntimeOutputSubscriptionParams, MachineRuntimeSubscriptionParams, SessionHostDiagnosticsSubscriptionParams, SessionModalSubscriptionParams, DaemonMetadataSubscriptionParams, WorkspaceGitSubscriptionParams, SessionChatTailUpdate, MachineRuntimeUpdate, SessionHostDiagnosticsUpdate, SessionModalUpdate, DaemonMetadataUpdate, TopicUpdateEnvelope, SubscribeRequest, UnsubscribeRequest, StandaloneWsStatusPayload, AvailableProviderInfo, AcpConfigOption, AcpMode, ProviderControlSchema, StatusReportPayload, MachineInfo, SessionHostDiagnosticsSnapshot, SessionHostRecord, SessionHostWriteOwner, SessionHostAttachedClient, SessionHostLogEntry, SessionHostRequestTrace, SessionHostRuntimeTransition, DetectedIdeInfo, WorkspaceEntry, ProviderSummaryItem, ProviderSummaryMetadata, ProviderState, ProviderStatus, ProviderErrorReason, SessionActiveChatData, ActiveChatData, IdeProviderState, CliProviderState, AcpProviderState, ExtensionProviderState, } from './shared-types.js';
|
|
8
|
+
export * from './git/index.js';
|
|
8
9
|
import type { RuntimeWriteOwner as _RuntimeWriteOwner } from './shared-types-extra.js';
|
|
9
10
|
import type { RuntimeAttachedClient as _RuntimeAttachedClient } from './shared-types-extra.js';
|
|
10
11
|
import type { RecentLaunchEntry as _RecentLaunchEntry } from './shared-types.js';
|