@agent-native/core 0.4.5 → 0.5.0-dev.b51eaae
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/dist/a2a/client.d.ts +7 -0
- package/dist/a2a/client.d.ts.map +1 -1
- package/dist/a2a/client.js +24 -3
- package/dist/a2a/client.js.map +1 -1
- package/dist/a2a/handlers.d.ts +6 -3
- package/dist/a2a/handlers.d.ts.map +1 -1
- package/dist/a2a/handlers.js +45 -39
- package/dist/a2a/handlers.js.map +1 -1
- package/dist/a2a/index.d.ts +1 -1
- package/dist/a2a/index.d.ts.map +1 -1
- package/dist/a2a/index.js +2 -2
- package/dist/a2a/index.js.map +1 -1
- package/dist/a2a/server.d.ts +7 -2
- package/dist/a2a/server.d.ts.map +1 -1
- package/dist/a2a/server.js +54 -14
- package/dist/a2a/server.js.map +1 -1
- package/dist/a2a/task-store.d.ts +6 -6
- package/dist/a2a/task-store.d.ts.map +1 -1
- package/dist/a2a/task-store.js +102 -42
- package/dist/a2a/task-store.js.map +1 -1
- package/dist/a2a/types.d.ts +2 -0
- package/dist/a2a/types.d.ts.map +1 -1
- package/dist/action.d.ts +46 -0
- package/dist/action.d.ts.map +1 -0
- package/dist/action.js +35 -0
- package/dist/action.js.map +1 -0
- package/dist/adapters/sync/file-sync.js +1 -1
- package/dist/agent/index.d.ts +2 -2
- package/dist/agent/index.d.ts.map +1 -1
- package/dist/agent/index.js.map +1 -1
- package/dist/agent/production-agent.d.ts +22 -6
- package/dist/agent/production-agent.d.ts.map +1 -1
- package/dist/agent/production-agent.js +336 -123
- package/dist/agent/production-agent.js.map +1 -1
- package/dist/agent/run-manager.d.ts +43 -0
- package/dist/agent/run-manager.d.ts.map +1 -0
- package/dist/agent/run-manager.js +358 -0
- package/dist/agent/run-manager.js.map +1 -0
- package/dist/agent/run-store.d.ts +26 -0
- package/dist/agent/run-store.d.ts.map +1 -0
- package/dist/agent/run-store.js +145 -0
- package/dist/agent/run-store.js.map +1 -0
- package/dist/agent/thread-data-builder.d.ts +30 -0
- package/dist/agent/thread-data-builder.d.ts.map +1 -0
- package/dist/agent/thread-data-builder.js +88 -0
- package/dist/agent/thread-data-builder.js.map +1 -0
- package/dist/agent/types.d.ts +52 -1
- package/dist/agent/types.d.ts.map +1 -1
- package/dist/application-state/emitter.d.ts +3 -2
- package/dist/application-state/emitter.d.ts.map +1 -1
- package/dist/application-state/emitter.js +14 -4
- package/dist/application-state/emitter.js.map +1 -1
- package/dist/application-state/handlers.d.ts.map +1 -1
- package/dist/application-state/handlers.js +13 -16
- package/dist/application-state/handlers.js.map +1 -1
- package/dist/application-state/script-helpers.d.ts +1 -1
- package/dist/application-state/script-helpers.d.ts.map +1 -1
- package/dist/application-state/script-helpers.js +15 -5
- package/dist/application-state/script-helpers.js.map +1 -1
- package/dist/application-state/store.d.ts +4 -3
- package/dist/application-state/store.d.ts.map +1 -1
- package/dist/application-state/store.js +31 -59
- package/dist/application-state/store.js.map +1 -1
- package/dist/chat-threads/emitter.d.ts +9 -0
- package/dist/chat-threads/emitter.d.ts.map +1 -0
- package/dist/chat-threads/emitter.js +14 -0
- package/dist/chat-threads/emitter.js.map +1 -0
- package/dist/chat-threads/store.d.ts +28 -0
- package/dist/chat-threads/store.d.ts.map +1 -0
- package/dist/chat-threads/store.js +124 -0
- package/dist/chat-threads/store.js.map +1 -0
- package/dist/cli/create.d.ts.map +1 -1
- package/dist/cli/create.js +4 -18
- package/dist/cli/create.js.map +1 -1
- package/dist/cli/index.js +30 -3
- package/dist/cli/index.js.map +1 -1
- package/dist/cli/setup-agents.d.ts +11 -0
- package/dist/cli/setup-agents.d.ts.map +1 -0
- package/dist/cli/setup-agents.js +123 -0
- package/dist/cli/setup-agents.js.map +1 -0
- package/dist/client/AgentPanel.d.ts +9 -2
- package/dist/client/AgentPanel.d.ts.map +1 -1
- package/dist/client/AgentPanel.js +466 -29
- package/dist/client/AgentPanel.js.map +1 -1
- package/dist/client/AssistantChat.d.ts +25 -3
- package/dist/client/AssistantChat.d.ts.map +1 -1
- package/dist/client/AssistantChat.js +613 -83
- package/dist/client/AssistantChat.js.map +1 -1
- package/dist/client/ClientOnly.d.ts +14 -0
- package/dist/client/ClientOnly.d.ts.map +1 -0
- package/dist/client/ClientOnly.js +17 -0
- package/dist/client/ClientOnly.js.map +1 -0
- package/dist/client/CommandMenu.d.ts +71 -0
- package/dist/client/CommandMenu.d.ts.map +1 -0
- package/dist/client/CommandMenu.js +257 -0
- package/dist/client/CommandMenu.js.map +1 -0
- package/dist/client/DefaultSpinner.d.ts +7 -0
- package/dist/client/DefaultSpinner.d.ts.map +1 -0
- package/dist/client/DefaultSpinner.js +28 -0
- package/dist/client/DefaultSpinner.js.map +1 -0
- package/dist/client/MultiTabAssistantChat.d.ts +34 -2
- package/dist/client/MultiTabAssistantChat.d.ts.map +1 -1
- package/dist/client/MultiTabAssistantChat.js +346 -57
- package/dist/client/MultiTabAssistantChat.js.map +1 -1
- package/dist/client/PoweredByBadge.d.ts.map +1 -1
- package/dist/client/PoweredByBadge.js +2 -1
- package/dist/client/PoweredByBadge.js.map +1 -1
- package/dist/client/active-run-state.d.ts +10 -0
- package/dist/client/active-run-state.d.ts.map +1 -0
- package/dist/client/active-run-state.js +32 -0
- package/dist/client/active-run-state.js.map +1 -0
- package/dist/client/agent-chat-adapter.d.ts +2 -1
- package/dist/client/agent-chat-adapter.d.ts.map +1 -1
- package/dist/client/agent-chat-adapter.js +83 -129
- package/dist/client/agent-chat-adapter.js.map +1 -1
- package/dist/client/agent-chat.js +2 -2
- package/dist/client/agent-chat.js.map +1 -1
- package/dist/client/components/ApiKeySettings.d.ts +2 -2
- package/dist/client/components/ApiKeySettings.js +4 -4
- package/dist/client/components/ApiKeySettings.js.map +1 -1
- package/dist/client/components/CodeRequiredDialog.d.ts.map +1 -1
- package/dist/client/components/CodeRequiredDialog.js +4 -3
- package/dist/client/components/CodeRequiredDialog.js.map +1 -1
- package/dist/client/composer/MentionPopover.d.ts +26 -0
- package/dist/client/composer/MentionPopover.d.ts.map +1 -0
- package/dist/client/composer/MentionPopover.js +130 -0
- package/dist/client/composer/MentionPopover.js.map +1 -0
- package/dist/client/composer/TiptapComposer.d.ts +19 -0
- package/dist/client/composer/TiptapComposer.d.ts.map +1 -0
- package/dist/client/composer/TiptapComposer.js +415 -0
- package/dist/client/composer/TiptapComposer.js.map +1 -0
- package/dist/client/composer/extensions/FileReference.d.ts +3 -0
- package/dist/client/composer/extensions/FileReference.d.ts.map +1 -0
- package/dist/client/composer/extensions/FileReference.js +36 -0
- package/dist/client/composer/extensions/FileReference.js.map +1 -0
- package/dist/client/composer/extensions/MentionReference.d.ts +3 -0
- package/dist/client/composer/extensions/MentionReference.d.ts.map +1 -0
- package/dist/client/composer/extensions/MentionReference.js +63 -0
- package/dist/client/composer/extensions/MentionReference.js.map +1 -0
- package/dist/client/composer/extensions/SkillReference.d.ts +3 -0
- package/dist/client/composer/extensions/SkillReference.d.ts.map +1 -0
- package/dist/client/composer/extensions/SkillReference.js +40 -0
- package/dist/client/composer/extensions/SkillReference.js.map +1 -0
- package/dist/client/composer/index.d.ts +8 -0
- package/dist/client/composer/index.d.ts.map +1 -0
- package/dist/client/composer/index.js +7 -0
- package/dist/client/composer/index.js.map +1 -0
- package/dist/client/composer/types.d.ts +32 -0
- package/dist/client/composer/types.d.ts.map +1 -0
- package/dist/client/composer/types.js +2 -0
- package/dist/client/composer/types.js.map +1 -0
- package/dist/client/composer/use-file-search.d.ts +6 -0
- package/dist/client/composer/use-file-search.d.ts.map +1 -0
- package/dist/client/composer/use-file-search.js +40 -0
- package/dist/client/composer/use-file-search.js.map +1 -0
- package/dist/client/composer/use-mention-search.d.ts +6 -0
- package/dist/client/composer/use-mention-search.d.ts.map +1 -0
- package/dist/client/composer/use-mention-search.js +39 -0
- package/dist/client/composer/use-mention-search.js.map +1 -0
- package/dist/client/composer/use-skills.d.ts +7 -0
- package/dist/client/composer/use-skills.d.ts.map +1 -0
- package/dist/client/composer/use-skills.js +38 -0
- package/dist/client/composer/use-skills.js.map +1 -0
- package/dist/client/index.d.ts +9 -4
- package/dist/client/index.d.ts.map +1 -1
- package/dist/client/index.js +8 -3
- package/dist/client/index.js.map +1 -1
- package/dist/client/resources/ResourceEditor.d.ts +7 -0
- package/dist/client/resources/ResourceEditor.d.ts.map +1 -0
- package/dist/client/resources/ResourceEditor.js +851 -0
- package/dist/client/resources/ResourceEditor.js.map +1 -0
- package/dist/client/resources/ResourceTree.d.ts +13 -0
- package/dist/client/resources/ResourceTree.d.ts.map +1 -0
- package/dist/client/resources/ResourceTree.js +122 -0
- package/dist/client/resources/ResourceTree.js.map +1 -0
- package/dist/client/resources/ResourcesPanel.d.ts +2 -0
- package/dist/client/resources/ResourcesPanel.d.ts.map +1 -0
- package/dist/client/resources/ResourcesPanel.js +341 -0
- package/dist/client/resources/ResourcesPanel.js.map +1 -0
- package/dist/client/resources/index.d.ts +5 -0
- package/dist/client/resources/index.d.ts.map +1 -0
- package/dist/client/resources/index.js +5 -0
- package/dist/client/resources/index.js.map +1 -0
- package/dist/client/resources/use-resources.d.ts +45 -0
- package/dist/client/resources/use-resources.d.ts.map +1 -0
- package/dist/client/resources/use-resources.js +102 -0
- package/dist/client/resources/use-resources.js.map +1 -0
- package/dist/client/sse-event-processor.d.ts +50 -0
- package/dist/client/sse-event-processor.d.ts.map +1 -0
- package/dist/client/sse-event-processor.js +267 -0
- package/dist/client/sse-event-processor.js.map +1 -0
- package/dist/client/terminal/AgentTerminal.d.ts +1 -1
- package/dist/client/terminal/AgentTerminal.d.ts.map +1 -1
- package/dist/client/terminal/AgentTerminal.js +11 -6
- package/dist/client/terminal/AgentTerminal.js.map +1 -1
- package/dist/client/use-agent-chat.d.ts +1 -1
- package/dist/client/use-agent-chat.d.ts.map +1 -1
- package/dist/client/use-agent-chat.js +3 -3
- package/dist/client/use-agent-chat.js.map +1 -1
- package/dist/client/use-chat-threads.d.ts +36 -0
- package/dist/client/use-chat-threads.d.ts.map +1 -0
- package/dist/client/use-chat-threads.js +175 -0
- package/dist/client/use-chat-threads.js.map +1 -0
- package/dist/client/use-db-sync.d.ts +35 -0
- package/dist/client/use-db-sync.d.ts.map +1 -0
- package/dist/client/use-db-sync.js +74 -0
- package/dist/client/use-db-sync.js.map +1 -0
- package/dist/client/use-dev-mode.d.ts +4 -2
- package/dist/client/use-dev-mode.d.ts.map +1 -1
- package/dist/client/use-dev-mode.js +39 -12
- package/dist/client/use-dev-mode.js.map +1 -1
- package/dist/client/use-file-sync-status.d.ts +1 -1
- package/dist/client/use-file-sync-status.js +3 -3
- package/dist/client/use-file-sync-status.js.map +1 -1
- package/dist/client/use-session.d.ts +1 -1
- package/dist/client/use-session.js +2 -2
- package/dist/client/use-session.js.map +1 -1
- package/dist/client/useProductionAgent.d.ts +1 -1
- package/dist/client/useProductionAgent.d.ts.map +1 -1
- package/dist/client/useProductionAgent.js +38 -3
- package/dist/client/useProductionAgent.js.map +1 -1
- package/dist/credentials/index.d.ts +18 -0
- package/dist/credentials/index.d.ts.map +1 -0
- package/dist/credentials/index.js +32 -0
- package/dist/credentials/index.js.map +1 -0
- package/dist/db/client.d.ts +35 -0
- package/dist/db/client.d.ts.map +1 -0
- package/dist/db/client.js +248 -0
- package/dist/db/client.js.map +1 -0
- package/dist/db/create-get-db.d.ts.map +1 -1
- package/dist/db/create-get-db.js +103 -16
- package/dist/db/create-get-db.js.map +1 -1
- package/dist/db/index.d.ts +10 -6
- package/dist/db/index.d.ts.map +1 -1
- package/dist/db/index.js +10 -4
- package/dist/db/index.js.map +1 -1
- package/dist/db/migrations.d.ts.map +1 -1
- package/dist/db/migrations.js +31 -30
- package/dist/db/migrations.js.map +1 -1
- package/dist/db/schema.d.ts +45 -0
- package/dist/db/schema.d.ts.map +1 -0
- package/dist/db/schema.js +61 -0
- package/dist/db/schema.js.map +1 -0
- package/dist/deploy/build.js +35 -6
- package/dist/deploy/build.js.map +1 -1
- package/dist/deploy/route-discovery.d.ts +9 -0
- package/dist/deploy/route-discovery.d.ts.map +1 -1
- package/dist/deploy/route-discovery.js +30 -1
- package/dist/deploy/route-discovery.js.map +1 -1
- package/dist/index.browser.d.ts +1 -1
- package/dist/index.browser.d.ts.map +1 -1
- package/dist/index.browser.js +1 -1
- package/dist/index.browser.js.map +1 -1
- package/dist/index.d.ts +3 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -1
- package/dist/index.js.map +1 -1
- package/dist/oauth-tokens/store.d.ts.map +1 -1
- package/dist/oauth-tokens/store.js +43 -81
- package/dist/oauth-tokens/store.js.map +1 -1
- package/dist/resources/emitter.d.ts +13 -0
- package/dist/resources/emitter.d.ts.map +1 -0
- package/dist/resources/emitter.js +32 -0
- package/dist/resources/emitter.js.map +1 -0
- package/dist/resources/handlers.d.ts +45 -0
- package/dist/resources/handlers.d.ts.map +1 -0
- package/dist/resources/handlers.js +219 -0
- package/dist/resources/handlers.js.map +1 -0
- package/dist/resources/index.d.ts +5 -0
- package/dist/resources/index.d.ts.map +1 -0
- package/dist/resources/index.js +5 -0
- package/dist/resources/index.js.map +1 -0
- package/dist/resources/script-helpers.d.ts +24 -0
- package/dist/resources/script-helpers.d.ts.map +1 -0
- package/dist/resources/script-helpers.js +36 -0
- package/dist/resources/script-helpers.js.map +1 -0
- package/dist/resources/store.d.ts +35 -0
- package/dist/resources/store.d.ts.map +1 -0
- package/dist/resources/store.js +453 -0
- package/dist/resources/store.js.map +1 -0
- package/dist/scripts/call-agent.d.ts +5 -0
- package/dist/scripts/call-agent.d.ts.map +1 -0
- package/dist/scripts/call-agent.js +107 -0
- package/dist/scripts/call-agent.js.map +1 -0
- package/dist/scripts/core-scripts.d.ts.map +1 -1
- package/dist/scripts/core-scripts.js +2 -0
- package/dist/scripts/core-scripts.js.map +1 -1
- package/dist/scripts/db/exec.d.ts +6 -2
- package/dist/scripts/db/exec.d.ts.map +1 -1
- package/dist/scripts/db/exec.js +127 -36
- package/dist/scripts/db/exec.js.map +1 -1
- package/dist/scripts/db/query.d.ts +7 -2
- package/dist/scripts/db/query.d.ts.map +1 -1
- package/dist/scripts/db/query.js +89 -45
- package/dist/scripts/db/query.js.map +1 -1
- package/dist/scripts/db/schema.d.ts +2 -2
- package/dist/scripts/db/schema.d.ts.map +1 -1
- package/dist/scripts/db/schema.js +145 -6
- package/dist/scripts/db/schema.js.map +1 -1
- package/dist/scripts/db/scoping.d.ts +36 -0
- package/dist/scripts/db/scoping.d.ts.map +1 -0
- package/dist/scripts/db/scoping.js +198 -0
- package/dist/scripts/db/scoping.js.map +1 -0
- package/dist/scripts/dev/index.d.ts +2 -2
- package/dist/scripts/dev/index.js +1 -1
- package/dist/scripts/dev/list-files.d.ts +2 -2
- package/dist/scripts/dev/read-file.d.ts +2 -2
- package/dist/scripts/dev/read-file.js +1 -1
- package/dist/scripts/dev/read-file.js.map +1 -1
- package/dist/scripts/dev/search-files.d.ts +2 -2
- package/dist/scripts/dev/search-files.js +1 -1
- package/dist/scripts/dev/search-files.js.map +1 -1
- package/dist/scripts/dev/shell.d.ts +2 -2
- package/dist/scripts/dev/shell.js +1 -1
- package/dist/scripts/dev/shell.js.map +1 -1
- package/dist/scripts/dev/write-file.d.ts +2 -2
- package/dist/scripts/dev/write-file.js +1 -1
- package/dist/scripts/dev/write-file.js.map +1 -1
- package/dist/scripts/resources/delete.d.ts +10 -0
- package/dist/scripts/resources/delete.d.ts.map +1 -0
- package/dist/scripts/resources/delete.js +38 -0
- package/dist/scripts/resources/delete.js.map +1 -0
- package/dist/scripts/resources/index.d.ts +2 -0
- package/dist/scripts/resources/index.d.ts.map +1 -0
- package/dist/scripts/resources/index.js +8 -0
- package/dist/scripts/resources/index.js.map +1 -0
- package/dist/scripts/resources/list.d.ts +10 -0
- package/dist/scripts/resources/list.d.ts.map +1 -0
- package/dist/scripts/resources/list.js +57 -0
- package/dist/scripts/resources/list.js.map +1 -0
- package/dist/scripts/resources/migrate-learnings.d.ts +10 -0
- package/dist/scripts/resources/migrate-learnings.d.ts.map +1 -0
- package/dist/scripts/resources/migrate-learnings.js +23 -0
- package/dist/scripts/resources/migrate-learnings.js.map +1 -0
- package/dist/scripts/resources/read.d.ts +10 -0
- package/dist/scripts/resources/read.d.ts.map +1 -0
- package/dist/scripts/resources/read.js +59 -0
- package/dist/scripts/resources/read.js.map +1 -0
- package/dist/scripts/resources/write.d.ts +10 -0
- package/dist/scripts/resources/write.d.ts.map +1 -0
- package/dist/scripts/resources/write.js +67 -0
- package/dist/scripts/resources/write.js.map +1 -0
- package/dist/scripts/runner.d.ts +7 -7
- package/dist/scripts/runner.d.ts.map +1 -1
- package/dist/scripts/runner.js +68 -27
- package/dist/scripts/runner.js.map +1 -1
- package/dist/scripts/utils.d.ts +4 -1
- package/dist/scripts/utils.d.ts.map +1 -1
- package/dist/scripts/utils.js +5 -3
- package/dist/scripts/utils.js.map +1 -1
- package/dist/server/action-discovery.d.ts +40 -0
- package/dist/server/action-discovery.d.ts.map +1 -0
- package/dist/server/action-discovery.js +189 -0
- package/dist/server/action-discovery.js.map +1 -0
- package/dist/server/agent-chat-plugin.d.ts +12 -23
- package/dist/server/agent-chat-plugin.d.ts.map +1 -1
- package/dist/server/agent-chat-plugin.js +1087 -36
- package/dist/server/agent-chat-plugin.js.map +1 -1
- package/dist/server/agent-discovery.d.ts +16 -0
- package/dist/server/agent-discovery.d.ts.map +1 -0
- package/dist/server/agent-discovery.js +136 -0
- package/dist/server/agent-discovery.js.map +1 -0
- package/dist/server/auth-plugin.d.ts +5 -0
- package/dist/server/auth-plugin.d.ts.map +1 -1
- package/dist/server/auth-plugin.js +12 -1
- package/dist/server/auth-plugin.js.map +1 -1
- package/dist/server/auth.d.ts +3 -1
- package/dist/server/auth.d.ts.map +1 -1
- package/dist/server/auth.js +576 -117
- package/dist/server/auth.js.map +1 -1
- package/dist/server/core-routes-plugin.d.ts +57 -0
- package/dist/server/core-routes-plugin.d.ts.map +1 -0
- package/dist/server/core-routes-plugin.js +125 -0
- package/dist/server/core-routes-plugin.js.map +1 -0
- package/dist/server/create-server.d.ts +4 -4
- package/dist/server/create-server.d.ts.map +1 -1
- package/dist/server/create-server.js +5 -5
- package/dist/server/create-server.js.map +1 -1
- package/dist/server/default-watcher.d.ts +9 -3
- package/dist/server/default-watcher.d.ts.map +1 -1
- package/dist/server/default-watcher.js +26 -6
- package/dist/server/default-watcher.js.map +1 -1
- package/dist/server/google-auth-plugin.js +3 -3
- package/dist/server/google-auth-plugin.js.map +1 -1
- package/dist/server/google-oauth.d.ts +72 -0
- package/dist/server/google-oauth.d.ts.map +1 -0
- package/dist/server/google-oauth.js +187 -0
- package/dist/server/google-oauth.js.map +1 -0
- package/dist/server/index.d.ts +9 -2
- package/dist/server/index.d.ts.map +1 -1
- package/dist/server/index.js +8 -1
- package/dist/server/index.js.map +1 -1
- package/dist/server/oauth-helpers.d.ts +16 -0
- package/dist/server/oauth-helpers.d.ts.map +1 -0
- package/dist/server/oauth-helpers.js +25 -0
- package/dist/server/oauth-helpers.js.map +1 -0
- package/dist/server/poll.d.ts +40 -0
- package/dist/server/poll.d.ts.map +1 -0
- package/dist/server/poll.js +49 -0
- package/dist/server/poll.js.map +1 -0
- package/dist/server/resources-plugin.d.ts +27 -0
- package/dist/server/resources-plugin.d.ts.map +1 -0
- package/dist/server/resources-plugin.js +74 -0
- package/dist/server/resources-plugin.js.map +1 -0
- package/dist/server/script-discovery.d.ts +6 -0
- package/dist/server/script-discovery.d.ts.map +1 -0
- package/dist/server/script-discovery.js +6 -0
- package/dist/server/script-discovery.js.map +1 -0
- package/dist/server/sse.d.ts +1 -1
- package/dist/server/sse.js +1 -1
- package/dist/settings/handlers.d.ts +3 -3
- package/dist/settings/handlers.d.ts.map +1 -1
- package/dist/settings/handlers.js +8 -6
- package/dist/settings/handlers.js.map +1 -1
- package/dist/settings/index.d.ts +1 -1
- package/dist/settings/index.d.ts.map +1 -1
- package/dist/settings/index.js.map +1 -1
- package/dist/settings/store.d.ts +6 -2
- package/dist/settings/store.d.ts.map +1 -1
- package/dist/settings/store.js +26 -63
- package/dist/settings/store.js.map +1 -1
- package/dist/settings/user-settings.d.ts +3 -2
- package/dist/settings/user-settings.d.ts.map +1 -1
- package/dist/settings/user-settings.js +5 -5
- package/dist/settings/user-settings.js.map +1 -1
- package/dist/tailwind.preset.d.ts +7 -6
- package/dist/tailwind.preset.d.ts.map +1 -1
- package/dist/tailwind.preset.js +18 -1
- package/dist/tailwind.preset.js.map +1 -1
- package/dist/terminal/cli-registry.d.ts +1 -1
- package/dist/terminal/cli-registry.js +3 -3
- package/dist/terminal/cli-registry.js.map +1 -1
- package/dist/terminal/pty-server.d.ts.map +1 -1
- package/dist/terminal/pty-server.js +65 -11
- package/dist/terminal/pty-server.js.map +1 -1
- package/dist/terminal/terminal-plugin.d.ts +2 -2
- package/dist/terminal/terminal-plugin.d.ts.map +1 -1
- package/dist/terminal/terminal-plugin.js +27 -21
- package/dist/terminal/terminal-plugin.js.map +1 -1
- package/dist/vite/client.d.ts.map +1 -1
- package/dist/vite/client.js +114 -8
- package/dist/vite/client.js.map +1 -1
- package/dist/vite/dev-api-server.d.ts +1 -1
- package/dist/vite/dev-api-server.d.ts.map +1 -1
- package/dist/vite/dev-api-server.js +105 -22
- package/dist/vite/dev-api-server.js.map +1 -1
- package/package.json +22 -6
- package/src/templates/default/.agents/skills/actions/SKILL.md +136 -0
- package/src/templates/default/.agents/skills/create-skill/SKILL.md +1 -1
- package/src/templates/default/.agents/skills/delegate-to-agent/SKILL.md +1 -1
- package/src/templates/default/.agents/skills/files-as-database/SKILL.md +2 -2
- package/src/templates/default/.agents/skills/real-time-sync/SKILL.md +112 -0
- package/src/templates/default/AGENTS.md +56 -164
- package/src/templates/default/DEVELOPING.md +117 -0
- package/src/templates/default/{scripts → actions}/hello.ts +1 -1
- package/src/templates/default/actions/navigate.ts +53 -0
- package/src/templates/default/actions/view-screen.ts +39 -0
- package/src/templates/default/app/global.css +2 -2
- package/src/templates/default/app/root.tsx +19 -16
- package/src/templates/default/app/routes/_index.tsx +1 -1
- package/src/templates/default/package.json +4 -0
- package/src/templates/default/server/plugins/.gitkeep +0 -0
- package/dist/a2a/middleware.d.ts +0 -3
- package/dist/a2a/middleware.d.ts.map +0 -1
- package/dist/a2a/middleware.js +0 -36
- package/dist/a2a/middleware.js.map +0 -1
- package/dist/client/use-file-watcher.d.ts +0 -23
- package/dist/client/use-file-watcher.d.ts.map +0 -1
- package/dist/client/use-file-watcher.js +0 -50
- package/dist/client/use-file-watcher.js.map +0 -1
- package/src/templates/default/.agents/skills/scripts/SKILL.md +0 -121
- package/src/templates/default/.agents/skills/sse-file-watcher/SKILL.md +0 -80
- package/src/templates/default/server/plugins/agent-chat.ts +0 -1
- package/src/templates/default/server/plugins/auth.ts +0 -1
- package/src/templates/default/server/plugins/file-sync.ts +0 -1
- package/src/templates/default/server/plugins/terminal.ts +0 -1
- package/src/templates/default/server/routes/api/events.get.ts +0 -3
- package/src/templates/default/server/routes/api/file-sync/status.get.ts +0 -4
- /package/src/templates/default/{scripts → actions}/run.ts +0 -0
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: actions
|
|
3
|
+
description: >-
|
|
4
|
+
How to create and run agent-callable actions in actions/. Use when creating
|
|
5
|
+
a new action, adding an API integration, implementing a complex agent
|
|
6
|
+
operation, or running pnpm action commands.
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
# Agent Actions
|
|
10
|
+
|
|
11
|
+
## Rule
|
|
12
|
+
|
|
13
|
+
Complex operations the agent needs to perform are implemented as actions in `actions/`. The agent runs them via `pnpm action <name>`.
|
|
14
|
+
|
|
15
|
+
## Why
|
|
16
|
+
|
|
17
|
+
Actions give the agent callable tools with structured input/output. They keep the agent's chat context clean (no massive code blocks), they're reusable, and they can be tested independently.
|
|
18
|
+
|
|
19
|
+
## How to Create an Action
|
|
20
|
+
|
|
21
|
+
Create `actions/my-action.ts`:
|
|
22
|
+
|
|
23
|
+
```ts
|
|
24
|
+
import fs from "fs";
|
|
25
|
+
import { parseArgs, loadEnv, fail, agentChat } from "@agent-native/core";
|
|
26
|
+
|
|
27
|
+
export default async function myAction(args: string[]) {
|
|
28
|
+
loadEnv();
|
|
29
|
+
|
|
30
|
+
const parsed = parseArgs(args);
|
|
31
|
+
const input = parsed.input;
|
|
32
|
+
if (!input) fail("--input is required");
|
|
33
|
+
|
|
34
|
+
const outputPath = parsed.output ?? "data/result.json";
|
|
35
|
+
const raw = fs.readFileSync(input, "utf-8");
|
|
36
|
+
const data = JSON.parse(raw) as unknown;
|
|
37
|
+
|
|
38
|
+
fs.writeFileSync(outputPath, JSON.stringify(data, null, 2));
|
|
39
|
+
agentChat.submit(`Processed ${input}, result saved to ${outputPath}`);
|
|
40
|
+
}
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
### Using `defineAction` (recommended for new actions)
|
|
44
|
+
|
|
45
|
+
```ts
|
|
46
|
+
import { defineAction } from "@agent-native/core";
|
|
47
|
+
|
|
48
|
+
export default defineAction({
|
|
49
|
+
description: "Process some data",
|
|
50
|
+
parameters: {
|
|
51
|
+
input: { type: "string", description: "Input file path" },
|
|
52
|
+
output: { type: "string", description: "Output file path" },
|
|
53
|
+
},
|
|
54
|
+
run: async (args) => {
|
|
55
|
+
// do work
|
|
56
|
+
return "Done";
|
|
57
|
+
},
|
|
58
|
+
});
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
## How to Run
|
|
62
|
+
|
|
63
|
+
```bash
|
|
64
|
+
pnpm action my-action --input data/source.json --output data/result.json
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
## Action Dispatcher
|
|
68
|
+
|
|
69
|
+
The default template uses core's `runScript()` in `actions/run.ts`:
|
|
70
|
+
|
|
71
|
+
```ts
|
|
72
|
+
import { runScript } from "@agent-native/core";
|
|
73
|
+
runScript();
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
This is the canonical approach for new apps. Action names must be lowercase with hyphens only (e.g., `my-action`).
|
|
77
|
+
|
|
78
|
+
## Guidelines
|
|
79
|
+
|
|
80
|
+
- **One action, one job.** Keep actions focused on a single operation. The agent composes multiple action calls for complex operations.
|
|
81
|
+
- **Use `parseArgs()`** for structured argument parsing. It converts `--key value` pairs to a `Record<string, string>`.
|
|
82
|
+
- **Use `loadEnv()`** if the action needs environment variables (API keys, etc.).
|
|
83
|
+
- **Use `fail()`** for user-friendly error messages (exits with message, no stack trace).
|
|
84
|
+
- **Write results to the database.** The agent and UI will pick them up via db sync polling.
|
|
85
|
+
- **Use `agentChat.submit()`** to report results or errors back to the agent chat.
|
|
86
|
+
- **Import from `@agent-native/core`** -- Don't redefine `parseArgs()` or other utilities locally.
|
|
87
|
+
|
|
88
|
+
## Common Patterns
|
|
89
|
+
|
|
90
|
+
**API integration action** (e.g., image generation):
|
|
91
|
+
|
|
92
|
+
```ts
|
|
93
|
+
import fs from "fs";
|
|
94
|
+
import { parseArgs, loadEnv, fail } from "@agent-native/core";
|
|
95
|
+
|
|
96
|
+
export default async function generateImage(args: string[]) {
|
|
97
|
+
loadEnv();
|
|
98
|
+
const parsed = parseArgs(args);
|
|
99
|
+
const prompt = parsed.prompt;
|
|
100
|
+
if (!prompt) fail("--prompt is required");
|
|
101
|
+
|
|
102
|
+
const outputPath = parsed.output ?? "data/generated-image.png";
|
|
103
|
+
const imageUrl = await callImageAPI(prompt);
|
|
104
|
+
const buffer = await fetch(imageUrl).then((r) => r.arrayBuffer());
|
|
105
|
+
fs.writeFileSync(outputPath, Buffer.from(buffer));
|
|
106
|
+
}
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
**Data processing action:**
|
|
110
|
+
|
|
111
|
+
```ts
|
|
112
|
+
import fs from "fs";
|
|
113
|
+
import { parseArgs, fail } from "@agent-native/core";
|
|
114
|
+
|
|
115
|
+
export default async function transform(args: string[]) {
|
|
116
|
+
const parsed = parseArgs(args);
|
|
117
|
+
const source = parsed.source;
|
|
118
|
+
if (!source) fail("--source is required");
|
|
119
|
+
|
|
120
|
+
const data = JSON.parse(fs.readFileSync(source, "utf-8")) as unknown[];
|
|
121
|
+
const result = data.map(transformItem);
|
|
122
|
+
fs.writeFileSync(source, JSON.stringify(result, null, 2));
|
|
123
|
+
}
|
|
124
|
+
```
|
|
125
|
+
|
|
126
|
+
## Troubleshooting
|
|
127
|
+
|
|
128
|
+
- **Action not found** -- Check that the filename matches the command name exactly. `pnpm action foo-bar` looks for `actions/foo-bar.ts`.
|
|
129
|
+
- **Args not parsing** -- Ensure args use `--key value` or `--key=value` format. Boolean flags use `--flag` (sets value to `"true"`).
|
|
130
|
+
- **Action runs but UI doesn't update** -- Make sure results are written to the database so db sync polling picks them up.
|
|
131
|
+
|
|
132
|
+
## Related Skills
|
|
133
|
+
|
|
134
|
+
- **files-as-database** -- Actions read/write data files in `data/`
|
|
135
|
+
- **delegate-to-agent** -- The agent invokes actions via `pnpm action <name>`
|
|
136
|
+
- **real-time-sync** -- Database writes from actions trigger poll events to update the UI
|
|
@@ -148,7 +148,7 @@ description: >-
|
|
|
148
148
|
|
|
149
149
|
- **Inline LLM calls** — Skills must not call LLMs directly (violates Rule 2)
|
|
150
150
|
- **Database patterns** — Skills must not introduce databases (violates Rule 1)
|
|
151
|
-
- **Ignoring
|
|
151
|
+
- **Ignoring db sync** — If a skill creates data, mention wiring up `useDbSync`
|
|
152
152
|
- **Vague descriptions** — "Helps with development" won't trigger. Be specific about _when_.
|
|
153
153
|
- **Pure documentation** — Skills should guide action, not just explain concepts
|
|
154
154
|
|
|
@@ -84,7 +84,7 @@ Scripts may call external APIs (image generation, search, etc.) — but the AI r
|
|
|
84
84
|
|
|
85
85
|
## Related Skills
|
|
86
86
|
|
|
87
|
-
- **scripts** — The agent invokes scripts via `pnpm
|
|
87
|
+
- **scripts** — The agent invokes scripts via `pnpm action <name>` to perform complex operations
|
|
88
88
|
- **self-modifying-code** — The agent operates through the chat bridge to make code changes
|
|
89
89
|
- **storing-data** — The agent writes results to the database after processing requests
|
|
90
90
|
- **real-time-sync** — The UI updates automatically when the agent writes to the database
|
|
@@ -63,9 +63,9 @@ SSE: writes automatically notify the UI via `{ source: "app-state", type: "chang
|
|
|
63
63
|
For data with schemas, relationships, and queries: forms, bookings, emails, compositions. Define tables in `server/db/schema.ts` using Drizzle ORM.
|
|
64
64
|
|
|
65
65
|
```ts
|
|
66
|
-
import {
|
|
66
|
+
import { table, text, integer } from "@agent-native/core/db/schema";
|
|
67
67
|
|
|
68
|
-
export const bookings =
|
|
68
|
+
export const bookings = table("bookings", {
|
|
69
69
|
id: text("id").primaryKey(),
|
|
70
70
|
name: text("name").notNull(),
|
|
71
71
|
email: text("email").notNull(),
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: real-time-sync
|
|
3
|
+
description: >-
|
|
4
|
+
How to keep the UI in sync with agent changes via polling. Use when wiring
|
|
5
|
+
query invalidation for new data models, debugging UI not updating, or
|
|
6
|
+
understanding jitter prevention.
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
# Real-Time Sync (Polling)
|
|
10
|
+
|
|
11
|
+
## Rule
|
|
12
|
+
|
|
13
|
+
The UI stays in sync with agent/script changes through database polling. When the agent writes to the database, the UI detects the change and updates automatically — no manual refresh needed.
|
|
14
|
+
|
|
15
|
+
## Why
|
|
16
|
+
|
|
17
|
+
The agent modifies data in SQL, but the UI runs in the browser. Polling bridges this gap: every database write increments a version counter, the `useDbSync()` hook polls for version changes, and React Query invalidates the relevant caches. This is what makes database writes feel real-time.
|
|
18
|
+
|
|
19
|
+
## How It Works
|
|
20
|
+
|
|
21
|
+
1. **Server** increments a version counter on every database write. The `/_agent-native/poll` endpoint returns the current version and any events since the last poll.
|
|
22
|
+
|
|
23
|
+
2. **Client** polls for changes and invalidates React Query caches:
|
|
24
|
+
|
|
25
|
+
```ts
|
|
26
|
+
import { useDbSync } from "@agent-native/core";
|
|
27
|
+
useDbSync({ queryClient, queryKeys: ["items", "settings"] });
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
3. When the agent writes to the database, the version increments, polling detects it, and React Query refetches the affected queries.
|
|
31
|
+
|
|
32
|
+
## Don't
|
|
33
|
+
|
|
34
|
+
- Don't create manual polling loops — `useDbSync()` handles it (polls every 2 seconds by default)
|
|
35
|
+
- Don't create your own fetch-based polling alongside `useDbSync` — use the `onEvent` callback for custom handling
|
|
36
|
+
|
|
37
|
+
## Query Key Mapping
|
|
38
|
+
|
|
39
|
+
By default, `useDbSync` invalidates all listed query keys on every change. For apps with multiple data models, this causes unnecessary refetches. Use event-based filtering via the `onEvent` callback:
|
|
40
|
+
|
|
41
|
+
```ts
|
|
42
|
+
useDbSync({
|
|
43
|
+
queryClient,
|
|
44
|
+
queryKeys: [], // don't auto-invalidate everything
|
|
45
|
+
onEvent: (data) => {
|
|
46
|
+
if (data.source === "settings") {
|
|
47
|
+
queryClient.invalidateQueries({ queryKey: ["settings"] });
|
|
48
|
+
} else if (data.source === "app-state") {
|
|
49
|
+
queryClient.invalidateQueries({ queryKey: ["navigate-command"] });
|
|
50
|
+
} else {
|
|
51
|
+
queryClient.invalidateQueries({ queryKey: ["items"] });
|
|
52
|
+
}
|
|
53
|
+
},
|
|
54
|
+
});
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
To prevent cache thrashing during rapid agent writes, set `staleTime` on your queries:
|
|
58
|
+
|
|
59
|
+
```ts
|
|
60
|
+
useQuery({
|
|
61
|
+
queryKey: ["items"],
|
|
62
|
+
queryFn: fetchItems,
|
|
63
|
+
staleTime: 2000, // don't refetch within 2 seconds
|
|
64
|
+
});
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
## Troubleshooting
|
|
68
|
+
|
|
69
|
+
| Symptom | Check |
|
|
70
|
+
| ---------------------------------- | -------------------------------------------------------------------------------------------------------------- |
|
|
71
|
+
| UI not updating after agent writes | Is `useDbSync` called with the correct `queryClient`? Are the `queryKeys` matching your `useQuery` keys? |
|
|
72
|
+
| Poll endpoint not responding | Is `/_agent-native/poll` accessible? Is the server running? |
|
|
73
|
+
| High CPU / event storms | The agent is writing rapidly. Add `staleTime` to queries and use event-based filtering. |
|
|
74
|
+
|
|
75
|
+
## Jitter Prevention
|
|
76
|
+
|
|
77
|
+
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.
|
|
78
|
+
|
|
79
|
+
### How it works
|
|
80
|
+
|
|
81
|
+
1. **Agent writes** are tagged: the script helpers in `@agent-native/core/application-state` pass `{ requestSource: "agent" }` to the store.
|
|
82
|
+
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.
|
|
83
|
+
3. **Polling 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.
|
|
84
|
+
|
|
85
|
+
### Template setup
|
|
86
|
+
|
|
87
|
+
```ts
|
|
88
|
+
// app/lib/tab-id.ts
|
|
89
|
+
export const TAB_ID = `tab-${Math.random().toString(36).slice(2, 8)}`;
|
|
90
|
+
|
|
91
|
+
// app/root.tsx
|
|
92
|
+
import { TAB_ID } from "@/lib/tab-id";
|
|
93
|
+
|
|
94
|
+
useDbSync({
|
|
95
|
+
queryClient,
|
|
96
|
+
queryKeys: ["app-state", "settings"],
|
|
97
|
+
ignoreSource: TAB_ID,
|
|
98
|
+
});
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
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.
|
|
102
|
+
|
|
103
|
+
### Why this matters
|
|
104
|
+
|
|
105
|
+
Without jitter prevention, a cycle occurs: the UI writes state, polling 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).
|
|
106
|
+
|
|
107
|
+
## Related Skills
|
|
108
|
+
|
|
109
|
+
- **storing-data** — Application-state and settings are the data stores that sync via polling
|
|
110
|
+
- **context-awareness** — Navigation state writes use jitter prevention to avoid overwriting active edits
|
|
111
|
+
- **scripts** — Script outputs written to the database trigger poll events
|
|
112
|
+
- **self-modifying-code** — Agent code edits trigger poll events; rapid edits can cause event storms
|
|
@@ -1,73 +1,71 @@
|
|
|
1
|
-
# {{APP_NAME}} — Agent
|
|
1
|
+
# {{APP_NAME}} — Agent Guide
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
This app follows the agent-native core philosophy: the agent and UI are equal partners. Everything the UI can do, the agent can do via actions. The agent always knows what you're looking at via application state. See the root AGENTS.md for full framework documentation.
|
|
4
4
|
|
|
5
|
-
This is an **@agent-native/core** application
|
|
5
|
+
This is an **@agent-native/core** application -- the AI agent and UI share state through a SQL database, with polling for real-time sync.
|
|
6
6
|
|
|
7
7
|
### Core Principles
|
|
8
8
|
|
|
9
|
-
1. **Shared SQL database**
|
|
10
|
-
2. **All AI through agent chat**
|
|
11
|
-
3. **
|
|
12
|
-
4. **
|
|
13
|
-
5. **Agent can update code**
|
|
9
|
+
1. **Shared SQL database** -- All app state lives in SQL (SQLite locally, cloud DB via `DATABASE_URL` in production). Core stores: `application_state`, `settings`, `oauth_tokens`, `sessions`, `resources`.
|
|
10
|
+
2. **All AI through agent chat** -- No inline LLM calls. UI delegates to the AI via `sendToAgentChat()` / `agentChat.submit()`.
|
|
11
|
+
3. **Actions for agent operations** -- `pnpm action <name>` dispatches to callable action files in `actions/`.
|
|
12
|
+
4. **Polling for real-time sync** -- Database writes trigger version counter increments that the UI polls to stay in sync.
|
|
13
|
+
5. **Agent can update code** -- The agent can modify this app's source code directly.
|
|
14
14
|
|
|
15
15
|
### Authentication
|
|
16
16
|
|
|
17
|
-
Auth is automatic and environment-driven
|
|
17
|
+
Auth is automatic and environment-driven:
|
|
18
18
|
|
|
19
|
-
- **Dev mode**: Auth is bypassed. `getSession()` returns `{ email: "local@localhost" }`.
|
|
20
|
-
- **Production** (`ACCESS_TOKEN` set): Auth middleware auto-mounts.
|
|
21
|
-
- **Production** (no token, no `AUTH_DISABLED=true`): Server refuses to start.
|
|
19
|
+
- **Dev mode**: Auth is bypassed. `getSession()` returns `{ email: "local@localhost" }`.
|
|
20
|
+
- **Production** (`ACCESS_TOKEN` set): Auth middleware auto-mounts.
|
|
22
21
|
|
|
23
|
-
Use `getSession(event)` server-side and `useSession()` client-side.
|
|
22
|
+
Use `getSession(event)` server-side and `useSession()` client-side.
|
|
24
23
|
|
|
25
|
-
|
|
24
|
+
## Resources
|
|
26
25
|
|
|
27
|
-
|
|
28
|
-
app/ # React frontend
|
|
29
|
-
root.tsx # HTML shell + global providers
|
|
30
|
-
entry.client.tsx # Client hydration entry
|
|
31
|
-
routes.ts # Route config — flatRoutes()
|
|
32
|
-
routes/ # File-based page routes (auto-discovered)
|
|
33
|
-
_index.tsx # / (home page)
|
|
34
|
-
components/ # UI components
|
|
35
|
-
hooks/ # React hooks
|
|
36
|
-
lib/ # Utilities (cn, etc)
|
|
26
|
+
Resources are SQL-backed persistent files for notes, learnings, and context.
|
|
37
27
|
|
|
38
|
-
|
|
39
|
-
routes/
|
|
40
|
-
api/ # File-based API routes (auto-discovered)
|
|
41
|
-
[...page].get.ts # SSR catch-all (delegates to React Router)
|
|
42
|
-
plugins/ # Server plugins (startup logic)
|
|
43
|
-
lib/ # Shared server modules
|
|
28
|
+
**At the start of every conversation, read these resources (both personal and shared scopes):**
|
|
44
29
|
|
|
45
|
-
|
|
30
|
+
1. **`AGENTS.md`** -- user-specific context. Read both `--scope personal` and `--scope shared`.
|
|
31
|
+
2. **`LEARNINGS.md`** -- user preferences, corrections, and patterns. Read both scopes.
|
|
46
32
|
|
|
47
|
-
|
|
48
|
-
run.ts # Script dispatcher
|
|
49
|
-
*.ts # Individual scripts (pnpm script <name>)
|
|
33
|
+
**Update `LEARNINGS.md` when you learn something important.**
|
|
50
34
|
|
|
51
|
-
|
|
35
|
+
| Action | Args | Purpose |
|
|
36
|
+
| ----------------- | ----------------------------------------------------------- | ----------------------- |
|
|
37
|
+
| `resource-read` | `--path <path> [--scope personal\|shared]` | Read a resource |
|
|
38
|
+
| `resource-write` | `--path <path> --content <text> [--scope personal\|shared]` | Write/update a resource |
|
|
39
|
+
| `resource-list` | `[--prefix <path>] [--scope personal\|shared\|all]` | List resources |
|
|
40
|
+
| `resource-delete` | `--path <path> [--scope personal\|shared]` | Delete a resource |
|
|
52
41
|
|
|
53
|
-
|
|
54
|
-
.agents/skills/ # Agent skills — detailed guidance for each rule
|
|
55
|
-
```
|
|
42
|
+
## Application State
|
|
56
43
|
|
|
57
|
-
|
|
44
|
+
Ephemeral UI state is stored in the SQL `application_state` table, accessed via `readAppState(key)` and `writeAppState(key, value)` from `@agent-native/core/application-state`.
|
|
58
45
|
|
|
59
|
-
|
|
46
|
+
| State Key | Purpose | Direction |
|
|
47
|
+
| ------------ | ----------------------------------------- | -------------------------- |
|
|
48
|
+
| `navigation` | Current view | UI -> Agent (read-only) |
|
|
49
|
+
| `navigate` | Navigate command (one-shot, auto-deleted) | Agent -> UI (auto-deleted) |
|
|
60
50
|
|
|
61
|
-
|
|
51
|
+
The `navigation` key is written by the UI whenever the route changes. The `navigate` key is a one-shot command: the agent writes it, the UI reads and executes the navigation, then deletes it.
|
|
62
52
|
|
|
63
|
-
|
|
64
|
-
- User shares personal info relevant to the app (contacts, preferences, habits)
|
|
65
|
-
- You discover a non-obvious pattern or gotcha
|
|
66
|
-
- User gives feedback that should apply to future conversations
|
|
53
|
+
## Agent Operations
|
|
67
54
|
|
|
68
|
-
|
|
55
|
+
**Always run `pnpm action view-screen` first** before taking any action. This tells you what the user is looking at.
|
|
69
56
|
|
|
70
|
-
|
|
57
|
+
### Actions
|
|
58
|
+
|
|
59
|
+
| Action | Args | Purpose |
|
|
60
|
+
| ------------- | --------------------------------- | ------------------------------- |
|
|
61
|
+
| `view-screen` | | See current UI state |
|
|
62
|
+
| `navigate` | `--view <name>` or `--path <url>` | Navigate the UI |
|
|
63
|
+
| `hello` | `[--name <name>]` | Example script |
|
|
64
|
+
| `db-schema` | | Show all tables, columns, types |
|
|
65
|
+
| `db-query` | `--sql "SELECT ..."` | Run a SELECT query |
|
|
66
|
+
| `db-exec` | `--sql "INSERT ..."` | Run INSERT/UPDATE/DELETE |
|
|
67
|
+
|
|
68
|
+
## Skills
|
|
71
69
|
|
|
72
70
|
Skills in `.agents/skills/` provide detailed guidance for each architectural rule. Read them before making changes.
|
|
73
71
|
|
|
@@ -75,128 +73,22 @@ Skills in `.agents/skills/` provide detailed guidance for each architectural rul
|
|
|
75
73
|
| --------------------- | -------------------------------------------------------------- |
|
|
76
74
|
| `storing-data` | Before storing or reading any app state |
|
|
77
75
|
| `delegate-to-agent` | Before adding LLM calls or AI delegation |
|
|
78
|
-
| `
|
|
76
|
+
| `actions` | Before creating or modifying actions |
|
|
79
77
|
| `real-time-sync` | Before wiring up real-time UI sync |
|
|
80
78
|
| `self-modifying-code` | Before editing source, components, or styles |
|
|
79
|
+
| `capture-learnings` | Before recording user preferences or corrections |
|
|
81
80
|
| `frontend-design` | Before building or restyling any UI component, page, or layout |
|
|
82
81
|
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
### Framework Basics
|
|
86
|
-
|
|
87
|
-
**SSR-first framework, CSR-by-default content:** This app uses React Router v7 framework mode with `ssr: true`. But virtually every route renders only an SSR shell (loading spinner + meta tags). All real data fetching and rendering happens on the client via React Query hooks. Server-side data fetching is the exception — only used for public pages that need SEO/og tags.
|
|
88
|
-
|
|
89
|
-
**Adding a page:**
|
|
90
|
-
Create a file in `app/routes/`. The filename determines the URL path:
|
|
91
|
-
|
|
92
|
-
```
|
|
93
|
-
app/routes/_index.tsx → /
|
|
94
|
-
app/routes/settings.tsx → /settings
|
|
95
|
-
app/routes/inbox.tsx → /inbox
|
|
96
|
-
app/routes/inbox.$threadId.tsx → /inbox/:threadId
|
|
97
|
-
app/routes/$id.tsx → /:id (dynamic param)
|
|
98
|
-
```
|
|
99
|
-
|
|
100
|
-
Each route file exports a default component, optional `meta()`, and optional `HydrateFallback()`:
|
|
101
|
-
|
|
102
|
-
```tsx
|
|
103
|
-
import MyPage from "@/pages/MyPage";
|
|
104
|
-
|
|
105
|
-
export function meta() {
|
|
106
|
-
return [{ title: "My Page" }];
|
|
107
|
-
}
|
|
108
|
-
|
|
109
|
-
export function HydrateFallback() {
|
|
110
|
-
return (
|
|
111
|
-
<div className="flex items-center justify-center h-screen">
|
|
112
|
-
<div className="animate-spin rounded-full h-8 w-8 border-b-2 border-foreground" />
|
|
113
|
-
</div>
|
|
114
|
-
);
|
|
115
|
-
}
|
|
116
|
-
|
|
117
|
-
export default function MyPageRoute() {
|
|
118
|
-
return <MyPage />;
|
|
119
|
-
}
|
|
120
|
-
```
|
|
121
|
-
|
|
122
|
-
**Do NOT fetch data server-side** in route loaders unless the page genuinely needs SEO content or og tags based on dynamic data. The standard pattern is: SSR renders a loading spinner, client hydrates, React Query hooks fetch from `/api/*`.
|
|
123
|
-
|
|
124
|
-
### Key Patterns
|
|
82
|
+
## When Adding Features
|
|
125
83
|
|
|
126
|
-
|
|
127
|
-
Create a file in `server/routes/api/`. The filename determines the URL path and HTTP method:
|
|
84
|
+
As you build out this app, follow this checklist for each new feature:
|
|
128
85
|
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
86
|
+
1. **Add navigation state entries** -- create or extend `app/hooks/use-navigation-state.ts` to track new routes
|
|
87
|
+
2. **Enhance view-screen** -- make the view-screen script return relevant context for the new view
|
|
88
|
+
3. **Create domain actions** -- add scripts for CRUD operations on new data models
|
|
89
|
+
4. **Create domain skills** -- add `.agents/skills/<feature>/SKILL.md` documenting the data model, storage patterns, and agent operations
|
|
90
|
+
5. **Update this AGENTS.md** -- add the new actions, state keys, and common tasks
|
|
134
91
|
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
**Adding a server plugin:**
|
|
138
|
-
Startup logic (auth, SSE, etc.) lives in `server/plugins/`. Use `defineNitroPlugin` from core:
|
|
139
|
-
|
|
140
|
-
```ts
|
|
141
|
-
import { defineNitroPlugin } from "@agent-native/core";
|
|
142
|
-
|
|
143
|
-
export default defineNitroPlugin(async (nitroApp) => {
|
|
144
|
-
// Runs once at server startup
|
|
145
|
-
});
|
|
146
|
-
```
|
|
147
|
-
|
|
148
|
-
**Key imports from `@agent-native/core`:**
|
|
149
|
-
|
|
150
|
-
| Import | Purpose |
|
|
151
|
-
| -------------------------------------------- | -------------------------------------------------------------------------- |
|
|
152
|
-
| `defineNitroPlugin` | Define a server plugin (re-exported from Nitro) |
|
|
153
|
-
| `createDefaultSSEHandler` | Create SSE endpoint for DB change events (server) |
|
|
154
|
-
| `readAppState`, `writeAppState` | Read/write application state (from `@agent-native/core/application-state`) |
|
|
155
|
-
| `readSetting`, `writeSetting` | Read/write settings (from `@agent-native/core/settings`) |
|
|
156
|
-
| `defineEventHandler`, `readBody`, `getQuery` | H3 route handler utilities (re-exported) |
|
|
157
|
-
| `sendToAgentChat` | Send messages to agent from UI (client-side) |
|
|
158
|
-
| `agentChat` | Send messages to agent from scripts (server-side) |
|
|
159
|
-
|
|
160
|
-
**Adding a script:**
|
|
161
|
-
Create `scripts/my-script.ts` exporting `default async function(args: string[])`.
|
|
162
|
-
Run with: `pnpm script my-script --arg value`
|
|
163
|
-
|
|
164
|
-
**Sending to agent chat from UI:**
|
|
165
|
-
|
|
166
|
-
```ts
|
|
167
|
-
import { sendToAgentChat } from "@agent-native/core";
|
|
168
|
-
sendToAgentChat({
|
|
169
|
-
message: "Generate something",
|
|
170
|
-
context: "...",
|
|
171
|
-
submit: true,
|
|
172
|
-
});
|
|
173
|
-
```
|
|
174
|
-
|
|
175
|
-
**Sending to agent chat from scripts:**
|
|
176
|
-
|
|
177
|
-
```ts
|
|
178
|
-
import { agentChat } from "@agent-native/core";
|
|
179
|
-
agentChat.submit("Generate something");
|
|
180
|
-
```
|
|
181
|
-
|
|
182
|
-
### Database (Cloud Deployment)
|
|
183
|
-
|
|
184
|
-
By default, data is stored in SQLite at `data/app.db`. For production/cloud deployment, set `DATABASE_URL` to point to a remote database (Turso, Neon, Supabase, D1).
|
|
92
|
+
---
|
|
185
93
|
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
| Variable | Required | Description |
|
|
189
|
-
| --------------------- | ---------------- | ---------------------------------------------------------- |
|
|
190
|
-
| `DATABASE_URL` | No (has default) | Database connection string (default: `file:./data/app.db`) |
|
|
191
|
-
| `DATABASE_AUTH_TOKEN` | For remote DBs | Auth token for Turso or other remote databases |
|
|
192
|
-
|
|
193
|
-
### Tech Stack
|
|
194
|
-
|
|
195
|
-
- **Framework:** @agent-native/core + React Router v7 (framework mode)
|
|
196
|
-
- **Frontend:** React 18, Vite, TailwindCSS, shadcn/ui
|
|
197
|
-
- **Routing:** File-based via `flatRoutes()` — SSR shell + client rendering
|
|
198
|
-
- **Backend:** Nitro (via @agent-native/core) — file-based API routing, server plugins, deploy-anywhere presets
|
|
199
|
-
- **State:** SQL-backed (SSE for real-time updates)
|
|
200
|
-
- **Build:** `pnpm build` (React Router build — client + SSR + Nitro server)
|
|
201
|
-
- **Dev:** `pnpm dev` (Vite dev server with both React Router + Nitro plugins)
|
|
202
|
-
- **Start:** `node .output/server/index.mjs` (production)
|
|
94
|
+
For code editing and development guidance, read `DEVELOPING.md`.
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
# {{APP_NAME}} — Development Guide
|
|
2
|
+
|
|
3
|
+
This guide is for development-mode agents editing this app's source code. For app operations and tools, see AGENTS.md.
|
|
4
|
+
|
|
5
|
+
## Framework Basics
|
|
6
|
+
|
|
7
|
+
**Client-side-first rendering:** This app uses React Router v7 framework mode with `ssr: true`, but all app content renders **client-side only**. The server renders only the HTML shell (meta tags, styles, scripts) plus a loading spinner. This is enforced by the `ClientOnly` wrapper in `root.tsx` — never remove it. Browser APIs (`window`, `localStorage`, `new Date()`) are safe to use anywhere in app code because components never run on the server.
|
|
8
|
+
|
|
9
|
+
**Do NOT fetch data server-side** in route loaders. The standard pattern is: server renders a spinner, client hydrates, React Query hooks fetch from `/api/*`.
|
|
10
|
+
|
|
11
|
+
## Adding a Page
|
|
12
|
+
|
|
13
|
+
Create a file in `app/routes/`. The filename determines the URL path:
|
|
14
|
+
|
|
15
|
+
```
|
|
16
|
+
app/routes/_index.tsx → /
|
|
17
|
+
app/routes/settings.tsx → /settings
|
|
18
|
+
app/routes/inbox.tsx → /inbox
|
|
19
|
+
app/routes/inbox.$threadId.tsx → /inbox/:threadId
|
|
20
|
+
app/routes/$id.tsx → /:id (dynamic param)
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
Each route file exports a default component and optional `meta()`:
|
|
24
|
+
|
|
25
|
+
```tsx
|
|
26
|
+
import MyPage from "@/pages/MyPage";
|
|
27
|
+
|
|
28
|
+
export function meta() {
|
|
29
|
+
return [{ title: "My Page" }];
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
export default function MyPageRoute() {
|
|
33
|
+
return <MyPage />;
|
|
34
|
+
}
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
## Adding an API Route
|
|
38
|
+
|
|
39
|
+
Create a file in `server/routes/api/`. The filename determines the URL path and HTTP method:
|
|
40
|
+
|
|
41
|
+
```
|
|
42
|
+
server/routes/api/items/index.get.ts → GET /api/items
|
|
43
|
+
server/routes/api/items/[id].get.ts → GET /api/items/:id
|
|
44
|
+
server/routes/api/items/[id].patch.ts → PATCH /api/items/:id
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
Each file exports a default `defineEventHandler`.
|
|
48
|
+
|
|
49
|
+
## Server Plugins
|
|
50
|
+
|
|
51
|
+
Startup logic (auth, SSE, etc.) lives in `server/plugins/`. Use `defineNitroPlugin` from core:
|
|
52
|
+
|
|
53
|
+
```ts
|
|
54
|
+
import { defineNitroPlugin } from "@agent-native/core";
|
|
55
|
+
|
|
56
|
+
export default defineNitroPlugin(async (nitroApp) => {
|
|
57
|
+
// Runs once at server startup
|
|
58
|
+
});
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
## Key Imports
|
|
62
|
+
|
|
63
|
+
| Import | Purpose |
|
|
64
|
+
| -------------------------------------------- | -------------------------------------------------------------------------- |
|
|
65
|
+
| `defineNitroPlugin` | Define a server plugin (re-exported from Nitro) |
|
|
66
|
+
| `createDefaultSSEHandler` | Create SSE endpoint for DB change events (server) |
|
|
67
|
+
| `readAppState`, `writeAppState` | Read/write application state (from `@agent-native/core/application-state`) |
|
|
68
|
+
| `readSetting`, `writeSetting` | Read/write settings (from `@agent-native/core/settings`) |
|
|
69
|
+
| `readResource`, `writeResource` | Read/write resources (from `@agent-native/core/resources`) |
|
|
70
|
+
| `defineEventHandler`, `readBody`, `getQuery` | H3 route handler utilities (re-exported) |
|
|
71
|
+
| `sendToAgentChat` | Send messages to agent from UI (client-side) |
|
|
72
|
+
| `agentChat` | Send messages to agent from scripts (server-side) |
|
|
73
|
+
|
|
74
|
+
## Adding a Script
|
|
75
|
+
|
|
76
|
+
Create `actions/my-script.ts` exporting `default async function(args: string[])`.
|
|
77
|
+
Run with: `pnpm action my-script --arg value`
|
|
78
|
+
|
|
79
|
+
## Sending to Agent Chat
|
|
80
|
+
|
|
81
|
+
**From UI:**
|
|
82
|
+
|
|
83
|
+
```ts
|
|
84
|
+
import { sendToAgentChat } from "@agent-native/core";
|
|
85
|
+
sendToAgentChat({
|
|
86
|
+
message: "Generate something",
|
|
87
|
+
context: "...",
|
|
88
|
+
submit: true,
|
|
89
|
+
});
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
**From scripts:**
|
|
93
|
+
|
|
94
|
+
```ts
|
|
95
|
+
import { agentChat } from "@agent-native/core";
|
|
96
|
+
agentChat.submit("Generate something");
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
## Database
|
|
100
|
+
|
|
101
|
+
By default, data is stored in SQLite at `data/app.db`. For production/cloud deployment, set `DATABASE_URL` to point to a remote database (Turso, Neon, Supabase, D1).
|
|
102
|
+
|
|
103
|
+
| Variable | Required | Description |
|
|
104
|
+
| --------------------- | ---------------- | ---------------------------------------------------------- |
|
|
105
|
+
| `DATABASE_URL` | No (has default) | Database connection string (default: `file:./data/app.db`) |
|
|
106
|
+
| `DATABASE_AUTH_TOKEN` | For remote DBs | Auth token for Turso or other remote databases |
|
|
107
|
+
|
|
108
|
+
## Tech Stack
|
|
109
|
+
|
|
110
|
+
- **Framework:** @agent-native/core + React Router v7 (framework mode)
|
|
111
|
+
- **Frontend:** React 18, Vite, TailwindCSS, shadcn/ui
|
|
112
|
+
- **Routing:** File-based via `flatRoutes()` — SSR shell + client rendering
|
|
113
|
+
- **Backend:** Nitro (via @agent-native/core) — file-based API routing, server plugins, deploy-anywhere presets
|
|
114
|
+
- **State:** SQL-backed (SSE for real-time updates)
|
|
115
|
+
- **Build:** `pnpm build` (React Router build — client + SSR + Nitro server)
|
|
116
|
+
- **Dev:** `pnpm dev` (Vite dev server with both React Router + Nitro plugins)
|
|
117
|
+
- **Start:** `node .output/server/index.mjs` (production)
|