opencode-swarm 7.195.0 → 7.197.0

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 (132) 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/README.md +1 -1
  55. package/binaries/win32-arm64/swarm-sandbox-runner.exe +0 -0
  56. package/binaries/win32-x64/swarm-sandbox-runner.exe +0 -0
  57. package/dist/cli/{auto-checkpoint-anf21wwa.js → auto-checkpoint-s05sxmg6.js} +4 -4
  58. package/dist/cli/{checkpoint-ngdw2qx2.js → checkpoint-kzyy9b7y.js} +8 -8
  59. package/dist/cli/{coder-settlement-bqb059y2.js → coder-settlement-d1qqfgdm.js} +3 -3
  60. package/dist/cli/{config-doctor-vetg215g.js → config-doctor-yrven0ya.js} +7 -7
  61. package/dist/cli/{core-8qgvsm6x.js → core-qpmksfae.js} +1 -1
  62. package/dist/cli/{curator-drift-3gjycbkv.js → curator-drift-2h6nf0mw.js} +5 -5
  63. package/dist/cli/{curator-llm-factory-d17ybmgm.js → curator-llm-factory-kt3jhgs9.js} +25 -25
  64. package/dist/cli/{curator-hh0n9wgz.js → curator-mqnqst1g.js} +25 -25
  65. package/dist/cli/{doctor-knowledge-receipt-phase-id-1d465vkg.js → doctor-knowledge-receipt-phase-id-d8arz38j.js} +4 -4
  66. package/dist/cli/{evidence-summary-service-rkd3yc5x.js → evidence-summary-service-gjs4zssz.js} +9 -9
  67. package/dist/cli/{gate-evidence-wtjrerkh.js → gate-evidence-9n5r17hq.js} +2 -2
  68. package/dist/cli/{guardrail-explain-8xh3r0dn.js → guardrail-explain-g4wcr664.js} +26 -26
  69. package/dist/cli/{guardrail-log-jrey2myg.js → guardrail-log-0hy23f7d.js} +3 -3
  70. package/dist/cli/{guardrail-reset-m5qbg30j.js → guardrail-reset-9z5rmp3f.js} +25 -25
  71. package/dist/cli/{hive-promoter-36yhdfre.js → hive-promoter-w8f840ah.js} +25 -25
  72. package/dist/cli/{index-gz16dke1.js → index-1cks27mv.js} +6 -6
  73. package/dist/cli/{index-epdzvp4w.js → index-1gnrtz76.js} +5 -5
  74. package/dist/cli/{index-jn4mmhqc.js → index-20m9q2z9.js} +1 -1
  75. package/dist/cli/{index-yryy781f.js → index-29xr45xr.js} +153 -52
  76. package/dist/cli/{index-bpq6z8qe.js → index-3qqnz0jg.js} +3 -3
  77. package/dist/cli/{index-kmvy5fr8.js → index-401a12w5.js} +1 -1
  78. package/dist/cli/{index-jatgbm7k.js → index-5p0jhn2s.js} +1 -1
  79. package/dist/cli/{index-gns3gc87.js → index-67w61x1b.js} +3 -3
  80. package/dist/cli/{index-ha8xc5d3.js → index-8ahnfc03.js} +2 -2
  81. package/dist/cli/{index-akb436kn.js → index-8zwmfh9d.js} +1 -1
  82. package/dist/cli/{index-3k65kdfp.js → index-9px1knpj.js} +1 -1
  83. package/dist/cli/{index-1hcjxz6w.js → index-9sqcmzc2.js} +2 -2
  84. package/dist/cli/{index-9teqkkp4.js → index-agvmmvdt.js} +25 -25
  85. package/dist/cli/{index-tc8x0zc5.js → index-avbvxmw2.js} +1 -1
  86. package/dist/cli/{index-c6hyd8hg.js → index-bpnpvhja.js} +1 -1
  87. package/dist/cli/{index-8448vj9w.js → index-dgvf1jey.js} +1 -1
  88. package/dist/cli/{index-bftpd2m5.js → index-eabxecjf.js} +2 -2
  89. package/dist/cli/{index-6vpqe4ws.js → index-fzx1wfxn.js} +1 -1
  90. package/dist/cli/{index-h7275akd.js → index-g1r94prs.js} +27 -27
  91. package/dist/cli/{index-82aj6gaj.js → index-g749xs7c.js} +2 -2
  92. package/dist/cli/{index-7kbpzg05.js → index-jvpvghyh.js} +328 -224
  93. package/dist/cli/{index-780g1hht.js → index-jvzfw0n5.js} +1 -1
  94. package/dist/cli/{index-479kf368.js → index-mbdkr2sh.js} +1 -1
  95. package/dist/cli/{index-c4hx57tz.js → index-ng6me2hh.js} +2 -2
  96. package/dist/cli/{index-fk4j26km.js → index-njfkqr77.js} +3 -3
  97. package/dist/cli/{index-peyz4k9k.js → index-t3tzk566.js} +1 -1
  98. package/dist/cli/{index-z59414gv.js → index-v8jhmn8x.js} +1 -1
  99. package/dist/cli/{index-5gf2wx2c.js → index-xb3h5tvj.js} +4 -4
  100. package/dist/cli/{index-xs9cn3c0.js → index-xf6tdsyr.js} +3 -3
  101. package/dist/cli/{index-863hst4e.js → index-ysbmrmzk.js} +1 -1
  102. package/dist/cli/index.js +26 -26
  103. package/dist/cli/{knowledge-escalator-6sgrjbcj.js → knowledge-escalator-42cvn0ec.js} +7 -7
  104. package/dist/cli/{knowledge-events-hztjt63y.js → knowledge-events-v0xavjkd.js} +5 -5
  105. package/dist/cli/{knowledge-store-3sd2034v.js → knowledge-store-s01cread.js} +1 -1
  106. package/dist/cli/{knowledge-validator-3fe82zy4.js → knowledge-validator-kvtcqpke.js} +2 -2
  107. package/dist/cli/{mcp-spbx3efe.js → mcp-ff73w9z7.js} +1 -1
  108. package/dist/cli/{model-preflight-k2bw7rt1.js → model-preflight-0k8bd388.js} +25 -25
  109. package/dist/cli/{pending-delegations-kcvd9t41.js → pending-delegations-bmj7djk1.js} +2 -2
  110. package/dist/cli/{pr-subscriptions-nqby87en.js → pr-subscriptions-9dbrw7ky.js} +1 -1
  111. package/dist/cli/{pr-workflow-gate-cgbc0x1z.js → pr-workflow-gate-wg003fkd.js} +25 -25
  112. package/dist/cli/{scan-cursor-sphr9phs.js → scan-cursor-d93q0q3s.js} +2 -2
  113. package/dist/cli/{schema-x892aatt.js → schema-0ny9ef6s.js} +1 -1
  114. package/dist/cli/{scope-persistence-n9xksct2.js → scope-persistence-ekcfq34x.js} +5 -5
  115. package/dist/cli/{server-am2y11yn.js → server-rpx7pkg1.js} +25 -25
  116. package/dist/cli/{skill-generator-p71b6h5k.js → skill-generator-h1w7s5dh.js} +8 -8
  117. package/dist/cli/{snapshot-coordination-init-x9b4t9sk.js → snapshot-coordination-init-f6ecsn9c.js} +25 -25
  118. package/dist/cli/{speckit-checkoff-xp9vsp9k.js → speckit-checkoff-kf0zkpdw.js} +3 -3
  119. package/dist/cli/{worktree-collision-ownership-2pmyww6g.js → worktree-collision-ownership-p7zmj4ag.js} +2 -2
  120. package/dist/cli/{worktree-isolation-379tmkta.js → worktree-isolation-nz90xvw5.js} +25 -25
  121. package/dist/commands/registry.d.ts +1 -1
  122. package/dist/config/skill-contract-digest.d.ts +6 -0
  123. package/dist/epic/start.d.ts +5 -4
  124. package/dist/hooks/skill-scoring.d.ts +1 -1
  125. package/dist/hooks/skill-usage-log.d.ts +2 -0
  126. package/dist/host/v2/agents-commands.d.ts +13 -3
  127. package/dist/index.js +103 -98
  128. package/dist/sbom/detectors/index.d.ts +15 -0
  129. package/dist/services/skill-evaluator.d.ts +2 -0
  130. package/dist/services/skill-generator.d.ts +13 -0
  131. package/dist/tools/sbom-generate.d.ts +1 -1
  132. package/package.json +1 -1
