0sec-cli 0.17.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 (62) hide show
  1. package/0sec.js +40 -35
  2. package/README.md +9 -0
  3. package/chunks/{adapt-loop-ECQG7454.js → adapt-loop-SMH6V4PD.js} +4 -4
  4. package/chunks/{artifact-scraper-GJEZMOHF.js → artifact-scraper-HQ7HLP6V.js} +2 -2
  5. package/chunks/{assumption-mining-BVMMUZHB.js → assumption-mining-5SNIVVDN.js} +13 -13
  6. package/chunks/{chunk-SZJCPG2I.js → chunk-242TMK6G.js} +1 -1
  7. package/chunks/{chunk-HE7LCA7G.js → chunk-2JCCA2JL.js} +1 -1
  8. package/chunks/{chunk-SNKTC4BP.js → chunk-3KPWWJCI.js} +1 -1
  9. package/chunks/{chunk-IORC6MQX.js → chunk-5JI7L7KV.js} +1557 -145
  10. package/chunks/{chunk-KKGE5RQE.js → chunk-6L26OBWI.js} +1 -1
  11. package/chunks/{chunk-HT6P7RY3.js → chunk-72CISA2D.js} +1 -1
  12. package/chunks/{chunk-VGRDNSHA.js → chunk-AD7WXDH6.js} +3 -2
  13. package/chunks/{chunk-QOKTUOU2.js → chunk-ADOLI6DT.js} +1 -1
  14. package/chunks/{chunk-HDWV7PGI.js → chunk-AHTBZC3E.js} +2 -2
  15. package/chunks/{chunk-D6S3IIPG.js → chunk-ASUR522M.js} +3 -3
  16. package/chunks/{chunk-CLHCDHP4.js → chunk-ATATQACO.js} +1 -1
  17. package/chunks/{chunk-KTQDLNSR.js → chunk-BATRQBOR.js} +1 -1
  18. package/chunks/{chunk-K26SZ37E.js → chunk-BFR2CDV5.js} +7 -7
  19. package/chunks/{chunk-A6CLR72I.js → chunk-BFRB6HB2.js} +1 -1
  20. package/chunks/{chunk-H44E2CRN.js → chunk-BVAZO4WA.js} +1 -1
  21. package/chunks/{chunk-O462Y7P2.js → chunk-BZNEY2ZS.js} +334 -128
  22. package/chunks/{chunk-DN25OQQA.js → chunk-C2WXWFBB.js} +1 -1
  23. package/chunks/{chunk-QJQKHO7G.js → chunk-CMKXP5RR.js} +1 -1
  24. package/chunks/{chunk-2CJ776PV.js → chunk-GMT2AZKM.js} +23 -14
  25. package/chunks/{chunk-47TQJWDH.js → chunk-JQHOLLTD.js} +3 -3
  26. package/chunks/{chunk-MMLDQR4H.js → chunk-N7BOUYEV.js} +3 -3
  27. package/chunks/{chunk-QKICO43A.js → chunk-SVJEDVYK.js} +1 -1
  28. package/chunks/{chunk-3QFDYBZQ.js → chunk-TSK2AG6J.js} +18 -18
  29. package/chunks/{chunk-UJ4IK5PO.js → chunk-U5FLXGHT.js} +1 -1
  30. package/chunks/{chunk-SOG2U7B3.js → chunk-UCYRA73C.js} +1 -1
  31. package/chunks/{chunk-2SANI5RH.js → chunk-UR4ELX2Y.js} +61 -5
  32. package/chunks/{chunk-UM3ZNQIM.js → chunk-WEBMRWEG.js} +17 -9
  33. package/chunks/{chunk-RDZYQQLW.js → chunk-WXQ6BJ6A.js} +1 -1
  34. package/chunks/{chunk-4Y4KQJXE.js → chunk-XM5NLHYU.js} +6 -6
  35. package/chunks/{chunk-LOHTE223.js → chunk-YYRBQVFE.js} +1 -1
  36. package/chunks/{chunk-WKNNZVJS.js → chunk-Z5FA2XOX.js} +1 -1
  37. package/chunks/{commands-U3AMV5ZU.js → commands-TBC2F5CE.js} +635 -431
  38. package/chunks/{cost-ledger-ZCKMBJEN.js → cost-ledger-NU63MYZM.js} +2 -2
  39. package/chunks/{db-26NGQFKO.js → db-KFWOAUUB.js} +3 -3
  40. package/chunks/{disclose-A6AEIEDA.js → disclose-EKTWSCGW.js} +2 -2
  41. package/chunks/{dist-GL66KMUX.js → dist-4MAW5X6L.js} +2 -2
  42. package/chunks/{dist-FDKALV4R.js → dist-4YICS2J2.js} +29 -25
  43. package/chunks/{dist-JR67XKYO.js → dist-FMGSR3DW.js} +1 -1
  44. package/chunks/{eval-runner-DDLE5RQ3.js → eval-runner-7ZF472KV.js} +8 -8
  45. package/chunks/{exploit-agent-XP23ISN7.js → exploit-agent-45YQOHPJ.js} +1 -1
  46. package/chunks/{exploit-autoclimb-E6T7RRSC.js → exploit-autoclimb-UZGEMGYT.js} +1 -1
  47. package/chunks/{exploit-climb-2FAUP6XU.js → exploit-climb-SG23KB2G.js} +2 -2
  48. package/chunks/{harness-HWOYFKFY.js → harness-7ODOLOWU.js} +3 -3
  49. package/chunks/{hunt-scan-XPELSPQQ.js → hunt-scan-MMKUOETU.js} +11 -11
  50. package/chunks/{kernel-primitive-TENE3R7T.js → kernel-primitive-7U6CWHXD.js} +2 -2
  51. package/chunks/{kernel-vm-runner-4F6QSNFY.js → kernel-vm-runner-3JAU4O6J.js} +2 -2
  52. package/chunks/{native-loop-NTONUDP7.js → native-loop-RJCJPOUS.js} +7 -7
  53. package/chunks/{orchestrate-ZUWAUWBC.js → orchestrate-OC2VZN2X.js} +26 -26
  54. package/chunks/{pipeline-FCARFZU3.js → pipeline-BZK5BLJR.js} +2 -2
  55. package/chunks/{process-3Q7QJIOZ.js → process-LQRCS5OY.js} +3 -3
  56. package/chunks/{replay-runner-RRR4E2A7.js → replay-runner-45G3VU7X.js} +2 -2
  57. package/chunks/{run-ESNN4V5W.js → run-D56MPDKY.js} +324 -240
  58. package/chunks/{runtime-62ZQAH7H.js → runtime-G7YWIO3B.js} +5 -5
  59. package/chunks/{session-store-BCFQYDCE.js → session-store-GZ4A4KYT.js} +2 -2
  60. package/chunks/{variant-candidates-6KM6F6MD.js → variant-candidates-YERCYMPD.js} +3 -3
  61. package/chunks/{web-recon-prepass-DPVCBRZA.js → web-recon-prepass-JJGPEOLE.js} +3 -3
  62. package/package.json +1 -1
