@outerlayer/cli 0.38.0-next.20261109143949 → 0.38.0-next.20261110130701

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 (203) hide show
  1. package/README.md +20 -3
  2. package/dist/agent-setup-GZBGCV3K.js +40 -0
  3. package/dist/{agent-subcommand-DCOPM2NX.js → agent-subcommand-5PNHUNZZ.js} +5 -5
  4. package/dist/{artifact-link-cmd-RUGAK5EX.js → artifact-link-cmd-XOFZP7U5.js} +2 -2
  5. package/dist/{bridge-HZRJYECQ.js → bridge-RNM7OWRW.js} +8 -8
  6. package/dist/{build-3LXKCCJF.js → build-VKO7IVOQ.js} +14 -14
  7. package/dist/{build-disk-TYX6DU5R.js → build-disk-M2JYJF6R.js} +12 -12
  8. package/dist/build-info.json +1 -1
  9. package/dist/{builder-VYKWHAUQ.js → builder-HMHJ6U7C.js} +11 -11
  10. package/dist/caller-U26SATTV.js +23 -0
  11. package/dist/{check-YUKNUSAS.js → check-SJCTNS7N.js} +60 -60
  12. package/dist/{chunk-5OBQBINA.js → chunk-2TXYQANG.js} +1 -1
  13. package/dist/{chunk-6EN72I2O.js → chunk-2WNJ2MHD.js} +1 -1
  14. package/dist/{chunk-F3MEL6B6.js → chunk-3DY4DQOC.js} +5 -5
  15. package/dist/{chunk-LYWLBZ37.js → chunk-3GTAPQBG.js} +2 -2
  16. package/dist/{chunk-U463IFDK.js → chunk-3HJK7WTM.js} +8 -8
  17. package/dist/{chunk-O4Q7GPKU.js → chunk-3W5JLANR.js} +3 -3
  18. package/dist/{chunk-22QIA7SH.js → chunk-47JRSV6Y.js} +1 -1
  19. package/dist/{chunk-RVDXHF2M.js → chunk-4EJHQYVI.js} +255 -50
  20. package/dist/{chunk-KX4JKW4Z.js → chunk-5QDHJT73.js} +7 -4
  21. package/dist/{chunk-X45WDWSV.js → chunk-5QFFQCSY.js} +1 -1
  22. package/dist/{chunk-HGWDBTQ3.js → chunk-6RQP5GP5.js} +3 -3
  23. package/dist/{chunk-5TZCV6JB.js → chunk-6XMC6R4W.js} +1 -1
  24. package/dist/{chunk-T63WTVGY.js → chunk-6XROZIV6.js} +8 -8
  25. package/dist/{chunk-GECHL3NC.js → chunk-72LXVD4O.js} +4 -4
  26. package/dist/{chunk-C3K54KRU.js → chunk-735C5J6Q.js} +7 -7
  27. package/dist/{chunk-JMWCPEKP.js → chunk-7E55P2NR.js} +2 -2
  28. package/dist/{chunk-LO3PSFNT.js → chunk-AC6DM3S3.js} +1 -1
  29. package/dist/{chunk-JAURZKSE.js → chunk-ALCZ2SEW.js} +5 -5
  30. package/dist/{chunk-HUP2CGX4.js → chunk-AS4NMHJM.js} +3 -3
  31. package/dist/{chunk-CDDED64E.js → chunk-ATEMEVFF.js} +1 -1
  32. package/dist/{chunk-RMXRQ3OC.js → chunk-ATQHPT3B.js} +1 -1
  33. package/dist/{chunk-7TM2E4RI.js → chunk-B4U5XI4F.js} +69 -9
  34. package/dist/{chunk-2DVQHK37.js → chunk-B5Z4VA4Q.js} +1 -1
  35. package/dist/{chunk-LIH6CIVB.js → chunk-BCQFMAGM.js} +3 -3
  36. package/dist/{chunk-LIMJRKIU.js → chunk-BTH6HTE5.js} +5 -5
  37. package/dist/{chunk-WGC7UFRM.js → chunk-C2PZOLN7.js} +3 -2
  38. package/dist/{chunk-IG5ZZG7R.js → chunk-C574RHGN.js} +3 -3
  39. package/dist/{chunk-4LUHKCDO.js → chunk-CXXQQST7.js} +26 -15
  40. package/dist/{chunk-4K2EMRJP.js → chunk-DKDBMMX7.js} +6 -6
  41. package/dist/{chunk-DX27B42J.js → chunk-EHPKACA7.js} +1 -1
  42. package/dist/{chunk-RVYMYTXX.js → chunk-ENHD5PNW.js} +1 -1
  43. package/dist/{chunk-EGKYININ.js → chunk-F2ADK2KB.js} +5 -5
  44. package/dist/{chunk-GVK7AKFX.js → chunk-FGBBGUM4.js} +10 -8
  45. package/dist/{chunk-HE53NIRE.js → chunk-FXVHF6RX.js} +54 -4
  46. package/dist/{chunk-H3YHAO7L.js → chunk-GJMLLXZJ.js} +1 -1
  47. package/dist/{chunk-4EQQS3VJ.js → chunk-HDEYRLWK.js} +1 -1
  48. package/dist/{chunk-G7HNRAXN.js → chunk-HJK2KI3Q.js} +16 -16
  49. package/dist/{chunk-2J3X2Z4F.js → chunk-I2N427GS.js} +8 -8
  50. package/dist/{chunk-NFZMENCY.js → chunk-I45HTSSA.js} +1 -1
  51. package/dist/{chunk-2XEQCSCQ.js → chunk-IGO766M6.js} +4 -4
  52. package/dist/{chunk-TNAUQADA.js → chunk-ITOIM3WV.js} +1 -1
  53. package/dist/{chunk-CCEP5WBI.js → chunk-IVB6A3I7.js} +13 -11
  54. package/dist/{chunk-SLR6QAOE.js → chunk-L32O52SH.js} +1 -1
  55. package/dist/{chunk-TTG6Y7G7.js → chunk-L6CZTRNW.js} +2 -2
  56. package/dist/{chunk-4OD45RBP.js → chunk-LGJ56FCM.js} +11 -2
  57. package/dist/{chunk-N2QYP3NQ.js → chunk-MBPBYMHU.js} +565 -16
  58. package/dist/{chunk-X56UUEHE.js → chunk-MSARYPFD.js} +12 -3
  59. package/dist/{chunk-OKELGJNN.js → chunk-MT4XF5OL.js} +3 -3
  60. package/dist/{chunk-QP6SPQU5.js → chunk-NE7EG3SN.js} +6 -6
  61. package/dist/{chunk-JKRVSEK7.js → chunk-OEWSICWM.js} +8 -8
  62. package/dist/{chunk-DEWD22FA.js → chunk-OI4ZV7MJ.js} +1 -1
  63. package/dist/{chunk-IJ4DF5QS.js → chunk-OK4RSIB2.js} +1 -1
  64. package/dist/{chunk-PM4YDVAX.js → chunk-OWEJP5HJ.js} +1 -1
  65. package/dist/{chunk-Z4R73UUH.js → chunk-PA6FKP5B.js} +7 -7
  66. package/dist/{chunk-KFHF3GBH.js → chunk-QFQ2UNZU.js} +6 -6
  67. package/dist/{chunk-D7KYG37D.js → chunk-QGUCHNSQ.js} +82 -16
  68. package/dist/{chunk-OYBBYENC.js → chunk-QNHBJU74.js} +8 -8
  69. package/dist/{chunk-LOG4LBUY.js → chunk-RBLXGO5K.js} +2 -2
  70. package/dist/{chunk-KIYP5TML.js → chunk-SBPMDO47.js} +1 -1
  71. package/dist/{chunk-6JW2L7UV.js → chunk-SKGUS2CB.js} +11 -11
  72. package/dist/{chunk-NHT7RHAI.js → chunk-TD6DN5LU.js} +3 -3
  73. package/dist/{chunk-TFR6S7ZB.js → chunk-TUEEGFAQ.js} +10 -10
  74. package/dist/{chunk-ZWWU7COR.js → chunk-TUSIYONR.js} +1 -1
  75. package/dist/{chunk-UCDCPQXU.js → chunk-TW2V2IQ4.js} +1 -1
  76. package/dist/{chunk-GTKR2YEZ.js → chunk-UCUBQWJC.js} +1 -1
  77. package/dist/{chunk-EI6JYZ42.js → chunk-UUSSRXUJ.js} +3 -3
  78. package/dist/{chunk-OPGF3FUY.js → chunk-VRWZNI6U.js} +2 -2
  79. package/dist/{chunk-B3ILHK4Q.js → chunk-VU5PPWIQ.js} +8 -8
  80. package/dist/{chunk-LA5UO6LI.js → chunk-WH2QUYXH.js} +5 -4
  81. package/dist/{chunk-HW7QPCOP.js → chunk-WVMKXDOW.js} +148 -53
  82. package/dist/{chunk-LLVBDIQJ.js → chunk-XAR2CJFV.js} +7 -7
  83. package/dist/{chunk-BFWZGLUU.js → chunk-XCTE5S2C.js} +1 -1
  84. package/dist/{chunk-NR3FDUWS.js → chunk-XFODM3V7.js} +7 -7
  85. package/dist/{chunk-BDTFO5S7.js → chunk-XFU37HIM.js} +3 -3
  86. package/dist/{chunk-Q6ANHBJK.js → chunk-YO2NPS66.js} +1 -1
  87. package/dist/chunk-YOAJLD2D.js +270 -0
  88. package/dist/{chunk-MMSFADKC.js → chunk-YZQYTOCR.js} +1 -1
  89. package/dist/{claude-launcher-YDSG5XIN.js → claude-launcher-WMIUTAXY.js} +8 -8
  90. package/dist/{cli-7VKJRQWW.js → cli-R5SJT3YL.js} +233 -156
  91. package/dist/{cli-update-notice-AWYJ4A7R.js → cli-update-notice-OC4SOSZE.js} +2 -2
  92. package/dist/{command-3WAJBJWX.js → command-LWMX6I7W.js} +55 -54
  93. package/dist/{config-O2LJAZJZ.js → config-ZRGYLVDX.js} +13 -13
  94. package/dist/{connect-cmd-3DBWVCUL.js → connect-cmd-MZXTWM4R.js} +15 -15
  95. package/dist/{container-start-T4GH4WLX.js → container-start-VQR5ERZE.js} +53 -52
  96. package/dist/{context-cleanup-Z23RX7JT.js → context-cleanup-Z3HZZZXW.js} +5 -5
  97. package/dist/{context-show-cmd-OGRCR5OT.js → context-show-cmd-SCOVPVDM.js} +16 -16
  98. package/dist/{control-plane-launch-JZPULKCL.js → control-plane-launch-MWZHJ4G5.js} +16 -16
  99. package/dist/{demo-record-cmd-YPWPHDAN.js → demo-record-cmd-4RVSWVMK.js} +9 -9
  100. package/dist/{demo-voice-cmd-TNZ2G5CJ.js → demo-voice-cmd-PGM5JPCQ.js} +24 -24
  101. package/dist/{dist-OMJJT636.js → dist-XEPPXF4M.js} +2 -2
  102. package/dist/docker-25F2KOBJ.js +20 -0
  103. package/dist/{doctor-KHAB6YWH.js → doctor-3QJLCHQY.js} +55 -54
  104. package/dist/emit-artifact-cmd-Z4SHPKFT.js +44 -0
  105. package/dist/{emit-cmd-3YOUQCID.js → emit-cmd-NHMZ4M5S.js} +8 -8
  106. package/dist/emit-criteria-cmd-HCN3DOJM.js +35 -0
  107. package/dist/{emit-demo-cmd-3UBPYRAM.js → emit-demo-cmd-NOSQTOES.js} +24 -24
  108. package/dist/emit-finding-cmd-YXR3ZVCJ.js +36 -0
  109. package/dist/{emit-result-cmd-KRUV7V74.js → emit-result-cmd-Z7MBE37R.js} +22 -22
  110. package/dist/emit-step-cmd-JOSYDSEO.js +35 -0
  111. package/dist/{exec-client-WJLO2KWS.js → exec-client-SZRXXKJ5.js} +9 -9
  112. package/dist/find-unit-3RHC4375.js +24 -0
  113. package/dist/{findings-cmd-3JP4GYD3.js → findings-cmd-NGFY25WZ.js} +20 -20
  114. package/dist/{fleet-readiness-U4IZZV52.js → fleet-readiness-NWIVQQ4P.js} +16 -16
  115. package/dist/governing-source-DNWVPRXP.js +41 -0
  116. package/dist/guest-init-T7QJW2AJ.js +20 -0
  117. package/dist/{hook-fast-2ENS5AKU.js → hook-fast-ECQBMESE.js} +3 -3
  118. package/dist/{hook-install-JTYPE5ZQ.js → hook-install-MBMG3G6B.js} +5 -5
  119. package/dist/host-checks-EHSA6FLE.js +80 -0
  120. package/dist/host-key-6SMJUTJ2.js +18 -0
  121. package/dist/{image-tag-EX2R462S.js → image-tag-OCVY4W5D.js} +9 -9
  122. package/dist/index.js +4 -4
  123. package/dist/{init-7F2KP6XU.js → init-ETG7XYFQ.js} +51 -50
  124. package/dist/init-F7NB7GBW.js +80 -0
  125. package/dist/{init-agent-RJSMNEWD.js → init-agent-WEYGBAII.js} +51 -50
  126. package/dist/{init-cmd-F72BWVFC.js → init-cmd-KGM7TN6Z.js} +29 -29
  127. package/dist/{init-update-ZWSICDTJ.js → init-update-EUJ4264S.js} +26 -26
  128. package/dist/install-cmd-HWG6LJX5.js +21 -0
  129. package/dist/{layout-4FLIBRPO.js → layout-CGE4KWGO.js} +5 -5
  130. package/dist/{login-browser-ZEOXKIQ2.js → login-browser-G7WNR74C.js} +2 -2
  131. package/dist/{logs-BWGJ2BVT.js → logs-TKWJ4S4W.js} +8 -8
  132. package/dist/loop-K3QREUHK.js +90 -0
  133. package/dist/machine-5GTYN2LP.js +80 -0
  134. package/dist/{machine-skills-UEQA3AUX.js → machine-skills-CXA57QHE.js} +5 -5
  135. package/dist/{mcp-install-cmd-DBKKGLHW.js → mcp-install-cmd-6IGK65DV.js} +5 -5
  136. package/dist/{mcp-serve-cmd-LFXU5UGJ.js → mcp-serve-cmd-DVE5XP2U.js} +11 -11
  137. package/dist/{paths-CSZZQK3X.js → paths-VOWYUJLZ.js} +8 -8
  138. package/dist/pending-35ML3JE5.js +18 -0
  139. package/dist/{pidfile-TTIUEDXW.js → pidfile-MFP6B2KV.js} +9 -9
  140. package/dist/{record-U7DU6IVT.js → record-AWCJ3LTG.js} +9 -9
  141. package/dist/{relay-KZTGUSFJ.js → relay-YVZM5M6B.js} +6 -6
  142. package/dist/{relay-protocol-LG4J5K63.js → relay-protocol-MNWITORT.js} +6 -6
  143. package/dist/run-cmd-MBH5Z2UL.js +114 -0
  144. package/dist/{runner-agents-32J743FJ.js → runner-agents-L3PLYFWJ.js} +5 -5
  145. package/dist/runner-env-IHWYZ3B6.js +24 -0
  146. package/dist/{runner-identity-VQCIKNBK.js → runner-identity-E2XKIJNB.js} +11 -11
  147. package/dist/{runner-key-TFFPQCGE.js → runner-key-3AHJX75Z.js} +51 -50
  148. package/dist/session-sender-IS6S7PBC.js +44 -0
  149. package/dist/{spec-cmd-RQFIJ75J.js → spec-cmd-ZLDYL4N5.js} +21 -21
  150. package/dist/{starter-pack-LO3D6CPP.js → starter-pack-XINCCMDN.js} +6 -6
  151. package/dist/state-NIA6XT7D.js +18 -0
  152. package/dist/{status-KGZWBU26.js → status-GZ7KAIMH.js} +51 -50
  153. package/dist/{sync-cmd-4RSCWFAF.js → sync-cmd-3YZ4IB3T.js} +22 -22
  154. package/dist/update-steps-XY46I7FV.js +81 -0
  155. package/dist/{watch-NH5QZJLE.js → watch-LIIODJ5U.js} +22 -22
  156. package/dist/{work-claim-cmd-FNE2ZMVG.js → work-claim-cmd-GWBWIZ43.js} +25 -25
  157. package/dist/work-cmd-CJWTGOU5.js +33 -0
  158. package/dist/work-comment-cmd-RFVCNEET.js +39 -0
  159. package/dist/{work-demo-cmd-56C6JQD3.js → work-demo-cmd-Q2GKJCVL.js} +18 -18
  160. package/dist/{work-launch-LWDQXLGI.js → work-launch-ODTGCNJC.js} +1 -1
  161. package/dist/{work-logs-cmd-XKVZ2UY6.js → work-logs-cmd-KZQBPU2J.js} +18 -18
  162. package/dist/{work-needs-attention-cmd-DYD3AIRU.js → work-needs-attention-cmd-L3DOYAMK.js} +18 -18
  163. package/dist/{work-no-change-cmd-QVD67UG5.js → work-no-change-cmd-SHP25CJB.js} +18 -18
  164. package/dist/{work-open-pr-cmd-3SSJPKHW.js → work-open-pr-cmd-VATPLVSL.js} +20 -20
  165. package/dist/work-pr-cmd-XBLNONT3.js +34 -0
  166. package/dist/work-proofs-cmd-T5WZG3CX.js +37 -0
  167. package/dist/{work-proofs-record-KEZ6Z4QH.js → work-proofs-record-6YF4BS3K.js} +28 -28
  168. package/dist/{work-stop-cmd-4KNMURDC.js → work-stop-cmd-BLOSL24H.js} +18 -18
  169. package/package.json +2 -2
  170. package/skill-pack/maintained/outerlayer-amend/SKILL.md +1 -0
  171. package/skill-pack/maintained/outerlayer-amend/references/attachments.md +23 -0
  172. package/skill-pack/maintained/outerlayer-build/SKILL.md +5 -0
  173. package/skill-pack/maintained/outerlayer-cli/SKILL.md +9 -0
  174. package/skill-pack/maintained/outerlayer-run/SKILL.md +49 -0
  175. package/skill-pack/shipped.json +2 -0
  176. package/skill-pack/template/spec/SKILL.md +10 -11
  177. package/skill-pack/template/writing-specs/SKILL.md +18 -22
  178. package/dist/agent-setup-MLSWF7RF.js +0 -40
  179. package/dist/caller-VU7QBFHQ.js +0 -23
  180. package/dist/chunk-UNA4YIHE.js +0 -128
  181. package/dist/docker-MOESJVCB.js +0 -20
  182. package/dist/emit-artifact-cmd-W7YBXLA7.js +0 -44
  183. package/dist/emit-criteria-cmd-KZW275Q2.js +0 -35
  184. package/dist/emit-finding-cmd-NL6H2PBJ.js +0 -36
  185. package/dist/emit-step-cmd-SHBIO2JI.js +0 -35
  186. package/dist/find-unit-YNIILXQK.js +0 -24
  187. package/dist/governing-source-VZFU65KP.js +0 -41
  188. package/dist/guest-init-HIKD3MHJ.js +0 -20
  189. package/dist/host-checks-HZLHQ6WH.js +0 -79
  190. package/dist/host-key-V2VVCBGR.js +0 -18
  191. package/dist/init-XTTWPX6J.js +0 -79
  192. package/dist/install-cmd-LX76Y7NB.js +0 -21
  193. package/dist/loop-O5JBFZXP.js +0 -90
  194. package/dist/machine-LGJSYGQS.js +0 -79
  195. package/dist/pending-BHRSEFXV.js +0 -18
  196. package/dist/runner-env-RGYTHURZ.js +0 -24
  197. package/dist/session-sender-3VFTMIM3.js +0 -44
  198. package/dist/state-IH6JOEJZ.js +0 -18
  199. package/dist/update-steps-3LU3NZQL.js +0 -80
  200. package/dist/work-cmd-32J5UQJO.js +0 -33
  201. package/dist/work-comment-cmd-ZUZEAIIH.js +0 -38
  202. package/dist/work-pr-cmd-DF6Q5XHU.js +0 -34
  203. package/dist/work-proofs-cmd-2XWS5N2R.js +0 -37
