@cofy-x/dsh-console 0.1.0-alpha.17 → 0.1.0-alpha.19
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +4 -2
- package/THIRD_PARTY_NOTICES.md +47 -31
- package/cordis.patch.yml +2 -2
- package/dist/CHANGELOG.md +23 -1
- package/dist/{chunk-4JD6IIIC.js → chunk-XTTAN4G5.js} +164 -161
- package/dist/dsh/index.js +1 -1
- package/dist/index.js +1 -1
- package/dist/presets/cordis.patch.yml +154 -0
- package/dist/presets/minimal.patch.yml +61 -0
- package/dist/presets/ptc.patch.yml +152 -0
- package/dist/presets/standard.patch.yml +146 -0
- package/package.json +68 -61
|
@@ -78,7 +78,6 @@ import {
|
|
|
78
78
|
import { z as zod } from "zod";
|
|
79
79
|
import { createUserMessage as createUserMessage2 } from "@deepseek-ai/dsh-llm";
|
|
80
80
|
import {
|
|
81
|
-
SessionLogOffset as SessionLogOffset2,
|
|
82
81
|
SessionId as SessionId5
|
|
83
82
|
} from "@deepseek-ai/dsh-session";
|
|
84
83
|
|
|
@@ -2449,8 +2448,8 @@ import {
|
|
|
2449
2448
|
useMemo as useMemo43,
|
|
2450
2449
|
useState as useState63,
|
|
2451
2450
|
useCallback as useCallback51,
|
|
2452
|
-
useEffect as
|
|
2453
|
-
useRef as
|
|
2451
|
+
useEffect as useEffect60,
|
|
2452
|
+
useRef as useRef37,
|
|
2454
2453
|
useLayoutEffect as useLayoutEffect5,
|
|
2455
2454
|
useSyncExternalStore as useSyncExternalStore10
|
|
2456
2455
|
} from "react";
|
|
@@ -6427,7 +6426,7 @@ import { Box as Box25 } from "ink";
|
|
|
6427
6426
|
import { Box as Box21, Text as Text21 } from "ink";
|
|
6428
6427
|
|
|
6429
6428
|
// src/generated/git-commit.ts
|
|
6430
|
-
var GIT_COMMIT_INFO = "
|
|
6429
|
+
var GIT_COMMIT_INFO = "649cfc6";
|
|
6431
6430
|
|
|
6432
6431
|
// src/ui/components/dialogs/about-box.tsx
|
|
6433
6432
|
import { jsx as jsx28, jsxs as jsxs21 } from "react/jsx-runtime";
|
|
@@ -19712,7 +19711,7 @@ function useHistory() {
|
|
|
19712
19711
|
}
|
|
19713
19712
|
|
|
19714
19713
|
// src/ui/hooks/commands/use-slash-command-processor.ts
|
|
19715
|
-
import { useCallback as useCallback41, useMemo as useMemo41, useEffect as
|
|
19714
|
+
import { useCallback as useCallback41, useMemo as useMemo41, useEffect as useEffect49, useRef as useRef28, useState as useState51 } from "react";
|
|
19716
19715
|
|
|
19717
19716
|
// src/services/command-service.ts
|
|
19718
19717
|
var CommandService = class _CommandService {
|
|
@@ -22515,7 +22514,14 @@ var agentsCommand = {
|
|
|
22515
22514
|
import React25 from "react";
|
|
22516
22515
|
|
|
22517
22516
|
// src/ui/components/dialogs/agent-preset-dialog.tsx
|
|
22518
|
-
import {
|
|
22517
|
+
import {
|
|
22518
|
+
useCallback as useCallback40,
|
|
22519
|
+
useEffect as useEffect45,
|
|
22520
|
+
useMemo as useMemo39,
|
|
22521
|
+
useRef as useRef26,
|
|
22522
|
+
useState as useState47,
|
|
22523
|
+
useSyncExternalStore as useSyncExternalStore6
|
|
22524
|
+
} from "react";
|
|
22519
22525
|
import { Box as Box82, Text as Text77 } from "ink";
|
|
22520
22526
|
import { Fragment as Fragment28, jsx as jsx105, jsxs as jsxs79 } from "react/jsx-runtime";
|
|
22521
22527
|
function AgentPresetDialog({
|
|
@@ -22530,7 +22536,18 @@ function AgentPresetDialog({
|
|
|
22530
22536
|
);
|
|
22531
22537
|
const [highlighted, setHighlighted] = useState47();
|
|
22532
22538
|
const [error, setError] = useState47();
|
|
22533
|
-
const
|
|
22539
|
+
const selectionController = useRef26(void 0);
|
|
22540
|
+
useEffect45(
|
|
22541
|
+
() => () => {
|
|
22542
|
+
selectionController.current?.abort();
|
|
22543
|
+
},
|
|
22544
|
+
[runtime]
|
|
22545
|
+
);
|
|
22546
|
+
const close = useCallback40(() => {
|
|
22547
|
+
selectionController.current?.abort();
|
|
22548
|
+
onClose();
|
|
22549
|
+
}, [onClose]);
|
|
22550
|
+
const selected = snapshot.options.find((item) => item.id === highlighted?.id) ?? snapshot.options.find((item) => item.id === snapshot.currentId) ?? snapshot.options[0];
|
|
22534
22551
|
const items = useMemo39(
|
|
22535
22552
|
() => snapshot.options.map((option) => ({
|
|
22536
22553
|
key: option.id,
|
|
@@ -22545,26 +22562,29 @@ function AgentPresetDialog({
|
|
|
22545
22562
|
);
|
|
22546
22563
|
const selectPreset = useCallback40(
|
|
22547
22564
|
async (option) => {
|
|
22565
|
+
if (selectionController.current !== void 0 || snapshot.busy) return;
|
|
22566
|
+
const controller = new AbortController();
|
|
22567
|
+
selectionController.current = controller;
|
|
22548
22568
|
setError(void 0);
|
|
22549
|
-
if (option.broken !== void 0) {
|
|
22550
|
-
setError(`This preset is unavailable: ${option.broken}`);
|
|
22551
|
-
return;
|
|
22552
|
-
}
|
|
22553
|
-
if (option.id === snapshot.currentId) {
|
|
22554
|
-
onClose();
|
|
22555
|
-
return;
|
|
22556
|
-
}
|
|
22557
22569
|
try {
|
|
22558
|
-
|
|
22570
|
+
const selection = await runtime.select(option.id, controller.signal);
|
|
22571
|
+
if (controller.signal.aborted) return;
|
|
22572
|
+
if (selection.id === snapshot.currentId) close();
|
|
22573
|
+
else onSwitched(selection);
|
|
22559
22574
|
} catch (cause) {
|
|
22575
|
+
if (controller.signal.aborted) return;
|
|
22560
22576
|
setError(cause instanceof Error ? cause.message : String(cause));
|
|
22577
|
+
} finally {
|
|
22578
|
+
if (selectionController.current === controller) {
|
|
22579
|
+
selectionController.current = void 0;
|
|
22580
|
+
}
|
|
22561
22581
|
}
|
|
22562
22582
|
},
|
|
22563
|
-
[
|
|
22583
|
+
[close, onSwitched, runtime, snapshot.currentId, snapshot.busy]
|
|
22564
22584
|
);
|
|
22565
22585
|
useKeypress(
|
|
22566
22586
|
(key) => {
|
|
22567
|
-
if (key.name === "escape" && !snapshot.busy)
|
|
22587
|
+
if (key.name === "escape" && !snapshot.busy) close();
|
|
22568
22588
|
},
|
|
22569
22589
|
{ isActive: true }
|
|
22570
22590
|
);
|
|
@@ -22580,7 +22600,7 @@ function AgentPresetDialog({
|
|
|
22580
22600
|
children: [
|
|
22581
22601
|
/* @__PURE__ */ jsxs79(Box82, { justifyContent: "space-between", children: [
|
|
22582
22602
|
/* @__PURE__ */ jsx105(Text77, { bold: true, color: theme.text.primary, children: "Select DSH Agent Preset" }),
|
|
22583
|
-
/* @__PURE__ */ jsx105(DialogCloseAction, { onClose, isActive: !snapshot.busy })
|
|
22603
|
+
/* @__PURE__ */ jsx105(DialogCloseAction, { onClose: close, isActive: !snapshot.busy })
|
|
22584
22604
|
] }),
|
|
22585
22605
|
(error ?? snapshot.error) && /* @__PURE__ */ jsx105(Box82, { marginTop: 1, children: /* @__PURE__ */ jsx105(Text77, { color: theme.status.error, children: error ?? snapshot.error }) }),
|
|
22586
22606
|
snapshot.options.length === 0 ? /* @__PURE__ */ jsx105(Box82, { marginTop: 1, children: /* @__PURE__ */ jsx105(Text77, { color: theme.text.secondary, children: "No Agent presets are available." }) }) : /* @__PURE__ */ jsxs79(Box82, { flexDirection: "row", marginTop: 1, children: [
|
|
@@ -22591,7 +22611,7 @@ function AgentPresetDialog({
|
|
|
22591
22611
|
initialIndex,
|
|
22592
22612
|
onHighlight: setHighlighted,
|
|
22593
22613
|
onSelect: (option) => void selectPreset(option),
|
|
22594
|
-
isFocused: !snapshot.busy,
|
|
22614
|
+
isFocused: !snapshot.busy && snapshot.status === "ready",
|
|
22595
22615
|
showNumbers: false,
|
|
22596
22616
|
renderItem: (item, { titleColor }) => /* @__PURE__ */ jsxs79(
|
|
22597
22617
|
Text77,
|
|
@@ -22610,11 +22630,7 @@ function AgentPresetDialog({
|
|
|
22610
22630
|
) }),
|
|
22611
22631
|
/* @__PURE__ */ jsx105(Box82, { width: "50%", paddingLeft: 2, flexDirection: "column", children: selected && /* @__PURE__ */ jsxs79(Fragment28, { children: [
|
|
22612
22632
|
/* @__PURE__ */ jsx105(Text77, { bold: true, color: theme.text.accent, children: selected.name }),
|
|
22613
|
-
/* @__PURE__ */
|
|
22614
|
-
selected.id,
|
|
22615
|
-
" \xB7 ",
|
|
22616
|
-
selected.trust
|
|
22617
|
-
] }),
|
|
22633
|
+
/* @__PURE__ */ jsx105(Text77, { color: theme.text.secondary, children: selected.id }),
|
|
22618
22634
|
/* @__PURE__ */ jsx105(Box82, { marginTop: 1, children: /* @__PURE__ */ jsx105(Text77, { wrap: "wrap", children: selected.description ?? "No description is available for this preset." }) }),
|
|
22619
22635
|
selected.broken && /* @__PURE__ */ jsx105(Box82, { marginTop: 1, children: /* @__PURE__ */ jsx105(Text77, { color: theme.status.warning, children: selected.broken }) }),
|
|
22620
22636
|
snapshot.busy && /* @__PURE__ */ jsx105(Box82, { marginTop: 1, children: /* @__PURE__ */ jsx105(Text77, { color: theme.text.accent, children: "Applying preset..." }) })
|
|
@@ -22656,13 +22672,6 @@ var presetCommand = {
|
|
|
22656
22672
|
};
|
|
22657
22673
|
}
|
|
22658
22674
|
await runtime.prepare(context.invocation.signal);
|
|
22659
|
-
if (!runtime.getSnapshot().modeSelectionEnabled) {
|
|
22660
|
-
return {
|
|
22661
|
-
type: "message",
|
|
22662
|
-
messageType: "info",
|
|
22663
|
-
content: "Agent preset selection is disabled by the DSH host."
|
|
22664
|
-
};
|
|
22665
|
-
}
|
|
22666
22675
|
if (context.services.sideConversation?.getWorkspaceSnapshot().sideSessionId !== void 0) {
|
|
22667
22676
|
return {
|
|
22668
22677
|
type: "message",
|
|
@@ -22707,7 +22716,6 @@ var presetCommand = {
|
|
|
22707
22716
|
await runtime.prepare();
|
|
22708
22717
|
const prefix = partialArg.trimStart();
|
|
22709
22718
|
const snapshot = runtime.getSnapshot();
|
|
22710
|
-
if (!snapshot.modeSelectionEnabled) return [];
|
|
22711
22719
|
return snapshot.options.filter(
|
|
22712
22720
|
(option) => option.broken === void 0 && option.id.startsWith(prefix)
|
|
22713
22721
|
).map((option) => {
|
|
@@ -22724,7 +22732,7 @@ var presetCommand = {
|
|
|
22724
22732
|
import React26 from "react";
|
|
22725
22733
|
|
|
22726
22734
|
// src/ui/components/dialogs/skills-dialog.tsx
|
|
22727
|
-
import { useEffect as
|
|
22735
|
+
import { useEffect as useEffect46, useMemo as useMemo40, useState as useState48, useSyncExternalStore as useSyncExternalStore7 } from "react";
|
|
22728
22736
|
import { Box as Box83, Text as Text78 } from "ink";
|
|
22729
22737
|
import { Fragment as Fragment29, jsx as jsx106, jsxs as jsxs80 } from "react/jsx-runtime";
|
|
22730
22738
|
function summary2(value) {
|
|
@@ -22742,7 +22750,7 @@ function SkillsDialog({
|
|
|
22742
22750
|
);
|
|
22743
22751
|
const [selectedName, setSelectedName] = useState48(snapshot.skills[0]?.name);
|
|
22744
22752
|
const selected = snapshot.skills.find((skill) => skill.name === selectedName) ?? snapshot.skills[0];
|
|
22745
|
-
|
|
22753
|
+
useEffect46(() => {
|
|
22746
22754
|
if (selected?.name !== selectedName) setSelectedName(selected?.name);
|
|
22747
22755
|
}, [selected?.name, selectedName]);
|
|
22748
22756
|
useKeypress(
|
|
@@ -22847,7 +22855,7 @@ var skillsCommand = {
|
|
|
22847
22855
|
import React27 from "react";
|
|
22848
22856
|
|
|
22849
22857
|
// src/ui/components/dialogs/jobs-dialog.tsx
|
|
22850
|
-
import { useEffect as
|
|
22858
|
+
import { useEffect as useEffect47, useState as useState49, useSyncExternalStore as useSyncExternalStore8 } from "react";
|
|
22851
22859
|
import { Text as Text79 } from "ink";
|
|
22852
22860
|
import { Fragment as Fragment30, jsx as jsx107, jsxs as jsxs81 } from "react/jsx-runtime";
|
|
22853
22861
|
function JobsDialog({
|
|
@@ -22863,11 +22871,11 @@ function JobsDialog({
|
|
|
22863
22871
|
const [pending, setPending] = useState49();
|
|
22864
22872
|
const [error, setError] = useState49();
|
|
22865
22873
|
const [now, setNow] = useState49(Date.now);
|
|
22866
|
-
|
|
22874
|
+
useEffect47(() => {
|
|
22867
22875
|
const timer = setInterval(() => setNow(Date.now()), 1e3);
|
|
22868
22876
|
return () => clearInterval(timer);
|
|
22869
22877
|
}, []);
|
|
22870
|
-
|
|
22878
|
+
useEffect47(() => {
|
|
22871
22879
|
setSelectedId(void 0);
|
|
22872
22880
|
setPending(void 0);
|
|
22873
22881
|
setError(void 0);
|
|
@@ -22971,7 +22979,7 @@ function JobsDialog({
|
|
|
22971
22979
|
}
|
|
22972
22980
|
|
|
22973
22981
|
// src/ui/components/dialogs/goal-dialog.tsx
|
|
22974
|
-
import { useEffect as
|
|
22982
|
+
import { useEffect as useEffect48, useRef as useRef27, useState as useState50, useSyncExternalStore as useSyncExternalStore9 } from "react";
|
|
22975
22983
|
import { Box as Box84, Text as Text80 } from "ink";
|
|
22976
22984
|
import { Fragment as Fragment31, jsx as jsx108, jsxs as jsxs82 } from "react/jsx-runtime";
|
|
22977
22985
|
function GoalDialog({
|
|
@@ -22991,9 +22999,9 @@ function GoalDialog({
|
|
|
22991
22999
|
);
|
|
22992
23000
|
const [pending, setPending] = useState50();
|
|
22993
23001
|
const [error, setError] = useState50();
|
|
22994
|
-
const controller =
|
|
22995
|
-
const mounted =
|
|
22996
|
-
|
|
23002
|
+
const controller = useRef27(void 0);
|
|
23003
|
+
const mounted = useRef27(true);
|
|
23004
|
+
useEffect48(() => {
|
|
22997
23005
|
mounted.current = true;
|
|
22998
23006
|
return () => {
|
|
22999
23007
|
mounted.current = false;
|
|
@@ -23319,7 +23327,7 @@ var useSlashCommandProcessor = (addItem, clearItems, loadHistory, refreshStatic,
|
|
|
23319
23327
|
void 0
|
|
23320
23328
|
);
|
|
23321
23329
|
const [reloadTrigger, setReloadTrigger] = useState51(0);
|
|
23322
|
-
const commandAbortRef =
|
|
23330
|
+
const commandAbortRef = useRef28(void 0);
|
|
23323
23331
|
const reloadCommands = useCallback41(() => {
|
|
23324
23332
|
setReloadTrigger((v) => v + 1);
|
|
23325
23333
|
}, []);
|
|
@@ -23380,7 +23388,7 @@ var useSlashCommandProcessor = (addItem, clearItems, loadHistory, refreshStatic,
|
|
|
23380
23388
|
setCustomDialog
|
|
23381
23389
|
]
|
|
23382
23390
|
);
|
|
23383
|
-
|
|
23391
|
+
useEffect49(() => {
|
|
23384
23392
|
const controller = new AbortController();
|
|
23385
23393
|
(async () => {
|
|
23386
23394
|
const loaders = [
|
|
@@ -23398,15 +23406,15 @@ var useSlashCommandProcessor = (addItem, clearItems, loadHistory, refreshStatic,
|
|
|
23398
23406
|
controller.abort();
|
|
23399
23407
|
};
|
|
23400
23408
|
}, [dshCommands, enableProfiler, reloadTrigger, skillCatalog]);
|
|
23401
|
-
|
|
23409
|
+
useEffect49(
|
|
23402
23410
|
() => dshCommands?.subscribe(reloadCommands),
|
|
23403
23411
|
[dshCommands, reloadCommands]
|
|
23404
23412
|
);
|
|
23405
|
-
|
|
23413
|
+
useEffect49(
|
|
23406
23414
|
() => skillCatalog?.subscribe(reloadCommands),
|
|
23407
23415
|
[skillCatalog, reloadCommands]
|
|
23408
23416
|
);
|
|
23409
|
-
|
|
23417
|
+
useEffect49(() => () => commandAbortRef.current?.abort(), []);
|
|
23410
23418
|
const handleSlashCommand = useCallback41(
|
|
23411
23419
|
async (rawQuery, overwriteConfirmed, addToHistory = true, attachments = []) => {
|
|
23412
23420
|
if (!commands) {
|
|
@@ -23698,7 +23706,7 @@ var useThemeCommand = (loadedSettings, setThemeError, addItem, initialThemeError
|
|
|
23698
23706
|
};
|
|
23699
23707
|
|
|
23700
23708
|
// src/ui/hooks/input/use-vim.ts
|
|
23701
|
-
import { useCallback as useCallback44, useReducer as useReducer5, useEffect as
|
|
23709
|
+
import { useCallback as useCallback44, useReducer as useReducer5, useEffect as useEffect50, useRef as useRef29 } from "react";
|
|
23702
23710
|
var DIGIT_MULTIPLIER = 10;
|
|
23703
23711
|
var DEFAULT_COUNT = 1;
|
|
23704
23712
|
var DIGIT_1_TO_9 = /^[1-9]$/;
|
|
@@ -23763,8 +23771,8 @@ var vimReducer = (state, action) => {
|
|
|
23763
23771
|
function useVim(buffer, onSubmit) {
|
|
23764
23772
|
const { vimEnabled, vimMode, setVimMode } = useVimMode();
|
|
23765
23773
|
const [state, dispatch] = useReducer5(vimReducer, initialVimState);
|
|
23766
|
-
const lastEscapeTimestampRef =
|
|
23767
|
-
|
|
23774
|
+
const lastEscapeTimestampRef = useRef29(0);
|
|
23775
|
+
useEffect50(() => {
|
|
23768
23776
|
dispatch({ type: "SET_MODE", mode: vimMode });
|
|
23769
23777
|
}, [vimMode]);
|
|
23770
23778
|
const updateMode = useCallback44(
|
|
@@ -24263,7 +24271,7 @@ function useVim(buffer, onSubmit) {
|
|
|
24263
24271
|
}
|
|
24264
24272
|
|
|
24265
24273
|
// src/ui/hooks/session/use-git-branch-name.ts
|
|
24266
|
-
import { useState as useState54, useEffect as
|
|
24274
|
+
import { useState as useState54, useEffect as useEffect51, useCallback as useCallback45 } from "react";
|
|
24267
24275
|
import fs9 from "node:fs";
|
|
24268
24276
|
import fsPromises2 from "node:fs/promises";
|
|
24269
24277
|
import path11 from "node:path";
|
|
@@ -24291,7 +24299,7 @@ function useGitBranchName(cwd) {
|
|
|
24291
24299
|
setBranchName(void 0);
|
|
24292
24300
|
}
|
|
24293
24301
|
}, [cwd, setBranchName]);
|
|
24294
|
-
|
|
24302
|
+
useEffect51(() => {
|
|
24295
24303
|
fetchBranchName();
|
|
24296
24304
|
const gitLogsHeadPath = path11.join(cwd, ".git", "logs", "HEAD");
|
|
24297
24305
|
let watcher;
|
|
@@ -24371,12 +24379,12 @@ var useEditorSettings = (loadedSettings, setEditorError, addItem) => {
|
|
|
24371
24379
|
};
|
|
24372
24380
|
|
|
24373
24381
|
// src/ui/hooks/terminal/use-memory-monitor.ts
|
|
24374
|
-
import { useEffect as
|
|
24382
|
+
import { useEffect as useEffect52 } from "react";
|
|
24375
24383
|
import process7 from "node:process";
|
|
24376
24384
|
var MEMORY_WARNING_THRESHOLD = 7 * 1024 * 1024 * 1024;
|
|
24377
24385
|
var MEMORY_CHECK_INTERVAL = 60 * 1e3;
|
|
24378
24386
|
var useMemoryMonitor = ({ addItem }) => {
|
|
24379
|
-
|
|
24387
|
+
useEffect52(() => {
|
|
24380
24388
|
const intervalId = setInterval(() => {
|
|
24381
24389
|
const usage = process7.memoryUsage().rss;
|
|
24382
24390
|
if (usage > MEMORY_WARNING_THRESHOLD) {
|
|
@@ -24397,9 +24405,9 @@ var useMemoryMonitor = ({ addItem }) => {
|
|
|
24397
24405
|
// src/ui/hooks/visual/use-console-messages.ts
|
|
24398
24406
|
import {
|
|
24399
24407
|
useCallback as useCallback47,
|
|
24400
|
-
useEffect as
|
|
24408
|
+
useEffect as useEffect53,
|
|
24401
24409
|
useReducer as useReducer6,
|
|
24402
|
-
useRef as
|
|
24410
|
+
useRef as useRef30,
|
|
24403
24411
|
useTransition
|
|
24404
24412
|
} from "react";
|
|
24405
24413
|
function consoleMessagesReducer(state, action) {
|
|
@@ -24427,8 +24435,8 @@ function consoleMessagesReducer(state, action) {
|
|
|
24427
24435
|
}
|
|
24428
24436
|
function useConsoleMessages() {
|
|
24429
24437
|
const [consoleMessages, dispatch] = useReducer6(consoleMessagesReducer, []);
|
|
24430
|
-
const messageQueueRef =
|
|
24431
|
-
const timeoutRef =
|
|
24438
|
+
const messageQueueRef = useRef30([]);
|
|
24439
|
+
const timeoutRef = useRef30(null);
|
|
24432
24440
|
const [, startTransition] = useTransition();
|
|
24433
24441
|
const processQueue = useCallback47(() => {
|
|
24434
24442
|
if (messageQueueRef.current.length > 0) {
|
|
@@ -24449,7 +24457,7 @@ function useConsoleMessages() {
|
|
|
24449
24457
|
},
|
|
24450
24458
|
[processQueue]
|
|
24451
24459
|
);
|
|
24452
|
-
|
|
24460
|
+
useEffect53(() => {
|
|
24453
24461
|
const handleConsoleLog = (payload) => {
|
|
24454
24462
|
handleNewMessage({
|
|
24455
24463
|
type: payload.type,
|
|
@@ -24478,7 +24486,7 @@ function useConsoleMessages() {
|
|
|
24478
24486
|
dispatch({ type: "CLEAR" });
|
|
24479
24487
|
});
|
|
24480
24488
|
}, []);
|
|
24481
|
-
|
|
24489
|
+
useEffect53(
|
|
24482
24490
|
() => () => {
|
|
24483
24491
|
if (timeoutRef.current) {
|
|
24484
24492
|
clearTimeout(timeoutRef.current);
|
|
@@ -24490,13 +24498,13 @@ function useConsoleMessages() {
|
|
|
24490
24498
|
}
|
|
24491
24499
|
|
|
24492
24500
|
// src/ui/hooks/visual/use-timer.ts
|
|
24493
|
-
import { useState as useState56, useEffect as
|
|
24501
|
+
import { useState as useState56, useEffect as useEffect54, useRef as useRef31 } from "react";
|
|
24494
24502
|
var useTimer = (isActive, resetKey) => {
|
|
24495
24503
|
const [elapsedTime, setElapsedTime] = useState56(0);
|
|
24496
|
-
const timerRef =
|
|
24497
|
-
const prevResetKeyRef =
|
|
24498
|
-
const prevIsActiveRef =
|
|
24499
|
-
|
|
24504
|
+
const timerRef = useRef31(null);
|
|
24505
|
+
const prevResetKeyRef = useRef31(resetKey);
|
|
24506
|
+
const prevIsActiveRef = useRef31(isActive);
|
|
24507
|
+
useEffect54(() => {
|
|
24500
24508
|
let shouldResetTime = false;
|
|
24501
24509
|
if (prevResetKeyRef.current !== resetKey) {
|
|
24502
24510
|
shouldResetTime = true;
|
|
@@ -24533,7 +24541,7 @@ var useTimer = (isActive, resetKey) => {
|
|
|
24533
24541
|
};
|
|
24534
24542
|
|
|
24535
24543
|
// src/ui/hooks/visual/use-phrase-cycler.ts
|
|
24536
|
-
import { useState as useState57, useEffect as
|
|
24544
|
+
import { useState as useState57, useEffect as useEffect55, useRef as useRef32 } from "react";
|
|
24537
24545
|
|
|
24538
24546
|
// src/ui/components/indicators/loading-phrases.ts
|
|
24539
24547
|
var WITTY_LOADING_PHRASES = [
|
|
@@ -24678,9 +24686,9 @@ var usePhraseCycler = (isActive, shouldShowFocusHint, customPhrases) => {
|
|
|
24678
24686
|
const [currentLoadingPhrase, setCurrentLoadingPhrase] = useState57(
|
|
24679
24687
|
loadingPhrases[0]
|
|
24680
24688
|
);
|
|
24681
|
-
const phraseIntervalRef =
|
|
24682
|
-
const hasShownFirstRequestTipRef =
|
|
24683
|
-
|
|
24689
|
+
const phraseIntervalRef = useRef32(null);
|
|
24690
|
+
const hasShownFirstRequestTipRef = useRef32(false);
|
|
24691
|
+
useEffect55(() => {
|
|
24684
24692
|
if (phraseIntervalRef.current) {
|
|
24685
24693
|
clearInterval(phraseIntervalRef.current);
|
|
24686
24694
|
phraseIntervalRef.current = null;
|
|
@@ -24725,7 +24733,7 @@ var usePhraseCycler = (isActive, shouldShowFocusHint, customPhrases) => {
|
|
|
24725
24733
|
};
|
|
24726
24734
|
|
|
24727
24735
|
// src/ui/hooks/visual/use-loading-indicator.ts
|
|
24728
|
-
import { useState as useState58, useEffect as
|
|
24736
|
+
import { useState as useState58, useEffect as useEffect56, useRef as useRef33 } from "react";
|
|
24729
24737
|
var useLoadingIndicator = ({
|
|
24730
24738
|
streamingState,
|
|
24731
24739
|
shouldShowFocusHint,
|
|
@@ -24740,8 +24748,8 @@ var useLoadingIndicator = ({
|
|
|
24740
24748
|
shouldShowFocusHint,
|
|
24741
24749
|
customWittyPhrases
|
|
24742
24750
|
);
|
|
24743
|
-
const prevStreamingStateRef =
|
|
24744
|
-
|
|
24751
|
+
const prevStreamingStateRef = useRef33(null);
|
|
24752
|
+
useEffect56(() => {
|
|
24745
24753
|
if (streamingState === "idle" /* Idle */ && prevStreamingStateRef.current === "responding" /* Responding */) {
|
|
24746
24754
|
setTimerResetKey((prevKey) => prevKey + 1);
|
|
24747
24755
|
}
|
|
@@ -24754,7 +24762,7 @@ var useLoadingIndicator = ({
|
|
|
24754
24762
|
};
|
|
24755
24763
|
|
|
24756
24764
|
// src/ui/hooks/session/use-message-queue.ts
|
|
24757
|
-
import { useCallback as useCallback48, useEffect as
|
|
24765
|
+
import { useCallback as useCallback48, useEffect as useEffect57, useMemo as useMemo42, useState as useState59 } from "react";
|
|
24758
24766
|
function useMessageQueue({
|
|
24759
24767
|
queueKey,
|
|
24760
24768
|
streamingState,
|
|
@@ -24793,7 +24801,7 @@ function useMessageQueue({
|
|
|
24793
24801
|
);
|
|
24794
24802
|
return allMessages;
|
|
24795
24803
|
}, [messageQueue, queueKey]);
|
|
24796
|
-
|
|
24804
|
+
useEffect57(() => {
|
|
24797
24805
|
if (streamingState === "idle" /* Idle */ && messageQueue.length > 0) {
|
|
24798
24806
|
const combinedMessage = messageQueue.join("\n\n");
|
|
24799
24807
|
setQueuedMessages(
|
|
@@ -24812,7 +24820,7 @@ function useMessageQueue({
|
|
|
24812
24820
|
}
|
|
24813
24821
|
|
|
24814
24822
|
// src/ui/hooks/input/use-input-history-store.ts
|
|
24815
|
-
import { useCallback as useCallback49, useRef as
|
|
24823
|
+
import { useCallback as useCallback49, useRef as useRef34, useState as useState60 } from "react";
|
|
24816
24824
|
function deduplicateConsecutive(messages) {
|
|
24817
24825
|
return messages.filter(
|
|
24818
24826
|
(message, index) => index === 0 || message !== messages[index - 1]
|
|
@@ -24820,7 +24828,7 @@ function deduplicateConsecutive(messages) {
|
|
|
24820
24828
|
}
|
|
24821
24829
|
function useInputHistoryStore() {
|
|
24822
24830
|
const [inputHistory, setInputHistory] = useState60([]);
|
|
24823
|
-
const initializationStarted =
|
|
24831
|
+
const initializationStarted = useRef34(false);
|
|
24824
24832
|
const initializeFromHistory = useCallback49(
|
|
24825
24833
|
async (history) => {
|
|
24826
24834
|
if (initializationStarted.current) return;
|
|
@@ -24942,12 +24950,12 @@ var PromptHistoryStore = class {
|
|
|
24942
24950
|
};
|
|
24943
24951
|
|
|
24944
24952
|
// src/ui/hooks/ai/use-turn-activity-monitor.ts
|
|
24945
|
-
import { useState as useState61, useEffect as
|
|
24953
|
+
import { useState as useState61, useEffect as useEffect58, useRef as useRef35 } from "react";
|
|
24946
24954
|
var useTurnActivityMonitor = (streamingState, activePtyId) => {
|
|
24947
24955
|
const [operationStartTime, setOperationStartTime] = useState61(0);
|
|
24948
|
-
const prevPtyIdRef =
|
|
24949
|
-
const prevStreamingStateRef =
|
|
24950
|
-
|
|
24956
|
+
const prevPtyIdRef = useRef35(void 0);
|
|
24957
|
+
const prevStreamingStateRef = useRef35(void 0);
|
|
24958
|
+
useEffect58(() => {
|
|
24951
24959
|
const isNowResponding = streamingState === "responding" /* Responding */;
|
|
24952
24960
|
const wasResponding = prevStreamingStateRef.current === "responding" /* Responding */;
|
|
24953
24961
|
const ptyChanged = activePtyId !== prevPtyIdRef.current;
|
|
@@ -25006,7 +25014,7 @@ var useShellInactivityStatus = ({
|
|
|
25006
25014
|
};
|
|
25007
25015
|
|
|
25008
25016
|
// src/ui/hooks/input/use-local-shell-command.ts
|
|
25009
|
-
import { useCallback as useCallback50, useEffect as
|
|
25017
|
+
import { useCallback as useCallback50, useEffect as useEffect59, useRef as useRef36, useState as useState62 } from "react";
|
|
25010
25018
|
import crypto2 from "node:crypto";
|
|
25011
25019
|
import fs11 from "node:fs";
|
|
25012
25020
|
import os3 from "node:os";
|
|
@@ -25023,13 +25031,13 @@ function useLocalShellCommand({
|
|
|
25023
25031
|
terminalWidth,
|
|
25024
25032
|
terminalHeight
|
|
25025
25033
|
}) {
|
|
25026
|
-
const controllerRef =
|
|
25027
|
-
const mountedRef =
|
|
25034
|
+
const controllerRef = useRef36(void 0);
|
|
25035
|
+
const mountedRef = useRef36(true);
|
|
25028
25036
|
const [isExecuting, setIsExecuting] = useState62(false);
|
|
25029
25037
|
const [activePtyId, setActivePtyId] = useState62(void 0);
|
|
25030
25038
|
const [lastOutputTime, setLastOutputTime] = useState62(0);
|
|
25031
25039
|
const cancel = useCallback50(() => controllerRef.current?.abort(), []);
|
|
25032
|
-
|
|
25040
|
+
useEffect59(() => {
|
|
25033
25041
|
mountedRef.current = true;
|
|
25034
25042
|
return () => {
|
|
25035
25043
|
mountedRef.current = false;
|
|
@@ -25315,18 +25323,18 @@ var AppContainer = (props) => {
|
|
|
25315
25323
|
interactionModeRuntime.getSnapshot,
|
|
25316
25324
|
interactionModeRuntime.getSnapshot
|
|
25317
25325
|
);
|
|
25318
|
-
const conversationHistoryIds =
|
|
25319
|
-
const conversationHistoryTexts =
|
|
25326
|
+
const conversationHistoryIds = useRef37(/* @__PURE__ */ new Map());
|
|
25327
|
+
const conversationHistoryTexts = useRef37(/* @__PURE__ */ new Map());
|
|
25320
25328
|
const conversationSessionId = conversationRuntime.getSessionStats().sessionId;
|
|
25321
25329
|
const [projectedSessionId, setProjectedSessionId] = useState63(
|
|
25322
25330
|
conversationSessionId
|
|
25323
25331
|
);
|
|
25324
|
-
const promptInputAbortRef =
|
|
25332
|
+
const promptInputAbortRef = useRef37(void 0);
|
|
25325
25333
|
const [promptInputPreparing, setPromptInputPreparing] = useState63(false);
|
|
25326
25334
|
const addConversationHistoryItem = historyManager.addItem;
|
|
25327
25335
|
const updateConversationHistoryItem = historyManager.updateItem;
|
|
25328
25336
|
const clearConversationHistory = historyManager.clearItems;
|
|
25329
|
-
|
|
25337
|
+
useEffect60(() => {
|
|
25330
25338
|
if (projectedSessionId !== conversationSessionId) {
|
|
25331
25339
|
conversationHistoryIds.current.clear();
|
|
25332
25340
|
conversationHistoryTexts.current.clear();
|
|
@@ -25407,7 +25415,7 @@ var AppContainer = (props) => {
|
|
|
25407
25415
|
const [modelSelectionSnapshot, setModelSelectionSnapshot] = useState63(
|
|
25408
25416
|
() => modelSelectionRuntime?.getSnapshot()
|
|
25409
25417
|
);
|
|
25410
|
-
|
|
25418
|
+
useEffect60(
|
|
25411
25419
|
() => modelSelectionRuntime?.subscribe(
|
|
25412
25420
|
() => setModelSelectionSnapshot(modelSelectionRuntime.getSnapshot())
|
|
25413
25421
|
),
|
|
@@ -25434,16 +25442,16 @@ var AppContainer = (props) => {
|
|
|
25434
25442
|
const app = useApp();
|
|
25435
25443
|
const { stats: sessionStats } = useSessionStats();
|
|
25436
25444
|
const branchName = useGitBranchName(config.getTargetDir());
|
|
25437
|
-
const mainControlsRef =
|
|
25438
|
-
const rootUiRef =
|
|
25439
|
-
const lastTitleRef =
|
|
25445
|
+
const mainControlsRef = useRef37(null);
|
|
25446
|
+
const rootUiRef = useRef37(null);
|
|
25447
|
+
const lastTitleRef = useRef37(null);
|
|
25440
25448
|
const staticExtraHeight = 3;
|
|
25441
|
-
|
|
25449
|
+
useEffect60(() => {
|
|
25442
25450
|
void (async () => {
|
|
25443
25451
|
startupProfiler.flush();
|
|
25444
25452
|
})();
|
|
25445
25453
|
}, []);
|
|
25446
|
-
|
|
25454
|
+
useEffect60(() => {
|
|
25447
25455
|
const handleSettingsChanged = () => {
|
|
25448
25456
|
setSettingsNonce((prev) => prev + 1);
|
|
25449
25457
|
};
|
|
@@ -25479,7 +25487,7 @@ var AppContainer = (props) => {
|
|
|
25479
25487
|
shellModeActive,
|
|
25480
25488
|
getPreferredEditor
|
|
25481
25489
|
});
|
|
25482
|
-
|
|
25490
|
+
useEffect60(() => {
|
|
25483
25491
|
initializeFromHistory(promptHistory);
|
|
25484
25492
|
}, [initializeFromHistory, promptHistory]);
|
|
25485
25493
|
const refreshStatic = useCallback51(() => {
|
|
@@ -25498,7 +25506,7 @@ var AppContainer = (props) => {
|
|
|
25498
25506
|
terminalCapabilityManager.enableSupportedModes();
|
|
25499
25507
|
refreshStatic();
|
|
25500
25508
|
}, [refreshStatic, isAlternateBuffer, app, config]);
|
|
25501
|
-
|
|
25509
|
+
useEffect60(() => {
|
|
25502
25510
|
coreEvents.on(CoreEvent.ExternalEditorClosed, handleEditorClose);
|
|
25503
25511
|
return () => {
|
|
25504
25512
|
coreEvents.off(CoreEvent.ExternalEditorClosed, handleEditorClose);
|
|
@@ -25577,8 +25585,8 @@ var AppContainer = (props) => {
|
|
|
25577
25585
|
skillCatalogRuntime,
|
|
25578
25586
|
agentActivityRuntime
|
|
25579
25587
|
);
|
|
25580
|
-
const commandPreparationRef =
|
|
25581
|
-
|
|
25588
|
+
const commandPreparationRef = useRef37(void 0);
|
|
25589
|
+
useEffect60(() => {
|
|
25582
25590
|
if (!isSlashCommand(buffer.text.trim()) || commandPreparationRef.current !== void 0) {
|
|
25583
25591
|
return;
|
|
25584
25592
|
}
|
|
@@ -25594,12 +25602,12 @@ var AppContainer = (props) => {
|
|
|
25594
25602
|
}
|
|
25595
25603
|
});
|
|
25596
25604
|
}, [buffer.text, commandRuntime]);
|
|
25597
|
-
|
|
25598
|
-
const cancelHandlerRef =
|
|
25605
|
+
useEffect60(() => () => commandPreparationRef.current?.abort(), []);
|
|
25606
|
+
const cancelHandlerRef = useRef37(
|
|
25599
25607
|
() => {
|
|
25600
25608
|
}
|
|
25601
25609
|
);
|
|
25602
|
-
|
|
25610
|
+
useEffect60(() => {
|
|
25603
25611
|
if (pendingRestorePrompt) {
|
|
25604
25612
|
const lastHistoryUserMsg = historyManager.history.findLast(
|
|
25605
25613
|
(h) => h.type === "user"
|
|
@@ -25714,14 +25722,14 @@ var AppContainer = (props) => {
|
|
|
25714
25722
|
promptInputAbortRef.current?.abort();
|
|
25715
25723
|
conversationRuntime.cancel();
|
|
25716
25724
|
}, [cancelCommand, cancelLocalShell, conversationRuntime]);
|
|
25717
|
-
|
|
25725
|
+
useEffect60(
|
|
25718
25726
|
() => () => {
|
|
25719
25727
|
promptInputAbortRef.current?.abort();
|
|
25720
25728
|
},
|
|
25721
25729
|
[]
|
|
25722
25730
|
);
|
|
25723
|
-
const lastOutputTimeRef =
|
|
25724
|
-
|
|
25731
|
+
const lastOutputTimeRef = useRef37(0);
|
|
25732
|
+
useEffect60(() => {
|
|
25725
25733
|
lastOutputTimeRef.current = lastOutputTime;
|
|
25726
25734
|
}, [lastOutputTime]);
|
|
25727
25735
|
const { shouldShowFocusHint, inactivityStatus } = useShellInactivityStatus({
|
|
@@ -25831,9 +25839,9 @@ ${queuedText}` : queuedText;
|
|
|
25831
25839
|
() => props.initialPrompt ?? config.getQuestion(),
|
|
25832
25840
|
[config, props.initialPrompt]
|
|
25833
25841
|
);
|
|
25834
|
-
const initialPromptSubmitted =
|
|
25842
|
+
const initialPromptSubmitted = useRef37(false);
|
|
25835
25843
|
const providerSetupRequired = providerSetupSnapshot?.current.status === "missing";
|
|
25836
|
-
|
|
25844
|
+
useEffect60(() => {
|
|
25837
25845
|
if (!providerSetupRuntime || !providerSetupRequired || providerSetupDismissed || customDialog) {
|
|
25838
25846
|
return;
|
|
25839
25847
|
}
|
|
@@ -25865,7 +25873,7 @@ ${queuedText}` : queuedText;
|
|
|
25865
25873
|
providerSetupRuntime,
|
|
25866
25874
|
providerSetupSnapshot
|
|
25867
25875
|
]);
|
|
25868
|
-
|
|
25876
|
+
useEffect60(() => {
|
|
25869
25877
|
if (activePtyId) {
|
|
25870
25878
|
try {
|
|
25871
25879
|
ShellExecutionService.resizePty(
|
|
@@ -25883,7 +25891,7 @@ ${queuedText}` : queuedText;
|
|
|
25883
25891
|
}
|
|
25884
25892
|
}
|
|
25885
25893
|
}, [terminalWidth, availableTerminalHeight, activePtyId]);
|
|
25886
|
-
|
|
25894
|
+
useEffect60(() => {
|
|
25887
25895
|
if (initialPrompt && !initialPromptSubmitted.current && !isThemeDialogOpen && !isEditorDialogOpen && !providerSetupRequired && !customDialog && conversationRuntime) {
|
|
25888
25896
|
handleFinalSubmit(initialPrompt);
|
|
25889
25897
|
initialPromptSubmitted.current = true;
|
|
@@ -25901,15 +25909,15 @@ ${queuedText}` : queuedText;
|
|
|
25901
25909
|
const [showFullTodos, setShowFullTodos] = useState63(false);
|
|
25902
25910
|
const [renderMarkdown, setRenderMarkdown] = useState63(true);
|
|
25903
25911
|
const [ctrlCPressCount, setCtrlCPressCount] = useState63(0);
|
|
25904
|
-
const ctrlCTimerRef =
|
|
25912
|
+
const ctrlCTimerRef = useRef37(null);
|
|
25905
25913
|
const [ctrlDPressCount, setCtrlDPressCount] = useState63(0);
|
|
25906
|
-
const ctrlDTimerRef =
|
|
25914
|
+
const ctrlDTimerRef = useRef37(null);
|
|
25907
25915
|
const [constrainHeight, setConstrainHeight] = useState63(true);
|
|
25908
25916
|
const [showEscapePrompt, setShowEscapePrompt] = useState63(false);
|
|
25909
25917
|
const [warningMessage, setWarningMessage] = useState63(null);
|
|
25910
|
-
const isInitialMount =
|
|
25911
|
-
const warningTimeoutRef =
|
|
25912
|
-
const tabFocusTimeoutRef =
|
|
25918
|
+
const isInitialMount = useRef37(true);
|
|
25919
|
+
const warningTimeoutRef = useRef37(null);
|
|
25920
|
+
const tabFocusTimeoutRef = useRef37(null);
|
|
25913
25921
|
const handleWarning = useCallback51((message) => {
|
|
25914
25922
|
setWarningMessage(message);
|
|
25915
25923
|
if (warningTimeoutRef.current) {
|
|
@@ -25919,7 +25927,7 @@ ${queuedText}` : queuedText;
|
|
|
25919
25927
|
setWarningMessage(null);
|
|
25920
25928
|
}, WARNING_PROMPT_DURATION_MS);
|
|
25921
25929
|
}, []);
|
|
25922
|
-
|
|
25930
|
+
useEffect60(() => {
|
|
25923
25931
|
const handleSelectionWarning = () => {
|
|
25924
25932
|
handleWarning("Press Ctrl-S to enter selection mode to copy text.");
|
|
25925
25933
|
};
|
|
@@ -25939,7 +25947,7 @@ ${queuedText}` : queuedText;
|
|
|
25939
25947
|
}
|
|
25940
25948
|
};
|
|
25941
25949
|
}, [handleWarning]);
|
|
25942
|
-
|
|
25950
|
+
useEffect60(() => {
|
|
25943
25951
|
if (queueErrorMessage) {
|
|
25944
25952
|
const timer = setTimeout(() => {
|
|
25945
25953
|
setQueueErrorMessage(null);
|
|
@@ -25948,7 +25956,7 @@ ${queuedText}` : queuedText;
|
|
|
25948
25956
|
}
|
|
25949
25957
|
return void 0;
|
|
25950
25958
|
}, [queueErrorMessage, setQueueErrorMessage]);
|
|
25951
|
-
|
|
25959
|
+
useEffect60(() => {
|
|
25952
25960
|
if (isInitialMount.current) {
|
|
25953
25961
|
isInitialMount.current = false;
|
|
25954
25962
|
return;
|
|
@@ -25960,7 +25968,7 @@ ${queuedText}` : queuedText;
|
|
|
25960
25968
|
clearTimeout(handler);
|
|
25961
25969
|
};
|
|
25962
25970
|
}, [terminalWidth, refreshStatic]);
|
|
25963
|
-
|
|
25971
|
+
useEffect60(() => {
|
|
25964
25972
|
const openDebugConsole = () => {
|
|
25965
25973
|
setShowErrorDetails(true);
|
|
25966
25974
|
setConstrainHeight(false);
|
|
@@ -25970,7 +25978,7 @@ ${queuedText}` : queuedText;
|
|
|
25970
25978
|
appEvents.off("open-debug-console" /* OpenDebugConsole */, openDebugConsole);
|
|
25971
25979
|
};
|
|
25972
25980
|
}, [config]);
|
|
25973
|
-
|
|
25981
|
+
useEffect60(() => {
|
|
25974
25982
|
if (ctrlCTimerRef.current) {
|
|
25975
25983
|
clearTimeout(ctrlCTimerRef.current);
|
|
25976
25984
|
ctrlCTimerRef.current = null;
|
|
@@ -25984,7 +25992,7 @@ ${queuedText}` : queuedText;
|
|
|
25984
25992
|
}, WARNING_PROMPT_DURATION_MS);
|
|
25985
25993
|
}
|
|
25986
25994
|
}, [ctrlCPressCount, config, setCtrlCPressCount, handleSlashCommand]);
|
|
25987
|
-
|
|
25995
|
+
useEffect60(() => {
|
|
25988
25996
|
if (ctrlDTimerRef.current) {
|
|
25989
25997
|
clearTimeout(ctrlDTimerRef.current);
|
|
25990
25998
|
ctrlCTimerRef.current = null;
|
|
@@ -26135,7 +26143,7 @@ ${queuedText}` : queuedText;
|
|
|
26135
26143
|
]
|
|
26136
26144
|
);
|
|
26137
26145
|
useKeypress(handleGlobalKeypress, { isActive: true });
|
|
26138
|
-
|
|
26146
|
+
useEffect60(() => {
|
|
26139
26147
|
if (settings.merged.ui.hideWindowTitle) return;
|
|
26140
26148
|
const paddedTitle = computeTerminalTitle({
|
|
26141
26149
|
streamingState,
|
|
@@ -26161,7 +26169,7 @@ ${queuedText}` : queuedText;
|
|
|
26161
26169
|
config,
|
|
26162
26170
|
stdout
|
|
26163
26171
|
]);
|
|
26164
|
-
|
|
26172
|
+
useEffect60(() => {
|
|
26165
26173
|
const handleUserFeedback = (payload) => {
|
|
26166
26174
|
let type;
|
|
26167
26175
|
switch (payload.severity) {
|
|
@@ -26677,12 +26685,6 @@ function projectDshContentBlock(block) {
|
|
|
26677
26685
|
name: block.name,
|
|
26678
26686
|
arguments: block.arguments
|
|
26679
26687
|
};
|
|
26680
|
-
case "tool-result":
|
|
26681
|
-
return {
|
|
26682
|
-
type: "extension",
|
|
26683
|
-
blockType: block.type,
|
|
26684
|
-
payload: block
|
|
26685
|
-
};
|
|
26686
26688
|
default: {
|
|
26687
26689
|
const extension = block;
|
|
26688
26690
|
return {
|
|
@@ -27022,20 +27024,18 @@ var DshSessionProjector = class {
|
|
|
27022
27024
|
}
|
|
27023
27025
|
if (event.type === "tool/result") {
|
|
27024
27026
|
if (this.cancelledTurns.has(event.data.turn)) return;
|
|
27025
|
-
const callId = String(event.data.message.
|
|
27027
|
+
const callId = String(event.data.message.toolCallId);
|
|
27026
27028
|
const id = `tool-${callId}`;
|
|
27027
|
-
const
|
|
27028
|
-
|
|
27029
|
-
);
|
|
27030
|
-
const failed = resultBlock?.isError === true || event.data.error !== void 0;
|
|
27029
|
+
const message = event.data.message;
|
|
27030
|
+
const failed = message.isError === true || event.data.error !== void 0;
|
|
27031
27031
|
const result = {
|
|
27032
|
-
content: projectDshContent(
|
|
27032
|
+
content: projectDshContent(message.content),
|
|
27033
27033
|
isError: failed,
|
|
27034
27034
|
...event.data.error === void 0 ? {} : { error: event.data.error },
|
|
27035
27035
|
...event.data.meta === void 0 ? {} : { meta: event.data.meta }
|
|
27036
27036
|
};
|
|
27037
27037
|
const existingMessage = this.snapshot.messages.find(
|
|
27038
|
-
(
|
|
27038
|
+
(message2) => message2.id === id && message2.role === "tool"
|
|
27039
27039
|
);
|
|
27040
27040
|
const toolName = this.toolNames.get(callId) ?? "tool";
|
|
27041
27041
|
const tool = this.metrics.tools.byName[toolName] ??= createInitialToolCallStats();
|
|
@@ -27051,7 +27051,7 @@ var DshSessionProjector = class {
|
|
|
27051
27051
|
toolName,
|
|
27052
27052
|
existingMessage?.arguments ?? "",
|
|
27053
27053
|
{
|
|
27054
|
-
content:
|
|
27054
|
+
content: [...message.content],
|
|
27055
27055
|
isError: failed,
|
|
27056
27056
|
...event.data.meta === void 0 ? {} : { meta: event.data.meta }
|
|
27057
27057
|
}
|
|
@@ -29546,6 +29546,10 @@ function waitForSharedPromise(promise, signal) {
|
|
|
29546
29546
|
|
|
29547
29547
|
// src/dsh/agent-preset-runtime.ts
|
|
29548
29548
|
var EMPTY_OPTIONS = Object.freeze([]);
|
|
29549
|
+
async function resolveNewSessionPreset(presets, requestedId) {
|
|
29550
|
+
if (requestedId === void 0) return presets.resolve();
|
|
29551
|
+
return presets.resolve(requestedId);
|
|
29552
|
+
}
|
|
29549
29553
|
var DshAgentPresetRuntime = class {
|
|
29550
29554
|
constructor(presets, projections, activeAgent, pendingPresetId, selectPendingPreset, onSelected) {
|
|
29551
29555
|
this.presets = presets;
|
|
@@ -29556,7 +29560,6 @@ var DshAgentPresetRuntime = class {
|
|
|
29556
29560
|
this.onSelected = onSelected;
|
|
29557
29561
|
this.snapshot = Object.freeze({
|
|
29558
29562
|
status: "idle",
|
|
29559
|
-
modeSelectionEnabled: false,
|
|
29560
29563
|
currentId: this.currentId(),
|
|
29561
29564
|
options: EMPTY_OPTIONS,
|
|
29562
29565
|
busy: false
|
|
@@ -29579,7 +29582,6 @@ var DshAgentPresetRuntime = class {
|
|
|
29579
29582
|
};
|
|
29580
29583
|
async prepare(signal) {
|
|
29581
29584
|
signal?.throwIfAborted();
|
|
29582
|
-
if (this.snapshot.status === "ready") return;
|
|
29583
29585
|
let loading = this.loading;
|
|
29584
29586
|
if (loading === void 0) {
|
|
29585
29587
|
loading = this.load().finally(() => {
|
|
@@ -29590,10 +29592,11 @@ var DshAgentPresetRuntime = class {
|
|
|
29590
29592
|
return waitForSharedPromise(loading, signal);
|
|
29591
29593
|
}
|
|
29592
29594
|
async select(id, signal) {
|
|
29595
|
+
const agent = this.activeAgent();
|
|
29593
29596
|
await this.prepare(signal);
|
|
29594
29597
|
signal?.throwIfAborted();
|
|
29595
|
-
if (
|
|
29596
|
-
throw new Error("
|
|
29598
|
+
if (this.activeAgent() !== agent) {
|
|
29599
|
+
throw new Error("The active Session changed. Reopen Agent presets.");
|
|
29597
29600
|
}
|
|
29598
29601
|
const option = this.snapshot.options.find(
|
|
29599
29602
|
(candidate) => candidate.id === id
|
|
@@ -29606,7 +29609,6 @@ var DshAgentPresetRuntime = class {
|
|
|
29606
29609
|
if (this.snapshot.busy) {
|
|
29607
29610
|
throw new Error("Another Agent preset change is already in progress.");
|
|
29608
29611
|
}
|
|
29609
|
-
const agent = this.activeAgent();
|
|
29610
29612
|
if (agent === void 0) {
|
|
29611
29613
|
this.selectPendingPreset(id);
|
|
29612
29614
|
this.refreshCurrent();
|
|
@@ -29652,14 +29654,12 @@ var DshAgentPresetRuntime = class {
|
|
|
29652
29654
|
id: preset.id,
|
|
29653
29655
|
name: preset.name ?? preset.id,
|
|
29654
29656
|
...preset.description === void 0 ? {} : { description: preset.description },
|
|
29655
|
-
|
|
29656
|
-
isDefault: preset.id === this.presets.defaultId,
|
|
29657
|
+
isDefault: preset.isDefault,
|
|
29657
29658
|
...preset.broken === void 0 ? {} : { broken: preset.broken }
|
|
29658
29659
|
})
|
|
29659
29660
|
);
|
|
29660
29661
|
this.snapshot = Object.freeze({
|
|
29661
29662
|
status: "ready",
|
|
29662
|
-
modeSelectionEnabled: roster.modeSelectionEnabled,
|
|
29663
29663
|
currentId: this.currentId(),
|
|
29664
29664
|
options: Object.freeze(options),
|
|
29665
29665
|
busy: this.snapshot.busy
|
|
@@ -29830,8 +29830,11 @@ var DshAgentActivityRuntime = class {
|
|
|
29830
29830
|
this.activeAgent = activeAgent;
|
|
29831
29831
|
this.ensureAgent = ensureAgent;
|
|
29832
29832
|
this.isSwitching = isSwitching;
|
|
29833
|
-
const offJobs = jobs.
|
|
29834
|
-
if (
|
|
29833
|
+
const offJobs = jobs.events.subscribe({ owners: "all" }, (event) => {
|
|
29834
|
+
if (event.type === "output") return;
|
|
29835
|
+
const agent = this.activeAgent();
|
|
29836
|
+
if (agent !== void 0 && event.job.owner === agent.session.id)
|
|
29837
|
+
this.refresh();
|
|
29835
29838
|
});
|
|
29836
29839
|
const offSession = subscribeSession((session, event) => {
|
|
29837
29840
|
if (session === this.activeAgent()?.session && event.type.startsWith("goal/"))
|
|
@@ -29867,10 +29870,14 @@ var DshAgentActivityRuntime = class {
|
|
|
29867
29870
|
"The active Session changed. Reopen Jobs before stopping work."
|
|
29868
29871
|
);
|
|
29869
29872
|
}
|
|
29870
|
-
const job = this.jobs.get(JobId(jobId), agent);
|
|
29871
|
-
if (String(job.
|
|
29873
|
+
const job = this.jobs.get(JobId(jobId), agent.session.id);
|
|
29874
|
+
if (String(job.owner) !== sessionId)
|
|
29872
29875
|
throw new Error("This job belongs to another Session.");
|
|
29873
|
-
this.jobs.kill(
|
|
29876
|
+
this.jobs.kill(
|
|
29877
|
+
job.id,
|
|
29878
|
+
agent.session.id,
|
|
29879
|
+
"Stopped by the user in DSH Console."
|
|
29880
|
+
);
|
|
29874
29881
|
this.refresh();
|
|
29875
29882
|
}
|
|
29876
29883
|
async changeGoal(expected, action, signal) {
|
|
@@ -29943,13 +29950,13 @@ var DshAgentActivityRuntime = class {
|
|
|
29943
29950
|
this.snapshot = {
|
|
29944
29951
|
sessionId,
|
|
29945
29952
|
busy: this.changing,
|
|
29946
|
-
jobs: agent === void 0 ? [] : this.jobs.list(agent).filter((job) => job.
|
|
29953
|
+
jobs: agent === void 0 ? [] : this.jobs.list(agent.session.id).filter((job) => job.owner === agent.session.id).map((job) => ({
|
|
29947
29954
|
id: String(job.id),
|
|
29948
29955
|
kind: String(job.kind),
|
|
29949
29956
|
label: job.label,
|
|
29950
29957
|
sessionId: String(agent.session.id),
|
|
29951
29958
|
status: job.status,
|
|
29952
|
-
detail: job.detail,
|
|
29959
|
+
detail: job.progress ?? job.detail,
|
|
29953
29960
|
startedAt: job.startedAt,
|
|
29954
29961
|
finishedAt: job.finishedAt
|
|
29955
29962
|
})),
|
|
@@ -30340,7 +30347,7 @@ async function start(ctx, config) {
|
|
|
30340
30347
|
model: selected.model,
|
|
30341
30348
|
...selected.reasoningEffort === void 0 ? {} : { reasoningEffort: selected.reasoningEffort }
|
|
30342
30349
|
};
|
|
30343
|
-
const preset = options.resumeSessionId === void 0 && options.inheritPresetFrom === void 0 ? await agentPresets
|
|
30350
|
+
const preset = options.resumeSessionId === void 0 && options.inheritPresetFrom === void 0 ? await resolveNewSessionPreset(agentPresets, options.presetId) : void 0;
|
|
30344
30351
|
const inheritedPresetId = options.inheritPresetFrom === void 0 ? void 0 : sessionProjections.snapshot(options.inheritPresetFrom.session).values.agentPreset ?? void 0;
|
|
30345
30352
|
const setup = async (agentCtx, agent) => {
|
|
30346
30353
|
const ref = {
|
|
@@ -30356,19 +30363,18 @@ async function start(ctx, config) {
|
|
|
30356
30363
|
}
|
|
30357
30364
|
if (options.restrictTools) agentCtx.tools.restrict({ allow: [] });
|
|
30358
30365
|
};
|
|
30366
|
+
const fork = options.seed === void 0 ? void 0 : forkSeedOptions(options.seed);
|
|
30359
30367
|
const handle = options.resumeSessionId === void 0 ? await agents.create({
|
|
30360
30368
|
sessionId: options.sessionId ?? SessionId5(`dsh-console-${randomUUID3()}`),
|
|
30361
30369
|
meta: {
|
|
30362
30370
|
cwd: process.cwd(),
|
|
30363
30371
|
...options.parentSession === void 0 ? {} : { parentSession: options.parentSession },
|
|
30364
|
-
...
|
|
30372
|
+
...fork?.meta,
|
|
30365
30373
|
...(preset?.id ?? inheritedPresetId) === void 0 ? {} : { agentPreset: preset?.id ?? inheritedPresetId }
|
|
30366
30374
|
},
|
|
30367
|
-
...
|
|
30368
|
-
seed:
|
|
30369
|
-
|
|
30370
|
-
inheritedEventCount: forkSeedOptions(options.seed).inheritedEventCount
|
|
30371
|
-
} : {}
|
|
30375
|
+
...fork === void 0 ? {} : {
|
|
30376
|
+
seed: fork.seed,
|
|
30377
|
+
inheritedEventCount: fork.inheritedEventCount
|
|
30372
30378
|
},
|
|
30373
30379
|
agentOptions,
|
|
30374
30380
|
setup,
|
|
@@ -30687,10 +30693,7 @@ async function start(ctx, config) {
|
|
|
30687
30693
|
);
|
|
30688
30694
|
return records.map((record) => {
|
|
30689
30695
|
const live = sessions.get(record.header.id);
|
|
30690
|
-
const projection = live === void 0 ? record.header
|
|
30691
|
-
record.header,
|
|
30692
|
-
SessionLogOffset2(0)
|
|
30693
|
-
) : sessionProjections.cachedSnapshot(live);
|
|
30696
|
+
const projection = live === void 0 ? sessionProjectionCache.cachedSnapshot(record.header) : sessionProjections.cachedSnapshot(live);
|
|
30694
30697
|
const metadata = projection?.values.sessionListMetadata;
|
|
30695
30698
|
const title = projection?.values.title;
|
|
30696
30699
|
return {
|