@@ -6,7 +6,7 @@ import {
6
6
  } from "./chunk-KLTNTE2Z.js";
7
7
  import {
8
8
  VERSION
9
- } from "./chunk-KKGE5RQE.js";
9
+ } from "./chunk-6L26OBWI.js";
10
10
 
11
11
  // packages/core/dist/verify/replay-runner.js
12
12
  import { spawn } from "node:child_process";
@@ -3,7 +3,7 @@ import { createRequire as __0secCreateRequire } from "node:module";
3
3
  const require = __0secCreateRequire(import.meta.url);
4
4
  import {
5
5
  jitterFor
6
- } from "./chunk-LOHTE223.js";
6
+ } from "./chunk-YYRBQVFE.js";
7
7
 
8
8
  // packages/core/dist/scope/rate-limit.js
9
9
  var TokenBucket = class {
@@ -4,13 +4,14 @@ const require = __0secCreateRequire(import.meta.url);
4
4
  import {
5
5
  ANALYTICS_LEVEL_ENV,
6
6
  analyticsPipeline,
7
+ levelAtLeast,
7
8
  resolveAnalyticsLevel
8
- } from "./chunk-O462Y7P2.js";
9
+ } from "./chunk-BZNEY2ZS.js";
9
10
  import {
10
11
  DEFAULT_ALLOW_MODEL_SELF_EXTENSION,
11
12
  createPresentationEvent,
12
13
  homeStateDir
13
- } from "./chunk-KKGE5RQE.js";
14
+ } from "./chunk-6L26OBWI.js";
14
15
 
15
16
  // packages/cli/src/tui/settings-store.ts
16
17
  import { useSyncExternalStore } from "react";