@@ -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.195.0",
24
+ version: "7.197.0",
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",
@@ -5,18 +5,18 @@ import {
5
5
  import {
6
6
  effectiveRetrievalOutcomes,
7
7
  readAuthoritativeKnowledgeCounterRollups
8
- } from "./index-bftpd2m5.js";
8
+ } from "./index-eabxecjf.js";
9
9
  import {
10
10
  ALLOWED_SKILL_PATH_PREFIXES,
11
11
  validateSkillPath
12
- } from "./index-tc8x0zc5.js";
12
+ } from "./index-avbvxmw2.js";
13
13
  import {
14
14
  computeOutcomeSignal,
15
15
  readKnowledge,
16
16
  resolveHiveKnowledgePath,
17
17
  resolveSwarmKnowledgePath,
18
18
  transactKnowledge
19
- } from "./index-5gf2wx2c.js";
19
+ } from "./index-xb3h5tvj.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 };
@@ -2,7 +2,7 @@
2
2
  import {
3
3
  _internals,
4
4
  resolveWorktreeIsolationConfig
5
- } from "./index-82aj6gaj.js";
5
+ } from "./index-g749xs7c.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-c6hyd8hg.js";
49
+ } from "./index-bpnpvhja.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-jn4mmhqc.js";
75
+ } from "./index-20m9q2z9.js";
76
76
  import {
77
77
  ALL_AGENT_NAMES,
78
78
  ALL_SUBAGENT_NAMES,
@@ -2,7 +2,7 @@
2
2
  import {
3
3
  autoCommitDirty,
4
4
  cleanUntrackedFiles
5
- } from "./index-479kf368.js";
5
+ } from "./index-mbdkr2sh.js";
6
6
  import {
7
7
  isSpawnCwdMissing,
8
8
  isSpawnCwdUnreadable
@@ -4,7 +4,7 @@ import {
4
4
  readShellAuditTail,
5
5
  redactPath,
6
6
  redactShellCommand
7
- } from "./index-akb436kn.js";
7
+ } from "./index-8zwmfh9d.js";
8
8
 
