@agent-native/core 0.37.3 → 0.39.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/README.md +19 -6
- package/dist/action.d.ts +60 -2
- package/dist/action.d.ts.map +1 -1
- package/dist/action.js +6 -2
- package/dist/action.js.map +1 -1
- package/dist/agent/production-agent.d.ts +12 -6
- package/dist/agent/production-agent.d.ts.map +1 -1
- package/dist/agent/production-agent.js +161 -11
- package/dist/agent/production-agent.js.map +1 -1
- package/dist/agent/types.d.ts +2 -0
- package/dist/agent/types.d.ts.map +1 -1
- package/dist/agent/types.js.map +1 -1
- package/dist/catalog.json +2 -2
- package/dist/cli/connect.d.ts.map +1 -1
- package/dist/cli/connect.js +15 -0
- package/dist/cli/connect.js.map +1 -1
- package/dist/cli/create.d.ts.map +1 -1
- package/dist/cli/create.js +8 -1
- package/dist/cli/create.js.map +1 -1
- package/dist/cli/index.js +10 -6
- package/dist/cli/index.js.map +1 -1
- package/dist/cli/plan-publish-store.d.ts +52 -0
- package/dist/cli/plan-publish-store.d.ts.map +1 -0
- package/dist/cli/plan-publish-store.js +103 -0
- package/dist/cli/plan-publish-store.js.map +1 -0
- package/dist/cli/skills.d.ts +30 -4
- package/dist/cli/skills.d.ts.map +1 -1
- package/dist/cli/skills.js +1240 -339
- package/dist/cli/skills.js.map +1 -1
- package/dist/cli/templates-meta.js +12 -12
- package/dist/cli/templates-meta.js.map +1 -1
- package/dist/client/AssistantChat.d.ts +3 -1
- package/dist/client/AssistantChat.d.ts.map +1 -1
- package/dist/client/AssistantChat.js +65 -15
- package/dist/client/AssistantChat.js.map +1 -1
- package/dist/client/MultiTabAssistantChat.d.ts.map +1 -1
- package/dist/client/MultiTabAssistantChat.js +20 -2
- package/dist/client/MultiTabAssistantChat.js.map +1 -1
- package/dist/client/agent-chat-adapter.d.ts.map +1 -1
- package/dist/client/agent-chat-adapter.js +12 -0
- package/dist/client/agent-chat-adapter.js.map +1 -1
- package/dist/client/agent-engine-key.d.ts +24 -0
- package/dist/client/agent-engine-key.d.ts.map +1 -0
- package/dist/client/agent-engine-key.js +49 -0
- package/dist/client/agent-engine-key.js.map +1 -0
- package/dist/client/analytics.d.ts.map +1 -1
- package/dist/client/analytics.js +34 -0
- package/dist/client/analytics.js.map +1 -1
- package/dist/client/blocks/BlockView.d.ts +35 -0
- package/dist/client/blocks/BlockView.d.ts.map +1 -0
- package/dist/client/blocks/BlockView.js +45 -0
- package/dist/client/blocks/BlockView.js.map +1 -0
- package/dist/client/blocks/SchemaBlockEditor.d.ts +25 -0
- package/dist/client/blocks/SchemaBlockEditor.d.ts.map +1 -0
- package/dist/client/blocks/SchemaBlockEditor.js +165 -0
- package/dist/client/blocks/SchemaBlockEditor.js.map +1 -0
- package/dist/client/blocks/agent.d.ts +30 -0
- package/dist/client/blocks/agent.d.ts.map +1 -0
- package/dist/client/blocks/agent.js +61 -0
- package/dist/client/blocks/agent.js.map +1 -0
- package/dist/client/blocks/index.d.ts +51 -0
- package/dist/client/blocks/index.d.ts.map +1 -0
- package/dist/client/blocks/index.js +67 -0
- package/dist/client/blocks/index.js.map +1 -0
- package/dist/client/blocks/library/AnnotatedCodeBlock.d.ts +6 -0
- package/dist/client/blocks/library/AnnotatedCodeBlock.d.ts.map +1 -0
- package/dist/client/blocks/library/AnnotatedCodeBlock.js +135 -0
- package/dist/client/blocks/library/AnnotatedCodeBlock.js.map +1 -0
- package/dist/client/blocks/library/ApiEndpointBlock.d.ts +20 -0
- package/dist/client/blocks/library/ApiEndpointBlock.d.ts.map +1 -0
- package/dist/client/blocks/library/ApiEndpointBlock.js +131 -0
- package/dist/client/blocks/library/ApiEndpointBlock.js.map +1 -0
- package/dist/client/blocks/library/DataModelBlock.d.ts +28 -0
- package/dist/client/blocks/library/DataModelBlock.d.ts.map +1 -0
- package/dist/client/blocks/library/DataModelBlock.js +222 -0
- package/dist/client/blocks/library/DataModelBlock.js.map +1 -0
- package/dist/client/blocks/library/DiffBlock.d.ts +6 -0
- package/dist/client/blocks/library/DiffBlock.d.ts.map +1 -0
- package/dist/client/blocks/library/DiffBlock.js +293 -0
- package/dist/client/blocks/library/DiffBlock.js.map +1 -0
- package/dist/client/blocks/library/FileTreeBlock.d.ts +23 -0
- package/dist/client/blocks/library/FileTreeBlock.d.ts.map +1 -0
- package/dist/client/blocks/library/FileTreeBlock.js +225 -0
- package/dist/client/blocks/library/FileTreeBlock.js.map +1 -0
- package/dist/client/blocks/library/JsonExplorerBlock.d.ts +19 -0
- package/dist/client/blocks/library/JsonExplorerBlock.d.ts.map +1 -0
- package/dist/client/blocks/library/JsonExplorerBlock.js +171 -0
- package/dist/client/blocks/library/JsonExplorerBlock.js.map +1 -0
- package/dist/client/blocks/library/MermaidBlock.d.ts +17 -0
- package/dist/client/blocks/library/MermaidBlock.d.ts.map +1 -0
- package/dist/client/blocks/library/MermaidBlock.js +131 -0
- package/dist/client/blocks/library/MermaidBlock.js.map +1 -0
- package/dist/client/blocks/library/OpenApiSpecBlock.d.ts +19 -0
- package/dist/client/blocks/library/OpenApiSpecBlock.d.ts.map +1 -0
- package/dist/client/blocks/library/OpenApiSpecBlock.js +494 -0
- package/dist/client/blocks/library/OpenApiSpecBlock.js.map +1 -0
- package/dist/client/blocks/library/annotated-code.config.d.ts +58 -0
- package/dist/client/blocks/library/annotated-code.config.d.ts.map +1 -0
- package/dist/client/blocks/library/annotated-code.config.js +53 -0
- package/dist/client/blocks/library/annotated-code.config.js.map +1 -0
- package/dist/client/blocks/library/api-endpoint.config.d.ts +71 -0
- package/dist/client/blocks/library/api-endpoint.config.d.ts.map +1 -0
- package/dist/client/blocks/library/api-endpoint.config.js +91 -0
- package/dist/client/blocks/library/api-endpoint.config.js.map +1 -0
- package/dist/client/blocks/library/checklist.config.d.ts +36 -0
- package/dist/client/blocks/library/checklist.config.d.ts.map +1 -0
- package/dist/client/blocks/library/checklist.config.js +25 -0
- package/dist/client/blocks/library/checklist.config.js.map +1 -0
- package/dist/client/blocks/library/checklist.d.ts +26 -0
- package/dist/client/blocks/library/checklist.d.ts.map +1 -0
- package/dist/client/blocks/library/checklist.js +78 -0
- package/dist/client/blocks/library/checklist.js.map +1 -0
- package/dist/client/blocks/library/code-tabs.config.d.ts +36 -0
- package/dist/client/blocks/library/code-tabs.config.d.ts.map +1 -0
- package/dist/client/blocks/library/code-tabs.config.js +30 -0
- package/dist/client/blocks/library/code-tabs.config.js.map +1 -0
- package/dist/client/blocks/library/code-tabs.d.ts +3 -0
- package/dist/client/blocks/library/code-tabs.d.ts.map +1 -0
- package/dist/client/blocks/library/code-tabs.js +165 -0
- package/dist/client/blocks/library/code-tabs.js.map +1 -0
- package/dist/client/blocks/library/data-model.config.d.ts +72 -0
- package/dist/client/blocks/library/data-model.config.d.ts.map +1 -0
- package/dist/client/blocks/library/data-model.config.js +59 -0
- package/dist/client/blocks/library/data-model.config.js.map +1 -0
- package/dist/client/blocks/library/dev-doc-ui.d.ts +49 -0
- package/dist/client/blocks/library/dev-doc-ui.d.ts.map +1 -0
- package/dist/client/blocks/library/dev-doc-ui.js +50 -0
- package/dist/client/blocks/library/dev-doc-ui.js.map +1 -0
- package/dist/client/blocks/library/diff.config.d.ts +41 -0
- package/dist/client/blocks/library/diff.config.d.ts.map +1 -0
- package/dist/client/blocks/library/diff.config.js +34 -0
- package/dist/client/blocks/library/diff.config.js.map +1 -0
- package/dist/client/blocks/library/file-tree.config.d.ts +59 -0
- package/dist/client/blocks/library/file-tree.config.d.ts.map +1 -0
- package/dist/client/blocks/library/file-tree.config.js +45 -0
- package/dist/client/blocks/library/file-tree.config.js.map +1 -0
- package/dist/client/blocks/library/html.config.d.ts +37 -0
- package/dist/client/blocks/library/html.config.d.ts.map +1 -0
- package/dist/client/blocks/library/html.config.js +46 -0
- package/dist/client/blocks/library/html.config.js.map +1 -0
- package/dist/client/blocks/library/html.d.ts +21 -0
- package/dist/client/blocks/library/html.d.ts.map +1 -0
- package/dist/client/blocks/library/html.js +72 -0
- package/dist/client/blocks/library/html.js.map +1 -0
- package/dist/client/blocks/library/json-explorer.config.d.ts +46 -0
- package/dist/client/blocks/library/json-explorer.config.d.ts.map +1 -0
- package/dist/client/blocks/library/json-explorer.config.js +28 -0
- package/dist/client/blocks/library/json-explorer.config.js.map +1 -0
- package/dist/client/blocks/library/mermaid.config.d.ts +32 -0
- package/dist/client/blocks/library/mermaid.config.d.ts.map +1 -0
- package/dist/client/blocks/library/mermaid.config.js +24 -0
- package/dist/client/blocks/library/mermaid.config.js.map +1 -0
- package/dist/client/blocks/library/openapi-spec.config.d.ts +49 -0
- package/dist/client/blocks/library/openapi-spec.config.d.ts.map +1 -0
- package/dist/client/blocks/library/openapi-spec.config.js +24 -0
- package/dist/client/blocks/library/openapi-spec.config.js.map +1 -0
- package/dist/client/blocks/library/server-specs.d.ts +35 -0
- package/dist/client/blocks/library/server-specs.d.ts.map +1 -0
- package/dist/client/blocks/library/server-specs.js +171 -0
- package/dist/client/blocks/library/server-specs.js.map +1 -0
- package/dist/client/blocks/library/specs.d.ts +29 -0
- package/dist/client/blocks/library/specs.d.ts.map +1 -0
- package/dist/client/blocks/library/specs.js +229 -0
- package/dist/client/blocks/library/specs.js.map +1 -0
- package/dist/client/blocks/library/table.config.d.ts +30 -0
- package/dist/client/blocks/library/table.config.d.ts.map +1 -0
- package/dist/client/blocks/library/table.config.js +22 -0
- package/dist/client/blocks/library/table.config.js.map +1 -0
- package/dist/client/blocks/library/table.d.ts +8 -0
- package/dist/client/blocks/library/table.d.ts.map +1 -0
- package/dist/client/blocks/library/table.js +109 -0
- package/dist/client/blocks/library/table.js.map +1 -0
- package/dist/client/blocks/library/tabs.config.d.ts +56 -0
- package/dist/client/blocks/library/tabs.config.d.ts.map +1 -0
- package/dist/client/blocks/library/tabs.config.js +36 -0
- package/dist/client/blocks/library/tabs.config.js.map +1 -0
- package/dist/client/blocks/library/tabs.d.ts +20 -0
- package/dist/client/blocks/library/tabs.d.ts.map +1 -0
- package/dist/client/blocks/library/tabs.js +123 -0
- package/dist/client/blocks/library/tabs.js.map +1 -0
- package/dist/client/blocks/mdx.d.ts +74 -0
- package/dist/client/blocks/mdx.d.ts.map +1 -0
- package/dist/client/blocks/mdx.js +205 -0
- package/dist/client/blocks/mdx.js.map +1 -0
- package/dist/client/blocks/provider.d.ts +25 -0
- package/dist/client/blocks/provider.d.ts.map +1 -0
- package/dist/client/blocks/provider.js +19 -0
- package/dist/client/blocks/provider.js.map +1 -0
- package/dist/client/blocks/registry.d.ts +32 -0
- package/dist/client/blocks/registry.d.ts.map +1 -0
- package/dist/client/blocks/registry.js +65 -0
- package/dist/client/blocks/registry.js.map +1 -0
- package/dist/client/blocks/schema-form/introspect.d.ts +31 -0
- package/dist/client/blocks/schema-form/introspect.d.ts.map +1 -0
- package/dist/client/blocks/schema-form/introspect.js +164 -0
- package/dist/client/blocks/schema-form/introspect.js.map +1 -0
- package/dist/client/blocks/server.d.ts +31 -0
- package/dist/client/blocks/server.d.ts.map +1 -0
- package/dist/client/blocks/server.js +41 -0
- package/dist/client/blocks/server.js.map +1 -0
- package/dist/client/blocks/types.d.ts +252 -0
- package/dist/client/blocks/types.d.ts.map +1 -0
- package/dist/client/blocks/types.js +5 -0
- package/dist/client/blocks/types.js.map +1 -0
- package/dist/client/composer/ComposerPlusMenu.js +10 -1
- package/dist/client/composer/ComposerPlusMenu.js.map +1 -1
- package/dist/client/guided-questions.d.ts +68 -0
- package/dist/client/guided-questions.d.ts.map +1 -1
- package/dist/client/guided-questions.js +158 -3
- package/dist/client/guided-questions.js.map +1 -1
- package/dist/client/index.d.ts +6 -1
- package/dist/client/index.d.ts.map +1 -1
- package/dist/client/index.js +24 -1
- package/dist/client/index.js.map +1 -1
- package/dist/client/rich-markdown-editor/BubbleToolbar.d.ts +37 -0
- package/dist/client/rich-markdown-editor/BubbleToolbar.d.ts.map +1 -0
- package/dist/client/rich-markdown-editor/BubbleToolbar.js +161 -0
- package/dist/client/rich-markdown-editor/BubbleToolbar.js.map +1 -0
- package/dist/client/rich-markdown-editor/DragHandle.d.ts +52 -0
- package/dist/client/rich-markdown-editor/DragHandle.d.ts.map +1 -0
- package/dist/client/rich-markdown-editor/DragHandle.js +403 -0
- package/dist/client/rich-markdown-editor/DragHandle.js.map +1 -0
- package/dist/client/rich-markdown-editor/ImageExtension.d.ts +63 -0
- package/dist/client/rich-markdown-editor/ImageExtension.d.ts.map +1 -0
- package/dist/client/rich-markdown-editor/ImageExtension.js +242 -0
- package/dist/client/rich-markdown-editor/ImageExtension.js.map +1 -0
- package/dist/client/rich-markdown-editor/RegistryBlockNode.d.ts +97 -0
- package/dist/client/rich-markdown-editor/RegistryBlockNode.d.ts.map +1 -0
- package/dist/client/rich-markdown-editor/RegistryBlockNode.js +214 -0
- package/dist/client/rich-markdown-editor/RegistryBlockNode.js.map +1 -0
- package/dist/client/rich-markdown-editor/RichMarkdownEditor.d.ts +51 -0
- package/dist/client/rich-markdown-editor/RichMarkdownEditor.d.ts.map +1 -0
- package/dist/client/rich-markdown-editor/RichMarkdownEditor.js +37 -0
- package/dist/client/rich-markdown-editor/RichMarkdownEditor.js.map +1 -0
- package/dist/client/rich-markdown-editor/RunId.d.ts +28 -0
- package/dist/client/rich-markdown-editor/RunId.d.ts.map +1 -0
- package/dist/client/rich-markdown-editor/RunId.js +60 -0
- package/dist/client/rich-markdown-editor/RunId.js.map +1 -0
- package/dist/client/rich-markdown-editor/SharedRichEditor.d.ts +85 -0
- package/dist/client/rich-markdown-editor/SharedRichEditor.d.ts.map +1 -0
- package/dist/client/rich-markdown-editor/SharedRichEditor.js +130 -0
- package/dist/client/rich-markdown-editor/SharedRichEditor.js.map +1 -0
- package/dist/client/rich-markdown-editor/SlashCommandMenu.d.ts +36 -0
- package/dist/client/rich-markdown-editor/SlashCommandMenu.d.ts.map +1 -0
- package/dist/client/rich-markdown-editor/SlashCommandMenu.js +193 -0
- package/dist/client/rich-markdown-editor/SlashCommandMenu.js.map +1 -0
- package/dist/client/rich-markdown-editor/extensions.d.ts +166 -0
- package/dist/client/rich-markdown-editor/extensions.d.ts.map +1 -0
- package/dist/client/rich-markdown-editor/extensions.js +222 -0
- package/dist/client/rich-markdown-editor/extensions.js.map +1 -0
- package/dist/client/rich-markdown-editor/gfmDoc.d.ts +24 -0
- package/dist/client/rich-markdown-editor/gfmDoc.d.ts.map +1 -0
- package/dist/client/rich-markdown-editor/gfmDoc.js +83 -0
- package/dist/client/rich-markdown-editor/gfmDoc.js.map +1 -0
- package/dist/client/rich-markdown-editor/index.d.ts +14 -0
- package/dist/client/rich-markdown-editor/index.d.ts.map +1 -0
- package/dist/client/rich-markdown-editor/index.js +14 -0
- package/dist/client/rich-markdown-editor/index.js.map +1 -0
- package/dist/client/rich-markdown-editor/registrySlashCommands.d.ts +46 -0
- package/dist/client/rich-markdown-editor/registrySlashCommands.d.ts.map +1 -0
- package/dist/client/rich-markdown-editor/registrySlashCommands.js +13 -0
- package/dist/client/rich-markdown-editor/registrySlashCommands.js.map +1 -0
- package/dist/client/rich-markdown-editor/uploadEditorImage.d.ts +18 -0
- package/dist/client/rich-markdown-editor/uploadEditorImage.d.ts.map +1 -0
- package/dist/client/rich-markdown-editor/uploadEditorImage.js +57 -0
- package/dist/client/rich-markdown-editor/uploadEditorImage.js.map +1 -0
- package/dist/client/rich-markdown-editor/useCollabReconcile.d.ts +91 -0
- package/dist/client/rich-markdown-editor/useCollabReconcile.d.ts.map +1 -0
- package/dist/client/rich-markdown-editor/useCollabReconcile.js +375 -0
- package/dist/client/rich-markdown-editor/useCollabReconcile.js.map +1 -0
- package/dist/client/track.d.ts +25 -0
- package/dist/client/track.d.ts.map +1 -0
- package/dist/client/track.js +53 -0
- package/dist/client/track.js.map +1 -0
- package/dist/client/use-action.d.ts.map +1 -1
- package/dist/client/use-action.js +6 -0
- package/dist/client/use-action.js.map +1 -1
- package/dist/client/use-session.d.ts +3 -2
- package/dist/client/use-session.d.ts.map +1 -1
- package/dist/client/use-session.js +3 -2
- package/dist/client/use-session.js.map +1 -1
- package/dist/deploy/build.d.ts +5 -0
- package/dist/deploy/build.d.ts.map +1 -1
- package/dist/deploy/build.js +67 -1
- package/dist/deploy/build.js.map +1 -1
- package/dist/extensions/schema.d.ts +1 -1
- package/dist/mcp/build-server.d.ts.map +1 -1
- package/dist/mcp/build-server.js +9 -2
- package/dist/mcp/build-server.js.map +1 -1
- package/dist/mcp/server.d.ts +1 -1
- package/dist/mcp/server.d.ts.map +1 -1
- package/dist/mcp/server.js +35 -2
- package/dist/mcp/server.js.map +1 -1
- package/dist/provider-api/index.d.ts +1 -1
- package/dist/provider-api/index.d.ts.map +1 -1
- package/dist/scripts/docs/search.d.ts.map +1 -1
- package/dist/scripts/docs/search.js +5 -2
- package/dist/scripts/docs/search.js.map +1 -1
- package/dist/scripts/runner.d.ts.map +1 -1
- package/dist/scripts/runner.js +16 -3
- package/dist/scripts/runner.js.map +1 -1
- package/dist/server/action-discovery.d.ts.map +1 -1
- package/dist/server/action-discovery.js +2 -0
- package/dist/server/action-discovery.js.map +1 -1
- package/dist/server/action-routes.d.ts.map +1 -1
- package/dist/server/action-routes.js +30 -4
- package/dist/server/action-routes.js.map +1 -1
- package/dist/server/agent-chat-plugin.d.ts.map +1 -1
- package/dist/server/agent-chat-plugin.js +65 -19
- package/dist/server/agent-chat-plugin.js.map +1 -1
- package/dist/server/agent-teams.d.ts.map +1 -1
- package/dist/server/agent-teams.js +8 -1
- package/dist/server/agent-teams.js.map +1 -1
- package/dist/server/agents-bundle.d.ts +27 -1
- package/dist/server/agents-bundle.d.ts.map +1 -1
- package/dist/server/agents-bundle.js +41 -3
- package/dist/server/agents-bundle.js.map +1 -1
- package/dist/server/auth.d.ts.map +1 -1
- package/dist/server/auth.js +76 -3
- package/dist/server/auth.js.map +1 -1
- package/dist/server/core-routes-plugin.d.ts.map +1 -1
- package/dist/server/core-routes-plugin.js +60 -0
- package/dist/server/core-routes-plugin.js.map +1 -1
- package/dist/server/onboarding-html.d.ts.map +1 -1
- package/dist/server/onboarding-html.js +160 -22
- package/dist/server/onboarding-html.js.map +1 -1
- package/dist/server/sentry.d.ts.map +1 -1
- package/dist/server/sentry.js +6 -0
- package/dist/server/sentry.js.map +1 -1
- package/dist/server/social-og-image.d.ts +2 -1
- package/dist/server/social-og-image.d.ts.map +1 -1
- package/dist/server/social-og-image.js +24 -4
- package/dist/server/social-og-image.js.map +1 -1
- package/dist/sharing/schema.d.ts +1 -1
- package/dist/styles/agent-native.css +1 -0
- package/dist/styles/rich-markdown-editor.css +439 -0
- package/dist/templates/default/.agents/skills/actions/SKILL.md +4 -1
- package/dist/templates/default/.agents/skills/security/SKILL.md +13 -4
- package/dist/templates/default/.agents/skills/storing-data/SKILL.md +15 -3
- package/dist/templates/default/AGENTS.md +1 -0
- package/dist/templates/default/DEVELOPING.md +2 -0
- package/dist/templates/workspace-core/.agents/skills/a2a-protocol/SKILL.md +10 -3
- package/dist/templates/workspace-core/.agents/skills/actions/SKILL.md +98 -10
- package/dist/templates/workspace-core/.agents/skills/adding-a-feature/SKILL.md +45 -3
- package/dist/templates/workspace-core/.agents/skills/address-feedback/SKILL.md +2 -0
- package/dist/templates/workspace-core/.agents/skills/authentication/SKILL.md +37 -4
- package/dist/templates/workspace-core/.agents/skills/automations/SKILL.md +9 -4
- package/dist/templates/workspace-core/.agents/skills/capture-learnings/SKILL.md +2 -0
- package/dist/templates/workspace-core/.agents/skills/client-methods/SKILL.md +106 -0
- package/dist/templates/workspace-core/.agents/skills/client-methods/references/legacy-client-fetch-audit-2026-06-03.md +53 -0
- package/dist/templates/workspace-core/.agents/skills/client-side-routing/SKILL.md +2 -0
- package/dist/templates/workspace-core/.agents/skills/context-awareness/SKILL.md +62 -61
- package/dist/templates/workspace-core/.agents/skills/context-xray/SKILL.md +47 -0
- package/dist/templates/workspace-core/.agents/skills/create-skill/SKILL.md +28 -0
- package/dist/templates/workspace-core/.agents/skills/delegate-to-agent/SKILL.md +52 -1
- package/dist/templates/workspace-core/.agents/skills/extension-points/SKILL.md +2 -0
- package/dist/templates/workspace-core/.agents/skills/extensions/SKILL.md +95 -433
- package/dist/templates/workspace-core/.agents/skills/extensions/references/api.md +285 -0
- package/dist/templates/workspace-core/.agents/skills/extensions/references/examples.md +259 -0
- package/dist/templates/workspace-core/.agents/skills/external-agents/SKILL.md +398 -0
- package/dist/templates/workspace-core/.agents/skills/external-agents/references/mcp-apps-embedding.md +157 -0
- package/dist/templates/workspace-core/.agents/skills/frontend-design/SKILL.md +17 -0
- package/dist/templates/workspace-core/.agents/skills/integration-webhooks/SKILL.md +13 -2
- package/dist/templates/workspace-core/.agents/skills/mvp-followup/SKILL.md +51 -0
- package/dist/templates/workspace-core/.agents/skills/observability/SKILL.md +14 -4
- package/dist/templates/workspace-core/.agents/skills/onboarding/SKILL.md +13 -1
- package/dist/templates/workspace-core/.agents/skills/portability/SKILL.md +27 -5
- package/dist/templates/workspace-core/.agents/skills/qa/SKILL.md +24 -8
- package/dist/templates/workspace-core/.agents/skills/real-time-collab/SKILL.md +53 -7
- package/dist/templates/workspace-core/.agents/skills/real-time-sync/SKILL.md +43 -10
- package/dist/templates/workspace-core/.agents/skills/recurring-jobs/SKILL.md +2 -0
- package/dist/templates/workspace-core/.agents/skills/secrets/SKILL.md +43 -14
- package/dist/templates/workspace-core/.agents/skills/security/SKILL.md +50 -1
- package/dist/templates/workspace-core/.agents/skills/self-modifying-code/SKILL.md +4 -2
- package/dist/templates/workspace-core/.agents/skills/server-plugins/SKILL.md +11 -1
- package/dist/templates/workspace-core/.agents/skills/shadcn-ui/SKILL.md +15 -0
- package/dist/templates/workspace-core/.agents/skills/sharing/SKILL.md +5 -1
- package/dist/templates/workspace-core/.agents/skills/storing-data/SKILL.md +48 -19
- package/dist/templates/workspace-core/.agents/skills/tracking/SKILL.md +7 -3
- package/dist/templates/workspace-core/.agents/skills/voice-transcription/SKILL.md +13 -6
- package/dist/templates/workspace-core/.agents/skills/writing-agent-instructions/SKILL.md +236 -0
- package/dist/templates/workspace-core/AGENTS.md +5 -1
- package/dist/templates/workspace-root/AGENTS.md +5 -2
- package/dist/tracking/route.d.ts +43 -0
- package/dist/tracking/route.d.ts.map +1 -0
- package/dist/tracking/route.js +85 -0
- package/dist/tracking/route.js.map +1 -0
- package/dist/vite/client.d.ts.map +1 -1
- package/dist/vite/client.js +15 -0
- package/dist/vite/client.js.map +1 -1
- package/docs/content/a2a-protocol.md +18 -4
- package/docs/content/actions.md +87 -0
- package/docs/content/agent-mentions.md +2 -1
- package/docs/content/authentication.md +2 -1
- package/docs/content/client.md +64 -13
- package/docs/content/cloneable-saas.md +1 -1
- package/docs/content/code-agents-ui.md +17 -11
- package/docs/content/context-awareness.md +23 -28
- package/docs/content/creating-templates.md +1 -1
- package/docs/content/drop-in-agent.md +2 -0
- package/docs/content/getting-started.md +2 -2
- package/docs/content/key-concepts.md +2 -2
- package/docs/content/messaging.md +57 -15
- package/docs/content/migration-workbench.md +1 -1
- package/docs/content/multi-app-workspace.md +1 -1
- package/docs/content/multi-tenancy.md +17 -15
- package/docs/content/real-time-collaboration.md +1 -1
- package/docs/content/recurring-jobs.md +1 -1
- package/docs/content/security.md +2 -2
- package/docs/content/server.md +4 -4
- package/docs/content/skills-guide.md +30 -0
- package/docs/content/template-analytics.md +2 -2
- package/docs/content/template-assets.md +17 -1
- package/docs/content/template-brain.md +2 -2
- package/docs/content/template-calendar.md +1 -1
- package/docs/content/template-clips.md +3 -3
- package/docs/content/template-content.md +2 -2
- package/docs/content/template-design.md +2 -2
- package/docs/content/template-dispatch.md +3 -3
- package/docs/content/template-forms.md +14 -2
- package/docs/content/template-mail.md +1 -3
- package/docs/content/template-plan.md +133 -0
- package/docs/content/template-slides.md +5 -4
- package/docs/content/template-starter.md +4 -4
- package/docs/content/template-videos.md +6 -11
- package/docs/content/tracking.md +21 -1
- package/docs/content/visual-plans.md +74 -0
- package/docs/content/workspace.md +9 -9
- package/package.json +26 -11
- package/src/templates/default/.agents/skills/actions/SKILL.md +4 -1
- package/src/templates/default/.agents/skills/security/SKILL.md +13 -4
- package/src/templates/default/.agents/skills/storing-data/SKILL.md +15 -3
- package/src/templates/default/AGENTS.md +1 -0
- package/src/templates/default/DEVELOPING.md +2 -0
- package/src/templates/workspace-core/.agents/skills/a2a-protocol/SKILL.md +10 -3
- package/src/templates/workspace-core/.agents/skills/actions/SKILL.md +98 -10
- package/src/templates/workspace-core/.agents/skills/adding-a-feature/SKILL.md +45 -3
- package/src/templates/workspace-core/.agents/skills/address-feedback/SKILL.md +2 -0
- package/src/templates/workspace-core/.agents/skills/authentication/SKILL.md +37 -4
- package/src/templates/workspace-core/.agents/skills/automations/SKILL.md +9 -4
- package/src/templates/workspace-core/.agents/skills/capture-learnings/SKILL.md +2 -0
- package/src/templates/workspace-core/.agents/skills/client-methods/SKILL.md +106 -0
- package/src/templates/workspace-core/.agents/skills/client-methods/references/legacy-client-fetch-audit-2026-06-03.md +53 -0
- package/src/templates/workspace-core/.agents/skills/client-side-routing/SKILL.md +2 -0
- package/src/templates/workspace-core/.agents/skills/context-awareness/SKILL.md +62 -61
- package/src/templates/workspace-core/.agents/skills/context-xray/SKILL.md +47 -0
- package/src/templates/workspace-core/.agents/skills/create-skill/SKILL.md +28 -0
- package/src/templates/workspace-core/.agents/skills/delegate-to-agent/SKILL.md +52 -1
- package/src/templates/workspace-core/.agents/skills/extension-points/SKILL.md +2 -0
- package/src/templates/workspace-core/.agents/skills/extensions/SKILL.md +95 -433
- package/src/templates/workspace-core/.agents/skills/extensions/references/api.md +285 -0
- package/src/templates/workspace-core/.agents/skills/extensions/references/examples.md +259 -0
- package/src/templates/workspace-core/.agents/skills/external-agents/SKILL.md +398 -0
- package/src/templates/workspace-core/.agents/skills/external-agents/references/mcp-apps-embedding.md +157 -0
- package/src/templates/workspace-core/.agents/skills/frontend-design/SKILL.md +17 -0
- package/src/templates/workspace-core/.agents/skills/integration-webhooks/SKILL.md +13 -2
- package/src/templates/workspace-core/.agents/skills/mvp-followup/SKILL.md +51 -0
- package/src/templates/workspace-core/.agents/skills/observability/SKILL.md +14 -4
- package/src/templates/workspace-core/.agents/skills/onboarding/SKILL.md +13 -1
- package/src/templates/workspace-core/.agents/skills/portability/SKILL.md +27 -5
- package/src/templates/workspace-core/.agents/skills/qa/SKILL.md +24 -8
- package/src/templates/workspace-core/.agents/skills/real-time-collab/SKILL.md +53 -7
- package/src/templates/workspace-core/.agents/skills/real-time-sync/SKILL.md +43 -10
- package/src/templates/workspace-core/.agents/skills/recurring-jobs/SKILL.md +2 -0
- package/src/templates/workspace-core/.agents/skills/secrets/SKILL.md +43 -14
- package/src/templates/workspace-core/.agents/skills/security/SKILL.md +50 -1
- package/src/templates/workspace-core/.agents/skills/self-modifying-code/SKILL.md +4 -2
- package/src/templates/workspace-core/.agents/skills/server-plugins/SKILL.md +11 -1
- package/src/templates/workspace-core/.agents/skills/shadcn-ui/SKILL.md +15 -0
- package/src/templates/workspace-core/.agents/skills/sharing/SKILL.md +5 -1
- package/src/templates/workspace-core/.agents/skills/storing-data/SKILL.md +48 -19
- package/src/templates/workspace-core/.agents/skills/tracking/SKILL.md +7 -3
- package/src/templates/workspace-core/.agents/skills/voice-transcription/SKILL.md +13 -6
- package/src/templates/workspace-core/.agents/skills/writing-agent-instructions/SKILL.md +236 -0
- package/src/templates/workspace-core/AGENTS.md +5 -1
- package/src/templates/workspace-root/AGENTS.md +5 -2
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Agent engine API-key helpers (browser).
|
|
3
|
+
*
|
|
4
|
+
* Named client helper for storing a bring-your-own provider key (Anthropic,
|
|
5
|
+
* OpenAI, etc.) so the agent chat can run without a Builder connection or an
|
|
6
|
+
* account. The key is persisted by the framework under the matching provider
|
|
7
|
+
* env var (e.g. ANTHROPIC_API_KEY) for the current owner, exactly like the
|
|
8
|
+
* LLM settings panel does — UI code should call this instead of hand-writing
|
|
9
|
+
* a fetch to the framework env-vars route.
|
|
10
|
+
*/
|
|
11
|
+
/** Providers that can be configured with a single pasted API key. */
|
|
12
|
+
export type AgentEngineProvider = "anthropic" | "openai";
|
|
13
|
+
export interface SaveAgentEngineApiKeyOptions {
|
|
14
|
+
provider: AgentEngineProvider;
|
|
15
|
+
apiKey: string;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Persist a provider API key for the current owner. Resolves on success.
|
|
19
|
+
* Throws an Error with a readable message on failure. On success it also
|
|
20
|
+
* dispatches `agent-engine:configured-changed` so any open agent chat flips
|
|
21
|
+
* out of its "needs setup" state without a reload.
|
|
22
|
+
*/
|
|
23
|
+
export declare function saveAgentEngineApiKey({ provider, apiKey, }: SaveAgentEngineApiKeyOptions): Promise<void>;
|
|
24
|
+
//# sourceMappingURL=agent-engine-key.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"agent-engine-key.d.ts","sourceRoot":"","sources":["../../src/client/agent-engine-key.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAIH,qEAAqE;AACrE,MAAM,MAAM,mBAAmB,GAAG,WAAW,GAAG,QAAQ,CAAC;AAUzD,MAAM,WAAW,4BAA4B;IAC3C,QAAQ,EAAE,mBAAmB,CAAC;IAC9B,MAAM,EAAE,MAAM,CAAC;CAChB;AAED;;;;;GAKG;AACH,wBAAsB,qBAAqB,CAAC,EAC1C,QAAQ,EACR,MAAM,GACP,EAAE,4BAA4B,GAAG,OAAO,CAAC,IAAI,CAAC,CA0B9C"}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Agent engine API-key helpers (browser).
|
|
3
|
+
*
|
|
4
|
+
* Named client helper for storing a bring-your-own provider key (Anthropic,
|
|
5
|
+
* OpenAI, etc.) so the agent chat can run without a Builder connection or an
|
|
6
|
+
* account. The key is persisted by the framework under the matching provider
|
|
7
|
+
* env var (e.g. ANTHROPIC_API_KEY) for the current owner, exactly like the
|
|
8
|
+
* LLM settings panel does — UI code should call this instead of hand-writing
|
|
9
|
+
* a fetch to the framework env-vars route.
|
|
10
|
+
*/
|
|
11
|
+
import { agentNativePath } from "./api-path.js";
|
|
12
|
+
const PROVIDER_ENV_VAR = {
|
|
13
|
+
anthropic: "ANTHROPIC_API_KEY",
|
|
14
|
+
openai: "OPENAI_API_KEY",
|
|
15
|
+
};
|
|
16
|
+
/** Event other parts of the agent UI listen for to re-check the LLM gate. */
|
|
17
|
+
const CONFIGURED_CHANGED_EVENT = "agent-engine:configured-changed";
|
|
18
|
+
/**
|
|
19
|
+
* Persist a provider API key for the current owner. Resolves on success.
|
|
20
|
+
* Throws an Error with a readable message on failure. On success it also
|
|
21
|
+
* dispatches `agent-engine:configured-changed` so any open agent chat flips
|
|
22
|
+
* out of its "needs setup" state without a reload.
|
|
23
|
+
*/
|
|
24
|
+
export async function saveAgentEngineApiKey({ provider, apiKey, }) {
|
|
25
|
+
const trimmed = apiKey.trim();
|
|
26
|
+
if (!trimmed) {
|
|
27
|
+
throw new Error("Enter an API key first.");
|
|
28
|
+
}
|
|
29
|
+
const envVar = PROVIDER_ENV_VAR[provider];
|
|
30
|
+
const res = await fetch(agentNativePath("/_agent-native/env-vars"), {
|
|
31
|
+
method: "POST",
|
|
32
|
+
headers: { "Content-Type": "application/json" },
|
|
33
|
+
body: JSON.stringify({ vars: [{ key: envVar, value: trimmed }] }),
|
|
34
|
+
});
|
|
35
|
+
if (!res.ok) {
|
|
36
|
+
const message = await res
|
|
37
|
+
.json()
|
|
38
|
+
.then((body) => body?.error)
|
|
39
|
+
.catch(() => null);
|
|
40
|
+
throw new Error(message ??
|
|
41
|
+
(res.status === 401
|
|
42
|
+
? "Sign in to save a key, or connect Builder instead."
|
|
43
|
+
: `Could not save the key (HTTP ${res.status}).`));
|
|
44
|
+
}
|
|
45
|
+
if (typeof window !== "undefined") {
|
|
46
|
+
window.dispatchEvent(new CustomEvent(CONFIGURED_CHANGED_EVENT));
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
//# sourceMappingURL=agent-engine-key.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"agent-engine-key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CAAC,gCAAgC,GAAG,CAAC,MAAM,IAAI,CAAC,CACtD,CAAC;IACJ,CAAC;IACD,IAAI,OAAO,MAAM,KAAK,WAAW,EAAE,CAAC;QAClC,MAAM,CAAC,aAAa,CAAC,IAAI,WAAW,CAAC,wBAAwB,CAAC,CAAC,CAAC;IAClE,CAAC;AACH,CAAC","sourcesContent":["/**\n * Agent engine API-key helpers (browser).\n *\n * Named client helper for storing a bring-your-own provider key (Anthropic,\n * OpenAI, etc.) so the agent chat can run without a Builder connection or an\n * account. The key is persisted by the framework under the matching provider\n * env var (e.g. ANTHROPIC_API_KEY) for the current owner, exactly like the\n * LLM settings panel does — UI code should call this instead of hand-writing\n * a fetch to the framework env-vars route.\n */\n\nimport { agentNativePath } from \"./api-path.js\";\n\n/** Providers that can be configured with a single pasted API key. */\nexport type AgentEngineProvider = \"anthropic\" | \"openai\";\n\nconst PROVIDER_ENV_VAR: Record<AgentEngineProvider, string> = {\n anthropic: \"ANTHROPIC_API_KEY\",\n openai: \"OPENAI_API_KEY\",\n};\n\n/** Event other parts of the agent UI listen for to re-check the LLM gate. */\nconst CONFIGURED_CHANGED_EVENT = \"agent-engine:configured-changed\";\n\nexport interface SaveAgentEngineApiKeyOptions {\n provider: AgentEngineProvider;\n apiKey: string;\n}\n\n/**\n * Persist a provider API key for the current owner. Resolves on success.\n * Throws an Error with a readable message on failure. On success it also\n * dispatches `agent-engine:configured-changed` so any open agent chat flips\n * out of its \"needs setup\" state without a reload.\n */\nexport async function saveAgentEngineApiKey({\n provider,\n apiKey,\n}: SaveAgentEngineApiKeyOptions): Promise<void> {\n const trimmed = apiKey.trim();\n if (!trimmed) {\n throw new Error(\"Enter an API key first.\");\n }\n const envVar = PROVIDER_ENV_VAR[provider];\n const res = await fetch(agentNativePath(\"/_agent-native/env-vars\"), {\n method: \"POST\",\n headers: { \"Content-Type\": \"application/json\" },\n body: JSON.stringify({ vars: [{ key: envVar, value: trimmed }] }),\n });\n if (!res.ok) {\n const message = await res\n .json()\n .then((body: { error?: string }) => body?.error)\n .catch(() => null);\n throw new Error(\n message ??\n (res.status === 401\n ? \"Sign in to save a key, or connect Builder instead.\"\n : `Could not save the key (HTTP ${res.status}).`),\n );\n }\n if (typeof window !== \"undefined\") {\n window.dispatchEvent(new CustomEvent(CONFIGURED_CHANGED_EVENT));\n }\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"analytics.d.ts","sourceRoot":"","sources":["../../src/client/analytics.ts"],"names":[],"mappings":"AAQA,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAE1C,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,MAAM;QACd,IAAI,CAAC,EAAE,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,IAAI,CAAC;QAChC,uBAAuB,CAAC,EAAE;YACxB,SAAS,CAAC,EAAE,MAAM,CAAC;YACnB,iBAAiB,CAAC,EAAE,MAAM,CAAC;SAC5B,CAAC;KACH;CACF;AAED,KAAK,eAAe,GAAG,CACrB,IAAI,EAAE,MAAM,EACZ,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,KAChC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;AAO7B,KAAK,UAAU,GAAG;IAChB,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB,CAAC;
|
|
1
|
+
{"version":3,"file":"analytics.d.ts","sourceRoot":"","sources":["../../src/client/analytics.ts"],"names":[],"mappings":"AAQA,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAE1C,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,MAAM;QACd,IAAI,CAAC,EAAE,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,IAAI,CAAC;QAChC,uBAAuB,CAAC,EAAE;YACxB,SAAS,CAAC,EAAE,MAAM,CAAC;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MAAM,EAAE,OAAO,CAAC,GAC/B,IAAI,CASN;AAED,wBAAgB,kBAAkB,CAAC,QAAQ,EAAE,OAAO,GAAG,IAAI,CAE1D"}
|
package/dist/client/analytics.js
CHANGED
|
@@ -198,6 +198,40 @@ function shouldDropBrowserSentryNoise(event) {
|
|
|
198
198
|
if (exceptionValues.some((value) => value.type === "AgentAutoContinueSignal")) {
|
|
199
199
|
return true;
|
|
200
200
|
}
|
|
201
|
+
// Browser-side access control rejections usually mean a tab outlived the
|
|
202
|
+
// session or hit a protected route while signed out. The server Sentry setup
|
|
203
|
+
// already drops these bare auth errors; mirror that here for client-captured
|
|
204
|
+
// route/query failures.
|
|
205
|
+
if (exceptionValues.some((value) => {
|
|
206
|
+
const exceptionType = String(value.type ?? "")
|
|
207
|
+
.trim()
|
|
208
|
+
.toLowerCase();
|
|
209
|
+
const exceptionValue = String(value.value ?? "")
|
|
210
|
+
.trim()
|
|
211
|
+
.toLowerCase();
|
|
212
|
+
return (exceptionType === "unauthorizederror" ||
|
|
213
|
+
exceptionType === "unauthenticatederror" ||
|
|
214
|
+
exceptionValue === "unauthorized" ||
|
|
215
|
+
exceptionValue === "unauthenticated");
|
|
216
|
+
})) {
|
|
217
|
+
return true;
|
|
218
|
+
}
|
|
219
|
+
// Exact user/navigation aborts are expected browser behavior. Keep other
|
|
220
|
+
// AbortError shapes visible unless they match this common non-bug message.
|
|
221
|
+
if (exceptionValues.some((value) => {
|
|
222
|
+
const exceptionType = String(value.type ?? "")
|
|
223
|
+
.trim()
|
|
224
|
+
.toLowerCase();
|
|
225
|
+
const exceptionValue = String(value.value ?? "")
|
|
226
|
+
.trim()
|
|
227
|
+
.toLowerCase();
|
|
228
|
+
return (exceptionValue === "the user aborted a request." ||
|
|
229
|
+
exceptionValue === "aborterror: the user aborted a request." ||
|
|
230
|
+
(exceptionType === "aborterror" &&
|
|
231
|
+
exceptionValue.includes("the user aborted a request")));
|
|
232
|
+
})) {
|
|
233
|
+
return true;
|
|
234
|
+
}
|
|
201
235
|
const exceptionText = exceptionValues
|
|
202
236
|
.map((value) => `${value.type ?? ""} ${value.value ?? ""}`)
|
|
203
237
|
.join(" ")
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"analytics.js","sourceRoot":"","sources":["../../src/client/analytics.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,SAAS,MAAM,8BAA8B,CAAC;AAC1D,OAAO,KAAK,MAAM,MAAM,iBAAiB,CAAC;AAC1C,OAAO,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AAChD,OAAO,EACL,+BAA+B,GAEhC,MAAM,6BAA6B,CAAC;AACrC,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAC1C,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AA4B1C,IAAI,gBAAgB,GAA2B,IAAI,CAAC;AACpD,IAAI,qBAAqB,GAAG,KAAK,CAAC;AAClC,IAAI,kBAAkB,GAAG,KAAK,CAAC;AAC/B,IAAI,oBAAoB,GAA+B,IAAI,CAAC;AAC5D,IAAI,qBAAqB,GAAyB,IAAI,CAAC;AACvD,IAAI,8BAA8B,GAAG,KAAK,CAAC;AAC3C,qEAAqE;AACrE,uEAAuE;AACvE,IAAI,kBAAkB,GAAkC,SAAS,CAAC;AAClE,IAAI,mBAAmB,GAA8B,SAAS,CAAC;AAE/D,MAAM,uCAAuC,GAC3C,0CAA0C,CAAC;AAC7C,MAAM,2BAA2B,GAAG,MAAM,CAAC,GAAG,CAC5C,sCAAsC,CACvC,CAAC;AAEF,MAAM,wBAAwB,GAAG,2BAA2B,CAAC;AAC7D,MAAM,sBAAsB,GAAG,yBAAyB,CAAC;AACzD,MAAM,iCAAiC,GAAG,oCAAoC,CAAC;AAC/E,MAAM,0BAA0B,GAAG,oCAAoC,CAAC;AACxE,MAAM,2BAA2B,GAAG,CAAC,GAAG,EAAE,GAAG,IAAI,CAAC;AAClD,2EAA2E;AAC3E,2EAA2E;AAC3E,gCA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U,CACxB,IAAY,EACZ,MAAgC;IAEhC,IAAI,OAAO,MAAM,KAAK,WAAW;QAAE,OAAO;IAC1C,YAAY,EAAE,CAAC;IACf,MAAM,KAAK,GAAG,YAAY,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC;IACzC,MAAM,CAAC,IAAI,EAAE,CAAC,OAAO,EAAE,IAAI,CAAC,OAAO,CAAC,MAAM,EAAE,GAAG,CAAC,EAAE,KAAK,CAAC,CAAC;IACzD,IAAI,eAAe,EAAE,EAAE,CAAC;QACtB,SAAS,CAAC,KAAK,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC;IAC/B,CAAC;IACD,wBAAwB,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC;AACxC,CAAC;AAED,MAAM,UAAU,kBAAkB,CAAC,QAAiB;IAClD,UAAU,CAAC,gBAAgB,EAAE,EAAE,SAAS,EAAE,QAAQ,EAAE,CAAC,CAAC;AACxD,CAAC","sourcesContent":["import * as amplitude from \"@amplitude/analytics-browser\";\nimport * as Sentry from \"@sentry/browser\";\nimport { agentNativePath } from \"./api-path.js\";\nimport {\n llmConnectionTrackingProperties,\n type LlmConnectionStatus,\n} from \"../shared/llm-connection.js\";\nimport { scrubUrl } from \"./url-scrub.js\";\nexport { scrubUrl } from \"./url-scrub.js\";\n\ndeclare global {\n interface Window {\n gtag?: (...args: any[]) => void;\n __AGENT_NATIVE_CONFIG__?: {\n sentryDsn?: string;\n sentryEnvironment?: string;\n };\n }\n}\n\ntype GetDefaultProps = (\n name: string,\n properties: Record<string, unknown>,\n) => Record<string, unknown>;\n\ntype PageviewTrackingState = {\n installed: boolean;\n lastPageviewKey: string | null;\n};\n\ntype SentryUser = {\n id?: string;\n email?: string;\n username?: string;\n};\n\nlet _getDefaultProps: GetDefaultProps | null = null;\nlet _amplitudeInitialized = false;\nlet _sentryInitialized = false;\nlet _llmConnectionStatus: LlmConnectionStatus | null = null;\nlet _llmConnectionRefresh: Promise<void> | null = null;\nlet _llmConnectionRefreshInstalled = false;\n// Buffer for setSentryUser calls made before Sentry has initialized.\n// `undefined` means \"no pending update\"; `null` means \"pending clear\".\nlet _pendingSentryUser: SentryUser | null | undefined = undefined;\nlet _pendingSentryOrgId: string | null | undefined = undefined;\n\nconst AGENT_NATIVE_ANALYTICS_DEFAULT_ENDPOINT =\n \"https://analytics.agent-native.com/track\";\nconst PAGEVIEW_TRACKING_STATE_KEY = Symbol.for(\n \"agent-native.client.pageviewTracking\",\n);\n\nconst ANONYMOUS_ID_STORAGE_KEY = \"agent-native.anonymous_id\";\nconst SESSION_ID_STORAGE_KEY = \"agent-native.session_id\";\nconst SESSION_LAST_ACTIVITY_STORAGE_KEY = \"agent-native.session_last_activity\";\nconst LLM_CONNECTION_STORAGE_KEY = \"agent-native.llm_connection_status\";\nconst LLM_CONNECTION_CACHE_TTL_MS = 5 * 60 * 1000;\n// 30-minute idle timeout matches GA4 / Mixpanel defaults — a tab left open\n// overnight starts a new session in the morning rather than stretching one\n// session over multiple visits.\nconst SESSION_IDLE_TIMEOUT_MS = 30 * 60 * 1000;\n\nfunction generateVisitorId(): string {\n try {\n if (\n typeof crypto !== \"undefined\" &&\n typeof crypto.randomUUID === \"function\"\n ) {\n return crypto.randomUUID();\n }\n } catch {\n // fall through to Math.random\n }\n return (\n Date.now().toString(36) +\n Math.random().toString(36).slice(2) +\n Math.random().toString(36).slice(2)\n );\n}\n\nfunction safeStorageGet(key: string): string | null {\n try {\n return window.localStorage.getItem(key);\n } catch {\n return null;\n }\n}\n\nfunction safeStorageSet(key: string, value: string): void {\n try {\n window.localStorage.setItem(key, value);\n } catch {\n // private browsing / storage disabled — best-effort\n }\n}\n\nfunction readCachedLlmConnectionStatus(): LlmConnectionStatus | null {\n if (typeof window === \"undefined\") return null;\n const raw = safeStorageGet(LLM_CONNECTION_STORAGE_KEY);\n if (!raw) return null;\n try {\n const parsed = JSON.parse(raw) as LlmConnectionStatus & {\n cachedAt?: number;\n };\n if (\n typeof parsed.cachedAt !== \"number\" ||\n Date.now() - parsed.cachedAt > LLM_CONNECTION_CACHE_TTL_MS\n ) {\n return null;\n }\n return {\n configured: parsed.configured,\n engine: parsed.engine,\n model: parsed.model,\n source: parsed.source,\n envVar: parsed.envVar,\n };\n } catch {\n return null;\n }\n}\n\nfunction cacheLlmConnectionStatus(status: LlmConnectionStatus): void {\n if (typeof window === \"undefined\") return;\n safeStorageSet(\n LLM_CONNECTION_STORAGE_KEY,\n JSON.stringify({ ...status, cachedAt: Date.now() }),\n );\n}\n\nfunction normalizeAgentEngineStatus(data: unknown): LlmConnectionStatus {\n const value = data as Record<string, unknown> | null;\n if (!value || value.configured !== true) {\n return { configured: false };\n }\n return {\n configured: true,\n engine: typeof value.engine === \"string\" ? value.engine : null,\n model: typeof value.model === \"string\" ? value.model : null,\n source: typeof value.source === \"string\" ? value.source : null,\n envVar: typeof value.envVar === \"string\" ? value.envVar : null,\n };\n}\n\nfunction refreshLlmConnectionStatus(): Promise<void> {\n if (typeof window === \"undefined\" || typeof fetch !== \"function\") {\n return Promise.resolve();\n }\n if (_llmConnectionRefresh) return _llmConnectionRefresh;\n let request: Promise<Response>;\n try {\n request = fetch(agentNativePath(\"/_agent-native/agent-engine/status\"));\n } catch {\n return Promise.resolve();\n }\n _llmConnectionRefresh = request\n .then((res) => (res.ok ? res.json() : null))\n .then((data) => {\n _llmConnectionStatus = normalizeAgentEngineStatus(data);\n cacheLlmConnectionStatus(_llmConnectionStatus);\n })\n .catch(() => {\n if (!_llmConnectionStatus) {\n _llmConnectionStatus = readCachedLlmConnectionStatus();\n }\n })\n .finally(() => {\n _llmConnectionRefresh = null;\n });\n return _llmConnectionRefresh;\n}\n\nfunction installLlmConnectionRefresh(): void {\n if (typeof window === \"undefined\" || _llmConnectionRefreshInstalled) return;\n _llmConnectionRefreshInstalled = true;\n _llmConnectionStatus = readCachedLlmConnectionStatus();\n void refreshLlmConnectionStatus();\n window.addEventListener(\"focus\", () => {\n void refreshLlmConnectionStatus();\n });\n window.addEventListener(\"agent-engine:configured-changed\", () => {\n void refreshLlmConnectionStatus();\n });\n}\n\nfunction getOrCreateAnonymousId(): string | undefined {\n if (typeof window === \"undefined\") return undefined;\n let id = safeStorageGet(ANONYMOUS_ID_STORAGE_KEY);\n if (!id) {\n id = generateVisitorId();\n safeStorageSet(ANONYMOUS_ID_STORAGE_KEY, id);\n }\n return id;\n}\n\nfunction getOrCreateSessionId(): string | undefined {\n if (typeof window === \"undefined\") return undefined;\n const now = Date.now();\n const lastActivityRaw = safeStorageGet(SESSION_LAST_ACTIVITY_STORAGE_KEY);\n const lastActivity = lastActivityRaw\n ? Number.parseInt(lastActivityRaw, 10)\n : 0;\n let id = safeStorageGet(SESSION_ID_STORAGE_KEY);\n const expired =\n !lastActivity ||\n Number.isNaN(lastActivity) ||\n now - lastActivity > SESSION_IDLE_TIMEOUT_MS;\n if (!id || expired) {\n id = generateVisitorId();\n safeStorageSet(SESSION_ID_STORAGE_KEY, id);\n }\n safeStorageSet(SESSION_LAST_ACTIVITY_STORAGE_KEY, String(now));\n return id;\n}\n\nfunction isLocalAnalyticsHostname(hostname: string | undefined): boolean {\n const h = (hostname || \"\").toLowerCase();\n return (\n h === \"localhost\" ||\n h === \"127.0.0.1\" ||\n h === \"::1\" ||\n h === \"[::1]\" ||\n h.endsWith(\".localhost\") ||\n h.endsWith(\".local\")\n );\n}\n\nfunction ensureAmplitude(): boolean {\n if (_amplitudeInitialized) return true;\n const key = (import.meta.env as Record<string, string | undefined>)\n ?.VITE_AMPLITUDE_API_KEY;\n if (!key) return false;\n amplitude.init(key, { autocapture: true });\n _amplitudeInitialized = true;\n return true;\n}\n\nfunction shouldDropBrowserSentryNoise(event: Sentry.Event): boolean {\n const exceptionValues = event.exception?.values ?? [];\n // AgentAutoContinueSignal is a control-flow sentinel thrown to bubble\n // out of the SSE stream parser when the agent run needs to be\n // auto-continued. It's caught by the chat adapter and is never a real\n // error. Drop it unconditionally — capturing it as a Sentry exception\n // pollutes the issue list with sentinels that have no actionable stack.\n if (\n exceptionValues.some((value) => value.type === \"AgentAutoContinueSignal\")\n ) {\n return true;\n }\n const exceptionText = exceptionValues\n .map((value) => `${value.type ?? \"\"} ${value.value ?? \"\"}`)\n .join(\" \")\n .toLowerCase();\n const requestUrl = event.request?.url?.toLowerCase() ?? \"\";\n const breadcrumbText = (event.breadcrumbs ?? [])\n .map((crumb) => {\n const data = crumb.data as Record<string, unknown> | undefined;\n return [\n crumb.category,\n crumb.message,\n typeof data?.url === \"string\" ? data.url : \"\",\n ].join(\" \");\n })\n .join(\" \")\n .toLowerCase();\n const combined = `${exceptionText} ${requestUrl} ${breadcrumbText}`;\n return (\n combined.includes(\"api2.amplitude.com\") &&\n (combined.includes(\"failed to fetch\") ||\n combined.includes(\"networkerror\") ||\n combined.includes(\"load failed\"))\n );\n}\n\nfunction getClientSentryDsn(): string | undefined {\n const env = (import.meta.env as Record<string, string | undefined>) ?? {};\n return (\n env.VITE_SENTRY_CLIENT_DSN ||\n env.VITE_SENTRY_DSN ||\n window.__AGENT_NATIVE_CONFIG__?.sentryDsn\n );\n}\n\nfunction ensureSentry(): void {\n if (_sentryInitialized) return;\n const dsn = getClientSentryDsn();\n if (!dsn) return;\n Sentry.init({\n dsn,\n environment:\n window.__AGENT_NATIVE_CONFIG__?.sentryEnvironment ||\n (import.meta.env as Record<string, string | undefined>)?.MODE ||\n \"production\",\n beforeSend(event) {\n if (shouldDropBrowserSentryNoise(event)) {\n return null;\n }\n // Strip sensitive query params from the request URL. React Router\n // history can include share tokens, ?signin=1, password reset codes,\n // public-share password params (audit F-07), etc.\n if (event.request?.url) {\n event.request.url = scrubUrl(event.request.url);\n }\n // Clean the same params from breadcrumb URLs (Sentry captures\n // history.pushState breadcrumbs by default).\n if (Array.isArray(event.breadcrumbs)) {\n for (const crumb of event.breadcrumbs) {\n if (crumb && typeof crumb === \"object\" && \"data\" in crumb) {\n const data = crumb.data as Record<string, unknown> | undefined;\n if (data && typeof data.url === \"string\") {\n data.url = scrubUrl(data.url);\n }\n if (data && typeof data.from === \"string\") {\n data.from = scrubUrl(data.from);\n }\n if (data && typeof data.to === \"string\") {\n data.to = scrubUrl(data.to);\n }\n }\n }\n }\n return event;\n },\n });\n Sentry.setTag(\"runtime\", \"browser\");\n _sentryInitialized = true;\n // Flush any user/tag that was set before init.\n if (_pendingSentryUser !== undefined) {\n Sentry.setUser(_pendingSentryUser);\n _pendingSentryUser = undefined;\n }\n if (_pendingSentryOrgId !== undefined) {\n Sentry.setTag(\"orgId\", _pendingSentryOrgId);\n _pendingSentryOrgId = undefined;\n }\n}\n\n/**\n * Attach the current user to Sentry events from the browser. Pass `null` to\n * clear (e.g. on logout). If Sentry isn't initialized yet, the value is\n * buffered and applied once `ensureSentry()` runs.\n *\n * Pass `orgId` to also tag events with the active organization ID — useful\n * for filtering Sentry by tenant.\n */\nexport function setSentryUser(\n user: SentryUser | null,\n orgId?: string | null,\n): void {\n if (_sentryInitialized) {\n Sentry.setUser(user);\n if (orgId !== undefined) {\n Sentry.setTag(\"orgId\", orgId ?? null);\n }\n return;\n }\n _pendingSentryUser = user;\n if (orgId !== undefined) {\n _pendingSentryOrgId = orgId ?? null;\n }\n}\n\nexport interface ClientCaptureContext {\n /** Searchable Sentry tags (low-cardinality strings only). */\n tags?: Record<string, string | undefined>;\n /**\n * High-cardinality / structured payload — not searchable but visible in\n * the Sentry event detail (file sizes, request URLs, response body\n * tails, etc.).\n */\n extra?: Record<string, unknown>;\n /**\n * Grouped contexts shown as separate cards in the Sentry event UI.\n */\n contexts?: Record<string, Record<string, unknown>>;\n}\n\n/**\n * Capture an exception to Sentry from browser code without forcing the\n * caller to depend on `@sentry/browser` directly.\n *\n * Templates can route a thrown Error through here on a known failure path\n * (chunk-upload 500, thumbnail upload, etc.) to attach searchable tags and\n * structured extra context. No-ops gracefully when Sentry isn't\n * initialized — never throws back into the caller, so a Sentry hiccup\n * can't mask the original error.\n */\nexport function captureClientException(\n error: unknown,\n context: ClientCaptureContext = {},\n): string | undefined {\n if (typeof window === \"undefined\") return undefined;\n try {\n ensureSentry();\n return Sentry.withScope((scope) => {\n if (context.tags) {\n for (const [k, v] of Object.entries(context.tags)) {\n if (typeof v === \"string\") scope.setTag(k, v);\n }\n }\n if (context.extra) {\n for (const [k, v] of Object.entries(context.extra)) {\n if (v !== undefined) scope.setExtra(k, v);\n }\n }\n if (context.contexts) {\n for (const [k, v] of Object.entries(context.contexts)) {\n scope.setContext(k, v);\n }\n }\n return Sentry.captureException(error);\n });\n } catch {\n return undefined;\n }\n}\n\n/**\n * Public browser-side error capture utility, mirroring `trackEvent()`:\n * templates can call `captureError(err, { tags, extra, contexts })` without\n * depending on Sentry directly. Sentry receives the event when a browser DSN\n * is configured; otherwise this is a quiet no-op.\n */\nexport function captureError(\n error: unknown,\n context: ClientCaptureContext = {},\n): string | undefined {\n return captureClientException(error, context);\n}\n\nfunction getPageviewTrackingState(): PageviewTrackingState {\n const g = globalThis as typeof globalThis & {\n [PAGEVIEW_TRACKING_STATE_KEY]?: PageviewTrackingState;\n };\n if (!g[PAGEVIEW_TRACKING_STATE_KEY]) {\n g[PAGEVIEW_TRACKING_STATE_KEY] = {\n installed: false,\n lastPageviewKey: null,\n };\n }\n return g[PAGEVIEW_TRACKING_STATE_KEY];\n}\n\nexport function configureTracking(options: {\n getDefaultProps?: GetDefaultProps;\n}): void {\n if (options.getDefaultProps) {\n _getDefaultProps = options.getDefaultProps;\n }\n if (typeof window !== \"undefined\") {\n ensureSentry();\n ensureAmplitude();\n installLlmConnectionRefresh();\n installPageviewTracking();\n }\n}\n\nfunction inferTemplateName(properties: Record<string, unknown>): string | null {\n const envTemplate =\n (import.meta.env as Record<string, string | undefined>)\n ?.VITE_AGENT_NATIVE_TEMPLATE ||\n (import.meta.env as Record<string, string | undefined>)?.VITE_APP_TEMPLATE;\n if (envTemplate) return envTemplate;\n\n const app = typeof properties.app === \"string\" ? properties.app.trim() : \"\";\n if (!app || app === \"localhost\") return null;\n if (app.startsWith(\"agent-native-\")) {\n return app.slice(\"agent-native-\".length);\n }\n return app;\n}\n\nfunction resolveProps(\n name: string,\n params?: Record<string, unknown>,\n): Record<string, unknown> {\n if (typeof window === \"undefined\") return { ...params };\n const base: Record<string, unknown> = {\n url: window.location.origin + window.location.pathname,\n app: window.location.hostname.split(\".\")[0] || \"localhost\",\n ...params,\n };\n const props = _getDefaultProps ? _getDefaultProps(name, base) : base;\n let withTemplate = props;\n if (withTemplate.template === undefined) {\n const template = inferTemplateName(props);\n if (template) {\n withTemplate = { ...props, template };\n }\n }\n const llmProps = llmConnectionTrackingProperties(_llmConnectionStatus);\n const enriched = { ...withTemplate };\n for (const [key, value] of Object.entries(llmProps)) {\n if (enriched[key] === undefined) enriched[key] = value;\n }\n return enriched;\n}\n\nfunction pageviewKey(): string {\n return window.location.href;\n}\n\nfunction pageviewProperties(reason: string): Record<string, unknown> {\n const properties: Record<string, unknown> = {\n url: scrubUrl(window.location.href),\n path: window.location.pathname,\n hostname: window.location.hostname,\n navigation_type: reason,\n };\n if (window.location.search) {\n properties.search = scrubUrl(window.location.search);\n }\n if (typeof document !== \"undefined\") {\n if (document.referrer) {\n properties.referrer = scrubUrl(document.referrer);\n }\n if (document.title) {\n properties.title = document.title;\n }\n }\n return properties;\n}\n\nfunction emitPageview(reason: string): void {\n if (isLocalAnalyticsHostname(window.location.hostname)) return;\n const state = getPageviewTrackingState();\n const key = pageviewKey();\n if (state.lastPageviewKey === key) return;\n state.lastPageviewKey = key;\n trackEvent(\"pageview\", pageviewProperties(reason));\n}\n\nfunction schedulePageview(reason: string): void {\n const run = () => emitPageview(reason);\n if (_llmConnectionRefresh && !_llmConnectionStatus) {\n const timeout = new Promise<void>((resolve) =>\n window.setTimeout(resolve, 250),\n );\n Promise.race([_llmConnectionRefresh, timeout]).finally(run);\n return;\n }\n if (typeof queueMicrotask === \"function\") {\n queueMicrotask(run);\n return;\n }\n window.setTimeout(run, 0);\n}\n\nfunction installPageviewTracking(): void {\n const state = getPageviewTrackingState();\n if (state.installed) return;\n state.installed = true;\n\n schedulePageview(\"load\");\n\n const originalPushState = window.history.pushState;\n const originalReplaceState = window.history.replaceState;\n\n window.history.pushState = function pushState(...args) {\n const result = originalPushState.apply(this, args);\n schedulePageview(\"pushState\");\n return result;\n };\n\n window.history.replaceState = function replaceState(...args) {\n const result = originalReplaceState.apply(this, args);\n schedulePageview(\"replaceState\");\n return result;\n };\n\n window.addEventListener(\"popstate\", () => schedulePageview(\"popstate\"));\n}\n\nfunction sendAgentNativeAnalytics(\n name: string,\n properties: Record<string, unknown>,\n): void {\n if (isLocalAnalyticsHostname(window.location.hostname)) return;\n\n const publicKey = (import.meta.env as Record<string, string | undefined>)\n ?.VITE_AGENT_NATIVE_ANALYTICS_PUBLIC_KEY;\n if (!publicKey) return;\n\n const endpoint =\n (import.meta.env as Record<string, string | undefined>)\n ?.VITE_AGENT_NATIVE_ANALYTICS_ENDPOINT ||\n AGENT_NATIVE_ANALYTICS_DEFAULT_ENDPOINT;\n const userId =\n typeof properties.userId === \"string\" ? properties.userId : undefined;\n const body = JSON.stringify({\n publicKey,\n event: name,\n properties,\n userId,\n anonymousId: getOrCreateAnonymousId(),\n sessionId: getOrCreateSessionId(),\n timestamp: new Date().toISOString(),\n });\n\n try {\n if (navigator.sendBeacon) {\n const sent = navigator.sendBeacon(endpoint, body);\n if (sent) return;\n }\n fetch(endpoint, {\n method: \"POST\",\n body,\n keepalive: true,\n headers: { \"Content-Type\": \"text/plain;charset=UTF-8\" },\n }).catch(() => {});\n } catch {\n // best-effort\n }\n}\n\nexport function trackEvent(\n name: string,\n params?: Record<string, unknown>,\n): void {\n if (typeof window === \"undefined\") return;\n ensureSentry();\n const props = resolveProps(name, params);\n window.gtag?.(\"event\", name.replace(/\\s+/g, \"_\"), props);\n if (ensureAmplitude()) {\n amplitude.track(name, props);\n }\n sendAgentNativeAnalytics(name, props);\n}\n\nexport function trackSessionStatus(signedIn: boolean): void {\n trackEvent(\"session status\", { signed_in: signedIn });\n}\n"]}
|
|
1
|
+
{"version":3,"file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,eAAe,EAAE,EAAE,CAAC;QACtB,SAAS,CAAC,KAAK,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC;IAC/B,CAAC;IACD,wBAAwB,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC;AACxC,CAAC;AAED,MAAM,UAAU,kBAAkB,CAAC,QAAiB;IAClD,UAAU,CAAC,gBAAgB,EAAE,EAAE,SAAS,EAAE,QAAQ,EAAE,CAAC,CAAC;AACxD,CAAC","sourcesContent":["import * as amplitude from \"@amplitude/analytics-browser\";\nimport * as Sentry from \"@sentry/browser\";\nimport { agentNativePath } from \"./api-path.js\";\nimport {\n llmConnectionTrackingProperties,\n type LlmConnectionStatus,\n} from \"../shared/llm-connection.js\";\nimport { scrubUrl } from \"./url-scrub.js\";\nexport { scrubUrl } from \"./url-scrub.js\";\n\ndeclare global {\n interface Window {\n gtag?: (...args: any[]) => void;\n __AGENT_NATIVE_CONFIG__?: {\n sentryDsn?: string;\n sentryEnvironment?: string;\n };\n }\n}\n\ntype GetDefaultProps = (\n name: string,\n properties: Record<string, unknown>,\n) => Record<string, unknown>;\n\ntype PageviewTrackingState = {\n installed: boolean;\n lastPageviewKey: string | null;\n};\n\ntype SentryUser = {\n id?: string;\n email?: string;\n username?: string;\n};\n\nlet _getDefaultProps: GetDefaultProps | null = null;\nlet _amplitudeInitialized = false;\nlet _sentryInitialized = false;\nlet _llmConnectionStatus: LlmConnectionStatus | null = null;\nlet _llmConnectionRefresh: Promise<void> | null = null;\nlet _llmConnectionRefreshInstalled = false;\n// Buffer for setSentryUser calls made before Sentry has initialized.\n// `undefined` means \"no pending update\"; `null` means \"pending clear\".\nlet _pendingSentryUser: SentryUser | null | undefined = undefined;\nlet _pendingSentryOrgId: string | null | undefined = undefined;\n\nconst AGENT_NATIVE_ANALYTICS_DEFAULT_ENDPOINT =\n \"https://analytics.agent-native.com/track\";\nconst PAGEVIEW_TRACKING_STATE_KEY = Symbol.for(\n \"agent-native.client.pageviewTracking\",\n);\n\nconst ANONYMOUS_ID_STORAGE_KEY = \"agent-native.anonymous_id\";\nconst SESSION_ID_STORAGE_KEY = \"agent-native.session_id\";\nconst SESSION_LAST_ACTIVITY_STORAGE_KEY = \"agent-native.session_last_activity\";\nconst LLM_CONNECTION_STORAGE_KEY = \"agent-native.llm_connection_status\";\nconst LLM_CONNECTION_CACHE_TTL_MS = 5 * 60 * 1000;\n// 30-minute idle timeout matches GA4 / Mixpanel defaults — a tab left open\n// overnight starts a new session in the morning rather than stretching one\n// session over multiple visits.\nconst SESSION_IDLE_TIMEOUT_MS = 30 * 60 * 1000;\n\nfunction generateVisitorId(): string {\n try {\n if (\n typeof crypto !== \"undefined\" &&\n typeof crypto.randomUUID === \"function\"\n ) {\n return crypto.randomUUID();\n }\n } catch {\n // fall through to Math.random\n }\n return (\n Date.now().toString(36) +\n Math.random().toString(36).slice(2) +\n Math.random().toString(36).slice(2)\n );\n}\n\nfunction safeStorageGet(key: string): string | null {\n try {\n return window.localStorage.getItem(key);\n } catch {\n return null;\n }\n}\n\nfunction safeStorageSet(key: string, value: string): void {\n try {\n window.localStorage.setItem(key, value);\n } catch {\n // private browsing / storage disabled — best-effort\n }\n}\n\nfunction readCachedLlmConnectionStatus(): LlmConnectionStatus | null {\n if (typeof window === \"undefined\") return null;\n const raw = safeStorageGet(LLM_CONNECTION_STORAGE_KEY);\n if (!raw) return null;\n try {\n const parsed = JSON.parse(raw) as LlmConnectionStatus & {\n cachedAt?: number;\n };\n if (\n typeof parsed.cachedAt !== \"number\" ||\n Date.now() - parsed.cachedAt > LLM_CONNECTION_CACHE_TTL_MS\n ) {\n return null;\n }\n return {\n configured: parsed.configured,\n engine: parsed.engine,\n model: parsed.model,\n source: parsed.source,\n envVar: parsed.envVar,\n };\n } catch {\n return null;\n }\n}\n\nfunction cacheLlmConnectionStatus(status: LlmConnectionStatus): void {\n if (typeof window === \"undefined\") return;\n safeStorageSet(\n LLM_CONNECTION_STORAGE_KEY,\n JSON.stringify({ ...status, cachedAt: Date.now() }),\n );\n}\n\nfunction normalizeAgentEngineStatus(data: unknown): LlmConnectionStatus {\n const value = data as Record<string, unknown> | null;\n if (!value || value.configured !== true) {\n return { configured: false };\n }\n return {\n configured: true,\n engine: typeof value.engine === \"string\" ? value.engine : null,\n model: typeof value.model === \"string\" ? value.model : null,\n source: typeof value.source === \"string\" ? value.source : null,\n envVar: typeof value.envVar === \"string\" ? value.envVar : null,\n };\n}\n\nfunction refreshLlmConnectionStatus(): Promise<void> {\n if (typeof window === \"undefined\" || typeof fetch !== \"function\") {\n return Promise.resolve();\n }\n if (_llmConnectionRefresh) return _llmConnectionRefresh;\n let request: Promise<Response>;\n try {\n request = fetch(agentNativePath(\"/_agent-native/agent-engine/status\"));\n } catch {\n return Promise.resolve();\n }\n _llmConnectionRefresh = request\n .then((res) => (res.ok ? res.json() : null))\n .then((data) => {\n _llmConnectionStatus = normalizeAgentEngineStatus(data);\n cacheLlmConnectionStatus(_llmConnectionStatus);\n })\n .catch(() => {\n if (!_llmConnectionStatus) {\n _llmConnectionStatus = readCachedLlmConnectionStatus();\n }\n })\n .finally(() => {\n _llmConnectionRefresh = null;\n });\n return _llmConnectionRefresh;\n}\n\nfunction installLlmConnectionRefresh(): void {\n if (typeof window === \"undefined\" || _llmConnectionRefreshInstalled) return;\n _llmConnectionRefreshInstalled = true;\n _llmConnectionStatus = readCachedLlmConnectionStatus();\n void refreshLlmConnectionStatus();\n window.addEventListener(\"focus\", () => {\n void refreshLlmConnectionStatus();\n });\n window.addEventListener(\"agent-engine:configured-changed\", () => {\n void refreshLlmConnectionStatus();\n });\n}\n\nfunction getOrCreateAnonymousId(): string | undefined {\n if (typeof window === \"undefined\") return undefined;\n let id = safeStorageGet(ANONYMOUS_ID_STORAGE_KEY);\n if (!id) {\n id = generateVisitorId();\n safeStorageSet(ANONYMOUS_ID_STORAGE_KEY, id);\n }\n return id;\n}\n\nfunction getOrCreateSessionId(): string | undefined {\n if (typeof window === \"undefined\") return undefined;\n const now = Date.now();\n const lastActivityRaw = safeStorageGet(SESSION_LAST_ACTIVITY_STORAGE_KEY);\n const lastActivity = lastActivityRaw\n ? Number.parseInt(lastActivityRaw, 10)\n : 0;\n let id = safeStorageGet(SESSION_ID_STORAGE_KEY);\n const expired =\n !lastActivity ||\n Number.isNaN(lastActivity) ||\n now - lastActivity > SESSION_IDLE_TIMEOUT_MS;\n if (!id || expired) {\n id = generateVisitorId();\n safeStorageSet(SESSION_ID_STORAGE_KEY, id);\n }\n safeStorageSet(SESSION_LAST_ACTIVITY_STORAGE_KEY, String(now));\n return id;\n}\n\nfunction isLocalAnalyticsHostname(hostname: string | undefined): boolean {\n const h = (hostname || \"\").toLowerCase();\n return (\n h === \"localhost\" ||\n h === \"127.0.0.1\" ||\n h === \"::1\" ||\n h === \"[::1]\" ||\n h.endsWith(\".localhost\") ||\n h.endsWith(\".local\")\n );\n}\n\nfunction ensureAmplitude(): boolean {\n if (_amplitudeInitialized) return true;\n const key = (import.meta.env as Record<string, string | undefined>)\n ?.VITE_AMPLITUDE_API_KEY;\n if (!key) return false;\n amplitude.init(key, { autocapture: true });\n _amplitudeInitialized = true;\n return true;\n}\n\nfunction shouldDropBrowserSentryNoise(event: Sentry.Event): boolean {\n const exceptionValues = event.exception?.values ?? [];\n // AgentAutoContinueSignal is a control-flow sentinel thrown to bubble\n // out of the SSE stream parser when the agent run needs to be\n // auto-continued. It's caught by the chat adapter and is never a real\n // error. Drop it unconditionally — capturing it as a Sentry exception\n // pollutes the issue list with sentinels that have no actionable stack.\n if (\n exceptionValues.some((value) => value.type === \"AgentAutoContinueSignal\")\n ) {\n return true;\n }\n // Browser-side access control rejections usually mean a tab outlived the\n // session or hit a protected route while signed out. The server Sentry setup\n // already drops these bare auth errors; mirror that here for client-captured\n // route/query failures.\n if (\n exceptionValues.some((value) => {\n const exceptionType = String(value.type ?? \"\")\n .trim()\n .toLowerCase();\n const exceptionValue = String(value.value ?? \"\")\n .trim()\n .toLowerCase();\n return (\n exceptionType === \"unauthorizederror\" ||\n exceptionType === \"unauthenticatederror\" ||\n exceptionValue === \"unauthorized\" ||\n exceptionValue === \"unauthenticated\"\n );\n })\n ) {\n return true;\n }\n // Exact user/navigation aborts are expected browser behavior. Keep other\n // AbortError shapes visible unless they match this common non-bug message.\n if (\n exceptionValues.some((value) => {\n const exceptionType = String(value.type ?? \"\")\n .trim()\n .toLowerCase();\n const exceptionValue = String(value.value ?? \"\")\n .trim()\n .toLowerCase();\n return (\n exceptionValue === \"the user aborted a request.\" ||\n exceptionValue === \"aborterror: the user aborted a request.\" ||\n (exceptionType === \"aborterror\" &&\n exceptionValue.includes(\"the user aborted a request\"))\n );\n })\n ) {\n return true;\n }\n const exceptionText = exceptionValues\n .map((value) => `${value.type ?? \"\"} ${value.value ?? \"\"}`)\n .join(\" \")\n .toLowerCase();\n const requestUrl = event.request?.url?.toLowerCase() ?? \"\";\n const breadcrumbText = (event.breadcrumbs ?? [])\n .map((crumb) => {\n const data = crumb.data as Record<string, unknown> | undefined;\n return [\n crumb.category,\n crumb.message,\n typeof data?.url === \"string\" ? data.url : \"\",\n ].join(\" \");\n })\n .join(\" \")\n .toLowerCase();\n const combined = `${exceptionText} ${requestUrl} ${breadcrumbText}`;\n return (\n combined.includes(\"api2.amplitude.com\") &&\n (combined.includes(\"failed to fetch\") ||\n combined.includes(\"networkerror\") ||\n combined.includes(\"load failed\"))\n );\n}\n\nfunction getClientSentryDsn(): string | undefined {\n const env = (import.meta.env as Record<string, string | undefined>) ?? {};\n return (\n env.VITE_SENTRY_CLIENT_DSN ||\n env.VITE_SENTRY_DSN ||\n window.__AGENT_NATIVE_CONFIG__?.sentryDsn\n );\n}\n\nfunction ensureSentry(): void {\n if (_sentryInitialized) return;\n const dsn = getClientSentryDsn();\n if (!dsn) return;\n Sentry.init({\n dsn,\n environment:\n window.__AGENT_NATIVE_CONFIG__?.sentryEnvironment ||\n (import.meta.env as Record<string, string | undefined>)?.MODE ||\n \"production\",\n beforeSend(event) {\n if (shouldDropBrowserSentryNoise(event)) {\n return null;\n }\n // Strip sensitive query params from the request URL. React Router\n // history can include share tokens, ?signin=1, password reset codes,\n // public-share password params (audit F-07), etc.\n if (event.request?.url) {\n event.request.url = scrubUrl(event.request.url);\n }\n // Clean the same params from breadcrumb URLs (Sentry captures\n // history.pushState breadcrumbs by default).\n if (Array.isArray(event.breadcrumbs)) {\n for (const crumb of event.breadcrumbs) {\n if (crumb && typeof crumb === \"object\" && \"data\" in crumb) {\n const data = crumb.data as Record<string, unknown> | undefined;\n if (data && typeof data.url === \"string\") {\n data.url = scrubUrl(data.url);\n }\n if (data && typeof data.from === \"string\") {\n data.from = scrubUrl(data.from);\n }\n if (data && typeof data.to === \"string\") {\n data.to = scrubUrl(data.to);\n }\n }\n }\n }\n return event;\n },\n });\n Sentry.setTag(\"runtime\", \"browser\");\n _sentryInitialized = true;\n // Flush any user/tag that was set before init.\n if (_pendingSentryUser !== undefined) {\n Sentry.setUser(_pendingSentryUser);\n _pendingSentryUser = undefined;\n }\n if (_pendingSentryOrgId !== undefined) {\n Sentry.setTag(\"orgId\", _pendingSentryOrgId);\n _pendingSentryOrgId = undefined;\n }\n}\n\n/**\n * Attach the current user to Sentry events from the browser. Pass `null` to\n * clear (e.g. on logout). If Sentry isn't initialized yet, the value is\n * buffered and applied once `ensureSentry()` runs.\n *\n * Pass `orgId` to also tag events with the active organization ID — useful\n * for filtering Sentry by tenant.\n */\nexport function setSentryUser(\n user: SentryUser | null,\n orgId?: string | null,\n): void {\n if (_sentryInitialized) {\n Sentry.setUser(user);\n if (orgId !== undefined) {\n Sentry.setTag(\"orgId\", orgId ?? null);\n }\n return;\n }\n _pendingSentryUser = user;\n if (orgId !== undefined) {\n _pendingSentryOrgId = orgId ?? null;\n }\n}\n\nexport interface ClientCaptureContext {\n /** Searchable Sentry tags (low-cardinality strings only). */\n tags?: Record<string, string | undefined>;\n /**\n * High-cardinality / structured payload — not searchable but visible in\n * the Sentry event detail (file sizes, request URLs, response body\n * tails, etc.).\n */\n extra?: Record<string, unknown>;\n /**\n * Grouped contexts shown as separate cards in the Sentry event UI.\n */\n contexts?: Record<string, Record<string, unknown>>;\n}\n\n/**\n * Capture an exception to Sentry from browser code without forcing the\n * caller to depend on `@sentry/browser` directly.\n *\n * Templates can route a thrown Error through here on a known failure path\n * (chunk-upload 500, thumbnail upload, etc.) to attach searchable tags and\n * structured extra context. No-ops gracefully when Sentry isn't\n * initialized — never throws back into the caller, so a Sentry hiccup\n * can't mask the original error.\n */\nexport function captureClientException(\n error: unknown,\n context: ClientCaptureContext = {},\n): string | undefined {\n if (typeof window === \"undefined\") return undefined;\n try {\n ensureSentry();\n return Sentry.withScope((scope) => {\n if (context.tags) {\n for (const [k, v] of Object.entries(context.tags)) {\n if (typeof v === \"string\") scope.setTag(k, v);\n }\n }\n if (context.extra) {\n for (const [k, v] of Object.entries(context.extra)) {\n if (v !== undefined) scope.setExtra(k, v);\n }\n }\n if (context.contexts) {\n for (const [k, v] of Object.entries(context.contexts)) {\n scope.setContext(k, v);\n }\n }\n return Sentry.captureException(error);\n });\n } catch {\n return undefined;\n }\n}\n\n/**\n * Public browser-side error capture utility, mirroring `trackEvent()`:\n * templates can call `captureError(err, { tags, extra, contexts })` without\n * depending on Sentry directly. Sentry receives the event when a browser DSN\n * is configured; otherwise this is a quiet no-op.\n */\nexport function captureError(\n error: unknown,\n context: ClientCaptureContext = {},\n): string | undefined {\n return captureClientException(error, context);\n}\n\nfunction getPageviewTrackingState(): PageviewTrackingState {\n const g = globalThis as typeof globalThis & {\n [PAGEVIEW_TRACKING_STATE_KEY]?: PageviewTrackingState;\n };\n if (!g[PAGEVIEW_TRACKING_STATE_KEY]) {\n g[PAGEVIEW_TRACKING_STATE_KEY] = {\n installed: false,\n lastPageviewKey: null,\n };\n }\n return g[PAGEVIEW_TRACKING_STATE_KEY];\n}\n\nexport function configureTracking(options: {\n getDefaultProps?: GetDefaultProps;\n}): void {\n if (options.getDefaultProps) {\n _getDefaultProps = options.getDefaultProps;\n }\n if (typeof window !== \"undefined\") {\n ensureSentry();\n ensureAmplitude();\n installLlmConnectionRefresh();\n installPageviewTracking();\n }\n}\n\nfunction inferTemplateName(properties: Record<string, unknown>): string | null {\n const envTemplate =\n (import.meta.env as Record<string, string | undefined>)\n ?.VITE_AGENT_NATIVE_TEMPLATE ||\n (import.meta.env as Record<string, string | undefined>)?.VITE_APP_TEMPLATE;\n if (envTemplate) return envTemplate;\n\n const app = typeof properties.app === \"string\" ? properties.app.trim() : \"\";\n if (!app || app === \"localhost\") return null;\n if (app.startsWith(\"agent-native-\")) {\n return app.slice(\"agent-native-\".length);\n }\n return app;\n}\n\nfunction resolveProps(\n name: string,\n params?: Record<string, unknown>,\n): Record<string, unknown> {\n if (typeof window === \"undefined\") return { ...params };\n const base: Record<string, unknown> = {\n url: window.location.origin + window.location.pathname,\n app: window.location.hostname.split(\".\")[0] || \"localhost\",\n ...params,\n };\n const props = _getDefaultProps ? _getDefaultProps(name, base) : base;\n let withTemplate = props;\n if (withTemplate.template === undefined) {\n const template = inferTemplateName(props);\n if (template) {\n withTemplate = { ...props, template };\n }\n }\n const llmProps = llmConnectionTrackingProperties(_llmConnectionStatus);\n const enriched = { ...withTemplate };\n for (const [key, value] of Object.entries(llmProps)) {\n if (enriched[key] === undefined) enriched[key] = value;\n }\n return enriched;\n}\n\nfunction pageviewKey(): string {\n return window.location.href;\n}\n\nfunction pageviewProperties(reason: string): Record<string, unknown> {\n const properties: Record<string, unknown> = {\n url: scrubUrl(window.location.href),\n path: window.location.pathname,\n hostname: window.location.hostname,\n navigation_type: reason,\n };\n if (window.location.search) {\n properties.search = scrubUrl(window.location.search);\n }\n if (typeof document !== \"undefined\") {\n if (document.referrer) {\n properties.referrer = scrubUrl(document.referrer);\n }\n if (document.title) {\n properties.title = document.title;\n }\n }\n return properties;\n}\n\nfunction emitPageview(reason: string): void {\n if (isLocalAnalyticsHostname(window.location.hostname)) return;\n const state = getPageviewTrackingState();\n const key = pageviewKey();\n if (state.lastPageviewKey === key) return;\n state.lastPageviewKey = key;\n trackEvent(\"pageview\", pageviewProperties(reason));\n}\n\nfunction schedulePageview(reason: string): void {\n const run = () => emitPageview(reason);\n if (_llmConnectionRefresh && !_llmConnectionStatus) {\n const timeout = new Promise<void>((resolve) =>\n window.setTimeout(resolve, 250),\n );\n Promise.race([_llmConnectionRefresh, timeout]).finally(run);\n return;\n }\n if (typeof queueMicrotask === \"function\") {\n queueMicrotask(run);\n return;\n }\n window.setTimeout(run, 0);\n}\n\nfunction installPageviewTracking(): void {\n const state = getPageviewTrackingState();\n if (state.installed) return;\n state.installed = true;\n\n schedulePageview(\"load\");\n\n const originalPushState = window.history.pushState;\n const originalReplaceState = window.history.replaceState;\n\n window.history.pushState = function pushState(...args) {\n const result = originalPushState.apply(this, args);\n schedulePageview(\"pushState\");\n return result;\n };\n\n window.history.replaceState = function replaceState(...args) {\n const result = originalReplaceState.apply(this, args);\n schedulePageview(\"replaceState\");\n return result;\n };\n\n window.addEventListener(\"popstate\", () => schedulePageview(\"popstate\"));\n}\n\nfunction sendAgentNativeAnalytics(\n name: string,\n properties: Record<string, unknown>,\n): void {\n if (isLocalAnalyticsHostname(window.location.hostname)) return;\n\n const publicKey = (import.meta.env as Record<string, string | undefined>)\n ?.VITE_AGENT_NATIVE_ANALYTICS_PUBLIC_KEY;\n if (!publicKey) return;\n\n const endpoint =\n (import.meta.env as Record<string, string | undefined>)\n ?.VITE_AGENT_NATIVE_ANALYTICS_ENDPOINT ||\n AGENT_NATIVE_ANALYTICS_DEFAULT_ENDPOINT;\n const userId =\n typeof properties.userId === \"string\" ? properties.userId : undefined;\n const body = JSON.stringify({\n publicKey,\n event: name,\n properties,\n userId,\n anonymousId: getOrCreateAnonymousId(),\n sessionId: getOrCreateSessionId(),\n timestamp: new Date().toISOString(),\n });\n\n try {\n if (navigator.sendBeacon) {\n const sent = navigator.sendBeacon(endpoint, body);\n if (sent) return;\n }\n fetch(endpoint, {\n method: \"POST\",\n body,\n keepalive: true,\n headers: { \"Content-Type\": \"text/plain;charset=UTF-8\" },\n }).catch(() => {});\n } catch {\n // best-effort\n }\n}\n\nexport function trackEvent(\n name: string,\n params?: Record<string, unknown>,\n): void {\n if (typeof window === \"undefined\") return;\n ensureSentry();\n const props = resolveProps(name, params);\n window.gtag?.(\"event\", name.replace(/\\s+/g, \"_\"), props);\n if (ensureAmplitude()) {\n amplitude.track(name, props);\n }\n sendAgentNativeAnalytics(name, props);\n}\n\nexport function trackSessionStatus(signedIn: boolean): void {\n trackEvent(\"session status\", { signed_in: signedIn });\n}\n"]}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import type { BlockSpec, BlockRenderContext } from "./types.js";
|
|
2
|
+
/**
|
|
3
|
+
* Resolve a spec's effective edit surface. Defaults to `"inline"` when the block
|
|
4
|
+
* ships a custom `Edit` (its author built direct-manipulation editing), else
|
|
5
|
+
* `"panel"` — an auto-form block is a property form, which reads best behind a
|
|
6
|
+
* corner edit button. An explicit `spec.editSurface` always wins.
|
|
7
|
+
*/
|
|
8
|
+
export declare function blockEditSurface(spec: BlockSpec<any>): "inline" | "panel";
|
|
9
|
+
/**
|
|
10
|
+
* Render one registered block. In read mode (or when the spec is inline-only and
|
|
11
|
+
* not editing) it renders the spec's `Read`. In edit mode for a `block`-placed
|
|
12
|
+
* spec it renders the editor — either inline (the spec's `Edit` or the
|
|
13
|
+
* schema-driven {@link SchemaBlockEditor}) or, for `editSurface: "panel"` blocks,
|
|
14
|
+
* the rendered `Read` plus a corner edit button that opens that editor in the
|
|
15
|
+
* app-provided panel ({@link BlockRenderContext.renderEditSurface}, e.g. a
|
|
16
|
+
* popover). This is what the app renderer delegates to once the registry
|
|
17
|
+
* recognizes a block type — the legacy switch handles unregistered types.
|
|
18
|
+
*/
|
|
19
|
+
export declare function BlockView({ spec, block, editing, editable, onChange, ctx, }: {
|
|
20
|
+
spec: BlockSpec<any>;
|
|
21
|
+
block: {
|
|
22
|
+
id: string;
|
|
23
|
+
title?: string;
|
|
24
|
+
summary?: string;
|
|
25
|
+
data: unknown;
|
|
26
|
+
};
|
|
27
|
+
/** Whether the document is in an editable/edit state. */
|
|
28
|
+
editing: boolean;
|
|
29
|
+
/** Whether this specific block allows editing (block.editable !== false). */
|
|
30
|
+
editable?: boolean;
|
|
31
|
+
/** Commit a new `data` value for the block. */
|
|
32
|
+
onChange?: (nextData: unknown) => void;
|
|
33
|
+
ctx: BlockRenderContext;
|
|
34
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
35
|
+
//# sourceMappingURL=BlockView.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"BlockView.d.ts","sourceRoot":"","sources":["../../../src/client/blocks/BlockView.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAC;AAGhE;;;;;GAKG;AACH,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,SAAS,CAAC,GAAG,CAAC,GAAG,QAAQ,GAAG,OAAO,CAEzE;AAED;;;;;;;;;GASG;AACH,wBAAgB,SAAS,CAAC,EACxB,IAAI,EACJ,KAAK,EACL,OAAO,EACP,QAAe,EACf,QAAQ,EACR,GAAG,GACJ,EAAE;IACD,IAAI,EAAE,SAAS,CAAC,GAAG,CAAC,CAAC;IACrB,KAAK,EAAE;QAAE,EAAE,EAAE,MAAM,CAAC;QAAC,KAAK,CAAC,EAAE,MAAM,CAAC;QAAC,OAAO,CAAC,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,OAAO,CAAA;KAAE,CAAC;IACvE,yDAAyD;IACzD,OAAO,EAAE,OAAO,CAAC;IACjB,6EAA6E;IAC7E,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,+CAA+C;IAC/C,QAAQ,CAAC,EAAE,CAAC,QAAQ,EAAE,OAAO,KAAK,IAAI,CAAC;IACvC,GAAG,EAAE,kBAAkB,CAAC;CACzB,2CAsEA"}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { IconPencil } from "@tabler/icons-react";
|
|
3
|
+
import { SchemaBlockEditor } from "./SchemaBlockEditor.js";
|
|
4
|
+
/**
|
|
5
|
+
* Resolve a spec's effective edit surface. Defaults to `"inline"` when the block
|
|
6
|
+
* ships a custom `Edit` (its author built direct-manipulation editing), else
|
|
7
|
+
* `"panel"` — an auto-form block is a property form, which reads best behind a
|
|
8
|
+
* corner edit button. An explicit `spec.editSurface` always wins.
|
|
9
|
+
*/
|
|
10
|
+
export function blockEditSurface(spec) {
|
|
11
|
+
return spec.editSurface ?? (spec.Edit ? "inline" : "panel");
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Render one registered block. In read mode (or when the spec is inline-only and
|
|
15
|
+
* not editing) it renders the spec's `Read`. In edit mode for a `block`-placed
|
|
16
|
+
* spec it renders the editor — either inline (the spec's `Edit` or the
|
|
17
|
+
* schema-driven {@link SchemaBlockEditor}) or, for `editSurface: "panel"` blocks,
|
|
18
|
+
* the rendered `Read` plus a corner edit button that opens that editor in the
|
|
19
|
+
* app-provided panel ({@link BlockRenderContext.renderEditSurface}, e.g. a
|
|
20
|
+
* popover). This is what the app renderer delegates to once the registry
|
|
21
|
+
* recognizes a block type — the legacy switch handles unregistered types.
|
|
22
|
+
*/
|
|
23
|
+
export function BlockView({ spec, block, editing, editable = true, onChange, ctx, }) {
|
|
24
|
+
const Read = spec.Read;
|
|
25
|
+
const readNode = (_jsx(Read, { data: block.data, blockId: block.id, title: block.title, summary: block.summary, ctx: ctx }));
|
|
26
|
+
const canEdit = editing && editable && spec.placement.includes("block") && !!onChange;
|
|
27
|
+
if (!canEdit)
|
|
28
|
+
return readNode;
|
|
29
|
+
const commit = (nextData) => onChange?.(nextData);
|
|
30
|
+
const Edit = spec.Edit;
|
|
31
|
+
const formNode = Edit ? (_jsx(Edit, { data: block.data, onChange: commit, editable: true, blockId: block.id, title: block.title, summary: block.summary, ctx: ctx })) : (_jsx(SchemaBlockEditor, { data: block.data, onChange: commit, schema: spec.schema, editable: true, blockId: block.id, ctx: ctx }));
|
|
32
|
+
// Panel mode: show the rendered block with a corner edit button that opens the
|
|
33
|
+
// form in the app-provided panel (popover). Falls back to inline editing when
|
|
34
|
+
// the app hasn't wired `renderEditSurface`.
|
|
35
|
+
if (blockEditSurface(spec) === "panel" && ctx.renderEditSurface) {
|
|
36
|
+
return (_jsxs("div", { className: "an-block-panel group relative", children: [readNode, _jsx("div", { className: "an-block-panel__edit absolute right-2 top-2 z-10", children: ctx.renderEditSurface({
|
|
37
|
+
title: spec.label,
|
|
38
|
+
trigger: (_jsx("button", { type: "button", "data-plan-interactive": true, "aria-label": `Edit ${spec.label}`, className: "an-block-edit-trigger flex size-7 items-center justify-center rounded-md border border-border bg-background/80 text-muted-foreground opacity-0 shadow-sm backdrop-blur transition-opacity hover:bg-muted hover:text-foreground focus-visible:opacity-100 group-hover:opacity-100", children: _jsx(IconPencil, { className: "size-4" }) })),
|
|
39
|
+
children: formNode,
|
|
40
|
+
}) })] }));
|
|
41
|
+
}
|
|
42
|
+
// Inline mode (direct manipulation).
|
|
43
|
+
return formNode;
|
|
44
|
+
}
|
|
45
|
+
//# sourceMappingURL=BlockView.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"BlockView.js","sourceRoot":"","sources":["../../../src/client/blocks/BlockView.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AAEjD,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAE3D;;;;;GAKG;AACH,MAAM,UAAU,gBAAgB,CAAC,IAAoB;IACnD,OAAO,IAAI,CAAC,WAAW,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC;AAC9D,CAAC;AAED;;;;;;;;;GASG;AACH,MAAM,UAAU,SAAS,CAAC,EACxB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5C,IAAI,gBAAgB,CAAC,IAAI,CAAC,KAAK,OAAO,IAAI,GAAG,CAAC,iBAAiB,EAAE,CAAC;QAChE,OAAO,CACL,eAAK,SAAS,EAAC,+BAA+B,aAC3C,QAAQ,EACT,cAAK,SAAS,EAAC,kDAAkD,YAC9D,GAAG,CAAC,iBAAiB,CAAC;wBACrB,KAAK,EAAE,IAAI,CAAC,KAAK;wBACjB,OAAO,EAAE,CACP,iBACE,IAAI,EAAC,QAAQ,+CAED,QAAQ,IAAI,CAAC,KAAK,EAAE,EAChC,SAAS,EAAC,kRAAkR,YAE5R,KAAC,UAAU,IAAC,SAAS,EAAC,QAAQ,GAAG,GAC1B,CACV;wBACD,QAAQ,EAAE,QAAQ;qBACnB,CAAC,GACE,IACF,CACP,CAAC;IACJ,CAAC;IAED,qCAAqC;IACrC,OAAO,QAAQ,CAAC;AAClB,CAAC","sourcesContent":["import { IconPencil } from \"@tabler/icons-react\";\nimport type { BlockSpec, BlockRenderContext } from \"./types.js\";\nimport { SchemaBlockEditor } from \"./SchemaBlockEditor.js\";\n\n/**\n * Resolve a spec's effective edit surface. Defaults to `\"inline\"` when the block\n * ships a custom `Edit` (its author built direct-manipulation editing), else\n * `\"panel\"` — an auto-form block is a property form, which reads best behind a\n * corner edit button. An explicit `spec.editSurface` always wins.\n */\nexport function blockEditSurface(spec: BlockSpec<any>): \"inline\" | \"panel\" {\n return spec.editSurface ?? (spec.Edit ? \"inline\" : \"panel\");\n}\n\n/**\n * Render one registered block. In read mode (or when the spec is inline-only and\n * not editing) it renders the spec's `Read`. In edit mode for a `block`-placed\n * spec it renders the editor — either inline (the spec's `Edit` or the\n * schema-driven {@link SchemaBlockEditor}) or, for `editSurface: \"panel\"` blocks,\n * the rendered `Read` plus a corner edit button that opens that editor in the\n * app-provided panel ({@link BlockRenderContext.renderEditSurface}, e.g. a\n * popover). This is what the app renderer delegates to once the registry\n * recognizes a block type — the legacy switch handles unregistered types.\n */\nexport function BlockView({\n spec,\n block,\n editing,\n editable = true,\n onChange,\n ctx,\n}: {\n spec: BlockSpec<any>;\n block: { id: string; title?: string; summary?: string; data: unknown };\n /** Whether the document is in an editable/edit state. */\n editing: boolean;\n /** Whether this specific block allows editing (block.editable !== false). */\n editable?: boolean;\n /** Commit a new `data` value for the block. */\n onChange?: (nextData: unknown) => void;\n ctx: BlockRenderContext;\n}) {\n const Read = spec.Read;\n const readNode = (\n <Read\n data={block.data}\n blockId={block.id}\n title={block.title}\n summary={block.summary}\n ctx={ctx}\n />\n );\n\n const canEdit =\n editing && editable && spec.placement.includes(\"block\") && !!onChange;\n\n if (!canEdit) return readNode;\n\n const commit = (nextData: unknown) => onChange?.(nextData);\n\n const Edit = spec.Edit;\n const formNode = Edit ? (\n <Edit\n data={block.data}\n onChange={commit}\n editable\n blockId={block.id}\n title={block.title}\n summary={block.summary}\n ctx={ctx}\n />\n ) : (\n <SchemaBlockEditor\n data={block.data}\n onChange={commit}\n schema={spec.schema}\n editable\n blockId={block.id}\n ctx={ctx}\n />\n );\n\n // Panel mode: show the rendered block with a corner edit button that opens the\n // form in the app-provided panel (popover). Falls back to inline editing when\n // the app hasn't wired `renderEditSurface`.\n if (blockEditSurface(spec) === \"panel\" && ctx.renderEditSurface) {\n return (\n <div className=\"an-block-panel group relative\">\n {readNode}\n <div className=\"an-block-panel__edit absolute right-2 top-2 z-10\">\n {ctx.renderEditSurface({\n title: spec.label,\n trigger: (\n <button\n type=\"button\"\n data-plan-interactive\n aria-label={`Edit ${spec.label}`}\n className=\"an-block-edit-trigger flex size-7 items-center justify-center rounded-md border border-border bg-background/80 text-muted-foreground opacity-0 shadow-sm backdrop-blur transition-opacity hover:bg-muted hover:text-foreground focus-visible:opacity-100 group-hover:opacity-100\"\n >\n <IconPencil className=\"size-4\" />\n </button>\n ),\n children: formNode,\n })}\n </div>\n </div>\n );\n }\n\n // Inline mode (direct manipulation).\n return formNode;\n}\n"]}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import type { ZodType } from "zod";
|
|
2
|
+
import type { BlockRenderContext } from "./types.js";
|
|
3
|
+
/**
|
|
4
|
+
* Schema-driven auto-editor. When a {@link BlockSpec} omits `Edit`, the registry
|
|
5
|
+
* renders this: it walks the block's zod `data` schema and renders one control
|
|
6
|
+
* per field (string → input, longtext → textarea, number, boolean → toggle,
|
|
7
|
+
* enum → native select, array → repeating rows, object → nested fieldset). A
|
|
8
|
+
* `markdown()`-tagged string field defers to the app-provided inline rich
|
|
9
|
+
* editor via `ctx.renderMarkdownEditor` so prose stays Notion-editable.
|
|
10
|
+
*
|
|
11
|
+
* It uses plain accessible native controls (not template shadcn primitives,
|
|
12
|
+
* which core does not bundle) styled to match the shadcn look. Validation runs
|
|
13
|
+
* the spec's own schema on every edit; the raw edit is kept in local state so a
|
|
14
|
+
* transiently-invalid value (e.g. mid-typing) doesn't get rolled back, and only
|
|
15
|
+
* valid data is committed upstream.
|
|
16
|
+
*/
|
|
17
|
+
export declare function SchemaBlockEditor<T>({ data, onChange, schema, editable, blockId, ctx, }: {
|
|
18
|
+
data: T;
|
|
19
|
+
onChange: (next: T) => void;
|
|
20
|
+
schema: ZodType<T>;
|
|
21
|
+
editable: boolean;
|
|
22
|
+
blockId?: string;
|
|
23
|
+
ctx: BlockRenderContext;
|
|
24
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
25
|
+
//# sourceMappingURL=SchemaBlockEditor.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SchemaBlockEditor.d.ts","sourceRoot":"","sources":["../../../src/client/blocks/SchemaBlockEditor.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,KAAK,CAAC;AAGnC,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAC;AAGrD;;;;;;;;;;;;;GAaG;AACH,wBAAgB,iBAAiB,CAAC,CAAC,EAAE,EACnC,IAAI,EACJ,QAAQ,EACR,MAAM,EACN,QAAQ,EACR,OAAO,EACP,GAAG,GACJ,EAAE;IACD,IAAI,EAAE,CAAC,CAAC;IACR,QAAQ,EAAE,CAAC,IAAI,EAAE,CAAC,KAAK,IAAI,CAAC;IAC5B,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC,CAAC;IACnB,QAAQ,EAAE,OAAO,CAAC;IAClB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,GAAG,EAAE,kBAAkB,CAAC;CACzB,2CAwDA"}
|