@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,113 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @module useQuestionForms
|
|
3
|
+
*
|
|
4
|
+
* Parses `<question-form>` artifacts out of each assistant message via
|
|
5
|
+
* `@jini-ai/chat/core`'s `findFirstQuestionForm`, tracks which one (if any) is
|
|
6
|
+
* still the active/answerable one, and recovers already-submitted answers by
|
|
7
|
+
* reading the next user message's `[form answers — ...]` payload. Pure parse
|
|
8
|
+
* — `submit` only builds the next-user-message text; the host posts it via
|
|
9
|
+
* its own `sendMessage`/transport call. Per
|
|
10
|
+
* `ADS-memory/reports/jini-port/recon/r4b-webui-design.md` §4.
|
|
11
|
+
*
|
|
12
|
+
* `parseSubmittedAnswers` below generalizes OD's `components/QuestionForm.tsx`
|
|
13
|
+
* function of the same name (verified 0 OD product references — it only
|
|
14
|
+
* reverses `formatFormAnswers`'s own text format) into this package, since
|
|
15
|
+
* chat-core intentionally ships only the forward direction
|
|
16
|
+
* (`formatFormAnswers`).
|
|
17
|
+
*/
|
|
18
|
+
import { useCallback, useMemo } from 'react';
|
|
19
|
+
import { findFirstQuestionForm, formOptionValueForLabel, formatFormAnswers } from '../../core/index.js';
|
|
20
|
+
export function useQuestionForms(messages) {
|
|
21
|
+
const forms = useMemo(() => {
|
|
22
|
+
if (!messages || messages.length === 0)
|
|
23
|
+
return [];
|
|
24
|
+
const out = [];
|
|
25
|
+
for (let i = 0; i < messages.length; i += 1) {
|
|
26
|
+
const message = messages[i];
|
|
27
|
+
if (!message || message.role !== 'assistant')
|
|
28
|
+
continue;
|
|
29
|
+
const found = findFirstQuestionForm(message.content);
|
|
30
|
+
if (!found)
|
|
31
|
+
continue;
|
|
32
|
+
const nextMessage = messages[i + 1];
|
|
33
|
+
const submittedAnswers = nextMessage && nextMessage.role === 'user' ? parseSubmittedAnswers(found.form, nextMessage.content) ?? undefined : undefined;
|
|
34
|
+
const interactive = submittedAnswers === undefined && i === messages.length - 1;
|
|
35
|
+
out.push({ form: found.form, raw: found.raw, messageId: message.id, interactive, submittedAnswers });
|
|
36
|
+
}
|
|
37
|
+
return out;
|
|
38
|
+
}, [messages]);
|
|
39
|
+
const activeForm = useMemo(() => {
|
|
40
|
+
for (let i = forms.length - 1; i >= 0; i -= 1) {
|
|
41
|
+
const form = forms[i];
|
|
42
|
+
if (form?.interactive)
|
|
43
|
+
return form;
|
|
44
|
+
}
|
|
45
|
+
return null;
|
|
46
|
+
}, [forms]);
|
|
47
|
+
const buildSubmission = useCallback((form, answers) => formatFormAnswers(form, answers), []);
|
|
48
|
+
return { forms, activeForm, buildSubmission };
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* Reverse of `formatFormAnswers` — given the user message that (maybe)
|
|
52
|
+
* answered `form`, recover the answers map so the form can render in its
|
|
53
|
+
* locked "answered" state with the user's picks visible.
|
|
54
|
+
*/
|
|
55
|
+
export function parseSubmittedAnswers(form, userMessageContent) {
|
|
56
|
+
// `String.prototype.split` always returns an array of length >= 1 (even
|
|
57
|
+
// `''.split('\n')` is `['']`), so `lines` can never be empty here — no
|
|
58
|
+
// `lines.length === 0` guard is needed (removed as provably-dead). Index 0
|
|
59
|
+
// of a non-empty array is always defined; TS just can't express that for
|
|
60
|
+
// a plain numeric index, hence the assertion instead of a `?? ''` branch
|
|
61
|
+
// that would never take its fallback path.
|
|
62
|
+
const lines = userMessageContent.split('\n').map((l) => l.trim());
|
|
63
|
+
const header = lines[0];
|
|
64
|
+
if (!/^\[form answers/i.test(header))
|
|
65
|
+
return null;
|
|
66
|
+
const answers = {};
|
|
67
|
+
const labelToId = new Map();
|
|
68
|
+
for (const q of form.questions)
|
|
69
|
+
labelToId.set(q.label.toLowerCase(), q.id);
|
|
70
|
+
for (let i = 1; i < lines.length; i += 1) {
|
|
71
|
+
// `i < lines.length` is the loop condition, so this index is always
|
|
72
|
+
// in-bounds and defined — same reasoning as `header` above.
|
|
73
|
+
const line = lines[i];
|
|
74
|
+
const m = /^[-*]\s*([^:]+):\s*(.*)$/.exec(line);
|
|
75
|
+
if (!m)
|
|
76
|
+
continue;
|
|
77
|
+
// Both capture groups are required (non-optional) in this pattern, so
|
|
78
|
+
// they're always defined once `m` is non-null — TS just can't express
|
|
79
|
+
// that for regex capture groups.
|
|
80
|
+
const labelKey = m[1].trim().toLowerCase();
|
|
81
|
+
const value = m[2].trim();
|
|
82
|
+
const id = labelToId.get(labelKey);
|
|
83
|
+
if (!id)
|
|
84
|
+
continue;
|
|
85
|
+
// `id` only ever comes from `labelToId`, which was populated from this
|
|
86
|
+
// same `form.questions` array immediately above, so a question with
|
|
87
|
+
// this exact `id` is always found — the `!` reflects that invariant
|
|
88
|
+
// rather than gaming an untestable defensive branch.
|
|
89
|
+
const question = form.questions.find((x) => x.id === id);
|
|
90
|
+
answers[id] = decodeAnswerValue(question, value);
|
|
91
|
+
}
|
|
92
|
+
return Object.keys(answers).length > 0 ? answers : null;
|
|
93
|
+
}
|
|
94
|
+
function decodeAnswerValue(question, value) {
|
|
95
|
+
if (question.type === 'checkbox') {
|
|
96
|
+
return value
|
|
97
|
+
.split(',')
|
|
98
|
+
.map((s) => s.trim())
|
|
99
|
+
.filter((s) => s.length > 0 && s.toLowerCase() !== '(skipped)')
|
|
100
|
+
.map((s) => formOptionValueForLabel(question, parseSubmittedOptionToken(s)));
|
|
101
|
+
}
|
|
102
|
+
return value.toLowerCase() === '(skipped)' ? '' : formOptionValueForLabel(question, parseSubmittedOptionToken(value));
|
|
103
|
+
}
|
|
104
|
+
function parseSubmittedOptionToken(raw) {
|
|
105
|
+
const match = /\s+\[value:\s*([^\]]+)\]\s*$/i.exec(raw);
|
|
106
|
+
if (!match)
|
|
107
|
+
return raw.trim();
|
|
108
|
+
// The single capture group is non-optional in this pattern, so it's
|
|
109
|
+
// always defined once `match` is non-null — same regex-capture-group
|
|
110
|
+
// caveat as `parseSubmittedAnswers` above.
|
|
111
|
+
return match[1].trim();
|
|
112
|
+
}
|
|
113
|
+
//# sourceMappingURL=useQuestionForms.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useQuestionForms.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AAC;AAC1D,CAAC;AAED,SAAS,iBAAiB,CAAC,QAAsB,EAAE,KAAa;IAC9D,IAAI,QAAQ,CAAC,IAAI,KAAK,UAAU,EAAE,CAAC;QACjC,OAAO,KAAK;aACT,KAAK,CAAC,GAAG,CAAC;aACV,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC;aACpB,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,MAAM,GAAG,CAAC,IAAI,CAAC,CAAC,WAAW,EAAE,KAAK,WAAW,CAAC;aAC9D,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,uBAAuB,CAAC,QAAQ,EAAE,yBAAyB,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;IACjF,CAAC;IACD,OAAO,KAAK,CAAC,WAAW,EAAE,KAAK,WAAW,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,uBAAuB,CAAC,QAAQ,EAAE,yBAAyB,CAAC,KAAK,CAAC,CAAC,CAAC;AACxH,CAAC;AAED,SAAS,yBAAyB,CAAC,GAAW;IAC5C,MAAM,KAAK,GAAG,+BAA+B,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;IACxD,IAAI,CAAC,KAAK;QAAE,OAAO,GAAG,CAAC,IAAI,EAAE,CAAC;IAC9B,oEAAoE;IACpE,qEAAqE;IACrE,2CAA2C;IAC3C,OAAO,KAAK,CAAC,CAAC,CAAE,CAAC,IAAI,EAAE,CAAC;AAC1B,CAAC"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import type { AgentEvent } from '../../core/index.js';
|
|
2
|
+
import type { ChatTransport, StartRunInput } from '../../core/index.js';
|
|
3
|
+
export type RunStreamStatus = 'idle' | 'streaming' | 'done' | 'error' | 'canceled';
|
|
4
|
+
export interface RunStreamState {
|
|
5
|
+
runId: string | null;
|
|
6
|
+
status: RunStreamStatus;
|
|
7
|
+
events: AgentEvent[];
|
|
8
|
+
error: Error | null;
|
|
9
|
+
/** Ephemeral live tool-input fragments, keyed by tool-use id. Never persisted. */
|
|
10
|
+
toolInputDeltas: Record<string, string>;
|
|
11
|
+
}
|
|
12
|
+
export type StartRunOptions = Omit<StartRunInput, 'signal' | 'cancelSignal'>;
|
|
13
|
+
export interface UseRunStreamResult extends RunStreamState {
|
|
14
|
+
/** True while `status === 'streaming'`. Convenience for render conditions. */
|
|
15
|
+
isStreaming: boolean;
|
|
16
|
+
start: (input: StartRunOptions) => Promise<{
|
|
17
|
+
runId: string;
|
|
18
|
+
} | null>;
|
|
19
|
+
/** Resume listening to an already-started run (reconnect/replay), optionally seeded with its persisted events. */
|
|
20
|
+
reattach: (runId: string, initialEvents?: AgentEvent[]) => Promise<void>;
|
|
21
|
+
/** Aborts the current browser-side subscription AND asks the transport to stop the run host-side. */
|
|
22
|
+
cancel: () => void;
|
|
23
|
+
/** Clears all state back to `idle` without touching the transport (e.g. moving to a fresh turn). */
|
|
24
|
+
reset: () => void;
|
|
25
|
+
}
|
|
26
|
+
export declare function useRunStream(transport: ChatTransport): UseRunStreamResult;
|
|
27
|
+
//# sourceMappingURL=useRunStream.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useRunStream.d.ts","sourceRoot":"","sources":["../../../src/react/hooks/useRunStream.ts"],"names":[],"mappings":"AAoBA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AACtD,OAAO,KAAK,EAAE,aAAa,EAAe,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAErF,MAAM,MAAM,eAAe,GAAG,MAAM,GAAG,WAAW,GAAG,MAAM,GAAG,OAAO,GAAG,UAAU,CAAC;AAEnF,MAAM,WAAW,cAAc;IAC7B,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IACrB,MAAM,EAAE,eAAe,CAAC;IACxB,MAAM,EAAE,UAAU,EAAE,CAAC;IACrB,KAAK,EAAE,KAAK,GAAG,IAAI,CAAC;IACpB,kFAAkF;IAClF,eAAe,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CACzC;AAED,MAAM,MAAM,eAAe,GAAG,IAAI,CAAC,aAAa,EAAE,QAAQ,GAAG,cAAc,CAAC,CAAC;AAE7E,MAAM,WAAW,kBAAmB,SAAQ,cAAc;IACxD,8EAA8E;IAC9E,WAAW,EAAE,OAAO,CAAC;IACrB,KAAK,EAAE,CAAC,KAAK,EAAE,eAAe,KAAK,OAAO,CAAC;QAAE,KAAK,EAAE,MAAM,CAAA;KAAE,GAAG,IAAI,CAAC,CAAC;IACrE,kHAAkH;IAClH,QAAQ,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,aAAa,CAAC,EAAE,UAAU,EAAE,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;IACzE,qGAAqG;IACrG,MAAM,EAAE,MAAM,IAAI,CAAC;IACnB,oGAAoG;IACpG,KAAK,EAAE,MAAM,IAAI,CAAC;CACnB;AAkCD,wBAAgB,YAAY,CAAC,SAAS,EAAE,aAAa,GAAG,kBAAkB,CAoIzE"}
|
|
@@ -0,0 +1,180 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @module useRunStream
|
|
3
|
+
*
|
|
4
|
+
* Owns the current `runId`, streaming flag, accumulated `AgentEvent[]`,
|
|
5
|
+
* error/terminal state, and the ephemeral tool-input-delta buffer (keyed by
|
|
6
|
+
* tool id) for a single active run. Calls `transport.startRun`/
|
|
7
|
+
* `reattachRun`/`stopRun` — never touches `fetch`/`EventSource` itself; the
|
|
8
|
+
* `ChatTransport` port (see `../../transport.js`) is the only I/O this hook
|
|
9
|
+
* performs. Per `ADS-memory/reports/jini-port/recon/r4b-webui-design.md` §4's hook table.
|
|
10
|
+
*
|
|
11
|
+
* This hook IS the "single-instance orchestrator" the §4 accumulating-
|
|
12
|
+
* subscription rule refers to: it owns the one active browser-side
|
|
13
|
+
* subscription for whichever run it is currently attached to. Each
|
|
14
|
+
* start/reattach bumps a generation counter; handlers from a superseded
|
|
15
|
+
* generation are ignored, so a slow/duplicate callback from an aborted
|
|
16
|
+
* subscription can never clobber a newer one's state (a plain `runId`
|
|
17
|
+
* comparison can't do this — `start()`'s handlers must exist before the
|
|
18
|
+
* transport's promise resolves with the real id).
|
|
19
|
+
*/
|
|
20
|
+
import { useCallback, useEffect, useRef, useState } from 'react';
|
|
21
|
+
function reportRunStreamHostEffectFailure(effectName, error) {
|
|
22
|
+
console.error(`[@jini-ai/chat] useRunStream ${effectName} host effect failed:`, error);
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Fire-and-forget teardown call to `transport.stopRun`. Invokes it synchronously, then observes
|
|
26
|
+
* a synchronous throw or async rejection without leaving it unhandled — under Node's default
|
|
27
|
+
* `--unhandled-rejections=throw` a rejecting transport would otherwise crash the process, and in
|
|
28
|
+
* the browser it is a silent, undiagnosable console error. Neither call site awaits the result
|
|
29
|
+
* or calls `setState`, so there is nothing here that could touch state after unmount.
|
|
30
|
+
*/
|
|
31
|
+
function runStopRunHostEffect(effectName, effect) {
|
|
32
|
+
let result;
|
|
33
|
+
try {
|
|
34
|
+
result = effect();
|
|
35
|
+
}
|
|
36
|
+
catch (error) {
|
|
37
|
+
reportRunStreamHostEffectFailure(effectName, error);
|
|
38
|
+
return;
|
|
39
|
+
}
|
|
40
|
+
void result.catch((error) => {
|
|
41
|
+
reportRunStreamHostEffectFailure(effectName, error);
|
|
42
|
+
});
|
|
43
|
+
}
|
|
44
|
+
const INITIAL_STATE = {
|
|
45
|
+
runId: null,
|
|
46
|
+
status: 'idle',
|
|
47
|
+
events: [],
|
|
48
|
+
error: null,
|
|
49
|
+
toolInputDeltas: {},
|
|
50
|
+
};
|
|
51
|
+
export function useRunStream(transport) {
|
|
52
|
+
const [state, setState] = useState(INITIAL_STATE);
|
|
53
|
+
const subscriptionAbortRef = useRef(null);
|
|
54
|
+
const cancelAbortRef = useRef(null);
|
|
55
|
+
// Bumped on every start/reattach/reset. A handler closes over the
|
|
56
|
+
// generation it was created for and drops itself once superseded.
|
|
57
|
+
const generationRef = useRef(0);
|
|
58
|
+
/**
|
|
59
|
+
* Generations that were CANCELLED (as opposed to merely superseded) while their `startRun` was
|
|
60
|
+
* still in flight.
|
|
61
|
+
*
|
|
62
|
+
* `cancel()` can only stop a run it has an id for, and during that window there is no id yet.
|
|
63
|
+
* The generation bump then routes the eventual resolution down the "not current" path, so the
|
|
64
|
+
* run was left alive on the daemon with nothing on the client able to reach it. Recording the
|
|
65
|
+
* intent here lets the resolution finish the job. A supersession by a new start/reattach is
|
|
66
|
+
* deliberately NOT recorded — that case really does need no stop.
|
|
67
|
+
*/
|
|
68
|
+
const canceledGenerations = useRef(new Set());
|
|
69
|
+
const teardownSubscription = useCallback(() => {
|
|
70
|
+
subscriptionAbortRef.current?.abort();
|
|
71
|
+
subscriptionAbortRef.current = null;
|
|
72
|
+
cancelAbortRef.current = null;
|
|
73
|
+
}, []);
|
|
74
|
+
// Abort any in-flight subscription on unmount so a slow transport can't
|
|
75
|
+
// call back into a hook instance that no longer exists.
|
|
76
|
+
useEffect(() => teardownSubscription, [teardownSubscription]);
|
|
77
|
+
const makeHandlers = useCallback((generation) => {
|
|
78
|
+
const isStale = () => generationRef.current !== generation;
|
|
79
|
+
return {
|
|
80
|
+
onEvent: (ev) => {
|
|
81
|
+
if (isStale())
|
|
82
|
+
return;
|
|
83
|
+
setState((prev) => ({ ...prev, status: 'streaming', events: [...prev.events, ev] }));
|
|
84
|
+
},
|
|
85
|
+
onToolInputDelta: (id, _name, delta) => {
|
|
86
|
+
if (isStale())
|
|
87
|
+
return;
|
|
88
|
+
setState((prev) => ({
|
|
89
|
+
...prev,
|
|
90
|
+
toolInputDeltas: { ...prev.toolInputDeltas, [id]: (prev.toolInputDeltas[id] ?? '') + delta },
|
|
91
|
+
}));
|
|
92
|
+
},
|
|
93
|
+
onError: (err) => {
|
|
94
|
+
if (isStale())
|
|
95
|
+
return;
|
|
96
|
+
setState((prev) => ({ ...prev, status: 'error', error: err }));
|
|
97
|
+
},
|
|
98
|
+
onDone: (finalEvents) => {
|
|
99
|
+
if (isStale())
|
|
100
|
+
return;
|
|
101
|
+
setState((prev) => ({ ...prev, status: prev.status === 'error' ? prev.status : 'done', events: finalEvents }));
|
|
102
|
+
},
|
|
103
|
+
};
|
|
104
|
+
}, []);
|
|
105
|
+
const start = useCallback(async (input) => {
|
|
106
|
+
teardownSubscription();
|
|
107
|
+
const generation = ++generationRef.current;
|
|
108
|
+
const subscriptionAbort = new AbortController();
|
|
109
|
+
const cancelAbort = new AbortController();
|
|
110
|
+
subscriptionAbortRef.current = subscriptionAbort;
|
|
111
|
+
cancelAbortRef.current = cancelAbort;
|
|
112
|
+
setState({ ...INITIAL_STATE, status: 'streaming' });
|
|
113
|
+
try {
|
|
114
|
+
const { runId } = await transport.startRun({ ...input, signal: subscriptionAbort.signal, cancelSignal: cancelAbort.signal }, makeHandlers(generation));
|
|
115
|
+
if (generationRef.current !== generation) {
|
|
116
|
+
// Consumed rather than assumed: only a CANCEL leaves an orphan here.
|
|
117
|
+
if (canceledGenerations.current.delete(generation)) {
|
|
118
|
+
runStopRunHostEffect('transport.stopRun (orphaned generation)', () => transport.stopRun(runId));
|
|
119
|
+
}
|
|
120
|
+
return { runId };
|
|
121
|
+
}
|
|
122
|
+
setState((prev) => ({ ...prev, runId }));
|
|
123
|
+
return { runId };
|
|
124
|
+
}
|
|
125
|
+
catch (err) {
|
|
126
|
+
// A start that never produced a run id has nothing to stop; drop the intent so the set does
|
|
127
|
+
// not accumulate one entry per failed start for the lifetime of the hook.
|
|
128
|
+
canceledGenerations.current.delete(generation);
|
|
129
|
+
if (generationRef.current !== generation)
|
|
130
|
+
return null;
|
|
131
|
+
setState((prev) => ({ ...prev, status: 'error', error: toError(err) }));
|
|
132
|
+
return null;
|
|
133
|
+
}
|
|
134
|
+
}, [makeHandlers, teardownSubscription, transport]);
|
|
135
|
+
const reattach = useCallback(async (runId, initialEvents = []) => {
|
|
136
|
+
teardownSubscription();
|
|
137
|
+
const generation = ++generationRef.current;
|
|
138
|
+
const subscriptionAbort = new AbortController();
|
|
139
|
+
const cancelAbort = new AbortController();
|
|
140
|
+
subscriptionAbortRef.current = subscriptionAbort;
|
|
141
|
+
cancelAbortRef.current = cancelAbort;
|
|
142
|
+
setState({ ...INITIAL_STATE, runId, status: 'streaming', events: initialEvents });
|
|
143
|
+
try {
|
|
144
|
+
// The subscription controller reaches the transport, so `teardownSubscription()` (unmount,
|
|
145
|
+
// reset, or a superseding start/reattach) actually detaches the stream. Without it the
|
|
146
|
+
// generation guard still stops stale callbacks from clobbering state, but the connection
|
|
147
|
+
// and its read loop stay open until the run ends on its own.
|
|
148
|
+
await transport.reattachRun(runId, makeHandlers(generation), { signal: subscriptionAbort.signal });
|
|
149
|
+
}
|
|
150
|
+
catch (err) {
|
|
151
|
+
if (generationRef.current !== generation)
|
|
152
|
+
return;
|
|
153
|
+
setState((prev) => ({ ...prev, status: 'error', error: toError(err) }));
|
|
154
|
+
}
|
|
155
|
+
}, [makeHandlers, teardownSubscription]);
|
|
156
|
+
const cancel = useCallback(() => {
|
|
157
|
+
cancelAbortRef.current?.abort();
|
|
158
|
+
const runId = state.runId;
|
|
159
|
+
// Recorded BEFORE the bump, so it names the generation currently in flight. When `runId` is
|
|
160
|
+
// already known the `stopRun` below does the work and this entry is simply never consumed;
|
|
161
|
+
// when it is not, this is the only thing that will ever stop that run.
|
|
162
|
+
if (runId == null)
|
|
163
|
+
canceledGenerations.current.add(generationRef.current);
|
|
164
|
+
generationRef.current += 1;
|
|
165
|
+
teardownSubscription();
|
|
166
|
+
setState((prev) => ({ ...prev, status: 'canceled' }));
|
|
167
|
+
if (runId)
|
|
168
|
+
runStopRunHostEffect('transport.stopRun (cancel)', () => transport.stopRun(runId));
|
|
169
|
+
}, [state.runId, teardownSubscription, transport]);
|
|
170
|
+
const reset = useCallback(() => {
|
|
171
|
+
generationRef.current += 1;
|
|
172
|
+
teardownSubscription();
|
|
173
|
+
setState(INITIAL_STATE);
|
|
174
|
+
}, [teardownSubscription]);
|
|
175
|
+
return { ...state, isStreaming: state.status === 'streaming', start, reattach, cancel, reset };
|
|
176
|
+
}
|
|
177
|
+
function toError(err) {
|
|
178
|
+
return err instanceof Error ? err : new Error(String(err));
|
|
179
|
+
}
|
|
180
|
+
//# sourceMappingURL=useRunStream.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useRunStream.js","sourceRoot":"","sources":["../../../src/react/hooks/useRunStream.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AACH,OAAO,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AA6BjE,SAAS,gCAAgC,CAAC,UAAkB,EAAE,KAAc;IAC1E,OAAO,CAAC,KAAK,CAAC,gCAAgC,UAAU,sBAAsB,EAAE,KAAK,CAAC,CAAC;AACzF,CAAC;AAED;;;;;;GAMG;AACH,SAAS,oBAAoB,CAAC,UAAkB,EAAE,MAA2B;IAC3E,IAAI,MAAqB,CAAC;IAC1B,IAAI,CAAC;QACH,MAAM,GAAG,MAAM,EAAE,CAAC;IACpB,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,gCAAgC,CAAC,UAAU,EAAE,KAAK,CAAC,CAAC;QACpD,OAAO;IACT,CAAC;IACD,KAAK,MAAM,CAAC,KAAK,CAAC,CAAC,KAAc,EAAE,EAAE;QACnC,gCAAgC,CAAC,UAAU,EAAE,KAAK,CAAC,CAAC;IACtD,CAAC,CAAC,CAAC;AACL,CAAC;AAED,MAAM,aAAa,GAAmB;IACpC,KAAK,EAAE,IAAI;IACX,MAAM,EAAE,MAAM;IACd,MAAM,EAAE,EAAE;IACV,KAAK,EAAE,IAAI;IACX,eAAe,EAAE,EAAE;CACpB,CAAC;AAEF,MAAM,UAAU,YAAY,CAAC,SAAwB;IACnD,MAAM,CAAC,KAAK,EAAE,QAAQ,CAAC,G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GAAG,CAAC,aAAa,CAAC,OAAO,CAAC,CAAC;QAC1E,aAAa,CAAC,OAAO,IAAI,CAAC,CAAC;QAC3B,oBAAoB,EAAE,CAAC;QACvB,QAAQ,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC,EAAE,GAAG,IAAI,EAAE,MAAM,EAAE,UAAU,EAAE,CAAC,CAAC,CAAC;QACtD,IAAI,KAAK;YAAE,oBAAoB,CAAC,4BAA4B,EAAE,GAAG,EAAE,CAAC,SAAS,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC;IAChG,CAAC,EAAE,CAAC,KAAK,CAAC,KAAK,EAAE,oBAAoB,EAAE,SAAS,CAAC,CAAC,CAAC;IAEnD,MAAM,KAAK,GAAG,WAAW,CAAC,GAAG,EAAE;QAC7B,aAAa,CAAC,OAAO,IAAI,CAAC,CAAC;QAC3B,oBAAoB,EAAE,CAAC;QACvB,QAAQ,CAAC,aAAa,CAAC,CAAC;IAC1B,CAAC,EAAE,CAAC,oBAAoB,CAAC,CAAC,CAAC;IAE3B,OAAO,EAAE,GAAG,KAAK,EAAE,WAAW,EAAE,KAAK,CAAC,MAAM,KAAK,WAAW,EAAE,KAAK,EAAE,QAAQ,EAAE,MAAM,EAAE,KAAK,EAAE,CAAC;AACjG,CAAC;AAED,SAAS,OAAO,CAAC,GAAY;IAC3B,OAAO,GAAG,YAAY,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,IAAI,KAAK,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC;AAC7D,CAAC"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import type { AgentEvent, ToolRenderProps, ToolStatus } from '../../core/index.js';
|
|
2
|
+
type ToolUseEvent = Extract<AgentEvent, {
|
|
3
|
+
kind: 'tool_use';
|
|
4
|
+
}>;
|
|
5
|
+
type ToolResultEvent = Extract<AgentEvent, {
|
|
6
|
+
kind: 'tool_result';
|
|
7
|
+
}>;
|
|
8
|
+
export interface ToolTimelineRow {
|
|
9
|
+
id: string;
|
|
10
|
+
name: string;
|
|
11
|
+
use: ToolUseEvent;
|
|
12
|
+
result: ToolResultEvent | undefined;
|
|
13
|
+
status: ToolStatus;
|
|
14
|
+
expanded: boolean;
|
|
15
|
+
renderProps: ToolRenderProps;
|
|
16
|
+
}
|
|
17
|
+
export interface UseToolTimelineOptions {
|
|
18
|
+
/** Whether the owning run is still emitting events. */
|
|
19
|
+
runStreaming?: boolean;
|
|
20
|
+
/** Whether the (already-terminal) owning run reached a successful status. Ignored while `runStreaming` is true. */
|
|
21
|
+
runSucceeded?: boolean;
|
|
22
|
+
/** Rows start expanded by default. Defaults to `false` (collapsed). */
|
|
23
|
+
defaultExpanded?: boolean;
|
|
24
|
+
}
|
|
25
|
+
export interface UseToolTimelineResult {
|
|
26
|
+
rows: ToolTimelineRow[];
|
|
27
|
+
toggle: (id: string) => void;
|
|
28
|
+
expandAll: () => void;
|
|
29
|
+
collapseAll: () => void;
|
|
30
|
+
}
|
|
31
|
+
export declare function useToolTimeline(events: AgentEvent[] | undefined, options?: UseToolTimelineOptions): UseToolTimelineResult;
|
|
32
|
+
export {};
|
|
33
|
+
//# sourceMappingURL=useToolTimeline.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useToolTimeline.d.ts","sourceRoot":"","sources":["../../../src/react/hooks/useToolTimeline.ts"],"names":[],"mappings":"AAWA,OAAO,KAAK,EAAE,UAAU,EAAE,eAAe,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AAGnF,KAAK,YAAY,GAAG,OAAO,CAAC,UAAU,EAAE;IAAE,IAAI,EAAE,UAAU,CAAA;CAAE,CAAC,CAAC;AAC9D,KAAK,eAAe,GAAG,OAAO,CAAC,UAAU,EAAE;IAAE,IAAI,EAAE,aAAa,CAAA;CAAE,CAAC,CAAC;AAEpE,MAAM,WAAW,eAAe;IAC9B,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,GAAG,EAAE,YAAY,CAAC;IAClB,MAAM,EAAE,eAAe,GAAG,SAAS,CAAC;IACpC,MAAM,EAAE,UAAU,CAAC;IACnB,QAAQ,EAAE,OAAO,CAAC;IAClB,WAAW,EAAE,eAAe,CAAC;CAC9B;AAED,MAAM,WAAW,sBAAsB;IACrC,uDAAuD;IACvD,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,mHAAmH;IACnH,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,uEAAuE;IACvE,eAAe,CAAC,EAAE,OAAO,CAAC;CAC3B;AAED,MAAM,WAAW,qBAAqB;IACpC,IAAI,EAAE,eAAe,EAAE,CAAC;IACxB,MAAM,EAAE,CAAC,EAAE,EAAE,MAAM,KAAK,IAAI,CAAC;IAC7B,SAAS,EAAE,MAAM,IAAI,CAAC;IACtB,WAAW,EAAE,MAAM,IAAI,CAAC;CACzB;AAED,wBAAgB,eAAe,CAAC,MAAM,EAAE,UAAU,EAAE,GAAG,SAAS,EAAE,OAAO,GAAE,sBAA2B,GAAG,qBAAqB,CAsC7H"}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @module useToolTimeline
|
|
3
|
+
*
|
|
4
|
+
* Per-tool lifecycle rows for a message's events: pairs each `tool_use` with
|
|
5
|
+
* its `tool_result` (deduped by id via `@jini-ai/chat/core`'s
|
|
6
|
+
* `dedupeToolUsesById`), derives a four-state status via
|
|
7
|
+
* `deriveToolStatus`, and tracks per-row expand/collapse UI state. Pure over
|
|
8
|
+
* `AgentEvent[]` — zero I/O. Per
|
|
9
|
+
* `ADS-memory/reports/jini-port/recon/r4b-webui-design.md` §4.
|
|
10
|
+
*/
|
|
11
|
+
import { useCallback, useMemo, useState } from 'react';
|
|
12
|
+
import { dedupeToolUsesById, deriveToolStatus } from '../../core/index.js';
|
|
13
|
+
export function useToolTimeline(events, options = {}) {
|
|
14
|
+
const { runStreaming = false, runSucceeded = false, defaultExpanded = false } = options;
|
|
15
|
+
const [overrides, setOverrides] = useState({});
|
|
16
|
+
const deduped = useMemo(() => dedupeToolUsesById(events), [events]);
|
|
17
|
+
const rows = useMemo(() => {
|
|
18
|
+
const out = [];
|
|
19
|
+
for (const ev of deduped) {
|
|
20
|
+
if (ev.kind !== 'tool_use')
|
|
21
|
+
continue;
|
|
22
|
+
const result = deduped.find((r) => r.kind === 'tool_result' && r.toolUseId === ev.id);
|
|
23
|
+
const status = deriveToolStatus(result, runStreaming, runSucceeded);
|
|
24
|
+
out.push({
|
|
25
|
+
id: ev.id,
|
|
26
|
+
name: ev.name,
|
|
27
|
+
use: ev,
|
|
28
|
+
result,
|
|
29
|
+
status,
|
|
30
|
+
expanded: overrides[ev.id] ?? defaultExpanded,
|
|
31
|
+
renderProps: { status, name: ev.name, args: ev.input, result: result?.content, isError: result?.isError ?? false, media: result?.media },
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
return out;
|
|
35
|
+
}, [deduped, defaultExpanded, overrides, runStreaming, runSucceeded]);
|
|
36
|
+
const toggle = useCallback((id) => {
|
|
37
|
+
setOverrides((prev) => ({ ...prev, [id]: !(prev[id] ?? defaultExpanded) }));
|
|
38
|
+
}, [defaultExpanded]);
|
|
39
|
+
const expandAll = useCallback(() => {
|
|
40
|
+
setOverrides(Object.fromEntries(deduped.filter((e) => e.kind === 'tool_use').map((e) => [e.id, true])));
|
|
41
|
+
}, [deduped]);
|
|
42
|
+
const collapseAll = useCallback(() => {
|
|
43
|
+
setOverrides(Object.fromEntries(deduped.filter((e) => e.kind === 'tool_use').map((e) => [e.id, false])));
|
|
44
|
+
}, [deduped]);
|
|
45
|
+
return { rows, toggle, expandAll, collapseAll };
|
|
46
|
+
}
|
|
47
|
+
//# sourceMappingURL=useToolTimeline.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useToolTimeline.js","sourceRoot":"","sources":["../../../src/react/hooks/useToolTimeline.ts"],"names":[],"mappings":"AAAA;;;;;;;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AC,CAAC,CAAC,CAAC;IAC7H,CAAC,EAAE,CAAC,OAAO,CAAC,CAAC,CAAC;IAEd,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,SAAS,EAAE,WAAW,EAAE,CAAC;AAClD,CAAC"}
|
|
@@ -0,0 +1,158 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @jini-ai/chat-react — headless hooks + presentational components + slots for
|
|
3
|
+
* a chat/artifact frontend, built on `@jini-ai/chat/core`'s framework-free
|
|
4
|
+
* vocabulary. See ADS-memory/reports/jini-port/recon/r4b-webui-design.md §1/§2/§4 for the
|
|
5
|
+
* spec this package implements, and source-map.md for provenance.
|
|
6
|
+
*
|
|
7
|
+
* This barrel is filled in incrementally as each layer lands (hooks first,
|
|
8
|
+
* then presentational components, then the `<JiniChatProvider>` composition
|
|
9
|
+
* root) — see source-map.md's "Status" section for what's shipped so far.
|
|
10
|
+
*
|
|
11
|
+
* ## Every export here is explicit. Do not reintroduce `export *`.
|
|
12
|
+
*
|
|
13
|
+
* This file used 15 `export * from` statements until 2026-08-05. That made the package's public
|
|
14
|
+
* API *implicit*: whatever any of those modules happened to export was public, so renaming an
|
|
15
|
+
* internal helper shipped a breaking change nobody reviewed, and no one could read this file and
|
|
16
|
+
* say what the package exports. It is also the likeliest reason consumers reach past this barrel
|
|
17
|
+
* into `@jini-ai/chat/core` deep paths — a grab-bag invites bypassing.
|
|
18
|
+
*
|
|
19
|
+
* The expansion was mechanical and provably surface-preserving: 193 symbols before and after,
|
|
20
|
+
* identical in name AND in value-vs-type kind. `features/chat-pane/index.ts` is the style model.
|
|
21
|
+
*
|
|
22
|
+
* When adding an export, add the name here deliberately. That edit IS the API review.
|
|
23
|
+
*/
|
|
24
|
+
export type { ChatTransport, FeedbackChange, OnFeedback, ReattachRunOptions, RunContext, RunHandlers, StartRunInput, } from '../core/index.js';
|
|
25
|
+
export { RendererRegistry, } from './artifact-types.js';
|
|
26
|
+
export type { ArtifactFile, ArtifactRenderContext, ArtifactRenderMatch, ArtifactRenderer, } from './artifact-types.js';
|
|
27
|
+
export type { AgentOption, AgentSelection, AnalyticsAdapter, AnnotationAdapter, AttachmentTraySlot, ComposerDiscoveryArgument, ComposerDiscoveryGroup, ComposerDiscoveryItem, ComposerDiscoveryOutcome, ComposerDiscoverySelection, ComposerPlusItem, ComposerSlots, FilePreviewSlot, I18nAdapter, MentionResult, MentionSource, ModelAgentPickerSlot, ProjectContextValue, } from './slots.js';
|
|
28
|
+
export { clearToolRenderers, getToolRenderer, registerToolRenderer, } from './tool-renderer-registry.js';
|
|
29
|
+
export type { ToolRenderer, } from './tool-renderer-registry.js';
|
|
30
|
+
export { clearExtEventRenderers, getExtEventRenderer, registerExtEventRenderer, } from './ext-event-renderer-registry.js';
|
|
31
|
+
export type { ExtEventRenderProps, ExtEventRenderer, } from './ext-event-renderer-registry.js';
|
|
32
|
+
/**
|
|
33
|
+
* @deprecated REF-001 Step C (2026-08-05): `ChatPane` and its companions moved to their own
|
|
34
|
+
* subpath, `@jini-ai/chat/react/chat-pane` — import from there in new code. Re-exported here,
|
|
35
|
+
* unchanged, so every existing `import { ChatPane } from '@jini-ai/chat/react'` keeps working.
|
|
36
|
+
* This alias has no removal date scheduled yet; see `chat-pane.ts` for the canonical surface and
|
|
37
|
+
* the module doc there for why the split exists.
|
|
38
|
+
*/
|
|
39
|
+
export { AgentRuntimePicker, CHAT_PANE_AGENT_TOOLS, ChatPane, createDaemonAttachmentUploader, createMcpUiToolCaller, defaultChatPaneSelection, orderChatPaneAgents, resolveChatPaneSelection, useChatPane, useChatPaneAgentControl, useChatPaneRuntimeInventory, useChatPaneWorkingDirectory, } from './chat-pane.js';
|
|
40
|
+
export type { AgentRuntimePickerProps, ByokRuntimeSummary, ChatPaneActivity, ChatPaneAgent, ChatPaneAgentBridgeAccess, ChatPaneAgentControlOptions, ChatPaneAgentOption, ChatPaneAgentSelection, ChatPaneAgentToolAction, ChatPaneAgentToolDef, ChatPaneAgentToolInputSchema, ChatPaneAgentToolRisk, ChatPaneAttachmentUploadOptions, ChatPaneComposerHandle, ChatPaneProps, ChatPaneRunContext, ChatPaneRunContextInput, ChatPaneRuntimeAccess, ChatPaneVariant, ChatPaneWorkingDirectoryAccess, CreateDaemonAttachmentUploaderOptions, CreateMcpUiToolCallerOptions, McpUiToolCallRequest, RuntimePickerPlacement, UseChatPaneAgentControlOptions, UseChatPaneOptions, UseChatPaneResult, UseChatPaneRuntimeInventoryOptions, UseChatPaneRuntimeInventoryResult, UseChatPaneWorkingDirectoryOptions, UseChatPaneWorkingDirectoryResult, } from './chat-pane.js';
|
|
41
|
+
export { useRunStream, } from './hooks/useRunStream.js';
|
|
42
|
+
export type { RunStreamState, RunStreamStatus, StartRunOptions, UseRunStreamResult, } from './hooks/useRunStream.js';
|
|
43
|
+
export { useConversation, } from './hooks/useConversation.js';
|
|
44
|
+
export type { SendMessageOptions, UseConversationOptions, UseConversationResult, } from './hooks/useConversation.js';
|
|
45
|
+
export { useComposer, } from './hooks/useComposer.js';
|
|
46
|
+
export type { ComposerDraftPersistence, MentionPopoverState, UseComposerOptions, UseComposerResult, } from './hooks/useComposer.js';
|
|
47
|
+
export { useToolTimeline, } from './hooks/useToolTimeline.js';
|
|
48
|
+
export type { ToolTimelineRow, UseToolTimelineOptions, UseToolTimelineResult, } from './hooks/useToolTimeline.js';
|
|
49
|
+
export { useExtEventGroups, } from './hooks/useExtEventGroups.js';
|
|
50
|
+
export type { ExtEventGroup, } from './hooks/useExtEventGroups.js';
|
|
51
|
+
export { usePinnedTodos, } from './hooks/usePinnedTodos.js';
|
|
52
|
+
export type { UsePinnedTodosResult, } from './hooks/usePinnedTodos.js';
|
|
53
|
+
export { parseSubmittedAnswers, useQuestionForms, } from './hooks/useQuestionForms.js';
|
|
54
|
+
export type { ParsedQuestionForm, QuestionFormAnswers, UseQuestionFormsResult, } from './hooks/useQuestionForms.js';
|
|
55
|
+
export { useArtifactStream, } from './hooks/useArtifactStream.js';
|
|
56
|
+
export type { ArtifactStreamItem, UseArtifactStreamResult, } from './hooks/useArtifactStream.js';
|
|
57
|
+
export { CHAT_FAB_DRAG_THRESHOLD_PX, CHAT_FAB_EDGE_MARGIN_PX, clampChatFabToViewport, useChatFabDrag, } from './hooks/useChatFabDrag.js';
|
|
58
|
+
export type { ChatFabPosition, UseChatFabDragResult, } from './hooks/useChatFabDrag.js';
|
|
59
|
+
export { useT, useI18n, useAnalytics, useProjectContext, useChatTransport, useArtifactRegistry, } from './hooks/context.js';
|
|
60
|
+
/**
|
|
61
|
+
* REF-001 Step D (2026-08-05): both newly public. `ChatPane`'s own composition already depended
|
|
62
|
+
* on both — `useLatestOperation` for the "only the newest attempt may write state" guard every
|
|
63
|
+
* async hook in this package needs, `definedProps` for collapsing `exactOptionalPropertyTypes`
|
|
64
|
+
* prop-forwarding ternaries — which was itself the finding: a consumer building an equivalent
|
|
65
|
+
* custom async hook or an equivalent prop-forwarding composition could not reach either one, so
|
|
66
|
+
* `ChatPane` was doing something the published API didn't let anyone else do. Both are general
|
|
67
|
+
* building blocks with no `ChatPane`-specific coupling (see each module's own doc), not composition
|
|
68
|
+
* internals, so exporting them is a surface completion, not a leak. See
|
|
69
|
+
* `scripts/check-chatpane-public-surface.ts` (R10) and
|
|
70
|
+
* ADS-memory/reports/refactor/2026-08-05-ref-001-steps-bcd-proposal.md §9.
|
|
71
|
+
*/
|
|
72
|
+
export { normalizeOperationError, useLatestOperation, } from './hooks/useLatestOperation.js';
|
|
73
|
+
export type { LatestOperation, OperationToken, } from './hooks/useLatestOperation.js';
|
|
74
|
+
export { definedProps } from './util/defined-props.js';
|
|
75
|
+
export type { DefinedProps } from './util/defined-props.js';
|
|
76
|
+
/**
|
|
77
|
+
* Newly public for the same R10 reason as `definedProps`/`useLatestOperation` above:
|
|
78
|
+
* `ChatPane`'s `composerHandle.insertText` (see `types.ts`'s `ChatPaneComposerHandle`) joins
|
|
79
|
+
* inserted text onto the existing draft with `appendComposerDiscovery` — the same joining rule the
|
|
80
|
+
* "+" discovery menu's own `insertText` items use, so a host writing into the draft from outside
|
|
81
|
+
* `ChatPane`'s props gets the identical, already-established behavior rather than inventing a
|
|
82
|
+
* second concatenation rule. Zero `ChatPane`-specific coupling (it operates on a plain draft string
|
|
83
|
+
* and an insertion string), so a consumer assembling an equivalent external-insertion feature faced
|
|
84
|
+
* the same problem and could not previously reach this solution either.
|
|
85
|
+
*/
|
|
86
|
+
export { appendComposerDiscovery } from './components/composer-discovery.js';
|
|
87
|
+
/**
|
|
88
|
+
* REF-001 §10 (2026-08-05): newly public, same reasoning as `definedProps`/`useLatestOperation`
|
|
89
|
+
* above. `MessageRow.tsx` (itself public) depends on `interleaveMessageBlocks` to reconstruct an
|
|
90
|
+
* assistant message's original event order — text and tool cards interleaved where they actually
|
|
91
|
+
* happened — from `ChatMessage.content` + `ChatMessage.events` (see `message-blocks.ts`'s own
|
|
92
|
+
* module doc for why this needs computing at all, and when it refuses rather than guesses). Zero
|
|
93
|
+
* `ChatPane`-specific coupling: it operates on core `AgentEvent`/message vocabulary, not anything
|
|
94
|
+
* `ChatPane`-shaped. A consumer building an equivalent custom message-row component, with its own
|
|
95
|
+
* tool-timeline data, faced the identical interleaving problem and could not reach this solution —
|
|
96
|
+
* the same API-gap finding as §9.2, just found one hop further out by §10's transitive-reach trace
|
|
97
|
+
* rather than by `ChatPane`'s own direct imports. See
|
|
98
|
+
* ADS-memory/reports/refactor/2026-08-05-ref-001-steps-bcd-proposal.md §10.2: this export closes
|
|
99
|
+
* the one live instance §10 found of R10's documented transitive-reach scope limit.
|
|
100
|
+
*/
|
|
101
|
+
export { interleaveMessageBlocks } from './message-blocks.js';
|
|
102
|
+
export type { MessageBlock } from './message-blocks.js';
|
|
103
|
+
export { TodoCard } from './components/TodoCard.js';
|
|
104
|
+
export type { TodoCardProps } from './components/TodoCard.js';
|
|
105
|
+
/**
|
|
106
|
+
* The conversation switcher — new / select / delete / search / rename-on-double-click. Storage
|
|
107
|
+
* agnostic: it takes data plus callbacks, so a host backs it with `@jini-ai/sqlite`'s
|
|
108
|
+
* `ChatHistoryStore`, an HTTP endpoint, or a plain array. Drop it into `ChatPane`'s
|
|
109
|
+
* `leadingAccessory` slot; it needs no changes to `ChatPane` itself.
|
|
110
|
+
*/
|
|
111
|
+
export { ConversationList } from './components/ConversationList.js';
|
|
112
|
+
export type { ConversationListProps, ConversationListItem } from './components/ConversationList.js';
|
|
113
|
+
export { ToolCard } from './components/ToolCard.js';
|
|
114
|
+
export type { ToolCardProps } from './components/ToolCard.js';
|
|
115
|
+
export { A2uiSurfaceCard } from './components/A2uiSurfaceCard.js';
|
|
116
|
+
export type { A2uiAgentActionOutcome, A2uiSurfaceCardProps } from './components/A2uiSurfaceCard.js';
|
|
117
|
+
/**
|
|
118
|
+
* Moved from `@jini-ai/ui`'s `react/mcp-ui/` 2026-08-03 (see `McpUiSurfaceCard.tsx`'s own file
|
|
119
|
+
* doc) — the same `kind: 'ext'` extensibility seam as `A2uiSurfaceCard` above, just for MCP-UI
|
|
120
|
+
* resources instead of A2UI surfaces.
|
|
121
|
+
*/
|
|
122
|
+
export { McpUiSurfaceCard, registerMcpUiSurfaceRenderer, MCP_UI_EXT_EVENT_NAME } from './components/McpUiSurfaceCard.js';
|
|
123
|
+
export type { McpUiSurfaceCardProps } from './components/McpUiSurfaceCard.js';
|
|
124
|
+
export { ExtEventErrorBoundary } from './components/ExtEventErrorBoundary.js';
|
|
125
|
+
export type { ExtEventErrorBoundaryProps } from './components/ExtEventErrorBoundary.js';
|
|
126
|
+
export { QuestionForm } from './components/QuestionForm.js';
|
|
127
|
+
export type { QuestionFormProps, QuestionFormHandle, QuestionFormFileSubmission } from './components/QuestionForm.js';
|
|
128
|
+
export { QuestionsPanel } from './components/QuestionsPanel.js';
|
|
129
|
+
export type { QuestionsPanelProps } from './components/QuestionsPanel.js';
|
|
130
|
+
export { NextStepActions } from './components/NextStepActions.js';
|
|
131
|
+
export type { NextStepAction, NextStepActionsProps } from './components/NextStepActions.js';
|
|
132
|
+
export { Markdown } from './components/Markdown.js';
|
|
133
|
+
export type { MarkdownProps } from './components/Markdown.js';
|
|
134
|
+
export { MessageRow } from './components/MessageRow.js';
|
|
135
|
+
export type { MessageRowProps } from './components/MessageRow.js';
|
|
136
|
+
export { MessageList } from './components/MessageList.js';
|
|
137
|
+
export type { MessageListProps } from './components/MessageList.js';
|
|
138
|
+
export { Composer } from './components/Composer.js';
|
|
139
|
+
export type { ComposerProps } from './components/Composer.js';
|
|
140
|
+
export { AttachmentTray } from './components/AttachmentTray.js';
|
|
141
|
+
export type { AttachmentTrayProps } from './components/AttachmentTray.js';
|
|
142
|
+
export { ChatFab } from './components/ChatFab.js';
|
|
143
|
+
export type { ChatFabProps } from './components/ChatFab.js';
|
|
144
|
+
export { JiniChatProvider, useJiniChatSlots, useOnFeedback } from './components/JiniChatProvider.js';
|
|
145
|
+
export type { JiniChatProviderProps, JiniChatSlots } from './components/JiniChatProvider.js';
|
|
146
|
+
/**
|
|
147
|
+
* Agent bridge — the browser half of daemon-relayed frontend control.
|
|
148
|
+
*
|
|
149
|
+
* Lives here rather than in an example because a consumer cannot copy-paste its way to a
|
|
150
|
+
* transport: this is the piece that makes `ChatPaneAgentBridgeAccess` satisfiable at all.
|
|
151
|
+
*
|
|
152
|
+
* `createDomPageDriver`/`currentAgentPage` moved to `@jini-ai/agentic/dom` in the 2026-07-26
|
|
153
|
+
* extraction — re-exported here so existing `@jini-ai/chat-react` importers keep working.
|
|
154
|
+
*/
|
|
155
|
+
export { createFrontendSessionBridge } from './agent-bridge/frontend-session-bridge.js';
|
|
156
|
+
export type { FrontendSessionBridge, FrontendSessionBridgeOptions, } from './agent-bridge/frontend-session-bridge.js';
|
|
157
|
+
export { createDomPageDriver, currentAgentPage, type DomPageDriverOptions } from '@jini-ai/agentic/dom';
|
|
158
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/react/index.ts"],"names":[],"mappings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