opencode-swarm 7.164.0 → 7.164.2

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 (103) hide show
  1. package/.opencode/skills/codebase-review-swarm/SKILL.md +4 -0
  2. package/.opencode/skills/commit-pr/SKILL.md +4 -1
  3. package/.opencode/skills/critic-gate/SKILL.md +4 -0
  4. package/.opencode/skills/deep-dive/SKILL.md +4 -0
  5. package/.opencode/skills/engineering-conventions/SKILL.md +2 -0
  6. package/.opencode/skills/execute/SKILL.md +4 -0
  7. package/.opencode/skills/phase-wrap/SKILL.md +4 -0
  8. package/.opencode/skills/plan/SKILL.md +4 -0
  9. package/.opencode/skills/running-tests/SKILL.md +4 -0
  10. package/.opencode/skills/swarm-pr-review/SKILL.md +4 -0
  11. package/.opencode/skills/swarm-pr-review/references/prompt-templates.md +2 -0
  12. package/.opencode/skills/writing-tests/SKILL.md +4 -0
  13. package/dist/agents/critic.d.ts +6 -6
  14. package/dist/cli/{coder-settlement-84je6bza.js → coder-settlement-kv1x94w6.js} +12 -13
  15. package/dist/cli/{config-doctor-vfze38e1.js → config-doctor-8d7ydxck.js} +3 -3
  16. package/dist/cli/{core-q5hv8e2w.js → core-7jjgxczp.js} +2 -2
  17. package/dist/cli/{curation-policy-a2zty4br.js → curation-policy-7pnmnfct.js} +6 -7
  18. package/dist/cli/{curator-4pckmmyf.js → curator-5nyth2rj.js} +35 -38
  19. package/dist/cli/{curator-drift-wy7ejcvw.js → curator-drift-ykrdf08r.js} +4 -5
  20. package/dist/cli/curator-llm-factory-d415s169.js +66 -0
  21. package/dist/cli/{evidence-summary-service-b15yes21.js → evidence-summary-service-aebn7nb9.js} +16 -17
  22. package/dist/cli/{gate-evidence-70h0w4tb.js → gate-evidence-es59pysy.js} +8 -9
  23. package/dist/cli/guardrail-explain-mn2x7w2y.js +67 -0
  24. package/dist/cli/{guardrail-log-7rxbd20p.js → guardrail-log-fd3c5rks.js} +8 -9
  25. package/dist/cli/{guardrail-reset-3b4gs357.js → guardrail-reset-r49rvptv.js} +35 -38
  26. package/dist/cli/{hive-promoter-s80g1gwb.js → hive-promoter-qp2kjhhp.js} +35 -38
  27. package/dist/cli/{index-93sepnc9.js → index-0145kpjr.js} +2 -2
  28. package/dist/cli/{index-v3a9rmyh.js → index-1r6p1wpa.js} +4 -4
  29. package/dist/cli/{index-c4pynht5.js → index-2xj34nkh.js} +1 -1
  30. package/dist/cli/{index-g64154pd.js → index-34exj2e3.js} +2 -2
  31. package/dist/cli/{index-td6n935w.js → index-3704v4e6.js} +2 -2
  32. package/dist/cli/{index-ynqp3jb6.js → index-5d7bzpfn.js} +1 -1
  33. package/dist/cli/{index-hyq20s2v.js → index-6vtm4rd0.js} +12 -12
  34. package/dist/cli/{index-4afh2cz7.js → index-92q98ry8.js} +7 -7
  35. package/dist/cli/{index-wdtckfnf.js → index-ac39znep.js} +2 -2
  36. package/dist/cli/{index-4jersar8.js → index-axtnc0xf.js} +5 -5
  37. package/dist/cli/{index-e3hwzcjv.js → index-b85jnfp4.js} +2 -2
  38. package/dist/cli/{index-bm73pych.js → index-br7q79t2.js} +7 -7
  39. package/dist/cli/{index-1b1h770t.js → index-bzd67m2j.js} +3 -3
  40. package/dist/cli/{index-ma8w6pfp.js → index-c8k4cs94.js} +5 -5
  41. package/dist/cli/{index-t90gjc0k.js → index-cm4r8gh2.js} +1 -1
  42. package/dist/cli/{index-3b762978.js → index-f9nfknjg.js} +182 -37
  43. package/dist/cli/{index-t9rhtvy9.js → index-fyt5byhd.js} +3 -3
  44. package/dist/cli/{index-zbpcpsk0.js → index-gz5rn6w6.js} +9 -9
  45. package/dist/cli/{index-7r9vpkwa.js → index-h9wnkr2e.js} +5 -5
  46. package/dist/cli/{index-1hpjwz3s.js → index-hcn69kp0.js} +1 -1
  47. package/dist/cli/{index-12f1tsn2.js → index-hnwg5gt6.js} +655 -16
  48. package/dist/cli/{index-qkk2skff.js → index-jw9wbwdh.js} +37 -40
  49. package/dist/cli/{index-pvgcex0d.js → index-kwd09y5a.js} +4 -4
  50. package/dist/cli/{index-9xd073d4.js → index-m1nrd3yd.js} +9 -2
  51. package/dist/cli/{index-c69jbpex.js → index-pcnhh2vt.js} +2 -2
  52. package/dist/cli/{index-gxd8fwyt.js → index-q3xn3m3g.js} +4 -4
  53. package/dist/cli/{index-fckfgptr.js → index-qbr05tbw.js} +2 -2
  54. package/dist/cli/{index-9sy65e94.js → index-qmeewt3g.js} +32 -34
  55. package/dist/cli/{index-tb1k8jya.js → index-sb4eanpv.js} +1 -1
  56. package/dist/cli/{index-dtn0pne5.js → index-v56mhyhs.js} +1 -1
  57. package/dist/cli/{index-2s4s9n82.js → index-w5jpjaqe.js} +2 -2
  58. package/dist/cli/{index-1z4jzwja.js → index-w8qt2612.js} +3 -3
  59. package/dist/cli/{index-nhxaa9j5.js → index-xm6c1tnf.js} +1 -1
  60. package/dist/cli/{index-0515j0cz.js → index-y2f5s2cf.js} +1 -1
  61. package/dist/cli/{index-36nt17m8.js → index-yep24wn4.js} +1 -1
  62. package/dist/cli/{index-xk0kc1py.js → index-yjftcanv.js} +7767 -2575
  63. package/dist/cli/{index-t5t82jy8.js → index-yqhwrjw9.js} +5 -5
  64. package/dist/cli/{index-nzrhw31r.js → index-zgeqwbhw.js} +2 -2
  65. package/dist/cli/{index-70bfj3v1.js → index-zs1jrsta.js} +2 -2
  66. package/dist/cli/index.js +35 -38
  67. package/dist/cli/{knowledge-escalator-sttdnwf8.js → knowledge-escalator-439jajb3.js} +14 -15
  68. package/dist/cli/{knowledge-events-4h88stj7.js → knowledge-events-wz3h98kk.js} +12 -13
  69. package/dist/cli/{knowledge-link-yykmxdyw.js → knowledge-link-2gh1cnk3.js} +5 -6
  70. package/dist/cli/{knowledge-store-j832fxpx.js → knowledge-store-y1cwe80n.js} +6 -7
  71. package/dist/cli/{knowledge-validator-edbg761g.js → knowledge-validator-bk2qfqe2.js} +8 -9
  72. package/dist/cli/{model-preflight-c3mc8njg.js → model-preflight-pmnbfzjv.js} +1 -1
  73. package/dist/cli/{pending-delegations-sphntrs0.js → pending-delegations-kh4mkvzb.js} +6 -8
  74. package/dist/cli/{pr-subscriptions-1a4gcnzv.js → pr-subscriptions-sdv0n59c.js} +6 -7
  75. package/dist/cli/pr-workflow-gate-a9vj11e5.js +221 -0
  76. package/dist/cli/{runner-d294h1by.js → runner-m95v9d47.js} +6 -7
  77. package/dist/cli/{scan-cursor-5frvp7nb.js → scan-cursor-pjek24k7.js} +7 -8
  78. package/dist/cli/{schema-9xkt5hvd.js → schema-674qw3aj.js} +2 -2
  79. package/dist/cli/{scope-persistence-gk55h3sp.js → scope-persistence-sq331eqh.js} +10 -11
  80. package/dist/cli/{skill-generator-sxxf7jbb.js → skill-generator-pcw7c50r.js} +16 -17
  81. package/dist/cli/{telemetry-q51s6tyt.js → telemetry-c4j18da8.js} +1 -1
  82. package/dist/cli/{worktree-collision-ownership-7kj2ryt1.js → worktree-collision-ownership-vnj31rgc.js} +7 -9
  83. package/dist/cli/{worktree-isolation-67fs6rz9.js → worktree-isolation-tje6p4zt.js} +35 -38
  84. package/dist/hooks/delegate-ack-collector.d.ts +5 -0
  85. package/dist/hooks/delegation-gate.d.ts +14 -2
  86. package/dist/hooks/plan-task-id-context.d.ts +24 -0
  87. package/dist/hooks/pr-workflow-gate.d.ts +14 -8
  88. package/dist/hooks/pr-workflow-response-gate.d.ts +9 -12
  89. package/dist/hooks/skill-injection.d.ts +7 -3
  90. package/dist/hooks/skill-propagation-gate.d.ts +1 -1
  91. package/dist/hooks/task-id-resolver.d.ts +46 -0
  92. package/dist/index.js +118 -92
  93. package/dist/pr-review/authorization.d.ts +18 -12
  94. package/dist/tools/authorize-pr-review-reentry.d.ts +12 -8
  95. package/dist/tools/tool-metadata.d.ts +1 -1
  96. package/opencode-swarm.schema.json +4 -1
  97. package/package.json +1 -1
  98. package/dist/cli/authorization-vstrh7ra.js +0 -23
  99. package/dist/cli/curator-llm-factory-msbj3hpn.js +0 -69
  100. package/dist/cli/guardrail-explain-kksdy032.js +0 -70
  101. package/dist/cli/index-ed5ykebp.js +0 -151
  102. package/dist/cli/index-mmngnxev.js +0 -883
  103. package/dist/cli/index-w7ekntej.js +0 -643