@@ -0,0 +1,270 @@
1
+ #!/usr/bin/env node
2
+ import { createRequire } from 'node:module';
3
+ import { resolveCredentials, postBytes, RateLimitedError, postJson, getJson, getBytes } from './chunk-B4U5XI4F.js';
4
+ import { detectActiveSession } from './chunk-SBPMDO47.js';
5
+ import { sanitizeTerminal } from './chunk-B5Z4VA4Q.js';
6
+ import { C } from './chunk-2AM6Z5BP.js';
7
+ import { defaultFetch } from './chunk-VRWZNI6U.js';
8
+ import { logHookError } from './chunk-QGUCHNSQ.js';
9
+ import { parseWorkItemEnv } from './chunk-LGJ56FCM.js';
10
+ import { parseTrackerNumber, trackerNumberError } from './chunk-WZBHBH3J.js';
11
+ import { homeFromEnv } from './chunk-352DHUTP.js';
12
+ import { resolveRepoIdentity } from './chunk-MBPBYMHU.js';
13
+ import { ATTACHMENT_CLIENT_ID_HEADER, ATTACHMENT_SHA256_HEADER, ATTACHMENT_FILENAME_HEADER, cleanAttachmentFilename, WORK_ITEM_ATTACHMENTS_MAX_PER_COMMENT, attachmentKind, WORK_ITEM_ATTACHMENT_MAX_BYTES, WORK_ITEM_ATTACHMENTS_MAX_TOTAL_BYTES } from './chunk-FXVHF6RX.js';
14
+ import { randomUUID, createHash } from 'crypto';
15
+ import { mkdirSync, statSync, readFileSync, writeFileSync } from 'fs';
16
+ import { resolve, extname, basename, join } from 'path';
17
+
18
+ createRequire(import.meta.url);
19
+ var WorkCommentCommandError = class extends Error {
20
+ };
21
+ function resolveAction(opts) {
22
+ const set = ["pass", "fail", "attach", "ready"].filter((flag) => opts[flag] === true);
23
+ if (set.length > 1) {
24
+ throw new WorkCommentCommandError(`only one of --${set.join(", --")} may be given \u2014 a comment carries at most one action`);
25
+ }
26
+ return set[0];
27
+ }
28
+ var MEDIA_TYPE_BY_EXTENSION = {
29
+ ".png": "image/png",
30
+ ".jpg": "image/jpeg",
31
+ ".jpeg": "image/jpeg",
32
+ ".gif": "image/gif",
33
+ ".webp": "image/webp",
34
+ ".mp4": "video/mp4",
35
+ ".webm": "video/webm",
36
+ ".pdf": "application/pdf",
37
+ ".txt": "text/plain",
38
+ ".log": "text/plain",
39
+ ".csv": "text/csv",
40
+ ".md": "text/markdown",
41
+ ".json": "application/json",
42
+ ".ndjson": "application/x-ndjson",
43
+ ".jsonl": "application/x-ndjson",
44
+ ".zip": "application/zip",
45
+ ".gz": "application/gzip",
46
+ ".tgz": "application/gzip"
47
+ };
48
+ function readFilesToUpload(paths, cwd) {
49
+ if (paths.length > WORK_ITEM_ATTACHMENTS_MAX_PER_COMMENT) {
50
+ throw new WorkCommentCommandError(`a comment takes at most ${WORK_ITEM_ATTACHMENTS_MAX_PER_COMMENT} files; ${paths.length} were given`);
51
+ }
52
+ let total = 0;
53
+ return paths.map((given) => {
54
+ const path = resolve(cwd, given);
55
+ const mediaType = MEDIA_TYPE_BY_EXTENSION[extname(path).toLowerCase()];
56
+ if (mediaType === void 0 || attachmentKind(mediaType) === null) {
57
+ throw new WorkCommentCommandError(`${basename(path)} was not added: this file type is not allowed. Allowed: ${Object.keys(MEDIA_TYPE_BY_EXTENSION).join(" ")}`);
58
+ }
59
+ let size;
60
+ try {
61
+ size = statSync(path).size;
62
+ } catch {
63
+ throw new WorkCommentCommandError(`${basename(path)} was not added: the file cannot be read`);
64
+ }
65
+ if (size > WORK_ITEM_ATTACHMENT_MAX_BYTES) {
66
+ throw new WorkCommentCommandError(`${basename(path)} was not added: it is larger than 8 MiB`);
67
+ }
68
+ total += size;
69
+ if (total > WORK_ITEM_ATTACHMENTS_MAX_TOTAL_BYTES) {
70
+ throw new WorkCommentCommandError(`the files together are larger than 10 MiB; ${basename(path)} was not added`);
71
+ }
72
+ const bytes = readFileSync(path);
73
+ return { path, filename: cleanAttachmentFilename(basename(path)), mediaType, bytes, sha256: createHash("sha256").update(bytes).digest("hex") };
74
+ });
75
+ }
76
+ function rateLimitedError(err) {
77
+ const wait = err.retryAfterSeconds === void 0 ? "Wait, then run the command again." : `Wait ${err.retryAfterSeconds} seconds, then run the command again.`;
78
+ return new WorkCommentCommandError(`rate_limited: ${err.message}. ${wait}`);
79
+ }
80
+ async function runWorkComment(opts) {
81
+ const cwd = opts.cwd ?? process.cwd();
82
+ const home = opts.home ?? homeFromEnv();
83
+ const env = opts.env ?? process.env;
84
+ const now = opts.now ?? (() => /* @__PURE__ */ new Date());
85
+ const itemNumber = parseTrackerNumber(opts.item);
86
+ if (itemNumber === void 0) {
87
+ throw new WorkCommentCommandError(trackerNumberError("--item", opts.item ?? ""));
88
+ }
89
+ const action = resolveAction(opts);
90
+ if (opts.thread !== void 0 && (opts.criterion !== void 0 || action !== void 0)) {
91
+ throw new WorkCommentCommandError("--thread answers one thread and takes no --criterion and no action flag");
92
+ }
93
+ if (action === "attach" && !opts.artifact) {
94
+ throw new WorkCommentCommandError("--attach needs --artifact <id>, naming the artifact that becomes the criterion's proof");
95
+ }
96
+ if (action === "attach" && !opts.criterion) {
97
+ throw new WorkCommentCommandError("--attach needs --criterion <id> \u2014 it names which criterion the artifact becomes proof for");
98
+ }
99
+ const identity = resolveRepoIdentity(cwd);
100
+ const sessionId = opts.sessionId ?? detectActiveSession({
101
+ env,
102
+ home,
103
+ cwds: identity.repoRoot !== void 0 ? [identity.repoRoot, cwd] : [cwd],
104
+ nowMs: now().getTime()
105
+ });
106
+ const files = opts.files ?? [];
107
+ if (files.length > 0 && action === "attach") {
108
+ throw new WorkCommentCommandError("--attach names its proof with --artifact and takes no --file");
109
+ }
110
+ const uploads = readFilesToUpload(files, cwd);
111
+ const creds = resolveCredentials({ ...opts, cwd, home, env });
112
+ const fetchImpl = opts.fetchImpl ?? defaultFetch;
113
+ const clientCommentId = opts.clientCommentId ?? randomUUID();
114
+ const attachmentIds = [];
115
+ try {
116
+ for (const [index, upload] of uploads.entries()) {
117
+ const { data: stored } = await postBytes(
118
+ creds.url,
119
+ `/v1/work-items/${itemNumber}/attachments`,
120
+ creds.apiKey,
121
+ creds.appId,
122
+ upload.bytes,
123
+ {
124
+ "content-type": upload.mediaType,
125
+ [ATTACHMENT_FILENAME_HEADER]: encodeURIComponent(upload.filename),
126
+ [ATTACHMENT_SHA256_HEADER]: upload.sha256,
127
+ [ATTACHMENT_CLIENT_ID_HEADER]: `${clientCommentId}:${index}`
128
+ },
129
+ fetchImpl
130
+ );
131
+ attachmentIds.push(String(stored.id));
132
+ }
133
+ } catch (err) {
134
+ if (err instanceof RateLimitedError) throw rateLimitedError(err);
135
+ throw err;
136
+ }
137
+ const comment = {
138
+ clientCommentId,
139
+ body: opts.body ?? "",
140
+ ...opts.criterion !== void 0 ? { criterion: opts.criterion } : {},
141
+ thread: opts.thread,
142
+ ...action !== void 0 ? { action } : {},
143
+ ...opts.artifact !== void 0 ? { artifact: opts.artifact } : {},
144
+ ...sessionId !== void 0 ? { sessionId } : {},
145
+ ...attachmentIds.length > 0 ? { attachments: attachmentIds } : {}
146
+ };
147
+ const { data } = await postJson(
148
+ creds.url,
149
+ `/v1/work-items/${itemNumber}/comments`,
150
+ creds.apiKey,
151
+ creds.appId,
152
+ { schemaVersion: 1, comment },
153
+ fetchImpl
154
+ );
155
+ const thread = data.thread;
156
+ const waitingOn = thread?.waitingOn ?? null;
157
+ const criterionLabel = opts.thread ? `thread ${opts.thread}` : opts.criterion ? `criterion ${opts.criterion}` : "the general thread";
158
+ const output = opts.json ? JSON.stringify(data) : `${C.green}\u2713${C.reset} commented on ${criterionLabel} of item #${itemNumber} ${C.dim}\xB7${C.reset} waiting on ${waitingOn ?? "no one"}`;
159
+ if (!opts.quiet) process.stdout.write(output + "\n");
160
+ return { data, output };
161
+ }
162
+ async function runWorkThreads(opts) {
163
+ const itemNumber = parseTrackerNumber(opts.item);
164
+ if (itemNumber === void 0) {
165
+ throw new WorkCommentCommandError(trackerNumberError("--item", opts.item ?? ""));
166
+ }
167
+ const creds = resolveCredentials(opts);
168
+ const fetchImpl = opts.fetchImpl ?? defaultFetch;
169
+ const { data } = await getJson(creds.url, `/v1/work-items/${itemNumber}/threads`, creds.apiKey, creds.appId, fetchImpl);
170
+ if (opts.json) {
171
+ const output2 = JSON.stringify(data);
172
+ if (!opts.quiet) process.stdout.write(output2 + "\n");
173
+ return { data, output: output2 };
174
+ }
175
+ const page = data;
176
+ const lines = [
177
+ renderThread("general", page.general),
178
+ ...page.criteria.map((t) => renderThread(t.criterion ?? "", t)),
179
+ ...(page.threads ?? []).map(renderSourceThread)
180
+ ];
181
+ const output = lines.join("\n");
182
+ if (!opts.quiet) process.stdout.write(output + "\n");
183
+ return { data, output };
184
+ }
185
+ function attachmentLines(attachments) {
186
+ return (attachments ?? []).map((a) => ` attachment ${sanitizeTerminal(a.id)} \xB7 ${sanitizeTerminal(a.filename)} \xB7 ${a.sizeBytes} bytes`);
187
+ }
188
+ function renderSourceThread(thread) {
189
+ const place = thread.anchor ? ` \xB7 ${sanitizeTerminal(thread.anchor.path)}:${thread.anchor.line}` : "";
190
+ const header = `${C.dim}thread ${sanitizeTerminal(thread.id)} \xB7 ${sanitizeTerminal(thread.source)}${place} \xB7 waiting on ${thread.waitingOn ?? "no one"}${C.reset}`;
191
+ const comments = thread.comments.flatMap((c) => [
192
+ ` ${c.authorKind === "person" ? "person" : "agent"} ${sanitizeTerminal(c.authorName)}: ${sanitizeTerminal(c.body)}`,
193
+ ...attachmentLines(c.attachments)
194
+ ]);
195
+ return [header, ...comments].join("\n");
196
+ }
197
+ function renderThread(label, thread) {
198
+ const header = `${C.dim}${label === "general" ? "general" : `criterion ${label}`} \xB7 waiting on ${thread.waitingOn ?? "no one"}${C.reset}`;
199
+ const checks = (thread.checkItems ?? []).flatMap((item) => [
200
+ ` check ${sanitizeTerminal(item.check)}${item.id === thread.criterion ? "" : ` \xB7 ${sanitizeTerminal(item.id)}`} \xB7 ${sanitizeTerminal(item.result)}${item.reason ? `: ${sanitizeTerminal(item.reason)}` : ""}`,
201
+ ...(item.refs ?? []).map((ref) => ` ${sanitizeTerminal(ref.path)}${ref.line === void 0 ? "" : `:${ref.line}`}`)
202
+ ]);
203
+ const comments = thread.comments.flatMap((c) => [
204
+ ` ${c.author.kind === "person" ? "person" : "agent"} ${sanitizeTerminal(c.author.name)}: ${sanitizeTerminal(c.body)}${c.action ? ` (${c.action})` : ""}`,
205
+ ...attachmentLines(c.attachments)
206
+ ]);
207
+ return [header, ...checks, ...comments].join("\n");
208
+ }
209
+ async function runWorkCommentsRead(opts) {
210
+ const home = opts.home ?? homeFromEnv();
211
+ try {
212
+ const itemNumber = parseTrackerNumber(opts.item);
213
+ if (itemNumber === void 0) throw new WorkCommentCommandError(trackerNumberError("--item", opts.item ?? ""));
214
+ const creds = resolveCredentials({ ...opts, cwd: opts.cwd ?? process.cwd(), home, env: opts.env ?? process.env });
215
+ await postJson(creds.url, `/v1/work-items/${itemNumber}/comments/read`, creds.apiKey, creds.appId, { commentIds: opts.commentIds }, opts.fetchImpl ?? defaultFetch);
216
+ } catch (err) {
217
+ logHookError(home, new Error(`work comments-read for item ${opts.item ?? ""} failed: ${err instanceof Error ? err.message : String(err)}`));
218
+ }
219
+ }
220
+ function dispositionFilename(header) {
221
+ const match = header?.match(/filename\*=(?:UTF-8'')?([^;]+)/i);
222
+ if (match?.[1] === void 0) return void 0;
223
+ try {
224
+ return decodeURIComponent(match[1].trim());
225
+ } catch {
226
+ return void 0;
227
+ }
228
+ }
229
+ function writeWithoutReplacing(folder, name, bytes) {
230
+ const dot = name.lastIndexOf(".");
231
+ const stem = dot > 0 ? name.slice(0, dot) : name;
232
+ const extension = dot > 0 ? name.slice(dot) : "";
233
+ for (let n = 1; ; n++) {
234
+ const path = join(folder, n === 1 ? name : `${stem} (${n})${extension}`);
235
+ try {
236
+ writeFileSync(path, bytes, { flag: "wx" });
237
+ return path;
238
+ } catch (err) {
239
+ if (err.code !== "EEXIST") throw err;
240
+ }
241
+ }
242
+ }
243
+ async function runWorkAttachmentGet(opts) {
244
+ let item = opts.item;
245
+ if (item === void 0) {
246
+ const parsed = parseWorkItemEnv((opts.env ?? process.env).OUTERLAYER_WORK);
247
+ if (!("number" in parsed)) throw new WorkCommentCommandError(`pass --item <number>: ${parsed.reason}`);
248
+ item = parsed.number;
249
+ }
250
+ const itemNumber = parseTrackerNumber(item);
251
+ if (itemNumber === void 0) throw new WorkCommentCommandError(trackerNumberError("--item", opts.item ?? ""));
252
+ const creds = resolveCredentials(opts);
253
+ const fetchImpl = opts.fetchImpl ?? defaultFetch;
254
+ const got = await getBytes(creds.url, `/v1/work-items/${itemNumber}/attachments/${encodeURIComponent(opts.attachment)}`, creds.apiKey, creds.appId, fetchImpl);
255
+ let name = dispositionFilename(got.disposition);
256
+ if (name === void 0) {
257
+ const { data } = await getJson(creds.url, `/v1/work-items/${itemNumber}/threads`, creds.apiKey, creds.appId, fetchImpl);
258
+ const page = data;
259
+ const comments = [page.general, ...page.criteria ?? [], ...page.threads ?? []].flatMap((t) => t?.comments ?? []);
260
+ name = comments.flatMap((c) => c.attachments ?? []).find((a) => a.id === opts.attachment)?.filename;
261
+ }
262
+ const folder = resolve(opts.cwd ?? process.cwd(), opts.out ?? ".");
263
+ mkdirSync(folder, { recursive: true });
264
+ const path = writeWithoutReplacing(folder, cleanAttachmentFilename(name ?? opts.attachment), got.bytes);
265
+ const output = opts.json ? JSON.stringify({ path }) : path;
266
+ if (!opts.quiet) process.stdout.write(output + "\n");
267
+ return { path, output };
268
+ }
269
+
270
+ export { WorkCommentCommandError, runWorkAttachmentGet, runWorkComment, runWorkCommentsRead, runWorkThreads };
@@ -1,6 +1,6 @@
1
1
  #!/usr/bin/env node
