nolo-cli 0.219.0 → 0.220.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/{_executeModel-WW57SJN4.js → _executeModel-BNEMFCAO.js} +74 -74
- package/{action-CK64LS6S.js → action-GDZDXPMB.js} +7 -7
- package/{addContentAction-EQXMFNPR.js → addContentAction-7RO4AMRI.js} +12 -12
- package/{addDialogAgentAction-RSDZDASD.js → addDialogAgentAction-EVYBGTXB.js} +14 -14
- package/{agentDeleteCommand-X2VWEKUA.js → agentDeleteCommand-7QTQNFCO.js} +114 -115
- package/{agentEmailCommands-6IE773VW.js → agentEmailCommands-I7SHOSD6.js} +115 -116
- package/{agentFavoriteCommands-2LKGKSUD.js → agentFavoriteCommands-7LOP3HUD.js} +5 -5
- package/{agentGrantCommands-QQV4N4JW.js → agentGrantCommands-L6O2HVJI.js} +5 -5
- package/{agentListCommands-5UNM7CGG.js → agentListCommands-GUGMORTK.js} +84 -70
- package/{agentMachineCommands-EVWFKK6Q.js → agentMachineCommands-UMDKILU3.js} +56 -55
- package/{agentProviderCommands-ZCH37KAL.js → agentProviderCommands-STI3DQ6A.js} +6 -6
- package/{agentPullCommand-XN6ZPBUW.js → agentPullCommand-KHV4EELF.js} +5 -5
- package/{agentRecordCommands-DX2WE6BH.js → agentRecordCommands-YTAMTHOY.js} +102 -103
- package/{agentRunCommand-KGOT2AFB.js → agentRunCommand-DBM6YNO6.js} +113 -112
- package/{agentRunControl-QDFW5P2T.js → agentRunControl-MBG4U6SL.js} +20 -14
- package/{agentRuntimeLocal-SD7U2EGY.js → agentRuntimeLocal-TU4LA353.js} +39 -39
- package/{agentSlice-ACZGTZVW.js → agentSlice-DPG7Q7IA.js} +16 -16
- package/{appDeleteCommands-NE3NQQJL.js → appDeleteCommands-JWP3XPUA.js} +50 -49
- package/{appDeployCommands-2BAHY522.js → appDeployCommands-6E4TQCWI.js} +50 -49
- package/{appDeployStatusCommands-JTW6LZNC.js → appDeployStatusCommands-ALU4SADG.js} +50 -49
- package/{appGetCommands-WKFEJO6A.js → appGetCommands-JEY4L6L4.js} +50 -49
- package/{appListCommands-HNAZZLFX.js → appListCommands-PCAVHU7M.js} +50 -49
- package/{authCommand-4FDPL7WG.js → authCommand-CGRIIOOV.js} +26 -23
- package/{authCommands-GAJ3NIXO.js → authCommands-55OGQGCR.js} +9 -6
- package/{builtinSkillRegistry-PXH7EGQB.js → builtinSkillRegistry-BAE2LDXF.js} +4 -4
- package/{chromeOpsCommands-YKX2QX3A.js → chromeOpsCommands-WAA45NCS.js} +6 -6
- package/{chunk-OB6DVWPF.js → chunk-262R3XNN.js} +16 -2
- package/{chunk-5OZC7R7Y.js → chunk-2MCB7CD7.js} +13 -12
- package/{chunk-IWH5SOU4.js → chunk-2NPD3FTX.js} +3 -3
- package/{chunk-OGHP3CTL.js → chunk-2X7WFDT6.js} +1 -1
- package/{chunk-XI2BWJM5.js → chunk-324FWHUA.js} +20 -3
- package/{chunk-QWYFFHCJ.js → chunk-3NNXR7EH.js} +10 -10
- package/{chunk-JWXITTQB.js → chunk-3P54D2E4.js} +1 -1
- package/{chunk-EGXPAWLG.js → chunk-3U44JB3O.js} +1 -1
- package/{chunk-KAVGK4ES.js → chunk-44J7Z5AQ.js} +18 -18
- package/{chunk-YL3EFYL3.js → chunk-4D4QD7FT.js} +3 -1
- package/{chunk-EUCFKKDM.js → chunk-4I2MXV5Q.js} +38 -10
- package/{chunk-C4WTX5TU.js → chunk-4ZGPHFLE.js} +2 -2
- package/{chunk-FVZW66K4.js → chunk-53MFERZ3.js} +177 -94
- package/{chunk-MOMR7NMG.js → chunk-547ENH5T.js} +1 -1
- package/{chunk-N7HVLYOY.js → chunk-5WKDR7HS.js} +3 -3
- package/chunk-5ZUOVCKT.js +32 -0
- package/{chunk-TRWT3EE3.js → chunk-62HXNQVV.js} +1 -1
- package/{chunk-KOXKKHFE.js → chunk-6QHKRARD.js} +2 -2
- package/{chunk-N3J4VDGV.js → chunk-6RDBLXVQ.js} +15 -15
- package/{chunk-YGMBIXCF.js → chunk-6XRPBZRS.js} +4 -2
- package/{chunk-JC5XLWZK.js → chunk-7JGMNKKG.js} +19 -15
- package/{chunk-FRSBYNWI.js → chunk-AGYPUBFW.js} +31 -205
- package/{chunk-UYOICCYG.js → chunk-ALAES342.js} +59 -88
- package/{chunk-VREDDN25.js → chunk-ATEKLSLR.js} +1 -1
- package/{chunk-6NKA6RKF.js → chunk-AUAJTAFM.js} +8 -8
- package/{chunk-7UH3DGV6.js → chunk-AWIL6EHN.js} +7 -7
- package/chunk-BIDSIRTS.js +307 -0
- package/chunk-BIWI5M4E.js +62 -0
- package/{chunk-L5I543VB.js → chunk-BNMPUQW6.js} +1 -1
- package/{chunk-BGGHA5DV.js → chunk-BP5ZJ6B4.js} +1 -1
- package/{chunk-Q6HOUF4O.js → chunk-CBUZ6DKA.js} +3 -3
- package/{chunk-LE6LGAJE.js → chunk-CD3RU7XL.js} +17 -2
- package/{chunk-AVHRSJUH.js → chunk-CMMI3DAT.js} +13 -13
- package/{chunk-H7R3365N.js → chunk-CYWNWA77.js} +5 -5
- package/{chunk-6D7NVU66.js → chunk-D6YNCNM6.js} +17 -14
- package/{chunk-6RQFZCKH.js → chunk-DBUR22G5.js} +6 -6
- package/{chunk-PVZY6P3S.js → chunk-DEA37IUY.js} +2 -2
- package/{chunk-QLFCTYRH.js → chunk-DGYCDA6W.js} +3 -3
- package/{chunk-SRL56PI2.js → chunk-DUUDXSLX.js} +21 -7
- package/{chunk-KFHREHUQ.js → chunk-DXWGFL2Z.js} +89 -1
- package/{chunk-PFJNLBRU.js → chunk-EEOOBRA7.js} +6 -6
- package/{chunk-KN3HEZIQ.js → chunk-EVGU5P4U.js} +1 -1
- package/{chunk-CXDPIPZ4.js → chunk-F6Z6ZCUV.js} +2 -2
- package/{chunk-EOWLBDY6.js → chunk-FJSNBZXR.js} +1 -1
- package/{chunk-GNHMRBYZ.js → chunk-G7IUT2V3.js} +4 -3
- package/{chunk-4NMHE7CX.js → chunk-GPOV42YM.js} +14 -14
- package/{chunk-SASHAZ67.js → chunk-GUXZK7SE.js} +2 -2
- package/{chunk-65XXHYZ5.js → chunk-GV6PRJBU.js} +3 -3
- package/{chunk-G2EJ7NL4.js → chunk-HBRDSQ3M.js} +2 -2
- package/{chunk-OOF7XDZF.js → chunk-HHFGE2WF.js} +6 -6
- package/{chunk-DJSTBAOU.js → chunk-HSSBDZLD.js} +4 -4
- package/{chunk-GIABSSWQ.js → chunk-HYLRQDEE.js} +4 -4
- package/{chunk-UJKTI5PG.js → chunk-ILHQ2AXT.js} +0 -1
- package/{chunk-S7SB7L2I.js → chunk-JJMR2EA3.js} +19 -19
- package/{chunk-3ESU44FG.js → chunk-JLAMNSBC.js} +3 -3
- package/{chunk-TVFRV3UQ.js → chunk-JUSHVFNF.js} +238 -185
- package/{chunk-MKQ2UTTX.js → chunk-KHVFJSVE.js} +22 -19
- package/{chunk-7WPAI5JJ.js → chunk-KRI6N5QZ.js} +14 -14
- package/{chunk-HCJFGH6Y.js → chunk-L32W3PRP.js} +46 -16
- package/{chunk-3N4ASIP6.js → chunk-LMRRCEDE.js} +11 -11
- package/{chunk-2KTUDBG7.js → chunk-M4SFKP5L.js} +1 -1
- package/{chunk-VHPAA6MT.js → chunk-MSMHU36U.js} +6 -6
- package/{chunk-F3TQURKK.js → chunk-MXKWTPUM.js} +19 -19
- package/{chunk-XFJ4ZPFC.js → chunk-MXRUXMZ3.js} +25 -25
- package/{chunk-OXKUPBAQ.js → chunk-NHY322ZU.js} +151 -10
- package/{chunk-UMRI2IRY.js → chunk-OBIC6EG7.js} +6 -6
- package/{chunk-VALBGPM6.js → chunk-OBSEKCVK.js} +17 -20
- package/{chunk-SYQR7FQS.js → chunk-OG6MQOQG.js} +96 -28
- package/{chunk-AMEOV5VZ.js → chunk-OOJNQK6V.js} +33 -33
- package/{chunk-K5FNYHZC.js → chunk-OWKNSIXL.js} +149 -54
- package/{chunk-CKT6QUE2.js → chunk-Q3IVPFVO.js} +1 -1
- package/{chunk-AFHOCBSP.js → chunk-QBZCGP34.js} +1 -1
- package/{chunk-2ZKFCIJJ.js → chunk-QCB42576.js} +1 -1
- package/{chunk-HOCHUZQ7.js → chunk-QJTZ76CP.js} +24 -6
- package/{chunk-XWGDCWXY.js → chunk-QRGDJA4B.js} +9 -9
- package/{chunk-4A2JIXR2.js → chunk-QYB23WUH.js} +1 -1
- package/{chunk-652XYZGP.js → chunk-R44TU3MZ.js} +8 -3
- package/{chunk-2VUZSVAS.js → chunk-R6Z5S5GA.js} +7 -7
- package/{chunk-MK2Q7ZJD.js → chunk-R7XWZDOH.js} +58 -24
- package/{chunk-GGKNJ42M.js → chunk-RBPUNSG5.js} +2 -2
- package/{chunk-GVGOEMNV.js → chunk-RG2DGNL6.js} +3 -3
- package/{chunk-2OLYKYNY.js → chunk-RTHFJZ6M.js} +8 -8
- package/{chunk-C4VAR65S.js → chunk-RYOLWYBK.js} +120 -116
- package/{chunk-T3O6BLYU.js → chunk-S5NA3C52.js} +147 -115
- package/{chunk-D726I5AZ.js → chunk-S6FDXXZV.js} +2 -2
- package/{chunk-JVRQ6YVK.js → chunk-S6K5F3KP.js} +1 -1
- package/{chunk-IWQAOW2X.js → chunk-SRCCSTIM.js} +8 -8
- package/{chunk-KO63FPG3.js → chunk-SZVMASJ2.js} +750 -2523
- package/{chunk-Q7WP5RPC.js → chunk-TGNIKIHR.js} +5 -5
- package/{chunk-AK5O76CC.js → chunk-TI2EPRHE.js} +2 -2
- package/{chunk-5R63B62U.js → chunk-TSPMLCWI.js} +7 -7
- package/{chunk-QVBXJNZ2.js → chunk-TUSTONB3.js} +1 -1
- package/{chunk-KEN3N2TN.js → chunk-VMJVAJ6W.js} +13 -10
- package/{chunk-SOF4OWDM.js → chunk-VS276URX.js} +0 -2
- package/{chunk-FIYSMXHY.js → chunk-WWTSEBDF.js} +1 -1
- package/{chunk-E2BESSAW.js → chunk-X4O7FJF5.js} +2 -0
- package/{chunk-J6T25AJ6.js → chunk-XSW4EXQV.js} +82 -18
- package/{chunk-O2CYENYJ.js → chunk-XTETTSKN.js} +2107 -1092
- package/{chunk-DVQH4BTR.js → chunk-YKY4OVOX.js} +14 -10
- package/{chunk-5RKUPJYL.js → chunk-ZH3KXFHS.js} +11 -3
- package/chunk-ZOHO6MOF.js +376 -0
- package/{cliAgentConfigHelpers-PO3MVDME.js → cliAgentConfigHelpers-BTRHMPW2.js} +12 -12
- package/{cliEnvHelpers-VPSJ4XWC.js → cliEnvHelpers-CNMP3RDX.js} +1 -1
- package/{cliExecutor-4MAX3PZL.js → cliExecutor-K6FDZTQ2.js} +3 -1
- package/{cliLocalAgentRecordReader-Z7CH4K4R.js → cliLocalAgentRecordReader-M3F76NIP.js} +45 -45
- package/{commandRegistry-SDSYBKMC.js → commandRegistry-T3UBK6OA.js} +93 -93
- package/{contentThunks-G3TRPEAU.js → contentThunks-YEPZAHXU.js} +36 -35
- package/{cooldownCommands-X7P5M2V5.js → cooldownCommands-YB5H5BBK.js} +4 -4
- package/{createAgentAutomationAction-KHA4MXUJ.js → createAgentAutomationAction-TBIIO5WT.js} +36 -35
- package/{createDialogAction-KWSBNAPJ.js → createDialogAction-KBKMYFTQ.js} +37 -36
- package/{createPageAction-HXKJ7OFG.js → createPageAction-3FGAPLJO.js} +37 -36
- package/{db-CS4ZJQKV.js → db-M7FU2GNK.js} +9 -6
- package/{dbSlice-ZJPDIFER.js → dbSlice-XRUZOGSU.js} +11 -11
- package/{deleteFile-Q3YDB4ML.js → deleteFile-6URDHYRB.js} +7 -7
- package/{dialogCommands-6KQEBHSG.js → dialogCommands-NRLCOPJR.js} +52 -52
- package/{dialogNotifyCommand-WIZFFEY3.js → dialogNotifyCommand-SHGPCU22.js} +13 -13
- package/{dialogSlice-HXPKFGRL.js → dialogSlice-DP2WTMNO.js} +34 -33
- package/{dialogUsageCommand-HTVPR2CX.js → dialogUsageCommand-W2WCSGKF.js} +1 -1
- package/{docCreateCommands-XZOLWBRC.js → docCreateCommands-YJRDA3RX.js} +48 -47
- package/{docDeleteCommands-ZSO4LGWE.js → docDeleteCommands-A5QIHZNF.js} +50 -49
- package/{docReadCommands-TTMXCDER.js → docReadCommands-CF2LTMYH.js} +48 -47
- package/{docStore-A2B3GH33.js → docStore-NDY3K3PK.js} +12 -12
- package/{docUpdateCommands-PRG6WOXL.js → docUpdateCommands-QRKV4ZXE.js} +48 -47
- package/fetchMessages-TQEUZD7H.js +1 -1
- package/{getPricing-YH3VMSVU.js → getPricing-LF5C4XSI.js} +5 -5
- package/{handleSendMessageAction-NWYG3Q72.js → handleSendMessageAction-IUGVVJ43.js} +65 -65
- package/{hostCredentialCreate-WS6D3EHT.js → hostCredentialCreate-X2ZFRXDR.js} +102 -103
- package/index.js +56 -18
- package/keys-RWF7UCB4.js +1 -1
- package/{localDialogRead-SVTPA5GY.js → localDialogRead-CCOCVGAP.js} +1 -1
- package/{localRecall-2J6QPOK2.js → localRecall-BDYKXB46.js} +3 -1
- package/{localRuntimeAdapter-TFYOA6YE.js → localRuntimeAdapter-KAG3T4LF.js} +109 -110
- package/{machineCommands-WFWV25IR.js → machineCommands-6NIQJE2A.js} +111 -112
- package/{machineWsRunDispatch-ZGXC3F2R.js → machineWsRunDispatch-RA5NOSGG.js} +100 -101
- package/{memberThunks-JRYNONYV.js → memberThunks-7Y3OYSJQ.js} +15 -15
- package/{memoryCommands-5WC3T66U.js → memoryCommands-BC6REPQB.js} +4 -4
- package/{models-CXINDUJA.js → models-H5NNZRLH.js} +2 -2
- package/{overlay-THLKYIWY.js → overlay-BBQZXGYI.js} +5 -3
- package/package.json +1 -1
- package/{projectArchive-ULJDLUA6.js → projectArchive-OIUP63MV.js} +42 -41
- package/{providerPresetApply-SHT2SUVB.js → providerPresetApply-WHAMP2D5.js} +6 -6
- package/{providerRegistry-TA7EGCVZ.js → providerRegistry-ZI2KORJ7.js} +6 -6
- package/{read-Q7GOHGNP.js → read-TYMBGEXO.js} +8 -8
- package/{readDocTool-Z5OQ6422.js → readDocTool-SKQVHBLO.js} +1 -1
- package/{readlineWorkspace-LTCV2BFW.js → readlineWorkspace-ZGC4KSXG.js} +3946 -4393
- package/{removeDialogAgentAction-U3F2MNAY.js → removeDialogAgentAction-F5QE2O2B.js} +16 -16
- package/{runAgentClientLoop-BVIEQUB3.js → runAgentClientLoop-NKUW2DSJ.js} +71 -67
- package/{runtimeDoctorCommands-I47JN4HS.js → runtimeDoctorCommands-RRKPBGVO.js} +14 -14
- package/{secretCommands-LJXOOYA7.js → secretCommands-KZWBZIYS.js} +4 -4
- package/{setDialogExtraReferencesAction-G3WSJ7EM.js → setDialogExtraReferencesAction-72L27ERM.js} +13 -13
- package/{setPrimaryDialogAgentAction-6FHAHZBB.js → setPrimaryDialogAgentAction-GJJDUSGJ.js} +16 -16
- package/{settingThunks-AXTBX3Q5.js → settingThunks-ZRGWVGZD.js} +15 -15
- package/{skillDiscovery-B5V23AXP.js → skillDiscovery-I37M5KJC.js} +3 -3
- package/{spaceCommands-IB6FKWIC.js → spaceCommands-MEH3HJBC.js} +53 -52
- package/{store-JRVN62NM.js → store-Z53ICFL3.js} +3 -1
- package/{streamAgentChatTurn-DNYFHBJM.js → streamAgentChatTurn-FJTUUXHJ.js} +89 -128
- package/{switchDialogAgentAction-UOFIAGPL.js → switchDialogAgentAction-IIJBPND3.js} +14 -14
- package/{tableCommands-HITDSLHS.js → tableCommands-FTAOCBTX.js} +11 -11
- package/{tools-JVOJ5HC4.js → tools-ZXHIAOSP.js} +58 -58
- package/tuiRestart-2IL37YIB.js +41 -0
- package/{tuiSummaryLlmCaller-7LWYTHLM.js → tuiSummaryLlmCaller-W2QN4VAC.js} +18 -18
- package/{updateCommands-RJVCRSBP.js → updateCommands-CPATDG6J.js} +8 -6
- package/{updateDialogTitleAction-Q57BOSXG.js → updateDialogTitleAction-JMKLKL4P.js} +36 -35
- package/{usageCommand-RVKHEPLU.js → usageCommand-2BF74MKF.js} +2 -2
- package/{usageRebuildCommand-GRAFOZF2.js → usageRebuildCommand-UHB55BQM.js} +3 -3
- package/{windowsSelfUpdate-KERHIAB4.js → windowsSelfUpdate-ZFD6J5HF.js} +2 -2
- package/chunk-2THCNKE4.js +0 -147
- package/chunk-KEPOVMF4.js +0 -91
- package/{accountResolver-EK2S4PWF.js → accountResolver-QETKNC7T.js} +3 -3
- package/{chunk-AGP3YSEC.js → chunk-4N6G2CKP.js} +3 -3
- package/{chunk-BLVSFYQ3.js → chunk-LISC7BD4.js} +3 -3
- package/{chunk-SNBZZPYH.js → chunk-OQHIVPG4.js} +3 -3
- package/{chunk-47ITIXO7.js → chunk-USGHJSGO.js} +3 -3
- package/{offlineMarxistsAgentCommand-4IC3Y4C6.js → offlineMarxistsAgentCommand-XVXUE6G5.js} +3 -3
- package/{workloadLifecycle-O2I3NZ2Q.js → workloadLifecycle-HFJIN5IZ.js} +8 -8
|
@@ -1,3 +1,9 @@
|
|
|
1
|
+
import {
|
|
2
|
+
isCompiledBinary
|
|
3
|
+
} from "./chunk-BIDSIRTS.js";
|
|
4
|
+
import {
|
|
5
|
+
DEFAULT_NOLO_SERVER_URL
|
|
6
|
+
} from "./chunk-OLZBQWZU.js";
|
|
1
7
|
import {
|
|
2
8
|
loadProfileConfig
|
|
3
9
|
} from "./chunk-R5GO3YZP.js";
|
|
@@ -6,28 +12,22 @@ import {
|
|
|
6
12
|
} from "./chunk-4O22PGNQ.js";
|
|
7
13
|
import {
|
|
8
14
|
scheduleWindowsSelfUpdate
|
|
9
|
-
} from "./chunk-
|
|
15
|
+
} from "./chunk-ZH3KXFHS.js";
|
|
10
16
|
import {
|
|
11
17
|
t
|
|
12
|
-
} from "./chunk-
|
|
13
|
-
import {
|
|
14
|
-
isCompiledBinary
|
|
15
|
-
} from "./chunk-2THCNKE4.js";
|
|
16
|
-
import {
|
|
17
|
-
DEFAULT_NOLO_SERVER_URL
|
|
18
|
-
} from "./chunk-OLZBQWZU.js";
|
|
18
|
+
} from "./chunk-262R3XNN.js";
|
|
19
19
|
import {
|
|
20
20
|
normalizeServerOrigin
|
|
21
21
|
} from "./chunk-CF7PE763.js";
|
|
22
22
|
|
|
23
23
|
// packages/cli/updateCommands.ts
|
|
24
|
-
import { existsSync, readFileSync, accessSync, constants } from "node:fs";
|
|
24
|
+
import { existsSync, readFileSync, accessSync, constants, realpathSync } from "node:fs";
|
|
25
25
|
import { homedir } from "node:os";
|
|
26
26
|
import { dirname, join } from "node:path";
|
|
27
27
|
import { fileURLToPath } from "node:url";
|
|
28
28
|
function resolvePackageJsonPath() {
|
|
29
29
|
if (isCompiledBinary()) {
|
|
30
|
-
const execDir = dirname(process.execPath);
|
|
30
|
+
const execDir = dirname(realpathSync(process.execPath));
|
|
31
31
|
const candidate2 = join(execDir, "package.json");
|
|
32
32
|
if (existsSync(candidate2)) return candidate2;
|
|
33
33
|
return null;
|
|
@@ -212,6 +212,34 @@ async function runShellScript(script, {
|
|
|
212
212
|
]);
|
|
213
213
|
return exitCode;
|
|
214
214
|
}
|
|
215
|
+
function buildManagedNpmUpdateScript(channel) {
|
|
216
|
+
return `set -eu
|
|
217
|
+
PREFIX=$(npm prefix -g)
|
|
218
|
+
ENTRY="$PREFIX/bin/nolo"
|
|
219
|
+
ROOT="\${NOLO_HOME:-$HOME/.nolo}/cli/versions"
|
|
220
|
+
mkdir -p "$ROOT" "\${ENTRY%/*}"
|
|
221
|
+
STAGING=$(mktemp -d "$ROOT/npm.XXXXXXXX")
|
|
222
|
+
# npm writes only into the newly reserved prefix, never the global package.
|
|
223
|
+
npm install -g --prefix "$STAGING" ${shellQuote(`nolo-cli@${channel}`)} --progress
|
|
224
|
+
PACKAGE="$STAGING/lib/node_modules/nolo-cli"
|
|
225
|
+
node -e 'const p=require(process.argv[1]); if(p.name!=="nolo-cli" || !/^[0-9]+\\.[0-9]+\\.[0-9]+(?:[-+][0-9A-Za-z.+-]+)?$/.test(p.version)) process.exit(1)' "$PACKAGE/package.json"
|
|
226
|
+
VERSION_TEXT=$("$PACKAGE/index.js" -v)
|
|
227
|
+
case "$VERSION_TEXT" in
|
|
228
|
+
"nolo-cli "*) ;;
|
|
229
|
+
*) echo "Error: invalid staged CLI version" >&2; exit 1 ;;
|
|
230
|
+
esac
|
|
231
|
+
# Fail before touching the live entry. Version is a health check, not identity:
|
|
232
|
+
# every install has a unique permanent prefix, including same-version builds.
|
|
233
|
+
EXPECTED=$(node -p 'require(process.argv[1]).version' "$PACKAGE/package.json")
|
|
234
|
+
[ "$VERSION_TEXT" = "nolo-cli $EXPECTED" ]
|
|
235
|
+
if [ -d "$ENTRY" ] || { [ -e "$ENTRY" ] && [ ! -L "$ENTRY" ]; }; then echo "Error: refusing non-symlink entrypoint; retain it and migrate explicitly" >&2; exit 1; fi
|
|
236
|
+
LINK="$ENTRY.new.$$"
|
|
237
|
+
if [ -e "$LINK" ] || [ -L "$LINK" ]; then exit 1; fi
|
|
238
|
+
ln -s "$PACKAGE/index.js" "$LINK"
|
|
239
|
+
mv -f "$LINK" "$ENTRY"
|
|
240
|
+
echo "nolo updated to $ENTRY"
|
|
241
|
+
`;
|
|
242
|
+
}
|
|
215
243
|
function shellQuote(value) {
|
|
216
244
|
return "'" + value.replace(/'/g, "'\\''") + "'";
|
|
217
245
|
}
|
|
@@ -221,39 +249,19 @@ function buildStandaloneUpdateScript(args) {
|
|
|
221
249
|
EXTRACT_DIR=${shellQuote(args.extractDir)}
|
|
222
250
|
ENTRY=${shellQuote(args.symlinkPath)}
|
|
223
251
|
CURRENT_VERSION=${shellQuote(args.currentVersion)}
|
|
224
|
-
|
|
225
|
-
|
|
252
|
+
if [ -L "$EXTRACT_DIR" ]; then
|
|
253
|
+
echo "Error: refusing symlink bundle directory" >&2
|
|
254
|
+
exit 1
|
|
255
|
+
fi
|
|
256
|
+
# mktemp reserves a fresh directory even for rebuilds of the same version.
|
|
257
|
+
mkdir -p "$EXTRACT_DIR.versions"
|
|
258
|
+
STAGING=$(mktemp -d "$EXTRACT_DIR.versions/build.XXXXXXXX")
|
|
226
259
|
LINK="$ENTRY.new.$$"
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
committed=0
|
|
230
|
-
cleanup() {
|
|
231
|
-
status=$?
|
|
232
|
-
trap - 0 HUP INT TERM
|
|
233
|
-
if [ "$committed" = 0 ]; then
|
|
234
|
-
if [ "$new_moved" = 1 ] && [ -d "$EXTRACT_DIR" ]; then
|
|
235
|
-
mv "$EXTRACT_DIR" "$STAGING" || exit 1
|
|
236
|
-
fi
|
|
237
|
-
if [ "$old_moved" = 1 ] && [ -d "$BACKUP" ]; then
|
|
238
|
-
mv "$BACKUP" "$EXTRACT_DIR" || exit 1
|
|
239
|
-
fi
|
|
240
|
-
fi
|
|
241
|
-
rm -rf "$STAGING" || true
|
|
242
|
-
rm -f "$LINK" || true
|
|
243
|
-
exit "$status"
|
|
244
|
-
}
|
|
245
|
-
# Refuse collisions before installing cleanup: never remove somebody else's path.
|
|
246
|
-
if [ -e "$STAGING" ] || [ -L "$STAGING" ] ||
|
|
247
|
-
[ -e "$BACKUP" ] || [ -L "$BACKUP" ] ||
|
|
248
|
-
[ -e "$LINK" ] || [ -L "$LINK" ]; then
|
|
249
|
-
echo "Error: update staging path already exists" >&2
|
|
260
|
+
if [ -e "$LINK" ] || [ -L "$LINK" ]; then
|
|
261
|
+
echo "Error: update link staging path already exists" >&2
|
|
250
262
|
exit 1
|
|
251
263
|
fi
|
|
252
|
-
|
|
253
|
-
mkdir "$STAGING"
|
|
254
|
-
trap cleanup 0
|
|
255
|
-
trap 'exit 1' HUP INT TERM
|
|
256
|
-
|
|
264
|
+
# Failed staged bundles are retained too; no old runtime is ever removed.
|
|
257
265
|
echo ${shellQuote(`Downloading nolo from ${args.tarballUrl}...`)}
|
|
258
266
|
if ! ${curl} ${shellQuote(args.tarballUrl)} -o "$STAGING/bundle.tar.gz"; then
|
|
259
267
|
${args.tarballUrl !== args.fallbackUrl ? `echo ${shellQuote(`Primary source unavailable, trying ${args.fallbackUrl}...`)}
|
|
@@ -264,7 +272,6 @@ if ! ${curl} ${shellQuote(args.tarballUrl)} -o "$STAGING/bundle.tar.gz"; then
|
|
|
264
272
|
exit 1`}
|
|
265
273
|
fi
|
|
266
274
|
tar -xzf "$STAGING/bundle.tar.gz" -C "$STAGING"
|
|
267
|
-
rm -f "$STAGING/bundle.tar.gz"
|
|
268
275
|
chmod +x "$STAGING/nolo"
|
|
269
276
|
# A failing, empty or malformed version response must not touch the live install.
|
|
270
277
|
VERSION_TEXT=$("$STAGING/nolo" -v)
|
|
@@ -321,32 +328,14 @@ if [ -n "$CUR_MAJOR" ] && [ -n "$CUR_MINOR" ] && [ -n "$CUR_PATCH" ]; then
|
|
|
321
328
|
;;
|
|
322
329
|
esac
|
|
323
330
|
fi
|
|
324
|
-
if [ "$VERSION" = "$CURRENT_VERSION" ]; then
|
|
325
|
-
echo "\u2713 Already up to date (nolo-cli $VERSION)."
|
|
326
|
-
exit 10
|
|
327
|
-
fi
|
|
328
331
|
mkdir -p "\${ENTRY%/*}"
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
echo "Error: refusing directory entrypoint or symlink bundle directory" >&2
|
|
332
|
+
if [ -d "$ENTRY" ] || { [ -e "$ENTRY" ] && [ ! -L "$ENTRY" ]; }; then
|
|
333
|
+
echo "Error: refusing non-symlink entrypoint; retain it and migrate explicitly" >&2
|
|
332
334
|
exit 1
|
|
333
335
|
fi
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
old_moved=1
|
|
337
|
-
mv "$EXTRACT_DIR" "$BACKUP"
|
|
338
|
-
fi
|
|
339
|
-
new_moved=1
|
|
340
|
-
mv "$STAGING" "$EXTRACT_DIR"
|
|
336
|
+
# The staged path becomes permanent. Never rename the running bundle.
|
|
337
|
+
ln -s "$STAGING/nolo" "$LINK"
|
|
341
338
|
mv -f "$LINK" "$ENTRY"
|
|
342
|
-
committed=1
|
|
343
|
-
# Retain only the newest recovery copy from this run; prune older backups.
|
|
344
|
-
for old_copy in "$EXTRACT_DIR.old."*; do
|
|
345
|
-
if [ -d "$old_copy" ] && [ ! -L "$old_copy" ] && [ "$old_copy" != "$BACKUP" ]; then
|
|
346
|
-
rm -rf "$old_copy" || true
|
|
347
|
-
fi
|
|
348
|
-
done
|
|
349
|
-
# Retain the previous bundle as a recovery copy; never unlink the live entry.
|
|
350
339
|
echo "nolo updated to $ENTRY"
|
|
351
340
|
`;
|
|
352
341
|
}
|
|
@@ -369,7 +358,7 @@ async function runStandaloneBundleUpdate(options) {
|
|
|
369
358
|
const tarballUrl = `${repoBase}/public/downloads/${bundleName}`;
|
|
370
359
|
const fallbackUrl = `https://nolo.chat/public/downloads/${bundleName}`;
|
|
371
360
|
const extractDir = join(homedir(), ".nolo", extractSubdir);
|
|
372
|
-
const installDir = resolveStandaloneInstallDir();
|
|
361
|
+
const installDir = env.NOLO_INSTALL_DIR || resolveStandaloneInstallDir();
|
|
373
362
|
const symlinkPath = join(installDir, "nolo");
|
|
374
363
|
const script = buildStandaloneUpdateScript({
|
|
375
364
|
tarballUrl,
|
|
@@ -543,31 +532,12 @@ ${t("updateInstallerTitle")}
|
|
|
543
532
|
`);
|
|
544
533
|
output.write(`${t("updateNpmDownloading")}
|
|
545
534
|
`);
|
|
546
|
-
const
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
stdout: useCustomSink ? "pipe" : "inherit",
|
|
552
|
-
stderr: useCustomSink ? "pipe" : "inherit",
|
|
553
|
-
env
|
|
535
|
+
const exitCode = await runShellScript(buildManagedNpmUpdateScript(channel), {
|
|
536
|
+
output,
|
|
537
|
+
spawn,
|
|
538
|
+
env,
|
|
539
|
+
useCustomSink: options.output !== void 0
|
|
554
540
|
});
|
|
555
|
-
if (!useCustomSink) {
|
|
556
|
-
const exitCode2 = await proc.exited;
|
|
557
|
-
if (exitCode2 === 0) {
|
|
558
|
-
output.write(` ${renderProgressBar(100)}
|
|
559
|
-
`);
|
|
560
|
-
output.write(`${t("updateCompleted")}
|
|
561
|
-
|
|
562
|
-
`);
|
|
563
|
-
}
|
|
564
|
-
return { exitCode: exitCode2, disposition: "completed" };
|
|
565
|
-
}
|
|
566
|
-
const [exitCode] = await Promise.all([
|
|
567
|
-
proc.exited,
|
|
568
|
-
forwardSpawnOutput(proc.stdout, output),
|
|
569
|
-
forwardSpawnOutput(proc.stderr, output)
|
|
570
|
-
]);
|
|
571
541
|
if (exitCode === 0) {
|
|
572
542
|
output.write(` ${renderProgressBar(100)}
|
|
573
543
|
`);
|
|
@@ -594,6 +564,7 @@ export {
|
|
|
594
564
|
buildSelfUpdateCommand,
|
|
595
565
|
resolveSelfUpdateServerUrl,
|
|
596
566
|
buildCliDoctorText,
|
|
567
|
+
buildManagedNpmUpdateScript,
|
|
597
568
|
buildStandaloneUpdateScript,
|
|
598
569
|
runStandaloneBundleUpdate,
|
|
599
570
|
NOLO_UPDATE_CHECK_KILL_SWITCH,
|
|
@@ -1,22 +1,19 @@
|
|
|
1
|
-
import {
|
|
2
|
-
readDbRecord,
|
|
3
|
-
writeAgentRecord
|
|
4
|
-
} from "./chunk-6D7NVU66.js";
|
|
5
1
|
import {
|
|
6
2
|
buildSkillSummaryMarker
|
|
7
3
|
} from "./chunk-VF4K2QE6.js";
|
|
4
|
+
import {
|
|
5
|
+
readDbRecord,
|
|
6
|
+
writeAgentRecord
|
|
7
|
+
} from "./chunk-D6YNCNM6.js";
|
|
8
8
|
import {
|
|
9
9
|
createSpaceKey
|
|
10
10
|
} from "./chunk-UAD2WT54.js";
|
|
11
|
-
import {
|
|
12
|
-
asTrimmedLowercaseString
|
|
13
|
-
} from "./chunk-QSJ3HFEF.js";
|
|
14
11
|
import {
|
|
15
12
|
parseUserIdFromAuthToken,
|
|
16
13
|
readOption,
|
|
17
14
|
resolveAuthToken,
|
|
18
15
|
resolveServerUrl
|
|
19
|
-
} from "./chunk-
|
|
16
|
+
} from "./chunk-BIDSIRTS.js";
|
|
20
17
|
import {
|
|
21
18
|
NOLO_CLUSTER_SERVERS
|
|
22
19
|
} from "./chunk-LCBAMY2M.js";
|
|
@@ -26,6 +23,9 @@ import {
|
|
|
26
23
|
import {
|
|
27
24
|
normalizeServerOrigin
|
|
28
25
|
} from "./chunk-CF7PE763.js";
|
|
26
|
+
import {
|
|
27
|
+
asTrimmedLowercaseString
|
|
28
|
+
} from "./chunk-QSJ3HFEF.js";
|
|
29
29
|
|
|
30
30
|
// packages/cli/docSpaceHelpers.ts
|
|
31
31
|
async function ensurePageAttachedToSpace(params) {
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import {
|
|
2
2
|
addContentToSpace
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-MXKWTPUM.js";
|
|
4
4
|
import {
|
|
5
5
|
prepareAndPersistMessage,
|
|
6
6
|
uiAskChoiceFunc,
|
|
7
7
|
uiAskChoiceFunctionSchema
|
|
8
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-53MFERZ3.js";
|
|
9
9
|
import {
|
|
10
10
|
require_format
|
|
11
11
|
} from "./chunk-BUDVRYES.js";
|
|
@@ -18,10 +18,10 @@ import {
|
|
|
18
18
|
removeCachedEntity,
|
|
19
19
|
upsertSSREntity,
|
|
20
20
|
write
|
|
21
|
-
} from "./chunk-
|
|
21
|
+
} from "./chunk-CMMI3DAT.js";
|
|
22
22
|
import {
|
|
23
23
|
isDevelopment
|
|
24
|
-
} from "./chunk-
|
|
24
|
+
} from "./chunk-4N6G2CKP.js";
|
|
25
25
|
import {
|
|
26
26
|
selectIdentityUserId
|
|
27
27
|
} from "./chunk-PXYBUFDB.js";
|
|
@@ -37,15 +37,15 @@ import {
|
|
|
37
37
|
createDialogKey,
|
|
38
38
|
dialogMessageRange
|
|
39
39
|
} from "./chunk-OJKUU3LP.js";
|
|
40
|
+
import {
|
|
41
|
+
asOptionalPositiveFiniteNumber
|
|
42
|
+
} from "./chunk-U6VC4MU4.js";
|
|
40
43
|
import {
|
|
41
44
|
asTrimmedString
|
|
42
45
|
} from "./chunk-3EUW3WEO.js";
|
|
43
46
|
import {
|
|
44
47
|
isRecord
|
|
45
48
|
} from "./chunk-KUG52IAP.js";
|
|
46
|
-
import {
|
|
47
|
-
asOptionalPositiveFiniteNumber
|
|
48
|
-
} from "./chunk-U6VC4MU4.js";
|
|
49
49
|
import {
|
|
50
50
|
asOptionalTrimmedString
|
|
51
51
|
} from "./chunk-G3SUCT4W.js";
|
|
@@ -0,0 +1,307 @@
|
|
|
1
|
+
import {
|
|
2
|
+
DEFAULT_NOLO_SERVER_URL
|
|
3
|
+
} from "./chunk-OLZBQWZU.js";
|
|
4
|
+
import {
|
|
5
|
+
NOLO_CLUSTER_SERVERS
|
|
6
|
+
} from "./chunk-LCBAMY2M.js";
|
|
7
|
+
import {
|
|
8
|
+
asOptionalTrimmedString
|
|
9
|
+
} from "./chunk-G3SUCT4W.js";
|
|
10
|
+
import {
|
|
11
|
+
DEFAULT_LOCAL_API_ORIGIN
|
|
12
|
+
} from "./chunk-4SN6J65J.js";
|
|
13
|
+
import {
|
|
14
|
+
normalizeServerOrigin
|
|
15
|
+
} from "./chunk-CF7PE763.js";
|
|
16
|
+
|
|
17
|
+
// packages/cli/agentRunProtocol.ts
|
|
18
|
+
import { createHash } from "node:crypto";
|
|
19
|
+
import { existsSync, lstatSync, statSync, readFileSync, readdirSync, realpathSync } from "node:fs";
|
|
20
|
+
import { dirname, extname, join, relative } from "node:path";
|
|
21
|
+
import { fileURLToPath } from "node:url";
|
|
22
|
+
var AGENT_RUN_PROTOCOL = "nolo-agent-run/2";
|
|
23
|
+
var RuntimeProtocolMismatchError = class extends Error {
|
|
24
|
+
code = "runtime_protocol_mismatch";
|
|
25
|
+
constructor() {
|
|
26
|
+
super("runtime_protocol_mismatch: parent and child agent-run protocols differ");
|
|
27
|
+
}
|
|
28
|
+
};
|
|
29
|
+
function validateAgentRunProtocol(expected) {
|
|
30
|
+
if (expected !== AGENT_RUN_PROTOCOL) throw new RuntimeProtocolMismatchError();
|
|
31
|
+
}
|
|
32
|
+
var RuntimeVersionMismatchError = class extends Error {
|
|
33
|
+
code = "runtime_version_mismatch";
|
|
34
|
+
constructor(detail) {
|
|
35
|
+
super(`runtime_version_mismatch: ${detail}; restart CLI/desktop before retrying`);
|
|
36
|
+
}
|
|
37
|
+
};
|
|
38
|
+
var ignoredDirectories = /* @__PURE__ */ new Set([
|
|
39
|
+
"node_modules",
|
|
40
|
+
".git",
|
|
41
|
+
".nolo",
|
|
42
|
+
".worktrees",
|
|
43
|
+
"data",
|
|
44
|
+
"nolodata",
|
|
45
|
+
"credentials",
|
|
46
|
+
"dist",
|
|
47
|
+
"build",
|
|
48
|
+
"public",
|
|
49
|
+
"assets",
|
|
50
|
+
"docs",
|
|
51
|
+
"logs",
|
|
52
|
+
"artifacts",
|
|
53
|
+
"coverage",
|
|
54
|
+
"__tests__",
|
|
55
|
+
"__fixtures__",
|
|
56
|
+
"fixtures",
|
|
57
|
+
"testHelpers",
|
|
58
|
+
"test-helpers"
|
|
59
|
+
]);
|
|
60
|
+
var codeFile = /\.[cm]?[jt]sx?$/;
|
|
61
|
+
var testFile = /(?:\.(?:test|spec)\.[^.]+$|^tsconfig\.)/;
|
|
62
|
+
function captureRuntimeContent(root, source) {
|
|
63
|
+
const hash = createHash("sha256");
|
|
64
|
+
const active = /* @__PURE__ */ new Set();
|
|
65
|
+
const visit = (directory) => {
|
|
66
|
+
const canonical = realpathSync(directory);
|
|
67
|
+
if (active.has(canonical)) throw new RuntimeVersionMismatchError("runtime code contains a symlink cycle");
|
|
68
|
+
active.add(canonical);
|
|
69
|
+
for (const name of readdirSync(directory).sort()) {
|
|
70
|
+
if (name.startsWith(".") || ignoredDirectories.has(name)) continue;
|
|
71
|
+
const path = join(directory, name);
|
|
72
|
+
let stat = lstatSync(path);
|
|
73
|
+
if (stat.isSymbolicLink()) {
|
|
74
|
+
try {
|
|
75
|
+
stat = statSync(path);
|
|
76
|
+
} catch {
|
|
77
|
+
if (codeFile.test(name) || name === "package.json") throw new RuntimeVersionMismatchError("runtime code link is unreadable");
|
|
78
|
+
continue;
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
if (stat.isDirectory()) visit(path);
|
|
82
|
+
else if (codeFile.test(name) && !testFile.test(name) || name === "package.json") {
|
|
83
|
+
const bytes = readFileSync(path);
|
|
84
|
+
hash.update(JSON.stringify([relative(root, path), bytes.length]));
|
|
85
|
+
hash.update(bytes);
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
active.delete(canonical);
|
|
89
|
+
};
|
|
90
|
+
if (source) {
|
|
91
|
+
visit(join(root, "packages"));
|
|
92
|
+
for (const name of ["package.json", "bun.lock", "bun.lockb", "bunfig.toml", "tsconfig.json"]) {
|
|
93
|
+
hash.update(name);
|
|
94
|
+
const path = join(root, name);
|
|
95
|
+
hash.update(existsSync(path) ? readFileSync(path) : "<absent>");
|
|
96
|
+
}
|
|
97
|
+
} else visit(root);
|
|
98
|
+
return hash.digest("hex");
|
|
99
|
+
}
|
|
100
|
+
function createRuntimeContentGuard(root, source) {
|
|
101
|
+
const canonical = realpathSync(root);
|
|
102
|
+
const startupContent = captureRuntimeContent(canonical, source);
|
|
103
|
+
return Object.assign(() => {
|
|
104
|
+
try {
|
|
105
|
+
if (captureRuntimeContent(canonical, source) !== startupContent) {
|
|
106
|
+
throw new RuntimeVersionMismatchError("runtime content changed since host startup");
|
|
107
|
+
}
|
|
108
|
+
} catch (error) {
|
|
109
|
+
if (error instanceof RuntimeVersionMismatchError) throw error;
|
|
110
|
+
throw new RuntimeVersionMismatchError("startup runtime content is no longer readable");
|
|
111
|
+
}
|
|
112
|
+
}, { identity: startupContent });
|
|
113
|
+
}
|
|
114
|
+
function captureHostRuntimeGuard() {
|
|
115
|
+
try {
|
|
116
|
+
const url = import.meta.url;
|
|
117
|
+
if (url.includes("/$bunfs/")) {
|
|
118
|
+
const executable = getHostRuntimeExecutable();
|
|
119
|
+
const digest = createHash("sha256").update(readFileSync(executable)).digest("hex");
|
|
120
|
+
return Object.assign(() => {
|
|
121
|
+
try {
|
|
122
|
+
if (createHash("sha256").update(readFileSync(executable)).digest("hex") !== digest) {
|
|
123
|
+
throw new RuntimeVersionMismatchError("host executable changed since startup");
|
|
124
|
+
}
|
|
125
|
+
} catch (error) {
|
|
126
|
+
if (error instanceof RuntimeVersionMismatchError) throw error;
|
|
127
|
+
throw new RuntimeVersionMismatchError("startup executable is no longer readable");
|
|
128
|
+
}
|
|
129
|
+
}, { identity: digest });
|
|
130
|
+
}
|
|
131
|
+
const modulePath = fileURLToPath(url);
|
|
132
|
+
const source = extname(modulePath) === ".ts";
|
|
133
|
+
return createRuntimeContentGuard(source ? dirname(dirname(dirname(modulePath))) : dirname(modulePath), source);
|
|
134
|
+
} catch {
|
|
135
|
+
return Object.assign(() => {
|
|
136
|
+
throw new RuntimeVersionMismatchError("host startup identity unavailable");
|
|
137
|
+
}, { identity: "unavailable" });
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
var hostExecutable;
|
|
141
|
+
function getHostRuntimeExecutable() {
|
|
142
|
+
return hostExecutable ?? realpathSync(process.execPath);
|
|
143
|
+
}
|
|
144
|
+
var hostGuard;
|
|
145
|
+
var HOST_RUNTIME_CONTENT_IDENTITY = "uninitialized";
|
|
146
|
+
function initializeHostRuntimeIdentity() {
|
|
147
|
+
if (hostGuard) return;
|
|
148
|
+
hostExecutable = realpathSync(process.execPath);
|
|
149
|
+
hostGuard = captureHostRuntimeGuard();
|
|
150
|
+
HOST_RUNTIME_CONTENT_IDENTITY = hostGuard.identity;
|
|
151
|
+
}
|
|
152
|
+
function isAgentRuntimeHostCommand(args, interactive) {
|
|
153
|
+
if (args.some((arg) => ["--help", "-h", "--version", "-v"].includes(arg))) return false;
|
|
154
|
+
if (!args.length) return interactive;
|
|
155
|
+
return args[0] === "chat" || args[0] === "tui" || args[0] === "connect" || args[0] === "agent" && ["run", "continue", "smoke-current"].includes(args[1]);
|
|
156
|
+
}
|
|
157
|
+
function resolveExactRuntimeEntrypoint(path) {
|
|
158
|
+
try {
|
|
159
|
+
if (!existsSync(path)) throw new Error("missing");
|
|
160
|
+
return realpathSync(path);
|
|
161
|
+
} catch {
|
|
162
|
+
throw new RuntimeVersionMismatchError("explicit runtime entrypoint is missing or unreadable");
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
// packages/cli/cliEnvHelpers.ts
|
|
167
|
+
import { dirname as dirname2, extname as extname2, join as join2 } from "node:path";
|
|
168
|
+
import { fileURLToPath as fileURLToPath2 } from "node:url";
|
|
169
|
+
import { existsSync as existsSync2, realpathSync as realpathSync2 } from "node:fs";
|
|
170
|
+
function resolveServerUrlFromEnv(env) {
|
|
171
|
+
return normalizeServerOrigin(
|
|
172
|
+
env.NOLO_SERVER || env.BASE_URL || DEFAULT_NOLO_SERVER_URL
|
|
173
|
+
);
|
|
174
|
+
}
|
|
175
|
+
function isCliArgs(value) {
|
|
176
|
+
return Array.isArray(value);
|
|
177
|
+
}
|
|
178
|
+
function buildServerCandidates(values) {
|
|
179
|
+
return [...new Set(
|
|
180
|
+
values.filter((value) => typeof value === "string" && value.trim().length > 0).map((value) => normalizeServerOrigin(value))
|
|
181
|
+
)];
|
|
182
|
+
}
|
|
183
|
+
function resolveServerUrl(input, env) {
|
|
184
|
+
if (isCliArgs(input)) {
|
|
185
|
+
const explicit = readOption(input, "--server-url") || readOption(input, "--server");
|
|
186
|
+
return normalizeServerOrigin(explicit) || resolveServerUrlFromEnv(env ?? {});
|
|
187
|
+
}
|
|
188
|
+
return resolveServerUrlFromEnv(input);
|
|
189
|
+
}
|
|
190
|
+
function resolveServerCandidates(input, envOrPreferred, preferred) {
|
|
191
|
+
if (isCliArgs(input)) {
|
|
192
|
+
const env2 = envOrPreferred ?? {};
|
|
193
|
+
const explicitServer = resolveServerUrl(input, env2);
|
|
194
|
+
return buildServerCandidates([
|
|
195
|
+
explicitServer,
|
|
196
|
+
preferred?.trim(),
|
|
197
|
+
env2.NOLO_SERVER,
|
|
198
|
+
env2.BASE_URL,
|
|
199
|
+
env2.NOLO_SERVER_URL,
|
|
200
|
+
DEFAULT_NOLO_SERVER_URL,
|
|
201
|
+
...NOLO_CLUSTER_SERVERS
|
|
202
|
+
]);
|
|
203
|
+
}
|
|
204
|
+
const env = input;
|
|
205
|
+
return buildServerCandidates([
|
|
206
|
+
asOptionalTrimmedString(envOrPreferred),
|
|
207
|
+
env.NOLO_SERVER,
|
|
208
|
+
env.BASE_URL,
|
|
209
|
+
env.NOLO_SERVER_URL,
|
|
210
|
+
DEFAULT_NOLO_SERVER_URL,
|
|
211
|
+
...NOLO_CLUSTER_SERVERS
|
|
212
|
+
]);
|
|
213
|
+
}
|
|
214
|
+
function resolveDeleteServerCandidatesFromEnv(env, ...preferredValues) {
|
|
215
|
+
return buildServerCandidates([
|
|
216
|
+
...preferredValues,
|
|
217
|
+
env.NOLO_SERVER,
|
|
218
|
+
env.BASE_URL,
|
|
219
|
+
env.NOLO_SERVER_URL,
|
|
220
|
+
env.READ_DIALOG_BASE,
|
|
221
|
+
DEFAULT_NOLO_SERVER_URL,
|
|
222
|
+
...NOLO_CLUSTER_SERVERS,
|
|
223
|
+
DEFAULT_LOCAL_API_ORIGIN
|
|
224
|
+
]);
|
|
225
|
+
}
|
|
226
|
+
function resolveDeleteServerCandidates(input, envOrPreferred, preferred) {
|
|
227
|
+
if (isCliArgs(input)) {
|
|
228
|
+
const env2 = envOrPreferred ?? {};
|
|
229
|
+
const explicitServer = resolveServerUrl(input, env2);
|
|
230
|
+
return resolveDeleteServerCandidatesFromEnv(env2, explicitServer, preferred?.trim());
|
|
231
|
+
}
|
|
232
|
+
const env = input;
|
|
233
|
+
return resolveDeleteServerCandidatesFromEnv(
|
|
234
|
+
env,
|
|
235
|
+
asOptionalTrimmedString(envOrPreferred)
|
|
236
|
+
);
|
|
237
|
+
}
|
|
238
|
+
function resolveAuthTokenFromEnv(env, extraEnvKeys = []) {
|
|
239
|
+
for (const key of ["AUTH_TOKEN", "AUTH", "NOLO_MACHINE_API_KEY", ...extraEnvKeys]) {
|
|
240
|
+
const value = env[key];
|
|
241
|
+
if (typeof value === "string" && value.trim()) return value;
|
|
242
|
+
}
|
|
243
|
+
return "";
|
|
244
|
+
}
|
|
245
|
+
function resolveAuthToken(input, envOrExtraEnvKeys, extraEnvKeys = []) {
|
|
246
|
+
if (isCliArgs(input)) {
|
|
247
|
+
const env = envOrExtraEnvKeys ?? {};
|
|
248
|
+
return readOption(input, "--token") || readOption(input, "--machine-key") || resolveAuthTokenFromEnv(env, extraEnvKeys);
|
|
249
|
+
}
|
|
250
|
+
return resolveAuthTokenFromEnv(input, envOrExtraEnvKeys ?? []);
|
|
251
|
+
}
|
|
252
|
+
function parseUserIdFromAuthToken(token) {
|
|
253
|
+
const parts = token.trim().split(".").filter(Boolean);
|
|
254
|
+
const payloadCandidates = parts.length >= 3 ? [parts[1], parts[0]] : [parts[0]];
|
|
255
|
+
for (const payload of payloadCandidates) {
|
|
256
|
+
if (!payload) continue;
|
|
257
|
+
try {
|
|
258
|
+
const parsed = JSON.parse(Buffer.from(payload, "base64").toString("utf8"));
|
|
259
|
+
if (typeof parsed?.userId === "string") return parsed.userId;
|
|
260
|
+
} catch {
|
|
261
|
+
}
|
|
262
|
+
}
|
|
263
|
+
return "";
|
|
264
|
+
}
|
|
265
|
+
function readOption(args, flag) {
|
|
266
|
+
const index = args.indexOf(flag);
|
|
267
|
+
return index >= 0 ? args[index + 1] : void 0;
|
|
268
|
+
}
|
|
269
|
+
function isCompiledBinary() {
|
|
270
|
+
try {
|
|
271
|
+
const url = import.meta.url;
|
|
272
|
+
return url.startsWith("file:///$bunfs/root/") || url.startsWith("/$bunfs/root/");
|
|
273
|
+
} catch {
|
|
274
|
+
return false;
|
|
275
|
+
}
|
|
276
|
+
}
|
|
277
|
+
function resolveCliEntrypointPath(fromModuleUrl = import.meta.url) {
|
|
278
|
+
if (isCompiledBinary()) {
|
|
279
|
+
return getHostRuntimeExecutable();
|
|
280
|
+
}
|
|
281
|
+
const modulePath = fileURLToPath2(fromModuleUrl);
|
|
282
|
+
const sourcePath = existsSync2(modulePath) ? realpathSync2(modulePath) : modulePath;
|
|
283
|
+
const ext = extname2(sourcePath) || ".ts";
|
|
284
|
+
return join2(dirname2(sourcePath), `index${ext}`);
|
|
285
|
+
}
|
|
286
|
+
|
|
287
|
+
export {
|
|
288
|
+
AGENT_RUN_PROTOCOL,
|
|
289
|
+
RuntimeProtocolMismatchError,
|
|
290
|
+
validateAgentRunProtocol,
|
|
291
|
+
RuntimeVersionMismatchError,
|
|
292
|
+
getHostRuntimeExecutable,
|
|
293
|
+
HOST_RUNTIME_CONTENT_IDENTITY,
|
|
294
|
+
initializeHostRuntimeIdentity,
|
|
295
|
+
isAgentRuntimeHostCommand,
|
|
296
|
+
resolveExactRuntimeEntrypoint,
|
|
297
|
+
resolveServerUrlFromEnv,
|
|
298
|
+
resolveServerUrl,
|
|
299
|
+
resolveServerCandidates,
|
|
300
|
+
resolveDeleteServerCandidates,
|
|
301
|
+
resolveAuthTokenFromEnv,
|
|
302
|
+
resolveAuthToken,
|
|
303
|
+
parseUserIdFromAuthToken,
|
|
304
|
+
readOption,
|
|
305
|
+
isCompiledBinary,
|
|
306
|
+
resolveCliEntrypointPath
|
|
307
|
+
};
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import {
|
|
2
|
+
isPidGone
|
|
3
|
+
} from "./chunk-OWKNSIXL.js";
|
|
4
|
+
|
|
5
|
+
// packages/cli/tui/tuiRestart.ts
|
|
6
|
+
import { realpathSync } from "node:fs";
|
|
7
|
+
import { isAbsolute, resolve } from "node:path";
|
|
8
|
+
function getRestartBlocker(state, checks) {
|
|
9
|
+
if (!checks.supported) return "\u5F53\u524D\u5BBF\u4E3B\u4E0D\u652F\u6301\u539F\u5730\u91CD\u542F\u3002";
|
|
10
|
+
if (checks.activeProcesses || checks.activeRuns) return "\u540E\u53F0\u4EFB\u52A1\u4ECD\u5728\u8FD0\u884C\u6216\u72B6\u6001\u672A\u786E\u8BA4\uFF0C\u4E0D\u80FD\u91CD\u542F\uFF1B\u8BF7\u7B49\u5F85\u4EFB\u52A1\u7ED3\u675F\u3002";
|
|
11
|
+
if (state.attachedImages.length || state.attachedDocs.length || state.attachedSkills.length || state.pendingCwdNotice || state.pendingTranscripts?.length || state.pendingChildRunNotices?.length || state.pendingProcessNotices?.length) {
|
|
12
|
+
return "\u6709\u672A\u53D1\u9001\u9644\u4EF6\u6216\u5F85\u5904\u7406\u901A\u77E5\uFF0C\u4E0D\u80FD\u91CD\u542F\uFF1B\u8BF7\u5148\u5904\u7406\u3002";
|
|
13
|
+
}
|
|
14
|
+
return void 0;
|
|
15
|
+
}
|
|
16
|
+
function buildRestartEnv(env, state) {
|
|
17
|
+
return {
|
|
18
|
+
...env,
|
|
19
|
+
// Override the startup snapshot, including an empty value after revocation.
|
|
20
|
+
// Omitting the key would let the next process inherit stale grants.
|
|
21
|
+
NOLO_PERMISSION_GRANTS: ["local", "remote"].filter((bucket) => state.permissionGrants?.[bucket] === true).join(","),
|
|
22
|
+
NOLO_CWD: state.cwd,
|
|
23
|
+
NOLO_AGENT: state.agentKey,
|
|
24
|
+
NOLO_AGENT_NAME: state.agentName,
|
|
25
|
+
NOLO_SERVER: state.serverUrl,
|
|
26
|
+
NOLO_RUNTIME_MODE: state.runtimeMode,
|
|
27
|
+
NOLO_DIALOG_ID: state.dialogId ?? "",
|
|
28
|
+
NOLO_DIALOG_KEY: state.dialogKey ?? "",
|
|
29
|
+
NOLO_DIALOG: state.dialogLabel,
|
|
30
|
+
NOLO_TUI_RESTART: "1"
|
|
31
|
+
};
|
|
32
|
+
}
|
|
33
|
+
function hasRestartBlockingRuns(records, pidGone = isPidGone) {
|
|
34
|
+
return records.some((run) => run.status === "running" && (typeof run.pid !== "number" || run.pid <= 0 || !pidGone(run.pid)));
|
|
35
|
+
}
|
|
36
|
+
function buildRestartArgv(args) {
|
|
37
|
+
return args.compiled ? [args.executable, "tui"] : [args.executable, ...args.execArgv, args.entrypoint, "tui"];
|
|
38
|
+
}
|
|
39
|
+
function replaceTuiProcess(executable, argv, env, execve = process.execve) {
|
|
40
|
+
try {
|
|
41
|
+
execve(executable, argv, env);
|
|
42
|
+
} catch (error) {
|
|
43
|
+
throw new Error(`\u539F\u5730\u91CD\u542F\u5931\u8D25\uFF1B\u672A\u542F\u52A8\u65B0\u8FDB\u7A0B\u3002\u5BF9\u8BDD ${env.NOLO_DIALOG_ID || "(new)"}\uFF1Bcwd ${env.NOLO_CWD}\uFF1B${String(error)}`, { cause: error });
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
function captureRestartExecutable(executable, invocation, lookup = (name) => Bun.which(name), realpath = realpathSync) {
|
|
47
|
+
const candidate = isAbsolute(invocation) ? invocation : invocation.includes("/") ? resolve(invocation) : lookup(invocation);
|
|
48
|
+
try {
|
|
49
|
+
if (candidate && realpath(candidate) === realpath(executable)) return candidate;
|
|
50
|
+
} catch {
|
|
51
|
+
}
|
|
52
|
+
return executable;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
export {
|
|
56
|
+
getRestartBlocker,
|
|
57
|
+
buildRestartEnv,
|
|
58
|
+
hasRestartBlockingRuns,
|
|
59
|
+
buildRestartArgv,
|
|
60
|
+
replaceTuiProcess,
|
|
61
|
+
captureRestartExecutable
|
|
62
|
+
};
|