opencode-swarm 7.196.0 → 7.197.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 (129) hide show
  1. package/.opencode/skills/brainstorm/SKILL.md +2 -1
  2. package/.opencode/skills/ci-failure-batching/SKILL.md +2 -1
  3. package/.opencode/skills/ci-fix-monitor/SKILL.md +2 -1
  4. package/.opencode/skills/clarify/SKILL.md +2 -1
  5. package/.opencode/skills/clarify-spec/SKILL.md +2 -1
  6. package/.opencode/skills/codebase-review-swarm/SKILL.md +1 -1
  7. package/.opencode/skills/commit-pr/SKILL.md +3 -2
  8. package/.opencode/skills/consult/SKILL.md +2 -1
  9. package/.opencode/skills/council/SKILL.md +2 -1
  10. package/.opencode/skills/critic-gate/SKILL.md +2 -1
  11. package/.opencode/skills/deep-dive/SKILL.md +2 -1
  12. package/.opencode/skills/deep-research/SKILL.md +2 -1
  13. package/.opencode/skills/design-docs/SKILL.md +2 -1
  14. package/.opencode/skills/discover/SKILL.md +2 -1
  15. package/.opencode/skills/durable-session-state/SKILL.md +2 -1
  16. package/.opencode/skills/engineering-conventions/SKILL.md +2 -1
  17. package/.opencode/skills/execute/SKILL.md +2 -1
  18. package/.opencode/skills/fork-pr-operations/SKILL.md +2 -1
  19. package/.opencode/skills/gate-attribution/SKILL.md +2 -1
  20. package/.opencode/skills/issue-ingest/SKILL.md +2 -1
  21. package/.opencode/skills/issue-tracer/SKILL.md +1 -1
  22. package/.opencode/skills/loop/SKILL.md +2 -1
  23. package/.opencode/skills/merge-queue-readiness/SKILL.md +2 -1
  24. package/.opencode/skills/orchestrating-subagents/SKILL.md +2 -1
  25. package/.opencode/skills/parallel-work-check/SKILL.md +17 -16
  26. package/.opencode/skills/phase-wrap/SKILL.md +2 -1
  27. package/.opencode/skills/pre-phase-briefing/SKILL.md +2 -1
  28. package/.opencode/skills/running-tests/SKILL.md +2 -1
  29. package/.opencode/skills/skill-edit-validation/SKILL.md +2 -1
  30. package/.opencode/skills/specify/SKILL.md +2 -1
  31. package/.opencode/skills/swarm/SKILL.md +2 -1
  32. package/.opencode/skills/swarm-ci-monitor/SKILL.md +3 -2
  33. package/.opencode/skills/swarm-implement/SKILL.md +2 -1
  34. package/.opencode/skills/swarm-plan/SKILL.md +2 -1
  35. package/.opencode/skills/swarm-pr-feedback/SKILL.md +9 -162
  36. package/.opencode/skills/swarm-pr-feedback/references/gate-evidence-scope.md +20 -0
  37. package/.opencode/skills/swarm-pr-feedback/references/intake-surfaces.md +107 -0
  38. package/.opencode/skills/swarm-pr-feedback/references/preflight-checkout.md +67 -0
  39. package/.opencode/skills/swarm-pr-review/SKILL.md +12 -344
  40. package/.opencode/skills/swarm-pr-review/references/council-mode.md +38 -0
  41. package/.opencode/skills/swarm-pr-review/references/explorer-output-format.md +54 -0
  42. package/.opencode/skills/swarm-pr-review/references/findings-persistence-detail.md +15 -0
  43. package/.opencode/skills/swarm-pr-review/references/parser-candidate-extraction.md +75 -0
  44. package/.opencode/skills/swarm-pr-review/references/phase0a-intake.md +61 -0
  45. package/.opencode/skills/swarm-pr-review/references/scope-detection.md +103 -0
  46. package/.opencode/skills/swarm-pr-review/references/writeback-phases.md +68 -0
  47. package/.opencode/skills/swarm-pr-subscribe/SKILL.md +3 -2
  48. package/.opencode/skills/swarm-resume/SKILL.md +2 -1
  49. package/.opencode/skills/test-file-split/SKILL.md +2 -1
  50. package/.opencode/skills/worktree-retry-cleanup/SKILL.md +2 -1
  51. package/.opencode/skills/writing-tests/SKILL.md +7 -437
  52. package/.opencode/skills/writing-tests/references/cross-platform-patterns.md +237 -0
  53. package/.opencode/skills/writing-tests/references/mock-tiers.md +207 -0
  54. package/binaries/win32-arm64/swarm-sandbox-runner.exe +0 -0
  55. package/binaries/win32-x64/swarm-sandbox-runner.exe +0 -0
  56. package/dist/cli/{auto-checkpoint-f00tk7sc.js → auto-checkpoint-1dv9a1w5.js} +4 -4
  57. package/dist/cli/{checkpoint-acztxqga.js → checkpoint-rkjb6kpr.js} +8 -8
  58. package/dist/cli/{coder-settlement-0ka4n1xf.js → coder-settlement-eavtvg8d.js} +3 -3
  59. package/dist/cli/{config-doctor-qv7wc6fa.js → config-doctor-4ck8e1fq.js} +7 -7
  60. package/dist/cli/{core-dmn3arr1.js → core-cyj0vphv.js} +1 -1
  61. package/dist/cli/{curator-drift-sxzs48ew.js → curator-drift-15mcxawb.js} +5 -5
  62. package/dist/cli/{curator-llm-factory-cvrt4bf9.js → curator-llm-factory-k0yebhsk.js} +25 -25
  63. package/dist/cli/{curator-891pc8b7.js → curator-p1r777m5.js} +25 -25
  64. package/dist/cli/{doctor-knowledge-receipt-phase-id-mvbj576e.js → doctor-knowledge-receipt-phase-id-k204028d.js} +4 -4
  65. package/dist/cli/{evidence-summary-service-x9nxvmn5.js → evidence-summary-service-4mx5ge81.js} +9 -9
  66. package/dist/cli/{gate-evidence-dxd20wrc.js → gate-evidence-pa8qadxh.js} +2 -2
  67. package/dist/cli/{guardrail-explain-fga9bnvt.js → guardrail-explain-pba5em4h.js} +26 -26
  68. package/dist/cli/{guardrail-log-y84b9m8n.js → guardrail-log-24fbykv3.js} +3 -3
  69. package/dist/cli/{guardrail-reset-xpcsxyt0.js → guardrail-reset-rfnr2vnn.js} +25 -25
  70. package/dist/cli/{hive-promoter-w1vchgfr.js → hive-promoter-0ht8jafr.js} +25 -25
  71. package/dist/cli/{index-hjma52c8.js → index-0sw6gjtn.js} +3 -3
  72. package/dist/cli/{index-mt5t492g.js → index-3h4tajza.js} +2 -2
  73. package/dist/cli/{index-t5med3ga.js → index-528gk6k1.js} +1 -1
  74. package/dist/cli/{index-nrqyc8pr.js → index-56n6nb7p.js} +25 -25
  75. package/dist/cli/{index-bjaef5zn.js → index-57g7yqx9.js} +390 -233
  76. package/dist/cli/{index-jnjvghgp.js → index-6g81mmmy.js} +4 -4
  77. package/dist/cli/{index-8bsnnnj2.js → index-9rqvm5sk.js} +2 -2
  78. package/dist/cli/{index-ryjp0wmq.js → index-9vwsvgzp.js} +1 -1
  79. package/dist/cli/{index-knxq5byr.js → index-a9bs0c71.js} +1 -1
  80. package/dist/cli/{index-3hpjqa6y.js → index-d0m3snqt.js} +1 -1
  81. package/dist/cli/{index-7zkgdefv.js → index-d483e4gz.js} +3 -3
  82. package/dist/cli/{index-sgt1d7ez.js → index-efen9p4c.js} +1 -1
  83. package/dist/cli/{index-w3mav870.js → index-f0d3z2ha.js} +2 -2
  84. package/dist/cli/{index-wscg5ryb.js → index-fmgkemn9.js} +1 -1
  85. package/dist/cli/{index-svbh91pz.js → index-h69nppa3.js} +1 -1
  86. package/dist/cli/{index-391ydd25.js → index-hyxw4j9t.js} +1 -1
  87. package/dist/cli/{index-41p9zzpe.js → index-kah11mjw.js} +153 -52
  88. package/dist/cli/{index-nqxbqb50.js → index-mwh6srje.js} +1 -1
  89. package/dist/cli/{index-psqfkgav.js → index-pek9gmwm.js} +3 -3
  90. package/dist/cli/{index-31b55cq9.js → index-pywrvjxj.js} +3 -3
  91. package/dist/cli/{index-2grr37ry.js → index-qae4572e.js} +1 -1
  92. package/dist/cli/{index-tzasccpd.js → index-qqe9tt5y.js} +1 -1
  93. package/dist/cli/{index-4cazf4kb.js → index-r9ab1sat.js} +27 -27
  94. package/dist/cli/{index-174j0g38.js → index-rqbhn0mh.js} +2 -2
  95. package/dist/cli/{index-te61qv0q.js → index-syrktqz9.js} +2 -2
  96. package/dist/cli/{index-3drq02r1.js → index-t4nxee8x.js} +1 -1
  97. package/dist/cli/{index-ppnpkww2.js → index-tstk9xx7.js} +1 -1
  98. package/dist/cli/{index-tjc68trf.js → index-vanjqbhp.js} +5 -5
  99. package/dist/cli/{index-vsa05smc.js → index-xtb61w73.js} +1 -1
  100. package/dist/cli/{index-7gqmqhzj.js → index-z5rkkhng.js} +6 -6
  101. package/dist/cli/index.js +26 -26
  102. package/dist/cli/{knowledge-escalator-2dy96d0j.js → knowledge-escalator-89crpby4.js} +7 -7
  103. package/dist/cli/{knowledge-events-70kb745b.js → knowledge-events-eyratqdp.js} +5 -5
  104. package/dist/cli/{knowledge-store-hvq03g0j.js → knowledge-store-kkwds05z.js} +1 -1
  105. package/dist/cli/{knowledge-validator-eaatcnkr.js → knowledge-validator-fww6p37v.js} +2 -2
  106. package/dist/cli/{mcp-bj3awdfy.js → mcp-8t3m998m.js} +1 -1
  107. package/dist/cli/{model-preflight-skhq4xtr.js → model-preflight-98g183my.js} +25 -25
  108. package/dist/cli/{pending-delegations-yamzv468.js → pending-delegations-qj5e0hh2.js} +2 -2
  109. package/dist/cli/{pr-subscriptions-hkzd0nr4.js → pr-subscriptions-edwd3syw.js} +1 -1
  110. package/dist/cli/{pr-workflow-gate-2gmznmj4.js → pr-workflow-gate-t8veygyh.js} +25 -25
  111. package/dist/cli/{scan-cursor-arezehhk.js → scan-cursor-0ffhpz79.js} +2 -2
  112. package/dist/cli/{schema-emx6r32d.js → schema-zytt0t7a.js} +1 -1
  113. package/dist/cli/{scope-persistence-tvr8w7ea.js → scope-persistence-p8a9a2xb.js} +5 -5
  114. package/dist/cli/{server-ez03wdw9.js → server-q4b9s64v.js} +25 -25
  115. package/dist/cli/{skill-generator-w0jy1mpc.js → skill-generator-wt7d640t.js} +8 -8
  116. package/dist/cli/{snapshot-coordination-init-2x56ds8a.js → snapshot-coordination-init-ywxyf130.js} +25 -25
  117. package/dist/cli/{speckit-checkoff-c2e5wezr.js → speckit-checkoff-y8na83hj.js} +3 -3
  118. package/dist/cli/{worktree-collision-ownership-1bgcea0v.js → worktree-collision-ownership-kssmhrpk.js} +2 -2
  119. package/dist/cli/{worktree-isolation-9xp4dz41.js → worktree-isolation-w6np680v.js} +25 -25
  120. package/dist/config/skill-contract-digest.d.ts +6 -0
  121. package/dist/hooks/pr-workflow-gate.d.ts +12 -0
  122. package/dist/hooks/pr-workflow-response-gate.d.ts +8 -0
  123. package/dist/hooks/skill-scoring.d.ts +1 -1
  124. package/dist/hooks/skill-usage-log.d.ts +2 -0
  125. package/dist/index.js +30 -28
  126. package/dist/pr-review/persistence.d.ts +18 -1
  127. package/dist/services/skill-evaluator.d.ts +2 -0
  128. package/dist/services/skill-generator.d.ts +13 -0
  129. package/package.json +1 -1
