@agent-native/core 0.6.1 → 0.7.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 +43 -3
- package/dist/agent/production-agent.d.ts.map +1 -1
- package/dist/agent/production-agent.js +154 -4
- package/dist/agent/production-agent.js.map +1 -1
- package/dist/agent/types.d.ts +1 -1
- package/dist/agent/types.d.ts.map +1 -1
- package/dist/cli/create-workspace.d.ts +8 -0
- package/dist/cli/create-workspace.d.ts.map +1 -0
- package/dist/cli/create-workspace.js +18 -0
- package/dist/cli/create-workspace.js.map +1 -0
- package/dist/cli/create.d.ts +35 -7
- package/dist/cli/create.d.ts.map +1 -1
- package/dist/cli/create.js +444 -251
- package/dist/cli/create.js.map +1 -1
- package/dist/cli/index.js +59 -5
- package/dist/cli/index.js.map +1 -1
- package/dist/cli/workspacify.d.ts +18 -0
- package/dist/cli/workspacify.d.ts.map +1 -0
- package/dist/cli/workspacify.js +74 -0
- package/dist/cli/workspacify.js.map +1 -0
- package/dist/client/AgentPanel.d.ts +1 -1
- package/dist/client/AgentPanel.d.ts.map +1 -1
- package/dist/client/AgentPanel.js +63 -225
- package/dist/client/AgentPanel.js.map +1 -1
- package/dist/client/components/CodeRequiredDialog.d.ts.map +1 -1
- package/dist/client/components/CodeRequiredDialog.js +86 -5
- package/dist/client/components/CodeRequiredDialog.js.map +1 -1
- package/dist/client/composer/MentionPopover.d.ts.map +1 -1
- package/dist/client/composer/MentionPopover.js +15 -2
- package/dist/client/composer/MentionPopover.js.map +1 -1
- package/dist/client/composer/TiptapComposer.d.ts.map +1 -1
- package/dist/client/composer/TiptapComposer.js +3 -1
- package/dist/client/composer/TiptapComposer.js.map +1 -1
- package/dist/client/composer/types.d.ts +1 -1
- package/dist/client/composer/types.d.ts.map +1 -1
- package/dist/client/integrations/IntegrationsPanel.d.ts.map +1 -1
- package/dist/client/integrations/IntegrationsPanel.js +22 -9
- package/dist/client/integrations/IntegrationsPanel.js.map +1 -1
- package/dist/client/onboarding/OnboardingBanner.d.ts +13 -0
- package/dist/client/onboarding/OnboardingBanner.d.ts.map +1 -0
- package/dist/client/onboarding/OnboardingBanner.js +36 -0
- package/dist/client/onboarding/OnboardingBanner.js.map +1 -0
- package/dist/client/onboarding/OnboardingPanel.d.ts +16 -0
- package/dist/client/onboarding/OnboardingPanel.d.ts.map +1 -0
- package/dist/client/onboarding/OnboardingPanel.js +360 -0
- package/dist/client/onboarding/OnboardingPanel.js.map +1 -0
- package/dist/client/onboarding/SetupButton.d.ts +10 -0
- package/dist/client/onboarding/SetupButton.d.ts.map +1 -0
- package/dist/client/onboarding/SetupButton.js +26 -0
- package/dist/client/onboarding/SetupButton.js.map +1 -0
- package/dist/client/onboarding/index.d.ts +12 -0
- package/dist/client/onboarding/index.d.ts.map +1 -0
- package/dist/client/onboarding/index.js +11 -0
- package/dist/client/onboarding/index.js.map +1 -0
- package/dist/client/onboarding/use-onboarding.d.ts +34 -0
- package/dist/client/onboarding/use-onboarding.d.ts.map +1 -0
- package/dist/client/onboarding/use-onboarding.js +101 -0
- package/dist/client/onboarding/use-onboarding.js.map +1 -0
- package/dist/client/org/TeamPage.d.ts +6 -1
- package/dist/client/org/TeamPage.d.ts.map +1 -1
- package/dist/client/org/TeamPage.js +85 -14
- package/dist/client/org/TeamPage.js.map +1 -1
- package/dist/client/resources/ResourceEditor.d.ts.map +1 -1
- package/dist/client/resources/ResourceEditor.js +48 -77
- package/dist/client/resources/ResourceEditor.js.map +1 -1
- package/dist/client/resources/ResourceTree.d.ts.map +1 -1
- package/dist/client/resources/ResourceTree.js +16 -3
- package/dist/client/resources/ResourceTree.js.map +1 -1
- package/dist/client/resources/ResourcesPanel.d.ts.map +1 -1
- package/dist/client/resources/ResourcesPanel.js +135 -9
- package/dist/client/resources/ResourcesPanel.js.map +1 -1
- package/dist/client/resources/use-resources.d.ts +5 -0
- package/dist/client/resources/use-resources.d.ts.map +1 -1
- package/dist/client/resources/use-resources.js.map +1 -1
- package/dist/client/settings/AgentsSection.d.ts +2 -0
- package/dist/client/settings/AgentsSection.d.ts.map +1 -0
- package/dist/client/settings/AgentsSection.js +198 -0
- package/dist/client/settings/AgentsSection.js.map +1 -0
- package/dist/client/settings/BackgroundAgentSection.d.ts +2 -0
- package/dist/client/settings/BackgroundAgentSection.d.ts.map +1 -0
- package/dist/client/settings/BackgroundAgentSection.js +46 -0
- package/dist/client/settings/BackgroundAgentSection.js.map +1 -0
- package/dist/client/settings/BrowserSection.d.ts +2 -0
- package/dist/client/settings/BrowserSection.d.ts.map +1 -0
- package/dist/client/settings/BrowserSection.js +10 -0
- package/dist/client/settings/BrowserSection.js.map +1 -0
- package/dist/client/settings/ComingSoonSection.d.ts +13 -0
- package/dist/client/settings/ComingSoonSection.d.ts.map +1 -0
- package/dist/client/settings/ComingSoonSection.js +9 -0
- package/dist/client/settings/ComingSoonSection.js.map +1 -0
- package/dist/client/settings/LLMSection.d.ts +2 -0
- package/dist/client/settings/LLMSection.d.ts.map +1 -0
- package/dist/client/settings/LLMSection.js +64 -0
- package/dist/client/settings/LLMSection.js.map +1 -0
- package/dist/client/settings/SettingsPanel.d.ts +8 -0
- package/dist/client/settings/SettingsPanel.d.ts.map +1 -0
- package/dist/client/settings/SettingsPanel.js +118 -0
- package/dist/client/settings/SettingsPanel.js.map +1 -0
- package/dist/client/settings/SettingsSection.d.ts +19 -0
- package/dist/client/settings/SettingsSection.d.ts.map +1 -0
- package/dist/client/settings/SettingsSection.js +10 -0
- package/dist/client/settings/SettingsSection.js.map +1 -0
- package/dist/client/settings/index.d.ts +3 -0
- package/dist/client/settings/index.d.ts.map +1 -0
- package/dist/client/settings/index.js +3 -0
- package/dist/client/settings/index.js.map +1 -0
- package/dist/client/settings/useBuilderStatus.d.ts +22 -0
- package/dist/client/settings/useBuilderStatus.d.ts.map +1 -0
- package/dist/client/settings/useBuilderStatus.js +41 -0
- package/dist/client/settings/useBuilderStatus.js.map +1 -0
- package/dist/deploy/build.js +198 -54
- package/dist/deploy/build.js.map +1 -1
- package/dist/deploy/route-discovery.d.ts +5 -0
- package/dist/deploy/route-discovery.d.ts.map +1 -1
- package/dist/deploy/route-discovery.js +38 -7
- package/dist/deploy/route-discovery.js.map +1 -1
- package/dist/deploy/workspace-core.d.ts +28 -0
- package/dist/deploy/workspace-core.d.ts.map +1 -0
- package/dist/deploy/workspace-core.js +223 -0
- package/dist/deploy/workspace-core.js.map +1 -0
- package/dist/deploy/workspace-deploy.d.ts +11 -0
- package/dist/deploy/workspace-deploy.d.ts.map +1 -0
- package/dist/deploy/workspace-deploy.js +148 -0
- package/dist/deploy/workspace-deploy.js.map +1 -0
- package/dist/file-upload/builder.d.ts +11 -0
- package/dist/file-upload/builder.d.ts.map +1 -0
- package/dist/file-upload/builder.js +53 -0
- package/dist/file-upload/builder.js.map +1 -0
- package/dist/file-upload/index.d.ts +4 -0
- package/dist/file-upload/index.d.ts.map +1 -0
- package/dist/file-upload/index.js +3 -0
- package/dist/file-upload/index.js.map +1 -0
- package/dist/file-upload/registry.d.ts +23 -0
- package/dist/file-upload/registry.d.ts.map +1 -0
- package/dist/file-upload/registry.js +52 -0
- package/dist/file-upload/registry.js.map +1 -0
- package/dist/file-upload/types.d.ts +37 -0
- package/dist/file-upload/types.d.ts.map +1 -0
- package/dist/file-upload/types.js +10 -0
- package/dist/file-upload/types.js.map +1 -0
- package/dist/integrations/adapters/google-docs.d.ts +89 -0
- package/dist/integrations/adapters/google-docs.d.ts.map +1 -0
- package/dist/integrations/adapters/google-docs.js +261 -0
- package/dist/integrations/adapters/google-docs.js.map +1 -0
- package/dist/integrations/adapters/slack.d.ts.map +1 -1
- package/dist/integrations/adapters/slack.js +34 -0
- package/dist/integrations/adapters/slack.js.map +1 -1
- package/dist/integrations/adapters/telegram.d.ts.map +1 -1
- package/dist/integrations/adapters/telegram.js +32 -0
- package/dist/integrations/adapters/telegram.js.map +1 -1
- package/dist/integrations/google-docs-poller.d.ts +54 -0
- package/dist/integrations/google-docs-poller.d.ts.map +1 -0
- package/dist/integrations/google-docs-poller.js +442 -0
- package/dist/integrations/google-docs-poller.js.map +1 -0
- package/dist/integrations/index.d.ts +2 -0
- package/dist/integrations/index.d.ts.map +1 -1
- package/dist/integrations/index.js +3 -0
- package/dist/integrations/index.js.map +1 -1
- package/dist/integrations/plugin.d.ts.map +1 -1
- package/dist/integrations/plugin.js +49 -2
- package/dist/integrations/plugin.js.map +1 -1
- package/dist/integrations/types.d.ts +33 -0
- package/dist/integrations/types.d.ts.map +1 -1
- package/dist/integrations/webhook-handler.d.ts +10 -1
- package/dist/integrations/webhook-handler.d.ts.map +1 -1
- package/dist/integrations/webhook-handler.js +13 -3
- package/dist/integrations/webhook-handler.js.map +1 -1
- package/dist/jobs/scheduler.d.ts +3 -0
- package/dist/jobs/scheduler.d.ts.map +1 -1
- package/dist/jobs/scheduler.js +81 -60
- package/dist/jobs/scheduler.js.map +1 -1
- package/dist/jobs/tools.d.ts.map +1 -1
- package/dist/jobs/tools.js +20 -3
- package/dist/jobs/tools.js.map +1 -1
- package/dist/mcp-client/config.d.ts +46 -0
- package/dist/mcp-client/config.d.ts.map +1 -0
- package/dist/mcp-client/config.js +152 -0
- package/dist/mcp-client/config.js.map +1 -0
- package/dist/mcp-client/index.d.ts +17 -0
- package/dist/mcp-client/index.d.ts.map +1 -0
- package/dist/mcp-client/index.js +53 -0
- package/dist/mcp-client/index.js.map +1 -0
- package/dist/mcp-client/manager.d.ts +76 -0
- package/dist/mcp-client/manager.d.ts.map +1 -0
- package/dist/mcp-client/manager.js +212 -0
- package/dist/mcp-client/manager.js.map +1 -0
- package/dist/oauth-tokens/store.d.ts.map +1 -1
- package/dist/oauth-tokens/store.js +3 -1
- package/dist/oauth-tokens/store.js.map +1 -1
- package/dist/onboarding/default-steps.d.ts +10 -0
- package/dist/onboarding/default-steps.d.ts.map +1 -0
- package/dist/onboarding/default-steps.js +164 -0
- package/dist/onboarding/default-steps.js.map +1 -0
- package/dist/onboarding/index.d.ts +12 -0
- package/dist/onboarding/index.d.ts.map +1 -0
- package/dist/onboarding/index.js +11 -0
- package/dist/onboarding/index.js.map +1 -0
- package/dist/onboarding/plugin.d.ts +19 -0
- package/dist/onboarding/plugin.d.ts.map +1 -0
- package/dist/onboarding/plugin.js +147 -0
- package/dist/onboarding/plugin.js.map +1 -0
- package/dist/onboarding/registry.d.ts +24 -0
- package/dist/onboarding/registry.d.ts.map +1 -0
- package/dist/onboarding/registry.js +40 -0
- package/dist/onboarding/registry.js.map +1 -0
- package/dist/onboarding/types.d.ts +71 -0
- package/dist/onboarding/types.d.ts.map +1 -0
- package/dist/onboarding/types.js +10 -0
- package/dist/onboarding/types.js.map +1 -0
- package/dist/resources/agents.d.ts +4 -0
- package/dist/resources/agents.d.ts.map +1 -0
- package/dist/resources/agents.js +44 -0
- package/dist/resources/agents.js.map +1 -0
- package/dist/resources/handlers.d.ts +17 -0
- package/dist/resources/handlers.d.ts.map +1 -1
- package/dist/resources/handlers.js +49 -12
- package/dist/resources/handlers.js.map +1 -1
- package/dist/resources/metadata.d.ts +48 -0
- package/dist/resources/metadata.d.ts.map +1 -0
- package/dist/resources/metadata.js +150 -0
- package/dist/resources/metadata.js.map +1 -0
- package/dist/resources/script-helpers.d.ts.map +1 -1
- package/dist/resources/script-helpers.js +3 -2
- package/dist/resources/script-helpers.js.map +1 -1
- package/dist/resources/store.d.ts.map +1 -1
- package/dist/resources/store.js +32 -17
- package/dist/resources/store.js.map +1 -1
- package/dist/scripts/call-agent.d.ts.map +1 -1
- package/dist/scripts/call-agent.js +3 -2
- package/dist/scripts/call-agent.js.map +1 -1
- package/dist/scripts/chat/search-chats.d.ts.map +1 -1
- package/dist/scripts/chat/search-chats.js +2 -1
- package/dist/scripts/chat/search-chats.js.map +1 -1
- package/dist/scripts/core-scripts.d.ts.map +1 -1
- package/dist/scripts/core-scripts.js +2 -0
- package/dist/scripts/core-scripts.js.map +1 -1
- package/dist/scripts/db/scoping.d.ts.map +1 -1
- package/dist/scripts/db/scoping.js +3 -2
- package/dist/scripts/db/scoping.js.map +1 -1
- package/dist/scripts/docs/index.d.ts +2 -0
- package/dist/scripts/docs/index.d.ts.map +1 -0
- package/dist/scripts/docs/index.js +4 -0
- package/dist/scripts/docs/index.js.map +1 -0
- package/dist/scripts/docs/search.d.ts +13 -0
- package/dist/scripts/docs/search.d.ts.map +1 -0
- package/dist/scripts/docs/search.js +130 -0
- package/dist/scripts/docs/search.js.map +1 -0
- package/dist/scripts/resources/delete-memory.d.ts +7 -0
- package/dist/scripts/resources/delete-memory.d.ts.map +1 -0
- package/dist/scripts/resources/delete-memory.js +49 -0
- package/dist/scripts/resources/delete-memory.js.map +1 -0
- package/dist/scripts/resources/delete.d.ts.map +1 -1
- package/dist/scripts/resources/delete.js +2 -1
- package/dist/scripts/resources/delete.js.map +1 -1
- package/dist/scripts/resources/index.d.ts.map +1 -1
- package/dist/scripts/resources/index.js +2 -0
- package/dist/scripts/resources/index.js.map +1 -1
- package/dist/scripts/resources/list.d.ts.map +1 -1
- package/dist/scripts/resources/list.js +2 -1
- package/dist/scripts/resources/list.js.map +1 -1
- package/dist/scripts/resources/migrate-learnings.d.ts.map +1 -1
- package/dist/scripts/resources/migrate-learnings.js +2 -1
- package/dist/scripts/resources/migrate-learnings.js.map +1 -1
- package/dist/scripts/resources/read.d.ts.map +1 -1
- package/dist/scripts/resources/read.js +2 -1
- package/dist/scripts/resources/read.js.map +1 -1
- package/dist/scripts/resources/save-memory.d.ts +9 -0
- package/dist/scripts/resources/save-memory.d.ts.map +1 -0
- package/dist/scripts/resources/save-memory.js +78 -0
- package/dist/scripts/resources/save-memory.js.map +1 -0
- package/dist/scripts/resources/write.d.ts.map +1 -1
- package/dist/scripts/resources/write.js +2 -1
- package/dist/scripts/resources/write.js.map +1 -1
- package/dist/scripts/utils.d.ts +10 -1
- package/dist/scripts/utils.d.ts.map +1 -1
- package/dist/scripts/utils.js +45 -2
- package/dist/scripts/utils.js.map +1 -1
- package/dist/server/action-discovery.d.ts +5 -0
- package/dist/server/action-discovery.d.ts.map +1 -1
- package/dist/server/action-discovery.js +51 -20
- 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 +63 -57
- package/dist/server/action-routes.js.map +1 -1
- package/dist/server/agent-chat-plugin.d.ts +3 -0
- package/dist/server/agent-chat-plugin.d.ts.map +1 -1
- package/dist/server/agent-chat-plugin.js +363 -48
- package/dist/server/agent-chat-plugin.js.map +1 -1
- package/dist/server/agent-discovery.d.ts.map +1 -1
- package/dist/server/agent-discovery.js +11 -23
- package/dist/server/agent-discovery.js.map +1 -1
- package/dist/server/agent-teams.d.ts.map +1 -1
- package/dist/server/agent-teams.js +2 -1
- package/dist/server/agent-teams.js.map +1 -1
- package/dist/server/agents-bundle.d.ts +33 -5
- package/dist/server/agents-bundle.d.ts.map +1 -1
- package/dist/server/agents-bundle.js +108 -64
- package/dist/server/agents-bundle.js.map +1 -1
- package/dist/server/auth.d.ts +1 -0
- package/dist/server/auth.d.ts.map +1 -1
- package/dist/server/auth.js +172 -60
- package/dist/server/auth.js.map +1 -1
- package/dist/server/better-auth-instance.d.ts.map +1 -1
- package/dist/server/better-auth-instance.js +202 -6
- package/dist/server/better-auth-instance.js.map +1 -1
- package/dist/server/builder-browser.d.ts +40 -0
- package/dist/server/builder-browser.d.ts.map +1 -0
- package/dist/server/builder-browser.js +166 -0
- package/dist/server/builder-browser.js.map +1 -0
- package/dist/server/core-routes-plugin.d.ts.map +1 -1
- package/dist/server/core-routes-plugin.js +152 -6
- package/dist/server/core-routes-plugin.js.map +1 -1
- package/dist/server/credential-provider.d.ts +37 -0
- package/dist/server/credential-provider.d.ts.map +1 -0
- package/dist/server/credential-provider.js +49 -0
- package/dist/server/credential-provider.js.map +1 -0
- package/dist/server/framework-request-handler.d.ts.map +1 -1
- package/dist/server/framework-request-handler.js +42 -3
- package/dist/server/framework-request-handler.js.map +1 -1
- package/dist/server/google-auth-plugin.js +1 -1
- package/dist/server/google-oauth.d.ts +1 -1
- package/dist/server/google-oauth.d.ts.map +1 -1
- package/dist/server/google-oauth.js +15 -10
- package/dist/server/google-oauth.js.map +1 -1
- package/dist/server/index.d.ts +3 -0
- package/dist/server/index.d.ts.map +1 -1
- package/dist/server/index.js +3 -0
- package/dist/server/index.js.map +1 -1
- package/dist/server/oauth-helpers.d.ts +1 -0
- package/dist/server/oauth-helpers.d.ts.map +1 -1
- package/dist/server/oauth-helpers.js +5 -4
- package/dist/server/oauth-helpers.js.map +1 -1
- package/dist/server/onboarding-html.d.ts.map +1 -1
- package/dist/server/onboarding-html.js +94 -3
- package/dist/server/onboarding-html.js.map +1 -1
- package/dist/server/request-context.d.ts +20 -0
- package/dist/server/request-context.d.ts.map +1 -0
- package/dist/server/request-context.js +41 -0
- package/dist/server/request-context.js.map +1 -0
- package/dist/templates/default/.agents/skills/actions/SKILL.md +2 -1
- package/dist/templates/default/.agents/skills/security/SKILL.md +145 -40
- package/dist/templates/default/.agents/skills/storing-data/SKILL.md +7 -1
- package/dist/templates/default/_gitignore +1 -0
- package/dist/templates/default/app/root.tsx +4 -1
- package/dist/templates/workspace-core/AGENTS.md +62 -0
- package/dist/templates/workspace-core/actions/company-directory.ts +38 -0
- package/dist/templates/workspace-core/package.json +39 -0
- package/dist/templates/workspace-core/skills/company-policies/SKILL.md +42 -0
- package/dist/templates/workspace-core/src/client/AuthenticatedLayout.tsx +37 -0
- package/dist/templates/workspace-core/src/client/index.ts +26 -0
- package/dist/templates/workspace-core/src/credentials.ts +29 -0
- package/dist/templates/workspace-core/src/index.ts +21 -0
- package/dist/templates/workspace-core/src/server/agent-chat-plugin.ts +30 -0
- package/dist/templates/workspace-core/src/server/auth-plugin.ts +35 -0
- package/dist/templates/workspace-core/src/server/index.ts +22 -0
- package/dist/templates/workspace-core/tailwind.preset.ts +34 -0
- package/dist/templates/workspace-core/tsconfig.json +9 -0
- package/dist/templates/workspace-root/.env.example +37 -0
- package/dist/templates/workspace-root/README.md +62 -0
- package/dist/templates/workspace-root/_gitignore +23 -0
- package/dist/templates/workspace-root/package.json +18 -0
- package/dist/templates/workspace-root/pnpm-workspace.yaml +3 -0
- package/dist/templates/workspace-root/tsconfig.base.json +21 -0
- package/dist/vite/agents-bundle-plugin.d.ts.map +1 -1
- package/dist/vite/agents-bundle-plugin.js +65 -15
- package/dist/vite/agents-bundle-plugin.js.map +1 -1
- package/dist/vite/client.d.ts +16 -0
- package/dist/vite/client.d.ts.map +1 -1
- package/dist/vite/client.js +75 -0
- package/dist/vite/client.js.map +1 -1
- package/docs/content/a2a-protocol.md +223 -0
- package/docs/content/actions.md +129 -0
- package/docs/content/agent-mentions.md +171 -0
- package/docs/content/authentication.md +155 -0
- package/docs/content/cli-adapters.md +244 -0
- package/docs/content/client.md +175 -0
- package/docs/content/context-awareness.md +168 -0
- package/docs/content/creating-templates.md +311 -0
- package/docs/content/database.md +82 -0
- package/docs/content/deployment.md +180 -0
- package/docs/content/enterprise-workspace.md +235 -0
- package/docs/content/faq.md +101 -0
- package/docs/content/file-uploads.md +102 -0
- package/docs/content/frames.md +47 -0
- package/docs/content/getting-started.md +104 -0
- package/docs/content/integrations.md +198 -0
- package/docs/content/key-concepts.md +246 -0
- package/docs/content/mcp-clients.md +110 -0
- package/docs/content/mcp-protocol.md +168 -0
- package/docs/content/onboarding.md +107 -0
- package/docs/content/real-time-collaboration.md +185 -0
- package/docs/content/resources.md +277 -0
- package/docs/content/security.md +158 -0
- package/docs/content/server.md +200 -0
- package/docs/content/skills-guide.md +107 -0
- package/docs/content/what-is-agent-native.md +100 -0
- package/docs/content/workspace-management.md +224 -0
- package/package.json +12 -2
- package/src/templates/default/.agents/skills/actions/SKILL.md +2 -1
- package/src/templates/default/.agents/skills/security/SKILL.md +145 -40
- package/src/templates/default/.agents/skills/storing-data/SKILL.md +7 -1
- package/src/templates/default/_gitignore +1 -0
- package/src/templates/default/app/root.tsx +4 -1
- package/src/templates/workspace-core/AGENTS.md +62 -0
- package/src/templates/workspace-core/actions/company-directory.ts +38 -0
- package/src/templates/workspace-core/package.json +39 -0
- package/src/templates/workspace-core/skills/company-policies/SKILL.md +42 -0
- package/src/templates/workspace-core/src/client/AuthenticatedLayout.tsx +37 -0
- package/src/templates/workspace-core/src/client/index.ts +26 -0
- package/src/templates/workspace-core/src/credentials.ts +29 -0
- package/src/templates/workspace-core/src/index.ts +21 -0
- package/src/templates/workspace-core/src/server/agent-chat-plugin.ts +30 -0
- package/src/templates/workspace-core/src/server/auth-plugin.ts +35 -0
- package/src/templates/workspace-core/src/server/index.ts +22 -0
- package/src/templates/workspace-core/tailwind.preset.ts +34 -0
- package/src/templates/workspace-core/tsconfig.json +9 -0
- package/src/templates/workspace-root/.env.example +37 -0
- package/src/templates/workspace-root/README.md +62 -0
- package/src/templates/workspace-root/_gitignore +23 -0
- package/src/templates/workspace-root/package.json +18 -0
- package/src/templates/workspace-root/pnpm-workspace.yaml +3 -0
- package/src/templates/workspace-root/tsconfig.base.json +21 -0
- package/dist/templates/templates/default/.agents/skills/actions/SKILL.md +0 -142
- package/dist/templates/templates/default/.agents/skills/agent-engines/SKILL.md +0 -127
- package/dist/templates/templates/default/.agents/skills/capture-learnings/SKILL.md +0 -50
- package/dist/templates/templates/default/.agents/skills/create-skill/SKILL.md +0 -167
- package/dist/templates/templates/default/.agents/skills/delegate-to-agent/SKILL.md +0 -90
- package/dist/templates/templates/default/.agents/skills/frontend-design/SKILL.md +0 -69
- package/dist/templates/templates/default/.agents/skills/real-time-collab/SKILL.md +0 -183
- package/dist/templates/templates/default/.agents/skills/real-time-sync/SKILL.md +0 -112
- package/dist/templates/templates/default/.agents/skills/security/SKILL.md +0 -108
- package/dist/templates/templates/default/.agents/skills/self-modifying-code/SKILL.md +0 -79
- package/dist/templates/templates/default/.agents/skills/storing-data/SKILL.md +0 -110
- package/dist/templates/templates/default/.claude/settings.json +0 -100
- package/dist/templates/templates/default/.env.example +0 -5
- package/dist/templates/templates/default/.ignore +0 -0
- package/dist/templates/templates/default/.prettierrc +0 -5
- package/dist/templates/templates/default/AGENTS.md +0 -110
- package/dist/templates/templates/default/DEVELOPING.md +0 -117
- package/dist/templates/templates/default/_gitignore +0 -37
- package/dist/templates/templates/default/actions/hello.ts +0 -20
- package/dist/templates/templates/default/actions/navigate.ts +0 -53
- package/dist/templates/templates/default/actions/run.ts +0 -2
- package/dist/templates/templates/default/actions/view-screen.ts +0 -39
- package/dist/templates/templates/default/app/entry.client.tsx +0 -4
- package/dist/templates/templates/default/app/entry.server.tsx +0 -56
- package/dist/templates/templates/default/app/global.css +0 -95
- package/dist/templates/templates/default/app/lib/utils.ts +0 -1
- package/dist/templates/templates/default/app/root.tsx +0 -107
- package/dist/templates/templates/default/app/routes/_index.tsx +0 -62
- package/dist/templates/templates/default/app/routes.ts +0 -4
- package/dist/templates/templates/default/app/vite-env.d.ts +0 -6
- package/dist/templates/templates/default/components.json +0 -20
- package/dist/templates/templates/default/data/.gitkeep +0 -0
- package/dist/templates/templates/default/data/sync-config.json +0 -1
- package/dist/templates/templates/default/learnings.defaults.md +0 -5
- package/dist/templates/templates/default/learnings.md +0 -0
- package/dist/templates/templates/default/package.json +0 -46
- package/dist/templates/templates/default/postcss.config.js +0 -6
- package/dist/templates/templates/default/public/icon-180.svg +0 -4
- package/dist/templates/templates/default/public/icon-192.svg +0 -4
- package/dist/templates/templates/default/public/icon-512.svg +0 -4
- package/dist/templates/templates/default/public/manifest.json +0 -13
- package/dist/templates/templates/default/react-router.config.ts +0 -6
- package/dist/templates/templates/default/server/middleware/auth.ts +0 -15
- package/dist/templates/templates/default/server/plugins/.gitkeep +0 -0
- package/dist/templates/templates/default/server/routes/[...page].get.ts +0 -5
- package/dist/templates/templates/default/server/routes/api/hello.get.ts +0 -5
- package/dist/templates/templates/default/shared/api.ts +0 -6
- package/dist/templates/templates/default/ssr-entry.ts +0 -20
- package/dist/templates/templates/default/tailwind.config.ts +0 -7
- package/dist/templates/templates/default/tsconfig.json +0 -11
- package/dist/templates/templates/default/vite.config.ts +0 -6
|
@@ -0,0 +1,175 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: "Client"
|
|
3
|
+
description: "React hooks and utilities for agent-native apps: sendToAgentChat, useDbSync, useAgentChatGenerating, and cn."
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Client
|
|
7
|
+
|
|
8
|
+
`@agent-native/core` provides React hooks and utilities for the browser-side of agent-native apps.
|
|
9
|
+
|
|
10
|
+
## File-Based Routing {#file-based-routing}
|
|
11
|
+
|
|
12
|
+
Agent-native apps use **React Router v7** with file-based routing. Every file in `app/routes/` becomes a URL.
|
|
13
|
+
|
|
14
|
+
### File → URL mapping
|
|
15
|
+
|
|
16
|
+
| File | URL |
|
|
17
|
+
| -------------------------------- | ------------------------------------- |
|
|
18
|
+
| `app/routes/_index.tsx` | `/` |
|
|
19
|
+
| `app/routes/settings.tsx` | `/settings` |
|
|
20
|
+
| `app/routes/inbox/index.tsx` | `/inbox` |
|
|
21
|
+
| `app/routes/inbox/$threadId.tsx` | `/inbox/:threadId` |
|
|
22
|
+
| `app/routes/inbox.$threadId.tsx` | `/inbox/:threadId` (flat alternative) |
|
|
23
|
+
|
|
24
|
+
Prefix a segment with `$` for dynamic params. Prefix with `_` to make it a pathless layout route (doesn't add a URL segment). `_index.tsx` is the index route for its folder.
|
|
25
|
+
|
|
26
|
+
### Adding a new page
|
|
27
|
+
|
|
28
|
+
Create the file and export a default component:
|
|
29
|
+
|
|
30
|
+
```tsx
|
|
31
|
+
// app/routes/settings.tsx
|
|
32
|
+
export function meta() {
|
|
33
|
+
return [{ title: "Settings" }];
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
export default function SettingsPage() {
|
|
37
|
+
return <div>Settings</div>;
|
|
38
|
+
}
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
That's it — React Router picks it up automatically, no registration needed.
|
|
42
|
+
|
|
43
|
+
### Dynamic params
|
|
44
|
+
|
|
45
|
+
```tsx
|
|
46
|
+
// app/routes/inbox/$threadId.tsx
|
|
47
|
+
import { useParams } from "react-router";
|
|
48
|
+
|
|
49
|
+
export default function ThreadPage() {
|
|
50
|
+
const { threadId } = useParams();
|
|
51
|
+
return <div>Thread: {threadId}</div>;
|
|
52
|
+
}
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
### Navigation
|
|
56
|
+
|
|
57
|
+
Use `<Link>` for client-side navigation and `useNavigate()` for programmatic navigation:
|
|
58
|
+
|
|
59
|
+
```tsx
|
|
60
|
+
import { Link, useNavigate } from "react-router";
|
|
61
|
+
|
|
62
|
+
// In JSX
|
|
63
|
+
<Link to="/settings">Settings</Link>;
|
|
64
|
+
|
|
65
|
+
// Programmatic
|
|
66
|
+
const navigate = useNavigate();
|
|
67
|
+
navigate(`/inbox/${threadId}`);
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
---
|
|
71
|
+
|
|
72
|
+
## sendToAgentChat(opts) {#sendtoagentchat}
|
|
73
|
+
|
|
74
|
+
Send a message to the agent chat via postMessage. Used to delegate AI tasks from UI interactions.
|
|
75
|
+
|
|
76
|
+
```ts
|
|
77
|
+
import { sendToAgentChat } from "@agent-native/core";
|
|
78
|
+
|
|
79
|
+
// Auto-submit a prompt with hidden context
|
|
80
|
+
sendToAgentChat({
|
|
81
|
+
message: "Generate alt text for this image",
|
|
82
|
+
context: "Image path: /api/projects/hero.jpg",
|
|
83
|
+
submit: true,
|
|
84
|
+
});
|
|
85
|
+
|
|
86
|
+
// Prefill without submitting (user reviews first)
|
|
87
|
+
sendToAgentChat({
|
|
88
|
+
message: "Rewrite this in a conversational tone",
|
|
89
|
+
context: selectedText,
|
|
90
|
+
submit: false,
|
|
91
|
+
});
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
### AgentChatMessage {#agentchatmessage}
|
|
95
|
+
|
|
96
|
+
| Option | Type | Description |
|
|
97
|
+
| --------------------- | ----------- | ---------------------------------------------- |
|
|
98
|
+
| `message` | `string` | The visible prompt sent to the chat |
|
|
99
|
+
| `context` | `string?` | Hidden context appended (not shown in chat UI) |
|
|
100
|
+
| `submit` | `boolean?` | true = auto-submit, false = prefill only |
|
|
101
|
+
| `projectSlug` | `string?` | Optional project slug for structured context |
|
|
102
|
+
| `preset` | `string?` | Optional preset name for downstream consumers |
|
|
103
|
+
| `referenceImagePaths` | `string[]?` | Optional reference image paths |
|
|
104
|
+
|
|
105
|
+
## useAgentChatGenerating() {#useagentchatgenerating}
|
|
106
|
+
|
|
107
|
+
React hook that wraps sendToAgentChat with loading state tracking:
|
|
108
|
+
|
|
109
|
+
```ts
|
|
110
|
+
import { useAgentChatGenerating } from "@agent-native/core";
|
|
111
|
+
|
|
112
|
+
function GenerateButton() {
|
|
113
|
+
const [isGenerating, send] = useAgentChatGenerating();
|
|
114
|
+
|
|
115
|
+
return (
|
|
116
|
+
<button
|
|
117
|
+
disabled={isGenerating}
|
|
118
|
+
onClick={() => send({
|
|
119
|
+
message: "Generate a summary",
|
|
120
|
+
context: documentContent,
|
|
121
|
+
submit: true,
|
|
122
|
+
})}
|
|
123
|
+
>
|
|
124
|
+
{isGenerating ? "Generating..." : "Generate"}
|
|
125
|
+
</button>
|
|
126
|
+
);
|
|
127
|
+
}
|
|
128
|
+
```
|
|
129
|
+
|
|
130
|
+
`isGenerating` turns true when you call `send()` and automatically resets to false when the agent finishes generating.
|
|
131
|
+
|
|
132
|
+
## useDbSync(options?) {#usedbsync}
|
|
133
|
+
|
|
134
|
+
React hook (formerly `useFileWatcher`) that polls for database changes and invalidates react-query caches:
|
|
135
|
+
|
|
136
|
+
```ts
|
|
137
|
+
import { useDbSync } from "@agent-native/core";
|
|
138
|
+
import { useQueryClient } from "@tanstack/react-query";
|
|
139
|
+
|
|
140
|
+
function App() {
|
|
141
|
+
const queryClient = useQueryClient();
|
|
142
|
+
|
|
143
|
+
useDbSync({
|
|
144
|
+
queryClient,
|
|
145
|
+
queryKeys: ["files", "projects", "versionHistory"],
|
|
146
|
+
pollUrl: "/_agent-native/poll",
|
|
147
|
+
onEvent: (data) => console.log("Data changed:", data),
|
|
148
|
+
});
|
|
149
|
+
|
|
150
|
+
return <div>...</div>;
|
|
151
|
+
}
|
|
152
|
+
```
|
|
153
|
+
|
|
154
|
+
### Options {#usedbsync-options}
|
|
155
|
+
|
|
156
|
+
| Option | Type | Description |
|
|
157
|
+
| ------------- | ---------------- | ----------------------------------------------------------------- |
|
|
158
|
+
| `queryClient` | `QueryClient?` | React-query client for cache invalidation |
|
|
159
|
+
| `queryKeys` | `string[]?` | Query key prefixes to invalidate. Default: `["file", "fileTree"]` |
|
|
160
|
+
| `pollUrl` | `string?` | Poll endpoint URL. Default: `"/_agent-native/poll"` |
|
|
161
|
+
| `onEvent` | `(data) => void` | Optional callback for each SSE event |
|
|
162
|
+
|
|
163
|
+
## cn(...inputs) {#cn}
|
|
164
|
+
|
|
165
|
+
Utility for merging class names (clsx + tailwind-merge):
|
|
166
|
+
|
|
167
|
+
```ts
|
|
168
|
+
import { cn } from "@agent-native/core";
|
|
169
|
+
|
|
170
|
+
<div className={cn(
|
|
171
|
+
"px-4 py-2 rounded",
|
|
172
|
+
isActive && "bg-primary text-primary-foreground",
|
|
173
|
+
className
|
|
174
|
+
)} />
|
|
175
|
+
```
|
|
@@ -0,0 +1,168 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: "Context Awareness"
|
|
3
|
+
description: "How the agent knows what the user is looking at: navigation state, view-screen, navigate commands, and jitter prevention."
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Context Awareness
|
|
7
|
+
|
|
8
|
+
How the agent knows what the user is looking at — and how the agent can control what the user sees.
|
|
9
|
+
|
|
10
|
+
## Overview {#overview}
|
|
11
|
+
|
|
12
|
+
Without context awareness, the agent is blind. It asks "which email?" when the user is staring at one. It cannot act on the current selection, cannot provide relevant suggestions, and cannot modify what the user sees.
|
|
13
|
+
|
|
14
|
+
Three patterns solve this:
|
|
15
|
+
|
|
16
|
+
1. **Navigation state** — the UI writes a `navigation` key to application-state on every route change
|
|
17
|
+
2. **`view-screen`** — an action that reads navigation state, fetches contextual data, and returns a snapshot of what the user sees
|
|
18
|
+
3. **`navigate`** — a one-shot command from the agent that tells the UI where to go
|
|
19
|
+
|
|
20
|
+
## Navigation state {#navigation-state}
|
|
21
|
+
|
|
22
|
+
The UI writes a `navigation` key to application-state on every route change. This tells the agent what view the user is on and what item is selected.
|
|
23
|
+
|
|
24
|
+
```json
|
|
25
|
+
{
|
|
26
|
+
"view": "inbox",
|
|
27
|
+
"threadId": "thread-123",
|
|
28
|
+
"focusedEmailId": "msg-456",
|
|
29
|
+
"search": "budget",
|
|
30
|
+
"label": "important"
|
|
31
|
+
}
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
What to include in navigation state:
|
|
35
|
+
|
|
36
|
+
- `view` — the current page/section (e.g., "inbox", "form-builder", "dashboard")
|
|
37
|
+
- Item IDs — the selected/open item (e.g., `threadId`, `formId`)
|
|
38
|
+
- Filter state — active search, label, or category filters
|
|
39
|
+
- Any selection — focused item, selected text range, active tab
|
|
40
|
+
|
|
41
|
+
The agent reads this before acting:
|
|
42
|
+
|
|
43
|
+
```ts
|
|
44
|
+
import { readAppState } from "@agent-native/core/application-state";
|
|
45
|
+
|
|
46
|
+
const navigation = await readAppState("navigation");
|
|
47
|
+
// { view: "inbox", threadId: "thread-123", label: "important" }
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
## The view-screen action {#view-screen-action}
|
|
51
|
+
|
|
52
|
+
Every template should have a `view-screen` action. It reads navigation state, fetches the relevant data, and returns a snapshot of what the user sees. This is the agent's eyes.
|
|
53
|
+
|
|
54
|
+
```ts
|
|
55
|
+
// actions/view-screen.ts
|
|
56
|
+
import { readAppState } from "@agent-native/core/application-state";
|
|
57
|
+
|
|
58
|
+
export default async function main() {
|
|
59
|
+
const navigation = await readAppState("navigation");
|
|
60
|
+
const screen: Record<string, unknown> = { navigation };
|
|
61
|
+
|
|
62
|
+
// Fetch data based on what the user is viewing
|
|
63
|
+
if (navigation?.view === "inbox") {
|
|
64
|
+
const res = await fetch(
|
|
65
|
+
"http://localhost:3000/api/emails?label=" + navigation.label,
|
|
66
|
+
);
|
|
67
|
+
screen.emailList = await res.json();
|
|
68
|
+
}
|
|
69
|
+
if (navigation?.threadId) {
|
|
70
|
+
const res = await fetch(
|
|
71
|
+
"http://localhost:3000/api/threads/" + navigation.threadId,
|
|
72
|
+
);
|
|
73
|
+
screen.thread = await res.json();
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
console.log(JSON.stringify(screen, null, 2));
|
|
77
|
+
}
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
The agent should always call `pnpm action view-screen` before acting. This is a hard convention across all templates. When adding new features, update `view-screen` to return data for the new view.
|
|
81
|
+
|
|
82
|
+
## The navigate action {#navigate-action}
|
|
83
|
+
|
|
84
|
+
The agent writes a one-shot `navigate` command to application-state. The UI reads it, performs the navigation, and deletes the entry.
|
|
85
|
+
|
|
86
|
+
```ts
|
|
87
|
+
// Agent side — write a navigate command
|
|
88
|
+
import { writeAppState } from "@agent-native/core/application-state";
|
|
89
|
+
|
|
90
|
+
await writeAppState("navigate", { view: "inbox", threadId: "thread-123" });
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
The UI polls for this command and navigates when it appears:
|
|
94
|
+
|
|
95
|
+
```ts
|
|
96
|
+
// UI side — poll for navigate commands
|
|
97
|
+
const { data: navCommand } = useQuery({
|
|
98
|
+
queryKey: ["navigate-command"],
|
|
99
|
+
queryFn: async () => {
|
|
100
|
+
const res = await fetch("/_agent-native/application-state/navigate");
|
|
101
|
+
if (!res.ok) return null;
|
|
102
|
+
const data = await res.json();
|
|
103
|
+
if (data) {
|
|
104
|
+
// Delete the one-shot command after reading
|
|
105
|
+
fetch("/_agent-native/application-state/navigate", { method: "DELETE" });
|
|
106
|
+
return data;
|
|
107
|
+
}
|
|
108
|
+
return null;
|
|
109
|
+
},
|
|
110
|
+
staleTime: 2_000,
|
|
111
|
+
});
|
|
112
|
+
|
|
113
|
+
useEffect(() => {
|
|
114
|
+
if (navCommand) {
|
|
115
|
+
router.navigate(buildPath(navCommand));
|
|
116
|
+
}
|
|
117
|
+
}, [navCommand]);
|
|
118
|
+
```
|
|
119
|
+
|
|
120
|
+
The `navigation` key belongs to the UI — the agent should never write to it directly. Instead, the agent writes to `navigate`, and the UI performs the actual navigation (which then updates `navigation`).
|
|
121
|
+
|
|
122
|
+
## useNavigationState hook {#use-navigation-state}
|
|
123
|
+
|
|
124
|
+
The `use-navigation-state.ts` hook syncs routes to application-state on every navigation:
|
|
125
|
+
|
|
126
|
+
```ts
|
|
127
|
+
// app/hooks/use-navigation-state.ts
|
|
128
|
+
import { useEffect } from "react";
|
|
129
|
+
import { useLocation } from "react-router";
|
|
130
|
+
|
|
131
|
+
export function useNavigationState() {
|
|
132
|
+
const location = useLocation();
|
|
133
|
+
|
|
134
|
+
useEffect(() => {
|
|
135
|
+
const state = deriveNavigationState(location.pathname);
|
|
136
|
+
fetch("/_agent-native/application-state/navigation", {
|
|
137
|
+
method: "PUT",
|
|
138
|
+
headers: { "Content-Type": "application/json" },
|
|
139
|
+
body: JSON.stringify(state),
|
|
140
|
+
}).catch(() => {});
|
|
141
|
+
}, [location.pathname]);
|
|
142
|
+
}
|
|
143
|
+
```
|
|
144
|
+
|
|
145
|
+
The `deriveNavigationState()` function is template-specific — it parses the URL path and extracts the view, item IDs, and filters relevant to your app.
|
|
146
|
+
|
|
147
|
+
## Jitter prevention {#jitter-prevention}
|
|
148
|
+
|
|
149
|
+
When the agent writes to application-state, the polling system might cause the UI to refetch data it just wrote. This creates jitter. The solution is source tagging:
|
|
150
|
+
|
|
151
|
+
```ts
|
|
152
|
+
// app/root.tsx
|
|
153
|
+
import { TAB_ID } from "@/lib/tab-id";
|
|
154
|
+
|
|
155
|
+
useDbSync({
|
|
156
|
+
queryClient,
|
|
157
|
+
queryKeys: ["app-state", "settings"],
|
|
158
|
+
ignoreSource: TAB_ID, // ignore events from this tab's own writes
|
|
159
|
+
});
|
|
160
|
+
```
|
|
161
|
+
|
|
162
|
+
How it works:
|
|
163
|
+
|
|
164
|
+
- Agent writes are tagged with `requestSource: "agent"` (the action helpers do this automatically)
|
|
165
|
+
- UI writes include the tab's unique ID via `X-Request-Source` header
|
|
166
|
+
- The server stores the source on each event
|
|
167
|
+
- When polling, the UI filters out events matching its own `ignoreSource` value — so it doesn't refetch data it just wrote
|
|
168
|
+
- Events from agents, other tabs, and actions still come through normally
|
|
@@ -0,0 +1,311 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: "Creating Templates"
|
|
3
|
+
description: "How to create and publish your own agent-native app templates."
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Creating Templates
|
|
7
|
+
|
|
8
|
+
How to build and publish your own agent-native app template.
|
|
9
|
+
|
|
10
|
+
## Overview {#overview}
|
|
11
|
+
|
|
12
|
+
Templates are complete, forkable agent-native apps that solve a specific use case. The analytics, content, slides, and video templates that ship with Agent-Native are all built this way. Anyone can create a template and share it with the community.
|
|
13
|
+
|
|
14
|
+
A good template:
|
|
15
|
+
|
|
16
|
+
- Solves a real workflow end-to-end (not a toy demo)
|
|
17
|
+
- Works out of the box with example data
|
|
18
|
+
- Has a comprehensive `AGENTS.md` so the AI agent understands the architecture
|
|
19
|
+
- Includes actions for key operations the agent can call
|
|
20
|
+
- Follows the core rules: data in SQL, all AI through agent chat, actions for operations, real-time sync, agent can modify code
|
|
21
|
+
|
|
22
|
+
## Start from the starter {#start-from-starter}
|
|
23
|
+
|
|
24
|
+
The fastest way to start is with the built-in starter template:
|
|
25
|
+
|
|
26
|
+
```bash
|
|
27
|
+
npx @agent-native/core create my-template
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
This scaffolds a minimal agent-native app with the standard directory structure, a working dev server, file watching, SSE, and an example action. Build your template on top of this.
|
|
31
|
+
|
|
32
|
+
## Project structure {#project-structure}
|
|
33
|
+
|
|
34
|
+
Every template follows the same convention:
|
|
35
|
+
|
|
36
|
+
```text
|
|
37
|
+
my-template/
|
|
38
|
+
app/ # React frontend
|
|
39
|
+
routes/ # File-based page routes (auto-discovered)
|
|
40
|
+
_index.tsx # / (home page)
|
|
41
|
+
settings.tsx # /settings
|
|
42
|
+
root.tsx # App shell — <html>, <head>, <body>, providers
|
|
43
|
+
entry.client.tsx # Client hydration entry
|
|
44
|
+
routes.ts # Route config — flatRoutes()
|
|
45
|
+
components/ # UI components
|
|
46
|
+
components/ui/ # Reusable primitives (shadcn/ui)
|
|
47
|
+
hooks/ # React hooks
|
|
48
|
+
lib/utils.ts # cn() utility
|
|
49
|
+
|
|
50
|
+
server/ # Nitro API server
|
|
51
|
+
routes/ # File-based API routes (auto-discovered by Nitro)
|
|
52
|
+
[...page].get.ts # SSR catch-all (delegates to React Router)
|
|
53
|
+
plugins/ # Server plugins (startup logic)
|
|
54
|
+
lib/ # Shared server modules
|
|
55
|
+
|
|
56
|
+
shared/ # Isomorphic types (imported by client & server)
|
|
57
|
+
api.ts # Shared interfaces
|
|
58
|
+
|
|
59
|
+
actions/ # Agent-callable actions
|
|
60
|
+
run.ts # Action dispatcher (don't modify)
|
|
61
|
+
*.ts # Your actions — one per operation
|
|
62
|
+
|
|
63
|
+
data/ # File-based state (watched by SSE)
|
|
64
|
+
.gitkeep # Or seed data for the template
|
|
65
|
+
|
|
66
|
+
.agents/skills/ # Agent skills — detailed guidance per topic
|
|
67
|
+
|
|
68
|
+
AGENTS.md # Master agent instructions
|
|
69
|
+
react-router.config.ts # React Router config (ssr, appDirectory)
|
|
70
|
+
package.json # Scripts: dev, build, start, action, typecheck
|
|
71
|
+
vite.config.ts # Vite config (React Router + Nitro)
|
|
72
|
+
tsconfig.json # TypeScript config
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
## Build your client {#build-your-client}
|
|
76
|
+
|
|
77
|
+
The client uses React Router v7 framework mode with file-based routing. Pages go in `app/routes/`, global providers live in `app/root.tsx`, and React Query handles data fetching.
|
|
78
|
+
|
|
79
|
+
```ts
|
|
80
|
+
// app/root.tsx — App shell with providers
|
|
81
|
+
import { Links, Meta, Outlet, Scripts, ScrollRestoration } from "react-router";
|
|
82
|
+
import { QueryClient, QueryClientProvider } from "@tanstack/react-query";
|
|
83
|
+
import { useDbSync } from "@agent-native/core";
|
|
84
|
+
|
|
85
|
+
const queryClient = new QueryClient();
|
|
86
|
+
|
|
87
|
+
export function Layout({ children }: { children: React.ReactNode }) {
|
|
88
|
+
return (
|
|
89
|
+
<html lang="en">
|
|
90
|
+
<head>
|
|
91
|
+
<meta charSet="utf-8" />
|
|
92
|
+
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
|
93
|
+
<Meta />
|
|
94
|
+
<Links />
|
|
95
|
+
</head>
|
|
96
|
+
<body>
|
|
97
|
+
{children}
|
|
98
|
+
<ScrollRestoration />
|
|
99
|
+
<Scripts />
|
|
100
|
+
</body>
|
|
101
|
+
</html>
|
|
102
|
+
);
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
export default function Root() {
|
|
106
|
+
useDbSync({ queryClient, queryKeys: ["items", "projects"] });
|
|
107
|
+
return (
|
|
108
|
+
<QueryClientProvider client={queryClient}>
|
|
109
|
+
<Outlet />
|
|
110
|
+
</QueryClientProvider>
|
|
111
|
+
);
|
|
112
|
+
}
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
Routes are auto-discovered from `app/routes/` via `flatRoutes()`. Create a file to add a page:
|
|
116
|
+
|
|
117
|
+
```ts
|
|
118
|
+
// app/routes/_index.tsx → /
|
|
119
|
+
export default function Dashboard() {
|
|
120
|
+
return <div>Home page</div>;
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
// app/routes/settings.tsx → /settings
|
|
124
|
+
export default function Settings() {
|
|
125
|
+
return <div>Settings page</div>;
|
|
126
|
+
}
|
|
127
|
+
```
|
|
128
|
+
|
|
129
|
+
The `useDbSync` hook (formerly `useFileWatcher`) polls `/_agent-native/poll` and invalidates react-query caches when data changes. This is how the UI stays in sync when the agent modifies data.
|
|
130
|
+
|
|
131
|
+
## Add API routes {#add-api-routes}
|
|
132
|
+
|
|
133
|
+
API routes serve data from files and handle mutations. They go in `server/routes/` as file-based routes:
|
|
134
|
+
|
|
135
|
+
```ts
|
|
136
|
+
// server/routes/api/items/index.get.ts
|
|
137
|
+
import { defineEventHandler } from "h3";
|
|
138
|
+
import { readdir, readFile, mkdir } from "node:fs/promises";
|
|
139
|
+
import path from "node:path";
|
|
140
|
+
|
|
141
|
+
export default defineEventHandler(async () => {
|
|
142
|
+
const dir = "./data/items";
|
|
143
|
+
await mkdir(dir, { recursive: true });
|
|
144
|
+
const files = await readdir(dir);
|
|
145
|
+
return Promise.all(
|
|
146
|
+
files
|
|
147
|
+
.filter((f) => f.endsWith(".json"))
|
|
148
|
+
.map(async (f) => {
|
|
149
|
+
const content = await readFile(path.join(dir, f), "utf-8");
|
|
150
|
+
return JSON.parse(content);
|
|
151
|
+
}),
|
|
152
|
+
);
|
|
153
|
+
});
|
|
154
|
+
```
|
|
155
|
+
|
|
156
|
+
Each route file exports a default `defineEventHandler`. Both the UI and the agent can create items — the UI via `POST /api/items`, the agent by writing directly to `data/items/`. The SSE watcher ensures both paths trigger UI updates.
|
|
157
|
+
|
|
158
|
+
## Add actions {#add-actions}
|
|
159
|
+
|
|
160
|
+
Actions are the agent's toolbox. Each action handles one operation — fetching data from an API, generating content, processing files, etc:
|
|
161
|
+
|
|
162
|
+
```typescript
|
|
163
|
+
// actions/import-data.ts
|
|
164
|
+
import { parseArgs } from "@agent-native/core";
|
|
165
|
+
import { writeFile, mkdir } from "node:fs/promises";
|
|
166
|
+
|
|
167
|
+
export default async function importData(args: string[]) {
|
|
168
|
+
const { url, name } = parseArgs(args);
|
|
169
|
+
if (!url) {
|
|
170
|
+
console.error("--url is required");
|
|
171
|
+
process.exit(1);
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
const res = await fetch(url);
|
|
175
|
+
const data = await res.json();
|
|
176
|
+
|
|
177
|
+
const slug = name ?? "imported";
|
|
178
|
+
await mkdir("./data/imports", { recursive: true });
|
|
179
|
+
await writeFile(`./data/imports/${slug}.json`, JSON.stringify(data, null, 2));
|
|
180
|
+
console.log(
|
|
181
|
+
`Imported ${Array.isArray(data) ? data.length + " records" : "data"} to data/imports/${slug}.json`,
|
|
182
|
+
);
|
|
183
|
+
}
|
|
184
|
+
```
|
|
185
|
+
|
|
186
|
+
```bash
|
|
187
|
+
# The agent can run this
|
|
188
|
+
pnpm action import-data --url https://api.example.com/data --name users
|
|
189
|
+
```
|
|
190
|
+
|
|
191
|
+
Scripts should write their output to `data/` — the SSE watcher will notify the UI. Use `console.log` for output the agent can see. Use `console.error` and `process.exit(1)` for errors.
|
|
192
|
+
|
|
193
|
+
## Add data models {#add-data-models}
|
|
194
|
+
|
|
195
|
+
Seed your template with example data so it works immediately. Put JSON files in `data/` matching the structure your API routes expect:
|
|
196
|
+
|
|
197
|
+
```text
|
|
198
|
+
data/
|
|
199
|
+
items/
|
|
200
|
+
example-1.json # {"id": "example-1", "title": "...", "status": "active"}
|
|
201
|
+
example-2.json
|
|
202
|
+
config.json # App-level config
|
|
203
|
+
sync-config.json # (optional) Firestore sync glob patterns
|
|
204
|
+
```
|
|
205
|
+
|
|
206
|
+
Keep your data models simple — flat JSON files, one per entity. The agent can grep, read, and modify them. Deeply nested structures or binary formats make it harder for the agent to work with the data.
|
|
207
|
+
|
|
208
|
+
## Write AGENTS.md {#write-agents-md}
|
|
209
|
+
|
|
210
|
+
This is the most important file in your template. `AGENTS.md` tells the AI agent how your app works, what it can and can't do, and how to make changes:
|
|
211
|
+
|
|
212
|
+
````markdown
|
|
213
|
+
# My Template — Agent-Native App
|
|
214
|
+
|
|
215
|
+
## Architecture
|
|
216
|
+
|
|
217
|
+
This is an **@agent-native/core** application.
|
|
218
|
+
|
|
219
|
+
### Core Principles
|
|
220
|
+
|
|
221
|
+
1. **Data lives in SQL** — All state in SQL via Drizzle ORM.
|
|
222
|
+
2. **All AI through agent chat** — No inline LLM calls.
|
|
223
|
+
3. **Actions for operations** — `pnpm action <name>` for complex work.
|
|
224
|
+
4. **Real-time sync** — Polling keeps UI in sync with agent changes.
|
|
225
|
+
5. **Agent can update code** — Edit components, routes, actions.
|
|
226
|
+
|
|
227
|
+
### Directory Structure
|
|
228
|
+
|
|
229
|
+
```
|
|
230
|
+
app/ # React frontend (file-based routing in app/routes/)
|
|
231
|
+
server/ # Nitro API server
|
|
232
|
+
actions/ # Agent-callable actions
|
|
233
|
+
data/ # File-based state
|
|
234
|
+
```
|
|
235
|
+
|
|
236
|
+
### Available Actions
|
|
237
|
+
|
|
238
|
+
- `pnpm action import-data --url <url>` — Import data from API
|
|
239
|
+
- `pnpm action generate-report --id <id>` — Generate a report
|
|
240
|
+
|
|
241
|
+
### Data Model
|
|
242
|
+
|
|
243
|
+
Items are stored as `data/items/<id>.json`:
|
|
244
|
+
|
|
245
|
+
```json
|
|
246
|
+
{ "id": "...", "title": "...", "status": "active" }
|
|
247
|
+
```
|
|
248
|
+
|
|
249
|
+
### Key Patterns
|
|
250
|
+
|
|
251
|
+
- API routes in `server/routes/` serve files from `data/`
|
|
252
|
+
- UI delegates AI work via `sendToAgentChat()`
|
|
253
|
+
- Actions write results to `data/` — SSE updates the UI
|
|
254
|
+
````
|
|
255
|
+
|
|
256
|
+
Be specific about your data models, available actions, and key patterns. The better your `AGENTS.md`, the better the agent will work with your template.
|
|
257
|
+
|
|
258
|
+
## Add skills {#add-skills}
|
|
259
|
+
|
|
260
|
+
For complex topics that don't fit in `AGENTS.md`, create skills in `.agents/skills/`. Each skill is a Markdown file with detailed guidance for a specific topic:
|
|
261
|
+
|
|
262
|
+
```markdown
|
|
263
|
+
# .agents/skills/bigquery/SKILL.md
|
|
264
|
+
|
|
265
|
+
## BigQuery Integration
|
|
266
|
+
|
|
267
|
+
### Column Reference
|
|
268
|
+
|
|
269
|
+
- `event_name` — The event type (string)
|
|
270
|
+
- `event_timestamp` — Microsecond timestamp (int64)
|
|
271
|
+
- `user_pseudo_id` — Anonymous user ID (string)
|
|
272
|
+
|
|
273
|
+
### Common Queries
|
|
274
|
+
|
|
275
|
+
...
|
|
276
|
+
|
|
277
|
+
### Gotchas
|
|
278
|
+
|
|
279
|
+
- Always use `event_date` partition filter to avoid full table scans
|
|
280
|
+
- Timestamps are in microseconds, not milliseconds
|
|
281
|
+
```
|
|
282
|
+
|
|
283
|
+
Skills let you give the agent deep domain knowledge for specific integrations or patterns without bloating your main `AGENTS.md`.
|
|
284
|
+
|
|
285
|
+
## Onboarding & API keys {#onboarding}
|
|
286
|
+
|
|
287
|
+
If your template needs API keys or external service configuration, document them in a `.env.example` file:
|
|
288
|
+
|
|
289
|
+
```bash
|
|
290
|
+
# .env.example
|
|
291
|
+
BIGQUERY_PROJECT_ID=your-project-id
|
|
292
|
+
STRIPE_SECRET_KEY=sk_live_...
|
|
293
|
+
OPENAI_API_KEY=sk-...
|
|
294
|
+
```
|
|
295
|
+
|
|
296
|
+
When users fork your template, they copy `.env.example` to `.env` and fill in their own values. Keep the number of required keys minimal — the template should work with example data before any keys are configured.
|
|
297
|
+
|
|
298
|
+
## Publishing {#publishing}
|
|
299
|
+
|
|
300
|
+
To share your template:
|
|
301
|
+
|
|
302
|
+
1. Push your template to a public GitHub repo
|
|
303
|
+
2. Make sure it works with `pnpm install && pnpm dev`
|
|
304
|
+
3. Include seed data in `data/` so it works without API keys
|
|
305
|
+
4. Write a clear README explaining what the template does and how to configure it
|
|
306
|
+
|
|
307
|
+
Community templates can be shared via GitHub. The agent-native CLI supports creating from any git repo:
|
|
308
|
+
|
|
309
|
+
```bash
|
|
310
|
+
npx @agent-native/core create my-app --template github:user/repo
|
|
311
|
+
```
|