@cofy-x/dsh-console 0.1.0-alpha.0 → 0.1.0-alpha.1
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 +8 -14
- package/dist/{chunk-YNJGTXFJ.js → chunk-N3EQS35J.js} +36 -5
- package/dist/{chunk-Z7RUTXMO.js → chunk-QZDOYPUU.js} +1331 -488
- package/dist/dsh/index.js +2 -2
- package/dist/index.js +2 -2
- package/dist/ui/renderers.js +1 -1
- package/package.json +17 -7
|
@@ -61,7 +61,7 @@ import {
|
|
|
61
61
|
unescapePath,
|
|
62
62
|
writeToStderr,
|
|
63
63
|
writeToStdout
|
|
64
|
-
} from "./chunk-
|
|
64
|
+
} from "./chunk-N3EQS35J.js";
|
|
65
65
|
|
|
66
66
|
// src/dsh/index.ts
|
|
67
67
|
import { randomUUID as randomUUID3 } from "node:crypto";
|
|
@@ -251,7 +251,7 @@ var SETTINGS_SCHEMA = {
|
|
|
251
251
|
category: "General",
|
|
252
252
|
requiresRestart: false,
|
|
253
253
|
default: false,
|
|
254
|
-
description: "
|
|
254
|
+
description: "Log raw terminal input and parsed keys locally for diagnostics. Prompt, paste, and shell content may be included; credential dialogs are always redacted.",
|
|
255
255
|
showInDialog: true
|
|
256
256
|
}
|
|
257
257
|
}
|
|
@@ -2319,12 +2319,12 @@ function computeTerminalTitle({
|
|
|
2319
2319
|
|
|
2320
2320
|
// src/ui/app-container.tsx
|
|
2321
2321
|
import {
|
|
2322
|
-
useMemo as
|
|
2323
|
-
useState as
|
|
2322
|
+
useMemo as useMemo34,
|
|
2323
|
+
useState as useState53,
|
|
2324
2324
|
useCallback as useCallback45,
|
|
2325
|
-
useEffect as
|
|
2326
|
-
useRef as
|
|
2327
|
-
useLayoutEffect as
|
|
2325
|
+
useEffect as useEffect54,
|
|
2326
|
+
useRef as useRef30,
|
|
2327
|
+
useLayoutEffect as useLayoutEffect3,
|
|
2328
2328
|
useSyncExternalStore as useSyncExternalStore5
|
|
2329
2329
|
} from "react";
|
|
2330
2330
|
import { measureElement as measureElement3, useApp } from "ink";
|
|
@@ -4810,7 +4810,7 @@ var ToolStatusIndicator = ({
|
|
|
4810
4810
|
name: name2
|
|
4811
4811
|
}) => {
|
|
4812
4812
|
const isShell = isShellTool(name2);
|
|
4813
|
-
const
|
|
4813
|
+
const statusColor2 = isShell ? theme.ui.symbol : theme.status.warning;
|
|
4814
4814
|
return /* @__PURE__ */ jsxs16(Box16, { minWidth: STATUS_INDICATOR_WIDTH, children: [
|
|
4815
4815
|
status === "Pending" /* Pending */ && /* @__PURE__ */ jsx21(Text17, { color: theme.status.success, children: TOOL_STATUS.PENDING }),
|
|
4816
4816
|
status === "Executing" /* Executing */ && /* @__PURE__ */ jsx21(
|
|
@@ -4821,7 +4821,7 @@ var ToolStatusIndicator = ({
|
|
|
4821
4821
|
}
|
|
4822
4822
|
),
|
|
4823
4823
|
status === "Success" /* Success */ && /* @__PURE__ */ jsx21(Text17, { color: theme.status.success, "aria-label": "Success:", children: TOOL_STATUS.SUCCESS }),
|
|
4824
|
-
status === "Canceled" /* Canceled */ && /* @__PURE__ */ jsx21(Text17, { color:
|
|
4824
|
+
status === "Canceled" /* Canceled */ && /* @__PURE__ */ jsx21(Text17, { color: statusColor2, "aria-label": "Canceled:", bold: true, children: TOOL_STATUS.CANCELED }),
|
|
4825
4825
|
status === "Error" /* Error */ && /* @__PURE__ */ jsx21(Text17, { color: theme.status.error, "aria-label": "Error:", bold: true, children: TOOL_STATUS.ERROR })
|
|
4826
4826
|
] });
|
|
4827
4827
|
};
|
|
@@ -4919,6 +4919,45 @@ var useFocus = () => {
|
|
|
4919
4919
|
return isFocused;
|
|
4920
4920
|
};
|
|
4921
4921
|
|
|
4922
|
+
// src/terminal/key-debug-metadata.ts
|
|
4923
|
+
function keyDebugMetadata(key) {
|
|
4924
|
+
if (key.name === "paste") {
|
|
4925
|
+
return {
|
|
4926
|
+
kind: "paste",
|
|
4927
|
+
length: Array.from(key.sequence).length
|
|
4928
|
+
};
|
|
4929
|
+
}
|
|
4930
|
+
if (key.insertable) {
|
|
4931
|
+
return {
|
|
4932
|
+
kind: "text-input",
|
|
4933
|
+
length: Array.from(key.sequence).length
|
|
4934
|
+
};
|
|
4935
|
+
}
|
|
4936
|
+
return {
|
|
4937
|
+
kind: "key",
|
|
4938
|
+
name: key.name || "unknown",
|
|
4939
|
+
ctrl: key.ctrl,
|
|
4940
|
+
cmd: key.cmd,
|
|
4941
|
+
alt: key.alt,
|
|
4942
|
+
shift: key.shift
|
|
4943
|
+
};
|
|
4944
|
+
}
|
|
4945
|
+
|
|
4946
|
+
// src/ui/hooks/input/use-sensitive-input-protection.ts
|
|
4947
|
+
import { useLayoutEffect } from "react";
|
|
4948
|
+
var sensitiveInputDepth = 0;
|
|
4949
|
+
function isSensitiveInputActive() {
|
|
4950
|
+
return sensitiveInputDepth > 0;
|
|
4951
|
+
}
|
|
4952
|
+
function useSensitiveInputProtection() {
|
|
4953
|
+
useLayoutEffect(() => {
|
|
4954
|
+
sensitiveInputDepth += 1;
|
|
4955
|
+
return () => {
|
|
4956
|
+
sensitiveInputDepth = Math.max(0, sensitiveInputDepth - 1);
|
|
4957
|
+
};
|
|
4958
|
+
}, []);
|
|
4959
|
+
}
|
|
4960
|
+
|
|
4922
4961
|
// src/ui/contexts/keypress-context.tsx
|
|
4923
4962
|
import { jsx as jsx22 } from "react/jsx-runtime";
|
|
4924
4963
|
var BACKSLASH_ENTER_TIMEOUT = 5;
|
|
@@ -5378,8 +5417,18 @@ function KeypressProvider({
|
|
|
5378
5417
|
[subscribers]
|
|
5379
5418
|
);
|
|
5380
5419
|
const broadcast = useCallback5(
|
|
5381
|
-
(key) =>
|
|
5382
|
-
|
|
5420
|
+
(key) => {
|
|
5421
|
+
if (debugKeystrokeLogging) {
|
|
5422
|
+
debugLogger.log(
|
|
5423
|
+
"[DEBUG] Keystroke:",
|
|
5424
|
+
JSON.stringify(
|
|
5425
|
+
isSensitiveInputActive() ? keyDebugMetadata(key) : key
|
|
5426
|
+
)
|
|
5427
|
+
);
|
|
5428
|
+
}
|
|
5429
|
+
subscribers.forEach((handler) => handler(key));
|
|
5430
|
+
},
|
|
5431
|
+
[debugKeystrokeLogging, subscribers]
|
|
5383
5432
|
);
|
|
5384
5433
|
useEffect8(() => {
|
|
5385
5434
|
const wasRaw = stdin.isRaw;
|
|
@@ -5395,12 +5444,14 @@ function KeypressProvider({
|
|
|
5395
5444
|
processor = bufferPaste(processor);
|
|
5396
5445
|
let dataListener = createDataListener(processor);
|
|
5397
5446
|
if (debugKeystrokeLogging) {
|
|
5398
|
-
const
|
|
5447
|
+
const forward = dataListener;
|
|
5399
5448
|
dataListener = (data) => {
|
|
5400
5449
|
if (data.length > 0) {
|
|
5401
|
-
debugLogger.log(
|
|
5450
|
+
debugLogger.log(
|
|
5451
|
+
isSensitiveInputActive() ? `[DEBUG] Raw StdIn: [REDACTED sensitive input, length=${Array.from(data).length}]` : `[DEBUG] Raw StdIn: ${JSON.stringify(data)}`
|
|
5452
|
+
);
|
|
5402
5453
|
}
|
|
5403
|
-
|
|
5454
|
+
forward(data);
|
|
5404
5455
|
};
|
|
5405
5456
|
}
|
|
5406
5457
|
stdin.on("data", dataListener);
|
|
@@ -5410,7 +5461,13 @@ function KeypressProvider({
|
|
|
5410
5461
|
setRawMode(false);
|
|
5411
5462
|
}
|
|
5412
5463
|
};
|
|
5413
|
-
}, [
|
|
5464
|
+
}, [
|
|
5465
|
+
stdin,
|
|
5466
|
+
setRawMode,
|
|
5467
|
+
config,
|
|
5468
|
+
debugKeystrokeLogging,
|
|
5469
|
+
broadcast
|
|
5470
|
+
]);
|
|
5414
5471
|
return /* @__PURE__ */ jsx22(KeypressContext.Provider, { value: { subscribe, unsubscribe }, children });
|
|
5415
5472
|
}
|
|
5416
5473
|
|
|
@@ -5982,7 +6039,7 @@ import { Box as Box25 } from "ink";
|
|
|
5982
6039
|
import { Box as Box21, Text as Text20 } from "ink";
|
|
5983
6040
|
|
|
5984
6041
|
// src/generated/git-commit.ts
|
|
5985
|
-
var GIT_COMMIT_INFO = "
|
|
6042
|
+
var GIT_COMMIT_INFO = "ab17524";
|
|
5986
6043
|
|
|
5987
6044
|
// src/ui/components/dialogs/about-box.tsx
|
|
5988
6045
|
import { jsx as jsx27, jsxs as jsxs21 } from "react/jsx-runtime";
|
|
@@ -7240,7 +7297,7 @@ var AppHeader = ({ version }) => {
|
|
|
7240
7297
|
import {
|
|
7241
7298
|
useState as useState13,
|
|
7242
7299
|
useRef as useRef6,
|
|
7243
|
-
useLayoutEffect,
|
|
7300
|
+
useLayoutEffect as useLayoutEffect2,
|
|
7244
7301
|
forwardRef,
|
|
7245
7302
|
useImperativeHandle,
|
|
7246
7303
|
useEffect as useEffect16,
|
|
@@ -7343,7 +7400,7 @@ function VirtualizedList(props, ref) {
|
|
|
7343
7400
|
return newHeights;
|
|
7344
7401
|
});
|
|
7345
7402
|
}, [data, estimatedItemHeight]);
|
|
7346
|
-
|
|
7403
|
+
useLayoutEffect2(() => {
|
|
7347
7404
|
if (containerRef.current) {
|
|
7348
7405
|
const height = Math.round(measureElement(containerRef.current).height);
|
|
7349
7406
|
if (containerHeight !== height) {
|
|
@@ -7393,7 +7450,7 @@ function VirtualizedList(props, ref) {
|
|
|
7393
7450
|
const prevTotalHeight = useRef6(totalHeight);
|
|
7394
7451
|
const prevScrollTop = useRef6(scrollTop);
|
|
7395
7452
|
const prevContainerHeight = useRef6(scrollableContainerHeight);
|
|
7396
|
-
|
|
7453
|
+
useLayoutEffect2(() => {
|
|
7397
7454
|
const contentPreviouslyFit = prevTotalHeight.current <= prevContainerHeight.current;
|
|
7398
7455
|
const wasScrolledToBottomPixels = prevScrollTop.current >= prevTotalHeight.current - prevContainerHeight.current - 1;
|
|
7399
7456
|
const wasAtBottom = contentPreviouslyFit || wasScrolledToBottomPixels;
|
|
@@ -7430,7 +7487,7 @@ function VirtualizedList(props, ref) {
|
|
|
7430
7487
|
offsets,
|
|
7431
7488
|
isStickingToBottom
|
|
7432
7489
|
]);
|
|
7433
|
-
|
|
7490
|
+
useLayoutEffect2(() => {
|
|
7434
7491
|
if (isInitialScrollSet.current || offsets.length <= 1 || totalHeight <= 0 || containerHeight <= 0) {
|
|
7435
7492
|
return;
|
|
7436
7493
|
}
|
|
@@ -11316,7 +11373,7 @@ function generatePastedTextId(content, lineCount, pastedContent) {
|
|
|
11316
11373
|
let id = base;
|
|
11317
11374
|
let suffix = 2;
|
|
11318
11375
|
while (pastedContent[id]) {
|
|
11319
|
-
id = base.
|
|
11376
|
+
id = `${base.slice(0, -1)} #${suffix}]`;
|
|
11320
11377
|
suffix++;
|
|
11321
11378
|
}
|
|
11322
11379
|
return id;
|
|
@@ -16598,10 +16655,10 @@ var InputPrompt = ({
|
|
|
16598
16655
|
onSuggestionsVisibilityChange(shouldShowSuggestions);
|
|
16599
16656
|
}
|
|
16600
16657
|
}, [shouldShowSuggestions, onSuggestionsVisibilityChange]);
|
|
16601
|
-
let
|
|
16658
|
+
let statusColor2;
|
|
16602
16659
|
let statusText = "";
|
|
16603
16660
|
if (shellModeActive) {
|
|
16604
|
-
|
|
16661
|
+
statusColor2 = theme.ui.symbol;
|
|
16605
16662
|
statusText = "Shell mode";
|
|
16606
16663
|
}
|
|
16607
16664
|
const suggestionsNode = shouldShowSuggestions ? /* @__PURE__ */ jsx64(Box50, { paddingRight: 2, children: /* @__PURE__ */ jsx64(
|
|
@@ -16617,7 +16674,7 @@ var InputPrompt = ({
|
|
|
16617
16674
|
expandedIndex: expandedSuggestionIndex
|
|
16618
16675
|
}
|
|
16619
16676
|
) }) : null;
|
|
16620
|
-
const borderColor = isShellFocused && !isEmbeddedShellFocused ?
|
|
16677
|
+
const borderColor = isShellFocused && !isEmbeddedShellFocused ? statusColor2 ?? theme.border.focused : theme.border.default;
|
|
16621
16678
|
return /* @__PURE__ */ jsxs48(Fragment12, { children: [
|
|
16622
16679
|
suggestionsPosition === "above" && suggestionsNode,
|
|
16623
16680
|
useLineFallback ? /* @__PURE__ */ jsx64(
|
|
@@ -16657,7 +16714,7 @@ var InputPrompt = ({
|
|
|
16657
16714
|
/* @__PURE__ */ jsxs48(
|
|
16658
16715
|
Text44,
|
|
16659
16716
|
{
|
|
16660
|
-
color:
|
|
16717
|
+
color: statusColor2 ?? theme.text.accent,
|
|
16661
16718
|
"aria-label": statusText || void 0,
|
|
16662
16719
|
children: [
|
|
16663
16720
|
shellModeActive ? reverseSearchActive ? /* @__PURE__ */ jsxs48(
|
|
@@ -16848,7 +16905,7 @@ var MemoryUsageDisplay = () => {
|
|
|
16848
16905
|
import { Text as Text47 } from "ink";
|
|
16849
16906
|
import { useEffect as useEffect35, useState as useState32 } from "react";
|
|
16850
16907
|
import { FixedDeque } from "mnemonist";
|
|
16851
|
-
import { jsxs as jsxs51 } from "react/jsx-runtime";
|
|
16908
|
+
import { jsx as jsx67, jsxs as jsxs51 } from "react/jsx-runtime";
|
|
16852
16909
|
var MIN_TIME_FROM_ACTION_TO_BE_IDLE = 500;
|
|
16853
16910
|
var ACTION_TIMESTAMP_CAPACITY = 2048;
|
|
16854
16911
|
var FRAME_TIMESTAMP_CAPACITY = 2048;
|
|
@@ -16945,7 +17002,7 @@ var profiler = {
|
|
|
16945
17002
|
};
|
|
16946
17003
|
}
|
|
16947
17004
|
};
|
|
16948
|
-
var DebugProfiler = () => {
|
|
17005
|
+
var DebugProfiler = ({ compact = false }) => {
|
|
16949
17006
|
const { showDebugProfiler, constrainHeight } = useUIState();
|
|
16950
17007
|
const [forceRefresh, setForceRefresh] = useState32(0);
|
|
16951
17008
|
useEffect35(() => {
|
|
@@ -16998,7 +17055,17 @@ var DebugProfiler = () => {
|
|
|
16998
17055
|
if (!showDebugProfiler) {
|
|
16999
17056
|
return null;
|
|
17000
17057
|
}
|
|
17001
|
-
|
|
17058
|
+
if (compact) {
|
|
17059
|
+
return /* @__PURE__ */ jsxs51(Text47, { color: theme.status.warning, wrap: "truncate-end", children: [
|
|
17060
|
+
"R:",
|
|
17061
|
+
profiler.numFrames,
|
|
17062
|
+
" I:",
|
|
17063
|
+
/* @__PURE__ */ jsx67(Text47, { color: theme.status.error, children: profiler.totalIdleFrames }),
|
|
17064
|
+
" F:",
|
|
17065
|
+
/* @__PURE__ */ jsx67(Text47, { color: theme.status.error, children: profiler.totalFlickerFrames })
|
|
17066
|
+
] }, forceRefresh);
|
|
17067
|
+
}
|
|
17068
|
+
return /* @__PURE__ */ jsxs51(Text47, { color: theme.status.warning, wrap: "truncate-end", children: [
|
|
17002
17069
|
"Renders: ",
|
|
17003
17070
|
profiler.numFrames,
|
|
17004
17071
|
" (total),",
|
|
@@ -17017,7 +17084,7 @@ var DebugProfiler = () => {
|
|
|
17017
17084
|
};
|
|
17018
17085
|
|
|
17019
17086
|
// src/ui/components/layout/footer.tsx
|
|
17020
|
-
import { jsx as
|
|
17087
|
+
import { jsx as jsx68, jsxs as jsxs52 } from "react/jsx-runtime";
|
|
17021
17088
|
var isDevelopment = process.env["NODE_ENV"] === "development";
|
|
17022
17089
|
var Footer = () => {
|
|
17023
17090
|
const uiState = useUIState();
|
|
@@ -17056,55 +17123,55 @@ var Footer = () => {
|
|
|
17056
17123
|
return /* @__PURE__ */ jsxs52(
|
|
17057
17124
|
Box53,
|
|
17058
17125
|
{
|
|
17126
|
+
justifyContent,
|
|
17059
17127
|
width: terminalWidth,
|
|
17060
|
-
flexDirection: "
|
|
17128
|
+
flexDirection: "row",
|
|
17129
|
+
alignItems: "center",
|
|
17130
|
+
paddingX: 1,
|
|
17061
17131
|
children: [
|
|
17062
|
-
/* @__PURE__ */ jsxs52(
|
|
17132
|
+
(displayVimMode || !hideCWD) && /* @__PURE__ */ jsxs52(Box53, { children: [
|
|
17133
|
+
displayVimMode && /* @__PURE__ */ jsxs52(Text48, { color: theme.text.secondary, children: [
|
|
17134
|
+
"[",
|
|
17135
|
+
displayVimMode,
|
|
17136
|
+
"] "
|
|
17137
|
+
] }),
|
|
17138
|
+
!hideCWD && (nightly ? /* @__PURE__ */ jsxs52(ThemedGradient, { children: [
|
|
17139
|
+
displayPath,
|
|
17140
|
+
branchName && /* @__PURE__ */ jsxs52(Text48, { children: [
|
|
17141
|
+
" (",
|
|
17142
|
+
branchName,
|
|
17143
|
+
"*)"
|
|
17144
|
+
] })
|
|
17145
|
+
] }) : /* @__PURE__ */ jsxs52(Text48, { color: theme.text.link, children: [
|
|
17146
|
+
displayPath,
|
|
17147
|
+
branchName && /* @__PURE__ */ jsxs52(Text48, { color: theme.text.secondary, children: [
|
|
17148
|
+
" (",
|
|
17149
|
+
branchName,
|
|
17150
|
+
"*)"
|
|
17151
|
+
] })
|
|
17152
|
+
] })),
|
|
17153
|
+
debugMode && /* @__PURE__ */ jsx68(Text48, { color: theme.status.error, children: " " + (debugMessage || "--debug") })
|
|
17154
|
+
] }),
|
|
17155
|
+
showRenderDiagnostics && /* @__PURE__ */ jsx68(
|
|
17063
17156
|
Box53,
|
|
17064
17157
|
{
|
|
17065
|
-
|
|
17066
|
-
|
|
17067
|
-
|
|
17068
|
-
|
|
17069
|
-
|
|
17070
|
-
children: [
|
|
17071
|
-
(displayVimMode || !hideCWD) && /* @__PURE__ */ jsxs52(Box53, { children: [
|
|
17072
|
-
displayVimMode && /* @__PURE__ */ jsxs52(Text48, { color: theme.text.secondary, children: [
|
|
17073
|
-
"[",
|
|
17074
|
-
displayVimMode,
|
|
17075
|
-
"] "
|
|
17076
|
-
] }),
|
|
17077
|
-
!hideCWD && (nightly ? /* @__PURE__ */ jsxs52(ThemedGradient, { children: [
|
|
17078
|
-
displayPath,
|
|
17079
|
-
branchName && /* @__PURE__ */ jsxs52(Text48, { children: [
|
|
17080
|
-
" (",
|
|
17081
|
-
branchName,
|
|
17082
|
-
"*)"
|
|
17083
|
-
] })
|
|
17084
|
-
] }) : /* @__PURE__ */ jsxs52(Text48, { color: theme.text.link, children: [
|
|
17085
|
-
displayPath,
|
|
17086
|
-
branchName && /* @__PURE__ */ jsxs52(Text48, { color: theme.text.secondary, children: [
|
|
17087
|
-
" (",
|
|
17088
|
-
branchName,
|
|
17089
|
-
"*)"
|
|
17090
|
-
] })
|
|
17091
|
-
] })),
|
|
17092
|
-
debugMode && /* @__PURE__ */ jsx67(Text48, { color: theme.status.error, children: " " + (debugMessage || "--debug") })
|
|
17093
|
-
] }),
|
|
17094
|
-
!hideModelInfo && /* @__PURE__ */ jsxs52(Box53, { alignItems: "center", justifyContent: "flex-end", children: [
|
|
17095
|
-
/* @__PURE__ */ jsxs52(Box53, { alignItems: "center", children: [
|
|
17096
|
-
/* @__PURE__ */ jsx67(Text48, { color: theme.text.accent, children: model }),
|
|
17097
|
-
showMemoryUsage && /* @__PURE__ */ jsx67(MemoryUsageDisplay, {})
|
|
17098
|
-
] }),
|
|
17099
|
-
/* @__PURE__ */ jsx67(Box53, { alignItems: "center", children: !showErrorDetails && errorCount > 0 && /* @__PURE__ */ jsxs52(Box53, { paddingLeft: 1, flexDirection: "row", children: [
|
|
17100
|
-
/* @__PURE__ */ jsx67(Text48, { color: theme.ui.comment, children: "| " }),
|
|
17101
|
-
/* @__PURE__ */ jsx67(ConsoleSummaryDisplay, { errorCount })
|
|
17102
|
-
] }) })
|
|
17103
|
-
] })
|
|
17104
|
-
]
|
|
17158
|
+
flexGrow: 1,
|
|
17159
|
+
flexShrink: 1,
|
|
17160
|
+
justifyContent: "center",
|
|
17161
|
+
marginX: terminalWidth >= 120 ? 1 : 0,
|
|
17162
|
+
children: /* @__PURE__ */ jsx68(DebugProfiler, { compact: terminalWidth < 120 })
|
|
17105
17163
|
}
|
|
17106
17164
|
),
|
|
17107
|
-
|
|
17165
|
+
!hideModelInfo && /* @__PURE__ */ jsxs52(Box53, { alignItems: "center", justifyContent: "flex-end", children: [
|
|
17166
|
+
/* @__PURE__ */ jsxs52(Box53, { alignItems: "center", justifyContent: "flex-end", children: [
|
|
17167
|
+
/* @__PURE__ */ jsx68(Text48, { color: theme.text.accent, children: model }),
|
|
17168
|
+
showMemoryUsage && /* @__PURE__ */ jsx68(MemoryUsageDisplay, {})
|
|
17169
|
+
] }),
|
|
17170
|
+
/* @__PURE__ */ jsx68(Box53, { alignItems: "center", children: !showErrorDetails && errorCount > 0 && /* @__PURE__ */ jsxs52(Box53, { paddingLeft: 1, flexDirection: "row", children: [
|
|
17171
|
+
/* @__PURE__ */ jsx68(Text48, { color: theme.ui.comment, children: "| " }),
|
|
17172
|
+
/* @__PURE__ */ jsx68(ConsoleSummaryDisplay, { errorCount })
|
|
17173
|
+
] }) })
|
|
17174
|
+
] })
|
|
17108
17175
|
]
|
|
17109
17176
|
}
|
|
17110
17177
|
);
|
|
@@ -17112,7 +17179,7 @@ var Footer = () => {
|
|
|
17112
17179
|
|
|
17113
17180
|
// src/ui/components/indicators/queued-message-display.tsx
|
|
17114
17181
|
import { Box as Box54, Text as Text49 } from "ink";
|
|
17115
|
-
import { jsx as
|
|
17182
|
+
import { jsx as jsx69, jsxs as jsxs53 } from "react/jsx-runtime";
|
|
17116
17183
|
var MAX_DISPLAYED_QUEUED_MESSAGES = 3;
|
|
17117
17184
|
var QueuedMessageDisplay = ({
|
|
17118
17185
|
messageQueue
|
|
@@ -17121,12 +17188,12 @@ var QueuedMessageDisplay = ({
|
|
|
17121
17188
|
return null;
|
|
17122
17189
|
}
|
|
17123
17190
|
return /* @__PURE__ */ jsxs53(Box54, { flexDirection: "column", marginTop: 1, children: [
|
|
17124
|
-
/* @__PURE__ */
|
|
17191
|
+
/* @__PURE__ */ jsx69(Box54, { paddingLeft: 2, children: /* @__PURE__ */ jsx69(Text49, { dimColor: true, children: "Queued (press \u2191 to edit):" }) }),
|
|
17125
17192
|
messageQueue.slice(0, MAX_DISPLAYED_QUEUED_MESSAGES).map((message, index) => {
|
|
17126
17193
|
const preview2 = message.replace(/\s+/g, " ");
|
|
17127
|
-
return /* @__PURE__ */
|
|
17194
|
+
return /* @__PURE__ */ jsx69(Box54, { paddingLeft: 4, width: "100%", children: /* @__PURE__ */ jsx69(Text49, { dimColor: true, wrap: "truncate", children: preview2 }) }, index);
|
|
17128
17195
|
}),
|
|
17129
|
-
messageQueue.length > MAX_DISPLAYED_QUEUED_MESSAGES && /* @__PURE__ */
|
|
17196
|
+
messageQueue.length > MAX_DISPLAYED_QUEUED_MESSAGES && /* @__PURE__ */ jsx69(Box54, { paddingLeft: 4, children: /* @__PURE__ */ jsxs53(Text49, { dimColor: true, children: [
|
|
17130
17197
|
"... (+",
|
|
17131
17198
|
messageQueue.length - MAX_DISPLAYED_QUEUED_MESSAGES,
|
|
17132
17199
|
" more)"
|
|
@@ -17136,19 +17203,19 @@ var QueuedMessageDisplay = ({
|
|
|
17136
17203
|
|
|
17137
17204
|
// src/ui/components/help/command-init-display.tsx
|
|
17138
17205
|
import { Box as Box55, Text as Text50 } from "ink";
|
|
17139
|
-
import { jsx as
|
|
17206
|
+
import { jsx as jsx70, jsxs as jsxs54 } from "react/jsx-runtime";
|
|
17140
17207
|
var CommandInitDisplay = ({
|
|
17141
17208
|
message = "Loading commands..."
|
|
17142
|
-
}) => /* @__PURE__ */
|
|
17143
|
-
/* @__PURE__ */
|
|
17209
|
+
}) => /* @__PURE__ */ jsx70(Box55, { marginTop: 1, children: /* @__PURE__ */ jsxs54(Text50, { children: [
|
|
17210
|
+
/* @__PURE__ */ jsx70(AgentSpinner, {}),
|
|
17144
17211
|
" ",
|
|
17145
|
-
/* @__PURE__ */
|
|
17212
|
+
/* @__PURE__ */ jsx70(Text50, { color: theme.text.primary, children: message })
|
|
17146
17213
|
] }) });
|
|
17147
17214
|
|
|
17148
17215
|
// src/ui/components/messages/todo.tsx
|
|
17149
17216
|
import { Box as Box56, Text as Text51 } from "ink";
|
|
17150
17217
|
import { useMemo as useMemo21 } from "react";
|
|
17151
|
-
import { jsx as
|
|
17218
|
+
import { jsx as jsx71, jsxs as jsxs55 } from "react/jsx-runtime";
|
|
17152
17219
|
var TodoTitleDisplay = ({ todos }) => {
|
|
17153
17220
|
const score = useMemo21(() => {
|
|
17154
17221
|
let total = 0;
|
|
@@ -17164,7 +17231,7 @@ var TodoTitleDisplay = ({ todos }) => {
|
|
|
17164
17231
|
return `${completed}/${total} completed`;
|
|
17165
17232
|
}, [todos]);
|
|
17166
17233
|
return /* @__PURE__ */ jsxs55(Box56, { flexDirection: "row", columnGap: 2, height: 1, children: [
|
|
17167
|
-
/* @__PURE__ */
|
|
17234
|
+
/* @__PURE__ */ jsx71(Text51, { color: theme.text.primary, bold: true, "aria-label": "Todo list", children: "Todo" }),
|
|
17168
17235
|
/* @__PURE__ */ jsxs55(Text51, { color: theme.text.secondary, children: [
|
|
17169
17236
|
score,
|
|
17170
17237
|
" (ctrl+t to toggle)"
|
|
@@ -17174,14 +17241,14 @@ var TodoTitleDisplay = ({ todos }) => {
|
|
|
17174
17241
|
var TodoStatusDisplay = ({ status }) => {
|
|
17175
17242
|
switch (status) {
|
|
17176
17243
|
case "completed":
|
|
17177
|
-
return /* @__PURE__ */
|
|
17244
|
+
return /* @__PURE__ */ jsx71(Text51, { color: theme.status.success, "aria-label": "Completed", children: "\u2713" });
|
|
17178
17245
|
case "in_progress":
|
|
17179
|
-
return /* @__PURE__ */
|
|
17246
|
+
return /* @__PURE__ */ jsx71(Text51, { color: theme.text.accent, "aria-label": "In Progress", children: "\xBB" });
|
|
17180
17247
|
case "pending":
|
|
17181
|
-
return /* @__PURE__ */
|
|
17248
|
+
return /* @__PURE__ */ jsx71(Text51, { color: theme.text.secondary, "aria-label": "Pending", children: "\u2610" });
|
|
17182
17249
|
case "cancelled":
|
|
17183
17250
|
default:
|
|
17184
|
-
return /* @__PURE__ */
|
|
17251
|
+
return /* @__PURE__ */ jsx71(Text51, { color: theme.status.error, "aria-label": "Cancelled", children: "\u2717" });
|
|
17185
17252
|
}
|
|
17186
17253
|
};
|
|
17187
17254
|
var TodoItemDisplay = ({ todo, wrap, role: ariaRole }) => {
|
|
@@ -17198,8 +17265,8 @@ var TodoItemDisplay = ({ todo, wrap, role: ariaRole }) => {
|
|
|
17198
17265
|
})();
|
|
17199
17266
|
const strikethrough = todo.status === "cancelled";
|
|
17200
17267
|
return /* @__PURE__ */ jsxs55(Box56, { flexDirection: "row", columnGap: 1, "aria-role": ariaRole, children: [
|
|
17201
|
-
/* @__PURE__ */
|
|
17202
|
-
/* @__PURE__ */
|
|
17268
|
+
/* @__PURE__ */ jsx71(TodoStatusDisplay, { status: todo.status }),
|
|
17269
|
+
/* @__PURE__ */ jsx71(Box56, { flexShrink: 1, children: /* @__PURE__ */ jsx71(Text51, { color: textColor, wrap, strikethrough, children: todo.description }) })
|
|
17203
17270
|
] });
|
|
17204
17271
|
};
|
|
17205
17272
|
var TodoTray = () => {
|
|
@@ -17220,7 +17287,7 @@ var TodoTray = () => {
|
|
|
17220
17287
|
if (todos === null || !todos.todos || todos.todos.length === 0 || !uiState.showFullTodos && !hasActiveTodos) {
|
|
17221
17288
|
return null;
|
|
17222
17289
|
}
|
|
17223
|
-
return /* @__PURE__ */
|
|
17290
|
+
return /* @__PURE__ */ jsx71(
|
|
17224
17291
|
Box56,
|
|
17225
17292
|
{
|
|
17226
17293
|
borderStyle: "single",
|
|
@@ -17231,46 +17298,46 @@ var TodoTray = () => {
|
|
|
17231
17298
|
paddingLeft: 1,
|
|
17232
17299
|
paddingRight: 1,
|
|
17233
17300
|
children: uiState.showFullTodos ? /* @__PURE__ */ jsxs55(Box56, { flexDirection: "column", rowGap: 1, children: [
|
|
17234
|
-
/* @__PURE__ */
|
|
17235
|
-
/* @__PURE__ */
|
|
17301
|
+
/* @__PURE__ */ jsx71(TodoTitleDisplay, { todos }),
|
|
17302
|
+
/* @__PURE__ */ jsx71(TodoListDisplay, { todos })
|
|
17236
17303
|
] }) : /* @__PURE__ */ jsxs55(Box56, { flexDirection: "row", columnGap: 1, height: 1, children: [
|
|
17237
|
-
/* @__PURE__ */
|
|
17238
|
-
inProgress && /* @__PURE__ */
|
|
17304
|
+
/* @__PURE__ */ jsx71(Box56, { flexShrink: 0, flexGrow: 0, children: /* @__PURE__ */ jsx71(TodoTitleDisplay, { todos }) }),
|
|
17305
|
+
inProgress && /* @__PURE__ */ jsx71(Box56, { flexShrink: 1, flexGrow: 1, children: /* @__PURE__ */ jsx71(TodoItemDisplay, { todo: inProgress, wrap: "truncate" }) })
|
|
17239
17306
|
] })
|
|
17240
17307
|
}
|
|
17241
17308
|
);
|
|
17242
17309
|
};
|
|
17243
|
-
var TodoListDisplay = ({ todos }) => /* @__PURE__ */
|
|
17310
|
+
var TodoListDisplay = ({ todos }) => /* @__PURE__ */ jsx71(Box56, { flexDirection: "column", "aria-role": "list", children: todos.todos.map((todo, index) => /* @__PURE__ */ jsx71(TodoItemDisplay, { todo, role: "listitem" }, index)) });
|
|
17244
17311
|
|
|
17245
17312
|
// src/ui/components/layout/status-display.tsx
|
|
17246
17313
|
import { Text as Text52 } from "ink";
|
|
17247
|
-
import { jsx as
|
|
17314
|
+
import { jsx as jsx72 } from "react/jsx-runtime";
|
|
17248
17315
|
var StatusDisplay = () => {
|
|
17249
17316
|
const uiState = useUIState();
|
|
17250
17317
|
if (process.env["DSH_CONSOLE_SYSTEM_MD"]) {
|
|
17251
|
-
return /* @__PURE__ */
|
|
17318
|
+
return /* @__PURE__ */ jsx72(Text52, { color: theme.status.error, children: "|\u2310\u25A0_\u25A0|" });
|
|
17252
17319
|
}
|
|
17253
17320
|
if (uiState.ctrlCPressedOnce) {
|
|
17254
|
-
return /* @__PURE__ */
|
|
17321
|
+
return /* @__PURE__ */ jsx72(Text52, { color: theme.status.warning, children: "Press Ctrl+C again to exit." });
|
|
17255
17322
|
}
|
|
17256
17323
|
if (uiState.warningMessage) {
|
|
17257
|
-
return /* @__PURE__ */
|
|
17324
|
+
return /* @__PURE__ */ jsx72(Text52, { color: theme.status.warning, children: uiState.warningMessage });
|
|
17258
17325
|
}
|
|
17259
17326
|
if (uiState.ctrlDPressedOnce) {
|
|
17260
|
-
return /* @__PURE__ */
|
|
17327
|
+
return /* @__PURE__ */ jsx72(Text52, { color: theme.status.warning, children: "Press Ctrl+D again to exit." });
|
|
17261
17328
|
}
|
|
17262
17329
|
if (uiState.showEscapePrompt) {
|
|
17263
17330
|
if (uiState.buffer.text.length === 0) return null;
|
|
17264
|
-
return /* @__PURE__ */
|
|
17331
|
+
return /* @__PURE__ */ jsx72(Text52, { color: theme.text.secondary, children: "Press Esc again to clear prompt." });
|
|
17265
17332
|
}
|
|
17266
17333
|
if (uiState.queueErrorMessage) {
|
|
17267
|
-
return /* @__PURE__ */
|
|
17334
|
+
return /* @__PURE__ */ jsx72(Text52, { color: theme.status.error, children: uiState.queueErrorMessage });
|
|
17268
17335
|
}
|
|
17269
17336
|
return null;
|
|
17270
17337
|
};
|
|
17271
17338
|
|
|
17272
17339
|
// src/ui/components/input/composer.tsx
|
|
17273
|
-
import { jsx as
|
|
17340
|
+
import { jsx as jsx73, jsxs as jsxs56 } from "react/jsx-runtime";
|
|
17274
17341
|
var Composer = ({ isFocused = true }) => {
|
|
17275
17342
|
const config = useConfig();
|
|
17276
17343
|
const settings = useSettings();
|
|
@@ -17292,16 +17359,16 @@ var Composer = ({ isFocused = true }) => {
|
|
|
17292
17359
|
flexGrow: 0,
|
|
17293
17360
|
flexShrink: 0,
|
|
17294
17361
|
children: [
|
|
17295
|
-
!uiState.embeddedShellFocused && /* @__PURE__ */
|
|
17362
|
+
!uiState.embeddedShellFocused && /* @__PURE__ */ jsx73(
|
|
17296
17363
|
LoadingIndicator,
|
|
17297
17364
|
{
|
|
17298
17365
|
currentLoadingPhrase: config.getAccessibility()?.enableLoadingPhrases === false ? void 0 : uiState.currentLoadingPhrase,
|
|
17299
17366
|
elapsedTime: uiState.elapsedTime
|
|
17300
17367
|
}
|
|
17301
17368
|
),
|
|
17302
|
-
!uiState.slashCommands && /* @__PURE__ */
|
|
17303
|
-
/* @__PURE__ */
|
|
17304
|
-
/* @__PURE__ */
|
|
17369
|
+
!uiState.slashCommands && /* @__PURE__ */ jsx73(CommandInitDisplay, {}),
|
|
17370
|
+
/* @__PURE__ */ jsx73(QueuedMessageDisplay, { messageQueue: uiState.messageQueue }),
|
|
17371
|
+
/* @__PURE__ */ jsx73(TodoTray, {}),
|
|
17305
17372
|
/* @__PURE__ */ jsxs56(
|
|
17306
17373
|
Box57,
|
|
17307
17374
|
{
|
|
@@ -17311,16 +17378,16 @@ var Composer = ({ isFocused = true }) => {
|
|
|
17311
17378
|
flexDirection: isNarrow ? "column" : "row",
|
|
17312
17379
|
alignItems: isNarrow ? "flex-start" : "center",
|
|
17313
17380
|
children: [
|
|
17314
|
-
/* @__PURE__ */
|
|
17381
|
+
/* @__PURE__ */ jsx73(Box57, { marginRight: 1, children: /* @__PURE__ */ jsx73(StatusDisplay, {}) }),
|
|
17315
17382
|
/* @__PURE__ */ jsxs56(Box57, { paddingTop: isNarrow ? 1 : 0, children: [
|
|
17316
|
-
uiState.shellModeActive && /* @__PURE__ */
|
|
17317
|
-
!uiState.renderMarkdown && /* @__PURE__ */
|
|
17383
|
+
uiState.shellModeActive && /* @__PURE__ */ jsx73(ShellModeIndicator, {}),
|
|
17384
|
+
!uiState.renderMarkdown && /* @__PURE__ */ jsx73(RawMarkdownIndicator, {})
|
|
17318
17385
|
] })
|
|
17319
17386
|
]
|
|
17320
17387
|
}
|
|
17321
17388
|
),
|
|
17322
|
-
uiState.showErrorDetails && /* @__PURE__ */
|
|
17323
|
-
/* @__PURE__ */
|
|
17389
|
+
uiState.showErrorDetails && /* @__PURE__ */ jsx73(OverflowProvider, { children: /* @__PURE__ */ jsxs56(Box57, { flexDirection: "column", children: [
|
|
17390
|
+
/* @__PURE__ */ jsx73(
|
|
17324
17391
|
DetailedMessagesDisplay,
|
|
17325
17392
|
{
|
|
17326
17393
|
messages: uiState.filteredConsoleMessages,
|
|
@@ -17329,9 +17396,9 @@ var Composer = ({ isFocused = true }) => {
|
|
|
17329
17396
|
hasFocus: uiState.showErrorDetails
|
|
17330
17397
|
}
|
|
17331
17398
|
),
|
|
17332
|
-
/* @__PURE__ */
|
|
17399
|
+
/* @__PURE__ */ jsx73(ShowMoreLines, { constrainHeight: uiState.constrainHeight })
|
|
17333
17400
|
] }) }),
|
|
17334
|
-
uiState.isInputActive && /* @__PURE__ */
|
|
17401
|
+
uiState.isInputActive && /* @__PURE__ */ jsx73(
|
|
17335
17402
|
InputPrompt,
|
|
17336
17403
|
{
|
|
17337
17404
|
buffer: uiState.buffer,
|
|
@@ -17358,7 +17425,7 @@ var Composer = ({ isFocused = true }) => {
|
|
|
17358
17425
|
onSuggestionsVisibilityChange: setSuggestionsVisible
|
|
17359
17426
|
}
|
|
17360
17427
|
),
|
|
17361
|
-
!settings.merged.ui.hideFooter && !isScreenReaderEnabled && /* @__PURE__ */
|
|
17428
|
+
!settings.merged.ui.hideFooter && !isScreenReaderEnabled && /* @__PURE__ */ jsx73(Footer, {})
|
|
17362
17429
|
]
|
|
17363
17430
|
}
|
|
17364
17431
|
);
|
|
@@ -17366,12 +17433,12 @@ var Composer = ({ isFocused = true }) => {
|
|
|
17366
17433
|
|
|
17367
17434
|
// src/ui/components/dialogs/exit-warning.tsx
|
|
17368
17435
|
import { Box as Box58, Text as Text53 } from "ink";
|
|
17369
|
-
import { Fragment as Fragment13, jsx as
|
|
17436
|
+
import { Fragment as Fragment13, jsx as jsx74, jsxs as jsxs57 } from "react/jsx-runtime";
|
|
17370
17437
|
var ExitWarning = () => {
|
|
17371
17438
|
const uiState = useUIState();
|
|
17372
17439
|
return /* @__PURE__ */ jsxs57(Fragment13, { children: [
|
|
17373
|
-
uiState.dialogsVisible && uiState.ctrlCPressedOnce && /* @__PURE__ */
|
|
17374
|
-
uiState.dialogsVisible && uiState.ctrlDPressedOnce && /* @__PURE__ */
|
|
17440
|
+
uiState.dialogsVisible && uiState.ctrlCPressedOnce && /* @__PURE__ */ jsx74(Box58, { marginTop: 1, children: /* @__PURE__ */ jsx74(Text53, { color: theme.status.warning, children: "Press Ctrl+C again to exit." }) }),
|
|
17441
|
+
uiState.dialogsVisible && uiState.ctrlDPressedOnce && /* @__PURE__ */ jsx74(Box58, { marginTop: 1, children: /* @__PURE__ */ jsx74(Text53, { color: theme.status.warning, children: "Press Ctrl+D again to exit." }) })
|
|
17375
17442
|
] });
|
|
17376
17443
|
};
|
|
17377
17444
|
|
|
@@ -17400,7 +17467,7 @@ import {
|
|
|
17400
17467
|
useMemo as useMemo22,
|
|
17401
17468
|
useSyncExternalStore
|
|
17402
17469
|
} from "react";
|
|
17403
|
-
import { jsx as
|
|
17470
|
+
import { jsx as jsx75 } from "react/jsx-runtime";
|
|
17404
17471
|
var ApprovalContext = createContext12(
|
|
17405
17472
|
void 0
|
|
17406
17473
|
);
|
|
@@ -17411,7 +17478,7 @@ var ApprovalRuntimeProvider = ({ runtime, children }) => {
|
|
|
17411
17478
|
runtime.getSnapshot
|
|
17412
17479
|
);
|
|
17413
17480
|
const value = useMemo22(() => ({ runtime, snapshot }), [runtime, snapshot]);
|
|
17414
|
-
return /* @__PURE__ */
|
|
17481
|
+
return /* @__PURE__ */ jsx75(ApprovalContext.Provider, { value, children });
|
|
17415
17482
|
};
|
|
17416
17483
|
function useApprovalRuntime() {
|
|
17417
17484
|
const value = useContext13(ApprovalContext);
|
|
@@ -17430,7 +17497,7 @@ import {
|
|
|
17430
17497
|
useMemo as useMemo23,
|
|
17431
17498
|
useSyncExternalStore as useSyncExternalStore2
|
|
17432
17499
|
} from "react";
|
|
17433
|
-
import { jsx as
|
|
17500
|
+
import { jsx as jsx76 } from "react/jsx-runtime";
|
|
17434
17501
|
var UserQuestionContext = createContext13(void 0);
|
|
17435
17502
|
var UserQuestionRuntimeProvider = ({ runtime, children }) => {
|
|
17436
17503
|
const snapshot = useSyncExternalStore2(
|
|
@@ -17439,7 +17506,7 @@ var UserQuestionRuntimeProvider = ({ runtime, children }) => {
|
|
|
17439
17506
|
runtime.getSnapshot
|
|
17440
17507
|
);
|
|
17441
17508
|
const value = useMemo23(() => ({ runtime, snapshot }), [runtime, snapshot]);
|
|
17442
|
-
return /* @__PURE__ */
|
|
17509
|
+
return /* @__PURE__ */ jsx76(UserQuestionContext.Provider, { value, children });
|
|
17443
17510
|
};
|
|
17444
17511
|
function useUserQuestionRuntime() {
|
|
17445
17512
|
const value = useContext14(UserQuestionContext);
|
|
@@ -17457,7 +17524,7 @@ import { Box as Box60, Text as Text55 } from "ink";
|
|
|
17457
17524
|
// src/ui/components/messages/tool-confirmation-message.tsx
|
|
17458
17525
|
import { Box as Box59, Text as Text54 } from "ink";
|
|
17459
17526
|
import { useMemo as useMemo24 } from "react";
|
|
17460
|
-
import { jsx as
|
|
17527
|
+
import { jsx as jsx77, jsxs as jsxs58 } from "react/jsx-runtime";
|
|
17461
17528
|
var ToolConfirmationMessage = ({ request, respond, isFocused }) => {
|
|
17462
17529
|
useKeypress(
|
|
17463
17530
|
(key) => {
|
|
@@ -17479,13 +17546,13 @@ var ToolConfirmationMessage = ({ request, respond, isFocused }) => {
|
|
|
17479
17546
|
[]
|
|
17480
17547
|
);
|
|
17481
17548
|
return /* @__PURE__ */ jsxs58(Box59, { flexDirection: "column", paddingBottom: 1, children: [
|
|
17482
|
-
request.reason !== void 0 && /* @__PURE__ */
|
|
17483
|
-
/* @__PURE__ */
|
|
17549
|
+
request.reason !== void 0 && /* @__PURE__ */ jsx77(Box59, { marginBottom: 1, children: /* @__PURE__ */ jsx77(Text54, { color: theme.text.secondary, children: request.reason }) }),
|
|
17550
|
+
/* @__PURE__ */ jsx77(Box59, { marginBottom: 1, children: /* @__PURE__ */ jsxs58(Text54, { color: theme.text.primary, children: [
|
|
17484
17551
|
"Allow ",
|
|
17485
|
-
/* @__PURE__ */
|
|
17552
|
+
/* @__PURE__ */ jsx77(Text54, { bold: true, children: request.toolName }),
|
|
17486
17553
|
" to continue?"
|
|
17487
17554
|
] }) }),
|
|
17488
|
-
/* @__PURE__ */
|
|
17555
|
+
/* @__PURE__ */ jsx77(
|
|
17489
17556
|
RadioButtonSelect,
|
|
17490
17557
|
{
|
|
17491
17558
|
items: options,
|
|
@@ -17493,12 +17560,12 @@ var ToolConfirmationMessage = ({ request, respond, isFocused }) => {
|
|
|
17493
17560
|
isFocused
|
|
17494
17561
|
}
|
|
17495
17562
|
),
|
|
17496
|
-
/* @__PURE__ */
|
|
17563
|
+
/* @__PURE__ */ jsx77(Text54, { color: theme.text.secondary, children: "Esc cancels this request" })
|
|
17497
17564
|
] });
|
|
17498
17565
|
};
|
|
17499
17566
|
|
|
17500
17567
|
// src/ui/components/dialogs/tool-confirmation-queue.tsx
|
|
17501
|
-
import { jsx as
|
|
17568
|
+
import { jsx as jsx78, jsxs as jsxs59 } from "react/jsx-runtime";
|
|
17502
17569
|
var ToolConfirmationQueue = ({ request, index, total, terminalWidth, respond }) => /* @__PURE__ */ jsxs59(
|
|
17503
17570
|
Box60,
|
|
17504
17571
|
{
|
|
@@ -17510,7 +17577,7 @@ var ToolConfirmationQueue = ({ request, index, total, terminalWidth, respond })
|
|
|
17510
17577
|
flexShrink: 0,
|
|
17511
17578
|
children: [
|
|
17512
17579
|
/* @__PURE__ */ jsxs59(Box60, { marginBottom: 1, justifyContent: "space-between", children: [
|
|
17513
|
-
/* @__PURE__ */
|
|
17580
|
+
/* @__PURE__ */ jsx78(Text55, { color: theme.status.warning, bold: true, children: "Action Required" }),
|
|
17514
17581
|
/* @__PURE__ */ jsxs59(Text55, { color: theme.text.secondary, children: [
|
|
17515
17582
|
index,
|
|
17516
17583
|
" of ",
|
|
@@ -17518,13 +17585,13 @@ var ToolConfirmationQueue = ({ request, index, total, terminalWidth, respond })
|
|
|
17518
17585
|
] })
|
|
17519
17586
|
] }),
|
|
17520
17587
|
/* @__PURE__ */ jsxs59(Box60, { marginBottom: 1, flexDirection: "column", children: [
|
|
17521
|
-
/* @__PURE__ */
|
|
17588
|
+
/* @__PURE__ */ jsx78(Text55, { color: theme.text.primary, bold: true, children: request.toolName }),
|
|
17522
17589
|
request.callId !== void 0 && /* @__PURE__ */ jsxs59(Text55, { color: theme.text.secondary, children: [
|
|
17523
17590
|
"Call ",
|
|
17524
17591
|
request.callId
|
|
17525
17592
|
] })
|
|
17526
17593
|
] }),
|
|
17527
|
-
/* @__PURE__ */
|
|
17594
|
+
/* @__PURE__ */ jsx78(
|
|
17528
17595
|
ToolConfirmationMessage,
|
|
17529
17596
|
{
|
|
17530
17597
|
request,
|
|
@@ -17553,7 +17620,7 @@ import { Box as Box62, Text as Text57, useStdout as useStdout3 } from "ink";
|
|
|
17553
17620
|
// src/ui/components/layout/tab-header.tsx
|
|
17554
17621
|
import React15 from "react";
|
|
17555
17622
|
import { Text as Text56, Box as Box61 } from "ink";
|
|
17556
|
-
import { jsx as
|
|
17623
|
+
import { jsx as jsx79, jsxs as jsxs60 } from "react/jsx-runtime";
|
|
17557
17624
|
function TabHeader({
|
|
17558
17625
|
tabs,
|
|
17559
17626
|
currentIndex,
|
|
@@ -17574,14 +17641,14 @@ function TabHeader({
|
|
|
17574
17641
|
return isCompleted ? "\u2713" : "\u25A1";
|
|
17575
17642
|
};
|
|
17576
17643
|
return /* @__PURE__ */ jsxs60(Box61, { flexDirection: "row", marginBottom: 1, children: [
|
|
17577
|
-
showArrows && /* @__PURE__ */
|
|
17644
|
+
showArrows && /* @__PURE__ */ jsx79(Text56, { color: theme.text.secondary, children: "\u2190 " }),
|
|
17578
17645
|
tabs.map((tab, i) => /* @__PURE__ */ jsxs60(React15.Fragment, { children: [
|
|
17579
|
-
i > 0 && /* @__PURE__ */
|
|
17646
|
+
i > 0 && /* @__PURE__ */ jsx79(Text56, { color: theme.text.secondary, children: " \u2502 " }),
|
|
17580
17647
|
showStatusIcons && /* @__PURE__ */ jsxs60(Text56, { color: theme.text.secondary, children: [
|
|
17581
17648
|
getStatusIcon(tab, i),
|
|
17582
17649
|
" "
|
|
17583
17650
|
] }),
|
|
17584
|
-
/* @__PURE__ */
|
|
17651
|
+
/* @__PURE__ */ jsx79(
|
|
17585
17652
|
Text56,
|
|
17586
17653
|
{
|
|
17587
17654
|
color: i === currentIndex ? theme.text.accent : theme.text.secondary,
|
|
@@ -17590,12 +17657,12 @@ function TabHeader({
|
|
|
17590
17657
|
}
|
|
17591
17658
|
)
|
|
17592
17659
|
] }, tab.key)),
|
|
17593
|
-
showArrows && /* @__PURE__ */
|
|
17660
|
+
showArrows && /* @__PURE__ */ jsx79(Text56, { color: theme.text.secondary, children: " \u2192" })
|
|
17594
17661
|
] });
|
|
17595
17662
|
}
|
|
17596
17663
|
|
|
17597
17664
|
// src/ui/components/dialogs/ask-user-dialog.tsx
|
|
17598
|
-
import { jsx as
|
|
17665
|
+
import { jsx as jsx80, jsxs as jsxs61 } from "react/jsx-runtime";
|
|
17599
17666
|
var initialState2 = {
|
|
17600
17667
|
currentQuestionIndex: 0,
|
|
17601
17668
|
answers: {},
|
|
@@ -17718,19 +17785,19 @@ var ReviewView = ({
|
|
|
17718
17785
|
borderColor: theme.border.default,
|
|
17719
17786
|
children: [
|
|
17720
17787
|
progressHeader,
|
|
17721
|
-
/* @__PURE__ */
|
|
17722
|
-
hasUnanswered && /* @__PURE__ */
|
|
17788
|
+
/* @__PURE__ */ jsx80(Box62, { marginBottom: 1, children: /* @__PURE__ */ jsx80(Text57, { bold: true, color: theme.text.primary, children: "Review your answers:" }) }),
|
|
17789
|
+
hasUnanswered && /* @__PURE__ */ jsx80(Box62, { marginBottom: 1, children: /* @__PURE__ */ jsxs61(Text57, { color: theme.status.warning, children: [
|
|
17723
17790
|
"\u26A0 You have ",
|
|
17724
17791
|
unansweredCount,
|
|
17725
17792
|
" unanswered question",
|
|
17726
17793
|
unansweredCount > 1 ? "s" : ""
|
|
17727
17794
|
] }) }),
|
|
17728
17795
|
questions.map((q, i) => /* @__PURE__ */ jsxs61(Box62, { marginBottom: 0, children: [
|
|
17729
|
-
/* @__PURE__ */
|
|
17730
|
-
/* @__PURE__ */
|
|
17731
|
-
/* @__PURE__ */
|
|
17796
|
+
/* @__PURE__ */ jsx80(Text57, { color: theme.text.secondary, children: q.header }),
|
|
17797
|
+
/* @__PURE__ */ jsx80(Text57, { color: theme.text.secondary, children: " \u2192 " }),
|
|
17798
|
+
/* @__PURE__ */ jsx80(Text57, { color: answers[i] ? theme.text.primary : theme.status.warning, children: (answers[i] ? formatAnswerForReview(q, answers[i]) : void 0) || "(not answered)" })
|
|
17732
17799
|
] }, i)),
|
|
17733
|
-
/* @__PURE__ */
|
|
17800
|
+
/* @__PURE__ */ jsx80(Box62, { marginTop: 1, children: /* @__PURE__ */ jsx80(Text57, { color: theme.text.secondary, children: "Enter to submit \xB7 Tab/Shift+Tab to edit answers \xB7 Esc to cancel" }) })
|
|
17734
17801
|
]
|
|
17735
17802
|
}
|
|
17736
17803
|
);
|
|
@@ -17804,11 +17871,11 @@ var TextQuestionView = ({
|
|
|
17804
17871
|
borderColor: theme.border.default,
|
|
17805
17872
|
children: [
|
|
17806
17873
|
progressHeader,
|
|
17807
|
-
/* @__PURE__ */
|
|
17808
|
-
question.detail && /* @__PURE__ */
|
|
17874
|
+
/* @__PURE__ */ jsx80(Box62, { marginBottom: 1, children: /* @__PURE__ */ jsx80(Text57, { bold: true, color: theme.text.primary, children: question.question }) }),
|
|
17875
|
+
question.detail && /* @__PURE__ */ jsx80(Box62, { marginBottom: 1, children: /* @__PURE__ */ jsx80(Text57, { color: theme.text.secondary, children: question.detail }) }),
|
|
17809
17876
|
/* @__PURE__ */ jsxs61(Box62, { flexDirection: "row", marginBottom: 1, children: [
|
|
17810
|
-
/* @__PURE__ */
|
|
17811
|
-
/* @__PURE__ */
|
|
17877
|
+
/* @__PURE__ */ jsx80(Text57, { color: theme.text.accent, children: "> " }),
|
|
17878
|
+
/* @__PURE__ */ jsx80(
|
|
17812
17879
|
TextInput,
|
|
17813
17880
|
{
|
|
17814
17881
|
buffer,
|
|
@@ -18112,13 +18179,13 @@ var ChoiceQuestionView = ({
|
|
|
18112
18179
|
borderColor: theme.border.default,
|
|
18113
18180
|
children: [
|
|
18114
18181
|
progressHeader,
|
|
18115
|
-
/* @__PURE__ */
|
|
18116
|
-
question.detail && /* @__PURE__ */
|
|
18182
|
+
/* @__PURE__ */ jsx80(Box62, { marginBottom: 1, children: /* @__PURE__ */ jsx80(Text57, { bold: true, color: theme.text.primary, children: question.question }) }),
|
|
18183
|
+
question.detail && /* @__PURE__ */ jsx80(Box62, { marginBottom: 1, children: /* @__PURE__ */ jsx80(Text57, { color: theme.text.secondary, children: question.detail }) }),
|
|
18117
18184
|
question.multiSelect && /* @__PURE__ */ jsxs61(Text57, { color: theme.text.secondary, italic: true, children: [
|
|
18118
18185
|
" ",
|
|
18119
18186
|
"(Select all that apply)"
|
|
18120
18187
|
] }),
|
|
18121
|
-
/* @__PURE__ */
|
|
18188
|
+
/* @__PURE__ */ jsx80(
|
|
18122
18189
|
BaseSelectionList,
|
|
18123
18190
|
{
|
|
18124
18191
|
items: selectionItems,
|
|
@@ -18143,8 +18210,8 @@ var ChoiceQuestionView = ({
|
|
|
18143
18210
|
]
|
|
18144
18211
|
}
|
|
18145
18212
|
),
|
|
18146
|
-
/* @__PURE__ */
|
|
18147
|
-
/* @__PURE__ */
|
|
18213
|
+
/* @__PURE__ */ jsx80(Text57, { color: theme.text.primary, children: " " }),
|
|
18214
|
+
/* @__PURE__ */ jsx80(
|
|
18148
18215
|
TextInput,
|
|
18149
18216
|
{
|
|
18150
18217
|
buffer: customBuffer,
|
|
@@ -18153,7 +18220,7 @@ var ChoiceQuestionView = ({
|
|
|
18153
18220
|
onSubmit: () => handleSelect(optionItem)
|
|
18154
18221
|
}
|
|
18155
18222
|
),
|
|
18156
|
-
isChecked && !question.multiSelect && /* @__PURE__ */
|
|
18223
|
+
isChecked && !question.multiSelect && /* @__PURE__ */ jsx80(Text57, { color: theme.status.success, children: " \u2713" })
|
|
18157
18224
|
] });
|
|
18158
18225
|
}
|
|
18159
18226
|
const labelColor = isChecked && !question.multiSelect ? theme.status.success : context.isSelected ? context.titleColor : theme.text.primary;
|
|
@@ -18174,7 +18241,7 @@ var ChoiceQuestionView = ({
|
|
|
18174
18241
|
" ",
|
|
18175
18242
|
optionItem.label
|
|
18176
18243
|
] }),
|
|
18177
|
-
isChecked && !question.multiSelect && /* @__PURE__ */
|
|
18244
|
+
isChecked && !question.multiSelect && /* @__PURE__ */ jsx80(Text57, { color: theme.status.success, children: " \u2713" })
|
|
18178
18245
|
] }),
|
|
18179
18246
|
optionItem.description && /* @__PURE__ */ jsxs61(Text57, { color: theme.text.secondary, wrap: "wrap", children: [
|
|
18180
18247
|
" ",
|
|
@@ -18356,7 +18423,7 @@ var AskUserDialog = ({
|
|
|
18356
18423
|
}
|
|
18357
18424
|
return questionTabs;
|
|
18358
18425
|
}, [questions]);
|
|
18359
|
-
const progressHeader = questions.length > 1 ? /* @__PURE__ */
|
|
18426
|
+
const progressHeader = questions.length > 1 ? /* @__PURE__ */ jsx80(
|
|
18360
18427
|
TabHeader,
|
|
18361
18428
|
{
|
|
18362
18429
|
tabs,
|
|
@@ -18365,7 +18432,7 @@ var AskUserDialog = ({
|
|
|
18365
18432
|
}
|
|
18366
18433
|
) : null;
|
|
18367
18434
|
if (isOnReviewTab) {
|
|
18368
|
-
return /* @__PURE__ */
|
|
18435
|
+
return /* @__PURE__ */ jsx80(
|
|
18369
18436
|
ReviewView,
|
|
18370
18437
|
{
|
|
18371
18438
|
questions,
|
|
@@ -18376,9 +18443,9 @@ var AskUserDialog = ({
|
|
|
18376
18443
|
);
|
|
18377
18444
|
}
|
|
18378
18445
|
if (!currentQuestion) return null;
|
|
18379
|
-
const keyboardHints = /* @__PURE__ */
|
|
18446
|
+
const keyboardHints = /* @__PURE__ */ jsx80(Box62, { marginTop: 1, children: /* @__PURE__ */ jsx80(Text57, { color: theme.text.secondary, children: currentQuestion.type === "text" || isEditingCustomOption ? questions.length > 1 ? "Enter to submit \xB7 Tab/Shift+Tab to switch questions \xB7 Esc to cancel" : "Enter to submit \xB7 Esc to cancel" : questions.length > 1 ? "Enter to select \xB7 \u2190/\u2192 to switch questions \xB7 Esc to cancel" : "Enter to select \xB7 \u2191/\u2193 to navigate \xB7 Esc to cancel" }) });
|
|
18380
18447
|
if (currentQuestion.type === "text") {
|
|
18381
|
-
return /* @__PURE__ */
|
|
18448
|
+
return /* @__PURE__ */ jsx80(
|
|
18382
18449
|
TextQuestionView,
|
|
18383
18450
|
{
|
|
18384
18451
|
question: currentQuestion,
|
|
@@ -18393,7 +18460,7 @@ var AskUserDialog = ({
|
|
|
18393
18460
|
currentQuestionIndex
|
|
18394
18461
|
);
|
|
18395
18462
|
}
|
|
18396
|
-
return /* @__PURE__ */
|
|
18463
|
+
return /* @__PURE__ */ jsx80(
|
|
18397
18464
|
ChoiceQuestionView,
|
|
18398
18465
|
{
|
|
18399
18466
|
question: effectiveQuestion,
|
|
@@ -18410,7 +18477,7 @@ var AskUserDialog = ({
|
|
|
18410
18477
|
};
|
|
18411
18478
|
|
|
18412
18479
|
// src/ui/components/dialogs/user-question-queue.tsx
|
|
18413
|
-
import { jsx as
|
|
18480
|
+
import { jsx as jsx81 } from "react/jsx-runtime";
|
|
18414
18481
|
var UserQuestionQueue = () => {
|
|
18415
18482
|
const { runtime, snapshot } = useUserQuestionRuntime();
|
|
18416
18483
|
const request = snapshot.pending[0];
|
|
@@ -18433,7 +18500,7 @@ var UserQuestionQueue = () => {
|
|
|
18433
18500
|
[request]
|
|
18434
18501
|
);
|
|
18435
18502
|
if (request === void 0) return null;
|
|
18436
|
-
return /* @__PURE__ */
|
|
18503
|
+
return /* @__PURE__ */ jsx81(
|
|
18437
18504
|
AskUserDialog,
|
|
18438
18505
|
{
|
|
18439
18506
|
questions: [...questions],
|
|
@@ -18456,7 +18523,7 @@ var UserQuestionQueue = () => {
|
|
|
18456
18523
|
};
|
|
18457
18524
|
|
|
18458
18525
|
// src/ui/components/layout/screen-reader-app-layout.tsx
|
|
18459
|
-
import { jsx as
|
|
18526
|
+
import { jsx as jsx82, jsxs as jsxs62 } from "react/jsx-runtime";
|
|
18460
18527
|
var ScreenReaderAppLayout = () => {
|
|
18461
18528
|
const uiState = useUIState();
|
|
18462
18529
|
const { rootUiRef, terminalHeight } = uiState;
|
|
@@ -18473,10 +18540,10 @@ var ScreenReaderAppLayout = () => {
|
|
|
18473
18540
|
height: "100%",
|
|
18474
18541
|
ref: uiState.rootUiRef,
|
|
18475
18542
|
children: [
|
|
18476
|
-
/* @__PURE__ */
|
|
18477
|
-
/* @__PURE__ */
|
|
18478
|
-
/* @__PURE__ */
|
|
18479
|
-
pendingApproval !== void 0 ? /* @__PURE__ */
|
|
18543
|
+
/* @__PURE__ */ jsx82(Notifications, {}),
|
|
18544
|
+
/* @__PURE__ */ jsx82(Footer, {}),
|
|
18545
|
+
/* @__PURE__ */ jsx82(Box63, { flexGrow: 1, overflow: "hidden", children: /* @__PURE__ */ jsx82(MainContent, {}) }),
|
|
18546
|
+
pendingApproval !== void 0 ? /* @__PURE__ */ jsx82(
|
|
18480
18547
|
ToolConfirmationQueue,
|
|
18481
18548
|
{
|
|
18482
18549
|
request: pendingApproval,
|
|
@@ -18485,13 +18552,13 @@ var ScreenReaderAppLayout = () => {
|
|
|
18485
18552
|
terminalWidth: uiState.terminalWidth,
|
|
18486
18553
|
respond: (response) => approvalRuntime.respond(pendingApproval.id, response)
|
|
18487
18554
|
}
|
|
18488
|
-
) : pendingUserQuestion !== void 0 ? /* @__PURE__ */
|
|
18555
|
+
) : pendingUserQuestion !== void 0 ? /* @__PURE__ */ jsx82(UserQuestionQueue, {}) : uiState.dialogsVisible ? /* @__PURE__ */ jsx82(
|
|
18489
18556
|
DialogManager,
|
|
18490
18557
|
{
|
|
18491
18558
|
terminalWidth: uiState.terminalWidth
|
|
18492
18559
|
}
|
|
18493
|
-
) : /* @__PURE__ */
|
|
18494
|
-
/* @__PURE__ */
|
|
18560
|
+
) : /* @__PURE__ */ jsx82(Composer, {}),
|
|
18561
|
+
/* @__PURE__ */ jsx82(ExitWarning, {})
|
|
18495
18562
|
]
|
|
18496
18563
|
}
|
|
18497
18564
|
);
|
|
@@ -18502,17 +18569,17 @@ import { Box as Box65 } from "ink";
|
|
|
18502
18569
|
|
|
18503
18570
|
// src/ui/components/dialogs/copy-mode-warning.tsx
|
|
18504
18571
|
import { Box as Box64, Text as Text58 } from "ink";
|
|
18505
|
-
import { jsx as
|
|
18572
|
+
import { jsx as jsx83 } from "react/jsx-runtime";
|
|
18506
18573
|
var CopyModeWarning = () => {
|
|
18507
18574
|
const { copyModeEnabled } = useUIState();
|
|
18508
18575
|
if (!copyModeEnabled) {
|
|
18509
18576
|
return null;
|
|
18510
18577
|
}
|
|
18511
|
-
return /* @__PURE__ */
|
|
18578
|
+
return /* @__PURE__ */ jsx83(Box64, { children: /* @__PURE__ */ jsx83(Text58, { color: theme.status.warning, children: "In Copy Mode. Press any key to exit." }) });
|
|
18512
18579
|
};
|
|
18513
18580
|
|
|
18514
18581
|
// src/ui/components/layout/default-app-layout.tsx
|
|
18515
|
-
import { Fragment as Fragment14, jsx as
|
|
18582
|
+
import { Fragment as Fragment14, jsx as jsx84, jsxs as jsxs63 } from "react/jsx-runtime";
|
|
18516
18583
|
var DefaultAppLayout = () => {
|
|
18517
18584
|
const uiState = useUIState();
|
|
18518
18585
|
const isAlternateBuffer = useAlternateBuffer();
|
|
@@ -18534,7 +18601,7 @@ var DefaultAppLayout = () => {
|
|
|
18534
18601
|
overflow: "hidden",
|
|
18535
18602
|
ref: uiState.rootUiRef,
|
|
18536
18603
|
children: [
|
|
18537
|
-
/* @__PURE__ */
|
|
18604
|
+
/* @__PURE__ */ jsx84(MainContent, {}),
|
|
18538
18605
|
/* @__PURE__ */ jsxs63(
|
|
18539
18606
|
Box65,
|
|
18540
18607
|
{
|
|
@@ -18544,10 +18611,10 @@ var DefaultAppLayout = () => {
|
|
|
18544
18611
|
flexGrow: 0,
|
|
18545
18612
|
width: uiState.terminalWidth,
|
|
18546
18613
|
children: [
|
|
18547
|
-
/* @__PURE__ */
|
|
18548
|
-
/* @__PURE__ */
|
|
18614
|
+
/* @__PURE__ */ jsx84(Notifications, {}),
|
|
18615
|
+
/* @__PURE__ */ jsx84(CopyModeWarning, {}),
|
|
18549
18616
|
pendingApproval !== void 0 ? /* @__PURE__ */ jsxs63(Fragment14, { children: [
|
|
18550
|
-
/* @__PURE__ */
|
|
18617
|
+
/* @__PURE__ */ jsx84(
|
|
18551
18618
|
ToolConfirmationQueue,
|
|
18552
18619
|
{
|
|
18553
18620
|
request: pendingApproval,
|
|
@@ -18557,14 +18624,14 @@ var DefaultAppLayout = () => {
|
|
|
18557
18624
|
respond: (response) => approvalRuntime.respond(pendingApproval.id, response)
|
|
18558
18625
|
}
|
|
18559
18626
|
),
|
|
18560
|
-
/* @__PURE__ */
|
|
18561
|
-
] }) : pendingUserQuestion !== void 0 ? /* @__PURE__ */
|
|
18627
|
+
/* @__PURE__ */ jsx84(Composer, { isFocused: false })
|
|
18628
|
+
] }) : pendingUserQuestion !== void 0 ? /* @__PURE__ */ jsx84(UserQuestionQueue, {}) : uiState.customDialog ? uiState.customDialog : uiState.dialogsVisible ? /* @__PURE__ */ jsx84(
|
|
18562
18629
|
DialogManager,
|
|
18563
18630
|
{
|
|
18564
18631
|
terminalWidth: uiState.terminalWidth
|
|
18565
18632
|
}
|
|
18566
|
-
) : /* @__PURE__ */
|
|
18567
|
-
/* @__PURE__ */
|
|
18633
|
+
) : /* @__PURE__ */ jsx84(Composer, { isFocused: true }),
|
|
18634
|
+
/* @__PURE__ */ jsx84(ExitWarning, {})
|
|
18568
18635
|
]
|
|
18569
18636
|
}
|
|
18570
18637
|
)
|
|
@@ -18575,7 +18642,7 @@ var DefaultAppLayout = () => {
|
|
|
18575
18642
|
|
|
18576
18643
|
// src/ui/components/indicators/alternate-buffer-quitting-display.tsx
|
|
18577
18644
|
import { Box as Box66, Text as Text59 } from "ink";
|
|
18578
|
-
import { jsx as
|
|
18645
|
+
import { jsx as jsx85, jsxs as jsxs64 } from "react/jsx-runtime";
|
|
18579
18646
|
var AlternateBufferQuittingDisplay = () => {
|
|
18580
18647
|
const { version } = useAppContext();
|
|
18581
18648
|
const uiState = useUIState();
|
|
@@ -18589,8 +18656,8 @@ var AlternateBufferQuittingDisplay = () => {
|
|
|
18589
18656
|
flexGrow: 0,
|
|
18590
18657
|
width: uiState.terminalWidth,
|
|
18591
18658
|
children: [
|
|
18592
|
-
/* @__PURE__ */
|
|
18593
|
-
uiState.history.map((h) => /* @__PURE__ */
|
|
18659
|
+
/* @__PURE__ */ jsx85(AppHeader, { version }, "app-header"),
|
|
18660
|
+
uiState.history.map((h) => /* @__PURE__ */ jsx85(
|
|
18594
18661
|
HistoryItemDisplay,
|
|
18595
18662
|
{
|
|
18596
18663
|
terminalWidth: uiState.mainAreaWidth,
|
|
@@ -18602,7 +18669,7 @@ var AlternateBufferQuittingDisplay = () => {
|
|
|
18602
18669
|
},
|
|
18603
18670
|
h.id
|
|
18604
18671
|
)),
|
|
18605
|
-
uiState.pendingHistoryItems.map((item, i) => /* @__PURE__ */
|
|
18672
|
+
uiState.pendingHistoryItems.map((item, i) => /* @__PURE__ */ jsx85(
|
|
18606
18673
|
HistoryItemDisplay,
|
|
18607
18674
|
{
|
|
18608
18675
|
availableTerminalHeight: void 0,
|
|
@@ -18616,30 +18683,30 @@ var AlternateBufferQuittingDisplay = () => {
|
|
|
18616
18683
|
i
|
|
18617
18684
|
)),
|
|
18618
18685
|
pendingApproval !== void 0 && /* @__PURE__ */ jsxs64(Box66, { flexDirection: "column", marginTop: 1, marginBottom: 1, children: [
|
|
18619
|
-
/* @__PURE__ */
|
|
18620
|
-
/* @__PURE__ */
|
|
18621
|
-
pendingApproval.reason !== void 0 && /* @__PURE__ */
|
|
18686
|
+
/* @__PURE__ */ jsx85(Text59, { color: theme.status.warning, bold: true, children: "Action Required (was prompted):" }),
|
|
18687
|
+
/* @__PURE__ */ jsx85(Text59, { color: theme.text.primary, children: pendingApproval.toolName }),
|
|
18688
|
+
pendingApproval.reason !== void 0 && /* @__PURE__ */ jsx85(Text59, { color: theme.text.secondary, children: pendingApproval.reason })
|
|
18622
18689
|
] }),
|
|
18623
|
-
/* @__PURE__ */
|
|
18690
|
+
/* @__PURE__ */ jsx85(QuittingDisplay, {})
|
|
18624
18691
|
]
|
|
18625
18692
|
}
|
|
18626
18693
|
);
|
|
18627
18694
|
};
|
|
18628
18695
|
|
|
18629
18696
|
// src/ui/app.tsx
|
|
18630
|
-
import { jsx as
|
|
18697
|
+
import { jsx as jsx86 } from "react/jsx-runtime";
|
|
18631
18698
|
var App = () => {
|
|
18632
18699
|
const uiState = useUIState();
|
|
18633
18700
|
const isAlternateBuffer = useAlternateBuffer();
|
|
18634
18701
|
const isScreenReaderEnabled = useIsScreenReaderEnabled5();
|
|
18635
18702
|
if (uiState.quittingMessages) {
|
|
18636
18703
|
if (isAlternateBuffer) {
|
|
18637
|
-
return /* @__PURE__ */
|
|
18704
|
+
return /* @__PURE__ */ jsx86(StreamingContext.Provider, { value: uiState.streamingState, children: /* @__PURE__ */ jsx86(AlternateBufferQuittingDisplay, {}) });
|
|
18638
18705
|
} else {
|
|
18639
|
-
return /* @__PURE__ */
|
|
18706
|
+
return /* @__PURE__ */ jsx86(QuittingDisplay, {});
|
|
18640
18707
|
}
|
|
18641
18708
|
}
|
|
18642
|
-
return /* @__PURE__ */
|
|
18709
|
+
return /* @__PURE__ */ jsx86(StreamingContext.Provider, { value: uiState.streamingState, children: isScreenReaderEnabled ? /* @__PURE__ */ jsx86(ScreenReaderAppLayout, {}) : /* @__PURE__ */ jsx86(DefaultAppLayout, {}) });
|
|
18643
18710
|
};
|
|
18644
18711
|
|
|
18645
18712
|
// src/ui/app-container.tsx
|
|
@@ -18705,7 +18772,7 @@ function useHistory() {
|
|
|
18705
18772
|
}
|
|
18706
18773
|
|
|
18707
18774
|
// src/ui/hooks/commands/use-slash-command-processor.ts
|
|
18708
|
-
import { useCallback as useCallback35, useMemo as
|
|
18775
|
+
import { useCallback as useCallback35, useMemo as useMemo33, useEffect as useEffect43, useRef as useRef21, useState as useState41 } from "react";
|
|
18709
18776
|
|
|
18710
18777
|
// src/services/command-service.ts
|
|
18711
18778
|
var CommandService = class _CommandService {
|
|
@@ -19132,26 +19199,222 @@ var terminalSetupCommand = {
|
|
|
19132
19199
|
import React16 from "react";
|
|
19133
19200
|
|
|
19134
19201
|
// src/ui/components/dialogs/model-dialog.tsx
|
|
19135
|
-
import { useCallback as useCallback32, useEffect as
|
|
19202
|
+
import { useCallback as useCallback32, useEffect as useEffect39, useMemo as useMemo28, useRef as useRef19, useState as useState36 } from "react";
|
|
19203
|
+
import { Box as Box68, Text as Text61 } from "ink";
|
|
19204
|
+
|
|
19205
|
+
// src/ui/components/dialogs/provider-setup-dialog.tsx
|
|
19206
|
+
import { useEffect as useEffect38, useRef as useRef18, useState as useState35 } from "react";
|
|
19136
19207
|
import { Box as Box67, Text as Text60 } from "ink";
|
|
19137
|
-
import {
|
|
19208
|
+
import { jsx as jsx87, jsxs as jsxs65 } from "react/jsx-runtime";
|
|
19209
|
+
function ProviderSetupDialog({
|
|
19210
|
+
runtime,
|
|
19211
|
+
provider,
|
|
19212
|
+
reason = "model",
|
|
19213
|
+
onCancel,
|
|
19214
|
+
onConfigured
|
|
19215
|
+
}) {
|
|
19216
|
+
useSensitiveInputProtection();
|
|
19217
|
+
const [view, setView] = useState35();
|
|
19218
|
+
const [secret, setSecret] = useState35("");
|
|
19219
|
+
const [saving, setSaving] = useState35(false);
|
|
19220
|
+
const [error, setError] = useState35();
|
|
19221
|
+
const mountedRef = useRef18(true);
|
|
19222
|
+
const saveControllerRef = useRef18(void 0);
|
|
19223
|
+
useEffect38(() => {
|
|
19224
|
+
mountedRef.current = true;
|
|
19225
|
+
const controller = new AbortController();
|
|
19226
|
+
void runtime.describeProvider(provider, controller.signal).then(setView).catch((cause) => {
|
|
19227
|
+
if (!controller.signal.aborted) {
|
|
19228
|
+
setError(cause instanceof Error ? cause.message : String(cause));
|
|
19229
|
+
}
|
|
19230
|
+
});
|
|
19231
|
+
return () => {
|
|
19232
|
+
mountedRef.current = false;
|
|
19233
|
+
controller.abort();
|
|
19234
|
+
saveControllerRef.current?.abort();
|
|
19235
|
+
};
|
|
19236
|
+
}, [provider, runtime]);
|
|
19237
|
+
const submit = async () => {
|
|
19238
|
+
if (saving || !view?.writable) return;
|
|
19239
|
+
const value = secret;
|
|
19240
|
+
const controller = new AbortController();
|
|
19241
|
+
saveControllerRef.current?.abort();
|
|
19242
|
+
saveControllerRef.current = controller;
|
|
19243
|
+
setSecret("");
|
|
19244
|
+
setSaving(true);
|
|
19245
|
+
setError(void 0);
|
|
19246
|
+
try {
|
|
19247
|
+
const configured = await runtime.configure(
|
|
19248
|
+
provider,
|
|
19249
|
+
value,
|
|
19250
|
+
controller.signal
|
|
19251
|
+
);
|
|
19252
|
+
if (!mountedRef.current || controller.signal.aborted) return;
|
|
19253
|
+
onConfigured(configured);
|
|
19254
|
+
} catch (cause) {
|
|
19255
|
+
if (!mountedRef.current || controller.signal.aborted || cause instanceof Error && cause.name === "AbortError") {
|
|
19256
|
+
return;
|
|
19257
|
+
}
|
|
19258
|
+
setError(
|
|
19259
|
+
cause instanceof Error ? cause.message : "Unable to save this credential."
|
|
19260
|
+
);
|
|
19261
|
+
} finally {
|
|
19262
|
+
if (saveControllerRef.current === controller) {
|
|
19263
|
+
saveControllerRef.current = void 0;
|
|
19264
|
+
}
|
|
19265
|
+
if (mountedRef.current) setSaving(false);
|
|
19266
|
+
}
|
|
19267
|
+
};
|
|
19268
|
+
useKeypress(
|
|
19269
|
+
(key) => {
|
|
19270
|
+
if (key.name === "escape") {
|
|
19271
|
+
saveControllerRef.current?.abort();
|
|
19272
|
+
setSecret("");
|
|
19273
|
+
onCancel();
|
|
19274
|
+
return;
|
|
19275
|
+
}
|
|
19276
|
+
if (key.ctrl && key.name === "c") {
|
|
19277
|
+
if (saving || secret.length === 0) {
|
|
19278
|
+
saveControllerRef.current?.abort();
|
|
19279
|
+
setSecret("");
|
|
19280
|
+
onCancel();
|
|
19281
|
+
} else {
|
|
19282
|
+
setSecret("");
|
|
19283
|
+
}
|
|
19284
|
+
return;
|
|
19285
|
+
}
|
|
19286
|
+
if (saving) return;
|
|
19287
|
+
if (key.ctrl && key.name === "u") {
|
|
19288
|
+
setSecret("");
|
|
19289
|
+
return;
|
|
19290
|
+
}
|
|
19291
|
+
if (key.name === "return" || key.name === "enter") {
|
|
19292
|
+
void submit();
|
|
19293
|
+
return;
|
|
19294
|
+
}
|
|
19295
|
+
if (key.name === "backspace" || key.name === "delete" || key.ctrl && key.name === "h") {
|
|
19296
|
+
setSecret((current) => current.slice(0, -1));
|
|
19297
|
+
return;
|
|
19298
|
+
}
|
|
19299
|
+
if (!key.ctrl && !key.cmd && key.sequence && key.sequence >= " ") {
|
|
19300
|
+
setSecret((current) => current + key.sequence);
|
|
19301
|
+
}
|
|
19302
|
+
},
|
|
19303
|
+
{ isActive: true }
|
|
19304
|
+
);
|
|
19305
|
+
const label = view?.displayName ?? provider;
|
|
19306
|
+
const credential = view?.credentialLabel ?? "provider credential";
|
|
19307
|
+
const fieldLabel = credential.endsWith("_API_KEY") ? "API key" : "Credential";
|
|
19308
|
+
const canWrite = view?.writable === true;
|
|
19309
|
+
const isReadOnly = view !== void 0 && view.status !== "unsupported" && view.status !== "error" && !view.writable;
|
|
19310
|
+
return /* @__PURE__ */ jsxs65(
|
|
19311
|
+
Box67,
|
|
19312
|
+
{
|
|
19313
|
+
borderStyle: "round",
|
|
19314
|
+
borderColor: theme.border.default,
|
|
19315
|
+
flexDirection: "column",
|
|
19316
|
+
paddingX: 1,
|
|
19317
|
+
paddingY: 1,
|
|
19318
|
+
width: "100%",
|
|
19319
|
+
children: [
|
|
19320
|
+
/* @__PURE__ */ jsxs65(Box67, { justifyContent: "space-between", children: [
|
|
19321
|
+
/* @__PURE__ */ jsxs65(Text60, { bold: true, color: theme.text.accent, children: [
|
|
19322
|
+
"Configure ",
|
|
19323
|
+
label
|
|
19324
|
+
] }),
|
|
19325
|
+
/* @__PURE__ */ jsxs65(Text60, { color: theme.text.secondary, children: [
|
|
19326
|
+
/* @__PURE__ */ jsx87(Text60, { bold: true, color: theme.text.primary, children: "Esc" }),
|
|
19327
|
+
" ",
|
|
19328
|
+
reason === "first-run" ? "Cancel" : "Close"
|
|
19329
|
+
] })
|
|
19330
|
+
] }),
|
|
19331
|
+
/* @__PURE__ */ jsxs65(Box67, { marginTop: 1, flexDirection: "column", children: [
|
|
19332
|
+
/* @__PURE__ */ jsx87(Text60, { color: theme.text.primary, children: reason === "first-run" ? `Enter your ${label} API key to continue.` : `Enter a replacement credential for ${label}.` }),
|
|
19333
|
+
/* @__PURE__ */ jsxs65(Text60, { color: theme.text.secondary, children: [
|
|
19334
|
+
"Alternatively, set ",
|
|
19335
|
+
credential,
|
|
19336
|
+
" before starting DSH Console."
|
|
19337
|
+
] })
|
|
19338
|
+
] }),
|
|
19339
|
+
!view && !error && /* @__PURE__ */ jsx87(Box67, { marginTop: 1, children: /* @__PURE__ */ jsx87(Text60, { color: theme.text.secondary, children: "Checking provider setup..." }) }),
|
|
19340
|
+
view?.status === "configured" && /* @__PURE__ */ jsx87(Box67, { marginTop: 1, children: /* @__PURE__ */ jsxs65(Text60, { color: theme.status.success, children: [
|
|
19341
|
+
"Configured from ",
|
|
19342
|
+
view.source ?? "DSH credential storage",
|
|
19343
|
+
"."
|
|
19344
|
+
] }) }),
|
|
19345
|
+
(view?.status === "unsupported" || view?.status === "error") && view.message && /* @__PURE__ */ jsx87(Box67, { marginTop: 1, children: /* @__PURE__ */ jsx87(Text60, { color: theme.status.warning, children: view.message }) }),
|
|
19346
|
+
isReadOnly && /* @__PURE__ */ jsx87(Box67, { marginTop: 1, children: /* @__PURE__ */ jsxs65(Text60, { color: theme.status.warning, children: [
|
|
19347
|
+
credential,
|
|
19348
|
+
" is supplied by a read-only source. Change that source and restart DSH Console."
|
|
19349
|
+
] }) }),
|
|
19350
|
+
canWrite && /* @__PURE__ */ jsxs65(Box67, { marginTop: 1, flexDirection: "column", children: [
|
|
19351
|
+
/* @__PURE__ */ jsx87(Text60, { bold: true, color: theme.text.primary, children: fieldLabel }),
|
|
19352
|
+
/* @__PURE__ */ jsx87(
|
|
19353
|
+
Box67,
|
|
19354
|
+
{
|
|
19355
|
+
borderStyle: "single",
|
|
19356
|
+
borderColor: saving ? theme.border.default : theme.text.accent,
|
|
19357
|
+
paddingX: 1,
|
|
19358
|
+
children: /* @__PURE__ */ jsx87(Text60, { color: theme.text.primary, children: secret.length === 0 ? /* @__PURE__ */ jsxs65(Text60, { color: theme.text.secondary, children: [
|
|
19359
|
+
"Paste your ",
|
|
19360
|
+
label,
|
|
19361
|
+
" API key"
|
|
19362
|
+
] }) : `${"*".repeat(Math.min(secret.length, 64))}${secret.length > 64 ? "..." : ""}` })
|
|
19363
|
+
}
|
|
19364
|
+
)
|
|
19365
|
+
] }),
|
|
19366
|
+
error && /* @__PURE__ */ jsx87(Box67, { marginTop: 1, children: /* @__PURE__ */ jsx87(Text60, { color: theme.status.error, children: error }) }),
|
|
19367
|
+
canWrite ? /* @__PURE__ */ jsxs65(Box67, { marginTop: 1, flexDirection: "column", children: [
|
|
19368
|
+
/* @__PURE__ */ jsx87(Text60, { color: theme.text.secondary, children: "Stored through the configured DSH credential service. Never added to prompts, sessions, history, or logs." }),
|
|
19369
|
+
/* @__PURE__ */ jsxs65(Box67, { marginTop: 1, children: [
|
|
19370
|
+
/* @__PURE__ */ jsx87(Text60, { bold: true, color: theme.text.accent, children: "Enter" }),
|
|
19371
|
+
/* @__PURE__ */ jsx87(Text60, { color: theme.text.primary, children: " Save and continue" }),
|
|
19372
|
+
/* @__PURE__ */ jsx87(Text60, { color: theme.text.secondary, children: " " }),
|
|
19373
|
+
/* @__PURE__ */ jsx87(Text60, { bold: true, color: theme.text.primary, children: "Esc" }),
|
|
19374
|
+
/* @__PURE__ */ jsxs65(Text60, { color: theme.text.secondary, children: [
|
|
19375
|
+
" ",
|
|
19376
|
+
reason === "first-run" ? "Cancel" : "Close"
|
|
19377
|
+
] }),
|
|
19378
|
+
/* @__PURE__ */ jsx87(Text60, { color: theme.text.secondary, children: " " }),
|
|
19379
|
+
/* @__PURE__ */ jsx87(Text60, { bold: true, color: theme.text.primary, children: "Ctrl+C" }),
|
|
19380
|
+
/* @__PURE__ */ jsxs65(Text60, { color: theme.text.secondary, children: [
|
|
19381
|
+
" ",
|
|
19382
|
+
secret.length > 0 ? "Clear" : "Cancel"
|
|
19383
|
+
] })
|
|
19384
|
+
] })
|
|
19385
|
+
] }) : /* @__PURE__ */ jsxs65(Box67, { marginTop: 1, children: [
|
|
19386
|
+
/* @__PURE__ */ jsx87(Text60, { bold: true, color: theme.text.primary, children: "Esc" }),
|
|
19387
|
+
/* @__PURE__ */ jsx87(Text60, { color: theme.text.secondary, children: " Close" })
|
|
19388
|
+
] }),
|
|
19389
|
+
saving && /* @__PURE__ */ jsx87(Text60, { bold: true, color: theme.text.accent, children: "Saving credential..." })
|
|
19390
|
+
]
|
|
19391
|
+
}
|
|
19392
|
+
);
|
|
19393
|
+
}
|
|
19394
|
+
|
|
19395
|
+
// src/ui/components/dialogs/model-dialog.tsx
|
|
19396
|
+
import { Fragment as Fragment15, jsx as jsx88, jsxs as jsxs66 } from "react/jsx-runtime";
|
|
19138
19397
|
function capabilityLabel(model) {
|
|
19139
19398
|
return model.inputModalities.includes("image") ? "Text + Vision" : "Text";
|
|
19140
19399
|
}
|
|
19141
19400
|
function ModelDialog({
|
|
19142
19401
|
runtime,
|
|
19143
19402
|
onClose,
|
|
19144
|
-
onSwitched
|
|
19403
|
+
onSwitched,
|
|
19404
|
+
providerSetupRuntime
|
|
19145
19405
|
}) {
|
|
19146
|
-
const [models, setModels] =
|
|
19147
|
-
const [highlighted, setHighlighted] =
|
|
19406
|
+
const [models, setModels] = useState36([]);
|
|
19407
|
+
const [highlighted, setHighlighted] = useState36(
|
|
19148
19408
|
runtime.getSnapshot().current
|
|
19149
19409
|
);
|
|
19150
|
-
const [pending, setPending] =
|
|
19151
|
-
const [loading, setLoading] =
|
|
19152
|
-
const [switching, setSwitching] =
|
|
19153
|
-
const [
|
|
19154
|
-
|
|
19410
|
+
const [pending, setPending] = useState36();
|
|
19411
|
+
const [loading, setLoading] = useState36(true);
|
|
19412
|
+
const [switching, setSwitching] = useState36(false);
|
|
19413
|
+
const [checkingProvider, setCheckingProvider] = useState36(false);
|
|
19414
|
+
const [error, setError] = useState36();
|
|
19415
|
+
const [setupSelection, setSetupSelection] = useState36();
|
|
19416
|
+
const providerCheckRef = useRef19(void 0);
|
|
19417
|
+
useEffect39(() => {
|
|
19155
19418
|
const controller = new AbortController();
|
|
19156
19419
|
void runtime.listModels(controller.signal).then((listed) => {
|
|
19157
19420
|
const sorted = [...listed].sort(
|
|
@@ -19173,6 +19436,10 @@ function ModelDialog({
|
|
|
19173
19436
|
});
|
|
19174
19437
|
return () => controller.abort();
|
|
19175
19438
|
}, [runtime]);
|
|
19439
|
+
useEffect39(
|
|
19440
|
+
() => () => providerCheckRef.current?.abort(),
|
|
19441
|
+
[]
|
|
19442
|
+
);
|
|
19176
19443
|
const current = runtime.getSnapshot().current;
|
|
19177
19444
|
const initialIndex = Math.max(
|
|
19178
19445
|
0,
|
|
@@ -19204,7 +19471,7 @@ function ModelDialog({
|
|
|
19204
19471
|
},
|
|
19205
19472
|
[onSwitched, runtime]
|
|
19206
19473
|
);
|
|
19207
|
-
const
|
|
19474
|
+
const finishSelection = useCallback32(
|
|
19208
19475
|
(selection) => {
|
|
19209
19476
|
if (selection.provider === current.provider && selection.model === current.model) {
|
|
19210
19477
|
onClose();
|
|
@@ -19218,16 +19485,75 @@ function ModelDialog({
|
|
|
19218
19485
|
},
|
|
19219
19486
|
[current.model, current.provider, onClose, runtime, switchModel]
|
|
19220
19487
|
);
|
|
19488
|
+
const selectModel = useCallback32(
|
|
19489
|
+
async (selection) => {
|
|
19490
|
+
if (providerSetupRuntime) {
|
|
19491
|
+
providerCheckRef.current?.abort();
|
|
19492
|
+
const controller = new AbortController();
|
|
19493
|
+
providerCheckRef.current = controller;
|
|
19494
|
+
setCheckingProvider(true);
|
|
19495
|
+
setError(void 0);
|
|
19496
|
+
try {
|
|
19497
|
+
const setup = await providerSetupRuntime.describeProvider(
|
|
19498
|
+
selection.provider,
|
|
19499
|
+
controller.signal
|
|
19500
|
+
);
|
|
19501
|
+
if (setup.status === "missing") {
|
|
19502
|
+
if (!setup.writable) {
|
|
19503
|
+
setError(
|
|
19504
|
+
`${setup.credentialLabel ?? "The credential"} is supplied by a read-only source and is not configured.`
|
|
19505
|
+
);
|
|
19506
|
+
return;
|
|
19507
|
+
}
|
|
19508
|
+
setSetupSelection(selection);
|
|
19509
|
+
return;
|
|
19510
|
+
}
|
|
19511
|
+
} catch (cause) {
|
|
19512
|
+
if (controller.signal.aborted || cause instanceof Error && cause.name === "AbortError") {
|
|
19513
|
+
return;
|
|
19514
|
+
}
|
|
19515
|
+
setError(cause instanceof Error ? cause.message : String(cause));
|
|
19516
|
+
return;
|
|
19517
|
+
} finally {
|
|
19518
|
+
if (providerCheckRef.current === controller) {
|
|
19519
|
+
providerCheckRef.current = void 0;
|
|
19520
|
+
setCheckingProvider(false);
|
|
19521
|
+
}
|
|
19522
|
+
}
|
|
19523
|
+
}
|
|
19524
|
+
finishSelection(selection);
|
|
19525
|
+
},
|
|
19526
|
+
[finishSelection, providerSetupRuntime]
|
|
19527
|
+
);
|
|
19221
19528
|
useKeypress(
|
|
19222
19529
|
(key) => {
|
|
19223
19530
|
if (key.name !== "escape" || switching) return;
|
|
19531
|
+
if (checkingProvider) {
|
|
19532
|
+
providerCheckRef.current?.abort();
|
|
19533
|
+
return;
|
|
19534
|
+
}
|
|
19224
19535
|
if (pending) setPending(void 0);
|
|
19225
19536
|
else onClose();
|
|
19226
19537
|
},
|
|
19227
|
-
{ isActive:
|
|
19538
|
+
{ isActive: setupSelection === void 0 }
|
|
19228
19539
|
);
|
|
19229
|
-
|
|
19230
|
-
|
|
19540
|
+
if (setupSelection) {
|
|
19541
|
+
return /* @__PURE__ */ jsx88(
|
|
19542
|
+
ProviderSetupDialog,
|
|
19543
|
+
{
|
|
19544
|
+
runtime: providerSetupRuntime,
|
|
19545
|
+
provider: setupSelection.provider,
|
|
19546
|
+
onCancel: () => setSetupSelection(void 0),
|
|
19547
|
+
onConfigured: () => {
|
|
19548
|
+
const selection = setupSelection;
|
|
19549
|
+
setSetupSelection(void 0);
|
|
19550
|
+
finishSelection(selection);
|
|
19551
|
+
}
|
|
19552
|
+
}
|
|
19553
|
+
);
|
|
19554
|
+
}
|
|
19555
|
+
return /* @__PURE__ */ jsxs66(
|
|
19556
|
+
Box68,
|
|
19231
19557
|
{
|
|
19232
19558
|
borderStyle: "round",
|
|
19233
19559
|
borderColor: theme.border.default,
|
|
@@ -19236,47 +19562,47 @@ function ModelDialog({
|
|
|
19236
19562
|
paddingY: 1,
|
|
19237
19563
|
width: "100%",
|
|
19238
19564
|
children: [
|
|
19239
|
-
/* @__PURE__ */
|
|
19240
|
-
/* @__PURE__ */
|
|
19241
|
-
/* @__PURE__ */
|
|
19565
|
+
/* @__PURE__ */ jsxs66(Box68, { justifyContent: "space-between", children: [
|
|
19566
|
+
/* @__PURE__ */ jsx88(Text61, { bold: true, color: theme.text.primary, children: "Select DSH Model" }),
|
|
19567
|
+
/* @__PURE__ */ jsx88(Text61, { color: theme.text.secondary, children: "Esc to close" })
|
|
19242
19568
|
] }),
|
|
19243
|
-
error && /* @__PURE__ */
|
|
19244
|
-
loading ? /* @__PURE__ */
|
|
19245
|
-
/* @__PURE__ */
|
|
19569
|
+
error && /* @__PURE__ */ jsx88(Box68, { marginTop: 1, children: /* @__PURE__ */ jsx88(Text61, { color: theme.status.error, children: error }) }),
|
|
19570
|
+
loading ? /* @__PURE__ */ jsx88(Box68, { marginTop: 1, children: /* @__PURE__ */ jsx88(Text61, { color: theme.text.secondary, children: "Loading models..." }) }) : models.length === 0 ? /* @__PURE__ */ jsx88(Box68, { marginTop: 1, children: /* @__PURE__ */ jsx88(Text61, { color: theme.status.warning, children: "No DSH models are available." }) }) : /* @__PURE__ */ jsxs66(Box68, { flexDirection: "row", marginTop: 1, children: [
|
|
19571
|
+
/* @__PURE__ */ jsx88(Box68, { width: "55%", paddingRight: 2, flexDirection: "column", children: /* @__PURE__ */ jsx88(
|
|
19246
19572
|
RadioButtonSelect,
|
|
19247
19573
|
{
|
|
19248
19574
|
items,
|
|
19249
19575
|
initialIndex,
|
|
19250
19576
|
onHighlight: setHighlighted,
|
|
19251
|
-
onSelect: selectModel,
|
|
19252
|
-
isFocused: !pending && !switching,
|
|
19577
|
+
onSelect: (selection) => void selectModel(selection),
|
|
19578
|
+
isFocused: !pending && !switching && !checkingProvider,
|
|
19253
19579
|
showScrollArrows: true,
|
|
19254
19580
|
maxItemsToShow: 12,
|
|
19255
19581
|
renderItem: (item, { titleColor }) => {
|
|
19256
19582
|
const model = item.value;
|
|
19257
19583
|
const isCurrent = model.provider === current.provider && model.model === current.model;
|
|
19258
|
-
return /* @__PURE__ */
|
|
19584
|
+
return /* @__PURE__ */ jsxs66(Text61, { color: titleColor, wrap: "truncate", children: [
|
|
19259
19585
|
model.name,
|
|
19260
19586
|
" ",
|
|
19261
|
-
/* @__PURE__ */
|
|
19262
|
-
model.inputModalities.includes("image") && /* @__PURE__ */
|
|
19263
|
-
isCurrent && /* @__PURE__ */
|
|
19587
|
+
/* @__PURE__ */ jsx88(Text61, { color: theme.text.secondary, children: model.provider }),
|
|
19588
|
+
model.inputModalities.includes("image") && /* @__PURE__ */ jsx88(Text61, { color: theme.status.success, children: " Vision" }),
|
|
19589
|
+
isCurrent && /* @__PURE__ */ jsx88(Text61, { color: theme.text.accent, children: " Current" })
|
|
19264
19590
|
] });
|
|
19265
19591
|
}
|
|
19266
19592
|
},
|
|
19267
19593
|
items.map((item) => item.key).join("|")
|
|
19268
19594
|
) }),
|
|
19269
|
-
/* @__PURE__ */
|
|
19270
|
-
/* @__PURE__ */
|
|
19271
|
-
/* @__PURE__ */
|
|
19272
|
-
/* @__PURE__ */
|
|
19595
|
+
/* @__PURE__ */ jsx88(Box68, { width: "45%", paddingLeft: 2, flexDirection: "column", children: pending ? /* @__PURE__ */ jsxs66(Fragment15, { children: [
|
|
19596
|
+
/* @__PURE__ */ jsx88(Text61, { bold: true, color: theme.status.warning, children: "Start a new Session?" }),
|
|
19597
|
+
/* @__PURE__ */ jsxs66(Box68, { marginTop: 1, flexDirection: "column", children: [
|
|
19598
|
+
/* @__PURE__ */ jsxs66(Text61, { children: [
|
|
19273
19599
|
"Changing to ",
|
|
19274
19600
|
pending.name,
|
|
19275
19601
|
" creates a new DSH Agent and Session."
|
|
19276
19602
|
] }),
|
|
19277
|
-
/* @__PURE__ */
|
|
19603
|
+
/* @__PURE__ */ jsx88(Text61, { color: theme.text.secondary, children: "The existing transcript remains visible but is not sent to the new model." })
|
|
19278
19604
|
] }),
|
|
19279
|
-
/* @__PURE__ */
|
|
19605
|
+
/* @__PURE__ */ jsx88(Box68, { marginTop: 1, children: /* @__PURE__ */ jsx88(
|
|
19280
19606
|
RadioButtonSelect,
|
|
19281
19607
|
{
|
|
19282
19608
|
items: [
|
|
@@ -19291,20 +19617,21 @@ function ModelDialog({
|
|
|
19291
19617
|
showNumbers: false
|
|
19292
19618
|
}
|
|
19293
19619
|
) })
|
|
19294
|
-
] }) : /* @__PURE__ */
|
|
19295
|
-
/* @__PURE__ */
|
|
19296
|
-
/* @__PURE__ */
|
|
19297
|
-
/* @__PURE__ */
|
|
19298
|
-
/* @__PURE__ */
|
|
19299
|
-
/* @__PURE__ */
|
|
19300
|
-
/* @__PURE__ */
|
|
19301
|
-
/* @__PURE__ */
|
|
19302
|
-
/* @__PURE__ */
|
|
19620
|
+
] }) : /* @__PURE__ */ jsxs66(Fragment15, { children: [
|
|
19621
|
+
/* @__PURE__ */ jsx88(Text61, { bold: true, color: theme.text.primary, children: highlighted.name }),
|
|
19622
|
+
/* @__PURE__ */ jsxs66(Box68, { marginTop: 1, flexDirection: "column", children: [
|
|
19623
|
+
/* @__PURE__ */ jsx88(Text61, { color: theme.text.secondary, children: "Provider" }),
|
|
19624
|
+
/* @__PURE__ */ jsx88(Text61, { children: highlighted.provider }),
|
|
19625
|
+
/* @__PURE__ */ jsx88(Text61, { color: theme.text.secondary, children: "Model ID" }),
|
|
19626
|
+
/* @__PURE__ */ jsx88(Text61, { wrap: "wrap", children: highlighted.model }),
|
|
19627
|
+
/* @__PURE__ */ jsx88(Text61, { color: theme.text.secondary, children: "Input" }),
|
|
19628
|
+
/* @__PURE__ */ jsx88(Text61, { color: highlighted.inputModalities.includes("image") ? theme.status.success : theme.text.primary, children: capabilityLabel(highlighted) })
|
|
19303
19629
|
] }),
|
|
19304
|
-
switching && /* @__PURE__ */
|
|
19630
|
+
switching && /* @__PURE__ */ jsx88(Box68, { marginTop: 1, children: /* @__PURE__ */ jsx88(Text61, { color: theme.text.accent, children: "Creating new Agent..." }) }),
|
|
19631
|
+
checkingProvider && /* @__PURE__ */ jsx88(Box68, { marginTop: 1, children: /* @__PURE__ */ jsx88(Text61, { color: theme.text.accent, children: "Checking provider setup..." }) })
|
|
19305
19632
|
] }) })
|
|
19306
19633
|
] }),
|
|
19307
|
-
/* @__PURE__ */
|
|
19634
|
+
/* @__PURE__ */ jsx88(Box68, { marginTop: 1, children: /* @__PURE__ */ jsx88(Text61, { color: theme.text.secondary, children: "Use \u2191/\u2193 to navigate and Enter to select." }) })
|
|
19308
19635
|
]
|
|
19309
19636
|
}
|
|
19310
19637
|
);
|
|
@@ -19330,6 +19657,7 @@ var modelCommand = {
|
|
|
19330
19657
|
type: "custom_dialog",
|
|
19331
19658
|
component: React16.createElement(ModelDialog, {
|
|
19332
19659
|
runtime,
|
|
19660
|
+
providerSetupRuntime: context.services.providerSetup,
|
|
19333
19661
|
onClose: context.ui.removeComponent,
|
|
19334
19662
|
onSwitched: (selection) => {
|
|
19335
19663
|
context.ui.addItem({
|
|
@@ -19365,6 +19693,43 @@ var modelCommand = {
|
|
|
19365
19693
|
originalInvocation: { raw: context.invocation?.raw ?? `/model ${args}` }
|
|
19366
19694
|
};
|
|
19367
19695
|
}
|
|
19696
|
+
const providerSetup = context.services.providerSetup;
|
|
19697
|
+
if (providerSetup) {
|
|
19698
|
+
const setup = await providerSetup.describeProvider(
|
|
19699
|
+
words[1],
|
|
19700
|
+
context.invocation.signal
|
|
19701
|
+
);
|
|
19702
|
+
if (setup.status === "missing") {
|
|
19703
|
+
if (!setup.writable) {
|
|
19704
|
+
return {
|
|
19705
|
+
type: "message",
|
|
19706
|
+
messageType: "error",
|
|
19707
|
+
content: `${setup.credentialLabel ?? "The provider credential"} is supplied by a read-only source and is not configured.`
|
|
19708
|
+
};
|
|
19709
|
+
}
|
|
19710
|
+
return {
|
|
19711
|
+
type: "custom_dialog",
|
|
19712
|
+
component: React16.createElement(ProviderSetupDialog, {
|
|
19713
|
+
runtime: providerSetup,
|
|
19714
|
+
provider: words[1],
|
|
19715
|
+
onCancel: context.ui.removeComponent,
|
|
19716
|
+
onConfigured: () => {
|
|
19717
|
+
void runtime.setModel(words[1], words[2]).then((selection) => {
|
|
19718
|
+
context.ui.addItem({
|
|
19719
|
+
type: "info" /* INFO */,
|
|
19720
|
+
text: `Started a new Agent with ${modelSelectionLabel(selection)}.`
|
|
19721
|
+
});
|
|
19722
|
+
}).catch(() => {
|
|
19723
|
+
context.ui.addItem({
|
|
19724
|
+
type: "error" /* ERROR */,
|
|
19725
|
+
text: "The credential was saved, but DSH could not start the selected model."
|
|
19726
|
+
});
|
|
19727
|
+
}).finally(context.ui.removeComponent);
|
|
19728
|
+
}
|
|
19729
|
+
})
|
|
19730
|
+
};
|
|
19731
|
+
}
|
|
19732
|
+
}
|
|
19368
19733
|
const selected = await runtime.setModel(words[1], words[2]);
|
|
19369
19734
|
return {
|
|
19370
19735
|
type: "message",
|
|
@@ -19388,13 +19753,248 @@ var modelCommand = {
|
|
|
19388
19753
|
}
|
|
19389
19754
|
};
|
|
19390
19755
|
|
|
19391
|
-
// src/ui/commands/
|
|
19756
|
+
// src/ui/commands/provider-command.ts
|
|
19392
19757
|
import React17 from "react";
|
|
19393
19758
|
|
|
19759
|
+
// src/ui/components/dialogs/provider-dialog.tsx
|
|
19760
|
+
import { useEffect as useEffect40, useMemo as useMemo29, useState as useState37 } from "react";
|
|
19761
|
+
import { Box as Box69, Text as Text62 } from "ink";
|
|
19762
|
+
import { Fragment as Fragment16, jsx as jsx89, jsxs as jsxs67 } from "react/jsx-runtime";
|
|
19763
|
+
function statusLabel(status) {
|
|
19764
|
+
switch (status) {
|
|
19765
|
+
case "configured":
|
|
19766
|
+
return "Configured";
|
|
19767
|
+
case "missing":
|
|
19768
|
+
return "Setup required";
|
|
19769
|
+
case "unsupported":
|
|
19770
|
+
return "Unavailable";
|
|
19771
|
+
case "error":
|
|
19772
|
+
return "Error";
|
|
19773
|
+
default: {
|
|
19774
|
+
const unhandled = status;
|
|
19775
|
+
return unhandled;
|
|
19776
|
+
}
|
|
19777
|
+
}
|
|
19778
|
+
}
|
|
19779
|
+
function statusColor(status) {
|
|
19780
|
+
switch (status) {
|
|
19781
|
+
case "configured":
|
|
19782
|
+
return theme.status.success;
|
|
19783
|
+
case "missing":
|
|
19784
|
+
case "unsupported":
|
|
19785
|
+
return theme.status.warning;
|
|
19786
|
+
case "error":
|
|
19787
|
+
return theme.status.error;
|
|
19788
|
+
default: {
|
|
19789
|
+
const unhandled = status;
|
|
19790
|
+
return unhandled;
|
|
19791
|
+
}
|
|
19792
|
+
}
|
|
19793
|
+
}
|
|
19794
|
+
function matchesProvider(view, query) {
|
|
19795
|
+
const normalized = query.toLocaleLowerCase();
|
|
19796
|
+
return view.provider.toLocaleLowerCase() === normalized || view.displayName.toLocaleLowerCase() === normalized;
|
|
19797
|
+
}
|
|
19798
|
+
function ProviderDialog({
|
|
19799
|
+
runtime,
|
|
19800
|
+
initialProvider,
|
|
19801
|
+
onClose
|
|
19802
|
+
}) {
|
|
19803
|
+
const [providers, setProviders] = useState37([]);
|
|
19804
|
+
const [highlighted, setHighlighted] = useState37();
|
|
19805
|
+
const [editing, setEditing] = useState37();
|
|
19806
|
+
const [loading, setLoading] = useState37(true);
|
|
19807
|
+
const [error, setError] = useState37();
|
|
19808
|
+
useEffect40(() => {
|
|
19809
|
+
const controller = new AbortController();
|
|
19810
|
+
void runtime.listProviders(controller.signal).then((available) => {
|
|
19811
|
+
if (controller.signal.aborted) return;
|
|
19812
|
+
setProviders(available);
|
|
19813
|
+
const requested = initialProvider ? available.find(
|
|
19814
|
+
(provider) => matchesProvider(provider, initialProvider)
|
|
19815
|
+
) : void 0;
|
|
19816
|
+
setHighlighted(requested ?? available[0]);
|
|
19817
|
+
if (initialProvider && !requested) {
|
|
19818
|
+
setError(`Unknown DSH provider: ${initialProvider}`);
|
|
19819
|
+
}
|
|
19820
|
+
}).catch((cause) => {
|
|
19821
|
+
if (!controller.signal.aborted) {
|
|
19822
|
+
setError(
|
|
19823
|
+
cause instanceof Error ? cause.message : "Unable to load DSH providers."
|
|
19824
|
+
);
|
|
19825
|
+
}
|
|
19826
|
+
}).finally(() => {
|
|
19827
|
+
if (!controller.signal.aborted) setLoading(false);
|
|
19828
|
+
});
|
|
19829
|
+
return () => controller.abort();
|
|
19830
|
+
}, [initialProvider, runtime]);
|
|
19831
|
+
useKeypress(
|
|
19832
|
+
(key) => {
|
|
19833
|
+
if (key.name === "escape") onClose();
|
|
19834
|
+
},
|
|
19835
|
+
{ isActive: editing === void 0 }
|
|
19836
|
+
);
|
|
19837
|
+
const items = useMemo29(
|
|
19838
|
+
() => providers.map((provider) => ({
|
|
19839
|
+
key: provider.provider,
|
|
19840
|
+
label: provider.displayName,
|
|
19841
|
+
value: provider
|
|
19842
|
+
})),
|
|
19843
|
+
[providers]
|
|
19844
|
+
);
|
|
19845
|
+
const initialIndex = Math.max(
|
|
19846
|
+
0,
|
|
19847
|
+
providers.findIndex(
|
|
19848
|
+
(provider) => provider.provider === highlighted?.provider
|
|
19849
|
+
)
|
|
19850
|
+
);
|
|
19851
|
+
const currentProvider = runtime.getSnapshot().current.provider;
|
|
19852
|
+
if (editing) {
|
|
19853
|
+
return /* @__PURE__ */ jsx89(
|
|
19854
|
+
ProviderSetupDialog,
|
|
19855
|
+
{
|
|
19856
|
+
runtime,
|
|
19857
|
+
provider: editing.provider,
|
|
19858
|
+
onCancel: () => setEditing(void 0),
|
|
19859
|
+
onConfigured: (configured) => {
|
|
19860
|
+
setProviders(
|
|
19861
|
+
(current) => current.map(
|
|
19862
|
+
(provider) => provider.provider === configured.provider ? configured : provider
|
|
19863
|
+
)
|
|
19864
|
+
);
|
|
19865
|
+
setHighlighted(configured);
|
|
19866
|
+
setEditing(void 0);
|
|
19867
|
+
}
|
|
19868
|
+
}
|
|
19869
|
+
);
|
|
19870
|
+
}
|
|
19871
|
+
return /* @__PURE__ */ jsxs67(
|
|
19872
|
+
Box69,
|
|
19873
|
+
{
|
|
19874
|
+
borderStyle: "round",
|
|
19875
|
+
borderColor: theme.border.default,
|
|
19876
|
+
flexDirection: "column",
|
|
19877
|
+
paddingX: 1,
|
|
19878
|
+
paddingY: 1,
|
|
19879
|
+
width: "100%",
|
|
19880
|
+
children: [
|
|
19881
|
+
/* @__PURE__ */ jsxs67(Box69, { justifyContent: "space-between", children: [
|
|
19882
|
+
/* @__PURE__ */ jsx89(Text62, { bold: true, color: theme.text.accent, children: "DSH Providers" }),
|
|
19883
|
+
/* @__PURE__ */ jsxs67(Text62, { color: theme.text.secondary, children: [
|
|
19884
|
+
/* @__PURE__ */ jsx89(Text62, { bold: true, color: theme.text.primary, children: "Esc" }),
|
|
19885
|
+
" Close"
|
|
19886
|
+
] })
|
|
19887
|
+
] }),
|
|
19888
|
+
error && /* @__PURE__ */ jsx89(Box69, { marginTop: 1, children: /* @__PURE__ */ jsx89(Text62, { color: theme.status.error, children: error }) }),
|
|
19889
|
+
loading && /* @__PURE__ */ jsx89(Box69, { marginTop: 1, children: /* @__PURE__ */ jsx89(Text62, { color: theme.text.secondary, children: "Loading providers..." }) }),
|
|
19890
|
+
!loading && providers.length === 0 && /* @__PURE__ */ jsx89(Box69, { marginTop: 1, children: /* @__PURE__ */ jsx89(Text62, { color: theme.status.warning, children: "No DSH-managed providers are available." }) }),
|
|
19891
|
+
providers.length > 0 && highlighted && /* @__PURE__ */ jsxs67(Box69, { marginTop: 1, children: [
|
|
19892
|
+
/* @__PURE__ */ jsx89(Box69, { width: "55%", paddingRight: 2, children: /* @__PURE__ */ jsx89(
|
|
19893
|
+
RadioButtonSelect,
|
|
19894
|
+
{
|
|
19895
|
+
items,
|
|
19896
|
+
initialIndex,
|
|
19897
|
+
onHighlight: setHighlighted,
|
|
19898
|
+
onSelect: (provider) => {
|
|
19899
|
+
if (provider.writable && provider.status !== "unsupported") {
|
|
19900
|
+
setEditing(provider);
|
|
19901
|
+
}
|
|
19902
|
+
},
|
|
19903
|
+
showScrollArrows: true,
|
|
19904
|
+
maxItemsToShow: 12,
|
|
19905
|
+
renderItem: (item, { titleColor }) => /* @__PURE__ */ jsxs67(Text62, { color: titleColor, wrap: "truncate", children: [
|
|
19906
|
+
item.value.displayName,
|
|
19907
|
+
" ",
|
|
19908
|
+
/* @__PURE__ */ jsx89(Text62, { color: statusColor(item.value.status), children: statusLabel(item.value.status) }),
|
|
19909
|
+
item.value.provider === currentProvider && /* @__PURE__ */ jsx89(Text62, { color: theme.text.accent, children: " Current" })
|
|
19910
|
+
] })
|
|
19911
|
+
}
|
|
19912
|
+
) }),
|
|
19913
|
+
/* @__PURE__ */ jsxs67(Box69, { width: "45%", paddingLeft: 2, flexDirection: "column", children: [
|
|
19914
|
+
/* @__PURE__ */ jsx89(Text62, { bold: true, color: theme.text.primary, children: highlighted.displayName }),
|
|
19915
|
+
/* @__PURE__ */ jsxs67(Box69, { marginTop: 1, flexDirection: "column", children: [
|
|
19916
|
+
/* @__PURE__ */ jsx89(Text62, { color: theme.text.secondary, children: "Provider" }),
|
|
19917
|
+
/* @__PURE__ */ jsx89(Text62, { children: highlighted.provider }),
|
|
19918
|
+
/* @__PURE__ */ jsx89(Text62, { color: theme.text.secondary, children: "Status" }),
|
|
19919
|
+
/* @__PURE__ */ jsx89(Text62, { color: statusColor(highlighted.status), children: statusLabel(highlighted.status) }),
|
|
19920
|
+
highlighted.credentialLabel && /* @__PURE__ */ jsxs67(Fragment16, { children: [
|
|
19921
|
+
/* @__PURE__ */ jsx89(Text62, { color: theme.text.secondary, children: "Credential" }),
|
|
19922
|
+
/* @__PURE__ */ jsx89(Text62, { children: highlighted.credentialLabel })
|
|
19923
|
+
] }),
|
|
19924
|
+
highlighted.source && /* @__PURE__ */ jsxs67(Fragment16, { children: [
|
|
19925
|
+
/* @__PURE__ */ jsx89(Text62, { color: theme.text.secondary, children: "Source" }),
|
|
19926
|
+
/* @__PURE__ */ jsx89(Text62, { children: highlighted.source })
|
|
19927
|
+
] }),
|
|
19928
|
+
highlighted.message && /* @__PURE__ */ jsx89(Box69, { marginTop: 1, children: /* @__PURE__ */ jsx89(Text62, { color: theme.status.warning, children: highlighted.message }) }),
|
|
19929
|
+
!highlighted.writable && highlighted.status !== "unsupported" && highlighted.status !== "error" && /* @__PURE__ */ jsx89(Box69, { marginTop: 1, children: /* @__PURE__ */ jsx89(Text62, { color: theme.status.warning, children: "This credential comes from a read-only source. Update it outside DSH Console." }) })
|
|
19930
|
+
] })
|
|
19931
|
+
] })
|
|
19932
|
+
] }),
|
|
19933
|
+
providers.length > 0 && highlighted && /* @__PURE__ */ jsx89(Box69, { marginTop: 1, children: highlighted.writable && highlighted.status !== "unsupported" ? /* @__PURE__ */ jsxs67(Fragment16, { children: [
|
|
19934
|
+
/* @__PURE__ */ jsx89(Text62, { bold: true, color: theme.text.accent, children: "Enter" }),
|
|
19935
|
+
/* @__PURE__ */ jsxs67(Text62, { color: theme.text.primary, children: [
|
|
19936
|
+
" ",
|
|
19937
|
+
highlighted.status === "configured" ? "Replace credential" : "Configure provider"
|
|
19938
|
+
] }),
|
|
19939
|
+
/* @__PURE__ */ jsxs67(Text62, { color: theme.text.secondary, children: [
|
|
19940
|
+
" ",
|
|
19941
|
+
"Use \u2191/\u2193 to navigate"
|
|
19942
|
+
] })
|
|
19943
|
+
] }) : /* @__PURE__ */ jsx89(Text62, { color: theme.text.secondary, children: "Use \u2191/\u2193 to inspect providers. This credential cannot be changed here." }) })
|
|
19944
|
+
]
|
|
19945
|
+
}
|
|
19946
|
+
);
|
|
19947
|
+
}
|
|
19948
|
+
|
|
19949
|
+
// src/ui/commands/provider-command.ts
|
|
19950
|
+
var providerCommand = {
|
|
19951
|
+
name: "provider",
|
|
19952
|
+
description: "View or update DSH provider credentials",
|
|
19953
|
+
inputHint: "[provider]",
|
|
19954
|
+
kind: "built-in" /* BUILT_IN */,
|
|
19955
|
+
autoExecute: true,
|
|
19956
|
+
action: (context, args) => {
|
|
19957
|
+
const runtime = context.services.providerSetup;
|
|
19958
|
+
if (!runtime) {
|
|
19959
|
+
return {
|
|
19960
|
+
type: "message",
|
|
19961
|
+
messageType: "error",
|
|
19962
|
+
content: "DSH provider setup is unavailable."
|
|
19963
|
+
};
|
|
19964
|
+
}
|
|
19965
|
+
const words = args.trim().split(/\s+/).filter(Boolean);
|
|
19966
|
+
if (words.length > 1) {
|
|
19967
|
+
return {
|
|
19968
|
+
type: "message",
|
|
19969
|
+
messageType: "error",
|
|
19970
|
+
content: "Usage: /provider [provider]"
|
|
19971
|
+
};
|
|
19972
|
+
}
|
|
19973
|
+
return {
|
|
19974
|
+
type: "custom_dialog",
|
|
19975
|
+
component: React17.createElement(ProviderDialog, {
|
|
19976
|
+
runtime,
|
|
19977
|
+
initialProvider: words[0],
|
|
19978
|
+
onClose: context.ui.removeComponent
|
|
19979
|
+
})
|
|
19980
|
+
};
|
|
19981
|
+
},
|
|
19982
|
+
completion: async (context, partialArg) => {
|
|
19983
|
+
const runtime = context.services.providerSetup;
|
|
19984
|
+
if (!runtime) return [];
|
|
19985
|
+
const providers = await runtime.listProviders();
|
|
19986
|
+
const prefix = partialArg.trimStart().toLocaleLowerCase();
|
|
19987
|
+
return providers.map((provider) => provider.provider).filter((provider) => provider.toLocaleLowerCase().startsWith(prefix));
|
|
19988
|
+
}
|
|
19989
|
+
};
|
|
19990
|
+
|
|
19991
|
+
// src/ui/commands/session-commands.ts
|
|
19992
|
+
import React18 from "react";
|
|
19993
|
+
|
|
19394
19994
|
// src/ui/components/dialogs/session-dialog.tsx
|
|
19395
|
-
import { useCallback as useCallback33, useEffect as
|
|
19396
|
-
import { Box as
|
|
19397
|
-
import { Fragment as
|
|
19995
|
+
import { useCallback as useCallback33, useEffect as useEffect41, useMemo as useMemo30, useRef as useRef20, useState as useState38 } from "react";
|
|
19996
|
+
import { Box as Box70, Text as Text63 } from "ink";
|
|
19997
|
+
import { Fragment as Fragment17, jsx as jsx90, jsxs as jsxs68 } from "react/jsx-runtime";
|
|
19398
19998
|
function shortId(id) {
|
|
19399
19999
|
const start2 = id.startsWith("dsh-console-") ? "dsh-console-".length : 0;
|
|
19400
20000
|
return id.slice(start2, start2 + 12);
|
|
@@ -19403,14 +20003,14 @@ function sessionLabel(session) {
|
|
|
19403
20003
|
return session.title ?? `Session ${shortId(session.id)}`;
|
|
19404
20004
|
}
|
|
19405
20005
|
function SessionDialog({ runtime, onClose }) {
|
|
19406
|
-
const [sessions, setSessions] =
|
|
19407
|
-
const [highlighted, setHighlighted] =
|
|
19408
|
-
const [pending, setPending] =
|
|
19409
|
-
const [loading, setLoading] =
|
|
19410
|
-
const [switching, setSwitching] =
|
|
19411
|
-
const [error, setError] =
|
|
19412
|
-
const switchingRef =
|
|
19413
|
-
|
|
20006
|
+
const [sessions, setSessions] = useState38([]);
|
|
20007
|
+
const [highlighted, setHighlighted] = useState38();
|
|
20008
|
+
const [pending, setPending] = useState38();
|
|
20009
|
+
const [loading, setLoading] = useState38(true);
|
|
20010
|
+
const [switching, setSwitching] = useState38(false);
|
|
20011
|
+
const [error, setError] = useState38();
|
|
20012
|
+
const switchingRef = useRef20(false);
|
|
20013
|
+
useEffect41(() => {
|
|
19414
20014
|
const controller = new AbortController();
|
|
19415
20015
|
void runtime.listSessions(controller.signal).then((listed) => {
|
|
19416
20016
|
setSessions(listed);
|
|
@@ -19422,7 +20022,7 @@ function SessionDialog({ runtime, onClose }) {
|
|
|
19422
20022
|
});
|
|
19423
20023
|
return () => controller.abort();
|
|
19424
20024
|
}, [runtime]);
|
|
19425
|
-
const items =
|
|
20025
|
+
const items = useMemo30(() => sessions.map((session) => ({
|
|
19426
20026
|
key: session.id,
|
|
19427
20027
|
value: session,
|
|
19428
20028
|
label: sessionLabel(session)
|
|
@@ -19461,14 +20061,14 @@ function SessionDialog({ runtime, onClose }) {
|
|
|
19461
20061
|
if (pending) setPending(void 0);
|
|
19462
20062
|
else onClose();
|
|
19463
20063
|
}, { isActive: true });
|
|
19464
|
-
return /* @__PURE__ */
|
|
19465
|
-
/* @__PURE__ */
|
|
19466
|
-
/* @__PURE__ */
|
|
19467
|
-
/* @__PURE__ */
|
|
20064
|
+
return /* @__PURE__ */ jsxs68(Box70, { borderStyle: "round", borderColor: theme.border.default, flexDirection: "column", paddingX: 1, paddingY: 1, width: "100%", children: [
|
|
20065
|
+
/* @__PURE__ */ jsxs68(Box70, { justifyContent: "space-between", children: [
|
|
20066
|
+
/* @__PURE__ */ jsx90(Text63, { bold: true, color: theme.text.primary, children: "DSH Sessions" }),
|
|
20067
|
+
/* @__PURE__ */ jsx90(Text63, { color: theme.text.secondary, children: "Esc to close" })
|
|
19468
20068
|
] }),
|
|
19469
|
-
error && /* @__PURE__ */
|
|
19470
|
-
loading ? /* @__PURE__ */
|
|
19471
|
-
/* @__PURE__ */
|
|
20069
|
+
error && /* @__PURE__ */ jsx90(Box70, { marginTop: 1, children: /* @__PURE__ */ jsx90(Text63, { color: theme.status.error, children: error }) }),
|
|
20070
|
+
loading ? /* @__PURE__ */ jsx90(Box70, { marginTop: 1, children: /* @__PURE__ */ jsx90(Text63, { color: theme.text.secondary, children: "Loading Sessions..." }) }) : sessions.length === 0 ? /* @__PURE__ */ jsx90(Box70, { marginTop: 1, children: /* @__PURE__ */ jsx90(Text63, { color: theme.text.secondary, children: "No resumable Sessions." }) }) : /* @__PURE__ */ jsxs68(Box70, { flexDirection: "row", marginTop: 1, children: [
|
|
20071
|
+
/* @__PURE__ */ jsx90(Box70, { width: "55%", paddingRight: 2, flexDirection: "column", children: /* @__PURE__ */ jsx90(
|
|
19472
20072
|
RadioButtonSelect,
|
|
19473
20073
|
{
|
|
19474
20074
|
items,
|
|
@@ -19478,20 +20078,20 @@ function SessionDialog({ runtime, onClose }) {
|
|
|
19478
20078
|
isFocused: !pending && !switching,
|
|
19479
20079
|
showScrollArrows: true,
|
|
19480
20080
|
maxItemsToShow: 12,
|
|
19481
|
-
renderItem: (item, { titleColor }) => /* @__PURE__ */
|
|
20081
|
+
renderItem: (item, { titleColor }) => /* @__PURE__ */ jsxs68(Text63, { color: titleColor, wrap: "truncate", children: [
|
|
19482
20082
|
sessionLabel(item.value),
|
|
19483
|
-
item.value.current && /* @__PURE__ */
|
|
19484
|
-
!item.value.current && !item.value.resumable && /* @__PURE__ */
|
|
20083
|
+
item.value.current && /* @__PURE__ */ jsx90(Text63, { color: theme.text.accent, children: " Current" }),
|
|
20084
|
+
!item.value.current && !item.value.resumable && /* @__PURE__ */ jsx90(Text63, { color: theme.status.warning, children: " Not resumable" })
|
|
19485
20085
|
] })
|
|
19486
20086
|
}
|
|
19487
20087
|
) }),
|
|
19488
|
-
/* @__PURE__ */
|
|
19489
|
-
/* @__PURE__ */
|
|
19490
|
-
/* @__PURE__ */
|
|
19491
|
-
/* @__PURE__ */
|
|
19492
|
-
/* @__PURE__ */
|
|
20088
|
+
/* @__PURE__ */ jsx90(Box70, { width: "45%", paddingLeft: 2, flexDirection: "column", children: pending ? /* @__PURE__ */ jsxs68(Fragment17, { children: [
|
|
20089
|
+
/* @__PURE__ */ jsx90(Text63, { bold: true, color: theme.status.warning, children: "Resume this Session?" }),
|
|
20090
|
+
/* @__PURE__ */ jsxs68(Box70, { marginTop: 1, flexDirection: "column", children: [
|
|
20091
|
+
/* @__PURE__ */ jsx90(Text63, { children: sessionLabel(pending) }),
|
|
20092
|
+
/* @__PURE__ */ jsx90(Text63, { color: theme.text.secondary, children: "The current transcript will be replaced." })
|
|
19493
20093
|
] }),
|
|
19494
|
-
/* @__PURE__ */
|
|
20094
|
+
/* @__PURE__ */ jsx90(Box70, { marginTop: 1, children: /* @__PURE__ */ jsx90(
|
|
19495
20095
|
RadioButtonSelect,
|
|
19496
20096
|
{
|
|
19497
20097
|
items: [
|
|
@@ -19503,21 +20103,21 @@ function SessionDialog({ runtime, onClose }) {
|
|
|
19503
20103
|
showNumbers: false
|
|
19504
20104
|
}
|
|
19505
20105
|
) })
|
|
19506
|
-
] }) : highlighted ? /* @__PURE__ */
|
|
19507
|
-
/* @__PURE__ */
|
|
19508
|
-
/* @__PURE__ */
|
|
19509
|
-
/* @__PURE__ */
|
|
19510
|
-
/* @__PURE__ */
|
|
19511
|
-
!highlighted.resumable && highlighted.resumeUnavailableReason && /* @__PURE__ */
|
|
19512
|
-
/* @__PURE__ */
|
|
19513
|
-
/* @__PURE__ */
|
|
20106
|
+
] }) : highlighted ? /* @__PURE__ */ jsxs68(Fragment17, { children: [
|
|
20107
|
+
/* @__PURE__ */ jsx90(Text63, { bold: true, children: sessionLabel(highlighted) }),
|
|
20108
|
+
/* @__PURE__ */ jsxs68(Box70, { marginTop: 1, flexDirection: "column", children: [
|
|
20109
|
+
/* @__PURE__ */ jsx90(Text63, { color: theme.text.secondary, children: "Created" }),
|
|
20110
|
+
/* @__PURE__ */ jsx90(Text63, { children: new Date(highlighted.createdAt).toLocaleString() }),
|
|
20111
|
+
!highlighted.resumable && highlighted.resumeUnavailableReason && /* @__PURE__ */ jsxs68(Fragment17, { children: [
|
|
20112
|
+
/* @__PURE__ */ jsx90(Text63, { color: theme.text.secondary, children: "Resume status" }),
|
|
20113
|
+
/* @__PURE__ */ jsx90(Text63, { color: theme.status.warning, children: highlighted.resumeUnavailableReason })
|
|
19514
20114
|
] }),
|
|
19515
|
-
/* @__PURE__ */
|
|
19516
|
-
/* @__PURE__ */
|
|
20115
|
+
/* @__PURE__ */ jsx90(Text63, { color: theme.text.secondary, children: "Session ID" }),
|
|
20116
|
+
/* @__PURE__ */ jsx90(Text63, { wrap: "wrap", children: highlighted.id })
|
|
19517
20117
|
] })
|
|
19518
20118
|
] }) : null })
|
|
19519
20119
|
] }),
|
|
19520
|
-
/* @__PURE__ */
|
|
20120
|
+
/* @__PURE__ */ jsx90(Box70, { marginTop: 1, children: /* @__PURE__ */ jsx90(Text63, { color: theme.text.secondary, children: "Use \u2191/\u2193 to navigate and Enter to resume." }) })
|
|
19521
20121
|
] });
|
|
19522
20122
|
}
|
|
19523
20123
|
|
|
@@ -19530,7 +20130,7 @@ function openDialog(context) {
|
|
|
19530
20130
|
if (!runtime) return unavailable();
|
|
19531
20131
|
return {
|
|
19532
20132
|
type: "custom_dialog",
|
|
19533
|
-
component:
|
|
20133
|
+
component: React18.createElement(SessionDialog, {
|
|
19534
20134
|
runtime,
|
|
19535
20135
|
onClose: context.ui.removeComponent
|
|
19536
20136
|
})
|
|
@@ -19605,15 +20205,15 @@ var statsCommand = {
|
|
|
19605
20205
|
};
|
|
19606
20206
|
|
|
19607
20207
|
// src/ui/commands/tools-command.ts
|
|
19608
|
-
import
|
|
20208
|
+
import React19 from "react";
|
|
19609
20209
|
|
|
19610
20210
|
// src/ui/components/dialogs/tools-dialog.tsx
|
|
19611
|
-
import { useEffect as
|
|
19612
|
-
import { Box as
|
|
20211
|
+
import { useEffect as useEffect42, useMemo as useMemo31, useState as useState39, useSyncExternalStore as useSyncExternalStore3 } from "react";
|
|
20212
|
+
import { Box as Box72, Text as Text65 } from "ink";
|
|
19613
20213
|
|
|
19614
20214
|
// src/ui/components/shared/descriptive-radio-button-select.tsx
|
|
19615
|
-
import { Text as
|
|
19616
|
-
import { jsx as
|
|
20215
|
+
import { Text as Text64, Box as Box71 } from "ink";
|
|
20216
|
+
import { jsx as jsx91, jsxs as jsxs69 } from "react/jsx-runtime";
|
|
19617
20217
|
function DescriptiveRadioButtonSelect({
|
|
19618
20218
|
items,
|
|
19619
20219
|
initialIndex = 0,
|
|
@@ -19624,7 +20224,7 @@ function DescriptiveRadioButtonSelect({
|
|
|
19624
20224
|
showScrollArrows = false,
|
|
19625
20225
|
maxItemsToShow = 10
|
|
19626
20226
|
}) {
|
|
19627
|
-
return /* @__PURE__ */
|
|
20227
|
+
return /* @__PURE__ */ jsx91(
|
|
19628
20228
|
BaseSelectionList,
|
|
19629
20229
|
{
|
|
19630
20230
|
items,
|
|
@@ -19635,16 +20235,16 @@ function DescriptiveRadioButtonSelect({
|
|
|
19635
20235
|
showNumbers,
|
|
19636
20236
|
showScrollArrows,
|
|
19637
20237
|
maxItemsToShow,
|
|
19638
|
-
renderItem: (item, { titleColor }) => /* @__PURE__ */
|
|
19639
|
-
/* @__PURE__ */
|
|
19640
|
-
item.description && /* @__PURE__ */
|
|
20238
|
+
renderItem: (item, { titleColor }) => /* @__PURE__ */ jsxs69(Box71, { flexDirection: "column", children: [
|
|
20239
|
+
/* @__PURE__ */ jsx91(Text64, { color: titleColor, children: item.title }),
|
|
20240
|
+
item.description && /* @__PURE__ */ jsx91(Text64, { color: theme.text.secondary, children: item.description })
|
|
19641
20241
|
] }, item.key)
|
|
19642
20242
|
}
|
|
19643
20243
|
);
|
|
19644
20244
|
}
|
|
19645
20245
|
|
|
19646
20246
|
// src/ui/components/dialogs/tools-dialog.tsx
|
|
19647
|
-
import { Fragment as
|
|
20247
|
+
import { Fragment as Fragment18, jsx as jsx92, jsxs as jsxs70 } from "react/jsx-runtime";
|
|
19648
20248
|
function summary(description) {
|
|
19649
20249
|
const line = description.replace(/\s+/g, " ").trim();
|
|
19650
20250
|
return line.length > 90 ? `${line.slice(0, 89)}...` : line;
|
|
@@ -19655,9 +20255,9 @@ function ToolsDialog({ runtime, onClose }) {
|
|
|
19655
20255
|
runtime.getSnapshot,
|
|
19656
20256
|
runtime.getSnapshot
|
|
19657
20257
|
);
|
|
19658
|
-
const [selectedName, setSelectedName] =
|
|
20258
|
+
const [selectedName, setSelectedName] = useState39(snapshot.tools[0]?.name);
|
|
19659
20259
|
const selected = snapshot.tools.find((tool) => tool.name === selectedName) ?? snapshot.tools[0];
|
|
19660
|
-
|
|
20260
|
+
useEffect42(() => {
|
|
19661
20261
|
if (selected?.name !== selectedName) setSelectedName(selected?.name);
|
|
19662
20262
|
}, [selected?.name, selectedName]);
|
|
19663
20263
|
useKeypress(
|
|
@@ -19666,7 +20266,7 @@ function ToolsDialog({ runtime, onClose }) {
|
|
|
19666
20266
|
},
|
|
19667
20267
|
{ isActive: true }
|
|
19668
20268
|
);
|
|
19669
|
-
const items =
|
|
20269
|
+
const items = useMemo31(
|
|
19670
20270
|
() => snapshot.tools.map((tool) => ({
|
|
19671
20271
|
key: tool.name,
|
|
19672
20272
|
value: tool.name,
|
|
@@ -19675,8 +20275,8 @@ function ToolsDialog({ runtime, onClose }) {
|
|
|
19675
20275
|
})),
|
|
19676
20276
|
[snapshot.tools]
|
|
19677
20277
|
);
|
|
19678
|
-
return /* @__PURE__ */
|
|
19679
|
-
|
|
20278
|
+
return /* @__PURE__ */ jsxs70(
|
|
20279
|
+
Box72,
|
|
19680
20280
|
{
|
|
19681
20281
|
borderStyle: "round",
|
|
19682
20282
|
borderColor: theme.border.default,
|
|
@@ -19685,16 +20285,16 @@ function ToolsDialog({ runtime, onClose }) {
|
|
|
19685
20285
|
paddingY: 1,
|
|
19686
20286
|
width: "100%",
|
|
19687
20287
|
children: [
|
|
19688
|
-
/* @__PURE__ */
|
|
19689
|
-
/* @__PURE__ */
|
|
20288
|
+
/* @__PURE__ */ jsxs70(Box72, { justifyContent: "space-between", children: [
|
|
20289
|
+
/* @__PURE__ */ jsxs70(Text65, { bold: true, color: theme.text.primary, children: [
|
|
19690
20290
|
"DSH Tools (",
|
|
19691
20291
|
snapshot.tools.length,
|
|
19692
20292
|
")"
|
|
19693
20293
|
] }),
|
|
19694
|
-
/* @__PURE__ */
|
|
20294
|
+
/* @__PURE__ */ jsx92(Text65, { color: theme.text.secondary, children: "Esc to close" })
|
|
19695
20295
|
] }),
|
|
19696
|
-
snapshot.tools.length === 0 ? /* @__PURE__ */
|
|
19697
|
-
/* @__PURE__ */
|
|
20296
|
+
snapshot.tools.length === 0 ? /* @__PURE__ */ jsx92(Box72, { marginTop: 1, children: /* @__PURE__ */ jsx92(Text65, { color: theme.text.secondary, children: "No tools are visible to the current Agent." }) }) : /* @__PURE__ */ jsxs70(Box72, { flexDirection: "row", marginTop: 1, children: [
|
|
20297
|
+
/* @__PURE__ */ jsx92(Box72, { width: "55%", paddingRight: 2, flexDirection: "column", children: /* @__PURE__ */ jsx92(
|
|
19698
20298
|
DescriptiveRadioButtonSelect,
|
|
19699
20299
|
{
|
|
19700
20300
|
items,
|
|
@@ -19705,26 +20305,26 @@ function ToolsDialog({ runtime, onClose }) {
|
|
|
19705
20305
|
maxItemsToShow: 10
|
|
19706
20306
|
}
|
|
19707
20307
|
) }),
|
|
19708
|
-
/* @__PURE__ */
|
|
19709
|
-
/* @__PURE__ */
|
|
19710
|
-
/* @__PURE__ */
|
|
19711
|
-
/* @__PURE__ */
|
|
19712
|
-
/* @__PURE__ */
|
|
19713
|
-
selected.parameters.length === 0 ? /* @__PURE__ */
|
|
19714
|
-
/* @__PURE__ */
|
|
20308
|
+
/* @__PURE__ */ jsx92(Box72, { width: "45%", paddingLeft: 2, flexDirection: "column", children: selected && /* @__PURE__ */ jsxs70(Fragment18, { children: [
|
|
20309
|
+
/* @__PURE__ */ jsx92(Text65, { bold: true, color: theme.text.accent, children: selected.name }),
|
|
20310
|
+
/* @__PURE__ */ jsx92(Box72, { marginTop: 1, children: /* @__PURE__ */ jsx92(Text65, { wrap: "wrap", children: selected.description }) }),
|
|
20311
|
+
/* @__PURE__ */ jsxs70(Box72, { marginTop: 1, flexDirection: "column", children: [
|
|
20312
|
+
/* @__PURE__ */ jsx92(Text65, { bold: true, color: theme.text.primary, children: "Parameters" }),
|
|
20313
|
+
selected.parameters.length === 0 ? /* @__PURE__ */ jsx92(Text65, { color: theme.text.secondary, children: "None" }) : selected.parameters.map((parameter) => /* @__PURE__ */ jsxs70(Box72, { flexDirection: "column", children: [
|
|
20314
|
+
/* @__PURE__ */ jsxs70(Text65, { color: theme.text.link, children: [
|
|
19715
20315
|
parameter.name,
|
|
19716
20316
|
" ",
|
|
19717
|
-
/* @__PURE__ */
|
|
20317
|
+
/* @__PURE__ */ jsxs70(Text65, { color: theme.text.secondary, children: [
|
|
19718
20318
|
parameter.type,
|
|
19719
20319
|
parameter.required ? " required" : " optional"
|
|
19720
20320
|
] })
|
|
19721
20321
|
] }),
|
|
19722
|
-
parameter.description && /* @__PURE__ */
|
|
20322
|
+
parameter.description && /* @__PURE__ */ jsx92(Text65, { color: theme.text.secondary, children: parameter.description })
|
|
19723
20323
|
] }, parameter.name))
|
|
19724
20324
|
] })
|
|
19725
20325
|
] }) })
|
|
19726
20326
|
] }),
|
|
19727
|
-
snapshot.tools.length > 0 && /* @__PURE__ */
|
|
20327
|
+
snapshot.tools.length > 0 && /* @__PURE__ */ jsx92(Box72, { marginTop: 1, children: /* @__PURE__ */ jsx92(Text65, { color: theme.text.secondary, children: "Use Up/Down to inspect the current Agent's tool catalog." }) })
|
|
19728
20328
|
]
|
|
19729
20329
|
}
|
|
19730
20330
|
);
|
|
@@ -19754,7 +20354,7 @@ var toolsCommand = {
|
|
|
19754
20354
|
}
|
|
19755
20355
|
return {
|
|
19756
20356
|
type: "custom_dialog",
|
|
19757
|
-
component:
|
|
20357
|
+
component: React19.createElement(ToolsDialog, {
|
|
19758
20358
|
runtime,
|
|
19759
20359
|
onClose: context.ui.removeComponent
|
|
19760
20360
|
})
|
|
@@ -19763,12 +20363,12 @@ var toolsCommand = {
|
|
|
19763
20363
|
};
|
|
19764
20364
|
|
|
19765
20365
|
// src/ui/commands/permission-command.ts
|
|
19766
|
-
import
|
|
20366
|
+
import React20 from "react";
|
|
19767
20367
|
|
|
19768
20368
|
// src/ui/components/dialogs/permission-dialog.tsx
|
|
19769
|
-
import { useCallback as useCallback34, useMemo as
|
|
19770
|
-
import { Box as
|
|
19771
|
-
import { Fragment as
|
|
20369
|
+
import { useCallback as useCallback34, useMemo as useMemo32, useState as useState40, useSyncExternalStore as useSyncExternalStore4 } from "react";
|
|
20370
|
+
import { Box as Box73, Text as Text66 } from "ink";
|
|
20371
|
+
import { Fragment as Fragment19, jsx as jsx93, jsxs as jsxs71 } from "react/jsx-runtime";
|
|
19772
20372
|
function PermissionDialog({
|
|
19773
20373
|
runtime,
|
|
19774
20374
|
onClose,
|
|
@@ -19779,11 +20379,11 @@ function PermissionDialog({
|
|
|
19779
20379
|
runtime.getSnapshot,
|
|
19780
20380
|
runtime.getSnapshot
|
|
19781
20381
|
);
|
|
19782
|
-
const [highlighted, setHighlighted] =
|
|
19783
|
-
const [pending, setPending] =
|
|
19784
|
-
const [error, setError] =
|
|
20382
|
+
const [highlighted, setHighlighted] = useState40();
|
|
20383
|
+
const [pending, setPending] = useState40();
|
|
20384
|
+
const [error, setError] = useState40();
|
|
19785
20385
|
const selected = highlighted ?? snapshot.options.find((option) => option.value === snapshot.currentValue) ?? snapshot.options[0];
|
|
19786
|
-
const items =
|
|
20386
|
+
const items = useMemo32(
|
|
19787
20387
|
() => snapshot.options.map((option) => ({
|
|
19788
20388
|
key: option.value,
|
|
19789
20389
|
value: option,
|
|
@@ -19830,8 +20430,8 @@ function PermissionDialog({
|
|
|
19830
20430
|
},
|
|
19831
20431
|
{ isActive: true }
|
|
19832
20432
|
);
|
|
19833
|
-
return /* @__PURE__ */
|
|
19834
|
-
|
|
20433
|
+
return /* @__PURE__ */ jsxs71(
|
|
20434
|
+
Box73,
|
|
19835
20435
|
{
|
|
19836
20436
|
borderStyle: "round",
|
|
19837
20437
|
borderColor: theme.border.default,
|
|
@@ -19840,13 +20440,13 @@ function PermissionDialog({
|
|
|
19840
20440
|
paddingY: 1,
|
|
19841
20441
|
width: "100%",
|
|
19842
20442
|
children: [
|
|
19843
|
-
/* @__PURE__ */
|
|
19844
|
-
/* @__PURE__ */
|
|
19845
|
-
/* @__PURE__ */
|
|
20443
|
+
/* @__PURE__ */ jsxs71(Box73, { justifyContent: "space-between", children: [
|
|
20444
|
+
/* @__PURE__ */ jsx93(Text66, { bold: true, color: theme.text.primary, children: "Select DSH Permission" }),
|
|
20445
|
+
/* @__PURE__ */ jsx93(Text66, { color: theme.text.secondary, children: "Esc to close" })
|
|
19846
20446
|
] }),
|
|
19847
|
-
error && /* @__PURE__ */
|
|
19848
|
-
!snapshot.available ? /* @__PURE__ */
|
|
19849
|
-
/* @__PURE__ */
|
|
20447
|
+
error && /* @__PURE__ */ jsx93(Box73, { marginTop: 1, children: /* @__PURE__ */ jsx93(Text66, { color: theme.status.error, children: error }) }),
|
|
20448
|
+
!snapshot.available ? /* @__PURE__ */ jsx93(Box73, { marginTop: 1, children: /* @__PURE__ */ jsx93(Text66, { color: theme.status.warning, children: "DSH permission presets are unavailable." }) }) : snapshot.options.length === 0 ? /* @__PURE__ */ jsx93(Box73, { marginTop: 1, children: /* @__PURE__ */ jsx93(Text66, { color: theme.status.warning, children: "No permission presets are available." }) }) : /* @__PURE__ */ jsxs71(Box73, { flexDirection: "row", marginTop: 1, children: [
|
|
20449
|
+
/* @__PURE__ */ jsx93(Box73, { width: "50%", paddingRight: 2, flexDirection: "column", children: /* @__PURE__ */ jsx93(
|
|
19850
20450
|
RadioButtonSelect,
|
|
19851
20451
|
{
|
|
19852
20452
|
items,
|
|
@@ -19855,17 +20455,17 @@ function PermissionDialog({
|
|
|
19855
20455
|
onSelect: selectPermission,
|
|
19856
20456
|
isFocused: !pending && !snapshot.busy,
|
|
19857
20457
|
showNumbers: false,
|
|
19858
|
-
renderItem: (item, { titleColor }) => /* @__PURE__ */
|
|
20458
|
+
renderItem: (item, { titleColor }) => /* @__PURE__ */ jsxs71(Text66, { color: titleColor, wrap: "truncate", children: [
|
|
19859
20459
|
item.value.name,
|
|
19860
|
-
item.value.value === snapshot.currentValue && /* @__PURE__ */
|
|
20460
|
+
item.value.value === snapshot.currentValue && /* @__PURE__ */ jsx93(Text66, { color: theme.text.accent, children: " Current" })
|
|
19861
20461
|
] })
|
|
19862
20462
|
},
|
|
19863
20463
|
items.map((item) => item.key).join("|")
|
|
19864
20464
|
) }),
|
|
19865
|
-
/* @__PURE__ */
|
|
19866
|
-
/* @__PURE__ */
|
|
19867
|
-
/* @__PURE__ */
|
|
19868
|
-
/* @__PURE__ */
|
|
20465
|
+
/* @__PURE__ */ jsx93(Box73, { width: "50%", paddingLeft: 2, flexDirection: "column", children: pending ? /* @__PURE__ */ jsxs71(Fragment19, { children: [
|
|
20466
|
+
/* @__PURE__ */ jsx93(Text66, { bold: true, color: theme.status.warning, children: "Enable Full access?" }),
|
|
20467
|
+
/* @__PURE__ */ jsx93(Box73, { marginTop: 1, children: /* @__PURE__ */ jsx93(Text66, { children: "This allows commands to run without workspace sandbox restrictions or approval prompts." }) }),
|
|
20468
|
+
/* @__PURE__ */ jsx93(Box73, { marginTop: 1, children: /* @__PURE__ */ jsx93(
|
|
19869
20469
|
RadioButtonSelect,
|
|
19870
20470
|
{
|
|
19871
20471
|
items: [
|
|
@@ -19880,14 +20480,14 @@ function PermissionDialog({
|
|
|
19880
20480
|
showNumbers: false
|
|
19881
20481
|
}
|
|
19882
20482
|
) })
|
|
19883
|
-
] }) : selected ? /* @__PURE__ */
|
|
19884
|
-
/* @__PURE__ */
|
|
19885
|
-
/* @__PURE__ */
|
|
19886
|
-
/* @__PURE__ */
|
|
19887
|
-
snapshot.busy && /* @__PURE__ */
|
|
20483
|
+
] }) : selected ? /* @__PURE__ */ jsxs71(Fragment19, { children: [
|
|
20484
|
+
/* @__PURE__ */ jsx93(Text66, { bold: true, color: theme.text.primary, children: selected.name }),
|
|
20485
|
+
/* @__PURE__ */ jsx93(Text66, { color: theme.text.secondary, children: selected.value }),
|
|
20486
|
+
/* @__PURE__ */ jsx93(Box73, { marginTop: 1, children: /* @__PURE__ */ jsx93(Text66, { children: selected.description ?? "No description is available for this preset." }) }),
|
|
20487
|
+
snapshot.busy && /* @__PURE__ */ jsx93(Box73, { marginTop: 1, children: /* @__PURE__ */ jsx93(Text66, { color: theme.text.accent, children: "Applying permission..." }) })
|
|
19888
20488
|
] }) : null })
|
|
19889
20489
|
] }),
|
|
19890
|
-
/* @__PURE__ */
|
|
20490
|
+
/* @__PURE__ */ jsx93(Box73, { marginTop: 1, children: /* @__PURE__ */ jsx93(Text66, { color: theme.text.secondary, children: "Changes apply to the current DSH Session immediately. No restart required." }) })
|
|
19891
20491
|
]
|
|
19892
20492
|
}
|
|
19893
20493
|
);
|
|
@@ -19915,7 +20515,7 @@ var permissionCommand = {
|
|
|
19915
20515
|
if (value === "") {
|
|
19916
20516
|
return {
|
|
19917
20517
|
type: "custom_dialog",
|
|
19918
|
-
component:
|
|
20518
|
+
component: React20.createElement(PermissionDialog, {
|
|
19919
20519
|
runtime,
|
|
19920
20520
|
onClose: context.ui.removeComponent,
|
|
19921
20521
|
onSwitched: (selection) => {
|
|
@@ -20005,6 +20605,7 @@ var BuiltinCommandLoader = class {
|
|
|
20005
20605
|
vimCommand,
|
|
20006
20606
|
terminalSetupCommand,
|
|
20007
20607
|
modelCommand,
|
|
20608
|
+
providerCommand,
|
|
20008
20609
|
permissionCommand,
|
|
20009
20610
|
newCommand,
|
|
20010
20611
|
sessionsCommand,
|
|
@@ -20087,21 +20688,22 @@ var DshCommandLoader = class {
|
|
|
20087
20688
|
};
|
|
20088
20689
|
|
|
20089
20690
|
// src/ui/hooks/commands/use-slash-command-processor.ts
|
|
20090
|
-
var useSlashCommandProcessor = (addItem, clearItems, loadHistory, refreshStatic, toggleVimEnabled, setIsProcessing, actions, setCustomDialog, modelSelection, permissionSelection, sessionManagement, toolCatalog, dshCommands, enableProfiler = false) => {
|
|
20691
|
+
var useSlashCommandProcessor = (addItem, clearItems, loadHistory, refreshStatic, toggleVimEnabled, setIsProcessing, actions, setCustomDialog, modelSelection, permissionSelection, sessionManagement, toolCatalog, dshCommands, enableProfiler = false, providerSetup) => {
|
|
20091
20692
|
const session = useSessionStats();
|
|
20092
|
-
const [commands, setCommands] =
|
|
20693
|
+
const [commands, setCommands] = useState41(
|
|
20093
20694
|
void 0
|
|
20094
20695
|
);
|
|
20095
|
-
const [reloadTrigger, setReloadTrigger] =
|
|
20096
|
-
const commandAbortRef =
|
|
20696
|
+
const [reloadTrigger, setReloadTrigger] = useState41(0);
|
|
20697
|
+
const commandAbortRef = useRef21(void 0);
|
|
20097
20698
|
const reloadCommands = useCallback35(() => {
|
|
20098
20699
|
setReloadTrigger((v) => v + 1);
|
|
20099
20700
|
}, []);
|
|
20100
|
-
const [confirmationRequest, setConfirmationRequest] =
|
|
20101
|
-
const commandContext =
|
|
20701
|
+
const [confirmationRequest, setConfirmationRequest] = useState41(null);
|
|
20702
|
+
const commandContext = useMemo33(
|
|
20102
20703
|
() => ({
|
|
20103
20704
|
services: {
|
|
20104
20705
|
modelSelection,
|
|
20706
|
+
providerSetup,
|
|
20105
20707
|
permissionSelection,
|
|
20106
20708
|
sessionManagement,
|
|
20107
20709
|
toolCatalog
|
|
@@ -20129,6 +20731,7 @@ var useSlashCommandProcessor = (addItem, clearItems, loadHistory, refreshStatic,
|
|
|
20129
20731
|
}),
|
|
20130
20732
|
[
|
|
20131
20733
|
modelSelection,
|
|
20734
|
+
providerSetup,
|
|
20132
20735
|
permissionSelection,
|
|
20133
20736
|
sessionManagement,
|
|
20134
20737
|
toolCatalog,
|
|
@@ -20142,7 +20745,7 @@ var useSlashCommandProcessor = (addItem, clearItems, loadHistory, refreshStatic,
|
|
|
20142
20745
|
setCustomDialog
|
|
20143
20746
|
]
|
|
20144
20747
|
);
|
|
20145
|
-
|
|
20748
|
+
useEffect43(() => {
|
|
20146
20749
|
const controller = new AbortController();
|
|
20147
20750
|
(async () => {
|
|
20148
20751
|
const loaders = [
|
|
@@ -20156,11 +20759,11 @@ var useSlashCommandProcessor = (addItem, clearItems, loadHistory, refreshStatic,
|
|
|
20156
20759
|
controller.abort();
|
|
20157
20760
|
};
|
|
20158
20761
|
}, [dshCommands, enableProfiler, reloadTrigger]);
|
|
20159
|
-
|
|
20762
|
+
useEffect43(
|
|
20160
20763
|
() => dshCommands?.subscribe(reloadCommands),
|
|
20161
20764
|
[dshCommands, reloadCommands]
|
|
20162
20765
|
);
|
|
20163
|
-
|
|
20766
|
+
useEffect43(
|
|
20164
20767
|
() => () => commandAbortRef.current?.abort(),
|
|
20165
20768
|
[]
|
|
20166
20769
|
);
|
|
@@ -20329,9 +20932,9 @@ import * as fs13 from "node:fs";
|
|
|
20329
20932
|
import { basename as basename2, join as join6 } from "node:path";
|
|
20330
20933
|
|
|
20331
20934
|
// src/ui/hooks/commands/use-settings-command.ts
|
|
20332
|
-
import { useState as
|
|
20935
|
+
import { useState as useState42, useCallback as useCallback36 } from "react";
|
|
20333
20936
|
function useSettingsCommand() {
|
|
20334
|
-
const [isSettingsDialogOpen, setIsSettingsDialogOpen] =
|
|
20937
|
+
const [isSettingsDialogOpen, setIsSettingsDialogOpen] = useState42(false);
|
|
20335
20938
|
const openSettingsDialog = useCallback36(() => {
|
|
20336
20939
|
setIsSettingsDialogOpen(true);
|
|
20337
20940
|
}, []);
|
|
@@ -20346,10 +20949,10 @@ function useSettingsCommand() {
|
|
|
20346
20949
|
}
|
|
20347
20950
|
|
|
20348
20951
|
// src/ui/hooks/commands/use-theme-command.ts
|
|
20349
|
-
import { useState as
|
|
20952
|
+
import { useState as useState43, useCallback as useCallback37 } from "react";
|
|
20350
20953
|
import process6 from "node:process";
|
|
20351
20954
|
var useThemeCommand = (loadedSettings, setThemeError, addItem, initialThemeError) => {
|
|
20352
|
-
const [isThemeDialogOpen, setIsThemeDialogOpen] =
|
|
20955
|
+
const [isThemeDialogOpen, setIsThemeDialogOpen] = useState43(!!initialThemeError);
|
|
20353
20956
|
const openThemeDialog = useCallback37(() => {
|
|
20354
20957
|
if (process6.env["NO_COLOR"]) {
|
|
20355
20958
|
addItem(
|
|
@@ -20420,7 +21023,7 @@ var useThemeCommand = (loadedSettings, setThemeError, addItem, initialThemeError
|
|
|
20420
21023
|
};
|
|
20421
21024
|
|
|
20422
21025
|
// src/ui/hooks/input/use-vim.ts
|
|
20423
|
-
import { useCallback as useCallback38, useReducer as useReducer5, useEffect as
|
|
21026
|
+
import { useCallback as useCallback38, useReducer as useReducer5, useEffect as useEffect44, useRef as useRef22 } from "react";
|
|
20424
21027
|
var DIGIT_MULTIPLIER = 10;
|
|
20425
21028
|
var DEFAULT_COUNT = 1;
|
|
20426
21029
|
var DIGIT_1_TO_9 = /^[1-9]$/;
|
|
@@ -20485,8 +21088,8 @@ var vimReducer = (state, action) => {
|
|
|
20485
21088
|
function useVim(buffer, onSubmit) {
|
|
20486
21089
|
const { vimEnabled, vimMode, setVimMode } = useVimMode();
|
|
20487
21090
|
const [state, dispatch] = useReducer5(vimReducer, initialVimState);
|
|
20488
|
-
const lastEscapeTimestampRef =
|
|
20489
|
-
|
|
21091
|
+
const lastEscapeTimestampRef = useRef22(0);
|
|
21092
|
+
useEffect44(() => {
|
|
20490
21093
|
dispatch({ type: "SET_MODE", mode: vimMode });
|
|
20491
21094
|
}, [vimMode]);
|
|
20492
21095
|
const updateMode = useCallback38(
|
|
@@ -20985,12 +21588,12 @@ function useVim(buffer, onSubmit) {
|
|
|
20985
21588
|
}
|
|
20986
21589
|
|
|
20987
21590
|
// src/ui/hooks/session/use-git-branch-name.ts
|
|
20988
|
-
import { useState as
|
|
21591
|
+
import { useState as useState44, useEffect as useEffect45, useCallback as useCallback39 } from "react";
|
|
20989
21592
|
import fs10 from "node:fs";
|
|
20990
21593
|
import fsPromises2 from "node:fs/promises";
|
|
20991
21594
|
import path12 from "node:path";
|
|
20992
21595
|
function useGitBranchName(cwd) {
|
|
20993
|
-
const [branchName, setBranchName] =
|
|
21596
|
+
const [branchName, setBranchName] = useState44(void 0);
|
|
20994
21597
|
const fetchBranchName = useCallback39(async () => {
|
|
20995
21598
|
try {
|
|
20996
21599
|
const { stdout } = await spawnAsync(
|
|
@@ -21013,7 +21616,7 @@ function useGitBranchName(cwd) {
|
|
|
21013
21616
|
setBranchName(void 0);
|
|
21014
21617
|
}
|
|
21015
21618
|
}, [cwd, setBranchName]);
|
|
21016
|
-
|
|
21619
|
+
useEffect45(() => {
|
|
21017
21620
|
fetchBranchName();
|
|
21018
21621
|
const gitLogsHeadPath = path12.join(cwd, ".git", "logs", "HEAD");
|
|
21019
21622
|
let watcher;
|
|
@@ -21040,7 +21643,7 @@ function useGitBranchName(cwd) {
|
|
|
21040
21643
|
}
|
|
21041
21644
|
|
|
21042
21645
|
// src/ui/hooks/settings/use-editor-settings.ts
|
|
21043
|
-
import { useState as
|
|
21646
|
+
import { useState as useState45, useCallback as useCallback40 } from "react";
|
|
21044
21647
|
|
|
21045
21648
|
// src/config/setting-paths.ts
|
|
21046
21649
|
var SettingPaths = {
|
|
@@ -21051,7 +21654,7 @@ var SettingPaths = {
|
|
|
21051
21654
|
|
|
21052
21655
|
// src/ui/hooks/settings/use-editor-settings.ts
|
|
21053
21656
|
var useEditorSettings = (loadedSettings, setEditorError, addItem) => {
|
|
21054
|
-
const [isEditorDialogOpen, setIsEditorDialogOpen] =
|
|
21657
|
+
const [isEditorDialogOpen, setIsEditorDialogOpen] = useState45(false);
|
|
21055
21658
|
const openEditorDialog = useCallback40(() => {
|
|
21056
21659
|
setIsEditorDialogOpen(true);
|
|
21057
21660
|
}, []);
|
|
@@ -21093,12 +21696,12 @@ var useEditorSettings = (loadedSettings, setEditorError, addItem) => {
|
|
|
21093
21696
|
};
|
|
21094
21697
|
|
|
21095
21698
|
// src/ui/hooks/terminal/use-memory-monitor.ts
|
|
21096
|
-
import { useEffect as
|
|
21699
|
+
import { useEffect as useEffect46 } from "react";
|
|
21097
21700
|
import process7 from "node:process";
|
|
21098
21701
|
var MEMORY_WARNING_THRESHOLD = 7 * 1024 * 1024 * 1024;
|
|
21099
21702
|
var MEMORY_CHECK_INTERVAL = 60 * 1e3;
|
|
21100
21703
|
var useMemoryMonitor = ({ addItem }) => {
|
|
21101
|
-
|
|
21704
|
+
useEffect46(() => {
|
|
21102
21705
|
const intervalId = setInterval(() => {
|
|
21103
21706
|
const usage = process7.memoryUsage().rss;
|
|
21104
21707
|
if (usage > MEMORY_WARNING_THRESHOLD) {
|
|
@@ -21119,9 +21722,9 @@ var useMemoryMonitor = ({ addItem }) => {
|
|
|
21119
21722
|
// src/ui/hooks/visual/use-console-messages.ts
|
|
21120
21723
|
import {
|
|
21121
21724
|
useCallback as useCallback41,
|
|
21122
|
-
useEffect as
|
|
21725
|
+
useEffect as useEffect47,
|
|
21123
21726
|
useReducer as useReducer6,
|
|
21124
|
-
useRef as
|
|
21727
|
+
useRef as useRef23,
|
|
21125
21728
|
useTransition
|
|
21126
21729
|
} from "react";
|
|
21127
21730
|
function consoleMessagesReducer(state, action) {
|
|
@@ -21149,8 +21752,8 @@ function consoleMessagesReducer(state, action) {
|
|
|
21149
21752
|
}
|
|
21150
21753
|
function useConsoleMessages() {
|
|
21151
21754
|
const [consoleMessages, dispatch] = useReducer6(consoleMessagesReducer, []);
|
|
21152
|
-
const messageQueueRef =
|
|
21153
|
-
const timeoutRef =
|
|
21755
|
+
const messageQueueRef = useRef23([]);
|
|
21756
|
+
const timeoutRef = useRef23(null);
|
|
21154
21757
|
const [, startTransition] = useTransition();
|
|
21155
21758
|
const processQueue = useCallback41(() => {
|
|
21156
21759
|
if (messageQueueRef.current.length > 0) {
|
|
@@ -21171,7 +21774,7 @@ function useConsoleMessages() {
|
|
|
21171
21774
|
},
|
|
21172
21775
|
[processQueue]
|
|
21173
21776
|
);
|
|
21174
|
-
|
|
21777
|
+
useEffect47(() => {
|
|
21175
21778
|
const handleConsoleLog = (payload) => {
|
|
21176
21779
|
handleNewMessage({
|
|
21177
21780
|
type: payload.type,
|
|
@@ -21200,7 +21803,7 @@ function useConsoleMessages() {
|
|
|
21200
21803
|
dispatch({ type: "CLEAR" });
|
|
21201
21804
|
});
|
|
21202
21805
|
}, []);
|
|
21203
|
-
|
|
21806
|
+
useEffect47(
|
|
21204
21807
|
() => () => {
|
|
21205
21808
|
if (timeoutRef.current) {
|
|
21206
21809
|
clearTimeout(timeoutRef.current);
|
|
@@ -21212,13 +21815,13 @@ function useConsoleMessages() {
|
|
|
21212
21815
|
}
|
|
21213
21816
|
|
|
21214
21817
|
// src/ui/hooks/visual/use-timer.ts
|
|
21215
|
-
import { useState as
|
|
21818
|
+
import { useState as useState46, useEffect as useEffect48, useRef as useRef24 } from "react";
|
|
21216
21819
|
var useTimer = (isActive, resetKey) => {
|
|
21217
|
-
const [elapsedTime, setElapsedTime] =
|
|
21218
|
-
const timerRef =
|
|
21219
|
-
const prevResetKeyRef =
|
|
21220
|
-
const prevIsActiveRef =
|
|
21221
|
-
|
|
21820
|
+
const [elapsedTime, setElapsedTime] = useState46(0);
|
|
21821
|
+
const timerRef = useRef24(null);
|
|
21822
|
+
const prevResetKeyRef = useRef24(resetKey);
|
|
21823
|
+
const prevIsActiveRef = useRef24(isActive);
|
|
21824
|
+
useEffect48(() => {
|
|
21222
21825
|
let shouldResetTime = false;
|
|
21223
21826
|
if (prevResetKeyRef.current !== resetKey) {
|
|
21224
21827
|
shouldResetTime = true;
|
|
@@ -21255,7 +21858,7 @@ var useTimer = (isActive, resetKey) => {
|
|
|
21255
21858
|
};
|
|
21256
21859
|
|
|
21257
21860
|
// src/ui/hooks/visual/use-phrase-cycler.ts
|
|
21258
|
-
import { useState as
|
|
21861
|
+
import { useState as useState47, useEffect as useEffect49, useRef as useRef25 } from "react";
|
|
21259
21862
|
|
|
21260
21863
|
// src/ui/components/indicators/loading-phrases.ts
|
|
21261
21864
|
var WITTY_LOADING_PHRASES = [
|
|
@@ -21398,12 +22001,12 @@ var PHRASE_CHANGE_INTERVAL_MS = 15e3;
|
|
|
21398
22001
|
var INTERACTIVE_SHELL_WAITING_PHRASE = "Interactive shell awaiting input... press tab to focus shell";
|
|
21399
22002
|
var usePhraseCycler = (isActive, shouldShowFocusHint, customPhrases) => {
|
|
21400
22003
|
const loadingPhrases = customPhrases && customPhrases.length > 0 ? customPhrases : WITTY_LOADING_PHRASES;
|
|
21401
|
-
const [currentLoadingPhrase, setCurrentLoadingPhrase] =
|
|
22004
|
+
const [currentLoadingPhrase, setCurrentLoadingPhrase] = useState47(
|
|
21402
22005
|
loadingPhrases[0]
|
|
21403
22006
|
);
|
|
21404
|
-
const phraseIntervalRef =
|
|
21405
|
-
const hasShownFirstRequestTipRef =
|
|
21406
|
-
|
|
22007
|
+
const phraseIntervalRef = useRef25(null);
|
|
22008
|
+
const hasShownFirstRequestTipRef = useRef25(false);
|
|
22009
|
+
useEffect49(() => {
|
|
21407
22010
|
if (phraseIntervalRef.current) {
|
|
21408
22011
|
clearInterval(phraseIntervalRef.current);
|
|
21409
22012
|
phraseIntervalRef.current = null;
|
|
@@ -21448,13 +22051,13 @@ var usePhraseCycler = (isActive, shouldShowFocusHint, customPhrases) => {
|
|
|
21448
22051
|
};
|
|
21449
22052
|
|
|
21450
22053
|
// src/ui/hooks/visual/use-loading-indicator.ts
|
|
21451
|
-
import { useState as
|
|
22054
|
+
import { useState as useState48, useEffect as useEffect50, useRef as useRef26 } from "react";
|
|
21452
22055
|
var useLoadingIndicator = ({
|
|
21453
22056
|
streamingState,
|
|
21454
22057
|
shouldShowFocusHint,
|
|
21455
22058
|
customWittyPhrases
|
|
21456
22059
|
}) => {
|
|
21457
|
-
const [timerResetKey, setTimerResetKey] =
|
|
22060
|
+
const [timerResetKey, setTimerResetKey] = useState48(0);
|
|
21458
22061
|
const isTimerActive = streamingState === "responding" /* Responding */;
|
|
21459
22062
|
const elapsedTimeFromTimer = useTimer(isTimerActive, timerResetKey);
|
|
21460
22063
|
const isPhraseCyclingActive = streamingState === "responding" /* Responding */;
|
|
@@ -21463,8 +22066,8 @@ var useLoadingIndicator = ({
|
|
|
21463
22066
|
shouldShowFocusHint,
|
|
21464
22067
|
customWittyPhrases
|
|
21465
22068
|
);
|
|
21466
|
-
const prevStreamingStateRef =
|
|
21467
|
-
|
|
22069
|
+
const prevStreamingStateRef = useRef26(null);
|
|
22070
|
+
useEffect50(() => {
|
|
21468
22071
|
if (streamingState === "idle" /* Idle */ && prevStreamingStateRef.current === "responding" /* Responding */) {
|
|
21469
22072
|
setTimerResetKey((prevKey) => prevKey + 1);
|
|
21470
22073
|
}
|
|
@@ -21477,12 +22080,12 @@ var useLoadingIndicator = ({
|
|
|
21477
22080
|
};
|
|
21478
22081
|
|
|
21479
22082
|
// src/ui/hooks/session/use-message-queue.ts
|
|
21480
|
-
import { useCallback as useCallback42, useEffect as
|
|
22083
|
+
import { useCallback as useCallback42, useEffect as useEffect51, useState as useState49 } from "react";
|
|
21481
22084
|
function useMessageQueue({
|
|
21482
22085
|
streamingState,
|
|
21483
22086
|
submitQuery
|
|
21484
22087
|
}) {
|
|
21485
|
-
const [messageQueue, setMessageQueue] =
|
|
22088
|
+
const [messageQueue, setMessageQueue] = useState49([]);
|
|
21486
22089
|
const addMessage = useCallback42((message) => {
|
|
21487
22090
|
const trimmedMessage = message.trim();
|
|
21488
22091
|
if (trimmedMessage.length > 0) {
|
|
@@ -21504,7 +22107,7 @@ function useMessageQueue({
|
|
|
21504
22107
|
setMessageQueue([]);
|
|
21505
22108
|
return allMessages;
|
|
21506
22109
|
}, [messageQueue]);
|
|
21507
|
-
|
|
22110
|
+
useEffect51(() => {
|
|
21508
22111
|
if (streamingState === "idle" /* Idle */ && messageQueue.length > 0) {
|
|
21509
22112
|
const combinedMessage = messageQueue.join("\n\n");
|
|
21510
22113
|
setMessageQueue([]);
|
|
@@ -21521,15 +22124,15 @@ function useMessageQueue({
|
|
|
21521
22124
|
}
|
|
21522
22125
|
|
|
21523
22126
|
// src/ui/hooks/input/use-input-history-store.ts
|
|
21524
|
-
import { useCallback as useCallback43, useRef as
|
|
22127
|
+
import { useCallback as useCallback43, useRef as useRef27, useState as useState50 } from "react";
|
|
21525
22128
|
function deduplicateConsecutive(messages) {
|
|
21526
22129
|
return messages.filter(
|
|
21527
22130
|
(message, index) => index === 0 || message !== messages[index - 1]
|
|
21528
22131
|
);
|
|
21529
22132
|
}
|
|
21530
22133
|
function useInputHistoryStore() {
|
|
21531
|
-
const [inputHistory, setInputHistory] =
|
|
21532
|
-
const initializationStarted =
|
|
22134
|
+
const [inputHistory, setInputHistory] = useState50([]);
|
|
22135
|
+
const initializationStarted = useRef27(false);
|
|
21533
22136
|
const initializeFromHistory = useCallback43(
|
|
21534
22137
|
async (history) => {
|
|
21535
22138
|
if (initializationStarted.current) return;
|
|
@@ -21651,12 +22254,12 @@ var PromptHistoryStore = class {
|
|
|
21651
22254
|
};
|
|
21652
22255
|
|
|
21653
22256
|
// src/ui/hooks/ai/use-turn-activity-monitor.ts
|
|
21654
|
-
import { useState as
|
|
22257
|
+
import { useState as useState51, useEffect as useEffect52, useRef as useRef28 } from "react";
|
|
21655
22258
|
var useTurnActivityMonitor = (streamingState, activePtyId) => {
|
|
21656
|
-
const [operationStartTime, setOperationStartTime] =
|
|
21657
|
-
const prevPtyIdRef =
|
|
21658
|
-
const prevStreamingStateRef =
|
|
21659
|
-
|
|
22259
|
+
const [operationStartTime, setOperationStartTime] = useState51(0);
|
|
22260
|
+
const prevPtyIdRef = useRef28(void 0);
|
|
22261
|
+
const prevStreamingStateRef = useRef28(void 0);
|
|
22262
|
+
useEffect52(() => {
|
|
21660
22263
|
const isNowResponding = streamingState === "responding" /* Responding */;
|
|
21661
22264
|
const wasResponding = prevStreamingStateRef.current === "responding" /* Responding */;
|
|
21662
22265
|
const ptyChanged = activePtyId !== prevPtyIdRef.current;
|
|
@@ -21715,7 +22318,7 @@ var useShellInactivityStatus = ({
|
|
|
21715
22318
|
};
|
|
21716
22319
|
|
|
21717
22320
|
// src/ui/hooks/input/use-local-shell-command.ts
|
|
21718
|
-
import { useCallback as useCallback44, useEffect as
|
|
22321
|
+
import { useCallback as useCallback44, useEffect as useEffect53, useRef as useRef29, useState as useState52 } from "react";
|
|
21719
22322
|
import crypto2 from "node:crypto";
|
|
21720
22323
|
import fs12 from "node:fs";
|
|
21721
22324
|
import os4 from "node:os";
|
|
@@ -21732,13 +22335,13 @@ function useLocalShellCommand({
|
|
|
21732
22335
|
terminalWidth,
|
|
21733
22336
|
terminalHeight
|
|
21734
22337
|
}) {
|
|
21735
|
-
const controllerRef =
|
|
21736
|
-
const mountedRef =
|
|
21737
|
-
const [isExecuting, setIsExecuting] =
|
|
21738
|
-
const [activePtyId, setActivePtyId] =
|
|
21739
|
-
const [lastOutputTime, setLastOutputTime] =
|
|
22338
|
+
const controllerRef = useRef29(void 0);
|
|
22339
|
+
const mountedRef = useRef29(true);
|
|
22340
|
+
const [isExecuting, setIsExecuting] = useState52(false);
|
|
22341
|
+
const [activePtyId, setActivePtyId] = useState52(void 0);
|
|
22342
|
+
const [lastOutputTime, setLastOutputTime] = useState52(0);
|
|
21740
22343
|
const cancel = useCallback44(() => controllerRef.current?.abort(), []);
|
|
21741
|
-
|
|
22344
|
+
useEffect53(() => {
|
|
21742
22345
|
mountedRef.current = true;
|
|
21743
22346
|
return () => {
|
|
21744
22347
|
mountedRef.current = false;
|
|
@@ -21942,9 +22545,12 @@ ${output}`;
|
|
|
21942
22545
|
}
|
|
21943
22546
|
|
|
21944
22547
|
// src/ui/app-container.tsx
|
|
21945
|
-
import { jsx as
|
|
22548
|
+
import { jsx as jsx94 } from "react/jsx-runtime";
|
|
21946
22549
|
var SHELL_WIDTH_FRACTION = 0.89;
|
|
21947
22550
|
var SHELL_HEIGHT_PADDING = 10;
|
|
22551
|
+
var noopExternalStoreSubscribe = () => () => {
|
|
22552
|
+
};
|
|
22553
|
+
var emptyProviderSetupSnapshot = () => void 0;
|
|
21948
22554
|
var AppContainer = (props) => {
|
|
21949
22555
|
const {
|
|
21950
22556
|
config,
|
|
@@ -21953,6 +22559,7 @@ var AppContainer = (props) => {
|
|
|
21953
22559
|
promptCompletionRuntime,
|
|
21954
22560
|
promptInputRuntime,
|
|
21955
22561
|
modelSelectionRuntime,
|
|
22562
|
+
providerSetupRuntime,
|
|
21956
22563
|
sessionManagementRuntime,
|
|
21957
22564
|
approvalRuntime,
|
|
21958
22565
|
userQuestionRuntime,
|
|
@@ -21978,18 +22585,18 @@ var AppContainer = (props) => {
|
|
|
21978
22585
|
userQuestionRuntime.getSnapshot
|
|
21979
22586
|
);
|
|
21980
22587
|
const pendingUserQuestion = userQuestionSnapshot.pending[0];
|
|
21981
|
-
const conversationHistoryIds =
|
|
21982
|
-
const conversationHistoryTexts =
|
|
22588
|
+
const conversationHistoryIds = useRef30(/* @__PURE__ */ new Map());
|
|
22589
|
+
const conversationHistoryTexts = useRef30(/* @__PURE__ */ new Map());
|
|
21983
22590
|
const conversationSessionId = conversationRuntime.getSessionStats().sessionId;
|
|
21984
|
-
const [projectedSessionId, setProjectedSessionId] =
|
|
22591
|
+
const [projectedSessionId, setProjectedSessionId] = useState53(
|
|
21985
22592
|
conversationSessionId
|
|
21986
22593
|
);
|
|
21987
|
-
const promptInputAbortRef =
|
|
21988
|
-
const [promptInputPreparing, setPromptInputPreparing] =
|
|
22594
|
+
const promptInputAbortRef = useRef30(void 0);
|
|
22595
|
+
const [promptInputPreparing, setPromptInputPreparing] = useState53(false);
|
|
21989
22596
|
const addConversationHistoryItem = historyManager.addItem;
|
|
21990
22597
|
const updateConversationHistoryItem = historyManager.updateItem;
|
|
21991
22598
|
const clearConversationHistory = historyManager.clearItems;
|
|
21992
|
-
|
|
22599
|
+
useEffect54(() => {
|
|
21993
22600
|
if (projectedSessionId !== conversationSessionId) {
|
|
21994
22601
|
conversationHistoryIds.current.clear();
|
|
21995
22602
|
conversationHistoryTexts.current.clear();
|
|
@@ -22074,42 +22681,48 @@ var AppContainer = (props) => {
|
|
|
22074
22681
|
useMemoryMonitor(historyManager);
|
|
22075
22682
|
const settings = useSettings();
|
|
22076
22683
|
const isAlternateBuffer = useAlternateBuffer();
|
|
22077
|
-
const [debugMessage, setDebugMessage] =
|
|
22078
|
-
const [quittingMessages, setQuittingMessages] =
|
|
22079
|
-
const [themeError, setThemeError] =
|
|
22684
|
+
const [debugMessage, setDebugMessage] = useState53("");
|
|
22685
|
+
const [quittingMessages, setQuittingMessages] = useState53(null);
|
|
22686
|
+
const [themeError, setThemeError] = useState53(
|
|
22080
22687
|
initializationResult.themeError
|
|
22081
22688
|
);
|
|
22082
|
-
const [isProcessing, setIsProcessing] =
|
|
22083
|
-
const [embeddedShellFocused, setEmbeddedShellFocused] =
|
|
22689
|
+
const [isProcessing, setIsProcessing] = useState53(false);
|
|
22690
|
+
const [embeddedShellFocused, setEmbeddedShellFocused] = useState53(false);
|
|
22084
22691
|
const enableProfiler = config.getDebugMode() || process8.env["NODE_ENV"] === "development";
|
|
22085
|
-
const [showDebugProfiler, setShowDebugProfiler] =
|
|
22086
|
-
const [customDialog, setCustomDialog] =
|
|
22692
|
+
const [showDebugProfiler, setShowDebugProfiler] = useState53(enableProfiler);
|
|
22693
|
+
const [customDialog, setCustomDialog] = useState53(
|
|
22087
22694
|
null
|
|
22088
22695
|
);
|
|
22089
|
-
const [copyModeEnabled, setCopyModeEnabled] =
|
|
22090
|
-
const [pendingRestorePrompt, setPendingRestorePrompt] =
|
|
22091
|
-
const [shellModeActive, setShellModeActive] =
|
|
22092
|
-
const [pendingShellHistoryItem, setPendingShellHistoryItem] =
|
|
22093
|
-
const [historyRemountKey, setHistoryRemountKey] =
|
|
22094
|
-
const [settingsNonce, setSettingsNonce] =
|
|
22095
|
-
const [queueErrorMessage, setQueueErrorMessage] =
|
|
22696
|
+
const [copyModeEnabled, setCopyModeEnabled] = useState53(false);
|
|
22697
|
+
const [pendingRestorePrompt, setPendingRestorePrompt] = useState53(false);
|
|
22698
|
+
const [shellModeActive, setShellModeActive] = useState53(false);
|
|
22699
|
+
const [pendingShellHistoryItem, setPendingShellHistoryItem] = useState53(null);
|
|
22700
|
+
const [historyRemountKey, setHistoryRemountKey] = useState53(0);
|
|
22701
|
+
const [settingsNonce, setSettingsNonce] = useState53(0);
|
|
22702
|
+
const [queueErrorMessage, setQueueErrorMessage] = useState53(
|
|
22096
22703
|
null
|
|
22097
22704
|
);
|
|
22098
22705
|
const toggleDebugProfiler = useCallback45(
|
|
22099
22706
|
() => setShowDebugProfiler((visible) => !visible),
|
|
22100
22707
|
[]
|
|
22101
22708
|
);
|
|
22102
|
-
const [modelSelectionSnapshot, setModelSelectionSnapshot] =
|
|
22709
|
+
const [modelSelectionSnapshot, setModelSelectionSnapshot] = useState53(
|
|
22103
22710
|
() => modelSelectionRuntime?.getSnapshot()
|
|
22104
22711
|
);
|
|
22105
|
-
|
|
22712
|
+
useEffect54(
|
|
22106
22713
|
() => modelSelectionRuntime?.subscribe(
|
|
22107
22714
|
() => setModelSelectionSnapshot(modelSelectionRuntime.getSnapshot())
|
|
22108
22715
|
),
|
|
22109
22716
|
[modelSelectionRuntime]
|
|
22110
22717
|
);
|
|
22111
22718
|
const currentModel = modelSelectionSnapshot ? modelSelectionLabel(modelSelectionSnapshot.current) : "DSH default";
|
|
22112
|
-
const
|
|
22719
|
+
const providerSetupSnapshot = useSyncExternalStore5(
|
|
22720
|
+
providerSetupRuntime?.subscribe ?? noopExternalStoreSubscribe,
|
|
22721
|
+
providerSetupRuntime?.getSnapshot ?? emptyProviderSetupSnapshot,
|
|
22722
|
+
providerSetupRuntime?.getSnapshot ?? emptyProviderSetupSnapshot
|
|
22723
|
+
);
|
|
22724
|
+
const [providerSetupDismissed, setProviderSetupDismissed] = useState53(false);
|
|
22725
|
+
const promptHistory = useMemo34(
|
|
22113
22726
|
() => new PromptHistoryStore(
|
|
22114
22727
|
join6(config.storage.getProjectTempDir(), "prompt_history.json")
|
|
22115
22728
|
),
|
|
@@ -22122,11 +22735,11 @@ var AppContainer = (props) => {
|
|
|
22122
22735
|
const app = useApp();
|
|
22123
22736
|
const { stats: sessionStats } = useSessionStats();
|
|
22124
22737
|
const branchName = useGitBranchName(config.getTargetDir());
|
|
22125
|
-
const mainControlsRef =
|
|
22126
|
-
const rootUiRef =
|
|
22127
|
-
const lastTitleRef =
|
|
22738
|
+
const mainControlsRef = useRef30(null);
|
|
22739
|
+
const rootUiRef = useRef30(null);
|
|
22740
|
+
const lastTitleRef = useRef30(null);
|
|
22128
22741
|
const staticExtraHeight = 3;
|
|
22129
|
-
|
|
22742
|
+
useEffect54(() => {
|
|
22130
22743
|
void (async () => {
|
|
22131
22744
|
startupProfiler.flush();
|
|
22132
22745
|
})();
|
|
@@ -22134,7 +22747,7 @@ var AppContainer = (props) => {
|
|
|
22134
22747
|
disableMouseEvents();
|
|
22135
22748
|
});
|
|
22136
22749
|
}, [config]);
|
|
22137
|
-
|
|
22750
|
+
useEffect54(() => {
|
|
22138
22751
|
const handleSettingsChanged = () => {
|
|
22139
22752
|
setSettingsNonce((prev) => prev + 1);
|
|
22140
22753
|
};
|
|
@@ -22145,7 +22758,7 @@ var AppContainer = (props) => {
|
|
|
22145
22758
|
}, []);
|
|
22146
22759
|
const { consoleMessages, clearConsoleMessages: clearConsoleMessagesState } = useConsoleMessages();
|
|
22147
22760
|
const mainAreaWidth = calculateMainAreaWidth(terminalWidth, settings);
|
|
22148
|
-
const { inputWidth, suggestionsWidth } =
|
|
22761
|
+
const { inputWidth, suggestionsWidth } = useMemo34(() => {
|
|
22149
22762
|
const { inputWidth: inputWidth2, suggestionsWidth: suggestionsWidth2 } = calculatePromptWidths(mainAreaWidth);
|
|
22150
22763
|
return { inputWidth: inputWidth2, suggestionsWidth: suggestionsWidth2 };
|
|
22151
22764
|
}, [mainAreaWidth]);
|
|
@@ -22170,7 +22783,7 @@ var AppContainer = (props) => {
|
|
|
22170
22783
|
shellModeActive,
|
|
22171
22784
|
getPreferredEditor
|
|
22172
22785
|
});
|
|
22173
|
-
|
|
22786
|
+
useEffect54(() => {
|
|
22174
22787
|
initializeFromHistory(promptHistory);
|
|
22175
22788
|
}, [initializeFromHistory, promptHistory]);
|
|
22176
22789
|
const refreshStatic = useCallback45(() => {
|
|
@@ -22189,7 +22802,7 @@ var AppContainer = (props) => {
|
|
|
22189
22802
|
terminalCapabilityManager.enableSupportedModes();
|
|
22190
22803
|
refreshStatic();
|
|
22191
22804
|
}, [refreshStatic, isAlternateBuffer, app, config]);
|
|
22192
|
-
|
|
22805
|
+
useEffect54(() => {
|
|
22193
22806
|
coreEvents.on(CoreEvent.ExternalEditorClosed, handleEditorClose);
|
|
22194
22807
|
return () => {
|
|
22195
22808
|
coreEvents.off(CoreEvent.ExternalEditorClosed, handleEditorClose);
|
|
@@ -22207,7 +22820,7 @@ var AppContainer = (props) => {
|
|
|
22207
22820
|
historyManager.addItem,
|
|
22208
22821
|
initializationResult.themeError
|
|
22209
22822
|
);
|
|
22210
|
-
const [editorError, setEditorError] =
|
|
22823
|
+
const [editorError, setEditorError] = useState53(null);
|
|
22211
22824
|
const {
|
|
22212
22825
|
isEditorDialogOpen,
|
|
22213
22826
|
openEditorDialog,
|
|
@@ -22216,7 +22829,7 @@ var AppContainer = (props) => {
|
|
|
22216
22829
|
} = useEditorSettings(settings, setEditorError, historyManager.addItem);
|
|
22217
22830
|
const { isSettingsDialogOpen, openSettingsDialog, closeSettingsDialog } = useSettingsCommand();
|
|
22218
22831
|
const { toggleVimEnabled } = useVimMode();
|
|
22219
|
-
const slashCommandActions =
|
|
22832
|
+
const slashCommandActions = useMemo34(
|
|
22220
22833
|
() => ({
|
|
22221
22834
|
openThemeDialog,
|
|
22222
22835
|
openEditorDialog,
|
|
@@ -22260,13 +22873,14 @@ var AppContainer = (props) => {
|
|
|
22260
22873
|
sessionManagementRuntime,
|
|
22261
22874
|
toolCatalogRuntime,
|
|
22262
22875
|
commandRuntime,
|
|
22263
|
-
enableProfiler
|
|
22876
|
+
enableProfiler,
|
|
22877
|
+
providerSetupRuntime
|
|
22264
22878
|
);
|
|
22265
|
-
const cancelHandlerRef =
|
|
22879
|
+
const cancelHandlerRef = useRef30(
|
|
22266
22880
|
() => {
|
|
22267
22881
|
}
|
|
22268
22882
|
);
|
|
22269
|
-
|
|
22883
|
+
useEffect54(() => {
|
|
22270
22884
|
if (pendingRestorePrompt) {
|
|
22271
22885
|
const lastHistoryUserMsg = historyManager.history.findLast(
|
|
22272
22886
|
(h) => h.type === "user"
|
|
@@ -22279,7 +22893,7 @@ var AppContainer = (props) => {
|
|
|
22279
22893
|
}
|
|
22280
22894
|
}, [pendingRestorePrompt, inputHistory, historyManager.history]);
|
|
22281
22895
|
const initError = initializationResult.initError;
|
|
22282
|
-
const todos =
|
|
22896
|
+
const todos = useMemo34(
|
|
22283
22897
|
() => ({
|
|
22284
22898
|
todos: conversationSnapshot.todos.map((todo) => ({
|
|
22285
22899
|
description: todo.content,
|
|
@@ -22363,14 +22977,14 @@ var AppContainer = (props) => {
|
|
|
22363
22977
|
promptInputAbortRef.current?.abort();
|
|
22364
22978
|
conversationRuntime.cancel();
|
|
22365
22979
|
}, [cancelCommand, cancelLocalShell, conversationRuntime]);
|
|
22366
|
-
|
|
22980
|
+
useEffect54(
|
|
22367
22981
|
() => () => {
|
|
22368
22982
|
promptInputAbortRef.current?.abort();
|
|
22369
22983
|
},
|
|
22370
22984
|
[]
|
|
22371
22985
|
);
|
|
22372
|
-
const lastOutputTimeRef =
|
|
22373
|
-
|
|
22986
|
+
const lastOutputTimeRef = useRef30(0);
|
|
22987
|
+
useEffect54(() => {
|
|
22374
22988
|
lastOutputTimeRef.current = lastOutputTime;
|
|
22375
22989
|
}, [lastOutputTime]);
|
|
22376
22990
|
const { shouldShowFocusHint, inactivityStatus } = useShellInactivityStatus({
|
|
@@ -22421,6 +23035,11 @@ ${queuedText}` : queuedText;
|
|
|
22421
23035
|
return;
|
|
22422
23036
|
}
|
|
22423
23037
|
const isSlash = isSlashCommand(submittedValue.trim());
|
|
23038
|
+
if (!isSlash && providerSetupSnapshot?.current.status === "missing") {
|
|
23039
|
+
buffer.setText(submittedValue);
|
|
23040
|
+
setProviderSetupDismissed(false);
|
|
23041
|
+
return;
|
|
23042
|
+
}
|
|
22424
23043
|
const isIdle = streamingState === "idle" /* Idle */;
|
|
22425
23044
|
if (isSlash || isIdle) {
|
|
22426
23045
|
void submitQuery(submittedValue);
|
|
@@ -22437,6 +23056,8 @@ ${queuedText}` : queuedText;
|
|
|
22437
23056
|
addInput,
|
|
22438
23057
|
executeLocalShell,
|
|
22439
23058
|
promptHistory,
|
|
23059
|
+
providerSetupSnapshot,
|
|
23060
|
+
buffer,
|
|
22440
23061
|
shellModeActive,
|
|
22441
23062
|
submitQuery,
|
|
22442
23063
|
streamingState
|
|
@@ -22449,8 +23070,8 @@ ${queuedText}` : queuedText;
|
|
|
22449
23070
|
}, [historyManager, clearConsoleMessagesState, refreshStatic]);
|
|
22450
23071
|
const { handleInput: vimHandleInput } = useVim(buffer, handleFinalSubmit);
|
|
22451
23072
|
const isInputActive = !initError && !isProcessing && pendingApproval === void 0 && pendingUserQuestion === void 0 && !!slashCommands && (streamingState === "idle" /* Idle */ || streamingState === "responding" /* Responding */);
|
|
22452
|
-
const [controlsHeight, setControlsHeight] =
|
|
22453
|
-
|
|
23073
|
+
const [controlsHeight, setControlsHeight] = useState53(0);
|
|
23074
|
+
useLayoutEffect3(() => {
|
|
22454
23075
|
if (mainControlsRef.current) {
|
|
22455
23076
|
const fullFooterMeasurement = measureElement3(mainControlsRef.current);
|
|
22456
23077
|
if (fullFooterMeasurement.height > 0 && fullFooterMeasurement.height !== controlsHeight) {
|
|
@@ -22473,12 +23094,45 @@ ${queuedText}` : queuedText;
|
|
|
22473
23094
|
sanitizationConfig: config.sanitizationConfig
|
|
22474
23095
|
});
|
|
22475
23096
|
const isFocused = useFocus();
|
|
22476
|
-
const initialPrompt =
|
|
23097
|
+
const initialPrompt = useMemo34(
|
|
22477
23098
|
() => props.initialPrompt ?? config.getQuestion(),
|
|
22478
23099
|
[config, props.initialPrompt]
|
|
22479
23100
|
);
|
|
22480
|
-
const initialPromptSubmitted =
|
|
22481
|
-
|
|
23101
|
+
const initialPromptSubmitted = useRef30(false);
|
|
23102
|
+
const providerSetupRequired = providerSetupSnapshot?.current.status === "missing";
|
|
23103
|
+
useEffect54(() => {
|
|
23104
|
+
if (!providerSetupRuntime || !providerSetupRequired || providerSetupDismissed || customDialog) {
|
|
23105
|
+
return;
|
|
23106
|
+
}
|
|
23107
|
+
setCustomDialog(
|
|
23108
|
+
/* @__PURE__ */ jsx94(
|
|
23109
|
+
ProviderSetupDialog,
|
|
23110
|
+
{
|
|
23111
|
+
runtime: providerSetupRuntime,
|
|
23112
|
+
provider: providerSetupSnapshot.current.provider,
|
|
23113
|
+
reason: "first-run",
|
|
23114
|
+
onConfigured: () => setCustomDialog(null),
|
|
23115
|
+
onCancel: () => {
|
|
23116
|
+
setProviderSetupDismissed(true);
|
|
23117
|
+
if (initialPrompt && !initialPromptSubmitted.current) {
|
|
23118
|
+
initialPromptSubmitted.current = true;
|
|
23119
|
+
buffer.setText(initialPrompt);
|
|
23120
|
+
}
|
|
23121
|
+
setCustomDialog(null);
|
|
23122
|
+
}
|
|
23123
|
+
}
|
|
23124
|
+
)
|
|
23125
|
+
);
|
|
23126
|
+
}, [
|
|
23127
|
+
buffer,
|
|
23128
|
+
customDialog,
|
|
23129
|
+
initialPrompt,
|
|
23130
|
+
providerSetupDismissed,
|
|
23131
|
+
providerSetupRequired,
|
|
23132
|
+
providerSetupRuntime,
|
|
23133
|
+
providerSetupSnapshot
|
|
23134
|
+
]);
|
|
23135
|
+
useEffect54(() => {
|
|
22482
23136
|
if (activePtyId) {
|
|
22483
23137
|
try {
|
|
22484
23138
|
ShellExecutionService.resizePty(
|
|
@@ -22496,8 +23150,8 @@ ${queuedText}` : queuedText;
|
|
|
22496
23150
|
}
|
|
22497
23151
|
}
|
|
22498
23152
|
}, [terminalWidth, availableTerminalHeight, activePtyId]);
|
|
22499
|
-
|
|
22500
|
-
if (initialPrompt && !initialPromptSubmitted.current && !isThemeDialogOpen && !isEditorDialogOpen && conversationRuntime) {
|
|
23153
|
+
useEffect54(() => {
|
|
23154
|
+
if (initialPrompt && !initialPromptSubmitted.current && !isThemeDialogOpen && !isEditorDialogOpen && !providerSetupRequired && !customDialog && conversationRuntime) {
|
|
22501
23155
|
handleFinalSubmit(initialPrompt);
|
|
22502
23156
|
initialPromptSubmitted.current = true;
|
|
22503
23157
|
}
|
|
@@ -22506,21 +23160,23 @@ ${queuedText}` : queuedText;
|
|
|
22506
23160
|
handleFinalSubmit,
|
|
22507
23161
|
isThemeDialogOpen,
|
|
22508
23162
|
isEditorDialogOpen,
|
|
23163
|
+
providerSetupRequired,
|
|
23164
|
+
customDialog,
|
|
22509
23165
|
conversationRuntime
|
|
22510
23166
|
]);
|
|
22511
|
-
const [showErrorDetails, setShowErrorDetails] =
|
|
22512
|
-
const [showFullTodos, setShowFullTodos] =
|
|
22513
|
-
const [renderMarkdown, setRenderMarkdown] =
|
|
22514
|
-
const [ctrlCPressCount, setCtrlCPressCount] =
|
|
22515
|
-
const ctrlCTimerRef =
|
|
22516
|
-
const [ctrlDPressCount, setCtrlDPressCount] =
|
|
22517
|
-
const ctrlDTimerRef =
|
|
22518
|
-
const [constrainHeight, setConstrainHeight] =
|
|
22519
|
-
const [showEscapePrompt, setShowEscapePrompt] =
|
|
22520
|
-
const [warningMessage, setWarningMessage] =
|
|
22521
|
-
const isInitialMount =
|
|
22522
|
-
const warningTimeoutRef =
|
|
22523
|
-
const tabFocusTimeoutRef =
|
|
23167
|
+
const [showErrorDetails, setShowErrorDetails] = useState53(false);
|
|
23168
|
+
const [showFullTodos, setShowFullTodos] = useState53(false);
|
|
23169
|
+
const [renderMarkdown, setRenderMarkdown] = useState53(true);
|
|
23170
|
+
const [ctrlCPressCount, setCtrlCPressCount] = useState53(0);
|
|
23171
|
+
const ctrlCTimerRef = useRef30(null);
|
|
23172
|
+
const [ctrlDPressCount, setCtrlDPressCount] = useState53(0);
|
|
23173
|
+
const ctrlDTimerRef = useRef30(null);
|
|
23174
|
+
const [constrainHeight, setConstrainHeight] = useState53(true);
|
|
23175
|
+
const [showEscapePrompt, setShowEscapePrompt] = useState53(false);
|
|
23176
|
+
const [warningMessage, setWarningMessage] = useState53(null);
|
|
23177
|
+
const isInitialMount = useRef30(true);
|
|
23178
|
+
const warningTimeoutRef = useRef30(null);
|
|
23179
|
+
const tabFocusTimeoutRef = useRef30(null);
|
|
22524
23180
|
const handleWarning = useCallback45((message) => {
|
|
22525
23181
|
setWarningMessage(message);
|
|
22526
23182
|
if (warningTimeoutRef.current) {
|
|
@@ -22530,7 +23186,7 @@ ${queuedText}` : queuedText;
|
|
|
22530
23186
|
setWarningMessage(null);
|
|
22531
23187
|
}, WARNING_PROMPT_DURATION_MS);
|
|
22532
23188
|
}, []);
|
|
22533
|
-
|
|
23189
|
+
useEffect54(() => {
|
|
22534
23190
|
const handleSelectionWarning = () => {
|
|
22535
23191
|
handleWarning("Press Ctrl-S to enter selection mode to copy text.");
|
|
22536
23192
|
};
|
|
@@ -22550,7 +23206,7 @@ ${queuedText}` : queuedText;
|
|
|
22550
23206
|
}
|
|
22551
23207
|
};
|
|
22552
23208
|
}, [handleWarning]);
|
|
22553
|
-
|
|
23209
|
+
useEffect54(() => {
|
|
22554
23210
|
if (queueErrorMessage) {
|
|
22555
23211
|
const timer = setTimeout(() => {
|
|
22556
23212
|
setQueueErrorMessage(null);
|
|
@@ -22559,7 +23215,7 @@ ${queuedText}` : queuedText;
|
|
|
22559
23215
|
}
|
|
22560
23216
|
return void 0;
|
|
22561
23217
|
}, [queueErrorMessage, setQueueErrorMessage]);
|
|
22562
|
-
|
|
23218
|
+
useEffect54(() => {
|
|
22563
23219
|
if (isInitialMount.current) {
|
|
22564
23220
|
isInitialMount.current = false;
|
|
22565
23221
|
return;
|
|
@@ -22571,7 +23227,7 @@ ${queuedText}` : queuedText;
|
|
|
22571
23227
|
clearTimeout(handler);
|
|
22572
23228
|
};
|
|
22573
23229
|
}, [terminalWidth, refreshStatic]);
|
|
22574
|
-
|
|
23230
|
+
useEffect54(() => {
|
|
22575
23231
|
const openDebugConsole = () => {
|
|
22576
23232
|
setShowErrorDetails(true);
|
|
22577
23233
|
setConstrainHeight(false);
|
|
@@ -22581,7 +23237,7 @@ ${queuedText}` : queuedText;
|
|
|
22581
23237
|
appEvents.off("open-debug-console" /* OpenDebugConsole */, openDebugConsole);
|
|
22582
23238
|
};
|
|
22583
23239
|
}, [config]);
|
|
22584
|
-
|
|
23240
|
+
useEffect54(() => {
|
|
22585
23241
|
if (ctrlCTimerRef.current) {
|
|
22586
23242
|
clearTimeout(ctrlCTimerRef.current);
|
|
22587
23243
|
ctrlCTimerRef.current = null;
|
|
@@ -22595,7 +23251,7 @@ ${queuedText}` : queuedText;
|
|
|
22595
23251
|
}, WARNING_PROMPT_DURATION_MS);
|
|
22596
23252
|
}
|
|
22597
23253
|
}, [ctrlCPressCount, config, setCtrlCPressCount, handleSlashCommand]);
|
|
22598
|
-
|
|
23254
|
+
useEffect54(() => {
|
|
22599
23255
|
if (ctrlDTimerRef.current) {
|
|
22600
23256
|
clearTimeout(ctrlDTimerRef.current);
|
|
22601
23257
|
ctrlCTimerRef.current = null;
|
|
@@ -22624,9 +23280,6 @@ ${queuedText}` : queuedText;
|
|
|
22624
23280
|
enableMouseEvents();
|
|
22625
23281
|
return;
|
|
22626
23282
|
}
|
|
22627
|
-
if (settings.merged.general.debugKeystrokeLogging) {
|
|
22628
|
-
debugLogger.log("[DEBUG] Keystroke:", JSON.stringify(key));
|
|
22629
|
-
}
|
|
22630
23283
|
if (isAlternateBuffer && keyMatchers["app.toggleCopyMode" /* TOGGLE_COPY_MODE */](key)) {
|
|
22631
23284
|
setCopyModeEnabled(true);
|
|
22632
23285
|
disableMouseEvents();
|
|
@@ -22641,6 +23294,9 @@ ${queuedText}` : queuedText;
|
|
|
22641
23294
|
userQuestionRuntime.cancel(pendingUserQuestion.id);
|
|
22642
23295
|
return;
|
|
22643
23296
|
}
|
|
23297
|
+
if (customDialog) {
|
|
23298
|
+
return;
|
|
23299
|
+
}
|
|
22644
23300
|
if (conversationRuntime) {
|
|
22645
23301
|
if (promptInputPreparing || localShellExecuting || isProcessing || conversationSnapshot.busy) {
|
|
22646
23302
|
cancelOngoingRequest();
|
|
@@ -22718,9 +23374,9 @@ ${queuedText}` : queuedText;
|
|
|
22718
23374
|
approvalRuntime,
|
|
22719
23375
|
pendingUserQuestion,
|
|
22720
23376
|
userQuestionRuntime,
|
|
23377
|
+
customDialog,
|
|
22721
23378
|
activePtyId,
|
|
22722
23379
|
embeddedShellFocused,
|
|
22723
|
-
settings.merged.general.debugKeystrokeLogging,
|
|
22724
23380
|
refreshStatic,
|
|
22725
23381
|
setCopyModeEnabled,
|
|
22726
23382
|
copyModeEnabled,
|
|
@@ -22729,7 +23385,7 @@ ${queuedText}` : queuedText;
|
|
|
22729
23385
|
]
|
|
22730
23386
|
);
|
|
22731
23387
|
useKeypress(handleGlobalKeypress, { isActive: true });
|
|
22732
|
-
|
|
23388
|
+
useEffect54(() => {
|
|
22733
23389
|
if (settings.merged.ui.hideWindowTitle) return;
|
|
22734
23390
|
const paddedTitle = computeTerminalTitle({
|
|
22735
23391
|
streamingState,
|
|
@@ -22753,7 +23409,7 @@ ${queuedText}` : queuedText;
|
|
|
22753
23409
|
config,
|
|
22754
23410
|
stdout
|
|
22755
23411
|
]);
|
|
22756
|
-
|
|
23412
|
+
useEffect54(() => {
|
|
22757
23413
|
const handleUserFeedback = (payload) => {
|
|
22758
23414
|
let type;
|
|
22759
23415
|
switch (payload.severity) {
|
|
@@ -22791,23 +23447,23 @@ ${queuedText}` : queuedText;
|
|
|
22791
23447
|
coreEvents.off(CoreEvent.UserFeedback, handleUserFeedback);
|
|
22792
23448
|
};
|
|
22793
23449
|
}, [historyManager]);
|
|
22794
|
-
const filteredConsoleMessages =
|
|
23450
|
+
const filteredConsoleMessages = useMemo34(() => {
|
|
22795
23451
|
if (config.getDebugMode()) {
|
|
22796
23452
|
return consoleMessages;
|
|
22797
23453
|
}
|
|
22798
23454
|
return consoleMessages.filter((msg) => msg.type !== "debug");
|
|
22799
23455
|
}, [consoleMessages, config]);
|
|
22800
|
-
const errorCount =
|
|
23456
|
+
const errorCount = useMemo34(
|
|
22801
23457
|
() => filteredConsoleMessages.filter((msg) => msg.type === "error").reduce((total, msg) => total + msg.count, 0),
|
|
22802
23458
|
[filteredConsoleMessages]
|
|
22803
23459
|
);
|
|
22804
23460
|
const nightly = props.version.includes("nightly");
|
|
22805
23461
|
const dialogsVisible = pendingUserQuestion !== void 0 || !!confirmationRequest || !!customDialog || isThemeDialogOpen || isSettingsDialogOpen || isEditorDialogOpen;
|
|
22806
|
-
const pendingHistoryItems =
|
|
23462
|
+
const pendingHistoryItems = useMemo34(
|
|
22807
23463
|
() => pendingShellHistoryItem ? [pendingShellHistoryItem] : [],
|
|
22808
23464
|
[pendingShellHistoryItem]
|
|
22809
23465
|
);
|
|
22810
|
-
const uiState =
|
|
23466
|
+
const uiState = useMemo34(
|
|
22811
23467
|
() => ({
|
|
22812
23468
|
history: historyManager.history,
|
|
22813
23469
|
isThemeDialogOpen,
|
|
@@ -22929,7 +23585,7 @@ ${queuedText}` : queuedText;
|
|
|
22929
23585
|
settingsNonce
|
|
22930
23586
|
]
|
|
22931
23587
|
);
|
|
22932
|
-
const uiActions =
|
|
23588
|
+
const uiActions = useMemo34(
|
|
22933
23589
|
() => ({
|
|
22934
23590
|
handleThemeSelect,
|
|
22935
23591
|
closeThemeDialog,
|
|
@@ -22971,22 +23627,22 @@ ${queuedText}` : queuedText;
|
|
|
22971
23627
|
setEmbeddedShellFocused
|
|
22972
23628
|
]
|
|
22973
23629
|
);
|
|
22974
|
-
return /* @__PURE__ */
|
|
23630
|
+
return /* @__PURE__ */ jsx94(UIStateContext.Provider, { value: uiState, children: /* @__PURE__ */ jsx94(UIActionsContext.Provider, { value: uiActions, children: /* @__PURE__ */ jsx94(ConfigContext.Provider, { value: config, children: /* @__PURE__ */ jsx94(
|
|
22975
23631
|
AppContext.Provider,
|
|
22976
23632
|
{
|
|
22977
23633
|
value: {
|
|
22978
23634
|
version: props.version,
|
|
22979
23635
|
startupWarnings: props.startupWarnings || []
|
|
22980
23636
|
},
|
|
22981
|
-
children: /* @__PURE__ */
|
|
23637
|
+
children: /* @__PURE__ */ jsx94(ApprovalRuntimeProvider, { runtime: approvalRuntime, children: /* @__PURE__ */ jsx94(UserQuestionRuntimeProvider, { runtime: userQuestionRuntime, children: /* @__PURE__ */ jsx94(ShellFocusContext.Provider, { value: isFocused, children: /* @__PURE__ */ jsx94(App, {}) }) }) })
|
|
22982
23638
|
}
|
|
22983
23639
|
) }) }) });
|
|
22984
23640
|
};
|
|
22985
23641
|
|
|
22986
23642
|
// src/ui/root.tsx
|
|
22987
|
-
import
|
|
23643
|
+
import React21 from "react";
|
|
22988
23644
|
import { render } from "ink";
|
|
22989
|
-
import { jsx as
|
|
23645
|
+
import { jsx as jsx95 } from "react/jsx-runtime";
|
|
22990
23646
|
var SLOW_RENDER_MS = 200;
|
|
22991
23647
|
function validateDnsResolutionOrder(order) {
|
|
22992
23648
|
const defaultValue = "ipv4first";
|
|
@@ -23018,7 +23674,7 @@ ${reason.stack}` : ""}`;
|
|
|
23018
23674
|
}
|
|
23019
23675
|
});
|
|
23020
23676
|
}
|
|
23021
|
-
async function startInteractiveUI(config, settings, startupWarnings, workspaceRoot = process.cwd(), initializationResult, conversationRuntime, approvalRuntime, userQuestionRuntime, commandRuntime, permissionSelectionRuntime, toolCatalogRuntime, promptCompletionRuntime, promptInputRuntime, modelSelectionRuntime, sessionManagementRuntime, initialPrompt) {
|
|
23677
|
+
async function startInteractiveUI(config, settings, startupWarnings, workspaceRoot = process.cwd(), initializationResult, conversationRuntime, approvalRuntime, userQuestionRuntime, commandRuntime, permissionSelectionRuntime, toolCatalogRuntime, promptCompletionRuntime, promptInputRuntime, modelSelectionRuntime, sessionManagementRuntime, initialPrompt, providerSetupRuntime) {
|
|
23022
23678
|
const useAlternateBuffer2 = shouldEnterAlternateScreen(
|
|
23023
23679
|
isAlternateBufferEnabled(settings),
|
|
23024
23680
|
config.getScreenReader()
|
|
@@ -23034,17 +23690,17 @@ async function startInteractiveUI(config, settings, startupWarnings, workspaceRo
|
|
|
23034
23690
|
const version = await getVersion();
|
|
23035
23691
|
const AppWrapper = () => {
|
|
23036
23692
|
useKittyKeyboardProtocol();
|
|
23037
|
-
return /* @__PURE__ */
|
|
23693
|
+
return /* @__PURE__ */ jsx95(SettingsContext.Provider, { value: settings, children: /* @__PURE__ */ jsx95(
|
|
23038
23694
|
KeypressProvider,
|
|
23039
23695
|
{
|
|
23040
23696
|
config,
|
|
23041
23697
|
debugKeystrokeLogging: settings.merged.general.debugKeystrokeLogging,
|
|
23042
|
-
children: /* @__PURE__ */
|
|
23698
|
+
children: /* @__PURE__ */ jsx95(
|
|
23043
23699
|
MouseProvider,
|
|
23044
23700
|
{
|
|
23045
23701
|
mouseEventsEnabled,
|
|
23046
23702
|
debugKeystrokeLogging: settings.merged.general.debugKeystrokeLogging,
|
|
23047
|
-
children: /* @__PURE__ */
|
|
23703
|
+
children: /* @__PURE__ */ jsx95(ScrollProvider, { children: /* @__PURE__ */ jsx95(SessionStatsProvider, { conversationRuntime, children: /* @__PURE__ */ jsx95(VimModeProvider, { settings, children: /* @__PURE__ */ jsx95(
|
|
23048
23704
|
AppContainer,
|
|
23049
23705
|
{
|
|
23050
23706
|
config,
|
|
@@ -23055,6 +23711,7 @@ async function startInteractiveUI(config, settings, startupWarnings, workspaceRo
|
|
|
23055
23711
|
promptCompletionRuntime,
|
|
23056
23712
|
promptInputRuntime,
|
|
23057
23713
|
modelSelectionRuntime,
|
|
23714
|
+
providerSetupRuntime,
|
|
23058
23715
|
sessionManagementRuntime,
|
|
23059
23716
|
approvalRuntime,
|
|
23060
23717
|
userQuestionRuntime,
|
|
@@ -23071,7 +23728,7 @@ async function startInteractiveUI(config, settings, startupWarnings, workspaceRo
|
|
|
23071
23728
|
};
|
|
23072
23729
|
const { stdout: inkStdout, stderr: inkStderr } = createWorkingStdio();
|
|
23073
23730
|
const instance = render(
|
|
23074
|
-
process.env["DEBUG"] ? /* @__PURE__ */
|
|
23731
|
+
process.env["DEBUG"] ? /* @__PURE__ */ jsx95(React21.StrictMode, { children: /* @__PURE__ */ jsx95(AppWrapper, {}) }) : /* @__PURE__ */ jsx95(AppWrapper, {}),
|
|
23075
23732
|
{
|
|
23076
23733
|
stdout: inkStdout,
|
|
23077
23734
|
stderr: inkStderr,
|
|
@@ -23176,7 +23833,8 @@ async function main(options) {
|
|
|
23176
23833
|
options.promptInputRuntime,
|
|
23177
23834
|
options.modelSelectionRuntime,
|
|
23178
23835
|
options.sessionManagementRuntime,
|
|
23179
|
-
options.initialPrompt
|
|
23836
|
+
options.initialPrompt,
|
|
23837
|
+
options.providerSetupRuntime
|
|
23180
23838
|
);
|
|
23181
23839
|
}
|
|
23182
23840
|
}
|
|
@@ -24855,6 +25513,175 @@ var DshPermissionSelectionRuntime = class {
|
|
|
24855
25513
|
}
|
|
24856
25514
|
};
|
|
24857
25515
|
|
|
25516
|
+
// src/dsh/provider-setup-runtime.ts
|
|
25517
|
+
import { credentialRef } from "@deepseek-ai/dsh-credentials";
|
|
25518
|
+
var DEEPSEEK_SETTINGS_NAMESPACE = "llm-deepseek";
|
|
25519
|
+
var DEFAULT_DEEPSEEK_CREDENTIAL = "DEEPSEEK_API_KEY";
|
|
25520
|
+
function throwIfAborted2(signal) {
|
|
25521
|
+
if (signal?.aborted) {
|
|
25522
|
+
throw new DOMException("The operation was aborted.", "AbortError");
|
|
25523
|
+
}
|
|
25524
|
+
}
|
|
25525
|
+
function valueAtPath(value, path16) {
|
|
25526
|
+
let current = value;
|
|
25527
|
+
for (const segment of path16) {
|
|
25528
|
+
if (typeof current !== "object" || current === null) return void 0;
|
|
25529
|
+
current = current[segment];
|
|
25530
|
+
}
|
|
25531
|
+
return current;
|
|
25532
|
+
}
|
|
25533
|
+
var DshProviderSetupRuntime = class _DshProviderSetupRuntime {
|
|
25534
|
+
constructor(credentials, settings, llm, currentProvider, current) {
|
|
25535
|
+
this.credentials = credentials;
|
|
25536
|
+
this.settings = settings;
|
|
25537
|
+
this.llm = llm;
|
|
25538
|
+
this.currentProvider = currentProvider;
|
|
25539
|
+
this.snapshot = { current };
|
|
25540
|
+
}
|
|
25541
|
+
listeners = /* @__PURE__ */ new Set();
|
|
25542
|
+
snapshot;
|
|
25543
|
+
static async create(credentials, settings, llm, currentProvider) {
|
|
25544
|
+
const provider = currentProvider();
|
|
25545
|
+
const runtime = new _DshProviderSetupRuntime(
|
|
25546
|
+
credentials,
|
|
25547
|
+
settings,
|
|
25548
|
+
llm,
|
|
25549
|
+
currentProvider,
|
|
25550
|
+
{
|
|
25551
|
+
provider,
|
|
25552
|
+
displayName: provider,
|
|
25553
|
+
status: "unsupported",
|
|
25554
|
+
writable: false
|
|
25555
|
+
}
|
|
25556
|
+
);
|
|
25557
|
+
await runtime.refreshCurrent();
|
|
25558
|
+
return runtime;
|
|
25559
|
+
}
|
|
25560
|
+
getSnapshot = () => this.snapshot;
|
|
25561
|
+
subscribe = (listener) => {
|
|
25562
|
+
this.listeners.add(listener);
|
|
25563
|
+
return () => this.listeners.delete(listener);
|
|
25564
|
+
};
|
|
25565
|
+
async listProviders(signal) {
|
|
25566
|
+
throwIfAborted2(signal);
|
|
25567
|
+
return Promise.all(
|
|
25568
|
+
this.llm.listConfigurableProviders().map(async (entry) => {
|
|
25569
|
+
try {
|
|
25570
|
+
return await this.describeProvider(entry.provider, signal);
|
|
25571
|
+
} catch (error) {
|
|
25572
|
+
if (signal?.aborted) throw error;
|
|
25573
|
+
return {
|
|
25574
|
+
provider: entry.provider,
|
|
25575
|
+
displayName: entry.displayName,
|
|
25576
|
+
status: "error",
|
|
25577
|
+
writable: false,
|
|
25578
|
+
message: error instanceof Error ? error.message : "Provider configuration could not be inspected."
|
|
25579
|
+
};
|
|
25580
|
+
}
|
|
25581
|
+
})
|
|
25582
|
+
);
|
|
25583
|
+
}
|
|
25584
|
+
async describeProvider(provider, signal) {
|
|
25585
|
+
throwIfAborted2(signal);
|
|
25586
|
+
const entry = this.llm.listConfigurableProviders().find((candidate) => candidate.provider === provider);
|
|
25587
|
+
if (!entry) {
|
|
25588
|
+
return {
|
|
25589
|
+
provider,
|
|
25590
|
+
displayName: provider,
|
|
25591
|
+
status: "unsupported",
|
|
25592
|
+
writable: false,
|
|
25593
|
+
message: "This provider does not expose DSH-managed setup."
|
|
25594
|
+
};
|
|
25595
|
+
}
|
|
25596
|
+
const credentialName = this.credentialName(entry);
|
|
25597
|
+
if (!credentialName) {
|
|
25598
|
+
return {
|
|
25599
|
+
provider,
|
|
25600
|
+
displayName: entry.displayName,
|
|
25601
|
+
status: "unsupported",
|
|
25602
|
+
writable: false,
|
|
25603
|
+
message: "This provider uses a setup flow that is not available in DSH Console yet."
|
|
25604
|
+
};
|
|
25605
|
+
}
|
|
25606
|
+
const info = await this.credentials.describe(credentialRef(credentialName));
|
|
25607
|
+
throwIfAborted2(signal);
|
|
25608
|
+
return {
|
|
25609
|
+
provider,
|
|
25610
|
+
displayName: entry.displayName,
|
|
25611
|
+
status: info.configured ? "configured" : "missing",
|
|
25612
|
+
credentialLabel: credentialName,
|
|
25613
|
+
...info.source === void 0 ? {} : { source: info.source },
|
|
25614
|
+
writable: info.writable
|
|
25615
|
+
};
|
|
25616
|
+
}
|
|
25617
|
+
async configure(provider, value, signal) {
|
|
25618
|
+
const normalized = value.trim();
|
|
25619
|
+
if (normalized.length === 0) throw new Error("API key cannot be empty.");
|
|
25620
|
+
if (normalized.length > 16384) throw new Error("API key is too long.");
|
|
25621
|
+
throwIfAborted2(signal);
|
|
25622
|
+
const before = await this.describeProvider(provider, signal);
|
|
25623
|
+
if (!before.credentialLabel || before.status === "unsupported") {
|
|
25624
|
+
throw new Error(
|
|
25625
|
+
before.message ?? "This provider cannot be configured here."
|
|
25626
|
+
);
|
|
25627
|
+
}
|
|
25628
|
+
if (!before.writable) {
|
|
25629
|
+
throw new Error(
|
|
25630
|
+
`${before.credentialLabel} is supplied by a read-only source and cannot be changed here.`
|
|
25631
|
+
);
|
|
25632
|
+
}
|
|
25633
|
+
try {
|
|
25634
|
+
await this.credentials.set(
|
|
25635
|
+
credentialRef(before.credentialLabel),
|
|
25636
|
+
normalized
|
|
25637
|
+
);
|
|
25638
|
+
} catch {
|
|
25639
|
+
throw new Error(
|
|
25640
|
+
`Unable to save ${before.credentialLabel} through the DSH credentials service.`
|
|
25641
|
+
);
|
|
25642
|
+
}
|
|
25643
|
+
const configured = await this.describeProvider(provider);
|
|
25644
|
+
if (provider === this.currentProvider()) this.publish(configured);
|
|
25645
|
+
throwIfAborted2(signal);
|
|
25646
|
+
return configured;
|
|
25647
|
+
}
|
|
25648
|
+
async refreshCurrent(signal) {
|
|
25649
|
+
const provider = this.currentProvider();
|
|
25650
|
+
try {
|
|
25651
|
+
this.publish(await this.describeProvider(provider, signal));
|
|
25652
|
+
} catch (error) {
|
|
25653
|
+
if (signal?.aborted) throw error;
|
|
25654
|
+
this.publish({
|
|
25655
|
+
provider,
|
|
25656
|
+
displayName: provider,
|
|
25657
|
+
status: "error",
|
|
25658
|
+
writable: false,
|
|
25659
|
+
message: error instanceof Error ? error.message : "Provider configuration failed."
|
|
25660
|
+
});
|
|
25661
|
+
}
|
|
25662
|
+
}
|
|
25663
|
+
credentialName(entry) {
|
|
25664
|
+
if (String(entry.settingsNs) !== DEEPSEEK_SETTINGS_NAMESPACE) {
|
|
25665
|
+
return void 0;
|
|
25666
|
+
}
|
|
25667
|
+
const descriptor = this.settings.describe({ redactSecrets: true }).find(
|
|
25668
|
+
(candidate) => String(candidate.ns) === String(entry.settingsNs)
|
|
25669
|
+
);
|
|
25670
|
+
const profile = valueAtPath(descriptor?.value, entry.settingsPath);
|
|
25671
|
+
if (typeof profile === "object" && profile !== null) {
|
|
25672
|
+
const configured = profile["apiKeyEnv"];
|
|
25673
|
+
if (typeof configured === "string" && configured.length > 0) {
|
|
25674
|
+
return configured;
|
|
25675
|
+
}
|
|
25676
|
+
}
|
|
25677
|
+
return DEFAULT_DEEPSEEK_CREDENTIAL;
|
|
25678
|
+
}
|
|
25679
|
+
publish(current) {
|
|
25680
|
+
this.snapshot = { current };
|
|
25681
|
+
for (const listener of this.listeners) listener();
|
|
25682
|
+
}
|
|
25683
|
+
};
|
|
25684
|
+
|
|
24858
25685
|
// src/dsh/index.ts
|
|
24859
25686
|
var name = "dsh-console-runner";
|
|
24860
25687
|
var inject = [
|
|
@@ -24868,7 +25695,9 @@ var inject = [
|
|
|
24868
25695
|
"approval",
|
|
24869
25696
|
"userQuestions",
|
|
24870
25697
|
"commands",
|
|
24871
|
-
"sessionProjections"
|
|
25698
|
+
"sessionProjections",
|
|
25699
|
+
"credentials",
|
|
25700
|
+
"settings"
|
|
24872
25701
|
];
|
|
24873
25702
|
var Config2 = z2.object({
|
|
24874
25703
|
prompt: z2.string(),
|
|
@@ -24893,6 +25722,8 @@ async function start(ctx, config) {
|
|
|
24893
25722
|
const commands = ctx.get("commands");
|
|
24894
25723
|
const sessionProjections = ctx.get("sessionProjections");
|
|
24895
25724
|
const appExit = ctx.get("appExit");
|
|
25725
|
+
const credentials = ctx.get("credentials");
|
|
25726
|
+
const settings = ctx.get("settings");
|
|
24896
25727
|
if (!attachments)
|
|
24897
25728
|
throw new Error("dsh-console requires the DSH attachment service");
|
|
24898
25729
|
if (!sessionQuery)
|
|
@@ -24905,6 +25736,10 @@ async function start(ctx, config) {
|
|
|
24905
25736
|
throw new Error("dsh-console requires the DSH commands service");
|
|
24906
25737
|
if (!sessionProjections)
|
|
24907
25738
|
throw new Error("dsh-console requires the DSH Session projection service");
|
|
25739
|
+
if (!credentials)
|
|
25740
|
+
throw new Error("dsh-console requires the DSH credentials service");
|
|
25741
|
+
if (!settings)
|
|
25742
|
+
throw new Error("dsh-console requires the DSH settings service");
|
|
24908
25743
|
if (!agents || !defaultModel || !sessions || !tools || !llm || !appExit)
|
|
24909
25744
|
return;
|
|
24910
25745
|
const selection = defaultModel.currentSelection();
|
|
@@ -24981,6 +25816,12 @@ async function start(ctx, config) {
|
|
|
24981
25816
|
}
|
|
24982
25817
|
};
|
|
24983
25818
|
let active = await createActiveConversation(selection);
|
|
25819
|
+
const providerSetupRuntime = await DshProviderSetupRuntime.create(
|
|
25820
|
+
credentials,
|
|
25821
|
+
settings,
|
|
25822
|
+
llm,
|
|
25823
|
+
() => activeSelection.provider
|
|
25824
|
+
);
|
|
24984
25825
|
const approvalRuntime = new DshApprovalRuntime(
|
|
24985
25826
|
(listener) => ctx.on("approval/request", listener),
|
|
24986
25827
|
(agent) => agent === active.handle.agent
|
|
@@ -25039,6 +25880,7 @@ async function start(ctx, config) {
|
|
|
25039
25880
|
previous.offProjector();
|
|
25040
25881
|
active = next;
|
|
25041
25882
|
activeSelection = selected;
|
|
25883
|
+
await providerSetupRuntime.refreshCurrent();
|
|
25042
25884
|
commandRuntime.activeAgentChanged();
|
|
25043
25885
|
permissionSelectionRuntime.activeAgentChanged();
|
|
25044
25886
|
toolCatalogRuntime.activeAgentChanged();
|
|
@@ -25175,6 +26017,7 @@ async function start(ctx, config) {
|
|
|
25175
26017
|
promptCompletionRuntime,
|
|
25176
26018
|
promptInputRuntime,
|
|
25177
26019
|
modelSelectionRuntime,
|
|
26020
|
+
providerSetupRuntime,
|
|
25178
26021
|
sessionManagementRuntime,
|
|
25179
26022
|
approvalRuntime,
|
|
25180
26023
|
userQuestionRuntime,
|