@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,169 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: feature-flags
|
|
3
|
-
description: >-
|
|
4
|
-
Declare, evaluate, manage, and remove framework feature flags. Use when
|
|
5
|
-
shipping a capability gradually, targeting users or organizations, or
|
|
6
|
-
replacing a compile-time rollout switch with a production-safe runtime flag.
|
|
7
|
-
scope: dev
|
|
8
|
-
metadata:
|
|
9
|
-
internal: true
|
|
10
|
-
---
|
|
11
|
-
|
|
12
|
-
# Feature Flags
|
|
13
|
-
|
|
14
|
-
A feature flag is a boolean declared in app code, evaluated locally by Core,
|
|
15
|
-
and managed from the Analytics fleet control plane. Code owns whether a flag
|
|
16
|
-
exists. Runtime settings own only its rollout state.
|
|
17
|
-
|
|
18
|
-
Flags let an app deploy dormant code and turn it on in the real environment
|
|
19
|
-
without another deployment. They are not experiments: do not add variants,
|
|
20
|
-
hypotheses, conversion metrics, exposure tracking, or lifecycle states.
|
|
21
|
-
|
|
22
|
-
## When to use one
|
|
23
|
-
|
|
24
|
-
Use a flag for a reversible rollout of a user-facing capability whose dormant
|
|
25
|
-
code is safe to deploy. Flags are useful for production dogfooding, exact-user
|
|
26
|
-
or organization pilots, and deterministic percentage rollouts.
|
|
27
|
-
|
|
28
|
-
Do not use a flag for authentication, authorization, secrets, audit enablement,
|
|
29
|
-
SSR cache behavior, or another security boundary. Client hiding is presentation
|
|
30
|
-
only; every guarded server action must evaluate the same registered flag.
|
|
31
|
-
|
|
32
|
-
## Agent workflow
|
|
33
|
-
|
|
34
|
-
### 1. Declare
|
|
35
|
-
|
|
36
|
-
Keep definitions in a shared TypeScript module so server and client code use the
|
|
37
|
-
same stable key. Flags are boolean and default-off.
|
|
38
|
-
|
|
39
|
-
```ts
|
|
40
|
-
import { defineFeatureFlag } from "@agent-native/core/feature-flags/registry";
|
|
41
|
-
|
|
42
|
-
export const FULL_APP_BUILDING = defineFeatureFlag({
|
|
43
|
-
key: "full-app-building",
|
|
44
|
-
displayName: "Full app building",
|
|
45
|
-
description: "Create and edit Fusion-backed applications.",
|
|
46
|
-
});
|
|
47
|
-
```
|
|
48
|
-
|
|
49
|
-
Keys are immutable, never reused, and contain only letters, numbers, dots,
|
|
50
|
-
underscores, or hyphens. Prefer a concise app-owned name. Do not create flag
|
|
51
|
-
definitions or rollout rows from Analytics.
|
|
52
|
-
|
|
53
|
-
### 2. Register
|
|
54
|
-
|
|
55
|
-
Register app definitions from a Nitro plugin before actions are discovered.
|
|
56
|
-
Do not add app-specific flags to a Core registry.
|
|
57
|
-
|
|
58
|
-
```ts
|
|
59
|
-
import { createFeatureFlagsPlugin } from "@agent-native/core/server";
|
|
60
|
-
|
|
61
|
-
import { FULL_APP_BUILDING } from "../../shared/feature-flags.js";
|
|
62
|
-
|
|
63
|
-
export default createFeatureFlagsPlugin({ flags: [FULL_APP_BUILDING] });
|
|
64
|
-
```
|
|
65
|
-
|
|
66
|
-
### 3. Guard server and client
|
|
67
|
-
|
|
68
|
-
The server action is the enforcement boundary:
|
|
69
|
-
|
|
70
|
-
```ts
|
|
71
|
-
import { isFeatureFlagEnabled } from "@agent-native/core/feature-flags";
|
|
72
|
-
|
|
73
|
-
run: async (args, ctx) => {
|
|
74
|
-
if (!(await isFeatureFlagEnabled(FULL_APP_BUILDING, ctx))) {
|
|
75
|
-
throw new Error("Full app building is not enabled for this account.");
|
|
76
|
-
}
|
|
77
|
-
// guarded operation
|
|
78
|
-
}
|
|
79
|
-
```
|
|
80
|
-
|
|
81
|
-
Use the client hook only to hide or reveal hydrated UI:
|
|
82
|
-
|
|
83
|
-
```tsx
|
|
84
|
-
import { useFeatureFlag } from "@agent-native/core/client/feature-flags";
|
|
85
|
-
|
|
86
|
-
const enabled = useFeatureFlag(FULL_APP_BUILDING.key);
|
|
87
|
-
return enabled ? <FullAppOption /> : null;
|
|
88
|
-
```
|
|
89
|
-
|
|
90
|
-
The client hook intentionally returns false while loading or for an unknown
|
|
91
|
-
flag. Never replace that fail-closed behavior with app-local bucketing or a
|
|
92
|
-
compile-time fallback. Never evaluate personalized flags in the public SSR
|
|
93
|
-
shell; it is shared and cached for every visitor.
|
|
94
|
-
|
|
95
|
-
### 4. Verify and roll out
|
|
96
|
-
|
|
97
|
-
1. Verify the off path before changing rollout state.
|
|
98
|
-
2. Confirm the registered flag appears in **Analytics → Feature flags** for the
|
|
99
|
-
app and is Off by default.
|
|
100
|
-
3. Use **Enable for me** for initial production dogfood.
|
|
101
|
-
4. Expand to exact emails, organization IDs, or a percentage only from
|
|
102
|
-
Analytics.
|
|
103
|
-
5. Confirm the client presentation and authoritative server action agree.
|
|
104
|
-
|
|
105
|
-
## Management contract
|
|
106
|
-
|
|
107
|
-
Core mounts three actions in registered apps:
|
|
108
|
-
|
|
109
|
-
| Action | Purpose |
|
|
110
|
-
| --- | --- |
|
|
111
|
-
| `get-feature-flags` | Return the current caller's evaluated boolean values. |
|
|
112
|
-
| `list-feature-flags` | Return definitions and rollout metadata to an authorized operator. |
|
|
113
|
-
| `set-feature-flag` | Atomically turn a flag off, enable it for the operator, or replace targeting rules. |
|
|
114
|
-
|
|
115
|
-
Analytics calls the app-local operator actions through narrowly scoped A2A
|
|
116
|
-
delegation. Tokens require an exact audience, organization, scope, operator
|
|
117
|
-
role, and audit correlation id. Management is permission-checked and audited
|
|
118
|
-
by the target app. Never manage flags through generic settings routes, raw SQL,
|
|
119
|
-
or per-app toggle UIs.
|
|
120
|
-
|
|
121
|
-
## Rollout semantics
|
|
122
|
-
|
|
123
|
-
The operator modes are **Off**, **Targeted**, and **Everyone**. Core stores them
|
|
124
|
-
as `off`, `rules`, and `on`.
|
|
125
|
-
|
|
126
|
-
Targeted rules combine exact normalized emails, exact organization IDs, and a
|
|
127
|
-
percentage with OR semantics. Exact matches are checked first. Percentage
|
|
128
|
-
buckets use Core's stable hash of the flag key and authenticated user identity;
|
|
129
|
-
anonymous callers fail closed. Raising a percentage preserves the users already
|
|
130
|
-
included at a lower percentage. Do not implement bucketing in app code.
|
|
131
|
-
|
|
132
|
-
Unknown definitions, missing state, malformed state, storage errors, and
|
|
133
|
-
evaluation errors all return the code default (`false` in v1). Explicit Off
|
|
134
|
-
wins over every target; Everyone enables every authenticated caller.
|
|
135
|
-
|
|
136
|
-
## Remove a flag
|
|
137
|
-
|
|
138
|
-
After a rollout is permanent:
|
|
139
|
-
|
|
140
|
-
1. Replace guarded branches with the chosen behavior.
|
|
141
|
-
2. Delete the server and client gates.
|
|
142
|
-
3. Delete the definition and registration entry.
|
|
143
|
-
4. Verify the flag disappears from the Analytics fleet.
|
|
144
|
-
5. Remove stale tests and rollout instructions.
|
|
145
|
-
|
|
146
|
-
A permanent flag is just an if statement with a pension plan.
|
|
147
|
-
|
|
148
|
-
## Verification checklist
|
|
149
|
-
|
|
150
|
-
- Unknown and unregistered keys evaluate false.
|
|
151
|
-
- UI hiding and server enforcement use the same registered key.
|
|
152
|
-
- Exact-user, organization, deterministic percentage, Everyone, and Off paths
|
|
153
|
-
have focused tests.
|
|
154
|
-
- Increasing a percentage is monotonic; anonymous percentage evaluation is off.
|
|
155
|
-
- Unauthorized callers cannot list targeting details or mutate flags.
|
|
156
|
-
- Mutations are atomic, read back stored state, emit refresh, and appear in the
|
|
157
|
-
audit log with the flag key.
|
|
158
|
-
- Analytics represents ready, no-definition, unsupported, forbidden, legacy,
|
|
159
|
-
and unreachable directory apps honestly.
|
|
160
|
-
- Future agents can find this skill from root `AGENTS.md`, and
|
|
161
|
-
`pnpm guard:workspace-skills` passes after syncing generated copies.
|
|
162
|
-
|
|
163
|
-
## Related skills
|
|
164
|
-
|
|
165
|
-
- **adding-a-feature** — preserve UI/action/instruction/application-state parity
|
|
166
|
-
- **actions** — define and call guarded app operations
|
|
167
|
-
- **audit-log** — inspect automatic action mutation history
|
|
168
|
-
- **reliable-mutations** — make rollout changes atomic and provable
|
|
169
|
-
- **security** — keep security controls out of feature flags
|
|
@@ -1,174 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: frontend-design
|
|
3
|
-
description: >-
|
|
4
|
-
Sets the visual direction for a new or redesigned surface, with production
|
|
5
|
-
quality that avoids generic AI aesthetics. Use when building a new page,
|
|
6
|
-
app, or marketing surface, defining visual identity, or doing a design pass
|
|
7
|
-
("make this look good"). Do not load it for routine UI edits: adding a field
|
|
8
|
-
to an existing form, fixing spacing, wiring a button, or changing copy.
|
|
9
|
-
scope: dev
|
|
10
|
-
license: Complete terms in LICENSE.txt
|
|
11
|
-
source: https://github.com/anthropics/skills/blob/main/skills/frontend-design/SKILL.md
|
|
12
|
-
local-changes: >-
|
|
13
|
-
Description narrowed and Verification rescoped deliberately; an upstream sync
|
|
14
|
-
must not restore the broad auto-load triggers or screenshot-everything step.
|
|
15
|
-
metadata:
|
|
16
|
-
internal: true
|
|
17
|
-
---
|
|
18
|
-
|
|
19
|
-
# Frontend Design
|
|
20
|
-
|
|
21
|
-
This skill guides creation of distinctive, production-grade frontend interfaces. Implement real working code with strong product judgment, excellent accessibility, and a clear visual point of view.
|
|
22
|
-
|
|
23
|
-
The user may ask for a component, page, full app, dashboard, marketing surface, or restyle. Before coding, understand the audience and pick a direction that fits the product instead of defaulting to generic SaaS polish.
|
|
24
|
-
|
|
25
|
-
## Design Thinking
|
|
26
|
-
|
|
27
|
-
Before coding, decide:
|
|
28
|
-
|
|
29
|
-
- **Purpose**: What workflow does this surface make easier? What is the primary action?
|
|
30
|
-
- **Audience**: Who will use it repeatedly, and what should feel fast, calm, playful, premium, editorial, technical, or utilitarian?
|
|
31
|
-
- **Tone**: Choose a concrete aesthetic direction: refined minimal, dense operations console, editorial, playful, industrial, warm handmade, high-contrast data tool, etc.
|
|
32
|
-
- **Information hierarchy**: What must be visible in the first five seconds, and what should be progressively disclosed?
|
|
33
|
-
- **Differentiation**: What makes this feel designed for this exact domain?
|
|
34
|
-
|
|
35
|
-
Then implement working code that is cohesive, accessible, responsive, and polished in small details: typography, spacing, copy, motion, empty states, loading states, focus states, and error states.
|
|
36
|
-
|
|
37
|
-
## Minimalism And Progressive Disclosure
|
|
38
|
-
|
|
39
|
-
Default to Apple/Linear-level restraint: make the primary workflow obvious, then remove everything that does not help that workflow right now. A polished UI often has fewer visible controls, fewer borders, fewer labels, and fewer explanatory surfaces than the first reasonable implementation.
|
|
40
|
-
|
|
41
|
-
### Progressive Disclosure Is A Design Requirement
|
|
42
|
-
|
|
43
|
-
Treat an all-at-once interface as a defect to fix during design, not as a
|
|
44
|
-
styling preference. Before coding, inventory every piece of content and action
|
|
45
|
-
on the surface, then assign each one to the smallest useful visibility level:
|
|
46
|
-
|
|
47
|
-
1. **Immediate** — the page title, current state, one primary action, and the
|
|
48
|
-
compact context needed to choose what to do next.
|
|
49
|
-
2. **Expanded** — the details needed for the selected item or active workflow.
|
|
50
|
-
3. **On demand** — advanced settings, diagnostics, credentials, metadata,
|
|
51
|
-
destructive actions, documentation, and rarely used tools.
|
|
52
|
-
|
|
53
|
-
Use single-select accordions or simple disclosure rows for sibling panels when
|
|
54
|
-
the user is choosing one item at a time. Inside an expanded panel, keep another
|
|
55
|
-
layer for independent concerns instead of dumping every form, explanation, and
|
|
56
|
-
secondary action into the first reveal. Prefer one flat panel with alignment,
|
|
57
|
-
dividers, and whitespace over nested cards; provider or product icons should
|
|
58
|
-
not receive decorative borders or containers unless the container communicates
|
|
59
|
-
state or interaction. A collapsed row should still show the item name, status,
|
|
60
|
-
and a concise summary so the user can scan the whole surface without opening
|
|
61
|
-
everything.
|
|
62
|
-
|
|
63
|
-
Before shipping, ask: “What can disappear until the user asks for it?” Then
|
|
64
|
-
verify collapsed, expanded, loading, empty, error, and narrow-width states.
|
|
65
|
-
If the first viewport contains multiple forms, repeated explanatory copy,
|
|
66
|
-
documentation links, and controls for unrelated tasks, the surface has not
|
|
67
|
-
passed this requirement yet.
|
|
68
|
-
|
|
69
|
-
- **Start by subtracting**: Before adding a visible control, banner, toolbar row, card, or explanatory block, ask what can be removed, merged, renamed, or moved into an existing affordance.
|
|
70
|
-
- **One primary action**: Each surface should have one dominant next action. Secondary actions belong in menus, popovers, command palettes, disclosure rows, or contextual hover/focus states unless they are used constantly.
|
|
71
|
-
- **Progressively disclose rare work**: Advanced options, diagnostics, metadata, settings, import/export, destructive actions, and inspection tools should stay tucked away until requested. Prefer small icon triggers with tooltips, popovers, drawers, or detail panels over permanent chrome.
|
|
72
|
-
- **Keep chrome quiet**: Avoid new always-visible bars, badges, callouts, helper text, and counters unless they prevent mistakes or are central to repeated use. Status can often be a dot, ring, muted count, or tooltip.
|
|
73
|
-
- **Favor content over containers**: Do not wrap every section in a card. Use whitespace, alignment, typography, dividers, and full-width bands before adding boxes.
|
|
74
|
-
- **Design for repeated use**: Production app UI should feel calm after the hundredth use. If a control shouts, animates, explains itself, or occupies a full row for an occasional action, hide or compress it.
|
|
75
|
-
- **Make absence intentional**: Empty states should be sparse and action-oriented. Do not fill blank space with marketing copy, decorative art, or lists of features just because the screen feels empty.
|
|
76
|
-
- **Use familiar primitives**: Icon buttons need clear tooltips. Menus, popovers, tabs, switches, and segmented controls should carry complexity instead of exposing every option at once.
|
|
77
|
-
|
|
78
|
-
## Aesthetic Guidelines
|
|
79
|
-
|
|
80
|
-
- **Typography**: Use the product's existing type system first. For net-new public pages, choose characterful but readable type and keep sizing appropriate to the surface.
|
|
81
|
-
- **Color and theme**: Use semantic tokens and CSS variables. Avoid one-note palettes and default purple/blue gradients unless the brand demands them.
|
|
82
|
-
- **Motion**: Prefer purposeful transitions and small state changes. Use CSS transitions/keyframes unless the app already uses a motion library. Never `transition-all` — list the properties that actually change (e.g. `transition-[opacity,transform]`). Use the shared easing tokens defined in `packages/core/src/styles/agent-native.css` instead of hand-typing curves: `var(--ease-drawer)` (260ms, drawers/app chrome), `var(--ease-collapse)` (200ms, expand/collapse), `var(--ease-out-strong)` (snappy entrances) — in Tailwind, `ease-[var(--ease-collapse)]`. Enter/exit with ease-out, never `ease-in`. Overlays that zoom in must set the Radix origin var (e.g. `origin-[--radix-popover-content-transform-origin]`). Animate `transform`/`opacity`, not width/height/padding/box-shadow. Gate looping or large-movement animations with `motion-reduce:`. Command palettes and keyboard-triggered actions get no animation.
|
|
83
|
-
- **Composition**: Match the workflow. Operational apps should be dense and scannable; marketing or portfolio pages can be more immersive.
|
|
84
|
-
- **Visual assets**: Websites, games, and object-focused pages need real or generated media when images help users understand the subject.
|
|
85
|
-
- **Responsive fit**: Text must not overflow buttons, cards, tabs, sidebars, or fixed-format tools. Use stable dimensions for boards, grids, toolbars, and counters.
|
|
86
|
-
|
|
87
|
-
**Beat convergence, not just defaults.** You sample toward the "on-distribution" center, so naming what to avoid is not enough: every "don't" needs a "do", or you converge on the next safe option (ban Inter and you reach for Roboto; ban purple gradients and you reach for Space Grotesk + a teal accent on every screen). Commit to one named direction, pair any reference with the reason it fits ("Linear: the quiet confidence of its spacing" — a bare "Linear" collapses back to the average), and match implementation effort to the vision: maximalist wants elaborate motion and effects, minimal wants restraint and precise spacing. When building on an existing app, inspect its tokens/type/components first and treat any drift back to a default as a missing token to pin, not something to re-prompt.
|
|
88
|
-
|
|
89
|
-
## Agent-Native UI Rules
|
|
90
|
-
|
|
91
|
-
- Agent-native apps use React and Vite. The default adapter uses Tailwind CSS,
|
|
92
|
-
shadcn/ui, and `@tabler/icons-react`, but an app may register a different
|
|
93
|
-
company design system in `app/design-system.ts`.
|
|
94
|
-
- **Use the app's design-system seam for standard UI.** Inspect
|
|
95
|
-
`app/design-system.ts`, `ToolkitProvider`, and the local UI adapter directory
|
|
96
|
-
before choosing a primitive. Use shadcn primitives when they are the active
|
|
97
|
-
adapter; use the registered company components when they are not.
|
|
98
|
-
- **When touching shadcn/ui components, also read `shadcn-ui` if it exists.** That skill covers `components.json`, CLI docs, component composition, theming, and registry workflows.
|
|
99
|
-
- Check `app/components/ui/` before importing a shadcn component. If a primitive is missing, add it from the app root with `pnpm dlx shadcn@latest add <component>`, then review the generated file.
|
|
100
|
-
- Pages, routes, and domain components must import controls through the app's
|
|
101
|
-
local adapter path, usually `@/components/ui/*`. Never import
|
|
102
|
-
`@agent-native/toolkit/ui/*` directly in app product code.
|
|
103
|
-
- Toolkit/Core feature presentation flows through the semantic components from
|
|
104
|
-
`@agent-native/toolkit/design-system`. Their props express intent, emphasis,
|
|
105
|
-
size, controlled values, and behavior; they do not require Tailwind, CVA, or
|
|
106
|
-
`className`.
|
|
107
|
-
- For deeper feature customization, consume the feature-level headless
|
|
108
|
-
controller through its product render slot. The same controller must power
|
|
109
|
-
the default and custom views. Eject the smallest supported unit only after
|
|
110
|
-
tokens, semantic components, controllers, and slots are insufficient.
|
|
111
|
-
- Do not build custom dropdowns, menus, popovers, modals, or confirmations with manual absolute positioning and click-outside effects.
|
|
112
|
-
- Never use browser dialogs (`window.alert`, `window.confirm`, `window.prompt`). Use `AlertDialog`, `Dialog`, or app-specific confirmation UI.
|
|
113
|
-
- Use Tabler icons for all first-party UI icons. Do not add Lucide, Heroicons, inline SVG icon sets, or emoji icons.
|
|
114
|
-
- Use `useActionQuery` and `useActionMutation` from `@agent-native/core/client` for action-backed UI. Standard CRUD should go through actions, not custom `/api/` routes.
|
|
115
|
-
- Keep UI optimistic where possible: update cache and navigation immediately, then reconcile or roll back on mutation result.
|
|
116
|
-
- Custom styles belong in Tailwind classes, component CSS, or the existing global CSS theme file; avoid inline styles.
|
|
117
|
-
|
|
118
|
-
## shadcn/ui Design Rules
|
|
119
|
-
|
|
120
|
-
- Use built-in component variants first (`variant`, `size`) before overriding classes.
|
|
121
|
-
- Use semantic tokens (`bg-background`, `text-muted-foreground`, `border-border`, `bg-primary`) instead of raw Tailwind colors for app chrome and reusable components.
|
|
122
|
-
- Use `gap-*` in flex/grid layouts instead of `space-x-*` or `space-y-*`.
|
|
123
|
-
- Use `size-*` when width and height are equal, and `truncate` instead of spelling out overflow/ellipsis/nowrap.
|
|
124
|
-
- Use `cn()` from the local utils alias for conditional classes.
|
|
125
|
-
- Dialog, Sheet, Drawer, and AlertDialog content must have an accessible title. Use `sr-only` only when the visible design already communicates the title.
|
|
126
|
-
- Put menu/list items inside their group primitives: `SelectGroup`, `DropdownMenuGroup`, `CommandGroup`, and equivalents.
|
|
127
|
-
- Use full `Card` composition when the content has a title, description, content, or actions. Do not dump complex cards into a single `CardContent`.
|
|
128
|
-
- Use `ToggleGroup` for small option sets, `Switch` for binary settings, `Checkbox` for multi-select, `RadioGroup` for one-of-many, and `Slider`/inputs for numeric values.
|
|
129
|
-
- For forms, prefer the app's existing shadcn form pattern. If newer `Field`, `FieldGroup`, or `InputGroup` primitives are installed or appropriate to add, use them instead of raw layout divs.
|
|
130
|
-
- Loading states use `Skeleton`, `Progress`, `Spinner`, or the app's existing loading primitives. Empty states should have one clear next action.
|
|
131
|
-
|
|
132
|
-
## Anti-Patterns
|
|
133
|
-
|
|
134
|
-
Avoid:
|
|
135
|
-
|
|
136
|
-
- Generic AI aesthetics: purple gradients, glassy cards everywhere, vague sparkle language, decorative blobs, and context-free hero sections.
|
|
137
|
-
- Custom reimplementations of shadcn primitives.
|
|
138
|
-
- Raw color overrides on shared components when semantic tokens or variants would work.
|
|
139
|
-
- New always-visible controls for rare actions. Prefer menus, popovers, sheets, tabs, collapsibles, or advanced sections.
|
|
140
|
-
- Full-width banners, persistent helper rows, decorative cards, or explanatory chrome for status that could be a compact affordance.
|
|
141
|
-
- Treating progressive disclosure as optional. If a control is not part of the main daily workflow, hide it until context, hover, focus, or explicit user intent makes it relevant.
|
|
142
|
-
- UI cards nested inside other cards.
|
|
143
|
-
- Text or icons that resize or shift fixed-format UI on hover/loading.
|
|
144
|
-
|
|
145
|
-
## Verification
|
|
146
|
-
|
|
147
|
-
Match verification effort to the size of the change. For one component, one
|
|
148
|
-
form, one page, or a restyle, run the app's existing checks — formatter,
|
|
149
|
-
`pnpm typecheck`, existing tests — and stop there.
|
|
150
|
-
|
|
151
|
-
Escalate to browser verification only when the user asks for it, or when the
|
|
152
|
-
change is a multi-step user-visible flow that cannot be confirmed any other
|
|
153
|
-
way. Never author a new Playwright/Puppeteer script, add a browser-automation
|
|
154
|
-
dependency, or stand up an e2e harness to check work the user did not ask you
|
|
155
|
-
to test that way; use an available browser tool, or say what you could not
|
|
156
|
-
verify.
|
|
157
|
-
|
|
158
|
-
For substantial frontend work:
|
|
159
|
-
|
|
160
|
-
1. Run the relevant formatter/checks.
|
|
161
|
-
2. Start the dev server when the app needs one.
|
|
162
|
-
3. Verify with the available browser tooling at desktop and mobile widths.
|
|
163
|
-
4. Check interactive states: hover, focus, loading, empty, error, and destructive confirmations.
|
|
164
|
-
5. When registering or changing a company adapter, run
|
|
165
|
-
`@agent-native/toolkit/conformance`, including mixed-overlay focus,
|
|
166
|
-
`portalContainer`, and z-index stacking checks.
|
|
167
|
-
|
|
168
|
-
## Related Skills
|
|
169
|
-
|
|
170
|
-
- **shadcn-ui** — shadcn CLI, component docs, composition rules, theming, and registries
|
|
171
|
-
- **customizing-agent-native** — Design-system registration, feature controllers, product slots, conformance, and ejection
|
|
172
|
-
- **self-modifying-code** — The agent can edit source code to apply design changes
|
|
173
|
-
- **storing-data** — All data lives in SQL; use actions for data access
|
|
174
|
-
- **actions** — `useActionQuery`/`useActionMutation` hooks for frontend data fetching
|
|
@@ -1,232 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: real-time-sync
|
|
3
|
-
description: >-
|
|
4
|
-
How to keep the UI in sync with agent changes via SSE plus polling fallback.
|
|
5
|
-
Use when wiring query invalidation for new data models, debugging UI not
|
|
6
|
-
updating, or understanding jitter prevention.
|
|
7
|
-
scope: dev
|
|
8
|
-
metadata:
|
|
9
|
-
internal: true
|
|
10
|
-
---
|
|
11
|
-
|
|
12
|
-
# Real-Time Sync
|
|
13
|
-
|
|
14
|
-
## Rule
|
|
15
|
-
|
|
16
|
-
The UI stays in sync with agent/script changes through `useDbSync()`. In-process writes stream over `/_agent-native/events` first; `/_agent-native/poll` remains the cross-process/serverless fallback. When the agent writes to the database, the UI detects the change and updates automatically — no manual refresh needed.
|
|
17
|
-
|
|
18
|
-
## Why
|
|
19
|
-
|
|
20
|
-
The agent modifies data in SQL, but the UI runs in the browser. SSE bridges same-process writes immediately; polling bridges anything SSE cannot see, such as another serverless invocation, cron job, or external script. Every visible write increments a version counter, `useDbSync()` receives the change, and React Query invalidates the relevant caches. This is what makes database writes feel real-time without relying on aggressive polling.
|
|
21
|
-
|
|
22
|
-
## How It Works
|
|
23
|
-
|
|
24
|
-
1. **Server** increments a version counter on every database write. In-process events stream through the authenticated `/_agent-native/events` endpoint.
|
|
25
|
-
|
|
26
|
-
2. **Client** listens for sync events and updates per-source change counters:
|
|
27
|
-
|
|
28
|
-
```ts
|
|
29
|
-
import { useDbSync } from "@agent-native/core/client/hooks";
|
|
30
|
-
useDbSync({ queryClient });
|
|
31
|
-
```
|
|
32
|
-
|
|
33
|
-
For each non-own event, `useDbSync` bumps a per-source counter (e.g. `dashboards`, `analyses`, `settings`, `action`) and invalidates a small fixed list of framework-internal prefixes (`["action"]`, `["app-state"]`, `["__set_url__"]`, etc.). It does **not** blanket-invalidate templates' own data queries — that caused request storms in production. A successful mutating action refreshes active `useActionQuery` observers under the `["action"]` prefix. Browser actions carry a tab id so their originating tab ignores the sync echo while other tabs refresh. Legacy apps can opt into broader compatibility with `actionInvalidatePredicate`, but first-party apps should use action-backed or source-versioned query keys. Idle fallback polling runs once per minute; active agent work temporarily uses the faster cadence.
|
|
34
|
-
|
|
35
|
-
3. **Templates fold per-source counters into their query keys.** This is the pattern that makes "agent writes show up without a manual refresh" reliable:
|
|
36
|
-
|
|
37
|
-
```ts
|
|
38
|
-
import { useChangeVersion } from "@agent-native/core/client/hooks";
|
|
39
|
-
import { useQuery } from "@tanstack/react-query";
|
|
40
|
-
|
|
41
|
-
const v = useChangeVersion("dashboards");
|
|
42
|
-
const dashboard = useQuery({
|
|
43
|
-
queryKey: ["dashboard", id, v],
|
|
44
|
-
queryFn: () => fetchDashboard(id),
|
|
45
|
-
placeholderData: (prev) => prev, // no flicker on refetch
|
|
46
|
-
});
|
|
47
|
-
```
|
|
48
|
-
|
|
49
|
-
When the agent writes (`update-dashboard` action → server emits `source: "dashboards"`), the counter advances, the queryKey changes, and React Query refetches that one query. The old data stays on screen during the refetch thanks to `placeholderData`.
|
|
50
|
-
|
|
51
|
-
For list/sidebar queries, use the same pattern — pass the counter into the queryKey of every list query you want to keep fresh.
|
|
52
|
-
|
|
53
|
-
4. **Fallback** polling calls `/_agent-native/poll?since=N`. It runs every 2 seconds until SSE is connected, then relaxes to 15 seconds (`SSE_FALLBACK_INTERVAL_MS`). If SSE is disabled or unavailable (e.g., edge/serverless deployments), polling continues at the 2 s cadence. Polling is the universal serverless fallback: new framework writes are read from the durable `sync_events` log, while the older DB timestamp scan remains as a slower safety net for direct SQL writes and older processes.
|
|
54
|
-
|
|
55
|
-
5. When the agent writes to the database, the version increments, SSE/polling detects it, and React Query refetches the affected queries.
|
|
56
|
-
|
|
57
|
-
## Don't
|
|
58
|
-
|
|
59
|
-
- Don't create manual polling loops — `useDbSync()` handles SSE plus fallback polling
|
|
60
|
-
- Don't create your own fetch-based polling alongside `useDbSync` — use the `onEvent` callback for custom handling
|
|
61
|
-
- Don't open your own `EventSource` to `/_agent-native/events`. A tab must hold exactly ONE SSE connection no matter how many features listen — extra streams eat the browser's per-origin connection budget and can starve ordinary data fetches (worst on HTTP/1.1 dev servers). Subscribe to the shared transport instead:
|
|
62
|
-
|
|
63
|
-
```ts
|
|
64
|
-
import { subscribeSyncEvents } from "@agent-native/core/client/hooks";
|
|
65
|
-
|
|
66
|
-
const unsubscribe = subscribeSyncEvents({
|
|
67
|
-
onEvents: (events) => {
|
|
68
|
-
// filter by event.source and handle push-style updates
|
|
69
|
-
},
|
|
70
|
-
// Optional: relax your own fallback cadence while push is healthy.
|
|
71
|
-
onSseStateChange: (connected) => {},
|
|
72
|
-
});
|
|
73
|
-
```
|
|
74
|
-
|
|
75
|
-
`useDbSync` and every `subscribeSyncEvents` subscriber share one `EventSource` and one fallback poll loop per tab — this is how collaborative documents receive doc updates and cursor/awareness events. Hidden tabs keep that shared transport alive by default: SSE stays connected and active fallback polling relaxes to a 10-second floor (idle polling remains once per minute). Pass `pauseWhenHidden: true` only for a consumer that explicitly must stop all hidden-tab sync.
|
|
76
|
-
|
|
77
|
-
## Which sources to depend on
|
|
78
|
-
|
|
79
|
-
Common sources you'll fold into query keys:
|
|
80
|
-
|
|
81
|
-
| Source | Bumped by |
|
|
82
|
-
| ----------------- | --------------------------------------------------------------------------- |
|
|
83
|
-
| `action` | The agent runner after every successful mutating action tool call |
|
|
84
|
-
| `app-state` | Writes to `application_state` (navigation, selections, ephemeral UI state) |
|
|
85
|
-
| `settings` | Writes to the `settings` table |
|
|
86
|
-
| `dashboards` | Dashboard CRUD via `upsertDashboard` / `archiveDashboard` etc. |
|
|
87
|
-
| `analyses` | Analysis CRUD |
|
|
88
|
-
| `extensions` | Extension CRUD |
|
|
89
|
-
| `collab` | Yjs collaborative-doc updates |
|
|
90
|
-
| `screen-refresh` | Explicit `refresh-screen` agent tool call |
|
|
91
|
-
|
|
92
|
-
If a query reads data the agent can mutate via more than one path, depend on multiple sources with `useChangeVersions`:
|
|
93
|
-
|
|
94
|
-
```ts
|
|
95
|
-
const v = useChangeVersions(["dashboards", "action"]);
|
|
96
|
-
useQuery({ queryKey: ["dashboard", id, v], ... });
|
|
97
|
-
```
|
|
98
|
-
|
|
99
|
-
`useChangeVersions` returns a single integer that advances whenever any of the listed sources advance.
|
|
100
|
-
|
|
101
|
-
## Tuning refetch behavior
|
|
102
|
-
|
|
103
|
-
To prevent cache thrashing during rapid agent writes, set `staleTime` on your queries:
|
|
104
|
-
|
|
105
|
-
```ts
|
|
106
|
-
useQuery({
|
|
107
|
-
queryKey: ["items"],
|
|
108
|
-
queryFn: fetchItems,
|
|
109
|
-
staleTime: 2000, // don't refetch within 2 seconds
|
|
110
|
-
});
|
|
111
|
-
```
|
|
112
|
-
|
|
113
|
-
## Troubleshooting
|
|
114
|
-
|
|
115
|
-
| Symptom | Check |
|
|
116
|
-
| ---------------------------------- | -------------------------------------------------------------------------------------------------------------- |
|
|
117
|
-
| UI not updating after agent writes | Is `useDbSync` called with the correct `queryClient`? Does the affected query have an active observer? |
|
|
118
|
-
| Poll endpoint not responding | Is `/_agent-native/poll` accessible? Is the server running? |
|
|
119
|
-
| SSE not connecting | Is `/_agent-native/events` accessible and authenticated? Polling should still keep the UI fresh as fallback. |
|
|
120
|
-
| High CPU / event storms | Use targeted source keys, settle bursty list counters, and avoid broad action invalidation. |
|
|
121
|
-
|
|
122
|
-
## Jitter Prevention
|
|
123
|
-
|
|
124
|
-
When the agent writes to application-state via script helpers (`writeAppState`, `deleteAppState`), the write is automatically tagged with `requestSource: "agent"`. This prevents the UI from overwriting active user edits when it receives the change event.
|
|
125
|
-
|
|
126
|
-
### How it works
|
|
127
|
-
|
|
128
|
-
1. **Agent writes** are tagged: the script helpers in `@agent-native/core/application-state` pass `{ requestSource: "agent" }` to the store.
|
|
129
|
-
2. **UI writes** are tagged: templates send a per-tab ID via the `X-Request-Source` header on PUT/DELETE requests to application-state endpoints.
|
|
130
|
-
3. **Sync filters**: `useDbSync()` accepts an `ignoreSource` option. The UI passes its own tab ID so it ignores events from its own writes — but still picks up events from agents, other tabs, and scripts.
|
|
131
|
-
|
|
132
|
-
### Template setup
|
|
133
|
-
|
|
134
|
-
```ts
|
|
135
|
-
// app/lib/tab-id.ts
|
|
136
|
-
export const TAB_ID = `tab-${Math.random().toString(36).slice(2, 8)}`;
|
|
137
|
-
|
|
138
|
-
// app/root.tsx
|
|
139
|
-
import { TAB_ID } from "@/lib/tab-id";
|
|
140
|
-
|
|
141
|
-
useDbSync({
|
|
142
|
-
queryClient,
|
|
143
|
-
ignoreSource: TAB_ID,
|
|
144
|
-
});
|
|
145
|
-
```
|
|
146
|
-
|
|
147
|
-
The `use-navigation-state.ts` hook sends the same `TAB_ID` in the `X-Request-Source` header when writing navigation state, so the tab that wrote the state does not refetch it.
|
|
148
|
-
|
|
149
|
-
### Why this matters
|
|
150
|
-
|
|
151
|
-
Without jitter prevention, a cycle occurs: the UI writes state, sync detects the change, the UI refetches and re-renders, potentially overwriting what the user is actively editing. With `ignoreSource`, the UI only reacts to changes from other sources (agent scripts, other browser tabs, other users).
|
|
152
|
-
|
|
153
|
-
## Action Routes and Live Sync
|
|
154
|
-
|
|
155
|
-
Actions work with the same sync system. When a mutating action writes to the database, the version counter increments and `useDbSync` picks up the change. Frontend mutations via `useActionMutation` automatically invalidate `["action"]` query keys on success, triggering refetches of `useActionQuery` hooks. Client components should call actions through those hooks, not with raw action-route fetches.
|
|
156
|
-
|
|
157
|
-
For custom apps, the best out-of-the-box path is:
|
|
158
|
-
|
|
159
|
-
1. Put read actions in `actions/` with `defineAction({ http: { method: "GET" } })`.
|
|
160
|
-
2. Put write actions in `actions/` with the default POST/PUT/DELETE behavior.
|
|
161
|
-
3. Call reads from React with `useActionQuery` and writes with `useActionMutation`.
|
|
162
|
-
|
|
163
|
-
This avoids duplicate `/api/*` JSON CRUD routes and makes agent-created records show up automatically. Raw `useQuery` can still work, but it should include `useChangeVersions(["action", "<domain-source>"])` in the query key for targeted refreshes.
|
|
164
|
-
|
|
165
|
-
### Auto-emit on mutating actions
|
|
166
|
-
|
|
167
|
-
The framework emits a change event with `source: "action"` whenever any non-read-only action runs to completion — whether called via HTTP (`/_agent-native/actions/:name`) or as an agent tool call. Read-only actions (`http: { method: "GET" }` or explicit `readOnly: true`) are skipped.
|
|
168
|
-
|
|
169
|
-
This means UIs don't need the agent to remember to call `refresh-screen` after every mutation. A listener like this (used in the `macros` template) will refresh after any mutating agent call:
|
|
170
|
-
|
|
171
|
-
```ts
|
|
172
|
-
useDbSync({
|
|
173
|
-
queryClient,
|
|
174
|
-
ignoreSource: TAB_ID,
|
|
175
|
-
onEvent: (data) => {
|
|
176
|
-
if (data.requestSource === TAB_ID) return;
|
|
177
|
-
// Invalidate all useActionQuery caches so list-*, get-*, etc. refetch
|
|
178
|
-
queryClient.invalidateQueries({ queryKey: ["action"] });
|
|
179
|
-
},
|
|
180
|
-
});
|
|
181
|
-
```
|
|
182
|
-
|
|
183
|
-
`refresh-screen` remains available for unusual cases — e.g. the agent mutated data via a path the framework can't see (external system the app mirrors), or the agent wants to pass a `scope` hint for narrower invalidation.
|
|
184
|
-
|
|
185
|
-
## Keeping Stateful Components In Sync
|
|
186
|
-
|
|
187
|
-
The `useChangeVersion` / `useActionQuery` pattern above keeps the **query layer** fresh. But components that copy a server value into local React state still go stale on agent edits — refetching the query updates the prop, yet the local copy never re-adopts it. This is a recurring bug.
|
|
188
|
-
|
|
189
|
-
**Never do this** for a value the agent can mutate:
|
|
190
|
-
|
|
191
|
-
```ts
|
|
192
|
-
// BUG: `title` is captured once and never re-reads the prop.
|
|
193
|
-
const [title, setTitle] = useState(props.title);
|
|
194
|
-
```
|
|
195
|
-
|
|
196
|
-
When the agent renames the record, the query refetches, `props.title` updates, but the input still shows the stale value until the component remounts.
|
|
197
|
-
|
|
198
|
-
**Derived-state surfaces (form fields, inline editors, popovers): use `useReconciledState`.** It re-adopts the authoritative external value when it changes, except while the user is actively editing that field — so agent mutations show up live without clobbering in-progress typing:
|
|
199
|
-
|
|
200
|
-
```ts
|
|
201
|
-
import { useReconciledState } from "@agent-native/core/client/hooks";
|
|
202
|
-
|
|
203
|
-
// `active` = true while the user is editing this field (focused / dirty).
|
|
204
|
-
const [title, setTitle] = useReconciledState(props.title, { active: isEditing });
|
|
205
|
-
```
|
|
206
|
-
|
|
207
|
-
**Collaborative rich-text editors are different** — they don't copy a value into `useState`. They reconcile authoritative SQL content into a shared Y.Doc under an `updatedAt` gate with lead-client election. See `real-time-collab` → "Agent edits as a real-time peer editor". Don't reach for `useReconciledState` for a Yjs-backed editor.
|
|
208
|
-
|
|
209
|
-
| Surface | Keep it fresh with |
|
|
210
|
-
| ------- | ------------------ |
|
|
211
|
-
| React Query reads | `useChangeVersion` / `useActionQuery` (above) |
|
|
212
|
-
| Local edit state copied from a server value (inputs, popovers, inline editors) | `useReconciledState(externalValue, { active })` |
|
|
213
|
-
| Collaborative rich-text editor (Yjs) | `updatedAt`-gated reconcile + `isReconcileLeadClient` — see `real-time-collab` |
|
|
214
|
-
|
|
215
|
-
## Granular server-side merge for non-body fields
|
|
216
|
-
|
|
217
|
-
For structured documents (slide decks, form builders, design files) where the
|
|
218
|
-
Yjs body collab would cause LWW conflicts at the container level, pair the
|
|
219
|
-
change-sync `updatedAt` bump with a **granular server-side merge action** that
|
|
220
|
-
accepts targeted per-item operations (add/patch/delete/reorder). Concurrent
|
|
221
|
-
edits to different items both survive at the action level; the `collab` source
|
|
222
|
-
version bump then propagates the merged state to all open clients. See
|
|
223
|
-
`real-time-collab` for the pattern and examples.
|
|
224
|
-
|
|
225
|
-
## Related Skills
|
|
226
|
-
|
|
227
|
-
- **storing-data** — Application-state and settings are data stores that sync through change events
|
|
228
|
-
- **context-awareness** — Navigation state writes use jitter prevention to avoid overwriting active edits
|
|
229
|
-
- **actions** — Mutating actions trigger change events
|
|
230
|
-
- **client-methods** — Route details belong in helpers/hooks, not components
|
|
231
|
-
- **self-modifying-code** — Agent code edits trigger change events; rapid edits can cause event storms
|
|
232
|
-
- **real-time-collab** — Collaborative editors reconcile agent edits into a shared Y.Doc, driven by the same change-sync `updatedAt` bump; also the granular server-side merge pattern for structured data
|