nolo-cli 0.180.0-alpha.2 → 0.182.0-alpha.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (86) hide show
  1. package/{_executeModel-ACI2KGWO.js → _executeModel-ZMEMTJMS.js} +24 -24
  2. package/{agentDeleteCommand-LVSLONDD.js → agentDeleteCommand-VXMMVCHV.js} +32 -31
  3. package/{agentEmailCommands-BKH3Q6I6.js → agentEmailCommands-G3UR3SVL.js} +31 -30
  4. package/{agentListCommands-JPKRBHMP.js → agentListCommands-V2F7XVZN.js} +15 -14
  5. package/{agentMachineCommands-HRORJN73.js → agentMachineCommands-FALEGGEG.js} +9 -9
  6. package/{agentRecordCommands-OSZF2EHL.js → agentRecordCommands-HN7WNNGT.js} +30 -29
  7. package/{agentRunCommand-FCGNSB4D.js → agentRunCommand-N3RD7WQ2.js} +31 -30
  8. package/{agentRuntimeLocal-SWG5ULIJ.js → agentRuntimeLocal-B2CGM4VH.js} +6 -6
  9. package/{agentSlice-FCDRLXVA.js → agentSlice-NG7VBT4O.js} +1 -1
  10. package/{appDeleteCommands-YH3BYQYK.js → appDeleteCommands-2GVSRT6R.js} +14 -13
  11. package/{appDeployCommands-F44TNQJG.js → appDeployCommands-UJVGSH4V.js} +14 -13
  12. package/{appDeployStatusCommands-BFTGFVQY.js → appDeployStatusCommands-4UJDG7P3.js} +14 -13
  13. package/{appGetCommands-SFLFIXPW.js → appGetCommands-D5HZK3DJ.js} +14 -13
  14. package/{appListCommands-RUO5SEAJ.js → appListCommands-FAHI4R2I.js} +14 -13
  15. package/{authCommand-UIF5UTYV.js → authCommand-AX23Q2Q5.js} +6 -5
  16. package/{authCommands-BKDT4ZYB.js → authCommands-PIUTADO5.js} +2 -2
  17. package/{builtinSkillRegistry-MRI4FNCR.js → builtinSkillRegistry-HJCSXMKS.js} +4 -4
  18. package/{chromeOpsCommands-IWKUA4C3.js → chromeOpsCommands-2KFQEE3H.js} +24 -46
  19. package/{chunk-ZEQ6L6MZ.js → chunk-3FTJG5NU.js} +1 -1
  20. package/{chunk-CGKN34IJ.js → chunk-3YMDHQAK.js} +39 -39
  21. package/{chunk-6MXCQLLB.js → chunk-53HMDUG6.js} +14 -583
  22. package/{chunk-QOKJFYJK.js → chunk-7HZ23BLI.js} +11 -11
  23. package/{chunk-KUGOIFXV.js → chunk-AWFDDOVW.js} +3 -3
  24. package/{chunk-SGATEZV5.js → chunk-BNEHIKIR.js} +24 -24
  25. package/{chunk-PT6335JZ.js → chunk-E54QZNU3.js} +2 -2
  26. package/{chunk-QUCQVMYZ.js → chunk-EHPJFHFL.js} +7 -7
  27. package/{chunk-TCCBECTT.js → chunk-EUOPEEMO.js} +5 -5
  28. package/{chunk-EAWOT7M6.js → chunk-F2P6YUHC.js} +1 -1
  29. package/{chunk-COXNBVP7.js → chunk-G5IZWDSM.js} +8 -8
  30. package/chunk-G5LNJZJH.js +584 -0
  31. package/{chunk-HTSXDJHA.js → chunk-GQEQYXWV.js} +12 -12
  32. package/{chunk-OXYSTN6B.js → chunk-GTQKUQGF.js} +1 -1
  33. package/{chunk-WQAOAJ5Q.js → chunk-HRTEMYBI.js} +2 -2
  34. package/{chunk-H63VHVFY.js → chunk-J2EVUNED.js} +4 -4
  35. package/{chunk-GCAOOTIS.js → chunk-JGH3VOCR.js} +3 -3
  36. package/{chunk-MMKP2XWK.js → chunk-JX5XVFVW.js} +1 -1
  37. package/{chunk-NJI5HZQA.js → chunk-KBVF7LOK.js} +3 -3
  38. package/chunk-LKZPX6YH.js +0 -0
  39. package/{chunk-4FZUUCXQ.js → chunk-MMSZKZWA.js} +1 -1
  40. package/{chunk-CTEEJJVR.js → chunk-MPIAKYZ7.js} +1 -1
  41. package/{chunk-XJBWPOIL.js → chunk-NHBJHDVW.js} +1 -1
  42. package/{chunk-SK2UMOZC.js → chunk-NRYTWXXV.js} +1 -1
  43. package/{chunk-6PHS6ADB.js → chunk-ONFC3RLP.js} +2 -2
  44. package/{chunk-2D3YKEAQ.js → chunk-P7JNYLDW.js} +1 -1
  45. package/{chunk-TDX2L4W2.js → chunk-PS3GU7YU.js} +1857 -1138
  46. package/{chunk-HS7JBDUJ.js → chunk-QHFRRM5U.js} +3 -3
  47. package/{chunk-DTA4JVXW.js → chunk-RHFEDL32.js} +3 -3
  48. package/{chunk-PD4KNHVU.js → chunk-SO3N2323.js} +3 -3
  49. package/{chunk-OBKPOFOB.js → chunk-T5RLIVBZ.js} +10 -10
  50. package/{chunk-POYXVOYU.js → chunk-TQU64H2A.js} +2 -2
  51. package/{chunk-5LZBJZLT.js → chunk-TXJZ7QXG.js} +2 -2
  52. package/{chunk-DVSXZC7F.js → chunk-UU3QSEA5.js} +19 -19
  53. package/{chunk-4KDYRX3O.js → chunk-XYRSQHF2.js} +2 -2
  54. package/{chunk-YAN7XTXO.js → chunk-Y2CQS353.js} +5 -5
  55. package/{chunk-GHKEUJ6I.js → chunk-ZVVAK3DH.js} +2 -2
  56. package/{commandRegistry-UQ4GKJ5B.js → commandRegistry-LFXI3KRG.js} +80 -65
  57. package/{contentThunks-GZUPF67H.js → contentThunks-AH7QDS6H.js} +6 -6
  58. package/{cooldownCommands-NS63RGBO.js → cooldownCommands-QFV3ERZX.js} +14 -28
  59. package/{createAgentAutomationAction-ZOFCBZRE.js → createAgentAutomationAction-FAOPVXNF.js} +6 -6
  60. package/{createDialogAction-G7QCYQT7.js → createDialogAction-DBTKPCXV.js} +9 -9
  61. package/{createPageAction-Z6JQZYS5.js → createPageAction-PZGKZFPS.js} +8 -8
  62. package/{dialogCommands-MITLWDBY.js → dialogCommands-GQPHQ2U6.js} +10 -10
  63. package/{dialogSlice-PKFXK5WM.js → dialogSlice-VHGZCHAQ.js} +4 -4
  64. package/{docCreateCommands-G3S3LZMZ.js → docCreateCommands-CQHPL5IB.js} +18 -45
  65. package/{docDeleteCommands-MLRCMLVB.js → docDeleteCommands-Z5UPI5PX.js} +25 -45
  66. package/{docReadCommands-6A6SBCOP.js → docReadCommands-2AEKFEFV.js} +19 -35
  67. package/{docStore-NAEY4CEK.js → docStore-XGWH3T7Q.js} +1 -1
  68. package/{docUpdateCommands-UZQC2NDO.js → docUpdateCommands-FZD4GSGV.js} +26 -80
  69. package/{handleSendMessageAction-HUQLERJP.js → handleSendMessageAction-XTQQEVD4.js} +14 -14
  70. package/index.js +17 -7
  71. package/{localRuntimeAdapter-4DJDFM7A.js → localRuntimeAdapter-LXMUSNJ5.js} +28 -27
  72. package/{machineCommands-R2IP5OVT.js → machineCommands-AXD7ISGC.js} +33 -29
  73. package/{machineWsRunDispatch-CIJDSHTA.js → machineWsRunDispatch-PGB3VJGM.js} +29 -28
  74. package/package.json +1 -1
  75. package/{readlineWorkspace-YCNAWRDL.js → readlineWorkspace-IO45OJPW.js} +43 -41
  76. package/{runAgentClientLoop-K7WRMT27.js → runAgentClientLoop-2APY5UZL.js} +22 -22
  77. package/{secretCommands-7S6REMJV.js → secretCommands-XEQLKDB4.js} +33 -47
  78. package/{spaceCommands-L537SH5I.js → spaceCommands-LM74S5WK.js} +9 -9
  79. package/{streamAgentChatTurn-HKUZ7OCA.js → streamAgentChatTurn-Z3KS7XZL.js} +26 -26
  80. package/{tools-NS37KPGT.js → tools-VWAK7F7J.js} +18 -18
  81. package/{updateCommands-BXGFH4VX.js → updateCommands-KDYX32JR.js} +3 -1
  82. package/{updateDialogTitleAction-UUZ5HDM2.js → updateDialogTitleAction-WBIPSXFL.js} +6 -6
  83. package/windowsSelfUpdate-IYQK4IDS.js +14 -0
  84. package/{agentPullCommand-UXXV5KKW.js → agentPullCommand-7LHBOEYH.js} +1 -1
  85. package/{chunk-RV4DPEAM.js → chunk-XLQ646HU.js} +3 -3
  86. package/{workloadLifecycle-MZ2V5L43.js → workloadLifecycle-2F5YKFGW.js} +7 -7
