@mcp-b/react-components 0.47.0 → 0.49.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/AgentChatQueue-C_Jaw3Ia.d.ts +48 -0
- package/dist/AgentToolRunsContext-GMe_hSnD.d.ts +35 -0
- package/dist/Avatar-o2NO1fCG.d.ts +124 -0
- package/dist/{Button-CZt3yywF.d.ts → Button-DjONW5UW.d.ts} +1 -1
- package/dist/{CodeBlock-C380GD5t.d.ts → CodeBlock--r6GS8YV.d.ts} +8 -2
- package/dist/{CodeBlock-DMHZiw86.js → CodeBlock-g8sADidM.js} +7 -7
- package/dist/Correspondent-7K6uNLUm.d.ts +64 -0
- package/dist/{FileTree-BHebfvkK.js → FileTree-H8mMg4rV.js} +20 -29
- package/dist/{IconButton-BAUFhUk8.d.ts → IconButton-ByiyjkYE.d.ts} +2 -2
- package/dist/{Message-D_vCVEGB.d.ts → Message-DyaTBiV7.d.ts} +17 -4
- package/dist/MessageScrollerVirtual-D4afYwVB.d.ts +84 -0
- package/dist/{PromptInput-DtJHyp0S.d.ts → PromptInput-C4Mofitz.d.ts} +44 -31
- package/dist/PromptInputApproval-D2hpn54U.d.ts +44 -0
- package/dist/Separator-CzhtLYE1.d.ts +41 -0
- package/dist/Toolbar-CGY004u0.d.ts +155 -0
- package/dist/{Workspace-C_zHq9KZ.d.ts → Workspace-HzGrWDX3.d.ts} +14 -3
- package/dist/{WorkspaceFile-Dq-GC0_T.d.ts → WorkspaceFile-Bouauobc.d.ts} +1 -1
- package/dist/{WorkspaceFileView-ChIJz-fl.js → WorkspaceFileView-DYPtRVpM.js} +4 -3
- package/dist/{WorkspaceLink-B1d2GIGl.js → WorkspaceLink-BYZG-V_I.js} +8 -91
- package/dist/{WorkspaceMessageResponse-Dg_aNpoj.js → WorkspaceMessageResponse-CUJk9_P5.js} +6 -3
- package/dist/components/agents-sdk/AgentChat.d.ts +198 -2
- package/dist/components/agents-sdk/AgentChat.js +525 -670
- package/dist/components/agents-sdk/AgentChatQueue.d.ts +2 -0
- package/dist/components/agents-sdk/AgentChatQueue.js +206 -0
- package/dist/components/agents-sdk/AgentEvent.js +1 -1
- package/dist/components/agents-sdk/AgentToolRunsContext.d.ts +2 -2
- package/dist/components/agents-sdk/AgentToolRunsContext.js +1 -36
- package/dist/components/agents-sdk/BrowserLiveScreen.js +21 -13
- package/dist/components/agents-sdk/BrowserReplay.d.ts +1 -1
- package/dist/components/agents-sdk/BrowserRunPanel.d.ts +3 -0
- package/dist/components/agents-sdk/BrowserRunPanel.js +31 -30
- package/dist/components/agents-sdk/EmployeeChrome.d.ts +212 -0
- package/dist/components/agents-sdk/EmployeeChrome.js +555 -0
- package/dist/components/agents-sdk/ManagerOffice.d.ts +115 -85
- package/dist/components/agents-sdk/ManagerOffice.js +545 -1154
- package/dist/components/agents-sdk/McpConnectionRequest.d.ts +4 -4
- package/dist/components/agents-sdk/McpConnectionRequest.js +3 -2
- package/dist/components/agents-sdk/McpConnectorForm.d.ts +38 -1
- package/dist/components/agents-sdk/McpPluginCatalog.d.ts +93 -1
- package/dist/components/agents-sdk/McpPluginCatalog.js +3 -2
- package/dist/components/agents-sdk/McpServerIcon.d.ts +17 -0
- package/dist/components/agents-sdk/McpServerIcon.js +25 -0
- package/dist/components/agents-sdk/McpServerPicker.d.ts +4 -3
- package/dist/components/agents-sdk/McpServerPicker.js +2 -1
- package/dist/components/agents-sdk/ModelSelector.d.ts +4 -4
- package/dist/components/agents-sdk/ModelSelector.js +3 -3
- package/dist/components/agents-sdk/PromptInputApproval.d.ts +1 -43
- package/dist/components/agents-sdk/PromptInputCommands.d.ts +1 -1
- package/dist/components/agents-sdk/PromptInputCommands.js +1 -2
- package/dist/components/agents-sdk/SessionCompaction.d.ts +88 -1
- package/dist/components/agents-sdk/SessionCompaction.js +2 -2
- package/dist/components/agents-sdk/SubagentRunDetails.d.ts +30 -1
- package/dist/components/agents-sdk/SubagentRunDetails.js +57 -1
- package/dist/components/agents-sdk/SubagentRunIndicator.d.ts +9 -9
- package/dist/components/agents-sdk/SubagentRunIndicator.js +18 -23
- package/dist/components/agents-sdk/SubagentRunList.d.ts +6 -3
- package/dist/components/agents-sdk/SubagentRunList.js +4 -2
- package/dist/components/agents-sdk/SubagentRunPanel.d.ts +60 -0
- package/dist/components/agents-sdk/SubagentRunPanel.js +255 -0
- package/dist/components/agents-sdk/SubagentRunSelector.d.ts +8 -4
- package/dist/components/agents-sdk/SubagentRunSelector.js +4 -2
- package/dist/components/agents-sdk/ThinkChat.d.ts +102 -2
- package/dist/components/agents-sdk/ThinkChat.js +233 -2
- package/dist/components/agents-sdk/ThinkChatActivity.d.ts +76 -1
- package/dist/components/agents-sdk/ThinkChatActivity.js +17 -9
- package/dist/components/agents-sdk/ThinkChatContext.d.ts +27 -1
- package/dist/components/agents-sdk/ThinkChatContext.js +1 -1
- package/dist/components/agents-sdk/ThinkChatToolPanels.js +23 -18
- package/dist/components/agents-sdk/ThinkExecutionDetail.js +1 -1
- package/dist/components/agents-sdk/ThinkExecutionStatus.d.ts +1 -1
- package/dist/components/agents-sdk/ThinkExecutionWorkbench.d.ts +85 -28
- package/dist/components/agents-sdk/ThinkExecutionWorkbench.js +158 -101
- package/dist/components/agents-sdk/ThinkFullApp.d.ts +40 -158
- package/dist/components/agents-sdk/ThinkFullApp.js +71 -285
- package/dist/components/agents-sdk/ThinkRecoveryNotice.d.ts +18 -1
- package/dist/components/agents-sdk/ThinkRoutineActions.d.ts +51 -0
- package/dist/components/agents-sdk/ThinkRoutineActions.js +201 -0
- package/dist/components/agents-sdk/ThinkRoutineBrowser.d.ts +4 -1
- package/dist/components/agents-sdk/ThinkRoutineBrowser.js +16 -14
- package/dist/components/agents-sdk/ThinkRoutineDetail.js +12 -12
- package/dist/components/agents-sdk/ThinkRoutineForm.d.ts +2 -1
- package/dist/components/agents-sdk/ThinkRoutineForm.js +11 -11
- package/dist/components/agents-sdk/ThinkRoutineRuns.js +6 -6
- package/dist/components/agents-sdk/ThinkThreadPicker.d.ts +90 -1
- package/dist/components/agents-sdk/ThinkThreadPicker.js +2 -2
- package/dist/components/agents-sdk/Workspace.d.ts +2 -2
- package/dist/components/agents-sdk/Workspace.js +20 -23
- package/dist/components/agents-sdk/WorkspaceBrowser.d.ts +1 -1
- package/dist/components/agents-sdk/WorkspaceBrowser.js +1 -1
- package/dist/components/agents-sdk/WorkspaceConcept.d.ts +3 -2
- package/dist/components/agents-sdk/WorkspaceConcept.js +3 -3
- package/dist/components/agents-sdk/WorkspaceCorrespondence.d.ts +15 -10
- package/dist/components/agents-sdk/WorkspaceCorrespondence.js +43 -40
- package/dist/components/agents-sdk/WorkspaceExecution.d.ts +31 -31
- package/dist/components/agents-sdk/WorkspaceExecution.js +115 -192
- package/dist/components/agents-sdk/WorkspaceExplorer.d.ts +5 -2
- package/dist/components/agents-sdk/WorkspaceExplorer.js +3 -2
- package/dist/components/agents-sdk/WorkspaceFile.d.ts +1 -1
- package/dist/components/agents-sdk/WorkspaceFileView.d.ts +1 -1
- package/dist/components/agents-sdk/WorkspaceFileView.js +1 -1
- package/dist/components/agents-sdk/WorkspaceLink.js +1 -1
- package/dist/components/agents-sdk/WorkspaceLive.d.ts +60 -1
- package/dist/components/agents-sdk/WorkspaceLive.js +33 -5
- package/dist/components/agents-sdk/WorkspaceMessageResponse.d.ts +47 -1
- package/dist/components/agents-sdk/WorkspaceMessageResponse.js +1 -1
- package/dist/components/agents-sdk/WorkspaceMountManager.d.ts +3 -2
- package/dist/components/agents-sdk/WorkspaceMountManager.js +5 -8
- package/dist/components/agents-sdk/WorkspaceNavigationRestoration.d.ts +38 -0
- package/dist/components/agents-sdk/WorkspaceNavigationRestoration.js +86 -0
- package/dist/components/agents-sdk/WorkspaceProject.d.ts +44 -15
- package/dist/components/agents-sdk/WorkspaceProject.js +74 -51
- package/dist/components/agents-sdk/WorkspaceUserScript.d.ts +1 -1
- package/dist/components/agents-sdk/WorkspaceUserScript.js +5 -2
- package/dist/components/ai-sdk/Activity.d.ts +1 -1
- package/dist/components/ai-sdk/AgentAttention.d.ts +2 -2
- package/dist/components/ai-sdk/AgentChatStartScreen.d.ts +89 -2
- package/dist/components/ai-sdk/AgentChatStartScreen.js +63 -42
- package/dist/components/ai-sdk/AgentMessageParts.d.ts +45 -1
- package/dist/components/ai-sdk/Approval.d.ts +1 -1
- package/dist/components/ai-sdk/Artifact.d.ts +2 -2
- package/dist/components/ai-sdk/Artifact.js +2 -2
- package/dist/components/ai-sdk/ChainOfThought.d.ts +1 -1
- package/dist/components/ai-sdk/CodeBlock.d.ts +1 -1
- package/dist/components/ai-sdk/CodeBlock.js +1 -1
- package/dist/components/ai-sdk/ComposerLink.js +1 -2
- package/dist/components/ai-sdk/ConnectedAppCards.d.ts +16 -1
- package/dist/components/ai-sdk/ConnectedAppCards.js +69 -94
- package/dist/components/ai-sdk/Context.d.ts +7 -3
- package/dist/components/ai-sdk/Context.js +7 -17
- package/dist/components/ai-sdk/Conversation.d.ts +2 -2
- package/dist/components/ai-sdk/Correspondent.d.ts +2 -0
- package/dist/components/ai-sdk/Correspondent.js +145 -0
- package/dist/components/ai-sdk/Goal.d.ts +3 -3
- package/dist/components/ai-sdk/Goal.js +2 -2
- package/dist/components/ai-sdk/InlineCitation.d.ts +1 -1
- package/dist/components/ai-sdk/InlineCitation.js +1 -1
- package/dist/components/ai-sdk/MediaPreviewCard.d.ts +1 -1
- package/dist/components/ai-sdk/Message.d.ts +2 -2
- package/dist/components/ai-sdk/Message.js +11 -2
- package/dist/components/ai-sdk/MessageScroller.d.ts +1 -1
- package/dist/components/ai-sdk/MessageScrollerVirtual.d.ts +2 -76
- package/dist/components/ai-sdk/MessageScrollerVirtual.js +38 -4
- package/dist/components/ai-sdk/Plan.d.ts +1 -1
- package/dist/components/ai-sdk/PromptInput.d.ts +2 -2
- package/dist/components/ai-sdk/PromptInput.js +170 -226
- package/dist/components/ai-sdk/PromptInputComposerEditor.js +32 -9
- package/dist/components/ai-sdk/Queue.d.ts +28 -5
- package/dist/components/ai-sdk/Queue.js +19 -4
- package/dist/components/ai-sdk/Reasoning.d.ts +1 -1
- package/dist/components/ai-sdk/Reasoning.js +4 -4
- package/dist/components/ai-sdk/Sources.d.ts +1 -1
- package/dist/components/ai-sdk/Task.d.ts +1 -1
- package/dist/components/extension/ChatGptSignInScreen.d.ts +1 -1
- package/dist/components/extension/CodexModelSelector.d.ts +5 -0
- package/dist/components/extension/ConversationTabPicker.d.ts +1 -0
- package/dist/components/extension/ConversationTabPicker.js +1 -1
- package/dist/components/foundations/AlertDialog.d.ts +1 -1
- package/dist/components/foundations/AppIcon.d.ts +3 -2
- package/dist/components/foundations/Autocomplete.js +6 -1
- package/dist/components/foundations/Avatar.d.ts +1 -121
- package/dist/components/foundations/Button.d.ts +1 -1
- package/dist/components/foundations/Card.d.ts +22 -27
- package/dist/components/foundations/Card.js +51 -32
- package/dist/components/foundations/CheckboxGroup.d.ts +1 -1
- package/dist/components/foundations/Collapsible.d.ts +1 -1
- package/dist/components/foundations/Combobox.js +6 -1
- package/dist/components/foundations/Dialog.d.ts +106 -1
- package/dist/components/foundations/EmptyState.d.ts +1 -1
- package/dist/components/foundations/Field.d.ts +2 -1
- package/dist/components/foundations/Fieldset.d.ts +1 -1
- package/dist/components/foundations/Form.d.ts +4 -4
- package/dist/components/foundations/IconButton.d.ts +1 -1
- package/dist/components/foundations/Label.d.ts +1 -1
- package/dist/components/foundations/LinkButton.d.ts +2 -2
- package/dist/components/foundations/Meter.d.ts +1 -1
- package/dist/components/foundations/NumberField.d.ts +1 -1
- package/dist/components/foundations/ScrollArea.d.ts +1 -1
- package/dist/components/foundations/SearchField.d.ts +1 -1
- package/dist/components/foundations/Select.js +6 -1
- package/dist/components/foundations/Separator.d.ts +1 -40
- package/dist/components/foundations/Stepper.d.ts +1 -1
- package/dist/components/foundations/Textarea.d.ts +1 -1
- package/dist/components/foundations/Toast.d.ts +5 -1
- package/dist/components/foundations/Toggle.d.ts +70 -1
- package/dist/components/foundations/ToggleGroup.d.ts +3 -2
- package/dist/components/foundations/Toolbar.d.ts +1 -151
- package/dist/components/foundations/TransitionSurface.d.ts +1 -1
- package/dist/components/general-purpose/ActionGuide.d.ts +10 -26
- package/dist/components/general-purpose/ActionGuide.js +4 -18
- package/dist/components/general-purpose/AppTopBar.d.ts +4 -2
- package/dist/components/general-purpose/Commit.d.ts +2 -2
- package/dist/components/general-purpose/Commit.js +1 -1
- package/dist/components/general-purpose/EnvironmentVariables.d.ts +2 -2
- package/dist/components/general-purpose/FileTree.d.ts +1 -7
- package/dist/components/general-purpose/FileTree.js +1 -1
- package/dist/components/general-purpose/PricingBillingToggle.js +1 -1
- package/dist/components/general-purpose/PricingPlanCard.d.ts +4 -0
- package/dist/components/general-purpose/PricingUsageCalculator.js +1 -1
- package/dist/components/general-purpose/ResizableSidePanel.d.ts +2 -2
- package/dist/components/general-purpose/ResponsiveSidebarShell.d.ts +128 -2
- package/dist/components/general-purpose/ResponsiveSidebarShell.js +119 -101
- package/dist/components/general-purpose/SettingsFormDialog.d.ts +14 -27
- package/dist/components/general-purpose/SettingsFormDialog.js +40 -70
- package/dist/components/general-purpose/SetupChecklist.d.ts +1 -0
- package/dist/components/general-purpose/SetupChecklist.js +76 -1
- package/dist/components/general-purpose/Terminal.d.ts +3 -3
- package/dist/components/general-purpose/Terminal.js +10 -5
- package/dist/components/general-purpose/TestResults.d.ts +23 -11
- package/dist/components/general-purpose/TestResults.js +48 -50
- package/dist/components/general-purpose/ThemeModeControl.d.ts +2 -0
- package/dist/components/general-purpose/WebPreview.d.ts +29 -4
- package/dist/components/general-purpose/WebPreview.js +37 -12
- package/dist/components/nanites/AgentConnection.js +1 -1
- package/dist/components/nanites/AgentToolDetail.d.ts +13 -11
- package/dist/components/nanites/AgentToolDetail.js +20 -41
- package/dist/{copy-button-C0JyjClr.d.ts → copy-button-OUwOdgEm.d.ts} +1 -1
- package/dist/mcp-server-mAErsxHU.js +27 -0
- package/dist/styles/activity.css +1 -96
- package/dist/styles/agent-chat.css +75 -102
- package/dist/styles/agent-tool-detail.css +0 -16
- package/dist/styles/base.css +3 -3
- package/dist/styles/browser-run-panel.css +1 -15
- package/dist/styles/button.css +7 -1
- package/dist/styles/code-block.css +12 -0
- package/dist/styles/composition-motion.css +0 -2
- package/dist/styles/correspondent.css +73 -0
- package/dist/styles/employee-chrome.css +43 -0
- package/dist/styles/file-tree.css +5 -0
- package/dist/styles/index.css +5 -2
- package/dist/styles/manager-office.css +380 -1086
- package/dist/styles/message.css +2 -10
- package/dist/styles/queue.css +71 -0
- package/dist/styles/subagent-run.css +122 -6
- package/dist/styles/test-results.css +2 -5
- package/dist/styles/think-chat-activity.css +13 -0
- package/dist/styles/think-chat-tool-panels.css +81 -0
- package/dist/styles/think-execution-workbench.css +2 -8
- package/dist/styles/think-full-app.css +42 -251
- package/dist/styles/{think-routine-library.css → think-routine.css} +64 -80
- package/dist/styles/web-preview.css +15 -1
- package/dist/utils/mcp-server-catalog.d.ts +1112 -2
- package/dist/utils/mcp-server-catalog.js +28 -9
- package/dist/utils/structured-code.d.ts +1 -1
- package/dist/{workspace-assets-CxpEHsac.js → workspace-assets-Bg7XhPsk.js} +16 -2
- package/package.json +7 -3
- package/dist/AgentChat-BLmQghkt.d.ts +0 -327
- package/dist/AgentChatStartScreen-Bkv7Avni.d.ts +0 -84
- package/dist/AgentMessageParts-C7L-Mv9U.d.ts +0 -46
- package/dist/AgentToolRunsContext-jtmveaRE.d.ts +0 -57
- package/dist/Dialog-B_FhRWaz.d.ts +0 -107
- package/dist/McpConnectorForm-CeYNY0MI.d.ts +0 -39
- package/dist/McpPluginCatalog-3qWu8oK1.d.ts +0 -92
- package/dist/ResponsiveSidebarShell-BTVPxLJK.d.ts +0 -123
- package/dist/SessionCompaction-CmTJFpzj.d.ts +0 -89
- package/dist/SetupChecklist-CwRjIDH4.js +0 -77
- package/dist/ThinkChat-CwMdEum8.d.ts +0 -185
- package/dist/ThinkChat-DLDta57t.js +0 -332
- package/dist/ThinkChatActivity-B3lGVS-6.d.ts +0 -77
- package/dist/ThinkChatContext-COIgzkYp.d.ts +0 -28
- package/dist/ThinkRecoveryNotice-DGWr94rk.d.ts +0 -19
- package/dist/ThinkThreadPicker-yFz4vvIf.d.ts +0 -91
- package/dist/Toggle-DLrIf5YH.d.ts +0 -69
- package/dist/WorkspaceLive-DLGhtIly.d.ts +0 -49
- package/dist/WorkspaceMessageResponse-kJYU8Onj.d.ts +0 -48
- package/dist/components/agents-sdk/ThinkFullAppViewSwitch.d.ts +0 -31
- package/dist/components/agents-sdk/ThinkFullAppViewSwitch.js +0 -34
- package/dist/components/agents-sdk/ThinkRoutineLibrary.d.ts +0 -80
- package/dist/components/agents-sdk/ThinkRoutineLibrary.js +0 -159
- package/dist/components/agents-sdk/ThinkSidepanel.d.ts +0 -200
- package/dist/components/agents-sdk/ThinkSidepanel.js +0 -775
- package/dist/mcp-server-7NR24ASj.js +0 -69
- package/dist/mcp-server-catalog-C_g7C-9o.d.ts +0 -1108
- package/dist/styles/think-sidepanel.css +0 -78
- package/dist/think-agent-Cip5KAPj.d.ts +0 -7
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { t as cx } from "../../class-names-BiMDVpUo.js";
|
|
2
2
|
import { J as StopIcon, K as SpinnerIcon, d as CheckIcon, et as WarningIcon } from "../../icons-cuEtsgj9.js";
|
|
3
3
|
import { r as firstLine, s as textLines } from "../../format-COCyV98Z.js";
|
|
4
|
-
import { NaniteMark } from "../nanites/NaniteScene.js";
|
|
5
4
|
import "react";
|
|
6
5
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
7
6
|
//#region src/components/agents-sdk/SubagentRunIndicator.tsx
|
|
@@ -25,11 +24,12 @@ function lastStreamedLine(run) {
|
|
|
25
24
|
/** Where a run's status line comes from, before it is cut to one line. */
|
|
26
25
|
function statusSource(run) {
|
|
27
26
|
switch (run.status) {
|
|
27
|
+
case "starting": return "Starting";
|
|
28
28
|
case "running": return run.progress?.message ?? run.progress?.phase ?? lastStreamedLine(run) ?? "Running";
|
|
29
29
|
case "completed": return run.summary ?? "Completed";
|
|
30
30
|
case "error": return run.error ?? "Agent run failed";
|
|
31
|
-
case "aborted": return run.error ?? "Agent run stopped";
|
|
32
|
-
case "interrupted": return run.
|
|
31
|
+
case "aborted": return run.childStillRunning !== false ? `Stop requested; child may still be running${run.error ? `. ${run.error}` : ""}` : run.error ?? "Agent run stopped";
|
|
32
|
+
case "interrupted": return `${run.childStillRunning !== false ? "Interrupted; child may still be running" : "Interrupted"}${run.error ? `. ${run.error}` : ""}`;
|
|
33
33
|
}
|
|
34
34
|
}
|
|
35
35
|
/**
|
|
@@ -45,7 +45,7 @@ function getSubagentRunStatusText(run) {
|
|
|
45
45
|
}
|
|
46
46
|
/** Decorative status mark derived from a whole upstream retained-run record. */
|
|
47
47
|
function SubagentRunIndicator({ className, run, ref, ...props }) {
|
|
48
|
-
const icon = run.status === "running" ? /* @__PURE__ */ jsx(SpinnerIcon, {}) : run.status === "completed" ? /* @__PURE__ */ jsx(CheckIcon, {}) : run.status === "aborted" ? /* @__PURE__ */ jsx(StopIcon, {}) : /* @__PURE__ */ jsx(WarningIcon, {});
|
|
48
|
+
const icon = run.status === "running" || run.status === "starting" ? /* @__PURE__ */ jsx(SpinnerIcon, {}) : run.status === "completed" ? /* @__PURE__ */ jsx(CheckIcon, {}) : run.status === "aborted" && run.childStillRunning === false ? /* @__PURE__ */ jsx(StopIcon, {}) : /* @__PURE__ */ jsx(WarningIcon, {});
|
|
49
49
|
return /* @__PURE__ */ jsx("span", {
|
|
50
50
|
ref,
|
|
51
51
|
"data-slot": "subagent-run-indicator",
|
|
@@ -57,27 +57,22 @@ function SubagentRunIndicator({ className, run, ref, ...props }) {
|
|
|
57
57
|
});
|
|
58
58
|
}
|
|
59
59
|
/**
|
|
60
|
-
* How a run labels itself anywhere it appears:
|
|
61
|
-
*
|
|
62
|
-
*
|
|
63
|
-
* same. The caller owns the surrounding row (a link, a bar title).
|
|
60
|
+
* How a run labels itself anywhere it appears: one status mark followed by its
|
|
61
|
+
* name and live status line. The selector and drill-in bar share this so what a
|
|
62
|
+
* person clicks and what they land on read the same.
|
|
64
63
|
*/
|
|
65
64
|
function SubagentRunLabel({ run }) {
|
|
66
|
-
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
"
|
|
71
|
-
children:
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
})]
|
|
78
|
-
}),
|
|
79
|
-
/* @__PURE__ */ jsx(SubagentRunIndicator, { run })
|
|
80
|
-
] });
|
|
65
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx(SubagentRunIndicator, { run }), /* @__PURE__ */ jsxs("span", {
|
|
66
|
+
className: "subagent-run__text",
|
|
67
|
+
"data-status": run.status,
|
|
68
|
+
children: [/* @__PURE__ */ jsx("span", {
|
|
69
|
+
className: "subagent-run__title sigvelo-truncate",
|
|
70
|
+
children: getSubagentRunName(run)
|
|
71
|
+
}), /* @__PURE__ */ jsx("span", {
|
|
72
|
+
className: "subagent-run__status sigvelo-truncate",
|
|
73
|
+
children: getSubagentRunStatusText(run)
|
|
74
|
+
})]
|
|
75
|
+
})] });
|
|
81
76
|
}
|
|
82
77
|
//#endregion
|
|
83
78
|
export { SubagentRunIndicator, SubagentRunLabel, getSubagentRunName, getSubagentRunStatusText };
|
|
@@ -1,18 +1,21 @@
|
|
|
1
|
+
import { n as AgentToolRunValue } from "../../AgentToolRunsContext-GMe_hSnD.js";
|
|
1
2
|
import * as React from "react";
|
|
2
3
|
import { UIMessage } from "ai";
|
|
3
|
-
import { AgentToolRunPart
|
|
4
|
+
import { AgentToolRunPart } from "agents/agent-tools";
|
|
4
5
|
|
|
5
6
|
//#region src/components/agents-sdk/SubagentRunList.d.ts
|
|
6
7
|
interface SubagentRunListProps<Part extends AgentToolRunPart = UIMessage["parts"][number]> extends Omit<React.HTMLAttributes<HTMLUListElement>, "children" | "onSelect"> {
|
|
7
8
|
/** Complete retained runs returned by `useAgentToolEvents()`, in display order. */
|
|
8
|
-
runs: readonly
|
|
9
|
+
runs: readonly AgentToolRunValue<Part>[];
|
|
9
10
|
/** App-authored TanStack Router Link for every retained run destination. */
|
|
10
|
-
renderRunLink: (run:
|
|
11
|
+
renderRunLink: (run: AgentToolRunValue<Part>) => React.ReactElement;
|
|
12
|
+
selectedRunId?: string;
|
|
11
13
|
}
|
|
12
14
|
/** Semantic, wrapping list of retained-run selectors. */
|
|
13
15
|
declare function SubagentRunList<Part extends AgentToolRunPart = UIMessage["parts"][number]>({
|
|
14
16
|
className,
|
|
15
17
|
renderRunLink,
|
|
18
|
+
selectedRunId,
|
|
16
19
|
runs,
|
|
17
20
|
ref,
|
|
18
21
|
...props
|
|
@@ -4,7 +4,7 @@ import "react";
|
|
|
4
4
|
import { jsx } from "react/jsx-runtime";
|
|
5
5
|
//#region src/components/agents-sdk/SubagentRunList.tsx
|
|
6
6
|
/** Semantic, wrapping list of retained-run selectors. */
|
|
7
|
-
function SubagentRunList({ className, renderRunLink, runs, ref, ...props }) {
|
|
7
|
+
function SubagentRunList({ className, renderRunLink, selectedRunId, runs, ref, ...props }) {
|
|
8
8
|
return /* @__PURE__ */ jsx("ul", {
|
|
9
9
|
ref,
|
|
10
10
|
"data-slot": "subagent-run-list",
|
|
@@ -13,9 +13,11 @@ function SubagentRunList({ className, renderRunLink, runs, ref, ...props }) {
|
|
|
13
13
|
role: "list",
|
|
14
14
|
children: runs.map((run) => /* @__PURE__ */ jsx("li", {
|
|
15
15
|
className: "subagent-run__list-item",
|
|
16
|
+
"data-run-id": run.runId,
|
|
16
17
|
children: /* @__PURE__ */ jsx(SubagentRunSelector, {
|
|
17
18
|
run,
|
|
18
|
-
render: renderRunLink(run)
|
|
19
|
+
render: renderRunLink(run),
|
|
20
|
+
"aria-current": run.runId === selectedRunId ? "page" : void 0
|
|
19
21
|
})
|
|
20
22
|
}, run.runId))
|
|
21
23
|
});
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import { n as AgentToolRunValue, t as AgentToolEventsValue } from "../../AgentToolRunsContext-GMe_hSnD.js";
|
|
2
|
+
import { ExpansionStore } from "../ai-sdk/ExpansionState.js";
|
|
3
|
+
import * as React from "react";
|
|
4
|
+
import { AgentToolRunPart } from "agents/agent-tools";
|
|
5
|
+
|
|
6
|
+
//#region src/components/agents-sdk/SubagentRunPanel.d.ts
|
|
7
|
+
interface CommandState {
|
|
8
|
+
pending: boolean;
|
|
9
|
+
error?: string;
|
|
10
|
+
}
|
|
11
|
+
/** Controlled collection facts supplied by the connection owner. */
|
|
12
|
+
interface SubagentRunCollectionState {
|
|
13
|
+
status: "loading" | "ready" | "error";
|
|
14
|
+
stale: boolean;
|
|
15
|
+
error?: string;
|
|
16
|
+
}
|
|
17
|
+
interface SubagentRunPanelProviderProps {
|
|
18
|
+
/** The one upstream event-hook value from the parent connection. */
|
|
19
|
+
agentTools: AgentToolEventsValue<AgentToolRunPart>;
|
|
20
|
+
collection: SubagentRunCollectionState;
|
|
21
|
+
/** The host's native execution predicate; presentation does not own cancellation policy. */
|
|
22
|
+
mayExecute: (run: AgentToolRunValue) => boolean;
|
|
23
|
+
selectedRunId?: string;
|
|
24
|
+
parentRunning: boolean;
|
|
25
|
+
onStopCurrentWork: () => Promise<void>;
|
|
26
|
+
onStopRun: (runId: string) => Promise<void>;
|
|
27
|
+
children: React.ReactNode;
|
|
28
|
+
}
|
|
29
|
+
interface SubagentRunPanelValue extends Pick<SubagentRunPanelProviderProps, "agentTools" | "collection" | "mayExecute" | "selectedRunId" | "parentRunning"> {
|
|
30
|
+
open: boolean;
|
|
31
|
+
setOpen: (open: boolean) => void;
|
|
32
|
+
hiddenCompleted: ReadonlySet<string>;
|
|
33
|
+
setHiddenCompleted: (ids: ReadonlySet<string>) => void;
|
|
34
|
+
reportDisclosures: ExpansionStore;
|
|
35
|
+
restoreFocusRunId: React.RefObject<string | undefined>;
|
|
36
|
+
commands: Readonly<Record<string, CommandState>>;
|
|
37
|
+
stopCurrentWork: () => Promise<void>;
|
|
38
|
+
stopRun: (runId: string) => Promise<void>;
|
|
39
|
+
}
|
|
40
|
+
/** A thread's transient controls/disclosure state; run facts remain in the SDK value. */
|
|
41
|
+
declare function SubagentRunPanelProvider({
|
|
42
|
+
agentTools,
|
|
43
|
+
collection,
|
|
44
|
+
mayExecute,
|
|
45
|
+
selectedRunId,
|
|
46
|
+
parentRunning,
|
|
47
|
+
onStopCurrentWork,
|
|
48
|
+
onStopRun,
|
|
49
|
+
children
|
|
50
|
+
}: SubagentRunPanelProviderProps): React.JSX.Element;
|
|
51
|
+
declare function useOptionalSubagentRunPanel(): SubagentRunPanelValue | null;
|
|
52
|
+
interface SubagentRunPanelProps {
|
|
53
|
+
renderRunLink: (run: AgentToolRunValue) => React.ReactElement;
|
|
54
|
+
}
|
|
55
|
+
/** Parent-scoped run queue composed beside queued prompts above the parent composer. */
|
|
56
|
+
declare function SubagentRunPanel({
|
|
57
|
+
renderRunLink
|
|
58
|
+
}: SubagentRunPanelProps): React.JSX.Element | null;
|
|
59
|
+
//#endregion
|
|
60
|
+
export { SubagentRunCollectionState, SubagentRunPanel, SubagentRunPanelProps, SubagentRunPanelProvider, SubagentRunPanelProviderProps, useOptionalSubagentRunPanel };
|
|
@@ -0,0 +1,255 @@
|
|
|
1
|
+
import { createExpansionStore } from "../ai-sdk/ExpansionState.js";
|
|
2
|
+
import { Button } from "../foundations/Button.js";
|
|
3
|
+
import { getSubagentRunName } from "./SubagentRunIndicator.js";
|
|
4
|
+
import { useOptionalAgentChatQueue } from "./AgentChatQueue.js";
|
|
5
|
+
import { Queue, QueueItem, QueueItemAction, QueueItemActions, QueueItemContent, QueueItemDescription, QueueList, QueueSection, QueueSectionActions, QueueSectionContent, QueueSectionLabel, QueueSectionTrigger } from "../ai-sdk/Queue.js";
|
|
6
|
+
import { AgentChatNotice, AgentChatPromptTray } from "./AgentChat.js";
|
|
7
|
+
import { SubagentRunSelector } from "./SubagentRunSelector.js";
|
|
8
|
+
import * as React from "react";
|
|
9
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
10
|
+
//#region src/components/agents-sdk/SubagentRunPanel.tsx
|
|
11
|
+
const IDLE = { pending: false };
|
|
12
|
+
const SubagentRunPanelContext = React.createContext(null);
|
|
13
|
+
/** A thread's transient controls/disclosure state; run facts remain in the SDK value. */
|
|
14
|
+
function SubagentRunPanelProvider({ agentTools, collection, mayExecute, selectedRunId, parentRunning, onStopCurrentWork, onStopRun, children }) {
|
|
15
|
+
const [open, setOpen] = React.useState(true);
|
|
16
|
+
const [reportDisclosures] = React.useState(createExpansionStore);
|
|
17
|
+
const [hiddenCompleted, setHiddenCompleted] = React.useState(/* @__PURE__ */ new Set());
|
|
18
|
+
const [commands, setCommands] = React.useState({});
|
|
19
|
+
const inFlight = React.useRef(/* @__PURE__ */ new Map());
|
|
20
|
+
const restoreFocusRunId = React.useRef(selectedRunId);
|
|
21
|
+
React.useLayoutEffect(() => {
|
|
22
|
+
if (selectedRunId) restoreFocusRunId.current = selectedRunId;
|
|
23
|
+
}, [selectedRunId]);
|
|
24
|
+
const execute = React.useCallback((key, command) => {
|
|
25
|
+
const pending = inFlight.current.get(key);
|
|
26
|
+
if (pending) return pending;
|
|
27
|
+
setCommands((current) => ({
|
|
28
|
+
...current,
|
|
29
|
+
[key]: { pending: true }
|
|
30
|
+
}));
|
|
31
|
+
const operation = Promise.resolve().then(command).then(() => setCommands((current) => ({
|
|
32
|
+
...current,
|
|
33
|
+
[key]: IDLE
|
|
34
|
+
})), (cause) => {
|
|
35
|
+
const error = cause instanceof Error ? cause.message : "Stop could not be confirmed. Try again.";
|
|
36
|
+
setCommands((current) => ({
|
|
37
|
+
...current,
|
|
38
|
+
[key]: {
|
|
39
|
+
pending: false,
|
|
40
|
+
error
|
|
41
|
+
}
|
|
42
|
+
}));
|
|
43
|
+
throw cause;
|
|
44
|
+
}).finally(() => inFlight.current.delete(key));
|
|
45
|
+
inFlight.current.set(key, operation);
|
|
46
|
+
return operation;
|
|
47
|
+
}, []);
|
|
48
|
+
const stopCurrentWork = React.useCallback(() => execute("current-work", onStopCurrentWork), [execute, onStopCurrentWork]);
|
|
49
|
+
const stopRun = React.useCallback((id) => execute(id, () => onStopRun(id)), [execute, onStopRun]);
|
|
50
|
+
const value = React.useMemo(() => ({
|
|
51
|
+
agentTools,
|
|
52
|
+
collection,
|
|
53
|
+
mayExecute,
|
|
54
|
+
selectedRunId,
|
|
55
|
+
parentRunning,
|
|
56
|
+
open,
|
|
57
|
+
setOpen,
|
|
58
|
+
hiddenCompleted,
|
|
59
|
+
setHiddenCompleted,
|
|
60
|
+
reportDisclosures,
|
|
61
|
+
restoreFocusRunId,
|
|
62
|
+
commands,
|
|
63
|
+
stopCurrentWork,
|
|
64
|
+
stopRun
|
|
65
|
+
}), [
|
|
66
|
+
agentTools,
|
|
67
|
+
collection,
|
|
68
|
+
mayExecute,
|
|
69
|
+
selectedRunId,
|
|
70
|
+
parentRunning,
|
|
71
|
+
open,
|
|
72
|
+
hiddenCompleted,
|
|
73
|
+
reportDisclosures,
|
|
74
|
+
commands,
|
|
75
|
+
stopCurrentWork,
|
|
76
|
+
stopRun
|
|
77
|
+
]);
|
|
78
|
+
return /* @__PURE__ */ jsx(SubagentRunPanelContext.Provider, {
|
|
79
|
+
value,
|
|
80
|
+
children
|
|
81
|
+
});
|
|
82
|
+
}
|
|
83
|
+
function useOptionalSubagentRunPanel() {
|
|
84
|
+
return React.useContext(SubagentRunPanelContext);
|
|
85
|
+
}
|
|
86
|
+
function getSubagentRunRows(panel) {
|
|
87
|
+
const runs = Object.values(panel.agentTools.runsById).sort((a, b) => Number(!panel.mayExecute(a)) - Number(!panel.mayExecute(b)) || a.order - b.order);
|
|
88
|
+
return {
|
|
89
|
+
runs,
|
|
90
|
+
active: runs.filter(panel.mayExecute),
|
|
91
|
+
completed: runs.filter((run) => !panel.mayExecute(run)),
|
|
92
|
+
visible: runs.filter((run) => !panel.hiddenCompleted.has(run.runId) || panel.mayExecute(run))
|
|
93
|
+
};
|
|
94
|
+
}
|
|
95
|
+
function useSubagentRunFocus(panel, visible) {
|
|
96
|
+
const rootRef = React.useRef(null);
|
|
97
|
+
const focusedControl = React.useRef(null);
|
|
98
|
+
const [focusedOrder, setFocusedOrder] = React.useState(null);
|
|
99
|
+
const ranks = focusedOrder ? new Map(focusedOrder.map((id, index) => [id, index])) : null;
|
|
100
|
+
const ordered = ranks ? visible.toSorted((a, b) => (ranks.get(a.runId) ?? Infinity) - (ranks.get(b.runId) ?? Infinity)) : visible;
|
|
101
|
+
React.useLayoutEffect(() => {
|
|
102
|
+
const previous = focusedControl.current;
|
|
103
|
+
if (!previous || previous.element.isConnected || document.activeElement !== document.body) return;
|
|
104
|
+
(Array.from(rootRef.current?.querySelectorAll("[data-run-id]") ?? []).find((element) => element.dataset.runId === previous.runId)?.querySelector("a") ?? rootRef.current?.querySelector("[data-slot=\"subagent-run-panel-trigger\"]"))?.focus({ preventScroll: true });
|
|
105
|
+
});
|
|
106
|
+
React.useEffect(() => {
|
|
107
|
+
const focusId = panel.restoreFocusRunId.current;
|
|
108
|
+
const root = rootRef.current;
|
|
109
|
+
if (panel.selectedRunId || !root) return;
|
|
110
|
+
if (!focusId) return;
|
|
111
|
+
(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 });
|
|
112
|
+
panel.restoreFocusRunId.current = void 0;
|
|
113
|
+
}, [panel.restoreFocusRunId, panel.selectedRunId]);
|
|
114
|
+
const onFocusCapture = (event) => {
|
|
115
|
+
focusedControl.current = {
|
|
116
|
+
element: event.target,
|
|
117
|
+
runId: event.target.closest("[data-run-id]")?.dataset.runId
|
|
118
|
+
};
|
|
119
|
+
if (!focusedOrder && event.target.closest("[data-run-id]")) setFocusedOrder(ordered.map((run) => run.runId));
|
|
120
|
+
};
|
|
121
|
+
const onBlurCapture = (event) => {
|
|
122
|
+
if (!event.currentTarget.contains(event.relatedTarget)) {
|
|
123
|
+
focusedControl.current = null;
|
|
124
|
+
setFocusedOrder(null);
|
|
125
|
+
}
|
|
126
|
+
};
|
|
127
|
+
return {
|
|
128
|
+
rootRef,
|
|
129
|
+
ordered,
|
|
130
|
+
onFocusCapture,
|
|
131
|
+
onBlurCapture
|
|
132
|
+
};
|
|
133
|
+
}
|
|
134
|
+
function delegatedWorkLabel(active, completed) {
|
|
135
|
+
const counts = [active ? `${active} active` : null, completed ? `${completed} finished` : null].filter(Boolean).join(", ");
|
|
136
|
+
return `Delegated work${counts ? `, ${counts}` : ""}`;
|
|
137
|
+
}
|
|
138
|
+
function SubagentRunPanelControls({ panel, active, completed }) {
|
|
139
|
+
const queue = useOptionalAgentChatQueue();
|
|
140
|
+
const stop = panel.commands["current-work"] ?? IDLE;
|
|
141
|
+
const canStop = panel.parentRunning || active > 1 || panel.collection.status !== "ready";
|
|
142
|
+
if (!canStop && !stop.error && !stop.pending && !completed.length) return null;
|
|
143
|
+
return /* @__PURE__ */ jsxs(QueueSectionActions, {
|
|
144
|
+
"aria-label": "Delegated work controls",
|
|
145
|
+
children: [canStop || stop.error || stop.pending ? /* @__PURE__ */ jsx(Button, {
|
|
146
|
+
size: "xs",
|
|
147
|
+
variant: "ghost",
|
|
148
|
+
color: "neutral",
|
|
149
|
+
disabled: stop.pending,
|
|
150
|
+
focusableWhenDisabled: true,
|
|
151
|
+
"aria-busy": stop.pending,
|
|
152
|
+
onClick: () => {
|
|
153
|
+
queue?.hold();
|
|
154
|
+
panel.stopCurrentWork().catch(() => void 0);
|
|
155
|
+
},
|
|
156
|
+
children: stop.pending ? "Stopping current work…" : "Stop current work"
|
|
157
|
+
}) : null, completed.length ? /* @__PURE__ */ jsx(Button, {
|
|
158
|
+
size: "xs",
|
|
159
|
+
variant: "ghost",
|
|
160
|
+
color: "neutral",
|
|
161
|
+
onClick: () => panel.setHiddenCompleted(panel.hiddenCompleted.size ? /* @__PURE__ */ new Set() : new Set(completed.map((run) => run.runId))),
|
|
162
|
+
children: panel.hiddenCompleted.size ? `Show completed (${completed.length})` : "Hide completed"
|
|
163
|
+
}) : null]
|
|
164
|
+
});
|
|
165
|
+
}
|
|
166
|
+
function SubagentRunRow({ panel, run, renderRunLink }) {
|
|
167
|
+
const command = panel.commands[run.runId] ?? IDLE;
|
|
168
|
+
const actionable = panel.mayExecute(run) || command.error || command.pending;
|
|
169
|
+
return /* @__PURE__ */ jsxs(QueueItem, {
|
|
170
|
+
"data-run-id": run.runId,
|
|
171
|
+
children: [/* @__PURE__ */ jsxs(QueueItemContent, { children: [/* @__PURE__ */ jsx(SubagentRunSelector, {
|
|
172
|
+
run,
|
|
173
|
+
render: renderRunLink(run),
|
|
174
|
+
surface: "plain",
|
|
175
|
+
"aria-current": run.runId === panel.selectedRunId ? "page" : void 0
|
|
176
|
+
}), command.error ? /* @__PURE__ */ jsx(QueueItemDescription, {
|
|
177
|
+
role: "alert",
|
|
178
|
+
children: command.error
|
|
179
|
+
}) : null] }), actionable ? /* @__PURE__ */ jsx(QueueItemActions, {
|
|
180
|
+
persistent: true,
|
|
181
|
+
children: /* @__PURE__ */ jsx(QueueItemAction, {
|
|
182
|
+
disabled: command.pending,
|
|
183
|
+
focusableWhenDisabled: true,
|
|
184
|
+
"aria-busy": command.pending,
|
|
185
|
+
"aria-label": `Stop ${getSubagentRunName(run)}`,
|
|
186
|
+
onClick: () => {
|
|
187
|
+
panel.stopRun(run.runId).catch(() => void 0);
|
|
188
|
+
},
|
|
189
|
+
children: command.pending ? "Stopping…" : "Stop"
|
|
190
|
+
})
|
|
191
|
+
}) : null]
|
|
192
|
+
});
|
|
193
|
+
}
|
|
194
|
+
function SubagentRunPanelContent({ panel, renderRunLink }) {
|
|
195
|
+
const { runs, active, completed, visible } = getSubagentRunRows(panel);
|
|
196
|
+
const focus = useSubagentRunFocus(panel, visible);
|
|
197
|
+
const stop = panel.commands["current-work"] ?? IDLE;
|
|
198
|
+
if (panel.collection.status === "ready" && !runs.length && !panel.parentRunning) return null;
|
|
199
|
+
return /* @__PURE__ */ jsx(AgentChatPromptTray, {
|
|
200
|
+
"data-subagent-run-panel": "",
|
|
201
|
+
children: /* @__PURE__ */ jsx(Queue, {
|
|
202
|
+
density: "compact",
|
|
203
|
+
children: /* @__PURE__ */ jsxs(QueueSection, {
|
|
204
|
+
ref: focus.rootRef,
|
|
205
|
+
open: panel.open,
|
|
206
|
+
onOpenChange: panel.setOpen,
|
|
207
|
+
onFocusCapture: focus.onFocusCapture,
|
|
208
|
+
onBlurCapture: focus.onBlurCapture,
|
|
209
|
+
children: [/* @__PURE__ */ jsx(QueueSectionTrigger, {
|
|
210
|
+
"data-slot": "subagent-run-panel-trigger",
|
|
211
|
+
"aria-label": delegatedWorkLabel(active.length, completed.length),
|
|
212
|
+
children: /* @__PURE__ */ jsx(QueueSectionLabel, {
|
|
213
|
+
count: runs.length || void 0,
|
|
214
|
+
children: "Delegated work"
|
|
215
|
+
})
|
|
216
|
+
}), /* @__PURE__ */ jsxs(QueueSectionContent, { children: [
|
|
217
|
+
stop.error ? /* @__PURE__ */ jsx(AgentChatNotice, {
|
|
218
|
+
"data-tone": "danger",
|
|
219
|
+
role: "alert",
|
|
220
|
+
children: stop.error
|
|
221
|
+
}) : null,
|
|
222
|
+
panel.collection.status === "loading" ? /* @__PURE__ */ jsx(AgentChatNotice, { children: panel.collection.stale ? "Reconnecting. Last known runs are shown." : "Loading delegated work…" }) : null,
|
|
223
|
+
panel.collection.status === "error" ? /* @__PURE__ */ jsx(AgentChatNotice, {
|
|
224
|
+
"data-tone": "danger",
|
|
225
|
+
role: "alert",
|
|
226
|
+
children: panel.collection.error ?? "Could not refresh delegated work. Last known runs are retained."
|
|
227
|
+
}) : null,
|
|
228
|
+
/* @__PURE__ */ jsx(QueueList, {
|
|
229
|
+
"aria-label": "Delegated work runs",
|
|
230
|
+
children: focus.ordered.map((run) => /* @__PURE__ */ jsx(SubagentRunRow, {
|
|
231
|
+
panel,
|
|
232
|
+
run,
|
|
233
|
+
renderRunLink
|
|
234
|
+
}, run.runId))
|
|
235
|
+
}),
|
|
236
|
+
/* @__PURE__ */ jsx(SubagentRunPanelControls, {
|
|
237
|
+
panel,
|
|
238
|
+
active: active.length,
|
|
239
|
+
completed
|
|
240
|
+
})
|
|
241
|
+
] })]
|
|
242
|
+
})
|
|
243
|
+
})
|
|
244
|
+
});
|
|
245
|
+
}
|
|
246
|
+
/** Parent-scoped run queue composed beside queued prompts above the parent composer. */
|
|
247
|
+
function SubagentRunPanel({ renderRunLink }) {
|
|
248
|
+
const panel = useOptionalSubagentRunPanel();
|
|
249
|
+
return panel ? /* @__PURE__ */ jsx(SubagentRunPanelContent, {
|
|
250
|
+
panel,
|
|
251
|
+
renderRunLink
|
|
252
|
+
}) : null;
|
|
253
|
+
}
|
|
254
|
+
//#endregion
|
|
255
|
+
export { SubagentRunPanel, SubagentRunPanelProvider, useOptionalSubagentRunPanel };
|
|
@@ -1,20 +1,23 @@
|
|
|
1
|
+
import { n as AgentToolRunValue } from "../../AgentToolRunsContext-GMe_hSnD.js";
|
|
1
2
|
import * as React from "react";
|
|
2
3
|
import { UIMessage } from "ai";
|
|
3
|
-
import { AgentToolRunPart
|
|
4
|
+
import { AgentToolRunPart } from "agents/agent-tools";
|
|
4
5
|
|
|
5
6
|
//#region src/components/agents-sdk/SubagentRunSelector.d.ts
|
|
6
7
|
interface SubagentRunSelectorProps<Part extends AgentToolRunPart = UIMessage["parts"][number]> extends Omit<React.AnchorHTMLAttributes<HTMLAnchorElement>, "children"> {
|
|
7
8
|
/** Complete retained-run state returned by `useAgentToolEvents()`. */
|
|
8
|
-
run:
|
|
9
|
+
run: AgentToolRunValue<Part>;
|
|
9
10
|
/** App-authored TanStack Router Link for this retained run. */
|
|
10
11
|
render: React.ReactElement;
|
|
11
12
|
/** Short supplementary status shown on hover and keyboard focus. `false` disables it. */
|
|
12
13
|
tooltip?: React.ReactNode | false;
|
|
14
|
+
/** Plain navigation rows sit on the containing panel's existing surface. */
|
|
15
|
+
surface?: "raised" | "plain";
|
|
13
16
|
}
|
|
14
17
|
/**
|
|
15
18
|
* Compact selector for a retained Cloudflare Agent Tool run.
|
|
16
19
|
*
|
|
17
|
-
* The component consumes `
|
|
20
|
+
* The component consumes `AgentToolRunValue` whole and derives its label and
|
|
18
21
|
* status from upstream fields. The application-authored Link routes
|
|
19
22
|
* `run.subAgent` to a run surface that replaces the conversation — the
|
|
20
23
|
* workspace drill-in pattern — with the top bar's back link as the way out;
|
|
@@ -26,11 +29,12 @@ declare function SubagentRunSelector<Part extends AgentToolRunPart = UIMessage["
|
|
|
26
29
|
render,
|
|
27
30
|
run,
|
|
28
31
|
tooltip,
|
|
32
|
+
surface,
|
|
29
33
|
ref,
|
|
30
34
|
"aria-label": ariaLabel,
|
|
31
35
|
...props
|
|
32
36
|
}: SubagentRunSelectorProps<Part> & {
|
|
33
|
-
ref?: React.Ref<HTMLAnchorElement>;
|
|
37
|
+
/** Ref forwarded to the component's rendered root element. */ref?: React.Ref<HTMLAnchorElement>;
|
|
34
38
|
}): React.JSX.Element;
|
|
35
39
|
//#endregion
|
|
36
40
|
export { SubagentRunSelector, SubagentRunSelectorProps };
|
|
@@ -9,26 +9,28 @@ import { jsx, jsxs } from "react/jsx-runtime";
|
|
|
9
9
|
/**
|
|
10
10
|
* Compact selector for a retained Cloudflare Agent Tool run.
|
|
11
11
|
*
|
|
12
|
-
* The component consumes `
|
|
12
|
+
* The component consumes `AgentToolRunValue` whole and derives its label and
|
|
13
13
|
* status from upstream fields. The application-authored Link routes
|
|
14
14
|
* `run.subAgent` to a run surface that replaces the conversation — the
|
|
15
15
|
* workspace drill-in pattern — with the top bar's back link as the way out;
|
|
16
16
|
* this component never invents a second transcript or expands child content
|
|
17
17
|
* inline.
|
|
18
18
|
*/
|
|
19
|
-
function SubagentRunSelector({ className, render, run, tooltip, ref, "aria-label": ariaLabel, ...props }) {
|
|
19
|
+
function SubagentRunSelector({ className, render, run, tooltip, surface = "raised", ref, "aria-label": ariaLabel, ...props }) {
|
|
20
20
|
const name = getSubagentRunName(run);
|
|
21
21
|
const link = /* @__PURE__ */ jsx(NavigationLink, {
|
|
22
22
|
ref,
|
|
23
23
|
render,
|
|
24
24
|
"data-slot": "subagent-run-selector",
|
|
25
25
|
"data-status": run.status,
|
|
26
|
+
"data-surface": surface,
|
|
26
27
|
className: cx(buttonVariants({
|
|
27
28
|
variant: "ghost",
|
|
28
29
|
color: "neutral",
|
|
29
30
|
size: "sm"
|
|
30
31
|
}), "subagent-run__selector", className),
|
|
31
32
|
"aria-label": ariaLabel ?? `Open ${name}, ${run.status}`,
|
|
33
|
+
"aria-description": getSubagentRunStatusText(run),
|
|
32
34
|
...props,
|
|
33
35
|
children: /* @__PURE__ */ jsx(SubagentRunLabel, { run })
|
|
34
36
|
});
|
|
@@ -1,2 +1,102 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
1
|
+
import { J as PromptInputMessage } from "../../PromptInput-C4Mofitz.js";
|
|
2
|
+
import { AgentMessageRenderPartContext } from "../ai-sdk/AgentMessageParts.js";
|
|
3
|
+
import { AgentChatMessageContentProps, AgentChatRootProps } from "./AgentChat.js";
|
|
4
|
+
import { UseSessionCompactionResult } from "./SessionCompaction.js";
|
|
5
|
+
import { ThinkChatActivity, ThinkChatActivityRendererOptions, createThinkChatActivityRenderer } from "./ThinkChatActivity.js";
|
|
6
|
+
import { ThinkChatValue } from "./ThinkChatContext.js";
|
|
7
|
+
import { WorkspaceFileRenderer } from "./WorkspaceMessageResponse.js";
|
|
8
|
+
import * as React from "react";
|
|
9
|
+
import { ChatStatus, UIMessage } from "ai";
|
|
10
|
+
import { DataTag, UndefinedInitialDataOptions } from "@tanstack/react-query";
|
|
11
|
+
import { PendingApproval, Think } from "@cloudflare/think";
|
|
12
|
+
import { AgentStub } from "agents/client";
|
|
13
|
+
|
|
14
|
+
//#region src/components/agents-sdk/ThinkChat.d.ts
|
|
15
|
+
type ThinkPendingExecutionApprovalsQueryKey = readonly ["think", sourceKey: string, "pending-approvals"];
|
|
16
|
+
type ThinkPendingExecutionApprovalsQueryOptions = UndefinedInitialDataOptions<readonly PendingApproval[], Error, readonly PendingApproval[], ThinkPendingExecutionApprovalsQueryKey> & {
|
|
17
|
+
queryKey: DataTag<ThinkPendingExecutionApprovalsQueryKey, readonly PendingApproval[], Error>;
|
|
18
|
+
};
|
|
19
|
+
/** Shared pending-approval options for components and TanStack Router loaders. */
|
|
20
|
+
declare function thinkPendingExecutionApprovalsQueryOptions(stub: AgentStub<Think>, sourceKey: string): ThinkPendingExecutionApprovalsQueryOptions;
|
|
21
|
+
declare function useThinkPendingExecutionApprovals(stub: AgentStub<Think>, sourceKey: string, refreshSignal?: unknown, enabled?: boolean): {
|
|
22
|
+
pendingApprovals: readonly PendingApproval[];
|
|
23
|
+
refreshPendingApprovals: () => Promise<void>;
|
|
24
|
+
};
|
|
25
|
+
/** The chat status shared by transcript, composer, and an external queue owner. */
|
|
26
|
+
declare function getThinkChatStatus<State = unknown, MessageT extends UIMessage = UIMessage>(chat: ThinkChatValue<State, MessageT>): ChatStatus;
|
|
27
|
+
interface ThinkChatRootProps<State = unknown, MessageT extends UIMessage = UIMessage> extends Omit<AgentChatRootProps<MessageT>, "messages" | "status" | "onSubmit" | "onStop" | "onRegenerate" | "onApprovalResponse"> {
|
|
28
|
+
/** Whole upstream hook value. Connections and subscriptions remain application-owned. */
|
|
29
|
+
chat: ThinkChatValue<State, MessageT>;
|
|
30
|
+
}
|
|
31
|
+
/** A single live adapter. It renders only explicit children and never opens another connection. */
|
|
32
|
+
declare function ThinkChatRoot<State = unknown, MessageT extends UIMessage = UIMessage>({
|
|
33
|
+
chat,
|
|
34
|
+
children,
|
|
35
|
+
...props
|
|
36
|
+
}: ThinkChatRootProps<State, MessageT>): React.JSX.Element;
|
|
37
|
+
/** Normalize composer references for the upstream transport, also usable before a conversation exists. */
|
|
38
|
+
declare function normalizeThinkPrompt({
|
|
39
|
+
text,
|
|
40
|
+
references
|
|
41
|
+
}: PromptInputMessage): string;
|
|
42
|
+
interface ThinkChatMessageContentProps<MessageT extends UIMessage = UIMessage> extends AgentChatMessageContentProps<MessageT>, ThinkChatActivityRendererOptions<MessageT> {
|
|
43
|
+
renderWorkspaceFile?: WorkspaceFileRenderer;
|
|
44
|
+
}
|
|
45
|
+
/** Think activity/workspace rendering, independent of transcript layout and message actions. */
|
|
46
|
+
declare function ThinkChatMessageContent<MessageT extends UIMessage = UIMessage>({
|
|
47
|
+
message,
|
|
48
|
+
renderPart,
|
|
49
|
+
excludeTools,
|
|
50
|
+
renderAgentToolRunLink,
|
|
51
|
+
toolRenderers,
|
|
52
|
+
renderWorkspaceFile
|
|
53
|
+
}: ThinkChatMessageContentProps<MessageT>): React.JSX.Element;
|
|
54
|
+
interface ThinkChatApprovalsProps {
|
|
55
|
+
stub: AgentStub<Think>;
|
|
56
|
+
sourceKey: string;
|
|
57
|
+
/** Chat parts that share the pending approvals discovered for this source. */
|
|
58
|
+
children: React.ReactNode;
|
|
59
|
+
}
|
|
60
|
+
/** Explicit durable discovery; policy and the decision to render a card remain with the caller. */
|
|
61
|
+
declare function ThinkChatApprovals({
|
|
62
|
+
stub,
|
|
63
|
+
sourceKey,
|
|
64
|
+
children
|
|
65
|
+
}: ThinkChatApprovalsProps): React.JSX.Element;
|
|
66
|
+
declare function ThinkChatRecoveryNotice(): React.JSX.Element;
|
|
67
|
+
declare function ThinkChatCompactionNotice({
|
|
68
|
+
compaction
|
|
69
|
+
}: {
|
|
70
|
+
compaction: UseSessionCompactionResult;
|
|
71
|
+
}): React.JSX.Element;
|
|
72
|
+
declare function useThinkChat<State = unknown, MessageT extends UIMessage = UIMessage>(): Omit<import("@ai-sdk/react").UseChatHelpers<MessageT>, "addToolOutput"> & {
|
|
73
|
+
clearHistory: () => void;
|
|
74
|
+
addToolOutput: (opts: {
|
|
75
|
+
toolCallId: string;
|
|
76
|
+
toolName?: string;
|
|
77
|
+
output?: unknown;
|
|
78
|
+
state?: "output-available" | "output-error";
|
|
79
|
+
errorText?: string;
|
|
80
|
+
}) => void;
|
|
81
|
+
isServerStreaming: boolean;
|
|
82
|
+
isStreaming: boolean;
|
|
83
|
+
isRecovering: boolean;
|
|
84
|
+
isToolContinuation: boolean;
|
|
85
|
+
connectionError: (Error & {
|
|
86
|
+
code: number;
|
|
87
|
+
reason: string;
|
|
88
|
+
wasClean: boolean;
|
|
89
|
+
}) | null;
|
|
90
|
+
};
|
|
91
|
+
declare const ThinkChat: {
|
|
92
|
+
Root: typeof ThinkChatRoot;
|
|
93
|
+
MessageContent: typeof ThinkChatMessageContent;
|
|
94
|
+
Approvals: typeof ThinkChatApprovals;
|
|
95
|
+
RecoveryNotice: typeof ThinkChatRecoveryNotice;
|
|
96
|
+
CompactionNotice: typeof ThinkChatCompactionNotice;
|
|
97
|
+
Activity: typeof ThinkChatActivity;
|
|
98
|
+
renderActivityPart: (context: AgentMessageRenderPartContext<UIMessage<unknown, import("ai").UIDataTypes, import("ai").UITools>>) => React.ReactNode | undefined;
|
|
99
|
+
createActivityRenderer: typeof createThinkChatActivityRenderer;
|
|
100
|
+
};
|
|
101
|
+
//#endregion
|
|
102
|
+
export { ThinkChat, ThinkChatApprovals, ThinkChatApprovalsProps, ThinkChatCompactionNotice, ThinkChatMessageContent, ThinkChatMessageContentProps, ThinkChatRecoveryNotice, ThinkChatRoot, ThinkChatRootProps, ThinkPendingExecutionApprovalsQueryKey, ThinkPendingExecutionApprovalsQueryOptions, getThinkChatStatus, normalizeThinkPrompt, thinkPendingExecutionApprovalsQueryOptions, useThinkChat, useThinkPendingExecutionApprovals };
|