@harperfast/agent 0.16.4 → 0.16.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/agent.js +242 -290
- package/package.json +3 -3
package/dist/agent.js
CHANGED
|
@@ -1195,14 +1195,6 @@ async function needsApproval(runContext, operation, callId) {
|
|
|
1195
1195
|
}
|
|
1196
1196
|
const autoApproved = getEnv("HARPER_AGENT_AUTO_APPROVE_PATCHES", "APPLY_PATCH_AUTO_APPROVE") === "1";
|
|
1197
1197
|
if (autoApproved) {
|
|
1198
|
-
if (callId) {
|
|
1199
|
-
emitToListeners("RegisterToolInfo", {
|
|
1200
|
-
type: operation.type,
|
|
1201
|
-
path: operation.path,
|
|
1202
|
-
diff: operation.diff,
|
|
1203
|
-
callId
|
|
1204
|
-
});
|
|
1205
|
-
}
|
|
1206
1198
|
return false;
|
|
1207
1199
|
}
|
|
1208
1200
|
emitToListeners("OpenApprovalViewer", {
|
|
@@ -1485,13 +1477,6 @@ async function needsApproval2(runContext, parameters, callId) {
|
|
|
1485
1477
|
}
|
|
1486
1478
|
const autoApproved = getEnv("HARPER_AGENT_AUTO_APPROVE_CODE_INTERPRETER", "CODE_INTERPRETER_AUTO_APPROVE") === "1";
|
|
1487
1479
|
if (autoApproved) {
|
|
1488
|
-
if (callId) {
|
|
1489
|
-
emitToListeners("RegisterToolInfo", {
|
|
1490
|
-
type: "code_interpreter",
|
|
1491
|
-
code: parameters.code,
|
|
1492
|
-
callId
|
|
1493
|
-
});
|
|
1494
|
-
}
|
|
1495
1480
|
return false;
|
|
1496
1481
|
}
|
|
1497
1482
|
emitToListeners("OpenApprovalViewer", {
|
|
@@ -1740,15 +1725,8 @@ function isRiskyCommand(command) {
|
|
|
1740
1725
|
// utils/shell/LocalShell.ts
|
|
1741
1726
|
import { exec as exec3 } from "child_process";
|
|
1742
1727
|
import { promisify as promisify5 } from "util";
|
|
1743
|
-
|
|
1744
|
-
// ink/contexts/ShellContext.tsx
|
|
1745
|
-
import { createContext, useContext, useMemo, useState } from "react";
|
|
1746
|
-
import { jsx } from "react/jsx-runtime";
|
|
1747
|
-
var ShellContext = createContext(void 0);
|
|
1748
|
-
var commandId = 0;
|
|
1749
|
-
|
|
1750
|
-
// utils/shell/LocalShell.ts
|
|
1751
1728
|
var execAsync3 = promisify5(exec3);
|
|
1729
|
+
var commandId = 0;
|
|
1752
1730
|
var LocalShell = class {
|
|
1753
1731
|
defaultTimeoutMs;
|
|
1754
1732
|
constructor(options) {
|
|
@@ -1769,12 +1747,7 @@ var LocalShell = class {
|
|
|
1769
1747
|
const parts = command.split(" ");
|
|
1770
1748
|
const firstPart = parts[0];
|
|
1771
1749
|
const laterParts = parts.slice(1).join(" ") || "";
|
|
1772
|
-
|
|
1773
|
-
emitToListeners("AddShellCommand", {
|
|
1774
|
-
command: firstPart,
|
|
1775
|
-
args: laterParts,
|
|
1776
|
-
running: true
|
|
1777
|
-
});
|
|
1750
|
+
const myCommandId = ++commandId;
|
|
1778
1751
|
emitToListeners("AddActionItem", {
|
|
1779
1752
|
id: myCommandId,
|
|
1780
1753
|
kind: "shell",
|
|
@@ -1800,11 +1773,6 @@ var LocalShell = class {
|
|
|
1800
1773
|
stderr = error?.stderr ?? "";
|
|
1801
1774
|
outcome = error?.killed || error?.signal === "SIGTERM" ? { type: "timeout" } : { type: "exit", exitCode };
|
|
1802
1775
|
}
|
|
1803
|
-
emitToListeners("UpdateShellCommand", {
|
|
1804
|
-
id: myCommandId,
|
|
1805
|
-
running: false,
|
|
1806
|
-
exitCode
|
|
1807
|
-
});
|
|
1808
1776
|
emitToListeners("UpdateActionItem", {
|
|
1809
1777
|
id: myCommandId,
|
|
1810
1778
|
running: false,
|
|
@@ -1864,13 +1832,6 @@ TIMEOUT`;
|
|
|
1864
1832
|
const foundIgnoredInteraction = commands.find((command) => mentionsIgnoredPath(command));
|
|
1865
1833
|
const autoApproved = getEnv("HARPER_AGENT_AUTO_APPROVE_SHELL", "SHELL_AUTO_APPROVE") === "1" && !foundRiskyCommand && !foundIgnoredInteraction;
|
|
1866
1834
|
if (autoApproved) {
|
|
1867
|
-
if (callId) {
|
|
1868
|
-
emitToListeners("RegisterToolInfo", {
|
|
1869
|
-
type: "shell",
|
|
1870
|
-
commands,
|
|
1871
|
-
callId
|
|
1872
|
-
});
|
|
1873
|
-
}
|
|
1874
1835
|
return false;
|
|
1875
1836
|
}
|
|
1876
1837
|
emitToListeners("OpenApprovalViewer", {
|
|
@@ -3274,11 +3235,11 @@ function createSession(sessionPath = null) {
|
|
|
3274
3235
|
import { run as run2, system as system2 } from "@openai/agents";
|
|
3275
3236
|
|
|
3276
3237
|
// ink/contexts/ActionsContext.tsx
|
|
3277
|
-
import { createContext
|
|
3278
|
-
import { jsx
|
|
3279
|
-
var ActionsContext =
|
|
3238
|
+
import { createContext, useContext, useEffect as useEffect2, useMemo, useState } from "react";
|
|
3239
|
+
import { jsx } from "react/jsx-runtime";
|
|
3240
|
+
var ActionsContext = createContext(void 0);
|
|
3280
3241
|
var useActions = () => {
|
|
3281
|
-
const context =
|
|
3242
|
+
const context = useContext(ActionsContext);
|
|
3282
3243
|
if (!context) {
|
|
3283
3244
|
throw new Error("useActions must be used within an ActionsProvider");
|
|
3284
3245
|
}
|
|
@@ -3286,7 +3247,7 @@ var useActions = () => {
|
|
|
3286
3247
|
};
|
|
3287
3248
|
var actionId = 0;
|
|
3288
3249
|
var ActionsProvider = ({ children }) => {
|
|
3289
|
-
const [actions, setActions] =
|
|
3250
|
+
const [actions, setActions] = useState([]);
|
|
3290
3251
|
useListener("AddActionItem", (action) => {
|
|
3291
3252
|
setActions((prev) => {
|
|
3292
3253
|
const assignedId = action.id ?? actionId++;
|
|
@@ -3310,8 +3271,8 @@ var ActionsProvider = ({ children }) => {
|
|
|
3310
3271
|
}
|
|
3311
3272
|
}
|
|
3312
3273
|
}, []);
|
|
3313
|
-
const value =
|
|
3314
|
-
return /* @__PURE__ */
|
|
3274
|
+
const value = useMemo(() => ({ actions }), [actions]);
|
|
3275
|
+
return /* @__PURE__ */ jsx(ActionsContext.Provider, { value, children });
|
|
3315
3276
|
};
|
|
3316
3277
|
|
|
3317
3278
|
// utils/sessions/cost.ts
|
|
@@ -3543,10 +3504,6 @@ Last tool call: ${lastToolCallInfo}` : "";
|
|
|
3543
3504
|
// agent/runAgentForOnePass.ts
|
|
3544
3505
|
async function runAgentForOnePass(agent, session, input, controller, isPrompt) {
|
|
3545
3506
|
let lastToolCallInfo = null;
|
|
3546
|
-
const toolInfoMap = /* @__PURE__ */ new Map();
|
|
3547
|
-
const removeToolListener = addListener("RegisterToolInfo", (info) => {
|
|
3548
|
-
toolInfoMap.set(info.callId, info);
|
|
3549
|
-
});
|
|
3550
3507
|
try {
|
|
3551
3508
|
let hasStartedResponse = false;
|
|
3552
3509
|
let adjustedInput = input;
|
|
@@ -3872,7 +3829,6 @@ async function runAgentForOnePass(agent, session, input, controller, isPrompt) {
|
|
|
3872
3829
|
}
|
|
3873
3830
|
emitToListeners("SetThinking", true);
|
|
3874
3831
|
setTimeout(curryEmitToListeners("SetInputMode", "waiting"), 1e3);
|
|
3875
|
-
removeToolListener();
|
|
3876
3832
|
return stream.state;
|
|
3877
3833
|
} else {
|
|
3878
3834
|
costTracker.recordTurn(
|
|
@@ -3882,7 +3838,6 @@ async function runAgentForOnePass(agent, session, input, controller, isPrompt) {
|
|
|
3882
3838
|
);
|
|
3883
3839
|
emitToListeners("UpdateCost", costTracker.getSessionStats());
|
|
3884
3840
|
}
|
|
3885
|
-
removeToolListener();
|
|
3886
3841
|
return null;
|
|
3887
3842
|
} catch (error) {
|
|
3888
3843
|
if (error?.name?.includes("MaxTurnsExceededError")) {
|
|
@@ -4157,14 +4112,14 @@ import "react";
|
|
|
4157
4112
|
// ink/components/ChatContent.tsx
|
|
4158
4113
|
import { Spinner as Spinner2 } from "@inkjs/ui";
|
|
4159
4114
|
import { Box as Box10, Text as Text10, useInput as useInput4 } from "ink";
|
|
4160
|
-
import React11, { useCallback as useCallback5, useEffect as useEffect8, useMemo as
|
|
4115
|
+
import React11, { useCallback as useCallback5, useEffect as useEffect8, useMemo as useMemo10, useRef as useRef2, useState as useState13 } from "react";
|
|
4161
4116
|
|
|
4162
4117
|
// ink/contexts/ChatContext.tsx
|
|
4163
|
-
import { createContext as
|
|
4164
|
-
import { jsx as
|
|
4165
|
-
var ChatContext =
|
|
4118
|
+
import { createContext as createContext2, useContext as useContext2, useMemo as useMemo2, useState as useState2 } from "react";
|
|
4119
|
+
import { jsx as jsx2 } from "react/jsx-runtime";
|
|
4120
|
+
var ChatContext = createContext2(void 0);
|
|
4166
4121
|
var useChat = () => {
|
|
4167
|
-
const context =
|
|
4122
|
+
const context = useContext2(ChatContext);
|
|
4168
4123
|
if (!context) {
|
|
4169
4124
|
throw new Error("useChat must be used within a ChatProvider");
|
|
4170
4125
|
}
|
|
@@ -4189,12 +4144,12 @@ function getInitialMessages() {
|
|
|
4189
4144
|
var ChatProvider = ({
|
|
4190
4145
|
children
|
|
4191
4146
|
}) => {
|
|
4192
|
-
const [messages, setMessages] =
|
|
4193
|
-
const [userInputMode, setUserInputMode] =
|
|
4194
|
-
const [isThinking, setIsThinking] =
|
|
4195
|
-
const [isCompacting, setIsCompacting] =
|
|
4196
|
-
const [pullingState, setPullingState] =
|
|
4197
|
-
const [focusedArea, setFocusedArea] =
|
|
4147
|
+
const [messages, setMessages] = useState2(getInitialMessages());
|
|
4148
|
+
const [userInputMode, setUserInputMode] = useState2("waiting");
|
|
4149
|
+
const [isThinking, setIsThinking] = useState2(false);
|
|
4150
|
+
const [isCompacting, setIsCompacting] = useState2(false);
|
|
4151
|
+
const [pullingState, setPullingState] = useState2(null);
|
|
4152
|
+
const [focusedArea, setFocusedArea] = useState2("input");
|
|
4198
4153
|
useListener("PushNewMessages", (messages2) => {
|
|
4199
4154
|
setMessages((prev) => {
|
|
4200
4155
|
return prev.concat(
|
|
@@ -4246,7 +4201,7 @@ var ChatProvider = ({
|
|
|
4246
4201
|
version: 1
|
|
4247
4202
|
}]);
|
|
4248
4203
|
}, []);
|
|
4249
|
-
const value =
|
|
4204
|
+
const value = useMemo2(() => ({
|
|
4250
4205
|
messages,
|
|
4251
4206
|
userInputMode,
|
|
4252
4207
|
isThinking,
|
|
@@ -4255,7 +4210,7 @@ var ChatProvider = ({
|
|
|
4255
4210
|
focusedArea,
|
|
4256
4211
|
setFocusedArea
|
|
4257
4212
|
}), [messages, userInputMode, isThinking, isCompacting, pullingState, focusedArea]);
|
|
4258
|
-
return /* @__PURE__ */
|
|
4213
|
+
return /* @__PURE__ */ jsx2(ChatContext.Provider, { value, children });
|
|
4259
4214
|
};
|
|
4260
4215
|
|
|
4261
4216
|
// ink/bindings/useMessageListener.ts
|
|
@@ -4302,19 +4257,19 @@ function useMessageListener() {
|
|
|
4302
4257
|
var footerHeight = 2;
|
|
4303
4258
|
|
|
4304
4259
|
// ink/contexts/ApprovalContext.tsx
|
|
4305
|
-
import { createContext as
|
|
4306
|
-
import { jsx as
|
|
4307
|
-
var ApprovalContext =
|
|
4260
|
+
import { createContext as createContext3, useCallback as useCallback2, useContext as useContext3, useMemo as useMemo3, useState as useState3 } from "react";
|
|
4261
|
+
import { jsx as jsx3 } from "react/jsx-runtime";
|
|
4262
|
+
var ApprovalContext = createContext3(void 0);
|
|
4308
4263
|
var useApproval = () => {
|
|
4309
|
-
const context =
|
|
4264
|
+
const context = useContext3(ApprovalContext);
|
|
4310
4265
|
if (!context) {
|
|
4311
4266
|
throw new Error("useApproval must be used within an ApprovalProvider");
|
|
4312
4267
|
}
|
|
4313
4268
|
return context;
|
|
4314
4269
|
};
|
|
4315
4270
|
var ApprovalProvider = ({ children }) => {
|
|
4316
|
-
const [payload, setPayload] =
|
|
4317
|
-
const [toolInfos] =
|
|
4271
|
+
const [payload, setPayload] = useState3(null);
|
|
4272
|
+
const [toolInfos] = useState3(/* @__PURE__ */ new Map());
|
|
4318
4273
|
const registerToolInfo = useCallback2(
|
|
4319
4274
|
(info) => {
|
|
4320
4275
|
toolInfos.set(info.callId, info);
|
|
@@ -4340,26 +4295,23 @@ var ApprovalProvider = ({ children }) => {
|
|
|
4340
4295
|
}
|
|
4341
4296
|
setPayload(finalPayload);
|
|
4342
4297
|
}, [registerToolInfo, toolInfos]);
|
|
4343
|
-
useListener("RegisterToolInfo", (info) => {
|
|
4344
|
-
registerToolInfo(info);
|
|
4345
|
-
}, [registerToolInfo]);
|
|
4346
4298
|
useListener("CloseApprovalViewer", () => {
|
|
4347
4299
|
setPayload(null);
|
|
4348
4300
|
}, []);
|
|
4349
|
-
const value =
|
|
4301
|
+
const value = useMemo3(() => ({
|
|
4350
4302
|
payload,
|
|
4351
4303
|
setPayload,
|
|
4352
4304
|
registerToolInfo
|
|
4353
4305
|
}), [payload, registerToolInfo]);
|
|
4354
|
-
return /* @__PURE__ */
|
|
4306
|
+
return /* @__PURE__ */ jsx3(ApprovalContext.Provider, { value, children });
|
|
4355
4307
|
};
|
|
4356
4308
|
|
|
4357
4309
|
// ink/contexts/PlanContext.tsx
|
|
4358
|
-
import { createContext as
|
|
4359
|
-
import { jsx as
|
|
4360
|
-
var PlanContext =
|
|
4310
|
+
import { createContext as createContext4, useContext as useContext4, useMemo as useMemo4, useState as useState4 } from "react";
|
|
4311
|
+
import { jsx as jsx4 } from "react/jsx-runtime";
|
|
4312
|
+
var PlanContext = createContext4(globalPlanContext);
|
|
4361
4313
|
var usePlan = () => {
|
|
4362
|
-
const context =
|
|
4314
|
+
const context = useContext4(PlanContext);
|
|
4363
4315
|
if (!context) {
|
|
4364
4316
|
throw new Error("usePlan must be used within a PlanProvider");
|
|
4365
4317
|
}
|
|
@@ -4368,9 +4320,9 @@ var usePlan = () => {
|
|
|
4368
4320
|
var PlanProvider = ({
|
|
4369
4321
|
children
|
|
4370
4322
|
}) => {
|
|
4371
|
-
const [planDescription, setPlanDescription] =
|
|
4372
|
-
const [planItems, setPlanItems] =
|
|
4373
|
-
const [progress, setProgress] =
|
|
4323
|
+
const [planDescription, setPlanDescription] = useState4(globalPlanContext.planDescription);
|
|
4324
|
+
const [planItems, setPlanItems] = useState4(globalPlanContext.planItems);
|
|
4325
|
+
const [progress, setProgress] = useState4(globalPlanContext.progress);
|
|
4374
4326
|
useListener("SetPlanDescription", (newGoal) => {
|
|
4375
4327
|
globalPlanContext.planDescription = newGoal;
|
|
4376
4328
|
setPlanDescription(newGoal);
|
|
@@ -4383,20 +4335,20 @@ var PlanProvider = ({
|
|
|
4383
4335
|
setPlanItems(planItems2);
|
|
4384
4336
|
setProgress(progress2);
|
|
4385
4337
|
}, []);
|
|
4386
|
-
const value =
|
|
4338
|
+
const value = useMemo4(() => ({
|
|
4387
4339
|
progress,
|
|
4388
4340
|
planDescription,
|
|
4389
4341
|
planItems
|
|
4390
4342
|
}), [progress, planDescription, planItems]);
|
|
4391
|
-
return /* @__PURE__ */
|
|
4343
|
+
return /* @__PURE__ */ jsx4(PlanContext.Provider, { value, children });
|
|
4392
4344
|
};
|
|
4393
4345
|
|
|
4394
4346
|
// ink/library/useTerminalSize.ts
|
|
4395
4347
|
import { useStdout } from "ink";
|
|
4396
|
-
import { useEffect as useEffect3, useState as
|
|
4348
|
+
import { useEffect as useEffect3, useState as useState5 } from "react";
|
|
4397
4349
|
function useTerminalSize() {
|
|
4398
4350
|
const { stdout } = useStdout();
|
|
4399
|
-
const [size, setSize] =
|
|
4351
|
+
const [size, setSize] = useState5({
|
|
4400
4352
|
rows: stdout?.rows ?? 24,
|
|
4401
4353
|
columns: stdout?.columns ?? 80
|
|
4402
4354
|
});
|
|
@@ -4467,18 +4419,18 @@ function wrapText(text, width) {
|
|
|
4467
4419
|
|
|
4468
4420
|
// ink/components/ActionsView.tsx
|
|
4469
4421
|
import { Box as Box3, Text as Text3, useInput } from "ink";
|
|
4470
|
-
import { useCallback as useCallback3, useEffect as useEffect5, useState as
|
|
4422
|
+
import { useCallback as useCallback3, useEffect as useEffect5, useState as useState7 } from "react";
|
|
4471
4423
|
|
|
4472
4424
|
// ink/components/ActionItemRow.tsx
|
|
4473
4425
|
import { Spinner } from "@inkjs/ui";
|
|
4474
4426
|
import { Box, Text } from "ink";
|
|
4475
4427
|
import { memo } from "react";
|
|
4476
|
-
import { jsx as
|
|
4428
|
+
import { jsx as jsx5, jsxs } from "react/jsx-runtime";
|
|
4477
4429
|
var ActionItemRow = memo(
|
|
4478
4430
|
({ item, isSelected, isFocused, width }) => {
|
|
4479
4431
|
const statusColor = item.running ? "yellow" : item.status === "approved" || item.status === "succeeded" || typeof item.exitCode === "number" && item.exitCode === 0 ? "green" : item.status === "denied" || item.status === "failed" || typeof item.exitCode === "number" && item.exitCode !== 0 ? "red" : "cyan";
|
|
4480
4432
|
const selectionColor = isFocused ? "cyan" : "gray";
|
|
4481
|
-
const pipe = /* @__PURE__ */
|
|
4433
|
+
const pipe = /* @__PURE__ */ jsx5(Text, { color: isSelected ? selectionColor : "gray", bold: isSelected, children: isSelected ? "\u2503 " : "\u2502 " });
|
|
4482
4434
|
const statusLabel = item.running ? " " : item.kind === "approval" ? item.status === "approved" ? " approved" : item.status === "denied" ? " denied" : "" : typeof item.exitCode === "number" ? ` ${item.exitCode}` : "";
|
|
4483
4435
|
const statusLabelWidth = item.running ? 2 : statusLabel.length;
|
|
4484
4436
|
const pipeWidth = 3;
|
|
@@ -4496,24 +4448,24 @@ var ActionItemRow = memo(
|
|
|
4496
4448
|
return /* @__PURE__ */ jsxs(Box, { children: [
|
|
4497
4449
|
pipe,
|
|
4498
4450
|
/* @__PURE__ */ jsxs(Box, { flexGrow: 1, children: [
|
|
4499
|
-
/* @__PURE__ */
|
|
4451
|
+
/* @__PURE__ */ jsx5(Text, { color: statusColor, bold: true, children: item.title }),
|
|
4500
4452
|
/* @__PURE__ */ jsxs(Text, { color: "gray", children: [
|
|
4501
4453
|
" ",
|
|
4502
4454
|
displayedDetail
|
|
4503
4455
|
] })
|
|
4504
4456
|
] }),
|
|
4505
|
-
/* @__PURE__ */
|
|
4506
|
-
/* @__PURE__ */
|
|
4507
|
-
/* @__PURE__ */
|
|
4508
|
-
] }) : /* @__PURE__ */
|
|
4457
|
+
/* @__PURE__ */ jsx5(Box, { children: item.running ? /* @__PURE__ */ jsxs(Box, { children: [
|
|
4458
|
+
/* @__PURE__ */ jsx5(Text, { color: "yellow" }),
|
|
4459
|
+
/* @__PURE__ */ jsx5(Spinner, { type: "dots" })
|
|
4460
|
+
] }) : /* @__PURE__ */ jsx5(Text, { color: statusColor, bold: true, children: statusLabel }) })
|
|
4509
4461
|
] });
|
|
4510
4462
|
}
|
|
4511
4463
|
);
|
|
4512
4464
|
|
|
4513
4465
|
// ink/components/VirtualList.tsx
|
|
4514
4466
|
import { Box as Box2, Text as Text2 } from "ink";
|
|
4515
|
-
import { forwardRef, useEffect as useEffect4, useImperativeHandle, useMemo as
|
|
4516
|
-
import { jsx as
|
|
4467
|
+
import { forwardRef, useEffect as useEffect4, useImperativeHandle, useMemo as useMemo5, useRef, useState as useState6 } from "react";
|
|
4468
|
+
import { jsx as jsx6, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
4517
4469
|
function getDefaultKey(item, index) {
|
|
4518
4470
|
if (item && typeof item === "object") {
|
|
4519
4471
|
if ("id" in item && (typeof item.id === "string" || typeof item.id === "number")) {
|
|
@@ -4543,7 +4495,7 @@ var VirtualListInner = (props, ref) => {
|
|
|
4543
4495
|
onViewportChange
|
|
4544
4496
|
} = props;
|
|
4545
4497
|
const { rows: terminalRows } = useTerminalSize();
|
|
4546
|
-
const resolvedHeight =
|
|
4498
|
+
const resolvedHeight = useMemo5(() => {
|
|
4547
4499
|
if (typeof propHeight === "number") {
|
|
4548
4500
|
return propHeight;
|
|
4549
4501
|
}
|
|
@@ -4553,7 +4505,7 @@ var VirtualListInner = (props, ref) => {
|
|
|
4553
4505
|
}
|
|
4554
4506
|
return Math.max(1, terminalRows - reservedLines);
|
|
4555
4507
|
}, [propHeight, terminalRows, reservedLines]);
|
|
4556
|
-
const getItemHeight =
|
|
4508
|
+
const getItemHeight = useMemo5(() => {
|
|
4557
4509
|
if (getItemHeightProp) {
|
|
4558
4510
|
return getItemHeightProp;
|
|
4559
4511
|
}
|
|
@@ -4564,14 +4516,14 @@ var VirtualListInner = (props, ref) => {
|
|
|
4564
4516
|
}, [getItemHeightProp, fixedItemHeight]);
|
|
4565
4517
|
const indicatorLines = showOverflowIndicators ? 2 : 0;
|
|
4566
4518
|
const availableHeight = Math.max(0, resolvedHeight - indicatorLines);
|
|
4567
|
-
const [viewportOffset, setViewportOffset] =
|
|
4519
|
+
const [viewportOffset, setViewportOffset] = useState6(0);
|
|
4568
4520
|
const lastItemsLength = useRef(items.length);
|
|
4569
4521
|
const viewportOffsetRef = useRef(viewportOffset);
|
|
4570
4522
|
useEffect4(() => {
|
|
4571
4523
|
viewportOffsetRef.current = viewportOffset;
|
|
4572
4524
|
}, [viewportOffset]);
|
|
4573
4525
|
const clampedSelectedIndex = Math.max(0, Math.min(selectedIndex, items.length - 1));
|
|
4574
|
-
const { visibleCount, visibleItems } =
|
|
4526
|
+
const { visibleCount, visibleItems } = useMemo5(() => {
|
|
4575
4527
|
if (availableHeight <= 0) {
|
|
4576
4528
|
return { visibleCount: 0, visibleItems: [] };
|
|
4577
4529
|
}
|
|
@@ -4636,7 +4588,7 @@ var VirtualListInner = (props, ref) => {
|
|
|
4636
4588
|
}
|
|
4637
4589
|
}
|
|
4638
4590
|
}, [clampedSelectedIndex, items, availableHeight, getItemHeight, visibleCount]);
|
|
4639
|
-
const viewport =
|
|
4591
|
+
const viewport = useMemo5(
|
|
4640
4592
|
() => ({
|
|
4641
4593
|
offset: viewportOffset,
|
|
4642
4594
|
visibleCount,
|
|
@@ -4768,7 +4720,7 @@ var VirtualListInner = (props, ref) => {
|
|
|
4768
4720
|
if (count < overflowIndicatorThreshold) {
|
|
4769
4721
|
return null;
|
|
4770
4722
|
}
|
|
4771
|
-
return /* @__PURE__ */
|
|
4723
|
+
return /* @__PURE__ */ jsx6(Box2, { paddingLeft: 2, children: /* @__PURE__ */ jsxs2(Text2, { dimColor: true, children: [
|
|
4772
4724
|
"\u25B2 ",
|
|
4773
4725
|
count,
|
|
4774
4726
|
" more"
|
|
@@ -4778,7 +4730,7 @@ var VirtualListInner = (props, ref) => {
|
|
|
4778
4730
|
if (count < overflowIndicatorThreshold) {
|
|
4779
4731
|
return null;
|
|
4780
4732
|
}
|
|
4781
|
-
return /* @__PURE__ */
|
|
4733
|
+
return /* @__PURE__ */ jsx6(Box2, { paddingLeft: 2, children: /* @__PURE__ */ jsxs2(Text2, { dimColor: true, children: [
|
|
4782
4734
|
"\u25BC ",
|
|
4783
4735
|
count,
|
|
4784
4736
|
" more"
|
|
@@ -4787,7 +4739,7 @@ var VirtualListInner = (props, ref) => {
|
|
|
4787
4739
|
const topIndicator = renderOverflowTop ?? defaultOverflowTop;
|
|
4788
4740
|
const bottomIndicator = renderOverflowBottom ?? defaultOverflowBottom;
|
|
4789
4741
|
return /* @__PURE__ */ jsxs2(Box2, { flexDirection: "column", height: resolvedHeight, children: [
|
|
4790
|
-
showOverflowIndicators && /* @__PURE__ */
|
|
4742
|
+
showOverflowIndicators && /* @__PURE__ */ jsx6(Box2, { height: 1, children: topIndicator(overflowTop) }),
|
|
4791
4743
|
/* @__PURE__ */ jsxs2(Box2, { flexDirection: "column", flexGrow: 1, children: [
|
|
4792
4744
|
visibleItems.map((item, idx) => {
|
|
4793
4745
|
const actualIndex = viewportOffset + idx;
|
|
@@ -4797,20 +4749,20 @@ var VirtualListInner = (props, ref) => {
|
|
|
4797
4749
|
index: actualIndex,
|
|
4798
4750
|
isSelected: actualIndex === clampedSelectedIndex
|
|
4799
4751
|
};
|
|
4800
|
-
return /* @__PURE__ */
|
|
4752
|
+
return /* @__PURE__ */ jsx6(Box2, { height: getItemHeight(item, actualIndex), overflow: "hidden", children: renderItem(itemProps) }, key);
|
|
4801
4753
|
}),
|
|
4802
|
-
renderFiller && hSum < availableHeight && /* @__PURE__ */
|
|
4754
|
+
renderFiller && hSum < availableHeight && /* @__PURE__ */ jsx6(Box2, { flexDirection: "column", flexGrow: 1, children: renderFiller(availableHeight - hSum) })
|
|
4803
4755
|
] }),
|
|
4804
|
-
showOverflowIndicators && /* @__PURE__ */
|
|
4756
|
+
showOverflowIndicators && /* @__PURE__ */ jsx6(Box2, { height: 1, children: bottomIndicator(overflowBottom) })
|
|
4805
4757
|
] });
|
|
4806
4758
|
};
|
|
4807
4759
|
var VirtualList = forwardRef(VirtualListInner);
|
|
4808
4760
|
|
|
4809
4761
|
// ink/components/ActionsView.tsx
|
|
4810
|
-
import { jsx as
|
|
4762
|
+
import { jsx as jsx7, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
4811
4763
|
function ActionsView({ height, isFocused }) {
|
|
4812
4764
|
const { actions } = useActions();
|
|
4813
|
-
const [selectedIndex, setSelectedIndex] =
|
|
4765
|
+
const [selectedIndex, setSelectedIndex] = useState7(0);
|
|
4814
4766
|
const size = useTerminalSize();
|
|
4815
4767
|
const timelineWidth = Math.floor(size.columns * 0.65);
|
|
4816
4768
|
const statusWidth = size.columns - timelineWidth;
|
|
@@ -4844,7 +4796,7 @@ function ActionsView({ height, isFocused }) {
|
|
|
4844
4796
|
}
|
|
4845
4797
|
});
|
|
4846
4798
|
const renderOverflowTop = useCallback3((count) => /* @__PURE__ */ jsxs3(Box3, { children: [
|
|
4847
|
-
/* @__PURE__ */
|
|
4799
|
+
/* @__PURE__ */ jsx7(Text3, { color: "gray", dimColor: true, children: "\u2502" }),
|
|
4848
4800
|
count > 0 && /* @__PURE__ */ jsxs3(Text3, { dimColor: true, children: [
|
|
4849
4801
|
" ",
|
|
4850
4802
|
"\u25B2 ",
|
|
@@ -4853,7 +4805,7 @@ function ActionsView({ height, isFocused }) {
|
|
|
4853
4805
|
] })
|
|
4854
4806
|
] }), []);
|
|
4855
4807
|
const renderOverflowBottom = useCallback3((count) => /* @__PURE__ */ jsxs3(Box3, { children: [
|
|
4856
|
-
/* @__PURE__ */
|
|
4808
|
+
/* @__PURE__ */ jsx7(Text3, { color: "gray", dimColor: true, children: "\u2502" }),
|
|
4857
4809
|
count > 0 && /* @__PURE__ */ jsxs3(Text3, { dimColor: true, children: [
|
|
4858
4810
|
" ",
|
|
4859
4811
|
"\u25BC ",
|
|
@@ -4861,15 +4813,15 @@ function ActionsView({ height, isFocused }) {
|
|
|
4861
4813
|
" more"
|
|
4862
4814
|
] })
|
|
4863
4815
|
] }), []);
|
|
4864
|
-
const renderFiller = useCallback3((h) => /* @__PURE__ */
|
|
4816
|
+
const renderFiller = useCallback3((h) => /* @__PURE__ */ jsx7(Box3, { flexDirection: "column", children: Array.from({ length: h }).map((_, i) => /* @__PURE__ */ jsx7(Box3, { children: /* @__PURE__ */ jsx7(Text3, { color: "gray", dimColor: true, children: "\u2502" }) }, i)) }), []);
|
|
4865
4817
|
const getItemHeight = useCallback3((_item) => 1, []);
|
|
4866
4818
|
if (actions.length === 0) {
|
|
4867
4819
|
return /* @__PURE__ */ jsxs3(Box3, { flexDirection: "column", flexGrow: 1, height, children: [
|
|
4868
|
-
/* @__PURE__ */
|
|
4869
|
-
Array.from({ length: height - 1 }).map((_, i) => /* @__PURE__ */
|
|
4820
|
+
/* @__PURE__ */ jsx7(Box3, { children: /* @__PURE__ */ jsx7(Text3, { italic: true, color: "gray", children: "No actions yet." }) }),
|
|
4821
|
+
Array.from({ length: height - 1 }).map((_, i) => /* @__PURE__ */ jsx7(Box3, { children: /* @__PURE__ */ jsx7(Text3, {}) }, i))
|
|
4870
4822
|
] });
|
|
4871
4823
|
}
|
|
4872
|
-
return /* @__PURE__ */
|
|
4824
|
+
return /* @__PURE__ */ jsx7(Box3, { flexDirection: "column", flexGrow: 1, children: /* @__PURE__ */ jsx7(
|
|
4873
4825
|
VirtualList,
|
|
4874
4826
|
{
|
|
4875
4827
|
items: actions,
|
|
@@ -4879,7 +4831,7 @@ function ActionsView({ height, isFocused }) {
|
|
|
4879
4831
|
renderOverflowTop,
|
|
4880
4832
|
renderOverflowBottom,
|
|
4881
4833
|
renderFiller,
|
|
4882
|
-
renderItem: ({ item, isSelected }) => /* @__PURE__ */
|
|
4834
|
+
renderItem: ({ item, isSelected }) => /* @__PURE__ */ jsx7(ActionItemRow, { item, isSelected, isFocused, width: statusWidth - 2 })
|
|
4883
4835
|
}
|
|
4884
4836
|
) });
|
|
4885
4837
|
}
|
|
@@ -4889,11 +4841,11 @@ import { Box as Box4, Text as Text4 } from "ink";
|
|
|
4889
4841
|
import "react";
|
|
4890
4842
|
|
|
4891
4843
|
// ink/contexts/CostContext.tsx
|
|
4892
|
-
import { createContext as
|
|
4893
|
-
import { jsx as
|
|
4894
|
-
var CostContext =
|
|
4844
|
+
import { createContext as createContext5, useContext as useContext5, useMemo as useMemo6, useState as useState8 } from "react";
|
|
4845
|
+
import { jsx as jsx8 } from "react/jsx-runtime";
|
|
4846
|
+
var CostContext = createContext5(void 0);
|
|
4895
4847
|
var useCost = () => {
|
|
4896
|
-
const context =
|
|
4848
|
+
const context = useContext5(CostContext);
|
|
4897
4849
|
if (!context) {
|
|
4898
4850
|
throw new Error("useCost must be used within a CostProvider");
|
|
4899
4851
|
}
|
|
@@ -4902,7 +4854,7 @@ var useCost = () => {
|
|
|
4902
4854
|
var CostProvider = ({
|
|
4903
4855
|
children
|
|
4904
4856
|
}) => {
|
|
4905
|
-
const [cost, setCost] =
|
|
4857
|
+
const [cost, setCost] = useState8({
|
|
4906
4858
|
totalCost: 0,
|
|
4907
4859
|
inputTokens: 0,
|
|
4908
4860
|
outputTokens: 0,
|
|
@@ -4912,37 +4864,37 @@ var CostProvider = ({
|
|
|
4912
4864
|
useListener("UpdateCost", (newCost) => {
|
|
4913
4865
|
setCost(newCost);
|
|
4914
4866
|
}, []);
|
|
4915
|
-
const value =
|
|
4867
|
+
const value = useMemo6(() => ({
|
|
4916
4868
|
cost
|
|
4917
4869
|
}), [cost]);
|
|
4918
|
-
return /* @__PURE__ */
|
|
4870
|
+
return /* @__PURE__ */ jsx8(CostContext.Provider, { value, children });
|
|
4919
4871
|
};
|
|
4920
4872
|
|
|
4921
4873
|
// ink/components/CostView.tsx
|
|
4922
|
-
import { jsx as
|
|
4874
|
+
import { jsx as jsx9, jsxs as jsxs4 } from "react/jsx-runtime";
|
|
4923
4875
|
function CostView({ isDense = false }) {
|
|
4924
4876
|
const { cost } = useCost();
|
|
4925
4877
|
return /* @__PURE__ */ jsxs4(Box4, { flexDirection: "column", paddingLeft: 1, paddingTop: isDense ? 0 : 1, children: [
|
|
4926
|
-
/* @__PURE__ */
|
|
4878
|
+
/* @__PURE__ */ jsx9(Box4, { marginBottom: isDense ? 0 : 1, children: /* @__PURE__ */ jsx9(Text4, { bold: true, underline: true, color: "cyan", children: "Session Cost Breakdown" }) }),
|
|
4927
4879
|
/* @__PURE__ */ jsxs4(Box4, { children: [
|
|
4928
|
-
/* @__PURE__ */
|
|
4880
|
+
/* @__PURE__ */ jsx9(Box4, { width: 20, children: /* @__PURE__ */ jsx9(Text4, { children: "Total Cost:" }) }),
|
|
4929
4881
|
/* @__PURE__ */ jsxs4(Text4, { color: "green", children: [
|
|
4930
4882
|
"$",
|
|
4931
4883
|
cost.totalCost.toFixed(4)
|
|
4932
4884
|
] }),
|
|
4933
|
-
cost.hasUnknownPrices && /* @__PURE__ */
|
|
4885
|
+
cost.hasUnknownPrices && /* @__PURE__ */ jsx9(Text4, { color: "yellow", children: "(est.)" })
|
|
4934
4886
|
] }),
|
|
4935
4887
|
/* @__PURE__ */ jsxs4(Box4, { children: [
|
|
4936
|
-
/* @__PURE__ */
|
|
4937
|
-
/* @__PURE__ */
|
|
4888
|
+
/* @__PURE__ */ jsx9(Box4, { width: 20, children: /* @__PURE__ */ jsx9(Text4, { children: "Input Tokens:" }) }),
|
|
4889
|
+
/* @__PURE__ */ jsx9(Text4, { children: cost.inputTokens.toLocaleString() })
|
|
4938
4890
|
] }),
|
|
4939
4891
|
/* @__PURE__ */ jsxs4(Box4, { children: [
|
|
4940
|
-
/* @__PURE__ */
|
|
4941
|
-
/* @__PURE__ */
|
|
4892
|
+
/* @__PURE__ */ jsx9(Box4, { width: 20, children: /* @__PURE__ */ jsx9(Text4, { children: "Cached Tokens:" }) }),
|
|
4893
|
+
/* @__PURE__ */ jsx9(Text4, { color: "gray", children: cost.cachedInputTokens.toLocaleString() })
|
|
4942
4894
|
] }),
|
|
4943
4895
|
/* @__PURE__ */ jsxs4(Box4, { children: [
|
|
4944
|
-
/* @__PURE__ */
|
|
4945
|
-
/* @__PURE__ */
|
|
4896
|
+
/* @__PURE__ */ jsx9(Box4, { width: 20, children: /* @__PURE__ */ jsx9(Text4, { children: "Output Tokens:" }) }),
|
|
4897
|
+
/* @__PURE__ */ jsx9(Text4, { children: cost.outputTokens.toLocaleString() })
|
|
4946
4898
|
] })
|
|
4947
4899
|
] });
|
|
4948
4900
|
}
|
|
@@ -4950,7 +4902,7 @@ function CostView({ isDense = false }) {
|
|
|
4950
4902
|
// ink/components/MessageLineItem.tsx
|
|
4951
4903
|
import { Box as Box5, Text as Text5 } from "ink";
|
|
4952
4904
|
import { memo as memo2 } from "react";
|
|
4953
|
-
import { Fragment, jsx as
|
|
4905
|
+
import { Fragment, jsx as jsx10, jsxs as jsxs5 } from "react/jsx-runtime";
|
|
4954
4906
|
var MessageLineItem = memo2(
|
|
4955
4907
|
({
|
|
4956
4908
|
item,
|
|
@@ -4962,17 +4914,17 @@ var MessageLineItem = memo2(
|
|
|
4962
4914
|
const label = item.type === "interrupted" ? "" : item.type.toUpperCase();
|
|
4963
4915
|
const selectionColor = isFocused ? "cyan" : "gray";
|
|
4964
4916
|
return /* @__PURE__ */ jsxs5(Box5, { children: [
|
|
4965
|
-
/* @__PURE__ */
|
|
4966
|
-
/* @__PURE__ */
|
|
4917
|
+
/* @__PURE__ */ jsx10(Text5, { color: isSelected ? selectionColor : "gray", dimColor: !isSelected, bold: isSelected, children: isSelected ? "\u2503 " : "\u2502 " }),
|
|
4918
|
+
/* @__PURE__ */ jsx10(Box5, { paddingLeft: indent, children: item.isFirstLine ? /* @__PURE__ */ jsxs5(Text5, { children: [
|
|
4967
4919
|
label && /* @__PURE__ */ jsxs5(Text5, { bold: true, color, children: [
|
|
4968
4920
|
label,
|
|
4969
4921
|
item.type === "tool" ? ": " : item.isArgsLine ? " args: " : ": "
|
|
4970
4922
|
] }),
|
|
4971
|
-
item.type === "tool" && item.toolName ? /* @__PURE__ */
|
|
4972
|
-
/* @__PURE__ */
|
|
4973
|
-
/* @__PURE__ */
|
|
4974
|
-
] }) : /* @__PURE__ */
|
|
4975
|
-
] }) : /* @__PURE__ */
|
|
4923
|
+
item.type === "tool" && item.toolName ? /* @__PURE__ */ jsx10(Text5, { children: item.text.startsWith(item.toolName) ? /* @__PURE__ */ jsxs5(Fragment, { children: [
|
|
4924
|
+
/* @__PURE__ */ jsx10(Text5, { color: "white", bold: true, children: item.toolName }),
|
|
4925
|
+
/* @__PURE__ */ jsx10(Text5, { dimColor: true, italic: true, children: item.text.slice(item.toolName.length) })
|
|
4926
|
+
] }) : /* @__PURE__ */ jsx10(Text5, { dimColor: true, italic: true, children: item.text.startsWith(" ") ? item.text : ` ${item.text}` }) }) : /* @__PURE__ */ jsx10(Text5, { dimColor: !!item.isArgsLine, italic: !!item.isArgsLine, children: item.text })
|
|
4927
|
+
] }) : /* @__PURE__ */ jsx10(Text5, { children: item.type === "tool" && item.toolName ? /* @__PURE__ */ jsx10(Text5, { dimColor: true, italic: true, children: item.text }) : /* @__PURE__ */ jsx10(Text5, { dimColor: !!item.isArgsLine, italic: !!item.isArgsLine, children: item.text }) }) })
|
|
4976
4928
|
] });
|
|
4977
4929
|
}
|
|
4978
4930
|
);
|
|
@@ -4994,12 +4946,12 @@ function messageTypeToColor(type) {
|
|
|
4994
4946
|
import { ProgressBar } from "@inkjs/ui";
|
|
4995
4947
|
import { Box as Box6, Text as Text6 } from "ink";
|
|
4996
4948
|
import "react";
|
|
4997
|
-
import { jsx as
|
|
4949
|
+
import { jsx as jsx11, jsxs as jsxs6 } from "react/jsx-runtime";
|
|
4998
4950
|
function PlanView() {
|
|
4999
4951
|
const { planDescription, planItems, progress } = usePlan();
|
|
5000
4952
|
return /* @__PURE__ */ jsxs6(Box6, { flexDirection: "column", flexGrow: 1, children: [
|
|
5001
|
-
/* @__PURE__ */
|
|
5002
|
-
/* @__PURE__ */
|
|
4953
|
+
/* @__PURE__ */ jsx11(Box6, { flexDirection: "column", marginBottom: 1, children: /* @__PURE__ */ jsx11(Text6, { italic: true, children: planDescription }) }),
|
|
4954
|
+
/* @__PURE__ */ jsx11(Box6, { flexDirection: "column", flexGrow: 1, children: planItems.map((planItem) => /* @__PURE__ */ jsx11(Box6, { children: /* @__PURE__ */ jsxs6(
|
|
5003
4955
|
Text6,
|
|
5004
4956
|
{
|
|
5005
4957
|
color: planItem.status === "done" ? "green" : planItem.status === "in-progress" ? "yellow" : planItem.status === "not-needed" ? "gray" : "white",
|
|
@@ -5016,7 +4968,7 @@ function PlanView() {
|
|
|
5016
4968
|
progress,
|
|
5017
4969
|
"%"
|
|
5018
4970
|
] }),
|
|
5019
|
-
/* @__PURE__ */
|
|
4971
|
+
/* @__PURE__ */ jsx11(ProgressBar, { value: progress })
|
|
5020
4972
|
] })
|
|
5021
4973
|
] });
|
|
5022
4974
|
}
|
|
@@ -5024,14 +4976,14 @@ function PlanView() {
|
|
|
5024
4976
|
// ink/components/SettingsView.tsx
|
|
5025
4977
|
import { Box as Box7, Text as Text7, useInput as useInput2 } from "ink";
|
|
5026
4978
|
import path9 from "path";
|
|
5027
|
-
import { useEffect as useEffect6, useMemo as
|
|
4979
|
+
import { useEffect as useEffect6, useMemo as useMemo8, useState as useState10 } from "react";
|
|
5028
4980
|
|
|
5029
4981
|
// ink/contexts/SettingsContext.tsx
|
|
5030
|
-
import { createContext as
|
|
5031
|
-
import { jsx as
|
|
5032
|
-
var SettingsContext =
|
|
4982
|
+
import { createContext as createContext6, useContext as useContext6, useMemo as useMemo7, useState as useState9 } from "react";
|
|
4983
|
+
import { jsx as jsx12 } from "react/jsx-runtime";
|
|
4984
|
+
var SettingsContext = createContext6(void 0);
|
|
5033
4985
|
var useSettings = () => {
|
|
5034
|
-
const context =
|
|
4986
|
+
const context = useContext6(SettingsContext);
|
|
5035
4987
|
if (!context) {
|
|
5036
4988
|
throw new Error("useSettings must be used within a SettingsProvider");
|
|
5037
4989
|
}
|
|
@@ -5040,11 +4992,11 @@ var useSettings = () => {
|
|
|
5040
4992
|
var SettingsProvider = ({
|
|
5041
4993
|
children
|
|
5042
4994
|
}) => {
|
|
5043
|
-
const [version, setVersion] =
|
|
4995
|
+
const [version, setVersion] = useState9(0);
|
|
5044
4996
|
useListener("SettingsUpdated", () => {
|
|
5045
4997
|
setVersion((v) => v + 1);
|
|
5046
4998
|
}, []);
|
|
5047
|
-
const value =
|
|
4999
|
+
const value = useMemo7(() => ({
|
|
5048
5000
|
version,
|
|
5049
5001
|
model: trackedState.model,
|
|
5050
5002
|
compactionModel: trackedState.compactionModel,
|
|
@@ -5061,11 +5013,11 @@ var SettingsProvider = ({
|
|
|
5061
5013
|
rateLimitThreshold: trackedState.rateLimitThreshold,
|
|
5062
5014
|
rateLimitStatus: rateLimitTracker.getStatus()
|
|
5063
5015
|
}), [version]);
|
|
5064
|
-
return /* @__PURE__ */
|
|
5016
|
+
return /* @__PURE__ */ jsx12(SettingsContext.Provider, { value, children });
|
|
5065
5017
|
};
|
|
5066
5018
|
|
|
5067
5019
|
// ink/components/SettingsView.tsx
|
|
5068
|
-
import { jsx as
|
|
5020
|
+
import { jsx as jsx13, jsxs as jsxs7 } from "react/jsx-runtime";
|
|
5069
5021
|
function SettingsView({ isDense = false }) {
|
|
5070
5022
|
const {
|
|
5071
5023
|
model,
|
|
@@ -5084,10 +5036,10 @@ function SettingsView({ isDense = false }) {
|
|
|
5084
5036
|
rateLimitStatus
|
|
5085
5037
|
} = useSettings();
|
|
5086
5038
|
const { focusedArea } = useChat();
|
|
5087
|
-
const [autoApproveCodeInterpreter, setAutoApproveCodeInterpreter] =
|
|
5088
|
-
const [autoApprovePatches, setAutoApprovePatches] =
|
|
5089
|
-
const [autoApproveShell, setAutoApproveShell] =
|
|
5090
|
-
const [monitorRateLimits, setMonitorRateLimits] =
|
|
5039
|
+
const [autoApproveCodeInterpreter, setAutoApproveCodeInterpreter] = useState10(initialAutoApproveCodeInterpreter);
|
|
5040
|
+
const [autoApprovePatches, setAutoApprovePatches] = useState10(initialAutoApprovePatches);
|
|
5041
|
+
const [autoApproveShell, setAutoApproveShell] = useState10(initialAutoApproveShell);
|
|
5042
|
+
const [monitorRateLimits, setMonitorRateLimits] = useState10(initialMonitorRateLimits);
|
|
5091
5043
|
useEffect6(() => {
|
|
5092
5044
|
setAutoApproveCodeInterpreter(initialAutoApproveCodeInterpreter);
|
|
5093
5045
|
}, [initialAutoApproveCodeInterpreter]);
|
|
@@ -5100,8 +5052,8 @@ function SettingsView({ isDense = false }) {
|
|
|
5100
5052
|
useEffect6(() => {
|
|
5101
5053
|
setMonitorRateLimits(initialMonitorRateLimits);
|
|
5102
5054
|
}, [initialMonitorRateLimits]);
|
|
5103
|
-
const [selectedIndex, setSelectedIndex] =
|
|
5104
|
-
const selectableOptions =
|
|
5055
|
+
const [selectedIndex, setSelectedIndex] = useState10(0);
|
|
5056
|
+
const selectableOptions = useMemo8(() => [
|
|
5105
5057
|
{
|
|
5106
5058
|
label: "Code Interpreter",
|
|
5107
5059
|
value: autoApproveCodeInterpreter,
|
|
@@ -5161,7 +5113,7 @@ function SettingsView({ isDense = false }) {
|
|
|
5161
5113
|
}
|
|
5162
5114
|
}
|
|
5163
5115
|
});
|
|
5164
|
-
const displayPath =
|
|
5116
|
+
const displayPath = useMemo8(() => {
|
|
5165
5117
|
if (!sessionPath) {
|
|
5166
5118
|
return null;
|
|
5167
5119
|
}
|
|
@@ -5173,25 +5125,25 @@ function SettingsView({ isDense = false }) {
|
|
|
5173
5125
|
}, [cwd, sessionPath]);
|
|
5174
5126
|
const marginBottom = isDense ? 0 : 1;
|
|
5175
5127
|
return /* @__PURE__ */ jsxs7(Box7, { flexDirection: "column", flexGrow: 1, paddingLeft: 1, children: [
|
|
5176
|
-
/* @__PURE__ */
|
|
5128
|
+
/* @__PURE__ */ jsx13(Box7, { marginBottom, children: /* @__PURE__ */ jsx13(Text7, { bold: true, underline: true, color: "cyan", children: "Configuration" }) }),
|
|
5177
5129
|
/* @__PURE__ */ jsxs7(Box7, { marginBottom, children: [
|
|
5178
|
-
/* @__PURE__ */
|
|
5179
|
-
/* @__PURE__ */
|
|
5130
|
+
/* @__PURE__ */ jsx13(Box7, { width: 20, children: /* @__PURE__ */ jsx13(Text7, { children: "Model:" }) }),
|
|
5131
|
+
/* @__PURE__ */ jsx13(Text7, { children: model })
|
|
5180
5132
|
] }),
|
|
5181
5133
|
/* @__PURE__ */ jsxs7(Box7, { marginBottom, children: [
|
|
5182
|
-
/* @__PURE__ */
|
|
5183
|
-
/* @__PURE__ */
|
|
5134
|
+
/* @__PURE__ */ jsx13(Box7, { width: 20, children: /* @__PURE__ */ jsx13(Text7, { children: "Compaction Model:" }) }),
|
|
5135
|
+
/* @__PURE__ */ jsx13(Text7, { children: compactionModel })
|
|
5184
5136
|
] }),
|
|
5185
5137
|
displayPath && /* @__PURE__ */ jsxs7(Box7, { marginBottom, children: [
|
|
5186
|
-
/* @__PURE__ */
|
|
5187
|
-
/* @__PURE__ */
|
|
5138
|
+
/* @__PURE__ */ jsx13(Box7, { width: 20, children: /* @__PURE__ */ jsx13(Text7, { children: "Session Path:" }) }),
|
|
5139
|
+
/* @__PURE__ */ jsx13(Text7, { children: displayPath })
|
|
5188
5140
|
] }),
|
|
5189
5141
|
/* @__PURE__ */ jsxs7(Box7, { marginBottom, children: [
|
|
5190
|
-
/* @__PURE__ */
|
|
5191
|
-
/* @__PURE__ */
|
|
5142
|
+
/* @__PURE__ */ jsx13(Box7, { width: 20, children: /* @__PURE__ */ jsx13(Text7, { children: "Flex Tier:" }) }),
|
|
5143
|
+
/* @__PURE__ */ jsx13(Text7, { children: useFlexTier ? "Yes" : "No" })
|
|
5192
5144
|
] }),
|
|
5193
5145
|
/* @__PURE__ */ jsxs7(Box7, { marginBottom, children: [
|
|
5194
|
-
/* @__PURE__ */
|
|
5146
|
+
/* @__PURE__ */ jsx13(Box7, { width: 20, children: /* @__PURE__ */ jsx13(Text7, { children: "Current Turn:" }) }),
|
|
5195
5147
|
/* @__PURE__ */ jsxs7(Text7, { children: [
|
|
5196
5148
|
currentTurn,
|
|
5197
5149
|
" / ",
|
|
@@ -5199,7 +5151,7 @@ function SettingsView({ isDense = false }) {
|
|
|
5199
5151
|
] })
|
|
5200
5152
|
] }),
|
|
5201
5153
|
/* @__PURE__ */ jsxs7(Box7, { marginBottom, children: [
|
|
5202
|
-
/* @__PURE__ */
|
|
5154
|
+
/* @__PURE__ */ jsx13(Box7, { width: 20, children: /* @__PURE__ */ jsx13(Text7, { children: "Rate Limit @:" }) }),
|
|
5203
5155
|
/* @__PURE__ */ jsxs7(Text7, { children: [
|
|
5204
5156
|
initialRateLimitThreshold,
|
|
5205
5157
|
"%"
|
|
@@ -5207,14 +5159,14 @@ function SettingsView({ isDense = false }) {
|
|
|
5207
5159
|
] }),
|
|
5208
5160
|
rateLimitStatus && /* @__PURE__ */ jsxs7(Box7, { marginBottom, flexDirection: "column", children: [
|
|
5209
5161
|
rateLimitStatus.retryAfter !== null && /* @__PURE__ */ jsxs7(Box7, { children: [
|
|
5210
|
-
/* @__PURE__ */
|
|
5162
|
+
/* @__PURE__ */ jsx13(Box7, { width: 20, children: /* @__PURE__ */ jsx13(Text7, { color: "red", children: "Retry After:" }) }),
|
|
5211
5163
|
/* @__PURE__ */ jsxs7(Text7, { color: "red", children: [
|
|
5212
5164
|
rateLimitStatus.retryAfter,
|
|
5213
5165
|
"s"
|
|
5214
5166
|
] })
|
|
5215
5167
|
] }),
|
|
5216
5168
|
(rateLimitStatus.limitRequests !== null || rateLimitStatus.remainingRequests !== null) && /* @__PURE__ */ jsxs7(Box7, { children: [
|
|
5217
|
-
/* @__PURE__ */
|
|
5169
|
+
/* @__PURE__ */ jsx13(Box7, { width: 20, children: /* @__PURE__ */ jsx13(Text7, { children: "RPM Limit:" }) }),
|
|
5218
5170
|
/* @__PURE__ */ jsxs7(Text7, { children: [
|
|
5219
5171
|
rateLimitStatus.remainingRequests ?? "?",
|
|
5220
5172
|
" / ",
|
|
@@ -5226,7 +5178,7 @@ function SettingsView({ isDense = false }) {
|
|
|
5226
5178
|
] })
|
|
5227
5179
|
] }),
|
|
5228
5180
|
rateLimitStatus.remainingTokens !== null && /* @__PURE__ */ jsxs7(Box7, { children: [
|
|
5229
|
-
/* @__PURE__ */
|
|
5181
|
+
/* @__PURE__ */ jsx13(Box7, { width: 20, children: /* @__PURE__ */ jsx13(Text7, { children: "TPM Limit:" }) }),
|
|
5230
5182
|
/* @__PURE__ */ jsxs7(Text7, { children: [
|
|
5231
5183
|
rateLimitStatus.remainingTokens ?? "?",
|
|
5232
5184
|
" / ",
|
|
@@ -5239,17 +5191,17 @@ function SettingsView({ isDense = false }) {
|
|
|
5239
5191
|
] })
|
|
5240
5192
|
] }),
|
|
5241
5193
|
maxCost !== null && /* @__PURE__ */ jsxs7(Box7, { marginBottom, children: [
|
|
5242
|
-
/* @__PURE__ */
|
|
5194
|
+
/* @__PURE__ */ jsx13(Box7, { width: 20, children: /* @__PURE__ */ jsx13(Text7, { children: "Max Cost:" }) }),
|
|
5243
5195
|
/* @__PURE__ */ jsxs7(Text7, { children: [
|
|
5244
5196
|
"$",
|
|
5245
5197
|
maxCost.toFixed(2)
|
|
5246
5198
|
] })
|
|
5247
5199
|
] }),
|
|
5248
5200
|
/* @__PURE__ */ jsxs7(Box7, { marginTop: 1, flexDirection: "column", children: [
|
|
5249
|
-
/* @__PURE__ */
|
|
5201
|
+
/* @__PURE__ */ jsx13(Text7, { bold: true, children: "Auto-approvals (up/down & space to toggle):" }),
|
|
5250
5202
|
selectableOptions.map((option, index) => {
|
|
5251
5203
|
const isSelected = index === selectedIndex && focusedArea === "status";
|
|
5252
|
-
return /* @__PURE__ */
|
|
5204
|
+
return /* @__PURE__ */ jsx13(Box7, { children: /* @__PURE__ */ jsxs7(Text7, { color: isSelected ? "cyan" : "white", children: [
|
|
5253
5205
|
isSelected ? "> " : " ",
|
|
5254
5206
|
option.label,
|
|
5255
5207
|
"isAction" in option ? "" : `: ${option.value ? "ON" : "OFF"}`
|
|
@@ -5263,13 +5215,13 @@ function SettingsView({ isDense = false }) {
|
|
|
5263
5215
|
import { Box as Box9, Text as Text9 } from "ink";
|
|
5264
5216
|
import { exec as exec4 } from "child_process";
|
|
5265
5217
|
import { promisify as promisify13 } from "util";
|
|
5266
|
-
import { useCallback as useCallback4, useState as
|
|
5218
|
+
import { useCallback as useCallback4, useState as useState12 } from "react";
|
|
5267
5219
|
|
|
5268
5220
|
// ink/components/BlinkingTextInput.tsx
|
|
5269
5221
|
import chalk3 from "chalk";
|
|
5270
5222
|
import { Box as Box8, Text as Text8, useInput as useInput3 } from "ink";
|
|
5271
|
-
import { useEffect as useEffect7, useMemo as
|
|
5272
|
-
import { jsx as
|
|
5223
|
+
import { useEffect as useEffect7, useMemo as useMemo9, useReducer, useState as useState11 } from "react";
|
|
5224
|
+
import { jsx as jsx14 } from "react/jsx-runtime";
|
|
5273
5225
|
var reducer = (state, action) => {
|
|
5274
5226
|
switch (action.type) {
|
|
5275
5227
|
case "move-cursor-left":
|
|
@@ -5322,7 +5274,7 @@ function BlinkingTextInput({
|
|
|
5322
5274
|
previousValue: defaultValue,
|
|
5323
5275
|
cursorOffset: defaultValue.length
|
|
5324
5276
|
});
|
|
5325
|
-
const [isCursorVisible, setIsCursorVisible] =
|
|
5277
|
+
const [isCursorVisible, setIsCursorVisible] = useState11(true);
|
|
5326
5278
|
useEffect7(() => {
|
|
5327
5279
|
if (isDisabled) {
|
|
5328
5280
|
setIsCursorVisible(false);
|
|
@@ -5338,7 +5290,7 @@ function BlinkingTextInput({
|
|
|
5338
5290
|
onChange?.(state.value);
|
|
5339
5291
|
}
|
|
5340
5292
|
}, [state.value, state.previousValue, onChange]);
|
|
5341
|
-
const suggestion =
|
|
5293
|
+
const suggestion = useMemo9(() => {
|
|
5342
5294
|
if (state.value.length === 0) {
|
|
5343
5295
|
return "";
|
|
5344
5296
|
}
|
|
@@ -5374,10 +5326,10 @@ function BlinkingTextInput({
|
|
|
5374
5326
|
},
|
|
5375
5327
|
{ isActive: !isDisabled }
|
|
5376
5328
|
);
|
|
5377
|
-
const renderedValue =
|
|
5329
|
+
const renderedValue = useMemo9(() => {
|
|
5378
5330
|
if (isDisabled) {
|
|
5379
5331
|
const lines2 = (state.value || (placeholder ? chalk3.dim(placeholder) : "")).split("\n");
|
|
5380
|
-
return /* @__PURE__ */
|
|
5332
|
+
return /* @__PURE__ */ jsx14(Box8, { flexDirection: "column", children: lines2.map((line, i) => /* @__PURE__ */ jsx14(Box8, { children: /* @__PURE__ */ jsx14(Text8, { children: line }) }, i)) });
|
|
5381
5333
|
}
|
|
5382
5334
|
if (state.value.length === 0) {
|
|
5383
5335
|
let displayContent = "";
|
|
@@ -5386,7 +5338,7 @@ function BlinkingTextInput({
|
|
|
5386
5338
|
} else {
|
|
5387
5339
|
displayContent = isCursorVisible ? chalk3.inverse(" ") : " ";
|
|
5388
5340
|
}
|
|
5389
|
-
return /* @__PURE__ */
|
|
5341
|
+
return /* @__PURE__ */ jsx14(Box8, { flexGrow: 1, minWidth: 1, children: /* @__PURE__ */ jsx14(Text8, { wrap: "end", children: displayContent }) });
|
|
5390
5342
|
}
|
|
5391
5343
|
const lines = state.value.split("\n");
|
|
5392
5344
|
const result = [];
|
|
@@ -5412,19 +5364,19 @@ function BlinkingTextInput({
|
|
|
5412
5364
|
lineContent += chalk3.dim(suggestion);
|
|
5413
5365
|
}
|
|
5414
5366
|
result.push(
|
|
5415
|
-
/* @__PURE__ */
|
|
5367
|
+
/* @__PURE__ */ jsx14(Box8, { flexGrow: 1, children: /* @__PURE__ */ jsx14(Text8, { wrap: "end", children: lineContent }) }, lineIndex)
|
|
5416
5368
|
);
|
|
5417
5369
|
if (lineIndex < lines.length - 1) {
|
|
5418
5370
|
totalOffset++;
|
|
5419
5371
|
}
|
|
5420
5372
|
});
|
|
5421
|
-
return /* @__PURE__ */
|
|
5373
|
+
return /* @__PURE__ */ jsx14(Box8, { flexDirection: "column", flexGrow: 1, children: result });
|
|
5422
5374
|
}, [state.value, state.cursorOffset, suggestion, isCursorVisible, isDisabled, placeholder]);
|
|
5423
|
-
return /* @__PURE__ */
|
|
5375
|
+
return /* @__PURE__ */ jsx14(Box8, { flexGrow: 1, minWidth: 1, children: renderedValue });
|
|
5424
5376
|
}
|
|
5425
5377
|
|
|
5426
5378
|
// ink/components/UserInput.tsx
|
|
5427
|
-
import { jsx as
|
|
5379
|
+
import { jsx as jsx15, jsxs as jsxs8 } from "react/jsx-runtime";
|
|
5428
5380
|
var execAsync4 = promisify13(exec4);
|
|
5429
5381
|
var modeSuggestion = {
|
|
5430
5382
|
approved: ["/clear", "/skills", "/exit"],
|
|
@@ -5434,8 +5386,8 @@ var modeSuggestion = {
|
|
|
5434
5386
|
};
|
|
5435
5387
|
function UserInput() {
|
|
5436
5388
|
const { userInputMode, focusedArea } = useChat();
|
|
5437
|
-
const [resetKey, setResetKey] =
|
|
5438
|
-
const [, setBlankLines] =
|
|
5389
|
+
const [resetKey, setResetKey] = useState12(0);
|
|
5390
|
+
const [, setBlankLines] = useState12(0);
|
|
5439
5391
|
useListener("ClearUserInput", () => {
|
|
5440
5392
|
setResetKey((prev) => prev + 1);
|
|
5441
5393
|
}, []);
|
|
@@ -5506,8 +5458,8 @@ Failed to install skills: ${error.message}`);
|
|
|
5506
5458
|
alignItems: "flex-start",
|
|
5507
5459
|
gap: 1,
|
|
5508
5460
|
children: [
|
|
5509
|
-
/* @__PURE__ */
|
|
5510
|
-
/* @__PURE__ */
|
|
5461
|
+
/* @__PURE__ */ jsx15(Box9, { marginLeft: 1, height: 1, children: /* @__PURE__ */ jsx15(Text9, { bold: true, color: borderColor, children: "\u276F" }) }),
|
|
5462
|
+
/* @__PURE__ */ jsx15(Box9, { flexGrow: 1, children: /* @__PURE__ */ jsx15(
|
|
5511
5463
|
BlinkingTextInput,
|
|
5512
5464
|
{
|
|
5513
5465
|
placeholder,
|
|
@@ -5536,14 +5488,14 @@ function calculatePlaceholder(mode) {
|
|
|
5536
5488
|
}
|
|
5537
5489
|
|
|
5538
5490
|
// ink/components/ChatContent.tsx
|
|
5539
|
-
import { jsx as
|
|
5491
|
+
import { jsx as jsx16, jsxs as jsxs9 } from "react/jsx-runtime";
|
|
5540
5492
|
function ChatContent() {
|
|
5541
5493
|
const { messages, isThinking, isCompacting, pullingState, focusedArea, setFocusedArea } = useChat();
|
|
5542
5494
|
const { payload } = useApproval();
|
|
5543
5495
|
const size = useTerminalSize();
|
|
5544
5496
|
useMessageListener();
|
|
5545
|
-
const [activeTab, setActiveTab] =
|
|
5546
|
-
const [userHasSwitchedTab, setUserHasSwitchedTab] =
|
|
5497
|
+
const [activeTab, setActiveTab] = useState13("settings");
|
|
5498
|
+
const [userHasSwitchedTab, setUserHasSwitchedTab] = useState13(false);
|
|
5547
5499
|
const { planDescription, planItems } = usePlan();
|
|
5548
5500
|
useEffect8(() => {
|
|
5549
5501
|
if (!userHasSwitchedTab && activeTab === "settings") {
|
|
@@ -5553,7 +5505,7 @@ function ChatContent() {
|
|
|
5553
5505
|
}
|
|
5554
5506
|
}
|
|
5555
5507
|
}, [planDescription, planItems, userHasSwitchedTab, activeTab]);
|
|
5556
|
-
const [selectedIndex, setSelectedIndex] =
|
|
5508
|
+
const [selectedIndex, setSelectedIndex] = useState13(0);
|
|
5557
5509
|
const wrapCache = useRef2(
|
|
5558
5510
|
/* @__PURE__ */ new Map()
|
|
5559
5511
|
);
|
|
@@ -5635,7 +5587,7 @@ function ChatContent() {
|
|
|
5635
5587
|
}, []);
|
|
5636
5588
|
const availableTextWidth = timelineWidth - 4;
|
|
5637
5589
|
const pullingHeight = pullingState ? 1 : 0;
|
|
5638
|
-
const lineItems =
|
|
5590
|
+
const lineItems = useMemo10(() => {
|
|
5639
5591
|
const acc = [];
|
|
5640
5592
|
for (const msg of messages) {
|
|
5641
5593
|
const labelWidth = labelWidthFor(msg.type);
|
|
@@ -5714,7 +5666,7 @@ function ChatContent() {
|
|
|
5714
5666
|
setSelectedIndex(lineItems.length - 1);
|
|
5715
5667
|
}
|
|
5716
5668
|
}, [size.rows, size.columns]);
|
|
5717
|
-
const tabs =
|
|
5669
|
+
const tabs = useMemo10(() => [
|
|
5718
5670
|
{ name: "settings", label: "SETTINGS" },
|
|
5719
5671
|
{ name: "planDescription", label: "PLAN" },
|
|
5720
5672
|
{ name: "actions", label: "ACTIONS" }
|
|
@@ -5733,16 +5685,16 @@ function ChatContent() {
|
|
|
5733
5685
|
const junctionLeftColor = focusedArea === "timeline" || focusedArea === "input" ? "cyan" : "gray";
|
|
5734
5686
|
const junctionMiddleColor = focusedArea === "timeline" || focusedArea === "status" || focusedArea === "input" ? "cyan" : "gray";
|
|
5735
5687
|
const junctionRightColor = focusedArea === "status" || focusedArea === "input" ? "cyan" : "gray";
|
|
5736
|
-
const timelinePipeFiller = useCallback5((count) => /* @__PURE__ */
|
|
5688
|
+
const timelinePipeFiller = useCallback5((count) => /* @__PURE__ */ jsx16(Box10, { flexDirection: "column", children: Array.from({ length: count }).map((_, i) => /* @__PURE__ */ jsx16(Box10, { children: /* @__PURE__ */ jsx16(Text10, { color: "gray", dimColor: true, children: "\u2502" }) }, i)) }), []);
|
|
5737
5689
|
return /* @__PURE__ */ jsxs9(Box10, { flexDirection: "column", height: size.rows, padding: 0, children: [
|
|
5738
5690
|
/* @__PURE__ */ jsxs9(Box10, { flexDirection: "row", height: 1, children: [
|
|
5739
|
-
/* @__PURE__ */
|
|
5740
|
-
/* @__PURE__ */
|
|
5741
|
-
showSpinner && /* @__PURE__ */
|
|
5742
|
-
/* @__PURE__ */
|
|
5743
|
-
/* @__PURE__ */
|
|
5691
|
+
/* @__PURE__ */ jsx16(Text10, { color: timelineColor, children: "\u256D" }),
|
|
5692
|
+
/* @__PURE__ */ jsx16(Text10, { bold: true, color: timelineColor, children: timelineTitle }),
|
|
5693
|
+
showSpinner && /* @__PURE__ */ jsx16(Box10, { paddingLeft: 2, paddingRight: 1, children: /* @__PURE__ */ jsx16(Spinner2, { type: "clock" }) }),
|
|
5694
|
+
/* @__PURE__ */ jsx16(Text10, { color: timelineColor, children: "\u2500".repeat(Math.max(0, timelineDashes)) }),
|
|
5695
|
+
/* @__PURE__ */ jsx16(Text10, { color: dividerColor, children: "\u252C" }),
|
|
5744
5696
|
tabs.map((tab, i) => /* @__PURE__ */ jsxs9(React11.Fragment, { children: [
|
|
5745
|
-
/* @__PURE__ */
|
|
5697
|
+
/* @__PURE__ */ jsx16(
|
|
5746
5698
|
Text10,
|
|
5747
5699
|
{
|
|
5748
5700
|
color: activeTab === tab.name ? "black" : statusColor,
|
|
@@ -5751,7 +5703,7 @@ function ChatContent() {
|
|
|
5751
5703
|
children: ` ${tab.label} `
|
|
5752
5704
|
}
|
|
5753
5705
|
),
|
|
5754
|
-
i < tabs.length - 1 && /* @__PURE__ */
|
|
5706
|
+
i < tabs.length - 1 && /* @__PURE__ */ jsx16(Text10, { color: statusColor, children: "|" })
|
|
5755
5707
|
] }, tab.name)),
|
|
5756
5708
|
/* @__PURE__ */ jsxs9(Text10, { color: statusColor, children: [
|
|
5757
5709
|
"\u2500".repeat(statusDashes),
|
|
@@ -5759,14 +5711,14 @@ function ChatContent() {
|
|
|
5759
5711
|
] })
|
|
5760
5712
|
] }),
|
|
5761
5713
|
/* @__PURE__ */ jsxs9(Box10, { flexDirection: "row", height: contentHeight - 2 - pullingHeight, children: [
|
|
5762
|
-
/* @__PURE__ */
|
|
5714
|
+
/* @__PURE__ */ jsx16(
|
|
5763
5715
|
Box10,
|
|
5764
5716
|
{
|
|
5765
5717
|
flexDirection: "column",
|
|
5766
5718
|
width: timelineWidth,
|
|
5767
5719
|
paddingLeft: 0,
|
|
5768
5720
|
paddingRight: 1,
|
|
5769
|
-
children: /* @__PURE__ */
|
|
5721
|
+
children: /* @__PURE__ */ jsx16(Box10, { flexDirection: "column", flexGrow: 1, children: /* @__PURE__ */ jsx16(
|
|
5770
5722
|
VirtualList,
|
|
5771
5723
|
{
|
|
5772
5724
|
items: lineItems,
|
|
@@ -5774,7 +5726,7 @@ function ChatContent() {
|
|
|
5774
5726
|
height: contentHeight - 2 - pullingHeight,
|
|
5775
5727
|
selectedIndex,
|
|
5776
5728
|
renderOverflowTop: useCallback5((count) => /* @__PURE__ */ jsxs9(Box10, { children: [
|
|
5777
|
-
/* @__PURE__ */
|
|
5729
|
+
/* @__PURE__ */ jsx16(Text10, { color: "gray", dimColor: true, children: "\u2502" }),
|
|
5778
5730
|
count > 0 && /* @__PURE__ */ jsxs9(Text10, { dimColor: true, children: [
|
|
5779
5731
|
" ",
|
|
5780
5732
|
"\u25B2 ",
|
|
@@ -5783,7 +5735,7 @@ function ChatContent() {
|
|
|
5783
5735
|
] })
|
|
5784
5736
|
] }), []),
|
|
5785
5737
|
renderOverflowBottom: useCallback5((count) => /* @__PURE__ */ jsxs9(Box10, { children: [
|
|
5786
|
-
/* @__PURE__ */
|
|
5738
|
+
/* @__PURE__ */ jsx16(Text10, { color: "gray", dimColor: true, children: "\u2502" }),
|
|
5787
5739
|
count > 0 && /* @__PURE__ */ jsxs9(Text10, { dimColor: true, children: [
|
|
5788
5740
|
" ",
|
|
5789
5741
|
"\u25BC ",
|
|
@@ -5794,7 +5746,7 @@ function ChatContent() {
|
|
|
5794
5746
|
renderFiller: timelinePipeFiller,
|
|
5795
5747
|
keyExtractor: (it) => it.key,
|
|
5796
5748
|
renderItem: useCallback5(
|
|
5797
|
-
({ item, isSelected }) => /* @__PURE__ */
|
|
5749
|
+
({ item, isSelected }) => /* @__PURE__ */ jsx16(
|
|
5798
5750
|
MessageLineItem,
|
|
5799
5751
|
{
|
|
5800
5752
|
item,
|
|
@@ -5809,7 +5761,7 @@ function ChatContent() {
|
|
|
5809
5761
|
) })
|
|
5810
5762
|
}
|
|
5811
5763
|
),
|
|
5812
|
-
activeTab !== "shell" && activeTab !== "actions" && /* @__PURE__ */
|
|
5764
|
+
activeTab !== "shell" && activeTab !== "actions" && /* @__PURE__ */ jsx16(
|
|
5813
5765
|
Box10,
|
|
5814
5766
|
{
|
|
5815
5767
|
flexDirection: "column",
|
|
@@ -5821,7 +5773,7 @@ function ChatContent() {
|
|
|
5821
5773
|
borderRight: false
|
|
5822
5774
|
}
|
|
5823
5775
|
),
|
|
5824
|
-
/* @__PURE__ */
|
|
5776
|
+
/* @__PURE__ */ jsx16(
|
|
5825
5777
|
Box10,
|
|
5826
5778
|
{
|
|
5827
5779
|
flexDirection: "column",
|
|
@@ -5835,11 +5787,11 @@ function ChatContent() {
|
|
|
5835
5787
|
paddingRight: 1,
|
|
5836
5788
|
children: /* @__PURE__ */ jsxs9(Box10, { flexDirection: "column", flexGrow: 1, marginTop: 0, children: [
|
|
5837
5789
|
activeTab === "settings" && /* @__PURE__ */ jsxs9(Box10, { flexDirection: "column", children: [
|
|
5838
|
-
/* @__PURE__ */
|
|
5839
|
-
/* @__PURE__ */
|
|
5790
|
+
/* @__PURE__ */ jsx16(CostView, { isDense: true }),
|
|
5791
|
+
/* @__PURE__ */ jsx16(Box10, { marginTop: 1, children: /* @__PURE__ */ jsx16(SettingsView, { isDense: true }) })
|
|
5840
5792
|
] }),
|
|
5841
|
-
activeTab === "planDescription" && /* @__PURE__ */
|
|
5842
|
-
activeTab === "actions" && /* @__PURE__ */
|
|
5793
|
+
activeTab === "planDescription" && /* @__PURE__ */ jsx16(PlanView, {}),
|
|
5794
|
+
activeTab === "actions" && /* @__PURE__ */ jsx16(
|
|
5843
5795
|
ActionsView,
|
|
5844
5796
|
{
|
|
5845
5797
|
height: contentHeight - 2 - pullingHeight,
|
|
@@ -5851,11 +5803,11 @@ function ChatContent() {
|
|
|
5851
5803
|
)
|
|
5852
5804
|
] }),
|
|
5853
5805
|
/* @__PURE__ */ jsxs9(Box10, { flexDirection: "column", children: [
|
|
5854
|
-
pullingState && /* @__PURE__ */
|
|
5806
|
+
pullingState && /* @__PURE__ */ jsx16(Box10, { paddingLeft: 2, paddingRight: 2, marginBottom: 0, children: /* @__PURE__ */ jsxs9(Text10, { color: "yellow", children: [
|
|
5855
5807
|
`\uF019 Downloading `,
|
|
5856
|
-
/* @__PURE__ */
|
|
5808
|
+
/* @__PURE__ */ jsx16(Text10, { bold: true, children: pullingState.modelName }),
|
|
5857
5809
|
` from Ollama... `,
|
|
5858
|
-
/* @__PURE__ */
|
|
5810
|
+
/* @__PURE__ */ jsx16(Text10, { dimColor: true, children: pullingState.status === "pulling manifest" ? "initializing" : pullingState.status }),
|
|
5859
5811
|
pullingState.total > 0 && /* @__PURE__ */ jsxs9(Text10, { children: [
|
|
5860
5812
|
` [${"=".repeat(Math.floor(pullingState.completed / pullingState.total * 20))}${" ".repeat(20 - Math.floor(pullingState.completed / pullingState.total * 20))}] `,
|
|
5861
5813
|
Math.round(pullingState.completed / pullingState.total * 100),
|
|
@@ -5863,32 +5815,32 @@ function ChatContent() {
|
|
|
5863
5815
|
] })
|
|
5864
5816
|
] }) }),
|
|
5865
5817
|
/* @__PURE__ */ jsxs9(Box10, { flexDirection: "row", height: 1, children: [
|
|
5866
|
-
/* @__PURE__ */
|
|
5867
|
-
/* @__PURE__ */
|
|
5868
|
-
/* @__PURE__ */
|
|
5869
|
-
/* @__PURE__ */
|
|
5870
|
-
/* @__PURE__ */
|
|
5818
|
+
/* @__PURE__ */ jsx16(Text10, { color: junctionLeftColor, children: "\u2522" }),
|
|
5819
|
+
/* @__PURE__ */ jsx16(Text10, { color: timelineBottomColor, children: "\u2501".repeat(timelineWidth - 1) }),
|
|
5820
|
+
/* @__PURE__ */ jsx16(Text10, { color: junctionMiddleColor, children: "\u2537" }),
|
|
5821
|
+
/* @__PURE__ */ jsx16(Text10, { color: statusBottomColor, children: "\u2501".repeat(Math.max(0, statusWidth - 2)) }),
|
|
5822
|
+
/* @__PURE__ */ jsx16(Text10, { color: junctionRightColor, children: "\u252A" })
|
|
5871
5823
|
] })
|
|
5872
5824
|
] }),
|
|
5873
|
-
/* @__PURE__ */
|
|
5825
|
+
/* @__PURE__ */ jsx16(UserInput, {})
|
|
5874
5826
|
] });
|
|
5875
5827
|
}
|
|
5876
5828
|
|
|
5877
5829
|
// ink/components/DiffApprovalView.tsx
|
|
5878
5830
|
import { Box as Box11, Text as Text11, useInput as useInput5 } from "ink";
|
|
5879
|
-
import { useMemo as
|
|
5880
|
-
import { Fragment as Fragment2, jsx as
|
|
5831
|
+
import { useMemo as useMemo11, useState as useState14 } from "react";
|
|
5832
|
+
import { Fragment as Fragment2, jsx as jsx17, jsxs as jsxs10 } from "react/jsx-runtime";
|
|
5881
5833
|
function DiffApprovalView() {
|
|
5882
5834
|
const { payload } = useApproval();
|
|
5883
5835
|
const size = useTerminalSize();
|
|
5884
|
-
const [scrollIndex, setScrollIndex] =
|
|
5885
|
-
const diffLines =
|
|
5836
|
+
const [scrollIndex, setScrollIndex] = useState14(0);
|
|
5837
|
+
const diffLines = useMemo11(() => {
|
|
5886
5838
|
if (!payload?.diff) {
|
|
5887
5839
|
return [];
|
|
5888
5840
|
}
|
|
5889
5841
|
return payload.diff.split("\n");
|
|
5890
5842
|
}, [payload?.diff]);
|
|
5891
|
-
const wrappedLines =
|
|
5843
|
+
const wrappedLines = useMemo11(() => {
|
|
5892
5844
|
const result = [];
|
|
5893
5845
|
if (!payload) {
|
|
5894
5846
|
return result;
|
|
@@ -6028,18 +5980,18 @@ function DiffApprovalView() {
|
|
|
6028
5980
|
payload.mode === "ask" ? "APPROVE " : "VIEW ",
|
|
6029
5981
|
payload.type.toUpperCase().replace("_", " ")
|
|
6030
5982
|
] }),
|
|
6031
|
-
/* @__PURE__ */
|
|
5983
|
+
/* @__PURE__ */ jsx17(Text11, { color: "gray", children: "\u2502" }),
|
|
6032
5984
|
payload.path && /* @__PURE__ */ jsxs10(Fragment2, { children: [
|
|
6033
5985
|
/* @__PURE__ */ jsxs10(Text11, { bold: true, children: [
|
|
6034
5986
|
payload.type,
|
|
6035
5987
|
":"
|
|
6036
5988
|
] }),
|
|
6037
|
-
/* @__PURE__ */
|
|
5989
|
+
/* @__PURE__ */ jsx17(Text11, { children: payload.path })
|
|
6038
5990
|
] })
|
|
6039
5991
|
]
|
|
6040
5992
|
}
|
|
6041
5993
|
),
|
|
6042
|
-
/* @__PURE__ */
|
|
5994
|
+
/* @__PURE__ */ jsx17(Box11, { flexGrow: 1, flexDirection: "column", paddingX: 1, children: wrappedLines.length === 0 ? /* @__PURE__ */ jsx17(Text11, { italic: true, color: "gray", children: "No diff content." }) : wrappedLines.slice(scrollIndex, scrollIndex + visibleHeight).map((line, i) => /* @__PURE__ */ jsx17(Text11, { color: line.color || "white", children: line.text }, i)) }),
|
|
6043
5995
|
/* @__PURE__ */ jsxs10(
|
|
6044
5996
|
Box11,
|
|
6045
5997
|
{
|
|
@@ -6051,11 +6003,11 @@ function DiffApprovalView() {
|
|
|
6051
6003
|
borderRight: false,
|
|
6052
6004
|
children: [
|
|
6053
6005
|
payload.mode === "ask" ? /* @__PURE__ */ jsxs10(Box11, { flexGrow: 1, children: [
|
|
6054
|
-
/* @__PURE__ */
|
|
6055
|
-
/* @__PURE__ */
|
|
6056
|
-
/* @__PURE__ */
|
|
6057
|
-
!canRespond && /* @__PURE__ */
|
|
6058
|
-
] }) : /* @__PURE__ */
|
|
6006
|
+
/* @__PURE__ */ jsx17(Text11, { color: canRespond ? "green" : "gray", children: "[Enter/y] Approve" }),
|
|
6007
|
+
/* @__PURE__ */ jsx17(Text11, {}),
|
|
6008
|
+
/* @__PURE__ */ jsx17(Text11, { color: canRespond ? "red" : "gray", children: "[Esc/n] Deny" }),
|
|
6009
|
+
!canRespond && /* @__PURE__ */ jsx17(Text11, { color: "yellow", children: "(Wait 1s...)" })
|
|
6010
|
+
] }) : /* @__PURE__ */ jsx17(Box11, { flexGrow: 1, children: /* @__PURE__ */ jsx17(Text11, { color: "cyan", children: "[Enter/Esc] Close" }) }),
|
|
6059
6011
|
/* @__PURE__ */ jsxs10(Text11, { color: "gray", children: [
|
|
6060
6012
|
"Line ",
|
|
6061
6013
|
scrollIndex + 1,
|
|
@@ -6073,7 +6025,7 @@ function DiffApprovalView() {
|
|
|
6073
6025
|
// ink/configurationWizard/ConfigurationWizard.tsx
|
|
6074
6026
|
import { Box as Box18, useInput as useInput10 } from "ink";
|
|
6075
6027
|
import { Step, Stepper } from "ink-stepper";
|
|
6076
|
-
import { useEffect as useEffect14, useState as
|
|
6028
|
+
import { useEffect as useEffect14, useState as useState16 } from "react";
|
|
6077
6029
|
|
|
6078
6030
|
// utils/files/getEnvVarForProvider.ts
|
|
6079
6031
|
function getEnvVarForProvider(provider) {
|
|
@@ -6100,7 +6052,7 @@ import { PasswordInput } from "@inkjs/ui";
|
|
|
6100
6052
|
import { Box as Box12, Text as Text12, useInput as useInput6 } from "ink";
|
|
6101
6053
|
import { useStepperInput } from "ink-stepper";
|
|
6102
6054
|
import { useEffect as useEffect9 } from "react";
|
|
6103
|
-
import { jsx as
|
|
6055
|
+
import { jsx as jsx18, jsxs as jsxs11 } from "react/jsx-runtime";
|
|
6104
6056
|
function ApiKeyStep({ provider, onConfirm, onBack }) {
|
|
6105
6057
|
const { disableNavigation, enableNavigation } = useStepperInput();
|
|
6106
6058
|
useEffect9(() => {
|
|
@@ -6124,8 +6076,8 @@ function ApiKeyStep({ provider, onConfirm, onBack }) {
|
|
|
6124
6076
|
provider,
|
|
6125
6077
|
" API key?"
|
|
6126
6078
|
] }),
|
|
6127
|
-
/* @__PURE__ */
|
|
6128
|
-
/* @__PURE__ */
|
|
6079
|
+
/* @__PURE__ */ jsx18(Text12, { dimColor: true, children: instructions[provider] }),
|
|
6080
|
+
/* @__PURE__ */ jsx18(Box12, { marginTop: 1, children: /* @__PURE__ */ jsx18(
|
|
6129
6081
|
PasswordInput,
|
|
6130
6082
|
{
|
|
6131
6083
|
onSubmit: (v) => {
|
|
@@ -6137,7 +6089,7 @@ function ApiKeyStep({ provider, onConfirm, onBack }) {
|
|
|
6137
6089
|
}
|
|
6138
6090
|
}
|
|
6139
6091
|
) }),
|
|
6140
|
-
/* @__PURE__ */
|
|
6092
|
+
/* @__PURE__ */ jsx18(Box12, { marginTop: 1, children: /* @__PURE__ */ jsx18(Text12, { dimColor: true, children: "Press ESC to go back" }) })
|
|
6141
6093
|
] });
|
|
6142
6094
|
}
|
|
6143
6095
|
|
|
@@ -6145,7 +6097,7 @@ function ApiKeyStep({ provider, onConfirm, onBack }) {
|
|
|
6145
6097
|
import { Box as Box13, Text as Text13, useInput as useInput7 } from "ink";
|
|
6146
6098
|
import { useStepperInput as useStepperInput2 } from "ink-stepper";
|
|
6147
6099
|
import { useEffect as useEffect10 } from "react";
|
|
6148
|
-
import { jsx as
|
|
6100
|
+
import { jsx as jsx19, jsxs as jsxs12 } from "react/jsx-runtime";
|
|
6149
6101
|
function ApiUrlStep({ provider, onConfirm, onBack }) {
|
|
6150
6102
|
const { disableNavigation, enableNavigation } = useStepperInput2();
|
|
6151
6103
|
useEffect10(() => {
|
|
@@ -6169,7 +6121,7 @@ function ApiUrlStep({ provider, onConfirm, onBack }) {
|
|
|
6169
6121
|
provider,
|
|
6170
6122
|
"?"
|
|
6171
6123
|
] }),
|
|
6172
|
-
/* @__PURE__ */
|
|
6124
|
+
/* @__PURE__ */ jsx19(Box13, { marginTop: 1, children: /* @__PURE__ */ jsx19(
|
|
6173
6125
|
BlinkingTextInput,
|
|
6174
6126
|
{
|
|
6175
6127
|
placeholder: defaultApi[provider] || "",
|
|
@@ -6182,7 +6134,7 @@ function ApiUrlStep({ provider, onConfirm, onBack }) {
|
|
|
6182
6134
|
}
|
|
6183
6135
|
}
|
|
6184
6136
|
) }),
|
|
6185
|
-
/* @__PURE__ */
|
|
6137
|
+
/* @__PURE__ */ jsx19(Box13, { marginTop: 1, children: /* @__PURE__ */ jsx19(Text13, { dimColor: true, children: "Press ESC to go back" }) })
|
|
6186
6138
|
] });
|
|
6187
6139
|
}
|
|
6188
6140
|
|
|
@@ -6191,7 +6143,7 @@ import { MultiSelect } from "@inkjs/ui";
|
|
|
6191
6143
|
import { Box as Box14, Text as Text14, useInput as useInput8 } from "ink";
|
|
6192
6144
|
import { useStepperInput as useStepperInput3 } from "ink-stepper";
|
|
6193
6145
|
import { useEffect as useEffect11 } from "react";
|
|
6194
|
-
import { jsx as
|
|
6146
|
+
import { jsx as jsx20, jsxs as jsxs13 } from "react/jsx-runtime";
|
|
6195
6147
|
var SETTINGS = [
|
|
6196
6148
|
{
|
|
6197
6149
|
label: "Save Harper agent memory locally",
|
|
@@ -6244,8 +6196,8 @@ function EnvironmentSettingsStep({ onConfirm, onBack }) {
|
|
|
6244
6196
|
onConfirm();
|
|
6245
6197
|
};
|
|
6246
6198
|
return /* @__PURE__ */ jsxs13(Box14, { flexDirection: "column", children: [
|
|
6247
|
-
/* @__PURE__ */
|
|
6248
|
-
/* @__PURE__ */
|
|
6199
|
+
/* @__PURE__ */ jsx20(Text14, { children: "Additional Settings (all enabled by default):" }),
|
|
6200
|
+
/* @__PURE__ */ jsx20(
|
|
6249
6201
|
MultiSelect,
|
|
6250
6202
|
{
|
|
6251
6203
|
options,
|
|
@@ -6281,8 +6233,8 @@ var compactorModelsByProvider = {
|
|
|
6281
6233
|
import { Select } from "@inkjs/ui";
|
|
6282
6234
|
import { Box as Box15, Text as Text15, useInput as useInput9 } from "ink";
|
|
6283
6235
|
import { useStepperInput as useStepperInput4 } from "ink-stepper";
|
|
6284
|
-
import { useEffect as useEffect12, useState as
|
|
6285
|
-
import { jsx as
|
|
6236
|
+
import { useEffect as useEffect12, useState as useState15 } from "react";
|
|
6237
|
+
import { jsx as jsx21, jsxs as jsxs14 } from "react/jsx-runtime";
|
|
6286
6238
|
function ModelSelectionStep({
|
|
6287
6239
|
title,
|
|
6288
6240
|
models,
|
|
@@ -6290,7 +6242,7 @@ function ModelSelectionStep({
|
|
|
6290
6242
|
onBack
|
|
6291
6243
|
}) {
|
|
6292
6244
|
const { disableNavigation, enableNavigation } = useStepperInput4();
|
|
6293
|
-
const [isCustom, setIsCustom] =
|
|
6245
|
+
const [isCustom, setIsCustom] = useState15(false);
|
|
6294
6246
|
useEffect12(() => {
|
|
6295
6247
|
disableNavigation();
|
|
6296
6248
|
return () => enableNavigation();
|
|
@@ -6310,7 +6262,7 @@ function ModelSelectionStep({
|
|
|
6310
6262
|
"Enter custom model name for: ",
|
|
6311
6263
|
title
|
|
6312
6264
|
] }),
|
|
6313
|
-
/* @__PURE__ */
|
|
6265
|
+
/* @__PURE__ */ jsx21(
|
|
6314
6266
|
BlinkingTextInput,
|
|
6315
6267
|
{
|
|
6316
6268
|
onSubmit: (v) => {
|
|
@@ -6322,12 +6274,12 @@ function ModelSelectionStep({
|
|
|
6322
6274
|
}
|
|
6323
6275
|
}
|
|
6324
6276
|
),
|
|
6325
|
-
/* @__PURE__ */
|
|
6277
|
+
/* @__PURE__ */ jsx21(Box15, { marginTop: 1, children: /* @__PURE__ */ jsx21(Text15, { dimColor: true, children: "Press ESC to go back to list" }) })
|
|
6326
6278
|
] });
|
|
6327
6279
|
}
|
|
6328
6280
|
return /* @__PURE__ */ jsxs14(Box15, { flexDirection: "column", children: [
|
|
6329
|
-
/* @__PURE__ */
|
|
6330
|
-
/* @__PURE__ */
|
|
6281
|
+
/* @__PURE__ */ jsx21(Text15, { children: title }),
|
|
6282
|
+
/* @__PURE__ */ jsx21(
|
|
6331
6283
|
Select,
|
|
6332
6284
|
{
|
|
6333
6285
|
options: [
|
|
@@ -6343,7 +6295,7 @@ function ModelSelectionStep({
|
|
|
6343
6295
|
}
|
|
6344
6296
|
}
|
|
6345
6297
|
),
|
|
6346
|
-
/* @__PURE__ */
|
|
6298
|
+
/* @__PURE__ */ jsx21(Box15, { marginTop: 1, children: /* @__PURE__ */ jsx21(Text15, { dimColor: true, children: "Press ESC to go back" }) })
|
|
6347
6299
|
] });
|
|
6348
6300
|
}
|
|
6349
6301
|
|
|
@@ -6362,7 +6314,7 @@ var providers = [
|
|
|
6362
6314
|
];
|
|
6363
6315
|
|
|
6364
6316
|
// ink/configurationWizard/ProviderStep.tsx
|
|
6365
|
-
import { jsx as
|
|
6317
|
+
import { jsx as jsx22, jsxs as jsxs15 } from "react/jsx-runtime";
|
|
6366
6318
|
function ProviderStep({ onConfirm }) {
|
|
6367
6319
|
const { disableNavigation, enableNavigation } = useStepperInput5();
|
|
6368
6320
|
useEffect13(() => {
|
|
@@ -6370,8 +6322,8 @@ function ProviderStep({ onConfirm }) {
|
|
|
6370
6322
|
return () => enableNavigation();
|
|
6371
6323
|
}, [disableNavigation, enableNavigation]);
|
|
6372
6324
|
return /* @__PURE__ */ jsxs15(Box16, { flexDirection: "column", children: [
|
|
6373
|
-
/* @__PURE__ */
|
|
6374
|
-
/* @__PURE__ */
|
|
6325
|
+
/* @__PURE__ */ jsx22(Text16, { children: "What model provider would you like to use today?" }),
|
|
6326
|
+
/* @__PURE__ */ jsx22(
|
|
6375
6327
|
Select2,
|
|
6376
6328
|
{
|
|
6377
6329
|
options: providers,
|
|
@@ -6384,7 +6336,7 @@ function ProviderStep({ onConfirm }) {
|
|
|
6384
6336
|
// ink/configurationWizard/StepperProgress.tsx
|
|
6385
6337
|
import { Box as Box17, Text as Text17 } from "ink";
|
|
6386
6338
|
import { Fragment as Fragment3 } from "react";
|
|
6387
|
-
import { jsx as
|
|
6339
|
+
import { jsx as jsx23, jsxs as jsxs16 } from "react/jsx-runtime";
|
|
6388
6340
|
var markers = {
|
|
6389
6341
|
completed: " \u2713 ",
|
|
6390
6342
|
current: " \u25CF ",
|
|
@@ -6393,8 +6345,8 @@ var markers = {
|
|
|
6393
6345
|
var SEGMENT_WIDTH = 12;
|
|
6394
6346
|
function StepperProgress({ steps, currentStep }) {
|
|
6395
6347
|
return /* @__PURE__ */ jsxs16(Box17, { flexDirection: "column", marginBottom: 1, children: [
|
|
6396
|
-
/* @__PURE__ */
|
|
6397
|
-
return /* @__PURE__ */
|
|
6348
|
+
/* @__PURE__ */ jsx23(Box17, { children: steps.map((step) => {
|
|
6349
|
+
return /* @__PURE__ */ jsx23(Box17, { width: SEGMENT_WIDTH, justifyContent: "center", children: /* @__PURE__ */ jsx23(
|
|
6398
6350
|
Text17,
|
|
6399
6351
|
{
|
|
6400
6352
|
color: step.completed ? "green" : step.current ? "cyan" : "gray",
|
|
@@ -6404,25 +6356,25 @@ function StepperProgress({ steps, currentStep }) {
|
|
|
6404
6356
|
}
|
|
6405
6357
|
) }, step.name);
|
|
6406
6358
|
}) }),
|
|
6407
|
-
/* @__PURE__ */
|
|
6359
|
+
/* @__PURE__ */ jsx23(Box17, { children: steps.map((step, idx) => {
|
|
6408
6360
|
const marker = step.completed ? markers.completed : step.current ? markers.current : markers.pending;
|
|
6409
6361
|
const beforeLineColor = step.completed || idx <= currentStep ? "green" : "gray";
|
|
6410
6362
|
const afterLineColor = step.completed ? "green" : "gray";
|
|
6411
6363
|
const markerColor = step.completed ? "green" : step.current ? "cyan" : "gray";
|
|
6412
6364
|
return /* @__PURE__ */ jsxs16(Fragment3, { children: [
|
|
6413
|
-
/* @__PURE__ */
|
|
6414
|
-
/* @__PURE__ */
|
|
6415
|
-
/* @__PURE__ */
|
|
6365
|
+
/* @__PURE__ */ jsx23(Text17, { color: beforeLineColor, children: "\u2501".repeat(SEGMENT_WIDTH / 2 - 2) }),
|
|
6366
|
+
/* @__PURE__ */ jsx23(Text17, { color: markerColor, bold: step.current, children: marker }),
|
|
6367
|
+
/* @__PURE__ */ jsx23(Text17, { color: afterLineColor, children: "\u2501".repeat(SEGMENT_WIDTH / 2 - 1) })
|
|
6416
6368
|
] }, step.name);
|
|
6417
6369
|
}) })
|
|
6418
6370
|
] });
|
|
6419
6371
|
}
|
|
6420
6372
|
|
|
6421
6373
|
// ink/configurationWizard/ConfigurationWizard.tsx
|
|
6422
|
-
import { jsx as
|
|
6374
|
+
import { jsx as jsx24, jsxs as jsxs17 } from "react/jsx-runtime";
|
|
6423
6375
|
function ConfigurationWizard({ onComplete }) {
|
|
6424
|
-
const [provider, setProvider] =
|
|
6425
|
-
const [ollamaModels, setOllamaModels] =
|
|
6376
|
+
const [provider, setProvider] = useState16("OpenAI");
|
|
6377
|
+
const [ollamaModels, setOllamaModels] = useState16([]);
|
|
6426
6378
|
useEffect14(() => {
|
|
6427
6379
|
if (provider === "Ollama") {
|
|
6428
6380
|
fetchOllamaModels().then((models2) => {
|
|
@@ -6439,7 +6391,7 @@ function ConfigurationWizard({ onComplete }) {
|
|
|
6439
6391
|
});
|
|
6440
6392
|
const models = provider === "Ollama" && ollamaModels.length > 0 ? [.../* @__PURE__ */ new Set([...ollamaModels, ...modelsByProvider[provider]])] : modelsByProvider[provider];
|
|
6441
6393
|
const compactorModels = provider === "Ollama" && ollamaModels.length > 0 ? [.../* @__PURE__ */ new Set([...ollamaModels, ...compactorModelsByProvider[provider]])] : compactorModelsByProvider[provider];
|
|
6442
|
-
return /* @__PURE__ */
|
|
6394
|
+
return /* @__PURE__ */ jsx24(Box18, { flexDirection: "column", padding: 1, minHeight: 10, children: /* @__PURE__ */ jsxs17(
|
|
6443
6395
|
Stepper,
|
|
6444
6396
|
{
|
|
6445
6397
|
onComplete,
|
|
@@ -6447,7 +6399,7 @@ function ConfigurationWizard({ onComplete }) {
|
|
|
6447
6399
|
keyboardNav: true,
|
|
6448
6400
|
renderProgress: StepperProgress,
|
|
6449
6401
|
children: [
|
|
6450
|
-
/* @__PURE__ */
|
|
6402
|
+
/* @__PURE__ */ jsx24(Step, { name: "AI Provider", children: ({ goNext }) => /* @__PURE__ */ jsx24(
|
|
6451
6403
|
ProviderStep,
|
|
6452
6404
|
{
|
|
6453
6405
|
onConfirm: (p) => {
|
|
@@ -6456,7 +6408,7 @@ function ConfigurationWizard({ onComplete }) {
|
|
|
6456
6408
|
}
|
|
6457
6409
|
}
|
|
6458
6410
|
) }),
|
|
6459
|
-
/* @__PURE__ */
|
|
6411
|
+
/* @__PURE__ */ jsx24(Step, { name: provider !== "Ollama" ? "API Key" : "API", children: ({ goNext, goBack }) => provider !== "Ollama" ? /* @__PURE__ */ jsx24(
|
|
6460
6412
|
ApiKeyStep,
|
|
6461
6413
|
{
|
|
6462
6414
|
provider,
|
|
@@ -6466,7 +6418,7 @@ function ConfigurationWizard({ onComplete }) {
|
|
|
6466
6418
|
},
|
|
6467
6419
|
onBack: goBack
|
|
6468
6420
|
}
|
|
6469
|
-
) : /* @__PURE__ */
|
|
6421
|
+
) : /* @__PURE__ */ jsx24(
|
|
6470
6422
|
ApiUrlStep,
|
|
6471
6423
|
{
|
|
6472
6424
|
provider,
|
|
@@ -6477,7 +6429,7 @@ function ConfigurationWizard({ onComplete }) {
|
|
|
6477
6429
|
onBack: goBack
|
|
6478
6430
|
}
|
|
6479
6431
|
) }),
|
|
6480
|
-
/* @__PURE__ */
|
|
6432
|
+
/* @__PURE__ */ jsx24(Step, { name: "Model", children: ({ goNext, goBack }) => /* @__PURE__ */ jsx24(
|
|
6481
6433
|
ModelSelectionStep,
|
|
6482
6434
|
{
|
|
6483
6435
|
title: "What model would you like to use?",
|
|
@@ -6490,7 +6442,7 @@ function ConfigurationWizard({ onComplete }) {
|
|
|
6490
6442
|
onBack: goBack
|
|
6491
6443
|
}
|
|
6492
6444
|
) }),
|
|
6493
|
-
/* @__PURE__ */
|
|
6445
|
+
/* @__PURE__ */ jsx24(Step, { name: "Compactor", children: ({ goNext, goBack }) => /* @__PURE__ */ jsx24(
|
|
6494
6446
|
ModelSelectionStep,
|
|
6495
6447
|
{
|
|
6496
6448
|
title: "What model should we use for memory compaction?",
|
|
@@ -6503,7 +6455,7 @@ function ConfigurationWizard({ onComplete }) {
|
|
|
6503
6455
|
onBack: goBack
|
|
6504
6456
|
}
|
|
6505
6457
|
) }),
|
|
6506
|
-
/* @__PURE__ */
|
|
6458
|
+
/* @__PURE__ */ jsx24(Step, { name: "Settings", children: ({ goNext, goBack }) => /* @__PURE__ */ jsx24(
|
|
6507
6459
|
EnvironmentSettingsStep,
|
|
6508
6460
|
{
|
|
6509
6461
|
onConfirm: () => {
|
|
@@ -6518,26 +6470,26 @@ function ConfigurationWizard({ onComplete }) {
|
|
|
6518
6470
|
}
|
|
6519
6471
|
|
|
6520
6472
|
// ink/main.tsx
|
|
6521
|
-
import { jsx as
|
|
6473
|
+
import { jsx as jsx25, jsxs as jsxs18 } from "react/jsx-runtime";
|
|
6522
6474
|
function bootstrapConfig() {
|
|
6523
6475
|
return new Promise((resolve2) => {
|
|
6524
|
-
render(/* @__PURE__ */
|
|
6476
|
+
render(/* @__PURE__ */ jsx25(MainConfig, { onComplete: resolve2 }));
|
|
6525
6477
|
});
|
|
6526
6478
|
}
|
|
6527
6479
|
function MainConfig({ onComplete }) {
|
|
6528
6480
|
const { exit } = useApp();
|
|
6529
6481
|
useListener("ExitUI", () => exit(), [exit]);
|
|
6530
|
-
return /* @__PURE__ */
|
|
6482
|
+
return /* @__PURE__ */ jsx25(ConfigurationWizard, { onComplete });
|
|
6531
6483
|
}
|
|
6532
6484
|
function bootstrapMain() {
|
|
6533
|
-
render(/* @__PURE__ */
|
|
6485
|
+
render(/* @__PURE__ */ jsx25(MainChat, {}));
|
|
6534
6486
|
}
|
|
6535
6487
|
function MainChat() {
|
|
6536
6488
|
const { exit } = useApp();
|
|
6537
6489
|
useListener("ExitUI", () => exit(), [exit]);
|
|
6538
|
-
return /* @__PURE__ */
|
|
6539
|
-
/* @__PURE__ */
|
|
6540
|
-
/* @__PURE__ */
|
|
6490
|
+
return /* @__PURE__ */ jsx25(CostProvider, { children: /* @__PURE__ */ jsx25(PlanProvider, { children: /* @__PURE__ */ jsx25(ActionsProvider, { children: /* @__PURE__ */ jsx25(ApprovalProvider, { children: /* @__PURE__ */ jsx25(SettingsProvider, { children: /* @__PURE__ */ jsxs18(ChatProvider, { children: [
|
|
6491
|
+
/* @__PURE__ */ jsx25(ChatContent, {}),
|
|
6492
|
+
/* @__PURE__ */ jsx25(DiffApprovalView, {})
|
|
6541
6493
|
] }) }) }) }) }) });
|
|
6542
6494
|
}
|
|
6543
6495
|
|