opencode-swarm 7.140.4 → 7.140.6

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 (100) hide show
  1. package/.opencode/skills/plan/SKILL.md +40 -12
  2. package/.opencode/skills/swarm-pr-review/SKILL.md +2 -4
  3. package/.opencode/skills/swarm-pr-review/references/lane-output-recoverability.md +54 -0
  4. package/dist/agents/architect.d.ts +2 -1
  5. package/dist/background/candidate-contract.d.ts +1 -1
  6. package/dist/background/pending-delegations.d.ts +5 -0
  7. package/dist/background/pr-review-trigger-contract.d.ts +36 -0
  8. package/dist/cli/{config-doctor-qqe6172n.js → config-doctor-y5qeh18c.js} +3 -3
  9. package/dist/cli/{core-52k057mf.js → core-pwd9604e.js} +2 -2
  10. package/dist/cli/{curation-policy-9291bdat.js → curation-policy-avvb56x2.js} +6 -6
  11. package/dist/cli/curator-llm-factory-96pnc23w.js +61 -0
  12. package/dist/cli/{curator-04xqq68e.js → curator-q1nchgpg.js} +36 -36
  13. package/dist/cli/{evidence-summary-service-em58myd7.js → evidence-summary-service-18142mr3.js} +14 -11
  14. package/dist/cli/gate-evidence-smn2wqft.js +51 -0
  15. package/dist/cli/guardrail-explain-kyd89z8z.js +62 -0
  16. package/dist/cli/{guardrail-log-vb5zkegf.js → guardrail-log-cahp1ews.js} +4 -4
  17. package/dist/cli/{hive-promoter-z09khawt.js → hive-promoter-vcbcvcsh.js} +36 -36
  18. package/dist/cli/{index-ysa38bnr.js → index-1p72dtym.js} +3 -3
  19. package/dist/cli/{index-s8g7jh1k.js → index-2778hhh7.js} +2 -2
  20. package/dist/cli/{index-v3xhc7kg.js → index-4s7xgzbm.js} +1 -1
  21. package/dist/cli/{index-wk8s1m7b.js → index-4zxrkk1h.js} +217 -15
  22. package/dist/cli/{index-hz0refz4.js → index-56rqw2hs.js} +70 -29
  23. package/dist/cli/{index-djbhe0yh.js → index-5qd5vt2d.js} +38 -38
  24. package/dist/cli/{index-35qep0v7.js → index-912qz4y0.js} +88 -88
  25. package/dist/cli/{index-2rb3x0fk.js → index-92n3d5ky.js} +7 -7
  26. package/dist/cli/{index-ryq97w1x.js → index-bjqpdr83.js} +4 -4
  27. package/dist/cli/{index-c5kr20nz.js → index-c432knmy.js} +1 -1
  28. package/dist/cli/{index-v3x7j9ey.js → index-dtqjxfw9.js} +2 -2
  29. package/dist/cli/{index-hfwzxh3j.js → index-e58e3v0v.js} +12 -10
  30. package/dist/cli/{index-bfhwtdsw.js → index-epvhf50h.js} +3 -3
  31. package/dist/cli/{index-vrmkg8fm.js → index-fejfzy2j.js} +9 -9
  32. package/dist/cli/{index-mpytsq6k.js → index-h01wb18g.js} +2 -2
  33. package/dist/cli/{index-hxvkfx6t.js → index-jqsfsqbx.js} +15 -2
  34. package/dist/cli/{index-bn17ycxn.js → index-m9xrdjn0.js} +1 -1
  35. package/dist/cli/{index-a1fjhx4w.js → index-nakkgkkt.js} +37922 -35984
  36. package/dist/cli/index-p04qrwck.js +43 -0
  37. package/dist/cli/{index-arza4m4j.js → index-p2ty3eee.js} +2 -2
  38. package/dist/cli/{index-4hp8nvwb.js → index-p8kk34am.js} +3 -3
  39. package/dist/cli/{index-1kyex7z2.js → index-qwm6vdyv.js} +32 -1
  40. package/dist/cli/{index-dtam929z.js → index-qy1nq52t.js} +1 -1
  41. package/dist/cli/{index-rrb6cz2f.js → index-s1v0wza5.js} +6 -2
  42. package/dist/cli/{index-w4etfamq.js → index-t5pytnca.js} +2 -2
  43. package/dist/cli/{index-tj04dj06.js → index-thp186x0.js} +2 -2
  44. package/dist/cli/index-tjqzr3jc.js +623 -0
  45. package/dist/cli/{index-mrpfd1jx.js → index-vh05t3w5.js} +1 -1
  46. package/dist/cli/{index-7begd9aq.js → index-y9q9f6ms.js} +4 -4
  47. package/dist/cli/{index-v1an91bq.js → index-z0z9pe7b.js} +5 -5
  48. package/dist/cli/{index-hfjvepk2.js → index-z3s0a44b.js} +3 -3
  49. package/dist/cli/{index-pp5m7xga.js → index-zd4qhnr7.js} +70 -34
  50. package/dist/cli/{index-b8zgtz81.js → index-zsrtt42s.js} +34 -1
  51. package/dist/cli/index.js +35 -35
  52. package/dist/cli/{knowledge-escalator-gdjnwszd.js → knowledge-escalator-gj58za4g.js} +12 -12
  53. package/dist/cli/{knowledge-events-581x4q7n.js → knowledge-events-3m5jnnv6.js} +10 -10
  54. package/dist/cli/{knowledge-link-axx45d1h.js → knowledge-link-m9p80f4r.js} +5 -5
  55. package/dist/cli/{knowledge-store-ttg33482.js → knowledge-store-0vy8wbzd.js} +6 -6
  56. package/dist/cli/{knowledge-validator-8kywqt8b.js → knowledge-validator-mvcs8wf6.js} +8 -8
  57. package/dist/cli/{pending-delegations-btwqsvz4.js → pending-delegations-cxx9tezp.js} +4 -4
  58. package/dist/cli/{pr-subscriptions-83y1cdwv.js → pr-subscriptions-2sfnb599.js} +4 -4
  59. package/dist/cli/{runner-fh3r41nw.js → runner-mky3vvht.js} +6 -6
  60. package/dist/cli/{scan-cursor-j8ytdpam.js → scan-cursor-wznc7p7p.js} +7 -7
  61. package/dist/cli/{schema-6xfqtpvn.js → schema-k596bhds.js} +2 -2
  62. package/dist/cli/{scope-persistence-8c72jrgp.js → scope-persistence-0ny5fn07.js} +10 -5
  63. package/dist/cli/{skill-generator-n8vm1yhn.js → skill-generator-vrks0jjj.js} +14 -14
  64. package/dist/cli/{telemetry-fb44gpba.js → telemetry-0x6kszvk.js} +1 -1
  65. package/dist/cli/{worktree-collision-ownership-f28r473k.js → worktree-collision-ownership-wm5pse49.js} +8 -8
  66. package/dist/cli/worktree-isolation-zgk7314k.js +102 -0
  67. package/dist/cli/worktree-provisioning-owner-sjh7te1h.js +22 -0
  68. package/dist/commands/acknowledge-spec-drift.d.ts +4 -5
  69. package/dist/config/evidence-schema.d.ts +3 -3
  70. package/dist/config/index.d.ts +2 -2
  71. package/dist/config/plan-schema.d.ts +8 -0
  72. package/dist/config/schema.d.ts +2 -2
  73. package/dist/council/council-evidence-writer.d.ts +1 -1
  74. package/dist/gate-evidence.d.ts +117 -4
  75. package/dist/hooks/delegation-gate.d.ts +21 -0
  76. package/dist/hooks/pr-workflow-gate.d.ts +20 -0
  77. package/dist/index.js +775 -748
  78. package/dist/plan/ledger.d.ts +55 -0
  79. package/dist/plan/manager.d.ts +9 -0
  80. package/dist/plan/planning-profile.d.ts +27 -0
  81. package/dist/services/spec-drift-recovery.d.ts +84 -0
  82. package/dist/session/snapshot-writer.d.ts +3 -1
  83. package/dist/state.d.ts +19 -17
  84. package/dist/summaries/schema.d.ts +2 -2
  85. package/dist/tools/convene-council.d.ts +6 -6
  86. package/dist/tools/save-plan.d.ts +8 -0
  87. package/dist/tools/submit-phase-council-verdicts.d.ts +6 -6
  88. package/dist/tools/tool-metadata.d.ts +28 -28
  89. package/dist/tools/update-task-status.d.ts +13 -0
  90. package/dist/tools/write-final-council-evidence.d.ts +6 -6
  91. package/dist/types/events.d.ts +29 -1
  92. package/dist/workflow/coder-settlement.d.ts +62 -0
  93. package/dist/workflow/task-repair.d.ts +30 -0
  94. package/dist/workflow/task-terminal.d.ts +52 -0
  95. package/package.json +1 -1
  96. package/dist/cli/curator-llm-factory-cfm8fhdw.js +0 -61
  97. package/dist/cli/gate-evidence-ezxfkb22.js +0 -32
  98. package/dist/cli/guardrail-explain-pn1bcgfz.js +0 -62
  99. package/dist/cli/index-d181x9zr.js +0 -71
  100. package/dist/cli/index-dtyeabmj.js +0 -239
