opencode-swarm 7.152.1 → 7.153.1

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 (121) hide show
  1. package/.opencode/skills/swarm-pr-review/SKILL.md +10 -10
  2. package/dist/background/pending-delegations.d.ts +7 -0
  3. package/dist/cli/{capability-probe-va4kk8vg.js → capability-probe-5wa7mcp6.js} +3 -2
  4. package/dist/cli/{config-doctor-bbqmye7a.js → config-doctor-ze21qs6b.js} +3 -3
  5. package/dist/cli/{core-fh4e6ex0.js → core-qdmhh1kx.js} +2 -2
  6. package/dist/cli/{curation-policy-nem98yc9.js → curation-policy-twa6agf8.js} +7 -7
  7. package/dist/cli/{curator-909s9dvs.js → curator-hxb3wsxr.js} +32 -33
  8. package/dist/cli/curator-llm-factory-s8atmc2n.js +64 -0
  9. package/dist/cli/{evidence-summary-service-kqw4y0yr.js → evidence-summary-service-wzzym9r7.js} +15 -15
  10. package/dist/cli/{gate-evidence-ycts62pj.js → gate-evidence-f71dn9vv.js} +8 -8
  11. package/dist/cli/guardrail-explain-5kzeem4m.js +65 -0
  12. package/dist/cli/{guardrail-log-e1tmdxxa.js → guardrail-log-38jnajpa.js} +6 -6
  13. package/dist/cli/{guardrail-reset-gdnaxxvb.js → guardrail-reset-wzvtmpn2.js} +32 -33
  14. package/dist/cli/{hive-promoter-d0xydg6r.js → hive-promoter-55qcqgfx.js} +32 -33
  15. package/dist/cli/{index-x6803sxh.js → index-0tyc8kdg.js} +2 -2
  16. package/dist/cli/{index-z8s2asdk.js → index-0tzv5zg2.js} +22 -150
  17. package/dist/cli/{index-3djxegsc.js → index-1akn19mp.js} +1 -1
  18. package/dist/cli/{index-q77e475x.js → index-1dtshrzg.js} +5 -5
  19. package/dist/cli/{index-73pmnsjg.js → index-1gzdnjg9.js} +2 -2
  20. package/dist/cli/{index-4tvvh7pn.js → index-23rneydq.js} +36 -35
  21. package/dist/cli/{index-z4bg1hv8.js → index-2mqmvxac.js} +9 -2
  22. package/dist/cli/index-3cegckkq.js +239 -0
  23. package/dist/cli/{index-pvrap7xg.js → index-3ttktt56.js} +1 -1
  24. package/dist/cli/{index-85gkedsf.js → index-4fwbbad3.js} +521 -15
  25. package/dist/cli/{index-qqrdmaxq.js → index-4g0g3dqz.js} +2 -2
  26. package/dist/cli/{index-44xdtqz8.js → index-4pjkdcgc.js} +1 -1
  27. package/dist/cli/{index-29vd7v3e.js → index-6vgb5fyb.js} +1 -1
  28. package/dist/cli/{index-sg2sx2q7.js → index-6ybjrqf7.js} +13095 -9360
  29. package/dist/cli/{index-txbd25bc.js → index-891g7hbf.js} +1 -1
  30. package/dist/cli/{index-02ajc6d1.js → index-8v9sj4aq.js} +2 -2
  31. package/dist/cli/{index-z9fyd0d6.js → index-9v8d3c0k.js} +450 -48
  32. package/dist/cli/{index-26vyr198.js → index-af0cqe6n.js} +16 -16
  33. package/dist/cli/{index-ryecg2st.js → index-ajkxx2k6.js} +3 -3
  34. package/dist/cli/{index-k3d919yf.js → index-gn26q90p.js} +85 -24
  35. package/dist/cli/{index-0tfgn5x0.js → index-k10qtq71.js} +9 -9
  36. package/dist/cli/{index-xyfdmrv7.js → index-mb7b1gye.js} +3 -3
  37. package/dist/cli/{index-0q2mjxp2.js → index-meg33yyv.js} +1 -1
  38. package/dist/cli/{index-cpg98bh1.js → index-myt57pht.js} +1 -1
  39. package/dist/cli/{index-2e1294d1.js → index-n5pxkera.js} +16 -10
  40. package/dist/cli/{index-n0vc5b5t.js → index-n823qsae.js} +16 -7
  41. package/dist/cli/{index-6zkm4p7p.js → index-pk1gbqmq.js} +1 -1
  42. package/dist/cli/{index-nd8tkb3g.js → index-smqsp8hs.js} +5 -5
  43. package/dist/cli/{index-7fh82sm1.js → index-td0jz8xe.js} +6 -6
  44. package/dist/cli/{index-dn6yt0xg.js → index-tdzbm974.js} +7 -7
  45. package/dist/cli/{index-rq6aetkv.js → index-v689bmr2.js} +4 -4
  46. package/dist/cli/{index-79g6edht.js → index-x3y6zhgj.js} +1 -1
  47. package/dist/cli/{index-aw492hpn.js → index-x8vw6ap1.js} +58 -41
  48. package/dist/cli/{index-96m8ckpq.js → index-xkjrg9k4.js} +4 -4
  49. package/dist/cli/{index-mken64yj.js → index-zppxpc3y.js} +2 -2
  50. package/dist/cli/index.js +32 -33
  51. package/dist/cli/{knowledge-escalator-4egcr928.js → knowledge-escalator-w05ztgvk.js} +13 -13
  52. package/dist/cli/{knowledge-events-kdyv4jzn.js → knowledge-events-pwm9jc0m.js} +11 -11
  53. package/dist/cli/{knowledge-link-h8cwj7af.js → knowledge-link-ge0rddxw.js} +6 -6
  54. package/dist/cli/{knowledge-store-dq3cvg53.js → knowledge-store-4xv65tj2.js} +7 -7
  55. package/dist/cli/{knowledge-validator-4bhtden9.js → knowledge-validator-0ttfsca7.js} +9 -9
  56. package/dist/cli/{model-preflight-7ea00h34.js → model-preflight-b95w8wxy.js} +1 -1
  57. package/dist/cli/{pending-delegations-a2nmssr1.js → pending-delegations-nk78wx7h.js} +4 -4
  58. package/dist/cli/{pr-subscriptions-7879nq5k.js → pr-subscriptions-dq1f61ye.js} +4 -4
  59. package/dist/cli/{runner-w81n9js3.js → runner-n50w1y4w.js} +7 -7
  60. package/dist/cli/{scan-cursor-2eezv81a.js → scan-cursor-b6n15w8d.js} +8 -8
  61. package/dist/cli/{schema-v4qcqhek.js → schema-jkbfwqr2.js} +2 -2
  62. package/dist/cli/{scope-persistence-y2r227r0.js → scope-persistence-5xt2m5ep.js} +10 -10
  63. package/dist/cli/{skill-generator-hhzxvb3h.js → skill-generator-3keadpf7.js} +15 -15
  64. package/dist/cli/{telemetry-52pw5xac.js → telemetry-hh1j99za.js} +1 -1
  65. package/dist/cli/{worktree-collision-ownership-p31zm5k0.js → worktree-collision-ownership-4drcjymy.js} +15 -10
  66. package/dist/cli/{worktree-isolation-ve338ez6.js → worktree-isolation-1ymaxn4h.js} +32 -33
  67. package/dist/commands/approve-write.d.ts +1 -0
  68. package/dist/commands/index.d.ts +1 -0
  69. package/dist/commands/lanes.d.ts +25 -0
  70. package/dist/commands/registry.d.ts +7 -0
  71. package/dist/config/schema.d.ts +39 -4
  72. package/dist/consensus/contracts.d.ts +14 -0
  73. package/dist/consensus/corpus.d.ts +16 -0
  74. package/dist/hooks/delegation-gate/worktree-isolation.d.ts +50 -3
  75. package/dist/hooks/delegation-gate/worktree-provisioning-owner.d.ts +40 -2
  76. package/dist/hooks/delegation-gate/worktree-recovery-authority.d.ts +201 -0
  77. package/dist/hooks/full-auto-permission.d.ts +7 -0
  78. package/dist/hooks/guardrails/index.d.ts +2 -1
  79. package/dist/hooks/guardrails/tool-before.d.ts +4 -0
  80. package/dist/hooks/init-orphan-recovery.d.ts +5 -1
  81. package/dist/hooks/pr-workflow-gate.d.ts +12 -0
  82. package/dist/hooks/scope-guard.d.ts +1 -3
  83. package/dist/hooks/trajectory-logger.d.ts +22 -6
  84. package/dist/hooks/trajectory-step-state.d.ts +43 -2
  85. package/dist/index.js +645 -622
  86. package/dist/learning/provenance.d.ts +9 -0
  87. package/dist/observability/catalog.d.ts +6 -4
  88. package/dist/prm/index.d.ts +3 -3
  89. package/dist/prm/replay.d.ts +29 -2
  90. package/dist/prm/trajectory-store.d.ts +210 -20
  91. package/dist/sandbox/capability-probe.d.ts +40 -1
  92. package/dist/sandbox/executor.d.ts +26 -1
  93. package/dist/sandbox/linux/bubblewrap-executor.d.ts +3 -1
  94. package/dist/sandbox/macos/sandbox-exec-executor.d.ts +3 -1
  95. package/dist/sandbox/skip-state.d.ts +24 -0
  96. package/dist/sandbox/win32/native-sandbox-executor.d.ts +5 -1
  97. package/dist/security/command-classifier.d.ts +22 -0
  98. package/dist/security/protected-input-integrity.d.ts +19 -0
  99. package/dist/security/protected-path-policy.d.ts +9 -0
  100. package/dist/security/write-authority.d.ts +46 -0
  101. package/dist/services/diagnose-service.d.ts +1 -1
  102. package/dist/services/skill-generator.d.ts +2 -0
  103. package/dist/services/skill-improver.d.ts +69 -0
  104. package/dist/telemetry.d.ts +21 -1
  105. package/dist/tools/dispatch-lanes.d.ts +47 -0
  106. package/dist/tools/repo-graph/query.d.ts +2 -1
  107. package/dist/tools/repo-graph/types.d.ts +64 -0
  108. package/dist/tools/repo-graph.d.ts +1 -1
  109. package/dist/tools/skill-improve.d.ts +7 -0
  110. package/dist/utils/atomic-write.d.ts +2 -0
  111. package/dist/utils/canonical-root.d.ts +31 -0
  112. package/dist/workflow/coder-settlement.d.ts +2 -0
  113. package/dist/worktree/index.d.ts +2 -2
  114. package/dist/worktree/merge.d.ts +47 -0
  115. package/package.json +2 -1
  116. package/dist/cli/curator-llm-factory-462rysph.js +0 -65
  117. package/dist/cli/guardrail-explain-7620hasq.js +0 -66
  118. package/dist/cli/index-3g0xk6tk.js +0 -219
  119. package/dist/cli/index-fxvgaeq4.js +0 -125
  120. package/dist/cli/worktree-provisioning-owner-cve95q4f.js +0 -22
  121. package/dist/cli/{curator-drift-2h1d2fnq.js → curator-drift-h57z6tm3.js} +1 -1