2
2
  import { createRequire } from 'node:module';
3
- import { RUNNER_DIR_MODE, RUNNER_FILE_MODE } from './chunk-LO3PSFNT.js';
3
+ import { RUNNER_DIR_MODE, RUNNER_FILE_MODE } from './chunk-AC6DM3S3.js';
4
4
  import { readFileSync, mkdirSync, writeFileSync, renameSync } from 'fs';
5
5
  import { join } from 'path';
6
6
 
@@ -1,18 +1,18 @@
1
1
  #!/usr/bin/env node
2
2
  import { createRequire } from 'node:module';
3
- import { withInjectedPrograms } from './chunk-22QIA7SH.js';
4
- import { sharedSkillNames } from './chunk-TTG6Y7G7.js';
3
+ import { withInjectedPrograms } from './chunk-47JRSV6Y.js';
4
+ import { sharedSkillNames } from './chunk-L6CZTRNW.js';
5
5
  import { GOVERNANCE_VARIABLE, versionAtLeast, CONTROL_PLANE_DIR_VARIABLE } from './chunk-SF2TBJBP.js';
6
6
  import { findGitDirs } from './chunk-BJ3KTMDH.js';
7
- import { setupMachineSkills } from './chunk-JMWCPEKP.js';
8
- import { defaultAgents, agentById, legacyAgent } from './chunk-OKELGJNN.js';
7
+ import { setupMachineSkills } from './chunk-7E55P2NR.js';
8
+ import { defaultAgents, agentById, legacyAgent } from './chunk-MT4XF5OL.js';
9
9
  import './chunk-PLVHIQJN.js';