9
9
  // src/services/guardrail-log-service.ts
10
10
  var BLOCK_TYPES = new Set([
@@ -1,7 +1,7 @@
1
1
  // @bun
2
2
  import {
3
3
  loadPlanJsonOnly
4
- } from "./index-epdzvp4w.js";
4
+ } from "./index-1gnrtz76.js";
5
5
  import {
6
6
  isCanonicalPathWithinRoot
7
7
  } from "./index-6b295cas.js";
@@ -14,7 +14,7 @@ import {
14
14
  legacyEpicIssuePath,
15
15
  migrateLegacyEpicConfig,
16
16
  resolveEpicConfig
17
- } from "./index-c6hyd8hg.js";
17
+ } from "./index-bpnpvhja.js";
18
18
  import {
19
19
  FALLBACK_MODELS_MAX,
20
20
  GATE_CONFIG_KNOWN_SECTION_KEYS,
@@ -24,7 +24,7 @@ import {
24
24
  init_schema,
25
25
  retiredEpicKeyReplacement,
26
26
  stripKnownSwarmPrefix
27
- } from "./index-jn4mmhqc.js";
27
+ } from "./index-20m9q2z9.js";
28
28
  import {
29
29
  ALL_AGENT_NAMES,
30
30
  TOOL_NAME_SET,
@@ -19,14 +19,14 @@ import {
19
19
  mergeWriteAnalyses,
20
20
  resolveWindowsWriteAuthority,
21
21
  resolveWriteTargets
22
- } from "./index-7kbpzg05.js";
22
+ } from "./index-jvpvghyh.js";
23
23
  import {
24
24
  checkFileAuthority,
25
25
  classifyFile,
26
26
  isInDeclaredScope,
27
27
  redactPath,
28
28
  redactShellCommand
29
- } from "./index-akb436kn.js";
29
+ } from "./index-8zwmfh9d.js";
30
30
 
31
31
  // src/services/guardrail-explain-service.ts
32
32
  import path from "path";
@@ -8,7 +8,7 @@ import {
8
8
  import {
9
9
  init_schema,
10
10
  stripKnownSwarmPrefix
11
- } from "./index-jn4mmhqc.js";
11
+ } from "./index-20m9q2z9.js";
12
12
  import {
13
13
  init_constants
14
14
  } from "./index-hqrkr9ag.js";