@@ -0,0 +1,9 @@
1
+ export interface ProtectedPathPolicyOptions {
2
+ includeDefaults?: boolean;
3
+ additional?: readonly string[];
4
+ }
5
+ export declare const DEFAULT_PROTECTED_PATH_PREFIXES: readonly [".github/workflows", ".github/CODEOWNERS", "src/sandbox", "src/hooks/guardrails", "src/security", "src/evaluation", "docs/releases", "tests/fixtures/evaluation"];
6
+ export declare function normalizeProtectedPath(value: string): string;
7
+ /** Central lexical policy; canonical containment remains caller-owned. */
8
+ export declare function isPolicyProtectedPath(filePath: string, options?: ProtectedPathPolicyOptions): boolean;
9
+ export declare function protectedRoots(projectRoot: string, additional?: readonly string[]): string[];
@@ -0,0 +1,46 @@
1
+ export type WriteAuthorityOrigin = 'autonomous' | 'optimizer_proposed' | 'critic_approved' | 'human_approved';
2
+ export type WriteApprovalAction = 'skill_improve';
3
+ export interface WriteApprovalRequest {
4
+ targetSessionId: string;
5
+ action: WriteApprovalAction;
6
+ candidateId: string;
7
+ candidateContentHash: string;
8
+ allowedPathDigest?: string;
9
+ generation?: number;
10
+ }
11
+ export interface WriteApprovalFactV1 extends WriteApprovalRequest {
12
+ v: 1;
13
+ id: string;
14
+ issuingSessionId: string;
15
+ issuedByCommand: 'approve-write';
16
+ issuedAt: string;
17
+ expiresAt: string;
18
+ }
19
+ export interface WriteAuthorityContext {
20
+ origin: WriteAuthorityOrigin;
21
+ fact?: WriteApprovalFactV1;
22
+ }
23
+ export declare function computeWriteApprovalHash(input: Record<string, unknown>): string;
24
+ export declare function getCurrentWriteAuthority(): WriteAuthorityContext;
25
+ export declare function withWriteAuthority<T>(context: WriteAuthorityContext, fn: () => Promise<T>): Promise<T>;
26
+ export declare function buildHumanApprovedWriteAuthority(fact: WriteApprovalFactV1): WriteAuthorityContext;
27
+ export declare function currentWriteAuthoritySatisfies(request: WriteApprovalRequest): boolean;
28
+ export declare function formatApproveWriteCommand(request: WriteApprovalRequest): string;
29
+ export declare function findWriteApprovalFact(args: {
30
+ directory: string;
31
+ request: WriteApprovalRequest;
32
+ now?: Date;
33
+ }): Promise<WriteApprovalFactV1 | null>;
34
+ export declare function issueWriteApprovalFact(args: {
35
+ directory: string;
36
+ request: WriteApprovalRequest;
37
+ issuingSessionId: string;
38
+ now?: Date;
39
+ ttlMs?: number;
40
+ }): Promise<WriteApprovalFactV1>;
41
+ export declare function consumeWriteApprovalFact(args: {
42
+ directory: string;
43
+ request: WriteApprovalRequest;
44
+ consumerSessionId: string;
45
+ now?: Date;
46
+ }): Promise<WriteApprovalFactV1 | null>;
@@ -1,6 +1,6 @@
1
1
  import { getExecutor } from '../sandbox/executor.js';