@@ -1010,7 +1011,7 @@ var THEMES = {
1010
1011
  swiss: {
1011
1012
  name: "swiss",
1012
1013
  label: "Swiss",
1013
- description: "Swiss-flag red on near-black, crisp white text. For the Swiss Applied AI Cybersecurity Research Lab.",
1014
+ description: "Swiss-flag red on near-black, crisp white text. For the Swiss Applied AI & Cybersecurity Research Lab.",
1014
1015
  mode: "dark",
1015
1016
  palette: SWISS
1016
1017
  },
@@ -1676,10 +1677,10 @@ var DEFS = [
1676
1677
  },
1677
1678
  {
1678
1679
  key: "analyticsLevel",
1679
- label: "Research analytics",
1680
- description: "How much anonymous data you share to advance open AI-cybersecurity research. Off shares nothing. Usage shares how features are used and the category of errors (no commands, code, targets or findings) \u2014 all that is transmitted today. Commands additionally authorizes anonymized commands and code; Full additionally authorizes targets and findings for open research. The richer tiers are a consent grant for future, privacy-reviewed collection, not extra data on the wire yet. Applies to this computer, not this project.",
1680
+ label: "Analytics and training data",
1681
+ description: "Full is the new-install default. Usage shares feature counters and error categories, not tool content. Commands adds tool arguments/results and submitted code for model training and security research; Full also adds scope and findings. Recognized credentials are scrubbed; emails, URLs, identifiers and other content are retained. Sending uses authenticated Cloud storage and is not anonymous. Each tool/code content field is limited to 256 KiB after credential scrubbing; oversized records are reported locally, not silently truncated. Explicit 0SEC_ANALYTICS_LEVEL and offline/no-telemetry/DO_NOT_TRACK restrictions win over broader settings. Problem reports are separate. Applies to this computer, not this project.",
1681
1682
  kind: "enum",
1682
- default: "off",
1683
+ default: "full",
1683
1684
  choices: ["off", "usage", "commands", "full"],
1684
1685
  group: "Privacy"
1685
1686
  },
@@ -1770,7 +1771,7 @@ var DEFAULT_SETTINGS = {
1770
1771
  elapsedTimer: "left",
1771
1772
  logoAnimation: "glitch",
1772
1773
  reduceMotion: false,
1773
- analyticsLevel: "off",
1774
+ analyticsLevel: "full",
1774
1775
  diagnosticReporting: "automatic",
1775
1776
  diagnosticReportingPrompted: false,
1776
1777
  updatePolicy: "automatic",
@@ -1983,6 +1984,7 @@ var homeDir;
1983
1984
  var projectDir;
1984
1985
  var subscribers = /* @__PURE__ */ new Set();
1985
1986
  function notify(settings) {
1987
+ bridgeAnalyticsLevel(settings);
1986
1988
  for (const fn of [...subscribers]) {
1987
1989
  try {
1988
1990
  fn(settings);
@@ -1994,7 +1996,10 @@ function loadLayered() {
1994
1996
  return globalDraft === null && projectDraft === null ? loadLayeredSettings({ homeDir, projectDir }) : resolveLayeredSettings(globalDraft ?? loadGlobalSettings(homeDir), projectDraft ?? readProjectOverrides(projectDir));
1995
1997
  }
1996
1998
  function getSettings() {
1997
- if (cached === null) cached = loadLayered();
1999
+ if (cached === null) {
2000
+ cached = loadLayered();
2001
+ bridgeAnalyticsLevel(cached.settings);
2002
+ }
1998
2003
  return cached.settings;
1999
2004
  }
2000
2005
  function setSettings(next) {
@@ -2055,17 +2060,21 @@ function subscribeSettings(fn) {
2055
2060
  subscribers.delete(fn);
2056
2061
  };
2057
2062
  }
2058
- var lastBridgedLevel;
2063
+ var bridgedAnalyticsEnv;
2059
2064
  function bridgeAnalyticsLevel(settings) {
2060
2065
  try {
2061
- if (settings.analyticsLevel === lastBridgedLevel) return;
2062
- lastBridgedLevel = settings.analyticsLevel;
2063
- process.env[ANALYTICS_LEVEL_ENV] = settings.analyticsLevel;
2064
- analyticsPipeline.setLevel(resolveAnalyticsLevel());
2066
+ const current = process.env[ANALYTICS_LEVEL_ENV];
2067
+ if (current === void 0 || current === bridgedAnalyticsEnv) {
2068
+ process.env[ANALYTICS_LEVEL_ENV] = settings.analyticsLevel;
2069
+ bridgedAnalyticsEnv = settings.analyticsLevel;
2070
+ } else {
2071
+ bridgedAnalyticsEnv = void 0;
2072
+ }
2073
+ const environmentLevel = resolveAnalyticsLevel();
2074
+ analyticsPipeline.setLevel(levelAtLeast(environmentLevel, settings.analyticsLevel) ? settings.analyticsLevel : environmentLevel);
2065
2075
  } catch {
2066
2076
  }
2067
2077
  }
2068
- subscribeSettings(bridgeAnalyticsLevel);
2069
2078
  function reloadSettings() {
2070
2079
  globalDraft = null;
2071
2080
  projectDraft = null;
@@ -3,15 +3,15 @@ import { createRequire as __0secCreateRequire } from "node:module";
3
3
  const require = __0secCreateRequire(import.meta.url);
4
4
  import {
5
5
  runReproducerInKernelVm
6
- } from "./chunk-SNKTC4BP.js";
6
+ } from "./chunk-3KPWWJCI.js";
7
7
  import {
8
8
  makeSkepticVerifier,
9
9
  runHuntScan,
10
10
  scoreGeometry
11
- } from "./chunk-K26SZ37E.js";
11
+ } from "./chunk-BFR2CDV5.js";
12
12
  import {
13
13
  LlmApiRuntime
14
- } from "./chunk-2SANI5RH.js";
14
+ } from "./chunk-UR4ELX2Y.js";
15
15
  import {
16
16
  __commonJS,
17
17
  __require,
@@ -3,10 +3,10 @@ import { createRequire as __0secCreateRequire } from "node:module";
3
3
  const require = __0secCreateRequire(import.meta.url);
4
4
  import {
5
5
  LlmApiRuntime
6
- } from "./chunk-2SANI5RH.js";
6
+ } from "./chunk-UR4ELX2Y.js";
7
7
  import {
8
8
  ProcessRuntime
9
- } from "./chunk-CLHCDHP4.js";
9
+ } from "./chunk-ATATQACO.js";
10
10
 
11
11
  // packages/core/dist/runtime/cli-native.js
12
12
  import { spawn } from "node:child_process";
@@ -806,7 +806,7 @@ function pickRuntimeForStage(stage, availableRuntimes) {
806
806
  return first.done ? "claude" : first.value;
807
807
  }
808
808
  async function detectAvailableRuntimes() {
809
- const { ProcessRuntime: ProcessRuntime2 } = await import("./process-3Q7QJIOZ.js");
809
+ const { ProcessRuntime: ProcessRuntime2 } = await import("./process-LQRCS5OY.js");
810
810
  const available = /* @__PURE__ */ new Set();
811
811
  const checks = RUNTIME_REGISTRY.map(async (info) => {
812
812
  const rt = new ProcessRuntime2({ type: info.type, timeout: 5e3 });
@@ -3,7 +3,7 @@ import { createRequire as __0secCreateRequire } from "node:module";
3
3
  const require = __0secCreateRequire(import.meta.url);
4
4
  import {
5
5
  homeStateDir
6
- } from "./chunk-KKGE5RQE.js";
6
+ } from "./chunk-6L26OBWI.js";
7
7
 
8
8
  // packages/core/dist/cve/artifact-scraper.js
9
9
  import { createHash } from "node:crypto";
@@ -5,12 +5,12 @@ import {
5
5
  isValidSessionId,
6
6
  listSessions,
7
7
  loadSession
8
- } from "./chunk-H44E2CRN.js";
8
+ } from "./chunk-BVAZO4WA.js";
9
9
  import {
10
10
  consolePresentationOutput,
11
11
  getSettings,
12
12
  maybeLoadCodexAuth
13
- } from "./chunk-2CJ776PV.js";
13
+ } from "./chunk-GMT2AZKM.js";
14
14
  import {
15
15
  captureObservation,
16
16
  createConsoleSession,
@@ -22,34 +22,34 @@ import {
22
22
  makeFinderLensProbe,
23
23
  retireArchetype,
24
24
  runLensSynthesisLoop
25
- } from "./chunk-IORC6MQX.js";
25
+ } from "./chunk-5JI7L7KV.js";
26
26
  import {
27
27
  source_default
28
28
  } from "./chunk-SF4KZ4O3.js";
29
29
  import {
30
30
  stampDeploymentContext
31
- } from "./chunk-K26SZ37E.js";
31
+ } from "./chunk-BFR2CDV5.js";
32
32
  import {
33
33
  harvestMissesFromLedgerEntry,
34
34
  loadEvolutionConfigFile,
35
35
  mergeHarvestedMisses
36
- } from "./chunk-O462Y7P2.js";
36
+ } from "./chunk-BZNEY2ZS.js";
37
37
  import {
38
38
  listOsecRunDatabasePaths,
39
39
  osecDB,
40
40
  resolveOsecDbPath,
41
41
  resolveOsecRunStorage,
42
42
  writeOsecRunReport
43
- } from "./chunk-HT6P7RY3.js";
43
+ } from "./chunk-72CISA2D.js";
44
44
  import {
45
45
  loadAppsecFinderLenses
46
46
  } from "./chunk-QI233I24.js";
