mixdog 0.9.43 → 0.9.45
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/package.json +3 -2
- package/scripts/ansi-color-capability-test.mjs +90 -0
- package/scripts/generate-runtime-manifest.mjs +39 -22
- package/scripts/grok-oauth-refresh-race-test.mjs +198 -0
- package/scripts/internal-comms-smoke.mjs +24 -7
- package/scripts/maintenance-default-routes-test.mjs +164 -0
- package/scripts/openai-oauth-ws-1006-retry-test.mjs +123 -0
- package/scripts/routing-corpus.mjs +1 -1
- package/scripts/shell-jobs-windows-hide-test.mjs +164 -0
- package/scripts/tui-transcript-jitter-harness-entry.jsx +302 -0
- package/scripts/tui-transcript-jitter-harness.mjs +58 -0
- package/src/agents/reviewer/AGENT.md +5 -7
- package/src/rules/lead/lead-brief.md +5 -4
- package/src/runtime/agent/orchestrator/agent-runtime/agent-dispatch.mjs +40 -3
- package/src/runtime/agent/orchestrator/config.mjs +29 -14
- package/src/runtime/agent/orchestrator/providers/grok-oauth.mjs +46 -21
- package/src/runtime/agent/orchestrator/providers/retry-classifier.mjs +5 -1
- package/src/runtime/agent/orchestrator/tools/builtin/shell-jobs.mjs +7 -5
- package/src/runtime/memory/data/runtime-manifest.json +11 -11
- package/src/runtime/memory/lib/runtime-fetcher.mjs +1 -2
- package/src/runtime/shared/update-checker.mjs +40 -10
- package/src/standalone/agent-tool.mjs +65 -50
- package/src/standalone/explore-tool.mjs +17 -16
- package/src/tui/App.jsx +3 -6
- package/src/tui/app/provider-setup-picker.mjs +1 -0
- package/src/tui/app/use-transcript-window.mjs +5 -1
- package/src/tui/components/StatusLine.jsx +7 -6
- package/src/tui/dist/index.mjs +225 -90
- package/src/tui/engine/turn.mjs +1 -1
- package/src/tui/index.jsx +3 -2
- package/src/tui/markdown/streaming-markdown.mjs +35 -9
- package/src/tui/statusline-ansi-bridge.mjs +17 -7
- package/src/ui/ansi.mjs +85 -5
- package/src/ui/statusline-format.mjs +7 -7
package/src/tui/dist/index.mjs
CHANGED
|
@@ -3140,8 +3140,8 @@ function formatAggregateDetail(summaries) {
|
|
|
3140
3140
|
}
|
|
3141
3141
|
|
|
3142
3142
|
// src/runtime/shared/update-checker.mjs
|
|
3143
|
-
import { existsSync, mkdirSync, readFileSync, writeFileSync } from "node:fs";
|
|
3144
|
-
import { dirname as dirname2, join as join2 } from "node:path";
|
|
3143
|
+
import { existsSync, mkdirSync, readFileSync, realpathSync, writeFileSync } from "node:fs";
|
|
3144
|
+
import { basename, delimiter, dirname as dirname2, join as join2 } from "node:path";
|
|
3145
3145
|
import { fileURLToPath as fileURLToPath2 } from "node:url";
|
|
3146
3146
|
|
|
3147
3147
|
// src/runtime/shared/plugin-paths.mjs
|
|
@@ -3729,8 +3729,110 @@ function Spinner({ verb = "Working", startedAt, outputTokens = 0, tokens = 0, th
|
|
|
3729
3729
|
import React2, { useEffect as useEffect2, useRef as useRef3, useState as useState2 } from "react";
|
|
3730
3730
|
import { Box as Box2, Text as Text2 } from "../../../vendor/ink/build/index.js";
|
|
3731
3731
|
|
|
3732
|
+
// src/ui/ansi.mjs
|
|
3733
|
+
import { stdout, env, platform } from "node:process";
|
|
3734
|
+
var COLOR_ENABLED = computeColorEnabled();
|
|
3735
|
+
function computeColorEnabled() {
|
|
3736
|
+
if (env.NO_COLOR !== void 0 && env.NO_COLOR !== "") return false;
|
|
3737
|
+
if (env.FORCE_COLOR !== void 0 && env.FORCE_COLOR !== "0" && env.FORCE_COLOR !== "") {
|
|
3738
|
+
return true;
|
|
3739
|
+
}
|
|
3740
|
+
return Boolean(stdout && stdout.isTTY);
|
|
3741
|
+
}
|
|
3742
|
+
var ESC = "\x1B[";
|
|
3743
|
+
var RESET = `${ESC}0m`;
|
|
3744
|
+
function supportsTruecolor(environment = env, platformName = platform) {
|
|
3745
|
+
const termProgram = String(environment?.TERM_PROGRAM || "").trim().toLowerCase();
|
|
3746
|
+
if (termProgram === "apple_terminal") return false;
|
|
3747
|
+
const colorTerm = String(environment?.COLORTERM || "").trim().toLowerCase();
|
|
3748
|
+
if (colorTerm === "truecolor" || colorTerm === "24bit") return true;
|
|
3749
|
+
if (environment?.WT_SESSION !== void 0 && environment.WT_SESSION !== "") return true;
|
|
3750
|
+
if (["iterm.app", "wezterm", "ghostty", "vscode"].includes(termProgram)) return true;
|
|
3751
|
+
if (/(?:direct|truecolor)/i.test(String(environment?.TERM || ""))) return true;
|
|
3752
|
+
if (platformName === "win32") return true;
|
|
3753
|
+
return true;
|
|
3754
|
+
}
|
|
3755
|
+
var ANSI_256_CUBE_LEVELS = Object.freeze([0, 95, 135, 175, 215, 255]);
|
|
3756
|
+
function colorByte(value) {
|
|
3757
|
+
const n = Number(value);
|
|
3758
|
+
return Number.isFinite(n) ? Math.max(0, Math.min(255, Math.round(n))) : 0;
|
|
3759
|
+
}
|
|
3760
|
+
function nearestCubeLevel(value) {
|
|
3761
|
+
let best = 0;
|
|
3762
|
+
let bestDistance = Infinity;
|
|
3763
|
+
for (let i = 0; i < ANSI_256_CUBE_LEVELS.length; i++) {
|
|
3764
|
+
const distance = Math.abs(value - ANSI_256_CUBE_LEVELS[i]);
|
|
3765
|
+
if (distance < bestDistance) {
|
|
3766
|
+
best = i;
|
|
3767
|
+
bestDistance = distance;
|
|
3768
|
+
}
|
|
3769
|
+
}
|
|
3770
|
+
return best;
|
|
3771
|
+
}
|
|
3772
|
+
function rgbToAnsi256(r, g, b) {
|
|
3773
|
+
const red2 = colorByte(r);
|
|
3774
|
+
const green2 = colorByte(g);
|
|
3775
|
+
const blue2 = colorByte(b);
|
|
3776
|
+
const redLevel = nearestCubeLevel(red2);
|
|
3777
|
+
const greenLevel = nearestCubeLevel(green2);
|
|
3778
|
+
const blueLevel = nearestCubeLevel(blue2);
|
|
3779
|
+
const cubeRed = ANSI_256_CUBE_LEVELS[redLevel];
|
|
3780
|
+
const cubeGreen = ANSI_256_CUBE_LEVELS[greenLevel];
|
|
3781
|
+
const cubeBlue = ANSI_256_CUBE_LEVELS[blueLevel];
|
|
3782
|
+
const cubeDistance = (red2 - cubeRed) ** 2 + (green2 - cubeGreen) ** 2 + (blue2 - cubeBlue) ** 2;
|
|
3783
|
+
const average = (red2 + green2 + blue2) / 3;
|
|
3784
|
+
const grayLevel = Math.max(0, Math.min(23, Math.round((average - 8) / 10)));
|
|
3785
|
+
const grayValue = 8 + grayLevel * 10;
|
|
3786
|
+
const grayDistance = (red2 - grayValue) ** 2 + (green2 - grayValue) ** 2 + (blue2 - grayValue) ** 2;
|
|
3787
|
+
if (grayDistance < cubeDistance) return 232 + grayLevel;
|
|
3788
|
+
return 16 + 36 * redLevel + 6 * greenLevel + blueLevel;
|
|
3789
|
+
}
|
|
3790
|
+
function rgbSgr(r, g, b, background = false) {
|
|
3791
|
+
const channel = background ? 48 : 38;
|
|
3792
|
+
if (supportsTruecolor()) return `${ESC}${channel};2;${r};${g};${b}m`;
|
|
3793
|
+
return `${ESC}${channel};5;${rgbToAnsi256(r, g, b)}m`;
|
|
3794
|
+
}
|
|
3795
|
+
function supportedSgrOpen(open) {
|
|
3796
|
+
const match = /^(38|48);2;([^;]+);([^;]+);([^;]+)$/.exec(String(open));
|
|
3797
|
+
if (!match || supportsTruecolor()) return open;
|
|
3798
|
+
return `${match[1]};5;${rgbToAnsi256(match[2], match[3], match[4])}`;
|
|
3799
|
+
}
|
|
3800
|
+
function sgr(open) {
|
|
3801
|
+
return (text) => {
|
|
3802
|
+
if (!COLOR_ENABLED) return String(text ?? "");
|
|
3803
|
+
const s = String(text ?? "");
|
|
3804
|
+
const openSeq = `${ESC}${supportedSgrOpen(open)}m`;
|
|
3805
|
+
return openSeq + s.replace(/\x1b\[0m/g, RESET + openSeq) + RESET;
|
|
3806
|
+
};
|
|
3807
|
+
}
|
|
3808
|
+
var bold = sgr("1");
|
|
3809
|
+
var dim = sgr("38;2;136;136;136");
|
|
3810
|
+
var italic = sgr("3");
|
|
3811
|
+
var underline = sgr("4");
|
|
3812
|
+
var inverse = sgr("7");
|
|
3813
|
+
var strike = sgr("9");
|
|
3814
|
+
var black = sgr("30");
|
|
3815
|
+
var red = sgr("38;2;220;70;88");
|
|
3816
|
+
var green = sgr("38;2;0;170;75");
|
|
3817
|
+
var yellow = sgr("38;2;255;193;7");
|
|
3818
|
+
var blue = sgr("38;2;77;159;255");
|
|
3819
|
+
var magenta = sgr("38;2;177;133;219");
|
|
3820
|
+
var cyan = sgr("38;2;136;136;136");
|
|
3821
|
+
var white = sgr("38;2;198;198;198");
|
|
3822
|
+
var gray = sgr("38;2;198;198;198");
|
|
3823
|
+
var brightRed = sgr("38;2;220;70;88");
|
|
3824
|
+
var brightGreen = sgr("38;2;0;185;88");
|
|
3825
|
+
var brightYellow = sgr("38;2;255;210;80");
|
|
3826
|
+
var brightBlue = sgr("38;2;93;173;255");
|
|
3827
|
+
var brightMagenta = sgr("38;2;190;150;230");
|
|
3828
|
+
var brightCyan = sgr("38;2;168;168;168");
|
|
3829
|
+
var brightWhite = sgr("38;2;220;220;220");
|
|
3830
|
+
var bgGray = sgr("100");
|
|
3831
|
+
var bgBlack = sgr("40");
|
|
3832
|
+
var bgBlue = sgr("44");
|
|
3833
|
+
|
|
3732
3834
|
// src/tui/statusline-ansi-bridge.mjs
|
|
3733
|
-
var
|
|
3835
|
+
var RESET2 = "\x1B[0m";
|
|
3734
3836
|
var STATUSLINE_CANONICAL_TRUECOLOR = Object.freeze({
|
|
3735
3837
|
statusText: [198, 198, 198],
|
|
3736
3838
|
subtle: [136, 136, 136],
|
|
@@ -3743,6 +3845,12 @@ var STATUSLINE_CANONICAL_TRUECOLOR = Object.freeze({
|
|
|
3743
3845
|
function truecolorSgr(r, g, b) {
|
|
3744
3846
|
return `\x1B[38;2;${r};${g};${b}m`;
|
|
3745
3847
|
}
|
|
3848
|
+
function ansi256Sgr(r, g, b) {
|
|
3849
|
+
return `\x1B[38;5;${rgbToAnsi256(r, g, b)}m`;
|
|
3850
|
+
}
|
|
3851
|
+
function canonicalSgrVariants(rgb) {
|
|
3852
|
+
return [truecolorSgr(...rgb), ansi256Sgr(...rgb)];
|
|
3853
|
+
}
|
|
3746
3854
|
function footerLocalNum(value) {
|
|
3747
3855
|
const n = Number(value);
|
|
3748
3856
|
return Number.isFinite(n) ? n : 0;
|
|
@@ -3793,7 +3901,7 @@ function statuslineFooterCacheKey({
|
|
|
3793
3901
|
String(autoCompactTokenLimit)
|
|
3794
3902
|
].join("\0");
|
|
3795
3903
|
}
|
|
3796
|
-
function applyDefaultStatusForegroundAfterReset(text, STATUS, reset =
|
|
3904
|
+
function applyDefaultStatusForegroundAfterReset(text, STATUS, reset = RESET2) {
|
|
3797
3905
|
const src = String(text || "");
|
|
3798
3906
|
if (!STATUS || !reset) return src;
|
|
3799
3907
|
let out = "";
|
|
@@ -3821,13 +3929,13 @@ function applyDefaultStatusForegroundAfterReset(text, STATUS, reset = RESET) {
|
|
|
3821
3929
|
function remapCanonicalStatuslineTruecolor(text, colors) {
|
|
3822
3930
|
const c = STATUSLINE_CANONICAL_TRUECOLOR;
|
|
3823
3931
|
const pairs = [
|
|
3824
|
-
|
|
3825
|
-
|
|
3826
|
-
|
|
3827
|
-
|
|
3828
|
-
|
|
3829
|
-
|
|
3830
|
-
|
|
3932
|
+
...canonicalSgrVariants(c.statusText).map((from) => [from, colors.STATUS]),
|
|
3933
|
+
...canonicalSgrVariants(c.subtle).map((from) => [from, colors.SUBTLE]),
|
|
3934
|
+
...canonicalSgrVariants(c.success).map((from) => [from, colors.SUCCESS]),
|
|
3935
|
+
...canonicalSgrVariants(c.successBright).map((from) => [from, colors.SUCCESS]),
|
|
3936
|
+
...canonicalSgrVariants(c.warning).map((from) => [from, colors.WARNING]),
|
|
3937
|
+
...canonicalSgrVariants(c.warningBright).map((from) => [from, colors.WARNING]),
|
|
3938
|
+
...canonicalSgrVariants(c.error).map((from) => [from, colors.ERROR])
|
|
3831
3939
|
];
|
|
3832
3940
|
let out = String(text || "");
|
|
3833
3941
|
for (const [from, to] of pairs) {
|
|
@@ -3835,7 +3943,7 @@ function remapCanonicalStatuslineTruecolor(text, colors) {
|
|
|
3835
3943
|
}
|
|
3836
3944
|
return out;
|
|
3837
3945
|
}
|
|
3838
|
-
function normalizeStatuslineAnsi(text, colors, { reset =
|
|
3946
|
+
function normalizeStatuslineAnsi(text, colors, { reset = RESET2 } = {}) {
|
|
3839
3947
|
const { STATUS, SUBTLE, SUCCESS, WARNING, ERROR } = colors;
|
|
3840
3948
|
let out = remapCanonicalStatuslineTruecolor(text, colors).replace(/\n+$/, "").replace(/\x1b\[1m/g, STATUS).replace(/\x1b\[2m/g, SUBTLE).replace(/\x1b\[31m/g, ERROR).replace(/\x1b\[32m/g, SUCCESS).replace(/\x1b\[33m/g, WARNING).replace(/\x1b\[36m/g, SUBTLE).replace(/\x1b\[90m/g, SUBTLE).replace(/^((?:\x1b\[[0-9;]*m)*)◆((?:\x1b\[[0-9;]*m)*)(\s?)/, `${STATUS}\u25C6$2$3`).replace(/(\x1b\[0m )(\d+(?:\.\d+)?%)(?= |$)/g, `$1${STATUS}$2${reset}`).replaceAll(`${reset} ${SUBTLE}\u2502${reset} `, ` ${SUBTLE}\u2502${reset} `);
|
|
3841
3949
|
out = applyDefaultStatusForegroundAfterReset(out, STATUS, reset);
|
|
@@ -3853,7 +3961,7 @@ function loadStatuslineModule() {
|
|
|
3853
3961
|
function resetStatuslineModuleLoad() {
|
|
3854
3962
|
statuslineModulePromise = null;
|
|
3855
3963
|
}
|
|
3856
|
-
var
|
|
3964
|
+
var RESET3 = "\x1B[0m";
|
|
3857
3965
|
var STATUSLINE_RENDER_DEBOUNCE_MS = 150;
|
|
3858
3966
|
var STATUSLINE_MODULE_PREWARM_DELAY_MS = 300;
|
|
3859
3967
|
var statuslineModulePrewarmScheduled = false;
|
|
@@ -3921,15 +4029,15 @@ function scheduleBootFullRetry(backoffMsRef, nextAttemptAtRef) {
|
|
|
3921
4029
|
function ansiRgb(value, fallback) {
|
|
3922
4030
|
const match = /^rgb\((\d+),(\d+),(\d+)\)$/.exec(String(value || "").replace(/\s+/g, ""));
|
|
3923
4031
|
if (!match) return fallback;
|
|
3924
|
-
return
|
|
4032
|
+
return rgbSgr(match[1], match[2], match[3]);
|
|
3925
4033
|
}
|
|
3926
4034
|
function statusColors() {
|
|
3927
4035
|
return {
|
|
3928
|
-
STATUS: ansiRgb(theme.statusText,
|
|
3929
|
-
SUBTLE: ansiRgb(theme.statusSubtle,
|
|
3930
|
-
SUCCESS: ansiRgb(theme.success,
|
|
3931
|
-
WARNING: ansiRgb(theme.warning,
|
|
3932
|
-
ERROR: ansiRgb(theme.error,
|
|
4036
|
+
STATUS: ansiRgb(theme.statusText, rgbSgr(198, 198, 198)),
|
|
4037
|
+
SUBTLE: ansiRgb(theme.statusSubtle, rgbSgr(136, 136, 136)),
|
|
4038
|
+
SUCCESS: ansiRgb(theme.success, rgbSgr(0, 170, 75)),
|
|
4039
|
+
WARNING: ansiRgb(theme.warning, rgbSgr(255, 193, 7)),
|
|
4040
|
+
ERROR: ansiRgb(theme.error, rgbSgr(220, 70, 88))
|
|
3933
4041
|
};
|
|
3934
4042
|
}
|
|
3935
4043
|
function terminalColumns() {
|
|
@@ -3977,14 +4085,14 @@ function localContextSegmentFromPct(ctxPct = 0) {
|
|
|
3977
4085
|
const barPct = Math.max(0, Math.min(100, pct));
|
|
3978
4086
|
const fill = pct >= 90 ? ERROR : pct >= 70 ? WARNING : SUCCESS;
|
|
3979
4087
|
const label = localContextPctDisplayLabel(pct);
|
|
3980
|
-
if (!cells) return `${fill}${label}%${
|
|
4088
|
+
if (!cells) return `${fill}${label}%${RESET3}`;
|
|
3981
4089
|
let filled = Math.floor(barPct * cells / 100);
|
|
3982
4090
|
if (barPct >= 1 && filled === 0) filled = 1;
|
|
3983
4091
|
filled = Math.max(0, Math.min(cells, filled));
|
|
3984
4092
|
const bar = "\u2593".repeat(filled) + "\u2591".repeat(cells - filled);
|
|
3985
4093
|
const filledBar = bar.replace(/░/g, "");
|
|
3986
4094
|
const emptyBar = bar.replace(/▓/g, "");
|
|
3987
|
-
return `${fill}${filledBar}${
|
|
4095
|
+
return `${fill}${filledBar}${RESET3}${SUBTLE}${emptyBar}${RESET3} ${label}%`;
|
|
3988
4096
|
}
|
|
3989
4097
|
var LOCAL_WORKER_SPINNER_FRAMES = ["\u280B", "\u2819", "\u2839", "\u2838", "\u283C", "\u2834", "\u2826", "\u2827", "\u2807", "\u280F"];
|
|
3990
4098
|
var LOCAL_L2_SPINNER_FRAME_MS = 120;
|
|
@@ -4048,27 +4156,27 @@ function localStatusLineL2({
|
|
|
4048
4156
|
activeTools = null
|
|
4049
4157
|
} = {}, now = Date.now()) {
|
|
4050
4158
|
const { STATUS, SUBTLE, SUCCESS } = statusColors();
|
|
4051
|
-
const spin = `${SUCCESS}${localL2SpinnerFrame(now)}${
|
|
4052
|
-
const segSep = ` ${SUBTLE}\u2502${
|
|
4053
|
-
const elapsedSuffix = (label) => label ? ` ${SUBTLE}\xB7${
|
|
4159
|
+
const spin = `${SUCCESS}${localL2SpinnerFrame(now)}${RESET3}`;
|
|
4160
|
+
const segSep = ` ${SUBTLE}\u2502${RESET3} `;
|
|
4161
|
+
const elapsedSuffix = (label) => label ? ` ${SUBTLE}\xB7${RESET3} ${label}` : "";
|
|
4054
4162
|
const l2Parts = [];
|
|
4055
4163
|
const runningCount = localRunningWorkerCount(agentWorkers, agentJobs);
|
|
4056
4164
|
if (runningCount > 0) {
|
|
4057
4165
|
const label = `Running ${runningCount} Agent${runningCount === 1 ? "" : "s"}`;
|
|
4058
4166
|
const oldestStart = localOldestWorkerStartMs(agentWorkers, agentJobs);
|
|
4059
4167
|
const elapsed = oldestStart > 0 ? localFormatElapsed(now - oldestStart) : "";
|
|
4060
|
-
l2Parts.push(`${spin} ${STATUS}${label}${
|
|
4168
|
+
l2Parts.push(`${spin} ${STATUS}${label}${RESET3}${elapsedSuffix(elapsed)}`);
|
|
4061
4169
|
}
|
|
4062
4170
|
const tools = activeTools && typeof activeTools === "object" ? activeTools : {};
|
|
4063
4171
|
const exploreInfo = tools.explore || null;
|
|
4064
4172
|
const searchInfo = tools.search || null;
|
|
4065
4173
|
if (exploreInfo && localNum(exploreInfo.count) > 0) {
|
|
4066
4174
|
const elapsed = localNum(exploreInfo.startedAt) > 0 ? localFormatElapsed(now - localNum(exploreInfo.startedAt)) : "";
|
|
4067
|
-
l2Parts.push(`${spin} ${STATUS}Exploring${
|
|
4175
|
+
l2Parts.push(`${spin} ${STATUS}Exploring${RESET3}${elapsedSuffix(elapsed)}`);
|
|
4068
4176
|
}
|
|
4069
4177
|
if (searchInfo && localNum(searchInfo.count) > 0) {
|
|
4070
4178
|
const elapsed = localNum(searchInfo.startedAt) > 0 ? localFormatElapsed(now - localNum(searchInfo.startedAt)) : "";
|
|
4071
|
-
l2Parts.push(`${spin} ${STATUS}Web Searching${
|
|
4179
|
+
l2Parts.push(`${spin} ${STATUS}Web Searching${RESET3}${elapsedSuffix(elapsed)}`);
|
|
4072
4180
|
}
|
|
4073
4181
|
return l2Parts.length ? l2Parts.join(segSep) : "";
|
|
4074
4182
|
}
|
|
@@ -4090,8 +4198,8 @@ function extractCachedShellSegments(cachedL2 = "", now = Date.now(), capturedAt
|
|
|
4090
4198
|
const visible = stripAnsi(cachedL2);
|
|
4091
4199
|
if (!visible) return [];
|
|
4092
4200
|
const { STATUS, SUBTLE, SUCCESS } = statusColors();
|
|
4093
|
-
const spin = `${SUCCESS}${localL2SpinnerFrame(now)}${
|
|
4094
|
-
const elapsedSuffix = (label) => label ? ` ${SUBTLE}\xB7${
|
|
4201
|
+
const spin = `${SUCCESS}${localL2SpinnerFrame(now)}${RESET3}`;
|
|
4202
|
+
const elapsedSuffix = (label) => label ? ` ${SUBTLE}\xB7${RESET3} ${label}` : "";
|
|
4095
4203
|
const out = [];
|
|
4096
4204
|
for (const seg of visible.split(" \u2502 ")) {
|
|
4097
4205
|
const m = /^(?:\S+\s+)?Running (\d+) Shells?\b(?:\s·\s(.+?))?\s*$/.exec(seg.trim());
|
|
@@ -4103,7 +4211,7 @@ function extractCachedShellSegments(cachedL2 = "", now = Date.now(), capturedAt
|
|
|
4103
4211
|
const advancedMs = baseMs > 0 && capturedAt > 0 ? baseMs + Math.max(0, now - capturedAt) : baseMs;
|
|
4104
4212
|
const elapsed = advancedMs > 0 ? localFormatElapsed(advancedMs) : cachedElapsedText;
|
|
4105
4213
|
const label = `Running ${n} Shell${n === 1 ? "" : "s"}`;
|
|
4106
|
-
out.push(`${spin} ${STATUS}${label}${
|
|
4214
|
+
out.push(`${spin} ${STATUS}${label}${RESET3}${elapsedSuffix(elapsed)}`);
|
|
4107
4215
|
}
|
|
4108
4216
|
return out;
|
|
4109
4217
|
}
|
|
@@ -4127,7 +4235,7 @@ function localBootStatusLine(args = {}) {
|
|
|
4127
4235
|
terminalColumns()
|
|
4128
4236
|
);
|
|
4129
4237
|
const flags = [effort ? String(effort).toUpperCase() : "", fast === true ? "FAST" : ""].filter(Boolean);
|
|
4130
|
-
const modelBits = [display, ...flags].join(` ${SUBTLE}\xB7${
|
|
4238
|
+
const modelBits = [display, ...flags].join(` ${SUBTLE}\xB7${RESET3} `);
|
|
4131
4239
|
const ctxPct = localContextPct({
|
|
4132
4240
|
provider,
|
|
4133
4241
|
stats,
|
|
@@ -4137,13 +4245,13 @@ function localBootStatusLine(args = {}) {
|
|
|
4137
4245
|
compactBoundaryTokens,
|
|
4138
4246
|
autoCompactTokenLimit
|
|
4139
4247
|
});
|
|
4140
|
-
const l1 = `${STATUS}${modelBits}${
|
|
4248
|
+
const l1 = `${STATUS}${modelBits}${RESET3} ${SUBTLE}\u2502${RESET3} ${localContextSegmentFromPct(ctxPct)}`;
|
|
4141
4249
|
const l2 = localStatusLineL2(args);
|
|
4142
4250
|
return l2 ? `${l1}
|
|
4143
4251
|
${l2}` : l1;
|
|
4144
4252
|
}
|
|
4145
4253
|
function normalizeStatusLine(text) {
|
|
4146
|
-
return normalizeStatuslineAnsi(text, statusColors(), { reset:
|
|
4254
|
+
return normalizeStatuslineAnsi(text, statusColors(), { reset: RESET3 });
|
|
4147
4255
|
}
|
|
4148
4256
|
function workflowModeLabel(workflow = {}, remoteEnabled = false) {
|
|
4149
4257
|
const name = String(workflow?.name || workflow?.id || "Default").trim() || "Default";
|
|
@@ -4261,7 +4369,7 @@ function StatusLineView({ sessionId, clientHostPid, provider, model, effort, fas
|
|
|
4261
4369
|
const freshL2 = localStatusLineL2(args, now);
|
|
4262
4370
|
const shellSegments = extractCachedShellSegments(cachedL2, now, lastRawFullLineAtRef.current);
|
|
4263
4371
|
const { SUBTLE } = statusColors();
|
|
4264
|
-
const localSegSep = ` ${SUBTLE}\u2502${
|
|
4372
|
+
const localSegSep = ` ${SUBTLE}\u2502${RESET3} `;
|
|
4265
4373
|
const grafted = [freshL2, ...shellSegments].filter(Boolean).join(localSegSep);
|
|
4266
4374
|
localNext = grafted ? `${cachedL1}
|
|
4267
4375
|
${grafted}` : cachedL1;
|
|
@@ -4363,11 +4471,11 @@ function isProblemCodePoint(cp) {
|
|
|
4363
4471
|
return cp >= 9312 && cp <= 9471 || cp >= 8596 && cp <= 8703 && cp !== 8635;
|
|
4364
4472
|
}
|
|
4365
4473
|
var PROBLEM_RE = /[\u2194-\u21ff\u2460-\u24ff]/;
|
|
4366
|
-
function resolveAmbiguousWidePolicy(
|
|
4367
|
-
const override =
|
|
4474
|
+
function resolveAmbiguousWidePolicy(env2 = process.env, platform2 = process.platform) {
|
|
4475
|
+
const override = env2?.MIXDOG_TUI_AMBIGUOUS_WIDE;
|
|
4368
4476
|
if (override === "1") return true;
|
|
4369
4477
|
if (override === "0") return false;
|
|
4370
|
-
return
|
|
4478
|
+
return platform2 === "win32" || Boolean(env2?.WT_SESSION);
|
|
4371
4479
|
}
|
|
4372
4480
|
var AMBIGUOUS_WIDE = resolveAmbiguousWidePolicy();
|
|
4373
4481
|
function displayWidthWith(str, wide) {
|
|
@@ -7020,7 +7128,7 @@ import { randomBytes } from "node:crypto";
|
|
|
7020
7128
|
import { existsSync as existsSync2, unlinkSync } from "node:fs";
|
|
7021
7129
|
import { readFile as readFileAsync, stat as statAsync } from "node:fs/promises";
|
|
7022
7130
|
import { tmpdir } from "node:os";
|
|
7023
|
-
import { basename, extname, isAbsolute, resolve } from "node:path";
|
|
7131
|
+
import { basename as basename2, extname, isAbsolute, resolve } from "node:path";
|
|
7024
7132
|
|
|
7025
7133
|
// src/runtime/agent/orchestrator/tools/builtin/read-image-resize.mjs
|
|
7026
7134
|
var API_IMAGE_MAX_BASE64_SIZE = 5 * 1024 * 1024;
|
|
@@ -7176,8 +7284,8 @@ function execFileBuffer(cmd, args, options = {}) {
|
|
|
7176
7284
|
maxBuffer: 16 * 1024 * 1024,
|
|
7177
7285
|
timeout: 5e3,
|
|
7178
7286
|
...options
|
|
7179
|
-
}, (error,
|
|
7180
|
-
resolve5({ ok: !error, code: error?.code ?? 0, stdout, stderr, error });
|
|
7287
|
+
}, (error, stdout2, stderr) => {
|
|
7288
|
+
resolve5({ ok: !error, code: error?.code ?? 0, stdout: stdout2, stderr, error });
|
|
7181
7289
|
});
|
|
7182
7290
|
});
|
|
7183
7291
|
}
|
|
@@ -7288,7 +7396,7 @@ async function readImageAttachmentFromPath(rawPath, cwd = process.cwd()) {
|
|
|
7288
7396
|
if (!st.isFile()) return null;
|
|
7289
7397
|
const buffer = await readFileAsync(fullPath);
|
|
7290
7398
|
return imageAttachmentFromBuffer(buffer, mimeType, {
|
|
7291
|
-
filename:
|
|
7399
|
+
filename: basename2(fullPath),
|
|
7292
7400
|
sourcePath: fullPath
|
|
7293
7401
|
});
|
|
7294
7402
|
}
|
|
@@ -7359,7 +7467,7 @@ async function readClipboardText() {
|
|
|
7359
7467
|
// src/standalone/projects.mjs
|
|
7360
7468
|
import { homedir as homedir2 } from "node:os";
|
|
7361
7469
|
import { existsSync as existsSync3, mkdirSync as mkdirSync2, readFileSync as readFileSync2, renameSync, statSync, writeFileSync as writeFileSync2 } from "node:fs";
|
|
7362
|
-
import { basename as
|
|
7470
|
+
import { basename as basename3, dirname as dirname3, isAbsolute as isAbsolute2, join as join3, resolve as resolve2 } from "node:path";
|
|
7363
7471
|
var MIXDOG_HOME = process.env.MIXDOG_HOME || join3(homedir2(), ".mixdog");
|
|
7364
7472
|
var PROJECTS_FILE = join3(MIXDOG_HOME, "projects.json");
|
|
7365
7473
|
function toAbsolute(rawPath) {
|
|
@@ -7379,7 +7487,7 @@ function readStore() {
|
|
|
7379
7487
|
const projects = Array.isArray(parsed?.projects) ? parsed.projects : [];
|
|
7380
7488
|
return {
|
|
7381
7489
|
projects: projects.filter((entry) => entry && typeof entry.path === "string" && entry.path.trim()).map((entry) => ({
|
|
7382
|
-
name: String(entry.name ||
|
|
7490
|
+
name: String(entry.name || basename3(entry.path) || entry.path),
|
|
7383
7491
|
path: String(entry.path),
|
|
7384
7492
|
addedAt: Number(entry.addedAt) || 0,
|
|
7385
7493
|
...Number(entry.lastSelectedAt) > 0 ? { lastSelectedAt: Number(entry.lastSelectedAt) } : {}
|
|
@@ -7409,7 +7517,7 @@ function ensureProjectIdMarker(absPath, name) {
|
|
|
7409
7517
|
}
|
|
7410
7518
|
const markerPath = join3(absPath, ".mixdog", "project.id");
|
|
7411
7519
|
if (existsSync3(markerPath)) return;
|
|
7412
|
-
const value = String(name ||
|
|
7520
|
+
const value = String(name || basename3(absPath) || "").trim();
|
|
7413
7521
|
if (!value || value.toLowerCase() === "common") return;
|
|
7414
7522
|
const markerDir = join3(absPath, ".mixdog");
|
|
7415
7523
|
mkdirSync2(markerDir, { recursive: true });
|
|
@@ -7447,7 +7555,7 @@ function addProject(rawPath) {
|
|
|
7447
7555
|
return existing;
|
|
7448
7556
|
}
|
|
7449
7557
|
const entry = {
|
|
7450
|
-
name:
|
|
7558
|
+
name: basename3(absPath) || absPath,
|
|
7451
7559
|
path: absPath,
|
|
7452
7560
|
addedAt: Date.now()
|
|
7453
7561
|
};
|
|
@@ -7476,7 +7584,7 @@ function renameProject(rawPath, nextName) {
|
|
|
7476
7584
|
const entry = store.projects.find((item) => normalizeKey(item.path) === key);
|
|
7477
7585
|
if (!entry) return null;
|
|
7478
7586
|
const trimmed = String(nextName || "").trim();
|
|
7479
|
-
entry.name = trimmed ||
|
|
7587
|
+
entry.name = trimmed || basename3(absPath) || absPath;
|
|
7480
7588
|
writeStore(store);
|
|
7481
7589
|
return entry;
|
|
7482
7590
|
}
|
|
@@ -7520,7 +7628,7 @@ function runCapture(cmd, args, { timeoutMs = DIALOG_TIMEOUT_MS } = {}) {
|
|
|
7520
7628
|
resolve5({ ok: false, code: -1, stdout: "", error });
|
|
7521
7629
|
return;
|
|
7522
7630
|
}
|
|
7523
|
-
let
|
|
7631
|
+
let stdout2 = "";
|
|
7524
7632
|
let settled = false;
|
|
7525
7633
|
const timer2 = setTimeout(() => {
|
|
7526
7634
|
if (settled) return;
|
|
@@ -7533,7 +7641,7 @@ function runCapture(cmd, args, { timeoutMs = DIALOG_TIMEOUT_MS } = {}) {
|
|
|
7533
7641
|
}, timeoutMs);
|
|
7534
7642
|
timer2.unref?.();
|
|
7535
7643
|
child.stdout.on("data", (chunk) => {
|
|
7536
|
-
|
|
7644
|
+
stdout2 += chunk.toString("utf8");
|
|
7537
7645
|
});
|
|
7538
7646
|
child.on("error", (error) => {
|
|
7539
7647
|
if (settled) return;
|
|
@@ -7545,7 +7653,7 @@ function runCapture(cmd, args, { timeoutMs = DIALOG_TIMEOUT_MS } = {}) {
|
|
|
7545
7653
|
if (settled) return;
|
|
7546
7654
|
settled = true;
|
|
7547
7655
|
clearTimeout(timer2);
|
|
7548
|
-
resolve5({ ok: code === 0, code, stdout });
|
|
7656
|
+
resolve5({ ok: code === 0, code, stdout: stdout2 });
|
|
7549
7657
|
});
|
|
7550
7658
|
});
|
|
7551
7659
|
}
|
|
@@ -7747,8 +7855,8 @@ namespace Mixdog {
|
|
|
7747
7855
|
].join("\n");
|
|
7748
7856
|
}
|
|
7749
7857
|
async function pickFolder({ title = "Select a project folder", initialPath = "" } = {}) {
|
|
7750
|
-
const
|
|
7751
|
-
if (
|
|
7858
|
+
const platform2 = process.platform;
|
|
7859
|
+
if (platform2 === "win32") {
|
|
7752
7860
|
const resolvedInitial = resolveInitialPath(initialPath);
|
|
7753
7861
|
const result = await runCapture("powershell.exe", [
|
|
7754
7862
|
"-NoLogo",
|
|
@@ -7763,7 +7871,7 @@ async function pickFolder({ title = "Select a project folder", initialPath = ""
|
|
|
7763
7871
|
if (!result.ok && !path2) return { available: false, path: null };
|
|
7764
7872
|
return { available: true, path: path2 || null };
|
|
7765
7873
|
}
|
|
7766
|
-
if (
|
|
7874
|
+
if (platform2 === "darwin") {
|
|
7767
7875
|
const safeTitle = String(title).replace(/"/g, '\\"');
|
|
7768
7876
|
const script = `set f to choose folder with prompt "${safeTitle}"
|
|
7769
7877
|
POSIX path of f`;
|
|
@@ -9185,6 +9293,7 @@ function renderTokenAnsiSegments(content, opts = {}) {
|
|
|
9185
9293
|
// src/tui/markdown/streaming-markdown.mjs
|
|
9186
9294
|
import { marked as marked2 } from "marked";
|
|
9187
9295
|
var stablePrefixByStreamKey = /* @__PURE__ */ new Map();
|
|
9296
|
+
var resolvedPartsByStreamKey = /* @__PURE__ */ new Map();
|
|
9188
9297
|
var STABLE_PREFIX_LRU_MAX = 32;
|
|
9189
9298
|
function streamingLayoutText(text) {
|
|
9190
9299
|
return String(text ?? "").replace(/^\n+|\n+$/g, "");
|
|
@@ -9209,6 +9318,23 @@ function getStablePrefixKey(key) {
|
|
|
9209
9318
|
stablePrefixByStreamKey.set(key, value);
|
|
9210
9319
|
return value;
|
|
9211
9320
|
}
|
|
9321
|
+
function getResolvedPartsKey(key, text) {
|
|
9322
|
+
if (!key) return null;
|
|
9323
|
+
const entry = resolvedPartsByStreamKey.get(key);
|
|
9324
|
+
if (!entry || entry.text !== text) return null;
|
|
9325
|
+
return entry.parts;
|
|
9326
|
+
}
|
|
9327
|
+
function cacheResolvedPartsKey(key, text, parts) {
|
|
9328
|
+
if (!key) return parts;
|
|
9329
|
+
if (resolvedPartsByStreamKey.has(key)) resolvedPartsByStreamKey.delete(key);
|
|
9330
|
+
resolvedPartsByStreamKey.set(key, { text, parts });
|
|
9331
|
+
while (resolvedPartsByStreamKey.size > STABLE_PREFIX_LRU_MAX) {
|
|
9332
|
+
const oldest = resolvedPartsByStreamKey.keys().next().value;
|
|
9333
|
+
if (oldest === void 0) break;
|
|
9334
|
+
resolvedPartsByStreamKey.delete(oldest);
|
|
9335
|
+
}
|
|
9336
|
+
return parts;
|
|
9337
|
+
}
|
|
9212
9338
|
function hasOpenFence(text) {
|
|
9213
9339
|
let ticks = 0;
|
|
9214
9340
|
let tildes = 0;
|
|
@@ -9261,31 +9387,36 @@ function balanceStreamingMarkdown(text) {
|
|
|
9261
9387
|
}
|
|
9262
9388
|
function resetStreamingMarkdownStablePrefix(streamKey) {
|
|
9263
9389
|
if (streamKey == null || streamKey === "") return;
|
|
9264
|
-
|
|
9390
|
+
const key = String(streamKey);
|
|
9391
|
+
stablePrefixByStreamKey.delete(key);
|
|
9392
|
+
resolvedPartsByStreamKey.delete(key);
|
|
9265
9393
|
}
|
|
9266
9394
|
function resetAllStreamingMarkdownStablePrefixes() {
|
|
9267
9395
|
stablePrefixByStreamKey.clear();
|
|
9396
|
+
resolvedPartsByStreamKey.clear();
|
|
9268
9397
|
}
|
|
9269
9398
|
function resolveStreamingMarkdownParts(text, streamKey) {
|
|
9270
9399
|
const t = streamingLayoutText(text);
|
|
9271
9400
|
const key = streamKey == null || streamKey === "" ? null : String(streamKey);
|
|
9401
|
+
const cachedParts = getResolvedPartsKey(key, t);
|
|
9402
|
+
if (cachedParts) return cachedParts;
|
|
9272
9403
|
if (!t) {
|
|
9273
9404
|
if (key) stablePrefixByStreamKey.delete(key);
|
|
9274
|
-
return {
|
|
9405
|
+
return cacheResolvedPartsKey(key, t, {
|
|
9275
9406
|
plain: true,
|
|
9276
9407
|
stablePrefix: "",
|
|
9277
9408
|
unstableSuffix: "",
|
|
9278
9409
|
unstableForRender: ""
|
|
9279
|
-
};
|
|
9410
|
+
});
|
|
9280
9411
|
}
|
|
9281
9412
|
if (!hasMarkdownSyntax(t)) {
|
|
9282
9413
|
if (key) stablePrefixByStreamKey.delete(key);
|
|
9283
|
-
return {
|
|
9414
|
+
return cacheResolvedPartsKey(key, t, {
|
|
9284
9415
|
plain: true,
|
|
9285
9416
|
stablePrefix: "",
|
|
9286
9417
|
unstableSuffix: t,
|
|
9287
9418
|
unstableForRender: t
|
|
9288
|
-
};
|
|
9419
|
+
});
|
|
9289
9420
|
}
|
|
9290
9421
|
let stablePrefix = key ? getStablePrefixKey(key) : "";
|
|
9291
9422
|
if (!t.startsWith(stablePrefix)) {
|
|
@@ -9298,13 +9429,13 @@ function resolveStreamingMarkdownParts(text, streamKey) {
|
|
|
9298
9429
|
if (key && openPrefix) touchStablePrefixKey(key, openPrefix);
|
|
9299
9430
|
else if (key) stablePrefixByStreamKey.delete(key);
|
|
9300
9431
|
const unstableSuffix2 = t.substring(openPrefix.length);
|
|
9301
|
-
return {
|
|
9432
|
+
return cacheResolvedPartsKey(key, t, {
|
|
9302
9433
|
plain: false,
|
|
9303
9434
|
openFence: true,
|
|
9304
9435
|
stablePrefix: openPrefix,
|
|
9305
9436
|
unstableSuffix: unstableSuffix2,
|
|
9306
9437
|
unstableForRender: unstableSuffix2
|
|
9307
|
-
};
|
|
9438
|
+
});
|
|
9308
9439
|
}
|
|
9309
9440
|
try {
|
|
9310
9441
|
configureMarked();
|
|
@@ -9333,12 +9464,12 @@ function resolveStreamingMarkdownParts(text, streamKey) {
|
|
|
9333
9464
|
}
|
|
9334
9465
|
if (isWhitespaceOnlyText(stablePrefix)) stablePrefix = "";
|
|
9335
9466
|
const unstableSuffix = t.substring(stablePrefix.length);
|
|
9336
|
-
return {
|
|
9467
|
+
return cacheResolvedPartsKey(key, t, {
|
|
9337
9468
|
plain: false,
|
|
9338
9469
|
stablePrefix,
|
|
9339
9470
|
unstableSuffix,
|
|
9340
9471
|
unstableForRender: balanceStreamingMarkdown(unstableSuffix)
|
|
9341
|
-
};
|
|
9472
|
+
});
|
|
9342
9473
|
}
|
|
9343
9474
|
|
|
9344
9475
|
// src/tui/markdown/measure-rendered-rows.mjs
|
|
@@ -10705,7 +10836,7 @@ function useMouseInput({
|
|
|
10705
10836
|
inkInput,
|
|
10706
10837
|
isRawModeSupported,
|
|
10707
10838
|
store,
|
|
10708
|
-
stdout,
|
|
10839
|
+
stdout: stdout2,
|
|
10709
10840
|
rows,
|
|
10710
10841
|
statuslineBandRows,
|
|
10711
10842
|
dragRef,
|
|
@@ -10731,16 +10862,16 @@ function useMouseInput({
|
|
|
10731
10862
|
const zoomTimerRef = useRef7(null);
|
|
10732
10863
|
const edgeAutoscrollRef = useRef7({ dir: 0, timer: null, noMove: 0 });
|
|
10733
10864
|
const passthroughCtrlWheelZoom = useCallback2(() => {
|
|
10734
|
-
if (!
|
|
10865
|
+
if (!stdout2?.write) return;
|
|
10735
10866
|
try {
|
|
10736
|
-
|
|
10867
|
+
stdout2.write(MOUSE_TRACKING_OFF + ALT_SCROLL_OFF);
|
|
10737
10868
|
} catch {
|
|
10738
10869
|
return;
|
|
10739
10870
|
}
|
|
10740
10871
|
const restore = (attempt) => {
|
|
10741
10872
|
zoomTimerRef.current = null;
|
|
10742
10873
|
try {
|
|
10743
|
-
|
|
10874
|
+
stdout2.write(MOUSE_TRACKING_ON + ALT_SCROLL_OFF);
|
|
10744
10875
|
} catch {
|
|
10745
10876
|
if (attempt < 5) {
|
|
10746
10877
|
zoomTimerRef.current = setTimeout(() => restore(attempt + 1), 200);
|
|
@@ -10751,7 +10882,7 @@ function useMouseInput({
|
|
|
10751
10882
|
if (zoomTimerRef.current) clearTimeout(zoomTimerRef.current);
|
|
10752
10883
|
zoomTimerRef.current = setTimeout(() => restore(0), 700);
|
|
10753
10884
|
zoomTimerRef.current.unref?.();
|
|
10754
|
-
}, [
|
|
10885
|
+
}, [stdout2, zoomTimerRef]);
|
|
10755
10886
|
useEffect7(() => () => {
|
|
10756
10887
|
if (zoomTimerRef.current) clearTimeout(zoomTimerRef.current);
|
|
10757
10888
|
}, [zoomTimerRef]);
|
|
@@ -11816,7 +11947,11 @@ function useTranscriptWindow({
|
|
|
11816
11947
|
floatingPanelRows: Number(floatingPanelRows) || 0
|
|
11817
11948
|
};
|
|
11818
11949
|
if (scrolledUp && !followingRef.current) {
|
|
11819
|
-
const growth = streamingTailMountedGrowth(
|
|
11950
|
+
const growth = streamingTailMountedGrowth(
|
|
11951
|
+
streamingTailItem ? [streamingTailItem] : transcriptItems,
|
|
11952
|
+
frameColumns,
|
|
11953
|
+
toolOutputExpanded
|
|
11954
|
+
);
|
|
11820
11955
|
if (growth && growth.delta > 0) {
|
|
11821
11956
|
const maxOffsetKeepingTailMounted = growth.tailRows + TRANSCRIPT_WINDOW_OVERSCAN_ROWS - 1;
|
|
11822
11957
|
if (renderScrollOffset <= maxOffsetKeepingTailMounted) {
|
|
@@ -12104,9 +12239,9 @@ function useTranscriptWindow({
|
|
|
12104
12239
|
import stringWidth8 from "string-width";
|
|
12105
12240
|
var SEARCH_DEFAULT_ROUTE = Object.freeze({ provider: "default", model: "default" });
|
|
12106
12241
|
var isSearchDefaultRoute = (route) => String(route?.provider || "").toLowerCase() === "default" && String(route?.model || "").toLowerCase() === "default";
|
|
12107
|
-
function terminalSize(
|
|
12108
|
-
const columns =
|
|
12109
|
-
const rows =
|
|
12242
|
+
function terminalSize(stdout2) {
|
|
12243
|
+
const columns = stdout2?.columns;
|
|
12244
|
+
const rows = stdout2?.rows;
|
|
12110
12245
|
if (columns && rows) return { columns, rows };
|
|
12111
12246
|
return {
|
|
12112
12247
|
columns: columns || 80,
|
|
@@ -14252,7 +14387,7 @@ import {
|
|
|
14252
14387
|
unlinkSync as unlinkSync2,
|
|
14253
14388
|
writeFileSync as writeFileSync3
|
|
14254
14389
|
} from "fs";
|
|
14255
|
-
import { dirname as dirname4, basename as
|
|
14390
|
+
import { dirname as dirname4, basename as basename4, join as join4 } from "path";
|
|
14256
14391
|
import { randomBytes as randomBytes2 } from "crypto";
|
|
14257
14392
|
import { execFile as execFile2, execFileSync } from "child_process";
|
|
14258
14393
|
import { promisify } from "util";
|
|
@@ -14664,11 +14799,11 @@ async function _resolveCurrentUserPrincipalAsync() {
|
|
|
14664
14799
|
const whoami = join4(systemRoot, "System32", "whoami.exe");
|
|
14665
14800
|
if (existsSync4(whoami)) {
|
|
14666
14801
|
try {
|
|
14667
|
-
const { stdout } = await _execFileAsync(whoami, ["/user", "/fo", "csv", "/nh"], {
|
|
14802
|
+
const { stdout: stdout2 } = await _execFileAsync(whoami, ["/user", "/fo", "csv", "/nh"], {
|
|
14668
14803
|
encoding: "utf8",
|
|
14669
14804
|
windowsHide: true
|
|
14670
14805
|
});
|
|
14671
|
-
const m = String(
|
|
14806
|
+
const m = String(stdout2).match(/S-1-5-[0-9-]+/);
|
|
14672
14807
|
if (m) return m[0];
|
|
14673
14808
|
} catch {
|
|
14674
14809
|
}
|
|
@@ -14708,7 +14843,7 @@ function writeFileAtomicSync(filePath, data, opts = {}) {
|
|
|
14708
14843
|
const run = () => {
|
|
14709
14844
|
const dir = dirname4(filePath);
|
|
14710
14845
|
mkdirSync3(dir, { recursive: true });
|
|
14711
|
-
const tmp = join4(dir, `.${
|
|
14846
|
+
const tmp = join4(dir, `.${basename4(filePath)}.${randomBytes2(12).toString("hex")}.tmp`);
|
|
14712
14847
|
try {
|
|
14713
14848
|
const writeOpts = { encoding: opts.encoding || "utf8", flag: "wx", mode: opts.mode !== void 0 ? opts.mode : 384 };
|
|
14714
14849
|
writeFileSync3(tmp, data, writeOpts);
|
|
@@ -16109,6 +16244,7 @@ function createProviderSetupPicker({
|
|
|
16109
16244
|
setContextPanel(null);
|
|
16110
16245
|
closeUsagePanel();
|
|
16111
16246
|
let setup = options.preloadedSetup && typeof options.preloadedSetup === "object" ? options.preloadedSetup : null;
|
|
16247
|
+
options.preloadedSetup = null;
|
|
16112
16248
|
if (!setup) {
|
|
16113
16249
|
setPicker({
|
|
16114
16250
|
title: options.title || "Providers",
|
|
@@ -19385,15 +19521,14 @@ function App({ store, initialStatusLine = "", forceOnboarding = false }) {
|
|
|
19385
19521
|
const [onboardingActive, setOnboardingActive] = useState8(false);
|
|
19386
19522
|
const { exit } = useApp();
|
|
19387
19523
|
const { isRawModeSupported, stdin, internal_eventEmitter: inkInput } = useStdin3();
|
|
19388
|
-
const { stdout } = useStdout2();
|
|
19524
|
+
const { stdout: stdout2 } = useStdout2();
|
|
19389
19525
|
const [exiting, setExiting] = useState8(false);
|
|
19390
19526
|
const [tuiReady, setTuiReady] = useState8(false);
|
|
19391
19527
|
const exitRequestedRef = useRef10(false);
|
|
19392
|
-
const [resizeState, setResizeState] = useState8(() => ({ ...terminalSize(
|
|
19528
|
+
const [resizeState, setResizeState] = useState8(() => ({ ...terminalSize(stdout2), epoch: 0 }));
|
|
19393
19529
|
const [panelTransitionEpoch, setPanelTransitionEpoch] = useState8(0);
|
|
19394
19530
|
const [panelInkMaskEpoch, setPanelInkMaskEpoch] = useState8(0);
|
|
19395
|
-
const
|
|
19396
|
-
const rightSafetyColumns = windowsLikeTerminal ? 1 : 0;
|
|
19531
|
+
const rightSafetyColumns = 1;
|
|
19397
19532
|
const frameColumns = Math.max(1, resizeState.columns - rightSafetyColumns);
|
|
19398
19533
|
const [scrollOffset, setScrollOffset] = useState8(0);
|
|
19399
19534
|
const scrollPositionRef = useRef10(0);
|
|
@@ -19904,13 +20039,13 @@ function App({ store, initialStatusLine = "", forceOnboarding = false }) {
|
|
|
19904
20039
|
return () => clearTimeout(timer2);
|
|
19905
20040
|
}, []);
|
|
19906
20041
|
useEffect10(() => {
|
|
19907
|
-
if (!
|
|
20042
|
+
if (!stdout2) return void 0;
|
|
19908
20043
|
let trailing = null;
|
|
19909
20044
|
const DEBOUNCE_MS = 80;
|
|
19910
20045
|
let lastRun = 0;
|
|
19911
20046
|
const update = () => {
|
|
19912
20047
|
setResizeState((prev) => {
|
|
19913
|
-
const next = terminalSize(
|
|
20048
|
+
const next = terminalSize(stdout2);
|
|
19914
20049
|
if (next.columns === prev.columns && next.rows === prev.rows) return prev;
|
|
19915
20050
|
return {
|
|
19916
20051
|
...next,
|
|
@@ -19931,13 +20066,13 @@ function App({ store, initialStatusLine = "", forceOnboarding = false }) {
|
|
|
19931
20066
|
update();
|
|
19932
20067
|
}, DEBOUNCE_MS);
|
|
19933
20068
|
};
|
|
19934
|
-
|
|
20069
|
+
stdout2.on("resize", onResize);
|
|
19935
20070
|
update();
|
|
19936
20071
|
return () => {
|
|
19937
20072
|
if (trailing) clearTimeout(trailing);
|
|
19938
|
-
|
|
20073
|
+
stdout2.off("resize", onResize);
|
|
19939
20074
|
};
|
|
19940
|
-
}, [
|
|
20075
|
+
}, [stdout2]);
|
|
19941
20076
|
const clearPromptHint = useCallback6(() => {
|
|
19942
20077
|
if (!promptHintActiveRef.current && !promptHintTimerRef.current) return;
|
|
19943
20078
|
if (promptHintTimerRef.current) {
|
|
@@ -20099,7 +20234,7 @@ function App({ store, initialStatusLine = "", forceOnboarding = false }) {
|
|
|
20099
20234
|
inkInput,
|
|
20100
20235
|
isRawModeSupported,
|
|
20101
20236
|
store,
|
|
20102
|
-
stdout,
|
|
20237
|
+
stdout: stdout2,
|
|
20103
20238
|
rows: resizeState.rows,
|
|
20104
20239
|
statuslineBandRows: STATUSLINE_BAND_ROWS,
|
|
20105
20240
|
dragRef,
|
|
@@ -20123,10 +20258,10 @@ function App({ store, initialStatusLine = "", forceOnboarding = false }) {
|
|
|
20123
20258
|
clearStitchBuffer
|
|
20124
20259
|
});
|
|
20125
20260
|
useEffect10(() => {
|
|
20126
|
-
if (!isRawModeSupported || !
|
|
20261
|
+
if (!isRawModeSupported || !stdout2?.write) return;
|
|
20127
20262
|
if (!supportsExtendedKeys()) return;
|
|
20128
20263
|
try {
|
|
20129
|
-
|
|
20264
|
+
stdout2.write(ENABLE_KITTY_KEYBOARD + ENABLE_MODIFY_OTHER_KEYS);
|
|
20130
20265
|
} catch {
|
|
20131
20266
|
}
|
|
20132
20267
|
}, []);
|
|
@@ -25407,7 +25542,7 @@ function createRunTurn(bag) {
|
|
|
25407
25542
|
markPromptCommitted();
|
|
25408
25543
|
if (result?.terminationReason === "refusal") {
|
|
25409
25544
|
pushNotice(
|
|
25410
|
-
"
|
|
25545
|
+
"The model refused to respond (safety refusal) \u2014 retry or rephrase your prompt.",
|
|
25411
25546
|
"warn",
|
|
25412
25547
|
{ transcript: true }
|
|
25413
25548
|
);
|
|
@@ -27709,7 +27844,7 @@ function resolveTuiStderrLogPath() {
|
|
|
27709
27844
|
}
|
|
27710
27845
|
function ansiFg(rgb) {
|
|
27711
27846
|
const m = /rgb\((\d+),\s*(\d+),\s*(\d+)\)/.exec(String(rgb || ""));
|
|
27712
|
-
return m ?
|
|
27847
|
+
return m ? rgbSgr(m[1], m[2], m[3]) : "";
|
|
27713
27848
|
}
|
|
27714
27849
|
function paintBootSplash() {
|
|
27715
27850
|
try {
|
|
@@ -27728,12 +27863,12 @@ function paintBootSplash() {
|
|
|
27728
27863
|
const textFg = ansiFg(theme.text);
|
|
27729
27864
|
const logoFg = ansiFg(theme.logo ?? theme.claude) || textFg;
|
|
27730
27865
|
const subtleFg = ansiFg(theme.inactive);
|
|
27731
|
-
const
|
|
27866
|
+
const bold2 = "\x1B[1m";
|
|
27732
27867
|
const reset = "\x1B[0m";
|
|
27733
27868
|
let out = "\x1B[4;1H";
|
|
27734
27869
|
for (let i = 0; i < logo.length; i++) {
|
|
27735
27870
|
const fg = i < 2 ? textFg : logoFg;
|
|
27736
|
-
out += `${
|
|
27871
|
+
out += `${bold2}${fg}${center(logo[i])}${reset}\r
|
|
27737
27872
|
`;
|
|
27738
27873
|
}
|
|
27739
27874
|
out += "\r\n";
|