@@ -0,0 +1,584 @@
1
+ import {
2
+ isCompiledBinary
3
+ } from "./chunk-WACI5I6V.js";
4
+ import {
5
+ DEFAULT_NOLO_SERVER_URL
6
+ } from "./chunk-OLZBQWZU.js";
7
+ import {
8
+ loadProfileConfig
9
+ } from "./chunk-R5GO3YZP.js";
10
+ import {
11
+ resolveDefaultSpawn
12
+ } from "./chunk-Y6ROFCZO.js";
13
+ import {
14
+ scheduleWindowsSelfUpdate
15
+ } from "./chunk-53HMDUG6.js";
16
+ import {
17
+ t
18
+ } from "./chunk-PS3GU7YU.js";
19
+ import {
20
+ normalizeServerOrigin
21
+ } from "./chunk-CF7PE763.js";
22
+
23
+ // packages/cli/updateCommands.ts
24
+ import { existsSync, readFileSync, accessSync, constants } from "node:fs";
25
+ import { homedir } from "node:os";
26
+ import { dirname, join } from "node:path";
27
+ import { fileURLToPath } from "node:url";
28
+ function resolvePackageJsonPath() {
29
+ if (isCompiledBinary()) {
30
+ const execDir = dirname(process.execPath);
31
+ const candidate2 = join(execDir, "package.json");
32
+ if (existsSync(candidate2)) return candidate2;
33
+ return null;
34
+ }
35
+ const CLI_DIR = dirname(fileURLToPath(import.meta.url));
36
+ const candidate = join(CLI_DIR, "package.json");
37
+ return existsSync(candidate) ? candidate : null;
38
+ }
39
+ var PACKAGE_JSON_PATH = resolvePackageJsonPath();
40
+ function getCliInstallChannel(serverUrl) {
41
+ const normalized = normalizeServerOrigin(serverUrl);
42
+ if (!normalized) {
43
+ return "latest";
44
+ }
45
+ try {
46
+ const hostname = new URL(normalized).hostname.toLowerCase();
47
+ if (hostname === "us.nolo.chat" || hostname.endsWith(".us.nolo.chat")) {
48
+ return "alpha";
49
+ }
50
+ } catch {
51
+ if (/us\.nolo\.chat/i.test(normalized)) {
52
+ return "alpha";
53
+ }
54
+ }
55
+ return "latest";
56
+ }
57
+ function renderProgressBar(percent, width = 30) {
58
+ const pct = Math.max(0, Math.min(100, percent));
59
+ const filledLen = Math.round(width * pct / 100);
60
+ const emptyLen = width - filledLen;
61
+ const bar = "#".repeat(filledLen) + " ".repeat(emptyLen);
62
+ const pctText = pct.toFixed(1).padStart(5, " ");
63
+ return `[${bar}] ${pctText}%`;
64
+ }
65
+ function buildNpmSelfUpdateCommand(channel = "latest") {
66
+ return ["npm", "install", "-g", `nolo-cli@${channel}`, "--force", "--progress"];
67
+ }
68
+ function resolveStandaloneBundlePlatform(platform = process.platform, arch = process.arch) {
69
+ if (platform === "linux" && arch === "x64") {
70
+ return { tarballName: "nolo-linux-x64.tar.gz", extractSubdir: "nolo-linux-x64" };
71
+ }
72
+ if (platform === "darwin" && arch === "arm64") {
73
+ return { tarballName: "nolo-darwin-arm64.tar.gz", extractSubdir: "nolo-darwin-arm64" };
74
+ }
75
+ return null;
76
+ }
77
+ function resolveStandaloneBundleRepoBase(channel) {
78
+ return channel === "alpha" ? "https://us.nolo.chat" : "https://nolo.chat";
79
+ }
80
+ function buildStandaloneManualUpdateHint(channel) {
81
+ const repoBase = resolveStandaloneBundleRepoBase(channel);
82
+ return `curl -fsSL ${repoBase}/install-nolo.sh | sh`;
83
+ }
84
+ function resolveStandaloneInstallDir() {
85
+ const candidates = [
86
+ "/usr/local/bin",
87
+ join(homedir(), ".local/bin"),
88
+ join(homedir(), ".nolo/bin")
89
+ ];
90
+ for (const dir of candidates) {
91
+ if (!existsSync(dir)) continue;
92
+ try {
93
+ accessSync(dir, constants.W_OK);
94
+ return dir;
95
+ } catch {
96
+ continue;
97
+ }
98
+ }
99
+ return join(homedir(), ".nolo/bin");
100
+ }
101
+ function readPackageInfo() {
102
+ if (PACKAGE_JSON_PATH) {
103
+ try {
104
+ const raw = readFileSync(PACKAGE_JSON_PATH, "utf8");
105
+ const parsed = JSON.parse(raw);
106
+ return {
107
+ name: parsed.name || "nolo-cli",
108
+ version: parsed.version || "0.0.0"
109
+ };
110
+ } catch {
111
+ }
112
+ }
113
+ return {
114
+ name: process.env.NOLO_CLI_PACKAGE_NAME || "nolo-cli",
115
+ version: process.env.NOLO_CLI_VERSION || "0.0.0"
116
+ };
117
+ }
118
+ function buildCliVersionText(info) {
119
+ return `${info.name} ${info.version}`;
120
+ }
121
+ function buildSelfUpdateCommand(serverUrl) {
122
+ return buildNpmSelfUpdateCommand(getCliInstallChannel(serverUrl));
123
+ }
124
+ function resolveSelfUpdateServerUrl(env = process.env, override) {
125
+ if (override?.trim()) {
126
+ return normalizeServerOrigin(override);
127
+ }
128
+ const fromEnv = env.NOLO_SERVER || env.BASE_URL;
129
+ if (typeof fromEnv === "string" && fromEnv.trim()) {
130
+ return normalizeServerOrigin(fromEnv);
131
+ }
132
+ const profile = loadProfileConfig();
133
+ const profileUrl = profile?.profiles?.[profile.currentProfile]?.serverUrl;
134
+ if (profileUrl?.trim()) {
135
+ return normalizeServerOrigin(profileUrl);
136
+ }
137
+ return DEFAULT_NOLO_SERVER_URL;
138
+ }
139
+ function buildCliDoctorText(info) {
140
+ return [
141
+ t("updateDoctorTitle"),
142
+ "---------------",
143
+ t("updateDoctorVersion", info.packageName, info.version),
144
+ t("updateDoctorInstall", info.installKind),
145
+ t("updateDoctorChannel", info.updateChannel),
146
+ t("updateDoctorEntry", info.entrypoint),
147
+ t("updateDoctorServer", info.serverUrl),
148
+ t("updateDoctorProfile", info.profileName),
149
+ t("updateDoctorCommand"),
150
+ "",
151
+ t("updateDoctorDiff"),
152
+ t("updateDoctorOlder"),
153
+ "",
154
+ t("updateDoctorManual", info.installKind === "standalone-bundle" ? buildStandaloneManualUpdateHint(info.updateChannel) : buildNpmSelfUpdateCommand(info.updateChannel).join(" "))
155
+ ].join("\n");
156
+ }
157
+ function isRunSelfUpdateOptions(value) {
158
+ return typeof value === "object" && value !== null && ("output" in value || "spawn" in value || "entrypointPath" in value || "serverUrl" in value || "env" in value || "platform" in value || "scheduleWindowsUpdate" in value);
159
+ }
160
+ async function forwardSpawnOutput(stream, output) {
161
+ if (!stream) {
162
+ return;
163
+ }
164
+ for await (const chunk of stream) {
165
+ output.write(normalizeSpawnChunk(chunk));
166
+ }
167
+ }
168
+ function normalizeSpawnChunk(chunk) {
169
+ if (typeof chunk === "string" || chunk instanceof Uint8Array) {
170
+ return chunk;
171
+ }
172
+ if (chunk instanceof ArrayBuffer) {
173
+ return new Uint8Array(chunk);
174
+ }
175
+ return new Uint8Array(chunk.buffer, chunk.byteOffset, chunk.byteLength);
176
+ }
177
+ async function runShellScript(script, {
178
+ output,
179
+ spawn,
180
+ env,
181
+ cwd,
182
+ useCustomSink
183
+ }) {
184
+ const proc = spawn({
185
+ cmd: ["sh", "-c", script],
186
+ cwd,
187
+ // Capture mode (TUI sink): ignore stdin — the TUI's own decoder is
188
+ // reading the tty, and a child that reads stdin would race it for keys.
189
+ // The inherit branch is unreachable inside the TUI (useCustomSink is
190
+ // always true there) and stays the correct choice for `nolo update`.
191
+ stdin: useCustomSink ? "ignore" : "inherit",
192
+ stdout: useCustomSink ? "pipe" : "inherit",
193
+ stderr: useCustomSink ? "pipe" : "inherit",
194
+ env
195
+ });
196
+ if (!useCustomSink) {
197
+ return proc.exited;
198
+ }
199
+ const [exitCode] = await Promise.all([
200
+ proc.exited,
201
+ forwardSpawnOutput(proc.stdout, output),
202
+ forwardSpawnOutput(proc.stderr, output)
203
+ ]);
204
+ return exitCode;
205
+ }
206
+ function shellQuote(value) {
207
+ return "'" + value.replace(/'/g, "'\\''") + "'";
208
+ }
209
+ function buildStandaloneUpdateScript(args) {
210
+ const curl = "curl -fL --progress-bar --connect-timeout 20 --max-time 600 --speed-limit 1 --speed-time 60";
211
+ return `set -eu
212
+ EXTRACT_DIR=${shellQuote(args.extractDir)}
213
+ ENTRY=${shellQuote(args.symlinkPath)}
214
+ CURRENT_VERSION=${shellQuote(args.currentVersion)}
215
+ STAGING="$EXTRACT_DIR.new.$$"
216
+ BACKUP="$EXTRACT_DIR.old.$$"
217
+ LINK="$ENTRY.new.$$"
218
+ old_moved=0
219
+ new_moved=0
220
+ committed=0
221
+ cleanup() {
222
+ status=$?
223
+ trap - 0 HUP INT TERM
224
+ if [ "$committed" = 0 ]; then
225
+ if [ "$new_moved" = 1 ] && [ -d "$EXTRACT_DIR" ]; then
226
+ mv "$EXTRACT_DIR" "$STAGING" || exit 1
227
+ fi
228
+ if [ "$old_moved" = 1 ] && [ -d "$BACKUP" ]; then
229
+ mv "$BACKUP" "$EXTRACT_DIR" || exit 1
230
+ fi
231
+ fi
232
+ rm -rf "$STAGING" || true
233
+ rm -f "$LINK" || true
234
+ exit "$status"
235
+ }
236
+ # Refuse collisions before installing cleanup: never remove somebody else's path.
237
+ if [ -e "$STAGING" ] || [ -L "$STAGING" ] ||
238
+ [ -e "$BACKUP" ] || [ -L "$BACKUP" ] ||
239
+ [ -e "$LINK" ] || [ -L "$LINK" ]; then
240
+ echo "Error: update staging path already exists" >&2
241
+ exit 1
242
+ fi
243
+ mkdir -p "\${EXTRACT_DIR%/*}"
244
+ mkdir "$STAGING"
245
+ trap cleanup 0
246
+ trap 'exit 1' HUP INT TERM
247
+
248
+ echo ${shellQuote(`Downloading nolo from ${args.tarballUrl}...`)}
249
+ if ! ${curl} ${shellQuote(args.tarballUrl)} -o "$STAGING/bundle.tar.gz"; then
250
+ ${args.tarballUrl !== args.fallbackUrl ? `echo ${shellQuote(`Primary source unavailable, trying ${args.fallbackUrl}...`)}
251
+ if ! ${curl} ${shellQuote(args.fallbackUrl)} -o "$STAGING/bundle.tar.gz"; then
252
+ echo "Error: download failed" >&2
253
+ exit 1
254
+ fi` : `echo "Error: download failed" >&2
255
+ exit 1`}
256
+ fi
257
+ tar -xzf "$STAGING/bundle.tar.gz" -C "$STAGING"
258
+ rm -f "$STAGING/bundle.tar.gz"
259
+ chmod +x "$STAGING/nolo"
260
+ # A failing, empty or malformed version response must not touch the live install.
261
+ VERSION_TEXT=$("$STAGING/nolo" -v)
262
+ case "$VERSION_TEXT" in
263
+ "nolo-cli "*) VERSION=\${VERSION_TEXT#nolo-cli } ;;
264
+ *) VERSION=$VERSION_TEXT ;;
265
+ esac
266
+ CORE=\${VERSION%%[-+]*}
267
+ MAJOR=\${CORE%%.*}
268
+ REST=\${CORE#*.}
269
+ MINOR=\${REST%%.*}
270
+ PATCH=\${REST#*.}
271
+ case "$MAJOR:$MINOR:$PATCH" in
272
+ *[!0-9:]*|:*|*::*|*:) echo "Error: invalid bundle version" >&2; exit 1 ;;
273
+ esac
274
+ if [ "$CORE" != "$MAJOR.$MINOR.$PATCH" ]; then
275
+ echo "Error: invalid bundle version" >&2
276
+ exit 1
277
+ fi
278
+ case "$VERSION" in
279
+ *[!0-9A-Za-z.+-]*) echo "Error: invalid bundle version" >&2; exit 1 ;;
280
+ esac
281
+ case "$CURRENT_VERSION" in
282
+ "nolo-cli "*) CUR_VER=\${CURRENT_VERSION#nolo-cli } ;;
283
+ *) CUR_VER=$CURRENT_VERSION ;;
284
+ esac
285
+ CUR_CORE=\${CUR_VER%%[-+]*}
286
+ CUR_MAJOR=\${CUR_CORE%%.*}
287
+ CUR_REST=\${CUR_CORE#*.}
288
+ CUR_MINOR=\${CUR_REST%%.*}
289
+ CUR_PATCH=\${CUR_REST#*.}
290
+ if [ -n "$CUR_MAJOR" ] && [ -n "$CUR_MINOR" ] && [ -n "$CUR_PATCH" ]; then
291
+ case "$CUR_MAJOR:$CUR_MINOR:$CUR_PATCH" in
292
+ *[!0-9:]*|:*|*::*|*:) ;;
293
+ *)
294
+ if [ "$CUR_CORE" = "$CUR_MAJOR.$CUR_MINOR.$CUR_PATCH" ]; then
295
+ is_downgrade=0
296
+ if [ "$MAJOR" -lt "$CUR_MAJOR" ]; then
297
+ is_downgrade=1
298
+ elif [ "$MAJOR" -eq "$CUR_MAJOR" ]; then
299
+ if [ "$MINOR" -lt "$CUR_MINOR" ]; then
300
+ is_downgrade=1
301
+ elif [ "$MINOR" -eq "$CUR_MINOR" ]; then
302
+ if [ "$PATCH" -lt "$CUR_PATCH" ]; then
303
+ is_downgrade=1
304
+ fi
305
+ fi
306
+ fi
307
+ if [ "$is_downgrade" = 1 ]; then
308
+ echo "Error: refusing downgrade from $CURRENT_VERSION to $VERSION" >&2
309
+ exit 11
310
+ fi
311
+ fi
312
+ ;;
313
+ esac
314
+ fi
315
+ if [ "$VERSION" = "$CURRENT_VERSION" ]; then
316
+ echo "\u2713 Already up to date (nolo-cli $VERSION)."
317
+ exit 10
318
+ fi
319
+ mkdir -p "\${ENTRY%/*}"
320
+ # mv without -T is portable only when the destination is not a directory.
321
+ if [ -d "$ENTRY" ] || [ -L "$EXTRACT_DIR" ]; then
322
+ echo "Error: refusing directory entrypoint or symlink bundle directory" >&2
323
+ exit 1
324
+ fi
325
+ ln -s "$EXTRACT_DIR/nolo" "$LINK"
326
+ if [ -e "$EXTRACT_DIR" ]; then
327
+ old_moved=1
328
+ mv "$EXTRACT_DIR" "$BACKUP"
329
+ fi
330
+ new_moved=1
331
+ mv "$STAGING" "$EXTRACT_DIR"
332
+ mv -f "$LINK" "$ENTRY"
333
+ committed=1
334
+ # Retain only the newest recovery copy from this run; prune older backups.
335
+ for old_copy in "$EXTRACT_DIR.old."*; do
336
+ if [ -d "$old_copy" ] && [ ! -L "$old_copy" ] && [ "$old_copy" != "$BACKUP" ]; then
337
+ rm -rf "$old_copy" || true
338
+ fi
339
+ done
340
+ # Retain the previous bundle as a recovery copy; never unlink the live entry.
341
+ echo "nolo updated to $ENTRY"
342
+ `;
343
+ }
344
+ async function runStandaloneBundleUpdate(options) {
345
+ const output = options.output ?? process.stdout;
346
+ const spawn = options.spawn ?? resolveDefaultSpawn();
347
+ const env = options.env ?? process.env;
348
+ const serverUrl = resolveSelfUpdateServerUrl(env, options.serverUrl);
349
+ const channel = getCliInstallChannel(serverUrl);
350
+ const platform = resolveStandaloneBundlePlatform();
351
+ if (!platform) {
352
+ output.write(
353
+ t("updateUnsupported", process.platform, process.arch, buildStandaloneManualUpdateHint(channel))
354
+ );
355
+ return 1;
356
+ }
357
+ const { tarballName, extractSubdir } = platform;
358
+ const repoBase = resolveStandaloneBundleRepoBase(channel);
359
+ const tarballUrl = `${repoBase}/public/downloads/${tarballName}`;
360
+ const fallbackUrl = `https://nolo.chat/public/downloads/${tarballName}`;
361
+ const extractDir = join(homedir(), ".nolo", extractSubdir);
362
+ const installDir = resolveStandaloneInstallDir();
363
+ const symlinkPath = join(installDir, "nolo");
364
+ const script = buildStandaloneUpdateScript({
365
+ tarballUrl,
366
+ fallbackUrl,
367
+ extractDir,
368
+ symlinkPath,
369
+ currentVersion: readPackageInfo().version
370
+ });
371
+ output.write(`
372
+ ${t("updateInstallerTitle")}
373
+ `);
374
+ output.write(`-----------------------------------------
375
+ `);
376
+ output.write(`${t("updateBundleTarget", channel)}
377
+ `);
378
+ output.write(`${t("updateBundleDownloading")}
379
+ `);
380
+ const useCustomSink = options.output !== void 0;
381
+ const exitCode = await runShellScript(script, {
382
+ output,
383
+ spawn,
384
+ env,
385
+ useCustomSink
386
+ });
387
+ if (exitCode === 10) {
388
+ output.write(` ${renderProgressBar(100)}
389
+ `);
390
+ return 0;
391
+ }
392
+ if (exitCode === 0) {
393
+ output.write(` ${renderProgressBar(100)}
394
+ `);
395
+ output.write(`${t("updateCompleted")}
396
+
397
+ `);
398
+ }
399
+ return exitCode;
400
+ }
401
+ var NOLO_UPDATE_CHECK_KILL_SWITCH = "NOLO_CLI_NO_UPDATE_CHECK";
402
+ function parseCliVersion(raw) {
403
+ const match = /^(\d+)\.(\d+)\.(\d+)(?:-([0-9A-Za-z.-]+))?$/.exec(raw.trim());
404
+ if (!match) return null;
405
+ return {
406
+ main: [Number(match[1]), Number(match[2]), Number(match[3])],
407
+ pre: match[4] ? match[4].split(".") : []
408
+ };
409
+ }
410
+ function compareCliVersions(a, b) {
411
+ const pa = parseCliVersion(a);
412
+ const pb = parseCliVersion(b);
413
+ if (!pa || !pb) return a.localeCompare(b);
414
+ for (let i = 0; i < 3; i++) {
415
+ if (pa.main[i] !== pb.main[i]) return pa.main[i] < pb.main[i] ? -1 : 1;
416
+ }
417
+ if (pa.pre.length === 0 && pb.pre.length === 0) return 0;
418
+ if (pa.pre.length === 0) return 1;
419
+ if (pb.pre.length === 0) return -1;
420
+ const len = Math.max(pa.pre.length, pb.pre.length);
421
+ for (let i = 0; i < len; i++) {
422
+ const x = pa.pre[i];
423
+ const y = pb.pre[i];
424
+ if (x === void 0) return -1;
425
+ if (y === void 0) return 1;
426
+ if (x === y) continue;
427
+ const xn = /^\d+$/.test(x) ? Number(x) : NaN;
428
+ const yn = /^\d+$/.test(y) ? Number(y) : NaN;
429
+ if (!Number.isNaN(xn) && !Number.isNaN(yn)) return xn < yn ? -1 : 1;
430
+ if (!Number.isNaN(xn)) return -1;
431
+ if (!Number.isNaN(yn)) return 1;
432
+ return x < y ? -1 : 1;
433
+ }
434
+ return 0;
435
+ }
436
+ async function checkForCliUpdate(currentVersion, serverUrl, options = {}) {
437
+ const env = options.env ?? process.env;
438
+ if ((env[NOLO_UPDATE_CHECK_KILL_SWITCH] ?? process.env[NOLO_UPDATE_CHECK_KILL_SWITCH]) === "1") {
439
+ return null;
440
+ }
441
+ if (!currentVersion || !parseCliVersion(currentVersion)) return null;
442
+ const channel = getCliInstallChannel(serverUrl);
443
+ const fetchImpl = options.fetchImpl ?? fetch;
444
+ const timeoutMs = options.timeoutMs ?? 2e3;
445
+ try {
446
+ const res = await fetchImpl(
447
+ `https://registry.npmjs.org/nolo-cli/${channel}`,
448
+ {
449
+ signal: AbortSignal.timeout(timeoutMs),
450
+ headers: { accept: "application/json" }
451
+ }
452
+ );
453
+ if (!res.ok) return null;
454
+ const data = await res.json();
455
+ const latestVersion = data.version;
456
+ if (!latestVersion || !parseCliVersion(latestVersion) || compareCliVersions(latestVersion, currentVersion) <= 0) {
457
+ return null;
458
+ }
459
+ return { latestVersion, channel };
460
+ } catch {
461
+ return null;
462
+ }
463
+ }
464
+ async function runSelfUpdateDetailed(outputOrOptions) {
465
+ const options = outputOrOptions === void 0 ? {} : isRunSelfUpdateOptions(outputOrOptions) ? outputOrOptions : { output: outputOrOptions };
466
+ if (isCompiledBinary()) {
467
+ return {
468
+ exitCode: await runStandaloneBundleUpdate(options),
469
+ disposition: "completed"
470
+ };
471
+ }
472
+ const output = options.output ?? process.stdout;
473
+ const spawn = options.spawn ?? resolveDefaultSpawn();
474
+ const env = options.env ?? process.env;
475
+ const serverUrl = resolveSelfUpdateServerUrl(env, options.serverUrl);
476
+ const channel = getCliInstallChannel(serverUrl);
477
+ const command = buildNpmSelfUpdateCommand(channel);
478
+ if ((options.platform ?? process.platform) === "win32") {
479
+ const packageInfo = readPackageInfo();
480
+ const entrypointPath = options.entrypointPath ?? fileURLToPath(import.meta.url);
481
+ const schedule = options.scheduleWindowsUpdate ?? scheduleWindowsSelfUpdate;
482
+ try {
483
+ const scheduled = schedule({
484
+ channel,
485
+ currentVersion: packageInfo.version,
486
+ entrypointPath,
487
+ env
488
+ });
489
+ output.write(`
490
+ ${t("updateInstallerTitle")}
491
+ `);
492
+ output.write(`-----------------------------------------
493
+ `);
494
+ output.write(`${t("updateNpmTarget", channel)}
495
+ `);
496
+ output.write(`${t("updateScheduled", String(scheduled.helperPid))}
497
+ `);
498
+ output.write(`${t("updateKeepUsing")}
499
+ `);
500
+ output.write(`${t("updateBackground")}
501
+ `);
502
+ output.write(`${t("updateCheckLog", scheduled.logPath)}
503
+
504
+ `);
505
+ return { exitCode: 0, disposition: "scheduled" };
506
+ } catch (error) {
507
+ output.write(
508
+ `${t("updateScheduleFailed", error instanceof Error ? error.message : String(error))}
509
+ `
510
+ );
511
+ output.write(
512
+ `${t("updateManualClose", command.join(" "))}
513
+ `
514
+ );
515
+ return { exitCode: 1, disposition: "completed" };
516
+ }
517
+ }
518
+ output.write(`
519
+ ${t("updateInstallerTitle")}
520
+ `);
521
+ output.write(`-----------------------------------------
522
+ `);
523
+ output.write(`${t("updateNpmTarget", channel)}
524
+ `);
525
+ output.write(`${t("updateNpmDownloading")}
526
+ `);
527
+ const useCustomSink = options.output !== void 0;
528
+ const proc = spawn({
529
+ cmd: command,
530
+ // Capture mode (TUI sink): ignore stdin — see runShellScript.
531
+ stdin: useCustomSink ? "ignore" : "inherit",
532
+ stdout: useCustomSink ? "pipe" : "inherit",
533
+ stderr: useCustomSink ? "pipe" : "inherit",
534
+ env
535
+ });
536
+ if (!useCustomSink) {
537
+ const exitCode2 = await proc.exited;
538
+ if (exitCode2 === 0) {
539
+ output.write(` ${renderProgressBar(100)}
540
+ `);
541
+ output.write(`${t("updateCompleted")}
542
+
543
+ `);
544
+ }
545
+ return { exitCode: exitCode2, disposition: "completed" };
546
+ }
547
+ const [exitCode] = await Promise.all([
548
+ proc.exited,
549
+ forwardSpawnOutput(proc.stdout, output),
550
+ forwardSpawnOutput(proc.stderr, output)
551
+ ]);
552
+ if (exitCode === 0) {
553
+ output.write(` ${renderProgressBar(100)}
554
+ `);
555
+ output.write(`${t("updateCompleted")}
556
+
557
+ `);
558
+ }
559
+ return { exitCode, disposition: "completed" };
560
+ }
561
+ async function runSelfUpdate(outputOrOptions) {
562
+ return (await runSelfUpdateDetailed(outputOrOptions)).exitCode;
563
+ }
564
+
565
+ export {
566
+ getCliInstallChannel,
567
+ renderProgressBar,
568
+ buildNpmSelfUpdateCommand,
569
+ resolveStandaloneBundlePlatform,
570
+ resolveStandaloneBundleRepoBase,
571
+ buildStandaloneManualUpdateHint,
572
+ readPackageInfo,
573
+ buildCliVersionText,
574
+ buildSelfUpdateCommand,
575
+ resolveSelfUpdateServerUrl,
576
+ buildCliDoctorText,
577
+ buildStandaloneUpdateScript,
578
+ runStandaloneBundleUpdate,
579
+ NOLO_UPDATE_CHECK_KILL_SWITCH,
580
+ compareCliVersions,
581
+ checkForCliUpdate,
582
+ runSelfUpdateDetailed,
583
+ runSelfUpdate
584
+ };
@@ -1,17 +1,17 @@
1
- import {
2
- buildDialogAttachmentPlan,
3
- extractFileContentIds
4
- } from "./chunk-OFFL4DCR.js";
5
1
  import {
6
2
  BUILTIN_DIALOG_LLM_FALLBACK_MODEL,
7
3
  BUILTIN_SUMMARY_LLM_CONFIG
8
4
  } from "./chunk-523DITKR.js";
5
+ import {
6
+ buildDialogAttachmentPlan,
7
+ extractFileContentIds
8
+ } from "./chunk-OFFL4DCR.js";
9
9
  import {
10
10
  isMediaToolConfirmation
11
11
  } from "./chunk-QYPE3TS3.js";
12
12
  import {
13
13
  runLlm
14
- } from "./chunk-HS7JBDUJ.js";
14
+ } from "./chunk-QHFRRM5U.js";
15
15
  import {
16
16
  getApproxPricePerImage
17
17
  } from "./chunk-4JH2UMJR.js";