47
47
  import {
48
48
  ScanCostLedger
49
- } from "./chunk-SZJCPG2I.js";
49
+ } from "./chunk-242TMK6G.js";
50
50
  import {
51
51
  redactSensitiveHeaders
52
- } from "./chunk-UM3ZNQIM.js";
52
+ } from "./chunk-WEBMRWEG.js";
53
53
  import {
54
54
  CloudAuthMissingError,
55
55
  CloudClient,
@@ -59,10 +59,10 @@ import {
59
59
  CloudUnauthorizedError,
60
60
  DEFAULT_CLOUD_HOST,
61
61
  loadCloudCredentials
62
- } from "./chunk-2SANI5RH.js";
62
+ } from "./chunk-UR4ELX2Y.js";
63
63
  import {
64
64
  eventBus
65
- } from "./chunk-QOKTUOU2.js";
65
+ } from "./chunk-ADOLI6DT.js";
66
66
  import {
67
67
  SEVERITY_RANK,
68
68
  VERSION,
@@ -73,12 +73,12 @@ import {
73
73
  formatZodError,
74
74
  homeStateDir,
75
75
  severityRank
76
- } from "./chunk-KKGE5RQE.js";
76
+ } from "./chunk-6L26OBWI.js";
77
77
 
78
78
  // packages/cli/src/utils.ts
