opencode-swarm 7.126.0 → 7.126.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 (50) hide show
  1. package/.opencode/skills/swarm-pr-feedback/SKILL.md +19 -14
  2. package/.opencode/skills/swarm-pr-review/SKILL.md +17 -13
  3. package/dist/cli/{config-doctor-akxywx0c.js → config-doctor-23jxdqwv.js} +2 -2
  4. package/dist/cli/{core-v1kp7anb.js → core-wg3re04e.js} +1 -1
  5. package/dist/cli/{curation-policy-dptr1rfe.js → curation-policy-0t6hny6g.js} +2 -2
  6. package/dist/cli/{curator-23hynz78.js → curator-g8rggzbk.js} +14 -14
  7. package/dist/cli/{curator-llm-factory-r648jn8e.js → curator-llm-factory-36psae60.js} +14 -14
  8. package/dist/cli/{guardrail-explain-6atsd4vr.js → guardrail-explain-6ffgrjx9.js} +15 -15
  9. package/dist/cli/{guardrail-log-222xyxfp.js → guardrail-log-57sczn5h.js} +3 -3
  10. package/dist/cli/{hive-promoter-bnkhzd46.js → hive-promoter-c458rgp5.js} +14 -14
  11. package/dist/cli/{index-qzkcy22e.js → index-1p9z8cc4.js} +1 -1
  12. package/dist/cli/{index-cdx337js.js → index-3hkbegq2.js} +1 -1
  13. package/dist/cli/{index-gnvg72y1.js → index-4ff0x4cg.js} +79 -1
  14. package/dist/cli/{index-kwnsatzq.js → index-6j9p0c40.js} +2 -2
  15. package/dist/cli/{index-a1c9az5e.js → index-abw10n3f.js} +109 -151
  16. package/dist/cli/{index-r1gdkn2d.js → index-c8sqc3nh.js} +113 -21
  17. package/dist/cli/{index-2bnfwmk3.js → index-cnhp6c0k.js} +1 -1
  18. package/dist/cli/{index-dezgmvtw.js → index-echdpdhy.js} +1 -1
  19. package/dist/cli/{index-yfzn5r9s.js → index-k5xh81c9.js} +3 -3
  20. package/dist/cli/{index-mgrsx5hn.js → index-kx3533dm.js} +1 -1
  21. package/dist/cli/{index-bcgfhxzv.js → index-nkhp7j16.js} +5 -5
  22. package/dist/cli/{index-2yd75hms.js → index-nmyg9b7v.js} +4 -4
  23. package/dist/cli/{index-16z6txq3.js → index-vvwf9ark.js} +2 -2
  24. package/dist/cli/{index-jt7hnr7q.js → index-w0yztxgq.js} +1 -1
  25. package/dist/cli/{index-g4ef4v3m.js → index-w9cb5zwh.js} +1 -1
  26. package/dist/cli/{index-y4ry07h8.js → index-x1w4cx3n.js} +2 -2
  27. package/dist/cli/{index-0ff5cm9j.js → index-y9t766sw.js} +2217 -2195
  28. package/dist/cli/{index-68fpa7ff.js → index-yf4kvhrn.js} +16 -16
  29. package/dist/cli/index.js +14 -14
  30. package/dist/cli/{knowledge-escalator-4hc8w7sd.js → knowledge-escalator-kd80m9vp.js} +3 -3
  31. package/dist/cli/{knowledge-events-kyqjv1f8.js → knowledge-events-j7jfwm1d.js} +1 -1
  32. package/dist/cli/{knowledge-store-06k0p1gs.js → knowledge-store-1d4byc7y.js} +1 -1
  33. package/dist/cli/{knowledge-validator-42xjmcmh.js → knowledge-validator-63mkgt9x.js} +4 -4
  34. package/dist/cli/{scan-cursor-gjcvpyta.js → scan-cursor-qzn5jmbe.js} +2 -2
  35. package/dist/cli/{schema-69z8w1ka.js → schema-2j92wnns.js} +1 -1
  36. package/dist/cli/{scope-persistence-habn4q8a.js → scope-persistence-dm5bab50.js} +3 -1
  37. package/dist/cli/{skill-generator-t6j93mwt.js → skill-generator-sv6zvdvz.js} +5 -5
  38. package/dist/config/index.d.ts +1 -0
  39. package/dist/config/loader.d.ts +51 -36
  40. package/dist/hooks/pr-workflow-gate.d.ts +39 -0
  41. package/dist/hooks/scope-guard.d.ts +6 -1
  42. package/dist/index.js +29 -26
  43. package/dist/scope/scope-binding.d.ts +21 -2
  44. package/dist/scope/scope-persistence.d.ts +6 -0
  45. package/dist/tools/index.d.ts +2 -0
  46. package/dist/tools/manifest.d.ts +2 -0
  47. package/dist/tools/prepare-pr-feedback-scope.d.ts +5 -0
  48. package/dist/tools/tool-metadata.d.ts +98 -0
  49. package/dist/tools/write-pr-review-artifact.d.ts +5 -0
  50. package/package.json +3 -3
