@letta-ai/letta-code 0.14.6 → 0.14.7
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/letta.js +767 -361
- package/package.json +1 -1
package/letta.js
CHANGED
|
@@ -3108,7 +3108,7 @@ var package_default;
|
|
|
3108
3108
|
var init_package = __esm(() => {
|
|
3109
3109
|
package_default = {
|
|
3110
3110
|
name: "@letta-ai/letta-code",
|
|
3111
|
-
version: "0.14.
|
|
3111
|
+
version: "0.14.7",
|
|
3112
3112
|
description: "Letta Code is a CLI tool for interacting with stateful Letta agents from the terminal.",
|
|
3113
3113
|
type: "module",
|
|
3114
3114
|
bin: {
|
|
@@ -30822,7 +30822,7 @@ var DEFAULT_AGENT_NAME = "Nameless Agent", INTERRUPTED_BY_USER = "Interrupted by
|
|
|
30822
30822
|
var init_constants = __esm(() => {
|
|
30823
30823
|
SYSTEM_REMINDER_OPEN = `<${SYSTEM_REMINDER_TAG}>`;
|
|
30824
30824
|
SYSTEM_REMINDER_CLOSE = `</${SYSTEM_REMINDER_TAG}>`;
|
|
30825
|
-
ELAPSED_DISPLAY_THRESHOLD_MS =
|
|
30825
|
+
ELAPSED_DISPLAY_THRESHOLD_MS = 60 * 1000;
|
|
30826
30826
|
});
|
|
30827
30827
|
|
|
30828
30828
|
// src/cli/hooks/useTerminalWidth.ts
|
|
@@ -62238,6 +62238,13 @@ class SessionStats {
|
|
|
62238
62238
|
sessionStartMs;
|
|
62239
62239
|
totalApiMs;
|
|
62240
62240
|
usage;
|
|
62241
|
+
lastUsageSnapshot;
|
|
62242
|
+
trajectoryStartMs;
|
|
62243
|
+
trajectoryApiMs;
|
|
62244
|
+
trajectoryLocalMs;
|
|
62245
|
+
trajectoryWallMs;
|
|
62246
|
+
trajectoryStepCount;
|
|
62247
|
+
trajectoryTokens;
|
|
62241
62248
|
constructor() {
|
|
62242
62249
|
this.sessionStartMs = performance.now();
|
|
62243
62250
|
this.totalApiMs = 0;
|
|
@@ -62249,12 +62256,81 @@ class SessionStats {
|
|
|
62249
62256
|
reasoningTokens: 0,
|
|
62250
62257
|
stepCount: 0
|
|
62251
62258
|
};
|
|
62259
|
+
this.lastUsageSnapshot = { ...this.usage };
|
|
62260
|
+
this.trajectoryStartMs = null;
|
|
62261
|
+
this.trajectoryApiMs = 0;
|
|
62262
|
+
this.trajectoryLocalMs = 0;
|
|
62263
|
+
this.trajectoryWallMs = 0;
|
|
62264
|
+
this.trajectoryStepCount = 0;
|
|
62265
|
+
this.trajectoryTokens = 0;
|
|
62252
62266
|
}
|
|
62253
62267
|
endTurn(apiDurationMs) {
|
|
62254
62268
|
this.totalApiMs += apiDurationMs;
|
|
62255
62269
|
}
|
|
62256
62270
|
updateUsageFromBuffers(buffers) {
|
|
62257
|
-
|
|
62271
|
+
const nextUsage = { ...buffers.usage };
|
|
62272
|
+
const prevUsage = this.lastUsageSnapshot;
|
|
62273
|
+
const delta = {
|
|
62274
|
+
promptTokens: Math.max(0, nextUsage.promptTokens - prevUsage.promptTokens),
|
|
62275
|
+
completionTokens: Math.max(0, nextUsage.completionTokens - prevUsage.completionTokens),
|
|
62276
|
+
totalTokens: Math.max(0, nextUsage.totalTokens - prevUsage.totalTokens),
|
|
62277
|
+
cachedTokens: Math.max(0, nextUsage.cachedTokens - prevUsage.cachedTokens),
|
|
62278
|
+
reasoningTokens: Math.max(0, nextUsage.reasoningTokens - prevUsage.reasoningTokens),
|
|
62279
|
+
stepCount: Math.max(0, nextUsage.stepCount - prevUsage.stepCount)
|
|
62280
|
+
};
|
|
62281
|
+
this.usage = nextUsage;
|
|
62282
|
+
this.lastUsageSnapshot = nextUsage;
|
|
62283
|
+
return delta;
|
|
62284
|
+
}
|
|
62285
|
+
startTrajectory() {
|
|
62286
|
+
if (this.trajectoryStartMs === null) {
|
|
62287
|
+
this.trajectoryStartMs = performance.now();
|
|
62288
|
+
}
|
|
62289
|
+
}
|
|
62290
|
+
accumulateTrajectory(options) {
|
|
62291
|
+
this.startTrajectory();
|
|
62292
|
+
if (options.apiDurationMs) {
|
|
62293
|
+
this.trajectoryApiMs += options.apiDurationMs;
|
|
62294
|
+
}
|
|
62295
|
+
if (options.localToolMs) {
|
|
62296
|
+
this.trajectoryLocalMs += options.localToolMs;
|
|
62297
|
+
}
|
|
62298
|
+
if (options.wallMs) {
|
|
62299
|
+
this.trajectoryWallMs += options.wallMs;
|
|
62300
|
+
}
|
|
62301
|
+
if (options.usageDelta) {
|
|
62302
|
+
this.trajectoryStepCount += options.usageDelta.stepCount;
|
|
62303
|
+
}
|
|
62304
|
+
if (options.tokenDelta) {
|
|
62305
|
+
this.trajectoryTokens += options.tokenDelta;
|
|
62306
|
+
}
|
|
62307
|
+
}
|
|
62308
|
+
getTrajectorySnapshot() {
|
|
62309
|
+
if (this.trajectoryStartMs === null)
|
|
62310
|
+
return null;
|
|
62311
|
+
const workMs = this.trajectoryApiMs + this.trajectoryLocalMs;
|
|
62312
|
+
return {
|
|
62313
|
+
trajectoryStartMs: this.trajectoryStartMs,
|
|
62314
|
+
wallMs: this.trajectoryWallMs,
|
|
62315
|
+
workMs,
|
|
62316
|
+
apiMs: this.trajectoryApiMs,
|
|
62317
|
+
localMs: this.trajectoryLocalMs,
|
|
62318
|
+
stepCount: this.trajectoryStepCount,
|
|
62319
|
+
tokens: this.trajectoryTokens
|
|
62320
|
+
};
|
|
62321
|
+
}
|
|
62322
|
+
endTrajectory() {
|
|
62323
|
+
const snapshot = this.getTrajectorySnapshot();
|
|
62324
|
+
this.resetTrajectory();
|
|
62325
|
+
return snapshot;
|
|
62326
|
+
}
|
|
62327
|
+
resetTrajectory() {
|
|
62328
|
+
this.trajectoryStartMs = null;
|
|
62329
|
+
this.trajectoryApiMs = 0;
|
|
62330
|
+
this.trajectoryLocalMs = 0;
|
|
62331
|
+
this.trajectoryWallMs = 0;
|
|
62332
|
+
this.trajectoryStepCount = 0;
|
|
62333
|
+
this.trajectoryTokens = 0;
|
|
62258
62334
|
}
|
|
62259
62335
|
getSnapshot() {
|
|
62260
62336
|
const now = performance.now();
|
|
@@ -62276,6 +62352,8 @@ class SessionStats {
|
|
|
62276
62352
|
reasoningTokens: 0,
|
|
62277
62353
|
stepCount: 0
|
|
62278
62354
|
};
|
|
62355
|
+
this.lastUsageSnapshot = { ...this.usage };
|
|
62356
|
+
this.resetTrajectory();
|
|
62279
62357
|
}
|
|
62280
62358
|
}
|
|
62281
62359
|
|
|
@@ -78858,7 +78936,7 @@ var init_AgentInfoBar = __esm(async () => {
|
|
|
78858
78936
|
/* @__PURE__ */ jsx_dev_runtime38.jsxDEV(dist_default4, {
|
|
78859
78937
|
url: "https://discord.gg/letta",
|
|
78860
78938
|
children: /* @__PURE__ */ jsx_dev_runtime38.jsxDEV(Text2, {
|
|
78861
|
-
children: "
|
|
78939
|
+
children: "on Discord ↗"
|
|
78862
78940
|
}, undefined, false, undefined, this)
|
|
78863
78941
|
}, undefined, false, undefined, this)
|
|
78864
78942
|
]
|
|
@@ -79379,9 +79457,7 @@ function SlashCommandAutocomplete({
|
|
|
79379
79457
|
agentId,
|
|
79380
79458
|
workingDirectory = process.cwd()
|
|
79381
79459
|
}) {
|
|
79382
|
-
const [matches, setMatches] = import_react64.useState([]);
|
|
79383
79460
|
const [customCommands, setCustomCommands] = import_react64.useState([]);
|
|
79384
|
-
const [showNoMatches, setShowNoMatches] = import_react64.useState(false);
|
|
79385
79461
|
import_react64.useEffect(() => {
|
|
79386
79462
|
Promise.resolve().then(() => (init_custom(), exports_custom)).then(({ getCustomCommands: getCustomCommands2 }) => {
|
|
79387
79463
|
getCustomCommands2().then((customs) => {
|
|
@@ -79419,44 +79495,51 @@ function SlashCommandAutocomplete({
|
|
|
79419
79495
|
}
|
|
79420
79496
|
return [...builtins, ...customCommands].sort((a, b) => (a.order ?? 100) - (b.order ?? 100));
|
|
79421
79497
|
}, [agentId, workingDirectory, customCommands]);
|
|
79498
|
+
const queryInfo = import_react64.useMemo(() => extractSearchQuery2(currentInput, cursorPosition), [currentInput, cursorPosition]);
|
|
79499
|
+
const { matches, showNoMatches, hideAutocomplete } = import_react64.useMemo(() => {
|
|
79500
|
+
if (!queryInfo) {
|
|
79501
|
+
return {
|
|
79502
|
+
matches: [],
|
|
79503
|
+
showNoMatches: false,
|
|
79504
|
+
hideAutocomplete: true
|
|
79505
|
+
};
|
|
79506
|
+
}
|
|
79507
|
+
const { query, hasSpaceAfter } = queryInfo;
|
|
79508
|
+
if (hasSpaceAfter) {
|
|
79509
|
+
return {
|
|
79510
|
+
matches: [],
|
|
79511
|
+
showNoMatches: false,
|
|
79512
|
+
hideAutocomplete: true
|
|
79513
|
+
};
|
|
79514
|
+
}
|
|
79515
|
+
if (query.length === 0) {
|
|
79516
|
+
return {
|
|
79517
|
+
matches: allCommands,
|
|
79518
|
+
showNoMatches: false,
|
|
79519
|
+
hideAutocomplete: allCommands.length === 0
|
|
79520
|
+
};
|
|
79521
|
+
}
|
|
79522
|
+
const lowerQuery = query.toLowerCase();
|
|
79523
|
+
const filtered = allCommands.filter((item) => {
|
|
79524
|
+
const cmdName = item.cmd.slice(1).toLowerCase();
|
|
79525
|
+
return cmdName.includes(lowerQuery);
|
|
79526
|
+
});
|
|
79527
|
+
return {
|
|
79528
|
+
matches: filtered,
|
|
79529
|
+
showNoMatches: filtered.length === 0,
|
|
79530
|
+
hideAutocomplete: false
|
|
79531
|
+
};
|
|
79532
|
+
}, [queryInfo, allCommands]);
|
|
79422
79533
|
const { selectedIndex } = useAutocompleteNavigation({
|
|
79423
79534
|
matches,
|
|
79424
79535
|
onSelect: onSelect ? (item) => onSelect(item.cmd) : undefined,
|
|
79425
79536
|
onAutocomplete: onAutocomplete ? (item) => onAutocomplete(item.cmd) : undefined,
|
|
79426
79537
|
manageActiveState: false
|
|
79427
79538
|
});
|
|
79428
|
-
import_react64.
|
|
79539
|
+
import_react64.useLayoutEffect(() => {
|
|
79429
79540
|
const isActive = matches.length > 0 || showNoMatches;
|
|
79430
79541
|
onActiveChange?.(isActive);
|
|
79431
79542
|
}, [matches.length, showNoMatches, onActiveChange]);
|
|
79432
|
-
import_react64.useEffect(() => {
|
|
79433
|
-
const result = extractSearchQuery2(currentInput, cursorPosition);
|
|
79434
|
-
if (!result) {
|
|
79435
|
-
setMatches([]);
|
|
79436
|
-
setShowNoMatches(false);
|
|
79437
|
-
return;
|
|
79438
|
-
}
|
|
79439
|
-
const { query, hasSpaceAfter } = result;
|
|
79440
|
-
if (hasSpaceAfter) {
|
|
79441
|
-
setMatches([]);
|
|
79442
|
-
setShowNoMatches(false);
|
|
79443
|
-
return;
|
|
79444
|
-
}
|
|
79445
|
-
let newMatches;
|
|
79446
|
-
if (query.length === 0) {
|
|
79447
|
-
newMatches = allCommands;
|
|
79448
|
-
setMatches(newMatches);
|
|
79449
|
-
setShowNoMatches(false);
|
|
79450
|
-
} else {
|
|
79451
|
-
const lowerQuery = query.toLowerCase();
|
|
79452
|
-
newMatches = allCommands.filter((item) => {
|
|
79453
|
-
const cmdName = item.cmd.slice(1).toLowerCase();
|
|
79454
|
-
return cmdName.includes(lowerQuery);
|
|
79455
|
-
});
|
|
79456
|
-
setMatches(newMatches);
|
|
79457
|
-
setShowNoMatches(newMatches.length === 0);
|
|
79458
|
-
}
|
|
79459
|
-
}, [currentInput, cursorPosition, allCommands]);
|
|
79460
79543
|
if (!currentInput.startsWith("/")) {
|
|
79461
79544
|
return null;
|
|
79462
79545
|
}
|
|
@@ -79471,7 +79554,7 @@ function SlashCommandAutocomplete({
|
|
|
79471
79554
|
}, undefined, true, undefined, this)
|
|
79472
79555
|
}, undefined, false, undefined, this);
|
|
79473
79556
|
}
|
|
79474
|
-
if (matches.length === 0) {
|
|
79557
|
+
if (hideAutocomplete || matches.length === 0) {
|
|
79475
79558
|
return null;
|
|
79476
79559
|
}
|
|
79477
79560
|
const totalMatches = matches.length;
|
|
@@ -79734,11 +79817,14 @@ function Input({
|
|
|
79734
79817
|
visible = true,
|
|
79735
79818
|
streaming,
|
|
79736
79819
|
tokenCount,
|
|
79820
|
+
elapsedBaseMs = 0,
|
|
79737
79821
|
thinkingMessage,
|
|
79738
79822
|
onSubmit,
|
|
79739
79823
|
onBashSubmit,
|
|
79740
79824
|
bashRunning = false,
|
|
79741
79825
|
onBashInterrupt,
|
|
79826
|
+
inputEnabled = true,
|
|
79827
|
+
collapseInputWhenDisabled = false,
|
|
79742
79828
|
permissionMode: externalMode,
|
|
79743
79829
|
onPermissionModeChange,
|
|
79744
79830
|
onExit,
|
|
@@ -79771,6 +79857,15 @@ function Input({
|
|
|
79771
79857
|
const [isAutocompleteActive, setIsAutocompleteActive] = import_react68.useState(false);
|
|
79772
79858
|
const [cursorPos, setCursorPos] = import_react68.useState(undefined);
|
|
79773
79859
|
const [currentCursorPosition, setCurrentCursorPosition] = import_react68.useState(0);
|
|
79860
|
+
const columns = useTerminalWidth();
|
|
79861
|
+
const contentWidth = Math.max(0, columns - 2);
|
|
79862
|
+
const interactionEnabled = visible && inputEnabled;
|
|
79863
|
+
const reserveInputSpace = !collapseInputWhenDisabled;
|
|
79864
|
+
const hideFooter = !interactionEnabled || value.startsWith("/");
|
|
79865
|
+
const inputRowLines = import_react68.useMemo(() => {
|
|
79866
|
+
return Math.max(1, getVisualLines(value, contentWidth).length);
|
|
79867
|
+
}, [value, contentWidth]);
|
|
79868
|
+
const inputChromeHeight = inputRowLines + 3;
|
|
79774
79869
|
const [history, setHistory] = import_react68.useState([]);
|
|
79775
79870
|
const [historyIndex, setHistoryIndex] = import_react68.useState(-1);
|
|
79776
79871
|
const [temporaryInput, setTemporaryInput] = import_react68.useState("");
|
|
@@ -79821,12 +79916,15 @@ function Input({
|
|
|
79821
79916
|
const [shimmerOffset, setShimmerOffset] = import_react68.useState(-3);
|
|
79822
79917
|
const [elapsedMs, setElapsedMs] = import_react68.useState(0);
|
|
79823
79918
|
const streamStartRef = import_react68.useRef(null);
|
|
79824
|
-
|
|
79825
|
-
|
|
79919
|
+
import_react68.useEffect(() => {
|
|
79920
|
+
if (!interactionEnabled) {
|
|
79921
|
+
setIsAutocompleteActive(false);
|
|
79922
|
+
}
|
|
79923
|
+
}, [interactionEnabled]);
|
|
79826
79924
|
const settings = settingsManager.getSettings();
|
|
79827
79925
|
const serverUrl = process.env.LETTA_BASE_URL || settings.env?.LETTA_BASE_URL || LETTA_CLOUD_API_URL;
|
|
79828
79926
|
use_input_default((_input, key) => {
|
|
79829
|
-
if (!
|
|
79927
|
+
if (!interactionEnabled)
|
|
79830
79928
|
return;
|
|
79831
79929
|
if (!onEscapeCancel)
|
|
79832
79930
|
return;
|
|
@@ -79837,7 +79935,7 @@ function Input({
|
|
|
79837
79935
|
onEscapeCancel();
|
|
79838
79936
|
});
|
|
79839
79937
|
use_input_default((_input, key) => {
|
|
79840
|
-
if (!
|
|
79938
|
+
if (!interactionEnabled)
|
|
79841
79939
|
return;
|
|
79842
79940
|
if (process.env.LETTA_DEBUG_KEYS === "1" && key.escape) {
|
|
79843
79941
|
console.error(`[debug:InputRich:escape] escape=${key.escape} visible=${visible} onEscapeCancel=${!!onEscapeCancel} streaming=${streaming}`);
|
|
@@ -79871,7 +79969,7 @@ function Input({
|
|
|
79871
79969
|
}
|
|
79872
79970
|
});
|
|
79873
79971
|
use_input_default((input, key) => {
|
|
79874
|
-
if (!
|
|
79972
|
+
if (!interactionEnabled)
|
|
79875
79973
|
return;
|
|
79876
79974
|
if (input === "c" && key.ctrl) {
|
|
79877
79975
|
if (bashRunning && onBashInterrupt) {
|
|
@@ -79893,7 +79991,7 @@ function Input({
|
|
|
79893
79991
|
}
|
|
79894
79992
|
});
|
|
79895
79993
|
use_input_default((_input, key) => {
|
|
79896
|
-
if (!
|
|
79994
|
+
if (!interactionEnabled)
|
|
79897
79995
|
return;
|
|
79898
79996
|
if (process.env.LETTA_DEBUG_KEYS === "1" && (key.shift || key.tab)) {
|
|
79899
79997
|
console.error(`[debug:InputRich] shift=${key.shift} tab=${key.tab} visible=${visible}`);
|
|
@@ -79920,7 +80018,7 @@ function Input({
|
|
|
79920
80018
|
}
|
|
79921
80019
|
});
|
|
79922
80020
|
use_input_default((_input, key) => {
|
|
79923
|
-
if (!
|
|
80021
|
+
if (!interactionEnabled)
|
|
79924
80022
|
return;
|
|
79925
80023
|
if (isAutocompleteActive && historyIndex === -1) {
|
|
79926
80024
|
return;
|
|
@@ -80049,11 +80147,11 @@ function Input({
|
|
|
80049
80147
|
import_react68.useEffect(() => {
|
|
80050
80148
|
if (streaming && visible) {
|
|
80051
80149
|
if (streamStartRef.current === null) {
|
|
80052
|
-
streamStartRef.current =
|
|
80150
|
+
streamStartRef.current = performance.now();
|
|
80053
80151
|
}
|
|
80054
80152
|
const id = setInterval(() => {
|
|
80055
80153
|
if (streamStartRef.current !== null) {
|
|
80056
|
-
setElapsedMs(
|
|
80154
|
+
setElapsedMs(performance.now() - streamStartRef.current);
|
|
80057
80155
|
}
|
|
80058
80156
|
}, 1000);
|
|
80059
80157
|
return () => clearInterval(id);
|
|
@@ -80169,9 +80267,10 @@ function Input({
|
|
|
80169
80267
|
}
|
|
80170
80268
|
}, [ralphPending, ralphPendingYolo, ralphActive, currentMode]);
|
|
80171
80269
|
const estimatedTokens = charsToTokens(tokenCount);
|
|
80270
|
+
const totalElapsedMs = elapsedBaseMs + elapsedMs;
|
|
80172
80271
|
const shouldShowTokenCount = streaming && estimatedTokens > TOKEN_DISPLAY_THRESHOLD;
|
|
80173
|
-
const shouldShowElapsed = streaming &&
|
|
80174
|
-
const
|
|
80272
|
+
const shouldShowElapsed = streaming && totalElapsedMs > ELAPSED_DISPLAY_THRESHOLD_MS;
|
|
80273
|
+
const elapsedLabel = formatElapsedLabel(totalElapsedMs);
|
|
80175
80274
|
const networkArrow = import_react68.useMemo(() => {
|
|
80176
80275
|
if (!networkPhase)
|
|
80177
80276
|
return "";
|
|
@@ -80181,16 +80280,17 @@ function Input({
|
|
|
80181
80280
|
return "↑";
|
|
80182
80281
|
return "↑̸";
|
|
80183
80282
|
}, [networkPhase]);
|
|
80283
|
+
const showErrorArrow = networkArrow === "↑̸";
|
|
80184
80284
|
const statusHintText = import_react68.useMemo(() => {
|
|
80185
80285
|
const hintColor = source_default.hex(colors.subagent.hint);
|
|
80186
80286
|
const hintBold = hintColor.bold;
|
|
80187
80287
|
const parts = [];
|
|
80188
80288
|
if (shouldShowElapsed) {
|
|
80189
|
-
parts.push(
|
|
80289
|
+
parts.push(elapsedLabel);
|
|
80190
80290
|
}
|
|
80191
80291
|
if (shouldShowTokenCount) {
|
|
80192
80292
|
parts.push(`${formatCompact(estimatedTokens)}${networkArrow ? ` ${networkArrow}` : ""}`);
|
|
80193
|
-
} else if (
|
|
80293
|
+
} else if (showErrorArrow) {
|
|
80194
80294
|
parts.push(networkArrow);
|
|
80195
80295
|
}
|
|
80196
80296
|
const suffix = `${parts.length > 0 ? ` · ${parts.join(" · ")}` : ""})`;
|
|
@@ -80200,11 +80300,12 @@ function Input({
|
|
|
80200
80300
|
return hintColor(" (") + hintBold("esc") + hintColor(` to interrupt${suffix}`);
|
|
80201
80301
|
}, [
|
|
80202
80302
|
shouldShowElapsed,
|
|
80203
|
-
|
|
80303
|
+
elapsedLabel,
|
|
80204
80304
|
shouldShowTokenCount,
|
|
80205
80305
|
estimatedTokens,
|
|
80206
80306
|
interruptRequested,
|
|
80207
|
-
networkArrow
|
|
80307
|
+
networkArrow,
|
|
80308
|
+
showErrorArrow
|
|
80208
80309
|
]);
|
|
80209
80310
|
const horizontalLine = import_react68.useMemo(() => "─".repeat(columns), [columns]);
|
|
80210
80311
|
if (!visible) {
|
|
@@ -80246,7 +80347,7 @@ function Input({
|
|
|
80246
80347
|
messageQueue && messageQueue.length > 0 && /* @__PURE__ */ jsx_dev_runtime45.jsxDEV(QueuedMessages, {
|
|
80247
80348
|
messages: messageQueue
|
|
80248
80349
|
}, undefined, false, undefined, this),
|
|
80249
|
-
/* @__PURE__ */ jsx_dev_runtime45.jsxDEV(Box_default, {
|
|
80350
|
+
interactionEnabled ? /* @__PURE__ */ jsx_dev_runtime45.jsxDEV(Box_default, {
|
|
80250
80351
|
flexDirection: "column",
|
|
80251
80352
|
children: [
|
|
80252
80353
|
/* @__PURE__ */ jsx_dev_runtime45.jsxDEV(Text2, {
|
|
@@ -80279,7 +80380,7 @@ function Input({
|
|
|
80279
80380
|
onSubmit: handleSubmit,
|
|
80280
80381
|
cursorPosition: cursorPos,
|
|
80281
80382
|
onCursorMove: setCurrentCursorPosition,
|
|
80282
|
-
focus: !onEscapeCancel,
|
|
80383
|
+
focus: interactionEnabled && !onEscapeCancel,
|
|
80283
80384
|
onBangAtEmpty: handleBangAtEmpty,
|
|
80284
80385
|
onBackspaceAtEmpty: handleBackspaceAtEmpty,
|
|
80285
80386
|
onPasteError
|
|
@@ -80316,13 +80417,35 @@ function Input({
|
|
|
80316
80417
|
currentModel,
|
|
80317
80418
|
isOpenAICodexProvider: currentModelProvider === OPENAI_CODEX_PROVIDER_NAME,
|
|
80318
80419
|
isByokProvider: currentModelProvider?.startsWith("lc-") || currentModelProvider === OPENAI_CODEX_PROVIDER_NAME,
|
|
80319
|
-
isAutocompleteActive
|
|
80420
|
+
isAutocompleteActive,
|
|
80421
|
+
hideFooter
|
|
80320
80422
|
}, undefined, false, undefined, this)
|
|
80321
80423
|
]
|
|
80322
|
-
}, undefined, true, undefined, this)
|
|
80424
|
+
}, undefined, true, undefined, this) : reserveInputSpace ? /* @__PURE__ */ jsx_dev_runtime45.jsxDEV(Box_default, {
|
|
80425
|
+
height: inputChromeHeight
|
|
80426
|
+
}, undefined, false, undefined, this) : null
|
|
80323
80427
|
]
|
|
80324
80428
|
}, undefined, true, undefined, this);
|
|
80325
80429
|
}
|
|
80430
|
+
function formatElapsedLabel(ms) {
|
|
80431
|
+
const totalSeconds = Math.max(0, Math.floor(ms / 1000));
|
|
80432
|
+
const seconds = totalSeconds % 60;
|
|
80433
|
+
const totalMinutes = Math.floor(totalSeconds / 60);
|
|
80434
|
+
if (totalMinutes === 0) {
|
|
80435
|
+
return `${seconds}s`;
|
|
80436
|
+
}
|
|
80437
|
+
const minutes = totalMinutes % 60;
|
|
80438
|
+
const hours = Math.floor(totalMinutes / 60);
|
|
80439
|
+
if (hours > 0) {
|
|
80440
|
+
const parts = [`${hours}hr`];
|
|
80441
|
+
if (minutes > 0)
|
|
80442
|
+
parts.push(`${minutes}m`);
|
|
80443
|
+
if (seconds > 0)
|
|
80444
|
+
parts.push(`${seconds}s`);
|
|
80445
|
+
return parts.join(" ");
|
|
80446
|
+
}
|
|
80447
|
+
return seconds > 0 ? `${minutes}m ${seconds}s` : `${minutes}m`;
|
|
80448
|
+
}
|
|
80326
80449
|
var import_react68, jsx_dev_runtime45, Spinner2, ESC_CLEAR_WINDOW_MS = 2500, InputFooter;
|
|
80327
80450
|
var init_InputRich = __esm(async () => {
|
|
80328
80451
|
init_source();
|
|
@@ -80357,9 +80480,10 @@ var init_InputRich = __esm(async () => {
|
|
|
80357
80480
|
currentModel,
|
|
80358
80481
|
isOpenAICodexProvider,
|
|
80359
80482
|
isByokProvider,
|
|
80360
|
-
isAutocompleteActive
|
|
80483
|
+
isAutocompleteActive,
|
|
80484
|
+
hideFooter
|
|
80361
80485
|
}) {
|
|
80362
|
-
if (isAutocompleteActive) {
|
|
80486
|
+
if (hideFooter || isAutocompleteActive) {
|
|
80363
80487
|
return null;
|
|
80364
80488
|
}
|
|
80365
80489
|
return /* @__PURE__ */ jsx_dev_runtime45.jsxDEV(Box_default, {
|
|
@@ -81874,6 +81998,12 @@ function scanMemoryFilesystem(memoryRoot) {
|
|
|
81874
81998
|
} catch {}
|
|
81875
81999
|
if (aIsDir !== bIsDir)
|
|
81876
82000
|
return aIsDir ? -1 : 1;
|
|
82001
|
+
if (aIsDir && bIsDir && depth === 0) {
|
|
82002
|
+
if (a === "system")
|
|
82003
|
+
return -1;
|
|
82004
|
+
if (b === "system")
|
|
82005
|
+
return 1;
|
|
82006
|
+
}
|
|
81877
82007
|
return a.localeCompare(b);
|
|
81878
82008
|
});
|
|
81879
82009
|
sorted.forEach((name, index) => {
|
|
@@ -82212,6 +82342,7 @@ function MemfsTreeViewer({
|
|
|
82212
82342
|
visibleTreeNodes.map((node) => {
|
|
82213
82343
|
const isSelected = !node.isDirectory && node.relativePath === selectedFile?.relativePath;
|
|
82214
82344
|
const prefix = renderTreePrefix(node);
|
|
82345
|
+
const isSystemDir = node.isDirectory && node.name === "system/";
|
|
82215
82346
|
return /* @__PURE__ */ jsx_dev_runtime48.jsxDEV(Box_default, {
|
|
82216
82347
|
flexDirection: "row",
|
|
82217
82348
|
children: [
|
|
@@ -82222,8 +82353,8 @@ function MemfsTreeViewer({
|
|
|
82222
82353
|
}, undefined, false, undefined, this),
|
|
82223
82354
|
/* @__PURE__ */ jsx_dev_runtime48.jsxDEV(Text2, {
|
|
82224
82355
|
backgroundColor: isSelected ? colors.selector.itemHighlighted : undefined,
|
|
82225
|
-
color: isSelected ? "black" : undefined,
|
|
82226
|
-
dimColor: node.isDirectory,
|
|
82356
|
+
color: isSelected ? "black" : isSystemDir ? colors.status.success : undefined,
|
|
82357
|
+
dimColor: node.isDirectory && !isSystemDir,
|
|
82227
82358
|
children: node.name
|
|
82228
82359
|
}, undefined, false, undefined, this)
|
|
82229
82360
|
]
|
|
@@ -88171,6 +88302,62 @@ var init_ToolsetSelector = __esm(async () => {
|
|
|
88171
88302
|
];
|
|
88172
88303
|
});
|
|
88173
88304
|
|
|
88305
|
+
// src/cli/components/TrajectorySummary.tsx
|
|
88306
|
+
function formatSummaryDuration(ms) {
|
|
88307
|
+
const totalSeconds = Math.floor(ms / 1000);
|
|
88308
|
+
if (totalSeconds < 60) {
|
|
88309
|
+
return `${Math.max(0, totalSeconds)}s`;
|
|
88310
|
+
}
|
|
88311
|
+
const totalMinutes = Math.floor(totalSeconds / 60);
|
|
88312
|
+
const seconds = totalSeconds % 60;
|
|
88313
|
+
if (totalMinutes < 60) {
|
|
88314
|
+
return seconds > 0 ? `${totalMinutes}m ${seconds}s` : `${totalMinutes}m`;
|
|
88315
|
+
}
|
|
88316
|
+
const hours = Math.floor(totalMinutes / 60);
|
|
88317
|
+
const minutes = totalMinutes % 60;
|
|
88318
|
+
const parts = [`${hours}hr`];
|
|
88319
|
+
if (minutes > 0)
|
|
88320
|
+
parts.push(`${minutes}m`);
|
|
88321
|
+
if (seconds > 0)
|
|
88322
|
+
parts.push(`${seconds}s`);
|
|
88323
|
+
return parts.join(" ");
|
|
88324
|
+
}
|
|
88325
|
+
var import_react87, jsx_dev_runtime67, TrajectorySummary;
|
|
88326
|
+
var init_TrajectorySummary = __esm(async () => {
|
|
88327
|
+
await __promiseAll([
|
|
88328
|
+
init_build2(),
|
|
88329
|
+
init_Text2()
|
|
88330
|
+
]);
|
|
88331
|
+
import_react87 = __toESM(require_react(), 1);
|
|
88332
|
+
jsx_dev_runtime67 = __toESM(require_jsx_dev_runtime(), 1);
|
|
88333
|
+
TrajectorySummary = import_react87.memo(({ line }) => {
|
|
88334
|
+
const duration = formatSummaryDuration(line.durationMs);
|
|
88335
|
+
const verb = line.verb.length > 0 ? line.verb.charAt(0).toUpperCase() + line.verb.slice(1) : line.verb;
|
|
88336
|
+
const summary = `${verb} for ${duration}`;
|
|
88337
|
+
return /* @__PURE__ */ jsx_dev_runtime67.jsxDEV(Box_default, {
|
|
88338
|
+
flexDirection: "row",
|
|
88339
|
+
children: [
|
|
88340
|
+
/* @__PURE__ */ jsx_dev_runtime67.jsxDEV(Box_default, {
|
|
88341
|
+
width: 2,
|
|
88342
|
+
flexShrink: 0,
|
|
88343
|
+
children: /* @__PURE__ */ jsx_dev_runtime67.jsxDEV(Text2, {
|
|
88344
|
+
dimColor: true,
|
|
88345
|
+
children: "✻"
|
|
88346
|
+
}, undefined, false, undefined, this)
|
|
88347
|
+
}, undefined, false, undefined, this),
|
|
88348
|
+
/* @__PURE__ */ jsx_dev_runtime67.jsxDEV(Box_default, {
|
|
88349
|
+
flexGrow: 1,
|
|
88350
|
+
children: /* @__PURE__ */ jsx_dev_runtime67.jsxDEV(Text2, {
|
|
88351
|
+
dimColor: true,
|
|
88352
|
+
children: summary
|
|
88353
|
+
}, undefined, false, undefined, this)
|
|
88354
|
+
}, undefined, false, undefined, this)
|
|
88355
|
+
]
|
|
88356
|
+
}, undefined, true, undefined, this);
|
|
88357
|
+
});
|
|
88358
|
+
TrajectorySummary.displayName = "TrajectorySummary";
|
|
88359
|
+
});
|
|
88360
|
+
|
|
88174
88361
|
// src/cli/components/UserMessageRich.tsx
|
|
88175
88362
|
function wordWrap(text, width) {
|
|
88176
88363
|
if (width <= 0)
|
|
@@ -88260,16 +88447,16 @@ function renderBlock(text, contentWidth, columns, highlighted, colorAnsi) {
|
|
|
88260
88447
|
return `${colorAnsi}${content}${" ".repeat(pad)}\x1B[0m`;
|
|
88261
88448
|
});
|
|
88262
88449
|
}
|
|
88263
|
-
var
|
|
88450
|
+
var import_react88, jsx_dev_runtime68, COMPACT_PAD = 1, UserMessage;
|
|
88264
88451
|
var init_UserMessageRich = __esm(async () => {
|
|
88265
88452
|
init_string_width();
|
|
88266
88453
|
init_constants();
|
|
88267
88454
|
init_useTerminalWidth();
|
|
88268
88455
|
init_colors();
|
|
88269
88456
|
await init_Text2();
|
|
88270
|
-
|
|
88271
|
-
|
|
88272
|
-
UserMessage =
|
|
88457
|
+
import_react88 = __toESM(require_react(), 1);
|
|
88458
|
+
jsx_dev_runtime68 = __toESM(require_jsx_dev_runtime(), 1);
|
|
88459
|
+
UserMessage = import_react88.memo(({ line }) => {
|
|
88273
88460
|
const columns = useTerminalWidth();
|
|
88274
88461
|
const contentWidth = Math.max(1, columns - 2);
|
|
88275
88462
|
const { background, text: textColor } = colors.userMessage;
|
|
@@ -88287,7 +88474,7 @@ var init_UserMessageRich = __esm(async () => {
|
|
|
88287
88474
|
const blockLines = renderBlock(block.text, contentWidth, columns, !block.isSystemReminder, colorAnsi);
|
|
88288
88475
|
allLines.push(...blockLines);
|
|
88289
88476
|
}
|
|
88290
|
-
return /* @__PURE__ */
|
|
88477
|
+
return /* @__PURE__ */ jsx_dev_runtime68.jsxDEV(Text2, {
|
|
88291
88478
|
children: allLines.join(`
|
|
88292
88479
|
`)
|
|
88293
88480
|
}, undefined, false, undefined, this);
|
|
@@ -88590,7 +88777,11 @@ function getRandomVerb() {
|
|
|
88590
88777
|
function getRandomThinkingVerb() {
|
|
88591
88778
|
return `is ${getRandomVerb()}`;
|
|
88592
88779
|
}
|
|
88593
|
-
|
|
88780
|
+
function getRandomPastTenseVerb() {
|
|
88781
|
+
const verb = getRandomVerb();
|
|
88782
|
+
return PAST_TENSE_VERBS[verb] ?? "completed";
|
|
88783
|
+
}
|
|
88784
|
+
var THINKING_VERBS, PAST_TENSE_VERBS;
|
|
88594
88785
|
var init_thinkingMessages = __esm(() => {
|
|
88595
88786
|
THINKING_VERBS = [
|
|
88596
88787
|
"thinking",
|
|
@@ -88635,13 +88826,56 @@ var init_thinkingMessages = __esm(() => {
|
|
|
88635
88826
|
"absorbing",
|
|
88636
88827
|
"internalizing"
|
|
88637
88828
|
];
|
|
88829
|
+
PAST_TENSE_VERBS = {
|
|
88830
|
+
thinking: "thought",
|
|
88831
|
+
processing: "processed",
|
|
88832
|
+
computing: "computed",
|
|
88833
|
+
calculating: "calculated",
|
|
88834
|
+
analyzing: "analyzed",
|
|
88835
|
+
synthesizing: "synthesized",
|
|
88836
|
+
deliberating: "deliberated",
|
|
88837
|
+
cogitating: "cogitated",
|
|
88838
|
+
reflecting: "reflected",
|
|
88839
|
+
reasoning: "reasoned",
|
|
88840
|
+
spinning: "spun",
|
|
88841
|
+
focusing: "focused",
|
|
88842
|
+
machinating: "machinated",
|
|
88843
|
+
contemplating: "contemplated",
|
|
88844
|
+
ruminating: "ruminated",
|
|
88845
|
+
considering: "considered",
|
|
88846
|
+
pondering: "pondered",
|
|
88847
|
+
evaluating: "evaluated",
|
|
88848
|
+
assessing: "assessed",
|
|
88849
|
+
inferring: "inferred",
|
|
88850
|
+
deducing: "deduced",
|
|
88851
|
+
interpreting: "interpreted",
|
|
88852
|
+
formulating: "formulated",
|
|
88853
|
+
strategizing: "strategized",
|
|
88854
|
+
orchestrating: "orchestrated",
|
|
88855
|
+
optimizing: "optimized",
|
|
88856
|
+
calibrating: "calibrated",
|
|
88857
|
+
indexing: "indexed",
|
|
88858
|
+
compiling: "compiled",
|
|
88859
|
+
rendering: "rendered",
|
|
88860
|
+
executing: "executed",
|
|
88861
|
+
initializing: "initialized",
|
|
88862
|
+
"absolutely right": "was absolutely right",
|
|
88863
|
+
"thinking about thinking": "thought about thinking",
|
|
88864
|
+
metathinking: "did metathinking",
|
|
88865
|
+
learning: "learned",
|
|
88866
|
+
adapting: "adapted",
|
|
88867
|
+
evolving: "evolved",
|
|
88868
|
+
remembering: "remembered",
|
|
88869
|
+
absorbing: "absorbed",
|
|
88870
|
+
internalizing: "internalized"
|
|
88871
|
+
};
|
|
88638
88872
|
});
|
|
88639
88873
|
|
|
88640
88874
|
// src/cli/hooks/useSuspend/useSuspend.ts
|
|
88641
88875
|
function useSuspend() {
|
|
88642
88876
|
const { stdin: stdin2, isRawModeSupported } = use_stdin_default();
|
|
88643
|
-
const [resumeKey, setResumeKey] =
|
|
88644
|
-
const forceUpdate =
|
|
88877
|
+
const [resumeKey, setResumeKey] = import_react89.useState(0);
|
|
88878
|
+
const forceUpdate = import_react89.useCallback(() => {
|
|
88645
88879
|
setResumeKey((prev) => prev + 1);
|
|
88646
88880
|
}, []);
|
|
88647
88881
|
use_input_default((input, key) => {
|
|
@@ -88653,7 +88887,7 @@ function useSuspend() {
|
|
|
88653
88887
|
return;
|
|
88654
88888
|
}
|
|
88655
88889
|
});
|
|
88656
|
-
|
|
88890
|
+
import_react89.useEffect(() => {
|
|
88657
88891
|
const handleResume = () => {
|
|
88658
88892
|
if (stdin2 && isRawModeSupported && stdin2.setRawMode) {
|
|
88659
88893
|
stdin2.setRawMode(true);
|
|
@@ -88668,25 +88902,25 @@ function useSuspend() {
|
|
|
88668
88902
|
}, [stdin2, isRawModeSupported, forceUpdate]);
|
|
88669
88903
|
return resumeKey;
|
|
88670
88904
|
}
|
|
88671
|
-
var
|
|
88905
|
+
var import_react89;
|
|
88672
88906
|
var init_useSuspend = __esm(async () => {
|
|
88673
88907
|
await init_build2();
|
|
88674
|
-
|
|
88908
|
+
import_react89 = __toESM(require_react(), 1);
|
|
88675
88909
|
});
|
|
88676
88910
|
|
|
88677
88911
|
// src/cli/hooks/useSyncedState.ts
|
|
88678
88912
|
function useSyncedState(initialValue) {
|
|
88679
|
-
const [state, setState] =
|
|
88680
|
-
const ref =
|
|
88681
|
-
const setSyncedState =
|
|
88913
|
+
const [state, setState] = import_react90.useState(initialValue);
|
|
88914
|
+
const ref = import_react90.useRef(initialValue);
|
|
88915
|
+
const setSyncedState = import_react90.useCallback((value) => {
|
|
88682
88916
|
ref.current = value;
|
|
88683
88917
|
setState(value);
|
|
88684
88918
|
}, []);
|
|
88685
88919
|
return [state, setSyncedState, ref];
|
|
88686
88920
|
}
|
|
88687
|
-
var
|
|
88921
|
+
var import_react90;
|
|
88688
88922
|
var init_useSyncedState = __esm(() => {
|
|
88689
|
-
|
|
88923
|
+
import_react90 = __toESM(require_react(), 1);
|
|
88690
88924
|
});
|
|
88691
88925
|
|
|
88692
88926
|
// src/cli/helpers/shellAliases.ts
|
|
@@ -89983,86 +90217,86 @@ function App2({
|
|
|
89983
90217
|
agentProvenance = null,
|
|
89984
90218
|
releaseNotes = null
|
|
89985
90219
|
}) {
|
|
89986
|
-
|
|
90220
|
+
import_react91.useEffect(() => {
|
|
89987
90221
|
prefetchAvailableModelHandles();
|
|
89988
90222
|
}, []);
|
|
89989
|
-
const [agentId, setAgentId] =
|
|
89990
|
-
const [agentState, setAgentState] =
|
|
89991
|
-
const updateAgentName =
|
|
90223
|
+
const [agentId, setAgentId] = import_react91.useState(initialAgentId);
|
|
90224
|
+
const [agentState, setAgentState] = import_react91.useState(initialAgentState);
|
|
90225
|
+
const updateAgentName = import_react91.useCallback((name) => {
|
|
89992
90226
|
setAgentState((prev) => prev ? { ...prev, name } : prev);
|
|
89993
90227
|
}, []);
|
|
89994
|
-
const [conversationId, setConversationId3] =
|
|
89995
|
-
const agentIdRef =
|
|
89996
|
-
|
|
90228
|
+
const [conversationId, setConversationId3] = import_react91.useState(initialConversationId);
|
|
90229
|
+
const agentIdRef = import_react91.useRef(agentId);
|
|
90230
|
+
import_react91.useEffect(() => {
|
|
89997
90231
|
agentIdRef.current = agentId;
|
|
89998
90232
|
telemetry2.setCurrentAgentId(agentId);
|
|
89999
90233
|
}, [agentId]);
|
|
90000
|
-
const conversationIdRef =
|
|
90001
|
-
|
|
90234
|
+
const conversationIdRef = import_react91.useRef(conversationId);
|
|
90235
|
+
import_react91.useEffect(() => {
|
|
90002
90236
|
conversationIdRef.current = conversationId;
|
|
90003
90237
|
}, [conversationId]);
|
|
90004
90238
|
const resumeKey = useSuspend();
|
|
90005
|
-
const prevInitialAgentIdRef =
|
|
90006
|
-
const prevInitialAgentStateRef =
|
|
90007
|
-
const prevInitialConversationIdRef =
|
|
90008
|
-
|
|
90239
|
+
const prevInitialAgentIdRef = import_react91.useRef(initialAgentId);
|
|
90240
|
+
const prevInitialAgentStateRef = import_react91.useRef(initialAgentState);
|
|
90241
|
+
const prevInitialConversationIdRef = import_react91.useRef(initialConversationId);
|
|
90242
|
+
import_react91.useEffect(() => {
|
|
90009
90243
|
if (initialAgentId !== prevInitialAgentIdRef.current) {
|
|
90010
90244
|
prevInitialAgentIdRef.current = initialAgentId;
|
|
90011
90245
|
agentIdRef.current = initialAgentId;
|
|
90012
90246
|
setAgentId(initialAgentId);
|
|
90013
90247
|
}
|
|
90014
90248
|
}, [initialAgentId]);
|
|
90015
|
-
|
|
90249
|
+
import_react91.useEffect(() => {
|
|
90016
90250
|
if (initialAgentState !== prevInitialAgentStateRef.current) {
|
|
90017
90251
|
prevInitialAgentStateRef.current = initialAgentState;
|
|
90018
90252
|
setAgentState(initialAgentState);
|
|
90019
90253
|
}
|
|
90020
90254
|
}, [initialAgentState]);
|
|
90021
|
-
|
|
90255
|
+
import_react91.useEffect(() => {
|
|
90022
90256
|
if (initialConversationId !== prevInitialConversationIdRef.current) {
|
|
90023
90257
|
prevInitialConversationIdRef.current = initialConversationId;
|
|
90024
90258
|
conversationIdRef.current = initialConversationId;
|
|
90025
90259
|
setConversationId3(initialConversationId);
|
|
90026
90260
|
}
|
|
90027
90261
|
}, [initialConversationId]);
|
|
90028
|
-
|
|
90262
|
+
import_react91.useEffect(() => {
|
|
90029
90263
|
if (agentId) {
|
|
90030
90264
|
setCurrentAgentId(agentId);
|
|
90031
90265
|
}
|
|
90032
90266
|
}, [agentId]);
|
|
90033
|
-
|
|
90267
|
+
import_react91.useEffect(() => {
|
|
90034
90268
|
const title = agentState?.name ? `${agentState.name} | Letta Code` : "Letta Code";
|
|
90035
90269
|
process.stdout.write(`\x1B]0;${title}\x07`);
|
|
90036
90270
|
}, [agentState?.name]);
|
|
90037
90271
|
const [streaming, setStreaming, streamingRef] = useSyncedState(false);
|
|
90038
|
-
const [networkPhase, setNetworkPhase] =
|
|
90039
|
-
|
|
90272
|
+
const [networkPhase, setNetworkPhase] = import_react91.useState(null);
|
|
90273
|
+
import_react91.useEffect(() => {
|
|
90040
90274
|
if (!streaming) {
|
|
90041
90275
|
setNetworkPhase(null);
|
|
90042
90276
|
}
|
|
90043
90277
|
}, [streaming]);
|
|
90044
|
-
const processingConversationRef =
|
|
90045
|
-
const conversationGenerationRef =
|
|
90046
|
-
const [interruptRequested, setInterruptRequested] =
|
|
90278
|
+
const processingConversationRef = import_react91.useRef(0);
|
|
90279
|
+
const conversationGenerationRef = import_react91.useRef(0);
|
|
90280
|
+
const [interruptRequested, setInterruptRequested] = import_react91.useState(false);
|
|
90047
90281
|
const [commandRunning, setCommandRunning, commandRunningRef] = useSyncedState(false);
|
|
90048
|
-
const [profileConfirmPending, setProfileConfirmPending] =
|
|
90049
|
-
const [pendingApprovals, setPendingApprovals] =
|
|
90050
|
-
const [approvalContexts, setApprovalContexts] =
|
|
90051
|
-
const [approvalResults, setApprovalResults] =
|
|
90052
|
-
const [isExecutingTool, setIsExecutingTool] =
|
|
90053
|
-
const [queuedApprovalResults, setQueuedApprovalResults] =
|
|
90054
|
-
const toolAbortControllerRef =
|
|
90055
|
-
const [bashRunning, setBashRunning] =
|
|
90056
|
-
const bashAbortControllerRef =
|
|
90057
|
-
const [needsEagerApprovalCheck, setNeedsEagerApprovalCheck] =
|
|
90058
|
-
const [autoHandledResults, setAutoHandledResults] =
|
|
90059
|
-
const [autoDeniedApprovals, setAutoDeniedApprovals] =
|
|
90060
|
-
const executingToolCallIdsRef =
|
|
90061
|
-
const interruptQueuedRef =
|
|
90062
|
-
const toolResultsInFlightRef =
|
|
90063
|
-
const autoAllowedExecutionRef =
|
|
90064
|
-
const queuedApprovalMetadataRef =
|
|
90065
|
-
const queueApprovalResults =
|
|
90282
|
+
const [profileConfirmPending, setProfileConfirmPending] = import_react91.useState(null);
|
|
90283
|
+
const [pendingApprovals, setPendingApprovals] = import_react91.useState([]);
|
|
90284
|
+
const [approvalContexts, setApprovalContexts] = import_react91.useState([]);
|
|
90285
|
+
const [approvalResults, setApprovalResults] = import_react91.useState([]);
|
|
90286
|
+
const [isExecutingTool, setIsExecutingTool] = import_react91.useState(false);
|
|
90287
|
+
const [queuedApprovalResults, setQueuedApprovalResults] = import_react91.useState(null);
|
|
90288
|
+
const toolAbortControllerRef = import_react91.useRef(null);
|
|
90289
|
+
const [bashRunning, setBashRunning] = import_react91.useState(false);
|
|
90290
|
+
const bashAbortControllerRef = import_react91.useRef(null);
|
|
90291
|
+
const [needsEagerApprovalCheck, setNeedsEagerApprovalCheck] = import_react91.useState(() => resumedExistingConversation || startupApprovals.length > 0);
|
|
90292
|
+
const [autoHandledResults, setAutoHandledResults] = import_react91.useState([]);
|
|
90293
|
+
const [autoDeniedApprovals, setAutoDeniedApprovals] = import_react91.useState([]);
|
|
90294
|
+
const executingToolCallIdsRef = import_react91.useRef([]);
|
|
90295
|
+
const interruptQueuedRef = import_react91.useRef(false);
|
|
90296
|
+
const toolResultsInFlightRef = import_react91.useRef(false);
|
|
90297
|
+
const autoAllowedExecutionRef = import_react91.useRef(null);
|
|
90298
|
+
const queuedApprovalMetadataRef = import_react91.useRef(null);
|
|
90299
|
+
const queueApprovalResults = import_react91.useCallback((results, metadata) => {
|
|
90066
90300
|
setQueuedApprovalResults(results);
|
|
90067
90301
|
if (results) {
|
|
90068
90302
|
queuedApprovalMetadataRef.current = metadata ?? {
|
|
@@ -90073,9 +90307,9 @@ function App2({
|
|
|
90073
90307
|
queuedApprovalMetadataRef.current = null;
|
|
90074
90308
|
}
|
|
90075
90309
|
}, []);
|
|
90076
|
-
const bashCommandCacheRef =
|
|
90077
|
-
const [pendingRalphConfig, setPendingRalphConfig] =
|
|
90078
|
-
const [uiRalphActive, setUiRalphActive] =
|
|
90310
|
+
const bashCommandCacheRef = import_react91.useRef([]);
|
|
90311
|
+
const [pendingRalphConfig, setPendingRalphConfig] = import_react91.useState(null);
|
|
90312
|
+
const [uiRalphActive, setUiRalphActive] = import_react91.useState(ralphMode.getState().isActive);
|
|
90079
90313
|
const currentApproval = pendingApprovals[approvalResults.length];
|
|
90080
90314
|
const currentApprovalContext = approvalContexts[approvalResults.length];
|
|
90081
90315
|
const activeApprovalId = currentApproval?.toolCallId ?? null;
|
|
@@ -90085,7 +90319,7 @@ function App2({
|
|
|
90085
90319
|
approvalMap,
|
|
90086
90320
|
stubDescriptions,
|
|
90087
90321
|
queuedDecisions
|
|
90088
|
-
} =
|
|
90322
|
+
} = import_react91.useMemo(() => {
|
|
90089
90323
|
const pending = new Set;
|
|
90090
90324
|
const queued = new Set;
|
|
90091
90325
|
const map = new Map;
|
|
@@ -90142,51 +90376,51 @@ function App2({
|
|
|
90142
90376
|
queuedDecisions: decisions
|
|
90143
90377
|
};
|
|
90144
90378
|
}, [pendingApprovals, approvalResults, activeApprovalId]);
|
|
90145
|
-
const [activeOverlay, setActiveOverlay] =
|
|
90146
|
-
const [memorySyncConflicts, setMemorySyncConflicts] =
|
|
90147
|
-
const memorySyncProcessedToolCallsRef =
|
|
90148
|
-
const memorySyncCommandIdRef =
|
|
90149
|
-
const memorySyncCommandInputRef =
|
|
90150
|
-
const memorySyncInFlightRef =
|
|
90151
|
-
const memoryFilesystemInitializedRef =
|
|
90152
|
-
const pendingMemfsConflictsRef =
|
|
90153
|
-
const memfsDirtyRef =
|
|
90154
|
-
const memfsWatcherRef =
|
|
90155
|
-
const memfsConflictCheckInFlightRef =
|
|
90156
|
-
const [feedbackPrefill, setFeedbackPrefill] =
|
|
90157
|
-
const [searchQuery, setSearchQuery] =
|
|
90158
|
-
const [modelSelectorOptions, setModelSelectorOptions] =
|
|
90159
|
-
const closeOverlay =
|
|
90379
|
+
const [activeOverlay, setActiveOverlay] = import_react91.useState(null);
|
|
90380
|
+
const [memorySyncConflicts, setMemorySyncConflicts] = import_react91.useState(null);
|
|
90381
|
+
const memorySyncProcessedToolCallsRef = import_react91.useRef(new Set);
|
|
90382
|
+
const memorySyncCommandIdRef = import_react91.useRef(null);
|
|
90383
|
+
const memorySyncCommandInputRef = import_react91.useRef("/memfs sync");
|
|
90384
|
+
const memorySyncInFlightRef = import_react91.useRef(false);
|
|
90385
|
+
const memoryFilesystemInitializedRef = import_react91.useRef(false);
|
|
90386
|
+
const pendingMemfsConflictsRef = import_react91.useRef(null);
|
|
90387
|
+
const memfsDirtyRef = import_react91.useRef(false);
|
|
90388
|
+
const memfsWatcherRef = import_react91.useRef(null);
|
|
90389
|
+
const memfsConflictCheckInFlightRef = import_react91.useRef(false);
|
|
90390
|
+
const [feedbackPrefill, setFeedbackPrefill] = import_react91.useState("");
|
|
90391
|
+
const [searchQuery, setSearchQuery] = import_react91.useState("");
|
|
90392
|
+
const [modelSelectorOptions, setModelSelectorOptions] = import_react91.useState({});
|
|
90393
|
+
const closeOverlay = import_react91.useCallback(() => {
|
|
90160
90394
|
setActiveOverlay(null);
|
|
90161
90395
|
setFeedbackPrefill("");
|
|
90162
90396
|
setSearchQuery("");
|
|
90163
90397
|
setModelSelectorOptions({});
|
|
90164
90398
|
}, []);
|
|
90165
|
-
const [queuedOverlayAction, setQueuedOverlayAction] =
|
|
90166
|
-
const [pinDialogLocal, setPinDialogLocal] =
|
|
90399
|
+
const [queuedOverlayAction, setQueuedOverlayAction] = import_react91.useState(null);
|
|
90400
|
+
const [pinDialogLocal, setPinDialogLocal] = import_react91.useState(false);
|
|
90167
90401
|
const anySelectorOpen = activeOverlay !== null;
|
|
90168
|
-
const [currentSystemPromptId, setCurrentSystemPromptId] =
|
|
90169
|
-
const [currentToolset, setCurrentToolset] =
|
|
90170
|
-
const [llmConfig, setLlmConfig] =
|
|
90171
|
-
const llmConfigRef =
|
|
90172
|
-
|
|
90402
|
+
const [currentSystemPromptId, setCurrentSystemPromptId] = import_react91.useState("default");
|
|
90403
|
+
const [currentToolset, setCurrentToolset] = import_react91.useState(null);
|
|
90404
|
+
const [llmConfig, setLlmConfig] = import_react91.useState(null);
|
|
90405
|
+
const llmConfigRef = import_react91.useRef(llmConfig);
|
|
90406
|
+
import_react91.useEffect(() => {
|
|
90173
90407
|
llmConfigRef.current = llmConfig;
|
|
90174
90408
|
}, [llmConfig]);
|
|
90175
|
-
const [currentModelId, setCurrentModelId] =
|
|
90409
|
+
const [currentModelId, setCurrentModelId] = import_react91.useState(null);
|
|
90176
90410
|
const agentName = agentState?.name ?? null;
|
|
90177
|
-
const [agentDescription, setAgentDescription] =
|
|
90178
|
-
const [agentLastRunAt, setAgentLastRunAt] =
|
|
90411
|
+
const [agentDescription, setAgentDescription] = import_react91.useState(null);
|
|
90412
|
+
const [agentLastRunAt, setAgentLastRunAt] = import_react91.useState(null);
|
|
90179
90413
|
const currentModelLabel = llmConfig?.model_endpoint_type && llmConfig?.model ? `${llmConfig.model_endpoint_type}/${llmConfig.model}` : llmConfig?.model ?? null;
|
|
90180
90414
|
const currentModelDisplay = currentModelLabel ? getModelShortName(currentModelLabel) ?? currentModelLabel.split("/").pop() : null;
|
|
90181
90415
|
const currentModelProvider = llmConfig?.provider_name ?? null;
|
|
90182
|
-
const [billingTier, setBillingTier] =
|
|
90183
|
-
|
|
90416
|
+
const [billingTier, setBillingTier] = import_react91.useState(null);
|
|
90417
|
+
import_react91.useEffect(() => {
|
|
90184
90418
|
setErrorContext({
|
|
90185
90419
|
modelDisplayName: currentModelDisplay ?? undefined,
|
|
90186
90420
|
billingTier: billingTier ?? undefined
|
|
90187
90421
|
});
|
|
90188
90422
|
}, [currentModelDisplay, billingTier]);
|
|
90189
|
-
|
|
90423
|
+
import_react91.useEffect(() => {
|
|
90190
90424
|
(async () => {
|
|
90191
90425
|
try {
|
|
90192
90426
|
const settings = settingsManager.getSettings();
|
|
@@ -90204,70 +90438,118 @@ function App2({
|
|
|
90204
90438
|
} catch {}
|
|
90205
90439
|
})();
|
|
90206
90440
|
}, []);
|
|
90207
|
-
const [tokenStreamingEnabled, setTokenStreamingEnabled] =
|
|
90208
|
-
const [tokenCount, setTokenCount] =
|
|
90209
|
-
const [
|
|
90210
|
-
const
|
|
90211
|
-
const
|
|
90212
|
-
const
|
|
90213
|
-
|
|
90441
|
+
const [tokenStreamingEnabled, setTokenStreamingEnabled] = import_react91.useState(tokenStreaming);
|
|
90442
|
+
const [tokenCount, setTokenCount] = import_react91.useState(0);
|
|
90443
|
+
const [trajectoryTokenBase, setTrajectoryTokenBase] = import_react91.useState(0);
|
|
90444
|
+
const [trajectoryElapsedBaseMs, setTrajectoryElapsedBaseMs] = import_react91.useState(0);
|
|
90445
|
+
const trajectoryRunTokenStartRef = import_react91.useRef(0);
|
|
90446
|
+
const trajectoryTokenDisplayRef = import_react91.useRef(0);
|
|
90447
|
+
const trajectorySegmentStartRef = import_react91.useRef(null);
|
|
90448
|
+
const [thinkingMessage, setThinkingMessage] = import_react91.useState(getRandomThinkingVerb());
|
|
90449
|
+
const sessionStatsRef = import_react91.useRef(new SessionStats);
|
|
90450
|
+
const sessionStartTimeRef = import_react91.useRef(Date.now());
|
|
90451
|
+
const sessionHooksRanRef = import_react91.useRef(false);
|
|
90452
|
+
const syncTrajectoryTokenBase = import_react91.useCallback(() => {
|
|
90453
|
+
const snapshot = sessionStatsRef.current.getTrajectorySnapshot();
|
|
90454
|
+
setTrajectoryTokenBase(snapshot?.tokens ?? 0);
|
|
90455
|
+
}, []);
|
|
90456
|
+
const openTrajectorySegment = import_react91.useCallback(() => {
|
|
90457
|
+
if (trajectorySegmentStartRef.current === null) {
|
|
90458
|
+
trajectorySegmentStartRef.current = performance.now();
|
|
90459
|
+
sessionStatsRef.current.startTrajectory();
|
|
90460
|
+
}
|
|
90461
|
+
}, []);
|
|
90462
|
+
const closeTrajectorySegment = import_react91.useCallback(() => {
|
|
90463
|
+
const start = trajectorySegmentStartRef.current;
|
|
90464
|
+
if (start !== null) {
|
|
90465
|
+
const segmentMs = performance.now() - start;
|
|
90466
|
+
sessionStatsRef.current.accumulateTrajectory({ wallMs: segmentMs });
|
|
90467
|
+
trajectorySegmentStartRef.current = null;
|
|
90468
|
+
}
|
|
90469
|
+
}, []);
|
|
90470
|
+
const syncTrajectoryElapsedBase = import_react91.useCallback(() => {
|
|
90471
|
+
const snapshot = sessionStatsRef.current.getTrajectorySnapshot();
|
|
90472
|
+
setTrajectoryElapsedBaseMs(snapshot?.wallMs ?? 0);
|
|
90473
|
+
}, []);
|
|
90474
|
+
const resetTrajectoryBases = import_react91.useCallback(() => {
|
|
90475
|
+
sessionStatsRef.current.resetTrajectory();
|
|
90476
|
+
setTrajectoryTokenBase(0);
|
|
90477
|
+
setTrajectoryElapsedBaseMs(0);
|
|
90478
|
+
trajectoryRunTokenStartRef.current = 0;
|
|
90479
|
+
trajectoryTokenDisplayRef.current = 0;
|
|
90480
|
+
trajectorySegmentStartRef.current = null;
|
|
90481
|
+
}, []);
|
|
90482
|
+
import_react91.useEffect(() => {
|
|
90214
90483
|
telemetry2.setSessionStatsGetter(() => sessionStatsRef.current.getSnapshot());
|
|
90215
90484
|
return () => {
|
|
90216
90485
|
telemetry2.setSessionStatsGetter(undefined);
|
|
90217
90486
|
};
|
|
90218
90487
|
}, []);
|
|
90219
|
-
|
|
90488
|
+
import_react91.useEffect(() => {
|
|
90489
|
+
if (streaming) {
|
|
90490
|
+
openTrajectorySegment();
|
|
90491
|
+
return;
|
|
90492
|
+
}
|
|
90493
|
+
closeTrajectorySegment();
|
|
90494
|
+
syncTrajectoryElapsedBase();
|
|
90495
|
+
}, [
|
|
90496
|
+
streaming,
|
|
90497
|
+
openTrajectorySegment,
|
|
90498
|
+
closeTrajectorySegment,
|
|
90499
|
+
syncTrajectoryElapsedBase
|
|
90500
|
+
]);
|
|
90501
|
+
import_react91.useEffect(() => {
|
|
90220
90502
|
if (agentId && !sessionHooksRanRef.current) {
|
|
90221
90503
|
sessionHooksRanRef.current = true;
|
|
90222
90504
|
const isNewSession = !initialConversationId;
|
|
90223
90505
|
runSessionStartHooks(isNewSession, agentId, agentName ?? undefined, conversationIdRef.current ?? undefined).catch(() => {});
|
|
90224
90506
|
}
|
|
90225
90507
|
}, [agentId, agentName, initialConversationId]);
|
|
90226
|
-
|
|
90508
|
+
import_react91.useEffect(() => {
|
|
90227
90509
|
return () => {
|
|
90228
90510
|
const durationMs = Date.now() - sessionStartTimeRef.current;
|
|
90229
90511
|
runSessionEndHooks(durationMs, undefined, undefined, agentIdRef.current ?? undefined, conversationIdRef.current ?? undefined).catch(() => {});
|
|
90230
90512
|
};
|
|
90231
90513
|
}, []);
|
|
90232
|
-
|
|
90514
|
+
import_react91.useEffect(() => {
|
|
90233
90515
|
return () => {
|
|
90234
90516
|
if (queueAppendTimeoutRef.current) {
|
|
90235
90517
|
clearTimeout(queueAppendTimeoutRef.current);
|
|
90236
90518
|
}
|
|
90237
90519
|
};
|
|
90238
90520
|
}, []);
|
|
90239
|
-
const [showExitStats, setShowExitStats] =
|
|
90240
|
-
const hasSentSessionContextRef =
|
|
90241
|
-
const turnCountRef =
|
|
90242
|
-
const lastNotifiedModeRef =
|
|
90243
|
-
const [staticItems, setStaticItems] =
|
|
90244
|
-
const emittedIdsRef =
|
|
90245
|
-
const welcomeCommittedRef =
|
|
90246
|
-
const abortControllerRef =
|
|
90247
|
-
const userCancelledRef =
|
|
90248
|
-
const llmApiErrorRetriesRef =
|
|
90249
|
-
const conversationBusyRetriesRef =
|
|
90250
|
-
const [messageQueue, setMessageQueue] =
|
|
90251
|
-
const messageQueueRef =
|
|
90252
|
-
|
|
90521
|
+
const [showExitStats, setShowExitStats] = import_react91.useState(false);
|
|
90522
|
+
const hasSentSessionContextRef = import_react91.useRef(false);
|
|
90523
|
+
const turnCountRef = import_react91.useRef(0);
|
|
90524
|
+
const lastNotifiedModeRef = import_react91.useRef("default");
|
|
90525
|
+
const [staticItems, setStaticItems] = import_react91.useState([]);
|
|
90526
|
+
const emittedIdsRef = import_react91.useRef(new Set);
|
|
90527
|
+
const welcomeCommittedRef = import_react91.useRef(false);
|
|
90528
|
+
const abortControllerRef = import_react91.useRef(null);
|
|
90529
|
+
const userCancelledRef = import_react91.useRef(false);
|
|
90530
|
+
const llmApiErrorRetriesRef = import_react91.useRef(0);
|
|
90531
|
+
const conversationBusyRetriesRef = import_react91.useRef(0);
|
|
90532
|
+
const [messageQueue, setMessageQueue] = import_react91.useState([]);
|
|
90533
|
+
const messageQueueRef = import_react91.useRef([]);
|
|
90534
|
+
import_react91.useEffect(() => {
|
|
90253
90535
|
messageQueueRef.current = messageQueue;
|
|
90254
90536
|
}, [messageQueue]);
|
|
90255
|
-
const waitingForQueueCancelRef =
|
|
90256
|
-
const queueSnapshotRef =
|
|
90257
|
-
const [restoreQueueOnCancel, setRestoreQueueOnCancel] =
|
|
90258
|
-
const restoreQueueOnCancelRef =
|
|
90259
|
-
|
|
90537
|
+
const waitingForQueueCancelRef = import_react91.useRef(false);
|
|
90538
|
+
const queueSnapshotRef = import_react91.useRef([]);
|
|
90539
|
+
const [restoreQueueOnCancel, setRestoreQueueOnCancel] = import_react91.useState(false);
|
|
90540
|
+
const restoreQueueOnCancelRef = import_react91.useRef(restoreQueueOnCancel);
|
|
90541
|
+
import_react91.useEffect(() => {
|
|
90260
90542
|
restoreQueueOnCancelRef.current = restoreQueueOnCancel;
|
|
90261
90543
|
}, [restoreQueueOnCancel]);
|
|
90262
|
-
const queueAppendTimeoutRef =
|
|
90263
|
-
const lastSentInputRef =
|
|
90264
|
-
const [dequeueEpoch, setDequeueEpoch] =
|
|
90265
|
-
const lastDequeuedMessageRef =
|
|
90266
|
-
const [restoredInput, setRestoredInput] =
|
|
90267
|
-
const isAgentBusy =
|
|
90544
|
+
const queueAppendTimeoutRef = import_react91.useRef(null);
|
|
90545
|
+
const lastSentInputRef = import_react91.useRef(null);
|
|
90546
|
+
const [dequeueEpoch, setDequeueEpoch] = import_react91.useState(0);
|
|
90547
|
+
const lastDequeuedMessageRef = import_react91.useRef(null);
|
|
90548
|
+
const [restoredInput, setRestoredInput] = import_react91.useState(null);
|
|
90549
|
+
const isAgentBusy = import_react91.useCallback(() => {
|
|
90268
90550
|
return streamingRef.current || isExecutingTool || commandRunningRef.current || abortControllerRef.current !== null;
|
|
90269
90551
|
}, [isExecutingTool]);
|
|
90270
|
-
const consumeQueuedMessages =
|
|
90552
|
+
const consumeQueuedMessages = import_react91.useCallback(() => {
|
|
90271
90553
|
if (messageQueueRef.current.length === 0)
|
|
90272
90554
|
return null;
|
|
90273
90555
|
if (queueAppendTimeoutRef.current) {
|
|
@@ -90278,7 +90560,7 @@ function App2({
|
|
|
90278
90560
|
setMessageQueue([]);
|
|
90279
90561
|
return messages;
|
|
90280
90562
|
}, []);
|
|
90281
|
-
const withCommandLock =
|
|
90563
|
+
const withCommandLock = import_react91.useCallback(async (asyncFn) => {
|
|
90282
90564
|
setActiveOverlay(null);
|
|
90283
90565
|
setCommandRunning(true);
|
|
90284
90566
|
try {
|
|
@@ -90289,14 +90571,14 @@ function App2({
|
|
|
90289
90571
|
}, [setCommandRunning]);
|
|
90290
90572
|
const columns = useTerminalWidth();
|
|
90291
90573
|
const terminalRows = useTerminalRows();
|
|
90292
|
-
const prevColumnsRef =
|
|
90293
|
-
const lastClearedColumnsRef =
|
|
90294
|
-
const pendingResizeRef =
|
|
90295
|
-
const pendingResizeColumnsRef =
|
|
90296
|
-
const [staticRenderEpoch, setStaticRenderEpoch] =
|
|
90297
|
-
const resizeClearTimeout =
|
|
90298
|
-
const isInitialResizeRef =
|
|
90299
|
-
|
|
90574
|
+
const prevColumnsRef = import_react91.useRef(columns);
|
|
90575
|
+
const lastClearedColumnsRef = import_react91.useRef(columns);
|
|
90576
|
+
const pendingResizeRef = import_react91.useRef(false);
|
|
90577
|
+
const pendingResizeColumnsRef = import_react91.useRef(null);
|
|
90578
|
+
const [staticRenderEpoch, setStaticRenderEpoch] = import_react91.useState(0);
|
|
90579
|
+
const resizeClearTimeout = import_react91.useRef(null);
|
|
90580
|
+
const isInitialResizeRef = import_react91.useRef(true);
|
|
90581
|
+
import_react91.useEffect(() => {
|
|
90300
90582
|
const prev = prevColumnsRef.current;
|
|
90301
90583
|
if (columns === prev)
|
|
90302
90584
|
return;
|
|
@@ -90345,7 +90627,7 @@ function App2({
|
|
|
90345
90627
|
}
|
|
90346
90628
|
};
|
|
90347
90629
|
}, [columns, streaming]);
|
|
90348
|
-
|
|
90630
|
+
import_react91.useEffect(() => {
|
|
90349
90631
|
if (streaming) {
|
|
90350
90632
|
if (resizeClearTimeout.current) {
|
|
90351
90633
|
clearTimeout(resizeClearTimeout.current);
|
|
@@ -90370,7 +90652,7 @@ function App2({
|
|
|
90370
90652
|
setStaticRenderEpoch((epoch) => epoch + 1);
|
|
90371
90653
|
lastClearedColumnsRef.current = pendingColumns;
|
|
90372
90654
|
}, [columns, streaming]);
|
|
90373
|
-
const commitEligibleLines =
|
|
90655
|
+
const commitEligibleLines = import_react91.useCallback((b) => {
|
|
90374
90656
|
const newlyCommitted = [];
|
|
90375
90657
|
let firstTaskIndex = -1;
|
|
90376
90658
|
const hasInProgress = hasInProgressTaskToolCalls(b.order, b.byId, emittedIdsRef.current);
|
|
@@ -90381,7 +90663,7 @@ function App2({
|
|
|
90381
90663
|
const ln = b.byId.get(id);
|
|
90382
90664
|
if (!ln)
|
|
90383
90665
|
continue;
|
|
90384
|
-
if (ln.kind === "user" || ln.kind === "error" || ln.kind === "status") {
|
|
90666
|
+
if (ln.kind === "user" || ln.kind === "error" || ln.kind === "status" || ln.kind === "trajectory_summary") {
|
|
90385
90667
|
emittedIdsRef.current.add(id);
|
|
90386
90668
|
newlyCommitted.push({ ...ln });
|
|
90387
90669
|
continue;
|
|
@@ -90429,27 +90711,27 @@ function App2({
|
|
|
90429
90711
|
setStaticItems((prev) => [...prev, ...newlyCommitted]);
|
|
90430
90712
|
}
|
|
90431
90713
|
}, []);
|
|
90432
|
-
const [lines, setLines] =
|
|
90433
|
-
const buffersRef =
|
|
90434
|
-
const hasBackfilledRef =
|
|
90435
|
-
|
|
90714
|
+
const [lines, setLines] = import_react91.useState([]);
|
|
90715
|
+
const buffersRef = import_react91.useRef(createBuffers());
|
|
90716
|
+
const hasBackfilledRef = import_react91.useRef(false);
|
|
90717
|
+
import_react91.useEffect(() => {
|
|
90436
90718
|
buffersRef.current.tokenStreamingEnabled = tokenStreamingEnabled;
|
|
90437
90719
|
}, [tokenStreamingEnabled]);
|
|
90438
|
-
|
|
90720
|
+
import_react91.useEffect(() => {
|
|
90439
90721
|
buffersRef.current.agentId = agentState?.id;
|
|
90440
90722
|
}, [agentState?.id]);
|
|
90441
|
-
const precomputedDiffsRef =
|
|
90442
|
-
const lastPlanFilePathRef =
|
|
90443
|
-
const eagerCommittedPreviewsRef =
|
|
90444
|
-
const refreshDerived =
|
|
90723
|
+
const precomputedDiffsRef = import_react91.useRef(new Map);
|
|
90724
|
+
const lastPlanFilePathRef = import_react91.useRef(null);
|
|
90725
|
+
const eagerCommittedPreviewsRef = import_react91.useRef(new Set);
|
|
90726
|
+
const refreshDerived = import_react91.useCallback(() => {
|
|
90445
90727
|
const b = buffersRef.current;
|
|
90446
90728
|
setTokenCount(b.tokenCount);
|
|
90447
90729
|
const newLines = toLines(b);
|
|
90448
90730
|
setLines(newLines);
|
|
90449
90731
|
commitEligibleLines(b);
|
|
90450
90732
|
}, [commitEligibleLines]);
|
|
90451
|
-
const streamingRefreshTimeoutRef =
|
|
90452
|
-
const refreshDerivedStreaming =
|
|
90733
|
+
const streamingRefreshTimeoutRef = import_react91.useRef(null);
|
|
90734
|
+
const refreshDerivedStreaming = import_react91.useCallback(() => {
|
|
90453
90735
|
if (streamingRefreshTimeoutRef.current) {
|
|
90454
90736
|
clearTimeout(streamingRefreshTimeoutRef.current);
|
|
90455
90737
|
}
|
|
@@ -90460,14 +90742,14 @@ function App2({
|
|
|
90460
90742
|
}
|
|
90461
90743
|
}, 100);
|
|
90462
90744
|
}, [refreshDerived]);
|
|
90463
|
-
|
|
90745
|
+
import_react91.useEffect(() => {
|
|
90464
90746
|
return () => {
|
|
90465
90747
|
if (streamingRefreshTimeoutRef.current) {
|
|
90466
90748
|
clearTimeout(streamingRefreshTimeoutRef.current);
|
|
90467
90749
|
}
|
|
90468
90750
|
};
|
|
90469
90751
|
}, []);
|
|
90470
|
-
const updateStreamingOutput =
|
|
90752
|
+
const updateStreamingOutput = import_react91.useCallback((toolCallId, chunk, isStderr = false) => {
|
|
90471
90753
|
const lineId = buffersRef.current.toolCallIdToLineId.get(toolCallId);
|
|
90472
90754
|
if (!lineId)
|
|
90473
90755
|
return;
|
|
@@ -90481,7 +90763,7 @@ function App2({
|
|
|
90481
90763
|
});
|
|
90482
90764
|
refreshDerivedStreaming();
|
|
90483
90765
|
}, [refreshDerivedStreaming]);
|
|
90484
|
-
const refreshDerivedThrottled =
|
|
90766
|
+
const refreshDerivedThrottled = import_react91.useCallback(() => {
|
|
90485
90767
|
if (!buffersRef.current.pendingRefresh) {
|
|
90486
90768
|
buffersRef.current.pendingRefresh = true;
|
|
90487
90769
|
const capturedGeneration = buffersRef.current.commitGeneration || 0;
|
|
@@ -90493,7 +90775,7 @@ function App2({
|
|
|
90493
90775
|
}, 16);
|
|
90494
90776
|
}
|
|
90495
90777
|
}, [refreshDerived]);
|
|
90496
|
-
|
|
90778
|
+
import_react91.useEffect(() => {
|
|
90497
90779
|
const approvals = startupApprovals?.length > 0 ? startupApprovals : startupApproval ? [startupApproval] : [];
|
|
90498
90780
|
if (loadingState === "ready" && approvals.length > 0) {
|
|
90499
90781
|
setPendingApprovals(approvals);
|
|
@@ -90511,7 +90793,7 @@ function App2({
|
|
|
90511
90793
|
analyzeStartupApprovals();
|
|
90512
90794
|
}
|
|
90513
90795
|
}, [loadingState, startupApproval, startupApprovals]);
|
|
90514
|
-
|
|
90796
|
+
import_react91.useEffect(() => {
|
|
90515
90797
|
if (!currentApproval)
|
|
90516
90798
|
return;
|
|
90517
90799
|
if (currentApproval.toolName !== "ExitPlanMode")
|
|
@@ -90543,7 +90825,7 @@ function App2({
|
|
|
90543
90825
|
lastPlanFilePathRef.current = planFilePath;
|
|
90544
90826
|
} catch {}
|
|
90545
90827
|
}, [currentApproval]);
|
|
90546
|
-
|
|
90828
|
+
import_react91.useEffect(() => {
|
|
90547
90829
|
if (loadingState === "ready" && messageHistory.length > 0 && !hasBackfilledRef.current) {
|
|
90548
90830
|
hasBackfilledRef.current = true;
|
|
90549
90831
|
if (!welcomeCommittedRef.current) {
|
|
@@ -90618,7 +90900,7 @@ function App2({
|
|
|
90618
90900
|
resumedExistingConversation,
|
|
90619
90901
|
releaseNotes
|
|
90620
90902
|
]);
|
|
90621
|
-
|
|
90903
|
+
import_react91.useEffect(() => {
|
|
90622
90904
|
if (loadingState === "ready" && agentId && agentId !== "loading") {
|
|
90623
90905
|
const fetchConfig = async () => {
|
|
90624
90906
|
try {
|
|
@@ -90648,7 +90930,7 @@ function App2({
|
|
|
90648
90930
|
fetchConfig();
|
|
90649
90931
|
}
|
|
90650
90932
|
}, [loadingState, agentId]);
|
|
90651
|
-
const appendError =
|
|
90933
|
+
const appendError = import_react91.useCallback((message, skipTelemetry = false) => {
|
|
90652
90934
|
const text = typeof message === "string" ? message : message != null ? JSON.stringify(message) : "[Unknown error]";
|
|
90653
90935
|
const id = uid4("err");
|
|
90654
90936
|
buffersRef.current.byId.set(id, {
|
|
@@ -90664,7 +90946,7 @@ function App2({
|
|
|
90664
90946
|
});
|
|
90665
90947
|
}
|
|
90666
90948
|
}, [refreshDerived, currentModelId]);
|
|
90667
|
-
const updateMemorySyncCommand =
|
|
90949
|
+
const updateMemorySyncCommand = import_react91.useCallback((commandId, output, success, input = "/memfs sync", keepRunning = false) => {
|
|
90668
90950
|
buffersRef.current.byId.set(commandId, {
|
|
90669
90951
|
kind: "command",
|
|
90670
90952
|
id: commandId,
|
|
@@ -90675,7 +90957,7 @@ function App2({
|
|
|
90675
90957
|
});
|
|
90676
90958
|
refreshDerived();
|
|
90677
90959
|
}, [refreshDerived]);
|
|
90678
|
-
const runMemoryFilesystemSync =
|
|
90960
|
+
const runMemoryFilesystemSync = import_react91.useCallback(async (source, commandId) => {
|
|
90679
90961
|
if (!agentId || agentId === "loading") {
|
|
90680
90962
|
return;
|
|
90681
90963
|
}
|
|
@@ -90720,7 +91002,7 @@ function App2({
|
|
|
90720
91002
|
memorySyncInFlightRef.current = false;
|
|
90721
91003
|
}
|
|
90722
91004
|
}, [agentId, appendError, updateMemorySyncCommand]);
|
|
90723
|
-
const maybeSyncMemoryFilesystemAfterTurn =
|
|
91005
|
+
const maybeSyncMemoryFilesystemAfterTurn = import_react91.useCallback(async () => {
|
|
90724
91006
|
if (!agentId || agentId === "loading")
|
|
90725
91007
|
return;
|
|
90726
91008
|
if (!settingsManager.isMemfsEnabled(agentId))
|
|
@@ -90767,7 +91049,7 @@ function App2({
|
|
|
90767
91049
|
});
|
|
90768
91050
|
}
|
|
90769
91051
|
}, [agentId, runMemoryFilesystemSync]);
|
|
90770
|
-
|
|
91052
|
+
import_react91.useEffect(() => {
|
|
90771
91053
|
if (loadingState !== "ready") {
|
|
90772
91054
|
return;
|
|
90773
91055
|
}
|
|
@@ -90783,7 +91065,7 @@ function App2({
|
|
|
90783
91065
|
memoryFilesystemInitializedRef.current = true;
|
|
90784
91066
|
runMemoryFilesystemSync("startup");
|
|
90785
91067
|
}, [agentId, loadingState, runMemoryFilesystemSync]);
|
|
90786
|
-
|
|
91068
|
+
import_react91.useEffect(() => {
|
|
90787
91069
|
if (!agentId || agentId === "loading")
|
|
90788
91070
|
return;
|
|
90789
91071
|
if (!settingsManager.isMemfsEnabled(agentId))
|
|
@@ -90817,7 +91099,7 @@ function App2({
|
|
|
90817
91099
|
}
|
|
90818
91100
|
};
|
|
90819
91101
|
}, [agentId]);
|
|
90820
|
-
const handleMemorySyncConflictSubmit =
|
|
91102
|
+
const handleMemorySyncConflictSubmit = import_react91.useCallback(async (answers) => {
|
|
90821
91103
|
if (!agentId || agentId === "loading" || !memorySyncConflicts) {
|
|
90822
91104
|
return;
|
|
90823
91105
|
}
|
|
@@ -90869,7 +91151,7 @@ ${resolutionSummary}`, true, commandInput);
|
|
|
90869
91151
|
memorySyncInFlightRef.current = false;
|
|
90870
91152
|
}
|
|
90871
91153
|
}, [agentId, appendError, memorySyncConflicts, updateMemorySyncCommand]);
|
|
90872
|
-
const handleMemorySyncConflictCancel =
|
|
91154
|
+
const handleMemorySyncConflictCancel = import_react91.useCallback(() => {
|
|
90873
91155
|
const commandId = memorySyncCommandIdRef.current;
|
|
90874
91156
|
const commandInput = memorySyncCommandInputRef.current;
|
|
90875
91157
|
memorySyncCommandIdRef.current = null;
|
|
@@ -90881,7 +91163,7 @@ ${resolutionSummary}`, true, commandInput);
|
|
|
90881
91163
|
updateMemorySyncCommand(commandId, "Memory sync cancelled.", false, commandInput);
|
|
90882
91164
|
}
|
|
90883
91165
|
}, [updateMemorySyncCommand]);
|
|
90884
|
-
const processConversation =
|
|
91166
|
+
const processConversation = import_react91.useCallback(async (initialInput, options) => {
|
|
90885
91167
|
const handleRalphContinuation = () => {
|
|
90886
91168
|
const ralphState = ralphMode.getState();
|
|
90887
91169
|
const lines2 = toLines(buffersRef.current);
|
|
@@ -90964,6 +91246,7 @@ ${newState.originalPrompt}`
|
|
|
90964
91246
|
return;
|
|
90965
91247
|
}
|
|
90966
91248
|
setStreaming(true);
|
|
91249
|
+
openTrajectorySegment();
|
|
90967
91250
|
setNetworkPhase("upload");
|
|
90968
91251
|
abortControllerRef.current = new AbortController;
|
|
90969
91252
|
const originalInput = currentInput;
|
|
@@ -91128,6 +91411,9 @@ ${newState.originalPrompt}`
|
|
|
91128
91411
|
setNetworkPhase("download");
|
|
91129
91412
|
syncAgentState();
|
|
91130
91413
|
};
|
|
91414
|
+
const runTokenStart = buffersRef.current.tokenCount;
|
|
91415
|
+
trajectoryRunTokenStartRef.current = runTokenStart;
|
|
91416
|
+
sessionStatsRef.current.startTrajectory();
|
|
91131
91417
|
const {
|
|
91132
91418
|
stopReason,
|
|
91133
91419
|
approval,
|
|
@@ -91138,7 +91424,14 @@ ${newState.originalPrompt}`
|
|
|
91138
91424
|
} = await drainStreamWithResume(stream2, buffersRef.current, refreshDerivedThrottled, signal, handleFirstMessage);
|
|
91139
91425
|
currentRunId = lastRunId ?? undefined;
|
|
91140
91426
|
sessionStatsRef.current.endTurn(apiDurationMs);
|
|
91141
|
-
sessionStatsRef.current.updateUsageFromBuffers(buffersRef.current);
|
|
91427
|
+
const usageDelta = sessionStatsRef.current.updateUsageFromBuffers(buffersRef.current);
|
|
91428
|
+
const tokenDelta = Math.max(0, buffersRef.current.tokenCount - runTokenStart);
|
|
91429
|
+
sessionStatsRef.current.accumulateTrajectory({
|
|
91430
|
+
apiDurationMs,
|
|
91431
|
+
usageDelta,
|
|
91432
|
+
tokenDelta
|
|
91433
|
+
});
|
|
91434
|
+
syncTrajectoryTokenBase();
|
|
91142
91435
|
const wasInterrupted = !!buffersRef.current.interrupted;
|
|
91143
91436
|
const wasAborted = !!signal?.aborted;
|
|
91144
91437
|
let stopReasonToHandle = wasAborted ? "cancelled" : stopReason;
|
|
@@ -91154,6 +91447,16 @@ ${newState.originalPrompt}`
|
|
|
91154
91447
|
}
|
|
91155
91448
|
if (stopReasonToHandle === "end_turn") {
|
|
91156
91449
|
setStreaming(false);
|
|
91450
|
+
const liveElapsedMs = (() => {
|
|
91451
|
+
const snapshot = sessionStatsRef.current.getTrajectorySnapshot();
|
|
91452
|
+
const base2 = snapshot?.wallMs ?? 0;
|
|
91453
|
+
const segmentStart = trajectorySegmentStartRef.current;
|
|
91454
|
+
if (segmentStart === null) {
|
|
91455
|
+
return base2;
|
|
91456
|
+
}
|
|
91457
|
+
return base2 + (performance.now() - segmentStart);
|
|
91458
|
+
})();
|
|
91459
|
+
closeTrajectorySegment();
|
|
91157
91460
|
llmApiErrorRetriesRef.current = 0;
|
|
91158
91461
|
conversationBusyRetriesRef.current = 0;
|
|
91159
91462
|
lastDequeuedMessageRef.current = null;
|
|
@@ -91194,6 +91497,27 @@ ${feedback}
|
|
|
91194
91497
|
if (needsEagerApprovalCheck) {
|
|
91195
91498
|
setNeedsEagerApprovalCheck(false);
|
|
91196
91499
|
}
|
|
91500
|
+
const trajectorySnapshot = sessionStatsRef.current.endTrajectory();
|
|
91501
|
+
setTrajectoryTokenBase(0);
|
|
91502
|
+
setTrajectoryElapsedBaseMs(0);
|
|
91503
|
+
trajectoryRunTokenStartRef.current = 0;
|
|
91504
|
+
trajectoryTokenDisplayRef.current = 0;
|
|
91505
|
+
if (trajectorySnapshot) {
|
|
91506
|
+
const summaryWallMs = Math.max(liveElapsedMs, trajectorySnapshot.wallMs);
|
|
91507
|
+
const shouldShowSummary = trajectorySnapshot.stepCount > 3 && summaryWallMs > 1e4 || summaryWallMs > 60000;
|
|
91508
|
+
if (shouldShowSummary) {
|
|
91509
|
+
const summaryId = uid4("trajectory-summary");
|
|
91510
|
+
buffersRef.current.byId.set(summaryId, {
|
|
91511
|
+
kind: "trajectory_summary",
|
|
91512
|
+
id: summaryId,
|
|
91513
|
+
durationMs: summaryWallMs,
|
|
91514
|
+
stepCount: trajectorySnapshot.stepCount,
|
|
91515
|
+
verb: getRandomPastTenseVerb()
|
|
91516
|
+
});
|
|
91517
|
+
buffersRef.current.order.push(summaryId);
|
|
91518
|
+
refreshDerived();
|
|
91519
|
+
}
|
|
91520
|
+
}
|
|
91197
91521
|
if (!waitingForQueueCancelRef.current) {
|
|
91198
91522
|
sendDesktopNotification("Turn completed, awaiting your input");
|
|
91199
91523
|
}
|
|
@@ -91214,6 +91538,8 @@ ${feedback}
|
|
|
91214
91538
|
}
|
|
91215
91539
|
if (stopReasonToHandle === "cancelled") {
|
|
91216
91540
|
setStreaming(false);
|
|
91541
|
+
closeTrajectorySegment();
|
|
91542
|
+
syncTrajectoryElapsedBase();
|
|
91217
91543
|
if (waitingForQueueCancelRef.current) {
|
|
91218
91544
|
debugLog("queue", "Queue-cancel completed (cancelled): messages will be processed by dequeue effect");
|
|
91219
91545
|
if (restoreQueueOnCancelRef.current) {
|
|
@@ -91248,6 +91574,8 @@ ${feedback}
|
|
|
91248
91574
|
if (approvalsToProcess.length === 0) {
|
|
91249
91575
|
appendError(`Unexpected empty approvals with stop reason: ${stopReason}`);
|
|
91250
91576
|
setStreaming(false);
|
|
91577
|
+
closeTrajectorySegment();
|
|
91578
|
+
syncTrajectoryElapsedBase();
|
|
91251
91579
|
return;
|
|
91252
91580
|
}
|
|
91253
91581
|
if (waitingForQueueCancelRef.current) {
|
|
@@ -91276,10 +91604,14 @@ ${feedback}
|
|
|
91276
91604
|
waitingForQueueCancelRef.current = false;
|
|
91277
91605
|
queueSnapshotRef.current = [];
|
|
91278
91606
|
setStreaming(false);
|
|
91607
|
+
closeTrajectorySegment();
|
|
91608
|
+
syncTrajectoryElapsedBase();
|
|
91279
91609
|
return;
|
|
91280
91610
|
}
|
|
91281
91611
|
if (userCancelledRef.current || abortControllerRef.current?.signal.aborted) {
|
|
91282
91612
|
setStreaming(false);
|
|
91613
|
+
closeTrajectorySegment();
|
|
91614
|
+
syncTrajectoryElapsedBase();
|
|
91283
91615
|
markIncompleteToolsAsCancelled(buffersRef.current, true, "user_interrupt");
|
|
91284
91616
|
refreshDerived();
|
|
91285
91617
|
return;
|
|
@@ -91444,6 +91776,8 @@ ${feedback}
|
|
|
91444
91776
|
queueApprovalResults(allResults, autoAllowedMetadata);
|
|
91445
91777
|
}
|
|
91446
91778
|
setStreaming(false);
|
|
91779
|
+
closeTrajectorySegment();
|
|
91780
|
+
syncTrajectoryElapsedBase();
|
|
91447
91781
|
markIncompleteToolsAsCancelled(buffersRef.current, true, "user_interrupt");
|
|
91448
91782
|
refreshDerived();
|
|
91449
91783
|
return;
|
|
@@ -91484,6 +91818,8 @@ ${feedback}
|
|
|
91484
91818
|
waitingForQueueCancelRef.current = false;
|
|
91485
91819
|
queueSnapshotRef.current = [];
|
|
91486
91820
|
setStreaming(false);
|
|
91821
|
+
closeTrajectorySegment();
|
|
91822
|
+
syncTrajectoryElapsedBase();
|
|
91487
91823
|
return;
|
|
91488
91824
|
}
|
|
91489
91825
|
setThinkingMessage(getRandomThinkingVerb());
|
|
@@ -91527,6 +91863,8 @@ ${feedback}
|
|
|
91527
91863
|
waitingForQueueCancelRef.current = false;
|
|
91528
91864
|
queueSnapshotRef.current = [];
|
|
91529
91865
|
setStreaming(false);
|
|
91866
|
+
closeTrajectorySegment();
|
|
91867
|
+
syncTrajectoryElapsedBase();
|
|
91530
91868
|
return;
|
|
91531
91869
|
}
|
|
91532
91870
|
} finally {
|
|
@@ -91540,6 +91878,8 @@ ${feedback}
|
|
|
91540
91878
|
}
|
|
91541
91879
|
if (userCancelledRef.current || abortControllerRef.current?.signal.aborted) {
|
|
91542
91880
|
setStreaming(false);
|
|
91881
|
+
closeTrajectorySegment();
|
|
91882
|
+
syncTrajectoryElapsedBase();
|
|
91543
91883
|
markIncompleteToolsAsCancelled(buffersRef.current, true, "user_interrupt");
|
|
91544
91884
|
refreshDerived();
|
|
91545
91885
|
return;
|
|
@@ -91549,6 +91889,8 @@ ${feedback}
|
|
|
91549
91889
|
setAutoHandledResults(autoAllowedResults);
|
|
91550
91890
|
setAutoDeniedApprovals(autoDeniedResults);
|
|
91551
91891
|
setStreaming(false);
|
|
91892
|
+
closeTrajectorySegment();
|
|
91893
|
+
syncTrajectoryElapsedBase();
|
|
91552
91894
|
sendDesktopNotification("Approval needed");
|
|
91553
91895
|
return;
|
|
91554
91896
|
}
|
|
@@ -91683,6 +92025,7 @@ ${feedback}
|
|
|
91683
92025
|
setStreaming(false);
|
|
91684
92026
|
sendDesktopNotification("Stream error", "error");
|
|
91685
92027
|
refreshDerived();
|
|
92028
|
+
resetTrajectoryBases();
|
|
91686
92029
|
return;
|
|
91687
92030
|
}
|
|
91688
92031
|
if (lastRunId) {
|
|
@@ -91718,6 +92061,7 @@ ${feedback}
|
|
|
91718
92061
|
setStreaming(false);
|
|
91719
92062
|
sendDesktopNotification();
|
|
91720
92063
|
refreshDerived();
|
|
92064
|
+
resetTrajectoryBases();
|
|
91721
92065
|
return;
|
|
91722
92066
|
}
|
|
91723
92067
|
} else {
|
|
@@ -91733,6 +92077,7 @@ ${feedback}
|
|
|
91733
92077
|
setStreaming(false);
|
|
91734
92078
|
sendDesktopNotification("Execution error", "error");
|
|
91735
92079
|
refreshDerived();
|
|
92080
|
+
resetTrajectoryBases();
|
|
91736
92081
|
return;
|
|
91737
92082
|
}
|
|
91738
92083
|
} catch (e) {
|
|
@@ -91761,6 +92106,7 @@ ${feedback}
|
|
|
91761
92106
|
setStreaming(false);
|
|
91762
92107
|
sendDesktopNotification("Processing error", "error");
|
|
91763
92108
|
refreshDerived();
|
|
92109
|
+
resetTrajectoryBases();
|
|
91764
92110
|
} finally {
|
|
91765
92111
|
const isStale = myGeneration !== conversationGenerationRef.current;
|
|
91766
92112
|
abortControllerRef.current = null;
|
|
@@ -91778,9 +92124,14 @@ ${feedback}
|
|
|
91778
92124
|
needsEagerApprovalCheck,
|
|
91779
92125
|
queueApprovalResults,
|
|
91780
92126
|
consumeQueuedMessages,
|
|
91781
|
-
maybeSyncMemoryFilesystemAfterTurn
|
|
92127
|
+
maybeSyncMemoryFilesystemAfterTurn,
|
|
92128
|
+
openTrajectorySegment,
|
|
92129
|
+
syncTrajectoryTokenBase,
|
|
92130
|
+
syncTrajectoryElapsedBase,
|
|
92131
|
+
closeTrajectorySegment,
|
|
92132
|
+
resetTrajectoryBases
|
|
91782
92133
|
]);
|
|
91783
|
-
const handleExit =
|
|
92134
|
+
const handleExit = import_react91.useCallback(async () => {
|
|
91784
92135
|
saveLastAgentBeforeExit();
|
|
91785
92136
|
const stats = sessionStatsRef.current.getSnapshot();
|
|
91786
92137
|
telemetry2.trackSessionEnd(stats, "exit_command");
|
|
@@ -91790,10 +92141,10 @@ ${feedback}
|
|
|
91790
92141
|
process.exit(0);
|
|
91791
92142
|
}, 100);
|
|
91792
92143
|
}, []);
|
|
91793
|
-
const handleEnterQueueEditMode =
|
|
92144
|
+
const handleEnterQueueEditMode = import_react91.useCallback(() => {
|
|
91794
92145
|
setMessageQueue([]);
|
|
91795
92146
|
}, []);
|
|
91796
|
-
const handlePasteError =
|
|
92147
|
+
const handlePasteError = import_react91.useCallback((message) => {
|
|
91797
92148
|
const statusId = uid4("status");
|
|
91798
92149
|
buffersRef.current.byId.set(statusId, {
|
|
91799
92150
|
kind: "status",
|
|
@@ -91803,7 +92154,7 @@ ${feedback}
|
|
|
91803
92154
|
buffersRef.current.order.push(statusId);
|
|
91804
92155
|
refreshDerived();
|
|
91805
92156
|
}, [refreshDerived]);
|
|
91806
|
-
const handleInterrupt =
|
|
92157
|
+
const handleInterrupt = import_react91.useCallback(async () => {
|
|
91807
92158
|
const hasTrackedTools = executingToolCallIdsRef.current.length > 0 || autoAllowedExecutionRef.current?.results;
|
|
91808
92159
|
if (isExecutingTool && toolAbortControllerRef.current && hasTrackedTools && !toolResultsInFlightRef.current) {
|
|
91809
92160
|
toolAbortControllerRef.current.abort();
|
|
@@ -91948,11 +92299,11 @@ ${feedback}
|
|
|
91948
92299
|
autoDeniedApprovals,
|
|
91949
92300
|
queueApprovalResults
|
|
91950
92301
|
]);
|
|
91951
|
-
const processConversationRef =
|
|
91952
|
-
|
|
92302
|
+
const processConversationRef = import_react91.useRef(processConversation);
|
|
92303
|
+
import_react91.useEffect(() => {
|
|
91953
92304
|
processConversationRef.current = processConversation;
|
|
91954
92305
|
}, [processConversation]);
|
|
91955
|
-
const handleAgentSelect =
|
|
92306
|
+
const handleAgentSelect = import_react91.useCallback(async (targetAgentId, opts) => {
|
|
91956
92307
|
setActiveOverlay(null);
|
|
91957
92308
|
if (targetAgentId === agentId) {
|
|
91958
92309
|
const label = agentName || targetAgentId.slice(0, 12);
|
|
@@ -92015,6 +92366,7 @@ ${feedback}
|
|
|
92015
92366
|
emittedIdsRef.current.clear();
|
|
92016
92367
|
setStaticItems([]);
|
|
92017
92368
|
setStaticRenderEpoch((e) => e + 1);
|
|
92369
|
+
resetTrajectoryBases();
|
|
92018
92370
|
turnCountRef.current = 0;
|
|
92019
92371
|
agentIdRef.current = targetAgentId;
|
|
92020
92372
|
setAgentId(targetAgentId);
|
|
@@ -92063,8 +92415,15 @@ ${feedback}
|
|
|
92063
92415
|
} finally {
|
|
92064
92416
|
setCommandRunning(false);
|
|
92065
92417
|
}
|
|
92066
|
-
}, [
|
|
92067
|
-
|
|
92418
|
+
}, [
|
|
92419
|
+
refreshDerived,
|
|
92420
|
+
agentId,
|
|
92421
|
+
agentName,
|
|
92422
|
+
setCommandRunning,
|
|
92423
|
+
isAgentBusy,
|
|
92424
|
+
resetTrajectoryBases
|
|
92425
|
+
]);
|
|
92426
|
+
const handleCreateNewAgent = import_react91.useCallback(async (name) => {
|
|
92068
92427
|
setActiveOverlay(null);
|
|
92069
92428
|
setCommandRunning(true);
|
|
92070
92429
|
const inputCmd = "/new";
|
|
@@ -92087,6 +92446,7 @@ ${feedback}
|
|
|
92087
92446
|
emittedIdsRef.current.clear();
|
|
92088
92447
|
setStaticItems([]);
|
|
92089
92448
|
setStaticRenderEpoch((e) => e + 1);
|
|
92449
|
+
resetTrajectoryBases();
|
|
92090
92450
|
turnCountRef.current = 0;
|
|
92091
92451
|
agentIdRef.current = agent.id;
|
|
92092
92452
|
setAgentId(agent.id);
|
|
@@ -92127,8 +92487,8 @@ ${feedback}
|
|
|
92127
92487
|
} finally {
|
|
92128
92488
|
setCommandRunning(false);
|
|
92129
92489
|
}
|
|
92130
|
-
}, [refreshDerived, agentId, setCommandRunning]);
|
|
92131
|
-
const handleBashSubmit =
|
|
92490
|
+
}, [refreshDerived, agentId, setCommandRunning, resetTrajectoryBases]);
|
|
92491
|
+
const handleBashSubmit = import_react91.useCallback(async (command) => {
|
|
92132
92492
|
if (bashRunning)
|
|
92133
92493
|
return;
|
|
92134
92494
|
const cmdId = uid4("bash");
|
|
@@ -92216,12 +92576,12 @@ ${expanded.command}` : expanded.command;
|
|
|
92216
92576
|
}
|
|
92217
92577
|
refreshDerived();
|
|
92218
92578
|
}, [bashRunning, refreshDerived, refreshDerivedStreaming]);
|
|
92219
|
-
const handleBashInterrupt =
|
|
92579
|
+
const handleBashInterrupt = import_react91.useCallback(() => {
|
|
92220
92580
|
if (bashAbortControllerRef.current) {
|
|
92221
92581
|
bashAbortControllerRef.current.abort();
|
|
92222
92582
|
}
|
|
92223
92583
|
}, []);
|
|
92224
|
-
const checkPendingApprovalsForSlashCommand =
|
|
92584
|
+
const checkPendingApprovalsForSlashCommand = import_react91.useCallback(async () => {
|
|
92225
92585
|
if (!needsEagerApprovalCheck) {
|
|
92226
92586
|
return { blocked: false };
|
|
92227
92587
|
}
|
|
@@ -92364,7 +92724,7 @@ ${expanded.command}` : expanded.command;
|
|
|
92364
92724
|
needsEagerApprovalCheck,
|
|
92365
92725
|
queueApprovalResults
|
|
92366
92726
|
]);
|
|
92367
|
-
const onSubmit =
|
|
92727
|
+
const onSubmit = import_react91.useCallback(async (message) => {
|
|
92368
92728
|
const msg = message?.trim() ?? "";
|
|
92369
92729
|
if (profileConfirmPending && !msg) {
|
|
92370
92730
|
const { name, agentId: targetAgentId, cmdId } = profileConfirmPending;
|
|
@@ -93171,6 +93531,7 @@ Type your task to begin the loop.`,
|
|
|
93171
93531
|
emittedIdsRef.current.clear();
|
|
93172
93532
|
setStaticItems([]);
|
|
93173
93533
|
setStaticRenderEpoch((e) => e + 1);
|
|
93534
|
+
resetTrajectoryBases();
|
|
93174
93535
|
const currentAgentName = agentState.name || "Unnamed Agent";
|
|
93175
93536
|
const successLines = resumeData.messageHistory.length > 0 ? [
|
|
93176
93537
|
`Resumed conversation with "${currentAgentName}"`,
|
|
@@ -94068,9 +94429,15 @@ ${SYSTEM_REMINDER_CLOSE}
|
|
|
94068
94429
|
});
|
|
94069
94430
|
buffersRef.current.order.push(userId);
|
|
94070
94431
|
buffersRef.current.tokenCount = 0;
|
|
94432
|
+
if (!sessionStatsRef.current.getTrajectorySnapshot()) {
|
|
94433
|
+
trajectoryTokenDisplayRef.current = 0;
|
|
94434
|
+
setTrajectoryTokenBase(0);
|
|
94435
|
+
trajectoryRunTokenStartRef.current = 0;
|
|
94436
|
+
}
|
|
94071
94437
|
buffersRef.current.interrupted = false;
|
|
94072
94438
|
setThinkingMessage(getRandomThinkingVerb());
|
|
94073
94439
|
setStreaming(true);
|
|
94440
|
+
openTrajectorySegment();
|
|
94074
94441
|
refreshDerived();
|
|
94075
94442
|
if (needsEagerApprovalCheck && !queuedApprovalResults) {
|
|
94076
94443
|
const eagerStatusId = uid4("status");
|
|
@@ -94500,13 +94867,15 @@ ${SYSTEM_REMINDER_CLOSE}
|
|
|
94500
94867
|
isAgentBusy,
|
|
94501
94868
|
setStreaming,
|
|
94502
94869
|
setCommandRunning,
|
|
94503
|
-
pendingRalphConfig
|
|
94870
|
+
pendingRalphConfig,
|
|
94871
|
+
openTrajectorySegment,
|
|
94872
|
+
resetTrajectoryBases
|
|
94504
94873
|
]);
|
|
94505
|
-
const onSubmitRef =
|
|
94506
|
-
|
|
94874
|
+
const onSubmitRef = import_react91.useRef(onSubmit);
|
|
94875
|
+
import_react91.useEffect(() => {
|
|
94507
94876
|
onSubmitRef.current = onSubmit;
|
|
94508
94877
|
}, [onSubmit]);
|
|
94509
|
-
|
|
94878
|
+
import_react91.useEffect(() => {
|
|
94510
94879
|
if (!streaming && messageQueue.length > 0 && pendingApprovals.length === 0 && !commandRunning && !isExecutingTool && !anySelectorOpen && !waitingForQueueCancelRef.current && !userCancelledRef.current) {
|
|
94511
94880
|
const concatenatedMessage = messageQueue.join(`
|
|
94512
94881
|
`);
|
|
@@ -94526,7 +94895,7 @@ ${SYSTEM_REMINDER_CLOSE}
|
|
|
94526
94895
|
anySelectorOpen,
|
|
94527
94896
|
dequeueEpoch
|
|
94528
94897
|
]);
|
|
94529
|
-
const sendAllResults =
|
|
94898
|
+
const sendAllResults = import_react91.useCallback(async (additionalDecision) => {
|
|
94530
94899
|
try {
|
|
94531
94900
|
if (userCancelledRef.current || abortControllerRef.current?.signal.aborted) {
|
|
94532
94901
|
setStreaming(false);
|
|
@@ -94548,6 +94917,7 @@ ${SYSTEM_REMINDER_CLOSE}
|
|
|
94548
94917
|
setAutoHandledResults([]);
|
|
94549
94918
|
setAutoDeniedApprovals([]);
|
|
94550
94919
|
setStreaming(true);
|
|
94920
|
+
openTrajectorySegment();
|
|
94551
94921
|
buffersRef.current.interrupted = false;
|
|
94552
94922
|
const approvalAbortController = new AbortController;
|
|
94553
94923
|
toolAbortControllerRef.current = approvalAbortController;
|
|
@@ -94559,19 +94929,29 @@ ${SYSTEM_REMINDER_CLOSE}
|
|
|
94559
94929
|
setToolCallsRunning(buffersRef.current, allDecisions.filter((d) => d.type === "approve").map((d) => d.approval.toolCallId));
|
|
94560
94930
|
refreshDerived();
|
|
94561
94931
|
const { executeApprovalBatch: executeApprovalBatch2 } = await init_approval_execution().then(() => exports_approval_execution);
|
|
94562
|
-
|
|
94563
|
-
|
|
94564
|
-
|
|
94565
|
-
|
|
94566
|
-
|
|
94567
|
-
|
|
94932
|
+
sessionStatsRef.current.startTrajectory();
|
|
94933
|
+
const toolRunStart = performance.now();
|
|
94934
|
+
let executedResults;
|
|
94935
|
+
try {
|
|
94936
|
+
executedResults = await executeApprovalBatch2(allDecisions, (chunk) => {
|
|
94937
|
+
onChunk(buffersRef.current, chunk);
|
|
94938
|
+
if (chunk.status === "error" && chunk.message_type === "tool_return_message") {
|
|
94939
|
+
const isToolError = chunk.tool_return?.startsWith("Error executing tool:");
|
|
94940
|
+
if (isToolError) {
|
|
94941
|
+
appendError(chunk.tool_return);
|
|
94942
|
+
}
|
|
94568
94943
|
}
|
|
94569
|
-
|
|
94570
|
-
|
|
94571
|
-
|
|
94572
|
-
|
|
94573
|
-
|
|
94574
|
-
}
|
|
94944
|
+
refreshDerived();
|
|
94945
|
+
}, {
|
|
94946
|
+
abortSignal: approvalAbortController.signal,
|
|
94947
|
+
onStreamingOutput: updateStreamingOutput
|
|
94948
|
+
});
|
|
94949
|
+
} finally {
|
|
94950
|
+
const toolRunMs = performance.now() - toolRunStart;
|
|
94951
|
+
sessionStatsRef.current.accumulateTrajectory({
|
|
94952
|
+
localToolMs: toolRunMs
|
|
94953
|
+
});
|
|
94954
|
+
}
|
|
94575
94955
|
const allResults = [
|
|
94576
94956
|
...autoHandledSnapshot.map((ar) => ({
|
|
94577
94957
|
type: "tool",
|
|
@@ -94613,6 +94993,8 @@ ${SYSTEM_REMINDER_CLOSE}
|
|
|
94613
94993
|
queueApprovalResults(allResults);
|
|
94614
94994
|
}
|
|
94615
94995
|
setStreaming(false);
|
|
94996
|
+
closeTrajectorySegment();
|
|
94997
|
+
syncTrajectoryElapsedBase();
|
|
94616
94998
|
waitingForQueueCancelRef.current = false;
|
|
94617
94999
|
queueSnapshotRef.current = [];
|
|
94618
95000
|
} else {
|
|
@@ -94660,9 +95042,12 @@ ${SYSTEM_REMINDER_CLOSE}
|
|
|
94660
95042
|
setStreaming,
|
|
94661
95043
|
updateStreamingOutput,
|
|
94662
95044
|
queueApprovalResults,
|
|
94663
|
-
consumeQueuedMessages
|
|
95045
|
+
consumeQueuedMessages,
|
|
95046
|
+
syncTrajectoryElapsedBase,
|
|
95047
|
+
closeTrajectorySegment,
|
|
95048
|
+
openTrajectorySegment
|
|
94664
95049
|
]);
|
|
94665
|
-
const handleApproveCurrent =
|
|
95050
|
+
const handleApproveCurrent = import_react91.useCallback(async (diffs) => {
|
|
94666
95051
|
if (isExecutingTool)
|
|
94667
95052
|
return;
|
|
94668
95053
|
const currentIndex = approvalResults.length;
|
|
@@ -94701,7 +95086,7 @@ ${SYSTEM_REMINDER_CLOSE}
|
|
|
94701
95086
|
isExecutingTool,
|
|
94702
95087
|
setStreaming
|
|
94703
95088
|
]);
|
|
94704
|
-
const handleApproveAlways =
|
|
95089
|
+
const handleApproveAlways = import_react91.useCallback(async (scope, diffs) => {
|
|
94705
95090
|
if (isExecutingTool)
|
|
94706
95091
|
return;
|
|
94707
95092
|
if (pendingApprovals.length === 0 || approvalContexts.length === 0)
|
|
@@ -94759,6 +95144,7 @@ ${SYSTEM_REMINDER_CLOSE}
|
|
|
94759
95144
|
setAutoHandledResults([]);
|
|
94760
95145
|
setAutoDeniedApprovals([]);
|
|
94761
95146
|
setStreaming(true);
|
|
95147
|
+
openTrajectorySegment();
|
|
94762
95148
|
buffersRef.current.interrupted = false;
|
|
94763
95149
|
setToolCallsRunning(buffersRef.current, allDecisions.filter((d) => d.type === "approve").map((d) => d.approval.toolCallId));
|
|
94764
95150
|
refreshDerived();
|
|
@@ -94811,9 +95197,10 @@ ${SYSTEM_REMINDER_CLOSE}
|
|
|
94811
95197
|
refreshDerived,
|
|
94812
95198
|
isExecutingTool,
|
|
94813
95199
|
setStreaming,
|
|
95200
|
+
openTrajectorySegment,
|
|
94814
95201
|
updateStreamingOutput
|
|
94815
95202
|
]);
|
|
94816
|
-
const handleDenyCurrent =
|
|
95203
|
+
const handleDenyCurrent = import_react91.useCallback(async (reason) => {
|
|
94817
95204
|
if (isExecutingTool)
|
|
94818
95205
|
return;
|
|
94819
95206
|
const currentIndex = approvalResults.length;
|
|
@@ -94849,7 +95236,7 @@ ${SYSTEM_REMINDER_CLOSE}
|
|
|
94849
95236
|
isExecutingTool,
|
|
94850
95237
|
setStreaming
|
|
94851
95238
|
]);
|
|
94852
|
-
const handleCancelApprovals =
|
|
95239
|
+
const handleCancelApprovals = import_react91.useCallback(() => {
|
|
94853
95240
|
if (pendingApprovals.length === 0)
|
|
94854
95241
|
return;
|
|
94855
95242
|
const denialResults = pendingApprovals.map((approval) => ({
|
|
@@ -94867,7 +95254,7 @@ ${SYSTEM_REMINDER_CLOSE}
|
|
|
94867
95254
|
setAutoHandledResults([]);
|
|
94868
95255
|
setAutoDeniedApprovals([]);
|
|
94869
95256
|
}, [pendingApprovals, refreshDerived, queueApprovalResults]);
|
|
94870
|
-
const handleModelSelect =
|
|
95257
|
+
const handleModelSelect = import_react91.useCallback(async (modelId) => {
|
|
94871
95258
|
if (isAgentBusy()) {
|
|
94872
95259
|
setActiveOverlay(null);
|
|
94873
95260
|
setQueuedOverlayAction({ type: "switch_model", modelId });
|
|
@@ -94968,7 +95355,7 @@ Consider switching to a different system prompt using /system to match.` : null;
|
|
|
94968
95355
|
}
|
|
94969
95356
|
});
|
|
94970
95357
|
}, [agentId, refreshDerived, currentToolset, withCommandLock, isAgentBusy]);
|
|
94971
|
-
|
|
95358
|
+
import_react91.useEffect(() => {
|
|
94972
95359
|
if (!streaming && !commandRunning && !isExecutingTool && pendingApprovals.length === 0 && queuedOverlayAction !== null) {
|
|
94973
95360
|
const action = queuedOverlayAction;
|
|
94974
95361
|
setQueuedOverlayAction(null);
|
|
@@ -95141,7 +95528,7 @@ Consider switching to a different system prompt using /system to match.` : null;
|
|
|
95141
95528
|
refreshDerived,
|
|
95142
95529
|
setCommandRunning
|
|
95143
95530
|
]);
|
|
95144
|
-
const handleSystemPromptSelect =
|
|
95531
|
+
const handleSystemPromptSelect = import_react91.useCallback(async (promptId) => {
|
|
95145
95532
|
if (isAgentBusy()) {
|
|
95146
95533
|
setActiveOverlay(null);
|
|
95147
95534
|
setQueuedOverlayAction({ type: "switch_system", promptId });
|
|
@@ -95222,7 +95609,7 @@ Consider switching to a different system prompt using /system to match.` : null;
|
|
|
95222
95609
|
}
|
|
95223
95610
|
});
|
|
95224
95611
|
}, [agentId, refreshDerived, withCommandLock, isAgentBusy]);
|
|
95225
|
-
const handleToolsetSelect =
|
|
95612
|
+
const handleToolsetSelect = import_react91.useCallback(async (toolsetId) => {
|
|
95226
95613
|
if (isAgentBusy()) {
|
|
95227
95614
|
setActiveOverlay(null);
|
|
95228
95615
|
setQueuedOverlayAction({ type: "switch_toolset", toolsetId });
|
|
@@ -95277,7 +95664,7 @@ Consider switching to a different system prompt using /system to match.` : null;
|
|
|
95277
95664
|
}
|
|
95278
95665
|
});
|
|
95279
95666
|
}, [agentId, refreshDerived, withCommandLock, isAgentBusy]);
|
|
95280
|
-
const handleFeedbackSubmit =
|
|
95667
|
+
const handleFeedbackSubmit = import_react91.useCallback(async (message) => {
|
|
95281
95668
|
closeOverlay();
|
|
95282
95669
|
await withCommandLock(async () => {
|
|
95283
95670
|
const cmdId = uid4("cmd");
|
|
@@ -95376,7 +95763,7 @@ Consider switching to a different system prompt using /system to match.` : null;
|
|
|
95376
95763
|
withCommandLock,
|
|
95377
95764
|
closeOverlay
|
|
95378
95765
|
]);
|
|
95379
|
-
const handleProfileEscapeCancel =
|
|
95766
|
+
const handleProfileEscapeCancel = import_react91.useCallback(() => {
|
|
95380
95767
|
if (profileConfirmPending) {
|
|
95381
95768
|
const { cmdId, name } = profileConfirmPending;
|
|
95382
95769
|
buffersRef.current.byId.set(cmdId, {
|
|
@@ -95391,8 +95778,8 @@ Consider switching to a different system prompt using /system to match.` : null;
|
|
|
95391
95778
|
setProfileConfirmPending(null);
|
|
95392
95779
|
}
|
|
95393
95780
|
}, [profileConfirmPending, refreshDerived]);
|
|
95394
|
-
const [uiPermissionMode, setUiPermissionMode] =
|
|
95395
|
-
const handleRalphExit =
|
|
95781
|
+
const [uiPermissionMode, setUiPermissionMode] = import_react91.useState(permissionMode2.getMode());
|
|
95782
|
+
const handleRalphExit = import_react91.useCallback(() => {
|
|
95396
95783
|
const ralph = ralphMode.getState();
|
|
95397
95784
|
if (ralph.isActive) {
|
|
95398
95785
|
const wasYolo = ralph.isYolo;
|
|
@@ -95404,14 +95791,14 @@ Consider switching to a different system prompt using /system to match.` : null;
|
|
|
95404
95791
|
}
|
|
95405
95792
|
}
|
|
95406
95793
|
}, []);
|
|
95407
|
-
const handlePermissionModeChange =
|
|
95794
|
+
const handlePermissionModeChange = import_react91.useCallback((mode) => {
|
|
95408
95795
|
if (mode === "plan") {
|
|
95409
95796
|
const planPath = generatePlanFilePath();
|
|
95410
95797
|
permissionMode2.setPlanFilePath(planPath);
|
|
95411
95798
|
}
|
|
95412
95799
|
setUiPermissionMode(mode);
|
|
95413
95800
|
}, []);
|
|
95414
|
-
const handlePlanApprove =
|
|
95801
|
+
const handlePlanApprove = import_react91.useCallback(async (acceptEdits = false) => {
|
|
95415
95802
|
const currentIndex = approvalResults.length;
|
|
95416
95803
|
const approval = pendingApprovals[currentIndex];
|
|
95417
95804
|
if (!approval)
|
|
@@ -95462,7 +95849,7 @@ Consider switching to a different system prompt using /system to match.` : null;
|
|
|
95462
95849
|
refreshDerived,
|
|
95463
95850
|
setStreaming
|
|
95464
95851
|
]);
|
|
95465
|
-
const handlePlanKeepPlanning =
|
|
95852
|
+
const handlePlanKeepPlanning = import_react91.useCallback(async (reason) => {
|
|
95466
95853
|
const currentIndex = approvalResults.length;
|
|
95467
95854
|
const approval = pendingApprovals[currentIndex];
|
|
95468
95855
|
if (!approval)
|
|
@@ -95481,7 +95868,7 @@ Consider switching to a different system prompt using /system to match.` : null;
|
|
|
95481
95868
|
setApprovalResults((prev) => [...prev, decision]);
|
|
95482
95869
|
}
|
|
95483
95870
|
}, [pendingApprovals, approvalResults, sendAllResults]);
|
|
95484
|
-
|
|
95871
|
+
import_react91.useEffect(() => {
|
|
95485
95872
|
const currentIndex = approvalResults.length;
|
|
95486
95873
|
const approval = pendingApprovals[currentIndex];
|
|
95487
95874
|
if (approval?.toolName === "ExitPlanMode") {
|
|
@@ -95526,7 +95913,7 @@ Consider switching to a different system prompt using /system to match.` : null;
|
|
|
95526
95913
|
refreshDerived,
|
|
95527
95914
|
queueApprovalResults
|
|
95528
95915
|
]);
|
|
95529
|
-
const handleQuestionSubmit =
|
|
95916
|
+
const handleQuestionSubmit = import_react91.useCallback(async (answers) => {
|
|
95530
95917
|
const currentIndex = approvalResults.length;
|
|
95531
95918
|
const approval = pendingApprovals[currentIndex];
|
|
95532
95919
|
if (!approval)
|
|
@@ -95570,7 +95957,7 @@ Consider switching to a different system prompt using /system to match.` : null;
|
|
|
95570
95957
|
setApprovalResults((prev) => [...prev, decision]);
|
|
95571
95958
|
}
|
|
95572
95959
|
}, [pendingApprovals, approvalResults, sendAllResults, refreshDerived]);
|
|
95573
|
-
const handleEnterPlanModeApprove =
|
|
95960
|
+
const handleEnterPlanModeApprove = import_react91.useCallback(async () => {
|
|
95574
95961
|
const currentIndex = approvalResults.length;
|
|
95575
95962
|
const approval = pendingApprovals[currentIndex];
|
|
95576
95963
|
if (!approval)
|
|
@@ -95621,7 +96008,7 @@ Plan file path: ${planFilePath}`;
|
|
|
95621
96008
|
setApprovalResults((prev) => [...prev, decision]);
|
|
95622
96009
|
}
|
|
95623
96010
|
}, [pendingApprovals, approvalResults, sendAllResults, refreshDerived]);
|
|
95624
|
-
const handleEnterPlanModeReject =
|
|
96011
|
+
const handleEnterPlanModeReject = import_react91.useCallback(async () => {
|
|
95625
96012
|
const currentIndex = approvalResults.length;
|
|
95626
96013
|
const approval = pendingApprovals[currentIndex];
|
|
95627
96014
|
if (!approval)
|
|
@@ -95640,7 +96027,7 @@ Plan file path: ${planFilePath}`;
|
|
|
95640
96027
|
setApprovalResults((prev) => [...prev, decision]);
|
|
95641
96028
|
}
|
|
95642
96029
|
}, [pendingApprovals, approvalResults, sendAllResults]);
|
|
95643
|
-
const liveItems =
|
|
96030
|
+
const liveItems = import_react91.useMemo(() => {
|
|
95644
96031
|
return lines.filter((ln) => {
|
|
95645
96032
|
if (!("phase" in ln))
|
|
95646
96033
|
return false;
|
|
@@ -95661,8 +96048,8 @@ Plan file path: ${planFilePath}`;
|
|
|
95661
96048
|
return ln.phase === "streaming";
|
|
95662
96049
|
});
|
|
95663
96050
|
}, [lines, tokenStreamingEnabled]);
|
|
95664
|
-
const { agents: subagents } =
|
|
95665
|
-
const shouldAnimate =
|
|
96051
|
+
const { agents: subagents } = import_react91.useSyncExternalStore(subscribe2, getSnapshot2);
|
|
96052
|
+
const shouldAnimate = import_react91.useMemo(() => {
|
|
95666
96053
|
const countLines4 = (text) => {
|
|
95667
96054
|
if (!text)
|
|
95668
96055
|
return 0;
|
|
@@ -95688,7 +96075,7 @@ Plan file path: ${planFilePath}`;
|
|
|
95688
96075
|
const estimatedHeight = liveItemsHeight + subagentsHeight + FIXED_BUFFER;
|
|
95689
96076
|
return estimatedHeight < terminalRows;
|
|
95690
96077
|
}, [liveItems, terminalRows, subagents.length]);
|
|
95691
|
-
|
|
96078
|
+
import_react91.useEffect(() => {
|
|
95692
96079
|
if (loadingState === "ready" && !welcomeCommittedRef.current && messageHistory.length === 0) {
|
|
95693
96080
|
if (!continueSession && !agentProvenance) {
|
|
95694
96081
|
return;
|
|
@@ -95752,46 +96139,58 @@ Plan file path: ${planFilePath}`;
|
|
|
95752
96139
|
refreshDerived,
|
|
95753
96140
|
releaseNotes
|
|
95754
96141
|
]);
|
|
95755
|
-
|
|
96142
|
+
const liveTrajectorySnapshot = sessionStatsRef.current.getTrajectorySnapshot();
|
|
96143
|
+
const liveTrajectoryTokenBase = liveTrajectorySnapshot?.tokens ?? trajectoryTokenBase;
|
|
96144
|
+
const liveTrajectoryElapsedBaseMs = liveTrajectorySnapshot?.wallMs ?? trajectoryElapsedBaseMs;
|
|
96145
|
+
const runTokenDelta = Math.max(0, tokenCount - trajectoryRunTokenStartRef.current);
|
|
96146
|
+
const trajectoryTokenDisplay = Math.max(liveTrajectoryTokenBase + runTokenDelta, trajectoryTokenDisplayRef.current);
|
|
96147
|
+
const inputVisible = !showExitStats;
|
|
96148
|
+
const inputEnabled = !showExitStats && pendingApprovals.length === 0 && !anySelectorOpen;
|
|
96149
|
+
import_react91.useEffect(() => {
|
|
96150
|
+
trajectoryTokenDisplayRef.current = trajectoryTokenDisplay;
|
|
96151
|
+
}, [trajectoryTokenDisplay]);
|
|
96152
|
+
return /* @__PURE__ */ jsx_dev_runtime69.jsxDEV(Box_default, {
|
|
95756
96153
|
flexDirection: "column",
|
|
95757
96154
|
children: [
|
|
95758
|
-
/* @__PURE__ */
|
|
96155
|
+
/* @__PURE__ */ jsx_dev_runtime69.jsxDEV(Static, {
|
|
95759
96156
|
items: staticItems,
|
|
95760
96157
|
style: { flexDirection: "column" },
|
|
95761
|
-
children: (item, index) => /* @__PURE__ */
|
|
96158
|
+
children: (item, index) => /* @__PURE__ */ jsx_dev_runtime69.jsxDEV(Box_default, {
|
|
95762
96159
|
marginTop: index > 0 ? 1 : 0,
|
|
95763
|
-
children: item.kind === "welcome" ? /* @__PURE__ */
|
|
96160
|
+
children: item.kind === "welcome" ? /* @__PURE__ */ jsx_dev_runtime69.jsxDEV(WelcomeScreen, {
|
|
95764
96161
|
loadingState: "ready",
|
|
95765
96162
|
...item.snapshot
|
|
95766
|
-
}, undefined, false, undefined, this) : item.kind === "user" ? /* @__PURE__ */
|
|
96163
|
+
}, undefined, false, undefined, this) : item.kind === "user" ? /* @__PURE__ */ jsx_dev_runtime69.jsxDEV(UserMessage, {
|
|
95767
96164
|
line: item
|
|
95768
|
-
}, undefined, false, undefined, this) : item.kind === "reasoning" ? /* @__PURE__ */
|
|
96165
|
+
}, undefined, false, undefined, this) : item.kind === "reasoning" ? /* @__PURE__ */ jsx_dev_runtime69.jsxDEV(ReasoningMessage, {
|
|
95769
96166
|
line: item
|
|
95770
|
-
}, undefined, false, undefined, this) : item.kind === "assistant" ? /* @__PURE__ */
|
|
96167
|
+
}, undefined, false, undefined, this) : item.kind === "assistant" ? /* @__PURE__ */ jsx_dev_runtime69.jsxDEV(AssistantMessage, {
|
|
95771
96168
|
line: item
|
|
95772
|
-
}, undefined, false, undefined, this) : item.kind === "tool_call" ? /* @__PURE__ */
|
|
96169
|
+
}, undefined, false, undefined, this) : item.kind === "tool_call" ? /* @__PURE__ */ jsx_dev_runtime69.jsxDEV(ToolCallMessage, {
|
|
95773
96170
|
line: item,
|
|
95774
96171
|
precomputedDiffs: precomputedDiffsRef.current,
|
|
95775
96172
|
lastPlanFilePath: lastPlanFilePathRef.current
|
|
95776
|
-
}, undefined, false, undefined, this) : item.kind === "subagent_group" ? /* @__PURE__ */
|
|
96173
|
+
}, undefined, false, undefined, this) : item.kind === "subagent_group" ? /* @__PURE__ */ jsx_dev_runtime69.jsxDEV(SubagentGroupStatic, {
|
|
95777
96174
|
agents: item.agents
|
|
95778
|
-
}, undefined, false, undefined, this) : item.kind === "error" ? /* @__PURE__ */
|
|
96175
|
+
}, undefined, false, undefined, this) : item.kind === "error" ? /* @__PURE__ */ jsx_dev_runtime69.jsxDEV(ErrorMessage, {
|
|
95779
96176
|
line: item
|
|
95780
|
-
}, undefined, false, undefined, this) : item.kind === "status" ? /* @__PURE__ */
|
|
96177
|
+
}, undefined, false, undefined, this) : item.kind === "status" ? /* @__PURE__ */ jsx_dev_runtime69.jsxDEV(StatusMessage, {
|
|
95781
96178
|
line: item
|
|
95782
|
-
}, undefined, false, undefined, this) : item.kind === "event" ? /* @__PURE__ */
|
|
96179
|
+
}, undefined, false, undefined, this) : item.kind === "event" ? /* @__PURE__ */ jsx_dev_runtime69.jsxDEV(EventMessage, {
|
|
95783
96180
|
line: item
|
|
95784
|
-
}, undefined, false, undefined, this) : item.kind === "separator" ? /* @__PURE__ */
|
|
96181
|
+
}, undefined, false, undefined, this) : item.kind === "separator" ? /* @__PURE__ */ jsx_dev_runtime69.jsxDEV(Box_default, {
|
|
95785
96182
|
marginTop: 1,
|
|
95786
|
-
children: /* @__PURE__ */
|
|
96183
|
+
children: /* @__PURE__ */ jsx_dev_runtime69.jsxDEV(Text2, {
|
|
95787
96184
|
dimColor: true,
|
|
95788
96185
|
children: "─".repeat(columns)
|
|
95789
96186
|
}, undefined, false, undefined, this)
|
|
95790
|
-
}, undefined, false, undefined, this) : item.kind === "command" ? /* @__PURE__ */
|
|
96187
|
+
}, undefined, false, undefined, this) : item.kind === "command" ? /* @__PURE__ */ jsx_dev_runtime69.jsxDEV(CommandMessage, {
|
|
96188
|
+
line: item
|
|
96189
|
+
}, undefined, false, undefined, this) : item.kind === "bash_command" ? /* @__PURE__ */ jsx_dev_runtime69.jsxDEV(BashCommandMessage, {
|
|
95791
96190
|
line: item
|
|
95792
|
-
}, undefined, false, undefined, this) : item.kind === "
|
|
96191
|
+
}, undefined, false, undefined, this) : item.kind === "trajectory_summary" ? /* @__PURE__ */ jsx_dev_runtime69.jsxDEV(TrajectorySummary, {
|
|
95793
96192
|
line: item
|
|
95794
|
-
}, undefined, false, undefined, this) : item.kind === "approval_preview" ? /* @__PURE__ */
|
|
96193
|
+
}, undefined, false, undefined, this) : item.kind === "approval_preview" ? /* @__PURE__ */ jsx_dev_runtime69.jsxDEV(ApprovalPreview, {
|
|
95795
96194
|
toolName: item.toolName,
|
|
95796
96195
|
toolArgs: item.toolArgs,
|
|
95797
96196
|
precomputedDiff: item.precomputedDiff,
|
|
@@ -95802,20 +96201,20 @@ Plan file path: ${planFilePath}`;
|
|
|
95802
96201
|
}, undefined, false, undefined, this) : null
|
|
95803
96202
|
}, item.id, false, undefined, this)
|
|
95804
96203
|
}, staticRenderEpoch, false, undefined, this),
|
|
95805
|
-
/* @__PURE__ */
|
|
96204
|
+
/* @__PURE__ */ jsx_dev_runtime69.jsxDEV(Box_default, {
|
|
95806
96205
|
flexDirection: "column",
|
|
95807
96206
|
children: [
|
|
95808
|
-
loadingState !== "ready" && /* @__PURE__ */
|
|
96207
|
+
loadingState !== "ready" && /* @__PURE__ */ jsx_dev_runtime69.jsxDEV(WelcomeScreen, {
|
|
95809
96208
|
loadingState,
|
|
95810
96209
|
continueSession,
|
|
95811
96210
|
agentState
|
|
95812
96211
|
}, undefined, false, undefined, this),
|
|
95813
|
-
loadingState === "ready" && /* @__PURE__ */
|
|
96212
|
+
loadingState === "ready" && /* @__PURE__ */ jsx_dev_runtime69.jsxDEV(jsx_dev_runtime69.Fragment, {
|
|
95814
96213
|
children: [
|
|
95815
|
-
/* @__PURE__ */
|
|
96214
|
+
/* @__PURE__ */ jsx_dev_runtime69.jsxDEV(AnimationProvider, {
|
|
95816
96215
|
shouldAnimate,
|
|
95817
96216
|
children: [
|
|
95818
|
-
liveItems.length > 0 && /* @__PURE__ */
|
|
96217
|
+
liveItems.length > 0 && /* @__PURE__ */ jsx_dev_runtime69.jsxDEV(Box_default, {
|
|
95819
96218
|
flexDirection: "column",
|
|
95820
96219
|
children: liveItems.map((ln) => {
|
|
95821
96220
|
if (ln.kind === "tool_call" && ln.name && isTaskTool(ln.name) && ln.toolCallId && !pendingIds.has(ln.toolCallId) && ln.toolCallId !== currentApproval?.toolCallId) {
|
|
@@ -95825,10 +96224,10 @@ Plan file path: ${planFilePath}`;
|
|
|
95825
96224
|
return null;
|
|
95826
96225
|
}
|
|
95827
96226
|
const matchesCurrentApproval = ln.kind === "tool_call" && currentApproval && ln.toolCallId === currentApproval.toolCallId;
|
|
95828
|
-
return /* @__PURE__ */
|
|
96227
|
+
return /* @__PURE__ */ jsx_dev_runtime69.jsxDEV(Box_default, {
|
|
95829
96228
|
flexDirection: "column",
|
|
95830
96229
|
marginTop: 1,
|
|
95831
|
-
children: matchesCurrentApproval ? /* @__PURE__ */
|
|
96230
|
+
children: matchesCurrentApproval ? /* @__PURE__ */ jsx_dev_runtime69.jsxDEV(ApprovalSwitch, {
|
|
95832
96231
|
approval: currentApproval,
|
|
95833
96232
|
onApprove: handleApproveCurrent,
|
|
95834
96233
|
onApproveAlways: handleApproveAlways,
|
|
@@ -95844,41 +96243,41 @@ Plan file path: ${planFilePath}`;
|
|
|
95844
96243
|
isFocused: true,
|
|
95845
96244
|
approveAlwaysText: currentApprovalContext?.approveAlwaysText,
|
|
95846
96245
|
allowPersistence: currentApprovalContext?.allowPersistence ?? true
|
|
95847
|
-
}, undefined, false, undefined, this) : ln.kind === "user" ? /* @__PURE__ */
|
|
96246
|
+
}, undefined, false, undefined, this) : ln.kind === "user" ? /* @__PURE__ */ jsx_dev_runtime69.jsxDEV(UserMessage, {
|
|
95848
96247
|
line: ln
|
|
95849
|
-
}, undefined, false, undefined, this) : ln.kind === "reasoning" ? /* @__PURE__ */
|
|
96248
|
+
}, undefined, false, undefined, this) : ln.kind === "reasoning" ? /* @__PURE__ */ jsx_dev_runtime69.jsxDEV(ReasoningMessage, {
|
|
95850
96249
|
line: ln
|
|
95851
|
-
}, undefined, false, undefined, this) : ln.kind === "assistant" ? /* @__PURE__ */
|
|
96250
|
+
}, undefined, false, undefined, this) : ln.kind === "assistant" ? /* @__PURE__ */ jsx_dev_runtime69.jsxDEV(AssistantMessage, {
|
|
95852
96251
|
line: ln
|
|
95853
|
-
}, undefined, false, undefined, this) : ln.kind === "tool_call" && ln.toolCallId && queuedIds.has(ln.toolCallId) ? /* @__PURE__ */
|
|
96252
|
+
}, undefined, false, undefined, this) : ln.kind === "tool_call" && ln.toolCallId && queuedIds.has(ln.toolCallId) ? /* @__PURE__ */ jsx_dev_runtime69.jsxDEV(PendingApprovalStub, {
|
|
95854
96253
|
toolName: approvalMap.get(ln.toolCallId)?.toolName || ln.name || "Unknown",
|
|
95855
96254
|
description: stubDescriptions.get(ln.toolCallId),
|
|
95856
96255
|
decision: queuedDecisions.get(ln.toolCallId)
|
|
95857
|
-
}, undefined, false, undefined, this) : ln.kind === "tool_call" && ln.toolCallId && pendingIds.has(ln.toolCallId) ? /* @__PURE__ */
|
|
96256
|
+
}, undefined, false, undefined, this) : ln.kind === "tool_call" && ln.toolCallId && pendingIds.has(ln.toolCallId) ? /* @__PURE__ */ jsx_dev_runtime69.jsxDEV(PendingApprovalStub, {
|
|
95858
96257
|
toolName: approvalMap.get(ln.toolCallId)?.toolName || ln.name || "Unknown",
|
|
95859
96258
|
description: stubDescriptions.get(ln.toolCallId)
|
|
95860
|
-
}, undefined, false, undefined, this) : ln.kind === "tool_call" ? /* @__PURE__ */
|
|
96259
|
+
}, undefined, false, undefined, this) : ln.kind === "tool_call" ? /* @__PURE__ */ jsx_dev_runtime69.jsxDEV(ToolCallMessage, {
|
|
95861
96260
|
line: ln,
|
|
95862
96261
|
precomputedDiffs: precomputedDiffsRef.current,
|
|
95863
96262
|
lastPlanFilePath: lastPlanFilePathRef.current,
|
|
95864
96263
|
isStreaming: streaming
|
|
95865
|
-
}, undefined, false, undefined, this) : ln.kind === "error" ? /* @__PURE__ */
|
|
96264
|
+
}, undefined, false, undefined, this) : ln.kind === "error" ? /* @__PURE__ */ jsx_dev_runtime69.jsxDEV(ErrorMessage, {
|
|
95866
96265
|
line: ln
|
|
95867
|
-
}, undefined, false, undefined, this) : ln.kind === "status" ? /* @__PURE__ */
|
|
96266
|
+
}, undefined, false, undefined, this) : ln.kind === "status" ? /* @__PURE__ */ jsx_dev_runtime69.jsxDEV(StatusMessage, {
|
|
95868
96267
|
line: ln
|
|
95869
|
-
}, undefined, false, undefined, this) : ln.kind === "event" ? /* @__PURE__ */
|
|
96268
|
+
}, undefined, false, undefined, this) : ln.kind === "event" ? /* @__PURE__ */ jsx_dev_runtime69.jsxDEV(EventMessage, {
|
|
95870
96269
|
line: ln
|
|
95871
|
-
}, undefined, false, undefined, this) : ln.kind === "command" ? /* @__PURE__ */
|
|
96270
|
+
}, undefined, false, undefined, this) : ln.kind === "command" ? /* @__PURE__ */ jsx_dev_runtime69.jsxDEV(CommandMessage, {
|
|
95872
96271
|
line: ln
|
|
95873
|
-
}, undefined, false, undefined, this) : ln.kind === "bash_command" ? /* @__PURE__ */
|
|
96272
|
+
}, undefined, false, undefined, this) : ln.kind === "bash_command" ? /* @__PURE__ */ jsx_dev_runtime69.jsxDEV(BashCommandMessage, {
|
|
95874
96273
|
line: ln
|
|
95875
96274
|
}, undefined, false, undefined, this) : null
|
|
95876
96275
|
}, ln.id, false, undefined, this);
|
|
95877
96276
|
})
|
|
95878
96277
|
}, undefined, false, undefined, this),
|
|
95879
|
-
liveItems.length === 0 && currentApproval && /* @__PURE__ */
|
|
96278
|
+
liveItems.length === 0 && currentApproval && /* @__PURE__ */ jsx_dev_runtime69.jsxDEV(Box_default, {
|
|
95880
96279
|
flexDirection: "column",
|
|
95881
|
-
children: /* @__PURE__ */
|
|
96280
|
+
children: /* @__PURE__ */ jsx_dev_runtime69.jsxDEV(ApprovalSwitch, {
|
|
95882
96281
|
approval: currentApproval,
|
|
95883
96282
|
onApprove: handleApproveCurrent,
|
|
95884
96283
|
onApproveAlways: handleApproveAlways,
|
|
@@ -95895,22 +96294,22 @@ Plan file path: ${planFilePath}`;
|
|
|
95895
96294
|
allowPersistence: currentApprovalContext?.allowPersistence ?? true
|
|
95896
96295
|
}, undefined, false, undefined, this)
|
|
95897
96296
|
}, undefined, false, undefined, this),
|
|
95898
|
-
/* @__PURE__ */
|
|
96297
|
+
/* @__PURE__ */ jsx_dev_runtime69.jsxDEV(SubagentGroupDisplay, {}, undefined, false, undefined, this)
|
|
95899
96298
|
]
|
|
95900
96299
|
}, undefined, true, undefined, this),
|
|
95901
96300
|
showExitStats && (() => {
|
|
95902
96301
|
const stats = sessionStatsRef.current.getSnapshot();
|
|
95903
|
-
return /* @__PURE__ */
|
|
96302
|
+
return /* @__PURE__ */ jsx_dev_runtime69.jsxDEV(Box_default, {
|
|
95904
96303
|
flexDirection: "column",
|
|
95905
96304
|
marginTop: 1,
|
|
95906
96305
|
children: [
|
|
95907
|
-
/* @__PURE__ */
|
|
96306
|
+
/* @__PURE__ */ jsx_dev_runtime69.jsxDEV(Box_default, {
|
|
95908
96307
|
children: [
|
|
95909
|
-
/* @__PURE__ */
|
|
96308
|
+
/* @__PURE__ */ jsx_dev_runtime69.jsxDEV(Text2, {
|
|
95910
96309
|
color: colors.footer.agentName,
|
|
95911
96310
|
children: " ▗▖▗▖ "
|
|
95912
96311
|
}, undefined, false, undefined, this),
|
|
95913
|
-
/* @__PURE__ */
|
|
96312
|
+
/* @__PURE__ */ jsx_dev_runtime69.jsxDEV(Text2, {
|
|
95914
96313
|
dimColor: true,
|
|
95915
96314
|
children: [
|
|
95916
96315
|
"Total duration (API): ",
|
|
@@ -95919,13 +96318,13 @@ Plan file path: ${planFilePath}`;
|
|
|
95919
96318
|
}, undefined, true, undefined, this)
|
|
95920
96319
|
]
|
|
95921
96320
|
}, undefined, true, undefined, this),
|
|
95922
|
-
/* @__PURE__ */
|
|
96321
|
+
/* @__PURE__ */ jsx_dev_runtime69.jsxDEV(Box_default, {
|
|
95923
96322
|
children: [
|
|
95924
|
-
/* @__PURE__ */
|
|
96323
|
+
/* @__PURE__ */ jsx_dev_runtime69.jsxDEV(Text2, {
|
|
95925
96324
|
color: colors.footer.agentName,
|
|
95926
96325
|
children: "▙█▜▛█▟ "
|
|
95927
96326
|
}, undefined, false, undefined, this),
|
|
95928
|
-
/* @__PURE__ */
|
|
96327
|
+
/* @__PURE__ */ jsx_dev_runtime69.jsxDEV(Text2, {
|
|
95929
96328
|
dimColor: true,
|
|
95930
96329
|
children: [
|
|
95931
96330
|
"Total duration (wall):",
|
|
@@ -95935,13 +96334,13 @@ Plan file path: ${planFilePath}`;
|
|
|
95935
96334
|
}, undefined, true, undefined, this)
|
|
95936
96335
|
]
|
|
95937
96336
|
}, undefined, true, undefined, this),
|
|
95938
|
-
/* @__PURE__ */
|
|
96337
|
+
/* @__PURE__ */ jsx_dev_runtime69.jsxDEV(Box_default, {
|
|
95939
96338
|
children: [
|
|
95940
|
-
/* @__PURE__ */
|
|
96339
|
+
/* @__PURE__ */ jsx_dev_runtime69.jsxDEV(Text2, {
|
|
95941
96340
|
color: colors.footer.agentName,
|
|
95942
96341
|
children: "▝▜▛▜▛▘ "
|
|
95943
96342
|
}, undefined, false, undefined, this),
|
|
95944
|
-
/* @__PURE__ */
|
|
96343
|
+
/* @__PURE__ */ jsx_dev_runtime69.jsxDEV(Text2, {
|
|
95945
96344
|
dimColor: true,
|
|
95946
96345
|
children: [
|
|
95947
96346
|
"Session usage: ",
|
|
@@ -95957,27 +96356,27 @@ Plan file path: ${planFilePath}`;
|
|
|
95957
96356
|
}, undefined, true, undefined, this)
|
|
95958
96357
|
]
|
|
95959
96358
|
}, undefined, true, undefined, this),
|
|
95960
|
-
/* @__PURE__ */
|
|
96359
|
+
/* @__PURE__ */ jsx_dev_runtime69.jsxDEV(Box_default, {
|
|
95961
96360
|
height: 1
|
|
95962
96361
|
}, undefined, false, undefined, this),
|
|
95963
|
-
/* @__PURE__ */
|
|
96362
|
+
/* @__PURE__ */ jsx_dev_runtime69.jsxDEV(Text2, {
|
|
95964
96363
|
dimColor: true,
|
|
95965
96364
|
children: "Resume this agent with:"
|
|
95966
96365
|
}, undefined, false, undefined, this),
|
|
95967
|
-
/* @__PURE__ */
|
|
96366
|
+
/* @__PURE__ */ jsx_dev_runtime69.jsxDEV(Text2, {
|
|
95968
96367
|
color: colors.link.url,
|
|
95969
96368
|
children: agentName && (settingsManager.getLocalPinnedAgents().includes(agentId) || settingsManager.getGlobalPinnedAgents().includes(agentId)) ? `letta -n "${agentName}"` : `letta --agent ${agentId}`
|
|
95970
96369
|
}, undefined, false, undefined, this),
|
|
95971
|
-
conversationId !== "default" && /* @__PURE__ */
|
|
96370
|
+
conversationId !== "default" && /* @__PURE__ */ jsx_dev_runtime69.jsxDEV(jsx_dev_runtime69.Fragment, {
|
|
95972
96371
|
children: [
|
|
95973
|
-
/* @__PURE__ */
|
|
96372
|
+
/* @__PURE__ */ jsx_dev_runtime69.jsxDEV(Box_default, {
|
|
95974
96373
|
height: 1
|
|
95975
96374
|
}, undefined, false, undefined, this),
|
|
95976
|
-
/* @__PURE__ */
|
|
96375
|
+
/* @__PURE__ */ jsx_dev_runtime69.jsxDEV(Text2, {
|
|
95977
96376
|
dimColor: true,
|
|
95978
96377
|
children: "Resume this conversation with:"
|
|
95979
96378
|
}, undefined, false, undefined, this),
|
|
95980
|
-
/* @__PURE__ */
|
|
96379
|
+
/* @__PURE__ */ jsx_dev_runtime69.jsxDEV(Text2, {
|
|
95981
96380
|
color: colors.link.url,
|
|
95982
96381
|
children: `letta --conv ${conversationId}`
|
|
95983
96382
|
}, undefined, false, undefined, this)
|
|
@@ -95986,17 +96385,20 @@ Plan file path: ${planFilePath}`;
|
|
|
95986
96385
|
]
|
|
95987
96386
|
}, undefined, true, undefined, this);
|
|
95988
96387
|
})(),
|
|
95989
|
-
/* @__PURE__ */
|
|
96388
|
+
/* @__PURE__ */ jsx_dev_runtime69.jsxDEV(Box_default, {
|
|
95990
96389
|
marginTop: 1,
|
|
95991
|
-
children: /* @__PURE__ */
|
|
95992
|
-
visible:
|
|
95993
|
-
streaming
|
|
95994
|
-
tokenCount,
|
|
96390
|
+
children: /* @__PURE__ */ jsx_dev_runtime69.jsxDEV(Input, {
|
|
96391
|
+
visible: inputVisible,
|
|
96392
|
+
streaming,
|
|
96393
|
+
tokenCount: trajectoryTokenDisplay,
|
|
96394
|
+
elapsedBaseMs: liveTrajectoryElapsedBaseMs,
|
|
95995
96395
|
thinkingMessage,
|
|
95996
96396
|
onSubmit,
|
|
95997
96397
|
onBashSubmit: handleBashSubmit,
|
|
95998
96398
|
bashRunning,
|
|
95999
96399
|
onBashInterrupt: handleBashInterrupt,
|
|
96400
|
+
inputEnabled,
|
|
96401
|
+
collapseInputWhenDisabled: pendingApprovals.length > 0 || anySelectorOpen,
|
|
96000
96402
|
permissionMode: uiPermissionMode,
|
|
96001
96403
|
onPermissionModeChange: handlePermissionModeChange,
|
|
96002
96404
|
onExit: handleExit,
|
|
@@ -96020,7 +96422,7 @@ Plan file path: ${planFilePath}`;
|
|
|
96020
96422
|
networkPhase
|
|
96021
96423
|
}, undefined, false, undefined, this)
|
|
96022
96424
|
}, undefined, false, undefined, this),
|
|
96023
|
-
activeOverlay === "model" && /* @__PURE__ */
|
|
96425
|
+
activeOverlay === "model" && /* @__PURE__ */ jsx_dev_runtime69.jsxDEV(ModelSelector, {
|
|
96024
96426
|
currentModelId: currentModelId ?? undefined,
|
|
96025
96427
|
onSelect: handleModelSelect,
|
|
96026
96428
|
onCancel: closeOverlay,
|
|
@@ -96033,7 +96435,7 @@ Plan file path: ${planFilePath}`;
|
|
|
96033
96435
|
return !baseURL.includes("api.letta.com");
|
|
96034
96436
|
})()
|
|
96035
96437
|
}, undefined, false, undefined, this),
|
|
96036
|
-
activeOverlay === "connect" && /* @__PURE__ */
|
|
96438
|
+
activeOverlay === "connect" && /* @__PURE__ */ jsx_dev_runtime69.jsxDEV(ProviderSelector, {
|
|
96037
96439
|
onCancel: closeOverlay,
|
|
96038
96440
|
onStartOAuth: async () => {
|
|
96039
96441
|
closeOverlay();
|
|
@@ -96052,20 +96454,20 @@ Plan file path: ${planFilePath}`;
|
|
|
96052
96454
|
}, "/connect codex");
|
|
96053
96455
|
}
|
|
96054
96456
|
}, undefined, false, undefined, this),
|
|
96055
|
-
activeOverlay === "toolset" && /* @__PURE__ */
|
|
96457
|
+
activeOverlay === "toolset" && /* @__PURE__ */ jsx_dev_runtime69.jsxDEV(ToolsetSelector, {
|
|
96056
96458
|
currentToolset: currentToolset ?? undefined,
|
|
96057
96459
|
onSelect: handleToolsetSelect,
|
|
96058
96460
|
onCancel: closeOverlay
|
|
96059
96461
|
}, undefined, false, undefined, this),
|
|
96060
|
-
activeOverlay === "system" && /* @__PURE__ */
|
|
96462
|
+
activeOverlay === "system" && /* @__PURE__ */ jsx_dev_runtime69.jsxDEV(SystemPromptSelector, {
|
|
96061
96463
|
currentPromptId: currentSystemPromptId ?? undefined,
|
|
96062
96464
|
onSelect: handleSystemPromptSelect,
|
|
96063
96465
|
onCancel: closeOverlay
|
|
96064
96466
|
}, undefined, false, undefined, this),
|
|
96065
|
-
activeOverlay === "subagent" && /* @__PURE__ */
|
|
96467
|
+
activeOverlay === "subagent" && /* @__PURE__ */ jsx_dev_runtime69.jsxDEV(SubagentManager, {
|
|
96066
96468
|
onClose: closeOverlay
|
|
96067
96469
|
}, undefined, false, undefined, this),
|
|
96068
|
-
activeOverlay === "resume" && /* @__PURE__ */
|
|
96470
|
+
activeOverlay === "resume" && /* @__PURE__ */ jsx_dev_runtime69.jsxDEV(AgentSelector, {
|
|
96069
96471
|
currentAgentId: agentId,
|
|
96070
96472
|
onSelect: async (id) => {
|
|
96071
96473
|
closeOverlay();
|
|
@@ -96077,7 +96479,7 @@ Plan file path: ${planFilePath}`;
|
|
|
96077
96479
|
setActiveOverlay("new");
|
|
96078
96480
|
}
|
|
96079
96481
|
}, undefined, false, undefined, this),
|
|
96080
|
-
activeOverlay === "conversations" && /* @__PURE__ */
|
|
96482
|
+
activeOverlay === "conversations" && /* @__PURE__ */ jsx_dev_runtime69.jsxDEV(ConversationSelector2, {
|
|
96081
96483
|
agentId,
|
|
96082
96484
|
agentName: agentName ?? undefined,
|
|
96083
96485
|
currentConversationId: conversationId,
|
|
@@ -96143,6 +96545,7 @@ Plan file path: ${planFilePath}`;
|
|
|
96143
96545
|
emittedIdsRef.current.clear();
|
|
96144
96546
|
setStaticItems([]);
|
|
96145
96547
|
setStaticRenderEpoch((e) => e + 1);
|
|
96548
|
+
resetTrajectoryBases();
|
|
96146
96549
|
const currentAgentName = agentState.name || "Unnamed Agent";
|
|
96147
96550
|
const successLines = resumeData.messageHistory.length > 0 ? [
|
|
96148
96551
|
`Resumed conversation with "${currentAgentName}"`,
|
|
@@ -96264,6 +96667,7 @@ Plan file path: ${planFilePath}`;
|
|
|
96264
96667
|
emittedIdsRef.current.clear();
|
|
96265
96668
|
setStaticItems([]);
|
|
96266
96669
|
setStaticRenderEpoch((e) => e + 1);
|
|
96670
|
+
resetTrajectoryBases();
|
|
96267
96671
|
const currentAgentName = agentState?.name || "Unnamed Agent";
|
|
96268
96672
|
const shortConvId = conversation.id.slice(0, 20);
|
|
96269
96673
|
const successLines = [
|
|
@@ -96300,7 +96704,7 @@ Plan file path: ${planFilePath}`;
|
|
|
96300
96704
|
},
|
|
96301
96705
|
onCancel: closeOverlay
|
|
96302
96706
|
}, undefined, false, undefined, this),
|
|
96303
|
-
activeOverlay === "search" && /* @__PURE__ */
|
|
96707
|
+
activeOverlay === "search" && /* @__PURE__ */ jsx_dev_runtime69.jsxDEV(MessageSearch, {
|
|
96304
96708
|
onClose: closeOverlay,
|
|
96305
96709
|
initialQuery: searchQuery || undefined,
|
|
96306
96710
|
agentId,
|
|
@@ -96362,6 +96766,7 @@ Plan file path: ${planFilePath}`;
|
|
|
96362
96766
|
emittedIdsRef.current.clear();
|
|
96363
96767
|
setStaticItems([]);
|
|
96364
96768
|
setStaticRenderEpoch((e) => e + 1);
|
|
96769
|
+
resetTrajectoryBases();
|
|
96365
96770
|
const currentAgentName = agentState.name || "Unnamed Agent";
|
|
96366
96771
|
const successOutput = [
|
|
96367
96772
|
`Switched to conversation with "${currentAgentName}"`,
|
|
@@ -96444,22 +96849,22 @@ Plan file path: ${planFilePath}`;
|
|
|
96444
96849
|
}
|
|
96445
96850
|
}
|
|
96446
96851
|
}, undefined, false, undefined, this),
|
|
96447
|
-
activeOverlay === "feedback" && /* @__PURE__ */
|
|
96852
|
+
activeOverlay === "feedback" && /* @__PURE__ */ jsx_dev_runtime69.jsxDEV(FeedbackDialog, {
|
|
96448
96853
|
onSubmit: handleFeedbackSubmit,
|
|
96449
96854
|
onCancel: closeOverlay,
|
|
96450
96855
|
initialValue: feedbackPrefill
|
|
96451
96856
|
}, undefined, false, undefined, this),
|
|
96452
|
-
activeOverlay === "memory" && (settingsManager.isMemfsEnabled(agentId) ? /* @__PURE__ */
|
|
96857
|
+
activeOverlay === "memory" && (settingsManager.isMemfsEnabled(agentId) ? /* @__PURE__ */ jsx_dev_runtime69.jsxDEV(MemfsTreeViewer, {
|
|
96453
96858
|
agentId,
|
|
96454
96859
|
onClose: closeOverlay,
|
|
96455
96860
|
conversationId
|
|
96456
|
-
}, undefined, false, undefined, this) : /* @__PURE__ */
|
|
96861
|
+
}, undefined, false, undefined, this) : /* @__PURE__ */ jsx_dev_runtime69.jsxDEV(MemoryTabViewer, {
|
|
96457
96862
|
blocks: agentState?.memory?.blocks || [],
|
|
96458
96863
|
agentId,
|
|
96459
96864
|
onClose: closeOverlay,
|
|
96460
96865
|
conversationId
|
|
96461
96866
|
}, undefined, false, undefined, this)),
|
|
96462
|
-
activeOverlay === "memfs-sync" && memorySyncConflicts && /* @__PURE__ */
|
|
96867
|
+
activeOverlay === "memfs-sync" && memorySyncConflicts && /* @__PURE__ */ jsx_dev_runtime69.jsxDEV(InlineQuestionApproval, {
|
|
96463
96868
|
questions: memorySyncConflicts.map((conflict) => ({
|
|
96464
96869
|
header: "Memory sync",
|
|
96465
96870
|
question: `Conflict for ${conflict.label}`,
|
|
@@ -96479,14 +96884,14 @@ Plan file path: ${planFilePath}`;
|
|
|
96479
96884
|
onSubmit: handleMemorySyncConflictSubmit,
|
|
96480
96885
|
onCancel: handleMemorySyncConflictCancel
|
|
96481
96886
|
}, undefined, false, undefined, this),
|
|
96482
|
-
activeOverlay === "mcp" && /* @__PURE__ */
|
|
96887
|
+
activeOverlay === "mcp" && /* @__PURE__ */ jsx_dev_runtime69.jsxDEV(McpSelector, {
|
|
96483
96888
|
agentId,
|
|
96484
96889
|
onAdd: () => {
|
|
96485
96890
|
setActiveOverlay("mcp-connect");
|
|
96486
96891
|
},
|
|
96487
96892
|
onCancel: closeOverlay
|
|
96488
96893
|
}, undefined, false, undefined, this),
|
|
96489
|
-
activeOverlay === "mcp-connect" && /* @__PURE__ */
|
|
96894
|
+
activeOverlay === "mcp-connect" && /* @__PURE__ */ jsx_dev_runtime69.jsxDEV(McpConnectFlow, {
|
|
96490
96895
|
onComplete: (serverName, serverId, toolCount) => {
|
|
96491
96896
|
closeOverlay();
|
|
96492
96897
|
const cmdId = uid4("cmd");
|
|
@@ -96506,18 +96911,18 @@ Open /mcp to attach or detach tools for this server.`,
|
|
|
96506
96911
|
},
|
|
96507
96912
|
onCancel: closeOverlay
|
|
96508
96913
|
}, undefined, false, undefined, this),
|
|
96509
|
-
activeOverlay === "help" && /* @__PURE__ */
|
|
96914
|
+
activeOverlay === "help" && /* @__PURE__ */ jsx_dev_runtime69.jsxDEV(HelpDialog, {
|
|
96510
96915
|
onClose: closeOverlay
|
|
96511
96916
|
}, undefined, false, undefined, this),
|
|
96512
|
-
activeOverlay === "hooks" && /* @__PURE__ */
|
|
96917
|
+
activeOverlay === "hooks" && /* @__PURE__ */ jsx_dev_runtime69.jsxDEV(HooksManager, {
|
|
96513
96918
|
onClose: closeOverlay,
|
|
96514
96919
|
agentId
|
|
96515
96920
|
}, undefined, false, undefined, this),
|
|
96516
|
-
activeOverlay === "new" && /* @__PURE__ */
|
|
96921
|
+
activeOverlay === "new" && /* @__PURE__ */ jsx_dev_runtime69.jsxDEV(NewAgentDialog, {
|
|
96517
96922
|
onSubmit: handleCreateNewAgent,
|
|
96518
96923
|
onCancel: closeOverlay
|
|
96519
96924
|
}, undefined, false, undefined, this),
|
|
96520
|
-
activeOverlay === "pin" && /* @__PURE__ */
|
|
96925
|
+
activeOverlay === "pin" && /* @__PURE__ */ jsx_dev_runtime69.jsxDEV(PinDialog, {
|
|
96521
96926
|
currentName: agentName || "",
|
|
96522
96927
|
local: pinDialogLocal,
|
|
96523
96928
|
onSubmit: async (newName) => {
|
|
@@ -96577,7 +96982,7 @@ Open /mcp to attach or detach tools for this server.`,
|
|
|
96577
96982
|
]
|
|
96578
96983
|
}, resumeKey, true, undefined, this);
|
|
96579
96984
|
}
|
|
96580
|
-
var
|
|
96985
|
+
var import_react91, jsx_dev_runtime69, CLEAR_SCREEN_AND_HOME = "\x1B[2J\x1B[H", MIN_RESIZE_DELTA = 2, EAGER_CANCEL = true, LLM_API_ERROR_MAX_RETRIES2 = 3, CONVERSATION_BUSY_MAX_RETRIES2 = 1, CONVERSATION_BUSY_RETRY_DELAY_MS2 = 2500, INTERRUPT_MESSAGE = "Interrupted – tell the agent what to do differently. Something went wrong? Use /feedback to report issues.", ERROR_FEEDBACK_HINT = "Something went wrong? Use /feedback to report issues.", OPUS_BEDROCK_FALLBACK_HINT = "Downstream provider issues? Use /model to switch to Bedrock Opus 4.5", PROVIDER_FALLBACK_HINT = "Downstream provider issues? Use /model to switch to another provider", INTERACTIVE_SLASH_COMMANDS, NON_STATE_COMMANDS;
|
|
96581
96986
|
var init_App2 = __esm(async () => {
|
|
96582
96987
|
init_error();
|
|
96583
96988
|
init_check_approval();
|
|
@@ -96653,6 +97058,7 @@ var init_App2 = __esm(async () => {
|
|
|
96653
97058
|
init_Text2(),
|
|
96654
97059
|
init_ToolCallMessageRich(),
|
|
96655
97060
|
init_ToolsetSelector(),
|
|
97061
|
+
init_TrajectorySummary(),
|
|
96656
97062
|
init_UserMessageRich(),
|
|
96657
97063
|
init_WelcomeScreen(),
|
|
96658
97064
|
init_accumulator(),
|
|
@@ -96661,8 +97067,8 @@ var init_App2 = __esm(async () => {
|
|
|
96661
97067
|
init_stream(),
|
|
96662
97068
|
init_useSuspend()
|
|
96663
97069
|
]);
|
|
96664
|
-
|
|
96665
|
-
|
|
97070
|
+
import_react91 = __toESM(require_react(), 1);
|
|
97071
|
+
jsx_dev_runtime69 = __toESM(require_jsx_dev_runtime(), 1);
|
|
96666
97072
|
INTERACTIVE_SLASH_COMMANDS = new Set([
|
|
96667
97073
|
"/model",
|
|
96668
97074
|
"/toolset",
|
|
@@ -103009,4 +103415,4 @@ Error during initialization: ${message}`);
|
|
|
103009
103415
|
}
|
|
103010
103416
|
main();
|
|
103011
103417
|
|
|
103012
|
-
//# debugId=
|
|
103418
|
+
//# debugId=ECD33F3765BB3B7864756E2164756E21
|