@agent-native/core 0.127.1 → 0.128.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/corpus/README.md +2 -2
- package/corpus/core/CHANGELOG.md +92 -0
- package/corpus/core/README.md +5 -26
- package/corpus/core/docs/content/actions.mdx +47 -4
- package/corpus/core/docs/content/native-chat-ui.mdx +7 -0
- package/corpus/core/docs/content/organizations-teams-permissions.mdx +109 -3
- package/corpus/core/docs/content/template-design-collaboration-and-full-apps.mdx +15 -0
- package/corpus/core/docs/content/toolkit-org-team.mdx +72 -12
- package/corpus/core/package.json +1 -1
- package/corpus/core/src/a2a/artifact-response.ts +36 -29
- package/corpus/core/src/action.ts +83 -2
- package/corpus/core/src/chat-threads/store.ts +48 -43
- package/corpus/core/src/cli/skills-content/design-visual-edit-skill.ts +46 -3
- package/corpus/core/src/cli/template-sync.ts +96 -0
- package/corpus/core/src/client/AgentPanel.tsx +26 -6
- package/corpus/core/src/client/AssistantChat.tsx +63 -7
- package/corpus/core/src/client/DefaultSpinner.tsx +29 -0
- package/corpus/core/src/client/org/TeamPage.tsx +161 -6
- package/corpus/core/src/client/org/hooks.ts +67 -0
- package/corpus/core/src/client/org/index.ts +9 -0
- package/corpus/core/src/client/transcription/use-live-transcription.ts +62 -10
- package/corpus/core/src/db/client.ts +42 -3
- package/corpus/core/src/db/ensure-additive-columns.ts +60 -33
- package/corpus/core/src/deploy/build.ts +31 -2
- package/corpus/core/src/mcp-client/routes.ts +10 -1
- package/corpus/core/src/org/app-roles-handlers.ts +152 -0
- package/corpus/core/src/org/app-roles.ts +355 -0
- package/corpus/core/src/org/index.ts +27 -1
- package/corpus/core/src/org/migrations.ts +22 -0
- package/corpus/core/src/org/plugin.ts +27 -0
- package/corpus/core/src/org/schema.ts +15 -0
- package/corpus/core/src/scripts/docs/search.ts +17 -0
- package/corpus/core/src/scripts/docs/source-search.ts +10 -0
- package/corpus/core/src/server/agent-chat/script-entries.ts +3 -0
- package/corpus/core/src/server/agent-chat-plugin.ts +53 -52
- package/corpus/core/src/server/builder-design-systems.ts +1 -1
- package/corpus/core/src/server/core-routes-plugin.ts +6 -1
- package/corpus/core/src/server/framework-request-handler.ts +44 -6
- package/corpus/core/src/templates/default/.agents/skills/actions/SKILL.md +32 -0
- package/corpus/core/src/templates/default/.agents/skills/adding-a-feature/SKILL.md +7 -0
- package/corpus/core/src/templates/default/.agents/skills/security/SKILL.md +31 -0
- package/corpus/core/src/templates/headless/.agents/skills/actions/SKILL.md +32 -0
- package/corpus/core/src/templates/workspace-core/.agents/skills/actions/SKILL.md +32 -0
- package/corpus/core/src/templates/workspace-core/.agents/skills/adding-a-feature/SKILL.md +7 -0
- package/corpus/core/src/templates/workspace-core/.agents/skills/authentication/SKILL.md +40 -0
- package/corpus/core/src/templates/workspace-core/.agents/skills/security/SKILL.md +31 -0
- package/corpus/core/src/templates/workspace-core/.agents/skills/sharing/SKILL.md +4 -0
- package/corpus/templates/analytics/.agents/skills/actions/SKILL.md +32 -0
- package/corpus/templates/analytics/.agents/skills/security/SKILL.md +31 -0
- package/corpus/templates/analytics/.agents/skills/sharing/SKILL.md +4 -0
- package/corpus/templates/analytics/actions/data-source-status.ts +21 -12
- package/corpus/templates/analytics/app/global.css +7 -7
- package/corpus/templates/analytics/app/i18n-data.ts +30 -0
- package/corpus/templates/analytics/app/lib/data-source-status.ts +2 -1
- package/corpus/templates/analytics/app/pages/DataSources.tsx +54 -10
- package/corpus/templates/analytics/changelog/2026-07-28-analytics-pages-load-reliably-with-large-dashboard-workspaces.md +6 -0
- package/corpus/templates/analytics/changelog/2026-07-28-dashboard-loading-shimmer-now-flows-smoothly-in-one-directi.md +6 -0
- package/corpus/templates/analytics/server/lib/first-party-dashboard-repair.ts +5 -4
- package/corpus/templates/analytics/server/plugins/agent-chat.ts +54 -42
- package/corpus/templates/analytics/server/plugins/db.ts +1 -18
- package/corpus/templates/assets/.agents/skills/actions/SKILL.md +32 -0
- package/corpus/templates/assets/.agents/skills/security/SKILL.md +31 -0
- package/corpus/templates/assets/.agents/skills/sharing/SKILL.md +4 -0
- package/corpus/templates/brain/.agents/skills/actions/SKILL.md +32 -0
- package/corpus/templates/brain/.agents/skills/adding-a-feature/SKILL.md +7 -0
- package/corpus/templates/brain/.agents/skills/security/SKILL.md +31 -0
- package/corpus/templates/brain/.agents/skills/sharing/SKILL.md +4 -0
- package/corpus/templates/calendar/.agents/skills/actions/SKILL.md +32 -0
- package/corpus/templates/calendar/.agents/skills/security/SKILL.md +31 -0
- package/corpus/templates/calendar/.agents/skills/sharing/SKILL.md +4 -0
- package/corpus/templates/chat/.agents/skills/actions/SKILL.md +32 -0
- package/corpus/templates/chat/.agents/skills/adding-a-feature/SKILL.md +7 -0
- package/corpus/templates/chat/.agents/skills/security/SKILL.md +31 -0
- package/corpus/templates/chat/.agents/skills/sharing/SKILL.md +4 -0
- package/corpus/templates/chat/_gitignore +2 -0
- package/corpus/templates/clips/.agents/skills/actions/SKILL.md +32 -0
- package/corpus/templates/clips/.agents/skills/security/SKILL.md +31 -0
- package/corpus/templates/clips/actions/request-transcript.ts +77 -11
- package/corpus/templates/clips/actions/save-browser-transcript.ts +28 -7
- package/corpus/templates/clips/app/routes/record.tsx +11 -3
- package/corpus/templates/clips/changelog/2026-07-28-browser-recordings-no-longer-save-a-truncated-transcript-as-.md +6 -0
- package/corpus/templates/clips/changelog/2026-07-28-browser-recordings-no-longer-stop-transcribing-partway-throu.md +6 -0
- package/corpus/templates/clips/changelog/2026-07-28-desktop-full-screen-clips-now-get-an-instant-local-transcrip.md +6 -0
- package/corpus/templates/clips/changelog/2026-07-28-long-transcriptions-no-longer-show-a-false-transcription-sto.md +6 -0
- package/corpus/templates/clips/changelog/2026-07-28-restarting-for-an-update-now-installs-the-newest-release-ins.md +6 -0
- package/corpus/templates/clips/changelog/2026-07-28-the-meeting-recording-pill-now-anchors-to-the-right-edge-of-.md +6 -0
- package/corpus/templates/clips/desktop/src/lib/audio-meter.ts +31 -2
- package/corpus/templates/clips/desktop/src/lib/recorder.ts +114 -13
- package/corpus/templates/clips/desktop/src/lib/updater.ts +12 -4
- package/corpus/templates/clips/desktop/src/overlays/live-audio-bars.tsx +40 -15
- package/corpus/templates/clips/desktop/src/styles.css +10 -7
- package/corpus/templates/clips/desktop/src-tauri/src/recording_indicator.rs +21 -14
- package/corpus/templates/clips/shared/transcript-status.ts +10 -0
- package/corpus/templates/content/.agents/skills/actions/SKILL.md +32 -0
- package/corpus/templates/content/.agents/skills/security/SKILL.md +31 -0
- package/corpus/templates/content/.agents/skills/sharing/SKILL.md +4 -0
- package/corpus/templates/crm/.agents/skills/sharing/SKILL.md +4 -0
- package/corpus/templates/design/.agents/skills/actions/SKILL.md +32 -0
- package/corpus/templates/design/.agents/skills/design-generation/SKILL.md +23 -0
- package/corpus/templates/design/.agents/skills/security/SKILL.md +31 -0
- package/corpus/templates/design/.agents/skills/sharing/SKILL.md +4 -0
- package/corpus/templates/design/.agents/skills/visual-edit/SKILL.md +46 -3
- package/corpus/templates/design/.generated/bridge/editor-chrome.generated.ts +7 -5
- package/corpus/templates/design/actions/create-file.ts +15 -0
- package/corpus/templates/design/actions/generate-design.ts +40 -0
- package/corpus/templates/design/actions/present-design-variants.ts +16 -0
- package/corpus/templates/design/app/components/design/CanvasContextMenu.tsx +2 -2
- package/corpus/templates/design/app/components/design/bridge/editor-chrome.bridge.ts +7 -4
- package/corpus/templates/design/app/components/design/keyboard-shortcuts.ts +1 -1
- package/corpus/templates/design/app/hooks/useDesignHotkeys.ts +10 -4
- package/corpus/templates/design/app/lib/design-ui-events.ts +5 -0
- package/corpus/templates/design/app/pages/design-editor/save-failure.ts +7 -1
- package/corpus/templates/design/app/root.tsx +18 -1
- package/corpus/templates/design/changelog/2026-07-28-generated-designs-with-malformed-html-are-now-rejected-at-sa.md +6 -0
- package/corpus/templates/design/changelog/2026-07-28-show-or-hide-design-editing-chrome-with-cmd-on-apple-devices.md +6 -0
- package/corpus/templates/design/server/source-workspace.ts +1 -0
- package/corpus/templates/design/shared/html-integrity.ts +608 -18
- package/corpus/templates/dispatch/.agents/skills/actions/SKILL.md +32 -0
- package/corpus/templates/dispatch/.agents/skills/security/SKILL.md +31 -0
- package/corpus/templates/dispatch/.agents/skills/sharing/SKILL.md +4 -0
- package/corpus/templates/forms/.agents/skills/actions/SKILL.md +32 -0
- package/corpus/templates/forms/.agents/skills/security/SKILL.md +31 -0
- package/corpus/templates/forms/.agents/skills/sharing/SKILL.md +4 -0
- package/corpus/templates/macros/.agents/skills/security/SKILL.md +31 -0
- package/corpus/templates/macros/.agents/skills/sharing/SKILL.md +4 -0
- package/corpus/templates/mail/.agents/skills/actions/SKILL.md +32 -0
- package/corpus/templates/mail/.agents/skills/security/SKILL.md +31 -0
- package/corpus/templates/mail/.agents/skills/sharing/SKILL.md +4 -0
- package/corpus/templates/plan/.agents/skills/actions/SKILL.md +32 -0
- package/corpus/templates/plan/.agents/skills/adding-a-feature/SKILL.md +7 -0
- package/corpus/templates/plan/.agents/skills/security/SKILL.md +31 -0
- package/corpus/templates/plan/.agents/skills/sharing/SKILL.md +4 -0
- package/corpus/templates/slides/.agents/skills/actions/SKILL.md +32 -0
- package/corpus/templates/slides/.agents/skills/security/SKILL.md +31 -0
- package/corpus/templates/slides/.agents/skills/sharing/SKILL.md +4 -0
- package/corpus/templates/slides/app/components/deck/DeckCard.tsx +2 -6
- package/corpus/templates/tasks/.agents/skills/actions/SKILL.md +32 -0
- package/corpus/templates/tasks/.agents/skills/adding-a-feature/SKILL.md +7 -0
- package/corpus/templates/tasks/.agents/skills/security/SKILL.md +31 -0
- package/corpus/templates/tasks/.agents/skills/sharing/SKILL.md +4 -0
- package/dist/a2a/artifact-response.d.ts.map +1 -1
- package/dist/a2a/artifact-response.js +30 -29
- package/dist/a2a/artifact-response.js.map +1 -1
- package/dist/action.d.ts +36 -0
- package/dist/action.d.ts.map +1 -1
- package/dist/action.js +37 -2
- package/dist/action.js.map +1 -1
- package/dist/chat-threads/store.d.ts +12 -0
- package/dist/chat-threads/store.d.ts.map +1 -1
- package/dist/chat-threads/store.js +48 -42
- package/dist/chat-threads/store.js.map +1 -1
- package/dist/cli/skills-content/design-visual-edit-skill.d.ts +1 -1
- package/dist/cli/skills-content/design-visual-edit-skill.d.ts.map +1 -1
- package/dist/cli/skills-content/design-visual-edit-skill.js +46 -3
- package/dist/cli/skills-content/design-visual-edit-skill.js.map +1 -1
- package/dist/cli/template-sync.d.ts.map +1 -1
- package/dist/cli/template-sync.js +88 -0
- package/dist/cli/template-sync.js.map +1 -1
- package/dist/client/AgentPanel.d.ts +3 -1
- package/dist/client/AgentPanel.d.ts.map +1 -1
- package/dist/client/AgentPanel.js +11 -9
- package/dist/client/AgentPanel.js.map +1 -1
- package/dist/client/AssistantChat.d.ts.map +1 -1
- package/dist/client/AssistantChat.js +57 -6
- package/dist/client/AssistantChat.js.map +1 -1
- package/dist/client/DefaultSpinner.d.ts +7 -0
- package/dist/client/DefaultSpinner.d.ts.map +1 -1
- package/dist/client/DefaultSpinner.js +25 -1
- package/dist/client/DefaultSpinner.js.map +1 -1
- package/dist/client/org/TeamPage.d.ts +13 -1
- package/dist/client/org/TeamPage.d.ts.map +1 -1
- package/dist/client/org/TeamPage.js +41 -11
- package/dist/client/org/TeamPage.js.map +1 -1
- package/dist/client/org/hooks.d.ts +37 -0
- package/dist/client/org/hooks.d.ts.map +1 -1
- package/dist/client/org/hooks.js +37 -0
- package/dist/client/org/hooks.js.map +1 -1
- package/dist/client/org/index.d.ts +3 -2
- package/dist/client/org/index.d.ts.map +1 -1
- package/dist/client/org/index.js +1 -1
- package/dist/client/org/index.js.map +1 -1
- package/dist/client/transcription/use-live-transcription.d.ts +8 -0
- package/dist/client/transcription/use-live-transcription.d.ts.map +1 -1
- package/dist/client/transcription/use-live-transcription.js +38 -11
- package/dist/client/transcription/use-live-transcription.js.map +1 -1
- package/dist/collab/routes.d.ts +1 -1
- package/dist/collab/struct-routes.d.ts +1 -1
- package/dist/db/client.d.ts +12 -0
- package/dist/db/client.d.ts.map +1 -1
- package/dist/db/client.js +40 -3
- package/dist/db/client.js.map +1 -1
- package/dist/db/ensure-additive-columns.d.ts.map +1 -1
- package/dist/db/ensure-additive-columns.js +54 -32
- package/dist/db/ensure-additive-columns.js.map +1 -1
- package/dist/deploy/build.d.ts +1 -0
- package/dist/deploy/build.d.ts.map +1 -1
- package/dist/deploy/build.js +23 -2
- package/dist/deploy/build.js.map +1 -1
- package/dist/mcp-client/routes.d.ts +3 -1
- package/dist/mcp-client/routes.d.ts.map +1 -1
- package/dist/mcp-client/routes.js +8 -2
- package/dist/mcp-client/routes.js.map +1 -1
- package/dist/notifications/routes.d.ts +1 -1
- package/dist/observability/routes.d.ts +3 -3
- package/dist/org/app-roles-handlers.d.ts +27 -0
- package/dist/org/app-roles-handlers.d.ts.map +1 -0
- package/dist/org/app-roles-handlers.js +125 -0
- package/dist/org/app-roles-handlers.js.map +1 -0
- package/dist/org/app-roles.d.ts +136 -0
- package/dist/org/app-roles.d.ts.map +1 -0
- package/dist/org/app-roles.js +216 -0
- package/dist/org/app-roles.js.map +1 -0
- package/dist/org/index.d.ts +4 -1
- package/dist/org/index.d.ts.map +1 -1
- package/dist/org/index.js +3 -1
- package/dist/org/index.js.map +1 -1
- package/dist/org/migrations.d.ts.map +1 -1
- package/dist/org/migrations.js +22 -0
- package/dist/org/migrations.js.map +1 -1
- package/dist/org/plugin.d.ts +2 -0
- package/dist/org/plugin.d.ts.map +1 -1
- package/dist/org/plugin.js +20 -0
- package/dist/org/plugin.js.map +1 -1
- package/dist/org/schema.d.ts +143 -0
- package/dist/org/schema.d.ts.map +1 -1
- package/dist/org/schema.js +14 -0
- package/dist/org/schema.js.map +1 -1
- package/dist/provider-api/actions/custom-provider-registration.d.ts +4 -4
- package/dist/provider-api/actions/provider-api.d.ts +12 -12
- package/dist/resources/handlers.d.ts +1 -1
- package/dist/scripts/docs/search.d.ts.map +1 -1
- package/dist/scripts/docs/search.js +15 -0
- package/dist/scripts/docs/search.js.map +1 -1
- package/dist/scripts/docs/source-search.d.ts +7 -0
- package/dist/scripts/docs/source-search.d.ts.map +1 -1
- package/dist/scripts/docs/source-search.js +9 -0
- package/dist/scripts/docs/source-search.js.map +1 -1
- package/dist/server/agent-chat/script-entries.d.ts.map +1 -1
- package/dist/server/agent-chat/script-entries.js +3 -0
- package/dist/server/agent-chat/script-entries.js.map +1 -1
- package/dist/server/agent-chat-plugin.d.ts.map +1 -1
- package/dist/server/agent-chat-plugin.js +46 -48
- package/dist/server/agent-chat-plugin.js.map +1 -1
- package/dist/server/agent-engine-api-key-route.d.ts +1 -1
- package/dist/server/builder-design-systems.js +1 -1
- package/dist/server/builder-design-systems.js.map +1 -1
- package/dist/server/core-routes-plugin.d.ts.map +1 -1
- package/dist/server/core-routes-plugin.js +6 -1
- package/dist/server/core-routes-plugin.js.map +1 -1
- package/dist/server/framework-request-handler.d.ts.map +1 -1
- package/dist/server/framework-request-handler.js +42 -6
- package/dist/server/framework-request-handler.js.map +1 -1
- package/dist/server/transcribe-voice.d.ts +1 -1
- package/dist/templates/chat/.agents/skills/actions/SKILL.md +32 -0
- package/dist/templates/chat/.agents/skills/adding-a-feature/SKILL.md +7 -0
- package/dist/templates/chat/.agents/skills/security/SKILL.md +31 -0
- package/dist/templates/chat/.agents/skills/sharing/SKILL.md +4 -0
- package/dist/templates/chat/_gitignore +2 -0
- package/dist/templates/default/.agents/skills/actions/SKILL.md +32 -0
- package/dist/templates/default/.agents/skills/adding-a-feature/SKILL.md +7 -0
- package/dist/templates/default/.agents/skills/security/SKILL.md +31 -0
- package/dist/templates/headless/.agents/skills/actions/SKILL.md +32 -0
- package/dist/templates/workspace-core/.agents/skills/actions/SKILL.md +32 -0
- package/dist/templates/workspace-core/.agents/skills/adding-a-feature/SKILL.md +7 -0
- package/dist/templates/workspace-core/.agents/skills/authentication/SKILL.md +40 -0
- package/dist/templates/workspace-core/.agents/skills/security/SKILL.md +31 -0
- package/dist/templates/workspace-core/.agents/skills/sharing/SKILL.md +4 -0
- package/docs/content/actions.mdx +47 -4
- package/docs/content/native-chat-ui.mdx +7 -0
- package/docs/content/organizations-teams-permissions.mdx +109 -3
- package/docs/content/template-design-collaboration-and-full-apps.mdx +15 -0
- package/docs/content/toolkit-org-team.mdx +72 -12
- package/package.json +1 -1
- package/src/a2a/artifact-response.ts +36 -29
- package/src/action.ts +83 -2
- package/src/chat-threads/store.ts +48 -43
- package/src/cli/skills-content/design-visual-edit-skill.ts +46 -3
- package/src/cli/template-sync.ts +96 -0
- package/src/client/AgentPanel.tsx +26 -6
- package/src/client/AssistantChat.tsx +63 -7
- package/src/client/DefaultSpinner.tsx +29 -0
- package/src/client/org/TeamPage.tsx +161 -6
- package/src/client/org/hooks.ts +67 -0
- package/src/client/org/index.ts +9 -0
- package/src/client/transcription/use-live-transcription.ts +62 -10
- package/src/db/client.ts +42 -3
- package/src/db/ensure-additive-columns.ts +60 -33
- package/src/deploy/build.ts +31 -2
- package/src/mcp-client/routes.ts +10 -1
- package/src/org/app-roles-handlers.ts +152 -0
- package/src/org/app-roles.ts +355 -0
- package/src/org/index.ts +27 -1
- package/src/org/migrations.ts +22 -0
- package/src/org/plugin.ts +27 -0
- package/src/org/schema.ts +15 -0
- package/src/scripts/docs/search.ts +17 -0
- package/src/scripts/docs/source-search.ts +10 -0
- package/src/server/agent-chat/script-entries.ts +3 -0
- package/src/server/agent-chat-plugin.ts +53 -52
- package/src/server/builder-design-systems.ts +1 -1
- package/src/server/core-routes-plugin.ts +6 -1
- package/src/server/framework-request-handler.ts +44 -6
- package/src/templates/chat/.agents/skills/actions/SKILL.md +32 -0
- package/src/templates/chat/.agents/skills/adding-a-feature/SKILL.md +7 -0
- package/src/templates/chat/.agents/skills/security/SKILL.md +31 -0
- package/src/templates/chat/.agents/skills/sharing/SKILL.md +4 -0
- package/src/templates/chat/_gitignore +2 -0
- package/src/templates/default/.agents/skills/actions/SKILL.md +32 -0
- package/src/templates/default/.agents/skills/adding-a-feature/SKILL.md +7 -0
- package/src/templates/default/.agents/skills/security/SKILL.md +31 -0
- package/src/templates/headless/.agents/skills/actions/SKILL.md +32 -0
- package/src/templates/workspace-core/.agents/skills/actions/SKILL.md +32 -0
- package/src/templates/workspace-core/.agents/skills/adding-a-feature/SKILL.md +7 -0
- package/src/templates/workspace-core/.agents/skills/authentication/SKILL.md +40 -0
- package/src/templates/workspace-core/.agents/skills/security/SKILL.md +31 -0
- package/src/templates/workspace-core/.agents/skills/sharing/SKILL.md +4 -0
- package/corpus/core/src/templates/chat/.agents/skills/actions/SKILL.md +0 -530
- package/corpus/core/src/templates/chat/.agents/skills/adding-a-feature/SKILL.md +0 -191
- package/corpus/core/src/templates/chat/.agents/skills/agent-native-docs/SKILL.md +0 -115
- package/corpus/core/src/templates/chat/.agents/skills/agent-native-toolkit/SKILL.md +0 -177
- package/corpus/core/src/templates/chat/.agents/skills/capture-learnings/SKILL.md +0 -89
- package/corpus/core/src/templates/chat/.agents/skills/create-skill/SKILL.md +0 -221
- package/corpus/core/src/templates/chat/.agents/skills/customizing-agent-native/SKILL.md +0 -220
- package/corpus/core/src/templates/chat/.agents/skills/delegate-to-agent/SKILL.md +0 -263
- package/corpus/core/src/templates/chat/.agents/skills/feature-flags/SKILL.md +0 -169
- package/corpus/core/src/templates/chat/.agents/skills/frontend-design/SKILL.md +0 -174
- package/corpus/core/src/templates/chat/.agents/skills/real-time-sync/SKILL.md +0 -232
- package/corpus/core/src/templates/chat/.agents/skills/security/SKILL.md +0 -282
- package/corpus/core/src/templates/chat/.agents/skills/self-modifying-code/SKILL.md +0 -119
- package/corpus/core/src/templates/chat/.agents/skills/shadcn-ui/SKILL.md +0 -123
- package/corpus/core/src/templates/chat/.agents/skills/upgrade-agent-native/SKILL.md +0 -122
- package/corpus/core/src/templates/chat/.env.example +0 -5
- package/corpus/core/src/templates/chat/.ignore +0 -0
- package/corpus/core/src/templates/chat/.oxfmtrc.json +0 -8
- package/corpus/core/src/templates/chat/AGENTS.md +0 -77
- package/corpus/core/src/templates/chat/CHANGELOG.md +0 -10
- package/corpus/core/src/templates/chat/DEVELOPING.md +0 -185
- package/corpus/core/src/templates/chat/README.md +0 -32
- package/corpus/core/src/templates/chat/_gitignore +0 -44
- package/corpus/core/src/templates/chat/actions/hello.ts +0 -13
- package/corpus/core/src/templates/chat/actions/navigate.ts +0 -41
- package/corpus/core/src/templates/chat/actions/run.ts +0 -2
- package/corpus/core/src/templates/chat/actions/view-screen.ts +0 -31
- package/corpus/core/src/templates/chat/app/components/layout/Header.tsx +0 -60
- package/corpus/core/src/templates/chat/app/components/layout/Layout.tsx +0 -188
- package/corpus/core/src/templates/chat/app/components/layout/Sidebar.tsx +0 -505
- package/corpus/core/src/templates/chat/app/components/ui/button.tsx +0 -1
- package/corpus/core/src/templates/chat/app/components/ui/card.tsx +0 -1
- package/corpus/core/src/templates/chat/app/components/ui/dropdown-menu.tsx +0 -1
- package/corpus/core/src/templates/chat/app/components/ui/input.tsx +0 -1
- package/corpus/core/src/templates/chat/app/components/ui/label.tsx +0 -1
- package/corpus/core/src/templates/chat/app/components/ui/sheet.tsx +0 -1
- package/corpus/core/src/templates/chat/app/components/ui/toolkit-provider.tsx +0 -17
- package/corpus/core/src/templates/chat/app/components/ui/tooltip.tsx +0 -1
- package/corpus/core/src/templates/chat/app/design-system.ts +0 -3
- package/corpus/core/src/templates/chat/app/entry.client.tsx +0 -22
- package/corpus/core/src/templates/chat/app/entry.server.tsx +0 -10
- package/corpus/core/src/templates/chat/app/global.css +0 -93
- package/corpus/core/src/templates/chat/app/hooks/use-navigation-state.ts +0 -93
- package/corpus/core/src/templates/chat/app/i18n/ar-SA.ts +0 -68
- package/corpus/core/src/templates/chat/app/i18n/de-DE.ts +0 -71
- package/corpus/core/src/templates/chat/app/i18n/en-US.ts +0 -70
- package/corpus/core/src/templates/chat/app/i18n/es-ES.ts +0 -71
- package/corpus/core/src/templates/chat/app/i18n/fr-FR.ts +0 -71
- package/corpus/core/src/templates/chat/app/i18n/hi-IN.ts +0 -69
- package/corpus/core/src/templates/chat/app/i18n/index.ts +0 -34
- package/corpus/core/src/templates/chat/app/i18n/ja-JP.ts +0 -70
- package/corpus/core/src/templates/chat/app/i18n/ko-KR.ts +0 -70
- package/corpus/core/src/templates/chat/app/i18n/pt-BR.ts +0 -71
- package/corpus/core/src/templates/chat/app/i18n/zh-CN.ts +0 -66
- package/corpus/core/src/templates/chat/app/i18n/zh-TW.ts +0 -66
- package/corpus/core/src/templates/chat/app/i18n-data.ts +0 -556
- package/corpus/core/src/templates/chat/app/lib/agent-page.tsx +0 -49
- package/corpus/core/src/templates/chat/app/lib/app-config.ts +0 -11
- package/corpus/core/src/templates/chat/app/lib/tab-id.ts +0 -1
- package/corpus/core/src/templates/chat/app/lib/utils.ts +0 -1
- package/corpus/core/src/templates/chat/app/root.tsx +0 -173
- package/corpus/core/src/templates/chat/app/routes/_index.tsx +0 -94
- package/corpus/core/src/templates/chat/app/routes/agent.tsx +0 -24
- package/corpus/core/src/templates/chat/app/routes/chat.$threadId.tsx +0 -1
- package/corpus/core/src/templates/chat/app/routes/database.tsx +0 -17
- package/corpus/core/src/templates/chat/app/routes/extensions.$id.$slug.tsx +0 -2
- package/corpus/core/src/templates/chat/app/routes/extensions.$id.tsx +0 -11
- package/corpus/core/src/templates/chat/app/routes/extensions._index.tsx +0 -11
- package/corpus/core/src/templates/chat/app/routes/extensions.tsx +0 -5
- package/corpus/core/src/templates/chat/app/routes/observability.tsx +0 -19
- package/corpus/core/src/templates/chat/app/routes/settings.tsx +0 -89
- package/corpus/core/src/templates/chat/app/routes/team.tsx +0 -11
- package/corpus/core/src/templates/chat/app/routes.ts +0 -4
- package/corpus/core/src/templates/chat/app/vite-env.d.ts +0 -6
- package/corpus/core/src/templates/chat/changelog/2026-06-24-a-new-settings-page-gives-quick-access-to-language-workspace.md +0 -6
- package/corpus/core/src/templates/chat/changelog/2026-06-24-added-a-language-picker-and-localized-app-chrome-for-support.md +0 -6
- package/corpus/core/src/templates/chat/changelog/2026-06-27-traditional-chinese-copy-uses-taiwan-terminology.md +0 -6
- package/corpus/core/src/templates/chat/changelog/2026-06-28-left-sidebar-collapse-motion-and-footer-chrome-are-quieter.md +0 -6
- package/corpus/core/src/templates/chat/changelog/2026-06-29-chat-layouts-adapt-when-the-agent-sidebar-is-open.md +0 -6
- package/corpus/core/src/templates/chat/changelog/2026-07-08-settings-are-cleaner-and-searchable.md +0 -5
- package/corpus/core/src/templates/chat/changelog/2026-07-10-chat-now-makes-ai-connection-setup-clear-without-shifting-th.md +0 -6
- package/corpus/core/src/templates/chat/changelog/2026-07-13-a-full-agent-page-now-brings-context-files-connections-jobs-.md +0 -6
- package/corpus/core/src/templates/chat/changelog/2026-07-14-chat-opens-reliably-on-hosted-deployments-instead-of-failing.md +0 -6
- package/corpus/core/src/templates/chat/changelog/2026-07-14-fixed-chat-template-startup-with-older-core-versions.md +0 -6
- package/corpus/core/src/templates/chat/changelog/2026-07-15-chat-navigation-focuses-on-chat-and-agent.md +0 -6
- package/corpus/core/src/templates/chat/changelog/2026-07-17-the-agent-chat-sidebar-stays-closed-until-you-open-it-or-sta.md +0 -6
- package/corpus/core/src/templates/chat/changelog/2026-07-22-compact-sidebar-footer.md +0 -6
- package/corpus/core/src/templates/chat/changelog/2026-07-22-full-page-chat-keeps-the-active-conversation-when-moving-to-.md +0 -6
- package/corpus/core/src/templates/chat/changelog/2026-07-22-manage-agent-navigation-now-uses-the-connected-nodes-icon.md +0 -6
- package/corpus/core/src/templates/chat/changelog/2026-07-22-recent-chats-are-easier-to-scan-and-expand.md +0 -6
- package/corpus/core/src/templates/chat/changelog/2026-07-23-full-page-chat-is-better-centered-with-quieter-chat-history-.md +0 -6
- package/corpus/core/src/templates/chat/changelog/2026-07-24-borderless-secondary-surfaces.md +0 -6
- package/corpus/core/src/templates/chat/changelog/2026-07-24-sidebar-footer-controls-follow-a-consistent-order.md +0 -6
- package/corpus/core/src/templates/chat/changelog/2026-07-25-settings-navigation-now-keeps-manage-agent-as-a-dedicated-li.md +0 -6
- package/corpus/core/src/templates/chat/components.json +0 -20
- package/corpus/core/src/templates/chat/learnings.defaults.md +0 -5
- package/corpus/core/src/templates/chat/netlify.toml +0 -11
- package/corpus/core/src/templates/chat/package.json +0 -92
- package/corpus/core/src/templates/chat/public/agent-native-icon-dark.svg +0 -10
- package/corpus/core/src/templates/chat/public/agent-native-icon-light.svg +0 -10
- package/corpus/core/src/templates/chat/public/agent-native-logo-dark.svg +0 -21
- package/corpus/core/src/templates/chat/public/agent-native-logo-light.svg +0 -21
- package/corpus/core/src/templates/chat/public/favicon.svg +0 -1
- package/corpus/core/src/templates/chat/public/icon-180.svg +0 -1
- package/corpus/core/src/templates/chat/public/icon-192.svg +0 -1
- package/corpus/core/src/templates/chat/public/icon-512.svg +0 -1
- package/corpus/core/src/templates/chat/public/manifest.json +0 -21
- package/corpus/core/src/templates/chat/react-router.config.ts +0 -7
- package/corpus/core/src/templates/chat/server/middleware/auth.ts +0 -15
- package/corpus/core/src/templates/chat/server/plugins/agent-chat.ts +0 -21
- package/corpus/core/src/templates/chat/server/plugins/auth.ts +0 -17
- package/corpus/core/src/templates/chat/server/routes/[...page].get.ts +0 -5
- package/corpus/core/src/templates/chat/ssr-entry.ts +0 -15
- package/corpus/core/src/templates/chat/tsconfig.json +0 -21
- package/corpus/core/src/templates/chat/vite.config.ts +0 -19
|
@@ -1,282 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: security
|
|
3
|
-
description: >-
|
|
4
|
-
Secure coding practices for agent-native apps: input validation, SQL
|
|
5
|
-
injection, XSS, secrets, data scoping, and auth. Use when writing any action,
|
|
6
|
-
route, or component that touches user data or external input.
|
|
7
|
-
scope: dev
|
|
8
|
-
metadata:
|
|
9
|
-
internal: true
|
|
10
|
-
---
|
|
11
|
-
|
|
12
|
-
# Security
|
|
13
|
-
|
|
14
|
-
## Rule
|
|
15
|
-
|
|
16
|
-
Use the framework's security primitives everywhere. Never bypass them.
|
|
17
|
-
|
|
18
|
-
## Absolute Secrets Rule
|
|
19
|
-
|
|
20
|
-
Never hardcode secret values or real private data. This applies to source code,
|
|
21
|
-
docs, tests, fixtures, generated prompts, screenshots, seed data, and extension
|
|
22
|
-
HTML just as much as production code.
|
|
23
|
-
|
|
24
|
-
Do not paste or invent real-looking API keys, bearer tokens, OAuth refresh
|
|
25
|
-
tokens, webhook URLs, signing secrets, private Builder/internal data, or customer
|
|
26
|
-
data into the repo. Examples must use obvious placeholders such as
|
|
27
|
-
`<OPENAI_API_KEY>`, `${keys.SLACK_WEBHOOK}`, `sk-test-example`, or
|
|
28
|
-
`example.customer@example.com`. Test literals should be clearly fake and must
|
|
29
|
-
not match real provider token formats when an `example` token will do.
|
|
30
|
-
|
|
31
|
-
Credential values enter the system only through approved runtime channels:
|
|
32
|
-
deployment env vars for deploy-level secrets, the encrypted `app_secrets` vault
|
|
33
|
-
or `saveCredential` / `resolveCredential` for user/org/workspace API keys, and
|
|
34
|
-
`oauth_tokens` for OAuth. Code and instructions may name the credential key
|
|
35
|
-
(`OPENAI_API_KEY`), but must never contain the credential value.
|
|
36
|
-
|
|
37
|
-
## Input Validation
|
|
38
|
-
|
|
39
|
-
Use `defineAction` with a Zod `schema:` for every action. The framework validates input automatically and returns clear 400 errors for HTTP callers and structured error results for agent tool calls.
|
|
40
|
-
|
|
41
|
-
```ts
|
|
42
|
-
export default defineAction({
|
|
43
|
-
schema: z.object({
|
|
44
|
-
email: z.string().email(),
|
|
45
|
-
role: z.enum(["admin", "member"]),
|
|
46
|
-
limit: z.coerce.number().int().min(1).max(100).default(25),
|
|
47
|
-
}),
|
|
48
|
-
run: async (args) => { /* args is fully typed and validated */ },
|
|
49
|
-
});
|
|
50
|
-
```
|
|
51
|
-
|
|
52
|
-
The legacy `parameters:` field (plain JSON Schema) has no runtime validation — do not use it for new code.
|
|
53
|
-
|
|
54
|
-
## Large Payloads
|
|
55
|
-
|
|
56
|
-
Do not accept or persist unbounded base64/file blobs through actions, SQL writes,
|
|
57
|
-
or `application_state`. Route uploads through the file-upload provider and store
|
|
58
|
-
references. This prevents database bloat, slow hot paths, and accidental secret
|
|
59
|
-
or customer-data embedding inside binary payloads.
|
|
60
|
-
|
|
61
|
-
## SQL Injection
|
|
62
|
-
|
|
63
|
-
Never concatenate user input into SQL strings. Use Drizzle ORM's query builder (always safe) or parameterized queries:
|
|
64
|
-
|
|
65
|
-
```ts
|
|
66
|
-
// Safe — Drizzle ORM
|
|
67
|
-
await db.select().from(users).where(eq(users.email, args.email));
|
|
68
|
-
|
|
69
|
-
// Safe — parameterized raw SQL
|
|
70
|
-
await client.execute({ sql: "SELECT * FROM users WHERE id = ?", args: [id] });
|
|
71
|
-
|
|
72
|
-
// NEVER do this
|
|
73
|
-
await client.execute(`SELECT * FROM users WHERE id = '${id}'`);
|
|
74
|
-
```
|
|
75
|
-
|
|
76
|
-
## XSS
|
|
77
|
-
|
|
78
|
-
- React auto-escapes JSX content — trust it.
|
|
79
|
-
- Never use `dangerouslySetInnerHTML`, `innerHTML`, `eval()`, or `document.write()` with user-controlled content.
|
|
80
|
-
- For rich text editing, use TipTap (framework dependency).
|
|
81
|
-
- For rendering markdown, use `react-markdown`.
|
|
82
|
-
|
|
83
|
-
## SSRF
|
|
84
|
-
|
|
85
|
-
Any server-side `fetch` of a user- or agent-controlled URL must go through the framework SSRF guard — a bare `fetch()` can be steered at cloud metadata (`169.254.169.254`), `localhost`, or internal services.
|
|
86
|
-
|
|
87
|
-
```ts
|
|
88
|
-
import { ssrfSafeFetch } from "@agent-native/core/extensions/url-safety";
|
|
89
|
-
// Blocks private/internal targets, re-checks the resolved IP at connect time
|
|
90
|
-
// (DNS rebinding), and re-validates every redirect hop.
|
|
91
|
-
const res = await ssrfSafeFetch(userProvidedUrl, {}, { maxRedirects: 3 });
|
|
92
|
-
```
|
|
93
|
-
|
|
94
|
-
For a pre-flight-only check (e.g. before a streaming or one-shot fetch), use `isBlockedExtensionUrlWithDns(url)` plus `createSsrfSafeDispatcher()` from the same module, and set `redirect: "manual"`. Never let the default `fetch` follow redirects for an untrusted URL — a public URL can 30x into the private network.
|
|
95
|
-
|
|
96
|
-
## Secrets
|
|
97
|
-
|
|
98
|
-
- OAuth tokens go in the `oauth_tokens` store via `saveOAuthTokens()`.
|
|
99
|
-
- Per-user / per-org API keys go through `saveCredential` / `resolveCredential` (`@agent-native/core/credentials`) or the `app_secrets` vault. Both encrypt values at rest with AES-256-GCM (keyed by `SECRETS_ENCRYPTION_KEY`, falling back to `BETTER_AUTH_SECRET`; production refuses to start without one).
|
|
100
|
-
- Never hand-roll secrets into `settings`, `application_state`, source code, or action responses sent to the client. The credential / vault APIs above are the only sanctioned stores.
|
|
101
|
-
- Never commit real keys, tokens, webhook URLs, signing secrets, or private
|
|
102
|
-
Builder/customer data in examples or fixtures. Use placeholders that cannot be
|
|
103
|
-
mistaken for working credentials.
|
|
104
|
-
|
|
105
|
-
## User Credentials Are Per-User Data — Never `process.env`
|
|
106
|
-
|
|
107
|
-
User credentials (API keys, third-party tokens) are per-user (or per-org) data. They MUST live in SQL, scoped per-user (`u:<email>:credential:KEY`) or per-org (`o:<orgId>:credential:KEY`). Always read with the request context:
|
|
108
|
-
|
|
109
|
-
```ts
|
|
110
|
-
import { resolveCredential } from "@agent-native/core/credentials";
|
|
111
|
-
const apiKey = await resolveCredential("OPENAI_API_KEY", { userEmail, orgId });
|
|
112
|
-
```
|
|
113
|
-
|
|
114
|
-
Values are encrypted at rest (AES-256-GCM, shared `secrets/crypto.ts`): `saveCredential` encrypts on write and `resolveCredential` decrypts on read, with a transparent fallback for legacy plaintext rows. The agent's raw `db-query` / `db-exec` tools also cannot read credential rows — they are excluded from the scoped `settings` view. To encrypt pre-existing rows in place, run `pnpm action db-migrate-encrypt-credentials` (idempotent, non-destructive; needs the same `SECRETS_ENCRYPTION_KEY` / `BETTER_AUTH_SECRET` as the app).
|
|
115
|
-
|
|
116
|
-
On 2026-04-29 the previous one-arg `resolveCredential(key)` form fell back to `process.env[key]` and an unscoped global `settings` row, so every signed-in user inherited the deployment's credentials. Two guards now block this in CI (`pnpm prep`):
|
|
117
|
-
|
|
118
|
-
- `scripts/guard-no-env-credentials.mjs` — bans `process.env.<KEY>` reads in `packages/core/src/credentials/`, `secrets/`, `vault/`, and `templates/*/server/{lib,routes/api}/credential*` paths, except for an explicit allowlist of deploy-level vars (`DATABASE_URL`, `BETTER_AUTH_SECRET`, `NETLIFY_*`, etc.). Per-line opt-out: `// guard:allow-env-credential — <reason>`.
|
|
119
|
-
- `scripts/guard-no-unscoped-credentials.mjs` — bans one-arg calls to `resolveCredential` / `hasCredential` / `saveCredential` / `deleteCredential`. Per-line opt-out: `// guard:allow-unscoped-credential — <reason>`.
|
|
120
|
-
|
|
121
|
-
If a deploy-level value genuinely needs an env var (CI-set token, host secret), it's not a user credential — keep it out of the credentials/ secrets/ vault/ paths and the env-credentials guard won't see it.
|
|
122
|
-
|
|
123
|
-
## Guards
|
|
124
|
-
|
|
125
|
-
Two more CI guards (also wired into `pnpm prep`) target the 2026-04 cross-tenant leak class — request-state escaping into shared process state, and dev-mode sentinel identities used as production fallbacks.
|
|
126
|
-
|
|
127
|
-
- `scripts/guard-no-env-mutation.mjs` — bans `process.env.<KEY> = …` (and bracket / compound forms) anywhere in production code. On serverless, every warm container handles many concurrent requests in one Node process, so `process.env` mutation leaks across in-flight requests (the "restore" line at the end of a handler races and never helps — most recently the Zoom webhook). Use `runWithRequestContext({ userEmail, orgId, timezone }, fn)` from `@agent-native/core/server` instead — it's AsyncLocalStorage-backed and per-request safe. Allowlisted paths: `scripts/`, `*.spec.ts` / `*.test.ts`, `packages/core/src/dev**`, `templates/*/test/`, anything under `/cli/` or `/scaffold/`. Per-line opt-out: `process.env.X = y // guard:allow-env-mutation — <reason>`.
|
|
128
|
-
- `scripts/guard-no-localhost-fallback.mjs` — bans the literal `"local@localhost"` / `'local@localhost'` / `` `local@localhost` `` in production code. The bug class: `getRequestUserEmail() ?? "local@localhost"` silently pools every unauthenticated request into a single shared tenant, leaking credentials, tools, and `application_state` rows between accounts. The right behavior is to throw / 401 when there's no session. Allowlisted paths: the dev-mode auth shim (`packages/core/src/server/auth.ts`), `packages/core/src/dev**`, tests, `scripts/`, `seed/` / `seeds/`, plus a few framework helpers that intentionally inspect or migrate the dev identity. SQL DDL `DEFAULT 'local@localhost'` and the Drizzle helper `.default('local@localhost')` are skipped per-line — schema column defaults are intentional dev fixtures, not the dangerous fallback pattern. Per-line opt-out: `email ?? "local@localhost" // guard:allow-localhost-fallback — <reason>`.
|
|
129
|
-
|
|
130
|
-
The same guard also bans the **ambient process identity** as a request-scoped fallback: `?? process.env.AGENT_USER_EMAIL`, `|| process.env.WORKSPACE_OWNER_EMAIL`, and `?? getAmbientUserEmail()`. Those name the identity of the *deployment*, not the caller, so a handler reading one authorizes whoever the deploy env names rather than whoever signed in — it fails open toward more privilege. Exempt paths are the ones with no request by construction: `scripts/` (including `templates/*/scripts/`), `src/cli/`, `src/scripts/`, `script-helpers.ts` / `script-entries.ts`, tests, and seeds. It deliberately matches only the `??` / `||` fallback position, so reading the same env var to build an admin allowlist (`envEmails("WORKSPACE_OWNER_EMAIL").includes(email)`) is untouched. Known gaps, both requiring dataflow analysis the guard does not do: an env read aliased through a local (`const fallback = process.env.AGENT_USER_EMAIL; … ?? fallback`) and a destructured `const { AGENT_USER_EMAIL } = process.env`.
|
|
131
|
-
|
|
132
|
-
## Auth
|
|
133
|
-
|
|
134
|
-
- All actions are protected by the auth guard automatically.
|
|
135
|
-
- Prefer actions for normal app data. Do not hand-write `/api/*` routes for
|
|
136
|
-
CRUD, data queries, or action re-exports just to add auth; action endpoints
|
|
137
|
-
already get auth and request context.
|
|
138
|
-
- If you must create custom `/api/` routes, always call `getSession(event)` and reject requests without a session:
|
|
139
|
-
|
|
140
|
-
```ts
|
|
141
|
-
import { getSession } from "@agent-native/core/server";
|
|
142
|
-
|
|
143
|
-
export default defineEventHandler(async (event) => {
|
|
144
|
-
const session = await getSession(event);
|
|
145
|
-
if (!session) throw createError({ statusCode: 401 });
|
|
146
|
-
// ...
|
|
147
|
-
});
|
|
148
|
-
```
|
|
149
|
-
|
|
150
|
-
- Never create unprotected routes that modify data.
|
|
151
|
-
|
|
152
|
-
**Exception — the SSR HTML/`.data` catch-all is deliberately session-blind.**
|
|
153
|
-
The rule above is for routes that read or mutate user data. The SSR page
|
|
154
|
-
render and React Router `.data` route are different: they serve one
|
|
155
|
-
impersonal, public-cacheable shell to every visitor by design, and loaders on
|
|
156
|
-
that path render no user data. Do not "fix" this by adding `getSession`,
|
|
157
|
-
`private`, or `no-store` to it — that regresses the CDN cache contract for the
|
|
158
|
-
whole site. Data scoping lives in actions and API routes; the client gates
|
|
159
|
-
private UI after the shell loads. See the `authentication` skill and
|
|
160
|
-
`guard:ssr-cache-shell` / `ssr-handler.spec.ts`.
|
|
161
|
-
|
|
162
|
-
## Human-in-the-Loop Approval for High-Consequence Actions
|
|
163
|
-
|
|
164
|
-
For a small set of outward-facing, hard-to-undo operations — sending an email, charging a card, deleting an account, posting publicly — auth and access control are necessary but not sufficient: you also do not want the **agent** to perform them autonomously. Set `needsApproval` on the `defineAction` so the agent cannot run the action without a human approving the specific call.
|
|
165
|
-
|
|
166
|
-
```ts
|
|
167
|
-
export default defineAction({
|
|
168
|
-
description: "Send an email via Gmail.",
|
|
169
|
-
schema: z.object({ to: z.string(), subject: z.string(), body: z.string() }),
|
|
170
|
-
needsApproval: true, // or (args, ctx) => boolean | Promise<boolean>
|
|
171
|
-
run: async (args) => {
|
|
172
|
-
/* ...actually send... */
|
|
173
|
-
},
|
|
174
|
-
});
|
|
175
|
-
```
|
|
176
|
-
|
|
177
|
-
When the gate is truthy and the call is not yet approved, the loop emits an `approval_required` event and **stops the turn — `run()` never executes**. The human approves via the chat UI's Approve affordance, which re-issues the turn with the call's stable `approvalKey`; only then does the action run. A predicate gates conditionally (e.g. only external recipients) and **fails closed** — a throw is treated as "approval required".
|
|
178
|
-
|
|
179
|
-
Rules:
|
|
180
|
-
|
|
181
|
-
- Reach for `needsApproval` only for genuinely high-consequence operations. The default is off, and the framework intentionally keeps approvals rare — over-gating turns the agent into a click-through wizard. The canonical (and intentionally lone) framework example is Mail's `send-email`.
|
|
182
|
-
- `needsApproval` is **not** a substitute for `accessFilter` / `assertAccess` or for hiding sensitive operations from the model with `agentTool: false` / `toolCallable: false`. It is the layer for "a human must explicitly bless this specific outward-facing call," not for scoping data. See the `actions` skill for the full surface.
|
|
183
|
-
|
|
184
|
-
## Custom HTTP Routes Must Apply Access Control Themselves
|
|
185
|
-
|
|
186
|
-
This is the single most-failed rule in the codebase. Auto-mounted action routes (`/_agent-native/actions/...`) get a request context wired up automatically. **Hand-written `/api/*` Nitro routes do not.** If your handler queries an ownable resource (any table with `...ownableColumns()`), you MUST:
|
|
187
|
-
|
|
188
|
-
1. Read the session: `const session = await getSession(event).catch(() => null)`.
|
|
189
|
-
2. Run the work inside `runWithRequestContext({ userEmail: session?.email, orgId: session?.orgId }, fn)` from `@agent-native/core/server`.
|
|
190
|
-
3. Inside `fn`, query through one of:
|
|
191
|
-
- `accessFilter(table, sharesTable)` in the WHERE clause for list/read-many.
|
|
192
|
-
- `resolveAccess("<type>", id)` for read-by-id (returns null if no access — return 404, not 403, so existence isn't leaked).
|
|
193
|
-
- `assertAccess("<type>", id, "viewer"|"editor"|"admin")` for write/delete-by-id.
|
|
194
|
-
|
|
195
|
-
```ts
|
|
196
|
-
// Bad — Brent's signup leaked every other user's decks because of this exact shape.
|
|
197
|
-
export default defineEventHandler(async () => {
|
|
198
|
-
const db = getDb();
|
|
199
|
-
return db.select().from(schema.decks); // no access filter!
|
|
200
|
-
});
|
|
201
|
-
|
|
202
|
-
// Good
|
|
203
|
-
import { getSession, runWithRequestContext } from "@agent-native/core/server";
|
|
204
|
-
import { accessFilter } from "@agent-native/core/sharing";
|
|
205
|
-
export default defineEventHandler(async (event) => {
|
|
206
|
-
const session = await getSession(event).catch(() => null);
|
|
207
|
-
return runWithRequestContext(
|
|
208
|
-
{ userEmail: session?.email, orgId: session?.orgId },
|
|
209
|
-
async () => {
|
|
210
|
-
const db = getDb();
|
|
211
|
-
return db
|
|
212
|
-
.select()
|
|
213
|
-
.from(schema.decks)
|
|
214
|
-
.where(accessFilter(schema.decks, schema.deckShares));
|
|
215
|
-
},
|
|
216
|
-
);
|
|
217
|
-
});
|
|
218
|
-
```
|
|
219
|
-
|
|
220
|
-
`scripts/guard-no-unscoped-queries.mjs` runs in `pnpm prep` and fails the build if any file in `templates/*/server/`, `templates/*/actions/`, or `packages/*/src/` queries an ownable table without one of the access helpers. Last-resort opt-out is the marker comment `// guard:allow-unscoped — <reason>` — only use it for cases like the sharing primitives themselves or share-token-public viewer endpoints, and always include a reviewer-readable reason.
|
|
221
|
-
|
|
222
|
-
## Data Scoping
|
|
223
|
-
|
|
224
|
-
In production, the framework automatically restricts all agent SQL queries to the current user's data using temporary views. This is enforced at the SQL level — the agent cannot bypass it.
|
|
225
|
-
|
|
226
|
-
The `db-query` / `db-exec` tools (and the extension SQL bridge, which shares the same path) reject schema-qualified table references like `public.<table>` or `main.<table>` — a qualified name resolves to the base table and would skip the temp view. Use bare table names; scoping is applied automatically.
|
|
227
|
-
|
|
228
|
-
### Per-User Scoping (`owner_email`)
|
|
229
|
-
|
|
230
|
-
Every template table with user data **must** have an `owner_email` text column:
|
|
231
|
-
|
|
232
|
-
1. Framework detects `owner_email` via schema introspection
|
|
233
|
-
2. Creates temp views `WHERE owner_email = <current user>` before each query
|
|
234
|
-
3. Auto-injects `owner_email` into INSERT statements
|
|
235
|
-
|
|
236
|
-
The current user is resolved from `AGENT_USER_EMAIL` (set automatically from the session).
|
|
237
|
-
|
|
238
|
-
### Per-Org Scoping (`org_id`)
|
|
239
|
-
|
|
240
|
-
For multi-org apps, tables also need `org_id`:
|
|
241
|
-
|
|
242
|
-
1. `WHERE org_id = <current org>` is added (in addition to `owner_email` if present)
|
|
243
|
-
2. `org_id` is auto-injected into INSERT statements
|
|
244
|
-
|
|
245
|
-
Enable org scoping in the agent-chat plugin:
|
|
246
|
-
|
|
247
|
-
```ts
|
|
248
|
-
createAgentChatPlugin({
|
|
249
|
-
resolveOrgId: async (event) => {
|
|
250
|
-
const ctx = await getOrgContext(event);
|
|
251
|
-
return ctx.orgId;
|
|
252
|
-
},
|
|
253
|
-
});
|
|
254
|
-
```
|
|
255
|
-
|
|
256
|
-
### Column Conventions
|
|
257
|
-
|
|
258
|
-
| Column | Purpose | Required |
|
|
259
|
-
| ------------- | ----------------------- | ------------------------------- |
|
|
260
|
-
| `owner_email` | Per-user data isolation | Yes, for all user-facing tables |
|
|
261
|
-
| `org_id` | Per-org data isolation | Yes, for multi-org apps |
|
|
262
|
-
|
|
263
|
-
Run `pnpm action db-check-scoping` to verify. Use `--require-org` for multi-org apps.
|
|
264
|
-
|
|
265
|
-
## Checklist
|
|
266
|
-
|
|
267
|
-
- [ ] New action uses `defineAction` with a Zod `schema:`
|
|
268
|
-
- [ ] No SQL string concatenation with user input
|
|
269
|
-
- [ ] No `dangerouslySetInnerHTML` with user content
|
|
270
|
-
- [ ] Server-side fetches of user/agent URLs use `ssrfSafeFetch`, not bare `fetch`
|
|
271
|
-
- [ ] Secrets stored via `saveCredential` / the vault (encrypted), never raw in `settings` or responses
|
|
272
|
-
- [ ] No hardcoded API keys, tokens, webhook URLs, signing secrets, real
|
|
273
|
-
credential-looking strings, private Builder/internal data, or customer data
|
|
274
|
-
- [ ] New env vars in `.env` only, not committed
|
|
275
|
-
- [ ] New user-data tables have `owner_email` column
|
|
276
|
-
- [ ] Custom routes call `getSession` and reject unauthenticated requests
|
|
277
|
-
|
|
278
|
-
## Related Skills
|
|
279
|
-
|
|
280
|
-
- `storing-data` — SQL patterns and the agent's db tools
|
|
281
|
-
- `actions` — `defineAction` with Zod schema validation
|
|
282
|
-
- `authentication` — Auth modes, sessions, and org context
|
|
@@ -1,119 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: self-modifying-code
|
|
3
|
-
description: >-
|
|
4
|
-
Tiers, checkpoints, and off-limits paths for an agent editing the app's own
|
|
5
|
-
source. Use when designing UI for agent editability, deciding whether a file
|
|
6
|
-
is safe for the agent to change, or when tempted to patch config, `.env`, or
|
|
7
|
-
an `@agent-native/*` package. Do not load it for ordinary source edits.
|
|
8
|
-
scope: dev
|
|
9
|
-
metadata:
|
|
10
|
-
internal: true
|
|
11
|
-
---
|
|
12
|
-
|
|
13
|
-
# Self-Modifying Code
|
|
14
|
-
|
|
15
|
-
## Rule
|
|
16
|
-
|
|
17
|
-
The agent can edit the app's own source code — components, routes, styles, scripts. This is a feature, not a bug. Design your app expecting this.
|
|
18
|
-
|
|
19
|
-
## Why
|
|
20
|
-
|
|
21
|
-
An agent-native app isn't just an app the agent can _use_ — it's an app the agent can _change_. The agent can fix bugs, add features, adjust styles, and restructure code. This makes the agent a true collaborator, not just an operator.
|
|
22
|
-
|
|
23
|
-
## Modification Taxonomy
|
|
24
|
-
|
|
25
|
-
Not all modifications are equal. Use this to decide what level of care is needed:
|
|
26
|
-
|
|
27
|
-
| Tier | What | Examples | After modifying |
|
|
28
|
-
| ------------- | --------------------- | ------------------------------------------------ | --------------------------------- |
|
|
29
|
-
| 1: Data | Files in `data/` | JSON state, generated content, markdown | Nothing — these are routine |
|
|
30
|
-
| 2: Source | App code | Components, routes, styles, scripts | Run `pnpm typecheck && pnpm lint` |
|
|
31
|
-
| 3: Config | Project config | `package.json`, `tsconfig.json`, `vite.config.*` | Ask for explicit approval first |
|
|
32
|
-
| 4: Off limits | Secrets and framework | `.env`, `@agent-native/*` packages & overrides | Never modify these |
|
|
33
|
-
|
|
34
|
-
Tier 4 includes **all** of the following — not only editing package source:
|
|
35
|
-
|
|
36
|
-
- Files under `node_modules/@agent-native/*` (core, dispatch, scheduling, …)
|
|
37
|
-
- `pnpm.overrides`, `overrides`, `resolutions`, or `patchedDependencies` that
|
|
38
|
-
target any `@agent-native/*` package
|
|
39
|
-
- Local package patches or invented "dispatch/core behavior" shims meant to
|
|
40
|
-
paper over a version skew or failed upgrade
|
|
41
|
-
|
|
42
|
-
This does not prohibit intentional app-owned UI customization. When public
|
|
43
|
-
props and composition are insufficient, the `customizing-agent-native` skill
|
|
44
|
-
uses `agent-native eject` to transfer the smallest supported unit from the
|
|
45
|
-
installed package into the app. The ejected unit must keep public runtime
|
|
46
|
-
contracts and must not replace Core auth, DB, actions, agent execution, or
|
|
47
|
-
transport behavior. Manual copying is only the fallback described by an unknown
|
|
48
|
-
third-party package's add-style blueprint.
|
|
49
|
-
|
|
50
|
-
When an older branch needs current packages, use **`agent-native upgrade`**
|
|
51
|
-
(see the `upgrade-agent-native` skill). If upgrade or typecheck fails, fix
|
|
52
|
-
**app** code or stop and ask — do not patch the framework.
|
|
53
|
-
|
|
54
|
-
## Git Checkpoint Pattern
|
|
55
|
-
|
|
56
|
-
Before modifying source code (Tier 2+), create a rollback point:
|
|
57
|
-
|
|
58
|
-
1. Commit or stash current state
|
|
59
|
-
2. Make the edit
|
|
60
|
-
3. Run `pnpm typecheck && pnpm lint`
|
|
61
|
-
4. If verification fails → revert with `git checkout -- <file>`
|
|
62
|
-
5. If verification passes → continue
|
|
63
|
-
|
|
64
|
-
This ensures the agent can experiment without breaking the app.
|
|
65
|
-
|
|
66
|
-
## Designing for Agent Editability
|
|
67
|
-
|
|
68
|
-
Make your app easy for the agent to understand and modify:
|
|
69
|
-
|
|
70
|
-
**Expose UI state via `data-*` attributes** so the agent knows what's selected:
|
|
71
|
-
|
|
72
|
-
```ts
|
|
73
|
-
const el = document.documentElement;
|
|
74
|
-
el.dataset.currentView = view;
|
|
75
|
-
el.dataset.selectedId = selectedItem?.id || "";
|
|
76
|
-
```
|
|
77
|
-
|
|
78
|
-
**Expose richer context via `window.__appState`** for complex state:
|
|
79
|
-
|
|
80
|
-
```ts
|
|
81
|
-
(window as any).__appState = {
|
|
82
|
-
selectedId: id,
|
|
83
|
-
currentLayout: layout,
|
|
84
|
-
itemCount: items.length,
|
|
85
|
-
};
|
|
86
|
-
```
|
|
87
|
-
|
|
88
|
-
**Use configuration-driven rendering** — Extract visual decisions (colors, layouts, sizes) into JSON config files in `data/`. The agent can modify the config (Tier 1) instead of the component source (Tier 2).
|
|
89
|
-
|
|
90
|
-
**Keep localized copy in catalogs** — When editing visible UI copy, labels,
|
|
91
|
-
toasts, empty states, prompts, or formatting, read `internationalization` and
|
|
92
|
-
update `app/i18n/en-US.ts` plus existing locale catalogs instead of leaving new
|
|
93
|
-
inline strings in components.
|
|
94
|
-
|
|
95
|
-
## Don't
|
|
96
|
-
|
|
97
|
-
- Don't modify `.env` files or files containing secrets
|
|
98
|
-
- Don't modify `@agent-native/core`, `@agent-native/dispatch`, or other
|
|
99
|
-
`@agent-native/*` package internals (including under `node_modules`)
|
|
100
|
-
- Don't confuse readable package source with app-owned code: use
|
|
101
|
-
`customizing-agent-native` and `agent-native eject` for supported ownership
|
|
102
|
-
transfer
|
|
103
|
-
- Don't add `pnpm.overrides` / `patchedDependencies` / `resolutions` for
|
|
104
|
-
`@agent-native/*` to "make the app run" after a version bump
|
|
105
|
-
- Don't invent local dispatch/core behavior overrides when upgrade fails —
|
|
106
|
-
run `npx @agent-native/core@latest upgrade`, then fix app-level errors only
|
|
107
|
-
- Don't modify `.agents/skills/` or `AGENTS.md` unless explicitly requested
|
|
108
|
-
- Don't skip the typecheck/lint step after editing source code
|
|
109
|
-
- Don't make source changes without a git checkpoint to roll back to
|
|
110
|
-
|
|
111
|
-
## Related Skills
|
|
112
|
-
|
|
113
|
-
- **upgrade-agent-native** — supported path to bring an older app/workspace current
|
|
114
|
-
- **customizing-agent-native** — configure, compose, or eject installed features safely
|
|
115
|
-
- **storing-data** — Tier 1 modifications (data files) are the safest and most common
|
|
116
|
-
- **actions** — The agent can create or modify actions to add new capabilities
|
|
117
|
-
- **delegate-to-agent** — Self-modification requests come through the agent chat
|
|
118
|
-
- **real-time-sync** — Database writes trigger change events to update the UI
|
|
119
|
-
- **internationalization** — UI copy, language catalogs, locale switching, and RTL-safe edits
|
|
@@ -1,123 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: shadcn-ui
|
|
3
|
-
description: >-
|
|
4
|
-
The shadcn CLI, component composition, theming, and registry workflow. Use
|
|
5
|
-
when adding, replacing, upgrading, or debugging a shadcn/ui primitive itself,
|
|
6
|
-
or when changing a theme or registry. Do not load it for ordinary edits to a
|
|
7
|
-
file that happens to import a shadcn component.
|
|
8
|
-
scope: dev
|
|
9
|
-
source: https://ui.shadcn.com/docs/skills
|
|
10
|
-
local-changes: >-
|
|
11
|
-
Description narrowed deliberately; an upstream sync must not restore the
|
|
12
|
-
"any project with a components.json file" trigger.
|
|
13
|
-
metadata:
|
|
14
|
-
internal: true
|
|
15
|
-
---
|
|
16
|
-
|
|
17
|
-
# shadcn/ui
|
|
18
|
-
|
|
19
|
-
This skill keeps shadcn/ui work project-aware. Components are source files in the app, so always inspect the local project before adding, importing, or rewriting them.
|
|
20
|
-
|
|
21
|
-
## First Steps
|
|
22
|
-
|
|
23
|
-
1. Work from the app root that owns `components.json`.
|
|
24
|
-
2. In an Agent Native app, inspect `app/design-system.ts` and
|
|
25
|
-
`ToolkitProvider` before choosing a primitive. A registered company design
|
|
26
|
-
system takes precedence over the default shadcn adapter.
|
|
27
|
-
3. Run `pnpm dlx shadcn@latest info --json` when you need current project context: framework, Tailwind version, aliases, icon library, installed components, and resolved paths.
|
|
28
|
-
4. Use the actual aliases from `components.json` or `shadcn info`; do not assume `@/components/ui` if the project says otherwise.
|
|
29
|
-
5. Check `app/components/ui/` or the resolved `ui` path before importing a component.
|
|
30
|
-
6. For unfamiliar components, run `pnpm dlx shadcn@latest docs <component>` and read the returned docs or examples before coding.
|
|
31
|
-
|
|
32
|
-
## Agent Native Adapter Rule
|
|
33
|
-
|
|
34
|
-
Pages, routes, and domain components import controls through the app's local UI
|
|
35
|
-
adapter layer. Never import `@agent-native/toolkit/ui/*` directly in app product
|
|
36
|
-
code. Direct imports bypass `app/design-system.ts` and make Toolkit/Core
|
|
37
|
-
surfaces use different controls from the app.
|
|
38
|
-
|
|
39
|
-
When shadcn is the app's adapter, add or update the local primitive and keep
|
|
40
|
-
product code on that local import. When a company design system is registered,
|
|
41
|
-
adapt its components to the semantic contracts from
|
|
42
|
-
`@agent-native/toolkit/design-system`; do not recreate a parallel shadcn
|
|
43
|
-
surface. The semantic API is styling-runtime agnostic, so do not require
|
|
44
|
-
Tailwind, CVA, or `className` in customer adapters.
|
|
45
|
-
|
|
46
|
-
For shared Toolkit features, customize presentation through semantic
|
|
47
|
-
components, a feature-level controller, and product-level render slots. Keep
|
|
48
|
-
the same controller for default and custom views. Use the conformance kit for
|
|
49
|
-
behavior components whose focus, portal, keyboard, dismissal, or stacking
|
|
50
|
-
behavior comes from the company design system.
|
|
51
|
-
|
|
52
|
-
## Adding Or Updating Components
|
|
53
|
-
|
|
54
|
-
- Add missing primitives with `pnpm dlx shadcn@latest add <component>` from the app root.
|
|
55
|
-
- Before overwriting an existing component, use `pnpm dlx shadcn@latest add <component> --dry-run` and `--diff` to inspect the change.
|
|
56
|
-
- After adding registry code, read the generated files. Fix import aliases, icon imports, missing subcomponents, and composition issues before using the component.
|
|
57
|
-
- Do not fetch raw component files manually from GitHub when the shadcn CLI can resolve the registry item.
|
|
58
|
-
- If a user asks to add a third-party block but does not name a registry, ask which registry to use instead of guessing.
|
|
59
|
-
|
|
60
|
-
## Component Composition
|
|
61
|
-
|
|
62
|
-
- Use existing primitives before custom markup: `Alert` for callouts, `Badge` for small status labels, `Separator` for dividers, `Skeleton` for placeholders, `Table` for tabular data, and `Card` for framed content.
|
|
63
|
-
- Use full card anatomy when appropriate: `CardHeader`, `CardTitle`, `CardDescription`, `CardContent`, and `CardFooter`.
|
|
64
|
-
- Dialog, Sheet, Drawer, and AlertDialog content must include an accessible title. Use visually hidden titles only when the visible UI already communicates the title.
|
|
65
|
-
- Put items inside their group components: `SelectItem` in `SelectGroup`, `DropdownMenuItem` in `DropdownMenuGroup`, `CommandItem` in `CommandGroup`, and equivalent menu groups.
|
|
66
|
-
- `TabsTrigger` belongs inside `TabsList`.
|
|
67
|
-
- `Avatar` always needs `AvatarFallback`.
|
|
68
|
-
- Buttons do not have magic loading props. Compose loading with `disabled`, `Spinner`, and clear text.
|
|
69
|
-
|
|
70
|
-
## Forms And Inputs
|
|
71
|
-
|
|
72
|
-
- Use the app's shadcn form primitives instead of raw div stacks.
|
|
73
|
-
- If `Field`, `FieldGroup`, `FieldSet`, or `InputGroup` are installed or worth adding, use them for form layout, grouped fields, and input add-ons.
|
|
74
|
-
- Do not place buttons inside inputs with absolute positioning. Use `InputGroup` and `InputGroupAddon` when available.
|
|
75
|
-
- Use `ToggleGroup` for small option sets, `RadioGroup` for one-of-many choices, `Checkbox` for multi-select, `Switch` for settings toggles, `Select` or `Combobox` for predefined choices, and `Slider` or numeric input for numeric values.
|
|
76
|
-
- Validation must be accessible: pair visual invalid states with `aria-invalid`, and connect descriptions/errors to controls.
|
|
77
|
-
|
|
78
|
-
## Styling And Theming
|
|
79
|
-
|
|
80
|
-
- Use semantic tokens (`bg-background`, `text-foreground`, `text-muted-foreground`, `bg-primary`, `border-border`, `text-destructive`) instead of raw colors for reusable app UI.
|
|
81
|
-
- Prefer built-in variants and sizes before custom classes.
|
|
82
|
-
- Use `className` mostly for layout and spacing; avoid overriding component colors and typography unless the component is intentionally being extended.
|
|
83
|
-
- Use `gap-*` instead of `space-x-*` / `space-y-*`.
|
|
84
|
-
- Use `size-*` when width and height are equal.
|
|
85
|
-
- Use `truncate` for single-line clipping.
|
|
86
|
-
- Use `cn()` for conditional classes.
|
|
87
|
-
- Do not add manual `z-index` to overlay primitives unless you are fixing a verified stacking bug.
|
|
88
|
-
- Add custom colors as CSS variables in the existing Tailwind CSS file reported by shadcn info. For Tailwind v4, register variables with `@theme inline`.
|
|
89
|
-
|
|
90
|
-
## Transitions And Motion
|
|
91
|
-
|
|
92
|
-
shadcn's built-in component animations are the right level of polish — keep them. The goal is a snappy, clean UI, not a motionless one. Match shadcn's motion vocabulary; don't strip it and don't pile on decorative custom animation.
|
|
93
|
-
|
|
94
|
-
- **Never remove or override a shadcn component's default animation.** `data-[state=open]:animate-in`, `data-[state=closed]:animate-out`, `fade-in/out`, `zoom-in/out`, `slide-in-from-*`, accordion height, the `tailwindcss-animate` utilities — these ship for a reason. Leave them as-is.
|
|
95
|
-
- **Custom transitions are fine when they communicate a state change and match shadcn's feel.** Reuse the same vocabulary: short durations (~120–200ms), `ease-out`, opacity/transform only, gated on `data-[state=...]`. Examples that are good and welcome:
|
|
96
|
-
- A portaled custom popover/tooltip/sheet that fades + scales/slides in on `data-[state=delayed-open]` / `data-[state=closed]`, mirroring Radix's own content animation.
|
|
97
|
-
- A list row or toast that fades/slides in on mount and out on dismiss.
|
|
98
|
-
- A chevron/caret `rotate` on expand, a subtle `opacity`/`color` hover on an icon button, skeleton shimmer, a progress/height transition on a collapsible.
|
|
99
|
-
- Continuous, product-defining motion where it _is_ the experience (e.g. a multi-stage booking flow's stage transitions) — fine, and framer-motion is acceptable there.
|
|
100
|
-
- **Avoid decorative, attention-seeking, or slow motion:** hand-rolled `duration-700` hero fade-ins, parallax, bouncing/spring entrances on ordinary content, animated gradients, staggered cascades on long lists, anything that delays the user seeing or acting on content. If an animation makes the UI feel slower, cut it.
|
|
101
|
-
- Rule of thumb: if the motion clarifies what just changed and is over in well under a quarter-second, it's polish; if it's there to look impressive, it's bloat.
|
|
102
|
-
|
|
103
|
-
## Icons
|
|
104
|
-
|
|
105
|
-
- Agent-native apps use `@tabler/icons-react`. Do not add `lucide-react` because a registry example used it.
|
|
106
|
-
- If registry code imports a different icon package, replace those imports with Tabler equivalents before finishing.
|
|
107
|
-
- Let shadcn components size icons through their CSS. Avoid manual icon sizing inside buttons, menus, alerts, and sidebars unless the local component API requires it.
|
|
108
|
-
|
|
109
|
-
## Base-Specific APIs
|
|
110
|
-
|
|
111
|
-
Check the project context before using trigger composition APIs:
|
|
112
|
-
|
|
113
|
-
- Radix-based components use `asChild` for custom triggers.
|
|
114
|
-
- Base UI components may use `render` and sometimes `nativeButton={false}`.
|
|
115
|
-
|
|
116
|
-
Do not wrap triggers in extra divs just to place a Button or Link inside them.
|
|
117
|
-
|
|
118
|
-
## Related Skills
|
|
119
|
-
|
|
120
|
-
- **frontend-design** — Product UX, visual direction, responsive polish, and verification
|
|
121
|
-
- **customizing-agent-native** — Registered design systems, controllers, slots, conformance, and ejection
|
|
122
|
-
- **actions** — Data fetching and mutation patterns for agent-native apps
|
|
123
|
-
- **security** — User data, forms, external input, and action safety
|
|
@@ -1,122 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: upgrade-agent-native
|
|
3
|
-
description: >-
|
|
4
|
-
Bring an older Agent Native app or workspace current. Use when updating
|
|
5
|
-
@agent-native/core, fixing a broken upgrade, or when tempted to patch or
|
|
6
|
-
override core/dispatch packages to make an old branch run.
|
|
7
|
-
scope: dev
|
|
8
|
-
metadata:
|
|
9
|
-
internal: true
|
|
10
|
-
---
|
|
11
|
-
|
|
12
|
-
# Upgrade Agent Native
|
|
13
|
-
|
|
14
|
-
## Rule
|
|
15
|
-
|
|
16
|
-
When an older Agent Native app/branch needs to run on current packages, use
|
|
17
|
-
`agent-native upgrade`. Never "fix" upgrade breakage with
|
|
18
|
-
`pnpm.overrides`, `patchedDependencies`, `resolutions`, local patches, or
|
|
19
|
-
edits under `node_modules/@agent-native/*` — especially not against
|
|
20
|
-
`@agent-native/core` or `@agent-native/dispatch`.
|
|
21
|
-
|
|
22
|
-
## Why
|
|
23
|
-
|
|
24
|
-
Agents often respond to a failed core bump by inventing framework patches and
|
|
25
|
-
dispatch behavior overrides. That hides the real app-level break, drifts from
|
|
26
|
-
upstream, and makes the next upgrade worse. The supported path is bump →
|
|
27
|
-
install → refresh scaffold skills → verify, then fix **app** code only.
|
|
28
|
-
|
|
29
|
-
## How
|
|
30
|
-
|
|
31
|
-
1. **Preview migration codemods first**
|
|
32
|
-
|
|
33
|
-
```bash
|
|
34
|
-
npx @agent-native/core@latest upgrade --codemods
|
|
35
|
-
```
|
|
36
|
-
|
|
37
|
-
Codemods are preview-by-default: read the diff before applying it. Do not
|
|
38
|
-
manually edit imports before running this command; the migration manifest is
|
|
39
|
-
the source of truth for renamed specifiers and symbols.
|
|
40
|
-
|
|
41
|
-
2. **Apply the reviewed codemods, then run the upgrade**
|
|
42
|
-
|
|
43
|
-
```bash
|
|
44
|
-
npx @agent-native/core@latest upgrade --codemods --yes
|
|
45
|
-
npx @agent-native/core@latest upgrade
|
|
46
|
-
```
|
|
47
|
-
|
|
48
|
-
Or from an already-installed CLI: `pnpm exec agent-native upgrade` /
|
|
49
|
-
`agent-native upgrade`.
|
|
50
|
-
|
|
51
|
-
What it does:
|
|
52
|
-
|
|
53
|
-
- Blocks (unless `--force`) when `@agent-native/*` overrides/patches exist
|
|
54
|
-
- Rewrites non-local `@agent-native/*` dependency pins to `latest`
|
|
55
|
-
- Runs the package manager install
|
|
56
|
-
- Runs `skills update scaffold --project`
|
|
57
|
-
- Runs `typecheck` when the project has that script
|
|
58
|
-
|
|
59
|
-
3. **Pull upstream template changes (optional, separate from the bump)**
|
|
60
|
-
|
|
61
|
-
`agent-native upgrade` moves package versions. It never touches files that
|
|
62
|
-
were copied out of a template at scaffold time, so template fixes and
|
|
63
|
-
improvements do not arrive with a bump.
|
|
64
|
-
|
|
65
|
-
```bash
|
|
66
|
-
agent-native template status # recorded ref vs latest, drift counts
|
|
67
|
-
agent-native template diff # what upstream changed, read-only
|
|
68
|
-
agent-native template sync # 3-way merge it into the app
|
|
69
|
-
```
|
|
70
|
-
|
|
71
|
-
`sync` defaults to the ref matching the installed `@agent-native/core`, so
|
|
72
|
-
run it after `upgrade`. It merges per file against a pristine baseline
|
|
73
|
-
stored in `refs/agent-native/template-baseline/<app-path>`; files upstream
|
|
74
|
-
did not touch are left alone, and real collisions get conflict markers.
|
|
75
|
-
After resolving markers, run `agent-native template accept` — the baseline
|
|
76
|
-
deliberately does not advance past an unresolved merge.
|
|
77
|
-
|
|
78
|
-
Apps scaffolded before provenance existed have no baseline. Create one
|
|
79
|
-
with `agent-native template baseline` before the first sync.
|
|
80
|
-
|
|
81
|
-
4. **If upgrade or typecheck fails**
|
|
82
|
-
|
|
83
|
-
- Read the concrete error
|
|
84
|
-
- Fix **app** source, actions, config, or env — not framework packages
|
|
85
|
-
- Re-run `agent-native upgrade` or `pnpm typecheck`
|
|
86
|
-
- Stop and ask the user if you cannot fix the app-level error
|
|
87
|
-
|
|
88
|
-
Intentional app-level UI customization is a separate workflow. Read
|
|
89
|
-
`customizing-agent-native` when the product needs to own a selectively
|
|
90
|
-
copied component; do not use that path to reproduce framework runtime
|
|
91
|
-
behavior or hide version skew.
|
|
92
|
-
|
|
93
|
-
5. **Dry-run / partial runs**
|
|
94
|
-
|
|
95
|
-
```bash
|
|
96
|
-
agent-native upgrade --dry-run
|
|
97
|
-
agent-native upgrade --skip-verify
|
|
98
|
-
agent-native upgrade --skip-install # package.json bumps only
|
|
99
|
-
agent-native doctor --only migration-manifest
|
|
100
|
-
```
|
|
101
|
-
|
|
102
|
-
`migration-manifest` has no opt-out. Run it in CI before upgrading to find
|
|
103
|
-
imports that will break, then use `npx @agent-native/core@latest upgrade --codemods`
|
|
104
|
-
to preview the supported rewrite.
|
|
105
|
-
|
|
106
|
-
## Don't
|
|
107
|
-
|
|
108
|
-
- Don't add `pnpm.overrides`, `overrides`, `resolutions`, or
|
|
109
|
-
`patchedDependencies` for any `@agent-native/*` package
|
|
110
|
-
- Don't edit `node_modules/@agent-native/core` or
|
|
111
|
-
`node_modules/@agent-native/dispatch`
|
|
112
|
-
- Don't invent local "dispatch behavior" shims to paper over version skew
|
|
113
|
-
- Don't keep iterating with more framework patches after a failed install
|
|
114
|
-
- Don't skip `skills update scaffold --project` after a core bump (the
|
|
115
|
-
upgrade command does this for you)
|
|
116
|
-
|
|
117
|
-
## Related Skills
|
|
118
|
-
|
|
119
|
-
- **self-modifying-code** — Tier 4: framework packages are off limits
|
|
120
|
-
- **agent-native-docs** — version-matched docs after the bump
|
|
121
|
-
- **customizing-agent-native** — intentional app-owned UI copies, not upgrade patches
|
|
122
|
-
- **portability** — keep app code provider-agnostic across upgrades
|
|
File without changes
|