@@ -203,20 +203,25 @@ for the Fix Planning step.
203
203
 
204
204
  ## Pre-flight: Scope Discipline
205
205
 
206
- The following `save_plan` / `declare_scope` mechanics apply only when those
207
- plugin tools are available. In other repositories or runtimes, use the native
208
- scope controller; if none exists, put exact allowed files and non-goals in the
209
- delegation and verify the resulting diff mechanically. Never bypass an
210
- available scope controller merely to reduce ceremony.
211
-
212
- `declare_scope({ taskId, files })` enforces that the delegated coder agent may only modify the declared files. The enforcement requires an active `.swarm/plan.json` — calling `declare_scope` in a feedback-closure run (which does not go through `save_plan`) rejects with "No plan found."
213
-
214
- **When to use `declare_scope` (preferred):** any feedback round that touches 2+ files, OR any feedback round where the file scope is not 100% obvious from the prompt. Before delegating, save a minimal plan via `save_plan` with a single phase containing the feedback-closure tasks, then call `declare_scope` per task with the exact file list.
215
-
216
- **Carve-out for direct Task delegation:** 1-file, single-function changes where the file path appears verbatim in the coder's prompt may use direct `Task(subagent_type="<coder>", ...)` delegation without `declare_scope`, where `<coder>` is the active swarm's coder agent (e.g. `coder`, or `paid_coder` when the swarm id is `paid`). This is a narrow exception; the orchestrator is responsible for verifying the scope is unambiguous.
217
- REQUIRED: even under this carve-out, the direct Task dispatch MUST contain a literal `ACCEPTANCE:` line resolve per ACCEPTANCE FIELD RESOLUTION in your system prompt (one-line task-derived DONE restatement for the feedback fix, since feedback-closure runs typically have no fr_refs). A missing line is BLOCKED by ACCEPTANCE_FIELD_REQUIRED.
218
-
219
- **Anti-pattern:** do not use `Task` delegation for multi-file feedback fixes just to skip `save_plan` — the loss of scope discipline is not worth the saved ceremony.
206
+ When the plugin's mechanical controller is available, every coder Task must be
207
+ preceded by `prepare_pr_feedback_scope({ task_id, files })`. The controller is
208
+ available only after the immutable feedback-verification lanes have settled and
209
+ binds the exact file set to the current feedback revision, parent session, and
210
+ next matching Task call. The coder prompt must use the same numeric `task_id`,
211
+ contain matching `FILE:` directives, and include a literal `ACCEPTANCE:` line.
212
+ Once a Task consumes that scope, its `task_id` is immutable for the current
213
+ feedback revision. Any retry must prepare and dispatch a fresh nested numeric
214
+ task identity (for example `1.1.1`), never re-declare the consumed ID.
215
+
216
+ Do not create a synthetic `save_plan` merely to authorize feedback work, and do
217
+ not use `declare_scope`; those tools belong to the normal implementation-plan
218
+ lifecycle. There is no one-file or single-function carve-out from the dedicated
219
+ PR-feedback scope controller.
220
+
221
+ In runtimes without this controller, use the native scope mechanism. If none
222
+ exists, put exact allowed files and non-goals in the delegation and verify the
223
+ resulting diff mechanically. Never bypass an available scope controller merely
224
+ to reduce ceremony.
220
225
 
221
226
  ## Intake Surfaces
222
227
 
