0sec-cli 0.22.1 → 0.23.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 (219) hide show
  1. package/0.js +64 -47
  2. package/README.md +73 -53
  3. package/chunks/{adapt-loop-J6QCZZTB.js → adapt-loop-V3JFWOKC.js} +4 -4
  4. package/chunks/{artifact-scraper-MFKT6OI4.js → artifact-scraper-NYKUF2M5.js} +2 -2
  5. package/chunks/{assumption-mining-646LYSJY.js → assumption-mining-ZX3YVWEH.js} +19 -15
  6. package/chunks/backend-connections-H52NIVH2.js +23 -0
  7. package/chunks/{chunk-NLH4LMWH.js → chunk-3E54JYS4.js} +1 -1
  8. package/chunks/chunk-3P3XXSIJ.js +463 -0
  9. package/chunks/{chunk-CPWA6RWE.js → chunk-3ZNI7F42.js} +3 -3
  10. package/chunks/{chunk-LGCASF2C.js → chunk-4HGGNBKK.js} +7405 -2225
  11. package/chunks/{chunk-TM74SSHC.js → chunk-62ENS6XO.js} +1 -1
  12. package/chunks/{chunk-4VGLO2YS.js → chunk-65H3MRBF.js} +5 -2
  13. package/chunks/chunk-A2ADXAC5.js +5329 -0
  14. package/chunks/chunk-A5QO7N3S.js +74 -0
  15. package/chunks/chunk-AAA4PRWK.js +990 -0
  16. package/chunks/{chunk-AV2LG2L7.js → chunk-BF5FIK7H.js} +257 -145
  17. package/chunks/chunk-CP6HANBE.js +355 -0
  18. package/chunks/{chunk-HHPWRY2M.js → chunk-EH2WTNY7.js} +23474 -22746
  19. package/chunks/{chunk-OSBPGWTE.js → chunk-EJH2TNVH.js} +3 -3
  20. package/chunks/chunk-EWXOG6D3.js +1695 -0
  21. package/chunks/{chunk-WZRVS7SB.js → chunk-F344NYUN.js} +1 -1
  22. package/chunks/chunk-FXR3BT2G.js +226 -0
  23. package/chunks/{chunk-GOEA3NW6.js → chunk-HFDSIHTE.js} +1603 -1295
  24. package/chunks/chunk-I3OCJ2OA.js +309 -0
  25. package/chunks/{chunk-X7LAEEUW.js → chunk-ITES7BCY.js} +1 -1
  26. package/chunks/{chunk-YL6YAGLL.js → chunk-JEYIWMGL.js} +1 -1
  27. package/chunks/{chunk-WSDDGFA6.js → chunk-K55B4OH4.js} +1 -1
  28. package/chunks/{chunk-TH2LW437.js → chunk-KCA35IL3.js} +2 -190
  29. package/chunks/chunk-KHPOSLCF.js +1659 -0
  30. package/chunks/chunk-LT7BFGXA.js +733 -0
  31. package/chunks/{chunk-KAU6NLGP.js → chunk-LTEE2JWK.js} +786 -20
  32. package/chunks/{chunk-ZKQ2I3S2.js → chunk-LVGZGG63.js} +1 -1
  33. package/chunks/chunk-MQJVU2GZ.js +277 -0
  34. package/chunks/{chunk-OHHCGDJ2.js → chunk-NI6QYQSK.js} +126 -1089
  35. package/chunks/{chunk-6YNKRUMC.js → chunk-NJLKFC66.js} +321 -5
  36. package/chunks/{chunk-3E2KALZ5.js → chunk-NX4H6L4M.js} +2 -2
  37. package/chunks/{chunk-W6UWZFKL.js → chunk-O6KPVYOI.js} +100 -5
  38. package/chunks/{chunk-IVQV574Y.js → chunk-O6Z4XPOM.js} +1 -1
  39. package/chunks/{chunk-V6GHX34G.js → chunk-OLSKXTQZ.js} +8 -274
  40. package/chunks/{chunk-5BTJMINS.js → chunk-P7KDN5PK.js} +208 -46
  41. package/chunks/chunk-PIR6BNE7.js +83 -0
  42. package/chunks/{chunk-XCISCI4T.js → chunk-QMICC5O2.js} +30 -12
  43. package/chunks/{chunk-6GHSR47F.js → chunk-R35KKJA4.js} +1 -58
  44. package/chunks/chunk-RS4MAN3Q.js +73 -0
  45. package/chunks/{chunk-VWITLWXB.js → chunk-T7ZEVY5G.js} +307 -34
  46. package/chunks/chunk-TPUJZ74W.js +36 -0
  47. package/chunks/{chunk-IFME676H.js → chunk-UZUELPFW.js} +79 -18
  48. package/chunks/{chunk-TV27OWIW.js → chunk-V2BWXPZP.js} +9 -9
  49. package/chunks/chunk-VDOWARMJ.js +63 -0
  50. package/chunks/{chunk-XDKB2P5X.js → chunk-W5VNCB57.js} +1 -1
  51. package/chunks/{chunk-4G7OVYJX.js → chunk-WIYNYNL2.js} +1 -1
  52. package/chunks/chunk-WYNZFNMF.js +457 -0
  53. package/chunks/{chunk-7XCKYNLO.js → chunk-XORZUR2H.js} +1 -1
  54. package/chunks/{chunk-2OQOQ2FZ.js → chunk-Y4HJRUFE.js} +20 -4
  55. package/chunks/{chunk-V36HVTUL.js → chunk-YAEJAZYW.js} +21 -18
  56. package/chunks/{chunk-XA2O4WXA.js → chunk-YYS2H33A.js} +169 -15
  57. package/chunks/{codex-models-NHQW45SO.js → codex-models-Y457ND6Q.js} +9 -3
  58. package/chunks/{commands-N6GN5SBF.js → commands-PBDAOZKA.js} +7019 -5937
  59. package/chunks/{db-5IWEJUYV.js → db-TPSI552V.js} +3 -3
  60. package/chunks/deep-review-DKED6EN5.js +81 -0
  61. package/chunks/{dist-L3XJWWZ6.js → dist-4LGRIBOC.js} +209 -114
  62. package/chunks/{dist-FSS7MBDF.js → dist-7Q5A6TQM.js} +12 -2
  63. package/chunks/{dist-KEULE5IQ.js → dist-LNXGATR2.js} +2 -2
  64. package/chunks/{dist-XZB53PS5.js → dist-M2X367VW.js} +2 -2
  65. package/chunks/{dist-BS4CY4RG.js → dist-RLPNLRZD.js} +79 -1
  66. package/chunks/eval-runner-RZKDOQ2G.js +30 -0
  67. package/chunks/{exploit-agent-KW4EB7BE.js → exploit-agent-RMFYNG7H.js} +1 -1
  68. package/chunks/{exploit-autoclimb-CXJ2ERRO.js → exploit-autoclimb-2A2PQI4E.js} +1 -1
  69. package/chunks/{exploit-climb-TJWLY4XC.js → exploit-climb-DEJ232QN.js} +2 -2
  70. package/chunks/{fix-UUKPXCFB.js → fix-JGBW7XUN.js} +12 -6
  71. package/chunks/{harness-C5HOKIEV.js → harness-CBOLMUHB.js} +3 -3
  72. package/chunks/{hunt-scan-KZZ444V2.js → hunt-scan-MIRMABY4.js} +17 -13
  73. package/chunks/{kernel-primitive-Z77IR7YS.js → kernel-primitive-NAPDMJC7.js} +2 -2
  74. package/chunks/{kernel-vm-runner-JW77P276.js → kernel-vm-runner-PR5OSDQ2.js} +2 -2
  75. package/chunks/managed-operation-YNQQEA5V.js +59 -0
  76. package/chunks/{memsafety-scan-FCPAXIZE.js → memsafety-scan-RPS446CD.js} +2 -2
  77. package/chunks/{native-loop-P6P5GYVJ.js → native-loop-CGOJMNHV.js} +19 -9
  78. package/chunks/orchestrate-5NK34H3W.js +62 -0
  79. package/chunks/{prepare-KYHGFWCJ.js → prepare-YVNENPNL.js} +6 -2
  80. package/chunks/{process-N245QIQG.js → process-MJYJ2K5E.js} +2 -1
  81. package/chunks/remote-workflow-runtime-RGQ5ECMN.js +96 -0
  82. package/chunks/{run-GAFKBCTN.js → run-VH4OIDKF.js} +1919 -4817
  83. package/chunks/{runtime-XFWJTBUO.js → runtime-4TAJFVF7.js} +7 -1
  84. package/chunks/{runtime-H7YBR5IZ.js → runtime-HWL6HG7A.js} +10 -4
  85. package/chunks/{scan-stream-BMOCPKQX.js → scan-stream-HJAZJONE.js} +7 -1
  86. package/chunks/{scope-QWY4VQZ7.js → scope-Q5PIX2IS.js} +2 -2
  87. package/chunks/service-plugins-QYFITODK.js +63 -0
  88. package/chunks/{session-store-XIDFGG7K.js → session-store-2FEIZGSV.js} +6 -4
  89. package/chunks/{variant-candidates-7D4F5E4H.js → variant-candidates-TX5V6XOT.js} +9 -3
  90. package/chunks/{web-recon-prepass-VXXBPDAV.js → web-recon-prepass-6HOUGF7Q.js} +11 -6
  91. package/chunks/workflow-runtime-ZEEBJFQG.js +64 -0
  92. package/dashboard/apple-touch-icon.png +0 -0
  93. package/dashboard/assets/abnfDiagram-VCTEODGH-BuvumFYR.js +1 -0
  94. package/dashboard/assets/arc-DZzWDuCG.js +1 -0
  95. package/dashboard/assets/architecture-7GRP2DOG-DK9bv1Md.js +1 -0
  96. package/dashboard/assets/architectureDiagram-5GKGNRK7-Bw5el_EL.js +36 -0
  97. package/dashboard/assets/array-BifhSqXX.js +1 -0
  98. package/dashboard/assets/blockDiagram-I7D4REHJ-BjVLEApp.js +129 -0
  99. package/dashboard/assets/c4Diagram-7LVT6UL2-B9nNzx2J.js +38 -0
  100. package/dashboard/assets/channel-Ck17eKdX.js +1 -0
  101. package/dashboard/assets/chunk-2Q5K7J3B-C1jixKkw.js +1 -0
  102. package/dashboard/assets/chunk-4HAMMTFA-y72Q95nW.js +62 -0
  103. package/dashboard/assets/chunk-5VM5RSS4-ZNzvKenW.js +15 -0
  104. package/dashboard/assets/chunk-75Z2AOVW-BOhrOGMO.js +2 -0
  105. package/dashboard/assets/chunk-DU6HZSFF-B0EhAaNb.js +127 -0
  106. package/dashboard/assets/chunk-F27PBJKO-BR-hiDvM.js +1 -0
  107. package/dashboard/assets/chunk-FOHPRMQF-DHwB1DNv.js +161 -0
  108. package/dashboard/assets/chunk-GMAD6QVW-H15vJYXg.js +72 -0
  109. package/dashboard/assets/chunk-GVQU2GXP-BRndps0o.js +1 -0
  110. package/dashboard/assets/chunk-IMKFNOWR-CIzC_OWx.js +231 -0
  111. package/dashboard/assets/chunk-JWPE2WC7-DVXcaiue.js +1 -0
  112. package/dashboard/assets/chunk-L3NEJ4N5-NR4P1Vko.js +1 -0
  113. package/dashboard/assets/chunk-OSK3NFVY-DtjTDf8S.js +10 -0
  114. package/dashboard/assets/chunk-P2QGCYS3-CYT11Qjx.js +1 -0
  115. package/dashboard/assets/chunk-POPQ4Y6H-Duj2Ygwu.js +1 -0
  116. package/dashboard/assets/chunk-PWAF6VOD-z4p5Tf_y.js +1 -0
  117. package/dashboard/assets/chunk-SHT3W25Y-DYeLYLS3.js +168 -0
  118. package/dashboard/assets/chunk-SVP7TREG-BKowxCVI.js +88 -0
  119. package/dashboard/assets/chunk-TICWLB2K-GDAwEFlH.js +206 -0
  120. package/dashboard/assets/chunk-XXDRQBXY-DRD79Mjx.js +1 -0
  121. package/dashboard/assets/chunk-Y2CYZVJY-DsF7k-Jl.js +1 -0
  122. package/dashboard/assets/classDiagram-ZZMXUADV-BaeZA6LE.js +1 -0
  123. package/dashboard/assets/classDiagram-v2-VYDZK3BY-BaeZA6LE.js +1 -0
  124. package/dashboard/assets/common-vnzd7UOF.js +5 -0
  125. package/dashboard/assets/cose-bilkent-JH36ORCC-GqCLsRyf.js +1 -0
  126. package/dashboard/assets/cynefin-OW5HDTMX-CJN9YwWN.js +1 -0
  127. package/dashboard/assets/cynefinDiagram-5FMLGOSQ-DVJHCYQY.js +62 -0
  128. package/dashboard/assets/cytoscape.esm-CGd-uY3x.js +321 -0
  129. package/dashboard/assets/dagre-GXQ25YYZ-BMCrrJJR.js +4 -0
  130. package/dashboard/assets/dagre-PrKaheQc.js +1 -0
  131. package/dashboard/assets/defaultLocale-BFoDCU3G.js +1 -0
  132. package/dashboard/assets/diagram-S7CK7UJ4-CLYDdOEm.js +30 -0
  133. package/dashboard/assets/diagram-UQ7AKVKN-CnPuAZK7.js +41 -0
  134. package/dashboard/assets/diagram-VSXAHHWV-Cr2I2DnG.js +3 -0
  135. package/dashboard/assets/diagram-VX7I27RA-_mGW1wpp.js +24 -0
  136. package/dashboard/assets/diagram-Z3DM3KII-igybB0l9.js +24 -0
  137. package/dashboard/assets/dist-Bb7_-x5y.js +1 -0
  138. package/dashboard/assets/ebnfDiagram-PWID7BFC-CVCICf2R.js +1 -0
  139. package/dashboard/assets/erDiagram-RLTQ6QDP-CRjnfgxj.js +99 -0
  140. package/dashboard/assets/eventmodeling-NTZA5JFV-po5oDydv.js +1 -0
  141. package/dashboard/assets/flowDiagram-HODETNUW-TSV9s7q4.js +1 -0
  142. package/dashboard/assets/ganttDiagram-EL5Y4UJY-DppD7sD7.js +292 -0
  143. package/dashboard/assets/gitGraph-4MIJSDKK-Tw0vNnQc.js +1 -0
  144. package/dashboard/assets/gitGraphDiagram-WWUBYQGX-Cpf96-z3.js +106 -0
  145. package/dashboard/assets/graphlib-DS17s2tU.js +1 -0
  146. package/dashboard/assets/info-A6RAGUB7-DLyt9arx.js +1 -0
  147. package/dashboard/assets/infoDiagram-27XIBGKW-B6_piSNS.js +2 -0
  148. package/dashboard/assets/init-C-OQMol4.js +1 -0
  149. package/dashboard/assets/ishikawaDiagram-5VMMS53U-DvMO0B0X.js +70 -0
  150. package/dashboard/assets/journeyDiagram-3NMN7TZE-f7ZK98b6.js +139 -0
  151. package/dashboard/assets/kanban-definition-UXKFOSKX-Dso0nAxL.js +89 -0
  152. package/dashboard/assets/katex-CXMH3UgJ.js +257 -0
  153. package/dashboard/assets/line-VcKaFG0G.js +1 -0
  154. package/dashboard/assets/linear-D7YnpiWh.js +1 -0
  155. package/dashboard/assets/mermaid-parser.core-DriL2hrV.js +7 -0
  156. package/dashboard/assets/mermaid.core-DJWYDh_P.js +44 -0
  157. package/dashboard/assets/mindmap-definition-YA3MSWOX-DZsoIeac.js +96 -0
  158. package/dashboard/assets/operations-BIaUSnYv.js +121 -0
  159. package/dashboard/assets/operations-BeCdkT4S.css +1 -0
  160. package/dashboard/assets/ordinal-BDEzSJ7C.js +1 -0
  161. package/dashboard/assets/packet-AYTQ26CC-BQBIXKxk.js +1 -0
  162. package/dashboard/assets/path-fybaL0A-.js +1 -0
  163. package/dashboard/assets/pegDiagram-XKGWAZYB-B0-lslgW.js +1 -0
  164. package/dashboard/assets/pie-WAS4IAKB-DoY6dwQs.js +1 -0
  165. package/dashboard/assets/pieDiagram-E7YTZNPT-ElmdRjp5.js +39 -0
  166. package/dashboard/assets/quadrantDiagram-AXDQQJYC-Ci1h98Q2.js +7 -0
  167. package/dashboard/assets/radar-RG4KPBEZ-DHod2WgB.js +1 -0
  168. package/dashboard/assets/railroad-74A4TZTK-90JxB4xV.js +1 -0
  169. package/dashboard/assets/railroad-abnf-HS5TGJTU-BkXGl114.js +1 -0
  170. package/dashboard/assets/railroad-ebnf-LZEXJU2U-QVAERn2C.js +1 -0
  171. package/dashboard/assets/railroad-peg-WCYAUIDC-B1-PM01z.js +1 -0
  172. package/dashboard/assets/railroadDiagram-O6MQD6OU-k3190A6L.js +1 -0
  173. package/dashboard/assets/requirementDiagram-BXWQKSXE-C3-eR7I5.js +84 -0
  174. package/dashboard/assets/rough.esm-Dy-Kn_BL.js +1 -0
  175. package/dashboard/assets/sankeyDiagram-P5KCCOFB-Bc86pi8w.js +40 -0
  176. package/dashboard/assets/sequenceDiagram-WJ2MYXX4-Bv_MvEmz.js +162 -0
  177. package/dashboard/assets/sizeCapture-INFHLROL-B0uUizjq.js +1 -0
  178. package/dashboard/assets/src-D7Dqq5yP.js +1 -0
  179. package/dashboard/assets/stateDiagram-D77RDMKH-Bq_GVmeW.js +1 -0
  180. package/dashboard/assets/stateDiagram-v2-MP3YSRHH-z1XRaftz.js +1 -0
  181. package/dashboard/assets/swimlanes-42K2YHIH-q0iK-e0P.js +1 -0
  182. package/dashboard/assets/swimlanesDiagram-VR7AAH4N-C9L6XBQj.js +8 -0
  183. package/dashboard/assets/timeline-definition-24CTP7MA-CNfF07hM.js +120 -0
  184. package/dashboard/assets/treeView-Q6P3EWNA-m629ePnS.js +1 -0
  185. package/dashboard/assets/treemap-WGGIJYW6-D9Cb2ETv.js +1 -0
  186. package/dashboard/assets/vennDiagram-4TSXK5OY-v4dKF-FE.js +34 -0
  187. package/dashboard/assets/wardley-WFR3VGLG-DkwH_nRe.js +1 -0
  188. package/dashboard/assets/wardleyDiagram-VM6X3IG4-3ImohVu4.js +78 -0
  189. package/dashboard/assets/xychartDiagram-S5SC5T6Z-QJu3dm7K.js +7 -0
  190. package/dashboard/assets/zero-connect-BGDY0PMZ.webp +0 -0
  191. package/dashboard/assets/zero-curious-DovTLOs8.webp +0 -0
  192. package/dashboard/assets/zero-peek-Dzm3MT3X.png +0 -0
  193. package/dashboard/assets/zero-planning-CBeHDrG_.webp +0 -0
  194. package/dashboard/favicon.ico +0 -0
  195. package/dashboard/favicon.svg +10 -0
  196. package/dashboard/index.html +5 -3
  197. package/package.json +1 -1
  198. package/chunks/chunk-BCSRRQG5.js +0 -3514
  199. package/chunks/chunk-BOUGKEKA.js +0 -193
  200. package/chunks/chunk-GHWODZMR.js +0 -16
  201. package/chunks/eval-runner-EMEGF24P.js +0 -26
  202. package/chunks/orchestrate-DWWUT5RC.js +0 -58
  203. package/dashboard/assets/bot-Bg1Tp9_d.js +0 -1
  204. package/dashboard/assets/dist-B_dDCPbu.js +0 -1
  205. package/dashboard/assets/findings-page-mayGhNx6.js +0 -5
  206. package/dashboard/assets/format--susmHX7.js +0 -1
  207. package/dashboard/assets/input-TuVPR3Zl.js +0 -1
  208. package/dashboard/assets/jsx-runtime-MGseXjj5.js +0 -3
  209. package/dashboard/assets/live-page-HWWHX99U.js +0 -1
  210. package/dashboard/assets/meta-tile-ckHo-w7k.js +0 -1
  211. package/dashboard/assets/operations-BxZ0OoXO.js +0 -10
  212. package/dashboard/assets/operations-CMFVrXEe.css +0 -2
  213. package/dashboard/assets/operations-app-D3d35rgo.js +0 -46
  214. package/dashboard/assets/overview-page-W_4IteEr.js +0 -1
  215. package/dashboard/assets/page-header-Bw9AJgBV.js +0 -1
  216. package/dashboard/assets/scans-page-CgzVXHnn.js +0 -1
  217. package/dashboard/assets/siren-KQj8QAnJ.js +0 -1
  218. package/dashboard/assets/table-8EDklulN.js +0 -1
  219. package/dashboard/assets/tabs-CFHPOwg8.js +0 -1
