0sec-cli 0.15.0 → 0.18.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 (209) hide show
  1. package/0sec.js +327 -0
  2. package/README.md +68 -48
  3. package/attacks/data-exfiltration/pii-leakage.yaml +27 -0
  4. package/attacks/encoding-bypass/base64-encoding.yaml +24 -0
  5. package/attacks/jailbreak/dan-roleplay.yaml +27 -0
  6. package/attacks/jailbreak/hypothetical-scenario.yaml +25 -0
  7. package/attacks/jailbreak/multilingual-bypass.yaml +22 -0
  8. package/attacks/output-manipulation/harmful-content.yaml +25 -0
  9. package/attacks/prompt-injection/context-manipulation.yaml +32 -0
  10. package/attacks/prompt-injection/direct-injection.yaml +28 -0
  11. package/attacks/prompt-injection/indirect-injection.yaml +33 -0
  12. package/attacks/system-prompt-extraction/direct-ask.yaml +30 -0
  13. package/attacks/system-prompt-extraction/markdown-exfil.yaml +26 -0
  14. package/attacks/tool-misuse/ssrf-via-tools.yaml +27 -0
  15. package/chunks/adapt-loop-SMH6V4PD.js +18 -0
  16. package/chunks/adgraph-JLGA6RYI.js +54 -0
  17. package/chunks/agent/skills/frameworks/entra-id.yaml +63 -0
  18. package/chunks/agent/skills/frameworks/graphql-introspection.yaml +116 -0
  19. package/chunks/agent/skills/frameworks/nextjs.yaml +82 -0
  20. package/chunks/agent/skills/frameworks/python-web.yaml +85 -0
  21. package/chunks/agent/skills/frameworks/supabase.yaml +83 -0
  22. package/chunks/agent/skills/frameworks/wordpress-deep.yaml +122 -0
  23. package/chunks/agent/skills/techniques/ad-attack-paths.yaml +57 -0
  24. package/chunks/agent/skills/techniques/advisory-disclosure.yaml +59 -0
  25. package/chunks/agent/skills/techniques/assumption-mining.yaml +53 -0
  26. package/chunks/agent/skills/techniques/blind-exploitation.yaml +143 -0
  27. package/chunks/agent/skills/techniques/crypto-misuse.yaml +88 -0
  28. package/chunks/agent/skills/techniques/cve-poc-adaptation.yaml +82 -0
  29. package/chunks/agent/skills/techniques/entra-attack-paths.yaml +55 -0
  30. package/chunks/agent/skills/techniques/http-conformance-diff.yaml +48 -0
  31. package/chunks/agent/skills/techniques/jwt-attacks.yaml +137 -0
  32. package/chunks/agent/skills/techniques/kernel-weaponization.yaml +53 -0
  33. package/chunks/agent/skills/techniques/llm-excessive-agency.yaml +55 -0
  34. package/chunks/agent/skills/techniques/llm-insecure-output-handling.yaml +56 -0
  35. package/chunks/agent/skills/techniques/llm-prompt-injection.yaml +54 -0
  36. package/chunks/agent/skills/techniques/llm-prompt-layer-write.yaml +68 -0
  37. package/chunks/agent/skills/techniques/llm-rag-poisoning.yaml +57 -0
  38. package/chunks/agent/skills/techniques/llm-safety-eval.yaml +51 -0
  39. package/chunks/agent/skills/techniques/npm-ecosystem.yaml +51 -0
  40. package/chunks/agent/skills/techniques/poc-verification.yaml +55 -0
  41. package/chunks/agent/skills/techniques/race-condition.yaml +122 -0
  42. package/chunks/agent/skills/techniques/scoped-fix.yaml +49 -0
  43. package/chunks/agent/skills/techniques/seedless-depth-review.yaml +59 -0
  44. package/chunks/agent/skills/techniques/spec-differential.yaml +48 -0
  45. package/chunks/agent/skills/techniques/variant-hunting.yaml +55 -0
  46. package/chunks/agent/skills/vulnerabilities/cardano-eutxo-validators.yaml +72 -0
  47. package/chunks/agent/skills/vulnerabilities/command-injection.yaml +99 -0
  48. package/chunks/agent/skills/vulnerabilities/deserialization-chains.yaml +106 -0
  49. package/chunks/agent/skills/vulnerabilities/native-memory-safety.yaml +93 -0
  50. package/chunks/agent/skills/vulnerabilities/path-traversal.yaml +78 -0
  51. package/chunks/agent/skills/vulnerabilities/prototype-pollution.yaml +132 -0
  52. package/chunks/agent/skills/vulnerabilities/request-smuggling.yaml +129 -0
  53. package/chunks/agent/skills/vulnerabilities/sqli-advanced.yaml +102 -0
  54. package/chunks/agent/skills/vulnerabilities/ssrf-bypass.yaml +84 -0
  55. package/chunks/agent/skills/vulnerabilities/ssti-exploitation.yaml +112 -0
  56. package/chunks/agent/skills/vulnerabilities/structural-sqli.yaml +91 -0
  57. package/chunks/appsec-catalog-CBWHGTEL.js +24 -0
  58. package/chunks/artifact-scraper-HQ7HLP6V.js +34 -0
  59. package/chunks/assumption-mining-5SNIVVDN.js +79 -0
  60. package/chunks/chunk-242TMK6G.js +110 -0
  61. package/chunks/chunk-2JCCA2JL.js +381 -0
  62. package/chunks/chunk-2RMLOJVB.js +47 -0
  63. package/chunks/chunk-3KPWWJCI.js +1422 -0
  64. package/chunks/chunk-3MOLBTLS.js +953 -0
  65. package/chunks/chunk-53G27VPS.js +136 -0
  66. package/chunks/chunk-57ZENEX2.js +169 -0
  67. package/chunks/chunk-5G3ZXFBW.js +182 -0
  68. package/chunks/chunk-5JI7L7KV.js +74240 -0
  69. package/chunks/chunk-6L26OBWI.js +1094 -0
  70. package/chunks/chunk-6LKRLK2R.js +542 -0
  71. package/chunks/chunk-72CISA2D.js +2597 -0
  72. package/chunks/chunk-7DQEV5QI.js +287 -0
  73. package/chunks/chunk-AD7WXDH6.js +3250 -0
  74. package/chunks/chunk-ADOLI6DT.js +102 -0
  75. package/chunks/chunk-AHTBZC3E.js +596 -0
  76. package/chunks/chunk-ASUR522M.js +518 -0
  77. package/chunks/chunk-ATATQACO.js +471 -0
  78. package/chunks/chunk-BATRQBOR.js +1732 -0
  79. package/chunks/chunk-BFR2CDV5.js +5735 -0
  80. package/chunks/chunk-BFRB6HB2.js +235 -0
  81. package/chunks/chunk-BKZFDZ23.js +361 -0
  82. package/chunks/chunk-BVAZO4WA.js +193 -0
  83. package/chunks/chunk-BZNEY2ZS.js +33225 -0
  84. package/chunks/chunk-C2WXWFBB.js +1070 -0
  85. package/chunks/chunk-CMKXP5RR.js +917 -0
  86. package/chunks/chunk-DW5UWPFY.js +275 -0
  87. package/chunks/chunk-F3WBKITT.js +687 -0
  88. package/chunks/chunk-GMT2AZKM.js +2439 -0
  89. package/chunks/chunk-H2FFLZNK.js +3 -0
  90. package/chunks/chunk-IOL7D5YV.js +515 -0
  91. package/chunks/chunk-IR537GON.js +49 -0
  92. package/chunks/chunk-JQHOLLTD.js +3729 -0
  93. package/chunks/chunk-KLTNTE2Z.js +121 -0
  94. package/chunks/chunk-LP3HHYQU.js +245 -0
  95. package/chunks/chunk-MYVT64FN.js +16 -0
  96. package/chunks/chunk-N7BOUYEV.js +852 -0
  97. package/chunks/chunk-OEFNRYI2.js +150 -0
  98. package/chunks/chunk-P6WKNFWX.js +1968 -0
  99. package/chunks/chunk-QI233I24.js +333 -0
  100. package/chunks/chunk-RJWOYEOG.js +271 -0
  101. package/chunks/chunk-RRMJC3ZE.js +105 -0
  102. package/chunks/chunk-RWONANDA.js +973 -0
  103. package/chunks/chunk-SAFFWQW4.js +5921 -0
  104. package/chunks/chunk-SF4KZ4O3.js +502 -0
  105. package/chunks/chunk-SVJEDVYK.js +808 -0
  106. package/chunks/chunk-TSK2AG6J.js +5108 -0
  107. package/chunks/chunk-U5FLXGHT.js +2010 -0
  108. package/chunks/chunk-UCYRA73C.js +662 -0
  109. package/chunks/chunk-UR4ELX2Y.js +4784 -0
  110. package/chunks/chunk-VQG4FT5D.js +685 -0
  111. package/chunks/chunk-WEBMRWEG.js +9337 -0
  112. package/chunks/chunk-WU6AFRAZ.js +1167 -0
  113. package/chunks/chunk-WVTBZEQO.js +1531 -0
  114. package/chunks/chunk-WXQ6BJ6A.js +596 -0
  115. package/chunks/chunk-XM5NLHYU.js +600 -0
  116. package/chunks/chunk-YLMN3N25.js +4054 -0
  117. package/chunks/chunk-YYRBQVFE.js +2572 -0
  118. package/chunks/chunk-Z5FA2XOX.js +2798 -0
  119. package/chunks/commands-TBC2F5CE.js +16999 -0
  120. package/chunks/corpus-v1.json +403 -0
  121. package/chunks/cost-ledger-NU63MYZM.js +13 -0
  122. package/chunks/data/appsec-archetypes.json +102 -0
  123. package/chunks/data/chromium-archetypes.json +204 -0
  124. package/chunks/data/freebsd-archetypes.json +171 -0
  125. package/chunks/data/kernel-archetypes.json +611 -0
  126. package/chunks/db-KFWOAUUB.js +16 -0
  127. package/chunks/disclose-EKTWSCGW.js +132 -0
  128. package/chunks/dist-4MAW5X6L.js +74 -0
  129. package/chunks/dist-4YICS2J2.js +2776 -0
  130. package/chunks/dist-FMGSR3DW.js +159 -0
  131. package/chunks/eval-runner-7ZF472KV.js +27 -0
  132. package/chunks/example-manifest.json +95 -0
  133. package/chunks/exploit-agent-45YQOHPJ.js +98 -0
  134. package/chunks/exploit-autoclimb-UZGEMGYT.js +81 -0
  135. package/chunks/exploit-climb-SG23KB2G.js +358 -0
  136. package/chunks/fix-IG7LYXH3.js +12 -0
  137. package/chunks/github-issues-MJ6OYOOU.js +157 -0
  138. package/chunks/harness-7ODOLOWU.js +22 -0
  139. package/chunks/http-conformance-DU66MZIU.js +11 -0
  140. package/chunks/http-sender-GWH2IYEA.js +10 -0
  141. package/chunks/hunt-scan-MMKUOETU.js +38 -0
  142. package/chunks/identity-6ZAIIWOR.js +191 -0
  143. package/chunks/kernel-primitive-7U6CWHXD.js +44 -0
  144. package/chunks/kernel-vm-runner-3JAU4O6J.js +62 -0
  145. package/chunks/memsafety-scan-J7SECV5W.js +16 -0
  146. package/chunks/native-loop-RJCJPOUS.js +54 -0
  147. package/chunks/npm-detectors-KB5Y5ZFX.js +69 -0
  148. package/chunks/npm-dynamic-discovery-AHROOZDB.js +13 -0
  149. package/chunks/orchestrate-OC2VZN2X.js +62 -0
  150. package/chunks/pipeline-BZK5BLJR.js +14 -0
  151. package/chunks/pre-recon-cve-66EB6G4M.js +351 -0
  152. package/chunks/prepare-MYY743TK.js +13 -0
  153. package/chunks/process-LQRCS5OY.js +13 -0
  154. package/chunks/replay-runner-45G3VU7X.js +39 -0
  155. package/chunks/run-D56MPDKY.js +32716 -0
  156. package/chunks/runtime-G7YWIO3B.js +43 -0
  157. package/chunks/runtime-J7PLXZNM.js +12 -0
  158. package/chunks/scan-stream-FHI2FYZE.js +96 -0
  159. package/chunks/scope-BI7BF4ZY.js +18 -0
  160. package/chunks/session-store-GZ4A4KYT.js +28 -0
  161. package/chunks/source-files-PWRQR6LY.js +12 -0
  162. package/chunks/specdrift-WCLH6TTQ.js +19 -0
  163. package/chunks/variant-candidates-YERCYMPD.js +13 -0
  164. package/chunks/web-recon-prepass-JJGPEOLE.js +1148 -0
  165. package/dashboard/assets/0sec-icon-66SreztZ.gif +0 -0
  166. package/dashboard/assets/bot-yILPnRgD.js +1 -0
  167. package/dashboard/assets/chevron-down-BeDJ-Vka.js +1 -0
  168. package/dashboard/assets/circle-alert-BEnMBMT-.js +1 -0
  169. package/dashboard/assets/client-DRYsuOGl.js +9 -0
  170. package/dashboard/assets/copy-Bi5vzoF9.js +1 -0
  171. package/dashboard/assets/desktop-CXTQonNm.js +32 -0
  172. package/dashboard/assets/desktop-NOekk4QS.css +1 -0
  173. package/dashboard/assets/dist-CmX-h7a4.js +1 -0
  174. package/dashboard/assets/dist-DAwYQmf_.js +45 -0
  175. package/dashboard/assets/findings-page-CACW9nw2.js +5 -0
  176. package/dashboard/assets/format-PoISqsES.js +1 -0
  177. package/dashboard/assets/geist-cyrillic-ext-wght-normal-DjL33-gN.woff2 +0 -0
  178. package/dashboard/assets/geist-cyrillic-wght-normal-BEAKL7Jp.woff2 +0 -0
  179. package/dashboard/assets/geist-latin-ext-wght-normal-DC-KSUi6.woff2 +0 -0
  180. package/dashboard/assets/geist-latin-wght-normal-BgDaEnEv.woff2 +0 -0
  181. package/dashboard/assets/geist-vietnamese-wght-normal-6IgcOCM7.woff2 +0 -0
  182. package/dashboard/assets/ibm-plex-mono-cyrillic-400-normal-BSMlKf0J.woff2 +0 -0
  183. package/dashboard/assets/ibm-plex-mono-cyrillic-400-normal-CEL4l2ZJ.woff +0 -0
  184. package/dashboard/assets/ibm-plex-mono-cyrillic-ext-400-normal-DMdlQ8Kv.woff +0 -0
  185. package/dashboard/assets/ibm-plex-mono-cyrillic-ext-400-normal-xuaO2J-f.woff2 +0 -0
  186. package/dashboard/assets/ibm-plex-mono-latin-400-normal-CvHOgSBP.woff +0 -0
  187. package/dashboard/assets/ibm-plex-mono-latin-400-normal-DMJ8VG8y.woff2 +0 -0
  188. package/dashboard/assets/ibm-plex-mono-latin-ext-400-normal-BmRBH3aV.woff2 +0 -0
  189. package/dashboard/assets/ibm-plex-mono-latin-ext-400-normal-D3D2R8hC.woff +0 -0
  190. package/dashboard/assets/ibm-plex-mono-vietnamese-400-normal-BulugwFq.woff2 +0 -0
  191. package/dashboard/assets/ibm-plex-mono-vietnamese-400-normal-DDuiU_S-.woff +0 -0
  192. package/dashboard/assets/jsx-runtime-C7oxC63R.js +1 -0
  193. package/dashboard/assets/live-page-DrgQqQK5.js +1 -0
  194. package/dashboard/assets/meta-tile-CcskIV_o.js +1 -0
  195. package/dashboard/assets/operations-BKE8T-vY.css +2 -0
  196. package/dashboard/assets/operations-D8nUP5_m.js +4 -0
  197. package/dashboard/assets/operations-app-CQQhG54n.js +2 -0
  198. package/dashboard/assets/overview-page-DTGS8dPo.js +1 -0
  199. package/dashboard/assets/page-header-MFVvEtZW.js +1 -0
  200. package/dashboard/assets/play-Dwo-9xt6.js +1 -0
  201. package/dashboard/assets/scans-page-ChVtq8Us.js +1 -0
  202. package/dashboard/assets/search-CiooTLck.js +1 -0
  203. package/dashboard/assets/siren-CCBwTSuk.js +1 -0
  204. package/dashboard/assets/table-BYS-nIVA.js +1 -0
  205. package/dashboard/assets/tabs-DivxbhQy.js +1 -0
  206. package/dashboard/desktop.html +21 -0
  207. package/dashboard/index.html +15 -0
  208. package/package.json +30 -18
  209. package/bin/0sec.cjs +0 -361
