@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,171 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: "Agent Mentions"
|
|
3
|
+
description: "Tag custom agents, connected agents, and files in chat with @-mentions."
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Agent Mentions
|
|
7
|
+
|
|
8
|
+
Type `@` in the chat composer to mention custom agents, connected agents, files, and resources.
|
|
9
|
+
|
|
10
|
+
## Overview {#overview}
|
|
11
|
+
|
|
12
|
+
The `@`-mention system connects the chat composer to the broader agent ecosystem. When you type `@`, a popover appears listing available custom agents, connected agents, codebase files, and resources.
|
|
13
|
+
|
|
14
|
+
This is how you orchestrate multi-agent workflows from a single chat. Ask your local `@design` agent to critique a layout, `@analytics` to pull in the latest numbers from another app, and the main agent can incorporate both in one conversation.
|
|
15
|
+
|
|
16
|
+
## Mentioning agents {#mentioning-agents}
|
|
17
|
+
|
|
18
|
+
To mention an agent in the chat composer:
|
|
19
|
+
|
|
20
|
+
1. Type `@` to open the mention popover
|
|
21
|
+
2. Browse or search the list of available agents
|
|
22
|
+
3. Select an agent — it appears as a tag in your message
|
|
23
|
+
4. Send the message — the server resolves the mention and includes that agent's response in the conversation context
|
|
24
|
+
|
|
25
|
+
There are two agent paths:
|
|
26
|
+
|
|
27
|
+
- **Custom agents** — local workspace agent profiles in `agents/*.md`. These run inside the current app/runtime using the agent profile's instructions and optional model override.
|
|
28
|
+
- **Connected agents** — remote A2A peers. These are called over the [A2A protocol](/docs/a2a-protocol).
|
|
29
|
+
|
|
30
|
+
In both cases, your main agent sees the response and can reference or build on it.
|
|
31
|
+
|
|
32
|
+
## How it works {#how-it-works}
|
|
33
|
+
|
|
34
|
+
When a message containing an `@`-mention is sent, the following happens on the server:
|
|
35
|
+
|
|
36
|
+
1. The server extracts mention references from the message
|
|
37
|
+
2. For each mentioned agent:
|
|
38
|
+
- custom agents run locally with their profile instructions
|
|
39
|
+
- connected agents are called via A2A
|
|
40
|
+
3. The agent's response is wrapped in an `<agent-response>` XML block and injected into the conversation context
|
|
41
|
+
4. The main agent processes the enriched message, seeing both the user's text and the mentioned agent's response
|
|
42
|
+
|
|
43
|
+
```text
|
|
44
|
+
// What the main agent sees in its context:
|
|
45
|
+
User: Draft an email with the latest signup numbers. @analytics
|
|
46
|
+
|
|
47
|
+
<agent-response agent="analytics">
|
|
48
|
+
Last week's signups: 1,247 total
|
|
49
|
+
- Organic: 623
|
|
50
|
+
- Paid: 412
|
|
51
|
+
- Referral: 212
|
|
52
|
+
</agent-response>
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
The main agent can then use this data naturally in its response — for example, incorporating the numbers into an email draft.
|
|
56
|
+
|
|
57
|
+
## Adding agents {#adding-agents}
|
|
58
|
+
|
|
59
|
+
Agents become available for mentioning through several mechanisms:
|
|
60
|
+
|
|
61
|
+
- **Custom workspace agents** — create agent profiles in the Workspace tab as `agents/*.md`
|
|
62
|
+
- **Auto-discovery** — the framework automatically discovers connected agents running on known ports or configured URLs
|
|
63
|
+
- **Remote manifests** — add connected-agent manifests as `agents/*.json`
|
|
64
|
+
|
|
65
|
+
### Custom workspace agents
|
|
66
|
+
|
|
67
|
+
Custom agents are Markdown resources:
|
|
68
|
+
|
|
69
|
+
```markdown
|
|
70
|
+
---
|
|
71
|
+
name: Design
|
|
72
|
+
description: >-
|
|
73
|
+
Reviews layouts, product UX, and visual direction.
|
|
74
|
+
model: inherit
|
|
75
|
+
tools: inherit
|
|
76
|
+
delegate-default: false
|
|
77
|
+
---
|
|
78
|
+
|
|
79
|
+
# Role
|
|
80
|
+
|
|
81
|
+
You are a focused design agent.
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
You can create them from the Workspace tab using:
|
|
85
|
+
|
|
86
|
+
- `Create Agent` -> `Describe It`
|
|
87
|
+
- `Create Agent` -> `Fill Form`
|
|
88
|
+
|
|
89
|
+
### Connected-agent manifests
|
|
90
|
+
|
|
91
|
+
Remote A2A agents still use JSON manifests:
|
|
92
|
+
|
|
93
|
+
```json
|
|
94
|
+
// agents/analytics.json
|
|
95
|
+
{
|
|
96
|
+
"name": "Analytics Agent",
|
|
97
|
+
"url": "https://analytics.example.com",
|
|
98
|
+
"apiKey": "env:ANALYTICS_A2A_KEY",
|
|
99
|
+
"description": "Runs analytics queries and returns data",
|
|
100
|
+
"skills": ["run-query", "generate-chart"]
|
|
101
|
+
}
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
## Custom mention providers {#custom-mention-providers}
|
|
105
|
+
|
|
106
|
+
Templates can register custom mention providers to add domain-specific mentionable items beyond agents and files. A mention provider implements the `MentionProvider` interface:
|
|
107
|
+
|
|
108
|
+
```ts
|
|
109
|
+
import type { MentionProvider } from "@agent-native/core/server";
|
|
110
|
+
|
|
111
|
+
const contactsProvider: MentionProvider = {
|
|
112
|
+
id: "contacts",
|
|
113
|
+
label: "Contacts",
|
|
114
|
+
|
|
115
|
+
// Search for mentionable items
|
|
116
|
+
async search(query: string) {
|
|
117
|
+
const contacts = await db.query.contacts.findMany({
|
|
118
|
+
where: like(contacts.name, `%${query}%`),
|
|
119
|
+
limit: 10,
|
|
120
|
+
});
|
|
121
|
+
return contacts.map((c) => ({
|
|
122
|
+
id: c.id,
|
|
123
|
+
label: c.name,
|
|
124
|
+
description: c.email,
|
|
125
|
+
type: "contact",
|
|
126
|
+
}));
|
|
127
|
+
},
|
|
128
|
+
|
|
129
|
+
// Resolve a mention into context for the agent
|
|
130
|
+
async resolve(id: string) {
|
|
131
|
+
const contact = await db.query.contacts.findFirst({
|
|
132
|
+
where: eq(contacts.id, id),
|
|
133
|
+
});
|
|
134
|
+
return {
|
|
135
|
+
type: "context",
|
|
136
|
+
text: `Contact: ${contact.name} (${contact.email})`,
|
|
137
|
+
};
|
|
138
|
+
},
|
|
139
|
+
};
|
|
140
|
+
```
|
|
141
|
+
|
|
142
|
+
Register providers in the agent-chat plugin configuration:
|
|
143
|
+
|
|
144
|
+
```ts
|
|
145
|
+
// server/plugins/agent-chat.ts
|
|
146
|
+
import { createAgentChatPlugin } from "@agent-native/core/server";
|
|
147
|
+
|
|
148
|
+
export default createAgentChatPlugin({
|
|
149
|
+
actions: scriptRegistry,
|
|
150
|
+
systemPrompt: "You are a helpful assistant...",
|
|
151
|
+
mentionProviders: [contactsProvider],
|
|
152
|
+
});
|
|
153
|
+
```
|
|
154
|
+
|
|
155
|
+
Custom mention providers appear alongside the built-in agent and file providers in the mention popover.
|
|
156
|
+
|
|
157
|
+
## Referencing files {#referencing-files}
|
|
158
|
+
|
|
159
|
+
The `@` popover is not limited to agents. You can also reference:
|
|
160
|
+
|
|
161
|
+
- **Codebase files** — type `@` and search for a filename. The file contents are included in the agent's context so it can read, analyze, or modify the file.
|
|
162
|
+
- **Workspace resources** — reference files defined in the Workspace tab. These can be data files, configuration, or any other structured content.
|
|
163
|
+
- **Skills** — type `/` to reference a skill. Skills provide structured instructions that guide how the agent approaches a task.
|
|
164
|
+
|
|
165
|
+
All reference types follow the same pattern: select from the popover, and the referenced content is resolved and injected into the agent's context when the message is sent.
|
|
166
|
+
|
|
167
|
+
## Sub-agent selection {#sub-agent-selection}
|
|
168
|
+
|
|
169
|
+
The main agent can also use custom agents when spawning sub-agents with `spawn-task`.
|
|
170
|
+
|
|
171
|
+
Pass the `agent` parameter to choose a profile from `agents/*.md`. That profile's instructions are added to the delegated run, and its `model` frontmatter can override the default model for that sub-agent.
|
|
@@ -0,0 +1,155 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: "Authentication"
|
|
3
|
+
description: "Better Auth integration with email/password, social providers, organizations, and access tokens."
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Authentication
|
|
7
|
+
|
|
8
|
+
Agent-native apps use [Better Auth](https://better-auth.com) for authentication with an account-first design. Users create an account on first visit and get real identity from day one.
|
|
9
|
+
|
|
10
|
+
## Overview {#overview}
|
|
11
|
+
|
|
12
|
+
Auth is configured automatically via `autoMountAuth(app)` in the auth server plugin. The behavior depends on your environment:
|
|
13
|
+
|
|
14
|
+
- **Default:** Better Auth with email/password + social providers. Onboarding page shown on first visit.
|
|
15
|
+
- **`AUTH_MODE=local`:** No auth. Solo local development with `local@localhost` identity.
|
|
16
|
+
- **`ACCESS_TOKEN`:** Simple shared token for production.
|
|
17
|
+
- **Custom:** Bring your own auth via `getSession` callback.
|
|
18
|
+
|
|
19
|
+
## Better Auth (Default) {#better-auth}
|
|
20
|
+
|
|
21
|
+
When no `ACCESS_TOKEN` or `AUTH_MODE=local` is set, Better Auth powers authentication. It provides:
|
|
22
|
+
|
|
23
|
+
- Email/password registration and login
|
|
24
|
+
- Social providers (Google, GitHub, and 35+ others)
|
|
25
|
+
- Organizations with roles and invitations
|
|
26
|
+
- JWT tokens for API and A2A access
|
|
27
|
+
- Bearer token support for programmatic clients
|
|
28
|
+
|
|
29
|
+
Better Auth routes are mounted at `/_agent-native/auth/ba/*`. The framework also provides backward-compatible endpoints:
|
|
30
|
+
|
|
31
|
+
- `GET /_agent-native/auth/session` — get current session
|
|
32
|
+
- `POST /_agent-native/auth/login` — email/password or token login
|
|
33
|
+
- `POST /_agent-native/auth/register` — create account
|
|
34
|
+
- `POST /_agent-native/auth/logout` — sign out
|
|
35
|
+
|
|
36
|
+
## Development Mode {#dev-mode}
|
|
37
|
+
|
|
38
|
+
In development (`NODE_ENV=development`), auth is automatically bypassed. If no other auth method succeeds (no account, no token, no local mode marker), `getSession()` returns `{ email: "local@localhost" }` so you can use the app immediately without any configuration.
|
|
39
|
+
|
|
40
|
+
This means you can run any template app locally and start using it right away — no account creation, no environment variables needed.
|
|
41
|
+
|
|
42
|
+
## Local Mode {#local-mode}
|
|
43
|
+
|
|
44
|
+
For explicit no-auth in any environment (including production), set `AUTH_MODE=local` in your `.env` file. This returns `{ email: "local@localhost" }` for all requests, skipping all other auth checks.
|
|
45
|
+
|
|
46
|
+
You can also enable local mode from the onboarding page by clicking "Use locally without an account". This writes a marker file that persists across server restarts.
|
|
47
|
+
|
|
48
|
+
```bash
|
|
49
|
+
# .env
|
|
50
|
+
AUTH_MODE=local
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
To switch back to real auth, remove the line from `.env` (or clear the marker file by calling `POST /_agent-native/auth/exit-local-mode`).
|
|
54
|
+
|
|
55
|
+
## Social Providers {#social-providers}
|
|
56
|
+
|
|
57
|
+
Set environment variables to enable social login. Better Auth auto-detects them:
|
|
58
|
+
|
|
59
|
+
```bash
|
|
60
|
+
# Google OAuth
|
|
61
|
+
GOOGLE_CLIENT_ID=your-client-id
|
|
62
|
+
GOOGLE_CLIENT_SECRET=your-client-secret
|
|
63
|
+
|
|
64
|
+
# GitHub OAuth
|
|
65
|
+
GITHUB_CLIENT_ID=your-client-id
|
|
66
|
+
GITHUB_CLIENT_SECRET=your-client-secret
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
Templates that use `createGoogleAuthPlugin()` show a "Sign in with Google" page. The Google OAuth callback handles mobile deep linking for native apps automatically.
|
|
70
|
+
|
|
71
|
+
## Organizations {#organizations}
|
|
72
|
+
|
|
73
|
+
Better Auth's organization plugin is built into the framework. Every app supports:
|
|
74
|
+
|
|
75
|
+
- Creating organizations
|
|
76
|
+
- Inviting members with roles (`owner`, `admin`, `member`)
|
|
77
|
+
- Switching active organization
|
|
78
|
+
- Per-org data scoping via `org_id` columns
|
|
79
|
+
|
|
80
|
+
The active organization flows automatically through the system: `session.orgId` → `AGENT_ORG_ID` → SQL scoping. See the [Security & Data Scoping](/docs/security) docs for details.
|
|
81
|
+
|
|
82
|
+
## Access Tokens {#access-tokens}
|
|
83
|
+
|
|
84
|
+
For simple deployments, set `ACCESS_TOKEN` (single) or `ACCESS_TOKENS` (comma-separated) as environment variables:
|
|
85
|
+
|
|
86
|
+
```bash
|
|
87
|
+
# Single token
|
|
88
|
+
ACCESS_TOKEN=my-secret-token
|
|
89
|
+
|
|
90
|
+
# Multiple tokens
|
|
91
|
+
ACCESS_TOKENS=token1,token2,token3
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
When access tokens are configured, users see a token login page. Sessions are cookie-based with 30-day expiry.
|
|
95
|
+
|
|
96
|
+
## Bring Your Own Auth {#byoa}
|
|
97
|
+
|
|
98
|
+
Pass a custom `getSession` callback to use any auth provider (Clerk, Auth0, Firebase, etc.):
|
|
99
|
+
|
|
100
|
+
```typescript
|
|
101
|
+
// server/plugins/auth.ts
|
|
102
|
+
import { createAuthPlugin } from "@agent-native/core/server";
|
|
103
|
+
|
|
104
|
+
export default createAuthPlugin({
|
|
105
|
+
getSession: async (event) => {
|
|
106
|
+
// Your custom auth logic here
|
|
107
|
+
const session = await myAuthProvider.verify(event);
|
|
108
|
+
if (!session) return null;
|
|
109
|
+
return { email: session.email };
|
|
110
|
+
},
|
|
111
|
+
publicPaths: ["/api/webhooks"],
|
|
112
|
+
});
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
## Session API {#session-api}
|
|
116
|
+
|
|
117
|
+
The session object returned by `getSession(event)` has this shape:
|
|
118
|
+
|
|
119
|
+
```typescript
|
|
120
|
+
interface AuthSession {
|
|
121
|
+
email: string; // User's email (primary identifier)
|
|
122
|
+
userId?: string; // Better Auth user ID
|
|
123
|
+
token?: string; // Session token
|
|
124
|
+
orgId?: string; // Active organization ID
|
|
125
|
+
orgRole?: string; // Role in active org (owner/admin/member)
|
|
126
|
+
}
|
|
127
|
+
```
|
|
128
|
+
|
|
129
|
+
On the client, use the `useSession()` hook:
|
|
130
|
+
|
|
131
|
+
```typescript
|
|
132
|
+
import { useSession } from "@agent-native/core/client";
|
|
133
|
+
|
|
134
|
+
function MyComponent() {
|
|
135
|
+
const { session, isLoading } = useSession();
|
|
136
|
+
if (isLoading) return <p>Loading...</p>;
|
|
137
|
+
if (!session) return <p>Not signed in</p>;
|
|
138
|
+
return <p>Hello, {session.email}</p>;
|
|
139
|
+
}
|
|
140
|
+
```
|
|
141
|
+
|
|
142
|
+
## Environment Variables {#environment-variables}
|
|
143
|
+
|
|
144
|
+
| Variable | Purpose |
|
|
145
|
+
| ---------------------- | ---------------------------------------------------------------- |
|
|
146
|
+
| `AUTH_MODE` | Set to `local` to disable auth |
|
|
147
|
+
| `BETTER_AUTH_SECRET` | Signing key for Better Auth (auto-generated if not set) |
|
|
148
|
+
| `GOOGLE_CLIENT_ID` | Enable Google OAuth |
|
|
149
|
+
| `GOOGLE_CLIENT_SECRET` | Google OAuth secret |
|
|
150
|
+
| `GITHUB_CLIENT_ID` | Enable GitHub OAuth |
|
|
151
|
+
| `GITHUB_CLIENT_SECRET` | GitHub OAuth secret |
|
|
152
|
+
| `ACCESS_TOKEN` | Simple shared token auth |
|
|
153
|
+
| `ACCESS_TOKENS` | Comma-separated shared tokens |
|
|
154
|
+
| `AUTH_DISABLED` | Set to `true` to skip auth (infrastructure-level auth) |
|
|
155
|
+
| `A2A_SECRET` | Shared secret for JWT-signed A2A cross-app identity verification |
|
|
@@ -0,0 +1,244 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: "CLI Adapters"
|
|
3
|
+
description: "Connect any CLI tool to your agent-native app with a standard adapter interface for discovery and execution."
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# CLI Adapters
|
|
7
|
+
|
|
8
|
+
Give your agent structured access to any CLI tool — with discovery, execution, and consistent output handling.
|
|
9
|
+
|
|
10
|
+
## Overview {#overview}
|
|
11
|
+
|
|
12
|
+
Agents are great at running CLI commands. But without structure, every script reinvents how to invoke a CLI, check if it's installed, and parse its output.
|
|
13
|
+
|
|
14
|
+
CLI adapters solve this with a small interface — similar to file sync adapters but for command-line tools. Each adapter wraps a single CLI (`gh`, `ffmpeg`, `stripe`, `aws`) and provides:
|
|
15
|
+
|
|
16
|
+
- **Discovery** — the agent can list what CLIs are available and what they do
|
|
17
|
+
- **Availability checks** — is the CLI installed?
|
|
18
|
+
- **Consistent execution** — stdout, stderr, and exit code in a standard format
|
|
19
|
+
|
|
20
|
+
## The interface {#the-interface}
|
|
21
|
+
|
|
22
|
+
Every CLI adapter implements `CliAdapter`:
|
|
23
|
+
|
|
24
|
+
```ts
|
|
25
|
+
import type { CliAdapter, CliResult } from "@agent-native/core/adapters/cli";
|
|
26
|
+
|
|
27
|
+
interface CliAdapter {
|
|
28
|
+
name: string; // "gh", "stripe", "ffmpeg"
|
|
29
|
+
description: string; // What the agent sees during discovery
|
|
30
|
+
isAvailable(): Promise<boolean>;
|
|
31
|
+
execute(args: string[]): Promise<CliResult>;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
interface CliResult {
|
|
35
|
+
stdout: string;
|
|
36
|
+
stderr: string;
|
|
37
|
+
exitCode: number;
|
|
38
|
+
}
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
## ShellCliAdapter {#shell-adapter}
|
|
42
|
+
|
|
43
|
+
For most CLIs, you don't need a custom class. `ShellCliAdapter` wraps any CLI binary with sensible defaults:
|
|
44
|
+
|
|
45
|
+
```ts
|
|
46
|
+
import { ShellCliAdapter } from "@agent-native/core/adapters/cli";
|
|
47
|
+
|
|
48
|
+
const gh = new ShellCliAdapter({
|
|
49
|
+
command: "gh",
|
|
50
|
+
description: "GitHub CLI — manage repos, PRs, issues, and releases",
|
|
51
|
+
});
|
|
52
|
+
|
|
53
|
+
const ffmpeg = new ShellCliAdapter({
|
|
54
|
+
command: "ffmpeg",
|
|
55
|
+
description: "Audio/video processing and transcoding",
|
|
56
|
+
timeoutMs: 120_000, // 2 min for long encodes
|
|
57
|
+
});
|
|
58
|
+
|
|
59
|
+
const stripe = new ShellCliAdapter({
|
|
60
|
+
command: "stripe",
|
|
61
|
+
description: "Stripe CLI — manage payments, webhooks, and customers",
|
|
62
|
+
env: { STRIPE_API_KEY: process.env.STRIPE_SECRET_KEY! },
|
|
63
|
+
});
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
### Options {#shell-adapter-options}
|
|
67
|
+
|
|
68
|
+
| Option | Type | Description |
|
|
69
|
+
| ------------- | ------ | --------------------------------------------------- |
|
|
70
|
+
| `command` | string | Binary name or path (required) |
|
|
71
|
+
| `description` | string | What the CLI does — shown to the agent (required) |
|
|
72
|
+
| `name` | string | Display name (defaults to `command`) |
|
|
73
|
+
| `env` | Record | Extra environment variables merged with process.env |
|
|
74
|
+
| `cwd` | string | Working directory (defaults to process.cwd()) |
|
|
75
|
+
| `timeoutMs` | number | Execution timeout (default: 30000) |
|
|
76
|
+
|
|
77
|
+
## Registry {#registry}
|
|
78
|
+
|
|
79
|
+
The `CliRegistry` collects adapters so the agent can discover what's available at runtime:
|
|
80
|
+
|
|
81
|
+
```ts
|
|
82
|
+
import { CliRegistry, ShellCliAdapter } from "@agent-native/core/adapters/cli";
|
|
83
|
+
|
|
84
|
+
const cliRegistry = new CliRegistry();
|
|
85
|
+
|
|
86
|
+
cliRegistry.register(
|
|
87
|
+
new ShellCliAdapter({
|
|
88
|
+
command: "gh",
|
|
89
|
+
description: "GitHub CLI — manage repos, PRs, issues, and releases",
|
|
90
|
+
}),
|
|
91
|
+
);
|
|
92
|
+
|
|
93
|
+
cliRegistry.register(
|
|
94
|
+
new ShellCliAdapter({
|
|
95
|
+
command: "ffmpeg",
|
|
96
|
+
description: "Audio/video processing and transcoding",
|
|
97
|
+
}),
|
|
98
|
+
);
|
|
99
|
+
|
|
100
|
+
// List all registered CLIs
|
|
101
|
+
cliRegistry.list();
|
|
102
|
+
// → [{ name: "gh", ... }, { name: "ffmpeg", ... }]
|
|
103
|
+
|
|
104
|
+
// List only installed CLIs
|
|
105
|
+
await cliRegistry.listAvailable();
|
|
106
|
+
// → [{ name: "gh", ... }] (if ffmpeg isn't installed)
|
|
107
|
+
|
|
108
|
+
// Get a full summary for agent discovery
|
|
109
|
+
await cliRegistry.describe();
|
|
110
|
+
// → [{ name: "gh", description: "...", available: true },
|
|
111
|
+
// { name: "ffmpeg", description: "...", available: false }]
|
|
112
|
+
|
|
113
|
+
// Execute a command
|
|
114
|
+
const gh = cliRegistry.get("gh");
|
|
115
|
+
const result = await gh?.execute(["pr", "list", "--json", "title,url"]);
|
|
116
|
+
console.log(result?.stdout);
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
## Custom adapters {#custom-adapter}
|
|
120
|
+
|
|
121
|
+
When you need more than `ShellCliAdapter` provides — custom auth, output parsing, or pre/post processing — implement `CliAdapter` directly:
|
|
122
|
+
|
|
123
|
+
```ts
|
|
124
|
+
import type { CliAdapter, CliResult } from "@agent-native/core/adapters/cli";
|
|
125
|
+
import { execFile } from "node:child_process";
|
|
126
|
+
|
|
127
|
+
export class DockerAdapter implements CliAdapter {
|
|
128
|
+
name = "docker";
|
|
129
|
+
description =
|
|
130
|
+
"Docker container management — build, run, and manage containers";
|
|
131
|
+
|
|
132
|
+
async isAvailable(): Promise<boolean> {
|
|
133
|
+
try {
|
|
134
|
+
const result = await this.execute([
|
|
135
|
+
"info",
|
|
136
|
+
"--format",
|
|
137
|
+
"{{.ServerVersion}}",
|
|
138
|
+
]);
|
|
139
|
+
return result.exitCode === 0;
|
|
140
|
+
} catch {
|
|
141
|
+
return false;
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
async execute(args: string[]): Promise<CliResult> {
|
|
146
|
+
return new Promise((resolve) => {
|
|
147
|
+
execFile(
|
|
148
|
+
"docker",
|
|
149
|
+
args,
|
|
150
|
+
{
|
|
151
|
+
timeout: 60_000,
|
|
152
|
+
maxBuffer: 10 * 1024 * 1024,
|
|
153
|
+
encoding: "utf-8",
|
|
154
|
+
},
|
|
155
|
+
(error, stdout, stderr) => {
|
|
156
|
+
resolve({
|
|
157
|
+
stdout: stdout ?? "",
|
|
158
|
+
stderr: stderr ?? "",
|
|
159
|
+
exitCode: (error as any)?.code ?? 0,
|
|
160
|
+
});
|
|
161
|
+
},
|
|
162
|
+
);
|
|
163
|
+
});
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
```
|
|
167
|
+
|
|
168
|
+
## Server route {#server-route}
|
|
169
|
+
|
|
170
|
+
Expose the registry to the UI via an API route so actions and components can discover and invoke CLIs:
|
|
171
|
+
|
|
172
|
+
```ts
|
|
173
|
+
// server/index.ts
|
|
174
|
+
import { createServer } from "@agent-native/core";
|
|
175
|
+
import { CliRegistry, ShellCliAdapter } from "@agent-native/core/adapters/cli";
|
|
176
|
+
|
|
177
|
+
const app = createServer();
|
|
178
|
+
const cliRegistry = new CliRegistry();
|
|
179
|
+
|
|
180
|
+
cliRegistry.register(
|
|
181
|
+
new ShellCliAdapter({
|
|
182
|
+
command: "gh",
|
|
183
|
+
description: "GitHub CLI",
|
|
184
|
+
}),
|
|
185
|
+
);
|
|
186
|
+
|
|
187
|
+
// Discovery endpoint — agent can query this
|
|
188
|
+
app.get("/api/cli", async (_req, res) => {
|
|
189
|
+
const tools = await cliRegistry.describe();
|
|
190
|
+
res.json(tools);
|
|
191
|
+
});
|
|
192
|
+
|
|
193
|
+
// Execution endpoint
|
|
194
|
+
app.post("/api/cli/:name", async (req, res) => {
|
|
195
|
+
const adapter = cliRegistry.get(req.params.name);
|
|
196
|
+
if (!adapter) return res.status(404).json({ error: "CLI not found" });
|
|
197
|
+
|
|
198
|
+
const { args } = req.body;
|
|
199
|
+
const result = await adapter.execute(args ?? []);
|
|
200
|
+
res.json(result);
|
|
201
|
+
});
|
|
202
|
+
```
|
|
203
|
+
|
|
204
|
+
## Using from actions {#from-scripts}
|
|
205
|
+
|
|
206
|
+
Actions can use CLI adapters directly for structured access:
|
|
207
|
+
|
|
208
|
+
```ts
|
|
209
|
+
// actions/list-prs.ts
|
|
210
|
+
import { ShellCliAdapter } from "@agent-native/core/adapters/cli";
|
|
211
|
+
|
|
212
|
+
const gh = new ShellCliAdapter({
|
|
213
|
+
command: "gh",
|
|
214
|
+
description: "GitHub CLI",
|
|
215
|
+
});
|
|
216
|
+
|
|
217
|
+
export default async function listPrs() {
|
|
218
|
+
if (!(await gh.isAvailable())) {
|
|
219
|
+
console.error("GitHub CLI not installed. Run: brew install gh");
|
|
220
|
+
process.exit(1);
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
const result = await gh.execute([
|
|
224
|
+
"pr",
|
|
225
|
+
"list",
|
|
226
|
+
"--json",
|
|
227
|
+
"title,url,state",
|
|
228
|
+
"--limit",
|
|
229
|
+
"10",
|
|
230
|
+
]);
|
|
231
|
+
|
|
232
|
+
if (result.exitCode !== 0) {
|
|
233
|
+
console.error(result.stderr);
|
|
234
|
+
process.exit(1);
|
|
235
|
+
}
|
|
236
|
+
|
|
237
|
+
const prs = JSON.parse(result.stdout);
|
|
238
|
+
const fs = await import("node:fs/promises");
|
|
239
|
+
await fs.writeFile("data/prs.json", JSON.stringify(prs, null, 2));
|
|
240
|
+
console.log(`Fetched ${prs.length} PRs`);
|
|
241
|
+
}
|
|
242
|
+
```
|
|
243
|
+
|
|
244
|
+
Or skip the adapter entirely and call the CLI directly in a script — adapters are useful when you want discovery, availability checks, and consistent error handling, but they're not required. Use whichever approach fits.
|