@@ -1,27 +1,27 @@
1
1
  // @bun
2
+ import {
3
+ scanWorktreeMergeFailuresForRecovery
4
+ } from "./index-zsrtt42s.js";
2
5
  import {
3
6
  WORKTREE_PROVISIONING_OWNER_LEASE_MS,
4
7
  removeWorktreeProvisioningOwner,
5
8
  scanWorktreeProvisioningOwnersForRecovery
6
- } from "./index-1kyex7z2.js";
7
- import {
8
- scanWorktreeMergeFailuresForRecovery
9
- } from "./index-b8zgtz81.js";
9
+ } from "./index-qwm6vdyv.js";
10
10
  import {
11
11
  scanDelegationFallbacksForRecovery,
12
12
  scanDelegationsForRecovery
13
- } from "./index-rrb6cz2f.js";
13
+ } from "./index-s1v0wza5.js";
14
14
  import"./index-k46me75h.js";
15
15
  import"./index-ee3x66a5.js";
16
- import"./index-ed5ykebp.js";
17
- import"./index-35qep0v7.js";
16
+ import"./index-912qz4y0.js";
18
17
  import"./index-7g4c7s5r.js";
18
+ import"./index-ed5ykebp.js";
19
19
  import {
20
20
  bunSpawn
21
21
  } from "./index-4nt52yr9.js";
