@adhdev/daemon-core 0.9.82-rc.200 → 0.9.82-rc.201

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.
@@ -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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@adhdev/daemon-core",
3
- "version": "0.9.82-rc.200",
3
+ "version": "0.9.82-rc.201",
4
4
  "description": "ADHDev daemon core — CDP, IDE detection, providers, command execution",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -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 adapter = this.deps.cliManager.findAdapter(target.providerType, { instanceKey: sessionId })?.adapter;
4188
- const snapshot = (adapter && typeof (adapter as any).getDebugSnapshot === 'function')
4189
- ? (adapter as any).getDebugSnapshot()
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,
@@ -535,4 +535,39 @@ export class SpecCliAdapter implements CliAdapter {
535
535
  this.interactivePromptTransport = 'tui';
536
536
  this.statusCallback?.();
537
537
  }
538
+
539
+ getDebugState(): Record<string, any> {
540
+ const screen = this.driver.getScreen?.() ?? '';
541
+ const history = this.driver.getStateHistory();
542
+ const status = this.getStatus();
543
+ return {
544
+ type: this.cliType,
545
+ name: this.cliName,
546
+ status: status.status,
547
+ rawStatus: status.status,
548
+ projectedStatus: status.status,
549
+ ready: this.spawned,
550
+ screenText: screen,
551
+ sections: this.driver.getSections?.() ?? null,
552
+ stateHistory: history,
553
+ specPath: (this.driver as any).opts?.specPath ?? null,
554
+ };
555
+ }
556
+
557
+ getTraceState(limit = 120): Record<string, any> {
558
+ const history = this.driver.getStateHistory();
559
+ return {
560
+ status: this.getStatus().status,
561
+ stateHistory: history.slice(-limit),
562
+ screenText: this.driver.getScreen?.() ?? '',
563
+ };
564
+ }
565
+
566
+ getProviderResolutionMeta(): Record<string, any> {
567
+ return {
568
+ type: this.cliType,
569
+ providerDir: null,
570
+ resolvedVersion: null,
571
+ };
572
+ }
538
573
  }
@@ -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