opencode-swarm 7.136.0 → 7.136.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 (68) hide show
  1. package/.opencode/skills/swarm-pr-feedback/SKILL.md +41 -1
  2. package/.opencode/skills/swarm-pr-review/SKILL.md +83 -24
  3. package/README.md +18 -0
  4. package/dist/background/candidate-contract.d.ts +13 -0
  5. package/dist/background/workspace-snapshot.d.ts +54 -0
  6. package/dist/cli/{config-doctor-q0krbxwv.js → config-doctor-b67nb84b.js} +2 -2
  7. package/dist/cli/{curation-policy-v6ywe8qd.js → curation-policy-kvzhfaj1.js} +2 -2
  8. package/dist/cli/{curator-llm-factory-mhwje8rf.js → curator-llm-factory-x7kvry9x.js} +17 -14
  9. package/dist/cli/{curator-tqedvpy1.js → curator-nrmj8bds.js} +17 -14
  10. package/dist/cli/{evidence-summary-service-w006jnpg.js → evidence-summary-service-cf8sz2bq.js} +3 -1
  11. package/dist/cli/{guardrail-explain-m0m74hvr.js → guardrail-explain-5kd44rcj.js} +18 -15
  12. package/dist/cli/{guardrail-log-5g8x6qc6.js → guardrail-log-aksrzqdx.js} +3 -3
  13. package/dist/cli/hashing-mjwn6j4y.js +34 -0
  14. package/dist/cli/{hive-promoter-s804newd.js → hive-promoter-cy21rhnd.js} +17 -14
  15. package/dist/cli/{index-n8j0cnp1.js → index-0755132s.js} +4 -4
  16. package/dist/cli/{index-1kjg590p.js → index-1kn24ja0.js} +1 -1
  17. package/dist/cli/{index-j08trvny.js → index-21115szq.js} +5 -5
  18. package/dist/cli/{index-2cv1j3rf.js → index-37v2wxqe.js} +1 -1
  19. package/dist/cli/{index-cfz5750k.js → index-7ayaq27q.js} +5 -1
  20. package/dist/cli/{index-9bk16zkv.js → index-84nz7bhe.js} +1 -1
  21. package/dist/cli/{index-bwfzq91q.js → index-ad6j0m7k.js} +12 -6
  22. package/dist/cli/{index-qh9466j3.js → index-azghvnja.js} +2 -2
  23. package/dist/cli/{index-cxq1t7j1.js → index-ckybsn6p.js} +19 -16
  24. package/dist/cli/{index-cggqh2dz.js → index-kwwxevne.js} +53 -996
  25. package/dist/cli/{index-nw9cn84t.js → index-m5fw4mer.js} +19 -2
  26. package/dist/cli/{index-2w4tsmva.js → index-rw3f73aq.js} +1 -1
  27. package/dist/cli/{index-wpqypdge.js → index-s0rbdp61.js} +2 -2
  28. package/dist/cli/{index-bbejqagj.js → index-s0vahtdm.js} +1 -1
  29. package/dist/cli/{index-81dkzncr.js → index-sr2cynyw.js} +4535 -2325
  30. package/dist/cli/index-wjm896ey.js +1100 -0
  31. package/dist/cli/{index-w58bmwyq.js → index-wnz282j3.js} +2 -2
  32. package/dist/cli/{index-y6a7gjtj.js → index-wsdnttf4.js} +228 -81
  33. package/dist/cli/{index-m1hew17b.js → index-y0xaq4f3.js} +39 -4
  34. package/dist/cli/index-y8552snf.js +264 -0
  35. package/dist/cli/index-z1tm47nj.js +783 -0
  36. package/dist/cli/index.js +17 -14
  37. package/dist/cli/{knowledge-escalator-f1m2xp5x.js → knowledge-escalator-ta3xjrdj.js} +3 -3
  38. package/dist/cli/{knowledge-events-rksgem6f.js → knowledge-events-dk6banmz.js} +1 -1
  39. package/dist/cli/{knowledge-store-t6d6fr8b.js → knowledge-store-h3jz10bv.js} +1 -1
  40. package/dist/cli/{knowledge-validator-5ggzb3j1.js → knowledge-validator-jsz1dxkr.js} +4 -4
  41. package/dist/cli/runner-2v413r74.js +21 -0
  42. package/dist/cli/{scan-cursor-18fnwr58.js → scan-cursor-48gwzh9c.js} +2 -2
  43. package/dist/cli/{schema-jw15d8bt.js → schema-f937b9cs.js} +5 -1
  44. package/dist/cli/{skill-generator-3n5y902z.js → skill-generator-4p10ktw1.js} +5 -5
  45. package/dist/cli/{workspace-snapshot-jmyamqnv.js → workspace-snapshot-h5rzw37b.js} +5 -1
  46. package/dist/commands/registry.d.ts +72 -0
  47. package/dist/commands/skill-opt.d.ts +41 -0
  48. package/dist/config/schema.d.ts +47 -0
  49. package/dist/hooks/guardrails/file-authority.d.ts +11 -2
  50. package/dist/hooks/pr-workflow-gate.d.ts +261 -4
  51. package/dist/hooks/pr-workflow-response-gate.d.ts +27 -9
  52. package/dist/hooks/write-target-resolver.d.ts +19 -0
  53. package/dist/index.js +355 -320
  54. package/dist/services/skill-evaluator.d.ts +17 -0
  55. package/dist/services/skill-optimizer/activation.d.ts +58 -0
  56. package/dist/services/skill-optimizer/candidates.d.ts +88 -0
  57. package/dist/services/skill-optimizer/controller.d.ts +146 -0
  58. package/dist/services/skill-optimizer/deterministic-seed.d.ts +29 -0
  59. package/dist/services/skill-optimizer/lifecycle.d.ts +70 -0
  60. package/dist/services/skill-optimizer/promoted-external-staleness.d.ts +98 -0
  61. package/dist/services/skill-optimizer/retirement.d.ts +54 -0
  62. package/dist/services/skill-optimizer/skill-eval-tasks.d.ts +47 -0
  63. package/dist/services/skill-optimizer/smoke.d.ts +46 -0
  64. package/dist/services/skill-optimizer/store.d.ts +118 -0
  65. package/dist/tools/write-pr-review-trigger-eval.d.ts +2 -1
  66. package/dist/utils/stable-stringify.d.ts +46 -0
  67. package/evaluation-fixtures/skill-eval/scoring/score-skill-eval.cjs +97 -0
  68. package/package.json +1 -1