10
10
  import { LEGACY_AGENT } from './chunk-7PZDPISM.js';
11
- import './chunk-CDDED64E.js';
11
+ import './chunk-ATEMEVFF.js';
12
12
  import './chunk-RA3O54FC.js';
13
13
  import { homeFromEnv } from './chunk-352DHUTP.js';
14
- import './chunk-N2QYP3NQ.js';
15
- import './chunk-HE53NIRE.js';
14
+ import './chunk-MBPBYMHU.js';
15
+ import './chunk-FXVHF6RX.js';
16
16
  import './chunk-Z5GEFMRW.js';
17
17
  import { spawn, execFileSync } from 'child_process';
18
18
  import { existsSync, readdirSync, lstatSync, readFileSync, writeFileSync, rmSync, mkdirSync, realpathSync, symlinkSync, renameSync, readlinkSync, statSync } from 'fs';
@@ -325,7 +325,7 @@ async function runAgentLauncher(agentId, args, deps = {}) {
325
325
  return 1;
326
326
  }
327
327
  } else {
328
- const { resolveLaunchPlane } = await import('./control-plane-launch-JZPULKCL.js');
328
+ const { resolveLaunchPlane } = await import('./control-plane-launch-MWZHJ4G5.js');
329
329
  const plane = env[GOVERNANCE_VARIABLE] === "self" ? { kind: "none" } : await resolveLaunchPlane({ cwd, env, home, fetchImpl: deps.fetchImpl, stderr });
330
330
  if (plane.kind === "none") {
331
331
  const own2 = ownSkillsDirFor(prefix, cwd, home, /* @__PURE__ */ new Set(), stderr);