opencode-swarm 7.126.0 → 7.126.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 (52) hide show
  1. package/.opencode/skills/swarm-pr-feedback/SKILL.md +24 -16
  2. package/.opencode/skills/swarm-pr-review/SKILL.md +18 -14
  3. package/dist/cli/{config-doctor-akxywx0c.js → config-doctor-mfx27331.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-n944aq62.js} +2 -2
  6. package/dist/cli/{curator-llm-factory-r648jn8e.js → curator-llm-factory-0rf29gfq.js} +14 -14
  7. package/dist/cli/{curator-23hynz78.js → curator-qfh9xty4.js} +14 -14
  8. package/dist/cli/{guardrail-explain-6atsd4vr.js → guardrail-explain-jsrjqps1.js} +15 -15
  9. package/dist/cli/{guardrail-log-222xyxfp.js → guardrail-log-61gya05m.js} +3 -3
  10. package/dist/cli/{hive-promoter-bnkhzd46.js → hive-promoter-ktt17fyf.js} +14 -14
  11. package/dist/cli/{index-jt7hnr7q.js → index-3xd9a2g7.js} +1 -1
  12. package/dist/cli/{index-gnvg72y1.js → index-4ff0x4cg.js} +79 -1
  13. package/dist/cli/{index-68fpa7ff.js → index-5nq8dp63.js} +16 -16
  14. package/dist/cli/{index-yfzn5r9s.js → index-7bxw3v5w.js} +3 -3
  15. package/dist/cli/{index-kwnsatzq.js → index-88dt7c9z.js} +2 -2
  16. package/dist/cli/{index-qzkcy22e.js → index-bf76q8q7.js} +1 -1
  17. package/dist/cli/{index-16z6txq3.js → index-c48dvb6j.js} +2 -2
  18. package/dist/cli/{index-0ff5cm9j.js → index-d88y17ht.js} +2222 -2197
  19. package/dist/cli/{index-bcgfhxzv.js → index-f97dm6tz.js} +5 -5
  20. package/dist/cli/{index-a1c9az5e.js → index-gf9cxvp0.js} +109 -151
  21. package/dist/cli/{index-mgrsx5hn.js → index-gwss5btk.js} +1 -1
  22. package/dist/cli/{index-dezgmvtw.js → index-gxw20m1d.js} +1 -1
  23. package/dist/cli/{index-2bnfwmk3.js → index-nqp13m5a.js} +1 -1
  24. package/dist/cli/{index-2yd75hms.js → index-pb8ag9vg.js} +4 -4
  25. package/dist/cli/{index-cdx337js.js → index-pf3xae4s.js} +1 -1
  26. package/dist/cli/{index-r1gdkn2d.js → index-vcqwhe9d.js} +117 -21
  27. package/dist/cli/{index-g4ef4v3m.js → index-w9cb5zwh.js} +1 -1
  28. package/dist/cli/{index-y4ry07h8.js → index-z8ftpav0.js} +2 -2
  29. package/dist/cli/index.js +14 -14
  30. package/dist/cli/{knowledge-escalator-4hc8w7sd.js → knowledge-escalator-nna0zec3.js} +3 -3
  31. package/dist/cli/{knowledge-events-kyqjv1f8.js → knowledge-events-7k82xk36.js} +1 -1
  32. package/dist/cli/{knowledge-store-06k0p1gs.js → knowledge-store-efvtng9t.js} +1 -1
  33. package/dist/cli/{knowledge-validator-42xjmcmh.js → knowledge-validator-jh93eagj.js} +4 -4
  34. package/dist/cli/{scan-cursor-gjcvpyta.js → scan-cursor-cydz8d9q.js} +2 -2
  35. package/dist/cli/{schema-69z8w1ka.js → schema-fa033pqw.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-8v463kj7.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/delegation-gate.d.ts +14 -2
  41. package/dist/hooks/pr-workflow-gate.d.ts +57 -0
  42. package/dist/hooks/scope-guard.d.ts +6 -1
  43. package/dist/index.js +55 -49
  44. package/dist/scope/scope-binding.d.ts +21 -2
  45. package/dist/scope/scope-persistence.d.ts +6 -0
  46. package/dist/tools/index.d.ts +3 -0
  47. package/dist/tools/manifest.d.ts +3 -0
  48. package/dist/tools/prepare-pr-feedback-scope.d.ts +5 -0
  49. package/dist/tools/prepare-pr-workflow-checkout.d.ts +25 -0
  50. package/dist/tools/tool-metadata.d.ts +102 -0
  51. package/dist/tools/write-pr-review-artifact.d.ts +5 -0
  52. package/package.json +3 -3
@@ -139,8 +139,11 @@ tree:
139
139
  supersedes your planned fixes, and prefer the parallel work if it's more
140
140
  comprehensive (more tests, better edge coverage, clearer error handling).
141
141
  Abort your rebase, take the remote state, then add minor improvements on top.
142
- - Verify the working tree is clean first (`git status --porcelain`). If uncommitted
143
- changes exist, stash them or abort to prevent data loss.
142
+ - Verify the working tree is clean first (`git status --porcelain`). If tracked
143
+ changes exist, call `prepare_pr_workflow_checkout` with every explicit dirty
144
+ tracked path. It creates an auditable, path-scoped stash and returns its
145
+ recovery command. Do not issue `git stash` through shell. The controller never
146
+ stashes untracked files; move or remove those manually, or abort the checkout.
144
147
  - **Check out the head branch locally.** Feedback verification reads the working-tree
145
148
  filesystem (`Read`/`Glob`/`Grep`), and fixes must land on the PR branch — without a
146
149
  checkout you would verify and patch the base branch's code instead. Record the
@@ -203,20 +206,25 @@ for the Fix Planning step.
203
206
 
204
207
  ## Pre-flight: Scope Discipline
205
208
 
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.
209
+ When the plugin's mechanical controller is available, every coder Task must be
210
+ preceded by `prepare_pr_feedback_scope({ task_id, files })`. The controller is
211
+ available only after the immutable feedback-verification lanes have settled and
212
+ binds the exact file set to the current feedback revision, parent session, and
213
+ next matching Task call. The coder prompt must use the same numeric `task_id`,
214
+ contain matching `FILE:` directives, and include a literal `ACCEPTANCE:` line.
215
+ Once a Task consumes that scope, its `task_id` is immutable for the current
216
+ feedback revision. Any retry must prepare and dispatch a fresh nested numeric
217
+ task identity (for example `1.1.1`), never re-declare the consumed ID.
218
+
219
+ Do not create a synthetic `save_plan` merely to authorize feedback work, and do
220
+ not use `declare_scope`; those tools belong to the normal implementation-plan
221
+ lifecycle. There is no one-file or single-function carve-out from the dedicated
222
+ PR-feedback scope controller.
223
+
224
+ In runtimes without this controller, use the native scope mechanism. If none
225
+ exists, put exact allowed files and non-goals in the delegation and verify the
226
+ resulting diff mechanically. Never bypass an available scope controller merely
227
+ to reduce ceremony.
220
228
 
221
229
  ## Intake Surfaces
222
230
 
@@ -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
@@ -136,7 +136,7 @@ If scope cannot be determined, review the narrowest safe scope available and sta
136
136
 
137
137
  Before launching explorers (Phase 3), confirm the PR branch refs are available:
138
138
  - If `head_ref` is a remote branch that is not checked out locally, fetch it via `git fetch origin <head_ref>`
139
- - **Check out the head branch locally.** Explorer agents read files from the working tree, not from git history — passing the commit range in the delegation prompt is not sufficient because `Read` / `Glob` / `Grep` tools operate on the filesystem. Without a checkout, explorers silently read the base branch's version of changed files and produce invalid candidates. **Before checking out, verify the working tree is clean (`git status --porcelain`). If uncommitted changes exist, stash them or abort the checkout to prevent data loss.**
139
+ - **Check out the head branch locally.** Explorer agents read files from the working tree, not from git history — passing the commit range in the delegation prompt is not sufficient because `Read` / `Glob` / `Grep` tools operate on the filesystem. Without a checkout, explorers silently read the base branch's version of changed files and produce invalid candidates. **Before checking out, verify the working tree is clean (`git status --porcelain`). If tracked changes exist, call `prepare_pr_workflow_checkout` with every explicit dirty tracked path. It creates an auditable, path-scoped stash and returns its recovery command. Do not issue `git stash` through shell. The controller never stashes untracked files; move or remove those manually, or abort the checkout.**
140
140
  - Explicitly pass the verified merge-base range (`base_sha...pr_head_sha`) in every explorer delegation so explorers inspect exactly the controller-bound PR diff. Include `base_ref` only as the live ref used to recompute `base_sha`; do not substitute a two-dot branch-tip range.
141
141
 
142
142
  If refs cannot be fetched or checked out, state the limitation in the context pack.
@@ -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-3xd9a2g7.js";
16
+ import"./index-vcqwhe9d.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-gwss5btk.js";
8
8
  import"./index-rtry5xyf.js";
9
- import"./index-2bnfwmk3.js";
9
+ import"./index-nqp13m5a.js";
10
10
  import"./index-ae75rja9.js";
11
11
  import"./index-q27bajqb.js";
12
12
  import"./index-zgwm4ryv.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-d88y17ht.js";
5
+ import"./index-gxw20m1d.js";
6
+ import"./index-3xd9a2g7.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-7bxw3v5w.js";
12
+ import"./index-f97dm6tz.js";
13
+ import"./index-pf3xae4s.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-88dt7c9z.js";
19
+ import"./index-gwss5btk.js";
20
20
  import"./index-rtry5xyf.js";
21
- import"./index-2yd75hms.js";
22
- import"./index-2bnfwmk3.js";
21
+ import"./index-pb8ag9vg.js";
22
+ import"./index-nqp13m5a.js";
23
23
  import"./index-ae75rja9.js";
24
24
  import"./index-q27bajqb.js";
25
- import"./index-a1c9az5e.js";
25
+ import"./index-gf9cxvp0.js";
26
26
  import"./index-k5jrywpr.js";
27
27
  import"./index-n832052r.js";
28
- import"./index-r1gdkn2d.js";
28
+ import"./index-vcqwhe9d.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";
@@ -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-d88y17ht.js";
18
+ import"./index-gxw20m1d.js";
19
+ import"./index-3xd9a2g7.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-7bxw3v5w.js";
25
+ import"./index-f97dm6tz.js";
26
+ import"./index-pf3xae4s.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-88dt7c9z.js";
32
+ import"./index-gwss5btk.js";
33
33
  import"./index-rtry5xyf.js";
34
- import"./index-2yd75hms.js";
35
- import"./index-2bnfwmk3.js";
34
+ import"./index-pb8ag9vg.js";
35
+ import"./index-nqp13m5a.js";
36
36
  import"./index-ae75rja9.js";
37
37
  import"./index-q27bajqb.js";
38
- import"./index-a1c9az5e.js";
38
+ import"./index-gf9cxvp0.js";
39
39
  import"./index-k5jrywpr.js";
40
40
  import"./index-n832052r.js";
41
- import"./index-r1gdkn2d.js";
41
+ import"./index-vcqwhe9d.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,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-z8ftpav0.js";
5
+ import"./index-d88y17ht.js";
6
+ import"./index-gxw20m1d.js";
7
+ import"./index-3xd9a2g7.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-7bxw3v5w.js";
13
+ import"./index-f97dm6tz.js";
14
+ import"./index-pf3xae4s.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-88dt7c9z.js";
20
+ import"./index-gwss5btk.js";
21
21
  import"./index-rtry5xyf.js";
22
- import"./index-2yd75hms.js";
23
- import"./index-2bnfwmk3.js";
22
+ import"./index-pb8ag9vg.js";
23
+ import"./index-nqp13m5a.js";
24
24
  import"./index-ae75rja9.js";
25
25
  import"./index-q27bajqb.js";
26
- import"./index-a1c9az5e.js";
26
+ import"./index-gf9cxvp0.js";
27
27
  import"./index-k5jrywpr.js";
28
28
  import"./index-n832052r.js";
29
- import"./index-r1gdkn2d.js";
29
+ import"./index-vcqwhe9d.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-bf76q8q7.js";
5
+ import"./index-gxw20m1d.js";
6
+ import"./index-vcqwhe9d.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-d88y17ht.js";
11
+ import"./index-gxw20m1d.js";
12
+ import"./index-3xd9a2g7.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-7bxw3v5w.js";
18
+ import"./index-f97dm6tz.js";
19
+ import"./index-pf3xae4s.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-88dt7c9z.js";
25
+ import"./index-gwss5btk.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-pb8ag9vg.js";
30
+ import"./index-nqp13m5a.js";
31
31
  import"./index-ae75rja9.js";
32
32
  import"./index-q27bajqb.js";
33
- import"./index-a1c9az5e.js";
33
+ import"./index-gf9cxvp0.js";
34
34
  import"./index-k5jrywpr.js";
35
35
  import"./index-n832052r.js";
36
- import"./index-r1gdkn2d.js";
36
+ import"./index-vcqwhe9d.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";
@@ -8,7 +8,7 @@ import {
8
8
  init_constants,
9
9
  init_schema,
10
10
  stripKnownSwarmPrefix
11
- } from "./index-r1gdkn2d.js";
11
+ } from "./index-vcqwhe9d.js";
12
12
  import {
13
13
  log
14
14
  } from "./index-zgwm4ryv.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,10 +1,10 @@