@@ -7,7 +7,7 @@ import {
7
7
  loadPluginConfigWithMeta,
8
8
  loadPluginConfigWithMetaAsync,
9
9
  resolveWorktreeIsolationConfig
10
- } from "./index-bbejqagj.js";
10
+ } from "./index-s0vahtdm.js";
11
11
  import {
12
12
  ApprovalEvidenceSchema,
13
13
  BaseEvidenceSchema,
@@ -54,7 +54,7 @@ import {
54
54
  TurboConfigSchema,
55
55
  WorktreeIsolationConfigSchema,
56
56
  resolveAutoReviewConfig
57
- } from "./index-m1hew17b.js";
57
+ } from "./index-y0xaq4f3.js";
58
58
  import"./index-bk5tah7q.js";
59
59
  import {
60
60
  MigrationStatusSchema,
@@ -9,11 +9,12 @@ import { createHash } from "crypto";
9
9
  import * as fs from "fs";
10
10
  import * as path from "path";
11
11
  var GIT_SNAPSHOT_TIMEOUT_MS = 3000;
12
- var GIT_SNAPSHOT_MAX_BUFFER = 512 * 1024;
13
- var REVISION_MAX_FILES = 5000;
14
- var REVISION_MAX_TOTAL_BYTES = 64 * 1024 * 1024;
12
+ var GIT_SNAPSHOT_MAX_BUFFER = 32 * 1024 * 1024;
13
+ var REVISION_MAX_FILES = 50000;
14
+ var REVISION_MAX_TOTAL_BYTES = 512 * 1024 * 1024;
15
15
  var REVISION_READ_CHUNK_BYTES = 64 * 1024;
16
16
  var REVISION_YIELD_EVERY_CHUNKS = 16;
17
+ var REVISION_ENUMERATION_TIMEOUT_MS = 15000;
17
18
  async function readBoundedGitOutput(stream, maxBytes, onOverflow) {
18
19
  const reader = stream.getReader();
19
20
  const chunks = [];
@@ -113,6 +114,78 @@ async function runGitAsync(directory, args, timeoutMs = _internals.gitTimeoutMs)
113
114
  } catch {}
114
115
  }
115
116
  }
