@adhdev/daemon-core 1.0.18-rc.2 → 1.0.18-rc.20

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.
Files changed (82) hide show
  1. package/dist/cli-adapters/cli-state-engine.d.ts +77 -0
  2. package/dist/cli-adapters/provider-cli-shared.d.ts +33 -0
  3. package/dist/cli-adapters/pty-transport.d.ts +2 -1
  4. package/dist/commands/cli-manager.d.ts +9 -0
  5. package/dist/commands/process-lifecycle.d.ts +43 -0
  6. package/dist/commands/upgrade-helper.d.ts +1 -0
  7. package/dist/commands/windows-atomic-upgrade.d.ts +17 -1
  8. package/dist/config/mesh-json-config.d.ts +62 -0
  9. package/dist/index.d.ts +4 -2
  10. package/dist/index.js +6674 -4237
  11. package/dist/index.js.map +1 -1
  12. package/dist/index.mjs +6361 -3927
  13. package/dist/index.mjs.map +1 -1
  14. package/dist/mesh/coordinator-prompt.d.ts +76 -0
  15. package/dist/mesh/mesh-active-work.d.ts +1 -1
  16. package/dist/mesh/mesh-disk-retention.d.ts +105 -0
  17. package/dist/mesh/mesh-ledger.d.ts +28 -1
  18. package/dist/mesh/mesh-node-identity.d.ts +23 -0
  19. package/dist/mesh/mesh-refine-gates.d.ts +89 -0
  20. package/dist/mesh/mesh-remote-event-pull.d.ts +3 -0
  21. package/dist/mesh/mesh-runtime-store.d.ts +11 -0
  22. package/dist/mesh/mesh-work-queue.d.ts +24 -1
  23. package/dist/providers/auto-approve-modes.d.ts +14 -0
  24. package/dist/providers/chat-message-normalization.d.ts +22 -0
  25. package/dist/providers/cli-provider-instance-types.d.ts +4 -0
  26. package/dist/providers/cli-provider-instance.d.ts +78 -0
  27. package/dist/providers/contracts.d.ts +17 -0
  28. package/dist/providers/provider-schema.d.ts +1 -0
  29. package/dist/providers/sdk/v1/builders/cli/detect-status.d.ts +14 -0
  30. package/dist/providers/types/interactive-prompt.d.ts +18 -0
  31. package/dist/repo-mesh-types.d.ts +38 -6
  32. package/dist/shared-types.d.ts +4 -2
  33. package/package.json +3 -3
  34. package/src/boot/daemon-lifecycle.ts +10 -0
  35. package/src/cli-adapters/cli-state-engine.ts +220 -3
  36. package/src/cli-adapters/provider-cli-adapter.ts +41 -11
  37. package/src/cli-adapters/provider-cli-shared.ts +48 -0
  38. package/src/cli-adapters/pty-transport.d.ts +2 -1
  39. package/src/cli-adapters/pty-transport.ts +1 -1
  40. package/src/cli-adapters/session-host-transport.ts +8 -3
  41. package/src/commands/cli-manager.ts +72 -8
  42. package/src/commands/high-family/mesh-coordinator-launch.ts +17 -2
  43. package/src/commands/high-family/mesh-events.ts +13 -2
  44. package/src/commands/med-family/mesh-crud.ts +155 -0
  45. package/src/commands/med-family/mesh-queue.ts +74 -1
  46. package/src/commands/process-lifecycle.ts +248 -0
  47. package/src/commands/router-refine.ts +71 -4
  48. package/src/commands/router.ts +8 -0
  49. package/src/commands/upgrade-helper.ts +106 -82
  50. package/src/commands/windows-atomic-upgrade.ts +281 -35
  51. package/src/config/mesh-json-config.ts +111 -0
  52. package/src/index.ts +21 -1
  53. package/src/mesh/coordinator-prompt.ts +258 -11
  54. package/src/mesh/mesh-active-work.ts +11 -1
  55. package/src/mesh/mesh-completion-synthesis.ts +12 -1
  56. package/src/mesh/mesh-disk-retention.ts +370 -0
  57. package/src/mesh/mesh-event-classify.ts +19 -0
  58. package/src/mesh/mesh-event-forwarding.ts +64 -6
  59. package/src/mesh/mesh-events-utils.ts +42 -0
  60. package/src/mesh/mesh-ledger.ts +77 -0
  61. package/src/mesh/mesh-node-identity.ts +49 -0
  62. package/src/mesh/mesh-queue-assignment.ts +210 -11
  63. package/src/mesh/mesh-reconcile-loop.ts +306 -3
  64. package/src/mesh/mesh-refine-gates.ts +300 -0
  65. package/src/mesh/mesh-remote-event-pull.ts +68 -47
  66. package/src/mesh/mesh-runtime-store.ts +21 -0
  67. package/src/mesh/mesh-work-queue.ts +85 -2
  68. package/src/providers/auto-approve-modes.ts +103 -0
  69. package/src/providers/chat-message-normalization.ts +53 -0
  70. package/src/providers/cli-provider-instance-types.ts +53 -0
  71. package/src/providers/cli-provider-instance.ts +497 -15
  72. package/src/providers/contracts.ts +25 -1
  73. package/src/providers/provider-schema.ts +83 -0
  74. package/src/providers/sdk/v1/builders/cli/detect-status.ts +23 -0
  75. package/src/providers/sdk/v1/builders/cli/parse-approval.ts +20 -0
  76. package/src/providers/sdk/v1/schemas/cli/provider.schema.json +44 -0
  77. package/src/providers/types/interactive-prompt.ts +77 -0
  78. package/src/repo-mesh-types.ts +112 -12
  79. package/src/session-host/managed-host.ts +34 -0
  80. package/src/shared-types.ts +9 -1
  81. package/src/status/reporter.ts +1 -0
  82. package/src/status/snapshot.ts +2 -0
