@agent-native/core 0.14.8 → 0.15.1
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 +1 -1
- package/dist/agent/engine/builder-engine.d.ts.map +1 -1
- package/dist/agent/engine/builder-engine.js +30 -9
- package/dist/agent/engine/builder-engine.js.map +1 -1
- package/dist/agent/engine/registry.d.ts.map +1 -1
- package/dist/agent/engine/registry.js +14 -4
- package/dist/agent/engine/registry.js.map +1 -1
- package/dist/agent/production-agent.d.ts.map +1 -1
- package/dist/agent/production-agent.js +71 -4
- package/dist/agent/production-agent.js.map +1 -1
- package/dist/agent/types.d.ts +9 -0
- package/dist/agent/types.d.ts.map +1 -1
- package/dist/agent/types.js.map +1 -1
- package/dist/appearance/actions/change-appearance.d.ts +3 -0
- package/dist/appearance/actions/change-appearance.d.ts.map +1 -0
- package/dist/appearance/actions/change-appearance.js +29 -0
- package/dist/appearance/actions/change-appearance.js.map +1 -0
- package/dist/chat-threads/store.d.ts +53 -2
- package/dist/chat-threads/store.d.ts.map +1 -1
- package/dist/chat-threads/store.js +172 -12
- package/dist/chat-threads/store.js.map +1 -1
- package/dist/cli/create.d.ts.map +1 -1
- package/dist/cli/create.js +114 -37
- package/dist/cli/create.js.map +1 -1
- package/dist/cli/index.js +30 -4
- package/dist/cli/index.js.map +1 -1
- package/dist/cli/workspace-dev.d.ts +25 -1
- package/dist/cli/workspace-dev.d.ts.map +1 -1
- package/dist/cli/workspace-dev.js +275 -49
- package/dist/cli/workspace-dev.js.map +1 -1
- package/dist/client/AgentPanel.d.ts +23 -4
- package/dist/client/AgentPanel.d.ts.map +1 -1
- package/dist/client/AgentPanel.js +276 -53
- package/dist/client/AgentPanel.js.map +1 -1
- package/dist/client/AppearancePicker.d.ts +11 -0
- package/dist/client/AppearancePicker.d.ts.map +1 -0
- package/dist/client/AppearancePicker.js +16 -0
- package/dist/client/AppearancePicker.js.map +1 -0
- package/dist/client/AssistantChat.d.ts +35 -0
- package/dist/client/AssistantChat.d.ts.map +1 -1
- package/dist/client/AssistantChat.js +315 -32
- package/dist/client/AssistantChat.js.map +1 -1
- package/dist/client/ConnectBuilderCard.d.ts.map +1 -1
- package/dist/client/ConnectBuilderCard.js +5 -2
- package/dist/client/ConnectBuilderCard.js.map +1 -1
- package/dist/client/ErrorBoundary.d.ts.map +1 -1
- package/dist/client/ErrorBoundary.js +8 -10
- package/dist/client/ErrorBoundary.js.map +1 -1
- package/dist/client/FeedbackButton.d.ts.map +1 -1
- package/dist/client/FeedbackButton.js +1 -1
- package/dist/client/FeedbackButton.js.map +1 -1
- package/dist/client/MultiTabAssistantChat.d.ts +13 -1
- package/dist/client/MultiTabAssistantChat.d.ts.map +1 -1
- package/dist/client/MultiTabAssistantChat.js +217 -38
- package/dist/client/MultiTabAssistantChat.js.map +1 -1
- package/dist/client/NewWorkspaceAppFlow.d.ts.map +1 -1
- package/dist/client/NewWorkspaceAppFlow.js +37 -14
- package/dist/client/NewWorkspaceAppFlow.js.map +1 -1
- package/dist/client/agent-chat-adapter.d.ts +5 -0
- package/dist/client/agent-chat-adapter.d.ts.map +1 -1
- package/dist/client/agent-chat-adapter.js +4 -0
- package/dist/client/agent-chat-adapter.js.map +1 -1
- package/dist/client/agent-sidebar-state.d.ts +12 -0
- package/dist/client/agent-sidebar-state.d.ts.map +1 -1
- package/dist/client/agent-sidebar-state.js +8 -0
- package/dist/client/agent-sidebar-state.js.map +1 -1
- package/dist/client/analytics.d.ts.map +1 -1
- package/dist/client/analytics.js +175 -3
- package/dist/client/analytics.js.map +1 -1
- package/dist/client/appearance.d.ts +40 -0
- package/dist/client/appearance.d.ts.map +1 -0
- package/dist/client/appearance.js +114 -0
- package/dist/client/appearance.js.map +1 -0
- package/dist/client/builder-frame.d.ts +1 -0
- package/dist/client/builder-frame.d.ts.map +1 -1
- package/dist/client/builder-frame.js +19 -9
- package/dist/client/builder-frame.js.map +1 -1
- package/dist/client/components/CodeRequiredDialog.d.ts.map +1 -1
- package/dist/client/components/CodeRequiredDialog.js +10 -2
- package/dist/client/components/CodeRequiredDialog.js.map +1 -1
- package/dist/client/components/ui/dropdown-menu.js +2 -2
- package/dist/client/components/ui/dropdown-menu.js.map +1 -1
- package/dist/client/components/ui/hover-card.js +1 -1
- package/dist/client/components/ui/hover-card.js.map +1 -1
- package/dist/client/components/ui/popover.js +1 -1
- package/dist/client/components/ui/popover.js.map +1 -1
- package/dist/client/composer/PromptComposer.d.ts +7 -0
- package/dist/client/composer/PromptComposer.d.ts.map +1 -1
- package/dist/client/composer/PromptComposer.js +63 -32
- package/dist/client/composer/PromptComposer.js.map +1 -1
- package/dist/client/composer/TiptapComposer.d.ts +5 -0
- package/dist/client/composer/TiptapComposer.d.ts.map +1 -1
- package/dist/client/composer/TiptapComposer.js +36 -6
- package/dist/client/composer/TiptapComposer.js.map +1 -1
- package/dist/client/composer/useVoiceDictation.d.ts.map +1 -1
- package/dist/client/composer/useVoiceDictation.js +13 -1
- package/dist/client/composer/useVoiceDictation.js.map +1 -1
- package/dist/client/dev-mode.d.ts +14 -0
- package/dist/client/dev-mode.d.ts.map +1 -0
- package/dist/client/dev-mode.js +14 -0
- package/dist/client/dev-mode.js.map +1 -0
- package/dist/client/error-format.d.ts +3 -2
- package/dist/client/error-format.d.ts.map +1 -1
- package/dist/client/error-format.js +9 -2
- package/dist/client/error-format.js.map +1 -1
- package/dist/client/extensions/EmbeddedTool.d.ts +20 -0
- package/dist/client/extensions/EmbeddedTool.d.ts.map +1 -0
- package/dist/client/extensions/EmbeddedTool.js +199 -0
- package/dist/client/extensions/EmbeddedTool.js.map +1 -0
- package/dist/client/extensions/ExtensionViewer.d.ts.map +1 -1
- package/dist/client/extensions/ExtensionViewer.js +24 -2
- package/dist/client/extensions/ExtensionViewer.js.map +1 -1
- package/dist/client/extensions/ToolEditor.d.ts +5 -0
- package/dist/client/extensions/ToolEditor.d.ts.map +1 -0
- package/dist/client/extensions/ToolEditor.js +129 -0
- package/dist/client/extensions/ToolEditor.js.map +1 -0
- package/dist/client/extensions/ToolViewer.d.ts +5 -0
- package/dist/client/extensions/ToolViewer.d.ts.map +1 -0
- package/dist/client/extensions/ToolViewer.js +400 -0
- package/dist/client/extensions/ToolViewer.js.map +1 -0
- package/dist/client/extensions/ToolViewerPage.d.ts +2 -0
- package/dist/client/extensions/ToolViewerPage.d.ts.map +1 -0
- package/dist/client/extensions/ToolViewerPage.js +24 -0
- package/dist/client/extensions/ToolViewerPage.js.map +1 -0
- package/dist/client/extensions/ToolsListPage.d.ts +2 -0
- package/dist/client/extensions/ToolsListPage.d.ts.map +1 -0
- package/dist/client/extensions/ToolsListPage.js +67 -0
- package/dist/client/extensions/ToolsListPage.js.map +1 -0
- package/dist/client/extensions/ToolsSidebarSection.d.ts +2 -0
- package/dist/client/extensions/ToolsSidebarSection.d.ts.map +1 -0
- package/dist/client/extensions/ToolsSidebarSection.js +236 -0
- package/dist/client/extensions/ToolsSidebarSection.js.map +1 -0
- package/dist/client/extensions/tool-order.d.ts +7 -0
- package/dist/client/extensions/tool-order.d.ts.map +1 -0
- package/dist/client/extensions/tool-order.js +47 -0
- package/dist/client/extensions/tool-order.js.map +1 -0
- package/dist/client/index.d.ts +8 -1
- package/dist/client/index.d.ts.map +1 -1
- package/dist/client/index.js +7 -0
- package/dist/client/index.js.map +1 -1
- package/dist/client/onboarding/OnboardingPanel.js +1 -0
- package/dist/client/onboarding/OnboardingPanel.js.map +1 -1
- package/dist/client/org/InvitationBanner.d.ts.map +1 -1
- package/dist/client/org/InvitationBanner.js +23 -2
- package/dist/client/org/InvitationBanner.js.map +1 -1
- package/dist/client/org/OrgSwitcher.d.ts +5 -4
- package/dist/client/org/OrgSwitcher.d.ts.map +1 -1
- package/dist/client/org/OrgSwitcher.js +57 -9
- package/dist/client/org/OrgSwitcher.js.map +1 -1
- package/dist/client/org/hooks.d.ts.map +1 -1
- package/dist/client/org/hooks.js +10 -6
- package/dist/client/org/hooks.js.map +1 -1
- package/dist/client/org/workspace-app-links.d.ts +31 -0
- package/dist/client/org/workspace-app-links.d.ts.map +1 -0
- package/dist/client/org/workspace-app-links.js +268 -0
- package/dist/client/org/workspace-app-links.js.map +1 -0
- package/dist/client/resources/ResourcesPanel.d.ts.map +1 -1
- package/dist/client/resources/ResourcesPanel.js +18 -5
- package/dist/client/resources/ResourcesPanel.js.map +1 -1
- package/dist/client/resources/use-resources.d.ts +18 -13
- package/dist/client/resources/use-resources.d.ts.map +1 -1
- package/dist/client/resources/use-resources.js +24 -6
- package/dist/client/resources/use-resources.js.map +1 -1
- package/dist/client/settings/BackgroundAgentSection.d.ts.map +1 -1
- package/dist/client/settings/BackgroundAgentSection.js +9 -1
- package/dist/client/settings/BackgroundAgentSection.js.map +1 -1
- package/dist/client/settings/BrowserSection.d.ts.map +1 -1
- package/dist/client/settings/BrowserSection.js +16 -1
- package/dist/client/settings/BrowserSection.js.map +1 -1
- package/dist/client/settings/SettingsPanel.d.ts.map +1 -1
- package/dist/client/settings/SettingsPanel.js +4 -1
- package/dist/client/settings/SettingsPanel.js.map +1 -1
- package/dist/client/settings/VoiceTranscriptionSection.d.ts.map +1 -1
- package/dist/client/settings/VoiceTranscriptionSection.js +5 -5
- package/dist/client/settings/VoiceTranscriptionSection.js.map +1 -1
- package/dist/client/settings/useBuilderStatus.d.ts +8 -0
- package/dist/client/settings/useBuilderStatus.d.ts.map +1 -1
- package/dist/client/settings/useBuilderStatus.js +50 -13
- package/dist/client/settings/useBuilderStatus.js.map +1 -1
- package/dist/client/settings/useBuilderStatus.spec.d.ts +2 -0
- package/dist/client/settings/useBuilderStatus.spec.d.ts.map +1 -0
- package/dist/client/settings/useBuilderStatus.spec.js +64 -0
- package/dist/client/settings/useBuilderStatus.spec.js.map +1 -0
- package/dist/client/sharing/ShareButton.d.ts +5 -0
- package/dist/client/sharing/ShareButton.d.ts.map +1 -1
- package/dist/client/sharing/ShareButton.js +60 -6
- package/dist/client/sharing/ShareButton.js.map +1 -1
- package/dist/client/theme.js +1 -1
- package/dist/client/theme.js.map +1 -1
- package/dist/client/tools/EmbeddedTool.d.ts +20 -0
- package/dist/client/tools/EmbeddedTool.d.ts.map +1 -0
- package/dist/client/tools/EmbeddedTool.js +199 -0
- package/dist/client/tools/EmbeddedTool.js.map +1 -0
- package/dist/client/tools/ExtensionSlot.d.ts +27 -0
- package/dist/client/tools/ExtensionSlot.d.ts.map +1 -0
- package/dist/client/tools/ExtensionSlot.js +96 -0
- package/dist/client/tools/ExtensionSlot.js.map +1 -0
- package/dist/client/tools/ToolEditor.d.ts +5 -0
- package/dist/client/tools/ToolEditor.d.ts.map +1 -0
- package/dist/client/tools/ToolEditor.js +129 -0
- package/dist/client/tools/ToolEditor.js.map +1 -0
- package/dist/client/tools/ToolViewer.d.ts +5 -0
- package/dist/client/tools/ToolViewer.d.ts.map +1 -0
- package/dist/client/tools/ToolViewer.js +400 -0
- package/dist/client/tools/ToolViewer.js.map +1 -0
- package/dist/client/tools/ToolViewerPage.d.ts +2 -0
- package/dist/client/tools/ToolViewerPage.d.ts.map +1 -0
- package/dist/client/tools/ToolViewerPage.js +24 -0
- package/dist/client/tools/ToolViewerPage.js.map +1 -0
- package/dist/client/tools/ToolsListPage.d.ts +2 -0
- package/dist/client/tools/ToolsListPage.d.ts.map +1 -0
- package/dist/client/tools/ToolsListPage.js +67 -0
- package/dist/client/tools/ToolsListPage.js.map +1 -0
- package/dist/client/tools/ToolsSidebarSection.d.ts +2 -0
- package/dist/client/tools/ToolsSidebarSection.d.ts.map +1 -0
- package/dist/client/tools/ToolsSidebarSection.js +236 -0
- package/dist/client/tools/ToolsSidebarSection.js.map +1 -0
- package/dist/client/tools/iframe-bridge.d.ts +38 -0
- package/dist/client/tools/iframe-bridge.d.ts.map +1 -0
- package/dist/client/tools/iframe-bridge.js +207 -0
- package/dist/client/tools/iframe-bridge.js.map +1 -0
- package/dist/client/tools/index.d.ts +8 -0
- package/dist/client/tools/index.d.ts.map +1 -0
- package/dist/client/tools/index.js +8 -0
- package/dist/client/tools/index.js.map +1 -0
- package/dist/client/tools/tool-order.d.ts +7 -0
- package/dist/client/tools/tool-order.d.ts.map +1 -0
- package/dist/client/tools/tool-order.js +47 -0
- package/dist/client/tools/tool-order.js.map +1 -0
- package/dist/client/transcription/BuilderTranscriptionCta.d.ts.map +1 -1
- package/dist/client/transcription/BuilderTranscriptionCta.js +2 -3
- package/dist/client/transcription/BuilderTranscriptionCta.js.map +1 -1
- package/dist/client/use-change-version.d.ts +46 -0
- package/dist/client/use-change-version.d.ts.map +1 -0
- package/dist/client/use-change-version.js +135 -0
- package/dist/client/use-change-version.js.map +1 -0
- package/dist/client/use-chat-threads.d.ts +16 -2
- package/dist/client/use-chat-threads.d.ts.map +1 -1
- package/dist/client/use-chat-threads.js +87 -12
- package/dist/client/use-chat-threads.js.map +1 -1
- package/dist/client/use-chat-threads.spec.d.ts +2 -0
- package/dist/client/use-chat-threads.spec.d.ts.map +1 -0
- package/dist/client/use-chat-threads.spec.js +85 -0
- package/dist/client/use-chat-threads.spec.js.map +1 -0
- package/dist/client/use-db-sync.d.ts +5 -2
- package/dist/client/use-db-sync.d.ts.map +1 -1
- package/dist/client/use-db-sync.js +41 -16
- package/dist/client/use-db-sync.js.map +1 -1
- package/dist/client/use-pinch-zoom.d.ts +35 -0
- package/dist/client/use-pinch-zoom.d.ts.map +1 -0
- package/dist/client/use-pinch-zoom.js +105 -0
- package/dist/client/use-pinch-zoom.js.map +1 -0
- package/dist/deploy/workspace-deploy.d.ts.map +1 -1
- package/dist/deploy/workspace-deploy.js +99 -5
- package/dist/deploy/workspace-deploy.js.map +1 -1
- package/dist/extensions/actions.d.ts.map +1 -1
- package/dist/extensions/actions.js +3 -0
- package/dist/extensions/actions.js.map +1 -1
- package/dist/extensions/store.d.ts +5 -0
- package/dist/extensions/store.d.ts.map +1 -1
- package/dist/extensions/store.js +16 -1
- package/dist/extensions/store.js.map +1 -1
- package/dist/file-upload/actions/upload-image.d.ts +3 -0
- package/dist/file-upload/actions/upload-image.d.ts.map +1 -0
- package/dist/file-upload/actions/upload-image.js +145 -0
- package/dist/file-upload/actions/upload-image.js.map +1 -0
- package/dist/file-upload/builder.d.ts.map +1 -1
- package/dist/file-upload/builder.js +31 -11
- package/dist/file-upload/builder.js.map +1 -1
- package/dist/file-upload/index.d.ts +1 -0
- package/dist/file-upload/index.d.ts.map +1 -1
- package/dist/file-upload/index.js +1 -0
- package/dist/file-upload/index.js.map +1 -1
- package/dist/file-upload/pre-upload-attachments.d.ts +39 -0
- package/dist/file-upload/pre-upload-attachments.d.ts.map +1 -0
- package/dist/file-upload/pre-upload-attachments.js +110 -0
- package/dist/file-upload/pre-upload-attachments.js.map +1 -0
- package/dist/file-upload/registry.d.ts.map +1 -1
- package/dist/file-upload/registry.js +8 -7
- package/dist/file-upload/registry.js.map +1 -1
- package/dist/onboarding/default-steps.js +1 -1
- package/dist/onboarding/default-steps.js.map +1 -1
- package/dist/org/context.d.ts +15 -1
- package/dist/org/context.d.ts.map +1 -1
- package/dist/org/context.js +25 -0
- package/dist/org/context.js.map +1 -1
- package/dist/org/handlers.d.ts +2 -2
- package/dist/org/handlers.d.ts.map +1 -1
- package/dist/org/handlers.js +3 -17
- package/dist/org/handlers.js.map +1 -1
- package/dist/org/index.d.ts +1 -1
- package/dist/org/index.d.ts.map +1 -1
- package/dist/org/index.js +1 -1
- package/dist/org/index.js.map +1 -1
- package/dist/resources/handlers.d.ts +6 -0
- package/dist/resources/handlers.d.ts.map +1 -1
- package/dist/resources/handlers.js +30 -6
- package/dist/resources/handlers.js.map +1 -1
- package/dist/resources/script-helpers.d.ts +11 -2
- package/dist/resources/script-helpers.d.ts.map +1 -1
- package/dist/resources/script-helpers.js +20 -3
- package/dist/resources/script-helpers.js.map +1 -1
- package/dist/resources/store.d.ts +28 -3
- package/dist/resources/store.d.ts.map +1 -1
- package/dist/resources/store.js +170 -20
- package/dist/resources/store.js.map +1 -1
- package/dist/scripts/resources/list.d.ts +1 -1
- package/dist/scripts/resources/list.d.ts.map +1 -1
- package/dist/scripts/resources/list.js +16 -4
- package/dist/scripts/resources/list.js.map +1 -1
- package/dist/scripts/resources/write.d.ts +1 -1
- package/dist/scripts/resources/write.d.ts.map +1 -1
- package/dist/scripts/resources/write.js +47 -3
- package/dist/scripts/resources/write.js.map +1 -1
- package/dist/server/action-discovery.d.ts.map +1 -1
- package/dist/server/action-discovery.js +8 -3
- package/dist/server/action-discovery.js.map +1 -1
- package/dist/server/agent-chat-plugin.d.ts.map +1 -1
- package/dist/server/agent-chat-plugin.js +214 -25
- package/dist/server/agent-chat-plugin.js.map +1 -1
- package/dist/server/agent-discovery.d.ts +35 -0
- package/dist/server/agent-discovery.d.ts.map +1 -1
- package/dist/server/agent-discovery.js +139 -8
- package/dist/server/agent-discovery.js.map +1 -1
- package/dist/server/app-url.d.ts +12 -6
- package/dist/server/app-url.d.ts.map +1 -1
- package/dist/server/app-url.js +58 -11
- package/dist/server/app-url.js.map +1 -1
- package/dist/server/auth.d.ts +22 -0
- package/dist/server/auth.d.ts.map +1 -1
- package/dist/server/auth.js +316 -65
- package/dist/server/auth.js.map +1 -1
- package/dist/server/better-auth-instance.d.ts +0 -4
- package/dist/server/better-auth-instance.d.ts.map +1 -1
- package/dist/server/better-auth-instance.js +0 -3
- package/dist/server/better-auth-instance.js.map +1 -1
- package/dist/server/builder-browser.d.ts.map +1 -1
- package/dist/server/builder-browser.js +23 -0
- package/dist/server/builder-browser.js.map +1 -1
- package/dist/server/core-routes-plugin.d.ts.map +1 -1
- package/dist/server/core-routes-plugin.js +29 -14
- package/dist/server/core-routes-plugin.js.map +1 -1
- package/dist/server/credential-provider.d.ts +14 -0
- package/dist/server/credential-provider.d.ts.map +1 -1
- package/dist/server/credential-provider.js +88 -11
- package/dist/server/credential-provider.js.map +1 -1
- package/dist/server/google-auth-plugin.d.ts.map +1 -1
- package/dist/server/google-auth-plugin.js +65 -17
- package/dist/server/google-auth-plugin.js.map +1 -1
- package/dist/server/google-oauth.d.ts.map +1 -1
- package/dist/server/google-oauth.js +47 -17
- package/dist/server/google-oauth.js.map +1 -1
- package/dist/server/index.d.ts +1 -1
- package/dist/server/index.d.ts.map +1 -1
- package/dist/server/index.js +1 -1
- package/dist/server/index.js.map +1 -1
- package/dist/server/local-migration.d.ts +41 -0
- package/dist/server/local-migration.d.ts.map +1 -0
- package/dist/server/local-migration.js +235 -0
- package/dist/server/local-migration.js.map +1 -0
- package/dist/server/oauth-public-origin.d.ts.map +1 -1
- package/dist/server/oauth-public-origin.js +19 -1
- package/dist/server/oauth-public-origin.js.map +1 -1
- package/dist/server/onboarding-html.d.ts.map +1 -1
- package/dist/server/onboarding-html.js +74 -19
- package/dist/server/onboarding-html.js.map +1 -1
- package/dist/server/poll.d.ts.map +1 -1
- package/dist/server/poll.js +20 -5
- package/dist/server/poll.js.map +1 -1
- package/dist/server/request-context.d.ts +8 -0
- package/dist/server/request-context.d.ts.map +1 -1
- package/dist/server/request-context.js.map +1 -1
- package/dist/shared/index.d.ts +2 -0
- package/dist/shared/index.d.ts.map +1 -1
- package/dist/shared/index.js +2 -0
- package/dist/shared/index.js.map +1 -1
- package/dist/shared/llm-connection.d.ts +10 -0
- package/dist/shared/llm-connection.d.ts.map +1 -0
- package/dist/shared/llm-connection.js +29 -0
- package/dist/shared/llm-connection.js.map +1 -0
- package/dist/shared/workspace-app-audience.d.ts +25 -0
- package/dist/shared/workspace-app-audience.d.ts.map +1 -0
- package/dist/shared/workspace-app-audience.js +126 -0
- package/dist/shared/workspace-app-audience.js.map +1 -0
- package/dist/shared/workspace-app-id.d.ts +1 -1
- package/dist/shared/workspace-app-id.d.ts.map +1 -1
- package/dist/shared/workspace-app-id.js +1 -0
- package/dist/shared/workspace-app-id.js.map +1 -1
- package/dist/sharing/access.d.ts.map +1 -1
- package/dist/sharing/access.js +46 -5
- package/dist/sharing/access.js.map +1 -1
- package/dist/sharing/actions/list-resource-shares.d.ts.map +1 -1
- package/dist/sharing/actions/list-resource-shares.js +8 -1
- package/dist/sharing/actions/list-resource-shares.js.map +1 -1
- package/dist/sharing/actions/set-resource-visibility.d.ts.map +1 -1
- package/dist/sharing/actions/set-resource-visibility.js +12 -3
- package/dist/sharing/actions/set-resource-visibility.js.map +1 -1
- package/dist/sharing/actions/share-resource.d.ts.map +1 -1
- package/dist/sharing/actions/share-resource.js +50 -1
- package/dist/sharing/actions/share-resource.js.map +1 -1
- package/dist/sharing/registry.d.ts +26 -0
- package/dist/sharing/registry.d.ts.map +1 -1
- package/dist/sharing/registry.js.map +1 -1
- package/dist/styles/agent-native.css +91 -0
- package/dist/templates/default/.agents/skills/adding-a-feature/SKILL.md +72 -0
- package/dist/templates/default/.agents/skills/frontend-design/SKILL.md +60 -37
- package/dist/templates/default/.agents/skills/real-time-sync/SKILL.md +28 -17
- package/dist/templates/default/.agents/skills/shadcn-ui/SKILL.md +79 -0
- package/dist/templates/default/AGENTS.md +22 -19
- package/dist/templates/default/actions/navigate.ts +3 -0
- package/dist/templates/default/app/hooks/use-navigation-state.ts +29 -5
- package/dist/templates/workspace-core/.agents/skills/a2a-protocol/SKILL.md +251 -0
- package/dist/templates/workspace-core/.agents/skills/actions/SKILL.md +264 -0
- package/dist/templates/workspace-core/.agents/skills/adding-a-feature/SKILL.md +130 -0
- package/dist/templates/workspace-core/.agents/skills/address-feedback/SKILL.md +112 -0
- package/dist/templates/workspace-core/.agents/skills/authentication/SKILL.md +88 -0
- package/dist/templates/workspace-core/.agents/skills/automations/SKILL.md +191 -0
- package/dist/templates/workspace-core/.agents/skills/capture-learnings/SKILL.md +74 -0
- package/dist/templates/workspace-core/.agents/skills/client-side-routing/SKILL.md +75 -0
- package/dist/templates/workspace-core/.agents/skills/context-awareness/SKILL.md +190 -0
- package/dist/templates/workspace-core/.agents/skills/create-skill/SKILL.md +168 -0
- package/dist/templates/workspace-core/.agents/skills/delegate-to-agent/SKILL.md +163 -0
- package/dist/templates/workspace-core/.agents/skills/extension-points/SKILL.md +205 -0
- package/dist/templates/workspace-core/.agents/skills/extensions/SKILL.md +720 -0
- package/dist/templates/workspace-core/.agents/skills/frontend-design/SKILL.md +92 -0
- package/dist/templates/workspace-core/.agents/skills/integration-webhooks/SKILL.md +285 -0
- package/dist/templates/workspace-core/.agents/skills/observability/SKILL.md +192 -0
- package/dist/templates/workspace-core/.agents/skills/onboarding/SKILL.md +43 -0
- package/dist/templates/workspace-core/.agents/skills/portability/SKILL.md +84 -0
- package/dist/templates/workspace-core/.agents/skills/qa/SKILL.md +313 -0
- package/dist/templates/workspace-core/.agents/skills/real-time-collab/SKILL.md +112 -0
- package/dist/templates/workspace-core/.agents/skills/real-time-sync/SKILL.md +165 -0
- package/dist/templates/workspace-core/.agents/skills/recurring-jobs/SKILL.md +41 -0
- package/dist/templates/workspace-core/.agents/skills/secrets/SKILL.md +239 -0
- package/dist/templates/workspace-core/.agents/skills/security/SKILL.md +191 -0
- package/dist/templates/workspace-core/.agents/skills/self-modifying-code/SKILL.md +79 -0
- package/dist/templates/workspace-core/.agents/skills/server-plugins/SKILL.md +73 -0
- package/dist/templates/workspace-core/.agents/skills/shadcn-ui/SKILL.md +79 -0
- package/dist/templates/workspace-core/.agents/skills/sharing/SKILL.md +217 -0
- package/dist/templates/workspace-core/.agents/skills/storing-data/SKILL.md +132 -0
- package/dist/templates/workspace-core/.agents/skills/tracking/SKILL.md +150 -0
- package/dist/templates/workspace-core/.agents/skills/voice-transcription/SKILL.md +124 -0
- package/dist/templates/workspace-core/AGENTS.md +16 -1
- package/dist/templates/workspace-root/AGENTS.md +35 -0
- package/dist/templates/workspace-root/README.md +7 -0
- package/dist/tools/actions.d.ts +3 -0
- package/dist/tools/actions.d.ts.map +1 -0
- package/dist/tools/actions.js +272 -0
- package/dist/tools/actions.js.map +1 -0
- package/dist/tools/fetch-tool.d.ts +23 -0
- package/dist/tools/fetch-tool.d.ts.map +1 -0
- package/dist/tools/fetch-tool.js +178 -0
- package/dist/tools/fetch-tool.js.map +1 -0
- package/dist/tools/html-shell.d.ts +45 -0
- package/dist/tools/html-shell.d.ts.map +1 -0
- package/dist/tools/html-shell.js +514 -0
- package/dist/tools/html-shell.js.map +1 -0
- package/dist/tools/proxy-security.d.ts +12 -0
- package/dist/tools/proxy-security.d.ts.map +1 -0
- package/dist/tools/proxy-security.js +158 -0
- package/dist/tools/proxy-security.js.map +1 -0
- package/dist/tools/routes.d.ts +2 -0
- package/dist/tools/routes.d.ts.map +1 -0
- package/dist/tools/routes.js +627 -0
- package/dist/tools/routes.js.map +1 -0
- package/dist/tools/schema.d.ts +664 -0
- package/dist/tools/schema.d.ts.map +1 -0
- package/dist/tools/schema.js +146 -0
- package/dist/tools/schema.js.map +1 -0
- package/dist/tools/slots/routes.d.ts +15 -0
- package/dist/tools/slots/routes.d.ts.map +1 -0
- package/dist/tools/slots/routes.js +94 -0
- package/dist/tools/slots/routes.js.map +1 -0
- package/dist/tools/slots/schema.d.ts +303 -0
- package/dist/tools/slots/schema.d.ts.map +1 -0
- package/dist/tools/slots/schema.js +76 -0
- package/dist/tools/slots/schema.js.map +1 -0
- package/dist/tools/slots/store.d.ts +66 -0
- package/dist/tools/slots/store.d.ts.map +1 -0
- package/dist/tools/slots/store.js +227 -0
- package/dist/tools/slots/store.js.map +1 -0
- package/dist/tools/store.d.ts +40 -0
- package/dist/tools/store.d.ts.map +1 -0
- package/dist/tools/store.js +193 -0
- package/dist/tools/store.js.map +1 -0
- package/dist/tools/theme.d.ts +2 -0
- package/dist/tools/theme.d.ts.map +1 -0
- package/dist/tools/theme.js +67 -0
- package/dist/tools/theme.js.map +1 -0
- package/dist/tools/url-safety.d.ts +24 -0
- package/dist/tools/url-safety.d.ts.map +1 -0
- package/dist/tools/url-safety.js +224 -0
- package/dist/tools/url-safety.js.map +1 -0
- package/dist/vite/action-types-plugin.d.ts.map +1 -1
- package/dist/vite/action-types-plugin.js +4 -0
- package/dist/vite/action-types-plugin.js.map +1 -1
- package/docs/content/authentication.md +36 -0
- package/docs/content/creating-templates.md +15 -0
- package/docs/content/dispatch.md +3 -3
- package/docs/content/multi-app-workspace.md +5 -0
- package/docs/content/tracking.md +12 -0
- package/docs/content/workspace-management.md +39 -4
- package/package.json +15 -12
- package/src/templates/default/.agents/skills/adding-a-feature/SKILL.md +72 -0
- package/src/templates/default/.agents/skills/frontend-design/SKILL.md +60 -37
- package/src/templates/default/.agents/skills/real-time-sync/SKILL.md +28 -17
- package/src/templates/default/.agents/skills/shadcn-ui/SKILL.md +79 -0
- package/src/templates/default/AGENTS.md +22 -19
- package/src/templates/default/actions/navigate.ts +3 -0
- package/src/templates/default/app/hooks/use-navigation-state.ts +29 -5
- package/src/templates/workspace-core/.agents/skills/a2a-protocol/SKILL.md +251 -0
- package/src/templates/workspace-core/.agents/skills/actions/SKILL.md +264 -0
- package/src/templates/workspace-core/.agents/skills/adding-a-feature/SKILL.md +130 -0
- package/src/templates/workspace-core/.agents/skills/address-feedback/SKILL.md +112 -0
- package/src/templates/workspace-core/.agents/skills/authentication/SKILL.md +88 -0
- package/src/templates/workspace-core/.agents/skills/automations/SKILL.md +191 -0
- package/src/templates/workspace-core/.agents/skills/capture-learnings/SKILL.md +74 -0
- package/src/templates/workspace-core/.agents/skills/client-side-routing/SKILL.md +75 -0
- package/src/templates/workspace-core/.agents/skills/context-awareness/SKILL.md +190 -0
- package/src/templates/workspace-core/.agents/skills/create-skill/SKILL.md +168 -0
- package/src/templates/workspace-core/.agents/skills/delegate-to-agent/SKILL.md +163 -0
- package/src/templates/workspace-core/.agents/skills/extension-points/SKILL.md +205 -0
- package/src/templates/workspace-core/.agents/skills/extensions/SKILL.md +720 -0
- package/src/templates/workspace-core/.agents/skills/frontend-design/SKILL.md +92 -0
- package/src/templates/workspace-core/.agents/skills/integration-webhooks/SKILL.md +285 -0
- package/src/templates/workspace-core/.agents/skills/observability/SKILL.md +192 -0
- package/src/templates/workspace-core/.agents/skills/onboarding/SKILL.md +43 -0
- package/src/templates/workspace-core/.agents/skills/portability/SKILL.md +84 -0
- package/src/templates/workspace-core/.agents/skills/qa/SKILL.md +313 -0
- package/src/templates/workspace-core/.agents/skills/real-time-collab/SKILL.md +112 -0
- package/src/templates/workspace-core/.agents/skills/real-time-sync/SKILL.md +165 -0
- package/src/templates/workspace-core/.agents/skills/recurring-jobs/SKILL.md +41 -0
- package/src/templates/workspace-core/.agents/skills/secrets/SKILL.md +239 -0
- package/src/templates/workspace-core/.agents/skills/security/SKILL.md +191 -0
- package/src/templates/workspace-core/.agents/skills/self-modifying-code/SKILL.md +79 -0
- package/src/templates/workspace-core/.agents/skills/server-plugins/SKILL.md +73 -0
- package/src/templates/workspace-core/.agents/skills/shadcn-ui/SKILL.md +79 -0
- package/src/templates/workspace-core/.agents/skills/sharing/SKILL.md +217 -0
- package/src/templates/workspace-core/.agents/skills/storing-data/SKILL.md +132 -0
- package/src/templates/workspace-core/.agents/skills/tracking/SKILL.md +150 -0
- package/src/templates/workspace-core/.agents/skills/voice-transcription/SKILL.md +124 -0
- package/src/templates/workspace-core/AGENTS.md +16 -1
- package/src/templates/workspace-root/AGENTS.md +35 -0
- package/src/templates/workspace-root/README.md +7 -0
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: shadcn-ui
|
|
3
|
+
description: >-
|
|
4
|
+
Use when adding, updating, debugging, styling, or composing shadcn/ui
|
|
5
|
+
components, forms, dialogs, menus, charts, sidebars, themes, registries, or
|
|
6
|
+
any project with a components.json file.
|
|
7
|
+
source: https://ui.shadcn.com/docs/skills
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
# shadcn/ui
|
|
11
|
+
|
|
12
|
+
This skill keeps shadcn/ui work project-aware. Components are source files in the app, so always inspect the local project before adding, importing, or rewriting them.
|
|
13
|
+
|
|
14
|
+
## First Steps
|
|
15
|
+
|
|
16
|
+
1. Work from the app root that owns `components.json`.
|
|
17
|
+
2. Run `pnpm dlx shadcn@latest info --json` when you need current project context: framework, Tailwind version, aliases, icon library, installed components, and resolved paths.
|
|
18
|
+
3. Use the actual aliases from `components.json` or `shadcn info`; do not assume `@/components/ui` if the project says otherwise.
|
|
19
|
+
4. Check `app/components/ui/` or the resolved `ui` path before importing a component.
|
|
20
|
+
5. For unfamiliar components, run `pnpm dlx shadcn@latest docs <component>` and read the returned docs or examples before coding.
|
|
21
|
+
|
|
22
|
+
## Adding Or Updating Components
|
|
23
|
+
|
|
24
|
+
- Add missing primitives with `pnpm dlx shadcn@latest add <component>` from the app root.
|
|
25
|
+
- Before overwriting an existing component, use `pnpm dlx shadcn@latest add <component> --dry-run` and `--diff` to inspect the change.
|
|
26
|
+
- After adding registry code, read the generated files. Fix import aliases, icon imports, missing subcomponents, and composition issues before using the component.
|
|
27
|
+
- Do not fetch raw component files manually from GitHub when the shadcn CLI can resolve the registry item.
|
|
28
|
+
- If a user asks to add a third-party block but does not name a registry, ask which registry to use instead of guessing.
|
|
29
|
+
|
|
30
|
+
## Component Composition
|
|
31
|
+
|
|
32
|
+
- Use existing primitives before custom markup: `Alert` for callouts, `Badge` for small status labels, `Separator` for dividers, `Skeleton` for placeholders, `Table` for tabular data, and `Card` for framed content.
|
|
33
|
+
- Use full card anatomy when appropriate: `CardHeader`, `CardTitle`, `CardDescription`, `CardContent`, and `CardFooter`.
|
|
34
|
+
- Dialog, Sheet, Drawer, and AlertDialog content must include an accessible title. Use visually hidden titles only when the visible UI already communicates the title.
|
|
35
|
+
- Put items inside their group components: `SelectItem` in `SelectGroup`, `DropdownMenuItem` in `DropdownMenuGroup`, `CommandItem` in `CommandGroup`, and equivalent menu groups.
|
|
36
|
+
- `TabsTrigger` belongs inside `TabsList`.
|
|
37
|
+
- `Avatar` always needs `AvatarFallback`.
|
|
38
|
+
- Buttons do not have magic loading props. Compose loading with `disabled`, `Spinner`, and clear text.
|
|
39
|
+
|
|
40
|
+
## Forms And Inputs
|
|
41
|
+
|
|
42
|
+
- Use the app's shadcn form primitives instead of raw div stacks.
|
|
43
|
+
- If `Field`, `FieldGroup`, `FieldSet`, or `InputGroup` are installed or worth adding, use them for form layout, grouped fields, and input add-ons.
|
|
44
|
+
- Do not place buttons inside inputs with absolute positioning. Use `InputGroup` and `InputGroupAddon` when available.
|
|
45
|
+
- Use `ToggleGroup` for small option sets, `RadioGroup` for one-of-many choices, `Checkbox` for multi-select, `Switch` for settings toggles, `Select` or `Combobox` for predefined choices, and `Slider` or numeric input for numeric values.
|
|
46
|
+
- Validation must be accessible: pair visual invalid states with `aria-invalid`, and connect descriptions/errors to controls.
|
|
47
|
+
|
|
48
|
+
## Styling And Theming
|
|
49
|
+
|
|
50
|
+
- Use semantic tokens (`bg-background`, `text-foreground`, `text-muted-foreground`, `bg-primary`, `border-border`, `text-destructive`) instead of raw colors for reusable app UI.
|
|
51
|
+
- Prefer built-in variants and sizes before custom classes.
|
|
52
|
+
- Use `className` mostly for layout and spacing; avoid overriding component colors and typography unless the component is intentionally being extended.
|
|
53
|
+
- Use `gap-*` instead of `space-x-*` / `space-y-*`.
|
|
54
|
+
- Use `size-*` when width and height are equal.
|
|
55
|
+
- Use `truncate` for single-line clipping.
|
|
56
|
+
- Use `cn()` for conditional classes.
|
|
57
|
+
- Do not add manual `z-index` to overlay primitives unless you are fixing a verified stacking bug.
|
|
58
|
+
- Add custom colors as CSS variables in the existing Tailwind CSS file reported by shadcn info. For Tailwind v4, register variables with `@theme inline`.
|
|
59
|
+
|
|
60
|
+
## Icons
|
|
61
|
+
|
|
62
|
+
- Agent-native apps use `@tabler/icons-react`. Do not add `lucide-react` because a registry example used it.
|
|
63
|
+
- If registry code imports a different icon package, replace those imports with Tabler equivalents before finishing.
|
|
64
|
+
- Let shadcn components size icons through their CSS. Avoid manual icon sizing inside buttons, menus, alerts, and sidebars unless the local component API requires it.
|
|
65
|
+
|
|
66
|
+
## Base-Specific APIs
|
|
67
|
+
|
|
68
|
+
Check the project context before using trigger composition APIs:
|
|
69
|
+
|
|
70
|
+
- Radix-based components use `asChild` for custom triggers.
|
|
71
|
+
- Base UI components may use `render` and sometimes `nativeButton={false}`.
|
|
72
|
+
|
|
73
|
+
Do not wrap triggers in extra divs just to place a Button or Link inside them.
|
|
74
|
+
|
|
75
|
+
## Related Skills
|
|
76
|
+
|
|
77
|
+
- **frontend-design** — Product UX, visual direction, responsive polish, and verification
|
|
78
|
+
- **actions** — Data fetching and mutation patterns for agent-native apps
|
|
79
|
+
- **security** — User data, forms, external input, and action safety
|
|
@@ -0,0 +1,217 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: sharing
|
|
3
|
+
description: >-
|
|
4
|
+
Framework-level sharing and privacy for user-authored resources
|
|
5
|
+
(dashboards, documents, forms, decks, etc.). Use when making a resource
|
|
6
|
+
table ownable, wiring list/read/update access checks, or dropping the
|
|
7
|
+
standard share dialog into a template.
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
# Sharing — Private by Default, Explicit Share
|
|
11
|
+
|
|
12
|
+
## Rule
|
|
13
|
+
|
|
14
|
+
Any resource a user **creates** (dashboards, documents, forms, decks, compositions, booking links, issues, analyses) is **private to the creator** by default and visible to others only when they have been **explicitly shared** with or when the creator changes visibility to `org` or `public`.
|
|
15
|
+
|
|
16
|
+
This is the framework-level primitive. Every ownable resource gets it for free — same API, same UI, same skill.
|
|
17
|
+
|
|
18
|
+
## Concepts
|
|
19
|
+
|
|
20
|
+
### Three visibility levels
|
|
21
|
+
|
|
22
|
+
- **`private`** — owner + explicit share grants only. Default.
|
|
23
|
+
- **`org`** — owner + explicit grants + anyone in the same org (read-only).
|
|
24
|
+
- **`public`** — owner + explicit grants + **anyone with the link** (read-only). Public docs do NOT appear in other users' list/sidebar/search results — `accessFilter` omits them by default. They're reachable by id (`resolveAccess` admits them) so direct links and SSR routes like `/p/:id` keep working. If a list endpoint legitimately needs cross-user public discovery (a template gallery, etc.), pass `accessFilter(table, shares, ctx, minRole, { includePublic: true })`.
|
|
25
|
+
|
|
26
|
+
Visibility is coarse. Explicit share grants are fine-grained (per user or per org).
|
|
27
|
+
|
|
28
|
+
### Roles on a share grant
|
|
29
|
+
|
|
30
|
+
- **`viewer`** — read only.
|
|
31
|
+
- **`editor`** — read + write.
|
|
32
|
+
- **`admin`** — read + write + manage shares. Does NOT replace the single `owner_email` on the resource.
|
|
33
|
+
|
|
34
|
+
### Anonymous public URLs stay separate
|
|
35
|
+
|
|
36
|
+
Form "publish" slugs, booking-link slugs, any feature that exposes a URL to unauthenticated users — these are a different axis and are NOT controlled by the sharing system. Keep them alongside it.
|
|
37
|
+
|
|
38
|
+
## Make a resource ownable
|
|
39
|
+
|
|
40
|
+
In your template's `server/db/schema.ts`:
|
|
41
|
+
|
|
42
|
+
```ts
|
|
43
|
+
import {
|
|
44
|
+
table,
|
|
45
|
+
text,
|
|
46
|
+
integer,
|
|
47
|
+
now,
|
|
48
|
+
ownableColumns,
|
|
49
|
+
createSharesTable,
|
|
50
|
+
} from "@agent-native/core/db/schema";
|
|
51
|
+
|
|
52
|
+
export const decks = table("decks", {
|
|
53
|
+
id: text("id").primaryKey(),
|
|
54
|
+
title: text("title").notNull(),
|
|
55
|
+
data: text("data").notNull(),
|
|
56
|
+
createdAt: text("created_at").notNull().default(now()),
|
|
57
|
+
updatedAt: text("updated_at").notNull().default(now()),
|
|
58
|
+
...ownableColumns(), // adds owner_email, org_id, visibility
|
|
59
|
+
});
|
|
60
|
+
|
|
61
|
+
export const deckShares = createSharesTable("deck_shares");
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
Then register it **in `server/db/index.ts`** (not the schema file — keeps the schema file free of the `getDb` closure and avoids circular imports):
|
|
65
|
+
|
|
66
|
+
```ts
|
|
67
|
+
// server/db/index.ts
|
|
68
|
+
import * as schema from "./schema.js";
|
|
69
|
+
import { createGetDb } from "@agent-native/core/db";
|
|
70
|
+
import { registerShareableResource } from "@agent-native/core/sharing";
|
|
71
|
+
|
|
72
|
+
export const getDb = createGetDb(schema);
|
|
73
|
+
export { schema };
|
|
74
|
+
|
|
75
|
+
registerShareableResource({
|
|
76
|
+
type: "deck",
|
|
77
|
+
resourceTable: schema.decks,
|
|
78
|
+
sharesTable: schema.deckShares,
|
|
79
|
+
displayName: "Deck",
|
|
80
|
+
titleColumn: "title",
|
|
81
|
+
getResourcePath: (deck) => `/deck/${deck.id}`,
|
|
82
|
+
getDb,
|
|
83
|
+
});
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
The `type` string is the stable id the UI and actions use. `getDb` is required — the framework-level share actions use it to reach your template's DB.
|
|
87
|
+
|
|
88
|
+
### Restricting public visibility and cross-org user shares
|
|
89
|
+
|
|
90
|
+
Some resources should NOT be reachable by an arbitrary authenticated user even with the link, and should NOT be shareable to an email outside the org. Two optional registration flags lock these axes down:
|
|
91
|
+
|
|
92
|
+
```ts
|
|
93
|
+
registerShareableResource({
|
|
94
|
+
type: "extension",
|
|
95
|
+
// ...
|
|
96
|
+
allowPublic: false, // hides "Public" in the share dialog and rejects it server-side
|
|
97
|
+
requireOrgMemberForUserShares: true, // user shares must target an org member or pending invitee
|
|
98
|
+
});
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
- **`allowPublic: false`** — `set-resource-visibility('public')` throws `ForbiddenError`, `accessFilter` / `resolveAccess` treat any stored `'public'` row as private (defense in depth against bad data), and the share popover hides the "Public" option. `list-resource-shares` returns `policy.allowPublic: false` so the UI follows the server.
|
|
102
|
+
- **`requireOrgMemberForUserShares: true`** — `share-resource` looks up `principalId` in `org_members` and `org_invitations` (pending) for the resource's `orgId` and rejects user shares to anyone else. The same flag also pins `principalType: "org"` shares to the resource's own org — sharing to a *different* org would let that org's members run code in the viewer's auth context (same threat model as a public extension). (The flag name is kept for backward compatibility; treat it as "lock both user and org shares to the resource's org".)
|
|
103
|
+
|
|
104
|
+
Use both for resources that execute code or expose privileged data with the *viewer's* credentials. Extensions ship with both set: an extension's HTML calls actions / SQL / the secrets-injecting proxy as the viewer, so a public or cross-org-shared extension would let a stranger run arbitrary code with someone else's auth context. `scripts/guard-extension-no-public.mjs` (CI + `pnpm prep`) statically enforces that the extension registration keeps both flags set.
|
|
105
|
+
|
|
106
|
+
Defaults match historical behaviour: `allowPublic: true`, `requireOrgMemberForUserShares: false`. Resources that don't set the flags work as before.
|
|
107
|
+
|
|
108
|
+
## Filter list/read queries
|
|
109
|
+
|
|
110
|
+
```ts
|
|
111
|
+
import { accessFilter } from "@agent-native/core/sharing";
|
|
112
|
+
|
|
113
|
+
const rows = await db
|
|
114
|
+
.select()
|
|
115
|
+
.from(schema.decks)
|
|
116
|
+
.where(accessFilter(schema.decks, schema.deckShares));
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
`accessFilter` admits rows the current user owns, has been shared on, or that the user can reach via `org` visibility. `public` rows are NOT admitted by default — see the visibility section above for why and how to opt in.
|
|
120
|
+
|
|
121
|
+
## Guard write actions
|
|
122
|
+
|
|
123
|
+
```ts
|
|
124
|
+
import { assertAccess } from "@agent-native/core/sharing";
|
|
125
|
+
|
|
126
|
+
export default defineAction({
|
|
127
|
+
schema: z.object({ id: z.string(), title: z.string() }),
|
|
128
|
+
run: async (args) => {
|
|
129
|
+
await assertAccess("deck", args.id, "editor");
|
|
130
|
+
// ...proceed
|
|
131
|
+
},
|
|
132
|
+
});
|
|
133
|
+
```
|
|
134
|
+
|
|
135
|
+
For delete actions use `"admin"` (or fold in `"owner"` to require the real owner).
|
|
136
|
+
|
|
137
|
+
## Create actions must set owner
|
|
138
|
+
|
|
139
|
+
When inserting a new row, fill `ownerEmail` and `orgId` from the request context:
|
|
140
|
+
|
|
141
|
+
```ts
|
|
142
|
+
import {
|
|
143
|
+
getRequestUserEmail,
|
|
144
|
+
getRequestOrgId,
|
|
145
|
+
} from "@agent-native/core/server/request-context";
|
|
146
|
+
|
|
147
|
+
await db.insert(schema.decks).values({
|
|
148
|
+
id: nanoid(),
|
|
149
|
+
title,
|
|
150
|
+
data,
|
|
151
|
+
ownerEmail: getRequestUserEmail() ?? "local@localhost",
|
|
152
|
+
orgId: getRequestOrgId(),
|
|
153
|
+
// visibility defaults to 'private'
|
|
154
|
+
// ...
|
|
155
|
+
});
|
|
156
|
+
```
|
|
157
|
+
|
|
158
|
+
## Drop in the share UI
|
|
159
|
+
|
|
160
|
+
```tsx
|
|
161
|
+
import { ShareButton } from "@agent-native/core/client";
|
|
162
|
+
|
|
163
|
+
// In the resource's header/toolbar:
|
|
164
|
+
<ShareButton
|
|
165
|
+
resourceType="deck"
|
|
166
|
+
resourceId={deck.id}
|
|
167
|
+
resourceTitle={deck.title}
|
|
168
|
+
/>;
|
|
169
|
+
```
|
|
170
|
+
|
|
171
|
+
For list views, show `<VisibilityBadge visibility={row.visibility} />` next to each resource.
|
|
172
|
+
|
|
173
|
+
## Actions available everywhere
|
|
174
|
+
|
|
175
|
+
The framework auto-mounts these actions in every template — no per-template boilerplate:
|
|
176
|
+
|
|
177
|
+
| Action | Args | Purpose |
|
|
178
|
+
| -------------------------- | ------------------------------------------------------------------------------ | ----------------------------------------- |
|
|
179
|
+
| `share-resource` | `resourceType, resourceId, principalType, principalId, role, notify?, resourceUrl?` | Grant a user or org access. `notify` defaults to true for individual user shares; `resourceUrl` can provide the direct app link used in the notification email. |
|
|
180
|
+
| `unshare-resource` | `resourceType, resourceId, principalType, principalId` | Revoke access. |
|
|
181
|
+
| `list-resource-shares` | `resourceType, resourceId` | Current visibility + all share grants. |
|
|
182
|
+
| `set-resource-visibility` | `resourceType, resourceId, visibility` | Change to `private` / `org` / `public`. |
|
|
183
|
+
|
|
184
|
+
Both the agent and the UI call these via the same endpoints.
|
|
185
|
+
|
|
186
|
+
## Migration pattern for existing tables
|
|
187
|
+
|
|
188
|
+
When retrofitting an existing resource table:
|
|
189
|
+
|
|
190
|
+
1. Add `owner_email`, `org_id`, `visibility` columns (defaults `'local@localhost'`, `NULL`, `'private'`).
|
|
191
|
+
2. Backfill `owner_email` from any prior creator trail; otherwise leave the default.
|
|
192
|
+
3. Add the companion `{type}_shares` table.
|
|
193
|
+
4. Register via `registerShareableResource`.
|
|
194
|
+
5. Update list/read actions to use `accessFilter`.
|
|
195
|
+
6. Update update/delete actions to `assertAccess` with the correct role.
|
|
196
|
+
7. Add `<ShareButton>` to the resource header.
|
|
197
|
+
8. Add `getResourcePath` in the registration so agent-triggered shares can email a direct link even when no UI supplied `resourceUrl`.
|
|
198
|
+
|
|
199
|
+
## Templates that opt out
|
|
200
|
+
|
|
201
|
+
Sharing doesn't apply to:
|
|
202
|
+
|
|
203
|
+
- **Personal-data apps** (mail, macros) — user-scoped by design.
|
|
204
|
+
- **External source-of-truth apps** (issues → Jira, recruiting → Greenhouse) — ACL lives in the upstream system.
|
|
205
|
+
- **Demo/boilerplate** (starter) — no resources.
|
|
206
|
+
|
|
207
|
+
For these, add a short note to the template's `AGENTS.md` explaining why.
|
|
208
|
+
|
|
209
|
+
## Analytics (follow-up)
|
|
210
|
+
|
|
211
|
+
Dashboards and analyses in the `analytics` template currently live in the settings KV store (`u:<email>:dashboard-*` keys), not SQL. Sharing requires either migrating them to SQL tables (then applying this skill) or extending the settings store with a parallel share overlay. This is a tracked follow-up — see the analytics template's `AGENTS.md`.
|
|
212
|
+
|
|
213
|
+
## Debugging
|
|
214
|
+
|
|
215
|
+
- `ForbiddenError` from an action means the current user isn't owner / hasn't been shared / can't meet the role bar.
|
|
216
|
+
- If the agent can't see a resource it just created, check that the insert actually set `owner_email` from the request context.
|
|
217
|
+
- If a share doesn't take effect in the UI, confirm the template's `list-*` action uses `accessFilter` — the share rows are there but nothing is reading them yet.
|
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: storing-data
|
|
3
|
+
description: >-
|
|
4
|
+
How to store application data in agent-native apps. All data lives in SQL.
|
|
5
|
+
Use when adding data models, deciding where to store data, or reading/writing
|
|
6
|
+
application data.
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
# Storing Data — SQL is the Source of Truth
|
|
10
|
+
|
|
11
|
+
## Rule
|
|
12
|
+
|
|
13
|
+
All application data lives in **SQL** (SQLite locally, cloud database in production). The agent and UI share the same database. There is no filesystem dependency for data.
|
|
14
|
+
|
|
15
|
+
## How It Works
|
|
16
|
+
|
|
17
|
+
Agent-native apps use SQLite via Drizzle ORM + `@libsql/client`. This works locally out of the box and upgrades seamlessly to cloud databases (Turso, Neon, Supabase, D1) by setting `DATABASE_URL`. **Local and production behave identically.**
|
|
18
|
+
|
|
19
|
+
### Core SQL Stores (auto-created, available in all templates)
|
|
20
|
+
|
|
21
|
+
| Store | Purpose | Access |
|
|
22
|
+
| ------------------- | ---------------------------------------------------- | ------------------------------------------ |
|
|
23
|
+
| `application_state` | Ephemeral UI state (compose windows, navigation) | `readAppState()` / `writeAppState()` |
|
|
24
|
+
| `settings` | Persistent KV config (preferences, app settings) | `getSetting()` / `setSetting()` |
|
|
25
|
+
| `oauth_tokens` | OAuth credentials | `@agent-native/core/oauth-tokens` |
|
|
26
|
+
| `sessions` | Auth sessions | `@agent-native/core/server` |
|
|
27
|
+
|
|
28
|
+
### Domain Data (per-template)
|
|
29
|
+
|
|
30
|
+
Define schema with Drizzle ORM in `server/db/schema.ts`. Get a database instance with `const db = getDb()` from `server/db/index.ts`. All queries are async.
|
|
31
|
+
|
|
32
|
+
| Template | Tables |
|
|
33
|
+
| ------------ | --------------------------------------------- |
|
|
34
|
+
| **Mail** | emails, labels (+ Gmail API when connected) |
|
|
35
|
+
| **Calendar** | events, bookings |
|
|
36
|
+
| **Forms** | forms, responses |
|
|
37
|
+
| **Content** | documents |
|
|
38
|
+
| **Slides** | decks (JSON stored in SQL) |
|
|
39
|
+
| **Videos** | compositions in registry + localStorage |
|
|
40
|
+
|
|
41
|
+
### Agent Access
|
|
42
|
+
|
|
43
|
+
The agent uses actions to read/write the database:
|
|
44
|
+
|
|
45
|
+
- `pnpm action db-schema` — Show all tables, columns, types
|
|
46
|
+
- `pnpm action db-query --sql "SELECT * FROM forms"` — Run SELECT queries
|
|
47
|
+
- `pnpm action db-exec --sql "INSERT INTO ..."` — Run INSERT / UPDATE / DELETE / REPLACE. Use for short columns, multi-column writes, computed updates. For several related writes, prefer `--statements '[{"sql":"...","args":[...]}]'` so they run sequentially in one transaction. Schema changes are blocked; use reviewed additive migrations/startup code instead.
|
|
48
|
+
- `pnpm action db-patch --table <t> --column <c> --where "<clause>" --find "<old>" --replace "<new>"` — **Surgical search/replace on a large text column.** Sends the diff instead of re-transmitting the whole value, so it's dramatically more token-efficient than `db-exec UPDATE` when editing multi-kilobyte documents, slide HTML, dashboard/form JSON, etc. Targets exactly one row per call — narrow `--where` by primary key. Supports `--edits '[{find,replace},...]'` for batch edits and `--all` to replace every occurrence.
|
|
49
|
+
- App-specific actions for domain operations (auto-exposed as HTTP endpoints) — **always prefer these over raw SQL when one exists.** They encode business rules, and for editor-backed tables (documents, slides) they also push live Yjs updates to open collaborative editors. `db-patch` is the generic fallback for tables without a dedicated edit action.
|
|
50
|
+
|
|
51
|
+
**How to choose between `db-exec UPDATE` and `db-patch`:**
|
|
52
|
+
|
|
53
|
+
| Scenario | Use |
|
|
54
|
+
| -------------------------------------------------------------- | ------------ |
|
|
55
|
+
| `SET status = 'published'` on one row | `db-exec` |
|
|
56
|
+
| `SET calories = calories + 50` | `db-exec` |
|
|
57
|
+
| Updating several columns at once | `db-exec` |
|
|
58
|
+
| Inserting/updating several rows as one logical operation | `db-exec --statements` |
|
|
59
|
+
| Fixing a typo in a 50KB markdown document's `content` column | `db-patch` |
|
|
60
|
+
| Changing a single key in a dashboard's JSON blob | `db-patch` |
|
|
61
|
+
| Tweaking one paragraph of slide HTML stored in `decks.data` | `db-patch` |
|
|
62
|
+
| Any edit where you'd otherwise re-send thousands of characters | `db-patch` |
|
|
63
|
+
|
|
64
|
+
All of these honor the per-user / per-org data scoping — you can't read or write rows outside the current user's data, regardless of which tool you choose.
|
|
65
|
+
|
|
66
|
+
### Frontend Access
|
|
67
|
+
|
|
68
|
+
The frontend calls actions via their auto-mounted HTTP endpoints using React Query hooks:
|
|
69
|
+
|
|
70
|
+
```ts
|
|
71
|
+
import { useActionQuery, useActionMutation } from "@agent-native/core/client";
|
|
72
|
+
|
|
73
|
+
// Read data (calls GET /_agent-native/actions/list-meals)
|
|
74
|
+
const { data } = useActionQuery<Meal[]>("list-meals", { date: "2025-01-01" });
|
|
75
|
+
|
|
76
|
+
// Write data (calls POST /_agent-native/actions/log-meal)
|
|
77
|
+
const { mutate } = useActionMutation<Meal>("log-meal");
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
Actions are the **preferred way** for the frontend to access data. You rarely need custom `/api/` routes — only for file uploads, streaming, webhooks, or OAuth callbacks.
|
|
81
|
+
|
|
82
|
+
### Cloud Deployment
|
|
83
|
+
|
|
84
|
+
Local SQLite works out of the box. To deploy to production with a cloud database:
|
|
85
|
+
|
|
86
|
+
1. Set `DATABASE_URL` (e.g. `libsql://your-db.turso.io`)
|
|
87
|
+
2. Set `DATABASE_AUTH_TOKEN` for auth
|
|
88
|
+
3. No code changes needed — `@libsql/client` handles both local and remote
|
|
89
|
+
|
|
90
|
+
### Real-time Sync
|
|
91
|
+
|
|
92
|
+
Polling streams database changes to the UI. When the agent writes to the database via scripts, the UI updates automatically via `useDbSync()` which invalidates React Query caches.
|
|
93
|
+
|
|
94
|
+
## Do
|
|
95
|
+
|
|
96
|
+
- Use Drizzle ORM for structured domain data (forms, bookings, documents)
|
|
97
|
+
- Use the `settings` store for app configuration and user preferences
|
|
98
|
+
- Use `application-state` for ephemeral UI state that the agent and UI share
|
|
99
|
+
- Use `oauth-tokens` for OAuth credentials
|
|
100
|
+
- Use core DB scripts (`db-schema`, `db-query`, `db-exec`, `db-patch`) for ad-hoc database operations
|
|
101
|
+
- Use `db-exec --statements` instead of several separate `db-exec` calls for related writes; it is faster and rolls back the whole batch if one statement fails
|
|
102
|
+
- Reach for `db-patch` instead of `db-exec UPDATE` whenever you're making a small change to a large text/JSON column — it's much cheaper on tokens
|
|
103
|
+
|
|
104
|
+
## Don't
|
|
105
|
+
|
|
106
|
+
- Don't store structured app data as JSON files
|
|
107
|
+
- Don't store app state in localStorage, sessionStorage, or cookies (except for UI-only preferences like sidebar width)
|
|
108
|
+
- Don't keep state only in memory (server variables, global stores)
|
|
109
|
+
- Don't use Redis or any external state store for app data
|
|
110
|
+
- Don't interpolate user input directly into SQL queries — use Drizzle ORM's query builder
|
|
111
|
+
|
|
112
|
+
## Security
|
|
113
|
+
|
|
114
|
+
- **SQL injection** — Use Drizzle ORM's query builder, never raw string interpolation for SQL queries
|
|
115
|
+
- **Validate before writing** — Check data shape before writing, especially for user-submitted data
|
|
116
|
+
|
|
117
|
+
## Application State and Context Awareness
|
|
118
|
+
|
|
119
|
+
When storing app-state, include **navigation state** — the agent needs to know what the user is looking at. The `application_state` table holds ephemeral UI state that both the agent and UI share. Key patterns:
|
|
120
|
+
|
|
121
|
+
- **`navigation` key** — the UI writes current view and selection on every route change. The agent reads this before acting.
|
|
122
|
+
- **`navigate` key** — the agent writes one-shot commands to navigate the UI. The UI processes and deletes them.
|
|
123
|
+
- **Domain-specific keys** (e.g., `compose-{id}`) — bidirectional state for features like email drafts.
|
|
124
|
+
|
|
125
|
+
When adding a new data model or feature, also consider what navigation and selection state needs to be exposed via application-state. See the **context-awareness** skill for the full pattern.
|
|
126
|
+
|
|
127
|
+
## Related Skills
|
|
128
|
+
|
|
129
|
+
- **context-awareness** — How to expose navigation and selection state via application-state
|
|
130
|
+
- **real-time-sync** — Set up polling so the UI updates when the database changes
|
|
131
|
+
- **actions** — Create actions with `defineAction` to query the database (auto-exposed as HTTP endpoints)
|
|
132
|
+
- **self-modifying-code** — The agent can also modify the app's source code
|
|
@@ -0,0 +1,150 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: tracking
|
|
3
|
+
description: >-
|
|
4
|
+
Server-side analytics tracking with pluggable providers. Use when adding
|
|
5
|
+
analytics events, registering custom tracking providers, or configuring
|
|
6
|
+
built-in providers (PostHog, Mixpanel, Amplitude, Webhook).
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
# Tracking
|
|
10
|
+
|
|
11
|
+
## Rule
|
|
12
|
+
|
|
13
|
+
The tracking system provides a single `track()` call that fans out to all registered providers. Built-in providers auto-register from env vars -- set the var and tracking starts. Custom providers can be registered for any analytics backend. Tracking is server-side only, best-effort, and never blocks request handling.
|
|
14
|
+
|
|
15
|
+
## How It Works
|
|
16
|
+
|
|
17
|
+
1. At server startup, `registerBuiltinProviders()` checks env vars and registers any configured providers.
|
|
18
|
+
2. Application code calls `track(eventName, properties, meta)` from actions, plugins, or server routes.
|
|
19
|
+
3. The registry fans out the event to every registered provider. Errors are caught and logged -- a failing provider never crashes the caller.
|
|
20
|
+
4. Built-in providers batch HTTP calls (flush every 10 seconds or 50 events, whichever comes first).
|
|
21
|
+
|
|
22
|
+
## API
|
|
23
|
+
|
|
24
|
+
### `track(name, properties?, meta?)`
|
|
25
|
+
|
|
26
|
+
Fire an analytics event.
|
|
27
|
+
|
|
28
|
+
```ts
|
|
29
|
+
import { track } from "@agent-native/core/tracking";
|
|
30
|
+
|
|
31
|
+
track("meal.logged", { mealName: "Salad", calories: 350 }, { userId: "owner@example.com" });
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
### `identify(userId, traits?)`
|
|
35
|
+
|
|
36
|
+
Identify a user with traits. Forwarded to providers that support it.
|
|
37
|
+
|
|
38
|
+
```ts
|
|
39
|
+
import { identify } from "@agent-native/core/tracking";
|
|
40
|
+
|
|
41
|
+
identify("owner@example.com", { plan: "pro", company: "Example Co" });
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
### `registerTrackingProvider(provider)`
|
|
45
|
+
|
|
46
|
+
Register a custom provider.
|
|
47
|
+
|
|
48
|
+
```ts
|
|
49
|
+
import { registerTrackingProvider } from "@agent-native/core/tracking";
|
|
50
|
+
|
|
51
|
+
registerTrackingProvider({
|
|
52
|
+
name: "my-analytics",
|
|
53
|
+
track(event) {
|
|
54
|
+
// Send event to your backend
|
|
55
|
+
},
|
|
56
|
+
identify(userId, traits) {
|
|
57
|
+
// Optional
|
|
58
|
+
},
|
|
59
|
+
flush() {
|
|
60
|
+
// Optional -- called on graceful shutdown
|
|
61
|
+
},
|
|
62
|
+
});
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
### `flushTracking()`
|
|
66
|
+
|
|
67
|
+
Flush all providers (call before process exit).
|
|
68
|
+
|
|
69
|
+
## Built-in Providers
|
|
70
|
+
|
|
71
|
+
Set the env var and the provider auto-registers at startup. No SDK dependencies -- all providers use raw HTTP.
|
|
72
|
+
|
|
73
|
+
| Provider | Env vars |
|
|
74
|
+
| ---------- | --------------------------------------------------------- |
|
|
75
|
+
| PostHog | `POSTHOG_API_KEY` (required), `POSTHOG_HOST` (optional, defaults to `https://us.i.posthog.com`) |
|
|
76
|
+
| Mixpanel | `MIXPANEL_TOKEN` |
|
|
77
|
+
| Amplitude | `AMPLITUDE_API_KEY` |
|
|
78
|
+
| Agent Native Analytics | `AGENT_NATIVE_ANALYTICS_PUBLIC_KEY` (server), `AGENT_NATIVE_ANALYTICS_ENDPOINT` (optional, defaults to `https://analytics.agent-native.com/track`) |
|
|
79
|
+
| Webhook | `TRACKING_WEBHOOK_URL` (required), `TRACKING_WEBHOOK_AUTH` (optional, sent as `Authorization` header) |
|
|
80
|
+
|
|
81
|
+
Multiple providers can be active simultaneously. All receive every event.
|
|
82
|
+
|
|
83
|
+
Browser-side `trackEvent()` also forwards to Agent Native Analytics when `VITE_AGENT_NATIVE_ANALYTICS_PUBLIC_KEY` is present. Use `VITE_AGENT_NATIVE_ANALYTICS_ENDPOINT` to override the default browser endpoint. The built-in Agent Native Analytics sender is quiet on localhost/local dev by default; set `AGENT_NATIVE_ANALYTICS_ALLOW_LOCALHOST=true` only for an intentional local ingestion test.
|
|
84
|
+
|
|
85
|
+
## Default Baseline Events
|
|
86
|
+
|
|
87
|
+
Template roots call `configureTracking()` once during app startup. That installs default browser pageview tracking for hosted apps:
|
|
88
|
+
|
|
89
|
+
- Event: `pageview`
|
|
90
|
+
- Fires on initial load, `history.pushState`, `history.replaceState`, and `popstate`
|
|
91
|
+
- De-dupes repeated events for the same URL
|
|
92
|
+
- Includes `url`, `path`, `hostname`, `referrer`, `title`, `navigation_type`, `app`, and inferred `template`
|
|
93
|
+
- Does not send first-party events from localhost/local dev
|
|
94
|
+
|
|
95
|
+
### Visitor identity (`anonymousId` + `sessionId`)
|
|
96
|
+
|
|
97
|
+
Every browser-side `trackEvent()` POST to the Agent Native Analytics `/track` endpoint includes:
|
|
98
|
+
|
|
99
|
+
- `anonymousId` — persistent per-browser visitor ID stored in `localStorage` under `agent-native.anonymous_id`. Generated once and reused across sessions. Use this for unique-visitor and returning-visitor metrics.
|
|
100
|
+
- `sessionId` — rotating per-visit ID stored in `localStorage` under `agent-native.session_id`, with a 30-minute idle timeout (matches GA4 / Mixpanel defaults). Use this for sessions-per-visitor, pages-per-session, and session-duration metrics.
|
|
101
|
+
- `userId` — only set when the calling code passes `properties.userId`. Anonymous traffic leaves this NULL by design; `anonymousId` is the fallback.
|
|
102
|
+
|
|
103
|
+
These fields land in the `analytics_events.anonymous_id`, `analytics_events.session_id`, and `analytics_events.user_id` columns in the analytics template. Storage access is wrapped in try/catch — private-browsing / blocked-storage clients silently degrade to NULL rather than crashing the page.
|
|
104
|
+
|
|
105
|
+
Other framework-level baseline events:
|
|
106
|
+
|
|
107
|
+
- `session status` from `useSession()`, with `signed_in`
|
|
108
|
+
- `signup` from Better Auth user creation, with `auth_provider` and `auth_user_id`
|
|
109
|
+
- `builder connect started`, `builder connect succeeded`, `builder connect failed`, `builder disconnect succeeded`, and `builder disconnect failed` from the Builder connection routes
|
|
110
|
+
|
|
111
|
+
For new lifecycle events, call `track()` server-side when the server is the source of truth, and `trackEvent()` client-side only for browser interactions.
|
|
112
|
+
|
|
113
|
+
## Provider Interface
|
|
114
|
+
|
|
115
|
+
```ts
|
|
116
|
+
interface TrackingProvider {
|
|
117
|
+
name: string;
|
|
118
|
+
track(event: TrackingEvent): void | Promise<void>;
|
|
119
|
+
identify?(userId: string, traits?: Record<string, unknown>): void | Promise<void>;
|
|
120
|
+
flush?(): void | Promise<void>;
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
interface TrackingEvent {
|
|
124
|
+
name: string;
|
|
125
|
+
properties?: Record<string, unknown>;
|
|
126
|
+
timestamp?: string;
|
|
127
|
+
userId?: string;
|
|
128
|
+
}
|
|
129
|
+
```
|
|
130
|
+
|
|
131
|
+
## Design Decisions
|
|
132
|
+
|
|
133
|
+
- **globalThis singleton** -- the registry uses a `Symbol.for` key on globalThis so multiple ESM graph instances (dev-mode Vite + Nitro, symlinks) share one provider set.
|
|
134
|
+
- **Best-effort fan-out** -- provider errors are caught and logged, never propagated. A broken analytics integration must not break app functionality.
|
|
135
|
+
- **Batched HTTP** -- built-in providers enqueue events and flush every 10 seconds or 50 events, minimizing outbound requests.
|
|
136
|
+
- **NOT bridged to the event bus** -- tracking and the event bus are separate concerns. The event bus is for triggering automations; tracking is for analytics. Do not subscribe to `track()` calls from the event bus or vice versa.
|
|
137
|
+
|
|
138
|
+
## Key Files
|
|
139
|
+
|
|
140
|
+
| File | Purpose |
|
|
141
|
+
| ---------------------------------------------- | ------------------------------------------- |
|
|
142
|
+
| `packages/core/src/tracking/registry.ts` | `track()`, `identify()`, `registerTrackingProvider()`, `flushTracking()` |
|
|
143
|
+
| `packages/core/src/tracking/providers.ts` | Built-in providers (PostHog, Mixpanel, Amplitude, Agent Native Analytics, Webhook) and `registerBuiltinProviders()` |
|
|
144
|
+
| `packages/core/src/tracking/types.ts` | `TrackingEvent` and `TrackingProvider` interfaces |
|
|
145
|
+
|
|
146
|
+
## Related Skills
|
|
147
|
+
|
|
148
|
+
- `secrets` -- API keys for tracking providers can be registered as secrets
|
|
149
|
+
- `server-plugins` -- `registerBuiltinProviders()` is called by the core-routes plugin at startup
|
|
150
|
+
- `actions` -- call `track()` from action handlers to record user/agent activity
|