@@ -102,8 +102,8 @@ import {
102
102
  resolveGeneratedAgentRole,
103
103
  resolveGuardrailsConfig,
104
104
  stripKnownSwarmPrefix
105
- } from "./index-td6n935w.js";
106
- import"./index-9xd073d4.js";
105
+ } from "./index-3704v4e6.js";
106
+ import"./index-m1nrd3yd.js";
107
107
  import"./index-zjygnfay.js";
108
108
  import"./index-bk5tah7q.js";
109
109
  import"./index-bpmtbmy9.js";
@@ -23,22 +23,21 @@ import {
23
23
  tombstoneScopeBinding,
24
24
  writeScopeBindingToDisk,
25
25
  writeScopeToDisk
26
- } from "./index-4jersar8.js";
27
- import"./index-1z4jzwja.js";
28
- import"./index-93sepnc9.js";
26
+ } from "./index-axtnc0xf.js";
27
+ import"./index-w8qt2612.js";
28
+ import"./index-0145kpjr.js";
29
29
  import"./index-556ja8an.js";
30
- import"./index-nhxaa9j5.js";
31
- import"./index-td6n935w.js";
30
+ import"./index-xm6c1tnf.js";
31
+ import"./index-3704v4e6.js";
32
32
  import"./index-9e6fdz2h.js";
