@agent-native/core 0.149.2 → 0.149.3
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/corpus/README.md +1 -1
- package/corpus/templates/analytics/.agents/skills/actions/SKILL.md +54 -488
- package/corpus/templates/analytics/.agents/skills/actions/references/action-fields.md +136 -0
- package/corpus/templates/analytics/.agents/skills/actions/references/examples.md +94 -0
- package/corpus/templates/analytics/.agents/skills/actions/references/provider-apis.md +95 -0
- package/corpus/templates/analytics/.agents/skills/create-skill/SKILL.md +9 -35
- package/corpus/templates/analytics/.agents/skills/creative-context/SKILL.md +4 -2
- package/corpus/templates/analytics/.agents/skills/frontend-design/SKILL.md +4 -5
- package/corpus/templates/analytics/.agents/skills/turn-into-app/SKILL.md +18 -31
- package/corpus/templates/analytics/AGENTS.md +25 -32
- package/corpus/templates/analytics/app/global.css +1 -1
- package/corpus/templates/analytics/changelog/2026-08-11-full-page-chat-composers-stay-at-a-focused-750px-width.md +6 -0
- package/corpus/templates/assets/.agents/skills/actions/SKILL.md +54 -488
- package/corpus/templates/assets/.agents/skills/actions/references/action-fields.md +136 -0
- package/corpus/templates/assets/.agents/skills/actions/references/examples.md +94 -0
- package/corpus/templates/assets/.agents/skills/actions/references/provider-apis.md +95 -0
- package/corpus/templates/assets/.agents/skills/create-skill/SKILL.md +9 -35
- package/corpus/templates/assets/.agents/skills/creative-context/SKILL.md +4 -2
- package/corpus/templates/assets/.agents/skills/frontend-design/SKILL.md +4 -5
- package/corpus/templates/assets/.agents/skills/turn-into-app/SKILL.md +18 -31
- package/corpus/templates/assets/AGENTS.md +6 -9
- package/corpus/templates/assets/app/global.css +1 -1
- package/corpus/templates/assets/changelog/2026-08-11-full-page-chat-composers-stay-at-a-focused-750px-width.md +6 -0
- package/corpus/templates/brain/.agents/skills/actions/SKILL.md +54 -488
- package/corpus/templates/brain/.agents/skills/actions/references/action-fields.md +136 -0
- package/corpus/templates/brain/.agents/skills/actions/references/examples.md +94 -0
- package/corpus/templates/brain/.agents/skills/actions/references/provider-apis.md +95 -0
- package/corpus/templates/brain/.agents/skills/create-skill/SKILL.md +9 -35
- package/corpus/templates/brain/.agents/skills/frontend-design/SKILL.md +4 -5
- package/corpus/templates/brain/.agents/skills/turn-into-app/SKILL.md +18 -31
- package/corpus/templates/brain/AGENTS.md +5 -12
- package/corpus/templates/brain/app/global.css +1 -1
- package/corpus/templates/brain/changelog/2026-08-11-full-page-chat-composers-stay-at-a-focused-750px-width.md +6 -0
- package/corpus/templates/calendar/.agents/skills/actions/SKILL.md +54 -488
- package/corpus/templates/calendar/.agents/skills/actions/references/action-fields.md +136 -0
- package/corpus/templates/calendar/.agents/skills/actions/references/examples.md +94 -0
- package/corpus/templates/calendar/.agents/skills/actions/references/provider-apis.md +95 -0
- package/corpus/templates/calendar/.agents/skills/create-skill/SKILL.md +9 -35
- package/corpus/templates/calendar/.agents/skills/frontend-design/SKILL.md +4 -5
- package/corpus/templates/calendar/.agents/skills/turn-into-app/SKILL.md +18 -31
- package/corpus/templates/calendar/AGENTS.md +8 -9
- package/corpus/templates/chat/.agents/skills/actions/SKILL.md +54 -488
- package/corpus/templates/chat/.agents/skills/actions/references/action-fields.md +136 -0
- package/corpus/templates/chat/.agents/skills/actions/references/examples.md +94 -0
- package/corpus/templates/chat/.agents/skills/actions/references/provider-apis.md +95 -0
- package/corpus/templates/chat/.agents/skills/create-skill/SKILL.md +9 -35
- package/corpus/templates/chat/.agents/skills/frontend-design/SKILL.md +4 -5
- package/corpus/templates/chat/.agents/skills/turn-into-app/SKILL.md +18 -31
- package/corpus/templates/chat/AGENTS.md +32 -80
- package/corpus/templates/clips/.agents/skills/actions/SKILL.md +54 -488
- package/corpus/templates/clips/.agents/skills/actions/references/action-fields.md +136 -0
- package/corpus/templates/clips/.agents/skills/actions/references/examples.md +94 -0
- package/corpus/templates/clips/.agents/skills/actions/references/provider-apis.md +95 -0
- package/corpus/templates/clips/.agents/skills/create-skill/SKILL.md +9 -35
- package/corpus/templates/clips/.agents/skills/frontend-design/SKILL.md +4 -5
- package/corpus/templates/clips/.agents/skills/turn-into-app/SKILL.md +18 -31
- package/corpus/templates/clips/AGENTS.md +25 -31
- package/corpus/templates/content/.agents/skills/actions/SKILL.md +54 -488
- package/corpus/templates/content/.agents/skills/actions/references/action-fields.md +136 -0
- package/corpus/templates/content/.agents/skills/actions/references/examples.md +94 -0
- package/corpus/templates/content/.agents/skills/actions/references/provider-apis.md +95 -0
- package/corpus/templates/content/.agents/skills/create-skill/SKILL.md +9 -35
- package/corpus/templates/content/.agents/skills/creative-context/SKILL.md +4 -2
- package/corpus/templates/content/.agents/skills/frontend-design/SKILL.md +4 -5
- package/corpus/templates/content/.agents/skills/turn-into-app/SKILL.md +18 -31
- package/corpus/templates/content/AGENTS.md +5 -9
- package/corpus/templates/crm/.agents/skills/turn-into-app/SKILL.md +18 -31
- package/corpus/templates/crm/AGENTS.md +7 -11
- package/corpus/templates/crm/app/global.css +1 -1
- package/corpus/templates/crm/changelog/2026-08-11-full-page-chat-composers-stay-at-a-focused-750px-width.md +6 -0
- package/corpus/templates/design/.agents/skills/actions/SKILL.md +54 -488
- package/corpus/templates/design/.agents/skills/actions/references/action-fields.md +136 -0
- package/corpus/templates/design/.agents/skills/actions/references/examples.md +94 -0
- package/corpus/templates/design/.agents/skills/actions/references/provider-apis.md +95 -0
- package/corpus/templates/design/.agents/skills/create-skill/SKILL.md +9 -35
- package/corpus/templates/design/.agents/skills/creative-context/SKILL.md +4 -2
- package/corpus/templates/design/.agents/skills/frontend-design/SKILL.md +4 -5
- package/corpus/templates/design/.agents/skills/turn-into-app/SKILL.md +18 -31
- package/corpus/templates/design/.generated/bridge/editor-chrome.generated.ts +70 -3
- package/corpus/templates/design/AGENTS.md +13 -21
- package/corpus/templates/design/app/components/design/DesignCanvas.tsx +12 -0
- package/corpus/templates/design/app/components/design/LayersPanel.tsx +19 -2
- package/corpus/templates/design/app/components/design/MultiScreenCanvas.tsx +115 -7
- package/corpus/templates/design/app/components/design/bridge/editor-chrome.bridge.ts +82 -7
- package/corpus/templates/design/app/components/design/design-trace.ts +120 -0
- package/corpus/templates/design/app/components/design/dnd-debug.ts +2 -1
- package/corpus/templates/design/app/components/design/edit-panel/position-layout-properties.tsx +40 -26
- package/corpus/templates/design/app/components/design/multi-screen/board-surface-html.ts +4 -1
- package/corpus/templates/design/app/components/design/multi-screen/frame-geometry.ts +12 -3
- package/corpus/templates/design/app/components/design/multi-screen/screen-content-cache.ts +4 -0
- package/corpus/templates/design/app/components/design/multi-screen/types.ts +7 -0
- package/corpus/templates/design/app/components/editor/PromptDialog.tsx +3 -2
- package/corpus/templates/design/app/components/layout/Sidebar.tsx +2 -2
- package/corpus/templates/design/app/hooks/useDesignHotkeys.ts +3 -0
- package/corpus/templates/design/app/i18n-data.ts +1 -0
- package/corpus/templates/design/app/pages/DesignSystemSetup.tsx +5 -5
- package/corpus/templates/design/app/pages/DesignSystems.tsx +3 -2
- package/corpus/templates/design/app/pages/design-editor/canvas-primitive-insert.ts +100 -13
- package/corpus/templates/design/app/pages/design-editor/cross-screen-text-color.ts +1 -1
- package/corpus/templates/design/app/pages/design-editor/data-operations.ts +14 -0
- package/corpus/templates/design/changelog/2026-08-10-marquee-selecting-layers-far-down-a-tall-screen-now-selects-.md +6 -0
- package/corpus/templates/design/changelog/2026-08-10-the-frame-tool-draws-a-plain-frame-by-default-with-screen-av.md +6 -0
- package/corpus/templates/design/e2e/global-setup.ts +27 -32
- package/corpus/templates/design/playwright.config.ts +3 -5
- package/corpus/templates/design/shared/breakpoint-media.ts +9 -2
- package/corpus/templates/dispatch/.agents/skills/actions/SKILL.md +54 -488
- package/corpus/templates/dispatch/.agents/skills/actions/references/action-fields.md +136 -0
- package/corpus/templates/dispatch/.agents/skills/actions/references/examples.md +94 -0
- package/corpus/templates/dispatch/.agents/skills/actions/references/provider-apis.md +95 -0
- package/corpus/templates/dispatch/.agents/skills/create-skill/SKILL.md +9 -35
- package/corpus/templates/dispatch/.agents/skills/frontend-design/SKILL.md +4 -5
- package/corpus/templates/dispatch/.agents/skills/turn-into-app/SKILL.md +18 -31
- package/corpus/templates/dispatch/AGENTS.md +9 -16
- package/corpus/templates/factory/.agents/skills/actions/SKILL.md +54 -488
- package/corpus/templates/factory/.agents/skills/actions/references/action-fields.md +136 -0
- package/corpus/templates/factory/.agents/skills/actions/references/examples.md +94 -0
- package/corpus/templates/factory/.agents/skills/actions/references/provider-apis.md +95 -0
- package/corpus/templates/factory/.agents/skills/create-skill/SKILL.md +9 -35
- package/corpus/templates/factory/.agents/skills/frontend-design/SKILL.md +4 -5
- package/corpus/templates/factory/.agents/skills/turn-into-app/SKILL.md +18 -31
- package/corpus/templates/factory/AGENTS.md +10 -24
- package/corpus/templates/forms/.agents/skills/actions/SKILL.md +54 -488
- package/corpus/templates/forms/.agents/skills/actions/references/action-fields.md +136 -0
- package/corpus/templates/forms/.agents/skills/actions/references/examples.md +94 -0
- package/corpus/templates/forms/.agents/skills/actions/references/provider-apis.md +95 -0
- package/corpus/templates/forms/.agents/skills/create-skill/SKILL.md +9 -35
- package/corpus/templates/forms/.agents/skills/frontend-design/SKILL.md +4 -5
- package/corpus/templates/forms/.agents/skills/turn-into-app/SKILL.md +18 -31
- package/corpus/templates/forms/AGENTS.md +11 -17
- package/corpus/templates/forms/app/global.css +1 -0
- package/corpus/templates/forms/changelog/2026-08-11-full-page-chat-composers-stay-at-a-focused-750px-width.md +6 -0
- package/corpus/templates/macros/.agents/skills/frontend-design/SKILL.md +4 -5
- package/corpus/templates/macros/.agents/skills/turn-into-app/SKILL.md +18 -31
- package/corpus/templates/macros/AGENTS.md +8 -8
- package/corpus/templates/mail/.agents/skills/actions/SKILL.md +54 -488
- package/corpus/templates/mail/.agents/skills/actions/references/action-fields.md +136 -0
- package/corpus/templates/mail/.agents/skills/actions/references/examples.md +94 -0
- package/corpus/templates/mail/.agents/skills/actions/references/provider-apis.md +95 -0
- package/corpus/templates/mail/.agents/skills/create-skill/SKILL.md +9 -35
- package/corpus/templates/mail/.agents/skills/frontend-design/SKILL.md +4 -5
- package/corpus/templates/mail/.agents/skills/turn-into-app/SKILL.md +18 -31
- package/corpus/templates/mail/AGENTS.md +5 -6
- package/corpus/templates/plan/.agents/skills/actions/SKILL.md +54 -488
- package/corpus/templates/plan/.agents/skills/actions/references/action-fields.md +136 -0
- package/corpus/templates/plan/.agents/skills/actions/references/examples.md +94 -0
- package/corpus/templates/plan/.agents/skills/actions/references/provider-apis.md +95 -0
- package/corpus/templates/plan/.agents/skills/create-skill/SKILL.md +9 -35
- package/corpus/templates/plan/.agents/skills/frontend-design/SKILL.md +4 -5
- package/corpus/templates/plan/.agents/skills/turn-into-app/SKILL.md +18 -31
- package/corpus/templates/plan/AGENTS.md +5 -14
- package/corpus/templates/plan/changelog/2026-08-11-plan-no-longer-reloads-when-runtime-state-changes.md +6 -0
- package/corpus/templates/plan/vite.config.ts +5 -0
- package/corpus/templates/slides/.agents/skills/actions/SKILL.md +54 -488
- package/corpus/templates/slides/.agents/skills/actions/references/action-fields.md +136 -0
- package/corpus/templates/slides/.agents/skills/actions/references/examples.md +94 -0
- package/corpus/templates/slides/.agents/skills/actions/references/provider-apis.md +95 -0
- package/corpus/templates/slides/.agents/skills/create-deck/SKILL.md +2 -2
- package/corpus/templates/slides/.agents/skills/create-skill/SKILL.md +9 -35
- package/corpus/templates/slides/.agents/skills/creative-context/SKILL.md +6 -3
- package/corpus/templates/slides/.agents/skills/deck-management/SKILL.md +6 -1
- package/corpus/templates/slides/.agents/skills/frontend-design/SKILL.md +4 -5
- package/corpus/templates/slides/.agents/skills/image-generation-via-a2a/SKILL.md +3 -2
- package/corpus/templates/slides/.agents/skills/slide-editing/SKILL.md +3 -0
- package/corpus/templates/slides/.agents/skills/slide-images/SKILL.md +3 -3
- package/corpus/templates/slides/.agents/skills/turn-into-app/SKILL.md +18 -31
- package/corpus/templates/slides/AGENTS.md +22 -25
- package/corpus/templates/slides/actions/get-deck-reference-context.ts +2 -2
- package/corpus/templates/slides/actions/get-deck.ts +57 -9
- package/corpus/templates/slides/actions/import-file.ts +2 -1
- package/corpus/templates/slides/actions/patch-deck.ts +45 -2
- package/corpus/templates/slides/actions/update-slide.ts +1 -1
- package/corpus/templates/slides/app/components/comments/SlideCommentsPanel.tsx +2 -2
- package/corpus/templates/slides/app/components/deck/DeckCard.tsx +1 -23
- package/corpus/templates/slides/app/components/design-system/DesignSystemCard.tsx +2 -2
- package/corpus/templates/slides/app/components/design-system/DesignSystemSetup.tsx +6 -6
- package/corpus/templates/slides/app/components/editor/AnimationsPanel.tsx +3 -3
- package/corpus/templates/slides/app/components/editor/DeckEditorSkeleton.tsx +4 -4
- package/corpus/templates/slides/app/components/editor/EditorSidebar.tsx +1 -1
- package/corpus/templates/slides/app/components/editor/EditorToolbar.tsx +428 -180
- package/corpus/templates/slides/app/components/editor/ExportMenu.tsx +294 -266
- package/corpus/templates/slides/app/components/editor/PromptDialog.tsx +7 -5
- package/corpus/templates/slides/app/components/editor/SlideContextToolbar.tsx +1 -1
- package/corpus/templates/slides/app/components/editor/SlideEditor.tsx +40 -12
- package/corpus/templates/slides/app/components/editor/SpeakerNotesPanel.tsx +6 -12
- package/corpus/templates/slides/app/components/editor/editor-command-model.ts +35 -0
- package/corpus/templates/slides/app/components/layout/Sidebar.tsx +8 -10
- package/corpus/templates/slides/app/context/DeckContext.tsx +2 -1
- package/corpus/templates/slides/app/global.css +76 -1
- package/corpus/templates/slides/app/i18n/en-US.ts +1 -0
- package/corpus/templates/slides/app/lib/create-deck-generation.ts +51 -23
- package/corpus/templates/slides/app/lib/slide-animation-elements.ts +68 -5
- package/corpus/templates/slides/app/pages/DeckEditor.tsx +13 -6
- package/corpus/templates/slides/app/pages/DesignSystems.tsx +2 -2
- package/corpus/templates/slides/app/pages/Index.tsx +87 -74
- package/corpus/templates/slides/app/root.tsx +43 -0
- package/corpus/templates/slides/changelog/2026-08-11-faster-slides-chat-deck-reads.md +6 -0
- package/corpus/templates/slides/changelog/2026-08-11-slides-chat-can-read-one-slide-without-loading-the-full-deck.md +6 -0
- package/corpus/templates/slides/changelog/2026-08-11-slides-clearly-indicate-when-an-ai-agent-is-editing-alongsid.md +6 -0
- package/corpus/templates/slides/package.json +1 -0
- package/corpus/templates/slides/server/lib/validate-slide-animations.ts +163 -0
- package/corpus/templates/slides/server/plugins/agent-chat.ts +4 -3
- package/corpus/templates/slides/shared/api.ts +46 -15
- package/corpus/templates/tasks/.agents/skills/actions/SKILL.md +54 -488
- package/corpus/templates/tasks/.agents/skills/actions/references/action-fields.md +136 -0
- package/corpus/templates/tasks/.agents/skills/actions/references/examples.md +94 -0
- package/corpus/templates/tasks/.agents/skills/actions/references/provider-apis.md +95 -0
- package/corpus/templates/tasks/.agents/skills/agent-watchdog/SKILL.md +1 -0
- package/corpus/templates/tasks/.agents/skills/create-skill/SKILL.md +9 -35
- package/corpus/templates/tasks/.agents/skills/efficient-fable/SKILL.md +1 -0
- package/corpus/templates/tasks/.agents/skills/efficient-frontier/SKILL.md +1 -0
- package/corpus/templates/tasks/.agents/skills/frontend-design/SKILL.md +4 -5
- package/corpus/templates/tasks/.agents/skills/plan-arbiter/SKILL.md +1 -0
- package/corpus/templates/tasks/.agents/skills/plow-ahead/SKILL.md +1 -0
- package/corpus/templates/tasks/.agents/skills/quick-recap/SKILL.md +1 -0
- package/corpus/templates/tasks/.agents/skills/read-the-damn-docs/SKILL.md +1 -0
- package/corpus/templates/tasks/.agents/skills/stay-within-limits/SKILL.md +1 -0
- package/corpus/templates/tasks/.agents/skills/turn-into-app/SKILL.md +18 -31
- package/corpus/templates/tasks/AGENTS.md +5 -20
- package/dist/agent/production-agent.js +376 -345
- package/dist/agent/run-manager.js +156 -14
- package/dist/agent/run-store.d.ts +11 -10
- package/dist/agent/run-store.js +17 -13
- package/dist/client/AssistantChat.d.ts +6 -2
- package/dist/client/AssistantChat.js +216 -131
- package/dist/client/active-run-state.d.ts +9 -1
- package/dist/client/active-run-state.js +34 -3
- package/dist/client/agent-chat-adapter.d.ts +8 -0
- package/dist/client/agent-chat-adapter.js +114 -28
- package/dist/client/chat/message-components.d.ts +7 -1
- package/dist/client/chat/message-components.js +32 -5
- package/dist/client/chat/run-recovery.d.ts +1 -0
- package/dist/client/chat/run-recovery.js +8 -0
- package/dist/client/chat/tool-call-display.d.ts +2 -0
- package/dist/client/chat/tool-call-display.js +2 -0
- package/dist/client/chat-first/apps-rail.js +1 -1
- package/dist/client/chat-first/chat-history.d.ts +1 -1
- package/dist/client/chat-first/chat-history.js +5 -2
- package/dist/client/sse-event-processor.d.ts +4 -2
- package/dist/client/sse-event-processor.js +36 -6
- package/dist/client/use-run-stuck-detection.d.ts +2 -0
- package/dist/client/use-run-stuck-detection.js +85 -9
- package/dist/collab/awareness.d.ts +2 -2
- package/dist/collab/routes.d.ts +1 -1
- package/dist/integrations/adapters/slack.d.ts +0 -4
- package/dist/integrations/adapters/slack.js +6 -30
- package/dist/integrations/catalog.js +1 -1
- package/dist/integrations/pending-tasks-store.d.ts +0 -8
- package/dist/integrations/pending-tasks-store.js +0 -21
- package/dist/integrations/slack-manifest.d.ts +2 -2
- package/dist/integrations/slack-manifest.js +0 -3
- package/dist/mcp/screen-memory-stdio.d.ts +7 -7
- package/dist/observability/routes.d.ts +3 -3
- package/dist/provider-api/actions/custom-provider-registration.d.ts +4 -4
- package/dist/provider-api/actions/provider-api.d.ts +8 -8
- package/dist/resources/handlers.d.ts +1 -1
- package/dist/scripts/docs/source-search.js +2 -2
- package/dist/secrets/routes.d.ts +9 -9
- package/dist/server/agent-chat/framework-prompts.js +7 -2
- package/dist/server/agent-chat/prompt-resources.js +2 -2
- package/dist/server/agent-chat/skill-frontmatter.d.ts +31 -2
- package/dist/server/agent-chat/skill-frontmatter.js +41 -15
- package/dist/server/agent-chat-plugin.js +3 -3
- package/dist/server/agent-engine-api-key-route.d.ts +1 -1
- package/dist/server/agents-bundle.d.ts +16 -19
- package/dist/server/agents-bundle.js +19 -35
- package/dist/server/better-auth-instance.d.ts +1 -0
- package/dist/server/better-auth-instance.js +17 -2
- package/dist/server/prompts/framework-core-compact.d.ts +6 -1
- package/dist/server/prompts/framework-core-compact.js +12 -9
- package/dist/server/prompts/framework-core.d.ts +6 -1
- package/dist/server/prompts/framework-core.js +11 -9
- package/dist/server/prompts/index.d.ts +1 -1
- package/dist/server/prompts/index.js +1 -1
- package/dist/server/prompts/shared-rules.d.ts +15 -11
- package/dist/server/prompts/shared-rules.js +17 -13
- package/dist/server/realtime-token.d.ts +1 -1
- package/dist/server/transcribe-voice.d.ts +1 -1
- package/dist/templates/chat/.agents/skills/actions/SKILL.md +54 -488
- package/dist/templates/chat/.agents/skills/actions/references/action-fields.md +136 -0
- package/dist/templates/chat/.agents/skills/actions/references/examples.md +94 -0
- package/dist/templates/chat/.agents/skills/actions/references/provider-apis.md +95 -0
- package/dist/templates/chat/.agents/skills/create-skill/SKILL.md +9 -35
- package/dist/templates/chat/.agents/skills/frontend-design/SKILL.md +4 -5
- package/dist/templates/chat/.agents/skills/turn-into-app/SKILL.md +18 -31
- package/dist/templates/chat/AGENTS.md +32 -80
- package/dist/templates/default/.agents/skills/actions/SKILL.md +54 -488
- package/dist/templates/default/.agents/skills/actions/references/action-fields.md +136 -0
- package/dist/templates/default/.agents/skills/actions/references/examples.md +94 -0
- package/dist/templates/default/.agents/skills/actions/references/provider-apis.md +95 -0
- package/dist/templates/default/.agents/skills/create-skill/SKILL.md +9 -35
- package/dist/templates/default/.agents/skills/frontend-design/SKILL.md +4 -5
- package/dist/templates/default/.agents/skills/turn-into-app/SKILL.md +18 -31
- package/dist/templates/headless/.agents/skills/actions/SKILL.md +54 -488
- package/dist/templates/headless/.agents/skills/actions/references/action-fields.md +136 -0
- package/dist/templates/headless/.agents/skills/actions/references/examples.md +94 -0
- package/dist/templates/headless/.agents/skills/actions/references/provider-apis.md +95 -0
- package/dist/templates/headless/.agents/skills/turn-into-app/SKILL.md +18 -31
- package/dist/templates/workspace-core/.agents/skills/actions/SKILL.md +54 -488
- package/dist/templates/workspace-core/.agents/skills/actions/references/action-fields.md +136 -0
- package/dist/templates/workspace-core/.agents/skills/actions/references/examples.md +94 -0
- package/dist/templates/workspace-core/.agents/skills/actions/references/provider-apis.md +95 -0
- package/dist/templates/workspace-core/.agents/skills/adding-workspace-apps/SKILL.md +1 -0
- package/dist/templates/workspace-core/.agents/skills/agent-page/SKILL.md +1 -0
- package/dist/templates/workspace-core/.agents/skills/create-skill/SKILL.md +9 -35
- package/dist/templates/workspace-core/.agents/skills/frontend-design/SKILL.md +4 -5
- package/dist/templates/workspace-core/.agents/skills/recurring-jobs/SKILL.md +21 -29
- package/dist/templates/workspace-core/.agents/skills/turn-into-app/SKILL.md +18 -31
- package/dist/templates/workspace-core/.agents/skills/workspace-conventions/SKILL.md +7 -17
- package/dist/templates/workspace-core/.agents/skills/writing-agent-instructions/SKILL.md +3 -3
- package/dist/templates/workspace-core/AGENTS.md +7 -16
- package/docs/content/messaging.mdx +6 -7
- package/package.json +1 -1
- package/src/templates/chat/.agents/skills/actions/SKILL.md +54 -488
- package/src/templates/chat/.agents/skills/actions/references/action-fields.md +136 -0
- package/src/templates/chat/.agents/skills/actions/references/examples.md +94 -0
- package/src/templates/chat/.agents/skills/actions/references/provider-apis.md +95 -0
- package/src/templates/chat/.agents/skills/create-skill/SKILL.md +9 -35
- package/src/templates/chat/.agents/skills/frontend-design/SKILL.md +4 -5
- package/src/templates/chat/.agents/skills/turn-into-app/SKILL.md +18 -31
- package/src/templates/chat/AGENTS.md +32 -80
- package/src/templates/default/.agents/skills/actions/SKILL.md +54 -488
- package/src/templates/default/.agents/skills/actions/references/action-fields.md +136 -0
- package/src/templates/default/.agents/skills/actions/references/examples.md +94 -0
- package/src/templates/default/.agents/skills/actions/references/provider-apis.md +95 -0
- package/src/templates/default/.agents/skills/create-skill/SKILL.md +9 -35
- package/src/templates/default/.agents/skills/frontend-design/SKILL.md +4 -5
- package/src/templates/default/.agents/skills/turn-into-app/SKILL.md +18 -31
- package/src/templates/headless/.agents/skills/actions/SKILL.md +54 -488
- package/src/templates/headless/.agents/skills/actions/references/action-fields.md +136 -0
- package/src/templates/headless/.agents/skills/actions/references/examples.md +94 -0
- package/src/templates/headless/.agents/skills/actions/references/provider-apis.md +95 -0
- package/src/templates/headless/.agents/skills/turn-into-app/SKILL.md +18 -31
- package/src/templates/workspace-core/.agents/skills/actions/SKILL.md +54 -488
- package/src/templates/workspace-core/.agents/skills/actions/references/action-fields.md +136 -0
- package/src/templates/workspace-core/.agents/skills/actions/references/examples.md +94 -0
- package/src/templates/workspace-core/.agents/skills/actions/references/provider-apis.md +95 -0
- package/src/templates/workspace-core/.agents/skills/adding-workspace-apps/SKILL.md +1 -0
- package/src/templates/workspace-core/.agents/skills/agent-page/SKILL.md +1 -0
- package/src/templates/workspace-core/.agents/skills/create-skill/SKILL.md +9 -35
- package/src/templates/workspace-core/.agents/skills/frontend-design/SKILL.md +4 -5
- package/src/templates/workspace-core/.agents/skills/recurring-jobs/SKILL.md +21 -29
- package/src/templates/workspace-core/.agents/skills/turn-into-app/SKILL.md +18 -31
- package/src/templates/workspace-core/.agents/skills/workspace-conventions/SKILL.md +7 -17
- package/src/templates/workspace-core/.agents/skills/writing-agent-instructions/SKILL.md +3 -3
- package/src/templates/workspace-core/AGENTS.md +7 -16
package/corpus/README.md
CHANGED
|
@@ -14,59 +14,18 @@ metadata:
|
|
|
14
14
|
|
|
15
15
|
## Rule
|
|
16
16
|
|
|
17
|
-
Actions in `actions/` are the **single source of truth** for app operations. The agent calls them as tools,
|
|
17
|
+
Actions in `actions/` are the **single source of truth** for app operations. The agent calls them as tools, the frontend calls them through `useActionQuery` / `useActionMutation`, and the framework owns the HTTP transport behind those hooks — no duplicate `/api/` routes.
|
|
18
18
|
|
|
19
|
-
Before creating any custom
|
|
19
|
+
Before creating any custom route for app data, check `actions/` and the action table in `AGENTS.md`. An action already exists? Call it directly. Missing? Create or update a `defineAction`. **Stop trigger:** about to add a file under `server/routes/api/` (or middleware to guard one)? Check it against the exception list in *Custom `/api/` Routes* below first — even if you already started the route.
|
|
20
20
|
|
|
21
|
-
|
|
21
|
+
## Keep Actions Deterministic
|
|
22
22
|
|
|
23
|
-
|
|
23
|
+
An action may call a provider API, validate data, and persist records without being an AI feature — keep it deterministic, focused, and independently useful to the agent. Don't put LLM calls or a second model runtime in ordinary actions (`completeText()` in `delegate-to-agent` is the one narrow exception).
|
|
24
24
|
|
|
25
|
-
|
|
26
|
-
records without being an AI feature. Keep those operations deterministic,
|
|
27
|
-
focused, and independently useful to the agent. Do not put LLM calls or a
|
|
28
|
-
second model runtime in ordinary actions. The only narrow exception is the
|
|
29
|
-
`completeText()` text-in/text-out escape hatch described in
|
|
30
|
-
`delegate-to-agent`; it must not own tools, chat history, run state, side
|
|
31
|
-
effects, or user steering.
|
|
32
|
-
|
|
33
|
-
When a workflow is framed as research, analysis, generation, recommendation,
|
|
34
|
-
or synthesis, or spans several provider calls and writes, route the user into
|
|
35
|
-
the AgentSidebar and let the agent orchestrate focused actions. Do not hide an
|
|
36
|
-
AI-shaped workflow behind one opaque `generate-*` or `create-*` action just
|
|
37
|
-
because its implementation is deterministic. A visible user-initiated run
|
|
38
|
-
should use `sendToAgentChat({ openSidebar: true })`, and its follow-ups should
|
|
39
|
-
continue in the same thread rather than a separate freeform input.
|
|
40
|
-
|
|
41
|
-
## Why
|
|
42
|
-
|
|
43
|
-
Actions give the agent callable tools with structured input/output, AND they give the frontend a typed client contract through hooks. One implementation serves both the agent and the UI. They keep the agent's chat context clean, they're reusable, and they can be tested independently.
|
|
44
|
-
|
|
45
|
-
## Keep the Action Surface Small and Orthogonal
|
|
46
|
-
|
|
47
|
-
Every agent-exposed action is a tool in the model's context window. There is a real cost to each one: more tools means more for the model to read, disambiguate, and choose between, which degrades tool-selection quality. Treat the action list like an API you have to maintain — add the fewest, most orthogonal actions that cover the capability, not one per UI affordance.
|
|
48
|
-
|
|
49
|
-
- **Prefer one CRUD-style `update` over N per-field actions.** A single `update-<thing>` that takes a patch of optional fields beats `update-<thing>-name`, `update-<thing>-order`, `update-<thing>-color`, … The agent (and the UI) pass only the fields that change. Same for `create`/`delete` — one orthogonal action per resource, not one per code path.
|
|
50
|
-
- **Reach for a generic query / escape hatch before minting a new read action.** If the agent needs more or different data, do not add `get-<thing>-by-x`, `list-<thing>-filtered-by-y`, etc. For provider data, expose the shared `provider-api-catalog` / `provider-api-docs` / `provider-api-request` trio (see `templates/dispatch/actions/`) so the agent can hit any endpoint or filter without a new action each time. For app data in dev, the `db-query` tool already answers arbitrary read questions.
|
|
51
|
-
- **Hide UI-only or purely programmatic actions from the model with `agentTool: false`.** An action that only the frontend or an HTTP/cron caller needs should not spend a slot in the model's tool list. `agentTool: false` keeps it callable from `useActionMutation` / `callAction` / `/_agent-native/actions/<name>` while removing it from every agent tool surface (in-app assistant, MCP, A2A).
|
|
52
|
-
- **`agentTool: false` is NOT `toolCallable: false`.** They are different switches:
|
|
53
|
-
- `agentTool: false` → hidden from the **model entirely** (it is no longer a tool the agent can see or call). Still frontend/HTTP-callable.
|
|
54
|
-
- `toolCallable: false` → only blocks the **sandboxed extension ("tools") iframe bridge** (`appAction(...)`). The action stays fully visible to the model, the UI, the CLI, MCP, and A2A. Use it for high-blast-radius operations (account/org/auth changes), not for trimming the tool list.
|
|
55
|
-
- **Remove or hide stale actions.** When the UI stops using an action, delete it or set `agentTool: false` — do not leave it exposed to the model as dead tool weight. The advisory audit below helps you spot these.
|
|
56
|
-
|
|
57
|
-
### Audit Script (Advisory)
|
|
58
|
-
|
|
59
|
-
`pnpm actions:audit [template ...]` (or `node scripts/audit-template-actions.mjs`) statically scans a template's `actions/` and prints two kinds of suggestions:
|
|
60
|
-
|
|
61
|
-
1. **Likely UI-dead** — HTTP-exposed mutating actions whose name is never referenced under `app/` (candidates to delete or mark `agentTool: false`).
|
|
62
|
-
2. **Likely redundant clusters** — groups like `update-foo-name` / `update-foo-order` that could collapse into one orthogonal `update-foo`.
|
|
63
|
-
|
|
64
|
-
It is **advisory only**: it always exits 0, never fails CI, and uses conservative heuristics, so expect some false positives (e.g. an action the agent calls but the UI doesn't). Use it as a prompt to review, not a gate.
|
|
25
|
+
When a workflow is research, analysis, generation, recommendation, or synthesis — or spans several provider calls and writes — route it to the AgentSidebar via `sendToAgentChat({ openSidebar: true })` and let the agent orchestrate focused actions instead of hiding an AI-shaped workflow behind one opaque `generate-*`/`create-*` action just because its implementation happens to be deterministic.
|
|
65
26
|
|
|
66
27
|
## How to Create an Action
|
|
67
28
|
|
|
68
|
-
Use `defineAction` with a Zod schema (required for new actions):
|
|
69
|
-
|
|
70
29
|
```ts
|
|
71
30
|
// actions/list-meals.ts
|
|
72
31
|
import { z } from "zod";
|
|
@@ -89,339 +48,60 @@ export default defineAction({
|
|
|
89
48
|
});
|
|
90
49
|
```
|
|
91
50
|
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
When an action reads or writes app data, use Drizzle's query builder and portable operators from `drizzle-orm`. Do not use raw SQL, `getDbExec()`, or dialect-specific schema imports in normal actions unless there is a documented reason Drizzle cannot express the query.
|
|
95
|
-
|
|
96
|
-
When an action calls an external service, never hardcode API keys, bearer
|
|
97
|
-
tokens, webhook URLs, signing secrets, OAuth refresh tokens, private
|
|
98
|
-
Builder/internal data, or customer data. Read user/org/workspace credentials
|
|
99
|
-
from `readAppSecret`, `resolveCredential`, OAuth token helpers, or the provider
|
|
100
|
-
API credential adapter. Use `process.env` only for explicitly deploy-level
|
|
101
|
-
configuration, and keep examples to obvious placeholders.
|
|
102
|
-
|
|
103
|
-
Tips:
|
|
104
|
-
- Use `.describe()` for parameter descriptions
|
|
105
|
-
- Use `.optional()` for optional params
|
|
106
|
-
- Use `z.coerce.number()` for numeric params that arrive as strings from HTTP.
|
|
107
|
-
For booleans, use an explicit string parser/helper instead of
|
|
108
|
-
`z.coerce.boolean()` because JavaScript treats any non-empty string,
|
|
109
|
-
including `"false"`, as truthy.
|
|
110
|
-
- Use `z.enum(["draft", "published"])` for constrained values
|
|
111
|
-
|
|
112
|
-
The legacy `parameters` field (plain JSON Schema object) still works as a fallback but does not provide runtime validation or type inference.
|
|
113
|
-
|
|
114
|
-
## Decision Order
|
|
115
|
-
|
|
116
|
-
When you need app data or a mutation:
|
|
117
|
-
|
|
118
|
-
1. **Use an existing action** if one already performs the operation.
|
|
119
|
-
2. **Create or extend a `defineAction`** when the agent and UI both need a new operation.
|
|
120
|
-
3. **Create a custom route only for route-only concerns** such as uploads, streaming, webhooks, OAuth callbacks, or a non-JSON protocol.
|
|
121
|
-
|
|
122
|
-
Do not build an umbrella REST API to make actions "easier" to call. Actions are already callable by agents, CLIs, React hooks, HTTP, MCP/A2A exposure, and external hosts through the framework.
|
|
123
|
-
|
|
124
|
-
## Flexible Provider APIs
|
|
125
|
-
|
|
126
|
-
For provider integrations used in ad hoc analysis, querying, reporting, or
|
|
127
|
-
cross-source research, do not hardcode every provider endpoint as a separate
|
|
128
|
-
rigid action and do not encode one lookback window, filter shape, or pagination
|
|
129
|
-
strategy as the only path the agent can take. Expose the shared provider API
|
|
130
|
-
action trio instead:
|
|
131
|
-
|
|
132
|
-
- `provider-api-catalog`: lists provider base URLs, auth style, credential keys,
|
|
133
|
-
docs/spec URLs, placeholders, and examples without exposing secrets.
|
|
134
|
-
- `provider-api-docs`: fetches public provider docs/spec/changelog URLs when
|
|
135
|
-
the exact endpoint, filter operator, payload shape, or pagination contract is
|
|
136
|
-
uncertain. Registered docs URLs are curated starting points. Use
|
|
137
|
-
`responseMode: "markdown"` for clean readable docs, or
|
|
138
|
-
`responseMode: "matches"` with `search: { query | terms | regex }` for
|
|
139
|
-
compact snippets instead of flooding context with raw HTML.
|
|
140
|
-
- `provider-api-request`: makes a constrained authenticated HTTP request to the
|
|
141
|
-
provider host, injects configured credentials, blocks private/internal URLs,
|
|
142
|
-
and redacts secrets.
|
|
143
|
-
|
|
144
|
-
Use `@agent-native/core/provider-api` as the shared substrate, and build these
|
|
145
|
-
actions as thin factory imports rather than copying `defineAction` schemas and
|
|
146
|
-
handlers into each template:
|
|
147
|
-
|
|
148
|
-
```ts
|
|
149
|
-
import {
|
|
150
|
-
createProviderApiCatalogAction,
|
|
151
|
-
createProviderApiDocsAction,
|
|
152
|
-
createProviderApiRequestAction,
|
|
153
|
-
} from "@agent-native/core/provider-api/actions/provider-api";
|
|
154
|
-
import {
|
|
155
|
-
createDeleteStagedDatasetAction,
|
|
156
|
-
createListStagedDatasetsAction,
|
|
157
|
-
createQueryStagedDatasetAction,
|
|
158
|
-
} from "@agent-native/core/provider-api/actions/staged-datasets";
|
|
159
|
-
```
|
|
160
|
-
|
|
161
|
-
Pass the app's existing provider runtime to the provider factories, and pass
|
|
162
|
-
its app id to the staged-dataset factories. Keep app-specific descriptions,
|
|
163
|
-
provider allow-lists, HTTP/tool-callability settings, and credential adapters
|
|
164
|
-
as factory options. Only add a thin credential adapter when the app has
|
|
165
|
-
app-specific credential lookup rules. If the app stores a built-in provider's
|
|
166
|
-
OAuth grant under a narrower local provider id, use the runtime's
|
|
167
|
-
`oauthProviderOverrides` instead of duplicating provider config. If credentials
|
|
168
|
-
are stored on shareable/resource rows rather than in the shared credential or
|
|
169
|
-
OAuth-token stores, build a resolver that enforces those access checks before
|
|
170
|
-
exposing raw provider requests. Keep `provider-api-request` `http: false`
|
|
171
|
-
unless a separate UI permission model authorizes arbitrary provider writes.
|
|
172
|
-
Specific actions such as `search-records`, `search-emails`, or `sync-source`
|
|
173
|
-
are convenience shortcuts, not capability limits; agents should fall back to
|
|
174
|
-
the provider API trio when a question requires an endpoint or filter that the
|
|
175
|
-
shortcut does not model.
|
|
176
|
-
|
|
177
|
-
This is a framework tenet. The safety boundary should be provider host
|
|
178
|
-
allow-listing, credential scoping, auth injection, private-network blocking,
|
|
179
|
-
secret redaction, and user/org access checks, not an artificially small set of
|
|
180
|
-
hand-authored read actions. If the upstream provider API supports a capability,
|
|
181
|
-
the agent should normally be able to reach it through `provider-api-request`
|
|
182
|
-
with the user's configured credentials. For large responses, expose staging
|
|
183
|
-
(`stageAs`, `itemsPath`, pagination, and `query-staged-dataset`) or sandboxed
|
|
184
|
-
code execution so the agent can reduce data without flooding context.
|
|
185
|
-
|
|
186
|
-
For broad provider questions, cross-source joins, corpus-wide mention/search
|
|
187
|
-
work, classification, or any answer where absence matters, design the action
|
|
188
|
-
surface for full coverage instead of convenience-only samples. The agent should
|
|
189
|
-
be able to fetch every relevant page or an explicitly bounded cohort, stage or
|
|
190
|
-
save the raw provider response outside chat, and then use
|
|
191
|
-
`query-staged-dataset`, `run-code`, or provider-side search to count, join,
|
|
192
|
-
grep, classify, and aggregate. Tool descriptions and AGENTS.md guidance should
|
|
193
|
-
teach agents to report source, filters, time window, row/record counts,
|
|
194
|
-
pagination status, truncation, failed pages, and uncovered gaps. They must not
|
|
195
|
-
turn default limits, sampled rows, truncated excerpts, or aborted calls into a
|
|
196
|
-
confident "none found", "all records", or exhaustive conclusion.
|
|
197
|
-
|
|
198
|
-
For public web pages and docs, prefer the token-efficient path: `web-search`
|
|
199
|
-
to find likely URLs, `web-request` or `provider-api-docs` with clean
|
|
200
|
-
`responseMode` output to read a page, and `run-code` with `webRead()` /
|
|
201
|
-
`webFetch()` when you need to grep, aggregate, or compare many pages before
|
|
202
|
-
returning a small result.
|
|
203
|
-
|
|
204
|
-
For LONG compute, `run-code` supports durable background executions: pass
|
|
205
|
-
`background: true` and the code is enqueued to a `sandbox_executions` row and
|
|
206
|
-
executed out-of-band with a generous budget (default 10 min), surviving the
|
|
207
|
-
hosted agent run's ~40s soft timeout. The call returns
|
|
208
|
-
`{ executionId, status: "queued" }` immediately with polling guidance; check
|
|
209
|
-
progress with `run-code` `{ executionId }` (or the `get-code-execution` tool
|
|
210
|
-
where registered) — results persist after completion. Use background for big
|
|
211
|
-
cross-source joins, multi-page provider sweeps, and heavy analysis scripts;
|
|
212
|
-
keep quick scripts in the default foreground mode. Agents should continue
|
|
213
|
-
other work between polls, and on `failed`/`timed_out` split the computation or
|
|
214
|
-
persist intermediate progress with `workspaceWrite` and re-run.
|
|
215
|
-
|
|
216
|
-
### The `http` Option
|
|
217
|
-
|
|
218
|
-
Controls how the action is exposed as an HTTP endpoint:
|
|
219
|
-
|
|
220
|
-
| Value | Behavior | Use for |
|
|
221
|
-
| ------------------------- | ----------------------------------------------------------- | -------------------------------- |
|
|
222
|
-
| _(omitted)_ | Auto-exposed as `POST /_agent-native/actions/:name` | Write operations (default) |
|
|
223
|
-
| `{ method: "GET" }` | Auto-exposed as `GET /_agent-native/actions/:name` | Read-only queries |
|
|
224
|
-
| `{ method: "PUT" }` | Auto-exposed as `PUT /_agent-native/actions/:name` | Update operations |
|
|
225
|
-
| `{ method: "DELETE" }` | Auto-exposed as `DELETE /_agent-native/actions/:name` | Delete operations |
|
|
226
|
-
| `{ method: "GET", path: "custom" }` | Auto-exposed as `GET /_agent-native/actions/custom` | Custom route path |
|
|
227
|
-
| `false` | Agent-only, never exposed as HTTP | `navigate`, `view-screen`, internal actions |
|
|
228
|
-
|
|
229
|
-
### Screen Refresh (automatic)
|
|
230
|
-
|
|
231
|
-
The framework auto-refreshes the UI after any successful mutating action. On completion of a non-`GET` action, the framework emits a change event with `source: "action"` that the client's `useDbSync` picks up and uses to invalidate `["action"]` React Query keys — so `list-*` / `get-*` hooks refetch without a full page reload. In-process calls emit directly; dev-mode `pnpm action ...` calls also write a durable marker so the web server sees child-process action changes.
|
|
232
|
-
|
|
233
|
-
Rules:
|
|
234
|
-
|
|
235
|
-
- `http: { method: "GET" }` → read-only, does NOT trigger a refresh (inferred automatically).
|
|
236
|
-
- Any other action (default `POST`, `PUT`, `DELETE`, or `http: false`) → treated as mutating, triggers a refresh on success.
|
|
237
|
-
- To override the inference on an unusual action (e.g. a `POST` that only reads), pass `readOnly: true` on the action definition.
|
|
238
|
-
- To let a mutating action run concurrently with other same-turn tool calls, pass `parallelSafe: true`. Only do this when the action is internally concurrency-safe and order-independent (for example, it uses an app-level lock or idempotent upsert semantics). Mutating actions remain serialized by default.
|
|
239
|
-
|
|
240
|
-
Agents do NOT need to call `refresh-screen` after a normal action — it's already handled. `refresh-screen` is only needed when the agent mutates data via a path the framework can't see (e.g. writing to an external system the app mirrors) or when the agent wants to pass a `scope` hint for narrower invalidation.
|
|
241
|
-
|
|
242
|
-
### Return Values
|
|
243
|
-
|
|
244
|
-
Actions should return **structured data** (objects, arrays) — not `JSON.stringify()`. The framework serializes the response automatically. If you return a string, the framework tries to parse it as JSON for a clean response.
|
|
51
|
+
`schema` (Zod or Standard Schema-compatible) gives runtime validation, TS inference for `run()` args, and an auto-generated JSON Schema for the tool. `.describe()` each param, `.optional()` for optional ones, `z.enum([...])` for constrained values, `z.coerce.number()` for numeric HTTP params — but write an explicit boolean parser instead of `z.coerce.boolean()`, which treats `"false"` as truthy.
|
|
245
52
|
|
|
246
|
-
|
|
247
|
-
// Good — return structured data
|
|
248
|
-
run: async (args) => {
|
|
249
|
-
const events = await fetchEvents(args.from, args.to);
|
|
250
|
-
return events;
|
|
251
|
-
}
|
|
252
|
-
|
|
253
|
-
// Bad — don't stringify
|
|
254
|
-
run: async (args) => {
|
|
255
|
-
const events = await fetchEvents(args.from, args.to);
|
|
256
|
-
return JSON.stringify(events, null, 2);
|
|
257
|
-
}
|
|
258
|
-
```
|
|
53
|
+
Use Drizzle's query builder, not raw SQL/`getDbExec()`/dialect-specific imports, unless Drizzle can't express the query. Never hardcode API keys/tokens/secrets — read via `readAppSecret` / `resolveCredential` / OAuth helpers; `process.env` is deploy-level config only.
|
|
259
54
|
|
|
260
|
-
|
|
55
|
+
**Decision order:** existing action → extend/create a `defineAction` → custom route as last resort (*Custom `/api/` Routes* below). Actions are already callable by agents, CLIs, hooks, HTTP, and MCP/A2A — don't wrap them in an umbrella REST API.
|
|
261
56
|
|
|
262
|
-
|
|
263
|
-
`_agentImages` to attach vision images (screenshots, chart previews, rendered
|
|
264
|
-
designs) to the tool result. The agent literally sees them — enabling visual
|
|
265
|
-
self-review loops — while the field itself is stripped from the JSON text the
|
|
266
|
-
model reads.
|
|
267
|
-
|
|
268
|
-
```ts
|
|
269
|
-
run: async ({ dashboardId }) => {
|
|
270
|
-
const shot = await renderDashboardPng(dashboardId); // Buffer
|
|
271
|
-
return {
|
|
272
|
-
dashboardId,
|
|
273
|
-
panelCount: 6,
|
|
274
|
-
_agentImages: [
|
|
275
|
-
// Either a public https URL (preferred — the provider fetches it)…
|
|
276
|
-
{ url: "https://cdn.example.com/previews/dash-1.png", label: "overview" },
|
|
277
|
-
// …or base64 without a data: prefix (mediaType required; a full
|
|
278
|
-
// data:image/png;base64,… URL in `data` is also accepted and parsed).
|
|
279
|
-
{ data: shot.toString("base64"), mediaType: "image/png" },
|
|
280
|
-
],
|
|
281
|
-
};
|
|
282
|
-
},
|
|
283
|
-
```
|
|
284
|
-
|
|
285
|
-
Rules and limits:
|
|
57
|
+
## Keep the Action Surface Small and Orthogonal
|
|
286
58
|
|
|
287
|
-
-
|
|
288
|
-
Each entry needs `url` (https only) **or** `data`. Supported media types:
|
|
289
|
-
`image/jpeg`, `image/png`, `image/gif`, `image/webp`.
|
|
290
|
-
- Caps: max **4 images** per result; max **~2MB of base64** per image.
|
|
291
|
-
Over-cap or invalid entries never fail the call — they become text notes in
|
|
292
|
-
the result telling the model what was dropped and why.
|
|
293
|
-
- Persistence: the run ledger stores only the string result plus compact
|
|
294
|
-
`[image: …]` notes (URLs verbatim; base64 as a byte-count placeholder) —
|
|
295
|
-
never the payload. Images are re-attached only for the live turn; replayed
|
|
296
|
-
history is text-only, so prefer stable `url` images the model can re-request.
|
|
297
|
-
- Engine support: native Anthropic and vision-capable AI-SDK providers
|
|
298
|
-
(anthropic, openai, google, openrouter) receive real image blocks; other
|
|
299
|
-
paths (Builder gateway, non-vision providers) degrade to the text notes.
|
|
300
|
-
- External MCP tools need no changes — standard MCP `image` content parts are
|
|
301
|
-
converted automatically under the same caps.
|
|
59
|
+
Every agent-exposed action is a tool in the model's context window; more tools degrades tool-selection quality. Add the fewest, most orthogonal actions that cover the capability.
|
|
302
60
|
|
|
303
|
-
|
|
61
|
+
- **One orthogonal `update` per resource**, not one per field — `update-<thing>` taking an optional-fields patch, not `update-<thing>-name` + `update-<thing>-order` + …
|
|
62
|
+
- **Reach for a generic escape hatch before minting a new read action** — the `provider-api-catalog`/`docs`/`request` trio for provider data (`references/provider-apis.md`), `db-query` for ad hoc app-data reads in dev.
|
|
63
|
+
- **`agentTool: false`** hides a UI-only/programmatic action from the model while keeping it frontend/HTTP-callable — not `toolCallable: false`, which only blocks the sandboxed extension bridge and leaves the action visible everywhere else; reserve that one for high-blast-radius operations.
|
|
64
|
+
- **Delete or hide stale actions** once the UI stops using them; `pnpm actions:audit` advisory-flags likely-dead/redundant ones (`references/examples.md`).
|
|
304
65
|
|
|
305
|
-
|
|
66
|
+
## The `http` Option
|
|
306
67
|
|
|
307
|
-
|
|
308
|
-
export default defineAction({
|
|
309
|
-
description: "Summarize a thread.",
|
|
310
|
-
schema: z.object({ threadId: z.string() }),
|
|
311
|
-
outputSchema: z.object({ summary: z.string(), messageCount: z.number() }),
|
|
312
|
-
outputErrorStrategy: "warn", // default; "strict" | "fallback"
|
|
313
|
-
// outputFallback: { summary: "", messageCount: 0 }, // used only by "fallback"
|
|
314
|
-
run: async ({ threadId }) => {
|
|
315
|
-
/* ... */
|
|
316
|
-
},
|
|
317
|
-
});
|
|
318
|
-
```
|
|
68
|
+
Controls HTTP exposure:
|
|
319
69
|
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
70
|
+
| Value | Behavior | Use for |
|
|
71
|
+
| --- | --- | --- |
|
|
72
|
+
| _(omitted)_ | `POST /_agent-native/actions/:name` | Write operations (default) |
|
|
73
|
+
| `{ method: "GET" }` | `GET /_agent-native/actions/:name` | Read-only queries |
|
|
74
|
+
| `{ method: "PUT"/"DELETE" }` | matching verb | Update / delete |
|
|
75
|
+
| `{ method: "GET", path: "x" }` | custom route path | Non-default path |
|
|
76
|
+
| `false` | never exposed as HTTP | `navigate`, `view-screen`, internal |
|
|
323
77
|
|
|
324
|
-
|
|
78
|
+
Mutating actions (anything but `GET`) auto-refresh the UI on success — don't call `refresh-screen` after a normal action. Overrides (`readOnly`, `parallelSafe`) and exact trigger rules: `references/action-fields.md`.
|
|
325
79
|
|
|
326
|
-
|
|
80
|
+
## Return Values
|
|
327
81
|
|
|
328
|
-
`
|
|
329
|
-
`run`, so it holds at **all six dispatch sites** — agent tool, HTTP, frontend
|
|
330
|
-
hook, MCP, A2A, CLI — unlike `needsApproval`, which is honoured only in the
|
|
331
|
-
agent loop. Use `authorize` for "not everyone may do this"; use `needsApproval`
|
|
332
|
-
to ask a human to bless one call a permitted caller is already allowed to make.
|
|
82
|
+
Return **structured data** (objects, arrays), never `JSON.stringify()` — the framework serializes the response and only tries to parse a returned string as JSON, which isn't the same contract.
|
|
333
83
|
|
|
334
84
|
```ts
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
export default defineAction({
|
|
338
|
-
description: "Archive a client roster.",
|
|
339
|
-
schema: z.object({ id: z.string() }),
|
|
340
|
-
authorize: coachAccess.requireAny("coach-admin"),
|
|
341
|
-
run: async (args) => {
|
|
342
|
-
/* ... */
|
|
343
|
-
},
|
|
344
|
-
});
|
|
85
|
+
run: async (args) => await fetchEvents(args.from, args.to); // good
|
|
86
|
+
run: async (args) => JSON.stringify(await fetchEvents(...)); // bad
|
|
345
87
|
```
|
|
346
88
|
|
|
347
|
-
|
|
348
|
-
-> audit`: the gate sits inside input validation, so a guard reading `args` gets
|
|
349
|
-
the parsed, coerced value, and auditing is outermost, so denials are recorded.
|
|
350
|
-
|
|
351
|
-
A guard that throws denies with its own message; returning `false` denies
|
|
352
|
-
generically; anything else (including `undefined`) allows. A guarded action
|
|
353
|
-
needs a user identity, so an unattended CLI/cron caller with no user email is
|
|
354
|
-
denied. `authorize` gates the operation; `accessFilter` / `assertAccess` still
|
|
355
|
-
scope which rows a permitted caller may touch. See the `authentication` skill
|
|
356
|
-
for `defineAppRoles` and the `sharing` skill for row scoping.
|
|
357
|
-
|
|
358
|
-
### Human-in-the-Loop Approval (`needsApproval`)
|
|
359
|
-
|
|
360
|
-
For high-consequence, outward-facing, hard-to-undo actions (sending an email, charging a card, deleting an account), set `needsApproval` so the agent **cannot** run the action without a human approving the specific call:
|
|
361
|
-
|
|
362
|
-
```ts
|
|
363
|
-
export default defineAction({
|
|
364
|
-
description: "Send an email via Gmail.",
|
|
365
|
-
schema: z.object({ to: z.string(), subject: z.string(), body: z.string() }),
|
|
366
|
-
needsApproval: true, // boolean, or (args, ctx) => boolean | Promise<boolean>
|
|
367
|
-
run: async (args) => {
|
|
368
|
-
/* ...actually send... */
|
|
369
|
-
},
|
|
370
|
-
});
|
|
371
|
-
```
|
|
372
|
-
|
|
373
|
-
When the gate is truthy and the call isn't yet approved, the loop emits an `approval_required` event and **stops the turn — `run()` never executes**. A predicate gates conditionally (e.g. only external recipients) and **fails closed**: a throw is treated as "approval required". The human approves via the chat UI's Approve affordance, which re-issues the turn with the call's `approvalKey`, and only then does the action run.
|
|
374
|
-
|
|
375
|
-
**Keep approvals rare** — the default is off and almost every action should leave it off. The canonical example is Mail's `send-email` (`needsApproval: true`). See the `security` skill and the Human Approval doc.
|
|
89
|
+
Reach for `outputSchema` (validate the return), `_agentImages` (attach images the agent can see), `authorize` (gate who may call it), or `needsApproval` (require human sign-off per call) only when the action needs that guarantee — examples in `references/action-fields.md`.
|
|
376
90
|
|
|
377
91
|
## Frontend Hooks
|
|
378
92
|
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
### `useActionQuery` — for GET actions
|
|
93
|
+
Use hooks from `@agent-native/core/client`, not hand-written `fetch("/_agent-native/actions/...")`.
|
|
382
94
|
|
|
383
95
|
```ts
|
|
384
|
-
import { useActionQuery } from "@agent-native/core/client/hooks";
|
|
385
|
-
|
|
386
|
-
function MealList() {
|
|
387
|
-
// Types are auto-inferred from the action's schema + return type — no manual generic needed
|
|
388
|
-
const { data: meals } = useActionQuery("list-meals", {
|
|
389
|
-
date: "2025-01-01",
|
|
390
|
-
});
|
|
391
|
-
return <ul>{meals?.map((m) => <li key={m.id}>{m.name}</li>)}</ul>;
|
|
392
|
-
}
|
|
393
|
-
```
|
|
394
|
-
|
|
395
|
-
### `useActionMutation` — for POST/PUT/DELETE actions
|
|
96
|
+
import { useActionQuery, useActionMutation, callAction } from "@agent-native/core/client/hooks";
|
|
396
97
|
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
// Types are auto-inferred — no manual generic needed
|
|
402
|
-
const { mutate } = useActionMutation("log-meal");
|
|
403
|
-
return (
|
|
404
|
-
<button onClick={() => mutate({ name: "Salad", calories: 350 })}>
|
|
405
|
-
Log Meal
|
|
406
|
-
</button>
|
|
407
|
-
);
|
|
408
|
-
}
|
|
98
|
+
const { data: meals } = useActionQuery("list-meals", { date: "2025-01-01" }); // GET, types auto-inferred
|
|
99
|
+
const { mutate } = useActionMutation("log-meal"); // POST/PUT/DELETE
|
|
100
|
+
mutate({ name: "Salad", calories: 350 });
|
|
101
|
+
const people = await callAction("search-people", { query }, { method: "GET" }); // imperative (debounce, prefetch)
|
|
409
102
|
```
|
|
410
103
|
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
Mutations automatically invalidate all `["action"]` query keys on success, so GET queries refetch.
|
|
414
|
-
|
|
415
|
-
### `callAction` — for imperative client code
|
|
416
|
-
|
|
417
|
-
```ts
|
|
418
|
-
import { callAction } from "@agent-native/core/client/hooks";
|
|
419
|
-
|
|
420
|
-
const people = await callAction("search-people", { query }, { method: "GET" });
|
|
421
|
-
```
|
|
422
|
-
|
|
423
|
-
Prefer hooks in React data flows. Use `callAction` when a hook would be awkward;
|
|
424
|
-
do not hand-write action route fetches in components.
|
|
104
|
+
Don't add manual generics like `useActionQuery<Meal[]>(...)` — types come from `.generated/action-types.d.ts`. Mutations auto-invalidate all `["action"]` query keys, so GET queries refetch.
|
|
425
105
|
|
|
426
106
|
## How to Run (Agent)
|
|
427
107
|
|
|
@@ -429,147 +109,33 @@ do not hand-write action route fetches in components.
|
|
|
429
109
|
pnpm action my-action --input data/source.json --output data/result.json
|
|
430
110
|
```
|
|
431
111
|
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
The default template uses core's `runScript()` in `actions/run.ts`:
|
|
435
|
-
|
|
436
|
-
```ts
|
|
437
|
-
import { runScript } from "@agent-native/core";
|
|
438
|
-
runScript();
|
|
439
|
-
```
|
|
440
|
-
|
|
441
|
-
This is the canonical approach for new apps. Action names must be lowercase with hyphens only (e.g., `my-action`).
|
|
442
|
-
|
|
443
|
-
## When You Still Need Custom `/api/` Routes
|
|
444
|
-
|
|
445
|
-
This is the complete exception list. A route in `server/routes/api/` is only
|
|
446
|
-
justified when the caller is not your own UI or agent, or when the payload is
|
|
447
|
-
not JSON:
|
|
448
|
-
|
|
449
|
-
- **File uploads** — actions receive JSON params, not multipart form data
|
|
450
|
-
- **Streaming responses** — SSE or chunked responses that need direct H3 control
|
|
451
|
-
- **Webhooks** — external services POST to a specific URL
|
|
452
|
-
- **OAuth callbacks** — redirect-based flows that need specific URL patterns
|
|
453
|
-
- **Public unauthenticated endpoints** — SEO/OG images, share links, and other
|
|
454
|
-
URLs opened directly by a browser or crawler
|
|
455
|
-
- **Binary or non-JSON responses** — media, exports, generated assets
|
|
456
|
-
|
|
457
|
-
Everything else is an action: CRUD, settings, search, list/detail reads, auth
|
|
458
|
-
state, and anything the UI fetches as JSON. If a route needs new middleware to
|
|
459
|
-
scope it to the current user, that is a signal it should be an action — actions
|
|
460
|
-
already run inside request context with access checks.
|
|
461
|
-
|
|
462
|
-
Existing first-party templates still contain a shrinking, explicitly
|
|
463
|
-
grandfathered set of older `/api/*` CRUD routes for app data. The repository's
|
|
464
|
-
`guard:no-action-twin-routes` CI check ratchets that baseline down across the
|
|
465
|
-
first-party template route trees (with the separately owned Plan template
|
|
466
|
-
fenced out); it is not a substitute for keeping generated apps action-first.
|
|
467
|
-
|
|
468
|
-
When the agent needs a durable image or file URL, call the core `upload-image`
|
|
469
|
-
action or use `uploadFile()` in server code. Do not write base64 into SQL,
|
|
470
|
-
markdown, deck/design JSON, or action results. `_agentImages` on action results
|
|
471
|
-
is for ephemeral vision previews only, not persistence.
|
|
472
|
-
|
|
473
|
-
If it's a standard CRUD operation, data query, or a wrapper around an action, use the action instead.
|
|
474
|
-
|
|
475
|
-
## Legacy Pattern (bare export)
|
|
476
|
-
|
|
477
|
-
Older actions use a bare async function export with `parseArgs`:
|
|
478
|
-
|
|
479
|
-
```ts
|
|
480
|
-
import { parseArgs, loadEnv, fail } from "@agent-native/core";
|
|
481
|
-
|
|
482
|
-
export default async function myAction(args: string[]) {
|
|
483
|
-
loadEnv();
|
|
484
|
-
const parsed = parseArgs(args);
|
|
485
|
-
// ...
|
|
486
|
-
}
|
|
487
|
-
```
|
|
488
|
-
|
|
489
|
-
This still works but is not auto-exposed as HTTP. Prefer `defineAction` for all new actions.
|
|
490
|
-
|
|
491
|
-
## Guidelines
|
|
492
|
-
|
|
493
|
-
- **One action, one job.** Keep actions focused on a single operation. The agent composes multiple action calls for complex operations.
|
|
494
|
-
- **Return structured data.** Return objects/arrays, not `JSON.stringify()`.
|
|
495
|
-
- **Use `http: { method: "GET" }`** for read-only actions. Default is POST.
|
|
496
|
-
- **Use `http: false`** for agent-only actions (`navigate`, `view-screen`).
|
|
497
|
-
- **Use `agentTool: false`** for UI-only / programmatic actions that should NOT be a tool in the model's context window. It stays frontend/HTTP-callable but is hidden from the agent. Distinct from `toolCallable: false`, which only blocks the sandboxed extension iframe bridge.
|
|
498
|
-
- **Document reusable actions.** If a new action should be called by agents outside one narrow screen, update `AGENTS.md` with when to use it, important args, and which return fields to preserve.
|
|
499
|
-
- **Promote workflow-heavy actions to skills.** If the action is part of a provider-backed, cross-app, MCP/A2A, or multi-step workflow, create or update a skill in `.agents/skills/` and add app-skill visibility (`internal`, `exported`, or `both`) when it should ship through a marketplace.
|
|
500
|
-
- **Use `loadEnv()`** only for deploy-level configuration. User/org/workspace
|
|
501
|
-
credentials belong in the encrypted secrets/credential/OAuth stores, never as
|
|
502
|
-
hardcoded literals or shared env fallbacks.
|
|
503
|
-
- **Use `fail()`** for user-friendly error messages (exits with message, no stack trace).
|
|
504
|
-
- **Import action primitives from `@agent-native/core/action`** and CLI helpers such as `parseArgs()` from `@agent-native/core` — do not redefine framework utilities locally.
|
|
505
|
-
- **Do not re-export actions as REST.** The mounted `/_agent-native/actions/:name` endpoint is the REST surface; duplicating it under `/api/*` creates drift and hides the operation from agents.
|
|
506
|
-
|
|
507
|
-
## Common Patterns
|
|
508
|
-
|
|
509
|
-
**Read action (GET):**
|
|
510
|
-
|
|
511
|
-
```ts
|
|
512
|
-
import { z } from "zod";
|
|
513
|
-
import { defineAction } from "@agent-native/core/action";
|
|
112
|
+
The default template dispatches through core's `runScript()` in `actions/run.ts`. Action names are lowercase-with-hyphens (`pnpm action my-action` → `actions/my-action.ts`).
|
|
514
113
|
|
|
515
|
-
|
|
516
|
-
description: "List calendar events",
|
|
517
|
-
schema: z.object({
|
|
518
|
-
from: z.string().describe("Start date"),
|
|
519
|
-
to: z.string().describe("End date"),
|
|
520
|
-
}),
|
|
521
|
-
http: { method: "GET" },
|
|
522
|
-
run: async (args) => {
|
|
523
|
-
return await fetchEvents(args.from, args.to);
|
|
524
|
-
},
|
|
525
|
-
});
|
|
526
|
-
```
|
|
114
|
+
## Custom `/api/` Routes
|
|
527
115
|
|
|
528
|
-
**
|
|
116
|
+
Complete exception list — justified only when the caller isn't your own UI/agent, or the payload isn't JSON: **file uploads** (actions take JSON, not multipart), **streaming** (SSE/chunked needing direct H3 control), **webhooks**, **OAuth callbacks** (fixed redirect URL patterns), **public unauthenticated endpoints** (SEO/OG images, share links), **binary/non-JSON responses**.
|
|
529
117
|
|
|
530
|
-
|
|
531
|
-
import { z } from "zod";
|
|
532
|
-
import { defineAction } from "@agent-native/core/action";
|
|
118
|
+
Everything else — CRUD, settings, search, list/detail reads, auth state, anything the UI fetches as JSON — is an action. Needing middleware to scope a route to the current user is itself a signal it should be an action. First-party templates still carry a shrinking, grandfathered set of older `/api/*` CRUD routes (`guard:no-action-twin-routes` ratchets it down) — not license to add new ones.
|
|
533
119
|
|
|
534
|
-
|
|
535
|
-
description: "Log a meal",
|
|
536
|
-
schema: z.object({
|
|
537
|
-
name: z.string().describe("Meal name"),
|
|
538
|
-
calories: z.coerce.number().describe("Calorie count"),
|
|
539
|
-
}),
|
|
540
|
-
run: async (args) => {
|
|
541
|
-
// args.calories is a number — z.coerce.number() handles string-to-number conversion from HTTP
|
|
542
|
-
const meal = await insertMeal(args);
|
|
543
|
-
return meal;
|
|
544
|
-
},
|
|
545
|
-
});
|
|
546
|
-
```
|
|
120
|
+
## Do / Don't
|
|
547
121
|
|
|
548
|
-
**
|
|
122
|
+
- **Do** keep one action, one job; document a reusable action (when to use it, key args, return fields to preserve) in `AGENTS.md` once it's called from outside one narrow screen; promote workflow-heavy actions (provider-backed, cross-app, MCP/A2A, multi-step) into a skill.
|
|
123
|
+
- **Do** use `fail()` for user-friendly errors and import primitives from `@agent-native/core`(`/action`) instead of redefining them; use the core `upload-image` action or `uploadFile()` for durable images/files — never base64 into SQL, markdown, or action results.
|
|
124
|
+
- **Don't** re-export actions as REST — `/_agent-native/actions/:name` is already the REST surface; duplicating it under `/api/*` hides the operation from agents.
|
|
125
|
+
- **Don't** reach for provider integrations, `outputSchema`, `authorize`, `needsApproval`, or `_agentImages` without checking `references/` first — each has sharp edges covered there, not here.
|
|
549
126
|
|
|
550
|
-
|
|
551
|
-
import { z } from "zod";
|
|
552
|
-
import { defineAction } from "@agent-native/core/action";
|
|
127
|
+
## Troubleshooting
|
|
553
128
|
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
}),
|
|
559
|
-
http: false,
|
|
560
|
-
run: async (args) => {
|
|
561
|
-
await writeAppState("navigate", { command: "go", view: args.view });
|
|
562
|
-
return "Navigated";
|
|
563
|
-
},
|
|
564
|
-
});
|
|
565
|
-
```
|
|
129
|
+
- **Action not found** — filename must match the command (`pnpm action foo-bar` → `actions/foo-bar.ts`).
|
|
130
|
+
- **Args not parsing** — use `--key value` / `--key=value`; boolean flags are `--flag` (sets `"true"`).
|
|
131
|
+
- **Frontend 405** — `http.method` doesn't match the hook (`useActionQuery` for GET, `useActionMutation` for POST/PUT/DELETE).
|
|
132
|
+
- **Frontend gets undefined** — action must return structured data, not `JSON.stringify()`.
|
|
566
133
|
|
|
567
|
-
##
|
|
134
|
+
## References
|
|
568
135
|
|
|
569
|
-
-
|
|
570
|
-
-
|
|
571
|
-
-
|
|
572
|
-
- **Frontend getting undefined** — Make sure the action returns structured data, not `JSON.stringify()`.
|
|
136
|
+
- `references/provider-apis.md` — wiring a credentialed provider (HubSpot, Gong, Slack, …) for querying, reporting, or cross-source research.
|
|
137
|
+
- `references/action-fields.md` — `outputSchema`, `authorize`, `needsApproval`, `_agentImages`, and exact auto-refresh rules.
|
|
138
|
+
- `references/examples.md` — a second worked example, the legacy `parameters`/bare-export patterns, and `pnpm actions:audit`.
|
|
573
139
|
|
|
574
140
|
## Related Skills
|
|
575
141
|
|