@@ -24,11 +24,11 @@ without running a fresh broad review.
24
24
  When a review finishes with actionable validated findings, stop and ask the user
25
25
  whether to continue into `swarm-pr-feedback`. Do not auto-dispatch fix work from
26
26
  `PR_REVIEW`. Instead, write a handoff artifact under
27
- `.swarm/pr-review/<run_id>/feedback-handoff.md` (or `.json`) and include the
28
- exact continuation prompt:
27
+ `.swarm/pr-review/<run_id>/feedback-handoff.json` with `write_pr_review_artifact`
28
+ and include the exact continuation prompt:
29
29
 
30
30
  ```text
31
- /swarm pr-feedback <PR_URL> continue from .swarm/pr-review/<run_id>/feedback-handoff.md
31
+ /swarm pr-feedback <PR_URL> continue from .swarm/pr-review/<run_id>/feedback-handoff.json
32
32
  ```
33
33
 
34
34
  `<run_id>` is a stable identifier for this review run, such as
@@ -459,10 +459,10 @@ The context pack must include, when available:
459
459
 
460
460
  ## Review Finding Persistence
461
461
 
462
- Do not rely on conversation context to preserve review findings. Create a run
463
- artifact under `.swarm/pr-review/<run_id>/findings.jsonl` when file writes are
464
- allowed, or under `.swarm/evidence/pr-review-<run_id>-findings.jsonl` when the
465
- review already uses the evidence tree.
462
+ Do not rely on conversation context to preserve review findings. Use
463
+ `write_pr_review_artifact` with `kind: "findings"`; the controller creates and
464
+ appends `.swarm/pr-review/<run_id>/findings.jsonl` without granting generic
465
+ write authority over `.swarm/`.
466
466
 
467
467
  Each persisted finding record must include at least:
468
468
 
@@ -484,11 +484,14 @@ Minimum field contract:
484
484
  Persist after every major validation boundary:
485
485
 
486
486
  1. **Post-explorer:** after Phase 3/4 candidate parsing and before reviewer
487
- dispatch, write all candidates as `PENDING` with their lane provenance.
488
- 2. **Post-reviewer:** after Phase 6 reviewer validation, update each reviewed
487
+ dispatch, call `write_pr_review_artifact` with `boundary: "post_explorer"`
488
+ and all candidates as `PENDING` with their lane provenance.
489
+ 2. **Post-reviewer:** after Phase 6 reviewer validation, call the controller
490
+ with `boundary: "post_reviewer"` and update each reviewed
489
491
  record to `CONFIRMED`, `DISPROVED`, `PRE_EXISTING`, or keep `PENDING` with a
490
492
  concrete `next_action` if more evidence is required.
491
- 3. **Post-critic:** after Phase 8 critic challenge, update final status,
493
+ 3. **Post-critic:** after Phase 8 critic challenge, call the controller with
494
+ `boundary: "post_critic"` and update final status,
492
495
  severity/action notes in `evidence`, and final reporting or handoff action.
493
496
 
494
497
  Resume/reload procedure:
@@ -1376,7 +1379,9 @@ Explain the recommendation in one short paragraph and list required actions befo
1376
1379
  ## Feedback handoff
1377
1380
 
1378
1381
  When the review produced actionable validated findings or operational blockers,
1379
- include:
1382
+ call `write_pr_review_artifact` with `kind: "handoff"`. The controller writes
1383
+ `.swarm/pr-review/<run_id>/feedback-handoff.json` only when its finding IDs
1384
+ exactly match the latest confirmed `handoff_to_feedback` records. Include:
1380
1385
 
1381
1386
  - the handoff artifact path,
1382
1387
  - the preserved finding IDs and provenance that `swarm-pr-feedback` must carry
@@ -1387,7 +1392,7 @@ include:
1387
1392
  Use this exact continuation prompt format:
1388
1393
 
1389
1394
  ```text
1390
- /swarm pr-feedback <PR_URL> continue from .swarm/pr-review/<run_id>/feedback-handoff.md
1395
+ /swarm pr-feedback <PR_URL> continue from .swarm/pr-review/<run_id>/feedback-handoff.json
1391
1396
  ```
1392
1397
 
1393
1398
  ---