22
22
  import"./index-zgwm4ryv.js";
23
23
  import"./index-zjygnfay.js";
24
- import"./index-bfhwtdsw.js";
24
+ import"./index-epvhf50h.js";
25
25
  import"./index-bpmtbmy9.js";
26
26
  import"./index-a76rekgs.js";
27
27
 
@@ -0,0 +1,102 @@
1
+ // @bun
2
+ import {
3
+ MAX_TRACKED_STANDARD_WORKTREE_CALLS,
4
+ _internals,
5
+ abortStandardWorktreeDispatch,
6
+ awaitingMergeByCallID,
7
+ checkStandardWorktreeSerializationRelease,
8
+ cleanupStandardWorktreeForCallId,
9
+ computeLaneRuntimeProfile,
10
+ finishStandardWorktreeDispatch,
11
+ isLaneOwnedByCurrentSession,
12
+ parseLeanLaneIndex,
13
+ preProvisionCollisionCheck,
14
+ precreateStandardWorktreeSession,
15
+ preserveBackgroundWorktreeOwnershipForCallId,
16
+ preserveDirtyWorktreeAtPath,
17
+ preserveDirtyWorktreeForCallId,
18
+ readLaneEnvFileFromDisk,
19
+ resetStandardWorktreeIsolationState,
20
+ sanitizeWorktreeTaskId,
21
+ standardWorktreeByCallID,
22
+ standardWorktreeSerializationSessions
23
+ } from "./index-nakkgkkt.js";
24
+ import"./index-4905hd2m.js";
25
+ import"./index-41hkt36g.js";
26
+ import"./index-c432knmy.js";
27
+ import"./index-1p72dtym.js";
28
+ import"./index-c8s9a3zh.js";
29
+ import"./index-p2ty3eee.js";
30
+ import"./index-56rqw2hs.js";
31
+ import"./index-134d35c1.js";
32
+ import"./index-t5pytnca.js";
33
+ import"./index-y8552snf.js";
34
+ import"./index-9ss2m4rs.js";
35
+ import"./index-74hpm6sh.js";
36
+ import"./index-z3s0a44b.js";
37
+ import"./index-z0z9pe7b.js";
38
+ import"./index-h01wb18g.js";
39
+ import"./index-v2xrer41.js";
40
+ import"./index-m9xrdjn0.js";
41
+ import"./index-bjqpdr83.js";
42
+ import"./index-556ja8an.js";
43
+ import"./index-4zxrkk1h.js";
44
+ import"./index-zsrtt42s.js";
45
+ import"./index-dtqjxfw9.js";
46
+ import"./index-qwm6vdyv.js";
47
+ import"./index-tjqzr3jc.js";
48
+ import"./index-s1v0wza5.js";
49
+ import"./index-8fwhhayc.js";
50
+ import"./index-q1exe2b3.js";
51
+ import"./index-92n3d5ky.js";
52
+ import"./index-k46me75h.js";
53
+ import"./index-ee3x66a5.js";
54
+ import"./index-y9q9f6ms.js";
55
+ import"./index-qy1nq52t.js";
56
+ import"./index-rtry5xyf.js";
57
+ import"./index-fejfzy2j.js";
58
+ import"./index-ae75rja9.js";
59
+ import"./index-vh05t3w5.js";
60
+ import"./index-p8kk34am.js";
61
+ import"./index-912qz4y0.js";
62
+ import"./index-7g4c7s5r.js";
63
+ import"./index-ed5ykebp.js";
64
+ import"./index-4nt52yr9.js";
65
+ import {
66
+ resolveWorktreeIsolationConfig
67
+ } from "./index-p04qrwck.js";
68
+ import"./index-gprxjmm7.js";
69
+ import"./index-n832052r.js";
70
+ import"./index-zd4qhnr7.js";
71
+ import"./index-4rhhvd1a.js";
72
+ import"./index-zgwm4ryv.js";
73
+ import"./index-thp186x0.js";
74
+ import"./index-jqsfsqbx.js";
75
+ import"./index-zjygnfay.js";
76
+ import"./index-bk5tah7q.js";
77
+ import"./index-epvhf50h.js";
78
+ import"./index-bpmtbmy9.js";
79
+ import"./index-a76rekgs.js";
80
+ export {
81
+ standardWorktreeSerializationSessions,
82
+ standardWorktreeByCallID,
83
+ sanitizeWorktreeTaskId,
84
+ resolveWorktreeIsolationConfig,
85
+ resetStandardWorktreeIsolationState,
86
+ readLaneEnvFileFromDisk,
87
+ preserveDirtyWorktreeForCallId,
88
+ preserveDirtyWorktreeAtPath,
89
+ preserveBackgroundWorktreeOwnershipForCallId,
90
+ precreateStandardWorktreeSession,
91
+ preProvisionCollisionCheck,
92
+ parseLeanLaneIndex,
93
+ isLaneOwnedByCurrentSession,
94
+ finishStandardWorktreeDispatch,
95
+ computeLaneRuntimeProfile,
96
+ cleanupStandardWorktreeForCallId,
97
+ checkStandardWorktreeSerializationRelease,
98
+ awaitingMergeByCallID,
99
+ abortStandardWorktreeDispatch,
100
+ _internals,
101
+ MAX_TRACKED_STANDARD_WORKTREE_CALLS
102
+ };
@@ -0,0 +1,22 @@
1
+ // @bun
2
+ import {
3
+ WORKTREE_LIFECYCLE_LOCK_FILE,
4
+ WORKTREE_PROVISIONING_OWNER_LEASE_MS,
5
+ recordWorktreeProvisioningOwner,
6
+ removeWorktreeProvisioningOwner,
7
+ scanWorktreeProvisioningOwnersForRecovery
8
+ } from "./index-qwm6vdyv.js";
9
+ import"./index-k46me75h.js";
10
+ import"./index-ee3x66a5.js";
11
+ import"./index-ed5ykebp.js";
12
+ import"./index-4nt52yr9.js";
13
+ import"./index-zgwm4ryv.js";
14
+ import"./index-zjygnfay.js";
15
+ import"./index-a76rekgs.js";
16
+ export {
17
+ scanWorktreeProvisioningOwnersForRecovery,
18
+ removeWorktreeProvisioningOwner,
19
+ recordWorktreeProvisioningOwner,
20
+ WORKTREE_PROVISIONING_OWNER_LEASE_MS,
21
+ WORKTREE_LIFECYCLE_LOCK_FILE
22
+ };
@@ -5,13 +5,12 @@
5
5
  * the resulting event mis-attributed the action. Callers now pass an
