opencode-swarm 7.133.0 → 7.134.0

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 (77) hide show
  1. package/dist/background/completion-observer.d.ts +17 -7
  2. package/dist/background/pending-delegations.d.ts +305 -30
  3. package/dist/cli/{config-doctor-8nbdwnn6.js → config-doctor-t5r92674.js} +3 -3
  4. package/dist/cli/{core-egwpry19.js → core-d6yd2jzv.js} +3 -3
  5. package/dist/cli/{curation-policy-gae3xm5d.js → curation-policy-3smfn2a3.js} +7 -7
  6. package/dist/cli/{curator-drift-ea0p8nh1.js → curator-drift-tsyyf4b4.js} +6 -6
  7. package/dist/cli/{curator-e88bm4mg.js → curator-hva8f3nf.js} +31 -28
  8. package/dist/cli/{curator-llm-factory-1a7esr69.js → curator-llm-factory-p3aqev12.js} +31 -28
  9. package/dist/cli/{dispatch-3mhgqj2x.js → dispatch-gxbeb2ps.js} +2 -2
  10. package/dist/cli/{evidence-summary-service-nhsmsap8.js → evidence-summary-service-mrzsjpg4.js} +13 -12
  11. package/dist/cli/{gate-evidence-cy2te3x8.js → gate-evidence-b5v1xvxp.js} +4 -4
  12. package/dist/cli/guardrail-explain-k8mcvk61.js +57 -0
  13. package/dist/cli/{guardrail-log-fjgyx76r.js → guardrail-log-absma1rv.js} +5 -5
  14. package/dist/cli/{hive-promoter-2b04e0wh.js → hive-promoter-jwd51gzk.js} +31 -28
  15. package/dist/cli/{index-g4mnf3p5.js → index-1j3682j8.js} +5 -5
  16. package/dist/cli/{index-7ftthvqt.js → index-2njes601.js} +8 -8
  17. package/dist/cli/{index-17zjp67y.js → index-2t1n9k7b.js} +4 -4
  18. package/dist/cli/{index-mwqfyjja.js → index-3dtjhr26.js} +48538 -48840
  19. package/dist/cli/{index-2tn5h2zp.js → index-4p02dp92.js} +6 -6
  20. package/dist/cli/index-b4z7s917.js +80 -0
  21. package/dist/cli/{index-wzb4dv5s.js → index-b5ek2cge.js} +4 -4
  22. package/dist/cli/index-b8zgtz81.js +123 -0
  23. package/dist/cli/{index-j5pnah1w.js → index-baawkm48.js} +12 -12
  24. package/dist/cli/{index-sp7tm8t7.js → index-c3e0ymrg.js} +1 -1
  25. package/dist/cli/{index-q27bajqb.js → index-cfkvc5q9.js} +3 -3
  26. package/dist/cli/{index-7mkpsw6g.js → index-dd7ttx8x.js} +1 -1
  27. package/dist/cli/{index-bz08438z.js → index-dgxgvzab.js} +7 -7
  28. package/dist/cli/{index-mhcge2ry.js → index-eedq2y40.js} +33 -30
  29. package/dist/cli/{index-tj2mkfb3.js → index-g87ty4wp.js} +1 -1
  30. package/dist/cli/{index-mmvaf4t6.js → index-hgh01f6h.js} +25 -3
  31. package/dist/cli/{index-0vd91yb8.js → index-j6ywarjp.js} +3 -3
  32. package/dist/cli/{index-cpest8sa.js → index-jpkxjmfw.js} +5 -5
  33. package/dist/cli/{index-r260ybay.js → index-k742ecbm.js} +178 -222
  34. package/dist/cli/{index-hfpw5m0e.js → index-kapharv7.js} +3 -3
  35. package/dist/cli/{index-66zght9d.js → index-m2s0gbzt.js} +2 -2
  36. package/dist/cli/{index-74tptrss.js → index-p8hezdtz.js} +1 -1
  37. package/dist/cli/{index-sw82jvf2.js → index-rkyhv4p5.js} +2 -2
  38. package/dist/cli/{index-3x761jqv.js → index-wk1h5ec2.js} +1 -1
  39. package/dist/cli/{index-kc1m6vpr.js → index-xfejq1p9.js} +2 -2
  40. package/dist/cli/{index-wz36r0fk.js → index-y0kk3rtv.js} +2 -2
  41. package/dist/cli/index-y3v1404y.js +1625 -0
  42. package/dist/cli/index.js +31 -28
  43. package/dist/cli/{knowledge-escalator-hzkw1ban.js → knowledge-escalator-mkdac2m7.js} +8 -8
  44. package/dist/cli/{knowledge-events-pbycdhqd.js → knowledge-events-jjc9qbe0.js} +6 -6
  45. package/dist/cli/{knowledge-link-4yd2z8ev.js → knowledge-link-nc4y2zkq.js} +5 -5
  46. package/dist/cli/{knowledge-store-45jawb2p.js → knowledge-store-9e0w1kxm.js} +6 -6
  47. package/dist/cli/{knowledge-validator-ge576f8n.js → knowledge-validator-h1nrn2pk.js} +9 -9
  48. package/dist/cli/pending-delegations-v9e40hfk.js +96 -0
  49. package/dist/cli/{pr-subscriptions-zqbmctwz.js → pr-subscriptions-ztq40hrt.js} +7 -7
  50. package/dist/cli/{scan-cursor-kvw872be.js → scan-cursor-mk3tq3sf.js} +7 -7
  51. package/dist/cli/{schema-a2zm2m3r.js → schema-bjb0yzsq.js} +2 -2
  52. package/dist/cli/{scope-persistence-5qypzxxm.js → scope-persistence-hz3zmmsv.js} +5 -5
  53. package/dist/cli/{skill-generator-ch79hvxh.js → skill-generator-p1de0wkr.js} +10 -10
  54. package/dist/cli/worktree-collision-ownership-c4bdnjtx.js +221 -0
  55. package/dist/evaluation/contracts.d.ts +1 -1
  56. package/dist/evaluation/public-api.d.ts +1 -1
  57. package/dist/hooks/delegation-gate/worktree-collision-ownership.d.ts +28 -0
  58. package/dist/hooks/delegation-gate/worktree-isolation.d.ts +63 -1
  59. package/dist/hooks/delegation-gate/worktree-merge-status.d.ts +14 -0
  60. package/dist/hooks/delegation-gate/worktree-ownership-tag.d.ts +19 -0
  61. package/dist/hooks/delegation-gate/worktree-provisioning-owner.d.ts +30 -0
  62. package/dist/hooks/delegation-gate.d.ts +14 -5
  63. package/dist/hooks/index.d.ts +1 -1
  64. package/dist/hooks/init-orphan-recovery.d.ts +17 -0
  65. package/dist/index.js +476 -470
  66. package/dist/memory/schema.d.ts +4 -4
  67. package/dist/session/snapshot-writer.d.ts +2 -0
  68. package/dist/state.d.ts +43 -1
  69. package/dist/tools/dispatch-lanes.d.ts +1 -1
  70. package/dist/tools/epic-record-divergence.d.ts +5 -5
  71. package/dist/worktree/merge.d.ts +47 -1
  72. package/package.json +1 -1
  73. package/dist/cli/guardrail-explain-zgja2b9m.js +0 -54
  74. package/dist/cli/pending-delegations-kxy8mdqg.js +0 -75
  75. package/dist/cli/{index-9f71ye47.js → index-13xxjfhn.js} +3 -3
  76. package/dist/cli/{index-s80bsjkj.js → index-2ghkk9ve.js} +6 -6
  77. package/dist/cli/{index-76kvm9z5.js → index-5nybajn9.js} +3 -3
