@outerlayer/cli 0.36.0-next.20261101131017 → 0.36.0-next.20261102124202

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 (192) hide show
  1. package/dist/agent-setup-AOB76EDJ.js +37 -0
  2. package/dist/{artifact-link-cmd-W7LRR76D.js → artifact-link-cmd-ZCMQIT5Y.js} +2 -2
  3. package/dist/bridge-DFG2GTXQ.js +13 -0
  4. package/dist/build-THAD3B4Q.js +21 -0
  5. package/dist/build-disk-HO2VPIBJ.js +18 -0
  6. package/dist/build-info.json +1 -1
  7. package/dist/builder-AXJNIF4S.js +17 -0
  8. package/dist/caller-GOY2X6QT.js +20 -0
  9. package/dist/{check-G4TVQKN3.js → check-SF2OVZXB.js} +73 -71
  10. package/dist/{chunk-KB5B6ZT5.js → chunk-3FSKTGM6.js} +20 -20
  11. package/dist/{chunk-CONA2WNE.js → chunk-4CTVN3C5.js} +18 -11
  12. package/dist/{chunk-2QW2PLWT.js → chunk-4TNUQLXH.js} +8 -8
  13. package/dist/{chunk-LGV5N5DG.js → chunk-564Q2STF.js} +1 -1
  14. package/dist/{chunk-2ANBJ7DB.js → chunk-5FIOUQGC.js} +8 -8
  15. package/dist/{chunk-4W7CPTKY.js → chunk-5FND4PIU.js} +3 -3
  16. package/dist/{chunk-SQ6HDN7A.js → chunk-5GHJFETA.js} +1 -1
  17. package/dist/{chunk-4DJZSNVT.js → chunk-6JJITHBI.js} +1 -1
  18. package/dist/{chunk-6CYNPWZT.js → chunk-6LO62EQ5.js} +151 -108
  19. package/dist/{chunk-RIHB3HA2.js → chunk-772ILTCK.js} +3 -3
  20. package/dist/{chunk-CIUD3436.js → chunk-A5Y2HBVU.js} +1 -1
  21. package/dist/{chunk-F3ZMVUAS.js → chunk-AYLYAOHH.js} +5 -5
  22. package/dist/{chunk-DZDTSDHQ.js → chunk-C3JWWPLC.js} +10 -11
  23. package/dist/{chunk-JFMSFHER.js → chunk-CKPQOQFC.js} +644 -74
  24. package/dist/{chunk-ALEUIS35.js → chunk-CVGQ3BNF.js} +1 -1
  25. package/dist/{chunk-GDMAN42R.js → chunk-EBIYRRJW.js} +5 -5
  26. package/dist/{chunk-UIKUH2UQ.js → chunk-ESSJPSJ2.js} +2 -2
  27. package/dist/{chunk-A67A5SWG.js → chunk-EUDG754F.js} +2 -2
  28. package/dist/{chunk-55PYF6S2.js → chunk-FIO6PIZ6.js} +3 -3
  29. package/dist/{chunk-WT7J2627.js → chunk-GD6KIHOS.js} +1 -1
  30. package/dist/{chunk-SRENPED2.js → chunk-GDZTL6BI.js} +42 -33
  31. package/dist/{chunk-AF6DQJ5W.js → chunk-GSXGA6KF.js} +1 -1
  32. package/dist/{chunk-T3AJOPUR.js → chunk-GZ75FRLB.js} +4 -5
  33. package/dist/chunk-H2FFONRY.js +136 -0
  34. package/dist/{chunk-IM2DECLP.js → chunk-HIN4BMRW.js} +3 -3
  35. package/dist/{chunk-OLENS2DD.js → chunk-I626B72C.js} +29 -26
  36. package/dist/{chunk-YCUUZGFF.js → chunk-I6FRCBMU.js} +26 -21
  37. package/dist/{chunk-PN6TNCQI.js → chunk-J7TCTARR.js} +11 -12
  38. package/dist/chunk-J7Y3PCO2.js +653 -0
  39. package/dist/{chunk-YQHEJ5SV.js → chunk-JVCQZDQ6.js} +3 -3
  40. package/dist/{chunk-5DYL6FJA.js → chunk-JXXHLQQR.js} +3 -3
  41. package/dist/{chunk-VI6Z4EJZ.js → chunk-K3X3L5YW.js} +4 -4
  42. package/dist/{chunk-MKSZHT6S.js → chunk-KN4VIK53.js} +1 -1
  43. package/dist/{chunk-3LCXSD26.js → chunk-L2BA2HXM.js} +1 -1
  44. package/dist/chunk-L3JXQDVH.js +78 -0
  45. package/dist/{chunk-3ONYQMGD.js → chunk-LCOQN6NR.js} +3 -3
  46. package/dist/{chunk-6KHQGLNT.js → chunk-LSXHTBAM.js} +5 -5
  47. package/dist/{chunk-RGH5GYU2.js → chunk-LVXR37OG.js} +47 -38
  48. package/dist/{chunk-HGGR7Y3V.js → chunk-LYFLUNWK.js} +12 -12
  49. package/dist/{chunk-GANAOCHR.js → chunk-M2NIHHQI.js} +24 -374
  50. package/dist/chunk-NC3QAHOS.js +26 -0
  51. package/dist/{chunk-UFRRRF64.js → chunk-NTMRMBLM.js} +10 -5
  52. package/dist/{chunk-RGU6LHPI.js → chunk-NWBB2SQ4.js} +38 -35
  53. package/dist/{chunk-A7D5BMII.js → chunk-OYKAOHX5.js} +5 -5
  54. package/dist/{chunk-46YRS7QS.js → chunk-OZOATEK3.js} +4 -4
  55. package/dist/{chunk-3PQTOKML.js → chunk-P6PHY33P.js} +1 -1
  56. package/dist/{chunk-GQ7VVBUA.js → chunk-PKO5IDW4.js} +7 -7
  57. package/dist/{chunk-7J7HRYZ3.js → chunk-PQDFW422.js} +1 -1
  58. package/dist/{chunk-EZRAR5YG.js → chunk-PT34C6SU.js} +1 -1
  59. package/dist/{chunk-K66FIV2S.js → chunk-PTPF36Q7.js} +3 -3
  60. package/dist/{chunk-7Y5VW4JG.js → chunk-Q42K6XZ6.js} +1 -1
  61. package/dist/{chunk-VIJWXQMT.js → chunk-QJDX6VJS.js} +7 -7
  62. package/dist/{chunk-W46566FP.js → chunk-RK4JQRVT.js} +9 -9
  63. package/dist/{chunk-U553JKMO.js → chunk-RPZIHELI.js} +5 -5
  64. package/dist/{chunk-CIEX2ZKQ.js → chunk-RSRZDF3K.js} +6 -6
  65. package/dist/{chunk-46OBCATR.js → chunk-T5Z22NA6.js} +1 -1
  66. package/dist/{chunk-5H57X7YC.js → chunk-TPMLB3VZ.js} +1 -1
  67. package/dist/chunk-TWYHSMHM.js +67 -0
  68. package/dist/{chunk-6GA5BJTH.js → chunk-TYCZVJTB.js} +54 -31
  69. package/dist/{chunk-4SFHEARD.js → chunk-VRQM4A64.js} +6 -3
  70. package/dist/{chunk-LRCGXRQI.js → chunk-WDQPBAFV.js} +44 -19
  71. package/dist/{chunk-UZGQT6OF.js → chunk-WLMAGMTU.js} +5 -3
  72. package/dist/{chunk-KCUX5I5W.js → chunk-WNYH42PF.js} +6 -6
  73. package/dist/{chunk-C4YULCXX.js → chunk-WQB3XOEP.js} +28 -31
  74. package/dist/{chunk-VUG4IZ7H.js → chunk-WUKLQWGY.js} +1 -1
  75. package/dist/{chunk-MDFOS4OM.js → chunk-XABJMU5A.js} +4 -4
  76. package/dist/{chunk-MMXPNEEQ.js → chunk-XAOIHYPS.js} +29 -24
  77. package/dist/{chunk-WAZJPDR2.js → chunk-XE3DIJJT.js} +1 -1
  78. package/dist/{chunk-3SQZ5LIK.js → chunk-XHFSBSIA.js} +4 -4
  79. package/dist/{chunk-GDIVOYDA.js → chunk-XLOM2BNL.js} +3 -4
  80. package/dist/{claude-launcher-YV3TDXBU.js → claude-launcher-LXZPTDNC.js} +23 -18
  81. package/dist/{cli-EMQEIYSR.js → cli-QFUT3UQS.js} +145 -146
  82. package/dist/{cli-update-notice-T3CXRWNB.js → cli-update-notice-AWYJ4A7R.js} +2 -2
  83. package/dist/{command-GKVKI74I.js → command-45RZT4CK.js} +59 -60
  84. package/dist/{config-4HXUXX3M.js → config-WYQPXLOP.js} +13 -11
  85. package/dist/connect-cmd-LUCQ7FSV.js +26 -0
  86. package/dist/{container-start-OMF3ZUIB.js → container-start-T776VI3M.js} +59 -58
  87. package/dist/{context-cleanup-TPHCVVFV.js → context-cleanup-QE2MIO2Q.js} +5 -3
  88. package/dist/{context-show-cmd-MKQAAR7R.js → context-show-cmd-7QEHUOEL.js} +17 -17
  89. package/dist/{control-plane-launch-UWFQWMWB.js → control-plane-launch-THUH6YU5.js} +19 -19
  90. package/dist/{demo-record-cmd-Y57UWBCX.js → demo-record-cmd-SBERRQNW.js} +8 -5
  91. package/dist/{demo-voice-cmd-H4PCO2PT.js → demo-voice-cmd-VM3FITZU.js} +22 -24
  92. package/dist/{dist-Y3WSK7OZ.js → dist-6KGTCWKR.js} +2 -2
  93. package/dist/docker-MQNLK4OO.js +17 -0
  94. package/dist/{doctor-FEBZ3DZB.js → doctor-NQOSPJGS.js} +75 -72
  95. package/dist/emit-artifact-cmd-6E365VBQ.js +41 -0
  96. package/dist/emit-cmd-ZPFCPVSR.js +16 -0
  97. package/dist/emit-criteria-cmd-HWQOYZZ4.js +32 -0
  98. package/dist/{emit-demo-cmd-VKGN74NW.js → emit-demo-cmd-PMQGNNVX.js} +22 -24
  99. package/dist/{emit-finding-cmd-DNFJEYQS.js → emit-finding-cmd-MYWQN5WW.js} +17 -18
  100. package/dist/{emit-result-cmd-OR5WTW4P.js → emit-result-cmd-GXK3KMAP.js} +20 -21
  101. package/dist/{emit-step-cmd-AAEBYW3L.js → emit-step-cmd-ZV2XTUVT.js} +17 -18
  102. package/dist/exec-client-P7RFRUCK.js +14 -0
  103. package/dist/find-unit-63SXQ7IM.js +21 -0
  104. package/dist/{findings-cmd-LTM62M3K.js → findings-cmd-OGMBVVSM.js} +17 -18
  105. package/dist/fleet-readiness-4RBKLXBQ.js +27 -0
  106. package/dist/governing-source-XJMXFSAR.js +38 -0
  107. package/dist/guest-init-XZHRPIMG.js +16 -0
  108. package/dist/{hook-fast-3HPWMSFB.js → hook-fast-ZOWGWCPO.js} +5 -5
  109. package/dist/host-checks-WHW24PJR.js +76 -0
  110. package/dist/host-key-MWLXB5U5.js +14 -0
  111. package/dist/{image-tag-WBD57QBN.js → image-tag-E4JK2APF.js} +9 -4
  112. package/dist/index.js +4 -4
  113. package/dist/init-EZIAHBMH.js +76 -0
  114. package/dist/{init-O5H4TWA7.js → init-LO6U7YTW.js} +56 -55
  115. package/dist/{init-cmd-HWAXEEOD.js → init-cmd-2JANO5EN.js} +27 -28
  116. package/dist/{init-update-3W2TOJQV.js → init-update-D6PRTGNE.js} +55 -48
  117. package/dist/install-cmd-SJMBNQEH.js +17 -0
  118. package/dist/layout-AQHIMJMO.js +11 -0
  119. package/dist/{login-browser-ODTJEGDN.js → login-browser-QH4KYG3F.js} +2 -2
  120. package/dist/{logs-FEITSC2V.js → logs-NE55HOET.js} +8 -3
  121. package/dist/loop-2E34CGCX.js +87 -0
  122. package/dist/machine-6ALGG4IO.js +76 -0
  123. package/dist/{machine-skills-VRUJVBQV.js → machine-skills-KK2HXYMR.js} +3 -4
  124. package/dist/{mcp-install-cmd-23ZY4IBK.js → mcp-install-cmd-2QAS3AQZ.js} +5 -1
  125. package/dist/{mcp-serve-cmd-ZINYSLY6.js → mcp-serve-cmd-U6USKHYR.js} +9 -7
  126. package/dist/{paths-XEYE7OZ2.js → paths-O7LCWY33.js} +8 -3
  127. package/dist/pending-YU2GE2UV.js +14 -0
  128. package/dist/pidfile-5GDCQ5HA.js +15 -0
  129. package/dist/record-NETSDAO6.js +14 -0
  130. package/dist/{relay-IEYNSKAZ.js → relay-VZ733BVJ.js} +6 -1
  131. package/dist/{relay-protocol-5LSWUJCW.js → relay-protocol-24GEUGCO.js} +6 -1
  132. package/dist/runner-env-KHCONH2R.js +21 -0
  133. package/dist/runner-identity-PSCZBILD.js +17 -0
  134. package/dist/{runner-key-HUOW7X7B.js → runner-key-VM2LYVRK.js} +48 -50
  135. package/dist/{session-sender-32UAV25N.js → session-sender-P2RHDM6U.js} +21 -22
  136. package/dist/{spec-cmd-TPRHZ3EV.js → spec-cmd-LGKP6MT7.js} +18 -19
  137. package/dist/{starter-pack-7QNUT74O.js → starter-pack-SMK6UPRL.js} +6 -7
  138. package/dist/state-RJR4PMMX.js +14 -0
  139. package/dist/{status-HDJ2V5UD.js → status-HEHCNIDS.js} +48 -50
  140. package/dist/{sync-cmd-AHXCXMVP.js → sync-cmd-HKN45HXL.js} +20 -21
  141. package/dist/update-steps-7E4RD47J.js +77 -0
  142. package/dist/{watch-4EDI4CTS.js → watch-RGZCUCR3.js} +20 -21
  143. package/dist/{work-claim-cmd-GFRZBX2V.js → work-claim-cmd-6DSPGCZE.js} +24 -26
  144. package/dist/{work-cmd-FLKJQWGQ.js → work-cmd-GPLYLWY7.js} +17 -18
  145. package/dist/work-comment-cmd-V5WM7LAW.js +35 -0
  146. package/dist/{work-demo-cmd-FDPDTXG6.js → work-demo-cmd-SWWI6AGD.js} +17 -18
  147. package/dist/{work-logs-cmd-PSB44DT5.js → work-logs-cmd-CTFBOPCI.js} +17 -18
  148. package/dist/{work-open-pr-cmd-QJW5PNT2.js → work-open-pr-cmd-HX2U3YBR.js} +18 -19
  149. package/dist/{work-pr-cmd-HMGBUHGL.js → work-pr-cmd-EI2R4FQG.js} +17 -18
  150. package/dist/{work-proofs-cmd-3GPGH4RL.js → work-proofs-cmd-QXNPHLYC.js} +19 -20
  151. package/dist/{work-proofs-record-AC4GYMQA.js → work-proofs-record-72OKWEES.js} +26 -28
  152. package/dist/{work-stop-cmd-YO7SBPNF.js → work-stop-cmd-7M7ZYUN2.js} +17 -18
  153. package/package.json +2 -1
  154. package/dist/agent-setup-UYTS2PHZ.js +0 -33
  155. package/dist/bridge-XM4QLKIX.js +0 -8
  156. package/dist/build-IENNKWWC.js +0 -18
  157. package/dist/build-disk-M33Q6L22.js +0 -15
  158. package/dist/builder-YNMSYR75.js +0 -14
  159. package/dist/caller-2GU5V52U.js +0 -18
  160. package/dist/chunk-3DMCCCVM.js +0 -74
  161. package/dist/chunk-7O7LJWQO.js +0 -144
  162. package/dist/chunk-FGF52V4V.js +0 -137
  163. package/dist/chunk-HCVLP7XA.js +0 -53
  164. package/dist/chunk-MESOOLF4.js +0 -45
  165. package/dist/chunk-OHQMGLJP.js +0 -113
  166. package/dist/chunk-OUPQTA7N.js +0 -145
  167. package/dist/connect-cmd-GLB2X7YA.js +0 -27
  168. package/dist/docker-AFJABU7U.js +0 -14
  169. package/dist/emit-artifact-cmd-DGFH4MUK.js +0 -42
  170. package/dist/emit-cmd-HNXRGC5Z.js +0 -17
  171. package/dist/emit-criteria-cmd-B23VYUF6.js +0 -33
  172. package/dist/exec-client-FGGPQSYQ.js +0 -9
  173. package/dist/find-unit-4XKMNIE7.js +0 -19
  174. package/dist/fleet-readiness-FAKMWCJV.js +0 -28
  175. package/dist/governing-source-75MBT2IE.js +0 -39
  176. package/dist/guest-init-WPUS45IN.js +0 -11
  177. package/dist/host-checks-PUI32LIA.js +0 -78
  178. package/dist/host-key-O4DFMOSV.js +0 -9
  179. package/dist/init-Y672J4BW.js +0 -78
  180. package/dist/install-cmd-JKPXIOEY.js +0 -12
  181. package/dist/layout-TLUOMM6F.js +0 -11
  182. package/dist/loop-QJGPNIT4.js +0 -89
  183. package/dist/machine-YKQSW22W.js +0 -78
  184. package/dist/pending-D2NNV54J.js +0 -9
  185. package/dist/pidfile-FLFVRKVW.js +0 -10
  186. package/dist/record-JMZOXD4R.js +0 -9
  187. package/dist/runner-env-FK3SUT3Q.js +0 -19
  188. package/dist/runner-identity-WYAGV6UQ.js +0 -14
  189. package/dist/state-UWIM42JH.js +0 -9
  190. package/dist/update-steps-F37GQWLJ.js +0 -79
  191. package/dist/work-comment-cmd-3HUIIEQD.js +0 -36
  192. package/dist/{chunk-OLM2TIOW.js → chunk-NFZMENCY.js} +1 -1
