@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,"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,CAAC;AAC5F,CAAC"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @module question-form/format
|
|
3
|
+
*
|
|
4
|
+
* Answer presentation: turning a submitted answer set into the prose the
|
|
5
|
+
* agent reads on its next turn, plus the label/value lookups also used by
|
|
6
|
+
* `normalize.ts`'s default-value resolution. Split out of the original
|
|
7
|
+
* single-file `question-form.ts`; see `../question-form.ts` for the public
|
|
8
|
+
* facade.
|
|
9
|
+
*/
|
|
10
|
+
import type { FormOption, QuestionForm } from './types.js';
|
|
11
|
+
/**
|
|
12
|
+
* Format a finished set of answers into a prose user message the agent can
|
|
13
|
+
* read on its next turn. The shape is stable enough that the agent can
|
|
14
|
+
* recognize "the form was answered" without any structured wrapper.
|
|
15
|
+
*
|
|
16
|
+
* @complexity O(q) in the number of questions on the form.
|
|
17
|
+
*/
|
|
18
|
+
export declare function formatFormAnswers(form: QuestionForm, answers: Record<string, string | string[]>): string;
|
|
19
|
+
/** Resolve a submitted answer value back to its display label, or the value itself when unmatched. */
|
|
20
|
+
export declare function formOptionLabelForValue(question: {
|
|
21
|
+
options?: FormOption[] | undefined;
|
|
22
|
+
}, value: string): string;
|
|
23
|
+
/** Resolve a label or value to the canonical option `value`, or the input itself when unmatched. */
|
|
24
|
+
export declare function formOptionValueForLabel(question: {
|
|
25
|
+
options?: FormOption[] | undefined;
|
|
26
|
+
}, labelOrValue: string): string;
|
|
27
|
+
//# sourceMappingURL=format.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"format.d.ts","sourceRoot":"","sources":["../../../src/core/question-form/format.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AACH,OAAO,KAAK,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAE3D;;;;;;GAMG;AACH,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,YAAY,EAAE,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC,GAAG,MAAM,CAgBxG;AASD,sGAAsG;AACtG,wBAAgB,uBAAuB,CAAC,QAAQ,EAAE;IAAE,OAAO,CAAC,EAAE,UAAU,EAAE,GAAG,SAAS,CAAA;CAAE,EAAE,KAAK,EAAE,MAAM,GAAG,MAAM,CAG/G;AAED,oGAAoG;AACpG,wBAAgB,uBAAuB,CAAC,QAAQ,EAAE;IAAE,OAAO,CAAC,EAAE,UAAU,EAAE,GAAG,SAAS,CAAA;CAAE,EAAE,YAAY,EAAE,MAAM,GAAG,MAAM,CAGtH"}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Format a finished set of answers into a prose user message the agent can
|
|
3
|
+
* read on its next turn. The shape is stable enough that the agent can
|
|
4
|
+
* recognize "the form was answered" without any structured wrapper.
|
|
5
|
+
*
|
|
6
|
+
* @complexity O(q) in the number of questions on the form.
|
|
7
|
+
*/
|
|
8
|
+
export function formatFormAnswers(form, answers) {
|
|
9
|
+
const lines = [];
|
|
10
|
+
lines.push(`[form answers — ${form.id}]`);
|
|
11
|
+
for (const q of form.questions) {
|
|
12
|
+
const v = answers[q.id];
|
|
13
|
+
let display;
|
|
14
|
+
if (Array.isArray(v)) {
|
|
15
|
+
display = v.length > 0 ? v.map((value) => formOptionDisplayForValue(q, value)).join(', ') : '(skipped)';
|
|
16
|
+
}
|
|
17
|
+
else if (typeof v === 'string') {
|
|
18
|
+
display = v.trim().length > 0 ? formOptionDisplayForValue(q, v.trim()) : '(skipped)';
|
|
19
|
+
}
|
|
20
|
+
else {
|
|
21
|
+
display = '(skipped)';
|
|
22
|
+
}
|
|
23
|
+
lines.push(`- ${q.label}: ${display}`);
|
|
24
|
+
}
|
|
25
|
+
return lines.join('\n');
|
|
26
|
+
}
|
|
27
|
+
function formOptionDisplayForValue(question, value) {
|
|
28
|
+
const match = question.options?.find((option) => option.value === value || option.label === value);
|
|
29
|
+
if (!match)
|
|
30
|
+
return value;
|
|
31
|
+
if (match.value === match.label)
|
|
32
|
+
return match.label;
|
|
33
|
+
return `${match.label} [value: ${match.value}]`;
|
|
34
|
+
}
|
|
35
|
+
/** Resolve a submitted answer value back to its display label, or the value itself when unmatched. */
|
|
36
|
+
export function formOptionLabelForValue(question, value) {
|
|
37
|
+
const match = question.options?.find((option) => option.value === value || option.label === value);
|
|
38
|
+
return match?.label ?? value;
|
|
39
|
+
}
|
|
40
|
+
/** Resolve a label or value to the canonical option `value`, or the input itself when unmatched. */
|
|
41
|
+
export function formOptionValueForLabel(question, labelOrValue) {
|
|
42
|
+
const match = question.options?.find((option) => option.value === labelOrValue || option.label === labelOrValue);
|
|
43
|
+
return match?.value ?? labelOrValue;
|
|
44
|
+
}
|
|
45
|
+
//# sourceMappingURL=format.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"format.js","sourceRoot":"","sources":["../../../src/core/question-form/format.ts"],"names":[],"mappings":"AAWA;;;;;;GAMG;AACH,MAAM,UAAU,iBAAiB,CAAC,IAAkB,EAAE,OAA0C;IAC9F,MAAM,KAAK,GAAa,EAAE,CAAC;IAC3B,KAAK,CAAC,IAAI,CAAC,mBAAmB,IAAI,CAAC,EAAE,GAAG,CAAC,CAAC;IAC1C,KAAK,MAAM,CAAC,IAAI,IAAI,CAAC,SAAS,EAAE,CAAC;QAC/B,MAAM,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC;QACxB,IAAI,OAAe,CAAC;QACpB,IAAI,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,CAAC;YACrB,OAAO,GAAG,CAAC,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,yBAAyB,CAAC,CAAC,EAAE,KAAK,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,WAAW,CAAC;QAC1G,CAAC;aAAM,IAAI,OAAO,CAAC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AM,KAAK,GAAG,QAAQ,CAAC,OAAO,EAAE,IAAI,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM,CAAC,KAAK,KAAK,YAAY,IAAI,MAAM,CAAC,KAAK,KAAK,YAAY,CAAC,CAAC;IACjH,OAAO,KAAK,EAAE,KAAK,IAAI,YAAY,CAAC;AACtC,CAAC"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @module question-form/normalize
|
|
3
|
+
*
|
|
4
|
+
* Normalization of a raw (already-JSON-parsed) question object into this
|
|
5
|
+
* package's stable `FormQuestion`/`DirectionCard` shape — tolerant of the
|
|
6
|
+
* looser vocabulary a model tends to emit (`"multi"` for `checkbox`,
|
|
7
|
+
* `"default"` for `defaultValue`, etc). Split out of the original
|
|
8
|
+
* single-file `question-form.ts`; see `../question-form.ts` for the public
|
|
9
|
+
* facade and `./scan.ts` for the caller that turns raw JSON into these
|
|
10
|
+
* question objects.
|
|
11
|
+
*/
|
|
12
|
+
import type { FormQuestion } from './types.js';
|
|
13
|
+
export declare function mapRawQuestion(q: unknown, index: number): FormQuestion | null;
|
|
14
|
+
/**
|
|
15
|
+
* Whether a model-supplied palette entry may be written into a CSS value.
|
|
16
|
+
*
|
|
17
|
+
* `palette` reaches `QuestionForm`'s swatch as `style={{ background: c }}`, and `background` is a
|
|
18
|
+
* SHORTHAND — it accepts far more than a colour. An agent (or anything that can influence one)
|
|
19
|
+
* emitting `url(https://attacker.example/pixel)` therefore got the browser to issue a request the
|
|
20
|
+
* moment the card rendered: a tracking beacon inside the chat transcript, needing no click. Neither
|
|
21
|
+
* React nor the CSSOM filters this; React passes style values through, and the CSSOM happily
|
|
22
|
+
* accepts a valid shorthand.
|
|
23
|
+
*
|
|
24
|
+
* Enforced HERE rather than at the swatch, because this is the normalization boundary and the
|
|
25
|
+
* component is not the only thing that could ever read `palette`. An entry that fails is DROPPED
|
|
26
|
+
* rather than substituted: a silently recoloured swatch would misrepresent the agent's proposal,
|
|
27
|
+
* and a card with fewer swatches is honest about what survived validation.
|
|
28
|
+
*/
|
|
29
|
+
export declare function isRenderableColor(value: string): boolean;
|
|
30
|
+
//# sourceMappingURL=normalize.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"normalize.d.ts","sourceRoot":"","sources":["../../../src/core/question-form/normalize.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AACH,OAAO,KAAK,EAA6B,YAAY,EAAgB,MAAM,YAAY,CAAC;AAGxF,wBAAgB,cAAc,CAAC,CAAC,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,GAAG,YAAY,GAAG,IAAI,CA6C7E;AA0FD;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAMxD"}
|
|
@@ -0,0 +1,192 @@
|
|
|
1
|
+
import { formOptionValueForLabel } from './format.js';
|
|
2
|
+
export function mapRawQuestion(q, index) {
|
|
3
|
+
if (!q || typeof q !== 'object')
|
|
4
|
+
return null;
|
|
5
|
+
const qo = q;
|
|
6
|
+
const id = typeof qo.id === 'string' && qo.id.trim().length > 0 ? qo.id.trim() : `q${index + 1}`;
|
|
7
|
+
const label = typeof qo.label === 'string' ? qo.label : id;
|
|
8
|
+
const type = normalizeType(qo.type);
|
|
9
|
+
const options = parseOptions(qo.options);
|
|
10
|
+
const placeholder = typeof qo.placeholder === 'string' ? qo.placeholder : undefined;
|
|
11
|
+
const help = typeof qo.help === 'string' ? qo.help : undefined;
|
|
12
|
+
const required = qo.required === true;
|
|
13
|
+
const maxSelections = typeof qo.maxSelections === 'number' && Number.isInteger(qo.maxSelections) && qo.maxSelections > 0
|
|
14
|
+
? qo.maxSelections
|
|
15
|
+
: undefined;
|
|
16
|
+
const cards = parseDirectionCards(qo.cards);
|
|
17
|
+
const defaultValue = parseDefaultValue(qo, options);
|
|
18
|
+
const allowCustom = qo.allowCustom === false ? false : qo.allowCustom === true || qo.custom === true ? true : undefined;
|
|
19
|
+
const customLabel = typeof qo.customLabel === 'string' ? qo.customLabel : undefined;
|
|
20
|
+
const customPlaceholder = typeof qo.customPlaceholder === 'string' ? qo.customPlaceholder : undefined;
|
|
21
|
+
const min = parseNumberAttr(qo.min);
|
|
22
|
+
const max = parseNumberAttr(qo.max);
|
|
23
|
+
const step = parseNumberAttr(qo.step);
|
|
24
|
+
const multiple = qo.multiple === true;
|
|
25
|
+
const accept = typeof qo.accept === 'string' ? qo.accept : undefined;
|
|
26
|
+
return {
|
|
27
|
+
id,
|
|
28
|
+
label,
|
|
29
|
+
type,
|
|
30
|
+
...(options ? { options } : {}),
|
|
31
|
+
...(placeholder ? { placeholder } : {}),
|
|
32
|
+
...(help ? { help } : {}),
|
|
33
|
+
...(required ? { required } : {}),
|
|
34
|
+
...(defaultValue !== undefined ? { defaultValue } : {}),
|
|
35
|
+
...(maxSelections !== undefined && type === 'checkbox' ? { maxSelections } : {}),
|
|
36
|
+
...(allowCustom !== undefined ? { allowCustom } : {}),
|
|
37
|
+
...(customLabel ? { customLabel } : {}),
|
|
38
|
+
...(customPlaceholder ? { customPlaceholder } : {}),
|
|
39
|
+
...(min !== undefined ? { min } : {}),
|
|
40
|
+
...(max !== undefined ? { max } : {}),
|
|
41
|
+
...(step !== undefined ? { step } : {}),
|
|
42
|
+
...(multiple && type === 'file' ? { multiple } : {}),
|
|
43
|
+
...(accept && type === 'file' ? { accept } : {}),
|
|
44
|
+
...(cards ? { cards } : {}),
|
|
45
|
+
};
|
|
46
|
+
}
|
|
47
|
+
function normalizeType(raw) {
|
|
48
|
+
if (typeof raw !== 'string')
|
|
49
|
+
return 'text';
|
|
50
|
+
const lower = raw.toLowerCase().trim();
|
|
51
|
+
if (lower === 'radio' || lower === 'single' || lower === 'choice')
|
|
52
|
+
return 'radio';
|
|
53
|
+
if (lower === 'checkbox' || lower === 'multi' || lower === 'multiple')
|
|
54
|
+
return 'checkbox';
|
|
55
|
+
if (lower === 'select' || lower === 'dropdown')
|
|
56
|
+
return 'select';
|
|
57
|
+
if (lower === 'textarea' || lower === 'long' || lower === 'paragraph')
|
|
58
|
+
return 'textarea';
|
|
59
|
+
if (lower === 'number' || lower === 'numeric')
|
|
60
|
+
return 'number';
|
|
61
|
+
if (lower === 'range' || lower === 'slider')
|
|
62
|
+
return 'range';
|
|
63
|
+
if (lower === 'date')
|
|
64
|
+
return 'date';
|
|
65
|
+
if (lower === 'time')
|
|
66
|
+
return 'time';
|
|
67
|
+
if (lower === 'datetime-local' || lower === 'datetime' || lower === 'date-time' || lower === 'datetime_local') {
|
|
68
|
+
return 'datetime-local';
|
|
69
|
+
}
|
|
70
|
+
if (lower === 'color' || lower === 'colour' || lower === 'color-picker')
|
|
71
|
+
return 'color';
|
|
72
|
+
if (lower === 'url' || lower === 'link')
|
|
73
|
+
return 'url';
|
|
74
|
+
if (lower === 'email')
|
|
75
|
+
return 'email';
|
|
76
|
+
if (lower === 'tel' || lower === 'phone')
|
|
77
|
+
return 'tel';
|
|
78
|
+
if (lower === 'file' || lower === 'upload' || lower === 'attachment')
|
|
79
|
+
return 'file';
|
|
80
|
+
if (lower === 'switch' || lower === 'toggle' || lower === 'boolean')
|
|
81
|
+
return 'switch';
|
|
82
|
+
if (lower === 'direction-cards' || lower === 'directions' || lower === 'cards' || lower === 'direction') {
|
|
83
|
+
return 'direction-cards';
|
|
84
|
+
}
|
|
85
|
+
return 'text';
|
|
86
|
+
}
|
|
87
|
+
function parseNumberAttr(raw) {
|
|
88
|
+
if (typeof raw === 'number' && Number.isFinite(raw))
|
|
89
|
+
return raw;
|
|
90
|
+
if (typeof raw !== 'string')
|
|
91
|
+
return undefined;
|
|
92
|
+
const n = Number(raw);
|
|
93
|
+
return Number.isFinite(n) ? n : undefined;
|
|
94
|
+
}
|
|
95
|
+
function parseOptions(raw) {
|
|
96
|
+
if (!Array.isArray(raw))
|
|
97
|
+
return undefined;
|
|
98
|
+
const options = raw.map(parseOption).filter((option) => option !== null);
|
|
99
|
+
return options.length > 0 ? options : undefined;
|
|
100
|
+
}
|
|
101
|
+
function parseOption(raw) {
|
|
102
|
+
if (typeof raw === 'string') {
|
|
103
|
+
const label = raw.trim();
|
|
104
|
+
return label.length > 0 ? { label, value: label } : null;
|
|
105
|
+
}
|
|
106
|
+
if (!raw || typeof raw !== 'object')
|
|
107
|
+
return null;
|
|
108
|
+
const obj = raw;
|
|
109
|
+
const label = typeof obj.label === 'string' ? obj.label.trim() : '';
|
|
110
|
+
if (label.length === 0)
|
|
111
|
+
return null;
|
|
112
|
+
const value = typeof obj.value === 'string' && obj.value.trim().length > 0 ? obj.value.trim() : label;
|
|
113
|
+
const description = typeof obj.description === 'string' && obj.description.trim().length > 0 ? obj.description.trim() : undefined;
|
|
114
|
+
return {
|
|
115
|
+
label,
|
|
116
|
+
value,
|
|
117
|
+
...(description ? { description } : {}),
|
|
118
|
+
};
|
|
119
|
+
}
|
|
120
|
+
function parseDefaultValue(question, options) {
|
|
121
|
+
const raw = typeof question.defaultValue === 'string' || Array.isArray(question.defaultValue)
|
|
122
|
+
? question.defaultValue
|
|
123
|
+
: typeof question.defaultValue === 'number' || typeof question.defaultValue === 'boolean'
|
|
124
|
+
? String(question.defaultValue)
|
|
125
|
+
: typeof question.default === 'string'
|
|
126
|
+
? question.default
|
|
127
|
+
: typeof question.default === 'number' || typeof question.default === 'boolean'
|
|
128
|
+
? String(question.default)
|
|
129
|
+
: undefined;
|
|
130
|
+
if (typeof raw === 'string')
|
|
131
|
+
return formOptionValueForLabel({ options }, raw);
|
|
132
|
+
if (Array.isArray(raw)) {
|
|
133
|
+
return raw.filter((value) => typeof value === 'string').map((value) => formOptionValueForLabel({ options }, value));
|
|
134
|
+
}
|
|
135
|
+
return undefined;
|
|
136
|
+
}
|
|
137
|
+
/** `#rgb`, `#rgba`, `#rrggbb`, `#rrggbbaa`. */
|
|
138
|
+
const HEX_COLOR = /^#(?:[0-9a-f]{3,4}|[0-9a-f]{6}|[0-9a-f]{8})$/i;
|
|
139
|
+
/** A bare CSS colour keyword. Letters only — with no parenthesis it cannot become a function call. */
|
|
140
|
+
const COLOR_KEYWORD = /^[a-z]+$/i;
|
|
141
|
+
/**
|
|
142
|
+
* A colour function. The argument charset deliberately excludes `(`, so no nested function —
|
|
143
|
+
* `var()`, `url()`, `image-set()`, `attr()` — can appear inside one of these either.
|
|
144
|
+
*/
|
|
145
|
+
const COLOR_FUNCTION = /^(?:rgb|rgba|hsl|hsla|hwb|lab|lch|oklab|oklch|color)\(\s*[0-9a-z%.,/\s+-]*\)$/i;
|
|
146
|
+
/**
|
|
147
|
+
* Whether a model-supplied palette entry may be written into a CSS value.
|
|
148
|
+
*
|
|
149
|
+
* `palette` reaches `QuestionForm`'s swatch as `style={{ background: c }}`, and `background` is a
|
|
150
|
+
* SHORTHAND — it accepts far more than a colour. An agent (or anything that can influence one)
|
|
151
|
+
* emitting `url(https://attacker.example/pixel)` therefore got the browser to issue a request the
|
|
152
|
+
* moment the card rendered: a tracking beacon inside the chat transcript, needing no click. Neither
|
|
153
|
+
* React nor the CSSOM filters this; React passes style values through, and the CSSOM happily
|
|
154
|
+
* accepts a valid shorthand.
|
|
155
|
+
*
|
|
156
|
+
* Enforced HERE rather than at the swatch, because this is the normalization boundary and the
|
|
157
|
+
* component is not the only thing that could ever read `palette`. An entry that fails is DROPPED
|
|
158
|
+
* rather than substituted: a silently recoloured swatch would misrepresent the agent's proposal,
|
|
159
|
+
* and a card with fewer swatches is honest about what survived validation.
|
|
160
|
+
*/
|
|
161
|
+
export function isRenderableColor(value) {
|
|
162
|
+
const candidate = value.trim();
|
|
163
|
+
// Bounded before any regex runs: these come from model output, and the function pattern's `\s*`
|
|
164
|
+
// plus a character class is the shape that makes a pathological input worth not accepting at all.
|
|
165
|
+
if (candidate.length === 0 || candidate.length > 64)
|
|
166
|
+
return false;
|
|
167
|
+
return HEX_COLOR.test(candidate) || COLOR_KEYWORD.test(candidate) || COLOR_FUNCTION.test(candidate);
|
|
168
|
+
}
|
|
169
|
+
function parseDirectionCards(raw) {
|
|
170
|
+
if (!Array.isArray(raw))
|
|
171
|
+
return undefined;
|
|
172
|
+
const out = [];
|
|
173
|
+
for (const entry of raw) {
|
|
174
|
+
if (!entry || typeof entry !== 'object')
|
|
175
|
+
continue;
|
|
176
|
+
const e = entry;
|
|
177
|
+
const id = typeof e.id === 'string' && e.id.trim().length > 0 ? e.id.trim() : null;
|
|
178
|
+
const label = typeof e.label === 'string' ? e.label : null;
|
|
179
|
+
if (id === null || label === null)
|
|
180
|
+
continue;
|
|
181
|
+
const mood = typeof e.mood === 'string' ? e.mood : '';
|
|
182
|
+
const references = Array.isArray(e.references) ? e.references.filter((r) => typeof r === 'string').slice(0, 6) : [];
|
|
183
|
+
const palette = Array.isArray(e.palette)
|
|
184
|
+
? e.palette.filter((p) => typeof p === 'string' && isRenderableColor(p)).slice(0, 8)
|
|
185
|
+
: [];
|
|
186
|
+
const displayFont = typeof e.displayFont === 'string' ? e.displayFont : 'Georgia, serif';
|
|
187
|
+
const bodyFont = typeof e.bodyFont === 'string' ? e.bodyFont : '-apple-system, system-ui, sans-serif';
|
|
188
|
+
out.push({ id, label, mood, references, palette, displayFont, bodyFont });
|
|
189
|
+
}
|
|
190
|
+
return out.length > 0 ? out : undefined;
|
|
191
|
+
}
|
|
192
|
+
//# sourceMappingURL=normalize.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"normalize.js","sourceRoot":"","sources":["../../../src/core/question-form/normalize.ts"],"names":[],"mappings":"AAYA,OAAO,EAAE,uBAAuB,EAAE,MAAM,aAAa,CAAC;AAEtD,MAAM,UAAU,cAAc,CAAC,CAAU,EAAE,KAAa;IACtD,IAAI,CAAC,CAAC,IAAI,OAAO,CAAC,KAAK,QAAQ;QAAE,OAAO,IAAI,CAAC;IAC7C,MAAM,EAAE,GAAG,CAA4B,CAAC;IACxC,MAAM,EAAE,GAAG,OAAO,EAAE,CAAC,EAAE,KAAK,QAAQ,IAAI,EAAE,CAAC,EAA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C;QACjI,MAAM,OAAO,GAAG,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,OAAO,CAAC;YACtC,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,EAAe,EAAE,CAAC,OAAO,CAAC,KAAK,QAAQ,IAAI,iBAAiB,CAAC,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC;YACjG,CAAC,CAAC,EAAE,CAAC;QACP,MAAM,WAAW,GAAG,OAAO,CAAC,CAAC,WAAW,KAAK,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,gBAAgB,CAAC;QACzF,MAAM,QAAQ,GAAG,OAAO,CAAC,CAAC,QAAQ,KAAK,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,sCAAsC,CAAC;QACtG,GAAG,CAAC,IAAI,CAAC,EAAE,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,UAAU,EAAE,OAAO,EAAE,WAAW,EAAE,QAAQ,EAAE,CAAC,CAAC;IAC5E,CAAC;IACD,OAAO,GAAG,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,SAAS,CAAC;AAC1C,CAAC"}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import type { FormSegment, QuestionForm } from './types.js';
|
|
2
|
+
/**
|
|
3
|
+
* Split `input` into ordered prose/form segments. Scans repeatedly for
|
|
4
|
+
* `question-form`/`ask-question` opens; for each, locates the matching close
|
|
5
|
+
* tag and tries to parse the JSON body. A block that doesn't parse cleanly,
|
|
6
|
+
* or has no close tag yet, is left in the prose stream verbatim.
|
|
7
|
+
*
|
|
8
|
+
* @complexity O(n) amortized in `input.length` — each iteration advances the
|
|
9
|
+
* cursor past the segment it just emitted.
|
|
10
|
+
*/
|
|
11
|
+
export declare function splitOnQuestionForms(input: string): FormSegment[];
|
|
12
|
+
/** The first complete, parseable `<question-form>` in `input`, or `null`. */
|
|
13
|
+
export declare function findFirstQuestionForm(input: string): {
|
|
14
|
+
form: QuestionForm;
|
|
15
|
+
raw: string;
|
|
16
|
+
} | null;
|
|
17
|
+
/**
|
|
18
|
+
* Convenience wrapper over {@link findFirstQuestionForm} matching the
|
|
19
|
+
* `parseQuestionForm()` name from the target API — returns just the form
|
|
20
|
+
* (dropping the matched raw text), or `null` when `input` has no complete
|
|
21
|
+
* question-form block. For a still-streaming block use
|
|
22
|
+
* {@link parsePartialQuestionForm} instead.
|
|
23
|
+
*/
|
|
24
|
+
export declare function parseQuestionForm(input: string): QuestionForm | null;
|
|
25
|
+
/**
|
|
26
|
+
* Drop a trailing, not-yet-closed question-form block from streaming text so
|
|
27
|
+
* a chat surface doesn't flash raw `<question-form>{…` markup before the
|
|
28
|
+
* JSON finishes. Returns the visible text plus whether such an open block
|
|
29
|
+
* existed (meaning a form is mid-generation).
|
|
30
|
+
*/
|
|
31
|
+
export declare function stripTrailingOpenQuestionForm(input: string): {
|
|
32
|
+
text: string;
|
|
33
|
+
hadOpenForm: boolean;
|
|
34
|
+
};
|
|
35
|
+
/** `true` when a question-form open tag is present but its close tag hasn't streamed in yet. */
|
|
36
|
+
export declare function hasUnterminatedQuestionForm(input: string): boolean;
|
|
37
|
+
/**
|
|
38
|
+
* Tolerant parser for a still-streaming `<question-form>` block. Unlike
|
|
39
|
+
* {@link tryParseForm} it does not require valid, complete JSON: it reads the
|
|
40
|
+
* title/id from the open tag's attrs (available the instant the tag streams
|
|
41
|
+
* in) and extracts however many *complete* question objects have arrived so
|
|
42
|
+
* far, so a Questions panel can render a frame immediately and fill
|
|
43
|
+
* questions in progressively. Returns `null` only when no open tag is
|
|
44
|
+
* present at all.
|
|
45
|
+
*
|
|
46
|
+
* @complexity O(n) in `input.length` (one regex scan plus a linear
|
|
47
|
+
* string-aware brace walk via {@link parsePartialJson}).
|
|
48
|
+
*/
|
|
49
|
+
export declare function parsePartialQuestionForm(input: string): QuestionForm | null;
|
|
50
|
+
//# sourceMappingURL=scan.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"scan.d.ts","sourceRoot":"","sources":["../../../src/core/question-form/scan.ts"],"names":[],"mappings":"AAaA,OAAO,KAAK,EAAgB,WAAW,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAiB1E;;;;;;;;GAQG;AACH,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,MAAM,GAAG,WAAW,EAAE,CAoCjE;AAED,6EAA6E;AAC7E,wBAAgB,qBAAqB,CAAC,KAAK,EAAE,MAAM,GAAG;IAAE,IAAI,EAAE,YAAY,CAAC;IAAC,GAAG,EAAE,MAAM,CAAA;CAAE,GAAG,IAAI,CAK/F;AAED;;;;;;GAMG;AACH,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,MAAM,GAAG,YAAY,GAAG,IAAI,CAEpE;AAED;;;;;GAKG;AACH,wBAAgB,6BAA6B,CAAC,KAAK,EAAE,MAAM,GAAG;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,WAAW,EAAE,OAAO,CAAA;CAAE,CAiBnG;AAED,gGAAgG;AAChG,wBAAgB,2BAA2B,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAElE;AAoDD;;;;;;;;;;;GAWG;AACH,wBAAgB,wBAAwB,CAAC,KAAK,EAAE,MAAM,GAAG,YAAY,GAAG,IAAI,CAoC3E"}
|