@@ -1,22 +1,32 @@
1
1
  /**
2
- * Background subagent completion observer/ingester.
2
+ * Trusted background-subagent completion observer.
3
3
  *
4
- * Trusted synthetic background completions always settle the durable
5
- * background-delegation ledger. Correctness-critical Stage B completions then
6
- * pass through workspace freshness validation before gate evidence, receipts, or
7
- * task workflow state can advance.
4
+ * Terminal identity, coder settlement, workflow ingestion, and parent
5
+ * notification are separate durable transitions. Replaying the same synthetic
6
+ * event therefore resumes the first incomplete transition without re-running a
7
+ * completed one.
8
8
  */
9
- import type { ReviewerReceiptValidationOptions } from '../hooks/review-receipt-collector.js';
9
+ import { type BackgroundDelegationRecord, recordDelegationIngestionResult } from './pending-delegations.js';
10
10
  interface ObserverConfig {
11
11
  enabled: boolean;
12
12
  }
13
+ export interface PreparedBackgroundAdvisories {
14
+ preparationId: string;
15
+ eventIds: string[];
16
+ messages: string[];
17
+ }
13
18
  export declare function createBackgroundCompletionObserver(opts: {
14
19
  config: ObserverConfig;
15
20
  directory: string;
16
- reviewerReceiptOptions?: ReviewerReceiptValidationOptions;
21
+ onTerminalClaimed?: (record: BackgroundDelegationRecord) => void;
22
+ recordIngestionResult?: typeof recordDelegationIngestionResult;
23
+ reviewerReceiptOptions?: Record<string, unknown>;
17
24
  }): {
18
25
  event: (input: {
19
26
  event: unknown;
20
27
  }) => Promise<void>;
28
+ prepareAdvisories: (parentSessionId: string) => Promise<PreparedBackgroundAdvisories | null>;
29
+ ackObservedAdvisories: (parentSessionId: string, observedTexts: readonly string[]) => Promise<number>;
30
+ releaseAdvisories: (parentSessionId: string, prepared: PreparedBackgroundAdvisories) => Promise<boolean>;
21
31
  };
22
32
  export {};
@@ -23,9 +23,24 @@
23
23
  * `.swarm/` (Invariant 4).
24
24
  */
25
25
  export declare const BACKGROUND_DELEGATIONS_FILE = "background-delegations.jsonl";
