@adhdev/daemon-core 0.9.82-rc.18 → 0.9.82-rc.181
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/process-hardening.d.ts +50 -0
- package/dist/chat/source-machine.d.ts +166 -0
- package/dist/chat/source-resolver.d.ts +104 -0
- package/dist/chat/subscription-updates.d.ts +1 -0
- package/dist/cli-adapter-types.d.ts +22 -2
- package/dist/cli-adapters/cli-script-runner.d.ts +117 -0
- package/dist/cli-adapters/cli-state-engine.d.ts +178 -0
- package/dist/cli-adapters/provider-cli-adapter.d.ts +106 -63
- package/dist/cli-adapters/provider-cli-parse.d.ts +4 -0
- package/dist/cli-adapters/provider-cli-shared.d.ts +29 -0
- package/dist/cli-adapters/raw-terminal-io.d.ts +37 -0
- package/dist/commands/handler.d.ts +110 -0
- package/dist/commands/mesh-coordinator.d.ts +72 -1
- package/dist/commands/router.d.ts +22 -0
- package/dist/config/chat-history.d.ts +8 -0
- package/dist/config/config.d.ts +5 -0
- package/dist/config/mesh-config.d.ts +72 -1
- package/dist/git/git-commands.d.ts +5 -1
- package/dist/index.d.ts +35 -8
- package/dist/index.js +20754 -5387
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +20567 -5270
- package/dist/index.mjs.map +1 -1
- package/dist/installer.d.ts +1 -4
- package/dist/ipc/local-ipc-server.d.ts +91 -0
- package/dist/launch.d.ts +1 -1
- package/dist/logging/async-batch-writer.d.ts +10 -0
- package/dist/mesh/beads-db.d.ts +72 -0
- package/dist/mesh/contracts.d.ts +164 -0
- package/dist/mesh/coordinator-prompt.d.ts +30 -0
- package/dist/mesh/coordinator-registry.d.ts +59 -0
- package/dist/mesh/mesh-active-work.d.ts +90 -0
- package/dist/mesh/mesh-events.d.ts +97 -5
- package/dist/mesh/mesh-fast-forward.d.ts +41 -0
- package/dist/mesh/mesh-host-ownership.d.ts +9 -0
- package/dist/mesh/mesh-ledger.d.ts +58 -1
- package/dist/mesh/mesh-refine-status.d.ts +26 -0
- package/dist/mesh/mesh-work-queue.d.ts +54 -6
- package/dist/mesh/preview-freshness.d.ts +18 -0
- package/dist/mesh/refine-config.d.ts +193 -0
- package/dist/mesh/worktree-bootstrap-config.d.ts +113 -0
- package/dist/providers/approval-utils.d.ts +13 -0
- package/dist/providers/cli-provider-instance.d.ts +35 -3
- package/dist/providers/contracts.d.ts +98 -5
- package/dist/providers/external-sources.d.ts +71 -0
- package/dist/providers/native-history/antigravity-cli-transcript.d.ts +100 -0
- package/dist/providers/native-history/claude-cli-transcript.d.ts +70 -0
- package/dist/providers/native-history/codex-cli-transcript.d.ts +73 -0
- package/dist/providers/native-history/dispatcher.d.ts +25 -0
- package/dist/providers/native-history/hermes-cli-transcript.d.ts +30 -0
- package/dist/providers/native-history/index.d.ts +13 -0
- package/dist/providers/provider-instance-manager.d.ts +12 -0
- package/dist/providers/provider-instance.d.ts +12 -0
- package/dist/providers/provider-loader.d.ts +26 -4
- package/dist/providers/provider-trust.d.ts +31 -0
- package/dist/providers/read-chat-contract.d.ts +29 -0
- package/dist/providers/sdk/v1/builders/acp/detect-status.d.ts +68 -0
- package/dist/providers/sdk/v1/builders/cli/detect-status.d.ts +85 -0
- package/dist/providers/sdk/v1/builders/cli/parse-approval-squash.d.ts +59 -0
- package/dist/providers/sdk/v1/builders/cli/parse-approval.d.ts +65 -0
- package/dist/providers/sdk/v1/builders/cli/parse-session.d.ts +91 -0
- package/dist/providers/sdk/v1/builders/cli/visible-region.d.ts +42 -0
- package/dist/providers/sdk/v1/fixture-tooling/format.d.ts +126 -0
- package/dist/providers/sdk/v1/fixture-tooling/index.d.ts +8 -0
- package/dist/providers/sdk/v1/fixture-tooling/replay.d.ts +38 -0
- package/dist/providers/sdk/v1/index.d.ts +30 -0
- package/dist/providers/sdk/v1/sandbox/README-design.d.ts +193 -0
- package/dist/providers/sdk/v1/sandbox/require-whitelist.d.ts +74 -0
- package/dist/providers/sdk/v1/sandbox/script-runner.d.ts +98 -0
- package/dist/providers/sdk/v1/types/cli/index.d.ts +277 -0
- package/dist/providers/sdk/v1/types/common/index.d.ts +169 -0
- package/dist/providers/sdk/v1/validators/index.d.ts +5 -0
- package/dist/providers/sdk/v1/validators/manifest.d.ts +40 -0
- package/dist/providers/sdk/v1/validators/taint.d.ts +52 -0
- package/dist/providers/spec/adapter.d.ts +56 -0
- package/dist/providers/spec/cli-adapter.d.ts +97 -0
- package/dist/providers/spec/driver.d.ts +159 -0
- package/dist/providers/spec/evaluator.d.ts +47 -0
- package/dist/providers/spec/loader.d.ts +14 -0
- package/dist/providers/spec/native-history-executor.d.ts +39 -0
- package/dist/providers/spec/route.d.ts +4 -0
- package/dist/providers/spec/schema.gen.d.ts +511 -0
- package/dist/providers/spec/types.d.ts +212 -0
- package/dist/providers/transcript-v2.d.ts +176 -0
- package/dist/providers/types/interactive-prompt.d.ts +48 -0
- package/dist/repo-mesh-types.d.ts +102 -1
- package/dist/sessions/registry.d.ts +3 -0
- package/dist/shared-types.d.ts +42 -1
- package/dist/status/reporter.d.ts +2 -0
- package/dist/status/snapshot.d.ts +1 -0
- package/dist/types.d.ts +5 -0
- package/package.json +7 -2
- package/src/agent-stream/poller.ts +2 -3
- package/src/boot/daemon-lifecycle.ts +17 -10
- package/src/boot/process-hardening.ts +89 -0
- package/src/chat/source-machine.ts +534 -0
- package/src/chat/source-resolver.ts +0 -0
- package/src/chat/subscription-updates.ts +14 -1
- package/src/cli-adapter-types.d.ts +1 -0
- package/src/cli-adapter-types.ts +21 -2
- package/src/cli-adapters/cli-script-runner.ts +421 -0
- package/src/cli-adapters/cli-state-engine.ts +1086 -0
- package/src/cli-adapters/provider-cli-adapter.d.ts +1 -1
- package/src/cli-adapters/provider-cli-adapter.ts +670 -1137
- package/src/cli-adapters/provider-cli-parse.d.ts +1 -0
- package/src/cli-adapters/provider-cli-parse.ts +13 -0
- package/src/cli-adapters/provider-cli-runtime.ts +3 -1
- package/src/cli-adapters/provider-cli-shared.d.ts +2 -0
- package/src/cli-adapters/provider-cli-shared.ts +59 -11
- package/src/cli-adapters/raw-terminal-io.ts +252 -0
- package/src/cli-adapters/terminal-backends/ghostty-vt-backend.ts +17 -1
- package/src/cli-adapters/terminal-backends/xterm-backend.ts +8 -1
- package/src/commands/chat-commands.ts +1597 -60
- package/src/commands/cli-manager.ts +230 -3
- package/src/commands/handler.ts +809 -2
- package/src/commands/mesh-coordinator.ts +231 -127
- package/src/commands/router.ts +3495 -502
- package/src/config/chat-history.ts +91 -24
- package/src/config/config.ts +12 -0
- package/src/config/mesh-config.ts +280 -2
- package/src/config/recent-activity.ts +8 -2
- package/src/daemon/dev-cli-debug.ts +10 -1
- package/src/detection/ide-detector.ts +26 -16
- package/src/git/git-commands.ts +17 -5
- package/src/git/git-worktree.ts +8 -1
- package/src/index.ts +113 -7
- package/src/installer.d.ts +1 -1
- package/src/installer.ts +8 -6
- package/src/ipc/local-ipc-server.ts +278 -0
- package/src/launch.d.ts +1 -1
- package/src/launch.ts +37 -28
- package/src/logging/async-batch-writer.ts +55 -0
- package/src/logging/logger.ts +2 -1
- package/src/mesh/beads-db.ts +486 -0
- package/src/mesh/contracts.ts +329 -0
- package/src/mesh/coordinator-prompt.ts +204 -30
- package/src/mesh/coordinator-registry.ts +121 -0
- package/src/mesh/mesh-active-work.ts +437 -0
- package/src/mesh/mesh-events.ts +963 -67
- package/src/mesh/mesh-fast-forward.ts +438 -0
- package/src/mesh/mesh-host-ownership.ts +73 -0
- package/src/mesh/mesh-ledger.ts +457 -104
- package/src/mesh/mesh-refine-status.ts +144 -0
- package/src/mesh/mesh-work-queue.ts +263 -159
- package/src/mesh/preview-freshness.ts +118 -0
- package/src/mesh/refine-config.ts +366 -0
- package/src/mesh/worktree-bootstrap-config.ts +247 -0
- package/src/providers/approval-utils.d.ts +4 -0
- package/src/providers/approval-utils.ts +47 -5
- package/src/providers/chat-message-normalization.ts +4 -11
- package/src/providers/cli-provider-instance.ts +651 -57
- package/src/providers/contracts.ts +105 -5
- package/src/providers/external-sources.ts +218 -0
- package/src/providers/ide-provider-instance.ts +19 -5
- package/src/providers/native-history/antigravity-cli-transcript.ts +643 -0
- package/src/providers/native-history/claude-cli-transcript.ts +396 -0
- package/src/providers/native-history/codex-cli-transcript.ts +419 -0
- package/src/providers/native-history/dispatcher.ts +231 -0
- package/src/providers/native-history/hermes-cli-transcript.ts +230 -0
- package/src/providers/native-history/index.ts +30 -0
- package/src/providers/provider-instance-manager.ts +30 -0
- package/src/providers/provider-instance.ts +9 -0
- package/src/providers/provider-loader.ts +585 -50
- package/src/providers/provider-schema.ts +31 -13
- package/src/providers/provider-trust.ts +114 -0
- package/src/providers/read-chat-contract.ts +76 -16
- package/src/providers/sdk/README.md +49 -0
- package/src/providers/sdk/v1/builders/acp/detect-status.ts +144 -0
- package/src/providers/sdk/v1/builders/cli/detect-status.ts +262 -0
- package/src/providers/sdk/v1/builders/cli/parse-approval-squash.ts +158 -0
- package/src/providers/sdk/v1/builders/cli/parse-approval.ts +250 -0
- package/src/providers/sdk/v1/builders/cli/parse-session.ts +276 -0
- package/src/providers/sdk/v1/builders/cli/visible-region.ts +143 -0
- package/src/providers/sdk/v1/fixture-tooling/format.ts +130 -0
- package/src/providers/sdk/v1/fixture-tooling/index.ts +22 -0
- package/src/providers/sdk/v1/fixture-tooling/replay.ts +352 -0
- package/src/providers/sdk/v1/index.ts +152 -0
- package/src/providers/sdk/v1/sandbox/README-design.ts +195 -0
- package/src/providers/sdk/v1/sandbox/require-whitelist.ts +472 -0
- package/src/providers/sdk/v1/sandbox/script-runner.ts +150 -0
- package/src/providers/sdk/v1/schemas/cli/provider.schema.json +458 -0
- package/src/providers/sdk/v1/schemas/primitives/acp-session-protocol-v1.json +131 -0
- package/src/providers/sdk/v1/schemas/primitives/native-history-codex-rollout-v1.json +66 -0
- package/src/providers/sdk/v1/schemas/primitives/tui-approval-squash-v1.json +91 -0
- package/src/providers/sdk/v1/schemas/primitives/tui-assistant-block-v1.json +91 -0
- package/src/providers/sdk/v1/schemas/primitives/tui-cue-ordering-v1.json +47 -0
- package/src/providers/sdk/v1/schemas/primitives/tui-dispatch-order-v1.json +32 -0
- package/src/providers/sdk/v1/schemas/primitives/tui-footer-chrome-v1.json +42 -0
- package/src/providers/sdk/v1/schemas/primitives/tui-index-finder-v1.json +27 -0
- package/src/providers/sdk/v1/schemas/primitives/tui-modal-v1.json +125 -0
- package/src/providers/sdk/v1/schemas/primitives/tui-prompt-marker-v1.json +45 -0
- package/src/providers/sdk/v1/schemas/primitives/tui-session-id-extraction-v1.json +46 -0
- package/src/providers/sdk/v1/schemas/primitives/tui-settled-prompt-v1.json +71 -0
- package/src/providers/sdk/v1/schemas/primitives/tui-spinner-v1.json +83 -0
- package/src/providers/sdk/v1/schemas/primitives/tui-transcript-pty-v1.json +83 -0
- package/src/providers/sdk/v1/schemas/primitives/tui-visible-region-v1.json +57 -0
- package/src/providers/sdk/v1/schemas/primitives/tui-welcome-screen-v1.json +35 -0
- package/src/providers/sdk/v1/types/cli/index.ts +365 -0
- package/src/providers/sdk/v1/types/common/index.ts +210 -0
- package/src/providers/sdk/v1/validators/index.ts +19 -0
- package/src/providers/sdk/v1/validators/manifest.ts +110 -0
- package/src/providers/sdk/v1/validators/taint.ts +309 -0
- package/src/providers/spec/adapter.ts +168 -0
- package/src/providers/spec/cli-adapter.ts +507 -0
- package/src/providers/spec/driver.ts +540 -0
- package/src/providers/spec/evaluator.ts +298 -0
- package/src/providers/spec/loader.ts +130 -0
- package/src/providers/spec/native-history-executor.ts +706 -0
- package/src/providers/spec/route.ts +51 -0
- package/src/providers/spec/schema.gen.ts +511 -0
- package/src/providers/spec/schema.json +211 -0
- package/src/providers/spec/types.ts +231 -0
- package/src/providers/transcript-v2.ts +567 -0
- package/src/providers/types/interactive-prompt.ts +396 -0
- package/src/providers/version-archive.ts +38 -20
- package/src/repo-mesh-types.ts +112 -1
- package/src/sessions/registry.ts +3 -0
- package/src/shared-types.ts +45 -1
- package/src/status/builders.ts +24 -6
- package/src/status/reporter.ts +15 -0
- package/src/status/snapshot.ts +84 -25
- package/src/system/host-memory.ts +29 -12
- package/src/types.ts +5 -0
- package/dist/mesh/mesh-sync.d.ts +0 -53
- package/src/mesh/mesh-sync.ts +0 -111
|
@@ -14,29 +14,30 @@
|
|
|
14
14
|
* compatibility: [{ ideVersion, scriptDir }] ← versioned scripts
|
|
15
15
|
*/
|
|
16
16
|
import type { CliAdapter } from '../cli-adapter-types.js';
|
|
17
|
+
import type { InteractivePromptResponse } from '../providers/types/interactive-prompt.js';
|
|
17
18
|
import { type PtyRuntimeMetadata, type PtyTransportFactory } from './pty-transport.js';
|
|
18
|
-
import { type CliProviderModule, type CliScripts, type CliSessionStatus } from './provider-cli-shared.js';
|
|
19
|
+
import { type CliProviderModule, type CliScripts, type CliSessionStatus, type CliTraceEntry, type ParsedSession } from './provider-cli-shared.js';
|
|
20
|
+
import { CliStateEngine, type CliBufferSnapshot } from './cli-state-engine.js';
|
|
21
|
+
import { type TurnParseScope } from './provider-cli-parse.js';
|
|
19
22
|
import { type ProviderResolutionMeta } from './provider-cli-config.js';
|
|
20
23
|
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
24
|
export declare function appendBoundedText(current: string, chunk: string, maxChars: number): string;
|
|
22
25
|
export declare class ProviderCliAdapter implements CliAdapter {
|
|
23
26
|
private extraArgs;
|
|
24
27
|
private extraEnv;
|
|
25
|
-
|
|
28
|
+
cliType: string;
|
|
26
29
|
readonly cliName: string;
|
|
27
30
|
workingDir: string;
|
|
28
31
|
private provider;
|
|
29
32
|
private ptyProcess;
|
|
30
33
|
private transportFactory;
|
|
31
|
-
private currentStatus;
|
|
32
34
|
private onStatusChange;
|
|
35
|
+
readonly engine: CliStateEngine;
|
|
33
36
|
private responseBuffer;
|
|
34
37
|
private recentOutputBuffer;
|
|
35
|
-
private
|
|
36
|
-
private
|
|
37
|
-
private parseErrorMessage;
|
|
38
|
+
private get parseErrorMessage();
|
|
39
|
+
private providerSessionId;
|
|
38
40
|
private responseTimeout;
|
|
39
|
-
private idleTimeout;
|
|
40
41
|
private ready;
|
|
41
42
|
private startupBuffer;
|
|
42
43
|
private startupParseGate;
|
|
@@ -57,28 +58,32 @@ export declare class ProviderCliAdapter implements CliAdapter {
|
|
|
57
58
|
private lastScreenSnapshotReadAt;
|
|
58
59
|
private serverConn;
|
|
59
60
|
private logBuffer;
|
|
60
|
-
private
|
|
61
|
-
private
|
|
62
|
-
private
|
|
63
|
-
private pendingScriptStatus;
|
|
64
|
-
private pendingScriptStatusSince;
|
|
65
|
-
private pendingScriptStatusTimer;
|
|
66
|
-
private settleTimer;
|
|
67
|
-
private settledBuffer;
|
|
68
|
-
private submitPendingUntil;
|
|
69
|
-
private responseSettleIgnoreUntil;
|
|
70
|
-
private responseEpoch;
|
|
61
|
+
private pendingOutboundQueue;
|
|
62
|
+
private pendingOutboundFlushTimer;
|
|
63
|
+
private pendingOutboundFlushInFlight;
|
|
71
64
|
private submitRetryTimer;
|
|
72
|
-
private submitRetryUsed;
|
|
73
|
-
private submitRetryPromptSnippet;
|
|
74
|
-
private idleFinishCandidate;
|
|
75
|
-
private finishRetryTimer;
|
|
76
|
-
private finishRetryCount;
|
|
77
65
|
private resizeSuppressUntil;
|
|
78
|
-
private
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
66
|
+
private readonly runner;
|
|
67
|
+
/** @deprecated use runner.cliScripts for direct script access */
|
|
68
|
+
get cliScripts(): CliScripts;
|
|
69
|
+
/**
|
|
70
|
+
* Recent script invocations (oldest → newest). Exposed via the
|
|
71
|
+
* `get_chat_debug_bundle` daemon command so anyone debugging a
|
|
72
|
+
* stuck-status regression can read what each detectStatus /
|
|
73
|
+
* parseSession call actually saw and returned, instead of having
|
|
74
|
+
* to instrument the daemon.
|
|
75
|
+
*/
|
|
76
|
+
getScriptInvocationTrace(): import("./cli-script-runner.js").CliScriptInvocationTrace[];
|
|
77
|
+
/**
|
|
78
|
+
* Returns the full raw PTY byte stream captured since adapter start.
|
|
79
|
+
* Used by the `record_provider_pty` IPC command to produce fixtures.
|
|
80
|
+
* Bounded by MAX_ACCUMULATED_BUFFER; older bytes may have been dropped.
|
|
81
|
+
*/
|
|
82
|
+
getAccumulatedRawBuffer(): {
|
|
83
|
+
text: string;
|
|
84
|
+
droppedChars: number;
|
|
85
|
+
};
|
|
86
|
+
set cliScripts(scripts: CliScripts);
|
|
82
87
|
private runtimeSettings;
|
|
83
88
|
/** Full accumulated rendered PTY transcript for parser/readback use */
|
|
84
89
|
private accumulatedBuffer;
|
|
@@ -98,16 +103,9 @@ export declare class ProviderCliAdapter implements CliAdapter {
|
|
|
98
103
|
* Hermes turn (tool calls + reasoning + final bubble) without the
|
|
99
104
|
* rolling window pushing the turn's ╭─ opening line out of view. */
|
|
100
105
|
private static readonly MAX_ACCUMULATED_BUFFER;
|
|
101
|
-
private currentTurnScope;
|
|
102
|
-
private traceEntries;
|
|
103
|
-
private traceSeq;
|
|
104
|
-
private traceSessionId;
|
|
105
106
|
private parsedStatusCache;
|
|
106
107
|
private static readonly SCREEN_SNAPSHOT_MIN_INTERVAL_MS;
|
|
107
|
-
private static readonly MAX_TRACE_ENTRIES;
|
|
108
108
|
private readonly providerResolutionMeta;
|
|
109
|
-
private static readonly FINISH_RETRY_DELAY_MS;
|
|
110
|
-
private static readonly MAX_FINISH_RETRIES;
|
|
111
109
|
private getBufferState;
|
|
112
110
|
private recordBoundedAppendDrop;
|
|
113
111
|
private readTerminalScreenText;
|
|
@@ -120,18 +118,12 @@ export declare class ProviderCliAdapter implements CliAdapter {
|
|
|
120
118
|
private shouldUseFullProviderTranscriptContext;
|
|
121
119
|
private getIdleFinishConfirmMs;
|
|
122
120
|
private getStatusActivityHoldMs;
|
|
123
|
-
private setStatus;
|
|
124
|
-
private clearIdleFinishCandidate;
|
|
125
|
-
private armIdleFinishCandidate;
|
|
126
|
-
private recordTrace;
|
|
127
|
-
private resetTraceSession;
|
|
128
121
|
private readonly timeouts;
|
|
129
122
|
private readonly approvalKeys;
|
|
130
123
|
private readonly sendDelayMs;
|
|
131
124
|
private readonly sendKey;
|
|
132
125
|
private readonly submitStrategy;
|
|
133
126
|
private readonly requirePromptEchoBeforeSubmit;
|
|
134
|
-
private static readonly SCRIPT_STATUS_DEBOUNCE_MS;
|
|
135
127
|
constructor(provider: CliProviderModule, workingDir: string, extraArgs?: string[], extraEnv?: Record<string, string>, transportFactory?: PtyTransportFactory);
|
|
136
128
|
/** Inject CLI scripts after construction (e.g. when resolved by ProviderLoader) */
|
|
137
129
|
setCliScripts(scripts: CliScripts): void;
|
|
@@ -146,29 +138,15 @@ export declare class ProviderCliAdapter implements CliAdapter {
|
|
|
146
138
|
private handleOutput;
|
|
147
139
|
private resolveStartupState;
|
|
148
140
|
private scheduleStartupSettleCheck;
|
|
149
|
-
private scheduleSettle;
|
|
150
|
-
private armApprovalExitTimeout;
|
|
151
|
-
private shouldRetryFinishResponse;
|
|
152
|
-
private hasRecentInteractiveActivity;
|
|
153
|
-
private shouldDeferIdleTimeoutFinish;
|
|
154
141
|
private waitForInteractivePrompt;
|
|
155
142
|
private clearAllTimers;
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
private
|
|
163
|
-
private applyIdle;
|
|
164
|
-
private finishResponse;
|
|
165
|
-
private maybeCommitVisibleIdleTranscript;
|
|
166
|
-
private commitCurrentTranscript;
|
|
167
|
-
private invokeCliScript;
|
|
168
|
-
private runParseSession;
|
|
169
|
-
private runDetectStatus;
|
|
170
|
-
private runParseApproval;
|
|
171
|
-
private hasActionableApproval;
|
|
143
|
+
runParseSession(): ParsedSession | null;
|
|
144
|
+
runDetectStatus(text: string): string | null;
|
|
145
|
+
runParseApproval(tail: string): {
|
|
146
|
+
message: string;
|
|
147
|
+
buttons: string[];
|
|
148
|
+
} | null;
|
|
149
|
+
private applyParsedSessionMetadata;
|
|
172
150
|
private projectEffectiveStatus;
|
|
173
151
|
getStatus(options?: {
|
|
174
152
|
allowParse?: boolean;
|
|
@@ -187,7 +165,9 @@ export declare class ProviderCliAdapter implements CliAdapter {
|
|
|
187
165
|
* Uses resolveAction script if available, otherwise falls back to standard text.
|
|
188
166
|
*/
|
|
189
167
|
resolveAction(data: any): Promise<void>;
|
|
168
|
+
setInteractivePromptResponse(_response: InteractivePromptResponse): Promise<void>;
|
|
190
169
|
private isSubmitStuck;
|
|
170
|
+
private hasMeaningfulResponseBufferLocal;
|
|
191
171
|
private writeToPty;
|
|
192
172
|
private resetPendingSendState;
|
|
193
173
|
private commitSendUserTurn;
|
|
@@ -198,7 +178,15 @@ export declare class ProviderCliAdapter implements CliAdapter {
|
|
|
198
178
|
private submitSendKey;
|
|
199
179
|
private submitImmediatePrompt;
|
|
200
180
|
private waitForEchoAndSubmit;
|
|
201
|
-
sendMessage(text: string
|
|
181
|
+
sendMessage(text: string, options?: {
|
|
182
|
+
force?: boolean;
|
|
183
|
+
}): Promise<void>;
|
|
184
|
+
forceSendMessage(text: string): Promise<void>;
|
|
185
|
+
private enqueuePendingOutboundMessage;
|
|
186
|
+
private shouldQueuePendingOutboundMessage;
|
|
187
|
+
private schedulePendingOutboundFlush;
|
|
188
|
+
private flushPendingOutboundQueue;
|
|
189
|
+
private sendMessageNow;
|
|
202
190
|
getPartialResponse(): string;
|
|
203
191
|
getDebugSnapshot(): Record<string, unknown>;
|
|
204
192
|
getRuntimeMetadata(): PtyRuntimeMetadata | null;
|
|
@@ -211,8 +199,63 @@ export declare class ProviderCliAdapter implements CliAdapter {
|
|
|
211
199
|
clearHistory(): void;
|
|
212
200
|
isProcessing(): boolean;
|
|
213
201
|
isReady(): boolean;
|
|
214
|
-
|
|
202
|
+
get currentStatus(): CliSessionStatus['status'];
|
|
203
|
+
set currentStatus(v: CliSessionStatus['status']);
|
|
204
|
+
get isWaitingForResponse(): boolean;
|
|
205
|
+
set isWaitingForResponse(v: boolean);
|
|
206
|
+
get activeModal(): {
|
|
207
|
+
message: string;
|
|
208
|
+
buttons: string[];
|
|
209
|
+
} | null;
|
|
210
|
+
set activeModal(v: {
|
|
211
|
+
message: string;
|
|
212
|
+
buttons: string[];
|
|
213
|
+
} | null);
|
|
214
|
+
get currentTurnScope(): TurnParseScope | null;
|
|
215
|
+
set currentTurnScope(v: TurnParseScope | null);
|
|
216
|
+
get responseEpoch(): number;
|
|
217
|
+
set responseEpoch(v: number);
|
|
218
|
+
get submitRetryUsed(): boolean;
|
|
219
|
+
set submitRetryUsed(v: boolean);
|
|
220
|
+
get submitRetryPromptSnippet(): string;
|
|
221
|
+
set submitRetryPromptSnippet(v: string);
|
|
222
|
+
get responseSettleIgnoreUntil(): number;
|
|
223
|
+
set responseSettleIgnoreUntil(v: number);
|
|
224
|
+
get submitPendingUntil(): number;
|
|
225
|
+
set submitPendingUntil(v: number);
|
|
226
|
+
get lastApprovalResolvedAt(): number;
|
|
227
|
+
set lastApprovalResolvedAt(v: number);
|
|
228
|
+
get providerErrorMessage(): string | null;
|
|
229
|
+
get providerErrorReason(): string | null;
|
|
230
|
+
get pendingScriptStatus(): 'generating' | 'waiting_approval' | null;
|
|
231
|
+
get pendingScriptStatusSince(): number;
|
|
232
|
+
get finishRetryCount(): number;
|
|
233
|
+
set finishRetryCount(v: number);
|
|
234
|
+
get traceSessionId(): string;
|
|
235
|
+
get traceEntries(): CliTraceEntry[];
|
|
236
|
+
get statusHistory(): {
|
|
237
|
+
status: string;
|
|
238
|
+
at: number;
|
|
239
|
+
trigger?: string;
|
|
240
|
+
}[];
|
|
241
|
+
get traceSeq(): number;
|
|
242
|
+
/** Expose engine's evaluateSettled for test access */
|
|
243
|
+
evaluateSettled(): void;
|
|
244
|
+
/** Expose engine's scheduleSettle for test access */
|
|
245
|
+
scheduleSettle(): void;
|
|
246
|
+
/** Expose engine's clearIdleFinishCandidate for test access */
|
|
247
|
+
clearIdleFinishCandidate(reason: string): void;
|
|
248
|
+
/** Expose engine's finishResponse for test access */
|
|
249
|
+
finishResponse(): void;
|
|
250
|
+
/** Returns a point-in-time snapshot of all buffer/screen state for external consumers (e.g. CliStateEngine). */
|
|
251
|
+
getSnapshot(): CliBufferSnapshot;
|
|
252
|
+
isAlive(): boolean;
|
|
253
|
+
flushOutboundQueue(): void;
|
|
254
|
+
writeRaw(data: string | Buffer): Promise<void>;
|
|
215
255
|
resolveModal(buttonIndex: number): void;
|
|
256
|
+
getApprovalKeyForIndex(buttonIndex: number): string | undefined;
|
|
257
|
+
/** Returns true if an approval was resolved within the adapter's cooldown window. */
|
|
258
|
+
isApprovalRecentlyResolved(): boolean;
|
|
216
259
|
resize(cols: number, rows: number): void;
|
|
217
260
|
private getParsedDebugState;
|
|
218
261
|
getDebugState(): Record<string, any>;
|
|
@@ -15,11 +15,15 @@ export declare function buildCliParseInput(options: {
|
|
|
15
15
|
accumulatedRawBuffer: string;
|
|
16
16
|
recentOutputBuffer: string;
|
|
17
17
|
terminalScreenText: string;
|
|
18
|
+
workingDir?: string;
|
|
19
|
+
providerSessionId?: string;
|
|
20
|
+
historySessionId?: string;
|
|
18
21
|
baseMessages: CliChatMessage[];
|
|
19
22
|
partialResponse: string;
|
|
20
23
|
isWaitingForResponse?: boolean;
|
|
21
24
|
scope?: TurnParseScope | null;
|
|
22
25
|
runtimeSettings: Record<string, any>;
|
|
26
|
+
spawnAt?: number;
|
|
23
27
|
}): CliScriptInput;
|
|
24
28
|
export declare function summarizeCliTraceText(text: string, max?: number): string;
|
|
25
29
|
export declare function summarizeCliTraceMessages(messages: CliChatMessage[], limit?: number): {
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { ProviderResumeCapability } from '../providers/contracts.js';
|
|
2
2
|
import type { ChatMessageKind } from '../providers/chat-message-normalization.js';
|
|
3
3
|
import type { ChatBubbleState } from '../types.js';
|
|
4
|
+
import type { InteractivePrompt } from '../providers/types/interactive-prompt.js';
|
|
4
5
|
import { sanitizeSpawnEnv } from './spawn-env.js';
|
|
5
6
|
export interface CliChatMessage {
|
|
6
7
|
role: string;
|
|
@@ -26,8 +27,18 @@ export interface CliSessionStatus {
|
|
|
26
27
|
message: string;
|
|
27
28
|
buttons: string[];
|
|
28
29
|
} | null;
|
|
30
|
+
activeInteractivePrompt?: InteractivePrompt | null;
|
|
31
|
+
pendingOutboundCount?: number;
|
|
32
|
+
pendingOutboundMessages?: Array<{
|
|
33
|
+
id: string;
|
|
34
|
+
role: 'user';
|
|
35
|
+
content: string;
|
|
36
|
+
queuedAt: number;
|
|
37
|
+
source: string;
|
|
38
|
+
}>;
|
|
29
39
|
errorMessage?: string;
|
|
30
40
|
errorReason?: string;
|
|
41
|
+
providerSessionId?: string;
|
|
31
42
|
bufferState?: {
|
|
32
43
|
responseBuffer?: {
|
|
33
44
|
truncated: boolean;
|
|
@@ -59,6 +70,9 @@ export interface ParsedSession {
|
|
|
59
70
|
buttons: string[];
|
|
60
71
|
} | null;
|
|
61
72
|
parsedStatus: string | null;
|
|
73
|
+
errorMessage?: string;
|
|
74
|
+
errorReason?: string;
|
|
75
|
+
providerSessionId?: string;
|
|
62
76
|
transcriptAuthority?: 'provider' | 'daemon';
|
|
63
77
|
coverage?: 'full' | 'tail' | 'current-turn';
|
|
64
78
|
}
|
|
@@ -112,6 +126,10 @@ export interface CliScriptInput {
|
|
|
112
126
|
rawBuffer: string;
|
|
113
127
|
recentBuffer: string;
|
|
114
128
|
screenText: string;
|
|
129
|
+
workspace?: string;
|
|
130
|
+
workingDir?: string;
|
|
131
|
+
providerSessionId?: string;
|
|
132
|
+
historySessionId?: string;
|
|
115
133
|
screen: CliScreenSnapshot;
|
|
116
134
|
bufferScreen: CliScreenSnapshot;
|
|
117
135
|
recentScreen: CliScreenSnapshot;
|
|
@@ -121,6 +139,7 @@ export interface CliScriptInput {
|
|
|
121
139
|
promptText?: string;
|
|
122
140
|
settings?: Record<string, any>;
|
|
123
141
|
args?: Record<string, any>;
|
|
142
|
+
spawnAt?: number;
|
|
124
143
|
}
|
|
125
144
|
export interface CliStatusInput {
|
|
126
145
|
tail: string;
|
|
@@ -158,16 +177,26 @@ export interface CliProviderModule {
|
|
|
158
177
|
binary: string;
|
|
159
178
|
approvalKeys?: Record<number, string>;
|
|
160
179
|
sendDelayMs?: number;
|
|
180
|
+
/** Wall-clock budget (ms) for a single provider script invocation. Default 50. Range 1..5000.
|
|
181
|
+
* Exceeding the budget records `timedOut: true` on the invocation trace and emits a
|
|
182
|
+
* throttled WARN — it does NOT abort the script (Node CJS can't interrupt sync code). */
|
|
183
|
+
scriptCallBudgetMs?: number;
|
|
161
184
|
sendKey?: string;
|
|
162
185
|
submitStrategy?: 'wait_for_echo' | 'immediate';
|
|
163
186
|
/** Require the typed prompt to be visible on the PTY screen before sending Enter. */
|
|
164
187
|
requirePromptEchoBeforeSubmit?: boolean;
|
|
165
188
|
/** Allow sending another prompt while the CLI is still generating so users can intervene mid-turn. */
|
|
166
189
|
allowInputDuringGeneration?: boolean;
|
|
190
|
+
/** When true, only transition to idle after the parsed transcript includes a final standard assistant message. */
|
|
191
|
+
requiresFinalAssistantBeforeIdle?: boolean;
|
|
192
|
+
/** When true, allow providers to augment stale snapshot data before parse. Reserved for future use. */
|
|
193
|
+
augmentStaleSnapshot?: boolean;
|
|
167
194
|
/** When provider-owned, daemon treats provider parser output as canonical transcript authority. */
|
|
168
195
|
transcriptAuthority?: 'provider' | 'daemon';
|
|
169
196
|
/** Full context lets provider-owned parsers canonicalize retained history instead of daemon prefix stitching. */
|
|
170
197
|
transcriptContext?: 'full' | 'tail';
|
|
198
|
+
/** v1 declarative tui block — used by CliScriptRunner to synthesize SDK helpers (declarativeDetectStatus, declarativeParseApproval). */
|
|
199
|
+
tui?: Record<string, unknown>;
|
|
171
200
|
scripts?: CliScripts;
|
|
172
201
|
spawn: {
|
|
173
202
|
command: string;
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { type SessionHostEndpoint, type SessionHostRequest, type SessionHostResponse, type SessionTerminalSnapshot, type SessionTerminalState } from '@adhdev/session-host-core';
|
|
2
|
+
type LowercaseLetter = 'a' | 'b' | 'c' | 'd' | 'e' | 'f' | 'g' | 'h' | 'i' | 'j' | 'k' | 'l' | 'm' | 'n' | 'o' | 'p' | 'q' | 'r' | 's' | 't' | 'u' | 'v' | 'w' | 'x' | 'y' | 'z';
|
|
3
|
+
type FunctionKey = 'f1' | 'f2' | 'f3' | 'f4' | 'f5' | 'f6' | 'f7' | 'f8' | 'f9' | 'f10' | 'f11' | 'f12';
|
|
4
|
+
type BaseNamedKey = 'enter' | 'escape' | 'tab' | 'backspace' | 'up' | 'down' | 'left' | 'right' | 'home' | 'end' | 'pageup' | 'pagedown' | 'space' | FunctionKey;
|
|
5
|
+
type ShiftNamedKey = BaseNamedKey | LowercaseLetter | `ctrl+${LowercaseLetter}` | `alt+${LowercaseLetter}`;
|
|
6
|
+
export type NamedKey = BaseNamedKey | `ctrl+${LowercaseLetter}` | `alt+${LowercaseLetter}` | `shift+${ShiftNamedKey}`;
|
|
7
|
+
export declare function namedKeyToAnsi(key: NamedKey | string): string;
|
|
8
|
+
export declare function namedKeysToAnsi(keys: readonly (NamedKey | string)[]): string;
|
|
9
|
+
export interface RawTerminalSessionHostClient {
|
|
10
|
+
connect(): Promise<void>;
|
|
11
|
+
request<T = unknown>(request: SessionHostRequest): Promise<SessionHostResponse<T>>;
|
|
12
|
+
close(): Promise<void>;
|
|
13
|
+
}
|
|
14
|
+
export interface RawTerminalAttachmentOptions {
|
|
15
|
+
endpoint?: SessionHostEndpoint;
|
|
16
|
+
sessionId: string;
|
|
17
|
+
mode?: 'read' | 'write';
|
|
18
|
+
clientId?: string;
|
|
19
|
+
client?: RawTerminalSessionHostClient;
|
|
20
|
+
}
|
|
21
|
+
export declare class RawTerminalAttachment {
|
|
22
|
+
readonly sessionId: string;
|
|
23
|
+
private readonly clientId;
|
|
24
|
+
private readonly mode;
|
|
25
|
+
private readonly client;
|
|
26
|
+
private closed;
|
|
27
|
+
private constructor();
|
|
28
|
+
static attach(options: RawTerminalAttachmentOptions): Promise<RawTerminalAttachment>;
|
|
29
|
+
readSnapshot(): Promise<SessionTerminalSnapshot>;
|
|
30
|
+
readScreenText(): Promise<string>;
|
|
31
|
+
readState(): Promise<SessionTerminalState>;
|
|
32
|
+
writeInput(text: string): Promise<void>;
|
|
33
|
+
writeKeys(keys: readonly (NamedKey | string)[]): Promise<void>;
|
|
34
|
+
close(): Promise<void>;
|
|
35
|
+
}
|
|
36
|
+
export declare function withRawTerminalAttachment<T>(options: RawTerminalAttachmentOptions, operation: (attachment: RawTerminalAttachment) => Promise<T>): Promise<T>;
|
|
37
|
+
export {};
|
|
@@ -104,7 +104,117 @@ export declare class DaemonCommandHandler implements CommandHelpers {
|
|
|
104
104
|
setAgentStreamManager(manager: DaemonAgentStreamManager): void;
|
|
105
105
|
handle(cmd: string, args: any): Promise<CommandResult>;
|
|
106
106
|
private dispatch;
|
|
107
|
+
/**
|
|
108
|
+
* Reload providers from disk. Does NOT pull from the registry — the user
|
|
109
|
+
* controls installs explicitly via install_provider_manifest. To upgrade
|
|
110
|
+
* an installed provider, call install_provider_manifest again with the
|
|
111
|
+
* desired version (or with no version to pick up the latest from
|
|
112
|
+
* registry), or use check_provider_updates to see what is out of date.
|
|
113
|
+
*/
|
|
107
114
|
private handleRefreshScripts;
|
|
115
|
+
/**
|
|
116
|
+
* Return per-provider availability so the dashboard's provider catalog
|
|
117
|
+
* can show "Installed" badges. Reuses the existing detection state from
|
|
118
|
+
* ProviderLoader.getMachineProviderStatus() — no probing is triggered.
|
|
119
|
+
*/
|
|
120
|
+
private handleListProviderAvailability;
|
|
121
|
+
/**
|
|
122
|
+
* Compute the *upstream cache root*. install_provider_manifest writes
|
|
123
|
+
* official-registry manifests here so the daemon's standard upstream
|
|
124
|
+
* layer picks them up — no special handling needed at load time, and
|
|
125
|
+
* the manifests inherit the official-trust badge instead of the
|
|
126
|
+
* untrusted-external one.
|
|
127
|
+
*
|
|
128
|
+
* Path matches ProviderLoader.upstreamDir but we recompute it from
|
|
129
|
+
* homedir() so this method stays usable in dev where userDir can
|
|
130
|
+
* point at a sibling git checkout.
|
|
131
|
+
*/
|
|
132
|
+
private getUpstreamInstallRoot;
|
|
133
|
+
/**
|
|
134
|
+
* Download a single provider manifest from the registry and write it to
|
|
135
|
+
* ~/.adhdev/providers/.upstream/{category}/{type}/provider.json.
|
|
136
|
+
*
|
|
137
|
+
* Used by standalone onboarding to seed the upstream cache with the
|
|
138
|
+
* default provider set on first launch. Verifies SHA-256 checksum
|
|
139
|
+
* against the registry meta before persisting. Refuses to write
|
|
140
|
+
* outside the upstream root.
|
|
141
|
+
*
|
|
142
|
+
* Args: { type: string, category?: string, version?: string }
|
|
143
|
+
* If category/version are omitted, looks up the latest from the registry.
|
|
144
|
+
*/
|
|
145
|
+
private handleInstallProviderManifest;
|
|
146
|
+
/**
|
|
147
|
+
* If `manifest.source = { type:'github', repo, ref, subdir? }` is set,
|
|
148
|
+
* walk each script directory the manifest references and download every
|
|
149
|
+
* file from the public GitHub raw endpoint. Returns a small summary so
|
|
150
|
+
* the caller can report what was fetched.
|
|
151
|
+
*
|
|
152
|
+
* Best-effort: failures don't reject the install — the manifest itself is
|
|
153
|
+
* usable for declarative-only providers, and the user still gets a clear
|
|
154
|
+
* error string back if a needed script is missing.
|
|
155
|
+
*/
|
|
156
|
+
private fetchProviderSources;
|
|
157
|
+
/**
|
|
158
|
+
* Remove a provider manifest from the upstream cache root
|
|
159
|
+
* (~/.adhdev/providers/.upstream/{category}/{type}/). Refuses to touch
|
|
160
|
+
* anything outside that root. Used by onboarding to opt out of a
|
|
161
|
+
* provider the user doesn't want; the dashboard no longer exposes a
|
|
162
|
+
* per-provider uninstall button (external sources are removed as a
|
|
163
|
+
* whole via remove_provider_source).
|
|
164
|
+
*/
|
|
165
|
+
private handleUninstallProviderManifest;
|
|
166
|
+
/**
|
|
167
|
+
* Return everything currently installed in the upstream cache with its
|
|
168
|
+
* version. This is the "what does this daemon have" answer used both by
|
|
169
|
+
* the UI and by the update checker.
|
|
170
|
+
*/
|
|
171
|
+
private handleListInstalledProviders;
|
|
172
|
+
/**
|
|
173
|
+
* For each installed provider, ask the registry for its current latest
|
|
174
|
+
* version and report whether an update is available. The user can then
|
|
175
|
+
* call install_provider_manifest to upgrade (it overwrites the file).
|
|
176
|
+
*
|
|
177
|
+
* Returns { providers: [{ type, category, installedVersion, latestVersion,
|
|
178
|
+
* updateAvailable, error? }] }
|
|
179
|
+
*/
|
|
180
|
+
private handleCheckProviderUpdates;
|
|
181
|
+
/**
|
|
182
|
+
* Register a new external provider source. The daemon clones the repo
|
|
183
|
+
* to ~/.adhdev/external/<name>/, walks it once to detect provided
|
|
184
|
+
* types, and surfaces any conflicts with already-installed types so
|
|
185
|
+
* the dashboard can ask the user how to resolve them.
|
|
186
|
+
*
|
|
187
|
+
* Args: { url: string, ref?: string, name?: string }
|
|
188
|
+
* - url: https://, git@, or any git-cloneable URL
|
|
189
|
+
* - ref: branch/tag/commit (default "main")
|
|
190
|
+
* - name: short identifier (default derived from URL)
|
|
191
|
+
*
|
|
192
|
+
* Returns: { source, providers, conflicts }
|
|
193
|
+
* - conflicts: list of types this new source provides that another
|
|
194
|
+
* source already exposes. UI uses this to prompt for active-source
|
|
195
|
+
* selection before the load takes effect.
|
|
196
|
+
*/
|
|
197
|
+
private handleAddProviderSource;
|
|
198
|
+
/**
|
|
199
|
+
* Remove a registered external source. Deletes the clone directory and
|
|
200
|
+
* any active-source entry pointing to it.
|
|
201
|
+
*
|
|
202
|
+
* Args: { name: string }
|
|
203
|
+
*/
|
|
204
|
+
private handleRemoveProviderSource;
|
|
205
|
+
/**
|
|
206
|
+
* List registered external sources + each source's currently installed
|
|
207
|
+
* providers + the active selection for any conflicting types. Used by
|
|
208
|
+
* the dashboard's "Sources" tab.
|
|
209
|
+
*/
|
|
210
|
+
private handleListProviderSources;
|
|
211
|
+
/**
|
|
212
|
+
* Pick which source's copy of a conflicting provider type is active.
|
|
213
|
+
* Other sources' copies stay on disk but the loader ignores them.
|
|
214
|
+
*
|
|
215
|
+
* Args: { type: string, sourceName: string }
|
|
216
|
+
*/
|
|
217
|
+
private handleSetActiveProviderSource;
|
|
108
218
|
private proxyDevServerPost;
|
|
109
219
|
private proxyDevServerGet;
|
|
110
220
|
private proxyDevServerScaffold;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { MeshCoordinatorMcpConfigFormat, MeshCoordinatorSystemPromptInjection, ProviderModule } from '../providers/contracts.js';
|
|
2
2
|
export interface MeshCoordinatorMcpServerLaunch {
|
|
3
3
|
command: string;
|
|
4
4
|
args: string[];
|
|
@@ -42,3 +42,74 @@ export interface ResolveMeshCoordinatorSetupOptions {
|
|
|
42
42
|
}
|
|
43
43
|
export declare function createHermesManualMeshCoordinatorSetup(meshId: string, workspace: string): MeshCoordinatorSetup;
|
|
44
44
|
export declare function resolveMeshCoordinatorSetup(options: ResolveMeshCoordinatorSetupOptions): MeshCoordinatorSetup;
|
|
45
|
+
/**
|
|
46
|
+
* Apply a provider's declared system-prompt injection rule, mutating `cliArgs`
|
|
47
|
+
* and `launchEnv` in place and writing any required workspace context file.
|
|
48
|
+
*
|
|
49
|
+
* Replaces the previous hard-coded `if (cliType === 'claude-cli') ... else if
|
|
50
|
+
* (cliType === 'hermes-cli') ...` branches in router.ts. Adding a new CLI is
|
|
51
|
+
* now provider.v1.json data, not a router edit.
|
|
52
|
+
*
|
|
53
|
+
* Failures are non-fatal: log and continue with whatever was applied so the
|
|
54
|
+
* coordinator session still launches, just without the prompt for that
|
|
55
|
+
* provider. A missing/unknown rule means "skip injection" — safe by default
|
|
56
|
+
* (the previous fallback unconditionally pushed --append-system-prompt onto
|
|
57
|
+
* every non-Claude CLI, which crashed agy on launch).
|
|
58
|
+
*/
|
|
59
|
+
export interface CoordinatorInjectionEffect {
|
|
60
|
+
/** Absolute path the daemon wrote a wrapper-blocked file to. Only set for
|
|
61
|
+
* context_file injection. R48 schedules a strip after launch so workers
|
|
62
|
+
* don't see the wrapper on disk; R47's unregister cleanup uses it as a
|
|
63
|
+
* fallback if the timer never fires (process crash, etc). */
|
|
64
|
+
contextFilePath?: string;
|
|
65
|
+
}
|
|
66
|
+
export declare function applyMeshCoordinatorSystemPromptInjection(systemPrompt: string, injection: MeshCoordinatorSystemPromptInjection | undefined, ctx: {
|
|
67
|
+
cliArgs: string[];
|
|
68
|
+
launchEnv: Record<string, string>;
|
|
69
|
+
workspace: string;
|
|
70
|
+
cliType: string;
|
|
71
|
+
}): CoordinatorInjectionEffect;
|
|
72
|
+
/**
|
|
73
|
+
* Strip the daemon's wrapper block from a context_file we previously wrote.
|
|
74
|
+
*
|
|
75
|
+
* Used in two places:
|
|
76
|
+
* 1. R48 inject-then-remove: ~5s after spawn, after agy/gemini have read
|
|
77
|
+
* the file into their in-memory system-prompt cache. Removing it from
|
|
78
|
+
* disk at that point doesn't affect the running coordinator but keeps
|
|
79
|
+
* worker sessions (or fresh non-coordinator launches) in the same
|
|
80
|
+
* workspace from picking up our wrapper.
|
|
81
|
+
* 2. R47 unregister fallback: if the timer never fires (process crash,
|
|
82
|
+
* kill -9), coordinator-registry.unregisterMeshCoordinator runs the
|
|
83
|
+
* same logic when its entry is dropped.
|
|
84
|
+
*
|
|
85
|
+
* Idempotent: missing file is fine, missing sentinels are fine, returns
|
|
86
|
+
* silently. Leaves user-authored content outside the sentinels intact.
|
|
87
|
+
* Deletes the file outright if our wrapper was the only content.
|
|
88
|
+
*/
|
|
89
|
+
export declare function stripCoordinatorWrapperFile(filePath: string): void;
|
|
90
|
+
export interface PtyExecResult {
|
|
91
|
+
exitCode: number | null;
|
|
92
|
+
signal: number | null;
|
|
93
|
+
output: string;
|
|
94
|
+
timedOut: boolean;
|
|
95
|
+
}
|
|
96
|
+
/**
|
|
97
|
+
* Run a one-shot CLI command under a real PTY and collect its output.
|
|
98
|
+
*
|
|
99
|
+
* Some provider mcp-registration commands (`agy mcp add`, future bubbletea
|
|
100
|
+
* TUIs) refuse to run without `/dev/tty`. Daemon-side `execFileSync` runs
|
|
101
|
+
* pipe-only, so those commands fail with errors like
|
|
102
|
+
* `bubbletea: error opening TTY: open /dev/tty: device not configured`
|
|
103
|
+
* and silently skip the registration, leaving the launched session
|
|
104
|
+
* without the adhdev-mesh MCP tools — which is exactly what we saw with
|
|
105
|
+
* agy coordinators.
|
|
106
|
+
*
|
|
107
|
+
* Wrapping the registration through node-pty gives the child a real PTY,
|
|
108
|
+
* so the bubbletea check passes. We close stdin immediately and just
|
|
109
|
+
* collect stdout until the process exits or the timeout fires.
|
|
110
|
+
*/
|
|
111
|
+
export declare function execUnderPty(command: string, args: string[], options?: {
|
|
112
|
+
cwd?: string;
|
|
113
|
+
env?: Record<string, string>;
|
|
114
|
+
timeoutMs?: number;
|
|
115
|
+
}): Promise<PtyExecResult>;
|
|
@@ -74,6 +74,8 @@ export interface CommandRouterDeps {
|
|
|
74
74
|
sessionHostControl?: SessionHostControlPlane | null;
|
|
75
75
|
/** Selected-coordinator mesh peer telemetry surface for target daemons, when supported by the runtime. */
|
|
76
76
|
getMeshPeerConnectionStatus?: (daemonId: string) => Record<string, unknown> | null;
|
|
77
|
+
/** Dispatch a command to a remote mesh node via P2P/relay. Injected by cloud runtime; absent in standalone. */
|
|
78
|
+
dispatchMeshCommand?: (daemonId: string, cmd: string, args: Record<string, unknown>) => Promise<unknown>;
|
|
77
79
|
}
|
|
78
80
|
export interface CommandRouterResult {
|
|
79
81
|
success: boolean;
|
|
@@ -85,9 +87,22 @@ export declare class DaemonCommandRouter {
|
|
|
85
87
|
* Allows the MCP server to query mesh data via get_mesh even when
|
|
86
88
|
* the mesh doesn't exist in the local meshes.json file. */
|
|
87
89
|
private inlineMeshCache;
|
|
90
|
+
/** Coordinator-owned whole-mesh aggregate status snapshots. Browser callers read this by default. */
|
|
91
|
+
private aggregateMeshStatusCache;
|
|
92
|
+
/** In-memory async Refinery jobs keyed by meshId:nodeId to reject/return duplicate in-flight requests. */
|
|
93
|
+
private runningRefineJobs;
|
|
94
|
+
/** Terminal async Refinery jobs preserve a clear answer after the worktree node has been removed. */
|
|
95
|
+
private terminalRefineJobs;
|
|
88
96
|
constructor(deps: CommandRouterDeps);
|
|
97
|
+
private cloneJsonValue;
|
|
98
|
+
private hydrateCachedAggregateMeshStatusFromInline;
|
|
99
|
+
private getCachedAggregateMeshStatus;
|
|
100
|
+
private rememberAggregateMeshStatus;
|
|
89
101
|
getCachedInlineMesh(meshId: string, inlineMesh?: unknown): any | undefined;
|
|
102
|
+
private warmInlineMeshCache;
|
|
90
103
|
private getMeshForCommand;
|
|
104
|
+
private invalidateAggregateMeshStatus;
|
|
105
|
+
private requireMeshHostMutationOwner;
|
|
91
106
|
private updateInlineMeshNode;
|
|
92
107
|
private removeInlineMeshNode;
|
|
93
108
|
private normalizeMeshSessionCleanupMode;
|
|
@@ -110,6 +125,13 @@ export declare class DaemonCommandRouter {
|
|
|
110
125
|
* @param source Log source ('ws' | 'p2p' | 'standalone' | etc.)
|
|
111
126
|
*/
|
|
112
127
|
execute(cmd: string, args: any, source?: string): Promise<CommandRouterResult>;
|
|
128
|
+
private buildRefineJobKey;
|
|
129
|
+
private buildRefineJobHandle;
|
|
130
|
+
private queueRefineJobEvent;
|
|
131
|
+
private appendRefineJobLedger;
|
|
132
|
+
private executeMeshRefineNodeSynchronously;
|
|
133
|
+
private finishMeshRefineJob;
|
|
134
|
+
private startMeshRefineJob;
|
|
113
135
|
/**
|
|
114
136
|
* Daemon-level command execution (IDE start/stop/restart, CLI, detect, logs).
|
|
115
137
|
* Returns null if not handled at this level → caller delegates to CommandHandler.
|
|
@@ -110,12 +110,20 @@ export declare function readProviderChatHistory(agentType: string, options?: {
|
|
|
110
110
|
excludeRecentCount?: number;
|
|
111
111
|
historyBehavior?: ProviderHistoryBehavior;
|
|
112
112
|
scripts?: ProviderNativeHistoryScripts;
|
|
113
|
+
excludeInProgressTurn?: boolean;
|
|
114
|
+
sessionStartedAtMs?: number;
|
|
115
|
+
envOverrides?: Record<string, string>;
|
|
116
|
+
forceRefresh?: boolean;
|
|
113
117
|
}): {
|
|
114
118
|
messages: HistoryMessage[];
|
|
115
119
|
hasMore: boolean;
|
|
116
120
|
source: 'provider-native' | 'adhdev-mirror' | 'native-unavailable';
|
|
117
121
|
sourcePath?: string;
|
|
118
122
|
sourceMtimeMs?: number;
|
|
123
|
+
providerSessionId?: string;
|
|
124
|
+
nativeHistoryCoverage?: string;
|
|
125
|
+
partialReason?: string;
|
|
126
|
+
unavailableReason?: string;
|
|
119
127
|
};
|
|
120
128
|
export declare function listProviderHistorySessions(agentType: string, options?: {
|
|
121
129
|
canonicalHistory?: ProviderCanonicalHistoryConfig;
|
package/dist/config/config.d.ts
CHANGED
|
@@ -86,6 +86,11 @@ export declare function isStableMachineId(machineId?: string | null): boolean;
|
|
|
86
86
|
* Get the config directory path
|
|
87
87
|
*/
|
|
88
88
|
export declare function getConfigDir(): string;
|
|
89
|
+
/**
|
|
90
|
+
* Get the daemon runtime data directory (~/.adhdev/daemon/).
|
|
91
|
+
* Distinct from the user-config dir so runtime state can be cleared independently.
|
|
92
|
+
*/
|
|
93
|
+
export declare function getDaemonDataDir(): string;
|
|
89
94
|
/**
|
|
90
95
|
* Load configuration from disk
|
|
91
96
|
*/
|