1
1
  // @bun
2
2
  import {
3
3
  handleGuardrailExplain
4
- } from "./index-y4ry07h8.js";
4
+ } from "./index-z8ftpav0.js";
5
5
  import {
6
6
  handleGuardrailLog
7
- } from "./index-qzkcy22e.js";
7
+ } from "./index-bf76q8q7.js";
8
8
  import {
9
9
  COMMAND_REGISTRY,
10
10
  SWARM_COMMAND_TOOL_ALLOWLIST,
@@ -83,28 +83,28 @@ import {
83
83
  handleWriteRetroCommand,
84
84
  normalizeSwarmCommandInput,
85
85
  resolveCommand
86
- } from "./index-0ff5cm9j.js";
87
- import"./index-dezgmvtw.js";
88
- import"./index-jt7hnr7q.js";
86
+ } from "./index-d88y17ht.js";
87
+ import"./index-gxw20m1d.js";
88
+ import"./index-3xd9a2g7.js";
89
89
  import"./index-kk1scggc.js";
90
90
  import"./index-4905hd2m.js";
91
91
  import"./index-134d35c1.js";
92
92
  import"./index-6n2jpz7x.js";
93
- import"./index-yfzn5r9s.js";
94
- import"./index-bcgfhxzv.js";
95
- import"./index-cdx337js.js";
93
+ import"./index-7bxw3v5w.js";
94
+ import"./index-f97dm6tz.js";
95
+ import"./index-pf3xae4s.js";
96
96
  import"./index-vxv732ex.js";