2
2
  export declare const _internals: {
3
- detectSandboxCapability: () => Promise<import("../sandbox/capability-probe.js").SandboxCapability>;
3
+ detectSandboxCapability: () => Promise<import("../sandbox/capability-probe.js").SandboxCapabilityV1>;
4
4
  getSandboxExecutor: typeof getExecutor;
5
5
  };
6
6
  /**
@@ -100,6 +100,7 @@ export interface GenerateRequest {
100
100
  evaluate?: boolean;
101
101
  minConfidence?: number;
102
102
  minConfirmations?: number;
103
+ preview?: boolean;
103
104
  }
104
105
  export interface GenerateResult {
105
106
  written: Array<{
@@ -110,6 +111,7 @@ export interface GenerateResult {
110
111
  missingSourceKnowledgeIds?: string[];
111
112
  preserved: boolean;
112
113
  evaluation?: SkillEvaluationResult;
114
+ content?: string;
113
115
  }>;
114
116
  skipped: Array<{
115
117
  slug: string;
@@ -19,6 +19,7 @@
19
19
  import type { EnrichmentQuotaOptions } from '../hooks/knowledge-curator.js';
20
20
  import type { KnowledgeEntryBase } from '../hooks/knowledge-types.js';
21
21
  import { type SkillImproverLLMDelegate } from '../hooks/skill-improver-llm-factory.js';
22
+ import { type WriteApprovalRequest } from '../security/write-authority.js';
22
23
  import { type AutoApplyResult, regenerateSkill } from './skill-generator.js';
23
24
  import { type QuotaWindow } from './skill-improver-quota.js';
24
25
  export interface SkillImproverConfigInput {
@@ -56,10 +57,20 @@ export interface SkillImproveRequest {
56
57
  evaluateDrafts?: boolean;
57
58
  /** Consolidation callers stage proposals only and must never auto-apply. */
58
59
  allowAutoApply?: boolean;
60
+ /** Exact approval-phase proposal body returned by a prior challenge. */
61
+ approvedCandidateContent?: string;
59
62
  }
