@mcp-b/react-components 0.48.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-BSJl682D.js → CodeBlock-g8sADidM.js} +8 -8
- package/dist/{FileTree-DvE0hNZu.js → FileTree-H8mMg4rV.js} +21 -30
- 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-LIoU30n7.d.ts → Workspace-HzGrWDX3.d.ts} +1 -1
- package/dist/{WorkspaceFile-Dq-GC0_T.d.ts → WorkspaceFile-Bouauobc.d.ts} +1 -1
- package/dist/{WorkspaceFileView-C_WnYm-a.js → WorkspaceFileView-DYPtRVpM.js} +5 -4
- package/dist/{WorkspaceLink-B1d2GIGl.js → WorkspaceLink-BYZG-V_I.js} +8 -91
- package/dist/{WorkspaceMessageResponse-BqOezptB.js → WorkspaceMessageResponse-CUJk9_P5.js} +2 -2
- package/dist/components/agents-sdk/AgentActivity.js +1 -1
- package/dist/components/agents-sdk/AgentChat.d.ts +198 -2
- package/dist/components/agents-sdk/AgentChat.js +527 -672
- 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 +2 -2
- 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 +22 -14
- package/dist/components/agents-sdk/BrowserLiveView.js +1 -1
- package/dist/components/agents-sdk/BrowserReplay.d.ts +1 -1
- package/dist/components/agents-sdk/BrowserReplay.js +1 -1
- package/dist/components/agents-sdk/BrowserRunPanel.d.ts +3 -0
- package/dist/components/agents-sdk/BrowserRunPanel.js +32 -31
- 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 +79 -40
- package/dist/components/agents-sdk/ManagerOffice.js +291 -281
- package/dist/components/agents-sdk/McpConnectionRequest.d.ts +4 -4
- package/dist/components/agents-sdk/McpConnectionRequest.js +4 -3
- package/dist/components/agents-sdk/McpConnectorForm.d.ts +38 -1
- package/dist/components/agents-sdk/McpConnectorForm.js +1 -1
- package/dist/components/agents-sdk/McpPluginCatalog.d.ts +93 -1
- package/dist/components/agents-sdk/McpPluginCatalog.js +5 -4
- 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 +4 -3
- package/dist/components/agents-sdk/ModelSelector.d.ts +4 -4
- package/dist/components/agents-sdk/ModelSelector.js +4 -4
- package/dist/components/agents-sdk/PromptInputApproval.d.ts +1 -43
- package/dist/components/agents-sdk/PromptInputApproval.js +1 -1
- package/dist/components/agents-sdk/PromptInputCommands.d.ts +1 -1
- package/dist/components/agents-sdk/PromptInputCommands.js +2 -3
- 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 +19 -24
- 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 +5 -3
- 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 +18 -10
- 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 +24 -19
- package/dist/components/agents-sdk/ThinkExecutionDetail.js +2 -2
- package/dist/components/agents-sdk/ThinkExecutionStatus.d.ts +1 -1
- package/dist/components/agents-sdk/ThinkExecutionStatus.js +1 -1
- package/dist/components/agents-sdk/ThinkExecutionWorkbench.d.ts +85 -28
- package/dist/components/agents-sdk/ThinkExecutionWorkbench.js +159 -102
- package/dist/components/agents-sdk/ThinkFullApp.d.ts +40 -158
- package/dist/components/agents-sdk/ThinkFullApp.js +71 -290
- package/dist/components/agents-sdk/ThinkRecoveryNotice.d.ts +18 -1
- package/dist/components/agents-sdk/ThinkRecoveryNotice.js +1 -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 +17 -15
- package/dist/components/agents-sdk/ThinkRoutineDetail.js +11 -11
- package/dist/components/agents-sdk/ThinkRoutineForm.d.ts +2 -1
- package/dist/components/agents-sdk/ThinkRoutineForm.js +14 -14
- package/dist/components/agents-sdk/ThinkRoutineRuns.js +7 -7
- package/dist/components/agents-sdk/ThinkThreadPicker.d.ts +90 -1
- package/dist/components/agents-sdk/ThinkThreadPicker.js +3 -3
- package/dist/components/agents-sdk/Workspace.d.ts +1 -1
- package/dist/components/agents-sdk/Workspace.js +7 -13
- 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 +1 -1
- package/dist/components/agents-sdk/WorkspaceCorrespondence.d.ts +10 -1
- package/dist/components/agents-sdk/WorkspaceCorrespondence.js +10 -7
- package/dist/components/agents-sdk/WorkspaceExecution.d.ts +5 -14
- package/dist/components/agents-sdk/WorkspaceExecution.js +24 -38
- 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/WorkspaceHeader.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/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 +6 -9
- 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 +5 -14
- package/dist/components/agents-sdk/WorkspaceProject.js +21 -35
- package/dist/components/agents-sdk/WorkspaceUserScript.d.ts +1 -1
- package/dist/components/agents-sdk/WorkspaceUserScript.js +8 -5
- package/dist/components/ai-sdk/Activity.d.ts +1 -1
- package/dist/components/ai-sdk/Activity.js +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 +64 -43
- 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/Approval.js +2 -2
- package/dist/components/ai-sdk/Artifact.d.ts +2 -2
- package/dist/components/ai-sdk/Artifact.js +1 -1
- package/dist/components/ai-sdk/ChainOfThought.d.ts +1 -1
- package/dist/components/ai-sdk/ChainOfThought.js +1 -1
- package/dist/components/ai-sdk/Checkpoint.js +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 +2 -3
- package/dist/components/ai-sdk/ConnectedAppCards.d.ts +9 -1
- package/dist/components/ai-sdk/ConnectedAppCards.js +28 -21
- 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/Conversation.js +1 -1
- package/dist/components/ai-sdk/Goal.d.ts +3 -3
- package/dist/components/ai-sdk/Goal.js +3 -3
- package/dist/components/ai-sdk/InlineCitation.d.ts +1 -1
- package/dist/components/ai-sdk/MediaPreviewCard.d.ts +1 -1
- package/dist/components/ai-sdk/MediaPreviewCard.js +1 -1
- package/dist/components/ai-sdk/Message.d.ts +2 -2
- package/dist/components/ai-sdk/Message.js +12 -3
- package/dist/components/ai-sdk/MessageScroller.d.ts +1 -1
- package/dist/components/ai-sdk/MessageScroller.js +1 -1
- package/dist/components/ai-sdk/MessageScrollerVirtual.d.ts +2 -76
- package/dist/components/ai-sdk/MessageScrollerVirtual.js +39 -5
- package/dist/components/ai-sdk/Plan.d.ts +1 -1
- package/dist/components/ai-sdk/Plan.js +1 -1
- package/dist/components/ai-sdk/PromptInput.d.ts +2 -2
- package/dist/components/ai-sdk/PromptInput.js +175 -231
- 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 +20 -5
- package/dist/components/ai-sdk/Reasoning.d.ts +1 -1
- package/dist/components/ai-sdk/Reasoning.js +5 -5
- package/dist/components/ai-sdk/Sources.d.ts +1 -1
- package/dist/components/ai-sdk/Sources.js +1 -1
- package/dist/components/ai-sdk/Task.d.ts +1 -1
- package/dist/components/ai-sdk/Task.js +1 -1
- package/dist/components/extension/ChatGptSignInScreen.d.ts +1 -1
- package/dist/components/extension/ChatGptSignInScreen.js +1 -1
- package/dist/components/extension/CodexModelSelector.d.ts +5 -0
- package/dist/components/extension/CodexModelSelector.js +2 -2
- package/dist/components/extension/ConversationTabPicker.d.ts +1 -0
- package/dist/components/extension/ConversationTabPicker.js +2 -2
- 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/Checkbox.js +1 -1
- package/dist/components/foundations/CheckboxGroup.d.ts +1 -1
- package/dist/components/foundations/Collapsible.d.ts +1 -1
- package/dist/components/foundations/Collapsible.js +1 -1
- package/dist/components/foundations/Combobox.js +6 -1
- package/dist/components/foundations/ContextMenu.js +1 -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/Menubar.js +1 -1
- 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/SearchField.js +1 -1
- package/dist/components/foundations/Select.js +7 -2
- package/dist/components/foundations/Separator.d.ts +1 -40
- package/dist/components/foundations/Stepper.d.ts +1 -1
- package/dist/components/foundations/Stepper.js +1 -1
- package/dist/components/foundations/Textarea.d.ts +1 -1
- package/dist/components/foundations/Toast.d.ts +5 -1
- package/dist/components/foundations/Toast.js +1 -1
- package/dist/components/foundations/Toggle.d.ts +70 -1
- package/dist/components/foundations/ToggleGroup.d.ts +4 -3
- package/dist/components/foundations/ToggleGroup.js +1 -1
- package/dist/components/foundations/Toolbar.d.ts +1 -151
- package/dist/components/foundations/TransitionSurface.d.ts +1 -1
- package/dist/components/foundations/icons.js +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 +2 -2
- package/dist/components/general-purpose/EnvironmentVariables.d.ts +2 -2
- package/dist/components/general-purpose/EnvironmentVariables.js +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/PricingPlanCard.d.ts +4 -0
- package/dist/components/general-purpose/PricingPlanCard.js +2 -2
- package/dist/components/general-purpose/PricingUsageCalculator.js +2 -2
- 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 +120 -102
- package/dist/components/general-purpose/SettingsFormDialog.d.ts +14 -27
- package/dist/components/general-purpose/SettingsFormDialog.js +42 -72
- 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 +11 -6
- package/dist/components/general-purpose/TestResults.d.ts +23 -11
- package/dist/components/general-purpose/TestResults.js +49 -51
- package/dist/components/general-purpose/ThemeModeControl.d.ts +2 -0
- package/dist/components/general-purpose/ThemeModeControl.js +2 -2
- package/dist/components/general-purpose/WebPreview.d.ts +29 -4
- package/dist/components/general-purpose/WebPreview.js +39 -14
- package/dist/components/nanites/AgentConnection.js +2 -2
- package/dist/components/nanites/AgentToolDetail.d.ts +13 -11
- package/dist/components/nanites/AgentToolDetail.js +21 -42
- package/dist/{copy-button-Dk2vRe9j.js → copy-button-CSDuDfdP.js} +1 -1
- 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 +1 -1
- 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/employee-chrome.css +43 -0
- package/dist/styles/file-tree.css +5 -0
- package/dist/styles/index.css +4 -2
- 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-GqsCYxqT.js → workspace-assets-Bg7XhPsk.js} +2 -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-DeTU9YpW.js +0 -77
- package/dist/ThinkChat-CwMdEum8.d.ts +0 -185
- package/dist/ThinkChat-DiI6hhDP.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-DfjH1Ypm.d.ts +0 -61
- 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
- package/dist/{icons-CeGfXO21.js → icons-cuEtsgj9.js} +1 -1
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import { i as useOptionalAgentChatQueue, n as AgentChatQueueProviderProps, r as AgentChatQueuedPrompt, t as AgentChatQueueProvider } from "../../AgentChatQueue-C_Jaw3Ia.js";
|
|
2
|
+
export { AgentChatQueueProvider, AgentChatQueueProviderProps, AgentChatQueuedPrompt, useOptionalAgentChatQueue };
|
|
@@ -0,0 +1,206 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import { jsx } from "react/jsx-runtime";
|
|
3
|
+
//#region src/components/agents-sdk/AgentChatQueue.tsx
|
|
4
|
+
const AgentChatQueueContext = React.createContext(null);
|
|
5
|
+
function useOptionalAgentChatQueue() {
|
|
6
|
+
return React.useContext(AgentChatQueueContext);
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* The queue's single owner, including dispatch reservations and the turn's
|
|
10
|
+
* busy-to-ready edge. Hoist it with the parent connection to preserve queued
|
|
11
|
+
* prompts and cancellation holds while the selected child is visible.
|
|
12
|
+
*/
|
|
13
|
+
function AgentChatQueueProvider({ children, status, onSubmit, onStop, onPromptQueued }) {
|
|
14
|
+
const [items, setItems] = React.useState([]);
|
|
15
|
+
const itemsRef = React.useRef(items);
|
|
16
|
+
const [held, setHeld] = React.useState(false);
|
|
17
|
+
const heldRef = React.useRef(false);
|
|
18
|
+
const holdRevision = React.useRef(0);
|
|
19
|
+
const [error, setError] = React.useState(null);
|
|
20
|
+
const [submissionVersion, setSubmissionVersion] = React.useState(0);
|
|
21
|
+
const [dispatchVersion, setDispatchVersion] = React.useState(0);
|
|
22
|
+
const drainRequested = React.useRef(false);
|
|
23
|
+
const busy = status === "submitted" || status === "streaming";
|
|
24
|
+
const busyRef = React.useRef(busy);
|
|
25
|
+
React.useLayoutEffect(() => {
|
|
26
|
+
busyRef.current = busy;
|
|
27
|
+
}, [busy]);
|
|
28
|
+
const wasBusy = React.useRef(busy);
|
|
29
|
+
const dispatching = React.useRef(null);
|
|
30
|
+
const updateItems = React.useCallback((next) => {
|
|
31
|
+
itemsRef.current = next;
|
|
32
|
+
setItems(next);
|
|
33
|
+
}, []);
|
|
34
|
+
const hold = React.useCallback(() => {
|
|
35
|
+
holdRevision.current += 1;
|
|
36
|
+
heldRef.current = true;
|
|
37
|
+
setHeld(true);
|
|
38
|
+
}, []);
|
|
39
|
+
const release = React.useCallback(() => {
|
|
40
|
+
heldRef.current = false;
|
|
41
|
+
setHeld(false);
|
|
42
|
+
setError(null);
|
|
43
|
+
}, []);
|
|
44
|
+
const send = React.useCallback((message) => {
|
|
45
|
+
const dispatch = Symbol();
|
|
46
|
+
dispatching.current = dispatch;
|
|
47
|
+
const finish = () => {
|
|
48
|
+
if (dispatching.current !== dispatch) return;
|
|
49
|
+
dispatching.current = null;
|
|
50
|
+
setDispatchVersion((version) => version + 1);
|
|
51
|
+
};
|
|
52
|
+
try {
|
|
53
|
+
const result = onSubmit?.(message);
|
|
54
|
+
if (result) return Promise.resolve(result).finally(finish);
|
|
55
|
+
finish();
|
|
56
|
+
} catch (cause) {
|
|
57
|
+
finish();
|
|
58
|
+
throw cause;
|
|
59
|
+
}
|
|
60
|
+
}, [onSubmit]);
|
|
61
|
+
const sendQueued = React.useEffectEvent(async (next) => {
|
|
62
|
+
if (dispatching.current || !onSubmit) return;
|
|
63
|
+
const dispatch = Symbol();
|
|
64
|
+
dispatching.current = dispatch;
|
|
65
|
+
setError(null);
|
|
66
|
+
drainRequested.current = false;
|
|
67
|
+
updateItems(itemsRef.current.filter((item) => item.id !== next.id));
|
|
68
|
+
try {
|
|
69
|
+
await onSubmit(next.message);
|
|
70
|
+
} catch (cause) {
|
|
71
|
+
updateItems([next, ...itemsRef.current]);
|
|
72
|
+
hold();
|
|
73
|
+
setError(cause instanceof Error ? cause.message : "Could not send queued message. Try again.");
|
|
74
|
+
} finally {
|
|
75
|
+
if (dispatching.current === dispatch) {
|
|
76
|
+
dispatching.current = null;
|
|
77
|
+
setDispatchVersion((version) => version + 1);
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
});
|
|
81
|
+
React.useEffect(() => {
|
|
82
|
+
if (wasBusy.current && !busy) drainRequested.current = true;
|
|
83
|
+
wasBusy.current = busy;
|
|
84
|
+
if (!busy && !held && drainRequested.current && items[0] && onSubmit && !dispatching.current) sendQueued(items[0]);
|
|
85
|
+
}, [
|
|
86
|
+
busy,
|
|
87
|
+
held,
|
|
88
|
+
items,
|
|
89
|
+
onSubmit,
|
|
90
|
+
dispatchVersion
|
|
91
|
+
]);
|
|
92
|
+
const submit = React.useCallback((message, revision = holdRevision.current) => {
|
|
93
|
+
setSubmissionVersion((version) => version + 1);
|
|
94
|
+
const wasHeld = heldRef.current;
|
|
95
|
+
if (wasHeld && revision !== holdRevision.current) {
|
|
96
|
+
updateItems([...itemsRef.current, {
|
|
97
|
+
id: crypto.randomUUID(),
|
|
98
|
+
message
|
|
99
|
+
}]);
|
|
100
|
+
onPromptQueued?.();
|
|
101
|
+
return;
|
|
102
|
+
}
|
|
103
|
+
release();
|
|
104
|
+
if (busyRef.current || dispatching.current || itemsRef.current.length > 0 && !wasHeld) {
|
|
105
|
+
updateItems([...itemsRef.current, {
|
|
106
|
+
id: crypto.randomUUID(),
|
|
107
|
+
message
|
|
108
|
+
}]);
|
|
109
|
+
onPromptQueued?.();
|
|
110
|
+
return;
|
|
111
|
+
}
|
|
112
|
+
drainRequested.current = false;
|
|
113
|
+
return send(message);
|
|
114
|
+
}, [
|
|
115
|
+
onPromptQueued,
|
|
116
|
+
release,
|
|
117
|
+
send,
|
|
118
|
+
updateItems
|
|
119
|
+
]);
|
|
120
|
+
const stop = React.useCallback(async () => {
|
|
121
|
+
hold();
|
|
122
|
+
try {
|
|
123
|
+
await onStop?.();
|
|
124
|
+
} catch (cause) {
|
|
125
|
+
setError(cause instanceof Error ? cause.message : "Stop could not be confirmed. Try again.");
|
|
126
|
+
throw cause;
|
|
127
|
+
}
|
|
128
|
+
}, [hold, onStop]);
|
|
129
|
+
const sendNext = React.useCallback((id) => {
|
|
130
|
+
if (busyRef.current || dispatching.current || !onSubmit) return;
|
|
131
|
+
const next = id ? itemsRef.current.find((item) => item.id === id) : itemsRef.current[0];
|
|
132
|
+
if (!next) return;
|
|
133
|
+
updateItems([next, ...itemsRef.current.filter((item) => item.id !== next.id)]);
|
|
134
|
+
release();
|
|
135
|
+
drainRequested.current = true;
|
|
136
|
+
setDispatchVersion((version) => version + 1);
|
|
137
|
+
}, [
|
|
138
|
+
onSubmit,
|
|
139
|
+
release,
|
|
140
|
+
updateItems
|
|
141
|
+
]);
|
|
142
|
+
const steer = React.useCallback(async (id) => {
|
|
143
|
+
const next = itemsRef.current.find((item) => item.id === id);
|
|
144
|
+
if (!next) return;
|
|
145
|
+
updateItems([next, ...itemsRef.current.filter((item) => item.id !== id)]);
|
|
146
|
+
hold();
|
|
147
|
+
const revision = holdRevision.current;
|
|
148
|
+
setError(null);
|
|
149
|
+
try {
|
|
150
|
+
if (busyRef.current) await onStop?.();
|
|
151
|
+
if (revision !== holdRevision.current) return;
|
|
152
|
+
release();
|
|
153
|
+
drainRequested.current = true;
|
|
154
|
+
setDispatchVersion((version) => version + 1);
|
|
155
|
+
} catch (cause) {
|
|
156
|
+
hold();
|
|
157
|
+
setError(cause instanceof Error ? cause.message : "Stop could not be confirmed. Try again.");
|
|
158
|
+
throw cause;
|
|
159
|
+
}
|
|
160
|
+
}, [
|
|
161
|
+
hold,
|
|
162
|
+
onStop,
|
|
163
|
+
release,
|
|
164
|
+
updateItems
|
|
165
|
+
]);
|
|
166
|
+
const captureSubmit = React.useCallback(() => {
|
|
167
|
+
const revision = holdRevision.current;
|
|
168
|
+
return (message) => submit(message, revision);
|
|
169
|
+
}, [submit]);
|
|
170
|
+
const remove = React.useCallback((id) => updateItems(itemsRef.current.filter((item) => item.id !== id)), [updateItems]);
|
|
171
|
+
const value = React.useMemo(() => ({
|
|
172
|
+
items,
|
|
173
|
+
held,
|
|
174
|
+
error,
|
|
175
|
+
submissionVersion,
|
|
176
|
+
canStop: Boolean(onStop),
|
|
177
|
+
canSubmit: Boolean(onSubmit),
|
|
178
|
+
hold,
|
|
179
|
+
submit,
|
|
180
|
+
captureSubmit,
|
|
181
|
+
stop,
|
|
182
|
+
steer,
|
|
183
|
+
sendNext,
|
|
184
|
+
remove
|
|
185
|
+
}), [
|
|
186
|
+
items,
|
|
187
|
+
held,
|
|
188
|
+
error,
|
|
189
|
+
submissionVersion,
|
|
190
|
+
onStop,
|
|
191
|
+
onSubmit,
|
|
192
|
+
hold,
|
|
193
|
+
submit,
|
|
194
|
+
captureSubmit,
|
|
195
|
+
stop,
|
|
196
|
+
steer,
|
|
197
|
+
sendNext,
|
|
198
|
+
remove
|
|
199
|
+
]);
|
|
200
|
+
return /* @__PURE__ */ jsx(AgentChatQueueContext.Provider, {
|
|
201
|
+
value,
|
|
202
|
+
children
|
|
203
|
+
});
|
|
204
|
+
}
|
|
205
|
+
//#endregion
|
|
206
|
+
export { AgentChatQueueProvider, useOptionalAgentChatQueue };
|
|
@@ -2,9 +2,9 @@ import { t as cx } from "../../class-names-BiMDVpUo.js";
|
|
|
2
2
|
import { Activity, ActivityContent, ActivityText, ActivityTrigger } from "../ai-sdk/Activity.js";
|
|
3
3
|
import { r as firstLine } from "../../format-COCyV98Z.js";
|
|
4
4
|
import { MessageResponse } from "../ai-sdk/Message.js";
|
|
5
|
-
import { NaniteMark } from "../nanites/NaniteScene.js";
|
|
6
|
-
import { getSubagentRunName } from "./SubagentRunIndicator.js";
|
|
7
5
|
import { useOptionalAgentToolRuns } from "./AgentToolRunsContext.js";
|
|
6
|
+
import { getSubagentRunName } from "./SubagentRunIndicator.js";
|
|
7
|
+
import { NaniteMark } from "../nanites/NaniteScene.js";
|
|
8
8
|
import "react";
|
|
9
9
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
10
10
|
import { isTextUIPart } from "ai";
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { a as useOptionalAgentToolRuns, i as AgentToolRunsProviderProps, n as
|
|
2
|
-
export {
|
|
1
|
+
import { a as useOptionalAgentToolRuns, i as AgentToolRunsProviderProps, n as AgentToolRunValue, r as AgentToolRunsProvider, t as AgentToolEventsValue } from "../../AgentToolRunsContext-GMe_hSnD.js";
|
|
2
|
+
export { AgentToolEventsValue, AgentToolRunValue, AgentToolRunsProvider, AgentToolRunsProviderProps, useOptionalAgentToolRuns };
|
|
@@ -1,41 +1,6 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
2
|
import { jsx } from "react/jsx-runtime";
|
|
3
|
-
import { useAgentToolEvents } from "agents/react";
|
|
4
3
|
//#region src/components/agents-sdk/AgentToolRunsContext.tsx
|
|
5
|
-
/**
|
|
6
|
-
* The one retained-run subscription for a parent connection: upstream
|
|
7
|
-
* `useAgentToolEvents` scoped to the connection's source identity, so runs
|
|
8
|
-
* from a previous thread cannot leak across a source swap. Call it beside the
|
|
9
|
-
* `useAgent` call that owns the connection — the server replays retained runs
|
|
10
|
-
* once per socket connect, so a later mount misses existing runs — and share
|
|
11
|
-
* the one value with every surface that reads runs (the chat shell and a
|
|
12
|
-
* run-detail route read the same projection, never two subscriptions).
|
|
13
|
-
*
|
|
14
|
-
* The subscription's listener attaches in a passive effect, after paint. A
|
|
15
|
-
* host whose transport is in-process (the browser extension's port bridge)
|
|
16
|
-
* can complete the connect and deliver the replay before that effect runs —
|
|
17
|
-
* reliably so on a hot return from a drill-in. The fix lives in the Agents
|
|
18
|
-
* SDK, not here: `useAgent` buffers `agent-tool-event` frames from socket
|
|
19
|
-
* construction and `useAgentToolEvents` drains them when its listener
|
|
20
|
-
* attaches (`_bufferAgentToolReplayFrame` is the seam for a non-`useAgent`
|
|
21
|
-
* socket). As of agents 0.21.0 that is still the browser host's vendored
|
|
22
|
-
* edit, not a published release; a host on the published package has to
|
|
23
|
-
* buffer and re-dispatch the frames around its own socket before this hook
|
|
24
|
-
* can see them. Network transports are not affected in practice: the round
|
|
25
|
-
* trip loses to the effect flush.
|
|
26
|
-
*/
|
|
27
|
-
function useSourceScopedAgentToolEvents(agent) {
|
|
28
|
-
const agentTools = useAgentToolEvents({ agent });
|
|
29
|
-
const sourceIdentity = JSON.stringify(agent.path);
|
|
30
|
-
const resetAgentTools = React.useEffectEvent(() => agentTools.resetLocalState());
|
|
31
|
-
const seenIdentity = React.useRef(sourceIdentity);
|
|
32
|
-
React.useEffect(() => {
|
|
33
|
-
if (seenIdentity.current === sourceIdentity) return;
|
|
34
|
-
seenIdentity.current = sourceIdentity;
|
|
35
|
-
resetAgentTools();
|
|
36
|
-
}, [sourceIdentity]);
|
|
37
|
-
return agentTools;
|
|
38
|
-
}
|
|
39
4
|
const AgentToolRunsContext = React.createContext(null);
|
|
40
5
|
/** Provides one parent connection's retained Agent Tool event projection. */
|
|
41
6
|
function AgentToolRunsProvider({ agentTools, children }) {
|
|
@@ -48,4 +13,4 @@ function useOptionalAgentToolRuns() {
|
|
|
48
13
|
return React.useContext(AgentToolRunsContext);
|
|
49
14
|
}
|
|
50
15
|
//#endregion
|
|
51
|
-
export { AgentToolRunsProvider, useOptionalAgentToolRuns
|
|
16
|
+
export { AgentToolRunsProvider, useOptionalAgentToolRuns };
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { E as KeyboardIcon, H as RefreshIcon, r as ArrowLeftIcon } from "../../icons-
|
|
1
|
+
import { E as KeyboardIcon, H as RefreshIcon, r as ArrowLeftIcon } from "../../icons-cuEtsgj9.js";
|
|
2
2
|
import { Button } from "../foundations/Button.js";
|
|
3
3
|
import { WebPreviewNavigationButton } from "../general-purpose/WebPreview.js";
|
|
4
4
|
import { BrowserLiveView } from "./BrowserLiveView.js";
|
|
5
5
|
import { BrowserRunPanel } from "./BrowserRunPanel.js";
|
|
6
|
-
import { useCallback, useEffect, useEffectEvent, useRef, useState } from "react";
|
|
6
|
+
import { useCallback, useEffect, useEffectEvent, useLayoutEffect, useRef, useState } from "react";
|
|
7
7
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
8
8
|
//#region src/components/agents-sdk/BrowserLiveScreen.tsx
|
|
9
9
|
const BROWSER_LIVE_SCREEN_NEGOTIATION_TIMEOUT_MS = 1e4;
|
|
@@ -17,6 +17,7 @@ const BROWSER_LIVE_SCREEN_NEGOTIATION_TIMEOUT_MS = 1e4;
|
|
|
17
17
|
function BrowserLiveScreen({ sendSignal: sendHostSignal, subscribeSignals, protocol, getIceServers, label = "Employee browser", controlLabel = "Control employee browser", tabs = [], requestedTabId }) {
|
|
18
18
|
const video = useRef(null);
|
|
19
19
|
const input = useRef(null);
|
|
20
|
+
const [inputElement, setInputElement] = useState(null);
|
|
20
21
|
const [videoElement, setVideoElement] = useState(null);
|
|
21
22
|
const track = useRef(null);
|
|
22
23
|
const attachVideo = useCallback((element) => {
|
|
@@ -54,11 +55,13 @@ function BrowserLiveScreen({ sendSignal: sendHostSignal, subscribeSignals, proto
|
|
|
54
55
|
const loadIceServers = useEffectEvent(async () => await getIceServers?.() ?? []);
|
|
55
56
|
const subscribe = useEffectEvent((listener) => subscribeSignals(listener));
|
|
56
57
|
const parseStatus = useEffectEvent((value) => protocol.parseStatus(value));
|
|
57
|
-
const
|
|
58
|
-
|
|
58
|
+
const currentProtocol = useRef(protocol);
|
|
59
|
+
useLayoutEffect(() => {
|
|
60
|
+
currentProtocol.current = protocol;
|
|
61
|
+
}, [protocol]);
|
|
59
62
|
const selectRequestedTab = useEffectEvent((data) => {
|
|
60
63
|
if (requestedTabId === void 0 || data?.readyState !== "open") return;
|
|
61
|
-
data.send(serializeCommand({
|
|
64
|
+
data.send(currentProtocol.current.serializeCommand({
|
|
62
65
|
kind: "selectTab",
|
|
63
66
|
tabId: requestedTabId
|
|
64
67
|
}));
|
|
@@ -93,11 +96,15 @@ function BrowserLiveScreen({ sendSignal: sendHostSignal, subscribeSignals, proto
|
|
|
93
96
|
}
|
|
94
97
|
const attachInput = useCallback((element) => {
|
|
95
98
|
if (input.current !== element) cancelPointerState();
|
|
96
|
-
input.current?.removeEventListener("wheel", handleWheel);
|
|
97
99
|
input.current = element;
|
|
98
|
-
element
|
|
100
|
+
setInputElement(element);
|
|
99
101
|
syncInputBounds();
|
|
100
102
|
}, []);
|
|
103
|
+
useEffect(() => {
|
|
104
|
+
if (!inputElement) return;
|
|
105
|
+
inputElement.addEventListener("wheel", handleWheel, { passive: false });
|
|
106
|
+
return () => inputElement.removeEventListener("wheel", handleWheel);
|
|
107
|
+
}, [inputElement]);
|
|
101
108
|
const [streamed, setStreamed] = useState(null);
|
|
102
109
|
useEffect(() => {
|
|
103
110
|
let disposed = false;
|
|
@@ -211,11 +218,12 @@ function BrowserLiveScreen({ sendSignal: sendHostSignal, subscribeSignals, proto
|
|
|
211
218
|
}
|
|
212
219
|
if (peer.connectionState === "failed" || peer.connectionState === "disconnected") scheduleReconnect();
|
|
213
220
|
};
|
|
214
|
-
const
|
|
215
|
-
channel.current =
|
|
216
|
-
|
|
217
|
-
selectRequestedTab(
|
|
218
|
-
|
|
221
|
+
const dataChannel = peer.createDataChannel(dataChannelLabel);
|
|
222
|
+
channel.current = dataChannel;
|
|
223
|
+
dataChannel.onopen = () => selectRequestedTab(dataChannel);
|
|
224
|
+
selectRequestedTab(dataChannel);
|
|
225
|
+
dataChannel.onmessage = (event) => {
|
|
226
|
+
if (disposed || peer !== connection || channel.current !== dataChannel) return;
|
|
219
227
|
const status = parseStatus(event.data);
|
|
220
228
|
if (!status) return;
|
|
221
229
|
if (status.kind === "idle") {
|
|
@@ -270,7 +278,7 @@ function BrowserLiveScreen({ sendSignal: sendHostSignal, subscribeSignals, proto
|
|
|
270
278
|
const open = channel.current;
|
|
271
279
|
const status = geometry.current;
|
|
272
280
|
if (open?.readyState !== "open" || !status || events.length === 0) return;
|
|
273
|
-
open.send(serializeInput({
|
|
281
|
+
open.send(currentProtocol.current.serializeInput({
|
|
274
282
|
tabId: status.tabId,
|
|
275
283
|
streamGeneration: status.streamGeneration,
|
|
276
284
|
events
|
|
@@ -283,7 +291,7 @@ function BrowserLiveScreen({ sendSignal: sendHostSignal, subscribeSignals, proto
|
|
|
283
291
|
function sendCommand(command) {
|
|
284
292
|
const open = channel.current;
|
|
285
293
|
if (open?.readyState !== "open") return;
|
|
286
|
-
open.send(serializeCommand(command));
|
|
294
|
+
open.send(currentProtocol.current.serializeCommand(command));
|
|
287
295
|
}
|
|
288
296
|
/**
|
|
289
297
|
* How the displayed picture maps to page CSS pixels, computed from the
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { t as cx } from "../../class-names-BiMDVpUo.js";
|
|
2
|
-
import { K as SpinnerIcon, _ as DotIcon, k as MaximizeIcon } from "../../icons-
|
|
2
|
+
import { K as SpinnerIcon, _ as DotIcon, k as MaximizeIcon } from "../../icons-cuEtsgj9.js";
|
|
3
3
|
import { Button } from "../foundations/Button.js";
|
|
4
4
|
import { Dialog } from "../foundations/Dialog.js";
|
|
5
5
|
import { TransitionSurface } from "../foundations/TransitionSurface.js";
|
|
@@ -35,7 +35,7 @@ declare function BrowserReplay({
|
|
|
35
35
|
ref,
|
|
36
36
|
...props
|
|
37
37
|
}: BrowserReplayProps & {
|
|
38
|
-
ref?: React.Ref<HTMLDivElement>;
|
|
38
|
+
/** Ref forwarded to the component's rendered root element. */ref?: React.Ref<HTMLDivElement>;
|
|
39
39
|
}): React.JSX.Element;
|
|
40
40
|
//#endregion
|
|
41
41
|
export { BrowserReplay, BrowserReplayProps };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { t as cx } from "../../class-names-BiMDVpUo.js";
|
|
2
|
-
import { L as PauseIcon, z as PlayIcon } from "../../icons-
|
|
2
|
+
import { L as PauseIcon, z as PlayIcon } from "../../icons-cuEtsgj9.js";
|
|
3
3
|
import { IconButton } from "../foundations/IconButton.js";
|
|
4
4
|
import { i as formatClock } from "../../format-COCyV98Z.js";
|
|
5
5
|
import { EmptyState } from "../foundations/EmptyState.js";
|
|
@@ -19,6 +19,7 @@ interface BrowserRunPanelCommonProps extends Omit<React.HTMLAttributes<HTMLDivEl
|
|
|
19
19
|
error?: React.ReactNode;
|
|
20
20
|
/** Panel heading. */
|
|
21
21
|
label?: React.ReactNode;
|
|
22
|
+
/** Ref forwarded to the panel's rendered root element. */
|
|
22
23
|
ref?: React.Ref<HTMLDivElement>;
|
|
23
24
|
}
|
|
24
25
|
interface BrowserRunPanelHostedProps extends BrowserRunPanelCommonProps {
|
|
@@ -62,7 +63,9 @@ interface BrowserRunPanelStreamedProps extends BrowserRunPanelCommonProps {
|
|
|
62
63
|
url?: string;
|
|
63
64
|
/** Commits an address-bar entry. Absent, the address bar is read-only. */
|
|
64
65
|
onOpenUrl?: (url: string) => void;
|
|
66
|
+
/** Placeholder shown when the streamed page has no current URL. */
|
|
65
67
|
urlPlaceholder?: string;
|
|
68
|
+
/** Disables address editing and navigation submission. */
|
|
66
69
|
urlDisabled?: boolean;
|
|
67
70
|
/** Accessible name for the address input. */
|
|
68
71
|
urlLabel?: string;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { t as cx } from "../../class-names-BiMDVpUo.js";
|
|
2
|
-
import { K as SpinnerIcon, nt as XIcon } from "../../icons-
|
|
2
|
+
import { K as SpinnerIcon, nt as XIcon } from "../../icons-cuEtsgj9.js";
|
|
3
3
|
import { Tabs } from "../foundations/Tabs.js";
|
|
4
|
-
import { WebPreview, WebPreviewNavigation, WebPreviewNavigationButton, WebPreviewUrl } from "../general-purpose/WebPreview.js";
|
|
4
|
+
import { WebPreview, WebPreviewEmpty, WebPreviewNavigation, WebPreviewNavigationButton, WebPreviewUrl, WebPreviewViewport } from "../general-purpose/WebPreview.js";
|
|
5
5
|
import { BrowserLiveView } from "./BrowserLiveView.js";
|
|
6
6
|
import * as React from "react";
|
|
7
7
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
@@ -20,8 +20,8 @@ function pickTarget(targets, targetId) {
|
|
|
20
20
|
return (targetId ? targets.find((target) => target.targetId === targetId) : void 0) ?? targets.find(isInspectablePage) ?? targets[0];
|
|
21
21
|
}
|
|
22
22
|
function BrowserRunPanelState({ children, role, tone = "neutral" }) {
|
|
23
|
-
return /* @__PURE__ */ jsx(
|
|
24
|
-
className: "
|
|
23
|
+
return /* @__PURE__ */ jsx(WebPreviewEmpty, {
|
|
24
|
+
className: "browser-run-panel__state",
|
|
25
25
|
"data-tone": tone,
|
|
26
26
|
role: role ?? (tone === "danger" ? "alert" : void 0),
|
|
27
27
|
children
|
|
@@ -29,10 +29,6 @@ function BrowserRunPanelState({ children, role, tone = "neutral" }) {
|
|
|
29
29
|
}
|
|
30
30
|
/** The one rendering of the panel chrome, whichever mode filled its props in. */
|
|
31
31
|
function BrowserRunPanelFrame({ body, bodyBusy, bodyTabValue, className, error, label = "Browser", navigation, navigationEnd, onOpenUrl, onSelectTab, ref, selectedTabId, tabs, url, urlDisabled, urlLabel = "Browser page URL", urlPlaceholder, urlReadOnly, ...props }) {
|
|
32
|
-
const bodyProps = {
|
|
33
|
-
className: "web-preview__body browser-run-panel__body",
|
|
34
|
-
"aria-busy": bodyBusy || void 0
|
|
35
|
-
};
|
|
36
32
|
return /* @__PURE__ */ jsxs(Tabs.Root, {
|
|
37
33
|
className: cx("browser-run-panel", className),
|
|
38
34
|
value: selectedTabId ?? null,
|
|
@@ -40,6 +36,7 @@ function BrowserRunPanelFrame({ body, bodyBusy, bodyTabValue, className, error,
|
|
|
40
36
|
if (typeof value === "string" && value !== selectedTabId) onSelectTab?.(value);
|
|
41
37
|
},
|
|
42
38
|
render: /* @__PURE__ */ jsx(WebPreview, {
|
|
39
|
+
surface: "plain",
|
|
43
40
|
ref,
|
|
44
41
|
url,
|
|
45
42
|
...onOpenUrl ? { onUrlChange: onOpenUrl } : {},
|
|
@@ -49,23 +46,26 @@ function BrowserRunPanelFrame({ body, bodyBusy, bodyTabValue, className, error,
|
|
|
49
46
|
"data-recipe": "fill-host"
|
|
50
47
|
}),
|
|
51
48
|
children: [
|
|
52
|
-
tabs.length > 1 ? /* @__PURE__ */ jsx(WebPreviewNavigation, {
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
className: "browser-run-panel__tab
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
49
|
+
tabs.length > 1 ? /* @__PURE__ */ jsx(WebPreviewNavigation, {
|
|
50
|
+
variant: "tabs",
|
|
51
|
+
children: /* @__PURE__ */ jsx(Tabs.List, {
|
|
52
|
+
className: "browser-run-panel__tabs",
|
|
53
|
+
"aria-label": "Open browser pages",
|
|
54
|
+
activateOnFocus: true,
|
|
55
|
+
children: tabs.map((tab) => /* @__PURE__ */ jsxs(Tabs.Tab, {
|
|
56
|
+
value: tab.id,
|
|
57
|
+
className: "browser-run-panel__tab",
|
|
58
|
+
children: [/* @__PURE__ */ jsx("span", {
|
|
59
|
+
className: "browser-run-panel__tab-glyph",
|
|
60
|
+
"aria-hidden": "true",
|
|
61
|
+
children: tabGlyph(tab)
|
|
62
|
+
}), /* @__PURE__ */ jsx("span", {
|
|
63
|
+
className: "browser-run-panel__tab-title sigvelo-truncate",
|
|
64
|
+
children: tabLabel(tab)
|
|
65
|
+
})]
|
|
66
|
+
}, tab.id))
|
|
67
|
+
})
|
|
68
|
+
}) : null,
|
|
69
69
|
/* @__PURE__ */ jsxs(WebPreviewNavigation, {
|
|
70
70
|
className: "browser-run-panel__address-bar",
|
|
71
71
|
children: [
|
|
@@ -83,12 +83,13 @@ function BrowserRunPanelFrame({ body, bodyBusy, bodyTabValue, className, error,
|
|
|
83
83
|
tone: "danger",
|
|
84
84
|
children: error
|
|
85
85
|
}) : null,
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
86
|
+
/* @__PURE__ */ jsx(WebPreviewViewport, {
|
|
87
|
+
className: "browser-run-panel__body",
|
|
88
|
+
"aria-busy": bodyBusy || void 0,
|
|
89
|
+
render: bodyTabValue !== void 0 ? /* @__PURE__ */ jsx(Tabs.Panel, {
|
|
90
|
+
value: bodyTabValue,
|
|
91
|
+
unstyled: true
|
|
92
|
+
}) : void 0,
|
|
92
93
|
children: body
|
|
93
94
|
})
|
|
94
95
|
]
|