97
97
  import"./index-c8s9a3zh.js";
98
98
  import"./index-9ss2m4rs.js";
99
99
  import"./index-23zsx7dm.js";
100
- import"./index-kwnsatzq.js";
101
- import"./index-mgrsx5hn.js";
100
+ import"./index-88dt7c9z.js";
101
+ import"./index-gwss5btk.js";
102
102
  import"./index-rtry5xyf.js";
103
- import"./index-2yd75hms.js";
104
- import"./index-2bnfwmk3.js";
103
+ import"./index-pb8ag9vg.js";
104
+ import"./index-nqp13m5a.js";
105
105
  import"./index-ae75rja9.js";
106
106
  import"./index-q27bajqb.js";
107
- import"./index-a1c9az5e.js";
107
+ import"./index-gf9cxvp0.js";
108
108
  import"./index-k5jrywpr.js";
109
109
  import"./index-n832052r.js";
110
110
  import {
@@ -113,14 +113,14 @@ import {
113
113
  init_constants,
114
114
  init_schema,
115
115
  stripKnownSwarmPrefix
116
- } from "./index-r1gdkn2d.js";
116
+ } from "./index-vcqwhe9d.js";
117
117
  import"./index-bk5tah7q.js";
118
118
  import"./index-8fwhhayc.js";
