@adhdev/daemon-core 0.9.82-rc.200 → 0.9.82-rc.202
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.js +5294 -5193
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +5314 -5213
- package/dist/index.mjs.map +1 -1
- package/dist/providers/spec/cli-adapter.d.ts +3 -0
- package/dist/providers/spec/driver.d.ts +5 -0
- package/package.json +1 -1
- package/src/commands/router.ts +7 -3
- package/src/providers/spec/cli-adapter.ts +96 -0
- package/src/providers/spec/driver.ts +8 -0
|
@@ -95,4 +95,7 @@ export declare class SpecCliAdapter implements CliAdapter {
|
|
|
95
95
|
private maybeCaptureClaudeTuiPrompt;
|
|
96
96
|
private readClaudeTuiHeaders;
|
|
97
97
|
private captureClaudeTuiPrompt;
|
|
98
|
+
getDebugState(): Record<string, any>;
|
|
99
|
+
getTraceState(limit?: number): Record<string, any>;
|
|
100
|
+
getProviderResolutionMeta(): Record<string, any>;
|
|
98
101
|
}
|
|
@@ -166,6 +166,11 @@ export declare class SpecDriver {
|
|
|
166
166
|
getLastBusyAt(): number;
|
|
167
167
|
hasIdleHoldPending(): boolean;
|
|
168
168
|
getSpecPath(): string;
|
|
169
|
+
getScreen(): string;
|
|
170
|
+
getSections(): Array<{
|
|
171
|
+
id: string;
|
|
172
|
+
text: string;
|
|
173
|
+
}> | null;
|
|
169
174
|
private loadSpecOrThrow;
|
|
170
175
|
private buildAdapterOpts;
|
|
171
176
|
private armSpecWatcher;
|
package/package.json
CHANGED
package/src/commands/router.ts
CHANGED
|
@@ -4184,9 +4184,13 @@ export class DaemonCommandRouter {
|
|
|
4184
4184
|
if (!sessionId) return { success: false, error: 'targetSessionId required' };
|
|
4185
4185
|
const target = this.deps.sessionRegistry.get(sessionId);
|
|
4186
4186
|
if (!target) return { success: false, error: 'Session not found', sessionId };
|
|
4187
|
-
const
|
|
4188
|
-
const snapshot =
|
|
4189
|
-
? (
|
|
4187
|
+
const adapterObj = this.deps.cliManager.findAdapter(target.providerType, { instanceKey: sessionId })?.adapter;
|
|
4188
|
+
const snapshot = adapterObj
|
|
4189
|
+
? (typeof (adapterObj as any).getDebugSnapshot === 'function'
|
|
4190
|
+
? (adapterObj as any).getDebugSnapshot()
|
|
4191
|
+
: typeof (adapterObj as any).getDebugState === 'function'
|
|
4192
|
+
? (adapterObj as any).getDebugState()
|
|
4193
|
+
: null)
|
|
4190
4194
|
: null;
|
|
4191
4195
|
return {
|
|
4192
4196
|
success: true,
|
|
@@ -20,6 +20,7 @@
|
|
|
20
20
|
|
|
21
21
|
import { SpecDriver, type DashboardEvent } from './driver.js';
|
|
22
22
|
import { evaluate } from './evaluator.js';
|
|
23
|
+
import { executeNativeHistory } from './native-history-executor.js';
|
|
23
24
|
import { loadSpec } from './loader.js';
|
|
24
25
|
import type { CliSpec } from './types.js';
|
|
25
26
|
import type { CliAdapter, CliAdapterStatus } from '../../cli-adapter-types.js';
|
|
@@ -340,6 +341,22 @@ export class SpecCliAdapter implements CliAdapter {
|
|
|
340
341
|
sections[(sec as any).id] = lines.slice(start, end).join('\n');
|
|
341
342
|
}
|
|
342
343
|
} catch { /* best-effort */ }
|
|
344
|
+
// Read native transcript messages for the debug snapshot
|
|
345
|
+
let messages: any[] = [];
|
|
346
|
+
if (this.spec.native_history?.source) {
|
|
347
|
+
try {
|
|
348
|
+
const nhResult = executeNativeHistory(this.spec.native_history, {
|
|
349
|
+
agentType: this.cliType,
|
|
350
|
+
providerSessionId: this.providerSessionId,
|
|
351
|
+
sessionStartedAtMs: this.spawnedAtMs,
|
|
352
|
+
envOverrides: this.spawnedEnv,
|
|
353
|
+
workspace: this.workingDir,
|
|
354
|
+
});
|
|
355
|
+
if (nhResult && Array.isArray(nhResult.messages)) messages = nhResult.messages;
|
|
356
|
+
} catch { /* best-effort */ }
|
|
357
|
+
} else {
|
|
358
|
+
messages = this.readClaudeScreenAssistantMessages();
|
|
359
|
+
}
|
|
343
360
|
return {
|
|
344
361
|
cliType: this.cliType,
|
|
345
362
|
spec_id: this.spec.id,
|
|
@@ -353,6 +370,14 @@ export class SpecCliAdapter implements CliAdapter {
|
|
|
353
370
|
idleHoldPending: this.driver.hasIdleHoldPending(),
|
|
354
371
|
lastBusyAt: this.driver.getLastBusyAt(),
|
|
355
372
|
specPath: this.driver.getSpecPath(),
|
|
373
|
+
// Extended fields
|
|
374
|
+
name: this.cliName,
|
|
375
|
+
status: this.getStatus().status,
|
|
376
|
+
workingDir: this.workingDir,
|
|
377
|
+
spawnedAtMs: this.spawnedAtMs,
|
|
378
|
+
providerSessionId: this.providerSessionId ?? null,
|
|
379
|
+
messages,
|
|
380
|
+
committedMessages: messages,
|
|
356
381
|
};
|
|
357
382
|
}
|
|
358
383
|
getRuntimeMetadata(): unknown {
|
|
@@ -535,4 +560,75 @@ export class SpecCliAdapter implements CliAdapter {
|
|
|
535
560
|
this.interactivePromptTransport = 'tui';
|
|
536
561
|
this.statusCallback?.();
|
|
537
562
|
}
|
|
563
|
+
|
|
564
|
+
getDebugState(): Record<string, any> {
|
|
565
|
+
const screen = this.driver.getScreen?.() ?? '';
|
|
566
|
+
const history = this.driver.getStateHistory();
|
|
567
|
+
const status = this.getStatus();
|
|
568
|
+
|
|
569
|
+
let messages: any[] = [];
|
|
570
|
+
if (this.spec.native_history?.source) {
|
|
571
|
+
try {
|
|
572
|
+
const result = executeNativeHistory(this.spec.native_history, {
|
|
573
|
+
agentType: this.cliType,
|
|
574
|
+
providerSessionId: this.providerSessionId,
|
|
575
|
+
sessionStartedAtMs: this.spawnedAtMs,
|
|
576
|
+
envOverrides: this.spawnedEnv,
|
|
577
|
+
workspace: this.workingDir,
|
|
578
|
+
});
|
|
579
|
+
if (result && Array.isArray(result.messages)) {
|
|
580
|
+
messages = result.messages;
|
|
581
|
+
}
|
|
582
|
+
} catch (e) {
|
|
583
|
+
// Ignore native history read errors in debug state
|
|
584
|
+
}
|
|
585
|
+
} else {
|
|
586
|
+
messages = this.readClaudeScreenAssistantMessages();
|
|
587
|
+
}
|
|
588
|
+
|
|
589
|
+
const latestState = this.latestState;
|
|
590
|
+
const latestModal = this.latestModal;
|
|
591
|
+
return {
|
|
592
|
+
type: this.cliType,
|
|
593
|
+
name: this.cliName,
|
|
594
|
+
status: status.status,
|
|
595
|
+
rawStatus: status.status,
|
|
596
|
+
projectedStatus: status.status,
|
|
597
|
+
ready: this.spawned,
|
|
598
|
+
// Legacy snapshot-style fields for panels that read getDebugSnapshot shape
|
|
599
|
+
spec_id: this.spec.id,
|
|
600
|
+
current_state: latestState ?? null,
|
|
601
|
+
current_modal: latestModal ?? null,
|
|
602
|
+
exited: this.exited,
|
|
603
|
+
idleHoldPending: this.driver.hasIdleHoldPending?.() ?? false,
|
|
604
|
+
lastBusyAt: this.driver.getLastBusyAt?.() ?? 0,
|
|
605
|
+
screen: screen,
|
|
606
|
+
screenText: screen,
|
|
607
|
+
workingDir: this.workingDir,
|
|
608
|
+
spawnedAtMs: this.spawnedAtMs,
|
|
609
|
+
providerSessionId: this.providerSessionId ?? null,
|
|
610
|
+
sections: this.driver.getSections?.() ?? null,
|
|
611
|
+
stateHistory: history,
|
|
612
|
+
specPath: (this.driver as any).opts?.specPath ?? null,
|
|
613
|
+
messages,
|
|
614
|
+
committedMessages: messages,
|
|
615
|
+
};
|
|
616
|
+
}
|
|
617
|
+
|
|
618
|
+
getTraceState(limit = 120): Record<string, any> {
|
|
619
|
+
const history = this.driver.getStateHistory();
|
|
620
|
+
return {
|
|
621
|
+
status: this.getStatus().status,
|
|
622
|
+
stateHistory: history.slice(-limit),
|
|
623
|
+
screenText: this.driver.getScreen?.() ?? '',
|
|
624
|
+
};
|
|
625
|
+
}
|
|
626
|
+
|
|
627
|
+
getProviderResolutionMeta(): Record<string, any> {
|
|
628
|
+
return {
|
|
629
|
+
type: this.cliType,
|
|
630
|
+
providerDir: null,
|
|
631
|
+
resolvedVersion: null,
|
|
632
|
+
};
|
|
633
|
+
}
|
|
538
634
|
}
|
|
@@ -311,6 +311,14 @@ export class SpecDriver {
|
|
|
311
311
|
getLastBusyAt(): number { return this.lastBusyAt; }
|
|
312
312
|
hasIdleHoldPending(): boolean { return this.idleHoldTimer !== null; }
|
|
313
313
|
getSpecPath(): string { return this.opts.specPath; }
|
|
314
|
+
getScreen(): string { return this.adapter.snapshot(); }
|
|
315
|
+
getSections(): Array<{ id: string; text: string }> | null {
|
|
316
|
+
try {
|
|
317
|
+
const screen = this.adapter.snapshot();
|
|
318
|
+
const ev = evaluate(this.spec, screen, undefined);
|
|
319
|
+
return ev.sections.map(s => ({ id: s.id, text: s.text }));
|
|
320
|
+
} catch { return null; }
|
|
321
|
+
}
|
|
314
322
|
|
|
315
323
|
// ────────────────────────────────────────────────────────────────────
|
|
316
324
|
// Loading & adapter wiring
|