@@ -1435,4 +1440,3 @@ unproductive wakes, and the only exits are:
1435
1440
  Abort is a recovery tool, not a coverage shortcut. Use it only when the
1436
1441
  bind/checkout path is genuinely unreachable; never use it to skip a
1437
1442
  coverage obligation that is merely expensive or inconvenient.
1438
-
@@ -12,8 +12,8 @@ import {
12
12
  shouldRunOnStartup,
13
13
  writeBackupArtifact,
14
14
  writeDoctorArtifact
15
- } from "./index-jt7hnr7q.js";
16
- import"./index-r1gdkn2d.js";
15
+ } from "./index-w0yztxgq.js";
16
+ import"./index-c8sqc3nh.js";
17
17
  import"./index-bk5tah7q.js";
18
18
  import"./index-z6xqpmqg.js";
19
19
  import"./index-zjygnfay.js";
@@ -14,7 +14,7 @@ import {
14
14
  resolveWorktreeBaseDir,
15
15
  shortenWorktreePath,
16
16
  writeLaneProfileToDiskReal
17
- } from "./index-g4ef4v3m.js";
17
+ } from "./index-w9cb5zwh.js";
18
18
  import"./index-4rhhvd1a.js";
19
19
  import"./index-z6xqpmqg.js";
20
20
  import"./index-zjygnfay.js";
@@ -4,9 +4,9 @@ import {
4
4
  authorizeCuration,
5
5
  buildConfigFingerprintInput,
6
6
  readCohortConfigFingerprint
7
- } from "./index-mgrsx5hn.js";
7
+ } from "./index-kx3533dm.js";
8
8
  import"./index-rtry5xyf.js";
9
- import"./index-2bnfwmk3.js";
9
+ import"./index-cnhp6c0k.js";
10
10
  import"./index-ae75rja9.js";
11
11
  import"./index-q27bajqb.js";
12
12
  import"./index-zgwm4ryv.js";
@@ -14,38 +14,38 @@ import {
14
14
  runCuratorInit,
15
15
  runCuratorPhase,
16
16
  writeCuratorSummary
17
- } from "./index-0ff5cm9j.js";
18
- import"./index-dezgmvtw.js";
19
- import"./index-jt7hnr7q.js";
17
+ } from "./index-y9t766sw.js";
18
+ import"./index-echdpdhy.js";
19
+ import"./index-w0yztxgq.js";
20
20
  import"./index-kk1scggc.js";
21
21
  import"./index-4905hd2m.js";
22
22
  import"./index-134d35c1.js";
23
23
  import"./index-6n2jpz7x.js";
24
- import"./index-yfzn5r9s.js";
25
- import"./index-bcgfhxzv.js";
26
- import"./index-cdx337js.js";
24
+ import"./index-k5xh81c9.js";
25
+ import"./index-nkhp7j16.js";
26
+ import"./index-3hkbegq2.js";
27
27
  import"./index-vxv732ex.js";
28
28
  import"./index-c8s9a3zh.js";
29
29
  import"./index-9ss2m4rs.js";
30
30
  import"./index-23zsx7dm.js";
31
- import"./index-kwnsatzq.js";
32
- import"./index-mgrsx5hn.js";
31
+ import"./index-6j9p0c40.js";
32
+ import"./index-kx3533dm.js";
33
33
  import"./index-rtry5xyf.js";
34
- import"./index-2yd75hms.js";
35
- import"./index-2bnfwmk3.js";
34
+ import"./index-nmyg9b7v.js";
35
+ import"./index-cnhp6c0k.js";
36
36
  import"./index-ae75rja9.js";
37
37
  import"./index-q27bajqb.js";
38
- import"./index-a1c9az5e.js";
38
+ import"./index-abw10n3f.js";
39
39
  import"./index-k5jrywpr.js";
40
40
  import"./index-n832052r.js";
41
- import"./index-r1gdkn2d.js";
41
+ import"./index-c8sqc3nh.js";
42
42
  import"./index-bk5tah7q.js";
43
43
  import"./index-8fwhhayc.js";
44
44
  import"./index-q1exe2b3.js";
45
- import"./index-gnvg72y1.js";
45
+ import"./index-4ff0x4cg.js";
46
46
  import"./index-2tn5h2zp.js";