119
119
  import"./index-q1exe2b3.js";
120
- import"./index-gnvg72y1.js";
120
+ import"./index-4ff0x4cg.js";
121
121
  import"./index-2tn5h2zp.js";
122
122
  import"./index-1kz6da87.js";
123
- import"./index-g4ef4v3m.js";
123
+ import"./index-w9cb5zwh.js";
124
124
  import"./index-4rhhvd1a.js";
125
125
  import"./index-0cz1ws47.js";
126
126
  import"./index-2445sx3d.js";
@@ -2,18 +2,18 @@
2
2
  import {
3
3
  ALLOWED_SKILL_PATH_PREFIXES,
4
4
  validateSkillPath
5
- } from "./index-kwnsatzq.js";
5
+ } from "./index-88dt7c9z.js";
6
6
  import {
7
7
  computeOutcomeSignal,
8
8
  readKnowledge,
9
9
  resolveHiveKnowledgePath,
10
10
  resolveSwarmKnowledgePath,
11
11
  transactKnowledge
12
- } from "./index-2yd75hms.js";
12
+ } from "./index-pb8ag9vg.js";
13
13
  import {
14
14
  effectiveRetrievalOutcomes,
15
15
  readKnowledgeCounterRollups
16
- } from "./index-2bnfwmk3.js";
16
+ } from "./index-nqp13m5a.js";
17
17
  import {
18
18
  init_knowledge_types,
19
19
  isActiveStatus
@@ -1,7 +1,7 @@
1
1
  // @bun
2
2
  import {
3
3
  authorizeCuration
4
- } from "./index-mgrsx5hn.js";
4
+ } from "./index-gwss5btk.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-pb8ag9vg.js";
13
13
  import {
14
14
  resolveKnowledgeStoreDir
15
15
  } from "./index-q27bajqb.js";
@@ -2,7 +2,7 @@
2
2
  import {
3
3
  redactPath,
4
4
  redactShellCommand
5
- } from "./index-dezgmvtw.js";
5
+ } from "./index-gxw20m1d.js";
6
6
 
7
7
  // src/services/guardrail-log-service.ts
8
8
  import * as fs from "fs/promises";