79
79
  import { gzipSync } from "zlib";
80
80
  async function getRuntimeAvailability() {
81
- const { detectAvailableRuntimes, LlmApiRuntime } = await import("./dist-FDKALV4R.js");
81
+ const { detectAvailableRuntimes, LlmApiRuntime } = await import("./dist-4YICS2J2.js");
82
82
  const apiRuntimeDiagnostics = new LlmApiRuntime({ type: "api", timeout: 5e3 }).getConfigurationDiagnostics();
83
83
  const hasApiKey = apiRuntimeDiagnostics.valid;
84
84
  const availableRuntimes = [...await detectAvailableRuntimes()];
@@ -187,7 +187,7 @@ async function runHunt(opts) {
187
187
  prepare,
188
188
  getCloudSinkConfig,
189
189
  postFinding
190
- } = await import("./dist-FDKALV4R.js");
190
+ } = await import("./dist-4YICS2J2.js");
191
191
  const log = opts.log ?? (() => {
192
192
  });
193
193
  const runtime = opts.runtime ?? "api";
@@ -790,7 +790,7 @@ async function runDeepReview(opts) {
790
790
  cairoVerifyLenses,
791
791
  moveFinderLenses,
792
792
  moveVerifyLenses
793
- } = await import("./dist-FDKALV4R.js");
793
+ } = await import("./dist-4YICS2J2.js");
794
794
  const costLedger = new ScanCostLedger();
795
795
  const scanStartedAt = Date.now();