33
33
  import"./index-4rhhvd1a.js";
34
- import"./index-wdtckfnf.js";
35
- import"./index-9xd073d4.js";
34
+ import"./index-ac39znep.js";
35
+ import"./index-m1nrd3yd.js";
36
36
  import"./index-zjygnfay.js";
37
37
  import"./index-bk5tah7q.js";
38
- import"./index-36nt17m8.js";
39
- import"./index-3b762978.js";
40
- import"./index-1b1h770t.js";
41
- import"./index-ed5ykebp.js";
38
+ import"./index-yep24wn4.js";
39
+ import"./index-f9nfknjg.js";
40
+ import"./index-bzd67m2j.js";
42
41
  import"./index-7g4c7s5r.js";
43
42
  import"./index-bpmtbmy9.js";
44
43
  import"./index-zgwm4ryv.js";
@@ -33,34 +33,33 @@ import {
33
33
  sanitizeSlug,
34
34
  selectCandidateEntries,
35
35
  writeEvalStub
36
- } from "./index-pvgcex0d.js";
37
- import"./index-gxd8fwyt.js";
38
- import"./index-tb1k8jya.js";
36
+ } from "./index-kwd09y5a.js";
37
+ import"./index-q3xn3m3g.js";
38
+ import"./index-sb4eanpv.js";
39
39
  import"./index-rtry5xyf.js";
40
40
  import"./index-q7sjgr1y.js";
41
- import"./index-bm73pych.js";
42
- import"./index-zbpcpsk0.js";
43
- import"./index-t9rhtvy9.js";
41
+ import"./index-br7q79t2.js";
42
+ import"./index-gz5rn6w6.js";
43
+ import"./index-fyt5byhd.js";
44
44
  import"./index-zg9d392c.js";
45
45
  import"./index-n832052r.js";
46
- import"./index-dtn0pne5.js";
46
+ import"./index-v56mhyhs.js";
47
47
  import"./index-z6xqpmqg.js";
48
48
  import"./index-r3mvsbtq.js";
49
- import"./index-nhxaa9j5.js";
50
- import"./index-td6n935w.js";
49
+ import"./index-xm6c1tnf.js";
50
+ import"./index-3704v4e6.js";
51
51
  import"./index-9e6fdz2h.js";
52
52
  import"./index-4rhhvd1a.js";
53
- import"./index-wdtckfnf.js";
54
- import"./index-9xd073d4.js";
53
+ import"./index-ac39znep.js";
54
+ import"./index-m1nrd3yd.js";
55
55
  import"./index-zjygnfay.js";
56
56
  import"./index-ae75rja9.js";
57
- import"./index-ynqp3jb6.js";
58
- import"./index-70bfj3v1.js";
57
+ import"./index-5d7bzpfn.js";
58
+ import"./index-zs1jrsta.js";
59
59
  import"./index-bk5tah7q.js";
60
- import"./index-36nt17m8.js";
61
- import"./index-3b762978.js";
62
- import"./index-1b1h770t.js";
63
- import"./index-ed5ykebp.js";
60
+ import"./index-yep24wn4.js";
61
+ import"./index-f9nfknjg.js";
62
+ import"./index-bzd67m2j.js";
64
63
  import"./index-7g4c7s5r.js";
65
64
  import"./index-bpmtbmy9.js";
66
65
  import"./index-zgwm4ryv.js";
@@ -14,7 +14,7 @@ import {
14
14
  startHeartbeatTracking,
15
15
  stopHeartbeatTracking,
16
16
  telemetry
17
- } from "./index-1b1h770t.js";
17
+ } from "./index-bzd67m2j.js";
18
18
  import"./index-bpmtbmy9.js";
19
19
  import"./index-a76rekgs.js";
20
20
  export {
@@ -6,14 +6,13 @@ import {
6
6
  WORKTREE_PROVISIONING_OWNER_LEASE_MS,
7
7
  removeWorktreeProvisioningOwner,
8
8
  scanWorktreeProvisioningOwnersForRecovery
9
- } from "./index-fckfgptr.js";
9
+ } from "./index-qbr05tbw.js";
10
10
  import {
11
11
  scanDelegationFallbacksForRecovery,
12
12
  scanDelegationsForRecovery
13
- } from "./index-12f1tsn2.js";
13
+ } from "./index-hnwg5gt6.js";
14
14
  import"./index-ddszzne4.js";
