0sec-cli 0.22.4 → 0.23.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/0.js +47 -41
- package/README.md +68 -60
- package/chunks/{adapt-loop-3CCOWE43.js → adapt-loop-V3JFWOKC.js} +4 -4
- package/chunks/{artifact-scraper-Z4UUIOH3.js → artifact-scraper-NYKUF2M5.js} +2 -2
- package/chunks/{assumption-mining-2UAKQB6V.js → assumption-mining-ZX3YVWEH.js} +17 -17
- package/chunks/backend-connections-H52NIVH2.js +23 -0
- package/chunks/{chunk-YED25PA4.js → chunk-3E54JYS4.js} +1 -1
- package/chunks/{chunk-FFHRANYC.js → chunk-3P3XXSIJ.js} +4 -88
- package/chunks/{chunk-5WAJGLCW.js → chunk-3ZNI7F42.js} +3 -3
- package/chunks/{chunk-OAS5SAVZ.js → chunk-4HGGNBKK.js} +703 -190
- package/chunks/{chunk-TM74SSHC.js → chunk-62ENS6XO.js} +1 -1
- package/chunks/{chunk-CPCHLL6A.js → chunk-65H3MRBF.js} +1 -1
- package/chunks/{chunk-6YZE552K.js → chunk-A2ADXAC5.js} +131 -405
- package/chunks/{chunk-4ZYYX5GY.js → chunk-A5QO7N3S.js} +1 -1
- package/chunks/{chunk-CF3MNS3O.js → chunk-AAA4PRWK.js} +2 -2
- package/chunks/{chunk-QVIRWJ45.js → chunk-BF5FIK7H.js} +3 -3
- package/chunks/{chunk-YAZARMJY.js → chunk-CP6HANBE.js} +2 -2
- package/chunks/{chunk-H6Q2QAIY.js → chunk-EH2WTNY7.js} +35 -35
- package/chunks/{chunk-ELI3BVIK.js → chunk-EJH2TNVH.js} +3 -3
- package/chunks/chunk-EWXOG6D3.js +1695 -0
- package/chunks/{chunk-RCRTSKQN.js → chunk-F344NYUN.js} +1 -1
- package/chunks/chunk-FXR3BT2G.js +226 -0
- package/chunks/{chunk-XODDLNBI.js → chunk-HFDSIHTE.js} +92 -13
- package/chunks/{chunk-BGX53365.js → chunk-I3OCJ2OA.js} +1 -1
- package/chunks/{chunk-C6JPA32H.js → chunk-ITES7BCY.js} +1 -1
- package/chunks/{chunk-SCWWLABR.js → chunk-JEYIWMGL.js} +1 -1
- package/chunks/{chunk-G2BE2FC7.js → chunk-K55B4OH4.js} +1 -1
- package/chunks/{chunk-GQ3DGHWE.js → chunk-KHPOSLCF.js} +2 -2
- package/chunks/chunk-LT7BFGXA.js +733 -0
- package/chunks/{chunk-6KFB6AYN.js → chunk-LTEE2JWK.js} +286 -15
- package/chunks/{chunk-DPUXXMJW.js → chunk-LVGZGG63.js} +1 -1
- package/chunks/{chunk-PS5E7LUQ.js → chunk-MQJVU2GZ.js} +6 -6
- package/chunks/{chunk-2WWAPKAW.js → chunk-NI6QYQSK.js} +3 -3
- package/chunks/{chunk-5JNTMWPK.js → chunk-NX4H6L4M.js} +2 -2
- package/chunks/{chunk-WHUAUFSX.js → chunk-O6Z4XPOM.js} +1 -1
- package/chunks/{chunk-RTBZ36BD.js → chunk-OLSKXTQZ.js} +2 -2
- package/chunks/{chunk-H4DH7COV.js → chunk-P7KDN5PK.js} +25 -15
- package/chunks/chunk-PIR6BNE7.js +83 -0
- package/chunks/{chunk-E3OOBVOK.js → chunk-QMICC5O2.js} +2 -2
- package/chunks/chunk-R35KKJA4.js +90 -0
- package/chunks/{chunk-L2CCO4KE.js → chunk-T7ZEVY5G.js} +26 -1
- package/chunks/{chunk-IXAHQICR.js → chunk-TPUJZ74W.js} +7 -2
- package/chunks/{chunk-WBRGXCU2.js → chunk-UZUELPFW.js} +1 -1
- package/chunks/{chunk-QWK4R3DB.js → chunk-V2BWXPZP.js} +6 -6
- package/chunks/{chunk-3BPX75OR.js → chunk-W5VNCB57.js} +1 -1
- package/chunks/{chunk-E74LXQFY.js → chunk-WIYNYNL2.js} +1 -1
- package/chunks/chunk-WYNZFNMF.js +457 -0
- package/chunks/{chunk-IHPTOTLL.js → chunk-XORZUR2H.js} +1 -1
- package/chunks/{chunk-2OQOQ2FZ.js → chunk-Y4HJRUFE.js} +20 -4
- package/chunks/{chunk-GVY3S5E5.js → chunk-YAEJAZYW.js} +2 -2
- package/chunks/{chunk-6WQDXWQC.js → chunk-YYS2H33A.js} +2 -2
- package/chunks/{codex-models-Z43V3427.js → codex-models-Y457ND6Q.js} +6 -6
- package/chunks/{commands-EUGF4FUZ.js → commands-PBDAOZKA.js} +1842 -2509
- package/chunks/{db-NVAW4WWR.js → db-TPSI552V.js} +3 -3
- package/chunks/deep-review-DKED6EN5.js +81 -0
- package/chunks/{dist-27BNG6WD.js → dist-4LGRIBOC.js} +44 -30
- package/chunks/{dist-7RUOKPRJ.js → dist-7Q5A6TQM.js} +2 -2
- package/chunks/{dist-NG2HT5XU.js → dist-RLPNLRZD.js} +53 -1
- package/chunks/{eval-runner-6Q3H52SP.js → eval-runner-RZKDOQ2G.js} +13 -13
- package/chunks/{exploit-agent-FCCR2HYX.js → exploit-agent-RMFYNG7H.js} +1 -1
- package/chunks/{exploit-autoclimb-X5ZS5FAO.js → exploit-autoclimb-2A2PQI4E.js} +1 -1
- package/chunks/{exploit-climb-3JHGEO36.js → exploit-climb-DEJ232QN.js} +2 -2
- package/chunks/{fix-NSNPU33B.js → fix-JGBW7XUN.js} +6 -6
- package/chunks/{harness-KXQOVIDQ.js → harness-CBOLMUHB.js} +3 -3
- package/chunks/{hunt-scan-ELTKGKC4.js → hunt-scan-MIRMABY4.js} +15 -15
- package/chunks/{kernel-primitive-MT7YZSIG.js → kernel-primitive-NAPDMJC7.js} +2 -2
- package/chunks/{kernel-vm-runner-YFRHYC6G.js → kernel-vm-runner-PR5OSDQ2.js} +2 -2
- package/chunks/managed-operation-YNQQEA5V.js +59 -0
- package/chunks/{memsafety-scan-FCPAXIZE.js → memsafety-scan-RPS446CD.js} +2 -2
- package/chunks/{native-loop-OFJDRHPI.js → native-loop-CGOJMNHV.js} +12 -12
- package/chunks/{orchestrate-DRZ2SVCP.js → orchestrate-5NK34H3W.js} +30 -30
- package/chunks/{prepare-72GWTRVI.js → prepare-YVNENPNL.js} +5 -5
- package/chunks/remote-workflow-runtime-RGQ5ECMN.js +96 -0
- package/chunks/{run-WTJCZZHV.js → run-VH4OIDKF.js} +73 -56
- package/chunks/{runtime-LCJ4XSKE.js → runtime-4TAJFVF7.js} +4 -2
- package/chunks/{runtime-FCKOUB7V.js → runtime-HWL6HG7A.js} +6 -6
- package/chunks/{scan-stream-GT6GKQ3U.js → scan-stream-HJAZJONE.js} +2 -2
- package/chunks/{scope-E5QZUOOH.js → scope-Q5PIX2IS.js} +2 -2
- package/chunks/service-plugins-QYFITODK.js +63 -0
- package/chunks/{session-store-H3Q7KCYG.js → session-store-2FEIZGSV.js} +2 -2
- package/chunks/{variant-candidates-SZKDCOLK.js → variant-candidates-TX5V6XOT.js} +6 -6
- package/chunks/{web-recon-prepass-IO3GXQMW.js → web-recon-prepass-6HOUGF7Q.js} +5 -5
- package/chunks/workflow-runtime-ZEEBJFQG.js +64 -0
- package/dashboard/assets/abnfDiagram-VCTEODGH-BuvumFYR.js +1 -0
- package/dashboard/assets/arc-DZzWDuCG.js +1 -0
- package/dashboard/assets/architecture-7GRP2DOG-DK9bv1Md.js +1 -0
- package/dashboard/assets/architectureDiagram-5GKGNRK7-Bw5el_EL.js +36 -0
- package/dashboard/assets/array-BifhSqXX.js +1 -0
- package/dashboard/assets/blockDiagram-I7D4REHJ-BjVLEApp.js +129 -0
- package/dashboard/assets/c4Diagram-7LVT6UL2-B9nNzx2J.js +38 -0
- package/dashboard/assets/channel-Ck17eKdX.js +1 -0
- package/dashboard/assets/chunk-2Q5K7J3B-C1jixKkw.js +1 -0
- package/dashboard/assets/chunk-4HAMMTFA-y72Q95nW.js +62 -0
- package/dashboard/assets/chunk-5VM5RSS4-ZNzvKenW.js +15 -0
- package/dashboard/assets/chunk-75Z2AOVW-BOhrOGMO.js +2 -0
- package/dashboard/assets/chunk-DU6HZSFF-B0EhAaNb.js +127 -0
- package/dashboard/assets/chunk-F27PBJKO-BR-hiDvM.js +1 -0
- package/dashboard/assets/chunk-FOHPRMQF-DHwB1DNv.js +161 -0
- package/dashboard/assets/chunk-GMAD6QVW-H15vJYXg.js +72 -0
- package/dashboard/assets/chunk-GVQU2GXP-BRndps0o.js +1 -0
- package/dashboard/assets/chunk-IMKFNOWR-CIzC_OWx.js +231 -0
- package/dashboard/assets/chunk-JWPE2WC7-DVXcaiue.js +1 -0
- package/dashboard/assets/chunk-L3NEJ4N5-NR4P1Vko.js +1 -0
- package/dashboard/assets/chunk-OSK3NFVY-DtjTDf8S.js +10 -0
- package/dashboard/assets/chunk-P2QGCYS3-CYT11Qjx.js +1 -0
- package/dashboard/assets/chunk-POPQ4Y6H-Duj2Ygwu.js +1 -0
- package/dashboard/assets/chunk-PWAF6VOD-z4p5Tf_y.js +1 -0
- package/dashboard/assets/chunk-SHT3W25Y-DYeLYLS3.js +168 -0
- package/dashboard/assets/chunk-SVP7TREG-BKowxCVI.js +88 -0
- package/dashboard/assets/chunk-TICWLB2K-GDAwEFlH.js +206 -0
- package/dashboard/assets/chunk-XXDRQBXY-DRD79Mjx.js +1 -0
- package/dashboard/assets/chunk-Y2CYZVJY-DsF7k-Jl.js +1 -0
- package/dashboard/assets/classDiagram-ZZMXUADV-BaeZA6LE.js +1 -0
- package/dashboard/assets/classDiagram-v2-VYDZK3BY-BaeZA6LE.js +1 -0
- package/dashboard/assets/common-vnzd7UOF.js +5 -0
- package/dashboard/assets/cose-bilkent-JH36ORCC-GqCLsRyf.js +1 -0
- package/dashboard/assets/cynefin-OW5HDTMX-CJN9YwWN.js +1 -0
- package/dashboard/assets/cynefinDiagram-5FMLGOSQ-DVJHCYQY.js +62 -0
- package/dashboard/assets/cytoscape.esm-CGd-uY3x.js +321 -0
- package/dashboard/assets/dagre-GXQ25YYZ-BMCrrJJR.js +4 -0
- package/dashboard/assets/dagre-PrKaheQc.js +1 -0
- package/dashboard/assets/defaultLocale-BFoDCU3G.js +1 -0
- package/dashboard/assets/diagram-S7CK7UJ4-CLYDdOEm.js +30 -0
- package/dashboard/assets/diagram-UQ7AKVKN-CnPuAZK7.js +41 -0
- package/dashboard/assets/diagram-VSXAHHWV-Cr2I2DnG.js +3 -0
- package/dashboard/assets/diagram-VX7I27RA-_mGW1wpp.js +24 -0
- package/dashboard/assets/diagram-Z3DM3KII-igybB0l9.js +24 -0
- package/dashboard/assets/dist-Bb7_-x5y.js +1 -0
- package/dashboard/assets/ebnfDiagram-PWID7BFC-CVCICf2R.js +1 -0
- package/dashboard/assets/erDiagram-RLTQ6QDP-CRjnfgxj.js +99 -0
- package/dashboard/assets/eventmodeling-NTZA5JFV-po5oDydv.js +1 -0
- package/dashboard/assets/flowDiagram-HODETNUW-TSV9s7q4.js +1 -0
- package/dashboard/assets/ganttDiagram-EL5Y4UJY-DppD7sD7.js +292 -0
- package/dashboard/assets/gitGraph-4MIJSDKK-Tw0vNnQc.js +1 -0
- package/dashboard/assets/gitGraphDiagram-WWUBYQGX-Cpf96-z3.js +106 -0
- package/dashboard/assets/graphlib-DS17s2tU.js +1 -0
- package/dashboard/assets/info-A6RAGUB7-DLyt9arx.js +1 -0
- package/dashboard/assets/infoDiagram-27XIBGKW-B6_piSNS.js +2 -0
- package/dashboard/assets/init-C-OQMol4.js +1 -0
- package/dashboard/assets/ishikawaDiagram-5VMMS53U-DvMO0B0X.js +70 -0
- package/dashboard/assets/journeyDiagram-3NMN7TZE-f7ZK98b6.js +139 -0
- package/dashboard/assets/kanban-definition-UXKFOSKX-Dso0nAxL.js +89 -0
- package/dashboard/assets/katex-CXMH3UgJ.js +257 -0
- package/dashboard/assets/line-VcKaFG0G.js +1 -0
- package/dashboard/assets/linear-D7YnpiWh.js +1 -0
- package/dashboard/assets/mermaid-parser.core-DriL2hrV.js +7 -0
- package/dashboard/assets/mermaid.core-DJWYDh_P.js +44 -0
- package/dashboard/assets/mindmap-definition-YA3MSWOX-DZsoIeac.js +96 -0
- package/dashboard/assets/operations-BIaUSnYv.js +121 -0
- package/dashboard/assets/operations-BeCdkT4S.css +1 -0
- package/dashboard/assets/ordinal-BDEzSJ7C.js +1 -0
- package/dashboard/assets/packet-AYTQ26CC-BQBIXKxk.js +1 -0
- package/dashboard/assets/path-fybaL0A-.js +1 -0
- package/dashboard/assets/pegDiagram-XKGWAZYB-B0-lslgW.js +1 -0
- package/dashboard/assets/pie-WAS4IAKB-DoY6dwQs.js +1 -0
- package/dashboard/assets/pieDiagram-E7YTZNPT-ElmdRjp5.js +39 -0
- package/dashboard/assets/quadrantDiagram-AXDQQJYC-Ci1h98Q2.js +7 -0
- package/dashboard/assets/radar-RG4KPBEZ-DHod2WgB.js +1 -0
- package/dashboard/assets/railroad-74A4TZTK-90JxB4xV.js +1 -0
- package/dashboard/assets/railroad-abnf-HS5TGJTU-BkXGl114.js +1 -0
- package/dashboard/assets/railroad-ebnf-LZEXJU2U-QVAERn2C.js +1 -0
- package/dashboard/assets/railroad-peg-WCYAUIDC-B1-PM01z.js +1 -0
- package/dashboard/assets/railroadDiagram-O6MQD6OU-k3190A6L.js +1 -0
- package/dashboard/assets/requirementDiagram-BXWQKSXE-C3-eR7I5.js +84 -0
- package/dashboard/assets/rough.esm-Dy-Kn_BL.js +1 -0
- package/dashboard/assets/sankeyDiagram-P5KCCOFB-Bc86pi8w.js +40 -0
- package/dashboard/assets/sequenceDiagram-WJ2MYXX4-Bv_MvEmz.js +162 -0
- package/dashboard/assets/sizeCapture-INFHLROL-B0uUizjq.js +1 -0
- package/dashboard/assets/src-D7Dqq5yP.js +1 -0
- package/dashboard/assets/stateDiagram-D77RDMKH-Bq_GVmeW.js +1 -0
- package/dashboard/assets/stateDiagram-v2-MP3YSRHH-z1XRaftz.js +1 -0
- package/dashboard/assets/swimlanes-42K2YHIH-q0iK-e0P.js +1 -0
- package/dashboard/assets/swimlanesDiagram-VR7AAH4N-C9L6XBQj.js +8 -0
- package/dashboard/assets/timeline-definition-24CTP7MA-CNfF07hM.js +120 -0
- package/dashboard/assets/treeView-Q6P3EWNA-m629ePnS.js +1 -0
- package/dashboard/assets/treemap-WGGIJYW6-D9Cb2ETv.js +1 -0
- package/dashboard/assets/vennDiagram-4TSXK5OY-v4dKF-FE.js +34 -0
- package/dashboard/assets/wardley-WFR3VGLG-DkwH_nRe.js +1 -0
- package/dashboard/assets/wardleyDiagram-VM6X3IG4-3ImohVu4.js +78 -0
- package/dashboard/assets/xychartDiagram-S5SC5T6Z-QJu3dm7K.js +7 -0
- package/dashboard/assets/zero-connect-BGDY0PMZ.webp +0 -0
- package/dashboard/assets/zero-curious-DovTLOs8.webp +0 -0
- package/dashboard/assets/zero-planning-CBeHDrG_.webp +0 -0
- package/dashboard/index.html +2 -2
- package/package.json +1 -1
- package/chunks/service-plugins-MSK2EQP6.js +0 -62
- package/dashboard/assets/operations-BvB5Qpmk.css +0 -1
- package/dashboard/assets/operations-D8Ii01SV.js +0 -114
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { createRequire as __0CreateRequire } from "node:module";
|
|
3
|
+
const require = __0CreateRequire(import.meta.url);
|
|
4
|
+
import {
|
|
5
|
+
executeWorkflow
|
|
6
|
+
} from "./chunk-4HGGNBKK.js";
|
|
7
|
+
import {
|
|
8
|
+
SecurityWorkflowStore
|
|
9
|
+
} from "./chunk-T7ZEVY5G.js";
|
|
10
|
+
|
|
11
|
+
// packages/cli/src/managed-operation.ts
|
|
12
|
+
async function executeManagedOperation(options, dependencies = { store: (path) => new SecurityWorkflowStore(path) }) {
|
|
13
|
+
const costCapUsd = options.costCapUsd ?? 1e3;
|
|
14
|
+
const workflow = {
|
|
15
|
+
id: `cli-${options.type}`,
|
|
16
|
+
revision: 1,
|
|
17
|
+
name: options.name,
|
|
18
|
+
instructions: "",
|
|
19
|
+
target: options.target,
|
|
20
|
+
nodes: [
|
|
21
|
+
{ id: "start", type: "trigger", label: "Start", enabled: true },
|
|
22
|
+
{
|
|
23
|
+
id: "operation",
|
|
24
|
+
type: options.type,
|
|
25
|
+
label: options.name,
|
|
26
|
+
enabled: true,
|
|
27
|
+
...options.type === "fix" ? { fix: { mode: options.fixMode ?? "candidate" } } : {},
|
|
28
|
+
plan: {
|
|
29
|
+
goal: "unknown-vulnerabilities",
|
|
30
|
+
depth: "default",
|
|
31
|
+
runCount: 1,
|
|
32
|
+
executionMode: "sequential",
|
|
33
|
+
timeCapMs: Math.min(options.timeCapMs, 864e5),
|
|
34
|
+
costCapUsd: Math.min(costCapUsd, 1e3)
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
],
|
|
38
|
+
edges: [{ source: "start", target: "operation" }]
|
|
39
|
+
};
|
|
40
|
+
const store = dependencies.store(options.controlDbPath);
|
|
41
|
+
let id;
|
|
42
|
+
let value;
|
|
43
|
+
let produced = false;
|
|
44
|
+
let engineStatus = "completed";
|
|
45
|
+
try {
|
|
46
|
+
id = store.createExecutionFromSnapshot(workflow, "cli").id;
|
|
47
|
+
store.updateExecution(id, { status: "running", nodeResults: { start: { status: "completed" }, operation: { status: "running" } } });
|
|
48
|
+
const result = await executeWorkflow({
|
|
49
|
+
workflow,
|
|
50
|
+
inputs: options.inputs,
|
|
51
|
+
signal: options.signal,
|
|
52
|
+
timeCapMs: options.timeCapMs,
|
|
53
|
+
costCapUsd,
|
|
54
|
+
executors: { [options.type]: async (context) => {
|
|
55
|
+
value = await options.execute(context);
|
|
56
|
+
produced = true;
|
|
57
|
+
engineStatus = options.status?.(value) ?? "completed";
|
|
58
|
+
return { status: engineStatus, ...options.reports ? { reports: options.reports(value) } : {}, outputs: [{ kind: options.type === "fix" ? "source-fix-result" : options.type === "verify" ? "verification-result" : `${options.type}-result`, value: options.output ? options.output(value) : value }] };
|
|
59
|
+
} }
|
|
60
|
+
});
|
|
61
|
+
const nodeResults = Object.fromEntries(Object.entries(result.nodeResults).map(([nodeId, node]) => [nodeId, { status: node.status, ...node.error ? { error: node.error.slice(0, 16e3) } : {} }]));
|
|
62
|
+
try {
|
|
63
|
+
store.saveExecutionResults(id, result);
|
|
64
|
+
} catch (error) {
|
|
65
|
+
const message = `Run ${result.status}, but result retention failed: ${error instanceof Error ? error.message : String(error)}`;
|
|
66
|
+
store.updateExecution(id, { status: result.status, nodeResults, error: message.slice(0, 16e3) });
|
|
67
|
+
throw new Error(message);
|
|
68
|
+
}
|
|
69
|
+
store.updateExecution(id, { status: result.status, nodeResults, ...result.error ? { error: result.error.slice(0, 16e3) } : {} });
|
|
70
|
+
if (!produced || result.status !== "completed" && engineStatus === "completed") throw new Error(result.error ?? "Operation did not complete.");
|
|
71
|
+
return value;
|
|
72
|
+
} catch (error) {
|
|
73
|
+
const current = id ? store.getExecution(id) : void 0;
|
|
74
|
+
if (id && (current?.status === "queued" || current?.status === "running")) store.updateExecution(id, { status: "failed", error: (error instanceof Error ? error.message : String(error)).slice(0, 16e3) });
|
|
75
|
+
throw error;
|
|
76
|
+
} finally {
|
|
77
|
+
store.close();
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
export {
|
|
82
|
+
executeManagedOperation
|
|
83
|
+
};
|
|
@@ -3,10 +3,10 @@ import { createRequire as __0CreateRequire } from "node:module";
|
|
|
3
3
|
const require = __0CreateRequire(import.meta.url);
|
|
4
4
|
import {
|
|
5
5
|
jitterFor
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-JEYIWMGL.js";
|
|
7
7
|
import {
|
|
8
8
|
scanExecutionSignal
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-CP6HANBE.js";
|
|
10
10
|
|
|
11
11
|
// packages/core/dist/scope/rate-limit.js
|
|
12
12
|
var TokenBucket = class {
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { createRequire as __0CreateRequire } from "node:module";
|
|
3
|
+
const require = __0CreateRequire(import.meta.url);
|
|
4
|
+
import {
|
|
5
|
+
expandHomePath,
|
|
6
|
+
isExistingLocalTargetPath,
|
|
7
|
+
isExplicitLocalTargetPath
|
|
8
|
+
} from "./chunk-YAEJAZYW.js";
|
|
9
|
+
|
|
10
|
+
// packages/cli/src/engagement-plan.ts
|
|
11
|
+
var PACKAGE_PREFIXES = {
|
|
12
|
+
"npm:": { ecosystem: "npm", targetType: "npm-package" },
|
|
13
|
+
"pypi:": { ecosystem: "pypi", targetType: "pypi-package" },
|
|
14
|
+
"cargo:": { ecosystem: "cargo", targetType: "cargo-package" },
|
|
15
|
+
"oci:": { ecosystem: "oci", targetType: "oci-image" }
|
|
16
|
+
};
|
|
17
|
+
function resolveEngagement(rawTarget) {
|
|
18
|
+
const raw = rawTarget.trim();
|
|
19
|
+
if (raw.length === 0) return { ok: false, message: "Enter a URL, source path, git URL, or ecosystem-prefixed package." };
|
|
20
|
+
for (const [prefix, packagePlan] of Object.entries(PACKAGE_PREFIXES)) {
|
|
21
|
+
if (!raw.startsWith(prefix)) continue;
|
|
22
|
+
const target = raw.slice(prefix.length).trim();
|
|
23
|
+
if (target.length === 0) return { ok: false, message: `${prefix} requires a package name.` };
|
|
24
|
+
return {
|
|
25
|
+
ok: true,
|
|
26
|
+
plan: {
|
|
27
|
+
kind: "package",
|
|
28
|
+
target,
|
|
29
|
+
targetType: packagePlan.targetType,
|
|
30
|
+
ecosystem: packagePlan.ecosystem,
|
|
31
|
+
label: `${packagePlan.ecosystem} package ${target}`
|
|
32
|
+
}
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
if (raw.startsWith("source:")) {
|
|
36
|
+
const target = raw.slice("source:".length).trim();
|
|
37
|
+
if (target.length === 0) return { ok: false, message: "source: requires a local path or git URL." };
|
|
38
|
+
return {
|
|
39
|
+
ok: true,
|
|
40
|
+
plan: {
|
|
41
|
+
kind: "source",
|
|
42
|
+
target: expandHomePath(target),
|
|
43
|
+
targetType: "source-code",
|
|
44
|
+
label: `source review ${target}`
|
|
45
|
+
}
|
|
46
|
+
};
|
|
47
|
+
}
|
|
48
|
+
if (raw.startsWith("git@") || raw.startsWith("git://") || raw.endsWith(".git") || raw.startsWith("https://github.com/")) {
|
|
49
|
+
return {
|
|
50
|
+
ok: true,
|
|
51
|
+
plan: {
|
|
52
|
+
kind: "source",
|
|
53
|
+
target: raw,
|
|
54
|
+
targetType: "source-code",
|
|
55
|
+
label: `source review ${raw}`
|
|
56
|
+
}
|
|
57
|
+
};
|
|
58
|
+
}
|
|
59
|
+
if (raw.startsWith("mcp://") || raw.startsWith("http://") || raw.startsWith("https://")) {
|
|
60
|
+
return {
|
|
61
|
+
ok: true,
|
|
62
|
+
plan: {
|
|
63
|
+
kind: "web",
|
|
64
|
+
target: raw,
|
|
65
|
+
targetType: "url",
|
|
66
|
+
label: `web target ${raw}`
|
|
67
|
+
}
|
|
68
|
+
};
|
|
69
|
+
}
|
|
70
|
+
if (isExplicitLocalTargetPath(raw) || isExistingLocalTargetPath(raw)) {
|
|
71
|
+
const target = expandHomePath(raw);
|
|
72
|
+
return {
|
|
73
|
+
ok: true,
|
|
74
|
+
plan: {
|
|
75
|
+
kind: "source",
|
|
76
|
+
target,
|
|
77
|
+
targetType: "source-code",
|
|
78
|
+
label: `source review ${target}`
|
|
79
|
+
}
|
|
80
|
+
};
|
|
81
|
+
}
|
|
82
|
+
return {
|
|
83
|
+
ok: false,
|
|
84
|
+
message: "Ambiguous target. Use https://\u2026, ./path, source:\u2026, npm:\u2026, pypi:\u2026, cargo:\u2026, or oci:\u2026."
|
|
85
|
+
};
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
export {
|
|
89
|
+
resolveEngagement
|
|
90
|
+
};
|
|
@@ -5,7 +5,7 @@ import {
|
|
|
5
5
|
homeStateDir,
|
|
6
6
|
parseSecurityWorkflowInput,
|
|
7
7
|
runStateDir
|
|
8
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-LTEE2JWK.js";
|
|
9
9
|
import {
|
|
10
10
|
__export
|
|
11
11
|
} from "./chunk-VCSFCHAJ.js";
|
|
@@ -2639,6 +2639,7 @@ var SecurityWorkflowStore = class {
|
|
|
2639
2639
|
CREATE TABLE IF NOT EXISTS workflow_executions (id TEXT PRIMARY KEY, workflow_id TEXT NOT NULL, workflow_revision INTEGER NOT NULL, session_id TEXT NOT NULL, status TEXT NOT NULL, execution_json TEXT NOT NULL, created_at TEXT NOT NULL, updated_at TEXT NOT NULL);
|
|
2640
2640
|
CREATE INDEX IF NOT EXISTS workflow_executions_workflow ON workflow_executions(workflow_id, created_at);
|
|
2641
2641
|
CREATE INDEX IF NOT EXISTS workflow_executions_session ON workflow_executions(session_id, created_at);`);
|
|
2642
|
+
this.#db.exec("CREATE TABLE IF NOT EXISTS workflow_execution_results (execution_id TEXT PRIMARY KEY, result_json TEXT NOT NULL);");
|
|
2642
2643
|
}
|
|
2643
2644
|
list() {
|
|
2644
2645
|
return this.#db.prepare("SELECT definition_json FROM workflow_definitions ORDER BY updated_at DESC, id").all().map((row) => JSON.parse(String(row.definition_json)));
|
|
@@ -2695,10 +2696,34 @@ var SecurityWorkflowStore = class {
|
|
|
2695
2696
|
return execution;
|
|
2696
2697
|
})();
|
|
2697
2698
|
}
|
|
2699
|
+
/** Execute a pinned template without implicitly saving a reusable definition. */
|
|
2700
|
+
createExecutionFromSnapshot(value, sessionId) {
|
|
2701
|
+
if (!sessionId || sessionId.length > 128)
|
|
2702
|
+
throw new SecurityWorkflowStoreError("Invalid execution owner.", 400);
|
|
2703
|
+
const input = parseSecurityWorkflowInput(value);
|
|
2704
|
+
const now = (/* @__PURE__ */ new Date()).toISOString();
|
|
2705
|
+
const workflow = { ...input, id: input.id ?? randomUUID3(), revision: input.revision ?? 1, createdAt: now, updatedAt: now };
|
|
2706
|
+
const execution = { id: randomUUID3(), workflowId: workflow.id, workflowRevision: workflow.revision, workflow, sessionId, ownerPid: process.pid, runnerInstanceId: this.#runnerInstanceId, status: "queued", nodeResults: {}, createdAt: now, updatedAt: now };
|
|
2707
|
+
this.#db.prepare("INSERT INTO workflow_executions (id, workflow_id, workflow_revision, session_id, status, execution_json, created_at, updated_at) VALUES (?, ?, ?, ?, ?, ?, ?, ?)").run(execution.id, execution.workflowId, execution.workflowRevision, sessionId, execution.status, JSON.stringify(execution), now, now);
|
|
2708
|
+
return execution;
|
|
2709
|
+
}
|
|
2698
2710
|
getExecution(id) {
|
|
2699
2711
|
const row = this.#db.prepare("SELECT execution_json FROM workflow_executions WHERE id = ?").all(id)[0];
|
|
2700
2712
|
return row ? JSON.parse(String(row.execution_json)) : null;
|
|
2701
2713
|
}
|
|
2714
|
+
/** Retain structured evidence independently of process-local job memory. */
|
|
2715
|
+
saveExecutionResults(id, result) {
|
|
2716
|
+
if (!this.getExecution(id))
|
|
2717
|
+
throw new SecurityWorkflowStoreError("Execution not found.", 404);
|
|
2718
|
+
const json = JSON.stringify(result);
|
|
2719
|
+
if (json === void 0 || Buffer.byteLength(json, "utf8") > 16 * 1024 * 1024)
|
|
2720
|
+
throw new SecurityWorkflowStoreError("Workflow results must be valid JSON of at most 16 MiB.", 400);
|
|
2721
|
+
this.#db.prepare("INSERT INTO workflow_execution_results (execution_id, result_json) VALUES (?, ?) ON CONFLICT(execution_id) DO UPDATE SET result_json = excluded.result_json").run(id, json);
|
|
2722
|
+
}
|
|
2723
|
+
getExecutionResults(id) {
|
|
2724
|
+
const row = this.#db.prepare("SELECT result_json FROM workflow_execution_results WHERE execution_id = ?").all(id)[0];
|
|
2725
|
+
return row ? JSON.parse(String(row.result_json)) : null;
|
|
2726
|
+
}
|
|
2702
2727
|
listExecutions(workflowId, sessionId) {
|
|
2703
2728
|
return this.#db.prepare("SELECT execution_json FROM workflow_executions WHERE (? IS NULL OR workflow_id = ?) AND (? IS NULL OR session_id = ?) ORDER BY created_at DESC, id LIMIT 200").all(workflowId ?? null, workflowId ?? null, sessionId ?? null, sessionId ?? null).map((row) => JSON.parse(String(row.execution_json)));
|
|
2704
2729
|
}
|
|
@@ -3,14 +3,18 @@ import { createRequire as __0CreateRequire } from "node:module";
|
|
|
3
3
|
const require = __0CreateRequire(import.meta.url);
|
|
4
4
|
import {
|
|
5
5
|
VERSION
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-LTEE2JWK.js";
|
|
7
7
|
|
|
8
8
|
// packages/cli/src/tui/runtime.ts
|
|
9
|
+
function getReleaseChannel(env = process.env) {
|
|
10
|
+
if (env["ZERO_DEV_SOURCE_ROOT"]?.trim() || env["NODE_ENV"] === "development") return "dev";
|
|
11
|
+
return true ? "beta" : "dev";
|
|
12
|
+
}
|
|
9
13
|
function getRuntimeMetadata() {
|
|
10
14
|
const bun = isBunRuntime();
|
|
11
15
|
return {
|
|
12
16
|
cliVersion: VERSION,
|
|
13
|
-
releaseChannel:
|
|
17
|
+
releaseChannel: getReleaseChannel(),
|
|
14
18
|
engine: bun ? "Bun" : "Node.js",
|
|
15
19
|
engineVersion: bun ? process.versions.bun ?? "unknown" : process.version,
|
|
16
20
|
platform: process.platform,
|
|
@@ -25,6 +29,7 @@ function canUseOpenTui() {
|
|
|
25
29
|
}
|
|
26
30
|
|
|
27
31
|
export {
|
|
32
|
+
getReleaseChannel,
|
|
28
33
|
getRuntimeMetadata,
|
|
29
34
|
isBunRuntime,
|
|
30
35
|
canUseOpenTui
|
|
@@ -6,22 +6,22 @@ import {
|
|
|
6
6
|
} from "./chunk-HLFS6WV2.js";
|
|
7
7
|
import {
|
|
8
8
|
agenticScan
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-4HGGNBKK.js";
|
|
10
10
|
import {
|
|
11
11
|
runAgentLoop
|
|
12
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-P7KDN5PK.js";
|
|
13
13
|
import {
|
|
14
14
|
getToolsForRole
|
|
15
|
-
} from "./chunk-
|
|
15
|
+
} from "./chunk-EH2WTNY7.js";
|
|
16
16
|
import {
|
|
17
17
|
createRuntime
|
|
18
|
-
} from "./chunk-
|
|
18
|
+
} from "./chunk-UZUELPFW.js";
|
|
19
19
|
import {
|
|
20
20
|
osecDB
|
|
21
|
-
} from "./chunk-
|
|
21
|
+
} from "./chunk-T7ZEVY5G.js";
|
|
22
22
|
import {
|
|
23
23
|
LlmApiRuntime
|
|
24
|
-
} from "./chunk-
|
|
24
|
+
} from "./chunk-BF5FIK7H.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 __0CreateRequire } from "node:module";
|
|
|
3
3
|
const require = __0CreateRequire(import.meta.url);
|
|
4
4
|
import {
|
|
5
5
|
homeStateDir
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-LTEE2JWK.js";
|
|
7
7
|
|
|
8
8
|
// packages/core/dist/cve/artifact-scraper.js
|
|
9
9
|
import { createHash } from "node:crypto";
|
|
@@ -3,7 +3,7 @@ import { createRequire as __0CreateRequire } from "node:module";
|
|
|
3
3
|
const require = __0CreateRequire(import.meta.url);
|
|
4
4
|
import {
|
|
5
5
|
LlmApiRuntime
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-BF5FIK7H.js";
|
|
7
7
|
|
|
8
8
|
// packages/core/dist/stages/variant-candidates.js
|
|
9
9
|
import { execFileSync } from "node:child_process";
|