@adhdev/daemon-core 0.6.50 → 0.6.51
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/index.d.ts +4 -1
- package/dist/index.js +40 -10
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/providers/_builtin/cli/claude-cli/provider.json +6 -6
- package/providers/_builtin/cli/codex-cli/provider.json +4 -2
- package/providers/_builtin/cli/gemini-cli/provider.json +4 -2
- package/providers/_builtin/registry.json +1 -1
- package/src/cli-adapters/provider-cli-adapter.ts +42 -14
package/dist/index.d.ts
CHANGED
|
@@ -2500,7 +2500,7 @@ declare const DAEMON_WS_PATH = "/ipc";
|
|
|
2500
2500
|
* category: 'cli'
|
|
2501
2501
|
* binary: string — binary name
|
|
2502
2502
|
* spawn: { command, args, shell, env }
|
|
2503
|
-
* patterns: { prompt, generating, approval, ready }
|
|
2503
|
+
* patterns: { prompt, generating, approval, ready } — prompt helps end startup splash-gate early; sendMessage does not wait for it
|
|
2504
2504
|
* timeouts?: { idleFinish, generatingIdle, maxResponse, approvalCooldown, outputSettle, ... }
|
|
2505
2505
|
* cleanOutput(raw, lastUserInput): string
|
|
2506
2506
|
*/
|
|
@@ -2574,6 +2574,9 @@ declare class ProviderCliAdapter implements CliAdapter {
|
|
|
2574
2574
|
private idleTimeout;
|
|
2575
2575
|
private ready;
|
|
2576
2576
|
private startupBuffer;
|
|
2577
|
+
/** After spawn: briefly skip generating/settle so splash/redraw does not flip status; not used to gate sendMessage */
|
|
2578
|
+
private startupParseGate;
|
|
2579
|
+
private spawnAt;
|
|
2577
2580
|
private onPtyDataCallback;
|
|
2578
2581
|
private ptyOutputBuffer;
|
|
2579
2582
|
private ptyOutputFlushTimer;
|
package/dist/index.js
CHANGED
|
@@ -780,6 +780,9 @@ var init_provider_cli_adapter = __esm({
|
|
|
780
780
|
idleTimeout = null;
|
|
781
781
|
ready = false;
|
|
782
782
|
startupBuffer = "";
|
|
783
|
+
/** After spawn: briefly skip generating/settle so splash/redraw does not flip status; not used to gate sendMessage */
|
|
784
|
+
startupParseGate = false;
|
|
785
|
+
spawnAt = 0;
|
|
783
786
|
// PTY I/O
|
|
784
787
|
onPtyDataCallback = null;
|
|
785
788
|
ptyOutputBuffer = "";
|
|
@@ -893,9 +896,15 @@ var init_provider_cli_adapter = __esm({
|
|
|
893
896
|
this.ptyProcess = null;
|
|
894
897
|
this.setStatus("stopped", "pty_exit");
|
|
895
898
|
this.ready = false;
|
|
899
|
+
this.startupParseGate = false;
|
|
900
|
+
this.spawnAt = 0;
|
|
896
901
|
this.onStatusChange?.();
|
|
897
902
|
});
|
|
898
|
-
this.
|
|
903
|
+
this.spawnAt = Date.now();
|
|
904
|
+
this.startupParseGate = true;
|
|
905
|
+
this.startupBuffer = "";
|
|
906
|
+
this.ready = true;
|
|
907
|
+
this.setStatus("idle", "pty_ready");
|
|
899
908
|
this.onStatusChange?.();
|
|
900
909
|
}
|
|
901
910
|
// ─── Output state machine ────────────────────────────
|
|
@@ -911,7 +920,7 @@ var init_provider_cli_adapter = __esm({
|
|
|
911
920
|
}
|
|
912
921
|
}
|
|
913
922
|
this.recentOutputBuffer = (this.recentOutputBuffer + cleanData).slice(-1e3);
|
|
914
|
-
if (
|
|
923
|
+
if (this.startupParseGate) {
|
|
915
924
|
this.startupBuffer += cleanData;
|
|
916
925
|
LOG.info("CLI", `[${this.cliType}] startup chunk (${cleanData.length} chars): ${cleanData.slice(0, 200).replace(/\n/g, "\\n")}`);
|
|
917
926
|
const dialogPatterns = [
|
|
@@ -926,13 +935,19 @@ var init_provider_cli_adapter = __esm({
|
|
|
926
935
|
this.startupBuffer = "";
|
|
927
936
|
return;
|
|
928
937
|
}
|
|
929
|
-
|
|
930
|
-
|
|
931
|
-
|
|
932
|
-
|
|
933
|
-
this.
|
|
938
|
+
const elapsed = Date.now() - this.spawnAt;
|
|
939
|
+
const bufCap = this.startupBuffer.length > 12e3;
|
|
940
|
+
const promptMatched = patterns.prompt.some((p) => p.test(this.startupBuffer));
|
|
941
|
+
if (promptMatched || elapsed > 8e3 || bufCap) {
|
|
942
|
+
this.startupParseGate = false;
|
|
943
|
+
if (promptMatched) {
|
|
944
|
+
LOG.info("CLI", `[${this.cliType}] \u2713 Startup gate end (prompt matched)`);
|
|
945
|
+
} else {
|
|
946
|
+
LOG.info("CLI", `[${this.cliType}] startup gate end (${elapsed}ms, cap=${bufCap}, prompt=${promptMatched})`);
|
|
947
|
+
}
|
|
948
|
+
} else {
|
|
949
|
+
return;
|
|
934
950
|
}
|
|
935
|
-
return;
|
|
936
951
|
}
|
|
937
952
|
if (cleanData.trim().length > 5) {
|
|
938
953
|
LOG.debug("CLI", `[${this.cliType}] output chunk (${cleanData.length}): ${cleanData.slice(0, 300).replace(/\n/g, "\\n")}`);
|
|
@@ -1140,6 +1155,8 @@ var init_provider_cli_adapter = __esm({
|
|
|
1140
1155
|
this.ptyProcess = null;
|
|
1141
1156
|
this.setStatus("stopped", "stop_cmd");
|
|
1142
1157
|
this.ready = false;
|
|
1158
|
+
this.startupParseGate = false;
|
|
1159
|
+
this.spawnAt = 0;
|
|
1143
1160
|
this.onStatusChange?.();
|
|
1144
1161
|
}, this.timeouts.shutdownGrace);
|
|
1145
1162
|
}
|
|
@@ -1186,16 +1203,29 @@ var init_provider_cli_adapter = __esm({
|
|
|
1186
1203
|
* Used by DevServer /api/cli/debug endpoint.
|
|
1187
1204
|
*/
|
|
1188
1205
|
getDebugState() {
|
|
1206
|
+
const sb = this.startupBuffer;
|
|
1207
|
+
const testOnStartup = (p) => {
|
|
1208
|
+
const flags = p.flags.includes("g") ? p.flags.replace(/g/g, "") : p.flags;
|
|
1209
|
+
return new RegExp(p.source, flags).test(sb);
|
|
1210
|
+
};
|
|
1211
|
+
const promptDiagnostics = this.provider.patterns.prompt.map((p) => ({
|
|
1212
|
+
pattern: p.toString(),
|
|
1213
|
+
matchedAgainstStartupBuffer: testOnStartup(p)
|
|
1214
|
+
}));
|
|
1189
1215
|
return {
|
|
1190
1216
|
type: this.cliType,
|
|
1191
1217
|
name: this.cliName,
|
|
1192
1218
|
status: this.currentStatus,
|
|
1193
1219
|
ready: this.ready,
|
|
1220
|
+
startupParseGate: this.startupParseGate,
|
|
1221
|
+
spawnAt: this.spawnAt,
|
|
1194
1222
|
workingDir: this.workingDir,
|
|
1195
1223
|
messages: this.messages.slice(-20),
|
|
1196
1224
|
messageCount: this.messages.length,
|
|
1197
|
-
// Buffers
|
|
1198
|
-
startupBuffer:
|
|
1225
|
+
// Buffers (longer tails here than in periodic logs — for matching provider.json patterns)
|
|
1226
|
+
startupBuffer: sb.slice(-4e3),
|
|
1227
|
+
startupBufferLength: sb.length,
|
|
1228
|
+
promptDiagnostics,
|
|
1199
1229
|
recentOutputBuffer: this.recentOutputBuffer.slice(-500),
|
|
1200
1230
|
settledBuffer: this.settledBuffer.slice(-500),
|
|
1201
1231
|
responseBuffer: this.responseBuffer.slice(-500),
|