@@ -739,7 +739,7 @@ async function applyConfidenceFloorAction(directory, touched, options) {
739
739
  const {
740
740
  readAuthoritativeKnowledgeCounterRollups,
741
741
  effectiveRetrievalOutcomes
742
- } = await import("./knowledge-events-70kb745b.js");
742
+ } = await import("./knowledge-events-eyratqdp.js");
743
743
  const rollups = await readAuthoritativeKnowledgeCounterRollups(directory);
744
744
  const flagIds = new Set;
745
745
  for (const e of atFloor) {
@@ -806,11 +806,11 @@ async function applyConfidenceFloorAction(directory, touched, options) {
806
806
  });
807
807
  }
808
808
  if (action === "quarantine" && toQuarantine.length > 0) {
809
- const { quarantineEntry } = await import("./knowledge-validator-eaatcnkr.js");
810
- const { KnowledgeConfigSchema } = await import("./schema-emx6r32d.js");
809
+ const { quarantineEntry } = await import("./knowledge-validator-fww6p37v.js");
810
+ const { KnowledgeConfigSchema } = await import("./schema-zytt0t7a.js");
811
811
  let config;
812
812
  try {
813
- const { loadPluginConfigWithMeta } = await import("./index-psqfkgav.js");
813
+ const { loadPluginConfigWithMeta } = await import("./index-pek9gmwm.js");
814
814
  const { config: loadedConfig } = loadPluginConfigWithMeta(directory);
815
815
  config = KnowledgeConfigSchema.parse(loadedConfig.knowledge ?? {});
816
816
  } catch {
@@ -2,10 +2,10 @@
2
2
  import {
3
3
  init_loader,
4
4
  loadPluginConfigWithMeta
5
- } from "./index-ppnpkww2.js";
5
+ } from "./index-tstk9xx7.js";
6
6
  import {
7
7
  init_schema
8
- } from "./index-nqxbqb50.js";
8
+ } from "./index-mwh6srje.js";
9
9
  import {
10
10
  DEFAULT_WORKTREE_ISOLATION_CONFIG,
11
11
  init_constants
@@ -1,7 +1,7 @@
1
1
  // @bun
2
2
  import {
3
3
  writeSpeckitCheckoffLedger
4
- } from "./index-svbh91pz.js";
4
+ } from "./index-h69nppa3.js";
5
5
  import {
6
6
  validateSpecContent
7
7
  } from "./index-0725jpp7.js";
