@adhdev/daemon-core 0.9.77-rc.4 → 0.9.77-rc.41

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.
@@ -57,6 +57,8 @@ export interface DaemonInitConfig {
57
57
  workspace: string;
58
58
  sessionId: string;
59
59
  }) => void;
60
+ /** Relays a command to a remote mesh node daemon */
61
+ dispatchMeshCommand?: (daemonId: string, command: string, args: Record<string, unknown>) => Promise<any>;
60
62
  }
61
63
  export interface DaemonComponents {
62
64
  providerLoader: ProviderLoader;
@@ -73,6 +75,7 @@ export interface DaemonComponents {
73
75
  value: IDEInfo[];
74
76
  };
75
77
  refreshProviderAvailability: (providerType?: string) => Promise<void>;
78
+ dispatchMeshCommand?: (daemonId: string, command: string, args: Record<string, unknown>) => Promise<any>;
76
79
  }
77
80
  export interface DaemonDevSupportOptions {
78
81
  components: DaemonComponents;
@@ -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;
@@ -112,6 +114,7 @@ export declare class ProviderCliAdapter implements CliAdapter {
112
114
  private getParseScreenText;
113
115
  private shouldReadTerminalScreenSnapshot;
114
116
  private resetTerminalScreen;
117
+ private getAccumulatedRawBufferCacheKey;
115
118
  private getFreshParsedStatusCache;
116
119
  private providerOwnsTranscript;
117
120
  private shouldUseFullProviderTranscriptContext;
@@ -161,6 +164,7 @@ export declare class ProviderCliAdapter implements CliAdapter {
161
164
  private finishResponse;
162
165
  private maybeCommitVisibleIdleTranscript;
163
166
  private commitCurrentTranscript;
167
+ private invokeCliScript;
164
168
  private runParseSession;
165
169
  private runDetectStatus;
166
170
  private runParseApproval;
@@ -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;
@@ -17,6 +17,14 @@ export type MeshCoordinatorSetup = {
17
17
  requiresRestart: boolean;
18
18
  instructions: string;
19
19
  template: string;
20
+ } | {
21
+ /** Provider registers MCP via its own CLI command (e.g. `codex mcp add` / `gemini mcp add`). */
22
+ kind: 'cli_command';
23
+ serverName: string;
24
+ /** The rendered shell command to execute before launching the coordinator session. */
25
+ command: string;
26
+ requiresRestart: boolean;
27
+ instructions: string;
20
28
  } | {
21
29
  kind: 'unsupported';
22
30
  reason: string;
@@ -29,6 +37,8 @@ export interface ResolveMeshCoordinatorSetupOptions {
29
37
  adhdevMcpCommand?: string;
30
38
  adhdevMcpEntryPath?: string;
31
39
  nodeExecutable?: string;
40
+ adhdevMcpTransport?: 'local' | 'ipc';
41
+ adhdevMcpPort?: number;
32
42
  }
33
43
  export declare function createHermesManualMeshCoordinatorSetup(meshId: string, workspace: string): MeshCoordinatorSetup;
34
44
  export declare function resolveMeshCoordinatorSetup(options: ResolveMeshCoordinatorSetupOptions): MeshCoordinatorSetup;
@@ -84,7 +84,7 @@ export declare class DaemonCommandRouter {
84
84
  * the mesh doesn't exist in the local meshes.json file. */
85
85
  private inlineMeshCache;
86
86
  constructor(deps: CommandRouterDeps);
87
- private getCachedInlineMesh;
87
+ getCachedInlineMesh(meshId: string, inlineMesh?: unknown): any | undefined;
88
88
  private getMeshForCommand;
89
89
  private updateInlineMeshNode;
90
90
  private removeInlineMeshNode;
package/dist/index.d.ts CHANGED
@@ -33,8 +33,8 @@ export { syncMeshes } from './mesh/mesh-sync.js';
33
33
  export type { MeshSyncTransport, MeshSyncResult, RemoteMeshRecord } from './mesh/mesh-sync.js';
34
34
  export { appendLedgerEntry, readLedgerEntries, getLedgerSummary, getLedgerDir, getSessionRecoveryContext } from './mesh/mesh-ledger.js';
35
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';
36
+ export { enqueueTask, getQueue, claimNextTask, updateTaskStatus, updateSessionTaskStatus, cancelTask, requeueTask, getMeshQueueStats } from './mesh/mesh-work-queue.js';
37
+ export type { MeshWorkQueueEntry, MeshTaskStatus, MeshWorkQueueStats } from './mesh/mesh-work-queue.js';
38
38
  export { triggerMeshQueue } from './mesh/mesh-events.js';
39
39
  export { loadState, saveState, resetState } from './config/state-store.js';
40
40
  export type { DaemonState } from './config/state-store.js';