@agent-native/core 0.96.0 → 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 +39 -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 +9 -2
- package/corpus/core/src/a2a/auth-policy.ts +33 -0
- package/corpus/core/src/agent/durable-background.ts +15 -7
- package/corpus/core/src/agent/run-store.ts +13 -4
- 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/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/agent-chat-adapter.ts +9 -9
- 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/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/secrets/storage.ts +47 -27
- package/corpus/core/src/server/action-discovery.ts +4 -0
- package/corpus/core/src/server/agent-chat-plugin.ts +54 -12
- package/corpus/core/src/server/core-routes-plugin.ts +30 -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 +9 -0
- package/corpus/core/src/server/request-origin.ts +63 -0
- package/corpus/core/src/server/transcribe-voice.ts +1 -50
- 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/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/templates/analytics/actions/compose-dashboard.ts +65 -37
- 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/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-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 +3 -2
- package/corpus/templates/analytics/server/lib/dashboards-store.ts +154 -11
- 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/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/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/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/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/agent-chat-adapter.js +7 -3
- package/dist/client/agent-chat-adapter.js.map +1 -1
- package/dist/collab/struct-routes.d.ts +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/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/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.map +1 -1
- package/dist/server/agent-chat-plugin.js +47 -13
- package/dist/server/agent-chat-plugin.js.map +1 -1
- package/dist/server/core-routes-plugin.d.ts.map +1 -1
- package/dist/server/core-routes-plugin.js +23 -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 +9 -0
- 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/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/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/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 +10 -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/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
|
@@ -1069,15 +1069,15 @@ function autoContinueMessage(signal: AgentAutoContinueSignal): string {
|
|
|
1069
1069
|
function delay(ms: number, abortSignal: AbortSignal): Promise<void> {
|
|
1070
1070
|
if (abortSignal.aborted) return Promise.resolve();
|
|
1071
1071
|
return new Promise((resolve) => {
|
|
1072
|
-
const
|
|
1073
|
-
|
|
1074
|
-
|
|
1075
|
-
|
|
1076
|
-
|
|
1077
|
-
|
|
1078
|
-
|
|
1079
|
-
|
|
1080
|
-
);
|
|
1072
|
+
const onAbort = () => {
|
|
1073
|
+
clearTimeout(timer);
|
|
1074
|
+
resolve();
|
|
1075
|
+
};
|
|
1076
|
+
const timer = setTimeout(() => {
|
|
1077
|
+
abortSignal.removeEventListener("abort", onAbort);
|
|
1078
|
+
resolve();
|
|
1079
|
+
}, ms);
|
|
1080
|
+
abortSignal.addEventListener("abort", onAbort, { once: true });
|
|
1081
1081
|
});
|
|
1082
1082
|
}
|
|
1083
1083
|
|
|
@@ -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
|
+
}
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* scanEnvMutation — ported from `scripts/guard-no-env-mutation.mjs`.
|
|
3
|
+
*
|
|
4
|
+
* Refuse to let production code MUTATE `process.env` (e.g.
|
|
5
|
+
* `process.env.AGENT_USER_EMAIL = userEmail`). `process.env` is
|
|
6
|
+
* process-scoped, not request-scoped — on serverless, every warm container
|
|
7
|
+
* handles many concurrent requests in one Node process, so mutating
|
|
8
|
+
* `process.env` in a request handler leaks state across requests. Use
|
|
9
|
+
* `runWithRequestContext` instead.
|
|
10
|
+
*
|
|
11
|
+
* Conditional guard — per report 005's V1 guard set table: the original
|
|
12
|
+
* has 9 `ALLOWED_PATH_PREDICATES`; 4 are monorepo-only
|
|
13
|
+
* (`packages/core/src/dev`, `templates/*\/test(s)/`, `packages/cli/`,
|
|
14
|
+
* `packages/create-agent-native/`) and dropped here. The 5 portable ones
|
|
15
|
+
* (`scripts/**`, `*.spec.*`, `*.test.*`, `/cli/`, `/scaffold/`) are kept
|
|
16
|
+
* verbatim — they already work unmodified for a generated app.
|
|
17
|
+
*
|
|
18
|
+
* Opt-out (same line, or the line immediately above):
|
|
19
|
+
* process.env.X = y // guard:allow-env-mutation — short reason
|
|
20
|
+
*/
|
|
21
|
+
|
|
22
|
+
import {
|
|
23
|
+
isCommentLine,
|
|
24
|
+
lineColForOffset,
|
|
25
|
+
readFileSafe,
|
|
26
|
+
relPosix,
|
|
27
|
+
walk,
|
|
28
|
+
} from "./scan-utils.js";
|
|
29
|
+
import type { GuardFinding, GuardResult, GuardScanOptions } from "./types.js";
|
|
30
|
+
|
|
31
|
+
const ALLOWED_PATH_PREDICATES: Array<(rel: string) => boolean> = [
|
|
32
|
+
(rel) => /^scripts\//.test(rel),
|
|
33
|
+
(rel) => /\.spec\.[tj]sx?$/.test(rel),
|
|
34
|
+
(rel) => /\.test\.[tj]sx?$/.test(rel),
|
|
35
|
+
(rel) => /\/cli\//.test(rel),
|
|
36
|
+
(rel) => /\/scaffold\//.test(rel),
|
|
37
|
+
];
|
|
38
|
+
|
|
39
|
+
const OPT_OUT_MARKER = /\/\/\s*guard:allow-env-mutation\b[^\n]*/;
|
|
40
|
+
const OPT_OUT_REQUIRES_REASON = /\/\/\s*guard:allow-env-mutation\s*[—-]\s*\S/;
|
|
41
|
+
|
|
42
|
+
const ASSIGN_TAIL = String.raw`(?:\s*(?:=(?!=)|\+=|-=|\*=|/=|\?\?=|\|\|=|&&=))`;
|
|
43
|
+
const MEMBER_FORM = new RegExp(
|
|
44
|
+
String.raw`process\.env\.[A-Z_][A-Z0-9_]*${ASSIGN_TAIL}`,
|
|
45
|
+
"g",
|
|
46
|
+
);
|
|
47
|
+
const BRACKET_FORM = new RegExp(
|
|
48
|
+
String.raw`process\.env\[\s*["'][A-Z_][A-Z0-9_]+["']\s*\]${ASSIGN_TAIL}`,
|
|
49
|
+
"g",
|
|
50
|
+
);
|
|
51
|
+
const DELETE_MEMBER_FORM = new RegExp(
|
|
52
|
+
String.raw`\bdelete\s+process\.env\.[A-Z_][A-Z0-9_]*\b`,
|
|
53
|
+
"g",
|
|
54
|
+
);
|
|
55
|
+
const DELETE_BRACKET_FORM = new RegExp(
|
|
56
|
+
String.raw`\bdelete\s+process\.env\[\s*["'][A-Z_][A-Z0-9_]+["']\s*\]`,
|
|
57
|
+
"g",
|
|
58
|
+
);
|
|
59
|
+
|
|
60
|
+
function isAllowedPath(rel: string): boolean {
|
|
61
|
+
return ALLOWED_PATH_PREDICATES.some((p) => p(rel));
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
function hasValidOptOut(lines: string[], lineIdx: number): boolean {
|
|
65
|
+
const cur = lines[lineIdx] ?? "";
|
|
66
|
+
if (OPT_OUT_MARKER.test(cur)) {
|
|
67
|
+
return OPT_OUT_REQUIRES_REASON.test(cur);
|
|
68
|
+
}
|
|
69
|
+
const prev = lines[lineIdx - 1] ?? "";
|
|
70
|
+
if (/^\s*\/\//.test(prev) && OPT_OUT_MARKER.test(prev)) {
|
|
71
|
+
return OPT_OUT_REQUIRES_REASON.test(prev);
|
|
72
|
+
}
|
|
73
|
+
return false;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
export function scanEnvMutation(options: GuardScanOptions): GuardResult {
|
|
77
|
+
const { root } = options;
|
|
78
|
+
const findings: GuardFinding[] = [];
|
|
79
|
+
|
|
80
|
+
for (const file of walk(root)) {
|
|
81
|
+
if (!/\.(ts|tsx|mts|cts|js|mjs|cjs)$/.test(file)) continue;
|
|
82
|
+
if (file.endsWith(".d.ts")) continue;
|
|
83
|
+
const rel = relPosix(root, file);
|
|
84
|
+
if (isAllowedPath(rel)) continue;
|
|
85
|
+
|
|
86
|
+
const contents = readFileSafe(file);
|
|
87
|
+
if (contents === null || !contents.includes("process.env")) continue;
|
|
88
|
+
|
|
89
|
+
const lines = contents.split("\n");
|
|
90
|
+
|
|
91
|
+
for (const re of [
|
|
92
|
+
MEMBER_FORM,
|
|
93
|
+
BRACKET_FORM,
|
|
94
|
+
DELETE_MEMBER_FORM,
|
|
95
|
+
DELETE_BRACKET_FORM,
|
|
96
|
+
]) {
|
|
97
|
+
re.lastIndex = 0;
|
|
98
|
+
let m: RegExpExecArray | null;
|
|
99
|
+
while ((m = re.exec(contents)) !== null) {
|
|
100
|
+
const { line } = lineColForOffset(contents, m.index);
|
|
101
|
+
const lineText = lines[line - 1] ?? "";
|
|
102
|
+
if (isCommentLine(lineText)) continue;
|
|
103
|
+
if (hasValidOptOut(lines, line - 1)) continue;
|
|
104
|
+
findings.push({
|
|
105
|
+
file: rel,
|
|
106
|
+
line,
|
|
107
|
+
message: `process.env mutated in production code: ${lineText.trim()}. process.env is process-scoped, not request-scoped — use runWithRequestContext instead.`,
|
|
108
|
+
});
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
return { name: "no-env-mutation", findings };
|
|
114
|
+
}
|