@@ -11064,7 +11064,7 @@ var messageSlice = createSliceWithThunks({
11064
11064
  runtimeOptions: args.runtimeOptions
11065
11065
  });
11066
11066
  if (agentKeyToUse) {
11067
- const { streamAgentChatTurn } = await import("./agentSlice-FCDRLXVA.js");
11067
+ const { streamAgentChatTurn } = await import("./agentSlice-NG7VBT4O.js");
11068
11068
  await dispatch(
11069
11069
  streamAgentChatTurn({
11070
11070
  agentKey: agentKeyToUse,
@@ -13881,7 +13881,7 @@ var deleteDialogThunk = async (payload, thunkApi) => {
13881
13881
  }
13882
13882
  if (isCurrentDialog) {
13883
13883
  await thunkApi.dispatch(resetMsgs());
13884
- const { clearPendingAttachments: clearPendingAttachments2 } = await import("./dialogSlice-PKFXK5WM.js");
13884
+ const { clearPendingAttachments: clearPendingAttachments2 } = await import("./dialogSlice-VHGZCHAQ.js");
13885
13885
  dispatch(clearPendingAttachments2());
13886
13886
  }
13887
13887
  return { dialogKey, isCurrentDialog, attachmentPlan };
@@ -13889,15 +13889,15 @@ var deleteDialogThunk = async (payload, thunkApi) => {
13889
13889
 
13890
13890
  // packages/chat/dialog/dialogSlice.ts
13891
13891
  var runCreateDialogAction = async (args, thunkApi) => {
13892
- const { createDialogAction } = await import("./createDialogAction-G7QCYQT7.js");
13892
+ const { createDialogAction } = await import("./createDialogAction-DBTKPCXV.js");
13893
13893
  return createDialogAction(args, thunkApi);
13894
13894
  };
13895
13895
  var runCreateAgentAutomationAction = async (args, thunkApi) => {
13896
- const { createAgentAutomationAction } = await import("./createAgentAutomationAction-ZOFCBZRE.js");
13896
+ const { createAgentAutomationAction } = await import("./createAgentAutomationAction-FAOPVXNF.js");
13897
13897
  return createAgentAutomationAction(args, thunkApi);
13898
13898
  };
13899
13899
  var runUpdateDialogTitleAction = async (args, thunkApi) => {
13900
- const { updateDialogTitleAction } = await import("./updateDialogTitleAction-UUZ5HDM2.js");
13900
+ const { updateDialogTitleAction } = await import("./updateDialogTitleAction-WBIPSXFL.js");
13901
13901
  return updateDialogTitleAction(args, thunkApi);
13902
13902
  };
13903
13903
  var runAddDialogAgentAction = async (args, thunkApi) => {
@@ -13921,7 +13921,7 @@ var runSetDialogExtraReferencesAction = async (args, thunkApi) => {
13921
13921
  return setDialogExtraReferencesAction(args, thunkApi);
13922
13922
  };
13923
13923
  var runHandleSendMessageAction = async (args, thunkApi) => {
13924
- const { handleSendMessageAction } = await import("./handleSendMessageAction-HUQLERJP.js");
13924
+ const { handleSendMessageAction } = await import("./handleSendMessageAction-XTQQEVD4.js");
13925
13925
  return handleSendMessageAction(args, thunkApi);
13926
13926
  };
13927
13927
  function clearDialogState() {
@@ -13934,7 +13934,7 @@ var createPageAndAddReference = createAsyncThunk(
13934
13934
  async (payload, { dispatch, getState, rejectWithValue }) => {
13935
13935
  const { slateData, jsonData, title, type, fileId, groupId, dialogKey } = payload;
13936
13936
  try {
13937
- const { createDocState } = await import("./docStore-NAEY4CEK.js");
13937
+ const { createDocState } = await import("./docStore-XGWH3T7Q.js");
13938
13938
  const pageKey = await createDocState(
13939
13939
  { slateData, title },
13940
13940
  { dispatch, getState }
@@ -3,7 +3,7 @@ import {
3
3
  classifyAgentApiKeyRef,
4
4
  formatUnsupportedAgentApiKeyRefMessage,
5
5
  shouldReadAgentKeyRemotely
6
- } from "./chunk-CTEEJJVR.js";
6
+ } from "./chunk-MPIAKYZ7.js";
7
7
  import {
8
8
  resolveCliAgentKeyInput
9
9
  } from "./chunk-NBTY7YJF.js";
@@ -6,7 +6,7 @@ import {
6
6
  } from "./chunk-62TBKWTV.js";
7
7
  import {
8
8
  clearCliLocalRuntimePreparedAgentCache
9
- } from "./chunk-SGATEZV5.js";
9
+ } from "./chunk-BNEHIKIR.js";
10
10
  import {
11
11
  readCredentialAvailability
12
12
  } from "./chunk-R4BMKAR5.js";
@@ -19,7 +19,7 @@ import {
19
19
  resolveAgentRecordFromHybridStore,
20
20
  sanitizeAgentRecordForCliOutput,
21
21
  writeAgentRecord
22
- } from "./chunk-OXYSTN6B.js";
22
+ } from "./chunk-GTQKUQGF.js";
23
23
  import {
24
24
  resolveCliAgentKeyInput
25
25
  } from "./chunk-NBTY7YJF.js";
@@ -1,12 +1,12 @@
1
1
  import {
2
2
  requireTokenUser
3
- } from "./chunk-4FZUUCXQ.js";
4
- import {
5
- t
6
- } from "./chunk-TDX2L4W2.js";
3
+ } from "./chunk-MMSZKZWA.js";
7
4
  import {
8
5
  resolveServerUrl
9
6
  } from "./chunk-WACI5I6V.js";
7
+ import {
8
+ t
9
+ } from "./chunk-PS3GU7YU.js";
10
10
 
11
11
  // packages/cli/cliApiClient.ts
12
12
  var CliApiError = class extends Error {