@@ -1,7 +1,14 @@
1
1
  #!/usr/bin/env node
2
2
  import { createRequire } from 'node:module';
3
- import { RESERVED_EMIT_NAMES, ARTIFACT_KINDS, ArtifactCriterionIdSchema } from './chunk-VUG4IZ7H.js';
3
+ import { RESERVED_EMIT_NAMES, ARTIFACT_KINDS, ArtifactCriterionIdSchema } from './chunk-WUKLQWGY.js';
4
+ import { MAINTAINED_SKILLS } from './chunk-CDDED64E.js';
5
+ import { resolvePackageVersion } from './chunk-RA3O54FC.js';
6
+ import { homeFromEnv } from './chunk-352DHUTP.js';
4
7
  import { __commonJS, __require, __toESM } from './chunk-Z5GEFMRW.js';
8
+ import { existsSync, readFileSync, mkdirSync, writeFileSync, readdirSync, rmSync, renameSync, realpathSync, readlinkSync, symlinkSync, copyFileSync, lstatSync } from 'fs';
9
+ import { join as join$1, dirname } from 'path';
10
+ import { fileURLToPath } from 'url';
11
+ import { homedir } from 'os';
5
12
 
6
13
  createRequire(import.meta.url);
7
14
 
@@ -7566,71 +7573,8 @@ function buildAgentsMd(input) {
7566
7573
  }
