@atlasharness/atlascode 0.1.104 → 0.1.105
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cli.js +819 -593
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -166,7 +166,8 @@ var ON_BY_DEFAULT, FEATURE_ON_BY_DEFAULT;
|
|
|
166
166
|
var init_feature = __esm(() => {
|
|
167
167
|
ON_BY_DEFAULT = new Set([
|
|
168
168
|
"TRANSCRIPT_CLASSIFIER",
|
|
169
|
-
"COORDINATOR_MODE"
|
|
169
|
+
"COORDINATOR_MODE",
|
|
170
|
+
"AUTO_THEME"
|
|
170
171
|
]);
|
|
171
172
|
FEATURE_ON_BY_DEFAULT = [...ON_BY_DEFAULT];
|
|
172
173
|
});
|
|
@@ -69952,6 +69953,7 @@ var init_webFetchTool = __esm(() => {
|
|
|
69952
69953
|
searchHint: "fetch and extract content from a URL",
|
|
69953
69954
|
maxResultSizeChars: 1e5,
|
|
69954
69955
|
shouldDefer: true,
|
|
69956
|
+
timeoutMs: 90000,
|
|
69955
69957
|
strict: true,
|
|
69956
69958
|
isEnabled: () => true,
|
|
69957
69959
|
isConcurrencySafe: () => true,
|
|
@@ -70359,6 +70361,7 @@ var init_webSearchTool = __esm(() => {
|
|
|
70359
70361
|
searchHint: "search the web for current information",
|
|
70360
70362
|
maxResultSizeChars: 1e5,
|
|
70361
70363
|
shouldDefer: true,
|
|
70364
|
+
timeoutMs: 30000,
|
|
70362
70365
|
strict: true,
|
|
70363
70366
|
isEnabled: () => {
|
|
70364
70367
|
return true;
|
|
@@ -84213,6 +84216,58 @@ async function runWithToolHeartbeat(opts, fn) {
|
|
|
84213
84216
|
}
|
|
84214
84217
|
var DEFAULT_TOOL_HEARTBEAT_INTERVAL_MS = 30000, MIN_TOOL_HEARTBEAT_INTERVAL_MS = 100;
|
|
84215
84218
|
|
|
84219
|
+
// src/engine/pipeline/toolTimeout.ts
|
|
84220
|
+
function createToolTimeoutGuard(opts) {
|
|
84221
|
+
const controller = new AbortController;
|
|
84222
|
+
const signal = opts.outerSignal ? AbortSignal.any([opts.outerSignal, controller.signal]) : controller.signal;
|
|
84223
|
+
const whenAborted = new Promise((resolve) => {
|
|
84224
|
+
controller.signal.addEventListener("abort", () => {
|
|
84225
|
+
if (controller.signal.reason === TOOL_TIMEOUT_ABORT_REASON)
|
|
84226
|
+
resolve();
|
|
84227
|
+
});
|
|
84228
|
+
});
|
|
84229
|
+
const timer = setTimeout(() => {
|
|
84230
|
+
controller.abort(TOOL_TIMEOUT_ABORT_REASON);
|
|
84231
|
+
}, opts.timeoutMs);
|
|
84232
|
+
const unref = timer.unref;
|
|
84233
|
+
unref?.call(timer);
|
|
84234
|
+
let armed = true;
|
|
84235
|
+
const clearTimer = () => {
|
|
84236
|
+
if (armed) {
|
|
84237
|
+
clearTimeout(timer);
|
|
84238
|
+
armed = false;
|
|
84239
|
+
}
|
|
84240
|
+
};
|
|
84241
|
+
return {
|
|
84242
|
+
signal,
|
|
84243
|
+
whenAborted,
|
|
84244
|
+
disarm: clearTimer,
|
|
84245
|
+
isTimeoutAbort() {
|
|
84246
|
+
return controller.signal.aborted && controller.signal.reason === TOOL_TIMEOUT_ABORT_REASON;
|
|
84247
|
+
},
|
|
84248
|
+
dispose: clearTimer
|
|
84249
|
+
};
|
|
84250
|
+
}
|
|
84251
|
+
async function raceWithToolDeadline(guard, onDeadline, pending) {
|
|
84252
|
+
pending.catch(() => {});
|
|
84253
|
+
return Promise.race([
|
|
84254
|
+
pending,
|
|
84255
|
+
guard.whenAborted.then(() => {
|
|
84256
|
+
throw onDeadline();
|
|
84257
|
+
})
|
|
84258
|
+
]);
|
|
84259
|
+
}
|
|
84260
|
+
var TOOL_TIMEOUT_ABORT_REASON, ToolTimeoutError;
|
|
84261
|
+
var init_toolTimeout = __esm(() => {
|
|
84262
|
+
TOOL_TIMEOUT_ABORT_REASON = Symbol("atlas.toolTimeout");
|
|
84263
|
+
ToolTimeoutError = class ToolTimeoutError extends Error {
|
|
84264
|
+
constructor(toolName, timeoutMs) {
|
|
84265
|
+
super(`TOOL_TIMEOUT: ${toolName} exceeded its ${timeoutMs}ms execution budget and was aborted.`);
|
|
84266
|
+
this.name = "ToolTimeoutError";
|
|
84267
|
+
}
|
|
84268
|
+
};
|
|
84269
|
+
});
|
|
84270
|
+
|
|
84216
84271
|
// src/engine/pipeline/toolExecution.ts
|
|
84217
84272
|
function mergeHookPermission(hookBehavior, gate, hookReason, hookSource) {
|
|
84218
84273
|
if (hookBehavior === "defer") {
|
|
@@ -84371,6 +84426,9 @@ async function executeToolUse(tu, assistantMsg, deps) {
|
|
|
84371
84426
|
};
|
|
84372
84427
|
}
|
|
84373
84428
|
const callInput = verdict.updatedInput ?? effectiveInput;
|
|
84429
|
+
const toolTimeout = tool.timeoutMs !== undefined && tool.timeoutMs > 0 ? createToolTimeoutGuard({ timeoutMs: tool.timeoutMs, outerSignal: deps.signal }) : undefined;
|
|
84430
|
+
if (toolTimeout !== undefined)
|
|
84431
|
+
toolCallContext.signal = toolTimeout.signal;
|
|
84374
84432
|
let block;
|
|
84375
84433
|
let isError = false;
|
|
84376
84434
|
let toolUseResult;
|
|
@@ -84393,6 +84451,7 @@ async function executeToolUse(tu, assistantMsg, deps) {
|
|
|
84393
84451
|
onBackgrounded: deps.onMcpToolBackgrounded
|
|
84394
84452
|
}, withHeartbeat);
|
|
84395
84453
|
if (raced.backgrounded === true) {
|
|
84454
|
+
toolTimeout?.disarm();
|
|
84396
84455
|
const backgroundedContent = `[mcp tool ${tool.name} is still running after exceeding the auto-background threshold; ` + "it has been moved to the background and will keep running. " + "The result will be delivered later as a task notification — do not call this tool again for the same purpose.";
|
|
84397
84456
|
return {
|
|
84398
84457
|
block: {
|
|
@@ -84406,9 +84465,12 @@ async function executeToolUse(tu, assistantMsg, deps) {
|
|
|
84406
84465
|
};
|
|
84407
84466
|
}
|
|
84408
84467
|
res = raced.result;
|
|
84468
|
+
} else if (toolTimeout !== undefined) {
|
|
84469
|
+
res = await raceWithToolDeadline(toolTimeout, () => new ToolTimeoutError(tool.name, tool.timeoutMs ?? 0), withHeartbeat());
|
|
84409
84470
|
} else {
|
|
84410
84471
|
res = await withHeartbeat();
|
|
84411
84472
|
}
|
|
84473
|
+
toolTimeout?.dispose();
|
|
84412
84474
|
block = tool.mapToolResultToToolResultBlockParam(res.data, tu.id);
|
|
84413
84475
|
toolUseResult = res.data;
|
|
84414
84476
|
if (res.newMessages !== undefined && block.is_error !== true) {
|
|
@@ -84428,15 +84490,27 @@ async function executeToolUse(tu, assistantMsg, deps) {
|
|
|
84428
84490
|
}
|
|
84429
84491
|
}
|
|
84430
84492
|
} catch (error) {
|
|
84431
|
-
|
|
84432
|
-
|
|
84433
|
-
|
|
84434
|
-
|
|
84435
|
-
|
|
84436
|
-
|
|
84437
|
-
|
|
84438
|
-
|
|
84439
|
-
|
|
84493
|
+
if (toolTimeout !== undefined && toolTimeout.isTimeoutAbort()) {
|
|
84494
|
+
const timeoutText = `<tool_use_error>TOOL_TIMEOUT: ${tool.name} exceeded its ${tool.timeoutMs}ms execution budget and was aborted. ` + "The tool's own cleanup (subprocess kill / connection close) runs via its abort path. " + "You may retry with adjusted parameters (e.g. a shorter command or explicit timeout_ms for Bash) or a different approach.</tool_use_error>";
|
|
84495
|
+
block = {
|
|
84496
|
+
type: "tool_result",
|
|
84497
|
+
tool_use_id: tu.id,
|
|
84498
|
+
content: timeoutText,
|
|
84499
|
+
is_error: true
|
|
84500
|
+
};
|
|
84501
|
+
isError = true;
|
|
84502
|
+
toolUseResult = timeoutText;
|
|
84503
|
+
} else {
|
|
84504
|
+
const errorText = `tool error [${classifyToolError(error)}]: ${String(error?.message ?? error)}`;
|
|
84505
|
+
block = {
|
|
84506
|
+
type: "tool_result",
|
|
84507
|
+
tool_use_id: tu.id,
|
|
84508
|
+
content: `<tool_use_error>${errorText}</tool_use_error>`,
|
|
84509
|
+
is_error: true
|
|
84510
|
+
};
|
|
84511
|
+
isError = true;
|
|
84512
|
+
toolUseResult = errorText;
|
|
84513
|
+
}
|
|
84440
84514
|
}
|
|
84441
84515
|
const postOutcome = await deps.hooks?.postToolUse?.(tool, callInput, block, tu.id);
|
|
84442
84516
|
if (postOutcome?.updatedToolOutput !== undefined) {
|
|
@@ -84473,6 +84547,7 @@ async function executeToolUse(tu, assistantMsg, deps) {
|
|
|
84473
84547
|
}
|
|
84474
84548
|
var init_toolExecution = __esm(() => {
|
|
84475
84549
|
init_userMessage();
|
|
84550
|
+
init_toolTimeout();
|
|
84476
84551
|
});
|
|
84477
84552
|
|
|
84478
84553
|
// src/engine/pipeline/toolOrchestration.ts
|
|
@@ -140737,16 +140812,54 @@ var init_use_stdin = __esm(() => {
|
|
|
140737
140812
|
// src/tui/utils/systemTheme.ts
|
|
140738
140813
|
function getSystemThemeName() {
|
|
140739
140814
|
if (cachedSystemTheme === undefined) {
|
|
140740
|
-
cachedSystemTheme = detectFromColorFgBg() ?? "dark";
|
|
140815
|
+
cachedSystemTheme = detectFromColorFgBg() ?? cachedOsAppearance ?? "dark";
|
|
140741
140816
|
}
|
|
140742
140817
|
return cachedSystemTheme;
|
|
140743
140818
|
}
|
|
140819
|
+
function setCachedSystemTheme(theme) {
|
|
140820
|
+
cachedSystemTheme = theme;
|
|
140821
|
+
}
|
|
140822
|
+
function setCachedOsAppearance(theme) {
|
|
140823
|
+
cachedOsAppearance = theme;
|
|
140824
|
+
}
|
|
140744
140825
|
function resolveThemeSetting(setting) {
|
|
140745
140826
|
if (setting === "auto") {
|
|
140746
140827
|
return getSystemThemeName();
|
|
140747
140828
|
}
|
|
140748
140829
|
return setting;
|
|
140749
140830
|
}
|
|
140831
|
+
function themeFromOscColor(data) {
|
|
140832
|
+
const rgb = parseOscRgb(data);
|
|
140833
|
+
if (!rgb)
|
|
140834
|
+
return;
|
|
140835
|
+
const luminance = 0.2126 * rgb.r + 0.7152 * rgb.g + 0.0722 * rgb.b;
|
|
140836
|
+
return luminance > 0.5 ? "light" : "dark";
|
|
140837
|
+
}
|
|
140838
|
+
function parseOscRgb(data) {
|
|
140839
|
+
const rgbMatch = /^rgba?:([0-9a-f]{1,4})\/([0-9a-f]{1,4})\/([0-9a-f]{1,4})/i.exec(data);
|
|
140840
|
+
if (rgbMatch) {
|
|
140841
|
+
return {
|
|
140842
|
+
r: hexComponent(rgbMatch[1]),
|
|
140843
|
+
g: hexComponent(rgbMatch[2]),
|
|
140844
|
+
b: hexComponent(rgbMatch[3])
|
|
140845
|
+
};
|
|
140846
|
+
}
|
|
140847
|
+
const hashMatch = /^#([0-9a-f]+)$/i.exec(data);
|
|
140848
|
+
if (hashMatch && hashMatch[1].length % 3 === 0) {
|
|
140849
|
+
const hex = hashMatch[1];
|
|
140850
|
+
const n = hex.length / 3;
|
|
140851
|
+
return {
|
|
140852
|
+
r: hexComponent(hex.slice(0, n)),
|
|
140853
|
+
g: hexComponent(hex.slice(n, 2 * n)),
|
|
140854
|
+
b: hexComponent(hex.slice(2 * n))
|
|
140855
|
+
};
|
|
140856
|
+
}
|
|
140857
|
+
return;
|
|
140858
|
+
}
|
|
140859
|
+
function hexComponent(hex) {
|
|
140860
|
+
const max = 16 ** hex.length - 1;
|
|
140861
|
+
return parseInt(hex, 16) / max;
|
|
140862
|
+
}
|
|
140750
140863
|
function detectFromColorFgBg() {
|
|
140751
140864
|
const colorfgbg = process.env["COLORFGBG"];
|
|
140752
140865
|
if (!colorfgbg)
|
|
@@ -140760,7 +140873,7 @@ function detectFromColorFgBg() {
|
|
|
140760
140873
|
return;
|
|
140761
140874
|
return bgNum <= 6 || bgNum === 8 ? "dark" : "light";
|
|
140762
140875
|
}
|
|
140763
|
-
var cachedSystemTheme;
|
|
140876
|
+
var cachedSystemTheme, cachedOsAppearance;
|
|
140764
140877
|
|
|
140765
140878
|
// node_modules/react/cjs/react-jsx-dev-runtime.development.js
|
|
140766
140879
|
var require_react_jsx_dev_runtime_development = __commonJS(function(exports) {
|
|
@@ -140994,8 +141107,652 @@ var require_jsx_dev_runtime = __commonJS(function(exports, module) {
|
|
|
140994
141107
|
}
|
|
140995
141108
|
});
|
|
140996
141109
|
|
|
141110
|
+
// src/tui/ink/termio/ansi.ts
|
|
141111
|
+
function isEscFinal(byte) {
|
|
141112
|
+
return byte >= 48 && byte <= 126;
|
|
141113
|
+
}
|
|
141114
|
+
var C0, ESC = "\x1B", BEL = "\x07", SEP = ";", ESC_TYPE;
|
|
141115
|
+
var init_ansi = __esm(() => {
|
|
141116
|
+
C0 = {
|
|
141117
|
+
NUL: 0,
|
|
141118
|
+
SOH: 1,
|
|
141119
|
+
STX: 2,
|
|
141120
|
+
ETX: 3,
|
|
141121
|
+
EOT: 4,
|
|
141122
|
+
ENQ: 5,
|
|
141123
|
+
ACK: 6,
|
|
141124
|
+
BEL: 7,
|
|
141125
|
+
BS: 8,
|
|
141126
|
+
HT: 9,
|
|
141127
|
+
LF: 10,
|
|
141128
|
+
VT: 11,
|
|
141129
|
+
FF: 12,
|
|
141130
|
+
CR: 13,
|
|
141131
|
+
SO: 14,
|
|
141132
|
+
SI: 15,
|
|
141133
|
+
DLE: 16,
|
|
141134
|
+
DC1: 17,
|
|
141135
|
+
DC2: 18,
|
|
141136
|
+
DC3: 19,
|
|
141137
|
+
DC4: 20,
|
|
141138
|
+
NAK: 21,
|
|
141139
|
+
SYN: 22,
|
|
141140
|
+
ETB: 23,
|
|
141141
|
+
CAN: 24,
|
|
141142
|
+
EM: 25,
|
|
141143
|
+
SUB: 26,
|
|
141144
|
+
ESC: 27,
|
|
141145
|
+
FS: 28,
|
|
141146
|
+
GS: 29,
|
|
141147
|
+
RS: 30,
|
|
141148
|
+
US: 31,
|
|
141149
|
+
DEL: 127
|
|
141150
|
+
};
|
|
141151
|
+
ESC_TYPE = {
|
|
141152
|
+
CSI: 91,
|
|
141153
|
+
OSC: 93,
|
|
141154
|
+
DCS: 80,
|
|
141155
|
+
APC: 95,
|
|
141156
|
+
PM: 94,
|
|
141157
|
+
SOS: 88,
|
|
141158
|
+
ST: 92
|
|
141159
|
+
};
|
|
141160
|
+
});
|
|
141161
|
+
|
|
141162
|
+
// src/tui/ink/termio/csi.ts
|
|
141163
|
+
function isCSIParam(byte) {
|
|
141164
|
+
return byte >= CSI_RANGE.PARAM_START && byte <= CSI_RANGE.PARAM_END;
|
|
141165
|
+
}
|
|
141166
|
+
function isCSIIntermediate(byte) {
|
|
141167
|
+
return byte >= CSI_RANGE.INTERMEDIATE_START && byte <= CSI_RANGE.INTERMEDIATE_END;
|
|
141168
|
+
}
|
|
141169
|
+
function isCSIFinal(byte) {
|
|
141170
|
+
return byte >= CSI_RANGE.FINAL_START && byte <= CSI_RANGE.FINAL_END;
|
|
141171
|
+
}
|
|
141172
|
+
function csi(...args) {
|
|
141173
|
+
if (args.length === 0)
|
|
141174
|
+
return CSI_PREFIX;
|
|
141175
|
+
if (args.length === 1)
|
|
141176
|
+
return `${CSI_PREFIX}${args[0]}`;
|
|
141177
|
+
const params = args.slice(0, -1);
|
|
141178
|
+
const final = args[args.length - 1];
|
|
141179
|
+
return `${CSI_PREFIX}${params.join(SEP)}${final}`;
|
|
141180
|
+
}
|
|
141181
|
+
function cursorUp(n = 1) {
|
|
141182
|
+
return n === 0 ? "" : csi(n, "A");
|
|
141183
|
+
}
|
|
141184
|
+
function cursorDown(n = 1) {
|
|
141185
|
+
return n === 0 ? "" : csi(n, "B");
|
|
141186
|
+
}
|
|
141187
|
+
function cursorForward(n = 1) {
|
|
141188
|
+
return n === 0 ? "" : csi(n, "C");
|
|
141189
|
+
}
|
|
141190
|
+
function cursorBack(n = 1) {
|
|
141191
|
+
return n === 0 ? "" : csi(n, "D");
|
|
141192
|
+
}
|
|
141193
|
+
function cursorTo(col) {
|
|
141194
|
+
return csi(col, "G");
|
|
141195
|
+
}
|
|
141196
|
+
function cursorPosition(row, col) {
|
|
141197
|
+
return csi(row, col, "H");
|
|
141198
|
+
}
|
|
141199
|
+
function cursorMove(x, y) {
|
|
141200
|
+
let result = "";
|
|
141201
|
+
if (x < 0) {
|
|
141202
|
+
result += cursorBack(-x);
|
|
141203
|
+
} else if (x > 0) {
|
|
141204
|
+
result += cursorForward(x);
|
|
141205
|
+
}
|
|
141206
|
+
if (y < 0) {
|
|
141207
|
+
result += cursorUp(-y);
|
|
141208
|
+
} else if (y > 0) {
|
|
141209
|
+
result += cursorDown(y);
|
|
141210
|
+
}
|
|
141211
|
+
return result;
|
|
141212
|
+
}
|
|
141213
|
+
function eraseLines(n) {
|
|
141214
|
+
if (n <= 0)
|
|
141215
|
+
return "";
|
|
141216
|
+
let result = "";
|
|
141217
|
+
for (let i = 0;i < n; i++) {
|
|
141218
|
+
result += ERASE_LINE;
|
|
141219
|
+
if (i < n - 1) {
|
|
141220
|
+
result += cursorUp(1);
|
|
141221
|
+
}
|
|
141222
|
+
}
|
|
141223
|
+
result += CURSOR_LEFT;
|
|
141224
|
+
return result;
|
|
141225
|
+
}
|
|
141226
|
+
function scrollUp(n = 1) {
|
|
141227
|
+
return n === 0 ? "" : csi(n, "S");
|
|
141228
|
+
}
|
|
141229
|
+
function scrollDown(n = 1) {
|
|
141230
|
+
return n === 0 ? "" : csi(n, "T");
|
|
141231
|
+
}
|
|
141232
|
+
function setScrollRegion(top, bottom) {
|
|
141233
|
+
return csi(top, bottom, "r");
|
|
141234
|
+
}
|
|
141235
|
+
var CSI_PREFIX, CSI_RANGE, CSI, ERASE_DISPLAY, ERASE_LINE_REGION, CURSOR_STYLES, CURSOR_LEFT, CURSOR_HOME, CURSOR_SAVE, CURSOR_RESTORE, ERASE_LINE, ERASE_SCREEN, ERASE_SCROLLBACK, RESET_SCROLL_REGION, PASTE_START, PASTE_END, FOCUS_IN, FOCUS_OUT, ENABLE_KITTY_KEYBOARD, DISABLE_KITTY_KEYBOARD, ENABLE_MODIFY_OTHER_KEYS, DISABLE_MODIFY_OTHER_KEYS;
|
|
141236
|
+
var init_csi = __esm(() => {
|
|
141237
|
+
init_ansi();
|
|
141238
|
+
CSI_PREFIX = ESC + String.fromCharCode(ESC_TYPE.CSI);
|
|
141239
|
+
CSI_RANGE = {
|
|
141240
|
+
PARAM_START: 48,
|
|
141241
|
+
PARAM_END: 63,
|
|
141242
|
+
INTERMEDIATE_START: 32,
|
|
141243
|
+
INTERMEDIATE_END: 47,
|
|
141244
|
+
FINAL_START: 64,
|
|
141245
|
+
FINAL_END: 126
|
|
141246
|
+
};
|
|
141247
|
+
CSI = {
|
|
141248
|
+
CUU: 65,
|
|
141249
|
+
CUD: 66,
|
|
141250
|
+
CUF: 67,
|
|
141251
|
+
CUB: 68,
|
|
141252
|
+
CNL: 69,
|
|
141253
|
+
CPL: 70,
|
|
141254
|
+
CHA: 71,
|
|
141255
|
+
CUP: 72,
|
|
141256
|
+
CHT: 73,
|
|
141257
|
+
VPA: 100,
|
|
141258
|
+
HVP: 102,
|
|
141259
|
+
ED: 74,
|
|
141260
|
+
EL: 75,
|
|
141261
|
+
ECH: 88,
|
|
141262
|
+
IL: 76,
|
|
141263
|
+
DL: 77,
|
|
141264
|
+
ICH: 64,
|
|
141265
|
+
DCH: 80,
|
|
141266
|
+
SU: 83,
|
|
141267
|
+
SD: 84,
|
|
141268
|
+
SM: 104,
|
|
141269
|
+
RM: 108,
|
|
141270
|
+
SGR: 109,
|
|
141271
|
+
DSR: 110,
|
|
141272
|
+
DECSCUSR: 113,
|
|
141273
|
+
DECSTBM: 114,
|
|
141274
|
+
SCOSC: 115,
|
|
141275
|
+
SCORC: 117,
|
|
141276
|
+
CBT: 90
|
|
141277
|
+
};
|
|
141278
|
+
ERASE_DISPLAY = ["toEnd", "toStart", "all", "scrollback"];
|
|
141279
|
+
ERASE_LINE_REGION = ["toEnd", "toStart", "all"];
|
|
141280
|
+
CURSOR_STYLES = [
|
|
141281
|
+
{ style: "block", blinking: true },
|
|
141282
|
+
{ style: "block", blinking: true },
|
|
141283
|
+
{ style: "block", blinking: false },
|
|
141284
|
+
{ style: "underline", blinking: true },
|
|
141285
|
+
{ style: "underline", blinking: false },
|
|
141286
|
+
{ style: "bar", blinking: true },
|
|
141287
|
+
{ style: "bar", blinking: false }
|
|
141288
|
+
];
|
|
141289
|
+
CURSOR_LEFT = csi("G");
|
|
141290
|
+
CURSOR_HOME = csi("H");
|
|
141291
|
+
CURSOR_SAVE = csi("s");
|
|
141292
|
+
CURSOR_RESTORE = csi("u");
|
|
141293
|
+
ERASE_LINE = csi(2, "K");
|
|
141294
|
+
ERASE_SCREEN = csi(2, "J");
|
|
141295
|
+
ERASE_SCROLLBACK = csi(3, "J");
|
|
141296
|
+
RESET_SCROLL_REGION = csi("r");
|
|
141297
|
+
PASTE_START = csi("200~");
|
|
141298
|
+
PASTE_END = csi("201~");
|
|
141299
|
+
FOCUS_IN = csi("I");
|
|
141300
|
+
FOCUS_OUT = csi("O");
|
|
141301
|
+
ENABLE_KITTY_KEYBOARD = csi(">1u");
|
|
141302
|
+
DISABLE_KITTY_KEYBOARD = csi("<u");
|
|
141303
|
+
ENABLE_MODIFY_OTHER_KEYS = csi(">4;2m");
|
|
141304
|
+
DISABLE_MODIFY_OTHER_KEYS = csi(">4m");
|
|
141305
|
+
});
|
|
141306
|
+
|
|
141307
|
+
// src/tui/ink/termio/osc.ts
|
|
141308
|
+
import { Buffer as Buffer8 } from "buffer";
|
|
141309
|
+
function osc(...parts) {
|
|
141310
|
+
const terminator = env5.terminal === "kitty" ? ST : BEL;
|
|
141311
|
+
return `${OSC_PREFIX}${parts.join(SEP)}${terminator}`;
|
|
141312
|
+
}
|
|
141313
|
+
function wrapForMultiplexer(sequence) {
|
|
141314
|
+
if (process.env["TMUX"]) {
|
|
141315
|
+
const escaped = sequence.replaceAll("\x1B", "\x1B\x1B");
|
|
141316
|
+
return `\x1BPtmux;${escaped}\x1B\\`;
|
|
141317
|
+
}
|
|
141318
|
+
if (process.env["STY"]) {
|
|
141319
|
+
return `\x1BP${sequence}\x1B\\`;
|
|
141320
|
+
}
|
|
141321
|
+
return sequence;
|
|
141322
|
+
}
|
|
141323
|
+
function getClipboardPath() {
|
|
141324
|
+
const nativeAvailable = process.platform === "darwin" && !process.env["SSH_CONNECTION"];
|
|
141325
|
+
if (nativeAvailable)
|
|
141326
|
+
return "native";
|
|
141327
|
+
if (process.env["TMUX"])
|
|
141328
|
+
return "tmux-buffer";
|
|
141329
|
+
return "osc52";
|
|
141330
|
+
}
|
|
141331
|
+
function tmuxPassthrough(payload) {
|
|
141332
|
+
return `${ESC}Ptmux;${payload.replaceAll(ESC, ESC + ESC)}${ST}`;
|
|
141333
|
+
}
|
|
141334
|
+
async function tmuxLoadBuffer(text) {
|
|
141335
|
+
if (!process.env["TMUX"])
|
|
141336
|
+
return false;
|
|
141337
|
+
const args = process.env["LC_TERMINAL"] === "iTerm2" ? ["load-buffer", "-"] : ["load-buffer", "-w", "-"];
|
|
141338
|
+
const { code } = await execFileNoThrow3("tmux", args, {
|
|
141339
|
+
input: text,
|
|
141340
|
+
useCwd: false,
|
|
141341
|
+
timeout: 2000
|
|
141342
|
+
});
|
|
141343
|
+
return code === 0;
|
|
141344
|
+
}
|
|
141345
|
+
async function setClipboard(text) {
|
|
141346
|
+
const b64 = Buffer8.from(text, "utf8").toString("base64");
|
|
141347
|
+
const raw = osc(OSC.CLIPBOARD, "c", b64);
|
|
141348
|
+
if (!process.env["SSH_CONNECTION"])
|
|
141349
|
+
copyNative(text);
|
|
141350
|
+
const tmuxBufferLoaded = await tmuxLoadBuffer(text);
|
|
141351
|
+
if (tmuxBufferLoaded)
|
|
141352
|
+
return tmuxPassthrough(`${ESC}]52;c;${b64}${BEL}`);
|
|
141353
|
+
return raw;
|
|
141354
|
+
}
|
|
141355
|
+
function copyNative(text) {
|
|
141356
|
+
const opts = { input: text, useCwd: false, timeout: 2000 };
|
|
141357
|
+
switch (process.platform) {
|
|
141358
|
+
case "darwin":
|
|
141359
|
+
execFileNoThrow3("pbcopy", [], opts);
|
|
141360
|
+
return;
|
|
141361
|
+
case "linux": {
|
|
141362
|
+
if (linuxCopy === null)
|
|
141363
|
+
return;
|
|
141364
|
+
if (linuxCopy === "wl-copy") {
|
|
141365
|
+
execFileNoThrow3("wl-copy", [], opts);
|
|
141366
|
+
return;
|
|
141367
|
+
}
|
|
141368
|
+
if (linuxCopy === "xclip") {
|
|
141369
|
+
execFileNoThrow3("xclip", ["-selection", "clipboard"], opts);
|
|
141370
|
+
return;
|
|
141371
|
+
}
|
|
141372
|
+
if (linuxCopy === "xsel") {
|
|
141373
|
+
execFileNoThrow3("xsel", ["--clipboard", "--input"], opts);
|
|
141374
|
+
return;
|
|
141375
|
+
}
|
|
141376
|
+
execFileNoThrow3("wl-copy", [], opts).then((r) => {
|
|
141377
|
+
if (r.code === 0) {
|
|
141378
|
+
linuxCopy = "wl-copy";
|
|
141379
|
+
return;
|
|
141380
|
+
}
|
|
141381
|
+
execFileNoThrow3("xclip", ["-selection", "clipboard"], opts).then((r2) => {
|
|
141382
|
+
if (r2.code === 0) {
|
|
141383
|
+
linuxCopy = "xclip";
|
|
141384
|
+
return;
|
|
141385
|
+
}
|
|
141386
|
+
execFileNoThrow3("xsel", ["--clipboard", "--input"], opts).then((r3) => {
|
|
141387
|
+
linuxCopy = r3.code === 0 ? "xsel" : null;
|
|
141388
|
+
});
|
|
141389
|
+
});
|
|
141390
|
+
});
|
|
141391
|
+
return;
|
|
141392
|
+
}
|
|
141393
|
+
case "win32":
|
|
141394
|
+
execFileNoThrow3("clip", [], opts);
|
|
141395
|
+
return;
|
|
141396
|
+
}
|
|
141397
|
+
}
|
|
141398
|
+
function parseOSC(content) {
|
|
141399
|
+
const semicolonIdx = content.indexOf(";");
|
|
141400
|
+
const command = semicolonIdx >= 0 ? content.slice(0, semicolonIdx) : content;
|
|
141401
|
+
const data = semicolonIdx >= 0 ? content.slice(semicolonIdx + 1) : "";
|
|
141402
|
+
const commandNum = parseInt(command, 10);
|
|
141403
|
+
if (commandNum === OSC.SET_TITLE_AND_ICON) {
|
|
141404
|
+
return { type: "title", action: { type: "both", title: data } };
|
|
141405
|
+
}
|
|
141406
|
+
if (commandNum === OSC.SET_ICON) {
|
|
141407
|
+
return { type: "title", action: { type: "iconName", name: data } };
|
|
141408
|
+
}
|
|
141409
|
+
if (commandNum === OSC.SET_TITLE) {
|
|
141410
|
+
return { type: "title", action: { type: "windowTitle", title: data } };
|
|
141411
|
+
}
|
|
141412
|
+
if (commandNum === OSC.HYPERLINK) {
|
|
141413
|
+
const parts = data.split(";");
|
|
141414
|
+
const paramsStr = parts[0] ?? "";
|
|
141415
|
+
const url = parts.slice(1).join(";");
|
|
141416
|
+
if (url === "") {
|
|
141417
|
+
return { type: "link", action: { type: "end" } };
|
|
141418
|
+
}
|
|
141419
|
+
const params = {};
|
|
141420
|
+
if (paramsStr) {
|
|
141421
|
+
for (const pair of paramsStr.split(":")) {
|
|
141422
|
+
const eqIdx = pair.indexOf("=");
|
|
141423
|
+
if (eqIdx >= 0) {
|
|
141424
|
+
params[pair.slice(0, eqIdx)] = pair.slice(eqIdx + 1);
|
|
141425
|
+
}
|
|
141426
|
+
}
|
|
141427
|
+
}
|
|
141428
|
+
return {
|
|
141429
|
+
type: "link",
|
|
141430
|
+
action: {
|
|
141431
|
+
type: "start",
|
|
141432
|
+
url,
|
|
141433
|
+
params: Object.keys(params).length > 0 ? params : undefined
|
|
141434
|
+
}
|
|
141435
|
+
};
|
|
141436
|
+
}
|
|
141437
|
+
if (commandNum === OSC.TAB_STATUS) {
|
|
141438
|
+
return { type: "tabStatus", action: parseTabStatus(data) };
|
|
141439
|
+
}
|
|
141440
|
+
return { type: "unknown", sequence: `\x1B]${content}` };
|
|
141441
|
+
}
|
|
141442
|
+
function parseOscColor(spec) {
|
|
141443
|
+
const hex = spec.match(/^#([0-9a-f]{2})([0-9a-f]{2})([0-9a-f]{2})$/i);
|
|
141444
|
+
if (hex) {
|
|
141445
|
+
return {
|
|
141446
|
+
type: "rgb",
|
|
141447
|
+
r: parseInt(hex[1], 16),
|
|
141448
|
+
g: parseInt(hex[2], 16),
|
|
141449
|
+
b: parseInt(hex[3], 16)
|
|
141450
|
+
};
|
|
141451
|
+
}
|
|
141452
|
+
const rgb = spec.match(/^rgb:([0-9a-f]{1,4})\/([0-9a-f]{1,4})\/([0-9a-f]{1,4})$/i);
|
|
141453
|
+
if (rgb) {
|
|
141454
|
+
const scale = (s) => Math.round(parseInt(s, 16) / (16 ** s.length - 1) * 255);
|
|
141455
|
+
return {
|
|
141456
|
+
type: "rgb",
|
|
141457
|
+
r: scale(rgb[1]),
|
|
141458
|
+
g: scale(rgb[2]),
|
|
141459
|
+
b: scale(rgb[3])
|
|
141460
|
+
};
|
|
141461
|
+
}
|
|
141462
|
+
return null;
|
|
141463
|
+
}
|
|
141464
|
+
function parseTabStatus(data) {
|
|
141465
|
+
const action = {};
|
|
141466
|
+
for (const [key, value] of splitTabStatusPairs(data)) {
|
|
141467
|
+
switch (key) {
|
|
141468
|
+
case "indicator":
|
|
141469
|
+
action.indicator = value === "" ? null : parseOscColor(value);
|
|
141470
|
+
break;
|
|
141471
|
+
case "status":
|
|
141472
|
+
action.status = value === "" ? null : value;
|
|
141473
|
+
break;
|
|
141474
|
+
case "status-color":
|
|
141475
|
+
action.statusColor = value === "" ? null : parseOscColor(value);
|
|
141476
|
+
break;
|
|
141477
|
+
}
|
|
141478
|
+
}
|
|
141479
|
+
return action;
|
|
141480
|
+
}
|
|
141481
|
+
function* splitTabStatusPairs(data) {
|
|
141482
|
+
let key = "";
|
|
141483
|
+
let val = "";
|
|
141484
|
+
let inVal = false;
|
|
141485
|
+
let esc = false;
|
|
141486
|
+
for (const c of data) {
|
|
141487
|
+
if (esc) {
|
|
141488
|
+
if (inVal)
|
|
141489
|
+
val += c;
|
|
141490
|
+
else
|
|
141491
|
+
key += c;
|
|
141492
|
+
esc = false;
|
|
141493
|
+
} else if (c === "\\") {
|
|
141494
|
+
esc = true;
|
|
141495
|
+
} else if (c === ";") {
|
|
141496
|
+
yield [key, val];
|
|
141497
|
+
key = "";
|
|
141498
|
+
val = "";
|
|
141499
|
+
inVal = false;
|
|
141500
|
+
} else if (c === "=" && !inVal) {
|
|
141501
|
+
inVal = true;
|
|
141502
|
+
} else if (inVal) {
|
|
141503
|
+
val += c;
|
|
141504
|
+
} else {
|
|
141505
|
+
key += c;
|
|
141506
|
+
}
|
|
141507
|
+
}
|
|
141508
|
+
if (key || inVal)
|
|
141509
|
+
yield [key, val];
|
|
141510
|
+
}
|
|
141511
|
+
function link(url, params) {
|
|
141512
|
+
if (!url)
|
|
141513
|
+
return LINK_END;
|
|
141514
|
+
const p = { id: osc8Id(url), ...params };
|
|
141515
|
+
const paramStr = Object.entries(p).map(([k, v]) => `${k}=${v}`).join(":");
|
|
141516
|
+
return osc(OSC.HYPERLINK, paramStr, url);
|
|
141517
|
+
}
|
|
141518
|
+
function osc8Id(url) {
|
|
141519
|
+
let h = 0;
|
|
141520
|
+
for (let i = 0;i < url.length; i++)
|
|
141521
|
+
h = (h << 5) - h + url.charCodeAt(i) | 0;
|
|
141522
|
+
return (h >>> 0).toString(36);
|
|
141523
|
+
}
|
|
141524
|
+
function supportsTabStatus() {
|
|
141525
|
+
return false;
|
|
141526
|
+
}
|
|
141527
|
+
function tabStatus(fields) {
|
|
141528
|
+
const parts = [];
|
|
141529
|
+
const rgb = (c) => c.type === "rgb" ? `#${[c.r, c.g, c.b].map((n) => n.toString(16).padStart(2, "0")).join("")}` : "";
|
|
141530
|
+
if ("indicator" in fields)
|
|
141531
|
+
parts.push(`indicator=${fields.indicator ? rgb(fields.indicator) : ""}`);
|
|
141532
|
+
if ("status" in fields)
|
|
141533
|
+
parts.push(`status=${fields.status?.replaceAll("\\", "\\\\").replaceAll(";", "\\;") ?? ""}`);
|
|
141534
|
+
if ("statusColor" in fields)
|
|
141535
|
+
parts.push(`status-color=${fields.statusColor ? rgb(fields.statusColor) : ""}`);
|
|
141536
|
+
return osc(OSC.TAB_STATUS, parts.join(";"));
|
|
141537
|
+
}
|
|
141538
|
+
var OSC_PREFIX, ST, linuxCopy, OSC, LINK_END, ITERM2, PROGRESS, CLEAR_ITERM2_PROGRESS, CLEAR_TERMINAL_TITLE, CLEAR_TAB_STATUS;
|
|
141539
|
+
var init_osc = __esm(() => {
|
|
141540
|
+
init_env2();
|
|
141541
|
+
init_execFileNoThrow2();
|
|
141542
|
+
init_ansi();
|
|
141543
|
+
OSC_PREFIX = ESC + String.fromCharCode(ESC_TYPE.OSC);
|
|
141544
|
+
ST = ESC + "\\";
|
|
141545
|
+
OSC = {
|
|
141546
|
+
SET_TITLE_AND_ICON: 0,
|
|
141547
|
+
SET_ICON: 1,
|
|
141548
|
+
SET_TITLE: 2,
|
|
141549
|
+
SET_COLOR: 4,
|
|
141550
|
+
SET_CWD: 7,
|
|
141551
|
+
HYPERLINK: 8,
|
|
141552
|
+
ITERM2: 9,
|
|
141553
|
+
SET_FG_COLOR: 10,
|
|
141554
|
+
SET_BG_COLOR: 11,
|
|
141555
|
+
SET_CURSOR_COLOR: 12,
|
|
141556
|
+
CLIPBOARD: 52,
|
|
141557
|
+
KITTY: 99,
|
|
141558
|
+
RESET_COLOR: 104,
|
|
141559
|
+
RESET_FG_COLOR: 110,
|
|
141560
|
+
RESET_BG_COLOR: 111,
|
|
141561
|
+
RESET_CURSOR_COLOR: 112,
|
|
141562
|
+
SEMANTIC_PROMPT: 133,
|
|
141563
|
+
GHOSTTY: 777,
|
|
141564
|
+
TAB_STATUS: 21337
|
|
141565
|
+
};
|
|
141566
|
+
LINK_END = osc(OSC.HYPERLINK, "", "");
|
|
141567
|
+
ITERM2 = {
|
|
141568
|
+
NOTIFY: 0,
|
|
141569
|
+
BADGE: 2,
|
|
141570
|
+
PROGRESS: 4
|
|
141571
|
+
};
|
|
141572
|
+
PROGRESS = {
|
|
141573
|
+
CLEAR: 0,
|
|
141574
|
+
SET: 1,
|
|
141575
|
+
ERROR: 2,
|
|
141576
|
+
INDETERMINATE: 3
|
|
141577
|
+
};
|
|
141578
|
+
CLEAR_ITERM2_PROGRESS = `${OSC_PREFIX}${OSC.ITERM2};${ITERM2.PROGRESS};${PROGRESS.CLEAR};${BEL}`;
|
|
141579
|
+
CLEAR_TERMINAL_TITLE = `${OSC_PREFIX}${OSC.SET_TITLE_AND_ICON};${BEL}`;
|
|
141580
|
+
CLEAR_TAB_STATUS = osc(OSC.TAB_STATUS, "indicator=;status=;status-color=");
|
|
141581
|
+
});
|
|
141582
|
+
|
|
141583
|
+
// src/tui/ink/terminal-querier.ts
|
|
141584
|
+
function oscColor(code) {
|
|
141585
|
+
return {
|
|
141586
|
+
request: osc(code, "?"),
|
|
141587
|
+
match: (r) => r.type === "osc" && r.code === code
|
|
141588
|
+
};
|
|
141589
|
+
}
|
|
141590
|
+
function xtversion() {
|
|
141591
|
+
return {
|
|
141592
|
+
request: csi(">0q"),
|
|
141593
|
+
match: (r) => r.type === "xtversion"
|
|
141594
|
+
};
|
|
141595
|
+
}
|
|
141596
|
+
|
|
141597
|
+
class TerminalQuerier {
|
|
141598
|
+
stdout;
|
|
141599
|
+
queue = [];
|
|
141600
|
+
constructor(stdout) {
|
|
141601
|
+
this.stdout = stdout;
|
|
141602
|
+
}
|
|
141603
|
+
send(query) {
|
|
141604
|
+
return new Promise((resolve) => {
|
|
141605
|
+
this.queue.push({
|
|
141606
|
+
kind: "query",
|
|
141607
|
+
match: query.match,
|
|
141608
|
+
resolve: (r) => resolve(r)
|
|
141609
|
+
});
|
|
141610
|
+
this.stdout.write(query.request);
|
|
141611
|
+
});
|
|
141612
|
+
}
|
|
141613
|
+
flush() {
|
|
141614
|
+
return new Promise((resolve) => {
|
|
141615
|
+
this.queue.push({ kind: "sentinel", resolve });
|
|
141616
|
+
this.stdout.write(SENTINEL);
|
|
141617
|
+
});
|
|
141618
|
+
}
|
|
141619
|
+
onResponse(r) {
|
|
141620
|
+
const idx = this.queue.findIndex((p) => p.kind === "query" && p.match(r));
|
|
141621
|
+
if (idx !== -1) {
|
|
141622
|
+
const [q] = this.queue.splice(idx, 1);
|
|
141623
|
+
if (q?.kind === "query")
|
|
141624
|
+
q.resolve(r);
|
|
141625
|
+
return;
|
|
141626
|
+
}
|
|
141627
|
+
if (r.type === "da1") {
|
|
141628
|
+
const s = this.queue.findIndex((p) => p.kind === "sentinel");
|
|
141629
|
+
if (s === -1)
|
|
141630
|
+
return;
|
|
141631
|
+
for (const p of this.queue.splice(0, s + 1)) {
|
|
141632
|
+
if (p.kind === "query")
|
|
141633
|
+
p.resolve(undefined);
|
|
141634
|
+
else
|
|
141635
|
+
p.resolve();
|
|
141636
|
+
}
|
|
141637
|
+
}
|
|
141638
|
+
}
|
|
141639
|
+
}
|
|
141640
|
+
var SENTINEL;
|
|
141641
|
+
var init_terminal_querier = __esm(() => {
|
|
141642
|
+
init_csi();
|
|
141643
|
+
init_osc();
|
|
141644
|
+
SENTINEL = csi("c");
|
|
141645
|
+
});
|
|
141646
|
+
|
|
141647
|
+
// src/tui/utils/osAppearance.ts
|
|
141648
|
+
async function readOsAppearance(deps = {}) {
|
|
141649
|
+
const platform = deps.platform ?? process.platform;
|
|
141650
|
+
const spawn = deps.spawn ?? __require("node:child_process").spawn;
|
|
141651
|
+
try {
|
|
141652
|
+
if (platform === "darwin") {
|
|
141653
|
+
const outcome = await run(spawn, "defaults", ["read", "-g", "AppleInterfaceStyle"]);
|
|
141654
|
+
if (outcome === undefined)
|
|
141655
|
+
return;
|
|
141656
|
+
if (outcome.code === 0) {
|
|
141657
|
+
return outcome.stdout.trim() === MACOS_DARK_STYLE_VALUE ? "dark" : "light";
|
|
141658
|
+
}
|
|
141659
|
+
return outcome.code === 1 ? "light" : undefined;
|
|
141660
|
+
}
|
|
141661
|
+
if (platform === "win32") {
|
|
141662
|
+
const outcome = await run(spawn, "reg", [
|
|
141663
|
+
"query",
|
|
141664
|
+
WIN_APPS_USE_LIGHT_THEME_REGKEY,
|
|
141665
|
+
"/v",
|
|
141666
|
+
WIN_APPS_USE_LIGHT_THEME_VALUE
|
|
141667
|
+
]);
|
|
141668
|
+
if (outcome === undefined || outcome.code !== 0)
|
|
141669
|
+
return;
|
|
141670
|
+
return /0x1\b/.test(outcome.stdout) ? "light" : "dark";
|
|
141671
|
+
}
|
|
141672
|
+
return;
|
|
141673
|
+
} catch {
|
|
141674
|
+
return;
|
|
141675
|
+
}
|
|
141676
|
+
}
|
|
141677
|
+
function run(spawn, cmd, args) {
|
|
141678
|
+
return new Promise((resolve) => {
|
|
141679
|
+
let settled = false;
|
|
141680
|
+
const done = (v) => {
|
|
141681
|
+
if (!settled) {
|
|
141682
|
+
settled = true;
|
|
141683
|
+
resolve(v);
|
|
141684
|
+
}
|
|
141685
|
+
};
|
|
141686
|
+
try {
|
|
141687
|
+
const child = spawn(cmd, args, { timeout: OS_APPEARANCE_READ_TIMEOUT_MS });
|
|
141688
|
+
let stdout = "";
|
|
141689
|
+
child.stdout?.on("data", (chunk) => {
|
|
141690
|
+
stdout += chunk.toString();
|
|
141691
|
+
});
|
|
141692
|
+
child.on("error", () => done(undefined));
|
|
141693
|
+
child.on("exit", (code) => done({ stdout, code }));
|
|
141694
|
+
child.on("close", (code) => done({ stdout, code }));
|
|
141695
|
+
const timer = setTimeout(() => {
|
|
141696
|
+
try {
|
|
141697
|
+
child.kill("SIGKILL");
|
|
141698
|
+
} catch {}
|
|
141699
|
+
}, OS_APPEARANCE_READ_TIMEOUT_MS);
|
|
141700
|
+
timer.unref?.();
|
|
141701
|
+
} catch {
|
|
141702
|
+
done(undefined);
|
|
141703
|
+
}
|
|
141704
|
+
});
|
|
141705
|
+
}
|
|
141706
|
+
var OS_APPEARANCE_READ_TIMEOUT_MS = 500, MACOS_DARK_STYLE_VALUE = "Dark", WIN_APPS_USE_LIGHT_THEME_REGKEY = "HKCU\\Software\\Microsoft\\Windows\\CurrentVersion\\Themes\\Personalize", WIN_APPS_USE_LIGHT_THEME_VALUE = "AppsUseLightTheme";
|
|
141707
|
+
|
|
140997
141708
|
// src/tui/utils/systemThemeWatcher.ts
|
|
140998
|
-
|
|
141709
|
+
function watchSystemTheme(querier, setSystemTheme) {
|
|
141710
|
+
let disposed = false;
|
|
141711
|
+
const applyTheme = (theme) => {
|
|
141712
|
+
if (disposed)
|
|
141713
|
+
return;
|
|
141714
|
+
setCachedSystemTheme(theme);
|
|
141715
|
+
setSystemTheme(theme);
|
|
141716
|
+
};
|
|
141717
|
+
const fallbackToOsAppearance = () => {
|
|
141718
|
+
readOsAppearance().then((theme) => {
|
|
141719
|
+
if (theme) {
|
|
141720
|
+
setCachedOsAppearance(theme);
|
|
141721
|
+
applyTheme(theme);
|
|
141722
|
+
}
|
|
141723
|
+
}).catch(() => {});
|
|
141724
|
+
};
|
|
141725
|
+
(async () => {
|
|
141726
|
+
const pending = querier.send(oscColor(11));
|
|
141727
|
+
querier.flush().catch(() => {});
|
|
141728
|
+
const response = await Promise.race([
|
|
141729
|
+
pending,
|
|
141730
|
+
sleep9(OSC_QUERY_TIMEOUT_MS).then(() => {
|
|
141731
|
+
return;
|
|
141732
|
+
})
|
|
141733
|
+
]);
|
|
141734
|
+
if (disposed)
|
|
141735
|
+
return;
|
|
141736
|
+
if (response?.type === "osc") {
|
|
141737
|
+
const theme = themeFromOscColor(response.data);
|
|
141738
|
+
if (theme) {
|
|
141739
|
+
applyTheme(theme);
|
|
141740
|
+
return;
|
|
141741
|
+
}
|
|
141742
|
+
}
|
|
141743
|
+
fallbackToOsAppearance();
|
|
141744
|
+
})().catch(() => {});
|
|
141745
|
+
return () => {
|
|
141746
|
+
disposed = true;
|
|
141747
|
+
};
|
|
141748
|
+
}
|
|
141749
|
+
function sleep9(ms) {
|
|
141750
|
+
return new Promise((resolve) => setTimeout(resolve, ms).unref?.());
|
|
141751
|
+
}
|
|
141752
|
+
var OSC_QUERY_TIMEOUT_MS = 2000;
|
|
141753
|
+
var init_systemThemeWatcher = __esm(() => {
|
|
141754
|
+
init_terminal_querier();
|
|
141755
|
+
});
|
|
140999
141756
|
|
|
141000
141757
|
// src/tui/components/design-system/ThemeProvider.tsx
|
|
141001
141758
|
function defaultInitialTheme() {
|
|
@@ -141025,7 +141782,7 @@ function ThemeProvider({
|
|
|
141025
141782
|
return;
|
|
141026
141783
|
let cleanup;
|
|
141027
141784
|
let cancelled = false;
|
|
141028
|
-
Promise.resolve().then(() => ({})).then(({}) => {
|
|
141785
|
+
Promise.resolve().then(() => (init_systemThemeWatcher(), {})).then(({}) => {
|
|
141029
141786
|
if (cancelled)
|
|
141030
141787
|
return;
|
|
141031
141788
|
cleanup = watchSystemTheme(internal_querier, setSystemTheme);
|
|
@@ -143298,203 +144055,6 @@ var init_fullscreen = __esm(() => {
|
|
|
143298
144055
|
init_execFileNoThrow2();
|
|
143299
144056
|
});
|
|
143300
144057
|
|
|
143301
|
-
// src/tui/ink/termio/ansi.ts
|
|
143302
|
-
function isEscFinal(byte) {
|
|
143303
|
-
return byte >= 48 && byte <= 126;
|
|
143304
|
-
}
|
|
143305
|
-
var C0, ESC = "\x1B", BEL = "\x07", SEP = ";", ESC_TYPE;
|
|
143306
|
-
var init_ansi = __esm(() => {
|
|
143307
|
-
C0 = {
|
|
143308
|
-
NUL: 0,
|
|
143309
|
-
SOH: 1,
|
|
143310
|
-
STX: 2,
|
|
143311
|
-
ETX: 3,
|
|
143312
|
-
EOT: 4,
|
|
143313
|
-
ENQ: 5,
|
|
143314
|
-
ACK: 6,
|
|
143315
|
-
BEL: 7,
|
|
143316
|
-
BS: 8,
|
|
143317
|
-
HT: 9,
|
|
143318
|
-
LF: 10,
|
|
143319
|
-
VT: 11,
|
|
143320
|
-
FF: 12,
|
|
143321
|
-
CR: 13,
|
|
143322
|
-
SO: 14,
|
|
143323
|
-
SI: 15,
|
|
143324
|
-
DLE: 16,
|
|
143325
|
-
DC1: 17,
|
|
143326
|
-
DC2: 18,
|
|
143327
|
-
DC3: 19,
|
|
143328
|
-
DC4: 20,
|
|
143329
|
-
NAK: 21,
|
|
143330
|
-
SYN: 22,
|
|
143331
|
-
ETB: 23,
|
|
143332
|
-
CAN: 24,
|
|
143333
|
-
EM: 25,
|
|
143334
|
-
SUB: 26,
|
|
143335
|
-
ESC: 27,
|
|
143336
|
-
FS: 28,
|
|
143337
|
-
GS: 29,
|
|
143338
|
-
RS: 30,
|
|
143339
|
-
US: 31,
|
|
143340
|
-
DEL: 127
|
|
143341
|
-
};
|
|
143342
|
-
ESC_TYPE = {
|
|
143343
|
-
CSI: 91,
|
|
143344
|
-
OSC: 93,
|
|
143345
|
-
DCS: 80,
|
|
143346
|
-
APC: 95,
|
|
143347
|
-
PM: 94,
|
|
143348
|
-
SOS: 88,
|
|
143349
|
-
ST: 92
|
|
143350
|
-
};
|
|
143351
|
-
});
|
|
143352
|
-
|
|
143353
|
-
// src/tui/ink/termio/csi.ts
|
|
143354
|
-
function isCSIParam(byte) {
|
|
143355
|
-
return byte >= CSI_RANGE.PARAM_START && byte <= CSI_RANGE.PARAM_END;
|
|
143356
|
-
}
|
|
143357
|
-
function isCSIIntermediate(byte) {
|
|
143358
|
-
return byte >= CSI_RANGE.INTERMEDIATE_START && byte <= CSI_RANGE.INTERMEDIATE_END;
|
|
143359
|
-
}
|
|
143360
|
-
function isCSIFinal(byte) {
|
|
143361
|
-
return byte >= CSI_RANGE.FINAL_START && byte <= CSI_RANGE.FINAL_END;
|
|
143362
|
-
}
|
|
143363
|
-
function csi(...args) {
|
|
143364
|
-
if (args.length === 0)
|
|
143365
|
-
return CSI_PREFIX;
|
|
143366
|
-
if (args.length === 1)
|
|
143367
|
-
return `${CSI_PREFIX}${args[0]}`;
|
|
143368
|
-
const params = args.slice(0, -1);
|
|
143369
|
-
const final = args[args.length - 1];
|
|
143370
|
-
return `${CSI_PREFIX}${params.join(SEP)}${final}`;
|
|
143371
|
-
}
|
|
143372
|
-
function cursorUp(n = 1) {
|
|
143373
|
-
return n === 0 ? "" : csi(n, "A");
|
|
143374
|
-
}
|
|
143375
|
-
function cursorDown(n = 1) {
|
|
143376
|
-
return n === 0 ? "" : csi(n, "B");
|
|
143377
|
-
}
|
|
143378
|
-
function cursorForward(n = 1) {
|
|
143379
|
-
return n === 0 ? "" : csi(n, "C");
|
|
143380
|
-
}
|
|
143381
|
-
function cursorBack(n = 1) {
|
|
143382
|
-
return n === 0 ? "" : csi(n, "D");
|
|
143383
|
-
}
|
|
143384
|
-
function cursorTo(col) {
|
|
143385
|
-
return csi(col, "G");
|
|
143386
|
-
}
|
|
143387
|
-
function cursorPosition(row, col) {
|
|
143388
|
-
return csi(row, col, "H");
|
|
143389
|
-
}
|
|
143390
|
-
function cursorMove(x, y) {
|
|
143391
|
-
let result = "";
|
|
143392
|
-
if (x < 0) {
|
|
143393
|
-
result += cursorBack(-x);
|
|
143394
|
-
} else if (x > 0) {
|
|
143395
|
-
result += cursorForward(x);
|
|
143396
|
-
}
|
|
143397
|
-
if (y < 0) {
|
|
143398
|
-
result += cursorUp(-y);
|
|
143399
|
-
} else if (y > 0) {
|
|
143400
|
-
result += cursorDown(y);
|
|
143401
|
-
}
|
|
143402
|
-
return result;
|
|
143403
|
-
}
|
|
143404
|
-
function eraseLines(n) {
|
|
143405
|
-
if (n <= 0)
|
|
143406
|
-
return "";
|
|
143407
|
-
let result = "";
|
|
143408
|
-
for (let i = 0;i < n; i++) {
|
|
143409
|
-
result += ERASE_LINE;
|
|
143410
|
-
if (i < n - 1) {
|
|
143411
|
-
result += cursorUp(1);
|
|
143412
|
-
}
|
|
143413
|
-
}
|
|
143414
|
-
result += CURSOR_LEFT;
|
|
143415
|
-
return result;
|
|
143416
|
-
}
|
|
143417
|
-
function scrollUp(n = 1) {
|
|
143418
|
-
return n === 0 ? "" : csi(n, "S");
|
|
143419
|
-
}
|
|
143420
|
-
function scrollDown(n = 1) {
|
|
143421
|
-
return n === 0 ? "" : csi(n, "T");
|
|
143422
|
-
}
|
|
143423
|
-
function setScrollRegion(top, bottom) {
|
|
143424
|
-
return csi(top, bottom, "r");
|
|
143425
|
-
}
|
|
143426
|
-
var CSI_PREFIX, CSI_RANGE, CSI, ERASE_DISPLAY, ERASE_LINE_REGION, CURSOR_STYLES, CURSOR_LEFT, CURSOR_HOME, CURSOR_SAVE, CURSOR_RESTORE, ERASE_LINE, ERASE_SCREEN, ERASE_SCROLLBACK, RESET_SCROLL_REGION, PASTE_START, PASTE_END, FOCUS_IN, FOCUS_OUT, ENABLE_KITTY_KEYBOARD, DISABLE_KITTY_KEYBOARD, ENABLE_MODIFY_OTHER_KEYS, DISABLE_MODIFY_OTHER_KEYS;
|
|
143427
|
-
var init_csi = __esm(() => {
|
|
143428
|
-
init_ansi();
|
|
143429
|
-
CSI_PREFIX = ESC + String.fromCharCode(ESC_TYPE.CSI);
|
|
143430
|
-
CSI_RANGE = {
|
|
143431
|
-
PARAM_START: 48,
|
|
143432
|
-
PARAM_END: 63,
|
|
143433
|
-
INTERMEDIATE_START: 32,
|
|
143434
|
-
INTERMEDIATE_END: 47,
|
|
143435
|
-
FINAL_START: 64,
|
|
143436
|
-
FINAL_END: 126
|
|
143437
|
-
};
|
|
143438
|
-
CSI = {
|
|
143439
|
-
CUU: 65,
|
|
143440
|
-
CUD: 66,
|
|
143441
|
-
CUF: 67,
|
|
143442
|
-
CUB: 68,
|
|
143443
|
-
CNL: 69,
|
|
143444
|
-
CPL: 70,
|
|
143445
|
-
CHA: 71,
|
|
143446
|
-
CUP: 72,
|
|
143447
|
-
CHT: 73,
|
|
143448
|
-
VPA: 100,
|
|
143449
|
-
HVP: 102,
|
|
143450
|
-
ED: 74,
|
|
143451
|
-
EL: 75,
|
|
143452
|
-
ECH: 88,
|
|
143453
|
-
IL: 76,
|
|
143454
|
-
DL: 77,
|
|
143455
|
-
ICH: 64,
|
|
143456
|
-
DCH: 80,
|
|
143457
|
-
SU: 83,
|
|
143458
|
-
SD: 84,
|
|
143459
|
-
SM: 104,
|
|
143460
|
-
RM: 108,
|
|
143461
|
-
SGR: 109,
|
|
143462
|
-
DSR: 110,
|
|
143463
|
-
DECSCUSR: 113,
|
|
143464
|
-
DECSTBM: 114,
|
|
143465
|
-
SCOSC: 115,
|
|
143466
|
-
SCORC: 117,
|
|
143467
|
-
CBT: 90
|
|
143468
|
-
};
|
|
143469
|
-
ERASE_DISPLAY = ["toEnd", "toStart", "all", "scrollback"];
|
|
143470
|
-
ERASE_LINE_REGION = ["toEnd", "toStart", "all"];
|
|
143471
|
-
CURSOR_STYLES = [
|
|
143472
|
-
{ style: "block", blinking: true },
|
|
143473
|
-
{ style: "block", blinking: true },
|
|
143474
|
-
{ style: "block", blinking: false },
|
|
143475
|
-
{ style: "underline", blinking: true },
|
|
143476
|
-
{ style: "underline", blinking: false },
|
|
143477
|
-
{ style: "bar", blinking: true },
|
|
143478
|
-
{ style: "bar", blinking: false }
|
|
143479
|
-
];
|
|
143480
|
-
CURSOR_LEFT = csi("G");
|
|
143481
|
-
CURSOR_HOME = csi("H");
|
|
143482
|
-
CURSOR_SAVE = csi("s");
|
|
143483
|
-
CURSOR_RESTORE = csi("u");
|
|
143484
|
-
ERASE_LINE = csi(2, "K");
|
|
143485
|
-
ERASE_SCREEN = csi(2, "J");
|
|
143486
|
-
ERASE_SCROLLBACK = csi(3, "J");
|
|
143487
|
-
RESET_SCROLL_REGION = csi("r");
|
|
143488
|
-
PASTE_START = csi("200~");
|
|
143489
|
-
PASTE_END = csi("201~");
|
|
143490
|
-
FOCUS_IN = csi("I");
|
|
143491
|
-
FOCUS_OUT = csi("O");
|
|
143492
|
-
ENABLE_KITTY_KEYBOARD = csi(">1u");
|
|
143493
|
-
DISABLE_KITTY_KEYBOARD = csi("<u");
|
|
143494
|
-
ENABLE_MODIFY_OTHER_KEYS = csi(">4;2m");
|
|
143495
|
-
DISABLE_MODIFY_OTHER_KEYS = csi(">4m");
|
|
143496
|
-
});
|
|
143497
|
-
|
|
143498
144058
|
// src/tui/ink/termio/tokenize.ts
|
|
143499
144059
|
function createTokenizer(options) {
|
|
143500
144060
|
let currentState = "ground";
|
|
@@ -143676,7 +144236,7 @@ var init_tokenize = __esm(() => {
|
|
|
143676
144236
|
});
|
|
143677
144237
|
|
|
143678
144238
|
// src/tui/ink/parse-keypress.ts
|
|
143679
|
-
import { Buffer as
|
|
144239
|
+
import { Buffer as Buffer9 } from "buffer";
|
|
143680
144240
|
function createPasteKey(content) {
|
|
143681
144241
|
return {
|
|
143682
144242
|
kind: "key",
|
|
@@ -143740,7 +144300,7 @@ function splitNumericParams(params) {
|
|
|
143740
144300
|
return params.split(";").map((p) => parseInt(p, 10));
|
|
143741
144301
|
}
|
|
143742
144302
|
function inputToString(input) {
|
|
143743
|
-
if (
|
|
144303
|
+
if (Buffer9.isBuffer(input)) {
|
|
143744
144304
|
if (input[0] > 127 && input[1] === undefined) {
|
|
143745
144305
|
input[0] -= 128;
|
|
143746
144306
|
return "\x1B" + String(input);
|
|
@@ -155654,20 +156214,20 @@ var init_ansi_styles2 = __esm(() => {
|
|
|
155654
156214
|
});
|
|
155655
156215
|
|
|
155656
156216
|
// node_modules/@alcalzone/ansi-tokenize/build/consts.js
|
|
155657
|
-
var BEL2 = "\x07", ESC2 = "\x1B", BACKSLASH = "\\", CSI2 = "[",
|
|
156217
|
+
var BEL2 = "\x07", ESC2 = "\x1B", BACKSLASH = "\\", CSI2 = "[", OSC2 = "]", C1_ST = "", CC_BEL, CC_ESC, CC_BACKSLASH, CC_CSI, CC_OSC, CC_C1_ST, CC_0 = 48, CC_9 = 57, CC_SEMI = 59, CC_M = 109, ESCAPES, linkCodePrefix, linkCodePrefixCharCodes, linkEndCode, linkEndCodeST, linkEndCodeC1ST;
|
|
155658
156218
|
var init_consts = __esm(() => {
|
|
155659
156219
|
CC_BEL = BEL2.charCodeAt(0);
|
|
155660
156220
|
CC_ESC = ESC2.charCodeAt(0);
|
|
155661
156221
|
CC_BACKSLASH = BACKSLASH.charCodeAt(0);
|
|
155662
156222
|
CC_CSI = CSI2.charCodeAt(0);
|
|
155663
|
-
CC_OSC =
|
|
156223
|
+
CC_OSC = OSC2.charCodeAt(0);
|
|
155664
156224
|
CC_C1_ST = C1_ST.charCodeAt(0);
|
|
155665
156225
|
ESCAPES = new Set([CC_ESC, 155]);
|
|
155666
|
-
linkCodePrefix = `${ESC2}${
|
|
156226
|
+
linkCodePrefix = `${ESC2}${OSC2}8;`;
|
|
155667
156227
|
linkCodePrefixCharCodes = linkCodePrefix.split("").map((char) => char.charCodeAt(0));
|
|
155668
|
-
linkEndCode = `${ESC2}${
|
|
155669
|
-
linkEndCodeST = `${ESC2}${
|
|
155670
|
-
linkEndCodeC1ST = `${ESC2}${
|
|
156228
|
+
linkEndCode = `${ESC2}${OSC2}8;;${BEL2}`;
|
|
156229
|
+
linkEndCodeST = `${ESC2}${OSC2}8;;${ESC2}${BACKSLASH}`;
|
|
156230
|
+
linkEndCodeC1ST = `${ESC2}${OSC2}8;;${C1_ST}`;
|
|
155671
156231
|
});
|
|
155672
156232
|
|
|
155673
156233
|
// node_modules/@alcalzone/ansi-tokenize/build/ansiCodes.js
|
|
@@ -161076,282 +161636,6 @@ var init_dec = __esm(() => {
|
|
|
161076
161636
|
DISABLE_MOUSE_TRACKING = decreset(DEC.MOUSE_SGR) + decreset(DEC.MOUSE_ANY) + decreset(DEC.MOUSE_BUTTON) + decreset(DEC.MOUSE_NORMAL);
|
|
161077
161637
|
});
|
|
161078
161638
|
|
|
161079
|
-
// src/tui/ink/termio/osc.ts
|
|
161080
|
-
import { Buffer as Buffer9 } from "buffer";
|
|
161081
|
-
function osc(...parts) {
|
|
161082
|
-
const terminator = env5.terminal === "kitty" ? ST : BEL;
|
|
161083
|
-
return `${OSC_PREFIX}${parts.join(SEP)}${terminator}`;
|
|
161084
|
-
}
|
|
161085
|
-
function wrapForMultiplexer(sequence) {
|
|
161086
|
-
if (process.env["TMUX"]) {
|
|
161087
|
-
const escaped = sequence.replaceAll("\x1B", "\x1B\x1B");
|
|
161088
|
-
return `\x1BPtmux;${escaped}\x1B\\`;
|
|
161089
|
-
}
|
|
161090
|
-
if (process.env["STY"]) {
|
|
161091
|
-
return `\x1BP${sequence}\x1B\\`;
|
|
161092
|
-
}
|
|
161093
|
-
return sequence;
|
|
161094
|
-
}
|
|
161095
|
-
function getClipboardPath() {
|
|
161096
|
-
const nativeAvailable = process.platform === "darwin" && !process.env["SSH_CONNECTION"];
|
|
161097
|
-
if (nativeAvailable)
|
|
161098
|
-
return "native";
|
|
161099
|
-
if (process.env["TMUX"])
|
|
161100
|
-
return "tmux-buffer";
|
|
161101
|
-
return "osc52";
|
|
161102
|
-
}
|
|
161103
|
-
function tmuxPassthrough(payload) {
|
|
161104
|
-
return `${ESC}Ptmux;${payload.replaceAll(ESC, ESC + ESC)}${ST}`;
|
|
161105
|
-
}
|
|
161106
|
-
async function tmuxLoadBuffer(text) {
|
|
161107
|
-
if (!process.env["TMUX"])
|
|
161108
|
-
return false;
|
|
161109
|
-
const args = process.env["LC_TERMINAL"] === "iTerm2" ? ["load-buffer", "-"] : ["load-buffer", "-w", "-"];
|
|
161110
|
-
const { code } = await execFileNoThrow3("tmux", args, {
|
|
161111
|
-
input: text,
|
|
161112
|
-
useCwd: false,
|
|
161113
|
-
timeout: 2000
|
|
161114
|
-
});
|
|
161115
|
-
return code === 0;
|
|
161116
|
-
}
|
|
161117
|
-
async function setClipboard(text) {
|
|
161118
|
-
const b64 = Buffer9.from(text, "utf8").toString("base64");
|
|
161119
|
-
const raw = osc(OSC2.CLIPBOARD, "c", b64);
|
|
161120
|
-
if (!process.env["SSH_CONNECTION"])
|
|
161121
|
-
copyNative(text);
|
|
161122
|
-
const tmuxBufferLoaded = await tmuxLoadBuffer(text);
|
|
161123
|
-
if (tmuxBufferLoaded)
|
|
161124
|
-
return tmuxPassthrough(`${ESC}]52;c;${b64}${BEL}`);
|
|
161125
|
-
return raw;
|
|
161126
|
-
}
|
|
161127
|
-
function copyNative(text) {
|
|
161128
|
-
const opts = { input: text, useCwd: false, timeout: 2000 };
|
|
161129
|
-
switch (process.platform) {
|
|
161130
|
-
case "darwin":
|
|
161131
|
-
execFileNoThrow3("pbcopy", [], opts);
|
|
161132
|
-
return;
|
|
161133
|
-
case "linux": {
|
|
161134
|
-
if (linuxCopy === null)
|
|
161135
|
-
return;
|
|
161136
|
-
if (linuxCopy === "wl-copy") {
|
|
161137
|
-
execFileNoThrow3("wl-copy", [], opts);
|
|
161138
|
-
return;
|
|
161139
|
-
}
|
|
161140
|
-
if (linuxCopy === "xclip") {
|
|
161141
|
-
execFileNoThrow3("xclip", ["-selection", "clipboard"], opts);
|
|
161142
|
-
return;
|
|
161143
|
-
}
|
|
161144
|
-
if (linuxCopy === "xsel") {
|
|
161145
|
-
execFileNoThrow3("xsel", ["--clipboard", "--input"], opts);
|
|
161146
|
-
return;
|
|
161147
|
-
}
|
|
161148
|
-
execFileNoThrow3("wl-copy", [], opts).then((r) => {
|
|
161149
|
-
if (r.code === 0) {
|
|
161150
|
-
linuxCopy = "wl-copy";
|
|
161151
|
-
return;
|
|
161152
|
-
}
|
|
161153
|
-
execFileNoThrow3("xclip", ["-selection", "clipboard"], opts).then((r2) => {
|
|
161154
|
-
if (r2.code === 0) {
|
|
161155
|
-
linuxCopy = "xclip";
|
|
161156
|
-
return;
|
|
161157
|
-
}
|
|
161158
|
-
execFileNoThrow3("xsel", ["--clipboard", "--input"], opts).then((r3) => {
|
|
161159
|
-
linuxCopy = r3.code === 0 ? "xsel" : null;
|
|
161160
|
-
});
|
|
161161
|
-
});
|
|
161162
|
-
});
|
|
161163
|
-
return;
|
|
161164
|
-
}
|
|
161165
|
-
case "win32":
|
|
161166
|
-
execFileNoThrow3("clip", [], opts);
|
|
161167
|
-
return;
|
|
161168
|
-
}
|
|
161169
|
-
}
|
|
161170
|
-
function parseOSC(content) {
|
|
161171
|
-
const semicolonIdx = content.indexOf(";");
|
|
161172
|
-
const command = semicolonIdx >= 0 ? content.slice(0, semicolonIdx) : content;
|
|
161173
|
-
const data = semicolonIdx >= 0 ? content.slice(semicolonIdx + 1) : "";
|
|
161174
|
-
const commandNum = parseInt(command, 10);
|
|
161175
|
-
if (commandNum === OSC2.SET_TITLE_AND_ICON) {
|
|
161176
|
-
return { type: "title", action: { type: "both", title: data } };
|
|
161177
|
-
}
|
|
161178
|
-
if (commandNum === OSC2.SET_ICON) {
|
|
161179
|
-
return { type: "title", action: { type: "iconName", name: data } };
|
|
161180
|
-
}
|
|
161181
|
-
if (commandNum === OSC2.SET_TITLE) {
|
|
161182
|
-
return { type: "title", action: { type: "windowTitle", title: data } };
|
|
161183
|
-
}
|
|
161184
|
-
if (commandNum === OSC2.HYPERLINK) {
|
|
161185
|
-
const parts = data.split(";");
|
|
161186
|
-
const paramsStr = parts[0] ?? "";
|
|
161187
|
-
const url = parts.slice(1).join(";");
|
|
161188
|
-
if (url === "") {
|
|
161189
|
-
return { type: "link", action: { type: "end" } };
|
|
161190
|
-
}
|
|
161191
|
-
const params = {};
|
|
161192
|
-
if (paramsStr) {
|
|
161193
|
-
for (const pair of paramsStr.split(":")) {
|
|
161194
|
-
const eqIdx = pair.indexOf("=");
|
|
161195
|
-
if (eqIdx >= 0) {
|
|
161196
|
-
params[pair.slice(0, eqIdx)] = pair.slice(eqIdx + 1);
|
|
161197
|
-
}
|
|
161198
|
-
}
|
|
161199
|
-
}
|
|
161200
|
-
return {
|
|
161201
|
-
type: "link",
|
|
161202
|
-
action: {
|
|
161203
|
-
type: "start",
|
|
161204
|
-
url,
|
|
161205
|
-
params: Object.keys(params).length > 0 ? params : undefined
|
|
161206
|
-
}
|
|
161207
|
-
};
|
|
161208
|
-
}
|
|
161209
|
-
if (commandNum === OSC2.TAB_STATUS) {
|
|
161210
|
-
return { type: "tabStatus", action: parseTabStatus(data) };
|
|
161211
|
-
}
|
|
161212
|
-
return { type: "unknown", sequence: `\x1B]${content}` };
|
|
161213
|
-
}
|
|
161214
|
-
function parseOscColor(spec) {
|
|
161215
|
-
const hex = spec.match(/^#([0-9a-f]{2})([0-9a-f]{2})([0-9a-f]{2})$/i);
|
|
161216
|
-
if (hex) {
|
|
161217
|
-
return {
|
|
161218
|
-
type: "rgb",
|
|
161219
|
-
r: parseInt(hex[1], 16),
|
|
161220
|
-
g: parseInt(hex[2], 16),
|
|
161221
|
-
b: parseInt(hex[3], 16)
|
|
161222
|
-
};
|
|
161223
|
-
}
|
|
161224
|
-
const rgb = spec.match(/^rgb:([0-9a-f]{1,4})\/([0-9a-f]{1,4})\/([0-9a-f]{1,4})$/i);
|
|
161225
|
-
if (rgb) {
|
|
161226
|
-
const scale = (s) => Math.round(parseInt(s, 16) / (16 ** s.length - 1) * 255);
|
|
161227
|
-
return {
|
|
161228
|
-
type: "rgb",
|
|
161229
|
-
r: scale(rgb[1]),
|
|
161230
|
-
g: scale(rgb[2]),
|
|
161231
|
-
b: scale(rgb[3])
|
|
161232
|
-
};
|
|
161233
|
-
}
|
|
161234
|
-
return null;
|
|
161235
|
-
}
|
|
161236
|
-
function parseTabStatus(data) {
|
|
161237
|
-
const action = {};
|
|
161238
|
-
for (const [key, value] of splitTabStatusPairs(data)) {
|
|
161239
|
-
switch (key) {
|
|
161240
|
-
case "indicator":
|
|
161241
|
-
action.indicator = value === "" ? null : parseOscColor(value);
|
|
161242
|
-
break;
|
|
161243
|
-
case "status":
|
|
161244
|
-
action.status = value === "" ? null : value;
|
|
161245
|
-
break;
|
|
161246
|
-
case "status-color":
|
|
161247
|
-
action.statusColor = value === "" ? null : parseOscColor(value);
|
|
161248
|
-
break;
|
|
161249
|
-
}
|
|
161250
|
-
}
|
|
161251
|
-
return action;
|
|
161252
|
-
}
|
|
161253
|
-
function* splitTabStatusPairs(data) {
|
|
161254
|
-
let key = "";
|
|
161255
|
-
let val = "";
|
|
161256
|
-
let inVal = false;
|
|
161257
|
-
let esc = false;
|
|
161258
|
-
for (const c of data) {
|
|
161259
|
-
if (esc) {
|
|
161260
|
-
if (inVal)
|
|
161261
|
-
val += c;
|
|
161262
|
-
else
|
|
161263
|
-
key += c;
|
|
161264
|
-
esc = false;
|
|
161265
|
-
} else if (c === "\\") {
|
|
161266
|
-
esc = true;
|
|
161267
|
-
} else if (c === ";") {
|
|
161268
|
-
yield [key, val];
|
|
161269
|
-
key = "";
|
|
161270
|
-
val = "";
|
|
161271
|
-
inVal = false;
|
|
161272
|
-
} else if (c === "=" && !inVal) {
|
|
161273
|
-
inVal = true;
|
|
161274
|
-
} else if (inVal) {
|
|
161275
|
-
val += c;
|
|
161276
|
-
} else {
|
|
161277
|
-
key += c;
|
|
161278
|
-
}
|
|
161279
|
-
}
|
|
161280
|
-
if (key || inVal)
|
|
161281
|
-
yield [key, val];
|
|
161282
|
-
}
|
|
161283
|
-
function link(url, params) {
|
|
161284
|
-
if (!url)
|
|
161285
|
-
return LINK_END;
|
|
161286
|
-
const p = { id: osc8Id(url), ...params };
|
|
161287
|
-
const paramStr = Object.entries(p).map(([k, v]) => `${k}=${v}`).join(":");
|
|
161288
|
-
return osc(OSC2.HYPERLINK, paramStr, url);
|
|
161289
|
-
}
|
|
161290
|
-
function osc8Id(url) {
|
|
161291
|
-
let h = 0;
|
|
161292
|
-
for (let i = 0;i < url.length; i++)
|
|
161293
|
-
h = (h << 5) - h + url.charCodeAt(i) | 0;
|
|
161294
|
-
return (h >>> 0).toString(36);
|
|
161295
|
-
}
|
|
161296
|
-
function supportsTabStatus() {
|
|
161297
|
-
return false;
|
|
161298
|
-
}
|
|
161299
|
-
function tabStatus(fields) {
|
|
161300
|
-
const parts = [];
|
|
161301
|
-
const rgb = (c) => c.type === "rgb" ? `#${[c.r, c.g, c.b].map((n) => n.toString(16).padStart(2, "0")).join("")}` : "";
|
|
161302
|
-
if ("indicator" in fields)
|
|
161303
|
-
parts.push(`indicator=${fields.indicator ? rgb(fields.indicator) : ""}`);
|
|
161304
|
-
if ("status" in fields)
|
|
161305
|
-
parts.push(`status=${fields.status?.replaceAll("\\", "\\\\").replaceAll(";", "\\;") ?? ""}`);
|
|
161306
|
-
if ("statusColor" in fields)
|
|
161307
|
-
parts.push(`status-color=${fields.statusColor ? rgb(fields.statusColor) : ""}`);
|
|
161308
|
-
return osc(OSC2.TAB_STATUS, parts.join(";"));
|
|
161309
|
-
}
|
|
161310
|
-
var OSC_PREFIX, ST, linuxCopy, OSC2, LINK_END, ITERM2, PROGRESS, CLEAR_ITERM2_PROGRESS, CLEAR_TERMINAL_TITLE, CLEAR_TAB_STATUS;
|
|
161311
|
-
var init_osc = __esm(() => {
|
|
161312
|
-
init_env2();
|
|
161313
|
-
init_execFileNoThrow2();
|
|
161314
|
-
init_ansi();
|
|
161315
|
-
OSC_PREFIX = ESC + String.fromCharCode(ESC_TYPE.OSC);
|
|
161316
|
-
ST = ESC + "\\";
|
|
161317
|
-
OSC2 = {
|
|
161318
|
-
SET_TITLE_AND_ICON: 0,
|
|
161319
|
-
SET_ICON: 1,
|
|
161320
|
-
SET_TITLE: 2,
|
|
161321
|
-
SET_COLOR: 4,
|
|
161322
|
-
SET_CWD: 7,
|
|
161323
|
-
HYPERLINK: 8,
|
|
161324
|
-
ITERM2: 9,
|
|
161325
|
-
SET_FG_COLOR: 10,
|
|
161326
|
-
SET_BG_COLOR: 11,
|
|
161327
|
-
SET_CURSOR_COLOR: 12,
|
|
161328
|
-
CLIPBOARD: 52,
|
|
161329
|
-
KITTY: 99,
|
|
161330
|
-
RESET_COLOR: 104,
|
|
161331
|
-
RESET_FG_COLOR: 110,
|
|
161332
|
-
RESET_BG_COLOR: 111,
|
|
161333
|
-
RESET_CURSOR_COLOR: 112,
|
|
161334
|
-
SEMANTIC_PROMPT: 133,
|
|
161335
|
-
GHOSTTY: 777,
|
|
161336
|
-
TAB_STATUS: 21337
|
|
161337
|
-
};
|
|
161338
|
-
LINK_END = osc(OSC2.HYPERLINK, "", "");
|
|
161339
|
-
ITERM2 = {
|
|
161340
|
-
NOTIFY: 0,
|
|
161341
|
-
BADGE: 2,
|
|
161342
|
-
PROGRESS: 4
|
|
161343
|
-
};
|
|
161344
|
-
PROGRESS = {
|
|
161345
|
-
CLEAR: 0,
|
|
161346
|
-
SET: 1,
|
|
161347
|
-
ERROR: 2,
|
|
161348
|
-
INDETERMINATE: 3
|
|
161349
|
-
};
|
|
161350
|
-
CLEAR_ITERM2_PROGRESS = `${OSC_PREFIX}${OSC2.ITERM2};${ITERM2.PROGRESS};${PROGRESS.CLEAR};${BEL}`;
|
|
161351
|
-
CLEAR_TERMINAL_TITLE = `${OSC_PREFIX}${OSC2.SET_TITLE_AND_ICON};${BEL}`;
|
|
161352
|
-
CLEAR_TAB_STATUS = osc(OSC2.TAB_STATUS, "indicator=;status=;status-color=");
|
|
161353
|
-
});
|
|
161354
|
-
|
|
161355
161639
|
// src/tui/ink/terminal.ts
|
|
161356
161640
|
function isProgressReportingAvailable() {
|
|
161357
161641
|
if (!process.stdout.isTTY) {
|
|
@@ -161514,64 +161798,6 @@ var init_terminal_focus_state = __esm(() => {
|
|
|
161514
161798
|
subscribers = new Set;
|
|
161515
161799
|
});
|
|
161516
161800
|
|
|
161517
|
-
// src/tui/ink/terminal-querier.ts
|
|
161518
|
-
function xtversion() {
|
|
161519
|
-
return {
|
|
161520
|
-
request: csi(">0q"),
|
|
161521
|
-
match: (r) => r.type === "xtversion"
|
|
161522
|
-
};
|
|
161523
|
-
}
|
|
161524
|
-
|
|
161525
|
-
class TerminalQuerier {
|
|
161526
|
-
stdout;
|
|
161527
|
-
queue = [];
|
|
161528
|
-
constructor(stdout) {
|
|
161529
|
-
this.stdout = stdout;
|
|
161530
|
-
}
|
|
161531
|
-
send(query) {
|
|
161532
|
-
return new Promise((resolve) => {
|
|
161533
|
-
this.queue.push({
|
|
161534
|
-
kind: "query",
|
|
161535
|
-
match: query.match,
|
|
161536
|
-
resolve: (r) => resolve(r)
|
|
161537
|
-
});
|
|
161538
|
-
this.stdout.write(query.request);
|
|
161539
|
-
});
|
|
161540
|
-
}
|
|
161541
|
-
flush() {
|
|
161542
|
-
return new Promise((resolve) => {
|
|
161543
|
-
this.queue.push({ kind: "sentinel", resolve });
|
|
161544
|
-
this.stdout.write(SENTINEL);
|
|
161545
|
-
});
|
|
161546
|
-
}
|
|
161547
|
-
onResponse(r) {
|
|
161548
|
-
const idx = this.queue.findIndex((p) => p.kind === "query" && p.match(r));
|
|
161549
|
-
if (idx !== -1) {
|
|
161550
|
-
const [q] = this.queue.splice(idx, 1);
|
|
161551
|
-
if (q?.kind === "query")
|
|
161552
|
-
q.resolve(r);
|
|
161553
|
-
return;
|
|
161554
|
-
}
|
|
161555
|
-
if (r.type === "da1") {
|
|
161556
|
-
const s = this.queue.findIndex((p) => p.kind === "sentinel");
|
|
161557
|
-
if (s === -1)
|
|
161558
|
-
return;
|
|
161559
|
-
for (const p of this.queue.splice(0, s + 1)) {
|
|
161560
|
-
if (p.kind === "query")
|
|
161561
|
-
p.resolve(undefined);
|
|
161562
|
-
else
|
|
161563
|
-
p.resolve();
|
|
161564
|
-
}
|
|
161565
|
-
}
|
|
161566
|
-
}
|
|
161567
|
-
}
|
|
161568
|
-
var SENTINEL;
|
|
161569
|
-
var init_terminal_querier = __esm(() => {
|
|
161570
|
-
init_csi();
|
|
161571
|
-
init_osc();
|
|
161572
|
-
SENTINEL = csi("c");
|
|
161573
|
-
});
|
|
161574
|
-
|
|
161575
161801
|
// src/tui/ink/components/AppContext.ts
|
|
161576
161802
|
var import_react4, AppContext, AppContext_default;
|
|
161577
161803
|
var init_AppContext = __esm(() => {
|
|
@@ -165990,7 +166216,7 @@ function useTerminalNotification() {
|
|
|
165990
166216
|
const notifyITerm2 = import_react11.useCallback(({ message, title }) => {
|
|
165991
166217
|
const displayString = title ? `${title}:
|
|
165992
166218
|
${message}` : message;
|
|
165993
|
-
writeRaw(wrapForMultiplexer(osc(
|
|
166219
|
+
writeRaw(wrapForMultiplexer(osc(OSC.ITERM2, `
|
|
165994
166220
|
|
|
165995
166221
|
${displayString}`)));
|
|
165996
166222
|
}, [writeRaw]);
|
|
@@ -165999,12 +166225,12 @@ ${displayString}`)));
|
|
|
165999
166225
|
title,
|
|
166000
166226
|
id
|
|
166001
166227
|
}) => {
|
|
166002
|
-
writeRaw(wrapForMultiplexer(osc(
|
|
166003
|
-
writeRaw(wrapForMultiplexer(osc(
|
|
166004
|
-
writeRaw(wrapForMultiplexer(osc(
|
|
166228
|
+
writeRaw(wrapForMultiplexer(osc(OSC.KITTY, `i=${id}:d=0:p=title`, title)));
|
|
166229
|
+
writeRaw(wrapForMultiplexer(osc(OSC.KITTY, `i=${id}:p=body`, message)));
|
|
166230
|
+
writeRaw(wrapForMultiplexer(osc(OSC.KITTY, `i=${id}:d=1:a=focus`, "")));
|
|
166005
166231
|
}, [writeRaw]);
|
|
166006
166232
|
const notifyGhostty = import_react11.useCallback(({ message, title }) => {
|
|
166007
|
-
writeRaw(wrapForMultiplexer(osc(
|
|
166233
|
+
writeRaw(wrapForMultiplexer(osc(OSC.GHOSTTY, "notify", title, message)));
|
|
166008
166234
|
}, [writeRaw]);
|
|
166009
166235
|
const notifyBell = import_react11.useCallback(() => {
|
|
166010
166236
|
writeRaw(BEL);
|
|
@@ -166014,22 +166240,22 @@ ${displayString}`)));
|
|
|
166014
166240
|
return;
|
|
166015
166241
|
}
|
|
166016
166242
|
if (!state) {
|
|
166017
|
-
writeRaw(wrapForMultiplexer(osc(
|
|
166243
|
+
writeRaw(wrapForMultiplexer(osc(OSC.ITERM2, ITERM2.PROGRESS, PROGRESS.CLEAR, "")));
|
|
166018
166244
|
return;
|
|
166019
166245
|
}
|
|
166020
166246
|
const pct = Math.max(0, Math.min(100, Math.round(percentage ?? 0)));
|
|
166021
166247
|
switch (state) {
|
|
166022
166248
|
case "completed":
|
|
166023
|
-
writeRaw(wrapForMultiplexer(osc(
|
|
166249
|
+
writeRaw(wrapForMultiplexer(osc(OSC.ITERM2, ITERM2.PROGRESS, PROGRESS.CLEAR, "")));
|
|
166024
166250
|
break;
|
|
166025
166251
|
case "error":
|
|
166026
|
-
writeRaw(wrapForMultiplexer(osc(
|
|
166252
|
+
writeRaw(wrapForMultiplexer(osc(OSC.ITERM2, ITERM2.PROGRESS, PROGRESS.ERROR, pct)));
|
|
166027
166253
|
break;
|
|
166028
166254
|
case "indeterminate":
|
|
166029
|
-
writeRaw(wrapForMultiplexer(osc(
|
|
166255
|
+
writeRaw(wrapForMultiplexer(osc(OSC.ITERM2, ITERM2.PROGRESS, PROGRESS.INDETERMINATE, "")));
|
|
166030
166256
|
break;
|
|
166031
166257
|
case "running":
|
|
166032
|
-
writeRaw(wrapForMultiplexer(osc(
|
|
166258
|
+
writeRaw(wrapForMultiplexer(osc(OSC.ITERM2, ITERM2.PROGRESS, PROGRESS.SET, pct)));
|
|
166033
166259
|
break;
|
|
166034
166260
|
case null:
|
|
166035
166261
|
break;
|
|
@@ -169531,7 +169757,7 @@ function useTerminalTitle(title) {
|
|
|
169531
169757
|
if (process.platform === "win32") {
|
|
169532
169758
|
process.title = clean;
|
|
169533
169759
|
} else {
|
|
169534
|
-
writeRaw(osc(
|
|
169760
|
+
writeRaw(osc(OSC.SET_TITLE_AND_ICON, clean));
|
|
169535
169761
|
}
|
|
169536
169762
|
}, [title, writeRaw]);
|
|
169537
169763
|
}
|
|
@@ -185241,7 +185467,7 @@ var init_shellRuleMatching2 = __esm(() => {
|
|
|
185241
185467
|
});
|
|
185242
185468
|
|
|
185243
185469
|
// src/kernel/utils/sleep.ts
|
|
185244
|
-
function
|
|
185470
|
+
function sleep10(ms, signal, opts) {
|
|
185245
185471
|
return new Promise((resolve, reject) => {
|
|
185246
185472
|
if (signal?.aborted) {
|
|
185247
185473
|
if (opts?.throwOnAbort || opts?.abortError) {
|
|
@@ -185776,7 +186002,7 @@ async function cleanupWorktree2() {
|
|
|
185776
186002
|
activeWorktreeSession: undefined
|
|
185777
186003
|
}));
|
|
185778
186004
|
if (!hookBased && worktreeBranch) {
|
|
185779
|
-
await
|
|
186005
|
+
await sleep10(100);
|
|
185780
186006
|
const { code: deleteBranchCode, stderr: deleteBranchError } = await execFileNoThrowWithCwd2(gitExe2(), ["branch", "-D", worktreeBranch], { cwd: originalCwd });
|
|
185781
186007
|
if (deleteBranchCode !== 0) {
|
|
185782
186008
|
logForDebugging3(`Could not delete worktree branch: ${deleteBranchError}`, { level: "error" });
|
|
@@ -216975,7 +217201,7 @@ class ClaudeAuthProvider {
|
|
|
216975
217201
|
const code = getErrnoCode2(e);
|
|
216976
217202
|
if (code === "ELOCKED") {
|
|
216977
217203
|
logMCPDebug(this.serverName, `Refresh lock held by another process, waiting (attempt ${retry + 1}/${MAX_LOCK_RETRIES})`);
|
|
216978
|
-
await
|
|
217204
|
+
await sleep10(1000 + Math.random() * 1000);
|
|
216979
217205
|
continue;
|
|
216980
217206
|
}
|
|
216981
217207
|
logMCPDebug(this.serverName, `Failed to acquire refresh lock: ${code}, proceeding without lock`);
|
|
@@ -217104,7 +217330,7 @@ class ClaudeAuthProvider {
|
|
|
217104
217330
|
}
|
|
217105
217331
|
const delayMs = 1000 * Math.pow(2, attempt - 1);
|
|
217106
217332
|
logMCPDebug(this.serverName, `Token refresh failed, retrying in ${delayMs}ms (attempt ${attempt}/${MAX_ATTEMPTS})`);
|
|
217107
|
-
await
|
|
217333
|
+
await sleep10(delayMs);
|
|
217108
217334
|
}
|
|
217109
217335
|
}
|
|
217110
217336
|
return;
|
|
@@ -223202,7 +223428,7 @@ async function flushPromptHistory(retries) {
|
|
|
223202
223428
|
} finally {
|
|
223203
223429
|
isWriting = false;
|
|
223204
223430
|
if (pendingEntries.length > 0) {
|
|
223205
|
-
await
|
|
223431
|
+
await sleep10(500);
|
|
223206
223432
|
flushPromptHistory(retries + 1);
|
|
223207
223433
|
}
|
|
223208
223434
|
}
|
|
@@ -228328,7 +228554,7 @@ function isBareEscape(parts) {
|
|
|
228328
228554
|
}
|
|
228329
228555
|
async function moveAndSettle(input, x, y) {
|
|
228330
228556
|
await input.moveMouse(x, y, false);
|
|
228331
|
-
await
|
|
228557
|
+
await sleep10(MOVE_SETTLE_MS);
|
|
228332
228558
|
}
|
|
228333
228559
|
async function releasePressed(input, pressed) {
|
|
228334
228560
|
let k;
|
|
@@ -228363,7 +228589,7 @@ async function typeViaClipboard(input, text) {
|
|
|
228363
228589
|
throw new Error("Clipboard write did not round-trip.");
|
|
228364
228590
|
}
|
|
228365
228591
|
await input.keys(["command", "v"]);
|
|
228366
|
-
await
|
|
228592
|
+
await sleep10(100);
|
|
228367
228593
|
} finally {
|
|
228368
228594
|
if (typeof saved === "string") {
|
|
228369
228595
|
try {
|
|
@@ -228398,10 +228624,10 @@ async function animatedMove(input, targetX, targetY, mouseAnimationEnabled) {
|
|
|
228398
228624
|
const eased = 1 - Math.pow(1 - t, 3);
|
|
228399
228625
|
await input.moveMouse(Math.round(start.x + deltaX * eased), Math.round(start.y + deltaY * eased), false);
|
|
228400
228626
|
if (frame < totalFrames) {
|
|
228401
|
-
await
|
|
228627
|
+
await sleep10(frameIntervalMs);
|
|
228402
228628
|
}
|
|
228403
228629
|
}
|
|
228404
|
-
await
|
|
228630
|
+
await sleep10(MOVE_SETTLE_MS);
|
|
228405
228631
|
}
|
|
228406
228632
|
function createCliExecutor(opts) {
|
|
228407
228633
|
if (process.platform !== "darwin") {
|
|
@@ -228470,7 +228696,7 @@ function createCliExecutor(opts) {
|
|
|
228470
228696
|
await drainRunLoop(async () => {
|
|
228471
228697
|
for (let i = 0;i < n; i++) {
|
|
228472
228698
|
if (i > 0) {
|
|
228473
|
-
await
|
|
228699
|
+
await sleep10(8);
|
|
228474
228700
|
}
|
|
228475
228701
|
if (isEsc) {
|
|
228476
228702
|
notifyExpectedEscape();
|
|
@@ -228495,7 +228721,7 @@ function createCliExecutor(opts) {
|
|
|
228495
228721
|
pressed.push(k);
|
|
228496
228722
|
}
|
|
228497
228723
|
});
|
|
228498
|
-
await
|
|
228724
|
+
await sleep10(durationMs);
|
|
228499
228725
|
} finally {
|
|
228500
228726
|
orphaned = true;
|
|
228501
228727
|
await drainRunLoop(() => releasePressed(input, pressed));
|
|
@@ -228538,7 +228764,7 @@ function createCliExecutor(opts) {
|
|
|
228538
228764
|
await moveAndSettle(input, from.x, from.y);
|
|
228539
228765
|
}
|
|
228540
228766
|
await input.mouseButton("left", "press");
|
|
228541
|
-
await
|
|
228767
|
+
await sleep10(MOVE_SETTLE_MS);
|
|
228542
228768
|
try {
|
|
228543
228769
|
await animatedMove(input, to.x, to.y, getMouseAnimationEnabled());
|
|
228544
228770
|
} finally {
|
|
@@ -233396,7 +233622,7 @@ var init_client4 = __esm(() => {
|
|
|
233396
233622
|
}
|
|
233397
233623
|
}, 600);
|
|
233398
233624
|
try {
|
|
233399
|
-
await
|
|
233625
|
+
await sleep10(100);
|
|
233400
233626
|
if (!resolved) {
|
|
233401
233627
|
try {
|
|
233402
233628
|
process.kill(childPid, 0);
|
|
@@ -233418,7 +233644,7 @@ var init_client4 = __esm(() => {
|
|
|
233418
233644
|
resolve();
|
|
233419
233645
|
return;
|
|
233420
233646
|
}
|
|
233421
|
-
await
|
|
233647
|
+
await sleep10(400);
|
|
233422
233648
|
if (!resolved) {
|
|
233423
233649
|
try {
|
|
233424
233650
|
process.kill(childPid, 0);
|
|
@@ -234417,7 +234643,7 @@ async function findAvailableIDE() {
|
|
|
234417
234643
|
const startTime = Date.now();
|
|
234418
234644
|
while (Date.now() - startTime < 30000 && !signal.aborted) {
|
|
234419
234645
|
if (getIsScrollDraining()) {
|
|
234420
|
-
await
|
|
234646
|
+
await sleep10(1000, signal);
|
|
234421
234647
|
continue;
|
|
234422
234648
|
}
|
|
234423
234649
|
const ides = await detectIDEs(false);
|
|
@@ -234427,7 +234653,7 @@ async function findAvailableIDE() {
|
|
|
234427
234653
|
if (ides.length === 1) {
|
|
234428
234654
|
return ides[0];
|
|
234429
234655
|
}
|
|
234430
|
-
await
|
|
234656
|
+
await sleep10(1000, signal);
|
|
234431
234657
|
}
|
|
234432
234658
|
return null;
|
|
234433
234659
|
}
|
|
@@ -234555,7 +234781,7 @@ async function installIDEExtension(ideType) {
|
|
|
234555
234781
|
if (command) {
|
|
234556
234782
|
let version = await getInstalledVSCodeExtensionVersion(command);
|
|
234557
234783
|
if (!version || lt2(version, getClaudeCodeVersion())) {
|
|
234558
|
-
await
|
|
234784
|
+
await sleep10(500);
|
|
234559
234785
|
const result = await execFileNoThrowWithCwd2(command, ["--force", "--install-extension", "atlas-code"], {
|
|
234560
234786
|
env: getInstallationEnv()
|
|
234561
234787
|
});
|
|
@@ -254740,7 +254966,7 @@ function createLSPServerInstance2(name, config) {
|
|
|
254740
254966
|
if (isContentModifiedError && attempt < MAX_RETRIES_FOR_TRANSIENT_ERRORS) {
|
|
254741
254967
|
const delay = RETRY_BASE_DELAY_MS * Math.pow(2, attempt);
|
|
254742
254968
|
logForDebugging3(`LSP request '${method}' to '${name}' got ContentModified error, ` + `retrying in ${delay}ms (attempt ${attempt + 1}/${MAX_RETRIES_FOR_TRANSIENT_ERRORS})…`);
|
|
254743
|
-
await
|
|
254969
|
+
await sleep10(delay);
|
|
254744
254970
|
continue;
|
|
254745
254971
|
}
|
|
254746
254972
|
break;
|
|
@@ -328186,7 +328412,7 @@ async function waitForTaskCompletion2(taskId, getAppState, timeoutMs, abortContr
|
|
|
328186
328412
|
if (task.status !== "running" && task.status !== "pending") {
|
|
328187
328413
|
return task;
|
|
328188
328414
|
}
|
|
328189
|
-
await
|
|
328415
|
+
await sleep10(100);
|
|
328190
328416
|
}
|
|
328191
328417
|
const finalState = getAppState();
|
|
328192
328418
|
return finalState.tasks?.[taskId] ?? null;
|
|
@@ -359439,7 +359665,7 @@ async function waitForSessionMemoryExtraction2() {
|
|
|
359439
359665
|
if (Date.now() - startTime > EXTRACTION_WAIT_TIMEOUT_MS2) {
|
|
359440
359666
|
return;
|
|
359441
359667
|
}
|
|
359442
|
-
await
|
|
359668
|
+
await sleep10(1000);
|
|
359443
359669
|
}
|
|
359444
359670
|
}
|
|
359445
359671
|
async function getSessionMemoryContent2() {
|
|
@@ -361424,7 +361650,7 @@ async function tryWithVersionLock(versionFilePath, callback, retries = 0) {
|
|
|
361424
361650
|
attempts++;
|
|
361425
361651
|
if (attempts < maxAttempts) {
|
|
361426
361652
|
const timeout = Math.min(minTimeout * Math.pow(2, attempts - 1), maxTimeout);
|
|
361427
|
-
await
|
|
361653
|
+
await sleep10(timeout);
|
|
361428
361654
|
}
|
|
361429
361655
|
}
|
|
361430
361656
|
logLockAcquisitionError(versionFilePath, new Error("Lock held by another process"));
|
|
@@ -387319,7 +387545,7 @@ function VirtualMessageList({
|
|
|
387319
387545
|
let workMs = 0;
|
|
387320
387546
|
const wallStart = performance.now();
|
|
387321
387547
|
for (let i = 0;i < msgs.length; i += CHUNK) {
|
|
387322
|
-
await
|
|
387548
|
+
await sleep10(0);
|
|
387323
387549
|
const t0 = performance.now();
|
|
387324
387550
|
const end = Math.min(i + CHUNK, msgs.length);
|
|
387325
387551
|
for (let j = i;j < end; j++) {
|
|
@@ -429004,7 +429230,7 @@ function useVoice({
|
|
|
429004
429230
|
connectionRef.current = null;
|
|
429005
429231
|
}
|
|
429006
429232
|
const replayBuffer = fullAudioRef.current;
|
|
429007
|
-
await
|
|
429233
|
+
await sleep10(250);
|
|
429008
429234
|
if (isStale())
|
|
429009
429235
|
return;
|
|
429010
429236
|
const stt = normalizeLanguageForSTT(getInitialSettings2().language);
|
|
@@ -440243,7 +440469,7 @@ async function streamCompactSummary({
|
|
|
440243
440469
|
return response;
|
|
440244
440470
|
}
|
|
440245
440471
|
if (attempt < maxAttempts) {
|
|
440246
|
-
await
|
|
440472
|
+
await sleep10(getRetryDelay(attempt), context.abortController.signal, {
|
|
440247
440473
|
abortError: () => new APIUserAbortError2
|
|
440248
440474
|
});
|
|
440249
440475
|
continue;
|
|
@@ -448718,9 +448944,9 @@ var init_pyright = __esm(() => {
|
|
|
448718
448944
|
});
|
|
448719
448945
|
|
|
448720
448946
|
// src/kernel/shell/bash/specs/sleep.ts
|
|
448721
|
-
var
|
|
448947
|
+
var sleep11, sleep_default;
|
|
448722
448948
|
var init_sleep = __esm(() => {
|
|
448723
|
-
|
|
448949
|
+
sleep11 = {
|
|
448724
448950
|
name: "sleep",
|
|
448725
448951
|
description: "Delay for a specified amount of time",
|
|
448726
448952
|
args: {
|
|
@@ -448729,7 +448955,7 @@ var init_sleep = __esm(() => {
|
|
|
448729
448955
|
isOptional: false
|
|
448730
448956
|
}
|
|
448731
448957
|
};
|
|
448732
|
-
sleep_default =
|
|
448958
|
+
sleep_default = sleep11;
|
|
448733
448959
|
});
|
|
448734
448960
|
|
|
448735
448961
|
// src/kernel/shell/bash/specs/srun.ts
|
|
@@ -499875,7 +500101,7 @@ async function main2() {
|
|
|
499875
500101
|
profileCheckpoint("main_client_type_determined");
|
|
499876
500102
|
eagerLoadSettings2();
|
|
499877
500103
|
profileCheckpoint("main_before_run");
|
|
499878
|
-
await
|
|
500104
|
+
await run2();
|
|
499879
500105
|
profileCheckpoint("main_after_run");
|
|
499880
500106
|
}
|
|
499881
500107
|
async function getInputPrompt2(prompt, inputFormat) {
|
|
@@ -499900,7 +500126,7 @@ async function getInputPrompt2(prompt, inputFormat) {
|
|
|
499900
500126
|
}
|
|
499901
500127
|
return prompt;
|
|
499902
500128
|
}
|
|
499903
|
-
async function
|
|
500129
|
+
async function run2() {
|
|
499904
500130
|
profileCheckpoint("run_function_start");
|
|
499905
500131
|
function createSortedHelpConfig() {
|
|
499906
500132
|
const getOptionSortKey = (opt) => opt.long?.replace(/^--/, "") ?? opt.short?.replace(/^-/, "") ?? "";
|