60
63
  export interface SkillImproveResult {
61
64
  ran: boolean;
62
65
  reason?: string;
66
+ approvalRequired?: {
67
+ request?: WriteApprovalRequest;
68
+ command?: string;
69
+ candidateContent?: string;
70
+ candidateContentChars?: number;
71
+ candidateContentTokenEstimate?: number;
72
+ allowedPaths?: string[];
73
+ };
63
74
  proposalPath?: string;
64
75
  source?: 'llm' | 'deterministic_fallback';
65
76
  quota: {
@@ -100,6 +111,59 @@ export interface SkillImproveResult {
100
111
  /** #1234 Part 3D: critic-gated auto-apply of proposals in full-auto mode. */
101
112
  autoApply?: AutoApplyResult;
102
113
  }
114
+ export declare const SKILL_IMPROVER_APPROVAL_CANDIDATE_ID = "skill_improve_request";
115
+ export declare const MAX_APPROVED_CANDIDATE_CONTENT_CHARS = 64000;
116
+ interface SkillImproverDraftWrite {
117
+ slug: string;
118
+ path: string;
119
+ content: string;
120
+ sourceKnowledgeIds: string[];
121
+ missingSourceKnowledgeIds?: string[];
122
+ }
123
+ interface SkillImproverDraftSourceStampTarget {
124
+ knowledgePath: string;
125
+ ids: string[];
126
+ slug: string;
127
+ draftGeneratedSkillPath: string;
128
+ updatedAt: string;
129
+ }
130
+ export declare function buildSkillImproverApprovalRequest(input: {
131
+ sessionId?: string;
132
+ candidateContent: string;
133
+ allowedPaths: string[];
134
+ candidateId?: string;
135
+ generation?: number;
136
+ }): WriteApprovalRequest | null;
137
+ export interface PreparedSkillImproverApprovalCandidate {
138
+ directory: string;
139
+ sessionId: string;
140
+ now: Date;
141
+ source: 'llm' | 'deterministic_fallback';
142
+ model?: string;
143
+ proposalPath: string;
144
+ proposalContent: string;
145
+ allowedPaths: string[];
146
+ candidateContent: string;
147
+ draftWrites: SkillImproverDraftWrite[];
148
+ draftSourceStamps: SkillImproverDraftSourceStampTarget[];
149
+ request: WriteApprovalRequest;
150
+ quota: {
151
+ date: string;
152
+ calls_used: number;
153
+ max_calls: number;
154
+ };
155
+ quotaWindow: QuotaWindow;
156
+ maxCalls: number;
157
+ maxCallsPerDay: number;
158
+ released: boolean;
159
+ }
160
+ type SkillImproverApprovalPreparation = {
161
+ kind: 'result';
162
+ result: SkillImproveResult;
163
+ } | {
164
+ kind: 'prepared';
165
+ prepared: PreparedSkillImproverApprovalCandidate;
166
+ };
103
167
  interface InventorySnapshot {
104
168
  knowledge: {
105
169
  swarm: number;
@@ -152,6 +216,10 @@ export interface StaleSkillReconciliationResult {
152
216
  export declare function reconcileStaleActiveSkills(directory: string, options?: {
153
217
  dryRun?: boolean;
154
218
  }): Promise<StaleSkillReconciliationResult>;
219
+ export declare function prepareSkillImproverApprovalCandidate(req: SkillImproveRequest): Promise<SkillImproverApprovalPreparation>;
220
+ export declare function prepareApprovedSkillImproverCandidateWrite(req: SkillImproveRequest): Promise<SkillImproverApprovalPreparation>;
221
+ export declare function releasePreparedSkillImproverApprovalCandidate(prepared: PreparedSkillImproverApprovalCandidate): Promise<SkillImproveResult['quota']>;
222
+ export declare function writeApprovedSkillImproverCandidate(prepared: PreparedSkillImproverApprovalCandidate): Promise<SkillImproveResult>;
155
223
  export declare function runSkillImprover(req: SkillImproveRequest): Promise<SkillImproveResult>;
156
224
  export declare const _internals: {
157
225
  runSkillImprover: typeof runSkillImprover;
@@ -159,6 +227,7 @@ export declare const _internals: {
159
227
  buildLLMProposalFrame: typeof buildLLMProposalFrame;
160
228
  buildSystemPrompt: typeof buildSystemPrompt;
161
229
  buildUserPrompt: typeof buildUserPrompt;
230
+ buildSkillImproverApprovalRequest: typeof buildSkillImproverApprovalRequest;
162
231
  gatherInventory: typeof gatherInventory;
163
232
  reconcileStaleActiveSkills: typeof reconcileStaleActiveSkills;
164
233
  regenerateSkill: typeof regenerateSkill;
@@ -32,7 +32,7 @@ export type TelemetryEvent = 'session_started' | 'session_ended' | 'agent_activa
32
32
  * `prm_hard_stop` TRIGGER emitted by `src/prm/escalation.ts`. A trigger with
33
33
  * no matching delivery means the containment never reached the agent.
34
34
  */
35
- | 'prm_hard_stop_delivered' | 'agent_conflict_detected' | 'close_archive_result' | 'knowledge_receipt_transition' | 'knowledge_maintenance' | 'residue_health' | 'context_telemetry_health' | 'skill_usage_health' | 'core_events_health' | 'shell_audit_health';
35
+ | 'prm_hard_stop_delivered' | 'agent_conflict_detected' | 'close_archive_result' | 'knowledge_receipt_transition' | 'knowledge_maintenance' | 'residue_health' | 'context_telemetry_health' | 'skill_usage_health' | 'core_events_health' | 'shell_audit_health' | 'trajectory_health';
36
36
  /** Stable classification for how a reviewer-gate decision was established. */
37
37
  export type ReviewerGateEvidenceKind = 'genuine' | 'fallback' | 'data_quality' | 'block';
38
38
  /**
@@ -335,6 +335,26 @@ export declare const telemetry: {
335
335
  bytes: number;
336
336
  limit_bytes: number;
337
337
  }): void;
338
+ /**
339
+ * PRM session-trajectory store health (issue #2041): emitted on
340
+ * compaction, cleanup sweeps, and (cooldown-bounded) lock-skipped appends
341
+ * for the bounded `.swarm/trajectories/` store. Counts ONLY — no session
342
+ * identifiers, no filesystem paths, no trajectory content — matching the
343
+ * observability contract's no-content-in-metrics rule.
344
+ * `dropped_count` discloses entries folded by compaction (line budget or
345
+ * the sovereign byte ceiling) and files removed by cleanup; `skipped_lock_count`
346
+ * discloses appends skipped because the per-file cross-process lock stayed
347
+ * busy (best-effort store: telemetry loss is preferred over corruption).
348
+ */
349
+ trajectoryHealth(data: {
350
+ trigger: "compaction" | "cleanup" | "append_skip";
351
+ retained_count: number;
352
+ dropped_count: number;
353
+ corrupt_count: number;
354
+ skipped_lock_count: number;
355
+ bytes: number;
356
+ limit_bytes: number;
357
+ }): void;
338
358
  /**
339
359
  * Issue #2063 C2 — the PRM hard-stop DENIAL was actually delivered to the
340
360
  * agent (thrown by the guardrails `toolBefore` consumer). `prm_hard_stop`
@@ -203,8 +203,30 @@ export interface CollectLaneResultsResult {
203
203
  * or any lane's state.
204
204
  */
205
205
  pending_liveness?: PrWorkflowPendingLaneLiveness[];
206
+ /**
207
+ * Issue #2381: identities of every lane that had NOT settled when this
208
+ * collection returned. Present whenever any lane is unsettled, INDEPENDENT of
209
+ * `include_pending` — a caller must never have to opt in to learn that work is
210
+ * still outstanding, and a wait budget expiring is not evidence the work died.
211
+ *
212
+ * Purely additive: `lane_results` filtering and every aggregate counter are
213
+ * unchanged, so existing consumers are unaffected.
214
+ */
215
+ pending_lanes?: CollectPendingLaneIdentity[];
206
216
  errors?: string[];
207
217
  }
218
+ /**
219
+ * Issue #2381: minimal, stable identity of an unsettled lane. `output_ref` is
220
+ * carried when the record already has one (for example an `ingesting` lane whose
221
+ * artifact was written before settlement) so a caller can still recover partial
222
+ * output via `retrieve_lane_output` without a second collection.
223
+ */
224
+ export interface CollectPendingLaneIdentity {
225
+ batch_id: string;
226
+ lane_id: string;
227
+ status: string;
228
+ output_ref?: string;
229
+ }
208
230
  export interface SessionOps {
209
231
  create(args: {
210
232
  body?: {
@@ -341,6 +363,8 @@ export declare const _test_exports: {
341
363
  nextCollectPollInterval: typeof nextCollectPollInterval;
342
364
  promptHash: typeof promptHash;
343
365
  reserveCollectionLaneCallBudgets: typeof reserveCollectionLaneCallBudgets;
366
+ assembleCollectionDiagnostics: typeof assembleCollectionDiagnostics;
367
+ addLaneDiagnostic: typeof addLaneDiagnostic;
344
368
  isRetryableSessionCreateFailure: typeof isRetryableSessionCreateFailure;
345
369
  DispatchLanesArgsSchema: z.ZodObject<{
346
370
  lanes: z.ZodArray<z.ZodObject<{
@@ -451,6 +475,29 @@ export declare function executeDispatchLanes(args: unknown, directory: string, c
451
475
  export declare function executeDispatchLanesAsync(args: unknown, directory: string, context?: DispatchLanesExecutionContext): Promise<DispatchLanesAsyncResult>;
452
476
  export declare function executeCollectLaneResults(args: unknown, directory: string, context?: Pick<DispatchLanesExecutionContext, 'sessionID'>): Promise<CollectLaneResultsResult>;
453
477
  declare function isRetryableSessionCreateFailure(error: unknown): boolean;
478
+ /**
479
+ * Issue #2381 (PR review follow-up): lane-keyed collection diagnostics.
480
+ *
481
+ * These were message-keyed `Set<string>`s, which forced clearing to match on the
482
+ * quoted lane label inside the message. Because entries embed host-derived error
483
+ * text, one lane's error could literally contain another lane's quoted id and
484
+ * clear it — a missing diagnostic, never a wrong lane state, but a real residue.
485
+ * Keying by lane removes the class outright: clearing is an exact `delete`, and
486
+ * no message content can ever influence another lane's entries.
487
+ */
488
+ type LaneDiagnostics = Map<string, Set<string>>;
489
+ /**
490
+ * Assemble `result.errors` from the three diagnostic channels.
491
+ *
492
+ * Extracted as a pure function so the starvation invariant is testable without
493
+ * having to drive the poll loop into a real timeout flood: each channel is
494
+ * bounded INDEPENDENTLY, so no channel can crowd out another no matter how one
495
+ * of them behaves. The lane-keyed channels lead because they carry the per-lane
496
+ * cause an operator acts on; `hostTimeouts` is the coarser "a host call ran out
497
+ * of budget" signal and takes its own slice.
498
+ */
499
+ declare function assembleCollectionDiagnostics(hostTimeouts: ReadonlySet<string>, settleFailureLogs: LaneDiagnostics, collectionResourceFailures: LaneDiagnostics): string[];
500
+ declare function addLaneDiagnostic(diagnostics: LaneDiagnostics, laneLabel: string, message: string): void;
454
501
  declare function consumePrReviewReceiptAppendFailureLog(loggedFailures: Set<string>, parentSessionId: string, correlationId: string): boolean;
455
502
  /**
456
503
  * Issue #2349: a terminal error read off the last assistant message of a lane
@@ -1,5 +1,5 @@
1
1
  import type { FreshnessProbe } from './freshness';
2
- import type { BlastRadiusResult, CallerReference, ContextPackResult, DeadExportsResult, FileOntology, FileReference, GraphHealthResult, GraphNode, LocalizationBlock, PackageBoundarySummary, RepoGraph, SymbolReference } from './types';
2
+ import type { BlastRadiusResult, CallerReference, ContextPackResult, ContextPackSourceMode, DeadExportsResult, FileOntology, FileReference, GraphHealthResult, GraphNode, LocalizationBlock, PackageBoundarySummary, RepoGraph, SymbolReference } from './types';
3
3
  export declare function getGraphNode(graph: RepoGraph, input: string): GraphNode | undefined;
4
4
  export declare function resetQueryCache(): void;
5
5
  /**
@@ -49,6 +49,7 @@ export declare function getContextPack(graph: RepoGraph, file: string, symbol: s
49
49
  maxDepth?: number;
50
50
  maxTokens?: number;
51
51
  includeSource?: boolean;
52
+ sourceMode?: ContextPackSourceMode;
52
53
  directory?: string;
53
54
  }): ContextPackResult;
54
55
  export declare function getPackageBoundaries(graph: RepoGraph, topN?: number): PackageBoundarySummary[];
@@ -286,6 +286,64 @@ export interface ContextPackSpan {
286
286
  text?: string;
287
287
  note?: string;
288
288
  }
289
+ /**
290
+ * Source-text extraction mode for source-bearing context packs (issue #1533).
291
+ * `include_source` remains the sole gate; `source_mode` only refines what is
292
+ * extracted once source was requested.
293
+ *
294
+ * - `mixed` (default): body text for near spans (span mode 'full'), signature
295
+ * text for periphery spans (span mode 'signature').
296
+ * - `body`: body text for every span with an export range.
297
+ * - `signature`: signature text for every span with an export range.
298
+ */
299
+ export type ContextPackSourceMode = 'signature' | 'body' | 'mixed';
300
+ /**
301
+ * A bounded source snippet with provenance (issue #1533). Emitted one per
302
+ * returned span that actually had text extracted; internal-symbol fallback
303
+ * spans produce no snippet.
304
+ *
305
+ * `mode` describes the returned text, independent of the owning span's
306
+ * traversal mode: 'full' = whole range text; 'signature' = signature-only
307
+ * extraction; 'summary' = body text line-capped at 80 lines.
308
+ *
309
+ * `hash` is the sha256 hex of the returned `text` — a content fingerprint.
310
+ * It is stable for a given source mode and file content; summary-mode hashes
311
+ * are cap-dependent by design because the text itself is truncated.
312
+ *
313
+ * `confidence` is a deterministic resolution-quality score in [0, 1]:
314
+ * 1.0 = the exact requested target symbol, 0.8 = a resolved neighbor with
315
+ * extracted text. Spans whose read failed or which lack an export range
316
+ * produce no snippet at all (their state surfaces via span.note, coverage,
317
+ * and warnings). It is NOT language grammar quality; issue #1532 (KG-11
318
+ * SymbolEdge v2) will replace this derivation with real edge confidence.
319
+ */
320
+ export interface ContextPackSnippet {
321
+ file: string;
322
+ symbol: string;
323
+ startLine: number;
324
+ endLine: number;
325
+ mode: 'full' | 'signature' | 'summary';
326
+ text: string;
327
+ hash: string;
328
+ confidence: number;
329
+ }
330
+ /**
331
+ * Coverage accounting for a context pack (issue #1533).
332
+ *
333
+ * `unresolvedEdges` and `lowConfidenceEdges` count distinct destination
334
+ * SYMBOLS (keyed `file\0symbol`, collected at BFS first discovery), not edge
335
+ * instances — duplicate edges toward the same unresolved symbol count once.
336
+ * `lowConfidenceEdges` uses exactly the same predicate as the internal-symbol
337
+ * span fallback (destination file present, no own-property export range for
338
+ * the symbol), so coverage and spans can never disagree.
339
+ */
340
+ export interface ContextPackCoverage {
341
+ reachedSymbols: number;
342
+ returnedSymbols: number;
343
+ omittedByBudget: number;
344
+ unresolvedEdges: number;
345
+ lowConfidenceEdges: number;
346
+ }
289
347
  /**
290
348
  * Result of a context-pack query: the set of spans needed to understand
291
349
  * how a target symbol is used across the workspace.
@@ -308,6 +366,12 @@ export interface ContextPackResult {
308
366
  note?: string;
309
367
  /** Whether source text was embedded in spans (only present when include_source was requested). */
310
368
  sourceIncluded?: boolean;
369
+ /** Source snippets with provenance; only present when include_source was requested. */
370
+ snippets?: ContextPackSnippet[];
371
+ /** Reach/omission and edge-resolution accounting; present on every result. */
372
+ coverage?: ContextPackCoverage;
373
+ /** Bounded, deduplicated non-fatal warnings (budget omissions, read failures, containment). */
374
+ warnings?: string[];
311
375
  }
312
376
  export interface AskHit {
313
377
  file: string;
@@ -26,6 +26,6 @@ export { extractFileOntology } from './repo-graph/ontology';
26
26
  export type { DeadExportsOptions } from './repo-graph/query';
27
27
  export { buildOntologyPreflightPacket, getBlastRadius, getCallers, getContextPack, getDeadExports, getDependencies, getFileOntology, getGraphHealth, getGraphNode, getImporters, getKeyFiles, getLocalizationContext, getPackageBoundaries, getSymbolConsumers, isGraphFresh, resetQueryCache, } from './repo-graph/query';
28
28
  export { getGraphPath, loadGraph, loadGraphSync, loadOrCreateGraph, saveGraph, saveIfDirty, } from './repo-graph/storage';
29
- export type { AskHit, AskOptions, AskResult, BlastRadiusResult, BuildWorkspaceGraphOptions, CallerReference, ContextPackResult, ContextPackSpan, ConventionFact, DataOperationFact, DeadExportCandidate, DeadExportsResult, FileOntology, FileReference, FileRole, FreshnessProbeState, GraphEdge, GraphExtractionFailure, GraphExtractorInputWitness, GraphHealthResult, GraphNode, GraphUnresolvedImport, LocalizationBlock, OntologyFinding, PackageBoundarySummary, RepoGraph, RepoGraphDiagnostics, RouteFact, RouteMethod, SecurityFact, SymbolEdge, SymbolEdgeEvidence, SymbolEdgeKind, SymbolEdgeResolution, SymbolIdentityKind, SymbolReference, } from './repo-graph/types';
29
+ export type { AskHit, AskOptions, AskResult, BlastRadiusResult, BuildWorkspaceGraphOptions, CallerReference, ContextPackCoverage, ContextPackResult, ContextPackSnippet, ContextPackSourceMode, ContextPackSpan, ConventionFact, DataOperationFact, DeadExportCandidate, DeadExportsResult, FileOntology, FileReference, FileRole, FreshnessProbeState, GraphEdge, GraphExtractionFailure, GraphExtractorInputWitness, GraphHealthResult, GraphNode, GraphUnresolvedImport, LocalizationBlock, OntologyFinding, PackageBoundarySummary, RepoGraph, RepoGraphDiagnostics, RouteFact, RouteMethod, SecurityFact, SymbolEdge, SymbolEdgeEvidence, SymbolEdgeKind, SymbolEdgeResolution, SymbolIdentityKind, SymbolReference, } from './repo-graph/types';
30
30
  export { createEmptyGraph, GRAPH_SCHEMA_VERSION, inferPackageBoundary, isSchemaVersionAtLeast, normalizeGraphPath, REPO_GRAPH_FILENAME, updateGraphMetadata, } from './repo-graph/types';
31
31
  export { validateGraphEdge, validateGraphNode, validateWorkspace, } from './repo-graph/validation';
@@ -9,8 +9,15 @@
9
9
  * Closes issue #629: lets users wire an expensive OpenRouter model and cap
10
10
  * its usage to e.g. 10 calls/day.
11
11
  */
12
+ import { findWriteApprovalFact, formatApproveWriteCommand } from '../security/write-authority.js';
12
13
  import { createSwarmTool } from './create-tool.js';
14
+ declare const writeAuthorityDependencies: {
15
+ findWriteApprovalFact: typeof findWriteApprovalFact;
16
+ formatApproveWriteCommand: typeof formatApproveWriteCommand;
17
+ };
13
18
  export declare const skill_improve: ReturnType<typeof createSwarmTool>;
14
19
  export declare const _internals: {
15
20
  skill_improve: typeof skill_improve;
21
+ writeAuthorityDependencies: typeof writeAuthorityDependencies;
16
22
  };
23
+ export {};
@@ -131,6 +131,8 @@ export declare const MAX_ATOMIC_WRITE_BYTES: number;
131
131
  export interface AtomicWriteOptions {
132
132
  /** Skip the pre-rename fsync (tests / truly ephemeral data). */
133
133
  readonly skipFsync?: boolean;
134
+ /** File mode for the per-write temporary file before rename. */
135
+ readonly mode?: number;
134
136
  /**
135
137
  * Override the bounded-write cap (default MAX_ATOMIC_WRITE_BYTES). Exposed
136
138
  * so the bound itself is testable without allocating 256 MiB.
@@ -0,0 +1,31 @@
1
+ /**
2
+ * Canonical project-root keying for session-scoped module state (issue #2041).
3
+ *
4
+ * The trajectory cache (src/prm/trajectory-store.ts), the step counters
5
+ * (src/hooks/trajectory-step-state.ts), and the logger's restart-seed gate
6
+ * (src/hooks/trajectory-logger.ts) are all process-global maps that a
7
+ * multi-root host can share through one plugin module instance. They must key
8
+ * by canonical root + session id, and they must agree on what "canonical"
9
+ * means: realpath resolves junction/symlink aliases (linked worktrees on
10
+ * Windows are junctions), `path.resolve` is the fallback for a root that does
11
+ * not exist yet, and Windows roots are case-folded because the filesystem is.
12
+ * A symlinked `.swarm` directory itself is already rejected by
13
+ * `validateSwarmPath`, so the aliasing this resolves lives strictly ABOVE
14
+ * `.swarm`. One shared implementation so the three maps cannot drift.
15
+ */
16
+ /**
17
+ * Separator between canonical root and session id in composite keys.
18
+ * `String.fromCharCode(0)` rather than an escape literal so the source stays
19
+ * clean text (a literal NUL byte in source makes tooling treat the file as
20
+ * binary); NUL cannot appear in a path on any supported platform.
21
+ */
22
+ export declare const SESSION_KEY_SEPARATOR: string;
23
+ export declare function canonicalRootKey(directory: string): string;
24
+ /** Composite map key: canonical root + NUL + session id. */
25
+ export declare function compositeSessionKey(directory: string, sessionId: string): string;
26
+ /**
27
+ * Suffix every root's key for a session ends with. Suffix-scan clear paths
28
+ * that legitimately lack a directory (the `/swarm reset` entry points) match
29
+ * all roots with this.
30
+ */
31
+ export declare function sessionKeySuffix(sessionId: string): string;
@@ -1,5 +1,6 @@
1
1
  import type { BackgroundTaskChangeContext, BackgroundWorktreeDescriptor } from '../background/pending-delegations.js';
2
2
  import { type TaskEvidence } from '../gate-evidence.js';
3
+ import { removeWorktreeProvisioningOwner } from '../hooks/delegation-gate/worktree-provisioning-owner.js';
3
4
  import type { MergeOperationProvenance } from '../worktree/merge.js';
4
5
  import type { CoderSettlementWal } from './workflow-wal-schema.js';
5
6
  export interface CoderSettlementResult {
@@ -161,6 +162,7 @@ export declare function recoverStaleCoderSettlements(directory: string, options?
161
162
  }>;
162
163
  export declare const _internals: {
163
164
  liveDispatches: Set<string>;
165
+ removeWorktreeProvisioningOwner: typeof removeWorktreeProvisioningOwner;
164
166
  /**
165
167
  * Test seam for the lane-branch existence probe. Production reads it here,
166
168
  * so the #2236 fail-closed invariants — never mark a WAL terminal while the
@@ -1,5 +1,5 @@
1
1
  export type { AutoCommitSkip, AutoCommitSuccess, CleanCheckFailure, CleanCheckSuccess, CleanFailure, CleanSuccess, ProvisionFailure, ProvisionSuccess, RemoveFailure, RemoveSuccess, } from './core';
2
2
  export { _internals as coreInternals, assertCleanWorkingTree, autoCommitDirty, checkPathBudget, cleanUntrackedFiles, isCleanWorktree, isPathUnderSwarmWorktreeBase, makeWorktreeBranchName, provisionWorktree, removeWorktree, resolveWorktreeBaseDir, shortenWorktreePath, } from './core';
3
- export type { CleanupFailure, CleanupSuccess, ConflictHandlingError, ConflictInfo, DirtyMergeFailure, DirtyMergePartial, DirtyMergeSuccess, MergeConflict, MergeFailure, MergeSuccess, OrphanCleanupResult, StartupRecoveryResult, } from './merge';
4
- export { _internals as mergeInternals, attemptMergeBackFromDirty, cleanupOrphanedBranches, getMergeStrategy, handleMergeConflict, mergeLaneBranch, postMergeCleanup, pruneStaleWorktreeMetadata, scanRegisteredWorktreeLiveness, startupOrphanRecovery, } from './merge';
3
+ export type { CleanupFailure, CleanupSuccess, ConflictHandlingError, ConflictInfo, DirtyMergeFailure, DirtyMergePartial, DirtyMergeSuccess, ImmutableMergeRecoveryCoordinates, ImmutableMergeRecoveryResult, MergeConflict, MergeFailure, MergeSuccess, OrphanCleanupResult, StartupRecoveryResult, } from './merge';
4
+ export { _internals as mergeInternals, attemptMergeBackFromDirty, cleanupOrphanedBranches, getMergeStrategy, handleMergeConflict, mergeLaneBranch, postMergeCleanup, pruneStaleWorktreeMetadata, recoverMergeBackFromImmutableCoordinates, scanRegisteredWorktreeLiveness, startupOrphanRecovery, } from './merge';
5
5
  export * from './types';
@@ -30,6 +30,8 @@ export declare const _internals: {
30
30
  cleanupOrphanedBranches: typeof cleanupOrphanedBranches;
31
31
  /** Test seam for startupOrphanRecovery — allows tests to intercept the recovery call. */
32
32
  startupOrphanRecovery: typeof startupOrphanRecovery;
33
+ /** Test seam for the dirty merge overlap preflight. */
34
+ captureMergeOverlapSnapshot: typeof captureMergeOverlapSnapshot;
33
35
  /** FR-001b: exposes extractSessionId for lane ownership validation. */
34
36
  extractSessionId: typeof extractSessionId;
35
37
  /**
@@ -156,6 +158,26 @@ export type MergeReconciliationResult = {
156
158
  landed: false;
157
159
  error?: string;
158
160
  };
161
+ /**
162
+ * Immutable preserved-lane coordinates captured by the #2105 recovery
163
+ * authority. This path deliberately consumes exact object ids rather than a
164
+ * mutable branch ref, so a redispatch can recover the preserved lane even if
165
+ * the lane branch later advances, rewinds, or is renamed.
166
+ */
167
+ export interface ImmutableMergeRecoveryCoordinates {
168
+ sourceBaseOid: string;
169
+ sourceHeadOid: string;
170
+ targetHeadOid: string;
171
+ strategy: MergeStrategy;
172
+ }
173
+ export type ImmutableMergeRecoveryResult = (MergeSuccess & {
174
+ sourceCommitOrder?: string[];
175
+ rewrittenCommitOrder?: string[];
176
+ }) | (MergeConflict & {
177
+ sourceCommitOrder?: string[];
178
+ }) | (MergeFailure & {
179
+ sourceCommitOrder?: string[];
180
+ });
159
181
  export interface DirtyMergeOptions {
160
182
  /** Stable identifier allocated before the merge-back begins. */
161
183
  operationId?: string;
@@ -167,6 +189,20 @@ export interface DirtyMergeOptions {
167
189
  */
168
190
  onBeforeMerge?: (provenance: MergeOperationProvenance) => Promise<void>;
169
191
  }
192
+ interface MergeOverlapSnapshot {
193
+ targetHead: string;
194
+ laneHead: string;
195
+ mergeBase: string;
196
+ indexDigest: string;
197
+ statusDigest: string;
198
+ incomingDigest: string;
199
+ overlapPaths: string[];
200
+ }
201
+ declare function captureMergeOverlapSnapshot(primaryDir: string, branchName: string): Promise<{
202
+ snapshot: MergeOverlapSnapshot;
203
+ } | {
204
+ error: string;
205
+ }>;
170
206
  export interface OrphanCleanupResult {
171
207
  removed: string[];
172
208
  skipped: string[];
@@ -219,6 +255,17 @@ export declare function getMergeStrategy(config: {
219
255
  * @returns Discriminated union: success, conflict, or failure.
220
256
  */
221
257
  export declare function mergeLaneBranch(primaryDir: string, branchName: string, strategy: MergeStrategy): Promise<MergeSuccess | MergeConflict | MergeFailure>;
258
+ /**
259
+ * Re-applies a preserved lane using exact immutable object ids captured by the
260
+ * #2105 recovery authority.
261
+ *
262
+ * This is the strategy-specific recovery primitive that `worktree-isolation`
263
+ * can call when a same-task redispatch claims a preserved lane. It refuses to
264
+ * operate on mutable branch refs, verifies that the captured lane ancestry is
265
+ * coherent, and fails closed if the current primary checkout no longer
266
+ * descends from the captured target head.
267
+ */
268
+ export declare function recoverMergeBackFromImmutableCoordinates(primaryDir: string, coordinates: ImmutableMergeRecoveryCoordinates): Promise<ImmutableMergeRecoveryResult>;
222
269
  /**
223
270
  * Detect whether a previously-started merge-back already landed on the target.
224
271
  *
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "opencode-swarm",
3
- "version": "7.152.1",
3
+ "version": "7.153.1",
4
4
  "description": "Architect-centric agentic swarm plugin for OpenCode - hub-and-spoke orchestration with SME consultation, code generation, and QA review",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -111,6 +111,7 @@
111
111
  "check:retention": "bun run scripts/check-retention-registry.ts",
112
112
  "check:core-events": "bun run scripts/check-core-events-usage.ts",
113
113
  "check:shell-audit": "bun run scripts/check-shell-audit-usage.ts",
114
+ "check:trajectory-store": "bun run scripts/check-trajectory-store-usage.ts",
114
115
  "check:test-file-cap": "bun run scripts/check-test-file-cap.ts",
115
116
  "check:pending-fragment": "bun run scripts/check-pending-fragment.ts",
116
117
  "check:gate-portability": "bun run scripts/check-gate-portability.ts",
@@ -1,65 +0,0 @@
1
- // @bun
2
- import {
3
- createCuratorLLMDelegate
4
- } from "./index-sg2sx2q7.js";
5
- import"./index-44xdtqz8.js";
6
- import"./index-k3d919yf.js";
7
- import"./index-x6803sxh.js";
8
- import"./index-26vyr198.js";
9
- import"./index-73pmnsjg.js";
10
- import"./index-134d35c1.js";
11
- import"./index-nj6rmyeh.js";
12
- import"./index-y8552snf.js";
13
- import"./index-nd8tkb3g.js";
14
- import"./index-02ajc6d1.js";
15
- import"./index-70ha9e09.js";
16
- import"./index-c8s9a3zh.js";
17
- import"./index-9ss2m4rs.js";
18
- import"./index-vnn7qq8c.js";
19
- import"./index-0q2mjxp2.js";
20
- import"./index-2e1294d1.js";
21
- import"./index-rq6aetkv.js";
22
- import"./index-pvrap7xg.js";
23
- import"./index-rtry5xyf.js";
24
- import"./index-zsrtt42s.js";
25
- import"./index-z4bg1hv8.js";
26
- import"./index-fxvgaeq4.js";
27
- import"./index-z9fyd0d6.js";
28
- import"./index-qqrdmaxq.js";
29
- import"./index-q77e475x.js";
30
- import"./index-xyfdmrv7.js";
31
- import"./index-6zkm4p7p.js";
32
- import"./index-556ja8an.js";
33
- import"./index-b43rt5ph.js";
34
- import"./index-q7sjgr1y.js";
35
- import"./index-3g0xk6tk.js";
36
- import"./index-85gkedsf.js";
37
- import"./index-0tfgn5x0.js";
38
- import"./index-dn6yt0xg.js";
39
- import"./index-ryecg2st.js";
40
- import"./index-gprxjmm7.js";
41
- import"./index-n832052r.js";
42
- import"./index-4cgee5vh.js";
43
- import"./index-z6xqpmqg.js";
44
- import"./index-r3mvsbtq.js";
45
- import"./index-3djxegsc.js";
46
- import"./index-n0vc5b5t.js";
47
- import"./index-cpg98bh1.js";
48
- import"./index-9e6fdz2h.js";
49
- import"./index-4rhhvd1a.js";
50
- import"./index-zjygnfay.js";
51
- import"./index-ae75rja9.js";
52
- import"./index-79g6edht.js";
53
- import"./index-mken64yj.js";
54
- import"./index-bk5tah7q.js";
55
- import"./index-7fh82sm1.js";
56
- import"./index-txbd25bc.js";
57
- import"./index-aw492hpn.js";
58
- import"./index-7g4c7s5r.js";
59
- import"./index-bpmtbmy9.js";
60
- import"./index-ed5ykebp.js";
61
- import"./index-zgwm4ryv.js";
62
- import"./index-a76rekgs.js";
63
- export {
64
- createCuratorLLMDelegate
65
- };