@adhdev/daemon-core 0.9.77-rc.1 → 0.9.77-rc.10

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.
@@ -77,6 +77,8 @@ export declare class ProviderCliAdapter implements CliAdapter {
77
77
  private resizeSuppressUntil;
78
78
  private statusHistory;
79
79
  private cliScripts;
80
+ /** Per-session opaque state object created by cliScripts.createState(), reset on stop. */
81
+ private scriptState;
80
82
  private runtimeSettings;
81
83
  /** Full accumulated rendered PTY transcript for parser/readback use */
82
84
  private accumulatedBuffer;
@@ -63,17 +63,27 @@ export interface ParsedSession {
63
63
  coverage?: 'full' | 'tail' | 'current-turn';
64
64
  }
65
65
  export interface CliScripts {
66
- parseSession?: (input: CliScriptInput & {
66
+ /**
67
+ * Optional state factory. Called once per CLI session start (or script reload).
68
+ * The returned object is passed as the first argument to detectStatus, parseApproval,
69
+ * and parseSession on every invocation, allowing scripts to maintain per-session state
70
+ * (e.g. last-seen status, approval fingerprints, stability counters).
71
+ *
72
+ * Scripts that don't define createState() receive null as the state argument,
73
+ * making this change fully backward compatible.
74
+ */
75
+ createState?: () => unknown;
76
+ parseSession?: (state: unknown, input: CliScriptInput & {
67
77
  tail?: string;
68
78
  tailScreen?: CliScreenSnapshot;
69
79
  }) => ParsedSession | null;
70
- detectStatus?: (input: CliStatusInput) => string | null;
71
- parseApproval?: (input: CliApprovalInput) => {
80
+ detectStatus?: (state: unknown, input: CliStatusInput) => string | null;
81
+ parseApproval?: (state: unknown, input: CliApprovalInput) => {
72
82
  message: string;
73
83
  buttons: string[];
74
84
  } | null;
75
85
  resolveAction?: (data: any) => string;
76
- [name: string]: ((input: any) => any) | undefined;
86
+ [name: string]: ((state: unknown, input: any) => any) | ((data: any) => any) | (() => unknown) | undefined;
77
87
  }
78
88
  export interface CliScreenLine {
79
89
  index: number;
package/dist/index.d.ts CHANGED
@@ -31,6 +31,11 @@ export { buildCoordinatorSystemPrompt } from './mesh/coordinator-prompt.js';
31
31
  export type { CoordinatorPromptContext } from './mesh/coordinator-prompt.js';
32
32
  export { syncMeshes } from './mesh/mesh-sync.js';
33
33
  export type { MeshSyncTransport, MeshSyncResult, RemoteMeshRecord } from './mesh/mesh-sync.js';
34
+ export { appendLedgerEntry, readLedgerEntries, getLedgerSummary, getLedgerDir, getSessionRecoveryContext } from './mesh/mesh-ledger.js';
35
+ export type { MeshLedgerEntry, MeshLedgerKind, MeshLedgerSummary, ReadLedgerOptions, SessionRecoveryContext } from './mesh/mesh-ledger.js';
36
+ export { enqueueTask, getQueue, claimNextTask, updateTaskStatus, updateSessionTaskStatus } from './mesh/mesh-work-queue.js';
37
+ export type { MeshWorkQueueEntry, MeshTaskStatus } from './mesh/mesh-work-queue.js';
38
+ export { triggerMeshQueue } from './mesh/mesh-events.js';
34
39
  export { loadState, saveState, resetState } from './config/state-store.js';
35
40
  export type { DaemonState } from './config/state-store.js';
36
41
  export { detectIDEs } from './detection/ide-detector.js';