@letta-ai/letta-code 0.12.4 → 0.12.5
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 +544 -431
- package/package.json +1 -1
package/letta.js
CHANGED
|
@@ -3237,7 +3237,7 @@ var package_default;
|
|
|
3237
3237
|
var init_package = __esm(() => {
|
|
3238
3238
|
package_default = {
|
|
3239
3239
|
name: "@letta-ai/letta-code",
|
|
3240
|
-
version: "0.12.
|
|
3240
|
+
version: "0.12.5",
|
|
3241
3241
|
description: "Letta Code is a CLI tool for interacting with stateful Letta agents from the terminal.",
|
|
3242
3242
|
type: "module",
|
|
3243
3243
|
bin: {
|
|
@@ -4495,6 +4495,50 @@ var init_anthropic_provider = __esm(async () => {
|
|
|
4495
4495
|
await init_settings_manager();
|
|
4496
4496
|
});
|
|
4497
4497
|
|
|
4498
|
+
// src/utils/timing.ts
|
|
4499
|
+
function isTimingsEnabled() {
|
|
4500
|
+
const val = process.env.LETTA_DEBUG_TIMINGS;
|
|
4501
|
+
return val === "1" || val === "true";
|
|
4502
|
+
}
|
|
4503
|
+
function formatDuration(ms) {
|
|
4504
|
+
if (ms < 1000)
|
|
4505
|
+
return `${Math.round(ms)}ms`;
|
|
4506
|
+
return `${(ms / 1000).toFixed(2)}s`;
|
|
4507
|
+
}
|
|
4508
|
+
function formatTimestamp(date) {
|
|
4509
|
+
return date.toISOString().slice(11, 23);
|
|
4510
|
+
}
|
|
4511
|
+
function logTiming(message) {
|
|
4512
|
+
if (isTimingsEnabled()) {
|
|
4513
|
+
console.error(`[timing] ${message}`);
|
|
4514
|
+
}
|
|
4515
|
+
}
|
|
4516
|
+
function createTimingFetch(baseFetch) {
|
|
4517
|
+
return async (input, init) => {
|
|
4518
|
+
const start = performance.now();
|
|
4519
|
+
const startTime = formatTimestamp(new Date);
|
|
4520
|
+
const url = typeof input === "string" ? input : input instanceof URL ? input.href : input.url;
|
|
4521
|
+
const method = init?.method || "GET";
|
|
4522
|
+
let path2;
|
|
4523
|
+
try {
|
|
4524
|
+
path2 = new URL(url).pathname;
|
|
4525
|
+
} catch {
|
|
4526
|
+
path2 = url;
|
|
4527
|
+
}
|
|
4528
|
+
logTiming(`${method} ${path2} started at ${startTime}`);
|
|
4529
|
+
try {
|
|
4530
|
+
const response = await baseFetch(input, init);
|
|
4531
|
+
const duration = performance.now() - start;
|
|
4532
|
+
logTiming(`${method} ${path2} -> ${formatDuration(duration)} (status: ${response.status})`);
|
|
4533
|
+
return response;
|
|
4534
|
+
} catch (error) {
|
|
4535
|
+
const duration = performance.now() - start;
|
|
4536
|
+
logTiming(`${method} ${path2} -> FAILED after ${formatDuration(duration)}`);
|
|
4537
|
+
throw error;
|
|
4538
|
+
}
|
|
4539
|
+
};
|
|
4540
|
+
}
|
|
4541
|
+
|
|
4498
4542
|
// src/agent/client.ts
|
|
4499
4543
|
var exports_client = {};
|
|
4500
4544
|
__export(exports_client, {
|
|
@@ -4543,7 +4587,8 @@ async function getClient2() {
|
|
|
4543
4587
|
defaultHeaders: {
|
|
4544
4588
|
"X-Letta-Source": "letta-code",
|
|
4545
4589
|
"User-Agent": `letta-code/${package_default.version}`
|
|
4546
|
-
}
|
|
4590
|
+
},
|
|
4591
|
+
...isTimingsEnabled() && { fetch: createTimingFetch(fetch) }
|
|
4547
4592
|
});
|
|
4548
4593
|
}
|
|
4549
4594
|
var init_client2 = __esm(async () => {
|
|
@@ -34376,6 +34421,12 @@ class PermissionModeManager2 {
|
|
|
34376
34421
|
return "allow";
|
|
34377
34422
|
}
|
|
34378
34423
|
}
|
|
34424
|
+
if (toolName === "Skill" || toolName === "skill") {
|
|
34425
|
+
const command = toolArgs?.command;
|
|
34426
|
+
if (command && ["load", "unload", "refresh"].includes(command)) {
|
|
34427
|
+
return "allow";
|
|
34428
|
+
}
|
|
34429
|
+
}
|
|
34379
34430
|
const shellTools = [
|
|
34380
34431
|
"Bash",
|
|
34381
34432
|
"shell",
|
|
@@ -50620,20 +50671,27 @@ var init_create = __esm(async () => {
|
|
|
50620
50671
|
|
|
50621
50672
|
// src/agent/message.ts
|
|
50622
50673
|
async function sendMessageStream(agentId, messages, opts = { streamTokens: true, background: true }, requestOptions = { maxRetries: 0 }) {
|
|
50674
|
+
const requestStartTime = isTimingsEnabled() ? performance.now() : undefined;
|
|
50623
50675
|
const client = await getClient2();
|
|
50624
|
-
|
|
50676
|
+
const stream2 = await client.agents.messages.create(agentId, {
|
|
50625
50677
|
messages,
|
|
50626
50678
|
streaming: true,
|
|
50627
50679
|
stream_tokens: opts.streamTokens ?? true,
|
|
50628
50680
|
background: opts.background ?? true,
|
|
50629
50681
|
client_tools: getClientToolsFromRegistry()
|
|
50630
50682
|
}, requestOptions);
|
|
50683
|
+
if (requestStartTime !== undefined) {
|
|
50684
|
+
stream2[STREAM_REQUEST_START_TIME] = requestStartTime;
|
|
50685
|
+
}
|
|
50686
|
+
return stream2;
|
|
50631
50687
|
}
|
|
50688
|
+
var STREAM_REQUEST_START_TIME;
|
|
50632
50689
|
var init_message = __esm(async () => {
|
|
50633
50690
|
await __promiseAll([
|
|
50634
50691
|
init_manager4(),
|
|
50635
50692
|
init_client2()
|
|
50636
50693
|
]);
|
|
50694
|
+
STREAM_REQUEST_START_TIME = Symbol("streamRequestStartTime");
|
|
50637
50695
|
});
|
|
50638
50696
|
|
|
50639
50697
|
// src/agent/stats.ts
|
|
@@ -51058,6 +51116,8 @@ function safeJsonParseOr(json, defaultValue) {
|
|
|
51058
51116
|
// src/cli/helpers/stream.ts
|
|
51059
51117
|
async function drainStream(stream2, buffers, refresh, abortSignal, onFirstMessage) {
|
|
51060
51118
|
const startTime = performance.now();
|
|
51119
|
+
const requestStartTime = stream2[STREAM_REQUEST_START_TIME];
|
|
51120
|
+
let hasLoggedTTFT = false;
|
|
51061
51121
|
let _approvalRequestId = null;
|
|
51062
51122
|
const pendingApprovals = new Map;
|
|
51063
51123
|
let stopReason = null;
|
|
@@ -51110,6 +51170,11 @@ async function drainStream(stream2, buffers, refresh, abortSignal, onFirstMessag
|
|
|
51110
51170
|
hasCalledFirstMessage = true;
|
|
51111
51171
|
queueMicrotask(() => onFirstMessage());
|
|
51112
51172
|
}
|
|
51173
|
+
if (!hasLoggedTTFT && requestStartTime !== undefined && (chunk.message_type === "reasoning_message" || chunk.message_type === "assistant_message")) {
|
|
51174
|
+
hasLoggedTTFT = true;
|
|
51175
|
+
const ttft = performance.now() - requestStartTime;
|
|
51176
|
+
logTiming(`TTFT: ${formatDuration(ttft)} (from POST to first content)`);
|
|
51177
|
+
}
|
|
51113
51178
|
if (chunk.message_type === "tool_return_message") {
|
|
51114
51179
|
if (chunk.tool_call_id) {
|
|
51115
51180
|
pendingApprovals.delete(chunk.tool_call_id);
|
|
@@ -51241,7 +51306,10 @@ async function drainStreamWithResume(stream2, buffers, refresh, abortSignal, onF
|
|
|
51241
51306
|
var init_stream = __esm(async () => {
|
|
51242
51307
|
init_error();
|
|
51243
51308
|
init_accumulator();
|
|
51244
|
-
await
|
|
51309
|
+
await __promiseAll([
|
|
51310
|
+
init_client2(),
|
|
51311
|
+
init_message()
|
|
51312
|
+
]);
|
|
51245
51313
|
});
|
|
51246
51314
|
|
|
51247
51315
|
// src/tools/toolset.ts
|
|
@@ -59085,10 +59153,26 @@ var init_HelpDialog = __esm(async () => {
|
|
|
59085
59153
|
HELP_TABS = ["commands", "shortcuts"];
|
|
59086
59154
|
});
|
|
59087
59155
|
|
|
59156
|
+
// src/cli/hooks/useProgressIndicator.ts
|
|
59157
|
+
function useProgressIndicator(active = true) {
|
|
59158
|
+
import_react41.useEffect(() => {
|
|
59159
|
+
if (!active)
|
|
59160
|
+
return;
|
|
59161
|
+
process.stdout.write(PROGRESS_INDETERMINATE);
|
|
59162
|
+
return () => {
|
|
59163
|
+
process.stdout.write(PROGRESS_CLEAR);
|
|
59164
|
+
};
|
|
59165
|
+
}, [active]);
|
|
59166
|
+
}
|
|
59167
|
+
var import_react41, PROGRESS_INDETERMINATE = "\x1B]9;4;3;0\x07", PROGRESS_CLEAR = "\x1B]9;4;0;0\x07";
|
|
59168
|
+
var init_useProgressIndicator = __esm(() => {
|
|
59169
|
+
import_react41 = __toESM(require_react(), 1);
|
|
59170
|
+
});
|
|
59171
|
+
|
|
59088
59172
|
// src/cli/hooks/useTextInputCursor.ts
|
|
59089
59173
|
function useTextInputCursor(initialText = "") {
|
|
59090
|
-
const [text, setText] =
|
|
59091
|
-
const [cursorPos, setCursorPos] =
|
|
59174
|
+
const [text, setText] = import_react42.useState(initialText);
|
|
59175
|
+
const [cursorPos, setCursorPos] = import_react42.useState(0);
|
|
59092
59176
|
const handleKey = (input, key) => {
|
|
59093
59177
|
if (key.leftArrow) {
|
|
59094
59178
|
setCursorPos((prev) => Math.max(0, prev - 1));
|
|
@@ -59125,21 +59209,22 @@ function useTextInputCursor(initialText = "") {
|
|
|
59125
59209
|
clear
|
|
59126
59210
|
};
|
|
59127
59211
|
}
|
|
59128
|
-
var
|
|
59212
|
+
var import_react42;
|
|
59129
59213
|
var init_useTextInputCursor = __esm(() => {
|
|
59130
|
-
|
|
59214
|
+
import_react42 = __toESM(require_react(), 1);
|
|
59131
59215
|
});
|
|
59132
59216
|
|
|
59133
59217
|
// src/cli/components/InlineBashApproval.tsx
|
|
59134
|
-
var
|
|
59218
|
+
var import_react43, jsx_dev_runtime20, SOLID_LINE4 = "─", InlineBashApproval;
|
|
59135
59219
|
var init_InlineBashApproval = __esm(async () => {
|
|
59220
|
+
init_useProgressIndicator();
|
|
59136
59221
|
init_useTerminalWidth();
|
|
59137
59222
|
init_useTextInputCursor();
|
|
59138
59223
|
init_colors();
|
|
59139
59224
|
await init_build2();
|
|
59140
|
-
|
|
59225
|
+
import_react43 = __toESM(require_react(), 1);
|
|
59141
59226
|
jsx_dev_runtime20 = __toESM(require_jsx_dev_runtime(), 1);
|
|
59142
|
-
InlineBashApproval =
|
|
59227
|
+
InlineBashApproval = import_react43.memo(({
|
|
59143
59228
|
bashInfo,
|
|
59144
59229
|
onApprove,
|
|
59145
59230
|
onApproveAlways,
|
|
@@ -59149,7 +59234,7 @@ var init_InlineBashApproval = __esm(async () => {
|
|
|
59149
59234
|
approveAlwaysText,
|
|
59150
59235
|
allowPersistence = true
|
|
59151
59236
|
}) => {
|
|
59152
|
-
const [selectedOption, setSelectedOption] =
|
|
59237
|
+
const [selectedOption, setSelectedOption] = import_react43.useState(0);
|
|
59153
59238
|
const {
|
|
59154
59239
|
text: customReason,
|
|
59155
59240
|
cursorPos,
|
|
@@ -59157,6 +59242,7 @@ var init_InlineBashApproval = __esm(async () => {
|
|
|
59157
59242
|
clear
|
|
59158
59243
|
} = useTextInputCursor();
|
|
59159
59244
|
const columns = useTerminalWidth();
|
|
59245
|
+
useProgressIndicator();
|
|
59160
59246
|
const customOptionIndex = allowPersistence ? 2 : 1;
|
|
59161
59247
|
const maxOptionIndex = customOptionIndex;
|
|
59162
59248
|
const isOnCustomOption = selectedOption === customOptionIndex;
|
|
@@ -59207,7 +59293,7 @@ var init_InlineBashApproval = __esm(async () => {
|
|
|
59207
59293
|
}
|
|
59208
59294
|
}, { isActive: isFocused });
|
|
59209
59295
|
const solidLine = SOLID_LINE4.repeat(Math.max(columns - 2, 10));
|
|
59210
|
-
const memoizedCommandContent =
|
|
59296
|
+
const memoizedCommandContent = import_react43.useMemo(() => /* @__PURE__ */ jsx_dev_runtime20.jsxDEV(jsx_dev_runtime20.Fragment, {
|
|
59211
59297
|
children: [
|
|
59212
59298
|
/* @__PURE__ */ jsx_dev_runtime20.jsxDEV(Text, {
|
|
59213
59299
|
dimColor: true,
|
|
@@ -59348,14 +59434,15 @@ var init_InlineBashApproval = __esm(async () => {
|
|
|
59348
59434
|
});
|
|
59349
59435
|
|
|
59350
59436
|
// src/cli/components/InlineEnterPlanModeApproval.tsx
|
|
59351
|
-
var
|
|
59437
|
+
var import_react44, jsx_dev_runtime21, SOLID_LINE5 = "─", OptionsRenderer, InlineEnterPlanModeApproval;
|
|
59352
59438
|
var init_InlineEnterPlanModeApproval = __esm(async () => {
|
|
59439
|
+
init_useProgressIndicator();
|
|
59353
59440
|
init_useTerminalWidth();
|
|
59354
59441
|
init_colors();
|
|
59355
59442
|
await init_build2();
|
|
59356
|
-
|
|
59443
|
+
import_react44 = __toESM(require_react(), 1);
|
|
59357
59444
|
jsx_dev_runtime21 = __toESM(require_jsx_dev_runtime(), 1);
|
|
59358
|
-
OptionsRenderer =
|
|
59445
|
+
OptionsRenderer = import_react44.memo(({
|
|
59359
59446
|
options,
|
|
59360
59447
|
selectedOption
|
|
59361
59448
|
}) => {
|
|
@@ -59381,9 +59468,10 @@ var init_InlineEnterPlanModeApproval = __esm(async () => {
|
|
|
59381
59468
|
}, undefined, false, undefined, this);
|
|
59382
59469
|
});
|
|
59383
59470
|
OptionsRenderer.displayName = "OptionsRenderer";
|
|
59384
|
-
InlineEnterPlanModeApproval =
|
|
59385
|
-
const [selectedOption, setSelectedOption] =
|
|
59471
|
+
InlineEnterPlanModeApproval = import_react44.memo(({ onApprove, onReject, isFocused = true }) => {
|
|
59472
|
+
const [selectedOption, setSelectedOption] = import_react44.useState(0);
|
|
59386
59473
|
const columns = useTerminalWidth();
|
|
59474
|
+
useProgressIndicator();
|
|
59387
59475
|
const options = [
|
|
59388
59476
|
{ label: "Yes, enter plan mode", action: onApprove },
|
|
59389
59477
|
{ label: "No, start implementing now", action: onReject }
|
|
@@ -59532,10 +59620,11 @@ function getDiffKind(toolName) {
|
|
|
59532
59620
|
}
|
|
59533
59621
|
return "edit";
|
|
59534
59622
|
}
|
|
59535
|
-
var
|
|
59623
|
+
var import_react45, jsx_dev_runtime22, SOLID_LINE6 = "─", DOTTED_LINE3 = "╌", InlineFileEditApproval;
|
|
59536
59624
|
var init_InlineFileEditApproval = __esm(async () => {
|
|
59537
59625
|
init_diff2();
|
|
59538
59626
|
init_formatArgsDisplay();
|
|
59627
|
+
init_useProgressIndicator();
|
|
59539
59628
|
init_useTerminalWidth();
|
|
59540
59629
|
init_useTextInputCursor();
|
|
59541
59630
|
init_colors();
|
|
@@ -59543,9 +59632,9 @@ var init_InlineFileEditApproval = __esm(async () => {
|
|
|
59543
59632
|
init_build2(),
|
|
59544
59633
|
init_AdvancedDiffRenderer()
|
|
59545
59634
|
]);
|
|
59546
|
-
|
|
59635
|
+
import_react45 = __toESM(require_react(), 1);
|
|
59547
59636
|
jsx_dev_runtime22 = __toESM(require_jsx_dev_runtime(), 1);
|
|
59548
|
-
InlineFileEditApproval =
|
|
59637
|
+
InlineFileEditApproval = import_react45.memo(({
|
|
59549
59638
|
fileEdit,
|
|
59550
59639
|
precomputedDiff,
|
|
59551
59640
|
allDiffs,
|
|
@@ -59557,7 +59646,7 @@ var init_InlineFileEditApproval = __esm(async () => {
|
|
|
59557
59646
|
approveAlwaysText,
|
|
59558
59647
|
allowPersistence = true
|
|
59559
59648
|
}) => {
|
|
59560
|
-
const [selectedOption, setSelectedOption] =
|
|
59649
|
+
const [selectedOption, setSelectedOption] = import_react45.useState(0);
|
|
59561
59650
|
const {
|
|
59562
59651
|
text: customReason,
|
|
59563
59652
|
cursorPos,
|
|
@@ -59565,10 +59654,11 @@ var init_InlineFileEditApproval = __esm(async () => {
|
|
|
59565
59654
|
clear
|
|
59566
59655
|
} = useTextInputCursor();
|
|
59567
59656
|
const columns = useTerminalWidth();
|
|
59657
|
+
useProgressIndicator();
|
|
59568
59658
|
const customOptionIndex = allowPersistence ? 2 : 1;
|
|
59569
59659
|
const maxOptionIndex = customOptionIndex;
|
|
59570
59660
|
const isOnCustomOption = selectedOption === customOptionIndex;
|
|
59571
|
-
const diffsToPass =
|
|
59661
|
+
const diffsToPass = import_react45.useMemo(() => {
|
|
59572
59662
|
const diffs = new Map;
|
|
59573
59663
|
const toolCallId = fileEdit.toolCallId;
|
|
59574
59664
|
if (precomputedDiff && toolCallId) {
|
|
@@ -59651,7 +59741,7 @@ var init_InlineFileEditApproval = __esm(async () => {
|
|
|
59651
59741
|
const dottedLine = DOTTED_LINE3.repeat(Math.max(columns - 2, 10));
|
|
59652
59742
|
const headerText = getHeaderText(fileEdit);
|
|
59653
59743
|
const diffKind = getDiffKind(fileEdit.toolName);
|
|
59654
|
-
const memoizedDiffContent =
|
|
59744
|
+
const memoizedDiffContent = import_react45.useMemo(() => /* @__PURE__ */ jsx_dev_runtime22.jsxDEV(jsx_dev_runtime22.Fragment, {
|
|
59655
59745
|
children: [
|
|
59656
59746
|
/* @__PURE__ */ jsx_dev_runtime22.jsxDEV(Text, {
|
|
59657
59747
|
dimColor: true,
|
|
@@ -59906,15 +59996,16 @@ function formatArgs(toolArgs) {
|
|
|
59906
59996
|
return toolArgs || "(no arguments)";
|
|
59907
59997
|
}
|
|
59908
59998
|
}
|
|
59909
|
-
var
|
|
59999
|
+
var import_react46, jsx_dev_runtime23, SOLID_LINE7 = "─", InlineGenericApproval;
|
|
59910
60000
|
var init_InlineGenericApproval = __esm(async () => {
|
|
60001
|
+
init_useProgressIndicator();
|
|
59911
60002
|
init_useTerminalWidth();
|
|
59912
60003
|
init_useTextInputCursor();
|
|
59913
60004
|
init_colors();
|
|
59914
60005
|
await init_build2();
|
|
59915
|
-
|
|
60006
|
+
import_react46 = __toESM(require_react(), 1);
|
|
59916
60007
|
jsx_dev_runtime23 = __toESM(require_jsx_dev_runtime(), 1);
|
|
59917
|
-
InlineGenericApproval =
|
|
60008
|
+
InlineGenericApproval = import_react46.memo(({
|
|
59918
60009
|
toolName,
|
|
59919
60010
|
toolArgs,
|
|
59920
60011
|
onApprove,
|
|
@@ -59925,7 +60016,7 @@ var init_InlineGenericApproval = __esm(async () => {
|
|
|
59925
60016
|
approveAlwaysText,
|
|
59926
60017
|
allowPersistence = true
|
|
59927
60018
|
}) => {
|
|
59928
|
-
const [selectedOption, setSelectedOption] =
|
|
60019
|
+
const [selectedOption, setSelectedOption] = import_react46.useState(0);
|
|
59929
60020
|
const {
|
|
59930
60021
|
text: customReason,
|
|
59931
60022
|
cursorPos,
|
|
@@ -59933,6 +60024,7 @@ var init_InlineGenericApproval = __esm(async () => {
|
|
|
59933
60024
|
clear
|
|
59934
60025
|
} = useTextInputCursor();
|
|
59935
60026
|
const columns = useTerminalWidth();
|
|
60027
|
+
useProgressIndicator();
|
|
59936
60028
|
const customOptionIndex = allowPersistence ? 2 : 1;
|
|
59937
60029
|
const maxOptionIndex = customOptionIndex;
|
|
59938
60030
|
const isOnCustomOption = selectedOption === customOptionIndex;
|
|
@@ -59984,7 +60076,7 @@ var init_InlineGenericApproval = __esm(async () => {
|
|
|
59984
60076
|
}, { isActive: isFocused });
|
|
59985
60077
|
const solidLine = SOLID_LINE7.repeat(Math.max(columns - 2, 10));
|
|
59986
60078
|
const formattedArgs = formatArgs(toolArgs);
|
|
59987
|
-
const memoizedToolContent =
|
|
60079
|
+
const memoizedToolContent = import_react46.useMemo(() => /* @__PURE__ */ jsx_dev_runtime23.jsxDEV(jsx_dev_runtime23.Fragment, {
|
|
59988
60080
|
children: [
|
|
59989
60081
|
/* @__PURE__ */ jsx_dev_runtime23.jsxDEV(Text, {
|
|
59990
60082
|
dimColor: true,
|
|
@@ -60124,18 +60216,19 @@ var init_InlineGenericApproval = __esm(async () => {
|
|
|
60124
60216
|
});
|
|
60125
60217
|
|
|
60126
60218
|
// src/cli/components/InlineQuestionApproval.tsx
|
|
60127
|
-
var
|
|
60219
|
+
var import_react47, jsx_dev_runtime24, SOLID_LINE8 = "─", InlineQuestionApproval;
|
|
60128
60220
|
var init_InlineQuestionApproval = __esm(async () => {
|
|
60221
|
+
init_useProgressIndicator();
|
|
60129
60222
|
init_useTerminalWidth();
|
|
60130
60223
|
init_useTextInputCursor();
|
|
60131
60224
|
init_colors();
|
|
60132
60225
|
await init_build2();
|
|
60133
|
-
|
|
60226
|
+
import_react47 = __toESM(require_react(), 1);
|
|
60134
60227
|
jsx_dev_runtime24 = __toESM(require_jsx_dev_runtime(), 1);
|
|
60135
|
-
InlineQuestionApproval =
|
|
60136
|
-
const [currentQuestionIndex, setCurrentQuestionIndex] =
|
|
60137
|
-
const [answers, setAnswers] =
|
|
60138
|
-
const [selectedOption, setSelectedOption] =
|
|
60228
|
+
InlineQuestionApproval = import_react47.memo(({ questions, onSubmit, onCancel, isFocused = true }) => {
|
|
60229
|
+
const [currentQuestionIndex, setCurrentQuestionIndex] = import_react47.useState(0);
|
|
60230
|
+
const [answers, setAnswers] = import_react47.useState({});
|
|
60231
|
+
const [selectedOption, setSelectedOption] = import_react47.useState(0);
|
|
60139
60232
|
const {
|
|
60140
60233
|
text: customText,
|
|
60141
60234
|
setText: setCustomText,
|
|
@@ -60144,8 +60237,9 @@ var init_InlineQuestionApproval = __esm(async () => {
|
|
|
60144
60237
|
handleKey,
|
|
60145
60238
|
clear: clearCustomText
|
|
60146
60239
|
} = useTextInputCursor();
|
|
60147
|
-
const [selectedMulti, setSelectedMulti] =
|
|
60240
|
+
const [selectedMulti, setSelectedMulti] = import_react47.useState(new Set);
|
|
60148
60241
|
const columns = useTerminalWidth();
|
|
60242
|
+
useProgressIndicator();
|
|
60149
60243
|
const currentQuestion = questions[currentQuestionIndex];
|
|
60150
60244
|
const baseOptions = currentQuestion ? [
|
|
60151
60245
|
...currentQuestion.options,
|
|
@@ -60312,7 +60406,7 @@ var init_InlineQuestionApproval = __esm(async () => {
|
|
|
60312
60406
|
}
|
|
60313
60407
|
}, { isActive: isFocused });
|
|
60314
60408
|
const solidLine = SOLID_LINE8.repeat(Math.max(columns - 2, 10));
|
|
60315
|
-
const memoizedHeaderContent =
|
|
60409
|
+
const memoizedHeaderContent = import_react47.useMemo(() => /* @__PURE__ */ jsx_dev_runtime24.jsxDEV(jsx_dev_runtime24.Fragment, {
|
|
60316
60410
|
children: [
|
|
60317
60411
|
/* @__PURE__ */ jsx_dev_runtime24.jsxDEV(Text, {
|
|
60318
60412
|
dimColor: true,
|
|
@@ -60405,7 +60499,7 @@ var init_InlineQuestionApproval = __esm(async () => {
|
|
|
60405
60499
|
}, "submit", true, undefined, this);
|
|
60406
60500
|
}
|
|
60407
60501
|
const hasDescription = option.description && !isCustomOption;
|
|
60408
|
-
return /* @__PURE__ */ jsx_dev_runtime24.jsxDEV(
|
|
60502
|
+
return /* @__PURE__ */ jsx_dev_runtime24.jsxDEV(import_react47.Fragment, {
|
|
60409
60503
|
children: [
|
|
60410
60504
|
/* @__PURE__ */ jsx_dev_runtime24.jsxDEV(Box_default, {
|
|
60411
60505
|
flexDirection: "row",
|
|
@@ -60493,15 +60587,16 @@ function truncate(text, maxLength) {
|
|
|
60493
60587
|
return text;
|
|
60494
60588
|
return `${text.slice(0, maxLength - 3)}...`;
|
|
60495
60589
|
}
|
|
60496
|
-
var
|
|
60590
|
+
var import_react48, jsx_dev_runtime25, SOLID_LINE9 = "─", InlineTaskApproval;
|
|
60497
60591
|
var init_InlineTaskApproval = __esm(async () => {
|
|
60592
|
+
init_useProgressIndicator();
|
|
60498
60593
|
init_useTerminalWidth();
|
|
60499
60594
|
init_useTextInputCursor();
|
|
60500
60595
|
init_colors();
|
|
60501
60596
|
await init_build2();
|
|
60502
|
-
|
|
60597
|
+
import_react48 = __toESM(require_react(), 1);
|
|
60503
60598
|
jsx_dev_runtime25 = __toESM(require_jsx_dev_runtime(), 1);
|
|
60504
|
-
InlineTaskApproval =
|
|
60599
|
+
InlineTaskApproval = import_react48.memo(({
|
|
60505
60600
|
taskInfo,
|
|
60506
60601
|
onApprove,
|
|
60507
60602
|
onApproveAlways,
|
|
@@ -60511,7 +60606,7 @@ var init_InlineTaskApproval = __esm(async () => {
|
|
|
60511
60606
|
approveAlwaysText,
|
|
60512
60607
|
allowPersistence = true
|
|
60513
60608
|
}) => {
|
|
60514
|
-
const [selectedOption, setSelectedOption] =
|
|
60609
|
+
const [selectedOption, setSelectedOption] = import_react48.useState(0);
|
|
60515
60610
|
const {
|
|
60516
60611
|
text: customReason,
|
|
60517
60612
|
cursorPos,
|
|
@@ -60519,6 +60614,7 @@ var init_InlineTaskApproval = __esm(async () => {
|
|
|
60519
60614
|
clear
|
|
60520
60615
|
} = useTextInputCursor();
|
|
60521
60616
|
const columns = useTerminalWidth();
|
|
60617
|
+
useProgressIndicator();
|
|
60522
60618
|
const customOptionIndex = allowPersistence ? 2 : 1;
|
|
60523
60619
|
const maxOptionIndex = customOptionIndex;
|
|
60524
60620
|
const isOnCustomOption = selectedOption === customOptionIndex;
|
|
@@ -60570,7 +60666,7 @@ var init_InlineTaskApproval = __esm(async () => {
|
|
|
60570
60666
|
}, { isActive: isFocused });
|
|
60571
60667
|
const solidLine = SOLID_LINE9.repeat(Math.max(columns - 2, 10));
|
|
60572
60668
|
const contentWidth = Math.max(0, columns - 4);
|
|
60573
|
-
const memoizedTaskContent =
|
|
60669
|
+
const memoizedTaskContent = import_react48.useMemo(() => {
|
|
60574
60670
|
const { subagentType, description, prompt, model } = taskInfo;
|
|
60575
60671
|
const truncatedPrompt = truncate(prompt, 300);
|
|
60576
60672
|
return /* @__PURE__ */ jsx_dev_runtime25.jsxDEV(jsx_dev_runtime25.Fragment, {
|
|
@@ -62436,9 +62532,9 @@ var require_cli_spinners = __commonJS((exports, module) => {
|
|
|
62436
62532
|
|
|
62437
62533
|
// node_modules/ink-spinner/build/index.js
|
|
62438
62534
|
function Spinner({ type = "dots" }) {
|
|
62439
|
-
const [frame, setFrame] =
|
|
62535
|
+
const [frame, setFrame] = import_react49.useState(0);
|
|
62440
62536
|
const spinner = import_cli_spinners.default[type];
|
|
62441
|
-
|
|
62537
|
+
import_react49.useEffect(() => {
|
|
62442
62538
|
const timer = setInterval(() => {
|
|
62443
62539
|
setFrame((previousFrame) => {
|
|
62444
62540
|
const isLastFrame = previousFrame === spinner.frames.length - 1;
|
|
@@ -62449,12 +62545,12 @@ function Spinner({ type = "dots" }) {
|
|
|
62449
62545
|
clearInterval(timer);
|
|
62450
62546
|
};
|
|
62451
62547
|
}, [spinner]);
|
|
62452
|
-
return
|
|
62548
|
+
return import_react49.default.createElement(Text, null, spinner.frames[frame]);
|
|
62453
62549
|
}
|
|
62454
|
-
var
|
|
62550
|
+
var import_react49, import_cli_spinners, build_default2;
|
|
62455
62551
|
var init_build5 = __esm(async () => {
|
|
62456
62552
|
await init_build2();
|
|
62457
|
-
|
|
62553
|
+
import_react49 = __toESM(require_react(), 1);
|
|
62458
62554
|
import_cli_spinners = __toESM(require_cli_spinners(), 1);
|
|
62459
62555
|
build_default2 = Spinner;
|
|
62460
62556
|
});
|
|
@@ -63661,7 +63757,7 @@ var init_dist4 = __esm(async () => {
|
|
|
63661
63757
|
});
|
|
63662
63758
|
|
|
63663
63759
|
// src/cli/components/AgentInfoBar.tsx
|
|
63664
|
-
var
|
|
63760
|
+
var import_react50, jsx_dev_runtime26, AgentInfoBar;
|
|
63665
63761
|
var init_AgentInfoBar = __esm(async () => {
|
|
63666
63762
|
init_constants();
|
|
63667
63763
|
init_colors();
|
|
@@ -63670,14 +63766,14 @@ var init_AgentInfoBar = __esm(async () => {
|
|
|
63670
63766
|
init_dist4(),
|
|
63671
63767
|
init_settings_manager()
|
|
63672
63768
|
]);
|
|
63673
|
-
|
|
63769
|
+
import_react50 = __toESM(require_react(), 1);
|
|
63674
63770
|
jsx_dev_runtime26 = __toESM(require_jsx_dev_runtime(), 1);
|
|
63675
|
-
AgentInfoBar =
|
|
63771
|
+
AgentInfoBar = import_react50.memo(function AgentInfoBar2({
|
|
63676
63772
|
agentId,
|
|
63677
63773
|
agentName,
|
|
63678
63774
|
serverUrl
|
|
63679
63775
|
}) {
|
|
63680
|
-
const isPinned =
|
|
63776
|
+
const isPinned = import_react50.useMemo(() => {
|
|
63681
63777
|
if (!agentId)
|
|
63682
63778
|
return false;
|
|
63683
63779
|
const localPinned = settingsManager.getLocalPinnedAgents();
|
|
@@ -63851,16 +63947,16 @@ function useAutocompleteNavigation({
|
|
|
63851
63947
|
manageActiveState = true,
|
|
63852
63948
|
disabled = false
|
|
63853
63949
|
}) {
|
|
63854
|
-
const [selectedIndex, setSelectedIndex] =
|
|
63855
|
-
const prevMatchCountRef =
|
|
63856
|
-
const prevIsActiveRef =
|
|
63857
|
-
|
|
63950
|
+
const [selectedIndex, setSelectedIndex] = import_react51.useState(0);
|
|
63951
|
+
const prevMatchCountRef = import_react51.useRef(0);
|
|
63952
|
+
const prevIsActiveRef = import_react51.useRef(false);
|
|
63953
|
+
import_react51.useEffect(() => {
|
|
63858
63954
|
if (matches.length !== prevMatchCountRef.current) {
|
|
63859
63955
|
setSelectedIndex(0);
|
|
63860
63956
|
prevMatchCountRef.current = matches.length;
|
|
63861
63957
|
}
|
|
63862
63958
|
}, [matches.length]);
|
|
63863
|
-
|
|
63959
|
+
import_react51.useEffect(() => {
|
|
63864
63960
|
if (manageActiveState) {
|
|
63865
63961
|
const isActive = matches.length > 0;
|
|
63866
63962
|
if (isActive !== prevIsActiveRef.current) {
|
|
@@ -63895,10 +63991,10 @@ function useAutocompleteNavigation({
|
|
|
63895
63991
|
});
|
|
63896
63992
|
return { selectedIndex };
|
|
63897
63993
|
}
|
|
63898
|
-
var
|
|
63994
|
+
var import_react51;
|
|
63899
63995
|
var init_useAutocompleteNavigation = __esm(async () => {
|
|
63900
63996
|
await init_build2();
|
|
63901
|
-
|
|
63997
|
+
import_react51 = __toESM(require_react(), 1);
|
|
63902
63998
|
});
|
|
63903
63999
|
|
|
63904
64000
|
// src/cli/components/Autocomplete.tsx
|
|
@@ -63973,10 +64069,10 @@ function FileAutocomplete({
|
|
|
63973
64069
|
onSelect,
|
|
63974
64070
|
onActiveChange
|
|
63975
64071
|
}) {
|
|
63976
|
-
const [matches, setMatches] =
|
|
63977
|
-
const [isLoading, setIsLoading] =
|
|
63978
|
-
const [lastValidQuery, setLastValidQuery] =
|
|
63979
|
-
const debounceTimeout =
|
|
64072
|
+
const [matches, setMatches] = import_react52.useState([]);
|
|
64073
|
+
const [isLoading, setIsLoading] = import_react52.useState(false);
|
|
64074
|
+
const [lastValidQuery, setLastValidQuery] = import_react52.useState("");
|
|
64075
|
+
const debounceTimeout = import_react52.useRef(null);
|
|
63980
64076
|
const { selectedIndex } = useAutocompleteNavigation({
|
|
63981
64077
|
matches,
|
|
63982
64078
|
maxVisible: 10,
|
|
@@ -63984,7 +64080,7 @@ function FileAutocomplete({
|
|
|
63984
64080
|
manageActiveState: false,
|
|
63985
64081
|
disabled: isLoading
|
|
63986
64082
|
});
|
|
63987
|
-
|
|
64083
|
+
import_react52.useEffect(() => {
|
|
63988
64084
|
if (debounceTimeout.current) {
|
|
63989
64085
|
clearTimeout(debounceTimeout.current);
|
|
63990
64086
|
}
|
|
@@ -64103,7 +64199,7 @@ function FileAutocomplete({
|
|
|
64103
64199
|
}, undefined, false, undefined, this)
|
|
64104
64200
|
}, undefined, false, undefined, this);
|
|
64105
64201
|
}
|
|
64106
|
-
var
|
|
64202
|
+
var import_react52, jsx_dev_runtime28;
|
|
64107
64203
|
var init_FileAutocomplete = __esm(async () => {
|
|
64108
64204
|
init_fileSearch();
|
|
64109
64205
|
init_colors();
|
|
@@ -64112,7 +64208,7 @@ var init_FileAutocomplete = __esm(async () => {
|
|
|
64112
64208
|
init_useAutocompleteNavigation(),
|
|
64113
64209
|
init_Autocomplete()
|
|
64114
64210
|
]);
|
|
64115
|
-
|
|
64211
|
+
import_react52 = __toESM(require_react(), 1);
|
|
64116
64212
|
jsx_dev_runtime28 = __toESM(require_jsx_dev_runtime(), 1);
|
|
64117
64213
|
});
|
|
64118
64214
|
|
|
@@ -64139,9 +64235,9 @@ function SlashCommandAutocomplete({
|
|
|
64139
64235
|
agentId,
|
|
64140
64236
|
workingDirectory = process.cwd()
|
|
64141
64237
|
}) {
|
|
64142
|
-
const [matches, setMatches] =
|
|
64143
|
-
const [customCommands, setCustomCommands] =
|
|
64144
|
-
|
|
64238
|
+
const [matches, setMatches] = import_react53.useState([]);
|
|
64239
|
+
const [customCommands, setCustomCommands] = import_react53.useState([]);
|
|
64240
|
+
import_react53.useEffect(() => {
|
|
64145
64241
|
Promise.resolve().then(() => (init_custom(), exports_custom)).then(({ getCustomCommands: getCustomCommands2 }) => {
|
|
64146
64242
|
getCustomCommands2().then((customs) => {
|
|
64147
64243
|
const matches2 = customs.map((cmd) => ({
|
|
@@ -64153,7 +64249,7 @@ function SlashCommandAutocomplete({
|
|
|
64153
64249
|
});
|
|
64154
64250
|
});
|
|
64155
64251
|
}, []);
|
|
64156
|
-
const allCommands =
|
|
64252
|
+
const allCommands = import_react53.useMemo(() => {
|
|
64157
64253
|
let builtins = _allCommands;
|
|
64158
64254
|
if (agentId) {
|
|
64159
64255
|
try {
|
|
@@ -64184,7 +64280,7 @@ function SlashCommandAutocomplete({
|
|
|
64184
64280
|
onAutocomplete: onAutocomplete ? (item) => onAutocomplete(item.cmd) : undefined,
|
|
64185
64281
|
onActiveChange
|
|
64186
64282
|
});
|
|
64187
|
-
|
|
64283
|
+
import_react53.useEffect(() => {
|
|
64188
64284
|
const result = extractSearchQuery2(currentInput, cursorPosition);
|
|
64189
64285
|
if (!result) {
|
|
64190
64286
|
setMatches([]);
|
|
@@ -64285,7 +64381,7 @@ function SlashCommandAutocomplete({
|
|
|
64285
64381
|
]
|
|
64286
64382
|
}, undefined, true, undefined, this);
|
|
64287
64383
|
}
|
|
64288
|
-
var
|
|
64384
|
+
var import_react53, jsx_dev_runtime29, VISIBLE_COMMANDS = 8, _allCommands;
|
|
64289
64385
|
var init_SlashCommandAutocomplete = __esm(async () => {
|
|
64290
64386
|
init_version();
|
|
64291
64387
|
init_registry();
|
|
@@ -64297,7 +64393,7 @@ var init_SlashCommandAutocomplete = __esm(async () => {
|
|
|
64297
64393
|
init_useAutocompleteNavigation(),
|
|
64298
64394
|
init_Autocomplete()
|
|
64299
64395
|
]);
|
|
64300
|
-
|
|
64396
|
+
import_react53 = __toESM(require_react(), 1);
|
|
64301
64397
|
jsx_dev_runtime29 = __toESM(require_jsx_dev_runtime(), 1);
|
|
64302
64398
|
_allCommands = Object.entries(commands).filter(([, { hidden }]) => !hidden).map(([cmd, { desc, order }]) => ({
|
|
64303
64399
|
cmd,
|
|
@@ -64321,7 +64417,7 @@ function InputAssist({
|
|
|
64321
64417
|
}) {
|
|
64322
64418
|
const showFileAutocomplete = currentInput.includes("@");
|
|
64323
64419
|
const showCommandAutocomplete = !showFileAutocomplete && currentInput.startsWith("/");
|
|
64324
|
-
|
|
64420
|
+
import_react54.useEffect(() => {
|
|
64325
64421
|
if (!showFileAutocomplete && !showCommandAutocomplete) {
|
|
64326
64422
|
onAutocompleteActiveChange(false);
|
|
64327
64423
|
}
|
|
@@ -64361,7 +64457,7 @@ function InputAssist({
|
|
|
64361
64457
|
}
|
|
64362
64458
|
return null;
|
|
64363
64459
|
}
|
|
64364
|
-
var
|
|
64460
|
+
var import_react54, jsx_dev_runtime30;
|
|
64365
64461
|
var init_InputAssist = __esm(async () => {
|
|
64366
64462
|
await __promiseAll([
|
|
64367
64463
|
init_build2(),
|
|
@@ -64369,17 +64465,17 @@ var init_InputAssist = __esm(async () => {
|
|
|
64369
64465
|
init_FileAutocomplete(),
|
|
64370
64466
|
init_SlashCommandAutocomplete()
|
|
64371
64467
|
]);
|
|
64372
|
-
|
|
64468
|
+
import_react54 = __toESM(require_react(), 1);
|
|
64373
64469
|
jsx_dev_runtime30 = __toESM(require_jsx_dev_runtime(), 1);
|
|
64374
64470
|
});
|
|
64375
64471
|
|
|
64376
64472
|
// src/cli/components/QueuedMessages.tsx
|
|
64377
|
-
var
|
|
64473
|
+
var import_react55, jsx_dev_runtime31, QueuedMessages;
|
|
64378
64474
|
var init_QueuedMessages = __esm(async () => {
|
|
64379
64475
|
await init_build2();
|
|
64380
|
-
|
|
64476
|
+
import_react55 = __toESM(require_react(), 1);
|
|
64381
64477
|
jsx_dev_runtime31 = __toESM(require_jsx_dev_runtime(), 1);
|
|
64382
|
-
QueuedMessages =
|
|
64478
|
+
QueuedMessages = import_react55.memo(({ messages }) => {
|
|
64383
64479
|
const maxDisplay = 5;
|
|
64384
64480
|
return /* @__PURE__ */ jsx_dev_runtime31.jsxDEV(Box_default, {
|
|
64385
64481
|
flexDirection: "column",
|
|
@@ -64488,22 +64584,22 @@ function Input({
|
|
|
64488
64584
|
ralphPendingYolo = false,
|
|
64489
64585
|
onRalphExit
|
|
64490
64586
|
}) {
|
|
64491
|
-
const [value, setValue] =
|
|
64492
|
-
const [escapePressed, setEscapePressed] =
|
|
64493
|
-
const escapeTimerRef =
|
|
64494
|
-
const [ctrlCPressed, setCtrlCPressed] =
|
|
64495
|
-
const ctrlCTimerRef =
|
|
64496
|
-
const previousValueRef =
|
|
64497
|
-
const [currentMode, setCurrentMode] =
|
|
64498
|
-
const [isAutocompleteActive, setIsAutocompleteActive] =
|
|
64499
|
-
const [cursorPos, setCursorPos] =
|
|
64500
|
-
const [currentCursorPosition, setCurrentCursorPosition] =
|
|
64501
|
-
const [history, setHistory] =
|
|
64502
|
-
const [historyIndex, setHistoryIndex] =
|
|
64503
|
-
const [temporaryInput, setTemporaryInput] =
|
|
64504
|
-
const [atStartBoundary, setAtStartBoundary] =
|
|
64505
|
-
const [atEndBoundary, setAtEndBoundary] =
|
|
64506
|
-
const [isBashMode, setIsBashMode] =
|
|
64587
|
+
const [value, setValue] = import_react56.useState("");
|
|
64588
|
+
const [escapePressed, setEscapePressed] = import_react56.useState(false);
|
|
64589
|
+
const escapeTimerRef = import_react56.useRef(null);
|
|
64590
|
+
const [ctrlCPressed, setCtrlCPressed] = import_react56.useState(false);
|
|
64591
|
+
const ctrlCTimerRef = import_react56.useRef(null);
|
|
64592
|
+
const previousValueRef = import_react56.useRef(value);
|
|
64593
|
+
const [currentMode, setCurrentMode] = import_react56.useState(externalMode || permissionMode2.getMode());
|
|
64594
|
+
const [isAutocompleteActive, setIsAutocompleteActive] = import_react56.useState(false);
|
|
64595
|
+
const [cursorPos, setCursorPos] = import_react56.useState(undefined);
|
|
64596
|
+
const [currentCursorPosition, setCurrentCursorPosition] = import_react56.useState(0);
|
|
64597
|
+
const [history, setHistory] = import_react56.useState([]);
|
|
64598
|
+
const [historyIndex, setHistoryIndex] = import_react56.useState(-1);
|
|
64599
|
+
const [temporaryInput, setTemporaryInput] = import_react56.useState("");
|
|
64600
|
+
const [atStartBoundary, setAtStartBoundary] = import_react56.useState(false);
|
|
64601
|
+
const [atEndBoundary, setAtEndBoundary] = import_react56.useState(false);
|
|
64602
|
+
const [isBashMode, setIsBashMode] = import_react56.useState(false);
|
|
64507
64603
|
const handleBangAtEmpty = () => {
|
|
64508
64604
|
if (isBashMode)
|
|
64509
64605
|
return false;
|
|
@@ -64516,13 +64612,13 @@ function Input({
|
|
|
64516
64612
|
setIsBashMode(false);
|
|
64517
64613
|
return true;
|
|
64518
64614
|
};
|
|
64519
|
-
|
|
64615
|
+
import_react56.useEffect(() => {
|
|
64520
64616
|
if (cursorPos !== undefined) {
|
|
64521
64617
|
const timer = setTimeout(() => setCursorPos(undefined), 0);
|
|
64522
64618
|
return () => clearTimeout(timer);
|
|
64523
64619
|
}
|
|
64524
64620
|
}, [cursorPos]);
|
|
64525
|
-
|
|
64621
|
+
import_react56.useEffect(() => {
|
|
64526
64622
|
if (currentCursorPosition !== 0) {
|
|
64527
64623
|
setAtStartBoundary(false);
|
|
64528
64624
|
}
|
|
@@ -64530,14 +64626,14 @@ function Input({
|
|
|
64530
64626
|
setAtEndBoundary(false);
|
|
64531
64627
|
}
|
|
64532
64628
|
}, [currentCursorPosition, value.length]);
|
|
64533
|
-
|
|
64629
|
+
import_react56.useEffect(() => {
|
|
64534
64630
|
if (externalMode !== undefined) {
|
|
64535
64631
|
setCurrentMode(externalMode);
|
|
64536
64632
|
}
|
|
64537
64633
|
}, [externalMode]);
|
|
64538
|
-
const [shimmerOffset, setShimmerOffset] =
|
|
64539
|
-
const [elapsedMs, setElapsedMs] =
|
|
64540
|
-
const streamStartRef =
|
|
64634
|
+
const [shimmerOffset, setShimmerOffset] = import_react56.useState(-3);
|
|
64635
|
+
const [elapsedMs, setElapsedMs] = import_react56.useState(0);
|
|
64636
|
+
const streamStartRef = import_react56.useRef(null);
|
|
64541
64637
|
const columns = useTerminalWidth();
|
|
64542
64638
|
const contentWidth = Math.max(0, columns - 2);
|
|
64543
64639
|
const settings = settingsManager.getSettings();
|
|
@@ -64705,7 +64801,7 @@ function Input({
|
|
|
64705
64801
|
}
|
|
64706
64802
|
}
|
|
64707
64803
|
});
|
|
64708
|
-
|
|
64804
|
+
import_react56.useEffect(() => {
|
|
64709
64805
|
if (value !== previousValueRef.current && value !== "") {
|
|
64710
64806
|
setEscapePressed(false);
|
|
64711
64807
|
if (escapeTimerRef.current)
|
|
@@ -64720,13 +64816,13 @@ function Input({
|
|
|
64720
64816
|
}
|
|
64721
64817
|
previousValueRef.current = value;
|
|
64722
64818
|
}, [value]);
|
|
64723
|
-
|
|
64819
|
+
import_react56.useEffect(() => {
|
|
64724
64820
|
if (historyIndex !== -1 && value !== history[historyIndex]) {
|
|
64725
64821
|
setHistoryIndex(-1);
|
|
64726
64822
|
setTemporaryInput("");
|
|
64727
64823
|
}
|
|
64728
64824
|
}, [value, historyIndex, history]);
|
|
64729
|
-
|
|
64825
|
+
import_react56.useEffect(() => {
|
|
64730
64826
|
return () => {
|
|
64731
64827
|
if (escapeTimerRef.current)
|
|
64732
64828
|
clearTimeout(escapeTimerRef.current);
|
|
@@ -64734,7 +64830,7 @@ function Input({
|
|
|
64734
64830
|
clearTimeout(ctrlCTimerRef.current);
|
|
64735
64831
|
};
|
|
64736
64832
|
}, []);
|
|
64737
|
-
|
|
64833
|
+
import_react56.useEffect(() => {
|
|
64738
64834
|
if (!streaming || !visible)
|
|
64739
64835
|
return;
|
|
64740
64836
|
const id = setInterval(() => {
|
|
@@ -64747,7 +64843,7 @@ function Input({
|
|
|
64747
64843
|
}, 120);
|
|
64748
64844
|
return () => clearInterval(id);
|
|
64749
64845
|
}, [streaming, thinkingMessage, visible, agentName]);
|
|
64750
|
-
|
|
64846
|
+
import_react56.useEffect(() => {
|
|
64751
64847
|
if (streaming && visible) {
|
|
64752
64848
|
if (streamStartRef.current === null) {
|
|
64753
64849
|
streamStartRef.current = Date.now();
|
|
@@ -65048,7 +65144,7 @@ function Input({
|
|
|
65048
65144
|
]
|
|
65049
65145
|
}, undefined, true, undefined, this);
|
|
65050
65146
|
}
|
|
65051
|
-
var
|
|
65147
|
+
var import_react56, jsx_dev_runtime33, Spinner2, ESC_CLEAR_WINDOW_MS = 2500;
|
|
65052
65148
|
var init_InputRich = __esm(async () => {
|
|
65053
65149
|
init_source();
|
|
65054
65150
|
init_oauth();
|
|
@@ -65067,7 +65163,7 @@ var init_InputRich = __esm(async () => {
|
|
|
65067
65163
|
init_QueuedMessages(),
|
|
65068
65164
|
init_ShimmerText()
|
|
65069
65165
|
]);
|
|
65070
|
-
|
|
65166
|
+
import_react56 = __toESM(require_react(), 1);
|
|
65071
65167
|
jsx_dev_runtime33 = __toESM(require_jsx_dev_runtime(), 1);
|
|
65072
65168
|
Spinner2 = build_default2;
|
|
65073
65169
|
stdin.setMaxListeners(20);
|
|
@@ -65103,7 +65199,7 @@ function truncateText(text, maxWidth) {
|
|
|
65103
65199
|
return text.slice(0, maxWidth);
|
|
65104
65200
|
return `${text.slice(0, maxWidth - 3)}...`;
|
|
65105
65201
|
}
|
|
65106
|
-
var
|
|
65202
|
+
var import_react57, jsx_dev_runtime34, DISPLAY_PAGE_SIZE = 5, TOOLS_DISPLAY_PAGE_SIZE = 8, McpSelector;
|
|
65107
65203
|
var init_McpSelector = __esm(async () => {
|
|
65108
65204
|
init_useTerminalWidth();
|
|
65109
65205
|
init_colors();
|
|
@@ -65111,30 +65207,30 @@ var init_McpSelector = __esm(async () => {
|
|
|
65111
65207
|
init_build2(),
|
|
65112
65208
|
init_client2()
|
|
65113
65209
|
]);
|
|
65114
|
-
|
|
65210
|
+
import_react57 = __toESM(require_react(), 1);
|
|
65115
65211
|
jsx_dev_runtime34 = __toESM(require_jsx_dev_runtime(), 1);
|
|
65116
|
-
McpSelector =
|
|
65212
|
+
McpSelector = import_react57.memo(function McpSelector2({
|
|
65117
65213
|
agentId,
|
|
65118
65214
|
onAdd,
|
|
65119
65215
|
onCancel
|
|
65120
65216
|
}) {
|
|
65121
65217
|
const terminalWidth = useTerminalWidth();
|
|
65122
|
-
const [servers, setServers] =
|
|
65123
|
-
const [loading, setLoading] =
|
|
65124
|
-
const [selectedIndex, setSelectedIndex] =
|
|
65125
|
-
const [currentPage, setCurrentPage] =
|
|
65126
|
-
const [mode, setMode] =
|
|
65127
|
-
const [deleteConfirmIndex, setDeleteConfirmIndex] =
|
|
65128
|
-
const [error, setError] =
|
|
65129
|
-
const [viewingServer, setViewingServer] =
|
|
65130
|
-
const [tools, setTools] =
|
|
65131
|
-
const [attachedToolIds, setAttachedToolIds] =
|
|
65132
|
-
const [toolsLoading, setToolsLoading] =
|
|
65133
|
-
const [toolsError, setToolsError] =
|
|
65134
|
-
const [toolsPage, setToolsPage] =
|
|
65135
|
-
const [toolsSelectedIndex, setToolsSelectedIndex] =
|
|
65136
|
-
const [isTogglingTool, setIsTogglingTool] =
|
|
65137
|
-
const loadServers =
|
|
65218
|
+
const [servers, setServers] = import_react57.useState([]);
|
|
65219
|
+
const [loading, setLoading] = import_react57.useState(true);
|
|
65220
|
+
const [selectedIndex, setSelectedIndex] = import_react57.useState(0);
|
|
65221
|
+
const [currentPage, setCurrentPage] = import_react57.useState(0);
|
|
65222
|
+
const [mode, setMode] = import_react57.useState("browsing");
|
|
65223
|
+
const [deleteConfirmIndex, setDeleteConfirmIndex] = import_react57.useState(0);
|
|
65224
|
+
const [error, setError] = import_react57.useState(null);
|
|
65225
|
+
const [viewingServer, setViewingServer] = import_react57.useState(null);
|
|
65226
|
+
const [tools, setTools] = import_react57.useState([]);
|
|
65227
|
+
const [attachedToolIds, setAttachedToolIds] = import_react57.useState(new Set);
|
|
65228
|
+
const [toolsLoading, setToolsLoading] = import_react57.useState(false);
|
|
65229
|
+
const [toolsError, setToolsError] = import_react57.useState(null);
|
|
65230
|
+
const [toolsPage, setToolsPage] = import_react57.useState(0);
|
|
65231
|
+
const [toolsSelectedIndex, setToolsSelectedIndex] = import_react57.useState(0);
|
|
65232
|
+
const [isTogglingTool, setIsTogglingTool] = import_react57.useState(false);
|
|
65233
|
+
const loadServers = import_react57.useCallback(async () => {
|
|
65138
65234
|
setLoading(true);
|
|
65139
65235
|
setError(null);
|
|
65140
65236
|
try {
|
|
@@ -65148,7 +65244,7 @@ var init_McpSelector = __esm(async () => {
|
|
|
65148
65244
|
setLoading(false);
|
|
65149
65245
|
}
|
|
65150
65246
|
}, []);
|
|
65151
|
-
const loadTools3 =
|
|
65247
|
+
const loadTools3 = import_react57.useCallback(async (server) => {
|
|
65152
65248
|
if (!server.id) {
|
|
65153
65249
|
setToolsError("Server ID not available");
|
|
65154
65250
|
return;
|
|
@@ -65176,7 +65272,7 @@ var init_McpSelector = __esm(async () => {
|
|
|
65176
65272
|
setToolsLoading(false);
|
|
65177
65273
|
}
|
|
65178
65274
|
}, [agentId]);
|
|
65179
|
-
const refreshToolsFromServer =
|
|
65275
|
+
const refreshToolsFromServer = import_react57.useCallback(async () => {
|
|
65180
65276
|
if (!viewingServer?.id)
|
|
65181
65277
|
return;
|
|
65182
65278
|
setToolsLoading(true);
|
|
@@ -65200,7 +65296,7 @@ var init_McpSelector = __esm(async () => {
|
|
|
65200
65296
|
setToolsLoading(false);
|
|
65201
65297
|
}
|
|
65202
65298
|
}, [agentId, viewingServer]);
|
|
65203
|
-
const toggleTool =
|
|
65299
|
+
const toggleTool = import_react57.useCallback(async (tool) => {
|
|
65204
65300
|
setIsTogglingTool(true);
|
|
65205
65301
|
try {
|
|
65206
65302
|
const client = await getClient2();
|
|
@@ -65219,7 +65315,7 @@ var init_McpSelector = __esm(async () => {
|
|
|
65219
65315
|
setIsTogglingTool(false);
|
|
65220
65316
|
}
|
|
65221
65317
|
}, [agentId, attachedToolIds]);
|
|
65222
|
-
const attachAllTools =
|
|
65318
|
+
const attachAllTools = import_react57.useCallback(async () => {
|
|
65223
65319
|
setIsTogglingTool(true);
|
|
65224
65320
|
try {
|
|
65225
65321
|
const client = await getClient2();
|
|
@@ -65234,7 +65330,7 @@ var init_McpSelector = __esm(async () => {
|
|
|
65234
65330
|
setIsTogglingTool(false);
|
|
65235
65331
|
}
|
|
65236
65332
|
}, [agentId, tools, attachedToolIds]);
|
|
65237
|
-
const detachAllTools =
|
|
65333
|
+
const detachAllTools = import_react57.useCallback(async () => {
|
|
65238
65334
|
setIsTogglingTool(true);
|
|
65239
65335
|
try {
|
|
65240
65336
|
const client = await getClient2();
|
|
@@ -65249,7 +65345,7 @@ var init_McpSelector = __esm(async () => {
|
|
|
65249
65345
|
setIsTogglingTool(false);
|
|
65250
65346
|
}
|
|
65251
65347
|
}, [agentId, tools, attachedToolIds]);
|
|
65252
|
-
|
|
65348
|
+
import_react57.useEffect(() => {
|
|
65253
65349
|
loadServers();
|
|
65254
65350
|
}, [loadServers]);
|
|
65255
65351
|
const totalPages = Math.ceil(servers.length / DISPLAY_PAGE_SIZE);
|
|
@@ -65719,10 +65815,10 @@ function MemoryViewer({
|
|
|
65719
65815
|
onClose
|
|
65720
65816
|
}) {
|
|
65721
65817
|
const adeUrl = `https://app.letta.com/agents/${agentId}?view=memory`;
|
|
65722
|
-
const [selectedIndex, setSelectedIndex] =
|
|
65723
|
-
const [currentPage, setCurrentPage] =
|
|
65724
|
-
const [detailBlockIndex, setDetailBlockIndex] =
|
|
65725
|
-
const [scrollOffset, setScrollOffset] =
|
|
65818
|
+
const [selectedIndex, setSelectedIndex] = import_react58.useState(0);
|
|
65819
|
+
const [currentPage, setCurrentPage] = import_react58.useState(0);
|
|
65820
|
+
const [detailBlockIndex, setDetailBlockIndex] = import_react58.useState(null);
|
|
65821
|
+
const [scrollOffset, setScrollOffset] = import_react58.useState(0);
|
|
65726
65822
|
const totalPages = Math.ceil(blocks.length / PAGE_SIZE2);
|
|
65727
65823
|
const startIndex = currentPage * PAGE_SIZE2;
|
|
65728
65824
|
const visibleBlocks = blocks.slice(startIndex, startIndex + PAGE_SIZE2);
|
|
@@ -66013,14 +66109,14 @@ function MemoryViewer({
|
|
|
66013
66109
|
]
|
|
66014
66110
|
}, undefined, true, undefined, this);
|
|
66015
66111
|
}
|
|
66016
|
-
var
|
|
66112
|
+
var import_react58, jsx_dev_runtime35, PAGE_SIZE2 = 3, PREVIEW_LINES = 3, DETAIL_DESCRIPTION_LINES = 3, DETAIL_VALUE_LINES = 12;
|
|
66017
66113
|
var init_MemoryViewer = __esm(async () => {
|
|
66018
66114
|
init_colors();
|
|
66019
66115
|
await __promiseAll([
|
|
66020
66116
|
init_build2(),
|
|
66021
66117
|
init_dist4()
|
|
66022
66118
|
]);
|
|
66023
|
-
|
|
66119
|
+
import_react58 = __toESM(require_react(), 1);
|
|
66024
66120
|
jsx_dev_runtime35 = __toESM(require_jsx_dev_runtime(), 1);
|
|
66025
66121
|
});
|
|
66026
66122
|
|
|
@@ -66097,16 +66193,16 @@ function getMessageText(msg) {
|
|
|
66097
66193
|
}
|
|
66098
66194
|
function MessageSearch({ onClose }) {
|
|
66099
66195
|
const terminalWidth = useTerminalWidth();
|
|
66100
|
-
const [searchInput, setSearchInput] =
|
|
66101
|
-
const [activeQuery, setActiveQuery] =
|
|
66102
|
-
const [searchMode, setSearchMode] =
|
|
66103
|
-
const [results, setResults] =
|
|
66104
|
-
const [loading, setLoading] =
|
|
66105
|
-
const [error, setError] =
|
|
66106
|
-
const [currentPage, setCurrentPage] =
|
|
66107
|
-
const [selectedIndex, setSelectedIndex] =
|
|
66108
|
-
const clientRef =
|
|
66109
|
-
const executeSearch =
|
|
66196
|
+
const [searchInput, setSearchInput] = import_react59.useState("");
|
|
66197
|
+
const [activeQuery, setActiveQuery] = import_react59.useState("");
|
|
66198
|
+
const [searchMode, setSearchMode] = import_react59.useState("hybrid");
|
|
66199
|
+
const [results, setResults] = import_react59.useState([]);
|
|
66200
|
+
const [loading, setLoading] = import_react59.useState(false);
|
|
66201
|
+
const [error, setError] = import_react59.useState(null);
|
|
66202
|
+
const [currentPage, setCurrentPage] = import_react59.useState(0);
|
|
66203
|
+
const [selectedIndex, setSelectedIndex] = import_react59.useState(0);
|
|
66204
|
+
const clientRef = import_react59.useRef(null);
|
|
66205
|
+
const executeSearch = import_react59.useCallback(async (query, mode) => {
|
|
66110
66206
|
if (!query.trim())
|
|
66111
66207
|
return;
|
|
66112
66208
|
setLoading(true);
|
|
@@ -66131,27 +66227,27 @@ function MessageSearch({ onClose }) {
|
|
|
66131
66227
|
setLoading(false);
|
|
66132
66228
|
}
|
|
66133
66229
|
}, []);
|
|
66134
|
-
const submitSearch =
|
|
66230
|
+
const submitSearch = import_react59.useCallback(() => {
|
|
66135
66231
|
if (searchInput.trim() && searchInput !== activeQuery) {
|
|
66136
66232
|
setActiveQuery(searchInput);
|
|
66137
66233
|
executeSearch(searchInput, searchMode);
|
|
66138
66234
|
}
|
|
66139
66235
|
}, [searchInput, activeQuery, searchMode, executeSearch]);
|
|
66140
|
-
const clearSearch =
|
|
66236
|
+
const clearSearch = import_react59.useCallback(() => {
|
|
66141
66237
|
setSearchInput("");
|
|
66142
66238
|
setActiveQuery("");
|
|
66143
66239
|
setResults([]);
|
|
66144
66240
|
setCurrentPage(0);
|
|
66145
66241
|
setSelectedIndex(0);
|
|
66146
66242
|
}, []);
|
|
66147
|
-
const cycleSearchMode =
|
|
66243
|
+
const cycleSearchMode = import_react59.useCallback(() => {
|
|
66148
66244
|
setSearchMode((current) => {
|
|
66149
66245
|
const currentIndex = SEARCH_MODES.indexOf(current);
|
|
66150
66246
|
const nextIndex = (currentIndex + 1) % SEARCH_MODES.length;
|
|
66151
66247
|
return SEARCH_MODES[nextIndex];
|
|
66152
66248
|
});
|
|
66153
66249
|
}, []);
|
|
66154
|
-
|
|
66250
|
+
import_react59.useEffect(() => {
|
|
66155
66251
|
if (activeQuery) {
|
|
66156
66252
|
executeSearch(activeQuery, searchMode);
|
|
66157
66253
|
}
|
|
@@ -66399,7 +66495,7 @@ function MessageSearch({ onClose }) {
|
|
|
66399
66495
|
]
|
|
66400
66496
|
}, undefined, true, undefined, this);
|
|
66401
66497
|
}
|
|
66402
|
-
var
|
|
66498
|
+
var import_react59, jsx_dev_runtime36, DISPLAY_PAGE_SIZE2 = 5, SEARCH_LIMIT = 100, SEARCH_MODES;
|
|
66403
66499
|
var init_MessageSearch = __esm(async () => {
|
|
66404
66500
|
init_useTerminalWidth();
|
|
66405
66501
|
init_colors();
|
|
@@ -66408,7 +66504,7 @@ var init_MessageSearch = __esm(async () => {
|
|
|
66408
66504
|
init_dist4(),
|
|
66409
66505
|
init_client2()
|
|
66410
66506
|
]);
|
|
66411
|
-
|
|
66507
|
+
import_react59 = __toESM(require_react(), 1);
|
|
66412
66508
|
jsx_dev_runtime36 = __toESM(require_jsx_dev_runtime(), 1);
|
|
66413
66509
|
SEARCH_MODES = ["hybrid", "vector", "fts"];
|
|
66414
66510
|
});
|
|
@@ -66420,24 +66516,24 @@ function ModelSelector({
|
|
|
66420
66516
|
onCancel
|
|
66421
66517
|
}) {
|
|
66422
66518
|
const typedModels = models;
|
|
66423
|
-
const [category, setCategory] =
|
|
66424
|
-
const [currentPage, setCurrentPage] =
|
|
66425
|
-
const [selectedIndex, setSelectedIndex] =
|
|
66426
|
-
const [availableHandles, setAvailableHandles] =
|
|
66427
|
-
const [allApiHandles, setAllApiHandles] =
|
|
66428
|
-
const [isLoading, setIsLoading] =
|
|
66429
|
-
const [error, setError] =
|
|
66430
|
-
const [isCached, setIsCached] =
|
|
66431
|
-
const [refreshing, setRefreshing] =
|
|
66432
|
-
const [searchQuery, setSearchQuery] =
|
|
66433
|
-
const mountedRef =
|
|
66434
|
-
|
|
66519
|
+
const [category, setCategory] = import_react60.useState("supported");
|
|
66520
|
+
const [currentPage, setCurrentPage] = import_react60.useState(0);
|
|
66521
|
+
const [selectedIndex, setSelectedIndex] = import_react60.useState(0);
|
|
66522
|
+
const [availableHandles, setAvailableHandles] = import_react60.useState(undefined);
|
|
66523
|
+
const [allApiHandles, setAllApiHandles] = import_react60.useState([]);
|
|
66524
|
+
const [isLoading, setIsLoading] = import_react60.useState(true);
|
|
66525
|
+
const [error, setError] = import_react60.useState(null);
|
|
66526
|
+
const [isCached, setIsCached] = import_react60.useState(false);
|
|
66527
|
+
const [refreshing, setRefreshing] = import_react60.useState(false);
|
|
66528
|
+
const [searchQuery, setSearchQuery] = import_react60.useState("");
|
|
66529
|
+
const mountedRef = import_react60.useRef(true);
|
|
66530
|
+
import_react60.useEffect(() => {
|
|
66435
66531
|
mountedRef.current = true;
|
|
66436
66532
|
return () => {
|
|
66437
66533
|
mountedRef.current = false;
|
|
66438
66534
|
};
|
|
66439
66535
|
}, []);
|
|
66440
|
-
const loadModels =
|
|
66536
|
+
const loadModels = import_react60.useRef(async (forceRefresh = false) => {
|
|
66441
66537
|
try {
|
|
66442
66538
|
if (forceRefresh) {
|
|
66443
66539
|
clearAvailableModelsCache();
|
|
@@ -66465,11 +66561,11 @@ function ModelSelector({
|
|
|
66465
66561
|
setAllApiHandles([]);
|
|
66466
66562
|
}
|
|
66467
66563
|
});
|
|
66468
|
-
|
|
66564
|
+
import_react60.useEffect(() => {
|
|
66469
66565
|
loadModels.current(false);
|
|
66470
66566
|
}, []);
|
|
66471
|
-
const staticModelHandles =
|
|
66472
|
-
const supportedModels =
|
|
66567
|
+
const staticModelHandles = import_react60.useMemo(() => new Set(typedModels.map((m) => m.handle)), [typedModels]);
|
|
66568
|
+
const supportedModels = import_react60.useMemo(() => {
|
|
66473
66569
|
if (availableHandles === undefined)
|
|
66474
66570
|
return [];
|
|
66475
66571
|
const available = availableHandles === null ? typedModels : typedModels.filter((m) => availableHandles.has(m.handle));
|
|
@@ -66477,14 +66573,14 @@ function ModelSelector({
|
|
|
66477
66573
|
const nonFeatured = available.filter((m) => !m.isFeatured);
|
|
66478
66574
|
return [...featured, ...nonFeatured];
|
|
66479
66575
|
}, [typedModels, availableHandles]);
|
|
66480
|
-
const otherModelHandles =
|
|
66576
|
+
const otherModelHandles = import_react60.useMemo(() => {
|
|
66481
66577
|
const filtered = allApiHandles.filter((handle) => !staticModelHandles.has(handle));
|
|
66482
66578
|
if (!searchQuery)
|
|
66483
66579
|
return filtered;
|
|
66484
66580
|
const query = searchQuery.toLowerCase();
|
|
66485
66581
|
return filtered.filter((handle) => handle.toLowerCase().includes(query));
|
|
66486
66582
|
}, [allApiHandles, staticModelHandles, searchQuery]);
|
|
66487
|
-
const currentList =
|
|
66583
|
+
const currentList = import_react60.useMemo(() => {
|
|
66488
66584
|
if (category === "supported") {
|
|
66489
66585
|
return supportedModels;
|
|
66490
66586
|
}
|
|
@@ -66495,12 +66591,12 @@ function ModelSelector({
|
|
|
66495
66591
|
description: ""
|
|
66496
66592
|
}));
|
|
66497
66593
|
}, [category, supportedModels, otherModelHandles]);
|
|
66498
|
-
const totalPages =
|
|
66499
|
-
const visibleModels =
|
|
66594
|
+
const totalPages = import_react60.useMemo(() => Math.max(1, Math.ceil(currentList.length / PAGE_SIZE3)), [currentList.length]);
|
|
66595
|
+
const visibleModels = import_react60.useMemo(() => {
|
|
66500
66596
|
const start = currentPage * PAGE_SIZE3;
|
|
66501
66597
|
return currentList.slice(start, start + PAGE_SIZE3);
|
|
66502
66598
|
}, [currentList, currentPage]);
|
|
66503
|
-
const cycleCategory =
|
|
66599
|
+
const cycleCategory = import_react60.useCallback(() => {
|
|
66504
66600
|
setCategory((current) => {
|
|
66505
66601
|
const idx = MODEL_CATEGORIES.indexOf(current);
|
|
66506
66602
|
return MODEL_CATEGORIES[(idx + 1) % MODEL_CATEGORIES.length];
|
|
@@ -66509,8 +66605,8 @@ function ModelSelector({
|
|
|
66509
66605
|
setSelectedIndex(0);
|
|
66510
66606
|
setSearchQuery("");
|
|
66511
66607
|
}, []);
|
|
66512
|
-
const initializedRef =
|
|
66513
|
-
|
|
66608
|
+
const initializedRef = import_react60.useRef(false);
|
|
66609
|
+
import_react60.useEffect(() => {
|
|
66514
66610
|
if (!initializedRef.current && visibleModels.length > 0) {
|
|
66515
66611
|
const index = visibleModels.findIndex((m) => m.id === currentModelId);
|
|
66516
66612
|
if (index >= 0) {
|
|
@@ -66519,7 +66615,7 @@ function ModelSelector({
|
|
|
66519
66615
|
initializedRef.current = true;
|
|
66520
66616
|
}
|
|
66521
66617
|
}, [visibleModels, currentModelId]);
|
|
66522
|
-
|
|
66618
|
+
import_react60.useEffect(() => {
|
|
66523
66619
|
if (selectedIndex >= visibleModels.length && visibleModels.length > 0) {
|
|
66524
66620
|
setSelectedIndex(visibleModels.length - 1);
|
|
66525
66621
|
}
|
|
@@ -66723,7 +66819,7 @@ function ModelSelector({
|
|
|
66723
66819
|
]
|
|
66724
66820
|
}, undefined, true, undefined, this);
|
|
66725
66821
|
}
|
|
66726
|
-
var
|
|
66822
|
+
var import_react60, jsx_dev_runtime37, PAGE_SIZE3 = 10, MODEL_CATEGORIES;
|
|
66727
66823
|
var init_ModelSelector = __esm(async () => {
|
|
66728
66824
|
init_model();
|
|
66729
66825
|
init_colors();
|
|
@@ -66731,7 +66827,7 @@ var init_ModelSelector = __esm(async () => {
|
|
|
66731
66827
|
init_build2(),
|
|
66732
66828
|
init_available_models()
|
|
66733
66829
|
]);
|
|
66734
|
-
|
|
66830
|
+
import_react60 = __toESM(require_react(), 1);
|
|
66735
66831
|
jsx_dev_runtime37 = __toESM(require_jsx_dev_runtime(), 1);
|
|
66736
66832
|
MODEL_CATEGORIES = ["supported", "all"];
|
|
66737
66833
|
});
|
|
@@ -66761,10 +66857,10 @@ function PinDialog({
|
|
|
66761
66857
|
onCancel
|
|
66762
66858
|
}) {
|
|
66763
66859
|
const isDefault = isDefaultAgentName(currentName);
|
|
66764
|
-
const [mode, setMode] =
|
|
66765
|
-
const [nameInput, setNameInput] =
|
|
66766
|
-
const [selectedOption, setSelectedOption] =
|
|
66767
|
-
const [error, setError] =
|
|
66860
|
+
const [mode, setMode] = import_react61.useState(isDefault ? "input" : "choose");
|
|
66861
|
+
const [nameInput, setNameInput] = import_react61.useState("");
|
|
66862
|
+
const [selectedOption, setSelectedOption] = import_react61.useState(0);
|
|
66863
|
+
const [error, setError] = import_react61.useState("");
|
|
66768
66864
|
const scopeText = local ? "to this project" : "globally";
|
|
66769
66865
|
use_input_default((input, key) => {
|
|
66770
66866
|
if (key.ctrl && input === "c") {
|
|
@@ -66938,7 +67034,7 @@ function PinDialog({
|
|
|
66938
67034
|
]
|
|
66939
67035
|
}, undefined, true, undefined, this);
|
|
66940
67036
|
}
|
|
66941
|
-
var
|
|
67037
|
+
var import_react61, jsx_dev_runtime38;
|
|
66942
67038
|
var init_PinDialog = __esm(async () => {
|
|
66943
67039
|
init_constants();
|
|
66944
67040
|
init_colors();
|
|
@@ -66946,14 +67042,14 @@ var init_PinDialog = __esm(async () => {
|
|
|
66946
67042
|
init_build2(),
|
|
66947
67043
|
init_PasteAwareTextInput()
|
|
66948
67044
|
]);
|
|
66949
|
-
|
|
67045
|
+
import_react61 = __toESM(require_react(), 1);
|
|
66950
67046
|
jsx_dev_runtime38 = __toESM(require_jsx_dev_runtime(), 1);
|
|
66951
67047
|
});
|
|
66952
67048
|
|
|
66953
67049
|
// src/cli/components/NewAgentDialog.tsx
|
|
66954
67050
|
function NewAgentDialog({ onSubmit, onCancel }) {
|
|
66955
|
-
const [nameInput, setNameInput] =
|
|
66956
|
-
const [error, setError] =
|
|
67051
|
+
const [nameInput, setNameInput] = import_react62.useState("");
|
|
67052
|
+
const [error, setError] = import_react62.useState("");
|
|
66957
67053
|
use_input_default((input, key) => {
|
|
66958
67054
|
if (key.ctrl && input === "c") {
|
|
66959
67055
|
onCancel();
|
|
@@ -67040,7 +67136,7 @@ function NewAgentDialog({ onSubmit, onCancel }) {
|
|
|
67040
67136
|
]
|
|
67041
67137
|
}, undefined, true, undefined, this);
|
|
67042
67138
|
}
|
|
67043
|
-
var
|
|
67139
|
+
var import_react62, jsx_dev_runtime39;
|
|
67044
67140
|
var init_NewAgentDialog = __esm(async () => {
|
|
67045
67141
|
init_constants();
|
|
67046
67142
|
init_colors();
|
|
@@ -67049,12 +67145,12 @@ var init_NewAgentDialog = __esm(async () => {
|
|
|
67049
67145
|
init_PasteAwareTextInput(),
|
|
67050
67146
|
init_PinDialog()
|
|
67051
67147
|
]);
|
|
67052
|
-
|
|
67148
|
+
import_react62 = __toESM(require_react(), 1);
|
|
67053
67149
|
jsx_dev_runtime39 = __toESM(require_jsx_dev_runtime(), 1);
|
|
67054
67150
|
});
|
|
67055
67151
|
|
|
67056
67152
|
// src/cli/components/OAuthCodeDialog.tsx
|
|
67057
|
-
var
|
|
67153
|
+
var import_react63, jsx_dev_runtime40, OAuthCodeDialog, WaitForKeyThenClose;
|
|
67058
67154
|
var init_OAuthCodeDialog = __esm(async () => {
|
|
67059
67155
|
init_anthropic_oauth();
|
|
67060
67156
|
init_colors();
|
|
@@ -67064,18 +67160,18 @@ var init_OAuthCodeDialog = __esm(async () => {
|
|
|
67064
67160
|
init_settings_manager(),
|
|
67065
67161
|
init_PasteAwareTextInput()
|
|
67066
67162
|
]);
|
|
67067
|
-
|
|
67163
|
+
import_react63 = __toESM(require_react(), 1);
|
|
67068
67164
|
jsx_dev_runtime40 = __toESM(require_jsx_dev_runtime(), 1);
|
|
67069
|
-
OAuthCodeDialog =
|
|
67070
|
-
const [flowState, setFlowState] =
|
|
67071
|
-
const [authUrl, setAuthUrl] =
|
|
67072
|
-
const [codeInput, setCodeInput] =
|
|
67073
|
-
const [errorMessage, setErrorMessage] =
|
|
67074
|
-
const [codeVerifier, setCodeVerifier] =
|
|
67075
|
-
const [state, setState] =
|
|
67076
|
-
const [availableModels, setAvailableModels] =
|
|
67077
|
-
const [selectedModelIndex, setSelectedModelIndex] =
|
|
67078
|
-
|
|
67165
|
+
OAuthCodeDialog = import_react63.memo(({ onComplete, onCancel, onModelSwitch }) => {
|
|
67166
|
+
const [flowState, setFlowState] = import_react63.useState("initializing");
|
|
67167
|
+
const [authUrl, setAuthUrl] = import_react63.useState("");
|
|
67168
|
+
const [codeInput, setCodeInput] = import_react63.useState("");
|
|
67169
|
+
const [errorMessage, setErrorMessage] = import_react63.useState("");
|
|
67170
|
+
const [codeVerifier, setCodeVerifier] = import_react63.useState("");
|
|
67171
|
+
const [state, setState] = import_react63.useState("");
|
|
67172
|
+
const [availableModels, setAvailableModels] = import_react63.useState([]);
|
|
67173
|
+
const [selectedModelIndex, setSelectedModelIndex] = import_react63.useState(0);
|
|
67174
|
+
import_react63.useEffect(() => {
|
|
67079
67175
|
const initFlow = async () => {
|
|
67080
67176
|
try {
|
|
67081
67177
|
if (settingsManager.hasAnthropicOAuth() && !settingsManager.isAnthropicTokenExpired()) {
|
|
@@ -67404,7 +67500,7 @@ Use /model to switch to a Claude model.`);
|
|
|
67404
67500
|
}, undefined, true, undefined, this);
|
|
67405
67501
|
});
|
|
67406
67502
|
OAuthCodeDialog.displayName = "OAuthCodeDialog";
|
|
67407
|
-
WaitForKeyThenClose =
|
|
67503
|
+
WaitForKeyThenClose = import_react63.memo(({ onClose }) => {
|
|
67408
67504
|
use_input_default(() => {
|
|
67409
67505
|
onClose();
|
|
67410
67506
|
});
|
|
@@ -67414,12 +67510,12 @@ Use /model to switch to a Claude model.`);
|
|
|
67414
67510
|
});
|
|
67415
67511
|
|
|
67416
67512
|
// src/cli/components/PendingApprovalStub.tsx
|
|
67417
|
-
var
|
|
67513
|
+
var import_react64, jsx_dev_runtime41, PendingApprovalStub;
|
|
67418
67514
|
var init_PendingApprovalStub = __esm(async () => {
|
|
67419
67515
|
await init_build2();
|
|
67420
|
-
|
|
67516
|
+
import_react64 = __toESM(require_react(), 1);
|
|
67421
67517
|
jsx_dev_runtime41 = __toESM(require_jsx_dev_runtime(), 1);
|
|
67422
|
-
PendingApprovalStub =
|
|
67518
|
+
PendingApprovalStub = import_react64.memo(({ toolName, description, decision }) => {
|
|
67423
67519
|
if (decision) {
|
|
67424
67520
|
const isApprove = decision.type === "approve";
|
|
67425
67521
|
return /* @__PURE__ */ jsx_dev_runtime41.jsxDEV(Box_default, {
|
|
@@ -67475,7 +67571,7 @@ var init_PendingApprovalStub = __esm(async () => {
|
|
|
67475
67571
|
});
|
|
67476
67572
|
|
|
67477
67573
|
// src/cli/components/ReasoningMessageRich.tsx
|
|
67478
|
-
var
|
|
67574
|
+
var import_react65, jsx_dev_runtime42, normalize5 = (s) => s.replace(/\r\n/g, `
|
|
67479
67575
|
`).replace(/[ \t]+$/gm, "").replace(/\n{3,}/g, `
|
|
67480
67576
|
|
|
67481
67577
|
`).replace(/^\n+|\n+$/g, ""), ReasoningMessage;
|
|
@@ -67485,9 +67581,9 @@ var init_ReasoningMessageRich = __esm(async () => {
|
|
|
67485
67581
|
init_build2(),
|
|
67486
67582
|
init_MarkdownDisplay()
|
|
67487
67583
|
]);
|
|
67488
|
-
|
|
67584
|
+
import_react65 = __toESM(require_react(), 1);
|
|
67489
67585
|
jsx_dev_runtime42 = __toESM(require_jsx_dev_runtime(), 1);
|
|
67490
|
-
ReasoningMessage =
|
|
67586
|
+
ReasoningMessage = import_react65.memo(({ line }) => {
|
|
67491
67587
|
const columns = useTerminalWidth();
|
|
67492
67588
|
const contentWidth = Math.max(0, columns - 2);
|
|
67493
67589
|
const normalizedText = normalize5(line.text);
|
|
@@ -67596,35 +67692,35 @@ function ResumeSelector({
|
|
|
67596
67692
|
onCancel
|
|
67597
67693
|
}) {
|
|
67598
67694
|
const terminalWidth = useTerminalWidth();
|
|
67599
|
-
const clientRef =
|
|
67600
|
-
const [activeTab, setActiveTab] =
|
|
67601
|
-
const [pinnedAgents, setPinnedAgents] =
|
|
67602
|
-
const [pinnedLoading, setPinnedLoading] =
|
|
67603
|
-
const [pinnedSelectedIndex, setPinnedSelectedIndex] =
|
|
67604
|
-
const [pinnedPage, setPinnedPage] =
|
|
67605
|
-
const [lettaCodeAgents, setLettaCodeAgents] =
|
|
67606
|
-
const [lettaCodeCursor, setLettaCodeCursor] =
|
|
67607
|
-
const [lettaCodeLoading, setLettaCodeLoading] =
|
|
67608
|
-
const [lettaCodeLoadingMore, setLettaCodeLoadingMore] =
|
|
67609
|
-
const [lettaCodeHasMore, setLettaCodeHasMore] =
|
|
67610
|
-
const [lettaCodeSelectedIndex, setLettaCodeSelectedIndex] =
|
|
67611
|
-
const [lettaCodePage, setLettaCodePage] =
|
|
67612
|
-
const [lettaCodeError, setLettaCodeError] =
|
|
67613
|
-
const [lettaCodeLoaded, setLettaCodeLoaded] =
|
|
67614
|
-
const [lettaCodeQuery, setLettaCodeQuery] =
|
|
67615
|
-
const [allAgents, setAllAgents] =
|
|
67616
|
-
const [allCursor, setAllCursor] =
|
|
67617
|
-
const [allLoading, setAllLoading] =
|
|
67618
|
-
const [allLoadingMore, setAllLoadingMore] =
|
|
67619
|
-
const [allHasMore, setAllHasMore] =
|
|
67620
|
-
const [allSelectedIndex, setAllSelectedIndex] =
|
|
67621
|
-
const [allPage, setAllPage] =
|
|
67622
|
-
const [allError, setAllError] =
|
|
67623
|
-
const [allLoaded, setAllLoaded] =
|
|
67624
|
-
const [allQuery, setAllQuery] =
|
|
67625
|
-
const [searchInput, setSearchInput] =
|
|
67626
|
-
const [activeQuery, setActiveQuery] =
|
|
67627
|
-
const loadPinnedAgents =
|
|
67695
|
+
const clientRef = import_react66.useRef(null);
|
|
67696
|
+
const [activeTab, setActiveTab] = import_react66.useState("pinned");
|
|
67697
|
+
const [pinnedAgents, setPinnedAgents] = import_react66.useState([]);
|
|
67698
|
+
const [pinnedLoading, setPinnedLoading] = import_react66.useState(true);
|
|
67699
|
+
const [pinnedSelectedIndex, setPinnedSelectedIndex] = import_react66.useState(0);
|
|
67700
|
+
const [pinnedPage, setPinnedPage] = import_react66.useState(0);
|
|
67701
|
+
const [lettaCodeAgents, setLettaCodeAgents] = import_react66.useState([]);
|
|
67702
|
+
const [lettaCodeCursor, setLettaCodeCursor] = import_react66.useState(null);
|
|
67703
|
+
const [lettaCodeLoading, setLettaCodeLoading] = import_react66.useState(false);
|
|
67704
|
+
const [lettaCodeLoadingMore, setLettaCodeLoadingMore] = import_react66.useState(false);
|
|
67705
|
+
const [lettaCodeHasMore, setLettaCodeHasMore] = import_react66.useState(true);
|
|
67706
|
+
const [lettaCodeSelectedIndex, setLettaCodeSelectedIndex] = import_react66.useState(0);
|
|
67707
|
+
const [lettaCodePage, setLettaCodePage] = import_react66.useState(0);
|
|
67708
|
+
const [lettaCodeError, setLettaCodeError] = import_react66.useState(null);
|
|
67709
|
+
const [lettaCodeLoaded, setLettaCodeLoaded] = import_react66.useState(false);
|
|
67710
|
+
const [lettaCodeQuery, setLettaCodeQuery] = import_react66.useState("");
|
|
67711
|
+
const [allAgents, setAllAgents] = import_react66.useState([]);
|
|
67712
|
+
const [allCursor, setAllCursor] = import_react66.useState(null);
|
|
67713
|
+
const [allLoading, setAllLoading] = import_react66.useState(false);
|
|
67714
|
+
const [allLoadingMore, setAllLoadingMore] = import_react66.useState(false);
|
|
67715
|
+
const [allHasMore, setAllHasMore] = import_react66.useState(true);
|
|
67716
|
+
const [allSelectedIndex, setAllSelectedIndex] = import_react66.useState(0);
|
|
67717
|
+
const [allPage, setAllPage] = import_react66.useState(0);
|
|
67718
|
+
const [allError, setAllError] = import_react66.useState(null);
|
|
67719
|
+
const [allLoaded, setAllLoaded] = import_react66.useState(false);
|
|
67720
|
+
const [allQuery, setAllQuery] = import_react66.useState("");
|
|
67721
|
+
const [searchInput, setSearchInput] = import_react66.useState("");
|
|
67722
|
+
const [activeQuery, setActiveQuery] = import_react66.useState("");
|
|
67723
|
+
const loadPinnedAgents = import_react66.useCallback(async () => {
|
|
67628
67724
|
setPinnedLoading(true);
|
|
67629
67725
|
try {
|
|
67630
67726
|
const mergedPinned = settingsManager.getMergedPinnedAgents();
|
|
@@ -67652,7 +67748,7 @@ function ResumeSelector({
|
|
|
67652
67748
|
setPinnedLoading(false);
|
|
67653
67749
|
}
|
|
67654
67750
|
}, []);
|
|
67655
|
-
const fetchListAgents =
|
|
67751
|
+
const fetchListAgents = import_react66.useCallback(async (filterLettaCode, afterCursor, query) => {
|
|
67656
67752
|
const client = clientRef.current || await getClient2();
|
|
67657
67753
|
clientRef.current = client;
|
|
67658
67754
|
const agentList = await client.agents.list({
|
|
@@ -67667,7 +67763,7 @@ function ResumeSelector({
|
|
|
67667
67763
|
const cursor = agentList.items.length === FETCH_PAGE_SIZE ? agentList.items[agentList.items.length - 1]?.id ?? null : null;
|
|
67668
67764
|
return { agents: agentList.items, nextCursor: cursor };
|
|
67669
67765
|
}, []);
|
|
67670
|
-
const loadLettaCodeAgents =
|
|
67766
|
+
const loadLettaCodeAgents = import_react66.useCallback(async (query) => {
|
|
67671
67767
|
setLettaCodeLoading(true);
|
|
67672
67768
|
setLettaCodeError(null);
|
|
67673
67769
|
try {
|
|
@@ -67685,7 +67781,7 @@ function ResumeSelector({
|
|
|
67685
67781
|
setLettaCodeLoading(false);
|
|
67686
67782
|
}
|
|
67687
67783
|
}, [fetchListAgents]);
|
|
67688
|
-
const loadAllAgents =
|
|
67784
|
+
const loadAllAgents = import_react66.useCallback(async (query) => {
|
|
67689
67785
|
setAllLoading(true);
|
|
67690
67786
|
setAllError(null);
|
|
67691
67787
|
try {
|
|
@@ -67703,10 +67799,10 @@ function ResumeSelector({
|
|
|
67703
67799
|
setAllLoading(false);
|
|
67704
67800
|
}
|
|
67705
67801
|
}, [fetchListAgents]);
|
|
67706
|
-
|
|
67802
|
+
import_react66.useEffect(() => {
|
|
67707
67803
|
loadPinnedAgents();
|
|
67708
67804
|
}, [loadPinnedAgents]);
|
|
67709
|
-
|
|
67805
|
+
import_react66.useEffect(() => {
|
|
67710
67806
|
if (activeTab === "letta-code" && !lettaCodeLoaded && !lettaCodeLoading) {
|
|
67711
67807
|
loadLettaCodeAgents();
|
|
67712
67808
|
} else if (activeTab === "all" && !allLoaded && !allLoading) {
|
|
@@ -67721,7 +67817,7 @@ function ResumeSelector({
|
|
|
67721
67817
|
allLoading,
|
|
67722
67818
|
loadAllAgents
|
|
67723
67819
|
]);
|
|
67724
|
-
|
|
67820
|
+
import_react66.useEffect(() => {
|
|
67725
67821
|
if (activeTab === "letta-code" && activeQuery !== lettaCodeQuery) {
|
|
67726
67822
|
loadLettaCodeAgents(activeQuery || undefined);
|
|
67727
67823
|
} else if (activeTab === "all" && activeQuery !== allQuery) {
|
|
@@ -67735,7 +67831,7 @@ function ResumeSelector({
|
|
|
67735
67831
|
loadLettaCodeAgents,
|
|
67736
67832
|
loadAllAgents
|
|
67737
67833
|
]);
|
|
67738
|
-
const fetchMoreLettaCodeAgents =
|
|
67834
|
+
const fetchMoreLettaCodeAgents = import_react66.useCallback(async () => {
|
|
67739
67835
|
if (lettaCodeLoadingMore || !lettaCodeHasMore || !lettaCodeCursor)
|
|
67740
67836
|
return;
|
|
67741
67837
|
setLettaCodeLoadingMore(true);
|
|
@@ -67754,7 +67850,7 @@ function ResumeSelector({
|
|
|
67754
67850
|
fetchListAgents,
|
|
67755
67851
|
activeQuery
|
|
67756
67852
|
]);
|
|
67757
|
-
const fetchMoreAllAgents =
|
|
67853
|
+
const fetchMoreAllAgents = import_react66.useCallback(async () => {
|
|
67758
67854
|
if (allLoadingMore || !allHasMore || !allCursor)
|
|
67759
67855
|
return;
|
|
67760
67856
|
setAllLoadingMore(true);
|
|
@@ -67782,12 +67878,12 @@ function ResumeSelector({
|
|
|
67782
67878
|
const currentError = activeTab === "letta-code" ? lettaCodeError : activeTab === "all" ? allError : null;
|
|
67783
67879
|
const currentAgents = activeTab === "pinned" ? pinnedPageAgents.map((p) => p.agent).filter(Boolean) : activeTab === "letta-code" ? lettaCodePageAgents : allPageAgents;
|
|
67784
67880
|
const setCurrentSelectedIndex = activeTab === "pinned" ? setPinnedSelectedIndex : activeTab === "letta-code" ? setLettaCodeSelectedIndex : setAllSelectedIndex;
|
|
67785
|
-
const submitSearch =
|
|
67881
|
+
const submitSearch = import_react66.useCallback(() => {
|
|
67786
67882
|
if (searchInput !== activeQuery) {
|
|
67787
67883
|
setActiveQuery(searchInput);
|
|
67788
67884
|
}
|
|
67789
67885
|
}, [searchInput, activeQuery]);
|
|
67790
|
-
const clearSearch =
|
|
67886
|
+
const clearSearch = import_react66.useCallback(() => {
|
|
67791
67887
|
setSearchInput("");
|
|
67792
67888
|
if (activeQuery) {
|
|
67793
67889
|
setActiveQuery("");
|
|
@@ -68152,7 +68248,7 @@ function ResumeSelector({
|
|
|
68152
68248
|
]
|
|
68153
68249
|
}, undefined, true, undefined, this);
|
|
68154
68250
|
}
|
|
68155
|
-
var
|
|
68251
|
+
var import_react66, jsx_dev_runtime43, TABS, TAB_DESCRIPTIONS, TAB_EMPTY_STATES, DISPLAY_PAGE_SIZE3 = 5, FETCH_PAGE_SIZE = 20;
|
|
68156
68252
|
var init_ResumeSelector = __esm(async () => {
|
|
68157
68253
|
init_model();
|
|
68158
68254
|
init_useTerminalWidth();
|
|
@@ -68162,7 +68258,7 @@ var init_ResumeSelector = __esm(async () => {
|
|
|
68162
68258
|
init_client2(),
|
|
68163
68259
|
init_settings_manager()
|
|
68164
68260
|
]);
|
|
68165
|
-
|
|
68261
|
+
import_react66 = __toESM(require_react(), 1);
|
|
68166
68262
|
jsx_dev_runtime43 = __toESM(require_jsx_dev_runtime(), 1);
|
|
68167
68263
|
TABS = [
|
|
68168
68264
|
{ id: "pinned", label: "Pinned" },
|
|
@@ -68182,7 +68278,7 @@ var init_ResumeSelector = __esm(async () => {
|
|
|
68182
68278
|
});
|
|
68183
68279
|
|
|
68184
68280
|
// src/cli/components/SessionStats.tsx
|
|
68185
|
-
function
|
|
68281
|
+
function formatDuration2(ms) {
|
|
68186
68282
|
if (ms < 1000) {
|
|
68187
68283
|
return `${Math.round(ms)}ms`;
|
|
68188
68284
|
}
|
|
@@ -68206,8 +68302,8 @@ function formatUsageStats({
|
|
|
68206
68302
|
balance
|
|
68207
68303
|
}) {
|
|
68208
68304
|
const outputLines = [
|
|
68209
|
-
`Total duration (API): ${
|
|
68210
|
-
`Total duration (wall): ${
|
|
68305
|
+
`Total duration (API): ${formatDuration2(stats.totalApiMs)}`,
|
|
68306
|
+
`Total duration (wall): ${formatDuration2(stats.totalWallMs)}`,
|
|
68211
68307
|
`Session usage: ${stats.usage.stepCount} steps, ${formatCompact(stats.usage.promptTokens)} input, ${formatCompact(stats.usage.completionTokens)} output`,
|
|
68212
68308
|
""
|
|
68213
68309
|
];
|
|
@@ -68224,21 +68320,22 @@ function formatUsageStats({
|
|
|
68224
68320
|
var init_SessionStats = () => {};
|
|
68225
68321
|
|
|
68226
68322
|
// src/cli/components/StaticPlanApproval.tsx
|
|
68227
|
-
var
|
|
68323
|
+
var import_react67, jsx_dev_runtime44, StaticPlanApproval;
|
|
68228
68324
|
var init_StaticPlanApproval = __esm(async () => {
|
|
68325
|
+
init_useProgressIndicator();
|
|
68229
68326
|
init_useTerminalWidth();
|
|
68230
68327
|
init_useTextInputCursor();
|
|
68231
68328
|
init_colors();
|
|
68232
68329
|
await init_build2();
|
|
68233
|
-
|
|
68330
|
+
import_react67 = __toESM(require_react(), 1);
|
|
68234
68331
|
jsx_dev_runtime44 = __toESM(require_jsx_dev_runtime(), 1);
|
|
68235
|
-
StaticPlanApproval =
|
|
68332
|
+
StaticPlanApproval = import_react67.memo(({
|
|
68236
68333
|
onApprove,
|
|
68237
68334
|
onApproveAndAcceptEdits,
|
|
68238
68335
|
onKeepPlanning,
|
|
68239
68336
|
isFocused = true
|
|
68240
68337
|
}) => {
|
|
68241
|
-
const [selectedOption, setSelectedOption] =
|
|
68338
|
+
const [selectedOption, setSelectedOption] = import_react67.useState(0);
|
|
68242
68339
|
const {
|
|
68243
68340
|
text: customReason,
|
|
68244
68341
|
cursorPos,
|
|
@@ -68246,6 +68343,7 @@ var init_StaticPlanApproval = __esm(async () => {
|
|
|
68246
68343
|
clear
|
|
68247
68344
|
} = useTextInputCursor();
|
|
68248
68345
|
const columns = useTerminalWidth();
|
|
68346
|
+
useProgressIndicator();
|
|
68249
68347
|
const customOptionIndex = 2;
|
|
68250
68348
|
const maxOptionIndex = customOptionIndex;
|
|
68251
68349
|
const isOnCustomOption = selectedOption === customOptionIndex;
|
|
@@ -68425,14 +68523,14 @@ function renderColoredText(text) {
|
|
|
68425
68523
|
}, i, false, undefined, this);
|
|
68426
68524
|
});
|
|
68427
68525
|
}
|
|
68428
|
-
var
|
|
68526
|
+
var import_react68, jsx_dev_runtime45, StatusMessage;
|
|
68429
68527
|
var init_StatusMessage = __esm(async () => {
|
|
68430
68528
|
init_useTerminalWidth();
|
|
68431
68529
|
init_colors();
|
|
68432
68530
|
await init_build2();
|
|
68433
|
-
|
|
68531
|
+
import_react68 = __toESM(require_react(), 1);
|
|
68434
68532
|
jsx_dev_runtime45 = __toESM(require_jsx_dev_runtime(), 1);
|
|
68435
|
-
StatusMessage =
|
|
68533
|
+
StatusMessage = import_react68.memo(({ line }) => {
|
|
68436
68534
|
const columns = useTerminalWidth();
|
|
68437
68535
|
const contentWidth = Math.max(0, columns - 2);
|
|
68438
68536
|
return /* @__PURE__ */ jsx_dev_runtime45.jsxDEV(Box_default, {
|
|
@@ -68497,7 +68595,7 @@ function formatToolArgs(argsStr) {
|
|
|
68497
68595
|
return "";
|
|
68498
68596
|
}
|
|
68499
68597
|
}
|
|
68500
|
-
var
|
|
68598
|
+
var import_react69, jsx_dev_runtime46, AgentRow, GroupHeader, SubagentGroupDisplay;
|
|
68501
68599
|
var init_SubagentGroupDisplay = __esm(async () => {
|
|
68502
68600
|
init_subagentState();
|
|
68503
68601
|
init_useTerminalWidth();
|
|
@@ -68506,9 +68604,9 @@ var init_SubagentGroupDisplay = __esm(async () => {
|
|
|
68506
68604
|
init_build2(),
|
|
68507
68605
|
init_BlinkDot()
|
|
68508
68606
|
]);
|
|
68509
|
-
|
|
68607
|
+
import_react69 = __toESM(require_react(), 1);
|
|
68510
68608
|
jsx_dev_runtime46 = __toESM(require_jsx_dev_runtime(), 1);
|
|
68511
|
-
AgentRow =
|
|
68609
|
+
AgentRow = import_react69.memo(({ agent, isLast, expanded }) => {
|
|
68512
68610
|
const { treeChar, continueChar } = getTreeChars(isLast);
|
|
68513
68611
|
const columns = useTerminalWidth();
|
|
68514
68612
|
const gutterWidth = 7;
|
|
@@ -68696,7 +68794,7 @@ var init_SubagentGroupDisplay = __esm(async () => {
|
|
|
68696
68794
|
}, undefined, true, undefined, this);
|
|
68697
68795
|
});
|
|
68698
68796
|
AgentRow.displayName = "AgentRow";
|
|
68699
|
-
GroupHeader =
|
|
68797
|
+
GroupHeader = import_react69.memo(({ count, allCompleted, hasErrors, expanded }) => {
|
|
68700
68798
|
const statusText = allCompleted ? `Ran ${count} subagent${count !== 1 ? "s" : ""}` : `Running ${count} subagent${count !== 1 ? "s" : ""}…`;
|
|
68701
68799
|
const hint = expanded ? "(ctrl+o to collapse)" : "(ctrl+o to expand)";
|
|
68702
68800
|
const dotColor = hasErrors ? colors.subagent.error : colors.subagent.completed;
|
|
@@ -68725,8 +68823,8 @@ var init_SubagentGroupDisplay = __esm(async () => {
|
|
|
68725
68823
|
}, undefined, true, undefined, this);
|
|
68726
68824
|
});
|
|
68727
68825
|
GroupHeader.displayName = "GroupHeader";
|
|
68728
|
-
SubagentGroupDisplay =
|
|
68729
|
-
const { agents, expanded } =
|
|
68826
|
+
SubagentGroupDisplay = import_react69.memo(() => {
|
|
68827
|
+
const { agents, expanded } = import_react69.useSyncExternalStore(subscribe, getSnapshot);
|
|
68730
68828
|
use_input_default((input, key) => {
|
|
68731
68829
|
if (key.ctrl && input === "o") {
|
|
68732
68830
|
toggleExpanded();
|
|
@@ -68758,14 +68856,14 @@ var init_SubagentGroupDisplay = __esm(async () => {
|
|
|
68758
68856
|
});
|
|
68759
68857
|
|
|
68760
68858
|
// src/cli/components/SubagentGroupStatic.tsx
|
|
68761
|
-
var
|
|
68859
|
+
var import_react70, jsx_dev_runtime47, AgentRow2, SubagentGroupStatic;
|
|
68762
68860
|
var init_SubagentGroupStatic = __esm(async () => {
|
|
68763
68861
|
init_useTerminalWidth();
|
|
68764
68862
|
init_colors();
|
|
68765
68863
|
await init_build2();
|
|
68766
|
-
|
|
68864
|
+
import_react70 = __toESM(require_react(), 1);
|
|
68767
68865
|
jsx_dev_runtime47 = __toESM(require_jsx_dev_runtime(), 1);
|
|
68768
|
-
AgentRow2 =
|
|
68866
|
+
AgentRow2 = import_react70.memo(({ agent, isLast }) => {
|
|
68769
68867
|
const { treeChar, continueChar } = getTreeChars(isLast);
|
|
68770
68868
|
const columns = useTerminalWidth();
|
|
68771
68869
|
const gutterWidth = 7;
|
|
@@ -68882,7 +68980,7 @@ var init_SubagentGroupStatic = __esm(async () => {
|
|
|
68882
68980
|
}, undefined, true, undefined, this);
|
|
68883
68981
|
});
|
|
68884
68982
|
AgentRow2.displayName = "AgentRow";
|
|
68885
|
-
SubagentGroupStatic =
|
|
68983
|
+
SubagentGroupStatic = import_react70.memo(({ agents }) => {
|
|
68886
68984
|
if (agents.length === 0) {
|
|
68887
68985
|
return null;
|
|
68888
68986
|
}
|
|
@@ -68920,11 +69018,11 @@ var init_SubagentGroupStatic = __esm(async () => {
|
|
|
68920
69018
|
|
|
68921
69019
|
// src/cli/components/SubagentManager.tsx
|
|
68922
69020
|
function SubagentManager({ onClose }) {
|
|
68923
|
-
const [builtinSubagents, setBuiltinSubagents] =
|
|
68924
|
-
const [customSubagents, setCustomSubagents] =
|
|
68925
|
-
const [loading, setLoading] =
|
|
68926
|
-
const [error, setError] =
|
|
68927
|
-
|
|
69021
|
+
const [builtinSubagents, setBuiltinSubagents] = import_react71.useState([]);
|
|
69022
|
+
const [customSubagents, setCustomSubagents] = import_react71.useState([]);
|
|
69023
|
+
const [loading, setLoading] = import_react71.useState(true);
|
|
69024
|
+
const [error, setError] = import_react71.useState(null);
|
|
69025
|
+
import_react71.useEffect(() => {
|
|
68928
69026
|
async function loadSubagents() {
|
|
68929
69027
|
setLoading(true);
|
|
68930
69028
|
setError(null);
|
|
@@ -69065,12 +69163,12 @@ function SubagentManager({ onClose }) {
|
|
|
69065
69163
|
]
|
|
69066
69164
|
}, undefined, true, undefined, this);
|
|
69067
69165
|
}
|
|
69068
|
-
var
|
|
69166
|
+
var import_react71, jsx_dev_runtime48;
|
|
69069
69167
|
var init_SubagentManager = __esm(async () => {
|
|
69070
69168
|
init_subagents();
|
|
69071
69169
|
init_colors();
|
|
69072
69170
|
await init_build2();
|
|
69073
|
-
|
|
69171
|
+
import_react71 = __toESM(require_react(), 1);
|
|
69074
69172
|
jsx_dev_runtime48 = __toESM(require_jsx_dev_runtime(), 1);
|
|
69075
69173
|
});
|
|
69076
69174
|
|
|
@@ -69080,10 +69178,10 @@ function SystemPromptSelector({
|
|
|
69080
69178
|
onSelect,
|
|
69081
69179
|
onCancel
|
|
69082
69180
|
}) {
|
|
69083
|
-
const [showAll, setShowAll] =
|
|
69084
|
-
const [selectedIndex, setSelectedIndex] =
|
|
69085
|
-
const featuredPrompts =
|
|
69086
|
-
const visiblePrompts =
|
|
69181
|
+
const [showAll, setShowAll] = import_react72.useState(false);
|
|
69182
|
+
const [selectedIndex, setSelectedIndex] = import_react72.useState(0);
|
|
69183
|
+
const featuredPrompts = import_react72.useMemo(() => SYSTEM_PROMPTS.filter((prompt) => prompt.isFeatured), []);
|
|
69184
|
+
const visiblePrompts = import_react72.useMemo(() => {
|
|
69087
69185
|
if (showAll)
|
|
69088
69186
|
return SYSTEM_PROMPTS;
|
|
69089
69187
|
if (featuredPrompts.length > 0)
|
|
@@ -69186,12 +69284,12 @@ function SystemPromptSelector({
|
|
|
69186
69284
|
]
|
|
69187
69285
|
}, undefined, true, undefined, this);
|
|
69188
69286
|
}
|
|
69189
|
-
var
|
|
69287
|
+
var import_react72, jsx_dev_runtime49;
|
|
69190
69288
|
var init_SystemPromptSelector = __esm(async () => {
|
|
69191
69289
|
init_promptAssets();
|
|
69192
69290
|
init_colors();
|
|
69193
69291
|
await init_build2();
|
|
69194
|
-
|
|
69292
|
+
import_react72 = __toESM(require_react(), 1);
|
|
69195
69293
|
jsx_dev_runtime49 = __toESM(require_jsx_dev_runtime(), 1);
|
|
69196
69294
|
});
|
|
69197
69295
|
|
|
@@ -70081,7 +70179,7 @@ var init_TodoRenderer = __esm(async () => {
|
|
|
70081
70179
|
function isQuestionTool(name) {
|
|
70082
70180
|
return name === "AskUserQuestion";
|
|
70083
70181
|
}
|
|
70084
|
-
var
|
|
70182
|
+
var import_react73, jsx_dev_runtime53, ToolCallMessage;
|
|
70085
70183
|
var init_ToolCallMessageRich = __esm(async () => {
|
|
70086
70184
|
init_constants();
|
|
70087
70185
|
init_formatArgsDisplay();
|
|
@@ -70098,9 +70196,9 @@ var init_ToolCallMessageRich = __esm(async () => {
|
|
|
70098
70196
|
init_PlanRenderer(),
|
|
70099
70197
|
init_TodoRenderer()
|
|
70100
70198
|
]);
|
|
70101
|
-
|
|
70199
|
+
import_react73 = __toESM(require_react(), 1);
|
|
70102
70200
|
jsx_dev_runtime53 = __toESM(require_jsx_dev_runtime(), 1);
|
|
70103
|
-
ToolCallMessage =
|
|
70201
|
+
ToolCallMessage = import_react73.memo(({
|
|
70104
70202
|
line,
|
|
70105
70203
|
precomputedDiffs,
|
|
70106
70204
|
lastPlanFilePath
|
|
@@ -70604,10 +70702,10 @@ function ToolsetSelector({
|
|
|
70604
70702
|
onSelect,
|
|
70605
70703
|
onCancel
|
|
70606
70704
|
}) {
|
|
70607
|
-
const [showAll, setShowAll] =
|
|
70608
|
-
const [selectedIndex, setSelectedIndex] =
|
|
70609
|
-
const featuredToolsets =
|
|
70610
|
-
const visibleToolsets =
|
|
70705
|
+
const [showAll, setShowAll] = import_react74.useState(false);
|
|
70706
|
+
const [selectedIndex, setSelectedIndex] = import_react74.useState(0);
|
|
70707
|
+
const featuredToolsets = import_react74.useMemo(() => toolsets.filter((toolset) => toolset.isFeatured), []);
|
|
70708
|
+
const visibleToolsets = import_react74.useMemo(() => {
|
|
70611
70709
|
if (showAll)
|
|
70612
70710
|
return toolsets;
|
|
70613
70711
|
if (featuredToolsets.length > 0)
|
|
@@ -70719,11 +70817,11 @@ function ToolsetSelector({
|
|
|
70719
70817
|
]
|
|
70720
70818
|
}, undefined, true, undefined, this);
|
|
70721
70819
|
}
|
|
70722
|
-
var
|
|
70820
|
+
var import_react74, jsx_dev_runtime54, toolsets;
|
|
70723
70821
|
var init_ToolsetSelector = __esm(async () => {
|
|
70724
70822
|
init_colors();
|
|
70725
70823
|
await init_build2();
|
|
70726
|
-
|
|
70824
|
+
import_react74 = __toESM(require_react(), 1);
|
|
70727
70825
|
jsx_dev_runtime54 = __toESM(require_jsx_dev_runtime(), 1);
|
|
70728
70826
|
toolsets = [
|
|
70729
70827
|
{
|
|
@@ -70817,16 +70915,16 @@ var init_ToolsetSelector = __esm(async () => {
|
|
|
70817
70915
|
});
|
|
70818
70916
|
|
|
70819
70917
|
// src/cli/components/UserMessageRich.tsx
|
|
70820
|
-
var
|
|
70918
|
+
var import_react75, jsx_dev_runtime55, UserMessage;
|
|
70821
70919
|
var init_UserMessageRich = __esm(async () => {
|
|
70822
70920
|
init_useTerminalWidth();
|
|
70823
70921
|
await __promiseAll([
|
|
70824
70922
|
init_build2(),
|
|
70825
70923
|
init_MarkdownDisplay()
|
|
70826
70924
|
]);
|
|
70827
|
-
|
|
70925
|
+
import_react75 = __toESM(require_react(), 1);
|
|
70828
70926
|
jsx_dev_runtime55 = __toESM(require_jsx_dev_runtime(), 1);
|
|
70829
|
-
UserMessage =
|
|
70927
|
+
UserMessage = import_react75.memo(({ line }) => {
|
|
70830
70928
|
const columns = useTerminalWidth();
|
|
70831
70929
|
const contentWidth = Math.max(0, columns - 2);
|
|
70832
70930
|
return /* @__PURE__ */ jsx_dev_runtime55.jsxDEV(Box_default, {
|
|
@@ -71219,8 +71317,8 @@ var init_thinkingMessages = __esm(() => {
|
|
|
71219
71317
|
// src/cli/hooks/useSuspend/useSuspend.ts
|
|
71220
71318
|
function useSuspend() {
|
|
71221
71319
|
const { stdin: stdin2, isRawModeSupported } = use_stdin_default();
|
|
71222
|
-
const [resumeKey, setResumeKey] =
|
|
71223
|
-
const forceUpdate =
|
|
71320
|
+
const [resumeKey, setResumeKey] = import_react76.useState(0);
|
|
71321
|
+
const forceUpdate = import_react76.useCallback(() => {
|
|
71224
71322
|
setResumeKey((prev) => prev + 1);
|
|
71225
71323
|
}, []);
|
|
71226
71324
|
use_input_default((input, key) => {
|
|
@@ -71232,7 +71330,7 @@ function useSuspend() {
|
|
|
71232
71330
|
return;
|
|
71233
71331
|
}
|
|
71234
71332
|
});
|
|
71235
|
-
|
|
71333
|
+
import_react76.useEffect(() => {
|
|
71236
71334
|
const handleResume = () => {
|
|
71237
71335
|
if (stdin2 && isRawModeSupported && stdin2.setRawMode) {
|
|
71238
71336
|
stdin2.setRawMode(true);
|
|
@@ -71247,25 +71345,25 @@ function useSuspend() {
|
|
|
71247
71345
|
}, [stdin2, isRawModeSupported, forceUpdate]);
|
|
71248
71346
|
return resumeKey;
|
|
71249
71347
|
}
|
|
71250
|
-
var
|
|
71348
|
+
var import_react76;
|
|
71251
71349
|
var init_useSuspend = __esm(async () => {
|
|
71252
71350
|
await init_build2();
|
|
71253
|
-
|
|
71351
|
+
import_react76 = __toESM(require_react(), 1);
|
|
71254
71352
|
});
|
|
71255
71353
|
|
|
71256
71354
|
// src/cli/hooks/useSyncedState.ts
|
|
71257
71355
|
function useSyncedState(initialValue) {
|
|
71258
|
-
const [state, setState] =
|
|
71259
|
-
const ref =
|
|
71260
|
-
const setSyncedState =
|
|
71356
|
+
const [state, setState] = import_react77.useState(initialValue);
|
|
71357
|
+
const ref = import_react77.useRef(initialValue);
|
|
71358
|
+
const setSyncedState = import_react77.useCallback((value) => {
|
|
71261
71359
|
ref.current = value;
|
|
71262
71360
|
setState(value);
|
|
71263
71361
|
}, []);
|
|
71264
71362
|
return [state, setSyncedState, ref];
|
|
71265
71363
|
}
|
|
71266
|
-
var
|
|
71364
|
+
var import_react77;
|
|
71267
71365
|
var init_useSyncedState = __esm(() => {
|
|
71268
|
-
|
|
71366
|
+
import_react77 = __toESM(require_react(), 1);
|
|
71269
71367
|
});
|
|
71270
71368
|
|
|
71271
71369
|
// src/cli/commands/connect.ts
|
|
@@ -71840,54 +71938,58 @@ function App2({
|
|
|
71840
71938
|
tokenStreaming = false,
|
|
71841
71939
|
agentProvenance = null
|
|
71842
71940
|
}) {
|
|
71843
|
-
|
|
71941
|
+
import_react78.useEffect(() => {
|
|
71844
71942
|
prefetchAvailableModelHandles();
|
|
71845
71943
|
}, []);
|
|
71846
|
-
const [agentId, setAgentId] =
|
|
71847
|
-
const [agentState, setAgentState] =
|
|
71848
|
-
const agentIdRef =
|
|
71849
|
-
|
|
71944
|
+
const [agentId, setAgentId] = import_react78.useState(initialAgentId);
|
|
71945
|
+
const [agentState, setAgentState] = import_react78.useState(initialAgentState);
|
|
71946
|
+
const agentIdRef = import_react78.useRef(agentId);
|
|
71947
|
+
import_react78.useEffect(() => {
|
|
71850
71948
|
agentIdRef.current = agentId;
|
|
71851
71949
|
telemetry2.setCurrentAgentId(agentId);
|
|
71852
71950
|
}, [agentId]);
|
|
71853
71951
|
const resumeKey = useSuspend();
|
|
71854
|
-
const prevInitialAgentIdRef =
|
|
71855
|
-
const prevInitialAgentStateRef =
|
|
71856
|
-
|
|
71952
|
+
const prevInitialAgentIdRef = import_react78.useRef(initialAgentId);
|
|
71953
|
+
const prevInitialAgentStateRef = import_react78.useRef(initialAgentState);
|
|
71954
|
+
import_react78.useEffect(() => {
|
|
71857
71955
|
if (initialAgentId !== prevInitialAgentIdRef.current) {
|
|
71858
71956
|
prevInitialAgentIdRef.current = initialAgentId;
|
|
71859
71957
|
agentIdRef.current = initialAgentId;
|
|
71860
71958
|
setAgentId(initialAgentId);
|
|
71861
71959
|
}
|
|
71862
71960
|
}, [initialAgentId]);
|
|
71863
|
-
|
|
71961
|
+
import_react78.useEffect(() => {
|
|
71864
71962
|
if (initialAgentState !== prevInitialAgentStateRef.current) {
|
|
71865
71963
|
prevInitialAgentStateRef.current = initialAgentState;
|
|
71866
71964
|
setAgentState(initialAgentState);
|
|
71867
71965
|
}
|
|
71868
71966
|
}, [initialAgentState]);
|
|
71869
|
-
|
|
71967
|
+
import_react78.useEffect(() => {
|
|
71870
71968
|
if (agentId) {
|
|
71871
71969
|
setCurrentAgentId(agentId);
|
|
71872
71970
|
}
|
|
71873
71971
|
}, [agentId]);
|
|
71972
|
+
import_react78.useEffect(() => {
|
|
71973
|
+
const title = agentState?.name ? `${agentState.name} | Letta Code` : "Letta Code";
|
|
71974
|
+
process.stdout.write(`\x1B]0;${title}\x07`);
|
|
71975
|
+
}, [agentState?.name]);
|
|
71874
71976
|
const [streaming, setStreaming, streamingRef] = useSyncedState(false);
|
|
71875
|
-
const processingConversationRef =
|
|
71876
|
-
const conversationGenerationRef =
|
|
71877
|
-
const [interruptRequested, setInterruptRequested] =
|
|
71977
|
+
const processingConversationRef = import_react78.useRef(0);
|
|
71978
|
+
const conversationGenerationRef = import_react78.useRef(0);
|
|
71979
|
+
const [interruptRequested, setInterruptRequested] = import_react78.useState(false);
|
|
71878
71980
|
const [commandRunning, setCommandRunning, commandRunningRef] = useSyncedState(false);
|
|
71879
|
-
const [profileConfirmPending, setProfileConfirmPending] =
|
|
71880
|
-
const [pendingApprovals, setPendingApprovals] =
|
|
71881
|
-
const [approvalContexts, setApprovalContexts] =
|
|
71882
|
-
const [approvalResults, setApprovalResults] =
|
|
71883
|
-
const [isExecutingTool, setIsExecutingTool] =
|
|
71884
|
-
const [queuedApprovalResults, setQueuedApprovalResults] =
|
|
71885
|
-
const toolAbortControllerRef =
|
|
71886
|
-
const [autoHandledResults, setAutoHandledResults] =
|
|
71887
|
-
const [autoDeniedApprovals, setAutoDeniedApprovals] =
|
|
71888
|
-
const bashCommandCacheRef =
|
|
71889
|
-
const [pendingRalphConfig, setPendingRalphConfig] =
|
|
71890
|
-
const [uiRalphActive, setUiRalphActive] =
|
|
71981
|
+
const [profileConfirmPending, setProfileConfirmPending] = import_react78.useState(null);
|
|
71982
|
+
const [pendingApprovals, setPendingApprovals] = import_react78.useState([]);
|
|
71983
|
+
const [approvalContexts, setApprovalContexts] = import_react78.useState([]);
|
|
71984
|
+
const [approvalResults, setApprovalResults] = import_react78.useState([]);
|
|
71985
|
+
const [isExecutingTool, setIsExecutingTool] = import_react78.useState(false);
|
|
71986
|
+
const [queuedApprovalResults, setQueuedApprovalResults] = import_react78.useState(null);
|
|
71987
|
+
const toolAbortControllerRef = import_react78.useRef(null);
|
|
71988
|
+
const [autoHandledResults, setAutoHandledResults] = import_react78.useState([]);
|
|
71989
|
+
const [autoDeniedApprovals, setAutoDeniedApprovals] = import_react78.useState([]);
|
|
71990
|
+
const bashCommandCacheRef = import_react78.useRef([]);
|
|
71991
|
+
const [pendingRalphConfig, setPendingRalphConfig] = import_react78.useState(null);
|
|
71992
|
+
const [uiRalphActive, setUiRalphActive] = import_react78.useState(ralphMode.getState().isActive);
|
|
71891
71993
|
const currentApproval = pendingApprovals[approvalResults.length];
|
|
71892
71994
|
const currentApprovalContext = approvalContexts[approvalResults.length];
|
|
71893
71995
|
const activeApprovalId = currentApproval?.toolCallId ?? null;
|
|
@@ -71897,7 +71999,7 @@ function App2({
|
|
|
71897
71999
|
approvalMap,
|
|
71898
72000
|
stubDescriptions,
|
|
71899
72001
|
queuedDecisions
|
|
71900
|
-
} =
|
|
72002
|
+
} = import_react78.useMemo(() => {
|
|
71901
72003
|
const pending = new Set;
|
|
71902
72004
|
const queued = new Set;
|
|
71903
72005
|
const map = new Map;
|
|
@@ -71954,59 +72056,59 @@ function App2({
|
|
|
71954
72056
|
queuedDecisions: decisions
|
|
71955
72057
|
};
|
|
71956
72058
|
}, [pendingApprovals, approvalResults, activeApprovalId]);
|
|
71957
|
-
const [activeOverlay, setActiveOverlay] =
|
|
71958
|
-
const [feedbackPrefill, setFeedbackPrefill] =
|
|
71959
|
-
const closeOverlay =
|
|
72059
|
+
const [activeOverlay, setActiveOverlay] = import_react78.useState(null);
|
|
72060
|
+
const [feedbackPrefill, setFeedbackPrefill] = import_react78.useState("");
|
|
72061
|
+
const closeOverlay = import_react78.useCallback(() => {
|
|
71960
72062
|
setActiveOverlay(null);
|
|
71961
72063
|
setFeedbackPrefill("");
|
|
71962
72064
|
}, []);
|
|
71963
|
-
const [pinDialogLocal, setPinDialogLocal] =
|
|
72065
|
+
const [pinDialogLocal, setPinDialogLocal] = import_react78.useState(false);
|
|
71964
72066
|
const anySelectorOpen = activeOverlay !== null;
|
|
71965
|
-
const [currentSystemPromptId, setCurrentSystemPromptId] =
|
|
71966
|
-
const [currentToolset, setCurrentToolset] =
|
|
71967
|
-
const [llmConfig, setLlmConfig] =
|
|
71968
|
-
const llmConfigRef =
|
|
71969
|
-
|
|
72067
|
+
const [currentSystemPromptId, setCurrentSystemPromptId] = import_react78.useState("default");
|
|
72068
|
+
const [currentToolset, setCurrentToolset] = import_react78.useState(null);
|
|
72069
|
+
const [llmConfig, setLlmConfig] = import_react78.useState(null);
|
|
72070
|
+
const llmConfigRef = import_react78.useRef(llmConfig);
|
|
72071
|
+
import_react78.useEffect(() => {
|
|
71970
72072
|
llmConfigRef.current = llmConfig;
|
|
71971
72073
|
}, [llmConfig]);
|
|
71972
|
-
const [currentModelId, setCurrentModelId] =
|
|
71973
|
-
const [agentName, setAgentName] =
|
|
71974
|
-
const [agentDescription, setAgentDescription] =
|
|
71975
|
-
const [agentLastRunAt, setAgentLastRunAt] =
|
|
72074
|
+
const [currentModelId, setCurrentModelId] = import_react78.useState(null);
|
|
72075
|
+
const [agentName, setAgentName] = import_react78.useState(null);
|
|
72076
|
+
const [agentDescription, setAgentDescription] = import_react78.useState(null);
|
|
72077
|
+
const [agentLastRunAt, setAgentLastRunAt] = import_react78.useState(null);
|
|
71976
72078
|
const currentModelLabel = llmConfig?.model_endpoint_type && llmConfig?.model ? `${llmConfig.model_endpoint_type}/${llmConfig.model}` : llmConfig?.model ?? null;
|
|
71977
72079
|
const currentModelDisplay = currentModelLabel ? getModelDisplayName(currentModelLabel) ?? currentModelLabel.split("/").pop() : null;
|
|
71978
72080
|
const currentModelProvider = llmConfig?.provider_name ?? null;
|
|
71979
|
-
const [tokenStreamingEnabled, setTokenStreamingEnabled] =
|
|
71980
|
-
const [tokenCount, setTokenCount] =
|
|
71981
|
-
const [thinkingMessage, setThinkingMessage] =
|
|
71982
|
-
const sessionStatsRef =
|
|
71983
|
-
|
|
72081
|
+
const [tokenStreamingEnabled, setTokenStreamingEnabled] = import_react78.useState(tokenStreaming);
|
|
72082
|
+
const [tokenCount, setTokenCount] = import_react78.useState(0);
|
|
72083
|
+
const [thinkingMessage, setThinkingMessage] = import_react78.useState(getRandomThinkingVerb());
|
|
72084
|
+
const sessionStatsRef = import_react78.useRef(new SessionStats);
|
|
72085
|
+
import_react78.useEffect(() => {
|
|
71984
72086
|
telemetry2.setSessionStatsGetter(() => sessionStatsRef.current.getSnapshot());
|
|
71985
72087
|
return () => {
|
|
71986
72088
|
telemetry2.setSessionStatsGetter(undefined);
|
|
71987
72089
|
};
|
|
71988
72090
|
}, []);
|
|
71989
|
-
const [showExitStats, setShowExitStats] =
|
|
71990
|
-
const hasSentSessionContextRef =
|
|
71991
|
-
const turnCountRef =
|
|
71992
|
-
const [staticItems, setStaticItems] =
|
|
71993
|
-
const emittedIdsRef =
|
|
71994
|
-
const welcomeCommittedRef =
|
|
71995
|
-
const abortControllerRef =
|
|
71996
|
-
const userCancelledRef =
|
|
71997
|
-
const llmApiErrorRetriesRef =
|
|
71998
|
-
const [messageQueue, setMessageQueue] =
|
|
71999
|
-
const waitingForQueueCancelRef =
|
|
72000
|
-
const queueSnapshotRef =
|
|
72001
|
-
const [restoreQueueOnCancel, setRestoreQueueOnCancel] =
|
|
72002
|
-
const restoreQueueOnCancelRef =
|
|
72003
|
-
|
|
72091
|
+
const [showExitStats, setShowExitStats] = import_react78.useState(false);
|
|
72092
|
+
const hasSentSessionContextRef = import_react78.useRef(false);
|
|
72093
|
+
const turnCountRef = import_react78.useRef(0);
|
|
72094
|
+
const [staticItems, setStaticItems] = import_react78.useState([]);
|
|
72095
|
+
const emittedIdsRef = import_react78.useRef(new Set);
|
|
72096
|
+
const welcomeCommittedRef = import_react78.useRef(false);
|
|
72097
|
+
const abortControllerRef = import_react78.useRef(null);
|
|
72098
|
+
const userCancelledRef = import_react78.useRef(false);
|
|
72099
|
+
const llmApiErrorRetriesRef = import_react78.useRef(0);
|
|
72100
|
+
const [messageQueue, setMessageQueue] = import_react78.useState([]);
|
|
72101
|
+
const waitingForQueueCancelRef = import_react78.useRef(false);
|
|
72102
|
+
const queueSnapshotRef = import_react78.useRef([]);
|
|
72103
|
+
const [restoreQueueOnCancel, setRestoreQueueOnCancel] = import_react78.useState(false);
|
|
72104
|
+
const restoreQueueOnCancelRef = import_react78.useRef(restoreQueueOnCancel);
|
|
72105
|
+
import_react78.useEffect(() => {
|
|
72004
72106
|
restoreQueueOnCancelRef.current = restoreQueueOnCancel;
|
|
72005
72107
|
}, [restoreQueueOnCancel]);
|
|
72006
|
-
const isAgentBusy =
|
|
72108
|
+
const isAgentBusy = import_react78.useCallback(() => {
|
|
72007
72109
|
return streamingRef.current || isExecutingTool || commandRunningRef.current || abortControllerRef.current !== null;
|
|
72008
72110
|
}, [isExecutingTool]);
|
|
72009
|
-
const withCommandLock =
|
|
72111
|
+
const withCommandLock = import_react78.useCallback(async (asyncFn) => {
|
|
72010
72112
|
setActiveOverlay(null);
|
|
72011
72113
|
setCommandRunning(true);
|
|
72012
72114
|
try {
|
|
@@ -72016,9 +72118,9 @@ function App2({
|
|
|
72016
72118
|
}
|
|
72017
72119
|
}, [setCommandRunning]);
|
|
72018
72120
|
const columns = useTerminalWidth();
|
|
72019
|
-
const prevColumnsRef =
|
|
72020
|
-
const [staticRenderEpoch, setStaticRenderEpoch] =
|
|
72021
|
-
|
|
72121
|
+
const prevColumnsRef = import_react78.useRef(columns);
|
|
72122
|
+
const [staticRenderEpoch, setStaticRenderEpoch] = import_react78.useState(0);
|
|
72123
|
+
import_react78.useEffect(() => {
|
|
72022
72124
|
const prev = prevColumnsRef.current;
|
|
72023
72125
|
if (columns === prev)
|
|
72024
72126
|
return;
|
|
@@ -72028,7 +72130,7 @@ function App2({
|
|
|
72028
72130
|
setStaticRenderEpoch((epoch) => epoch + 1);
|
|
72029
72131
|
prevColumnsRef.current = columns;
|
|
72030
72132
|
}, [columns]);
|
|
72031
|
-
const commitEligibleLines =
|
|
72133
|
+
const commitEligibleLines = import_react78.useCallback((b) => {
|
|
72032
72134
|
const newlyCommitted = [];
|
|
72033
72135
|
let firstTaskIndex = -1;
|
|
72034
72136
|
const hasInProgress = hasInProgressTaskToolCalls(b.order, b.byId, emittedIdsRef.current);
|
|
@@ -72082,20 +72184,20 @@ function App2({
|
|
|
72082
72184
|
setStaticItems((prev) => [...prev, ...newlyCommitted]);
|
|
72083
72185
|
}
|
|
72084
72186
|
}, []);
|
|
72085
|
-
const [lines, setLines] =
|
|
72086
|
-
const buffersRef =
|
|
72087
|
-
const hasBackfilledRef =
|
|
72088
|
-
const precomputedDiffsRef =
|
|
72089
|
-
const lastPlanFilePathRef =
|
|
72090
|
-
const eagerCommittedPreviewsRef =
|
|
72091
|
-
const refreshDerived =
|
|
72187
|
+
const [lines, setLines] = import_react78.useState([]);
|
|
72188
|
+
const buffersRef = import_react78.useRef(createBuffers());
|
|
72189
|
+
const hasBackfilledRef = import_react78.useRef(false);
|
|
72190
|
+
const precomputedDiffsRef = import_react78.useRef(new Map);
|
|
72191
|
+
const lastPlanFilePathRef = import_react78.useRef(null);
|
|
72192
|
+
const eagerCommittedPreviewsRef = import_react78.useRef(new Set);
|
|
72193
|
+
const refreshDerived = import_react78.useCallback(() => {
|
|
72092
72194
|
const b = buffersRef.current;
|
|
72093
72195
|
setTokenCount(b.tokenCount);
|
|
72094
72196
|
const newLines = toLines(b);
|
|
72095
72197
|
setLines(newLines);
|
|
72096
72198
|
commitEligibleLines(b);
|
|
72097
72199
|
}, [commitEligibleLines]);
|
|
72098
|
-
const refreshDerivedThrottled =
|
|
72200
|
+
const refreshDerivedThrottled = import_react78.useCallback(() => {
|
|
72099
72201
|
if (!buffersRef.current.pendingRefresh) {
|
|
72100
72202
|
buffersRef.current.pendingRefresh = true;
|
|
72101
72203
|
const capturedGeneration = buffersRef.current.commitGeneration || 0;
|
|
@@ -72107,7 +72209,7 @@ function App2({
|
|
|
72107
72209
|
}, 16);
|
|
72108
72210
|
}
|
|
72109
72211
|
}, [refreshDerived]);
|
|
72110
|
-
|
|
72212
|
+
import_react78.useEffect(() => {
|
|
72111
72213
|
const approvals = startupApprovals?.length > 0 ? startupApprovals : startupApproval ? [startupApproval] : [];
|
|
72112
72214
|
if (loadingState === "ready" && approvals.length > 0) {
|
|
72113
72215
|
setPendingApprovals(approvals);
|
|
@@ -72125,7 +72227,7 @@ function App2({
|
|
|
72125
72227
|
analyzeStartupApprovals();
|
|
72126
72228
|
}
|
|
72127
72229
|
}, [loadingState, startupApproval, startupApprovals]);
|
|
72128
|
-
|
|
72230
|
+
import_react78.useEffect(() => {
|
|
72129
72231
|
if (!currentApproval)
|
|
72130
72232
|
return;
|
|
72131
72233
|
if (currentApproval.toolName !== "ExitPlanMode")
|
|
@@ -72157,7 +72259,7 @@ function App2({
|
|
|
72157
72259
|
lastPlanFilePathRef.current = planFilePath;
|
|
72158
72260
|
} catch {}
|
|
72159
72261
|
}, [currentApproval]);
|
|
72160
|
-
|
|
72262
|
+
import_react78.useEffect(() => {
|
|
72161
72263
|
if (loadingState === "ready" && messageHistory.length > 0 && !hasBackfilledRef.current) {
|
|
72162
72264
|
hasBackfilledRef.current = true;
|
|
72163
72265
|
if (!welcomeCommittedRef.current) {
|
|
@@ -72216,7 +72318,7 @@ function App2({
|
|
|
72216
72318
|
agentState,
|
|
72217
72319
|
agentProvenance
|
|
72218
72320
|
]);
|
|
72219
|
-
|
|
72321
|
+
import_react78.useEffect(() => {
|
|
72220
72322
|
if (loadingState === "ready" && agentId && agentId !== "loading") {
|
|
72221
72323
|
const fetchConfig = async () => {
|
|
72222
72324
|
try {
|
|
@@ -72246,7 +72348,7 @@ function App2({
|
|
|
72246
72348
|
fetchConfig();
|
|
72247
72349
|
}
|
|
72248
72350
|
}, [loadingState, agentId]);
|
|
72249
|
-
const appendError =
|
|
72351
|
+
const appendError = import_react78.useCallback((message, skipTelemetry = false) => {
|
|
72250
72352
|
const text = typeof message === "string" ? message : message != null ? JSON.stringify(message) : "[Unknown error]";
|
|
72251
72353
|
const id = uid4("err");
|
|
72252
72354
|
buffersRef.current.byId.set(id, {
|
|
@@ -72262,7 +72364,7 @@ function App2({
|
|
|
72262
72364
|
});
|
|
72263
72365
|
}
|
|
72264
72366
|
}, [refreshDerived, currentModelId]);
|
|
72265
|
-
const processConversation =
|
|
72367
|
+
const processConversation = import_react78.useCallback(async (initialInput, options) => {
|
|
72266
72368
|
const handleRalphContinuation = () => {
|
|
72267
72369
|
const ralphState = ralphMode.getState();
|
|
72268
72370
|
const lines2 = toLines(buffersRef.current);
|
|
@@ -72964,7 +73066,7 @@ ${newState.originalPrompt}`
|
|
|
72964
73066
|
setStreaming,
|
|
72965
73067
|
currentModelId
|
|
72966
73068
|
]);
|
|
72967
|
-
const handleExit =
|
|
73069
|
+
const handleExit = import_react78.useCallback(async () => {
|
|
72968
73070
|
saveLastAgentBeforeExit();
|
|
72969
73071
|
const stats = sessionStatsRef.current.getSnapshot();
|
|
72970
73072
|
telemetry2.trackSessionEnd(stats, "exit_command");
|
|
@@ -72974,10 +73076,10 @@ ${newState.originalPrompt}`
|
|
|
72974
73076
|
process.exit(0);
|
|
72975
73077
|
}, 100);
|
|
72976
73078
|
}, []);
|
|
72977
|
-
const handleEnterQueueEditMode =
|
|
73079
|
+
const handleEnterQueueEditMode = import_react78.useCallback(() => {
|
|
72978
73080
|
setMessageQueue([]);
|
|
72979
73081
|
}, []);
|
|
72980
|
-
const handleInterrupt =
|
|
73082
|
+
const handleInterrupt = import_react78.useCallback(async () => {
|
|
72981
73083
|
if (isExecutingTool && toolAbortControllerRef.current) {
|
|
72982
73084
|
toolAbortControllerRef.current.abort();
|
|
72983
73085
|
buffersRef.current.abortGeneration = (buffersRef.current.abortGeneration || 0) + 1;
|
|
@@ -73064,11 +73166,11 @@ ${newState.originalPrompt}`
|
|
|
73064
73166
|
setStreaming,
|
|
73065
73167
|
pendingApprovals
|
|
73066
73168
|
]);
|
|
73067
|
-
const processConversationRef =
|
|
73068
|
-
|
|
73169
|
+
const processConversationRef = import_react78.useRef(processConversation);
|
|
73170
|
+
import_react78.useEffect(() => {
|
|
73069
73171
|
processConversationRef.current = processConversation;
|
|
73070
73172
|
}, [processConversation]);
|
|
73071
|
-
const handleAgentSelect =
|
|
73173
|
+
const handleAgentSelect = import_react78.useCallback(async (targetAgentId, _opts) => {
|
|
73072
73174
|
setActiveOverlay(null);
|
|
73073
73175
|
if (targetAgentId === agentId) {
|
|
73074
73176
|
const label = agentName || targetAgentId.slice(0, 12);
|
|
@@ -73165,7 +73267,7 @@ ${newState.originalPrompt}`
|
|
|
73165
73267
|
setCommandRunning(false);
|
|
73166
73268
|
}
|
|
73167
73269
|
}, [refreshDerived, agentId, agentName, setCommandRunning]);
|
|
73168
|
-
const handleCreateNewAgent =
|
|
73270
|
+
const handleCreateNewAgent = import_react78.useCallback(async (name) => {
|
|
73169
73271
|
setActiveOverlay(null);
|
|
73170
73272
|
setCommandRunning(true);
|
|
73171
73273
|
const inputCmd = "/new";
|
|
@@ -73230,7 +73332,7 @@ ${newState.originalPrompt}`
|
|
|
73230
73332
|
setCommandRunning(false);
|
|
73231
73333
|
}
|
|
73232
73334
|
}, [refreshDerived, agentId, setCommandRunning]);
|
|
73233
|
-
const handleBashSubmit =
|
|
73335
|
+
const handleBashSubmit = import_react78.useCallback(async (command) => {
|
|
73234
73336
|
const cmdId = uid4("bash");
|
|
73235
73337
|
buffersRef.current.byId.set(cmdId, {
|
|
73236
73338
|
kind: "bash_command",
|
|
@@ -73277,7 +73379,7 @@ ${newState.originalPrompt}`
|
|
|
73277
73379
|
}
|
|
73278
73380
|
refreshDerived();
|
|
73279
73381
|
}, [refreshDerived]);
|
|
73280
|
-
const checkPendingApprovalsForSlashCommand =
|
|
73382
|
+
const checkPendingApprovalsForSlashCommand = import_react78.useCallback(async () => {
|
|
73281
73383
|
if (!CHECK_PENDING_APPROVALS_BEFORE_SEND) {
|
|
73282
73384
|
return { blocked: false };
|
|
73283
73385
|
}
|
|
@@ -73367,7 +73469,7 @@ ${newState.originalPrompt}`
|
|
|
73367
73469
|
return { blocked: false };
|
|
73368
73470
|
}
|
|
73369
73471
|
}, [agentId, processConversation]);
|
|
73370
|
-
const onSubmit =
|
|
73472
|
+
const onSubmit = import_react78.useCallback(async (message) => {
|
|
73371
73473
|
const msg = message?.trim() ?? "";
|
|
73372
73474
|
if (profileConfirmPending && !msg) {
|
|
73373
73475
|
const { name, agentId: targetAgentId, cmdId } = profileConfirmPending;
|
|
@@ -74850,11 +74952,11 @@ DO NOT respond to these messages or otherwise consider them in your response unl
|
|
|
74850
74952
|
setCommandRunning,
|
|
74851
74953
|
pendingRalphConfig
|
|
74852
74954
|
]);
|
|
74853
|
-
const onSubmitRef =
|
|
74854
|
-
|
|
74955
|
+
const onSubmitRef = import_react78.useRef(onSubmit);
|
|
74956
|
+
import_react78.useEffect(() => {
|
|
74855
74957
|
onSubmitRef.current = onSubmit;
|
|
74856
74958
|
}, [onSubmit]);
|
|
74857
|
-
|
|
74959
|
+
import_react78.useEffect(() => {
|
|
74858
74960
|
if (!streaming && messageQueue.length > 0 && pendingApprovals.length === 0 && !commandRunning && !isExecutingTool && !anySelectorOpen && !waitingForQueueCancelRef.current && !userCancelledRef.current) {
|
|
74859
74961
|
const [firstMessage, ...rest] = messageQueue;
|
|
74860
74962
|
setMessageQueue(rest);
|
|
@@ -74868,7 +74970,7 @@ DO NOT respond to these messages or otherwise consider them in your response unl
|
|
|
74868
74970
|
isExecutingTool,
|
|
74869
74971
|
anySelectorOpen
|
|
74870
74972
|
]);
|
|
74871
|
-
const sendAllResults =
|
|
74973
|
+
const sendAllResults = import_react78.useCallback(async (additionalDecision) => {
|
|
74872
74974
|
try {
|
|
74873
74975
|
if (userCancelledRef.current || abortControllerRef.current?.signal.aborted) {
|
|
74874
74976
|
setStreaming(false);
|
|
@@ -74973,7 +75075,7 @@ DO NOT respond to these messages or otherwise consider them in your response unl
|
|
|
74973
75075
|
appendError,
|
|
74974
75076
|
setStreaming
|
|
74975
75077
|
]);
|
|
74976
|
-
const handleApproveCurrent =
|
|
75078
|
+
const handleApproveCurrent = import_react78.useCallback(async (diffs) => {
|
|
74977
75079
|
if (isExecutingTool)
|
|
74978
75080
|
return;
|
|
74979
75081
|
const currentIndex = approvalResults.length;
|
|
@@ -75012,7 +75114,7 @@ DO NOT respond to these messages or otherwise consider them in your response unl
|
|
|
75012
75114
|
isExecutingTool,
|
|
75013
75115
|
setStreaming
|
|
75014
75116
|
]);
|
|
75015
|
-
const handleApproveAlways =
|
|
75117
|
+
const handleApproveAlways = import_react78.useCallback(async (scope, diffs) => {
|
|
75016
75118
|
if (isExecutingTool)
|
|
75017
75119
|
return;
|
|
75018
75120
|
if (pendingApprovals.length === 0 || approvalContexts.length === 0)
|
|
@@ -75121,7 +75223,7 @@ DO NOT respond to these messages or otherwise consider them in your response unl
|
|
|
75121
75223
|
isExecutingTool,
|
|
75122
75224
|
setStreaming
|
|
75123
75225
|
]);
|
|
75124
|
-
const handleDenyCurrent =
|
|
75226
|
+
const handleDenyCurrent = import_react78.useCallback(async (reason) => {
|
|
75125
75227
|
if (isExecutingTool)
|
|
75126
75228
|
return;
|
|
75127
75229
|
const currentIndex = approvalResults.length;
|
|
@@ -75157,7 +75259,7 @@ DO NOT respond to these messages or otherwise consider them in your response unl
|
|
|
75157
75259
|
isExecutingTool,
|
|
75158
75260
|
setStreaming
|
|
75159
75261
|
]);
|
|
75160
|
-
const handleCancelApprovals =
|
|
75262
|
+
const handleCancelApprovals = import_react78.useCallback(() => {
|
|
75161
75263
|
if (pendingApprovals.length === 0)
|
|
75162
75264
|
return;
|
|
75163
75265
|
const denialResults = pendingApprovals.map((approval) => ({
|
|
@@ -75175,7 +75277,7 @@ DO NOT respond to these messages or otherwise consider them in your response unl
|
|
|
75175
75277
|
setAutoHandledResults([]);
|
|
75176
75278
|
setAutoDeniedApprovals([]);
|
|
75177
75279
|
}, [pendingApprovals, refreshDerived]);
|
|
75178
|
-
const handleModelSelect =
|
|
75280
|
+
const handleModelSelect = import_react78.useCallback(async (modelId) => {
|
|
75179
75281
|
await withCommandLock(async () => {
|
|
75180
75282
|
let cmdId = null;
|
|
75181
75283
|
try {
|
|
@@ -75260,7 +75362,7 @@ Consider switching to a different system prompt using /system to match.` : null;
|
|
|
75260
75362
|
}
|
|
75261
75363
|
});
|
|
75262
75364
|
}, [agentId, refreshDerived, currentToolset, withCommandLock]);
|
|
75263
|
-
const handleSystemPromptSelect =
|
|
75365
|
+
const handleSystemPromptSelect = import_react78.useCallback(async (promptId) => {
|
|
75264
75366
|
await withCommandLock(async () => {
|
|
75265
75367
|
const cmdId = uid4("cmd");
|
|
75266
75368
|
try {
|
|
@@ -75325,7 +75427,7 @@ Consider switching to a different system prompt using /system to match.` : null;
|
|
|
75325
75427
|
}
|
|
75326
75428
|
});
|
|
75327
75429
|
}, [agentId, refreshDerived, withCommandLock]);
|
|
75328
|
-
const handleToolsetSelect =
|
|
75430
|
+
const handleToolsetSelect = import_react78.useCallback(async (toolsetId) => {
|
|
75329
75431
|
await withCommandLock(async () => {
|
|
75330
75432
|
const cmdId = uid4("cmd");
|
|
75331
75433
|
try {
|
|
@@ -75364,7 +75466,7 @@ Consider switching to a different system prompt using /system to match.` : null;
|
|
|
75364
75466
|
}
|
|
75365
75467
|
});
|
|
75366
75468
|
}, [agentId, refreshDerived, withCommandLock]);
|
|
75367
|
-
const handleFeedbackSubmit =
|
|
75469
|
+
const handleFeedbackSubmit = import_react78.useCallback(async (message) => {
|
|
75368
75470
|
closeOverlay();
|
|
75369
75471
|
await withCommandLock(async () => {
|
|
75370
75472
|
const cmdId = uid4("cmd");
|
|
@@ -75432,7 +75534,7 @@ Consider switching to a different system prompt using /system to match.` : null;
|
|
|
75432
75534
|
}
|
|
75433
75535
|
});
|
|
75434
75536
|
}, [agentId, refreshDerived, withCommandLock, closeOverlay]);
|
|
75435
|
-
const handleProfileEscapeCancel =
|
|
75537
|
+
const handleProfileEscapeCancel = import_react78.useCallback(() => {
|
|
75436
75538
|
if (profileConfirmPending) {
|
|
75437
75539
|
const { cmdId, name } = profileConfirmPending;
|
|
75438
75540
|
buffersRef.current.byId.set(cmdId, {
|
|
@@ -75447,8 +75549,8 @@ Consider switching to a different system prompt using /system to match.` : null;
|
|
|
75447
75549
|
setProfileConfirmPending(null);
|
|
75448
75550
|
}
|
|
75449
75551
|
}, [profileConfirmPending, refreshDerived]);
|
|
75450
|
-
const [uiPermissionMode, setUiPermissionMode] =
|
|
75451
|
-
const handleRalphExit =
|
|
75552
|
+
const [uiPermissionMode, setUiPermissionMode] = import_react78.useState(permissionMode2.getMode());
|
|
75553
|
+
const handleRalphExit = import_react78.useCallback(() => {
|
|
75452
75554
|
const ralph = ralphMode.getState();
|
|
75453
75555
|
if (ralph.isActive) {
|
|
75454
75556
|
const wasYolo = ralph.isYolo;
|
|
@@ -75460,14 +75562,14 @@ Consider switching to a different system prompt using /system to match.` : null;
|
|
|
75460
75562
|
}
|
|
75461
75563
|
}
|
|
75462
75564
|
}, []);
|
|
75463
|
-
const handlePermissionModeChange =
|
|
75565
|
+
const handlePermissionModeChange = import_react78.useCallback((mode) => {
|
|
75464
75566
|
if (mode === "plan") {
|
|
75465
75567
|
const planPath = generatePlanFilePath();
|
|
75466
75568
|
permissionMode2.setPlanFilePath(planPath);
|
|
75467
75569
|
}
|
|
75468
75570
|
setUiPermissionMode(mode);
|
|
75469
75571
|
}, []);
|
|
75470
|
-
const handlePlanApprove =
|
|
75572
|
+
const handlePlanApprove = import_react78.useCallback(async (acceptEdits = false) => {
|
|
75471
75573
|
const currentIndex = approvalResults.length;
|
|
75472
75574
|
const approval = pendingApprovals[currentIndex];
|
|
75473
75575
|
if (!approval)
|
|
@@ -75518,7 +75620,7 @@ Consider switching to a different system prompt using /system to match.` : null;
|
|
|
75518
75620
|
refreshDerived,
|
|
75519
75621
|
setStreaming
|
|
75520
75622
|
]);
|
|
75521
|
-
const handlePlanKeepPlanning =
|
|
75623
|
+
const handlePlanKeepPlanning = import_react78.useCallback(async (reason) => {
|
|
75522
75624
|
const currentIndex = approvalResults.length;
|
|
75523
75625
|
const approval = pendingApprovals[currentIndex];
|
|
75524
75626
|
if (!approval)
|
|
@@ -75537,7 +75639,7 @@ Consider switching to a different system prompt using /system to match.` : null;
|
|
|
75537
75639
|
setApprovalResults((prev) => [...prev, decision]);
|
|
75538
75640
|
}
|
|
75539
75641
|
}, [pendingApprovals, approvalResults, sendAllResults]);
|
|
75540
|
-
|
|
75642
|
+
import_react78.useEffect(() => {
|
|
75541
75643
|
const currentIndex = approvalResults.length;
|
|
75542
75644
|
const approval = pendingApprovals[currentIndex];
|
|
75543
75645
|
if (approval?.toolName === "ExitPlanMode" && !planFileExists()) {
|
|
@@ -75547,7 +75649,7 @@ Consider switching to a different system prompt using /system to match.` : null;
|
|
|
75547
75649
|
` + `Use a write tool (e.g. Write, ApplyPatch, etc.) to create your plan, then call ExitPlanMode again.`);
|
|
75548
75650
|
}
|
|
75549
75651
|
}, [pendingApprovals, approvalResults.length, handlePlanKeepPlanning]);
|
|
75550
|
-
const handleQuestionSubmit =
|
|
75652
|
+
const handleQuestionSubmit = import_react78.useCallback(async (answers) => {
|
|
75551
75653
|
const currentIndex = approvalResults.length;
|
|
75552
75654
|
const approval = pendingApprovals[currentIndex];
|
|
75553
75655
|
if (!approval)
|
|
@@ -75588,7 +75690,7 @@ Consider switching to a different system prompt using /system to match.` : null;
|
|
|
75588
75690
|
setApprovalResults((prev) => [...prev, decision]);
|
|
75589
75691
|
}
|
|
75590
75692
|
}, [pendingApprovals, approvalResults, sendAllResults, refreshDerived]);
|
|
75591
|
-
const handleEnterPlanModeApprove =
|
|
75693
|
+
const handleEnterPlanModeApprove = import_react78.useCallback(async () => {
|
|
75592
75694
|
const currentIndex = approvalResults.length;
|
|
75593
75695
|
const approval = pendingApprovals[currentIndex];
|
|
75594
75696
|
if (!approval)
|
|
@@ -75639,7 +75741,7 @@ Plan file path: ${planFilePath}`;
|
|
|
75639
75741
|
setApprovalResults((prev) => [...prev, decision]);
|
|
75640
75742
|
}
|
|
75641
75743
|
}, [pendingApprovals, approvalResults, sendAllResults, refreshDerived]);
|
|
75642
|
-
const handleEnterPlanModeReject =
|
|
75744
|
+
const handleEnterPlanModeReject = import_react78.useCallback(async () => {
|
|
75643
75745
|
const currentIndex = approvalResults.length;
|
|
75644
75746
|
const approval = pendingApprovals[currentIndex];
|
|
75645
75747
|
if (!approval)
|
|
@@ -75658,7 +75760,7 @@ Plan file path: ${planFilePath}`;
|
|
|
75658
75760
|
setApprovalResults((prev) => [...prev, decision]);
|
|
75659
75761
|
}
|
|
75660
75762
|
}, [pendingApprovals, approvalResults, sendAllResults]);
|
|
75661
|
-
const liveItems =
|
|
75763
|
+
const liveItems = import_react78.useMemo(() => {
|
|
75662
75764
|
return lines.filter((ln) => {
|
|
75663
75765
|
if (!("phase" in ln))
|
|
75664
75766
|
return false;
|
|
@@ -75676,7 +75778,7 @@ Plan file path: ${planFilePath}`;
|
|
|
75676
75778
|
return ln.phase === "streaming";
|
|
75677
75779
|
});
|
|
75678
75780
|
}, [lines, tokenStreamingEnabled]);
|
|
75679
|
-
|
|
75781
|
+
import_react78.useEffect(() => {
|
|
75680
75782
|
if (loadingState === "ready" && !welcomeCommittedRef.current && messageHistory.length === 0) {
|
|
75681
75783
|
if (!continueSession && !agentProvenance) {
|
|
75682
75784
|
return;
|
|
@@ -76154,7 +76256,7 @@ Plan file path: ${planFilePath}`;
|
|
|
76154
76256
|
]
|
|
76155
76257
|
}, resumeKey, true, undefined, this);
|
|
76156
76258
|
}
|
|
76157
|
-
var
|
|
76259
|
+
var import_react78, jsx_dev_runtime56, CLEAR_SCREEN_AND_HOME = "\x1B[2J\x1B[H", CHECK_PENDING_APPROVALS_BEFORE_SEND = true, EAGER_CANCEL = true, LLM_API_ERROR_MAX_RETRIES2 = 3, INTERRUPT_MESSAGE = "Interrupted – tell the agent what to do differently. Something went wrong? Use /feedback to report the issue.";
|
|
76158
76260
|
var init_App2 = __esm(async () => {
|
|
76159
76261
|
init_error();
|
|
76160
76262
|
init_check_approval();
|
|
@@ -76228,7 +76330,7 @@ var init_App2 = __esm(async () => {
|
|
|
76228
76330
|
init_stream(),
|
|
76229
76331
|
init_useSuspend()
|
|
76230
76332
|
]);
|
|
76231
|
-
|
|
76333
|
+
import_react78 = __toESM(require_react(), 1);
|
|
76232
76334
|
jsx_dev_runtime56 = __toESM(require_jsx_dev_runtime(), 1);
|
|
76233
76335
|
});
|
|
76234
76336
|
|
|
@@ -77235,7 +77337,8 @@ async function getClient() {
|
|
|
77235
77337
|
defaultHeaders: {
|
|
77236
77338
|
"X-Letta-Source": "letta-code",
|
|
77237
77339
|
"User-Agent": `letta-code/${package_default.version}`
|
|
77238
|
-
}
|
|
77340
|
+
},
|
|
77341
|
+
...isTimingsEnabled() && { fetch: createTimingFetch(fetch) }
|
|
77239
77342
|
});
|
|
77240
77343
|
}
|
|
77241
77344
|
|
|
@@ -77691,6 +77794,12 @@ class PermissionModeManager {
|
|
|
77691
77794
|
return "allow";
|
|
77692
77795
|
}
|
|
77693
77796
|
}
|
|
77797
|
+
if (toolName === "Skill" || toolName === "skill") {
|
|
77798
|
+
const command = toolArgs?.command;
|
|
77799
|
+
if (command && ["load", "unload", "refresh"].includes(command)) {
|
|
77800
|
+
return "allow";
|
|
77801
|
+
}
|
|
77802
|
+
}
|
|
77694
77803
|
const shellTools = [
|
|
77695
77804
|
"Bash",
|
|
77696
77805
|
"shell",
|
|
@@ -79215,7 +79324,7 @@ Error: ${message}`);
|
|
|
79215
79324
|
} catch {}
|
|
79216
79325
|
const React14 = await Promise.resolve().then(() => __toESM(require_react2(), 1));
|
|
79217
79326
|
const { render: render2 } = await init_build3().then(() => exports_build);
|
|
79218
|
-
const { useState: useState39, useEffect:
|
|
79327
|
+
const { useState: useState39, useEffect: useEffect26 } = React14;
|
|
79219
79328
|
const AppModule = await init_App2().then(() => exports_App);
|
|
79220
79329
|
const App3 = AppModule.default;
|
|
79221
79330
|
function LoadingApp({
|
|
@@ -79238,7 +79347,8 @@ Error: ${message}`);
|
|
|
79238
79347
|
const [isResumingSession, setIsResumingSession] = useState39(false);
|
|
79239
79348
|
const [agentProvenance, setAgentProvenance] = useState39(null);
|
|
79240
79349
|
const [selectedGlobalAgentId, setSelectedGlobalAgentId] = useState39(null);
|
|
79241
|
-
|
|
79350
|
+
const [userRequestedNewAgent, setUserRequestedNewAgent] = useState39(false);
|
|
79351
|
+
useEffect26(() => {
|
|
79242
79352
|
async function autoInstallKeybinding() {
|
|
79243
79353
|
const {
|
|
79244
79354
|
detectTerminalType: detectTerminalType3,
|
|
@@ -79295,7 +79405,7 @@ Error: ${message}`);
|
|
|
79295
79405
|
autoInstallKeybinding();
|
|
79296
79406
|
autoInstallWezTermFix();
|
|
79297
79407
|
}, []);
|
|
79298
|
-
|
|
79408
|
+
useEffect26(() => {
|
|
79299
79409
|
async function checkAndStart() {
|
|
79300
79410
|
await settingsManager2.loadLocalProjectSettings();
|
|
79301
79411
|
const localSettings = settingsManager2.getLocalProjectSettings();
|
|
@@ -79309,7 +79419,7 @@ Error: ${message}`);
|
|
|
79309
79419
|
}
|
|
79310
79420
|
checkAndStart();
|
|
79311
79421
|
}, [forceNew2, agentIdArg, fromAfFile2, continueSession]);
|
|
79312
|
-
|
|
79422
|
+
useEffect26(() => {
|
|
79313
79423
|
if (loadingState !== "assembling")
|
|
79314
79424
|
return;
|
|
79315
79425
|
async function init() {
|
|
@@ -79321,7 +79431,8 @@ Error: ${message}`);
|
|
|
79321
79431
|
resumingAgentId = agentIdArg;
|
|
79322
79432
|
} catch {}
|
|
79323
79433
|
}
|
|
79324
|
-
|
|
79434
|
+
const shouldCreateNew = forceNew2 || userRequestedNewAgent;
|
|
79435
|
+
if (!resumingAgentId && !shouldCreateNew) {
|
|
79325
79436
|
const localProjectSettings = settingsManager2.getLocalProjectSettings();
|
|
79326
79437
|
if (localProjectSettings?.lastAgent) {
|
|
79327
79438
|
try {
|
|
@@ -79388,7 +79499,7 @@ Error: ${message}`);
|
|
|
79388
79499
|
process.exit(1);
|
|
79389
79500
|
}
|
|
79390
79501
|
}
|
|
79391
|
-
if (!agent &&
|
|
79502
|
+
if (!agent && shouldCreateNew) {
|
|
79392
79503
|
const updateArgs = getModelUpdateArgs3(model);
|
|
79393
79504
|
const result = await createAgent3(undefined, model, undefined, updateArgs, skillsDirectory2, true, sleeptimeFlag ?? settings.enableSleeptime, systemPromptPreset2, initBlocks2, baseTools2);
|
|
79394
79505
|
agent = result.agent;
|
|
@@ -79446,8 +79557,8 @@ Error: ${message}`);
|
|
|
79446
79557
|
} catch (error) {
|
|
79447
79558
|
console.warn(`Failed to update skills: ${error instanceof Error ? error.message : String(error)}`);
|
|
79448
79559
|
}
|
|
79449
|
-
const isResumingProject = !
|
|
79450
|
-
const isReusingExistingAgent = !
|
|
79560
|
+
const isResumingProject = !shouldCreateNew && !!resumingAgentId;
|
|
79561
|
+
const isReusingExistingAgent = !shouldCreateNew && !fromAfFile2 && agent && agent.id;
|
|
79451
79562
|
const resuming = !!(continueSession || agentIdArg || isResumingProject || isReusingExistingAgent);
|
|
79452
79563
|
setIsResumingSession(resuming);
|
|
79453
79564
|
if (resuming && (model || systemPromptPreset2)) {
|
|
@@ -79500,6 +79611,7 @@ Error during initialization: ${message}`);
|
|
|
79500
79611
|
}, [
|
|
79501
79612
|
continueSession,
|
|
79502
79613
|
forceNew2,
|
|
79614
|
+
userRequestedNewAgent,
|
|
79503
79615
|
agentIdArg,
|
|
79504
79616
|
model,
|
|
79505
79617
|
systemPromptPreset2,
|
|
@@ -79524,6 +79636,7 @@ Error during initialization: ${message}`);
|
|
|
79524
79636
|
setLoadingState("assembling");
|
|
79525
79637
|
},
|
|
79526
79638
|
onCreateNew: () => {
|
|
79639
|
+
setUserRequestedNewAgent(true);
|
|
79527
79640
|
setLoadingState("assembling");
|
|
79528
79641
|
},
|
|
79529
79642
|
onExit: () => {
|
|
@@ -79572,4 +79685,4 @@ Error during initialization: ${message}`);
|
|
|
79572
79685
|
}
|
|
79573
79686
|
main();
|
|
79574
79687
|
|
|
79575
|
-
//# debugId=
|
|
79688
|
+
//# debugId=F6FA3742BB8A91B864756E2164756E21
|