47
47
  import"./index-1kz6da87.js";
48
- import"./index-g4ef4v3m.js";
48
+ import"./index-w9cb5zwh.js";
49
49
  import"./index-4rhhvd1a.js";
50
50
  import"./index-0cz1ws47.js";
51
51
  import"./index-2445sx3d.js";
@@ -1,38 +1,38 @@
1
1
  // @bun
2
2
  import {
3
3
  createCuratorLLMDelegate
4
- } from "./index-0ff5cm9j.js";
5
- import"./index-dezgmvtw.js";
6
- import"./index-jt7hnr7q.js";
4
+ } from "./index-y9t766sw.js";
5
+ import"./index-echdpdhy.js";
6
+ import"./index-w0yztxgq.js";
7
7
  import"./index-kk1scggc.js";
8
8
  import"./index-4905hd2m.js";
9
9
  import"./index-134d35c1.js";
10
10
  import"./index-6n2jpz7x.js";
11
- import"./index-yfzn5r9s.js";
12
- import"./index-bcgfhxzv.js";
13
- import"./index-cdx337js.js";
11
+ import"./index-k5xh81c9.js";
12
+ import"./index-nkhp7j16.js";
13
+ import"./index-3hkbegq2.js";
14
14
  import"./index-vxv732ex.js";
15
15
  import"./index-c8s9a3zh.js";
16
16
  import"./index-9ss2m4rs.js";
17
17
  import"./index-23zsx7dm.js";
18
- import"./index-kwnsatzq.js";
19
- import"./index-mgrsx5hn.js";
18
+ import"./index-6j9p0c40.js";
19
+ import"./index-kx3533dm.js";
20
20
  import"./index-rtry5xyf.js";
21
- import"./index-2yd75hms.js";
22
- import"./index-2bnfwmk3.js";
21
+ import"./index-nmyg9b7v.js";
22
+ import"./index-cnhp6c0k.js";
23
23
  import"./index-ae75rja9.js";
24
24
  import"./index-q27bajqb.js";
25
- import"./index-a1c9az5e.js";
25
+ import"./index-abw10n3f.js";
26
26
  import"./index-k5jrywpr.js";
27
27
  import"./index-n832052r.js";
28
- import"./index-r1gdkn2d.js";
28
+ import"./index-c8sqc3nh.js";
29
29
  import"./index-bk5tah7q.js";
30
30
  import"./index-8fwhhayc.js";
31
31
  import"./index-q1exe2b3.js";
32
- import"./index-gnvg72y1.js";
32
+ import"./index-4ff0x4cg.js";
33
33
  import"./index-2tn5h2zp.js";
34
34
  import"./index-1kz6da87.js";
35
- import"./index-g4ef4v3m.js";
35
+ import"./index-w9cb5zwh.js";
36
36
  import"./index-4rhhvd1a.js";
37
37
  import"./index-0cz1ws47.js";
38
38
  import"./index-2445sx3d.js";
@@ -1,39 +1,39 @@
1
1
  // @bun
2
2
  import {
3
3
  handleGuardrailExplain
4
- } from "./index-y4ry07h8.js";
5
- import"./index-0ff5cm9j.js";
6
- import"./index-dezgmvtw.js";
7
- import"./index-jt7hnr7q.js";
4
+ } from "./index-x1w4cx3n.js";
5
+ import"./index-y9t766sw.js";
6
+ import"./index-echdpdhy.js";
7
+ import"./index-w0yztxgq.js";
8
8
  import"./index-kk1scggc.js";
9
9
  import"./index-4905hd2m.js";
10
10
  import"./index-134d35c1.js";
11
11
  import"./index-6n2jpz7x.js";
12
- import"./index-yfzn5r9s.js";
13
- import"./index-bcgfhxzv.js";
14
- import"./index-cdx337js.js";
12
+ import"./index-k5xh81c9.js";
13
+ import"./index-nkhp7j16.js";
14
+ import"./index-3hkbegq2.js";
15
15
  import"./index-vxv732ex.js";
16
16
  import"./index-c8s9a3zh.js";
17
17
  import"./index-9ss2m4rs.js";
18
18
  import"./index-23zsx7dm.js";
