@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,112 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Remove the first real `<artifact …>…</artifact>` block from `content`.
|
|
3
|
+
*
|
|
4
|
+
* "Real" excludes any `<artifact` substring that a Markdown-rendering chat
|
|
5
|
+
* surface would render as inline code or part of a fenced code block —
|
|
6
|
+
* those are literal recitations of the protocol and must survive intact,
|
|
7
|
+
* otherwise a rendered reply gets silently truncated mid-explanation.
|
|
8
|
+
*
|
|
9
|
+
* If no real open tag exists, `content` is returned unchanged. If a real
|
|
10
|
+
* open exists but no matching real close is found, `content` is also
|
|
11
|
+
* returned unchanged (refusing to strip is safer than truncating to
|
|
12
|
+
* end-of-string when a tag is malformed or still streaming).
|
|
13
|
+
*
|
|
14
|
+
* @complexity O(n) in `content.length` — one skip-range computation plus a
|
|
15
|
+
* pair of linear scans for the open/close tags.
|
|
16
|
+
*/
|
|
17
|
+
export declare function stripArtifact(content: string): string;
|
|
18
|
+
/**
|
|
19
|
+
* Display-only cleanup for a fallback shape some models emit: a complete
|
|
20
|
+
* HTML document as a standalone reply, or as a single ```html fenced block,
|
|
21
|
+
* instead of using the `<artifact>` protocol. A host that persists that
|
|
22
|
+
* recovered document as a real file (see `resolvePersistedArtifactHtml` in
|
|
23
|
+
* `./recover.js`) uses this helper to remove the now-duplicate raw document
|
|
24
|
+
* from the rendered chat bubble.
|
|
25
|
+
*
|
|
26
|
+
* Must never be used to rewrite the canonical stored message content — only
|
|
27
|
+
* the *display* copy — because that content is the transcript future agent
|
|
28
|
+
* turns and forked conversations read from.
|
|
29
|
+
*
|
|
30
|
+
* @complexity O(n) in `content.length` (plus one bounded regex scan over `sourceText` for the fence-recovery path).
|
|
31
|
+
*/
|
|
32
|
+
export declare function stripRecoveredHtmlFallbackForDisplay(content: string, sourceText?: string): string;
|
|
33
|
+
/**
|
|
34
|
+
* A persisted file a host confirms an artifact save wrote to storage.
|
|
35
|
+
* `identifier` is the artifact manifest's `metadata.identifier` when present
|
|
36
|
+
* — the strongest link, since it survives a collision-suffix rename that
|
|
37
|
+
* would break a name-only match.
|
|
38
|
+
*/
|
|
39
|
+
export interface PersistedArtifactFileRef {
|
|
40
|
+
name: string;
|
|
41
|
+
identifier?: string;
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* Find the persisted file this artifact block was saved to, or `null` when
|
|
45
|
+
* persistence cannot be confirmed. Match order: manifest identifier first
|
|
46
|
+
* (strongest — survives collision-suffix renames), then the derived
|
|
47
|
+
* `<slug><ext>` / `<slug>-<n><ext>` file name.
|
|
48
|
+
*
|
|
49
|
+
* @complexity O(m) in `persistedFiles.length` (linear `find`s).
|
|
50
|
+
*/
|
|
51
|
+
export declare function matchPersistedArtifactFile(attrs: Record<string, string>, persistedFiles: ReadonlyArray<PersistedArtifactFileRef>): PersistedArtifactFileRef | null;
|
|
52
|
+
/**
|
|
53
|
+
* Replace every real `<artifact …>…</artifact>` block whose body is
|
|
54
|
+
* CONFIRMED persisted to a file with a one-line summary, for use in a
|
|
55
|
+
* multi-turn transcript sent back to the agent.
|
|
56
|
+
*
|
|
57
|
+
* Once an artifact lives on disk, an agent reads/edits it from there, never
|
|
58
|
+
* from a transcript copy, so re-sending the whole body every turn is pure
|
|
59
|
+
* waste — a large artifact balloons every subsequent turn's input. The
|
|
60
|
+
* summary keeps the metadata the agent needs (`identifier`/`title`/`type`
|
|
61
|
+
* plus the saved file name) and points it at the on-disk file.
|
|
62
|
+
*
|
|
63
|
+
* Persistence is confirmed against `persistedFiles` — evidence a host
|
|
64
|
+
* derives from its own per-turn file-write bookkeeping (see
|
|
65
|
+
* {@link import('../transcript.js').buildTranscript}'s
|
|
66
|
+
* `resolvePersistedArtifactFiles` option). A save can fail validation or a
|
|
67
|
+
* write, in which case the transcript copy is the ONLY surviving artifact
|
|
68
|
+
* body — an unmatched block is left verbatim so a follow-up turn can still
|
|
69
|
+
* inspect or repair it.
|
|
70
|
+
*
|
|
71
|
+
* Uses the same skip-range / real-open detection as {@link stripArtifact},
|
|
72
|
+
* so a literal `<artifact …>` recited inside a code fence is left intact —
|
|
73
|
+
* only genuine protocol blocks are summarized. Malformed / still-streaming
|
|
74
|
+
* blocks (real open, no real close) are left untouched.
|
|
75
|
+
*
|
|
76
|
+
* @complexity O(n) in `content.length` across the whole scan (each iteration
|
|
77
|
+
* consumes at least one full artifact block or the remaining tail), times
|
|
78
|
+
* O(m) for the `persistedFiles` lookup per block.
|
|
79
|
+
*/
|
|
80
|
+
export declare function summarizeArtifactsForTranscript(content: string, persistedFiles: ReadonlyArray<PersistedArtifactFileRef>): string;
|
|
81
|
+
export interface StreamingArtifact {
|
|
82
|
+
artifactType: string;
|
|
83
|
+
title: string;
|
|
84
|
+
identifier: string;
|
|
85
|
+
/** The artifact body received so far — raw, possibly mid-token. */
|
|
86
|
+
content: string;
|
|
87
|
+
}
|
|
88
|
+
/**
|
|
89
|
+
* Split `content` around the first real `<artifact …>` whose closing
|
|
90
|
+
* `</artifact>` has NOT yet arrived — i.e. an artifact whose body is still
|
|
91
|
+
* streaming in. Returns the text *before* the open tag as `head` (safe to
|
|
92
|
+
* render as Markdown) and the in-flight artifact as `live`.
|
|
93
|
+
*
|
|
94
|
+
* This is the streaming-display counterpart to {@link stripArtifact}: the
|
|
95
|
+
* stripper removes a *completed* block once `</artifact>` lands, whereas
|
|
96
|
+
* this surfaces the *incomplete* one so a chat surface can show a live
|
|
97
|
+
* preview instead of leaking the raw `<artifact …>` tag plus half-written
|
|
98
|
+
* body as text.
|
|
99
|
+
*
|
|
100
|
+
* Returns `{ head: content, live: null }` when there is no open artifact,
|
|
101
|
+
* when the open tag already has a matching close (defer to the stripper),
|
|
102
|
+
* or when the artifact `type` is a non-text/HTML kind (media artifacts must
|
|
103
|
+
* not render as a code panel). "Real" open detection reuses the same
|
|
104
|
+
* skip-range logic as the stripper.
|
|
105
|
+
*
|
|
106
|
+
* @complexity O(n) in `content.length`.
|
|
107
|
+
*/
|
|
108
|
+
export declare function splitStreamingArtifact(content: string): {
|
|
109
|
+
head: string;
|
|
110
|
+
live: StreamingArtifact | null;
|
|
111
|
+
};
|
|
112
|
+
//# sourceMappingURL=strip.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"strip.d.ts","sourceRoot":"","sources":["../../../src/core/util/strip.ts"],"names":[],"mappings":"AAsDA;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,aAAa,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAcrD;AA0DD;;;;;;;;;;;;;GAaG;AACH,wBAAgB,oCAAoC,CAAC,OAAO,EAAE,MAAM,EAAE,UAAU,SAAU,GAAG,MAAM,CASlG;AAED;;;;;GAKG;AACH,MAAM,WAAW,wBAAwB;IACvC,IAAI,EAAE,MAAM,CAAC;IACb,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAyBD;;;;;;;GAOG;AACH,wBAAgB,0BAA0B,CACxC,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,EAC7B,cAAc,EAAE,aAAa,CAAC,wBAAwB,CAAC,GACtD,wBAAwB,GAAG,IAAI,CAUjC;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,wBAAgB,+BAA+B,CAAC,OAAO,EAAE,MAAM,EAAE,cAAc,EAAE,aAAa,CAAC,wBAAwB,CAAC,GAAG,MAAM,CAqChI;AAUD,MAAM,WAAW,iBAAiB;IAChC,YAAY,EAAE,MAAM,CAAC;IACrB,KAAK,EAAE,MAAM,CAAC;IACd,UAAU,EAAE,MAAM,CAAC;IACnB,mEAAmE;IACnE,OAAO,EAAE,MAAM,CAAC;CACjB;AAED;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAgB,sBAAsB,CAAC,OAAO,EAAE,MAAM,GAAG;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,iBAAiB,GAAG,IAAI,CAAA;CAAE,CAgCxG"}
|
|
@@ -0,0 +1,333 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @module strip
|
|
3
|
+
*
|
|
4
|
+
* Post-stream `<artifact>` removal/summarization and the streaming-display
|
|
5
|
+
* counterpart that surfaces an in-flight (not-yet-closed) artifact block.
|
|
6
|
+
*/
|
|
7
|
+
import { computeSkipRanges, isRealArtifactOpenAt, rangeContains } from './markdown-context.js';
|
|
8
|
+
import { parseQuotedAttrs } from './markup-attributes.js';
|
|
9
|
+
import { recoverHtmlArtifactFromPrecedingDocument, recoverHtmlDocumentFromMarkdownFence, recoverStandaloneHtmlDocument, } from './recover.js';
|
|
10
|
+
const OPEN = '<artifact';
|
|
11
|
+
const CLOSE = '</artifact>';
|
|
12
|
+
const HTML_FENCE_RE = /```(?:html|HTML)\s*\n([\s\S]*?)\n```/g;
|
|
13
|
+
function findUnskipped(content, needle, fromIndex, ranges) {
|
|
14
|
+
let from = fromIndex;
|
|
15
|
+
// `needle` (always `CLOSE`, non-empty) makes `content.indexOf` itself
|
|
16
|
+
// return -1 once `from` runs past `content.length` — the loop always exits
|
|
17
|
+
// through the `idx === -1` check below, so no bounded `while` or trailing
|
|
18
|
+
// fallback return is needed for this to provably terminate.
|
|
19
|
+
for (;;) {
|
|
20
|
+
const idx = content.indexOf(needle, from);
|
|
21
|
+
if (idx === -1)
|
|
22
|
+
return -1;
|
|
23
|
+
if (!rangeContains(ranges, idx))
|
|
24
|
+
return idx;
|
|
25
|
+
from = idx + needle.length;
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
// Like `findUnskipped(OPEN, …)` but also rejects prefix-shared literals like
|
|
29
|
+
// `<artifactual` — only `<artifact` followed by whitespace counts as a real
|
|
30
|
+
// protocol open. Matches the streaming parser's `findOpenTag` real-open guard
|
|
31
|
+
// so the two paths agree on what a renderer will treat as a tag.
|
|
32
|
+
function findRealOpen(content, fromIndex, ranges) {
|
|
33
|
+
let from = fromIndex;
|
|
34
|
+
// Same reasoning as findUnskipped: `OPEN` is a fixed non-empty literal, so
|
|
35
|
+
// `content.indexOf` alone provides the bound safety once `from` runs past
|
|
36
|
+
// `content.length` — no separate bounded `while` is needed.
|
|
37
|
+
for (;;) {
|
|
38
|
+
const idx = content.indexOf(OPEN, from);
|
|
39
|
+
if (idx === -1)
|
|
40
|
+
return -1;
|
|
41
|
+
if (rangeContains(ranges, idx) || !isRealArtifactOpenAt(content, idx)) {
|
|
42
|
+
from = idx + OPEN.length;
|
|
43
|
+
continue;
|
|
44
|
+
}
|
|
45
|
+
return idx;
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* Remove the first real `<artifact …>…</artifact>` block from `content`.
|
|
50
|
+
*
|
|
51
|
+
* "Real" excludes any `<artifact` substring that a Markdown-rendering chat
|
|
52
|
+
* surface would render as inline code or part of a fenced code block —
|
|
53
|
+
* those are literal recitations of the protocol and must survive intact,
|
|
54
|
+
* otherwise a rendered reply gets silently truncated mid-explanation.
|
|
55
|
+
*
|
|
56
|
+
* If no real open tag exists, `content` is returned unchanged. If a real
|
|
57
|
+
* open exists but no matching real close is found, `content` is also
|
|
58
|
+
* returned unchanged (refusing to strip is safer than truncating to
|
|
59
|
+
* end-of-string when a tag is malformed or still streaming).
|
|
60
|
+
*
|
|
61
|
+
* @complexity O(n) in `content.length` — one skip-range computation plus a
|
|
62
|
+
* pair of linear scans for the open/close tags.
|
|
63
|
+
*/
|
|
64
|
+
export function stripArtifact(content) {
|
|
65
|
+
const { ranges: baseRanges, unclosedFenceStart } = computeSkipRanges(content);
|
|
66
|
+
// For complete (non-streaming) content, an unclosed fence renders as a code
|
|
67
|
+
// block extending to end of input — the stripper mirrors that, otherwise a
|
|
68
|
+
// literal `<artifact …>` tucked into a trailing code example (no trailing
|
|
69
|
+
// newline) gets treated as a real protocol tag and eaten.
|
|
70
|
+
const ranges = unclosedFenceStart !== null ? [...baseRanges, [unclosedFenceStart, content.length]] : baseRanges;
|
|
71
|
+
const open = findRealOpen(content, 0, ranges);
|
|
72
|
+
if (open === -1)
|
|
73
|
+
return content;
|
|
74
|
+
const closeTag = content.indexOf('>', open);
|
|
75
|
+
if (closeTag === -1)
|
|
76
|
+
return content;
|
|
77
|
+
const end = findUnskipped(content, CLOSE, closeTag, ranges);
|
|
78
|
+
if (end === -1)
|
|
79
|
+
return content;
|
|
80
|
+
return (content.slice(0, open) + content.slice(end + CLOSE.length)).trim();
|
|
81
|
+
}
|
|
82
|
+
function findSingleRecoverableHtmlFence(content) {
|
|
83
|
+
HTML_FENCE_RE.lastIndex = 0;
|
|
84
|
+
let recovered = null;
|
|
85
|
+
let count = 0;
|
|
86
|
+
let match = HTML_FENCE_RE.exec(content);
|
|
87
|
+
while (match !== null) {
|
|
88
|
+
const html = (match[1] || '').replace(/^/, '').trim();
|
|
89
|
+
if (recoverHtmlDocumentFromMarkdownFence(match[0]) === html) {
|
|
90
|
+
recovered = { start: match.index, end: match.index + match[0].length, html };
|
|
91
|
+
count += 1;
|
|
92
|
+
}
|
|
93
|
+
match = HTML_FENCE_RE.exec(content);
|
|
94
|
+
}
|
|
95
|
+
return count === 1 ? recovered : null;
|
|
96
|
+
}
|
|
97
|
+
function findRecoverablePrecedingHtmlArtifact(sourceText) {
|
|
98
|
+
const { ranges: baseRanges, unclosedFenceStart } = computeSkipRanges(sourceText);
|
|
99
|
+
const ranges = unclosedFenceStart !== null ? [...baseRanges, [unclosedFenceStart, sourceText.length]] : baseRanges;
|
|
100
|
+
let from = 0;
|
|
101
|
+
// `findRealOpen` already returns -1 once `from` runs past `sourceText.length`
|
|
102
|
+
// (it inherits the same `indexOf`-based bound safety), so this loop also
|
|
103
|
+
// always exits through an inner return — no trailing fallback needed.
|
|
104
|
+
for (;;) {
|
|
105
|
+
const open = findRealOpen(sourceText, from, ranges);
|
|
106
|
+
if (open === -1)
|
|
107
|
+
return null;
|
|
108
|
+
const closeTag = sourceText.indexOf('>', open);
|
|
109
|
+
if (closeTag === -1)
|
|
110
|
+
return null;
|
|
111
|
+
const end = findUnskipped(sourceText, CLOSE, closeTag, ranges);
|
|
112
|
+
if (end === -1)
|
|
113
|
+
return null;
|
|
114
|
+
const attrs = parseQuotedAttrs(sourceText.slice(open, closeTag));
|
|
115
|
+
const recovered = recoverHtmlArtifactFromPrecedingDocument({
|
|
116
|
+
artifactHtml: sourceText.slice(closeTag + 1, end),
|
|
117
|
+
identifier: attrs['identifier'],
|
|
118
|
+
sourceText,
|
|
119
|
+
});
|
|
120
|
+
if (recovered)
|
|
121
|
+
return recovered;
|
|
122
|
+
from = end + CLOSE.length;
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
function stripRecoverablePrecedingHtml(content, sourceText) {
|
|
126
|
+
const recovered = findRecoverablePrecedingHtmlArtifact(sourceText);
|
|
127
|
+
if (!recovered)
|
|
128
|
+
return null;
|
|
129
|
+
const start = content.lastIndexOf(recovered);
|
|
130
|
+
if (start === -1)
|
|
131
|
+
return null;
|
|
132
|
+
return `${content.slice(0, start)}${content.slice(start + recovered.length)}`.trim();
|
|
133
|
+
}
|
|
134
|
+
/**
|
|
135
|
+
* Display-only cleanup for a fallback shape some models emit: a complete
|
|
136
|
+
* HTML document as a standalone reply, or as a single ```html fenced block,
|
|
137
|
+
* instead of using the `<artifact>` protocol. A host that persists that
|
|
138
|
+
* recovered document as a real file (see `resolvePersistedArtifactHtml` in
|
|
139
|
+
* `./recover.js`) uses this helper to remove the now-duplicate raw document
|
|
140
|
+
* from the rendered chat bubble.
|
|
141
|
+
*
|
|
142
|
+
* Must never be used to rewrite the canonical stored message content — only
|
|
143
|
+
* the *display* copy — because that content is the transcript future agent
|
|
144
|
+
* turns and forked conversations read from.
|
|
145
|
+
*
|
|
146
|
+
* @complexity O(n) in `content.length` (plus one bounded regex scan over `sourceText` for the fence-recovery path).
|
|
147
|
+
*/
|
|
148
|
+
export function stripRecoveredHtmlFallbackForDisplay(content, sourceText = content) {
|
|
149
|
+
const withoutPrecedingDocument = stripRecoverablePrecedingHtml(content, sourceText);
|
|
150
|
+
if (withoutPrecedingDocument !== null)
|
|
151
|
+
return withoutPrecedingDocument;
|
|
152
|
+
if (recoverStandaloneHtmlDocument(content))
|
|
153
|
+
return '';
|
|
154
|
+
const fence = findSingleRecoverableHtmlFence(content);
|
|
155
|
+
if (!fence)
|
|
156
|
+
return content;
|
|
157
|
+
return `${content.slice(0, fence.start)}${content.slice(fence.end)}`.trim();
|
|
158
|
+
}
|
|
159
|
+
// The on-disk extension a persist path would pick from the artifact's type/identifier.
|
|
160
|
+
function artifactExtensionForAttrs(attrs) {
|
|
161
|
+
const type = (attrs['type'] || '').toLowerCase();
|
|
162
|
+
const identifier = (attrs['identifier'] || '').toLowerCase();
|
|
163
|
+
if (type.includes('tsx') || identifier.endsWith('.tsx'))
|
|
164
|
+
return '.tsx';
|
|
165
|
+
if (type.includes('jsx') || type.includes('react') || identifier.endsWith('.jsx'))
|
|
166
|
+
return '.jsx';
|
|
167
|
+
if (type.includes('css') || identifier.endsWith('.css'))
|
|
168
|
+
return '.css';
|
|
169
|
+
if (type.includes('svg') || identifier.endsWith('.svg'))
|
|
170
|
+
return '.svg';
|
|
171
|
+
if (type.includes('markdown') || type === 'md' || identifier.endsWith('.md'))
|
|
172
|
+
return '.md';
|
|
173
|
+
return '.html';
|
|
174
|
+
}
|
|
175
|
+
// The slug a persist path would derive the file name from.
|
|
176
|
+
function artifactBaseNameForAttrs(attrs) {
|
|
177
|
+
return ((attrs['identifier'] || attrs['title'] || 'artifact')
|
|
178
|
+
.toLowerCase()
|
|
179
|
+
.replace(/[^a-z0-9_-]+/g, '-')
|
|
180
|
+
.replace(/^-+|-+$/g, '')
|
|
181
|
+
.slice(0, 60) || 'artifact');
|
|
182
|
+
}
|
|
183
|
+
/**
|
|
184
|
+
* Find the persisted file this artifact block was saved to, or `null` when
|
|
185
|
+
* persistence cannot be confirmed. Match order: manifest identifier first
|
|
186
|
+
* (strongest — survives collision-suffix renames), then the derived
|
|
187
|
+
* `<slug><ext>` / `<slug>-<n><ext>` file name.
|
|
188
|
+
*
|
|
189
|
+
* @complexity O(m) in `persistedFiles.length` (linear `find`s).
|
|
190
|
+
*/
|
|
191
|
+
export function matchPersistedArtifactFile(attrs, persistedFiles) {
|
|
192
|
+
const identifier = attrs['identifier'] ?? '';
|
|
193
|
+
if (identifier) {
|
|
194
|
+
const byManifest = persistedFiles.find((f) => f.identifier === identifier);
|
|
195
|
+
if (byManifest)
|
|
196
|
+
return byManifest;
|
|
197
|
+
}
|
|
198
|
+
const ext = artifactExtensionForAttrs(attrs);
|
|
199
|
+
const base = artifactBaseNameForAttrs(attrs);
|
|
200
|
+
const namePattern = new RegExp(`^${base.replace(/[.*+?^${}()|[\]\\]/g, '\\$&')}(?:-\\d+)?${ext.replace('.', '\\.')}$`);
|
|
201
|
+
return persistedFiles.find((f) => namePattern.test(f.name)) ?? null;
|
|
202
|
+
}
|
|
203
|
+
/**
|
|
204
|
+
* Replace every real `<artifact …>…</artifact>` block whose body is
|
|
205
|
+
* CONFIRMED persisted to a file with a one-line summary, for use in a
|
|
206
|
+
* multi-turn transcript sent back to the agent.
|
|
207
|
+
*
|
|
208
|
+
* Once an artifact lives on disk, an agent reads/edits it from there, never
|
|
209
|
+
* from a transcript copy, so re-sending the whole body every turn is pure
|
|
210
|
+
* waste — a large artifact balloons every subsequent turn's input. The
|
|
211
|
+
* summary keeps the metadata the agent needs (`identifier`/`title`/`type`
|
|
212
|
+
* plus the saved file name) and points it at the on-disk file.
|
|
213
|
+
*
|
|
214
|
+
* Persistence is confirmed against `persistedFiles` — evidence a host
|
|
215
|
+
* derives from its own per-turn file-write bookkeeping (see
|
|
216
|
+
* {@link import('../transcript.js').buildTranscript}'s
|
|
217
|
+
* `resolvePersistedArtifactFiles` option). A save can fail validation or a
|
|
218
|
+
* write, in which case the transcript copy is the ONLY surviving artifact
|
|
219
|
+
* body — an unmatched block is left verbatim so a follow-up turn can still
|
|
220
|
+
* inspect or repair it.
|
|
221
|
+
*
|
|
222
|
+
* Uses the same skip-range / real-open detection as {@link stripArtifact},
|
|
223
|
+
* so a literal `<artifact …>` recited inside a code fence is left intact —
|
|
224
|
+
* only genuine protocol blocks are summarized. Malformed / still-streaming
|
|
225
|
+
* blocks (real open, no real close) are left untouched.
|
|
226
|
+
*
|
|
227
|
+
* @complexity O(n) in `content.length` across the whole scan (each iteration
|
|
228
|
+
* consumes at least one full artifact block or the remaining tail), times
|
|
229
|
+
* O(m) for the `persistedFiles` lookup per block.
|
|
230
|
+
*/
|
|
231
|
+
export function summarizeArtifactsForTranscript(content, persistedFiles) {
|
|
232
|
+
if (persistedFiles.length === 0)
|
|
233
|
+
return content;
|
|
234
|
+
let result = '';
|
|
235
|
+
let cursor = 0;
|
|
236
|
+
// Recompute skip ranges per iteration against the remaining tail so indices
|
|
237
|
+
// stay valid as we consume the string left to right.
|
|
238
|
+
while (cursor <= content.length) {
|
|
239
|
+
const tail = content.slice(cursor);
|
|
240
|
+
const { ranges: baseRanges, unclosedFenceStart } = computeSkipRanges(tail);
|
|
241
|
+
const ranges = unclosedFenceStart !== null ? [...baseRanges, [unclosedFenceStart, tail.length]] : baseRanges;
|
|
242
|
+
const open = findRealOpen(tail, 0, ranges);
|
|
243
|
+
if (open === -1) {
|
|
244
|
+
result += tail;
|
|
245
|
+
break;
|
|
246
|
+
}
|
|
247
|
+
const gt = tail.indexOf('>', open);
|
|
248
|
+
if (gt === -1) {
|
|
249
|
+
result += tail;
|
|
250
|
+
break;
|
|
251
|
+
}
|
|
252
|
+
const end = findUnskipped(tail, CLOSE, gt, ranges);
|
|
253
|
+
if (end === -1) {
|
|
254
|
+
// Real open but no real close — refuse to summarize (safer than eating
|
|
255
|
+
// to end-of-string on a malformed/streaming tag). Keep the rest as-is.
|
|
256
|
+
result += tail;
|
|
257
|
+
break;
|
|
258
|
+
}
|
|
259
|
+
const attrs = parseQuotedAttrs(tail.slice(open, gt));
|
|
260
|
+
const persisted = matchPersistedArtifactFile(attrs, persistedFiles);
|
|
261
|
+
result += persisted
|
|
262
|
+
? tail.slice(0, open) + artifactTranscriptSummary(attrs, persisted)
|
|
263
|
+
: // Unconfirmed save — the transcript copy may be the only surviving
|
|
264
|
+
// body. Keep the block verbatim and keep scanning past it.
|
|
265
|
+
tail.slice(0, end + CLOSE.length);
|
|
266
|
+
cursor += end + CLOSE.length;
|
|
267
|
+
}
|
|
268
|
+
return result;
|
|
269
|
+
}
|
|
270
|
+
function artifactTranscriptSummary(attrs, persisted) {
|
|
271
|
+
const id = attrs['identifier'] ?? '';
|
|
272
|
+
const title = attrs['title'] ?? '';
|
|
273
|
+
const type = attrs['type'] ?? 'text/html';
|
|
274
|
+
const meta = [id ? `identifier="${id}"` : '', title ? `title="${title}"` : '', `type="${type}"`].filter(Boolean).join(', ');
|
|
275
|
+
return `[artifact emitted on a prior turn — ${meta}. Its full content was saved to the file "${persisted.name}" and is NOT repeated here. Read or modify that file on disk (list/grep the workspace directory if it was since renamed); do not rely on this transcript for its contents.]`;
|
|
276
|
+
}
|
|
277
|
+
/**
|
|
278
|
+
* Split `content` around the first real `<artifact …>` whose closing
|
|
279
|
+
* `</artifact>` has NOT yet arrived — i.e. an artifact whose body is still
|
|
280
|
+
* streaming in. Returns the text *before* the open tag as `head` (safe to
|
|
281
|
+
* render as Markdown) and the in-flight artifact as `live`.
|
|
282
|
+
*
|
|
283
|
+
* This is the streaming-display counterpart to {@link stripArtifact}: the
|
|
284
|
+
* stripper removes a *completed* block once `</artifact>` lands, whereas
|
|
285
|
+
* this surfaces the *incomplete* one so a chat surface can show a live
|
|
286
|
+
* preview instead of leaking the raw `<artifact …>` tag plus half-written
|
|
287
|
+
* body as text.
|
|
288
|
+
*
|
|
289
|
+
* Returns `{ head: content, live: null }` when there is no open artifact,
|
|
290
|
+
* when the open tag already has a matching close (defer to the stripper),
|
|
291
|
+
* or when the artifact `type` is a non-text/HTML kind (media artifacts must
|
|
292
|
+
* not render as a code panel). "Real" open detection reuses the same
|
|
293
|
+
* skip-range logic as the stripper.
|
|
294
|
+
*
|
|
295
|
+
* @complexity O(n) in `content.length`.
|
|
296
|
+
*/
|
|
297
|
+
export function splitStreamingArtifact(content) {
|
|
298
|
+
const { ranges: baseRanges, unclosedFenceStart } = computeSkipRanges(content);
|
|
299
|
+
const ranges = unclosedFenceStart !== null ? [...baseRanges, [unclosedFenceStart, content.length]] : baseRanges;
|
|
300
|
+
const open = findRealOpen(content, 0, ranges);
|
|
301
|
+
if (open === -1)
|
|
302
|
+
return { head: content, live: null };
|
|
303
|
+
const gt = content.indexOf('>', open);
|
|
304
|
+
if (gt === -1) {
|
|
305
|
+
// The open tag's attributes are still streaming — the type/title aren't
|
|
306
|
+
// known yet, but an artifact is starting, so show the box (empty body)
|
|
307
|
+
// and hide the partial `<artifact …` tail from Markdown.
|
|
308
|
+
return {
|
|
309
|
+
head: content.slice(0, open).replace(/\s+$/, ''),
|
|
310
|
+
live: { artifactType: '', title: '', identifier: '', content: '' },
|
|
311
|
+
};
|
|
312
|
+
}
|
|
313
|
+
// A matching close means the block is complete; defer to stripArtifact.
|
|
314
|
+
if (findUnskipped(content, CLOSE, gt, ranges) !== -1)
|
|
315
|
+
return { head: content, live: null };
|
|
316
|
+
const attrs = parseQuotedAttrs(content.slice(open, gt));
|
|
317
|
+
const artifactType = attrs['type'] ?? '';
|
|
318
|
+
// Only HTML/text artifacts read as code. An unknown type (attrs not fully
|
|
319
|
+
// parsed, or omitted) is treated as code-eligible since the dominant case
|
|
320
|
+
// is text/html; media/binary types fall through and render as raw text.
|
|
321
|
+
if (artifactType && !/html|text\//i.test(artifactType))
|
|
322
|
+
return { head: content, live: null };
|
|
323
|
+
return {
|
|
324
|
+
head: content.slice(0, open).replace(/\s+$/, ''),
|
|
325
|
+
live: {
|
|
326
|
+
artifactType,
|
|
327
|
+
title: attrs['title'] ?? '',
|
|
328
|
+
identifier: attrs['identifier'] ?? '',
|
|
329
|
+
content: content.slice(gt + 1),
|
|
330
|
+
},
|
|
331
|
+
};
|
|
332
|
+
}
|
|
333
|
+
//# sourceMappingURL=strip.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"strip.js","sourceRoot":"","sources":["../../../src/core/util/strip.ts"],"names":[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AAC,KAAK,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC,CAAC;IACxD,MAAM,YAAY,GAAG,KAAK,CAAC,MAAM,CAAC,IAAI,EAAE,CAAC;IACzC,0EAA0E;IAC1E,0EAA0E;IAC1E,wEAAwE;IACxE,IAAI,YAAY,IAAI,CAAC,cAAc,CAAC,IAAI,CAAC,YAAY,CAAC;QAAE,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC;IAC7F,OAAO;QACL,IAAI,EAAE,OAAO,CAAC,KAAK,CAAC,CAAC,EAAE,IAAI,CAAC,CAAC,OAAO,CAAC,MAAM,EAAE,EAAE,CAAC;QAChD,IAAI,EAAE;YACJ,YAAY;YACZ,KAAK,EAAE,KAAK,CAAC,OAAO,CAAC,IAAI,EAAE;YAC3B,UAAU,EAAE,KAAK,CAAC,YAAY,CAAC,IAAI,EAAE;YACrC,OAAO,EAAE,OAAO,CAAC,KAAK,CAAC,EAAE,GAAG,CAAC,CAAC;SAC/B;KACF,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
export type ArtifactKind = 'html' | 'deck' | 'react-component' | 'markdown-document' | 'svg' | 'diagram' | 'code-snippet' | 'mini-app' | 'design-system';
|
|
2
|
+
export type ArtifactRendererId = 'html' | 'deck-html' | 'react-component' | 'markdown' | 'svg' | 'diagram' | 'code' | 'mini-app' | 'design-system';
|
|
3
|
+
export type ArtifactExportKind = 'html' | 'pdf' | 'zip' | 'jsx' | 'md' | 'svg' | 'txt';
|
|
4
|
+
export type ArtifactStatus = 'streaming' | 'complete' | 'error';
|
|
5
|
+
/**
|
|
6
|
+
* The sidecar manifest an artifact-producing turn writes alongside its
|
|
7
|
+
* generated file, describing how to render/export it. Generic across
|
|
8
|
+
* artifact kinds — a host's own artifact-file type carries this manifest,
|
|
9
|
+
* not the other way around (see `ArtifactFile` in r4b §2, owned by
|
|
10
|
+
* `@jini-ai/artifacts-react`, not this package).
|
|
11
|
+
*/
|
|
12
|
+
export interface ArtifactManifest {
|
|
13
|
+
version: 1;
|
|
14
|
+
kind: ArtifactKind;
|
|
15
|
+
title: string;
|
|
16
|
+
entry: string;
|
|
17
|
+
renderer: ArtifactRendererId;
|
|
18
|
+
/** Optional for backward compatibility with older manifests; treat missing as `'complete'`. */
|
|
19
|
+
status?: ArtifactStatus | undefined;
|
|
20
|
+
exports: ArtifactExportKind[];
|
|
21
|
+
/** Optional primary-entry hint for multi-file outputs; fall back to renderable-file heuristics when omitted. */
|
|
22
|
+
primary?: string | boolean | undefined;
|
|
23
|
+
/** Reserved for future multi-file artifact packaging; not yet populated by any known generator. */
|
|
24
|
+
supportingFiles?: string[] | undefined;
|
|
25
|
+
createdAt?: string | undefined;
|
|
26
|
+
updatedAt?: string | undefined;
|
|
27
|
+
sourceSkillId?: string | undefined;
|
|
28
|
+
designSystemId?: string | null | undefined;
|
|
29
|
+
metadata?: Record<string, unknown> | undefined;
|
|
30
|
+
}
|
|
31
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/core/util/types.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,YAAY,GACpB,MAAM,GACN,MAAM,GACN,iBAAiB,GACjB,mBAAmB,GACnB,KAAK,GACL,SAAS,GACT,cAAc,GACd,UAAU,GACV,eAAe,CAAC;AAEpB,MAAM,MAAM,kBAAkB,GAC1B,MAAM,GACN,WAAW,GACX,iBAAiB,GACjB,UAAU,GACV,KAAK,GACL,SAAS,GACT,MAAM,GACN,UAAU,GACV,eAAe,CAAC;AAEpB,MAAM,MAAM,kBAAkB,GAAG,MAAM,GAAG,KAAK,GAAG,KAAK,GAAG,KAAK,GAAG,IAAI,GAAG,KAAK,GAAG,KAAK,CAAC;AAEvF,MAAM,MAAM,cAAc,GAAG,WAAW,GAAG,UAAU,GAAG,OAAO,CAAC;AAEhE;;;;;;GAMG;AACH,MAAM,WAAW,gBAAgB;IAC/B,OAAO,EAAE,CAAC,CAAC;IACX,IAAI,EAAE,YAAY,CAAC;IACnB,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,kBAAkB,CAAC;IAC7B,+FAA+F;IAC/F,MAAM,CAAC,EAAE,cAAc,GAAG,SAAS,CAAC;IACpC,OAAO,EAAE,kBAAkB,EAAE,CAAC;IAC9B,gHAAgH;IAChH,OAAO,CAAC,EAAE,MAAM,GAAG,OAAO,GAAG,SAAS,CAAC;IACvC,mGAAmG;IACnG,eAAe,CAAC,EAAE,MAAM,EAAE,GAAG,SAAS,CAAC;IACvC,SAAS,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAC/B,SAAS,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAC/B,aAAa,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IACnC,cAAc,CAAC,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,CAAC;IAC3C,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,SAAS,CAAC;CAChD"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/core/util/types.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @module validate
|
|
3
|
+
*
|
|
4
|
+
* Pre-write structural sniff for AI-emitted HTML artifacts.
|
|
5
|
+
*
|
|
6
|
+
* Defends an HTML-artifact persistence path against the failure mode where a
|
|
7
|
+
* model emits an `<artifact type="text/html">…</artifact>` block whose body
|
|
8
|
+
* is a prose summary instead of a complete document. Without this gate, such
|
|
9
|
+
* content can land on disk as a real `.html` file and pollute a file panel
|
|
10
|
+
* as a phantom artifact tab.
|
|
11
|
+
*
|
|
12
|
+
* Policy (intentionally narrow — false positives here block real saves):
|
|
13
|
+
* - non-empty after trimming BOM and leading whitespace
|
|
14
|
+
* - meets a minimum length threshold
|
|
15
|
+
* - the *first* non-whitespace token is `<!doctype html>` or `<html`
|
|
16
|
+
* (anchored at the start; mid-string mentions of these tags do NOT count —
|
|
17
|
+
* prose like "Updated the <html lang> attribute…" must be rejected)
|
|
18
|
+
* - URL-bearing attributes or CSS `url(...)` / `@import` values do not point
|
|
19
|
+
* at a reserved internal workspace-storage path
|
|
20
|
+
*
|
|
21
|
+
* What this gate is NOT:
|
|
22
|
+
* - It is **not** an HTML linter or validator. Malformed but
|
|
23
|
+
* recognizably document-shaped HTML passes; only content that obviously
|
|
24
|
+
* isn't a document fails. The guarantee is "blocks obvious prose-as-HTML",
|
|
25
|
+
* not "validates well-formed HTML."
|
|
26
|
+
* - It does **not** cover `.jsx`/`.tsx` or any other artifact kind — a caller
|
|
27
|
+
* should only invoke this for an HTML-typed artifact.
|
|
28
|
+
* - It does **not** apply to user-driven file saves through some other path;
|
|
29
|
+
* those may legitimately persist partial drafts.
|
|
30
|
+
*
|
|
31
|
+
* Threshold note: 64 chars rejects minimal empty-body documents like
|
|
32
|
+
* `<!doctype html><html><body></body></html>` (49 chars) — AI-emitted
|
|
33
|
+
* artifacts are expected to be non-trivial deliverables, not test fixtures,
|
|
34
|
+
* so the lower bound favors fewer phantom files over preserving
|
|
35
|
+
* fixture-grade empties.
|
|
36
|
+
*/
|
|
37
|
+
export type HtmlArtifactValidationResult = {
|
|
38
|
+
ok: true;
|
|
39
|
+
} | {
|
|
40
|
+
ok: false;
|
|
41
|
+
reason: string;
|
|
42
|
+
};
|
|
43
|
+
/**
|
|
44
|
+
* Sniff-test whether `content` looks like a complete HTML document rather
|
|
45
|
+
* than prose that happens to mention HTML.
|
|
46
|
+
*
|
|
47
|
+
* @complexity O(n) in `content.length` — a handful of linear regex scans.
|
|
48
|
+
*/
|
|
49
|
+
export declare function validateHtmlArtifact(content: string): HtmlArtifactValidationResult;
|
|
50
|
+
//# sourceMappingURL=validate.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"validate.d.ts","sourceRoot":"","sources":["../../../src/core/util/validate.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmCG;AAcH,MAAM,MAAM,4BAA4B,GAAG;IAAE,EAAE,EAAE,IAAI,CAAA;CAAE,GAAG;IAAE,EAAE,EAAE,KAAK,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,CAAC;AAExF;;;;;GAKG;AACH,wBAAgB,oBAAoB,CAAC,OAAO,EAAE,MAAM,GAAG,4BAA4B,CAelF"}
|