@@ -2,7 +2,7 @@
2
2
  import {
3
3
  readKnowledge,
4
4
  transactKnowledge
5
- } from "./index-jnjvghgp.js";
5
+ } from "./index-6g81mmmy.js";
6
6
  import {
7
7
  resolveKnowledgeStoreDir
8
8
  } from "./index-ry5g9s8d.js";
@@ -4,7 +4,7 @@ import {
4
4
  readShellAuditTail,
5
5
  redactPath,
6
6
  redactShellCommand
7
- } from "./index-t5med3ga.js";
7
+ } from "./index-528gk6k1.js";
8
8
 
9
9
  // src/services/guardrail-log-service.ts
10
10
  var BLOCK_TYPES = new Set([
@@ -14,7 +14,7 @@ import {
14
14
  reconcileLandedMerge,
15
15
  withTaskEvidenceTransaction,
16
16
  writeWorkflowWalFile
17
- } from "./index-3drq02r1.js";
17
+ } from "./index-t4nxee8x.js";
18
18
  import {
19
19
  validateSwarmPath
20
20
  } from "./index-kphy4we7.js";
@@ -512,7 +512,7 @@ async function cleanupRecoveredWorktree(directory, descriptor, options) {
512
512
  awaitingMergeByCallID,
513
513
  cleanupStandardWorktreeForCallId,
514
514
  standardWorktreeByCallID
515
- } = await import("./worktree-isolation-9xp4dz41.js");
515
+ } = await import("./worktree-isolation-w6np680v.js");
516
516
  standardWorktreeByCallID.delete(descriptor.callID);
517
517
  if (hasResidue)
518
518
  awaitingMergeByCallID.set(descriptor.callID, {
@@ -648,7 +648,7 @@ async function recoverCoderSettlement(directory, taskId) {
648
648
  awaitingMergeByCallID,
649
649
  finishStandardWorktreeDispatch,
650
650
  standardWorktreeByCallID
651
- } = await import("./worktree-isolation-9xp4dz41.js");
651
+ } = await import("./worktree-isolation-w6np680v.js");
652
652
  const descriptor = wal.worktree;
653
653
  const reconstructedDispatch = {
654
654
  callID: descriptor.callID,
@@ -1,7 +1,7 @@
1
1
  // @bun
2
2
  import {
3
3
  readEffectiveSpecSync
4
- } from "./index-ryjp0wmq.js";
4
+ } from "./index-9vwsvgzp.js";
5
5
  import {
6
6
  readSwarmFileAsync
7
7
  } from "./index-kphy4we7.js";
@@ -19,14 +19,14 @@ import {
19
19
  mergeWriteAnalyses,
20
20
  resolveWindowsWriteAuthority,
21
21
  resolveWriteTargets
22
- } from "./index-bjaef5zn.js";
22
+ } from "./index-57g7yqx9.js";
23
23
  import {
24
24
  checkFileAuthority,
25
25
  classifyFile,
26
26
  isInDeclaredScope,
27
27
  redactPath,
28
28
  redactShellCommand
29
- } from "./index-t5med3ga.js";
29
+ } from "./index-528gk6k1.js";
30
30
 