19
- import"./index-kwnsatzq.js";
20
- import"./index-mgrsx5hn.js";
19
+ import"./index-6j9p0c40.js";
20
+ import"./index-kx3533dm.js";
21
21
  import"./index-rtry5xyf.js";
22
- import"./index-2yd75hms.js";
23
- import"./index-2bnfwmk3.js";
22
+ import"./index-nmyg9b7v.js";
23
+ import"./index-cnhp6c0k.js";
24
24
  import"./index-ae75rja9.js";
25
25
  import"./index-q27bajqb.js";
26
- import"./index-a1c9az5e.js";
26
+ import"./index-abw10n3f.js";
27
27
  import"./index-k5jrywpr.js";
28
28
  import"./index-n832052r.js";
29
- import"./index-r1gdkn2d.js";
29
+ import"./index-c8sqc3nh.js";
30
30
  import"./index-bk5tah7q.js";
31
31
  import"./index-8fwhhayc.js";
32
32
  import"./index-q1exe2b3.js";
33
- import"./index-gnvg72y1.js";
33
+ import"./index-4ff0x4cg.js";
34
34
  import"./index-2tn5h2zp.js";
35
35
  import"./index-1kz6da87.js";
36
- import"./index-g4ef4v3m.js";
36
+ import"./index-w9cb5zwh.js";
37
37
  import"./index-4rhhvd1a.js";
38
38
  import"./index-0cz1ws47.js";
39
39
  import"./index-2445sx3d.js";
@@ -1,9 +1,9 @@
1
1
  // @bun
2
2
  import {
3
3
  handleGuardrailLog
4
- } from "./index-qzkcy22e.js";
5
- import"./index-dezgmvtw.js";
6
- import"./index-r1gdkn2d.js";
4
+ } from "./index-1p9z8cc4.js";
5
+ import"./index-echdpdhy.js";
6
+ import"./index-c8sqc3nh.js";
7
7
  import"./index-bk5tah7q.js";
8
8
  import"./index-z6xqpmqg.js";
9
9
  import"./index-zjygnfay.js";
@@ -7,40 +7,40 @@ import {
7
7
  isHiveEligible,
8
8
  promoteFromSwarm,
9
9
  promoteToHive
10
- } from "./index-0ff5cm9j.js";
11
- import"./index-dezgmvtw.js";
12
- import"./index-jt7hnr7q.js";
10
+ } from "./index-y9t766sw.js";
11
+ import"./index-echdpdhy.js";
12
+ import"./index-w0yztxgq.js";
13
13
  import"./index-kk1scggc.js";
14
14
  import"./index-4905hd2m.js";
15
15
  import"./index-134d35c1.js";
16
16
  import"./index-6n2jpz7x.js";
17
- import"./index-yfzn5r9s.js";
18
- import"./index-bcgfhxzv.js";
19
- import"./index-cdx337js.js";
17
+ import"./index-k5xh81c9.js";
18
+ import"./index-nkhp7j16.js";
19
+ import"./index-3hkbegq2.js";
20
20
  import"./index-vxv732ex.js";
21
21
  import"./index-c8s9a3zh.js";
22
22
  import"./index-9ss2m4rs.js";
23
23
  import"./index-23zsx7dm.js";
24
- import"./index-kwnsatzq.js";
25
- import"./index-mgrsx5hn.js";
24
+ import"./index-6j9p0c40.js";
25
+ import"./index-kx3533dm.js";
26
26
  import"./index-rtry5xyf.js";
27
27
  import {
28
28
  resolveHiveKnowledgePath
29
- } from "./index-2yd75hms.js";
30
- import"./index-2bnfwmk3.js";
29
+ } from "./index-nmyg9b7v.js";
30
+ import"./index-cnhp6c0k.js";
31
31
  import"./index-ae75rja9.js";
32
32
  import"./index-q27bajqb.js";
33
- import"./index-a1c9az5e.js";
33
+ import"./index-abw10n3f.js";
34
34
  import"./index-k5jrywpr.js";
35
35
  import"./index-n832052r.js";
36
- import"./index-r1gdkn2d.js";
36
+ import"./index-c8sqc3nh.js";
37
37
  import"./index-bk5tah7q.js";
38
38
  import"./index-8fwhhayc.js";
39
39
  import"./index-q1exe2b3.js";