15
- import"./index-w7ekntej.js";
16
- import"./index-dtn0pne5.js";
15
+ import"./index-v56mhyhs.js";
17
16
  import"./index-z6xqpmqg.js";
18
17
  import {
19
18
  bunSpawn
@@ -23,12 +22,11 @@ import {
23
22
  resolveGitExecutable
24
23
  } from "./index-9e6fdz2h.js";
25
24
  import"./index-4rhhvd1a.js";
26
- import"./index-wdtckfnf.js";
25
+ import"./index-ac39znep.js";
27
26
  import"./index-zjygnfay.js";
28
- import"./index-36nt17m8.js";
29
- import"./index-3b762978.js";
30
- import"./index-1b1h770t.js";
31
- import"./index-ed5ykebp.js";
27
+ import"./index-yep24wn4.js";
28
+ import"./index-f9nfknjg.js";
29
+ import"./index-bzd67m2j.js";
32
30
  import"./index-7g4c7s5r.js";
33
31
  import"./index-bpmtbmy9.js";
34
32
  import"./index-zgwm4ryv.js";
@@ -21,67 +21,64 @@ import {
21
21
  sanitizeWorktreeTaskId,
22
22
  standardWorktreeByCallID,
23
23
  standardWorktreeSerializationSessions
24
- } from "./index-xk0kc1py.js";
25
- import"./index-c4pynht5.js";
26
- import"./index-9sy65e94.js";
27
- import"./index-g64154pd.js";
28
- import"./index-hyq20s2v.js";
29
- import"./index-2s4s9n82.js";
24
+ } from "./index-yjftcanv.js";
25
+ import"./index-2xj34nkh.js";
26
+ import"./index-qmeewt3g.js";
27
+ import"./index-34exj2e3.js";
28
+ import"./index-6vtm4rd0.js";
29
+ import"./index-w5jpjaqe.js";
30
30
  import"./index-txdagbh7.js";
31
31
  import"./index-3146wmgv.js";
32
- import"./index-pvgcex0d.js";
33
- import"./index-t5t82jy8.js";
34
- import"./index-e3hwzcjv.js";
32
+ import"./index-kwd09y5a.js";
33
+ import"./index-yqhwrjw9.js";
34
+ import"./index-b85jnfp4.js";
35
35
  import"./index-70ha9e09.js";
36
- import"./index-0515j0cz.js";
37
- import"./index-1hpjwz3s.js";
36
+ import"./index-y2f5s2cf.js";
37
+ import"./index-hcn69kp0.js";
38
38
  import"./index-zaab1wz9.js";
39
- import"./index-ma8w6pfp.js";
39
+ import"./index-c8k4cs94.js";
40
40
  import"./index-zsrtt42s.js";
41
- import"./index-4afh2cz7.js";
41
+ import"./index-92q98ry8.js";
42
42
  import"./index-3f7hqtgg.js";
43
- import"./index-fckfgptr.js";
44
- import"./index-gxd8fwyt.js";
45
- import"./index-tb1k8jya.js";
43
+ import"./index-qbr05tbw.js";
44
+ import"./index-q3xn3m3g.js";
45
+ import"./index-sb4eanpv.js";
46
46
  import"./index-rtry5xyf.js";
47
- import"./index-7r9vpkwa.js";
48
- import"./index-nzrhw31r.js";
49
- import"./index-12f1tsn2.js";
47
+ import"./index-h9wnkr2e.js";
48
+ import"./index-zgeqwbhw.js";
49
+ import"./index-hnwg5gt6.js";
50
50
  import"./index-ddszzne4.js";
51
- import"./index-mmngnxev.js";
52
- import"./index-w7ekntej.js";
53
- import"./index-4jersar8.js";
54
- import"./index-1z4jzwja.js";
55
- import"./index-93sepnc9.js";
51
+ import"./index-axtnc0xf.js";
52
+ import"./index-w8qt2612.js";
53
+ import"./index-0145kpjr.js";
56
54
  import"./index-556ja8an.js";
57
55
  import"./index-4fwbbad3.js";
58
56
  import"./index-b43rt5ph.js";
59
57
  import"./index-q7sjgr1y.js";
60
- import"./index-bm73pych.js";
61
- import"./index-zbpcpsk0.js";
58
+ import"./index-br7q79t2.js";
59
+ import"./index-gz5rn6w6.js";
62
60
  import {
63
61
  resolveWorktreeIsolationConfig
64
- } from "./index-t9rhtvy9.js";
62
+ } from "./index-fyt5byhd.js";
65
63
  import"./index-zg9d392c.js";
66
64
  import"./index-n832052r.js";
67
- import"./index-dtn0pne5.js";
65
+ import"./index-v56mhyhs.js";
68
66
  import"./index-z6xqpmqg.js";
69
67
  import"./index-r3mvsbtq.js";
70
- import"./index-nhxaa9j5.js";
71
- import"./index-td6n935w.js";
68
+ import"./index-xm6c1tnf.js";
69
+ import"./index-3704v4e6.js";
72
70
  import"./index-9e6fdz2h.js";
73
71
  import"./index-4rhhvd1a.js";
74
- import"./index-wdtckfnf.js";
75
- import"./index-9xd073d4.js";
72
+ import"./index-ac39znep.js";
73
+ import"./index-m1nrd3yd.js";
76
74
  import"./index-zjygnfay.js";
