zcode-app-cli 3.18.1-46 → 3.18.2-47
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/bin/zcode.js +101 -1
- package/docs/CONFIGURATION.md +17 -4
- package/docs/CONFIGURATION.zh-CN.md +12 -3
- package/docs/HEADLESS.md +25 -0
- package/docs/HOST_INTEGRATION.md +10 -4
- package/package.json +2 -2
- package/vendor/cli-config.cjs +170 -1
- package/vendor/extraction.json +9 -4
- package/vendor/node_modules/@zcode/tui/dist/index.js +250 -21
- package/vendor/packages/node-repl-host/dist/build-identity.json +1 -1
- package/vendor/packages/node-repl-host/dist/mcp/server.js +1 -1
- package/vendor/zcode.cjs +1021 -1022
- package/zcode-runtime.lock.json +3 -3
|
@@ -1,15 +1,17 @@
|
|
|
1
1
|
import { createRequire } from "node:module";
|
|
2
|
-
import { spawn } from "node:child_process";
|
|
3
|
-
import { accessSync, appendFileSync, closeSync, constants, fstatSync, openSync, readFileSync, readSync } from "node:fs";
|
|
2
|
+
import { execFile, spawn } from "node:child_process";
|
|
3
|
+
import { accessSync, appendFileSync, closeSync, constants, fstatSync, openSync, readFileSync, readSync, writeSync } from "node:fs";
|
|
4
4
|
import { constants as constants$1, homedir } from "node:os";
|
|
5
5
|
import { access, link, mkdir, open, readFile, rename, rm, stat, writeFile } from "node:fs/promises";
|
|
6
6
|
import { basename, dirname, extname, isAbsolute, join, posix, resolve, sep, win32 } from "node:path";
|
|
7
7
|
import { randomUUID } from "node:crypto";
|
|
8
|
+
import { isDeepStrictEqual, promisify } from "node:util";
|
|
9
|
+
import { AsyncLocalStorage } from "node:async_hooks";
|
|
10
|
+
import { isatty } from "node:tty";
|
|
8
11
|
import { Box, CombinedAutocompleteProvider, Container, Editor, Image, Input, Markdown, ProcessTerminal, ScrollView, SelectList, Spacer, Text, TuiAltScreen, TuiMainScreen, VStack, decodeKittyPrintable, getKeybindings, isKeyRelease, isViewportTUI, matchesKey, renderFakeCursor, truncateToWidth, visibleWidth, wrapTextWithAnsi } from "@earendil-works/pi-tui";
|
|
9
12
|
import { AltScreenSearchComponent } from "@earendil-works/pi-tui/dist/alt-screen-search.js";
|
|
10
13
|
import { DatabaseSync } from "node:sqlite";
|
|
11
14
|
import { StringDecoder } from "node:string_decoder";
|
|
12
|
-
import { isDeepStrictEqual } from "node:util";
|
|
13
15
|
var __commonJSMin = (cb, mod) => () => (mod || (cb((mod = { exports: {} }).exports, mod), cb = null), mod.exports);
|
|
14
16
|
var __require = /* #__PURE__ */ (() => createRequire(import.meta.url))();
|
|
15
17
|
//#endregion
|
|
@@ -275,7 +277,7 @@ async function updateCliSettings(update, env = process.env) {
|
|
|
275
277
|
await rm(temporaryPath, { force: true }).catch(() => {});
|
|
276
278
|
}
|
|
277
279
|
}
|
|
278
|
-
function record$
|
|
280
|
+
function record$6(value) {
|
|
279
281
|
return typeof value === "object" && value !== null && !Array.isArray(value) ? value : void 0;
|
|
280
282
|
}
|
|
281
283
|
/**
|
|
@@ -304,9 +306,9 @@ async function readConfiguredModelAccess(env = process.env) {
|
|
|
304
306
|
} catch (error) {
|
|
305
307
|
return null;
|
|
306
308
|
}
|
|
307
|
-
const root = record$
|
|
309
|
+
const root = record$6(value), config = record$6(root?.config);
|
|
308
310
|
if (root?.schemaVersion !== 1 || !config) return null;
|
|
309
|
-
const selection = record$
|
|
311
|
+
const selection = record$6(config.defaultModelSelection);
|
|
310
312
|
const providerId = typeof selection?.providerId === "string" ? selection.providerId.trim() : "";
|
|
311
313
|
const modelId = typeof selection?.modelId === "string" ? selection.modelId.trim() : "";
|
|
312
314
|
if (!providerId || !modelId) return null;
|
|
@@ -316,23 +318,23 @@ async function readConfiguredModelAccess(env = process.env) {
|
|
|
316
318
|
providerId
|
|
317
319
|
};
|
|
318
320
|
if (providerId.startsWith("account:")) try {
|
|
319
|
-
return accountProviderConfigured(record$
|
|
321
|
+
return accountProviderConfigured(record$6(JSON.parse(await readFile(credentialsPath(env), "utf8"))) ?? {}, providerId) ? result : null;
|
|
320
322
|
} catch {
|
|
321
323
|
return null;
|
|
322
324
|
}
|
|
323
|
-
const rules = record$
|
|
325
|
+
const rules = record$6(config.providerConfigRules)?.providerRules;
|
|
324
326
|
if (!Array.isArray(rules)) return null;
|
|
325
|
-
const settings = record$
|
|
327
|
+
const settings = record$6(rules.map(record$6).find((rule) => rule?.providerId === providerId)?.config), access = record$6(settings?.access);
|
|
326
328
|
return settings?.visibility !== "hidden" && typeof access?.apiKey === "string" && access.apiKey.trim() && (!Array.isArray(settings?.personalModelIds) || settings.personalModelIds.includes(modelId)) ? result : null;
|
|
327
329
|
}
|
|
328
330
|
/** A native personal provider can be usable without a saved default selection. */
|
|
329
331
|
async function hasConfiguredProviderAccess(env = process.env) {
|
|
330
332
|
if (await readConfiguredModelAccess(env)) return true;
|
|
331
333
|
try {
|
|
332
|
-
const value = record$
|
|
333
|
-
const rules = record$
|
|
334
|
+
const value = record$6(JSON.parse(await readFile(providerConfigPath(env), "utf8")));
|
|
335
|
+
const rules = record$6(record$6(value?.config)?.providerConfigRules)?.providerRules;
|
|
334
336
|
return value?.schemaVersion === 1 && Array.isArray(rules) && rules.some((raw) => {
|
|
335
|
-
const rule = record$
|
|
337
|
+
const rule = record$6(raw), config = record$6(rule?.config), access = record$6(config?.access);
|
|
336
338
|
return rule?.enabled !== false && config?.visibility !== "hidden" && typeof access?.apiKey === "string" && access.apiKey.trim().length > 0 && (typeof rule?.templateId === "string" || Array.isArray(config?.personalModelIds) && config.personalModelIds.length > 0);
|
|
337
339
|
});
|
|
338
340
|
} catch {
|
|
@@ -360,7 +362,7 @@ async function clearSetupPending(env = process.env) {
|
|
|
360
362
|
}
|
|
361
363
|
//#endregion
|
|
362
364
|
//#region src/prompt-preflight.ts
|
|
363
|
-
function record$
|
|
365
|
+
function record$5(value) {
|
|
364
366
|
return typeof value === "object" && value !== null && !Array.isArray(value) ? value : void 0;
|
|
365
367
|
}
|
|
366
368
|
async function exists(path) {
|
|
@@ -389,25 +391,161 @@ async function missingCodingPlanKey(options = {}) {
|
|
|
389
391
|
const message = (providerId) => `Model access is not configured${providerId ? ` for ${providerId}` : ""}. Run /login or /setup in zcode, or configure its API key before sending a prompt. No model request was sent.`;
|
|
390
392
|
let root;
|
|
391
393
|
try {
|
|
392
|
-
root = record$
|
|
394
|
+
root = record$5(JSON.parse(await readFile(providerConfigPath(env), "utf8")));
|
|
393
395
|
} catch (error) {
|
|
394
396
|
return error.code === "ENOENT" && !options.model ? message() : void 0;
|
|
395
397
|
}
|
|
396
|
-
const config = record$
|
|
398
|
+
const config = record$5(root?.config);
|
|
397
399
|
if (root?.schemaVersion !== 1 || !config) return void 0;
|
|
398
|
-
const selection = record$
|
|
400
|
+
const selection = record$5(config.defaultModelSelection);
|
|
399
401
|
const model = options.model ?? (typeof selection?.providerId === "string" && typeof selection.modelId === "string" ? `${selection.providerId}/${selection.modelId}` : void 0);
|
|
400
402
|
if (!model) return await hasConfiguredProviderAccess(env) ? void 0 : message();
|
|
401
403
|
const separator = model.indexOf("/");
|
|
402
404
|
if (separator <= 0) return void 0;
|
|
403
405
|
const providerId = model.slice(0, separator), modelId = model.slice(separator + 1);
|
|
404
406
|
if (providerId.startsWith("account:")) return void 0;
|
|
405
|
-
const rules = record$
|
|
407
|
+
const rules = record$5(config.providerConfigRules)?.providerRules;
|
|
406
408
|
if (!Array.isArray(rules)) return void 0;
|
|
407
|
-
const settings = record$
|
|
408
|
-
if (!settings || !["api-key", "zhipu-coding-plan-api-key"].includes(String(auth?.type)) || typeof auth?.apiKey === "string" && auth.apiKey.trim() || auth?.apiKey !== void 0 && typeof auth.apiKey !== "string" || Object.keys(record$
|
|
409
|
+
const settings = record$5(rules.map(record$5).find((rule) => rule?.providerId === providerId)?.config), auth = record$5(settings?.access), api = record$5(settings?.api);
|
|
410
|
+
if (!settings || !["api-key", "zhipu-coding-plan-api-key"].includes(String(auth?.type)) || typeof auth?.apiKey === "string" && auth.apiKey.trim() || auth?.apiKey !== void 0 && typeof auth.apiKey !== "string" || Object.keys(record$5(api?.headers) ?? {}).length > 0 || Array.isArray(settings.personalModelIds) && !settings.personalModelIds.includes(modelId)) return void 0;
|
|
409
411
|
return message(providerId);
|
|
410
412
|
}
|
|
413
|
+
promisify(execFile);
|
|
414
|
+
new AsyncLocalStorage();
|
|
415
|
+
//#endregion
|
|
416
|
+
//#region src/runtime-keychain-recovery.ts
|
|
417
|
+
function recoveryError(message, cause) {
|
|
418
|
+
return Object.assign(new Error(message, { cause }), { code: "CREDENTIAL_SECURE_STORAGE_UNAVAILABLE" });
|
|
419
|
+
}
|
|
420
|
+
function interactionRequired(error) {
|
|
421
|
+
return error instanceof Error && /user interaction is not allowed|interaction (?:is )?not allowed|keychain (?:is )?locked|errSecInteractionNotAllowed|(?:^|\D)-25308(?:\D|$)/iu.test(error.message);
|
|
422
|
+
}
|
|
423
|
+
async function unlockKeychainInTerminal() {
|
|
424
|
+
if (process.stdin.isRaw) throw recoveryError("The keychain needs unlocking. Unlock it with security unlock-keychain in another terminal, then retry the operation in this session.");
|
|
425
|
+
let terminal;
|
|
426
|
+
try {
|
|
427
|
+
terminal = openSync("/dev/tty", "r+");
|
|
428
|
+
} catch (cause) {
|
|
429
|
+
throw recoveryError("The keychain needs unlocking, but no controlling terminal is available. Run security unlock-keychain in an interactive SSH session or configure a managed credential secret.", cause);
|
|
430
|
+
}
|
|
431
|
+
const wasFlowing = process.stdin.isTTY && process.stdin.readableFlowing === true;
|
|
432
|
+
try {
|
|
433
|
+
if (!isatty(terminal)) throw recoveryError("Keychain unlock requires a controlling terminal.");
|
|
434
|
+
if (wasFlowing) process.stdin.pause();
|
|
435
|
+
writeSync(terminal, "\nThe macOS keychain needs unlocking to continue. Enter its password below (Ctrl-C to cancel).\n");
|
|
436
|
+
await new Promise((resolve, reject) => {
|
|
437
|
+
const child = spawn("/usr/bin/security", ["unlock-keychain"], { stdio: [
|
|
438
|
+
terminal,
|
|
439
|
+
terminal,
|
|
440
|
+
terminal
|
|
441
|
+
] });
|
|
442
|
+
const handlers = [
|
|
443
|
+
"SIGINT",
|
|
444
|
+
"SIGTERM",
|
|
445
|
+
"SIGHUP"
|
|
446
|
+
].map((signal) => {
|
|
447
|
+
const hadListeners = process.listenerCount(signal) > 0;
|
|
448
|
+
const forward = () => {
|
|
449
|
+
child.kill(signal);
|
|
450
|
+
if (!hadListeners) {
|
|
451
|
+
process.off(signal, forward);
|
|
452
|
+
process.kill(process.pid, signal);
|
|
453
|
+
}
|
|
454
|
+
};
|
|
455
|
+
process.prependListener(signal, forward);
|
|
456
|
+
return {
|
|
457
|
+
signal,
|
|
458
|
+
forward
|
|
459
|
+
};
|
|
460
|
+
});
|
|
461
|
+
const cleanup = () => {
|
|
462
|
+
for (const { signal, forward } of handlers) process.off(signal, forward);
|
|
463
|
+
};
|
|
464
|
+
child.once("error", (cause) => {
|
|
465
|
+
cleanup();
|
|
466
|
+
reject(recoveryError("Could not start the system keychain unlock tool.", cause));
|
|
467
|
+
});
|
|
468
|
+
child.once("close", (code, signal) => {
|
|
469
|
+
cleanup();
|
|
470
|
+
if (code === 0) resolve();
|
|
471
|
+
else reject(recoveryError(signal ? `Keychain unlock was cancelled (${signal}); no credentials were changed.` : "Keychain unlock failed; no credentials were changed. Retry the operation to try again."));
|
|
472
|
+
});
|
|
473
|
+
});
|
|
474
|
+
writeSync(terminal, "Keychain unlocked; continuing the pending credential operation.\n");
|
|
475
|
+
} finally {
|
|
476
|
+
closeSync(terminal);
|
|
477
|
+
if (wasFlowing) process.stdin.resume();
|
|
478
|
+
}
|
|
479
|
+
}
|
|
480
|
+
function createKeychainRecovery(options = {}) {
|
|
481
|
+
const platform = options.platform ?? process.platform;
|
|
482
|
+
const unlock = options.unlock ?? unlockKeychainInTerminal;
|
|
483
|
+
let pending;
|
|
484
|
+
let generation = 0;
|
|
485
|
+
let lastFailure;
|
|
486
|
+
return async (operation) => {
|
|
487
|
+
const started = generation;
|
|
488
|
+
try {
|
|
489
|
+
return await operation();
|
|
490
|
+
} catch (error) {
|
|
491
|
+
if (platform !== "darwin" || !interactionRequired(error)) throw error;
|
|
492
|
+
if (started === generation) {
|
|
493
|
+
if (!pending) pending = Promise.resolve().then(unlock).then(() => {
|
|
494
|
+
lastFailure = void 0;
|
|
495
|
+
}, (cause) => {
|
|
496
|
+
lastFailure = cause;
|
|
497
|
+
throw cause;
|
|
498
|
+
}).finally(() => {
|
|
499
|
+
generation++;
|
|
500
|
+
pending = void 0;
|
|
501
|
+
});
|
|
502
|
+
await pending;
|
|
503
|
+
} else if (lastFailure !== void 0) throw lastFailure;
|
|
504
|
+
try {
|
|
505
|
+
return await operation();
|
|
506
|
+
} catch (cause) {
|
|
507
|
+
if (interactionRequired(cause)) throw recoveryError("Keychain unlock completed, but credential access is still denied. Check the keychain item's access controls in a local macOS session.", cause);
|
|
508
|
+
throw cause;
|
|
509
|
+
}
|
|
510
|
+
}
|
|
511
|
+
};
|
|
512
|
+
}
|
|
513
|
+
createKeychainRecovery();
|
|
514
|
+
//#endregion
|
|
515
|
+
//#region src/runtime-config-bridge.ts
|
|
516
|
+
function record$4(value) {
|
|
517
|
+
return value && typeof value === "object" && !Array.isArray(value) ? value : void 0;
|
|
518
|
+
}
|
|
519
|
+
async function writeTuiShowReasoning(value, env = process.env) {
|
|
520
|
+
const filePath = desktopSettingsPath(env);
|
|
521
|
+
let settings = {};
|
|
522
|
+
try {
|
|
523
|
+
const existing = record$4(JSON.parse(await readFile(filePath, "utf8")));
|
|
524
|
+
if (!existing) throw new Error("Desktop setting.json must contain an object.");
|
|
525
|
+
settings = existing;
|
|
526
|
+
} catch (error) {
|
|
527
|
+
if (error.code !== "ENOENT") throw new Error("Unable to read Desktop setting.json; the file was left unchanged.", { cause: error });
|
|
528
|
+
}
|
|
529
|
+
const directory = dirname(filePath);
|
|
530
|
+
const temporaryPath = join(directory, `.${basename(filePath)}.${process.pid}.${randomUUID()}.tmp`);
|
|
531
|
+
await mkdir(directory, {
|
|
532
|
+
recursive: true,
|
|
533
|
+
mode: 448
|
|
534
|
+
});
|
|
535
|
+
try {
|
|
536
|
+
await writeFile(temporaryPath, `${JSON.stringify({
|
|
537
|
+
...settings,
|
|
538
|
+
messageStreamShowReasoning: value
|
|
539
|
+
}, null, 2)}\n`, {
|
|
540
|
+
flag: "wx",
|
|
541
|
+
mode: 384
|
|
542
|
+
});
|
|
543
|
+
await rename(temporaryPath, filePath);
|
|
544
|
+
} catch (error) {
|
|
545
|
+
await rm(temporaryPath, { force: true }).catch(() => {});
|
|
546
|
+
throw new Error("Unable to save Desktop reasoning visibility; the setting was left unchanged.", { cause: error });
|
|
547
|
+
}
|
|
548
|
+
}
|
|
411
549
|
//#endregion
|
|
412
550
|
//#region packages/zcode-tui/src/stream-error-guard.ts
|
|
413
551
|
function watchStreamErrors(sources, onError) {
|
|
@@ -166955,6 +167093,9 @@ var ZCodeTui = class {
|
|
|
166955
167093
|
recentSteerCommit;
|
|
166956
167094
|
currentThinking;
|
|
166957
167095
|
currentThinkingPartId;
|
|
167096
|
+
currentTurnHasReasoning = false;
|
|
167097
|
+
currentTurnReasoningPartId;
|
|
167098
|
+
currentTurnReasoningMessageId;
|
|
166958
167099
|
presentationRegistry = new TurnPresentationRegistry();
|
|
166959
167100
|
thinkingParts = this.presentationRegistry.thinkingParts;
|
|
166960
167101
|
protocolPartViews = this.presentationRegistry.protocolPartViews;
|
|
@@ -166978,6 +167119,7 @@ var ZCodeTui = class {
|
|
|
166978
167119
|
terminalFocus = "unknown";
|
|
166979
167120
|
copyOnSelect = true;
|
|
166980
167121
|
thoughtLevel;
|
|
167122
|
+
showReasoning;
|
|
166981
167123
|
modelOptions;
|
|
166982
167124
|
effortOptions;
|
|
166983
167125
|
lastAssistantText = "";
|
|
@@ -167066,6 +167208,7 @@ var ZCodeTui = class {
|
|
|
167066
167208
|
this.planEnabled = options.initialPlanEnabled ?? false;
|
|
167067
167209
|
this.model = modelLabel(options.initialModel);
|
|
167068
167210
|
this.thoughtLevel = options.initialThoughtLevel;
|
|
167211
|
+
this.showReasoning = options.showReasoning ?? true;
|
|
167069
167212
|
this.modelOptions = [...options.modelOptions ?? []];
|
|
167070
167213
|
this.effortOptions = [...options.effortOptions ?? []];
|
|
167071
167214
|
this.loginRequired = options.loginRequired === true;
|
|
@@ -167243,6 +167386,30 @@ var ZCodeTui = class {
|
|
|
167243
167386
|
this.copyOnSelect = enabled;
|
|
167244
167387
|
this.fullscreenAltScreen?.setCopyOnSelect(enabled);
|
|
167245
167388
|
}
|
|
167389
|
+
setShowReasoning(enabled) {
|
|
167390
|
+
this.showReasoning = enabled;
|
|
167391
|
+
}
|
|
167392
|
+
resetTurnReasoningVisibility() {
|
|
167393
|
+
this.currentTurnHasReasoning = false;
|
|
167394
|
+
this.currentTurnReasoningPartId = void 0;
|
|
167395
|
+
this.currentTurnReasoningMessageId = void 0;
|
|
167396
|
+
}
|
|
167397
|
+
shouldShowCurrentTurnReasoning(partId, messageId) {
|
|
167398
|
+
if (!this.currentTurnHasReasoning) {
|
|
167399
|
+
this.currentTurnHasReasoning = true;
|
|
167400
|
+
this.currentTurnReasoningPartId = partId;
|
|
167401
|
+
this.currentTurnReasoningMessageId = messageId;
|
|
167402
|
+
return true;
|
|
167403
|
+
}
|
|
167404
|
+
if (this.showReasoning) return true;
|
|
167405
|
+
if (this.currentTurnReasoningPartId) return partId === this.currentTurnReasoningPartId;
|
|
167406
|
+
if (partId && this.currentTurnReasoningMessageId && messageId === this.currentTurnReasoningMessageId) {
|
|
167407
|
+
this.currentTurnReasoningPartId = partId;
|
|
167408
|
+
return true;
|
|
167409
|
+
}
|
|
167410
|
+
if (this.currentTurnReasoningMessageId) return messageId === this.currentTurnReasoningMessageId;
|
|
167411
|
+
return !partId && !messageId && this.currentThinking !== void 0;
|
|
167412
|
+
}
|
|
167246
167413
|
/**
|
|
167247
167414
|
* Mirror terminal focus onto the hardware cursor so multiplexer panes
|
|
167248
167415
|
* (tmux/windows-style splits) only show a live cursor in the focused pane;
|
|
@@ -168826,7 +168993,7 @@ var ZCodeTui = class {
|
|
|
168826
168993
|
return;
|
|
168827
168994
|
}
|
|
168828
168995
|
if (part.type === "thought") {
|
|
168829
|
-
if (!part.partId) return;
|
|
168996
|
+
if (!part.partId || !this.shouldShowCurrentTurnReasoning(part.partId, part.messageId)) return;
|
|
168830
168997
|
let view = this.thinkingParts.get(part.partId);
|
|
168831
168998
|
if (!view) {
|
|
168832
168999
|
view = new ThinkingView(this.theme);
|
|
@@ -168940,6 +169107,7 @@ var ZCodeTui = class {
|
|
|
168940
169107
|
}
|
|
168941
169108
|
beginTurn(prompt) {
|
|
168942
169109
|
this.completeThinking();
|
|
169110
|
+
this.resetTurnReasoningVisibility();
|
|
168943
169111
|
this.presentationRegistry.beginTurn();
|
|
168944
169112
|
this.modelStatusBlockId = `${modelStatusBlockIdPrefix}_${this.turnEpoch}`;
|
|
168945
169113
|
this.currentThinking = void 0;
|
|
@@ -168971,6 +169139,7 @@ var ZCodeTui = class {
|
|
|
168971
169139
|
this.assistantStream.clear();
|
|
168972
169140
|
this.currentThinking = void 0;
|
|
168973
169141
|
this.currentThinkingPartId = void 0;
|
|
169142
|
+
this.resetTurnReasoningVisibility();
|
|
168974
169143
|
this.backgroundCoordinatorMessageIds.clear();
|
|
168975
169144
|
this.presentationRegistry.clear();
|
|
168976
169145
|
this.turnDiffs.clear();
|
|
@@ -168979,6 +169148,7 @@ var ZCodeTui = class {
|
|
|
168979
169148
|
this.currentToolGroupMessageId = void 0;
|
|
168980
169149
|
}
|
|
168981
169150
|
appendThinking(delta, partId, messageId) {
|
|
169151
|
+
if (!this.shouldShowCurrentTurnReasoning(partId, messageId)) return;
|
|
168982
169152
|
if (delta.trim()) this.enterSessionRail();
|
|
168983
169153
|
if (partId) {
|
|
168984
169154
|
let view = this.thinkingParts.get(partId);
|
|
@@ -169377,6 +169547,7 @@ var ZCodeTui = class {
|
|
|
169377
169547
|
this.transcript.setNavigationViewportRows(Math.max(4, this.ui.terminal.rows - 10));
|
|
169378
169548
|
}
|
|
169379
169549
|
restoreTranscript(messages) {
|
|
169550
|
+
this.resetTurnReasoningVisibility();
|
|
169380
169551
|
let firstUserMessageText;
|
|
169381
169552
|
let lastAssistantModel;
|
|
169382
169553
|
for (const message of messages) {
|
|
@@ -169385,6 +169556,7 @@ var ZCodeTui = class {
|
|
|
169385
169556
|
this.currentToolGroupMessageId = void 0;
|
|
169386
169557
|
this.assistantStream.breakSegment();
|
|
169387
169558
|
if (message.role === "user") {
|
|
169559
|
+
this.resetTurnReasoningVisibility();
|
|
169388
169560
|
const text = message.parts.map((part) => part.type === "text" || part.type === "file" ? part.text : "").filter(Boolean).join("\n");
|
|
169389
169561
|
if (text) {
|
|
169390
169562
|
if (!firstUserMessageText) firstUserMessageText = text;
|
|
@@ -169435,6 +169607,7 @@ var ZCodeTui = class {
|
|
|
169435
169607
|
return;
|
|
169436
169608
|
}
|
|
169437
169609
|
if (part.type === "thought") {
|
|
169610
|
+
if (!this.shouldShowCurrentTurnReasoning(part.partId, messageId)) return;
|
|
169438
169611
|
if (part.partId) {
|
|
169439
169612
|
this.upsertProtocolPart(identifiedPart);
|
|
169440
169613
|
this.completeThinking(part.partId);
|
|
@@ -170232,6 +170405,11 @@ var ZCodeTui = class {
|
|
|
170232
170405
|
label: "Display mode",
|
|
170233
170406
|
description: tuiModeOverride === "fullscreen" || tuiModeOverride === "regular" ? `Current: ${this.tuiMode === "fullscreen" ? "Fullscreen" : "Regular"} (environment override)` : `Current: ${this.tuiMode === "fullscreen" ? "Fullscreen" : "Regular"}`
|
|
170234
170407
|
},
|
|
170408
|
+
{
|
|
170409
|
+
value: "reasoning-text",
|
|
170410
|
+
label: "Reasoning text",
|
|
170411
|
+
description: `Current: ${this.showReasoning ? "All thoughts" : "First thought per turn"} · shared with Desktop`
|
|
170412
|
+
},
|
|
170235
170413
|
{
|
|
170236
170414
|
value: "copy-on-select",
|
|
170237
170415
|
label: "Fullscreen copy on select",
|
|
@@ -170278,8 +170456,59 @@ var ZCodeTui = class {
|
|
|
170278
170456
|
selectedSettingIndex = 3;
|
|
170279
170457
|
continue;
|
|
170280
170458
|
}
|
|
170281
|
-
if (setting.value === "
|
|
170459
|
+
if (setting.value === "reasoning-text") {
|
|
170282
170460
|
selectedSettingIndex = 4;
|
|
170461
|
+
const selected = await this.showChoice({
|
|
170462
|
+
title: "Reasoning text",
|
|
170463
|
+
prompt: "Compare the example output, then choose what appears in each turn.",
|
|
170464
|
+
help: "Up/Down choose · Enter save · Esc back",
|
|
170465
|
+
items: [{
|
|
170466
|
+
value: "shown",
|
|
170467
|
+
label: "Show all thoughts",
|
|
170468
|
+
description: "Keep every thought and the answer in the stream.",
|
|
170469
|
+
preview: new Text([
|
|
170470
|
+
this.theme.muted("Example output"),
|
|
170471
|
+
`${this.theme.muted("◇")} ${this.theme.bold("Thought")}`,
|
|
170472
|
+
this.theme.muted(" Check the input details."),
|
|
170473
|
+
`${this.theme.muted("◇")} ${this.theme.bold("Thought")}`,
|
|
170474
|
+
this.theme.muted(" Verify the edge cases."),
|
|
170475
|
+
`${this.theme.accent("›")} The answer is 42.`
|
|
170476
|
+
].join("\n"), 1, 0)
|
|
170477
|
+
}, {
|
|
170478
|
+
value: "hidden",
|
|
170479
|
+
label: "Show first thought only",
|
|
170480
|
+
description: "Hide later thoughts; the answer still appears.",
|
|
170481
|
+
preview: new Text([
|
|
170482
|
+
this.theme.muted("Example output"),
|
|
170483
|
+
`${this.theme.muted("◇")} ${this.theme.bold("Thought")}`,
|
|
170484
|
+
this.theme.muted(" Check the input details."),
|
|
170485
|
+
this.theme.muted(" (Later thought omitted)"),
|
|
170486
|
+
`${this.theme.accent("›")} The answer is 42.`
|
|
170487
|
+
].join("\n"), 1, 0)
|
|
170488
|
+
}],
|
|
170489
|
+
selectedIndex: this.showReasoning ? 0 : 1
|
|
170490
|
+
});
|
|
170491
|
+
if (!selected) {
|
|
170492
|
+
feedback = "No changes · Esc closes settings";
|
|
170493
|
+
continue;
|
|
170494
|
+
}
|
|
170495
|
+
const next = selected.value === "shown";
|
|
170496
|
+
if (next === this.showReasoning) {
|
|
170497
|
+
feedback = "Reasoning text setting unchanged";
|
|
170498
|
+
continue;
|
|
170499
|
+
}
|
|
170500
|
+
try {
|
|
170501
|
+
await writeTuiShowReasoning(next);
|
|
170502
|
+
this.setShowReasoning(next);
|
|
170503
|
+
feedback = `${next ? "All reasoning text shown" : "First thought per turn shown"} · saved to shared Desktop settings`;
|
|
170504
|
+
} catch (error) {
|
|
170505
|
+
this.addNotice(error instanceof Error ? error.message : String(error), "error");
|
|
170506
|
+
feedback = "Could not save the setting · select it to retry";
|
|
170507
|
+
}
|
|
170508
|
+
continue;
|
|
170509
|
+
}
|
|
170510
|
+
if (setting.value === "copy-on-select") {
|
|
170511
|
+
selectedSettingIndex = 5;
|
|
170283
170512
|
const selected = await this.showChoice({
|
|
170284
170513
|
title: "Fullscreen copy on select",
|
|
170285
170514
|
prompt: "Only applies to fullscreen mode. Releasing a mouse selection copies it to the clipboard.",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"cuaHelperBuildId":"pipeline-
|
|
1
|
+
{"cuaHelperBuildId":"pipeline-337296-2681f4af"}
|
|
@@ -83730,7 +83730,7 @@ var ZCODE_CUA_HELPER_BUILD_ID;
|
|
|
83730
83730
|
var init_cua_version = __esm({
|
|
83731
83731
|
"src/broker/shared/cua-version.ts"() {
|
|
83732
83732
|
"use strict";
|
|
83733
|
-
ZCODE_CUA_HELPER_BUILD_ID = true ? "pipeline-
|
|
83733
|
+
ZCODE_CUA_HELPER_BUILD_ID = true ? "pipeline-337296-2681f4af" : "";
|
|
83734
83734
|
}
|
|
83735
83735
|
});
|
|
83736
83736
|
var init_shared = __esm({
|