7567
7574
  return { files, copies: [], warnings };
7568
7575
  }
7569
- function buildClaudeCode(input) {
7570
- const files = [];
7571
- const copies = [];
7572
- const warnings = [];
7573
- for (const entry of input.entries) {
7574
- switch (entry.kind) {
7575
- case "instructions": {
7576
- const content = contentForEntry(input.contents, entry, warnings);
7577
- if (content !== void 0) {
7578
- files.push({ path: joinPath(entry.scopePath, "CLAUDE.md"), content: withHeader(entry.path, content) });
7579
- }
7580
- break;
7581
- }
7582
- case "skill": {
7583
- const content = contentForEntry(input.contents, entry, warnings);
7584
- if (content !== void 0) {
7585
- files.push({
7586
- path: joinPath(entry.scopePath, ".claude/skills", entry.skillName, "SKILL.md"),
7587
- content: withHeader(entry.path, content)
7588
- });
7589
- }
7590
- break;
7591
- }
7592
- case "skill-reference": {
7593
- const content = contentForEntry(input.contents, entry, warnings);
7594
- if (content !== void 0) {
7595
- files.push({
7596
- path: joinPath(entry.scopePath, ".claude/skills", entry.skillName, "references", skillReferenceRelPath(entry)),
7597
- content: withHeader(entry.path, content)
7598
- });
7599
- }
7600
- break;
7601
- }
7602
- case "command": {
7603
- const content = contentForEntry(input.contents, entry, warnings);
7604
- if (content !== void 0) {
7605
- files.push({
7606
- path: joinPath(entry.scopePath, ".claude/commands", commandRelPath(entry)),
7607
- content: withHeader(entry.path, content)
7608
- });
7609
- }
7610
- break;
7611
- }
7612
- case "mcp": {
7613
- const content = contentForEntry(input.contents, entry, warnings);
7614
- if (content !== void 0) {
7615
- files.push({ path: joinPath(entry.scopePath, ".mcp.json"), content });
7616
- }
7617
- break;
7618
- }
7619
- }
7620
- }
7621
- for (const assetPath of input.assetPaths) {
7622
- const parsed = parseSkillAssetPath(assetPath);
7623
- if (!parsed) continue;
7624
- copies.push({
7625
- toPath: joinPath(parsed.scopePath, ".claude/skills", parsed.skillName, parsed.relPath),
7626
- fromSourcePath: assetPath
7627
- });
7628
- }
7629
- return { files, copies, warnings };
7630
- }
7631
- var ALL_TARGET_IDS = ["claude-code"];
7632
7576
  var REMOVED_TARGET_IDS = ["cursor", "codex", "copilot", "factory"];