26
- export type BackgroundDelegationStatus = 'pending' | 'running' | 'ingestion_error' | 'completed' | 'ingesting' | 'error' | 'cancelled' | 'stale' | 'consumed';
26
+ export declare const BACKGROUND_DELEGATION_FALLBACK_DIR = "background-delegation-fallback";
27
+ export declare const BACKGROUND_CODER_RESERVATIONS_FILE = "background-coder-reservations.json";
28
+ export declare const MAX_LIVE_BACKGROUND_FALLBACKS = 256;
29
+ export declare const MAX_LIVE_BACKGROUND_CODER_RESERVATIONS = 256;
30
+ export declare const MAX_BACKGROUND_OBSERVED_FILES = 5000;
31
+ export declare const MAX_BACKGROUND_ADVISORY_CHARS = 4000;
32
+ export type RecoveryOwnershipScanResult<T> = {
33
+ status: 'ok';
34
+ owners: T[];
35
+ } | {
36
+ status: 'uncertain';
37
+ reason: string;
38
+ };
39
+ /** An abandoned ingestion lease may be reclaimed after this bounded interval. */
40
+ export declare const BACKGROUND_INGESTION_LEASE_MS = 30000;
41
+ export type BackgroundDelegationStatus = 'pending' | 'running' | 'ingesting' | 'ingestion_error' | 'completed' | 'error' | 'cancelled' | 'stale' | 'consumed';
27
42
  export interface BackgroundDelegationRecord {
28
- schemaVersion: 1 | 2;
43
+ schemaVersion: 1 | 2 | 3;
29
44
  /** Subagent session id from the dispatch envelope — the correlation key. */
30
45
  correlationId: string;
31
46
  /** Structured jobId from dispatch metadata when available, else null. */
@@ -66,16 +81,22 @@ export interface BackgroundDelegationRecord {
66
81
  workspace?: BackgroundWorkspaceSnapshot;
67
82
  /** Immutable pre-coder provenance for doc-only gate classification. */
68
83
  taskChangeContext?: BackgroundTaskChangeContext;
84
+ /** Complete isolated-worktree recovery coordinates captured before handoff. */
85
+ worktree?: BackgroundWorktreeDescriptor;
86
+ /** Stable pre-launch background-coder capacity reservation. */
87
+ coderReservationId?: string;
69
88
  prompt?: BackgroundPromptSnapshot;
70
89
  generation?: number;
90
+ /** Immutable trusted terminal event. Established exactly once. */
91
+ terminalResult?: BackgroundTerminalResult;
92
+ /** Durable coder settlement state. Settled outcomes are never recomputed. */
93
+ coderSettlement?: BackgroundCoderSettlement;
94
+ /** Durable parent advisory keyed by terminalResult.eventId. */
95
+ advisoryInbox?: BackgroundAdvisoryInboxEntry;
96
+ /** CAS marker for exactly one active ingestion attempt. */
97
+ ingestion?: BackgroundDelegationIngestion;
71
98
  result?: BackgroundDelegationResult;
72
99
  completedAt?: number;
73
- /** Unique lease token for the process currently applying Stage-B side effects. */
74
- ingestionId?: string;
75
- /** Start time for bounded crash-recovery of an abandoned ingestion lease. */
76
- ingestionStartedAt?: number;
77
- /** Terminal result digest claimed by the ingester. */
78
- ingestionDigest?: string;
79
100
  }
80
101
  export interface BackgroundWorkspaceSnapshot {
81
102
  directory: string;
@@ -89,6 +110,19 @@ export interface BackgroundTaskChangeContext {
89
110
  declaredFiles: string[] | null;
90
111
  baseline: BackgroundWorkspaceSnapshot;
91
112
  }
113
+ export interface BackgroundWorktreeDescriptor {
114
+ callID: string;
115
+ parentSessionId: string;
116
+ taskId: string;
117
+ planTaskId: string | null;
118
+ worktreePath: string;
119
+ branchName: string;
120
+ worktreeId: string;
121
+ worktreeSessionId: string;
122
+ mergeStrategy: 'merge' | 'rebase' | 'cherry-pick';
123
+ laneIndex: number;
124
+ worktreeDir: string | null;
125
+ }
92
126
  export interface BackgroundPromptSnapshot {
93
127
  text: string;
94
128
  chars: number;
@@ -108,6 +142,71 @@ export interface BackgroundDelegationResult {
108
142
  transcriptIncomplete?: boolean;
109
143
  messageCount?: number;
110
144
  }
145
+ export interface BackgroundTerminalResult {
146
+ /** Stable identity derived from trusted correlation + immutable result metadata. */
147
+ eventId: string;
148
+ status: 'completed' | 'error' | 'cancelled';
149
+ recordedAt: number;
150
+ result: BackgroundDelegationResult;
151
+ }
152
+ export type BackgroundCoderSettlementState = 'pending' | 'settling' | 'settled' | 'preserved';
153
+ export interface BackgroundCoderSettlementProvenance {
154
+ correlationId: string;
155
+ parentSessionId: string;
156
+ callID: string;
157
+ planTaskId: string | null;
158
+ baseline: BackgroundWorkspaceSnapshot;
159
+ worktree: BackgroundWorktreeDescriptor | null;
160
+ }
161
+ export interface BackgroundCoderSettlementOutcome {
162
+ kind: 'shared-root' | 'standard-worktree';
163
+ result: 'ready' | 'merged' | 'unchanged' | 'partial' | 'failed';
164
+ reason?: string;
165
+ sourceHeadAfterCommit?: string | null;
166
+ targetHeadBeforeMerge?: string | null;
167
+ targetHeadAfterMerge?: string | null;
168
+ }
169
+ export interface BackgroundCoderSettlement {
170
+ state: BackgroundCoderSettlementState;
171
+ provenance: BackgroundCoderSettlementProvenance;
172
+ operationId?: string;
173
+ sourceHeadAfterCommit?: string | null;
174
+ targetHeadBeforeMerge?: string | null;
175
+ observedFiles: string[] | null;
176
+ outcome?: BackgroundCoderSettlementOutcome;
177
+ updatedAt: number;
178
+ }
179
+ export interface BackgroundAdvisoryPreparation {
180
+ id: string;
181
+ preparedAt: number;
182
+ leaseExpiresAt: number;
183
+ }
184
+ export interface BackgroundAdvisoryInboxEntry {
185
+ eventId: string;
186
+ parentSessionId: string;
187
+ state: 'pending' | 'delivered';
188
+ message: string;
189
+ createdAt: number;
190
+ preparation?: BackgroundAdvisoryPreparation;
191
+ deliveredAt?: number;
192
+ }
193
+ export interface BackgroundDelegationIngestion {
194
+ state: 'claimed' | 'retryable' | 'consumed';
195
+ attempt: number;
196
+ updatedAt: number;
197
+ claimToken: string;
198
+ leaseExpiresAt?: number;
199
+ }
200
+ export interface BackgroundCoderReservation {
201
+ reservationId: string;
202
+ parentSessionId: string;
203
+ planTaskId: string | null;
204
+ callID: string;
205
+ state: 'reserved' | 'bound';
206
+ correlationId: string | null;
207
+ createdAt: number;
208
+ updatedAt: number;
209
+ }
111
210
  /**
112
211
  * Read and fold the store to the latest snapshot per correlationId. Lock-free and
113
212
  * defensive: a missing file yields an empty list, and malformed/partial lines are skipped
@@ -118,6 +217,12 @@ export interface BackgroundDelegationResult {
118
217
  * concurrent background delegations, and the on-disk log is small).
119
218
  */
120
219
  export declare function readDelegations(directory: string): BackgroundDelegationRecord[];
220
+ /**
221
+ * Strict startup-recovery view of the primary ledger. Unlike the ordinary
222
+ * advisory reader, this never treats unreadable, oversized, or malformed owner
223
+ * data as absence: destructive orphan cleanup must fail closed on uncertainty.
224
+ */
225
+ export declare function scanDelegationsForRecovery(directory: string): RecoveryOwnershipScanResult<BackgroundDelegationRecord>;
121
226
  /** Returns the folded record for a correlationId, or null. Lock-free read. */
122
227
  export declare function findByCorrelationId(directory: string, correlationId: string): BackgroundDelegationRecord | null;
123
228
  export interface RecordPendingInput {
@@ -138,6 +243,8 @@ export interface RecordPendingInput {
138
243
  promptHash?: string;
139
244
  workspace?: BackgroundWorkspaceSnapshot;
140
245
  taskChangeContext?: BackgroundTaskChangeContext;
246
+ worktree?: BackgroundWorktreeDescriptor;
247
+ coderReservationId?: string;
141
248
  prompt?: BackgroundPromptSnapshot;
142
249
  generation?: number;
143
250
  }
@@ -157,38 +264,101 @@ export declare function appendDelegationTransition(directory: string, correlatio
157
264
  result?: BackgroundDelegationResult;
158
265
  completedAt?: number;
159
266
  }): Promise<BackgroundDelegationRecord | null>;
160
- /** An abandoned ingestion lease may be reclaimed after this bounded interval. */
161
- export declare const BACKGROUND_INGESTION_LEASE_MS = 30000;
162
- export type BackgroundIngestionClaim = {
163
- outcome: 'claimed';
267
+ export interface BuildBackgroundCompletionEventIdInput {
268
+ correlationId: string;
269
+ jobId: string | null;
270
+ status: BackgroundTerminalResult['status'];
271
+ resultDigest: string;
272
+ }
273
+ /** Build the stable inbox/terminal identity without timestamps or process state. */
274
+ export declare function buildBackgroundCompletionEventId(input: BuildBackgroundCompletionEventIdInput): string;
275
+ export type TerminalClaimDisposition = 'claimed' | 'resume_settlement' | 'retry_ingestion' | 'preserved' | 'consumed' | 'duplicate';
276
+ export interface TerminalClaim {
277
+ disposition: TerminalClaimDisposition;
164
278
  record: BackgroundDelegationRecord;
165
- ingestionId: string;
166
- } | {
167
- outcome: 'busy' | 'settled' | 'rejected' | 'missing';
168
- record: BackgroundDelegationRecord | null;
169
- };
279
+ }
170
280
  /**
171
- * Acquire the single durable right to apply Stage-B side effects.
281
+ * Establish an immutable trusted terminal event exactly once.
172
282
  *
173
- * The completed/ingestion_error -> ingesting transition is a compare-and-set
174
- * performed under the pending-delegation store lock. A stale ingesting lease
175
- * may be reclaimed after a crash; live duplicates observe `busy` and do no
176
- * work. Result digest equality keeps replay bound to the immutable completion.
283
+ * A different event for an already-claimed correlation is rejected. Replays of the
284
+ * same event receive an explicit resume/retry disposition from durable state.
177
285
  */
178
- export declare function claimDelegationIngestion(directory: string, correlationId: string, resultDigest: string, options?: {
286
+ export declare function claimTerminalResult(directory: string, correlationId: string, terminalResult: BackgroundTerminalResult): Promise<TerminalClaim | null>;
287
+ export interface ClaimCoderSettlementInput {
288
+ sourceHeadAfterCommit?: string | null;
289
+ targetHeadBeforeMerge?: string | null;
290
+ }
291
+ export interface CoderSettlementClaim {
292
+ disposition: 'claimed' | 'resume' | 'settled' | 'preserved';
293
+ record: BackgroundDelegationRecord;
294
+ }
295
+ /**
296
+ * Claim coder settlement under the ledger lock. A `settling` operation may resume only
297
+ * with its original operationId; completed or preserved outcomes are returned unchanged.
298
+ */
299
+ export declare function claimCoderSettlement(directory: string, correlationId: string, operationId: string, input?: ClaimCoderSettlementInput): Promise<CoderSettlementClaim | null>;
300
+ export declare function normalizeBackgroundObservedFiles(files: readonly string[]): string[] | null;
301
+ export interface UpdateCoderSettlementInput {
302
+ operationId: string;
303
+ state: 'settling' | 'settled' | 'preserved';
304
+ sourceHeadAfterCommit?: string | null;
305
+ targetHeadBeforeMerge?: string | null;
306
+ observedFiles?: string[] | null;
307
+ outcome?: BackgroundCoderSettlementOutcome;
308
+ }
309
+ /**
310
+ * Persist settlement progress or its terminal outcome. Once settled/preserved, every
311
+ * replay returns the original snapshot and ignores recomputation attempts.
312
+ */
313
+ export declare function updateCoderSettlement(directory: string, correlationId: string, input: UpdateCoderSettlementInput): Promise<BackgroundDelegationRecord | null>;
314
+ export type DelegationIngestionDisposition = 'claimed' | 'retry' | 'busy' | 'not_ready' | 'preserved' | 'consumed';
315
+ export interface DelegationIngestionClaim {
316
+ disposition: DelegationIngestionDisposition;
317
+ record: BackgroundDelegationRecord;
318
+ }
319
+ export interface ClaimDelegationIngestionOptions {
320
+ claimantId: string;
179
321
  now?: number;
180
322
  leaseMs?: number;
181
- }): Promise<BackgroundIngestionClaim>;
323
+ }
182
324
  /**
183
- * Settle only the ingestion lease held by `ingestionId`.
325
+ * Lease-backed CAS claim for ingestion.
184
326
  *
185
- * A consumed record is forward-only and returned idempotently; no late error
186
- * path can regress it to ingestion_error.
327
+ * An interrupted claimant cannot strand the record permanently: after the
328
+ * bounded lease expires, a replay may reclaim and retry the immutable settled
329
+ * input. A still-live claim remains busy and must never be reported as success.
187
330
  */
188
- export declare function settleDelegationIngestion(directory: string, correlationId: string, ingestionId: string, transition: {
189
- status: 'consumed' | 'ingestion_error';
190
- result?: BackgroundDelegationResult;
331
+ export declare function claimDelegationIngestion(directory: string, correlationId: string, options: ClaimDelegationIngestionOptions): Promise<DelegationIngestionClaim | null>;
332
+ /** Commit an ingestion claim to consumed or retryable ingestion_error. */
333
+ export declare function recordDelegationIngestionResult(directory: string, correlationId: string, claimToken: string, success: boolean, options?: {
334
+ now?: number;
191
335
  }): Promise<BackgroundDelegationRecord | null>;
336
+ export interface PutPendingBackgroundAdvisoryInput {
337
+ eventId: string;
338
+ parentSessionId: string;
339
+ message: string;
340
+ createdAt?: number;
341
+ }
342
+ /** Establish one immutable durable advisory for the terminal event. */
343
+ export declare function putPendingBackgroundAdvisory(directory: string, correlationId: string, input: PutPendingBackgroundAdvisoryInput): Promise<BackgroundAdvisoryInboxEntry | null>;
344
+ export interface PreparePendingBackgroundAdvisoriesOptions {
345
+ preparationId: string;
346
+ now?: number;
347
+ leaseMs?: number;
348
+ }
349
+ /**
350
+ * Lease pending entries for one synchronous message transform. Expired leases are
351
+ * reclaimable after restart; delivery is committed only when a later host
352
+ * transform reflects the injected text back as conversation history.
353
+ */
354
+ export declare function preparePendingBackgroundAdvisories(directory: string, parentSessionId: string, options: PreparePendingBackgroundAdvisoriesOptions): Promise<BackgroundAdvisoryInboxEntry[]>;
355
+ /**
356
+ * Commit delivery only after a later host transform reflects the exact advisory
357
+ * text back in conversation history. This is the first boundary at which the
358
+ * plugin can prove that a prior transform result escaped the process.
359
+ */
360
+ export declare function acknowledgeObservedBackgroundAdvisories(directory: string, parentSessionId: string, observedTexts: readonly string[]): Promise<number>;
361
+ export declare function releasePreparedBackgroundAdvisories(directory: string, parentSessionId: string, preparationId: string, eventIds: readonly string[]): Promise<boolean>;
192
362
  export declare function findByBatchId(directory: string, batchId: string, opts?: {
193
363
  parentSessionId?: string;
194
364
  }): BackgroundDelegationRecord[];
@@ -198,3 +368,108 @@ export declare function findOpenAsyncLaneBatches(directory: string): BackgroundD
198
368
  * Best-effort; returns the number swept (0 on lock timeout / error).
199
369
  */
200
370
  export declare function sweepStaleDelegations(directory: string, timeoutMs: number): Promise<number>;
371
+ export interface BackgroundDelegationFallbackArtifact {
372
+ schemaVersion: 1;
373
+ correlationId: string;
374
+ createdAt: number;
375
+ record: BackgroundDelegationRecord;
376
+ }
377
+ /** Read one exact fallback artifact with bounded post-rename visibility retries. */
378
+ export declare function readDelegationFallback(directory: string, correlationId: string): Promise<BackgroundDelegationFallbackArtifact | null>;
379
+ /**
380
+ * Enumerate valid live fallback owners for startup orphan recovery. Malformed files are
381
+ * ignored as data but still count toward the fail-closed capacity bound.
382
+ */
383
+ export declare function listDelegationFallbacks(directory: string): Promise<BackgroundDelegationFallbackArtifact[]>;
384
+ /**
385
+ * Strict startup-recovery view of fallback owners. Every candidate must be
386
+ * readable and schema-valid, and overflow is uncertainty rather than
387
+ * truncation, because omitted ownership could make cleanup destructive.
388
+ */
389
+ export declare function scanDelegationFallbacksForRecovery(directory: string): Promise<RecoveryOwnershipScanResult<BackgroundDelegationFallbackArtifact>>;
390
+ export interface WriteDelegationFallbackOptions {
391
+ /** Testable lower cap; callers cannot raise the production maximum. */
392
+ maxLive?: number;
393
+ }
394
+ /**
395
+ * Atomically persist a launched-but-unledgered delegation in an independent,
396
+ * per-correlation artifact. Capacity failure never removes another live artifact.
397
+ */
398
+ export declare function writeDelegationFallback(directory: string, input: RecordPendingInput, options?: WriteDelegationFallbackOptions): Promise<BackgroundDelegationFallbackArtifact | null>;
399
+ /** Idempotently remove one exact fallback after durable primary promotion. */
400
+ export declare function removeDelegationFallback(directory: string, correlationId: string): Promise<boolean>;
401
+ export interface CompletionDelegationLookup {
402
+ source: 'primary' | 'fallback';
403
+ record: BackgroundDelegationRecord;
404
+ fallback?: BackgroundDelegationFallbackArtifact;
405
+ }
406
+ /** Lookup used by terminal handling: primary ledger first, exact fallback second. */
407
+ export declare function findDelegationForCompletion(directory: string, correlationId: string): Promise<CompletionDelegationLookup | null>;
408
+ /**
409
+ * Promote one exact fallback into the append-only primary ledger, then remove it.
410
+ * A conflicting primary identity fails closed and leaves the fallback untouched.
411
+ */
412
+ export declare function promoteDelegationFallback(directory: string, correlationId: string): Promise<CompletionDelegationLookup | null>;
413
+ export declare function buildBackgroundCoderReservationId(input: {
414
+ parentSessionId: string;
415
+ planTaskId: string | null;
416
+ callID: string;
417
+ }): string;
418
+ export type BackgroundCoderReservationScanResult = {
419
+ status: 'ok';
420
+ reservations: BackgroundCoderReservation[];
421
+ } | {
422
+ status: 'uncertain';
423
+ reason: string;
424
+ };
425
+ /**
426
+ * Strict reservation read for admission. Corruption is uncertainty, never absence.
427
+ */
428
+ export declare function scanBackgroundCoderReservationsForAdmission(directory: string): BackgroundCoderReservationScanResult;
429
+ export interface ReserveBackgroundCoderSlotInput {
430
+ parentSessionId: string;
431
+ planTaskId: string | null;
432
+ callID: string;
433
+ maxConcurrent: number;
434
+ occupiedTaskIds?: readonly string[];
435
+ now?: number;
436
+ }
437
+ export type ReserveBackgroundCoderSlotResult = {
438
+ ok: true;
439
+ reservation: BackgroundCoderReservation;
440
+ activeCount: number;
441
+ } | {
442
+ ok: false;
443
+ reason: 'invalid' | 'duplicate_task' | 'duplicate_call' | 'capacity' | 'uncertain';
444
+ activeCount?: number;
445
+ detail?: string;
446
+ existing?: BackgroundCoderReservation;
447
+ };
448
+ /**
449
+ * Atomically reserve one parent-scoped background coder slot before launch.
450
+ * This has no workflow-state side effect.
451
+ */
452
+ export declare function reserveBackgroundCoderSlot(directory: string, input: ReserveBackgroundCoderSlotInput): Promise<ReserveBackgroundCoderSlotResult>;
453
+ export interface BindBackgroundCoderReservationInput {
454
+ reservationId: string;
455
+ parentSessionId: string;
456
+ planTaskId: string | null;
457
+ callID: string;
458
+ correlationId: string;
459
+ now?: number;
460
+ }
461
+ /** Bind the pre-launch owner to the exact trusted completion correlation. */
462
+ export declare function bindBackgroundCoderReservation(directory: string, input: BindBackgroundCoderReservationInput): Promise<BackgroundCoderReservation | null>;
463
+ export interface ReleaseBackgroundCoderReservationInput {
464
+ reservationId: string;
465
+ parentSessionId: string;
466
+ planTaskId: string | null;
467
+ callID: string;
468
+ correlationId: string | null;
469
+ reason: 'consumed' | 'recovered';
470
+ }
471
+ /**
472
+ * Release only an exact owner. `consumed` is independently proven from the strict
473
+ * primary ledger; `recovered` is reserved for a caller that completed recovery.
474
+ */
475
+ export declare function releaseBackgroundCoderReservation(directory: string, input: ReleaseBackgroundCoderReservationInput): Promise<boolean>;
@@ -12,13 +12,13 @@ import {
12
12
  shouldRunOnStartup,
13
13
  writeBackupArtifact,
14
14
  writeDoctorArtifact
15
- } from "./index-tj2mkfb3.js";
16
- import"./index-wzb4dv5s.js";
15
+ } from "./index-g87ty4wp.js";
16
+ import"./index-b5ek2cge.js";
17
17
  import"./index-bk5tah7q.js";
18
+ import"./index-bpmtbmy9.js";
18
19
  import"./index-z6xqpmqg.js";
19
20
  import"./index-zjygnfay.js";
20
21
  import"./index-zgwm4ryv.js";
21
- import"./index-bpmtbmy9.js";
22
22
  import"./index-a76rekgs.js";
23
23
  export {
24
24
  writeDoctorArtifact,
@@ -14,12 +14,12 @@ import {
14
14
  resolveWorktreeBaseDir,
15
15
  shortenWorktreePath,
16
16
  writeLaneProfileToDiskReal
17
- } from "./index-17zjp67y.js";
18
- import"./index-z6xqpmqg.js";
17
+ } from "./index-2t1n9k7b.js";
19
18
  import"./index-4rhhvd1a.js";
19
+ import"./index-z6xqpmqg.js";
20
20
  import"./index-zjygnfay.js";
21
- import"./index-zgwm4ryv.js";
22
21
  import"./index-qe3v54nb.js";
22
+ import"./index-zgwm4ryv.js";
23
23
  import"./index-a76rekgs.js";
24
24
  export {
25
25
  writeLaneProfileToDiskReal,
@@ -4,18 +4,18 @@ import {
4
4
  authorizeCuration,
5
5
  buildConfigFingerprintInput,
6
6
  readCohortConfigFingerprint
7
- } from "./index-wz36r0fk.js";
7
+ } from "./index-y0kk3rtv.js";
8
8
  import"./index-rtry5xyf.js";
9
- import"./index-bz08438z.js";
9
+ import"./index-dgxgvzab.js";
10
10
  import"./index-ae75rja9.js";
11
- import"./index-q27bajqb.js";
12
- import"./index-zgwm4ryv.js";
13
- import"./index-7mkpsw6g.js";
11
+ import"./index-cfkvc5q9.js";
12
+ import"./index-dd7ttx8x.js";
14
13
  import"./index-fsrp8wp3.js";
15
- import"./index-76kvm9z5.js";
16
- import"./index-q2rrv0cy.js";
14
+ import"./index-5nybajn9.js";
17
15
  import"./index-7g4c7s5r.js";
16
+ import"./index-q2rrv0cy.js";
18
17
  import"./index-qe3v54nb.js";
18
+ import"./index-zgwm4ryv.js";
19
19
  import"./index-a76rekgs.js";
20
20
  export {
21
21
  readCohortConfigFingerprint,
@@ -5,21 +5,21 @@ import {
5
5
  import {
6
6
  readEffectiveSpecSync
7
7
  } from "./index-9ss2m4rs.js";
8
+ import"./index-n832052r.js";
9
+ import"./index-4rhhvd1a.js";
8
10
  import {
9
11
  readSwarmFileAsync,
10
12
  validateSwarmPath
11
- } from "./index-s80bsjkj.js";
12
- import"./index-n832052r.js";
13
+ } from "./index-2ghkk9ve.js";
14
+ import"./index-fsrp8wp3.js";
15
+ import"./index-bpmtbmy9.js";
13
16
  import"./index-z6xqpmqg.js";
14
- import"./index-4rhhvd1a.js";
15
17
  import"./index-zjygnfay.js";
18
+ import"./index-qe3v54nb.js";
16
19
  import {
17
20
  init_logger,
18
21
  warn
19
22
  } from "./index-zgwm4ryv.js";
20
- import"./index-fsrp8wp3.js";
21
- import"./index-bpmtbmy9.js";
22
- import"./index-qe3v54nb.js";
23
23
  import"./index-a76rekgs.js";
24
24
 
25
25
  // src/hooks/curator-drift.ts
@@ -14,52 +14,55 @@ import {
14
14
  runCuratorInit,
15
15
  runCuratorPhase,
16
16
  writeCuratorSummary
17
- } from "./index-mwqfyjja.js";
18
- import"./index-mmvaf4t6.js";
19
- import"./index-tj2mkfb3.js";
20
- import"./index-r260ybay.js";
17
+ } from "./index-3dtjhr26.js";
18
+ import"./index-13xxjfhn.js";
19
+ import"./index-hgh01f6h.js";
20
+ import"./index-g87ty4wp.js";
21
+ import"./index-k742ecbm.js";
21
22
  import"./index-4905hd2m.js";
22
23
  import"./index-134d35c1.js";
23
- import"./index-9f71ye47.js";
24
- import"./index-0vd91yb8.js";
25
- import"./index-cpest8sa.js";
26
- import"./index-66zght9d.js";
24
+ import"./index-j6ywarjp.js";
25
+ import"./index-jpkxjmfw.js";
26
+ import"./index-m2s0gbzt.js";
27
27
  import"./index-vxv732ex.js";
28
28
  import"./index-c8s9a3zh.js";
29
29
  import"./index-9ss2m4rs.js";
30
- import"./index-g4mnf3p5.js";
31
- import"./index-s80bsjkj.js";
32
- import"./index-7ftthvqt.js";
33
- import"./index-wz36r0fk.js";
30
+ import"./index-wk1h5ec2.js";
31
+ import"./index-1j3682j8.js";
32
+ import"./index-2njes601.js";
33
+ import"./index-y0kk3rtv.js";
34
34
  import"./index-rtry5xyf.js";
35
- import"./index-j5pnah1w.js";
36
- import"./index-bz08438z.js";
35
+ import"./index-baawkm48.js";
36
+ import"./index-dgxgvzab.js";
37
37
  import"./index-ae75rja9.js";
38
- import"./index-q27bajqb.js";
39
- import"./index-kc1m6vpr.js";
38
+ import"./index-cfkvc5q9.js";
39
+ import"./index-dd7ttx8x.js";
40
+ import"./index-xfejq1p9.js";
40
41
  import"./index-k5jrywpr.js";
41
42
  import"./index-n832052r.js";
42
- import"./index-wzb4dv5s.js";
43
+ import"./index-b5ek2cge.js";
43
44
  import"./index-bk5tah7q.js";
44
45
  import"./index-8fwhhayc.js";
45
46
  import"./index-q1exe2b3.js";
46
- import"./index-74tptrss.js";
47
- import"./index-2tn5h2zp.js";
47
+ import"./index-p8hezdtz.js";
48
+ import"./index-4p02dp92.js";
48
49
  import"./index-1kz6da87.js";
49
- import"./index-17zjp67y.js";
50
- import"./index-z6xqpmqg.js";
50
+ import"./index-b4z7s917.js";
51
+ import"./index-b8zgtz81.js";
52
+ import"./index-2t1n9k7b.js";
51
53
  import"./index-4rhhvd1a.js";
52
- import"./index-zjygnfay.js";
53
- import"./index-zgwm4ryv.js";
54
- import"./index-h3k62043.js";
55
- import"./index-3x761jqv.js";
56
- import"./index-7mkpsw6g.js";
54
+ import"./index-y3v1404y.js";
55
+ import"./index-2ghkk9ve.js";
57
56
  import"./index-fsrp8wp3.js";
58
- import"./index-76kvm9z5.js";
57
+ import"./index-5nybajn9.js";
58
+ import"./index-7g4c7s5r.js";
59
59
  import"./index-q2rrv0cy.js";
60
60
  import"./index-bpmtbmy9.js";
61
- import"./index-7g4c7s5r.js";
61
+ import"./index-z6xqpmqg.js";
62
+ import"./index-zjygnfay.js";
62
63
  import"./index-qe3v54nb.js";
64
+ import"./index-zgwm4ryv.js";
65
+ import"./index-h3k62043.js";
63
66
  import"./index-a76rekgs.js";
64
67
  export {
65
68
  writeCuratorSummary,