@@ -59,6 +59,17 @@ export interface CliStateEngineCallbacks {
59
59
  */
60
60
  isInApprovalResumeGrace?(): boolean;
61
61
  }
62
+ /**
63
+ * Minimal shape computeApprovalContentSignature / isStaleResolvedApproval
64
+ * actually need — deliberately narrower than the full CliBufferSnapshot so
65
+ * callers outside the settled-eval loop (e.g. the adapter's startup-gate
66
+ * modal parse in getStatus/getDebugState) can supply just these two fields
67
+ * without having to fabricate an entire snapshot.
68
+ */
69
+ interface ApprovalSignatureSnapshot {
70
+ screenText?: string;
71
+ accumulatedBuffer?: string;
72
+ }
62
73
  export declare class CliStateEngine {
63
74
  private readonly provider;
64
75
  private readonly runner;
@@ -76,6 +87,22 @@ export declare class CliStateEngine {
76
87
  } | null;
77
88
  lastApprovalResolvedAt: number;
78
89
  lastResolvedModalMessage: string;
90
+ /**
91
+ * Normalized approval-context signature captured at resolve time (see
92
+ * `computeApprovalContentSignature`) — the screen text with blank-line
93
+ * padding and any manifest-declared chrome (transcriptPty.chromePatterns,
94
+ * spinner.patterns) stripped out. Used by applyWaitingApproval's
95
+ * isStaleResolvedRepaint check to tell "the same already-answered modal,
96
+ * re-parsed from a screen that has not meaningfully changed" apart from
97
+ * "a genuinely new approval" — content-based, not time-based, because
98
+ * ordinary TUI chrome (status bar, context meter, blank-line repaint)
99
+ * keeps producing fresh PTY bytes on an otherwise-unchanged screen and
100
+ * defeats any output-timestamp discriminator within a few hundred ms.
101
+ * Cleared whenever a turn starts or the session tears down (see
102
+ * onTurnStarted / resetActiveTurnState / onPtyExit) so a next-turn
103
+ * approval is never compared against stale prior-turn state.
104
+ */
105
+ lastApprovalResolvedContentSignature: string;
79
106
  /**
80
107
  * Monotonic counter bumped every time the FSM *enters* waiting_approval
81
108
  * with a freshly captured modal (see `applyWaitingApproval`). It is the
@@ -243,6 +270,55 @@ export declare class CliStateEngine {
243
270
  finishResponse(): void;
244
271
  private scheduleIdleFinish;
245
272
  private cancelPendingIdleFinish;
273
+ /**
274
+ * Derive a stable approval-context signature from the current screen,
275
+ * with blank-line padding and any manifest-declared chrome stripped out.
276
+ *
277
+ * Generic by design — no kimi- or provider-specific hardcoding: it reads
278
+ * whatever `tui.transcriptPty.chromePatterns` and `tui.spinner.patterns`
279
+ * the ACTIVE provider's own manifest already declares (present on any
280
+ * declarative-TUI provider; simply absent/empty for scripted providers,
281
+ * in which case this degrades to blank-line stripping only — never worse
282
+ * than comparing the raw screen). Those pattern lists exist precisely to
283
+ * name "known volatile repaint noise" (status bar, context meter, spinner
284
+ * ticks, banners) — reusing them here means the SAME declared knowledge
285
+ * that governs transcript-chrome stripping also governs staleness
286
+ * detection, instead of re-encoding provider knowledge into daemon-core.
287
+ *
288
+ * Deliberately NOT a hash of the whole screen/buffer: an ordinary TUI
289
+ * repaints its footer/status/context-meter chrome continuously even while
290
+ * genuinely idle, so a raw whole-screen or whole-buffer fingerprint (or a
291
+ * mere "did any bytes arrive" timestamp) changes on every repaint tick
292
+ * regardless of whether anything approval-relevant actually happened.
293
+ * Stripping the declared chrome first yields a signature that only
294
+ * changes when the surrounding conversation/tool-output content itself
295
+ * changes — exactly the discriminator applyWaitingApproval's
296
+ * isStaleResolvedRepaint check needs.
297
+ */
298
+ private computeApprovalContentSignature;
299
+ /**
300
+ * True when `modal` is a stale re-parse of an already-resolved approval:
301
+ * same message text, and the chrome-stripped approval-context signature
302
+ * of `snap` is unchanged from the signature captured at resolve time.
303
+ *
304
+ * Public and reused verbatim by BOTH the settled-eval capture path
305
+ * (applyWaitingApproval, below) and any OUTSIDE re-parse the adapter
306
+ * performs independently of the settle loop — e.g. provider-cli-adapter's
307
+ * getStatus()/getDebugState() startup-gate modal detection, which reads
308
+ * `recentOutputBuffer` directly while `startupParseGate` is open and can
309
+ * re-surface the same already-resolved modal before the gate closes.
310
+ * Centralizing the discriminator here means there is exactly ONE
311
+ * definition of "stale" for the whole session — no divergent duplicate
312
+ * heuristic re-implemented per call site.
313
+ */
314
+ isStaleResolvedApproval(modal: {
315
+ message: string;
316
+ buttons: string[];
317
+ } | null, snap: ApprovalSignatureSnapshot): boolean;
318
+ /** Clear all resolve-time approval bookkeeping (message, timestamp, content
319
+ * signature) — called at turn/session boundaries so a next-turn or
320
+ * next-session approval is never compared against stale prior state. */
321
+ private clearApprovalResolutionMemory;
246
322
  /**
247
323
  * Schedule one more settled evaluation while pinned to `waiting_approval`
248
324
  * with no actionable modal. The settled FSM normally only re-runs on new
@@ -269,3 +345,4 @@ export declare class CliStateEngine {
269
345
  private parsedStatusHasFinalStandardAssistantMessage;
270
346
  private recordTrace;
271
347
  }
348
+ export {};
@@ -270,6 +270,39 @@ export interface CliProviderModule {
270
270
  _resolvedScriptsSource?: string | null;
271
271
  _versionWarning?: string | null;
272
272
  }
273
+ /**
274
+ * PURE-PTY TRANSCRIPT CLASS predicate (kimi and kin).
275
+ *
276
+ * A provider is "pure-PTY full-buffer" when it reconstructs its ENTIRE transcript
277
+ * from the rendered PTY buffer on every read and has NO alternate transcript
278
+ * source:
279
+ * - transcriptAuthority !== 'provider' (the daemon PTY parser owns the transcript,
280
+ * not a provider-side canonical source)
281
+ * - NO nativeHistory (no on-disk / native-source history to fall back to)
282
+ * - tui.transcriptPty.scope === 'buffer' (the parser walks the full rendered buffer)
283
+ *
284
+ * This class is invisible to two provider-authority-keyed code paths that other
285
+ * providers rely on for mesh completion semantics:
286
+ * 1. CliStateEngine.onTurnStarted only promotes to 'generating' for
287
+ * transcriptAuthority==='provider' providers — so a pure-PTY session that
288
+ * submits a prompt while already idle collapses idle→idle, the
289
+ * generating→idle edge never occurs, and agent:generating_completed is never
290
+ * emitted (the coordinator ledger leaves the task 'assigned' forever).
291
+ * 2. checkMeshWorkerStall's native-transcript completion reconcile is gated on
292
+ * the native-source shape, so a finished pure-PTY worker's static idle is
293
+ * misread as monitor:no_progress (a false task_stalled).
294
+ *
295
+ * The runtime capability, NOT any single spec field value, is authoritative: a
296
+ * given kimi manifest checkout may declare nativeHistory/transcriptAuthority, but
297
+ * the live-loaded pure-PTY session has none. Callers that only hold a
298
+ * CliProviderModule (the engine) share this exact predicate with the adapter
299
+ * (parsesFullPtyTranscriptFromBuffer) so the two never drift.
300
+ */
301
+ export declare function isPurePtyTranscriptProvider(provider: {
302
+ transcriptAuthority?: 'provider' | 'daemon';
303
+ nativeHistory?: unknown;
304
+ tui?: Record<string, unknown>;
305
+ } | null | undefined): boolean;
273
306
  /**
274
307
  * Stateful, transcript-oriented terminal cell accumulator.
275
308
  *
@@ -39,7 +39,8 @@ export interface PtyRuntimeTransport {
39
39
  getMetadata?(): PtyRuntimeMetadata | null;
40
40
  onData(callback: (data: string) => void): void;
41
41
  onExit(callback: (info: {
42
- exitCode: number;
42
+ exitCode: number | null;
43
+ signal?: number | null;
43
44
  }) => void): void;
44
45
  }
45
46
  export interface PtyTransportFactory {
@@ -131,6 +131,15 @@ export declare function expandModelLaunchArgs(template: string[] | undefined, mo
131
131
  * thinking request without a template is a no-op). BRAIN-ROUTING thinking axis.
132
132
  */
133
133
  export declare function expandThinkingLaunchArgs(template: string[] | undefined, level: string | undefined, levelMap: Partial<Record<string, string>> | undefined): string[] | undefined;
134
+ /**
135
+ * Apply a selected launch-args auto-approve mode without mutating provider metadata.
136
+ * removeArgs only targets provider-owned base spawn.args; launchArgs are prepended to
137
+ * per-launch args beside model/thinking args, making conflict removal order-independent.
138
+ */
139
+ export declare function applyAutoApproveModeLaunchArgs(provider: ProviderModule | undefined, cliArgs: string[] | undefined, settings: Record<string, unknown> | undefined): {
140
+ provider: ProviderModule | undefined;
141
+ cliArgs: string[] | undefined;
142
+ };
134
143
  export declare function supportsExplicitSessionResume(resume?: ProviderResumeCapability): boolean;
135
144
  export declare function resolveCliSessionBinding(provider: ProviderModule | undefined, normalizedType: string, cliArgs?: string[], requestedResumeSessionId?: string): CliSessionBinding;
136
145
  export declare class DaemonCliManager {
@@ -0,0 +1,43 @@
1
+ export interface ProcessLifecycleOptions {
2
+ platform?: NodeJS.Platform;
3
+ execFileSync?: typeof import('child_process').execFileSync;
4
+ }
5
+ export interface OwnedProcessInfo {
6
+ pid: number;
7
+ commandLine: string | null;
8
+ }
9
+ export declare function getProcessCommandLine(pid: number, options?: ProcessLifecycleOptions): string | null;
10
+ /**
11
+ * Extract the script argument (the token after the node executable) from a
12
+ * command line. Handles both quoted and unquoted executables/scripts.
13
+ */
14
+ export declare function parseNodeScriptPath(commandLine: string | null): string | null;
15
+ export declare function killProcess(pid: number, options?: ProcessLifecycleOptions): boolean;
16
+ export declare function waitForPidExit(pid: number, timeoutMs: number): Promise<boolean>;
17
+ /**
18
+ * List Node processes whose command line places them under any of the supplied
19
+ * prefixes. Windows-only — the versioned-prefix lifecycle this supports does not
20
+ * exist on POSIX, so the helper is a no-op there.
21
+ */
22
+ export declare function listOwnedNodeProcesses(options: {
23
+ prefixes: readonly string[];
24
+ excludePids?: readonly number[];
25
+ markers?: readonly string[];
26
+ } & ProcessLifecycleOptions): OwnedProcessInfo[];
27
+ export declare function stopOwnedProcesses(options: {
28
+ processes: readonly OwnedProcessInfo[];
29
+ waitMs?: number;
30
+ } & ProcessLifecycleOptions): Promise<{
31
+ stopped: number;
32
+ survivors: OwnedProcessInfo[];
33
+ }>;
34
+ export declare function stopOwnedProcessesForPrefixes(options: {
35
+ prefixes: readonly string[];
36
+ excludePids?: readonly number[];
37
+ markers?: readonly string[];
38
+ waitMs?: number;
39
+ log?: (message: string) => void;
40
+ } & ProcessLifecycleOptions): Promise<{
41
+ stopped: number;
42
+ survivors: OwnedProcessInfo[];
43
+ }>;
@@ -29,6 +29,7 @@ export declare function resolveCurrentGlobalInstallSurface(options: {
29
29
  currentCliPath?: string;
30
30
  nodeExecutable?: string;
31
31
  platform?: NodeJS.Platform;
32
+ homeDir?: string;
32
33
  }): CurrentGlobalInstallSurface;
33
34
  export declare function buildPinnedGlobalInstallCommand(options: {
34
35
  packageName: string;
@@ -1,4 +1,6 @@
1
1
  import { type ChildProcess } from 'child_process';
2
+ export declare const DEFAULT_HEALTH_TIMEOUT_MS = 120000;
3
+ export declare const ADHDEV_OWNED_MARKERS: readonly ["session-host-daemon", "node_modules/adhdev", "node_modules/@adhdev/daemon-standalone"];
2
4
  export interface WindowsInstallerLayout {
3
5
  homeDir: string;
4
6
  installRoot: string;
@@ -13,7 +15,7 @@ export interface WindowsAtomicUpgradeHooks {
13
15
  restartOld: (portableNode: string) => void;
14
16
  waitForHealth: (pid: number, targetVersion: string) => Promise<boolean>;
15
17
  stopProcess: (pid: number) => void;
16
- cleanup: (layout: WindowsInstallerLayout, activePrefix: string) => void;
18
+ cleanup: (layout: WindowsInstallerLayout, activePrefix: string) => void | Promise<void>;
17
19
  log: (message: string) => void;
18
20
  }
19
21
  export interface WindowsAtomicUpgradeOptions {
@@ -22,6 +24,8 @@ export interface WindowsAtomicUpgradeOptions {
22
24
  targetVersion: string;
23
25
  portableNode: string;
24
26
  hooks: WindowsAtomicUpgradeHooks;
27
+ /** PIDs that must never be terminated during prefix sweeps (helper + parent daemon). */
28
+ excludePids?: number[];
25
29
  }
26
30
  export interface WindowsAtomicUpgradeResult {
27
31
  stagedPrefix: string;
@@ -43,5 +47,17 @@ export declare function createDefaultWindowsAtomicHooks(options: {
43
47
  cwd: string;
44
48
  env: NodeJS.ProcessEnv;
45
49
  log: (message: string) => void;
50
+ /** Loopback IPC port to probe for health/version. Defaults to the daemon's local IPC port. */
51
+ healthPort?: number;
52
+ /** How long to poll for the replacement daemon to report the target version. */
53
+ healthTimeoutMs?: number;
46
54
  }): WindowsAtomicUpgradeHooks;
47
55
  export declare function boundedCleanupInactivePrefixes(layout: WindowsInstallerLayout, activePrefix: string, log: (message: string) => void): void;
56
+ export declare function cleanupInactivePrefixesWithGuard(options: {
57
+ layout: WindowsInstallerLayout;
58
+ activePrefix: string;
59
+ excludePids?: number[];
60
+ markers?: readonly string[];
61
+ waitMs?: number;
62
+ log?: (message: string) => void;
63
+ }): Promise<void>;
@@ -19,6 +19,18 @@
19
19
  * machine-local policy directly. The repo file shapes the coordinator prompt and
20
20
  * operating notes, nothing else.
21
21
  *
22
+ * `providerDefaults` IS NOT POLICY EITHER. It is a repo-shared DECLARATIVE
23
+ * "requested auto-approve mode" per providerType — the answer to "WHEN a delegated
24
+ * worker of type X is auto-approved, WHICH mode should it use by default". It has
25
+ * NO say over WHETHER auto-approve is enabled: the ENABLE decision (and the
26
+ * dangerous-mode opt-in) remains 100% machine-local (meshes.json /
27
+ * RepoMeshPolicy). A repo can declare `providerDefaults` freely; a machine that
28
+ * has delegatedWorkerAutoApprove=false still gets no auto-approve, and a dangerous
29
+ * requested mode is still downgraded to PTY parsing unless the machine opts in.
30
+ * The requested mode ID is validated at runtime against the provider spec — an
31
+ * unknown mode ID is IGNORED (fall back to the provider's own default), never
32
+ * silently coerced into a dangerous mode.
33
+ *
22
34
  * The coordinator/operatingNotes merge is **in-memory only**: the on-disk
23
35
  * machine-local `meshes.json` is never mutated by this module.
24
36
  *
@@ -48,6 +60,18 @@ export interface RepoMeshDeclarativeLimits {
48
60
  /** Advisory only in v1 — recorded but never enforced. */
49
61
  maxNotes?: number;
50
62
  }
63
+ /**
64
+ * Repo-shared declarative per-provider defaults. NOT policy — see the file header.
65
+ * `autoApproveModes` maps a providerType (e.g. "claude-cli") to the auto-approve
66
+ * mode ID that a delegated worker of that type should REQUEST when it is
67
+ * auto-approved. The map only influences WHICH mode is used, never WHETHER
68
+ * auto-approve is enabled (that stays machine-local). Mode IDs are validated
69
+ * against the live provider spec at resolve time; an unknown ID is ignored.
70
+ */
71
+ export interface RepoMeshDeclarativeProviderDefaults {
72
+ /** providerType → requested auto-approve mode ID. */
73
+ autoApproveModes?: Record<string, string>;
74
+ }
51
75
  /**
52
76
  * Parsed + normalized `.adhdev/mesh.json` shape. Every field is optional except
53
77
  * version so a repo can declare only the zone(s) it cares about. Policy is NOT a
@@ -58,6 +82,8 @@ export interface RepoMeshDeclarativeConfig {
58
82
  coordinator?: RepoMeshDeclarativeCoordinatorConfig;
59
83
  operatingNotes?: CoordinatorOperatingNote[];
60
84
  limits?: RepoMeshDeclarativeLimits;
85
+ /** Repo-shared per-provider defaults (requested auto-approve mode). NOT policy. */
86
+ providerDefaults?: RepoMeshDeclarativeProviderDefaults;
61
87
  }
62
88
  export interface RepoMeshJsonConfigLoadResult {
63
89
  config?: RepoMeshDeclarativeConfig;
@@ -133,6 +159,18 @@ export declare const MESH_JSON_CONFIG_SCHEMA: {
133
159
  };
134
160
  };
135
161
  };
162
+ readonly providerDefaults: {
163
+ readonly type: "object";
164
+ readonly additionalProperties: false;
165
+ readonly properties: {
166
+ readonly autoApproveModes: {
167
+ readonly type: "object";
168
+ readonly additionalProperties: {
169
+ readonly type: "string";
170
+ };
171
+ };
172
+ };
173
+ };
136
174
  };
137
175
  };
138
176
  /**
@@ -193,7 +231,31 @@ export declare function applyRepoMeshConfig<T extends Pick<LocalMeshEntry, 'coor
193
231
  * exported — it is machine-local only and has no place in mesh.json. Operating
194
232
  * notes are intentionally NOT exported either: those are runtime ledger lessons,
195
233
  * and a repo should declare baseline notes deliberately.
234
+ *
235
+ * `providerDefaults` is NOT auto-exported from the machine-local mesh (there is no
236
+ * machine-local source for it — it is a repo-authored declaration). To help an
237
+ * operator hand-author it, the scaffold carries a commented example shape:
238
+ *
239
+ * "providerDefaults": {
240
+ * "autoApproveModes": {
241
+ * "claude-cli": "accept-edits", // requested mode WHEN auto-approve is on
242
+ * "codex-cli": "auto" // (enable/dangerous opt-in stays machine-local)
243
+ * }
244
+ * }
245
+ *
246
+ * The example is surfaced via the scaffold's `_providerDefaultsExample` hint (JSON
247
+ * has no comments) rather than a live `providerDefaults` value, so serializing the
248
+ * scaffold never writes an unwanted requested-mode map into the repo file.
196
249
  */
197
250
  export declare function buildMeshJsonConfigScaffold(mesh: Pick<LocalMeshEntry, 'coordinator'>): RepoMeshDeclarativeConfig;
251
+ /**
252
+ * A copy-paste example of the `providerDefaults` zone for operators hand-authoring
253
+ * a repo `.adhdev/mesh.json`. Returned by the export/write commands as a separate
254
+ * hint field (never merged into the serialized scaffold) so the repo file stays
255
+ * clean. The mode IDs shown are illustrative — a repo should use IDs that exist in
256
+ * its own providers' specs; an unknown ID is ignored at resolve time and the
257
+ * provider's own default is used.
258
+ */
259
+ export declare const MESH_JSON_PROVIDER_DEFAULTS_EXAMPLE: RepoMeshDeclarativeProviderDefaults;
198
260
  /** Serialize a scaffold to the canonical 2-space JSON draft text. */
199
261
  export declare function serializeMeshJsonConfigScaffold(config: RepoMeshDeclarativeConfig): string;
package/dist/index.d.ts CHANGED
@@ -8,7 +8,9 @@ export type { SessionEntry, CompactSessionEntry, CompactDaemonEntry, CloudDaemon
8
8
  export type { InteractivePrompt, InteractiveQuestion, InteractiveOption, InteractivePromptResponse, InteractiveAnswer, } from './providers/types/interactive-prompt.js';
9
9
  export { normalizeInteractivePrompt, normalizeInteractivePromptResponse, buildClaudeInteractiveToolResult, interactivePromptFromClaudeAskUserQuestion, detectClaudeAskUserQuestionPromptFromJson, } from './providers/types/interactive-prompt.js';
10
10
  export type { RepoMesh, RepoMeshDaemonRole, RepoMeshHostMetadata, RepoMeshHostPairingMetadata, RepoMeshHostStatus, RepoMeshNode, RepoMeshNodeHealth, RepoMeshPolicy, RepoMeshMagiSessionCleanupMode, RepoMeshNodePolicy, RepoMeshRelatedRepo, RepoMeshNodeCapabilities, DetectedCommand, ProjectContextSnapshot, ProjectContextSource, RepoMeshCoordinatorConfig, LocalMeshConfig, LocalMeshEntry, LocalMeshNodeEntry, RepoMeshStatus, RepoMeshNodeStatus, RepoMeshPeerConnectionStatus, RepoMeshPeerConnectionState, RepoMeshPeerConnectionTransport, RepoMeshSessionStatus, RepoMeshQueueTask, RepoMeshQueueTaskStatus, RepoMeshQueueSummary, RepoMeshQueueStatus, RepoMeshLedgerEntryStatus, RepoMeshLedgerSummaryStatus, RepoMeshLedgerStatus, MeshAsyncJobLifecycle, RepoMeshSchedulingStrategy, RepoMeshSchedulingStatus, RepoMeshNodeSchedulingStatus, RepoMeshNodeProviderSchedulingStatus, } from './repo-mesh-types.js';
11
- export { DEFAULT_MESH_POLICY, resolveDelegatedWorkerAutoApprove, resolveAllowSendKeysDestructive, resolveMagiSessionCleanupMode, magiAutoLaunchedSessionCleanupDecision, MESH_SCHEDULING_STRATEGIES, DEFAULT_MESH_SCHEDULING_STRATEGY, normalizeMeshSchedulingStrategy, resolveNodeSchedulingPriority, resolveProviderMaxParallel, mergeAndNormalizePolicy, normalizeAutoFastForwardPolicy, resolveMaxParallelTasks, MESH_MAX_PARALLEL_TASKS_MIN, MESH_MAX_PARALLEL_TASKS_MAX, MESH_CONVERGE_REFINE_TAG, MESH_CONVERGE_FAST_FORWARD_TAG, resolveAutoConvergeCodeChange, } from './repo-mesh-types.js';
11
+ export { DEFAULT_MESH_POLICY, resolveDelegatedWorkerAutoApprove, delegatedWorkerAutoApproveSettings, resolveDelegatedWorkerDangerousModeAllow, resolveAllowSendKeysDestructive, resolveMagiSessionCleanupMode, magiAutoLaunchedSessionCleanupDecision, MESH_SCHEDULING_STRATEGIES, DEFAULT_MESH_SCHEDULING_STRATEGY, normalizeMeshSchedulingStrategy, resolveNodeSchedulingPriority, resolveProviderMaxParallel, mergeAndNormalizePolicy, normalizeAutoFastForwardPolicy, resolveMaxParallelTasks, MESH_MAX_PARALLEL_TASKS_MIN, MESH_MAX_PARALLEL_TASKS_MAX, MESH_CONVERGE_REFINE_TAG, MESH_CONVERGE_FAST_FORWARD_TAG, resolveAutoConvergeCodeChange, } from './repo-mesh-types.js';
12
+ export { loadRepoMeshJsonConfig, normalizeRepoMeshDeclarativeConfig, buildMeshJsonConfigScaffold, serializeMeshJsonConfigScaffold, MESH_JSON_CONFIG_LOCATIONS, MESH_JSON_CONFIG_SCHEMA, MESH_JSON_PROVIDER_DEFAULTS_EXAMPLE, } from './config/mesh-json-config.js';
13
+ export type { RepoMeshDeclarativeConfig, RepoMeshDeclarativeCoordinatorConfig, RepoMeshDeclarativeLimits, RepoMeshDeclarativeProviderDefaults, RepoMeshJsonConfigLoadResult, } from './config/mesh-json-config.js';
12
14
  export * from './git/index.js';
13
15
  import type { RuntimeWriteOwner as _RuntimeWriteOwner } from './shared-types-extra.js';
14
16
  import type { RuntimeAttachedClient as _RuntimeAttachedClient } from './shared-types-extra.js';
@@ -137,7 +139,7 @@ export { ProviderInstanceManager } from './providers/provider-instance-manager.j
137
139
  export { IdeProviderInstance } from './providers/ide-provider-instance.js';
138
140
  export { CliProviderInstance } from './providers/cli-provider-instance.js';
139
141
  export { AcpProviderInstance } from './providers/acp-provider-instance.js';
140
- export type { ProviderModule, CdpTargetFilter, ProviderResumeCapability, InputEnvelope, InputPart, MessagePart, ReadChatTurnStatus, ControlListResult, ControlSetResult, ControlInvokeResult } from './providers/contracts.js';
142
+ export type { ProviderModule, AutoApproveMode, AutoApproveModesConfig, AutoApproveModeRisk, AutoApproveModeStrategy, CdpTargetFilter, ProviderResumeCapability, InputEnvelope, InputPart, MessagePart, ReadChatTurnStatus, ControlListResult, ControlSetResult, ControlInvokeResult } from './providers/contracts.js';
141
143
  export type { ProviderSourceConfigSnapshot, ProviderSourceConfigUpdate } from './config/provider-source-config.js';
142
144
  export { parseProviderSourceConfigUpdate } from './config/provider-source-config.js';
143
145
  export { normalizeInputEnvelope, normalizeMessageParts, flattenMessageParts } from './providers/io-contracts.js';