0sec-cli 0.21.4 → 0.22.1
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 +56 -56
- package/README.md +48 -63
- package/chunks/{adapt-loop-IGBRQAXO.js → adapt-loop-J6QCZZTB.js} +4 -4
- package/chunks/{artifact-scraper-LNQJUORS.js → artifact-scraper-MFKT6OI4.js} +2 -2
- package/chunks/{assumption-mining-4MJTP6H5.js → assumption-mining-646LYSJY.js} +16 -16
- package/chunks/{chunk-Z3IKZX3X.js → chunk-23DG5YKS.js} +1 -1
- package/chunks/{chunk-2WSXFFJZ.js → chunk-3E2KALZ5.js} +2 -2
- package/chunks/{chunk-TF46UWFU.js → chunk-4G7OVYJX.js} +1 -1
- package/chunks/{chunk-E2UOY5PJ.js → chunk-5BTJMINS.js} +12 -70
- package/chunks/{chunk-QZVG3BG4.js → chunk-5IBCBQEH.js} +1 -2
- package/chunks/{chunk-YA4PUM4H.js → chunk-7XCKYNLO.js} +1 -1
- package/chunks/{chunk-BACXRTQ4.js → chunk-AV2LG2L7.js} +87 -767
- package/chunks/{chunk-IMGWPNQM.js → chunk-BCSRRQG5.js} +76 -593
- package/chunks/{chunk-NOPBXZUV.js → chunk-BOUGKEKA.js} +1 -1
- package/chunks/{chunk-RF5QGKLR.js → chunk-CPWA6RWE.js} +3 -3
- package/chunks/{chunk-P6YG6TEZ.js → chunk-DKSCN2AB.js} +1 -1
- package/chunks/{chunk-YPOA3W4O.js → chunk-GOEA3NW6.js} +877 -110
- package/chunks/{chunk-ANDKY54G.js → chunk-HHPWRY2M.js} +4019 -7299
- package/chunks/{chunk-NDJU5ZZ7.js → chunk-IFME676H.js} +3 -3
- package/chunks/{chunk-HBKCGJAV.js → chunk-IVQV574Y.js} +1 -1
- package/chunks/{chunk-W4JOXE4N.js → chunk-IXT64DV5.js} +709 -1929
- package/chunks/{chunk-PC6RCKQV.js → chunk-KAU6NLGP.js} +59 -26
- package/chunks/{chunk-FAH6V4QM.js → chunk-LGCASF2C.js} +1117 -2291
- package/chunks/{chunk-CAJJRUTV.js → chunk-NLH4LMWH.js} +1 -1
- package/chunks/chunk-OHHCGDJ2.js +5523 -0
- package/chunks/{chunk-YHWWF4QY.js → chunk-OSBPGWTE.js} +3 -3
- package/chunks/{chunk-G34QP2XW.js → chunk-TM74SSHC.js} +1 -1
- package/chunks/{chunk-VOAXLO4A.js → chunk-TO35Y326.js} +5 -721
- package/chunks/{chunk-FWAYJ2IV.js → chunk-TV27OWIW.js} +8 -8
- package/chunks/chunk-UELXHK2Y.js +1950 -0
- package/chunks/{chunk-CL5KAUM6.js → chunk-V6GHX34G.js} +274 -8
- package/chunks/{chunk-WZISK5VC.js → chunk-VWITLWXB.js} +53 -7
- package/chunks/{chunk-ER3SUMYJ.js → chunk-W6UWZFKL.js} +0 -195
- package/chunks/chunk-WSDDGFA6.js +114 -0
- package/chunks/{chunk-5T6D5BVY.js → chunk-WZRVS7SB.js} +1 -1
- package/chunks/chunk-X7LAEEUW.js +2143 -0
- package/chunks/chunk-XA2O4WXA.js +1228 -0
- package/chunks/{chunk-Y5H6E24H.js → chunk-XCISCI4T.js} +1 -1
- package/chunks/{chunk-WPQLBN4S.js → chunk-XDKB2P5X.js} +1 -1
- package/chunks/{chunk-SBMB4OL3.js → chunk-YL6YAGLL.js} +62 -8
- package/chunks/{chunk-O6SD4A36.js → chunk-ZKQ2I3S2.js} +1 -1
- package/chunks/{codex-models-TYYV4JNN.js → codex-models-NHQW45SO.js} +5 -3
- package/chunks/{commands-WF5RG4I2.js → commands-N6GN5SBF.js} +2152 -3643
- package/chunks/{db-U3WQZVAO.js → db-5IWEJUYV.js} +3 -3
- package/chunks/{disclose-67GZCDBO.js → disclose-LDNKAVRH.js} +10 -8
- package/chunks/{dist-ACC3DZUZ.js → dist-BS4CY4RG.js} +3 -1
- package/chunks/{dist-EVTN3UTT.js → dist-FSS7MBDF.js} +2 -2
- package/chunks/{dist-F6X62TQK.js → dist-L3XJWWZ6.js} +225 -192
- package/chunks/{eval-runner-SA6OUGHZ.js → eval-runner-EMEGF24P.js} +11 -11
- package/chunks/{exploit-agent-36Q7XQFP.js → exploit-agent-KW4EB7BE.js} +1 -1
- package/chunks/{exploit-autoclimb-J4OTSTZ6.js → exploit-autoclimb-CXJ2ERRO.js} +1 -1
- package/chunks/{exploit-climb-PYEJDIC4.js → exploit-climb-TJWLY4XC.js} +2 -2
- package/chunks/fix-UUKPXCFB.js +26 -0
- package/chunks/{harness-GDUMKGSE.js → harness-C5HOKIEV.js} +3 -3
- package/chunks/{hunt-scan-UDJSCISU.js → hunt-scan-KZZ444V2.js} +14 -14
- package/chunks/{identity-JTIVJSV7.js → identity-62SVRW4H.js} +1 -1
- package/chunks/{kernel-primitive-F2IXUFAX.js → kernel-primitive-Z77IR7YS.js} +2 -2
- package/chunks/{kernel-vm-runner-276LHIOV.js → kernel-vm-runner-JW77P276.js} +2 -2
- package/chunks/{memsafety-scan-NHUOGTEX.js → memsafety-scan-FCPAXIZE.js} +2 -2
- package/chunks/{native-loop-3BSYVDUI.js → native-loop-P6P5GYVJ.js} +10 -10
- package/chunks/{npm-detectors-VIYJXKFQ.js → npm-detectors-Z2ZIQCN4.js} +2 -2
- package/chunks/orchestrate-DWWUT5RC.js +58 -0
- package/chunks/{process-PNMC36JI.js → process-N245QIQG.js} +1 -4
- package/chunks/{run-CBGE6DRQ.js → run-GAFKBCTN.js} +14935 -17598
- package/chunks/{runtime-PXO5G6UV.js → runtime-H7YBR5IZ.js} +4 -5
- package/chunks/{scope-NJHIDDTN.js → scope-QWY4VQZ7.js} +4 -1
- package/chunks/{session-store-46WBZM22.js → session-store-XIDFGG7K.js} +2 -2
- package/chunks/{variant-candidates-UH2WC2HA.js → variant-candidates-7D4F5E4H.js} +3 -3
- package/chunks/{web-recon-prepass-SFXU44SS.js → web-recon-prepass-VXXBPDAV.js} +3 -3
- package/cli-path-traversal-fixture.js +352 -0
- package/dashboard/assets/bot-Bg1Tp9_d.js +1 -0
- package/dashboard/assets/dist-B_dDCPbu.js +1 -0
- package/dashboard/assets/findings-page-mayGhNx6.js +5 -0
- package/dashboard/assets/format--susmHX7.js +1 -0
- package/dashboard/assets/input-TuVPR3Zl.js +1 -0
- package/dashboard/assets/jsx-runtime-MGseXjj5.js +3 -0
- package/dashboard/assets/live-page-HWWHX99U.js +1 -0
- package/dashboard/assets/meta-tile-ckHo-w7k.js +1 -0
- package/dashboard/assets/operations-BxZ0OoXO.js +10 -0
- package/dashboard/assets/operations-app-D3d35rgo.js +46 -0
- package/dashboard/assets/overview-page-W_4IteEr.js +1 -0
- package/dashboard/assets/page-header-Bw9AJgBV.js +1 -0
- package/dashboard/assets/scans-page-CgzVXHnn.js +1 -0
- package/dashboard/assets/siren-KQj8QAnJ.js +1 -0
- package/dashboard/assets/table-8EDklulN.js +1 -0
- package/dashboard/assets/tabs-CFHPOwg8.js +1 -0
- package/dashboard/index.html +2 -3
- package/node_modules/node-addon-api/LICENSE.md +9 -0
- package/node_modules/node-addon-api/README.md +95 -0
- package/node_modules/node-addon-api/common.gypi +21 -0
- package/node_modules/node-addon-api/except.gypi +25 -0
- package/node_modules/node-addon-api/index.js +14 -0
- package/node_modules/node-addon-api/napi-inl.deprecated.h +186 -0
- package/node_modules/node-addon-api/napi-inl.h +7250 -0
- package/node_modules/node-addon-api/napi.h +3463 -0
- package/node_modules/node-addon-api/node_addon_api.gyp +42 -0
- package/node_modules/node-addon-api/node_api.gyp +9 -0
- package/node_modules/node-addon-api/noexcept.gypi +26 -0
- package/node_modules/node-addon-api/nothing.c +0 -0
- package/node_modules/node-addon-api/package-support.json +21 -0
- package/node_modules/node-addon-api/package.json +481 -0
- package/node_modules/node-addon-api/tools/README.md +73 -0
- package/node_modules/node-addon-api/tools/check-napi.js +99 -0
- package/node_modules/node-addon-api/tools/clang-format.js +71 -0
- package/node_modules/node-addon-api/tools/conversion.js +301 -0
- package/node_modules/node-gyp-build/LICENSE +21 -0
- package/node_modules/node-gyp-build/README.md +58 -0
- package/node_modules/node-gyp-build/SECURITY.md +5 -0
- package/node_modules/node-gyp-build/bin.js +84 -0
- package/node_modules/node-gyp-build/build-test.js +19 -0
- package/node_modules/node-gyp-build/index.js +6 -0
- package/node_modules/node-gyp-build/node-gyp-build.js +207 -0
- package/node_modules/node-gyp-build/optional.js +7 -0
- package/node_modules/node-gyp-build/package.json +43 -0
- package/node_modules/tree-sitter/LICENSE +21 -0
- package/node_modules/tree-sitter/README.md +90 -0
- package/node_modules/tree-sitter/binding.gyp +76 -0
- package/node_modules/tree-sitter/index.js +895 -0
- package/node_modules/tree-sitter/package.json +62 -0
- package/node_modules/tree-sitter/prebuilds/darwin-arm64/tree-sitter.node +0 -0
- package/node_modules/tree-sitter/prebuilds/darwin-x64/tree-sitter.node +0 -0
- package/node_modules/tree-sitter/prebuilds/linux-x64/tree-sitter.node +0 -0
- package/node_modules/tree-sitter/prebuilds/win32-x64/tree-sitter.node +0 -0
- package/node_modules/tree-sitter/src/addon_data.h +47 -0
- package/node_modules/tree-sitter/src/binding.cc +35 -0
- package/node_modules/tree-sitter/src/conversions.cc +140 -0
- package/node_modules/tree-sitter/src/conversions.h +22 -0
- package/node_modules/tree-sitter/src/language.cc +106 -0
- package/node_modules/tree-sitter/src/language.h +17 -0
- package/node_modules/tree-sitter/src/logger.cc +70 -0
- package/node_modules/tree-sitter/src/logger.h +19 -0
- package/node_modules/tree-sitter/src/lookaheaditerator.cc +122 -0
- package/node_modules/tree-sitter/src/lookaheaditerator.h +33 -0
- package/node_modules/tree-sitter/src/node.cc +1056 -0
- package/node_modules/tree-sitter/src/node.h +30 -0
- package/node_modules/tree-sitter/src/parser.cc +298 -0
- package/node_modules/tree-sitter/src/parser.h +35 -0
- package/node_modules/tree-sitter/src/query.cc +383 -0
- package/node_modules/tree-sitter/src/query.h +39 -0
- package/node_modules/tree-sitter/src/tree.cc +307 -0
- package/node_modules/tree-sitter/src/tree.h +45 -0
- package/node_modules/tree-sitter/src/tree_cursor.cc +213 -0
- package/node_modules/tree-sitter/src/tree_cursor.h +52 -0
- package/node_modules/tree-sitter/tree-sitter.d.ts +211 -0
- package/node_modules/tree-sitter/vendor/tree-sitter/LICENSE +21 -0
- package/node_modules/tree-sitter/vendor/tree-sitter/README.md +21 -0
- package/node_modules/tree-sitter/vendor/tree-sitter/lib/README.md +6 -0
- package/node_modules/tree-sitter/vendor/tree-sitter/lib/include/tree_sitter/api.h +1266 -0
- package/node_modules/tree-sitter/vendor/tree-sitter/lib/src/alloc.c +48 -0
- package/node_modules/tree-sitter/vendor/tree-sitter/lib/src/alloc.h +41 -0
- package/node_modules/tree-sitter/vendor/tree-sitter/lib/src/array.h +290 -0
- package/node_modules/tree-sitter/vendor/tree-sitter/lib/src/atomic.h +68 -0
- package/node_modules/tree-sitter/vendor/tree-sitter/lib/src/clock.h +146 -0
- package/node_modules/tree-sitter/vendor/tree-sitter/lib/src/error_costs.h +11 -0
- package/node_modules/tree-sitter/vendor/tree-sitter/lib/src/get_changed_ranges.c +501 -0
- package/node_modules/tree-sitter/vendor/tree-sitter/lib/src/get_changed_ranges.h +36 -0
- package/node_modules/tree-sitter/vendor/tree-sitter/lib/src/host.h +21 -0
- package/node_modules/tree-sitter/vendor/tree-sitter/lib/src/language.c +221 -0
- package/node_modules/tree-sitter/vendor/tree-sitter/lib/src/language.h +299 -0
- package/node_modules/tree-sitter/vendor/tree-sitter/lib/src/length.h +52 -0
- package/node_modules/tree-sitter/vendor/tree-sitter/lib/src/lexer.c +419 -0
- package/node_modules/tree-sitter/vendor/tree-sitter/lib/src/lexer.h +49 -0
- package/node_modules/tree-sitter/vendor/tree-sitter/lib/src/lib.c +14 -0
- package/node_modules/tree-sitter/vendor/tree-sitter/lib/src/node.c +774 -0
- package/node_modules/tree-sitter/vendor/tree-sitter/lib/src/parser.c +2151 -0
- package/node_modules/tree-sitter/vendor/tree-sitter/lib/src/parser.h +230 -0
- package/node_modules/tree-sitter/vendor/tree-sitter/lib/src/point.h +62 -0
- package/node_modules/tree-sitter/vendor/tree-sitter/lib/src/query.c +4134 -0
- package/node_modules/tree-sitter/vendor/tree-sitter/lib/src/reduce_action.h +34 -0
- package/node_modules/tree-sitter/vendor/tree-sitter/lib/src/reusable_node.h +95 -0
- package/node_modules/tree-sitter/vendor/tree-sitter/lib/src/stack.c +899 -0
- package/node_modules/tree-sitter/vendor/tree-sitter/lib/src/stack.h +133 -0
- package/node_modules/tree-sitter/vendor/tree-sitter/lib/src/subtree.c +1060 -0
- package/node_modules/tree-sitter/vendor/tree-sitter/lib/src/subtree.h +382 -0
- package/node_modules/tree-sitter/vendor/tree-sitter/lib/src/tree.c +165 -0
- package/node_modules/tree-sitter/vendor/tree-sitter/lib/src/tree.h +31 -0
- package/node_modules/tree-sitter/vendor/tree-sitter/lib/src/tree_cursor.c +714 -0
- package/node_modules/tree-sitter/vendor/tree-sitter/lib/src/tree_cursor.h +48 -0
- package/node_modules/tree-sitter/vendor/tree-sitter/lib/src/unicode/ICU_SHA +1 -0
- package/node_modules/tree-sitter/vendor/tree-sitter/lib/src/unicode/LICENSE +414 -0
- package/node_modules/tree-sitter/vendor/tree-sitter/lib/src/unicode/README.md +29 -0
- package/node_modules/tree-sitter/vendor/tree-sitter/lib/src/unicode/ptypes.h +1 -0
- package/node_modules/tree-sitter/vendor/tree-sitter/lib/src/unicode/umachine.h +448 -0
- package/node_modules/tree-sitter/vendor/tree-sitter/lib/src/unicode/urename.h +1 -0
- package/node_modules/tree-sitter/vendor/tree-sitter/lib/src/unicode/utf.h +1 -0
- package/node_modules/tree-sitter/vendor/tree-sitter/lib/src/unicode/utf16.h +733 -0
- package/node_modules/tree-sitter/vendor/tree-sitter/lib/src/unicode/utf8.h +881 -0
- package/node_modules/tree-sitter/vendor/tree-sitter/lib/src/unicode.h +50 -0
- package/node_modules/tree-sitter/vendor/tree-sitter/lib/src/wasm/stdlib-symbols.txt +23 -0
- package/node_modules/tree-sitter/vendor/tree-sitter/lib/src/wasm/stdlib.c +109 -0
- package/node_modules/tree-sitter/vendor/tree-sitter/lib/src/wasm/wasm-stdlib.h +1294 -0
- package/node_modules/tree-sitter/vendor/tree-sitter/lib/src/wasm_store.c +1823 -0
- package/node_modules/tree-sitter/vendor/tree-sitter/lib/src/wasm_store.h +31 -0
- package/node_modules/tree-sitter/vendor/tree-sitter/test/fixtures/grammars/.gitkeep +0 -0
- package/node_modules/tree-sitter-c/LICENSE +21 -0
- package/node_modules/tree-sitter-c/README.md +18 -0
- package/node_modules/tree-sitter-c/binding.gyp +20 -0
- package/node_modules/tree-sitter-c/bindings/node/binding.cc +20 -0
- package/node_modules/tree-sitter-c/bindings/node/index.d.ts +28 -0
- package/node_modules/tree-sitter-c/bindings/node/index.js +7 -0
- package/node_modules/tree-sitter-c/grammar.js +1463 -0
- package/node_modules/tree-sitter-c/package.json +108 -0
- package/node_modules/tree-sitter-c/prebuilds/darwin-arm64/tree-sitter-c.node +0 -0
- package/node_modules/tree-sitter-c/prebuilds/darwin-x64/tree-sitter-c.node +0 -0
- package/node_modules/tree-sitter-c/prebuilds/linux-x64/tree-sitter-c.node +0 -0
- package/node_modules/tree-sitter-c/prebuilds/win32-x64/tree-sitter-c.node +0 -0
- package/node_modules/tree-sitter-c/queries/highlights.scm +81 -0
- package/node_modules/tree-sitter-c/queries/tags.scm +9 -0
- package/node_modules/tree-sitter-c/src/grammar.json +9682 -0
- package/node_modules/tree-sitter-c/src/node-types.json +4556 -0
- package/node_modules/tree-sitter-c/src/parser.c +113852 -0
- package/node_modules/tree-sitter-c/src/tree_sitter/alloc.h +54 -0
- package/node_modules/tree-sitter-c/src/tree_sitter/array.h +290 -0
- package/node_modules/tree-sitter-c/src/tree_sitter/parser.h +265 -0
- package/package.json +10 -3
- package/vendor/tree-sitter-0.21.1-node24.json +16 -0
- package/vendor/tree-sitter-0.21.1-node24.tgz +0 -0
- package/chunks/chunk-CGHCEN7W.js +0 -169
- package/chunks/chunk-CXKDWFNO.js +0 -102
- package/chunks/chunk-GIQKESMN.js +0 -687
- package/chunks/chunk-HPQZHOIU.js +0 -67
- package/chunks/chunk-PD2BBBKT.js +0 -245
- package/chunks/chunk-WF5W75WY.js +0 -1070
- package/chunks/fix-J2KBRJDV.js +0 -12
- package/chunks/orchestrate-DHBFRTSI.js +0 -59
- package/chunks/replay-runner-LK2XFIVG.js +0 -39
- package/dashboard/assets/bot-yILPnRgD.js +0 -1
- package/dashboard/assets/chevron-down-BeDJ-Vka.js +0 -1
- package/dashboard/assets/circle-alert-BEnMBMT-.js +0 -1
- package/dashboard/assets/client-DRYsuOGl.js +0 -9
- package/dashboard/assets/copy-Bi5vzoF9.js +0 -1
- package/dashboard/assets/desktop-BT7RkC4q.js +0 -32
- package/dashboard/assets/desktop-OaBI0E0e.css +0 -1
- package/dashboard/assets/dist-CmX-h7a4.js +0 -1
- package/dashboard/assets/dist-DAwYQmf_.js +0 -45
- package/dashboard/assets/findings-page-B4rwF6fZ.js +0 -5
- package/dashboard/assets/format-LNQSSpn6.js +0 -1
- package/dashboard/assets/jsx-runtime-C7oxC63R.js +0 -1
- package/dashboard/assets/live-page-DoNwpPAO.js +0 -1
- package/dashboard/assets/meta-tile-BMtBC-Qq.js +0 -1
- package/dashboard/assets/operations-app-ER0gg7GN.js +0 -2
- package/dashboard/assets/operations-e2CGYKB1.js +0 -4
- package/dashboard/assets/overview-page-CmeWH17A.js +0 -1
- package/dashboard/assets/page-header-CIJyycfz.js +0 -1
- package/dashboard/assets/play-Dwo-9xt6.js +0 -1
- package/dashboard/assets/scans-page-CuhzWhHx.js +0 -1
- package/dashboard/assets/search-CiooTLck.js +0 -1
- package/dashboard/assets/siren-CCBwTSuk.js +0 -1
- package/dashboard/assets/table-BgsSBdke.js +0 -1
- package/dashboard/assets/tabs-vn6v7Bk6.js +0 -1
- package/dashboard/desktop.html +0 -21
|
@@ -5,15 +5,11 @@ import {
|
|
|
5
5
|
isValidSessionId,
|
|
6
6
|
listSessions,
|
|
7
7
|
loadSession
|
|
8
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-BOUGKEKA.js";
|
|
9
9
|
import {
|
|
10
|
-
consolePresentationOutput,
|
|
11
10
|
getSettings,
|
|
12
11
|
maybeLoadCodexAuth
|
|
13
|
-
} from "./chunk-
|
|
14
|
-
import {
|
|
15
|
-
source_default
|
|
16
|
-
} from "./chunk-HLFS6WV2.js";
|
|
12
|
+
} from "./chunk-GOEA3NW6.js";
|
|
17
13
|
import {
|
|
18
14
|
createConsoleJevRuntime,
|
|
19
15
|
createConsoleSession,
|
|
@@ -25,49 +21,40 @@ import {
|
|
|
25
21
|
retireArchetype,
|
|
26
22
|
runLensSynthesisLoop,
|
|
27
23
|
toToolContextJevRuntime
|
|
28
|
-
} from "./chunk-
|
|
24
|
+
} from "./chunk-LGCASF2C.js";
|
|
25
|
+
import {
|
|
26
|
+
source_default
|
|
27
|
+
} from "./chunk-HLFS6WV2.js";
|
|
29
28
|
import {
|
|
30
29
|
harvestMissesFromLedgerEntry,
|
|
31
30
|
mergeHarvestedMisses
|
|
32
|
-
} from "./chunk-
|
|
31
|
+
} from "./chunk-HHPWRY2M.js";
|
|
33
32
|
import {
|
|
34
33
|
eventBus
|
|
35
|
-
} from "./chunk-
|
|
34
|
+
} from "./chunk-OHHCGDJ2.js";
|
|
36
35
|
import {
|
|
37
36
|
listOsecRunDatabasePaths,
|
|
38
37
|
osecDB,
|
|
39
38
|
resolveOsecDbPath
|
|
40
|
-
} from "./chunk-
|
|
39
|
+
} from "./chunk-VWITLWXB.js";
|
|
41
40
|
import {
|
|
42
41
|
redactSensitiveHeaders
|
|
43
|
-
} from "./chunk-
|
|
44
|
-
import {
|
|
45
|
-
CloudAuthMissingError,
|
|
46
|
-
CloudClient,
|
|
47
|
-
CloudError,
|
|
48
|
-
CloudForbiddenError,
|
|
49
|
-
CloudNetworkError,
|
|
50
|
-
CloudUnauthorizedError,
|
|
51
|
-
DEFAULT_CLOUD_HOST,
|
|
52
|
-
loadCloudCredentials
|
|
53
|
-
} from "./chunk-BACXRTQ4.js";
|
|
42
|
+
} from "./chunk-UELXHK2Y.js";
|
|
54
43
|
import {
|
|
55
44
|
SEVERITY_RANK,
|
|
56
45
|
VERSION,
|
|
57
|
-
cloudStateDir,
|
|
58
46
|
createAuditReportDocument,
|
|
59
47
|
createReviewReportDocument,
|
|
60
48
|
createScanReportDocument,
|
|
61
49
|
findingSchema,
|
|
62
50
|
formatZodError,
|
|
63
|
-
homeStateDir,
|
|
64
51
|
severityRank
|
|
65
|
-
} from "./chunk-
|
|
52
|
+
} from "./chunk-KAU6NLGP.js";
|
|
66
53
|
|
|
67
54
|
// packages/cli/src/utils.ts
|
|
68
55
|
import { gzipSync } from "zlib";
|
|
69
56
|
async function getRuntimeAvailability() {
|
|
70
|
-
const { detectAvailableRuntimes, LlmApiRuntime } = await import("./dist-
|
|
57
|
+
const { detectAvailableRuntimes, LlmApiRuntime } = await import("./dist-L3XJWWZ6.js");
|
|
71
58
|
const apiRuntimeDiagnostics = new LlmApiRuntime({ type: "api", timeout: 5e3 }).getConfigurationDiagnostics();
|
|
72
59
|
const hasApiKey = apiRuntimeDiagnostics.valid;
|
|
73
60
|
const availableRuntimes = [...await detectAvailableRuntimes()];
|
|
@@ -578,392 +565,12 @@ function registerLensSynthCommand(program) {
|
|
|
578
565
|
});
|
|
579
566
|
}
|
|
580
567
|
|
|
581
|
-
// packages/cli/src/commands/auth.ts
|
|
582
|
-
import { spawn } from "node:child_process";
|
|
583
|
-
import { mkdirSync, writeFileSync, chmodSync, unlinkSync, existsSync as existsSync2 } from "node:fs";
|
|
584
|
-
import { homedir, platform } from "node:os";
|
|
585
|
-
import { join } from "node:path";
|
|
586
|
-
import { randomBytes } from "node:crypto";
|
|
587
|
-
import { setTimeout as delay } from "node:timers/promises";
|
|
588
|
-
var EXIT_OK = 0;
|
|
589
|
-
var EXIT_USER_ERROR = 1;
|
|
590
|
-
var EXIT_AUTH = 2;
|
|
591
|
-
var EXIT_NET = 3;
|
|
592
|
-
function registerAuthCommand(program) {
|
|
593
|
-
const auth = program.command("auth").description("0-cloud authentication");
|
|
594
|
-
auth.command("login").description("Log in to 0-cloud (opens browser; --token to paste directly)").option("--host <url>", "Cloud host (defaults to ZERO_CLOUD_HOST or production)").option("--token <value>", "Skip the browser flow and persist this token directly").action(async (opts) => {
|
|
595
|
-
await runLogin(opts);
|
|
596
|
-
});
|
|
597
|
-
auth.command("logout").description("Delete credentials for the current Cloud profile").action(() => {
|
|
598
|
-
runLogout({});
|
|
599
|
-
});
|
|
600
|
-
auth.command("status").description("Verify 0-cloud credentials and account access").action(async () => {
|
|
601
|
-
await runStatus({});
|
|
602
|
-
});
|
|
603
|
-
}
|
|
604
|
-
async function hostedBrowserLoginFlow(opts = {}) {
|
|
605
|
-
const host = normaliseHostArg(opts.host ?? process.env["ZERO_CLOUD_HOST"] ?? DEFAULT_CLOUD_HOST);
|
|
606
|
-
if (host === null) {
|
|
607
|
-
return { ok: false, error: "Cloud host must be an http(s) URL without credentials, query or fragment." };
|
|
608
|
-
}
|
|
609
|
-
const attempts = opts.pollAttempts ?? 150;
|
|
610
|
-
const intervalMs = opts.pollIntervalMs ?? 2e3;
|
|
611
|
-
if (!Number.isSafeInteger(attempts) || attempts <= 0 || !Number.isFinite(intervalMs) || intervalMs < 0) {
|
|
612
|
-
return { ok: false, error: "Invalid sign-in polling budget." };
|
|
613
|
-
}
|
|
614
|
-
const cancelled = () => {
|
|
615
|
-
opts.onStatus?.("cancelled", "Sign-in cancelled.");
|
|
616
|
-
return { ok: false, error: "Sign-in cancelled.", recoverable: true, cancelled: true };
|
|
617
|
-
};
|
|
618
|
-
if (opts.signal?.aborted) return cancelled();
|
|
619
|
-
const deadline = new AbortController();
|
|
620
|
-
const timer = setTimeout(() => deadline.abort(), 3e5);
|
|
621
|
-
const signal = opts.signal ? AbortSignal.any([opts.signal, deadline.signal]) : deadline.signal;
|
|
622
|
-
const session = randomBytes(9).toString("base64url").slice(0, 12);
|
|
623
|
-
const loginUrl = `${host}/cli-auth?session=${session}`;
|
|
624
|
-
const pollUrl = `${host}/cli-auth/sessions/${session}`;
|
|
625
|
-
const timedOut = () => {
|
|
626
|
-
opts.onStatus?.("timeout", "Sign-in timed out. Try again.");
|
|
627
|
-
return { ok: false, error: "Sign-in timed out. Try again.", recoverable: true };
|
|
628
|
-
};
|
|
629
|
-
try {
|
|
630
|
-
opts.onStatus?.("opening", "Opening browser for 0cloud sign-in.", loginUrl);
|
|
631
|
-
signal.throwIfAborted();
|
|
632
|
-
try {
|
|
633
|
-
await awaitLoginStep(Promise.resolve().then(() => {
|
|
634
|
-
signal.throwIfAborted();
|
|
635
|
-
return (opts.openBrowser ?? defaultOpenBrowser)(loginUrl);
|
|
636
|
-
}), signal);
|
|
637
|
-
} catch {
|
|
638
|
-
signal.throwIfAborted();
|
|
639
|
-
opts.onStatus?.("opener-failed", "Could not open a browser. Open this sign-in URL manually.", loginUrl);
|
|
640
|
-
}
|
|
641
|
-
const fetcher = opts.fetchImpl ?? fetch;
|
|
642
|
-
for (let i = 0; i < attempts; i++) {
|
|
643
|
-
signal.throwIfAborted();
|
|
644
|
-
opts.onStatus?.("polling", "Waiting for browser sign-in.", loginUrl);
|
|
645
|
-
signal.throwIfAborted();
|
|
646
|
-
await awaitLoginStep(
|
|
647
|
-
opts.sleep ? opts.sleep(intervalMs) : delay(intervalMs, void 0, { signal }),
|
|
648
|
-
signal
|
|
649
|
-
);
|
|
650
|
-
signal.throwIfAborted();
|
|
651
|
-
const request = new AbortController();
|
|
652
|
-
const requestTimer = setTimeout(() => request.abort(), 1e4);
|
|
653
|
-
const requestSignal = AbortSignal.any([signal, request.signal]);
|
|
654
|
-
try {
|
|
655
|
-
let res;
|
|
656
|
-
try {
|
|
657
|
-
res = await awaitLoginStep(fetcher(pollUrl, {
|
|
658
|
-
method: "GET",
|
|
659
|
-
headers: { Accept: "application/json" },
|
|
660
|
-
signal: requestSignal,
|
|
661
|
-
redirect: "error"
|
|
662
|
-
}), requestSignal);
|
|
663
|
-
} catch {
|
|
664
|
-
signal.throwIfAborted();
|
|
665
|
-
continue;
|
|
666
|
-
}
|
|
667
|
-
signal.throwIfAborted();
|
|
668
|
-
if (res.status === 200) {
|
|
669
|
-
let body;
|
|
670
|
-
try {
|
|
671
|
-
body = await awaitLoginStep(res.json(), requestSignal);
|
|
672
|
-
} catch {
|
|
673
|
-
signal.throwIfAborted();
|
|
674
|
-
if (requestSignal.aborted) continue;
|
|
675
|
-
return { ok: false, error: "Login response was not valid JSON." };
|
|
676
|
-
}
|
|
677
|
-
signal.throwIfAborted();
|
|
678
|
-
const rawStatus = body && typeof body === "object" ? body.status : void 0;
|
|
679
|
-
const status = sessionStatus(body);
|
|
680
|
-
const token = extractToken(body);
|
|
681
|
-
if (token) {
|
|
682
|
-
if (rawStatus !== void 0 && status !== "ready") {
|
|
683
|
-
return { ok: false, error: "Login returned credentials before the session was ready." };
|
|
684
|
-
}
|
|
685
|
-
try {
|
|
686
|
-
persistCredentials(host, token, opts.homeDir);
|
|
687
|
-
} catch {
|
|
688
|
-
return { ok: false, error: "Could not save 0cloud credentials." };
|
|
689
|
-
}
|
|
690
|
-
opts.onStatus?.("ready", "Signed in to 0cloud.");
|
|
691
|
-
return { ok: true, host };
|
|
692
|
-
}
|
|
693
|
-
if (status === "pending") continue;
|
|
694
|
-
if (status === "expired") return { ok: false, error: "Sign-in request expired. Try again.", recoverable: true };
|
|
695
|
-
return { ok: false, error: "Login response did not contain valid credentials." };
|
|
696
|
-
}
|
|
697
|
-
if ([202, 204, 404].includes(res.status)) continue;
|
|
698
|
-
if (res.status === 410) return { ok: false, error: "Sign-in request expired. Try again.", recoverable: true };
|
|
699
|
-
return {
|
|
700
|
-
ok: false,
|
|
701
|
-
error: `0cloud sign-in unavailable (HTTP ${res.status}). Use your own provider or try again later.`,
|
|
702
|
-
recoverable: res.status === 429 || res.status >= 500
|
|
703
|
-
};
|
|
704
|
-
} finally {
|
|
705
|
-
clearTimeout(requestTimer);
|
|
706
|
-
request.abort();
|
|
707
|
-
}
|
|
708
|
-
}
|
|
709
|
-
return timedOut();
|
|
710
|
-
} catch (error) {
|
|
711
|
-
if (opts.signal?.aborted) return cancelled();
|
|
712
|
-
if (deadline.signal.aborted) return timedOut();
|
|
713
|
-
throw error;
|
|
714
|
-
} finally {
|
|
715
|
-
clearTimeout(timer);
|
|
716
|
-
}
|
|
717
|
-
}
|
|
718
|
-
async function awaitLoginStep(operation, signal) {
|
|
719
|
-
return new Promise((resolve4, reject) => {
|
|
720
|
-
const onAbort = () => {
|
|
721
|
-
signal.removeEventListener("abort", onAbort);
|
|
722
|
-
reject(signal.reason);
|
|
723
|
-
};
|
|
724
|
-
operation.then(
|
|
725
|
-
(value) => {
|
|
726
|
-
signal.removeEventListener("abort", onAbort);
|
|
727
|
-
resolve4(value);
|
|
728
|
-
},
|
|
729
|
-
(error) => {
|
|
730
|
-
signal.removeEventListener("abort", onAbort);
|
|
731
|
-
reject(error);
|
|
732
|
-
}
|
|
733
|
-
);
|
|
734
|
-
if (signal.aborted) onAbort();
|
|
735
|
-
else signal.addEventListener("abort", onAbort, { once: true });
|
|
736
|
-
});
|
|
737
|
-
}
|
|
738
|
-
async function runLogin(opts) {
|
|
739
|
-
const host = normaliseHostArg(opts.host ?? process.env["ZERO_CLOUD_HOST"] ?? DEFAULT_CLOUD_HOST);
|
|
740
|
-
if (host === null) {
|
|
741
|
-
consolePresentationOutput.stderr(source_default.red("Error: Cloud host must be an http(s) URL without credentials, query or fragment."), "auth.login.host-error");
|
|
742
|
-
process.exitCode = EXIT_USER_ERROR;
|
|
743
|
-
return;
|
|
744
|
-
}
|
|
745
|
-
if (opts.token !== void 0) {
|
|
746
|
-
const tok = opts.token.trim();
|
|
747
|
-
if (!validCloudToken(tok)) {
|
|
748
|
-
consolePresentationOutput.stderr(source_default.red("Error: --token must be a nonempty credential without whitespace."), "auth.login.token-empty");
|
|
749
|
-
process.exitCode = EXIT_USER_ERROR;
|
|
750
|
-
return;
|
|
751
|
-
}
|
|
752
|
-
try {
|
|
753
|
-
persistCredentials(host, tok, opts.homeDir);
|
|
754
|
-
} catch {
|
|
755
|
-
consolePresentationOutput.stderr(source_default.red("Could not save 0cloud credentials."), "auth.login.save-error");
|
|
756
|
-
process.exitCode = EXIT_USER_ERROR;
|
|
757
|
-
return;
|
|
758
|
-
}
|
|
759
|
-
consolePresentationOutput.stdout(`Logged in (host=${host})`, "auth.login.logged-in");
|
|
760
|
-
process.exitCode = EXIT_OK;
|
|
761
|
-
return;
|
|
762
|
-
}
|
|
763
|
-
const result = await hostedBrowserLoginFlow({
|
|
764
|
-
host,
|
|
765
|
-
pollAttempts: opts.pollAttempts,
|
|
766
|
-
pollIntervalMs: opts.pollIntervalMs,
|
|
767
|
-
openBrowser: opts.openBrowser,
|
|
768
|
-
fetchImpl: opts.fetchImpl,
|
|
769
|
-
homeDir: opts.homeDir,
|
|
770
|
-
sleep: opts.sleep,
|
|
771
|
-
onStatus: (phase, msg, url) => {
|
|
772
|
-
if (phase === "opening") {
|
|
773
|
-
consolePresentationOutput.stdout(source_default.dim("Opening browser..."), "auth.login.opening");
|
|
774
|
-
if (url) consolePresentationOutput.stdout(source_default.dim(` ${url}`), "auth.login.url");
|
|
775
|
-
consolePresentationOutput.stdout("", "auth.login.empty-line");
|
|
776
|
-
consolePresentationOutput.stdout(source_default.dim("Complete sign-in in the opened browser, then return here."), "auth.login.browser-hint");
|
|
777
|
-
consolePresentationOutput.stdout("", "auth.login.empty-line");
|
|
778
|
-
}
|
|
779
|
-
if (phase === "opener-failed") {
|
|
780
|
-
consolePresentationOutput.stderr(source_default.yellow(msg), "auth.login.browser-error");
|
|
781
|
-
}
|
|
782
|
-
}
|
|
783
|
-
});
|
|
784
|
-
if (result.ok) {
|
|
785
|
-
consolePresentationOutput.stdout(`Logged in (host=${result.host})`, "auth.login.logged-in");
|
|
786
|
-
process.exitCode = EXIT_OK;
|
|
787
|
-
} else {
|
|
788
|
-
consolePresentationOutput.stderr(source_default.red(result.error), "auth.login.error");
|
|
789
|
-
process.exitCode = result.recoverable ? EXIT_NET : EXIT_USER_ERROR;
|
|
790
|
-
}
|
|
791
|
-
}
|
|
792
|
-
function runLogout(opts) {
|
|
793
|
-
const home = opts.homeDir ?? homedir();
|
|
794
|
-
const stateDir = cloudStateDir(opts.homeDir);
|
|
795
|
-
const osecPath = join(stateDir, "cloud.env");
|
|
796
|
-
const cloudCredsPath = join(home, ".0cloud", "credentials.json");
|
|
797
|
-
let deletedAny = false;
|
|
798
|
-
try {
|
|
799
|
-
unlinkSync(osecPath);
|
|
800
|
-
deletedAny = true;
|
|
801
|
-
} catch (err) {
|
|
802
|
-
const code = err.code;
|
|
803
|
-
if (code !== "ENOENT") {
|
|
804
|
-
consolePresentationOutput.stderr(source_default.red(`Could not delete ${osecPath}: ${err instanceof Error ? err.message : String(err)}`), "auth.logout.delete-error");
|
|
805
|
-
process.exitCode = EXIT_USER_ERROR;
|
|
806
|
-
return;
|
|
807
|
-
}
|
|
808
|
-
}
|
|
809
|
-
if (stateDir === homeStateDir(opts.homeDir)) {
|
|
810
|
-
try {
|
|
811
|
-
unlinkSync(cloudCredsPath);
|
|
812
|
-
deletedAny = true;
|
|
813
|
-
} catch (err) {
|
|
814
|
-
const code = err !== null && typeof err === "object" && "code" in err ? err.code : void 0;
|
|
815
|
-
if (code !== "ENOENT") {
|
|
816
|
-
consolePresentationOutput.stderr(source_default.red(`Could not delete ${cloudCredsPath}: ${err instanceof Error ? err.message : String(err)}`), "auth.logout.delete-error");
|
|
817
|
-
process.exitCode = EXIT_USER_ERROR;
|
|
818
|
-
return;
|
|
819
|
-
}
|
|
820
|
-
}
|
|
821
|
-
}
|
|
822
|
-
if (deletedAny) {
|
|
823
|
-
consolePresentationOutput.stdout("Logged out", "auth.logout.deleted");
|
|
824
|
-
} else {
|
|
825
|
-
consolePresentationOutput.stdout("Logged out (no credentials file was present)", "auth.logout.not-found");
|
|
826
|
-
}
|
|
827
|
-
process.exitCode = EXIT_OK;
|
|
828
|
-
}
|
|
829
|
-
async function runStatus(opts) {
|
|
830
|
-
let creds;
|
|
831
|
-
try {
|
|
832
|
-
const c = loadCloudCredentials();
|
|
833
|
-
creds = { host: c.host, token: c.token };
|
|
834
|
-
} catch (err) {
|
|
835
|
-
if (err instanceof CloudAuthMissingError) {
|
|
836
|
-
consolePresentationOutput.stderr(source_default.red(err.message), "auth.status.auth-missing");
|
|
837
|
-
process.exitCode = EXIT_AUTH;
|
|
838
|
-
return;
|
|
839
|
-
}
|
|
840
|
-
consolePresentationOutput.stderr(source_default.red(err instanceof Error ? err.message : String(err)), "auth.status.load-error");
|
|
841
|
-
process.exitCode = EXIT_AUTH;
|
|
842
|
-
return;
|
|
843
|
-
}
|
|
844
|
-
const client = new CloudClient({ ...creds, fetchImpl: opts.fetchImpl });
|
|
845
|
-
try {
|
|
846
|
-
await client.getInferenceAccount();
|
|
847
|
-
consolePresentationOutput.stdout(`OK (host=${creds.host})`, "auth.status.ok");
|
|
848
|
-
process.exitCode = EXIT_OK;
|
|
849
|
-
} catch (err) {
|
|
850
|
-
handleStatusError(err);
|
|
851
|
-
}
|
|
852
|
-
}
|
|
853
|
-
function handleStatusError(err) {
|
|
854
|
-
if (err instanceof CloudUnauthorizedError) {
|
|
855
|
-
consolePresentationOutput.stderr("FAIL (HTTP 401)", "auth.status.unauthorized");
|
|
856
|
-
process.exitCode = EXIT_AUTH;
|
|
857
|
-
return;
|
|
858
|
-
}
|
|
859
|
-
if (err instanceof CloudForbiddenError) {
|
|
860
|
-
consolePresentationOutput.stderr(source_default.red(`FAIL (HTTP 403) \u2014 status: ${err.message}`), "auth.status.forbidden");
|
|
861
|
-
process.exitCode = EXIT_AUTH;
|
|
862
|
-
return;
|
|
863
|
-
}
|
|
864
|
-
if (err instanceof CloudNetworkError) {
|
|
865
|
-
consolePresentationOutput.stderr(source_default.red(`FAIL (network) \u2014 status: ${err.message}`), "auth.status.network-error");
|
|
866
|
-
process.exitCode = EXIT_NET;
|
|
867
|
-
return;
|
|
868
|
-
}
|
|
869
|
-
if (err instanceof CloudError) {
|
|
870
|
-
consolePresentationOutput.stderr(source_default.red(`FAIL (HTTP ${err.status ?? "?"}) \u2014 status`), "auth.status.cloud-error");
|
|
871
|
-
process.exitCode = EXIT_USER_ERROR;
|
|
872
|
-
return;
|
|
873
|
-
}
|
|
874
|
-
consolePresentationOutput.stderr(source_default.red(`FAIL \u2014 status: ${err instanceof Error ? err.message : String(err)}`), "auth.status.error");
|
|
875
|
-
process.exitCode = EXIT_USER_ERROR;
|
|
876
|
-
}
|
|
877
|
-
function normaliseHostArg(host) {
|
|
878
|
-
if (!host?.trim()) return null;
|
|
879
|
-
try {
|
|
880
|
-
const url = new URL(host.trim());
|
|
881
|
-
if (!["http:", "https:"].includes(url.protocol) || url.username || url.password || url.search || url.hash) return null;
|
|
882
|
-
return url.href.replace(/\/+$/, "");
|
|
883
|
-
} catch {
|
|
884
|
-
return null;
|
|
885
|
-
}
|
|
886
|
-
}
|
|
887
|
-
function persistCredentials(host, token, homeDirOverride) {
|
|
888
|
-
if (!validCloudToken(token)) throw new Error("Invalid Cloud credential");
|
|
889
|
-
const home = homeDirOverride ?? homedir();
|
|
890
|
-
const dir = cloudStateDir(homeDirOverride);
|
|
891
|
-
mkdirSync(dir, { recursive: true, mode: 448 });
|
|
892
|
-
const path = join(dir, "cloud.env");
|
|
893
|
-
const body = `# 0-cloud credentials. Managed by \`0 auth\`.
|
|
894
|
-
# DO NOT commit this file or share its contents.
|
|
895
|
-
ZERO_CLOUD_HOST=${host}
|
|
896
|
-
ZERO_CLOUD_TOKEN=${token}
|
|
897
|
-
`;
|
|
898
|
-
writeFileSync(path, body, { mode: 384 });
|
|
899
|
-
chmodSync(path, 384);
|
|
900
|
-
if (!existsSync2(path)) {
|
|
901
|
-
return;
|
|
902
|
-
}
|
|
903
|
-
if (dir !== homeStateDir(homeDirOverride)) return;
|
|
904
|
-
try {
|
|
905
|
-
const cloudDir = join(home, ".0cloud");
|
|
906
|
-
mkdirSync(cloudDir, { recursive: true });
|
|
907
|
-
const cloudCredsPath = join(cloudDir, "credentials.json");
|
|
908
|
-
const trimmedHost = host.replace(/\/+$/, "");
|
|
909
|
-
const apiEndpoint = trimmedHost.endsWith("/api") ? trimmedHost : `${trimmedHost}/api`;
|
|
910
|
-
const cloudCreds = JSON.stringify(
|
|
911
|
-
{
|
|
912
|
-
token,
|
|
913
|
-
orgId: "",
|
|
914
|
-
endpoint: apiEndpoint,
|
|
915
|
-
dashboardUrl: host,
|
|
916
|
-
createdAt: (/* @__PURE__ */ new Date()).toISOString()
|
|
917
|
-
},
|
|
918
|
-
null,
|
|
919
|
-
2
|
|
920
|
-
) + "\n";
|
|
921
|
-
writeFileSync(cloudCredsPath, cloudCreds, { mode: 384 });
|
|
922
|
-
chmodSync(cloudCredsPath, 384);
|
|
923
|
-
} catch {
|
|
924
|
-
}
|
|
925
|
-
}
|
|
926
|
-
function sessionStatus(body) {
|
|
927
|
-
if (!body || typeof body !== "object") return void 0;
|
|
928
|
-
const status = body.status;
|
|
929
|
-
return status === "pending" || status === "ready" || status === "expired" ? status : void 0;
|
|
930
|
-
}
|
|
931
|
-
function validCloudToken(value) {
|
|
932
|
-
return typeof value === "string" && value.trim().length > 0 && !/[\s\x00-\x1f\x7f]/.test(value.trim());
|
|
933
|
-
}
|
|
934
|
-
function extractToken(body) {
|
|
935
|
-
if (!body || typeof body !== "object") return null;
|
|
936
|
-
const obj = body;
|
|
937
|
-
const candidates = [obj.token, obj.access_token];
|
|
938
|
-
for (const c of candidates) {
|
|
939
|
-
if (validCloudToken(c)) return c.trim();
|
|
940
|
-
}
|
|
941
|
-
return null;
|
|
942
|
-
}
|
|
943
|
-
function defaultOpenBrowser(url) {
|
|
944
|
-
const plat = platform();
|
|
945
|
-
return new Promise((resolve4, reject) => {
|
|
946
|
-
const options = { detached: true, stdio: "ignore", shell: false };
|
|
947
|
-
const child = plat === "darwin" ? spawn("open", [url], options) : plat === "win32" ? spawn("powershell.exe", [
|
|
948
|
-
"-NoProfile",
|
|
949
|
-
"-NonInteractive",
|
|
950
|
-
"-Command",
|
|
951
|
-
"Start-Process -FilePath $env:OSEC_BROWSER_LOGIN_URL"
|
|
952
|
-
], { ...options, env: { ...process.env, OSEC_BROWSER_LOGIN_URL: url } }) : spawn("xdg-open", [url], options);
|
|
953
|
-
child.once("error", reject);
|
|
954
|
-
child.once("spawn", () => {
|
|
955
|
-
child.unref();
|
|
956
|
-
resolve4();
|
|
957
|
-
});
|
|
958
|
-
});
|
|
959
|
-
}
|
|
960
|
-
|
|
961
568
|
// packages/cli/src/commands/run.ts
|
|
962
569
|
import { writeFile } from "node:fs/promises";
|
|
963
|
-
import { join
|
|
570
|
+
import { join, resolve as resolve3 } from "node:path";
|
|
964
571
|
import { tmpdir } from "node:os";
|
|
965
572
|
import { execFile } from "node:child_process";
|
|
966
|
-
import { existsSync as
|
|
573
|
+
import { existsSync as existsSync2 } from "node:fs";
|
|
967
574
|
import { fileURLToPath } from "node:url";
|
|
968
575
|
|
|
969
576
|
// packages/cli/src/formatters/terminal.ts
|
|
@@ -2532,8 +2139,8 @@ var coreModulePromise = null;
|
|
|
2532
2139
|
async function loadCoreModule() {
|
|
2533
2140
|
if (!coreModulePromise) {
|
|
2534
2141
|
const srcUrl = new URL("../../../core/src/index.ts", import.meta.url);
|
|
2535
|
-
const srcExists = process.versions.bun &&
|
|
2536
|
-
coreModulePromise = srcExists ? import(srcUrl.href) : import("./dist-
|
|
2142
|
+
const srcExists = process.versions.bun && existsSync2(fileURLToPath(srcUrl));
|
|
2143
|
+
coreModulePromise = srcExists ? import(srcUrl.href) : import("./dist-L3XJWWZ6.js");
|
|
2537
2144
|
}
|
|
2538
2145
|
return coreModulePromise;
|
|
2539
2146
|
}
|
|
@@ -2577,17 +2184,9 @@ function getTargetType(report, opts) {
|
|
|
2577
2184
|
return report?.targetType ?? opts.targetType;
|
|
2578
2185
|
}
|
|
2579
2186
|
function emitResultLine(payload) {
|
|
2580
|
-
if (process.env["ZERO_EMIT_RESULT_LINE"] !== "1"
|
|
2187
|
+
if (process.env["ZERO_EMIT_RESULT_LINE"] !== "1") return;
|
|
2581
2188
|
console.log(`ZERO_RESULT=${JSON.stringify(payload)}`);
|
|
2582
2189
|
}
|
|
2583
|
-
function getCloudFinalSinkConfig() {
|
|
2584
|
-
if (process.env["ZERO_FEATURE_CLOUD_SINK"] === "0") return null;
|
|
2585
|
-
const sinkUrl = process.env["ZERO_CLOUD_SINK"]?.trim();
|
|
2586
|
-
const scanId = process.env["ZERO_CLOUD_SCAN_ID"]?.trim();
|
|
2587
|
-
if (!sinkUrl || !scanId) return null;
|
|
2588
|
-
const token = process.env["ZERO_CLOUD_TOKEN"]?.trim() || void 0;
|
|
2589
|
-
return { sinkUrl, scanId, token };
|
|
2590
|
-
}
|
|
2591
2190
|
function isCostBreakdownEntry(value) {
|
|
2592
2191
|
if (!value || typeof value !== "object") return false;
|
|
2593
2192
|
const entry = value;
|
|
@@ -2659,34 +2258,6 @@ function printCrossValidatedLeads(summary) {
|
|
|
2659
2258
|
console.log(source_default.gray(` +${summary.moreCount} more`));
|
|
2660
2259
|
}
|
|
2661
2260
|
}
|
|
2662
|
-
async function postFinalResultToCloud(report) {
|
|
2663
|
-
const config = getCloudFinalSinkConfig();
|
|
2664
|
-
if (!config) return;
|
|
2665
|
-
const url = `${config.sinkUrl.replace(/\/+$/, "")}/scans/${encodeURIComponent(config.scanId)}/findings`;
|
|
2666
|
-
const headers = {
|
|
2667
|
-
"Content-Type": "application/json",
|
|
2668
|
-
"X-0-Scan-Id": config.scanId
|
|
2669
|
-
};
|
|
2670
|
-
if (config.token) headers.Authorization = `Bearer ${config.token}`;
|
|
2671
|
-
try {
|
|
2672
|
-
const res = await fetch(url, {
|
|
2673
|
-
method: "POST",
|
|
2674
|
-
headers,
|
|
2675
|
-
body: JSON.stringify({ report, final: true })
|
|
2676
|
-
});
|
|
2677
|
-
if (!res.ok) {
|
|
2678
|
-
const text = await res.text().catch(() => "");
|
|
2679
|
-
process.stderr.write(
|
|
2680
|
-
`[0 cloud-sink] report POST ${url} returned ${res.status}: ${text.slice(0, 200)}
|
|
2681
|
-
`
|
|
2682
|
-
);
|
|
2683
|
-
}
|
|
2684
|
-
} catch (err) {
|
|
2685
|
-
const msg = err instanceof Error ? err.message : String(err);
|
|
2686
|
-
process.stderr.write(`[0 cloud-sink] report POST ${url} failed: ${msg}
|
|
2687
|
-
`);
|
|
2688
|
-
}
|
|
2689
|
-
}
|
|
2690
2261
|
async function runUnified(opts) {
|
|
2691
2262
|
const { target, depth, format, runtime, timeout } = opts;
|
|
2692
2263
|
const core = await loadCoreModule();
|
|
@@ -2696,7 +2267,7 @@ async function runUnified(opts) {
|
|
|
2696
2267
|
console.error(source_default.red("--branch-from requires --resume <run-id>"));
|
|
2697
2268
|
process.exit(2);
|
|
2698
2269
|
}
|
|
2699
|
-
const { branchJournal } = await import("./dist-
|
|
2270
|
+
const { branchJournal } = await import("./dist-L3XJWWZ6.js");
|
|
2700
2271
|
const result = branchJournal({
|
|
2701
2272
|
runId: effectiveResumeScanId,
|
|
2702
2273
|
fromEntry: opts.branchFromEntry
|
|
@@ -2753,7 +2324,7 @@ async function runUnified(opts) {
|
|
|
2753
2324
|
} else {
|
|
2754
2325
|
const { isBunRuntime } = await import("./runtime-XFWJTBUO.js");
|
|
2755
2326
|
if (isBunRuntime()) {
|
|
2756
|
-
const { createOpenTuiSession } = await import("./run-
|
|
2327
|
+
const { createOpenTuiSession } = await import("./run-GAFKBCTN.js");
|
|
2757
2328
|
const availability = await getRuntimeAvailability();
|
|
2758
2329
|
inkUI = await createOpenTuiSession({
|
|
2759
2330
|
target,
|
|
@@ -2842,16 +2413,13 @@ async function runUnified(opts) {
|
|
|
2842
2413
|
}
|
|
2843
2414
|
const reportAny = report;
|
|
2844
2415
|
const canonicalReport = toScanReport(report);
|
|
2845
|
-
if (opts.targetType !== "url" && opts.targetType !== "web-app") {
|
|
2846
|
-
await postFinalResultToCloud(reportAny);
|
|
2847
|
-
}
|
|
2848
2416
|
if (inkUI) {
|
|
2849
2417
|
inkUI.setReport(report);
|
|
2850
2418
|
await inkUI.waitForExit();
|
|
2851
2419
|
} else {
|
|
2852
2420
|
if (format === "html" || format === "pdf") {
|
|
2853
2421
|
const extension = format === "pdf" ? "pdf" : "html";
|
|
2854
|
-
const filePath = opts.reportPath ? resolve3(opts.reportPath) :
|
|
2422
|
+
const filePath = opts.reportPath ? resolve3(opts.reportPath) : join(tmpdir(), `0-report-${Date.now()}.${extension}`);
|
|
2855
2423
|
if (format === "pdf") {
|
|
2856
2424
|
await generatePdfReport(toScanReport(reportAny), filePath);
|
|
2857
2425
|
} else {
|
|
@@ -2887,8 +2455,8 @@ async function runUnified(opts) {
|
|
|
2887
2455
|
if (opts.emit === "pr") {
|
|
2888
2456
|
const findings = report.findings ?? [];
|
|
2889
2457
|
const core2 = await loadCoreModule();
|
|
2890
|
-
const repoRoot = opts.targetType === "source-code" &&
|
|
2891
|
-
const outDir = opts.emitOutDir ??
|
|
2458
|
+
const repoRoot = opts.targetType === "source-code" && existsSync2(target) ? resolve3(target) : process.cwd();
|
|
2459
|
+
const outDir = opts.emitOutDir ?? join(tmpdir(), `0-emit-${Date.now()}`);
|
|
2892
2460
|
console.log(source_default.blue(`[emit pr] ${findings.length} finding(s); repo=${repoRoot} base=${opts.emitPrBase ?? "main"}${opts.emitPrDryRun ? " (dry-run)" : ""}`));
|
|
2893
2461
|
const emitReport = await core2.emitFindingsAsPRs(findings, {
|
|
2894
2462
|
repoRoot,
|
|
@@ -2999,13 +2567,18 @@ var DEFAULT_ENCODED_RUN_MAX = 140;
|
|
|
2999
2567
|
var ENCODED_RUN_MAX_CAP = 1e6;
|
|
3000
2568
|
var ELLIPSIS = "...";
|
|
3001
2569
|
var ENCODED_PLACEHOLDER = "[encoded payload omitted]";
|
|
2570
|
+
var DEFAULT_ENCODED_SEGMENT = new RegExp(`[A-Za-z0-9+_-]{${DEFAULT_ENCODED_RUN_MAX},}={0,2}`, "g");
|
|
2571
|
+
var DEFAULT_ENCODED_DATA_URI = new RegExp(`(data:[^\\s,]*;base64,)[A-Za-z0-9+/_-]{${DEFAULT_ENCODED_RUN_MAX},}={0,2}`, "gi");
|
|
3002
2572
|
function stripTerminalControl(text) {
|
|
3003
2573
|
return text.replace(/\x1b\][^\x07\x1b]*(?:\x07|\x1b\\)/g, "").replace(/\x1b\[[0-?]*[ -/]*[@-~]/g, "").replace(/[\x00-\x08\x0b-\x1f\x7f]/g, "");
|
|
3004
2574
|
}
|
|
3005
2575
|
function replaceLargeEncodedChunks(text, maxEncodedRun) {
|
|
3006
2576
|
const normalized = Number.isFinite(maxEncodedRun) ? Math.trunc(maxEncodedRun) : DEFAULT_ENCODED_RUN_MAX;
|
|
3007
2577
|
const minRun = Math.min(Math.max(32, normalized), ENCODED_RUN_MAX_CAP);
|
|
3008
|
-
|
|
2578
|
+
if (text.length < minRun) return text;
|
|
2579
|
+
const segment = minRun === DEFAULT_ENCODED_RUN_MAX ? DEFAULT_ENCODED_SEGMENT : new RegExp(`[A-Za-z0-9+_-]{${minRun},}={0,2}`, "g");
|
|
2580
|
+
const dataUri = minRun === DEFAULT_ENCODED_RUN_MAX ? DEFAULT_ENCODED_DATA_URI : new RegExp(`(data:[^\\s,]*;base64,)[A-Za-z0-9+/_-]{${minRun},}={0,2}`, "gi");
|
|
2581
|
+
return text.replace(dataUri, `$1${ENCODED_PLACEHOLDER}`).replace(segment, ENCODED_PLACEHOLDER);
|
|
3009
2582
|
}
|
|
3010
2583
|
function sanitizeTuiText(value, options = {}) {
|
|
3011
2584
|
return stripTerminalControl(replaceLargeEncodedChunks(String(value ?? ""), options.maxEncodedRun ?? DEFAULT_ENCODED_RUN_MAX)).replace(/\s+/g, " ").trim();
|
|
@@ -3129,7 +2702,8 @@ var SLASH_COMMANDS = [
|
|
|
3129
2702
|
aliases: ["caps"],
|
|
3130
2703
|
category: "info",
|
|
3131
2704
|
description: "Show the harness capability map and its safety gates",
|
|
3132
|
-
usage: "/capabilities"
|
|
2705
|
+
usage: "/capabilities",
|
|
2706
|
+
tuiOnly: true
|
|
3133
2707
|
},
|
|
3134
2708
|
{
|
|
3135
2709
|
name: "status",
|
|
@@ -3143,20 +2717,6 @@ var SLASH_COMMANDS = [
|
|
|
3143
2717
|
category: "info",
|
|
3144
2718
|
description: "List available tools"
|
|
3145
2719
|
},
|
|
3146
|
-
{
|
|
3147
|
-
name: "agents",
|
|
3148
|
-
aliases: [],
|
|
3149
|
-
category: "info",
|
|
3150
|
-
description: "List available agents",
|
|
3151
|
-
tuiOnly: true
|
|
3152
|
-
},
|
|
3153
|
-
{
|
|
3154
|
-
name: "harness",
|
|
3155
|
-
aliases: [],
|
|
3156
|
-
category: "navigation",
|
|
3157
|
-
description: "Live harness: views, commands, settings, rollback and workspace trust",
|
|
3158
|
-
tuiOnly: true
|
|
3159
|
-
},
|
|
3160
2720
|
{
|
|
3161
2721
|
name: "new-chat",
|
|
3162
2722
|
aliases: ["new"],
|
|
@@ -3164,13 +2724,6 @@ var SLASH_COMMANDS = [
|
|
|
3164
2724
|
description: "Create an independent audit using the staged model and connection",
|
|
3165
2725
|
tuiOnly: true
|
|
3166
2726
|
},
|
|
3167
|
-
{
|
|
3168
|
-
name: "audits",
|
|
3169
|
-
aliases: [],
|
|
3170
|
-
category: "navigation",
|
|
3171
|
-
description: "Switch between live audits without stopping their work",
|
|
3172
|
-
tuiOnly: true
|
|
3173
|
-
},
|
|
3174
2727
|
{
|
|
3175
2728
|
name: "onboard",
|
|
3176
2729
|
aliases: [],
|
|
@@ -3178,14 +2731,6 @@ var SLASH_COMMANDS = [
|
|
|
3178
2731
|
description: "Reopen guided setup without replacing the current audit",
|
|
3179
2732
|
tuiOnly: true
|
|
3180
2733
|
},
|
|
3181
|
-
{
|
|
3182
|
-
name: "stop",
|
|
3183
|
-
aliases: [],
|
|
3184
|
-
category: "session",
|
|
3185
|
-
description: "Stop this audit's work or one owned worker and its descendants",
|
|
3186
|
-
usage: "/stop audit | /stop worker <exact name or id>",
|
|
3187
|
-
tuiOnly: true
|
|
3188
|
-
},
|
|
3189
2734
|
// ── session ─────────────────────────────────────────────────────────────
|
|
3190
2735
|
{
|
|
3191
2736
|
name: "clear",
|
|
@@ -3200,13 +2745,6 @@ var SLASH_COMMANDS = [
|
|
|
3200
2745
|
description: "Browse previous scan runs and their results",
|
|
3201
2746
|
tuiOnly: true
|
|
3202
2747
|
},
|
|
3203
|
-
{
|
|
3204
|
-
name: "transcript",
|
|
3205
|
-
aliases: ["review"],
|
|
3206
|
-
category: "session",
|
|
3207
|
-
description: "Show this conversation, including tool details",
|
|
3208
|
-
tuiOnly: true
|
|
3209
|
-
},
|
|
3210
2748
|
{
|
|
3211
2749
|
name: "findings",
|
|
3212
2750
|
aliases: ["finds"],
|
|
@@ -3215,19 +2753,11 @@ var SLASH_COMMANDS = [
|
|
|
3215
2753
|
tuiOnly: true
|
|
3216
2754
|
},
|
|
3217
2755
|
{
|
|
3218
|
-
name: "
|
|
3219
|
-
aliases: ["finding-detail"],
|
|
3220
|
-
category: "session",
|
|
3221
|
-
description: "Open one finding in full detail to read and act on it",
|
|
3222
|
-
usage: "/finding [id]",
|
|
3223
|
-
tuiOnly: true
|
|
3224
|
-
},
|
|
3225
|
-
{
|
|
3226
|
-
name: "impact",
|
|
2756
|
+
name: "fix",
|
|
3227
2757
|
aliases: [],
|
|
3228
2758
|
category: "session",
|
|
3229
|
-
description: "
|
|
3230
|
-
usage: "/
|
|
2759
|
+
description: "Generate a verified local source fix; review before explicitly publishing a draft PR",
|
|
2760
|
+
usage: "/fix [finding-id] | /fix publish <finding-id> | /fix cancel",
|
|
3231
2761
|
tuiOnly: true
|
|
3232
2762
|
},
|
|
3233
2763
|
{
|
|
@@ -3239,25 +2769,11 @@ var SLASH_COMMANDS = [
|
|
|
3239
2769
|
tuiOnly: true
|
|
3240
2770
|
},
|
|
3241
2771
|
{
|
|
3242
|
-
name: "
|
|
2772
|
+
name: "sessions",
|
|
3243
2773
|
aliases: [],
|
|
3244
2774
|
category: "session",
|
|
3245
|
-
description: "
|
|
3246
|
-
|
|
3247
|
-
},
|
|
3248
|
-
{
|
|
3249
|
-
name: "resume",
|
|
3250
|
-
aliases: ["sessions"],
|
|
3251
|
-
category: "session",
|
|
3252
|
-
description: "Find and resume saved conversations",
|
|
3253
|
-
usage: "/resume"
|
|
3254
|
-
},
|
|
3255
|
-
{
|
|
3256
|
-
name: "providers",
|
|
3257
|
-
aliases: [],
|
|
3258
|
-
category: "system",
|
|
3259
|
-
description: "Connection: 0cloud, API keys, or provider subscriptions",
|
|
3260
|
-
usage: "/providers",
|
|
2775
|
+
description: "Switch open sessions or resume saved conversations",
|
|
2776
|
+
usage: "/sessions",
|
|
3261
2777
|
tuiOnly: true
|
|
3262
2778
|
},
|
|
3263
2779
|
{
|
|
@@ -3265,21 +2781,24 @@ var SLASH_COMMANDS = [
|
|
|
3265
2781
|
aliases: ["eli5"],
|
|
3266
2782
|
category: "session",
|
|
3267
2783
|
description: "Explain like I'm five: short sentences and everyday words",
|
|
3268
|
-
usage: "/explain [topic]"
|
|
2784
|
+
usage: "/explain [topic]",
|
|
2785
|
+
tuiOnly: true
|
|
3269
2786
|
},
|
|
3270
2787
|
{
|
|
3271
2788
|
name: "feedback",
|
|
3272
2789
|
aliases: [],
|
|
3273
2790
|
category: "system",
|
|
3274
2791
|
description: "Record feedback about 0 to a local file you control, with optional HTTPS submission",
|
|
3275
|
-
usage: "/feedback <message> | /feedback submit <message> | /feedback send | /feedback cancel"
|
|
2792
|
+
usage: "/feedback <message> | /feedback submit <message> | /feedback send | /feedback cancel",
|
|
2793
|
+
tuiOnly: true
|
|
3276
2794
|
},
|
|
3277
2795
|
{
|
|
3278
2796
|
name: "settings",
|
|
3279
2797
|
aliases: ["config", "prefs"],
|
|
3280
2798
|
category: "system",
|
|
3281
2799
|
description: "Open settings; changes persist between sessions",
|
|
3282
|
-
usage: "/settings"
|
|
2800
|
+
usage: "/settings",
|
|
2801
|
+
tuiOnly: true
|
|
3283
2802
|
},
|
|
3284
2803
|
{
|
|
3285
2804
|
name: "keybindings",
|
|
@@ -3302,7 +2821,8 @@ var SLASH_COMMANDS = [
|
|
|
3302
2821
|
aliases: ["models"],
|
|
3303
2822
|
category: "session",
|
|
3304
2823
|
description: "Show or select a model (TUI: applies to New chat)",
|
|
3305
|
-
usage: "/model [id]"
|
|
2824
|
+
usage: "/model [id]",
|
|
2825
|
+
tuiOnly: true
|
|
3306
2826
|
},
|
|
3307
2827
|
// ── navigation ──────────────────────────────────────────────────────────
|
|
3308
2828
|
{
|
|
@@ -3326,20 +2846,6 @@ var SLASH_COMMANDS = [
|
|
|
3326
2846
|
description: "View active and recent operations",
|
|
3327
2847
|
tuiOnly: true
|
|
3328
2848
|
},
|
|
3329
|
-
{
|
|
3330
|
-
name: "herd",
|
|
3331
|
-
aliases: ["workers"],
|
|
3332
|
-
category: "navigation",
|
|
3333
|
-
description: "Inspect the active harness worker herd",
|
|
3334
|
-
tuiOnly: true
|
|
3335
|
-
},
|
|
3336
|
-
{
|
|
3337
|
-
name: "comms",
|
|
3338
|
-
aliases: ["messages"],
|
|
3339
|
-
category: "navigation",
|
|
3340
|
-
description: "Watch the agent fleet and the messages flowing between agents",
|
|
3341
|
-
tuiOnly: true
|
|
3342
|
-
},
|
|
3343
2849
|
{
|
|
3344
2850
|
name: "hackstore",
|
|
3345
2851
|
aliases: ["store", "market", "marketplace"],
|
|
@@ -3349,9 +2855,9 @@ var SLASH_COMMANDS = [
|
|
|
3349
2855
|
},
|
|
3350
2856
|
{
|
|
3351
2857
|
name: "connect",
|
|
3352
|
-
aliases: [
|
|
2858
|
+
aliases: [],
|
|
3353
2859
|
category: "navigation",
|
|
3354
|
-
description: "Connect
|
|
2860
|
+
description: "Connect your API key or provider subscription",
|
|
3355
2861
|
usage: "/connect",
|
|
3356
2862
|
tuiOnly: true
|
|
3357
2863
|
},
|
|
@@ -3528,7 +3034,7 @@ import { execFile as execFile2 } from "node:child_process";
|
|
|
3528
3034
|
import { createHash as createHash2 } from "node:crypto";
|
|
3529
3035
|
import { appendFileSync, readFileSync as readFileSync2, readdirSync, realpathSync, statSync } from "node:fs";
|
|
3530
3036
|
import { mkdir, mkdtemp, rm } from "node:fs/promises";
|
|
3531
|
-
import { isAbsolute, join as
|
|
3037
|
+
import { isAbsolute, join as join2, relative, sep } from "node:path";
|
|
3532
3038
|
import { pathToFileURL } from "node:url";
|
|
3533
3039
|
import { isDeepStrictEqual, promisify } from "node:util";
|
|
3534
3040
|
var execute = promisify(execFile2);
|
|
@@ -3561,7 +3067,7 @@ function sourceDigest(root) {
|
|
|
3561
3067
|
const entries = readdirSync(directory, { withFileTypes: true }).sort((a, b) => a.name.localeCompare(b.name));
|
|
3562
3068
|
for (const entry of entries) {
|
|
3563
3069
|
if (entry.name.startsWith(".") || Object.hasOwn(ignoredSourceNames, entry.name)) continue;
|
|
3564
|
-
const path =
|
|
3070
|
+
const path = join2(directory, entry.name);
|
|
3565
3071
|
if (entry.isDirectory()) {
|
|
3566
3072
|
visit(path);
|
|
3567
3073
|
continue;
|
|
@@ -3584,7 +3090,7 @@ function sourceDigest(root) {
|
|
|
3584
3090
|
function withDevEngineUpdates(initial, config, closeStore) {
|
|
3585
3091
|
const requestedRoot = process.env["ZERO_DEV_SOURCE_ROOT"];
|
|
3586
3092
|
const root = requestedRoot ? realpathSync(requestedRoot) : void 0;
|
|
3587
|
-
if (root && JSON.parse(readFileSync2(
|
|
3093
|
+
if (root && JSON.parse(readFileSync2(join2(root, "packages/core/package.json"), "utf8")).name !== "@0/core") {
|
|
3588
3094
|
throw new Error("ZERO_DEV_SOURCE_ROOT must identify a 0 development checkout");
|
|
3589
3095
|
}
|
|
3590
3096
|
let current = initial;
|
|
@@ -3611,15 +3117,15 @@ function withDevEngineUpdates(initial, config, closeStore) {
|
|
|
3611
3117
|
let committed = false;
|
|
3612
3118
|
let pendingHarnessSnapshot;
|
|
3613
3119
|
try {
|
|
3614
|
-
const source =
|
|
3120
|
+
const source = join2(root, "packages/core/src");
|
|
3615
3121
|
const digest = sourceDigest(source);
|
|
3616
3122
|
if (digest === activeDigest || digest === rejectedDigest) return;
|
|
3617
3123
|
rejectedDigest = digest;
|
|
3618
3124
|
notify("Building changed development engine source; the current session remains active until handoff.");
|
|
3619
|
-
const generationRoot =
|
|
3125
|
+
const generationRoot = join2(root, "packages/core/.0/dev-engines");
|
|
3620
3126
|
await mkdir(generationRoot, { recursive: true, mode: 448 });
|
|
3621
|
-
directory = await mkdtemp(
|
|
3622
|
-
const result = await execute(process.execPath, [
|
|
3127
|
+
directory = await mkdtemp(join2(generationRoot, "generation-"));
|
|
3128
|
+
const result = await execute(process.execPath, [join2(root, "scripts/build-dev-engine.mjs"), source, directory], {
|
|
3623
3129
|
cwd: root,
|
|
3624
3130
|
timeout: 12e4,
|
|
3625
3131
|
maxBuffer: 2 * 1024 * 1024,
|
|
@@ -3649,7 +3155,7 @@ function withDevEngineUpdates(initial, config, closeStore) {
|
|
|
3649
3155
|
if (!isDeepStrictEqual(comparableCheckpoint(candidate.exportCheckpoint()), comparableCheckpoint(checkpoint))) {
|
|
3650
3156
|
throw new Error("Candidate engine did not preserve the session checkpoint");
|
|
3651
3157
|
}
|
|
3652
|
-
const candidateBus = await import(pathToFileURL(
|
|
3158
|
+
const candidateBus = await import(pathToFileURL(join2(directory, "runtime/events/bus.js")).href);
|
|
3653
3159
|
signal?.throwIfAborted();
|
|
3654
3160
|
if (closingStarted || !getSettings().allowDevSourceUpdates) throw new Error("Development engine update cancelled before handoff");
|
|
3655
3161
|
if (!isDeepStrictEqual(current.exportCheckpoint(), checkpoint)) throw new Error("Session changed during candidate preparation; keeping the current engine");
|
|
@@ -3849,48 +3355,31 @@ function createLocalConsoleSession(config, dbPath) {
|
|
|
3849
3355
|
}
|
|
3850
3356
|
}
|
|
3851
3357
|
|
|
3852
|
-
// packages/cli/src/tui/
|
|
3853
|
-
|
|
3854
|
-
|
|
3855
|
-
|
|
3856
|
-
|
|
3857
|
-
|
|
3858
|
-
|
|
3859
|
-
const
|
|
3860
|
-
|
|
3861
|
-
|
|
3862
|
-
|
|
3863
|
-
|
|
3864
|
-
|
|
3865
|
-
|
|
3866
|
-
|
|
3867
|
-
|
|
3868
|
-
|
|
3869
|
-
|
|
3870
|
-
|
|
3871
|
-
|
|
3872
|
-
|
|
3873
|
-
|
|
3874
|
-
return `Usage: ${state.display}`;
|
|
3875
|
-
}
|
|
3876
|
-
function formatBalanceDetail(account) {
|
|
3877
|
-
if (!account) return " Usage unavailable (unsupported account data).\n";
|
|
3878
|
-
const { included, prepaid } = account;
|
|
3879
|
-
const lines = [included.state === "none" ? " Usage: no included allowance" : included.state !== "unavailable" && included.usedPercent !== null ? ` Usage: ${included.usedPercent}% used` : " Usage: unavailable"];
|
|
3880
|
-
if (included.state !== "unavailable" && included.resetsAt) {
|
|
3881
|
-
lines.push(` Resets: ${included.resetsAt}`);
|
|
3882
|
-
}
|
|
3883
|
-
if (prepaid.fallbackEnabled) lines.push(` Prepaid balance: ${fmtUsd(prepaid.balanceUsd)}`);
|
|
3884
|
-
if (account.state !== "ready" || !account.admission.eligible) {
|
|
3885
|
-
lines.push(` Access: ${account.state === "ready" ? "blocked" : account.state}`);
|
|
3886
|
-
const reason = account.admission.reason ?? account.reason;
|
|
3887
|
-
if (reason) lines.push(` Reason: ${reason}`);
|
|
3888
|
-
}
|
|
3889
|
-
return lines.join("\n") + "\n";
|
|
3358
|
+
// packages/cli/src/tui/codex-device-auth.ts
|
|
3359
|
+
import { spawn as spawn2 } from "node:child_process";
|
|
3360
|
+
|
|
3361
|
+
// packages/cli/src/open-browser.ts
|
|
3362
|
+
import { spawn } from "node:child_process";
|
|
3363
|
+
import { platform } from "node:os";
|
|
3364
|
+
function defaultOpenBrowser(url) {
|
|
3365
|
+
const plat = platform();
|
|
3366
|
+
return new Promise((resolve4, reject) => {
|
|
3367
|
+
const options = { detached: true, stdio: "ignore", shell: false };
|
|
3368
|
+
const child = plat === "darwin" ? spawn("open", [url], options) : plat === "win32" ? spawn("powershell.exe", [
|
|
3369
|
+
"-NoProfile",
|
|
3370
|
+
"-NonInteractive",
|
|
3371
|
+
"-Command",
|
|
3372
|
+
"Start-Process -FilePath $env:OSEC_BROWSER_LOGIN_URL"
|
|
3373
|
+
], { ...options, env: { ...process.env, OSEC_BROWSER_LOGIN_URL: url } }) : spawn("xdg-open", [url], options);
|
|
3374
|
+
child.once("error", reject);
|
|
3375
|
+
child.once("spawn", () => {
|
|
3376
|
+
child.unref();
|
|
3377
|
+
resolve4();
|
|
3378
|
+
});
|
|
3379
|
+
});
|
|
3890
3380
|
}
|
|
3891
3381
|
|
|
3892
3382
|
// packages/cli/src/tui/codex-device-auth.ts
|
|
3893
|
-
import { spawn as spawn2 } from "node:child_process";
|
|
3894
3383
|
var MAX_VISIBLE_LINES = 8;
|
|
3895
3384
|
function defaultSpawnCodexDeviceAuth(command, args, options) {
|
|
3896
3385
|
const child = spawn2(command, args, {
|
|
@@ -4019,12 +3508,6 @@ export {
|
|
|
4019
3508
|
watchLensSynthCommand,
|
|
4020
3509
|
registerLensSynthCommand,
|
|
4021
3510
|
createLocalConsoleSession,
|
|
4022
|
-
hostedBalanceState,
|
|
4023
|
-
formatHostedBalance,
|
|
4024
|
-
formatBalanceDetail,
|
|
4025
|
-
registerAuthCommand,
|
|
4026
|
-
hostedBrowserLoginFlow,
|
|
4027
|
-
runLogin,
|
|
4028
3511
|
defaultOpenBrowser,
|
|
4029
3512
|
startCodexDeviceAuth,
|
|
4030
3513
|
runUnified
|