@cofy-x/dsh-console 0.1.0-alpha.16 → 0.1.0-alpha.18

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.
@@ -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 useEffect59,
2453
- useRef as useRef36,
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 = "7a7aa5f";
6429
+ var GIT_COMMIT_INFO = "5944608";
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 useEffect48, useRef as useRef27, useState as useState51 } from "react";
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 { useCallback as useCallback40, useMemo as useMemo39, useState as useState47, useSyncExternalStore as useSyncExternalStore6 } from "react";
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 selected = highlighted ?? snapshot.options.find((item) => item.id === snapshot.currentId) ?? snapshot.options[0];
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
- onSwitched(await runtime.select(option.id));
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
- [onClose, onSwitched, runtime, snapshot.currentId]
22583
+ [close, onSwitched, runtime, snapshot.currentId, snapshot.busy]
22564
22584
  );
22565
22585
  useKeypress(
22566
22586
  (key) => {
22567
- if (key.name === "escape" && !snapshot.busy) onClose();
22587
+ if (key.name === "escape" && !snapshot.busy) close();
22568
22588
  },
22569
22589
  { isActive: true }
22570
22590
  );
@@ -22580,10 +22600,10 @@ 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
- 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: [
22606
+ !snapshot.modeSelectionEnabled ? /* @__PURE__ */ jsx105(Box82, { marginTop: 1, children: /* @__PURE__ */ jsx105(Text77, { color: theme.text.secondary, children: "Agent preset selection is disabled by the DSH host." }) }) : 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: [
22587
22607
  /* @__PURE__ */ jsx105(Box82, { width: "50%", paddingRight: 2, flexDirection: "column", children: /* @__PURE__ */ jsx105(
22588
22608
  RadioButtonSelect,
22589
22609
  {
@@ -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__ */ jsxs79(Text77, { color: theme.text.secondary, children: [
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..." }) })
@@ -22724,7 +22740,7 @@ var presetCommand = {
22724
22740
  import React26 from "react";
22725
22741
 
22726
22742
  // src/ui/components/dialogs/skills-dialog.tsx
22727
- import { useEffect as useEffect45, useMemo as useMemo40, useState as useState48, useSyncExternalStore as useSyncExternalStore7 } from "react";
22743
+ import { useEffect as useEffect46, useMemo as useMemo40, useState as useState48, useSyncExternalStore as useSyncExternalStore7 } from "react";
22728
22744
  import { Box as Box83, Text as Text78 } from "ink";
22729
22745
  import { Fragment as Fragment29, jsx as jsx106, jsxs as jsxs80 } from "react/jsx-runtime";
22730
22746
  function summary2(value) {
@@ -22742,7 +22758,7 @@ function SkillsDialog({
22742
22758
  );
22743
22759
  const [selectedName, setSelectedName] = useState48(snapshot.skills[0]?.name);
22744
22760
  const selected = snapshot.skills.find((skill) => skill.name === selectedName) ?? snapshot.skills[0];
22745
- useEffect45(() => {
22761
+ useEffect46(() => {
22746
22762
  if (selected?.name !== selectedName) setSelectedName(selected?.name);
22747
22763
  }, [selected?.name, selectedName]);
22748
22764
  useKeypress(
@@ -22847,7 +22863,7 @@ var skillsCommand = {
22847
22863
  import React27 from "react";
22848
22864
 
22849
22865
  // src/ui/components/dialogs/jobs-dialog.tsx
22850
- import { useEffect as useEffect46, useState as useState49, useSyncExternalStore as useSyncExternalStore8 } from "react";
22866
+ import { useEffect as useEffect47, useState as useState49, useSyncExternalStore as useSyncExternalStore8 } from "react";
22851
22867
  import { Text as Text79 } from "ink";
22852
22868
  import { Fragment as Fragment30, jsx as jsx107, jsxs as jsxs81 } from "react/jsx-runtime";
22853
22869
  function JobsDialog({
@@ -22863,11 +22879,11 @@ function JobsDialog({
22863
22879
  const [pending, setPending] = useState49();
22864
22880
  const [error, setError] = useState49();
22865
22881
  const [now, setNow] = useState49(Date.now);
22866
- useEffect46(() => {
22882
+ useEffect47(() => {
22867
22883
  const timer = setInterval(() => setNow(Date.now()), 1e3);
22868
22884
  return () => clearInterval(timer);
22869
22885
  }, []);
22870
- useEffect46(() => {
22886
+ useEffect47(() => {
22871
22887
  setSelectedId(void 0);
22872
22888
  setPending(void 0);
22873
22889
  setError(void 0);
@@ -22971,7 +22987,7 @@ function JobsDialog({
22971
22987
  }
22972
22988
 
22973
22989
  // src/ui/components/dialogs/goal-dialog.tsx
22974
- import { useEffect as useEffect47, useRef as useRef26, useState as useState50, useSyncExternalStore as useSyncExternalStore9 } from "react";
22990
+ import { useEffect as useEffect48, useRef as useRef27, useState as useState50, useSyncExternalStore as useSyncExternalStore9 } from "react";
22975
22991
  import { Box as Box84, Text as Text80 } from "ink";
22976
22992
  import { Fragment as Fragment31, jsx as jsx108, jsxs as jsxs82 } from "react/jsx-runtime";
22977
22993
  function GoalDialog({
@@ -22991,9 +23007,9 @@ function GoalDialog({
22991
23007
  );
22992
23008
  const [pending, setPending] = useState50();
22993
23009
  const [error, setError] = useState50();
22994
- const controller = useRef26(void 0);
22995
- const mounted = useRef26(true);
22996
- useEffect47(() => {
23010
+ const controller = useRef27(void 0);
23011
+ const mounted = useRef27(true);
23012
+ useEffect48(() => {
22997
23013
  mounted.current = true;
22998
23014
  return () => {
22999
23015
  mounted.current = false;
@@ -23319,7 +23335,7 @@ var useSlashCommandProcessor = (addItem, clearItems, loadHistory, refreshStatic,
23319
23335
  void 0
23320
23336
  );
23321
23337
  const [reloadTrigger, setReloadTrigger] = useState51(0);
23322
- const commandAbortRef = useRef27(void 0);
23338
+ const commandAbortRef = useRef28(void 0);
23323
23339
  const reloadCommands = useCallback41(() => {
23324
23340
  setReloadTrigger((v) => v + 1);
23325
23341
  }, []);
@@ -23380,7 +23396,7 @@ var useSlashCommandProcessor = (addItem, clearItems, loadHistory, refreshStatic,
23380
23396
  setCustomDialog
23381
23397
  ]
23382
23398
  );
23383
- useEffect48(() => {
23399
+ useEffect49(() => {
23384
23400
  const controller = new AbortController();
23385
23401
  (async () => {
23386
23402
  const loaders = [
@@ -23398,15 +23414,15 @@ var useSlashCommandProcessor = (addItem, clearItems, loadHistory, refreshStatic,
23398
23414
  controller.abort();
23399
23415
  };
23400
23416
  }, [dshCommands, enableProfiler, reloadTrigger, skillCatalog]);
23401
- useEffect48(
23417
+ useEffect49(
23402
23418
  () => dshCommands?.subscribe(reloadCommands),
23403
23419
  [dshCommands, reloadCommands]
23404
23420
  );
23405
- useEffect48(
23421
+ useEffect49(
23406
23422
  () => skillCatalog?.subscribe(reloadCommands),
23407
23423
  [skillCatalog, reloadCommands]
23408
23424
  );
23409
- useEffect48(() => () => commandAbortRef.current?.abort(), []);
23425
+ useEffect49(() => () => commandAbortRef.current?.abort(), []);
23410
23426
  const handleSlashCommand = useCallback41(
23411
23427
  async (rawQuery, overwriteConfirmed, addToHistory = true, attachments = []) => {
23412
23428
  if (!commands) {
@@ -23698,7 +23714,7 @@ var useThemeCommand = (loadedSettings, setThemeError, addItem, initialThemeError
23698
23714
  };
23699
23715
 
23700
23716
  // src/ui/hooks/input/use-vim.ts
23701
- import { useCallback as useCallback44, useReducer as useReducer5, useEffect as useEffect49, useRef as useRef28 } from "react";
23717
+ import { useCallback as useCallback44, useReducer as useReducer5, useEffect as useEffect50, useRef as useRef29 } from "react";
23702
23718
  var DIGIT_MULTIPLIER = 10;
23703
23719
  var DEFAULT_COUNT = 1;
23704
23720
  var DIGIT_1_TO_9 = /^[1-9]$/;
@@ -23763,8 +23779,8 @@ var vimReducer = (state, action) => {
23763
23779
  function useVim(buffer, onSubmit) {
23764
23780
  const { vimEnabled, vimMode, setVimMode } = useVimMode();
23765
23781
  const [state, dispatch] = useReducer5(vimReducer, initialVimState);
23766
- const lastEscapeTimestampRef = useRef28(0);
23767
- useEffect49(() => {
23782
+ const lastEscapeTimestampRef = useRef29(0);
23783
+ useEffect50(() => {
23768
23784
  dispatch({ type: "SET_MODE", mode: vimMode });
23769
23785
  }, [vimMode]);
23770
23786
  const updateMode = useCallback44(
@@ -24263,7 +24279,7 @@ function useVim(buffer, onSubmit) {
24263
24279
  }
24264
24280
 
24265
24281
  // src/ui/hooks/session/use-git-branch-name.ts
24266
- import { useState as useState54, useEffect as useEffect50, useCallback as useCallback45 } from "react";
24282
+ import { useState as useState54, useEffect as useEffect51, useCallback as useCallback45 } from "react";
24267
24283
  import fs9 from "node:fs";
24268
24284
  import fsPromises2 from "node:fs/promises";
24269
24285
  import path11 from "node:path";
@@ -24291,7 +24307,7 @@ function useGitBranchName(cwd) {
24291
24307
  setBranchName(void 0);
24292
24308
  }
24293
24309
  }, [cwd, setBranchName]);
24294
- useEffect50(() => {
24310
+ useEffect51(() => {
24295
24311
  fetchBranchName();
24296
24312
  const gitLogsHeadPath = path11.join(cwd, ".git", "logs", "HEAD");
24297
24313
  let watcher;
@@ -24371,12 +24387,12 @@ var useEditorSettings = (loadedSettings, setEditorError, addItem) => {
24371
24387
  };
24372
24388
 
24373
24389
  // src/ui/hooks/terminal/use-memory-monitor.ts
24374
- import { useEffect as useEffect51 } from "react";
24390
+ import { useEffect as useEffect52 } from "react";
24375
24391
  import process7 from "node:process";
24376
24392
  var MEMORY_WARNING_THRESHOLD = 7 * 1024 * 1024 * 1024;
24377
24393
  var MEMORY_CHECK_INTERVAL = 60 * 1e3;
24378
24394
  var useMemoryMonitor = ({ addItem }) => {
24379
- useEffect51(() => {
24395
+ useEffect52(() => {
24380
24396
  const intervalId = setInterval(() => {
24381
24397
  const usage = process7.memoryUsage().rss;
24382
24398
  if (usage > MEMORY_WARNING_THRESHOLD) {
@@ -24397,9 +24413,9 @@ var useMemoryMonitor = ({ addItem }) => {
24397
24413
  // src/ui/hooks/visual/use-console-messages.ts
24398
24414
  import {
24399
24415
  useCallback as useCallback47,
24400
- useEffect as useEffect52,
24416
+ useEffect as useEffect53,
24401
24417
  useReducer as useReducer6,
24402
- useRef as useRef29,
24418
+ useRef as useRef30,
24403
24419
  useTransition
24404
24420
  } from "react";
24405
24421
  function consoleMessagesReducer(state, action) {
@@ -24427,8 +24443,8 @@ function consoleMessagesReducer(state, action) {
24427
24443
  }
24428
24444
  function useConsoleMessages() {
24429
24445
  const [consoleMessages, dispatch] = useReducer6(consoleMessagesReducer, []);
24430
- const messageQueueRef = useRef29([]);
24431
- const timeoutRef = useRef29(null);
24446
+ const messageQueueRef = useRef30([]);
24447
+ const timeoutRef = useRef30(null);
24432
24448
  const [, startTransition] = useTransition();
24433
24449
  const processQueue = useCallback47(() => {
24434
24450
  if (messageQueueRef.current.length > 0) {
@@ -24449,7 +24465,7 @@ function useConsoleMessages() {
24449
24465
  },
24450
24466
  [processQueue]
24451
24467
  );
24452
- useEffect52(() => {
24468
+ useEffect53(() => {
24453
24469
  const handleConsoleLog = (payload) => {
24454
24470
  handleNewMessage({
24455
24471
  type: payload.type,
@@ -24478,7 +24494,7 @@ function useConsoleMessages() {
24478
24494
  dispatch({ type: "CLEAR" });
24479
24495
  });
24480
24496
  }, []);
24481
- useEffect52(
24497
+ useEffect53(
24482
24498
  () => () => {
24483
24499
  if (timeoutRef.current) {
24484
24500
  clearTimeout(timeoutRef.current);
@@ -24490,13 +24506,13 @@ function useConsoleMessages() {
24490
24506
  }
24491
24507
 
24492
24508
  // src/ui/hooks/visual/use-timer.ts
24493
- import { useState as useState56, useEffect as useEffect53, useRef as useRef30 } from "react";
24509
+ import { useState as useState56, useEffect as useEffect54, useRef as useRef31 } from "react";
24494
24510
  var useTimer = (isActive, resetKey) => {
24495
24511
  const [elapsedTime, setElapsedTime] = useState56(0);
24496
- const timerRef = useRef30(null);
24497
- const prevResetKeyRef = useRef30(resetKey);
24498
- const prevIsActiveRef = useRef30(isActive);
24499
- useEffect53(() => {
24512
+ const timerRef = useRef31(null);
24513
+ const prevResetKeyRef = useRef31(resetKey);
24514
+ const prevIsActiveRef = useRef31(isActive);
24515
+ useEffect54(() => {
24500
24516
  let shouldResetTime = false;
24501
24517
  if (prevResetKeyRef.current !== resetKey) {
24502
24518
  shouldResetTime = true;
@@ -24533,7 +24549,7 @@ var useTimer = (isActive, resetKey) => {
24533
24549
  };
24534
24550
 
24535
24551
  // src/ui/hooks/visual/use-phrase-cycler.ts
24536
- import { useState as useState57, useEffect as useEffect54, useRef as useRef31 } from "react";
24552
+ import { useState as useState57, useEffect as useEffect55, useRef as useRef32 } from "react";
24537
24553
 
24538
24554
  // src/ui/components/indicators/loading-phrases.ts
24539
24555
  var WITTY_LOADING_PHRASES = [
@@ -24678,9 +24694,9 @@ var usePhraseCycler = (isActive, shouldShowFocusHint, customPhrases) => {
24678
24694
  const [currentLoadingPhrase, setCurrentLoadingPhrase] = useState57(
24679
24695
  loadingPhrases[0]
24680
24696
  );
24681
- const phraseIntervalRef = useRef31(null);
24682
- const hasShownFirstRequestTipRef = useRef31(false);
24683
- useEffect54(() => {
24697
+ const phraseIntervalRef = useRef32(null);
24698
+ const hasShownFirstRequestTipRef = useRef32(false);
24699
+ useEffect55(() => {
24684
24700
  if (phraseIntervalRef.current) {
24685
24701
  clearInterval(phraseIntervalRef.current);
24686
24702
  phraseIntervalRef.current = null;
@@ -24725,7 +24741,7 @@ var usePhraseCycler = (isActive, shouldShowFocusHint, customPhrases) => {
24725
24741
  };
24726
24742
 
24727
24743
  // src/ui/hooks/visual/use-loading-indicator.ts
24728
- import { useState as useState58, useEffect as useEffect55, useRef as useRef32 } from "react";
24744
+ import { useState as useState58, useEffect as useEffect56, useRef as useRef33 } from "react";
24729
24745
  var useLoadingIndicator = ({
24730
24746
  streamingState,
24731
24747
  shouldShowFocusHint,
@@ -24740,8 +24756,8 @@ var useLoadingIndicator = ({
24740
24756
  shouldShowFocusHint,
24741
24757
  customWittyPhrases
24742
24758
  );
24743
- const prevStreamingStateRef = useRef32(null);
24744
- useEffect55(() => {
24759
+ const prevStreamingStateRef = useRef33(null);
24760
+ useEffect56(() => {
24745
24761
  if (streamingState === "idle" /* Idle */ && prevStreamingStateRef.current === "responding" /* Responding */) {
24746
24762
  setTimerResetKey((prevKey) => prevKey + 1);
24747
24763
  }
@@ -24754,7 +24770,7 @@ var useLoadingIndicator = ({
24754
24770
  };
24755
24771
 
24756
24772
  // src/ui/hooks/session/use-message-queue.ts
24757
- import { useCallback as useCallback48, useEffect as useEffect56, useMemo as useMemo42, useState as useState59 } from "react";
24773
+ import { useCallback as useCallback48, useEffect as useEffect57, useMemo as useMemo42, useState as useState59 } from "react";
24758
24774
  function useMessageQueue({
24759
24775
  queueKey,
24760
24776
  streamingState,
@@ -24793,7 +24809,7 @@ function useMessageQueue({
24793
24809
  );
24794
24810
  return allMessages;
24795
24811
  }, [messageQueue, queueKey]);
24796
- useEffect56(() => {
24812
+ useEffect57(() => {
24797
24813
  if (streamingState === "idle" /* Idle */ && messageQueue.length > 0) {
24798
24814
  const combinedMessage = messageQueue.join("\n\n");
24799
24815
  setQueuedMessages(
@@ -24812,7 +24828,7 @@ function useMessageQueue({
24812
24828
  }
24813
24829
 
24814
24830
  // src/ui/hooks/input/use-input-history-store.ts
24815
- import { useCallback as useCallback49, useRef as useRef33, useState as useState60 } from "react";
24831
+ import { useCallback as useCallback49, useRef as useRef34, useState as useState60 } from "react";
24816
24832
  function deduplicateConsecutive(messages) {
24817
24833
  return messages.filter(
24818
24834
  (message, index) => index === 0 || message !== messages[index - 1]
@@ -24820,7 +24836,7 @@ function deduplicateConsecutive(messages) {
24820
24836
  }
24821
24837
  function useInputHistoryStore() {
24822
24838
  const [inputHistory, setInputHistory] = useState60([]);
24823
- const initializationStarted = useRef33(false);
24839
+ const initializationStarted = useRef34(false);
24824
24840
  const initializeFromHistory = useCallback49(
24825
24841
  async (history) => {
24826
24842
  if (initializationStarted.current) return;
@@ -24942,12 +24958,12 @@ var PromptHistoryStore = class {
24942
24958
  };
24943
24959
 
24944
24960
  // src/ui/hooks/ai/use-turn-activity-monitor.ts
24945
- import { useState as useState61, useEffect as useEffect57, useRef as useRef34 } from "react";
24961
+ import { useState as useState61, useEffect as useEffect58, useRef as useRef35 } from "react";
24946
24962
  var useTurnActivityMonitor = (streamingState, activePtyId) => {
24947
24963
  const [operationStartTime, setOperationStartTime] = useState61(0);
24948
- const prevPtyIdRef = useRef34(void 0);
24949
- const prevStreamingStateRef = useRef34(void 0);
24950
- useEffect57(() => {
24964
+ const prevPtyIdRef = useRef35(void 0);
24965
+ const prevStreamingStateRef = useRef35(void 0);
24966
+ useEffect58(() => {
24951
24967
  const isNowResponding = streamingState === "responding" /* Responding */;
24952
24968
  const wasResponding = prevStreamingStateRef.current === "responding" /* Responding */;
24953
24969
  const ptyChanged = activePtyId !== prevPtyIdRef.current;
@@ -25006,7 +25022,7 @@ var useShellInactivityStatus = ({
25006
25022
  };
25007
25023
 
25008
25024
  // src/ui/hooks/input/use-local-shell-command.ts
25009
- import { useCallback as useCallback50, useEffect as useEffect58, useRef as useRef35, useState as useState62 } from "react";
25025
+ import { useCallback as useCallback50, useEffect as useEffect59, useRef as useRef36, useState as useState62 } from "react";
25010
25026
  import crypto2 from "node:crypto";
25011
25027
  import fs11 from "node:fs";
25012
25028
  import os3 from "node:os";
@@ -25023,13 +25039,13 @@ function useLocalShellCommand({
25023
25039
  terminalWidth,
25024
25040
  terminalHeight
25025
25041
  }) {
25026
- const controllerRef = useRef35(void 0);
25027
- const mountedRef = useRef35(true);
25042
+ const controllerRef = useRef36(void 0);
25043
+ const mountedRef = useRef36(true);
25028
25044
  const [isExecuting, setIsExecuting] = useState62(false);
25029
25045
  const [activePtyId, setActivePtyId] = useState62(void 0);
25030
25046
  const [lastOutputTime, setLastOutputTime] = useState62(0);
25031
25047
  const cancel = useCallback50(() => controllerRef.current?.abort(), []);
25032
- useEffect58(() => {
25048
+ useEffect59(() => {
25033
25049
  mountedRef.current = true;
25034
25050
  return () => {
25035
25051
  mountedRef.current = false;
@@ -25315,18 +25331,18 @@ var AppContainer = (props) => {
25315
25331
  interactionModeRuntime.getSnapshot,
25316
25332
  interactionModeRuntime.getSnapshot
25317
25333
  );
25318
- const conversationHistoryIds = useRef36(/* @__PURE__ */ new Map());
25319
- const conversationHistoryTexts = useRef36(/* @__PURE__ */ new Map());
25334
+ const conversationHistoryIds = useRef37(/* @__PURE__ */ new Map());
25335
+ const conversationHistoryTexts = useRef37(/* @__PURE__ */ new Map());
25320
25336
  const conversationSessionId = conversationRuntime.getSessionStats().sessionId;
25321
25337
  const [projectedSessionId, setProjectedSessionId] = useState63(
25322
25338
  conversationSessionId
25323
25339
  );
25324
- const promptInputAbortRef = useRef36(void 0);
25340
+ const promptInputAbortRef = useRef37(void 0);
25325
25341
  const [promptInputPreparing, setPromptInputPreparing] = useState63(false);
25326
25342
  const addConversationHistoryItem = historyManager.addItem;
25327
25343
  const updateConversationHistoryItem = historyManager.updateItem;
25328
25344
  const clearConversationHistory = historyManager.clearItems;
25329
- useEffect59(() => {
25345
+ useEffect60(() => {
25330
25346
  if (projectedSessionId !== conversationSessionId) {
25331
25347
  conversationHistoryIds.current.clear();
25332
25348
  conversationHistoryTexts.current.clear();
@@ -25407,7 +25423,7 @@ var AppContainer = (props) => {
25407
25423
  const [modelSelectionSnapshot, setModelSelectionSnapshot] = useState63(
25408
25424
  () => modelSelectionRuntime?.getSnapshot()
25409
25425
  );
25410
- useEffect59(
25426
+ useEffect60(
25411
25427
  () => modelSelectionRuntime?.subscribe(
25412
25428
  () => setModelSelectionSnapshot(modelSelectionRuntime.getSnapshot())
25413
25429
  ),
@@ -25434,16 +25450,16 @@ var AppContainer = (props) => {
25434
25450
  const app = useApp();
25435
25451
  const { stats: sessionStats } = useSessionStats();
25436
25452
  const branchName = useGitBranchName(config.getTargetDir());
25437
- const mainControlsRef = useRef36(null);
25438
- const rootUiRef = useRef36(null);
25439
- const lastTitleRef = useRef36(null);
25453
+ const mainControlsRef = useRef37(null);
25454
+ const rootUiRef = useRef37(null);
25455
+ const lastTitleRef = useRef37(null);
25440
25456
  const staticExtraHeight = 3;
25441
- useEffect59(() => {
25457
+ useEffect60(() => {
25442
25458
  void (async () => {
25443
25459
  startupProfiler.flush();
25444
25460
  })();
25445
25461
  }, []);
25446
- useEffect59(() => {
25462
+ useEffect60(() => {
25447
25463
  const handleSettingsChanged = () => {
25448
25464
  setSettingsNonce((prev) => prev + 1);
25449
25465
  };
@@ -25479,7 +25495,7 @@ var AppContainer = (props) => {
25479
25495
  shellModeActive,
25480
25496
  getPreferredEditor
25481
25497
  });
25482
- useEffect59(() => {
25498
+ useEffect60(() => {
25483
25499
  initializeFromHistory(promptHistory);
25484
25500
  }, [initializeFromHistory, promptHistory]);
25485
25501
  const refreshStatic = useCallback51(() => {
@@ -25498,7 +25514,7 @@ var AppContainer = (props) => {
25498
25514
  terminalCapabilityManager.enableSupportedModes();
25499
25515
  refreshStatic();
25500
25516
  }, [refreshStatic, isAlternateBuffer, app, config]);
25501
- useEffect59(() => {
25517
+ useEffect60(() => {
25502
25518
  coreEvents.on(CoreEvent.ExternalEditorClosed, handleEditorClose);
25503
25519
  return () => {
25504
25520
  coreEvents.off(CoreEvent.ExternalEditorClosed, handleEditorClose);
@@ -25577,8 +25593,8 @@ var AppContainer = (props) => {
25577
25593
  skillCatalogRuntime,
25578
25594
  agentActivityRuntime
25579
25595
  );
25580
- const commandPreparationRef = useRef36(void 0);
25581
- useEffect59(() => {
25596
+ const commandPreparationRef = useRef37(void 0);
25597
+ useEffect60(() => {
25582
25598
  if (!isSlashCommand(buffer.text.trim()) || commandPreparationRef.current !== void 0) {
25583
25599
  return;
25584
25600
  }
@@ -25594,12 +25610,12 @@ var AppContainer = (props) => {
25594
25610
  }
25595
25611
  });
25596
25612
  }, [buffer.text, commandRuntime]);
25597
- useEffect59(() => () => commandPreparationRef.current?.abort(), []);
25598
- const cancelHandlerRef = useRef36(
25613
+ useEffect60(() => () => commandPreparationRef.current?.abort(), []);
25614
+ const cancelHandlerRef = useRef37(
25599
25615
  () => {
25600
25616
  }
25601
25617
  );
25602
- useEffect59(() => {
25618
+ useEffect60(() => {
25603
25619
  if (pendingRestorePrompt) {
25604
25620
  const lastHistoryUserMsg = historyManager.history.findLast(
25605
25621
  (h) => h.type === "user"
@@ -25714,14 +25730,14 @@ var AppContainer = (props) => {
25714
25730
  promptInputAbortRef.current?.abort();
25715
25731
  conversationRuntime.cancel();
25716
25732
  }, [cancelCommand, cancelLocalShell, conversationRuntime]);
25717
- useEffect59(
25733
+ useEffect60(
25718
25734
  () => () => {
25719
25735
  promptInputAbortRef.current?.abort();
25720
25736
  },
25721
25737
  []
25722
25738
  );
25723
- const lastOutputTimeRef = useRef36(0);
25724
- useEffect59(() => {
25739
+ const lastOutputTimeRef = useRef37(0);
25740
+ useEffect60(() => {
25725
25741
  lastOutputTimeRef.current = lastOutputTime;
25726
25742
  }, [lastOutputTime]);
25727
25743
  const { shouldShowFocusHint, inactivityStatus } = useShellInactivityStatus({
@@ -25831,9 +25847,9 @@ ${queuedText}` : queuedText;
25831
25847
  () => props.initialPrompt ?? config.getQuestion(),
25832
25848
  [config, props.initialPrompt]
25833
25849
  );
25834
- const initialPromptSubmitted = useRef36(false);
25850
+ const initialPromptSubmitted = useRef37(false);
25835
25851
  const providerSetupRequired = providerSetupSnapshot?.current.status === "missing";
25836
- useEffect59(() => {
25852
+ useEffect60(() => {
25837
25853
  if (!providerSetupRuntime || !providerSetupRequired || providerSetupDismissed || customDialog) {
25838
25854
  return;
25839
25855
  }
@@ -25865,7 +25881,7 @@ ${queuedText}` : queuedText;
25865
25881
  providerSetupRuntime,
25866
25882
  providerSetupSnapshot
25867
25883
  ]);
25868
- useEffect59(() => {
25884
+ useEffect60(() => {
25869
25885
  if (activePtyId) {
25870
25886
  try {
25871
25887
  ShellExecutionService.resizePty(
@@ -25883,7 +25899,7 @@ ${queuedText}` : queuedText;
25883
25899
  }
25884
25900
  }
25885
25901
  }, [terminalWidth, availableTerminalHeight, activePtyId]);
25886
- useEffect59(() => {
25902
+ useEffect60(() => {
25887
25903
  if (initialPrompt && !initialPromptSubmitted.current && !isThemeDialogOpen && !isEditorDialogOpen && !providerSetupRequired && !customDialog && conversationRuntime) {
25888
25904
  handleFinalSubmit(initialPrompt);
25889
25905
  initialPromptSubmitted.current = true;
@@ -25901,15 +25917,15 @@ ${queuedText}` : queuedText;
25901
25917
  const [showFullTodos, setShowFullTodos] = useState63(false);
25902
25918
  const [renderMarkdown, setRenderMarkdown] = useState63(true);
25903
25919
  const [ctrlCPressCount, setCtrlCPressCount] = useState63(0);
25904
- const ctrlCTimerRef = useRef36(null);
25920
+ const ctrlCTimerRef = useRef37(null);
25905
25921
  const [ctrlDPressCount, setCtrlDPressCount] = useState63(0);
25906
- const ctrlDTimerRef = useRef36(null);
25922
+ const ctrlDTimerRef = useRef37(null);
25907
25923
  const [constrainHeight, setConstrainHeight] = useState63(true);
25908
25924
  const [showEscapePrompt, setShowEscapePrompt] = useState63(false);
25909
25925
  const [warningMessage, setWarningMessage] = useState63(null);
25910
- const isInitialMount = useRef36(true);
25911
- const warningTimeoutRef = useRef36(null);
25912
- const tabFocusTimeoutRef = useRef36(null);
25926
+ const isInitialMount = useRef37(true);
25927
+ const warningTimeoutRef = useRef37(null);
25928
+ const tabFocusTimeoutRef = useRef37(null);
25913
25929
  const handleWarning = useCallback51((message) => {
25914
25930
  setWarningMessage(message);
25915
25931
  if (warningTimeoutRef.current) {
@@ -25919,7 +25935,7 @@ ${queuedText}` : queuedText;
25919
25935
  setWarningMessage(null);
25920
25936
  }, WARNING_PROMPT_DURATION_MS);
25921
25937
  }, []);
25922
- useEffect59(() => {
25938
+ useEffect60(() => {
25923
25939
  const handleSelectionWarning = () => {
25924
25940
  handleWarning("Press Ctrl-S to enter selection mode to copy text.");
25925
25941
  };
@@ -25939,7 +25955,7 @@ ${queuedText}` : queuedText;
25939
25955
  }
25940
25956
  };
25941
25957
  }, [handleWarning]);
25942
- useEffect59(() => {
25958
+ useEffect60(() => {
25943
25959
  if (queueErrorMessage) {
25944
25960
  const timer = setTimeout(() => {
25945
25961
  setQueueErrorMessage(null);
@@ -25948,7 +25964,7 @@ ${queuedText}` : queuedText;
25948
25964
  }
25949
25965
  return void 0;
25950
25966
  }, [queueErrorMessage, setQueueErrorMessage]);
25951
- useEffect59(() => {
25967
+ useEffect60(() => {
25952
25968
  if (isInitialMount.current) {
25953
25969
  isInitialMount.current = false;
25954
25970
  return;
@@ -25960,7 +25976,7 @@ ${queuedText}` : queuedText;
25960
25976
  clearTimeout(handler);
25961
25977
  };
25962
25978
  }, [terminalWidth, refreshStatic]);
25963
- useEffect59(() => {
25979
+ useEffect60(() => {
25964
25980
  const openDebugConsole = () => {
25965
25981
  setShowErrorDetails(true);
25966
25982
  setConstrainHeight(false);
@@ -25970,7 +25986,7 @@ ${queuedText}` : queuedText;
25970
25986
  appEvents.off("open-debug-console" /* OpenDebugConsole */, openDebugConsole);
25971
25987
  };
25972
25988
  }, [config]);
25973
- useEffect59(() => {
25989
+ useEffect60(() => {
25974
25990
  if (ctrlCTimerRef.current) {
25975
25991
  clearTimeout(ctrlCTimerRef.current);
25976
25992
  ctrlCTimerRef.current = null;
@@ -25984,7 +26000,7 @@ ${queuedText}` : queuedText;
25984
26000
  }, WARNING_PROMPT_DURATION_MS);
25985
26001
  }
25986
26002
  }, [ctrlCPressCount, config, setCtrlCPressCount, handleSlashCommand]);
25987
- useEffect59(() => {
26003
+ useEffect60(() => {
25988
26004
  if (ctrlDTimerRef.current) {
25989
26005
  clearTimeout(ctrlDTimerRef.current);
25990
26006
  ctrlCTimerRef.current = null;
@@ -26135,7 +26151,7 @@ ${queuedText}` : queuedText;
26135
26151
  ]
26136
26152
  );
26137
26153
  useKeypress(handleGlobalKeypress, { isActive: true });
26138
- useEffect59(() => {
26154
+ useEffect60(() => {
26139
26155
  if (settings.merged.ui.hideWindowTitle) return;
26140
26156
  const paddedTitle = computeTerminalTitle({
26141
26157
  streamingState,
@@ -26161,7 +26177,7 @@ ${queuedText}` : queuedText;
26161
26177
  config,
26162
26178
  stdout
26163
26179
  ]);
26164
- useEffect59(() => {
26180
+ useEffect60(() => {
26165
26181
  const handleUserFeedback = (payload) => {
26166
26182
  let type;
26167
26183
  switch (payload.severity) {
@@ -26677,12 +26693,6 @@ function projectDshContentBlock(block) {
26677
26693
  name: block.name,
26678
26694
  arguments: block.arguments
26679
26695
  };
26680
- case "tool-result":
26681
- return {
26682
- type: "extension",
26683
- blockType: block.type,
26684
- payload: block
26685
- };
26686
26696
  default: {
26687
26697
  const extension = block;
26688
26698
  return {
@@ -27022,20 +27032,18 @@ var DshSessionProjector = class {
27022
27032
  }
27023
27033
  if (event.type === "tool/result") {
27024
27034
  if (this.cancelledTurns.has(event.data.turn)) return;
27025
- const callId = String(event.data.message.source.callId);
27035
+ const callId = String(event.data.message.toolCallId);
27026
27036
  const id = `tool-${callId}`;
27027
- const resultBlock = event.data.message.content.find(
27028
- (block) => block.type === "tool-result"
27029
- );
27030
- const failed = resultBlock?.isError === true || event.data.error !== void 0;
27037
+ const message = event.data.message;
27038
+ const failed = message.isError === true || event.data.error !== void 0;
27031
27039
  const result = {
27032
- content: projectDshContent(resultBlock?.content ?? []),
27040
+ content: projectDshContent(message.content),
27033
27041
  isError: failed,
27034
27042
  ...event.data.error === void 0 ? {} : { error: event.data.error },
27035
27043
  ...event.data.meta === void 0 ? {} : { meta: event.data.meta }
27036
27044
  };
27037
27045
  const existingMessage = this.snapshot.messages.find(
27038
- (message) => message.id === id && message.role === "tool"
27046
+ (message2) => message2.id === id && message2.role === "tool"
27039
27047
  );
27040
27048
  const toolName = this.toolNames.get(callId) ?? "tool";
27041
27049
  const tool = this.metrics.tools.byName[toolName] ??= createInitialToolCallStats();
@@ -27051,7 +27059,7 @@ var DshSessionProjector = class {
27051
27059
  toolName,
27052
27060
  existingMessage?.arguments ?? "",
27053
27061
  {
27054
- content: resultBlock?.content ?? [],
27062
+ content: [...message.content],
27055
27063
  isError: failed,
27056
27064
  ...event.data.meta === void 0 ? {} : { meta: event.data.meta }
27057
27065
  }
@@ -29546,6 +29554,11 @@ function waitForSharedPromise(promise, signal) {
29546
29554
 
29547
29555
  // src/dsh/agent-preset-runtime.ts
29548
29556
  var EMPTY_OPTIONS = Object.freeze([]);
29557
+ async function resolveNewSessionPreset(presets, requestedId) {
29558
+ if (requestedId === void 0) return presets.resolve();
29559
+ const roster = await presets.remoteExportList();
29560
+ return presets.resolve(roster.modeSelectionEnabled ? requestedId : void 0);
29561
+ }
29549
29562
  var DshAgentPresetRuntime = class {
29550
29563
  constructor(presets, projections, activeAgent, pendingPresetId, selectPendingPreset, onSelected) {
29551
29564
  this.presets = presets;
@@ -29579,7 +29592,6 @@ var DshAgentPresetRuntime = class {
29579
29592
  };
29580
29593
  async prepare(signal) {
29581
29594
  signal?.throwIfAborted();
29582
- if (this.snapshot.status === "ready") return;
29583
29595
  let loading = this.loading;
29584
29596
  if (loading === void 0) {
29585
29597
  loading = this.load().finally(() => {
@@ -29590,8 +29602,12 @@ var DshAgentPresetRuntime = class {
29590
29602
  return waitForSharedPromise(loading, signal);
29591
29603
  }
29592
29604
  async select(id, signal) {
29605
+ const agent = this.activeAgent();
29593
29606
  await this.prepare(signal);
29594
29607
  signal?.throwIfAborted();
29608
+ if (this.activeAgent() !== agent) {
29609
+ throw new Error("The active Session changed. Reopen Agent presets.");
29610
+ }
29595
29611
  if (!this.snapshot.modeSelectionEnabled) {
29596
29612
  throw new Error("Agent preset selection is disabled by the DSH host.");
29597
29613
  }
@@ -29606,7 +29622,6 @@ var DshAgentPresetRuntime = class {
29606
29622
  if (this.snapshot.busy) {
29607
29623
  throw new Error("Another Agent preset change is already in progress.");
29608
29624
  }
29609
- const agent = this.activeAgent();
29610
29625
  if (agent === void 0) {
29611
29626
  this.selectPendingPreset(id);
29612
29627
  this.refreshCurrent();
@@ -29652,15 +29667,14 @@ var DshAgentPresetRuntime = class {
29652
29667
  id: preset.id,
29653
29668
  name: preset.name ?? preset.id,
29654
29669
  ...preset.description === void 0 ? {} : { description: preset.description },
29655
- trust: preset.trust,
29656
- isDefault: preset.id === this.presets.defaultId,
29670
+ isDefault: preset.isDefault,
29657
29671
  ...preset.broken === void 0 ? {} : { broken: preset.broken }
29658
29672
  })
29659
29673
  );
29660
29674
  this.snapshot = Object.freeze({
29661
29675
  status: "ready",
29662
29676
  modeSelectionEnabled: roster.modeSelectionEnabled,
29663
- currentId: this.currentId(),
29677
+ currentId: this.currentId(roster.modeSelectionEnabled),
29664
29678
  options: Object.freeze(options),
29665
29679
  busy: this.snapshot.busy
29666
29680
  });
@@ -29669,16 +29683,17 @@ var DshAgentPresetRuntime = class {
29669
29683
  this.snapshot = Object.freeze({
29670
29684
  ...this.snapshot,
29671
29685
  status: "error",
29686
+ modeSelectionEnabled: false,
29672
29687
  error: error instanceof Error ? error.message : String(error)
29673
29688
  });
29674
29689
  this.emit();
29675
29690
  throw error;
29676
29691
  }
29677
29692
  }
29678
- currentId() {
29693
+ currentId(modeSelectionEnabled = this.snapshot?.modeSelectionEnabled) {
29679
29694
  const agent = this.activeAgent();
29680
29695
  if (agent === void 0)
29681
- return this.pendingPresetId() ?? this.presets.defaultId;
29696
+ return (modeSelectionEnabled === false ? void 0 : this.pendingPresetId()) ?? this.presets.defaultId;
29682
29697
  return this.projections.snapshot(agent.session).values.agentPreset ?? this.presets.defaultId;
29683
29698
  }
29684
29699
  refreshCurrent() {
@@ -29830,8 +29845,11 @@ var DshAgentActivityRuntime = class {
29830
29845
  this.activeAgent = activeAgent;
29831
29846
  this.ensureAgent = ensureAgent;
29832
29847
  this.isSwitching = isSwitching;
29833
- const offJobs = jobs.onJobsChanged((owner) => {
29834
- if (owner === this.activeAgent()) this.refresh();
29848
+ const offJobs = jobs.events.subscribe({ owners: "all" }, (event) => {
29849
+ if (event.type === "output") return;
29850
+ const agent = this.activeAgent();
29851
+ if (agent !== void 0 && event.job.owner === agent.session.id)
29852
+ this.refresh();
29835
29853
  });
29836
29854
  const offSession = subscribeSession((session, event) => {
29837
29855
  if (session === this.activeAgent()?.session && event.type.startsWith("goal/"))
@@ -29867,10 +29885,14 @@ var DshAgentActivityRuntime = class {
29867
29885
  "The active Session changed. Reopen Jobs before stopping work."
29868
29886
  );
29869
29887
  }
29870
- const job = this.jobs.get(JobId(jobId), agent);
29871
- if (String(job.ownerSession) !== sessionId)
29888
+ const job = this.jobs.get(JobId(jobId), agent.session.id);
29889
+ if (String(job.owner) !== sessionId)
29872
29890
  throw new Error("This job belongs to another Session.");
29873
- this.jobs.kill(job.id, agent, "Stopped by the user in DSH Console.");
29891
+ this.jobs.kill(
29892
+ job.id,
29893
+ agent.session.id,
29894
+ "Stopped by the user in DSH Console."
29895
+ );
29874
29896
  this.refresh();
29875
29897
  }
29876
29898
  async changeGoal(expected, action, signal) {
@@ -29943,13 +29965,13 @@ var DshAgentActivityRuntime = class {
29943
29965
  this.snapshot = {
29944
29966
  sessionId,
29945
29967
  busy: this.changing,
29946
- jobs: agent === void 0 ? [] : this.jobs.list(agent).filter((job) => job.ownerSession === agent.session.id).map((job) => ({
29968
+ jobs: agent === void 0 ? [] : this.jobs.list(agent.session.id).filter((job) => job.owner === agent.session.id).map((job) => ({
29947
29969
  id: String(job.id),
29948
29970
  kind: String(job.kind),
29949
29971
  label: job.label,
29950
29972
  sessionId: String(agent.session.id),
29951
29973
  status: job.status,
29952
- detail: job.detail,
29974
+ detail: job.progress ?? job.detail,
29953
29975
  startedAt: job.startedAt,
29954
29976
  finishedAt: job.finishedAt
29955
29977
  })),
@@ -30340,7 +30362,7 @@ async function start(ctx, config) {
30340
30362
  model: selected.model,
30341
30363
  ...selected.reasoningEffort === void 0 ? {} : { reasoningEffort: selected.reasoningEffort }
30342
30364
  };
30343
- const preset = options.resumeSessionId === void 0 && options.inheritPresetFrom === void 0 ? await agentPresets.resolve(options.presetId) : void 0;
30365
+ const preset = options.resumeSessionId === void 0 && options.inheritPresetFrom === void 0 ? await resolveNewSessionPreset(agentPresets, options.presetId) : void 0;
30344
30366
  const inheritedPresetId = options.inheritPresetFrom === void 0 ? void 0 : sessionProjections.snapshot(options.inheritPresetFrom.session).values.agentPreset ?? void 0;
30345
30367
  const setup = async (agentCtx, agent) => {
30346
30368
  const ref = {
@@ -30356,19 +30378,18 @@ async function start(ctx, config) {
30356
30378
  }
30357
30379
  if (options.restrictTools) agentCtx.tools.restrict({ allow: [] });
30358
30380
  };
30381
+ const fork = options.seed === void 0 ? void 0 : forkSeedOptions(options.seed);
30359
30382
  const handle = options.resumeSessionId === void 0 ? await agents.create({
30360
30383
  sessionId: options.sessionId ?? SessionId5(`dsh-console-${randomUUID3()}`),
30361
30384
  meta: {
30362
30385
  cwd: process.cwd(),
30363
30386
  ...options.parentSession === void 0 ? {} : { parentSession: options.parentSession },
30364
- ...options.seed === void 0 ? {} : forkSeedOptions(options.seed).meta,
30387
+ ...fork?.meta,
30365
30388
  ...(preset?.id ?? inheritedPresetId) === void 0 ? {} : { agentPreset: preset?.id ?? inheritedPresetId }
30366
30389
  },
30367
- ...options.seed === void 0 ? {} : {
30368
- seed: options.seed,
30369
- ..."inheritedEventCount" in forkSeedOptions(options.seed) ? {
30370
- inheritedEventCount: forkSeedOptions(options.seed).inheritedEventCount
30371
- } : {}
30390
+ ...fork === void 0 ? {} : {
30391
+ seed: fork.seed,
30392
+ inheritedEventCount: fork.inheritedEventCount
30372
30393
  },
30373
30394
  agentOptions,
30374
30395
  setup,
@@ -30687,10 +30708,7 @@ async function start(ctx, config) {
30687
30708
  );
30688
30709
  return records.map((record) => {
30689
30710
  const live = sessions.get(record.header.id);
30690
- const projection = live === void 0 ? record.header.isSeeded ? void 0 : sessionProjectionCache.cachedSnapshot(
30691
- record.header,
30692
- SessionLogOffset2(0)
30693
- ) : sessionProjections.cachedSnapshot(live);
30711
+ const projection = live === void 0 ? sessionProjectionCache.cachedSnapshot(record.header) : sessionProjections.cachedSnapshot(live);
30694
30712
  const metadata = projection?.values.sessionListMetadata;
30695
30713
  const title = projection?.values.title;
30696
30714
  return {