7633
- function parseOuterlayerConfig(json) {
7577
+ function parseOuterlayerConfig(json, knownTargets) {
7634
7578
  let raw;
7635
7579
  try {
7636
7580
  raw = JSON.parse(json);
@@ -7656,13 +7600,13 @@ function parseOuterlayerConfig(json) {
7656
7600
  {
7657
7601
  path: "targets",
7658
7602
  code: "no_targets",
7659
- message: `"targets" must be a non-empty array of target ids; valid ids: ${ALL_TARGET_IDS.join(", ")}`
7603
+ message: `"targets" must be a non-empty array of target ids; valid ids: ${knownTargets.join(", ")}`
7660
7604
  }
7661
7605
  ],
7662
7606
  warnings: []
7663
7607
  };
7664
7608
  }
7665
- const validIds = new Set(ALL_TARGET_IDS);
7609
+ const validIds = new Set(knownTargets);
7666
7610
  const removedIds = new Set(REMOVED_TARGET_IDS);
7667
7611
  const errors = [];
7668
7612
  const targets = [];
@@ -7679,7 +7623,7 @@ function parseOuterlayerConfig(json) {
7679
7623
  errors.push({
7680
7624
  path: `targets[${i}]`,
7681
7625
  code: "unknown_target",
7682
- message: `unknown target id ${JSON.stringify(t)}; valid ids: ${ALL_TARGET_IDS.join(", ")}`
7626
+ message: `unknown target id ${JSON.stringify(t)}; valid ids: ${knownTargets.join(", ")}`
7683
7627
  });
7684
7628
  return;
7685
7629
  }
@@ -7688,10 +7632,7 @@ function parseOuterlayerConfig(json) {
7688
7632
  if (errors.length > 0) return { ok: false, errors, warnings: [] };
7689
7633
  return { ok: true, errors: [], warnings: [], config: { targets } };
7690
7634
  }
7691
- var TARGET_BUILDERS = {
7692
- "claude-code": buildClaudeCode
7693
- };
7694
- function emitTree(input) {
7635
+ function emitTree(input, builders) {
7695
7636
  if (input.targets.length === 0) {
7696
7637
  return {
7697
7638
  files: [],
@@ -7700,7 +7641,11 @@ function emitTree(input) {
7700
7641
  errors: [{ path: "targets", code: "no_targets", message: "no targets configured \u2014 nothing to emit" }]
7701
7642
  };
7702
7643
  }
7703
- const perTarget = input.targets.map((target) => TARGET_BUILDERS[target](input));
7644
+ const unknown = input.targets.flatMap(
7645
+ (target, index) => Object.hasOwn(builders, target) ? [] : [{ path: `targets[${index}]`, code: "unknown_target", message: `unknown target id ${JSON.stringify(target)}` }]
7646
+ );
7647
+ if (unknown.length > 0) return { files: [], copies: [], warnings: [], errors: unknown };
7648
+ const perTarget = input.targets.map((target) => builders[target](input));
7704
7649
  return mergeEmitResults([...perTarget, buildAgentsMd(input)]);
7705
7650
  }
7706
7651
  function mergeEmitResults(perTarget) {
@@ -8561,4 +8506,629 @@ function parseProofsConfig(text) {
8561
8506
  return problems.length > 0 ? { ok: false, problems } : { ok: true, value: { setup, teardown, runners } };
8562
8507
  }
8563
8508
 
8564
- export { ALL_TARGET_IDS, CONTEXT_PIN_FILENAME, classifyTree, emitTree, extractFacts, generatedHeaderSource, normalizePath, normalizeRepoName, orderSessions, parseOuterlayerConfig, parsePolicy, parseProofsConfig, sessionsToTimeline, splitRawFile };
8509
+ // ../agents/src/claude-code/descriptor.ts
8510
+ var CLAUDE_CODE = {
8511
+ id: "claude-code",
8512
+ label: "Claude Code",
8513
+ color: "#D97757",
8514
+ program: "claude",
8515
+ legacy: {
8516
+ subcommand: "claude",
8517
+ runnerName: "claude",
8518
+ usageEventValue: "claude_code",
8519
+ envFile: "claude.env",
8520
+ credentialId: "claude",
8521
+ imagePaths: ["/opt/outerlayer/claude", "/usr/local/bin/claude", "/etc/claude-code"],
8522
+ toolsVersionKey: "claudeCodeVersion",
8523
+ handOffKey: "claudeCredential"
8524
+ },
8525
+ versions: { minimum: "2.1.284", tested: { from: "2.1.0", to: "2.1.255" } },
8526
+ providers: ["anthropic"],
8527
+ credentials: {
8528
+ label: "Claude",
8529
+ setupCommand: "claude setup-token",
8530
+ forwarded: ["CLAUDE_CODE_OAUTH_TOKEN", "ANTHROPIC_API_KEY"],
8531
+ stripped: ["CLAUDE_CODE_OAUTH_TOKEN", "ANTHROPIC_API_KEY", "ANTHROPIC_AUTH_TOKEN"],
8532
+ placeholders: {
8533
+ CLAUDE_CODE_OAUTH_TOKEN: "sk-ant-oat01-placeholder-not-a-real-token",
8534
+ ANTHROPIC_API_KEY: "sk-ant-api03-placeholder-not-a-real-key"
8535
+ },
8536
+ kinds: {
8537
+ CLAUDE_CODE_OAUTH_TOKEN: { pattern: "^sk-ant-oat[0-9]*-[A-Za-z0-9_-]+$", provider: "anthropic", providerKind: "oauth-token", starts: "sk-ant-oat" },
8538
+ ANTHROPIC_API_KEY: { pattern: "^sk-ant-api[0-9]*-[A-Za-z0-9_-]+$", provider: "anthropic", providerKind: "api-key", starts: "sk-ant-api" },
8539
+ ANTHROPIC_AUTH_TOKEN: { pattern: ".+", provider: "anthropic", providerKind: "oauth-token", starts: "" }
8540
+ }
8541
+ },
8542
+ context: {
8543
+ instructionFiles: ["CLAUDE.md"],
8544
+ repoSkillFolders: [".claude/skills"],
8545
+ userSkillFolder: "~/.claude/skills",
8546
+ attach: "additive",
8547
+ native: ["agents-md", "skills", "settings-hooks", "subagents", "commands", "mcp"]
8548
+ },
8549
+ capabilities: {
8550
+ sessionId: "assignable",
8551
+ resume: true,
8552
+ fork: true,
8553
+ subagents: { spawnTools: ["Agent", "Task"], transcript: "separate-file" },
8554
+ cost: "status-line",
8555
+ longCommands: "blocking",
8556
+ permission: { unattended: "bypassPermissions", "accept-edits": "acceptEdits", plan: "plan", default: "default" },
8557
+ structuredOutput: true,
8558
+ mcp: true,
8559
+ judge: true
8560
+ },
8561
+ hooks: { contextCap: 1e4, timeoutCeilingMs: 6e5 }
8562
+ };
8563
+
8564
+ // ../agents/src/native/agents.ts
8565
+ var NATIVE_AGENTS = {
8566
+ "claude-code": CLAUDE_CODE
8567
+ };
8568
+ var LEGACY_AGENT = "claude-code";
8569
+
8570
+ // ../agents/src/providers/index.ts
8571
+ var PROVIDERS = {
8572
+ anthropic: {
8573
+ id: "anthropic",
8574
+ label: "Anthropic",
8575
+ upstream: "https://api.anthropic.com/",
8576
+ credentialKinds: [
8577
+ { id: "api-key", label: "API key", header: "x-api-key", prefix: "" },
8578
+ { id: "oauth-token", label: "OAuth token", header: "Authorization", prefix: "Bearer " }
8579
+ ],
8580
+ droppedHeaders: ["x-api-key", "authorization"],
8581
+ destination: { name: "claude", port: 3127, socket: "claude.sock" }
8582
+ }
8583
+ };
8584
+
8585
+ // ../agents/src/adapter.ts
8586
+ var McpFileError = class extends Error {
8587
+ constructor(problem) {
8588
+ super(`the MCP file ${problem}`);
8589
+ this.problem = problem;
8590
+ }
8591
+ };
8592
+
8593
+ // ../agents/src/claude-code/credentials.ts
8594
+ var { forwarded, kinds, placeholders } = CLAUDE_CODE.credentials;
8595
+ var FORWARDED = forwarded;
8596
+ var KINDS = kinds;
8597
+ var BASE_URL_VARIABLE = "ANTHROPIC_BASE_URL";
8598
+ var QUIET_TRAFFIC_VARIABLE = "CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC";
8599
+ function createClaudeCodeCredentials() {
8600
+ return {
8601
+ classify(env) {
8602
+ for (const variable of FORWARDED) {
8603
+ const value = env[variable];
8604
+ if (value === void 0 || value === "") continue;
8605
+ const kind = KINDS[variable];
8606
+ return { variable, provider: kind.provider, kind: kind.providerKind };
8607
+ }
8608
+ return void 0;
8609
+ },
8610
+ identify(value) {
8611
+ return FORWARDED.find((variable) => new RegExp(KINDS[variable].pattern).test(value));
8612
+ },
8613
+ buildEnvironment({ providerUrl, variable }) {
8614
+ const placeholder = placeholders[variable ?? ""];
8615
+ return {
8616
+ [BASE_URL_VARIABLE]: providerUrl(CLAUDE_CODE.providers[0]),
8617
+ ...placeholder === void 0 ? {} : { [variable]: placeholder },
8618
+ [QUIET_TRAFFIC_VARIABLE]: "1"
8619
+ };
8620
+ }
8621
+ };
8622
+ }
8623
+
8624
+ // ../agents/src/claude-code/delivery.ts
8625
+ var PROJECT_DIR_SPELLINGS = [
8626
+ /"\$\{?CLAUDE_PROJECT_DIR\}?"\/\.claude(?![\w.-])/g,
8627
+ /\$\{CLAUDE_PROJECT_DIR\}\/\.claude(?![\w.-])/g,
8628
+ /\$CLAUDE_PROJECT_DIR\/\.claude(?![\w.-])/g
8629
+ ];
8630
+ function controlPlaneVariableForms(variable) {
8631
+ return [
8632
+ new RegExp(`\\$\\{${variable}:-[^}]*\\}/\\.claude(?![\\w.-])`, "g"),
8633
+ new RegExp(`\\$\\{${variable}\\}/\\.claude(?![\\w.-])`, "g"),
8634
+ new RegExp(`\\$${variable}/\\.claude(?![\\w.-])`, "g")
8635
+ ];
8636
+ }
8637
+ function rewriteHookCommand(command, dir) {
8638
+ return PROJECT_DIR_SPELLINGS.reduce((text, pattern) => text.replace(pattern, () => `${dir}/.claude`), command);
8639
+ }
8640
+ function rewriteControlPlanePaths(text, dir) {
8641
+ return text.replace(/(?<![\w./~$}:-])(\.outerlayer|\.claude)\//g, (_match, root) => `${dir}/${root}/`);
8642
+ }
8643
+ function rewriteAgentsFilePaths(text, dir, holds) {
8644
+ return text.replace(/(?<![\w./~$}:-])\.agents\/[\w@+./-]*/g, (match) => {
8645
+ const path = match.replace(/\.+$/, "");
8646
+ if (path.split("/").includes("..") || !holds(path)) return match;
8647
+ return `${dir}/${path}${match.slice(path.length)}`;
8648
+ });
8649
+ }
8650
+ function hookCommandEscapesControlPlane(command, controlPlaneVariable) {
8651
+ const remaining = [...PROJECT_DIR_SPELLINGS, ...controlPlaneVariableForms(controlPlaneVariable)].reduce((text, pattern) => text.replace(pattern, " "), command);
8652
+ return /\.claude(?:\/|["'\s;|&)]|$)/.test(remaining) || /\$\{?CLAUDE_PROJECT_DIR\}?"?\/\.claude/.test(remaining);
8653
+ }
8654
+ function deliverySection(dir) {
8655
+ return `This repository's control plane is not in the checkout. Its files are in \`${dir}\`. When the instructions name a file under \`.agents/\` that this directory holds, or a path under \`.outerlayer/\` or \`.claude/\`, read it under \`${dir}\`.`;
8656
+ }
8657
+ function join(base, ...parts) {
8658
+ return parts.reduce((path, part) => path === "" || path.endsWith("/") ? `${path}${part}` : `${path}/${part}`, base);
8659
+ }
8660
+ function parentOf(path) {
8661
+ const cut = path.lastIndexOf("/");
8662
+ return cut <= 0 ? path.slice(0, cut + 1) : path.slice(0, cut);
8663
+ }
8664
+ function filesOf(fs) {
8665
+ const exists = (path) => {
8666
+ const kind = fs.kind(path);
8667
+ if (kind !== "link") return kind !== "missing";
8668
+ try {
8669
+ return fs.kind(fs.realPath(path)) !== "missing";
8670
+ } catch {
8671
+ return false;
8672
+ }
8673
+ };
8674
+ const filesUnder2 = (dir, base = dir) => {
8675
+ if (fs.kind(dir) !== "directory") return [];
8676
+ const out = [];
8677
+ for (const name of fs.list(dir)) {
8678
+ const abs = join(dir, name);
8679
+ const kind = fs.kind(abs);
8680
+ if (kind === "directory") out.push(...filesUnder2(abs, base));
8681
+ else if (kind === "file") out.push(abs.slice(base.length + 1));
8682
+ }
8683
+ return out.sort();
8684
+ };
8685
+ const readText = (path) => fs.kind(path) === "file" ? fs.readText(path) : void 0;
8686
+ const isFile = (path) => fs.kind(path) === "file";
8687
+ return { exists, filesUnder: filesUnder2, readText, isFile };
8688
+ }
8689
+ function deliveredSettings(raw, dir) {
8690
+ if (raw === void 0) return "{}\n";
8691
+ const rewrite = (value) => {
8692
+ if (typeof value === "string") return rewriteHookCommand(value, dir);
8693
+ if (Array.isArray(value)) return value.map(rewrite);
8694
+ if (typeof value === "object" && value !== null) return Object.fromEntries(Object.entries(value).map(([key, inner]) => [key, rewrite(inner)]));
8695
+ return value;
8696
+ };
8697
+ try {
8698
+ return `${JSON.stringify(rewrite(JSON.parse(raw)), null, 2)}
8699
+ `;
8700
+ } catch {
8701
+ return rewriteHookCommand(raw, dir);
8702
+ }
8703
+ }
8704
+ function createDelivery(io) {
8705
+ const { fs } = io;
8706
+ const { exists, filesUnder: filesUnder2, readText, isFile } = filesOf(fs);
8707
+ return {
8708
+ compose({ tree, dir, maintainedSkills }) {
8709
+ const added = [];
8710
+ const put = (rel, content) => {
8711
+ fs.makeDir(parentOf(join(tree, rel)));
8712
+ fs.write(join(tree, rel), content);
8713
+ added.push(rel);
8714
+ };
8715
+ for (const skill of maintainedSkills) {
8716
+ for (const rel of filesUnder2(join(tree, ".outerlayer/skills", skill))) {
8717
+ const target = `.claude/skills/${skill}/${rel}`;
8718
+ if (exists(join(tree, target))) continue;
8719
+ fs.makeDir(parentOf(join(tree, target)));
8720
+ fs.copy(join(tree, ".outerlayer/skills", skill, rel), join(tree, target));
8721
+ added.push(target);
8722
+ }
8723
+ }
8724
+ const agentSkills = join(tree, ".agents/skills");
8725
+ if (exists(agentSkills) && fs.kind(agentSkills) === "directory") {
8726
+ for (const name of fs.list(agentSkills)) {
8727
+ if (fs.kind(join(agentSkills, name)) !== "directory" || exists(join(tree, ".claude/skills", name))) continue;
8728
+ for (const rel of filesUnder2(join(agentSkills, name))) {
8729
+ const target = `.claude/skills/${name}/${rel}`;
8730
+ fs.makeDir(parentOf(join(tree, target)));
8731
+ fs.copy(join(agentSkills, name, rel), join(tree, target));
8732
+ added.push(target);
8733
+ }
8734
+ }
8735
+ }
8736
+ for (const rel of [...filesUnder2(join(tree, ".claude/skills"), tree), ...filesUnder2(join(tree, ".claude/agents"), tree)]) {
8737
+ const text = readText(join(tree, rel));
8738
+ if (text === void 0) continue;
8739
+ const rewritten = rewriteControlPlanePaths(text, dir);
8740
+ if (rewritten !== text) fs.write(join(tree, rel), rewritten);
8741
+ }
8742
+ const agents = readText(join(tree, "AGENTS.md"));
8743
+ const instructions = agents === void 0 ? void 0 : rewriteAgentsFilePaths(rewriteControlPlanePaths(agents, dir), dir, (path) => isFile(join(tree, path)));
8744
+ put("CLAUDE.md", instructions === void 0 ? `${deliverySection(dir)}
8745
+ ` : `${deliverySection(dir)}
8746
+
8747
+ ${instructions}`);
8748
+ put("settings.json", deliveredSettings(readText(join(tree, ".claude/settings.json")), dir));
8749
+ return added;
8750
+ },
8751
+ deliveredSkills(tree) {
8752
+ const dir = join(tree, ".claude/skills");
8753
+ if (!exists(dir)) return [];
8754
+ return fs.list(dir).filter((name) => fs.kind(join(dir, name)) === "directory").sort();
8755
+ },
8756
+ escapesDelivery: hookCommandEscapesControlPlane
8757
+ };
8758
+ }
8759
+
8760
+ // ../agents/src/claude-code/emit.ts
8761
+ function buildClaudeCode(input) {
8762
+ const files = [];
8763
+ const copies = [];
8764
+ const warnings = [];
8765
+ for (const entry of input.entries) {
8766
+ switch (entry.kind) {
8767
+ case "instructions": {
8768
+ const content = contentForEntry(input.contents, entry, warnings);
8769
+ if (content !== void 0) {
8770
+ files.push({ path: joinPath(entry.scopePath, "CLAUDE.md"), content: withHeader(entry.path, content) });
8771
+ }
8772
+ break;
8773
+ }
8774
+ case "skill": {
8775
+ const content = contentForEntry(input.contents, entry, warnings);
8776
+ if (content !== void 0) {
8777
+ files.push({
8778
+ path: joinPath(entry.scopePath, ".claude/skills", entry.skillName, "SKILL.md"),
8779
+ content: withHeader(entry.path, content)
8780
+ });
8781
+ }
8782
+ break;
8783
+ }
8784
+ case "skill-reference": {
8785
+ const content = contentForEntry(input.contents, entry, warnings);
8786
+ if (content !== void 0) {
8787
+ files.push({
8788
+ path: joinPath(entry.scopePath, ".claude/skills", entry.skillName, "references", skillReferenceRelPath(entry)),
8789
+ content: withHeader(entry.path, content)
8790
+ });
8791
+ }
8792
+ break;
8793
+ }
8794
+ case "command": {
8795
+ const content = contentForEntry(input.contents, entry, warnings);
8796
+ if (content !== void 0) {
8797
+ files.push({
8798
+ path: joinPath(entry.scopePath, ".claude/commands", commandRelPath(entry)),
8799
+ content: withHeader(entry.path, content)
8800
+ });
8801
+ }
8802
+ break;
8803
+ }
8804
+ case "mcp": {
8805
+ const content = contentForEntry(input.contents, entry, warnings);
8806
+ if (content !== void 0) {
8807
+ files.push({ path: joinPath(entry.scopePath, ".mcp.json"), content });
8808
+ }
8809
+ break;
8810
+ }
8811
+ }
8812
+ }
8813
+ for (const assetPath of input.assetPaths) {
8814
+ const parsed = parseSkillAssetPath(assetPath);
8815
+ if (!parsed) continue;
8816
+ copies.push({
8817
+ toPath: joinPath(parsed.scopePath, ".claude/skills", parsed.skillName, parsed.relPath),
8818
+ fromSourcePath: assetPath
8819
+ });
8820
+ }
8821
+ return { files, copies, warnings };
8822
+ }
8823
+
8824
+ // ../agents/src/claude-code/image.ts
8825
+ var PREFIX = "/opt/outerlayer/claude";
8826
+ var PACKAGE = "@anthropic-ai/claude-code";
8827
+ var HOOK_EVENTS = ["SessionStart", "SessionEnd", "Stop", "PostToolUse"];
8828
+ var MANAGED_SETTINGS = JSON.stringify({
8829
+ hooks: Object.fromEntries(HOOK_EVENTS.map((event) => [event, [{ hooks: [{ type: "command", command: `outerlayer hook ${event}` }] }]]))
8830
+ });
8831
+ function createClaudeCodeImage() {
8832
+ return {
8833
+ install: (version) => [`RUN npm install --global --prefix /out${PREFIX} ${PACKAGE}@${version}`],
8834
+ program: `${PREFIX}/bin/claude`,
8835
+ command: CLAUDE_CODE.program,
8836
+ files: [{ path: "/etc/claude-code/managed-settings.json", text: MANAGED_SETTINGS }],
8837
+ env: { DISABLE_AUTOUPDATER: "1" },
8838
+ versionKey: CLAUDE_CODE.legacy.toolsVersionKey,
8839
+ latestUrl: `https://registry.npmjs.org/${PACKAGE}/latest`
8840
+ };
8841
+ }
8842
+
8843
+ // ../agents/src/claude-code/mcp.ts
8844
+ function documentOf(text) {
8845
+ if (text === void 0) return {};
8846
+ let doc;
8847
+ try {
8848
+ doc = JSON.parse(text);
8849
+ } catch {
8850
+ throw new McpFileError("not-json");
8851
+ }
8852
+ if (doc === null || typeof doc !== "object" || Array.isArray(doc)) throw new McpFileError("not-object");
8853
+ return doc;
8854
+ }
8855
+ function isObject(value) {
8856
+ return value !== null && typeof value === "object" && !Array.isArray(value);
8857
+ }
8858
+ var CLAUDE_CODE_MCP = {
8859
+ file: ".mcp.json",
8860
+ servers(text) {
8861
+ let doc;
8862
+ try {
8863
+ doc = JSON.parse(text);
8864
+ } catch {
8865
+ return void 0;
8866
+ }
8867
+ if (doc === null) return void 0;
8868
+ const servers = doc.mcpServers;
8869
+ return servers !== null && typeof servers === "object" ? servers : {};
8870
+ },
8871
+ setServer(text, name, entry, mode) {
8872
+ const doc = documentOf(text);
8873
+ const current = doc.mcpServers;
8874
+ if (mode === "if-absent") {
8875
+ if (current !== void 0 && !isObject(current)) throw new McpFileError("servers-not-object");
8876
+ if (current !== void 0 && name in current) return { text: text ?? "", changed: false };
8877
+ }
8878
+ const existing = isObject(current) ? current : {};
8879
+ const changed = JSON.stringify(existing[name] ?? null) !== JSON.stringify(entry);
8880
+ return { text: `${JSON.stringify({ ...doc, mcpServers: { ...existing, [name]: entry } }, null, 2)}
8881
+ `, changed };
8882
+ }
8883
+ };
8884
+
8885
+ // ../agents/src/claude-code/adapter.ts
8886
+ function createClaudeCodeAdapter(io) {
8887
+ return {
8888
+ context: {
8889
+ emit: buildClaudeCode,
8890
+ ...createDelivery(io),
8891
+ mcp: CLAUDE_CODE_MCP
8892
+ },
8893
+ credentials: createClaudeCodeCredentials(),
8894
+ image: createClaudeCodeImage()
8895
+ };
8896
+ }
8897
+
8898
+ // ../agents/src/native/factories.ts
8899
+ var ADAPTER_FACTORIES = {
8900
+ "claude-code": createClaudeCodeAdapter
8901
+ };
8902
+
8903
+ // ../agents/src/claude-code/conformance-fixtures.ts
8904
+ var TREE_ROOT = "/work/control-plane";
8905
+ var PATHS = [".outerlayer/AGENTS.md", ".outerlayer/skills/build/SKILL.md", ".outerlayer/commands/ship.md", ".outerlayer/mcp.json"];
8906
+ ({
8907
+ context: {
8908
+ emitInput: { entries: classifyTree(PATHS).entries},
8909
+ tree: {
8910
+ [`${TREE_ROOT}/.claude/settings.json`]: `${JSON.stringify({ hooks: { SessionStart: [{ hooks: [{ type: "command", command: '"$CLAUDE_PROJECT_DIR"/.claude/hooks/start.sh' }] }] } })}
8911
+ `}}
8912
+ });
8913
+ var TEMPLATE_SKILLS = ["spec", "writing-specs", "writing-tests", "build"];
8914
+ function templateClassLine(version) {
8915
+ return `<!-- yours to edit. Copied once from the default template by outerlayer init ${version}; never overwritten. -->`;
8916
+ }
8917
+ function maintainedClassLine(version, base) {
8918
+ if (base === MACHINE_SKILL_PATH) return `<!-- maintained by OuterLayer ${version}. Edits are overwritten by the next outerlayer command. -->`;
8919
+ const command = base === AGENTS_SKILLS_BASE ? "outerlayer init --update" : "outerlayer context emit";
8920
+ return `<!-- maintained by OuterLayer ${version}. Edits are overwritten on the next ${command}. -->`;
8921
+ }
8922
+ var OUTERLAYER_SKILLS_BASE = ".outerlayer/skills";
8923
+ var AGENTS_SKILLS_BASE = ".agents/skills";
8924
+ var MACHINE_SKILL_PATH = "~/.agents/skills";
8925
+ var MAINTAINED_SKILL_PATH_IN_PACK = new RegExp(`${OUTERLAYER_SKILLS_BASE.replace(".", "\\.")}/(outerlayer-[a-z]+)/`, "g");
8926
+ function rewriteSkillPaths(content, base) {
8927
+ if (base === OUTERLAYER_SKILLS_BASE) return content;
8928
+ if (base === MACHINE_SKILL_PATH) {
8929
+ return content.replace(MAINTAINED_SKILL_PATH_IN_PACK, `${MACHINE_SKILL_PATH}/$1/`).split(`${OUTERLAYER_SKILLS_BASE}/`).join(`${AGENTS_SKILLS_BASE}/`);
8930
+ }
8931
+ return content.split(`${OUTERLAYER_SKILLS_BASE}/`).join(`${base}/`);
8932
+ }
8933
+ function restoreSkillPaths(content, base) {
8934
+ return base === OUTERLAYER_SKILLS_BASE ? content : content.split(`${base}/`).join(`${OUTERLAYER_SKILLS_BASE}/`);
8935
+ }
8936
+ function resolvePackRoot(entryPath = fileURLToPath(import.meta.url)) {
8937
+ return join$1(dirname(dirname(entryPath)), "skill-pack");
8938
+ }
8939
+ function skillDir(skill, base = OUTERLAYER_SKILLS_BASE) {
8940
+ return `${base}/${skill}`;
8941
+ }
8942
+ function renderSkillFile(skillClass, content, version, base) {
8943
+ const line = skillClass === "maintained" ? maintainedClassLine(version, base) : templateClassLine(version);
8944
+ const { frontmatterInner, body } = splitRawFile(content);
8945
+ if (frontmatterInner === null) return `${line}
8946
+ ${content}`;
8947
+ const block = content.slice(0, content.length - body.length);
8948
+ return `${block}${block.endsWith("\n") ? "" : "\n"}${line}
8949
+ ${body}`;
8950
+ }
8951
+ function filesUnder(dir, base = dir) {
8952
+ const out = [];
8953
+ for (const entry of readdirSync(dir, { withFileTypes: true })) {
8954
+ const abs = join$1(dir, entry.name);
8955
+ if (entry.isDirectory()) out.push(...filesUnder(abs, base));
8956
+ else if (entry.isFile()) out.push(abs.slice(base.length + 1).split("\\").join("/"));
8957
+ }
8958
+ return out.sort();
8959
+ }
8960
+ function orderSkillFiles(relPaths) {
8961
+ return [...relPaths.filter((p) => p === "SKILL.md"), ...relPaths.filter((p) => p !== "SKILL.md")];
8962
+ }
8963
+ function loadClass(packRoot, skillClass, names, version, base) {
8964
+ const files = [];
8965
+ for (const skill of names) {
8966
+ const dir = join$1(packRoot, skillClass, skill);
8967
+ if (!existsSync(dir)) throw new Error(`skill pack is missing ${skillClass}/${skill} under ${packRoot}`);
8968
+ for (const rel of orderSkillFiles(filesUnder(dir))) {
8969
+ const raw = readFileSync(join$1(dir, rel), "utf8");
8970
+ files.push({
8971
+ skill,
8972
+ skillClass,
8973
+ path: `${skillDir(skill, base)}/${rel}`,
8974
+ content: rewriteSkillPaths(rel === "SKILL.md" ? renderSkillFile(skillClass, raw, version, base) : raw, base)
8975
+ });
8976
+ }
8977
+ }
8978
+ return files;
8979
+ }
8980
+ function loadTemplateFiles(packRoot = resolvePackRoot(), version = resolvePackageVersion(), base = OUTERLAYER_SKILLS_BASE) {
8981
+ return loadClass(packRoot, "template", TEMPLATE_SKILLS, version, base);
8982
+ }
8983
+ function loadMaintainedFiles(packRoot = resolvePackRoot(), version = resolvePackageVersion(), base = OUTERLAYER_SKILLS_BASE) {
8984
+ return loadClass(packRoot, "maintained", MAINTAINED_SKILLS, version, base);
8985
+ }
8986
+ function loadMachineSkillFiles(packRoot = resolvePackRoot(), version = resolvePackageVersion()) {
8987
+ return loadClass(packRoot, "maintained", MAINTAINED_SKILLS, version, MACHINE_SKILL_PATH).map((file) => ({ ...file, path: file.path.slice(skillDir(file.skill, MACHINE_SKILL_PATH).length + 1) }));
8988
+ }
8989
+ function writeMaintainedFiles(repoRoot, files) {
8990
+ const created = [];
8991
+ const rewritten = [];
8992
+ for (const file of files) {
8993
+ const abs = join$1(repoRoot, file.path);
8994
+ const exists = existsSync(abs);
8995
+ if (exists && readFileSync(abs, "utf8") === file.content) continue;
8996
+ mkdirSync(dirname(abs), { recursive: true });
8997
+ writeFileSync(abs, file.content);
8998
+ (exists ? rewritten : created).push(file.path);
8999
+ }
9000
+ return { created, rewritten };
9001
+ }
9002
+ function maintainedFilesForExistingSkills(repoRoot, files, base = OUTERLAYER_SKILLS_BASE) {
9003
+ return files.filter(
9004
+ (file) => existsSync(join$1(repoRoot, skillDir(file.skill, base))) || formerNameExists(repoRoot, file.skill, base) || requiredByBuild(repoRoot, file.skill, base)
9005
+ );
9006
+ }
9007
+ var RELATIVE_CORE = "../outerlayer-build/SKILL.md";
9008
+ function namesCore(text) {
9009
+ return text.includes("outerlayer-build");
9010
+ }
9011
+ function requiredByBuild(repoRoot, skill, base) {
9012
+ if (skill !== "outerlayer-build") return false;
9013
+ const named = (file, pattern = "outerlayer-build") => {
9014
+ try {
9015
+ return readFileSync(file, "utf8").includes(pattern);
9016
+ } catch {
9017
+ return false;
9018
+ }
9019
+ };
9020
+ if (named(join$1(repoRoot, skillDir("build", base), "SKILL.md"), RELATIVE_CORE)) return true;
9021
+ const dir = join$1(repoRoot, ".outerlayer", "validators");
9022
+ try {
9023
+ return readdirSync(dir).some((name) => name.endsWith(".yaml") && named(join$1(dir, name)));
9024
+ } catch {
9025
+ return false;
9026
+ }
9027
+ }
9028
+ var FORMER_MAINTAINED_NAMES = {
9029
+ amend: "outerlayer-amend",
9030
+ "emitting-evidence": "outerlayer-evidence",
9031
+ "reporting-findings": "outerlayer-findings",
9032
+ outerlayer: "outerlayer-cli"
9033
+ };
9034
+ var MAINTAINED_LINE = /^<!-- maintained by OuterLayer \S+?\. /m;
9035
+ function isMaintainedCopy(repoRoot, skill, base = OUTERLAYER_SKILLS_BASE) {
9036
+ try {
9037
+ return MAINTAINED_LINE.test(readFileSync(join$1(repoRoot, skillDir(skill, base), "SKILL.md"), "utf8"));
9038
+ } catch {
9039
+ return false;
9040
+ }
9041
+ }
9042
+ function formerNameExists(repoRoot, skill, base) {
9043
+ return Object.entries(FORMER_MAINTAINED_NAMES).some(([former, current]) => current === skill && isMaintainedCopy(repoRoot, former, base));
9044
+ }
9045
+ function createNodeAgentFs() {
9046
+ return {
9047
+ kind(path) {
9048
+ try {
9049
+ const stat = lstatSync(path);
9050
+ if (stat.isSymbolicLink()) return "link";
9051
+ if (stat.isDirectory()) return "directory";
9052
+ return stat.isFile() ? "file" : "missing";
9053
+ } catch {
9054
+ return "missing";
9055
+ }
9056
+ },
9057
+ readText(path) {
9058
+ let content;
9059
+ try {
9060
+ content = readFileSync(path);
9061
+ } catch (err) {
9062
+ const code = err.code;
9063
+ if (code === "ENOENT" || code === "ENOTDIR") return void 0;
9064
+ throw err;
9065
+ }
9066
+ return content.includes(0) ? void 0 : content.toString("utf8");
9067
+ },
9068
+ write: (path, text) => writeFileSync(path, text),
9069
+ copy: (from, to) => copyFileSync(from, to),
9070
+ makeDir: (path) => void mkdirSync(path, { recursive: true }),
9071
+ list: (dir) => readdirSync(dir),
9072
+ link: (target, path) => symlinkSync(target, path),
9073
+ readLink: (path) => readlinkSync(path),
9074
+ realPath: (path) => realpathSync(path),
9075
+ rename: (from, to) => renameSync(from, to),
9076
+ remove: (path) => rmSync(path, { recursive: true, force: true })
9077
+ };
9078
+ }
9079
+ function createNodeAgentIO() {
9080
+ return {
9081
+ fs: createNodeAgentFs(),
9082
+ async run(program, args, options) {
9083
+ const { execFile } = await import('child_process');
9084
+ return new Promise((resolve) => {
9085
+ const child = execFile(program, [...args], { cwd: options?.cwd, env: options?.env === void 0 ? process.env : { ...process.env, ...options.env }, encoding: "utf8" }, (error, stdout, stderr) => {
9086
+ const code = error === null ? 0 : typeof error.code === "number" ? error.code : 1;
9087
+ resolve({ code, stdout, stderr });
9088
+ });
9089
+ if (options?.stdin !== void 0) child.stdin?.end(options.stdin);
9090
+ });
9091
+ },
9092
+ home: () => homeFromEnv() || homedir(),
9093
+ env: () => ({ ...process.env }),
9094
+ now: () => /* @__PURE__ */ new Date()
9095
+ };
9096
+ }
9097
+
9098
+ // src/agents.ts
9099
+ var native;
9100
+ function defaultAgents() {
9101
+ native ??= Object.keys(NATIVE_AGENTS).map((id) => ({ descriptor: NATIVE_AGENTS[id], adapter: ADAPTER_FACTORIES[id](createNodeAgentIO()) }));
9102
+ return native;
9103
+ }
9104
+ function agentById(id, agents = defaultAgents()) {
9105
+ return agents.find((agent) => agent.descriptor.id === id);
9106
+ }
9107
+ function legacyAgent(agents = defaultAgents()) {
9108
+ const found = agentById(LEGACY_AGENT, agents);
9109
+ if (found === void 0) throw new Error(`the agent list has no ${LEGACY_AGENT} entry`);
9110
+ return found;
9111
+ }
9112
+ function contextAgents(agents = defaultAgents()) {
9113
+ return agents.flatMap((agent) => agent.adapter.context === void 0 ? [] : [{ descriptor: agent.descriptor, context: agent.adapter.context }]);
9114
+ }
9115
+ function legacySubcommand(agents = defaultAgents()) {
9116
+ return legacyAgent(agents).descriptor.legacy?.subcommand ?? LEGACY_AGENT;
9117
+ }
9118
+ function userSkillFolderIn(home, descriptor) {
9119
+ return join$1(home, descriptor.context.userSkillFolder.replace(/^~\//, ""));
9120
+ }
9121
+ function agentRootFolders(agents = defaultAgents()) {
9122
+ return [...new Set(contextAgents(agents).flatMap((agent) => agent.descriptor.context.repoSkillFolders.map((folder) => folder.split("/")[0])))];
9123
+ }
9124
+ function emitBuilders(agents = defaultAgents()) {
9125
+ return Object.fromEntries(contextAgents(agents).map((agent) => [agent.descriptor.id, agent.context.emit]));
9126
+ }
9127
+ function targetIds(agents = defaultAgents()) {
9128
+ return contextAgents(agents).map((agent) => agent.descriptor.id);
9129
+ }
9130
+ function skillBases(agents = defaultAgents()) {
9131
+ return [AGENTS_SKILLS_BASE, ...contextAgents(agents).flatMap((agent) => agent.descriptor.context.repoSkillFolders)];
9132
+ }
9133
+
9134
+ export { AGENTS_SKILLS_BASE, CONTEXT_PIN_FILENAME, FORMER_MAINTAINED_NAMES, LEGACY_AGENT, MACHINE_SKILL_PATH, McpFileError, OUTERLAYER_SKILLS_BASE, PROVIDERS, TEMPLATE_SKILLS, agentById, agentRootFolders, classifyTree, contextAgents, defaultAgents, emitBuilders, emitTree, extractFacts, generatedHeaderSource, isMaintainedCopy, legacyAgent, legacySubcommand, loadMachineSkillFiles, loadMaintainedFiles, loadTemplateFiles, maintainedFilesForExistingSkills, namesCore, normalizePath, normalizeRepoName, orderSessions, parseOuterlayerConfig, parsePolicy, parseProofsConfig, resolvePackRoot, restoreSkillPaths, rewriteSkillPaths, sessionsToTimeline, skillBases, skillDir, splitRawFile, targetIds, userSkillFolderIn, writeMaintainedFiles };