@jini-ai/chat 0.1.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/LICENSE +201 -0
- package/README.md +109 -0
- package/dist/core/agentic/chat-capabilities.d.ts +19 -0
- package/dist/core/agentic/chat-capabilities.d.ts.map +1 -0
- package/dist/core/agentic/chat-capabilities.js +106 -0
- package/dist/core/agentic/chat-capabilities.js.map +1 -0
- package/dist/core/agentic/index.d.ts +22 -0
- package/dist/core/agentic/index.d.ts.map +1 -0
- package/dist/core/agentic/index.js +21 -0
- package/dist/core/agentic/index.js.map +1 -0
- package/dist/core/events.d.ts +84 -0
- package/dist/core/events.d.ts.map +1 -0
- package/dist/core/events.js +14 -0
- package/dist/core/events.js.map +1 -0
- package/dist/core/index.d.ts +40 -0
- package/dist/core/index.d.ts.map +1 -0
- package/dist/core/index.js +40 -0
- package/dist/core/index.js.map +1 -0
- package/dist/core/messages.d.ts +53 -0
- package/dist/core/messages.d.ts.map +1 -0
- package/dist/core/messages.js +16 -0
- package/dist/core/messages.js.map +1 -0
- package/dist/core/partial-json.d.ts +36 -0
- package/dist/core/partial-json.d.ts.map +1 -0
- package/dist/core/partial-json.js +119 -0
- package/dist/core/partial-json.js.map +1 -0
- package/dist/core/persistence/index.d.ts +11 -0
- package/dist/core/persistence/index.d.ts.map +1 -0
- package/dist/core/persistence/index.js +11 -0
- package/dist/core/persistence/index.js.map +1 -0
- package/dist/core/persistence/ports.d.ts +124 -0
- package/dist/core/persistence/ports.d.ts.map +1 -0
- package/dist/core/persistence/ports.js +2 -0
- package/dist/core/persistence/ports.js.map +1 -0
- package/dist/core/persistence/title.d.ts +35 -0
- package/dist/core/persistence/title.d.ts.map +1 -0
- package/dist/core/persistence/title.js +137 -0
- package/dist/core/persistence/title.js.map +1 -0
- package/dist/core/question-form/format.d.ts +27 -0
- package/dist/core/question-form/format.d.ts.map +1 -0
- package/dist/core/question-form/format.js +45 -0
- package/dist/core/question-form/format.js.map +1 -0
- package/dist/core/question-form/normalize.d.ts +30 -0
- package/dist/core/question-form/normalize.d.ts.map +1 -0
- package/dist/core/question-form/normalize.js +192 -0
- package/dist/core/question-form/normalize.js.map +1 -0
- package/dist/core/question-form/scan.d.ts +50 -0
- package/dist/core/question-form/scan.d.ts.map +1 -0
- package/dist/core/question-form/scan.js +404 -0
- package/dist/core/question-form/scan.js.map +1 -0
- package/dist/core/question-form/types.d.ts +83 -0
- package/dist/core/question-form/types.d.ts.map +1 -0
- package/dist/core/question-form/types.js +11 -0
- package/dist/core/question-form/types.js.map +1 -0
- package/dist/core/question-form.d.ts +39 -0
- package/dist/core/question-form.d.ts.map +1 -0
- package/dist/core/question-form.js +4 -0
- package/dist/core/question-form.js.map +1 -0
- package/dist/core/todos.d.ts +70 -0
- package/dist/core/todos.d.ts.map +1 -0
- package/dist/core/todos.js +175 -0
- package/dist/core/todos.js.map +1 -0
- package/dist/core/tool-events.d.ts +18 -0
- package/dist/core/tool-events.d.ts.map +1 -0
- package/dist/core/tool-events.js +36 -0
- package/dist/core/tool-events.js.map +1 -0
- package/dist/core/tools.d.ts +51 -0
- package/dist/core/tools.d.ts.map +1 -0
- package/dist/core/tools.js +41 -0
- package/dist/core/tools.js.map +1 -0
- package/dist/core/transcript.d.ts +81 -0
- package/dist/core/transcript.d.ts.map +1 -0
- package/dist/core/transcript.js +133 -0
- package/dist/core/transcript.js.map +1 -0
- package/dist/core/transport.d.ts +109 -0
- package/dist/core/transport.d.ts.map +1 -0
- package/dist/core/transport.js +2 -0
- package/dist/core/transport.js.map +1 -0
- package/dist/core/util/index.d.ts +16 -0
- package/dist/core/util/index.d.ts.map +1 -0
- package/dist/core/util/index.js +16 -0
- package/dist/core/util/index.js.map +1 -0
- package/dist/core/util/manifest.d.ts +39 -0
- package/dist/core/util/manifest.d.ts.map +1 -0
- package/dist/core/util/manifest.js +173 -0
- package/dist/core/util/manifest.js.map +1 -0
- package/dist/core/util/markdown-context.d.ts +47 -0
- package/dist/core/util/markdown-context.d.ts.map +1 -0
- package/dist/core/util/markdown-context.js +125 -0
- package/dist/core/util/markdown-context.js.map +1 -0
- package/dist/core/util/markup-attributes.d.ts +20 -0
- package/dist/core/util/markup-attributes.d.ts.map +1 -0
- package/dist/core/util/markup-attributes.js +33 -0
- package/dist/core/util/markup-attributes.js.map +1 -0
- package/dist/core/util/parser.d.ts +42 -0
- package/dist/core/util/parser.d.ts.map +1 -0
- package/dist/core/util/parser.js +238 -0
- package/dist/core/util/parser.js.map +1 -0
- package/dist/core/util/pointer.d.ts +28 -0
- package/dist/core/util/pointer.d.ts.map +1 -0
- package/dist/core/util/pointer.js +75 -0
- package/dist/core/util/pointer.js.map +1 -0
- package/dist/core/util/recover.d.ts +40 -0
- package/dist/core/util/recover.d.ts.map +1 -0
- package/dist/core/util/recover.js +117 -0
- package/dist/core/util/recover.js.map +1 -0
- package/dist/core/util/strip.d.ts +112 -0
- package/dist/core/util/strip.d.ts.map +1 -0
- package/dist/core/util/strip.js +333 -0
- package/dist/core/util/strip.js.map +1 -0
- package/dist/core/util/types.d.ts +31 -0
- package/dist/core/util/types.d.ts.map +1 -0
- package/dist/core/util/types.js +2 -0
- package/dist/core/util/types.js.map +1 -0
- package/dist/core/util/validate.d.ts +50 -0
- package/dist/core/util/validate.d.ts.map +1 -0
- package/dist/core/util/validate.js +202 -0
- package/dist/core/util/validate.js.map +1 -0
- package/dist/react/agent-bridge/frontend-session-bridge.d.ts +45 -0
- package/dist/react/agent-bridge/frontend-session-bridge.d.ts.map +1 -0
- package/dist/react/agent-bridge/frontend-session-bridge.js +214 -0
- package/dist/react/agent-bridge/frontend-session-bridge.js.map +1 -0
- package/dist/react/artifact-types.d.ts +61 -0
- package/dist/react/artifact-types.d.ts.map +1 -0
- package/dist/react/artifact-types.js +33 -0
- package/dist/react/artifact-types.js.map +1 -0
- package/dist/react/chat-pane.d.ts +21 -0
- package/dist/react/chat-pane.d.ts.map +1 -0
- package/dist/react/chat-pane.js +20 -0
- package/dist/react/chat-pane.js.map +1 -0
- package/dist/react/components/A2uiSurfaceCard.d.ts +35 -0
- package/dist/react/components/A2uiSurfaceCard.d.ts.map +1 -0
- package/dist/react/components/A2uiSurfaceCard.js +272 -0
- package/dist/react/components/A2uiSurfaceCard.js.map +1 -0
- package/dist/react/components/AttachmentTray.d.ts +6 -0
- package/dist/react/components/AttachmentTray.d.ts.map +1 -0
- package/dist/react/components/AttachmentTray.js +30 -0
- package/dist/react/components/AttachmentTray.js.map +1 -0
- package/dist/react/components/ChatFab.d.ts +8 -0
- package/dist/react/components/ChatFab.d.ts.map +1 -0
- package/dist/react/components/ChatFab.js +24 -0
- package/dist/react/components/ChatFab.js.map +1 -0
- package/dist/react/components/Composer.d.ts +34 -0
- package/dist/react/components/Composer.d.ts.map +1 -0
- package/dist/react/components/Composer.js +300 -0
- package/dist/react/components/Composer.js.map +1 -0
- package/dist/react/components/ComposerDiscovery.d.ts +46 -0
- package/dist/react/components/ComposerDiscovery.d.ts.map +1 -0
- package/dist/react/components/ComposerDiscovery.js +38 -0
- package/dist/react/components/ComposerDiscovery.js.map +1 -0
- package/dist/react/components/ConversationList.d.ts +31 -0
- package/dist/react/components/ConversationList.d.ts.map +1 -0
- package/dist/react/components/ConversationList.js +221 -0
- package/dist/react/components/ConversationList.js.map +1 -0
- package/dist/react/components/ExtEventErrorBoundary.d.ts +35 -0
- package/dist/react/components/ExtEventErrorBoundary.d.ts.map +1 -0
- package/dist/react/components/ExtEventErrorBoundary.js +38 -0
- package/dist/react/components/ExtEventErrorBoundary.js.map +1 -0
- package/dist/react/components/Icon.d.ts +17 -0
- package/dist/react/components/Icon.d.ts.map +1 -0
- package/dist/react/components/Icon.js +46 -0
- package/dist/react/components/Icon.js.map +1 -0
- package/dist/react/components/JiniChatProvider.d.ts +45 -0
- package/dist/react/components/JiniChatProvider.d.ts.map +1 -0
- package/dist/react/components/JiniChatProvider.js +44 -0
- package/dist/react/components/JiniChatProvider.js.map +1 -0
- package/dist/react/components/Markdown.d.ts +5 -0
- package/dist/react/components/Markdown.d.ts.map +1 -0
- package/dist/react/components/Markdown.js +390 -0
- package/dist/react/components/Markdown.js.map +1 -0
- package/dist/react/components/McpUiSurfaceCard.d.ts +51 -0
- package/dist/react/components/McpUiSurfaceCard.d.ts.map +1 -0
- package/dist/react/components/McpUiSurfaceCard.js +159 -0
- package/dist/react/components/McpUiSurfaceCard.js.map +1 -0
- package/dist/react/components/MessageList.d.ts +15 -0
- package/dist/react/components/MessageList.d.ts.map +1 -0
- package/dist/react/components/MessageList.js +81 -0
- package/dist/react/components/MessageList.js.map +1 -0
- package/dist/react/components/MessageRow.d.ts +60 -0
- package/dist/react/components/MessageRow.d.ts.map +1 -0
- package/dist/react/components/MessageRow.js +156 -0
- package/dist/react/components/MessageRow.js.map +1 -0
- package/dist/react/components/NextStepActions.d.ts +34 -0
- package/dist/react/components/NextStepActions.d.ts.map +1 -0
- package/dist/react/components/NextStepActions.js +9 -0
- package/dist/react/components/NextStepActions.js.map +1 -0
- package/dist/react/components/QuestionForm.d.ts +26 -0
- package/dist/react/components/QuestionForm.d.ts.map +1 -0
- package/dist/react/components/QuestionForm.js +238 -0
- package/dist/react/components/QuestionForm.js.map +1 -0
- package/dist/react/components/QuestionsPanel.d.ts +13 -0
- package/dist/react/components/QuestionsPanel.d.ts.map +1 -0
- package/dist/react/components/QuestionsPanel.js +33 -0
- package/dist/react/components/QuestionsPanel.js.map +1 -0
- package/dist/react/components/TodoCard.d.ts +8 -0
- package/dist/react/components/TodoCard.d.ts.map +1 -0
- package/dist/react/components/TodoCard.js +29 -0
- package/dist/react/components/TodoCard.js.map +1 -0
- package/dist/react/components/ToolCard.d.ts +22 -0
- package/dist/react/components/ToolCard.d.ts.map +1 -0
- package/dist/react/components/ToolCard.js +298 -0
- package/dist/react/components/ToolCard.js.map +1 -0
- package/dist/react/components/composer-discovery.d.ts +107 -0
- package/dist/react/components/composer-discovery.d.ts.map +1 -0
- package/dist/react/components/composer-discovery.js +176 -0
- package/dist/react/components/composer-discovery.js.map +1 -0
- package/dist/react/ext-event-renderer-registry.d.ts +51 -0
- package/dist/react/ext-event-renderer-registry.d.ts.map +1 -0
- package/dist/react/ext-event-renderer-registry.js +20 -0
- package/dist/react/ext-event-renderer-registry.js.map +1 -0
- package/dist/react/features/chat-pane/agent-tools.d.ts +14 -0
- package/dist/react/features/chat-pane/agent-tools.d.ts.map +1 -0
- package/dist/react/features/chat-pane/agent-tools.js +22 -0
- package/dist/react/features/chat-pane/agent-tools.js.map +1 -0
- package/dist/react/features/chat-pane/components/AgentRuntimePicker.d.ts +12 -0
- package/dist/react/features/chat-pane/components/AgentRuntimePicker.d.ts.map +1 -0
- package/dist/react/features/chat-pane/components/AgentRuntimePicker.js +106 -0
- package/dist/react/features/chat-pane/components/AgentRuntimePicker.js.map +1 -0
- package/dist/react/features/chat-pane/components/ChatPane.d.ts +10 -0
- package/dist/react/features/chat-pane/components/ChatPane.d.ts.map +1 -0
- package/dist/react/features/chat-pane/components/ChatPane.js +169 -0
- package/dist/react/features/chat-pane/components/ChatPane.js.map +1 -0
- package/dist/react/features/chat-pane/create-daemon-attachment-uploader.d.ts +21 -0
- package/dist/react/features/chat-pane/create-daemon-attachment-uploader.d.ts.map +1 -0
- package/dist/react/features/chat-pane/create-daemon-attachment-uploader.js +213 -0
- package/dist/react/features/chat-pane/create-daemon-attachment-uploader.js.map +1 -0
- package/dist/react/features/chat-pane/create-mcp-ui-tool-caller.d.ts +70 -0
- package/dist/react/features/chat-pane/create-mcp-ui-tool-caller.d.ts.map +1 -0
- package/dist/react/features/chat-pane/create-mcp-ui-tool-caller.js +76 -0
- package/dist/react/features/chat-pane/create-mcp-ui-tool-caller.js.map +1 -0
- package/dist/react/features/chat-pane/hooks/useAgentRuntimePicker.hooks.d.ts +133 -0
- package/dist/react/features/chat-pane/hooks/useAgentRuntimePicker.hooks.d.ts.map +1 -0
- package/dist/react/features/chat-pane/hooks/useAgentRuntimePicker.hooks.js +258 -0
- package/dist/react/features/chat-pane/hooks/useAgentRuntimePicker.hooks.js.map +1 -0
- package/dist/react/features/chat-pane/hooks/useChatPane.hooks.d.ts +66 -0
- package/dist/react/features/chat-pane/hooks/useChatPane.hooks.d.ts.map +1 -0
- package/dist/react/features/chat-pane/hooks/useChatPane.hooks.js +224 -0
- package/dist/react/features/chat-pane/hooks/useChatPane.hooks.js.map +1 -0
- package/dist/react/features/chat-pane/hooks/useChatPaneAgentControl.hooks.d.ts +38 -0
- package/dist/react/features/chat-pane/hooks/useChatPaneAgentControl.hooks.d.ts.map +1 -0
- package/dist/react/features/chat-pane/hooks/useChatPaneAgentControl.hooks.js +252 -0
- package/dist/react/features/chat-pane/hooks/useChatPaneAgentControl.hooks.js.map +1 -0
- package/dist/react/features/chat-pane/hooks/useChatPaneControlsHeight.hooks.d.ts +16 -0
- package/dist/react/features/chat-pane/hooks/useChatPaneControlsHeight.hooks.d.ts.map +1 -0
- package/dist/react/features/chat-pane/hooks/useChatPaneControlsHeight.hooks.js +59 -0
- package/dist/react/features/chat-pane/hooks/useChatPaneControlsHeight.hooks.js.map +1 -0
- package/dist/react/features/chat-pane/hooks/useChatPaneFileDrop.hooks.d.ts +26 -0
- package/dist/react/features/chat-pane/hooks/useChatPaneFileDrop.hooks.d.ts.map +1 -0
- package/dist/react/features/chat-pane/hooks/useChatPaneFileDrop.hooks.js +74 -0
- package/dist/react/features/chat-pane/hooks/useChatPaneFileDrop.hooks.js.map +1 -0
- package/dist/react/features/chat-pane/hooks/useChatPaneRuntimeInventory.hooks.d.ts +25 -0
- package/dist/react/features/chat-pane/hooks/useChatPaneRuntimeInventory.hooks.d.ts.map +1 -0
- package/dist/react/features/chat-pane/hooks/useChatPaneRuntimeInventory.hooks.js +88 -0
- package/dist/react/features/chat-pane/hooks/useChatPaneRuntimeInventory.hooks.js.map +1 -0
- package/dist/react/features/chat-pane/hooks/useChatPaneWorkingDirectory.hooks.d.ts +38 -0
- package/dist/react/features/chat-pane/hooks/useChatPaneWorkingDirectory.hooks.d.ts.map +1 -0
- package/dist/react/features/chat-pane/hooks/useChatPaneWorkingDirectory.hooks.js +184 -0
- package/dist/react/features/chat-pane/hooks/useChatPaneWorkingDirectory.hooks.js.map +1 -0
- package/dist/react/features/chat-pane/index.d.ts +12 -0
- package/dist/react/features/chat-pane/index.d.ts.map +1 -0
- package/dist/react/features/chat-pane/index.js +11 -0
- package/dist/react/features/chat-pane/index.js.map +1 -0
- package/dist/react/features/chat-pane/react/components/AgentRuntimePicker.d.ts +12 -0
- package/dist/react/features/chat-pane/react/components/AgentRuntimePicker.d.ts.map +1 -0
- package/dist/react/features/chat-pane/react/components/AgentRuntimePicker.js +102 -0
- package/dist/react/features/chat-pane/react/components/AgentRuntimePicker.js.map +1 -0
- package/dist/react/features/chat-pane/react/components/ChatPane.d.ts +10 -0
- package/dist/react/features/chat-pane/react/components/ChatPane.d.ts.map +1 -0
- package/dist/react/features/chat-pane/react/components/ChatPane.js +137 -0
- package/dist/react/features/chat-pane/react/components/ChatPane.js.map +1 -0
- package/dist/react/features/chat-pane/react/hooks/useAgentRuntimePicker.hooks.d.ts +133 -0
- package/dist/react/features/chat-pane/react/hooks/useAgentRuntimePicker.hooks.d.ts.map +1 -0
- package/dist/react/features/chat-pane/react/hooks/useAgentRuntimePicker.hooks.js +258 -0
- package/dist/react/features/chat-pane/react/hooks/useAgentRuntimePicker.hooks.js.map +1 -0
- package/dist/react/features/chat-pane/react/hooks/useChatPane.hooks.d.ts +66 -0
- package/dist/react/features/chat-pane/react/hooks/useChatPane.hooks.d.ts.map +1 -0
- package/dist/react/features/chat-pane/react/hooks/useChatPane.hooks.js +223 -0
- package/dist/react/features/chat-pane/react/hooks/useChatPane.hooks.js.map +1 -0
- package/dist/react/features/chat-pane/react/hooks/useChatPaneAgentControl.hooks.d.ts +38 -0
- package/dist/react/features/chat-pane/react/hooks/useChatPaneAgentControl.hooks.d.ts.map +1 -0
- package/dist/react/features/chat-pane/react/hooks/useChatPaneAgentControl.hooks.js +252 -0
- package/dist/react/features/chat-pane/react/hooks/useChatPaneAgentControl.hooks.js.map +1 -0
- package/dist/react/features/chat-pane/react/hooks/useChatPaneFileDrop.hooks.d.ts +26 -0
- package/dist/react/features/chat-pane/react/hooks/useChatPaneFileDrop.hooks.d.ts.map +1 -0
- package/dist/react/features/chat-pane/react/hooks/useChatPaneFileDrop.hooks.js +60 -0
- package/dist/react/features/chat-pane/react/hooks/useChatPaneFileDrop.hooks.js.map +1 -0
- package/dist/react/features/chat-pane/react/hooks/useChatPaneRuntimeInventory.hooks.d.ts +25 -0
- package/dist/react/features/chat-pane/react/hooks/useChatPaneRuntimeInventory.hooks.d.ts.map +1 -0
- package/dist/react/features/chat-pane/react/hooks/useChatPaneRuntimeInventory.hooks.js +83 -0
- package/dist/react/features/chat-pane/react/hooks/useChatPaneRuntimeInventory.hooks.js.map +1 -0
- package/dist/react/features/chat-pane/react/hooks/useChatPaneWorkingDirectory.hooks.d.ts +38 -0
- package/dist/react/features/chat-pane/react/hooks/useChatPaneWorkingDirectory.hooks.d.ts.map +1 -0
- package/dist/react/features/chat-pane/react/hooks/useChatPaneWorkingDirectory.hooks.js +184 -0
- package/dist/react/features/chat-pane/react/hooks/useChatPaneWorkingDirectory.hooks.js.map +1 -0
- package/dist/react/features/chat-pane/react/styles.d.ts +2 -0
- package/dist/react/features/chat-pane/react/styles.d.ts.map +1 -0
- package/dist/react/features/chat-pane/react/styles.js +863 -0
- package/dist/react/features/chat-pane/react/styles.js.map +1 -0
- package/dist/react/features/chat-pane/rules.d.ts +31 -0
- package/dist/react/features/chat-pane/rules.d.ts.map +1 -0
- package/dist/react/features/chat-pane/rules.js +81 -0
- package/dist/react/features/chat-pane/rules.js.map +1 -0
- package/dist/react/features/chat-pane/styles.d.ts +2 -0
- package/dist/react/features/chat-pane/styles.d.ts.map +1 -0
- package/dist/react/features/chat-pane/styles.js +1327 -0
- package/dist/react/features/chat-pane/styles.js.map +1 -0
- package/dist/react/features/chat-pane/types.d.ts +248 -0
- package/dist/react/features/chat-pane/types.d.ts.map +1 -0
- package/dist/react/features/chat-pane/types.js +2 -0
- package/dist/react/features/chat-pane/types.js.map +1 -0
- package/dist/react/features/model-picker/components/CredentialStatusBadge.d.ts +7 -0
- package/dist/react/features/model-picker/components/CredentialStatusBadge.d.ts.map +1 -0
- package/dist/react/features/model-picker/components/CredentialStatusBadge.js +20 -0
- package/dist/react/features/model-picker/components/CredentialStatusBadge.js.map +1 -0
- package/dist/react/features/model-picker/components/ModelPicker.d.ts +9 -0
- package/dist/react/features/model-picker/components/ModelPicker.d.ts.map +1 -0
- package/dist/react/features/model-picker/components/ModelPicker.js +34 -0
- package/dist/react/features/model-picker/components/ModelPicker.js.map +1 -0
- package/dist/react/features/model-picker/constants.d.ts +6 -0
- package/dist/react/features/model-picker/constants.d.ts.map +1 -0
- package/dist/react/features/model-picker/constants.js +9 -0
- package/dist/react/features/model-picker/constants.js.map +1 -0
- package/dist/react/features/model-picker/dependencies.d.ts +11 -0
- package/dist/react/features/model-picker/dependencies.d.ts.map +1 -0
- package/dist/react/features/model-picker/dependencies.js +10 -0
- package/dist/react/features/model-picker/dependencies.js.map +1 -0
- package/dist/react/features/model-picker/hooks/useModelPicker.hooks.d.ts +27 -0
- package/dist/react/features/model-picker/hooks/useModelPicker.hooks.d.ts.map +1 -0
- package/dist/react/features/model-picker/hooks/useModelPicker.hooks.js +62 -0
- package/dist/react/features/model-picker/hooks/useModelPicker.hooks.js.map +1 -0
- package/dist/react/features/model-picker/index.d.ts +32 -0
- package/dist/react/features/model-picker/index.d.ts.map +1 -0
- package/dist/react/features/model-picker/index.js +29 -0
- package/dist/react/features/model-picker/index.js.map +1 -0
- package/dist/react/features/model-picker/ports.d.ts +11 -0
- package/dist/react/features/model-picker/ports.d.ts.map +1 -0
- package/dist/react/features/model-picker/ports.js +2 -0
- package/dist/react/features/model-picker/ports.js.map +1 -0
- package/dist/react/features/model-picker/react/components/CredentialStatusBadge.d.ts +7 -0
- package/dist/react/features/model-picker/react/components/CredentialStatusBadge.d.ts.map +1 -0
- package/dist/react/features/model-picker/react/components/CredentialStatusBadge.js +20 -0
- package/dist/react/features/model-picker/react/components/CredentialStatusBadge.js.map +1 -0
- package/dist/react/features/model-picker/react/components/ModelPicker.d.ts +9 -0
- package/dist/react/features/model-picker/react/components/ModelPicker.d.ts.map +1 -0
- package/dist/react/features/model-picker/react/components/ModelPicker.js +34 -0
- package/dist/react/features/model-picker/react/components/ModelPicker.js.map +1 -0
- package/dist/react/features/model-picker/react/hooks/useModelPicker.hooks.d.ts +27 -0
- package/dist/react/features/model-picker/react/hooks/useModelPicker.hooks.d.ts.map +1 -0
- package/dist/react/features/model-picker/react/hooks/useModelPicker.hooks.js +62 -0
- package/dist/react/features/model-picker/react/hooks/useModelPicker.hooks.js.map +1 -0
- package/dist/react/features/model-picker/rules.d.ts +26 -0
- package/dist/react/features/model-picker/rules.d.ts.map +1 -0
- package/dist/react/features/model-picker/rules.js +84 -0
- package/dist/react/features/model-picker/rules.js.map +1 -0
- package/dist/react/features/model-picker/types.d.ts +38 -0
- package/dist/react/features/model-picker/types.d.ts.map +1 -0
- package/dist/react/features/model-picker/types.js +2 -0
- package/dist/react/features/model-picker/types.js.map +1 -0
- package/dist/react/hooks/composer-draft-cache.d.ts +65 -0
- package/dist/react/hooks/composer-draft-cache.d.ts.map +1 -0
- package/dist/react/hooks/composer-draft-cache.js +89 -0
- package/dist/react/hooks/composer-draft-cache.js.map +1 -0
- package/dist/react/hooks/context.d.ts +18 -0
- package/dist/react/hooks/context.d.ts.map +1 -0
- package/dist/react/hooks/context.js +60 -0
- package/dist/react/hooks/context.js.map +1 -0
- package/dist/react/hooks/testing/fake-transport.d.ts +34 -0
- package/dist/react/hooks/testing/fake-transport.d.ts.map +1 -0
- package/dist/react/hooks/testing/fake-transport.js +46 -0
- package/dist/react/hooks/testing/fake-transport.js.map +1 -0
- package/dist/react/hooks/useArtifactStream.d.ts +18 -0
- package/dist/react/hooks/useArtifactStream.d.ts.map +1 -0
- package/dist/react/hooks/useArtifactStream.js +55 -0
- package/dist/react/hooks/useArtifactStream.js.map +1 -0
- package/dist/react/hooks/useChatFabDrag.d.ts +25 -0
- package/dist/react/hooks/useChatFabDrag.d.ts.map +1 -0
- package/dist/react/hooks/useChatFabDrag.js +88 -0
- package/dist/react/hooks/useChatFabDrag.js.map +1 -0
- package/dist/react/hooks/useComposer.d.ts +48 -0
- package/dist/react/hooks/useComposer.d.ts.map +1 -0
- package/dist/react/hooks/useComposer.js +121 -0
- package/dist/react/hooks/useComposer.js.map +1 -0
- package/dist/react/hooks/useConversation.d.ts +34 -0
- package/dist/react/hooks/useConversation.d.ts.map +1 -0
- package/dist/react/hooks/useConversation.js +163 -0
- package/dist/react/hooks/useConversation.js.map +1 -0
- package/dist/react/hooks/useCopyToClipboard.d.ts +14 -0
- package/dist/react/hooks/useCopyToClipboard.d.ts.map +1 -0
- package/dist/react/hooks/useCopyToClipboard.js +98 -0
- package/dist/react/hooks/useCopyToClipboard.js.map +1 -0
- package/dist/react/hooks/useExtEventGroups.d.ts +7 -0
- package/dist/react/hooks/useExtEventGroups.d.ts.map +1 -0
- package/dist/react/hooks/useExtEventGroups.js +32 -0
- package/dist/react/hooks/useExtEventGroups.js.map +1 -0
- package/dist/react/hooks/useLatestOperation.d.ts +31 -0
- package/dist/react/hooks/useLatestOperation.d.ts.map +1 -0
- package/dist/react/hooks/useLatestOperation.js +74 -0
- package/dist/react/hooks/useLatestOperation.js.map +1 -0
- package/dist/react/hooks/usePinnedTodos.d.ts +15 -0
- package/dist/react/hooks/usePinnedTodos.d.ts.map +1 -0
- package/dist/react/hooks/usePinnedTodos.js +43 -0
- package/dist/react/hooks/usePinnedTodos.js.map +1 -0
- package/dist/react/hooks/useQuestionForms.d.ts +28 -0
- package/dist/react/hooks/useQuestionForms.d.ts.map +1 -0
- package/dist/react/hooks/useQuestionForms.js +113 -0
- package/dist/react/hooks/useQuestionForms.js.map +1 -0
- package/dist/react/hooks/useRunStream.d.ts +27 -0
- package/dist/react/hooks/useRunStream.d.ts.map +1 -0
- package/dist/react/hooks/useRunStream.js +180 -0
- package/dist/react/hooks/useRunStream.js.map +1 -0
- package/dist/react/hooks/useToolTimeline.d.ts +33 -0
- package/dist/react/hooks/useToolTimeline.d.ts.map +1 -0
- package/dist/react/hooks/useToolTimeline.js +47 -0
- package/dist/react/hooks/useToolTimeline.js.map +1 -0
- package/dist/react/index.d.ts +158 -0
- package/dist/react/index.d.ts.map +1 -0
- package/dist/react/index.js +118 -0
- package/dist/react/index.js.map +1 -0
- package/dist/react/message-blocks.d.ts +86 -0
- package/dist/react/message-blocks.d.ts.map +1 -0
- package/dist/react/message-blocks.js +78 -0
- package/dist/react/message-blocks.js.map +1 -0
- package/dist/react/poc-mcp-ui-official/PocMcpUiCard.d.ts +9 -0
- package/dist/react/poc-mcp-ui-official/PocMcpUiCard.d.ts.map +1 -0
- package/dist/react/poc-mcp-ui-official/PocMcpUiCard.js +29 -0
- package/dist/react/poc-mcp-ui-official/PocMcpUiCard.js.map +1 -0
- package/dist/react/poc-mcp-ui-official/create-poc-resource.d.ts +30 -0
- package/dist/react/poc-mcp-ui-official/create-poc-resource.d.ts.map +1 -0
- package/dist/react/poc-mcp-ui-official/create-poc-resource.js +44 -0
- package/dist/react/poc-mcp-ui-official/create-poc-resource.js.map +1 -0
- package/dist/react/slots.d.ts +215 -0
- package/dist/react/slots.d.ts.map +1 -0
- package/dist/react/slots.js +2 -0
- package/dist/react/slots.js.map +1 -0
- package/dist/react/styles/reference.css +298 -0
- package/dist/react/tool-renderer-registry.d.ts +41 -0
- package/dist/react/tool-renderer-registry.d.ts.map +1 -0
- package/dist/react/tool-renderer-registry.js +22 -0
- package/dist/react/tool-renderer-registry.js.map +1 -0
- package/dist/react/util/defined-props.d.ts +31 -0
- package/dist/react/util/defined-props.d.ts.map +1 -0
- package/dist/react/util/defined-props.js +28 -0
- package/dist/react/util/defined-props.js.map +1 -0
- package/package.json +99 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"chat-pane.js","sourceRoot":"","sources":["../../src/react/chat-pane.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AACH,OAAO,EACL,kBAAkB,EAClB,qBAAqB,EACrB,QAAQ,EACR,8BAA8B,EAC9B,qBAAqB,EACrB,wBAAwB,EACxB,mBAAmB,EACnB,wBAAwB,EACxB,WAAW,EACX,uBAAuB,EACvB,2BAA2B,EAC3B,2BAA2B,GAC5B,MAAM,+BAA+B,CAAC"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import type { ExtEventRenderProps } from '../ext-event-renderer-registry.js';
|
|
2
|
+
/**
|
|
3
|
+
* What a host reports back after attempting to deliver an agent-directed action. Returned (not
|
|
4
|
+
* thrown) because a delivery failure here is routine, not exceptional — a closed exchange, a
|
|
5
|
+
* network blip, a stale tab — and every one of them is something the human needs to *see*, not
|
|
6
|
+
* something that should unwind a React event handler.
|
|
7
|
+
*/
|
|
8
|
+
export type A2uiAgentActionOutcome = {
|
|
9
|
+
readonly ok: true;
|
|
10
|
+
} | {
|
|
11
|
+
readonly ok: false;
|
|
12
|
+
readonly reason: string;
|
|
13
|
+
};
|
|
14
|
+
export interface A2uiSurfaceCardProps extends ExtEventRenderProps {
|
|
15
|
+
/**
|
|
16
|
+
* Called when a rendered surface produces a `message`-shaped action meant for the agent (as
|
|
17
|
+
* opposed to a `local` client-side function call, which this component already resolves and
|
|
18
|
+
* displays itself). Omit to surface the module doc's honest "nowhere to send this yet" notice
|
|
19
|
+
* instead of silently dropping the action.
|
|
20
|
+
*
|
|
21
|
+
* May return `void` — the original, still fully-supported contract; `examples/reference-web/src/
|
|
22
|
+
* A2uiLab.tsx` uses exactly this and needs no changes — or a `Promise<A2uiAgentActionOutcome>` for
|
|
23
|
+
* a host that can tell whether the message actually arrived (e.g. `createA2uiActionPoster`, a
|
|
24
|
+
* host-side implementation reporting the POST's outcome). When a promise is returned and it resolves
|
|
25
|
+
* `{ ok: false }` or rejects, the card shows a visible delivery-failure notice instead of leaving
|
|
26
|
+
* the human to wonder whether their click did anything. This is the same problem `refusalNotice`
|
|
27
|
+
* already solves for a *client-side* refusal (`buildAction` says no before anything is sent), one
|
|
28
|
+
* hop further out: the message left this component but never reached the agent. Both are needed —
|
|
29
|
+
* neither substitutes for the other.
|
|
30
|
+
*/
|
|
31
|
+
onAgentAction?: (runId: string | undefined, message: unknown) => void | Promise<A2uiAgentActionOutcome>;
|
|
32
|
+
}
|
|
33
|
+
/** Registered against `ext-event-renderer-registry.ts`'s `'a2ui'` name — see module doc. */
|
|
34
|
+
export declare function A2uiSurfaceCard({ events, runId, onAgentAction }: A2uiSurfaceCardProps): import("react").JSX.Element;
|
|
35
|
+
//# sourceMappingURL=A2uiSurfaceCard.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"A2uiSurfaceCard.d.ts","sourceRoot":"","sources":["../../../src/react/components/A2uiSurfaceCard.tsx"],"names":[],"mappings":"AAqCA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,mCAAmC,CAAC;AA2I7E;;;;;GAKG;AACH,MAAM,MAAM,sBAAsB,GAAG;IAAE,QAAQ,CAAC,EAAE,EAAE,IAAI,CAAA;CAAE,GAAG;IAAE,QAAQ,CAAC,EAAE,EAAE,KAAK,CAAC;IAAC,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAA;CAAE,CAAC;AAmB7G,MAAM,WAAW,oBAAqB,SAAQ,mBAAmB;IAC/D;;;;;;;;;;;;;;;OAeG;IACH,aAAa,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,GAAG,SAAS,EAAE,OAAO,EAAE,OAAO,KAAK,IAAI,GAAG,OAAO,CAAC,sBAAsB,CAAC,CAAC;CACzG;AAED,4FAA4F;AAC5F,wBAAgB,eAAe,CAAC,EAAE,MAAM,EAAE,KAAK,EAAE,aAAa,EAAE,EAAE,oBAAoB,+BAyKrF"}
|
|
@@ -0,0 +1,272 @@
|
|
|
1
|
+
import { jsxs as _jsxs, jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
/**
|
|
3
|
+
* @module A2uiSurfaceCard
|
|
4
|
+
*
|
|
5
|
+
* Renders a live A2UI (a2ui-project/a2ui v1.0) surface inline in the chat transcript, fed by a
|
|
6
|
+
* message's `kind: 'ext', name: 'a2ui'` events (see `ext-event-renderer-registry.ts`). A host
|
|
7
|
+
* registers this against `'a2ui'` once, at module scope — mirroring how `McpUiLab.tsx` registers
|
|
8
|
+
* `show_mcpui_widget` via `registerToolRenderer` — and every `ChatPane` that surfaces an `a2ui`
|
|
9
|
+
* event thereafter renders through it.
|
|
10
|
+
*
|
|
11
|
+
* Ported from `examples/reference-web/src/A2uiLab.tsx`'s `RenderComponent` (the same tree-walking
|
|
12
|
+
* approach: degrade sanely — a visible, inert placeholder, never a crash — for a missing child id
|
|
13
|
+
* or a circular reference), generalized to consume a growing `events` array instead of a live SSE
|
|
14
|
+
* callback. `@jini-ai/agentic/a2ui`'s catalog validates all 18 of the real basic catalog's
|
|
15
|
+
* components; this renderer has React cases for 5 of them — `Text`/`Column`/`Row`/`Card`/`Button`
|
|
16
|
+
* — plus, since the catalog this card builds is the lab catalog MERGED with
|
|
17
|
+
* `DEFAULT_INTERACTIVE_UI_REGISTRY` (`buildA2uiCatalogFromRegistry`, `@jini-ai/ui/a2ui`), any
|
|
18
|
+
* registry-sourced component (`shadcn.*`, `recharts.*`) resolves through that registry the same
|
|
19
|
+
* way `@jini-ai/ui`'s own `A2uiSurfaceRenderer` does — see this file's `default` case. The
|
|
20
|
+
* remaining basic types (Image/Icon/Video/AudioPlayer/List/Tabs/Modal/Divider and the input
|
|
21
|
+
* family) still have no case here; a catalog type the interpreter accepts but this switch has no
|
|
22
|
+
* case for, and that the registry does not resolve either, degrades to the same visible
|
|
23
|
+
* placeholder as a genuinely unrenderable one — see the `default` branch's own comment.
|
|
24
|
+
*
|
|
25
|
+
* **Known gap, by design, not oversight:** a `Button`'s click only completes the round trip when
|
|
26
|
+
* `interpreter.buildAction` resolves it as a `local` (client-side) function call. A `message`-shaped
|
|
27
|
+
* action (meant for the agent) has nowhere real to go yet — the only existing relay
|
|
28
|
+
* (`examples/reference-web/src/daemon.ts`'s `/a2ui-action`) is hardwired to that app's fixed,
|
|
29
|
+
* scripted `a2ui-demo` agent, not a real conversational run; sending to it here would silently
|
|
30
|
+
* misrepresent whether a live agent turn can actually receive the action. `onAgentAction` is the
|
|
31
|
+
* seam a host wires up once that backend capability exists — until then, a `message`-shaped action
|
|
32
|
+
* surfaces as a visible, honest notice instead of vanishing or hitting the wrong endpoint.
|
|
33
|
+
*/
|
|
34
|
+
import { useEffect, useMemo, useRef, useState } from 'react';
|
|
35
|
+
import { createA2uiInterpreter, createLabCatalog } from '@jini-ai/agentic/a2ui';
|
|
36
|
+
import { buildA2uiCatalogFromRegistry } from '@jini-ai/ui/a2ui';
|
|
37
|
+
import { DEFAULT_INTERACTIVE_UI_REGISTRY } from '@jini-ai/ui/interactive-ui';
|
|
38
|
+
import { useT } from '../hooks/context.js';
|
|
39
|
+
/** Every agent→renderer message shape carries `surfaceId` under exactly one of these keys. */
|
|
40
|
+
const SURFACE_ID_KEYS = ['createSurface', 'updateComponents', 'updateDataModel', 'deleteSurface'];
|
|
41
|
+
function extractSurfaceId(message) {
|
|
42
|
+
if (typeof message !== 'object' || message === null)
|
|
43
|
+
return undefined;
|
|
44
|
+
for (const key of SURFACE_ID_KEYS) {
|
|
45
|
+
const body = message[key];
|
|
46
|
+
if (body && typeof body === 'object' && typeof body.surfaceId === 'string') {
|
|
47
|
+
return body.surfaceId;
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
return undefined;
|
|
51
|
+
}
|
|
52
|
+
/** Renders one component and its children by walking the surface's component map from `componentId` — identical degrade-sanely behavior to `A2uiLab.tsx`'s `RenderComponent`. */
|
|
53
|
+
function RenderComponent({ interpreter, surfaceId, componentId, ancestors, onAction, }) {
|
|
54
|
+
if (ancestors.has(componentId)) {
|
|
55
|
+
return (_jsxs("span", { className: "a2ui-placeholder a2ui-placeholder-cycle", "data-a2ui-status": "cycle", "data-a2ui-component-id": componentId, children: ["\u27F2 circular reference at \u201C", componentId, "\u201D"] }));
|
|
56
|
+
}
|
|
57
|
+
const surface = interpreter.getSurface(surfaceId);
|
|
58
|
+
const component = surface?.components.get(componentId);
|
|
59
|
+
if (!component) {
|
|
60
|
+
return (_jsxs("span", { className: "a2ui-placeholder a2ui-placeholder-missing", "data-a2ui-status": "missing", "data-a2ui-component-id": componentId, children: ["\u26A0 missing component \u201C", componentId, "\u201D"] }));
|
|
61
|
+
}
|
|
62
|
+
const nextAncestors = new Set(ancestors);
|
|
63
|
+
nextAncestors.add(componentId);
|
|
64
|
+
const childProps = { interpreter, surfaceId, ancestors: nextAncestors, onAction };
|
|
65
|
+
function resolveText(value) {
|
|
66
|
+
const result = interpreter.resolve(surfaceId, value);
|
|
67
|
+
if (!result.ok)
|
|
68
|
+
return `⚠ unresolved (${result.reason})`;
|
|
69
|
+
return typeof result.value === 'string' ? result.value : JSON.stringify(result.value);
|
|
70
|
+
}
|
|
71
|
+
function renderChildList(children) {
|
|
72
|
+
if (Array.isArray(children)) {
|
|
73
|
+
return children.map((childId) => _jsx(RenderComponent, { componentId: String(childId), ...childProps }, String(childId)));
|
|
74
|
+
}
|
|
75
|
+
return (_jsx("span", { className: "a2ui-placeholder", "data-a2ui-status": "unimplemented-template-list", children: "\u26A0 dynamic (template) child lists are not implemented by this port" }));
|
|
76
|
+
}
|
|
77
|
+
switch (component.component) {
|
|
78
|
+
case 'Text':
|
|
79
|
+
return (
|
|
80
|
+
// `variant` is always populated: the catalog's `TextPropsSchema` declares
|
|
81
|
+
// `.default('body')`, and the interpreter stores zod's *output* (`applyComponentsList`'s
|
|
82
|
+
// `parsed.data`, its only writer), so an absent variant is filled in upstream and an
|
|
83
|
+
// explicit `null` is refused before the component ever enters the map. No `??` fallback.
|
|
84
|
+
_jsx("span", { className: `a2ui-text a2ui-text-${String(component.props.variant)}`, "data-a2ui-component-id": componentId, children: resolveText(component.props.text) }));
|
|
85
|
+
case 'Column':
|
|
86
|
+
return (_jsx("div", { className: "a2ui-column", "data-a2ui-component-id": componentId, children: renderChildList(component.props.children) }));
|
|
87
|
+
case 'Row':
|
|
88
|
+
return (_jsx("div", { className: "a2ui-row", "data-a2ui-component-id": componentId, children: renderChildList(component.props.children) }));
|
|
89
|
+
case 'Card':
|
|
90
|
+
// A single-child wrapper — needed to usefully contain one registry component (see the
|
|
91
|
+
// `default` case below) inside a `Column`/`Row`, the same reasoning `@jini-ai/ui`'s
|
|
92
|
+
// `A2uiSurfaceRenderer` documents for its own identical case.
|
|
93
|
+
return (_jsx("div", { className: "a2ui-card", "data-a2ui-component-id": componentId, children: _jsx(RenderComponent, { ...childProps, componentId: String(component.props.child) }) }));
|
|
94
|
+
case 'Button':
|
|
95
|
+
return (_jsx("button", { type: "button",
|
|
96
|
+
// Always populated, for the same reason as `Text`'s variant above — `ButtonPropsSchema`
|
|
97
|
+
// declares `.default('default')`.
|
|
98
|
+
className: `a2ui-button a2ui-button-${String(component.props.variant)}`, "data-a2ui-component-id": componentId, onClick: () => onAction(componentId), children: _jsx(RenderComponent, { ...childProps, componentId: String(component.props.child) }) }));
|
|
99
|
+
default: {
|
|
100
|
+
// A component type the active catalog rejects never reaches the component map
|
|
101
|
+
// (`interpreter.applyAgentMessage`'s own guard) — everything that DOES reach here is either
|
|
102
|
+
// one of the 13 basic types this switch has no case for, or a registry-sourced component
|
|
103
|
+
// (`shadcn.*`/`recharts.*`) merged into the catalog by `A2uiSurfaceCard`'s own
|
|
104
|
+
// `buildA2uiCatalogFromRegistry` call below. Resolved against the SAME registry
|
|
105
|
+
// `@jini-ai/ui`'s own `A2uiSurfaceRenderer` uses, so a type addable to the catalog and
|
|
106
|
+
// renderable there is addable and renderable here too.
|
|
107
|
+
const entry = DEFAULT_INTERACTIVE_UI_REGISTRY.resolveById(component.component);
|
|
108
|
+
if (!entry) {
|
|
109
|
+
return (_jsxs("span", { className: "a2ui-placeholder", "data-a2ui-status": "unrenderable-type", children: ["\u26A0 no renderer yet for component type \u201C", component.component, "\u201D"] }));
|
|
110
|
+
}
|
|
111
|
+
const RegistryComponent = entry.Component;
|
|
112
|
+
// `onRowClick`: the one registry component that exists today (`native.data-table`/
|
|
113
|
+
// `shadcn.data-table`) reads this, not a generic per-type feedback convention — same
|
|
114
|
+
// documented simplification `A2uiSurfaceRenderer`'s own identical line carries.
|
|
115
|
+
return _jsx(RegistryComponent, { ...component.props, onRowClick: () => onAction(componentId) });
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
/**
|
|
120
|
+
* Duck-types `value` as a thenable rather than checking `instanceof Promise`. `onAgentAction`'s
|
|
121
|
+
* declared return type is `void | Promise<A2uiAgentActionOutcome>`, and TypeScript's structural
|
|
122
|
+
* typing means anything with a spec-shaped `then` — a hand-built thenable, a non-native promise
|
|
123
|
+
* library, a promise crossing a realm boundary (e.g. constructed inside an iframe) — satisfies
|
|
124
|
+
* `Promise<T>` at the call site without being `instanceof Promise` in *this* realm. An `instanceof`
|
|
125
|
+
* check would silently skip the await branch for any of those, dropping the delivery outcome on the
|
|
126
|
+
* floor — reintroducing, inside the fix for it, the exact silent-failure class this feature exists
|
|
127
|
+
* to remove. Do not "simplify" this back to `instanceof`.
|
|
128
|
+
*
|
|
129
|
+
* @complexity O(1).
|
|
130
|
+
* @overallScore 100
|
|
131
|
+
*/
|
|
132
|
+
function isThenable(value) {
|
|
133
|
+
return typeof value === 'object' && value !== null && typeof value.then === 'function';
|
|
134
|
+
}
|
|
135
|
+
/** Registered against `ext-event-renderer-registry.ts`'s `'a2ui'` name — see module doc. */
|
|
136
|
+
export function A2uiSurfaceCard({ events, runId, onAgentAction }) {
|
|
137
|
+
const t = useT();
|
|
138
|
+
// Merges `DEFAULT_INTERACTIVE_UI_REGISTRY` (shadcn/recharts) into the lab catalog, keyed under
|
|
139
|
+
// the SAME `catalogId` the lab catalog already uses — so a tool built against
|
|
140
|
+
// `createLabCatalog().catalogId` (e.g. `demo-a2ui-tool.ts`) still validates unchanged, and now
|
|
141
|
+
// ALSO gains every registry component as a real, addable/removable catalog entry.
|
|
142
|
+
const catalog = useMemo(() => {
|
|
143
|
+
const base = createLabCatalog();
|
|
144
|
+
return buildA2uiCatalogFromRegistry(DEFAULT_INTERACTIVE_UI_REGISTRY, base.catalogId, { base });
|
|
145
|
+
}, []);
|
|
146
|
+
const interpreterRef = useRef(null);
|
|
147
|
+
if (!interpreterRef.current)
|
|
148
|
+
interpreterRef.current = createA2uiInterpreter(catalog);
|
|
149
|
+
const interpreter = interpreterRef.current;
|
|
150
|
+
const [, forceRender] = useState(0);
|
|
151
|
+
const appliedCountRef = useRef(0);
|
|
152
|
+
const surfaceIdRef = useRef(undefined);
|
|
153
|
+
/** Monotonic ticket for `handleAction`'s agent-delivery attempts — see its use for why a host's
|
|
154
|
+
* promises settling out of order would otherwise repaint a superseded failure. */
|
|
155
|
+
const agentActionAttemptRef = useRef(0);
|
|
156
|
+
const [refusalNotice, setRefusalNotice] = useState(null);
|
|
157
|
+
const [pendingAgentAction, setPendingAgentAction] = useState(null);
|
|
158
|
+
const [localActionResult, setLocalActionResult] = useState(null);
|
|
159
|
+
const [deliveryFailureNotice, setDeliveryFailureNotice] = useState(null);
|
|
160
|
+
useEffect(() => interpreter.subscribe(() => forceRender((n) => n + 1)), [interpreter]);
|
|
161
|
+
useEffect(() => {
|
|
162
|
+
while (appliedCountRef.current < events.length) {
|
|
163
|
+
const message = events[appliedCountRef.current];
|
|
164
|
+
appliedCountRef.current += 1;
|
|
165
|
+
const surfaceId = extractSurfaceId(message);
|
|
166
|
+
if (surfaceId)
|
|
167
|
+
surfaceIdRef.current = surfaceId;
|
|
168
|
+
const result = interpreter.applyAgentMessage(message);
|
|
169
|
+
if (result.unattributedViolation) {
|
|
170
|
+
setRefusalNotice(result.unattributedViolation);
|
|
171
|
+
}
|
|
172
|
+
else {
|
|
173
|
+
// A catalog-validation refusal (e.g. an unrecognized component type, or a known type with a
|
|
174
|
+
// missing/invalid required prop) surfaces as an `error`-shaped entry in `rendererMessages`,
|
|
175
|
+
// not `unattributedViolation`. Shown locally AND relayed through the exact same
|
|
176
|
+
// `onAgentAction` pipe a button click already uses: `errorMessage` is a real
|
|
177
|
+
// `RendererToAgentMessage` carrying `error.surfaceId`, which is all `onAgentAction`'s host
|
|
178
|
+
// implementation needs to address it — no second callback prop, no new wire shape. Without
|
|
179
|
+
// this relay a tool call that opened the surface has no way to learn its render was REFUSED
|
|
180
|
+
// and returns success anyway, which is worse than the silent-"waiting" bug this comment used
|
|
181
|
+
// to describe: it actively tells the agent (and, downstream, the human) that a chart is on
|
|
182
|
+
// screen when it never rendered at all.
|
|
183
|
+
const errorMessage = result.rendererMessages.find((m) => 'error' in m);
|
|
184
|
+
if (errorMessage) {
|
|
185
|
+
setRefusalNotice(errorMessage.error.message);
|
|
186
|
+
void onAgentAction?.(runId, errorMessage);
|
|
187
|
+
}
|
|
188
|
+
else {
|
|
189
|
+
// A message that applies cleanly clears any earlier refusal. `refusalNotice` describes
|
|
190
|
+
// whether the CURRENT surface is broken, not a permanent scar from an earlier mistake this
|
|
191
|
+
// same conversation already recovered from — e.g. a retry that fixed a missing prop, or an
|
|
192
|
+
// unrelated later `updateDataModel`. Without this, a stale "Action refused" banner from an
|
|
193
|
+
// early failed attempt sits underneath a chart that went on to render successfully.
|
|
194
|
+
setRefusalNotice(null);
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
}
|
|
198
|
+
// `onAgentAction`/`runId` included: the loop above now calls `onAgentAction` directly (relaying
|
|
199
|
+
// a validation error), not just on a later user click — the effect must see a fresh reference,
|
|
200
|
+
// the same way `handleAction`'s own (non-effect) call site already gets one on every render.
|
|
201
|
+
}, [events, interpreter, onAgentAction, runId]);
|
|
202
|
+
const surfaceId = surfaceIdRef.current;
|
|
203
|
+
const root = surfaceId ? interpreter.getRoot(surfaceId) : undefined;
|
|
204
|
+
function handleAction(componentId) {
|
|
205
|
+
// `surfaceId` is non-null here by construction, not by luck: this callback is only ever reached
|
|
206
|
+
// from a `Button` inside the rendered tree, and nothing renders until `root` resolves — which
|
|
207
|
+
// the `!root` early return below only permits when `surfaceId` was already truthy. Asserted
|
|
208
|
+
// rather than re-checked, exactly as the `RenderComponent` call site below already does.
|
|
209
|
+
const built = interpreter.buildAction(surfaceId, componentId);
|
|
210
|
+
if (!built.ok) {
|
|
211
|
+
setRefusalNotice(built.reason);
|
|
212
|
+
return;
|
|
213
|
+
}
|
|
214
|
+
setRefusalNotice(null);
|
|
215
|
+
if (built.kind === 'local') {
|
|
216
|
+
// `buildAction`'s local branch is a pure computation (`resolveDynamicValue` over a
|
|
217
|
+
// registered catalog function's `impl`) — it never touches interpreter state, so there is
|
|
218
|
+
// nothing for `interpreter.subscribe` to notify and no re-render to "reflect" it. The only
|
|
219
|
+
// honest thing this component can do with the resolved value is show it.
|
|
220
|
+
setPendingAgentAction(null);
|
|
221
|
+
setLocalActionResult({ componentId, value: built.result });
|
|
222
|
+
return;
|
|
223
|
+
}
|
|
224
|
+
setLocalActionResult(null);
|
|
225
|
+
if (onAgentAction) {
|
|
226
|
+
// Clearing here, not just at the top of `handleAction`: a *previous* click's delivery failure
|
|
227
|
+
// must not linger next to a new attempt that has not resolved yet — same "stale notice beside
|
|
228
|
+
// a working control" concern `refusalNotice`'s own clearing already guards against.
|
|
229
|
+
setPendingAgentAction(null);
|
|
230
|
+
setDeliveryFailureNotice(null);
|
|
231
|
+
// Clearing the notice is not enough on its own: `onAgentAction` is host-supplied and its
|
|
232
|
+
// promises are not guaranteed to settle in call order, so an OLDER click's rejection could
|
|
233
|
+
// land after a newer one had already cleared the notice — repainting a failure the human has
|
|
234
|
+
// since superseded, next to a control that just worked. Only the latest attempt may write.
|
|
235
|
+
const attempt = (agentActionAttemptRef.current += 1);
|
|
236
|
+
const isLatestAttempt = () => agentActionAttemptRef.current === attempt;
|
|
237
|
+
const outcome = onAgentAction(runId, built.message);
|
|
238
|
+
// `isThenable`, not `instanceof Promise` — see that helper's own doc for why.
|
|
239
|
+
if (isThenable(outcome)) {
|
|
240
|
+
void outcome.then((result) => {
|
|
241
|
+
if (!result.ok && isLatestAttempt())
|
|
242
|
+
setDeliveryFailureNotice(result.reason);
|
|
243
|
+
}, (error) => {
|
|
244
|
+
// A rejection is the host's transport breaking, not a message the host chose to report —
|
|
245
|
+
// still surfaced, so the human sees *something* rather than a click that silently did
|
|
246
|
+
// nothing.
|
|
247
|
+
if (!isLatestAttempt())
|
|
248
|
+
return;
|
|
249
|
+
setDeliveryFailureNotice(error instanceof Error ? error.message : String(error));
|
|
250
|
+
});
|
|
251
|
+
}
|
|
252
|
+
}
|
|
253
|
+
else {
|
|
254
|
+
setPendingAgentAction(JSON.stringify(built.message));
|
|
255
|
+
}
|
|
256
|
+
}
|
|
257
|
+
function formatLocalActionValue(value) {
|
|
258
|
+
if (value === undefined)
|
|
259
|
+
return t('(no return value)');
|
|
260
|
+
return typeof value === 'string' ? value : JSON.stringify(value);
|
|
261
|
+
}
|
|
262
|
+
if (!root) {
|
|
263
|
+
return refusalNotice ? (_jsx("div", { className: "a2ui-surface-card a2ui-surface-refused", role: "status", children: t('A2UI surface refused: {reason}', { reason: refusalNotice }) })) : (_jsx("div", { className: "a2ui-surface-card a2ui-surface-waiting", role: "status", children: t('Waiting for the agent to send a root component…') }));
|
|
264
|
+
}
|
|
265
|
+
return (_jsxs("div", { className: "a2ui-surface-card", "data-a2ui-surface-id": surfaceId, children: [_jsx(RenderComponent, { interpreter: interpreter, surfaceId: surfaceId, componentId: "root", ancestors: new Set(), onAction: handleAction }), refusalNotice ? (_jsx("div", { className: "a2ui-surface-notice a2ui-surface-notice-refused", role: "status", children: t('Action refused: {reason}', { reason: refusalNotice }) })) : null, pendingAgentAction ? (_jsx("div", { className: "a2ui-surface-notice a2ui-surface-notice-unwired", role: "status", children: t('This action is meant for the agent, but this host has not wired up a live agent-action relay yet.') })) : null, deliveryFailureNotice ? (
|
|
266
|
+
// Deliberately its own notice, not folded into `refusalNotice` above: that one fires
|
|
267
|
+
// *before* anything is sent (the interpreter said no); this one fires *after* — the message
|
|
268
|
+
// left this component but the host reports it never arrived. Conflating them would tell the
|
|
269
|
+
// human the wrong half of the story.
|
|
270
|
+
_jsx("div", { className: "a2ui-surface-notice a2ui-surface-notice-delivery-failed", role: "status", children: t('This action could not be delivered: {reason}', { reason: deliveryFailureNotice }) })) : null, localActionResult ? (_jsx("div", { className: "a2ui-surface-notice a2ui-surface-notice-local-action", role: "status", "data-a2ui-component-id": localActionResult.componentId, children: t('Local action resolved: {value}', { value: formatLocalActionValue(localActionResult.value) }) })) : null] }));
|
|
271
|
+
}
|
|
272
|
+
//# sourceMappingURL=A2uiSurfaceCard.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"A2uiSurfaceCard.js","sourceRoot":"","sources":["../../../src/react/components/A2uiSurfaceCard.tsx"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AACH,OAAO,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAE7D,OAAO,EAAE,qBAAqB,EAAE,gBAAgB,EAAwB,MAAM,uBAAuB,CAAC;AACtG,OAAO,EAAE,4BAA4B,EAAE,MAAM,kBAAkB,CAAC;AAChE,OAAO,EAAE,+BAA+B,EAAE,MAAM,4BAA4B,CAAC;AAE7E,OAAO,EAAE,IAAI,EAAE,MAAM,qBAAqB,CAAC;AAE3C,8FAA8F;AAC9F,MAAM,eAAe,GAAG,CAAC,eAAe,EAAE,kBAAkB,EAAE,iBAAiB,EAAE,eAAe,CAAU,CAAC;AAE3G,SAAS,gBAAgB,CAAC,OAAgB;IACxC,IAAI,OAAO,OAAO,KAAK,QAAQ,IAAI,OAAO,KAAK,IAAI;QAAE,OAAO,SAAS,CAAC;IACtE,KAAK,MAAM,GAAG,IAAI,eAAe,EA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,EAAC,QAAQ,4BAAyB,iBAAiB,CAAC,WAAW,YACtI,CAAC,CAAC,gCAAgC,EAAE,EAAE,KAAK,EAAE,sBAAsB,CAAC,iBAAiB,CAAC,KAAK,CAAC,EAAE,CAAC,GAC5F,CACP,CAAC,CAAC,CAAC,IAAI,IACJ,CACP,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { AttachmentTraySlot } from '../slots.js';
|
|
2
|
+
export type AttachmentTrayProps = AttachmentTraySlot;
|
|
3
|
+
export declare function AttachmentTray({ attachments, onRemove, renderItem }: AttachmentTrayProps): import("react").JSX.Element | null;
|
|
4
|
+
/** Formats optional byte counts for the compact composer attachment chip. */
|
|
5
|
+
export declare function formatAttachmentSize(size: number | undefined): string | null;
|
|
6
|
+
//# sourceMappingURL=AttachmentTray.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AttachmentTray.d.ts","sourceRoot":"","sources":["../../../src/react/components/AttachmentTray.tsx"],"names":[],"mappings":"AAYA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAC;AAEtD,MAAM,MAAM,mBAAmB,GAAG,kBAAkB,CAAC;AAErD,wBAAgB,cAAc,CAAC,EAAE,WAAW,EAAE,QAAQ,EAAE,UAAU,EAAE,EAAE,mBAAmB,sCAqBxF;AAmBD,6EAA6E;AAC7E,wBAAgB,oBAAoB,CAAC,IAAI,EAAE,MAAM,GAAG,SAAS,GAAG,MAAM,GAAG,IAAI,CAY5E"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useT } from '../hooks/context.js';
|
|
3
|
+
import { Icon } from './Icon.js';
|
|
4
|
+
export function AttachmentTray({ attachments, onRemove, renderItem }) {
|
|
5
|
+
const t = useT();
|
|
6
|
+
if (attachments.length === 0)
|
|
7
|
+
return null;
|
|
8
|
+
return (_jsx("div", { className: "jini-attachment-tray", "data-testid": "composer-attachment-tray", children: attachments.map((a) => (_jsxs("div", { className: "jini-attachment-chip", "data-testid": "attachment-chip", "data-attachment-kind": a.kind, "data-attachment-name": a.name, children: [renderItem ? renderItem(a) : _jsx(DefaultAttachmentChip, { attachment: a }), _jsx("button", { type: "button", className: "jini-attachment-remove", onClick: () => onRemove(a.path), title: t('Remove {name}', { name: a.name }), "aria-label": t('Remove {name}', { name: a.name }), children: _jsx(Icon, { name: "close", size: 12 }) })] }, a.path))) }));
|
|
9
|
+
}
|
|
10
|
+
function DefaultAttachmentChip({ attachment }) {
|
|
11
|
+
const size = formatAttachmentSize(attachment.size);
|
|
12
|
+
return (_jsxs("span", { className: "jini-attachment-chip-body", children: [_jsx("span", { className: `jini-attachment-chip-icon is-${attachment.kind}`, children: _jsx(Icon, { name: attachment.kind === 'image' ? 'image' : 'file', size: 15 }) }), _jsxs("span", { className: "jini-attachment-chip-copy", children: [_jsx("span", { className: "jini-attachment-chip-name", title: attachment.name, children: attachment.name }), size ? _jsx("small", { className: "jini-attachment-chip-size", children: size }) : null] })] }));
|
|
13
|
+
}
|
|
14
|
+
/** Formats optional byte counts for the compact composer attachment chip. */
|
|
15
|
+
export function formatAttachmentSize(size) {
|
|
16
|
+
if (size === undefined || !Number.isFinite(size) || size < 0)
|
|
17
|
+
return null;
|
|
18
|
+
if (size < 1_024)
|
|
19
|
+
return `${Math.round(size)} B`;
|
|
20
|
+
const units = ['KB', 'MB', 'GB'];
|
|
21
|
+
let value = size / 1_024;
|
|
22
|
+
let unitIndex = 0;
|
|
23
|
+
while (value >= 1_024 && unitIndex < units.length - 1) {
|
|
24
|
+
value /= 1_024;
|
|
25
|
+
unitIndex += 1;
|
|
26
|
+
}
|
|
27
|
+
const formatted = value < 10 ? value.toFixed(1).replace(/\.0$/u, '') : Math.round(value).toString();
|
|
28
|
+
return `${formatted} ${units[unitIndex]}`;
|
|
29
|
+
}
|
|
30
|
+
//# sourceMappingURL=AttachmentTray.js.map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C,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,QAAQ,EAAE,CAAC;IACpG,OAAO,GAAG,SAAS,IAAI,KAAK,CAAC,SAAS,CAAC,EAAE,CAAC;AAC5C,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export interface ChatFabProps {
|
|
2
|
+
readonly open: boolean;
|
|
3
|
+
readonly onToggle: () => void;
|
|
4
|
+
/** Rendered as the accessible name, and announced as a state change to assistive tech. */
|
|
5
|
+
readonly label?: string;
|
|
6
|
+
}
|
|
7
|
+
export declare function ChatFab({ open, onToggle, label }: ChatFabProps): import("react").JSX.Element;
|
|
8
|
+
//# sourceMappingURL=ChatFab.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ChatFab.d.ts","sourceRoot":"","sources":["../../../src/react/components/ChatFab.tsx"],"names":[],"mappings":"AASA,MAAM,WAAW,YAAY;IAC3B,QAAQ,CAAC,IAAI,EAAE,OAAO,CAAC;IACvB,QAAQ,CAAC,QAAQ,EAAE,MAAM,IAAI,CAAC;IAC9B,0FAA0F;IAC1F,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,CAAC;CACzB;AAED,wBAAgB,OAAO,CAAC,EAAE,IAAI,EAAE,QAAQ,EAAE,KAAc,EAAE,EAAE,YAAY,+BAmCvE"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
/**
|
|
3
|
+
* @module ChatFab
|
|
4
|
+
*
|
|
5
|
+
* A draggable floating button that opens and closes a chat pane. This package ships unstyled
|
|
6
|
+
* semantic markup (same convention as the rest of `@jini-ai/chat-react`) — a host supplies CSS
|
|
7
|
+
* for the `chat-fab`/`chat-fab-open` classes.
|
|
8
|
+
*/
|
|
9
|
+
import { useChatFabDrag } from '../hooks/useChatFabDrag.js';
|
|
10
|
+
export function ChatFab({ open, onToggle, label = 'chat' }) {
|
|
11
|
+
const { buttonRef, position, onPointerDown, onPointerMove, onPointerUp, onPointerCancel } = useChatFabDrag(onToggle);
|
|
12
|
+
return (_jsx("button", { ref: buttonRef, type: "button", className: `chat-fab${open ? ' chat-fab-open' : ''}`,
|
|
13
|
+
// Not `onClick`: the pointer gesture already decides click-versus-drag, and keeping both
|
|
14
|
+
// would fire the toggle twice on a tap.
|
|
15
|
+
onPointerDown: onPointerDown, onPointerMove: onPointerMove, onPointerUp: onPointerUp, onPointerCancel: onPointerCancel, onKeyDown: (event) => {
|
|
16
|
+
// Pointer handling bypasses the implicit click, so keyboard activation is wired directly
|
|
17
|
+
// — otherwise the button would be unusable without a mouse.
|
|
18
|
+
if (event.key === 'Enter' || event.key === ' ') {
|
|
19
|
+
event.preventDefault();
|
|
20
|
+
onToggle();
|
|
21
|
+
}
|
|
22
|
+
}, style: position === null ? undefined : { left: position.x, top: position.y, right: 'auto', bottom: 'auto' }, "aria-expanded": open, "aria-label": open ? `Hide ${label}` : `Show ${label}`, children: _jsx("span", { "aria-hidden": "true", children: open ? '×' : '💬' }) }));
|
|
23
|
+
}
|
|
24
|
+
//# sourceMappingURL=ChatFab.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ChatFab.js","sourceRoot":"","sources":["../../../src/react/components/ChatFab.tsx"],"names":[],"mappings":";AAAA;;;;;;GAMG;AACH,OAAO,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAC;AAS5D,MAAM,UAAU,OAAO,CAAC,EAAE,IAAI,EAAE,QAAQ,EAAE,KAAK,GAAG,MAAM,EAAgB;IACtE,MAAM,EAAE,SAAS,EAAE,QAAQ,EAAE,aAAa,EAAE,aAAa,EAAE,WAAW,EAAE,eAAe,EAAE,GAAG,cAAc,CAAC,QAAQ,CAAC,CAAC;IAErH,OAAO,CACL,iBACE,GAAG,EAAE,SAAS,EACd,IAAI,EAAC,QAAQ,EACb,SAAS,EAAE,WAAW,IAAI,CAAC,CAAC,CAAC,gBAAgB,CAAC,CAAC,CAAC,EAAE,EAAE;QACpD,yFAAyF;QACzF,wCAAwC;QACxC,aAAa,EAAE,aAAa,EAC5B,aAAa,EAAE,aAAa,EAC5B,WAAW,EAAE,WAAW,EACxB,eAAe,EAAE,eAAe,EAChC,SAAS,EAAE,CAAC,KAAK,EAAE,EAAE;YACnB,yFAAyF;YACzF,4DAA4D;YAC5D,IAAI,KAAK,CAAC,GAAG,KAAK,OAAO,IAAI,KAAK,CAAC,GAAG,KAAK,GAAG,EAAE,CAAC;gBAC/C,KAAK,CAAC,cAAc,EAAE,CAAC;gBACvB,QAAQ,EAAE,CAAC;YACb,CAAC;QACH,CAAC,EACD,KAAK,EAAE,QAAQ,KAAK,IAAI,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,QAAQ,CAAC,CAAC,EAAE,GAAG,EAAE,QAAQ,CAAC,CAAC,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,mBAC5F,IAAI,gBACP,IAAI,CAAC,CAAC,CAAC,QAAQ,KAAK,EAAE,CAAC,CAAC,CAAC,QAAQ,KAAK,EAAE,YAQpD,8BAAkB,MAAM,YAAE,IAAI,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,IAAI,GAAQ,GAC5C,CACV,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import type { UseComposerResult } from '../hooks/useComposer.js';
|
|
2
|
+
import type { ComposerSlots } from '../slots.js';
|
|
3
|
+
export interface ComposerProps {
|
|
4
|
+
composer: UseComposerResult;
|
|
5
|
+
onSend: () => void;
|
|
6
|
+
disabled?: boolean;
|
|
7
|
+
/** Disables submission without disabling draft editing or attachment controls. */
|
|
8
|
+
sendDisabled?: boolean;
|
|
9
|
+
placeholder?: string;
|
|
10
|
+
slots?: ComposerSlots;
|
|
11
|
+
attachmentPicker?: {
|
|
12
|
+
onFiles: (files: File[]) => void | Promise<void>;
|
|
13
|
+
accept?: string;
|
|
14
|
+
uploading?: boolean;
|
|
15
|
+
};
|
|
16
|
+
/**
|
|
17
|
+
* A run is currently streaming. Swaps the trailing send button for a stop button in the same
|
|
18
|
+
* position — same control an operator already has their attention on, rather than a second,
|
|
19
|
+
* separately placed cancel affordance elsewhere in the pane. Always clickable when true,
|
|
20
|
+
* regardless of `disabled`/`sendDisabled`/`composer.canSubmit`: those all gate *submitting a new
|
|
21
|
+
* draft*, which has nothing to do with whether a caller may cancel the run already in flight.
|
|
22
|
+
*/
|
|
23
|
+
running?: boolean;
|
|
24
|
+
/** Cancels the in-flight run. Required when `running` is true; ignored otherwise. */
|
|
25
|
+
onCancel?: () => void;
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Renders the controlled message composer and optional attachment picker.
|
|
29
|
+
*
|
|
30
|
+
* @complexity Time/space: O(n) in rendered attachments and supplied menu items.
|
|
31
|
+
* @overallScore 100/100
|
|
32
|
+
*/
|
|
33
|
+
export declare function Composer({ composer, onSend, disabled, sendDisabled, placeholder, slots, attachmentPicker, running, onCancel, }: ComposerProps): import("react").JSX.Element;
|
|
34
|
+
//# sourceMappingURL=Composer.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Composer.d.ts","sourceRoot":"","sources":["../../../src/react/components/Composer.tsx"],"names":[],"mappings":"AA0BA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AACjE,OAAO,KAAK,EAAmD,aAAa,EAAE,MAAM,aAAa,CAAC;AAalG,MAAM,WAAW,aAAa;IAC5B,QAAQ,EAAE,iBAAiB,CAAC;IAC5B,MAAM,EAAE,MAAM,IAAI,CAAC;IACnB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,kFAAkF;IAClF,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,KAAK,CAAC,EAAE,aAAa,CAAC;IACtB,gBAAgB,CAAC,EAAE;QACjB,OAAO,EAAE,CAAC,KAAK,EAAE,IAAI,EAAE,KAAK,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;QACjD,MAAM,CAAC,EAAE,MAAM,CAAC;QAChB,SAAS,CAAC,EAAE,OAAO,CAAC;KACrB,CAAC;IACF;;;;;;OAMG;IACH,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,qFAAqF;IACrF,QAAQ,CAAC,EAAE,MAAM,IAAI,CAAC;CACvB;AA+CD;;;;;GAKG;AACH,wBAAgB,QAAQ,CAAC,EACvB,QAAQ,EACR,MAAM,EACN,QAAgB,EAChB,YAAoB,EACpB,WAAW,EACX,KAAK,EACL,gBAAgB,EAChB,OAAe,EACf,QAAQ,GACT,EAAE,aAAa,+BAoVf"}
|