117
+ function runGitDetailed(directory, args, timeoutMs) {
118
+ const result = _internals.spawnSync("git", ["-C", directory, ...args], {
119
+ cwd: directory,
120
+ encoding: "utf-8",
121
+ timeout: timeoutMs,
122
+ maxBuffer: _internals.gitSnapshotMaxBuffer,
123
+ stdio: ["ignore", "pipe", "pipe"]
124
+ });
125
+ const errorCode = result.error?.code;
126
+ if (errorCode === "ENOBUFS")
127
+ return { ok: false, reason: "buffer-truncated" };
128
+ if (errorCode === "ETIMEDOUT")
129
+ return { ok: false, reason: "timeout" };
130
+ if (result.error || result.status !== 0 || typeof result.stdout !== "string") {
131
+ return { ok: false, reason: "git-failed" };
132
+ }
133
+ return { ok: true, text: result.stdout.trimEnd() };
134
+ }
135
+ async function runGitAsyncDetailed(directory, args, timeoutMs) {
136
+ let proc;
137
+ let timeout;
138
+ try {
139
+ const options = {
140
+ cwd: directory,
141
+ stdin: "ignore",
142
+ stdout: "pipe",
143
+ stderr: "pipe",
144
+ killProcessTree: true
145
+ };
146
+ proc = _internals.bunSpawn(["git", "-C", directory, ...args], options);
147
+ let overflowed = false;
148
+ const stopOverflow = () => {
149
+ overflowed = true;
150
+ try {
151
+ proc?.kill("SIGKILL");
152
+ } catch {}
153
+ };
154
+ const maxBuffer = _internals.gitSnapshotMaxBuffer;
155
+ const completed = Promise.all([
156
+ proc.exited,
157
+ readBoundedGitOutput(proc.stdout, maxBuffer, stopOverflow),
158
+ readBoundedGitOutput(proc.stderr, maxBuffer, stopOverflow)
159
+ ]);
160
+ const result = await Promise.race([
161
+ completed.then(([exitCode, stdout, stderr]) => ({
162
+ kind: "completed",
163
+ exitCode,
164
+ stdout,
165
+ stderr
166
+ })),
167
+ new Promise((resolve2) => {
168
+ timeout = setTimeout(() => resolve2({ kind: "timeout" }), timeoutMs);
169
+ })
170
+ ]);
171
+ if (result.kind === "timeout")
172
+ return { ok: false, reason: "timeout" };
173
+ if (overflowed || result.stdout.truncated || result.stderr.truncated) {
174
+ return { ok: false, reason: "buffer-truncated" };
175
+ }
176
+ if (result.exitCode !== 0)
177
+ return { ok: false, reason: "git-failed" };
178
+ return { ok: true, text: result.stdout.text.trimEnd() };
179
+ } catch {
180
+ return { ok: false, reason: "git-failed" };
181
+ } finally {
182
+ if (timeout)
183
+ clearTimeout(timeout);
184
+ try {
185
+ proc?.kill("SIGKILL");
186
+ } catch {}
187
+ }
188
+ }
116
189
  function readGitTextAtRevision(directory, revision, relativePath) {
117
190
  if (!isSafeGitRevisionToken(revision) || !/^\.?(?:[A-Za-z0-9][A-Za-z0-9._-]*\/)*[A-Za-z0-9][A-Za-z0-9._-]*$/.test(relativePath) || relativePath.split("/").includes("..")) {
118
191
  return null;
@@ -529,44 +602,59 @@ async function switchPrFeedbackTrackingCandidateAsync(directory, candidate) {
529
602
  const output = await runGitAsync(directory, args);
530
603
  return output !== null;
531
604
  }
532
- function resolvePrWorkflowRevisionDigest(directory, baseHeadSha) {
605
+ function revisionDigestGitCallFailure(call, result) {
606
+ const description = result.reason === "timeout" ? "timed out" : result.reason === "buffer-truncated" ? "output exceeded the bounded buffer" : "failed";
607
+ return {
608
+ ok: false,
609
+ reason: result.reason,
610
+ detail: `git ${call} ${description}`
611
+ };
612
+ }
613
+ function resolvePrWorkflowRevisionDigestDetailed(directory, baseHeadSha) {
533
614
  const projectRoot = path.resolve(directory);
534
- const baseHead = runGit(projectRoot, [
535
- "rev-parse",
536
- "--verify",
537
- `${baseHeadSha}^{commit}`
538
- ]);
539
- const diffNames = runGit(projectRoot, [
540
- "diff",
541
- "--no-ext-diff",
542
- "--name-only",
543
- "-z",
544
- baseHeadSha
545
- ]);
546
- const porcelain = runGit(projectRoot, [
547
- "status",
548
- "--porcelain=v1",
549
- "-z",
550
- "--untracked-files=all"
551
- ]);
552
- if (!baseHead || diffNames === null || porcelain === null)
553
- return null;
554
- const porcelainPaths = parsePorcelainPaths(porcelain);
555
- if (!porcelainPaths)
556
- return null;
615
+ const baseHeadResult = runGitDetailed(projectRoot, ["rev-parse", "--verify", `${baseHeadSha}^{commit}`], _internals.gitTimeoutMs);
616
+ if (!baseHeadResult.ok) {
617
+ return revisionDigestGitCallFailure("rev-parse --verify", baseHeadResult);
618
+ }
619
+ const diffResult = runGitDetailed(projectRoot, ["diff", "--no-ext-diff", "--name-only", "-z", baseHeadSha], _internals.revisionEnumerationTimeoutMs);
620
+ if (!diffResult.ok) {
621
+ return revisionDigestGitCallFailure("diff --name-only", diffResult);
622
+ }
623
+ const porcelainResult = runGitDetailed(projectRoot, ["status", "--porcelain=v1", "-z", "--untracked-files=all"], _internals.revisionEnumerationTimeoutMs);
624
+ if (!porcelainResult.ok) {
625
+ return revisionDigestGitCallFailure("status --porcelain", porcelainResult);
626
+ }
627
+ const porcelainPaths = parsePorcelainPaths(porcelainResult.text);
628
+ if (!porcelainPaths) {
629
+ return {
630
+ ok: false,
631
+ reason: "git-failed",
632
+ detail: "malformed git status --porcelain=v1 output"
633
+ };
634
+ }
557
635
  const changedPaths = [
558
- ...new Set([...parseNulPaths(diffNames), ...porcelainPaths])
636
+ ...new Set([...parseNulPaths(diffResult.text), ...porcelainPaths])
559
637
  ].sort((left, right) => left.localeCompare(right));
560
- if (changedPaths.length > REVISION_MAX_FILES)
561
- return null;
638
+ if (changedPaths.length > _internals.revisionMaxFiles) {
639
+ return {
640
+ ok: false,
641
+ reason: "file-cap",
642
+ detail: `${changedPaths.length} changed paths exceed the cap of ${_internals.revisionMaxFiles}`
643
+ };
644
+ }
562
645
  const hash = createHash("sha256");
563
- hash.update(`base\x00${baseHead}\x00`);
646
+ hash.update(`base\x00${baseHeadResult.text}\x00`);
564
647
  let totalBytes = 0;
565
648
  for (const relativePath of changedPaths) {
566
649
  const resolvedPath = path.resolve(projectRoot, relativePath);
567
650
  const relativeToRoot = path.relative(projectRoot, resolvedPath);
568
- if (!relativeToRoot || relativeToRoot.startsWith("..") || path.isAbsolute(relativeToRoot))
569
- return null;
651
+ if (!relativeToRoot || relativeToRoot.startsWith("..") || path.isAbsolute(relativeToRoot)) {
652
+ return {
653
+ ok: false,
654
+ reason: "containment",
655
+ detail: `path escapes the project root: ${relativePath}`
656
+ };
657
+ }
570
658
  hash.update(`path\x00${relativePath}\x00`);
571
659
  let stats;
572
660
  try {
@@ -576,14 +664,22 @@ function resolvePrWorkflowRevisionDigest(directory, baseHeadSha) {
576
664
  hash.update("deleted\x00");
577
665
  continue;
578
666
  }
579
- return null;
667
+ return {
668
+ ok: false,
669
+ reason: "read-failed",
670
+ detail: `lstat failed for ${relativePath}`
671
+ };
580
672
  }
581
673
  if (stats.isSymbolicLink()) {
582
674
  try {
583
675
  hash.update(`symlink\x00${fs.readlinkSync(resolvedPath)}\x00`);
584
676
  continue;
585
677
  } catch {
586
- return null;
678
+ return {
679
+ ok: false,
680
+ reason: "read-failed",
681
+ detail: `readlink failed for ${relativePath}`
682
+ };
587
683
  }
588
684
  }
589
685
  if (!stats.isFile()) {
@@ -591,59 +687,79 @@ function resolvePrWorkflowRevisionDigest(directory, baseHeadSha) {
591
687
  continue;
592
688
  }
593
689
  totalBytes += stats.size;
594
- if (totalBytes > REVISION_MAX_TOTAL_BYTES)
595
- return null;
690
+ if (totalBytes > _internals.revisionMaxTotalBytes) {
691
+ return {
692
+ ok: false,
693
+ reason: "byte-cap",
694
+ detail: `accumulated content bytes ${totalBytes} exceed the cap of ${_internals.revisionMaxTotalBytes} at ${relativePath}`
695
+ };
696
+ }
596
697
  try {
597
698
  hash.update(`file\x00${stats.mode}\x00`);
598
- hash.update(fs.readFileSync(resolvedPath));
699
+ hash.update(_internals.readChangedFileSync(resolvedPath));
599
700
  hash.update("\x00");
600
701
  } catch {
601
- return null;
702
+ return {
703
+ ok: false,
704
+ reason: "read-failed",
705
+ detail: `read failed for ${relativePath}`
706
+ };
602
707
  }
603
708
  }
604
- return hash.digest("hex");
709
+ return { ok: true, digest: hash.digest("hex") };
605
710
  }
606
- async function resolvePrWorkflowRevisionDigestAsync(directory, baseHeadSha) {
711
+ function resolvePrWorkflowRevisionDigest(directory, baseHeadSha) {
712
+ const result = resolvePrWorkflowRevisionDigestDetailed(directory, baseHeadSha);
713
+ return result.ok ? result.digest : null;
714
+ }
715
+ async function resolvePrWorkflowRevisionDigestDetailedAsync(directory, baseHeadSha) {
607
716
  const projectRoot = path.resolve(directory);
608
- const [baseHead, diffNames, porcelain] = await Promise.all([
609
- runGitAsync(projectRoot, [
610
- "rev-parse",
611
- "--verify",
612
- `${baseHeadSha}^{commit}`
613
- ]),
614
- runGitAsync(projectRoot, [
615
- "diff",
616
- "--no-ext-diff",
617
- "--name-only",
618
- "-z",
619
- baseHeadSha
620
- ]),
621
- runGitAsync(projectRoot, [
622
- "status",
623
- "--porcelain=v1",
624
- "-z",
625
- "--untracked-files=all"
626
- ])
717
+ const [baseHeadResult, diffResult, porcelainResult] = await Promise.all([
718
+ runGitAsyncDetailed(projectRoot, ["rev-parse", "--verify", `${baseHeadSha}^{commit}`], _internals.gitTimeoutMs),
719
+ runGitAsyncDetailed(projectRoot, ["diff", "--no-ext-diff", "--name-only", "-z", baseHeadSha], _internals.revisionEnumerationTimeoutMs),
720
+ runGitAsyncDetailed(projectRoot, ["status", "--porcelain=v1", "-z", "--untracked-files=all"], _internals.revisionEnumerationTimeoutMs)
627
721
  ]);
628
- if (!baseHead || diffNames === null || porcelain === null)
629
- return null;
630
- const porcelainPaths = parsePorcelainPaths(porcelain);
631
- if (!porcelainPaths)
632
- return null;
722
+ if (!baseHeadResult.ok) {
723
+ return revisionDigestGitCallFailure("rev-parse --verify", baseHeadResult);
724
+ }
725
+ if (!diffResult.ok) {
726
+ return revisionDigestGitCallFailure("diff --name-only", diffResult);
727
+ }
728
+ if (!porcelainResult.ok) {
729
+ return revisionDigestGitCallFailure("status --porcelain", porcelainResult);
730
+ }
731
+ const porcelainPaths = parsePorcelainPaths(porcelainResult.text);
732
+ if (!porcelainPaths) {
733
+ return {
734
+ ok: false,
735
+ reason: "git-failed",
736
+ detail: "malformed git status --porcelain=v1 output"
737
+ };
738
+ }
633
739
  const changedPaths = [
634
- ...new Set([...parseNulPaths(diffNames), ...porcelainPaths])
740
+ ...new Set([...parseNulPaths(diffResult.text), ...porcelainPaths])
635
741
  ].sort((left, right) => left.localeCompare(right));
636
- if (changedPaths.length > REVISION_MAX_FILES)
637
- return null;
742
+ if (changedPaths.length > _internals.revisionMaxFiles) {
743
+ return {
744
+ ok: false,
745
+ reason: "file-cap",
746
+ detail: `${changedPaths.length} changed paths exceed the cap of ${_internals.revisionMaxFiles}`
747
+ };
748
+ }
638
749
  const hash = createHash("sha256");
639
- hash.update(`base\x00${baseHead}\x00`);
750
+ hash.update(`base\x00${baseHeadResult.text}\x00`);
640
751
  let totalBytes = 0;
641
752
  let chunksSinceYield = 0;
642
753
  for (const relativePath of changedPaths) {
643
754
  const resolvedPath = path.resolve(projectRoot, relativePath);
644
755
  const relativeToRoot = path.relative(projectRoot, resolvedPath);
645
- if (!relativeToRoot || relativeToRoot.startsWith("..") || path.isAbsolute(relativeToRoot))
646
- return null;
756
+ if (!relativeToRoot || relativeToRoot.startsWith("..") || path.isAbsolute(relativeToRoot)) {
757
+ return {
758
+ ok: false,
759
+ reason: "containment",
760
+ detail: `path escapes the project root: ${relativePath}`
761
+ };
762
+ }
647
763
  hash.update(`path\x00${relativePath}\x00`);
648
764
  let stats;
649
765
  try {
@@ -653,14 +769,22 @@ async function resolvePrWorkflowRevisionDigestAsync(directory, baseHeadSha) {
653
769
  hash.update("deleted\x00");
654
770
  continue;
655
771
  }
656
- return null;
772
+ return {
773
+ ok: false,
774
+ reason: "read-failed",
775
+ detail: `lstat failed for ${relativePath}`
776
+ };
657
777
  }
658
778
  if (stats.isSymbolicLink()) {
659
779
  try {
660
780
  hash.update(`symlink\x00${await fs.promises.readlink(resolvedPath)}\x00`);
661
781
  continue;
662
782
  } catch {
663
- return null;
783
+ return {
784
+ ok: false,
785
+ reason: "read-failed",
786
+ detail: `readlink failed for ${relativePath}`
787
+ };
664
788
  }
665
789
  }
666
790
  if (!stats.isFile()) {
@@ -668,8 +792,13 @@ async function resolvePrWorkflowRevisionDigestAsync(directory, baseHeadSha) {
668
792
  continue;
669
793
  }
670
794
  totalBytes += stats.size;
671
- if (totalBytes > REVISION_MAX_TOTAL_BYTES)
672
- return null;
795
+ if (totalBytes > _internals.revisionMaxTotalBytes) {
796
+ return {
797
+ ok: false,
798
+ reason: "byte-cap",
799
+ detail: `accumulated content bytes ${totalBytes} exceed the cap of ${_internals.revisionMaxTotalBytes} at ${relativePath}`
800
+ };
801
+ }
673
802
  hash.update(`file\x00${stats.mode}\x00`);
674
803
  let handle;
675
804
  try {
@@ -678,8 +807,13 @@ async function resolvePrWorkflowRevisionDigestAsync(directory, baseHeadSha) {
678
807
  for (let position = 0;position < stats.size; ) {
679
808
  const length = Math.min(REVISION_READ_CHUNK_BYTES, stats.size - position);
680
809
  const { bytesRead } = await handle.read(buffer, 0, length, position);
681
- if (bytesRead <= 0)
682
- return null;
810
+ if (bytesRead <= 0) {
811
+ return {
812
+ ok: false,
813
+ reason: "read-failed",
814
+ detail: `short read for ${relativePath}`
815
+ };
816
+ }
683
817
  hash.update(buffer.subarray(0, bytesRead));
684
818
  position += bytesRead;
685
819
  chunksSinceYield++;
@@ -690,14 +824,22 @@ async function resolvePrWorkflowRevisionDigestAsync(directory, baseHeadSha) {
690
824
  }
691
825
  hash.update("\x00");
692
826
  } catch {
693
- return null;
827
+ return {
828
+ ok: false,
829
+ reason: "read-failed",
830
+ detail: `read failed for ${relativePath}`
831
+ };
694
832
  } finally {
695
833
  await handle?.close().catch(() => {
696
834
  return;
697
835
  });
698
836
  }
699
837
  }
700
- return hash.digest("hex");
838
+ return { ok: true, digest: hash.digest("hex") };
839
+ }
840
+ async function resolvePrWorkflowRevisionDigestAsync(directory, baseHeadSha) {
841
+ const result = await resolvePrWorkflowRevisionDigestDetailedAsync(directory, baseHeadSha);
842
+ return result.ok ? result.digest : null;
701
843
  }
702
844
  function parseNulPaths(output) {
703
845
  return output.split("\x00").filter((entry) => entry.length > 0);
@@ -906,7 +1048,12 @@ var _internals = {
906
1048
  bunSpawn,
907
1049
  gitTimeoutMs: GIT_SNAPSHOT_TIMEOUT_MS,
908
1050
  yieldControl: () => new Promise((resolve2) => setImmediate(resolve2)),
909
- parsePorcelainV2Snapshot
1051
+ parsePorcelainV2Snapshot,
1052
+ revisionMaxFiles: REVISION_MAX_FILES,
1053
+ revisionMaxTotalBytes: REVISION_MAX_TOTAL_BYTES,
1054
+ gitSnapshotMaxBuffer: GIT_SNAPSHOT_MAX_BUFFER,
1055
+ revisionEnumerationTimeoutMs: REVISION_ENUMERATION_TIMEOUT_MS,
1056
+ readChangedFileSync: (filePath) => fs.readFileSync(filePath)
910
1057
  };
911
1058
 
912
- export { readGitTextAtRevision, resolveCurrentGitHead, resolveCurrentGitHeadAsync, resolveExactMergeBase, resolveExactMergeBaseAsync, resolvePrReviewDiffStats, resolvePrReviewDiffStatsAsync, resolveCurrentUpstreamRemoteRef, resolveCurrentUpstreamPushTarget, resolveCurrentUpstreamPushTargetAsync, resolveExactRemoteBranchHead, resolveExactRemoteBranchHeadAsync, resolveGitControlStateDigest, resolveGitControlStateDigestAsync, resolveIsWorkingTreeClean, resolveIsWorkingTreeCleanAsync, resolveCommitCountSince, resolveCommitCountSinceAsync, resolveIsExactSingleChildCommit, resolveIsExactSingleChildCommitAsync, resolveRemoteRefsContainingHead, resolveRemoteRefsContainingHeadAsync, resolvePrFeedbackTrackingCandidatesAsync, switchPrFeedbackTrackingCandidateAsync, resolvePrWorkflowRevisionDigest, resolvePrWorkflowRevisionDigestAsync, parsePorcelainPaths, parsePorcelainV2Snapshot, captureWorkspaceSnapshot, changedFilesSinceSnapshot, workspaceSnapshotMatches, compareWorkspaceSnapshot, compareWorkspaceSnapshots, digest, _internals };
1059
+ export { readGitTextAtRevision, resolveCurrentGitHead, resolveCurrentGitHeadAsync, resolveExactMergeBase, resolveExactMergeBaseAsync, resolvePrReviewDiffStats, resolvePrReviewDiffStatsAsync, resolveCurrentUpstreamRemoteRef, resolveCurrentUpstreamPushTarget, resolveCurrentUpstreamPushTargetAsync, resolveExactRemoteBranchHead, resolveExactRemoteBranchHeadAsync, resolveGitControlStateDigest, resolveGitControlStateDigestAsync, resolveIsWorkingTreeClean, resolveIsWorkingTreeCleanAsync, resolveCommitCountSince, resolveCommitCountSinceAsync, resolveIsExactSingleChildCommit, resolveIsExactSingleChildCommitAsync, resolveRemoteRefsContainingHead, resolveRemoteRefsContainingHeadAsync, resolvePrFeedbackTrackingCandidatesAsync, switchPrFeedbackTrackingCandidateAsync, resolvePrWorkflowRevisionDigestDetailed, resolvePrWorkflowRevisionDigest, resolvePrWorkflowRevisionDigestDetailedAsync, resolvePrWorkflowRevisionDigestAsync, parsePorcelainPaths, parsePorcelainV2Snapshot, captureWorkspaceSnapshot, changedFilesSinceSnapshot, workspaceSnapshotMatches, compareWorkspaceSnapshot, compareWorkspaceSnapshots, digest, _internals };
@@ -21,7 +21,7 @@ var package_default;
21
21
  var init_package = __esm(() => {
22
22
  package_default = {
23
23
  name: "opencode-swarm",
24
- version: "7.136.0",
24
+ version: "7.136.2",
25
25
  description: "Architect-centric agentic swarm plugin for OpenCode - hub-and-spoke orchestration with SME consultation, code generation, and QA review",
26
26
  main: "dist/index.js",
27
27
  types: "dist/index.d.ts",
@@ -280,7 +280,7 @@ function resolveExternalSkillsConfig(input) {
280
280
  };
281
281
  return merged;
282
282
  }
283
- var _internals, SEPARATORS, CANONICAL_ROLES_LONGEST_FIRST, CANONICAL_ROLES_SET, AgentReasoningConfigSchema, AgentThinkingConfigSchema, FALLBACK_MODELS_MAX = 3, AgentOverrideConfigSchema, SwarmConfigSchema, ModelPricingConfigSchema, PricingConfigSchema, HooksConfigSchema, ScoringWeightsSchema, DecisionDecaySchema, TokenRatiosSchema, ScoringConfigSchema, ContextBudgetConfigSchema, EvidenceConfigSchema, GateFeatureSchema, PlaceholderScanConfigSchema, QualityBudgetConfigSchema, GATE_CONFIG_KNOWN_SECTION_KEYS, GateConfigSchema, PipelineConfigSchema, PhaseCompleteConfigSchema, SummaryConfigSchema, ReviewPassesConfigSchema, AUTO_REVIEW_V8_BURN_IN_DECISION, AutoReviewFinalConfigSchema, AutoReviewConfigObjectSchema, AutoReviewConfigSchema, AdversarialDetectionConfigSchema, AdversarialTestingConfigSchemaBase, AdversarialTestingConfigSchema, IntegrationAnalysisConfigSchema, DocsConfigSchema, DesignDocsConfigSchema, UIReviewConfigSchema, CompactionAdvisoryConfigSchema, LintConfigSchema, SecretscanConfigSchema, GuardrailsProfileSchema, DEFAULT_AGENT_PROFILES, DEFAULT_ARCHITECT_PROFILE, GuardrailsConfigSchema, WatchdogConfigSchema, SelfReviewConfigSchema, ToolFilterConfigSchema, PlanCursorConfigSchema, ContextMapConfigSchema, RepoGraphConfigSchema, INVALID_CHECKPOINT_PROTO_FIELD = "__swarm_invalid_checkpoint_proto__", FORBIDDEN_CHECKPOINT_CONFIG_KEYS, CheckpointConfigSchema, ApplyPatchConfigSchema, AutomationModeSchema, AutomationCapabilitiesSchema, AutomationConfigSchemaBase, AutomationConfigSchema, KnowledgeConfigSchema, LearningConfigSchema, ConsensusConfigSchema, MemoryConfigSchema, CuratorConfigSchema, ArchitecturalSupervisionConfigSchema, KnowledgeApplicationConfigSchema, SkillPropagationAudienceSchema, SkillPropagationConfigSchema, SkillImproverConfigSchema, SkillsConfigSchema, SpecWriterConfigSchema, SlopDetectorConfigSchema, IncrementalVerifyConfigSchema, CompactionConfigSchema, PrmConfigSchema, AgentAuthorityRuleSchema, AuthorityConfigSchema, GeneralCouncilMemberConfigSchema, GeneralCouncilConfigSchema, CouncilConfigSchema, PrMonitorConfigSchema, ParallelizationConfigSchema, WorktreeIsolationConfigSchema, LeanTurboConfigSchema, EpicConfigSchema, StandardTurboConfigSchema, LeanTurboStrategyConfigSchema, TurboConfigSchema, ExternalSkillCandidateSourceTypeSchema, ExternalSkillCandidateEvaluationVerdictSchema, DiscoverySourceSchema, ExternalSkillCandidateSchema, ExternalSkillsConfigSchema, DEFAULT_EXTERNAL_SKILLS_CONFIG, DEFAULT_SKILLS_CONFIG, PluginConfigSchema;
283
+ var _internals, SEPARATORS, CANONICAL_ROLES_LONGEST_FIRST, CANONICAL_ROLES_SET, AgentReasoningConfigSchema, AgentThinkingConfigSchema, FALLBACK_MODELS_MAX = 3, AgentOverrideConfigSchema, SwarmConfigSchema, ModelPricingConfigSchema, PricingConfigSchema, HooksConfigSchema, ScoringWeightsSchema, DecisionDecaySchema, TokenRatiosSchema, ScoringConfigSchema, ContextBudgetConfigSchema, EvidenceConfigSchema, GateFeatureSchema, PlaceholderScanConfigSchema, QualityBudgetConfigSchema, GATE_CONFIG_KNOWN_SECTION_KEYS, GateConfigSchema, PipelineConfigSchema, PhaseCompleteConfigSchema, SummaryConfigSchema, ReviewPassesConfigSchema, AUTO_REVIEW_V8_BURN_IN_DECISION, AutoReviewFinalConfigSchema, AutoReviewConfigObjectSchema, AutoReviewConfigSchema, AdversarialDetectionConfigSchema, AdversarialTestingConfigSchemaBase, AdversarialTestingConfigSchema, IntegrationAnalysisConfigSchema, DocsConfigSchema, DesignDocsConfigSchema, UIReviewConfigSchema, CompactionAdvisoryConfigSchema, LintConfigSchema, SecretscanConfigSchema, GuardrailsProfileSchema, DEFAULT_AGENT_PROFILES, DEFAULT_ARCHITECT_PROFILE, GuardrailsConfigSchema, WatchdogConfigSchema, SelfReviewConfigSchema, ToolFilterConfigSchema, PlanCursorConfigSchema, ContextMapConfigSchema, RepoGraphConfigSchema, INVALID_CHECKPOINT_PROTO_FIELD = "__swarm_invalid_checkpoint_proto__", FORBIDDEN_CHECKPOINT_CONFIG_KEYS, CheckpointConfigSchema, ApplyPatchConfigSchema, AutomationModeSchema, AutomationCapabilitiesSchema, AutomationConfigSchemaBase, AutomationConfigSchema, KnowledgeConfigSchema, LearningConfigSchema, ConsensusConfigSchema, MemoryConfigSchema, CuratorConfigSchema, ArchitecturalSupervisionConfigSchema, KnowledgeApplicationConfigSchema, SkillPropagationAudienceSchema, SkillPropagationConfigSchema, SkillImproverConfigSchema, SkillsConfigSchema, SkillOptConfigSchema, DEFAULT_SKILL_OPT_CONFIG, SpecWriterConfigSchema, SlopDetectorConfigSchema, IncrementalVerifyConfigSchema, CompactionConfigSchema, PrmConfigSchema, AgentAuthorityRuleSchema, AuthorityConfigSchema, GeneralCouncilMemberConfigSchema, GeneralCouncilConfigSchema, CouncilConfigSchema, PrMonitorConfigSchema, ParallelizationConfigSchema, WorktreeIsolationConfigSchema, LeanTurboConfigSchema, EpicConfigSchema, StandardTurboConfigSchema, LeanTurboStrategyConfigSchema, TurboConfigSchema, ExternalSkillCandidateSourceTypeSchema, ExternalSkillCandidateEvaluationVerdictSchema, DiscoverySourceSchema, ExternalSkillCandidateSchema, ExternalSkillsConfigSchema, DEFAULT_EXTERNAL_SKILLS_CONFIG, DEFAULT_SKILLS_CONFIG, PluginConfigSchema;
284
284
  var init_schema = __esm(() => {
285
285
  init_zod();
286
286
  init_package();
@@ -1216,6 +1216,40 @@ var init_schema = __esm(() => {
1216
1216
  SkillsConfigSchema = exports_external.object({
1217
1217
  enabled: exports_external.boolean().default(false)
1218
1218
  });
1219
+ SkillOptConfigSchema = exports_external.object({
1220
+ enabled: exports_external.boolean().default(false),
1221
+ max_rounds: exports_external.number().int().min(1).max(50).default(5),
1222
+ max_candidates_per_round: exports_external.number().int().min(1).max(20).default(3),
1223
+ max_validations_per_round: exports_external.number().int().min(1).max(10).default(1),
1224
+ max_round_time_ms: exports_external.number().int().min(1e4).max(86400000).default(3600000),
1225
+ max_tokens_per_round: exports_external.number().int().min(1000).max(2000000).default(50000),
1226
+ max_rejections: exports_external.number().int().min(1).max(50).default(5),
1227
+ max_inconclusive_rounds: exports_external.number().int().min(0).max(10).default(2),
1228
+ max_transient_retries: exports_external.number().int().min(0).max(20).default(5),
1229
+ convergence_non_improvements: exports_external.number().int().min(1).max(20).default(3),
1230
+ max_changed_lines: exports_external.number().int().min(1).max(2000).default(200),
1231
+ max_changed_bytes: exports_external.number().int().min(64).max(200000).default(20000),
1232
+ max_changed_sections: exports_external.number().int().min(1).max(40).default(6),
1233
+ deadband: exports_external.number().min(0).max(1).default(0),
1234
+ retirement_min_age_days: exports_external.number().int().min(1).max(3650).default(60)
1235
+ }).strict();
1236
+ DEFAULT_SKILL_OPT_CONFIG = {
1237
+ enabled: false,
1238
+ max_rounds: 5,
1239
+ max_candidates_per_round: 3,
1240
+ max_validations_per_round: 1,
1241
+ max_round_time_ms: 3600000,
1242
+ max_tokens_per_round: 50000,
1243
+ max_rejections: 5,
1244
+ max_inconclusive_rounds: 2,
1245
+ max_transient_retries: 5,
1246
+ convergence_non_improvements: 3,
1247
+ max_changed_lines: 200,
1248
+ max_changed_bytes: 20000,
1249
+ max_changed_sections: 6,
1250
+ deadband: 0,
1251
+ retirement_min_age_days: 60
1252
+ };
1219
1253
  SpecWriterConfigSchema = exports_external.object({
1220
1254
  enabled: exports_external.boolean().default(true),
1221
1255
  model: exports_external.string().nullable().default(null),
@@ -1742,8 +1776,9 @@ var init_schema = __esm(() => {
1742
1776
  })),
1743
1777
  pr_monitor: PrMonitorConfigSchema.optional(),
1744
1778
  external_skills: ExternalSkillsConfigSchema.optional(),
1745
- skills: SkillsConfigSchema.optional()
1779
+ skills: SkillsConfigSchema.optional(),
1780
+ skill_opt: SkillOptConfigSchema.optional()
1746
1781
  });
1747
1782
  });
1748
1783
 
1749
- export { init_package, package_default, _internals, isKnownCanonicalRole, getCanonicalAgentRole, resolveGeneratedAgentRole, stripKnownSwarmPrefix, AgentReasoningConfigSchema, AgentThinkingConfigSchema, FALLBACK_MODELS_MAX, AgentOverrideConfigSchema, SwarmConfigSchema, ModelPricingConfigSchema, PricingConfigSchema, HooksConfigSchema, ScoringWeightsSchema, DecisionDecaySchema, TokenRatiosSchema, ScoringConfigSchema, ContextBudgetConfigSchema, EvidenceConfigSchema, GateFeatureSchema, PlaceholderScanConfigSchema, QualityBudgetConfigSchema, GATE_CONFIG_KNOWN_SECTION_KEYS, GateConfigSchema, PipelineConfigSchema, PhaseCompleteConfigSchema, SummaryConfigSchema, ReviewPassesConfigSchema, AUTO_REVIEW_V8_BURN_IN_DECISION, AutoReviewConfigSchema, resolveAutoReviewConfig, AdversarialDetectionConfigSchema, AdversarialTestingConfigSchema, IntegrationAnalysisConfigSchema, DocsConfigSchema, DesignDocsConfigSchema, UIReviewConfigSchema, CompactionAdvisoryConfigSchema, LintConfigSchema, SecretscanConfigSchema, GuardrailsProfileSchema, DEFAULT_AGENT_PROFILES, DEFAULT_ARCHITECT_PROFILE, GuardrailsConfigSchema, WatchdogConfigSchema, SelfReviewConfigSchema, resolveGuardrailsConfig, ToolFilterConfigSchema, PlanCursorConfigSchema, ContextMapConfigSchema, RepoGraphConfigSchema, CheckpointConfigSchema, ApplyPatchConfigSchema, AutomationModeSchema, AutomationCapabilitiesSchema, AutomationConfigSchema, KnowledgeConfigSchema, LearningConfigSchema, ConsensusConfigSchema, MemoryConfigSchema, CuratorConfigSchema, ArchitecturalSupervisionConfigSchema, KnowledgeApplicationConfigSchema, SkillPropagationConfigSchema, SkillImproverConfigSchema, SkillsConfigSchema, SpecWriterConfigSchema, SlopDetectorConfigSchema, IncrementalVerifyConfigSchema, CompactionConfigSchema, PrmConfigSchema, AgentAuthorityRuleSchema, AuthorityConfigSchema, GeneralCouncilConfigSchema, CouncilConfigSchema, PrMonitorConfigSchema, ParallelizationConfigSchema, WorktreeIsolationConfigSchema, LeanTurboConfigSchema, EpicConfigSchema, StandardTurboConfigSchema, LeanTurboStrategyConfigSchema, TurboConfigSchema, ExternalSkillCandidateSourceTypeSchema, ExternalSkillCandidateEvaluationVerdictSchema, DiscoverySourceSchema, ExternalSkillCandidateSchema, ExternalSkillsConfigSchema, DEFAULT_EXTERNAL_SKILLS_CONFIG, DEFAULT_SKILLS_CONFIG, resolveExternalSkillsConfig, PluginConfigSchema, init_schema };
1784
+ export { init_package, package_default, _internals, isKnownCanonicalRole, getCanonicalAgentRole, resolveGeneratedAgentRole, stripKnownSwarmPrefix, AgentReasoningConfigSchema, AgentThinkingConfigSchema, FALLBACK_MODELS_MAX, AgentOverrideConfigSchema, SwarmConfigSchema, ModelPricingConfigSchema, PricingConfigSchema, HooksConfigSchema, ScoringWeightsSchema, DecisionDecaySchema, TokenRatiosSchema, ScoringConfigSchema, ContextBudgetConfigSchema, EvidenceConfigSchema, GateFeatureSchema, PlaceholderScanConfigSchema, QualityBudgetConfigSchema, GATE_CONFIG_KNOWN_SECTION_KEYS, GateConfigSchema, PipelineConfigSchema, PhaseCompleteConfigSchema, SummaryConfigSchema, ReviewPassesConfigSchema, AUTO_REVIEW_V8_BURN_IN_DECISION, AutoReviewConfigSchema, resolveAutoReviewConfig, AdversarialDetectionConfigSchema, AdversarialTestingConfigSchema, IntegrationAnalysisConfigSchema, DocsConfigSchema, DesignDocsConfigSchema, UIReviewConfigSchema, CompactionAdvisoryConfigSchema, LintConfigSchema, SecretscanConfigSchema, GuardrailsProfileSchema, DEFAULT_AGENT_PROFILES, DEFAULT_ARCHITECT_PROFILE, GuardrailsConfigSchema, WatchdogConfigSchema, SelfReviewConfigSchema, resolveGuardrailsConfig, ToolFilterConfigSchema, PlanCursorConfigSchema, ContextMapConfigSchema, RepoGraphConfigSchema, CheckpointConfigSchema, ApplyPatchConfigSchema, AutomationModeSchema, AutomationCapabilitiesSchema, AutomationConfigSchema, KnowledgeConfigSchema, LearningConfigSchema, ConsensusConfigSchema, MemoryConfigSchema, CuratorConfigSchema, ArchitecturalSupervisionConfigSchema, KnowledgeApplicationConfigSchema, SkillPropagationConfigSchema, SkillImproverConfigSchema, SkillsConfigSchema, SkillOptConfigSchema, DEFAULT_SKILL_OPT_CONFIG, SpecWriterConfigSchema, SlopDetectorConfigSchema, IncrementalVerifyConfigSchema, CompactionConfigSchema, PrmConfigSchema, AgentAuthorityRuleSchema, AuthorityConfigSchema, GeneralCouncilConfigSchema, CouncilConfigSchema, PrMonitorConfigSchema, ParallelizationConfigSchema, WorktreeIsolationConfigSchema, LeanTurboConfigSchema, EpicConfigSchema, StandardTurboConfigSchema, LeanTurboStrategyConfigSchema, TurboConfigSchema, ExternalSkillCandidateSourceTypeSchema, ExternalSkillCandidateEvaluationVerdictSchema, DiscoverySourceSchema, ExternalSkillCandidateSchema, ExternalSkillsConfigSchema, DEFAULT_EXTERNAL_SKILLS_CONFIG, DEFAULT_SKILLS_CONFIG, resolveExternalSkillsConfig, PluginConfigSchema, init_schema };