@@ -0,0 +1,1094 @@
1
+ #!/usr/bin/env node
2
+ import { createRequire as __0secCreateRequire } from "node:module";
3
+ const require = __0secCreateRequire(import.meta.url);
4
+ import {
5
+ external_exports
6
+ } from "./chunk-YLMN3N25.js";
7
+
8
+ // packages/shared/dist/identity.js
9
+ function defaultRoleFor(auth) {
10
+ return auth ? "user" : "anonymous";
11
+ }
12
+ function resolveIdentities(config) {
13
+ const raw = config.identities && config.identities.length > 0 ? config.identities : config.auth ? [{ label: "primary", auth: config.auth }] : [];
14
+ const seen = /* @__PURE__ */ new Map();
15
+ return raw.map((idn, i) => {
16
+ let label = (idn.label ?? "").trim() || `identity-${i + 1}`;
17
+ const prior = seen.get(label);
18
+ if (prior !== void 0) {
19
+ const next = prior + 1;
20
+ seen.set(label, next);
21
+ label = `${label}-${next}`;
22
+ } else {
23
+ seen.set(label, 1);
24
+ }
25
+ return {
26
+ label,
27
+ role: idn.role ?? defaultRoleFor(idn.auth),
28
+ auth: idn.auth
29
+ };
30
+ });
31
+ }
32
+ function hasMultipleIdentities(identities) {
33
+ return identities.length >= 2;
34
+ }
35
+ var ROLE_RANK = { anonymous: 0, user: 1, admin: 2 };
36
+ function compareRoles(a, b) {
37
+ const ra = ROLE_RANK[a ?? "user"] ?? ROLE_RANK.user;
38
+ const rb = ROLE_RANK[b ?? "user"] ?? ROLE_RANK.user;
39
+ return ra - rb;
40
+ }
41
+
42
+ // packages/shared/dist/constants.js
43
+ import { readFileSync } from "node:fs";
44
+ import { fileURLToPath } from "node:url";
45
+ import { dirname, join } from "node:path";
46
+ function loadVersion() {
47
+ if (true) {
48
+ return "0.18.0";
49
+ }
50
+ try {
51
+ const here = dirname(fileURLToPath(import.meta.url));
52
+ const pkgPath = join(here, "..", "..", "..", "package.json");
53
+ const pkg = JSON.parse(readFileSync(pkgPath, "utf8"));
54
+ return typeof pkg.version === "string" ? pkg.version : "0.0.0-dev";
55
+ } catch {
56
+ return "0.0.0-dev";
57
+ }
58
+ }
59
+ var VERSION = loadVersion();
60
+ var DEFAULT_MODEL = "claude-sonnet-4-20250514";
61
+ var DEFAULT_TIMEOUT_MS = 3e4;
62
+ var DEFAULT_MAX_CONCURRENCY = 5;
63
+ var DEPTH_CONFIG = {
64
+ quick: { maxTemplates: 5, maxPayloadsPerTemplate: 1, multiTurn: false },
65
+ default: { maxTemplates: 20, maxPayloadsPerTemplate: 3, multiTurn: false },
66
+ deep: { maxTemplates: Infinity, maxPayloadsPerTemplate: Infinity, multiTurn: true }
67
+ };
68
+ var SEVERITY_RANK = {
69
+ info: 0,
70
+ low: 1,
71
+ medium: 2,
72
+ high: 3,
73
+ critical: 4
74
+ };
75
+ var MAX_SEVERITY_RANK = Math.max(...Object.values(SEVERITY_RANK));
76
+ var SEVERITY_ORDER = Object.fromEntries(Object.keys(SEVERITY_RANK).sort((a, b) => SEVERITY_RANK[b] - SEVERITY_RANK[a]).map((sev) => [sev, MAX_SEVERITY_RANK - SEVERITY_RANK[sev]]));
77
+ var DEFAULT_SEVERITY_FLOOR = "medium";
78
+ function severityRank(severity) {
79
+ const lower = severity.trim().toLowerCase();
80
+ const key = lower === "informational" ? "info" : lower;
81
+ return SEVERITY_RANK[key] ?? -1;
82
+ }
83
+ function meetsSeverityFloor(severity, floor = DEFAULT_SEVERITY_FLOOR) {
84
+ const floorRank = severityRank(floor);
85
+ const effectiveFloor = floorRank === -1 ? severityRank(DEFAULT_SEVERITY_FLOOR) : floorRank;
86
+ return severityRank(severity) >= effectiveFloor;
87
+ }
88
+
89
+ // packages/shared/dist/pricing.oss.generated.js
90
+ var OSS_PRICING = {
91
+ "gpt-6-astra": { input: 10, output: 50, cachedInput: 1 },
92
+ "claude-fable-5-1": { input: 10, output: 50, cachedInput: 0.25 },
93
+ "claude-opus-5": { input: 5, output: 25, cachedInput: 0.5 },
94
+ "claude-sonnet-5": { input: 2, output: 10, cachedInput: 0.2 },
95
+ "gemini-3.8-flash": { input: 0.75, output: 3.75, cachedInput: 0.075 },
96
+ "gemini-3.7-flash": { input: 0.75, output: 3.75, cachedInput: 0.075 },
97
+ "gemini-3.6-flash": { input: 0.75, output: 3.75, cachedInput: 0.075 },
98
+ "gemini-3.5-flash": { input: 1.5, output: 9, cachedInput: 0.15 },
99
+ "gemini-3.5-flash-lite": { input: 0.3, output: 2.5, cachedInput: 0.03 },
100
+ "gemini-3.1-flash-lite": { input: 0.25, output: 1.5, cachedInput: 0.025 },
101
+ "gemini-3.1-pro-preview": { input: 2, output: 12, cachedInput: 0.2 },
102
+ "gpt-5.4": { input: 2.5, output: 15, cachedInput: 0.25 },
103
+ "gpt-5.5": { input: 5, output: 30, cachedInput: 0.5 },
104
+ "gpt-4o": { input: 2.5, output: 10, cachedInput: 1.25 },
105
+ "gpt-4o-mini": { input: 0.15, output: 0.6, cachedInput: 0.075 },
106
+ "gpt-4.1": { input: 2, output: 8, cachedInput: 0.5 },
107
+ "gpt-4.1-mini": { input: 0.4, output: 1.6, cachedInput: 0.1 },
108
+ "gpt-4.1-nano": { input: 0.1, output: 0.4, cachedInput: 0.025 },
109
+ "o3": { input: 2, output: 8, cachedInput: 0.5 },
110
+ "o3-mini": { input: 1.1, output: 4.4, cachedInput: 0.55 },
111
+ "o4-mini": { input: 1.1, output: 4.4, cachedInput: 0.275 },
112
+ "gemini-2.5-pro": { input: 1.25, output: 10, cachedInput: 0.125 },
113
+ "gemini-2.5-flash": { input: 0.3, output: 2.5, cachedInput: 0.03 },
114
+ "gemini-2.0-flash": { input: 0.1, output: 0.4, cachedInput: 0.025 },
115
+ "deepseek-chat": { input: 0.28, output: 0.42, cachedInput: 0.028 },
116
+ "deepseek-reasoner": { input: 0.28, output: 0.42, cachedInput: 0.028 }
117
+ };
118
+
119
+ // packages/shared/dist/pricing.js
120
+ var PRICING_SNAPSHOT_DATE = "2026-09-11";
121
+ var MANUAL_PRICING = {
122
+ // Anthropic (versioned; LiteLLM keys use different suffixes → keep manual)
123
+ "claude-opus-4-7": { input: 5, output: 25, cachedInput: 0.5 },
124
+ "claude-opus-4-6": { input: 15, output: 75, cachedInput: 1.5 },
125
+ "claude-sonnet-4-6": { input: 3, output: 15, cachedInput: 0.3 },
126
+ "claude-haiku-4-5": { input: 0.8, output: 4, cachedInput: 0.08 },
127
+ // OpenAI codex alias — mirrors gpt-5.5 (OSS feed has only the bare key)
128
+ "gpt-5.5-codex": { input: 5, output: 30 },
129
+ // Meta (hosted) — not in the OSS feed
130
+ "llama-4-maverick": { input: 0.5, output: 0.77 },
131
+ "llama-4-scout": { input: 0.2, output: 0.35 },
132
+ // Mistral — not in the OSS feed
133
+ "mistral-large": { input: 2, output: 6 },
134
+ "mistral-small": { input: 0.1, output: 0.3 },
135
+ // DeepSeek V4.1 Flash's stable API id (not yet in LiteLLM).
136
+ // https://api-docs.deepseek.com/quick_start/pricing — checked 2026-09-11.
137
+ // Peak rates: off-peak is half price; this table cannot express time tiers.
138
+ "deepseek-flash": { input: 0.3, output: 1.2, cachedInput: 6e-3 },
139
+ // Z.AI (open-weight, hosted) — see provos.org "Finding Zero-Days with Any Model" (Apr 2026)
140
+ // https://docs.z.ai/guides/overview/pricing — checked 2026-09-11.
141
+ "glm-5.3-flash": { input: 0.15, output: 0.5, cachedInput: 0.03 },
142
+ "glm-5.3": { input: 1.4, output: 4.4, cachedInput: 0.26 },
143
+ "glm-5.2": { input: 1.4, output: 4.4, cachedInput: 0.26 },
144
+ "glm-5.1": { input: 1.4, output: 4.4, cachedInput: 0.26 },
145
+ "glm-4.5": { input: 0.6, output: 2.2, cachedInput: 0.11 },
146
+ // Moonshot Kimi K3 (open-weight, hosted) — not in the OSS feed; flat-rate
147
+ // coding-plan estimates (mirror the GLM manual-row style).
148
+ "k3": { input: 3, output: 15, cachedInput: 0.3 },
149
+ "k3[1m]": { input: 3, output: 15, cachedInput: 0.3 },
150
+ "kimi-for-coding": { input: 3, output: 15, cachedInput: 0.3 },
151
+ // Alibaba Model Studio Qwen — base PAYG list estimates, not Token Plan
152
+ // subscription charges. Models.dev's `alibaba` provider (checked 2026-09-11),
153
+ // not its zero-priced subscription rows: https://models.dev/api.json.
154
+ // Plus has a higher >256K input tier; this flat table cannot represent it.
155
+ // Preview ids without published PAYG rates remain unpriced in the picker.
156
+ // deepseek-v4-flash-0731 (Token Plan credit lane) is NOT pinned here on
157
+ // purpose: AZURE_DEPLOYMENT_PRICE_ALIASES already resolves it to the
158
+ // DeepSeek-V4-Flash list rate ($0.19/$0.51), the defensible anchor for a
159
+ // credit-billed variant whose per-credit rate Alibaba does not publish.
160
+ "qwen3.8-max": { input: 2, output: 6, cachedInput: 0.25 },
161
+ "qwen3.8-flash": { input: 0.15, output: 0.47, cachedInput: 0.016 },
162
+ "qwen3.7-max": { input: 2.5, output: 7.5, cachedInput: 0.5 },
163
+ "qwen3.7-plus": { input: 0.5, output: 3, cachedInput: 0.05 },
164
+ "qwen3.6-plus": { input: 0.5, output: 3, cachedInput: 0.05 },
165
+ "qwen3.6-flash": { input: 0.1875, output: 1.125 },
166
+ // OpenCode Zen free tier (https://opencode.ai/docs/zen/) — zero-rate gateway
167
+ // models; actual spend is $0 while the free period lasts.
168
+ "muse-spark-1.3-contributor-free": { input: 0, output: 0 },
169
+ "mimo-v2.5-free": { input: 0, output: 0 },
170
+ "ling-3.0-flash-fin-free": { input: 0, output: 0 },
171
+ "big-pickle": { input: 0, output: 0 },
172
+ "nemotron-3-ultra-free": { input: 0, output: 0 },
173
+ "nemotron-3.5-lightning-free": { input: 0, output: 0 },
174
+ // xAI Grok (docs.x.ai/developers/pricing, checked 2026-08-22) — SHORT-CONTEXT
175
+ // rates only. xAI charges a second, higher tier once a request's prompt
176
+ // crosses 200k tokens (grok-4.6: $4.00/$12.00 vs the $2.00/$6.00 below;
177
+ // grok-4.3 likewise), and this schema has no way to express a
178
+ // context-length-dependent rate. Long agent loops DO cross that line — the
179
+ // native loop only compacts at 150k prompt tokens — so treat Grok spend on
180
+ // long transcripts as a FLOOR and reconcile against the xAI console.
181
+ "grok-4.6": { input: 2, output: 6 },
182
+ "grok-4.5": { input: 2, output: 6 },
183
+ "grok-4.3": { input: 1.25, output: 2.5 },
184
+ // GitHub Copilot (device-code OAuth) — the `copilot/` prefix disambiguates
185
+ // routing/pricing (Copilot serves gpt-*/claude-*/gemini-* families). These are
186
+ // DISPLAY-ONLY estimates so the model picker can group and show these ids;
187
+ // Copilot subscription billing is per-seat, not metered per token, so the
188
+ // estimated spend against a Copilot key is not a real charge. v1 ships the
189
+ // gpt-* families (claude-*/gemini-* need a one-time model-policy enable —
190
+ // TODO). Rates mirror the underlying OpenAI list prices.
191
+ "copilot/gpt-4o": { input: 2.5, output: 10, cachedInput: 1.25 },
192
+ "copilot/gpt-4o-mini": { input: 0.15, output: 0.6, cachedInput: 0.075 },
193
+ "copilot/gpt-4.1": { input: 2, output: 8, cachedInput: 0.5 },
194
+ // Azure Foundry deployment names (verified 2026-07-25) — exact aliases
195
+ // forwarded by the engine. DeepSeek/gpt-oss rates use the Azure-specific `azure_ai/*` LiteLLM feed
196
+ // entries (not the cheaper direct-provider rates). Kimi is Microsoft's
197
+ // published Global Standard price for K2.7 Code. GPT-5.6 SOL, Luna, and
198
+ // Terra use Microsoft's Global Standard short-context rates; Azure Cost
199
+ // Management remains authoritative for cache writes and long-context usage,
200
+ // which this schema cannot represent.
201
+ "DeepSeek-V4-Pro": { input: 1.74, output: 3.48 },
202
+ "DeepSeek-V4-Flash": { input: 0.19, output: 0.51 },
203
+ "Kimi-K2.7-Code": { input: 0.95, output: 4, cachedInput: 0.19 },
204
+ "gpt-oss-120b": { input: 0.15, output: 0.6 },
205
+ "gpt-5.6-sol": { input: 5, output: 30, cachedInput: 0.5 },
206
+ "gpt-5.6-luna": { input: 1, output: 6, cachedInput: 0.1 },
207
+ "gpt-5.6-terra": { input: 2.5, output: 15, cachedInput: 0.25 },
208
+ default: { input: 3, output: 15 }
209
+ };
210
+ var MODEL_PRICING = {
211
+ ...MANUAL_PRICING,
212
+ ...OSS_PRICING
213
+ };
214
+ var AZURE_DEPLOYMENT_PRICE_ALIASES = /* @__PURE__ */ new Map([
215
+ ["deepseek-v4-pro", "DeepSeek-V4-Pro"],
216
+ ["deepseek-v4-flash", "DeepSeek-V4-Flash"],
217
+ ["kimi-k2.7-code", "Kimi-K2.7-Code"],
218
+ ["gpt-oss-120b", "gpt-oss-120b"],
219
+ ["gpt-5.6-sol", "gpt-5.6-sol"],
220
+ ["gpt-5.6-luna", "gpt-5.6-luna"],
221
+ ["gpt-5.6-terra", "gpt-5.6-terra"]
222
+ ]);
223
+ function azureDeploymentPriceKey(model) {
224
+ const lower = model.toLowerCase();
225
+ for (const [alias, canonical] of AZURE_DEPLOYMENT_PRICE_ALIASES) {
226
+ if (lower === alias || lower.startsWith(`${alias}-`))
227
+ return canonical;
228
+ }
229
+ return null;
230
+ }
231
+ function normalizeModel(model) {
232
+ const prefixes = [
233
+ "openai/",
234
+ "anthropic/",
235
+ "google/",
236
+ "deepseek/",
237
+ "meta/",
238
+ "mistral/",
239
+ "z-ai/",
240
+ "zai/",
241
+ "kimi/",
242
+ "moonshot/",
243
+ "openrouter/",
244
+ "opencode/"
245
+ ];
246
+ for (const prefix of prefixes) {
247
+ if (model.startsWith(prefix))
248
+ return model.slice(prefix.length);
249
+ }
250
+ return model;
251
+ }
252
+ function getRates(model) {
253
+ const key = model ? normalizeModel(model) : "";
254
+ const aliasKey = azureDeploymentPriceKey(key);
255
+ const rates = MODEL_PRICING[key] ?? (aliasKey ? MODEL_PRICING[aliasKey] : void 0);
256
+ if (!rates) {
257
+ if (model)
258
+ console.warn(`[0sec] Unknown model for cost estimation: ${model}`);
259
+ return MODEL_PRICING.default;
260
+ }
261
+ return rates;
262
+ }
263
+ function estimateCost(usage, model) {
264
+ const rates = getRates(model);
265
+ const cachedInputRate = rates.cachedInput ?? rates.input;
266
+ const cached = usage.cachedInputTokens ?? 0;
267
+ const uncachedInput = Math.max(0, usage.inputTokens - cached);
268
+ return uncachedInput / 1e6 * rates.input + cached / 1e6 * cachedInputRate + usage.outputTokens / 1e6 * rates.output;
269
+ }
270
+ function priceRun(usage, model) {
271
+ return estimateCost(usage, model);
272
+ }
273
+ function modelProvider(model) {
274
+ if (!model)
275
+ return "unknown";
276
+ const lowered = model.toLowerCase();
277
+ if (lowered.startsWith("openai/"))
278
+ return "openai";
279
+ if (lowered.startsWith("anthropic/"))
280
+ return "anthropic";
281
+ if (lowered.startsWith("google/"))
282
+ return "google";
283
+ if (lowered.startsWith("deepseek/"))
284
+ return "deepseek";
285
+ if (lowered.startsWith("meta/"))
286
+ return "meta";
287
+ if (lowered.startsWith("mistral/"))
288
+ return "mistral";
289
+ if (lowered.startsWith("z-ai/") || lowered.startsWith("zai/"))
290
+ return "z-ai";
291
+ if (lowered.startsWith("kimi/") || lowered.startsWith("moonshot/"))
292
+ return "kimi";
293
+ if (lowered.startsWith("openrouter/"))
294
+ return "openrouter";
295
+ if (lowered.startsWith("opencode/"))
296
+ return "opencode";
297
+ if (lowered.startsWith("copilot/"))
298
+ return "copilot";
299
+ if (lowered.startsWith("xai/") || lowered.startsWith("x-ai/"))
300
+ return "xai";
301
+ const stripped = normalizeModel(model).toLowerCase();
302
+ if (stripped.startsWith("gpt-") || stripped.startsWith("o3") || stripped.startsWith("o4-"))
303
+ return "openai";
304
+ if (stripped.startsWith("claude-"))
305
+ return "anthropic";
306
+ if (stripped.startsWith("gemini-"))
307
+ return "google";
308
+ if (stripped.startsWith("deepseek-"))
309
+ return "deepseek";
310
+ if (stripped.startsWith("llama-"))
311
+ return "meta";
312
+ if (stripped.startsWith("mistral-"))
313
+ return "mistral";
314
+ if (stripped.startsWith("glm-"))
315
+ return "z-ai";
316
+ if (stripped.startsWith("k3") || stripped.startsWith("kimi"))
317
+ return "kimi";
318
+ if (stripped.startsWith("qwen"))
319
+ return "qwen";
320
+ if (stripped.startsWith("grok"))
321
+ return "xai";
322
+ if (/^(muse-spark|mimo|ling|big-pickle|nemotron|minimax)/.test(stripped))
323
+ return "opencode";
324
+ return "unknown";
325
+ }
326
+ function splitCost(usage, model) {
327
+ const rates = getRates(model);
328
+ const cachedInputRate = rates.cachedInput ?? rates.input;
329
+ const cached = usage.cachedInputTokens ?? 0;
330
+ const uncachedInput = Math.max(0, usage.inputTokens - cached);
331
+ const split = {
332
+ cost_in: uncachedInput / 1e6 * rates.input,
333
+ cost_out: usage.outputTokens / 1e6 * rates.output
334
+ };
335
+ if (usage.cachedInputTokens !== void 0) {
336
+ split.cost_cache_read = cached / 1e6 * cachedInputRate;
337
+ }
338
+ return split;
339
+ }
340
+
341
+ // packages/shared/dist/verification.js
342
+ var VerificationStatusSchema = external_exports.enum([
343
+ "reproduced",
344
+ "not_reproduced",
345
+ "error",
346
+ "skipped"
347
+ ]);
348
+ var VerificationModeSchema = external_exports.enum([
349
+ "deterministic_replay",
350
+ "agent_assisted"
351
+ ]);
352
+ var RunnerKindSchema = external_exports.enum(["local", "docker", "qemu"]);
353
+ var EngineMetadataSchema = external_exports.object({
354
+ os: external_exports.string(),
355
+ arch: external_exports.string(),
356
+ runner: RunnerKindSchema
357
+ });
358
+ var VerificationCommandSchema = external_exports.object({
359
+ argv: external_exports.array(external_exports.string()).min(1),
360
+ exit_code: external_exports.number().int().nullable(),
361
+ stdout_excerpt: external_exports.string().optional(),
362
+ stderr_excerpt: external_exports.string().optional(),
363
+ duration_ms: external_exports.number().nonnegative()
364
+ });
365
+ var AssertionKindSchema = external_exports.enum([
366
+ "file_exists",
367
+ "http_status",
368
+ "string_in_output",
369
+ "exit_code"
370
+ ]);
371
+ var VerificationAssertionSchema = external_exports.object({
372
+ kind: AssertionKindSchema,
373
+ target: external_exports.string(),
374
+ expected: external_exports.union([external_exports.string(), external_exports.number(), external_exports.boolean()]),
375
+ actual: external_exports.union([external_exports.string(), external_exports.number(), external_exports.boolean(), external_exports.null()]),
376
+ passed: external_exports.boolean()
377
+ });
378
+ var EvidenceArtifactSchema = external_exports.object({
379
+ kind: external_exports.string().min(1),
380
+ path: external_exports.string().min(1),
381
+ sha256: external_exports.string().regex(/^[0-9a-f]{64}$/i, "sha256 must be 64 lowercase hex chars"),
382
+ bytes: external_exports.number().int().nonnegative().optional()
383
+ });
384
+ var VerificationResultSchema = external_exports.object({
385
+ status: VerificationStatusSchema,
386
+ mode: VerificationModeSchema,
387
+ finding_id: external_exports.string().min(1),
388
+ engine_version: external_exports.string().min(1),
389
+ started_at: external_exports.string().min(1),
390
+ completed_at: external_exports.string().min(1),
391
+ duration_ms: external_exports.number().nonnegative(),
392
+ commands: external_exports.array(VerificationCommandSchema),
393
+ assertions: external_exports.array(VerificationAssertionSchema),
394
+ evidence_artifacts: external_exports.array(EvidenceArtifactSchema),
395
+ engine_metadata: EngineMetadataSchema,
396
+ // Optional, additive fields. Existing producers can leave these undefined.
397
+ error_reason: external_exports.string().nullable().optional(),
398
+ summary: external_exports.string().optional(),
399
+ // #659 / #1278 — evidence provenance surfaced to the cloud verify writeback.
400
+ //
401
+ // `evidence_kind` mirrors the cloud contract's VerifyEvidenceKind (0cloud
402
+ // `@0cloud/cloud-contracts`): a reproduced kind promotes the finding to
403
+ // in_scope, `source-only` never does. Producers that actually reproduced a
404
+ // PoC set it; leave it undefined to let the consumer keep its own default
405
+ // (the cloud maps a `reproduced` replay to `reproduced-poc` on its own, so
406
+ // an undefined kind never downgrades a genuine replay). We only ever emit a
407
+ // REPRODUCED kind here — never `source-only` — for exactly that reason.
408
+ //
409
+ // `oast_confirmed` is the out-of-band signal: true when a token-matched OAST
410
+ // (interactsh-style DNS/HTTP) callback proved a blind class (SSRF / OOB-RCE /
411
+ // OOB-SQLi / blind XSS). Its proof lives OUTSIDE the request/response the
412
+ // deterministic replay can see, so the cloud promotes it even when the
413
+ // in-band replay predicates left the status at `not_reproduced` / `skipped`.
414
+ evidence_kind: external_exports.enum(["reproduced-poc", "source-only", "reproduced-memcorruption-poc"]).optional(),
415
+ oast_confirmed: external_exports.boolean().optional()
416
+ });
417
+
418
+ // packages/shared/dist/finding-schemas.js
419
+ var severityEnum = external_exports.enum(["critical", "high", "medium", "low", "info"]);
420
+ var attackCategoryEnum = external_exports.enum([
421
+ "prompt-injection",
422
+ "jailbreak",
423
+ "system-prompt-extraction",
424
+ "data-exfiltration",
425
+ "tool-misuse",
426
+ "output-manipulation",
427
+ "encoding-bypass",
428
+ "multi-turn",
429
+ "prototype-pollution",
430
+ "path-traversal",
431
+ "command-injection",
432
+ "code-injection",
433
+ "regex-dos",
434
+ "unsafe-deserialization",
435
+ "information-disclosure",
436
+ "ssrf",
437
+ "sql-injection",
438
+ "xss",
439
+ "cors",
440
+ "security-misconfiguration",
441
+ "missing-validation",
442
+ "crypto-misuse",
443
+ "heap-overflow",
444
+ "out-of-bounds-read",
445
+ "out-of-bounds-write",
446
+ "use-after-free",
447
+ "stack-buffer-overflow",
448
+ "null-pointer-deref",
449
+ "null-deref",
450
+ "integer-overflow",
451
+ "integer-truncation",
452
+ "race-condition",
453
+ "toctou",
454
+ "type-confusion",
455
+ "double-free",
456
+ "format-string",
457
+ "uninitialized-memory",
458
+ "denial-of-service",
459
+ "known-vulnerable-package",
460
+ "supply-chain",
461
+ "other"
462
+ ]);
463
+ var findingStatusEnum = external_exports.enum([
464
+ "discovered",
465
+ "verified",
466
+ "confirmed",
467
+ "scored",
468
+ "reported",
469
+ "fixed",
470
+ "false-positive"
471
+ ]);
472
+ var pocStepKindEnum = external_exports.enum([
473
+ "setup",
474
+ "auth",
475
+ "prerequisite",
476
+ "exploit",
477
+ "verify"
478
+ ]);
479
+ var pocStepActionSchema = external_exports.discriminatedUnion("type", [
480
+ external_exports.object({
481
+ type: external_exports.literal("shell"),
482
+ cmd: external_exports.string(),
483
+ cwd: external_exports.string().optional()
484
+ }),
485
+ external_exports.object({
486
+ type: external_exports.literal("http"),
487
+ method: external_exports.string(),
488
+ url: external_exports.string(),
489
+ headers: external_exports.record(external_exports.string()).optional(),
490
+ body: external_exports.string().optional()
491
+ }),
492
+ external_exports.object({
493
+ type: external_exports.literal("docker"),
494
+ image: external_exports.string(),
495
+ args: external_exports.array(external_exports.string())
496
+ }),
497
+ external_exports.object({
498
+ type: external_exports.literal("note"),
499
+ text: external_exports.string()
500
+ })
501
+ ]);
502
+ var pocStepExpectSchema = external_exports.discriminatedUnion("type", [
503
+ external_exports.object({ type: external_exports.literal("exit-zero") }),
504
+ external_exports.object({
505
+ type: external_exports.literal("http-status"),
506
+ status: external_exports.union([external_exports.number(), external_exports.array(external_exports.number())])
507
+ }),
508
+ external_exports.object({ type: external_exports.literal("body-contains"), text: external_exports.string() }),
509
+ external_exports.object({ type: external_exports.literal("body-matches"), pattern: external_exports.string() }),
510
+ external_exports.object({ type: external_exports.literal("file-exists"), path: external_exports.string() })
511
+ ]);
512
+ var pocStepSchema = external_exports.object({
513
+ id: external_exports.string(),
514
+ kind: pocStepKindEnum,
515
+ summary: external_exports.string(),
516
+ action: pocStepActionSchema,
517
+ expect: pocStepExpectSchema.optional()
518
+ });
519
+ var pocStepArraySchema = external_exports.array(pocStepSchema);
520
+ var evidenceSchema = external_exports.object({
521
+ request: external_exports.string(),
522
+ response: external_exports.string(),
523
+ analysis: external_exports.string().optional()
524
+ });
525
+ var findingSchema = external_exports.object({
526
+ id: external_exports.string().min(1),
527
+ templateId: external_exports.string(),
528
+ title: external_exports.string(),
529
+ description: external_exports.string(),
530
+ severity: severityEnum,
531
+ category: attackCategoryEnum,
532
+ status: findingStatusEnum,
533
+ evidence: evidenceSchema,
534
+ fingerprint: external_exports.string().optional(),
535
+ triageStatus: external_exports.enum(["new", "accepted", "suppressed"]).optional(),
536
+ triageNote: external_exports.string().optional(),
537
+ layerVerdicts: external_exports.array(external_exports.unknown()).optional(),
538
+ workflowStatus: external_exports.string().optional(),
539
+ workflowAssignee: external_exports.string().nullable().optional(),
540
+ confidence: external_exports.number().optional(),
541
+ cvssVector: external_exports.string().optional(),
542
+ cvssScore: external_exports.number().optional(),
543
+ remediation: external_exports.unknown().optional(),
544
+ pocSteps: pocStepArraySchema.optional(),
545
+ verificationSpec: external_exports.unknown().optional(),
546
+ timestamp: external_exports.number()
547
+ }).passthrough();
548
+ var nonNegativeIntCounter = external_exports.number().int().nonnegative();
549
+ var reportSummarySchema = external_exports.object({
550
+ totalAttacks: nonNegativeIntCounter,
551
+ totalFindings: nonNegativeIntCounter,
552
+ critical: nonNegativeIntCounter,
553
+ high: nonNegativeIntCounter,
554
+ medium: nonNegativeIntCounter,
555
+ low: nonNegativeIntCounter,
556
+ info: nonNegativeIntCounter
557
+ }).passthrough();
558
+ function formatZodError(err, label) {
559
+ const issue = err.issues[0];
560
+ if (!issue)
561
+ return `${label} failed validation`;
562
+ const path = issue.path.length > 0 ? issue.path.join(".") : "<root>";
563
+ return `${label} failed validation at ${path}: ${issue.message}`;
564
+ }
565
+
566
+ // packages/shared/dist/workflow.js
567
+ var conditionCmpOpSchema = external_exports.enum(["==", "!=", ">=", "<=", ">", "<", "in"]);
568
+ var conditionLhsSchema = external_exports.enum([
569
+ // Most-recent journal entry kind: "finding" | "decision" | "error" | etc.
570
+ "last_entry_kind",
571
+ // Confidence on the most-recent finding/decision entry (0–1).
572
+ "confidence",
573
+ // Total entry count seen so far.
574
+ "entry_count",
575
+ // True iff at least one finding has been recorded.
576
+ "has_finding",
577
+ // True iff the most-recent entry was an error.
578
+ "last_error"
579
+ ]);
580
+ var conditionRhsSchema = external_exports.union([
581
+ external_exports.string(),
582
+ external_exports.number(),
583
+ external_exports.boolean(),
584
+ external_exports.array(external_exports.string())
585
+ ]);
586
+ var conditionCmpSchema = external_exports.object({
587
+ kind: external_exports.literal("cmp"),
588
+ lhs: conditionLhsSchema,
589
+ op: conditionCmpOpSchema,
590
+ rhs: conditionRhsSchema
591
+ });
592
+ var conditionExprSchema = external_exports.lazy(() => external_exports.union([
593
+ conditionCmpSchema,
594
+ external_exports.object({
595
+ kind: external_exports.literal("and"),
596
+ clauses: external_exports.array(conditionExprSchema).min(1)
597
+ }),
598
+ external_exports.object({
599
+ kind: external_exports.literal("or"),
600
+ clauses: external_exports.array(conditionExprSchema).min(1)
601
+ })
602
+ ]));
603
+ var HALT_STATE = "__end__";
604
+ var transitionTargetSchema = external_exports.string().min(1).regex(/^[A-Za-z_][A-Za-z0-9_-]*$/, "state names must be identifier-shaped");
605
+ var transitionRefSchema = external_exports.object({
606
+ to: transitionTargetSchema
607
+ });
608
+ var transitionRuleSchema = external_exports.object({
609
+ when: conditionExprSchema,
610
+ to: transitionTargetSchema
611
+ });
612
+ var stateDefSchema = external_exports.object({
613
+ // Named specialist this state invokes. The string is resolved at
614
+ // orchestrator dispatch time (#249); this schema only validates the
615
+ // shape, not the existence of the specialist.
616
+ specialist: external_exports.string().min(1),
617
+ // Default-happy-path transition. Optional — a state can rely entirely
618
+ // on `transitions[].when` rules or terminate via `__end__`.
619
+ on_success: transitionRefSchema.optional(),
620
+ // Default-error transition. When omitted, the orchestrator surfaces
621
+ // the error per its own policy (today: halt with status `failed`).
622
+ on_failure: transitionRefSchema.optional(),
623
+ // Ordered rule list. Evaluated top-to-bottom by the orchestrator; the
624
+ // first rule whose `when` matches wins. Falls through to on_success /
625
+ // on_failure when no rule matches.
626
+ transitions: external_exports.array(transitionRuleSchema).optional()
627
+ });
628
+ var specialistRefSchema = external_exports.object({
629
+ ref: external_exports.string().min(1),
630
+ description: external_exports.string().optional()
631
+ });
632
+ var workflowDefinitionSchema = external_exports.object({
633
+ name: external_exports.string().min(1).regex(/^[A-Za-z][A-Za-z0-9_-]*$/, "workflow name must be identifier-shaped"),
634
+ version: external_exports.number().int().positive(),
635
+ description: external_exports.string().min(1),
636
+ initial_state: transitionTargetSchema,
637
+ states: external_exports.record(external_exports.string(), stateDefSchema).refine((v) => Object.keys(v).length > 0, {
638
+ message: "workflow must declare at least one state"
639
+ }),
640
+ specialists: external_exports.record(external_exports.string(), specialistRefSchema).optional()
641
+ }).superRefine((wf, ctx) => {
642
+ const stateNames = new Set(Object.keys(wf.states));
643
+ const targetOk = (t) => t === HALT_STATE || stateNames.has(t);
644
+ if (!targetOk(wf.initial_state)) {
645
+ ctx.addIssue({
646
+ code: external_exports.ZodIssueCode.custom,
647
+ path: ["initial_state"],
648
+ message: `initial_state '${wf.initial_state}' is not declared in states`
649
+ });
650
+ }
651
+ for (const [stateName, state] of Object.entries(wf.states)) {
652
+ if (state.on_success && !targetOk(state.on_success.to)) {
653
+ ctx.addIssue({
654
+ code: external_exports.ZodIssueCode.custom,
655
+ path: ["states", stateName, "on_success", "to"],
656
+ message: `on_success.to '${state.on_success.to}' references an unknown state`
657
+ });
658
+ }
659
+ if (state.on_failure && !targetOk(state.on_failure.to)) {
660
+ ctx.addIssue({
661
+ code: external_exports.ZodIssueCode.custom,
662
+ path: ["states", stateName, "on_failure", "to"],
663
+ message: `on_failure.to '${state.on_failure.to}' references an unknown state`
664
+ });
665
+ }
666
+ state.transitions?.forEach((rule, idx) => {
667
+ if (!targetOk(rule.to)) {
668
+ ctx.addIssue({
669
+ code: external_exports.ZodIssueCode.custom,
670
+ path: ["states", stateName, "transitions", idx, "to"],
671
+ message: `transitions[${idx}].to '${rule.to}' references an unknown state`
672
+ });
673
+ }
674
+ });
675
+ }
676
+ });
677
+
678
+ // packages/shared/dist/research-evidence.js
679
+ var GRADE_ORDER = {
680
+ candidate: 0,
681
+ reachable: 1,
682
+ observed: 2,
683
+ reproduced: 3,
684
+ "impact-proven": 4
685
+ };
686
+ function researchGradeAtLeast(actual, required) {
687
+ return GRADE_ORDER[actual] >= GRADE_ORDER[required];
688
+ }
689
+ function normalizeResearchNovelty(receipt) {
690
+ if (receipt.state === "novel" && (!receipt.sources?.length || (receipt.scanned ?? 0) <= 0)) {
691
+ return { ...receipt, state: "unchecked" };
692
+ }
693
+ return receipt;
694
+ }
695
+ function researchDisclosureReady(envelope) {
696
+ const novelty = normalizeResearchNovelty(envelope.novelty);
697
+ return researchGradeAtLeast(envelope.grade, "reproduced") && novelty.state === "novel";
698
+ }
699
+ function researchZeroCapProven(envelope) {
700
+ const context = envelope.executionContext;
701
+ return (context?.platform === void 0 || context.platform === "linux") && context?.privilege === "zero-cap" && context.basis === "runtime-attested" && researchGradeAtLeast(envelope.grade, "reproduced") && Number.isSafeInteger(context.realUid) && (context.realUid ?? 0) > 0 && Number.isSafeInteger(context.effectiveUid) && (context.effectiveUid ?? 0) > 0 && /^[0]{16}$/.test(context.effectiveCapabilities ?? "") && context.noNewPrivileges === true && Boolean(context.attestationArtifact?.ref) && /^[a-f0-9]{64}$/.test(context.attestationArtifact?.sha256 ?? "");
702
+ }
703
+ function researchLpeDisclosureReady(envelope) {
704
+ return researchDisclosureReady(envelope) && researchZeroCapProven(envelope);
705
+ }
706
+ var SHA256 = /^[a-f0-9]{64}$/;
707
+ function retainedArtifact(envelope, artifact, expectedKind) {
708
+ if (typeof artifact !== "object" || artifact === null || typeof artifact.ref !== "string" || !artifact.ref || typeof artifact.sha256 !== "string" || !SHA256.test(artifact.sha256) || !Array.isArray(envelope.artifacts))
709
+ return false;
710
+ const candidates = envelope.artifacts.filter((candidate) => typeof candidate === "object" && candidate !== null && typeof candidate.path === "string" && typeof candidate.sha256 === "string" && typeof candidate.kind === "string");
711
+ const matchingPath = candidates.filter((candidate) => candidate.path === artifact.ref);
712
+ return matchingPath.length === 1 && matchingPath[0].sha256.toLowerCase() === artifact.sha256 && (expectedKind === void 0 || matchingPath[0].kind === expectedKind) && candidates.filter((candidate) => candidate.sha256.toLowerCase() === artifact.sha256).length === 1;
713
+ }
714
+ var SID = /^S-1-(?:0|[1-9][0-9]*)(?:-(?:0|[1-9][0-9]*)){1,15}$/;
715
+ var TOKEN_ID = /^[A-Za-z0-9_-]{16,128}$/;
716
+ var RUN_NONCE = /^[A-Za-z0-9_-]{32,128}$/;
717
+ var PRIVILEGE = /^Se[A-Za-z0-9]+Privilege$/;
718
+ var DANGEROUS_WINDOWS_PRIVILEGES = /* @__PURE__ */ new Set([
719
+ "SeDebugPrivilege",
720
+ "SeImpersonatePrivilege",
721
+ "SeAssignPrimaryTokenPrivilege",
722
+ "SeCreateTokenPrivilege",
723
+ "SeRelabelPrivilege",
724
+ "SeTcbPrivilege",
725
+ "SeBackupPrivilege",
726
+ "SeRestorePrivilege",
727
+ "SeTakeOwnershipPrivilege",
728
+ "SeLoadDriverPrivilege"
729
+ ]);
730
+ function coherentTokenSnapshot(token) {
731
+ if (typeof token !== "object" || token === null)
732
+ return false;
733
+ const candidate = token;
734
+ return TOKEN_ID.test(candidate.tokenId) && SID.test(candidate.userSid) && Number.isSafeInteger(candidate.integrityRid) && candidate.integrityRid >= 0 && ["default", "limited", "full"].includes(candidate.elevationType) && typeof candidate.elevated === "boolean" && ["absent", "deny-only", "enabled"].includes(candidate.adminGroup) && typeof candidate.appContainer === "boolean" && Number.isSafeInteger(candidate.restrictedSidCount) && candidate.restrictedSidCount >= 0 && Array.isArray(candidate.enabledPrivileges) && candidate.enabledPrivileges.length <= 128 && candidate.enabledPrivileges.every((privilege) => typeof privilege === "string" && PRIVILEGE.test(privilege)) && new Set(candidate.enabledPrivileges).size === candidate.enabledPrivileges.length;
735
+ }
736
+ function equalTokenSnapshot(left, right) {
737
+ return left.tokenId === right.tokenId && left.userSid === right.userSid && left.integrityRid === right.integrityRid && left.elevationType === right.elevationType && left.elevated === right.elevated && left.adminGroup === right.adminGroup && left.appContainer === right.appContainer && left.restrictedSidCount === right.restrictedSidCount && left.enabledPrivileges.length === right.enabledPrivileges.length && left.enabledPrivileges.every((privilege, index) => privilege === right.enabledPrivileges[index]);
738
+ }
739
+ function unprivilegedWindowsToken(token) {
740
+ return token.integrityRid <= 8448 && !token.elevated && token.elevationType !== "full" && token.adminGroup !== "enabled" && (token.appContainer || token.restrictedSidCount > 0 || token.adminGroup === "absent") && !token.enabledPrivileges.some((privilege) => DANGEROUS_WINDOWS_PRIVILEGES.has(privilege));
741
+ }
742
+ function validWindowsStart(startingContext, token) {
743
+ if (startingContext === "lpac")
744
+ return false;
745
+ if (startingContext === "standard-user") {
746
+ return !token.appContainer && token.restrictedSidCount === 0;
747
+ }
748
+ if (startingContext === "appcontainer")
749
+ return token.appContainer;
750
+ return token.appContainer || token.restrictedSidCount > 0;
751
+ }
752
+ function validWindowsFinish(principal, start, finish) {
753
+ if (finish.appContainer || finish.restrictedSidCount !== 0)
754
+ return false;
755
+ if (principal === "local-system") {
756
+ return finish.userSid === "S-1-5-18" && finish.integrityRid >= 16384 && finish.elevated && finish.elevationType === "default";
757
+ }
758
+ return finish.userSid === start.userSid && finish.integrityRid >= 12288 && finish.elevated && finish.elevationType === "full" && finish.adminGroup === "enabled";
759
+ }
760
+ function researchWindowsTokenTransitionProven(envelope) {
761
+ const context = envelope.executionContext;
762
+ const transition = context?.windowsTokenTransition;
763
+ if (context?.platform !== "windows" || context.privilege !== "windows-restricted" || context.basis !== "runtime-attested" || !researchGradeAtLeast(envelope.grade, "reproduced") || typeof transition !== "object" || transition === null || transition.claimEligible !== true || transition.fixture !== false || !envelope.target.kind.startsWith("windows.") || !context.campaignId || transition.campaignId !== context.campaignId || !SHA256.test(context.configDigest ?? "") || envelope.target.configDigest !== context.configDigest || typeof transition.buildLabEx !== "string" || !transition.buildLabEx.trim() || transition.buildLabEx.length > 256 || transition.buildLabEx !== envelope.target.buildId || typeof transition.workerId !== "string" || !transition.workerId.trim() || transition.workerId.length > 256 || !["standard-user", "appcontainer", "lpac", "eligible-sandbox"].includes(transition.startingContext) || !["elevated-user", "local-system"].includes(transition.finishingPrincipal) || !SHA256.test(transition.scopeManifestSha256) || !Number.isSafeInteger(transition.targetTrials) || transition.targetTrials < 2 || !Number.isSafeInteger(transition.cleanControls) || transition.cleanControls < 2 || !Array.isArray(transition.runCaptures) || transition.runCaptures.length < 4 || transition.runCaptures.length > 128 || !coherentTokenSnapshot(transition.startToken) || !coherentTokenSnapshot(transition.finishToken) || transition.startToken.tokenId === transition.finishToken.tokenId || context.attestationArtifact?.ref === transition.receiptArtifact?.ref || context.attestationArtifact?.ref === transition.workerAcceptanceArtifact?.ref || transition.receiptArtifact?.ref === transition.workerAcceptanceArtifact?.ref || !retainedArtifact(envelope, context.attestationArtifact, "windows_token_transition") || !retainedArtifact(envelope, transition.receiptArtifact, "windows_evidence_receipt") || !retainedArtifact(envelope, transition.workerAcceptanceArtifact, "windows_worker_acceptance")) {
764
+ return false;
765
+ }
766
+ const start = transition.startToken;
767
+ const finish = transition.finishToken;
768
+ const runNonces = /* @__PURE__ */ new Set();
769
+ const captureNonces = /* @__PURE__ */ new Set();
770
+ const tokenIds = /* @__PURE__ */ new Set();
771
+ const captureDigests = /* @__PURE__ */ new Set();
772
+ const caseTrials = /* @__PURE__ */ new Set();
773
+ let targetTrials = 0;
774
+ let cleanControls = 0;
775
+ let acceptanceSha = "";
776
+ let acceptanceNonce = "";
777
+ let grantNonce = "";
778
+ for (const rawCapture of transition.runCaptures) {
779
+ if (typeof rawCapture !== "object" || rawCapture === null)
780
+ return false;
781
+ const capture = rawCapture;
782
+ if (!(capture.case === "target" || capture.case === "control") || !Number.isSafeInteger(capture.trial) || capture.trial < 1 || !RUN_NONCE.test(capture.runNonce) || !RUN_NONCE.test(capture.captureNonce) || !RUN_NONCE.test(capture.workerAcceptanceNonce) || !RUN_NONCE.test(capture.executionGrantNonce) || capture.runNonce === capture.captureNonce || capture.workerAcceptanceNonce === capture.executionGrantNonce || capture.runNonce === capture.workerAcceptanceNonce || capture.runNonce === capture.executionGrantNonce || capture.captureNonce === capture.workerAcceptanceNonce || capture.captureNonce === capture.executionGrantNonce || capture.buildLabEx !== transition.buildLabEx || capture.campaignId !== transition.campaignId || capture.workerId !== transition.workerId || capture.configDigest !== context.configDigest || capture.scopeManifestSha256 !== transition.scopeManifestSha256 || capture.workerAcceptanceSha256 !== transition.workerAcceptanceArtifact.sha256 || !coherentTokenSnapshot(capture.startToken) || !coherentTokenSnapshot(capture.finishToken) || capture.startToken.tokenId === capture.finishToken.tokenId || !retainedArtifact(envelope, capture.captureArtifact, "windows_token_capture") || runNonces.has(capture.runNonce) || runNonces.has(capture.captureNonce) || captureNonces.has(capture.captureNonce) || captureNonces.has(capture.runNonce) || captureDigests.has(capture.captureArtifact.sha256) || caseTrials.has(`${capture.case}:${capture.trial}`) || tokenIds.has(capture.startToken.tokenId) || tokenIds.has(capture.finishToken.tokenId) || !validWindowsStart(transition.startingContext, capture.startToken) || !unprivilegedWindowsToken(capture.startToken)) {
783
+ return false;
784
+ }
785
+ if (acceptanceSha && acceptanceSha !== capture.workerAcceptanceSha256)
786
+ return false;
787
+ if (acceptanceNonce && acceptanceNonce !== capture.workerAcceptanceNonce)
788
+ return false;
789
+ if (grantNonce && grantNonce !== capture.executionGrantNonce)
790
+ return false;
791
+ acceptanceSha = capture.workerAcceptanceSha256;
792
+ acceptanceNonce = capture.workerAcceptanceNonce;
793
+ grantNonce = capture.executionGrantNonce;
794
+ runNonces.add(capture.runNonce);
795
+ captureNonces.add(capture.captureNonce);
796
+ captureDigests.add(capture.captureArtifact.sha256);
797
+ caseTrials.add(`${capture.case}:${capture.trial}`);
798
+ tokenIds.add(capture.startToken.tokenId);
799
+ tokenIds.add(capture.finishToken.tokenId);
800
+ if (capture.case === "target") {
801
+ if (!validWindowsFinish(transition.finishingPrincipal, capture.startToken, capture.finishToken))
802
+ return false;
803
+ targetTrials += 1;
804
+ } else {
805
+ if (!validWindowsStart(transition.startingContext, capture.finishToken) || !unprivilegedWindowsToken(capture.finishToken) || capture.finishToken.userSid !== capture.startToken.userSid)
806
+ return false;
807
+ cleanControls += 1;
808
+ }
809
+ }
810
+ const targets = transition.runCaptures.filter((capture) => capture.case === "target").sort((left, right) => left.trial - right.trial);
811
+ const controls = transition.runCaptures.filter((capture) => capture.case === "control").sort((left, right) => left.trial - right.trial);
812
+ if (!targets.every((capture, index) => capture.trial === index + 1) || !controls.every((capture, index) => capture.trial === index + 1))
813
+ return false;
814
+ const firstTarget = targets[0];
815
+ return targetTrials === transition.targetTrials && cleanControls === transition.cleanControls && targetTrials >= 2 && cleanControls >= 2 && Boolean(firstTarget) && equalTokenSnapshot(start, firstTarget.startToken) && equalTokenSnapshot(finish, firstTarget.finishToken);
816
+ }
817
+ function researchWindowsLpeDisclosureReady(envelope) {
818
+ const policy = envelope.reportingPolicy;
819
+ return researchDisclosureReady(envelope) && researchWindowsTokenTransitionProven(envelope) && policy?.automaticDisclosure === false && policy.humanReviewRequired === true && policy.benchmarkCase === false;
820
+ }
821
+ function researchPlatformLpeDisclosureReady(envelope, platform) {
822
+ if (platform !== envelope.executionContext?.platform)
823
+ return false;
824
+ if (platform === "linux")
825
+ return researchLpeDisclosureReady(envelope);
826
+ if (platform === "windows")
827
+ return researchWindowsLpeDisclosureReady(envelope);
828
+ return false;
829
+ }
830
+
831
+ // packages/shared/dist/paths.js
832
+ import { homedir } from "node:os";
833
+ import { join as join2 } from "node:path";
834
+ function homeStateDir(home = homedir()) {
835
+ return join2(home, ".0sec");
836
+ }
837
+ function runStateDir(runId, home) {
838
+ if (!/^[A-Za-z0-9][A-Za-z0-9._-]{0,127}$/.test(runId)) {
839
+ throw new Error(`Invalid 0sec run id ${JSON.stringify(runId)}.`);
840
+ }
841
+ return join2(homeStateDir(home), "runs", runId);
842
+ }
843
+
844
+ // packages/shared/dist/agent-assurance.js
845
+ var AGENT_ACTION_ASSURANCE_SCHEMA_VERSION = "0sec.agent-action-assurance/v1";
846
+ var AgentInjectionVectorSchema = external_exports.enum([
847
+ "readme",
848
+ "code-comment",
849
+ "issue-or-pr",
850
+ "web-content",
851
+ "tool-output",
852
+ "support-doc",
853
+ "email",
854
+ "forum-post",
855
+ "rules-file"
856
+ ]);
857
+ var AgentActionScenarioSchema = external_exports.object({
858
+ id: external_exports.string().min(1),
859
+ title: external_exports.string().min(1),
860
+ injection_vector: AgentInjectionVectorSchema,
861
+ benign_task: external_exports.string().min(1),
862
+ payload: external_exports.string().min(1),
863
+ prohibited_action: external_exports.string().min(1)
864
+ }).strict();
865
+ var Sha256Schema = external_exports.string().regex(/^[a-f0-9]{64}$/, "sha256 must be 64 lowercase hex characters");
866
+ var IsoTimestampSchema = external_exports.string().datetime({ offset: true });
867
+ var AgentActionOutcomeSchema = external_exports.enum([
868
+ "observed",
869
+ "not_observed",
870
+ "inconclusive",
871
+ "error"
872
+ ]);
873
+ var AgentActionTargetMetadataSchema = external_exports.object({
874
+ scope_sha256: Sha256Schema,
875
+ environment: external_exports.enum(["local", "test", "staging"]),
876
+ agent_endpoint: external_exports.string().url(),
877
+ mcp_endpoint: external_exports.string().url(),
878
+ oracle_endpoint: external_exports.string().url(),
879
+ target_version: external_exports.string().min(1),
880
+ policy_version: external_exports.string().min(1),
881
+ model_version: external_exports.string().min(1),
882
+ tool_versions: external_exports.record(external_exports.string().min(1)),
883
+ configuration_sha256: Sha256Schema
884
+ }).strict();
885
+ var AgentActionToolCallSchema = external_exports.object({
886
+ name: external_exports.string().min(1),
887
+ args_sha256: Sha256Schema
888
+ }).strict();
889
+ var AgentActionRedactionSchema = external_exports.object({
890
+ strategy: external_exports.literal("sensitive-text-v1"),
891
+ redacted_fields: external_exports.array(external_exports.string().min(1)),
892
+ /** Customer-facing bundles never include unredacted execution bytes. */
893
+ raw_artifacts: external_exports.literal(false)
894
+ }).strict();
895
+ var AgentActionRetestSchema = external_exports.object({
896
+ previous_run_id: external_exports.string().uuid(),
897
+ previous_manifest_sha256: Sha256Schema,
898
+ configuration_changed: external_exports.boolean()
899
+ }).strict();
900
+ var AgentActionEvidenceManifestSchema = external_exports.object({
901
+ schema_version: external_exports.literal(AGENT_ACTION_ASSURANCE_SCHEMA_VERSION),
902
+ run_id: external_exports.string().uuid(),
903
+ created_at: IsoTimestampSchema,
904
+ target: AgentActionTargetMetadataSchema,
905
+ scenario: external_exports.object({
906
+ id: external_exports.string().min(1),
907
+ title: external_exports.string().min(1),
908
+ injection_vector: AgentInjectionVectorSchema,
909
+ payload_sha256: Sha256Schema,
910
+ prohibited_action: external_exports.string().min(1)
911
+ }).strict(),
912
+ execution: external_exports.object({
913
+ request_sha256: Sha256Schema,
914
+ response_sha256: Sha256Schema,
915
+ transcript_sha256: Sha256Schema,
916
+ mcp_tools_sha256: Sha256Schema,
917
+ tool_calls: external_exports.array(AgentActionToolCallSchema)
918
+ }).strict(),
919
+ oracle: external_exports.object({
920
+ name: external_exports.string().min(1),
921
+ outcome: AgentActionOutcomeSchema,
922
+ complete: external_exports.boolean(),
923
+ observation_sha256: Sha256Schema,
924
+ observed_at: IsoTimestampSchema.optional(),
925
+ summary: external_exports.string().optional()
926
+ }).strict(),
927
+ redaction: AgentActionRedactionSchema,
928
+ retest: AgentActionRetestSchema.optional(),
929
+ artifacts: external_exports.array(EvidenceArtifactSchema)
930
+ }).strict().superRefine((manifest, ctx) => {
931
+ const requiresCompleteOracle = manifest.oracle.outcome === "observed" || manifest.oracle.outcome === "not_observed";
932
+ if (requiresCompleteOracle && !manifest.oracle.complete) {
933
+ ctx.addIssue({
934
+ code: external_exports.ZodIssueCode.custom,
935
+ path: ["oracle", "complete"],
936
+ message: "observed and not_observed outcomes require a complete action-oracle observation"
937
+ });
938
+ }
939
+ if (manifest.oracle.outcome === "inconclusive" && manifest.oracle.complete) {
940
+ ctx.addIssue({
941
+ code: external_exports.ZodIssueCode.custom,
942
+ path: ["oracle", "complete"],
943
+ message: "an inconclusive outcome cannot claim a complete action-oracle observation"
944
+ });
945
+ }
946
+ for (const [field, endpoint] of Object.entries({
947
+ agent_endpoint: manifest.target.agent_endpoint,
948
+ mcp_endpoint: manifest.target.mcp_endpoint,
949
+ oracle_endpoint: manifest.target.oracle_endpoint
950
+ })) {
951
+ const parsed = new URL(endpoint);
952
+ if (parsed.username || parsed.password) {
953
+ ctx.addIssue({
954
+ code: external_exports.ZodIssueCode.custom,
955
+ path: ["target", field],
956
+ message: "endpoint URLs must not embed credentials"
957
+ });
958
+ }
959
+ }
960
+ for (const [index, artifact] of manifest.artifacts.entries()) {
961
+ if (/^(?:\/|[A-Za-z]:[\\/])/.test(artifact.path) || /(?:^|[\\/])\.\.(?:[\\/]|$)/.test(artifact.path)) {
962
+ ctx.addIssue({
963
+ code: external_exports.ZodIssueCode.custom,
964
+ path: ["artifacts", index, "path"],
965
+ message: "artifact paths must be relative and must not escape the evidence bundle"
966
+ });
967
+ }
968
+ }
969
+ });
970
+ function parseAgentActionEvidenceManifest(value) {
971
+ return AgentActionEvidenceManifestSchema.parse(value);
972
+ }
973
+
974
+ // packages/shared/dist/presentation.js
975
+ var PRESENTATION_PROTOCOL = "0sec.presentation/v1";
976
+ function createTranscriptDocument(entries) {
977
+ return {
978
+ protocol: PRESENTATION_PROTOCOL,
979
+ kind: "document",
980
+ documentType: "transcript",
981
+ entries
982
+ };
983
+ }
984
+ function createPresentationEvent(options) {
985
+ return {
986
+ protocol: PRESENTATION_PROTOCOL,
987
+ kind: "event",
988
+ source: options.source,
989
+ sequence: options.sequence,
990
+ at: options.at,
991
+ eventType: options.eventType,
992
+ payload: options.payload,
993
+ ...options.scanId ? { scanId: options.scanId } : {},
994
+ ...options.sessionId ? { sessionId: options.sessionId } : {}
995
+ };
996
+ }
997
+ function createScanReportDocument(report) {
998
+ return { protocol: PRESENTATION_PROTOCOL, kind: "document", documentType: "scan-report", report };
999
+ }
1000
+ function createAuditReportDocument(report) {
1001
+ return { protocol: PRESENTATION_PROTOCOL, kind: "document", documentType: "audit-report", report };
1002
+ }
1003
+ function createReviewReportDocument(report) {
1004
+ return { protocol: PRESENTATION_PROTOCOL, kind: "document", documentType: "review-report", report };
1005
+ }
1006
+ function isPresentationEvent(value) {
1007
+ if (typeof value !== "object" || value === null || Array.isArray(value))
1008
+ return false;
1009
+ const candidate = value;
1010
+ return candidate.protocol === PRESENTATION_PROTOCOL && candidate.kind === "event" && typeof candidate.source === "string" && typeof candidate.sequence === "number" && typeof candidate.at === "string" && typeof candidate.eventType === "string" && typeof candidate.payload === "object" && candidate.payload !== null && !Array.isArray(candidate.payload);
1011
+ }
1012
+
1013
+ // packages/shared/dist/desktop-console.js
1014
+ var DESKTOP_CONSOLE_SCHEMA_VERSION = 1;
1015
+ var DEFAULT_AUTONOMY_MODE = "yolo";
1016
+ var DEFAULT_ALLOW_MODEL_SELF_EXTENSION = true;
1017
+
1018
+ export {
1019
+ defaultRoleFor,
1020
+ resolveIdentities,
1021
+ hasMultipleIdentities,
1022
+ compareRoles,
1023
+ VERSION,
1024
+ DEFAULT_MODEL,
1025
+ DEFAULT_TIMEOUT_MS,
1026
+ DEFAULT_MAX_CONCURRENCY,
1027
+ DEPTH_CONFIG,
1028
+ SEVERITY_RANK,
1029
+ SEVERITY_ORDER,
1030
+ DEFAULT_SEVERITY_FLOOR,
1031
+ severityRank,
1032
+ meetsSeverityFloor,
1033
+ PRICING_SNAPSHOT_DATE,
1034
+ MANUAL_PRICING,
1035
+ MODEL_PRICING,
1036
+ getRates,
1037
+ estimateCost,
1038
+ priceRun,
1039
+ modelProvider,
1040
+ splitCost,
1041
+ VerificationStatusSchema,
1042
+ VerificationModeSchema,
1043
+ RunnerKindSchema,
1044
+ EngineMetadataSchema,
1045
+ VerificationCommandSchema,
1046
+ AssertionKindSchema,
1047
+ VerificationAssertionSchema,
1048
+ EvidenceArtifactSchema,
1049
+ VerificationResultSchema,
1050
+ pocStepSchema,
1051
+ pocStepArraySchema,
1052
+ findingSchema,
1053
+ reportSummarySchema,
1054
+ formatZodError,
1055
+ conditionCmpOpSchema,
1056
+ conditionLhsSchema,
1057
+ conditionRhsSchema,
1058
+ conditionCmpSchema,
1059
+ conditionExprSchema,
1060
+ HALT_STATE,
1061
+ transitionTargetSchema,
1062
+ transitionRefSchema,
1063
+ transitionRuleSchema,
1064
+ stateDefSchema,
1065
+ specialistRefSchema,
1066
+ workflowDefinitionSchema,
1067
+ researchGradeAtLeast,
1068
+ normalizeResearchNovelty,
1069
+ researchDisclosureReady,
1070
+ researchZeroCapProven,
1071
+ researchLpeDisclosureReady,
1072
+ researchWindowsTokenTransitionProven,
1073
+ researchWindowsLpeDisclosureReady,
1074
+ researchPlatformLpeDisclosureReady,
1075
+ homeStateDir,
1076
+ runStateDir,
1077
+ AGENT_ACTION_ASSURANCE_SCHEMA_VERSION,
1078
+ AgentInjectionVectorSchema,
1079
+ AgentActionScenarioSchema,
1080
+ AgentActionOutcomeSchema,
1081
+ AgentActionTargetMetadataSchema,
1082
+ AgentActionEvidenceManifestSchema,
1083
+ parseAgentActionEvidenceManifest,
1084
+ PRESENTATION_PROTOCOL,
1085
+ createTranscriptDocument,
1086
+ createPresentationEvent,
1087
+ createScanReportDocument,
1088
+ createAuditReportDocument,
1089
+ createReviewReportDocument,
1090
+ isPresentationEvent,
1091
+ DESKTOP_CONSOLE_SCHEMA_VERSION,
1092
+ DEFAULT_AUTONOMY_MODE,
1093
+ DEFAULT_ALLOW_MODEL_SELF_EXTENSION
1094
+ };