6
6
  * explicit actor so events.jsonl can distinguish the legitimate paths
7
7
  * ('user' from chat slash command, 'cli' from a real terminal) from any
8
- * unidentified caller ('unknown'). The Bash guardrail
9
- * (`src/hooks/guardrails.ts` section 23) blocks the agent-shell bypass at
10
- * the runtime layer; this parameter exists for forensic clarity.
8
+ * unidentified caller ('unknown').
11
9
  */
12
10
  export type SpecDriftAcknowledgedBy = 'user' | 'cli' | 'unknown';
13
11
  /**
14
- * Handle /swarm acknowledge-spec-drift command
15
- * Acknowledges and clears a previously detected spec drift staleness warning
12
+ * Handle /swarm acknowledge-spec-drift command.
13
+ * Acknowledges a previously detected spec-drift marker after reconciling
14
+ * plan hash, snapshot, and audit state in a retry-safe order.
16
15
  */
17
16
  export declare function handleAcknowledgeSpecDriftCommand(directory: string, _args: string[], acknowledgedBy?: SpecDriftAcknowledgedBy): Promise<string>;
@@ -228,8 +228,8 @@ export declare const RetrospectiveEvidenceSchema: z.ZodObject<{
228
228
  }>;
229
229
  scope: z.ZodEnum<{
230
230
  global: "global";
231
- session: "session";
232
231
  project: "project";
232
+ session: "session";
233
233
  }>;
234
234
  }, z.core.$strip>>>;
235
235
  approaches_tried: z.ZodDefault<z.ZodArray<z.ZodObject<{
@@ -751,8 +751,8 @@ export declare const EvidenceSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
751
751
  }>;
752
752
  scope: z.ZodEnum<{
753
753
  global: "global";
754
- session: "session";
755
754
  project: "project";
755
+ session: "session";
756
756
  }>;
757
757
  }, z.core.$strip>>>;
758
758
  approaches_tried: z.ZodDefault<z.ZodArray<z.ZodObject<{
@@ -1241,8 +1241,8 @@ export declare const EvidenceBundleSchema: z.ZodObject<{
1241
1241
  }>;
1242
1242
  scope: z.ZodEnum<{
1243
1243
  global: "global";
1244
- session: "session";
1245
1244
  project: "project";
1245
+ session: "session";
1246
1246
  }>;
1247
1247
  }, z.core.$strip>>>;