@@ -3,19 +3,23 @@ import { createRequire as __0CreateRequire } from "node:module";
3
3
  const require = __0CreateRequire(import.meta.url);
4
4
  import {
5
5
  ProcessRuntime
6
- } from "./chunk-W6UWZFKL.js";
6
+ } from "./chunk-O6KPVYOI.js";
7
7
  import {
8
8
  LlmApiRuntime
9
- } from "./chunk-AV2LG2L7.js";
9
+ } from "./chunk-BF5FIK7H.js";
10
+ import {
11
+ readCacheUsage
12
+ } from "./chunk-RS4MAN3Q.js";
10
13
 
11
14
  // packages/core/dist/runtime/cli-native.js
12
15
  import { spawn } from "node:child_process";
13
- var CliNativeRuntime = class {
16
+ var CliNativeRuntime = class _CliNativeRuntime {
14
17
  type;
15
18
  config;
16
19
  command;
17
20
  /** Populated from the first turn's stream-json `system` event. */
18
21
  sessionId;
22
+ observedModel;
19
23
  constructor(config) {
20
24
  if (config.type === "api") {
21
25
  throw new Error("CliNativeRuntime does not support type=api. Use LlmApiRuntime instead.");
@@ -31,6 +35,18 @@ var CliNativeRuntime = class {
31
35
  resetSession() {
32
36
  this.sessionId = void 0;
33
37
  }
38
+ resolvedModel() {
39
+ return this.observedModel ?? this.config.model ?? "unknown";
40
+ }
41
+ async forkForSubagent(timeout, selection) {
42
+ const pin = selection?.role && Object.hasOwn(this.config.agentModels ?? {}, selection.role) ? this.config.agentModels?.[selection.role] : void 0;
43
+ const parentModel = this.observedModel ?? this.config.model;
44
+ const model = this.config.singleModel ? parentModel : selection?.model ?? (pin && pin !== "auto" ? pin : parentModel);
45
+ if (model !== parentModel && !Object.values(this.config.agentModels ?? {}).some((approved) => approved !== "auto" && approved === model)) {
46
+ throw new Error(`Model '${model}' was not approved for this CLI runtime.`);
47
+ }
48
+ return new _CliNativeRuntime({ ...this.config, timeout, model });
49
+ }
34
50
  async isAvailable() {
35
51
  return new Promise((resolve) => {
36
52
  const proc = spawn(this.command, ["--version"], {
@@ -52,8 +68,10 @@ var CliNativeRuntime = class {
52
68
  });
53
69
  });
54
70
  }
55
- async executeNative(system, messages, _tools, callbacks) {
71
+ async executeNative(system, messages, _tools, callbacks, signal) {
56
72
  const start = Date.now();
73
+ if (signal?.aborted)
74
+ return { content: [], stopReason: "error", durationMs: 0, cancelled: true, error: "CLI execution cancelled." };
57
75
  if (this.type !== "claude") {
58
76
  return {
59
77
  content: [{ type: "text", text: "" }],
@@ -72,6 +90,8 @@ var CliNativeRuntime = class {
72
90
  };
73
91
  }
74
92
  const args = ["-p", promptText, "--verbose", "--output-format", "stream-json"];
93
+ if (this.config.model)
94
+ args.push("--model", this.config.model);
75
95
  if (this.sessionId) {
76
96
  args.push("--resume", this.sessionId);
77
97
  } else if (system && system.trim().length > 0) {
@@ -88,7 +108,8 @@ var CliNativeRuntime = class {
88
108
  const proc = spawn(this.command, args, {
89
109
  cwd: this.config.cwd ?? process.cwd(),
90
110
  env: { ...process.env, ...this.config.env },
91
- stdio: ["ignore", "pipe", "pipe"]
111
+ stdio: ["ignore", "pipe", "pipe"],
112
+ detached: process.platform !== "win32"
92
113
  });
93
114
  proc.stdout?.on("data", (chunk) => {
94
115
  stdoutBuf += chunk.toString("utf-8");
@@ -127,6 +148,8 @@ var CliNativeRuntime = class {
127
148
  callbacks?.onUsage?.(partial);
128
149
  }
129
150
  }
151
+ if (typeof event.message?.model === "string")
152
+ this.observedModel = event.message.model;
130
153
  if (event.type === "result") {
131
154
  sawAssistantEnd = true;
132
155
  stopReason = mapClaudeStopReason(event.stop_reason ?? event.subtype);
@@ -139,13 +162,38 @@ var CliNativeRuntime = class {
139
162
  proc.stderr?.on("data", (chunk) => {
140
163
  stderrBuf += chunk.toString("utf-8");
141
164
  });
165
+ let killTimer;
166
+ const terminate = () => {
167
+ if (proc.pid && process.platform !== "win32") {
168
+ try {
169
+ process.kill(-proc.pid, "SIGTERM");
170
+ } catch {
171
+ proc.kill("SIGTERM");
172
+ }
173
+ } else
174
+ proc.kill("SIGTERM");
175
+ killTimer ??= setTimeout(() => {
176
+ if (proc.pid && process.platform !== "win32") {
177
+ try {
178
+ process.kill(-proc.pid, "SIGKILL");
179
+ } catch {
180
+ proc.kill("SIGKILL");
181
+ }
182
+ } else
183
+ proc.kill("SIGKILL");
184
+ }, 1e3);
185
+ };
142
186
  const timer = setTimeout(() => {
143
187
  timedOut = true;
144
- proc.kill("SIGTERM");
145
- setTimeout(() => proc.kill("SIGKILL"), 5e3).unref();
188
+ terminate();
146
189
  }, this.config.timeout || 6e5);
190
+ signal?.addEventListener("abort", terminate, { once: true });
191
+ if (signal?.aborted)
192
+ terminate();
147
193
  proc.on("error", (err) => {
148
194
  clearTimeout(timer);
195
+ clearTimeout(killTimer);
196
+ signal?.removeEventListener("abort", terminate);
149
197
  this.sessionId = void 0;
150
198
  resolve({
151
199
  content: [{ type: "text", text: "" }],
@@ -156,6 +204,13 @@ var CliNativeRuntime = class {
156
204
  });
157
205
  proc.on("close", (code) => {
158
206
  clearTimeout(timer);
207
+ clearTimeout(killTimer);
208
+ signal?.removeEventListener("abort", terminate);
209
+ if (signal?.aborted) {
210
+ this.sessionId = void 0;
211
+ resolve({ content, stopReason: "error", usage, durationMs: Date.now() - start, cancelled: true, error: "CLI execution cancelled." });
212
+ return;
213
+ }
159
214
  if (timedOut) {
160
215
  this.sessionId = void 0;
161
216
  resolve({
@@ -257,8 +312,11 @@ function tryParseJson(line) {
257
312
  function readUsage(u) {
258
313
  const input = num(u.input_tokens) ?? num(u.prompt_tokens);
259
314
  const output = num(u.output_tokens) ?? num(u.completion_tokens);
260
- if (input === void 0 && output === void 0)
315
+ if (input === void 0 && output === void 0 && num(u.cache_read_input_tokens) === void 0 && num(u.cache_creation_input_tokens) === void 0)
261
316
  return void 0;
317
+ if (u.input_tokens !== void 0 || u.cache_read_input_tokens !== void 0 || u.cache_creation_input_tokens !== void 0) {
318
+ return readCacheUsage({ ...u, input_tokens: input ?? 0, output_tokens: output ?? 0 });
319
+ }
262
320
  return { inputTokens: input ?? 0, outputTokens: output ?? 0 };
263
321
  }
264
322
  function num(v) {
@@ -540,7 +598,7 @@ var OllamaRuntime = class {
540
598
  }
541
599
  }
542
600
  /** Legacy text-in/text-out path. Used by stages that haven't migrated to NativeRuntime. */
543
- async execute(prompt, _context) {
601
+ async execute(prompt, context) {
544
602
  const start = Date.now();
545
603
  try {
546
604
  const body = {
@@ -549,7 +607,7 @@ var OllamaRuntime = class {
549
607
  stream: false,
550
608
  options: { temperature: this.temperature }
551
609
  };
552
- const res = await this.postChat(body);
610
+ const res = await this.postChat(body, context?.signal);
553
611
  const usage = readUsage2(res);
554
612
  return {
555
613
  output: res.message.content,
@@ -569,7 +627,7 @@ var OllamaRuntime = class {
569
627
  };
570
628
  }
571
629
  }
572
- async executeNative(system, messages, tools, callbacks) {
630
+ async executeNative(system, messages, tools, callbacks, signal) {
573
631
  const start = Date.now();
574
632
  const useStream = this.stream;
575
633
  try {
@@ -580,7 +638,7 @@ var OllamaRuntime = class {
580
638
  stream: useStream,
581
639
  options: { temperature: this.temperature }
582
640
  };
583
- const aggregate = useStream ? await this.streamChat(body, callbacks) : await this.postChat(body);
641
+ const aggregate = useStream ? await this.streamChat(body, callbacks, signal) : await this.postChat(body, signal);
584
642
  const usage = readUsage2(aggregate);
585
643
  if (callbacks?.onUsage && usage)
586
644
  callbacks.onUsage(usage);
@@ -609,19 +667,21 @@ var OllamaRuntime = class {
609
667
  content: [{ type: "text", text: "" }],
610
668
  stopReason: "error",
611
669
  durationMs: Date.now() - start,
612
- error: msg
670
+ error: msg,
671
+ ...signal?.aborted ? { cancelled: true } : {}
613
672
  };
614
673
  }
615
674
  }
616
- async postChat(body) {
675
+ async postChat(body, signal) {
617
676
  const ctl = new AbortController();
618
677
  const timer = setTimeout(() => ctl.abort(), this.timeout);
619
678
  try {
679
+ signal?.throwIfAborted();
620
680
  const res = await this.fetchImpl(`${this.host}/api/chat`, {
621
681
  method: "POST",
622
682
  headers: { "content-type": "application/json" },
623
683
  body: JSON.stringify(body),
624
- signal: ctl.signal
684
+ signal: signal ? AbortSignal.any([ctl.signal, signal]) : ctl.signal
625
685
  });
626
686
  if (!res.ok) {
627
687
  const text = await res.text().catch(() => "");
@@ -648,15 +708,16 @@ var OllamaRuntime = class {
648
708
  * the synthetic `OllamaChatResponse` so the rest of `executeNative`
649
709
  * can keep its non-streaming-shape codepath.
650
710
  */
651
- async streamChat(body, callbacks) {
711
+ async streamChat(body, callbacks, signal) {
652
712
  const ctl = new AbortController();
653
713
  const timer = setTimeout(() => ctl.abort(), this.timeout);
654
714
  try {
715
+ signal?.throwIfAborted();
655
716
  const res = await this.fetchImpl(`${this.host}/api/chat`, {
656
717
  method: "POST",
657
718
  headers: { "content-type": "application/json" },
658
719
  body: JSON.stringify(body),
659
- signal: ctl.signal
720
+ signal: signal ? AbortSignal.any([ctl.signal, signal]) : ctl.signal
660
721
  });
661
722
  if (!res.ok) {
662
723
  const text = await res.text().catch(() => "");
@@ -806,7 +867,7 @@ function pickRuntimeForStage(stage, availableRuntimes) {
806
867
  return first.done ? "claude" : first.value;
807
868
  }
808
869
  async function detectAvailableRuntimes() {
809
- const { ProcessRuntime: ProcessRuntime2 } = await import("./process-N245QIQG.js");
870
+ const { ProcessRuntime: ProcessRuntime2 } = await import("./process-MJYJ2K5E.js");
810
871
  const available = /* @__PURE__ */ new Set();
811
872
  const checks = RUNTIME_REGISTRY.map(async (info) => {
812
873
  const rt = new ProcessRuntime2({ type: info.type, timeout: 5e3 });
@@ -1,27 +1,27 @@
1
1
  #!/usr/bin/env node
2
2
  import { createRequire as __0CreateRequire } from "node:module";
3
3
  const require = __0CreateRequire(import.meta.url);
4
- import {
5
- agenticScan
6
- } from "./chunk-LGCASF2C.js";
7
4
  import {
8
5
  source_default
9
6
  } from "./chunk-HLFS6WV2.js";
7
+ import {
8
+ agenticScan
9
+ } from "./chunk-4HGGNBKK.js";
10
10
  import {
11
11
  runAgentLoop
12
- } from "./chunk-5BTJMINS.js";
12
+ } from "./chunk-P7KDN5PK.js";
13
13
  import {
14
14
  getToolsForRole
15
- } from "./chunk-HHPWRY2M.js";
15
+ } from "./chunk-EH2WTNY7.js";
16
16
  import {
17
17
  createRuntime
18
- } from "./chunk-IFME676H.js";
18
+ } from "./chunk-UZUELPFW.js";
19
19
  import {
20
20
  osecDB
21
- } from "./chunk-VWITLWXB.js";
21
+ } from "./chunk-T7ZEVY5G.js";
22
22
  import {
23
23
  LlmApiRuntime
24
- } from "./chunk-AV2LG2L7.js";
24
+ } from "./chunk-BF5FIK7H.js";
25
25
 
26
26
  // packages/cli/src/commands/orchestrate.ts
27
27
  import { randomUUID } from "node:crypto";
@@ -483,7 +483,7 @@ async function runFamilyCandidate(candidate, opts) {
483
483
  }
484
484
  }
485
485
  function registerOrchestrateCommand(program) {
486
- program.command("orchestrate").description("Run the autonomous verification worker against persisted queued case work").option("--db-path <path>", "Path to SQLite database").option("--limit <n>", "Maximum queued cases to claim per pass", "1").option("--runtime <runtime>", "Runtime override: auto, claude, codex, gemini, api").option("--timeout <ms>", "Request timeout in milliseconds", "30000").option("--api-key <key>", "API key for LLM provider").option("-m, --model <model>", "LLM model to use").option("--watch", "Run as a persistent daemon loop", false).option("--poll-interval <ms>", "Idle poll interval for watch mode", "5000").option("--label <name>", "Operator-facing worker label").action(async (opts) => {
486
+ program.command("orchestrate").description("Run the verification worker against queued cases").option("--db-path <path>", "Path to SQLite database").option("--limit <n>", "Maximum queued cases to claim per pass", "1").option("--runtime <runtime>", "Runtime override: auto, claude, codex, gemini, api").option("--timeout <ms>", "Request timeout in milliseconds", "30000").option("--api-key <key>", "API key for LLM provider").option("-m, --model <model>", "LLM model to use").option("--watch", "Run as a persistent daemon loop", false).option("--poll-interval <ms>", "Idle poll interval for watch mode", "5000").option("--label <name>", "Operator-facing worker label").action(async (opts) => {
487
487
  const workerId = `orchestrator:${randomUUID()}`;
488
488
  const label = opts.label?.trim() || `${hostname()}:${process.pid}`;
489
489
  const limit = Math.max(1, parseInt(opts.limit ?? "1", 10));
@@ -0,0 +1,63 @@
1
+ #!/usr/bin/env node
2
+ import { createRequire as __0CreateRequire } from "node:module";
3
+ const require = __0CreateRequire(import.meta.url);
4
+
5
+ // packages/cli/src/herdr-state.ts
6
+ var sink = null;
7
+ function setHerdrSink(next) {
8
+ sink = next;
9
+ }
10
+ function reportOperatorGate(blocked) {
11
+ if (!sink) return;
12
+ try {
13
+ if (blocked) sink.reportBlocked();
14
+ else sink.reportWorking();
15
+ } catch {
16
+ }
17
+ }
18
+ function withSink(fn) {
19
+ if (!sink) return;
20
+ try {
21
+ fn(sink);
22
+ } catch {
23
+ }
24
+ }
25
+ function reportHerdrModel(model, provider) {
26
+ withSink((s) => s.setModel(model, provider));
27
+ }
28
+ function reportHerdrContextPercent(percent) {
29
+ withSink((s) => s.setContextPercent(percent));
30
+ }
31
+ function reportHerdrTarget(target) {
32
+ withSink((s) => s.setTarget(target));
33
+ }
34
+ function reportHerdrObjective(objective) {
35
+ withSink((s) => s.setObjective(objective));
36
+ }
37
+ function reportHerdrActivity(activity) {
38
+ withSink((s) => s.setActivity(activity));
39
+ }
40
+ function reportHerdrCompaction() {
41
+ withSink((s) => s.reportCompacting());
42
+ }
43
+ function reportHerdrSession(ref) {
44
+ withSink((s) => s.reportSession(ref));
45
+ }
46
+ function reportHerdrSessionClose() {
47
+ withSink((s) => {
48
+ void s.release();
49
+ });
50
+ }
51
+
52
+ export {
53
+ setHerdrSink,
54
+ reportOperatorGate,
55
+ reportHerdrModel,
56
+ reportHerdrContextPercent,
57
+ reportHerdrTarget,
58
+ reportHerdrObjective,
59
+ reportHerdrActivity,
60
+ reportHerdrCompaction,
61
+ reportHerdrSession,
62
+ reportHerdrSessionClose
63
+ };
@@ -3,7 +3,7 @@ import { createRequire as __0CreateRequire } from "node:module";
3
3
  const require = __0CreateRequire(import.meta.url);
4
4
  import {
5
5
  homeStateDir
6
- } from "./chunk-KAU6NLGP.js";
6
+ } from "./chunk-LTEE2JWK.js";
7
7
 
8
8
  // packages/core/dist/cve/artifact-scraper.js
9
9
  import { createHash } from "node:crypto";
@@ -3,7 +3,7 @@ import { createRequire as __0CreateRequire } from "node:module";
3
3
  const require = __0CreateRequire(import.meta.url);
4
4
  import {
5
5
  LlmApiRuntime
6
- } from "./chunk-AV2LG2L7.js";
6
+ } from "./chunk-BF5FIK7H.js";
7
7
 
8
8
  // packages/core/dist/stages/variant-candidates.js
9
9
  import { execFileSync } from "node:child_process";