scope-agent-workbench 0.2.0 → 0.2.3
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/CHANGELOG.md +41 -0
- package/bridge/agent-email-relay.mjs +160 -160
- package/bridge/app-server-websocket-transport.mjs +219 -219
- package/bridge/archive/service.mjs +130 -130
- package/bridge/auth-profile-failover.mjs +58 -58
- package/bridge/auth-profile-manager.mjs +215 -215
- package/bridge/capacity-recovery.mjs +90 -90
- package/bridge/gpu-usage-history.mjs +322 -322
- package/bridge/local/history.mjs +20 -5
- package/bridge/plugins/aliyun-dlc/monitor.mjs +236 -236
- package/bridge/plugins/aliyun-dlc/probe.mjs +701 -701
- package/bridge/private-gateway.mjs +371 -371
- package/bridge/private-start.mjs +22 -22
- package/bridge/probes/app-server-handoff-probe.mjs +87 -87
- package/bridge/probes/app-server-writer-probe.mjs +69 -69
- package/bridge/probes/assistant-search-probe.mjs +321 -321
- package/bridge/probes/dialogue-probe.mjs +462 -462
- package/bridge/probes/history-probe.mjs +430 -345
- package/bridge/probes/new-session-preflight.mjs +14 -14
- package/bridge/probes/profile-cancel-probe.mjs +17 -17
- package/bridge/probes/profile-delete-probe.mjs +26 -26
- package/bridge/probes/profile-list-probe.mjs +114 -114
- package/bridge/probes/profile-write-probe.mjs +109 -109
- package/bridge/probes/raw-context-probe.mjs +51 -51
- package/bridge/probes/remote-probe.mjs +627 -626
- package/bridge/probes/submission-probe.mjs +2 -2
- package/bridge/probes/takeover-probe.mjs +326 -326
- package/bridge/probes/vscode-open-preflight.mjs +21 -21
- package/bridge/providers/claude-interactive.py +463 -341
- package/bridge/providers/cli-command.mjs +103 -103
- package/bridge/providers/conversations.mjs +231 -231
- package/bridge/providers/native-commands.py +38 -38
- package/bridge/providers/native-session-state.mjs +14 -14
- package/bridge/providers/native-session-state.py +96 -96
- package/bridge/providers/remote-job.py +130 -130
- package/bridge/remote-app-server-command.mjs +121 -121
- package/bridge/remote-directory-listing.mjs +148 -148
- package/bridge/rollout-summary.mjs +20 -2
- package/bridge/routes/dialogue.mjs +48 -3
- package/bridge/routes/models.mjs +312 -312
- package/bridge/server.mjs +3357 -3332
- package/bridge/session-attachments.mjs +150 -150
- package/bridge/session-catalog/agy-history.py +141 -2
- package/bridge/session-catalog/catalog.mjs +17 -0
- package/bridge/session-catalog/probe.py +1207 -331
- package/bridge/session-catalog/routes.mjs +6 -0
- package/bridge/start.mjs +205 -205
- package/bridge/state-persistence.mjs +9 -1
- package/bridge/tmux-session-control.mjs +29 -29
- package/bridge/vscode-opener.mjs +157 -157
- package/bridge/web-terminal.mjs +52 -52
- package/bridge/workbench/manager-context.mjs +51 -51
- package/bridge/workbench/service.mjs +301 -301
- package/dist/client/.vite/manifest.json +4 -4
- package/dist/client/assets/{index-Enu1x0PS.js → index-BMior55c.js} +2 -2
- package/dist/client/assets/{layout-segment-context-CmJzExWq.js → layout-segment-context-DjGudgXn.js} +1 -1
- package/dist/client/assets/page-CJqXlhDs.js +551 -0
- package/dist/client/assets/page-LYzRz6_S.css +1 -0
- package/dist/client/favicon.svg +6 -6
- package/dist/server/__vite_rsc_assets_manifest.js +8 -8
- package/dist/server/index.js +7 -7
- package/dist/server/ssr/__vite_rsc_assets_manifest.js +8 -8
- package/dist/server/ssr/assets/{page-CYYyCnKD.js → page-BB9Dri2u.js} +2416 -271
- package/dist/server/ssr/assets/page-LYzRz6_S.css +1 -0
- package/dist/server/ssr/index.js +1 -1
- package/dist/server/ssr/vinext-server.json +1 -1
- package/dist/server/vinext-server.json +1 -1
- package/dist/server/wrangler.json +1 -1
- package/lib/browser-snapshot-cache.js +53 -53
- package/lib/formula-preview.js +1 -1
- package/lib/incremental-snapshot.js +300 -300
- package/lib/markdown-math.js +151 -151
- package/lib/remote-links.js +95 -95
- package/lib/runtime-config.js +70 -70
- package/lib/session-filters.js +38 -38
- package/lib/ssh-config.js +26 -26
- package/lib/stable-order.js +39 -39
- package/lib/subagent-display-prefs.ts +130 -0
- package/package.json +1 -1
- package/scripts/agent-email-relay.mjs +104 -104
- package/scripts/email-notification-cli.mjs +28 -28
- package/scripts/enable-private-access.ps1 +109 -109
- package/scripts/fixtures/native-conversations.mjs +164 -6
- package/scripts/fixtures/workbench-conversations.mjs +475 -352
- package/scripts/preview-workbench.mjs +669 -669
- package/dist/client/assets/page-COBv6VWj.css +0 -1
- package/dist/client/assets/page-DVjU6VG_.js +0 -550
- package/dist/server/ssr/assets/page-COBv6VWj.css +0 -1
|
@@ -19426,12 +19426,12 @@ function defaultUrlTransform(value) {
|
|
|
19426
19426
|
}
|
|
19427
19427
|
//#endregion
|
|
19428
19428
|
//#region lib/i18n.tsx
|
|
19429
|
-
var STORAGE_KEY = "scope:locale";
|
|
19429
|
+
var STORAGE_KEY$1 = "scope:locale";
|
|
19430
19430
|
var LOCALE_EVENT = "scope:locale-change";
|
|
19431
19431
|
var fallbackLocale = "zh-CN";
|
|
19432
19432
|
function readLocale() {
|
|
19433
19433
|
try {
|
|
19434
|
-
const saved = window.localStorage.getItem(STORAGE_KEY);
|
|
19434
|
+
const saved = window.localStorage.getItem(STORAGE_KEY$1);
|
|
19435
19435
|
if (saved === "en" || saved === "zh-CN") return saved;
|
|
19436
19436
|
} catch {}
|
|
19437
19437
|
return fallbackLocale;
|
|
@@ -19455,7 +19455,7 @@ function LocaleProvider({ children }) {
|
|
|
19455
19455
|
function setLocale(next) {
|
|
19456
19456
|
fallbackLocale = next;
|
|
19457
19457
|
try {
|
|
19458
|
-
window.localStorage.setItem(STORAGE_KEY, next);
|
|
19458
|
+
window.localStorage.setItem(STORAGE_KEY$1, next);
|
|
19459
19459
|
} catch {}
|
|
19460
19460
|
window.dispatchEvent(new Event(LOCALE_EVENT));
|
|
19461
19461
|
}
|
|
@@ -87721,6 +87721,158 @@ function useSessionArchives(onArchived) {
|
|
|
87721
87721
|
change
|
|
87722
87722
|
};
|
|
87723
87723
|
}
|
|
87724
|
+
/**
|
|
87725
|
+
* @license lucide-react v1.25.0 - ISC
|
|
87726
|
+
*
|
|
87727
|
+
* This source code is licensed under the ISC license.
|
|
87728
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
87729
|
+
*/
|
|
87730
|
+
var ChevronDown = createLucideIcon("chevron-down", [["path", {
|
|
87731
|
+
d: "m6 9 6 6 6-6",
|
|
87732
|
+
key: "qrunsl"
|
|
87733
|
+
}]]);
|
|
87734
|
+
/**
|
|
87735
|
+
* @license lucide-react v1.25.0 - ISC
|
|
87736
|
+
*
|
|
87737
|
+
* This source code is licensed under the ISC license.
|
|
87738
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
87739
|
+
*/
|
|
87740
|
+
var ChevronUp = createLucideIcon("chevron-up", [["path", {
|
|
87741
|
+
d: "m18 15-6-6-6 6",
|
|
87742
|
+
key: "153udz"
|
|
87743
|
+
}]]);
|
|
87744
|
+
//#endregion
|
|
87745
|
+
//#region components/collapsible-user-message.tsx
|
|
87746
|
+
var OVERFLOW_THRESHOLD_PX = 216;
|
|
87747
|
+
function formatCompactCount(count) {
|
|
87748
|
+
if (count >= 1e3) return `${(count / 1e3).toFixed(1)}k`;
|
|
87749
|
+
return String(count);
|
|
87750
|
+
}
|
|
87751
|
+
function CollapsibleUserMessage({ value, remoteHost, remoteCwd, surface = "panel-2" }) {
|
|
87752
|
+
const { tr } = useLocale();
|
|
87753
|
+
const rootRef = (0, import_react.useRef)(null);
|
|
87754
|
+
const innerRef = (0, import_react.useRef)(null);
|
|
87755
|
+
const stats = (0, import_react.useMemo)(() => {
|
|
87756
|
+
const trimmed = (value || "").trim();
|
|
87757
|
+
const lines = trimmed ? trimmed.split(/\r?\n/).length : 0;
|
|
87758
|
+
const chars = trimmed.length;
|
|
87759
|
+
return {
|
|
87760
|
+
lines,
|
|
87761
|
+
chars,
|
|
87762
|
+
likelyOverflow: lines >= 7 || chars >= 320
|
|
87763
|
+
};
|
|
87764
|
+
}, [value]);
|
|
87765
|
+
const [expanded, setExpanded] = (0, import_react.useState)(false);
|
|
87766
|
+
const [measuredOverflow, setMeasuredOverflow] = (0, import_react.useState)(null);
|
|
87767
|
+
(0, import_react.useLayoutEffect)(() => {
|
|
87768
|
+
const el = innerRef.current;
|
|
87769
|
+
if (!el) return;
|
|
87770
|
+
const measure = () => {
|
|
87771
|
+
setMeasuredOverflow(el.scrollHeight > OVERFLOW_THRESHOLD_PX);
|
|
87772
|
+
};
|
|
87773
|
+
measure();
|
|
87774
|
+
if (typeof ResizeObserver === "undefined") return;
|
|
87775
|
+
const observer = new ResizeObserver(measure);
|
|
87776
|
+
observer.observe(el);
|
|
87777
|
+
return () => observer.disconnect();
|
|
87778
|
+
}, [value]);
|
|
87779
|
+
const collapsible = measuredOverflow ?? stats.likelyOverflow;
|
|
87780
|
+
const isCollapsed = collapsible && !expanded;
|
|
87781
|
+
const metaLabel = stats.lines >= 4 ? tr(`${stats.lines} 行`, `${stats.lines} lines`) : tr(`${formatCompactCount(stats.chars)} 字`, `${formatCompactCount(stats.chars)} chars`);
|
|
87782
|
+
const handleToggle = () => {
|
|
87783
|
+
if (expanded) {
|
|
87784
|
+
const rect = rootRef.current?.getBoundingClientRect();
|
|
87785
|
+
setExpanded(false);
|
|
87786
|
+
if (rect && rect.top < 80) requestAnimationFrame(() => {
|
|
87787
|
+
rootRef.current?.scrollIntoView({ block: "nearest" });
|
|
87788
|
+
});
|
|
87789
|
+
} else setExpanded(true);
|
|
87790
|
+
};
|
|
87791
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
|
|
87792
|
+
ref: rootRef,
|
|
87793
|
+
className: `collapsible-user-msg is-surface-${surface}${isCollapsed ? " is-collapsed" : ""}`,
|
|
87794
|
+
"data-collapsible": collapsible ? "true" : "false",
|
|
87795
|
+
children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
|
|
87796
|
+
className: "collapsible-user-msg-clip",
|
|
87797
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
|
|
87798
|
+
ref: innerRef,
|
|
87799
|
+
className: "collapsible-user-msg-inner",
|
|
87800
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(MarkdownBody, {
|
|
87801
|
+
value,
|
|
87802
|
+
remoteHost,
|
|
87803
|
+
remoteCwd
|
|
87804
|
+
})
|
|
87805
|
+
})
|
|
87806
|
+
}), collapsible && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
|
|
87807
|
+
className: "collapsible-user-msg-footer",
|
|
87808
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("button", {
|
|
87809
|
+
type: "button",
|
|
87810
|
+
className: "collapsible-user-msg-toggle",
|
|
87811
|
+
"aria-expanded": expanded,
|
|
87812
|
+
onClick: handleToggle,
|
|
87813
|
+
children: expanded ? /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(ChevronUp, { size: 13 }), tr("收起", "Collapse")] }) : /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(ChevronDown, { size: 13 }), tr(`展开全部 · ${metaLabel}`, `Expand · ${metaLabel}`)] })
|
|
87814
|
+
})
|
|
87815
|
+
})]
|
|
87816
|
+
});
|
|
87817
|
+
}
|
|
87818
|
+
//#endregion
|
|
87819
|
+
//#region components/message-copy-button.tsx
|
|
87820
|
+
async function copyTextToClipboard(text) {
|
|
87821
|
+
if (typeof navigator !== "undefined" && navigator.clipboard?.writeText) try {
|
|
87822
|
+
await navigator.clipboard.writeText(text);
|
|
87823
|
+
return true;
|
|
87824
|
+
} catch {}
|
|
87825
|
+
if (typeof document === "undefined") return false;
|
|
87826
|
+
try {
|
|
87827
|
+
const textarea = document.createElement("textarea");
|
|
87828
|
+
textarea.value = text;
|
|
87829
|
+
textarea.setAttribute("readonly", "");
|
|
87830
|
+
textarea.style.position = "fixed";
|
|
87831
|
+
textarea.style.top = "-9999px";
|
|
87832
|
+
textarea.style.left = "-9999px";
|
|
87833
|
+
document.body.appendChild(textarea);
|
|
87834
|
+
textarea.select();
|
|
87835
|
+
const ok = document.execCommand("copy");
|
|
87836
|
+
document.body.removeChild(textarea);
|
|
87837
|
+
return ok;
|
|
87838
|
+
} catch {
|
|
87839
|
+
return false;
|
|
87840
|
+
}
|
|
87841
|
+
}
|
|
87842
|
+
function MessageCopyButton({ text, title, align = "start" }) {
|
|
87843
|
+
const { tr } = useLocale();
|
|
87844
|
+
const [copied, setCopied] = (0, import_react.useState)(false);
|
|
87845
|
+
const [copyError, setCopyError] = (0, import_react.useState)(false);
|
|
87846
|
+
const timerRef = (0, import_react.useRef)(null);
|
|
87847
|
+
(0, import_react.useEffect)(() => {
|
|
87848
|
+
return () => {
|
|
87849
|
+
if (timerRef.current) clearTimeout(timerRef.current);
|
|
87850
|
+
};
|
|
87851
|
+
}, []);
|
|
87852
|
+
if (!text) return null;
|
|
87853
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
|
|
87854
|
+
className: `message-copy-actions${align === "end" ? " is-end" : ""}`,
|
|
87855
|
+
children: [/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("button", {
|
|
87856
|
+
type: "button",
|
|
87857
|
+
className: `message-copy-btn${copied ? " is-copied" : ""}`,
|
|
87858
|
+
"aria-label": tr("复制消息", "Copy message"),
|
|
87859
|
+
title: title || tr("复制消息", "Copy message"),
|
|
87860
|
+
onClick: async () => {
|
|
87861
|
+
if (await copyTextToClipboard(text)) {
|
|
87862
|
+
setCopied(true);
|
|
87863
|
+
setCopyError(false);
|
|
87864
|
+
if (timerRef.current) clearTimeout(timerRef.current);
|
|
87865
|
+
timerRef.current = setTimeout(() => setCopied(false), 1800);
|
|
87866
|
+
} else setCopyError(true);
|
|
87867
|
+
},
|
|
87868
|
+
children: [copied ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Check, { size: 14 }) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Copy, { size: 14 }), copied && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { children: tr("已复制", "Copied") })]
|
|
87869
|
+
}), copyError && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("small", {
|
|
87870
|
+
className: "message-copy-error",
|
|
87871
|
+
role: "status",
|
|
87872
|
+
children: tr("复制失败,请选中文本复制", "Copy failed; select text manually")
|
|
87873
|
+
})]
|
|
87874
|
+
});
|
|
87875
|
+
}
|
|
87724
87876
|
//#endregion
|
|
87725
87877
|
//#region lib/execution-host.js
|
|
87726
87878
|
var LOCAL_HOST = "@local";
|
|
@@ -87936,16 +88088,6 @@ var SlidersHorizontal = createLucideIcon("sliders-horizontal", [
|
|
|
87936
88088
|
key: "a7s4jb"
|
|
87937
88089
|
}]
|
|
87938
88090
|
]);
|
|
87939
|
-
/**
|
|
87940
|
-
* @license lucide-react v1.25.0 - ISC
|
|
87941
|
-
*
|
|
87942
|
-
* This source code is licensed under the ISC license.
|
|
87943
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
87944
|
-
*/
|
|
87945
|
-
var ChevronDown = createLucideIcon("chevron-down", [["path", {
|
|
87946
|
-
d: "m6 9 6 6 6-6",
|
|
87947
|
-
key: "qrunsl"
|
|
87948
|
-
}]]);
|
|
87949
88091
|
//#endregion
|
|
87950
88092
|
//#region lib/model-effort.js
|
|
87951
88093
|
var EFFORT_LABELS = {
|
|
@@ -88963,7 +89105,14 @@ function ManagerChat({ state, busy, mutate, onSettings, onDraft, hosts }) {
|
|
|
88963
89105
|
children: message.role === "user" ? "你" : "SCOPE"
|
|
88964
89106
|
}),
|
|
88965
89107
|
message.role === "assistant" && !!state.tasks.find((t) => t.id === message.taskId)?.result?.activity?.length && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ActivityDisclosure, { events: state.tasks.find((t) => t.id === message.taskId).result.activity }),
|
|
88966
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
89108
|
+
message.role === "user" ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(CollapsibleUserMessage, {
|
|
89109
|
+
value: message.text,
|
|
89110
|
+
surface: "panel-2"
|
|
89111
|
+
}) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(MarkdownBody, { value: message.text }),
|
|
89112
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(MessageCopyButton, {
|
|
89113
|
+
text: message.text,
|
|
89114
|
+
align: "start"
|
|
89115
|
+
}),
|
|
88967
89116
|
message.role === "assistant" && onDraft && managerPlans(message.text).map((plan, index) => /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("button", {
|
|
88968
89117
|
className: "manager-plan",
|
|
88969
89118
|
onClick: () => onDraft(plan),
|
|
@@ -90264,10 +90413,201 @@ var User = createLucideIcon("user", [["path", {
|
|
|
90264
90413
|
r: "4",
|
|
90265
90414
|
key: "17ys0d"
|
|
90266
90415
|
}]]);
|
|
90416
|
+
/**
|
|
90417
|
+
* @license lucide-react v1.25.0 - ISC
|
|
90418
|
+
*
|
|
90419
|
+
* This source code is licensed under the ISC license.
|
|
90420
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
90421
|
+
*/
|
|
90422
|
+
var RotateCcw = createLucideIcon("rotate-ccw", [["path", {
|
|
90423
|
+
d: "M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",
|
|
90424
|
+
key: "1357e3"
|
|
90425
|
+
}], ["path", {
|
|
90426
|
+
d: "M3 3v5h5",
|
|
90427
|
+
key: "1xhq8a"
|
|
90428
|
+
}]]);
|
|
90429
|
+
//#endregion
|
|
90430
|
+
//#region lib/subagent-display-prefs.ts
|
|
90431
|
+
var DEFAULT_SUBAGENT_DISPLAY_PREFS = {
|
|
90432
|
+
showInlineCards: true,
|
|
90433
|
+
showInteractions: true,
|
|
90434
|
+
showHeaderBadge: true,
|
|
90435
|
+
autoExpandInteractions: false
|
|
90436
|
+
};
|
|
90437
|
+
var STORAGE_KEY = "scope:subagent-display";
|
|
90438
|
+
var PREFS_EVENT = "scope:subagent-display-change";
|
|
90439
|
+
var cachedRaw = null;
|
|
90440
|
+
var cachedSnapshot = DEFAULT_SUBAGENT_DISPLAY_PREFS;
|
|
90441
|
+
function normalizeSubagentDisplayPrefs(raw) {
|
|
90442
|
+
if (!raw || typeof raw !== "object") return DEFAULT_SUBAGENT_DISPLAY_PREFS;
|
|
90443
|
+
const obj = raw;
|
|
90444
|
+
return {
|
|
90445
|
+
showInlineCards: typeof obj.showInlineCards === "boolean" ? obj.showInlineCards : DEFAULT_SUBAGENT_DISPLAY_PREFS.showInlineCards,
|
|
90446
|
+
showInteractions: typeof obj.showInteractions === "boolean" ? obj.showInteractions : DEFAULT_SUBAGENT_DISPLAY_PREFS.showInteractions,
|
|
90447
|
+
showHeaderBadge: typeof obj.showHeaderBadge === "boolean" ? obj.showHeaderBadge : DEFAULT_SUBAGENT_DISPLAY_PREFS.showHeaderBadge,
|
|
90448
|
+
autoExpandInteractions: typeof obj.autoExpandInteractions === "boolean" ? obj.autoExpandInteractions : DEFAULT_SUBAGENT_DISPLAY_PREFS.autoExpandInteractions
|
|
90449
|
+
};
|
|
90450
|
+
}
|
|
90451
|
+
function readPrefs() {
|
|
90452
|
+
try {
|
|
90453
|
+
const saved = window.localStorage.getItem(STORAGE_KEY);
|
|
90454
|
+
if (saved === cachedRaw) return cachedSnapshot;
|
|
90455
|
+
cachedRaw = saved;
|
|
90456
|
+
cachedSnapshot = saved ? normalizeSubagentDisplayPrefs(JSON.parse(saved)) : DEFAULT_SUBAGENT_DISPLAY_PREFS;
|
|
90457
|
+
return cachedSnapshot;
|
|
90458
|
+
} catch {
|
|
90459
|
+
return DEFAULT_SUBAGENT_DISPLAY_PREFS;
|
|
90460
|
+
}
|
|
90461
|
+
}
|
|
90462
|
+
function subscribePrefs(notify) {
|
|
90463
|
+
window.addEventListener("storage", notify);
|
|
90464
|
+
window.addEventListener(PREFS_EVENT, notify);
|
|
90465
|
+
return () => {
|
|
90466
|
+
window.removeEventListener("storage", notify);
|
|
90467
|
+
window.removeEventListener(PREFS_EVENT, notify);
|
|
90468
|
+
};
|
|
90469
|
+
}
|
|
90470
|
+
function setSubagentDisplayPrefs(patch) {
|
|
90471
|
+
const next = {
|
|
90472
|
+
...readPrefs(),
|
|
90473
|
+
...patch
|
|
90474
|
+
};
|
|
90475
|
+
const serialized = JSON.stringify(next);
|
|
90476
|
+
cachedRaw = serialized;
|
|
90477
|
+
cachedSnapshot = next;
|
|
90478
|
+
try {
|
|
90479
|
+
window.localStorage.setItem(STORAGE_KEY, serialized);
|
|
90480
|
+
} catch {}
|
|
90481
|
+
if (typeof window !== "undefined") window.dispatchEvent(new Event(PREFS_EVENT));
|
|
90482
|
+
return next;
|
|
90483
|
+
}
|
|
90484
|
+
function resetSubagentDisplayPrefs() {
|
|
90485
|
+
cachedRaw = null;
|
|
90486
|
+
cachedSnapshot = DEFAULT_SUBAGENT_DISPLAY_PREFS;
|
|
90487
|
+
try {
|
|
90488
|
+
window.localStorage.removeItem(STORAGE_KEY);
|
|
90489
|
+
} catch {}
|
|
90490
|
+
if (typeof window !== "undefined") window.dispatchEvent(new Event(PREFS_EVENT));
|
|
90491
|
+
return DEFAULT_SUBAGENT_DISPLAY_PREFS;
|
|
90492
|
+
}
|
|
90493
|
+
function isDefaultSubagentDisplayPrefs(prefs) {
|
|
90494
|
+
return prefs.showInlineCards === DEFAULT_SUBAGENT_DISPLAY_PREFS.showInlineCards && prefs.showInteractions === DEFAULT_SUBAGENT_DISPLAY_PREFS.showInteractions && prefs.showHeaderBadge === DEFAULT_SUBAGENT_DISPLAY_PREFS.showHeaderBadge && prefs.autoExpandInteractions === DEFAULT_SUBAGENT_DISPLAY_PREFS.autoExpandInteractions;
|
|
90495
|
+
}
|
|
90496
|
+
function useSubagentDisplayPrefs() {
|
|
90497
|
+
return {
|
|
90498
|
+
prefs: (0, import_react.useSyncExternalStore)(subscribePrefs, readPrefs, () => DEFAULT_SUBAGENT_DISPLAY_PREFS),
|
|
90499
|
+
updatePrefs: setSubagentDisplayPrefs,
|
|
90500
|
+
resetPrefs: resetSubagentDisplayPrefs
|
|
90501
|
+
};
|
|
90502
|
+
}
|
|
90503
|
+
//#endregion
|
|
90504
|
+
//#region components/subagent-display-toggles.tsx
|
|
90505
|
+
function SubagentDisplayToggles({ variant }) {
|
|
90506
|
+
const { tr } = useLocale();
|
|
90507
|
+
const { prefs, updatePrefs, resetPrefs } = useSubagentDisplayPrefs();
|
|
90508
|
+
const isDefault = isDefaultSubagentDisplayPrefs(prefs);
|
|
90509
|
+
const items = [
|
|
90510
|
+
{
|
|
90511
|
+
key: "showInlineCards",
|
|
90512
|
+
drawerTitle: tr("任务派发卡片", "Inline spawn cards"),
|
|
90513
|
+
drawerDesc: tr("对话中展示新建子代理与指令", "Show spawned agents per turn"),
|
|
90514
|
+
settingsTitle: tr("对话流任务派发卡片", "Inline subagent spawn cards"),
|
|
90515
|
+
settingsDesc: tr("在对话中显示「当前任务新建了 N 个子代理」卡片与底部汇总", "Show per-turn 'Spawned N subagents' cards and summary bar in the feed")
|
|
90516
|
+
},
|
|
90517
|
+
{
|
|
90518
|
+
key: "showInteractions",
|
|
90519
|
+
drawerTitle: tr("主/子会话互动", "Parent ↔ subagent feed"),
|
|
90520
|
+
drawerDesc: tr("回传报告、跨会话消息与通知", "Handbacks, messages & notices"),
|
|
90521
|
+
settingsTitle: tr("主/子会话双向互动消息", "Parent ↔ subagent interaction messages"),
|
|
90522
|
+
settingsDesc: tr("在对话流中显示子代理回传报告、跨会话 SendMessage 与后台任务通知", "Show subagent handback reports, SendMessage exchanges, and background notifications")
|
|
90523
|
+
},
|
|
90524
|
+
{
|
|
90525
|
+
key: "autoExpandInteractions",
|
|
90526
|
+
drawerTitle: tr("默认展开回传正文", "Auto-expand handbacks"),
|
|
90527
|
+
drawerDesc: tr("免点击直接展示回传详情", "Open handback reports by default"),
|
|
90528
|
+
settingsTitle: tr("默认展开回传与协作消息正文", "Auto-expand handback & interaction bodies"),
|
|
90529
|
+
settingsDesc: tr("开启后无需逐条点击展开,直接显示主/子会话回传和协作详情", "Expand subagent handbacks and collaboration message bodies automatically"),
|
|
90530
|
+
disabled: !prefs.showInteractions
|
|
90531
|
+
},
|
|
90532
|
+
{
|
|
90533
|
+
key: "showHeaderBadge",
|
|
90534
|
+
drawerTitle: tr("顶栏「子代理」入口", "Header shortcut badge"),
|
|
90535
|
+
drawerDesc: tr("会话顶部显示「子代理 · N」按钮", "Show 'Subagents · N' in header"),
|
|
90536
|
+
settingsTitle: tr("会话顶栏「子代理 · N」快捷入口", "Header 'Subagents · N' shortcut button"),
|
|
90537
|
+
settingsDesc: tr("在会话顶部显示子代理数量与快速打开入口(关闭后仍可在此重新开启)", "Show the subagent count and quick-open button in the conversation header")
|
|
90538
|
+
}
|
|
90539
|
+
];
|
|
90540
|
+
const renderToggle = (item) => {
|
|
90541
|
+
const checked = Boolean(prefs[item.key]);
|
|
90542
|
+
const disabled = Boolean(item.disabled);
|
|
90543
|
+
const title = variant === "drawer" ? item.drawerTitle : item.settingsTitle;
|
|
90544
|
+
const desc = variant === "drawer" ? item.drawerDesc : item.settingsDesc;
|
|
90545
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("button", {
|
|
90546
|
+
type: "button",
|
|
90547
|
+
role: "switch",
|
|
90548
|
+
"aria-checked": checked,
|
|
90549
|
+
disabled,
|
|
90550
|
+
"data-pref-key": item.key,
|
|
90551
|
+
className: `${variant === "drawer" ? "subagent-pref-card" : "subagent-pref-row"}${disabled ? " is-disabled" : ""}`,
|
|
90552
|
+
onClick: () => {
|
|
90553
|
+
if (disabled) return;
|
|
90554
|
+
updatePrefs({ [item.key]: !checked });
|
|
90555
|
+
},
|
|
90556
|
+
children: [/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("span", {
|
|
90557
|
+
className: "subagent-pref-copy",
|
|
90558
|
+
children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", {
|
|
90559
|
+
className: "subagent-pref-title",
|
|
90560
|
+
children: title
|
|
90561
|
+
}), /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", {
|
|
90562
|
+
className: "subagent-pref-desc",
|
|
90563
|
+
children: desc
|
|
90564
|
+
})]
|
|
90565
|
+
}), /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", {
|
|
90566
|
+
className: `scope-switch${checked ? " is-checked" : ""}`,
|
|
90567
|
+
"aria-hidden": "true",
|
|
90568
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "scope-switch-thumb" })
|
|
90569
|
+
})]
|
|
90570
|
+
}, item.key);
|
|
90571
|
+
};
|
|
90572
|
+
if (variant === "settings") return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
|
|
90573
|
+
className: "subagent-prefs-list",
|
|
90574
|
+
role: "group",
|
|
90575
|
+
"aria-label": tr("子代理显示设置", "Subagent display settings"),
|
|
90576
|
+
children: items.map(renderToggle)
|
|
90577
|
+
});
|
|
90578
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
|
|
90579
|
+
className: "subagent-prefs-panel",
|
|
90580
|
+
role: "group",
|
|
90581
|
+
"aria-label": tr("对话流子代理显示开关", "Conversation subagent display toggles"),
|
|
90582
|
+
children: [/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
|
|
90583
|
+
className: "subagent-prefs-head",
|
|
90584
|
+
children: [/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
|
|
90585
|
+
className: "subagent-prefs-head-copy",
|
|
90586
|
+
children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", {
|
|
90587
|
+
className: "subagent-prefs-head-title",
|
|
90588
|
+
children: tr("对话流显示开关", "Conversation display")
|
|
90589
|
+
}), /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", {
|
|
90590
|
+
className: "subagent-prefs-head-hint",
|
|
90591
|
+
children: tr("即时生效", "Applies instantly")
|
|
90592
|
+
})]
|
|
90593
|
+
}), !isDefault && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("button", {
|
|
90594
|
+
type: "button",
|
|
90595
|
+
className: "subagent-prefs-reset",
|
|
90596
|
+
onClick: () => resetPrefs(),
|
|
90597
|
+
children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(RotateCcw, { size: 11 }), tr("恢复默认", "Reset")]
|
|
90598
|
+
})]
|
|
90599
|
+
}), /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
|
|
90600
|
+
className: "subagent-prefs-grid",
|
|
90601
|
+
children: items.map(renderToggle)
|
|
90602
|
+
})]
|
|
90603
|
+
});
|
|
90604
|
+
}
|
|
90267
90605
|
//#endregion
|
|
90268
90606
|
//#region features/settings/GeneralSettingsTab.tsx
|
|
90269
90607
|
function GeneralSettingsTab({ draft, update, state, hosts, operatorName, onSaveOperatorName }) {
|
|
90270
90608
|
const { tr } = useLocale();
|
|
90609
|
+
const { prefs: subagentPrefs, resetPrefs: resetSubagentPrefs } = useSubagentDisplayPrefs();
|
|
90610
|
+
const isDefaultSubagentPrefs = isDefaultSubagentDisplayPrefs(subagentPrefs);
|
|
90271
90611
|
const [nameEdit, setNameEdit] = (0, import_react.useState)(null);
|
|
90272
90612
|
const nameDraft = nameEdit?.base === operatorName ? nameEdit.value : operatorName;
|
|
90273
90613
|
const setNameDraft = (value) => setNameEdit({
|
|
@@ -90676,6 +91016,18 @@ function GeneralSettingsTab({ draft, update, state, hosts, operatorName, onSaveO
|
|
|
90676
91016
|
}), tr("暂停派发新的队列任务", "Pause new queued task dispatches")]
|
|
90677
91017
|
})
|
|
90678
91018
|
]
|
|
91019
|
+
}),
|
|
91020
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
|
|
91021
|
+
className: "settings-card",
|
|
91022
|
+
children: [/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
|
|
91023
|
+
className: "settings-card-head",
|
|
91024
|
+
children: [/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { children: [/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("h2", { children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Bot, { size: 16 }), tr("子代理显示设置", "Subagent Display")] }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { children: tr("控制 Claude Code 与 Codex 会话中子代理派发卡片、主/子会话互动消息和顶栏入口的显示方式(即时生效,保存在当前浏览器本地)。", "Control how subagent spawn cards, parent ↔ subagent interaction messages, and header shortcuts appear in Claude Code & Codex conversations (applies immediately in this browser).") })] }), !isDefaultSubagentPrefs && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("button", {
|
|
91025
|
+
type: "button",
|
|
91026
|
+
className: "center-secondary",
|
|
91027
|
+
onClick: () => resetSubagentPrefs(),
|
|
91028
|
+
children: tr("恢复默认", "Reset defaults")
|
|
91029
|
+
})]
|
|
91030
|
+
}), /* @__PURE__ */ (0, import_jsx_runtime.jsx)(SubagentDisplayToggles, { variant: "settings" })]
|
|
90679
91031
|
})
|
|
90680
91032
|
]
|
|
90681
91033
|
});
|
|
@@ -93499,19 +93851,6 @@ function filterProjects(projects, filters, query = "") {
|
|
|
93499
93851
|
}] : [];
|
|
93500
93852
|
}).sort((a, b) => Number(b.pinned) - Number(a.pinned) || compare(a.sessions[0] || {}, b.sessions[0] || {}) || a.key.localeCompare(b.key));
|
|
93501
93853
|
}
|
|
93502
|
-
/**
|
|
93503
|
-
* @license lucide-react v1.25.0 - ISC
|
|
93504
|
-
*
|
|
93505
|
-
* This source code is licensed under the ISC license.
|
|
93506
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
93507
|
-
*/
|
|
93508
|
-
var RotateCcw = createLucideIcon("rotate-ccw", [["path", {
|
|
93509
|
-
d: "M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",
|
|
93510
|
-
key: "1357e3"
|
|
93511
|
-
}], ["path", {
|
|
93512
|
-
d: "M3 3v5h5",
|
|
93513
|
-
key: "1xhq8a"
|
|
93514
|
-
}]]);
|
|
93515
93854
|
//#endregion
|
|
93516
93855
|
//#region components/project-filters.tsx
|
|
93517
93856
|
var PROJECT_FILTER_OPTIONS_EN = {
|
|
@@ -93817,7 +94156,7 @@ function ProjectSidebar({ projects, selectedKey, selectedSessionId, busyKey, onS
|
|
|
93817
94156
|
className: "sidebar-archive-action",
|
|
93818
94157
|
"aria-label": `归档会话 ${session.title}`,
|
|
93819
94158
|
title: ["claude", "antigravity"].includes(session.provider || "") ? "归档到 SCOPE,保留原生历史" : "归档会话及其子会话,可在已归档中恢复",
|
|
93820
|
-
disabled: archiveBusy || !session.sessionId || session.status === "working",
|
|
94159
|
+
disabled: archiveBusy || !session.sessionId || session.status === "working" || Boolean(session.externalTerminal),
|
|
93821
94160
|
onClick: () => onArchive(project, session),
|
|
93822
94161
|
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Archive, { size: 14 })
|
|
93823
94162
|
})]
|
|
@@ -94387,7 +94726,8 @@ function useSessionCatalog(workspace) {
|
|
|
94387
94726
|
...item,
|
|
94388
94727
|
historyVersion: native?.historyVersion,
|
|
94389
94728
|
phase: native?.phase || item.phase,
|
|
94390
|
-
activeSubagents
|
|
94729
|
+
activeSubagents,
|
|
94730
|
+
externalLock: native?.externalLock || null
|
|
94391
94731
|
};
|
|
94392
94732
|
}), ...entries.filter((entry) => !ids.has(entry.key) && !managed.some((item) => item.key === entry.key))];
|
|
94393
94733
|
}, [entries, managed]);
|
|
@@ -94448,6 +94788,13 @@ function useSessionCatalog(workspace) {
|
|
|
94448
94788
|
}
|
|
94449
94789
|
const management = workspace.snapshot.management.sessions[`${entry.host}:${entry.sessionId}`];
|
|
94450
94790
|
const activeSubagents = entry.activeSubagents || 0;
|
|
94791
|
+
const externalTerminal = Boolean(entry.externalLock?.locked && ![
|
|
94792
|
+
"running",
|
|
94793
|
+
"launching",
|
|
94794
|
+
"waiting_permission",
|
|
94795
|
+
"stopping",
|
|
94796
|
+
"finishing"
|
|
94797
|
+
].includes(entry.status || ""));
|
|
94451
94798
|
const baseStatus = [
|
|
94452
94799
|
"running",
|
|
94453
94800
|
"launching",
|
|
@@ -94459,13 +94806,20 @@ function useSessionCatalog(workspace) {
|
|
|
94459
94806
|
"needs_permission",
|
|
94460
94807
|
"waiting_permission"
|
|
94461
94808
|
].includes(entry.status || "") ? "attention" : "idle";
|
|
94809
|
+
const externalWorking = externalTerminal && [
|
|
94810
|
+
"running",
|
|
94811
|
+
"working",
|
|
94812
|
+
"shell",
|
|
94813
|
+
"tool"
|
|
94814
|
+
].includes(entry.externalLock?.status || "");
|
|
94462
94815
|
project.sessions.push({
|
|
94463
94816
|
id: entry.key,
|
|
94464
94817
|
sessionId: entry.sessionId || "",
|
|
94465
94818
|
title: entry.title,
|
|
94466
94819
|
category: management?.summary?.category || "other",
|
|
94467
|
-
status: activeSubagents > 0 && baseStatus === "idle" ? "working" : baseStatus,
|
|
94468
|
-
historical: !entry.managed,
|
|
94820
|
+
status: (activeSubagents > 0 || externalWorking) && baseStatus === "idle" ? "working" : baseStatus,
|
|
94821
|
+
historical: !entry.managed && !externalTerminal,
|
|
94822
|
+
externalTerminal,
|
|
94469
94823
|
provider: entry.provider,
|
|
94470
94824
|
catalog: true,
|
|
94471
94825
|
lastActivityAt: activityTime(entry.updatedAt),
|
|
@@ -95422,6 +95776,24 @@ function useConversationLocation(options) {
|
|
|
95422
95776
|
* This source code is licensed under the ISC license.
|
|
95423
95777
|
* See the LICENSE file in the root directory of this source tree.
|
|
95424
95778
|
*/
|
|
95779
|
+
var Lock = createLucideIcon("lock", [["rect", {
|
|
95780
|
+
width: "18",
|
|
95781
|
+
height: "11",
|
|
95782
|
+
x: "3",
|
|
95783
|
+
y: "11",
|
|
95784
|
+
rx: "2",
|
|
95785
|
+
ry: "2",
|
|
95786
|
+
key: "1w4ew1"
|
|
95787
|
+
}], ["path", {
|
|
95788
|
+
d: "M7 11V7a5 5 0 0 1 10 0v4",
|
|
95789
|
+
key: "fwvmzm"
|
|
95790
|
+
}]]);
|
|
95791
|
+
/**
|
|
95792
|
+
* @license lucide-react v1.25.0 - ISC
|
|
95793
|
+
*
|
|
95794
|
+
* This source code is licensed under the ISC license.
|
|
95795
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
95796
|
+
*/
|
|
95425
95797
|
var Square = createLucideIcon("square", [["rect", {
|
|
95426
95798
|
width: "18",
|
|
95427
95799
|
height: "18",
|
|
@@ -95493,7 +95865,7 @@ function visibleSpoolTurns(messages, turns) {
|
|
|
95493
95865
|
//#region features/conversation/use-native-history.ts
|
|
95494
95866
|
function useNativeHistory(entry, sessionId, turnStatus) {
|
|
95495
95867
|
const nativeId = sessionId || entry.sessionId;
|
|
95496
|
-
const key = entry.provider === "antigravity" && nativeId ? JSON.stringify([
|
|
95868
|
+
const key = (entry.provider === "antigravity" || entry.provider === "claude") && nativeId ? JSON.stringify([
|
|
95497
95869
|
entry.host,
|
|
95498
95870
|
entry.provider,
|
|
95499
95871
|
nativeId
|
|
@@ -95557,10 +95929,181 @@ function useNativeHistory(entry, sessionId, turnStatus) {
|
|
|
95557
95929
|
earlier
|
|
95558
95930
|
};
|
|
95559
95931
|
}
|
|
95932
|
+
/**
|
|
95933
|
+
* @license lucide-react v1.25.0 - ISC
|
|
95934
|
+
*
|
|
95935
|
+
* This source code is licensed under the ISC license.
|
|
95936
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
95937
|
+
*/
|
|
95938
|
+
var ArrowDownLeft = createLucideIcon("arrow-down-left", [["path", {
|
|
95939
|
+
d: "M17 7 7 17",
|
|
95940
|
+
key: "15tmo1"
|
|
95941
|
+
}], ["path", {
|
|
95942
|
+
d: "M17 17H7V7",
|
|
95943
|
+
key: "1org7z"
|
|
95944
|
+
}]]);
|
|
95945
|
+
/**
|
|
95946
|
+
* @license lucide-react v1.25.0 - ISC
|
|
95947
|
+
*
|
|
95948
|
+
* This source code is licensed under the ISC license.
|
|
95949
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
95950
|
+
*/
|
|
95951
|
+
var Bell = createLucideIcon("bell", [["path", {
|
|
95952
|
+
d: "M10.268 21a2 2 0 0 0 3.464 0",
|
|
95953
|
+
key: "vwvbt9"
|
|
95954
|
+
}], ["path", {
|
|
95955
|
+
d: "M3.262 15.326A1 1 0 0 0 4 17h16a1 1 0 0 0 .74-1.673C19.41 13.956 18 12.499 18 8A6 6 0 0 0 6 8c0 4.499-1.411 5.956-2.738 7.326",
|
|
95956
|
+
key: "11g9vi"
|
|
95957
|
+
}]]);
|
|
95560
95958
|
//#endregion
|
|
95561
95959
|
//#region features/conversation/NativeHistoryView.tsx
|
|
95562
|
-
function
|
|
95960
|
+
function InlineTaskSubagentGroup({ subagents, canInspect, onInspect }) {
|
|
95961
|
+
const { tr } = useLocale();
|
|
95962
|
+
const [expanded, setExpanded] = (0, import_react.useState)(false);
|
|
95963
|
+
if (!subagents.length) return null;
|
|
95964
|
+
const workingCount = subagents.filter((s) => s.status === "working").length;
|
|
95965
|
+
const doneCount = subagents.length - workingCount;
|
|
95966
|
+
const visible = expanded ? subagents : subagents.slice(0, 5);
|
|
95967
|
+
const hiddenCount = subagents.length - visible.length;
|
|
95968
|
+
const statusLabels = {
|
|
95969
|
+
working: tr("工作中", "Working"),
|
|
95970
|
+
completed: tr("已完成", "Done"),
|
|
95971
|
+
failed: tr("失败", "Failed"),
|
|
95972
|
+
stopped: tr("已停止", "Stopped")
|
|
95973
|
+
};
|
|
95974
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
|
|
95975
|
+
className: `native-task-subagents${workingCount > 0 ? " is-working" : ""}`,
|
|
95976
|
+
children: [
|
|
95977
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
|
|
95978
|
+
className: "native-task-subagents-head",
|
|
95979
|
+
children: [/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("span", {
|
|
95980
|
+
className: "native-task-subagents-title",
|
|
95981
|
+
children: [workingCount > 0 ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(LoaderCircle, {
|
|
95982
|
+
size: 13,
|
|
95983
|
+
className: "is-spinning"
|
|
95984
|
+
}) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Bot, { size: 13 }), tr(`当前任务新建了 ${subagents.length} 个子代理`, `Spawned ${subagents.length} subagent${subagents.length > 1 ? "s" : ""} for this task`)]
|
|
95985
|
+
}), /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", {
|
|
95986
|
+
className: "native-task-subagents-count",
|
|
95987
|
+
children: workingCount > 0 ? tr(`${workingCount} 工作中 · ${doneCount} 已完成`, `${workingCount} active · ${doneCount} done`) : tr(`${doneCount} 已完成`, `${doneCount} completed`)
|
|
95988
|
+
})]
|
|
95989
|
+
}),
|
|
95990
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
|
|
95991
|
+
className: "native-task-subagents-list",
|
|
95992
|
+
children: visible.map((item) => {
|
|
95993
|
+
const inner = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
|
|
95994
|
+
className: "native-subagent-stack",
|
|
95995
|
+
children: [/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
|
|
95996
|
+
className: "native-subagent-meta",
|
|
95997
|
+
children: [
|
|
95998
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("span", {
|
|
95999
|
+
className: `native-subagent-badge is-${item.status || "completed"}`,
|
|
96000
|
+
children: [item.status === "working" ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(LoaderCircle, {
|
|
96001
|
+
size: 11,
|
|
96002
|
+
className: "is-spinning"
|
|
96003
|
+
}) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Bot, { size: 11 }), statusLabels[item.status] || item.status]
|
|
96004
|
+
}),
|
|
96005
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("strong", {
|
|
96006
|
+
title: item.role,
|
|
96007
|
+
children: item.role
|
|
96008
|
+
}),
|
|
96009
|
+
item.typeName && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("small", { children: item.typeName }),
|
|
96010
|
+
item.model && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("small", { children: item.model })
|
|
96011
|
+
]
|
|
96012
|
+
}), item.promptPreview && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("span", {
|
|
96013
|
+
className: "native-subagent-prompt",
|
|
96014
|
+
title: item.promptPreview,
|
|
96015
|
+
children: [tr("派发指令:", "Prompt: "), item.promptPreview.split(/\r?\n/)[0]]
|
|
96016
|
+
})]
|
|
96017
|
+
}), /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("span", {
|
|
96018
|
+
className: "native-subagent-right",
|
|
96019
|
+
children: [item.lastAction && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", {
|
|
96020
|
+
className: "native-subagent-action",
|
|
96021
|
+
title: item.lastAction,
|
|
96022
|
+
children: item.lastAction
|
|
96023
|
+
}), canInspect && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ChevronRight, { size: 13 })]
|
|
96024
|
+
})] });
|
|
96025
|
+
return canInspect && onInspect ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)("button", {
|
|
96026
|
+
type: "button",
|
|
96027
|
+
className: "native-subagent-row",
|
|
96028
|
+
onClick: () => onInspect(item),
|
|
96029
|
+
title: tr("点击查看该子代理完整工作流", "Inspect subagent workflow"),
|
|
96030
|
+
children: inner
|
|
96031
|
+
}, item.toolUseId || item.id) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
|
|
96032
|
+
className: "native-subagent-row",
|
|
96033
|
+
children: inner
|
|
96034
|
+
}, item.toolUseId || item.id);
|
|
96035
|
+
})
|
|
96036
|
+
}),
|
|
96037
|
+
hiddenCount > 0 && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("button", {
|
|
96038
|
+
type: "button",
|
|
96039
|
+
className: "native-task-subagents-more",
|
|
96040
|
+
onClick: () => setExpanded(true),
|
|
96041
|
+
children: tr(`展开其余 ${hiddenCount} 个子代理`, `Show ${hiddenCount} more subagents`)
|
|
96042
|
+
})
|
|
96043
|
+
]
|
|
96044
|
+
});
|
|
96045
|
+
}
|
|
96046
|
+
function AgentInteractionCard({ message, host, cwd, canInspect, defaultOpen = false, onInspectSubagent }) {
|
|
96047
|
+
const { tr } = useLocale();
|
|
96048
|
+
const isOutbound = message.direction === "outbound";
|
|
96049
|
+
const isNotif = message.interactionKind === "notification";
|
|
96050
|
+
const isHandback = message.interactionKind === "handback";
|
|
96051
|
+
const variant = isNotif ? "is-notification" : isOutbound ? "is-outbound" : "is-inbound";
|
|
96052
|
+
const badgeLabel = isNotif ? tr("后台任务通知", "Background task") : isOutbound ? tr("主会话 → 协作消息", "Main → Agent") : isHandback ? tr("子代理回传 → 主会话", "Subagent → Main") : tr("收到协作消息", "Agent → Main");
|
|
96053
|
+
const peerLabel = message.peerName || message.peerId || "";
|
|
96054
|
+
const preview = message.summary || (message.text || "").split(/\r?\n/).find((ln) => ln.trim()) || "";
|
|
96055
|
+
const canJump = Boolean(message.subagentId && canInspect && onInspectSubagent);
|
|
96056
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("details", {
|
|
96057
|
+
className: `agent-interaction-card ${variant}`,
|
|
96058
|
+
open: defaultOpen,
|
|
96059
|
+
children: [/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("summary", { children: [/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("span", {
|
|
96060
|
+
className: "agent-interaction-left",
|
|
96061
|
+
children: [
|
|
96062
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("span", {
|
|
96063
|
+
className: "agent-interaction-badge",
|
|
96064
|
+
children: [isNotif ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Bell, { size: 11 }) : isOutbound ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ArrowUpRight, { size: 11 }) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ArrowDownLeft, { size: 11 }), badgeLabel]
|
|
96065
|
+
}),
|
|
96066
|
+
peerLabel && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", {
|
|
96067
|
+
className: "agent-interaction-peer",
|
|
96068
|
+
title: peerLabel,
|
|
96069
|
+
children: peerLabel
|
|
96070
|
+
}),
|
|
96071
|
+
preview && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", {
|
|
96072
|
+
className: "agent-interaction-preview",
|
|
96073
|
+
title: preview,
|
|
96074
|
+
children: preview
|
|
96075
|
+
})
|
|
96076
|
+
]
|
|
96077
|
+
}), /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("span", {
|
|
96078
|
+
className: "agent-interaction-right",
|
|
96079
|
+
children: [canJump && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("button", {
|
|
96080
|
+
type: "button",
|
|
96081
|
+
className: "agent-interaction-jump",
|
|
96082
|
+
onClick: (event) => {
|
|
96083
|
+
event.preventDefault();
|
|
96084
|
+
event.stopPropagation();
|
|
96085
|
+
onInspectSubagent?.({
|
|
96086
|
+
id: message.subagentId,
|
|
96087
|
+
agentId: message.subagentId,
|
|
96088
|
+
role: peerLabel || message.subagentId,
|
|
96089
|
+
status: message.status || "completed"
|
|
96090
|
+
});
|
|
96091
|
+
},
|
|
96092
|
+
children: [tr("查看工作流", "Workflow"), /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ChevronRight, { size: 11 })]
|
|
96093
|
+
}), /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ChevronRight, { size: 13 })]
|
|
96094
|
+
})] }), message.text && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
|
|
96095
|
+
className: "agent-interaction-body",
|
|
96096
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(MarkdownBody, {
|
|
96097
|
+
value: message.text,
|
|
96098
|
+
remoteHost: host,
|
|
96099
|
+
remoteCwd: cwd
|
|
96100
|
+
})
|
|
96101
|
+
})]
|
|
96102
|
+
});
|
|
96103
|
+
}
|
|
96104
|
+
function NativeHistoryView({ value, host, cwd, canInspectSubagent = false, onInspectSubagent }) {
|
|
95563
96105
|
const { history, busy, error, earlier, refresh } = value;
|
|
96106
|
+
const { prefs } = useSubagentDisplayPrefs();
|
|
95564
96107
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
|
|
95565
96108
|
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
|
|
95566
96109
|
className: "native-history-actions",
|
|
@@ -95597,16 +96140,38 @@ function NativeHistoryView({ value, host, cwd }) {
|
|
|
95597
96140
|
className: "native-note",
|
|
95598
96141
|
children: "部分记录过长、已被上游截断或尚未写完,当前显示可读取的内容。"
|
|
95599
96142
|
}),
|
|
95600
|
-
history?.messages.map((message, index) => /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { children: [message.role === "
|
|
96143
|
+
history?.messages.map((message, index) => /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { children: [message.role === "subagent_group" && message.subagents?.length ? prefs.showInlineCards ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(InlineTaskSubagentGroup, {
|
|
96144
|
+
subagents: message.subagents,
|
|
96145
|
+
canInspect: canInspectSubagent,
|
|
96146
|
+
onInspect: onInspectSubagent
|
|
96147
|
+
}) : null : message.role === "agent_interaction" ? prefs.showInteractions ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(AgentInteractionCard, {
|
|
96148
|
+
message,
|
|
96149
|
+
host,
|
|
96150
|
+
cwd,
|
|
96151
|
+
canInspect: canInspectSubagent,
|
|
96152
|
+
defaultOpen: prefs.autoExpandInteractions,
|
|
96153
|
+
onInspectSubagent
|
|
96154
|
+
}, `${message.id || index}:${prefs.autoExpandInteractions ? "1" : "0"}`) : null : message.role === "activity" ? /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("details", {
|
|
95601
96155
|
className: "native-history-activity",
|
|
95602
96156
|
children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)("summary", { children: message.title || "工具记录" }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)("pre", { children: message.text })]
|
|
95603
|
-
}) : message.text && /* @__PURE__ */ (0, import_jsx_runtime.
|
|
95604
|
-
className: `native-message ${message.role}`,
|
|
95605
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
95606
|
-
|
|
95607
|
-
|
|
95608
|
-
|
|
95609
|
-
|
|
96157
|
+
}) : message.text && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
|
|
96158
|
+
className: `native-message-block ${message.role === "user" ? "is-user" : "is-assistant"}`,
|
|
96159
|
+
children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
|
|
96160
|
+
className: `native-message ${message.role}`,
|
|
96161
|
+
children: message.role === "user" ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(CollapsibleUserMessage, {
|
|
96162
|
+
value: message.text,
|
|
96163
|
+
remoteHost: host,
|
|
96164
|
+
remoteCwd: cwd,
|
|
96165
|
+
surface: "hover"
|
|
96166
|
+
}) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(MarkdownBody, {
|
|
96167
|
+
value: message.text,
|
|
96168
|
+
remoteHost: host,
|
|
96169
|
+
remoteCwd: cwd
|
|
96170
|
+
})
|
|
96171
|
+
}), /* @__PURE__ */ (0, import_jsx_runtime.jsx)(MessageCopyButton, {
|
|
96172
|
+
text: message.text,
|
|
96173
|
+
align: message.role === "user" ? "end" : "start"
|
|
96174
|
+
})]
|
|
95610
96175
|
}), message.activity && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("details", {
|
|
95611
96176
|
className: "native-history-activity",
|
|
95612
96177
|
children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)("summary", { children: message.title || "工具调用" }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)("pre", { children: message.activity })]
|
|
@@ -96036,6 +96601,819 @@ function useSlashCommands({ provider, host, cwd, sessionId, draft, setDraft, onL
|
|
|
96036
96601
|
};
|
|
96037
96602
|
}
|
|
96038
96603
|
//#endregion
|
|
96604
|
+
//#region features/conversation/use-claude-subagent-workflow.ts
|
|
96605
|
+
function useClaudeSubagentWorkflow(catalogKey, provider, subagents, selectedId) {
|
|
96606
|
+
const selected = (0, import_react.useMemo)(() => selectedId ? subagents.find((item) => item.id === selectedId || item.agentId === selectedId || item.toolUseId === selectedId) || null : null, [subagents, selectedId]);
|
|
96607
|
+
const lookupId = selected?.agentId || selected?.id || selectedId || "";
|
|
96608
|
+
const canFetchDisk = Boolean(provider === "claude" && catalogKey && !catalogKey.startsWith("cli:") && lookupId);
|
|
96609
|
+
const targetKey = canFetchDisk ? `${catalogKey}::${lookupId}` : "";
|
|
96610
|
+
const [state, setState] = (0, import_react.useState)({
|
|
96611
|
+
targetKey: "",
|
|
96612
|
+
data: null,
|
|
96613
|
+
loading: false,
|
|
96614
|
+
error: ""
|
|
96615
|
+
});
|
|
96616
|
+
const versionRef = (0, import_react.useRef)({
|
|
96617
|
+
targetKey: "",
|
|
96618
|
+
version: ""
|
|
96619
|
+
});
|
|
96620
|
+
const reqIdRef = (0, import_react.useRef)(0);
|
|
96621
|
+
const fetchWorkflow = (0, import_react.useCallback)(async (force = false, showSpinner = false) => {
|
|
96622
|
+
if (!canFetchDisk || !targetKey) return;
|
|
96623
|
+
const reqId = ++reqIdRef.current;
|
|
96624
|
+
const cachedVersion = !force && versionRef.current.targetKey === targetKey ? versionRef.current.version : "";
|
|
96625
|
+
if (showSpinner) setState((prev) => prev.targetKey === targetKey ? {
|
|
96626
|
+
...prev,
|
|
96627
|
+
loading: true,
|
|
96628
|
+
error: ""
|
|
96629
|
+
} : {
|
|
96630
|
+
targetKey,
|
|
96631
|
+
data: null,
|
|
96632
|
+
loading: true,
|
|
96633
|
+
error: ""
|
|
96634
|
+
});
|
|
96635
|
+
try {
|
|
96636
|
+
const params = new URLSearchParams({
|
|
96637
|
+
key: catalogKey,
|
|
96638
|
+
subagentId: lookupId
|
|
96639
|
+
});
|
|
96640
|
+
if (cachedVersion) params.set("version", cachedVersion);
|
|
96641
|
+
const res = await conversationRequest(`/api/session-catalog/subagent-workflow?${params.toString()}`);
|
|
96642
|
+
if (reqId !== reqIdRef.current) return;
|
|
96643
|
+
if (res.notModified) {
|
|
96644
|
+
setState((prev) => prev.targetKey === targetKey ? {
|
|
96645
|
+
...prev,
|
|
96646
|
+
loading: false,
|
|
96647
|
+
error: ""
|
|
96648
|
+
} : prev);
|
|
96649
|
+
return;
|
|
96650
|
+
}
|
|
96651
|
+
if (res.version) versionRef.current = {
|
|
96652
|
+
targetKey,
|
|
96653
|
+
version: res.version
|
|
96654
|
+
};
|
|
96655
|
+
setState({
|
|
96656
|
+
targetKey,
|
|
96657
|
+
data: res,
|
|
96658
|
+
loading: false,
|
|
96659
|
+
error: ""
|
|
96660
|
+
});
|
|
96661
|
+
} catch (cause) {
|
|
96662
|
+
if (reqId !== reqIdRef.current) return;
|
|
96663
|
+
setState((prev) => ({
|
|
96664
|
+
targetKey,
|
|
96665
|
+
data: prev.targetKey === targetKey ? prev.data : null,
|
|
96666
|
+
loading: false,
|
|
96667
|
+
error: cause.message || "加载子代理工作流失败"
|
|
96668
|
+
}));
|
|
96669
|
+
}
|
|
96670
|
+
}, [
|
|
96671
|
+
canFetchDisk,
|
|
96672
|
+
catalogKey,
|
|
96673
|
+
lookupId,
|
|
96674
|
+
targetKey
|
|
96675
|
+
]);
|
|
96676
|
+
(0, import_react.useEffect)(() => {
|
|
96677
|
+
if (!canFetchDisk || !targetKey) return;
|
|
96678
|
+
fetchWorkflow(true, false);
|
|
96679
|
+
}, [
|
|
96680
|
+
canFetchDisk,
|
|
96681
|
+
targetKey,
|
|
96682
|
+
fetchWorkflow
|
|
96683
|
+
]);
|
|
96684
|
+
const activeData = state.targetKey === targetKey ? state.data : null;
|
|
96685
|
+
const activeStatus = selected?.status === "working" ? "working" : activeData?.status || selected?.status || "completed";
|
|
96686
|
+
(0, import_react.useEffect)(() => {
|
|
96687
|
+
if (!canFetchDisk || !targetKey || activeStatus !== "working") return;
|
|
96688
|
+
const timer = setInterval(() => {
|
|
96689
|
+
if (!document.hidden) fetchWorkflow(false, false);
|
|
96690
|
+
}, 2500);
|
|
96691
|
+
return () => clearInterval(timer);
|
|
96692
|
+
}, [
|
|
96693
|
+
canFetchDisk,
|
|
96694
|
+
targetKey,
|
|
96695
|
+
activeStatus,
|
|
96696
|
+
fetchWorkflow
|
|
96697
|
+
]);
|
|
96698
|
+
const diskSteps = activeData?.found ? activeData.steps || [] : [];
|
|
96699
|
+
const liveSteps = selected?.steps || [];
|
|
96700
|
+
const useDisk = diskSteps.length > 0 && (diskSteps.length >= liveSteps.length || activeStatus !== "working");
|
|
96701
|
+
return {
|
|
96702
|
+
selected,
|
|
96703
|
+
steps: useDisk ? diskSteps : liveSteps,
|
|
96704
|
+
partial: activeStatus === "working" ? selected?.partial || "" : "",
|
|
96705
|
+
loading: state.targetKey === targetKey ? state.loading : canFetchDisk && liveSteps.length === 0,
|
|
96706
|
+
error: state.targetKey === targetKey && liveSteps.length === 0 ? state.error : "",
|
|
96707
|
+
status: activeStatus,
|
|
96708
|
+
model: activeData?.model || selected?.model || "",
|
|
96709
|
+
typeName: activeData?.typeName || selected?.typeName || "",
|
|
96710
|
+
spawnDepth: activeData?.spawnDepth ?? selected?.spawnDepth ?? null,
|
|
96711
|
+
role: activeData?.role || selected?.role || "",
|
|
96712
|
+
totalSteps: useDisk ? activeData?.totalSteps ?? diskSteps.length : liveSteps.length,
|
|
96713
|
+
truncated: useDisk ? Boolean(activeData?.truncated) : false,
|
|
96714
|
+
refresh: () => void fetchWorkflow(true, true)
|
|
96715
|
+
};
|
|
96716
|
+
}
|
|
96717
|
+
/**
|
|
96718
|
+
* @license lucide-react v1.25.0 - ISC
|
|
96719
|
+
*
|
|
96720
|
+
* This source code is licensed under the ISC license.
|
|
96721
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
96722
|
+
*/
|
|
96723
|
+
var ArrowLeft = createLucideIcon("arrow-left", [["path", {
|
|
96724
|
+
d: "m12 19-7-7 7-7",
|
|
96725
|
+
key: "1l729n"
|
|
96726
|
+
}], ["path", {
|
|
96727
|
+
d: "M19 12H5",
|
|
96728
|
+
key: "x3x0zl"
|
|
96729
|
+
}]]);
|
|
96730
|
+
/**
|
|
96731
|
+
* @license lucide-react v1.25.0 - ISC
|
|
96732
|
+
*
|
|
96733
|
+
* This source code is licensed under the ISC license.
|
|
96734
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
96735
|
+
*/
|
|
96736
|
+
var ChevronLeft = createLucideIcon("chevron-left", [["path", {
|
|
96737
|
+
d: "m15 18-6-6 6-6",
|
|
96738
|
+
key: "1wnfg3"
|
|
96739
|
+
}]]);
|
|
96740
|
+
/**
|
|
96741
|
+
* @license lucide-react v1.25.0 - ISC
|
|
96742
|
+
*
|
|
96743
|
+
* This source code is licensed under the ISC license.
|
|
96744
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
96745
|
+
*/
|
|
96746
|
+
var ChevronsDownUp = createLucideIcon("chevrons-down-up", [["path", {
|
|
96747
|
+
d: "m7 20 5-5 5 5",
|
|
96748
|
+
key: "13a0gw"
|
|
96749
|
+
}], ["path", {
|
|
96750
|
+
d: "m7 4 5 5 5-5",
|
|
96751
|
+
key: "1kwcof"
|
|
96752
|
+
}]]);
|
|
96753
|
+
/**
|
|
96754
|
+
* @license lucide-react v1.25.0 - ISC
|
|
96755
|
+
*
|
|
96756
|
+
* This source code is licensed under the ISC license.
|
|
96757
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
96758
|
+
*/
|
|
96759
|
+
var ChevronsUpDown = createLucideIcon("chevrons-up-down", [["path", {
|
|
96760
|
+
d: "m7 15 5 5 5-5",
|
|
96761
|
+
key: "1hf1tw"
|
|
96762
|
+
}], ["path", {
|
|
96763
|
+
d: "m7 9 5-5 5 5",
|
|
96764
|
+
key: "sgt6xg"
|
|
96765
|
+
}]]);
|
|
96766
|
+
//#endregion
|
|
96767
|
+
//#region components/subagent-workflow-drawer.tsx
|
|
96768
|
+
function formatTime(ts) {
|
|
96769
|
+
if (ts == null || ts === "") return "";
|
|
96770
|
+
const date = typeof ts === "number" ? new Date(ts) : new Date(ts);
|
|
96771
|
+
if (Number.isNaN(date.getTime())) return "";
|
|
96772
|
+
return date.toLocaleTimeString([], {
|
|
96773
|
+
hour: "2-digit",
|
|
96774
|
+
minute: "2-digit",
|
|
96775
|
+
second: "2-digit"
|
|
96776
|
+
});
|
|
96777
|
+
}
|
|
96778
|
+
function formatDateTime(ts) {
|
|
96779
|
+
if (ts == null || ts === "") return "";
|
|
96780
|
+
const date = typeof ts === "number" ? new Date(ts) : new Date(ts);
|
|
96781
|
+
if (Number.isNaN(date.getTime())) return "";
|
|
96782
|
+
return date.toLocaleString([], {
|
|
96783
|
+
month: "2-digit",
|
|
96784
|
+
day: "2-digit",
|
|
96785
|
+
hour: "2-digit",
|
|
96786
|
+
minute: "2-digit"
|
|
96787
|
+
});
|
|
96788
|
+
}
|
|
96789
|
+
function formatDuration(ms) {
|
|
96790
|
+
if (typeof ms !== "number" || !Number.isFinite(ms) || ms <= 0) return "";
|
|
96791
|
+
if (ms < 1e3) return `${Math.round(ms)}ms`;
|
|
96792
|
+
return `${(ms / 1e3).toFixed(1)}s`;
|
|
96793
|
+
}
|
|
96794
|
+
function extractHandbackMarkdown(step) {
|
|
96795
|
+
if (step.toolName !== "SubagentHandback" || !step.inputPreview) return null;
|
|
96796
|
+
try {
|
|
96797
|
+
const parsed = JSON.parse(step.inputPreview);
|
|
96798
|
+
for (const key of [
|
|
96799
|
+
"result",
|
|
96800
|
+
"report",
|
|
96801
|
+
"summary",
|
|
96802
|
+
"message",
|
|
96803
|
+
"output"
|
|
96804
|
+
]) {
|
|
96805
|
+
const value = parsed[key];
|
|
96806
|
+
if (typeof value === "string" && value.trim()) return value.trim();
|
|
96807
|
+
}
|
|
96808
|
+
} catch {
|
|
96809
|
+
return null;
|
|
96810
|
+
}
|
|
96811
|
+
return null;
|
|
96812
|
+
}
|
|
96813
|
+
function SubagentWorkflowDrawer({ open, providerLabel, items, totalSubagents, selectedId, onSelect, onClose, onRefresh, onLoadMore, loading, error, steps, partial, totalSteps, truncated, hasMore, host, cwd, activeStatus, activeModel, activeTypeName, activeSpawnDepth, activeRole }) {
|
|
96814
|
+
const { tr } = useLocale();
|
|
96815
|
+
const [stepFilter, setStepFilter] = (0, import_react.useState)("all");
|
|
96816
|
+
const [expandAll, setExpandAll] = (0, import_react.useState)(false);
|
|
96817
|
+
const [dirQuery, setDirQuery] = (0, import_react.useState)("");
|
|
96818
|
+
const [prefsOpen, setPrefsOpen] = (0, import_react.useState)(false);
|
|
96819
|
+
(0, import_react.useEffect)(() => {
|
|
96820
|
+
if (!open) return;
|
|
96821
|
+
const onKeyDown = (event) => {
|
|
96822
|
+
if (event.key === "Escape") onClose();
|
|
96823
|
+
};
|
|
96824
|
+
window.addEventListener("keydown", onKeyDown);
|
|
96825
|
+
return () => window.removeEventListener("keydown", onKeyDown);
|
|
96826
|
+
}, [open, onClose]);
|
|
96827
|
+
const counts = (0, import_react.useMemo)(() => {
|
|
96828
|
+
let dialogue = 0;
|
|
96829
|
+
let tools = 0;
|
|
96830
|
+
let thinking = 0;
|
|
96831
|
+
let errors = 0;
|
|
96832
|
+
for (const step of steps) {
|
|
96833
|
+
if (step.kind === "prompt" || step.kind === "assistant" || extractHandbackMarkdown(step)) dialogue += 1;
|
|
96834
|
+
if (step.kind === "tool" || step.kind === "command") tools += 1;
|
|
96835
|
+
if (step.kind === "thinking") thinking += 1;
|
|
96836
|
+
if (step.kind === "error" || step.isError) errors += 1;
|
|
96837
|
+
}
|
|
96838
|
+
return {
|
|
96839
|
+
dialogue,
|
|
96840
|
+
tools,
|
|
96841
|
+
thinking,
|
|
96842
|
+
errors
|
|
96843
|
+
};
|
|
96844
|
+
}, [steps]);
|
|
96845
|
+
const filteredSteps = (0, import_react.useMemo)(() => {
|
|
96846
|
+
if (stepFilter === "all") return steps;
|
|
96847
|
+
if (stepFilter === "dialogue") return steps.filter((s) => s.kind === "prompt" || s.kind === "assistant" || Boolean(extractHandbackMarkdown(s)));
|
|
96848
|
+
if (stepFilter === "tools") return steps.filter((s) => s.kind === "tool" || s.kind === "command");
|
|
96849
|
+
if (stepFilter === "thinking") return steps.filter((s) => s.kind === "thinking");
|
|
96850
|
+
return steps.filter((s) => s.kind === "error" || s.isError);
|
|
96851
|
+
}, [steps, stepFilter]);
|
|
96852
|
+
const groupedDirectory = (0, import_react.useMemo)(() => {
|
|
96853
|
+
const q = dirQuery.trim().toLowerCase();
|
|
96854
|
+
const list = q ? items.filter((item) => (item.role || item.label).toLowerCase().includes(q) || (item.typeName || "").toLowerCase().includes(q) || (item.model || "").toLowerCase().includes(q) || (item.taskTitle || "").toLowerCase().includes(q) || item.id.toLowerCase().includes(q)) : items;
|
|
96855
|
+
const groups = [];
|
|
96856
|
+
const byKey = /* @__PURE__ */ new Map();
|
|
96857
|
+
for (const item of list) {
|
|
96858
|
+
const taskKey = item.taskTitle ? `task:${item.taskTitle}` : "other";
|
|
96859
|
+
let group = byKey.get(taskKey);
|
|
96860
|
+
if (!group) {
|
|
96861
|
+
group = {
|
|
96862
|
+
key: taskKey,
|
|
96863
|
+
title: item.taskTitle || "",
|
|
96864
|
+
items: []
|
|
96865
|
+
};
|
|
96866
|
+
byKey.set(taskKey, group);
|
|
96867
|
+
groups.push(group);
|
|
96868
|
+
}
|
|
96869
|
+
group.items.push(item);
|
|
96870
|
+
}
|
|
96871
|
+
return groups;
|
|
96872
|
+
}, [items, dirQuery]);
|
|
96873
|
+
if (!open) return null;
|
|
96874
|
+
const statusText = {
|
|
96875
|
+
working: tr("工作中", "Working"),
|
|
96876
|
+
running: tr("运行中", "Running"),
|
|
96877
|
+
completed: tr("已完成", "Completed"),
|
|
96878
|
+
idle: tr("已结束", "Idle"),
|
|
96879
|
+
failed: tr("失败", "Failed"),
|
|
96880
|
+
stopped: tr("已停止", "Stopped")
|
|
96881
|
+
};
|
|
96882
|
+
const totalCount = Math.max(totalSubagents || 0, items.length);
|
|
96883
|
+
const workingCount = items.filter((item) => item.status === "working" || item.status === "running").length;
|
|
96884
|
+
const selectedIndex = selectedId ? items.findIndex((item) => item.id === selectedId) : -1;
|
|
96885
|
+
const selectedItem = selectedIndex >= 0 ? items[selectedIndex] : null;
|
|
96886
|
+
const status = activeStatus || selectedItem?.status || "completed";
|
|
96887
|
+
const isWorking = status === "working" || status === "running";
|
|
96888
|
+
const model = activeModel || selectedItem?.model || "";
|
|
96889
|
+
const typeName = activeTypeName || selectedItem?.typeName || "";
|
|
96890
|
+
const spawnDepth = activeSpawnDepth ?? selectedItem?.spawnDepth ?? null;
|
|
96891
|
+
const title = activeRole || selectedItem?.role || selectedItem?.label || selectedId || "";
|
|
96892
|
+
const selectSubagent = (nextId) => {
|
|
96893
|
+
setStepFilter("all");
|
|
96894
|
+
setExpandAll(false);
|
|
96895
|
+
onSelect(nextId);
|
|
96896
|
+
};
|
|
96897
|
+
const prefsToggleButton = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("button", {
|
|
96898
|
+
type: "button",
|
|
96899
|
+
className: `subagent-drawer-icon-btn${prefsOpen ? " is-active" : ""}`,
|
|
96900
|
+
onClick: () => setPrefsOpen((value) => !value),
|
|
96901
|
+
"aria-expanded": prefsOpen,
|
|
96902
|
+
title: tr("子代理显示开关", "Subagent display toggles"),
|
|
96903
|
+
children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(SlidersHorizontal, { size: 13 }), tr("显示开关", "Display")]
|
|
96904
|
+
});
|
|
96905
|
+
const prefsPanel = prefsOpen ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(SubagentDisplayToggles, { variant: "drawer" }) : null;
|
|
96906
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
|
|
96907
|
+
className: "subagent-drawer-backdrop",
|
|
96908
|
+
role: "presentation",
|
|
96909
|
+
onClick: (event) => {
|
|
96910
|
+
if (event.target === event.currentTarget) onClose();
|
|
96911
|
+
},
|
|
96912
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("aside", {
|
|
96913
|
+
className: "subagent-drawer",
|
|
96914
|
+
role: "dialog",
|
|
96915
|
+
"aria-modal": "true",
|
|
96916
|
+
"aria-label": tr("子代理工作流详情", "Subagent workflow inspector"),
|
|
96917
|
+
children: !selectedId ? /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
|
|
96918
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("header", {
|
|
96919
|
+
className: "subagent-drawer-header",
|
|
96920
|
+
children: [/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
|
|
96921
|
+
className: "subagent-drawer-title",
|
|
96922
|
+
children: [
|
|
96923
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
|
|
96924
|
+
className: "subagent-drawer-title-row",
|
|
96925
|
+
children: [
|
|
96926
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", {
|
|
96927
|
+
className: "subagent-drawer-pill",
|
|
96928
|
+
children: providerLabel
|
|
96929
|
+
}),
|
|
96930
|
+
workingCount > 0 && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("span", {
|
|
96931
|
+
className: "subagent-drawer-pill is-working",
|
|
96932
|
+
children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(LoaderCircle, {
|
|
96933
|
+
size: 11,
|
|
96934
|
+
className: "is-spinning"
|
|
96935
|
+
}), tr(`${workingCount} 个工作中`, `${workingCount} working`)]
|
|
96936
|
+
}),
|
|
96937
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("span", {
|
|
96938
|
+
className: "subagent-drawer-pill is-completed",
|
|
96939
|
+
children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Bot, { size: 11 }), tr(`共 ${totalCount} 个子代理`, `${totalCount} subagents`)]
|
|
96940
|
+
})
|
|
96941
|
+
]
|
|
96942
|
+
}),
|
|
96943
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("h3", { children: tr("会话子代理总览", "Session Subagents") }),
|
|
96944
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
|
|
96945
|
+
className: "subagent-drawer-meta",
|
|
96946
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { children: tr("点击任意子代理查看其完整思考、工具调用与输出工作流", "Select any subagent to inspect its full step-by-step workflow") })
|
|
96947
|
+
})
|
|
96948
|
+
]
|
|
96949
|
+
}), /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
|
|
96950
|
+
className: "subagent-drawer-actions",
|
|
96951
|
+
children: [prefsToggleButton, /* @__PURE__ */ (0, import_jsx_runtime.jsx)("button", {
|
|
96952
|
+
type: "button",
|
|
96953
|
+
className: "subagent-drawer-icon-btn",
|
|
96954
|
+
onClick: onClose,
|
|
96955
|
+
"aria-label": tr("关闭子代理面板", "Close subagents panel"),
|
|
96956
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(X, { size: 14 })
|
|
96957
|
+
})]
|
|
96958
|
+
})]
|
|
96959
|
+
}),
|
|
96960
|
+
prefsPanel,
|
|
96961
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
|
|
96962
|
+
className: "subagent-drawer-body",
|
|
96963
|
+
children: [
|
|
96964
|
+
items.length >= 6 && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("label", {
|
|
96965
|
+
className: "subagent-dir-search",
|
|
96966
|
+
children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Search, { size: 14 }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)("input", {
|
|
96967
|
+
value: dirQuery,
|
|
96968
|
+
onChange: (event) => setDirQuery(event.target.value),
|
|
96969
|
+
placeholder: tr("按名称、任务、类型或模型筛选子代理…", "Filter subagents by name, task, type, or model…")
|
|
96970
|
+
})]
|
|
96971
|
+
}),
|
|
96972
|
+
totalCount > items.length && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
|
|
96973
|
+
className: "subagent-drawer-banner",
|
|
96974
|
+
style: { marginBottom: 12 },
|
|
96975
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { children: tr(`该会话共创建过 ${totalCount} 个子代理,当前展示最近 ${items.length} 个。`, `Showing latest ${items.length} of ${totalCount} subagents in this session.`) })
|
|
96976
|
+
}),
|
|
96977
|
+
groupedDirectory.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
|
|
96978
|
+
className: "subagent-drawer-empty",
|
|
96979
|
+
children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Bot, { size: 20 }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { children: tr("未匹配到符合条件的子代理", "No matching subagents") })]
|
|
96980
|
+
}) : groupedDirectory.map((group) => /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
|
|
96981
|
+
className: "subagent-dir-group",
|
|
96982
|
+
children: [(group.title || groupedDirectory.length > 1) && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
|
|
96983
|
+
className: "subagent-dir-group-head",
|
|
96984
|
+
children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", {
|
|
96985
|
+
className: "subagent-dir-group-title",
|
|
96986
|
+
title: group.title || tr("更早创建的子代理", "Earlier subagents"),
|
|
96987
|
+
children: group.title ? tr(`任务:${group.title}`, `Task: ${group.title}`) : tr("更早创建的子代理", "Earlier subagents")
|
|
96988
|
+
}), /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { children: tr(`${group.items.length} 个`, `${group.items.length}`) })]
|
|
96989
|
+
}), group.items.map((item) => {
|
|
96990
|
+
const itemWorking = item.status === "working" || item.status === "running";
|
|
96991
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("button", {
|
|
96992
|
+
type: "button",
|
|
96993
|
+
className: `subagent-dir-card${itemWorking ? " is-working" : ""}`,
|
|
96994
|
+
onClick: () => selectSubagent(item.id),
|
|
96995
|
+
children: [/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
|
|
96996
|
+
className: "subagent-dir-card-main",
|
|
96997
|
+
children: [
|
|
96998
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
|
|
96999
|
+
className: "subagent-dir-card-top",
|
|
97000
|
+
children: [
|
|
97001
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("span", {
|
|
97002
|
+
className: `subagent-drawer-pill is-${item.status}`,
|
|
97003
|
+
children: [itemWorking ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(LoaderCircle, {
|
|
97004
|
+
size: 10,
|
|
97005
|
+
className: "is-spinning"
|
|
97006
|
+
}) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Bot, { size: 10 }), statusText[item.status] || item.status]
|
|
97007
|
+
}),
|
|
97008
|
+
item.typeName && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", {
|
|
97009
|
+
className: "subagent-drawer-pill",
|
|
97010
|
+
children: item.typeName
|
|
97011
|
+
}),
|
|
97012
|
+
item.model && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", {
|
|
97013
|
+
className: "subagent-drawer-pill",
|
|
97014
|
+
children: item.model
|
|
97015
|
+
}),
|
|
97016
|
+
item.updatedAt && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", {
|
|
97017
|
+
className: "subagent-drawer-meta",
|
|
97018
|
+
children: formatDateTime(item.updatedAt)
|
|
97019
|
+
})
|
|
97020
|
+
]
|
|
97021
|
+
}),
|
|
97022
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", {
|
|
97023
|
+
className: "subagent-dir-card-name",
|
|
97024
|
+
children: item.role || item.label
|
|
97025
|
+
}),
|
|
97026
|
+
item.lastAction && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", {
|
|
97027
|
+
className: "subagent-dir-card-sub",
|
|
97028
|
+
title: item.lastAction,
|
|
97029
|
+
children: item.lastAction
|
|
97030
|
+
})
|
|
97031
|
+
]
|
|
97032
|
+
}), /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ChevronRight, { size: 15 })]
|
|
97033
|
+
}, item.id);
|
|
97034
|
+
})]
|
|
97035
|
+
}, group.key))
|
|
97036
|
+
]
|
|
97037
|
+
})
|
|
97038
|
+
] }) : /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
|
|
97039
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("header", {
|
|
97040
|
+
className: "subagent-drawer-header",
|
|
97041
|
+
children: [/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
|
|
97042
|
+
className: "subagent-drawer-title",
|
|
97043
|
+
children: [
|
|
97044
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
|
|
97045
|
+
className: "subagent-drawer-title-row",
|
|
97046
|
+
children: [
|
|
97047
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("span", {
|
|
97048
|
+
className: `subagent-drawer-pill is-${status}`,
|
|
97049
|
+
children: [isWorking ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(LoaderCircle, {
|
|
97050
|
+
size: 11,
|
|
97051
|
+
className: "is-spinning"
|
|
97052
|
+
}) : status === "failed" ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(CircleAlert, { size: 11 }) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Bot, { size: 11 }), statusText[status] || status]
|
|
97053
|
+
}),
|
|
97054
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", {
|
|
97055
|
+
className: "subagent-drawer-pill",
|
|
97056
|
+
children: providerLabel
|
|
97057
|
+
}),
|
|
97058
|
+
typeName && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", {
|
|
97059
|
+
className: "subagent-drawer-pill",
|
|
97060
|
+
children: typeName
|
|
97061
|
+
}),
|
|
97062
|
+
model && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", {
|
|
97063
|
+
className: "subagent-drawer-pill",
|
|
97064
|
+
children: model
|
|
97065
|
+
}),
|
|
97066
|
+
typeof spawnDepth === "number" && spawnDepth > 0 && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", {
|
|
97067
|
+
className: "subagent-drawer-pill",
|
|
97068
|
+
children: tr(`层级 ${spawnDepth}`, `Depth ${spawnDepth}`)
|
|
97069
|
+
})
|
|
97070
|
+
]
|
|
97071
|
+
}),
|
|
97072
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("h3", {
|
|
97073
|
+
title,
|
|
97074
|
+
children: title
|
|
97075
|
+
}),
|
|
97076
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
|
|
97077
|
+
className: "subagent-drawer-meta",
|
|
97078
|
+
children: [
|
|
97079
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("span", { children: ["ID: ", selectedId] }),
|
|
97080
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("span", { children: [
|
|
97081
|
+
"·",
|
|
97082
|
+
" ",
|
|
97083
|
+
tr(`共 ${totalSteps ?? steps.length} 步`, `${totalSteps ?? steps.length} steps`)
|
|
97084
|
+
] }),
|
|
97085
|
+
isWorking && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("span", { children: ["· ", tr("实时自动同步", "Auto-syncing live")] })
|
|
97086
|
+
]
|
|
97087
|
+
})
|
|
97088
|
+
]
|
|
97089
|
+
}), /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
|
|
97090
|
+
className: "subagent-drawer-actions",
|
|
97091
|
+
children: [
|
|
97092
|
+
prefsToggleButton,
|
|
97093
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("button", {
|
|
97094
|
+
type: "button",
|
|
97095
|
+
className: "subagent-drawer-icon-btn",
|
|
97096
|
+
onClick: onRefresh,
|
|
97097
|
+
disabled: loading,
|
|
97098
|
+
title: tr("刷新工作流", "Refresh workflow"),
|
|
97099
|
+
children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(RefreshCw, {
|
|
97100
|
+
size: 13,
|
|
97101
|
+
className: loading ? "is-spinning" : ""
|
|
97102
|
+
}), tr("刷新", "Refresh")]
|
|
97103
|
+
}),
|
|
97104
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("button", {
|
|
97105
|
+
type: "button",
|
|
97106
|
+
className: "subagent-drawer-icon-btn",
|
|
97107
|
+
onClick: onClose,
|
|
97108
|
+
"aria-label": tr("关闭子代理工作流", "Close subagent workflow"),
|
|
97109
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(X, { size: 14 })
|
|
97110
|
+
})
|
|
97111
|
+
]
|
|
97112
|
+
})]
|
|
97113
|
+
}),
|
|
97114
|
+
prefsPanel,
|
|
97115
|
+
items.length > 1 && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
|
|
97116
|
+
className: "subagent-drawer-nav",
|
|
97117
|
+
children: [
|
|
97118
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("button", {
|
|
97119
|
+
type: "button",
|
|
97120
|
+
className: "subagent-drawer-icon-btn",
|
|
97121
|
+
onClick: () => selectSubagent(null),
|
|
97122
|
+
title: tr("返回全部子代理列表", "Back to all subagents"),
|
|
97123
|
+
children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(ArrowLeft, { size: 13 }), tr(`子代理列表 (${totalCount})`, `All subagents (${totalCount})`)]
|
|
97124
|
+
}),
|
|
97125
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("select", {
|
|
97126
|
+
className: "subagent-switcher-select",
|
|
97127
|
+
"aria-label": tr("切换子代理", "Switch subagent"),
|
|
97128
|
+
value: selectedId,
|
|
97129
|
+
onChange: (event) => selectSubagent(event.target.value),
|
|
97130
|
+
children: items.map((item, idx) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)("option", {
|
|
97131
|
+
value: item.id,
|
|
97132
|
+
children: `${item.status === "working" ? "● " : "✓ "}${idx + 1}/${items.length} · ${item.role || item.label}${item.typeName ? ` (${item.typeName})` : ""}`
|
|
97133
|
+
}, item.id))
|
|
97134
|
+
}),
|
|
97135
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
|
|
97136
|
+
className: "subagent-drawer-nav-arrows",
|
|
97137
|
+
children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)("button", {
|
|
97138
|
+
type: "button",
|
|
97139
|
+
className: "subagent-drawer-icon-btn",
|
|
97140
|
+
disabled: selectedIndex <= 0,
|
|
97141
|
+
onClick: () => selectedIndex > 0 && selectSubagent(items[selectedIndex - 1].id),
|
|
97142
|
+
"aria-label": tr("上一个子代理", "Previous subagent"),
|
|
97143
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ChevronLeft, { size: 14 })
|
|
97144
|
+
}), /* @__PURE__ */ (0, import_jsx_runtime.jsx)("button", {
|
|
97145
|
+
type: "button",
|
|
97146
|
+
className: "subagent-drawer-icon-btn",
|
|
97147
|
+
disabled: selectedIndex < 0 || selectedIndex >= items.length - 1,
|
|
97148
|
+
onClick: () => selectedIndex >= 0 && selectedIndex < items.length - 1 && selectSubagent(items[selectedIndex + 1].id),
|
|
97149
|
+
"aria-label": tr("下一个子代理", "Next subagent"),
|
|
97150
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ChevronRight, { size: 14 })
|
|
97151
|
+
})]
|
|
97152
|
+
})
|
|
97153
|
+
]
|
|
97154
|
+
}),
|
|
97155
|
+
steps.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
|
|
97156
|
+
className: "subagent-drawer-filters",
|
|
97157
|
+
children: [/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
|
|
97158
|
+
className: "subagent-filter-pills",
|
|
97159
|
+
role: "tablist",
|
|
97160
|
+
children: [
|
|
97161
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("button", {
|
|
97162
|
+
type: "button",
|
|
97163
|
+
className: `subagent-filter-pill${stepFilter === "all" ? " is-active" : ""}`,
|
|
97164
|
+
onClick: () => setStepFilter("all"),
|
|
97165
|
+
children: tr(`全部 (${steps.length})`, `All (${steps.length})`)
|
|
97166
|
+
}),
|
|
97167
|
+
counts.dialogue > 0 && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("button", {
|
|
97168
|
+
type: "button",
|
|
97169
|
+
className: `subagent-filter-pill${stepFilter === "dialogue" ? " is-active" : ""}`,
|
|
97170
|
+
onClick: () => setStepFilter("dialogue"),
|
|
97171
|
+
children: tr(`对话 & 结论 (${counts.dialogue})`, `Messages (${counts.dialogue})`)
|
|
97172
|
+
}),
|
|
97173
|
+
counts.tools > 0 && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("button", {
|
|
97174
|
+
type: "button",
|
|
97175
|
+
className: `subagent-filter-pill${stepFilter === "tools" ? " is-active" : ""}`,
|
|
97176
|
+
onClick: () => setStepFilter("tools"),
|
|
97177
|
+
children: tr(`工具 & 命令 (${counts.tools})`, `Tools (${counts.tools})`)
|
|
97178
|
+
}),
|
|
97179
|
+
counts.thinking > 0 && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("button", {
|
|
97180
|
+
type: "button",
|
|
97181
|
+
className: `subagent-filter-pill${stepFilter === "thinking" ? " is-active" : ""}`,
|
|
97182
|
+
onClick: () => setStepFilter("thinking"),
|
|
97183
|
+
children: tr(`思考 (${counts.thinking})`, `Thinking (${counts.thinking})`)
|
|
97184
|
+
}),
|
|
97185
|
+
counts.errors > 0 && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("button", {
|
|
97186
|
+
type: "button",
|
|
97187
|
+
className: `subagent-filter-pill${stepFilter === "errors" ? " is-active" : ""}`,
|
|
97188
|
+
onClick: () => setStepFilter("errors"),
|
|
97189
|
+
children: tr(`错误 (${counts.errors})`, `Errors (${counts.errors})`)
|
|
97190
|
+
})
|
|
97191
|
+
]
|
|
97192
|
+
}), /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("button", {
|
|
97193
|
+
type: "button",
|
|
97194
|
+
className: "subagent-drawer-icon-btn",
|
|
97195
|
+
onClick: () => setExpandAll((value) => !value),
|
|
97196
|
+
title: expandAll ? tr("折叠所有步骤", "Collapse all steps") : tr("展开所有步骤", "Expand all steps"),
|
|
97197
|
+
children: [expandAll ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ChevronsDownUp, { size: 13 }) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ChevronsUpDown, { size: 13 }), expandAll ? tr("全部折叠", "Collapse all") : tr("全部展开", "Expand all")]
|
|
97198
|
+
})]
|
|
97199
|
+
}),
|
|
97200
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
|
|
97201
|
+
className: "subagent-drawer-body",
|
|
97202
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
|
|
97203
|
+
className: "subagent-steps-list",
|
|
97204
|
+
children: [
|
|
97205
|
+
error && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
|
|
97206
|
+
className: "subagent-drawer-banner is-error",
|
|
97207
|
+
role: "alert",
|
|
97208
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { children: error })
|
|
97209
|
+
}),
|
|
97210
|
+
truncated && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
|
|
97211
|
+
className: "subagent-drawer-banner",
|
|
97212
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { children: tr(`工作流步骤较多(共 ${totalSteps ?? steps.length} 步),当前保留初始任务与最新 ${steps.length} 步。`, `Showing initial task + latest ${steps.length} of ${totalSteps ?? steps.length} workflow steps.`) })
|
|
97213
|
+
}),
|
|
97214
|
+
hasMore && onLoadMore && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("button", {
|
|
97215
|
+
type: "button",
|
|
97216
|
+
className: "subagent-drawer-load-more",
|
|
97217
|
+
disabled: loading,
|
|
97218
|
+
onClick: onLoadMore,
|
|
97219
|
+
children: loading ? tr("加载中…", "Loading…") : tr("加载更早的工作流步骤", "Load earlier workflow steps")
|
|
97220
|
+
}),
|
|
97221
|
+
loading && steps.length === 0 && !partial ? /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
|
|
97222
|
+
className: "subagent-drawer-empty",
|
|
97223
|
+
children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(LoaderCircle, {
|
|
97224
|
+
size: 20,
|
|
97225
|
+
className: "is-spinning"
|
|
97226
|
+
}), /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { children: tr("正在同步子代理工作流…", "Loading subagent workflow…") })]
|
|
97227
|
+
}) : filteredSteps.length === 0 && !partial ? /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
|
|
97228
|
+
className: "subagent-drawer-empty",
|
|
97229
|
+
children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Bot, { size: 20 }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { children: steps.length > 0 ? tr("当前筛选条件下没有步骤", "No steps match this filter") : isWorking ? tr("子代理已启动,等待写入第一步工具调用或回复…", "Subagent started; waiting for first tool call or reply…") : tr("暂无可展示的子代理工作流记录。", "No workflow steps recorded for this subagent.") })]
|
|
97230
|
+
}) : filteredSteps.map((step) => {
|
|
97231
|
+
const timeStr = formatTime(step.timestamp);
|
|
97232
|
+
const expandKey = `${step.id}:${expandAll ? "1" : "0"}`;
|
|
97233
|
+
if (step.kind === "prompt") return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("details", {
|
|
97234
|
+
className: "subagent-step is-prompt",
|
|
97235
|
+
open: expandAll || (step.text || "").length < 600,
|
|
97236
|
+
children: [/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("summary", { children: [/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("span", {
|
|
97237
|
+
className: "subagent-step-summary-left",
|
|
97238
|
+
children: [
|
|
97239
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Bot, { size: 13 }),
|
|
97240
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("strong", { children: tr("初始任务 Prompt", "Task prompt") }),
|
|
97241
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", {
|
|
97242
|
+
className: "subagent-step-summary-preview",
|
|
97243
|
+
children: (step.text || "").split(/\r?\n/)[0]
|
|
97244
|
+
})
|
|
97245
|
+
]
|
|
97246
|
+
}), /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("span", {
|
|
97247
|
+
className: "subagent-step-summary-right",
|
|
97248
|
+
children: [timeStr && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { children: timeStr }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ChevronRight, {
|
|
97249
|
+
size: 13,
|
|
97250
|
+
className: "subagent-step-chevron"
|
|
97251
|
+
})]
|
|
97252
|
+
})] }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
|
|
97253
|
+
className: "subagent-step-body",
|
|
97254
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(MarkdownBody, {
|
|
97255
|
+
value: step.text || "",
|
|
97256
|
+
remoteHost: host,
|
|
97257
|
+
remoteCwd: cwd
|
|
97258
|
+
})
|
|
97259
|
+
})]
|
|
97260
|
+
}, expandKey);
|
|
97261
|
+
if (step.kind === "thinking") {
|
|
97262
|
+
const dur = formatDuration(step.durationMs);
|
|
97263
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("details", {
|
|
97264
|
+
className: "subagent-step",
|
|
97265
|
+
open: expandAll,
|
|
97266
|
+
children: [/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("summary", { children: [/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("span", {
|
|
97267
|
+
className: "subagent-step-summary-left",
|
|
97268
|
+
children: [
|
|
97269
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Brain, { size: 13 }),
|
|
97270
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("strong", { children: tr("思考过程", "Thinking") }),
|
|
97271
|
+
dur && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", {
|
|
97272
|
+
className: "subagent-drawer-pill",
|
|
97273
|
+
children: dur
|
|
97274
|
+
}),
|
|
97275
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", {
|
|
97276
|
+
className: "subagent-step-summary-preview",
|
|
97277
|
+
children: (step.text || "").split(/\r?\n/)[0]
|
|
97278
|
+
})
|
|
97279
|
+
]
|
|
97280
|
+
}), /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("span", {
|
|
97281
|
+
className: "subagent-step-summary-right",
|
|
97282
|
+
children: [timeStr && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { children: timeStr }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ChevronRight, {
|
|
97283
|
+
size: 13,
|
|
97284
|
+
className: "subagent-step-chevron"
|
|
97285
|
+
})]
|
|
97286
|
+
})] }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
|
|
97287
|
+
className: "subagent-step-body",
|
|
97288
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("pre", {
|
|
97289
|
+
className: "subagent-step-pre",
|
|
97290
|
+
children: step.text
|
|
97291
|
+
})
|
|
97292
|
+
})]
|
|
97293
|
+
}, expandKey);
|
|
97294
|
+
}
|
|
97295
|
+
if (step.kind === "tool" || step.kind === "command") {
|
|
97296
|
+
const isCommand = step.kind === "command";
|
|
97297
|
+
const stepStatus = step.isError ? "failed" : step.status || "completed";
|
|
97298
|
+
const handbackMd = extractHandbackMarkdown(step);
|
|
97299
|
+
const previewLine = step.summary || step.command?.split(/\r?\n/)[0] || step.title || "";
|
|
97300
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("details", {
|
|
97301
|
+
className: "subagent-step",
|
|
97302
|
+
open: expandAll || Boolean(handbackMd),
|
|
97303
|
+
children: [/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("summary", { children: [/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("span", {
|
|
97304
|
+
className: "subagent-step-summary-left",
|
|
97305
|
+
children: [
|
|
97306
|
+
stepStatus === "running" ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(LoaderCircle, {
|
|
97307
|
+
size: 13,
|
|
97308
|
+
className: "is-spinning"
|
|
97309
|
+
}) : stepStatus === "failed" ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(CircleAlert, { size: 13 }) : isCommand ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Terminal, { size: 13 }) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Wrench, { size: 13 }),
|
|
97310
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("strong", { children: step.toolName || step.title || (isCommand ? tr("命令", "Command") : tr("工具调用", "Tool")) }),
|
|
97311
|
+
previewLine && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", {
|
|
97312
|
+
className: "subagent-step-summary-preview",
|
|
97313
|
+
title: previewLine,
|
|
97314
|
+
children: previewLine
|
|
97315
|
+
})
|
|
97316
|
+
]
|
|
97317
|
+
}), /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("span", {
|
|
97318
|
+
className: "subagent-step-summary-right",
|
|
97319
|
+
children: [
|
|
97320
|
+
stepStatus === "completed" && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(CircleCheck, { size: 12 }),
|
|
97321
|
+
timeStr && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { children: timeStr }),
|
|
97322
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(ChevronRight, {
|
|
97323
|
+
size: 13,
|
|
97324
|
+
className: "subagent-step-chevron"
|
|
97325
|
+
})
|
|
97326
|
+
]
|
|
97327
|
+
})] }), /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
|
|
97328
|
+
className: "subagent-step-body",
|
|
97329
|
+
children: [
|
|
97330
|
+
handbackMd && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
|
|
97331
|
+
className: "subagent-step-section-label",
|
|
97332
|
+
children: tr("子代理回传结果", "Handback Summary")
|
|
97333
|
+
}), /* @__PURE__ */ (0, import_jsx_runtime.jsx)(MarkdownBody, {
|
|
97334
|
+
value: handbackMd,
|
|
97335
|
+
remoteHost: host,
|
|
97336
|
+
remoteCwd: cwd
|
|
97337
|
+
})] }),
|
|
97338
|
+
step.command && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
|
|
97339
|
+
className: "subagent-step-section-label",
|
|
97340
|
+
children: tr("命令", "Command")
|
|
97341
|
+
}), /* @__PURE__ */ (0, import_jsx_runtime.jsx)("pre", {
|
|
97342
|
+
className: "subagent-step-pre",
|
|
97343
|
+
children: step.command
|
|
97344
|
+
})] }),
|
|
97345
|
+
step.inputPreview && !handbackMd && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
|
|
97346
|
+
className: "subagent-step-section-label",
|
|
97347
|
+
children: tr("参数 / 输入", "Input")
|
|
97348
|
+
}), /* @__PURE__ */ (0, import_jsx_runtime.jsx)("pre", {
|
|
97349
|
+
className: "subagent-step-pre",
|
|
97350
|
+
children: step.inputPreview
|
|
97351
|
+
})] }),
|
|
97352
|
+
step.output && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
|
|
97353
|
+
className: "subagent-step-section-label",
|
|
97354
|
+
children: step.isError ? tr("错误输出", "Error Output") : tr("执行输出", "Output")
|
|
97355
|
+
}), /* @__PURE__ */ (0, import_jsx_runtime.jsx)("pre", {
|
|
97356
|
+
className: `subagent-step-pre${step.isError ? " is-error" : ""}`,
|
|
97357
|
+
children: step.output
|
|
97358
|
+
})] })
|
|
97359
|
+
]
|
|
97360
|
+
})]
|
|
97361
|
+
}, expandKey);
|
|
97362
|
+
}
|
|
97363
|
+
if (step.kind === "error") return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
|
|
97364
|
+
className: "subagent-step is-error",
|
|
97365
|
+
children: [/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
|
|
97366
|
+
className: "subagent-step-head",
|
|
97367
|
+
children: [/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("strong", { children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(CircleAlert, { size: 13 }), step.title || tr("执行错误", "Error")] }), timeStr && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { children: timeStr })]
|
|
97368
|
+
}), /* @__PURE__ */ (0, import_jsx_runtime.jsx)("pre", {
|
|
97369
|
+
className: "subagent-step-pre is-error",
|
|
97370
|
+
children: step.text
|
|
97371
|
+
})]
|
|
97372
|
+
}, step.id);
|
|
97373
|
+
if (step.kind === "note") return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
|
|
97374
|
+
className: "subagent-step is-note",
|
|
97375
|
+
children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", {
|
|
97376
|
+
className: "subagent-note-text",
|
|
97377
|
+
children: step.text || step.title
|
|
97378
|
+
}), timeStr && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", {
|
|
97379
|
+
className: "subagent-note-time",
|
|
97380
|
+
children: timeStr
|
|
97381
|
+
})]
|
|
97382
|
+
}, step.id);
|
|
97383
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
|
|
97384
|
+
className: "subagent-step is-assistant",
|
|
97385
|
+
children: [/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
|
|
97386
|
+
className: "subagent-step-head",
|
|
97387
|
+
children: [/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("strong", { children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Bot, { size: 13 }), step.title || tr("子代理输出", "Assistant")] }), timeStr && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { children: timeStr })]
|
|
97388
|
+
}), /* @__PURE__ */ (0, import_jsx_runtime.jsx)(MarkdownBody, {
|
|
97389
|
+
value: step.text || "",
|
|
97390
|
+
remoteHost: host,
|
|
97391
|
+
remoteCwd: cwd
|
|
97392
|
+
})]
|
|
97393
|
+
}, step.id);
|
|
97394
|
+
}),
|
|
97395
|
+
partial && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
|
|
97396
|
+
className: "subagent-step is-assistant is-assistant-partial",
|
|
97397
|
+
children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
|
|
97398
|
+
className: "subagent-step-head",
|
|
97399
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("strong", { children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(LoaderCircle, {
|
|
97400
|
+
size: 12,
|
|
97401
|
+
className: "is-spinning"
|
|
97402
|
+
}), tr("实时生成中…", "Streaming…")] })
|
|
97403
|
+
}), /* @__PURE__ */ (0, import_jsx_runtime.jsx)(MarkdownBody, {
|
|
97404
|
+
value: partial,
|
|
97405
|
+
remoteHost: host,
|
|
97406
|
+
remoteCwd: cwd
|
|
97407
|
+
})]
|
|
97408
|
+
})
|
|
97409
|
+
]
|
|
97410
|
+
})
|
|
97411
|
+
})
|
|
97412
|
+
] })
|
|
97413
|
+
})
|
|
97414
|
+
});
|
|
97415
|
+
}
|
|
97416
|
+
//#endregion
|
|
96039
97417
|
//#region features/conversation/NativePermissionRequest.tsx
|
|
96040
97418
|
function NativePermissionRequest({ request, disabled, respond, provider = "Claude" }) {
|
|
96041
97419
|
const { tr } = useLocale();
|
|
@@ -96090,27 +97468,168 @@ function NativePermissionRequest({ request, disabled, respond, provider = "Claud
|
|
|
96090
97468
|
}
|
|
96091
97469
|
//#endregion
|
|
96092
97470
|
//#region features/conversation/NativeLiveEvents.tsx
|
|
96093
|
-
function
|
|
97471
|
+
function extractAgentIdFromResult(text) {
|
|
97472
|
+
if (!text) return "";
|
|
97473
|
+
const m = text.match(/agentId:\s*([a-zA-Z0-9_-]+)/);
|
|
97474
|
+
if (!m) return "";
|
|
97475
|
+
return m[1].startsWith("agent-") ? m[1] : `agent-${m[1]}`;
|
|
97476
|
+
}
|
|
97477
|
+
function NativeLiveEvents({ events, partial, host, cwd, subagents = [], canInspectSubagent = false, onInspectSubagent }) {
|
|
97478
|
+
const { tr } = useLocale();
|
|
97479
|
+
const { prefs } = useSubagentDisplayPrefs();
|
|
96094
97480
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [events.map((event, index) => {
|
|
96095
97481
|
if (event.kind === "tool_result") return null;
|
|
96096
|
-
if (event.kind === "tool")
|
|
96097
|
-
|
|
96098
|
-
|
|
96099
|
-
|
|
96100
|
-
|
|
96101
|
-
|
|
96102
|
-
|
|
96103
|
-
|
|
97482
|
+
if (event.kind === "tool") {
|
|
97483
|
+
const inp = event.input && typeof event.input === "object" ? event.input : null;
|
|
97484
|
+
const results = events.filter((item) => item.kind === "tool_result" && item.id === event.id);
|
|
97485
|
+
const resultText = results.map((r) => r.text || "").join("\n");
|
|
97486
|
+
if (event.name === "Agent" || event.name === "Task") {
|
|
97487
|
+
if (!prefs.showInteractions) return null;
|
|
97488
|
+
const desc = String(inp?.name || inp?.description || tr("子代理", "Subagent"));
|
|
97489
|
+
const prompt = String(inp?.prompt || "");
|
|
97490
|
+
const matched = subagents.find((s) => event.id && s.toolUseId === event.id || event.id && s.id === event.id || s.role === desc);
|
|
97491
|
+
const jumpId = matched?.agentId || matched?.id || extractAgentIdFromResult(resultText) || event.id || "";
|
|
97492
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("details", {
|
|
97493
|
+
className: "agent-interaction-card is-outbound",
|
|
97494
|
+
open: prefs.autoExpandInteractions,
|
|
97495
|
+
children: [/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("summary", { children: [/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("span", {
|
|
97496
|
+
className: "agent-interaction-left",
|
|
97497
|
+
children: [
|
|
97498
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("span", {
|
|
97499
|
+
className: "agent-interaction-badge",
|
|
97500
|
+
children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(ArrowUpRight, { size: 11 }), tr("主会话 → 新建子代理", "Main → Spawn")]
|
|
97501
|
+
}),
|
|
97502
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", {
|
|
97503
|
+
className: "agent-interaction-peer",
|
|
97504
|
+
title: desc,
|
|
97505
|
+
children: desc
|
|
97506
|
+
}),
|
|
97507
|
+
prompt && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", {
|
|
97508
|
+
className: "agent-interaction-preview",
|
|
97509
|
+
title: prompt,
|
|
97510
|
+
children: prompt.split(/\r?\n/)[0]
|
|
97511
|
+
})
|
|
97512
|
+
]
|
|
97513
|
+
}), /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("span", {
|
|
97514
|
+
className: "agent-interaction-right",
|
|
97515
|
+
children: [canInspectSubagent && jumpId && onInspectSubagent && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("button", {
|
|
97516
|
+
type: "button",
|
|
97517
|
+
className: "agent-interaction-jump",
|
|
97518
|
+
onClick: (e) => {
|
|
97519
|
+
e.preventDefault();
|
|
97520
|
+
e.stopPropagation();
|
|
97521
|
+
onInspectSubagent(jumpId);
|
|
97522
|
+
},
|
|
97523
|
+
children: [tr("查看工作流", "Workflow"), /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ChevronRight, { size: 11 })]
|
|
97524
|
+
}), /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ChevronRight, { size: 13 })]
|
|
97525
|
+
})] }), prompt && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
|
|
97526
|
+
className: "agent-interaction-body",
|
|
97527
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(MarkdownBody, {
|
|
97528
|
+
value: prompt,
|
|
97529
|
+
remoteHost: host,
|
|
97530
|
+
remoteCwd: cwd
|
|
97531
|
+
})
|
|
97532
|
+
})]
|
|
97533
|
+
}, `${index}:${prefs.autoExpandInteractions ? "1" : "0"}`);
|
|
97534
|
+
}
|
|
97535
|
+
if (event.name === "SendMessage") {
|
|
97536
|
+
if (!prefs.showInteractions) return null;
|
|
97537
|
+
const to = String(inp?.to || inp?.recipient || "");
|
|
97538
|
+
const summary = String(inp?.summary || "");
|
|
97539
|
+
const body = String(inp?.message || inp?.content || "");
|
|
97540
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("details", {
|
|
97541
|
+
className: "agent-interaction-card is-outbound",
|
|
97542
|
+
open: prefs.autoExpandInteractions,
|
|
97543
|
+
children: [/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("summary", { children: [/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("span", {
|
|
97544
|
+
className: "agent-interaction-left",
|
|
97545
|
+
children: [
|
|
97546
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("span", {
|
|
97547
|
+
className: "agent-interaction-badge",
|
|
97548
|
+
children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(ArrowUpRight, { size: 11 }), tr("主会话 → 协作消息", "Main → Agent")]
|
|
97549
|
+
}),
|
|
97550
|
+
to && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", {
|
|
97551
|
+
className: "agent-interaction-peer",
|
|
97552
|
+
title: to,
|
|
97553
|
+
children: to
|
|
97554
|
+
}),
|
|
97555
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", {
|
|
97556
|
+
className: "agent-interaction-preview",
|
|
97557
|
+
children: summary || body.split(/\r?\n/)[0]
|
|
97558
|
+
})
|
|
97559
|
+
]
|
|
97560
|
+
}), /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", {
|
|
97561
|
+
className: "agent-interaction-right",
|
|
97562
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ChevronRight, { size: 13 })
|
|
97563
|
+
})] }), body && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
|
|
97564
|
+
className: "agent-interaction-body",
|
|
97565
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(MarkdownBody, {
|
|
97566
|
+
value: body,
|
|
97567
|
+
remoteHost: host,
|
|
97568
|
+
remoteCwd: cwd
|
|
97569
|
+
})
|
|
97570
|
+
})]
|
|
97571
|
+
}, `${index}:${prefs.autoExpandInteractions ? "1" : "0"}`);
|
|
97572
|
+
}
|
|
97573
|
+
if (event.name === "SubagentHandback") {
|
|
97574
|
+
if (!prefs.showInteractions) return null;
|
|
97575
|
+
const report = String(inp?.message || inp?.report || inp?.result || inp?.summary || "").trim();
|
|
97576
|
+
const firstLine = report.split(/\r?\n/).find((ln) => ln.trim()) || "";
|
|
97577
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("details", {
|
|
97578
|
+
className: "agent-interaction-card is-inbound",
|
|
97579
|
+
open: prefs.autoExpandInteractions,
|
|
97580
|
+
children: [/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("summary", { children: [/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("span", {
|
|
97581
|
+
className: "agent-interaction-left",
|
|
97582
|
+
children: [/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("span", {
|
|
97583
|
+
className: "agent-interaction-badge",
|
|
97584
|
+
children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(ArrowDownLeft, { size: 11 }), tr("子代理回传 → 主会话", "Subagent → Main")]
|
|
97585
|
+
}), firstLine && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", {
|
|
97586
|
+
className: "agent-interaction-preview",
|
|
97587
|
+
title: firstLine,
|
|
97588
|
+
children: firstLine
|
|
97589
|
+
})]
|
|
97590
|
+
}), /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", {
|
|
97591
|
+
className: "agent-interaction-right",
|
|
97592
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ChevronRight, { size: 13 })
|
|
97593
|
+
})] }), report && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
|
|
97594
|
+
className: "agent-interaction-body",
|
|
97595
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(MarkdownBody, {
|
|
97596
|
+
value: report,
|
|
97597
|
+
remoteHost: host,
|
|
97598
|
+
remoteCwd: cwd
|
|
97599
|
+
})
|
|
97600
|
+
})]
|
|
97601
|
+
}, `${index}:${prefs.autoExpandInteractions ? "1" : "0"}`);
|
|
97602
|
+
}
|
|
97603
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("details", {
|
|
97604
|
+
className: "native-tool-event",
|
|
97605
|
+
children: [
|
|
97606
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("summary", { children: event.name || "工具调用" }),
|
|
97607
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("pre", { children: JSON.stringify(event.input, null, 2) }),
|
|
97608
|
+
results.map((item, i) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)("pre", { children: item.text }, i))
|
|
97609
|
+
]
|
|
97610
|
+
}, index);
|
|
97611
|
+
}
|
|
96104
97612
|
if (event.kind === "permission") return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", {
|
|
96105
97613
|
className: "native-note",
|
|
96106
97614
|
children: event.text
|
|
96107
97615
|
}, index);
|
|
96108
97616
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
|
|
96109
|
-
className: `native-message ${event.kind === "user" ? "user" : "assistant"}`,
|
|
96110
|
-
children: [
|
|
96111
|
-
|
|
96112
|
-
|
|
96113
|
-
|
|
97617
|
+
className: `native-message-block ${event.kind === "user" ? "is-user" : "is-assistant"}`,
|
|
97618
|
+
children: [/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
|
|
97619
|
+
className: `native-message ${event.kind === "user" ? "user" : "assistant"}`,
|
|
97620
|
+
children: [event.kind === "user" && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("small", { children: "追加消息 · 已接收" }), event.kind === "user" ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(CollapsibleUserMessage, {
|
|
97621
|
+
value: event.text || "",
|
|
97622
|
+
remoteHost: host,
|
|
97623
|
+
remoteCwd: cwd,
|
|
97624
|
+
surface: "hover"
|
|
97625
|
+
}) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(MarkdownBody, {
|
|
97626
|
+
value: event.text || "",
|
|
97627
|
+
remoteHost: host,
|
|
97628
|
+
remoteCwd: cwd
|
|
97629
|
+
})]
|
|
97630
|
+
}), event.text && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(MessageCopyButton, {
|
|
97631
|
+
text: event.text,
|
|
97632
|
+
align: event.kind === "user" ? "end" : "start"
|
|
96114
97633
|
})]
|
|
96115
97634
|
}, index);
|
|
96116
97635
|
}), partial && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
|
|
@@ -96133,29 +97652,50 @@ var ACTIVE = [
|
|
|
96133
97652
|
"finishing"
|
|
96134
97653
|
];
|
|
96135
97654
|
function mergeNativeSubagents(historySubs = [], liveSubs = [], preferLive) {
|
|
96136
|
-
const
|
|
97655
|
+
const byKey = /* @__PURE__ */ new Map();
|
|
97656
|
+
const keyFor = (item) => item.toolUseId || item.id;
|
|
96137
97657
|
const ordered = preferLive ? [...historySubs, ...liveSubs] : [...liveSubs, ...historySubs];
|
|
96138
97658
|
for (const item of ordered) {
|
|
96139
97659
|
if (!item?.id) continue;
|
|
96140
|
-
const
|
|
97660
|
+
const key = keyFor(item);
|
|
97661
|
+
const prev = byKey.get(key) || byKey.get(item.id);
|
|
96141
97662
|
if (!prev) {
|
|
96142
|
-
|
|
97663
|
+
byKey.set(key, item);
|
|
96143
97664
|
continue;
|
|
96144
97665
|
}
|
|
96145
97666
|
const prevAt = prev.updatedAt || 0;
|
|
96146
97667
|
const nextAt = item.updatedAt || 0;
|
|
96147
97668
|
const prevWorking = prev.status === "working";
|
|
96148
97669
|
const nextWorking = item.status === "working";
|
|
96149
|
-
|
|
97670
|
+
const merged = nextAt > prevAt || nextAt === prevAt && prevWorking && !nextWorking ? {
|
|
96150
97671
|
...prev,
|
|
96151
|
-
...item
|
|
96152
|
-
|
|
97672
|
+
...item,
|
|
97673
|
+
agentId: item.agentId || prev.agentId,
|
|
97674
|
+
toolUseId: item.toolUseId || prev.toolUseId,
|
|
97675
|
+
model: item.model || prev.model,
|
|
97676
|
+
spawnDepth: item.spawnDepth ?? prev.spawnDepth,
|
|
97677
|
+
steps: item.steps?.length ? item.steps : prev.steps,
|
|
97678
|
+
partial: item.partial || prev.partial,
|
|
97679
|
+
hasWorkflow: Boolean(item.hasWorkflow || prev.hasWorkflow)
|
|
97680
|
+
} : {
|
|
97681
|
+
...item,
|
|
97682
|
+
...prev,
|
|
97683
|
+
agentId: prev.agentId || item.agentId,
|
|
97684
|
+
toolUseId: prev.toolUseId || item.toolUseId,
|
|
97685
|
+
model: prev.model || item.model,
|
|
97686
|
+
spawnDepth: prev.spawnDepth ?? item.spawnDepth,
|
|
97687
|
+
steps: prev.steps?.length ? prev.steps : item.steps,
|
|
97688
|
+
partial: prev.partial || item.partial,
|
|
97689
|
+
hasWorkflow: Boolean(prev.hasWorkflow || item.hasWorkflow)
|
|
97690
|
+
};
|
|
97691
|
+
byKey.set(key, merged);
|
|
96153
97692
|
}
|
|
96154
|
-
return Array.from(
|
|
97693
|
+
return Array.from(byKey.values());
|
|
96155
97694
|
}
|
|
96156
|
-
function NativeSubagentsPanel({ subagents }) {
|
|
97695
|
+
function NativeSubagentsPanel({ subagents, totalCount, canInspect, onInspect, onOpenDirectory }) {
|
|
96157
97696
|
const { tr } = useLocale();
|
|
96158
97697
|
if (!subagents.length) return null;
|
|
97698
|
+
const total = Math.max(totalCount || 0, subagents.length);
|
|
96159
97699
|
const statusLabels = {
|
|
96160
97700
|
working: tr("工作中", "Working"),
|
|
96161
97701
|
completed: tr("已完成", "Done"),
|
|
@@ -96166,9 +97706,8 @@ function NativeSubagentsPanel({ subagents }) {
|
|
|
96166
97706
|
const finishedCount = subagents.length - workingList.length;
|
|
96167
97707
|
const body = /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
|
|
96168
97708
|
className: "native-subagents-list",
|
|
96169
|
-
children: subagents.map((item) =>
|
|
96170
|
-
|
|
96171
|
-
children: [/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
|
|
97709
|
+
children: subagents.map((item) => {
|
|
97710
|
+
const inner = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
|
|
96172
97711
|
className: "native-subagent-meta",
|
|
96173
97712
|
children: [
|
|
96174
97713
|
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("span", {
|
|
@@ -96182,14 +97721,28 @@ function NativeSubagentsPanel({ subagents }) {
|
|
|
96182
97721
|
title: item.role,
|
|
96183
97722
|
children: item.role
|
|
96184
97723
|
}),
|
|
96185
|
-
item.typeName && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("small", { children: item.typeName })
|
|
97724
|
+
item.typeName && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("small", { children: item.typeName }),
|
|
97725
|
+
item.model && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("small", { children: item.model })
|
|
96186
97726
|
]
|
|
96187
|
-
}),
|
|
96188
|
-
className: "native-subagent-
|
|
96189
|
-
|
|
96190
|
-
|
|
96191
|
-
|
|
96192
|
-
|
|
97727
|
+
}), /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("span", {
|
|
97728
|
+
className: "native-subagent-right",
|
|
97729
|
+
children: [item.lastAction && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", {
|
|
97730
|
+
className: "native-subagent-action",
|
|
97731
|
+
title: item.lastAction,
|
|
97732
|
+
children: item.lastAction
|
|
97733
|
+
}), canInspect && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ChevronRight, { size: 13 })]
|
|
97734
|
+
})] });
|
|
97735
|
+
return canInspect ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)("button", {
|
|
97736
|
+
type: "button",
|
|
97737
|
+
className: "native-subagent-row",
|
|
97738
|
+
onClick: () => onInspect(item),
|
|
97739
|
+
title: tr("点击查看子代理实际工作流", "Inspect subagent workflow"),
|
|
97740
|
+
children: inner
|
|
97741
|
+
}, item.id) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
|
|
97742
|
+
className: "native-subagent-row",
|
|
97743
|
+
children: inner
|
|
97744
|
+
}, item.id);
|
|
97745
|
+
})
|
|
96193
97746
|
});
|
|
96194
97747
|
if (workingList.length > 0) return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("section", {
|
|
96195
97748
|
className: "native-subagents-card is-working",
|
|
@@ -96208,10 +97761,19 @@ function NativeSubagentsPanel({ subagents }) {
|
|
|
96208
97761
|
});
|
|
96209
97762
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("details", {
|
|
96210
97763
|
className: "native-subagents-card",
|
|
96211
|
-
children: [
|
|
96212
|
-
|
|
96213
|
-
|
|
96214
|
-
|
|
97764
|
+
children: [
|
|
97765
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("summary", {
|
|
97766
|
+
className: "native-subagents-head",
|
|
97767
|
+
children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Bot, { size: 13 }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { children: total > subagents.length ? tr(`本会话共新建 ${total} 个子代理(展开最近 ${subagents.length} 个)`, `${total} subagents created in this session (showing latest ${subagents.length})`) : tr(`本会话子代理 · ${subagents.length} 个已完成`, `Session subagents · ${subagents.length} completed`) })]
|
|
97768
|
+
}),
|
|
97769
|
+
body,
|
|
97770
|
+
canInspect && onOpenDirectory && total > subagents.length && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("button", {
|
|
97771
|
+
type: "button",
|
|
97772
|
+
className: "native-task-subagents-more",
|
|
97773
|
+
onClick: onOpenDirectory,
|
|
97774
|
+
children: tr(`在右侧总览查看全部 ${total} 个子代理 →`, `Browse all ${total} subagents in drawer →`)
|
|
97775
|
+
})
|
|
97776
|
+
]
|
|
96215
97777
|
});
|
|
96216
97778
|
}
|
|
96217
97779
|
function NativeConversation({ entry, onChanged, onAccounts }) {
|
|
@@ -96228,8 +97790,10 @@ function NativeConversation({ entry, onChanged, onAccounts }) {
|
|
|
96228
97790
|
const [error, setError] = (0, import_react.useState)("");
|
|
96229
97791
|
const [sending, setSending] = (0, import_react.useState)(false);
|
|
96230
97792
|
const [loading, setLoading] = (0, import_react.useState)(Boolean(entry.managed));
|
|
97793
|
+
const [openSubagent, setOpenSubagent] = (0, import_react.useState)(null);
|
|
96231
97794
|
const composer = (0, import_react.useRef)(null);
|
|
96232
97795
|
const { tr } = useLocale();
|
|
97796
|
+
const { prefs: subagentPrefs } = useSubagentDisplayPrefs();
|
|
96233
97797
|
const attach = useComposerAttachments({
|
|
96234
97798
|
host: entry.host,
|
|
96235
97799
|
scope: entry.key,
|
|
@@ -96318,9 +97882,35 @@ function NativeConversation({ entry, onChanged, onAccounts }) {
|
|
|
96318
97882
|
working
|
|
96319
97883
|
]);
|
|
96320
97884
|
const workingSubagentsCount = (0, import_react.useMemo)(() => subagents.filter((item) => item.status === "working").length, [subagents]);
|
|
97885
|
+
const totalSubagentsCount = Math.max(nativeHistory.history?.totalSubagents || 0, subagents.length);
|
|
97886
|
+
const isLocalReadOnly = entry.host === LOCAL_HOST;
|
|
97887
|
+
const externalLock = nativeHistory.history ? nativeHistory.history.externalLock || null : entry.externalLock || null;
|
|
97888
|
+
const isExternalLocked = Boolean(externalLock?.locked) && !working && !isLocalReadOnly;
|
|
97889
|
+
const isComposerReadOnly = isLocalReadOnly || isExternalLocked;
|
|
97890
|
+
const resolvedSessionId = conversation?.sessionId || entry.sessionId;
|
|
97891
|
+
const resolvedCatalogKey = (entry.provider === "claude" || entry.provider === "antigravity") && resolvedSessionId ? JSON.stringify([
|
|
97892
|
+
entry.host,
|
|
97893
|
+
entry.provider,
|
|
97894
|
+
resolvedSessionId
|
|
97895
|
+
]) : entry.key;
|
|
97896
|
+
const isDrawerOpen = openSubagent?.entryKey === entry.key && entry.provider === "claude";
|
|
97897
|
+
const activeSubagentId = isDrawerOpen ? openSubagent.id : null;
|
|
97898
|
+
const claudeWorkflow = useClaudeSubagentWorkflow(resolvedCatalogKey, entry.provider, subagents, activeSubagentId);
|
|
97899
|
+
const subagentDrawerItems = (0, import_react.useMemo)(() => subagents.map((item) => ({
|
|
97900
|
+
id: item.id,
|
|
97901
|
+
label: item.role || item.id,
|
|
97902
|
+
role: item.role,
|
|
97903
|
+
typeName: item.typeName,
|
|
97904
|
+
model: item.model,
|
|
97905
|
+
spawnDepth: item.spawnDepth,
|
|
97906
|
+
status: item.status,
|
|
97907
|
+
lastAction: item.lastAction,
|
|
97908
|
+
taskTitle: item.taskTitle,
|
|
97909
|
+
updatedAt: item.updatedAt
|
|
97910
|
+
})), [subagents]);
|
|
96321
97911
|
const refreshNativeHistory = nativeHistory.refresh;
|
|
96322
97912
|
(0, import_react.useEffect)(() => {
|
|
96323
|
-
if (working || workingSubagentsCount === 0 || !nativeHistory.available) return;
|
|
97913
|
+
if (working || workingSubagentsCount === 0 && !isExternalLocked || !nativeHistory.available) return;
|
|
96324
97914
|
const timer = setInterval(() => {
|
|
96325
97915
|
if (!document.hidden) refreshNativeHistory();
|
|
96326
97916
|
}, 4e3);
|
|
@@ -96328,6 +97918,7 @@ function NativeConversation({ entry, onChanged, onAccounts }) {
|
|
|
96328
97918
|
}, [
|
|
96329
97919
|
working,
|
|
96330
97920
|
workingSubagentsCount,
|
|
97921
|
+
isExternalLocked,
|
|
96331
97922
|
nativeHistory.available,
|
|
96332
97923
|
refreshNativeHistory
|
|
96333
97924
|
]);
|
|
@@ -96365,7 +97956,7 @@ function NativeConversation({ entry, onChanged, onAccounts }) {
|
|
|
96365
97956
|
const canControl = conversation?.interactive && ["running", "waiting_permission"].includes(conversation.status);
|
|
96366
97957
|
async function send() {
|
|
96367
97958
|
if (slash.handleLocal()) return;
|
|
96368
|
-
if (!Boolean(draft.trim() || attach.readyTokens.length > 0) || attach.hasUnready || controlBusy || pendingControl || working && !canControl ||
|
|
97959
|
+
if (!Boolean(draft.trim() || attach.readyTokens.length > 0) || attach.hasUnready || controlBusy || pendingControl || working && !canControl || isComposerReadOnly || !entry.cwd) return;
|
|
96369
97960
|
if (working && canControl) {
|
|
96370
97961
|
if (await control("message", {
|
|
96371
97962
|
prompt: draft,
|
|
@@ -96397,7 +97988,6 @@ function NativeConversation({ entry, onChanged, onAccounts }) {
|
|
|
96397
97988
|
setSending(false);
|
|
96398
97989
|
}
|
|
96399
97990
|
}
|
|
96400
|
-
const isLocalReadOnly = entry.host === LOCAL_HOST;
|
|
96401
97991
|
const [providerQuotaState, setProviderQuotaState] = (0, import_react.useState)(null);
|
|
96402
97992
|
const quotaScopeKey = !isLocalReadOnly ? `${entry.host}:${entry.provider}` : "";
|
|
96403
97993
|
(0, import_react.useEffect)(() => {
|
|
@@ -96437,20 +98027,37 @@ function NativeConversation({ entry, onChanged, onAccounts }) {
|
|
|
96437
98027
|
hostLabel(entry.host),
|
|
96438
98028
|
" · ",
|
|
96439
98029
|
entry.cwd || "未记录工作目录",
|
|
96440
|
-
isLocalReadOnly ? " · 本机只读" : ""
|
|
98030
|
+
isLocalReadOnly ? " · 本机只读" : isExternalLocked ? tr(` · 外部终端 (${externalLock?.tty || (externalLock?.pid ? `PID ${externalLock.pid}` : "只读")}) · 持续监控`, ` · External terminal (${externalLock?.tty || (externalLock?.pid ? `PID ${externalLock.pid}` : "read-only")}) · Watching`) : ""
|
|
96441
98031
|
]
|
|
96442
|
-
})] }), onAccounts && !isLocalReadOnly && /* @__PURE__ */ (0, import_jsx_runtime.
|
|
98032
|
+
})] }), (isExternalLocked || subagentPrefs.showHeaderBadge && entry.provider === "claude" && totalSubagentsCount > 0 || onAccounts && !isLocalReadOnly) && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
|
|
96443
98033
|
className: "conversation-header-actions",
|
|
96444
|
-
children:
|
|
96445
|
-
|
|
96446
|
-
|
|
96447
|
-
|
|
96448
|
-
|
|
96449
|
-
|
|
96450
|
-
|
|
96451
|
-
|
|
96452
|
-
|
|
96453
|
-
|
|
98034
|
+
children: [
|
|
98035
|
+
isExternalLocked && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("span", {
|
|
98036
|
+
className: "native-lock-pill",
|
|
98037
|
+
title: externalLock?.reason || tr("外部终端占用锁定,只读监控中", "Locked by external terminal (read-only)"),
|
|
98038
|
+
children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Lock, { size: 12 }), tr(externalLock?.tty ? `终端锁定 · ${externalLock.tty}` : "外部终端锁定", externalLock?.tty ? `Terminal lock · ${externalLock.tty}` : "Terminal locked")]
|
|
98039
|
+
}),
|
|
98040
|
+
subagentPrefs.showHeaderBadge && entry.provider === "claude" && totalSubagentsCount > 0 && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("button", {
|
|
98041
|
+
type: "button",
|
|
98042
|
+
className: "session-info-trigger",
|
|
98043
|
+
onClick: () => setOpenSubagent({
|
|
98044
|
+
entryKey: entry.key,
|
|
98045
|
+
id: subagents.length === 1 ? subagents[0].id : null
|
|
98046
|
+
}),
|
|
98047
|
+
title: tr("查看本会话所有子代理与实际工作流", "View all subagents and inspect workflows"),
|
|
98048
|
+
children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Bot, { size: 14 }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { children: tr(`子代理 · ${totalSubagentsCount}`, `Subagents · ${totalSubagentsCount}`) })]
|
|
98049
|
+
}),
|
|
98050
|
+
onAccounts && !isLocalReadOnly && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("button", {
|
|
98051
|
+
type: "button",
|
|
98052
|
+
className: "session-info-trigger",
|
|
98053
|
+
onClick: onAccounts,
|
|
98054
|
+
children: [
|
|
98055
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(KeyRound, { size: 14 }),
|
|
98056
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { children: tr("账号管理", "Accounts") }),
|
|
98057
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(QuotaInlineBadge, { quota: providerQuota })
|
|
98058
|
+
]
|
|
98059
|
+
})
|
|
98060
|
+
]
|
|
96454
98061
|
})]
|
|
96455
98062
|
}),
|
|
96456
98063
|
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
|
|
@@ -96470,21 +98077,33 @@ function NativeConversation({ entry, onChanged, onAccounts }) {
|
|
|
96470
98077
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(NativeHistoryView, {
|
|
96471
98078
|
host: entry.host,
|
|
96472
98079
|
cwd: entry.cwd,
|
|
98080
|
+
canInspectSubagent: entry.provider === "claude",
|
|
98081
|
+
onInspectSubagent: (item) => setOpenSubagent({
|
|
98082
|
+
entryKey: entry.key,
|
|
98083
|
+
id: item.agentId || item.id
|
|
98084
|
+
}),
|
|
96473
98085
|
value: {
|
|
96474
98086
|
...nativeHistory,
|
|
96475
98087
|
earlier: () => older(nativeHistory.earlier)
|
|
96476
98088
|
}
|
|
96477
98089
|
}),
|
|
96478
|
-
|
|
98090
|
+
visibleSpoolTurns(nativeHistory.history?.messages || [], conversation?.turns || []).map((turn) => /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
|
|
96479
98091
|
className: "native-turn",
|
|
96480
98092
|
children: [
|
|
96481
|
-
/* @__PURE__ */ (0, import_jsx_runtime.
|
|
96482
|
-
className: "native-message user",
|
|
96483
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
96484
|
-
|
|
96485
|
-
|
|
96486
|
-
|
|
96487
|
-
|
|
98093
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
|
|
98094
|
+
className: "native-message-block is-user",
|
|
98095
|
+
children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
|
|
98096
|
+
className: "native-message user",
|
|
98097
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(CollapsibleUserMessage, {
|
|
98098
|
+
value: turn.prompt,
|
|
98099
|
+
remoteHost: entry.host,
|
|
98100
|
+
remoteCwd: entry.cwd,
|
|
98101
|
+
surface: "hover"
|
|
98102
|
+
})
|
|
98103
|
+
}), /* @__PURE__ */ (0, import_jsx_runtime.jsx)(MessageCopyButton, {
|
|
98104
|
+
text: turn.prompt,
|
|
98105
|
+
align: "end"
|
|
98106
|
+
})]
|
|
96488
98107
|
}),
|
|
96489
98108
|
turn.truncated && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", {
|
|
96490
98109
|
className: "native-note",
|
|
@@ -96494,19 +98113,39 @@ function NativeConversation({ entry, onChanged, onAccounts }) {
|
|
|
96494
98113
|
events: turn.events || [],
|
|
96495
98114
|
partial: turn.partial,
|
|
96496
98115
|
host: entry.host,
|
|
96497
|
-
cwd: entry.cwd
|
|
98116
|
+
cwd: entry.cwd,
|
|
98117
|
+
subagents,
|
|
98118
|
+
canInspectSubagent: entry.provider === "claude",
|
|
98119
|
+
onInspectSubagent: (subId) => setOpenSubagent({
|
|
98120
|
+
entryKey: entry.key,
|
|
98121
|
+
id: subId
|
|
98122
|
+
})
|
|
98123
|
+
}),
|
|
98124
|
+
subagentPrefs.showInlineCards && turn.subagents && turn.subagents.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(InlineTaskSubagentGroup, {
|
|
98125
|
+
subagents: turn.subagents,
|
|
98126
|
+
canInspect: entry.provider === "claude",
|
|
98127
|
+
onInspect: (item) => setOpenSubagent({
|
|
98128
|
+
entryKey: entry.key,
|
|
98129
|
+
id: item.agentId || item.id
|
|
98130
|
+
})
|
|
96498
98131
|
}),
|
|
96499
98132
|
turn.status === "stopped" && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", {
|
|
96500
98133
|
className: "native-note",
|
|
96501
98134
|
children: "已停止,保留已产生的消息和操作记录。"
|
|
96502
98135
|
}),
|
|
96503
|
-
turn.text && !turn.events?.some((event) => event.kind === "assistant") && /* @__PURE__ */ (0, import_jsx_runtime.
|
|
96504
|
-
className: "native-message assistant",
|
|
96505
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
96506
|
-
|
|
96507
|
-
|
|
96508
|
-
|
|
96509
|
-
|
|
98136
|
+
turn.text && !turn.events?.some((event) => event.kind === "assistant") && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
|
|
98137
|
+
className: "native-message-block is-assistant",
|
|
98138
|
+
children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
|
|
98139
|
+
className: "native-message assistant",
|
|
98140
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(MarkdownBody, {
|
|
98141
|
+
value: turn.text,
|
|
98142
|
+
remoteHost: entry.host,
|
|
98143
|
+
remoteCwd: entry.cwd
|
|
98144
|
+
})
|
|
98145
|
+
}), /* @__PURE__ */ (0, import_jsx_runtime.jsx)(MessageCopyButton, {
|
|
98146
|
+
text: turn.text,
|
|
98147
|
+
align: "start"
|
|
98148
|
+
})]
|
|
96510
98149
|
}),
|
|
96511
98150
|
turn.error && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
|
|
96512
98151
|
className: "form-error native-error",
|
|
@@ -96543,7 +98182,19 @@ function NativeConversation({ entry, onChanged, onAccounts }) {
|
|
|
96543
98182
|
optionId
|
|
96544
98183
|
})
|
|
96545
98184
|
}, request.id)),
|
|
96546
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(NativeSubagentsPanel, {
|
|
98185
|
+
subagentPrefs.showInlineCards && (workingSubagentsCount > 0 || subagents.length > 0 && !nativeHistory.history?.messages?.some((m) => m.role === "subagent_group")) && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(NativeSubagentsPanel, {
|
|
98186
|
+
subagents: workingSubagentsCount > 0 ? subagents.filter((item) => item.status === "working") : subagents.slice(0, 6),
|
|
98187
|
+
totalCount: totalSubagentsCount,
|
|
98188
|
+
canInspect: entry.provider === "claude",
|
|
98189
|
+
onInspect: (item) => setOpenSubagent({
|
|
98190
|
+
entryKey: entry.key,
|
|
98191
|
+
id: item.agentId || item.id
|
|
98192
|
+
}),
|
|
98193
|
+
onOpenDirectory: () => setOpenSubagent({
|
|
98194
|
+
entryKey: entry.key,
|
|
98195
|
+
id: null
|
|
98196
|
+
})
|
|
98197
|
+
}),
|
|
96547
98198
|
working && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("details", {
|
|
96548
98199
|
className: "native-thinking",
|
|
96549
98200
|
children: [/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("summary", { children: [
|
|
@@ -96571,94 +98222,140 @@ function NativeConversation({ entry, onChanged, onAccounts }) {
|
|
|
96571
98222
|
}),
|
|
96572
98223
|
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
|
|
96573
98224
|
className: "native-compose-wrap",
|
|
96574
|
-
children: [
|
|
96575
|
-
|
|
96576
|
-
|
|
96577
|
-
|
|
96578
|
-
|
|
96579
|
-
|
|
96580
|
-
|
|
96581
|
-
|
|
96582
|
-
|
|
96583
|
-
|
|
96584
|
-
|
|
96585
|
-
|
|
96586
|
-
|
|
96587
|
-
|
|
96588
|
-
|
|
96589
|
-
|
|
96590
|
-
|
|
96591
|
-
|
|
96592
|
-
|
|
96593
|
-
|
|
96594
|
-
|
|
96595
|
-
|
|
96596
|
-
|
|
96597
|
-
|
|
96598
|
-
|
|
96599
|
-
|
|
96600
|
-
|
|
96601
|
-
|
|
96602
|
-
|
|
96603
|
-
|
|
96604
|
-
|
|
96605
|
-
event.preventDefault();
|
|
96606
|
-
send();
|
|
96607
|
-
}
|
|
96608
|
-
}
|
|
96609
|
-
}),
|
|
96610
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("footer", { children: [
|
|
96611
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("span", {
|
|
96612
|
-
className: "native-provider-badge",
|
|
96613
|
-
title: providerName,
|
|
96614
|
-
children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(AgentLogo, { provider: entry.provider }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { children: providerName })]
|
|
96615
|
-
}),
|
|
96616
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(ComposerAttachmentButton, {
|
|
96617
|
-
compact: true,
|
|
96618
|
-
uploading: attach.uploading,
|
|
96619
|
-
disabled: isLocalReadOnly || !entry.cwd || working && !canControl,
|
|
96620
|
-
onClick: attach.openPicker
|
|
96621
|
-
}),
|
|
96622
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(NativePermissionControl, {
|
|
96623
|
-
autoSupported,
|
|
96624
|
-
provider: entry.provider,
|
|
96625
|
-
compact: true,
|
|
96626
|
-
value: permissionMode,
|
|
96627
|
-
onChange: setPermissionMode,
|
|
96628
|
-
disabled: working || isLocalReadOnly
|
|
96629
|
-
}),
|
|
96630
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(NativeModelControl, {
|
|
96631
|
-
onAutoSupportChange: setAutoSupported,
|
|
96632
|
-
effort,
|
|
96633
|
-
onEffortChange: setEffort,
|
|
96634
|
-
compact: true,
|
|
96635
|
-
host: entry.host,
|
|
96636
|
-
provider: entry.provider,
|
|
96637
|
-
value: model,
|
|
96638
|
-
onChange: setModel,
|
|
96639
|
-
disabled: working || isLocalReadOnly
|
|
98225
|
+
children: [
|
|
98226
|
+
isExternalLocked && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
|
|
98227
|
+
className: "native-lock-banner",
|
|
98228
|
+
role: "status",
|
|
98229
|
+
children: [/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
|
|
98230
|
+
className: "native-lock-banner-main",
|
|
98231
|
+
children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Lock, { size: 14 }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { children: tr(`该 ${providerName} 会话当前正由外部终端(${externalLock?.inTmux ? `tmux ${externalLock.tty || ""}` : externalLock?.tty || "非 tmux 终端"}${externalLock?.pid ? ` · PID ${externalLock.pid}` : ""})占用,已只读锁定并每 4 秒自动同步。请先正常退出原终端后再由 SCOPE 接管发送。`, `This ${providerName} session is locked by an external terminal (${externalLock?.inTmux ? `tmux ${externalLock.tty || ""}` : externalLock?.tty || "non-tmux"}${externalLock?.pid ? ` · PID ${externalLock.pid}` : ""}). Read-only live monitoring every 4s — exit the original terminal to take over here.`) })]
|
|
98232
|
+
}), /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("button", {
|
|
98233
|
+
type: "button",
|
|
98234
|
+
className: "native-lock-banner-btn",
|
|
98235
|
+
disabled: nativeHistory.busy,
|
|
98236
|
+
onClick: () => void nativeHistory.refresh(),
|
|
98237
|
+
children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(RefreshCw, {
|
|
98238
|
+
size: 12,
|
|
98239
|
+
className: nativeHistory.busy ? "is-spinning" : ""
|
|
98240
|
+
}), tr("检查解锁", "Check status")]
|
|
98241
|
+
})]
|
|
98242
|
+
}),
|
|
98243
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("form", {
|
|
98244
|
+
ref: composer,
|
|
98245
|
+
className: "native-composer",
|
|
98246
|
+
onDragOver: attach.onDragOver,
|
|
98247
|
+
onDrop: attach.onDrop,
|
|
98248
|
+
onSubmit: (event) => {
|
|
98249
|
+
event.preventDefault();
|
|
98250
|
+
send();
|
|
98251
|
+
},
|
|
98252
|
+
children: [
|
|
98253
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(ComposerAttachmentList, {
|
|
98254
|
+
attachments: attach.attachments,
|
|
98255
|
+
onRemove: attach.remove
|
|
96640
98256
|
}),
|
|
96641
|
-
|
|
96642
|
-
|
|
96643
|
-
|
|
96644
|
-
"aria-label": `停止 ${providerName}`,
|
|
96645
|
-
title: "停止当前 SCOPE 任务",
|
|
96646
|
-
disabled: controlBusy || Boolean(pendingControl),
|
|
96647
|
-
onClick: () => void control("stop"),
|
|
96648
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Square, { size: 14 })
|
|
98257
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(ComposerAttachmentInput, {
|
|
98258
|
+
inputRef: attach.inputRef,
|
|
98259
|
+
onFiles: attach.uploadFiles
|
|
96649
98260
|
}),
|
|
96650
|
-
|
|
96651
|
-
|
|
98261
|
+
slash.panel,
|
|
98262
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("textarea", {
|
|
98263
|
+
...slash.inputProps,
|
|
96652
98264
|
"aria-label": tr("发送消息", "Send message"),
|
|
96653
|
-
|
|
96654
|
-
|
|
96655
|
-
|
|
96656
|
-
|
|
96657
|
-
|
|
96658
|
-
|
|
96659
|
-
|
|
96660
|
-
|
|
96661
|
-
|
|
98265
|
+
placeholder: isLocalReadOnly ? tr("本机历史记录仅支持只读查看", "Local history is read-only") : isExternalLocked ? tr("原外部终端占用中(只读锁定)· 请在原终端继续或退出后接管", "Locked by external terminal (read-only) · Reply in original terminal or exit it to take over") : !entry.cwd ? tr("缺少工作目录,暂无法继续发送", "Working directory is required") : tr("继续对话…(支持拖拽或粘贴附件)", "Continue conversation… (drop or paste files)"),
|
|
98266
|
+
rows: 2,
|
|
98267
|
+
disabled: isComposerReadOnly || !entry.cwd,
|
|
98268
|
+
value: draft,
|
|
98269
|
+
onChange: (event) => setDraft(event.target.value),
|
|
98270
|
+
onPaste: attach.onPaste,
|
|
98271
|
+
onKeyDown: (event) => {
|
|
98272
|
+
if (slash.onKeyDown(event)) return;
|
|
98273
|
+
if (event.key === "Enter" && !event.shiftKey && !event.nativeEvent.isComposing) {
|
|
98274
|
+
event.preventDefault();
|
|
98275
|
+
send();
|
|
98276
|
+
}
|
|
98277
|
+
}
|
|
98278
|
+
}),
|
|
98279
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("footer", { children: [
|
|
98280
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("span", {
|
|
98281
|
+
className: "native-provider-badge",
|
|
98282
|
+
title: providerName,
|
|
98283
|
+
children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(AgentLogo, { provider: entry.provider }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { children: providerName })]
|
|
98284
|
+
}),
|
|
98285
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(ComposerAttachmentButton, {
|
|
98286
|
+
compact: true,
|
|
98287
|
+
uploading: attach.uploading,
|
|
98288
|
+
disabled: isComposerReadOnly || !entry.cwd || working && !canControl,
|
|
98289
|
+
onClick: attach.openPicker
|
|
98290
|
+
}),
|
|
98291
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(NativePermissionControl, {
|
|
98292
|
+
autoSupported,
|
|
98293
|
+
provider: entry.provider,
|
|
98294
|
+
compact: true,
|
|
98295
|
+
value: permissionMode,
|
|
98296
|
+
onChange: setPermissionMode,
|
|
98297
|
+
disabled: working || isComposerReadOnly
|
|
98298
|
+
}),
|
|
98299
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(NativeModelControl, {
|
|
98300
|
+
onAutoSupportChange: setAutoSupported,
|
|
98301
|
+
effort,
|
|
98302
|
+
onEffortChange: setEffort,
|
|
98303
|
+
compact: true,
|
|
98304
|
+
host: entry.host,
|
|
98305
|
+
provider: entry.provider,
|
|
98306
|
+
value: model,
|
|
98307
|
+
onChange: setModel,
|
|
98308
|
+
disabled: working || isComposerReadOnly
|
|
98309
|
+
}),
|
|
98310
|
+
canControl && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("button", {
|
|
98311
|
+
className: "native-stop",
|
|
98312
|
+
type: "button",
|
|
98313
|
+
"aria-label": `停止 ${providerName}`,
|
|
98314
|
+
title: "停止当前 SCOPE 任务",
|
|
98315
|
+
disabled: controlBusy || Boolean(pendingControl),
|
|
98316
|
+
onClick: () => void control("stop"),
|
|
98317
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Square, { size: 14 })
|
|
98318
|
+
}),
|
|
98319
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("button", {
|
|
98320
|
+
type: "submit",
|
|
98321
|
+
"aria-label": tr("发送消息", "Send message"),
|
|
98322
|
+
disabled: working && !canControl || controlBusy || Boolean(pendingControl) || !draft.trim() && attach.attachments.length === 0 || attach.hasUnready || isComposerReadOnly || !entry.cwd,
|
|
98323
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ArrowUp, { size: 16 })
|
|
98324
|
+
})
|
|
98325
|
+
] })
|
|
98326
|
+
]
|
|
98327
|
+
}),
|
|
98328
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", {
|
|
98329
|
+
className: "native-note",
|
|
98330
|
+
children: isLocalReadOnly ? tr("本机历史只读 · 新建 Claude / Antigravity 会话请选择远程设备", "Local history is read-only · Choose a remote host for new Claude / Antigravity sessions") : isExternalLocked ? tr("正在只读监控外部终端会话 · 原终端退出后自动解锁发送", "Watching external terminal session (read-only) · Unlocks automatically after terminal exits") : tr(`${permissionMode === "full" ? "完全访问 · 跳过权限审批 · " : ""}Enter 发送 · Shift + Enter 换行${working && !conversation?.interactive ? " · 回复在本轮结束后显示" : ""}`, `${permissionMode === "full" ? "Full access · Skipping approvals · " : ""}Enter to send · Shift + Enter for newline${working && !conversation?.interactive ? " · Reply displays after turn finishes" : ""}`)
|
|
98331
|
+
})
|
|
98332
|
+
]
|
|
98333
|
+
}),
|
|
98334
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(SubagentWorkflowDrawer, {
|
|
98335
|
+
open: isDrawerOpen,
|
|
98336
|
+
providerLabel: "Claude Code",
|
|
98337
|
+
items: subagentDrawerItems,
|
|
98338
|
+
totalSubagents: totalSubagentsCount,
|
|
98339
|
+
selectedId: activeSubagentId,
|
|
98340
|
+
onSelect: (id) => setOpenSubagent({
|
|
98341
|
+
entryKey: entry.key,
|
|
98342
|
+
id
|
|
98343
|
+
}),
|
|
98344
|
+
onClose: () => setOpenSubagent(null),
|
|
98345
|
+
onRefresh: claudeWorkflow.refresh,
|
|
98346
|
+
loading: claudeWorkflow.loading,
|
|
98347
|
+
error: claudeWorkflow.error,
|
|
98348
|
+
steps: claudeWorkflow.steps,
|
|
98349
|
+
partial: claudeWorkflow.partial,
|
|
98350
|
+
totalSteps: claudeWorkflow.totalSteps,
|
|
98351
|
+
truncated: claudeWorkflow.truncated,
|
|
98352
|
+
host: entry.host,
|
|
98353
|
+
cwd: entry.cwd,
|
|
98354
|
+
activeStatus: claudeWorkflow.status,
|
|
98355
|
+
activeModel: claudeWorkflow.model,
|
|
98356
|
+
activeTypeName: claudeWorkflow.typeName,
|
|
98357
|
+
activeSpawnDepth: claudeWorkflow.spawnDepth,
|
|
98358
|
+
activeRole: claudeWorkflow.role
|
|
96662
98359
|
})
|
|
96663
98360
|
]
|
|
96664
98361
|
});
|
|
@@ -96686,6 +98383,103 @@ var Info = createLucideIcon("info", [
|
|
|
96686
98383
|
}]
|
|
96687
98384
|
]);
|
|
96688
98385
|
//#endregion
|
|
98386
|
+
//#region features/workspace/CodexSubagentsPanel.tsx
|
|
98387
|
+
function codexSubagentLabel(subagent) {
|
|
98388
|
+
return subagent.agentNickname || subagent.agentPath || subagent.id.slice(0, 8);
|
|
98389
|
+
}
|
|
98390
|
+
function codexSubagentStatus(subagent) {
|
|
98391
|
+
return subagent.turnState === "working" ? "working" : "completed";
|
|
98392
|
+
}
|
|
98393
|
+
function toCodexDrawerItems(subagents) {
|
|
98394
|
+
return subagents.map((sub) => ({
|
|
98395
|
+
id: sub.id,
|
|
98396
|
+
label: codexSubagentLabel(sub),
|
|
98397
|
+
role: sub.agentNickname || sub.agentPath || sub.firstUser || sub.id.slice(0, 8),
|
|
98398
|
+
typeName: sub.agentRole || "",
|
|
98399
|
+
model: sub.model || "",
|
|
98400
|
+
status: codexSubagentStatus(sub),
|
|
98401
|
+
lastAction: sub.lastAction || sub.lastAssistant || sub.lastUser || "",
|
|
98402
|
+
taskTitle: sub.firstUser ? sub.firstUser.split(/\r?\n/)[0].slice(0, 80) : "",
|
|
98403
|
+
updatedAt: sub.mtimeMs || null
|
|
98404
|
+
}));
|
|
98405
|
+
}
|
|
98406
|
+
function CodexSubagentRows({ subagents, onInspect }) {
|
|
98407
|
+
const { tr } = useLocale();
|
|
98408
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
|
|
98409
|
+
className: "codex-subagents-list",
|
|
98410
|
+
children: subagents.map((subagent) => {
|
|
98411
|
+
const status = codexSubagentStatus(subagent);
|
|
98412
|
+
const label = codexSubagentLabel(subagent);
|
|
98413
|
+
const summary = subagent.lastAction || subagent.lastAssistant || subagent.lastUser || tr("暂无活动摘要", "No recent activity");
|
|
98414
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("button", {
|
|
98415
|
+
type: "button",
|
|
98416
|
+
className: "codex-subagent-row",
|
|
98417
|
+
onClick: () => onInspect(subagent),
|
|
98418
|
+
title: tr("点击查看子代理实际工作流", "Inspect subagent workflow"),
|
|
98419
|
+
children: [/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
|
|
98420
|
+
className: "codex-subagent-row-main",
|
|
98421
|
+
children: [/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
|
|
98422
|
+
className: "codex-subagent-row-title",
|
|
98423
|
+
children: [
|
|
98424
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: `subagent-dot is-${status}` }),
|
|
98425
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("strong", {
|
|
98426
|
+
title: label,
|
|
98427
|
+
children: label
|
|
98428
|
+
}),
|
|
98429
|
+
subagent.agentRole && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", {
|
|
98430
|
+
className: "codex-subagent-role-pill",
|
|
98431
|
+
children: subagent.agentRole
|
|
98432
|
+
}),
|
|
98433
|
+
subagent.model && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", {
|
|
98434
|
+
className: "codex-subagent-role-pill",
|
|
98435
|
+
children: subagent.model
|
|
98436
|
+
})
|
|
98437
|
+
]
|
|
98438
|
+
}), /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", {
|
|
98439
|
+
className: "codex-subagent-row-sub",
|
|
98440
|
+
title: summary,
|
|
98441
|
+
children: summary
|
|
98442
|
+
})]
|
|
98443
|
+
}), /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ChevronRight, { size: 14 })]
|
|
98444
|
+
}, subagent.id);
|
|
98445
|
+
})
|
|
98446
|
+
});
|
|
98447
|
+
}
|
|
98448
|
+
function CodexSubagentsCard({ subagents, onInspect }) {
|
|
98449
|
+
const { tr } = useLocale();
|
|
98450
|
+
if (!subagents.length) return null;
|
|
98451
|
+
const workingCount = subagents.filter((sub) => codexSubagentStatus(sub) === "working").length;
|
|
98452
|
+
const finishedCount = subagents.length - workingCount;
|
|
98453
|
+
if (workingCount > 0) return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("section", {
|
|
98454
|
+
className: "codex-subagents-card is-working",
|
|
98455
|
+
"aria-label": tr("Codex 子代理状态", "Codex subagents"),
|
|
98456
|
+
children: [/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
|
|
98457
|
+
className: "codex-subagents-head",
|
|
98458
|
+
children: [
|
|
98459
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(LoaderCircle, {
|
|
98460
|
+
size: 13,
|
|
98461
|
+
className: "is-spinning"
|
|
98462
|
+
}),
|
|
98463
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("strong", { children: tr(`Codex 子代理工作中 · ${workingCount} 个运行中`, `Codex subagents working · ${workingCount} active`) }),
|
|
98464
|
+
finishedCount > 0 && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { children: tr(` · ${finishedCount} 个已完成`, ` · ${finishedCount} done`) })
|
|
98465
|
+
]
|
|
98466
|
+
}), /* @__PURE__ */ (0, import_jsx_runtime.jsx)(CodexSubagentRows, {
|
|
98467
|
+
subagents,
|
|
98468
|
+
onInspect
|
|
98469
|
+
})]
|
|
98470
|
+
});
|
|
98471
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("details", {
|
|
98472
|
+
className: "codex-subagents-card",
|
|
98473
|
+
children: [/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("summary", {
|
|
98474
|
+
className: "codex-subagents-head",
|
|
98475
|
+
children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Bot, { size: 13 }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { children: tr(`Codex 子代理记录 · ${subagents.length} 个已完成`, `Codex subagents · ${subagents.length} completed`) })]
|
|
98476
|
+
}), /* @__PURE__ */ (0, import_jsx_runtime.jsx)(CodexSubagentRows, {
|
|
98477
|
+
subagents,
|
|
98478
|
+
onInspect
|
|
98479
|
+
})]
|
|
98480
|
+
});
|
|
98481
|
+
}
|
|
98482
|
+
//#endregion
|
|
96689
98483
|
//#region features/workspace/HumanRequests.tsx
|
|
96690
98484
|
function HumanRequests({ selectedHumanRequests, operatorName, clockNow, planInputDrafts, busyAction, setPlanInputDrafts, respondToHumanRequest, elicitationDrafts, setElicitationDrafts, answerElicitation, answerPlanInput }) {
|
|
96691
98485
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_jsx_runtime.Fragment, { children: selectedHumanRequests.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("section", {
|
|
@@ -97215,6 +99009,182 @@ function SessionComposer({ conversation = false, controls, onCommand, selectedIn
|
|
|
97215
99009
|
})
|
|
97216
99010
|
}, `${selectedInspectorKey}:reply`);
|
|
97217
99011
|
}
|
|
99012
|
+
//#endregion
|
|
99013
|
+
//#region features/workspace/use-codex-subagent-workflow.ts
|
|
99014
|
+
function mapDialogueToSteps(events) {
|
|
99015
|
+
let seenPrompt = false;
|
|
99016
|
+
return events.map((event) => {
|
|
99017
|
+
if (event.kind === "user") {
|
|
99018
|
+
const isFirst = !seenPrompt;
|
|
99019
|
+
seenPrompt = true;
|
|
99020
|
+
return {
|
|
99021
|
+
id: event.id,
|
|
99022
|
+
kind: isFirst ? "prompt" : "assistant",
|
|
99023
|
+
title: isFirst ? "子代理任务" : event.title || "输入",
|
|
99024
|
+
text: event.text,
|
|
99025
|
+
timestamp: event.timestamp
|
|
99026
|
+
};
|
|
99027
|
+
}
|
|
99028
|
+
if (event.kind === "reasoning" || event.kind === "intermediate") return {
|
|
99029
|
+
id: event.id,
|
|
99030
|
+
kind: "thinking",
|
|
99031
|
+
title: event.title || "思考摘要",
|
|
99032
|
+
text: event.text,
|
|
99033
|
+
timestamp: event.timestamp
|
|
99034
|
+
};
|
|
99035
|
+
if (event.kind === "command") return {
|
|
99036
|
+
id: event.id,
|
|
99037
|
+
kind: "command",
|
|
99038
|
+
toolName: event.toolName || "shell",
|
|
99039
|
+
title: event.title || "命令",
|
|
99040
|
+
command: event.command || event.text,
|
|
99041
|
+
summary: (event.command || event.text || "").split(/\r?\n/)[0].slice(0, 90),
|
|
99042
|
+
output: event.output || "",
|
|
99043
|
+
status: event.status || "completed",
|
|
99044
|
+
timestamp: event.timestamp
|
|
99045
|
+
};
|
|
99046
|
+
if (event.kind === "tool") return {
|
|
99047
|
+
id: event.id,
|
|
99048
|
+
kind: "tool",
|
|
99049
|
+
toolName: event.toolName || event.title || "Tool",
|
|
99050
|
+
title: event.title || "工具调用",
|
|
99051
|
+
summary: (event.text || "").split(/\r?\n/)[0].slice(0, 90),
|
|
99052
|
+
inputPreview: event.text || "",
|
|
99053
|
+
output: event.output || "",
|
|
99054
|
+
status: event.status || "completed",
|
|
99055
|
+
timestamp: event.timestamp
|
|
99056
|
+
};
|
|
99057
|
+
if (event.kind === "error") return {
|
|
99058
|
+
id: event.id,
|
|
99059
|
+
kind: "error",
|
|
99060
|
+
title: event.title || "会话错误",
|
|
99061
|
+
text: event.text,
|
|
99062
|
+
timestamp: event.timestamp
|
|
99063
|
+
};
|
|
99064
|
+
if (event.kind === "system") return {
|
|
99065
|
+
id: event.id,
|
|
99066
|
+
kind: "note",
|
|
99067
|
+
title: event.title || "系统事件",
|
|
99068
|
+
text: event.text,
|
|
99069
|
+
timestamp: event.timestamp
|
|
99070
|
+
};
|
|
99071
|
+
return {
|
|
99072
|
+
id: event.id,
|
|
99073
|
+
kind: "assistant",
|
|
99074
|
+
title: event.title || "Codex",
|
|
99075
|
+
text: event.text,
|
|
99076
|
+
timestamp: event.timestamp
|
|
99077
|
+
};
|
|
99078
|
+
});
|
|
99079
|
+
}
|
|
99080
|
+
function useCodexSubagentWorkflow(host, sessionId, subagents, selectedId) {
|
|
99081
|
+
const selected = (0, import_react.useMemo)(() => selectedId ? subagents.find((item) => item.id === selectedId) || null : null, [subagents, selectedId]);
|
|
99082
|
+
const targetKey = host && sessionId && selectedId ? `${host}:${sessionId}:${selectedId}` : "";
|
|
99083
|
+
const [state, setState] = (0, import_react.useState)({
|
|
99084
|
+
targetKey: "",
|
|
99085
|
+
events: [],
|
|
99086
|
+
hasMore: false,
|
|
99087
|
+
nextBefore: null,
|
|
99088
|
+
loading: false,
|
|
99089
|
+
error: "",
|
|
99090
|
+
model: ""
|
|
99091
|
+
});
|
|
99092
|
+
const reqIdRef = (0, import_react.useRef)(0);
|
|
99093
|
+
const load = (0, import_react.useCallback)(async (before, showSpinner = false) => {
|
|
99094
|
+
if (!targetKey || !selectedId) return;
|
|
99095
|
+
const reqId = ++reqIdRef.current;
|
|
99096
|
+
if (showSpinner) setState((prev) => prev.targetKey === targetKey ? {
|
|
99097
|
+
...prev,
|
|
99098
|
+
loading: true,
|
|
99099
|
+
error: ""
|
|
99100
|
+
} : {
|
|
99101
|
+
targetKey,
|
|
99102
|
+
events: [],
|
|
99103
|
+
hasMore: false,
|
|
99104
|
+
nextBefore: null,
|
|
99105
|
+
loading: true,
|
|
99106
|
+
error: "",
|
|
99107
|
+
model: ""
|
|
99108
|
+
});
|
|
99109
|
+
try {
|
|
99110
|
+
const res = await fetch(bridgeUrl("/api/dialogue"), {
|
|
99111
|
+
method: "POST",
|
|
99112
|
+
headers: { "Content-Type": "application/json" },
|
|
99113
|
+
body: JSON.stringify({
|
|
99114
|
+
host,
|
|
99115
|
+
sessionId,
|
|
99116
|
+
subagentId: selectedId,
|
|
99117
|
+
limit: 40,
|
|
99118
|
+
...before != null ? { before } : {}
|
|
99119
|
+
})
|
|
99120
|
+
});
|
|
99121
|
+
const data = await res.json();
|
|
99122
|
+
if (reqId !== reqIdRef.current) return;
|
|
99123
|
+
if (!res.ok || data.error) throw new Error(data.error || `HTTP ${res.status}`);
|
|
99124
|
+
const incoming = Array.isArray(data.events) ? data.events : [];
|
|
99125
|
+
setState((prev) => {
|
|
99126
|
+
return {
|
|
99127
|
+
targetKey,
|
|
99128
|
+
events: before != null && prev.targetKey === targetKey ? [...incoming, ...prev.events.filter((existing) => !incoming.some((item) => item.id === existing.id))] : incoming,
|
|
99129
|
+
hasMore: Boolean(data.hasMore),
|
|
99130
|
+
nextBefore: data.nextBefore ?? null,
|
|
99131
|
+
loading: false,
|
|
99132
|
+
error: "",
|
|
99133
|
+
model: data.subagent?.model || prev.model || ""
|
|
99134
|
+
};
|
|
99135
|
+
});
|
|
99136
|
+
} catch (cause) {
|
|
99137
|
+
if (reqId !== reqIdRef.current) return;
|
|
99138
|
+
setState((prev) => ({
|
|
99139
|
+
targetKey,
|
|
99140
|
+
events: prev.targetKey === targetKey ? prev.events : [],
|
|
99141
|
+
hasMore: prev.targetKey === targetKey ? prev.hasMore : false,
|
|
99142
|
+
nextBefore: prev.targetKey === targetKey ? prev.nextBefore : null,
|
|
99143
|
+
loading: false,
|
|
99144
|
+
error: cause.message || "读取 Codex 子代理工作流失败",
|
|
99145
|
+
model: prev.targetKey === targetKey ? prev.model : ""
|
|
99146
|
+
}));
|
|
99147
|
+
}
|
|
99148
|
+
}, [
|
|
99149
|
+
host,
|
|
99150
|
+
sessionId,
|
|
99151
|
+
selectedId,
|
|
99152
|
+
targetKey
|
|
99153
|
+
]);
|
|
99154
|
+
(0, import_react.useEffect)(() => {
|
|
99155
|
+
if (!targetKey) return;
|
|
99156
|
+
load(null, false);
|
|
99157
|
+
}, [targetKey, load]);
|
|
99158
|
+
const isWorking = selected?.turnState === "working";
|
|
99159
|
+
(0, import_react.useEffect)(() => {
|
|
99160
|
+
if (!targetKey || !isWorking) return;
|
|
99161
|
+
const timer = setInterval(() => {
|
|
99162
|
+
if (!document.hidden) load(null, false);
|
|
99163
|
+
}, 3e3);
|
|
99164
|
+
return () => clearInterval(timer);
|
|
99165
|
+
}, [
|
|
99166
|
+
targetKey,
|
|
99167
|
+
isWorking,
|
|
99168
|
+
load
|
|
99169
|
+
]);
|
|
99170
|
+
return {
|
|
99171
|
+
selected,
|
|
99172
|
+
steps: (0, import_react.useMemo)(() => state.targetKey === targetKey ? mapDialogueToSteps(state.events) : [], [
|
|
99173
|
+
state.targetKey,
|
|
99174
|
+
state.events,
|
|
99175
|
+
targetKey
|
|
99176
|
+
]),
|
|
99177
|
+
loading: state.targetKey === targetKey ? state.loading : Boolean(targetKey),
|
|
99178
|
+
error: state.targetKey === targetKey ? state.error : "",
|
|
99179
|
+
hasMore: state.targetKey === targetKey ? state.hasMore : false,
|
|
99180
|
+
model: (state.targetKey === targetKey ? state.model : "") || selected?.model || "",
|
|
99181
|
+
status: isWorking ? "working" : "completed",
|
|
99182
|
+
refresh: () => void load(null, true),
|
|
99183
|
+
loadMore: () => {
|
|
99184
|
+
if (state.targetKey === targetKey && state.nextBefore != null) load(state.nextBefore, true);
|
|
99185
|
+
}
|
|
99186
|
+
};
|
|
99187
|
+
}
|
|
97218
99188
|
/**
|
|
97219
99189
|
* @license lucide-react v1.25.0 - ISC
|
|
97220
99190
|
*
|
|
@@ -97774,8 +99744,106 @@ function hasConversationReply(pending, latest) {
|
|
|
97774
99744
|
}
|
|
97775
99745
|
//#endregion
|
|
97776
99746
|
//#region features/conversation/ConversationFeed.tsx
|
|
97777
|
-
|
|
99747
|
+
var CODEX_SUBAGENT_TOOLS = new Set([
|
|
99748
|
+
"spawn_agent",
|
|
99749
|
+
"send_message",
|
|
99750
|
+
"send_input",
|
|
99751
|
+
"wait_agent",
|
|
99752
|
+
"close_agent"
|
|
99753
|
+
]);
|
|
99754
|
+
function isCodexSubagentInteraction(event) {
|
|
99755
|
+
return event.category === "subagent" || event.kind === "tool" && CODEX_SUBAGENT_TOOLS.has(event.toolName || "");
|
|
99756
|
+
}
|
|
99757
|
+
function matchCodexSubagent(subagents, hint) {
|
|
99758
|
+
if (!hint || !subagents.length) return null;
|
|
99759
|
+
const norm = hint.trim().toLowerCase();
|
|
99760
|
+
return subagents.find((sub) => {
|
|
99761
|
+
return [
|
|
99762
|
+
sub.id,
|
|
99763
|
+
sub.agentNickname || "",
|
|
99764
|
+
sub.agentPath || "",
|
|
99765
|
+
(sub.agentPath || "").split("/").pop() || ""
|
|
99766
|
+
].some((c) => c && (c.toLowerCase() === norm || c.toLowerCase().includes(norm)));
|
|
99767
|
+
}) || null;
|
|
99768
|
+
}
|
|
99769
|
+
function CodexSubagentInteractionCard({ event, subagents, host, cwd, defaultOpen = false, onInspectSubagent }) {
|
|
99770
|
+
const { tr } = useLocale();
|
|
99771
|
+
const tool = event.toolName || "";
|
|
99772
|
+
const isOutbound = tool === "spawn_agent" || tool === "send_message" || tool === "send_input";
|
|
99773
|
+
let targetHint = event.agentPath || "";
|
|
99774
|
+
let bodyText = event.text || event.output || "";
|
|
99775
|
+
let encryptedNote = false;
|
|
99776
|
+
if (tool && event.text) try {
|
|
99777
|
+
const parsed = JSON.parse(event.text);
|
|
99778
|
+
targetHint = String(parsed.target || parsed.task_name || parsed.agent_path || parsed.nickname || parsed.id || targetHint);
|
|
99779
|
+
const msg = parsed.message || parsed.input || parsed.prompt;
|
|
99780
|
+
if (typeof msg === "string" && msg.trim()) if (msg.startsWith("gAAAAAB") && msg.length > 60) {
|
|
99781
|
+
encryptedNote = true;
|
|
99782
|
+
bodyText = event.output || "";
|
|
99783
|
+
} else bodyText = msg;
|
|
99784
|
+
} catch {}
|
|
99785
|
+
const matched = matchCodexSubagent(subagents, targetHint);
|
|
99786
|
+
const peerLabel = matched?.agentNickname || targetHint || event.title || tr("子代理", "Subagent");
|
|
99787
|
+
const badgeLabel = tool === "spawn_agent" ? tr("主会话 → 新建子代理", "Main → Spawn") : isOutbound ? tr("主会话 → 子代理", "Main → Subagent") : tool === "wait_agent" ? tr("等待子代理返回", "Wait subagent") : tr("子代理回传 → 主会话", "Subagent → Main");
|
|
99788
|
+
const preview = encryptedNote ? tr("已加密协作载荷 · 点击右侧“查看工作流”在子代理会话阅读完整明文", "Encrypted handoff payload · Click Workflow to read plaintext inside subagent") : (bodyText || event.output || "").split(/\r?\n/).find((ln) => ln.trim()) || "";
|
|
99789
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("details", {
|
|
99790
|
+
className: `agent-interaction-card ${isOutbound ? "is-outbound" : "is-inbound"}`,
|
|
99791
|
+
open: defaultOpen,
|
|
99792
|
+
children: [/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("summary", { children: [/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("span", {
|
|
99793
|
+
className: "agent-interaction-left",
|
|
99794
|
+
children: [
|
|
99795
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("span", {
|
|
99796
|
+
className: "agent-interaction-badge",
|
|
99797
|
+
children: [isOutbound ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ArrowUpRight, { size: 11 }) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ArrowDownLeft, { size: 11 }), badgeLabel]
|
|
99798
|
+
}),
|
|
99799
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", {
|
|
99800
|
+
className: "agent-interaction-peer",
|
|
99801
|
+
title: peerLabel,
|
|
99802
|
+
children: peerLabel
|
|
99803
|
+
}),
|
|
99804
|
+
preview && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", {
|
|
99805
|
+
className: "agent-interaction-preview",
|
|
99806
|
+
title: preview,
|
|
99807
|
+
children: preview
|
|
99808
|
+
})
|
|
99809
|
+
]
|
|
99810
|
+
}), /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("span", {
|
|
99811
|
+
className: "agent-interaction-right",
|
|
99812
|
+
children: [matched && onInspectSubagent && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("button", {
|
|
99813
|
+
type: "button",
|
|
99814
|
+
className: "agent-interaction-jump",
|
|
99815
|
+
onClick: (e) => {
|
|
99816
|
+
e.preventDefault();
|
|
99817
|
+
e.stopPropagation();
|
|
99818
|
+
onInspectSubagent(matched.id);
|
|
99819
|
+
},
|
|
99820
|
+
children: [tr("查看工作流", "Workflow"), /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ChevronRight, { size: 11 })]
|
|
99821
|
+
}), /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ChevronRight, { size: 13 })]
|
|
99822
|
+
})] }), (bodyText || event.output || encryptedNote) && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
|
|
99823
|
+
className: "agent-interaction-body",
|
|
99824
|
+
children: [
|
|
99825
|
+
encryptedNote && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", {
|
|
99826
|
+
className: "native-note",
|
|
99827
|
+
style: { marginTop: 0 },
|
|
99828
|
+
children: tr("Codex 在父会话中加密存储了该条协作消息载荷;点击上方“查看工作流”可直接查看子代理侧的明文指令与执行过程。", "Codex encrypted this handoff payload in the parent rollout; click Workflow above to read the plaintext prompt and steps inside the subagent.")
|
|
99829
|
+
}),
|
|
99830
|
+
bodyText && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(MarkdownBody, {
|
|
99831
|
+
value: bodyText,
|
|
99832
|
+
remoteHost: host,
|
|
99833
|
+
remoteCwd: cwd
|
|
99834
|
+
}),
|
|
99835
|
+
event.output && event.output !== bodyText && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("pre", {
|
|
99836
|
+
className: "subagent-step-pre",
|
|
99837
|
+
style: { marginTop: 8 },
|
|
99838
|
+
children: event.output
|
|
99839
|
+
})
|
|
99840
|
+
]
|
|
99841
|
+
})]
|
|
99842
|
+
});
|
|
99843
|
+
}
|
|
99844
|
+
function ConversationFeed({ events, host, cwd, loading, error, working, hasMore, loadingMore, onOlder, onRetry, subagents = [], onInspectSubagent, children, sentAt }) {
|
|
97778
99845
|
const scroll = (0, import_react.useRef)(null);
|
|
99846
|
+
const { prefs: subagentPrefs } = useSubagentDisplayPrefs();
|
|
97779
99847
|
const content = (0, import_react.useRef)(null);
|
|
97780
99848
|
const follow = (0, import_react.useRef)(true);
|
|
97781
99849
|
const anchor = (0, import_react.useRef)(null);
|
|
@@ -97857,16 +99925,39 @@ function ConversationFeed({ events, host, cwd, loading, error, working, hasMore,
|
|
|
97857
99925
|
className: "conversation-intro",
|
|
97858
99926
|
children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)("h2", { children: "从这里继续。" }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { children: "发送一条消息,开始这个项目的工作。" })]
|
|
97859
99927
|
}),
|
|
97860
|
-
entries.map((entry, index) =>
|
|
97861
|
-
|
|
97862
|
-
|
|
97863
|
-
|
|
97864
|
-
|
|
97865
|
-
|
|
97866
|
-
|
|
97867
|
-
|
|
97868
|
-
|
|
97869
|
-
|
|
99928
|
+
entries.map((entry, index) => {
|
|
99929
|
+
if (entry.type === "message") return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Message, {
|
|
99930
|
+
event: entry.event,
|
|
99931
|
+
host,
|
|
99932
|
+
cwd
|
|
99933
|
+
}, entry.id);
|
|
99934
|
+
const segments = [];
|
|
99935
|
+
for (const ev of entry.events) if (isCodexSubagentInteraction(ev)) segments.push({
|
|
99936
|
+
kind: "interaction",
|
|
99937
|
+
event: ev
|
|
99938
|
+
});
|
|
99939
|
+
else {
|
|
99940
|
+
const prev = segments.at(-1);
|
|
99941
|
+
if (prev?.kind === "activity") prev.events.push(ev);
|
|
99942
|
+
else segments.push({
|
|
99943
|
+
kind: "activity",
|
|
99944
|
+
events: [ev]
|
|
99945
|
+
});
|
|
99946
|
+
}
|
|
99947
|
+
return segments.map((seg, segIdx) => seg.kind === "interaction" ? subagentPrefs.showInteractions ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(CodexSubagentInteractionCard, {
|
|
99948
|
+
event: seg.event,
|
|
99949
|
+
subagents,
|
|
99950
|
+
host,
|
|
99951
|
+
cwd,
|
|
99952
|
+
defaultOpen: subagentPrefs.autoExpandInteractions,
|
|
99953
|
+
onInspectSubagent
|
|
99954
|
+
}, `${seg.event.id}:${subagentPrefs.autoExpandInteractions ? "1" : "0"}`) : null : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ActivityDisclosure, {
|
|
99955
|
+
events: seg.events,
|
|
99956
|
+
active: working && index === entries.length - 1 && segIdx === segments.length - 1,
|
|
99957
|
+
host,
|
|
99958
|
+
cwd
|
|
99959
|
+
}, `${entry.id}:${segIdx}`));
|
|
99960
|
+
}),
|
|
97870
99961
|
error && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
|
|
97871
99962
|
className: "conversation-error",
|
|
97872
99963
|
role: "alert",
|
|
@@ -97894,8 +99985,6 @@ function ConversationFeed({ events, host, cwd, loading, error, working, hasMore,
|
|
|
97894
99985
|
});
|
|
97895
99986
|
}
|
|
97896
99987
|
function Message({ event, host, cwd }) {
|
|
97897
|
-
const [copied, setCopied] = (0, import_react.useState)(false);
|
|
97898
|
-
const [copyError, setCopyError] = (0, import_react.useState)(false);
|
|
97899
99988
|
const progress = event.kind === "assistant" && event.phase === "commentary";
|
|
97900
99989
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("article", {
|
|
97901
99990
|
className: `conversation-message message-${event.kind}${progress ? " message-progress" : ""}`,
|
|
@@ -97906,41 +99995,40 @@ function Message({ event, host, cwd }) {
|
|
|
97906
99995
|
}),
|
|
97907
99996
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
|
|
97908
99997
|
className: "conversation-message-body",
|
|
97909
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
99998
|
+
children: event.kind === "user" ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(CollapsibleUserMessage, {
|
|
99999
|
+
value: event.text,
|
|
100000
|
+
remoteHost: host,
|
|
100001
|
+
remoteCwd: cwd,
|
|
100002
|
+
surface: "panel-2"
|
|
100003
|
+
}) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(MarkdownBody, {
|
|
97910
100004
|
value: event.text,
|
|
97911
100005
|
remoteHost: host,
|
|
97912
100006
|
remoteCwd: cwd
|
|
97913
100007
|
})
|
|
97914
100008
|
}),
|
|
97915
|
-
!progress && /* @__PURE__ */ (0, import_jsx_runtime.
|
|
97916
|
-
|
|
97917
|
-
|
|
97918
|
-
|
|
97919
|
-
title: event.timestamp || "复制消息",
|
|
97920
|
-
onClick: async () => {
|
|
97921
|
-
try {
|
|
97922
|
-
await navigator.clipboard.writeText(event.text);
|
|
97923
|
-
setCopied(true);
|
|
97924
|
-
setCopyError(false);
|
|
97925
|
-
} catch {
|
|
97926
|
-
setCopyError(true);
|
|
97927
|
-
}
|
|
97928
|
-
},
|
|
97929
|
-
children: [copied ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Check, { size: 14 }) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Copy, { size: 14 }), copied && "已复制"]
|
|
97930
|
-
}), copyError && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("small", {
|
|
97931
|
-
role: "status",
|
|
97932
|
-
children: "复制失败,请选中文本复制"
|
|
97933
|
-
})]
|
|
100009
|
+
!progress && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(MessageCopyButton, {
|
|
100010
|
+
text: event.text,
|
|
100011
|
+
title: event.timestamp || void 0,
|
|
100012
|
+
align: event.kind === "user" ? "end" : "start"
|
|
97934
100013
|
})
|
|
97935
100014
|
]
|
|
97936
100015
|
});
|
|
97937
100016
|
}
|
|
97938
100017
|
//#endregion
|
|
97939
100018
|
//#region features/conversation/SessionConversation.tsx
|
|
97940
|
-
function SessionConversation({ workspace, onTools }) {
|
|
100019
|
+
function SessionConversation({ workspace, onTools, openSubagent, onOpenSubagent }) {
|
|
97941
100020
|
const { tr } = useLocale();
|
|
100021
|
+
const { prefs: subagentPrefs } = useSubagentDisplayPrefs();
|
|
97942
100022
|
const [stopping, setStopping] = (0, import_react.useState)(false);
|
|
100023
|
+
const [localSubagent, setLocalSubagent] = (0, import_react.useState)(null);
|
|
97943
100024
|
const { selectedAgent: agent, selectedDialogue: dialogue, selectedAppServerSession: session, selectedProject: project } = workspace;
|
|
100025
|
+
const subagents = (0, import_react.useMemo)(() => agent?.subagents || [], [agent?.subagents]);
|
|
100026
|
+
const drawerState = openSubagent !== void 0 ? openSubagent : localSubagent;
|
|
100027
|
+
const isDrawerOpen = Boolean(drawerState?.open);
|
|
100028
|
+
const activeSubagentId = isDrawerOpen ? drawerState?.id ?? null : null;
|
|
100029
|
+
const setDrawerState = onOpenSubagent || setLocalSubagent;
|
|
100030
|
+
const codexWorkflow = useCodexSubagentWorkflow(agent?.host || "", agent?.rollout?.id || "", subagents, activeSubagentId);
|
|
100031
|
+
const codexDrawerItems = (0, import_react.useMemo)(() => toCodexDrawerItems(subagents), [subagents]);
|
|
97944
100032
|
const working = agent?.status === "working" || session?.status === "working" || Boolean(agent && workspace.pendingInstruction?.key === managementKey(agent));
|
|
97945
100033
|
async function stop() {
|
|
97946
100034
|
if (!agent?.rollout || stopping) return;
|
|
@@ -98009,32 +100097,45 @@ function SessionConversation({ workspace, onTools }) {
|
|
|
98009
100097
|
]
|
|
98010
100098
|
})] }), /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
|
|
98011
100099
|
className: "conversation-header-actions",
|
|
98012
|
-
children: [
|
|
98013
|
-
|
|
98014
|
-
|
|
98015
|
-
|
|
98016
|
-
|
|
100100
|
+
children: [
|
|
100101
|
+
agent.rollout && !agent.historical && (() => {
|
|
100102
|
+
const key = managementKey(agent);
|
|
100103
|
+
const reserved = Boolean(workspace.snapshot.management.sessions[key]?.reserved);
|
|
100104
|
+
const reserveBusy = workspace.busyAction === `reserve:${key}`;
|
|
100105
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("button", {
|
|
100106
|
+
type: "button",
|
|
100107
|
+
className: `session-reserve-trigger ${reserved ? "active" : ""}`,
|
|
100108
|
+
disabled: reserveBusy,
|
|
100109
|
+
"aria-pressed": reserved,
|
|
100110
|
+
onClick: () => void workspace.toggleSessionReserved(agent),
|
|
100111
|
+
title: tr("设为保留后不会因超出设备常驻池而被自动释放(适合带 Timer 或长期等待的会话)", "Reserved sessions stay pinned when the host resident pool overflows"),
|
|
100112
|
+
children: [reserveBusy ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(LoaderCircle, {
|
|
100113
|
+
size: 13,
|
|
100114
|
+
className: "is-spinning"
|
|
100115
|
+
}) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Pin, { size: 13 }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { children: reserved ? tr("常驻保留", "Reserved") : tr("设为保留", "Pin") })]
|
|
100116
|
+
});
|
|
100117
|
+
})(),
|
|
100118
|
+
subagentPrefs.showHeaderBadge && subagents.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("button", {
|
|
98017
100119
|
type: "button",
|
|
98018
|
-
className:
|
|
98019
|
-
|
|
98020
|
-
|
|
98021
|
-
|
|
98022
|
-
|
|
98023
|
-
|
|
98024
|
-
|
|
98025
|
-
|
|
98026
|
-
|
|
98027
|
-
|
|
98028
|
-
|
|
98029
|
-
|
|
98030
|
-
|
|
98031
|
-
|
|
98032
|
-
|
|
98033
|
-
|
|
98034
|
-
})]
|
|
100120
|
+
className: "session-info-trigger",
|
|
100121
|
+
onClick: () => setDrawerState({
|
|
100122
|
+
open: true,
|
|
100123
|
+
id: subagents.length === 1 ? subagents[0].id : null
|
|
100124
|
+
}),
|
|
100125
|
+
title: tr("查看本会话所有 Codex 子代理与工作流", "View all Codex subagents and workflows"),
|
|
100126
|
+
children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Bot, { size: 14 }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { children: tr(`子代理 · ${subagents.length}`, `Subagents · ${subagents.length}`) })]
|
|
100127
|
+
}),
|
|
100128
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("button", {
|
|
100129
|
+
type: "button",
|
|
100130
|
+
className: "session-info-trigger",
|
|
100131
|
+
onClick: onTools,
|
|
100132
|
+
"aria-label": tr("会话信息", "Session info"),
|
|
100133
|
+
children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Info, { size: 14 }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { children: tr("会话信息", "Session info") })]
|
|
100134
|
+
})
|
|
100135
|
+
]
|
|
98035
100136
|
})]
|
|
98036
100137
|
}),
|
|
98037
|
-
/* @__PURE__ */ (0, import_jsx_runtime.
|
|
100138
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(ConversationFeed, {
|
|
98038
100139
|
sentAt: workspace.pendingInstruction?.key === managementKey(agent) ? workspace.pendingInstruction.sentAt : void 0,
|
|
98039
100140
|
events: dialogue?.events || [],
|
|
98040
100141
|
host: agent.host,
|
|
@@ -98046,7 +100147,18 @@ function SessionConversation({ workspace, onTools }) {
|
|
|
98046
100147
|
loadingMore: workspace.dialogueLoadingMore,
|
|
98047
100148
|
onOlder: workspace.loadOlderDialogue,
|
|
98048
100149
|
onRetry: () => workspace.setDialogueRefresh((value) => value + 1),
|
|
98049
|
-
|
|
100150
|
+
subagents,
|
|
100151
|
+
onInspectSubagent: (id) => setDrawerState({
|
|
100152
|
+
open: true,
|
|
100153
|
+
id
|
|
100154
|
+
}),
|
|
100155
|
+
children: [subagentPrefs.showInlineCards && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(CodexSubagentsCard, {
|
|
100156
|
+
subagents,
|
|
100157
|
+
onInspect: (sub) => setDrawerState({
|
|
100158
|
+
open: true,
|
|
100159
|
+
id: sub.id
|
|
100160
|
+
})
|
|
100161
|
+
}), /* @__PURE__ */ (0, import_jsx_runtime.jsx)(HumanRequests, { ...workspace })]
|
|
98050
100162
|
}, managementKey(agent)),
|
|
98051
100163
|
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
|
|
98052
100164
|
className: "conversation-bottom",
|
|
@@ -98071,6 +100183,30 @@ function SessionConversation({ workspace, onTools }) {
|
|
|
98071
100183
|
children: session ? tr("Enter 发送 · Shift + Enter 换行", "Enter to send · Shift + Enter for newline") : agent.pane ? tr("消息发送到当前终端 · Enter 发送", "Send to active terminal · Enter to send") : workspace.selectedAgentIsExternalTerminal ? tr("正在监控原终端会话 · 请在原终端输入", "Watching external terminal · Reply in original terminal") : tr("恢复会话后即可继续对话", "Resume session to continue chatting")
|
|
98072
100184
|
})
|
|
98073
100185
|
]
|
|
100186
|
+
}),
|
|
100187
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(SubagentWorkflowDrawer, {
|
|
100188
|
+
open: isDrawerOpen,
|
|
100189
|
+
providerLabel: "Codex",
|
|
100190
|
+
items: codexDrawerItems,
|
|
100191
|
+
totalSubagents: codexDrawerItems.length,
|
|
100192
|
+
selectedId: activeSubagentId,
|
|
100193
|
+
onSelect: (id) => setDrawerState({
|
|
100194
|
+
open: true,
|
|
100195
|
+
id
|
|
100196
|
+
}),
|
|
100197
|
+
onClose: () => setDrawerState(null),
|
|
100198
|
+
onRefresh: codexWorkflow.refresh,
|
|
100199
|
+
onLoadMore: codexWorkflow.loadMore,
|
|
100200
|
+
loading: codexWorkflow.loading,
|
|
100201
|
+
error: codexWorkflow.error,
|
|
100202
|
+
steps: codexWorkflow.steps,
|
|
100203
|
+
hasMore: codexWorkflow.hasMore,
|
|
100204
|
+
host: agent.host,
|
|
100205
|
+
cwd: agent.cwd,
|
|
100206
|
+
activeStatus: codexWorkflow.status,
|
|
100207
|
+
activeModel: codexWorkflow.model,
|
|
100208
|
+
activeTypeName: codexWorkflow.selected?.agentRole || "",
|
|
100209
|
+
activeRole: codexWorkflow.selected?.agentNickname || codexWorkflow.selected?.agentPath || ""
|
|
98074
100210
|
})
|
|
98075
100211
|
]
|
|
98076
100212
|
});
|
|
@@ -98101,7 +100237,7 @@ var Minimize2 = createLucideIcon("minimize-2", [
|
|
|
98101
100237
|
]);
|
|
98102
100238
|
//#endregion
|
|
98103
100239
|
//#region features/conversation/WorkspaceTools.tsx
|
|
98104
|
-
function WorkspaceTools({ workspace, onClose }) {
|
|
100240
|
+
function WorkspaceTools({ workspace, onClose, onInspectSubagent }) {
|
|
98105
100241
|
const { tr } = useLocale();
|
|
98106
100242
|
const dialog = (0, import_react.useRef)(null);
|
|
98107
100243
|
(0, import_react.useEffect)(() => {
|
|
@@ -98305,10 +100441,16 @@ function WorkspaceTools({ workspace, onClose }) {
|
|
|
98305
100441
|
})]
|
|
98306
100442
|
}, ep.id))
|
|
98307
100443
|
}),
|
|
98308
|
-
subagents.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", {
|
|
100444
|
+
subagents.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", {
|
|
98309
100445
|
className: "session-drawer-note",
|
|
98310
|
-
children: tr(`当前挂载 ${subagents.length}
|
|
98311
|
-
})
|
|
100446
|
+
children: tr(`当前挂载 ${subagents.length} 个子代理(点击查看工作流)`, `${subagents.length} subagent(s) recorded (click to inspect)`)
|
|
100447
|
+
}), /* @__PURE__ */ (0, import_jsx_runtime.jsx)(CodexSubagentRows, {
|
|
100448
|
+
subagents,
|
|
100449
|
+
onInspect: (sub) => {
|
|
100450
|
+
onClose();
|
|
100451
|
+
onInspectSubagent?.(sub.id);
|
|
100452
|
+
}
|
|
100453
|
+
})] })
|
|
98312
100454
|
]
|
|
98313
100455
|
})
|
|
98314
100456
|
] })
|
|
@@ -98704,19 +100846,6 @@ function SubmissionDialog({ submissionTrackerOpen, setSubmissionTrackerOpen, sub
|
|
|
98704
100846
|
* This source code is licensed under the ISC license.
|
|
98705
100847
|
* See the LICENSE file in the root directory of this source tree.
|
|
98706
100848
|
*/
|
|
98707
|
-
var ArrowLeft = createLucideIcon("arrow-left", [["path", {
|
|
98708
|
-
d: "m12 19-7-7 7-7",
|
|
98709
|
-
key: "1l729n"
|
|
98710
|
-
}], ["path", {
|
|
98711
|
-
d: "M19 12H5",
|
|
98712
|
-
key: "x3x0zl"
|
|
98713
|
-
}]]);
|
|
98714
|
-
/**
|
|
98715
|
-
* @license lucide-react v1.25.0 - ISC
|
|
98716
|
-
*
|
|
98717
|
-
* This source code is licensed under the ISC license.
|
|
98718
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
98719
|
-
*/
|
|
98720
100849
|
var CircleDot = createLucideIcon("circle-dot", [["circle", {
|
|
98721
100850
|
cx: "12",
|
|
98722
100851
|
cy: "12",
|
|
@@ -102353,6 +104482,7 @@ function HomeShell() {
|
|
|
102353
104482
|
const [section, setSection] = (0, import_react.useState)("manager");
|
|
102354
104483
|
const [settingsTab, setSettingsTab] = (0, import_react.useState)("general");
|
|
102355
104484
|
const [toolsOpen, setToolsOpen] = (0, import_react.useState)(false);
|
|
104485
|
+
const [openCodexSubagent, setOpenCodexSubagent] = (0, import_react.useState)(null);
|
|
102356
104486
|
const [projectHost, setProjectHost] = (0, import_react.useState)("all");
|
|
102357
104487
|
const rememberedSessions = (0, import_react.useRef)({});
|
|
102358
104488
|
const location = useConversationLocation({
|
|
@@ -102493,13 +104623,28 @@ function HomeShell() {
|
|
|
102493
104623
|
}
|
|
102494
104624
|
}, catalog.selected.key) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(SessionConversation, {
|
|
102495
104625
|
workspace: navigationWorkspace,
|
|
102496
|
-
onTools: () => setToolsOpen(true)
|
|
104626
|
+
onTools: () => setToolsOpen(true),
|
|
104627
|
+
openSubagent: openCodexSubagent?.agentId === (workspace.selectedAgentId || "") ? {
|
|
104628
|
+
open: true,
|
|
104629
|
+
id: openCodexSubagent.id
|
|
104630
|
+
} : {
|
|
104631
|
+
open: false,
|
|
104632
|
+
id: null
|
|
104633
|
+
},
|
|
104634
|
+
onOpenSubagent: (next) => setOpenCodexSubagent(next?.open ? {
|
|
104635
|
+
agentId: workspace.selectedAgentId || "",
|
|
104636
|
+
id: next.id
|
|
104637
|
+
} : null)
|
|
102497
104638
|
}, workspace.selectedAgentId || "empty")
|
|
102498
104639
|
]
|
|
102499
104640
|
}),
|
|
102500
104641
|
toolsOpen && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(WorkspaceTools, {
|
|
102501
104642
|
workspace,
|
|
102502
|
-
onClose: () => setToolsOpen(false)
|
|
104643
|
+
onClose: () => setToolsOpen(false),
|
|
104644
|
+
onInspectSubagent: (id) => setOpenCodexSubagent({
|
|
104645
|
+
agentId: workspace.selectedAgentId || "",
|
|
104646
|
+
id
|
|
104647
|
+
})
|
|
102503
104648
|
}),
|
|
102504
104649
|
sshTerminalTarget && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(SshTerminalPanel, {
|
|
102505
104650
|
target: sshTerminalTarget,
|