@adhdev/daemon-core 0.9.82-rc.136 → 0.9.82-rc.137
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/cli-adapters/cli-script-runner.d.ts +45 -0
- package/dist/cli-adapters/cli-state-engine.d.ts +154 -0
- package/dist/cli-adapters/provider-cli-adapter.d.ts +73 -74
- package/dist/cli-adapters/provider-cli-shared.d.ts +4 -0
- package/dist/config/chat-history.d.ts +1 -0
- package/dist/index.d.ts +3 -3
- package/dist/index.js +2591 -1966
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +2594 -1974
- package/dist/index.mjs.map +1 -1
- package/dist/mesh/beads-db.d.ts +54 -0
- package/dist/mesh/mesh-active-work.d.ts +7 -1
- package/dist/mesh/mesh-events.d.ts +10 -4
- package/dist/mesh/mesh-ledger.d.ts +21 -1
- package/dist/mesh/mesh-refine-status.d.ts +2 -3
- package/dist/mesh/mesh-work-queue.d.ts +17 -0
- package/dist/mesh/worktree-bootstrap-config.d.ts +2 -4
- package/dist/repo-mesh-types.d.ts +5 -0
- package/package.json +1 -1
- package/src/cli-adapters/cli-script-runner.ts +145 -0
- package/src/cli-adapters/cli-state-engine.ts +957 -0
- package/src/cli-adapters/provider-cli-adapter.d.ts +0 -1
- package/src/cli-adapters/provider-cli-adapter.ts +365 -1397
- package/src/cli-adapters/provider-cli-shared.ts +4 -0
- package/src/commands/chat-commands.ts +17 -1
- package/src/commands/router.ts +8 -0
- package/src/config/chat-history.ts +7 -3
- package/src/git/git-worktree.ts +8 -1
- package/src/index.ts +3 -2
- package/src/mesh/beads-db.ts +305 -2
- package/src/mesh/coordinator-prompt.ts +12 -17
- package/src/mesh/mesh-active-work.ts +162 -59
- package/src/mesh/mesh-events.ts +198 -53
- package/src/mesh/mesh-ledger.ts +321 -105
- package/src/mesh/mesh-refine-status.ts +2 -3
- package/src/mesh/mesh-work-queue.ts +116 -120
- package/src/mesh/worktree-bootstrap-config.ts +17 -4
- package/src/providers/provider-schema.ts +2 -0
- package/src/repo-mesh-types.ts +10 -0
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* CliScriptRunner — isolated execution of provider CLI scripts
|
|
3
|
+
*
|
|
4
|
+
* Responsible solely for invoking provider-supplied JavaScript functions
|
|
5
|
+
* (detectStatus, parseApproval, parseSession, etc.) and managing the
|
|
6
|
+
* per-session script state created by createState().
|
|
7
|
+
*
|
|
8
|
+
* The runner is stateless with respect to PTY / buffer content — all
|
|
9
|
+
* input data is passed explicitly by the caller so that the adapter can
|
|
10
|
+
* remain a pure transport layer without embedding parsing logic.
|
|
11
|
+
*/
|
|
12
|
+
import { type CliApprovalInput, type CliScripts, type CliScriptInput, type CliScreenSnapshot, type CliStatusInput, type ParsedSession } from './provider-cli-shared.js';
|
|
13
|
+
export declare class CliScriptRunner {
|
|
14
|
+
private scripts;
|
|
15
|
+
private scriptState;
|
|
16
|
+
private _parseErrorMessage;
|
|
17
|
+
private readonly cliType;
|
|
18
|
+
constructor(cliType: string);
|
|
19
|
+
setScripts(scripts: CliScripts): void;
|
|
20
|
+
/** Reset per-session state — called when the PTY process exits. */
|
|
21
|
+
resetSessionState(): void;
|
|
22
|
+
/** Returns the live scripts object. Direct property assignment on this object
|
|
23
|
+
* patches individual scripts without replacing others (used in tests). */
|
|
24
|
+
get cliScripts(): CliScripts;
|
|
25
|
+
hasDetectStatus(): boolean;
|
|
26
|
+
hasParseSession(): boolean;
|
|
27
|
+
getScriptNames(): string[];
|
|
28
|
+
get parseErrorMessage(): string | null;
|
|
29
|
+
clearParseError(): void;
|
|
30
|
+
detectStatus(input: CliStatusInput): string | null;
|
|
31
|
+
parseApproval(input: CliApprovalInput): {
|
|
32
|
+
message: string;
|
|
33
|
+
buttons: string[];
|
|
34
|
+
} | null;
|
|
35
|
+
parseSession(input: CliScriptInput & {
|
|
36
|
+
tail?: string;
|
|
37
|
+
tailScreen?: CliScreenSnapshot;
|
|
38
|
+
}): ParsedSession | null;
|
|
39
|
+
/**
|
|
40
|
+
* Invoke an arbitrary named script (e.g. setModel, openModelPicker).
|
|
41
|
+
* Throws if the script is not available.
|
|
42
|
+
*/
|
|
43
|
+
invokeByName(name: string, input: any): any;
|
|
44
|
+
private invoke;
|
|
45
|
+
}
|
|
@@ -0,0 +1,154 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* CliStateEngine — CLI provider status state machine
|
|
3
|
+
*
|
|
4
|
+
* Owns all status-transition logic, timer management, and script-driven
|
|
5
|
+
* evaluation. Reads buffer state from the transport and writes to PTY via
|
|
6
|
+
* the transport interface — adapter stays as pure I/O layer.
|
|
7
|
+
*/
|
|
8
|
+
import { type TurnParseScope } from './provider-cli-parse.js';
|
|
9
|
+
import { type CliProviderModule, type CliSessionStatus, type CliTraceEntry, type ParsedSession } from './provider-cli-shared.js';
|
|
10
|
+
import type { CliScriptRunner } from './cli-script-runner.js';
|
|
11
|
+
export interface CliBufferSnapshot {
|
|
12
|
+
accumulatedBuffer: string;
|
|
13
|
+
accumulatedRawBuffer: string;
|
|
14
|
+
recentOutputBuffer: string;
|
|
15
|
+
responseBuffer: string;
|
|
16
|
+
screenText: string;
|
|
17
|
+
parseScreenText: string;
|
|
18
|
+
workingDir: string;
|
|
19
|
+
providerSessionId: string | null;
|
|
20
|
+
runtimeSettings: Record<string, any>;
|
|
21
|
+
isWaitingForResponse: boolean;
|
|
22
|
+
currentTurnScope: TurnParseScope | null;
|
|
23
|
+
lastOutputAt: number;
|
|
24
|
+
lastNonEmptyOutputAt: number;
|
|
25
|
+
lastScreenChangeAt: number;
|
|
26
|
+
lastScreenSnapshot: string;
|
|
27
|
+
}
|
|
28
|
+
/** What the engine needs from the transport layer */
|
|
29
|
+
export interface CliTransportAccess {
|
|
30
|
+
getSnapshot(): CliBufferSnapshot;
|
|
31
|
+
writeRaw(data: string | Buffer): void;
|
|
32
|
+
getApprovalKeyForIndex(buttonIndex: number): string | undefined;
|
|
33
|
+
flushOutboundQueue(): void;
|
|
34
|
+
isAlive(): boolean;
|
|
35
|
+
/** Optional: override script dispatch (used by tests to mock detection) */
|
|
36
|
+
runDetectStatus?(text: string): string | null;
|
|
37
|
+
/** Optional: override script dispatch (used by tests to mock approval) */
|
|
38
|
+
runParseApproval?(tail: string): {
|
|
39
|
+
message: string;
|
|
40
|
+
buttons: string[];
|
|
41
|
+
} | null;
|
|
42
|
+
/** Optional: override full session parse (used by tests to mock parsing) */
|
|
43
|
+
runParseSession?(): ParsedSession | null;
|
|
44
|
+
/** Optional: provider type override — used when tests patch the adapter's cliType */
|
|
45
|
+
cliType?: string;
|
|
46
|
+
}
|
|
47
|
+
export interface CliStateEngineCallbacks {
|
|
48
|
+
onStatusChange(): void;
|
|
49
|
+
onApplyParsedSession(session: ParsedSession): void;
|
|
50
|
+
onTurnCompleted(): void;
|
|
51
|
+
}
|
|
52
|
+
export declare class CliStateEngine {
|
|
53
|
+
private readonly provider;
|
|
54
|
+
private readonly runner;
|
|
55
|
+
private readonly transport;
|
|
56
|
+
private readonly callbacks;
|
|
57
|
+
private readonly timeouts;
|
|
58
|
+
currentStatus: CliSessionStatus['status'];
|
|
59
|
+
isWaitingForResponse: boolean;
|
|
60
|
+
currentTurnScope: TurnParseScope | null;
|
|
61
|
+
activeModal: {
|
|
62
|
+
message: string;
|
|
63
|
+
buttons: string[];
|
|
64
|
+
} | null;
|
|
65
|
+
lastApprovalResolvedAt: number;
|
|
66
|
+
lastResolvedModalMessage: string;
|
|
67
|
+
private approvalExitTimeout;
|
|
68
|
+
responseEpoch: number;
|
|
69
|
+
submitPendingUntil: number;
|
|
70
|
+
responseSettleIgnoreUntil: number;
|
|
71
|
+
submitRetryUsed: boolean;
|
|
72
|
+
submitRetryPromptSnippet: string;
|
|
73
|
+
finishRetryCount: number;
|
|
74
|
+
providerErrorMessage: string | null;
|
|
75
|
+
providerErrorReason: string | null;
|
|
76
|
+
private settleTimer;
|
|
77
|
+
private idleTimeout;
|
|
78
|
+
private finishRetryTimer;
|
|
79
|
+
private providerErrorRetryTimer;
|
|
80
|
+
private providerErrorRetryKey;
|
|
81
|
+
pendingScriptStatus: 'generating' | 'waiting_approval' | null;
|
|
82
|
+
pendingScriptStatusSince: number;
|
|
83
|
+
private pendingScriptStatusTimer;
|
|
84
|
+
private idleFinishCandidate;
|
|
85
|
+
private statusHistory;
|
|
86
|
+
private traceEntries;
|
|
87
|
+
private traceSeq;
|
|
88
|
+
private traceSessionId;
|
|
89
|
+
constructor(provider: CliProviderModule, runner: CliScriptRunner, transport: CliTransportAccess, callbacks: CliStateEngineCallbacks, timeouts: Required<NonNullable<CliProviderModule['timeouts']>>);
|
|
90
|
+
setStatus(status: CliSessionStatus['status'], trigger?: string): void;
|
|
91
|
+
scheduleSettle(): void;
|
|
92
|
+
/** Called from sendMessage in transport once a turn scope is established. */
|
|
93
|
+
onTurnStarted(turnScope: TurnParseScope): void;
|
|
94
|
+
/** Called when PTY exits */
|
|
95
|
+
onPtyExit(): void;
|
|
96
|
+
/** Called when adapter starts up successfully */
|
|
97
|
+
onSpawnReady(): void;
|
|
98
|
+
resolveModal(buttonIndex: number): void;
|
|
99
|
+
isApprovalRecentlyResolved(): boolean;
|
|
100
|
+
/**
|
|
101
|
+
* Called from sendMessage before starting a new turn.
|
|
102
|
+
* Clears stale idle response state when the terminal looks idle and no modal is active.
|
|
103
|
+
*/
|
|
104
|
+
clearStaleIdleResponseGuard(reason: string, snap: CliBufferSnapshot): boolean;
|
|
105
|
+
/**
|
|
106
|
+
* Called from sendMessage before starting a new turn.
|
|
107
|
+
* Clears stale idle response state when the parsed session confirms idle with a final assistant message.
|
|
108
|
+
*/
|
|
109
|
+
clearParsedIdleResponseGuard(reason: string, parsedStatus: any, snap: CliBufferSnapshot): boolean;
|
|
110
|
+
clearAllTimers(): void;
|
|
111
|
+
resetActiveTurnState(): void;
|
|
112
|
+
clearIdleFinishCandidate(reason: string): void;
|
|
113
|
+
hasActionableApproval(startupModal?: {
|
|
114
|
+
message: string;
|
|
115
|
+
buttons: string[];
|
|
116
|
+
} | null): boolean;
|
|
117
|
+
getTraceEntries(): CliTraceEntry[];
|
|
118
|
+
getStatusHistory(): {
|
|
119
|
+
status: string;
|
|
120
|
+
at: number;
|
|
121
|
+
trigger?: string;
|
|
122
|
+
}[];
|
|
123
|
+
getTraceSessionId(): string;
|
|
124
|
+
/** Record a trace entry from the transport layer (e.g. output events in debug mode). */
|
|
125
|
+
recordExternalTrace(type: string, payload?: Record<string, any>): void;
|
|
126
|
+
runDetectStatus(snap: CliBufferSnapshot): string | null;
|
|
127
|
+
runParseApproval(snap: CliBufferSnapshot): {
|
|
128
|
+
message: string;
|
|
129
|
+
buttons: string[];
|
|
130
|
+
} | null;
|
|
131
|
+
runParseSession(snap: CliBufferSnapshot): ParsedSession | null;
|
|
132
|
+
evaluateSettled(snap: CliBufferSnapshot): void;
|
|
133
|
+
private applyPendingScriptStatusDebounce;
|
|
134
|
+
private applyHoldGenerating;
|
|
135
|
+
private applyWaitingApproval;
|
|
136
|
+
private applyGenerating;
|
|
137
|
+
private applyError;
|
|
138
|
+
private maybeScheduleProviderErrorRetry;
|
|
139
|
+
private applyIdle;
|
|
140
|
+
finishResponse(): void;
|
|
141
|
+
private armApprovalExitTimeout;
|
|
142
|
+
private armIdleFinishCandidate;
|
|
143
|
+
private shouldDeferIdleTimeoutFinish;
|
|
144
|
+
private hasRecentInteractiveActivity;
|
|
145
|
+
private hasMeaningfulResponseBuffer;
|
|
146
|
+
private shouldDeferFinishForTranscript;
|
|
147
|
+
private rescheduleTranscriptFinishCheck;
|
|
148
|
+
private shouldRetryFinishResponse;
|
|
149
|
+
private commitCurrentTranscript;
|
|
150
|
+
private maybeCommitVisibleIdleTranscript;
|
|
151
|
+
private parsedStatusHasFinalAssistantMessage;
|
|
152
|
+
private parsedStatusHasFinalStandardAssistantMessage;
|
|
153
|
+
private recordTrace;
|
|
154
|
+
}
|
|
@@ -15,31 +15,28 @@
|
|
|
15
15
|
*/
|
|
16
16
|
import type { CliAdapter } from '../cli-adapter-types.js';
|
|
17
17
|
import { type PtyRuntimeMetadata, type PtyTransportFactory } from './pty-transport.js';
|
|
18
|
-
import { type CliProviderModule, type CliScripts, type CliSessionStatus } from './provider-cli-shared.js';
|
|
18
|
+
import { type CliProviderModule, type CliScripts, type CliSessionStatus, type CliTraceEntry, type ParsedSession } from './provider-cli-shared.js';
|
|
19
|
+
import { CliStateEngine, type CliBufferSnapshot } from './cli-state-engine.js';
|
|
20
|
+
import { type TurnParseScope } from './provider-cli-parse.js';
|
|
19
21
|
import { type ProviderResolutionMeta } from './provider-cli-config.js';
|
|
20
22
|
export { normalizeCliProviderForRuntime, type CliApprovalInput, type CliChatMessage, type CliProviderModule, type CliScreenLine, type CliScreenSnapshot, type CliScriptInput, type CliScripts, type CliSessionStatus, type CliStatusInput, type CliTraceEntry, } from './provider-cli-shared.js';
|
|
21
23
|
export declare function appendBoundedText(current: string, chunk: string, maxChars: number): string;
|
|
22
24
|
export declare class ProviderCliAdapter implements CliAdapter {
|
|
23
25
|
private extraArgs;
|
|
24
26
|
private extraEnv;
|
|
25
|
-
|
|
27
|
+
cliType: string;
|
|
26
28
|
readonly cliName: string;
|
|
27
29
|
workingDir: string;
|
|
28
30
|
private provider;
|
|
29
31
|
private ptyProcess;
|
|
30
32
|
private transportFactory;
|
|
31
|
-
private currentStatus;
|
|
32
33
|
private onStatusChange;
|
|
34
|
+
readonly engine: CliStateEngine;
|
|
33
35
|
private responseBuffer;
|
|
34
36
|
private recentOutputBuffer;
|
|
35
|
-
private
|
|
36
|
-
private activeModal;
|
|
37
|
-
private parseErrorMessage;
|
|
37
|
+
private get parseErrorMessage();
|
|
38
38
|
private providerSessionId;
|
|
39
|
-
private providerErrorMessage;
|
|
40
|
-
private providerErrorReason;
|
|
41
39
|
private responseTimeout;
|
|
42
|
-
private idleTimeout;
|
|
43
40
|
private ready;
|
|
44
41
|
private startupBuffer;
|
|
45
42
|
private startupParseGate;
|
|
@@ -60,33 +57,16 @@ export declare class ProviderCliAdapter implements CliAdapter {
|
|
|
60
57
|
private lastScreenSnapshotReadAt;
|
|
61
58
|
private serverConn;
|
|
62
59
|
private logBuffer;
|
|
63
|
-
private lastApprovalResolvedAt;
|
|
64
|
-
private approvalTransitionBuffer;
|
|
65
|
-
private approvalExitTimeout;
|
|
66
|
-
private pendingScriptStatus;
|
|
67
|
-
private pendingScriptStatusSince;
|
|
68
|
-
private pendingScriptStatusTimer;
|
|
69
|
-
private settleTimer;
|
|
70
|
-
private settledBuffer;
|
|
71
|
-
private submitPendingUntil;
|
|
72
|
-
private responseSettleIgnoreUntil;
|
|
73
|
-
private responseEpoch;
|
|
74
|
-
private submitRetryTimer;
|
|
75
|
-
private submitRetryUsed;
|
|
76
|
-
private submitRetryPromptSnippet;
|
|
77
|
-
private idleFinishCandidate;
|
|
78
|
-
private finishRetryTimer;
|
|
79
|
-
private finishRetryCount;
|
|
80
60
|
private pendingOutboundQueue;
|
|
81
61
|
private pendingOutboundFlushTimer;
|
|
82
62
|
private pendingOutboundFlushInFlight;
|
|
83
|
-
private
|
|
84
|
-
private providerErrorRetryKey;
|
|
63
|
+
private submitRetryTimer;
|
|
85
64
|
private resizeSuppressUntil;
|
|
86
|
-
|
|
87
|
-
private
|
|
88
|
-
/**
|
|
89
|
-
|
|
65
|
+
nativeHistoryAnchoredAt: number;
|
|
66
|
+
private readonly runner;
|
|
67
|
+
/** @deprecated use runner.cliScripts for direct script access */
|
|
68
|
+
get cliScripts(): CliScripts;
|
|
69
|
+
set cliScripts(scripts: CliScripts);
|
|
90
70
|
private runtimeSettings;
|
|
91
71
|
/** Full accumulated rendered PTY transcript for parser/readback use */
|
|
92
72
|
private accumulatedBuffer;
|
|
@@ -106,16 +86,9 @@ export declare class ProviderCliAdapter implements CliAdapter {
|
|
|
106
86
|
* Hermes turn (tool calls + reasoning + final bubble) without the
|
|
107
87
|
* rolling window pushing the turn's ╭─ opening line out of view. */
|
|
108
88
|
private static readonly MAX_ACCUMULATED_BUFFER;
|
|
109
|
-
private currentTurnScope;
|
|
110
|
-
private traceEntries;
|
|
111
|
-
private traceSeq;
|
|
112
|
-
private traceSessionId;
|
|
113
89
|
private parsedStatusCache;
|
|
114
90
|
private static readonly SCREEN_SNAPSHOT_MIN_INTERVAL_MS;
|
|
115
|
-
private static readonly MAX_TRACE_ENTRIES;
|
|
116
91
|
private readonly providerResolutionMeta;
|
|
117
|
-
private static readonly FINISH_RETRY_DELAY_MS;
|
|
118
|
-
private static readonly MAX_FINISH_RETRIES;
|
|
119
92
|
private getBufferState;
|
|
120
93
|
private recordBoundedAppendDrop;
|
|
121
94
|
private readTerminalScreenText;
|
|
@@ -128,18 +101,12 @@ export declare class ProviderCliAdapter implements CliAdapter {
|
|
|
128
101
|
private shouldUseFullProviderTranscriptContext;
|
|
129
102
|
private getIdleFinishConfirmMs;
|
|
130
103
|
private getStatusActivityHoldMs;
|
|
131
|
-
private setStatus;
|
|
132
|
-
private clearIdleFinishCandidate;
|
|
133
|
-
private armIdleFinishCandidate;
|
|
134
|
-
private recordTrace;
|
|
135
|
-
private resetTraceSession;
|
|
136
104
|
private readonly timeouts;
|
|
137
105
|
private readonly approvalKeys;
|
|
138
106
|
private readonly sendDelayMs;
|
|
139
107
|
private readonly sendKey;
|
|
140
108
|
private readonly submitStrategy;
|
|
141
109
|
private readonly requirePromptEchoBeforeSubmit;
|
|
142
|
-
private static readonly SCRIPT_STATUS_DEBOUNCE_MS;
|
|
143
110
|
constructor(provider: CliProviderModule, workingDir: string, extraArgs?: string[], extraEnv?: Record<string, string>, transportFactory?: PtyTransportFactory);
|
|
144
111
|
/** Inject CLI scripts after construction (e.g. when resolved by ProviderLoader) */
|
|
145
112
|
setCliScripts(scripts: CliScripts): void;
|
|
@@ -154,37 +121,15 @@ export declare class ProviderCliAdapter implements CliAdapter {
|
|
|
154
121
|
private handleOutput;
|
|
155
122
|
private resolveStartupState;
|
|
156
123
|
private scheduleStartupSettleCheck;
|
|
157
|
-
private scheduleSettle;
|
|
158
|
-
private armApprovalExitTimeout;
|
|
159
|
-
private shouldRetryFinishResponse;
|
|
160
|
-
private hasRecentInteractiveActivity;
|
|
161
|
-
private shouldDeferIdleTimeoutFinish;
|
|
162
124
|
private waitForInteractivePrompt;
|
|
163
125
|
private clearAllTimers;
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
private applyWaitingApproval;
|
|
171
|
-
private applyGenerating;
|
|
172
|
-
private applyError;
|
|
173
|
-
private maybeScheduleProviderErrorRetry;
|
|
174
|
-
private applyIdle;
|
|
175
|
-
private finishResponse;
|
|
176
|
-
private maybeCommitVisibleIdleTranscript;
|
|
177
|
-
private commitCurrentTranscript;
|
|
178
|
-
private invokeCliScript;
|
|
179
|
-
private runParseSession;
|
|
180
|
-
private runDetectStatus;
|
|
181
|
-
private runParseApproval;
|
|
182
|
-
private hasActionableApproval;
|
|
183
|
-
private parsedStatusHasFinalAssistantMessage;
|
|
126
|
+
runParseSession(): ParsedSession | null;
|
|
127
|
+
runDetectStatus(text: string): string | null;
|
|
128
|
+
runParseApproval(tail: string): {
|
|
129
|
+
message: string;
|
|
130
|
+
buttons: string[];
|
|
131
|
+
} | null;
|
|
184
132
|
private applyParsedSessionMetadata;
|
|
185
|
-
private parsedStatusHasFinalStandardAssistantMessage;
|
|
186
|
-
private shouldKeepCodexTurnOpenForFinish;
|
|
187
|
-
private rescheduleCodexFinishCheck;
|
|
188
133
|
private projectEffectiveStatus;
|
|
189
134
|
getStatus(options?: {
|
|
190
135
|
allowParse?: boolean;
|
|
@@ -204,6 +149,7 @@ export declare class ProviderCliAdapter implements CliAdapter {
|
|
|
204
149
|
*/
|
|
205
150
|
resolveAction(data: any): Promise<void>;
|
|
206
151
|
private isSubmitStuck;
|
|
152
|
+
private hasMeaningfulResponseBufferLocal;
|
|
207
153
|
private writeToPty;
|
|
208
154
|
private resetPendingSendState;
|
|
209
155
|
private commitSendUserTurn;
|
|
@@ -235,8 +181,61 @@ export declare class ProviderCliAdapter implements CliAdapter {
|
|
|
235
181
|
clearHistory(): void;
|
|
236
182
|
isProcessing(): boolean;
|
|
237
183
|
isReady(): boolean;
|
|
238
|
-
|
|
184
|
+
get currentStatus(): CliSessionStatus['status'];
|
|
185
|
+
set currentStatus(v: CliSessionStatus['status']);
|
|
186
|
+
get isWaitingForResponse(): boolean;
|
|
187
|
+
set isWaitingForResponse(v: boolean);
|
|
188
|
+
get activeModal(): {
|
|
189
|
+
message: string;
|
|
190
|
+
buttons: string[];
|
|
191
|
+
} | null;
|
|
192
|
+
set activeModal(v: {
|
|
193
|
+
message: string;
|
|
194
|
+
buttons: string[];
|
|
195
|
+
} | null);
|
|
196
|
+
get currentTurnScope(): TurnParseScope | null;
|
|
197
|
+
set currentTurnScope(v: TurnParseScope | null);
|
|
198
|
+
get responseEpoch(): number;
|
|
199
|
+
set responseEpoch(v: number);
|
|
200
|
+
get submitRetryUsed(): boolean;
|
|
201
|
+
set submitRetryUsed(v: boolean);
|
|
202
|
+
get submitRetryPromptSnippet(): string;
|
|
203
|
+
set submitRetryPromptSnippet(v: string);
|
|
204
|
+
get responseSettleIgnoreUntil(): number;
|
|
205
|
+
set responseSettleIgnoreUntil(v: number);
|
|
206
|
+
get submitPendingUntil(): number;
|
|
207
|
+
set submitPendingUntil(v: number);
|
|
208
|
+
get lastApprovalResolvedAt(): number;
|
|
209
|
+
set lastApprovalResolvedAt(v: number);
|
|
210
|
+
get providerErrorMessage(): string | null;
|
|
211
|
+
get providerErrorReason(): string | null;
|
|
212
|
+
get pendingScriptStatus(): 'generating' | 'waiting_approval' | null;
|
|
213
|
+
get pendingScriptStatusSince(): number;
|
|
214
|
+
get finishRetryCount(): number;
|
|
215
|
+
set finishRetryCount(v: number);
|
|
216
|
+
get traceSessionId(): string;
|
|
217
|
+
get traceEntries(): CliTraceEntry[];
|
|
218
|
+
get statusHistory(): {
|
|
219
|
+
status: string;
|
|
220
|
+
at: number;
|
|
221
|
+
trigger?: string;
|
|
222
|
+
}[];
|
|
223
|
+
get traceSeq(): number;
|
|
224
|
+
/** Expose engine's evaluateSettled for test access */
|
|
225
|
+
evaluateSettled(): void;
|
|
226
|
+
/** Expose engine's scheduleSettle for test access */
|
|
227
|
+
scheduleSettle(): void;
|
|
228
|
+
/** Expose engine's clearIdleFinishCandidate for test access */
|
|
229
|
+
clearIdleFinishCandidate(reason: string): void;
|
|
230
|
+
/** Expose engine's finishResponse for test access */
|
|
231
|
+
finishResponse(): void;
|
|
232
|
+
/** Returns a point-in-time snapshot of all buffer/screen state for external consumers (e.g. CliStateEngine). */
|
|
233
|
+
getSnapshot(): CliBufferSnapshot;
|
|
234
|
+
isAlive(): boolean;
|
|
235
|
+
flushOutboundQueue(): void;
|
|
236
|
+
writeRaw(data: string | Buffer): Promise<void>;
|
|
239
237
|
resolveModal(buttonIndex: number): void;
|
|
238
|
+
getApprovalKeyForIndex(buttonIndex: number): string | undefined;
|
|
240
239
|
/** Returns true if an approval was resolved within the adapter's cooldown window. */
|
|
241
240
|
isApprovalRecentlyResolved(): boolean;
|
|
242
241
|
resize(cols: number, rows: number): void;
|
|
@@ -180,6 +180,10 @@ export interface CliProviderModule {
|
|
|
180
180
|
requirePromptEchoBeforeSubmit?: boolean;
|
|
181
181
|
/** Allow sending another prompt while the CLI is still generating so users can intervene mid-turn. */
|
|
182
182
|
allowInputDuringGeneration?: boolean;
|
|
183
|
+
/** When true, only transition to idle after the parsed transcript includes a final standard assistant message. */
|
|
184
|
+
requiresFinalAssistantBeforeIdle?: boolean;
|
|
185
|
+
/** When true, allow providers to augment stale snapshot data before parse. Reserved for future use. */
|
|
186
|
+
augmentStaleSnapshot?: boolean;
|
|
183
187
|
/** When provider-owned, daemon treats provider parser output as canonical transcript authority. */
|
|
184
188
|
transcriptAuthority?: 'provider' | 'daemon';
|
|
185
189
|
/** Full context lets provider-owned parsers canonicalize retained history instead of daemon prefix stitching. */
|
|
@@ -110,6 +110,7 @@ export declare function readProviderChatHistory(agentType: string, options?: {
|
|
|
110
110
|
excludeRecentCount?: number;
|
|
111
111
|
historyBehavior?: ProviderHistoryBehavior;
|
|
112
112
|
scripts?: ProviderNativeHistoryScripts;
|
|
113
|
+
excludeInProgressTurn?: boolean;
|
|
113
114
|
}): {
|
|
114
115
|
messages: HistoryMessage[];
|
|
115
116
|
hasMore: boolean;
|
package/dist/index.d.ts
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
*/
|
|
6
6
|
export type { ChatBubbleState, ChatMessage, ExtensionInfo, CommandResult as CoreCommandResult, ProviderConfig, DaemonEvent, StatusResponse, SystemInfo, DetectedIde, ProviderInfo, AgentEntry, } from './types.js';
|
|
7
7
|
export type { SessionEntry, CompactSessionEntry, CompactDaemonEntry, CloudDaemonSummaryEntry, DashboardBootstrapDaemonEntry, VersionUpdateReason, CloudStatusReportPayload, DaemonStatusEventPayload, DashboardStatusEventPayload, SessionTransport, SessionKind, SessionCapability, AgentSessionStream, ReadChatCursor, 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, MessageInputSupport, InputMediaStrategyDescriptor, InputAttachmentStrategy, InputMediaType, } from './shared-types.js';
|
|
8
|
-
export type { RepoMesh, RepoMeshDaemonRole, RepoMeshHostMetadata, RepoMeshHostPairingMetadata, RepoMeshHostStatus, RepoMeshNode, RepoMeshNodeHealth, RepoMeshPolicy, RepoMeshNodePolicy, RepoMeshRelatedRepo, RepoMeshNodeCapabilities, DetectedCommand, ProjectContextSnapshot, ProjectContextSource, RepoMeshCoordinatorConfig, LocalMeshConfig, LocalMeshEntry, LocalMeshNodeEntry, RepoMeshStatus, RepoMeshNodeStatus, RepoMeshSessionStatus, RepoMeshQueueTask, RepoMeshQueueTaskStatus, RepoMeshQueueSummary, RepoMeshQueueStatus, RepoMeshLedgerEntryStatus, RepoMeshLedgerSummaryStatus, RepoMeshLedgerStatus, } from './repo-mesh-types.js';
|
|
8
|
+
export type { RepoMesh, RepoMeshDaemonRole, RepoMeshHostMetadata, RepoMeshHostPairingMetadata, RepoMeshHostStatus, RepoMeshNode, RepoMeshNodeHealth, RepoMeshPolicy, RepoMeshNodePolicy, RepoMeshRelatedRepo, RepoMeshNodeCapabilities, DetectedCommand, ProjectContextSnapshot, ProjectContextSource, RepoMeshCoordinatorConfig, LocalMeshConfig, LocalMeshEntry, LocalMeshNodeEntry, RepoMeshStatus, RepoMeshNodeStatus, RepoMeshSessionStatus, RepoMeshQueueTask, RepoMeshQueueTaskStatus, RepoMeshQueueSummary, RepoMeshQueueStatus, RepoMeshLedgerEntryStatus, RepoMeshLedgerSummaryStatus, RepoMeshLedgerStatus, MeshAsyncJobLifecycle, } from './repo-mesh-types.js';
|
|
9
9
|
export { DEFAULT_MESH_POLICY } from './repo-mesh-types.js';
|
|
10
10
|
export * from './git/index.js';
|
|
11
11
|
import type { RuntimeWriteOwner as _RuntimeWriteOwner } from './shared-types-extra.js';
|
|
@@ -41,8 +41,8 @@ export { fastForwardMeshNode } from './mesh/mesh-fast-forward.js';
|
|
|
41
41
|
export type { MeshFastForwardNodeArgs, MeshFastForwardPlannedStep, MeshFastForwardResult } from './mesh/mesh-fast-forward.js';
|
|
42
42
|
export { buildMeshLedgerReconciliationEvidence, buildMeshLedgerReplicaEvidence } from './mesh/mesh-ledger-reconciliation.js';
|
|
43
43
|
export type { MeshLedgerReconciliationEvidence, MeshLedgerReplicaEvidence, MeshLedgerReplicaStatus } from './mesh/mesh-ledger-reconciliation.js';
|
|
44
|
-
export { enqueueTask, getQueue, claimNextTask, updateTaskStatus, updateSessionTaskStatus, cancelTask, requeueTask, getMeshQueueStats, getMeshQueueRevision, normalizeMeshTaskMode, validateMeshTaskModeRequest } from './mesh/mesh-work-queue.js';
|
|
45
|
-
export type { MeshWorkQueueEntry, MeshTaskStatus, MeshTaskMode, MeshWorkQueueStats, MeshQueueMutationOptions, MeshTaskModeValidationResult } from './mesh/mesh-work-queue.js';
|
|
44
|
+
export { enqueueTask, getQueue, claimNextTask, updateTaskStatus, updateSessionTaskStatus, cancelTask, requeueTask, getMeshQueueStats, getMeshQueueRevision, normalizeMeshTaskMode, validateMeshTaskModeRequest, insertDirectDispatch, getActiveDirectDispatches, updateDirectDispatchStatus, cleanupTerminalDirectDispatches, markStaleDirectDispatches } from './mesh/mesh-work-queue.js';
|
|
45
|
+
export type { MeshWorkQueueEntry, MeshTaskStatus, MeshTaskMode, MeshWorkQueueStats, MeshQueueMutationOptions, MeshTaskModeValidationResult, DirectDispatchRecord } from './mesh/mesh-work-queue.js';
|
|
46
46
|
export { buildCompactStaleDirectWorkSummary, buildMeshActiveWork, buildMeshActiveWorkSummary } from './mesh/mesh-active-work.js';
|
|
47
47
|
export type { MeshActiveWorkRecord, MeshActiveWorkStatus, MeshActiveWorkSummary, MeshActiveWorkSource, MeshStaleDirectWorkSummary } from './mesh/mesh-active-work.js';
|
|
48
48
|
export { buildMeshAsyncRefineJobs } from './mesh/mesh-refine-status.js';
|