796
796
  const log = opts.log ?? (() => {
@@ -839,7 +839,7 @@ async function runDeepReview(opts) {
839
839
  let lanes = null;
840
840
  let allocateAcrossLanes;
841
841
  if (opts.useThreatModel) {
842
- const threatModule = await import("./dist-FDKALV4R.js");
842
+ const threatModule = await import("./dist-4YICS2J2.js");
843
843
  allocateAcrossLanes = threatModule.allocateCandidatesAcrossLanes;
844
844
  const rtType = runtime !== "auto" ? runtime : "api";
845
845
  const plannerRuntime = threatModule.createRuntime({
@@ -3620,7 +3620,7 @@ async function loadCoreModule() {
3620
3620
  if (!coreModulePromise) {
3621
3621
  const srcUrl = new URL("../../../core/src/index.ts", import.meta.url);
3622
3622
  const srcExists = process.versions.bun && existsSync3(fileURLToPath(srcUrl));
3623
- coreModulePromise = srcExists ? import(srcUrl.href) : import("./dist-FDKALV4R.js");
3623
+ coreModulePromise = srcExists ? import(srcUrl.href) : import("./dist-4YICS2J2.js");
3624
3624
  }
3625
3625
  return coreModulePromise;
3626
3626
  }
@@ -3804,7 +3804,7 @@ async function runUnified(opts) {
3804
3804
  console.error(source_default.red("--branch-from requires --resume <run-id>"));
3805
3805
  process.exit(2);
3806
3806
  }
3807
- const { branchJournal } = await import("./dist-FDKALV4R.js");
3807
+ const { branchJournal } = await import("./dist-4YICS2J2.js");
3808
3808
  const result = branchJournal({
3809
3809
  runId: effectiveResumeScanId,
3810
3810
  fromEntry: opts.branchFromEntry
@@ -3861,7 +3861,7 @@ async function runUnified(opts) {
3861
3861
  } else {
3862
3862
  const { isBunRuntime } = await import("./runtime-J7PLXZNM.js");
3863
3863
  if (isBunRuntime()) {
3864
- const { createOpenTuiSession } = await import("./run-ESNN4V5W.js");
3864
+ const { createOpenTuiSession } = await import("./run-D56MPDKY.js");
3865
3865
  const availability = await getRuntimeAvailability();
3866
3866
  inkUI = await createOpenTuiSession({
3867
3867
  target,
@@ -7,7 +7,7 @@ import {
7
7
  extractFileRefs,
8
8
  redactSensitiveHeaders,
9
9
  require_dist
10
- } from "./chunk-UM3ZNQIM.js";
10
+ } from "./chunk-WEBMRWEG.js";
11
11
  import {
12
12
  __toESM
13
13
  } from "./chunk-IR537GON.js";
@@ -3,7 +3,7 @@ import { createRequire as __0secCreateRequire } from "node:module";
3
3
  const require = __0secCreateRequire(import.meta.url);
4
4
  import {
5
5
  homeStateDir
6
- } from "./chunk-KKGE5RQE.js";
6
+ } from "./chunk-6L26OBWI.js";
7
7
 
8
8
  // packages/core/dist/agent/journal/types.js
9
9
  var JOURNAL_SCHEMA_VERSION = 1;
@@ -4,7 +4,7 @@ const require = __0secCreateRequire(import.meta.url);
4
4
  import {
5
5
  VERSION,
6
6
  homeStateDir
7
- } from "./chunk-KKGE5RQE.js";
7
+ } from "./chunk-6L26OBWI.js";
8
8
 
9
9
  // packages/core/dist/agent/feature-presets.js
10
10
  var FP_MOAT_FLAGS = [
@@ -1247,6 +1247,36 @@ var CloudClient = class {
1247
1247
  async getInferenceUsage() {
1248
1248
  return this.getJson("/api/inference/usage");
1249
1249
  }
1250
+ /**
1251
+ * Generic JSON POST helper with the same error mapping as getJson.
1252
+ * Used by `0sec connect` to enqueue scans and schedules.
1253
+ */
1254
+ async postJson(path, body) {
1255
+ const url = `${this.host}${path}`;
1256
+ let res;
1257
+ try {
1258
+ res = await this.fetchImpl(url, {
1259
+ method: "POST",
1260
+ headers: { ...this.headers(), "Content-Type": "application/json" },
1261
+ body: JSON.stringify(body)
1262
+ });
1263
+ } catch (err) {
1264
+ const msg = err instanceof Error ? err.message : String(err);
1265
+ throw new CloudNetworkError(this.scrub(msg), path);
1266
+ }
1267
+ if (!res.ok) {
1268
+ let code;
1269
+ try {
1270
+ const parsed = await res.json();
1271
+ const raw = typeof parsed?.error === "object" ? parsed.error?.code : void 0;
1272
+ if (typeof raw === "string" && raw.length > 0)
1273
+ code = raw;
1274
+ } catch {
1275
+ }
1276
+ this.throwForStatus(res.status, path, code);
1277
+ }
1278
+ return await res.json();
1279
+ }
1250
1280
  /**
1251
1281
  * Generic JSON GET helper. Public so future modules (scans, findings)
1252
1282
  * can reuse the same error mapping without duplicating it. Not exported
@@ -1683,6 +1713,13 @@ function llmStreamIdleTimeoutMs() {
1683
1713
  const n = Number.parseInt(raw, 10);
1684
1714
  return Number.isFinite(n) && n > 0 ? n : 12e4;
1685
1715
  }
1716
+ function llmStreamEventIdleTimeoutMs() {
1717
+ const raw = process.env["0SEC_LLM_STREAM_EVENT_IDLE_TIMEOUT_MS"];
1718
+ if (raw == null || raw.trim() === "")
1719
+ return 24e4;
1720
+ const n = Number.parseInt(raw, 10);
1721
+ return Number.isFinite(n) && n > 0 ? n : 24e4;
1722
+ }
1686
1723
  function parseRetryAfterMs(headerValue) {
1687
1724
  if (!headerValue)
1688
1725
  return void 0;
@@ -4095,6 +4132,7 @@ Missing: ${missing.join("; ")}
4095
4132
  }
4096
4133
  const streamed = await this.consumeResponsesStream(res, start, callbacks, {
4097
4134
  idleTimeoutMs: llmStreamIdleTimeoutMs(),
4135
+ eventIdleTimeoutMs: llmStreamEventIdleTimeoutMs(),
4098
4136
  abort: call
4099
4137
  });
4100
4138
  clearTimeout(timer);
@@ -4416,10 +4454,14 @@ Missing: ${missing.join("; ")}
4416
4454
  };
4417
4455
  }
4418
4456
  const idleTimeoutMs = opts?.idleTimeoutMs ?? llmStreamIdleTimeoutMs();
4457
+ const eventIdleTimeoutMs = opts?.eventIdleTimeoutMs ?? llmStreamEventIdleTimeoutMs();
4458
+ let lastEventAt = Date.now();
4419
4459
  const operatorSignal = opts?.abort?.operator;
4420
4460
  let stalled = false;
4461
+ let stallIdleMs = idleTimeoutMs;
4421
4462
  const readBounded = async () => {
4422
4463
  let timer;
4464
+ let eventTimer;
4423
4465
  const detach = operatorSignal ? new AbortController() : void 0;
4424
4466
  try {
4425
4467
  return await Promise.race([
@@ -4427,9 +4469,22 @@ Missing: ${missing.join("; ")}
4427
4469
  new Promise((_resolve, reject) => {
4428
4470
  timer = setTimeout(() => {
4429
4471
  stalled = true;
4472
+ stallIdleMs = idleTimeoutMs;
4430
4473
  reject(new Error("stream stalled"));
4431
4474
  }, idleTimeoutMs);
4432
4475
  }),
4476
+ // Event-level racer: fires when no MEANINGFUL SSE event has arrived
4477
+ // for `eventIdleTimeoutMs`, even if keep-alive bytes keep resetting
4478
+ // the byte-level timer above. Recomputed per read, so an event that
4479
+ // landed while the previous chunk was being parsed re-arms it.
4480
+ new Promise((_resolve, reject) => {
4481
+ const remainingMs = eventIdleTimeoutMs - (Date.now() - lastEventAt);
4482
+ eventTimer = setTimeout(() => {
4483
+ stalled = true;
4484
+ stallIdleMs = eventIdleTimeoutMs;
4485
+ reject(new Error("stream stalled"));
4486
+ }, Math.max(remainingMs, 0));
4487
+ }),
4433
4488
  // A real aborted `fetch` also errors the body stream, so `read()`
4434
4489
  // would reject on its own — but only for a live socket. This racer
4435
4490
  // is what makes cancellation immediate and unconditional, including
@@ -4445,8 +4500,8 @@ Missing: ${missing.join("; ")}
4445
4500
  ] : []
4446
4501
  ]);
4447
4502
  } finally {
4448
- if (timer)
4449
- clearTimeout(timer);
4503
+ clearTimeout(timer);
4504
+ clearTimeout(eventTimer);
4450
4505
  detach?.abort();
4451
4506
  }
4452
4507
  };
@@ -4494,10 +4549,10 @@ Missing: ${missing.join("; ")}
4494
4549
  await reader.cancel();
4495
4550
  } catch {
4496
4551
  }
4497
- const secs = Math.round(idleTimeoutMs / 1e3);
4552
+ const secs = Math.round(stallIdleMs / 1e3);
4498
4553
  diag.warn("stream_stalled", `${this.providerLabel} stream stalled \u2014 no SSE events for ${secs}s (server hold; aborting call)`, {
4499
4554
  provider: this.providerLabel,
4500
- idle_timeout_ms: idleTimeoutMs,
4555
+ idle_timeout_ms: stallIdleMs,
4501
4556
  idle_timeout_s: secs
4502
4557
  });
4503
4558
  return {
@@ -4521,6 +4576,7 @@ Missing: ${missing.join("; ")}
4521
4576
  const payload = rawChunk.split("\n").filter((line) => line.startsWith("data:")).map((line) => line.slice(5).trim()).join("\n");
4522
4577
  if (!payload || payload === "[DONE]")
4523
4578
  continue;
4579
+ lastEventAt = Date.now();
4524
4580
  let event;
4525
4581
  try {
4526
4582
  event = JSON.parse(payload);
@@ -8690,17 +8690,31 @@ var EmptyPocError = class extends Error {
8690
8690
  };
8691
8691
  var SENSITIVE_HEADER_NAMES = /* @__PURE__ */ new Set([
8692
8692
  "authorization",
8693
+ "proxy-authorization",
8693
8694
  "cookie",
8694
8695
  "set-cookie",
8695
8696
  "x-auth-token",
8696
8697
  "x-api-key",
8697
- "x-csrf-token"
8698
+ "x-csrf-token",
8699
+ "x-xsrf-token"
8698
8700
  ]);
8699
8701
  var AWS_KEY_RE = /\bAKIA[0-9A-Z]{16}\b/g;
8700
8702
  var JWT_RE = /\b[A-Za-z0-9_-]+\.[A-Za-z0-9_-]+\.[A-Za-z0-9_-]+={0,2}\b/g;
8701
8703
  var INLINE_BEARER_RE = /\b(Bearer)\s+([^\s"'`]+)/gi;
8702
8704
  var INLINE_CURL_HEADER_RE = /(-H|--header)(\s+|=)(["']?)([A-Za-z][A-Za-z0-9-]*)\s*:\s*([^"'\n]*)\3/gi;
8703
8705
  function redactSensitiveHeaders(text) {
8706
+ if (!text)
8707
+ return text;
8708
+ let out = redactAuthHeaders(text);
8709
+ out = out.replace(AWS_KEY_RE, "<REDACTED-AWS-KEY>");
8710
+ out = out.replace(JWT_RE, (match) => {
8711
+ if (match.length < 80)
8712
+ return match;
8713
+ return "<REDACTED-JWT>";
8714
+ });
8715
+ return out;
8716
+ }
8717
+ function redactAuthHeaders(text) {
8704
8718
  if (!text)
8705
8719
  return text;
8706
8720
  const lines = text.split("\n");
@@ -8717,14 +8731,7 @@ function redactSensitiveHeaders(text) {
8717
8731
  return match;
8718
8732
  return `${flag}${sep}${quote}${name}: <REDACTED-${name}>${quote}`;
8719
8733
  });
8720
- out = out.replace(INLINE_BEARER_RE, "$1 <REDACTED-Bearer>");
8721
- out = out.replace(AWS_KEY_RE, "<REDACTED-AWS-KEY>");
8722
- out = out.replace(JWT_RE, (match) => {
8723
- if (match.length < 80)
8724
- return match;
8725
- return "<REDACTED-JWT>";
8726
- });
8727
- return out;
8734
+ return out.replace(INLINE_BEARER_RE, "$1 <REDACTED-Bearer>");
8728
8735
  }
8729
8736
  function reachabilityLabel(tier) {
8730
8737
  switch (tier) {
@@ -9322,6 +9329,7 @@ export {
9322
9329
  formatVersionRangeLine,
9323
9330
  EmptyPocError,
9324
9331
  redactSensitiveHeaders,
9332
+ redactAuthHeaders,
9325
9333
  renderAdvisoryMarkdown,
9326
9334
  REPORT_PLATFORMS,
9327
9335
  reportTemplate,
@@ -8,7 +8,7 @@ import {
8
8
  osecDB,
9
9
  repairOsecDatabase,
10
10
  resetOsecDatabase
11
- } from "./chunk-HT6P7RY3.js";
11
+ } from "./chunk-72CISA2D.js";
12
12
 
13
13
  // packages/cli/src/commands/db.ts
14
14
  import { randomUUID } from "node:crypto";
@@ -3,25 +3,25 @@ import { createRequire as __0secCreateRequire } from "node:module";
3
3
  const require = __0secCreateRequire(import.meta.url);
4
4
  import {
5
5
  agenticScan
6
- } from "./chunk-IORC6MQX.js";
6
+ } from "./chunk-5JI7L7KV.js";
7
7
  import {
8
8
  source_default
9
9
  } from "./chunk-SF4KZ4O3.js";
10
10
  import {
11
11
  runAgentLoop
12
- } from "./chunk-K26SZ37E.js";
12
+ } from "./chunk-BFR2CDV5.js";
13
13
  import {
14
14
  getToolsForRole
15
- } from "./chunk-O462Y7P2.js";
15
+ } from "./chunk-BZNEY2ZS.js";
16
16
  import {
17
17
  osecDB
18
- } from "./chunk-HT6P7RY3.js";
18
+ } from "./chunk-72CISA2D.js";
19
19
  import {
20
20
  createRuntime
21
- } from "./chunk-MMLDQR4H.js";
21
+ } from "./chunk-N7BOUYEV.js";
22
22
  import {
23
23
  LlmApiRuntime
24
- } from "./chunk-2SANI5RH.js";
24
+ } from "./chunk-UR4ELX2Y.js";
25
25
 
26
26
  // packages/cli/src/commands/orchestrate.ts
27
27
  import { randomUUID } from "node:crypto";
@@ -3,7 +3,7 @@ import { createRequire as __0secCreateRequire } from "node:module";
3
3
  const require = __0secCreateRequire(import.meta.url);
4
4
  import {
5
5
  homeStateDir
6
- } from "./chunk-KKGE5RQE.js";
6
+ } from "./chunk-6L26OBWI.js";
7
7
 
8
8
  // packages/core/dist/scope/waf-detect.js
9
9
  function readHeader(headers, name) {
@@ -6,7 +6,7 @@ import {
6
6
  } from "./chunk-RRMJC3ZE.js";
7
7
  import {
8
8
  estimateCost
9
- } from "./chunk-KKGE5RQE.js";
9
+ } from "./chunk-6L26OBWI.js";
10
10
 
11
11
  // packages/core/dist/file-review/pipeline.js
12
12
  import path5 from "node:path";