31
31
  // src/services/guardrail-explain-service.ts
32
32
  import path from "path";
@@ -9,7 +9,7 @@ import {
9
9
  resolveSwarmKnowledgePath,
10
10
  resolveSwarmRejectedPath,
11
11
  transactKnowledge
12
- } from "./index-jnjvghgp.js";
12
+ } from "./index-6g81mmmy.js";
13
13
  import {
14
14
  resolveKnowledgeStoreDir
15
15
  } from "./index-ry5g9s8d.js";
@@ -9,7 +9,7 @@ import {
9
9
  import {
10
10
  init_loader,
11
11
  loadPluginConfig
12
- } from "./index-ppnpkww2.js";
12
+ } from "./index-tstk9xx7.js";
13
13
  import {
14
14
  init_logger,
15
15
  log,
@@ -242,7 +242,7 @@ var _internals2 = {
242
242
  symlinkSync: fs2.symlinkSync
243
243
  },
244
244
  writeScopeToDisk: async (directory, taskId, files) => {
245
- const { writeScopeToDisk: realWrite } = await import("./scope-persistence-tvr8w7ea.js");
245
+ const { writeScopeToDisk: realWrite } = await import("./scope-persistence-p8a9a2xb.js");
246
246
  return realWrite(directory, taskId, files);
247
247
  },
248
248
  writeLaneProfileToDisk: async (_worktreePath, _laneIndex, _envOverrides) => {
@@ -5,18 +5,18 @@ import {
5
5
  import {
6
6
  effectiveRetrievalOutcomes,
7
7
  readAuthoritativeKnowledgeCounterRollups
8
- } from "./index-mt5t492g.js";
8
+ } from "./index-3h4tajza.js";
9
9
  import {
10
10
  ALLOWED_SKILL_PATH_PREFIXES,
11
11
  validateSkillPath
12
- } from "./index-wscg5ryb.js";
12
+ } from "./index-fmgkemn9.js";
13
13
  import {
14
14
  computeOutcomeSignal,
15
15
  readKnowledge,
16
16
  resolveHiveKnowledgePath,
17
17
  resolveSwarmKnowledgePath,
18
18
  transactKnowledge
19
- } from "./index-jnjvghgp.js";
19
+ } from "./index-6g81mmmy.js";
20
20
  import {
21
21
  appendCappedJsonl,
22
22
  resolveRetentionCap
@@ -405,6 +405,28 @@ async function syncBundledProjectSkillsIfMissingAsync(projectDirectory, packageR
405
405
  return syncPromise;
406
406
  }
407
407
 
408
+ // src/config/skill-contract-digest.ts
409
+ import { createHash } from "crypto";
410
+ function splitSkillFrontmatter(content) {
411
+ if (!content.startsWith(`---
412
+ `))
413
+ return { frontmatter: "", body: content };
414
+ const end = content.indexOf(`
415
+ ---
416
+ `, 4);
417
+ if (end === -1)
418
+ return { frontmatter: "", body: content };
419
+ return {
420
+ frontmatter: content.slice(0, end + 5),
421
+ body: content.slice(end + 5)
422
+ };
423
+ }
424
+ function skillContractDigest(body) {
425
+ const normalized = body.replace(/\r\n/g, `
426
+ `);
427
+ return createHash("sha256").update(normalized, "utf8").digest("hex").slice(0, 12);
428
+ }
429
+
408
430
  // src/services/skill-generator.ts
409
431
  init_knowledge_types();
410
432
  init_logger();
@@ -503,7 +525,7 @@ async function appendSkillChangelog(directory, slug, entry) {
503
525
  }
504
526
 
505
527
  // src/services/skill-evaluator.ts
506
- import { createHash } from "crypto";
528
+ import { createHash as createHash2 } from "crypto";
507
529
  import { existsSync } from "fs";
508
530
  import {
509
531
  lstat as lstat2,
@@ -761,10 +783,10 @@ function average(values) {
761
783
  function hashContent(content) {
762
784
  if (content === undefined)
763
785
  return;
764
- return createHash("sha256").update(content).digest("hex");
786
+ return createHash2("sha256").update(content).digest("hex");
765
787
  }
766
788
  function normalizeRejectedContent(content) {
767
- return content.replace(/^generated_at:\s*\S+\s*$/gim, "generated_at: <generated>").replace(/\s+/g, " ").trim().toLowerCase();
789
+ return content.replace(/^[^\S\n]*generated_at:[^\n]*/gim, "generated_at: <generated>").replace(/\s+/g, " ").trim().toLowerCase();
768
790
  }
769
791
  function hashNormalizedContent(content) {
770
792
  if (content === undefined)
@@ -1070,10 +1092,22 @@ function isSkillSingletonEligible(entry) {
1070
1092
  function uniqueStrings(arr) {
1071
1093
  return [...new Set(arr.filter((s) => typeof s === "string" && s.length > 0))];
1072
1094
  }
1095
+ function yamlJsonString(values) {
1096
+ const json = JSON.stringify(values);
1097
+ return `'${json.replace(/'/g, "''")}'`;
1098
+ }
1099
+ function yamlStringScalar(value) {
1100
+ if (/^-?(\d+\.?\d*|\.\d+)$/.test(value))
1101
+ return `"${value}"`;
1102
+ if (/^(true|false|null|yes|no|on|off)$/i.test(value))
1103
+ return `"${value}"`;
1104
+ if (/^\d{4}-\d{2}-\d{2}([T ].*)?$/.test(value))
1105
+ return `"${value}"`;
1106
+ return value;
1107
+ }
1073
1108
  function renderSkillMarkdown(cluster, mode = "active", generatedAt = new Date().toISOString(), overrides) {
1074
1109
  const description = cluster.title.length > 200 ? `${cluster.title.slice(0, 197)}\u2026` : cluster.title;
1075
- const ids = cluster.entries.map((e) => ` - ${e.id}`).join(`
1076
- `);
1110
+ const ids = cluster.entries.map((e) => e.id);
1077
1111
  const version = overrides?.version ?? 1;
1078
1112
  const skillOrigin = overrides?.skillOrigin ?? "generated";
1079
1113
  const skillType = overrides?.skillType;
@@ -1081,23 +1115,19 @@ function renderSkillMarkdown(cluster, mode = "active", generatedAt = new Date().
1081
1115
  lines.push("---");
1082
1116
  lines.push(`name: ${cluster.slug}`);
1083
1117
  lines.push(`description: ${escapeYaml(description)}`);
1118
+ lines.push("metadata:");
1084
1119
  if (cluster.triggers.length > 0) {
1085
- lines.push("triggers:");
1086
- for (const trigger of cluster.triggers) {
1087
- lines.push(` - ${escapeYaml(trigger)}`);
1088
- }
1089
- }
1090
- lines.push("generated_from_knowledge:");
1091
- lines.push(ids);
1092
- lines.push("source_knowledge_ids:");
1093
- lines.push(ids);
1094
- lines.push(`generated_at: ${generatedAt}`);
1095
- lines.push(`confidence: ${cluster.avgConfidence.toFixed(2)}`);
1096
- lines.push(`status: ${mode === "active" ? "active" : "draft"}`);
1097
- lines.push(`version: ${version}`);
1098
- lines.push(`skill_origin: ${skillOrigin}`);
1120
+ lines.push(` triggers: ${yamlJsonString(cluster.triggers)}`);
1121
+ }
1122
+ lines.push(` generated_from_knowledge: ${yamlJsonString(ids)}`);
1123
+ lines.push(` source_knowledge_ids: ${yamlJsonString(ids)}`);
1124
+ lines.push(` generated_at: ${yamlStringScalar(generatedAt)}`);
1125
+ lines.push(` confidence: ${yamlStringScalar(cluster.avgConfidence.toFixed(2))}`);
1126
+ lines.push(` status: ${mode === "active" ? "active" : "draft"}`);
1127
+ lines.push(` version: ${yamlStringScalar(String(version))}`);
1128
+ lines.push(` skill_origin: ${skillOrigin}`);
1099
1129
  if (skillType) {
1100
- lines.push(`skill_type: ${skillType}`);
1130
+ lines.push(` skill_type: ${skillType}`);
1101
1131
  }
1102
1132
  lines.push("---");
1103
1133
  lines.push("");
@@ -1326,6 +1356,9 @@ async function generateSkills(req) {
1326
1356
  function injectMissingIdsIntoFrontmatter(content, missingIds) {
1327
1357
  if (missingIds.length === 0)
1328
1358
  return content;
1359
+ const safeIds = missingIds.map((id) => id.replace(/[\r\n]+/g, " ").trim()).filter((id) => id.length > 0);
1360
+ if (safeIds.length === 0)
1361
+ return content;
1329
1362
  const stripped = content.charCodeAt(0) === 65279 ? content.slice(1) : content;
1330
1363
  const openFence = stripped.match(/^---[ \t]*\r?\n/);
1331
1364
  if (!openFence)
@@ -1337,39 +1370,44 @@ function injectMissingIdsIntoFrontmatter(content, missingIds) {
1337
1370
  const closeStart = fenceLen + (closeFence.index ?? 0);
1338
1371
  const body = stripped.slice(fenceLen, closeStart).replace(/\r\n/g, `
1339
1372
  `);
1340
- const sourceIdx = body.indexOf("source_knowledge_ids:");
1341
- if (sourceIdx === -1)
1342
- return content;
1343
- const afterLabel = body.indexOf(`
1344
- `, sourceIdx);
1345
- const listStart = afterLabel === -1 ? body.length : afterLabel + 1;
1346
1373
  const lines = body.split(`
1347
1374
  `);
1348
- let insertIdx = -1;
1375
+ let labelIdx = -1;
1376
+ let childIndent = "";
1349
1377
  for (let i = 0;i < lines.length; i++) {
1350
- if (lines[i].length === 0)
1351
- continue;
1352
- const relativePos = body.indexOf(lines[i], listStart);
1353
- if (relativePos >= 0 && relativePos < listStart + 2)
1354
- continue;
1355
- if (body.slice(listStart, body.indexOf(lines[i], listStart)).match(/^\s+-/)) {
1356
- continue;
1378
+ const m = lines[i].match(/^(\s*)source_knowledge_ids:\s*$/);
1379
+ if (m) {
1380
+ labelIdx = i;
1381
+ childIndent = m[1];
1382
+ break;
1357
1383
  }
1358
- insertIdx = body.indexOf(lines[i], listStart);
1359
- break;
1360
1384
  }
1361
- if (insertIdx === -1)
1362
- insertIdx = body.length;
1363
- const missingBlock = [
1364
- "missing_source_knowledge_ids:",
1365
- ...missingIds.map((id) => ` - ${id}`),
1366
- ""
1367
- ].join(`
1368
- `);
1369
- const newBody = body.slice(0, insertIdx) + missingBlock + body.slice(insertIdx);
1385
+ if (labelIdx === -1) {
1386
+ for (let i = 0;i < lines.length; i++) {
1387
+ const m = lines[i].match(/^(\s*)source_knowledge_ids:\s*\S/);
1388
+ if (m) {
1389
+ labelIdx = i;
1390
+ childIndent = m[1];
1391
+ break;
1392
+ }
1393
+ }
1394
+ }
1395
+ if (labelIdx === -1)
1396
+ return content;
1397
+ let insertIdx;
1398
+ if (childIndent.length > 0) {
1399
+ insertIdx = labelIdx + 1;
1400
+ lines.splice(insertIdx, 0, `${childIndent}missing_source_knowledge_ids: ${yamlJsonString(safeIds)}`);
1401
+ } else {
1402
+ let end = labelIdx + 1;
1403
+ while (end < lines.length && /^\s+-/.test(lines[end]))
1404
+ end += 1;
1405
+ lines.splice(end, 0, "missing_source_knowledge_ids:", ...safeIds.map((id) => ` - ${id}`), "");
1406
+ }
1370
1407
  const prefix = stripped.slice(0, fenceLen);
1371
1408
  const suffix = stripped.slice(closeStart);
1372
- return prefix + newBody + suffix;
1409
+ return prefix + lines.join(`
1410
+ `) + suffix;
1373
1411
  }
1374
1412
  async function stampSourceEntries(directory, slug, ids, mode = "active") {
1375
1413
  if (!ids || ids.length === 0)
@@ -1448,8 +1486,28 @@ function parseDraftFrontmatter(content) {
1448
1486
  let inLegacyIdsList = false;
1449
1487
  let inSourceIdsList = false;
1450
1488
  let inTriggersList = false;
1489
+ let inMetadataBlock = false;
1490
+ const metadataChildren = new Map;
1451
1491
  for (const raw of lines) {
1452
1492
  const line = raw;
1493
+ if (inMetadataBlock) {
1494
+ if (/^\S/.test(line)) {
1495
+ inMetadataBlock = false;
1496
+ } else {
1497
+ const child = line.match(/^\s+([A-Za-z_][A-Za-z0-9_-]*):\s*(.*)$/);
1498
+ if (child) {
1499
+ const key = child[1].toLowerCase();
1500
+ if (!metadataChildren.has(key)) {
1501
+ metadataChildren.set(key, stripGeneratedYamlQuotes(child[2]));
1502
+ }
1503
+ }
1504
+ continue;
1505
+ }
1506
+ }
1507
+ if (/^metadata:\s*$/.test(line)) {
1508
+ inMetadataBlock = true;
1509
+ continue;
1510
+ }
1453
1511
  if (inLegacyIdsList || inSourceIdsList || inTriggersList) {
1454
1512
  const m = inTriggersList ? line.match(/^\s+-\s+(.{1,120}?)\s*$/) : line.match(/^\s+-\s+(\S{1,64})\s*$/);
1455
1513
  if (m && inTriggersList) {
@@ -1515,12 +1573,53 @@ function parseDraftFrontmatter(content) {
1515
1573
  inSourceIdsList = true;
1516
1574
  }
1517
1575
  }
1576
+ if (metadataChildren.size > 0) {
1577
+ const fromJsonList = (value) => {
1578
+ if (!value)
1579
+ return null;
1580
+ if (value.startsWith("[") && value.endsWith("]")) {
1581
+ try {
1582
+ const parsed = JSON.parse(value);
1583
+ if (Array.isArray(parsed))
1584
+ return parsed.map(String);
1585
+ } catch {}
1586
+ return value.slice(1, -1).split(",").map((entry) => stripGeneratedYamlQuotes(entry.trim())).filter(Boolean);
1587
+ }
1588
+ return null;
1589
+ };
1590
+ const triggers = fromJsonList(metadataChildren.get("triggers"));
1591
+ if (triggers)
1592
+ out.triggers = triggers;
1593
+ const ids = fromJsonList(metadataChildren.get("source_knowledge_ids"));
1594
+ if (ids)
1595
+ out.sourceKnowledgeIds = ids;
1596
+ const legacyIds = fromJsonList(metadataChildren.get("generated_from_knowledge"));
1597
+ if (!ids && legacyIds)
1598
+ out.sourceKnowledgeIds = legacyIds;
1599
+ const status = metadataChildren.get("status");
1600
+ if (status)
1601
+ out.status = status;
1602
+ const generatedAt = metadataChildren.get("generated_at");
1603
+ if (generatedAt)
1604
+ out.generatedAt = generatedAt;
1605
+ const version = metadataChildren.get("version");
1606
+ if (version !== undefined && /^\d+$/.test(version)) {
1607
+ out.version = parseInt(version, 10);
1608
+ }
1609
+ const skillOrigin = metadataChildren.get("skill_origin");
1610
+ if (skillOrigin)
1611
+ out.skillOrigin = skillOrigin;
1612
+ const skillType = metadataChildren.get("skill_type");
1613
+ if (skillType === "directive" || skillType === "workflow") {
1614
+ out.skillType = skillType;
1615
+ }
1616
+ }
1518
1617
  return out;
1519
1618
  }
1520
1619
  function stripGeneratedYamlQuotes(value) {
1521
1620
  const trimmed = value.trim();
1522
1621
  if (trimmed.startsWith('"') && trimmed.endsWith('"') || trimmed.startsWith("'") && trimmed.endsWith("'")) {
1523
- return trimmed.slice(1, -1).trim();
1622
+ return trimmed.slice(1, -1).replace(/''/g, "'").trim();
1524
1623
  }
1525
1624
  return trimmed;
1526
1625
  }
@@ -1591,7 +1690,8 @@ async function activateProposal(directory, slug, force = false, options = {}) {
1591
1690
  reason: "previously rejected equivalent content"
1592
1691
  };
1593
1692
  }
1594
- const flipped = proposalContent.replace(/^status:\s*draft\s*$/m, "status: active");
1693
+ const proposalSplit = splitSkillFrontmatter(proposalContent);
1694
+ const flipped = proposalSplit.frontmatter.replace(/^(\s*)status:\s*"?draft"?\s*[ \t]*$/m, "$1status: active") + proposalSplit.body;
1595
1695
  let evaluation;
1596
1696
  if (options.evaluate) {
1597
1697
  let incumbentContent;
@@ -2260,6 +2360,7 @@ var _internals = {
2260
2360
  renderSkillMarkdown,
2261
2361
  generateSkills,
2262
2362
  activateProposal,
2363
+ injectMissingIdsIntoFrontmatter,
2263
2364
  listSkills,
2264
2365
  findSkillsBySourceKnowledgeId,
2265
2366
  findStaleSkillsBySourceKnowledgeId,
@@ -2279,4 +2380,4 @@ var _internals = {
2279
2380
  clearRetiredSkillLinks
2280
2381
  };
2281
2382
 
2282
- export { BUNDLED_PROJECT_SKILL_ROOT, bundledProjectSkillFileReference, syncBundledProjectSkillsIfMissingAsync, appendSkillChangelog, evaluateSkillChange, appendRejectedSkillEdit, isRejectedSkillContent, sanitizeSlug, isValidSlug2 as isValidSlug, proposalPath, activePath, activeRepoRelativePath, proposalRepoRelativePath, generateEvalStub, writeEvalStub, DEFAULT_SKILL_MIN_CONFIDENCE, DEFAULT_SKILL_MIN_CONFIRMATIONS, STRONG_SKILL_OUTCOME_COUNT, HIGH_PRIORITY_SKILL_MIN_CONFIDENCE, selectCandidateEntries, isSkillMaturityEligible, clusterEntries, buildKnowledgeCluster, renderSkillMarkdown, generateSkills, parseDraftFrontmatter, activateProposal, findSkillsBySourceKnowledgeId, findStaleSkillsBySourceKnowledgeId, listSkills, autoApplyProposals, inspectSkill, retireSkill, clearDraftSkillLinks, clearRetiredSkillLinks, markSkillStale, clearSkillStale, retireOrMarkStale, regenerateSkill, _internals };
2383
+ export { BUNDLED_PROJECT_SKILL_ROOT, bundledProjectSkillFileReference, syncBundledProjectSkillsIfMissingAsync, splitSkillFrontmatter, skillContractDigest, appendSkillChangelog, evaluateSkillChange, appendRejectedSkillEdit, isRejectedSkillContent, sanitizeSlug, isValidSlug2 as isValidSlug, proposalPath, activePath, activeRepoRelativePath, proposalRepoRelativePath, generateEvalStub, writeEvalStub, DEFAULT_SKILL_MIN_CONFIDENCE, DEFAULT_SKILL_MIN_CONFIRMATIONS, STRONG_SKILL_OUTCOME_COUNT, HIGH_PRIORITY_SKILL_MIN_CONFIDENCE, selectCandidateEntries, isSkillMaturityEligible, clusterEntries, buildKnowledgeCluster, renderSkillMarkdown, generateSkills, parseDraftFrontmatter, activateProposal, findSkillsBySourceKnowledgeId, findStaleSkillsBySourceKnowledgeId, listSkills, autoApplyProposals, inspectSkill, retireSkill, clearDraftSkillLinks, clearRetiredSkillLinks, markSkillStale, clearSkillStale, retireOrMarkStale, regenerateSkill, _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.196.0",
24
+ version: "7.197.1",
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",
@@ -2,7 +2,7 @@
2
2
  import {
3
3
  _internals,
4
4
  resolveWorktreeIsolationConfig
5
- } from "./index-8bsnnnj2.js";
5
+ } from "./index-9rqvm5sk.js";
6
6
  import {
7
7
  ApprovalEvidenceSchema,
8
8
  BaseEvidenceSchema,
@@ -46,7 +46,7 @@ import {
46
46
  loadPluginConfigWithMeta,
47
47
  loadPluginConfigWithMetaAsync,
48
48
  resetConfigAdvisoryDedup
49
- } from "./index-ppnpkww2.js";
49
+ } from "./index-tstk9xx7.js";
50
50
  import"./index-zxdawwc7.js";
51
51
  import {
52
52
  AUTO_REVIEW_V8_BURN_IN_DECISION,
@@ -72,7 +72,7 @@ import {
72
72
  TurboConfigSchema,
73
73
  WorktreeIsolationConfigSchema,
74
74
  resolveAutoReviewConfig
75
- } from "./index-nqxbqb50.js";
75
+ } from "./index-mwh6srje.js";
76
76
  import {
77
77
  ALL_AGENT_NAMES,
78
78
  ALL_SUBAGENT_NAMES,
@@ -4,7 +4,7 @@ import {
4
4
  ensureTaskCheckpointReceipt,
5
5
  loadPlan,
6
6
  updateTaskCheckpointReceipt
7
- } from "./index-tjc68trf.js";
7
+ } from "./index-vanjqbhp.js";
8
8
  import {
9
9
  tool
10
10
  } from "./index-9nyqt3kb.js";
@@ -20,7 +20,7 @@ import {
20
20
  } from "./index-kphy4we7.js";
21
21
  import {
22
22
  readLedgerEvents
23
- } from "./index-174j0g38.js";
23
+ } from "./index-rqbhn0mh.js";
24
24
  import {
25
25
  appendCoreEventSync
26
26
  } from "./index-6183at3v.js";
@@ -41,7 +41,7 @@ import {
41
41
  } from "./index-yf2z4j7s.js";
42
42
  import {
43
43
  loadPluginConfigWithMeta
44
- } from "./index-ppnpkww2.js";
44
+ } from "./index-tstk9xx7.js";
45
45
  import {
46
46
  init_git_executable,
47
47
  resolveGitExecutable
@@ -12,7 +12,7 @@ import {
12
12
  readTaskEvidence,
13
13
  readTaskEvidenceRaw,
14
14
  sanitizeTaskId
15
- } from "./index-3drq02r1.js";
15
+ } from "./index-t4nxee8x.js";
16
16
  import {
17
17
  readSwarmFileAsync,
18
18
  validateSwarmPath
@@ -1,7 +1,7 @@
1
1
  // @bun
2
2
  import {
3
3
  computePlanStructureHash
4
- } from "./index-174j0g38.js";
4
+ } from "./index-rqbhn0mh.js";
5
5
  import {
6
6
  appendCoreEventSync
7
7
  } from "./index-6183at3v.js";
@@ -1,10 +1,10 @@
1
1
  // @bun
2
2
  import {
3
3
  handleGuardrailExplain
4
- } from "./index-w3mav870.js";
4
+ } from "./index-f0d3z2ha.js";
5
5
  import {
6
6
  handleGuardrailLog
7
- } from "./index-3hpjqa6y.js";
7
+ } from "./index-d0m3snqt.js";
8
8
  import {
9
9
  COMMAND_REGISTRY,
10
10
  DEFAULT_CI_DEADLINE_MS,
@@ -97,50 +97,50 @@ import {
97
97
  handleWriteRetroCommand,
98
98
  normalizeSwarmCommandInput,
99
99
  resolveCommand
100
- } from "./index-bjaef5zn.js";
101
- import"./index-t5med3ga.js";
102
- import"./index-hjma52c8.js";
103
- import"./index-2grr37ry.js";
100
+ } from "./index-57g7yqx9.js";
101
+ import"./index-528gk6k1.js";
102
+ import"./index-0sw6gjtn.js";
103
+ import"./index-qae4572e.js";
104
104
  import"./index-j2vv0h13.js";
105
105
  import"./index-c5xvm318.js";
106
106
  import"./index-necqa5bj.js";
107
107
  import"./index-txdagbh7.js";
108
- import"./index-knxq5byr.js";
108
+ import"./index-a9bs0c71.js";
109
109
  import"./index-rdec0y3z.js";
110
- import"./index-sgt1d7ez.js";
111
- import"./index-7zkgdefv.js";
112
- import"./index-41p9zzpe.js";
113
- import"./index-7gqmqhzj.js";
110
+ import"./index-efen9p4c.js";
111
+ import"./index-d483e4gz.js";
112
+ import"./index-kah11mjw.js";
113
+ import"./index-z5rkkhng.js";
114
114
  import"./index-ghckhk16.js";
115
115
  import"./index-ypkfhqbc.js";
116
116
  import"./index-cjapb4hy.js";
117
117
  import"./index-dfrcc46h.js";
118
118
  import"./index-pt7h91zc.js";
119
119
  import"./index-q7sjgr1y.js";
120
- import"./index-31b55cq9.js";
121
- import"./index-tjc68trf.js";
120
+ import"./index-pywrvjxj.js";
121
+ import"./index-vanjqbhp.js";
122
122
  import"./index-6b295cas.js";
123
123
  import"./index-9nyqt3kb.js";
124
- import"./index-ryjp0wmq.js";
124
+ import"./index-9vwsvgzp.js";
125
125
  import"./index-v3bmwmqw.js";
126
- import"./index-svbh91pz.js";
127
- import"./index-3drq02r1.js";
128
- import"./index-391ydd25.js";
126
+ import"./index-h69nppa3.js";
127
+ import"./index-t4nxee8x.js";
128
+ import"./index-hyxw4j9t.js";
129
129
  import"./index-g4fs6z4e.js";
130
- import"./index-vsa05smc.js";
131
- import"./index-mt5t492g.js";
132
- import"./index-te61qv0q.js";
130
+ import"./index-xtb61w73.js";
131
+ import"./index-3h4tajza.js";
132
+ import"./index-syrktqz9.js";
133
133
  import"./index-m9zzj4ee.js";
134
134
  import"./index-kphy4we7.js";
135
135
  import"./index-2s7dvzff.js";
136
- import"./index-wscg5ryb.js";
136
+ import"./index-fmgkemn9.js";
137
137
  import"./index-hy2fqapm.js";
138
138
  import"./index-rtry5xyf.js";
139
- import"./index-8bsnnnj2.js";
139
+ import"./index-9rqvm5sk.js";
140
140
  import"./index-g22dps7x.js";
141
141
  import"./index-0725jpp7.js";
142
- import"./index-tzasccpd.js";
143
- import"./index-174j0g38.js";
142
+ import"./index-qqe9tt5y.js";
143
+ import"./index-rqbhn0mh.js";
144
144
  import"./index-6183at3v.js";
145
145
  import"./index-j8t1g5qd.js";
146
146
  import"./index-crz772sx.js";
@@ -149,7 +149,7 @@ import"./index-ry16d01s.js";
149
149
  import"./index-rdm3px0g.js";
150
150
  import"./index-7pmbnjvj.js";
151
151
  import"./index-gc0aeth5.js";
152
- import"./index-jnjvghgp.js";
152
+ import"./index-6g81mmmy.js";
153
153
  import"./index-vzm6zre7.js";
154
154
  import"./index-ae75rja9.js";
155
155
  import"./index-ry5g9s8d.js";
@@ -162,12 +162,12 @@ import"./index-ejhxgyvm.js";
162
162
  import"./index-7g4c7s5r.js";
163
163
  import"./index-yf2z4j7s.js";
164
164
  import"./index-gx2vp8gx.js";
165
- import"./index-ppnpkww2.js";
165
+ import"./index-tstk9xx7.js";
166
166
  import"./index-zxdawwc7.js";
167
167
  import {
168
168
  init_schema,
169
169
  stripKnownSwarmPrefix
170
- } from "./index-nqxbqb50.js";
170
+ } from "./index-mwh6srje.js";
171
171
  import {
172
172
  AGENT_TOOL_MAP,
173
173
  ORCHESTRATOR_NAME,