40
- import"./index-gnvg72y1.js";
40
+ import"./index-4ff0x4cg.js";
41
41
  import"./index-2tn5h2zp.js";
42
42
  import"./index-1kz6da87.js";
43
- import"./index-g4ef4v3m.js";
43
+ import"./index-w9cb5zwh.js";
44
44
  import"./index-4rhhvd1a.js";
45
45
  import"./index-0cz1ws47.js";
46
46
  import"./index-2445sx3d.js";
@@ -2,7 +2,7 @@
2
2
  import {
3
3
  redactPath,
4
4
  redactShellCommand
5
- } from "./index-dezgmvtw.js";
5
+ } from "./index-echdpdhy.js";
6
6
 
7
7
  // src/services/guardrail-log-service.ts
8
8
  import * as fs from "fs/promises";
@@ -2,7 +2,7 @@
2
2
  import {
3
3
  readKnowledge,
4
4
  transactKnowledge
5
- } from "./index-2yd75hms.js";
5
+ } from "./index-nmyg9b7v.js";
6
6
  import {
7
7
  resolveKnowledgeStoreDir
8
8
  } from "./index-q27bajqb.js";
@@ -136,6 +136,7 @@ var SCOPES_DIR = ".swarm/scopes";
136
136
  var MAX_FILES_PER_SCOPE = 1e4;
137
137
  var MAX_PLAN_BYTES = 10 * 1024 * 1024;
138
138
  var MAX_SCOPE_BYTES = 2 * 1024 * 1024;
