@cofy-x/dsh-console 0.1.0-rc.3 → 0.1.0-rc.4
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/README.md +4 -3
- package/cordis.patch.yml +58 -0
- package/dist/CHANGELOG.md +34 -1
- package/dist/{chunk-LKBS2JJK.js → chunk-BTABK2TP.js} +456 -409
- package/dist/dsh/index.js +1 -1
- package/dist/index.js +1 -1
- package/dist/presets/cordis.patch.yml +4 -13
- package/dist/presets/minimal.patch.yml +17 -0
- package/dist/presets/ptc.patch.yml +4 -13
- package/dist/presets/standard.patch.yml +4 -13
- package/package.json +70 -60
|
@@ -2446,10 +2446,10 @@ var emptyAgentActivitySnapshot = () => EMPTY_AGENT_ACTIVITY;
|
|
|
2446
2446
|
// src/ui/app-container.tsx
|
|
2447
2447
|
import {
|
|
2448
2448
|
useMemo as useMemo43,
|
|
2449
|
-
useState as
|
|
2449
|
+
useState as useState64,
|
|
2450
2450
|
useCallback as useCallback51,
|
|
2451
|
-
useEffect as
|
|
2452
|
-
useRef as
|
|
2451
|
+
useEffect as useEffect61,
|
|
2452
|
+
useRef as useRef38,
|
|
2453
2453
|
useLayoutEffect as useLayoutEffect5,
|
|
2454
2454
|
useSyncExternalStore as useSyncExternalStore10
|
|
2455
2455
|
} from "react";
|
|
@@ -6426,7 +6426,7 @@ import { Box as Box25 } from "ink";
|
|
|
6426
6426
|
import { Box as Box21, Text as Text21 } from "ink";
|
|
6427
6427
|
|
|
6428
6428
|
// src/generated/git-commit.ts
|
|
6429
|
-
var GIT_COMMIT_INFO = "
|
|
6429
|
+
var GIT_COMMIT_INFO = "916cd41";
|
|
6430
6430
|
|
|
6431
6431
|
// src/ui/components/dialogs/about-box.tsx
|
|
6432
6432
|
import { jsx as jsx28, jsxs as jsxs21 } from "react/jsx-runtime";
|
|
@@ -9012,8 +9012,33 @@ var MainContent = () => {
|
|
|
9012
9012
|
staticAreaMaxItemHeight,
|
|
9013
9013
|
availableTerminalHeight
|
|
9014
9014
|
} = uiState;
|
|
9015
|
+
const pendingHistoryStart = uiState.pendingHistoryStart ?? uiState.history.length;
|
|
9016
|
+
const staticHistory = useMemo15(
|
|
9017
|
+
() => uiState.history.slice(0, pendingHistoryStart),
|
|
9018
|
+
[uiState.history, pendingHistoryStart]
|
|
9019
|
+
);
|
|
9020
|
+
const liveItems = useMemo15(
|
|
9021
|
+
() => [
|
|
9022
|
+
...(isAlternateBuffer ? [] : uiState.history.slice(pendingHistoryStart)).map((item) => ({
|
|
9023
|
+
item,
|
|
9024
|
+
id: item.id,
|
|
9025
|
+
key: `history-${String(item.id)}`
|
|
9026
|
+
})),
|
|
9027
|
+
...pendingHistoryItems.map((item, index) => ({
|
|
9028
|
+
item,
|
|
9029
|
+
id: 0,
|
|
9030
|
+
key: `pending-${String(index)}`
|
|
9031
|
+
}))
|
|
9032
|
+
],
|
|
9033
|
+
[
|
|
9034
|
+
isAlternateBuffer,
|
|
9035
|
+
uiState.history,
|
|
9036
|
+
pendingHistoryStart,
|
|
9037
|
+
pendingHistoryItems
|
|
9038
|
+
]
|
|
9039
|
+
);
|
|
9015
9040
|
const historyItems = useMemo15(
|
|
9016
|
-
() =>
|
|
9041
|
+
() => staticHistory.map((h, index) => /* @__PURE__ */ jsx49(
|
|
9017
9042
|
MemoizedHistoryItemDisplay,
|
|
9018
9043
|
{
|
|
9019
9044
|
terminalWidth: mainAreaWidth,
|
|
@@ -9022,7 +9047,7 @@ var MainContent = () => {
|
|
|
9022
9047
|
item: h,
|
|
9023
9048
|
separateFromPrevious: shouldSeparateFromPrevious(
|
|
9024
9049
|
h,
|
|
9025
|
-
|
|
9050
|
+
staticHistory[index - 1]
|
|
9026
9051
|
),
|
|
9027
9052
|
isPending: false,
|
|
9028
9053
|
commands: uiState.slashCommands
|
|
@@ -9030,7 +9055,7 @@ var MainContent = () => {
|
|
|
9030
9055
|
h.id
|
|
9031
9056
|
)),
|
|
9032
9057
|
[
|
|
9033
|
-
|
|
9058
|
+
staticHistory,
|
|
9034
9059
|
mainAreaWidth,
|
|
9035
9060
|
staticAreaMaxItemHeight,
|
|
9036
9061
|
uiState.slashCommands
|
|
@@ -9038,27 +9063,28 @@ var MainContent = () => {
|
|
|
9038
9063
|
);
|
|
9039
9064
|
const pendingItems = useMemo15(
|
|
9040
9065
|
() => /* @__PURE__ */ jsx49(OverflowProvider, { children: /* @__PURE__ */ jsxs33(Box38, { flexDirection: "column", children: [
|
|
9041
|
-
|
|
9066
|
+
liveItems.map(({ item, id, key }, i) => /* @__PURE__ */ jsx49(
|
|
9042
9067
|
HistoryItemDisplay,
|
|
9043
9068
|
{
|
|
9044
9069
|
availableTerminalHeight: uiState.constrainHeight && !isAlternateBuffer ? availableTerminalHeight : void 0,
|
|
9045
9070
|
terminalWidth: mainAreaWidth,
|
|
9046
|
-
item: { ...item, id
|
|
9071
|
+
item: { ...item, id },
|
|
9047
9072
|
separateFromPrevious: shouldSeparateFromPrevious(
|
|
9048
9073
|
item,
|
|
9049
|
-
i > 0 ?
|
|
9074
|
+
i > 0 ? liveItems[i - 1]?.item : isAlternateBuffer ? uiState.history.at(-1) : staticHistory.at(-1)
|
|
9050
9075
|
),
|
|
9051
9076
|
isPending: true,
|
|
9052
9077
|
isFocused: !uiState.isEditorDialogOpen,
|
|
9053
9078
|
activeShellPtyId: uiState.activePtyId,
|
|
9054
9079
|
embeddedShellFocused: uiState.embeddedShellFocused
|
|
9055
9080
|
},
|
|
9056
|
-
|
|
9081
|
+
key
|
|
9057
9082
|
)),
|
|
9058
9083
|
/* @__PURE__ */ jsx49(ShowMoreLines, { constrainHeight: uiState.constrainHeight })
|
|
9059
9084
|
] }) }),
|
|
9060
9085
|
[
|
|
9061
|
-
|
|
9086
|
+
liveItems,
|
|
9087
|
+
staticHistory,
|
|
9062
9088
|
uiState.history,
|
|
9063
9089
|
uiState.constrainHeight,
|
|
9064
9090
|
isAlternateBuffer,
|
|
@@ -9076,6 +9102,7 @@ var MainContent = () => {
|
|
|
9076
9102
|
...uiState.history.map((item, index) => ({
|
|
9077
9103
|
type: "history",
|
|
9078
9104
|
item,
|
|
9105
|
+
pending: index >= pendingHistoryStart,
|
|
9079
9106
|
separateFromPrevious: shouldSeparateFromPrevious(
|
|
9080
9107
|
item,
|
|
9081
9108
|
uiState.history[index - 1]
|
|
@@ -9083,7 +9110,7 @@ var MainContent = () => {
|
|
|
9083
9110
|
})),
|
|
9084
9111
|
{ type: "pending" }
|
|
9085
9112
|
],
|
|
9086
|
-
[uiState.history]
|
|
9113
|
+
[uiState.history, pendingHistoryStart]
|
|
9087
9114
|
);
|
|
9088
9115
|
const renderItem = useCallback17(
|
|
9089
9116
|
({ item }) => {
|
|
@@ -9105,7 +9132,7 @@ var MainContent = () => {
|
|
|
9105
9132
|
availableTerminalHeightAgent: MAX_AGENT_MESSAGE_LINES,
|
|
9106
9133
|
item: item.item,
|
|
9107
9134
|
separateFromPrevious: item.separateFromPrevious,
|
|
9108
|
-
isPending:
|
|
9135
|
+
isPending: item.pending,
|
|
9109
9136
|
commands: uiState.slashCommands
|
|
9110
9137
|
},
|
|
9111
9138
|
item.item.id
|
|
@@ -19710,8 +19737,157 @@ function useHistory() {
|
|
|
19710
19737
|
);
|
|
19711
19738
|
}
|
|
19712
19739
|
|
|
19740
|
+
// src/ui/hooks/session/use-conversation-history.ts
|
|
19741
|
+
import { useEffect as useEffect38, useRef as useRef21, useState as useState38 } from "react";
|
|
19742
|
+
|
|
19743
|
+
// src/ui/conversation-history-projector.ts
|
|
19744
|
+
function projectedToolCallIds(messages) {
|
|
19745
|
+
return new Set(
|
|
19746
|
+
messages.flatMap(
|
|
19747
|
+
(message) => message.role === "tool" ? [message.callId] : []
|
|
19748
|
+
)
|
|
19749
|
+
);
|
|
19750
|
+
}
|
|
19751
|
+
function conversationMessageToHistoryItem(message, visibleToolCallIds) {
|
|
19752
|
+
const assistantContent = message.role === "assistant" ? message.content.filter(
|
|
19753
|
+
(block) => block.type !== "tool-call" || !visibleToolCallIds.has(block.id)
|
|
19754
|
+
) : void 0;
|
|
19755
|
+
if (message.role === "assistant" && assistantContent?.length === 0 && message.interrupted !== true) {
|
|
19756
|
+
return void 0;
|
|
19757
|
+
}
|
|
19758
|
+
if (message.role === "tool") {
|
|
19759
|
+
return {
|
|
19760
|
+
type: "tool_group",
|
|
19761
|
+
tools: [
|
|
19762
|
+
{
|
|
19763
|
+
callId: message.callId,
|
|
19764
|
+
name: message.presentation?.kind === "card" ? message.presentation.title ?? message.name : message.name,
|
|
19765
|
+
description: message.presentation?.kind === "compact" ? "" : message.presentation?.description ?? message.arguments,
|
|
19766
|
+
arguments: message.arguments,
|
|
19767
|
+
resultDisplay: message.presentation?.kind === "compact" ? void 0 : message.presentation?.resultDisplay ?? (message.result === void 0 ? void 0 : {
|
|
19768
|
+
type: "dsh-content",
|
|
19769
|
+
content: message.result.content,
|
|
19770
|
+
...message.result.error === void 0 ? {} : { error: message.result.error }
|
|
19771
|
+
}),
|
|
19772
|
+
...message.presentation?.kind === "compact" ? {
|
|
19773
|
+
presentation: {
|
|
19774
|
+
kind: "compact",
|
|
19775
|
+
label: message.presentation.label
|
|
19776
|
+
}
|
|
19777
|
+
} : {},
|
|
19778
|
+
status: message.status === "executing" ? "Executing" /* Executing */ : message.status === "success" ? "Success" /* Success */ : "Error" /* Error */
|
|
19779
|
+
}
|
|
19780
|
+
]
|
|
19781
|
+
};
|
|
19782
|
+
}
|
|
19783
|
+
if (message.role === "assistant") {
|
|
19784
|
+
return {
|
|
19785
|
+
type: "dsh_assistant",
|
|
19786
|
+
content: assistantContent ?? message.content,
|
|
19787
|
+
interrupted: message.interrupted === true,
|
|
19788
|
+
...message.turnMetrics === void 0 ? {} : { turnMetrics: message.turnMetrics }
|
|
19789
|
+
};
|
|
19790
|
+
}
|
|
19791
|
+
if (message.role === "user") {
|
|
19792
|
+
return {
|
|
19793
|
+
type: "dsh_user",
|
|
19794
|
+
content: message.displayContent ?? message.content
|
|
19795
|
+
};
|
|
19796
|
+
}
|
|
19797
|
+
return {
|
|
19798
|
+
type: message.status === "cancelled" ? "warning" /* WARNING */ : "error" /* ERROR */,
|
|
19799
|
+
text: conversationMessageText(message)
|
|
19800
|
+
};
|
|
19801
|
+
}
|
|
19802
|
+
function conversationMessageFingerprint(message, item) {
|
|
19803
|
+
if (message.role === "tool") {
|
|
19804
|
+
return JSON.stringify([
|
|
19805
|
+
message.status,
|
|
19806
|
+
message.arguments,
|
|
19807
|
+
message.result,
|
|
19808
|
+
message.presentation
|
|
19809
|
+
]);
|
|
19810
|
+
}
|
|
19811
|
+
if (message.role === "assistant" && item.type === "dsh_assistant") {
|
|
19812
|
+
return JSON.stringify([item.content, item.interrupted, item.turnMetrics]);
|
|
19813
|
+
}
|
|
19814
|
+
if (message.role === "user") {
|
|
19815
|
+
return JSON.stringify(message.displayContent ?? message.content);
|
|
19816
|
+
}
|
|
19817
|
+
return conversationMessageText(message);
|
|
19818
|
+
}
|
|
19819
|
+
|
|
19820
|
+
// src/ui/hooks/session/use-conversation-history.ts
|
|
19821
|
+
function useConversationHistory(sessionId, snapshot, manager) {
|
|
19822
|
+
const ids = useRef21(/* @__PURE__ */ new Map());
|
|
19823
|
+
const fingerprints = useRef21(/* @__PURE__ */ new Map());
|
|
19824
|
+
const [projectedSessionId, setProjectedSessionId] = useState38(sessionId);
|
|
19825
|
+
const [pendingHistoryStart, setPendingHistoryStart] = useState38();
|
|
19826
|
+
const { history, addItem, updateItem, clearItems, loadHistory } = manager;
|
|
19827
|
+
useEffect38(() => {
|
|
19828
|
+
if (projectedSessionId !== sessionId) {
|
|
19829
|
+
ids.current.clear();
|
|
19830
|
+
fingerprints.current.clear();
|
|
19831
|
+
clearItems();
|
|
19832
|
+
setPendingHistoryStart(void 0);
|
|
19833
|
+
setProjectedSessionId(sessionId);
|
|
19834
|
+
return;
|
|
19835
|
+
}
|
|
19836
|
+
const pendingStart = snapshot.busy ? Math.min(pendingHistoryStart ?? history.length, history.length) : void 0;
|
|
19837
|
+
if (pendingStart !== pendingHistoryStart) {
|
|
19838
|
+
setPendingHistoryStart(pendingStart);
|
|
19839
|
+
}
|
|
19840
|
+
const visibleToolCallIds = projectedToolCallIds(snapshot.messages);
|
|
19841
|
+
const projected = snapshot.messages.flatMap((message) => {
|
|
19842
|
+
const item = conversationMessageToHistoryItem(
|
|
19843
|
+
message,
|
|
19844
|
+
visibleToolCallIds
|
|
19845
|
+
);
|
|
19846
|
+
return item === void 0 ? [] : [{ message, item }];
|
|
19847
|
+
});
|
|
19848
|
+
const projectedIds = new Set(projected.map(({ message }) => message.id));
|
|
19849
|
+
const removedIds = /* @__PURE__ */ new Set();
|
|
19850
|
+
for (const [messageId, historyId] of ids.current) {
|
|
19851
|
+
if (!projectedIds.has(messageId)) {
|
|
19852
|
+
removedIds.add(historyId);
|
|
19853
|
+
ids.current.delete(messageId);
|
|
19854
|
+
fingerprints.current.delete(messageId);
|
|
19855
|
+
}
|
|
19856
|
+
}
|
|
19857
|
+
if (removedIds.size > 0) {
|
|
19858
|
+
loadHistory(history.filter((item) => !removedIds.has(item.id)));
|
|
19859
|
+
}
|
|
19860
|
+
const visibleHistoryIds = new Set(history.map((item) => item.id));
|
|
19861
|
+
for (const { message, item } of projected) {
|
|
19862
|
+
const historyId = ids.current.get(message.id);
|
|
19863
|
+
const fingerprint = conversationMessageFingerprint(message, item);
|
|
19864
|
+
if (historyId === void 0 || !visibleHistoryIds.has(historyId)) {
|
|
19865
|
+
const nextHistoryId = addItem(item);
|
|
19866
|
+
ids.current.set(message.id, nextHistoryId);
|
|
19867
|
+
fingerprints.current.set(message.id, fingerprint);
|
|
19868
|
+
visibleHistoryIds.add(nextHistoryId);
|
|
19869
|
+
} else if (fingerprints.current.get(message.id) !== fingerprint) {
|
|
19870
|
+
updateItem(historyId, item);
|
|
19871
|
+
fingerprints.current.set(message.id, fingerprint);
|
|
19872
|
+
}
|
|
19873
|
+
}
|
|
19874
|
+
}, [
|
|
19875
|
+
sessionId,
|
|
19876
|
+
projectedSessionId,
|
|
19877
|
+
snapshot.messages,
|
|
19878
|
+
snapshot.busy,
|
|
19879
|
+
pendingHistoryStart,
|
|
19880
|
+
history,
|
|
19881
|
+
addItem,
|
|
19882
|
+
updateItem,
|
|
19883
|
+
clearItems,
|
|
19884
|
+
loadHistory
|
|
19885
|
+
]);
|
|
19886
|
+
return pendingHistoryStart;
|
|
19887
|
+
}
|
|
19888
|
+
|
|
19713
19889
|
// src/ui/hooks/commands/use-slash-command-processor.ts
|
|
19714
|
-
import { useCallback as useCallback41, useMemo as useMemo41, useEffect as
|
|
19890
|
+
import { useCallback as useCallback41, useMemo as useMemo41, useEffect as useEffect50, useRef as useRef29, useState as useState52 } from "react";
|
|
19715
19891
|
|
|
19716
19892
|
// src/services/command-service.ts
|
|
19717
19893
|
var CommandService = class _CommandService {
|
|
@@ -19833,7 +20009,7 @@ function loadChangelog() {
|
|
|
19833
20009
|
}
|
|
19834
20010
|
|
|
19835
20011
|
// src/ui/components/dialogs/changelog-dialog.tsx
|
|
19836
|
-
import { useMemo as useMemo32, useState as
|
|
20012
|
+
import { useMemo as useMemo32, useState as useState39 } from "react";
|
|
19837
20013
|
import { Box as Box72, Text as Text67 } from "ink";
|
|
19838
20014
|
import stringWidth4 from "string-width";
|
|
19839
20015
|
import { jsx as jsx95, jsxs as jsxs69 } from "react/jsx-runtime";
|
|
@@ -19911,7 +20087,7 @@ function ChangelogDialog({
|
|
|
19911
20087
|
[content, contentWidth]
|
|
19912
20088
|
);
|
|
19913
20089
|
const maxOffset = Math.max(0, lines.length - viewportHeight);
|
|
19914
|
-
const [offset, setOffset] =
|
|
20090
|
+
const [offset, setOffset] = useState39(0);
|
|
19915
20091
|
const visibleOffset = Math.min(offset, maxOffset);
|
|
19916
20092
|
useKeypress(
|
|
19917
20093
|
(key) => {
|
|
@@ -20104,11 +20280,11 @@ var vimCommand = {
|
|
|
20104
20280
|
import React19 from "react";
|
|
20105
20281
|
|
|
20106
20282
|
// src/ui/components/dialogs/model-dialog.tsx
|
|
20107
|
-
import { useCallback as useCallback36, useEffect as
|
|
20283
|
+
import { useCallback as useCallback36, useEffect as useEffect40, useMemo as useMemo33, useRef as useRef23, useState as useState41 } from "react";
|
|
20108
20284
|
import { Box as Box74, Text as Text69 } from "ink";
|
|
20109
20285
|
|
|
20110
20286
|
// src/ui/components/dialogs/provider-setup-dialog.tsx
|
|
20111
|
-
import { useEffect as
|
|
20287
|
+
import { useEffect as useEffect39, useRef as useRef22, useState as useState40 } from "react";
|
|
20112
20288
|
import { Box as Box73, Text as Text68 } from "ink";
|
|
20113
20289
|
import { jsx as jsx96, jsxs as jsxs70 } from "react/jsx-runtime";
|
|
20114
20290
|
function ProviderSetupDialog({
|
|
@@ -20119,13 +20295,13 @@ function ProviderSetupDialog({
|
|
|
20119
20295
|
onConfigured
|
|
20120
20296
|
}) {
|
|
20121
20297
|
useSensitiveInputProtection();
|
|
20122
|
-
const [view, setView] =
|
|
20123
|
-
const [secret, setSecret] =
|
|
20124
|
-
const [saving, setSaving] =
|
|
20125
|
-
const [error, setError] =
|
|
20126
|
-
const mountedRef =
|
|
20127
|
-
const saveControllerRef =
|
|
20128
|
-
|
|
20298
|
+
const [view, setView] = useState40();
|
|
20299
|
+
const [secret, setSecret] = useState40("");
|
|
20300
|
+
const [saving, setSaving] = useState40(false);
|
|
20301
|
+
const [error, setError] = useState40();
|
|
20302
|
+
const mountedRef = useRef22(true);
|
|
20303
|
+
const saveControllerRef = useRef22(void 0);
|
|
20304
|
+
useEffect39(() => {
|
|
20129
20305
|
mountedRef.current = true;
|
|
20130
20306
|
const controller = new AbortController();
|
|
20131
20307
|
void runtime.describeProvider(provider, controller.signal).then(setView).catch((cause) => {
|
|
@@ -20308,19 +20484,19 @@ function ModelDialog({
|
|
|
20308
20484
|
onSwitched,
|
|
20309
20485
|
providerSetupRuntime
|
|
20310
20486
|
}) {
|
|
20311
|
-
const [models, setModels] =
|
|
20312
|
-
const [highlighted, setHighlighted] =
|
|
20487
|
+
const [models, setModels] = useState41([]);
|
|
20488
|
+
const [highlighted, setHighlighted] = useState41(
|
|
20313
20489
|
runtime.getSnapshot().current
|
|
20314
20490
|
);
|
|
20315
|
-
const [pending, setPending] =
|
|
20316
|
-
const [loading, setLoading] =
|
|
20317
|
-
const [switching, setSwitching] =
|
|
20318
|
-
const [checkingProvider, setCheckingProvider] =
|
|
20319
|
-
const [error, setError] =
|
|
20320
|
-
const [setupSelection, setSetupSelection] =
|
|
20321
|
-
const [reasoningSelection, setReasoningSelection] =
|
|
20322
|
-
const providerCheckRef =
|
|
20323
|
-
|
|
20491
|
+
const [pending, setPending] = useState41();
|
|
20492
|
+
const [loading, setLoading] = useState41(true);
|
|
20493
|
+
const [switching, setSwitching] = useState41(false);
|
|
20494
|
+
const [checkingProvider, setCheckingProvider] = useState41(false);
|
|
20495
|
+
const [error, setError] = useState41();
|
|
20496
|
+
const [setupSelection, setSetupSelection] = useState41();
|
|
20497
|
+
const [reasoningSelection, setReasoningSelection] = useState41();
|
|
20498
|
+
const providerCheckRef = useRef23(void 0);
|
|
20499
|
+
useEffect40(() => {
|
|
20324
20500
|
const controller = new AbortController();
|
|
20325
20501
|
void runtime.listModels(controller.signal).then((listed) => {
|
|
20326
20502
|
const sorted = [...listed].sort(
|
|
@@ -20342,7 +20518,7 @@ function ModelDialog({
|
|
|
20342
20518
|
});
|
|
20343
20519
|
return () => controller.abort();
|
|
20344
20520
|
}, [runtime]);
|
|
20345
|
-
|
|
20521
|
+
useEffect40(() => () => providerCheckRef.current?.abort(), []);
|
|
20346
20522
|
const current = runtime.getSnapshot().current;
|
|
20347
20523
|
const initialIndex = Math.max(
|
|
20348
20524
|
0,
|
|
@@ -20705,7 +20881,7 @@ var modelCommand = {
|
|
|
20705
20881
|
import React20 from "react";
|
|
20706
20882
|
|
|
20707
20883
|
// src/ui/components/dialogs/provider-dialog.tsx
|
|
20708
|
-
import { useEffect as
|
|
20884
|
+
import { useEffect as useEffect41, useMemo as useMemo34, useState as useState42 } from "react";
|
|
20709
20885
|
import { Box as Box75, Text as Text70 } from "ink";
|
|
20710
20886
|
import { Fragment as Fragment22, jsx as jsx98, jsxs as jsxs72 } from "react/jsx-runtime";
|
|
20711
20887
|
function statusLabel(status) {
|
|
@@ -20748,12 +20924,12 @@ function ProviderDialog({
|
|
|
20748
20924
|
initialProvider,
|
|
20749
20925
|
onClose
|
|
20750
20926
|
}) {
|
|
20751
|
-
const [providers, setProviders] =
|
|
20752
|
-
const [highlighted, setHighlighted] =
|
|
20753
|
-
const [editing, setEditing] =
|
|
20754
|
-
const [loading, setLoading] =
|
|
20755
|
-
const [error, setError] =
|
|
20756
|
-
|
|
20927
|
+
const [providers, setProviders] = useState42([]);
|
|
20928
|
+
const [highlighted, setHighlighted] = useState42();
|
|
20929
|
+
const [editing, setEditing] = useState42();
|
|
20930
|
+
const [loading, setLoading] = useState42(true);
|
|
20931
|
+
const [error, setError] = useState42();
|
|
20932
|
+
useEffect41(() => {
|
|
20757
20933
|
const controller = new AbortController();
|
|
20758
20934
|
void runtime.listProviders(controller.signal).then((available) => {
|
|
20759
20935
|
if (controller.signal.aborted) return;
|
|
@@ -20940,7 +21116,7 @@ var providerCommand = {
|
|
|
20940
21116
|
import React21 from "react";
|
|
20941
21117
|
|
|
20942
21118
|
// src/ui/components/dialogs/session-dialog.tsx
|
|
20943
|
-
import { useCallback as useCallback37, useEffect as
|
|
21119
|
+
import { useCallback as useCallback37, useEffect as useEffect42, useMemo as useMemo35, useRef as useRef24, useState as useState43 } from "react";
|
|
20944
21120
|
import { Box as Box76, Text as Text71 } from "ink";
|
|
20945
21121
|
import { Fragment as Fragment23, jsx as jsx99, jsxs as jsxs73 } from "react/jsx-runtime";
|
|
20946
21122
|
function shortId(id) {
|
|
@@ -20954,14 +21130,14 @@ function SessionDialog({
|
|
|
20954
21130
|
runtime,
|
|
20955
21131
|
onClose
|
|
20956
21132
|
}) {
|
|
20957
|
-
const [sessions, setSessions] =
|
|
20958
|
-
const [highlighted, setHighlighted] =
|
|
20959
|
-
const [pending, setPending] =
|
|
20960
|
-
const [loading, setLoading] =
|
|
20961
|
-
const [switching, setSwitching] =
|
|
20962
|
-
const [error, setError] =
|
|
20963
|
-
const switchingRef =
|
|
20964
|
-
const titleRequestsRef =
|
|
21133
|
+
const [sessions, setSessions] = useState43([]);
|
|
21134
|
+
const [highlighted, setHighlighted] = useState43();
|
|
21135
|
+
const [pending, setPending] = useState43();
|
|
21136
|
+
const [loading, setLoading] = useState43(true);
|
|
21137
|
+
const [switching, setSwitching] = useState43(false);
|
|
21138
|
+
const [error, setError] = useState43();
|
|
21139
|
+
const switchingRef = useRef24(false);
|
|
21140
|
+
const titleRequestsRef = useRef24(/* @__PURE__ */ new Map());
|
|
20965
21141
|
const resolveTitles = useCallback37(
|
|
20966
21142
|
(candidates) => {
|
|
20967
21143
|
const sessionsToResolve = candidates.filter(
|
|
@@ -21000,7 +21176,7 @@ function SessionDialog({
|
|
|
21000
21176
|
},
|
|
21001
21177
|
[runtime]
|
|
21002
21178
|
);
|
|
21003
|
-
|
|
21179
|
+
useEffect42(() => {
|
|
21004
21180
|
const controller = new AbortController();
|
|
21005
21181
|
const titleRequests = titleRequestsRef.current;
|
|
21006
21182
|
void runtime.listSessions(controller.signal).then((listed) => {
|
|
@@ -21165,7 +21341,7 @@ function SessionDialog({
|
|
|
21165
21341
|
}
|
|
21166
21342
|
|
|
21167
21343
|
// src/ui/components/dialogs/session-explorer-dialog.tsx
|
|
21168
|
-
import { useEffect as
|
|
21344
|
+
import { useEffect as useEffect43, useRef as useRef25, useState as useState44 } from "react";
|
|
21169
21345
|
import { Box as Box77, Text as Text72 } from "ink";
|
|
21170
21346
|
import { Fragment as Fragment24, jsx as jsx100, jsxs as jsxs74 } from "react/jsx-runtime";
|
|
21171
21347
|
var SESSION_PAGE_SIZE = 8;
|
|
@@ -21197,27 +21373,27 @@ function SessionExplorerDialog({
|
|
|
21197
21373
|
onClose
|
|
21198
21374
|
}) {
|
|
21199
21375
|
const { terminalWidth } = useUIState();
|
|
21200
|
-
const [query, setQuery] =
|
|
21201
|
-
const [items, setItems] =
|
|
21202
|
-
const [preview2, setPreview] =
|
|
21203
|
-
const [mode, setMode] =
|
|
21376
|
+
const [query, setQuery] = useState44("");
|
|
21377
|
+
const [items, setItems] = useState44([]);
|
|
21378
|
+
const [preview2, setPreview] = useState44();
|
|
21379
|
+
const [mode, setMode] = useState44(
|
|
21204
21380
|
"list"
|
|
21205
21381
|
);
|
|
21206
|
-
const [pending, setPending] =
|
|
21207
|
-
const [busy, setBusy] =
|
|
21208
|
-
const [searching, setSearching] =
|
|
21209
|
-
const [loading, setLoading] =
|
|
21210
|
-
const [error, setError] =
|
|
21211
|
-
const [notice, setNotice] =
|
|
21212
|
-
const actionController =
|
|
21213
|
-
const searchController =
|
|
21214
|
-
const refresh =
|
|
21382
|
+
const [pending, setPending] = useState44();
|
|
21383
|
+
const [busy, setBusy] = useState44(false);
|
|
21384
|
+
const [searching, setSearching] = useState44(false);
|
|
21385
|
+
const [loading, setLoading] = useState44(false);
|
|
21386
|
+
const [error, setError] = useState44();
|
|
21387
|
+
const [notice, setNotice] = useState44();
|
|
21388
|
+
const actionController = useRef25(void 0);
|
|
21389
|
+
const searchController = useRef25(void 0);
|
|
21390
|
+
const refresh = useRef25(() => {
|
|
21215
21391
|
});
|
|
21216
|
-
const queryRef =
|
|
21217
|
-
const resultQuery =
|
|
21218
|
-
const modeRef =
|
|
21219
|
-
const mounted =
|
|
21220
|
-
const writing =
|
|
21392
|
+
const queryRef = useRef25(query);
|
|
21393
|
+
const resultQuery = useRef25(void 0);
|
|
21394
|
+
const modeRef = useRef25(mode);
|
|
21395
|
+
const mounted = useRef25(true);
|
|
21396
|
+
const writing = useRef25(false);
|
|
21221
21397
|
const searchBuffer = useTextBuffer({
|
|
21222
21398
|
initialText: "",
|
|
21223
21399
|
initialCursorOffset: 0,
|
|
@@ -21275,7 +21451,7 @@ function SessionExplorerDialog({
|
|
|
21275
21451
|
setSearching(false);
|
|
21276
21452
|
});
|
|
21277
21453
|
};
|
|
21278
|
-
|
|
21454
|
+
useEffect43(() => {
|
|
21279
21455
|
mounted.current = true;
|
|
21280
21456
|
const unsubscribe = explorer.subscribe?.(() => {
|
|
21281
21457
|
if (modeRef.current === "list") refresh.current(queryRef.current);
|
|
@@ -21290,7 +21466,7 @@ function SessionExplorerDialog({
|
|
|
21290
21466
|
refresh.current = search;
|
|
21291
21467
|
queryRef.current = query;
|
|
21292
21468
|
modeRef.current = mode;
|
|
21293
|
-
|
|
21469
|
+
useEffect43(() => {
|
|
21294
21470
|
if (mode !== "list") return;
|
|
21295
21471
|
const timer = setTimeout(() => search(query), query ? 150 : 0);
|
|
21296
21472
|
return () => clearTimeout(timer);
|
|
@@ -21648,7 +21824,7 @@ var statsCommand = {
|
|
|
21648
21824
|
import React22 from "react";
|
|
21649
21825
|
|
|
21650
21826
|
// src/ui/components/dialogs/tools-dialog.tsx
|
|
21651
|
-
import { useEffect as
|
|
21827
|
+
import { useEffect as useEffect44, useMemo as useMemo36, useState as useState45, useSyncExternalStore as useSyncExternalStore3 } from "react";
|
|
21652
21828
|
import { Box as Box79, Text as Text74 } from "ink";
|
|
21653
21829
|
|
|
21654
21830
|
// src/ui/components/shared/descriptive-radio-button-select.tsx
|
|
@@ -21698,9 +21874,9 @@ function ToolsDialog({
|
|
|
21698
21874
|
runtime.getSnapshot,
|
|
21699
21875
|
runtime.getSnapshot
|
|
21700
21876
|
);
|
|
21701
|
-
const [selectedName, setSelectedName] =
|
|
21877
|
+
const [selectedName, setSelectedName] = useState45(snapshot.tools[0]?.name);
|
|
21702
21878
|
const selected = snapshot.tools.find((tool) => tool.name === selectedName) ?? snapshot.tools[0];
|
|
21703
|
-
|
|
21879
|
+
useEffect44(() => {
|
|
21704
21880
|
if (selected?.name !== selectedName) setSelectedName(selected?.name);
|
|
21705
21881
|
}, [selected?.name, selectedName]);
|
|
21706
21882
|
useKeypress(
|
|
@@ -21809,7 +21985,7 @@ var toolsCommand = {
|
|
|
21809
21985
|
import React23 from "react";
|
|
21810
21986
|
|
|
21811
21987
|
// src/ui/components/dialogs/permission-dialog.tsx
|
|
21812
|
-
import { useCallback as useCallback38, useMemo as useMemo37, useState as
|
|
21988
|
+
import { useCallback as useCallback38, useMemo as useMemo37, useState as useState46, useSyncExternalStore as useSyncExternalStore4 } from "react";
|
|
21813
21989
|
import { Box as Box80, Text as Text75 } from "ink";
|
|
21814
21990
|
import { Fragment as Fragment26, jsx as jsx103, jsxs as jsxs77 } from "react/jsx-runtime";
|
|
21815
21991
|
function PermissionDialog({
|
|
@@ -21822,9 +21998,9 @@ function PermissionDialog({
|
|
|
21822
21998
|
runtime.getSnapshot,
|
|
21823
21999
|
runtime.getSnapshot
|
|
21824
22000
|
);
|
|
21825
|
-
const [highlighted, setHighlighted] =
|
|
21826
|
-
const [pending, setPending] =
|
|
21827
|
-
const [error, setError] =
|
|
22001
|
+
const [highlighted, setHighlighted] = useState46();
|
|
22002
|
+
const [pending, setPending] = useState46();
|
|
22003
|
+
const [error, setError] = useState46();
|
|
21828
22004
|
const selected = highlighted ?? snapshot.options.find((option) => option.value === snapshot.currentValue) ?? snapshot.options[0];
|
|
21829
22005
|
const items = useMemo37(
|
|
21830
22006
|
() => snapshot.options.map((option) => ({
|
|
@@ -22102,92 +22278,13 @@ import React24 from "react";
|
|
|
22102
22278
|
// src/ui/components/dialogs/agents-dialog.tsx
|
|
22103
22279
|
import {
|
|
22104
22280
|
useCallback as useCallback39,
|
|
22105
|
-
useEffect as
|
|
22281
|
+
useEffect as useEffect45,
|
|
22106
22282
|
useMemo as useMemo38,
|
|
22107
|
-
useRef as
|
|
22108
|
-
useState as
|
|
22283
|
+
useRef as useRef26,
|
|
22284
|
+
useState as useState47,
|
|
22109
22285
|
useSyncExternalStore as useSyncExternalStore5
|
|
22110
22286
|
} from "react";
|
|
22111
22287
|
import { Box as Box81, Text as Text76 } from "ink";
|
|
22112
|
-
|
|
22113
|
-
// src/ui/conversation-history-projector.ts
|
|
22114
|
-
function projectedToolCallIds(messages) {
|
|
22115
|
-
return new Set(
|
|
22116
|
-
messages.flatMap(
|
|
22117
|
-
(message) => message.role === "tool" ? [message.callId] : []
|
|
22118
|
-
)
|
|
22119
|
-
);
|
|
22120
|
-
}
|
|
22121
|
-
function conversationMessageToHistoryItem(message, visibleToolCallIds) {
|
|
22122
|
-
const assistantContent = message.role === "assistant" ? message.content.filter(
|
|
22123
|
-
(block) => block.type !== "tool-call" || !visibleToolCallIds.has(block.id)
|
|
22124
|
-
) : void 0;
|
|
22125
|
-
if (message.role === "assistant" && assistantContent?.length === 0 && message.interrupted !== true) {
|
|
22126
|
-
return void 0;
|
|
22127
|
-
}
|
|
22128
|
-
if (message.role === "tool") {
|
|
22129
|
-
return {
|
|
22130
|
-
type: "tool_group",
|
|
22131
|
-
tools: [
|
|
22132
|
-
{
|
|
22133
|
-
callId: message.callId,
|
|
22134
|
-
name: message.presentation?.kind === "card" ? message.presentation.title ?? message.name : message.name,
|
|
22135
|
-
description: message.presentation?.kind === "compact" ? "" : message.presentation?.description ?? message.arguments,
|
|
22136
|
-
arguments: message.arguments,
|
|
22137
|
-
resultDisplay: message.presentation?.kind === "compact" ? void 0 : message.presentation?.resultDisplay ?? (message.result === void 0 ? void 0 : {
|
|
22138
|
-
type: "dsh-content",
|
|
22139
|
-
content: message.result.content,
|
|
22140
|
-
...message.result.error === void 0 ? {} : { error: message.result.error }
|
|
22141
|
-
}),
|
|
22142
|
-
...message.presentation?.kind === "compact" ? {
|
|
22143
|
-
presentation: {
|
|
22144
|
-
kind: "compact",
|
|
22145
|
-
label: message.presentation.label
|
|
22146
|
-
}
|
|
22147
|
-
} : {},
|
|
22148
|
-
status: message.status === "executing" ? "Executing" /* Executing */ : message.status === "success" ? "Success" /* Success */ : "Error" /* Error */
|
|
22149
|
-
}
|
|
22150
|
-
]
|
|
22151
|
-
};
|
|
22152
|
-
}
|
|
22153
|
-
if (message.role === "assistant") {
|
|
22154
|
-
return {
|
|
22155
|
-
type: "dsh_assistant",
|
|
22156
|
-
content: assistantContent ?? message.content,
|
|
22157
|
-
interrupted: message.interrupted === true,
|
|
22158
|
-
...message.turnMetrics === void 0 ? {} : { turnMetrics: message.turnMetrics }
|
|
22159
|
-
};
|
|
22160
|
-
}
|
|
22161
|
-
if (message.role === "user") {
|
|
22162
|
-
return {
|
|
22163
|
-
type: "dsh_user",
|
|
22164
|
-
content: message.displayContent ?? message.content
|
|
22165
|
-
};
|
|
22166
|
-
}
|
|
22167
|
-
return {
|
|
22168
|
-
type: message.status === "cancelled" ? "warning" /* WARNING */ : "error" /* ERROR */,
|
|
22169
|
-
text: conversationMessageText(message)
|
|
22170
|
-
};
|
|
22171
|
-
}
|
|
22172
|
-
function conversationMessageFingerprint(message, item) {
|
|
22173
|
-
if (message.role === "tool") {
|
|
22174
|
-
return JSON.stringify([
|
|
22175
|
-
message.status,
|
|
22176
|
-
message.arguments,
|
|
22177
|
-
message.result,
|
|
22178
|
-
message.presentation
|
|
22179
|
-
]);
|
|
22180
|
-
}
|
|
22181
|
-
if (message.role === "assistant" && item.type === "dsh_assistant") {
|
|
22182
|
-
return JSON.stringify([item.content, item.interrupted, item.turnMetrics]);
|
|
22183
|
-
}
|
|
22184
|
-
if (message.role === "user") {
|
|
22185
|
-
return JSON.stringify(message.displayContent ?? message.content);
|
|
22186
|
-
}
|
|
22187
|
-
return conversationMessageText(message);
|
|
22188
|
-
}
|
|
22189
|
-
|
|
22190
|
-
// src/ui/components/dialogs/agents-dialog.tsx
|
|
22191
22288
|
import { Fragment as Fragment27, jsx as jsx104, jsxs as jsxs78 } from "react/jsx-runtime";
|
|
22192
22289
|
function shortId2(id) {
|
|
22193
22290
|
return id.slice(-8);
|
|
@@ -22209,23 +22306,23 @@ function AgentsDialog({
|
|
|
22209
22306
|
runtime.getSnapshot,
|
|
22210
22307
|
runtime.getSnapshot
|
|
22211
22308
|
);
|
|
22212
|
-
const [selectedId, setSelectedId] =
|
|
22213
|
-
const [transcript, setTranscript] =
|
|
22214
|
-
const [transcriptSessionId, setTranscriptSessionId] =
|
|
22215
|
-
const [opening, setOpening] =
|
|
22216
|
-
const [openError, setOpenError] =
|
|
22217
|
-
const openController =
|
|
22218
|
-
const openingRef =
|
|
22219
|
-
const transcriptRef =
|
|
22309
|
+
const [selectedId, setSelectedId] = useState47(snapshot.items[0]?.id);
|
|
22310
|
+
const [transcript, setTranscript] = useState47();
|
|
22311
|
+
const [transcriptSessionId, setTranscriptSessionId] = useState47();
|
|
22312
|
+
const [opening, setOpening] = useState47(false);
|
|
22313
|
+
const [openError, setOpenError] = useState47();
|
|
22314
|
+
const openController = useRef26(void 0);
|
|
22315
|
+
const openingRef = useRef26(false);
|
|
22316
|
+
const transcriptRef = useRef26(
|
|
22220
22317
|
void 0
|
|
22221
22318
|
);
|
|
22222
22319
|
const selected = snapshot.items.find((item) => item.id === selectedId) ?? snapshot.items[0];
|
|
22223
|
-
|
|
22320
|
+
useEffect45(() => {
|
|
22224
22321
|
const controller = new AbortController();
|
|
22225
22322
|
void runtime.refresh(controller.signal);
|
|
22226
22323
|
return () => controller.abort();
|
|
22227
22324
|
}, [runtime]);
|
|
22228
|
-
|
|
22325
|
+
useEffect45(
|
|
22229
22326
|
() => () => {
|
|
22230
22327
|
openController.current?.abort();
|
|
22231
22328
|
transcriptRef.current?.dispose();
|
|
@@ -22233,7 +22330,7 @@ function AgentsDialog({
|
|
|
22233
22330
|
},
|
|
22234
22331
|
[]
|
|
22235
22332
|
);
|
|
22236
|
-
|
|
22333
|
+
useEffect45(() => {
|
|
22237
22334
|
if (selected?.id !== selectedId) setSelectedId(selected?.id);
|
|
22238
22335
|
}, [selected?.id, selectedId]);
|
|
22239
22336
|
useKeypress(
|
|
@@ -22413,7 +22510,7 @@ function AgentTranscriptView({
|
|
|
22413
22510
|
runtime.getSnapshot,
|
|
22414
22511
|
runtime.getSnapshot
|
|
22415
22512
|
);
|
|
22416
|
-
const listRef =
|
|
22513
|
+
const listRef = useRef26(null);
|
|
22417
22514
|
const history = useMemo38(
|
|
22418
22515
|
() => transcriptItems(snapshot.messages),
|
|
22419
22516
|
[snapshot.messages]
|
|
@@ -22421,7 +22518,7 @@ function AgentTranscriptView({
|
|
|
22421
22518
|
const completed = snapshot.todos.filter(
|
|
22422
22519
|
(todo) => todo.status === "completed"
|
|
22423
22520
|
).length;
|
|
22424
|
-
|
|
22521
|
+
useEffect45(() => {
|
|
22425
22522
|
listRef.current?.scrollToEnd();
|
|
22426
22523
|
}, [history.length]);
|
|
22427
22524
|
useKeypress(
|
|
@@ -22543,10 +22640,10 @@ import React25 from "react";
|
|
|
22543
22640
|
// src/ui/components/dialogs/agent-preset-dialog.tsx
|
|
22544
22641
|
import {
|
|
22545
22642
|
useCallback as useCallback40,
|
|
22546
|
-
useEffect as
|
|
22643
|
+
useEffect as useEffect46,
|
|
22547
22644
|
useMemo as useMemo39,
|
|
22548
|
-
useRef as
|
|
22549
|
-
useState as
|
|
22645
|
+
useRef as useRef27,
|
|
22646
|
+
useState as useState48,
|
|
22550
22647
|
useSyncExternalStore as useSyncExternalStore6
|
|
22551
22648
|
} from "react";
|
|
22552
22649
|
import { Box as Box82, Text as Text77 } from "ink";
|
|
@@ -22561,10 +22658,10 @@ function AgentPresetDialog({
|
|
|
22561
22658
|
runtime.getSnapshot,
|
|
22562
22659
|
runtime.getSnapshot
|
|
22563
22660
|
);
|
|
22564
|
-
const [highlighted, setHighlighted] =
|
|
22565
|
-
const [error, setError] =
|
|
22566
|
-
const selectionController =
|
|
22567
|
-
|
|
22661
|
+
const [highlighted, setHighlighted] = useState48();
|
|
22662
|
+
const [error, setError] = useState48();
|
|
22663
|
+
const selectionController = useRef27(void 0);
|
|
22664
|
+
useEffect46(
|
|
22568
22665
|
() => () => {
|
|
22569
22666
|
selectionController.current?.abort();
|
|
22570
22667
|
},
|
|
@@ -22759,7 +22856,7 @@ var presetCommand = {
|
|
|
22759
22856
|
import React26 from "react";
|
|
22760
22857
|
|
|
22761
22858
|
// src/ui/components/dialogs/skills-dialog.tsx
|
|
22762
|
-
import { useEffect as
|
|
22859
|
+
import { useEffect as useEffect47, useMemo as useMemo40, useState as useState49, useSyncExternalStore as useSyncExternalStore7 } from "react";
|
|
22763
22860
|
import { Box as Box83, Text as Text78 } from "ink";
|
|
22764
22861
|
import { Fragment as Fragment29, jsx as jsx106, jsxs as jsxs80 } from "react/jsx-runtime";
|
|
22765
22862
|
function summary2(value) {
|
|
@@ -22775,9 +22872,9 @@ function SkillsDialog({
|
|
|
22775
22872
|
runtime.getSnapshot,
|
|
22776
22873
|
runtime.getSnapshot
|
|
22777
22874
|
);
|
|
22778
|
-
const [selectedName, setSelectedName] =
|
|
22875
|
+
const [selectedName, setSelectedName] = useState49(snapshot.skills[0]?.name);
|
|
22779
22876
|
const selected = snapshot.skills.find((skill) => skill.name === selectedName) ?? snapshot.skills[0];
|
|
22780
|
-
|
|
22877
|
+
useEffect47(() => {
|
|
22781
22878
|
if (selected?.name !== selectedName) setSelectedName(selected?.name);
|
|
22782
22879
|
}, [selected?.name, selectedName]);
|
|
22783
22880
|
useKeypress(
|
|
@@ -22882,7 +22979,7 @@ var skillsCommand = {
|
|
|
22882
22979
|
import React27 from "react";
|
|
22883
22980
|
|
|
22884
22981
|
// src/ui/components/dialogs/jobs-dialog.tsx
|
|
22885
|
-
import { useEffect as
|
|
22982
|
+
import { useEffect as useEffect48, useState as useState50, useSyncExternalStore as useSyncExternalStore8 } from "react";
|
|
22886
22983
|
import { Text as Text79 } from "ink";
|
|
22887
22984
|
import { Fragment as Fragment30, jsx as jsx107, jsxs as jsxs81 } from "react/jsx-runtime";
|
|
22888
22985
|
function JobsDialog({
|
|
@@ -22894,15 +22991,15 @@ function JobsDialog({
|
|
|
22894
22991
|
runtime.getSnapshot,
|
|
22895
22992
|
runtime.getSnapshot
|
|
22896
22993
|
);
|
|
22897
|
-
const [selectedId, setSelectedId] =
|
|
22898
|
-
const [pending, setPending] =
|
|
22899
|
-
const [error, setError] =
|
|
22900
|
-
const [now, setNow] =
|
|
22901
|
-
|
|
22994
|
+
const [selectedId, setSelectedId] = useState50();
|
|
22995
|
+
const [pending, setPending] = useState50();
|
|
22996
|
+
const [error, setError] = useState50();
|
|
22997
|
+
const [now, setNow] = useState50(Date.now);
|
|
22998
|
+
useEffect48(() => {
|
|
22902
22999
|
const timer = setInterval(() => setNow(Date.now()), 1e3);
|
|
22903
23000
|
return () => clearInterval(timer);
|
|
22904
23001
|
}, []);
|
|
22905
|
-
|
|
23002
|
+
useEffect48(() => {
|
|
22906
23003
|
setSelectedId(void 0);
|
|
22907
23004
|
setPending(void 0);
|
|
22908
23005
|
setError(void 0);
|
|
@@ -23006,7 +23103,7 @@ function JobsDialog({
|
|
|
23006
23103
|
}
|
|
23007
23104
|
|
|
23008
23105
|
// src/ui/components/dialogs/goal-dialog.tsx
|
|
23009
|
-
import { useEffect as
|
|
23106
|
+
import { useEffect as useEffect49, useRef as useRef28, useState as useState51, useSyncExternalStore as useSyncExternalStore9 } from "react";
|
|
23010
23107
|
import { Box as Box84, Text as Text80 } from "ink";
|
|
23011
23108
|
import { Fragment as Fragment31, jsx as jsx108, jsxs as jsxs82 } from "react/jsx-runtime";
|
|
23012
23109
|
function GoalDialog({
|
|
@@ -23018,17 +23115,17 @@ function GoalDialog({
|
|
|
23018
23115
|
runtime.getSnapshot,
|
|
23019
23116
|
runtime.getSnapshot
|
|
23020
23117
|
);
|
|
23021
|
-
const [editor, setEditor] =
|
|
23118
|
+
const [editor, setEditor] = useState51(
|
|
23022
23119
|
() => snapshot.goal === void 0 ? {
|
|
23023
23120
|
kind: "create",
|
|
23024
23121
|
expected: { sessionId: snapshot.sessionId, goal: void 0 }
|
|
23025
23122
|
} : void 0
|
|
23026
23123
|
);
|
|
23027
|
-
const [pending, setPending] =
|
|
23028
|
-
const [error, setError] =
|
|
23029
|
-
const controller =
|
|
23030
|
-
const mounted =
|
|
23031
|
-
|
|
23124
|
+
const [pending, setPending] = useState51();
|
|
23125
|
+
const [error, setError] = useState51();
|
|
23126
|
+
const controller = useRef28(void 0);
|
|
23127
|
+
const mounted = useRef28(true);
|
|
23128
|
+
useEffect49(() => {
|
|
23032
23129
|
mounted.current = true;
|
|
23033
23130
|
return () => {
|
|
23034
23131
|
mounted.current = false;
|
|
@@ -23350,15 +23447,15 @@ var SkillCommandLoader = class {
|
|
|
23350
23447
|
// src/ui/hooks/commands/use-slash-command-processor.ts
|
|
23351
23448
|
var useSlashCommandProcessor = (addItem, clearItems, loadHistory, refreshStatic, toggleVimEnabled, setIsProcessing, actions, setCustomDialog, modelSelection, permissionSelection, sessionManagement, toolCatalog, dshCommands, enableProfiler = false, providerSetup, sideConversation, subagentCatalog, agentPreset, skillCatalog, agentActivity) => {
|
|
23352
23449
|
const session = useSessionStats();
|
|
23353
|
-
const [commands, setCommands] =
|
|
23450
|
+
const [commands, setCommands] = useState52(
|
|
23354
23451
|
void 0
|
|
23355
23452
|
);
|
|
23356
|
-
const [reloadTrigger, setReloadTrigger] =
|
|
23357
|
-
const commandAbortRef =
|
|
23453
|
+
const [reloadTrigger, setReloadTrigger] = useState52(0);
|
|
23454
|
+
const commandAbortRef = useRef29(void 0);
|
|
23358
23455
|
const reloadCommands = useCallback41(() => {
|
|
23359
23456
|
setReloadTrigger((v) => v + 1);
|
|
23360
23457
|
}, []);
|
|
23361
|
-
const [confirmationRequest, setConfirmationRequest] =
|
|
23458
|
+
const [confirmationRequest, setConfirmationRequest] = useState52(null);
|
|
23362
23459
|
const commandContext = useMemo41(
|
|
23363
23460
|
() => ({
|
|
23364
23461
|
services: {
|
|
@@ -23415,7 +23512,7 @@ var useSlashCommandProcessor = (addItem, clearItems, loadHistory, refreshStatic,
|
|
|
23415
23512
|
setCustomDialog
|
|
23416
23513
|
]
|
|
23417
23514
|
);
|
|
23418
|
-
|
|
23515
|
+
useEffect50(() => {
|
|
23419
23516
|
const controller = new AbortController();
|
|
23420
23517
|
(async () => {
|
|
23421
23518
|
const loaders = [
|
|
@@ -23433,15 +23530,15 @@ var useSlashCommandProcessor = (addItem, clearItems, loadHistory, refreshStatic,
|
|
|
23433
23530
|
controller.abort();
|
|
23434
23531
|
};
|
|
23435
23532
|
}, [dshCommands, enableProfiler, reloadTrigger, skillCatalog]);
|
|
23436
|
-
|
|
23533
|
+
useEffect50(
|
|
23437
23534
|
() => dshCommands?.subscribe(reloadCommands),
|
|
23438
23535
|
[dshCommands, reloadCommands]
|
|
23439
23536
|
);
|
|
23440
|
-
|
|
23537
|
+
useEffect50(
|
|
23441
23538
|
() => skillCatalog?.subscribe(reloadCommands),
|
|
23442
23539
|
[skillCatalog, reloadCommands]
|
|
23443
23540
|
);
|
|
23444
|
-
|
|
23541
|
+
useEffect50(() => () => commandAbortRef.current?.abort(), []);
|
|
23445
23542
|
const handleSlashCommand = useCallback41(
|
|
23446
23543
|
async (rawQuery, overwriteConfirmed, addToHistory = true, attachments = []) => {
|
|
23447
23544
|
if (!commands) {
|
|
@@ -23642,9 +23739,9 @@ import * as fs12 from "node:fs";
|
|
|
23642
23739
|
import { basename as basename3, join as join6 } from "node:path";
|
|
23643
23740
|
|
|
23644
23741
|
// src/ui/hooks/commands/use-settings-command.ts
|
|
23645
|
-
import { useState as
|
|
23742
|
+
import { useState as useState53, useCallback as useCallback42 } from "react";
|
|
23646
23743
|
function useSettingsCommand() {
|
|
23647
|
-
const [isSettingsDialogOpen, setIsSettingsDialogOpen] =
|
|
23744
|
+
const [isSettingsDialogOpen, setIsSettingsDialogOpen] = useState53(false);
|
|
23648
23745
|
const openSettingsDialog = useCallback42(() => {
|
|
23649
23746
|
setIsSettingsDialogOpen(true);
|
|
23650
23747
|
}, []);
|
|
@@ -23659,10 +23756,10 @@ function useSettingsCommand() {
|
|
|
23659
23756
|
}
|
|
23660
23757
|
|
|
23661
23758
|
// src/ui/hooks/commands/use-theme-command.ts
|
|
23662
|
-
import { useState as
|
|
23759
|
+
import { useState as useState54, useCallback as useCallback43 } from "react";
|
|
23663
23760
|
import process6 from "node:process";
|
|
23664
23761
|
var useThemeCommand = (loadedSettings, setThemeError, addItem, initialThemeError) => {
|
|
23665
|
-
const [isThemeDialogOpen, setIsThemeDialogOpen] =
|
|
23762
|
+
const [isThemeDialogOpen, setIsThemeDialogOpen] = useState54(!!initialThemeError);
|
|
23666
23763
|
const openThemeDialog = useCallback43(() => {
|
|
23667
23764
|
if (process6.env["NO_COLOR"]) {
|
|
23668
23765
|
addItem(
|
|
@@ -23733,7 +23830,7 @@ var useThemeCommand = (loadedSettings, setThemeError, addItem, initialThemeError
|
|
|
23733
23830
|
};
|
|
23734
23831
|
|
|
23735
23832
|
// src/ui/hooks/input/use-vim.ts
|
|
23736
|
-
import { useCallback as useCallback44, useReducer as useReducer5, useEffect as
|
|
23833
|
+
import { useCallback as useCallback44, useReducer as useReducer5, useEffect as useEffect51, useRef as useRef30 } from "react";
|
|
23737
23834
|
var DIGIT_MULTIPLIER = 10;
|
|
23738
23835
|
var DEFAULT_COUNT = 1;
|
|
23739
23836
|
var DIGIT_1_TO_9 = /^[1-9]$/;
|
|
@@ -23798,8 +23895,8 @@ var vimReducer = (state, action) => {
|
|
|
23798
23895
|
function useVim(buffer, onSubmit) {
|
|
23799
23896
|
const { vimEnabled, vimMode, setVimMode } = useVimMode();
|
|
23800
23897
|
const [state, dispatch] = useReducer5(vimReducer, initialVimState);
|
|
23801
|
-
const lastEscapeTimestampRef =
|
|
23802
|
-
|
|
23898
|
+
const lastEscapeTimestampRef = useRef30(0);
|
|
23899
|
+
useEffect51(() => {
|
|
23803
23900
|
dispatch({ type: "SET_MODE", mode: vimMode });
|
|
23804
23901
|
}, [vimMode]);
|
|
23805
23902
|
const updateMode = useCallback44(
|
|
@@ -24298,12 +24395,12 @@ function useVim(buffer, onSubmit) {
|
|
|
24298
24395
|
}
|
|
24299
24396
|
|
|
24300
24397
|
// src/ui/hooks/session/use-git-branch-name.ts
|
|
24301
|
-
import { useState as
|
|
24398
|
+
import { useState as useState55, useEffect as useEffect52, useCallback as useCallback45 } from "react";
|
|
24302
24399
|
import fs9 from "node:fs";
|
|
24303
24400
|
import fsPromises2 from "node:fs/promises";
|
|
24304
24401
|
import path11 from "node:path";
|
|
24305
24402
|
function useGitBranchName(cwd) {
|
|
24306
|
-
const [branchName, setBranchName] =
|
|
24403
|
+
const [branchName, setBranchName] = useState55(void 0);
|
|
24307
24404
|
const fetchBranchName = useCallback45(async () => {
|
|
24308
24405
|
try {
|
|
24309
24406
|
const { stdout } = await spawnAsync(
|
|
@@ -24326,7 +24423,7 @@ function useGitBranchName(cwd) {
|
|
|
24326
24423
|
setBranchName(void 0);
|
|
24327
24424
|
}
|
|
24328
24425
|
}, [cwd, setBranchName]);
|
|
24329
|
-
|
|
24426
|
+
useEffect52(() => {
|
|
24330
24427
|
fetchBranchName();
|
|
24331
24428
|
const gitLogsHeadPath = path11.join(cwd, ".git", "logs", "HEAD");
|
|
24332
24429
|
let watcher;
|
|
@@ -24353,7 +24450,7 @@ function useGitBranchName(cwd) {
|
|
|
24353
24450
|
}
|
|
24354
24451
|
|
|
24355
24452
|
// src/ui/hooks/settings/use-editor-settings.ts
|
|
24356
|
-
import { useState as
|
|
24453
|
+
import { useState as useState56, useCallback as useCallback46 } from "react";
|
|
24357
24454
|
|
|
24358
24455
|
// src/config/setting-paths.ts
|
|
24359
24456
|
var SettingPaths = {
|
|
@@ -24364,7 +24461,7 @@ var SettingPaths = {
|
|
|
24364
24461
|
|
|
24365
24462
|
// src/ui/hooks/settings/use-editor-settings.ts
|
|
24366
24463
|
var useEditorSettings = (loadedSettings, setEditorError, addItem) => {
|
|
24367
|
-
const [isEditorDialogOpen, setIsEditorDialogOpen] =
|
|
24464
|
+
const [isEditorDialogOpen, setIsEditorDialogOpen] = useState56(false);
|
|
24368
24465
|
const openEditorDialog = useCallback46(() => {
|
|
24369
24466
|
setIsEditorDialogOpen(true);
|
|
24370
24467
|
}, []);
|
|
@@ -24406,12 +24503,12 @@ var useEditorSettings = (loadedSettings, setEditorError, addItem) => {
|
|
|
24406
24503
|
};
|
|
24407
24504
|
|
|
24408
24505
|
// src/ui/hooks/terminal/use-memory-monitor.ts
|
|
24409
|
-
import { useEffect as
|
|
24506
|
+
import { useEffect as useEffect53 } from "react";
|
|
24410
24507
|
import process7 from "node:process";
|
|
24411
24508
|
var MEMORY_WARNING_THRESHOLD = 7 * 1024 * 1024 * 1024;
|
|
24412
24509
|
var MEMORY_CHECK_INTERVAL = 60 * 1e3;
|
|
24413
24510
|
var useMemoryMonitor = ({ addItem }) => {
|
|
24414
|
-
|
|
24511
|
+
useEffect53(() => {
|
|
24415
24512
|
const intervalId = setInterval(() => {
|
|
24416
24513
|
const usage = process7.memoryUsage().rss;
|
|
24417
24514
|
if (usage > MEMORY_WARNING_THRESHOLD) {
|
|
@@ -24432,9 +24529,9 @@ var useMemoryMonitor = ({ addItem }) => {
|
|
|
24432
24529
|
// src/ui/hooks/visual/use-console-messages.ts
|
|
24433
24530
|
import {
|
|
24434
24531
|
useCallback as useCallback47,
|
|
24435
|
-
useEffect as
|
|
24532
|
+
useEffect as useEffect54,
|
|
24436
24533
|
useReducer as useReducer6,
|
|
24437
|
-
useRef as
|
|
24534
|
+
useRef as useRef31,
|
|
24438
24535
|
useTransition
|
|
24439
24536
|
} from "react";
|
|
24440
24537
|
function consoleMessagesReducer(state, action) {
|
|
@@ -24462,8 +24559,8 @@ function consoleMessagesReducer(state, action) {
|
|
|
24462
24559
|
}
|
|
24463
24560
|
function useConsoleMessages() {
|
|
24464
24561
|
const [consoleMessages, dispatch] = useReducer6(consoleMessagesReducer, []);
|
|
24465
|
-
const messageQueueRef =
|
|
24466
|
-
const timeoutRef =
|
|
24562
|
+
const messageQueueRef = useRef31([]);
|
|
24563
|
+
const timeoutRef = useRef31(null);
|
|
24467
24564
|
const [, startTransition] = useTransition();
|
|
24468
24565
|
const processQueue = useCallback47(() => {
|
|
24469
24566
|
if (messageQueueRef.current.length > 0) {
|
|
@@ -24484,7 +24581,7 @@ function useConsoleMessages() {
|
|
|
24484
24581
|
},
|
|
24485
24582
|
[processQueue]
|
|
24486
24583
|
);
|
|
24487
|
-
|
|
24584
|
+
useEffect54(() => {
|
|
24488
24585
|
const handleConsoleLog = (payload) => {
|
|
24489
24586
|
handleNewMessage({
|
|
24490
24587
|
type: payload.type,
|
|
@@ -24513,7 +24610,7 @@ function useConsoleMessages() {
|
|
|
24513
24610
|
dispatch({ type: "CLEAR" });
|
|
24514
24611
|
});
|
|
24515
24612
|
}, []);
|
|
24516
|
-
|
|
24613
|
+
useEffect54(
|
|
24517
24614
|
() => () => {
|
|
24518
24615
|
if (timeoutRef.current) {
|
|
24519
24616
|
clearTimeout(timeoutRef.current);
|
|
@@ -24525,13 +24622,13 @@ function useConsoleMessages() {
|
|
|
24525
24622
|
}
|
|
24526
24623
|
|
|
24527
24624
|
// src/ui/hooks/visual/use-timer.ts
|
|
24528
|
-
import { useState as
|
|
24625
|
+
import { useState as useState57, useEffect as useEffect55, useRef as useRef32 } from "react";
|
|
24529
24626
|
var useTimer = (isActive, resetKey) => {
|
|
24530
|
-
const [elapsedTime, setElapsedTime] =
|
|
24531
|
-
const timerRef =
|
|
24532
|
-
const prevResetKeyRef =
|
|
24533
|
-
const prevIsActiveRef =
|
|
24534
|
-
|
|
24627
|
+
const [elapsedTime, setElapsedTime] = useState57(0);
|
|
24628
|
+
const timerRef = useRef32(null);
|
|
24629
|
+
const prevResetKeyRef = useRef32(resetKey);
|
|
24630
|
+
const prevIsActiveRef = useRef32(isActive);
|
|
24631
|
+
useEffect55(() => {
|
|
24535
24632
|
let shouldResetTime = false;
|
|
24536
24633
|
if (prevResetKeyRef.current !== resetKey) {
|
|
24537
24634
|
shouldResetTime = true;
|
|
@@ -24568,7 +24665,7 @@ var useTimer = (isActive, resetKey) => {
|
|
|
24568
24665
|
};
|
|
24569
24666
|
|
|
24570
24667
|
// src/ui/hooks/visual/use-phrase-cycler.ts
|
|
24571
|
-
import { useState as
|
|
24668
|
+
import { useState as useState58, useEffect as useEffect56, useRef as useRef33 } from "react";
|
|
24572
24669
|
|
|
24573
24670
|
// src/ui/components/indicators/loading-phrases.ts
|
|
24574
24671
|
var WITTY_LOADING_PHRASES = [
|
|
@@ -24710,12 +24807,12 @@ var PHRASE_CHANGE_INTERVAL_MS = 15e3;
|
|
|
24710
24807
|
var INTERACTIVE_SHELL_WAITING_PHRASE = "Interactive shell awaiting input... press tab to focus shell";
|
|
24711
24808
|
var usePhraseCycler = (isActive, shouldShowFocusHint, customPhrases) => {
|
|
24712
24809
|
const loadingPhrases = customPhrases && customPhrases.length > 0 ? customPhrases : WITTY_LOADING_PHRASES;
|
|
24713
|
-
const [currentLoadingPhrase, setCurrentLoadingPhrase] =
|
|
24810
|
+
const [currentLoadingPhrase, setCurrentLoadingPhrase] = useState58(
|
|
24714
24811
|
loadingPhrases[0]
|
|
24715
24812
|
);
|
|
24716
|
-
const phraseIntervalRef =
|
|
24717
|
-
const hasShownFirstRequestTipRef =
|
|
24718
|
-
|
|
24813
|
+
const phraseIntervalRef = useRef33(null);
|
|
24814
|
+
const hasShownFirstRequestTipRef = useRef33(false);
|
|
24815
|
+
useEffect56(() => {
|
|
24719
24816
|
if (phraseIntervalRef.current) {
|
|
24720
24817
|
clearInterval(phraseIntervalRef.current);
|
|
24721
24818
|
phraseIntervalRef.current = null;
|
|
@@ -24760,13 +24857,13 @@ var usePhraseCycler = (isActive, shouldShowFocusHint, customPhrases) => {
|
|
|
24760
24857
|
};
|
|
24761
24858
|
|
|
24762
24859
|
// src/ui/hooks/visual/use-loading-indicator.ts
|
|
24763
|
-
import { useState as
|
|
24860
|
+
import { useState as useState59, useEffect as useEffect57, useRef as useRef34 } from "react";
|
|
24764
24861
|
var useLoadingIndicator = ({
|
|
24765
24862
|
streamingState,
|
|
24766
24863
|
shouldShowFocusHint,
|
|
24767
24864
|
customWittyPhrases
|
|
24768
24865
|
}) => {
|
|
24769
|
-
const [timerResetKey, setTimerResetKey] =
|
|
24866
|
+
const [timerResetKey, setTimerResetKey] = useState59(0);
|
|
24770
24867
|
const isTimerActive = streamingState === "responding" /* Responding */;
|
|
24771
24868
|
const elapsedTimeFromTimer = useTimer(isTimerActive, timerResetKey);
|
|
24772
24869
|
const isPhraseCyclingActive = streamingState === "responding" /* Responding */;
|
|
@@ -24775,8 +24872,8 @@ var useLoadingIndicator = ({
|
|
|
24775
24872
|
shouldShowFocusHint,
|
|
24776
24873
|
customWittyPhrases
|
|
24777
24874
|
);
|
|
24778
|
-
const prevStreamingStateRef =
|
|
24779
|
-
|
|
24875
|
+
const prevStreamingStateRef = useRef34(null);
|
|
24876
|
+
useEffect57(() => {
|
|
24780
24877
|
if (streamingState === "idle" /* Idle */ && prevStreamingStateRef.current === "responding" /* Responding */) {
|
|
24781
24878
|
setTimerResetKey((prevKey) => prevKey + 1);
|
|
24782
24879
|
}
|
|
@@ -24789,13 +24886,13 @@ var useLoadingIndicator = ({
|
|
|
24789
24886
|
};
|
|
24790
24887
|
|
|
24791
24888
|
// src/ui/hooks/session/use-message-queue.ts
|
|
24792
|
-
import { useCallback as useCallback48, useEffect as
|
|
24889
|
+
import { useCallback as useCallback48, useEffect as useEffect58, useMemo as useMemo42, useState as useState60 } from "react";
|
|
24793
24890
|
function useMessageQueue({
|
|
24794
24891
|
queueKey,
|
|
24795
24892
|
streamingState,
|
|
24796
24893
|
submitQuery
|
|
24797
24894
|
}) {
|
|
24798
|
-
const [queuedMessages, setQueuedMessages] =
|
|
24895
|
+
const [queuedMessages, setQueuedMessages] = useState60([]);
|
|
24799
24896
|
const messageQueue = useMemo42(
|
|
24800
24897
|
() => queuedMessages.filter((entry) => entry.key === queueKey).map((entry) => entry.message),
|
|
24801
24898
|
[queueKey, queuedMessages]
|
|
@@ -24828,7 +24925,7 @@ function useMessageQueue({
|
|
|
24828
24925
|
);
|
|
24829
24926
|
return allMessages;
|
|
24830
24927
|
}, [messageQueue, queueKey]);
|
|
24831
|
-
|
|
24928
|
+
useEffect58(() => {
|
|
24832
24929
|
if (streamingState === "idle" /* Idle */ && messageQueue.length > 0) {
|
|
24833
24930
|
const combinedMessage = messageQueue.join("\n\n");
|
|
24834
24931
|
setQueuedMessages(
|
|
@@ -24847,15 +24944,15 @@ function useMessageQueue({
|
|
|
24847
24944
|
}
|
|
24848
24945
|
|
|
24849
24946
|
// src/ui/hooks/input/use-input-history-store.ts
|
|
24850
|
-
import { useCallback as useCallback49, useRef as
|
|
24947
|
+
import { useCallback as useCallback49, useRef as useRef35, useState as useState61 } from "react";
|
|
24851
24948
|
function deduplicateConsecutive(messages) {
|
|
24852
24949
|
return messages.filter(
|
|
24853
24950
|
(message, index) => index === 0 || message !== messages[index - 1]
|
|
24854
24951
|
);
|
|
24855
24952
|
}
|
|
24856
24953
|
function useInputHistoryStore() {
|
|
24857
|
-
const [inputHistory, setInputHistory] =
|
|
24858
|
-
const initializationStarted =
|
|
24954
|
+
const [inputHistory, setInputHistory] = useState61([]);
|
|
24955
|
+
const initializationStarted = useRef35(false);
|
|
24859
24956
|
const initializeFromHistory = useCallback49(
|
|
24860
24957
|
async (history) => {
|
|
24861
24958
|
if (initializationStarted.current) return;
|
|
@@ -24977,12 +25074,12 @@ var PromptHistoryStore = class {
|
|
|
24977
25074
|
};
|
|
24978
25075
|
|
|
24979
25076
|
// src/ui/hooks/ai/use-turn-activity-monitor.ts
|
|
24980
|
-
import { useState as
|
|
25077
|
+
import { useState as useState62, useEffect as useEffect59, useRef as useRef36 } from "react";
|
|
24981
25078
|
var useTurnActivityMonitor = (streamingState, activePtyId) => {
|
|
24982
|
-
const [operationStartTime, setOperationStartTime] =
|
|
24983
|
-
const prevPtyIdRef =
|
|
24984
|
-
const prevStreamingStateRef =
|
|
24985
|
-
|
|
25079
|
+
const [operationStartTime, setOperationStartTime] = useState62(0);
|
|
25080
|
+
const prevPtyIdRef = useRef36(void 0);
|
|
25081
|
+
const prevStreamingStateRef = useRef36(void 0);
|
|
25082
|
+
useEffect59(() => {
|
|
24986
25083
|
const isNowResponding = streamingState === "responding" /* Responding */;
|
|
24987
25084
|
const wasResponding = prevStreamingStateRef.current === "responding" /* Responding */;
|
|
24988
25085
|
const ptyChanged = activePtyId !== prevPtyIdRef.current;
|
|
@@ -25041,7 +25138,7 @@ var useShellInactivityStatus = ({
|
|
|
25041
25138
|
};
|
|
25042
25139
|
|
|
25043
25140
|
// src/ui/hooks/input/use-local-shell-command.ts
|
|
25044
|
-
import { useCallback as useCallback50, useEffect as
|
|
25141
|
+
import { useCallback as useCallback50, useEffect as useEffect60, useRef as useRef37, useState as useState63 } from "react";
|
|
25045
25142
|
import crypto2 from "node:crypto";
|
|
25046
25143
|
import fs11 from "node:fs";
|
|
25047
25144
|
import os3 from "node:os";
|
|
@@ -25058,13 +25155,13 @@ function useLocalShellCommand({
|
|
|
25058
25155
|
terminalWidth,
|
|
25059
25156
|
terminalHeight
|
|
25060
25157
|
}) {
|
|
25061
|
-
const controllerRef =
|
|
25062
|
-
const mountedRef =
|
|
25063
|
-
const [isExecuting, setIsExecuting] =
|
|
25064
|
-
const [activePtyId, setActivePtyId] =
|
|
25065
|
-
const [lastOutputTime, setLastOutputTime] =
|
|
25158
|
+
const controllerRef = useRef37(void 0);
|
|
25159
|
+
const mountedRef = useRef37(true);
|
|
25160
|
+
const [isExecuting, setIsExecuting] = useState63(false);
|
|
25161
|
+
const [activePtyId, setActivePtyId] = useState63(void 0);
|
|
25162
|
+
const [lastOutputTime, setLastOutputTime] = useState63(0);
|
|
25066
25163
|
const cancel = useCallback50(() => controllerRef.current?.abort(), []);
|
|
25067
|
-
|
|
25164
|
+
useEffect60(() => {
|
|
25068
25165
|
mountedRef.current = true;
|
|
25069
25166
|
return () => {
|
|
25070
25167
|
mountedRef.current = false;
|
|
@@ -25350,81 +25447,37 @@ var AppContainer = (props) => {
|
|
|
25350
25447
|
interactionModeRuntime.getSnapshot,
|
|
25351
25448
|
interactionModeRuntime.getSnapshot
|
|
25352
25449
|
);
|
|
25353
|
-
const conversationHistoryIds = useRef37(/* @__PURE__ */ new Map());
|
|
25354
|
-
const conversationHistoryTexts = useRef37(/* @__PURE__ */ new Map());
|
|
25355
25450
|
const conversationSessionId = conversationRuntime.getSessionStats().sessionId;
|
|
25356
|
-
const
|
|
25357
|
-
conversationSessionId
|
|
25451
|
+
const pendingHistoryStart = useConversationHistory(
|
|
25452
|
+
conversationSessionId,
|
|
25453
|
+
conversationSnapshot,
|
|
25454
|
+
historyManager
|
|
25358
25455
|
);
|
|
25359
|
-
const promptInputAbortRef = useRef37(void 0);
|
|
25360
|
-
const [promptInputPreparing, setPromptInputPreparing] = useState63(false);
|
|
25361
25456
|
const addConversationHistoryItem = historyManager.addItem;
|
|
25362
|
-
const
|
|
25363
|
-
const
|
|
25364
|
-
useEffect60(() => {
|
|
25365
|
-
if (projectedSessionId !== conversationSessionId) {
|
|
25366
|
-
conversationHistoryIds.current.clear();
|
|
25367
|
-
conversationHistoryTexts.current.clear();
|
|
25368
|
-
clearConversationHistory();
|
|
25369
|
-
setProjectedSessionId(conversationSessionId);
|
|
25370
|
-
return;
|
|
25371
|
-
}
|
|
25372
|
-
const visibleHistoryIds = new Set(
|
|
25373
|
-
historyManager.history.map((item) => item.id)
|
|
25374
|
-
);
|
|
25375
|
-
const visibleToolCallIds = projectedToolCallIds(
|
|
25376
|
-
conversationSnapshot.messages
|
|
25377
|
-
);
|
|
25378
|
-
for (const message of conversationSnapshot.messages) {
|
|
25379
|
-
const historyId = conversationHistoryIds.current.get(message.id);
|
|
25380
|
-
const item = conversationMessageToHistoryItem(
|
|
25381
|
-
message,
|
|
25382
|
-
visibleToolCallIds
|
|
25383
|
-
);
|
|
25384
|
-
if (item === void 0) continue;
|
|
25385
|
-
const fingerprint = conversationMessageFingerprint(message, item);
|
|
25386
|
-
if (historyId === void 0 || !visibleHistoryIds.has(historyId)) {
|
|
25387
|
-
const nextHistoryId = addConversationHistoryItem(item);
|
|
25388
|
-
conversationHistoryIds.current.set(message.id, nextHistoryId);
|
|
25389
|
-
conversationHistoryTexts.current.set(message.id, fingerprint);
|
|
25390
|
-
visibleHistoryIds.add(nextHistoryId);
|
|
25391
|
-
} else if (conversationHistoryTexts.current.get(message.id) !== fingerprint) {
|
|
25392
|
-
updateConversationHistoryItem(historyId, item);
|
|
25393
|
-
conversationHistoryTexts.current.set(message.id, fingerprint);
|
|
25394
|
-
}
|
|
25395
|
-
}
|
|
25396
|
-
}, [
|
|
25397
|
-
conversationSessionId,
|
|
25398
|
-
projectedSessionId,
|
|
25399
|
-
conversationRuntime,
|
|
25400
|
-
conversationSnapshot.messages,
|
|
25401
|
-
historyManager.history,
|
|
25402
|
-
addConversationHistoryItem,
|
|
25403
|
-
updateConversationHistoryItem,
|
|
25404
|
-
clearConversationHistory
|
|
25405
|
-
]);
|
|
25457
|
+
const promptInputAbortRef = useRef38(void 0);
|
|
25458
|
+
const [promptInputPreparing, setPromptInputPreparing] = useState64(false);
|
|
25406
25459
|
useMemoryMonitor(historyManager);
|
|
25407
25460
|
const settings = useSettings();
|
|
25408
25461
|
const isAlternateBuffer = useAlternateBuffer();
|
|
25409
|
-
const [debugMessage, setDebugMessage] =
|
|
25410
|
-
const [quittingMessages, setQuittingMessages] =
|
|
25411
|
-
const [themeError, setThemeError] =
|
|
25462
|
+
const [debugMessage, setDebugMessage] = useState64("");
|
|
25463
|
+
const [quittingMessages, setQuittingMessages] = useState64(null);
|
|
25464
|
+
const [themeError, setThemeError] = useState64(
|
|
25412
25465
|
initializationResult.themeError
|
|
25413
25466
|
);
|
|
25414
|
-
const [isProcessing, setIsProcessing] =
|
|
25415
|
-
const [embeddedShellFocused, setEmbeddedShellFocused] =
|
|
25467
|
+
const [isProcessing, setIsProcessing] = useState64(false);
|
|
25468
|
+
const [embeddedShellFocused, setEmbeddedShellFocused] = useState64(false);
|
|
25416
25469
|
const enableProfiler = config.getDebugMode() || process8.env["NODE_ENV"] === "development";
|
|
25417
|
-
const [showDebugProfiler, setShowDebugProfiler] =
|
|
25418
|
-
const [customDialog, setCustomDialog] =
|
|
25470
|
+
const [showDebugProfiler, setShowDebugProfiler] = useState64(enableProfiler);
|
|
25471
|
+
const [customDialog, setCustomDialog] = useState64(
|
|
25419
25472
|
null
|
|
25420
25473
|
);
|
|
25421
|
-
const [copyModeEnabled, setCopyModeEnabled] =
|
|
25422
|
-
const [pendingRestorePrompt, setPendingRestorePrompt] =
|
|
25423
|
-
const [shellModeActive, setShellModeActive] =
|
|
25424
|
-
const [pendingShellHistoryItem, setPendingShellHistoryItem] =
|
|
25425
|
-
const [historyRemountKey, setHistoryRemountKey] =
|
|
25426
|
-
const [settingsNonce, setSettingsNonce] =
|
|
25427
|
-
const [queueErrorMessage, setQueueErrorMessage] =
|
|
25474
|
+
const [copyModeEnabled, setCopyModeEnabled] = useState64(false);
|
|
25475
|
+
const [pendingRestorePrompt, setPendingRestorePrompt] = useState64(false);
|
|
25476
|
+
const [shellModeActive, setShellModeActive] = useState64(false);
|
|
25477
|
+
const [pendingShellHistoryItem, setPendingShellHistoryItem] = useState64(null);
|
|
25478
|
+
const [historyRemountKey, setHistoryRemountKey] = useState64(0);
|
|
25479
|
+
const [settingsNonce, setSettingsNonce] = useState64(0);
|
|
25480
|
+
const [queueErrorMessage, setQueueErrorMessage] = useState64(
|
|
25428
25481
|
null
|
|
25429
25482
|
);
|
|
25430
25483
|
const toggleDebugProfiler = useCallback51(
|
|
@@ -25439,10 +25492,10 @@ var AppContainer = (props) => {
|
|
|
25439
25492
|
},
|
|
25440
25493
|
[interactionModeRuntime]
|
|
25441
25494
|
);
|
|
25442
|
-
const [modelSelectionSnapshot, setModelSelectionSnapshot] =
|
|
25495
|
+
const [modelSelectionSnapshot, setModelSelectionSnapshot] = useState64(
|
|
25443
25496
|
() => modelSelectionRuntime?.getSnapshot()
|
|
25444
25497
|
);
|
|
25445
|
-
|
|
25498
|
+
useEffect61(
|
|
25446
25499
|
() => modelSelectionRuntime?.subscribe(
|
|
25447
25500
|
() => setModelSelectionSnapshot(modelSelectionRuntime.getSnapshot())
|
|
25448
25501
|
),
|
|
@@ -25455,7 +25508,7 @@ var AppContainer = (props) => {
|
|
|
25455
25508
|
providerSetupRuntime?.getSnapshot ?? emptyProviderSetupSnapshot,
|
|
25456
25509
|
providerSetupRuntime?.getSnapshot ?? emptyProviderSetupSnapshot
|
|
25457
25510
|
);
|
|
25458
|
-
const [providerSetupDismissed, setProviderSetupDismissed] =
|
|
25511
|
+
const [providerSetupDismissed, setProviderSetupDismissed] = useState64(false);
|
|
25459
25512
|
const promptHistory = useMemo43(
|
|
25460
25513
|
() => new PromptHistoryStore(
|
|
25461
25514
|
join6(config.storage.getProjectTempDir(), "prompt_history.json")
|
|
@@ -25469,16 +25522,16 @@ var AppContainer = (props) => {
|
|
|
25469
25522
|
const app = useApp();
|
|
25470
25523
|
const { stats: sessionStats } = useSessionStats();
|
|
25471
25524
|
const branchName = useGitBranchName(config.getTargetDir());
|
|
25472
|
-
const mainControlsRef =
|
|
25473
|
-
const rootUiRef =
|
|
25474
|
-
const lastTitleRef =
|
|
25525
|
+
const mainControlsRef = useRef38(null);
|
|
25526
|
+
const rootUiRef = useRef38(null);
|
|
25527
|
+
const lastTitleRef = useRef38(null);
|
|
25475
25528
|
const staticExtraHeight = 3;
|
|
25476
|
-
|
|
25529
|
+
useEffect61(() => {
|
|
25477
25530
|
void (async () => {
|
|
25478
25531
|
startupProfiler.flush();
|
|
25479
25532
|
})();
|
|
25480
25533
|
}, []);
|
|
25481
|
-
|
|
25534
|
+
useEffect61(() => {
|
|
25482
25535
|
const handleSettingsChanged = () => {
|
|
25483
25536
|
setSettingsNonce((prev) => prev + 1);
|
|
25484
25537
|
};
|
|
@@ -25514,7 +25567,7 @@ var AppContainer = (props) => {
|
|
|
25514
25567
|
shellModeActive,
|
|
25515
25568
|
getPreferredEditor
|
|
25516
25569
|
});
|
|
25517
|
-
|
|
25570
|
+
useEffect61(() => {
|
|
25518
25571
|
initializeFromHistory(promptHistory);
|
|
25519
25572
|
}, [initializeFromHistory, promptHistory]);
|
|
25520
25573
|
const refreshStatic = useCallback51(() => {
|
|
@@ -25533,7 +25586,7 @@ var AppContainer = (props) => {
|
|
|
25533
25586
|
terminalCapabilityManager.enableSupportedModes();
|
|
25534
25587
|
refreshStatic();
|
|
25535
25588
|
}, [refreshStatic, isAlternateBuffer, app, config]);
|
|
25536
|
-
|
|
25589
|
+
useEffect61(() => {
|
|
25537
25590
|
coreEvents.on(CoreEvent.ExternalEditorClosed, handleEditorClose);
|
|
25538
25591
|
return () => {
|
|
25539
25592
|
coreEvents.off(CoreEvent.ExternalEditorClosed, handleEditorClose);
|
|
@@ -25551,7 +25604,7 @@ var AppContainer = (props) => {
|
|
|
25551
25604
|
historyManager.addItem,
|
|
25552
25605
|
initializationResult.themeError
|
|
25553
25606
|
);
|
|
25554
|
-
const [editorError, setEditorError] =
|
|
25607
|
+
const [editorError, setEditorError] = useState64(null);
|
|
25555
25608
|
const {
|
|
25556
25609
|
isEditorDialogOpen,
|
|
25557
25610
|
openEditorDialog,
|
|
@@ -25612,8 +25665,8 @@ var AppContainer = (props) => {
|
|
|
25612
25665
|
skillCatalogRuntime,
|
|
25613
25666
|
agentActivityRuntime
|
|
25614
25667
|
);
|
|
25615
|
-
const commandPreparationRef =
|
|
25616
|
-
|
|
25668
|
+
const commandPreparationRef = useRef38(void 0);
|
|
25669
|
+
useEffect61(() => {
|
|
25617
25670
|
if (!isSlashCommand(buffer.text.trim()) || commandPreparationRef.current !== void 0) {
|
|
25618
25671
|
return;
|
|
25619
25672
|
}
|
|
@@ -25629,12 +25682,12 @@ var AppContainer = (props) => {
|
|
|
25629
25682
|
}
|
|
25630
25683
|
});
|
|
25631
25684
|
}, [buffer.text, commandRuntime]);
|
|
25632
|
-
|
|
25633
|
-
const cancelHandlerRef =
|
|
25685
|
+
useEffect61(() => () => commandPreparationRef.current?.abort(), []);
|
|
25686
|
+
const cancelHandlerRef = useRef38(
|
|
25634
25687
|
() => {
|
|
25635
25688
|
}
|
|
25636
25689
|
);
|
|
25637
|
-
|
|
25690
|
+
useEffect61(() => {
|
|
25638
25691
|
if (pendingRestorePrompt) {
|
|
25639
25692
|
const lastHistoryUserMsg = historyManager.history.findLast(
|
|
25640
25693
|
(h) => h.type === "user"
|
|
@@ -25749,14 +25802,14 @@ var AppContainer = (props) => {
|
|
|
25749
25802
|
promptInputAbortRef.current?.abort();
|
|
25750
25803
|
conversationRuntime.cancel();
|
|
25751
25804
|
}, [cancelCommand, cancelLocalShell, conversationRuntime]);
|
|
25752
|
-
|
|
25805
|
+
useEffect61(
|
|
25753
25806
|
() => () => {
|
|
25754
25807
|
promptInputAbortRef.current?.abort();
|
|
25755
25808
|
},
|
|
25756
25809
|
[]
|
|
25757
25810
|
);
|
|
25758
|
-
const lastOutputTimeRef =
|
|
25759
|
-
|
|
25811
|
+
const lastOutputTimeRef = useRef38(0);
|
|
25812
|
+
useEffect61(() => {
|
|
25760
25813
|
lastOutputTimeRef.current = lastOutputTime;
|
|
25761
25814
|
}, [lastOutputTime]);
|
|
25762
25815
|
const { shouldShowFocusHint, inactivityStatus } = useShellInactivityStatus({
|
|
@@ -25838,7 +25891,7 @@ ${queuedText}` : queuedText;
|
|
|
25838
25891
|
}, [historyManager, clearConsoleMessagesState, refreshStatic]);
|
|
25839
25892
|
const { handleInput: vimHandleInput } = useVim(buffer, handleFinalSubmit);
|
|
25840
25893
|
const isInputActive = !initError && !isProcessing && pendingApproval === void 0 && pendingUserQuestion === void 0 && !!slashCommands && (streamingState === "idle" /* Idle */ || streamingState === "responding" /* Responding */);
|
|
25841
|
-
const [controlsHeight, setControlsHeight] =
|
|
25894
|
+
const [controlsHeight, setControlsHeight] = useState64(0);
|
|
25842
25895
|
useLayoutEffect5(() => {
|
|
25843
25896
|
if (mainControlsRef.current) {
|
|
25844
25897
|
const fullFooterMeasurement = measureElement3(mainControlsRef.current);
|
|
@@ -25866,9 +25919,9 @@ ${queuedText}` : queuedText;
|
|
|
25866
25919
|
() => props.initialPrompt ?? config.getQuestion(),
|
|
25867
25920
|
[config, props.initialPrompt]
|
|
25868
25921
|
);
|
|
25869
|
-
const initialPromptSubmitted =
|
|
25922
|
+
const initialPromptSubmitted = useRef38(false);
|
|
25870
25923
|
const providerSetupRequired = providerSetupSnapshot?.current.status === "missing";
|
|
25871
|
-
|
|
25924
|
+
useEffect61(() => {
|
|
25872
25925
|
if (!providerSetupRuntime || !providerSetupRequired || providerSetupDismissed || customDialog) {
|
|
25873
25926
|
return;
|
|
25874
25927
|
}
|
|
@@ -25900,7 +25953,7 @@ ${queuedText}` : queuedText;
|
|
|
25900
25953
|
providerSetupRuntime,
|
|
25901
25954
|
providerSetupSnapshot
|
|
25902
25955
|
]);
|
|
25903
|
-
|
|
25956
|
+
useEffect61(() => {
|
|
25904
25957
|
if (activePtyId) {
|
|
25905
25958
|
try {
|
|
25906
25959
|
ShellExecutionService.resizePty(
|
|
@@ -25918,7 +25971,7 @@ ${queuedText}` : queuedText;
|
|
|
25918
25971
|
}
|
|
25919
25972
|
}
|
|
25920
25973
|
}, [terminalWidth, availableTerminalHeight, activePtyId]);
|
|
25921
|
-
|
|
25974
|
+
useEffect61(() => {
|
|
25922
25975
|
if (initialPrompt && !initialPromptSubmitted.current && !isThemeDialogOpen && !isEditorDialogOpen && !providerSetupRequired && !customDialog && conversationRuntime) {
|
|
25923
25976
|
handleFinalSubmit(initialPrompt);
|
|
25924
25977
|
initialPromptSubmitted.current = true;
|
|
@@ -25932,19 +25985,19 @@ ${queuedText}` : queuedText;
|
|
|
25932
25985
|
customDialog,
|
|
25933
25986
|
conversationRuntime
|
|
25934
25987
|
]);
|
|
25935
|
-
const [showErrorDetails, setShowErrorDetails] =
|
|
25936
|
-
const [showFullTodos, setShowFullTodos] =
|
|
25937
|
-
const [renderMarkdown, setRenderMarkdown] =
|
|
25938
|
-
const [ctrlCPressCount, setCtrlCPressCount] =
|
|
25939
|
-
const ctrlCTimerRef =
|
|
25940
|
-
const [ctrlDPressCount, setCtrlDPressCount] =
|
|
25941
|
-
const ctrlDTimerRef =
|
|
25942
|
-
const [constrainHeight, setConstrainHeight] =
|
|
25943
|
-
const [showEscapePrompt, setShowEscapePrompt] =
|
|
25944
|
-
const [warningMessage, setWarningMessage] =
|
|
25945
|
-
const isInitialMount =
|
|
25946
|
-
const warningTimeoutRef =
|
|
25947
|
-
const tabFocusTimeoutRef =
|
|
25988
|
+
const [showErrorDetails, setShowErrorDetails] = useState64(false);
|
|
25989
|
+
const [showFullTodos, setShowFullTodos] = useState64(false);
|
|
25990
|
+
const [renderMarkdown, setRenderMarkdown] = useState64(true);
|
|
25991
|
+
const [ctrlCPressCount, setCtrlCPressCount] = useState64(0);
|
|
25992
|
+
const ctrlCTimerRef = useRef38(null);
|
|
25993
|
+
const [ctrlDPressCount, setCtrlDPressCount] = useState64(0);
|
|
25994
|
+
const ctrlDTimerRef = useRef38(null);
|
|
25995
|
+
const [constrainHeight, setConstrainHeight] = useState64(true);
|
|
25996
|
+
const [showEscapePrompt, setShowEscapePrompt] = useState64(false);
|
|
25997
|
+
const [warningMessage, setWarningMessage] = useState64(null);
|
|
25998
|
+
const isInitialMount = useRef38(true);
|
|
25999
|
+
const warningTimeoutRef = useRef38(null);
|
|
26000
|
+
const tabFocusTimeoutRef = useRef38(null);
|
|
25948
26001
|
const handleWarning = useCallback51((message) => {
|
|
25949
26002
|
setWarningMessage(message);
|
|
25950
26003
|
if (warningTimeoutRef.current) {
|
|
@@ -25954,7 +26007,7 @@ ${queuedText}` : queuedText;
|
|
|
25954
26007
|
setWarningMessage(null);
|
|
25955
26008
|
}, WARNING_PROMPT_DURATION_MS);
|
|
25956
26009
|
}, []);
|
|
25957
|
-
|
|
26010
|
+
useEffect61(() => {
|
|
25958
26011
|
const handleSelectionWarning = () => {
|
|
25959
26012
|
handleWarning("Press Ctrl-S to enter selection mode to copy text.");
|
|
25960
26013
|
};
|
|
@@ -25974,7 +26027,7 @@ ${queuedText}` : queuedText;
|
|
|
25974
26027
|
}
|
|
25975
26028
|
};
|
|
25976
26029
|
}, [handleWarning]);
|
|
25977
|
-
|
|
26030
|
+
useEffect61(() => {
|
|
25978
26031
|
if (queueErrorMessage) {
|
|
25979
26032
|
const timer = setTimeout(() => {
|
|
25980
26033
|
setQueueErrorMessage(null);
|
|
@@ -25983,7 +26036,7 @@ ${queuedText}` : queuedText;
|
|
|
25983
26036
|
}
|
|
25984
26037
|
return void 0;
|
|
25985
26038
|
}, [queueErrorMessage, setQueueErrorMessage]);
|
|
25986
|
-
|
|
26039
|
+
useEffect61(() => {
|
|
25987
26040
|
if (isInitialMount.current) {
|
|
25988
26041
|
isInitialMount.current = false;
|
|
25989
26042
|
return;
|
|
@@ -25995,7 +26048,7 @@ ${queuedText}` : queuedText;
|
|
|
25995
26048
|
clearTimeout(handler);
|
|
25996
26049
|
};
|
|
25997
26050
|
}, [terminalWidth, refreshStatic]);
|
|
25998
|
-
|
|
26051
|
+
useEffect61(() => {
|
|
25999
26052
|
const openDebugConsole = () => {
|
|
26000
26053
|
setShowErrorDetails(true);
|
|
26001
26054
|
setConstrainHeight(false);
|
|
@@ -26005,7 +26058,7 @@ ${queuedText}` : queuedText;
|
|
|
26005
26058
|
appEvents.off("open-debug-console" /* OpenDebugConsole */, openDebugConsole);
|
|
26006
26059
|
};
|
|
26007
26060
|
}, [config]);
|
|
26008
|
-
|
|
26061
|
+
useEffect61(() => {
|
|
26009
26062
|
if (ctrlCTimerRef.current) {
|
|
26010
26063
|
clearTimeout(ctrlCTimerRef.current);
|
|
26011
26064
|
ctrlCTimerRef.current = null;
|
|
@@ -26019,7 +26072,7 @@ ${queuedText}` : queuedText;
|
|
|
26019
26072
|
}, WARNING_PROMPT_DURATION_MS);
|
|
26020
26073
|
}
|
|
26021
26074
|
}, [ctrlCPressCount, config, setCtrlCPressCount, handleSlashCommand]);
|
|
26022
|
-
|
|
26075
|
+
useEffect61(() => {
|
|
26023
26076
|
if (ctrlDTimerRef.current) {
|
|
26024
26077
|
clearTimeout(ctrlDTimerRef.current);
|
|
26025
26078
|
ctrlCTimerRef.current = null;
|
|
@@ -26170,7 +26223,7 @@ ${queuedText}` : queuedText;
|
|
|
26170
26223
|
]
|
|
26171
26224
|
);
|
|
26172
26225
|
useKeypress(handleGlobalKeypress, { isActive: true });
|
|
26173
|
-
|
|
26226
|
+
useEffect61(() => {
|
|
26174
26227
|
if (settings.merged.ui.hideWindowTitle) return;
|
|
26175
26228
|
const paddedTitle = computeTerminalTitle({
|
|
26176
26229
|
streamingState,
|
|
@@ -26196,7 +26249,7 @@ ${queuedText}` : queuedText;
|
|
|
26196
26249
|
config,
|
|
26197
26250
|
stdout
|
|
26198
26251
|
]);
|
|
26199
|
-
|
|
26252
|
+
useEffect61(() => {
|
|
26200
26253
|
const handleUserFeedback = (payload) => {
|
|
26201
26254
|
let type;
|
|
26202
26255
|
switch (payload.severity) {
|
|
@@ -26253,6 +26306,7 @@ ${queuedText}` : queuedText;
|
|
|
26253
26306
|
const uiState = useMemo43(
|
|
26254
26307
|
() => ({
|
|
26255
26308
|
history: historyManager.history,
|
|
26309
|
+
pendingHistoryStart,
|
|
26256
26310
|
isThemeDialogOpen,
|
|
26257
26311
|
themeError,
|
|
26258
26312
|
editorError,
|
|
@@ -26370,6 +26424,7 @@ ${queuedText}` : queuedText;
|
|
|
26370
26424
|
interactionModeSnapshot,
|
|
26371
26425
|
activePtyId,
|
|
26372
26426
|
historyManager,
|
|
26427
|
+
pendingHistoryStart,
|
|
26373
26428
|
embeddedShellFocused,
|
|
26374
26429
|
showDebugProfiler,
|
|
26375
26430
|
customDialog,
|
|
@@ -26650,6 +26705,9 @@ import {
|
|
|
26650
26705
|
foldSurface,
|
|
26651
26706
|
isSurfaceEvent
|
|
26652
26707
|
} from "@deepseek-ai/dsh-session";
|
|
26708
|
+
import {
|
|
26709
|
+
lastAssistantStreamChunk
|
|
26710
|
+
} from "@deepseek-ai/dsh-llm";
|
|
26653
26711
|
|
|
26654
26712
|
// src/ui/session-metrics.ts
|
|
26655
26713
|
function createInitialSessionTimingMetrics() {
|
|
@@ -26726,32 +26784,11 @@ function projectDshContent(content) {
|
|
|
26726
26784
|
return content.map(projectDshContentBlock);
|
|
26727
26785
|
}
|
|
26728
26786
|
|
|
26729
|
-
// src/dsh/assistant-stream.ts
|
|
26730
|
-
function isFirstTokenChunk(chunk) {
|
|
26731
|
-
return chunk.type === "text-delta" && chunk.text !== "" || chunk.type === "reasoning-delta" && chunk.text !== "" || chunk.type === "tool-call-delta" && (chunk.argumentsDelta !== "" || chunk.name !== void 0);
|
|
26732
|
-
}
|
|
26733
|
-
function assistantStreamFirstTokenTime(event) {
|
|
26734
|
-
for (const record of event.data.stream) {
|
|
26735
|
-
if (record.type === "chunk") {
|
|
26736
|
-
if (isFirstTokenChunk(record.chunk)) return record.time;
|
|
26737
|
-
continue;
|
|
26738
|
-
}
|
|
26739
|
-
const members = record.type === "tool-call-chunks" ? record.args : record.texts;
|
|
26740
|
-
let time = record.time0;
|
|
26741
|
-
for (let index = 0; index < members.length; index += 1) {
|
|
26742
|
-
if (index > 0) time += record.dt[index - 1] ?? 0;
|
|
26743
|
-
if (members[index] !== "" || record.type === "tool-call-chunks" && record.name !== void 0) {
|
|
26744
|
-
return time;
|
|
26745
|
-
}
|
|
26746
|
-
}
|
|
26747
|
-
}
|
|
26748
|
-
return void 0;
|
|
26749
|
-
}
|
|
26750
|
-
function subscribeToAssistantStream(agent, listener) {
|
|
26751
|
-
return agent.ctx.on("agent/assistant-stream", ({ frame }) => listener(frame));
|
|
26752
|
-
}
|
|
26753
|
-
|
|
26754
26787
|
// src/dsh/session-timing-projector.ts
|
|
26788
|
+
import {
|
|
26789
|
+
assistantStreamFirstTokenTime,
|
|
26790
|
+
isTokenDelta
|
|
26791
|
+
} from "@deepseek-ai/dsh-llm";
|
|
26755
26792
|
function eventTime(event) {
|
|
26756
26793
|
const value = event.time;
|
|
26757
26794
|
const parsed = typeof value === "number" ? value : Date.parse(value);
|
|
@@ -26789,7 +26826,9 @@ var SessionTimingProjector = class {
|
|
|
26789
26826
|
}
|
|
26790
26827
|
if (event.type === "assistant/attempt") {
|
|
26791
26828
|
const { turn, step } = event.data;
|
|
26792
|
-
const embeddedFirstTokenAt = assistantStreamFirstTokenTime(
|
|
26829
|
+
const embeddedFirstTokenAt = assistantStreamFirstTokenTime(
|
|
26830
|
+
event.data.stream
|
|
26831
|
+
);
|
|
26793
26832
|
if (embeddedFirstTokenAt !== void 0) {
|
|
26794
26833
|
this.markFirstToken(turn, step, embeddedFirstTokenAt);
|
|
26795
26834
|
}
|
|
@@ -26797,7 +26836,9 @@ var SessionTimingProjector = class {
|
|
|
26797
26836
|
}
|
|
26798
26837
|
if (event.type === "assistant/message") {
|
|
26799
26838
|
const { turn, step } = event.data;
|
|
26800
|
-
const embeddedFirstTokenAt = assistantStreamFirstTokenTime(
|
|
26839
|
+
const embeddedFirstTokenAt = assistantStreamFirstTokenTime(
|
|
26840
|
+
event.data.stream
|
|
26841
|
+
);
|
|
26801
26842
|
if (embeddedFirstTokenAt !== void 0) {
|
|
26802
26843
|
this.markFirstToken(turn, step, embeddedFirstTokenAt);
|
|
26803
26844
|
}
|
|
@@ -26879,7 +26920,7 @@ var SessionTimingProjector = class {
|
|
|
26879
26920
|
};
|
|
26880
26921
|
}
|
|
26881
26922
|
projectAssistantChunk(turn, step, chunk, at) {
|
|
26882
|
-
if (
|
|
26923
|
+
if (isTokenDelta(chunk)) this.markFirstToken(turn, step, at);
|
|
26883
26924
|
}
|
|
26884
26925
|
markFirstToken(turn, step, at) {
|
|
26885
26926
|
const timing = this.turns.get(turn)?.steps.get(step);
|
|
@@ -27012,12 +27053,7 @@ var DshSessionProjector = class {
|
|
|
27012
27053
|
if (this.cancelledTurns.has(event.data.turn)) return;
|
|
27013
27054
|
const stepKey = this.stepKey(event.data.turn, event.data.step);
|
|
27014
27055
|
if (event.data.usage !== void 0 && !this.liveUsageSteps.has(stepKey)) {
|
|
27015
|
-
this.accountUsage(
|
|
27016
|
-
stepKey,
|
|
27017
|
-
event.data.turn,
|
|
27018
|
-
event.data.step,
|
|
27019
|
-
event.data.usage
|
|
27020
|
-
);
|
|
27056
|
+
this.accountUsage(stepKey, event.data.usage);
|
|
27021
27057
|
}
|
|
27022
27058
|
const id = this.assistantId(event.data.turn, event.data.step);
|
|
27023
27059
|
this.assistantStreams.delete(id);
|
|
@@ -27027,7 +27063,13 @@ var DshSessionProjector = class {
|
|
|
27027
27063
|
});
|
|
27028
27064
|
return;
|
|
27029
27065
|
}
|
|
27030
|
-
if (event.type === "assistant/attempt")
|
|
27066
|
+
if (event.type === "assistant/attempt") {
|
|
27067
|
+
const usage = lastAssistantStreamChunk(event.data.stream, "usage")?.usage;
|
|
27068
|
+
if (usage !== void 0 && !this.liveUsageSteps.has(this.stepKey(event.data.turn, event.data.step))) {
|
|
27069
|
+
this.accountUsage(`event:${String(event.seq)}`, usage);
|
|
27070
|
+
}
|
|
27071
|
+
return;
|
|
27072
|
+
}
|
|
27031
27073
|
if (event.type === "tool/call") {
|
|
27032
27074
|
if (this.cancelledTurns.has(event.data.turn)) return;
|
|
27033
27075
|
this.projectToolCall(
|
|
@@ -27219,7 +27261,7 @@ var DshSessionProjector = class {
|
|
|
27219
27261
|
chunk.text
|
|
27220
27262
|
);
|
|
27221
27263
|
} else if (chunk.type === "usage") {
|
|
27222
|
-
this.accountUsage(usageKey,
|
|
27264
|
+
this.accountUsage(usageKey, chunk.usage);
|
|
27223
27265
|
if (liveAttempt) this.liveUsageSteps.add(this.stepKey(turn, step));
|
|
27224
27266
|
}
|
|
27225
27267
|
}
|
|
@@ -27231,7 +27273,7 @@ var DshSessionProjector = class {
|
|
|
27231
27273
|
};
|
|
27232
27274
|
this.emit();
|
|
27233
27275
|
}
|
|
27234
|
-
accountUsage(key,
|
|
27276
|
+
accountUsage(key, usage) {
|
|
27235
27277
|
if (this.accountedUsages.has(key)) return;
|
|
27236
27278
|
this.accountedUsages.add(key);
|
|
27237
27279
|
const cacheRead = usage.cacheReadTokens ?? 0;
|
|
@@ -29583,6 +29625,11 @@ var DshSubagentCatalogRuntime = class {
|
|
|
29583
29625
|
}
|
|
29584
29626
|
};
|
|
29585
29627
|
|
|
29628
|
+
// src/dsh/assistant-stream.ts
|
|
29629
|
+
function subscribeToAssistantStream(agent, listener) {
|
|
29630
|
+
return agent.ctx.on("agent/assistant-stream", ({ frame }) => listener(frame));
|
|
29631
|
+
}
|
|
29632
|
+
|
|
29586
29633
|
// src/dsh/wait-for-shared-promise.ts
|
|
29587
29634
|
function waitForSharedPromise(promise, signal) {
|
|
29588
29635
|
signal?.throwIfAborted();
|