@@ -4737,7 +4737,7 @@ async function reconcileLegacyCoderSettlements(directory, maxRecords, onReconcil
4737
4737
  const candidates = readDelegations(directory).filter((record) => record.normalizedAgent === "coder" && Boolean(record.legacyCoderSettlementTransfer) && Boolean(record.terminalResult)).slice(0, maxRecords);
4738
4738
  if (candidates.length === 0)
4739
4739
  return 0;
4740
- const { transferCoderSettlementToBackground } = await import("./coder-settlement-bqb059y2.js");
4740
+ const { transferCoderSettlementToBackground } = await import("./coder-settlement-d1qqfgdm.js");
4741
4741
  let transferred = 0;
4742
4742
  for (const record of candidates) {
4743
4743
  try {
@@ -27,11 +27,11 @@ import {
27
27
  import {
28
28
  init_loader,
29
29
  loadPluginConfig
30
- } from "./index-c6hyd8hg.js";
30
+ } from "./index-bpnpvhja.js";
31
31
  import {
32
32
  init_package,
33
33
  package_default
34
- } from "./index-jn4mmhqc.js";
34
+ } from "./index-20m9q2z9.js";
35
35
  import {
36
36
  criticalWarn,
37
37
  init_logger,
@@ -23,52 +23,52 @@ import {
23
23
  resolveFallbackModel,
24
24
  resolvePrimaryAgentNames,
25
25
  stripSwarmPrefix
26
- } from "./index-7kbpzg05.js";
27
- import"./index-akb436kn.js";
28
- import"./index-gns3gc87.js";
29
- import"./index-780g1hht.js";
26
+ } from "./index-jvpvghyh.js";
27
+ import"./index-8zwmfh9d.js";
28
+ import"./index-67w61x1b.js";
29
+ import"./index-jvzfw0n5.js";
30
30
  import"./index-j2vv0h13.js";
31
31
  import"./index-c5xvm318.js";
32
32
  import"./index-necqa5bj.js";
33
33
  import"./index-txdagbh7.js";
34
- import"./index-8448vj9w.js";
34
+ import"./index-dgvf1jey.js";
35
35
  import {
36
36
  createExplorerAgent
37
37
  } from "./index-rdec0y3z.js";
38
- import"./index-863hst4e.js";
39
- import"./index-fk4j26km.js";
40
- import"./index-yryy781f.js";
41
- import"./index-gz16dke1.js";
38
+ import"./index-ysbmrmzk.js";
39
+ import"./index-njfkqr77.js";
40
+ import"./index-29xr45xr.js";
41
+ import"./index-1cks27mv.js";
42
42
  import"./index-ghckhk16.js";
43
43
  import"./index-ypkfhqbc.js";
44
44
  import"./index-cjapb4hy.js";
45
45
  import"./index-dfrcc46h.js";
46
46
  import"./index-pt7h91zc.js";
47
47
  import"./index-q7sjgr1y.js";
48
- import"./index-xs9cn3c0.js";
49
- import"./index-epdzvp4w.js";
48
+ import"./index-xf6tdsyr.js";
49
+ import"./index-1gnrtz76.js";
50
50
  import"./index-6b295cas.js";
51
51
  import"./index-9nyqt3kb.js";
52
- import"./index-peyz4k9k.js";
52
+ import"./index-t3tzk566.js";
53
53
  import"./index-v3bmwmqw.js";
54
- import"./index-z59414gv.js";
55
- import"./index-kmvy5fr8.js";
56
- import"./index-479kf368.js";
54
+ import"./index-v8jhmn8x.js";
55
+ import"./index-401a12w5.js";
56
+ import"./index-mbdkr2sh.js";
57
57
  import"./index-g4fs6z4e.js";
58
- import"./index-3k65kdfp.js";
59
- import"./index-bftpd2m5.js";
60
- import"./index-c4hx57tz.js";
58
+ import"./index-9px1knpj.js";
59
+ import"./index-eabxecjf.js";
60
+ import"./index-ng6me2hh.js";
61
61
  import"./index-m9zzj4ee.js";
62
62
  import"./index-kphy4we7.js";
63
63
  import"./index-2s7dvzff.js";
64
- import"./index-tc8x0zc5.js";
64
+ import"./index-avbvxmw2.js";
65
65
  import"./index-hy2fqapm.js";
66
66
  import"./index-rtry5xyf.js";
67
- import"./index-82aj6gaj.js";
67
+ import"./index-g749xs7c.js";
68
68
  import"./index-g22dps7x.js";
69
69
  import"./index-0725jpp7.js";
70
- import"./index-6vpqe4ws.js";
71
- import"./index-1hcjxz6w.js";
70
+ import"./index-fzx1wfxn.js";
71
+ import"./index-9sqcmzc2.js";
72
72
  import"./index-6183at3v.js";
73
73
  import"./index-j8t1g5qd.js";
74
74
  import"./index-crz772sx.js";
@@ -77,7 +77,7 @@ import"./index-ry16d01s.js";
77
77
  import"./index-rdm3px0g.js";
78
78
  import"./index-7pmbnjvj.js";
79
79
  import"./index-gc0aeth5.js";
80
- import"./index-5gf2wx2c.js";
80
+ import"./index-xb3h5tvj.js";
81
81
  import"./index-vzm6zre7.js";
82
82
  import"./index-ae75rja9.js";
83
83
  import"./index-ry5g9s8d.js";
@@ -90,9 +90,9 @@ import"./index-ejhxgyvm.js";
90
90
  import"./index-7g4c7s5r.js";
91
91
  import"./index-yf2z4j7s.js";
92
92
  import"./index-gx2vp8gx.js";
93
- import"./index-c6hyd8hg.js";
93
+ import"./index-bpnpvhja.js";
94
94
  import"./index-zxdawwc7.js";
95
- import"./index-jn4mmhqc.js";
95
+ import"./index-20m9q2z9.js";
96
96
  import"./index-hqrkr9ag.js";
97
97
  import"./index-bk5tah7q.js";
98
98
  import"./index-gknz3bv1.js";
@@ -9,7 +9,7 @@ import {
9
9
  resolveSwarmKnowledgePath,
10
10
  resolveSwarmRejectedPath,
11
11
  transactKnowledge
12
- } from "./index-5gf2wx2c.js";
12
+ } from "./index-xb3h5tvj.js";
13
13
  import {
14
14
  resolveKnowledgeStoreDir
15
15
  } from "./index-ry5g9s8d.js";
@@ -15,7 +15,7 @@ import {
15
15
  init_schema,
16
16
  resolveExternalSkillsConfig,
17
17
  retiredEpicKeyReplacement
18
- } from "./index-jn4mmhqc.js";
18
+ } from "./index-20m9q2z9.js";
19
19
  import {
20
20
  DangerousMergeKeyError,
21
21
  MAX_MERGE_DEPTH,
@@ -2,7 +2,7 @@
2
2
  import {
3
3
  readKnowledge,
4
4
  transactKnowledge
5
- } from "./index-5gf2wx2c.js";
5
+ } from "./index-xb3h5tvj.js";
6
6
  import {
7
7
  resolveKnowledgeStoreDir
8
8
  } from "./index-ry5g9s8d.js";
@@ -1,7 +1,7 @@
1
1
  // @bun
2
2
  import {
3
3
  queryHistoricalOutcomes
4
- } from "./index-c4hx57tz.js";
4
+ } from "./index-ng6me2hh.js";
5
5
  import {
6
6
  resolveHiveEventsPath
7
7
  } from "./index-ae75rja9.js";
@@ -708,7 +708,7 @@ async function applyKnowledgeVerdictFeedback(directory, options) {
708
708
  }
709
709
  let bumps = 0;
710
710
  if (deltas.length > 0) {
711
- const { bumpKnowledgeConfidenceBatch } = await import("./knowledge-store-3sd2034v.js");
711
+ const { bumpKnowledgeConfidenceBatch } = await import("./knowledge-store-s01cread.js");
712
712
  bumps = await bumpKnowledgeConfidenceBatch(directory, deltas, options?.floorOptions);
713
713
  }
714
714
  return {
@@ -1,7 +1,7 @@
1
1
  // @bun
2
2
  import {
3
3
  computePlanStructureHash
4
- } from "./index-1hcjxz6w.js";
4
+ } from "./index-9sqcmzc2.js";
5
5
  import {
6
6
  appendCoreEventSync
7
7
  } from "./index-6183at3v.js";