@agent-native/core 0.95.1 → 0.97.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/README.md +6 -0
- package/corpus/README.md +2 -2
- package/corpus/core/CHANGELOG.md +64 -0
- package/corpus/core/docs/content/audit-log.mdx +2 -1
- package/corpus/core/docs/content/automations.mdx +7 -7
- package/corpus/core/docs/content/creating-templates.mdx +1 -1
- package/corpus/core/docs/content/internationalization.mdx +2 -1
- package/corpus/core/docs/content/locales/ar-SA/audit-log.mdx +2 -1
- package/corpus/core/docs/content/locales/ar-SA/automations.mdx +7 -7
- package/corpus/core/docs/content/locales/ar-SA/getting-started.mdx +7 -1
- package/corpus/core/docs/content/locales/ar-SA/internationalization.mdx +1 -1
- package/corpus/core/docs/content/locales/ar-SA/package-lifecycle.mdx +19 -0
- package/corpus/core/docs/content/locales/ar-SA/sandbox-adapters.mdx +18 -7
- package/corpus/core/docs/content/locales/ar-SA/security.mdx +8 -0
- package/corpus/core/docs/content/locales/de-DE/audit-log.mdx +2 -1
- package/corpus/core/docs/content/locales/de-DE/automations.mdx +7 -7
- package/corpus/core/docs/content/locales/de-DE/getting-started.mdx +7 -1
- package/corpus/core/docs/content/locales/de-DE/internationalization.mdx +1 -1
- package/corpus/core/docs/content/locales/de-DE/package-lifecycle.mdx +22 -0
- package/corpus/core/docs/content/locales/de-DE/sandbox-adapters.mdx +18 -7
- package/corpus/core/docs/content/locales/de-DE/security.mdx +8 -0
- package/corpus/core/docs/content/locales/es-ES/audit-log.mdx +2 -1
- package/corpus/core/docs/content/locales/es-ES/automations.mdx +7 -7
- package/corpus/core/docs/content/locales/es-ES/getting-started.mdx +7 -1
- package/corpus/core/docs/content/locales/es-ES/internationalization.mdx +1 -1
- package/corpus/core/docs/content/locales/es-ES/package-lifecycle.mdx +22 -0
- package/corpus/core/docs/content/locales/es-ES/sandbox-adapters.mdx +18 -7
- package/corpus/core/docs/content/locales/es-ES/security.mdx +8 -0
- package/corpus/core/docs/content/locales/fr-FR/audit-log.mdx +2 -1
- package/corpus/core/docs/content/locales/fr-FR/automations.mdx +7 -7
- package/corpus/core/docs/content/locales/fr-FR/getting-started.mdx +7 -1
- package/corpus/core/docs/content/locales/fr-FR/internationalization.mdx +1 -1
- package/corpus/core/docs/content/locales/fr-FR/package-lifecycle.mdx +21 -0
- package/corpus/core/docs/content/locales/fr-FR/sandbox-adapters.mdx +19 -8
- package/corpus/core/docs/content/locales/fr-FR/security.mdx +8 -0
- package/corpus/core/docs/content/locales/hi-IN/audit-log.mdx +2 -1
- package/corpus/core/docs/content/locales/hi-IN/automations.mdx +7 -7
- package/corpus/core/docs/content/locales/hi-IN/getting-started.mdx +7 -1
- package/corpus/core/docs/content/locales/hi-IN/internationalization.mdx +1 -1
- package/corpus/core/docs/content/locales/hi-IN/package-lifecycle.mdx +20 -0
- package/corpus/core/docs/content/locales/hi-IN/sandbox-adapters.mdx +18 -7
- package/corpus/core/docs/content/locales/hi-IN/security.mdx +8 -0
- package/corpus/core/docs/content/locales/ja-JP/audit-log.mdx +2 -1
- package/corpus/core/docs/content/locales/ja-JP/automations.mdx +7 -7
- package/corpus/core/docs/content/locales/ja-JP/getting-started.mdx +7 -1
- package/corpus/core/docs/content/locales/ja-JP/internationalization.mdx +1 -1
- package/corpus/core/docs/content/locales/ja-JP/package-lifecycle.mdx +21 -0
- package/corpus/core/docs/content/locales/ja-JP/sandbox-adapters.mdx +17 -6
- package/corpus/core/docs/content/locales/ja-JP/security.mdx +8 -0
- package/corpus/core/docs/content/locales/ko-KR/audit-log.mdx +2 -1
- package/corpus/core/docs/content/locales/ko-KR/automations.mdx +7 -7
- package/corpus/core/docs/content/locales/ko-KR/getting-started.mdx +7 -1
- package/corpus/core/docs/content/locales/ko-KR/internationalization.mdx +1 -1
- package/corpus/core/docs/content/locales/ko-KR/package-lifecycle.mdx +20 -0
- package/corpus/core/docs/content/locales/ko-KR/sandbox-adapters.mdx +17 -6
- package/corpus/core/docs/content/locales/ko-KR/security.mdx +8 -0
- package/corpus/core/docs/content/locales/pt-BR/audit-log.mdx +2 -1
- package/corpus/core/docs/content/locales/pt-BR/automations.mdx +7 -7
- package/corpus/core/docs/content/locales/pt-BR/getting-started.mdx +7 -1
- package/corpus/core/docs/content/locales/pt-BR/internationalization.mdx +1 -1
- package/corpus/core/docs/content/locales/pt-BR/package-lifecycle.mdx +21 -0
- package/corpus/core/docs/content/locales/pt-BR/sandbox-adapters.mdx +18 -7
- package/corpus/core/docs/content/locales/pt-BR/security.mdx +8 -0
- package/corpus/core/docs/content/locales/zh-CN/audit-log.mdx +2 -1
- package/corpus/core/docs/content/locales/zh-CN/automations.mdx +7 -7
- package/corpus/core/docs/content/locales/zh-CN/getting-started.mdx +6 -4
- package/corpus/core/docs/content/locales/zh-CN/internationalization.mdx +1 -1
- package/corpus/core/docs/content/locales/zh-CN/package-lifecycle.mdx +19 -0
- package/corpus/core/docs/content/locales/zh-CN/sandbox-adapters.mdx +17 -6
- package/corpus/core/docs/content/locales/zh-CN/security.mdx +8 -0
- package/corpus/core/docs/content/locales/zh-TW/audit-log.mdx +2 -1
- package/corpus/core/docs/content/locales/zh-TW/automations.mdx +7 -7
- package/corpus/core/docs/content/locales/zh-TW/getting-started.mdx +6 -4
- package/corpus/core/docs/content/locales/zh-TW/internationalization.mdx +1 -1
- package/corpus/core/docs/content/locales/zh-TW/package-lifecycle.mdx +19 -0
- package/corpus/core/docs/content/locales/zh-TW/sandbox-adapters.mdx +18 -7
- package/corpus/core/docs/content/locales/zh-TW/security.mdx +8 -0
- package/corpus/core/docs/content/package-lifecycle.mdx +51 -0
- package/corpus/core/docs/content/sandbox-adapters.mdx +16 -5
- package/corpus/core/package.json +11 -2
- package/corpus/core/src/a2a/auth-policy.ts +33 -0
- package/corpus/core/src/a2a/client.ts +11 -1
- package/corpus/core/src/agent/durable-background.ts +15 -7
- package/corpus/core/src/agent/production-agent.ts +87 -27
- package/corpus/core/src/agent/run-store.ts +13 -4
- package/corpus/core/src/agent/thread-data-builder.ts +7 -5
- package/corpus/core/src/audit/actions/export-audit-events.ts +162 -0
- package/corpus/core/src/audit/store.ts +8 -3
- package/corpus/core/src/audit/types.ts +3 -0
- package/corpus/core/src/chat-threads/store.ts +20 -1
- package/corpus/core/src/cli/code-agent-executor.ts +1 -0
- package/corpus/core/src/cli/code-agent-runs.ts +14 -0
- package/corpus/core/src/cli/doctor.ts +396 -0
- package/corpus/core/src/cli/index.ts +56 -0
- package/corpus/core/src/cli/info.ts +3 -3
- package/corpus/core/src/cli/package-lifecycle.ts +821 -0
- package/corpus/core/src/client/AgentPanel.tsx +32 -25
- package/corpus/core/src/client/AssistantChat.tsx +36 -20
- package/corpus/core/src/client/MultiTabAssistantChat.tsx +141 -90
- package/corpus/core/src/client/agent-chat-adapter.ts +9 -9
- package/corpus/core/src/client/chat/ChatHistoryList.tsx +404 -0
- package/corpus/core/src/client/chat/index.ts +6 -0
- package/corpus/core/src/client/chat/tool-call-display.tsx +37 -3
- package/corpus/core/src/client/code-agent-chat-adapter.ts +72 -4
- package/corpus/core/src/client/composer/RealtimeVoiceMode.tsx +52 -11
- package/corpus/core/src/client/composer/TiptapComposer.tsx +157 -20
- package/corpus/core/src/client/composer/VoiceButton.tsx +28 -0
- package/corpus/core/src/client/composer/useRealtimeVoiceMode.tsx +5 -0
- package/corpus/core/src/client/conversation/code-agent-transcript.ts +4 -5
- package/corpus/core/src/client/guided-questions.tsx +2 -1
- package/corpus/core/src/client/index.ts +11 -0
- package/corpus/core/src/client/use-chat-threads.ts +10 -1
- package/corpus/core/src/client/voice-provider-status.ts +44 -0
- package/corpus/core/src/code-agents/transcript-normalizer.ts +76 -0
- package/corpus/core/src/deploy/build.ts +12 -11
- package/corpus/core/src/guards/db-tool-scoping.ts +129 -0
- package/corpus/core/src/guards/index.ts +23 -0
- package/corpus/core/src/guards/no-drizzle-push.ts +116 -0
- package/corpus/core/src/guards/no-env-credentials.ts +229 -0
- package/corpus/core/src/guards/no-env-mutation.ts +114 -0
- package/corpus/core/src/guards/no-localhost-fallback.ts +124 -0
- package/corpus/core/src/guards/no-unscoped-credentials.ts +227 -0
- package/corpus/core/src/guards/no-unscoped-queries.ts +834 -0
- package/corpus/core/src/guards/scan-utils.ts +105 -0
- package/corpus/core/src/guards/types.ts +30 -0
- package/corpus/core/src/integrations/a2a-continuation-processor.ts +35 -5
- package/corpus/core/src/integrations/adapters/slack.ts +74 -21
- package/corpus/core/src/integrations/webhook-handler.ts +14 -0
- package/corpus/core/src/localization/default-messages.ts +6 -0
- package/corpus/core/src/observability/hosted-model-experiment.ts +118 -0
- package/corpus/core/src/observability/routes.ts +17 -0
- package/corpus/core/src/observability/store.ts +4 -1
- package/corpus/core/src/observability/traces.ts +41 -2
- package/corpus/core/src/org/accept-pending.ts +9 -1
- package/corpus/core/src/org/migrations.ts +41 -0
- package/corpus/core/src/package-lifecycle/index.ts +1 -0
- package/corpus/core/src/package-lifecycle/manifest.ts +120 -0
- package/corpus/core/src/provider-api/custom-registry.ts +56 -0
- package/corpus/core/src/provider-api/index.ts +2 -0
- package/corpus/core/src/scripts/agent-engines/list-agent-engines.ts +19 -1
- package/corpus/core/src/scripts/call-agent.ts +53 -3
- package/corpus/core/src/scripts/chat/search-chats.ts +11 -8
- package/corpus/core/src/secrets/register-framework-secrets.ts +1 -1
- package/corpus/core/src/secrets/storage.ts +47 -27
- package/corpus/core/src/server/action-discovery.ts +4 -0
- package/corpus/core/src/server/agent-chat-plugin.ts +95 -18
- package/corpus/core/src/server/core-routes-plugin.ts +45 -14
- package/corpus/core/src/server/csrf.ts +24 -5
- package/corpus/core/src/server/framework-request-handler.ts +34 -0
- package/corpus/core/src/server/google-realtime-session.ts +1 -36
- package/corpus/core/src/server/poll.ts +24 -2
- package/corpus/core/src/server/realtime-voice.ts +80 -24
- package/corpus/core/src/server/request-origin.ts +63 -0
- package/corpus/core/src/server/transcribe-voice.ts +1 -50
- package/corpus/core/src/server/voice-providers-status.ts +4 -3
- package/corpus/core/src/shared/cache-control.ts +2 -8
- package/corpus/core/src/styles/agent-native.css +1 -0
- package/corpus/core/src/styles/chat-history-list.css +313 -0
- package/corpus/core/src/templates/default/package.json +2 -2
- package/corpus/core/src/templates/headless/package.json +0 -1
- package/corpus/core/src/templates/workspace-core/.agents/skills/audit-log/SKILL.md +3 -0
- package/corpus/core/src/templates/workspace-core/.agents/skills/automations/SKILL.md +1 -1
- package/corpus/core/src/templates/workspace-core/.agents/skills/observability/SKILL.md +20 -0
- package/corpus/core/src/templates/workspace-core/.agents/skills/voice-transcription/SKILL.md +8 -4
- package/corpus/core/src/templates/workspace-core/package.json +0 -1
- package/corpus/core/src/templates/workspace-root/package.json +0 -1
- package/corpus/core/src/triggers/actions.ts +11 -3
- package/corpus/core/src/triggers/types.ts +7 -1
- package/corpus/core/src/vite/client.ts +1 -0
- package/corpus/templates/analytics/AGENTS.md +7 -0
- package/corpus/templates/analytics/actions/bigquery.ts +26 -2
- package/corpus/templates/analytics/actions/compose-dashboard.ts +65 -37
- package/corpus/templates/analytics/actions/data-source-status.ts +18 -0
- package/corpus/templates/analytics/actions/mutate-dashboard.ts +73 -24
- package/corpus/templates/analytics/actions/reorder-dashboard-panels.ts +16 -13
- package/corpus/templates/analytics/actions/update-dashboard.ts +53 -42
- package/corpus/templates/analytics/app/components/layout/Sidebar.tsx +5 -4
- package/corpus/templates/analytics/app/global.css +10 -0
- package/corpus/templates/analytics/app/pages/Ask.tsx +25 -2
- package/corpus/templates/analytics/changelog/2026-07-10-analytics-answers-simple-time-bounded-metrics-without-unnece.md +6 -0
- package/corpus/templates/analytics/changelog/2026-07-10-analytics-chat-reliably-uses-connected-data-sources-across-s.md +6 -0
- package/corpus/templates/analytics/changelog/2026-07-10-chat-threads-now-stay-clear-of-top-actions-and-fade-smoothly.md +6 -0
- package/corpus/templates/analytics/changelog/2026-07-10-context-chips-can-now-be-selected-and-removed-one-at-a-time-.md +6 -0
- package/corpus/templates/analytics/changelog/2026-07-10-dashboard-edits-from-the-agent-and-the-ui-at-the-same-time-n.md +6 -0
- package/corpus/templates/analytics/changelog/2026-07-10-the-ask-composer-no-longer-carries-dashboard-or-panel-contex.md +6 -0
- package/corpus/templates/analytics/changelog/2026-07-10-the-ask-section-stays-highlighted-while-its-chat-history-is-.md +6 -0
- package/corpus/templates/analytics/changelog/2026-07-10-timed-out-bigquery-jobs-are-now-cancelled-so-they-stop-consu.md +6 -0
- package/corpus/templates/analytics/package.json +1 -2
- package/corpus/templates/analytics/server/lib/bigquery.ts +91 -14
- package/corpus/templates/analytics/server/lib/dashboards-store.ts +154 -11
- package/corpus/templates/analytics/server/plugins/agent-chat.ts +82 -7
- package/corpus/templates/assets/package.json +1 -2
- package/corpus/templates/brain/package.json +1 -2
- package/corpus/templates/calendar/package.json +1 -2
- package/corpus/templates/chat/package.json +1 -2
- package/corpus/templates/clips/changelog/2026-07-10-atomic-view-tracking.md +6 -0
- package/corpus/templates/clips/chrome-extension/package.json +3 -2
- package/corpus/templates/clips/desktop/package.json +6 -4
- package/corpus/templates/clips/desktop/src/lib/recorder.ts +26 -13
- package/corpus/templates/clips/desktop/src/lib/voice-dictation.ts +4 -1
- package/corpus/templates/clips/package.json +1 -2
- package/corpus/templates/clips/server/db/schema.ts +29 -17
- package/corpus/templates/clips/server/plugins/db.ts +8 -0
- package/corpus/templates/clips/server/routes/api/view-event.post.ts +260 -105
- package/corpus/templates/content/.agents/skills/notion-integration/SKILL.md +16 -0
- package/corpus/templates/content/AGENTS.md +72 -62
- package/corpus/templates/content/actions/_content-database-source-adapters.ts +84 -0
- package/corpus/templates/content/actions/_database-source-utils.ts +206 -96
- package/corpus/templates/content/actions/_notion-database-source-adapter.ts +216 -0
- package/corpus/templates/content/actions/_position-utils.ts +76 -0
- package/corpus/templates/content/actions/_property-utils.ts +31 -20
- package/corpus/templates/content/actions/add-database-item.ts +52 -39
- package/corpus/templates/content/actions/attach-content-database-source.ts +95 -11
- package/corpus/templates/content/actions/change-content-database-source-role.ts +24 -1
- package/corpus/templates/content/actions/configure-document-property.ts +36 -27
- package/corpus/templates/content/actions/create-content-database.ts +40 -30
- package/corpus/templates/content/actions/create-document.ts +39 -32
- package/corpus/templates/content/actions/duplicate-document-property.ts +37 -28
- package/corpus/templates/content/actions/list-notion-database-sources.ts +80 -0
- package/corpus/templates/content/actions/move-document.ts +64 -48
- package/corpus/templates/content/actions/refresh-content-database-source.ts +42 -3
- package/corpus/templates/content/actions/share-local-file-document.ts +36 -27
- package/corpus/templates/content/actions/suggest-source-join-key.ts +39 -16
- package/corpus/templates/content/app/components/editor/database/DatabaseView.tsx +89 -23
- package/corpus/templates/content/app/components/editor/database/settings.tsx +1 -1
- package/corpus/templates/content/app/hooks/use-content-database.ts +18 -1
- package/corpus/templates/content/app/i18n/zh-TW.ts +4 -0
- package/corpus/templates/content/app/i18n-data.ts +40 -0
- package/corpus/templates/content/changelog/2026-07-10-failed-row-creation-and-source-attach-now-show-an-error-inst.md +6 -0
- package/corpus/templates/content/changelog/2026-07-10-items-added-at-the-same-time-no-longer-end-up-with-identical.md +6 -0
- package/corpus/templates/content/changelog/2026-07-10-notion-databases-can-add-read-only-details-to-content-tables.md +6 -0
- package/corpus/templates/content/package.json +1 -2
- package/corpus/templates/content/parity/matrix.md +25 -25
- package/corpus/templates/content/parity/matrix.ts +1 -0
- package/corpus/templates/content/server/routes/api/documents/[id]/move.patch.ts +43 -26
- package/corpus/templates/content/shared/api.ts +16 -1
- package/corpus/templates/design/.agents/skills/visual-edit/SKILL.md +8 -4
- package/corpus/templates/design/AGENTS.md +12 -2
- package/corpus/templates/design/DEVELOPING.md +10 -6
- package/corpus/templates/design/actions/apply-visual-edit.ts +191 -6
- package/corpus/templates/design/actions/duplicate-design.ts +31 -25
- package/corpus/templates/design/app/pages/design-editor/pending-edits.ts +5 -1
- package/corpus/templates/design/changelog/2026-07-10-duplicating-a-design-can-no-longer-produce-a-copy-with-missi.md +6 -0
- package/corpus/templates/design/changelog/2026-07-10-local-visual-edits-can-now-save-safe-leaf-text-class-and.md +6 -0
- package/corpus/templates/design/package.json +1 -1
- package/corpus/templates/design/shared/local-jsx-visual-edit.ts +388 -0
- package/corpus/templates/dispatch/package.json +1 -2
- package/corpus/templates/forms/actions/patch-form-fields.ts +82 -44
- package/corpus/templates/forms/changelog/2026-07-10-simultaneous-edits-to-different-form-fields-no-longer-overwr.md +6 -0
- package/corpus/templates/forms/package.json +1 -2
- package/corpus/templates/macros/package.json +1 -2
- package/corpus/templates/mail/app/components/email/EmailThread.tsx +3 -1
- package/corpus/templates/mail/changelog/2026-07-10-fixed-calendar-rsvp-buttons-in-emails-firing-duplicate-respo.md +6 -0
- package/corpus/templates/mail/package.json +1 -2
- package/corpus/templates/plan/actions/restore-plan-version.ts +126 -96
- package/corpus/templates/plan/changelog/2026-07-10-restoring-a-plan-version-can-no-longer-leave-a-plan-half-res.md +6 -0
- package/corpus/templates/plan/package.json +1 -2
- package/corpus/templates/plan/server/plans.ts +9 -2
- package/corpus/templates/slides/actions/list-decks.ts +28 -0
- package/corpus/templates/slides/app/components/deck/MermaidRenderer.tsx +41 -26
- package/corpus/templates/slides/app/components/design-system/DesignSystemSetup.tsx +4 -8
- package/corpus/templates/slides/app/components/editor/EditorSidebar.tsx +2 -4
- package/corpus/templates/slides/app/components/editor/EditorToolbar.tsx +4 -8
- package/corpus/templates/slides/app/components/editor/ExportMenu.tsx +5 -12
- package/corpus/templates/slides/app/components/editor/HistoryPanel.tsx +3 -6
- package/corpus/templates/slides/app/components/editor/ImageDropPromptPopover.tsx +3 -6
- package/corpus/templates/slides/app/components/editor/PromptDialog.tsx +2 -5
- package/corpus/templates/slides/app/context/DeckContext.tsx +47 -4
- package/corpus/templates/slides/app/pages/DeckEditor.tsx +11 -30
- package/corpus/templates/slides/app/pages/Index.tsx +2 -3
- package/corpus/templates/slides/app/root.tsx +0 -5
- package/corpus/templates/slides/changelog/2026-07-10-deck-lists-load-much-faster-and-no-longer-re-download-slide-.md +6 -0
- package/corpus/templates/slides/package.json +1 -2
- package/dist/a2a/auth-policy.d.ts +19 -0
- package/dist/a2a/auth-policy.d.ts.map +1 -1
- package/dist/a2a/auth-policy.js +32 -0
- package/dist/a2a/auth-policy.js.map +1 -1
- package/dist/a2a/client.d.ts +7 -0
- package/dist/a2a/client.d.ts.map +1 -1
- package/dist/a2a/client.js +2 -1
- package/dist/a2a/client.js.map +1 -1
- package/dist/agent/durable-background.d.ts +8 -5
- package/dist/agent/durable-background.d.ts.map +1 -1
- package/dist/agent/durable-background.js +15 -8
- package/dist/agent/durable-background.js.map +1 -1
- package/dist/agent/production-agent.d.ts +6 -0
- package/dist/agent/production-agent.d.ts.map +1 -1
- package/dist/agent/production-agent.js +63 -26
- package/dist/agent/production-agent.js.map +1 -1
- package/dist/agent/run-store.d.ts.map +1 -1
- package/dist/agent/run-store.js +9 -4
- package/dist/agent/run-store.js.map +1 -1
- package/dist/agent/thread-data-builder.d.ts +1 -0
- package/dist/agent/thread-data-builder.d.ts.map +1 -1
- package/dist/agent/thread-data-builder.js +6 -5
- package/dist/agent/thread-data-builder.js.map +1 -1
- package/dist/audit/actions/export-audit-events.d.ts +27 -0
- package/dist/audit/actions/export-audit-events.d.ts.map +1 -0
- package/dist/audit/actions/export-audit-events.js +144 -0
- package/dist/audit/actions/export-audit-events.js.map +1 -0
- package/dist/audit/store.d.ts +1 -0
- package/dist/audit/store.d.ts.map +1 -1
- package/dist/audit/store.js +8 -3
- package/dist/audit/store.js.map +1 -1
- package/dist/audit/types.d.ts +3 -0
- package/dist/audit/types.d.ts.map +1 -1
- package/dist/audit/types.js.map +1 -1
- package/dist/chat-threads/store.d.ts +10 -0
- package/dist/chat-threads/store.d.ts.map +1 -1
- package/dist/chat-threads/store.js +6 -0
- package/dist/chat-threads/store.js.map +1 -1
- package/dist/cli/code-agent-executor.d.ts.map +1 -1
- package/dist/cli/code-agent-executor.js +1 -0
- package/dist/cli/code-agent-executor.js.map +1 -1
- package/dist/cli/code-agent-runs.d.ts +12 -0
- package/dist/cli/code-agent-runs.d.ts.map +1 -1
- package/dist/cli/code-agent-runs.js +1 -0
- package/dist/cli/code-agent-runs.js.map +1 -1
- package/dist/cli/doctor.d.ts +83 -0
- package/dist/cli/doctor.d.ts.map +1 -0
- package/dist/cli/doctor.js +277 -0
- package/dist/cli/doctor.js.map +1 -0
- package/dist/cli/index.js +50 -0
- package/dist/cli/index.js.map +1 -1
- package/dist/cli/info.js +3 -3
- package/dist/cli/info.js.map +1 -1
- package/dist/cli/package-lifecycle.d.ts +50 -0
- package/dist/cli/package-lifecycle.d.ts.map +1 -0
- package/dist/cli/package-lifecycle.js +560 -0
- package/dist/cli/package-lifecycle.js.map +1 -0
- package/dist/client/AgentPanel.d.ts.map +1 -1
- package/dist/client/AgentPanel.js +3 -3
- package/dist/client/AgentPanel.js.map +1 -1
- package/dist/client/AssistantChat.d.ts +11 -0
- package/dist/client/AssistantChat.d.ts.map +1 -1
- package/dist/client/AssistantChat.js +7 -4
- package/dist/client/AssistantChat.js.map +1 -1
- package/dist/client/MultiTabAssistantChat.d.ts.map +1 -1
- package/dist/client/MultiTabAssistantChat.js +83 -10
- package/dist/client/MultiTabAssistantChat.js.map +1 -1
- package/dist/client/agent-chat-adapter.js +7 -3
- package/dist/client/agent-chat-adapter.js.map +1 -1
- package/dist/client/chat/ChatHistoryList.d.ts +88 -0
- package/dist/client/chat/ChatHistoryList.d.ts.map +1 -0
- package/dist/client/chat/ChatHistoryList.js +83 -0
- package/dist/client/chat/ChatHistoryList.js.map +1 -0
- package/dist/client/chat/index.d.ts +1 -0
- package/dist/client/chat/index.d.ts.map +1 -1
- package/dist/client/chat/index.js +1 -0
- package/dist/client/chat/index.js.map +1 -1
- package/dist/client/chat/tool-call-display.d.ts +13 -1
- package/dist/client/chat/tool-call-display.d.ts.map +1 -1
- package/dist/client/chat/tool-call-display.js +10 -2
- package/dist/client/chat/tool-call-display.js.map +1 -1
- package/dist/client/code-agent-chat-adapter.d.ts +17 -1
- package/dist/client/code-agent-chat-adapter.d.ts.map +1 -1
- package/dist/client/code-agent-chat-adapter.js +47 -3
- package/dist/client/code-agent-chat-adapter.js.map +1 -1
- package/dist/client/composer/RealtimeVoiceMode.d.ts +11 -1
- package/dist/client/composer/RealtimeVoiceMode.d.ts.map +1 -1
- package/dist/client/composer/RealtimeVoiceMode.js +5 -3
- package/dist/client/composer/RealtimeVoiceMode.js.map +1 -1
- package/dist/client/composer/TiptapComposer.d.ts +25 -2
- package/dist/client/composer/TiptapComposer.d.ts.map +1 -1
- package/dist/client/composer/TiptapComposer.js +96 -5
- package/dist/client/composer/TiptapComposer.js.map +1 -1
- package/dist/client/composer/VoiceButton.d.ts.map +1 -1
- package/dist/client/composer/VoiceButton.js +21 -1
- package/dist/client/composer/VoiceButton.js.map +1 -1
- package/dist/client/composer/useRealtimeVoiceMode.d.ts.map +1 -1
- package/dist/client/composer/useRealtimeVoiceMode.js +5 -0
- package/dist/client/composer/useRealtimeVoiceMode.js.map +1 -1
- package/dist/client/conversation/code-agent-transcript.d.ts +2 -0
- package/dist/client/conversation/code-agent-transcript.d.ts.map +1 -1
- package/dist/client/conversation/code-agent-transcript.js +3 -5
- package/dist/client/conversation/code-agent-transcript.js.map +1 -1
- package/dist/client/guided-questions.d.ts.map +1 -1
- package/dist/client/guided-questions.js +2 -1
- package/dist/client/guided-questions.js.map +1 -1
- package/dist/client/index.d.ts +3 -1
- package/dist/client/index.d.ts.map +1 -1
- package/dist/client/index.js +3 -1
- package/dist/client/index.js.map +1 -1
- package/dist/client/use-chat-threads.d.ts.map +1 -1
- package/dist/client/use-chat-threads.js +9 -1
- package/dist/client/use-chat-threads.js.map +1 -1
- package/dist/client/voice-provider-status.d.ts +10 -0
- package/dist/client/voice-provider-status.d.ts.map +1 -0
- package/dist/client/voice-provider-status.js +32 -0
- package/dist/client/voice-provider-status.js.map +1 -0
- package/dist/code-agents/transcript-normalizer.d.ts +29 -0
- package/dist/code-agents/transcript-normalizer.d.ts.map +1 -1
- package/dist/code-agents/transcript-normalizer.js +55 -0
- package/dist/code-agents/transcript-normalizer.js.map +1 -1
- package/dist/collab/routes.d.ts +1 -1
- package/dist/deploy/build.d.ts.map +1 -1
- package/dist/deploy/build.js +13 -11
- package/dist/deploy/build.js.map +1 -1
- package/dist/guards/db-tool-scoping.d.ts +38 -0
- package/dist/guards/db-tool-scoping.d.ts.map +1 -0
- package/dist/guards/db-tool-scoping.js +114 -0
- package/dist/guards/db-tool-scoping.js.map +1 -0
- package/dist/guards/index.d.ts +23 -0
- package/dist/guards/index.d.ts.map +1 -0
- package/dist/guards/index.js +19 -0
- package/dist/guards/index.js.map +1 -0
- package/dist/guards/no-drizzle-push.d.ts +14 -0
- package/dist/guards/no-drizzle-push.d.ts.map +1 -0
- package/dist/guards/no-drizzle-push.js +97 -0
- package/dist/guards/no-drizzle-push.js.map +1 -0
- package/dist/guards/no-env-credentials.d.ts +36 -0
- package/dist/guards/no-env-credentials.d.ts.map +1 -0
- package/dist/guards/no-env-credentials.js +204 -0
- package/dist/guards/no-env-credentials.js.map +1 -0
- package/dist/guards/no-env-mutation.d.ts +23 -0
- package/dist/guards/no-env-mutation.d.ts.map +1 -0
- package/dist/guards/no-env-mutation.js +90 -0
- package/dist/guards/no-env-mutation.js.map +1 -0
- package/dist/guards/no-localhost-fallback.d.ts +30 -0
- package/dist/guards/no-localhost-fallback.d.ts.map +1 -0
- package/dist/guards/no-localhost-fallback.js +105 -0
- package/dist/guards/no-localhost-fallback.js.map +1 -0
- package/dist/guards/no-unscoped-credentials.d.ts +28 -0
- package/dist/guards/no-unscoped-credentials.d.ts.map +1 -0
- package/dist/guards/no-unscoped-credentials.js +199 -0
- package/dist/guards/no-unscoped-credentials.js.map +1 -0
- package/dist/guards/no-unscoped-queries.d.ts +32 -0
- package/dist/guards/no-unscoped-queries.d.ts.map +1 -0
- package/dist/guards/no-unscoped-queries.js +720 -0
- package/dist/guards/no-unscoped-queries.js.map +1 -0
- package/dist/guards/scan-utils.d.ts +28 -0
- package/dist/guards/scan-utils.d.ts.map +1 -0
- package/dist/guards/scan-utils.js +92 -0
- package/dist/guards/scan-utils.js.map +1 -0
- package/dist/guards/types.d.ts +28 -0
- package/dist/guards/types.d.ts.map +1 -0
- package/dist/guards/types.js +11 -0
- package/dist/guards/types.js.map +1 -0
- package/dist/integrations/a2a-continuation-processor.d.ts.map +1 -1
- package/dist/integrations/a2a-continuation-processor.js +25 -5
- package/dist/integrations/a2a-continuation-processor.js.map +1 -1
- package/dist/integrations/adapters/slack.d.ts.map +1 -1
- package/dist/integrations/adapters/slack.js +55 -21
- package/dist/integrations/adapters/slack.js.map +1 -1
- package/dist/integrations/webhook-handler.d.ts.map +1 -1
- package/dist/integrations/webhook-handler.js +11 -0
- package/dist/integrations/webhook-handler.js.map +1 -1
- package/dist/localization/default-messages.d.ts +5 -0
- package/dist/localization/default-messages.d.ts.map +1 -1
- package/dist/localization/default-messages.js +5 -0
- package/dist/localization/default-messages.js.map +1 -1
- package/dist/notifications/routes.d.ts +2 -2
- package/dist/observability/hosted-model-experiment.d.ts +39 -0
- package/dist/observability/hosted-model-experiment.d.ts.map +1 -0
- package/dist/observability/hosted-model-experiment.js +90 -0
- package/dist/observability/hosted-model-experiment.js.map +1 -0
- package/dist/observability/routes.d.ts +1 -1
- package/dist/observability/routes.d.ts.map +1 -1
- package/dist/observability/routes.js +16 -0
- package/dist/observability/routes.js.map +1 -1
- package/dist/observability/store.d.ts.map +1 -1
- package/dist/observability/store.js +4 -1
- package/dist/observability/store.js.map +1 -1
- package/dist/observability/traces.d.ts +6 -0
- package/dist/observability/traces.d.ts.map +1 -1
- package/dist/observability/traces.js +28 -2
- package/dist/observability/traces.js.map +1 -1
- package/dist/org/accept-pending.d.ts.map +1 -1
- package/dist/org/accept-pending.js +9 -1
- package/dist/org/accept-pending.js.map +1 -1
- package/dist/org/migrations.d.ts +7 -2
- package/dist/org/migrations.d.ts.map +1 -1
- package/dist/org/migrations.js +41 -0
- package/dist/org/migrations.js.map +1 -1
- package/dist/package-lifecycle/index.d.ts +2 -0
- package/dist/package-lifecycle/index.d.ts.map +1 -0
- package/dist/package-lifecycle/index.js +2 -0
- package/dist/package-lifecycle/index.js.map +1 -0
- package/dist/package-lifecycle/manifest.d.ts +24 -0
- package/dist/package-lifecycle/manifest.d.ts.map +1 -0
- package/dist/package-lifecycle/manifest.js +81 -0
- package/dist/package-lifecycle/manifest.js.map +1 -0
- package/dist/progress/routes.d.ts +1 -1
- package/dist/provider-api/custom-registry.d.ts +32 -1
- package/dist/provider-api/custom-registry.d.ts.map +1 -1
- package/dist/provider-api/custom-registry.js +41 -1
- package/dist/provider-api/custom-registry.js.map +1 -1
- package/dist/provider-api/index.d.ts +1 -1
- package/dist/provider-api/index.d.ts.map +1 -1
- package/dist/provider-api/index.js +1 -1
- package/dist/provider-api/index.js.map +1 -1
- package/dist/resources/handlers.d.ts +1 -1
- package/dist/scripts/agent-engines/list-agent-engines.d.ts.map +1 -1
- package/dist/scripts/agent-engines/list-agent-engines.js +19 -1
- package/dist/scripts/agent-engines/list-agent-engines.js.map +1 -1
- package/dist/scripts/call-agent.d.ts.map +1 -1
- package/dist/scripts/call-agent.js +43 -3
- package/dist/scripts/call-agent.js.map +1 -1
- package/dist/scripts/chat/search-chats.d.ts +1 -1
- package/dist/scripts/chat/search-chats.d.ts.map +1 -1
- package/dist/scripts/chat/search-chats.js +11 -8
- package/dist/scripts/chat/search-chats.js.map +1 -1
- package/dist/secrets/register-framework-secrets.js +1 -1
- package/dist/secrets/register-framework-secrets.js.map +1 -1
- package/dist/secrets/storage.d.ts.map +1 -1
- package/dist/secrets/storage.js +45 -27
- package/dist/secrets/storage.js.map +1 -1
- package/dist/server/action-discovery.d.ts.map +1 -1
- package/dist/server/action-discovery.js +4 -0
- package/dist/server/action-discovery.js.map +1 -1
- package/dist/server/agent-chat-plugin.d.ts +11 -0
- package/dist/server/agent-chat-plugin.d.ts.map +1 -1
- package/dist/server/agent-chat-plugin.js +74 -19
- 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/core-routes-plugin.d.ts +3 -0
- package/dist/server/core-routes-plugin.d.ts.map +1 -1
- package/dist/server/core-routes-plugin.js +36 -12
- package/dist/server/core-routes-plugin.js.map +1 -1
- package/dist/server/csrf.d.ts.map +1 -1
- package/dist/server/csrf.js +18 -5
- package/dist/server/csrf.js.map +1 -1
- package/dist/server/framework-request-handler.d.ts.map +1 -1
- package/dist/server/framework-request-handler.js +34 -0
- package/dist/server/framework-request-handler.js.map +1 -1
- package/dist/server/google-realtime-session.d.ts.map +1 -1
- package/dist/server/google-realtime-session.js +2 -34
- package/dist/server/google-realtime-session.js.map +1 -1
- package/dist/server/poll.d.ts.map +1 -1
- package/dist/server/poll.js +24 -2
- package/dist/server/poll.js.map +1 -1
- package/dist/server/realtime-voice.d.ts.map +1 -1
- package/dist/server/realtime-voice.js +64 -21
- package/dist/server/realtime-voice.js.map +1 -1
- package/dist/server/request-origin.d.ts +10 -0
- package/dist/server/request-origin.d.ts.map +1 -0
- package/dist/server/request-origin.js +60 -0
- package/dist/server/request-origin.js.map +1 -0
- package/dist/server/transcribe-voice.d.ts.map +1 -1
- package/dist/server/transcribe-voice.js +2 -48
- package/dist/server/transcribe-voice.js.map +1 -1
- package/dist/server/voice-providers-status.d.ts.map +1 -1
- package/dist/server/voice-providers-status.js +2 -3
- package/dist/server/voice-providers-status.js.map +1 -1
- package/dist/shared/cache-control.d.ts +4 -6
- package/dist/shared/cache-control.d.ts.map +1 -1
- package/dist/shared/cache-control.js +2 -7
- package/dist/shared/cache-control.js.map +1 -1
- package/dist/styles/agent-native.css +1 -0
- package/dist/styles/chat-history-list.css +313 -0
- package/dist/templates/default/package.json +2 -2
- package/dist/templates/headless/package.json +0 -1
- package/dist/templates/workspace-core/.agents/skills/audit-log/SKILL.md +3 -0
- package/dist/templates/workspace-core/.agents/skills/automations/SKILL.md +1 -1
- package/dist/templates/workspace-core/.agents/skills/observability/SKILL.md +20 -0
- package/dist/templates/workspace-core/.agents/skills/voice-transcription/SKILL.md +8 -4
- package/dist/templates/workspace-core/package.json +0 -1
- package/dist/templates/workspace-root/package.json +0 -1
- package/dist/triggers/actions.d.ts.map +1 -1
- package/dist/triggers/actions.js +8 -3
- package/dist/triggers/actions.js.map +1 -1
- package/dist/triggers/types.d.ts +7 -1
- package/dist/triggers/types.d.ts.map +1 -1
- package/dist/triggers/types.js.map +1 -1
- package/dist/vite/client.d.ts.map +1 -1
- package/dist/vite/client.js +1 -0
- package/dist/vite/client.js.map +1 -1
- package/docs/content/audit-log.mdx +2 -1
- package/docs/content/automations.mdx +7 -7
- package/docs/content/creating-templates.mdx +1 -1
- package/docs/content/internationalization.mdx +2 -1
- package/docs/content/locales/ar-SA/audit-log.mdx +2 -1
- package/docs/content/locales/ar-SA/automations.mdx +7 -7
- package/docs/content/locales/ar-SA/getting-started.mdx +7 -1
- package/docs/content/locales/ar-SA/internationalization.mdx +1 -1
- package/docs/content/locales/ar-SA/package-lifecycle.mdx +19 -0
- package/docs/content/locales/ar-SA/sandbox-adapters.mdx +18 -7
- package/docs/content/locales/ar-SA/security.mdx +8 -0
- package/docs/content/locales/de-DE/audit-log.mdx +2 -1
- package/docs/content/locales/de-DE/automations.mdx +7 -7
- package/docs/content/locales/de-DE/getting-started.mdx +7 -1
- package/docs/content/locales/de-DE/internationalization.mdx +1 -1
- package/docs/content/locales/de-DE/package-lifecycle.mdx +22 -0
- package/docs/content/locales/de-DE/sandbox-adapters.mdx +18 -7
- package/docs/content/locales/de-DE/security.mdx +8 -0
- package/docs/content/locales/es-ES/audit-log.mdx +2 -1
- package/docs/content/locales/es-ES/automations.mdx +7 -7
- package/docs/content/locales/es-ES/getting-started.mdx +7 -1
- package/docs/content/locales/es-ES/internationalization.mdx +1 -1
- package/docs/content/locales/es-ES/package-lifecycle.mdx +22 -0
- package/docs/content/locales/es-ES/sandbox-adapters.mdx +18 -7
- package/docs/content/locales/es-ES/security.mdx +8 -0
- package/docs/content/locales/fr-FR/audit-log.mdx +2 -1
- package/docs/content/locales/fr-FR/automations.mdx +7 -7
- package/docs/content/locales/fr-FR/getting-started.mdx +7 -1
- package/docs/content/locales/fr-FR/internationalization.mdx +1 -1
- package/docs/content/locales/fr-FR/package-lifecycle.mdx +21 -0
- package/docs/content/locales/fr-FR/sandbox-adapters.mdx +19 -8
- package/docs/content/locales/fr-FR/security.mdx +8 -0
- package/docs/content/locales/hi-IN/audit-log.mdx +2 -1
- package/docs/content/locales/hi-IN/automations.mdx +7 -7
- package/docs/content/locales/hi-IN/getting-started.mdx +7 -1
- package/docs/content/locales/hi-IN/internationalization.mdx +1 -1
- package/docs/content/locales/hi-IN/package-lifecycle.mdx +20 -0
- package/docs/content/locales/hi-IN/sandbox-adapters.mdx +18 -7
- package/docs/content/locales/hi-IN/security.mdx +8 -0
- package/docs/content/locales/ja-JP/audit-log.mdx +2 -1
- package/docs/content/locales/ja-JP/automations.mdx +7 -7
- package/docs/content/locales/ja-JP/getting-started.mdx +7 -1
- package/docs/content/locales/ja-JP/internationalization.mdx +1 -1
- package/docs/content/locales/ja-JP/package-lifecycle.mdx +21 -0
- package/docs/content/locales/ja-JP/sandbox-adapters.mdx +17 -6
- package/docs/content/locales/ja-JP/security.mdx +8 -0
- package/docs/content/locales/ko-KR/audit-log.mdx +2 -1
- package/docs/content/locales/ko-KR/automations.mdx +7 -7
- package/docs/content/locales/ko-KR/getting-started.mdx +7 -1
- package/docs/content/locales/ko-KR/internationalization.mdx +1 -1
- package/docs/content/locales/ko-KR/package-lifecycle.mdx +20 -0
- package/docs/content/locales/ko-KR/sandbox-adapters.mdx +17 -6
- package/docs/content/locales/ko-KR/security.mdx +8 -0
- package/docs/content/locales/pt-BR/audit-log.mdx +2 -1
- package/docs/content/locales/pt-BR/automations.mdx +7 -7
- package/docs/content/locales/pt-BR/getting-started.mdx +7 -1
- package/docs/content/locales/pt-BR/internationalization.mdx +1 -1
- package/docs/content/locales/pt-BR/package-lifecycle.mdx +21 -0
- package/docs/content/locales/pt-BR/sandbox-adapters.mdx +18 -7
- package/docs/content/locales/pt-BR/security.mdx +8 -0
- package/docs/content/locales/zh-CN/audit-log.mdx +2 -1
- package/docs/content/locales/zh-CN/automations.mdx +7 -7
- package/docs/content/locales/zh-CN/getting-started.mdx +6 -4
- package/docs/content/locales/zh-CN/internationalization.mdx +1 -1
- package/docs/content/locales/zh-CN/package-lifecycle.mdx +19 -0
- package/docs/content/locales/zh-CN/sandbox-adapters.mdx +17 -6
- package/docs/content/locales/zh-CN/security.mdx +8 -0
- package/docs/content/locales/zh-TW/audit-log.mdx +2 -1
- package/docs/content/locales/zh-TW/automations.mdx +7 -7
- package/docs/content/locales/zh-TW/getting-started.mdx +6 -4
- package/docs/content/locales/zh-TW/internationalization.mdx +1 -1
- package/docs/content/locales/zh-TW/package-lifecycle.mdx +19 -0
- package/docs/content/locales/zh-TW/sandbox-adapters.mdx +18 -7
- package/docs/content/locales/zh-TW/security.mdx +8 -0
- package/docs/content/package-lifecycle.mdx +51 -0
- package/docs/content/sandbox-adapters.mdx +16 -5
- package/package.json +12 -3
- package/src/templates/default/package.json +2 -2
- package/src/templates/headless/package.json +0 -1
- package/src/templates/workspace-core/.agents/skills/audit-log/SKILL.md +3 -0
- package/src/templates/workspace-core/.agents/skills/automations/SKILL.md +1 -1
- package/src/templates/workspace-core/.agents/skills/observability/SKILL.md +20 -0
- package/src/templates/workspace-core/.agents/skills/voice-transcription/SKILL.md +8 -4
- package/src/templates/workspace-core/package.json +0 -1
- package/src/templates/workspace-root/package.json +0 -1
- package/corpus/templates/slides/app/components/ui/toast.tsx +0 -1
- package/corpus/templates/slides/app/components/ui/toaster.tsx +0 -1
- package/corpus/templates/slides/app/hooks/use-toast.ts +0 -1
|
@@ -61,6 +61,16 @@ export interface NormalizedCodeAgentToolEvent extends NormalizedCodeAgentTranscr
|
|
|
61
61
|
* it. Absent on old transcript events — UI must handle both cases.
|
|
62
62
|
*/
|
|
63
63
|
structuredMeta?: Record<string, unknown>;
|
|
64
|
+
/**
|
|
65
|
+
* Stable approval id extracted from the synthetic "Approval required..."
|
|
66
|
+
* bash result (see `requestCodeAgentApproval` in `cli/code-agent-executor.ts`)
|
|
67
|
+
* when this exact approval has not yet been resolved elsewhere in the
|
|
68
|
+
* transcript (approved / denied / allowlisted / forbidden). Consumers attach
|
|
69
|
+
* this as `approval: { approvalKey }` on the rendered tool-call content part
|
|
70
|
+
* so the shared `ApprovalAffordance` can render inline. Absent once a later
|
|
71
|
+
* transcript event records a resolution for this approval id.
|
|
72
|
+
*/
|
|
73
|
+
pendingApprovalKey?: string;
|
|
64
74
|
}
|
|
65
75
|
|
|
66
76
|
export interface NormalizedCodeAgentStatusEvent extends NormalizedCodeAgentTranscriptBase {
|
|
@@ -70,6 +80,7 @@ export interface NormalizedCodeAgentStatusEvent extends NormalizedCodeAgentTrans
|
|
|
70
80
|
statusKind: CodeAgentTranscriptEvent["kind"];
|
|
71
81
|
status?: string;
|
|
72
82
|
phase?: string;
|
|
83
|
+
signal?: CodeAgentTranscriptEvent["signal"];
|
|
73
84
|
metadata?: Record<string, unknown>;
|
|
74
85
|
}
|
|
75
86
|
|
|
@@ -82,6 +93,35 @@ export interface NormalizedCodeAgentThinkingEvent extends NormalizedCodeAgentTra
|
|
|
82
93
|
text: string;
|
|
83
94
|
}
|
|
84
95
|
|
|
96
|
+
/** Structured signal value stamped on the "no LLM provider key" status event. */
|
|
97
|
+
export const CREDENTIAL_GAP_SIGNAL: NonNullable<
|
|
98
|
+
CodeAgentTranscriptEvent["signal"]
|
|
99
|
+
> = "credential-gap";
|
|
100
|
+
|
|
101
|
+
/**
|
|
102
|
+
* Shared "credential gap" detection for code-agent transcript events and the
|
|
103
|
+
* normalized status items built from them. Prefers the structured `signal`
|
|
104
|
+
* field the executor stamps on the event (see `code-agent-executor.ts`); only
|
|
105
|
+
* falls back to matching the legacy hint text for transcripts persisted
|
|
106
|
+
* before the structured signal existed. Accepts either a raw
|
|
107
|
+
* `CodeAgentTranscriptEvent` (`message`) or a `NormalizedCodeAgentStatusEvent`
|
|
108
|
+
* (`text`), and any of the other UI-facing transcript event shapes that carry
|
|
109
|
+
* the same field names, so every consumer can share one implementation
|
|
110
|
+
* instead of re-implementing the regex.
|
|
111
|
+
*/
|
|
112
|
+
export function isCredentialGapCodeAgentEvent(event: {
|
|
113
|
+
signal?: string;
|
|
114
|
+
text?: string;
|
|
115
|
+
message?: string;
|
|
116
|
+
}): boolean {
|
|
117
|
+
if (event.signal === CREDENTIAL_GAP_SIGNAL) return true;
|
|
118
|
+
return isLegacyCredentialGapHintText(event.text ?? event.message ?? "");
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
function isLegacyCredentialGapHintText(value: string): boolean {
|
|
122
|
+
return /No LLM provider key was found|Missing credentials/i.test(value);
|
|
123
|
+
}
|
|
124
|
+
|
|
85
125
|
export function normalizeCodeAgentTranscript(
|
|
86
126
|
events: readonly CodeAgentTranscriptEvent[],
|
|
87
127
|
): NormalizedCodeAgentTranscript {
|
|
@@ -148,6 +188,7 @@ export function normalizeCodeAgentTranscript(
|
|
|
148
188
|
hiddenEvents.sort(
|
|
149
189
|
(a, b) => (eventOrder.get(a.id) ?? 0) - (eventOrder.get(b.id) ?? 0),
|
|
150
190
|
);
|
|
191
|
+
applyPendingCodeAgentApprovalKeys(dedupedItems, events);
|
|
151
192
|
|
|
152
193
|
return {
|
|
153
194
|
items: dedupedItems,
|
|
@@ -156,6 +197,40 @@ export function normalizeCodeAgentTranscript(
|
|
|
156
197
|
};
|
|
157
198
|
}
|
|
158
199
|
|
|
200
|
+
/**
|
|
201
|
+
* Stamp `pendingApprovalKey` onto completed bash tool events whose synthetic
|
|
202
|
+
* result carries an "Approval id: {id}" marker (see `requestCodeAgentApproval`
|
|
203
|
+
* in `cli/code-agent-executor.ts`), unless a later raw event already recorded
|
|
204
|
+
* a resolution for that same id (approved / denied / allowlisted-and-run /
|
|
205
|
+
* forbidden — all stamp `metadata.approvalId`).
|
|
206
|
+
*
|
|
207
|
+
* Resolution lookup scans the *raw* event stream rather than the normalized
|
|
208
|
+
* items: resolution status events are intentionally low-signal (they read as
|
|
209
|
+
* "status: running") and get folded into `hiddenEvents` by
|
|
210
|
+
* `isLowSignalLifecycleEvent`, so they would not otherwise be visible here.
|
|
211
|
+
*/
|
|
212
|
+
function applyPendingCodeAgentApprovalKeys(
|
|
213
|
+
items: NormalizedCodeAgentTranscriptItem[],
|
|
214
|
+
events: readonly CodeAgentTranscriptEvent[],
|
|
215
|
+
): void {
|
|
216
|
+
const resolvedApprovalIds = new Set<string>();
|
|
217
|
+
for (const event of events) {
|
|
218
|
+
const approvalId = stringMetadata(event.metadata, "approvalId");
|
|
219
|
+
if (approvalId) resolvedApprovalIds.add(approvalId);
|
|
220
|
+
}
|
|
221
|
+
for (const item of items) {
|
|
222
|
+
if (item.type !== "tool" || item.state !== "completed") continue;
|
|
223
|
+
if (typeof item.result !== "string") continue;
|
|
224
|
+
const match = CODE_AGENT_APPROVAL_ID_RESULT_PATTERN.exec(item.result);
|
|
225
|
+
const id = match?.[1];
|
|
226
|
+
if (id && !resolvedApprovalIds.has(id)) {
|
|
227
|
+
item.pendingApprovalKey = id;
|
|
228
|
+
}
|
|
229
|
+
}
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
const CODE_AGENT_APPROVAL_ID_RESULT_PATTERN = /Approval id:\s*(\S+)/;
|
|
233
|
+
|
|
159
234
|
function createUserTurn(
|
|
160
235
|
event: CodeAgentTranscriptEvent,
|
|
161
236
|
turnIndex: number,
|
|
@@ -253,6 +328,7 @@ function createStatusEvent(
|
|
|
253
328
|
statusKind: event.kind,
|
|
254
329
|
status: stringMetadata(metadata, "status"),
|
|
255
330
|
phase: stringMetadata(metadata, "phase"),
|
|
331
|
+
signal: event.signal,
|
|
256
332
|
metadata,
|
|
257
333
|
createdAt: event.createdAt,
|
|
258
334
|
updatedAt: event.createdAt,
|
|
@@ -32,7 +32,6 @@ import { normalizeAppBasePath } from "../server/app-base-path.js";
|
|
|
32
32
|
import {
|
|
33
33
|
DEFAULT_SSR_CDN_CACHE_CONTROL,
|
|
34
34
|
DEFAULT_SSR_NETLIFY_CDN_CACHE_CONTROL,
|
|
35
|
-
DEFAULT_SSR_NETLIFY_VARY,
|
|
36
35
|
DEFAULT_SPECULATION_RULES_PATH,
|
|
37
36
|
DEFAULT_SSR_CACHE_CONTROL,
|
|
38
37
|
} from "../shared/cache-control.js";
|
|
@@ -909,7 +908,6 @@ function injectHeadScript(html, script) {
|
|
|
909
908
|
const DEFAULT_SSR_CACHE_CONTROL = ${JSON.stringify(DEFAULT_SSR_CACHE_CONTROL)};
|
|
910
909
|
const DEFAULT_SSR_CDN_CACHE_CONTROL = ${JSON.stringify(DEFAULT_SSR_CDN_CACHE_CONTROL)};
|
|
911
910
|
const DEFAULT_SSR_NETLIFY_CDN_CACHE_CONTROL = ${JSON.stringify(DEFAULT_SSR_NETLIFY_CDN_CACHE_CONTROL)};
|
|
912
|
-
const DEFAULT_SSR_NETLIFY_VARY = ${JSON.stringify(DEFAULT_SSR_NETLIFY_VARY)};
|
|
913
911
|
const DEFAULT_SPECULATION_RULES_PATH = ${JSON.stringify(DEFAULT_SPECULATION_RULES_PATH)};
|
|
914
912
|
const IMMUTABLE_ASSET_CACHE_CONTROL = ${JSON.stringify(IMMUTABLE_ASSET_CACHE_CONTROL)};
|
|
915
913
|
const IMMUTABLE_ASSET_PATHS = new Set(${JSON.stringify(
|
|
@@ -986,17 +984,21 @@ function isSsrHtmlOrDataResponse(headers, status, pathname) {
|
|
|
986
984
|
/**
|
|
987
985
|
* Apply the SSR cache policy to the response headers.
|
|
988
986
|
*
|
|
989
|
-
* SSR
|
|
990
|
-
*
|
|
991
|
-
*
|
|
992
|
-
*
|
|
993
|
-
* so it is safe to hard-cache one shared copy at the edge. Do NOT reintroduce
|
|
994
|
-
* per-user / cookie-based cache variation here (no private, no no-store, no
|
|
995
|
-
* "authenticated then don't cache" branch) — that makes every logged-in
|
|
996
|
-
* visitor's pages uncacheable. Per-user state is resolved client-side instead.
|
|
987
|
+
* Unannotated SSR HTML and React Router .data responses share a public
|
|
988
|
+
* stale-while-revalidate cache policy. Preserve an explicit route policy,
|
|
989
|
+
* though: token-gated and personalized routes can opt out with private or
|
|
990
|
+
* no-store policies.
|
|
997
991
|
*/
|
|
998
992
|
function applyDefaultSsrCacheHeader(headers, status, pathname) {
|
|
999
993
|
if (!isSsrHtmlOrDataResponse(headers, status, pathname)) return;
|
|
994
|
+
// React Router marks every .data response as no-cache, but those loader
|
|
995
|
+
// payloads are safe to cache at the shared edge. Preserve only explicit
|
|
996
|
+
// private/no-store policies, which token-gated and personalized routes use
|
|
997
|
+
// to opt out of shared caching.
|
|
998
|
+
const cacheControl = headers.get("cache-control")?.toLowerCase() ?? "";
|
|
999
|
+
if (cacheControl.includes("private") || cacheControl.includes("no-store")) {
|
|
1000
|
+
return;
|
|
1001
|
+
}
|
|
1000
1002
|
|
|
1001
1003
|
headers.set("cache-control", DEFAULT_SSR_CACHE_CONTROL);
|
|
1002
1004
|
headers.set("cdn-cache-control", DEFAULT_SSR_CDN_CACHE_CONTROL);
|
|
@@ -1005,7 +1007,6 @@ function applyDefaultSsrCacheHeader(headers, status, pathname) {
|
|
|
1005
1007
|
// Netlify-specific header so SSR HTML/.data are served from the shared
|
|
1006
1008
|
// durable CDN cache instead of stampeding origin — for every visitor.
|
|
1007
1009
|
headers.set("netlify-cdn-cache-control", DEFAULT_SSR_NETLIFY_CDN_CACHE_CONTROL);
|
|
1008
|
-
headers.set("netlify-vary", DEFAULT_SSR_NETLIFY_VARY);
|
|
1009
1010
|
}
|
|
1010
1011
|
|
|
1011
1012
|
function applyDefaultSpeculationRulesHeader(headers, status, basePath) {
|
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* scanDbToolScoping — ported from `scripts/guard-db-tool-scoping.mjs`.
|
|
3
|
+
*
|
|
4
|
+
* The agent's raw DB tools (`db-query`, `db-exec`, `db-patch`) can only
|
|
5
|
+
* safely expose tables with an explicit tenant scope (`owner_email` and/or
|
|
6
|
+
* `org_id`) or a documented, reviewed exception. This guard keeps schema
|
|
7
|
+
* drift visible: any table without raw-DB scope must either add
|
|
8
|
+
* `owner_email`/`org_id`, or be added to the denylist with a
|
|
9
|
+
* reviewer-readable reason.
|
|
10
|
+
*
|
|
11
|
+
* Conditional guard — per report 005's V1 guard set table: the original
|
|
12
|
+
* walks every `templates/*\/server/db/schema.ts` and keys its denylist
|
|
13
|
+
* `"<template>:<table>"`. A generated app has exactly one
|
|
14
|
+
* `server/db/schema.ts` (confirmed convention), so this port scans that
|
|
15
|
+
* single file and uses bare `"<table>"` denylist keys. The denylist itself
|
|
16
|
+
* comes from `agent-native.json`'s `doctor.dbToolScopingDenylist` (see
|
|
17
|
+
* `../cli/doctor.ts`) — empty by default; app authors add entries with the
|
|
18
|
+
* same reviewer-readable-reason convention as the original constant.
|
|
19
|
+
*
|
|
20
|
+
* Not ported: the original also resolves `export * from
|
|
21
|
+
* "@agent-native/<pkg>/schema"` re-exports back to that package's
|
|
22
|
+
* `packages/<pkg>/src/schema/*.ts` monorepo source, so template schemas
|
|
23
|
+
* that re-export scheduling/dispatch tables get scanned too. In a
|
|
24
|
+
* generated app those packages are compiled `node_modules` output (no
|
|
25
|
+
* `.ts` source to brace-parse), and report 005's parameterization note
|
|
26
|
+
* doesn't cover that case, so re-export resolution is intentionally
|
|
27
|
+
* dropped for app mode: a re-exported table from an `@agent-native/*`
|
|
28
|
+
* package is not scanned here (false-negative, not false-positive) — see
|
|
29
|
+
* the plan's STOP-condition guidance ("report rather than invent new
|
|
30
|
+
* detection logic").
|
|
31
|
+
*/
|
|
32
|
+
|
|
33
|
+
import { readFileSafe, relPosix, walk } from "./scan-utils.js";
|
|
34
|
+
import type { GuardFinding, GuardResult, GuardScanOptions } from "./types.js";
|
|
35
|
+
|
|
36
|
+
export interface DbToolScopingOptions extends GuardScanOptions {
|
|
37
|
+
/** Table name -> reviewer-readable reason. Default `{}`. */
|
|
38
|
+
denylist?: Record<string, string>;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
interface TableCall {
|
|
42
|
+
exportName: string;
|
|
43
|
+
sqlName: string;
|
|
44
|
+
body: string;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
function extractTableCalls(contents: string): TableCall[] {
|
|
48
|
+
const out: TableCall[] = [];
|
|
49
|
+
const headerRegex =
|
|
50
|
+
/export\s+const\s+([a-zA-Z_$][\w$]*)\s*=\s*(?:[a-zA-Z_$][\w$]*Table|table)\s*\(\s*"([^"]+)"\s*,\s*\{/gm;
|
|
51
|
+
let match: RegExpExecArray | null;
|
|
52
|
+
while ((match = headerRegex.exec(contents)) !== null) {
|
|
53
|
+
const exportName = match[1];
|
|
54
|
+
const sqlName = match[2];
|
|
55
|
+
const start = headerRegex.lastIndex - 1;
|
|
56
|
+
let depth = 0;
|
|
57
|
+
let inStr: string | null = null;
|
|
58
|
+
let bodyEnd = -1;
|
|
59
|
+
for (let i = start; i < contents.length; i++) {
|
|
60
|
+
const c = contents[i];
|
|
61
|
+
const prev = contents[i - 1];
|
|
62
|
+
if (inStr) {
|
|
63
|
+
if (c === inStr && prev !== "\\") inStr = null;
|
|
64
|
+
continue;
|
|
65
|
+
}
|
|
66
|
+
if (c === '"' || c === "'" || c === "`") {
|
|
67
|
+
inStr = c;
|
|
68
|
+
continue;
|
|
69
|
+
}
|
|
70
|
+
if (c === "{") depth++;
|
|
71
|
+
else if (c === "}") {
|
|
72
|
+
depth--;
|
|
73
|
+
if (depth === 0) {
|
|
74
|
+
bodyEnd = i;
|
|
75
|
+
break;
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
if (bodyEnd === -1) continue;
|
|
80
|
+
out.push({ exportName, sqlName, body: contents.slice(start + 1, bodyEnd) });
|
|
81
|
+
}
|
|
82
|
+
return out;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
function hasRawDbScope(tableBody: string): boolean {
|
|
86
|
+
return (
|
|
87
|
+
/\.\.\.ownableColumns\s*\(/.test(tableBody) ||
|
|
88
|
+
/\b[\w$]+\s*:\s*text\s*\(\s*["']owner_email["']/.test(tableBody) ||
|
|
89
|
+
/\b[\w$]+\s*:\s*text\s*\(\s*["']org_id["']/.test(tableBody)
|
|
90
|
+
);
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
export function scanDbToolScoping(options: DbToolScopingOptions): GuardResult {
|
|
94
|
+
const { root, denylist = {} } = options;
|
|
95
|
+
const findings: GuardFinding[] = [];
|
|
96
|
+
const seenAllowed = new Set<string>();
|
|
97
|
+
|
|
98
|
+
for (const file of walk(root)) {
|
|
99
|
+
if (!file.endsWith("/server/db/schema.ts")) continue;
|
|
100
|
+
const contents = readFileSafe(file);
|
|
101
|
+
if (contents === null) continue;
|
|
102
|
+
const rel = relPosix(root, file);
|
|
103
|
+
const tables = extractTableCalls(contents);
|
|
104
|
+
for (const table of tables) {
|
|
105
|
+
if (hasRawDbScope(table.body)) continue;
|
|
106
|
+
if (Object.hasOwn(denylist, table.sqlName)) {
|
|
107
|
+
seenAllowed.add(table.sqlName);
|
|
108
|
+
continue;
|
|
109
|
+
}
|
|
110
|
+
findings.push({
|
|
111
|
+
file: rel,
|
|
112
|
+
line: 1,
|
|
113
|
+
message: `Table "${table.sqlName}" (export ${table.exportName}) has no owner_email/org_id scope and is not on the doctor.dbToolScopingDenylist — add tenant scope, or add it to agent-native.json's "doctor.dbToolScopingDenylist" with a reason.`,
|
|
114
|
+
});
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
for (const key of Object.keys(denylist)) {
|
|
119
|
+
if (!seenAllowed.has(key)) {
|
|
120
|
+
findings.push({
|
|
121
|
+
file: "agent-native.json",
|
|
122
|
+
line: 1,
|
|
123
|
+
message: `Stale doctor.dbToolScopingDenylist entry "${key}" — no matching table found in server/db/schema.ts. Remove it.`,
|
|
124
|
+
});
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
return { name: "db-tool-scoping", findings };
|
|
129
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `agent-native doctor`'s guard functions — the source-code safety
|
|
3
|
+
* invariants ported from this monorepo's `scripts/guard-*.mjs` CI guards
|
|
4
|
+
* (see report `advisor-plans/reports/005-doctor-design.md` for the
|
|
5
|
+
* classification and per-guard parameterization). Each guard is a pure,
|
|
6
|
+
* synchronous function that scans an app root and returns a `GuardResult`.
|
|
7
|
+
*
|
|
8
|
+
* `../cli/doctor.ts` is the only in-package caller; this module is also
|
|
9
|
+
* published under the `./guards` export subpath for advanced/CI use
|
|
10
|
+
* outside the CLI.
|
|
11
|
+
*/
|
|
12
|
+
|
|
13
|
+
export { scanDbToolScoping } from "./db-tool-scoping.js";
|
|
14
|
+
export type { DbToolScopingOptions } from "./db-tool-scoping.js";
|
|
15
|
+
export { scanDrizzlePush } from "./no-drizzle-push.js";
|
|
16
|
+
export { scanEnvCredentials } from "./no-env-credentials.js";
|
|
17
|
+
export { scanEnvMutation } from "./no-env-mutation.js";
|
|
18
|
+
export { scanLocalhostFallback } from "./no-localhost-fallback.js";
|
|
19
|
+
export type { LocalhostFallbackOptions } from "./no-localhost-fallback.js";
|
|
20
|
+
export { scanUnscopedCredentials } from "./no-unscoped-credentials.js";
|
|
21
|
+
export { scanUnscopedQueries } from "./no-unscoped-queries.js";
|
|
22
|
+
export type { UnscopedQueriesOptions } from "./no-unscoped-queries.js";
|
|
23
|
+
export type { GuardFinding, GuardResult, GuardScanOptions } from "./types.js";
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* scanDrizzlePush — ported from `scripts/guard-no-drizzle-push.mjs`.
|
|
3
|
+
*
|
|
4
|
+
* Refuse to let `drizzle-kit push` (or `drizzle push`) get wired into any
|
|
5
|
+
* build/deploy path (`netlify.toml`, or a `package.json` build/deploy
|
|
6
|
+
* script). Generic guard — no monorepo-specific path assumption in the
|
|
7
|
+
* original, ported as-is.
|
|
8
|
+
*
|
|
9
|
+
* Standalone `db:push` / `db:push:*` npm scripts are intentionally NOT
|
|
10
|
+
* flagged — those are explicit, human-invoked commands, not build hooks.
|
|
11
|
+
*/
|
|
12
|
+
|
|
13
|
+
import {
|
|
14
|
+
lineColForOffset,
|
|
15
|
+
readFileSafe,
|
|
16
|
+
relPosix,
|
|
17
|
+
walk,
|
|
18
|
+
} from "./scan-utils.js";
|
|
19
|
+
import type { GuardFinding, GuardResult, GuardScanOptions } from "./types.js";
|
|
20
|
+
|
|
21
|
+
const DANGEROUS_SCRIPT_HOOKS = new Set([
|
|
22
|
+
"build",
|
|
23
|
+
"prebuild",
|
|
24
|
+
"postbuild",
|
|
25
|
+
"install",
|
|
26
|
+
"preinstall",
|
|
27
|
+
"postinstall",
|
|
28
|
+
"deploy",
|
|
29
|
+
"predeploy",
|
|
30
|
+
"postdeploy",
|
|
31
|
+
"start",
|
|
32
|
+
"prestart",
|
|
33
|
+
"poststart",
|
|
34
|
+
"ci",
|
|
35
|
+
"release",
|
|
36
|
+
"prerelease",
|
|
37
|
+
"postrelease",
|
|
38
|
+
]);
|
|
39
|
+
|
|
40
|
+
const PATTERNS = [/\bdrizzle-kit\s+push\b/, /\bdrizzle\s+push\b/];
|
|
41
|
+
|
|
42
|
+
function matchesForbidden(str: unknown): str is string {
|
|
43
|
+
if (!str || typeof str !== "string") return false;
|
|
44
|
+
return PATTERNS.some((p) => p.test(str));
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
interface PackageJsonLike {
|
|
48
|
+
scripts?: Record<string, unknown>;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
export function scanDrizzlePush(options: GuardScanOptions): GuardResult {
|
|
52
|
+
const { root } = options;
|
|
53
|
+
const findings: GuardFinding[] = [];
|
|
54
|
+
|
|
55
|
+
for (const file of walk(root)) {
|
|
56
|
+
const base = file.split("/").pop() ?? file;
|
|
57
|
+
if (base === "netlify.toml") {
|
|
58
|
+
scanNetlifyToml(root, file, findings);
|
|
59
|
+
} else if (base === "package.json") {
|
|
60
|
+
scanPackageJson(root, file, findings);
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
return { name: "no-drizzle-push", findings };
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
function scanNetlifyToml(
|
|
68
|
+
root: string,
|
|
69
|
+
file: string,
|
|
70
|
+
findings: GuardFinding[],
|
|
71
|
+
): void {
|
|
72
|
+
const contents = readFileSafe(file);
|
|
73
|
+
if (contents === null || !matchesForbidden(contents)) return;
|
|
74
|
+
const lines = contents.split("\n");
|
|
75
|
+
const rel = relPosix(root, file);
|
|
76
|
+
for (let i = 0; i < lines.length; i++) {
|
|
77
|
+
if (matchesForbidden(lines[i])) {
|
|
78
|
+
findings.push({
|
|
79
|
+
file: rel,
|
|
80
|
+
line: i + 1,
|
|
81
|
+
message: `forbidden \`drizzle-kit push\` in netlify.toml: ${lines[i].trim()}`,
|
|
82
|
+
});
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
function scanPackageJson(
|
|
88
|
+
root: string,
|
|
89
|
+
file: string,
|
|
90
|
+
findings: GuardFinding[],
|
|
91
|
+
): void {
|
|
92
|
+
const contents = readFileSafe(file);
|
|
93
|
+
if (contents === null) return;
|
|
94
|
+
let json: PackageJsonLike;
|
|
95
|
+
try {
|
|
96
|
+
json = JSON.parse(contents) as PackageJsonLike;
|
|
97
|
+
} catch {
|
|
98
|
+
return;
|
|
99
|
+
}
|
|
100
|
+
const scripts = json.scripts;
|
|
101
|
+
if (!scripts || typeof scripts !== "object") return;
|
|
102
|
+
const rel = relPosix(root, file);
|
|
103
|
+
for (const [name, cmd] of Object.entries(scripts)) {
|
|
104
|
+
if (!DANGEROUS_SCRIPT_HOOKS.has(name)) continue;
|
|
105
|
+
if (matchesForbidden(cmd)) {
|
|
106
|
+
// Locate the line for a readable finding; fall back to line 1.
|
|
107
|
+
const idx = contents.indexOf(`"${name}"`);
|
|
108
|
+
const line = idx >= 0 ? lineColForOffset(contents, idx).line : 1;
|
|
109
|
+
findings.push({
|
|
110
|
+
file: rel,
|
|
111
|
+
line,
|
|
112
|
+
message: `forbidden \`drizzle-kit push\` in scripts.${name}: ${String(cmd)}`,
|
|
113
|
+
});
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
}
|
|
@@ -0,0 +1,229 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* scanEnvCredentials — ported from `scripts/guard-no-env-credentials.mjs`.
|
|
3
|
+
*
|
|
4
|
+
* User credentials are per-user (or per-org) data. They MUST live in SQL,
|
|
5
|
+
* scoped by `userEmail` / `orgId`, never in `process.env` — a deployment's
|
|
6
|
+
* env vars are shared by every signed-in user. This guard flags any
|
|
7
|
+
* `process.env.<KEY>` / `process.env["KEY"]` read whose key is not on the
|
|
8
|
+
* deploy-level allowlist (`DATABASE_URL`, `BETTER_AUTH_SECRET`, etc.), plus
|
|
9
|
+
* any dynamic `process.env[key]` read (the key is only known at runtime, so
|
|
10
|
+
* it can never be allowlisted safely).
|
|
11
|
+
*
|
|
12
|
+
* Conditional guard — per report 005's V1 guard set table, this is "the big
|
|
13
|
+
* one": the original only scans a curated set of monorepo subtrees
|
|
14
|
+
* (`packages/core/src/{credentials,secrets,vault,agent}/`, template
|
|
15
|
+
* credential libs/routes) via `FORBIDDEN_PATH_PREDICATES` — none of which
|
|
16
|
+
* exist in a generated app, so nothing would ever be scanned. This port
|
|
17
|
+
* replaces that default-allow-outside-a-curated-subtree behavior with
|
|
18
|
+
* default-deny across the whole app source tree: every `process.env.<KEY>`
|
|
19
|
+
* read anywhere in app source must be on the deploy-var allowlist (kept
|
|
20
|
+
* verbatim) or carry the opt-out marker. `HIGH_RISK_ENV_KEY_ALLOWLIST`,
|
|
21
|
+
* `HIGH_RISK_PROCESS_ENV_ALLOWLIST`, and `HIGH_RISK_ENV_VARS_WRITE_ALLOWLIST`
|
|
22
|
+
* — the three monorepo-file-keyed exception maps for specific template
|
|
23
|
+
* platform-adapter files — are dropped entirely per the report; with
|
|
24
|
+
* default-deny scanning already covering every `process.env` read
|
|
25
|
+
* everywhere, the narrower `env-config.ts`/`core-routes.ts`-specific
|
|
26
|
+
* registration checks those maps supported become redundant (any
|
|
27
|
+
* high-risk key would already be caught by the general scan) and are
|
|
28
|
+
* dropped along with them. The per-line `// guard:allow-env-credential`
|
|
29
|
+
* marker remains the only escape hatch.
|
|
30
|
+
*
|
|
31
|
+
* Opt-out (same line, or the line immediately above):
|
|
32
|
+
* process.env.SOMETHING // guard:allow-env-credential — short reason
|
|
33
|
+
*/
|
|
34
|
+
|
|
35
|
+
import {
|
|
36
|
+
lineColForOffset,
|
|
37
|
+
readFileSafe,
|
|
38
|
+
relPosix,
|
|
39
|
+
walk,
|
|
40
|
+
} from "./scan-utils.js";
|
|
41
|
+
import type { GuardFinding, GuardResult, GuardScanOptions } from "./types.js";
|
|
42
|
+
|
|
43
|
+
const ALLOWLIST_EXACT = new Set([
|
|
44
|
+
"DATABASE_URL",
|
|
45
|
+
"DATABASE_AUTH_TOKEN",
|
|
46
|
+
"NODE_ENV",
|
|
47
|
+
"CI",
|
|
48
|
+
"DEBUG",
|
|
49
|
+
"NETLIFY",
|
|
50
|
+
"VERCEL",
|
|
51
|
+
"RENDER",
|
|
52
|
+
"FLY_APP_NAME",
|
|
53
|
+
"K_SERVICE",
|
|
54
|
+
"AWS_LAMBDA_FUNCTION_NAME",
|
|
55
|
+
"BETTER_AUTH_SECRET",
|
|
56
|
+
"BETTER_AUTH_URL",
|
|
57
|
+
"NOTION_CLIENT_ID",
|
|
58
|
+
"NOTION_CLIENT_SECRET",
|
|
59
|
+
"NOTION_STATE_SECRET",
|
|
60
|
+
"GOOGLE_SIGN_IN_CLIENT_ID",
|
|
61
|
+
"GOOGLE_SIGN_IN_CLIENT_SECRET",
|
|
62
|
+
"AUTH_SECRET",
|
|
63
|
+
"A2A_SECRET",
|
|
64
|
+
"ACCESS_TOKEN",
|
|
65
|
+
"PORT",
|
|
66
|
+
"HOST",
|
|
67
|
+
"SECRETS_ENCRYPTION_KEY",
|
|
68
|
+
]);
|
|
69
|
+
|
|
70
|
+
const ALLOWLIST_PREFIX = [
|
|
71
|
+
"npm_",
|
|
72
|
+
"AGENT_NATIVE_",
|
|
73
|
+
"AGENT_",
|
|
74
|
+
"NETLIFY_",
|
|
75
|
+
"VERCEL_",
|
|
76
|
+
"CF_",
|
|
77
|
+
];
|
|
78
|
+
|
|
79
|
+
/** Dev-only paths where ANTHROPIC_API_KEY etc. may legitimately be read
|
|
80
|
+
* from env (local dev tooling, scripts, tests). Portable subset of the
|
|
81
|
+
* original — the monorepo-only `packages/core/src/dev` predicate is
|
|
82
|
+
* dropped (see report 005's V1 guard set table). */
|
|
83
|
+
const DEV_ONLY_PATH_PATTERNS = [
|
|
84
|
+
/\.spec\.[tj]sx?$/,
|
|
85
|
+
/\.test\.[tj]sx?$/,
|
|
86
|
+
/^scripts\//,
|
|
87
|
+
];
|
|
88
|
+
|
|
89
|
+
const DEV_ONLY_KEYS = new Set(["ANTHROPIC_API_KEY"]);
|
|
90
|
+
|
|
91
|
+
const OPT_OUT_MARKER = /\/\/\s*guard:allow-env-credential\b[^\n]*/;
|
|
92
|
+
const OPT_OUT_REQUIRES_REASON = /\/\/\s*guard:allow-env-credential\s*[—-]\s*\S/;
|
|
93
|
+
|
|
94
|
+
const ENV_READ_REGEX =
|
|
95
|
+
/process\.env(?:\.([A-Z][A-Z0-9_]*)|\[\s*["']([A-Z][A-Z0-9_]*)["']\s*\])/g;
|
|
96
|
+
|
|
97
|
+
const ENV_DYNAMIC_READ_REGEX =
|
|
98
|
+
/process\.env(?:\?\.)?\s*\[\s*(?!["'])([^\]\n]+?)\s*\]/g;
|
|
99
|
+
|
|
100
|
+
function isAllowlistedKey(key: string): boolean {
|
|
101
|
+
if (ALLOWLIST_EXACT.has(key)) return true;
|
|
102
|
+
return ALLOWLIST_PREFIX.some((prefix) => key.startsWith(prefix));
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
function isDevOnlyPath(rel: string): boolean {
|
|
106
|
+
return DEV_ONLY_PATH_PATTERNS.some((re) => re.test(rel));
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
function hasOptOutOnLine(lines: string[], lineIdx: number): boolean {
|
|
110
|
+
const cur = lines[lineIdx] ?? "";
|
|
111
|
+
if (OPT_OUT_MARKER.test(cur)) return true;
|
|
112
|
+
const prev = lines[lineIdx - 1] ?? "";
|
|
113
|
+
if (/^\s*\/\//.test(prev) && OPT_OUT_MARKER.test(prev)) return true;
|
|
114
|
+
return false;
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
function optOutOnLineIsValid(
|
|
118
|
+
lines: string[],
|
|
119
|
+
lineIdx: number,
|
|
120
|
+
key: string,
|
|
121
|
+
rel: string,
|
|
122
|
+
): { ok: boolean; why?: string } {
|
|
123
|
+
const cur = lines[lineIdx] ?? "";
|
|
124
|
+
const prev = lines[lineIdx - 1] ?? "";
|
|
125
|
+
const candidate = OPT_OUT_REQUIRES_REASON.test(cur)
|
|
126
|
+
? cur
|
|
127
|
+
: OPT_OUT_REQUIRES_REASON.test(prev)
|
|
128
|
+
? prev
|
|
129
|
+
: null;
|
|
130
|
+
if (!candidate) return { ok: false, why: "missing or empty reason" };
|
|
131
|
+
|
|
132
|
+
if (/dev-only\b/i.test(candidate)) {
|
|
133
|
+
if (!DEV_ONLY_KEYS.has(key)) {
|
|
134
|
+
return {
|
|
135
|
+
ok: false,
|
|
136
|
+
why: `key "${key}" is not in the dev-only credential allowlist`,
|
|
137
|
+
};
|
|
138
|
+
}
|
|
139
|
+
if (!isDevOnlyPath(rel)) {
|
|
140
|
+
return {
|
|
141
|
+
ok: false,
|
|
142
|
+
why: "dev-only opt-out used outside dev / scripts / test paths",
|
|
143
|
+
};
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
return { ok: true };
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
export function scanEnvCredentials(options: GuardScanOptions): GuardResult {
|
|
150
|
+
const { root } = options;
|
|
151
|
+
const findings: GuardFinding[] = [];
|
|
152
|
+
|
|
153
|
+
for (const file of walk(root)) {
|
|
154
|
+
if (!/\.(ts|tsx|mts|cts|js|mjs|cjs)$/.test(file)) continue;
|
|
155
|
+
if (file.endsWith(".d.ts")) continue;
|
|
156
|
+
const rel = relPosix(root, file);
|
|
157
|
+
|
|
158
|
+
const contents = readFileSafe(file);
|
|
159
|
+
if (contents === null || !contents.includes("process.env")) continue;
|
|
160
|
+
|
|
161
|
+
const lines = contents.split("\n");
|
|
162
|
+
|
|
163
|
+
ENV_READ_REGEX.lastIndex = 0;
|
|
164
|
+
let m: RegExpExecArray | null;
|
|
165
|
+
while ((m = ENV_READ_REGEX.exec(contents)) !== null) {
|
|
166
|
+
const key = m[1] ?? m[2];
|
|
167
|
+
if (!key) continue;
|
|
168
|
+
const { line } = lineColForOffset(contents, m.index);
|
|
169
|
+
const lineIdx = line - 1;
|
|
170
|
+
const lineText = lines[lineIdx] ?? "";
|
|
171
|
+
const trimmed = lineText.trimStart();
|
|
172
|
+
if (
|
|
173
|
+
trimmed.startsWith("*") ||
|
|
174
|
+
trimmed.startsWith("//") ||
|
|
175
|
+
trimmed.startsWith("/*")
|
|
176
|
+
) {
|
|
177
|
+
continue;
|
|
178
|
+
}
|
|
179
|
+
if (isAllowlistedKey(key)) continue;
|
|
180
|
+
if (hasOptOutOnLine(lines, lineIdx)) {
|
|
181
|
+
const verdict = optOutOnLineIsValid(lines, lineIdx, key, rel);
|
|
182
|
+
if (verdict.ok) continue;
|
|
183
|
+
findings.push({
|
|
184
|
+
file: rel,
|
|
185
|
+
line,
|
|
186
|
+
message: `process.env.${key} opt-out invalid: ${verdict.why}`,
|
|
187
|
+
});
|
|
188
|
+
continue;
|
|
189
|
+
}
|
|
190
|
+
findings.push({
|
|
191
|
+
file: rel,
|
|
192
|
+
line,
|
|
193
|
+
message: `process.env.${key} read — not a deploy-level allowlisted key. User credentials must be read via resolveCredential(key, { userEmail, orgId }), never process.env.`,
|
|
194
|
+
});
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
ENV_DYNAMIC_READ_REGEX.lastIndex = 0;
|
|
198
|
+
while ((m = ENV_DYNAMIC_READ_REGEX.exec(contents)) !== null) {
|
|
199
|
+
const { line } = lineColForOffset(contents, m.index);
|
|
200
|
+
const lineIdx = line - 1;
|
|
201
|
+
const lineText = lines[lineIdx] ?? "";
|
|
202
|
+
const trimmed = lineText.trimStart();
|
|
203
|
+
if (
|
|
204
|
+
trimmed.startsWith("*") ||
|
|
205
|
+
trimmed.startsWith("//") ||
|
|
206
|
+
trimmed.startsWith("/*")
|
|
207
|
+
) {
|
|
208
|
+
continue;
|
|
209
|
+
}
|
|
210
|
+
if (hasOptOutOnLine(lines, lineIdx)) {
|
|
211
|
+
const verdict = optOutOnLineIsValid(lines, lineIdx, "<dynamic>", rel);
|
|
212
|
+
if (verdict.ok) continue;
|
|
213
|
+
findings.push({
|
|
214
|
+
file: rel,
|
|
215
|
+
line,
|
|
216
|
+
message: `process.env[<dynamic>] opt-out invalid: ${verdict.why}`,
|
|
217
|
+
});
|
|
218
|
+
continue;
|
|
219
|
+
}
|
|
220
|
+
findings.push({
|
|
221
|
+
file: rel,
|
|
222
|
+
line,
|
|
223
|
+
message: `process.env[<dynamic key>] read — dynamic keys can never be allowlisted safely.`,
|
|
224
|
+
});
|
|
225
|
+
}
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
return { name: "no-env-credentials", findings };
|
|
229
|
+
}
|