@mcp-b/react-components 0.58.0 → 0.59.0
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/dist/{EmployeeChrome-DsdIek0l.d.ts → EmployeeChrome-QSki0QT4.d.ts} +4 -4
- package/dist/{ResponsiveSidebarShell-DoZlSP30.d.ts → ResponsiveSidebarShell-DzBGlRJF.d.ts} +23 -8
- package/dist/{ThinkChatActivity-BkGjTY4r.d.ts → ThinkChatActivity-C4_hPEmb.d.ts} +20 -4
- package/dist/{ThinkChatActivitySummary-DZVy3uQV.d.ts → ThinkChatActivitySummary-ChJ8Iu2T.d.ts} +3 -3
- package/dist/{ThinkChatToolParts-BucHi63O.d.ts → ThinkChatToolParts-BrntWlpa.d.ts} +29 -3
- package/dist/{WorkspaceConceptPanel-97ZyVpZI.js → WorkspaceConceptPanel-D21iRsWm.js} +7 -4
- package/dist/{WorkspaceFileView-M2jC2P4p.js → WorkspaceFileView-CsWwQA1U.js} +80 -74
- package/dist/app-bar-outlet-CNfNzY4Y.js +6 -0
- package/dist/components/agents-sdk/AgentEvent.js +2 -2
- package/dist/components/agents-sdk/BrowserLiveScreen.js +49 -11
- package/dist/components/agents-sdk/EmployeeApp.d.ts +2 -3
- package/dist/components/agents-sdk/EmployeeApp.js +4 -4
- package/dist/components/agents-sdk/EmployeeChat.js +1 -1
- package/dist/components/agents-sdk/EmployeeChrome.d.ts +1 -1
- package/dist/components/agents-sdk/EmployeeChrome.js +213 -201
- package/dist/components/agents-sdk/EmployeeSchedules.d.ts +1 -1
- package/dist/components/agents-sdk/EmployeeSchedules.js +6 -6
- package/dist/components/agents-sdk/EmployeeStartScreen.d.ts +1 -1
- package/dist/components/agents-sdk/ManagerOfficeScreens.d.ts +1 -1
- package/dist/components/agents-sdk/ManagerOfficeScreens.js +5 -18
- package/dist/components/agents-sdk/ModelSelector.js +1 -1
- package/dist/components/agents-sdk/SubagentRunPanel.d.ts +8 -9
- package/dist/components/agents-sdk/SubagentRunPanel.js +133 -122
- package/dist/components/agents-sdk/ThinkChat.d.ts +1 -1
- package/dist/components/agents-sdk/ThinkChat.js +26 -3
- package/dist/components/agents-sdk/ThinkChatActivity.d.ts +1 -1
- package/dist/components/agents-sdk/ThinkChatActivity.js +110 -110
- package/dist/components/agents-sdk/ThinkChatActivitySummary.d.ts +1 -1
- package/dist/components/agents-sdk/ThinkChatActivitySummary.js +183 -40
- package/dist/components/agents-sdk/ThinkChatToolPanels.d.ts +8 -4
- package/dist/components/agents-sdk/ThinkChatToolPanels.js +308 -62
- package/dist/components/agents-sdk/ThinkChatToolParts.d.ts +2 -2
- package/dist/components/agents-sdk/ThinkChatToolParts.js +71 -1
- package/dist/components/agents-sdk/ThinkExecutionWorkbench.d.ts +3 -4
- package/dist/components/agents-sdk/ThinkExecutionWorkbench.js +5 -5
- package/dist/components/agents-sdk/ThinkFullApp.d.ts +1 -1
- package/dist/components/agents-sdk/ThinkFullApp.js +6 -1
- package/dist/components/agents-sdk/ThinkRoutineActions.js +14 -22
- package/dist/components/agents-sdk/ThinkThreadPicker.js +1 -1
- package/dist/components/agents-sdk/WorkspaceExecution.js +138 -131
- package/dist/components/agents-sdk/WorkspaceExplorer.js +3 -3
- package/dist/components/agents-sdk/WorkspaceFileView.js +1 -1
- package/dist/components/agents-sdk/WorkspaceHeader.js +26 -28
- package/dist/components/agents-sdk/WorkspaceProject.js +1 -1
- package/dist/components/agents-sdk/WorkspaceUserScript.js +1 -1
- package/dist/components/ai-sdk/Activity.d.ts +1 -1
- package/dist/components/ai-sdk/Activity.js +84 -6
- package/dist/components/ai-sdk/AgentChatMessageEditor.js +1 -1
- package/dist/components/ai-sdk/Approval.js +2 -1
- package/dist/components/ai-sdk/ComposerLink.js +1 -1
- package/dist/components/ai-sdk/ConnectedAppCards.js +63 -45
- package/dist/components/ai-sdk/Conversation.js +1 -1
- package/dist/components/ai-sdk/ExpansionState.d.ts +16 -6
- package/dist/components/ai-sdk/ExpansionState.js +25 -7
- package/dist/components/ai-sdk/MediaPreviewCard.js +1 -1
- package/dist/components/ai-sdk/MessageScrollerVirtual.js +98 -11
- package/dist/components/ai-sdk/PromptInput.js +7 -3
- package/dist/components/ai-sdk/PromptInputComposerEditor.js +2 -2
- package/dist/components/ai-sdk/Queue.js +1 -1
- package/dist/components/ai-sdk/ToolInvocation.d.ts +8 -0
- package/dist/components/ai-sdk/ToolInvocation.js +45 -19
- package/dist/components/foundations/ToggleGroup.js +1 -1
- package/dist/components/general-purpose/ResponsiveSidebarShell.d.ts +2 -2
- package/dist/components/general-purpose/ResponsiveSidebarShell.js +162 -87
- package/dist/components/general-purpose/Terminal.js +1 -1
- package/dist/components/general-purpose/WebPreview.js +1 -1
- package/dist/components/nanites/AgentToolDetail.d.ts +1 -3
- package/dist/components/nanites/AgentToolDetail.js +30 -39
- package/dist/merge-refs-DAh6reu8.js +26 -0
- package/dist/styles/activity.css +74 -0
- package/dist/styles/agent-chat.css +7 -0
- package/dist/styles/agent-tool-detail.css +2 -17
- package/dist/styles/app-top-bar.css +6 -7
- package/dist/styles/base.css +1 -1
- package/dist/styles/employee-chrome.css +0 -7
- package/dist/styles/message-scroller.css +8 -0
- package/dist/styles/message.css +1 -1
- package/dist/styles/responsive-sidebar-shell.css +10 -25
- package/dist/styles/scroll-area.css +16 -0
- package/dist/styles/scrollbars.css +55 -41
- package/dist/styles/search-field.css +0 -1
- package/dist/styles/subagent-run.css +36 -196
- package/dist/styles/think-chat-tool-panels.css +38 -5
- package/dist/styles/think-execution-workbench.css +4 -0
- package/dist/styles/think-full-app.css +1 -6
- package/dist/styles/workspace-concepts.css +6 -39
- package/dist/styles/workspace-explorer.css +4 -11
- package/package.json +2 -2
- package/dist/components/agents-sdk/SubagentRunDetails.d.ts +0 -40
- package/dist/components/agents-sdk/SubagentRunDetails.js +0 -98
- package/dist/merge-refs-DF_7w2x_.js +0 -18
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { n as AgentToolRunValue, t as AgentToolEventsValue } from "../../AgentToolRunsContext-DniwGn96.js";
|
|
2
|
-
import { ExpansionStore } from "../ai-sdk/ExpansionState.js";
|
|
3
2
|
import * as React from "react";
|
|
4
3
|
import { AgentToolRunPart } from "agents/agent-tools";
|
|
5
4
|
//#region src/components/agents-sdk/SubagentRunPanel.d.ts
|
|
@@ -19,22 +18,22 @@ export interface SubagentRunPanelProviderProps {
|
|
|
19
18
|
children: React.ReactNode;
|
|
20
19
|
}
|
|
21
20
|
interface SubagentRunPanelValue extends Pick<SubagentRunPanelProviderProps, "agentTools" | "selectedRunId" | "parentRunning"> {
|
|
22
|
-
open
|
|
23
|
-
|
|
24
|
-
hiddenCompleted: ReadonlySet<string>;
|
|
25
|
-
setHiddenCompleted: (ids: ReadonlySet<string>) => void;
|
|
26
|
-
reportDisclosures: ExpansionStore;
|
|
27
|
-
restoreFocusRunId: React.RefObject<string | undefined>;
|
|
21
|
+
/** Set while a run is open, so coming back lands on the pill that led there. */
|
|
22
|
+
restoreFocus: React.RefObject<boolean>;
|
|
28
23
|
commands: Readonly<Record<string, CommandState>>;
|
|
29
24
|
stopCurrentWork: () => Promise<void>;
|
|
30
25
|
stopRun: (runId: string) => Promise<void>;
|
|
31
26
|
}
|
|
32
|
-
/** A thread's transient
|
|
27
|
+
/** A thread's transient Stop commands and focus return; run facts remain in the SDK value. */
|
|
33
28
|
export declare function SubagentRunPanelProvider({ scopeKey, agentTools, selectedRunId, parentRunning, onStopCurrentWork, onStopRun, children }: SubagentRunPanelProviderProps): React.JSX.Element;
|
|
34
29
|
export declare function useOptionalSubagentRunPanel(): SubagentRunPanelValue | null;
|
|
35
30
|
export interface SubagentRunPanelProps {
|
|
36
31
|
renderRunLink: (run: AgentToolRunValue) => React.ReactElement;
|
|
37
32
|
}
|
|
38
|
-
/**
|
|
33
|
+
/**
|
|
34
|
+
* Parent-scoped delegated work, collapsed to one pill above the composer — the
|
|
35
|
+
* shipped Codex "N background agents" row. The runs open in a popover on
|
|
36
|
+
* demand, so the dock never grows with the roster.
|
|
37
|
+
*/
|
|
39
38
|
export declare function SubagentRunPanel({ renderRunLink }: SubagentRunPanelProps): React.JSX.Element | null;
|
|
40
39
|
//#endregion
|
|
@@ -1,9 +1,12 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
1
|
+
import { J as SquareIcon, K as SpinnerIcon } from "../../icons-DvlrWt54.js";
|
|
2
|
+
import { buttonVariants } from "../foundations/Button.js";
|
|
3
|
+
import { Tooltip } from "../foundations/Tooltip.js";
|
|
4
|
+
import { IconButton } from "../foundations/IconButton.js";
|
|
5
|
+
import { Popover } from "../foundations/Popover.js";
|
|
6
|
+
import { Queue, QueueItem, QueueItemActions, QueueItemContent, QueueItemDescription, QueueList } from "../ai-sdk/Queue.js";
|
|
7
|
+
import { SubagentRunIndicator, getSubagentRunName } from "./SubagentRunIndicator.js";
|
|
5
8
|
import { useOptionalAgentChatQueue } from "./AgentChatQueue.js";
|
|
6
|
-
import { AgentChatNotice
|
|
9
|
+
import { AgentChatNotice } from "./AgentChat.js";
|
|
7
10
|
import { SubagentRunSelector } from "./SubagentRunSelector.js";
|
|
8
11
|
import * as React from "react";
|
|
9
12
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
@@ -14,30 +17,19 @@ const SubagentRunPanelContext = React.createContext(null);
|
|
|
14
17
|
function createPanelState(scopeKey, selectedRunId) {
|
|
15
18
|
return {
|
|
16
19
|
scopeKey,
|
|
17
|
-
open: true,
|
|
18
|
-
hiddenCompleted: /* @__PURE__ */ new Set(),
|
|
19
20
|
commands: {},
|
|
20
|
-
reportDisclosures: createExpansionStore(),
|
|
21
21
|
inFlight: /* @__PURE__ */ new Map(),
|
|
22
|
-
|
|
22
|
+
restoreFocus: { current: Boolean(selectedRunId) }
|
|
23
23
|
};
|
|
24
24
|
}
|
|
25
|
-
/** A thread's transient
|
|
25
|
+
/** A thread's transient Stop commands and focus return; run facts remain in the SDK value. */
|
|
26
26
|
function SubagentRunPanelProvider({ scopeKey, agentTools, selectedRunId, parentRunning, onStopCurrentWork, onStopRun, children }) {
|
|
27
27
|
const [state, setState] = React.useState(() => createPanelState(scopeKey, selectedRunId));
|
|
28
28
|
if (state.scopeKey !== scopeKey) setState(createPanelState(scopeKey, selectedRunId));
|
|
29
|
-
const {
|
|
30
|
-
const setOpen = React.useCallback((open) => setState((current) => current.inFlight === inFlight ? {
|
|
31
|
-
...current,
|
|
32
|
-
open
|
|
33
|
-
} : current), [inFlight]);
|
|
34
|
-
const setHiddenCompleted = React.useCallback((hiddenCompleted) => setState((current) => current.inFlight === inFlight ? {
|
|
35
|
-
...current,
|
|
36
|
-
hiddenCompleted
|
|
37
|
-
} : current), [inFlight]);
|
|
29
|
+
const { commands, inFlight, restoreFocus } = state;
|
|
38
30
|
React.useLayoutEffect(() => {
|
|
39
|
-
if (selectedRunId)
|
|
40
|
-
}, [
|
|
31
|
+
if (selectedRunId) restoreFocus.current = true;
|
|
32
|
+
}, [restoreFocus, selectedRunId]);
|
|
41
33
|
const execute = React.useCallback((key, command) => {
|
|
42
34
|
const pending = inFlight.get(key);
|
|
43
35
|
if (pending) return pending;
|
|
@@ -66,12 +58,7 @@ function SubagentRunPanelProvider({ scopeKey, agentTools, selectedRunId, parentR
|
|
|
66
58
|
agentTools,
|
|
67
59
|
selectedRunId,
|
|
68
60
|
parentRunning,
|
|
69
|
-
|
|
70
|
-
setOpen,
|
|
71
|
-
hiddenCompleted,
|
|
72
|
-
setHiddenCompleted,
|
|
73
|
-
reportDisclosures,
|
|
74
|
-
restoreFocusRunId,
|
|
61
|
+
restoreFocus,
|
|
75
62
|
commands,
|
|
76
63
|
stopCurrentWork,
|
|
77
64
|
stopRun
|
|
@@ -79,12 +66,7 @@ function SubagentRunPanelProvider({ scopeKey, agentTools, selectedRunId, parentR
|
|
|
79
66
|
agentTools,
|
|
80
67
|
selectedRunId,
|
|
81
68
|
parentRunning,
|
|
82
|
-
|
|
83
|
-
hiddenCompleted,
|
|
84
|
-
reportDisclosures,
|
|
85
|
-
restoreFocusRunId,
|
|
86
|
-
setOpen,
|
|
87
|
-
setHiddenCompleted,
|
|
69
|
+
restoreFocus,
|
|
88
70
|
commands,
|
|
89
71
|
stopCurrentWork,
|
|
90
72
|
stopRun
|
|
@@ -97,34 +79,28 @@ function SubagentRunPanelProvider({ scopeKey, agentTools, selectedRunId, parentR
|
|
|
97
79
|
function useOptionalSubagentRunPanel() {
|
|
98
80
|
return React.useContext(SubagentRunPanelContext);
|
|
99
81
|
}
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
return
|
|
103
|
-
runs,
|
|
104
|
-
active: runs.filter(agentToolRunMayExecute),
|
|
105
|
-
completed: runs.filter((run) => !agentToolRunMayExecute(run)),
|
|
106
|
-
visible: runs.filter((run) => !panel.hiddenCompleted.has(run.runId) || agentToolRunMayExecute(run))
|
|
107
|
-
};
|
|
82
|
+
/** Runs that may still execute lead; each group keeps dispatch order. */
|
|
83
|
+
function sortSubagentRuns(panel) {
|
|
84
|
+
return Object.values(panel.agentTools.runsById).sort((a, b) => Number(!agentToolRunMayExecute(a)) - Number(!agentToolRunMayExecute(b)) || a.order - b.order);
|
|
108
85
|
}
|
|
109
|
-
function useSubagentRunFocus(panel,
|
|
86
|
+
function useSubagentRunFocus(panel, runs) {
|
|
87
|
+
const triggerRef = React.useRef(null);
|
|
110
88
|
const rootRef = React.useRef(null);
|
|
111
89
|
const focusedControl = React.useRef(null);
|
|
112
90
|
const [focusedOrder, setFocusedOrder] = React.useState(null);
|
|
113
91
|
const ranks = focusedOrder ? new Map(focusedOrder.map((id, index) => [id, index])) : null;
|
|
114
|
-
const ordered = ranks ?
|
|
92
|
+
const ordered = ranks ? runs.toSorted((a, b) => (ranks.get(a.runId) ?? Infinity) - (ranks.get(b.runId) ?? Infinity)) : runs;
|
|
115
93
|
React.useLayoutEffect(() => {
|
|
116
94
|
const previous = focusedControl.current;
|
|
117
|
-
|
|
118
|
-
(
|
|
95
|
+
const root = rootRef.current;
|
|
96
|
+
if (!previous || previous.element.isConnected || !root || document.activeElement !== document.body) return;
|
|
97
|
+
(Array.from(root.querySelectorAll("[data-run-id]")).find((element) => element.dataset.runId === previous.runId)?.querySelector("a") ?? root).focus({ preventScroll: true });
|
|
119
98
|
});
|
|
120
99
|
React.useEffect(() => {
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
(Array.from(root.querySelectorAll("[data-run-id]")).find((element) => element.dataset.runId === focusId)?.querySelector("a") ?? root.querySelector("[data-slot=\"subagent-run-panel-trigger\"]"))?.focus({ preventScroll: true });
|
|
126
|
-
panel.restoreFocusRunId.current = void 0;
|
|
127
|
-
}, [panel.restoreFocusRunId, panel.selectedRunId]);
|
|
100
|
+
if (panel.selectedRunId || !panel.restoreFocus.current) return;
|
|
101
|
+
triggerRef.current?.focus({ preventScroll: true });
|
|
102
|
+
panel.restoreFocus.current = false;
|
|
103
|
+
}, [panel.restoreFocus, panel.selectedRunId]);
|
|
128
104
|
const onFocusCapture = (event) => {
|
|
129
105
|
focusedControl.current = {
|
|
130
106
|
element: event.target,
|
|
@@ -139,25 +115,23 @@ function useSubagentRunFocus(panel, visible) {
|
|
|
139
115
|
}
|
|
140
116
|
};
|
|
141
117
|
return {
|
|
118
|
+
triggerRef,
|
|
142
119
|
rootRef,
|
|
143
120
|
ordered,
|
|
144
121
|
onFocusCapture,
|
|
145
122
|
onBlurCapture
|
|
146
123
|
};
|
|
147
124
|
}
|
|
148
|
-
function
|
|
149
|
-
const counts = [active ? `${active} active` : null, completed ? `${completed} finished` : null].filter(Boolean).join(", ");
|
|
150
|
-
return `Delegated work${counts ? `, ${counts}` : ""}`;
|
|
151
|
-
}
|
|
152
|
-
function SubagentRunPanelControls({ panel, active }) {
|
|
125
|
+
function SubagentRunStopAll({ panel, active }) {
|
|
153
126
|
const queue = useOptionalAgentChatQueue();
|
|
154
127
|
const stop = panel.commands["current-work"] ?? IDLE;
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
128
|
+
if (active < 2 && !stop.error && !stop.pending) return null;
|
|
129
|
+
return /* @__PURE__ */ jsx("div", {
|
|
130
|
+
className: "subagent-run__menu-header",
|
|
131
|
+
children: /* @__PURE__ */ jsx(IconButton, {
|
|
132
|
+
label: "Stop current work",
|
|
133
|
+
tooltip: stop.pending ? "Stopping current work…" : void 0,
|
|
134
|
+
size: "xs",
|
|
161
135
|
variant: "ghost",
|
|
162
136
|
color: "neutral",
|
|
163
137
|
disabled: stop.pending,
|
|
@@ -167,8 +141,8 @@ function SubagentRunPanelControls({ panel, active }) {
|
|
|
167
141
|
queue?.hold();
|
|
168
142
|
panel.stopCurrentWork().catch(() => void 0);
|
|
169
143
|
},
|
|
170
|
-
children: stop.pending ?
|
|
171
|
-
})
|
|
144
|
+
children: stop.pending ? /* @__PURE__ */ jsx(SpinnerIcon, {}) : /* @__PURE__ */ jsx(SquareIcon, {})
|
|
145
|
+
})
|
|
172
146
|
});
|
|
173
147
|
}
|
|
174
148
|
function SubagentRunRow({ panel, run, renderRunLink }) {
|
|
@@ -186,81 +160,118 @@ function SubagentRunRow({ panel, run, renderRunLink }) {
|
|
|
186
160
|
children: command.error
|
|
187
161
|
}) : null] }), actionable ? /* @__PURE__ */ jsx(QueueItemActions, {
|
|
188
162
|
persistent: true,
|
|
189
|
-
children: /* @__PURE__ */ jsx(
|
|
163
|
+
children: /* @__PURE__ */ jsx(IconButton, {
|
|
164
|
+
label: `Stop ${getSubagentRunName(run)}`,
|
|
165
|
+
tooltip: command.pending ? "Stopping…" : void 0,
|
|
166
|
+
size: "xs",
|
|
167
|
+
variant: "ghost",
|
|
168
|
+
color: "neutral",
|
|
190
169
|
disabled: command.pending,
|
|
191
170
|
focusableWhenDisabled: true,
|
|
192
171
|
"aria-busy": command.pending,
|
|
193
|
-
"aria-label": `Stop ${getSubagentRunName(run)}`,
|
|
194
172
|
onClick: () => {
|
|
195
173
|
panel.stopRun(run.runId).catch(() => void 0);
|
|
196
174
|
},
|
|
197
|
-
children: command.pending ?
|
|
175
|
+
children: command.pending ? /* @__PURE__ */ jsx(SpinnerIcon, {}) : /* @__PURE__ */ jsx(SquareIcon, {})
|
|
198
176
|
})
|
|
199
177
|
}) : null]
|
|
200
178
|
});
|
|
201
179
|
}
|
|
202
180
|
function SubagentRunPanelContent({ panel, renderRunLink }) {
|
|
203
|
-
const
|
|
204
|
-
const focus = useSubagentRunFocus(panel,
|
|
181
|
+
const runs = sortSubagentRuns(panel);
|
|
182
|
+
const focus = useSubagentRunFocus(panel, runs);
|
|
205
183
|
const stop = panel.commands["current-work"] ?? IDLE;
|
|
206
|
-
|
|
207
|
-
|
|
184
|
+
const [open, setOpen] = React.useState(false);
|
|
185
|
+
const lead = runs.find((run) => run.status !== "completed") ?? runs[0];
|
|
186
|
+
if (!lead) {
|
|
187
|
+
if (open) setOpen(false);
|
|
188
|
+
return null;
|
|
189
|
+
}
|
|
190
|
+
const active = runs.filter(agentToolRunMayExecute).length;
|
|
191
|
+
const finished = runs.length - active;
|
|
192
|
+
const counts = [active && `${active} active`, finished && `${finished} finished`].filter(Boolean).join(", ");
|
|
193
|
+
const { collection } = panel.agentTools;
|
|
194
|
+
return /* @__PURE__ */ jsx("div", {
|
|
195
|
+
className: "subagent-run__dock",
|
|
208
196
|
"data-subagent-run-panel": "",
|
|
209
|
-
children: /* @__PURE__ */
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
className: "subagent-run__panel-header",
|
|
219
|
-
children: [/* @__PURE__ */ jsx(QueueSectionTrigger, {
|
|
197
|
+
children: /* @__PURE__ */ jsxs(Popover.Root, {
|
|
198
|
+
open,
|
|
199
|
+
onOpenChange: setOpen,
|
|
200
|
+
children: [/* @__PURE__ */ jsxs(Tooltip.Root, {
|
|
201
|
+
disabled: open,
|
|
202
|
+
children: [/* @__PURE__ */ jsxs(Tooltip.Trigger, {
|
|
203
|
+
render: /* @__PURE__ */ jsx(Popover.Trigger, {
|
|
204
|
+
unstyled: true,
|
|
205
|
+
ref: focus.triggerRef,
|
|
220
206
|
"data-slot": "subagent-run-panel-trigger",
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
size: "xs",
|
|
229
|
-
variant: "ghost",
|
|
230
|
-
color: "neutral",
|
|
231
|
-
onClick: () => panel.setHiddenCompleted(panel.hiddenCompleted.size ? /* @__PURE__ */ new Set() : new Set(completed.map((run) => run.runId))),
|
|
232
|
-
children: panel.hiddenCompleted.size ? `Show completed (${completed.length})` : "Hide completed"
|
|
233
|
-
}) : null]
|
|
234
|
-
}), /* @__PURE__ */ jsxs(QueueSectionContent, { children: [
|
|
235
|
-
stop.error ? /* @__PURE__ */ jsx(AgentChatNotice, {
|
|
236
|
-
"data-tone": "danger",
|
|
237
|
-
role: "alert",
|
|
238
|
-
children: stop.error
|
|
239
|
-
}) : null,
|
|
240
|
-
panel.agentTools.collection.status === "loading" ? /* @__PURE__ */ jsx(AgentChatNotice, { children: panel.agentTools.collection.stale ? "Reconnecting. Last known runs are shown." : "Loading delegated work…" }) : null,
|
|
241
|
-
panel.agentTools.collection.status === "error" ? /* @__PURE__ */ jsx(AgentChatNotice, {
|
|
242
|
-
"data-tone": "danger",
|
|
243
|
-
role: "alert",
|
|
244
|
-
children: panel.agentTools.collection.error ?? "Could not refresh delegated work. Last known runs are retained."
|
|
245
|
-
}) : null,
|
|
246
|
-
/* @__PURE__ */ jsx(QueueList, {
|
|
247
|
-
"aria-label": "Delegated work runs",
|
|
248
|
-
children: focus.ordered.map((run) => /* @__PURE__ */ jsx(SubagentRunRow, {
|
|
249
|
-
panel,
|
|
250
|
-
run,
|
|
251
|
-
renderRunLink
|
|
252
|
-
}, run.runId))
|
|
207
|
+
className: buttonVariants({
|
|
208
|
+
variant: "surface",
|
|
209
|
+
color: "neutral",
|
|
210
|
+
size: "xs",
|
|
211
|
+
className: "subagent-run__pill"
|
|
212
|
+
}),
|
|
213
|
+
"aria-description": counts
|
|
253
214
|
}),
|
|
254
|
-
/* @__PURE__ */ jsx(
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
215
|
+
children: [/* @__PURE__ */ jsx(SubagentRunIndicator, { run: lead }), runs.length === 1 ? "1 agent" : `${runs.length} agents`]
|
|
216
|
+
}), /* @__PURE__ */ jsx(Tooltip.Portal, { children: /* @__PURE__ */ jsx(Tooltip.Positioner, {
|
|
217
|
+
side: "top",
|
|
218
|
+
sideOffset: 6,
|
|
219
|
+
children: /* @__PURE__ */ jsxs(Tooltip.Popup, { children: ["Delegated work · ", counts] })
|
|
220
|
+
}) })]
|
|
221
|
+
}), /* @__PURE__ */ jsx(Popover.Portal, { children: /* @__PURE__ */ jsx(Popover.Positioner, {
|
|
222
|
+
side: "top",
|
|
223
|
+
align: "center",
|
|
224
|
+
sideOffset: 8,
|
|
225
|
+
children: /* @__PURE__ */ jsxs(Popover.Popup, {
|
|
226
|
+
ref: focus.rootRef,
|
|
227
|
+
"aria-label": "Delegated work",
|
|
228
|
+
className: "subagent-run__menu",
|
|
229
|
+
initialFocus: (openType) => openType === "keyboard" ? focus.rootRef.current?.querySelector("[data-run-id] a") ?? true : focus.rootRef.current,
|
|
230
|
+
onFocusCapture: focus.onFocusCapture,
|
|
231
|
+
onBlurCapture: focus.onBlurCapture,
|
|
232
|
+
children: [
|
|
233
|
+
/* @__PURE__ */ jsx(SubagentRunStopAll, {
|
|
234
|
+
panel,
|
|
235
|
+
active
|
|
236
|
+
}),
|
|
237
|
+
/* @__PURE__ */ jsxs("div", {
|
|
238
|
+
className: "subagent-run__notices",
|
|
239
|
+
children: [
|
|
240
|
+
stop.error ? /* @__PURE__ */ jsx(AgentChatNotice, {
|
|
241
|
+
"data-tone": "danger",
|
|
242
|
+
role: "alert",
|
|
243
|
+
children: stop.error
|
|
244
|
+
}) : null,
|
|
245
|
+
collection.status === "loading" ? /* @__PURE__ */ jsx(AgentChatNotice, { children: collection.stale ? "Reconnecting. Last known runs are shown." : "Loading delegated work…" }) : null,
|
|
246
|
+
collection.status === "error" ? /* @__PURE__ */ jsx(AgentChatNotice, {
|
|
247
|
+
"data-tone": "danger",
|
|
248
|
+
role: "alert",
|
|
249
|
+
children: collection.error ?? "Could not refresh delegated work. Last known runs are retained."
|
|
250
|
+
}) : null
|
|
251
|
+
]
|
|
252
|
+
}),
|
|
253
|
+
/* @__PURE__ */ jsx(Queue, {
|
|
254
|
+
density: "compact",
|
|
255
|
+
children: /* @__PURE__ */ jsx(QueueList, {
|
|
256
|
+
"aria-label": "Delegated work runs",
|
|
257
|
+
children: focus.ordered.map((run) => /* @__PURE__ */ jsx(SubagentRunRow, {
|
|
258
|
+
panel,
|
|
259
|
+
run,
|
|
260
|
+
renderRunLink
|
|
261
|
+
}, run.runId))
|
|
262
|
+
})
|
|
263
|
+
})
|
|
264
|
+
]
|
|
265
|
+
})
|
|
266
|
+
}) })]
|
|
260
267
|
})
|
|
261
268
|
});
|
|
262
269
|
}
|
|
263
|
-
/**
|
|
270
|
+
/**
|
|
271
|
+
* Parent-scoped delegated work, collapsed to one pill above the composer — the
|
|
272
|
+
* shipped Codex "N background agents" row. The runs open in a popover on
|
|
273
|
+
* demand, so the dock never grows with the roster.
|
|
274
|
+
*/
|
|
264
275
|
function SubagentRunPanel({ renderRunLink }) {
|
|
265
276
|
const panel = useOptionalSubagentRunPanel();
|
|
266
277
|
return panel ? /* @__PURE__ */ jsx(SubagentRunPanelContent, {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { J as PromptInputMessage } from "../../PromptInput-C3adKglc.js";
|
|
2
2
|
import { i as AgentMessageRenderPartContext } from "../../AgentMessageParts-BtWwiE4f.js";
|
|
3
3
|
import { AgentChatMessageContentProps, AgentChatRootProps } from "./AgentChat.js";
|
|
4
|
-
import { o as createThinkChatActivityRenderer, r as ThinkChatActivityRendererOptions, t as ThinkChatActivity } from "../../ThinkChatActivity-
|
|
4
|
+
import { o as createThinkChatActivityRenderer, r as ThinkChatActivityRendererOptions, t as ThinkChatActivity } from "../../ThinkChatActivity-C4_hPEmb.js";
|
|
5
5
|
import { i as ThinkChatValue } from "../../ThinkChatContext-DQ6M2VlJ.js";
|
|
6
6
|
import { n as WorkspaceFileRenderer } from "../../WorkspaceMessageResponse-D8FGgIQU.js";
|
|
7
7
|
import * as React from "react";
|
|
@@ -7,7 +7,7 @@ import { n as WorkspaceMessageResponse, t as WorkspaceFileRendererProvider } fro
|
|
|
7
7
|
import * as React from "react";
|
|
8
8
|
import { jsx } from "react/jsx-runtime";
|
|
9
9
|
import { isTextUIPart } from "ai";
|
|
10
|
-
import { queryOptions, useQuery, useQueryClient } from "@tanstack/react-query";
|
|
10
|
+
import { queryOptions, replaceEqualDeep, useQuery, useQueryClient } from "@tanstack/react-query";
|
|
11
11
|
//#region src/components/agents-sdk/ThinkChat.tsx
|
|
12
12
|
const EMPTY_PENDING_APPROVALS = [];
|
|
13
13
|
const STREAMED_TEXT_ANIMATION = {
|
|
@@ -129,10 +129,33 @@ function ThinkChatRoot({ chat, children, ...props }) {
|
|
|
129
129
|
function normalizeThinkPrompt({ text, references }) {
|
|
130
130
|
return parseComposerLinks(text).length ? composerDraftToPrompt(text) : [...references?.map(({ trigger, value }) => trigger ? `${trigger}${value}` : value) ?? [], text.trim()].filter(Boolean).join(" ");
|
|
131
131
|
}
|
|
132
|
+
/**
|
|
133
|
+
* Agents' stream state assigns part fields in place and re-emits the same part
|
|
134
|
+
* objects, so the shared snapshot keeps its own shallow copies to compare against.
|
|
135
|
+
*/
|
|
136
|
+
function detachParts(message) {
|
|
137
|
+
return {
|
|
138
|
+
...message,
|
|
139
|
+
parts: message.parts.map((part) => ({ ...part }))
|
|
140
|
+
};
|
|
141
|
+
}
|
|
132
142
|
/** Think activity/workspace rendering, independent of transcript layout and message actions. */
|
|
133
143
|
function ThinkChatMessageContent({ message, renderPart, excludeTools, renderAgentToolRunLink, toolRenderers, renderWorkspaceFile }) {
|
|
144
|
+
const [snapshot, setSnapshot] = React.useState(() => ({
|
|
145
|
+
input: message,
|
|
146
|
+
shared: detachParts(message)
|
|
147
|
+
}));
|
|
148
|
+
let sharedMessage = snapshot.shared;
|
|
149
|
+
if (snapshot.input !== message) {
|
|
150
|
+
const detached = detachParts(message);
|
|
151
|
+
sharedMessage = snapshot.shared.id === message.id ? replaceEqualDeep(snapshot.shared, detached) : detached;
|
|
152
|
+
setSnapshot({
|
|
153
|
+
input: message,
|
|
154
|
+
shared: sharedMessage
|
|
155
|
+
});
|
|
156
|
+
}
|
|
134
157
|
const { lastMessageId, status } = useAgentChatControls();
|
|
135
|
-
const isLiveMessage =
|
|
158
|
+
const isLiveMessage = sharedMessage.role === "assistant" && sharedMessage.id === lastMessageId && status === "streaming";
|
|
136
159
|
const activity = React.useMemo(() => createThinkChatActivityRenderer({
|
|
137
160
|
excludeTools,
|
|
138
161
|
renderAgentToolRunLink,
|
|
@@ -166,7 +189,7 @@ function ThinkChatMessageContent({ message, renderPart, excludeTools, renderAgen
|
|
|
166
189
|
return /* @__PURE__ */ jsx(WorkspaceFileRendererProvider, {
|
|
167
190
|
renderWorkspaceFile,
|
|
168
191
|
children: /* @__PURE__ */ jsx(AgentChat.MessageContent, {
|
|
169
|
-
message,
|
|
192
|
+
message: sharedMessage,
|
|
170
193
|
renderPart: resolved
|
|
171
194
|
})
|
|
172
195
|
});
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { a as ThinkChatToolRenderers, i as ThinkChatToolRenderer, n as ThinkChatActivityProps, o as createThinkChatActivityRenderer, r as ThinkChatActivityRendererOptions, s as renderThinkChatActivityPart, t as ThinkChatActivity } from "../../ThinkChatActivity-
|
|
1
|
+
import { a as ThinkChatToolRenderers, i as ThinkChatToolRenderer, n as ThinkChatActivityProps, o as createThinkChatActivityRenderer, r as ThinkChatActivityRendererOptions, s as renderThinkChatActivityPart, t as ThinkChatActivity } from "../../ThinkChatActivity-C4_hPEmb.js";
|
|
2
2
|
export { ThinkChatActivity, ThinkChatActivityProps, ThinkChatActivityRendererOptions, ThinkChatToolRenderer, ThinkChatToolRenderers, createThinkChatActivityRenderer, renderThinkChatActivityPart };
|