1248
1248
  approaches_tried: z.ZodDefault<z.ZodArray<z.ZodObject<{
@@ -17,8 +17,8 @@ import { loadPluginConfigWithMeta } from './loader';
17
17
  export declare const _internals: {
18
18
  loadPluginConfigWithMeta: typeof loadPluginConfigWithMeta;
19
19
  };
20
- export type { MigrationStatus, Phase, PhaseStatus, Plan, Task, TaskSize, TaskStatus, } from './plan-schema';
21
- export { MigrationStatusSchema, PhaseSchema, PhaseStatusSchema, PlanSchema, TaskSchema, TaskSizeSchema, TaskStatusSchema, } from './plan-schema';
20
+ export type { ExecutionProfile, MigrationStatus, Phase, PhaseStatus, Plan, Task, TaskSize, TaskStatus, } from './plan-schema';
21
+ export { ExecutionProfileSchema, MigrationStatusSchema, PhaseSchema, PhaseStatusSchema, PlanSchema, TaskSchema, TaskSizeSchema, TaskStatusSchema, } from './plan-schema';
22
22
  export type { AgentOverrideConfig, ApplyPatchConfig, AutomationCapabilities, AutomationConfig, AutomationMode, AutoReviewBurnInDecision, AutoReviewConfig, AutoReviewReleaseContext, LeanTurboConfig, MemoryConfig, ModelPricingConfig, PhaseCompleteConfig, PipelineConfig, PluginConfig, PricingConfig, RepoGraphConfig, SkillPropagationConfig, SwarmConfig, TurboConfig, WorktreeIsolationConfig, } from './schema';
23
23
  export { AgentOverrideConfigSchema, ApplyPatchConfigSchema, AUTO_REVIEW_V8_BURN_IN_DECISION, AutomationCapabilitiesSchema, AutomationConfigSchema, AutomationModeSchema, AutoReviewConfigSchema, LeanTurboConfigSchema, MemoryConfigSchema, ModelPricingConfigSchema, PhaseCompleteConfigSchema, PipelineConfigSchema, PluginConfigSchema, PricingConfigSchema, RepoGraphConfigSchema, resolveAutoReviewConfig, SkillPropagationConfigSchema, SwarmConfigSchema, TurboConfigSchema, WorktreeIsolationConfigSchema, } from './schema';
24
24
  export type { DeltaSpec, Obligation, SpecDelta, SpecRequirement, SpecScenario, SpecSection, SwarmSpec, } from './spec-schema';
@@ -6,6 +6,10 @@ export declare const ExecutionProfileSchema: z.ZodObject<{
6
6
  locked: z.ZodDefault<z.ZodBoolean>;
7
7
  auto_proceed: z.ZodDefault<z.ZodBoolean>;
8
8
  commit_after_each_completed_task: z.ZodDefault<z.ZodBoolean>;
9
+ planning_profile: z.ZodOptional<z.ZodEnum<{
10
+ balanced: "balanced";
11
+ strict: "strict";
12
+ }>>;
9
13
  }, z.core.$strip>;
10
14
  export type ExecutionProfile = z.infer<typeof ExecutionProfileSchema>;
11
15
  export declare const TaskStatusSchema: z.ZodEnum<{
@@ -173,6 +177,10 @@ export declare const PlanSchema: z.ZodObject<{
173
177
  locked: z.ZodDefault<z.ZodBoolean>;
174
178
  auto_proceed: z.ZodDefault<z.ZodBoolean>;
175
179
  commit_after_each_completed_task: z.ZodDefault<z.ZodBoolean>;
180
+ planning_profile: z.ZodOptional<z.ZodEnum<{
181
+ balanced: "balanced";
182
+ strict: "strict";
183
+ }>>;
176
184
  }, z.core.$strip>>;
177
185
  }, z.core.$strip>;
178
186
  export type Plan = z.infer<typeof PlanSchema>;
@@ -359,8 +359,8 @@ export declare const PhaseCompleteConfigSchema: z.ZodObject<{
359
359
  enabled: z.ZodDefault<z.ZodBoolean>;
360
360
  required_agents: z.ZodDefault<z.ZodArray<z.ZodEnum<{
361
361
  reviewer: "reviewer";
362
- test_engineer: "test_engineer";
363
362
  coder: "coder";
363
+ test_engineer: "test_engineer";
364
364
  }>>>;
365
365
  require_docs: z.ZodDefault<z.ZodBoolean>;
366
366
  policy: z.ZodDefault<z.ZodEnum<{
@@ -1770,8 +1770,8 @@ export declare const PluginConfigSchema: z.ZodObject<{
1770
1770
  enabled: z.ZodDefault<z.ZodBoolean>;
1771
1771
  required_agents: z.ZodDefault<z.ZodArray<z.ZodEnum<{
1772
1772
  reviewer: "reviewer";
1773
- test_engineer: "test_engineer";
1774
1773
  coder: "coder";
1774
+ test_engineer: "test_engineer";
1775
1775
  }>>>;
1776
1776
  require_docs: z.ZodDefault<z.ZodBoolean>;
1777
1777
  policy: z.ZodDefault<z.ZodEnum<{
@@ -24,5 +24,5 @@ import type { CouncilSynthesis } from './types';
24
24
  export declare const _internals: {
25
25
  withTaskEvidenceLock: typeof withTaskEvidenceLock;
26
26
  };
27
- export declare function writeCouncilEvidence(workingDir: string, synthesis: CouncilSynthesis, attemptId?: string): Promise<void>;
27
+ export declare function writeCouncilEvidence(workingDir: string, synthesis: CouncilSynthesis, attemptId?: string, expectedGeneration?: number): Promise<void>;
28
28
  export declare function hasCouncilEvidenceAttempt(workingDir: string, taskId: string, attemptId: string, roundNumber: number): boolean;
@@ -15,11 +15,30 @@
15
15
  * authorization against a process with arbitrary same-user workspace access;
16
16
  * that requires a protected trust root outside the project workspace.
17
17
  */
18
+ import type { TaskWorkflowState } from './state';
18
19
  export interface GateEvidence {
19
20
  sessionId: string;
20
21
  timestamp: string;
21
22
  agent: string;
22
23
  }
24
+ export declare const TASK_WORKFLOW_SCHEMA_MARKER: "exact-task-v1";
25
+ declare const TASK_WORKFLOW_OUTCOMES: readonly ["none", "dispatch_attempted", "dispatch_no_mutation", "accepted_mutation", "accepted_mutation_failed", "stage_a_passed", "stage_a_failed", "stage_b_completed", "stage_b_failed", "gate_recorded", "task_completed", "task_blocked", "repair_idle"];
26
+ export type TaskWorkflowTransitionOutcome = (typeof TASK_WORKFLOW_OUTCOMES)[number];
27
+ export interface TaskWorkflowMetadata {
28
+ schema: typeof TASK_WORKFLOW_SCHEMA_MARKER;
29
+ generation: number;
30
+ state: TaskWorkflowState;
31
+ retryCount: number;
32
+ retryHistory: TaskWorkflowTransitionOutcome[];
33
+ /** Stable circuit-breaker cycle across accepted repair mutations. */
34
+ retryEpoch: number;
35
+ lastOutcome: TaskWorkflowTransitionOutcome;
36
+ lastTransitionId: string | null;
37
+ updatedAt: string;
38
+ }
39
+ export interface TaskWorkflowSnapshot extends TaskWorkflowMetadata {
40
+ authoritative: boolean;
41
+ }
23
42
  export interface TaskEvidence {
24
43
  taskId: string;
25
44
  required_gates: string[];
@@ -27,11 +46,90 @@ export interface TaskEvidence {
27
46
  turbo?: boolean;
28
47
  /** Durable proof that the coder dispatch was classified as exact Markdown-only. */
29
48
  test_engineer_exempt?: boolean;
49
+ /** Exact-task workflow metadata. Missing on legacy evidence written before #2098. */
50
+ workflow?: TaskWorkflowMetadata;
51
+ }
52
+ /**
53
+ * Fence ordinary evidence writers while a terminal or repair plan/evidence
54
+ * transaction is PREPARED. Only the owning WAL transition may proceed.
55
+ */
56
+ export declare function assertTaskEvidenceWriteAllowed(directory: string, taskId: string, event?: TaskWorkflowTransitionEvent): void;
57
+ export type TaskWorkflowTransitionEvent = {
58
+ type: 'dispatch_attempted';
59
+ agentType?: string;
60
+ context?: GateDerivationContext;
61
+ turbo?: boolean;
62
+ expectedGeneration: number;
63
+ transitionId?: string;
64
+ } | {
65
+ type: 'dispatch_no_mutation';
66
+ agentType?: string;
67
+ context?: GateDerivationContext;
68
+ turbo?: boolean;
69
+ expectedGeneration: number;
70
+ transitionId?: string;
71
+ } | {
72
+ type: 'accepted_mutation';
73
+ agentType?: string;
74
+ context?: GateDerivationContext;
75
+ turbo?: boolean;
76
+ expectedGeneration: number;
77
+ transitionId?: string;
78
+ } | {
79
+ type: 'stage_a_passed';
80
+ expectedGeneration: number;
81
+ transitionId?: string;
82
+ } | {
83
+ type: 'stage_a_failed';
84
+ expectedGeneration: number;
85
+ transitionId?: string;
86
+ } | {
87
+ type: 'stage_b_completed';
88
+ gate: 'reviewer' | 'test_engineer';
89
+ sessionId: string;
90
+ turbo?: boolean;
91
+ ensureDefaultStageB?: boolean;
92
+ expectedGeneration: number;
93
+ transitionId?: string;
94
+ } | {
95
+ type: 'stage_b_failed';
96
+ gate: 'reviewer' | 'test_engineer';
97
+ expectedGeneration: number;
98
+ transitionId?: string;
99
+ } | {
100
+ type: 'gate_recorded';
101
+ gate: string;
102
+ sessionId: string;
103
+ turbo?: boolean;
104
+ expectedGeneration?: number;
105
+ transitionId?: string;
106
+ } | {
107
+ type: 'task_completed';
108
+ /** Locked plan phase explicitly declares that reviewer QA is not required. */
109
+ qaExempt?: boolean;
110
+ expectedGeneration: number;
111
+ transitionId?: string;
112
+ } | {
113
+ type: 'task_blocked';
114
+ expectedGeneration: number;
115
+ transitionId?: string;
116
+ } | {
117
+ type: 'repair_idle';
118
+ expectedGeneration: number;
119
+ transitionId?: string;
120
+ };
121
+ export interface TaskEvidenceTransaction {
122
+ taskId: string;
123
+ read(): TaskEvidence | null;
124
+ transition(event: TaskWorkflowTransitionEvent): Promise<TaskEvidence>;
30
125
  }
126
+ export declare function parseTaskEvidence(raw: string, expectedTaskId: string): TaskEvidence;
31
127
  export declare const DEFAULT_REQUIRED_GATES: string[];
32
128
  export interface GateDerivationContext {
33
129
  /** Trusted pre/post workspace classification; false/absent fails closed. */
34
130
  testEngineerExempt?: boolean;
131
+ /** The shared-root coder changed files but returned a failed/cancelled result. */
132
+ settlementFailed?: boolean;
35
133
  }
36
134
  /**
37
135
  * Canonical task-id validation helper.
@@ -39,6 +137,12 @@ export interface GateDerivationContext {
39
137
  * Re-exported for backward compatibility with existing callers.
40
138
  */
41
139
  export declare function isValidTaskId(taskId: string): boolean;
140
+ export declare function getTaskWorkflowSnapshot(evidence: TaskEvidence | null | undefined): TaskWorkflowSnapshot;
141
+ export declare function reduceTaskWorkflowSnapshot(current: TaskWorkflowSnapshot, event: TaskWorkflowTransitionEvent, context: {
142
+ requiredGates: string[];
143
+ gates: Record<string, GateEvidence>;
144
+ nowIso: string;
145
+ }): TaskWorkflowMetadata;
42
146
  /**
43
147
  * Maps the first-dispatched agent type to the initial required_gates array.
44
148
  * Unknown agent types fall back to the safe default ["reviewer", "test_engineer"].
@@ -49,17 +153,24 @@ export declare function deriveRequiredGates(agentType: string, context?: GateDer
49
153
  * Sorted, deduplicated. Gates can only grow, never shrink.
50
154
  */
51
155
  export declare function expandRequiredGates(existingGates: string[], newAgentType: string, context?: GateDerivationContext): string[];
156
+ export declare function transitionTaskWorkflowEvidence(directory: string, taskId: string, event: TaskWorkflowTransitionEvent): Promise<TaskEvidence>;
157
+ export declare function withTaskEvidenceTransaction<T>(directory: string, taskId: string, agent: string, callback: (transaction: TaskEvidenceTransaction) => Promise<T>): Promise<T>;
52
158
  /**
53
159
  * Creates or updates .swarm/evidence/{taskId}.json with a gate pass entry.
54
160
  * If file doesn't exist: creates with required_gates from deriveRequiredGates(gate).
55
161
  * If file exists: merges gate entry, expands required_gates via expandRequiredGates.
56
162
  * Atomic write: temp file + rename.
57
163
  */
58
- export declare function recordGateEvidence(directory: string, taskId: string, gate: string, sessionId: string, turbo?: boolean): Promise<void>;
164
+ export declare function recordGateEvidence(directory: string, taskId: string, gate: string, sessionId: string, turbo?: boolean, options?: {
165
+ expectedGeneration?: number;
166
+ transitionId?: string;
167
+ ensureDefaultStageB?: boolean;
168
+ }): Promise<void>;
59
169
  /**
60
- * Sets or expands required_gates WITHOUT recording a gate pass.
61
- * Used when non-gate agents are dispatched (coder, explorer, sme, etc.).
62
- * Creates evidence file if it doesn't exist yet.
170
+ * Compatibility API for a settled non-gate dispatch. Coder callers represent
171
+ * an accepted mutation and therefore rotate the workflow generation; mere
172
+ * attempts must call `transitionTaskWorkflowEvidence(dispatch_attempted)` and
173
+ * failed/no-op settlements must use `dispatch_no_mutation` instead.
63
174
  */
64
175
  export declare function recordAgentDispatch(directory: string, taskId: string, agentType: string, turbo?: boolean, context?: GateDerivationContext): Promise<void>;
65
176
  /**
@@ -78,3 +189,5 @@ export declare function readTaskEvidenceRaw(directory: string, taskId: string):
78
189
  * Returns false if no evidence file exists.
79
190
  */
80
191
  export declare function hasPassedAllGates(directory: string, taskId: string): Promise<boolean>;
192
+ export declare function compareTaskWorkflowStateRank(left: TaskWorkflowState, right: TaskWorkflowState): number;
193
+ export {};
@@ -6,6 +6,8 @@
6
6
  */
7
7
  import type { BackgroundDelegationRecord } from '../background/pending-delegations.js';
8
8
  import type { PluginConfig } from '../config';
9
+ import type { Plan } from '../config/plan-schema';
10
+ import { type QaGates } from '../db/qa-gate-profile.js';
9
11
  import { loadPlanJsonOnly } from '../plan/manager';
10
12
  import type { AgentSessionState } from '../state';
11
13
  import type { DelegationEnvelope, EnvelopeValidationResult } from '../types/delegation.js';
@@ -282,6 +284,18 @@ declare function extractPlanCriticVerdict(output: unknown): 'APPROVED' | 'NEEDS_
282
284
  * approval. Does not throw — returns `false` for any failure (fail-closed).
283
285
  */
284
286
  export declare function isPlanCriticApproved(directory: string): Promise<boolean>;
287
+ /**
288
+ * Resolve the effective critic-pre-plan policy for coder execution.
289
+ *
290
+ * Missing or unreadable profiles preserve the historical default (`true`). A
291
+ * persisted `false` is honored, while session overrides can only ratchet it
292
+ * back to `true` through `getEffectiveGates`.
293
+ */
294
+ export interface PlanCriticPolicyDecision {
295
+ required: boolean;
296
+ source: 'persisted_profile' | 'session_ratchet' | 'default_missing_profile' | 'corrupt_profile_conservative';
297
+ }
298
+ export declare function resolvePlanCriticPolicyForExecution(directory: string, plan: Plan, sessionOverrides?: Partial<QaGates>): PlanCriticPolicyDecision;
285
299
  /**
286
300
  * Escape hatch for the ratchet-tighter `critic_pre_plan` gate (issue #2012).
287
301
  *
@@ -348,6 +362,13 @@ declare function describeCoderScopeFailure(args: Record<string, unknown>, planTa
348
362
  * @returns Map of taskId -> verdict string
349
363
  */
350
364
  export declare function parsePerTaskVerdicts(outputText: string): Map<string, string>;
365
+ export declare function canRunWhileTaskAwaitsCompletion(input: {
366
+ directory: string | undefined;
367
+ normalizedTool: string;
368
+ args: Record<string, unknown>;
369
+ awaitingTaskId: string;
370
+ requestedTaskId: string | null;
371
+ }): boolean;
351
372
  declare function buildParallelExecutionGuidance(directory: string | undefined, sessionID: string, session: AgentSessionState): Promise<string | null>;
352
373
  /**
353
374
  * Resolves the correct task ID for evidence recording by chaining:
@@ -555,6 +555,8 @@ export declare const _test_exports: {
555
555
  extractCandidateIds: typeof extractCandidateIds;
556
556
  parseCanonicalCandidateRows: typeof parseCanonicalCandidateRows;
557
557
  resolvePrReviewRowFamily: typeof resolvePrReviewRowFamily;
558
+ pipeFieldsCapped: typeof pipeFieldsCapped;
559
+ reviewerVerdictRowDigest: typeof reviewerVerdictRowDigest;
558
560
  workflowGateStateRelativePath: typeof workflowGateStateRelativePath;
559
561
  workflowGateStateLockRelativePath: typeof workflowGateStateLockRelativePath;
560
562
  workflowCheckoutMutationLockRelativePath: typeof workflowCheckoutMutationLockRelativePath;
@@ -843,10 +845,28 @@ declare function analyzePrReviewBatchRecordIntegrity(args: {
843
845
  export declare function validatePrReviewDiscoveryLaneCompletion(input: PrReviewDiscoveryLaneValidationInput): PrReviewLaneValidationResult;
844
846
  /** Require at least one semantically valid discovery row or CLEAN attestation. */
845
847
  export declare function prReviewDiscoveryArtifactCoversLane(text: string, expectedWorkflowLane: string, ownedWorkflowLanes?: readonly string[], mode?: string): boolean;
848
+ /**
849
+ * Digest of the FULL canonical reviewer row, not the classification/severity
850
+ * pair a reviewer verdict projects to. Only 2 of the 10 required fields survive
851
+ * that projection, so a tuple binding would still match a row whose evidence,
852
+ * file:line and root cause all changed. Fields are joined on NUL, which
853
+ * `pipeFields` can never produce, so no field boundary is forgeable.
854
+ */
855
+ declare function reviewerVerdictRowDigest(fields: readonly string[]): string;
846
856
  declare function parseCriticVerdict(text: string, itemId: string, reviewerSeverity?: string): {
847
857
  status: string;
848
858
  severity: string;
849
859
  } | null;
860
+ /**
861
+ * `pipeFields` capped at the row's canonical field count: separators beyond the
862
+ * expected count merge back into the trailing (free-text) field. Verdict rows
863
+ * ([REVIEWED], [CRITIC], [FEEDBACK-VERIFIED]) carry prose evidence in their
864
+ * last field, and prose containing literal pipes (regex text, `,;|`, shell
865
+ * snippets) otherwise splits the row past its strict field-count check and the
866
+ * whole verdict becomes unparseable. Deterministic: the enumerated leading
867
+ * fields are never merged.
868
+ */
869
+ declare function pipeFieldsCapped(line: string, expectedFieldCount: number): string[];
850
870
  declare function workflowCheckoutMutationLockRelativePath(): string;
851
871
  declare function openCheckoutLockFile(lockPath: string): Promise<fsp.FileHandle>;
852
872
  declare function removeCheckoutLockFile(lockPath: string): Promise<void>;