77
75
  import"./index-ae75rja9.js";
78
- import"./index-ynqp3jb6.js";
79
- import"./index-70bfj3v1.js";
76
+ import"./index-5d7bzpfn.js";
77
+ import"./index-zs1jrsta.js";
80
78
  import"./index-bk5tah7q.js";
81
- import"./index-36nt17m8.js";
82
- import"./index-3b762978.js";
83
- import"./index-1b1h770t.js";
84
- import"./index-ed5ykebp.js";
79
+ import"./index-yep24wn4.js";
80
+ import"./index-f9nfknjg.js";
81
+ import"./index-bzd67m2j.js";
85
82
  import"./index-7g4c7s5r.js";
86
83
  import"./index-bpmtbmy9.js";
87
84
  import"./index-zgwm4ryv.js";
@@ -27,6 +27,7 @@
27
27
  * durable `delegate_directive` memberships) and Task collections share ONE
28
28
  * implementation — not a second lifecycle copy.
29
29
  */
30
+ import { type TaskIdResolution } from './task-id-resolver.js';
30
31
  export interface DelegateAckInput {
31
32
  tool: unknown;
32
33
  agent?: unknown;
@@ -36,6 +37,8 @@ export interface DelegateAckInput {
36
37
  export interface DelegateAckOutput {
37
38
  output?: unknown;
38
39
  }
40
+ /** Best-effort extraction of a task id from a delegation prompt envelope. */
41
+ export declare function resolveDelegateAckTaskId(args: Record<string, unknown>, knownPlanTaskIds?: ReadonlySet<string>, planContextOverLimit?: boolean): string | undefined;
39
42
  export interface CollectDelegateAcksResult {
40
43
  emitted: Array<{
41
44
  id: string;
@@ -113,6 +116,8 @@ export declare function collectDelegateAcks(params: {
113
116
  agent: string;
114
117
  sessionId?: string;
115
118
  taskId?: string;
119
+ /** A caller-owned resolution attempt; non-resolved states forbid reparsing. */
120
+ taskIdResolution?: TaskIdResolution;
116
121
  }): Promise<CollectDelegateAcksResult>;
117
122
  export interface CollectLaneDelegateAcksResult extends CollectDelegateAcksResult {
118
123
  /**
@@ -11,6 +11,9 @@ import { type QaGates } from '../db/qa-gate-profile.js';
11
11
  import { loadPlanJsonOnly } from '../plan/manager';
12
12
  import type { AgentSessionState } from '../state';
13
13
  import type { DelegationEnvelope, EnvelopeValidationResult } from '../types/delegation.js';
14
+ import { type PlanTaskIdContext } from './plan-task-id-context.js';
15
+ import { resolveDelegatedPlanTaskId } from './task-id-resolver.js';
16
+ export { resolveDelegatedPlanTaskId } from './task-id-resolver.js';
14
17
  import { resetStandardWorktreeIsolationState } from './delegation-gate/worktree-isolation';
15
18
  export { resetStandardWorktreeIsolationState };
16
19
  import { _internals as _wtiInternals } from './delegation-gate/worktree-isolation';
@@ -351,6 +354,14 @@ interface MessageWithParts {
351
354
  info: MessageInfo;
352
355
  parts: MessagePart[];
353
356
  }
357
+ /**
358
+ * Extracts a plan task ID (N.M or N.M.P format) from text.
359
+ * Checks for:
360
+ * 1. Task IDs in task list format: "- [ ] 1.1: ..." or "- [x] 1.1: ..."
361
+ * 2. Standalone task IDs like "1.1" or "1.2.3" near the TASK: line
362
+ * Returns the plan task ID if found, otherwise null.
363
+ */
364
+ declare function extractPlanTaskId(text: string): string | null;
354
365
  declare function extractPlanCriticVerdict(output: unknown): 'APPROVED' | 'NEEDS_REVISION' | 'REJECTED' | null;
355
366
  /**
356
367
  * Returns whether the plan in the given directory has a valid plan-critic
@@ -407,7 +418,6 @@ export declare function forceRecordPlanCriticApproval(directory: string, session
407
418
  reason?: string;
408
419
  userConfirmed: boolean;
409
420
  }>;
410
- export declare function resolveDelegatedPlanTaskId(args: Record<string, unknown>, knownPlanTaskIds?: ReadonlySet<string>): string | null;
411
421
  /**
412
422
  * Builds a cause-specific diagnostic for `prepareCoderScope`'s SCOPE_NOT_DECLARED
413
423
  * throw when `resolveDelegatedPlanTaskId` returns null. Re-runs extraction with
@@ -418,7 +428,7 @@ export declare function resolveDelegatedPlanTaskId(args: Record<string, unknown>
418
428
  * latency, and does NOT handle plan-task-shaped-but-unknown ids (those are
419
429
  * rejected by the membership gate in prepareCoderScope with their own message).
420
430
  */
421
- declare function describeCoderScopeFailure(args: Record<string, unknown>, planTaskIds: ReadonlySet<string>): string;
431
+ declare function describeCoderScopeFailure(args: Record<string, unknown>, planTaskIdContext: PlanTaskIdContext): string;
422
432
  type FileDirectiveExtractionMode = 'enforce' | 'observe';
423
433
  declare function extractTaskFileDirectives(args: Record<string, unknown>, mode?: FileDirectiveExtractionMode): {
424
434
  present: boolean;
@@ -493,7 +503,9 @@ export declare const _internals: {
493
503
  resetStandardWorktreeIsolationState: typeof resetStandardWorktreeIsolationState;
494
504
  PLAN_CRITIC_TASK_SIGNALS: readonly ["critic-gate", "plan critic", "review plan", "review the plan", "plan.md", "approve the plan", "plan approval", "pre-implementation review", "evaluate this plan", "evaluate the plan", "assess this plan", "assess the plan", "plan soundness", "before implementation", "review the plan below"];
495
505
  extractPlanCriticVerdict: typeof extractPlanCriticVerdict;
506
+ extractPlanTaskId: typeof extractPlanTaskId;
496
507
  forceRecordPlanCriticApproval: typeof forceRecordPlanCriticApproval;
508
+ beforePrFeedbackScopeConsume: (() => Promise<void>) | undefined;
497
509
  provisionWorktree: typeof _wtiInternals.provisionWorktree;
498
510
  removeWorktree: typeof _wtiInternals.removeWorktree;
499
511
  attemptMergeBackFromDirty: typeof _wtiInternals.attemptMergeBackFromDirty;
@@ -0,0 +1,24 @@
1
+ import { type TaskIdPlanContextOptions } from './task-id-resolver.js';
2
+ export type PlanTaskIdContext = {
3
+ status: 'available';
4
+ taskIds: ReadonlySet<string>;
5
+ } | {
6
+ status: 'unavailable';
7
+ } | {
8
+ status: 'over_limit';
9
+ };
10
+ /** Traverse plan phases without first materializing an unbounded flat task list. */
11
+ export declare function collectPlanTaskIdContextFromPhases(phases: ReadonlyArray<{
12
+ tasks?: ReadonlyArray<{
13
+ id?: string;
14
+ } | null> | null;
15
+ } | null | undefined>): PlanTaskIdContext;
16
+ /**
17
+ * Best-effort caller-side plan context for the pure task-ID resolver.
18
+ * Missing/corrupt plans remain distinguishable from valid plans whose task-ID
19
+ * cardinality exceeds the resolver bound. Callers must preserve that distinction
20
+ * so numeric IDs never become unfiltered when a plan is merely too large.
21
+ */
22
+ export declare function loadPlanTaskIdContext(directory: string): Promise<PlanTaskIdContext>;
23
+ /** Convert a typed loader result into the resolver's bounded plan context. */
24
+ export declare function toTaskIdPlanContextOptions(context: PlanTaskIdContext): TaskIdPlanContextOptions;
@@ -8,6 +8,7 @@ import { type PrReviewInlineTriggerRow } from '../background/pr-review-trigger-c
8
8
  import { type RevisionDigestResult, resolveCommitCountSince, resolveCommitCountSinceAsync, resolveCurrentGitHead, resolveCurrentGitHeadAsync, resolveCurrentLocalHeadRefAsync, resolveCurrentUpstreamPushTarget, resolveCurrentUpstreamPushTargetAsync, resolveCurrentUpstreamRemoteRef, resolveExactRemoteBranchHead, resolveExactRemoteBranchHeadAsync, resolveIsExactSingleChildCommit, resolveIsExactSingleChildCommitAsync, resolveIsWorkingTreeClean, resolveIsWorkingTreeCleanAsync, resolvePrReviewDiffStats, resolvePrReviewDiffStatsAsync, resolvePrWorkflowRevisionDigest, resolvePrWorkflowRevisionDigestDetailed, resolveRemoteRefsContainingHead, resolveRemoteRefsContainingHeadAsync, resolveRemoteUrlIdentity, resolveRemoteUrlIdentityAsync } from '../background/workspace-snapshot.js';
9
9
  import { type PrReviewResilienceConfig } from '../config/schema.js';
10
10
  import { classifyPrWorkflowGitState, type PrWorkflowGitState } from '../git/pr-workflow-state.js';
11
+ import { type PrReviewReentryAuthorizationRecord, type PrReviewReentryBindingContext, type PrReviewReentryRole } from '../pr-review/authorization.js';
11
12
  import { classifyPrReviewCircuitSignal, type PrReviewCircuitLegacyRecord, type PrReviewCircuitRecordV2, type PrReviewResiliencePolicyRecord, resolvePrReviewResiliencePolicy } from '../pr-review/circuit.js';
12
13
  import { type PrReviewDimensionCancellationRecord, type PrReviewPartialBaseCoverageRecord, type PrReviewReportVerdict, type PrReviewTerminalCoverageSettlement } from '../pr-review/completion.js';
13
14
  import { type PrReviewComposablePhase, type PrReviewPhaseComposition, parseCriticVerdict } from '../pr-review/legacy-transcript-adapter.js';
@@ -1252,7 +1253,7 @@ export declare function transitionPrReviewToFeedback(directory: string, sessionI
1252
1253
  }): Promise<PrWorkflowGateState>;
1253
1254
  export declare function declarePrFeedbackScope(directory: string, sessionID: string, taskId: string, files: string[]): Promise<PrWorkflowGateState>;
1254
1255
  export declare function resolvePrFeedbackScopeDeclaration(directory: string, sessionID: string, taskId: string): Promise<PrFeedbackScopeDeclarationRecord | null>;
1255
- export declare function consumePrFeedbackScopeDeclaration(directory: string, sessionID: string, taskId: string, callID: string): Promise<PrFeedbackScopeDeclarationRecord | null>;
1256
+ export declare function consumePrFeedbackScopeDeclaration(directory: string, sessionID: string, taskId: string, callID: string, expected: Pick<PrFeedbackScopeDeclarationRecord, 'declaredAt' | 'revisionDigest' | 'files'>): Promise<PrFeedbackScopeDeclarationRecord | null>;
1256
1257
  export declare function validatePrFeedbackScopeBinding(directory: string, binding: {
1257
1258
  taskId: string;
1258
1259
  files: string[];
@@ -1270,13 +1271,16 @@ export declare function enforcePrWorkflowToolBefore(directory: string, sessionID
1270
1271
  * revision), workflow instance id, and the active run id. Null when no active
1271
1272
  * head-bound PR_REVIEW gate exists for the session.
1272
1273
  */
1273
- export declare function readPrReviewReentryBindingContext(directory: string, sessionID: string): Promise<{
1274
- prHeadSha: string;
1275
- revisionDigest: string;
1276
- generation: number;
1277
- workflowInstanceId?: string;
1278
- runId?: string;
1279
- } | null>;
1274
+ export declare function readPrReviewReentryBindingContext(directory: string, sessionID: string): Promise<PrReviewReentryBindingContext | null>;
1275
+ /**
1276
+ * Sole production reservation/verification path for direct PR-review re-entry.
1277
+ * Lock order is fixed: workflow-session first, authorization store second. The
1278
+ * active binding cannot change between its locked reread and reservation commit.
1279
+ */
1280
+ export declare function reserveActivePrReviewReentryAuthorization(directory: string, sessionID: string, request: {
1281
+ role: PrReviewReentryRole;
1282
+ callID: string;
1283
+ }): Promise<PrReviewReentryAuthorizationRecord | null>;
1280
1284
  export declare function completePrWorkflow(directory: string, sessionID: string, expectedMode: PrWorkflowMode, prHeadSha: string, options?: {
1281
1285
  reportVerdict?: PrReviewReportVerdict;
1282
1286
  }): Promise<PrWorkflowCompletionStatus>;
@@ -1305,6 +1309,8 @@ export declare const _test_exports: {
1305
1309
  beforePrFeedbackTrackingSwitch: (() => Promise<void>) | undefined;
1306
1310
  afterPrFeedbackTrackingSwitch: (() => Promise<void>) | undefined;
1307
1311
  beforePrFeedbackTrackingPersist: (() => Promise<void>) | undefined;
1312
+ /** Interleave point held inside the workflow-session lock before auth commit. */
1313
+ beforePrReviewReentryReservation: (() => Promise<void>) | undefined;
1308
1314
  beforeBoundedSwarmFileOpen: (() => Promise<void>) | undefined;
1309
1315
  beforeSessionStateLockWrite: (() => Promise<void>) | undefined;
1310
1316
  beforeCheckoutLockWrite: (() => Promise<void>) | undefined;
@@ -1,3 +1,4 @@
1
+ import { scanDelegationsForRecovery } from '../background/pending-delegations.js';
1
2
  import { claimPrFeedbackMonitorEvents, readPrFeedbackMonitorQueue } from '../background/pr-feedback-event-queue.js';
2
3
  import { observePrWorkflowAutoWakeEvent } from './pr-workflow-auto-wake.js';
3
4
  import { type PrReviewDepthTier, readPrWorkflowGateState } from './pr-workflow-gate.js';
@@ -10,22 +11,16 @@ export declare const _internals: {
10
11
  claimPrFeedbackMonitorEvents: typeof claimPrFeedbackMonitorEvents;
11
12
  readPrFeedbackMonitorQueue: typeof readPrFeedbackMonitorQueue;
12
13
  observePrWorkflowAutoWakeEvent: typeof observePrWorkflowAutoWakeEvent;
14
+ scanDelegationsForRecovery: typeof scanDelegationsForRecovery;
13
15
  };
14
16
  /**
15
17
  * Maximum number of consecutive unproductive auto-resumes per gated session
16
18
  * before the response gate suspends further wakes. "Unproductive" means the
17
- * durable gate's `revision` did not advance between wakes i.e. no
18
- * state-mutating controller tool (dispatch_lanes_async,
19
- * write_pr_review_trigger_eval, complete_pr_workflow, recordPrReview*,
20
- * bindPrReviewBase, …) made durable progress. A healthy review bumps
21
- * `revision` on every successful state-mutating controller call, so the
22
- * consecutive counter resets on progress and never exhausts the budget.
23
- * Read-only tools (collect_lane_results polling, grep, read) intentionally do
24
- * NOT bump `revision` — an architect that only polls without ever dispatching
25
- * new lanes or recording trigger evaluations IS making progress on the
26
- * runtime's bookkeeping but is not advancing the durable gate, so the budget
27
- * treats long polling-only stretches conservatively. Only a genuinely stuck
28
- * session holds `revision` constant across many idle cycles.
19
+ * fixed-size digest of the durable gate plus its exact active delegation lanes
20
+ * did not change. Controller revisions, lane status transitions, terminal
21
+ * events, and structured receipt digests count as progress; repeated
22
+ * collect_lane_results polls do not. Strict-ledger uncertainty is sticky and
23
+ * never earns progress credit, including the first recovered snapshot.
29
24
  */
30
25
  export declare const DEFAULT_MAX_CONSECUTIVE_UNPRODUCTIVE_WAKES = 5;
31
26
  /**
@@ -102,6 +97,8 @@ interface WakeBudget {
102
97
  consecutiveUnproductive: number;
103
98
  lastWakeAt: number;
104
99
  lastSeenRevision?: number;
100
+ lastSeenProgressToken?: string;
101
+ progressUncertain: boolean;
105
102
  suspended: boolean;
106
103
  /** Total number of wake attempts recorded for this budget. NEVER reset by
107
104
  * revision progress — only the consecutive counter resets on progress; that
@@ -15,9 +15,9 @@
15
15
  * the three other recording sites in `skill-propagation-gate.ts`, (b) broke
16
16
  * the SKILL_COMPLIANCE round-trip join except by coincidence, and (c)
17
17
  * inflated frequency / taskID-diversity scoring. The fallback is
18
- * `'auto-injected'` rather than `'unknown'` so the compliance resolver's
19
- * `resolvedTaskID !== 'unknown'` guard at `skill-propagation-gate.ts:1302`
20
- * continues to fire and populate fallback skill paths.
18
+ * `'auto-injected'` to preserve a stable local audit ID for the injection
19
+ * entry; reviewer compliance attribution still requires an explicit TASK
20
+ * marker and otherwise fails closed as `'unknown'`.
21
21
  *
22
22
  * 2. Observability — a `skill_injection_decision` event is emitted to
23
23
  * `.swarm/events.jsonl` for BOTH the qualified-injection and the
@@ -40,6 +40,10 @@ export interface RecommendedSkill {
40
40
  export interface SkillInjectionOptions {
41
41
  /** When true, suppresses console.warn output (does not affect event emission). */
42
42
  quiet?: boolean;
43
+ /** Caller-loaded finite plan IDs for plan-aware attribution. */
44
+ knownPlanTaskIds?: ReadonlySet<string>;
45
+ /** The caller observed a valid plan whose task-ID cardinality exceeded the bound. */
46
+ planContextOverLimit?: boolean;
43
47
  }
44
48
  /** Result of an injection attempt. */
45
49
  export interface SkillInjectionResult {
@@ -160,7 +160,7 @@ export declare function validateExplicitSkillReferencesBefore(directory: string,
160
160
  * Looks for patterns like "taskId: <id>" or "TASK: <id>" (case-insensitive).
161
161
  * Returns "unknown" when no pattern is found.
162
162
  */
163
- export declare function extractTaskIdFromPrompt(prompt: string): string;
163
+ export declare function extractTaskIdFromPrompt(prompt: string, knownPlanTaskIds?: ReadonlySet<string>, planContextOverLimit?: boolean): string;
164
164
  /**
165
165
  * Pre-tool gate. When the architect delegates via Task tool to a skill-capable
166
166
  * agent and the SKILLS field is missing or 'none' while skills exist in the
@@ -0,0 +1,46 @@
1
+ /**
2
+ * Pure, bounded task-identity resolution shared by delegation hooks.
3
+ *
4
+ * This leaf deliberately performs no I/O and imports no plan, hook, or tool
5
+ * modules. Callers own plan loading and may supply only finite known IDs and an
6
+ * optional fallback whose uniqueness they have already proved.
7
+ */
8
+ export declare const TASK_ID_RESOLUTION_LIMITS: {
9
+ readonly maxFields: 4;
10
+ readonly maxFieldChars: number;
11
+ readonly maxTotalChars: number;
12
+ readonly maxKnownIds: 1024;
13
+ readonly maxCandidates: 32;
14
+ readonly maxTokenChars: 80;
15
+ };
16
+ export type TaskIdPolicy = 'plan' | 'attribution';
17
+ export type TaskIdSource = 'explicit' | 'task_line' | 'text' | 'marker' | 'fallback';
18
+ export type TaskIdResolution = {
19
+ status: 'resolved';
20
+ taskId: string;
21
+ source: TaskIdSource;
22
+ } | {
23
+ status: 'missing';
24
+ } | {
25
+ status: 'ambiguous';
26
+ candidates: string[];
27
+ } | {
28
+ status: 'over_limit';
29
+ input: string;
30
+ } | {
31
+ status: 'invalid';
32
+ input: string;
33
+ };
34
+ export interface ResolveTaskIdOptions {
35
+ policy: TaskIdPolicy;
36
+ knownPlanTaskIds?: ReadonlySet<string>;
37
+ /** The caller observed a valid plan whose task-ID cardinality exceeded the bound. */
38
+ planContextOverLimit?: boolean;
39
+ fallback?: string;
40
+ fallbackProvenUnique?: boolean;
41
+ }
42
+ export type TaskIdPlanContextOptions = Pick<ResolveTaskIdOptions, 'knownPlanTaskIds' | 'planContextOverLimit'>;
43
+ /** Resolve a task identity without I/O or mutable session state. */
44
+ export declare function resolveTaskId(input: Record<string, unknown>, options: ResolveTaskIdOptions): TaskIdResolution;
45
+ /** Backward-compatible delegation API backed by the bounded plan policy. */
46
+ export declare function resolveDelegatedPlanTaskId(args: Record<string, unknown>, planContext?: ReadonlySet<string> | TaskIdPlanContextOptions): string | null;