139
+ var MAX_BINDING_FILES_TO_SCAN = 1e4;
139
140
  var WINDOWS_RESERVED = new Set([
140
141
  "CON",
141
142
  "PRN",
@@ -432,6 +433,83 @@ function resolveAuthorizedScopeBindingForSession(input) {
432
433
  }
433
434
  return matches[0] ?? null;
434
435
  }
436
+ function readPrFeedbackBindingFile(directory, filePath, activeSessionId, taskId) {
437
+ try {
438
+ const leaf = fs2.lstatSync(filePath);
439
+ if (!leaf.isFile() || leaf.isSymbolicLink())
440
+ return null;
441
+ if (normalizePathForComparison(fs2.realpathSync(filePath)) !== normalizePathForComparison(filePath))
442
+ return null;
443
+ } catch {
444
+ return null;
445
+ }
446
+ const nofollow = fs2.constants.O_NOFOLLOW ?? 0;
447
+ let fd;
448
+ try {
449
+ fd = fs2.openSync(filePath, fs2.constants.O_RDONLY | nofollow);
450
+ } catch {
451
+ return null;
452
+ }
453
+ let raw = "";
454
+ try {
455
+ const stat = fs2.fstatSync(fd);
456
+ if (!stat.isFile() || stat.size > MAX_SCOPE_BYTES)
457
+ return null;
458
+ const buffer = Buffer.alloc(stat.size);
459
+ fs2.readSync(fd, buffer, 0, stat.size, 0);
460
+ raw = buffer.toString("utf8");
461
+ } catch {
462
+ return null;
463
+ } finally {
464
+ try {
465
+ fs2.closeSync(fd);
466
+ } catch {}
467
+ }
468
+ let parsed;
469
+ try {
470
+ parsed = JSON.parse(raw);
471
+ } catch {
472
+ return null;
473
+ }
474
+ const workspaceIdentity = canonicalWorkspaceIdentity(directory);
475
+ const files = Array.isArray(parsed.files) ? normalizeScopeFiles(parsed.files.filter((file) => typeof file === "string")) : null;
476
+ const now = Date.now();
477
+ if (parsed.version !== 2 || parsed.source !== "pr_feedback" || !workspaceIdentity || parsed.workspaceIdentity !== workspaceIdentity || !isSafeTaskId(parsed.taskId ?? "") || taskId !== undefined && parsed.taskId !== taskId || parsed.ownerSessionId !== activeSessionId || parsed.activation !== "active" || typeof parsed.dispatchCallId !== "string" || !parsed.dispatchCallId || parsed.ownerMessageId !== parsed.dispatchCallId || typeof parsed.parentOwnerSessionId !== "string" || !parsed.parentOwnerSessionId || parsed.ownerSessionId === parsed.parentOwnerSessionId || parsed.parentCallId !== parsed.dispatchCallId || parsed.workflowSessionId !== parsed.parentOwnerSessionId || typeof parsed.workflowRevisionDigest !== "string" || !parsed.workflowRevisionDigest || parsed.planId !== `pr-feedback:${parsed.workflowSessionId}` || parsed.planStructureHash !== parsed.workflowRevisionDigest || typeof parsed.declaredAt !== "number" || parsed.declaredAt > now || typeof parsed.expiresAt !== "number" || parsed.expiresAt <= now || !files)
478
+ return null;
479
+ const expectedPath = getBindingFilePath(directory, parsed.taskId, activeSessionId);
480
+ if (normalizePathForComparison(expectedPath) !== normalizePathForComparison(filePath))
481
+ return null;
482
+ return { ...parsed, files };
483
+ }
484
+ function resolveAuthorizedPrFeedbackScopeBindingFromDisk(input) {
485
+ if (!input.activeSessionId.trim())
486
+ return null;
487
+ const scopesDir = getScopesDir(input.directory);
488
+ if (!isScopesDirSafe(input.directory, scopesDir))
489
+ return null;
490
+ let candidates;
491
+ if (input.taskId) {
492
+ if (!isSafeTaskId(input.taskId))
493
+ return null;
494
+ candidates = [
495
+ getBindingFilePath(input.directory, input.taskId, input.activeSessionId)
496
+ ];
497
+ } else {
498
+ try {
499
+ const names = fs2.readdirSync(scopesDir);
500
+ if (names.length > MAX_BINDING_FILES_TO_SCAN)
501
+ return null;
502
+ candidates = names.filter((name) => name.startsWith("binding-") && name.endsWith(".json")).map((name) => path2.join(scopesDir, name));
503
+ } catch {
504
+ return null;
505
+ }
506
+ }
507
+ const matches = candidates.map((candidate) => readPrFeedbackBindingFile(input.directory, candidate, input.activeSessionId, input.taskId)).filter((binding) => binding !== null);
508
+ if (matches.length !== 1)
509
+ return null;
510
+ registerScopeBinding(matches[0]);
511
+ return matches[0];
512
+ }
435
513
  async function atomicWrite(targetPath, content) {
436
514
  const tempPath = `${targetPath}.tmp.${Date.now()}.${Math.floor(Math.random() * 1e9)}`;
437
515
  try {
@@ -561,4 +639,4 @@ function resolveScopeWithFallbacks(input) {
561
639
  return null;
562
640
  }
563
641
 
564
- export { MAX_PENDING_SCOPE_BINDINGS, clearScopeBindings, writeScopeToDisk, writeScopeBindingToDisk, readScopeBindingFromDisk, clearScopeBindingFromDisk, resolveAuthorizedScopeBinding, resolveAuthorizedScopeBindingForSession, readScopeFromDisk, readPlanScope, clearScopeForTask, clearAllScopes, resolveScopeWithFallbacks };
642
+ export { MAX_PENDING_SCOPE_BINDINGS, clearScopeBindings, writeScopeToDisk, writeScopeBindingToDisk, readScopeBindingFromDisk, clearScopeBindingFromDisk, resolveAuthorizedScopeBinding, resolveAuthorizedScopeBindingForSession, resolveAuthorizedPrFeedbackScopeBindingFromDisk, readScopeFromDisk, readPlanScope, clearScopeForTask, clearAllScopes, resolveScopeWithFallbacks };
@@ -1,7 +1,7 @@
1
1
  // @bun
2
2
  import {
3
3
  authorizeCuration
4
- } from "./index-mgrsx5hn.js";
4
+ } from "./index-kx3533dm.js";
5
5
  import {
6
6
  findNearDuplicate,
7
7
  inferTags,
@@ -9,7 +9,7 @@ import {
9
9
  resolveSwarmKnowledgePath,
10
10
  resolveSwarmRejectedPath,
11
11
  transactKnowledge
12
- } from "./index-2yd75hms.js";
12
+ } from "./index-nmyg9b7v.js";
13
13
  import {
14
14
  resolveKnowledgeStoreDir
15
15
  } from "./index-q27bajqb.js";