newcraw 1.0.2 → 1.0.3
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/dist/REPL-CTTH53A7.js +50 -0
- package/dist/{acp-J4WDYGRX.js → acp-25PIN25O.js} +69 -40
- package/dist/acp-25PIN25O.js.map +7 -0
- package/dist/{agentsValidate-UBOER2IN.js → agentsValidate-BXDD54YP.js} +13 -10
- package/dist/{agentsValidate-UBOER2IN.js.map → agentsValidate-BXDD54YP.js.map} +1 -1
- package/dist/{ask-MGUO3L35.js → ask-EL4XAA5P.js} +62 -52
- package/dist/ask-EL4XAA5P.js.map +7 -0
- package/dist/{autoUpdater-2GS6LRPK.js → autoUpdater-DKMSJXWW.js} +5 -4
- package/dist/{chunk-2C43OXE7.js → chunk-2OVXJBJV.js} +38 -59
- package/dist/chunk-2OVXJBJV.js.map +7 -0
- package/dist/{chunk-53A4JHFW.js → chunk-3D3C7MRI.js} +23 -4
- package/dist/chunk-3D3C7MRI.js.map +7 -0
- package/dist/{chunk-VKI7ORIO.js → chunk-3ZQRACCP.js} +37 -18
- package/dist/{chunk-VKI7ORIO.js.map → chunk-3ZQRACCP.js.map} +1 -1
- package/dist/chunk-4A6CDBDH.js +822 -0
- package/dist/chunk-4A6CDBDH.js.map +7 -0
- package/dist/{chunk-VQSCECTS.js → chunk-53VETVCP.js} +6 -4
- package/dist/{chunk-VQSCECTS.js.map → chunk-53VETVCP.js.map} +1 -1
- package/dist/{chunk-WWDVA4NV.js → chunk-6WT3ZRYF.js} +22 -6
- package/dist/{chunk-WWDVA4NV.js.map → chunk-6WT3ZRYF.js.map} +1 -1
- package/dist/{chunk-RUXIBQ3B.js → chunk-7E2L7EH2.js} +4 -4
- package/dist/{chunk-VHS2MZQS.js → chunk-7PWVUHQ2.js} +9 -6
- package/dist/{chunk-VHS2MZQS.js.map → chunk-7PWVUHQ2.js.map} +1 -1
- package/dist/{chunk-2EFL22PV.js → chunk-ADJ4YEII.js} +7 -3
- package/dist/chunk-ADJ4YEII.js.map +7 -0
- package/dist/chunk-AKNZJBBU.js +372 -0
- package/dist/chunk-AKNZJBBU.js.map +7 -0
- package/dist/chunk-ALQSPHXV.js +135 -0
- package/dist/chunk-ALQSPHXV.js.map +7 -0
- package/dist/{chunk-XS6PU75S.js → chunk-APSIF3YK.js} +1 -1
- package/dist/{chunk-IM33F5CM.js → chunk-BMJ5XGFR.js} +1668 -1623
- package/dist/chunk-BMJ5XGFR.js.map +7 -0
- package/dist/chunk-BQCOSNM3.js +93 -0
- package/dist/chunk-BQCOSNM3.js.map +7 -0
- package/dist/{chunk-OJIMOLIC.js → chunk-BTCASL4X.js} +3621 -7413
- package/dist/chunk-BTCASL4X.js.map +7 -0
- package/dist/chunk-CHB5K4GI.js +107 -0
- package/dist/chunk-CHB5K4GI.js.map +7 -0
- package/dist/{chunk-QH2M65BR.js → chunk-D2FSAFMO.js} +7 -3
- package/dist/{chunk-QH2M65BR.js.map → chunk-D2FSAFMO.js.map} +1 -1
- package/dist/chunk-D4OZACS2.js +35 -0
- package/dist/{chunk-IIFUDVGS.js → chunk-ENLHVQCX.js} +310 -177
- package/dist/chunk-ENLHVQCX.js.map +7 -0
- package/dist/{chunk-A7X6OCZE.js → chunk-ERKWSZ3K.js} +1 -1
- package/dist/{chunk-UYRR6F5S.js → chunk-FSSZHQEJ.js} +9 -3
- package/dist/{chunk-UYRR6F5S.js.map → chunk-FSSZHQEJ.js.map} +1 -1
- package/dist/chunk-GV73HKJO.js +5473 -0
- package/dist/chunk-GV73HKJO.js.map +7 -0
- package/dist/{chunk-GZTCXXSS.js → chunk-GZ4BEVMZ.js} +57 -46
- package/dist/{chunk-GZTCXXSS.js.map → chunk-GZ4BEVMZ.js.map} +1 -1
- package/dist/chunk-HLBLZKZH.js +45 -0
- package/dist/chunk-HLBLZKZH.js.map +7 -0
- package/dist/chunk-JLVECHVJ.js +36 -0
- package/dist/chunk-JLVECHVJ.js.map +7 -0
- package/dist/chunk-KNSAVNMD.js +683 -0
- package/dist/{chunk-F3COCCAE.js.map → chunk-KNSAVNMD.js.map} +1 -1
- package/dist/{chunk-V5U6BHT2.js → chunk-KRN3WHHL.js} +7 -3
- package/dist/{chunk-V5U6BHT2.js.map → chunk-KRN3WHHL.js.map} +1 -1
- package/dist/{chunk-3LMXSKZ7.js → chunk-NFYAVT54.js} +1 -1
- package/dist/chunk-NT7RDVDA.js +33 -0
- package/dist/{chunk-KQSHIOZK.js.map → chunk-NT7RDVDA.js.map} +1 -1
- package/dist/chunk-NW7WSLD5.js +166 -0
- package/dist/{chunk-ZYSVG4X3.js.map → chunk-NW7WSLD5.js.map} +2 -2
- package/dist/{chunk-HSJ6HYAO.js → chunk-P52SGBC4.js} +18 -10
- package/dist/chunk-P52SGBC4.js.map +7 -0
- package/dist/{chunk-XXU2NVOE.js → chunk-PC6QOCGI.js} +30 -6
- package/dist/chunk-PC6QOCGI.js.map +7 -0
- package/dist/{chunk-N5OHRWG2.js → chunk-QSRXXZO7.js} +4 -2
- package/dist/{chunk-N5OHRWG2.js.map → chunk-QSRXXZO7.js.map} +1 -1
- package/dist/{chunk-DEF3KFP7.js → chunk-QZFKONA3.js} +4 -2
- package/dist/{chunk-DEF3KFP7.js.map → chunk-QZFKONA3.js.map} +1 -1
- package/dist/{chunk-JWXQNBBA.js → chunk-RE226X4F.js} +7 -1
- package/dist/{chunk-JWXQNBBA.js.map → chunk-RE226X4F.js.map} +1 -1
- package/dist/chunk-RF57YWGW.js +88 -0
- package/dist/chunk-RF57YWGW.js.map +7 -0
- package/dist/chunk-UGBECBIR.js +62 -0
- package/dist/chunk-UGBECBIR.js.map +7 -0
- package/dist/chunk-UYWZQVH5.js +35 -0
- package/dist/chunk-UYWZQVH5.js.map +7 -0
- package/dist/{chunk-LOIZNQOU.js → chunk-VHZRJ7RI.js} +9 -3
- package/dist/{chunk-LOIZNQOU.js.map → chunk-VHZRJ7RI.js.map} +1 -1
- package/dist/{chunk-XMGUQHMF.js → chunk-VSSVN6WG.js} +11 -1
- package/dist/chunk-VSSVN6WG.js.map +7 -0
- package/dist/{chunk-OZHBEG7U.js → chunk-XV7LPJNT.js} +15 -5
- package/dist/{chunk-OZHBEG7U.js.map → chunk-XV7LPJNT.js.map} +1 -1
- package/dist/chunk-Y7MDOB3N.js +65 -0
- package/dist/chunk-Y7MDOB3N.js.map +7 -0
- package/dist/{chunk-BWYKUDJR.js → chunk-ZLAB3Z4G.js} +14 -8
- package/dist/{chunk-BWYKUDJR.js.map → chunk-ZLAB3Z4G.js.map} +1 -1
- package/dist/{chunk-755HIAI3.js → chunk-ZMO4E7IW.js} +3 -42
- package/dist/chunk-ZMO4E7IW.js.map +7 -0
- package/dist/{cli-KZGF3FV5.js → cli-Z2BNJWHT.js} +251 -485
- package/dist/cli-Z2BNJWHT.js.map +7 -0
- package/dist/commands-3Y3OQOXT.js +54 -0
- package/dist/{config-GTJWCNPF.js → config-5RS7HDIK.js} +9 -6
- package/dist/{context-WF3TTXQU.js → context-XZXRRYKS.js} +8 -7
- package/dist/{costTracker-2G3ZI2JF.js → costTracker-VSWW7SRT.js} +3 -2
- package/dist/{customCommands-QOWK57EX.js → customCommands-6KDAODFQ.js} +6 -5
- package/dist/{env-37BAP7QF.js → env-WIM2DQ4L.js} +10 -7
- package/dist/{gateway-IZYO6YFJ.js → gateway-DKHC7H3K.js} +542 -96
- package/dist/gateway-DKHC7H3K.js.map +7 -0
- package/dist/identity-3KZQQVBG.js +16 -0
- package/dist/index.js +8 -6
- package/dist/index.js.map +1 -1
- package/dist/{kodeAgentSessionId-KTGFX2BE.js → kodeAgentSessionId-4SH24DVH.js} +1 -1
- package/dist/{kodeAgentSessionLoad-6F7SJXBC.js → kodeAgentSessionLoad-4S452GGD.js} +6 -5
- package/dist/{kodeAgentSessionResume-UEEDRJ3N.js → kodeAgentSessionResume-MSMG4QUR.js} +6 -5
- package/dist/{kodeAgentStreamJson-VIXFTYL5.js → kodeAgentStreamJson-4ZKIWKS3.js} +4 -2
- package/dist/{kodeAgentStreamJsonSession-XC3IPREZ.js → kodeAgentStreamJsonSession-CYG6MLKP.js} +15 -4
- package/dist/kodeAgentStreamJsonSession-CYG6MLKP.js.map +7 -0
- package/dist/{kodeAgentStructuredStdio-SI5C7AAD.js → kodeAgentStructuredStdio-5DCUC6V6.js} +3 -3
- package/dist/{kodeHooks-V36SHCTC.js → kodeHooks-WX3N6CL6.js} +6 -5
- package/dist/{llm-CYUDKJNR.js → llm-V2W4KJIA.js} +239 -57
- package/dist/llm-V2W4KJIA.js.map +7 -0
- package/dist/{llmLazy-IXVVBRTN.js → llmLazy-I7SO67YA.js} +2 -2
- package/dist/{loader-OEJ6C3TN.js → loader-YJGRGJNH.js} +6 -5
- package/dist/{mcp-KE3SILMX.js → mcp-WG3RQQCZ.js} +10 -9
- package/dist/{mentionProcessor-GAU2WAYB.js → mentionProcessor-PKWDUKTN.js} +14 -7
- package/dist/{mentionProcessor-GAU2WAYB.js.map → mentionProcessor-PKWDUKTN.js.map} +1 -1
- package/dist/{messages-WCSGGSEU.js → messages-RXHQ6VKL.js} +2 -2
- package/dist/{model-4TQIV5J2.js → model-JNWAZGT7.js} +10 -7
- package/dist/{openai-KTZV6F7N.js → openai-6NL5UXO7.js} +8 -7
- package/dist/{outputStyles-WX5RYQOA.js → outputStyles-BVPXT3MW.js} +6 -5
- package/dist/{pluginRuntime-JXMJZ2LC.js → pluginRuntime-XHI3TCRJ.js} +11 -8
- package/dist/{pluginRuntime-JXMJZ2LC.js.map → pluginRuntime-XHI3TCRJ.js.map} +1 -1
- package/dist/{pluginValidation-JNQZYLUP.js → pluginValidation-WDFL352C.js} +8 -7
- package/dist/prompts-C4RUFGX2.js +58 -0
- package/dist/query-IA3UKMGR.js +58 -0
- package/dist/{responsesStreaming-2AIT6GHG.js → responsesStreaming-JORGEFQC.js} +1 -1
- package/dist/{ripgrep-KDPQAMB2.js → ripgrep-BHDXRABJ.js} +5 -4
- package/dist/sandbox-QOXESHL4.js +63 -0
- package/dist/{skillMarketplace-IXAGP3Q2.js → skillMarketplace-RIAMO2YA.js} +5 -4
- package/dist/{state-MSCYLB6Y.js → state-TM2XZQE2.js} +6 -3
- package/dist/structuredOutput-KAVFUV2Z.js +9 -0
- package/dist/theme-BXUQNXSD.js +15 -0
- package/dist/thinking-BCZ4WDT6.js +18 -0
- package/dist/{toolPermissionContext-I3IXPVED.js → toolPermissionContext-JCQ5MFUT.js} +1 -1
- package/dist/toolPermissionContext-JCQ5MFUT.js.map +7 -0
- package/dist/toolPermissionContextState-ILRPUITK.js +24 -0
- package/dist/toolPermissionContextState-ILRPUITK.js.map +7 -0
- package/dist/{toolPermissionSettings-EUZKGZU2.js → toolPermissionSettings-LNYZ6XFE.js} +9 -8
- package/dist/toolPermissionSettings-LNYZ6XFE.js.map +7 -0
- package/dist/tools-HIPUGTF5.js +55 -0
- package/dist/tools-HIPUGTF5.js.map +7 -0
- package/dist/{userInput-LJL4CVOB.js → userInput-I33T2RX2.js} +49 -34
- package/dist/{userInput-LJL4CVOB.js.map → userInput-I33T2RX2.js.map} +1 -1
- package/dist/{uuid-VA3KVASX.js → uuid-RQH3OZ3W.js} +1 -1
- package/dist/uuid-RQH3OZ3W.js.map +7 -0
- package/dist/workspace-EP63OB5S.js +21 -0
- package/dist/workspace-EP63OB5S.js.map +7 -0
- package/package.json +1 -1
- package/web/dist/assets/index-XuLVvSQF.js +251 -0
- package/web/dist/assets/index-pSid9IlY.css +10 -0
- package/web/dist/index.html +2 -2
- package/dist/REPL-IAK7ZN2Z.js +0 -42
- package/dist/acp-J4WDYGRX.js.map +0 -7
- package/dist/ask-MGUO3L35.js.map +0 -7
- package/dist/chunk-2C43OXE7.js.map +0 -7
- package/dist/chunk-2EFL22PV.js.map +0 -7
- package/dist/chunk-53A4JHFW.js.map +0 -7
- package/dist/chunk-755HIAI3.js.map +0 -7
- package/dist/chunk-AXWJI6N5.js +0 -11
- package/dist/chunk-F3COCCAE.js +0 -654
- package/dist/chunk-HSJ6HYAO.js.map +0 -7
- package/dist/chunk-IIFUDVGS.js.map +0 -7
- package/dist/chunk-IM33F5CM.js.map +0 -7
- package/dist/chunk-KQSHIOZK.js +0 -24
- package/dist/chunk-OJIMOLIC.js.map +0 -7
- package/dist/chunk-XMGUQHMF.js.map +0 -7
- package/dist/chunk-XXU2NVOE.js.map +0 -7
- package/dist/chunk-ZYSVG4X3.js +0 -151
- package/dist/cli-KZGF3FV5.js.map +0 -7
- package/dist/commands-AVEBLFVS.js +0 -46
- package/dist/gateway-IZYO6YFJ.js.map +0 -7
- package/dist/kodeAgentStreamJsonSession-XC3IPREZ.js.map +0 -7
- package/dist/llm-CYUDKJNR.js.map +0 -7
- package/dist/prompts-LE6GK75N.js +0 -48
- package/dist/query-GGIP6PWG.js +0 -50
- package/dist/theme-GAMFOLBW.js +0 -14
- package/dist/tools-3HOUIDM3.js +0 -47
- package/web/dist/assets/index-COAJqX1Z.css +0 -1
- package/web/dist/assets/index-CzS_4LmC.js +0 -179
- /package/dist/{REPL-IAK7ZN2Z.js.map → REPL-CTTH53A7.js.map} +0 -0
- /package/dist/{autoUpdater-2GS6LRPK.js.map → autoUpdater-DKMSJXWW.js.map} +0 -0
- /package/dist/{chunk-RUXIBQ3B.js.map → chunk-7E2L7EH2.js.map} +0 -0
- /package/dist/{chunk-XS6PU75S.js.map → chunk-APSIF3YK.js.map} +0 -0
- /package/dist/{chunk-AXWJI6N5.js.map → chunk-D4OZACS2.js.map} +0 -0
- /package/dist/{chunk-A7X6OCZE.js.map → chunk-ERKWSZ3K.js.map} +0 -0
- /package/dist/{chunk-3LMXSKZ7.js.map → chunk-NFYAVT54.js.map} +0 -0
- /package/dist/{commands-AVEBLFVS.js.map → commands-3Y3OQOXT.js.map} +0 -0
- /package/dist/{config-GTJWCNPF.js.map → config-5RS7HDIK.js.map} +0 -0
- /package/dist/{context-WF3TTXQU.js.map → context-XZXRRYKS.js.map} +0 -0
- /package/dist/{costTracker-2G3ZI2JF.js.map → costTracker-VSWW7SRT.js.map} +0 -0
- /package/dist/{customCommands-QOWK57EX.js.map → customCommands-6KDAODFQ.js.map} +0 -0
- /package/dist/{env-37BAP7QF.js.map → env-WIM2DQ4L.js.map} +0 -0
- /package/dist/{kodeAgentSessionId-KTGFX2BE.js.map → identity-3KZQQVBG.js.map} +0 -0
- /package/dist/{kodeAgentSessionLoad-6F7SJXBC.js.map → kodeAgentSessionId-4SH24DVH.js.map} +0 -0
- /package/dist/{kodeAgentSessionResume-UEEDRJ3N.js.map → kodeAgentSessionLoad-4S452GGD.js.map} +0 -0
- /package/dist/{kodeAgentStreamJson-VIXFTYL5.js.map → kodeAgentSessionResume-MSMG4QUR.js.map} +0 -0
- /package/dist/{kodeAgentStructuredStdio-SI5C7AAD.js.map → kodeAgentStreamJson-4ZKIWKS3.js.map} +0 -0
- /package/dist/{kodeHooks-V36SHCTC.js.map → kodeAgentStructuredStdio-5DCUC6V6.js.map} +0 -0
- /package/dist/{llmLazy-IXVVBRTN.js.map → kodeHooks-WX3N6CL6.js.map} +0 -0
- /package/dist/{loader-OEJ6C3TN.js.map → llmLazy-I7SO67YA.js.map} +0 -0
- /package/dist/{mcp-KE3SILMX.js.map → loader-YJGRGJNH.js.map} +0 -0
- /package/dist/{messages-WCSGGSEU.js.map → mcp-WG3RQQCZ.js.map} +0 -0
- /package/dist/{model-4TQIV5J2.js.map → messages-RXHQ6VKL.js.map} +0 -0
- /package/dist/{openai-KTZV6F7N.js.map → model-JNWAZGT7.js.map} +0 -0
- /package/dist/{outputStyles-WX5RYQOA.js.map → openai-6NL5UXO7.js.map} +0 -0
- /package/dist/{pluginValidation-JNQZYLUP.js.map → outputStyles-BVPXT3MW.js.map} +0 -0
- /package/dist/{prompts-LE6GK75N.js.map → pluginValidation-WDFL352C.js.map} +0 -0
- /package/dist/{query-GGIP6PWG.js.map → prompts-C4RUFGX2.js.map} +0 -0
- /package/dist/{responsesStreaming-2AIT6GHG.js.map → query-IA3UKMGR.js.map} +0 -0
- /package/dist/{ripgrep-KDPQAMB2.js.map → responsesStreaming-JORGEFQC.js.map} +0 -0
- /package/dist/{skillMarketplace-IXAGP3Q2.js.map → ripgrep-BHDXRABJ.js.map} +0 -0
- /package/dist/{state-MSCYLB6Y.js.map → sandbox-QOXESHL4.js.map} +0 -0
- /package/dist/{theme-GAMFOLBW.js.map → skillMarketplace-RIAMO2YA.js.map} +0 -0
- /package/dist/{toolPermissionContext-I3IXPVED.js.map → state-TM2XZQE2.js.map} +0 -0
- /package/dist/{toolPermissionSettings-EUZKGZU2.js.map → structuredOutput-KAVFUV2Z.js.map} +0 -0
- /package/dist/{tools-3HOUIDM3.js.map → theme-BXUQNXSD.js.map} +0 -0
- /package/dist/{uuid-VA3KVASX.js.map → thinking-BCZ4WDT6.js.map} +0 -0
|
@@ -1,68 +1,30 @@
|
|
|
1
1
|
import { createRequire as __newcrawCreateRequire } from "node:module";
|
|
2
2
|
const require = __newcrawCreateRequire(import.meta.url);
|
|
3
3
|
import {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
import { cwd } from "process";
|
|
9
|
-
|
|
10
|
-
// src/utils/bun/shell.ts
|
|
11
|
-
import { spawn } from "child_process";
|
|
12
|
-
import { existsSync as existsSync4, mkdirSync as mkdirSync4, realpathSync as realpathSync2, statSync as statSync3 } from "fs";
|
|
13
|
-
import { randomUUID as randomUUID2 } from "crypto";
|
|
14
|
-
import { homedir as homedir2 } from "os";
|
|
15
|
-
import { basename, dirname as dirname3, isAbsolute as isAbsolute2, join as join5, resolve as resolve2 } from "path";
|
|
16
|
-
import which from "which";
|
|
17
|
-
|
|
18
|
-
// src/utils/log/index.ts
|
|
4
|
+
CONFIG_BASE_DIR,
|
|
5
|
+
PRODUCT_COMMAND,
|
|
6
|
+
init_product
|
|
7
|
+
} from "./chunk-UYWZQVH5.js";
|
|
19
8
|
import {
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
copyFileSync,
|
|
27
|
-
promises as fsPromises
|
|
28
|
-
} from "fs";
|
|
29
|
-
import { dirname, join as join3 } from "path";
|
|
9
|
+
MACRO,
|
|
10
|
+
init_macros
|
|
11
|
+
} from "./chunk-NW7WSLD5.js";
|
|
12
|
+
import {
|
|
13
|
+
__esm
|
|
14
|
+
} from "./chunk-D4OZACS2.js";
|
|
30
15
|
|
|
31
16
|
// src/services/telemetry/sentry.ts
|
|
32
17
|
function initSentry() {
|
|
33
18
|
}
|
|
34
19
|
async function captureException(error) {
|
|
35
20
|
}
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
// src/constants/product.ts
|
|
42
|
-
var PRODUCT_NAME = "NewCraw";
|
|
43
|
-
var PROJECT_FILE = "AGENTS.md";
|
|
44
|
-
var PRODUCT_COMMAND = "newcraw";
|
|
45
|
-
var CONFIG_BASE_DIR = ".newcraw";
|
|
46
|
-
var CONFIG_FILE = ".newcraw.json";
|
|
47
|
-
var GITHUB_ISSUES_REPO_URL = "https://github.com/YOUR_USERNAME/newcraw/issues";
|
|
48
|
-
var ASCII_LOGO = `
|
|
49
|
-
_ _ ____
|
|
50
|
-
| \\ | | ___ __ __/ ___|_ __ __ ___ __
|
|
51
|
-
| \\| | / _ \\\\ \\ /\\ / / | | '__/ _\` \\ \\ /\\ / /
|
|
52
|
-
| |\\ || __/ \\ V V /| |___| | | (_| |\\ V V /
|
|
53
|
-
|_| \\_| \\___| \\_/\\_/ \\____|_| \\__,_| \\_/\\_/
|
|
54
|
-
|
|
55
|
-
`;
|
|
56
|
-
|
|
57
|
-
// src/utils/plan/planMode.ts
|
|
58
|
-
import { existsSync, mkdirSync, readFileSync, realpathSync } from "fs";
|
|
59
|
-
import { randomBytes } from "crypto";
|
|
60
|
-
import { isAbsolute, join as join2, relative, resolve, parse } from "path";
|
|
21
|
+
var init_sentry = __esm({
|
|
22
|
+
"src/services/telemetry/sentry.ts"() {
|
|
23
|
+
}
|
|
24
|
+
});
|
|
61
25
|
|
|
62
26
|
// src/utils/system/execFileNoThrow.ts
|
|
63
27
|
import { execFile } from "child_process";
|
|
64
|
-
var MS_IN_SECOND = 1e3;
|
|
65
|
-
var SECONDS_IN_MINUTE = 60;
|
|
66
28
|
function execFileNoThrow(file, args, abortSignal, timeout = 10 * SECONDS_IN_MINUTE * MS_IN_SECOND, preserveOutputOnError = true) {
|
|
67
29
|
return new Promise((resolve3) => {
|
|
68
30
|
try {
|
|
@@ -98,799 +60,815 @@ function execFileNoThrow(file, args, abortSignal, timeout = 10 * SECONDS_IN_MINU
|
|
|
98
60
|
}
|
|
99
61
|
});
|
|
100
62
|
}
|
|
63
|
+
var MS_IN_SECOND, SECONDS_IN_MINUTE;
|
|
64
|
+
var init_execFileNoThrow = __esm({
|
|
65
|
+
"src/utils/system/execFileNoThrow.ts"() {
|
|
66
|
+
init_state();
|
|
67
|
+
init_log();
|
|
68
|
+
MS_IN_SECOND = 1e3;
|
|
69
|
+
SECONDS_IN_MINUTE = 60;
|
|
70
|
+
}
|
|
71
|
+
});
|
|
101
72
|
|
|
102
73
|
// src/utils/config/env.ts
|
|
103
74
|
import { memoize } from "lodash-es";
|
|
104
75
|
import { join } from "path";
|
|
105
76
|
import { homedir } from "os";
|
|
106
|
-
function
|
|
77
|
+
function getNewcrawBaseDir() {
|
|
107
78
|
return process.env.NEWCRAW_CONFIG_DIR ?? process.env.CLAUDE_CONFIG_DIR ?? join(homedir(), CONFIG_BASE_DIR);
|
|
108
79
|
}
|
|
109
80
|
function getGlobalConfigFilePath() {
|
|
110
|
-
return
|
|
81
|
+
return join(getNewcrawBaseDir(), "config.json");
|
|
111
82
|
}
|
|
112
83
|
function getMemoryDir() {
|
|
113
|
-
return join(
|
|
114
|
-
}
|
|
115
|
-
var NEWCRAW_BASE_DIR
|
|
116
|
-
var
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
84
|
+
return join(getNewcrawBaseDir(), "memory");
|
|
85
|
+
}
|
|
86
|
+
var NEWCRAW_BASE_DIR, GLOBAL_CONFIG_FILE, MEMORY_DIR, getIsDocker, hasInternetAccess, env;
|
|
87
|
+
var init_env = __esm({
|
|
88
|
+
"src/utils/config/env.ts"() {
|
|
89
|
+
init_execFileNoThrow();
|
|
90
|
+
init_product();
|
|
91
|
+
NEWCRAW_BASE_DIR = getNewcrawBaseDir();
|
|
92
|
+
GLOBAL_CONFIG_FILE = getGlobalConfigFilePath();
|
|
93
|
+
MEMORY_DIR = getMemoryDir();
|
|
94
|
+
getIsDocker = memoize(async () => {
|
|
95
|
+
const { code } = await execFileNoThrow("test", ["-f", "/.dockerenv"]);
|
|
96
|
+
if (code !== 0) {
|
|
97
|
+
return false;
|
|
98
|
+
}
|
|
99
|
+
return process.platform === "linux";
|
|
100
|
+
});
|
|
101
|
+
hasInternetAccess = memoize(async () => {
|
|
102
|
+
const offline = process.env.NEWCRAW_OFFLINE ?? process.env.OFFLINE ?? process.env.NO_NETWORK ?? "";
|
|
103
|
+
const normalized = String(offline).trim().toLowerCase();
|
|
104
|
+
if (["1", "true", "yes", "on"].includes(normalized)) return false;
|
|
105
|
+
return true;
|
|
106
|
+
});
|
|
107
|
+
env = {
|
|
108
|
+
getIsDocker,
|
|
109
|
+
hasInternetAccess,
|
|
110
|
+
isCI: Boolean(process.env.CI),
|
|
111
|
+
platform: process.platform === "win32" ? "windows" : process.platform === "darwin" ? "macos" : "linux",
|
|
112
|
+
nodeVersion: process.version,
|
|
113
|
+
terminal: process.env.TERM_PROGRAM
|
|
114
|
+
};
|
|
122
115
|
}
|
|
123
|
-
return process.platform === "linux";
|
|
124
|
-
});
|
|
125
|
-
var hasInternetAccess = memoize(async () => {
|
|
126
|
-
const offline = process.env.NEWCRAW_OFFLINE ?? process.env.OFFLINE ?? process.env.NO_NETWORK ?? "";
|
|
127
|
-
const normalized = String(offline).trim().toLowerCase();
|
|
128
|
-
if (["1", "true", "yes", "on"].includes(normalized)) return false;
|
|
129
|
-
return true;
|
|
130
116
|
});
|
|
131
|
-
var env = {
|
|
132
|
-
getIsDocker,
|
|
133
|
-
hasInternetAccess,
|
|
134
|
-
isCI: Boolean(process.env.CI),
|
|
135
|
-
platform: process.platform === "win32" ? "windows" : process.platform === "darwin" ? "macos" : "linux",
|
|
136
|
-
nodeVersion: process.version,
|
|
137
|
-
terminal: process.env.TERM_PROGRAM
|
|
138
|
-
};
|
|
139
117
|
|
|
140
118
|
// src/utils/plan/planSlugWords.ts
|
|
141
|
-
var PLAN_SLUG_ADJECTIVES
|
|
142
|
-
|
|
143
|
-
"
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
|
|
840
|
-
|
|
841
|
-
|
|
842
|
-
|
|
843
|
-
|
|
844
|
-
|
|
845
|
-
|
|
846
|
-
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
|
|
852
|
-
|
|
853
|
-
|
|
854
|
-
|
|
855
|
-
|
|
856
|
-
|
|
857
|
-
|
|
858
|
-
|
|
859
|
-
|
|
860
|
-
|
|
861
|
-
|
|
862
|
-
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
|
|
866
|
-
|
|
867
|
-
|
|
868
|
-
|
|
869
|
-
|
|
870
|
-
|
|
871
|
-
|
|
872
|
-
|
|
873
|
-
|
|
874
|
-
|
|
875
|
-
|
|
876
|
-
|
|
877
|
-
|
|
878
|
-
|
|
879
|
-
|
|
880
|
-
|
|
881
|
-
|
|
882
|
-
|
|
883
|
-
|
|
119
|
+
var PLAN_SLUG_ADJECTIVES, PLAN_SLUG_VERBS, PLAN_SLUG_NOUNS;
|
|
120
|
+
var init_planSlugWords = __esm({
|
|
121
|
+
"src/utils/plan/planSlugWords.ts"() {
|
|
122
|
+
PLAN_SLUG_ADJECTIVES = [
|
|
123
|
+
"abundant",
|
|
124
|
+
"ancient",
|
|
125
|
+
"bright",
|
|
126
|
+
"calm",
|
|
127
|
+
"cheerful",
|
|
128
|
+
"clever",
|
|
129
|
+
"cozy",
|
|
130
|
+
"curious",
|
|
131
|
+
"dapper",
|
|
132
|
+
"dazzling",
|
|
133
|
+
"deep",
|
|
134
|
+
"delightful",
|
|
135
|
+
"eager",
|
|
136
|
+
"elegant",
|
|
137
|
+
"enchanted",
|
|
138
|
+
"fancy",
|
|
139
|
+
"fluffy",
|
|
140
|
+
"gentle",
|
|
141
|
+
"gleaming",
|
|
142
|
+
"golden",
|
|
143
|
+
"graceful",
|
|
144
|
+
"happy",
|
|
145
|
+
"hidden",
|
|
146
|
+
"humble",
|
|
147
|
+
"jolly",
|
|
148
|
+
"joyful",
|
|
149
|
+
"keen",
|
|
150
|
+
"kind",
|
|
151
|
+
"lively",
|
|
152
|
+
"lovely",
|
|
153
|
+
"lucky",
|
|
154
|
+
"luminous",
|
|
155
|
+
"magical",
|
|
156
|
+
"majestic",
|
|
157
|
+
"mellow",
|
|
158
|
+
"merry",
|
|
159
|
+
"mighty",
|
|
160
|
+
"misty",
|
|
161
|
+
"noble",
|
|
162
|
+
"peaceful",
|
|
163
|
+
"playful",
|
|
164
|
+
"polished",
|
|
165
|
+
"precious",
|
|
166
|
+
"proud",
|
|
167
|
+
"quiet",
|
|
168
|
+
"quirky",
|
|
169
|
+
"radiant",
|
|
170
|
+
"rosy",
|
|
171
|
+
"serene",
|
|
172
|
+
"shiny",
|
|
173
|
+
"silly",
|
|
174
|
+
"sleepy",
|
|
175
|
+
"smooth",
|
|
176
|
+
"snazzy",
|
|
177
|
+
"snug",
|
|
178
|
+
"snuggly",
|
|
179
|
+
"soft",
|
|
180
|
+
"sparkling",
|
|
181
|
+
"spicy",
|
|
182
|
+
"splendid",
|
|
183
|
+
"sprightly",
|
|
184
|
+
"starry",
|
|
185
|
+
"steady",
|
|
186
|
+
"sunny",
|
|
187
|
+
"swift",
|
|
188
|
+
"tender",
|
|
189
|
+
"tidy",
|
|
190
|
+
"toasty",
|
|
191
|
+
"tranquil",
|
|
192
|
+
"twinkly",
|
|
193
|
+
"valiant",
|
|
194
|
+
"vast",
|
|
195
|
+
"velvet",
|
|
196
|
+
"vivid",
|
|
197
|
+
"warm",
|
|
198
|
+
"whimsical",
|
|
199
|
+
"wild",
|
|
200
|
+
"wise",
|
|
201
|
+
"witty",
|
|
202
|
+
"wondrous",
|
|
203
|
+
"zany",
|
|
204
|
+
"zesty",
|
|
205
|
+
"zippy",
|
|
206
|
+
"breezy",
|
|
207
|
+
"bubbly",
|
|
208
|
+
"buzzing",
|
|
209
|
+
"cheeky",
|
|
210
|
+
"cosmic",
|
|
211
|
+
"cozy",
|
|
212
|
+
"crispy",
|
|
213
|
+
"crystalline",
|
|
214
|
+
"cuddly",
|
|
215
|
+
"drifting",
|
|
216
|
+
"dreamy",
|
|
217
|
+
"effervescent",
|
|
218
|
+
"ethereal",
|
|
219
|
+
"fizzy",
|
|
220
|
+
"flickering",
|
|
221
|
+
"floating",
|
|
222
|
+
"floofy",
|
|
223
|
+
"fluttering",
|
|
224
|
+
"foamy",
|
|
225
|
+
"frolicking",
|
|
226
|
+
"fuzzy",
|
|
227
|
+
"giggly",
|
|
228
|
+
"glimmering",
|
|
229
|
+
"glistening",
|
|
230
|
+
"glittery",
|
|
231
|
+
"glowing",
|
|
232
|
+
"goofy",
|
|
233
|
+
"groovy",
|
|
234
|
+
"harmonic",
|
|
235
|
+
"hazy",
|
|
236
|
+
"humming",
|
|
237
|
+
"iridescent",
|
|
238
|
+
"jaunty",
|
|
239
|
+
"jazzy",
|
|
240
|
+
"jiggly",
|
|
241
|
+
"melodic",
|
|
242
|
+
"moonlit",
|
|
243
|
+
"mossy",
|
|
244
|
+
"nifty",
|
|
245
|
+
"peppy",
|
|
246
|
+
"prancy",
|
|
247
|
+
"purrfect",
|
|
248
|
+
"purring",
|
|
249
|
+
"quizzical",
|
|
250
|
+
"rippling",
|
|
251
|
+
"rustling",
|
|
252
|
+
"shimmering",
|
|
253
|
+
"shimmying",
|
|
254
|
+
"snappy",
|
|
255
|
+
"snoopy",
|
|
256
|
+
"squishy",
|
|
257
|
+
"swirling",
|
|
258
|
+
"ticklish",
|
|
259
|
+
"tingly",
|
|
260
|
+
"twinkling",
|
|
261
|
+
"velvety",
|
|
262
|
+
"wiggly",
|
|
263
|
+
"wobbly",
|
|
264
|
+
"woolly",
|
|
265
|
+
"zazzy",
|
|
266
|
+
"abstract",
|
|
267
|
+
"adaptive",
|
|
268
|
+
"agile",
|
|
269
|
+
"async",
|
|
270
|
+
"atomic",
|
|
271
|
+
"binary",
|
|
272
|
+
"cached",
|
|
273
|
+
"compiled",
|
|
274
|
+
"composed",
|
|
275
|
+
"compressed",
|
|
276
|
+
"concurrent",
|
|
277
|
+
"cryptic",
|
|
278
|
+
"curried",
|
|
279
|
+
"declarative",
|
|
280
|
+
"delegated",
|
|
281
|
+
"distributed",
|
|
282
|
+
"dynamic",
|
|
283
|
+
"eager",
|
|
284
|
+
"elegant",
|
|
285
|
+
"encapsulated",
|
|
286
|
+
"enumerated",
|
|
287
|
+
"eventual",
|
|
288
|
+
"expressive",
|
|
289
|
+
"federated",
|
|
290
|
+
"functional",
|
|
291
|
+
"generic",
|
|
292
|
+
"greedy",
|
|
293
|
+
"hashed",
|
|
294
|
+
"idempotent",
|
|
295
|
+
"immutable",
|
|
296
|
+
"imperative",
|
|
297
|
+
"indexed",
|
|
298
|
+
"inherited",
|
|
299
|
+
"iterative",
|
|
300
|
+
"lazy",
|
|
301
|
+
"lexical",
|
|
302
|
+
"linear",
|
|
303
|
+
"linked",
|
|
304
|
+
"logical",
|
|
305
|
+
"memoized",
|
|
306
|
+
"modular",
|
|
307
|
+
"mutable",
|
|
308
|
+
"nested",
|
|
309
|
+
"optimized",
|
|
310
|
+
"parallel",
|
|
311
|
+
"parsed",
|
|
312
|
+
"partitioned",
|
|
313
|
+
"piped",
|
|
314
|
+
"polymorphic",
|
|
315
|
+
"pure",
|
|
316
|
+
"reactive",
|
|
317
|
+
"recursive",
|
|
318
|
+
"refactored",
|
|
319
|
+
"reflective",
|
|
320
|
+
"replicated",
|
|
321
|
+
"resilient",
|
|
322
|
+
"robust",
|
|
323
|
+
"scalable",
|
|
324
|
+
"sequential",
|
|
325
|
+
"serialized",
|
|
326
|
+
"sharded",
|
|
327
|
+
"sorted",
|
|
328
|
+
"staged",
|
|
329
|
+
"stateful",
|
|
330
|
+
"stateless",
|
|
331
|
+
"streamed",
|
|
332
|
+
"structured",
|
|
333
|
+
"synchronous",
|
|
334
|
+
"synthetic",
|
|
335
|
+
"temporal",
|
|
336
|
+
"transient",
|
|
337
|
+
"typed",
|
|
338
|
+
"unified",
|
|
339
|
+
"validated",
|
|
340
|
+
"vectorized",
|
|
341
|
+
"virtual"
|
|
342
|
+
];
|
|
343
|
+
PLAN_SLUG_VERBS = [
|
|
344
|
+
"baking",
|
|
345
|
+
"beaming",
|
|
346
|
+
"booping",
|
|
347
|
+
"bouncing",
|
|
348
|
+
"brewing",
|
|
349
|
+
"bubbling",
|
|
350
|
+
"chasing",
|
|
351
|
+
"churning",
|
|
352
|
+
"coalescing",
|
|
353
|
+
"conjuring",
|
|
354
|
+
"cooking",
|
|
355
|
+
"crafting",
|
|
356
|
+
"crunching",
|
|
357
|
+
"cuddling",
|
|
358
|
+
"dancing",
|
|
359
|
+
"dazzling",
|
|
360
|
+
"discovering",
|
|
361
|
+
"doodling",
|
|
362
|
+
"dreaming",
|
|
363
|
+
"drifting",
|
|
364
|
+
"enchanting",
|
|
365
|
+
"exploring",
|
|
366
|
+
"finding",
|
|
367
|
+
"floating",
|
|
368
|
+
"fluttering",
|
|
369
|
+
"foraging",
|
|
370
|
+
"forging",
|
|
371
|
+
"frolicking",
|
|
372
|
+
"gathering",
|
|
373
|
+
"giggling",
|
|
374
|
+
"gliding",
|
|
375
|
+
"greeting",
|
|
376
|
+
"growing",
|
|
377
|
+
"hatching",
|
|
378
|
+
"herding",
|
|
379
|
+
"honking",
|
|
380
|
+
"hopping",
|
|
381
|
+
"hugging",
|
|
382
|
+
"humming",
|
|
383
|
+
"imagining",
|
|
384
|
+
"inventing",
|
|
385
|
+
"jingling",
|
|
386
|
+
"juggling",
|
|
387
|
+
"jumping",
|
|
388
|
+
"kindling",
|
|
389
|
+
"knitting",
|
|
390
|
+
"launching",
|
|
391
|
+
"leaping",
|
|
392
|
+
"mapping",
|
|
393
|
+
"marinating",
|
|
394
|
+
"meandering",
|
|
395
|
+
"mixing",
|
|
396
|
+
"moseying",
|
|
397
|
+
"munching",
|
|
398
|
+
"napping",
|
|
399
|
+
"nibbling",
|
|
400
|
+
"noodling",
|
|
401
|
+
"orbiting",
|
|
402
|
+
"painting",
|
|
403
|
+
"percolating",
|
|
404
|
+
"petting",
|
|
405
|
+
"plotting",
|
|
406
|
+
"pondering",
|
|
407
|
+
"popping",
|
|
408
|
+
"prancing",
|
|
409
|
+
"purring",
|
|
410
|
+
"puzzling",
|
|
411
|
+
"questing",
|
|
412
|
+
"riding",
|
|
413
|
+
"roaming",
|
|
414
|
+
"rolling",
|
|
415
|
+
"sauteeing",
|
|
416
|
+
"scribbling",
|
|
417
|
+
"seeking",
|
|
418
|
+
"shimmying",
|
|
419
|
+
"singing",
|
|
420
|
+
"skipping",
|
|
421
|
+
"sleeping",
|
|
422
|
+
"snacking",
|
|
423
|
+
"sniffing",
|
|
424
|
+
"snuggling",
|
|
425
|
+
"soaring",
|
|
426
|
+
"sparking",
|
|
427
|
+
"spinning",
|
|
428
|
+
"splashing",
|
|
429
|
+
"sprouting",
|
|
430
|
+
"squishing",
|
|
431
|
+
"stargazing",
|
|
432
|
+
"stirring",
|
|
433
|
+
"strolling",
|
|
434
|
+
"swimming",
|
|
435
|
+
"swinging",
|
|
436
|
+
"tickling",
|
|
437
|
+
"tinkering",
|
|
438
|
+
"toasting",
|
|
439
|
+
"tumbling",
|
|
440
|
+
"twirling",
|
|
441
|
+
"waddling",
|
|
442
|
+
"wandering",
|
|
443
|
+
"watching",
|
|
444
|
+
"weaving",
|
|
445
|
+
"whistling",
|
|
446
|
+
"wibbling",
|
|
447
|
+
"wiggling",
|
|
448
|
+
"wishing",
|
|
449
|
+
"wobbling",
|
|
450
|
+
"wondering",
|
|
451
|
+
"yawning",
|
|
452
|
+
"zooming"
|
|
453
|
+
];
|
|
454
|
+
PLAN_SLUG_NOUNS = [
|
|
455
|
+
"aurora",
|
|
456
|
+
"avalanche",
|
|
457
|
+
"blossom",
|
|
458
|
+
"breeze",
|
|
459
|
+
"brook",
|
|
460
|
+
"bubble",
|
|
461
|
+
"canyon",
|
|
462
|
+
"cascade",
|
|
463
|
+
"cloud",
|
|
464
|
+
"clover",
|
|
465
|
+
"comet",
|
|
466
|
+
"coral",
|
|
467
|
+
"cosmos",
|
|
468
|
+
"creek",
|
|
469
|
+
"crescent",
|
|
470
|
+
"crystal",
|
|
471
|
+
"dawn",
|
|
472
|
+
"dewdrop",
|
|
473
|
+
"dusk",
|
|
474
|
+
"eclipse",
|
|
475
|
+
"ember",
|
|
476
|
+
"feather",
|
|
477
|
+
"fern",
|
|
478
|
+
"firefly",
|
|
479
|
+
"flame",
|
|
480
|
+
"flurry",
|
|
481
|
+
"fog",
|
|
482
|
+
"forest",
|
|
483
|
+
"frost",
|
|
484
|
+
"galaxy",
|
|
485
|
+
"garden",
|
|
486
|
+
"glacier",
|
|
487
|
+
"glade",
|
|
488
|
+
"grove",
|
|
489
|
+
"harbor",
|
|
490
|
+
"horizon",
|
|
491
|
+
"island",
|
|
492
|
+
"lagoon",
|
|
493
|
+
"lake",
|
|
494
|
+
"leaf",
|
|
495
|
+
"lightning",
|
|
496
|
+
"meadow",
|
|
497
|
+
"meteor",
|
|
498
|
+
"mist",
|
|
499
|
+
"moon",
|
|
500
|
+
"moonbeam",
|
|
501
|
+
"mountain",
|
|
502
|
+
"nebula",
|
|
503
|
+
"nova",
|
|
504
|
+
"ocean",
|
|
505
|
+
"orbit",
|
|
506
|
+
"pebble",
|
|
507
|
+
"petal",
|
|
508
|
+
"pine",
|
|
509
|
+
"planet",
|
|
510
|
+
"pond",
|
|
511
|
+
"puddle",
|
|
512
|
+
"quasar",
|
|
513
|
+
"rain",
|
|
514
|
+
"rainbow",
|
|
515
|
+
"reef",
|
|
516
|
+
"ripple",
|
|
517
|
+
"river",
|
|
518
|
+
"shore",
|
|
519
|
+
"sky",
|
|
520
|
+
"snowflake",
|
|
521
|
+
"spark",
|
|
522
|
+
"spring",
|
|
523
|
+
"star",
|
|
524
|
+
"stardust",
|
|
525
|
+
"starlight",
|
|
526
|
+
"storm",
|
|
527
|
+
"stream",
|
|
528
|
+
"summit",
|
|
529
|
+
"sun",
|
|
530
|
+
"sunbeam",
|
|
531
|
+
"sunrise",
|
|
532
|
+
"sunset",
|
|
533
|
+
"thunder",
|
|
534
|
+
"tide",
|
|
535
|
+
"twilight",
|
|
536
|
+
"valley",
|
|
537
|
+
"volcano",
|
|
538
|
+
"waterfall",
|
|
539
|
+
"wave",
|
|
540
|
+
"willow",
|
|
541
|
+
"wind",
|
|
542
|
+
"alpaca",
|
|
543
|
+
"axolotl",
|
|
544
|
+
"badger",
|
|
545
|
+
"bear",
|
|
546
|
+
"beaver",
|
|
547
|
+
"bee",
|
|
548
|
+
"bird",
|
|
549
|
+
"bumblebee",
|
|
550
|
+
"bunny",
|
|
551
|
+
"cat",
|
|
552
|
+
"chipmunk",
|
|
553
|
+
"crab",
|
|
554
|
+
"crane",
|
|
555
|
+
"deer",
|
|
556
|
+
"dolphin",
|
|
557
|
+
"dove",
|
|
558
|
+
"dragon",
|
|
559
|
+
"dragonfly",
|
|
560
|
+
"duckling",
|
|
561
|
+
"eagle",
|
|
562
|
+
"elephant",
|
|
563
|
+
"falcon",
|
|
564
|
+
"finch",
|
|
565
|
+
"flamingo",
|
|
566
|
+
"fox",
|
|
567
|
+
"frog",
|
|
568
|
+
"giraffe",
|
|
569
|
+
"goose",
|
|
570
|
+
"hamster",
|
|
571
|
+
"hare",
|
|
572
|
+
"hedgehog",
|
|
573
|
+
"hippo",
|
|
574
|
+
"hummingbird",
|
|
575
|
+
"jellyfish",
|
|
576
|
+
"kitten",
|
|
577
|
+
"koala",
|
|
578
|
+
"ladybug",
|
|
579
|
+
"lark",
|
|
580
|
+
"lemur",
|
|
581
|
+
"llama",
|
|
582
|
+
"lobster",
|
|
583
|
+
"lynx",
|
|
584
|
+
"manatee",
|
|
585
|
+
"meerkat",
|
|
586
|
+
"moth",
|
|
587
|
+
"narwhal",
|
|
588
|
+
"newt",
|
|
589
|
+
"octopus",
|
|
590
|
+
"otter",
|
|
591
|
+
"owl",
|
|
592
|
+
"panda",
|
|
593
|
+
"parrot",
|
|
594
|
+
"peacock",
|
|
595
|
+
"pelican",
|
|
596
|
+
"penguin",
|
|
597
|
+
"phoenix",
|
|
598
|
+
"piglet",
|
|
599
|
+
"platypus",
|
|
600
|
+
"pony",
|
|
601
|
+
"porcupine",
|
|
602
|
+
"puffin",
|
|
603
|
+
"puppy",
|
|
604
|
+
"quail",
|
|
605
|
+
"quokka",
|
|
606
|
+
"rabbit",
|
|
607
|
+
"raccoon",
|
|
608
|
+
"raven",
|
|
609
|
+
"robin",
|
|
610
|
+
"salamander",
|
|
611
|
+
"seahorse",
|
|
612
|
+
"seal",
|
|
613
|
+
"sloth",
|
|
614
|
+
"snail",
|
|
615
|
+
"sparrow",
|
|
616
|
+
"sphinx",
|
|
617
|
+
"squid",
|
|
618
|
+
"squirrel",
|
|
619
|
+
"starfish",
|
|
620
|
+
"swan",
|
|
621
|
+
"tiger",
|
|
622
|
+
"toucan",
|
|
623
|
+
"turtle",
|
|
624
|
+
"unicorn",
|
|
625
|
+
"walrus",
|
|
626
|
+
"whale",
|
|
627
|
+
"wolf",
|
|
628
|
+
"wombat",
|
|
629
|
+
"wren",
|
|
630
|
+
"yeti",
|
|
631
|
+
"zebra",
|
|
632
|
+
"acorn",
|
|
633
|
+
"anchor",
|
|
634
|
+
"balloon",
|
|
635
|
+
"beacon",
|
|
636
|
+
"biscuit",
|
|
637
|
+
"blanket",
|
|
638
|
+
"bonbon",
|
|
639
|
+
"book",
|
|
640
|
+
"boot",
|
|
641
|
+
"cake",
|
|
642
|
+
"candle",
|
|
643
|
+
"candy",
|
|
644
|
+
"castle",
|
|
645
|
+
"charm",
|
|
646
|
+
"clock",
|
|
647
|
+
"cocoa",
|
|
648
|
+
"cookie",
|
|
649
|
+
"crayon",
|
|
650
|
+
"crown",
|
|
651
|
+
"cupcake",
|
|
652
|
+
"donut",
|
|
653
|
+
"dream",
|
|
654
|
+
"fairy",
|
|
655
|
+
"fiddle",
|
|
656
|
+
"flask",
|
|
657
|
+
"flute",
|
|
658
|
+
"fountain",
|
|
659
|
+
"gadget",
|
|
660
|
+
"gem",
|
|
661
|
+
"gizmo",
|
|
662
|
+
"globe",
|
|
663
|
+
"goblet",
|
|
664
|
+
"hammock",
|
|
665
|
+
"harp",
|
|
666
|
+
"haven",
|
|
667
|
+
"hearth",
|
|
668
|
+
"honey",
|
|
669
|
+
"journal",
|
|
670
|
+
"kazoo",
|
|
671
|
+
"kettle",
|
|
672
|
+
"key",
|
|
673
|
+
"kite",
|
|
674
|
+
"lantern",
|
|
675
|
+
"lemon",
|
|
676
|
+
"lighthouse",
|
|
677
|
+
"locket",
|
|
678
|
+
"lollipop",
|
|
679
|
+
"mango",
|
|
680
|
+
"map",
|
|
681
|
+
"marble",
|
|
682
|
+
"marshmallow",
|
|
683
|
+
"melody",
|
|
684
|
+
"mitten",
|
|
685
|
+
"mochi",
|
|
686
|
+
"muffin",
|
|
687
|
+
"music",
|
|
688
|
+
"nest",
|
|
689
|
+
"noodle",
|
|
690
|
+
"oasis",
|
|
691
|
+
"origami",
|
|
692
|
+
"pancake",
|
|
693
|
+
"parasol",
|
|
694
|
+
"peach",
|
|
695
|
+
"pearl",
|
|
696
|
+
"pebble",
|
|
697
|
+
"pie",
|
|
698
|
+
"pillow",
|
|
699
|
+
"pinwheel",
|
|
700
|
+
"pixel",
|
|
701
|
+
"pizza",
|
|
702
|
+
"plum",
|
|
703
|
+
"popcorn",
|
|
704
|
+
"pretzel",
|
|
705
|
+
"prism",
|
|
706
|
+
"pudding",
|
|
707
|
+
"pumpkin",
|
|
708
|
+
"puzzle",
|
|
709
|
+
"quiche",
|
|
710
|
+
"quill",
|
|
711
|
+
"quilt",
|
|
712
|
+
"riddle",
|
|
713
|
+
"rocket",
|
|
714
|
+
"rose",
|
|
715
|
+
"scone",
|
|
716
|
+
"scroll",
|
|
717
|
+
"shell",
|
|
718
|
+
"sketch",
|
|
719
|
+
"snowglobe",
|
|
720
|
+
"sonnet",
|
|
721
|
+
"sparkle",
|
|
722
|
+
"spindle",
|
|
723
|
+
"sprout",
|
|
724
|
+
"sundae",
|
|
725
|
+
"swing",
|
|
726
|
+
"taco",
|
|
727
|
+
"teacup",
|
|
728
|
+
"teapot",
|
|
729
|
+
"thimble",
|
|
730
|
+
"toast",
|
|
731
|
+
"token",
|
|
732
|
+
"tome",
|
|
733
|
+
"tower",
|
|
734
|
+
"treasure",
|
|
735
|
+
"treehouse",
|
|
736
|
+
"trinket",
|
|
737
|
+
"truffle",
|
|
738
|
+
"tulip",
|
|
739
|
+
"umbrella",
|
|
740
|
+
"waffle",
|
|
741
|
+
"wand",
|
|
742
|
+
"whisper",
|
|
743
|
+
"whistle",
|
|
744
|
+
"widget",
|
|
745
|
+
"wreath",
|
|
746
|
+
"zephyr",
|
|
747
|
+
"abelson",
|
|
748
|
+
"adleman",
|
|
749
|
+
"aho",
|
|
750
|
+
"allen",
|
|
751
|
+
"babbage",
|
|
752
|
+
"bachman",
|
|
753
|
+
"backus",
|
|
754
|
+
"barto",
|
|
755
|
+
"bengio",
|
|
756
|
+
"bentley",
|
|
757
|
+
"blum",
|
|
758
|
+
"boole",
|
|
759
|
+
"brooks",
|
|
760
|
+
"catmull",
|
|
761
|
+
"cerf",
|
|
762
|
+
"cherny",
|
|
763
|
+
"church",
|
|
764
|
+
"clarke",
|
|
765
|
+
"cocke",
|
|
766
|
+
"codd",
|
|
767
|
+
"conway",
|
|
768
|
+
"cook",
|
|
769
|
+
"corbato",
|
|
770
|
+
"cray",
|
|
771
|
+
"curry",
|
|
772
|
+
"dahl",
|
|
773
|
+
"diffie",
|
|
774
|
+
"dijkstra",
|
|
775
|
+
"dongarra",
|
|
776
|
+
"eich",
|
|
777
|
+
"emerson",
|
|
778
|
+
"engelbart",
|
|
779
|
+
"feigenbaum",
|
|
780
|
+
"floyd",
|
|
781
|
+
"gosling",
|
|
782
|
+
"graham",
|
|
783
|
+
"gray",
|
|
784
|
+
"hamming",
|
|
785
|
+
"hanrahan",
|
|
786
|
+
"hartmanis",
|
|
787
|
+
"hejlsberg",
|
|
788
|
+
"hellman",
|
|
789
|
+
"hennessy",
|
|
790
|
+
"hickey",
|
|
791
|
+
"hinton",
|
|
792
|
+
"hoare",
|
|
793
|
+
"hollerith",
|
|
794
|
+
"hopcroft",
|
|
795
|
+
"hopper",
|
|
796
|
+
"iverson",
|
|
797
|
+
"kahan",
|
|
798
|
+
"kahn",
|
|
799
|
+
"karp",
|
|
800
|
+
"kay",
|
|
801
|
+
"kernighan",
|
|
802
|
+
"knuth",
|
|
803
|
+
"kurzweil",
|
|
804
|
+
"lamport",
|
|
805
|
+
"lampson",
|
|
806
|
+
"lecun",
|
|
807
|
+
"lerdorf",
|
|
808
|
+
"liskov",
|
|
809
|
+
"lovelace",
|
|
810
|
+
"matsumoto",
|
|
811
|
+
"mccarthy",
|
|
812
|
+
"metcalfe",
|
|
813
|
+
"micali",
|
|
814
|
+
"milner",
|
|
815
|
+
"minsky",
|
|
816
|
+
"moler",
|
|
817
|
+
"moore",
|
|
818
|
+
"naur",
|
|
819
|
+
"neumann",
|
|
820
|
+
"newell",
|
|
821
|
+
"nygaard",
|
|
822
|
+
"papert",
|
|
823
|
+
"parnas",
|
|
824
|
+
"pascal",
|
|
825
|
+
"patterson",
|
|
826
|
+
"pearl",
|
|
827
|
+
"perlis",
|
|
828
|
+
"pike",
|
|
829
|
+
"pnueli",
|
|
830
|
+
"rabin",
|
|
831
|
+
"reddy",
|
|
832
|
+
"ritchie",
|
|
833
|
+
"rivest",
|
|
834
|
+
"rossum",
|
|
835
|
+
"russell",
|
|
836
|
+
"scott",
|
|
837
|
+
"sedgewick",
|
|
838
|
+
"shamir",
|
|
839
|
+
"shannon",
|
|
840
|
+
"sifakis",
|
|
841
|
+
"simon",
|
|
842
|
+
"stallman",
|
|
843
|
+
"stearns",
|
|
844
|
+
"steele",
|
|
845
|
+
"stonebraker",
|
|
846
|
+
"stroustrup",
|
|
847
|
+
"sutherland",
|
|
848
|
+
"sutton",
|
|
849
|
+
"tarjan",
|
|
850
|
+
"thacker",
|
|
851
|
+
"thompson",
|
|
852
|
+
"torvalds",
|
|
853
|
+
"turing",
|
|
854
|
+
"ullman",
|
|
855
|
+
"valiant",
|
|
856
|
+
"wadler",
|
|
857
|
+
"wall",
|
|
858
|
+
"wigderson",
|
|
859
|
+
"wilkes",
|
|
860
|
+
"wilkinson",
|
|
861
|
+
"wirth",
|
|
862
|
+
"wozniak",
|
|
863
|
+
"yao"
|
|
864
|
+
];
|
|
865
|
+
}
|
|
866
|
+
});
|
|
884
867
|
|
|
885
868
|
// src/utils/plan/planMode.ts
|
|
886
|
-
|
|
887
|
-
|
|
888
|
-
|
|
889
|
-
var planModeEnabledByConversationKey = /* @__PURE__ */ new Map();
|
|
890
|
-
var planSlugCache = /* @__PURE__ */ new Map();
|
|
891
|
-
var planModeFlagsByConversationKey = /* @__PURE__ */ new Map();
|
|
892
|
-
var planModeAttachmentStateByAgentKey = /* @__PURE__ */ new Map();
|
|
893
|
-
var activePlanConversationKey = null;
|
|
869
|
+
import { existsSync, mkdirSync, readFileSync, realpathSync } from "fs";
|
|
870
|
+
import { randomBytes } from "crypto";
|
|
871
|
+
import { isAbsolute, join as join2, relative, resolve, parse } from "path";
|
|
894
872
|
function getConversationKey(context) {
|
|
895
873
|
const messageLogName = context?.options?.messageLogName ?? DEFAULT_CONVERSATION_KEY;
|
|
896
874
|
const forkNumber = context?.options?.forkNumber ?? 0;
|
|
@@ -1179,7 +1157,7 @@ function hydratePlanSlugFromMessages(messages, context) {
|
|
|
1179
1157
|
return false;
|
|
1180
1158
|
}
|
|
1181
1159
|
function getPlanDirectory() {
|
|
1182
|
-
const dir = join2(
|
|
1160
|
+
const dir = join2(getNewcrawBaseDir(), "plans");
|
|
1183
1161
|
if (!existsSync(dir)) {
|
|
1184
1162
|
mkdirSync(dir, { recursive: true });
|
|
1185
1163
|
}
|
|
@@ -1217,11 +1195,36 @@ function readPlanFile(agentId, conversationKey) {
|
|
|
1217
1195
|
planFilePath
|
|
1218
1196
|
};
|
|
1219
1197
|
}
|
|
1198
|
+
var DEFAULT_CONVERSATION_KEY, MAX_SLUG_ATTEMPTS, TURNS_BETWEEN_ATTACHMENTS, planModeEnabledByConversationKey, planSlugCache, planModeFlagsByConversationKey, planModeAttachmentStateByAgentKey, activePlanConversationKey;
|
|
1199
|
+
var init_planMode = __esm({
|
|
1200
|
+
"src/utils/plan/planMode.ts"() {
|
|
1201
|
+
init_env();
|
|
1202
|
+
init_planSlugWords();
|
|
1203
|
+
DEFAULT_CONVERSATION_KEY = "default";
|
|
1204
|
+
MAX_SLUG_ATTEMPTS = 10;
|
|
1205
|
+
TURNS_BETWEEN_ATTACHMENTS = 5;
|
|
1206
|
+
planModeEnabledByConversationKey = /* @__PURE__ */ new Map();
|
|
1207
|
+
planSlugCache = /* @__PURE__ */ new Map();
|
|
1208
|
+
planModeFlagsByConversationKey = /* @__PURE__ */ new Map();
|
|
1209
|
+
planModeAttachmentStateByAgentKey = /* @__PURE__ */ new Map();
|
|
1210
|
+
activePlanConversationKey = null;
|
|
1211
|
+
}
|
|
1212
|
+
});
|
|
1220
1213
|
|
|
1221
1214
|
// src/utils/log/index.ts
|
|
1222
|
-
|
|
1223
|
-
|
|
1224
|
-
|
|
1215
|
+
import {
|
|
1216
|
+
existsSync as existsSync2,
|
|
1217
|
+
mkdirSync as mkdirSync2,
|
|
1218
|
+
writeFileSync,
|
|
1219
|
+
readFileSync as readFileSync2,
|
|
1220
|
+
readdirSync,
|
|
1221
|
+
statSync,
|
|
1222
|
+
copyFileSync,
|
|
1223
|
+
promises as fsPromises
|
|
1224
|
+
} from "fs";
|
|
1225
|
+
import { dirname, join as join3 } from "path";
|
|
1226
|
+
import { randomUUID } from "crypto";
|
|
1227
|
+
import envPaths from "env-paths";
|
|
1225
1228
|
function isPermissionError(error) {
|
|
1226
1229
|
return typeof error === "object" && error !== null && "code" in error && PERMISSION_ERROR_CODES.has(error.code ?? "");
|
|
1227
1230
|
}
|
|
@@ -1248,8 +1251,6 @@ function safeWriteFile(path, data, encoding = "utf8") {
|
|
|
1248
1251
|
throw error;
|
|
1249
1252
|
}
|
|
1250
1253
|
}
|
|
1251
|
-
var SESSION_ID = randomUUID();
|
|
1252
|
-
var paths = envPaths(PRODUCT_COMMAND);
|
|
1253
1254
|
function getProjectDir(cwd2) {
|
|
1254
1255
|
return cwd2.replace(/[^a-zA-Z0-9]/g, "-");
|
|
1255
1256
|
}
|
|
@@ -1257,30 +1258,11 @@ function getLegacyCacheRoot() {
|
|
|
1257
1258
|
return process.env.NEWCRAW_LEGACY_CACHE_ROOT ?? paths.cache;
|
|
1258
1259
|
}
|
|
1259
1260
|
function getNewLogRoot() {
|
|
1260
|
-
return process.env.NEWCRAW_LOG_ROOT ??
|
|
1261
|
-
}
|
|
1262
|
-
var CACHE_PATHS = {
|
|
1263
|
-
errors: () => join3(getNewLogRoot(), getProjectDir(process.cwd()), "errors"),
|
|
1264
|
-
messages: () => join3(getNewLogRoot(), getProjectDir(process.cwd()), "messages"),
|
|
1265
|
-
mcpLogs: (serverName) => join3(
|
|
1266
|
-
getLegacyCacheRoot(),
|
|
1267
|
-
getProjectDir(process.cwd()),
|
|
1268
|
-
`mcp-logs-${serverName}`
|
|
1269
|
-
)
|
|
1270
|
-
};
|
|
1271
|
-
var LEGACY_CACHE_PATHS = {
|
|
1272
|
-
errors: () => join3(getLegacyCacheRoot(), getProjectDir(process.cwd()), "errors"),
|
|
1273
|
-
messages: () => join3(getLegacyCacheRoot(), getProjectDir(process.cwd()), "messages"),
|
|
1274
|
-
mcpLogs: (serverName) => join3(
|
|
1275
|
-
getLegacyCacheRoot(),
|
|
1276
|
-
getProjectDir(process.cwd()),
|
|
1277
|
-
`mcp-logs-${serverName}`
|
|
1278
|
-
)
|
|
1279
|
-
};
|
|
1261
|
+
return process.env.NEWCRAW_LOG_ROOT ?? getNewcrawBaseDir();
|
|
1262
|
+
}
|
|
1280
1263
|
function dateToFilename(date) {
|
|
1281
1264
|
return date.toISOString().replace(/[:.]/g, "-");
|
|
1282
1265
|
}
|
|
1283
|
-
var DATE = dateToFilename(/* @__PURE__ */ new Date());
|
|
1284
1266
|
function getErrorsPath() {
|
|
1285
1267
|
return join3(CACHE_PATHS.errors(), DATE + ".txt");
|
|
1286
1268
|
}
|
|
@@ -1290,8 +1272,6 @@ function getMessagesPath(messageLogName, forkNumber, sidechainNumber) {
|
|
|
1290
1272
|
`${messageLogName}${forkNumber > 0 ? `-${forkNumber}` : ""}${sidechainNumber > 0 ? `-sidechain-${sidechainNumber}` : ""}.json`
|
|
1291
1273
|
);
|
|
1292
1274
|
}
|
|
1293
|
-
var MIGRATION_MESSAGE_LOG_LIMIT = 50;
|
|
1294
|
-
var didMigrateMessageLogs = false;
|
|
1295
1275
|
function migrateLegacyMessageLogsIfNeeded() {
|
|
1296
1276
|
if (didMigrateMessageLogs) return;
|
|
1297
1277
|
didMigrateMessageLogs = true;
|
|
@@ -1567,6 +1547,42 @@ function logMCPError(serverName, error) {
|
|
|
1567
1547
|
} catch {
|
|
1568
1548
|
}
|
|
1569
1549
|
}
|
|
1550
|
+
var IN_MEMORY_ERROR_LOG, MAX_IN_MEMORY_ERRORS, PERMISSION_ERROR_CODES, SESSION_ID, paths, CACHE_PATHS, LEGACY_CACHE_PATHS, DATE, MIGRATION_MESSAGE_LOG_LIMIT, didMigrateMessageLogs;
|
|
1551
|
+
var init_log = __esm({
|
|
1552
|
+
"src/utils/log/index.ts"() {
|
|
1553
|
+
init_sentry();
|
|
1554
|
+
init_macros();
|
|
1555
|
+
init_product();
|
|
1556
|
+
init_planMode();
|
|
1557
|
+
init_env();
|
|
1558
|
+
IN_MEMORY_ERROR_LOG = [];
|
|
1559
|
+
MAX_IN_MEMORY_ERRORS = 100;
|
|
1560
|
+
PERMISSION_ERROR_CODES = /* @__PURE__ */ new Set(["EACCES", "EPERM", "EROFS"]);
|
|
1561
|
+
SESSION_ID = randomUUID();
|
|
1562
|
+
paths = envPaths(PRODUCT_COMMAND);
|
|
1563
|
+
CACHE_PATHS = {
|
|
1564
|
+
errors: () => join3(getNewLogRoot(), getProjectDir(process.cwd()), "errors"),
|
|
1565
|
+
messages: () => join3(getNewLogRoot(), getProjectDir(process.cwd()), "messages"),
|
|
1566
|
+
mcpLogs: (serverName) => join3(
|
|
1567
|
+
getLegacyCacheRoot(),
|
|
1568
|
+
getProjectDir(process.cwd()),
|
|
1569
|
+
`mcp-logs-${serverName}`
|
|
1570
|
+
)
|
|
1571
|
+
};
|
|
1572
|
+
LEGACY_CACHE_PATHS = {
|
|
1573
|
+
errors: () => join3(getLegacyCacheRoot(), getProjectDir(process.cwd()), "errors"),
|
|
1574
|
+
messages: () => join3(getLegacyCacheRoot(), getProjectDir(process.cwd()), "messages"),
|
|
1575
|
+
mcpLogs: (serverName) => join3(
|
|
1576
|
+
getLegacyCacheRoot(),
|
|
1577
|
+
getProjectDir(process.cwd()),
|
|
1578
|
+
`mcp-logs-${serverName}`
|
|
1579
|
+
)
|
|
1580
|
+
};
|
|
1581
|
+
DATE = dateToFilename(/* @__PURE__ */ new Date());
|
|
1582
|
+
MIGRATION_MESSAGE_LOG_LIMIT = 50;
|
|
1583
|
+
didMigrateMessageLogs = false;
|
|
1584
|
+
}
|
|
1585
|
+
});
|
|
1570
1586
|
|
|
1571
1587
|
// src/utils/log/taskOutputStore.ts
|
|
1572
1588
|
import {
|
|
@@ -1581,9 +1597,8 @@ import { dirname as dirname2, join as join4 } from "path";
|
|
|
1581
1597
|
function getProjectDir2(cwd2) {
|
|
1582
1598
|
return cwd2.replace(/[^a-zA-Z0-9]/g, "-");
|
|
1583
1599
|
}
|
|
1584
|
-
var PROJECT_ROOT = process.cwd();
|
|
1585
1600
|
function getTaskOutputsDir() {
|
|
1586
|
-
return join4(
|
|
1601
|
+
return join4(getNewcrawBaseDir(), getProjectDir2(PROJECT_ROOT), "tasks");
|
|
1587
1602
|
}
|
|
1588
1603
|
function getTaskOutputFilePath(taskId) {
|
|
1589
1604
|
return join4(getTaskOutputsDir(), `${taskId}.output`);
|
|
@@ -1619,8 +1634,21 @@ function readTaskOutput(taskId) {
|
|
|
1619
1634
|
return "";
|
|
1620
1635
|
}
|
|
1621
1636
|
}
|
|
1637
|
+
var PROJECT_ROOT;
|
|
1638
|
+
var init_taskOutputStore = __esm({
|
|
1639
|
+
"src/utils/log/taskOutputStore.ts"() {
|
|
1640
|
+
init_env();
|
|
1641
|
+
PROJECT_ROOT = process.cwd();
|
|
1642
|
+
}
|
|
1643
|
+
});
|
|
1622
1644
|
|
|
1623
1645
|
// src/utils/bun/shell.ts
|
|
1646
|
+
import { spawn } from "child_process";
|
|
1647
|
+
import { existsSync as existsSync4, mkdirSync as mkdirSync4, realpathSync as realpathSync2, statSync as statSync3 } from "fs";
|
|
1648
|
+
import { randomUUID as randomUUID2 } from "crypto";
|
|
1649
|
+
import { homedir as homedir2 } from "os";
|
|
1650
|
+
import { basename, dirname as dirname3, isAbsolute as isAbsolute2, join as join5, resolve as resolve2 } from "path";
|
|
1651
|
+
import which from "which";
|
|
1624
1652
|
function whichSync(bin) {
|
|
1625
1653
|
try {
|
|
1626
1654
|
return which.sync(bin, { nothrow: true }) ?? null;
|
|
@@ -2098,393 +2126,521 @@ function renderBashNotification(notification) {
|
|
|
2098
2126
|
"</bash-notification>"
|
|
2099
2127
|
].join("\n");
|
|
2100
2128
|
}
|
|
2101
|
-
var BunShell
|
|
2102
|
-
|
|
2103
|
-
|
|
2104
|
-
|
|
2105
|
-
|
|
2106
|
-
|
|
2107
|
-
|
|
2108
|
-
|
|
2109
|
-
|
|
2110
|
-
|
|
2111
|
-
|
|
2112
|
-
|
|
2113
|
-
|
|
2114
|
-
_BunShell.instance = null;
|
|
2115
|
-
}
|
|
2116
|
-
}
|
|
2117
|
-
static getInstance() {
|
|
2118
|
-
if (!_BunShell.instance || !_BunShell.instance.isAlive) {
|
|
2119
|
-
_BunShell.instance = new _BunShell(process.cwd());
|
|
2120
|
-
}
|
|
2121
|
-
return _BunShell.instance;
|
|
2122
|
-
}
|
|
2123
|
-
static getShellCmdForPlatform(platform, command, _env = process.env) {
|
|
2124
|
-
if (platform === "win32") {
|
|
2125
|
-
return [resolvePowerShellPath(), "-NoProfile", "-NonInteractive", "-Command", command];
|
|
2126
|
-
}
|
|
2127
|
-
const sh = existsSync4("/bin/sh") ? "/bin/sh" : "sh";
|
|
2128
|
-
return [sh, "-c", command];
|
|
2129
|
-
}
|
|
2130
|
-
getShellCmd(command) {
|
|
2131
|
-
return _BunShell.getShellCmdForPlatform(
|
|
2132
|
-
process.platform,
|
|
2133
|
-
command,
|
|
2134
|
-
process.env
|
|
2135
|
-
);
|
|
2136
|
-
}
|
|
2137
|
-
buildSandboxCmd(command, sandbox) {
|
|
2138
|
-
if (!sandbox.enabled) return null;
|
|
2139
|
-
const platform = sandbox.__platformOverride ?? process.platform;
|
|
2140
|
-
const needsNetworkRestriction = sandbox.needsNetworkRestriction !== void 0 ? sandbox.needsNetworkRestriction : sandbox.allowNetwork === true ? false : true;
|
|
2141
|
-
const writeConfig = sandbox.writeConfig ?? (sandbox.writableRoots && sandbox.writableRoots.length > 0 ? { allowOnly: sandbox.writableRoots.filter(Boolean) } : void 0);
|
|
2142
|
-
const readConfig = sandbox.readConfig;
|
|
2143
|
-
const hasReadRestrictions = (readConfig?.denyOnly?.length ?? 0) > 0;
|
|
2144
|
-
const hasWriteRestrictions = writeConfig !== void 0;
|
|
2145
|
-
const hasNetworkRestrictions = needsNetworkRestriction === true;
|
|
2146
|
-
if (!hasReadRestrictions && !hasWriteRestrictions && !hasNetworkRestrictions) {
|
|
2147
|
-
return null;
|
|
2148
|
-
}
|
|
2149
|
-
const binShell = sandbox.binShell ?? (whichSync("bash") ? "bash" : "sh");
|
|
2150
|
-
const binShellPath = whichOrSelf(binShell);
|
|
2151
|
-
const cwd2 = sandbox.chdir || this.cwd;
|
|
2152
|
-
if (platform === "linux") {
|
|
2153
|
-
const bwrapPath = sandbox.__bwrapPathOverride !== void 0 ? sandbox.__bwrapPathOverride : whichSync("bwrap") ?? whichSync("bubblewrap");
|
|
2154
|
-
if (!bwrapPath) {
|
|
2155
|
-
return null;
|
|
2129
|
+
var BunShell;
|
|
2130
|
+
var init_shell = __esm({
|
|
2131
|
+
"src/utils/bun/shell.ts"() {
|
|
2132
|
+
init_log();
|
|
2133
|
+
init_taskOutputStore();
|
|
2134
|
+
BunShell = class _BunShell {
|
|
2135
|
+
cwd;
|
|
2136
|
+
isAlive = true;
|
|
2137
|
+
currentProcess = null;
|
|
2138
|
+
abortController = null;
|
|
2139
|
+
backgroundProcesses = /* @__PURE__ */ new Map();
|
|
2140
|
+
constructor(cwd2) {
|
|
2141
|
+
this.cwd = cwd2;
|
|
2156
2142
|
}
|
|
2157
|
-
|
|
2158
|
-
|
|
2159
|
-
|
|
2160
|
-
|
|
2161
|
-
|
|
2162
|
-
bwrapPath,
|
|
2163
|
-
command,
|
|
2164
|
-
needsNetworkRestriction,
|
|
2165
|
-
readConfig,
|
|
2166
|
-
writeConfig,
|
|
2167
|
-
enableWeakerNestedSandbox: sandbox.enableWeakerNestedSandbox,
|
|
2168
|
-
binShellPath,
|
|
2169
|
-
cwd: cwd2
|
|
2170
|
-
});
|
|
2171
|
-
return { cmd };
|
|
2172
|
-
}
|
|
2173
|
-
if (platform === "darwin") {
|
|
2174
|
-
const sandboxExecPath = sandbox.__sandboxExecPathOverride !== void 0 ? sandbox.__sandboxExecPathOverride : existsSync4("/usr/bin/sandbox-exec") ? "/usr/bin/sandbox-exec" : whichSync("sandbox-exec");
|
|
2175
|
-
if (!sandboxExecPath) {
|
|
2176
|
-
return null;
|
|
2177
|
-
}
|
|
2178
|
-
try {
|
|
2179
|
-
mkdirSync4("/tmp/newcraw", { recursive: true });
|
|
2180
|
-
} catch {
|
|
2181
|
-
}
|
|
2182
|
-
try {
|
|
2183
|
-
mkdirSync4("/private/tmp/newcraw", { recursive: true });
|
|
2184
|
-
} catch {
|
|
2185
|
-
}
|
|
2186
|
-
return {
|
|
2187
|
-
cmd: buildMacosSandboxExecCommand({
|
|
2188
|
-
sandboxExecPath,
|
|
2189
|
-
binShellPath,
|
|
2190
|
-
command,
|
|
2191
|
-
needsNetworkRestriction,
|
|
2192
|
-
httpProxyPort: sandbox.httpProxyPort,
|
|
2193
|
-
socksProxyPort: sandbox.socksProxyPort,
|
|
2194
|
-
allowUnixSockets: sandbox.allowUnixSockets,
|
|
2195
|
-
allowAllUnixSockets: sandbox.allowAllUnixSockets,
|
|
2196
|
-
allowLocalBinding: sandbox.allowLocalBinding,
|
|
2197
|
-
readConfig,
|
|
2198
|
-
writeConfig
|
|
2199
|
-
})
|
|
2200
|
-
};
|
|
2201
|
-
}
|
|
2202
|
-
return null;
|
|
2203
|
-
}
|
|
2204
|
-
isSandboxInitFailure(stderr) {
|
|
2205
|
-
const s = stderr.toLowerCase();
|
|
2206
|
-
return s.includes("bwrap:") || s.includes("bubblewrap") || s.includes("namespace") && s.includes("failed");
|
|
2207
|
-
}
|
|
2208
|
-
startStreamReader(stream, append) {
|
|
2209
|
-
if (!stream) return;
|
|
2210
|
-
try {
|
|
2211
|
-
;
|
|
2212
|
-
stream.setEncoding?.("utf8");
|
|
2213
|
-
} catch {
|
|
2214
|
-
}
|
|
2215
|
-
stream.on("data", (chunk) => {
|
|
2216
|
-
append(
|
|
2217
|
-
typeof chunk === "string" ? chunk : Buffer.isBuffer(chunk) ? chunk.toString("utf8") : String(chunk)
|
|
2218
|
-
);
|
|
2219
|
-
});
|
|
2220
|
-
stream.on("error", (err) => {
|
|
2221
|
-
logError(`Stream read error: ${err}`);
|
|
2222
|
-
});
|
|
2223
|
-
}
|
|
2224
|
-
createCancellableTextCollector(stream, options) {
|
|
2225
|
-
let text = "";
|
|
2226
|
-
const collectText = options?.collectText !== false;
|
|
2227
|
-
if (!stream) {
|
|
2228
|
-
return {
|
|
2229
|
-
getText: () => text,
|
|
2230
|
-
done: Promise.resolve(),
|
|
2231
|
-
cancel: async () => {
|
|
2143
|
+
static instance = null;
|
|
2144
|
+
static restart() {
|
|
2145
|
+
if (_BunShell.instance) {
|
|
2146
|
+
_BunShell.instance.close();
|
|
2147
|
+
_BunShell.instance = null;
|
|
2232
2148
|
}
|
|
2233
|
-
};
|
|
2234
|
-
}
|
|
2235
|
-
let cancelled = false;
|
|
2236
|
-
let resolveDone = null;
|
|
2237
|
-
const done = new Promise((resolve3) => {
|
|
2238
|
-
resolveDone = resolve3;
|
|
2239
|
-
});
|
|
2240
|
-
const finish = () => {
|
|
2241
|
-
if (!resolveDone) return;
|
|
2242
|
-
resolveDone();
|
|
2243
|
-
resolveDone = null;
|
|
2244
|
-
};
|
|
2245
|
-
const onData = (chunk) => {
|
|
2246
|
-
if (cancelled) return;
|
|
2247
|
-
const s = typeof chunk === "string" ? chunk : Buffer.isBuffer(chunk) ? chunk.toString("utf8") : String(chunk);
|
|
2248
|
-
if (collectText) text += s;
|
|
2249
|
-
options?.onChunk?.(s);
|
|
2250
|
-
};
|
|
2251
|
-
const onEnd = () => {
|
|
2252
|
-
cleanup();
|
|
2253
|
-
finish();
|
|
2254
|
-
};
|
|
2255
|
-
const onClose = () => {
|
|
2256
|
-
cleanup();
|
|
2257
|
-
finish();
|
|
2258
|
-
};
|
|
2259
|
-
const cleanup = () => {
|
|
2260
|
-
stream.off("data", onData);
|
|
2261
|
-
stream.off("end", onEnd);
|
|
2262
|
-
stream.off("close", onClose);
|
|
2263
|
-
stream.off("error", onError);
|
|
2264
|
-
};
|
|
2265
|
-
const onError = (err) => {
|
|
2266
|
-
if (!cancelled) {
|
|
2267
|
-
logError(`Stream read error: ${err}`);
|
|
2268
|
-
}
|
|
2269
|
-
cleanup();
|
|
2270
|
-
finish();
|
|
2271
|
-
};
|
|
2272
|
-
try {
|
|
2273
|
-
;
|
|
2274
|
-
stream.setEncoding?.("utf8");
|
|
2275
|
-
} catch {
|
|
2276
|
-
}
|
|
2277
|
-
stream.on("data", onData);
|
|
2278
|
-
stream.once("end", onEnd);
|
|
2279
|
-
stream.once("close", onClose);
|
|
2280
|
-
stream.once("error", onError);
|
|
2281
|
-
return {
|
|
2282
|
-
getText: () => text,
|
|
2283
|
-
done,
|
|
2284
|
-
cancel: async () => {
|
|
2285
|
-
if (cancelled) return;
|
|
2286
|
-
cancelled = true;
|
|
2287
|
-
cleanup();
|
|
2288
|
-
finish();
|
|
2289
|
-
}
|
|
2290
|
-
};
|
|
2291
|
-
}
|
|
2292
|
-
static makeBackgroundTaskId() {
|
|
2293
|
-
return `b${randomUUID2().replace(/-/g, "").slice(0, 6)}`;
|
|
2294
|
-
}
|
|
2295
|
-
execPromotable(command, abortSignal, timeout, options) {
|
|
2296
|
-
const DEFAULT_TIMEOUT = 12e4;
|
|
2297
|
-
const commandTimeout = timeout ?? DEFAULT_TIMEOUT;
|
|
2298
|
-
const startedAt = Date.now();
|
|
2299
|
-
const sandbox = options?.sandbox;
|
|
2300
|
-
const shouldAttemptSandbox = sandbox?.enabled === true;
|
|
2301
|
-
const executionCwd = shouldAttemptSandbox && sandbox?.chdir ? sandbox.chdir : this.cwd;
|
|
2302
|
-
if (abortSignal?.aborted) {
|
|
2303
|
-
return {
|
|
2304
|
-
get status() {
|
|
2305
|
-
return "killed";
|
|
2306
|
-
},
|
|
2307
|
-
background: () => null,
|
|
2308
|
-
kill: () => {
|
|
2309
|
-
},
|
|
2310
|
-
result: Promise.resolve({
|
|
2311
|
-
stdout: "",
|
|
2312
|
-
stderr: "Command aborted before execution",
|
|
2313
|
-
code: 145,
|
|
2314
|
-
interrupted: true
|
|
2315
|
-
})
|
|
2316
|
-
};
|
|
2317
|
-
}
|
|
2318
|
-
const sandboxCmd = shouldAttemptSandbox ? this.buildSandboxCmd(command, sandbox) : null;
|
|
2319
|
-
if (shouldAttemptSandbox && sandbox?.require && !sandboxCmd) {
|
|
2320
|
-
return {
|
|
2321
|
-
get status() {
|
|
2322
|
-
return "killed";
|
|
2323
|
-
},
|
|
2324
|
-
background: () => null,
|
|
2325
|
-
kill: () => {
|
|
2326
|
-
},
|
|
2327
|
-
result: Promise.resolve({
|
|
2328
|
-
stdout: "",
|
|
2329
|
-
stderr: "System sandbox is required but unavailable (missing bubblewrap or unsupported platform).",
|
|
2330
|
-
code: 2,
|
|
2331
|
-
interrupted: false
|
|
2332
|
-
})
|
|
2333
|
-
};
|
|
2334
|
-
}
|
|
2335
|
-
const cmdToRun = sandboxCmd ? sandboxCmd.cmd : this.getShellCmd(command);
|
|
2336
|
-
const internalAbortController = new AbortController();
|
|
2337
|
-
this.abortController = internalAbortController;
|
|
2338
|
-
let status = "running";
|
|
2339
|
-
let backgroundProcess = null;
|
|
2340
|
-
let backgroundTaskId = null;
|
|
2341
|
-
let stdout = "";
|
|
2342
|
-
let stderr = "";
|
|
2343
|
-
let wasAborted = false;
|
|
2344
|
-
let wasBackgrounded = false;
|
|
2345
|
-
let timeoutHandle = null;
|
|
2346
|
-
let timedOut = false;
|
|
2347
|
-
let onTimeoutCb = null;
|
|
2348
|
-
const countNonEmptyLines = (chunk) => chunk.split("\n").filter((line) => line.length > 0).length;
|
|
2349
|
-
const spawnedProcess = spawnWithExited({ cmd: cmdToRun, cwd: executionCwd });
|
|
2350
|
-
this.currentProcess = spawnedProcess;
|
|
2351
|
-
const onAbort = () => {
|
|
2352
|
-
if (status === "backgrounded") return;
|
|
2353
|
-
wasAborted = true;
|
|
2354
|
-
try {
|
|
2355
|
-
internalAbortController.abort();
|
|
2356
|
-
} catch {
|
|
2357
2149
|
}
|
|
2358
|
-
|
|
2359
|
-
|
|
2360
|
-
|
|
2150
|
+
static getInstance() {
|
|
2151
|
+
if (!_BunShell.instance || !_BunShell.instance.isAlive) {
|
|
2152
|
+
_BunShell.instance = new _BunShell(process.cwd());
|
|
2153
|
+
}
|
|
2154
|
+
return _BunShell.instance;
|
|
2361
2155
|
}
|
|
2362
|
-
|
|
2363
|
-
|
|
2364
|
-
|
|
2365
|
-
|
|
2366
|
-
|
|
2367
|
-
|
|
2156
|
+
static getShellCmdForPlatform(platform, command, _env = process.env) {
|
|
2157
|
+
if (platform === "win32") {
|
|
2158
|
+
return [resolvePowerShellPath(), "-NoProfile", "-NonInteractive", "-Command", command];
|
|
2159
|
+
}
|
|
2160
|
+
const sh = existsSync4("/bin/sh") ? "/bin/sh" : "sh";
|
|
2161
|
+
return [sh, "-c", command];
|
|
2368
2162
|
}
|
|
2369
|
-
|
|
2370
|
-
|
|
2163
|
+
getShellCmd(command) {
|
|
2164
|
+
return _BunShell.getShellCmdForPlatform(
|
|
2165
|
+
process.platform,
|
|
2166
|
+
command,
|
|
2167
|
+
process.env
|
|
2168
|
+
);
|
|
2371
2169
|
}
|
|
2372
|
-
|
|
2373
|
-
|
|
2374
|
-
|
|
2375
|
-
|
|
2376
|
-
|
|
2377
|
-
|
|
2378
|
-
|
|
2379
|
-
|
|
2380
|
-
|
|
2381
|
-
|
|
2382
|
-
|
|
2383
|
-
|
|
2384
|
-
|
|
2385
|
-
|
|
2386
|
-
|
|
2387
|
-
|
|
2170
|
+
buildSandboxCmd(command, sandbox) {
|
|
2171
|
+
if (!sandbox.enabled) return null;
|
|
2172
|
+
const platform = sandbox.__platformOverride ?? process.platform;
|
|
2173
|
+
const needsNetworkRestriction = sandbox.needsNetworkRestriction !== void 0 ? sandbox.needsNetworkRestriction : sandbox.allowNetwork === true ? false : true;
|
|
2174
|
+
const writeConfig = sandbox.writeConfig ?? (sandbox.writableRoots && sandbox.writableRoots.length > 0 ? { allowOnly: sandbox.writableRoots.filter(Boolean) } : void 0);
|
|
2175
|
+
const readConfig = sandbox.readConfig;
|
|
2176
|
+
const hasReadRestrictions = (readConfig?.denyOnly?.length ?? 0) > 0;
|
|
2177
|
+
const hasWriteRestrictions = writeConfig !== void 0;
|
|
2178
|
+
const hasNetworkRestrictions = needsNetworkRestriction === true;
|
|
2179
|
+
if (!hasReadRestrictions && !hasWriteRestrictions && !hasNetworkRestrictions) {
|
|
2180
|
+
return null;
|
|
2181
|
+
}
|
|
2182
|
+
const binShell = sandbox.binShell ?? (whichSync("bash") ? "bash" : "sh");
|
|
2183
|
+
const binShellPath = whichOrSelf(binShell);
|
|
2184
|
+
const cwd2 = sandbox.chdir || this.cwd;
|
|
2185
|
+
if (platform === "linux") {
|
|
2186
|
+
const bwrapPath = sandbox.__bwrapPathOverride !== void 0 ? sandbox.__bwrapPathOverride : whichSync("bwrap") ?? whichSync("bubblewrap");
|
|
2187
|
+
if (!bwrapPath) {
|
|
2188
|
+
return null;
|
|
2189
|
+
}
|
|
2190
|
+
try {
|
|
2191
|
+
mkdirSync4("/tmp/newcraw", { recursive: true });
|
|
2192
|
+
} catch {
|
|
2388
2193
|
}
|
|
2194
|
+
const cmd = buildLinuxBwrapCommand({
|
|
2195
|
+
bwrapPath,
|
|
2196
|
+
command,
|
|
2197
|
+
needsNetworkRestriction,
|
|
2198
|
+
readConfig,
|
|
2199
|
+
writeConfig,
|
|
2200
|
+
enableWeakerNestedSandbox: sandbox.enableWeakerNestedSandbox,
|
|
2201
|
+
binShellPath,
|
|
2202
|
+
cwd: cwd2
|
|
2203
|
+
});
|
|
2204
|
+
return { cmd };
|
|
2389
2205
|
}
|
|
2390
|
-
|
|
2391
|
-
|
|
2392
|
-
|
|
2393
|
-
|
|
2394
|
-
{
|
|
2395
|
-
collectText: false,
|
|
2396
|
-
onChunk: (chunk) => {
|
|
2397
|
-
stderr += chunk;
|
|
2398
|
-
options?.onStderrChunk?.(chunk);
|
|
2399
|
-
if (backgroundProcess) {
|
|
2400
|
-
backgroundProcess.stderr = stderr;
|
|
2401
|
-
appendTaskOutput(backgroundProcess.id, chunk);
|
|
2402
|
-
backgroundProcess.stderrLineCount += countNonEmptyLines(chunk);
|
|
2206
|
+
if (platform === "darwin") {
|
|
2207
|
+
const sandboxExecPath = sandbox.__sandboxExecPathOverride !== void 0 ? sandbox.__sandboxExecPathOverride : existsSync4("/usr/bin/sandbox-exec") ? "/usr/bin/sandbox-exec" : whichSync("sandbox-exec");
|
|
2208
|
+
if (!sandboxExecPath) {
|
|
2209
|
+
return null;
|
|
2403
2210
|
}
|
|
2211
|
+
try {
|
|
2212
|
+
mkdirSync4("/tmp/newcraw", { recursive: true });
|
|
2213
|
+
} catch {
|
|
2214
|
+
}
|
|
2215
|
+
try {
|
|
2216
|
+
mkdirSync4("/private/tmp/newcraw", { recursive: true });
|
|
2217
|
+
} catch {
|
|
2218
|
+
}
|
|
2219
|
+
return {
|
|
2220
|
+
cmd: buildMacosSandboxExecCommand({
|
|
2221
|
+
sandboxExecPath,
|
|
2222
|
+
binShellPath,
|
|
2223
|
+
command,
|
|
2224
|
+
needsNetworkRestriction,
|
|
2225
|
+
httpProxyPort: sandbox.httpProxyPort,
|
|
2226
|
+
socksProxyPort: sandbox.socksProxyPort,
|
|
2227
|
+
allowUnixSockets: sandbox.allowUnixSockets,
|
|
2228
|
+
allowAllUnixSockets: sandbox.allowAllUnixSockets,
|
|
2229
|
+
allowLocalBinding: sandbox.allowLocalBinding,
|
|
2230
|
+
readConfig,
|
|
2231
|
+
writeConfig
|
|
2232
|
+
})
|
|
2233
|
+
};
|
|
2404
2234
|
}
|
|
2235
|
+
return null;
|
|
2405
2236
|
}
|
|
2406
|
-
|
|
2407
|
-
|
|
2408
|
-
|
|
2409
|
-
if (onTimeoutCb) {
|
|
2410
|
-
onTimeoutCb(background);
|
|
2411
|
-
return;
|
|
2412
|
-
}
|
|
2413
|
-
timedOut = true;
|
|
2414
|
-
try {
|
|
2415
|
-
spawnedProcess.kill();
|
|
2416
|
-
} catch {
|
|
2237
|
+
isSandboxInitFailure(stderr) {
|
|
2238
|
+
const s = stderr.toLowerCase();
|
|
2239
|
+
return s.includes("bwrap:") || s.includes("bubblewrap") || s.includes("namespace") && s.includes("failed");
|
|
2417
2240
|
}
|
|
2418
|
-
|
|
2419
|
-
|
|
2420
|
-
|
|
2241
|
+
startStreamReader(stream, append) {
|
|
2242
|
+
if (!stream) return;
|
|
2243
|
+
try {
|
|
2244
|
+
;
|
|
2245
|
+
stream.setEncoding?.("utf8");
|
|
2246
|
+
} catch {
|
|
2247
|
+
}
|
|
2248
|
+
stream.on("data", (chunk) => {
|
|
2249
|
+
append(
|
|
2250
|
+
typeof chunk === "string" ? chunk : Buffer.isBuffer(chunk) ? chunk.toString("utf8") : String(chunk)
|
|
2251
|
+
);
|
|
2252
|
+
});
|
|
2253
|
+
stream.on("error", (err) => {
|
|
2254
|
+
logError(`Stream read error: ${err}`);
|
|
2255
|
+
});
|
|
2421
2256
|
}
|
|
2422
|
-
|
|
2423
|
-
|
|
2424
|
-
|
|
2425
|
-
|
|
2426
|
-
|
|
2427
|
-
|
|
2428
|
-
|
|
2429
|
-
|
|
2430
|
-
|
|
2431
|
-
|
|
2432
|
-
|
|
2433
|
-
|
|
2434
|
-
|
|
2435
|
-
|
|
2436
|
-
|
|
2437
|
-
|
|
2438
|
-
|
|
2439
|
-
|
|
2440
|
-
|
|
2441
|
-
|
|
2442
|
-
|
|
2443
|
-
|
|
2444
|
-
|
|
2445
|
-
|
|
2446
|
-
|
|
2447
|
-
|
|
2448
|
-
|
|
2449
|
-
|
|
2450
|
-
|
|
2451
|
-
|
|
2452
|
-
|
|
2453
|
-
|
|
2454
|
-
|
|
2455
|
-
|
|
2456
|
-
|
|
2457
|
-
|
|
2458
|
-
|
|
2459
|
-
|
|
2460
|
-
|
|
2461
|
-
|
|
2462
|
-
|
|
2463
|
-
|
|
2464
|
-
|
|
2465
|
-
|
|
2466
|
-
|
|
2467
|
-
|
|
2257
|
+
createCancellableTextCollector(stream, options) {
|
|
2258
|
+
let text = "";
|
|
2259
|
+
const collectText = options?.collectText !== false;
|
|
2260
|
+
if (!stream) {
|
|
2261
|
+
return {
|
|
2262
|
+
getText: () => text,
|
|
2263
|
+
done: Promise.resolve(),
|
|
2264
|
+
cancel: async () => {
|
|
2265
|
+
}
|
|
2266
|
+
};
|
|
2267
|
+
}
|
|
2268
|
+
let cancelled = false;
|
|
2269
|
+
let resolveDone = null;
|
|
2270
|
+
const done = new Promise((resolve3) => {
|
|
2271
|
+
resolveDone = resolve3;
|
|
2272
|
+
});
|
|
2273
|
+
const finish = () => {
|
|
2274
|
+
if (!resolveDone) return;
|
|
2275
|
+
resolveDone();
|
|
2276
|
+
resolveDone = null;
|
|
2277
|
+
};
|
|
2278
|
+
const onData = (chunk) => {
|
|
2279
|
+
if (cancelled) return;
|
|
2280
|
+
const s = typeof chunk === "string" ? chunk : Buffer.isBuffer(chunk) ? chunk.toString("utf8") : String(chunk);
|
|
2281
|
+
if (collectText) text += s;
|
|
2282
|
+
options?.onChunk?.(s);
|
|
2283
|
+
};
|
|
2284
|
+
const onEnd = () => {
|
|
2285
|
+
cleanup();
|
|
2286
|
+
finish();
|
|
2287
|
+
};
|
|
2288
|
+
const onClose = () => {
|
|
2289
|
+
cleanup();
|
|
2290
|
+
finish();
|
|
2291
|
+
};
|
|
2292
|
+
const cleanup = () => {
|
|
2293
|
+
stream.off("data", onData);
|
|
2294
|
+
stream.off("end", onEnd);
|
|
2295
|
+
stream.off("close", onClose);
|
|
2296
|
+
stream.off("error", onError);
|
|
2297
|
+
};
|
|
2298
|
+
const onError = (err) => {
|
|
2299
|
+
if (!cancelled) {
|
|
2300
|
+
logError(`Stream read error: ${err}`);
|
|
2301
|
+
}
|
|
2302
|
+
cleanup();
|
|
2303
|
+
finish();
|
|
2304
|
+
};
|
|
2305
|
+
try {
|
|
2306
|
+
;
|
|
2307
|
+
stream.setEncoding?.("utf8");
|
|
2308
|
+
} catch {
|
|
2309
|
+
}
|
|
2310
|
+
stream.on("data", onData);
|
|
2311
|
+
stream.once("end", onEnd);
|
|
2312
|
+
stream.once("close", onClose);
|
|
2313
|
+
stream.once("error", onError);
|
|
2314
|
+
return {
|
|
2315
|
+
getText: () => text,
|
|
2316
|
+
done,
|
|
2317
|
+
cancel: async () => {
|
|
2318
|
+
if (cancelled) return;
|
|
2319
|
+
cancelled = true;
|
|
2320
|
+
cleanup();
|
|
2321
|
+
finish();
|
|
2322
|
+
}
|
|
2323
|
+
};
|
|
2468
2324
|
}
|
|
2469
|
-
|
|
2470
|
-
|
|
2471
|
-
} catch {
|
|
2325
|
+
static makeBackgroundTaskId() {
|
|
2326
|
+
return `b${randomUUID2().replace(/-/g, "").slice(0, 6)}`;
|
|
2472
2327
|
}
|
|
2473
|
-
|
|
2474
|
-
|
|
2475
|
-
|
|
2328
|
+
execPromotable(command, abortSignal, timeout, options) {
|
|
2329
|
+
const DEFAULT_TIMEOUT = 12e4;
|
|
2330
|
+
const commandTimeout = timeout ?? DEFAULT_TIMEOUT;
|
|
2331
|
+
const startedAt = Date.now();
|
|
2332
|
+
const sandbox = options?.sandbox;
|
|
2333
|
+
const shouldAttemptSandbox = sandbox?.enabled === true;
|
|
2334
|
+
const executionCwd = shouldAttemptSandbox && sandbox?.chdir ? sandbox.chdir : this.cwd;
|
|
2335
|
+
if (abortSignal?.aborted) {
|
|
2336
|
+
return {
|
|
2337
|
+
get status() {
|
|
2338
|
+
return "killed";
|
|
2339
|
+
},
|
|
2340
|
+
background: () => null,
|
|
2341
|
+
kill: () => {
|
|
2342
|
+
},
|
|
2343
|
+
result: Promise.resolve({
|
|
2344
|
+
stdout: "",
|
|
2345
|
+
stderr: "Command aborted before execution",
|
|
2346
|
+
code: 145,
|
|
2347
|
+
interrupted: true
|
|
2348
|
+
})
|
|
2349
|
+
};
|
|
2350
|
+
}
|
|
2351
|
+
const sandboxCmd = shouldAttemptSandbox ? this.buildSandboxCmd(command, sandbox) : null;
|
|
2352
|
+
if (shouldAttemptSandbox && sandbox?.require && !sandboxCmd) {
|
|
2353
|
+
return {
|
|
2354
|
+
get status() {
|
|
2355
|
+
return "killed";
|
|
2356
|
+
},
|
|
2357
|
+
background: () => null,
|
|
2358
|
+
kill: () => {
|
|
2359
|
+
},
|
|
2360
|
+
result: Promise.resolve({
|
|
2361
|
+
stdout: "",
|
|
2362
|
+
stderr: "System sandbox is required but unavailable (missing bubblewrap or unsupported platform).",
|
|
2363
|
+
code: 2,
|
|
2364
|
+
interrupted: false
|
|
2365
|
+
})
|
|
2366
|
+
};
|
|
2367
|
+
}
|
|
2368
|
+
const cmdToRun = sandboxCmd ? sandboxCmd.cmd : this.getShellCmd(command);
|
|
2369
|
+
const internalAbortController = new AbortController();
|
|
2370
|
+
this.abortController = internalAbortController;
|
|
2371
|
+
let status = "running";
|
|
2372
|
+
let backgroundProcess = null;
|
|
2373
|
+
let backgroundTaskId = null;
|
|
2374
|
+
let stdout = "";
|
|
2375
|
+
let stderr = "";
|
|
2376
|
+
let wasAborted = false;
|
|
2377
|
+
let wasBackgrounded = false;
|
|
2378
|
+
let timeoutHandle = null;
|
|
2379
|
+
let timedOut = false;
|
|
2380
|
+
let onTimeoutCb = null;
|
|
2381
|
+
const countNonEmptyLines = (chunk) => chunk.split("\n").filter((line) => line.length > 0).length;
|
|
2382
|
+
const spawnedProcess = spawnWithExited({ cmd: cmdToRun, cwd: executionCwd });
|
|
2383
|
+
this.currentProcess = spawnedProcess;
|
|
2384
|
+
const onAbort = () => {
|
|
2385
|
+
if (status === "backgrounded") return;
|
|
2386
|
+
wasAborted = true;
|
|
2387
|
+
try {
|
|
2388
|
+
internalAbortController.abort();
|
|
2389
|
+
} catch {
|
|
2390
|
+
}
|
|
2391
|
+
try {
|
|
2392
|
+
spawnedProcess.kill();
|
|
2393
|
+
} catch {
|
|
2394
|
+
}
|
|
2395
|
+
if (backgroundProcess) backgroundProcess.interrupted = true;
|
|
2396
|
+
};
|
|
2397
|
+
const clearForegroundGuards = () => {
|
|
2398
|
+
if (timeoutHandle) {
|
|
2399
|
+
clearTimeout(timeoutHandle);
|
|
2400
|
+
timeoutHandle = null;
|
|
2401
|
+
}
|
|
2402
|
+
if (abortSignal) {
|
|
2403
|
+
abortSignal.removeEventListener("abort", onAbort);
|
|
2404
|
+
}
|
|
2405
|
+
};
|
|
2406
|
+
if (abortSignal) {
|
|
2407
|
+
abortSignal.addEventListener("abort", onAbort, { once: true });
|
|
2408
|
+
if (abortSignal.aborted) onAbort();
|
|
2409
|
+
}
|
|
2410
|
+
const stdoutCollector = this.createCancellableTextCollector(
|
|
2411
|
+
spawnedProcess.stdout,
|
|
2412
|
+
{
|
|
2413
|
+
collectText: false,
|
|
2414
|
+
onChunk: (chunk) => {
|
|
2415
|
+
stdout += chunk;
|
|
2416
|
+
options?.onStdoutChunk?.(chunk);
|
|
2417
|
+
if (backgroundProcess) {
|
|
2418
|
+
backgroundProcess.stdout = stdout;
|
|
2419
|
+
appendTaskOutput(backgroundProcess.id, chunk);
|
|
2420
|
+
backgroundProcess.stdoutLineCount += countNonEmptyLines(chunk);
|
|
2421
|
+
}
|
|
2422
|
+
}
|
|
2423
|
+
}
|
|
2424
|
+
);
|
|
2425
|
+
const stderrCollector = this.createCancellableTextCollector(
|
|
2426
|
+
spawnedProcess.stderr,
|
|
2427
|
+
{
|
|
2428
|
+
collectText: false,
|
|
2429
|
+
onChunk: (chunk) => {
|
|
2430
|
+
stderr += chunk;
|
|
2431
|
+
options?.onStderrChunk?.(chunk);
|
|
2432
|
+
if (backgroundProcess) {
|
|
2433
|
+
backgroundProcess.stderr = stderr;
|
|
2434
|
+
appendTaskOutput(backgroundProcess.id, chunk);
|
|
2435
|
+
backgroundProcess.stderrLineCount += countNonEmptyLines(chunk);
|
|
2436
|
+
}
|
|
2437
|
+
}
|
|
2438
|
+
}
|
|
2439
|
+
);
|
|
2440
|
+
timeoutHandle = setTimeout(() => {
|
|
2441
|
+
if (status !== "running") return;
|
|
2442
|
+
if (onTimeoutCb) {
|
|
2443
|
+
onTimeoutCb(background);
|
|
2444
|
+
return;
|
|
2445
|
+
}
|
|
2446
|
+
timedOut = true;
|
|
2447
|
+
try {
|
|
2448
|
+
spawnedProcess.kill();
|
|
2449
|
+
} catch {
|
|
2450
|
+
}
|
|
2451
|
+
try {
|
|
2452
|
+
internalAbortController.abort();
|
|
2453
|
+
} catch {
|
|
2454
|
+
}
|
|
2455
|
+
}, commandTimeout);
|
|
2456
|
+
const background = (bashId) => {
|
|
2457
|
+
if (backgroundTaskId) return { bashId: backgroundTaskId };
|
|
2458
|
+
if (status !== "running") return null;
|
|
2459
|
+
backgroundTaskId = bashId ?? _BunShell.makeBackgroundTaskId();
|
|
2460
|
+
const outputFile = touchTaskOutputFile(backgroundTaskId);
|
|
2461
|
+
if (stdout) appendTaskOutput(backgroundTaskId, stdout);
|
|
2462
|
+
if (stderr) appendTaskOutput(backgroundTaskId, stderr);
|
|
2463
|
+
status = "backgrounded";
|
|
2464
|
+
wasBackgrounded = true;
|
|
2465
|
+
clearForegroundGuards();
|
|
2466
|
+
backgroundProcess = {
|
|
2467
|
+
id: backgroundTaskId,
|
|
2468
|
+
command,
|
|
2469
|
+
stdout,
|
|
2470
|
+
stderr,
|
|
2471
|
+
stdoutCursor: 0,
|
|
2472
|
+
stderrCursor: 0,
|
|
2473
|
+
stdoutLineCount: countNonEmptyLines(stdout),
|
|
2474
|
+
stderrLineCount: countNonEmptyLines(stderr),
|
|
2475
|
+
lastReportedStdoutLines: 0,
|
|
2476
|
+
lastReportedStderrLines: 0,
|
|
2477
|
+
code: null,
|
|
2478
|
+
interrupted: false,
|
|
2479
|
+
killed: false,
|
|
2480
|
+
timedOut: false,
|
|
2481
|
+
completionStatusSentInAttachment: false,
|
|
2482
|
+
notified: false,
|
|
2483
|
+
startedAt,
|
|
2484
|
+
timeoutAt: Number.POSITIVE_INFINITY,
|
|
2485
|
+
process: spawnedProcess,
|
|
2486
|
+
abortController: internalAbortController,
|
|
2487
|
+
timeoutHandle: null,
|
|
2488
|
+
cwd: executionCwd,
|
|
2489
|
+
outputFile
|
|
2490
|
+
};
|
|
2491
|
+
this.backgroundProcesses.set(backgroundTaskId, backgroundProcess);
|
|
2492
|
+
this.currentProcess = null;
|
|
2493
|
+
this.abortController = null;
|
|
2494
|
+
return { bashId: backgroundTaskId };
|
|
2495
|
+
};
|
|
2496
|
+
const kill = () => {
|
|
2497
|
+
status = "killed";
|
|
2498
|
+
try {
|
|
2499
|
+
spawnedProcess.kill();
|
|
2500
|
+
} catch {
|
|
2501
|
+
}
|
|
2502
|
+
try {
|
|
2503
|
+
internalAbortController.abort();
|
|
2504
|
+
} catch {
|
|
2505
|
+
}
|
|
2506
|
+
if (backgroundProcess) {
|
|
2507
|
+
backgroundProcess.interrupted = true;
|
|
2508
|
+
backgroundProcess.killed = true;
|
|
2509
|
+
}
|
|
2510
|
+
};
|
|
2511
|
+
const result = (async () => {
|
|
2512
|
+
try {
|
|
2513
|
+
await spawnedProcess.exited;
|
|
2514
|
+
if (status === "running" || status === "backgrounded")
|
|
2515
|
+
status = "completed";
|
|
2516
|
+
if (backgroundProcess) {
|
|
2517
|
+
backgroundProcess.code = spawnedProcess.exitCode ?? 0;
|
|
2518
|
+
backgroundProcess.interrupted = backgroundProcess.interrupted || wasAborted || internalAbortController.signal.aborted;
|
|
2519
|
+
}
|
|
2520
|
+
if (!wasBackgrounded) {
|
|
2521
|
+
await Promise.race([
|
|
2522
|
+
Promise.allSettled([stdoutCollector.done, stderrCollector.done]),
|
|
2523
|
+
new Promise((resolve3) => setTimeout(resolve3, 250))
|
|
2524
|
+
]);
|
|
2525
|
+
await Promise.allSettled([
|
|
2526
|
+
stdoutCollector.cancel(),
|
|
2527
|
+
stderrCollector.cancel()
|
|
2528
|
+
]);
|
|
2529
|
+
}
|
|
2530
|
+
const interrupted = wasAborted || abortSignal?.aborted === true || internalAbortController.signal.aborted === true || timedOut;
|
|
2531
|
+
let code = spawnedProcess.exitCode;
|
|
2532
|
+
if (!Number.isFinite(code)) {
|
|
2533
|
+
code = interrupted ? 143 : 0;
|
|
2534
|
+
}
|
|
2535
|
+
const stderrWithTimeout = timedOut ? [`Command timed out`, stderr].filter(Boolean).join("\n") : stderr;
|
|
2536
|
+
const stderrAnnotated = sandboxCmd ? maybeAnnotateMacosSandboxStderr(stderrWithTimeout, sandbox) : stderrWithTimeout;
|
|
2537
|
+
return {
|
|
2538
|
+
stdout,
|
|
2539
|
+
stderr: stderrAnnotated,
|
|
2540
|
+
code,
|
|
2541
|
+
interrupted
|
|
2542
|
+
};
|
|
2543
|
+
} finally {
|
|
2544
|
+
clearForegroundGuards();
|
|
2545
|
+
if (this.currentProcess === spawnedProcess) {
|
|
2546
|
+
this.currentProcess = null;
|
|
2547
|
+
this.abortController = null;
|
|
2548
|
+
}
|
|
2549
|
+
}
|
|
2550
|
+
})();
|
|
2551
|
+
const execHandle = {
|
|
2552
|
+
get status() {
|
|
2553
|
+
return status;
|
|
2554
|
+
},
|
|
2555
|
+
background,
|
|
2556
|
+
kill,
|
|
2557
|
+
result
|
|
2558
|
+
};
|
|
2559
|
+
execHandle.onTimeout = (cb) => {
|
|
2560
|
+
onTimeoutCb = cb;
|
|
2561
|
+
};
|
|
2562
|
+
result.then((r) => {
|
|
2563
|
+
if (!backgroundProcess || !backgroundTaskId) return;
|
|
2564
|
+
backgroundProcess.code = r.code;
|
|
2565
|
+
backgroundProcess.interrupted = r.interrupted;
|
|
2566
|
+
}).catch(() => {
|
|
2567
|
+
if (!backgroundProcess) return;
|
|
2568
|
+
backgroundProcess.code = backgroundProcess.code ?? 2;
|
|
2569
|
+
});
|
|
2570
|
+
return execHandle;
|
|
2476
2571
|
}
|
|
2477
|
-
|
|
2478
|
-
|
|
2479
|
-
|
|
2480
|
-
|
|
2481
|
-
|
|
2482
|
-
|
|
2483
|
-
|
|
2484
|
-
|
|
2485
|
-
|
|
2572
|
+
async exec(command, abortSignal, timeout, options) {
|
|
2573
|
+
const DEFAULT_TIMEOUT = 12e4;
|
|
2574
|
+
const commandTimeout = timeout ?? DEFAULT_TIMEOUT;
|
|
2575
|
+
this.abortController = new AbortController();
|
|
2576
|
+
let wasAborted = false;
|
|
2577
|
+
const onAbort = () => {
|
|
2578
|
+
wasAborted = true;
|
|
2579
|
+
try {
|
|
2580
|
+
this.abortController?.abort();
|
|
2581
|
+
} catch {
|
|
2582
|
+
}
|
|
2583
|
+
try {
|
|
2584
|
+
this.currentProcess?.kill();
|
|
2585
|
+
} catch {
|
|
2586
|
+
}
|
|
2587
|
+
};
|
|
2588
|
+
if (abortSignal) {
|
|
2589
|
+
abortSignal.addEventListener("abort", onAbort, { once: true });
|
|
2486
2590
|
}
|
|
2487
|
-
|
|
2591
|
+
const sandbox = options?.sandbox;
|
|
2592
|
+
const shouldAttemptSandbox = sandbox?.enabled === true;
|
|
2593
|
+
const executionCwd = shouldAttemptSandbox && sandbox?.chdir ? sandbox.chdir : this.cwd;
|
|
2594
|
+
const runOnce = async (cmd, cwdOverride) => {
|
|
2595
|
+
this.currentProcess = spawnWithExited({
|
|
2596
|
+
cmd,
|
|
2597
|
+
cwd: cwdOverride ?? executionCwd
|
|
2598
|
+
});
|
|
2599
|
+
const stdoutCollector = this.createCancellableTextCollector(
|
|
2600
|
+
this.currentProcess.stdout,
|
|
2601
|
+
{ onChunk: options?.onStdoutChunk }
|
|
2602
|
+
);
|
|
2603
|
+
const stderrCollector = this.createCancellableTextCollector(
|
|
2604
|
+
this.currentProcess.stderr,
|
|
2605
|
+
{ onChunk: options?.onStderrChunk }
|
|
2606
|
+
);
|
|
2607
|
+
let timeoutHandle = null;
|
|
2608
|
+
const timeoutPromise = new Promise((resolve3) => {
|
|
2609
|
+
timeoutHandle = setTimeout(() => resolve3("timeout"), commandTimeout);
|
|
2610
|
+
});
|
|
2611
|
+
const result = await Promise.race([
|
|
2612
|
+
this.currentProcess.exited.then(() => "completed"),
|
|
2613
|
+
timeoutPromise
|
|
2614
|
+
]);
|
|
2615
|
+
if (timeoutHandle) clearTimeout(timeoutHandle);
|
|
2616
|
+
if (result === "timeout") {
|
|
2617
|
+
try {
|
|
2618
|
+
this.currentProcess.kill();
|
|
2619
|
+
} catch {
|
|
2620
|
+
}
|
|
2621
|
+
try {
|
|
2622
|
+
this.abortController.abort();
|
|
2623
|
+
} catch {
|
|
2624
|
+
}
|
|
2625
|
+
try {
|
|
2626
|
+
await this.currentProcess.exited;
|
|
2627
|
+
} catch {
|
|
2628
|
+
}
|
|
2629
|
+
await Promise.race([
|
|
2630
|
+
Promise.allSettled([stdoutCollector.done, stderrCollector.done]),
|
|
2631
|
+
new Promise((resolve3) => setTimeout(resolve3, 250))
|
|
2632
|
+
]);
|
|
2633
|
+
await Promise.allSettled([
|
|
2634
|
+
stdoutCollector.cancel(),
|
|
2635
|
+
stderrCollector.cancel()
|
|
2636
|
+
]);
|
|
2637
|
+
return {
|
|
2638
|
+
stdout: "",
|
|
2639
|
+
stderr: "Command timed out",
|
|
2640
|
+
code: 143,
|
|
2641
|
+
interrupted: true
|
|
2642
|
+
};
|
|
2643
|
+
}
|
|
2488
2644
|
await Promise.race([
|
|
2489
2645
|
Promise.allSettled([stdoutCollector.done, stderrCollector.done]),
|
|
2490
2646
|
new Promise((resolve3) => setTimeout(resolve3, 250))
|
|
@@ -2493,415 +2649,292 @@ var BunShell = class _BunShell {
|
|
|
2493
2649
|
stdoutCollector.cancel(),
|
|
2494
2650
|
stderrCollector.cancel()
|
|
2495
2651
|
]);
|
|
2496
|
-
|
|
2497
|
-
|
|
2498
|
-
|
|
2499
|
-
|
|
2500
|
-
|
|
2501
|
-
|
|
2502
|
-
|
|
2503
|
-
|
|
2504
|
-
|
|
2505
|
-
|
|
2506
|
-
stderr: stderrAnnotated,
|
|
2507
|
-
code,
|
|
2508
|
-
interrupted
|
|
2652
|
+
const stdout = stdoutCollector.getText();
|
|
2653
|
+
const stderr = stderrCollector.getText();
|
|
2654
|
+
const interrupted = wasAborted || abortSignal?.aborted === true || this.abortController?.signal.aborted === true;
|
|
2655
|
+
const exitCode = this.currentProcess.exitCode ?? (interrupted ? 143 : 0);
|
|
2656
|
+
return {
|
|
2657
|
+
stdout,
|
|
2658
|
+
stderr,
|
|
2659
|
+
code: exitCode,
|
|
2660
|
+
interrupted
|
|
2661
|
+
};
|
|
2509
2662
|
};
|
|
2510
|
-
|
|
2511
|
-
|
|
2512
|
-
|
|
2663
|
+
try {
|
|
2664
|
+
if (shouldAttemptSandbox) {
|
|
2665
|
+
const sandboxCmd = this.buildSandboxCmd(command, sandbox);
|
|
2666
|
+
if (!sandboxCmd) {
|
|
2667
|
+
if (sandbox?.require) {
|
|
2668
|
+
return {
|
|
2669
|
+
stdout: "",
|
|
2670
|
+
stderr: "System sandbox is required but unavailable (missing bubblewrap or unsupported platform).",
|
|
2671
|
+
code: 2,
|
|
2672
|
+
interrupted: false
|
|
2673
|
+
};
|
|
2674
|
+
}
|
|
2675
|
+
const fallback = await runOnce(this.getShellCmd(command));
|
|
2676
|
+
return {
|
|
2677
|
+
...fallback,
|
|
2678
|
+
stderr: `[sandbox] unavailable, ran without isolation.
|
|
2679
|
+
${fallback.stderr}`.trim()
|
|
2680
|
+
};
|
|
2681
|
+
}
|
|
2682
|
+
const sandboxed = await runOnce(sandboxCmd.cmd);
|
|
2683
|
+
sandboxed.stderr = maybeAnnotateMacosSandboxStderr(
|
|
2684
|
+
sandboxed.stderr,
|
|
2685
|
+
sandbox
|
|
2686
|
+
);
|
|
2687
|
+
if (!sandboxed.interrupted && sandboxed.code !== 0 && this.isSandboxInitFailure(sandboxed.stderr) && !sandbox?.require) {
|
|
2688
|
+
const fallback = await runOnce(this.getShellCmd(command));
|
|
2689
|
+
return {
|
|
2690
|
+
...fallback,
|
|
2691
|
+
stderr: `[sandbox] failed to start, ran without isolation.
|
|
2692
|
+
${fallback.stderr}`.trim()
|
|
2693
|
+
};
|
|
2694
|
+
}
|
|
2695
|
+
return sandboxed;
|
|
2696
|
+
}
|
|
2697
|
+
return await runOnce(this.getShellCmd(command));
|
|
2698
|
+
} catch (error) {
|
|
2699
|
+
if (this.abortController.signal.aborted) {
|
|
2700
|
+
this.currentProcess?.kill();
|
|
2701
|
+
return {
|
|
2702
|
+
stdout: "",
|
|
2703
|
+
stderr: "Command was interrupted",
|
|
2704
|
+
code: 143,
|
|
2705
|
+
interrupted: true
|
|
2706
|
+
};
|
|
2707
|
+
}
|
|
2708
|
+
const errorStr = error instanceof Error ? error.message : String(error);
|
|
2709
|
+
logError(`Shell execution error: ${errorStr}`);
|
|
2710
|
+
return {
|
|
2711
|
+
stdout: "",
|
|
2712
|
+
stderr: errorStr,
|
|
2713
|
+
code: 2,
|
|
2714
|
+
interrupted: false
|
|
2715
|
+
};
|
|
2716
|
+
} finally {
|
|
2717
|
+
if (abortSignal) {
|
|
2718
|
+
abortSignal.removeEventListener("abort", onAbort);
|
|
2719
|
+
}
|
|
2513
2720
|
this.currentProcess = null;
|
|
2514
2721
|
this.abortController = null;
|
|
2515
2722
|
}
|
|
2516
2723
|
}
|
|
2517
|
-
|
|
2518
|
-
|
|
2519
|
-
|
|
2520
|
-
|
|
2521
|
-
|
|
2522
|
-
|
|
2523
|
-
|
|
2524
|
-
|
|
2525
|
-
|
|
2526
|
-
|
|
2527
|
-
|
|
2528
|
-
|
|
2529
|
-
|
|
2530
|
-
|
|
2531
|
-
|
|
2532
|
-
|
|
2533
|
-
|
|
2534
|
-
|
|
2535
|
-
|
|
2536
|
-
|
|
2537
|
-
|
|
2538
|
-
|
|
2539
|
-
|
|
2540
|
-
|
|
2541
|
-
|
|
2542
|
-
|
|
2543
|
-
|
|
2544
|
-
|
|
2545
|
-
|
|
2546
|
-
|
|
2547
|
-
|
|
2548
|
-
|
|
2724
|
+
execInBackground(command, timeout, options) {
|
|
2725
|
+
const DEFAULT_TIMEOUT = 12e4;
|
|
2726
|
+
const commandTimeout = timeout ?? DEFAULT_TIMEOUT;
|
|
2727
|
+
const abortController = new AbortController();
|
|
2728
|
+
const sandbox = options?.sandbox;
|
|
2729
|
+
const sandboxCmd = sandbox?.enabled === true ? this.buildSandboxCmd(command, sandbox) : null;
|
|
2730
|
+
const executionCwd = sandbox?.enabled === true && sandbox?.chdir ? sandbox.chdir : this.cwd;
|
|
2731
|
+
if (sandbox?.enabled === true && sandbox?.require && !sandboxCmd) {
|
|
2732
|
+
throw new Error(
|
|
2733
|
+
"System sandbox is required but unavailable (missing bubblewrap or unsupported platform)."
|
|
2734
|
+
);
|
|
2735
|
+
}
|
|
2736
|
+
const cmdToRun = sandboxCmd ? sandboxCmd.cmd : this.getShellCmd(command);
|
|
2737
|
+
const bashId = _BunShell.makeBackgroundTaskId();
|
|
2738
|
+
const outputFile = touchTaskOutputFile(bashId);
|
|
2739
|
+
const process2 = spawnWithExited({ cmd: cmdToRun, cwd: executionCwd });
|
|
2740
|
+
const timeoutHandle = setTimeout(() => {
|
|
2741
|
+
abortController.abort();
|
|
2742
|
+
backgroundProcess.timedOut = true;
|
|
2743
|
+
process2.kill();
|
|
2744
|
+
}, commandTimeout);
|
|
2745
|
+
const backgroundProcess = {
|
|
2746
|
+
id: bashId,
|
|
2747
|
+
command,
|
|
2748
|
+
stdout: "",
|
|
2749
|
+
stderr: "",
|
|
2750
|
+
stdoutCursor: 0,
|
|
2751
|
+
stderrCursor: 0,
|
|
2752
|
+
stdoutLineCount: 0,
|
|
2753
|
+
stderrLineCount: 0,
|
|
2754
|
+
lastReportedStdoutLines: 0,
|
|
2755
|
+
lastReportedStderrLines: 0,
|
|
2756
|
+
code: null,
|
|
2757
|
+
interrupted: false,
|
|
2758
|
+
killed: false,
|
|
2759
|
+
timedOut: false,
|
|
2760
|
+
completionStatusSentInAttachment: false,
|
|
2761
|
+
notified: false,
|
|
2762
|
+
startedAt: Date.now(),
|
|
2763
|
+
timeoutAt: Date.now() + commandTimeout,
|
|
2764
|
+
process: process2,
|
|
2765
|
+
abortController,
|
|
2766
|
+
timeoutHandle,
|
|
2767
|
+
cwd: executionCwd,
|
|
2768
|
+
outputFile
|
|
2769
|
+
};
|
|
2770
|
+
const countNonEmptyLines = (chunk) => chunk.split("\n").filter((line) => line.length > 0).length;
|
|
2771
|
+
this.startStreamReader(process2.stdout, (chunk) => {
|
|
2772
|
+
backgroundProcess.stdout += chunk;
|
|
2773
|
+
appendTaskOutput(bashId, chunk);
|
|
2774
|
+
backgroundProcess.stdoutLineCount += countNonEmptyLines(chunk);
|
|
2775
|
+
});
|
|
2776
|
+
this.startStreamReader(process2.stderr, (chunk) => {
|
|
2777
|
+
backgroundProcess.stderr += chunk;
|
|
2778
|
+
appendTaskOutput(bashId, chunk);
|
|
2779
|
+
backgroundProcess.stderrLineCount += countNonEmptyLines(chunk);
|
|
2780
|
+
});
|
|
2781
|
+
process2.exited.then(() => {
|
|
2782
|
+
backgroundProcess.code = process2.exitCode ?? 0;
|
|
2783
|
+
backgroundProcess.interrupted = backgroundProcess.interrupted || abortController.signal.aborted;
|
|
2784
|
+
if (sandbox?.enabled === true) {
|
|
2785
|
+
backgroundProcess.stderr = maybeAnnotateMacosSandboxStderr(
|
|
2786
|
+
backgroundProcess.stderr,
|
|
2787
|
+
sandbox
|
|
2788
|
+
);
|
|
2789
|
+
}
|
|
2790
|
+
if (backgroundProcess.timeoutHandle) {
|
|
2791
|
+
clearTimeout(backgroundProcess.timeoutHandle);
|
|
2792
|
+
backgroundProcess.timeoutHandle = null;
|
|
2793
|
+
}
|
|
2794
|
+
});
|
|
2795
|
+
this.backgroundProcesses.set(bashId, backgroundProcess);
|
|
2796
|
+
return { bashId };
|
|
2549
2797
|
}
|
|
2550
|
-
|
|
2551
|
-
this.
|
|
2552
|
-
|
|
2798
|
+
getBackgroundOutput(shellId) {
|
|
2799
|
+
const proc = this.backgroundProcesses.get(shellId);
|
|
2800
|
+
if (!proc) return null;
|
|
2801
|
+
const running = proc.code === null && !proc.interrupted;
|
|
2802
|
+
return {
|
|
2803
|
+
stdout: proc.stdout,
|
|
2804
|
+
stderr: proc.stderr,
|
|
2805
|
+
code: proc.code,
|
|
2806
|
+
interrupted: proc.interrupted,
|
|
2807
|
+
killed: proc.killed,
|
|
2808
|
+
timedOut: proc.timedOut,
|
|
2809
|
+
running,
|
|
2810
|
+
command: proc.command,
|
|
2811
|
+
cwd: proc.cwd,
|
|
2812
|
+
startedAt: proc.startedAt,
|
|
2813
|
+
timeoutAt: proc.timeoutAt,
|
|
2814
|
+
outputFile: proc.outputFile
|
|
2815
|
+
};
|
|
2553
2816
|
}
|
|
2554
|
-
|
|
2555
|
-
|
|
2556
|
-
|
|
2557
|
-
|
|
2558
|
-
|
|
2559
|
-
|
|
2560
|
-
|
|
2561
|
-
|
|
2562
|
-
|
|
2563
|
-
|
|
2564
|
-
|
|
2565
|
-
|
|
2566
|
-
|
|
2567
|
-
|
|
2568
|
-
|
|
2569
|
-
|
|
2570
|
-
const stderrCollector = this.createCancellableTextCollector(
|
|
2571
|
-
this.currentProcess.stderr,
|
|
2572
|
-
{ onChunk: options?.onStderrChunk }
|
|
2573
|
-
);
|
|
2574
|
-
let timeoutHandle = null;
|
|
2575
|
-
const timeoutPromise = new Promise((resolve3) => {
|
|
2576
|
-
timeoutHandle = setTimeout(() => resolve3("timeout"), commandTimeout);
|
|
2577
|
-
});
|
|
2578
|
-
const result = await Promise.race([
|
|
2579
|
-
this.currentProcess.exited.then(() => "completed"),
|
|
2580
|
-
timeoutPromise
|
|
2581
|
-
]);
|
|
2582
|
-
if (timeoutHandle) clearTimeout(timeoutHandle);
|
|
2583
|
-
if (result === "timeout") {
|
|
2584
|
-
try {
|
|
2585
|
-
this.currentProcess.kill();
|
|
2586
|
-
} catch {
|
|
2587
|
-
}
|
|
2588
|
-
try {
|
|
2589
|
-
this.abortController.abort();
|
|
2590
|
-
} catch {
|
|
2591
|
-
}
|
|
2592
|
-
try {
|
|
2593
|
-
await this.currentProcess.exited;
|
|
2594
|
-
} catch {
|
|
2817
|
+
readBackgroundOutput(bashId, options) {
|
|
2818
|
+
const proc = this.backgroundProcesses.get(bashId);
|
|
2819
|
+
if (!proc) return null;
|
|
2820
|
+
const stdoutDelta = proc.stdout.slice(proc.stdoutCursor);
|
|
2821
|
+
const stderrDelta = proc.stderr.slice(proc.stderrCursor);
|
|
2822
|
+
proc.stdoutCursor = proc.stdout.length;
|
|
2823
|
+
proc.stderrCursor = proc.stderr.length;
|
|
2824
|
+
const stdoutLines = stdoutDelta === "" ? 0 : stdoutDelta.split("\n").length;
|
|
2825
|
+
const stderrLines = stderrDelta === "" ? 0 : stderrDelta.split("\n").length;
|
|
2826
|
+
let stdoutToReturn = stdoutDelta;
|
|
2827
|
+
let stderrToReturn = stderrDelta;
|
|
2828
|
+
const filter = options?.filter?.trim();
|
|
2829
|
+
if (filter) {
|
|
2830
|
+
const regex = new RegExp(filter, "i");
|
|
2831
|
+
stdoutToReturn = stdoutDelta.split("\n").filter((line) => regex.test(line)).join("\n");
|
|
2832
|
+
stderrToReturn = stderrDelta.split("\n").filter((line) => regex.test(line)).join("\n");
|
|
2595
2833
|
}
|
|
2596
|
-
|
|
2597
|
-
Promise.allSettled([stdoutCollector.done, stderrCollector.done]),
|
|
2598
|
-
new Promise((resolve3) => setTimeout(resolve3, 250))
|
|
2599
|
-
]);
|
|
2600
|
-
await Promise.allSettled([
|
|
2601
|
-
stdoutCollector.cancel(),
|
|
2602
|
-
stderrCollector.cancel()
|
|
2603
|
-
]);
|
|
2834
|
+
const status = proc.killed ? "killed" : proc.code === null ? "running" : proc.code === 0 ? "completed" : "failed";
|
|
2604
2835
|
return {
|
|
2605
|
-
|
|
2606
|
-
|
|
2607
|
-
|
|
2608
|
-
|
|
2836
|
+
shellId: bashId,
|
|
2837
|
+
command: proc.command,
|
|
2838
|
+
cwd: proc.cwd,
|
|
2839
|
+
startedAt: proc.startedAt,
|
|
2840
|
+
timeoutAt: proc.timeoutAt,
|
|
2841
|
+
status,
|
|
2842
|
+
exitCode: proc.code,
|
|
2843
|
+
stdout: stdoutToReturn,
|
|
2844
|
+
stderr: stderrToReturn,
|
|
2845
|
+
stdoutLines,
|
|
2846
|
+
stderrLines,
|
|
2847
|
+
...filter ? { filterPattern: filter } : {}
|
|
2609
2848
|
};
|
|
2610
2849
|
}
|
|
2611
|
-
|
|
2612
|
-
|
|
2613
|
-
|
|
2614
|
-
|
|
2615
|
-
|
|
2616
|
-
|
|
2617
|
-
|
|
2618
|
-
|
|
2619
|
-
|
|
2620
|
-
|
|
2621
|
-
|
|
2622
|
-
const exitCode = this.currentProcess.exitCode ?? (interrupted ? 143 : 0);
|
|
2623
|
-
return {
|
|
2624
|
-
stdout,
|
|
2625
|
-
stderr,
|
|
2626
|
-
code: exitCode,
|
|
2627
|
-
interrupted
|
|
2628
|
-
};
|
|
2629
|
-
};
|
|
2630
|
-
try {
|
|
2631
|
-
if (shouldAttemptSandbox) {
|
|
2632
|
-
const sandboxCmd = this.buildSandboxCmd(command, sandbox);
|
|
2633
|
-
if (!sandboxCmd) {
|
|
2634
|
-
if (sandbox?.require) {
|
|
2635
|
-
return {
|
|
2636
|
-
stdout: "",
|
|
2637
|
-
stderr: "System sandbox is required but unavailable (missing bubblewrap or unsupported platform).",
|
|
2638
|
-
code: 2,
|
|
2639
|
-
interrupted: false
|
|
2640
|
-
};
|
|
2850
|
+
killBackgroundShell(shellId) {
|
|
2851
|
+
const proc = this.backgroundProcesses.get(shellId);
|
|
2852
|
+
if (!proc) return false;
|
|
2853
|
+
try {
|
|
2854
|
+
proc.interrupted = true;
|
|
2855
|
+
proc.killed = true;
|
|
2856
|
+
proc.abortController.abort();
|
|
2857
|
+
proc.process.kill();
|
|
2858
|
+
if (proc.timeoutHandle) {
|
|
2859
|
+
clearTimeout(proc.timeoutHandle);
|
|
2860
|
+
proc.timeoutHandle = null;
|
|
2641
2861
|
}
|
|
2642
|
-
|
|
2643
|
-
|
|
2644
|
-
|
|
2645
|
-
stderr: `[sandbox] unavailable, ran without isolation.
|
|
2646
|
-
${fallback.stderr}`.trim()
|
|
2647
|
-
};
|
|
2862
|
+
return true;
|
|
2863
|
+
} catch {
|
|
2864
|
+
return false;
|
|
2648
2865
|
}
|
|
2649
|
-
|
|
2650
|
-
|
|
2651
|
-
|
|
2652
|
-
|
|
2653
|
-
|
|
2654
|
-
|
|
2655
|
-
|
|
2656
|
-
|
|
2657
|
-
|
|
2658
|
-
|
|
2659
|
-
${
|
|
2660
|
-
};
|
|
2866
|
+
}
|
|
2867
|
+
listBackgroundShells() {
|
|
2868
|
+
return Array.from(this.backgroundProcesses.values());
|
|
2869
|
+
}
|
|
2870
|
+
pwd() {
|
|
2871
|
+
return this.cwd;
|
|
2872
|
+
}
|
|
2873
|
+
async setCwd(cwd2) {
|
|
2874
|
+
const resolved = isAbsolute2(cwd2) ? cwd2 : resolve2(this.cwd, cwd2);
|
|
2875
|
+
if (!existsSync4(resolved)) {
|
|
2876
|
+
throw new Error(`Path "${resolved}" does not exist`);
|
|
2661
2877
|
}
|
|
2662
|
-
|
|
2878
|
+
this.cwd = resolved;
|
|
2663
2879
|
}
|
|
2664
|
-
|
|
2665
|
-
|
|
2666
|
-
if (this.abortController.signal.aborted) {
|
|
2880
|
+
killChildren() {
|
|
2881
|
+
this.abortController?.abort();
|
|
2667
2882
|
this.currentProcess?.kill();
|
|
2668
|
-
|
|
2669
|
-
|
|
2670
|
-
|
|
2671
|
-
code: 143,
|
|
2672
|
-
interrupted: true
|
|
2673
|
-
};
|
|
2883
|
+
for (const bg of Array.from(this.backgroundProcesses.keys())) {
|
|
2884
|
+
this.killBackgroundShell(bg);
|
|
2885
|
+
}
|
|
2674
2886
|
}
|
|
2675
|
-
|
|
2676
|
-
|
|
2677
|
-
|
|
2678
|
-
stdout: "",
|
|
2679
|
-
stderr: errorStr,
|
|
2680
|
-
code: 2,
|
|
2681
|
-
interrupted: false
|
|
2682
|
-
};
|
|
2683
|
-
} finally {
|
|
2684
|
-
if (abortSignal) {
|
|
2685
|
-
abortSignal.removeEventListener("abort", onAbort);
|
|
2887
|
+
close() {
|
|
2888
|
+
this.isAlive = false;
|
|
2889
|
+
this.killChildren();
|
|
2686
2890
|
}
|
|
2687
|
-
|
|
2688
|
-
|
|
2689
|
-
|
|
2690
|
-
|
|
2691
|
-
|
|
2692
|
-
|
|
2693
|
-
|
|
2694
|
-
|
|
2695
|
-
|
|
2696
|
-
|
|
2697
|
-
|
|
2698
|
-
|
|
2699
|
-
|
|
2700
|
-
|
|
2701
|
-
|
|
2702
|
-
|
|
2703
|
-
|
|
2704
|
-
|
|
2705
|
-
|
|
2706
|
-
const process2 = spawnWithExited({ cmd: cmdToRun, cwd: executionCwd });
|
|
2707
|
-
const timeoutHandle = setTimeout(() => {
|
|
2708
|
-
abortController.abort();
|
|
2709
|
-
backgroundProcess.timedOut = true;
|
|
2710
|
-
process2.kill();
|
|
2711
|
-
}, commandTimeout);
|
|
2712
|
-
const backgroundProcess = {
|
|
2713
|
-
id: bashId,
|
|
2714
|
-
command,
|
|
2715
|
-
stdout: "",
|
|
2716
|
-
stderr: "",
|
|
2717
|
-
stdoutCursor: 0,
|
|
2718
|
-
stderrCursor: 0,
|
|
2719
|
-
stdoutLineCount: 0,
|
|
2720
|
-
stderrLineCount: 0,
|
|
2721
|
-
lastReportedStdoutLines: 0,
|
|
2722
|
-
lastReportedStderrLines: 0,
|
|
2723
|
-
code: null,
|
|
2724
|
-
interrupted: false,
|
|
2725
|
-
killed: false,
|
|
2726
|
-
timedOut: false,
|
|
2727
|
-
completionStatusSentInAttachment: false,
|
|
2728
|
-
notified: false,
|
|
2729
|
-
startedAt: Date.now(),
|
|
2730
|
-
timeoutAt: Date.now() + commandTimeout,
|
|
2731
|
-
process: process2,
|
|
2732
|
-
abortController,
|
|
2733
|
-
timeoutHandle,
|
|
2734
|
-
cwd: executionCwd,
|
|
2735
|
-
outputFile
|
|
2736
|
-
};
|
|
2737
|
-
const countNonEmptyLines = (chunk) => chunk.split("\n").filter((line) => line.length > 0).length;
|
|
2738
|
-
this.startStreamReader(process2.stdout, (chunk) => {
|
|
2739
|
-
backgroundProcess.stdout += chunk;
|
|
2740
|
-
appendTaskOutput(bashId, chunk);
|
|
2741
|
-
backgroundProcess.stdoutLineCount += countNonEmptyLines(chunk);
|
|
2742
|
-
});
|
|
2743
|
-
this.startStreamReader(process2.stderr, (chunk) => {
|
|
2744
|
-
backgroundProcess.stderr += chunk;
|
|
2745
|
-
appendTaskOutput(bashId, chunk);
|
|
2746
|
-
backgroundProcess.stderrLineCount += countNonEmptyLines(chunk);
|
|
2747
|
-
});
|
|
2748
|
-
process2.exited.then(() => {
|
|
2749
|
-
backgroundProcess.code = process2.exitCode ?? 0;
|
|
2750
|
-
backgroundProcess.interrupted = backgroundProcess.interrupted || abortController.signal.aborted;
|
|
2751
|
-
if (sandbox?.enabled === true) {
|
|
2752
|
-
backgroundProcess.stderr = maybeAnnotateMacosSandboxStderr(
|
|
2753
|
-
backgroundProcess.stderr,
|
|
2754
|
-
sandbox
|
|
2755
|
-
);
|
|
2891
|
+
flushBashNotifications() {
|
|
2892
|
+
const processes = Array.from(this.backgroundProcesses.values());
|
|
2893
|
+
const statusFor = (proc) => proc.killed ? "killed" : proc.code === null ? "running" : proc.code === 0 ? "completed" : "failed";
|
|
2894
|
+
const notifications = [];
|
|
2895
|
+
for (const proc of processes) {
|
|
2896
|
+
if (proc.notified) continue;
|
|
2897
|
+
const status = statusFor(proc);
|
|
2898
|
+
if (status === "running") continue;
|
|
2899
|
+
notifications.push({
|
|
2900
|
+
type: "bash_notification",
|
|
2901
|
+
taskId: proc.id,
|
|
2902
|
+
description: proc.command,
|
|
2903
|
+
outputFile: proc.outputFile || getTaskOutputFilePath(proc.id),
|
|
2904
|
+
status,
|
|
2905
|
+
...proc.code !== null ? { exitCode: proc.code } : {}
|
|
2906
|
+
});
|
|
2907
|
+
proc.notified = true;
|
|
2908
|
+
}
|
|
2909
|
+
return notifications;
|
|
2756
2910
|
}
|
|
2757
|
-
|
|
2758
|
-
|
|
2759
|
-
|
|
2911
|
+
flushBackgroundShellStatusAttachments() {
|
|
2912
|
+
const processes = Array.from(this.backgroundProcesses.values());
|
|
2913
|
+
const statusFor = (proc) => proc.killed ? "killed" : proc.code === null ? "running" : proc.code === 0 ? "completed" : "failed";
|
|
2914
|
+
const progressAttachments = [];
|
|
2915
|
+
for (const proc of processes) {
|
|
2916
|
+
if (statusFor(proc) !== "running") continue;
|
|
2917
|
+
const stdoutDelta = proc.stdoutLineCount - proc.lastReportedStdoutLines;
|
|
2918
|
+
const stderrDelta = proc.stderrLineCount - proc.lastReportedStderrLines;
|
|
2919
|
+
if (stdoutDelta === 0 && stderrDelta === 0) continue;
|
|
2920
|
+
proc.lastReportedStdoutLines = proc.stdoutLineCount;
|
|
2921
|
+
proc.lastReportedStderrLines = proc.stderrLineCount;
|
|
2922
|
+
progressAttachments.push({
|
|
2923
|
+
type: "task_progress",
|
|
2924
|
+
taskId: proc.id,
|
|
2925
|
+
stdoutLineDelta: stdoutDelta,
|
|
2926
|
+
stderrLineDelta: stderrDelta,
|
|
2927
|
+
outputFile: proc.outputFile || getTaskOutputFilePath(proc.id)
|
|
2928
|
+
});
|
|
2929
|
+
}
|
|
2930
|
+
return progressAttachments;
|
|
2760
2931
|
}
|
|
2761
|
-
});
|
|
2762
|
-
this.backgroundProcesses.set(bashId, backgroundProcess);
|
|
2763
|
-
return { bashId };
|
|
2764
|
-
}
|
|
2765
|
-
getBackgroundOutput(shellId) {
|
|
2766
|
-
const proc = this.backgroundProcesses.get(shellId);
|
|
2767
|
-
if (!proc) return null;
|
|
2768
|
-
const running = proc.code === null && !proc.interrupted;
|
|
2769
|
-
return {
|
|
2770
|
-
stdout: proc.stdout,
|
|
2771
|
-
stderr: proc.stderr,
|
|
2772
|
-
code: proc.code,
|
|
2773
|
-
interrupted: proc.interrupted,
|
|
2774
|
-
killed: proc.killed,
|
|
2775
|
-
timedOut: proc.timedOut,
|
|
2776
|
-
running,
|
|
2777
|
-
command: proc.command,
|
|
2778
|
-
cwd: proc.cwd,
|
|
2779
|
-
startedAt: proc.startedAt,
|
|
2780
|
-
timeoutAt: proc.timeoutAt,
|
|
2781
|
-
outputFile: proc.outputFile
|
|
2782
2932
|
};
|
|
2783
2933
|
}
|
|
2784
|
-
|
|
2785
|
-
const proc = this.backgroundProcesses.get(bashId);
|
|
2786
|
-
if (!proc) return null;
|
|
2787
|
-
const stdoutDelta = proc.stdout.slice(proc.stdoutCursor);
|
|
2788
|
-
const stderrDelta = proc.stderr.slice(proc.stderrCursor);
|
|
2789
|
-
proc.stdoutCursor = proc.stdout.length;
|
|
2790
|
-
proc.stderrCursor = proc.stderr.length;
|
|
2791
|
-
const stdoutLines = stdoutDelta === "" ? 0 : stdoutDelta.split("\n").length;
|
|
2792
|
-
const stderrLines = stderrDelta === "" ? 0 : stderrDelta.split("\n").length;
|
|
2793
|
-
let stdoutToReturn = stdoutDelta;
|
|
2794
|
-
let stderrToReturn = stderrDelta;
|
|
2795
|
-
const filter = options?.filter?.trim();
|
|
2796
|
-
if (filter) {
|
|
2797
|
-
const regex = new RegExp(filter, "i");
|
|
2798
|
-
stdoutToReturn = stdoutDelta.split("\n").filter((line) => regex.test(line)).join("\n");
|
|
2799
|
-
stderrToReturn = stderrDelta.split("\n").filter((line) => regex.test(line)).join("\n");
|
|
2800
|
-
}
|
|
2801
|
-
const status = proc.killed ? "killed" : proc.code === null ? "running" : proc.code === 0 ? "completed" : "failed";
|
|
2802
|
-
return {
|
|
2803
|
-
shellId: bashId,
|
|
2804
|
-
command: proc.command,
|
|
2805
|
-
cwd: proc.cwd,
|
|
2806
|
-
startedAt: proc.startedAt,
|
|
2807
|
-
timeoutAt: proc.timeoutAt,
|
|
2808
|
-
status,
|
|
2809
|
-
exitCode: proc.code,
|
|
2810
|
-
stdout: stdoutToReturn,
|
|
2811
|
-
stderr: stderrToReturn,
|
|
2812
|
-
stdoutLines,
|
|
2813
|
-
stderrLines,
|
|
2814
|
-
...filter ? { filterPattern: filter } : {}
|
|
2815
|
-
};
|
|
2816
|
-
}
|
|
2817
|
-
killBackgroundShell(shellId) {
|
|
2818
|
-
const proc = this.backgroundProcesses.get(shellId);
|
|
2819
|
-
if (!proc) return false;
|
|
2820
|
-
try {
|
|
2821
|
-
proc.interrupted = true;
|
|
2822
|
-
proc.killed = true;
|
|
2823
|
-
proc.abortController.abort();
|
|
2824
|
-
proc.process.kill();
|
|
2825
|
-
if (proc.timeoutHandle) {
|
|
2826
|
-
clearTimeout(proc.timeoutHandle);
|
|
2827
|
-
proc.timeoutHandle = null;
|
|
2828
|
-
}
|
|
2829
|
-
return true;
|
|
2830
|
-
} catch {
|
|
2831
|
-
return false;
|
|
2832
|
-
}
|
|
2833
|
-
}
|
|
2834
|
-
listBackgroundShells() {
|
|
2835
|
-
return Array.from(this.backgroundProcesses.values());
|
|
2836
|
-
}
|
|
2837
|
-
pwd() {
|
|
2838
|
-
return this.cwd;
|
|
2839
|
-
}
|
|
2840
|
-
async setCwd(cwd2) {
|
|
2841
|
-
const resolved = isAbsolute2(cwd2) ? cwd2 : resolve2(this.cwd, cwd2);
|
|
2842
|
-
if (!existsSync4(resolved)) {
|
|
2843
|
-
throw new Error(`Path "${resolved}" does not exist`);
|
|
2844
|
-
}
|
|
2845
|
-
this.cwd = resolved;
|
|
2846
|
-
}
|
|
2847
|
-
killChildren() {
|
|
2848
|
-
this.abortController?.abort();
|
|
2849
|
-
this.currentProcess?.kill();
|
|
2850
|
-
for (const bg of Array.from(this.backgroundProcesses.keys())) {
|
|
2851
|
-
this.killBackgroundShell(bg);
|
|
2852
|
-
}
|
|
2853
|
-
}
|
|
2854
|
-
close() {
|
|
2855
|
-
this.isAlive = false;
|
|
2856
|
-
this.killChildren();
|
|
2857
|
-
}
|
|
2858
|
-
flushBashNotifications() {
|
|
2859
|
-
const processes = Array.from(this.backgroundProcesses.values());
|
|
2860
|
-
const statusFor = (proc) => proc.killed ? "killed" : proc.code === null ? "running" : proc.code === 0 ? "completed" : "failed";
|
|
2861
|
-
const notifications = [];
|
|
2862
|
-
for (const proc of processes) {
|
|
2863
|
-
if (proc.notified) continue;
|
|
2864
|
-
const status = statusFor(proc);
|
|
2865
|
-
if (status === "running") continue;
|
|
2866
|
-
notifications.push({
|
|
2867
|
-
type: "bash_notification",
|
|
2868
|
-
taskId: proc.id,
|
|
2869
|
-
description: proc.command,
|
|
2870
|
-
outputFile: proc.outputFile || getTaskOutputFilePath(proc.id),
|
|
2871
|
-
status,
|
|
2872
|
-
...proc.code !== null ? { exitCode: proc.code } : {}
|
|
2873
|
-
});
|
|
2874
|
-
proc.notified = true;
|
|
2875
|
-
}
|
|
2876
|
-
return notifications;
|
|
2877
|
-
}
|
|
2878
|
-
flushBackgroundShellStatusAttachments() {
|
|
2879
|
-
const processes = Array.from(this.backgroundProcesses.values());
|
|
2880
|
-
const statusFor = (proc) => proc.killed ? "killed" : proc.code === null ? "running" : proc.code === 0 ? "completed" : "failed";
|
|
2881
|
-
const progressAttachments = [];
|
|
2882
|
-
for (const proc of processes) {
|
|
2883
|
-
if (statusFor(proc) !== "running") continue;
|
|
2884
|
-
const stdoutDelta = proc.stdoutLineCount - proc.lastReportedStdoutLines;
|
|
2885
|
-
const stderrDelta = proc.stderrLineCount - proc.lastReportedStderrLines;
|
|
2886
|
-
if (stdoutDelta === 0 && stderrDelta === 0) continue;
|
|
2887
|
-
proc.lastReportedStdoutLines = proc.stdoutLineCount;
|
|
2888
|
-
proc.lastReportedStderrLines = proc.stderrLineCount;
|
|
2889
|
-
progressAttachments.push({
|
|
2890
|
-
type: "task_progress",
|
|
2891
|
-
taskId: proc.id,
|
|
2892
|
-
stdoutLineDelta: stdoutDelta,
|
|
2893
|
-
stderrLineDelta: stderrDelta,
|
|
2894
|
-
outputFile: proc.outputFile || getTaskOutputFilePath(proc.id)
|
|
2895
|
-
});
|
|
2896
|
-
}
|
|
2897
|
-
return progressAttachments;
|
|
2898
|
-
}
|
|
2899
|
-
};
|
|
2934
|
+
});
|
|
2900
2935
|
|
|
2901
2936
|
// src/utils/state/index.ts
|
|
2902
|
-
|
|
2903
|
-
originalCwd: cwd()
|
|
2904
|
-
};
|
|
2937
|
+
import { cwd } from "process";
|
|
2905
2938
|
async function setCwd(cwd2) {
|
|
2906
2939
|
await BunShell.getInstance().setCwd(cwd2);
|
|
2907
2940
|
}
|
|
@@ -2914,37 +2947,47 @@ function getOriginalCwd() {
|
|
|
2914
2947
|
function getCwd() {
|
|
2915
2948
|
return BunShell.getInstance().pwd();
|
|
2916
2949
|
}
|
|
2950
|
+
var STATE;
|
|
2951
|
+
var init_state = __esm({
|
|
2952
|
+
"src/utils/state/index.ts"() {
|
|
2953
|
+
init_shell();
|
|
2954
|
+
STATE = {
|
|
2955
|
+
originalCwd: cwd()
|
|
2956
|
+
};
|
|
2957
|
+
}
|
|
2958
|
+
});
|
|
2917
2959
|
|
|
2918
2960
|
export {
|
|
2919
2961
|
initSentry,
|
|
2920
2962
|
captureException,
|
|
2921
|
-
|
|
2922
|
-
PROJECT_FILE,
|
|
2923
|
-
PRODUCT_COMMAND,
|
|
2924
|
-
CONFIG_BASE_DIR,
|
|
2925
|
-
GITHUB_ISSUES_REPO_URL,
|
|
2926
|
-
ASCII_LOGO,
|
|
2963
|
+
init_sentry,
|
|
2927
2964
|
getTaskOutputFilePath,
|
|
2928
2965
|
readTaskOutput,
|
|
2966
|
+
init_taskOutputStore,
|
|
2929
2967
|
detectRuntimeShell,
|
|
2930
2968
|
renderBackgroundShellStatusAttachment,
|
|
2931
2969
|
renderBashNotification,
|
|
2932
2970
|
BunShell,
|
|
2971
|
+
init_shell,
|
|
2933
2972
|
setCwd,
|
|
2934
2973
|
setOriginalCwd,
|
|
2935
2974
|
getOriginalCwd,
|
|
2936
2975
|
getCwd,
|
|
2976
|
+
init_state,
|
|
2937
2977
|
execFileNoThrow,
|
|
2938
|
-
|
|
2978
|
+
init_execFileNoThrow,
|
|
2979
|
+
getNewcrawBaseDir,
|
|
2939
2980
|
getGlobalConfigFilePath,
|
|
2940
2981
|
getMemoryDir,
|
|
2941
2982
|
NEWCRAW_BASE_DIR,
|
|
2942
2983
|
GLOBAL_CONFIG_FILE,
|
|
2943
2984
|
MEMORY_DIR,
|
|
2944
2985
|
env,
|
|
2986
|
+
init_env,
|
|
2945
2987
|
PLAN_SLUG_ADJECTIVES,
|
|
2946
2988
|
PLAN_SLUG_VERBS,
|
|
2947
2989
|
PLAN_SLUG_NOUNS,
|
|
2990
|
+
init_planSlugWords,
|
|
2948
2991
|
getPlanConversationKey,
|
|
2949
2992
|
setActivePlanConversationKey,
|
|
2950
2993
|
getPlanModeSystemPromptAdditions,
|
|
@@ -2955,6 +2998,7 @@ export {
|
|
|
2955
2998
|
getPlanFilePath,
|
|
2956
2999
|
isMainPlanFilePathForActiveConversation,
|
|
2957
3000
|
readPlanFile,
|
|
3001
|
+
init_planMode,
|
|
2958
3002
|
SESSION_ID,
|
|
2959
3003
|
CACHE_PATHS,
|
|
2960
3004
|
dateToFilename,
|
|
@@ -2966,5 +3010,6 @@ export {
|
|
|
2966
3010
|
getNextAvailableLogForkNumber,
|
|
2967
3011
|
getNextAvailableLogSidechainNumber,
|
|
2968
3012
|
formatDate,
|
|
2969
|
-
logMCPError
|
|
3013
|
+
logMCPError,
|
|
3014
|
+
init_log
|
|
2970
3015
|
};
|