@supatest/cli 0.0.33 → 0.0.34
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/index.js +126 -64
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -343,14 +343,28 @@ function getTierFromProviderModel(providerModel) {
|
|
|
343
343
|
return null;
|
|
344
344
|
}
|
|
345
345
|
function getModelCostLabel(modelId) {
|
|
346
|
-
if (modelId === "small")
|
|
347
|
-
|
|
348
|
-
|
|
346
|
+
if (modelId === "small") {
|
|
347
|
+
return SMALL_COST_LABEL;
|
|
348
|
+
}
|
|
349
|
+
if (modelId === "medium") {
|
|
350
|
+
return MEDIUM_COST_LABEL;
|
|
351
|
+
}
|
|
352
|
+
if (modelId === "premium") {
|
|
353
|
+
return PREMIUM_COST_LABEL;
|
|
354
|
+
}
|
|
349
355
|
const model = getModelById(modelId);
|
|
350
356
|
if (model) {
|
|
351
|
-
|
|
357
|
+
if (model.costMultiplier === SMALL_COST_MULTIPLIER) {
|
|
358
|
+
return SMALL_COST_LABEL;
|
|
359
|
+
}
|
|
360
|
+
if (model.costMultiplier === MEDIUM_COST_MULTIPLIER) {
|
|
361
|
+
return MEDIUM_COST_LABEL;
|
|
362
|
+
}
|
|
363
|
+
if (model.costMultiplier === PREMIUM_COST_MULTIPLIER) {
|
|
364
|
+
return PREMIUM_COST_LABEL;
|
|
365
|
+
}
|
|
352
366
|
}
|
|
353
|
-
return
|
|
367
|
+
return MEDIUM_COST_LABEL;
|
|
354
368
|
}
|
|
355
369
|
function getModelDisplayName(id) {
|
|
356
370
|
if (MODEL_TIERS.includes(id)) {
|
|
@@ -591,7 +605,31 @@ function getToolDisplayName(toolName) {
|
|
|
591
605
|
};
|
|
592
606
|
return displayNameMap[toolName] || toolName;
|
|
593
607
|
}
|
|
594
|
-
|
|
608
|
+
function getToolCategory(toolName) {
|
|
609
|
+
const name = toolName.toLowerCase();
|
|
610
|
+
if (name.includes("read")) return "Read";
|
|
611
|
+
if (name.includes("write")) return "Write";
|
|
612
|
+
if (name.includes("edit")) return "Edit";
|
|
613
|
+
if (name.includes("bash") || name.includes("command")) return "Bash";
|
|
614
|
+
if (name.includes("glob")) return "Glob";
|
|
615
|
+
if (name.includes("grep")) return "Grep";
|
|
616
|
+
if (name.includes("task")) return "Task";
|
|
617
|
+
if (name.includes("todo")) return "Todo";
|
|
618
|
+
return getToolDisplayName(toolName);
|
|
619
|
+
}
|
|
620
|
+
function getToolGroupCounts(tools) {
|
|
621
|
+
const groups = tools.reduce(
|
|
622
|
+
(acc, tool) => {
|
|
623
|
+
const toolName = tool.toolName || tool.name || "";
|
|
624
|
+
const category = getToolCategory(toolName);
|
|
625
|
+
acc[category] = (acc[category] || 0) + 1;
|
|
626
|
+
return acc;
|
|
627
|
+
},
|
|
628
|
+
{}
|
|
629
|
+
);
|
|
630
|
+
return Object.entries(groups).map(([name, count]) => ({ name, count })).sort((a, b) => b.count - a.count);
|
|
631
|
+
}
|
|
632
|
+
var AVAILABLE_MODELS, DATE_SUFFIX_REGEX, SMALL_COST_MULTIPLIER, MEDIUM_COST_MULTIPLIER, PREMIUM_COST_MULTIPLIER, SMALL_COST_LABEL, MEDIUM_COST_LABEL, PREMIUM_COST_LABEL, MODEL_TIERS, CONTEXT_WINDOWS, util, objectUtil, ZodParsedType, getParsedType, ZodIssueCode, ZodError, errorMap, overrideErrorMap, makeIssue, ParseStatus, INVALID, DIRTY, OK, isAborted, isDirty, isValid, isAsync, errorUtil, ParseInputLazyPath, handleResult, ZodType, cuidRegex, cuid2Regex, ulidRegex, uuidRegex, nanoidRegex, jwtRegex, durationRegex, emailRegex, _emojiRegex, emojiRegex, ipv4Regex, ipv4CidrRegex, ipv6Regex, ipv6CidrRegex, base64Regex, base64urlRegex, dateRegexSource, dateRegex, ZodString, ZodNumber, ZodBigInt, ZodBoolean, ZodDate, ZodSymbol, ZodUndefined, ZodNull, ZodAny, ZodUnknown, ZodNever, ZodVoid, ZodArray, ZodObject, ZodUnion, getDiscriminator, ZodDiscriminatedUnion, ZodIntersection, ZodTuple, ZodRecord, ZodMap, ZodSet, ZodFunction, ZodLazy, ZodLiteral, ZodEnum, ZodNativeEnum, ZodPromise, ZodEffects, ZodOptional, ZodNullable, ZodDefault, ZodCatch, ZodNaN, ZodBranded, ZodPipeline, ZodReadonly, ZodFirstPartyTypeKind, stringType, numberType, booleanType, dateType, unknownType, arrayType, objectType, unionType, discriminatedUnionType, recordType, functionType, lazyType, literalType, enumType, promiseType, coerce, MAX_API_KEY_NAME_LENGTH, apiKeySchema, apiKeyUsageSchema, createApiKeyRequestSchema, apiKeyResponseSchema, apiKeyUsageSummarySchema, genericErrorSchema, validationErrorSchema, feedbackCategorySchema, FEEDBACK_CATEGORIES, createFeedbackSchema, feedbackResponseSchema, listFeedbackQuerySchema, feedbackListResponseSchema, healthMetricSchema, healthMetricDailyItemSchema, healthMetricsWithDailySchema, healthAnalyticsPeriodSchema, healthAnalyticsDailyItemSchema, healthAnalyticsResponseSchema, MAX_TIMEZONE_CHAR_LENGTH, organizationSchema, organizationSettingsSchema, textBlockSchema, toolUseBlockSchema, toolResultBlockSchema, thinkingBlockSchema, imageBlockSchema, contentBlockSchema, sessionSchema, createSessionRequestSchema, updateSessionRequestSchema, messageSchema, createMessageRequestSchema, cliEventSchema, createCLISessionRequestSchema, queryResultSchema, queryTurnSchema, queryContentSchema, queryUsageSchema, querySchema, runStatusSchema, testResultStatusSchema, testOutcomeSchema, attachmentKindSchema, stepCategorySchema, runSummarySchema, ciMetadataSchema, gitMetadataSchema, playwrightConfigSchema, errorInfoSchema, locationSchema, sourceSnippetSchema, runSchema, annotationSchema, testSchema, testResultSchema, baseStepSchema, stepSchema, attachmentSchema, listRunsQuerySchema, listTestsQuerySchema, runsListResponseSchema, runDetailResponseSchema, testsListResponseSchema, testDetailResponseSchema, testHistoryItemSchema, testHistoryResponseSchema, topOffenderSchema, topOffendersResponseSchema, trendPointSchema, trendsResponseSchema, errorCategorySchema, failureClusterSchema, newFailureSchema, runInsightsResponseSchema, FailureCategoryEnum, SelectorTypeEnum, FailureCategoryStatsSchema, FailureCategoriesResponseSchema, FailingSelectorStatsSchema, FailingSelectorsResponseSchema, newFailureItemSchema, newFailuresResponseSchema, flakyTestItemSchema, flakyTestsResponseSchema, slowestTestItemSchema, slowestTestsResponseSchema;
|
|
595
633
|
var init_shared_es = __esm({
|
|
596
634
|
"../shared/dist/shared.es.mjs"() {
|
|
597
635
|
"use strict";
|
|
@@ -619,6 +657,12 @@ var init_shared_es = __esm({
|
|
|
619
657
|
}
|
|
620
658
|
];
|
|
621
659
|
DATE_SUFFIX_REGEX = /-\d{8}$/;
|
|
660
|
+
SMALL_COST_MULTIPLIER = 0.5;
|
|
661
|
+
MEDIUM_COST_MULTIPLIER = 1;
|
|
662
|
+
PREMIUM_COST_MULTIPLIER = 2;
|
|
663
|
+
SMALL_COST_LABEL = "0.5x";
|
|
664
|
+
MEDIUM_COST_LABEL = "1x";
|
|
665
|
+
PREMIUM_COST_LABEL = "2x";
|
|
622
666
|
MODEL_TIERS = ["small", "medium", "premium"];
|
|
623
667
|
CONTEXT_WINDOWS = Object.fromEntries(
|
|
624
668
|
AVAILABLE_MODELS.map((m) => [m.id, m.contextWindow])
|
|
@@ -5321,7 +5365,7 @@ var CLI_VERSION;
|
|
|
5321
5365
|
var init_version = __esm({
|
|
5322
5366
|
"src/version.ts"() {
|
|
5323
5367
|
"use strict";
|
|
5324
|
-
CLI_VERSION = "0.0.
|
|
5368
|
+
CLI_VERSION = "0.0.34";
|
|
5325
5369
|
}
|
|
5326
5370
|
});
|
|
5327
5371
|
|
|
@@ -6932,7 +6976,7 @@ var init_react = __esm({
|
|
|
6932
6976
|
});
|
|
6933
6977
|
|
|
6934
6978
|
// src/ui/contexts/SessionContext.tsx
|
|
6935
|
-
import React, { createContext, useCallback, useContext, useState } from "react";
|
|
6979
|
+
import React, { createContext, useCallback, useContext, useMemo, useState } from "react";
|
|
6936
6980
|
var SessionContext, SessionProvider, useSession;
|
|
6937
6981
|
var init_SessionContext = __esm({
|
|
6938
6982
|
"src/ui/contexts/SessionContext.tsx"() {
|
|
@@ -7047,7 +7091,7 @@ var init_SessionContext = __esm({
|
|
|
7047
7091
|
const toggleToolGroups = useCallback(() => {
|
|
7048
7092
|
setToolGroupsExpanded((prev) => !prev);
|
|
7049
7093
|
}, []);
|
|
7050
|
-
const value = {
|
|
7094
|
+
const value = useMemo(() => ({
|
|
7051
7095
|
messages,
|
|
7052
7096
|
addMessage,
|
|
7053
7097
|
updateLastMessage,
|
|
@@ -7083,7 +7127,33 @@ var init_SessionContext = __esm({
|
|
|
7083
7127
|
setLlmProvider,
|
|
7084
7128
|
staticRemountKey,
|
|
7085
7129
|
refreshStatic
|
|
7086
|
-
}
|
|
7130
|
+
}), [
|
|
7131
|
+
messages,
|
|
7132
|
+
addMessage,
|
|
7133
|
+
updateLastMessage,
|
|
7134
|
+
updateMessageById,
|
|
7135
|
+
updateMessageByToolId,
|
|
7136
|
+
clearMessages,
|
|
7137
|
+
loadMessages,
|
|
7138
|
+
toggleAllToolOutputs,
|
|
7139
|
+
allToolsExpanded,
|
|
7140
|
+
toolGroupsExpanded,
|
|
7141
|
+
toggleToolGroups,
|
|
7142
|
+
todos,
|
|
7143
|
+
stats,
|
|
7144
|
+
updateStats,
|
|
7145
|
+
usageStats,
|
|
7146
|
+
isAgentRunning,
|
|
7147
|
+
shouldInterruptAgent,
|
|
7148
|
+
sessionId,
|
|
7149
|
+
webUrl,
|
|
7150
|
+
agentMode,
|
|
7151
|
+
planFilePath,
|
|
7152
|
+
selectedModel,
|
|
7153
|
+
llmProvider,
|
|
7154
|
+
staticRemountKey,
|
|
7155
|
+
refreshStatic
|
|
7156
|
+
]);
|
|
7087
7157
|
return /* @__PURE__ */ React.createElement(SessionContext.Provider, { value }, children);
|
|
7088
7158
|
};
|
|
7089
7159
|
useSession = () => {
|
|
@@ -7122,7 +7192,7 @@ var init_theme = __esm({
|
|
|
7122
7192
|
text: {
|
|
7123
7193
|
primary: "#FFFFFF",
|
|
7124
7194
|
secondary: "#A0AEC0",
|
|
7125
|
-
dim: "#
|
|
7195
|
+
dim: "#8C99B2",
|
|
7126
7196
|
accent: "#38B2AC",
|
|
7127
7197
|
// Cyan/teal accent
|
|
7128
7198
|
success: "#48BB78",
|
|
@@ -7138,7 +7208,7 @@ var init_theme = __esm({
|
|
|
7138
7208
|
},
|
|
7139
7209
|
// Borders
|
|
7140
7210
|
border: {
|
|
7141
|
-
default: "#
|
|
7211
|
+
default: "#8C99B2",
|
|
7142
7212
|
accent: "#38B2AC",
|
|
7143
7213
|
error: "#F56565"
|
|
7144
7214
|
},
|
|
@@ -7178,7 +7248,7 @@ var init_Header = __esm({
|
|
|
7178
7248
|
init_banner();
|
|
7179
7249
|
init_version();
|
|
7180
7250
|
init_theme();
|
|
7181
|
-
Header = ({ currentFolder, gitBranch, headless = false }) => {
|
|
7251
|
+
Header = React2.memo(({ currentFolder, gitBranch, headless = false }) => {
|
|
7182
7252
|
const version = CLI_VERSION;
|
|
7183
7253
|
const banner = getBanner();
|
|
7184
7254
|
const infoParts = [`v${version}`];
|
|
@@ -7203,7 +7273,7 @@ var init_Header = __esm({
|
|
|
7203
7273
|
/* @__PURE__ */ React2.createElement(Box, { justifyContent: "center", marginTop: 0 }, /* @__PURE__ */ React2.createElement(Text, { color: theme.text.dim }, infoLine)),
|
|
7204
7274
|
!headless && /* @__PURE__ */ React2.createElement(Box, { flexDirection: "column", marginTop: 1, paddingX: 2, width: "100%" }, /* @__PURE__ */ React2.createElement(Box, { flexDirection: "column", marginBottom: 0 }, /* @__PURE__ */ React2.createElement(Text, { color: theme.text.dim }, "\u{1F4A1} ", /* @__PURE__ */ React2.createElement(Text, { color: theme.text.secondary }, "Tip:"), " Use ", /* @__PURE__ */ React2.createElement(Text, { bold: true, color: theme.text.accent }, "@filename"), " to reference files, or ", /* @__PURE__ */ React2.createElement(Text, { bold: true, color: theme.text.accent }, "/help"), " for commands")), /* @__PURE__ */ React2.createElement(Box, { flexDirection: "column", marginTop: 0 }, /* @__PURE__ */ React2.createElement(Text, { color: theme.text.dim }, "\u2328\uFE0F ", /* @__PURE__ */ React2.createElement(Text, { color: theme.text.secondary }, "Shortcuts:"), " ", /* @__PURE__ */ React2.createElement(Text, { bold: true, color: theme.text.accent }, "Ctrl+H"), " help, ", /* @__PURE__ */ React2.createElement(Text, { bold: true, color: theme.text.accent }, "Ctrl+C"), " exit, ", /* @__PURE__ */ React2.createElement(Text, { bold: true, color: theme.text.accent }, "ESC"), " interrupt")), /* @__PURE__ */ React2.createElement(Box, { flexDirection: "column", marginTop: 0 }, /* @__PURE__ */ React2.createElement(Text, { color: theme.text.dim }, "\u{1F680} ", /* @__PURE__ */ React2.createElement(Text, { color: theme.text.secondary }, "Prompt Tips:"), " Be explicit with instructions, provide context, use examples, and think step-by-step")))
|
|
7205
7275
|
);
|
|
7206
|
-
};
|
|
7276
|
+
});
|
|
7207
7277
|
}
|
|
7208
7278
|
});
|
|
7209
7279
|
|
|
@@ -7211,7 +7281,7 @@ var init_Header = __esm({
|
|
|
7211
7281
|
import chalk2 from "chalk";
|
|
7212
7282
|
import { Box as Box2, Text as Text2 } from "ink";
|
|
7213
7283
|
import { all, createLowlight } from "lowlight";
|
|
7214
|
-
import React3, { useMemo } from "react";
|
|
7284
|
+
import React3, { useMemo as useMemo2 } from "react";
|
|
7215
7285
|
function parseMarkdownSections(text) {
|
|
7216
7286
|
const sections = [];
|
|
7217
7287
|
const lines = text.split(/\r?\n/);
|
|
@@ -7371,7 +7441,7 @@ var init_markdown = __esm({
|
|
|
7371
7441
|
text,
|
|
7372
7442
|
isPending = false
|
|
7373
7443
|
}) => {
|
|
7374
|
-
const sections =
|
|
7444
|
+
const sections = useMemo2(() => parseMarkdownSections(text), [text]);
|
|
7375
7445
|
const elements = sections.map((section, index) => {
|
|
7376
7446
|
if (section.type === "table" && section.tableRows) {
|
|
7377
7447
|
return /* @__PURE__ */ React3.createElement(Table, { key: `table-${index}`, rows: section.tableRows });
|
|
@@ -7907,33 +7977,11 @@ var init_ToolMessage = __esm({
|
|
|
7907
7977
|
// src/ui/components/messages/ToolGroup.tsx
|
|
7908
7978
|
import { Box as Box9, Text as Text9 } from "ink";
|
|
7909
7979
|
import React10 from "react";
|
|
7910
|
-
function getToolCategory(toolName) {
|
|
7911
|
-
const name = toolName.toLowerCase();
|
|
7912
|
-
if (name.includes("read")) return "Read";
|
|
7913
|
-
if (name.includes("write")) return "Write";
|
|
7914
|
-
if (name.includes("edit")) return "Edit";
|
|
7915
|
-
if (name.includes("bash") || name.includes("command")) return "Bash";
|
|
7916
|
-
if (name.includes("glob")) return "Glob";
|
|
7917
|
-
if (name.includes("grep")) return "Grep";
|
|
7918
|
-
if (name.includes("task")) return "Task";
|
|
7919
|
-
if (name.includes("todo")) return "Todo";
|
|
7920
|
-
return toolName.charAt(0).toUpperCase() + toolName.slice(1).toLowerCase();
|
|
7921
|
-
}
|
|
7922
|
-
function getToolGroupCounts(tools) {
|
|
7923
|
-
const groups = tools.reduce(
|
|
7924
|
-
(acc, tool) => {
|
|
7925
|
-
const category = getToolCategory(tool.toolName);
|
|
7926
|
-
acc[category] = (acc[category] || 0) + 1;
|
|
7927
|
-
return acc;
|
|
7928
|
-
},
|
|
7929
|
-
{}
|
|
7930
|
-
);
|
|
7931
|
-
return Object.entries(groups).map(([name, count]) => ({ name, count })).sort((a, b) => b.count - a.count);
|
|
7932
|
-
}
|
|
7933
7980
|
var ToolGroup;
|
|
7934
7981
|
var init_ToolGroup = __esm({
|
|
7935
7982
|
"src/ui/components/messages/ToolGroup.tsx"() {
|
|
7936
7983
|
"use strict";
|
|
7984
|
+
init_shared_es();
|
|
7937
7985
|
init_theme();
|
|
7938
7986
|
init_ToolMessage();
|
|
7939
7987
|
ToolGroup = ({
|
|
@@ -8021,7 +8069,7 @@ var init_QueuedMessageDisplay = __esm({
|
|
|
8021
8069
|
|
|
8022
8070
|
// src/ui/components/MessageList.tsx
|
|
8023
8071
|
import { Box as Box12, Static } from "ink";
|
|
8024
|
-
import React13, { useMemo as
|
|
8072
|
+
import React13, { useMemo as useMemo4, useRef } from "react";
|
|
8025
8073
|
var MessageList;
|
|
8026
8074
|
var init_MessageList = __esm({
|
|
8027
8075
|
"src/ui/components/MessageList.tsx"() {
|
|
@@ -8135,7 +8183,28 @@ var init_MessageList = __esm({
|
|
|
8135
8183
|
}
|
|
8136
8184
|
return renderMessage(group.messages[0]);
|
|
8137
8185
|
};
|
|
8138
|
-
const
|
|
8186
|
+
const lastUserMessageIndex = useMemo4(() => {
|
|
8187
|
+
for (let i = messages.length - 1; i >= 0; i--) {
|
|
8188
|
+
if (messages[i].type === "user") {
|
|
8189
|
+
return i;
|
|
8190
|
+
}
|
|
8191
|
+
}
|
|
8192
|
+
return -1;
|
|
8193
|
+
}, [messages]);
|
|
8194
|
+
const hasPendingAssistant = useMemo4(
|
|
8195
|
+
() => messages.some((m) => m.type === "assistant" && m.isPending),
|
|
8196
|
+
[messages]
|
|
8197
|
+
);
|
|
8198
|
+
const completedBoundaryRef = useRef(-1);
|
|
8199
|
+
const completedBoundaryKey = useMemo4(() => {
|
|
8200
|
+
const currentBoundary = lastUserMessageIndex;
|
|
8201
|
+
if (currentBoundary !== completedBoundaryRef.current) {
|
|
8202
|
+
completedBoundaryRef.current = currentBoundary;
|
|
8203
|
+
return `boundary-${currentBoundary}`;
|
|
8204
|
+
}
|
|
8205
|
+
return `boundary-${completedBoundaryRef.current}`;
|
|
8206
|
+
}, [lastUserMessageIndex]);
|
|
8207
|
+
const { completedGroups, currentTurnGroups } = useMemo4(() => {
|
|
8139
8208
|
const completed = [];
|
|
8140
8209
|
const currentTurn = [];
|
|
8141
8210
|
const processTurn = (turnMessages2, targetArray) => {
|
|
@@ -8159,13 +8228,6 @@ var init_MessageList = __esm({
|
|
|
8159
8228
|
}
|
|
8160
8229
|
flushToolGroup();
|
|
8161
8230
|
};
|
|
8162
|
-
let lastUserMessageIndex = -1;
|
|
8163
|
-
for (let i = messages.length - 1; i >= 0; i--) {
|
|
8164
|
-
if (messages[i].type === "user") {
|
|
8165
|
-
lastUserMessageIndex = i;
|
|
8166
|
-
break;
|
|
8167
|
-
}
|
|
8168
|
-
}
|
|
8169
8231
|
let turnMessages = [];
|
|
8170
8232
|
for (let i = 0; i < lastUserMessageIndex; i++) {
|
|
8171
8233
|
const msg = messages[i];
|
|
@@ -8184,8 +8246,8 @@ var init_MessageList = __esm({
|
|
|
8184
8246
|
const currentTurnMessages = lastUserMessageIndex >= 0 ? messages.slice(lastUserMessageIndex + 1) : messages;
|
|
8185
8247
|
processTurn(currentTurnMessages, currentTurn);
|
|
8186
8248
|
return { completedGroups: completed, currentTurnGroups: currentTurn };
|
|
8187
|
-
}, [messages]);
|
|
8188
|
-
const staticItems =
|
|
8249
|
+
}, [messages, lastUserMessageIndex, completedBoundaryKey]);
|
|
8250
|
+
const staticItems = useMemo4(() => [
|
|
8189
8251
|
{ id: "header", type: "header" },
|
|
8190
8252
|
...completedGroups.map((group, idx) => {
|
|
8191
8253
|
if (group.type === "group") {
|
|
@@ -8216,7 +8278,7 @@ var init_MessageList = __esm({
|
|
|
8216
8278
|
return null;
|
|
8217
8279
|
}
|
|
8218
8280
|
return /* @__PURE__ */ React13.createElement(Box12, { flexDirection: "column", key: group.type === "group" ? `current-group-${idx}` : group.messages[0].id, width: "100%" }, content);
|
|
8219
|
-
}), /* @__PURE__ */ React13.createElement(QueuedMessageDisplay, { messageQueue: queuedTasks }), isAgentRunning && !
|
|
8281
|
+
}), /* @__PURE__ */ React13.createElement(QueuedMessageDisplay, { messageQueue: queuedTasks }), isAgentRunning && !hasPendingAssistant && /* @__PURE__ */ React13.createElement(LoadingMessage, { headless, key: "loading" }));
|
|
8220
8282
|
};
|
|
8221
8283
|
}
|
|
8222
8284
|
});
|
|
@@ -9275,7 +9337,7 @@ import React17, {
|
|
|
9275
9337
|
useCallback as useCallback2,
|
|
9276
9338
|
useContext as useContext2,
|
|
9277
9339
|
useEffect as useEffect4,
|
|
9278
|
-
useRef as
|
|
9340
|
+
useRef as useRef3
|
|
9279
9341
|
} from "react";
|
|
9280
9342
|
function charLengthAt(str, i) {
|
|
9281
9343
|
if (str.length <= i) {
|
|
@@ -9562,7 +9624,7 @@ function KeypressProvider({
|
|
|
9562
9624
|
debugKeystrokeLogging
|
|
9563
9625
|
}) {
|
|
9564
9626
|
const { stdin, setRawMode } = useStdin2();
|
|
9565
|
-
const subscribers =
|
|
9627
|
+
const subscribers = useRef3(/* @__PURE__ */ new Set()).current;
|
|
9566
9628
|
const subscribe = useCallback2(
|
|
9567
9629
|
(handler) => subscribers.add(handler),
|
|
9568
9630
|
[subscribers]
|
|
@@ -11164,18 +11226,18 @@ var init_useModeToggle = __esm({
|
|
|
11164
11226
|
});
|
|
11165
11227
|
|
|
11166
11228
|
// src/ui/hooks/useOverlayEscapeGuard.ts
|
|
11167
|
-
import { useCallback as useCallback3, useMemo as
|
|
11229
|
+
import { useCallback as useCallback3, useMemo as useMemo5, useRef as useRef4 } from "react";
|
|
11168
11230
|
var useOverlayEscapeGuard;
|
|
11169
11231
|
var init_useOverlayEscapeGuard = __esm({
|
|
11170
11232
|
"src/ui/hooks/useOverlayEscapeGuard.ts"() {
|
|
11171
11233
|
"use strict";
|
|
11172
11234
|
useOverlayEscapeGuard = ({ overlays, suppressionMs = 250 }) => {
|
|
11173
|
-
const suppressUntilRef =
|
|
11235
|
+
const suppressUntilRef = useRef4(0);
|
|
11174
11236
|
const markOverlayClosed = useCallback3(() => {
|
|
11175
11237
|
suppressUntilRef.current = Date.now() + suppressionMs;
|
|
11176
11238
|
}, [suppressionMs]);
|
|
11177
11239
|
const isCancelSuppressed = useCallback3(() => Date.now() < suppressUntilRef.current, []);
|
|
11178
|
-
const isOverlayOpen =
|
|
11240
|
+
const isOverlayOpen = useMemo5(() => overlays.some(Boolean), [overlays]);
|
|
11179
11241
|
return { isOverlayOpen, isCancelSuppressed, markOverlayClosed };
|
|
11180
11242
|
};
|
|
11181
11243
|
}
|
|
@@ -11186,7 +11248,7 @@ import { execSync as execSync6 } from "child_process";
|
|
|
11186
11248
|
import { homedir as homedir6 } from "os";
|
|
11187
11249
|
import { Box as Box25, Text as Text23, useApp as useApp2, useStdout as useStdout2 } from "ink";
|
|
11188
11250
|
import Spinner3 from "ink-spinner";
|
|
11189
|
-
import React28, { useEffect as useEffect13, useRef as
|
|
11251
|
+
import React28, { useEffect as useEffect13, useRef as useRef5, useState as useState14 } from "react";
|
|
11190
11252
|
var getGitBranch2, getCurrentFolder2, AppContent, App;
|
|
11191
11253
|
var init_App = __esm({
|
|
11192
11254
|
"src/ui/App.tsx"() {
|
|
@@ -11244,7 +11306,7 @@ var init_App = __esm({
|
|
|
11244
11306
|
const [currentFolder] = useState14(() => getCurrentFolder2(config2.cwd));
|
|
11245
11307
|
const [hasInputContent, setHasInputContent] = useState14(false);
|
|
11246
11308
|
const [exitWarning, setExitWarning] = useState14(null);
|
|
11247
|
-
const inputPromptRef =
|
|
11309
|
+
const inputPromptRef = useRef5(null);
|
|
11248
11310
|
const [showSessionSelector, setShowSessionSelector] = useState14(false);
|
|
11249
11311
|
const [showModelSelector, setShowModelSelector] = useState14(false);
|
|
11250
11312
|
const [showProviderSelector, setShowProviderSelector] = useState14(false);
|
|
@@ -11600,7 +11662,7 @@ var init_App = __esm({
|
|
|
11600
11662
|
markOverlayClosed();
|
|
11601
11663
|
setShowHelp(false);
|
|
11602
11664
|
};
|
|
11603
|
-
const isInitialMount =
|
|
11665
|
+
const isInitialMount = useRef5(true);
|
|
11604
11666
|
useEffect13(() => {
|
|
11605
11667
|
const handleResize = () => {
|
|
11606
11668
|
setTerminalWidth(process.stdout.columns || 80);
|
|
@@ -11799,7 +11861,7 @@ __export(interactive_exports, {
|
|
|
11799
11861
|
runInteractive: () => runInteractive
|
|
11800
11862
|
});
|
|
11801
11863
|
import { render as render2 } from "ink";
|
|
11802
|
-
import React29, { useEffect as useEffect15, useRef as
|
|
11864
|
+
import React29, { useEffect as useEffect15, useRef as useRef6 } from "react";
|
|
11803
11865
|
function getToolDescription2(toolName, input) {
|
|
11804
11866
|
switch (toolName) {
|
|
11805
11867
|
case "Read":
|
|
@@ -12009,7 +12071,7 @@ var init_interactive = __esm({
|
|
|
12009
12071
|
selectedModel,
|
|
12010
12072
|
llmProvider
|
|
12011
12073
|
} = useSession();
|
|
12012
|
-
const agentRef =
|
|
12074
|
+
const agentRef = useRef6(null);
|
|
12013
12075
|
useEffect15(() => {
|
|
12014
12076
|
if (shouldInterruptAgent && agentRef.current) {
|
|
12015
12077
|
agentRef.current.abort();
|
|
@@ -12332,7 +12394,7 @@ init_SessionContext();
|
|
|
12332
12394
|
import { execSync as execSync2 } from "child_process";
|
|
12333
12395
|
import { homedir as homedir3 } from "os";
|
|
12334
12396
|
import { Box as Box13, useApp } from "ink";
|
|
12335
|
-
import React14, { useEffect as useEffect2, useRef, useState as useState3 } from "react";
|
|
12397
|
+
import React14, { useEffect as useEffect2, useRef as useRef2, useState as useState3 } from "react";
|
|
12336
12398
|
var getGitBranch = () => {
|
|
12337
12399
|
try {
|
|
12338
12400
|
return execSync2("git rev-parse --abbrev-ref HEAD", { encoding: "utf8" }).trim();
|
|
@@ -12358,7 +12420,7 @@ var HeadlessAgentRunner = ({ config: config2, sessionId, apiClient, onComplete }
|
|
|
12358
12420
|
setTodos,
|
|
12359
12421
|
setUsageStats
|
|
12360
12422
|
} = useSession();
|
|
12361
|
-
const agentRef =
|
|
12423
|
+
const agentRef = useRef2(null);
|
|
12362
12424
|
useEffect2(() => {
|
|
12363
12425
|
let isMounted = true;
|
|
12364
12426
|
const runAgent2 = async () => {
|
|
@@ -12446,7 +12508,7 @@ var HeadlessAppContent = ({
|
|
|
12446
12508
|
const [gitBranch] = useState3(() => getGitBranch());
|
|
12447
12509
|
const [currentFolder] = useState3(() => getCurrentFolder());
|
|
12448
12510
|
const [terminalWidth, setTerminalWidth] = useState3(process.stdout.columns || 80);
|
|
12449
|
-
const hasCompletedRef =
|
|
12511
|
+
const hasCompletedRef = useRef2(false);
|
|
12450
12512
|
useEffect2(() => {
|
|
12451
12513
|
setSessionId(sessionId);
|
|
12452
12514
|
if (webUrl) {
|