@adhdev/daemon-core 1.0.18-rc.17 → 1.0.18-rc.19

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.
@@ -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
@@ -9,6 +9,8 @@ export type { InteractivePrompt, InteractiveQuestion, InteractiveOption, Interac
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
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';