@datalayer/agent-runtimes 1.3.89 → 1.3.91
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/lib/Agent.js +2 -18
- package/lib/AgentDocument.js +5 -55
- package/lib/AgentNode.js +31 -208
- package/lib/AgentNotebook.js +5 -59
- package/lib/agent-node/AgentNodeGallery.js +23 -111
- package/lib/agents/AgentDetails.js +36 -274
- package/lib/agents/AgentRuntimeChat.js +1 -8
- package/lib/chat/Chat.js +7 -46
- package/lib/chat/ChatFloating.js +15 -100
- package/lib/chat/ChatInline.js +5 -47
- package/lib/chat/ChatPopupStandalone.js +5 -53
- package/lib/chat/ChatSidebar.js +4 -51
- package/lib/chat/ChatStandalone.js +4 -45
- package/lib/chat/EphemeralSurfaceControl.js +5 -25
- package/lib/chat/assistant/AssistantContextMenu.d.ts +8 -0
- package/lib/chat/assistant/AssistantContextMenu.js +17 -1
- package/lib/chat/assistant/AssistantStage.js +6 -25
- package/lib/chat/assistant/BalloonParts.js +8 -40
- package/lib/chat/assistant/BalloonVisual.js +2 -2
- package/lib/chat/assistant/ConversationBalloon.js +2 -11
- package/lib/chat/assistant/DecisionAsk.js +3 -3
- package/lib/chat/assistant/SandboxDetailsDialog.js +3 -17
- package/lib/chat/assistant/SpeechBalloon.js +14 -78
- package/lib/chat/base/ChatBase.js +37 -172
- package/lib/chat/display/EmptyState.js +7 -35
- package/lib/chat/display/FloatingBrandButton.js +4 -34
- package/lib/chat/display/PoweredByTag.js +3 -14
- package/lib/chat/document/EphemeralDocument.js +3 -18
- package/lib/chat/header/ChatHeader.js +1 -17
- package/lib/chat/header/ChatHeaderBase.js +2 -24
- package/lib/chat/header/ChatViewModeToggle.js +7 -29
- package/lib/chat/indicators/McpStatusIndicator.js +3 -12
- package/lib/chat/indicators/SandboxStatusIndicator.js +6 -34
- package/lib/chat/indicators/SkillsStatusIndicator.js +3 -12
- package/lib/chat/indicators/TypingDots.js +1 -11
- package/lib/chat/messages/ChatMessageList.js +58 -185
- package/lib/chat/messages/ChatMessages.js +15 -79
- package/lib/chat/messages/FormSubmissionMessage.js +2 -33
- package/lib/chat/messages/NotebookToolSurfaces.js +12 -41
- package/lib/chat/messages/TurnFooter.js +4 -10
- package/lib/chat/notebook/EphemeralNotebook.js +2 -10
- package/lib/chat/parts/ReasoningPart.js +2 -16
- package/lib/chat/parts/TextPart.js +2 -12
- package/lib/chat/parts/ToolPart.js +16 -90
- package/lib/chat/presence/Presence.js +5 -33
- package/lib/chat/prompt/FloatingCard.js +1 -13
- package/lib/chat/prompt/InputPrompt.js +1 -6
- package/lib/chat/prompt/InputPromptBase.js +4 -17
- package/lib/chat/prompt/InputPromptLexical.js +44 -45
- package/lib/chat/prompt/InputPromptText.js +1 -1
- package/lib/chat/prompt/footer/InPromptFooter.js +1 -8
- package/lib/chat/prompt/menus/AgentsMenu.js +1 -1
- package/lib/chat/prompt/menus/InlineAgentsMenu.js +1 -1
- package/lib/chat/prompt/menus/ModelSelector.js +1 -5
- package/lib/chat/prompt/menus/SkillsMenu.js +3 -30
- package/lib/chat/prompt/menus/SuggestionsMenu.js +1 -1
- package/lib/chat/prompt/menus/ToolsMenu.js +4 -48
- package/lib/chat/prompt/plugins/AgentMentionPlugin.js +2 -9
- package/lib/chat/prompt/plugins/CommandPlugin.js +2 -9
- package/lib/chat/prompt/plugins/MentionChip.js +1 -15
- package/lib/chat/prompt/stack.js +1 -19
- package/lib/chat/tools/A2AAgentDialog.js +9 -42
- package/lib/chat/tools/SubagentActivity.js +5 -22
- package/lib/chat/tools/ToolApprovalBanner.js +4 -34
- package/lib/chat/tools/ToolApprovalDialog.js +4 -19
- package/lib/chat/tools/ToolCallDisplay.js +12 -97
- package/lib/chat/usage/ContextPie.js +4 -45
- package/lib/chat/words.d.ts +7 -0
- package/lib/chat/words.js +12 -0
- package/lib/components/a2ui/datalayer/Chart.js +4 -10
- package/lib/components/a2ui/datalayer/Chat.js +2 -10
- package/lib/components/a2ui/datalayer/Download.js +1 -1
- package/lib/components/a2ui/datalayer/Evidence.js +1 -15
- package/lib/components/a2ui/datalayer/FileUpload.js +1 -12
- package/lib/components/a2ui/datalayer/Table.js +9 -17
- package/lib/components/a2ui/datalayer/formWidgets.js +3 -2
- package/lib/components/a2ui/datalayer/parts.js +1 -16
- package/lib/components/a2ui/styles.js +16 -5
- package/lib/components/agents/AgentSummary.js +1 -51
- package/lib/components/cards/NotificationEventCard.js +6 -72
- package/lib/components/cards/OutputCard.js +4 -48
- package/lib/components/cards/ToolApprovalCard.js +2 -35
- package/lib/components/code-sandboxes/CodeSandboxCellVariables.js +1 -1
- package/lib/components/code-sandboxes/CodeSandboxEnvironmentSelect.js +4 -14
- package/lib/components/code-sandboxes/CodeSandboxPicker.js +16 -21
- package/lib/components/code-sandboxes/CodeSandboxVariables.js +2 -2
- package/lib/components/scheduler/ScheduleMenu.js +5 -10
- package/lib/components/specs/SpecPayloadPreview.js +1 -26
- package/lib/components/teams/A2ATeamGraph.d.ts +4 -3
- package/lib/components/teams/A2ATeamGraph.js +25 -71
- package/lib/components/teams/AnswerSurfacesView.js +2 -2
- package/lib/components/teams/NotebookPreview.js +1 -10
- package/lib/components/teams/NotebookPreviewView.js +2 -3
- package/lib/components/teams/SceneTranscript.js +3 -17
- package/lib/components/teams/SceneView.js +1 -8
- package/lib/components/teams/TeamNotebook.js +5 -13
- package/lib/components/teams/TeamNotebookView.js +2 -12
- package/lib/components/teams/index.d.ts +1 -0
- package/lib/components/teams/index.js +1 -0
- package/lib/components/teams/useBalloonRoom.d.ts +39 -0
- package/lib/components/teams/useBalloonRoom.js +89 -0
- package/lib/config/AgentConfiguration.js +22 -225
- package/lib/context/ContextDistribution.js +7 -41
- package/lib/context/ContextInspector.js +9 -107
- package/lib/context/ContextPanel.js +11 -86
- package/lib/context/ContextUsage.js +6 -34
- package/lib/context/CostTracker.js +7 -42
- package/lib/context/MessageHistory.js +3 -37
- package/lib/context/TurnGraphChart.js +9 -41
- package/lib/examples/A2UiAgentExample.js +6 -108
- package/lib/examples/A2UiComponentsGalleryExample.js +1 -1
- package/lib/examples/A2UiContactCardExample.js +1 -1
- package/lib/examples/A2UiJupyterOutputExample.js +25 -125
- package/lib/examples/A2UiRestaurantExample.js +1 -1
- package/lib/examples/A2UiViewerExample.js +1 -1
- package/lib/examples/AgUiAgenticExample.js +3 -35
- package/lib/examples/AgUiBackendToolRenderingExample.js +2 -25
- package/lib/examples/AgUiHaikuGenUiExample.js +2 -32
- package/lib/examples/AgUiHumanInTheLoopExample.js +5 -59
- package/lib/examples/AgUiSharedStateExample.js +6 -56
- package/lib/examples/AgUiToolsBasedGenUiExample.js +25 -120
- package/lib/examples/AgentA2AExample.js +1 -15
- package/lib/examples/AgentA2ATeamExample.js +6 -30
- package/lib/examples/AgentCheckpointsExample.js +11 -145
- package/lib/examples/AgentCodeSandboxExample.js +5 -108
- package/lib/examples/AgentCodeSandboxesExample.js +3 -30
- package/lib/examples/AgentCodemodeExample.js +9 -85
- package/lib/examples/AgentCompactionExample.js +3 -64
- package/lib/examples/AgentDecideExample.js +1 -13
- package/lib/examples/AgentEvalsExample.js +5 -60
- package/lib/examples/AgentGuardrailsExample.js +4 -28
- package/lib/examples/AgentHooksExample.js +1 -1
- package/lib/examples/AgentInferenceProviderExample.js +5 -96
- package/lib/examples/AgentMCPExample.js +7 -105
- package/lib/examples/AgentMemoryExample.js +5 -74
- package/lib/examples/AgentMonitoringExample.js +7 -53
- package/lib/examples/AgentNotificationsExample.js +3 -61
- package/lib/examples/AgentOtelExample.js +3 -72
- package/lib/examples/AgentOutputsExample.js +6 -81
- package/lib/examples/AgentParametersExample.js +2 -37
- package/lib/examples/AgentSkillsExample.js +3 -45
- package/lib/examples/AgentSubagentsExample.js +6 -56
- package/lib/examples/AgentToolApprovalsExample.js +1 -11
- package/lib/examples/AgentTriggersExample.js +29 -239
- package/lib/examples/AgentspecsExample.js +6 -60
- package/lib/examples/AssistantExample.js +5 -5
- package/lib/examples/AssistantGalleryExample.js +8 -65
- package/lib/examples/CellExample.js +1 -6
- package/lib/examples/ChatCustomExample.js +2 -31
- package/lib/examples/ChatExample.js +1 -9
- package/lib/examples/ChatStandaloneExample.js +3 -37
- package/lib/examples/CopilotKitLexicalExample.js +1 -24
- package/lib/examples/DecksAgent.js +1 -1
- package/lib/examples/DocumentPageAgent.js +1 -1
- package/lib/examples/HomeExample.js +14 -62
- package/lib/examples/Lexical2Example.js +3 -32
- package/lib/examples/LexicalAgentExample.js +2 -34
- package/lib/examples/LexicalAgentSidebarExample.js +3 -34
- package/lib/examples/LoopAppComputerExample.js +1 -1
- package/lib/examples/LoopShellExample.js +2 -2
- package/lib/examples/LoopStrategyExample.js +15 -87
- package/lib/examples/LoopWorkspaceEmbed.js +2 -18
- package/lib/examples/LoopWorkspaceExample.js +2 -2
- package/lib/examples/NotebookAgentExample.js +2 -33
- package/lib/examples/NotebookAgentSidebarExample.js +3 -46
- package/lib/examples/NotebookCollaborationExample.js +1 -31
- package/lib/examples/NotebookExample.js +1 -18
- package/lib/examples/NotebookPageAgent.js +1 -1
- package/lib/examples/ScenesExample.js +5 -24
- package/lib/examples/VoiceChatExample.js +1 -1
- package/lib/examples/components/AuthRequiredView.js +1 -7
- package/lib/examples/components/ErrorView.js +1 -8
- package/lib/examples/components/ExampleErrorBoundary.js +1 -14
- package/lib/examples/components/FooterMetrics.js +1 -7
- package/lib/examples/components/Header.js +12 -51
- package/lib/examples/components/HeaderControls.js +1 -9
- package/lib/examples/components/LexicalEditor.js +1 -8
- package/lib/examples/components/MainContent.js +1 -13
- package/lib/examples/components/MockFileBrowser.js +4 -40
- package/lib/examples/components/SessionTabs.js +1 -1
- package/lib/examples/components/TimeTravel.js +1 -13
- package/lib/examples/main.js +13 -81
- package/lib/examples/scenes/A2UiComponentsGalleryScene.js +3 -34
- package/lib/examples/scenes/A2UiContactCardScene.js +3 -35
- package/lib/examples/scenes/A2UiRestaurantScene.js +3 -53
- package/lib/examples/scenes/A2UiViewerScene.js +3 -34
- package/lib/examples/utils/AssistantGalleryGrid.js +6 -35
- package/lib/examples2/DatalayerNotebookExample.js +3 -33
- package/lib/examples2/NativeNavigationExample.js +4 -10
- package/lib/examples2/NotebookMutationsKernel.js +2 -1
- package/lib/examples2/NotebookMutationsServiceManager.js +2 -1
- package/lib/examples2/ReactRouterExample.js +14 -42
- package/lib/hooks/useToolApprovals.d.ts +2 -34
- package/lib/hooks/useToolApprovals.js +1 -64
- package/lib/identity/AgentIdentity.js +17 -62
- package/lib/identity/IdentityConnect.js +13 -59
- package/lib/identity/OAuthCallback.js +6 -44
- package/lib/lexical/ChatInlinePlugin.js +6 -14
- package/lib/loop/apps/AppFeedback.js +12 -3
- package/lib/loop/apps/AppRenderer.d.ts +4 -3
- package/lib/loop/apps/AppRenderer.js +11 -12
- package/lib/loop/apps/appspec.js +6 -3
- package/lib/loop/apps/feedback.d.ts +3 -2
- package/lib/loop/apps/feedback.js +4 -2
- package/lib/loop/core/index.d.ts +19 -0
- package/lib/loop/core/index.js +27 -0
- package/lib/loop/embed/AppEmbed.d.ts +1 -1
- package/lib/loop/embed/AppEmbed.js +2 -1
- package/lib/loop/embed/LoopEmbed.js +1 -7
- package/lib/loop/embed/embedConfig.d.ts +3 -3
- package/lib/loop/embed/embedConfig.js +2 -3
- package/lib/loop/embed/embedTheme.d.ts +4 -4
- package/lib/loop/embed/embedTheme.js +11 -7
- package/lib/loop/plugins/a2a-sidebar/A2ASidebar.js +7 -34
- package/lib/loop/plugins/a2ui/A2uiView.js +4 -12
- package/lib/loop/plugins/a2ui-surface/InlineSurface.js +1 -16
- package/lib/loop/plugins/a2ui-surface/SurfaceToolResult.js +2 -12
- package/lib/loop/plugins/agents/AnonymousKeyBadge.js +3 -2
- package/lib/loop/plugins/agents/SandboxSelector.js +3 -7
- package/lib/loop/plugins/agents/SandboxView.js +4 -27
- package/lib/loop/plugins/agents/TeamMemberPicker.js +2 -2
- package/lib/loop/plugins/agentspecs/AgentspecPicker.js +3 -2
- package/lib/loop/plugins/app-activity/AppActivity.js +1 -1
- package/lib/loop/plugins/app-computer/AppComputer.js +32 -27
- package/lib/loop/plugins/app-elements/AppElements.js +2 -31
- package/lib/loop/plugins/app-page/AppPage.js +26 -8
- package/lib/loop/plugins/app-rules/AppRulesCard.js +4 -20
- package/lib/loop/plugins/assistant/index.js +1 -13
- package/lib/loop/plugins/chat/ChatView.js +89 -130
- package/lib/loop/plugins/checkpoints-sidebar/CheckpointsSidebar.js +2 -13
- package/lib/loop/plugins/decks/DeckSurface.js +2 -2
- package/lib/loop/plugins/document/DocumentView.js +4 -12
- package/lib/loop/plugins/document-toolbar/SandboxStatusItem.js +3 -8
- package/lib/loop/plugins/graph/GraphView.js +2 -2
- package/lib/loop/plugins/input-prompt/ComposerView.js +1 -1
- package/lib/loop/plugins/notebook/NotebookView.js +3 -11
- package/lib/loop/plugins/page-layout/SplitLayout.js +11 -34
- package/lib/loop/plugins/page-layout/TurnPanel.js +9 -35
- package/lib/loop/plugins/shell/useEditorPreviews.js +3 -2
- package/lib/loop/plugins/subagent-activity/SubagentPulse.js +1 -13
- package/lib/loop/plugins/window-frame/WindowFrame.js +10 -44
- package/lib/loop/plugins/window-frame/index.js +1 -1
- package/lib/loop/shell/LoopWorkspace.js +34 -77
- package/lib/loop/shell/PluginToggles.js +4 -15
- package/lib/loop/shell/SidebarRail.js +8 -40
- package/lib/loop/shell/ViewSwitcher.js +4 -24
- package/lib/loop-main.js +2 -3
- package/lib/mcp/McpServerManager.js +6 -37
- package/lib/portable/index.d.ts +11 -0
- package/lib/portable/index.js +20 -0
- package/lib/protocols/AGUIAdapter.js +2 -2
- package/lib/protocols/BaseProtocolAdapter.d.ts +2 -0
- package/lib/protocols/BaseProtocolAdapter.js +4 -0
- package/lib/specs/apps.js +6 -0
- package/lib/specs/appspecSchema.js +11 -4
- package/lib/stories/loop/ReferenceScreens.js +17 -91
- package/lib/stories/loop/pictures-main.js +1 -1
- package/lib/types/agentspecs.d.ts +5 -2
- package/lib/types/protocol.d.ts +2 -0
- package/lib/utils/approvals.d.ts +59 -0
- package/lib/utils/approvals.js +101 -0
- package/lib/voice/VoiceInput.js +3 -39
- package/package.json +2 -2
- package/lib/shims/primerAddonsBox.d.ts +0 -1
- package/lib/shims/primerAddonsBox.js +0 -7
|
@@ -153,18 +153,18 @@ const AssistantExample = () => {
|
|
|
153
153
|
};
|
|
154
154
|
const isClippyJs = typeof character !== 'string' &&
|
|
155
155
|
Object.values(clippyJs).includes(character);
|
|
156
|
-
return (_jsx(ThemedProvider, { children: _jsxs(Box, {
|
|
156
|
+
return (_jsx(ThemedProvider, { children: _jsxs(Box, { minHeight: "100vh", bg: "canvas.default", p: 4, children: [_jsxs(Box, { maxWidth: 720, mx: "auto", children: [_jsx(Heading, { as: "h1", sx: { mb: 2 }, children: "Assistant" }), _jsx(Text, { as: "p", sx: { color: 'fg.muted', mb: 3 }, children: "The chat as a character on the page. It greets you, acts out what the agent is doing, and says the agent\u2019s words in a balloon while the conversation is closed. Click it to talk, drag it to move it, hover it to send it away." }), _jsxs(Box, { display: "flex", gap: 2, flexWrap: "wrap", children: [CATALOGUE.map(option => (_jsx(Button, { variant: option.id === character ? 'primary' : 'default', onClick: () => {
|
|
157
157
|
setCharacter(option.id);
|
|
158
158
|
setLoadError(undefined);
|
|
159
159
|
}, "aria-pressed": option.id === character, "data-assistant-character": option.id, children: option.name }, option.id))), pixel && (_jsxs(Button, { variant: character === pixel ? 'primary' : 'default', onClick: () => {
|
|
160
160
|
setCharacter(pixel);
|
|
161
161
|
setLoadError(undefined);
|
|
162
|
-
}, "aria-pressed": character === pixel, "data-assistant-character": "sprite", children: [pixel.name, " (sprite)"] }))] }), _jsxs(Box, { as: "section",
|
|
162
|
+
}, "aria-pressed": character === pixel, "data-assistant-character": "sprite", children: [pixel.name, " (sprite)"] }))] }), _jsxs(Box, { as: "section", mt: 4, children: [_jsx(Heading, { as: "h2", sx: { fontSize: 2, mb: 1 }, children: "The balloon" }), _jsxs(Text, { as: "p", sx: { color: 'fg.muted', mb: 2 }, children: [_jsx("strong", { children: "History" }), ": the whole conversation, counted in its header \u2014 closed, every message listed and scrolled; open, the composer last. ", _jsx("strong", { children: "Current" }), ": only what it says or does now \u2014 the answer as it is written, or the tool it calls (\u201CUsing current_time\u2026\u201D) \u2014 in one compact balloon. Either way, a tool call is said in the balloon."] }), _jsxs(Box, { display: "flex", alignItems: "center", gap: 2, "data-assistant-balloon-toggle": "", children: [_jsx(Text, { id: "assistant-balloon-history", sx: { fontWeight: 'semibold' }, children: "History" }), _jsx(ToggleSwitch, { "aria-labelledby": "assistant-balloon-history", size: "small", checked: balloon === 'history',
|
|
163
163
|
// Controlled, Primer's switch flips only through its click.
|
|
164
|
-
onClick: () => setBalloon(balloon === 'history' ? 'current' : 'history') }), _jsx(Text, { "aria-live": "polite", "data-toggle-state": "", sx: { color: 'fg.muted' }, children: balloon === 'history' ? 'History' : 'Current' })] })] }), _jsxs(Box, { as: "section",
|
|
164
|
+
onClick: () => setBalloon(balloon === 'history' ? 'current' : 'history') }), _jsx(Text, { "aria-live": "polite", "data-toggle-state": "", sx: { color: 'fg.muted' }, children: balloon === 'history' ? 'History' : 'Current' })] })] }), _jsxs(Box, { as: "section", mt: 4, children: [_jsx(Heading, { as: "h2", sx: { fontSize: 2, mb: 1 }, children: "The clippy.js characters" }), _jsxs(Text, { as: "p", sx: { color: 'fg.muted', mb: 2 }, children: ["Fetched when picked from the", ' ', _jsxs("code", { children: ["clippyjs@", CLIPPY_JS_VERSION] }), " package on jsDelivr and read as data by the same reader. They are not in this repository: clippy.js\u2019s licence covers its code only, and the characters are Microsoft\u2019s."] }), _jsx(Box, { display: "flex", gap: 2, flexWrap: "wrap", children: CLIPPY_JS_CHARACTERS.map(name => {
|
|
165
165
|
const picked = clippyJs[name] !== undefined && character === clippyJs[name];
|
|
166
166
|
return (_jsx(Button, { variant: picked ? 'primary' : 'default', onClick: () => void pickClippyJs(name), disabled: fetching !== undefined, "aria-pressed": picked, "data-assistant-character": `clippy-js-${name.toLowerCase()}`, children: fetching === name ? `${name}…` : name }, name));
|
|
167
|
-
}) })] }), _jsxs(Box, { as: "section",
|
|
167
|
+
}) })] }), _jsxs(Box, { as: "section", mt: 4, children: [_jsx(Heading, { as: "h2", sx: { fontSize: 2, mb: 1 }, children: "A character you bring" }), _jsxs(Text, { as: "p", sx: { color: 'fg.muted', mb: 2 }, children: ["The characters of Microsoft Office \u2014 Clippy, Merlin, Links and the others \u2014 are Microsoft\u2019s. Load only a character file you have the right to use: a Microsoft Agent ", _jsx("code", { children: ".acs" }), " file, or a clippy.js character\u2019s ", _jsx("code", { children: "agent.js" }), " and map image. It is read in this page and sent nowhere."] }), _jsx("input", { type: "file", multiple: true, accept: CHARACTER_FILES_ACCEPT, "aria-label": "Character files", onChange: async (event) => {
|
|
168
168
|
const files = Array.from(event.target.files ?? []);
|
|
169
169
|
if (!files.length) {
|
|
170
170
|
return;
|
|
@@ -178,7 +178,7 @@ const AssistantExample = () => {
|
|
|
178
178
|
}
|
|
179
179
|
} }), loadError && (_jsx(Text, { as: "p", role: "alert", sx: { color: 'danger.fg', mt: 2 }, children: loadError })), typeof character !== 'string' &&
|
|
180
180
|
character !== pixel &&
|
|
181
|
-
!isClippyJs && (_jsxs(Text, { as: "p", sx: { mt: 2 }, children: ["Playing ", character.name, "."] }))] })] }), agentError && (_jsx(Box, {
|
|
181
|
+
!isClippyJs && (_jsxs(Text, { as: "p", sx: { mt: 2 }, children: ["Playing ", character.name, "."] }))] })] }), agentError && (_jsx(Box, { maxWidth: 720, mx: "auto", mt: 3, children: _jsx(Text, { as: "p", role: "alert", sx: { color: 'danger.fg' }, children: agentError }) })), agentReady && (_jsx(ChatFloating, { defaultViewMode: "assistant", assistantCharacter: drawn, balloonDisplay: balloon, protocol: "ag-ui", endpoint: `${SERVER}/api/v1/ag-ui/${AGENT_ID}/`, title: "Assistant", description: "Hello! Ask me anything about this page.", position: "bottom-right", useStore: false,
|
|
182
182
|
// Ask a decision beside the composer: Jev, through this server.
|
|
183
183
|
decisions: { serverUrl: SERVER },
|
|
184
184
|
// Right-click the character: its menu.
|
|
@@ -60,18 +60,7 @@ function ModePanel({ mode, character, pose, presence, balloon, insist, onToggle,
|
|
|
60
60
|
: presence === 'arriving'
|
|
61
61
|
? 'greeting'
|
|
62
62
|
: stateOfPose(pose);
|
|
63
|
-
return (_jsxs(Box, { ref: panelRef, "data-gallery-mode": mode, sx: {
|
|
64
|
-
position: 'relative',
|
|
65
|
-
flex: '1 1 320px',
|
|
66
|
-
minWidth: 0,
|
|
67
|
-
height: PANEL_HEIGHT,
|
|
68
|
-
bg: 'canvas.default',
|
|
69
|
-
color: 'fg.default',
|
|
70
|
-
border: '1px solid',
|
|
71
|
-
borderColor: 'border.default',
|
|
72
|
-
borderRadius: 2,
|
|
73
|
-
overflow: 'visible',
|
|
74
|
-
}, children: [_jsx(Text, { sx: {
|
|
63
|
+
return (_jsxs(Box, { ref: panelRef, "data-gallery-mode": mode, position: "relative", flex: "1 1 320px", minWidth: 0, height: PANEL_HEIGHT, bg: "canvas.default", color: "fg.default", border: "1px solid", borderColor: "border.default", borderRadius: 2, overflow: "visible", children: [_jsx(Text, { sx: {
|
|
75
64
|
position: 'absolute',
|
|
76
65
|
top: 2,
|
|
77
66
|
left: 3,
|
|
@@ -80,11 +69,7 @@ function ModePanel({ mode, character, pose, presence, balloon, insist, onToggle,
|
|
|
80
69
|
color: 'fg.muted',
|
|
81
70
|
textTransform: 'uppercase',
|
|
82
71
|
letterSpacing: '0.04em',
|
|
83
|
-
}, children: mode }), presence === 'away' ? (_jsxs(Box, { sx: {
|
|
84
|
-
position: 'absolute',
|
|
85
|
-
left: spot.left,
|
|
86
|
-
top: spot.top + STAGE_SIZE / 2 - 16,
|
|
87
|
-
}, children: [_jsxs(Button, { size: "small", onClick: onCallBack, "data-gallery-call-back": "", children: ["Call ", character.name, " back"] }), _jsxs(Text, { as: "p", sx: { fontSize: 0, color: 'fg.muted', mt: 1 }, children: ["Sent away ", AWAY_WORDS[away], "."] })] })) : (_jsx(AssistantStage, { character: character.character, state: state, size: STAGE_SIZE, place: { position: 'absolute', left: spot.left, top: spot.top }, stageRef: stageRef, onDragStart: drag.onHandlePointerDown, open: false, onToggle: onToggle, balloon: presence === 'here' ? balloon : undefined, balloonDisplay: display, expandTarget: expandTarget, insist: insist, onDismiss: onDismiss }, `${character.id}-${replay}`)), pose === 'aside' && presence === 'here' && (_jsx(GalleryObstacle, { sx: {
|
|
72
|
+
}, children: mode }), presence === 'away' ? (_jsxs(Box, { position: "absolute", left: spot.left, top: spot.top + STAGE_SIZE / 2 - 16, children: [_jsxs(Button, { size: "small", onClick: onCallBack, "data-gallery-call-back": "", children: ["Call ", character.name, " back"] }), _jsxs(Text, { as: "p", sx: { fontSize: 0, color: 'fg.muted', mt: 1 }, children: ["Sent away ", AWAY_WORDS[away], "."] })] })) : (_jsx(AssistantStage, { character: character.character, state: state, size: STAGE_SIZE, place: { position: 'absolute', left: spot.left, top: spot.top }, stageRef: stageRef, onDragStart: drag.onHandlePointerDown, open: false, onToggle: onToggle, balloon: presence === 'here' ? balloon : undefined, balloonDisplay: display, expandTarget: expandTarget, insist: insist, onDismiss: onDismiss }, `${character.id}-${replay}`)), pose === 'aside' && presence === 'here' && (_jsx(GalleryObstacle, { sx: {
|
|
88
73
|
left: spot.left - 12,
|
|
89
74
|
top: spot.top - 12,
|
|
90
75
|
width: STAGE_SIZE + 24,
|
|
@@ -93,7 +78,7 @@ function ModePanel({ mode, character, pose, presence, balloon, insist, onToggle,
|
|
|
93
78
|
}
|
|
94
79
|
/** A two-way choice as a Primer toggle: its label, the switch, what is on. */
|
|
95
80
|
function GalleryToggle({ id, label, on, onChange, state, ...rest }) {
|
|
96
|
-
return (_jsxs(Box, {
|
|
81
|
+
return (_jsxs(Box, { display: "flex", alignItems: "center", gap: 2, ...rest, children: [_jsx(Text, { id: id, sx: { fontSize: 1, fontWeight: 'semibold' }, children: label }), _jsx(ToggleSwitch, { "aria-labelledby": id, size: "small", checked: on,
|
|
97
82
|
// Controlled, Primer's switch flips only through its click.
|
|
98
83
|
onClick: () => onChange(!on) }), _jsx(Text, { "aria-live": "polite", "data-toggle-state": "", sx: { fontSize: 1, color: 'fg.muted' }, children: state })] }));
|
|
99
84
|
}
|
|
@@ -102,12 +87,7 @@ function InModes({ modes, stacked = false, children, }) {
|
|
|
102
87
|
const { theme } = useExampleThemeStore();
|
|
103
88
|
const config = themeConfigs[theme] ?? themeConfigs.loop;
|
|
104
89
|
const shown = modes === 'both' ? ['light', 'dark'] : [modes];
|
|
105
|
-
return (_jsx(Box, {
|
|
106
|
-
display: 'flex',
|
|
107
|
-
flexDirection: stacked ? 'column' : 'row',
|
|
108
|
-
gap: 3,
|
|
109
|
-
flexWrap: 'wrap',
|
|
110
|
-
}, children: shown.map(mode => (_jsx(Box, { sx: { flex: '1 1 320px', minWidth: 0 }, children: _jsx(DatalayerThemeProvider, { colorMode: mode, theme: config.primerTheme, themeStyles: config.themeStyles, children: children(mode) }) }, mode))) }));
|
|
90
|
+
return (_jsx(Box, { display: "flex", flexDirection: stacked ? 'column' : 'row', gap: 3, flexWrap: "wrap", children: shown.map(mode => (_jsx(Box, { flex: "1 1 320px", minWidth: 0, children: _jsx(DatalayerThemeProvider, { colorMode: mode, theme: config.primerTheme, themeStyles: config.themeStyles, children: children(mode) }) }, mode))) }));
|
|
111
91
|
}
|
|
112
92
|
const AssistantGalleryExample = () => {
|
|
113
93
|
const { characters: ours, problem } = useGalleryCharacters();
|
|
@@ -187,39 +167,15 @@ const AssistantGalleryExample = () => {
|
|
|
187
167
|
withNotebook ||
|
|
188
168
|
pose === 'waiting' ||
|
|
189
169
|
pose === 'paused';
|
|
190
|
-
return (_jsx(ThemedProvider, { children: _jsx(Box, { sx: {
|
|
191
|
-
minHeight: '100vh',
|
|
192
|
-
bg: 'canvas.default',
|
|
193
|
-
color: 'fg.default',
|
|
194
|
-
p: 4,
|
|
195
|
-
}, children: _jsxs(Box, { sx: { maxWidth: 1200, mx: 'auto' }, children: [_jsx(Heading, { as: "h1", sx: { mb: 2 }, children: "Assistant gallery" }), _jsxs(Text, { as: "p", sx: { color: 'fg.muted', mb: 3, maxWidth: 760 }, children: ["Every character in every state the floating assistant acts, with its balloon, in light and dark. Datalayer\u2019s four and the owl are what the enabled plugins contribute to", ' ', _jsx("code", { children: "loop.assistant.character" }), "; Pixel is a test sprite of our own, read through the clippy.js reader. No agent is behind it: the words are a sample conversation."] }), _jsxs(Text, { as: "p", sx: { color: 'fg.muted', mb: 3, maxWidth: 760 }, children: ["The characters clippy.js publishes \u2014 Clippy, Merlin, Links, Rover and the others \u2014 are loaded on request from the", ' ', _jsxs("code", { children: ["clippyjs@", CLIPPY_JS_VERSION] }), " package on jsDelivr (about 15 MB) and read by the same reader. They are not in this repository: clippy.js\u2019s licence covers its code only, and the characters are Microsoft\u2019s."] }), _jsxs(Box, { as: "section", "aria-label": "Gallery controls", sx: {
|
|
196
|
-
display: 'grid',
|
|
197
|
-
gap: 3,
|
|
198
|
-
mb: 4,
|
|
199
|
-
p: 3,
|
|
200
|
-
border: '1px solid',
|
|
201
|
-
borderColor: 'border.default',
|
|
202
|
-
borderRadius: 2,
|
|
203
|
-
bg: 'canvas.subtle',
|
|
204
|
-
}, children: [_jsxs(Box, { sx: {
|
|
205
|
-
display: 'flex',
|
|
206
|
-
gap: 3,
|
|
207
|
-
flexWrap: 'wrap',
|
|
208
|
-
alignItems: 'center',
|
|
209
|
-
}, children: [_jsxs(SegmentedControl, { "aria-label": "View", children: [_jsx(SegmentedControl.Button, { selected: view === 'stage', onClick: () => setView('stage'), children: "One at a time" }), _jsx(SegmentedControl.Button, { selected: view === 'grid', onClick: () => setView('grid'), "data-gallery-view": "grid", children: "Grid" })] }), _jsx(SegmentedControl, { "aria-label": "Colour mode", children: ['light', 'dark', 'both'].map(option => (_jsx(SegmentedControl.Button, { selected: modes === option, onClick: () => setModes(option), children: option === 'both'
|
|
170
|
+
return (_jsx(ThemedProvider, { children: _jsx(Box, { minHeight: "100vh", bg: "canvas.default", color: "fg.default", p: 4, children: _jsxs(Box, { maxWidth: 1200, mx: "auto", children: [_jsx(Heading, { as: "h1", sx: { mb: 2 }, children: "Assistant gallery" }), _jsxs(Text, { as: "p", sx: { color: 'fg.muted', mb: 3, maxWidth: 760 }, children: ["Every character in every state the floating assistant acts, with its balloon, in light and dark. Datalayer\u2019s four and the owl are what the enabled plugins contribute to", ' ', _jsx("code", { children: "loop.assistant.character" }), "; Pixel is a test sprite of our own, read through the clippy.js reader. No agent is behind it: the words are a sample conversation."] }), _jsxs(Text, { as: "p", sx: { color: 'fg.muted', mb: 3, maxWidth: 760 }, children: ["The characters clippy.js publishes \u2014 Clippy, Merlin, Links, Rover and the others \u2014 are loaded on request from the", ' ', _jsxs("code", { children: ["clippyjs@", CLIPPY_JS_VERSION] }), " package on jsDelivr (about 15 MB) and read by the same reader. They are not in this repository: clippy.js\u2019s licence covers its code only, and the characters are Microsoft\u2019s."] }), _jsxs(Box, { as: "section", "aria-label": "Gallery controls", display: "grid", gap: 3, mb: 4, p: 3, border: "1px solid", borderColor: "border.default", borderRadius: 2, bg: "canvas.subtle", children: [_jsxs(Box, { display: "flex", gap: 3, flexWrap: "wrap", alignItems: "center", children: [_jsxs(SegmentedControl, { "aria-label": "View", children: [_jsx(SegmentedControl.Button, { selected: view === 'stage', onClick: () => setView('stage'), children: "One at a time" }), _jsx(SegmentedControl.Button, { selected: view === 'grid', onClick: () => setView('grid'), "data-gallery-view": "grid", children: "Grid" })] }), _jsx(SegmentedControl, { "aria-label": "Colour mode", children: ['light', 'dark', 'both'].map(option => (_jsx(SegmentedControl.Button, { selected: modes === option, onClick: () => setModes(option), children: option === 'both'
|
|
210
171
|
? 'Side by side'
|
|
211
172
|
: option === 'light'
|
|
212
173
|
? 'Light'
|
|
213
|
-
: 'Dark' }, option))) }), _jsxs(FormControl, { children: [_jsx(Checkbox, { checked: still, onChange: event => setStill(event.target.checked) }), _jsx(FormControl.Label, { children: "Reduced motion" })] }), _jsxs(FormControl, { children: [_jsx(Checkbox, { checked: withClippyJs, onChange: event => setWithClippyJs(event.target.checked), "data-gallery-clippy-js": "" }), _jsxs(FormControl.Label, { children: ["clippy.js characters", clippyJs.loading ? ' (loading…)' : ''] })] }), _jsx(Button, { onClick: () => setReplay(replay + 1), children: "Replay the motions" })] }), view === 'stage' && (_jsxs(_Fragment, { children: [_jsx(Box, { role: "group", "aria-label": "Character",
|
|
174
|
+
: 'Dark' }, option))) }), _jsxs(FormControl, { children: [_jsx(Checkbox, { checked: still, onChange: event => setStill(event.target.checked) }), _jsx(FormControl.Label, { children: "Reduced motion" })] }), _jsxs(FormControl, { children: [_jsx(Checkbox, { checked: withClippyJs, onChange: event => setWithClippyJs(event.target.checked), "data-gallery-clippy-js": "" }), _jsxs(FormControl.Label, { children: ["clippy.js characters", clippyJs.loading ? ' (loading…)' : ''] })] }), _jsx(Button, { onClick: () => setReplay(replay + 1), children: "Replay the motions" })] }), view === 'stage' && (_jsxs(_Fragment, { children: [_jsx(Box, { role: "group", "aria-label": "Character", display: "flex", gap: 2, flexWrap: "wrap", children: characters.map(option => (_jsx(Button, { size: "small", variant: option.id === character.id ? 'primary' : 'default', "aria-pressed": option.id === character.id, "data-gallery-character": option.id, onClick: () => setCharacterId(option.id), children: option.name }, option.id))) }), _jsx(Box, { role: "group", "aria-label": "State", display: "flex", gap: 2, flexWrap: "wrap", children: GALLERY_POSES.map(option => (_jsx(Button, { size: "small", variant: option === pose ? 'primary' : 'default', "aria-pressed": option === pose, "data-gallery-pose": option, onClick: () => {
|
|
214
175
|
setPose(option);
|
|
215
176
|
setDecision(undefined);
|
|
216
177
|
setReplay(replay + 1);
|
|
217
|
-
}, children: GALLERY_POSE_LABELS[option] }, option))) }), _jsxs(Box, {
|
|
218
|
-
display: 'flex',
|
|
219
|
-
gap: 2,
|
|
220
|
-
flexWrap: 'wrap',
|
|
221
|
-
alignItems: 'center',
|
|
222
|
-
}, children: [_jsx(GalleryToggle, { id: "gallery-balloon-history", label: "History", on: display === 'history', onChange: on => setDisplay(on ? 'history' : 'current'), state: display === 'history' ? 'History' : 'Current', "data-gallery-balloon-toggle": "" }), _jsx(GalleryToggle, { id: "gallery-expand-into-page", label: "Expand into the page", on: expandIntoPage, onChange: setExpandIntoPage, state: expandIntoPage ? 'The page area' : 'An overlay', "data-gallery-expand-toggle": "" }), _jsx(Button, { onClick: say, "data-gallery-say": "", children: "Say something" }), _jsx(Button, { "data-gallery-tool": toolPhase ?? 'none', onClick: () => setToolPhase(toolPhase === undefined
|
|
178
|
+
}, children: GALLERY_POSE_LABELS[option] }, option))) }), _jsxs(Box, { display: "flex", gap: 2, flexWrap: "wrap", alignItems: "center", children: [_jsx(GalleryToggle, { id: "gallery-balloon-history", label: "History", on: display === 'history', onChange: on => setDisplay(on ? 'history' : 'current'), state: display === 'history' ? 'History' : 'Current', "data-gallery-balloon-toggle": "" }), _jsx(GalleryToggle, { id: "gallery-expand-into-page", label: "Expand into the page", on: expandIntoPage, onChange: setExpandIntoPage, state: expandIntoPage ? 'The page area' : 'An overlay', "data-gallery-expand-toggle": "" }), _jsx(Button, { onClick: say, "data-gallery-say": "", children: "Say something" }), _jsx(Button, { "data-gallery-tool": toolPhase ?? 'none', onClick: () => setToolPhase(toolPhase === undefined
|
|
223
179
|
? 'running'
|
|
224
180
|
: toolPhase === 'running'
|
|
225
181
|
? 'done'
|
|
@@ -231,19 +187,6 @@ const AssistantGalleryExample = () => {
|
|
|
231
187
|
? 'Tool done'
|
|
232
188
|
: toolPhase === 'done'
|
|
233
189
|
? 'Tool failed'
|
|
234
|
-
: 'No tool' }), _jsx(Button, { "data-gallery-notebook": withNotebook ? 'on' : 'off', "aria-pressed": withNotebook, onClick: () => setWithNotebook(!withNotebook), children: withNotebook ? 'Take the notebook' : 'Give a notebook' }), saying !== undefined && (_jsx(Button, { variant: "invisible", onClick: () => setSaying(undefined), children: "Hush" })), presence === 'away' ? (_jsx(Button, { onClick: callBack, children: "Call it back" })) : (_jsx(Button, { onClick: () => sendAway('page'), disabled: presence !== 'here', "data-gallery-send-away": "", children: "Send it away" })), _jsx(Text, { sx: { color: 'fg.muted', fontSize: 1 }, children: "Drag the character to move it; hover it for its own send-away menu." }), decision && (_jsx(Text, { role: "status", sx: { fontSize: 1 }, children: decision }))] })] }))] }), problem && (_jsxs(Text, { as: "p", role: "alert", sx: { color: 'danger.fg', mb: 3 }, children: ["The test sprite could not be read: ", problem] })), clippyJs.problem && (_jsxs(Text, { as: "p", role: "alert", sx: { color: 'danger.fg', mb: 3 }, children: ["A clippy.js character could not be read: ", clippyJs.problem] })), _jsx(Still, { still: still, children: view === 'stage' ? (_jsx(InModes, { modes: modes, children: mode => (_jsx(ModePanel, { mode: mode, character: character, pose: pose, presence: presence, balloon: balloon, insist: insist, onToggle: () => saying === undefined ? say() : setSaying(undefined), onDismiss: sendAway, onCallBack: callBack, away: away, replay: replay, display: display, expandTarget: expandIntoPage ? expandArea : undefined })) })) : (_jsx(InModes, { modes: modes, stacked: true, children: mode => (_jsxs(Box, { "data-gallery-mode": mode, sx: {
|
|
235
|
-
bg: 'canvas.default',
|
|
236
|
-
border: '1px solid',
|
|
237
|
-
borderColor: 'border.default',
|
|
238
|
-
borderRadius: 2,
|
|
239
|
-
p: 2,
|
|
240
|
-
overflowX: 'auto',
|
|
241
|
-
}, children: [_jsx(AssistantGalleryGrid, { characters: characters }, replay), _jsx(GalleryBalloons, { character: character })] })) })) }), view === 'stage' && expandIntoPage && (_jsxs(Box, { as: "section", "aria-label": "Expanded here", sx: {
|
|
242
|
-
mt: 4,
|
|
243
|
-
p: 3,
|
|
244
|
-
border: '1px dashed',
|
|
245
|
-
borderColor: 'border.default',
|
|
246
|
-
borderRadius: 2,
|
|
247
|
-
}, children: [_jsxs(Text, { as: "p", sx: { m: 0, mb: 2, color: 'fg.muted', fontSize: 1 }, children: ["Expanded here: what the balloon\u2019s ", _jsx("em", { children: "Expand" }), " draws large when the page names an area for it \u2014 the notebook, to edit and run on the browser sandbox. Without one, it opens in an overlay."] }), _jsx(Box, { ref: expandArea, "data-gallery-expand-target": "" })] }))] }) }) }));
|
|
190
|
+
: 'No tool' }), _jsx(Button, { "data-gallery-notebook": withNotebook ? 'on' : 'off', "aria-pressed": withNotebook, onClick: () => setWithNotebook(!withNotebook), children: withNotebook ? 'Take the notebook' : 'Give a notebook' }), saying !== undefined && (_jsx(Button, { variant: "invisible", onClick: () => setSaying(undefined), children: "Hush" })), presence === 'away' ? (_jsx(Button, { onClick: callBack, children: "Call it back" })) : (_jsx(Button, { onClick: () => sendAway('page'), disabled: presence !== 'here', "data-gallery-send-away": "", children: "Send it away" })), _jsx(Text, { sx: { color: 'fg.muted', fontSize: 1 }, children: "Drag the character to move it; hover it for its own send-away menu." }), decision && (_jsx(Text, { role: "status", sx: { fontSize: 1 }, children: decision }))] })] }))] }), problem && (_jsxs(Text, { as: "p", role: "alert", sx: { color: 'danger.fg', mb: 3 }, children: ["The test sprite could not be read: ", problem] })), clippyJs.problem && (_jsxs(Text, { as: "p", role: "alert", sx: { color: 'danger.fg', mb: 3 }, children: ["A clippy.js character could not be read: ", clippyJs.problem] })), _jsx(Still, { still: still, children: view === 'stage' ? (_jsx(InModes, { modes: modes, children: mode => (_jsx(ModePanel, { mode: mode, character: character, pose: pose, presence: presence, balloon: balloon, insist: insist, onToggle: () => saying === undefined ? say() : setSaying(undefined), onDismiss: sendAway, onCallBack: callBack, away: away, replay: replay, display: display, expandTarget: expandIntoPage ? expandArea : undefined })) })) : (_jsx(InModes, { modes: modes, stacked: true, children: mode => (_jsxs(Box, { "data-gallery-mode": mode, bg: "canvas.default", border: "1px solid", borderColor: "border.default", borderRadius: 2, p: 2, overflowX: "auto", children: [_jsx(AssistantGalleryGrid, { characters: characters }, replay), _jsx(GalleryBalloons, { character: character })] })) })) }), view === 'stage' && expandIntoPage && (_jsxs(Box, { as: "section", "aria-label": "Expanded here", mt: 4, p: 3, border: "1px dashed", borderColor: "border.default", borderRadius: 2, children: [_jsxs(Text, { as: "p", sx: { m: 0, mb: 2, color: 'fg.muted', fontSize: 1 }, children: ["Expanded here: what the balloon\u2019s ", _jsx("em", { children: "Expand" }), " draws large when the page names an area for it \u2014 the notebook, to edit and run on the browser sandbox. Without one, it opens in an overlay."] }), _jsx(Box, { ref: expandArea, "data-gallery-expand-target": "" })] }))] }) }) }));
|
|
248
191
|
};
|
|
249
192
|
export default AssistantGalleryExample;
|
|
@@ -70,12 +70,7 @@ const CellExampleContent = ({ serviceManager }) => {
|
|
|
70
70
|
}, [activeKernel, serviceManager?.serverSettings.baseUrl]);
|
|
71
71
|
const cellsStore = useCellsStore();
|
|
72
72
|
const kernelsStore = useKernelsStore();
|
|
73
|
-
return (_jsxs(Box, { p: 4, children: [_jsx(Heading, { as: "h1", sx: { fontSize: 3, mb: 3 }, children: "Cell Example" }), _jsxs(Box, { sx: {
|
|
74
|
-
display: 'grid',
|
|
75
|
-
gridTemplateColumns: ['1fr', null, 'repeat(3, minmax(0, 1fr))'],
|
|
76
|
-
gap: 3,
|
|
77
|
-
mb: 3,
|
|
78
|
-
}, children: [_jsx(Box, { children: _jsxs(Text, { as: "p", sx: { mb: 0, wordBreak: 'break-word' }, children: ["Source: ", cellsStore.getSource(CELL_ID)] }) }), _jsxs(Box, { children: [_jsxs(Text, { as: "p", sx: { mb: 2 }, children: ["Outputs Count: ", cellsStore.getOutputsCount(CELL_ID)] }), _jsxs(Box, { sx: { mb: 2 }, children: ["Kernel State:", ' ', _jsx(Label, { children: activeKernel && kernelsStore.getExecutionState(activeKernel.id) })] }), _jsxs(Box, { children: ["Kernel Phase:", ' ', _jsx(Label, { children: activeKernel && kernelsStore.getExecutionPhase(activeKernel.id) })] })] }), _jsxs(Box, { children: [_jsx(Button, { sx: { mb: 3 }, onClick: () => cellsStore.execute(CELL_ID), disabled: !activeKernel, children: "Run Cell" }), _jsxs(Box, { sx: { display: 'flex', alignItems: 'center', gap: 2, mb: 3 }, children: [_jsx(Box, { children: "Code Sandbox:" }), _jsx(KernelIndicator, { kernel: activeKernel && activeKernel.connection, environmentName: kernelEnvironmentName, cpu: runtimeEnvironment?.cpu, memory: runtimeEnvironment?.memory, gpu: runtimeEnvironment?.gpu, bordered: false, position: "bottom-left" })] }), !activeKernel && (_jsx(Text, { as: "p", sx: { mb: 0, color: 'fg.muted' }, children: "Waiting for an existing sandbox kernel connection." }))] })] }), activeKernel ? (_jsx(Cell, { source: DEFAULT_SOURCE, id: CELL_ID, kernel: activeKernel }, cellRemountKey)) : null] }));
|
|
73
|
+
return (_jsxs(Box, { p: 4, children: [_jsx(Heading, { as: "h1", sx: { fontSize: 3, mb: 3 }, children: "Cell Example" }), _jsxs(Box, { display: "grid", gridTemplateColumns: ['1fr', null, 'repeat(3, minmax(0, 1fr))'], gap: 3, mb: 3, children: [_jsx(Box, { children: _jsxs(Text, { as: "p", sx: { mb: 0, wordBreak: 'break-word' }, children: ["Source: ", cellsStore.getSource(CELL_ID)] }) }), _jsxs(Box, { children: [_jsxs(Text, { as: "p", sx: { mb: 2 }, children: ["Outputs Count: ", cellsStore.getOutputsCount(CELL_ID)] }), _jsxs(Box, { mb: 2, children: ["Kernel State:", ' ', _jsx(Label, { children: activeKernel && kernelsStore.getExecutionState(activeKernel.id) })] }), _jsxs(Box, { children: ["Kernel Phase:", ' ', _jsx(Label, { children: activeKernel && kernelsStore.getExecutionPhase(activeKernel.id) })] })] }), _jsxs(Box, { children: [_jsx(Button, { sx: { mb: 3 }, onClick: () => cellsStore.execute(CELL_ID), disabled: !activeKernel, children: "Run Cell" }), _jsxs(Box, { display: "flex", alignItems: "center", gap: 2, mb: 3, children: [_jsx(Box, { children: "Code Sandbox:" }), _jsx(KernelIndicator, { kernel: activeKernel && activeKernel.connection, environmentName: kernelEnvironmentName, cpu: runtimeEnvironment?.cpu, memory: runtimeEnvironment?.memory, gpu: runtimeEnvironment?.gpu, bordered: false, position: "bottom-left" })] }), !activeKernel && (_jsx(Text, { as: "p", sx: { mb: 0, color: 'fg.muted' }, children: "Waiting for an existing sandbox kernel connection." }))] })] }), activeKernel ? (_jsx(Cell, { source: DEFAULT_SOURCE, id: CELL_ID, kernel: activeKernel }, cellRemountKey)) : null] }));
|
|
79
74
|
};
|
|
80
75
|
export const CellExample = (props) => {
|
|
81
76
|
const { serviceManager } = props;
|
|
@@ -55,41 +55,12 @@ Be concise, helpful, and provide working code examples when appropriate.`,
|
|
|
55
55
|
});
|
|
56
56
|
const isLoading = !isReady && status !== 'error';
|
|
57
57
|
const retry = () => window.location.reload();
|
|
58
|
-
return (_jsx(QueryClientProvider, { client: queryClient, children: _jsx(ThemedProvider, { children: _jsxs(Box, { sx: {
|
|
59
|
-
display: 'flex',
|
|
60
|
-
flexDirection: 'column',
|
|
61
|
-
height: '100vh',
|
|
62
|
-
backgroundColor: 'canvas.default',
|
|
63
|
-
}, children: [_jsxs(Box, { as: "header", sx: {
|
|
64
|
-
borderBottom: '1px solid',
|
|
65
|
-
borderColor: 'border.default',
|
|
66
|
-
padding: 3,
|
|
67
|
-
}, children: [_jsx(Text, { sx: {
|
|
58
|
+
return (_jsx(QueryClientProvider, { client: queryClient, children: _jsx(ThemedProvider, { children: _jsxs(Box, { display: "flex", flexDirection: "column", height: "100vh", backgroundColor: "canvas.default", children: [_jsxs(Box, { as: "header", borderBottom: "1px solid", borderColor: "border.default", padding: 3, children: [_jsx(Text, { sx: {
|
|
68
59
|
fontSize: 3,
|
|
69
60
|
fontWeight: 'bold',
|
|
70
61
|
display: 'block',
|
|
71
62
|
marginBottom: 1,
|
|
72
|
-
}, children: "Custom Chat Example" }), _jsx(Text, { sx: { fontSize: 1, color: 'fg.muted' }, children: "Interactive chat interface with AI assistance" })] }), _jsx(Box, { as: "main", sx: {
|
|
73
|
-
flex: 1,
|
|
74
|
-
overflow: 'hidden',
|
|
75
|
-
display: 'flex',
|
|
76
|
-
flexDirection: 'column',
|
|
77
|
-
}, children: isLoading ? (_jsxs(Box, { sx: {
|
|
78
|
-
display: 'flex',
|
|
79
|
-
flexDirection: 'column',
|
|
80
|
-
alignItems: 'center',
|
|
81
|
-
justifyContent: 'center',
|
|
82
|
-
height: '100%',
|
|
83
|
-
gap: 3,
|
|
84
|
-
}, children: [_jsx(Spinner, { size: "large" }), _jsx(Text, { sx: { color: 'fg.muted' }, children: "Initializing agent..." })] })) : error ? (_jsxs(Box, { sx: {
|
|
85
|
-
display: 'flex',
|
|
86
|
-
flexDirection: 'column',
|
|
87
|
-
alignItems: 'center',
|
|
88
|
-
justifyContent: 'center',
|
|
89
|
-
height: '100%',
|
|
90
|
-
gap: 3,
|
|
91
|
-
p: 4,
|
|
92
|
-
}, children: [_jsx(Text, { sx: { color: 'danger.fg', fontWeight: 'bold' }, children: "Failed to initialize agent" }), _jsx(Text, { sx: { color: 'fg.muted', textAlign: 'center' }, children: error }), _jsx(Text, { as: "button", onClick: retry, sx: {
|
|
63
|
+
}, children: "Custom Chat Example" }), _jsx(Text, { sx: { fontSize: 1, color: 'fg.muted' }, children: "Interactive chat interface with AI assistance" })] }), _jsx(Box, { as: "main", flex: 1, overflow: "hidden", display: "flex", flexDirection: "column", children: isLoading ? (_jsxs(Box, { display: "flex", flexDirection: "column", alignItems: "center", justifyContent: "center", height: "100%", gap: 3, children: [_jsx(Spinner, { size: "large" }), _jsx(Text, { sx: { color: 'fg.muted' }, children: "Initializing agent..." })] })) : error ? (_jsxs(Box, { display: "flex", flexDirection: "column", alignItems: "center", justifyContent: "center", height: "100%", gap: 3, p: 4, children: [_jsx(Text, { sx: { color: 'danger.fg', fontWeight: 'bold' }, children: "Failed to initialize agent" }), _jsx(Text, { sx: { color: 'fg.muted', textAlign: 'center' }, children: error }), _jsx(Text, { as: "button", onClick: retry, sx: {
|
|
93
64
|
color: 'accent.fg',
|
|
94
65
|
cursor: 'pointer',
|
|
95
66
|
textDecoration: 'underline',
|
|
@@ -60,15 +60,7 @@ const AgentRuntimeChatExample = () => {
|
|
|
60
60
|
const isCreating = !inBrowser && !isReady && status !== 'error';
|
|
61
61
|
// Loading state while agent is being created
|
|
62
62
|
if (isCreating) {
|
|
63
|
-
return (_jsx(ThemedProvider, { children: _jsxs(Box, { sx: {
|
|
64
|
-
display: 'flex',
|
|
65
|
-
flexDirection: 'column',
|
|
66
|
-
alignItems: 'center',
|
|
67
|
-
justifyContent: 'center',
|
|
68
|
-
height: '100vh',
|
|
69
|
-
gap: 3,
|
|
70
|
-
bg: 'canvas.default',
|
|
71
|
-
}, children: [_jsx(Spinner, { size: "large" }), _jsxs(Text, { sx: { color: 'fg.muted' }, children: ["Creating agent from ", AGENTSPEC_ID, "..."] })] }) }));
|
|
63
|
+
return (_jsx(ThemedProvider, { children: _jsxs(Box, { display: "flex", flexDirection: "column", alignItems: "center", justifyContent: "center", height: "100vh", gap: 3, bg: "canvas.default", children: [_jsx(Spinner, { size: "large" }), _jsxs(Text, { sx: { color: 'fg.muted' }, children: ["Creating agent from ", AGENTSPEC_ID, "..."] })] }) }));
|
|
72
64
|
}
|
|
73
65
|
// Error state. In the browser there is no agent id to have — the loop is
|
|
74
66
|
// here — so the only thing that can be missing is the sign-in the inference
|
|
@@ -97,14 +97,7 @@ const AgentRuntimePopupStandaloneExample = () => {
|
|
|
97
97
|
throw err;
|
|
98
98
|
}
|
|
99
99
|
}, []);
|
|
100
|
-
return (_jsx(ThemedProvider, { children: _jsxs(Box, { sx: {
|
|
101
|
-
minHeight: '100vh',
|
|
102
|
-
backgroundColor: 'canvas.default',
|
|
103
|
-
padding: 4,
|
|
104
|
-
}, children: [_jsxs(Box, { sx: {
|
|
105
|
-
maxWidth: '800px',
|
|
106
|
-
margin: '0 auto',
|
|
107
|
-
}, children: [_jsx(Text, { as: "h1", sx: {
|
|
100
|
+
return (_jsx(ThemedProvider, { children: _jsxs(Box, { minHeight: "100vh", backgroundColor: "canvas.default", padding: 4, children: [_jsxs(Box, { maxWidth: "800px", margin: "0 auto", children: [_jsx(Text, { as: "h1", sx: {
|
|
108
101
|
fontSize: 4,
|
|
109
102
|
fontWeight: 'bold',
|
|
110
103
|
marginBottom: 2,
|
|
@@ -112,28 +105,7 @@ const AgentRuntimePopupStandaloneExample = () => {
|
|
|
112
105
|
fontSize: 2,
|
|
113
106
|
color: 'fg.muted',
|
|
114
107
|
marginBottom: 4,
|
|
115
|
-
}, children: "A standalone floating chat popup with props-based message handling. Click the chat button in the bottom-right corner to start!" }), _jsxs(Box, { sx: {
|
|
116
|
-
padding: 4,
|
|
117
|
-
backgroundColor: 'canvas.default',
|
|
118
|
-
borderRadius: 2,
|
|
119
|
-
border: '1px solid',
|
|
120
|
-
borderColor: 'border.default',
|
|
121
|
-
marginBottom: 4,
|
|
122
|
-
}, children: [_jsx(Text, { as: "h2", sx: { fontSize: 2, fontWeight: 'semibold', marginBottom: 2 }, children: "Key Features" }), _jsxs(Box, { as: "ul", sx: { paddingLeft: 3 }, children: [_jsxs(Box, { as: "li", sx: { marginBottom: 2 }, children: [_jsx(Text, { sx: { fontWeight: 'semibold' }, children: "Props-based Handler" }), _jsxs(Text, { sx: { fontSize: 1, color: 'fg.muted', display: 'block' }, children: ["Implement your own ", _jsx("code", { children: "onSendMessage" }), " function to connect to any AI backend"] })] }), _jsxs(Box, { as: "li", sx: { marginBottom: 2 }, children: [_jsx(Text, { sx: { fontWeight: 'semibold' }, children: "Streaming Support" }), _jsxs(Text, { sx: { fontSize: 1, color: 'fg.muted', display: 'block' }, children: ["Use the ", _jsx("code", { children: "onChunk" }), " callback for real-time streaming responses"] })] }), _jsxs(Box, { as: "li", sx: { marginBottom: 2 }, children: [_jsx(Text, { sx: { fontWeight: 'semibold' }, children: "Full Customization" }), _jsx(Text, { sx: { fontSize: 1, color: 'fg.muted', display: 'block' }, children: "Brand colors, icons, position, keyboard shortcuts, and more" })] }), _jsxs(Box, { as: "li", sx: { marginBottom: 2 }, children: [_jsx(Text, { sx: { fontWeight: 'semibold' }, children: "No Backend Required" }), _jsx(Text, { sx: { fontSize: 1, color: 'fg.muted', display: 'block' }, children: "Unlike AG-UI examples, this works without a server (demo mode)" })] })] })] }), _jsxs(Box, { sx: {
|
|
123
|
-
padding: 4,
|
|
124
|
-
backgroundColor: 'canvas.default',
|
|
125
|
-
borderRadius: 2,
|
|
126
|
-
border: '1px solid',
|
|
127
|
-
borderColor: 'border.default',
|
|
128
|
-
marginBottom: 4,
|
|
129
|
-
}, children: [_jsx(Text, { as: "h2", sx: { fontSize: 2, fontWeight: 'semibold', marginBottom: 2 }, children: "Usage Example" }), _jsx(Box, { as: "pre", sx: {
|
|
130
|
-
backgroundColor: 'neutral.emphasisPlus',
|
|
131
|
-
color: 'fg.onEmphasis',
|
|
132
|
-
padding: 3,
|
|
133
|
-
borderRadius: 2,
|
|
134
|
-
overflow: 'auto',
|
|
135
|
-
fontSize: 0,
|
|
136
|
-
}, children: _jsx("code", { children: `<ChatStandalone
|
|
108
|
+
}, children: "A standalone floating chat popup with props-based message handling. Click the chat button in the bottom-right corner to start!" }), _jsxs(Box, { padding: 4, backgroundColor: "canvas.default", borderRadius: 2, border: "1px solid", borderColor: "border.default", marginBottom: 4, children: [_jsx(Text, { as: "h2", sx: { fontSize: 2, fontWeight: 'semibold', marginBottom: 2 }, children: "Key Features" }), _jsxs(Box, { as: "ul", paddingLeft: 3, children: [_jsxs(Box, { as: "li", marginBottom: 2, children: [_jsx(Text, { sx: { fontWeight: 'semibold' }, children: "Props-based Handler" }), _jsxs(Text, { sx: { fontSize: 1, color: 'fg.muted', display: 'block' }, children: ["Implement your own ", _jsx("code", { children: "onSendMessage" }), " function to connect to any AI backend"] })] }), _jsxs(Box, { as: "li", marginBottom: 2, children: [_jsx(Text, { sx: { fontWeight: 'semibold' }, children: "Streaming Support" }), _jsxs(Text, { sx: { fontSize: 1, color: 'fg.muted', display: 'block' }, children: ["Use the ", _jsx("code", { children: "onChunk" }), " callback for real-time streaming responses"] })] }), _jsxs(Box, { as: "li", marginBottom: 2, children: [_jsx(Text, { sx: { fontWeight: 'semibold' }, children: "Full Customization" }), _jsx(Text, { sx: { fontSize: 1, color: 'fg.muted', display: 'block' }, children: "Brand colors, icons, position, keyboard shortcuts, and more" })] }), _jsxs(Box, { as: "li", marginBottom: 2, children: [_jsx(Text, { sx: { fontWeight: 'semibold' }, children: "No Backend Required" }), _jsx(Text, { sx: { fontSize: 1, color: 'fg.muted', display: 'block' }, children: "Unlike AG-UI examples, this works without a server (demo mode)" })] })] })] }), _jsxs(Box, { padding: 4, backgroundColor: "canvas.default", borderRadius: 2, border: "1px solid", borderColor: "border.default", marginBottom: 4, children: [_jsx(Text, { as: "h2", sx: { fontSize: 2, fontWeight: 'semibold', marginBottom: 2 }, children: "Usage Example" }), _jsx(Box, { as: "pre", backgroundColor: "neutral.emphasisPlus", color: "fg.onEmphasis", padding: 3, borderRadius: 2, overflow: "auto", fontSize: 0, children: _jsx("code", { children: `<ChatStandalone
|
|
137
109
|
title="My Assistant"
|
|
138
110
|
onSendMessage={async (message, options) => {
|
|
139
111
|
// Your custom AI logic here
|
|
@@ -147,12 +119,6 @@ const AgentRuntimePopupStandaloneExample = () => {
|
|
|
147
119
|
}}
|
|
148
120
|
brandColor="#7c3aed"
|
|
149
121
|
position="bottom-right"
|
|
150
|
-
/>` }) })] }), _jsxs(Box, { sx: {
|
|
151
|
-
padding: 4,
|
|
152
|
-
backgroundColor: 'attention.subtle',
|
|
153
|
-
borderRadius: 2,
|
|
154
|
-
border: '1px solid',
|
|
155
|
-
borderColor: 'attention.muted',
|
|
156
|
-
}, children: [_jsx(Text, { as: "h2", sx: { fontSize: 2, fontWeight: 'semibold', marginBottom: 2 }, children: "When to Use" }), _jsxs(Text, { as: "p", sx: { fontSize: 1, marginBottom: 2 }, children: ["Use ", _jsx("strong", { children: "ChatStandalone" }), " when:"] }), _jsxs(Box, { as: "ul", sx: { paddingLeft: 3, fontSize: 1 }, children: [_jsx("li", { children: "You have a custom AI backend that does not use AG-UI/ACP" }), _jsx("li", { children: "You want full control over the message handling logic" }), _jsx("li", { children: "You need to integrate with a specific API (OpenAI, etc.)" }), _jsx("li", { children: "You want a quick demo without setting up a backend server" })] }), _jsxs(Text, { as: "p", sx: { fontSize: 1, marginTop: 2 }, children: ["Use ", _jsx("strong", { children: "ChatFloating" }), " instead when:"] }), _jsxs(Box, { as: "ul", sx: { paddingLeft: 3, fontSize: 1 }, children: [_jsx("li", { children: "You have an AG-UI compatible backend" }), _jsx("li", { children: "You need built-in tool rendering support" }), _jsx("li", { children: "You want automatic protocol handling" })] })] })] }), _jsx(ChatStandalone, { title: "Demo Assistant", onSendMessage: handleSendMessage, position: "bottom-right", enableStreaming: true, emptyStateMessage: "Hi! I'm a demo assistant. Try asking me for the time, a joke, or what I can do!", buttonTooltip: "Chat with Demo Assistant", showPoweredBy: true })] }) }));
|
|
122
|
+
/>` }) })] }), _jsxs(Box, { padding: 4, backgroundColor: "attention.subtle", borderRadius: 2, border: "1px solid", borderColor: "attention.muted", children: [_jsx(Text, { as: "h2", sx: { fontSize: 2, fontWeight: 'semibold', marginBottom: 2 }, children: "When to Use" }), _jsxs(Text, { as: "p", sx: { fontSize: 1, marginBottom: 2 }, children: ["Use ", _jsx("strong", { children: "ChatStandalone" }), " when:"] }), _jsxs(Box, { as: "ul", paddingLeft: 3, fontSize: 1, children: [_jsx("li", { children: "You have a custom AI backend that does not use AG-UI/ACP" }), _jsx("li", { children: "You want full control over the message handling logic" }), _jsx("li", { children: "You need to integrate with a specific API (OpenAI, etc.)" }), _jsx("li", { children: "You want a quick demo without setting up a backend server" })] }), _jsxs(Text, { as: "p", sx: { fontSize: 1, marginTop: 2 }, children: ["Use ", _jsx("strong", { children: "ChatFloating" }), " instead when:"] }), _jsxs(Box, { as: "ul", paddingLeft: 3, fontSize: 1, children: [_jsx("li", { children: "You have an AG-UI compatible backend" }), _jsx("li", { children: "You need built-in tool rendering support" }), _jsx("li", { children: "You want automatic protocol handling" })] })] })] }), _jsx(ChatStandalone, { title: "Demo Assistant", onSendMessage: handleSendMessage, position: "bottom-right", enableStreaming: true, emptyStateMessage: "Hi! I'm a demo assistant. Try asking me for the time, a joke, or what I can do!", buttonTooltip: "Chat with Demo Assistant", showPoweredBy: true })] }) }));
|
|
157
123
|
};
|
|
158
124
|
export default AgentRuntimePopupStandaloneExample;
|
|
@@ -77,30 +77,7 @@ const LexicalUI = React.memo(function LexicalUI({ content = INITIAL_CONTENT, ser
|
|
|
77
77
|
const handleChange = useCallback((_editorState) => {
|
|
78
78
|
// onChange handler - can be used for tracking changes
|
|
79
79
|
}, []);
|
|
80
|
-
return (_jsx(Box, {
|
|
81
|
-
height: '100vh',
|
|
82
|
-
width: '100vw',
|
|
83
|
-
display: 'flex',
|
|
84
|
-
overflow: 'hidden',
|
|
85
|
-
}, children: _jsxs(Box, { sx: {
|
|
86
|
-
flex: 1,
|
|
87
|
-
display: 'flex',
|
|
88
|
-
flexDirection: 'column',
|
|
89
|
-
overflow: 'auto',
|
|
90
|
-
padding: 3,
|
|
91
|
-
}, children: [_jsxs(Box, { sx: {
|
|
92
|
-
marginBottom: 3,
|
|
93
|
-
paddingBottom: 3,
|
|
94
|
-
borderBottom: '1px solid',
|
|
95
|
-
borderColor: 'border.default',
|
|
96
|
-
}, children: [_jsx("h1", { children: "CopilotKit Lexical Example" }), _jsx("p", { children: "Platform-agnostic tool usage with CopilotKit integration. Use the AI copilot to manipulate the document." })] }), _jsx(Box, { sx: {
|
|
97
|
-
border: '1px solid',
|
|
98
|
-
borderColor: 'border.default',
|
|
99
|
-
borderRadius: 2,
|
|
100
|
-
padding: 3,
|
|
101
|
-
backgroundColor: 'canvas.default',
|
|
102
|
-
minHeight: '600px',
|
|
103
|
-
}, children: _jsx(LexicalConfigProvider, { lexicalId: LEXICAL_ID, serviceManager: serviceManager, children: _jsx(LexicalExtensionComposer, { extension: editorExtension, contentEditable: null, children: _jsxs("div", { className: "lexical-editor-inner", ref: onRef, children: [_jsx(LexicalStatePlugin, {}), _jsx(ContentEditable, { className: "lexical-editor-content", "aria-label": "Lexical Editor" }), _jsx(OnChangePlugin, { onChange: handleChange }), _jsx(TableCellResizerPlugin, {}), _jsx(LoadContentPlugin, { content: content }), _jsx(ThemedJupyterProvider, { children: _jsx(SimpleKernelPluginsInner, {}) }), floatingAnchorElem && (_jsxs(_Fragment, { children: [_jsx(DraggableBlockPlugin, { anchorElem: floatingAnchorElem }), _jsx(FloatingTextFormatToolbarPlugin, { anchorElem: floatingAnchorElem, setIsLinkEditMode: setIsLinkEditMode }), _jsx(CodeActionMenuPlugin, { anchorElem: floatingAnchorElem })] }))] }) }) }) })] }) }));
|
|
80
|
+
return (_jsx(Box, { height: "100vh", width: "100vw", display: "flex", overflow: "hidden", children: _jsxs(Box, { flex: 1, display: "flex", flexDirection: "column", overflow: "auto", padding: 3, children: [_jsxs(Box, { marginBottom: 3, paddingBottom: 3, borderBottom: "1px solid", borderColor: "border.default", children: [_jsx("h1", { children: "CopilotKit Lexical Example" }), _jsx("p", { children: "Platform-agnostic tool usage with CopilotKit integration. Use the AI copilot to manipulate the document." })] }), _jsx(Box, { border: "1px solid", borderColor: "border.default", borderRadius: 2, padding: 3, backgroundColor: "canvas.default", minHeight: "600px", children: _jsx(LexicalConfigProvider, { lexicalId: LEXICAL_ID, serviceManager: serviceManager, children: _jsx(LexicalExtensionComposer, { extension: editorExtension, contentEditable: null, children: _jsxs("div", { className: "lexical-editor-inner", ref: onRef, children: [_jsx(LexicalStatePlugin, {}), _jsx(ContentEditable, { className: "lexical-editor-content", "aria-label": "Lexical Editor" }), _jsx(OnChangePlugin, { onChange: handleChange }), _jsx(TableCellResizerPlugin, {}), _jsx(LoadContentPlugin, { content: content }), _jsx(ThemedJupyterProvider, { children: _jsx(SimpleKernelPluginsInner, {}) }), floatingAnchorElem && (_jsxs(_Fragment, { children: [_jsx(DraggableBlockPlugin, { anchorElem: floatingAnchorElem }), _jsx(FloatingTextFormatToolbarPlugin, { anchorElem: floatingAnchorElem, setIsLinkEditMode: setIsLinkEditMode }), _jsx(CodeActionMenuPlugin, { anchorElem: floatingAnchorElem })] }))] }) }) }) })] }) }));
|
|
104
81
|
});
|
|
105
82
|
function LexicalWithTools({ content, serviceManager, }) {
|
|
106
83
|
// Get all actions for this lexical document
|
|
@@ -13,7 +13,7 @@ registerDeckComponents(exampleDeckComponents);
|
|
|
13
13
|
// Module-level, so the embed builds its reactor once rather than on every
|
|
14
14
|
// render of this component.
|
|
15
15
|
const DECK_PLUGINS = [LoopDecksPlugin, DeckViewPlugin];
|
|
16
|
-
const DecksAgent = () => (_jsx(ThemedProvider, { children: _jsx(Box, {
|
|
16
|
+
const DecksAgent = () => (_jsx(ThemedProvider, { children: _jsx(Box, { height: "100vh", minHeight: 0, children: _jsx(LoopEmbed, { target: "browser", agentId: "example-decks",
|
|
17
17
|
/* The deck open beside the chat from the first frame. */
|
|
18
18
|
defaultEditor: "deck",
|
|
19
19
|
/* The header carries the editor choice — deck, notebook, document, or
|
|
@@ -2,7 +2,7 @@ import { jsx as _jsx } from "react/jsx-runtime";
|
|
|
2
2
|
import { Box } from '@datalayer/primer-addons';
|
|
3
3
|
import { ThemedProvider } from './utils/themedProvider';
|
|
4
4
|
import { LoopEmbed } from '../loop';
|
|
5
|
-
const DocumentPageAgent = () => (_jsx(ThemedProvider, { children: _jsx(Box, {
|
|
5
|
+
const DocumentPageAgent = () => (_jsx(ThemedProvider, { children: _jsx(Box, { height: "100vh", minHeight: 0, children: _jsx(LoopEmbed, { target: "browser",
|
|
6
6
|
/* The Loop Shell's agent: it drives the document tools — insert a
|
|
7
7
|
block, run a code block, read the document — as readily as the
|
|
8
8
|
notebook's, and its openers work on either. */
|
|
@@ -4,75 +4,27 @@ import { Heading, Text, TextInput, Label } from '@primer/react';
|
|
|
4
4
|
import { SearchIcon } from '@primer/octicons-react';
|
|
5
5
|
const HomeExample = ({ examples = [], searchQuery = '', onSearchChange, onSelectExample, }) => {
|
|
6
6
|
const sortedExamples = [...examples].sort((a, b) => a.title.localeCompare(b.title));
|
|
7
|
-
return (_jsx(Box, { sx: {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
}, children: _jsxs(Box, { sx: {
|
|
13
|
-
maxWidth: '1600px',
|
|
14
|
-
margin: '0 auto',
|
|
15
|
-
p: 4,
|
|
16
|
-
display: 'flex',
|
|
17
|
-
flexDirection: 'column',
|
|
18
|
-
gap: 3,
|
|
19
|
-
}, children: [_jsxs(Box, { sx: {
|
|
20
|
-
display: 'flex',
|
|
21
|
-
justifyContent: 'space-between',
|
|
22
|
-
alignItems: 'center',
|
|
23
|
-
gap: 3,
|
|
24
|
-
flexWrap: 'wrap',
|
|
25
|
-
}, children: [_jsxs(Box, { children: [_jsx(Heading, { as: "h2", sx: { fontSize: 4, mb: 1 }, children: "Agent Runtimes Examples" }), _jsx(Text, { sx: { color: 'fg.muted', fontSize: 1 }, children: "Browse all examples as cards and open any flow in one click." })] }), _jsx(TextInput, { autoFocus: true, value: searchQuery, onChange: event => onSearchChange?.(event.target.value), placeholder: "Search examples", leadingVisual: SearchIcon, sx: { minWidth: ['100%', '320px'] } })] }), sortedExamples.length === 0 ? (_jsx(Box, { sx: {
|
|
26
|
-
border: '1px dashed',
|
|
27
|
-
borderColor: 'border.default',
|
|
28
|
-
borderRadius: 3,
|
|
29
|
-
p: 4,
|
|
30
|
-
textAlign: 'center',
|
|
31
|
-
color: 'fg.muted',
|
|
32
|
-
}, children: "No examples match your search." })) : (_jsx(Box, { sx: {
|
|
33
|
-
display: 'grid',
|
|
34
|
-
gridTemplateColumns: [
|
|
35
|
-
'1fr',
|
|
36
|
-
'repeat(2, minmax(0, 1fr))',
|
|
37
|
-
'repeat(4, minmax(0, 1fr))',
|
|
38
|
-
],
|
|
39
|
-
gap: 3,
|
|
40
|
-
}, children: sortedExamples.map(example => (_jsxs(Box, { role: "button", tabIndex: 0, onClick: () => onSelectExample?.(example.id), onKeyDown: event => {
|
|
7
|
+
return (_jsx(Box, { width: "100%", height: "100%", overflow: "auto", bg: "canvas.default", children: _jsxs(Box, { maxWidth: "1600px", margin: "0 auto", p: 4, display: "flex", flexDirection: "column", gap: 3, children: [_jsxs(Box, { display: "flex", justifyContent: "space-between", alignItems: "center", gap: 3, flexWrap: "wrap", children: [_jsxs(Box, { children: [_jsx(Heading, { as: "h2", sx: { fontSize: 4, mb: 1 }, children: "Agent Runtimes Examples" }), _jsx(Text, { sx: { color: 'fg.muted', fontSize: 1 }, children: "Browse all examples as cards and open any flow in one click." })] }), _jsx(TextInput, { autoFocus: true, value: searchQuery, onChange: event => onSearchChange?.(event.target.value), placeholder: "Search examples", leadingVisual: SearchIcon, sx: { minWidth: ['100%', '320px'] } })] }), sortedExamples.length === 0 ? (_jsx(Box, { border: "1px dashed", borderColor: "border.default", borderRadius: 3, p: 4, textAlign: "center", color: "fg.muted", children: "No examples match your search." })) : (_jsx(Box, { display: "grid", gridTemplateColumns: [
|
|
8
|
+
'1fr',
|
|
9
|
+
'repeat(2, minmax(0, 1fr))',
|
|
10
|
+
'repeat(4, minmax(0, 1fr))',
|
|
11
|
+
], gap: 3, children: sortedExamples.map(example => (_jsxs(Box, { role: "button", tabIndex: 0, onClick: () => onSelectExample?.(example.id), onKeyDown: event => {
|
|
41
12
|
if (event.key === 'Enter' || event.key === ' ') {
|
|
42
13
|
event.preventDefault();
|
|
43
14
|
onSelectExample?.(example.id);
|
|
44
15
|
}
|
|
45
|
-
},
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
gap: 2,
|
|
54
|
-
cursor: 'pointer',
|
|
55
|
-
transition: 'box-shadow 0.2s, transform 0.2s, border-color 0.2s',
|
|
56
|
-
'&:hover': {
|
|
57
|
-
boxShadow: 'shadow.large',
|
|
58
|
-
transform: 'translateY(-2px)',
|
|
59
|
-
borderColor: 'accent.emphasis',
|
|
60
|
-
},
|
|
61
|
-
'&:focus-visible': {
|
|
62
|
-
outline: '2px solid',
|
|
63
|
-
outlineColor: 'accent.emphasis',
|
|
64
|
-
outlineOffset: '2px',
|
|
65
|
-
},
|
|
16
|
+
}, bg: "canvas.default", p: 4, borderRadius: "12px", border: "1px solid", borderColor: "border.default", display: "flex", flexDirection: "column", gap: 2, cursor: "pointer", transition: "box-shadow 0.2s, transform 0.2s, border-color 0.2s", hover: {
|
|
17
|
+
boxShadow: 'shadow.large',
|
|
18
|
+
transform: 'translateY(-2px)',
|
|
19
|
+
borderColor: 'accent.emphasis',
|
|
20
|
+
}, focusVisible: {
|
|
21
|
+
outline: '2px solid',
|
|
22
|
+
outlineColor: 'accent.emphasis',
|
|
23
|
+
outlineOffset: '2px',
|
|
66
24
|
}, children: [_jsx(Heading, { as: "h3", sx: { fontSize: 2, fontWeight: 'bold' }, children: example.title }), _jsx(Text, { sx: { color: 'fg.muted', fontSize: 1, lineHeight: 1.6 }, children: example.description }), _jsx(Text, { sx: {
|
|
67
25
|
color: 'fg.muted',
|
|
68
26
|
fontSize: 0,
|
|
69
27
|
fontFamily: 'mono',
|
|
70
|
-
}, children: example.id }), example.tags.length > 0 && (_jsx(Box, {
|
|
71
|
-
display: 'flex',
|
|
72
|
-
gap: 1,
|
|
73
|
-
flexWrap: 'wrap',
|
|
74
|
-
mt: 'auto',
|
|
75
|
-
pt: 2,
|
|
76
|
-
}, children: example.tags.map(tag => (_jsx(Label, { variant: "secondary", children: tag }, `${example.id}-${tag}`))) }))] }, example.id))) }))] }) }));
|
|
28
|
+
}, children: example.id }), example.tags.length > 0 && (_jsx(Box, { display: "flex", gap: 1, flexWrap: "wrap", mt: "auto", pt: 2, children: example.tags.map(tag => (_jsx(Label, { variant: "secondary", children: tag }, `${example.id}-${tag}`))) }))] }, example.id))) }))] }) }));
|
|
77
29
|
};
|
|
78
30
|
export default HomeExample;
|
|
@@ -110,13 +110,7 @@ function LexicalEditor({ serviceManager: _serviceManager, }) {
|
|
|
110
110
|
const onChange = useCallback((_editorState) => {
|
|
111
111
|
// Could persist state here
|
|
112
112
|
}, []);
|
|
113
|
-
return (_jsx(LexicalExtensionComposer, { extension: editorExtension, contentEditable: null, children: _jsxs(Box, {
|
|
114
|
-
position: 'relative',
|
|
115
|
-
flex: 1,
|
|
116
|
-
display: 'flex',
|
|
117
|
-
flexDirection: 'column',
|
|
118
|
-
overflow: 'hidden',
|
|
119
|
-
}, children: [_jsx("div", { ref: onRef, style: { flex: 1, display: 'flex', flexDirection: 'column' }, children: _jsx(ContentEditable, { placeholder: _jsx("div", { style: {
|
|
113
|
+
return (_jsx(LexicalExtensionComposer, { extension: editorExtension, contentEditable: null, children: _jsxs(Box, { position: "relative", flex: 1, display: "flex", flexDirection: "column", overflow: "hidden", children: [_jsx("div", { ref: onRef, style: { flex: 1, display: 'flex', flexDirection: 'column' }, children: _jsx(ContentEditable, { placeholder: _jsx("div", { style: {
|
|
120
114
|
position: 'absolute',
|
|
121
115
|
top: '24px',
|
|
122
116
|
left: '24px',
|
|
@@ -156,37 +150,14 @@ export function ChatLexicalExampleInner({ serviceManager, }) {
|
|
|
156
150
|
useChatStore.getState().setInferenceProvider(null);
|
|
157
151
|
};
|
|
158
152
|
}, []);
|
|
159
|
-
return (_jsxs(_Fragment, { children: [_jsx(LexicalToolRegistrar, {}), _jsx(CustomToolsRegistrar, {}), _jsxs(Box, { sx: {
|
|
160
|
-
height: '100vh',
|
|
161
|
-
width: '100vw',
|
|
162
|
-
display: 'flex',
|
|
163
|
-
flexDirection: 'column',
|
|
164
|
-
overflow: 'hidden',
|
|
165
|
-
}, children: [_jsxs(Box, { sx: {
|
|
166
|
-
p: 3,
|
|
167
|
-
borderBottom: '1px solid',
|
|
168
|
-
borderColor: 'border.default',
|
|
169
|
-
bg: 'canvas.default',
|
|
170
|
-
display: 'flex',
|
|
171
|
-
justifyContent: 'space-between',
|
|
172
|
-
alignItems: 'center',
|
|
173
|
-
}, children: [_jsxs("div", { children: [_jsx("h1", { style: { margin: 0, fontSize: '1.5rem' }, children: "Chat Lexical Example" }), _jsx("p", { style: { margin: '8px 0 0', color: 'var(--fgColor-muted)' }, children: "Sidebar popup chat with Lexical editor integration." })] }), _jsx(Box, { sx: {
|
|
174
|
-
display: 'flex',
|
|
175
|
-
gap: 2,
|
|
176
|
-
alignItems: 'center',
|
|
177
|
-
}, children: _jsxs(Text, { sx: { fontSize: 1, color: 'fg.muted' }, children: ["Press", ' ', _jsx("kbd", { style: {
|
|
153
|
+
return (_jsxs(_Fragment, { children: [_jsx(LexicalToolRegistrar, {}), _jsx(CustomToolsRegistrar, {}), _jsxs(Box, { height: "100vh", width: "100vw", display: "flex", flexDirection: "column", overflow: "hidden", children: [_jsxs(Box, { p: 3, borderBottom: "1px solid", borderColor: "border.default", bg: "canvas.default", display: "flex", justifyContent: "space-between", alignItems: "center", children: [_jsxs("div", { children: [_jsx("h1", { style: { margin: 0, fontSize: '1.5rem' }, children: "Chat Lexical Example" }), _jsx("p", { style: { margin: '8px 0 0', color: 'var(--fgColor-muted)' }, children: "Sidebar popup chat with Lexical editor integration." })] }), _jsx(Box, { display: "flex", gap: 2, alignItems: "center", children: _jsxs(Text, { sx: { fontSize: 1, color: 'fg.muted' }, children: ["Press", ' ', _jsx("kbd", { style: {
|
|
178
154
|
padding: '2px 6px',
|
|
179
155
|
borderRadius: '4px',
|
|
180
156
|
backgroundColor: 'var(--bgColor-neutral-muted)',
|
|
181
157
|
border: '1px solid var(--borderColor-default)',
|
|
182
158
|
fontFamily: 'monospace',
|
|
183
159
|
fontSize: '12px',
|
|
184
|
-
}, children: "\u2318/" }), ' ', "or click the button to open chat"] }) })] }), _jsx(Box, {
|
|
185
|
-
flex: 1,
|
|
186
|
-
display: 'flex',
|
|
187
|
-
overflow: 'hidden',
|
|
188
|
-
bg: 'canvas.default',
|
|
189
|
-
}, children: _jsx(LexicalEditor, { serviceManager: serviceManager }) })] }), _jsx(ChatFloating, { kernelIndicatorPlacement: "right", useStore: true, title: "AI Assistant", position: "bottom-right", width: 400, height: 550, defaultOpen: false, showNewChatButton: true, showClearButton: true, showSettingsButton: false, clickOutsideToClose: true, escapeToClose: true, enableKeyboardShortcuts: true, toggleShortcut: "/", buttonTooltip: "Open AI Assistant", showPoweredBy: true, poweredByProps: {
|
|
160
|
+
}, children: "\u2318/" }), ' ', "or click the button to open chat"] }) })] }), _jsx(Box, { flex: 1, display: "flex", overflow: "hidden", bg: "canvas.default", children: _jsx(LexicalEditor, { serviceManager: serviceManager }) })] }), _jsx(ChatFloating, { kernelIndicatorPlacement: "right", useStore: true, title: "AI Assistant", position: "bottom-right", width: 400, height: 550, defaultOpen: false, showNewChatButton: true, showClearButton: true, showSettingsButton: false, clickOutsideToClose: true, escapeToClose: true, enableKeyboardShortcuts: true, toggleShortcut: "/", buttonTooltip: "Open AI Assistant", showPoweredBy: true, poweredByProps: {
|
|
190
161
|
brandName: 'Datalayer',
|
|
191
162
|
brandUrl: 'https://datalayer.ai',
|
|
192
163
|
}, onOpen: () => {
|