@agent-native/core 0.96.0 → 0.98.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 +71 -0
- package/corpus/core/docs/content/audit-log.mdx +2 -1
- package/corpus/core/docs/content/authentication.mdx +3 -3
- package/corpus/core/docs/content/automations.mdx +7 -7
- package/corpus/core/docs/content/creating-templates.mdx +1 -1
- package/corpus/core/docs/content/doctor.mdx +170 -0
- package/corpus/core/docs/content/external-agents.mdx +8 -7
- 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/authentication.mdx +2 -2
- package/corpus/core/docs/content/locales/ar-SA/automations.mdx +7 -7
- package/corpus/core/docs/content/locales/ar-SA/external-agents.mdx +8 -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/mcp-protocol.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 +10 -0
- package/corpus/core/docs/content/locales/de-DE/audit-log.mdx +2 -1
- package/corpus/core/docs/content/locales/de-DE/authentication.mdx +1 -1
- package/corpus/core/docs/content/locales/de-DE/automations.mdx +7 -7
- package/corpus/core/docs/content/locales/de-DE/external-agents.mdx +8 -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/mcp-protocol.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 +10 -0
- package/corpus/core/docs/content/locales/es-ES/audit-log.mdx +2 -1
- package/corpus/core/docs/content/locales/es-ES/authentication.mdx +2 -2
- package/corpus/core/docs/content/locales/es-ES/automations.mdx +7 -7
- package/corpus/core/docs/content/locales/es-ES/external-agents.mdx +8 -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/mcp-protocol.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 +10 -0
- package/corpus/core/docs/content/locales/fr-FR/audit-log.mdx +2 -1
- package/corpus/core/docs/content/locales/fr-FR/authentication.mdx +1 -1
- package/corpus/core/docs/content/locales/fr-FR/automations.mdx +7 -7
- package/corpus/core/docs/content/locales/fr-FR/external-agents.mdx +8 -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/mcp-protocol.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 +10 -0
- package/corpus/core/docs/content/locales/hi-IN/audit-log.mdx +2 -1
- package/corpus/core/docs/content/locales/hi-IN/authentication.mdx +2 -2
- package/corpus/core/docs/content/locales/hi-IN/automations.mdx +7 -7
- package/corpus/core/docs/content/locales/hi-IN/external-agents.mdx +8 -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/mcp-protocol.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 +10 -0
- package/corpus/core/docs/content/locales/ja-JP/audit-log.mdx +2 -1
- package/corpus/core/docs/content/locales/ja-JP/authentication.mdx +2 -2
- package/corpus/core/docs/content/locales/ja-JP/automations.mdx +7 -7
- package/corpus/core/docs/content/locales/ja-JP/external-agents.mdx +8 -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/mcp-protocol.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 +10 -0
- package/corpus/core/docs/content/locales/ko-KR/audit-log.mdx +2 -1
- package/corpus/core/docs/content/locales/ko-KR/authentication.mdx +2 -2
- package/corpus/core/docs/content/locales/ko-KR/automations.mdx +7 -7
- package/corpus/core/docs/content/locales/ko-KR/external-agents.mdx +8 -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/mcp-protocol.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 +10 -0
- package/corpus/core/docs/content/locales/pt-BR/audit-log.mdx +2 -1
- package/corpus/core/docs/content/locales/pt-BR/authentication.mdx +2 -2
- package/corpus/core/docs/content/locales/pt-BR/automations.mdx +7 -7
- package/corpus/core/docs/content/locales/pt-BR/external-agents.mdx +8 -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/mcp-protocol.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 +10 -0
- package/corpus/core/docs/content/locales/zh-CN/audit-log.mdx +2 -1
- package/corpus/core/docs/content/locales/zh-CN/authentication.mdx +2 -2
- package/corpus/core/docs/content/locales/zh-CN/automations.mdx +7 -7
- package/corpus/core/docs/content/locales/zh-CN/external-agents.mdx +8 -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/mcp-protocol.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 +10 -0
- package/corpus/core/docs/content/locales/zh-TW/audit-log.mdx +2 -1
- package/corpus/core/docs/content/locales/zh-TW/authentication.mdx +2 -2
- package/corpus/core/docs/content/locales/zh-TW/automations.mdx +7 -7
- package/corpus/core/docs/content/locales/zh-TW/external-agents.mdx +8 -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/mcp-protocol.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 +10 -0
- package/corpus/core/docs/content/mcp-protocol.mdx +1 -1
- package/corpus/core/docs/content/package-lifecycle.mdx +51 -0
- package/corpus/core/docs/content/sandbox-adapters.mdx +16 -5
- package/corpus/core/docs/content/security.mdx +2 -0
- package/corpus/core/package.json +13 -2
- package/corpus/core/scripts/finalize-build.mjs +63 -3
- package/corpus/core/scripts/materialize-source-corpus.mjs +101 -15
- package/corpus/core/src/a2a/auth-policy.ts +33 -0
- package/corpus/core/src/action.ts +42 -0
- package/corpus/core/src/agent/durable-background.ts +15 -7
- package/corpus/core/src/agent/engine/builder-engine.ts +3 -0
- package/corpus/core/src/agent/engine/context-directives-transform.ts +69 -0
- package/corpus/core/src/agent/engine/continuation-dispatch-retry.ts +168 -0
- package/corpus/core/src/agent/engine/tool-call-journal-seed.ts +85 -0
- package/corpus/core/src/agent/production-agent.ts +129 -244
- 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 +402 -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/cli/plan-local.ts +10 -2
- package/corpus/core/src/cli/skills-content/assets-skill.ts +83 -0
- package/corpus/core/src/cli/skills-content/canvas.ts +153 -0
- package/corpus/core/src/cli/skills-content/connection.ts +52 -0
- package/corpus/core/src/cli/skills-content/content-skill.ts +109 -0
- package/corpus/core/src/cli/skills-content/design-exploration-skill.ts +118 -0
- package/corpus/core/src/cli/skills-content/design-visual-edit-skill.ts +228 -0
- package/corpus/core/src/cli/skills-content/document-quality.ts +196 -0
- package/corpus/core/src/cli/skills-content/exemplar.ts +69 -0
- package/corpus/core/src/cli/skills-content/help.ts +77 -0
- package/corpus/core/src/cli/skills-content/index.ts +22 -0
- package/corpus/core/src/cli/skills-content/local-files.ts +95 -0
- package/corpus/core/src/cli/skills-content/plan-setup-auth.ts +80 -0
- package/corpus/core/src/cli/skills-content/visual-plan-skill.ts +470 -0
- package/corpus/core/src/cli/skills-content/visual-recap-skill.ts +547 -0
- package/corpus/core/src/cli/skills-content/visualize-repo-skill.ts +93 -0
- package/corpus/core/src/cli/skills-content/wireframe.ts +349 -0
- package/corpus/core/src/cli/skills.ts +27 -2733
- package/corpus/core/src/client/AgentPanel.tsx +6 -5
- package/corpus/core/src/client/CommandMenu.tsx +16 -5
- package/corpus/core/src/client/FeedbackButton.tsx +2 -2
- package/corpus/core/src/client/agent-chat-adapter.ts +9 -9
- package/corpus/core/src/client/app-providers.tsx +18 -5
- package/corpus/core/src/client/chat/tool-call-display.tsx +3 -3
- package/corpus/core/src/client/composer/PastedTextChip.tsx +1 -1
- package/corpus/core/src/client/composer/RealtimeVoiceMode.tsx +143 -45
- package/corpus/core/src/client/composer/TiptapComposer.tsx +1 -1
- package/corpus/core/src/client/composer/VoiceButton.tsx +21 -5
- package/corpus/core/src/client/composer/useRealtimeVoiceMode.tsx +107 -10
- package/corpus/core/src/client/context-xray/ContextXRayPanel.tsx +5 -2
- package/corpus/core/src/client/extensions/ExtensionEditor.tsx +37 -4
- package/corpus/core/src/client/extensions/ExtensionQueryErrorState.tsx +47 -0
- package/corpus/core/src/client/extensions/ExtensionSlot.tsx +39 -10
- package/corpus/core/src/client/extensions/ExtensionViewer.tsx +44 -6
- package/corpus/core/src/client/extensions/ExtensionsListPage.tsx +12 -3
- package/corpus/core/src/client/extensions/ExtensionsSidebarSection.tsx +49 -11
- package/corpus/core/src/client/index.ts +0 -13
- package/corpus/core/src/client/progress/RunsTray.tsx +10 -3
- package/corpus/core/src/client/settings/SettingsTabsPage.tsx +7 -0
- package/corpus/core/src/client/settings/useBuilderStatus.ts +6 -0
- package/corpus/core/src/client/tool-cells/EditCell.tsx +19 -16
- package/corpus/core/src/client/tool-cells/FilesChangedSummary.tsx +26 -23
- package/corpus/core/src/client/tool-cells/WriteCell.tsx +19 -16
- package/corpus/core/src/client/visual-style-controls.tsx +1 -1
- package/corpus/core/src/deploy/build.ts +36 -14
- 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/google-docs-poller.ts +23 -2
- package/corpus/core/src/integrations/plugin.ts +10 -0
- package/corpus/core/src/integrations/webhook-handler.ts +27 -2
- package/corpus/core/src/jobs/scheduler.ts +28 -2
- package/corpus/core/src/localization/default-messages.ts +8 -1
- package/corpus/core/src/mcp/oauth-token.ts +6 -1
- package/corpus/core/src/observability/routes.ts +36 -0
- package/corpus/core/src/observability/sentiment.ts +261 -0
- package/corpus/core/src/observability/store.ts +23 -0
- package/corpus/core/src/observability/traces.ts +49 -63
- package/corpus/core/src/observability/tracking-identity.ts +55 -0
- package/corpus/core/src/observability/types.ts +13 -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 +114 -30
- package/corpus/core/src/server/action-discovery.ts +4 -0
- package/corpus/core/src/server/agent-chat/action-filters-a2a.ts +199 -0
- package/corpus/core/src/server/agent-chat/browser-team-tools.ts +510 -0
- package/corpus/core/src/server/agent-chat/context-tools.ts +595 -0
- package/corpus/core/src/server/agent-chat/framework-prompts.ts +470 -0
- package/corpus/core/src/server/agent-chat/lazy-fs.ts +11 -0
- package/corpus/core/src/server/agent-chat/mcp-glue.ts +91 -0
- package/corpus/core/src/server/agent-chat/plugin-options.ts +350 -0
- package/corpus/core/src/server/agent-chat/process-run-failure.ts +62 -0
- package/corpus/core/src/server/agent-chat/prompt-resources.ts +688 -0
- package/corpus/core/src/server/agent-chat/recurring-jobs-runtime.ts +80 -0
- package/corpus/core/src/server/agent-chat/request-surface.ts +71 -0
- package/corpus/core/src/server/agent-chat/run-code-tools.ts +67 -0
- package/corpus/core/src/server/agent-chat/script-entries.ts +779 -0
- package/corpus/core/src/server/agent-chat/shared-thread.ts +301 -0
- package/corpus/core/src/server/agent-chat/skill-frontmatter.ts +41 -0
- package/corpus/core/src/server/agent-chat-plugin.ts +403 -4179
- package/corpus/core/src/server/agent-teams.ts +26 -3
- package/corpus/core/src/server/auth.ts +55 -57
- package/corpus/core/src/server/core-routes-plugin.ts +30 -14
- package/corpus/core/src/server/credential-provider.ts +22 -25
- package/corpus/core/src/server/csrf.ts +24 -5
- package/corpus/core/src/server/edge.ts +1 -0
- 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/onboarding-html.ts +1 -16
- package/corpus/core/src/server/poll.ts +24 -2
- package/corpus/core/src/server/realtime-voice.ts +49 -5
- package/corpus/core/src/server/request-origin.ts +67 -0
- package/corpus/core/src/server/ssr-handler.ts +55 -2
- package/corpus/core/src/server/transcribe-voice.ts +1 -50
- package/corpus/core/src/sharing/access.ts +155 -11
- package/corpus/core/src/sharing/registry.ts +7 -0
- package/corpus/core/src/styles/agent-native.css +15 -14
- package/corpus/core/src/templates/default/.agents/skills/frontend-design/SKILL.md +1 -1
- package/corpus/core/src/templates/default/app/i18n/ar-SA.ts +6 -0
- package/corpus/core/src/templates/default/app/i18n/de-DE.ts +6 -0
- package/corpus/core/src/templates/default/app/i18n/en-US.ts +6 -0
- package/corpus/core/src/templates/default/app/i18n/es-ES.ts +6 -0
- package/corpus/core/src/templates/default/app/i18n/fr-FR.ts +6 -0
- package/corpus/core/src/templates/default/app/i18n/hi-IN.ts +6 -0
- package/corpus/core/src/templates/default/app/i18n/ja-JP.ts +6 -0
- package/corpus/core/src/templates/default/app/i18n/ko-KR.ts +6 -0
- package/corpus/core/src/templates/default/app/i18n/pt-BR.ts +6 -0
- package/corpus/core/src/templates/default/app/i18n/zh-CN.ts +6 -0
- package/corpus/core/src/templates/default/app/i18n/zh-TW.ts +6 -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/authentication/SKILL.md +27 -29
- package/corpus/core/src/templates/workspace-core/.agents/skills/automations/SKILL.md +1 -1
- package/corpus/core/src/templates/workspace-core/.agents/skills/external-agents/SKILL.md +2 -1
- package/corpus/core/src/templates/workspace-core/.agents/skills/frontend-design/SKILL.md +1 -1
- package/corpus/core/src/templates/workspace-core/.agents/skills/observability/SKILL.md +32 -0
- package/corpus/core/src/templates/workspace-core/.agents/skills/writing-agent-instructions/SKILL.md +25 -0
- package/corpus/core/src/templates/workspace-core/package.json +0 -1
- package/corpus/core/src/templates/workspace-core/src/server/index.ts +4 -2
- package/corpus/core/src/templates/workspace-root/package.json +0 -1
- package/corpus/core/src/testing.ts +26 -0
- package/corpus/core/src/triggers/actions.ts +11 -3
- package/corpus/core/src/triggers/dispatcher.ts +23 -2
- package/corpus/core/src/triggers/types.ts +7 -1
- package/corpus/core/src/vite/client.ts +126 -2
- package/corpus/core/tsconfig.cli.json +1 -1
- package/corpus/core/tsconfig.json +5 -1
- package/corpus/templates/analytics/.agents/skills/bigquery/SKILL.md +2 -2
- package/corpus/templates/analytics/.agents/skills/frontend-design/SKILL.md +1 -1
- package/corpus/templates/analytics/AGENTS.md +19 -6
- package/corpus/templates/analytics/actions/compose-dashboard.ts +65 -37
- package/corpus/templates/analytics/actions/install-dashboard-template.ts +79 -43
- package/corpus/templates/analytics/actions/list-explorer-dashboards.ts +3 -3
- package/corpus/templates/analytics/actions/list-sql-dashboards.ts +8 -3
- package/corpus/templates/analytics/actions/mutate-dashboard.ts +73 -24
- package/corpus/templates/analytics/actions/rename-analysis.ts +8 -2
- package/corpus/templates/analytics/actions/rename-dashboard.ts +8 -7
- 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/actions/view-screen.ts +4 -23
- package/corpus/templates/analytics/app/components/ResourceLoadError.tsx +42 -0
- package/corpus/templates/analytics/app/components/layout/CommandPalette.tsx +85 -70
- package/corpus/templates/analytics/app/components/layout/Sidebar.tsx +107 -89
- package/corpus/templates/analytics/app/components/layout/SidebarLoadError.tsx +24 -0
- package/corpus/templates/analytics/app/hooks/use-dashboard-views.ts +15 -5
- package/corpus/templates/analytics/app/i18n/zh-TW.ts +4 -0
- package/corpus/templates/analytics/app/i18n-data.ts +40 -0
- package/corpus/templates/analytics/app/pages/Settings.tsx +6 -2
- package/corpus/templates/analytics/app/pages/adhoc/explorer/components/SqlPreview.tsx +36 -20
- package/corpus/templates/analytics/app/pages/adhoc/explorer/index.tsx +34 -20
- package/corpus/templates/analytics/app/pages/adhoc/explorer/use-explorer-config.ts +42 -41
- package/corpus/templates/analytics/app/pages/adhoc/explorer-dashboard/index.tsx +43 -36
- package/corpus/templates/analytics/app/pages/adhoc/sql-dashboard/ViewsMenu.tsx +11 -2
- package/corpus/templates/analytics/app/root.tsx +13 -1
- package/corpus/templates/analytics/app/routes/_index.tsx +14 -2
- package/corpus/templates/analytics/changelog/2026-07-03-agent-llm-observability-dashboard.md +1 -1
- 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/changelog/2026-07-11-agent-feedback-sentiment-dashboard.md +6 -0
- package/corpus/templates/analytics/changelog/2026-07-11-analytics-chats-now-start-faster-by-loading-metric-definitio.md +6 -0
- package/corpus/templates/analytics/changelog/2026-07-11-command-and-sql-previews-now-respond-without-lag.md +6 -0
- package/corpus/templates/analytics/changelog/2026-07-11-command-search-now-reports-loading-failures-and-lets-you-ret.md +6 -0
- package/corpus/templates/analytics/changelog/2026-07-11-dashboard-navigation-now-loads-faster-and-reports-request-fa.md +6 -0
- package/corpus/templates/analytics/changelog/2026-07-11-inferred-message-sentiment-dashboard.md +6 -0
- package/corpus/templates/analytics/changelog/2026-07-11-microphone-settings-from-realtime-voice-mode-now-open-the-vo.md +6 -0
- package/corpus/templates/analytics/changelog/2026-07-11-more-dashboard-edit-paths-are-now-safe-against-simultaneous-.md +6 -0
- package/corpus/templates/analytics/changelog/2026-07-11-renaming-a-dashboard-is-now-safe-against-simultaneous-agent-.md +6 -0
- package/corpus/templates/analytics/changelog/2026-07-11-renaming-an-analysis-is-now-safe-against-simultaneous-edits.md +6 -0
- package/corpus/templates/analytics/changelog/2026-07-11-workspace-mounted-analytics-now-opens-ask-reliably-and-route.md +6 -0
- package/corpus/templates/analytics/docs/schemas/first-party-analytics.md +37 -3
- package/corpus/templates/analytics/package.json +1 -2
- package/corpus/templates/analytics/seeds/dashboards/agent-native-templates-first-party.json +339 -1
- package/corpus/templates/analytics/server/lib/bigquery.ts +3 -2
- package/corpus/templates/analytics/server/lib/dashboard-catalog.ts +1 -24
- package/corpus/templates/analytics/server/lib/dashboard-seeds.ts +0 -5
- package/corpus/templates/analytics/server/lib/dashboards-store.ts +443 -31
- package/corpus/templates/analytics/server/lib/data-dictionary-context.ts +106 -34
- package/corpus/templates/analytics/server/lib/demo-dashboards.ts +4 -1
- package/corpus/templates/analytics/server/plugins/agent-chat.ts +11 -39
- package/corpus/templates/assets/.agents/skills/frontend-design/SKILL.md +1 -1
- package/corpus/templates/assets/app/components/create/RecentDraftsSection.tsx +30 -4
- package/corpus/templates/assets/app/routes/library.tsx +49 -5
- package/corpus/templates/assets/changelog/2026-07-11-library-load-failures-now-show-a-retry-action.md +6 -0
- package/corpus/templates/assets/package.json +1 -2
- package/corpus/templates/brain/.agents/skills/frontend-design/SKILL.md +1 -1
- package/corpus/templates/brain/package.json +1 -2
- package/corpus/templates/calendar/.agents/skills/frontend-design/SKILL.md +1 -1
- package/corpus/templates/calendar/.env.example +5 -0
- package/corpus/templates/calendar/app/components/calendar/EventCard.tsx +2 -2
- package/corpus/templates/calendar/app/i18n/zh-TW.ts +2 -0
- package/corpus/templates/calendar/app/i18n-data.ts +20 -0
- package/corpus/templates/calendar/app/pages/BookingLinksPage.tsx +37 -1
- package/corpus/templates/calendar/app/pages/BookingsList.tsx +20 -3
- package/corpus/templates/calendar/changelog/2026-07-11-booking-load-failures-now-show-a-retry-action.md +6 -0
- package/corpus/templates/calendar/changelog/2026-07-11-event-cards-give-subtle-press-feedback-and-smoother-hover.md +6 -0
- package/corpus/templates/calendar/package.json +1 -2
- package/corpus/templates/chat/.agents/skills/frontend-design/SKILL.md +1 -1
- package/corpus/templates/chat/package.json +1 -2
- package/corpus/templates/clips/.agents/skills/frontend-design/SKILL.md +1 -1
- package/corpus/templates/clips/actions/decline-invite.ts +8 -0
- package/corpus/templates/clips/app/components/library/folder-tree.tsx +209 -187
- package/corpus/templates/clips/app/components/meetings/meeting-card.tsx +2 -2
- package/corpus/templates/clips/app/components/player/reactions-tray.tsx +17 -5
- package/corpus/templates/clips/app/components/player/scrubber.tsx +5 -3
- package/corpus/templates/clips/app/components/recorder/pre-record-panel.tsx +2 -2
- package/corpus/templates/clips/app/components/workspace/insights-hub.tsx +119 -95
- package/corpus/templates/clips/app/global.css +45 -0
- package/corpus/templates/clips/app/root.tsx +4 -0
- package/corpus/templates/clips/app/routes/_app.notifications.tsx +23 -2
- package/corpus/templates/clips/app/routes/_app.trash.tsx +24 -2
- package/corpus/templates/clips/changelog/2026-07-10-atomic-view-tracking.md +6 -0
- package/corpus/templates/clips/changelog/2026-07-11-controls-and-folders-now-move-more-smoothly.md +6 -0
- package/corpus/templates/clips/changelog/2026-07-11-declining-an-invitation-now-requires-being-its-recipient.md +6 -0
- package/corpus/templates/clips/changelog/2026-07-11-recording-overlays-are-lighter-weight-and-no-longer-cause-pa.md +6 -0
- package/corpus/templates/clips/changelog/2026-07-11-workspace-load-failures-now-show-a-retry-action.md +6 -0
- package/corpus/templates/clips/chrome-extension/package.json +3 -2
- package/corpus/templates/clips/chrome-extension/src/overlay.css +34 -5
- package/corpus/templates/clips/chrome-extension/src/styles.css +2 -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/desktop/src/styles.css +71 -26
- 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/frontend-design/SKILL.md +1 -1
- 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 +93 -61
- 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/QueryErrorState.tsx +39 -0
- package/corpus/templates/content/app/components/editor/LinkHoverPreview.tsx +1 -1
- package/corpus/templates/content/app/components/editor/database/DatabaseView.tsx +323 -1467
- package/corpus/templates/content/app/components/editor/database/GalleryView.tsx +368 -0
- package/corpus/templates/content/app/components/editor/database/ListView.tsx +353 -0
- package/corpus/templates/content/app/components/editor/database/TimelineView.tsx +580 -0
- package/corpus/templates/content/app/components/editor/database/settings.tsx +1 -1
- package/corpus/templates/content/app/components/sidebar/DocumentSidebar.tsx +11 -2
- package/corpus/templates/content/app/global.css +19 -19
- 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/app/root.tsx +2 -2
- package/corpus/templates/content/app/routes/_app._index.tsx +11 -1
- 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/changelog/2026-07-11-document-load-failures-now-show-a-retry-action.md +6 -0
- package/corpus/templates/content/changelog/2026-07-11-editor-toggle-feedback-now-feels-more-responsive.md +6 -0
- package/corpus/templates/content/changelog/2026-07-11-moving-documents-at-the-same-time-no-longer-scrambles-their-.md +6 -0
- package/corpus/templates/content/changelog/2026-07-11-public-document-chats-now-start-faster-while-keeping-full-do.md +6 -0
- package/corpus/templates/content/changelog/2026-07-11-reopening-a-comment-now-uses-consistent-permissions-everywhe.md +6 -0
- package/corpus/templates/content/changelog/2026-07-11-sidebar-resizing-now-tracks-your-cursor-instantly-instead-of.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/lib/public-documents.ts +47 -10
- package/corpus/templates/content/server/routes/api/comments/[id].patch.ts +24 -24
- 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/frontend-design/SKILL.md +1 -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/components/QueryErrorState.tsx +24 -0
- package/corpus/templates/design/app/components/design/CanvasContextMenu.tsx +1 -1
- package/corpus/templates/design/app/components/design/DesignImportPanel.tsx +5 -2
- package/corpus/templates/design/app/components/design/EditPanel.tsx +326 -319
- package/corpus/templates/design/app/components/design/LayersPanel.tsx +198 -193
- package/corpus/templates/design/app/components/design/edit-panel/panel-primitives.tsx +11 -4
- package/corpus/templates/design/app/components/design/inspector/DesignColorPicker.tsx +1 -1
- package/corpus/templates/design/app/components/layout/Layout.tsx +1 -1
- package/corpus/templates/design/app/pages/DesignSystems.tsx +7 -1
- package/corpus/templates/design/app/pages/Index.tsx +14 -2
- package/corpus/templates/design/app/pages/Present.tsx +16 -3
- package/corpus/templates/design/app/pages/Templates.tsx +10 -4
- package/corpus/templates/design/app/pages/design-editor/canvas-primitive-insert.ts +484 -0
- package/corpus/templates/design/app/pages/design-editor/clone-and-pen-edit.ts +378 -0
- package/corpus/templates/design/app/pages/design-editor/design-data-geometry-utils.ts +138 -0
- package/corpus/templates/design/app/pages/design-editor/dom-utils.ts +15 -0
- package/corpus/templates/design/app/pages/design-editor/generation-prompt-directives.ts +180 -0
- package/corpus/templates/design/app/pages/design-editor/html-layer-positioning.ts +226 -0
- package/corpus/templates/design/app/pages/design-editor/pending-edits.ts +5 -1
- package/corpus/templates/design/app/pages/design-editor/png-export-render.ts +348 -0
- package/corpus/templates/design/app/pages/design-editor/screen-command-utils.ts +160 -0
- package/corpus/templates/design/app/pages/design-editor/text-edit-utils.ts +238 -0
- package/corpus/templates/design/app/pages/design-editor/tool-state.ts +23 -1
- package/corpus/templates/design/app/pages/design-editor/types.ts +25 -0
- package/corpus/templates/design/app/root.tsx +10 -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/changelog/2026-07-11-canvas-context-menus-now-open-without-motion-jitter.md +6 -0
- package/corpus/templates/design/changelog/2026-07-11-design-load-failures-now-show-a-retry-action.md +6 -0
- package/corpus/templates/design/changelog/2026-07-11-inspector-tooltips-appear-instantly-as-you-sweep-across-icon.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/.agents/skills/frontend-design/SKILL.md +1 -1
- package/corpus/templates/dispatch/app/i18n/zh-TW.ts +10 -0
- package/corpus/templates/dispatch/app/i18n-data.ts +123 -0
- package/corpus/templates/dispatch/app/routes/integrations.tsx +163 -144
- package/corpus/templates/dispatch/changelog/2026-07-11-dispatch-mcp-connections-now-start-with-safer-app-access-and.md +6 -0
- package/corpus/templates/dispatch/changelog/2026-07-11-overview-and-chat-now-share-a-cleaner-more-stable-flow.md +6 -0
- package/corpus/templates/dispatch/changelog/2026-07-11-query-errors-now-show-a-retry-option.md +6 -0
- package/corpus/templates/dispatch/package.json +1 -2
- package/corpus/templates/forms/.agents/skills/frontend-design/SKILL.md +1 -1
- package/corpus/templates/forms/actions/patch-form-fields.ts +82 -44
- package/corpus/templates/forms/app/components/layout/Sidebar.tsx +3 -3
- package/corpus/templates/forms/app/root.tsx +34 -8
- 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/.agents/skills/frontend-design/SKILL.md +1 -1
- package/corpus/templates/macros/app/components/DailyProgress.tsx +25 -5
- package/corpus/templates/macros/app/components/QueryErrorState.tsx +31 -0
- package/corpus/templates/macros/app/components/WeightTracker.tsx +5 -1
- package/corpus/templates/macros/app/components/ui/button.tsx +1 -1
- package/corpus/templates/macros/app/components/ui/progress.tsx +1 -1
- package/corpus/templates/macros/app/components/ui/tabs.tsx +1 -1
- package/corpus/templates/macros/app/i18n/ar-SA.ts +2 -0
- package/corpus/templates/macros/app/i18n/de-DE.ts +2 -0
- package/corpus/templates/macros/app/i18n/en-US.ts +2 -0
- package/corpus/templates/macros/app/i18n/es-ES.ts +2 -0
- package/corpus/templates/macros/app/i18n/fr-FR.ts +2 -0
- package/corpus/templates/macros/app/i18n/hi-IN.ts +2 -0
- package/corpus/templates/macros/app/i18n/ja-JP.ts +2 -0
- package/corpus/templates/macros/app/i18n/ko-KR.ts +2 -0
- package/corpus/templates/macros/app/i18n/pt-BR.ts +2 -0
- package/corpus/templates/macros/app/i18n/zh-CN.ts +2 -0
- package/corpus/templates/macros/app/i18n/zh-TW.ts +2 -0
- package/corpus/templates/macros/app/routes/_index.tsx +22 -12
- package/corpus/templates/macros/app/routes/analytics.tsx +31 -10
- package/corpus/templates/macros/changelog/2026-07-11-daily-tracking-now-loads-and-updates-more-quickly.md +6 -0
- package/corpus/templates/macros/changelog/2026-07-11-data-load-failures-now-show-a-clear-error-with-a-retry-actio.md +6 -0
- package/corpus/templates/macros/package.json +1 -2
- package/corpus/templates/mail/.agents/skills/frontend-design/SKILL.md +1 -1
- package/corpus/templates/mail/.env.example +16 -11
- package/corpus/templates/mail/actions/list-emails.ts +39 -35
- package/corpus/templates/mail/app/components/email/ComposeModal.tsx +58 -6
- package/corpus/templates/mail/app/components/email/EmailListItem.tsx +35 -2
- package/corpus/templates/mail/app/components/email/EmailThread.tsx +3 -1
- package/corpus/templates/mail/app/components/layout/AppLayout.tsx +113 -104
- package/corpus/templates/mail/app/root.tsx +8 -10
- package/corpus/templates/mail/changelog/2026-07-10-fixed-calendar-rsvp-buttons-in-emails-firing-duplicate-respo.md +6 -0
- package/corpus/templates/mail/changelog/2026-07-11-compose-and-navigation-motion-now-feel-faster-and-smoother.md +6 -0
- package/corpus/templates/mail/changelog/2026-07-11-swipe-to-archive-or-snooze-now-responds-to-quick-flicks-not-.md +6 -0
- package/corpus/templates/mail/changelog/2026-07-11-the-assistant-now-sees-the-same-inbox-you-do-snoozed-mail-st.md +6 -0
- package/corpus/templates/mail/package.json +1 -2
- package/corpus/templates/mail/server/handlers/emails.ts +25 -69
- package/corpus/templates/mail/server/lib/list-inbox-emails.ts +169 -0
- package/corpus/templates/plan/.agents/skills/frontend-design/SKILL.md +1 -1
- package/corpus/templates/plan/.env.example +4 -0
- package/corpus/templates/plan/actions/create-plan-design.ts +89 -81
- package/corpus/templates/plan/actions/create-prototype-plan.ts +72 -59
- package/corpus/templates/plan/actions/create-ui-plan.ts +70 -55
- package/corpus/templates/plan/actions/create-visual-plan.ts +65 -51
- package/corpus/templates/plan/actions/restore-plan-version.ts +126 -96
- package/corpus/templates/plan/actions/update-local-plan-folder.ts +43 -30
- package/corpus/templates/plan/actions/update-visual-plan.ts +81 -64
- package/corpus/templates/plan/app/components/layout/Sidebar.tsx +17 -0
- package/corpus/templates/plan/app/components/ui/tabs.tsx +1 -1
- package/corpus/templates/plan/app/i18n/ar-SA.ts +10 -0
- package/corpus/templates/plan/app/i18n/de-DE.ts +10 -0
- package/corpus/templates/plan/app/i18n/en-US.ts +10 -0
- package/corpus/templates/plan/app/i18n/es-ES.ts +10 -0
- package/corpus/templates/plan/app/i18n/fr-FR.ts +10 -0
- package/corpus/templates/plan/app/i18n/hi-IN.ts +10 -0
- package/corpus/templates/plan/app/i18n/ja-JP.ts +10 -0
- package/corpus/templates/plan/app/i18n/ko-KR.ts +10 -0
- package/corpus/templates/plan/app/i18n/pt-BR.ts +10 -0
- package/corpus/templates/plan/app/i18n/zh-CN.ts +10 -0
- package/corpus/templates/plan/app/i18n/zh-TW.ts +10 -0
- package/corpus/templates/plan/app/lib/plan-local-bridge.ts +80 -1
- package/corpus/templates/plan/app/pages/PlansPage.tsx +152 -4
- package/corpus/templates/plan/app/root.tsx +11 -0
- 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/changelog/2026-07-11-local-plans-now-explain-and-recover-from-browser-permission-.md +6 -0
- package/corpus/templates/plan/changelog/2026-07-11-plan-edits-now-save-atomically-and-can-no-longer-partially-a.md +6 -0
- package/corpus/templates/plan/changelog/2026-07-11-plan-lists-now-show-a-clear-error-with-a-retry-action-when-t.md +6 -0
- package/corpus/templates/plan/package.json +1 -2
- package/corpus/templates/plan/server/plans.ts +9 -2
- package/corpus/templates/plan/shared/plan-content.ts +546 -260
- package/corpus/templates/slides/.agents/skills/frontend-design/SKILL.md +1 -1
- package/corpus/templates/slides/actions/delete-slide-comment.ts +49 -0
- package/corpus/templates/slides/actions/list-decks.ts +28 -0
- package/corpus/templates/slides/actions/update-slide-comment.ts +93 -0
- package/corpus/templates/slides/actions/view-screen.ts +14 -6
- package/corpus/templates/slides/app/components/comments/SlideCommentsPanel.tsx +33 -10
- 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 +3 -5
- package/corpus/templates/slides/app/components/editor/EditorToolbar.tsx +5 -9
- package/corpus/templates/slides/app/components/editor/ExportMenu.tsx +5 -12
- package/corpus/templates/slides/app/components/editor/GenerateSlidesDialog.tsx +2 -2
- 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/components/presentation/PresentationView.tsx +4 -2
- package/corpus/templates/slides/app/components/visual-editor/CanvasCommentPins.tsx +4 -3
- package/corpus/templates/slides/app/context/DeckContext.tsx +56 -4
- package/corpus/templates/slides/app/i18n/ar-SA.ts +6 -0
- package/corpus/templates/slides/app/i18n/de-DE.ts +6 -0
- package/corpus/templates/slides/app/i18n/en-US.ts +6 -0
- package/corpus/templates/slides/app/i18n/es-ES.ts +6 -0
- package/corpus/templates/slides/app/i18n/fr-FR.ts +6 -0
- package/corpus/templates/slides/app/i18n/hi-IN.ts +6 -0
- package/corpus/templates/slides/app/i18n/ja-JP.ts +6 -0
- package/corpus/templates/slides/app/i18n/ko-KR.ts +6 -0
- package/corpus/templates/slides/app/i18n/pt-BR.ts +6 -0
- package/corpus/templates/slides/app/i18n/zh-CN.ts +5 -0
- package/corpus/templates/slides/app/i18n/zh-TW.ts +5 -0
- package/corpus/templates/slides/app/pages/DeckEditor.tsx +11 -30
- package/corpus/templates/slides/app/pages/DesignSystems.tsx +23 -2
- package/corpus/templates/slides/app/pages/Index.tsx +31 -4
- 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/changelog/2026-07-11-comment-load-failures-now-show-a-retry-action-instead-of-say.md +6 -0
- package/corpus/templates/slides/changelog/2026-07-11-comment-pins-now-clear-with-a-faster-smoother-confirmation.md +6 -0
- package/corpus/templates/slides/changelog/2026-07-11-deck-and-design-system-load-failures-now-show-a-retry-action.md +6 -0
- package/corpus/templates/slides/changelog/2026-07-11-editor-toggles-and-toolbar-menus-now-animate-smoothly.md +6 -0
- package/corpus/templates/slides/changelog/2026-07-11-the-assistant-can-now-resolve-reopen-and-delete-slide-commen.md +6 -0
- package/corpus/templates/slides/changelog/2026-07-11-viewing-slides-no-longer-loads-every-deck-s-full-contents-in.md +6 -0
- package/corpus/templates/slides/package.json +1 -2
- package/corpus/templates/slides/server/routes/api/comments/[id].delete.ts +29 -48
- package/corpus/templates/slides/server/routes/api/comments/[id].patch.ts +29 -65
- 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/action.d.ts +23 -0
- package/dist/action.d.ts.map +1 -1
- package/dist/action.js +13 -0
- package/dist/action.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/engine/builder-engine.d.ts.map +1 -1
- package/dist/agent/engine/builder-engine.js +3 -0
- package/dist/agent/engine/builder-engine.js.map +1 -1
- package/dist/agent/engine/context-directives-transform.d.ts +25 -0
- package/dist/agent/engine/context-directives-transform.d.ts.map +1 -0
- package/dist/agent/engine/context-directives-transform.js +53 -0
- package/dist/agent/engine/context-directives-transform.js.map +1 -0
- package/dist/agent/engine/continuation-dispatch-retry.d.ts +40 -0
- package/dist/agent/engine/continuation-dispatch-retry.d.ts.map +1 -0
- package/dist/agent/engine/continuation-dispatch-retry.js +109 -0
- package/dist/agent/engine/continuation-dispatch-retry.js.map +1 -0
- package/dist/agent/engine/tool-call-journal-seed.d.ts +46 -0
- package/dist/agent/engine/tool-call-journal-seed.d.ts.map +1 -0
- package/dist/agent/engine/tool-call-journal-seed.js +60 -0
- package/dist/agent/engine/tool-call-journal-seed.js.map +1 -0
- package/dist/agent/production-agent.d.ts +7 -0
- package/dist/agent/production-agent.d.ts.map +1 -1
- package/dist/agent/production-agent.js +102 -222
- 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/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 +281 -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/cli/plan-local.d.ts.map +1 -1
- package/dist/cli/plan-local.js +8 -2
- package/dist/cli/plan-local.js.map +1 -1
- package/dist/cli/skills-content/assets-skill.d.ts +2 -0
- package/dist/cli/skills-content/assets-skill.d.ts.map +1 -0
- package/dist/cli/skills-content/assets-skill.js +84 -0
- package/dist/cli/skills-content/assets-skill.js.map +1 -0
- package/dist/cli/skills-content/canvas.d.ts +4 -0
- package/dist/cli/skills-content/canvas.d.ts.map +1 -0
- package/dist/cli/skills-content/canvas.js +152 -0
- package/dist/cli/skills-content/canvas.js.map +1 -0
- package/dist/cli/skills-content/connection.d.ts +2 -0
- package/dist/cli/skills-content/connection.d.ts.map +1 -0
- package/dist/cli/skills-content/connection.js +53 -0
- package/dist/cli/skills-content/connection.js.map +1 -0
- package/dist/cli/skills-content/content-skill.d.ts +2 -0
- package/dist/cli/skills-content/content-skill.d.ts.map +1 -0
- package/dist/cli/skills-content/content-skill.js +110 -0
- package/dist/cli/skills-content/content-skill.js.map +1 -0
- package/dist/cli/skills-content/design-exploration-skill.d.ts +2 -0
- package/dist/cli/skills-content/design-exploration-skill.d.ts.map +1 -0
- package/dist/cli/skills-content/design-exploration-skill.js +119 -0
- package/dist/cli/skills-content/design-exploration-skill.js.map +1 -0
- package/dist/cli/skills-content/design-visual-edit-skill.d.ts +2 -0
- package/dist/cli/skills-content/design-visual-edit-skill.d.ts.map +1 -0
- package/dist/cli/skills-content/design-visual-edit-skill.js +229 -0
- package/dist/cli/skills-content/design-visual-edit-skill.js.map +1 -0
- package/dist/cli/skills-content/document-quality.d.ts +4 -0
- package/dist/cli/skills-content/document-quality.d.ts.map +1 -0
- package/dist/cli/skills-content/document-quality.js +195 -0
- package/dist/cli/skills-content/document-quality.js.map +1 -0
- package/dist/cli/skills-content/exemplar.d.ts +4 -0
- package/dist/cli/skills-content/exemplar.d.ts.map +1 -0
- package/dist/cli/skills-content/exemplar.js +68 -0
- package/dist/cli/skills-content/exemplar.js.map +1 -0
- package/dist/cli/skills-content/help.d.ts +2 -0
- package/dist/cli/skills-content/help.d.ts.map +1 -0
- package/dist/cli/skills-content/help.js +78 -0
- package/dist/cli/skills-content/help.js.map +1 -0
- package/dist/cli/skills-content/index.d.ts +23 -0
- package/dist/cli/skills-content/index.d.ts.map +1 -0
- package/dist/cli/skills-content/index.js +23 -0
- package/dist/cli/skills-content/index.js.map +1 -0
- package/dist/cli/skills-content/local-files.d.ts +2 -0
- package/dist/cli/skills-content/local-files.d.ts.map +1 -0
- package/dist/cli/skills-content/local-files.js +96 -0
- package/dist/cli/skills-content/local-files.js.map +1 -0
- package/dist/cli/skills-content/plan-setup-auth.d.ts +9 -0
- package/dist/cli/skills-content/plan-setup-auth.d.ts.map +1 -0
- package/dist/cli/skills-content/plan-setup-auth.js +81 -0
- package/dist/cli/skills-content/plan-setup-auth.js.map +1 -0
- package/dist/cli/skills-content/visual-plan-skill.d.ts +2 -0
- package/dist/cli/skills-content/visual-plan-skill.d.ts.map +1 -0
- package/dist/cli/skills-content/visual-plan-skill.js +471 -0
- package/dist/cli/skills-content/visual-plan-skill.js.map +1 -0
- package/dist/cli/skills-content/visual-recap-skill.d.ts +2 -0
- package/dist/cli/skills-content/visual-recap-skill.d.ts.map +1 -0
- package/dist/cli/skills-content/visual-recap-skill.js +548 -0
- package/dist/cli/skills-content/visual-recap-skill.js.map +1 -0
- package/dist/cli/skills-content/visualize-repo-skill.d.ts +2 -0
- package/dist/cli/skills-content/visualize-repo-skill.d.ts.map +1 -0
- package/dist/cli/skills-content/visualize-repo-skill.js +94 -0
- package/dist/cli/skills-content/visualize-repo-skill.js.map +1 -0
- package/dist/cli/skills-content/wireframe.d.ts +4 -0
- package/dist/cli/skills-content/wireframe.d.ts.map +1 -0
- package/dist/cli/skills-content/wireframe.js +347 -0
- package/dist/cli/skills-content/wireframe.js.map +1 -0
- package/dist/cli/skills.d.ts +2 -10
- package/dist/cli/skills.d.ts.map +1 -1
- package/dist/cli/skills.js +2 -2710
- package/dist/cli/skills.js.map +1 -1
- package/dist/client/AgentPanel.d.ts.map +1 -1
- package/dist/client/AgentPanel.js +4 -2
- package/dist/client/AgentPanel.js.map +1 -1
- package/dist/client/CommandMenu.d.ts.map +1 -1
- package/dist/client/CommandMenu.js +15 -3
- package/dist/client/CommandMenu.js.map +1 -1
- package/dist/client/FeedbackButton.js +2 -2
- package/dist/client/FeedbackButton.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/app-providers.d.ts +13 -5
- package/dist/client/app-providers.d.ts.map +1 -1
- package/dist/client/app-providers.js +9 -6
- package/dist/client/app-providers.js.map +1 -1
- package/dist/client/chat/tool-call-display.d.ts +4 -0
- package/dist/client/chat/tool-call-display.d.ts.map +1 -1
- package/dist/client/chat/tool-call-display.js +3 -3
- package/dist/client/chat/tool-call-display.js.map +1 -1
- package/dist/client/composer/PastedTextChip.js +1 -1
- package/dist/client/composer/PastedTextChip.js.map +1 -1
- package/dist/client/composer/RealtimeVoiceMode.d.ts +3 -1
- package/dist/client/composer/RealtimeVoiceMode.d.ts.map +1 -1
- package/dist/client/composer/RealtimeVoiceMode.js +35 -14
- package/dist/client/composer/RealtimeVoiceMode.js.map +1 -1
- package/dist/client/composer/TiptapComposer.js +1 -1
- package/dist/client/composer/TiptapComposer.js.map +1 -1
- package/dist/client/composer/VoiceButton.d.ts +2 -0
- package/dist/client/composer/VoiceButton.d.ts.map +1 -1
- package/dist/client/composer/VoiceButton.js +9 -3
- package/dist/client/composer/VoiceButton.js.map +1 -1
- package/dist/client/composer/useRealtimeVoiceMode.d.ts +5 -0
- package/dist/client/composer/useRealtimeVoiceMode.d.ts.map +1 -1
- package/dist/client/composer/useRealtimeVoiceMode.js +91 -12
- package/dist/client/composer/useRealtimeVoiceMode.js.map +1 -1
- package/dist/client/context-xray/ContextXRayPanel.d.ts.map +1 -1
- package/dist/client/context-xray/ContextXRayPanel.js +4 -1
- package/dist/client/context-xray/ContextXRayPanel.js.map +1 -1
- package/dist/client/extensions/ExtensionEditor.d.ts.map +1 -1
- package/dist/client/extensions/ExtensionEditor.js +15 -5
- package/dist/client/extensions/ExtensionEditor.js.map +1 -1
- package/dist/client/extensions/ExtensionQueryErrorState.d.ts +8 -0
- package/dist/client/extensions/ExtensionQueryErrorState.d.ts.map +1 -0
- package/dist/client/extensions/ExtensionQueryErrorState.js +11 -0
- package/dist/client/extensions/ExtensionQueryErrorState.js.map +1 -0
- package/dist/client/extensions/ExtensionSlot.d.ts.map +1 -1
- package/dist/client/extensions/ExtensionSlot.js +17 -7
- package/dist/client/extensions/ExtensionSlot.js.map +1 -1
- package/dist/client/extensions/ExtensionViewer.d.ts.map +1 -1
- package/dist/client/extensions/ExtensionViewer.js +17 -7
- package/dist/client/extensions/ExtensionViewer.js.map +1 -1
- package/dist/client/extensions/ExtensionsListPage.d.ts.map +1 -1
- package/dist/client/extensions/ExtensionsListPage.js +5 -3
- package/dist/client/extensions/ExtensionsListPage.js.map +1 -1
- package/dist/client/extensions/ExtensionsSidebarSection.d.ts.map +1 -1
- package/dist/client/extensions/ExtensionsSidebarSection.js +21 -8
- package/dist/client/extensions/ExtensionsSidebarSection.js.map +1 -1
- package/dist/client/index.d.ts +0 -2
- package/dist/client/index.d.ts.map +1 -1
- package/dist/client/index.js +0 -5
- package/dist/client/index.js.map +1 -1
- package/dist/client/progress/RunsTray.d.ts.map +1 -1
- package/dist/client/progress/RunsTray.js +7 -3
- package/dist/client/progress/RunsTray.js.map +1 -1
- package/dist/client/settings/SettingsTabsPage.d.ts.map +1 -1
- package/dist/client/settings/SettingsTabsPage.js +4 -0
- package/dist/client/settings/SettingsTabsPage.js.map +1 -1
- package/dist/client/settings/useBuilderStatus.d.ts +2 -0
- package/dist/client/settings/useBuilderStatus.d.ts.map +1 -1
- package/dist/client/settings/useBuilderStatus.js +4 -0
- package/dist/client/settings/useBuilderStatus.js.map +1 -1
- package/dist/client/tool-cells/EditCell.d.ts.map +1 -1
- package/dist/client/tool-cells/EditCell.js +2 -1
- package/dist/client/tool-cells/EditCell.js.map +1 -1
- package/dist/client/tool-cells/FilesChangedSummary.d.ts.map +1 -1
- package/dist/client/tool-cells/FilesChangedSummary.js +2 -1
- package/dist/client/tool-cells/FilesChangedSummary.js.map +1 -1
- package/dist/client/tool-cells/WriteCell.d.ts.map +1 -1
- package/dist/client/tool-cells/WriteCell.js +2 -1
- package/dist/client/tool-cells/WriteCell.js.map +1 -1
- package/dist/client/visual-style-controls.js +1 -1
- package/dist/client/visual-style-controls.js.map +1 -1
- package/dist/collab/routes.d.ts +1 -1
- package/dist/collab/struct-routes.d.ts +1 -1
- package/dist/deploy/build.d.ts.map +1 -1
- package/dist/deploy/build.js +36 -14
- 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/google-docs-poller.d.ts +7 -0
- package/dist/integrations/google-docs-poller.d.ts.map +1 -1
- package/dist/integrations/google-docs-poller.js +13 -3
- package/dist/integrations/google-docs-poller.js.map +1 -1
- package/dist/integrations/plugin.d.ts.map +1 -1
- package/dist/integrations/plugin.js +10 -0
- package/dist/integrations/plugin.js.map +1 -1
- package/dist/integrations/webhook-handler.d.ts +11 -0
- package/dist/integrations/webhook-handler.d.ts.map +1 -1
- package/dist/integrations/webhook-handler.js +16 -4
- package/dist/integrations/webhook-handler.js.map +1 -1
- package/dist/jobs/scheduler.d.ts +12 -0
- package/dist/jobs/scheduler.d.ts.map +1 -1
- package/dist/jobs/scheduler.js +13 -3
- package/dist/jobs/scheduler.js.map +1 -1
- package/dist/localization/default-messages.d.ts +7 -0
- package/dist/localization/default-messages.d.ts.map +1 -1
- package/dist/localization/default-messages.js +8 -1
- package/dist/localization/default-messages.js.map +1 -1
- package/dist/mcp/oauth-token.d.ts +1 -1
- package/dist/mcp/oauth-token.d.ts.map +1 -1
- package/dist/mcp/oauth-token.js +6 -1
- package/dist/mcp/oauth-token.js.map +1 -1
- package/dist/notifications/routes.d.ts +2 -2
- package/dist/observability/routes.d.ts.map +1 -1
- package/dist/observability/routes.js +32 -0
- package/dist/observability/routes.js.map +1 -1
- package/dist/observability/sentiment.d.ts +42 -0
- package/dist/observability/sentiment.d.ts.map +1 -0
- package/dist/observability/sentiment.js +196 -0
- package/dist/observability/sentiment.js.map +1 -0
- package/dist/observability/store.d.ts +5 -0
- package/dist/observability/store.d.ts.map +1 -1
- package/dist/observability/store.js +17 -0
- package/dist/observability/store.js.map +1 -1
- package/dist/observability/traces.d.ts +2 -0
- package/dist/observability/traces.d.ts.map +1 -1
- package/dist/observability/traces.js +42 -57
- package/dist/observability/traces.js.map +1 -1
- package/dist/observability/tracking-identity.d.ts +3 -0
- package/dist/observability/tracking-identity.d.ts.map +1 -0
- package/dist/observability/tracking-identity.js +51 -0
- package/dist/observability/tracking-identity.js.map +1 -0
- package/dist/observability/types.d.ts +10 -0
- package/dist/observability/types.d.ts.map +1 -1
- package/dist/observability/types.js +3 -0
- package/dist/observability/types.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/provider-api/corpus-jobs.d.ts +2 -2
- 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/secrets/storage.d.ts +6 -0
- package/dist/secrets/storage.d.ts.map +1 -1
- package/dist/secrets/storage.js +105 -29
- 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/action-filters-a2a.d.ts +50 -0
- package/dist/server/agent-chat/action-filters-a2a.d.ts.map +1 -0
- package/dist/server/agent-chat/action-filters-a2a.js +127 -0
- package/dist/server/agent-chat/action-filters-a2a.js.map +1 -0
- package/dist/server/agent-chat/browser-team-tools.d.ts +21 -0
- package/dist/server/agent-chat/browser-team-tools.d.ts.map +1 -0
- package/dist/server/agent-chat/browser-team-tools.js +417 -0
- package/dist/server/agent-chat/browser-team-tools.js.map +1 -0
- package/dist/server/agent-chat/context-tools.d.ts +33 -0
- package/dist/server/agent-chat/context-tools.d.ts.map +1 -0
- package/dist/server/agent-chat/context-tools.js +520 -0
- package/dist/server/agent-chat/context-tools.js.map +1 -0
- package/dist/server/agent-chat/framework-prompts.d.ts +65 -0
- package/dist/server/agent-chat/framework-prompts.d.ts.map +1 -0
- package/dist/server/agent-chat/framework-prompts.js +403 -0
- package/dist/server/agent-chat/framework-prompts.js.map +1 -0
- package/dist/server/agent-chat/lazy-fs.d.ts +2 -0
- package/dist/server/agent-chat/lazy-fs.d.ts.map +1 -0
- package/dist/server/agent-chat/lazy-fs.js +11 -0
- package/dist/server/agent-chat/lazy-fs.js.map +1 -0
- package/dist/server/agent-chat/mcp-glue.d.ts +9 -0
- package/dist/server/agent-chat/mcp-glue.d.ts.map +1 -0
- package/dist/server/agent-chat/mcp-glue.js +63 -0
- package/dist/server/agent-chat/mcp-glue.js.map +1 -0
- package/dist/server/agent-chat/plugin-options.d.ts +322 -0
- package/dist/server/agent-chat/plugin-options.d.ts.map +1 -0
- package/dist/server/agent-chat/plugin-options.js +2 -0
- package/dist/server/agent-chat/plugin-options.js.map +1 -0
- package/dist/server/agent-chat/process-run-failure.d.ts +12 -0
- package/dist/server/agent-chat/process-run-failure.d.ts.map +1 -0
- package/dist/server/agent-chat/process-run-failure.js +24 -0
- package/dist/server/agent-chat/process-run-failure.js.map +1 -0
- package/dist/server/agent-chat/prompt-resources.d.ts +28 -0
- package/dist/server/agent-chat/prompt-resources.d.ts.map +1 -0
- package/dist/server/agent-chat/prompt-resources.js +514 -0
- package/dist/server/agent-chat/prompt-resources.js.map +1 -0
- package/dist/server/agent-chat/recurring-jobs-runtime.d.ts +5 -0
- package/dist/server/agent-chat/recurring-jobs-runtime.d.ts.map +1 -0
- package/dist/server/agent-chat/recurring-jobs-runtime.js +53 -0
- package/dist/server/agent-chat/recurring-jobs-runtime.js.map +1 -0
- package/dist/server/agent-chat/request-surface.d.ts +8 -0
- package/dist/server/agent-chat/request-surface.d.ts.map +1 -0
- package/dist/server/agent-chat/request-surface.js +56 -0
- package/dist/server/agent-chat/request-surface.js.map +1 -0
- package/dist/server/agent-chat/run-code-tools.d.ts +17 -0
- package/dist/server/agent-chat/run-code-tools.d.ts.map +1 -0
- package/dist/server/agent-chat/run-code-tools.js +55 -0
- package/dist/server/agent-chat/run-code-tools.js.map +1 -0
- package/dist/server/agent-chat/script-entries.d.ts +47 -0
- package/dist/server/agent-chat/script-entries.d.ts.map +1 -0
- package/dist/server/agent-chat/script-entries.js +633 -0
- package/dist/server/agent-chat/script-entries.js.map +1 -0
- package/dist/server/agent-chat/shared-thread.d.ts +33 -0
- package/dist/server/agent-chat/shared-thread.d.ts.map +1 -0
- package/dist/server/agent-chat/shared-thread.js +242 -0
- package/dist/server/agent-chat/shared-thread.js.map +1 -0
- package/dist/server/agent-chat/skill-frontmatter.d.ts +7 -0
- package/dist/server/agent-chat/skill-frontmatter.d.ts.map +1 -0
- package/dist/server/agent-chat/skill-frontmatter.js +26 -0
- package/dist/server/agent-chat/skill-frontmatter.js.map +1 -0
- package/dist/server/agent-chat-plugin.d.ts +45 -486
- package/dist/server/agent-chat-plugin.d.ts.map +1 -1
- package/dist/server/agent-chat-plugin.js +217 -3015
- 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/agent-teams.d.ts +10 -0
- package/dist/server/agent-teams.d.ts.map +1 -1
- package/dist/server/agent-teams.js +13 -3
- package/dist/server/agent-teams.js.map +1 -1
- package/dist/server/auth.d.ts.map +1 -1
- package/dist/server/auth.js +50 -52
- package/dist/server/auth.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/credential-provider.d.ts.map +1 -1
- package/dist/server/credential-provider.js +22 -21
- package/dist/server/credential-provider.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/edge.d.ts +1 -0
- package/dist/server/edge.d.ts.map +1 -1
- package/dist/server/edge.js +1 -0
- package/dist/server/edge.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/onboarding-html.d.ts.map +1 -1
- package/dist/server/onboarding-html.js +1 -16
- package/dist/server/onboarding-html.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 +3 -0
- package/dist/server/realtime-voice.d.ts.map +1 -1
- package/dist/server/realtime-voice.js +38 -5
- 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 +63 -0
- package/dist/server/request-origin.js.map +1 -0
- package/dist/server/ssr-handler.d.ts.map +1 -1
- package/dist/server/ssr-handler.js +47 -2
- package/dist/server/ssr-handler.js.map +1 -1
- 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/sharing/access.d.ts +63 -3
- package/dist/sharing/access.d.ts.map +1 -1
- package/dist/sharing/access.js +53 -15
- package/dist/sharing/access.js.map +1 -1
- package/dist/sharing/registry.d.ts +7 -0
- package/dist/sharing/registry.d.ts.map +1 -1
- package/dist/sharing/registry.js.map +1 -1
- package/dist/styles/agent-native.css +15 -14
- package/dist/templates/default/.agents/skills/frontend-design/SKILL.md +1 -1
- package/dist/templates/default/app/i18n/ar-SA.ts +6 -0
- package/dist/templates/default/app/i18n/de-DE.ts +6 -0
- package/dist/templates/default/app/i18n/en-US.ts +6 -0
- package/dist/templates/default/app/i18n/es-ES.ts +6 -0
- package/dist/templates/default/app/i18n/fr-FR.ts +6 -0
- package/dist/templates/default/app/i18n/hi-IN.ts +6 -0
- package/dist/templates/default/app/i18n/ja-JP.ts +6 -0
- package/dist/templates/default/app/i18n/ko-KR.ts +6 -0
- package/dist/templates/default/app/i18n/pt-BR.ts +6 -0
- package/dist/templates/default/app/i18n/zh-CN.ts +6 -0
- package/dist/templates/default/app/i18n/zh-TW.ts +6 -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/authentication/SKILL.md +27 -29
- package/dist/templates/workspace-core/.agents/skills/automations/SKILL.md +1 -1
- package/dist/templates/workspace-core/.agents/skills/external-agents/SKILL.md +2 -1
- package/dist/templates/workspace-core/.agents/skills/frontend-design/SKILL.md +1 -1
- package/dist/templates/workspace-core/.agents/skills/observability/SKILL.md +32 -0
- package/dist/templates/workspace-core/.agents/skills/writing-agent-instructions/SKILL.md +25 -0
- package/dist/templates/workspace-core/package.json +0 -1
- package/dist/templates/workspace-core/src/server/index.ts +4 -2
- package/dist/templates/workspace-root/package.json +0 -1
- package/dist/testing.d.ts +16 -0
- package/dist/testing.d.ts.map +1 -0
- package/dist/testing.js +16 -0
- package/dist/testing.js.map +1 -0
- 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/dispatcher.d.ts +7 -0
- package/dist/triggers/dispatcher.d.ts.map +1 -1
- package/dist/triggers/dispatcher.js +13 -3
- package/dist/triggers/dispatcher.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 +16 -1
- package/dist/vite/client.d.ts.map +1 -1
- package/dist/vite/client.js +105 -2
- package/dist/vite/client.js.map +1 -1
- package/docs/content/audit-log.mdx +2 -1
- package/docs/content/authentication.mdx +3 -3
- package/docs/content/automations.mdx +7 -7
- package/docs/content/creating-templates.mdx +1 -1
- package/docs/content/doctor.mdx +170 -0
- package/docs/content/external-agents.mdx +8 -7
- package/docs/content/internationalization.mdx +2 -1
- package/docs/content/locales/ar-SA/audit-log.mdx +2 -1
- package/docs/content/locales/ar-SA/authentication.mdx +2 -2
- package/docs/content/locales/ar-SA/automations.mdx +7 -7
- package/docs/content/locales/ar-SA/external-agents.mdx +8 -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/mcp-protocol.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 +10 -0
- package/docs/content/locales/de-DE/audit-log.mdx +2 -1
- package/docs/content/locales/de-DE/authentication.mdx +1 -1
- package/docs/content/locales/de-DE/automations.mdx +7 -7
- package/docs/content/locales/de-DE/external-agents.mdx +8 -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/mcp-protocol.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 +10 -0
- package/docs/content/locales/es-ES/audit-log.mdx +2 -1
- package/docs/content/locales/es-ES/authentication.mdx +2 -2
- package/docs/content/locales/es-ES/automations.mdx +7 -7
- package/docs/content/locales/es-ES/external-agents.mdx +8 -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/mcp-protocol.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 +10 -0
- package/docs/content/locales/fr-FR/audit-log.mdx +2 -1
- package/docs/content/locales/fr-FR/authentication.mdx +1 -1
- package/docs/content/locales/fr-FR/automations.mdx +7 -7
- package/docs/content/locales/fr-FR/external-agents.mdx +8 -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/mcp-protocol.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 +10 -0
- package/docs/content/locales/hi-IN/audit-log.mdx +2 -1
- package/docs/content/locales/hi-IN/authentication.mdx +2 -2
- package/docs/content/locales/hi-IN/automations.mdx +7 -7
- package/docs/content/locales/hi-IN/external-agents.mdx +8 -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/mcp-protocol.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 +10 -0
- package/docs/content/locales/ja-JP/audit-log.mdx +2 -1
- package/docs/content/locales/ja-JP/authentication.mdx +2 -2
- package/docs/content/locales/ja-JP/automations.mdx +7 -7
- package/docs/content/locales/ja-JP/external-agents.mdx +8 -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/mcp-protocol.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 +10 -0
- package/docs/content/locales/ko-KR/audit-log.mdx +2 -1
- package/docs/content/locales/ko-KR/authentication.mdx +2 -2
- package/docs/content/locales/ko-KR/automations.mdx +7 -7
- package/docs/content/locales/ko-KR/external-agents.mdx +8 -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/mcp-protocol.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 +10 -0
- package/docs/content/locales/pt-BR/audit-log.mdx +2 -1
- package/docs/content/locales/pt-BR/authentication.mdx +2 -2
- package/docs/content/locales/pt-BR/automations.mdx +7 -7
- package/docs/content/locales/pt-BR/external-agents.mdx +8 -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/mcp-protocol.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 +10 -0
- package/docs/content/locales/zh-CN/audit-log.mdx +2 -1
- package/docs/content/locales/zh-CN/authentication.mdx +2 -2
- package/docs/content/locales/zh-CN/automations.mdx +7 -7
- package/docs/content/locales/zh-CN/external-agents.mdx +8 -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/mcp-protocol.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 +10 -0
- package/docs/content/locales/zh-TW/audit-log.mdx +2 -1
- package/docs/content/locales/zh-TW/authentication.mdx +2 -2
- package/docs/content/locales/zh-TW/automations.mdx +7 -7
- package/docs/content/locales/zh-TW/external-agents.mdx +8 -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/mcp-protocol.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 +10 -0
- package/docs/content/mcp-protocol.mdx +1 -1
- package/docs/content/package-lifecycle.mdx +51 -0
- package/docs/content/sandbox-adapters.mdx +16 -5
- package/docs/content/security.mdx +2 -0
- package/package.json +14 -3
- package/src/templates/default/.agents/skills/frontend-design/SKILL.md +1 -1
- package/src/templates/default/app/i18n/ar-SA.ts +6 -0
- package/src/templates/default/app/i18n/de-DE.ts +6 -0
- package/src/templates/default/app/i18n/en-US.ts +6 -0
- package/src/templates/default/app/i18n/es-ES.ts +6 -0
- package/src/templates/default/app/i18n/fr-FR.ts +6 -0
- package/src/templates/default/app/i18n/hi-IN.ts +6 -0
- package/src/templates/default/app/i18n/ja-JP.ts +6 -0
- package/src/templates/default/app/i18n/ko-KR.ts +6 -0
- package/src/templates/default/app/i18n/pt-BR.ts +6 -0
- package/src/templates/default/app/i18n/zh-CN.ts +6 -0
- package/src/templates/default/app/i18n/zh-TW.ts +6 -0
- 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/authentication/SKILL.md +27 -29
- package/src/templates/workspace-core/.agents/skills/automations/SKILL.md +1 -1
- package/src/templates/workspace-core/.agents/skills/external-agents/SKILL.md +2 -1
- package/src/templates/workspace-core/.agents/skills/frontend-design/SKILL.md +1 -1
- package/src/templates/workspace-core/.agents/skills/observability/SKILL.md +32 -0
- package/src/templates/workspace-core/.agents/skills/writing-agent-instructions/SKILL.md +25 -0
- package/src/templates/workspace-core/package.json +0 -1
- package/src/templates/workspace-core/src/server/index.ts +4 -2
- package/src/templates/workspace-root/package.json +0 -1
- package/corpus/core/src/client/ProductionAgentPanel.tsx +0 -9
- package/corpus/core/src/client/auth-redirect-url.ts +0 -23
- package/corpus/core/src/client/useProductionAgent.ts +0 -253
- package/corpus/core/src/shared/auth-redirect-url.ts +0 -1
- package/corpus/templates/analytics/app/pages/Index.tsx +0 -16
- package/corpus/templates/analytics/seeds/dashboards/agent-observability-llm.json +0 -173
- 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
- package/dist/client/ProductionAgentPanel.d.ts +0 -6
- package/dist/client/ProductionAgentPanel.d.ts.map +0 -1
- package/dist/client/ProductionAgentPanel.js +0 -6
- package/dist/client/ProductionAgentPanel.js.map +0 -1
- package/dist/client/auth-redirect-url.d.ts +0 -2
- package/dist/client/auth-redirect-url.d.ts.map +0 -1
- package/dist/client/auth-redirect-url.js +0 -19
- package/dist/client/auth-redirect-url.js.map +0 -1
- package/dist/client/useProductionAgent.d.ts +0 -24
- package/dist/client/useProductionAgent.d.ts.map +0 -1
- package/dist/client/useProductionAgent.js +0 -179
- package/dist/client/useProductionAgent.js.map +0 -1
- package/dist/shared/auth-redirect-url.d.ts +0 -2
- package/dist/shared/auth-redirect-url.d.ts.map +0 -1
- package/dist/shared/auth-redirect-url.js +0 -2
- package/dist/shared/auth-redirect-url.js.map +0 -1
|
@@ -0,0 +1,38 @@
|
|
|
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
|
+
import type { GuardResult, GuardScanOptions } from "./types.js";
|
|
33
|
+
export interface DbToolScopingOptions extends GuardScanOptions {
|
|
34
|
+
/** Table name -> reviewer-readable reason. Default `{}`. */
|
|
35
|
+
denylist?: Record<string, string>;
|
|
36
|
+
}
|
|
37
|
+
export declare function scanDbToolScoping(options: DbToolScopingOptions): GuardResult;
|
|
38
|
+
//# sourceMappingURL=db-tool-scoping.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"db-tool-scoping.d.ts","sourceRoot":"","sources":["../../src/guards/db-tool-scoping.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AAGH,OAAO,KAAK,EAAgB,WAAW,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AAE9E,MAAM,WAAW,oBAAqB,SAAQ,gBAAgB;IAC5D,4DAA4D;IAC5D,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CACnC;AAsDD,wBAAgB,iBAAiB,CAAC,OAAO,EAAE,oBAAoB,GAAG,WAAW,CAoC5E"}
|
|
@@ -0,0 +1,114 @@
|
|
|
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
|
+
import { readFileSafe, relPosix, walk } from "./scan-utils.js";
|
|
33
|
+
function extractTableCalls(contents) {
|
|
34
|
+
const out = [];
|
|
35
|
+
const headerRegex = /export\s+const\s+([a-zA-Z_$][\w$]*)\s*=\s*(?:[a-zA-Z_$][\w$]*Table|table)\s*\(\s*"([^"]+)"\s*,\s*\{/gm;
|
|
36
|
+
let match;
|
|
37
|
+
while ((match = headerRegex.exec(contents)) !== null) {
|
|
38
|
+
const exportName = match[1];
|
|
39
|
+
const sqlName = match[2];
|
|
40
|
+
const start = headerRegex.lastIndex - 1;
|
|
41
|
+
let depth = 0;
|
|
42
|
+
let inStr = null;
|
|
43
|
+
let bodyEnd = -1;
|
|
44
|
+
for (let i = start; i < contents.length; i++) {
|
|
45
|
+
const c = contents[i];
|
|
46
|
+
const prev = contents[i - 1];
|
|
47
|
+
if (inStr) {
|
|
48
|
+
if (c === inStr && prev !== "\\")
|
|
49
|
+
inStr = null;
|
|
50
|
+
continue;
|
|
51
|
+
}
|
|
52
|
+
if (c === '"' || c === "'" || c === "`") {
|
|
53
|
+
inStr = c;
|
|
54
|
+
continue;
|
|
55
|
+
}
|
|
56
|
+
if (c === "{")
|
|
57
|
+
depth++;
|
|
58
|
+
else if (c === "}") {
|
|
59
|
+
depth--;
|
|
60
|
+
if (depth === 0) {
|
|
61
|
+
bodyEnd = i;
|
|
62
|
+
break;
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
if (bodyEnd === -1)
|
|
67
|
+
continue;
|
|
68
|
+
out.push({ exportName, sqlName, body: contents.slice(start + 1, bodyEnd) });
|
|
69
|
+
}
|
|
70
|
+
return out;
|
|
71
|
+
}
|
|
72
|
+
function hasRawDbScope(tableBody) {
|
|
73
|
+
return (/\.\.\.ownableColumns\s*\(/.test(tableBody) ||
|
|
74
|
+
/\b[\w$]+\s*:\s*text\s*\(\s*["']owner_email["']/.test(tableBody) ||
|
|
75
|
+
/\b[\w$]+\s*:\s*text\s*\(\s*["']org_id["']/.test(tableBody));
|
|
76
|
+
}
|
|
77
|
+
export function scanDbToolScoping(options) {
|
|
78
|
+
const { root, denylist = {} } = options;
|
|
79
|
+
const findings = [];
|
|
80
|
+
const seenAllowed = new Set();
|
|
81
|
+
for (const file of walk(root)) {
|
|
82
|
+
if (!file.endsWith("/server/db/schema.ts"))
|
|
83
|
+
continue;
|
|
84
|
+
const contents = readFileSafe(file);
|
|
85
|
+
if (contents === null)
|
|
86
|
+
continue;
|
|
87
|
+
const rel = relPosix(root, file);
|
|
88
|
+
const tables = extractTableCalls(contents);
|
|
89
|
+
for (const table of tables) {
|
|
90
|
+
if (hasRawDbScope(table.body))
|
|
91
|
+
continue;
|
|
92
|
+
if (Object.hasOwn(denylist, table.sqlName)) {
|
|
93
|
+
seenAllowed.add(table.sqlName);
|
|
94
|
+
continue;
|
|
95
|
+
}
|
|
96
|
+
findings.push({
|
|
97
|
+
file: rel,
|
|
98
|
+
line: 1,
|
|
99
|
+
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.`,
|
|
100
|
+
});
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
for (const key of Object.keys(denylist)) {
|
|
104
|
+
if (!seenAllowed.has(key)) {
|
|
105
|
+
findings.push({
|
|
106
|
+
file: "agent-native.json",
|
|
107
|
+
line: 1,
|
|
108
|
+
message: `Stale doctor.dbToolScopingDenylist entry "${key}" — no matching table found in server/db/schema.ts. Remove it.`,
|
|
109
|
+
});
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
return { name: "db-tool-scoping", findings };
|
|
113
|
+
}
|
|
114
|
+
//# sourceMappingURL=db-tool-scoping.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"db-tool-scoping.js","sourceRoot":"","sources":["../../src/guards/db-tool-scoping.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AAEH,OAAO,EAAE,YAAY,EAAE,QAAQ,EAAE,IAAI,EAAE,MAAM,iBAAiB,CAAC;AAc/D,SAAS,iBAAiB,CAAC,QAAgB;IACzC,MAAM,GAAG,GAAgB,EAAE,CAAC;IAC5B,MAAM,WAAW,GACf,uGAAuG,CAAC;IAC1G,IAAI,KAA6B,CAAC;IAClC,OAAO,CAAC,KAAK,GAAG,WAAW,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC,KAAK,IAAI,EAAE,CAAC;QACrD,MAAM,UAAU,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC;QAC5B,MAAM,OAAO,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC;QACzB,MAAM,KAAK,GAAG,WAAW,CAAC,SAAS,GAAG,CAAC,CAAC;QACxC,IAAI,KAAK,GAAG,CAAC,CAAC;QACd,IAAI,KAAK,GAAkB,IAAI,CAAC;QAChC,IAAI,OAAO,GAAG,CAAC,CAAC,CAAC;QACjB,KAAK,IAAI,CAAC,GAAG,KAAK,EAAE,CAAC,GAAG,QAAQ,CAAC,MAAM,EAAE,CAAC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,CAAC;IAED,OAAO,EAAE,IAAI,EAAE,iBAAiB,EAAE,QAAQ,EAAE,CAAC;AAC/C,CAAC","sourcesContent":["/**\n * scanDbToolScoping — ported from `scripts/guard-db-tool-scoping.mjs`.\n *\n * The agent's raw DB tools (`db-query`, `db-exec`, `db-patch`) can only\n * safely expose tables with an explicit tenant scope (`owner_email` and/or\n * `org_id`) or a documented, reviewed exception. This guard keeps schema\n * drift visible: any table without raw-DB scope must either add\n * `owner_email`/`org_id`, or be added to the denylist with a\n * reviewer-readable reason.\n *\n * Conditional guard — per report 005's V1 guard set table: the original\n * walks every `templates/*\\/server/db/schema.ts` and keys its denylist\n * `\"<template>:<table>\"`. A generated app has exactly one\n * `server/db/schema.ts` (confirmed convention), so this port scans that\n * single file and uses bare `\"<table>\"` denylist keys. The denylist itself\n * comes from `agent-native.json`'s `doctor.dbToolScopingDenylist` (see\n * `../cli/doctor.ts`) — empty by default; app authors add entries with the\n * same reviewer-readable-reason convention as the original constant.\n *\n * Not ported: the original also resolves `export * from\n * \"@agent-native/<pkg>/schema\"` re-exports back to that package's\n * `packages/<pkg>/src/schema/*.ts` monorepo source, so template schemas\n * that re-export scheduling/dispatch tables get scanned too. In a\n * generated app those packages are compiled `node_modules` output (no\n * `.ts` source to brace-parse), and report 005's parameterization note\n * doesn't cover that case, so re-export resolution is intentionally\n * dropped for app mode: a re-exported table from an `@agent-native/*`\n * package is not scanned here (false-negative, not false-positive) — see\n * the plan's STOP-condition guidance (\"report rather than invent new\n * detection logic\").\n */\n\nimport { readFileSafe, relPosix, walk } from \"./scan-utils.js\";\nimport type { GuardFinding, GuardResult, GuardScanOptions } from \"./types.js\";\n\nexport interface DbToolScopingOptions extends GuardScanOptions {\n /** Table name -> reviewer-readable reason. Default `{}`. */\n denylist?: Record<string, string>;\n}\n\ninterface TableCall {\n exportName: string;\n sqlName: string;\n body: string;\n}\n\nfunction extractTableCalls(contents: string): TableCall[] {\n const out: TableCall[] = [];\n const headerRegex =\n /export\\s+const\\s+([a-zA-Z_$][\\w$]*)\\s*=\\s*(?:[a-zA-Z_$][\\w$]*Table|table)\\s*\\(\\s*\"([^\"]+)\"\\s*,\\s*\\{/gm;\n let match: RegExpExecArray | null;\n while ((match = headerRegex.exec(contents)) !== null) {\n const exportName = match[1];\n const sqlName = match[2];\n const start = headerRegex.lastIndex - 1;\n let depth = 0;\n let inStr: string | null = null;\n let bodyEnd = -1;\n for (let i = start; i < contents.length; i++) {\n const c = contents[i];\n const prev = contents[i - 1];\n if (inStr) {\n if (c === inStr && prev !== \"\\\\\") inStr = null;\n continue;\n }\n if (c === '\"' || c === \"'\" || c === \"`\") {\n inStr = c;\n continue;\n }\n if (c === \"{\") depth++;\n else if (c === \"}\") {\n depth--;\n if (depth === 0) {\n bodyEnd = i;\n break;\n }\n }\n }\n if (bodyEnd === -1) continue;\n out.push({ exportName, sqlName, body: contents.slice(start + 1, bodyEnd) });\n }\n return out;\n}\n\nfunction hasRawDbScope(tableBody: string): boolean {\n return (\n /\\.\\.\\.ownableColumns\\s*\\(/.test(tableBody) ||\n /\\b[\\w$]+\\s*:\\s*text\\s*\\(\\s*[\"']owner_email[\"']/.test(tableBody) ||\n /\\b[\\w$]+\\s*:\\s*text\\s*\\(\\s*[\"']org_id[\"']/.test(tableBody)\n );\n}\n\nexport function scanDbToolScoping(options: DbToolScopingOptions): GuardResult {\n const { root, denylist = {} } = options;\n const findings: GuardFinding[] = [];\n const seenAllowed = new Set<string>();\n\n for (const file of walk(root)) {\n if (!file.endsWith(\"/server/db/schema.ts\")) continue;\n const contents = readFileSafe(file);\n if (contents === null) continue;\n const rel = relPosix(root, file);\n const tables = extractTableCalls(contents);\n for (const table of tables) {\n if (hasRawDbScope(table.body)) continue;\n if (Object.hasOwn(denylist, table.sqlName)) {\n seenAllowed.add(table.sqlName);\n continue;\n }\n findings.push({\n file: rel,\n line: 1,\n 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.`,\n });\n }\n }\n\n for (const key of Object.keys(denylist)) {\n if (!seenAllowed.has(key)) {\n findings.push({\n file: \"agent-native.json\",\n line: 1,\n message: `Stale doctor.dbToolScopingDenylist entry \"${key}\" — no matching table found in server/db/schema.ts. Remove it.`,\n });\n }\n }\n\n return { name: \"db-tool-scoping\", findings };\n}\n"]}
|
|
@@ -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
|
+
export { scanDbToolScoping } from "./db-tool-scoping.js";
|
|
13
|
+
export type { DbToolScopingOptions } from "./db-tool-scoping.js";
|
|
14
|
+
export { scanDrizzlePush } from "./no-drizzle-push.js";
|
|
15
|
+
export { scanEnvCredentials } from "./no-env-credentials.js";
|
|
16
|
+
export { scanEnvMutation } from "./no-env-mutation.js";
|
|
17
|
+
export { scanLocalhostFallback } from "./no-localhost-fallback.js";
|
|
18
|
+
export type { LocalhostFallbackOptions } from "./no-localhost-fallback.js";
|
|
19
|
+
export { scanUnscopedCredentials } from "./no-unscoped-credentials.js";
|
|
20
|
+
export { scanUnscopedQueries } from "./no-unscoped-queries.js";
|
|
21
|
+
export type { UnscopedQueriesOptions } from "./no-unscoped-queries.js";
|
|
22
|
+
export type { GuardFinding, GuardResult, GuardScanOptions } from "./types.js";
|
|
23
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/guards/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AACzD,YAAY,EAAE,oBAAoB,EAAE,MAAM,sBAAsB,CAAC;AACjE,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AACvD,OAAO,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AAC7D,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AACvD,OAAO,EAAE,qBAAqB,EAAE,MAAM,4BAA4B,CAAC;AACnE,YAAY,EAAE,wBAAwB,EAAE,MAAM,4BAA4B,CAAC;AAC3E,OAAO,EAAE,uBAAuB,EAAE,MAAM,8BAA8B,CAAC;AACvE,OAAO,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAC;AAC/D,YAAY,EAAE,sBAAsB,EAAE,MAAM,0BAA0B,CAAC;AACvE,YAAY,EAAE,YAAY,EAAE,WAAW,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC"}
|
|
@@ -0,0 +1,19 @@
|
|
|
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
|
+
export { scanDbToolScoping } from "./db-tool-scoping.js";
|
|
13
|
+
export { scanDrizzlePush } from "./no-drizzle-push.js";
|
|
14
|
+
export { scanEnvCredentials } from "./no-env-credentials.js";
|
|
15
|
+
export { scanEnvMutation } from "./no-env-mutation.js";
|
|
16
|
+
export { scanLocalhostFallback } from "./no-localhost-fallback.js";
|
|
17
|
+
export { scanUnscopedCredentials } from "./no-unscoped-credentials.js";
|
|
18
|
+
export { scanUnscopedQueries } from "./no-unscoped-queries.js";
|
|
19
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/guards/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AAEzD,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AACvD,OAAO,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AAC7D,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AACvD,OAAO,EAAE,qBAAqB,EAAE,MAAM,4BAA4B,CAAC;AAEnE,OAAO,EAAE,uBAAuB,EAAE,MAAM,8BAA8B,CAAC;AACvE,OAAO,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAC","sourcesContent":["/**\n * `agent-native doctor`'s guard functions — the source-code safety\n * invariants ported from this monorepo's `scripts/guard-*.mjs` CI guards\n * (see report `advisor-plans/reports/005-doctor-design.md` for the\n * classification and per-guard parameterization). Each guard is a pure,\n * synchronous function that scans an app root and returns a `GuardResult`.\n *\n * `../cli/doctor.ts` is the only in-package caller; this module is also\n * published under the `./guards` export subpath for advanced/CI use\n * outside the CLI.\n */\n\nexport { scanDbToolScoping } from \"./db-tool-scoping.js\";\nexport type { DbToolScopingOptions } from \"./db-tool-scoping.js\";\nexport { scanDrizzlePush } from \"./no-drizzle-push.js\";\nexport { scanEnvCredentials } from \"./no-env-credentials.js\";\nexport { scanEnvMutation } from \"./no-env-mutation.js\";\nexport { scanLocalhostFallback } from \"./no-localhost-fallback.js\";\nexport type { LocalhostFallbackOptions } from \"./no-localhost-fallback.js\";\nexport { scanUnscopedCredentials } from \"./no-unscoped-credentials.js\";\nexport { scanUnscopedQueries } from \"./no-unscoped-queries.js\";\nexport type { UnscopedQueriesOptions } from \"./no-unscoped-queries.js\";\nexport type { GuardFinding, GuardResult, GuardScanOptions } from \"./types.js\";\n"]}
|
|
@@ -0,0 +1,14 @@
|
|
|
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
|
+
import type { GuardResult, GuardScanOptions } from "./types.js";
|
|
13
|
+
export declare function scanDrizzlePush(options: GuardScanOptions): GuardResult;
|
|
14
|
+
//# sourceMappingURL=no-drizzle-push.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"no-drizzle-push.d.ts","sourceRoot":"","sources":["../../src/guards/no-drizzle-push.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAQH,OAAO,KAAK,EAAgB,WAAW,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AAgC9E,wBAAgB,eAAe,CAAC,OAAO,EAAE,gBAAgB,GAAG,WAAW,CActE"}
|
|
@@ -0,0 +1,97 @@
|
|
|
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
|
+
import { lineColForOffset, readFileSafe, relPosix, walk, } from "./scan-utils.js";
|
|
13
|
+
const DANGEROUS_SCRIPT_HOOKS = new Set([
|
|
14
|
+
"build",
|
|
15
|
+
"prebuild",
|
|
16
|
+
"postbuild",
|
|
17
|
+
"install",
|
|
18
|
+
"preinstall",
|
|
19
|
+
"postinstall",
|
|
20
|
+
"deploy",
|
|
21
|
+
"predeploy",
|
|
22
|
+
"postdeploy",
|
|
23
|
+
"start",
|
|
24
|
+
"prestart",
|
|
25
|
+
"poststart",
|
|
26
|
+
"ci",
|
|
27
|
+
"release",
|
|
28
|
+
"prerelease",
|
|
29
|
+
"postrelease",
|
|
30
|
+
]);
|
|
31
|
+
const PATTERNS = [/\bdrizzle-kit\s+push\b/, /\bdrizzle\s+push\b/];
|
|
32
|
+
function matchesForbidden(str) {
|
|
33
|
+
if (!str || typeof str !== "string")
|
|
34
|
+
return false;
|
|
35
|
+
return PATTERNS.some((p) => p.test(str));
|
|
36
|
+
}
|
|
37
|
+
export function scanDrizzlePush(options) {
|
|
38
|
+
const { root } = options;
|
|
39
|
+
const findings = [];
|
|
40
|
+
for (const file of walk(root)) {
|
|
41
|
+
const base = file.split("/").pop() ?? file;
|
|
42
|
+
if (base === "netlify.toml") {
|
|
43
|
+
scanNetlifyToml(root, file, findings);
|
|
44
|
+
}
|
|
45
|
+
else if (base === "package.json") {
|
|
46
|
+
scanPackageJson(root, file, findings);
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
return { name: "no-drizzle-push", findings };
|
|
50
|
+
}
|
|
51
|
+
function scanNetlifyToml(root, file, findings) {
|
|
52
|
+
const contents = readFileSafe(file);
|
|
53
|
+
if (contents === null || !matchesForbidden(contents))
|
|
54
|
+
return;
|
|
55
|
+
const lines = contents.split("\n");
|
|
56
|
+
const rel = relPosix(root, file);
|
|
57
|
+
for (let i = 0; i < lines.length; i++) {
|
|
58
|
+
if (matchesForbidden(lines[i])) {
|
|
59
|
+
findings.push({
|
|
60
|
+
file: rel,
|
|
61
|
+
line: i + 1,
|
|
62
|
+
message: `forbidden \`drizzle-kit push\` in netlify.toml: ${lines[i].trim()}`,
|
|
63
|
+
});
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
function scanPackageJson(root, file, findings) {
|
|
68
|
+
const contents = readFileSafe(file);
|
|
69
|
+
if (contents === null)
|
|
70
|
+
return;
|
|
71
|
+
let json;
|
|
72
|
+
try {
|
|
73
|
+
json = JSON.parse(contents);
|
|
74
|
+
}
|
|
75
|
+
catch {
|
|
76
|
+
return;
|
|
77
|
+
}
|
|
78
|
+
const scripts = json.scripts;
|
|
79
|
+
if (!scripts || typeof scripts !== "object")
|
|
80
|
+
return;
|
|
81
|
+
const rel = relPosix(root, file);
|
|
82
|
+
for (const [name, cmd] of Object.entries(scripts)) {
|
|
83
|
+
if (!DANGEROUS_SCRIPT_HOOKS.has(name))
|
|
84
|
+
continue;
|
|
85
|
+
if (matchesForbidden(cmd)) {
|
|
86
|
+
// Locate the line for a readable finding; fall back to line 1.
|
|
87
|
+
const idx = contents.indexOf(`"${name}"`);
|
|
88
|
+
const line = idx >= 0 ? lineColForOffset(contents, idx).line : 1;
|
|
89
|
+
findings.push({
|
|
90
|
+
file: rel,
|
|
91
|
+
line,
|
|
92
|
+
message: `forbidden \`drizzle-kit push\` in scripts.${name}: ${String(cmd)}`,
|
|
93
|
+
});
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
//# sourceMappingURL=no-drizzle-push.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"no-drizzle-push.js","sourceRoot":"","sources":["../../src/guards/no-drizzle-push.ts"],"names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AAI,EAAE,IAAI,CAAC,CAAC;IACjC,KAAK,MAAM,CAAC,IAAI,EAAE,GAAG,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,OAAO,CAAC,EAAE,CAAC;QAClD,IAAI,CAAC,sBAAsB,CAAC,GAAG,CAAC,IAAI,CAAC;YAAE,SAAS;QAChD,IAAI,gBAAgB,CAAC,GAAG,CAAC,EAAE,CAAC;YAC1B,+DAA+D;YAC/D,MAAM,GAAG,GAAG,QAAQ,CAAC,OAAO,CAAC,IAAI,IAAI,GAAG,CAAC,CAAC;YAC1C,MAAM,IAAI,GAAG,GAAG,IAAI,CAAC,CAAC,CAAC,CAAC,gBAAgB,CAAC,QAAQ,EAAE,GAAG,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC;YACjE,QAAQ,CAAC,IAAI,CAAC;gBACZ,IAAI,EAAE,GAAG;gBACT,IAAI;gBACJ,OAAO,EAAE,6CAA6C,IAAI,KAAK,MAAM,CAAC,GAAG,CAAC,EAAE;aAC7E,CAAC,CAAC;QACL,CAAC;IACH,CAAC;AACH,CAAC","sourcesContent":["/**\n * scanDrizzlePush — ported from `scripts/guard-no-drizzle-push.mjs`.\n *\n * Refuse to let `drizzle-kit push` (or `drizzle push`) get wired into any\n * build/deploy path (`netlify.toml`, or a `package.json` build/deploy\n * script). Generic guard — no monorepo-specific path assumption in the\n * original, ported as-is.\n *\n * Standalone `db:push` / `db:push:*` npm scripts are intentionally NOT\n * flagged — those are explicit, human-invoked commands, not build hooks.\n */\n\nimport {\n lineColForOffset,\n readFileSafe,\n relPosix,\n walk,\n} from \"./scan-utils.js\";\nimport type { GuardFinding, GuardResult, GuardScanOptions } from \"./types.js\";\n\nconst DANGEROUS_SCRIPT_HOOKS = new Set([\n \"build\",\n \"prebuild\",\n \"postbuild\",\n \"install\",\n \"preinstall\",\n \"postinstall\",\n \"deploy\",\n \"predeploy\",\n \"postdeploy\",\n \"start\",\n \"prestart\",\n \"poststart\",\n \"ci\",\n \"release\",\n \"prerelease\",\n \"postrelease\",\n]);\n\nconst PATTERNS = [/\\bdrizzle-kit\\s+push\\b/, /\\bdrizzle\\s+push\\b/];\n\nfunction matchesForbidden(str: unknown): str is string {\n if (!str || typeof str !== \"string\") return false;\n return PATTERNS.some((p) => p.test(str));\n}\n\ninterface PackageJsonLike {\n scripts?: Record<string, unknown>;\n}\n\nexport function scanDrizzlePush(options: GuardScanOptions): GuardResult {\n const { root } = options;\n const findings: GuardFinding[] = [];\n\n for (const file of walk(root)) {\n const base = file.split(\"/\").pop() ?? file;\n if (base === \"netlify.toml\") {\n scanNetlifyToml(root, file, findings);\n } else if (base === \"package.json\") {\n scanPackageJson(root, file, findings);\n }\n }\n\n return { name: \"no-drizzle-push\", findings };\n}\n\nfunction scanNetlifyToml(\n root: string,\n file: string,\n findings: GuardFinding[],\n): void {\n const contents = readFileSafe(file);\n if (contents === null || !matchesForbidden(contents)) return;\n const lines = contents.split(\"\\n\");\n const rel = relPosix(root, file);\n for (let i = 0; i < lines.length; i++) {\n if (matchesForbidden(lines[i])) {\n findings.push({\n file: rel,\n line: i + 1,\n message: `forbidden \\`drizzle-kit push\\` in netlify.toml: ${lines[i].trim()}`,\n });\n }\n }\n}\n\nfunction scanPackageJson(\n root: string,\n file: string,\n findings: GuardFinding[],\n): void {\n const contents = readFileSafe(file);\n if (contents === null) return;\n let json: PackageJsonLike;\n try {\n json = JSON.parse(contents) as PackageJsonLike;\n } catch {\n return;\n }\n const scripts = json.scripts;\n if (!scripts || typeof scripts !== \"object\") return;\n const rel = relPosix(root, file);\n for (const [name, cmd] of Object.entries(scripts)) {\n if (!DANGEROUS_SCRIPT_HOOKS.has(name)) continue;\n if (matchesForbidden(cmd)) {\n // Locate the line for a readable finding; fall back to line 1.\n const idx = contents.indexOf(`\"${name}\"`);\n const line = idx >= 0 ? lineColForOffset(contents, idx).line : 1;\n findings.push({\n file: rel,\n line,\n message: `forbidden \\`drizzle-kit push\\` in scripts.${name}: ${String(cmd)}`,\n });\n }\n }\n}\n"]}
|
|
@@ -0,0 +1,36 @@
|
|
|
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
|
+
import type { GuardResult, GuardScanOptions } from "./types.js";
|
|
35
|
+
export declare function scanEnvCredentials(options: GuardScanOptions): GuardResult;
|
|
36
|
+
//# sourceMappingURL=no-env-credentials.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"no-env-credentials.d.ts","sourceRoot":"","sources":["../../src/guards/no-env-credentials.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCG;AAQH,OAAO,KAAK,EAAgB,WAAW,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AA4G9E,wBAAgB,kBAAkB,CAAC,OAAO,EAAE,gBAAgB,GAAG,WAAW,CAgFzE"}
|
|
@@ -0,0 +1,204 @@
|
|
|
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
|
+
import { lineColForOffset, readFileSafe, relPosix, walk, } from "./scan-utils.js";
|
|
35
|
+
const ALLOWLIST_EXACT = new Set([
|
|
36
|
+
"DATABASE_URL",
|
|
37
|
+
"DATABASE_AUTH_TOKEN",
|
|
38
|
+
"NODE_ENV",
|
|
39
|
+
"CI",
|
|
40
|
+
"DEBUG",
|
|
41
|
+
"NETLIFY",
|
|
42
|
+
"VERCEL",
|
|
43
|
+
"RENDER",
|
|
44
|
+
"FLY_APP_NAME",
|
|
45
|
+
"K_SERVICE",
|
|
46
|
+
"AWS_LAMBDA_FUNCTION_NAME",
|
|
47
|
+
"BETTER_AUTH_SECRET",
|
|
48
|
+
"BETTER_AUTH_URL",
|
|
49
|
+
"NOTION_CLIENT_ID",
|
|
50
|
+
"NOTION_CLIENT_SECRET",
|
|
51
|
+
"NOTION_STATE_SECRET",
|
|
52
|
+
"GOOGLE_SIGN_IN_CLIENT_ID",
|
|
53
|
+
"GOOGLE_SIGN_IN_CLIENT_SECRET",
|
|
54
|
+
"AUTH_SECRET",
|
|
55
|
+
"A2A_SECRET",
|
|
56
|
+
"ACCESS_TOKEN",
|
|
57
|
+
"PORT",
|
|
58
|
+
"HOST",
|
|
59
|
+
"SECRETS_ENCRYPTION_KEY",
|
|
60
|
+
]);
|
|
61
|
+
const ALLOWLIST_PREFIX = [
|
|
62
|
+
"npm_",
|
|
63
|
+
"AGENT_NATIVE_",
|
|
64
|
+
"AGENT_",
|
|
65
|
+
"NETLIFY_",
|
|
66
|
+
"VERCEL_",
|
|
67
|
+
"CF_",
|
|
68
|
+
];
|
|
69
|
+
/** Dev-only paths where ANTHROPIC_API_KEY etc. may legitimately be read
|
|
70
|
+
* from env (local dev tooling, scripts, tests). Portable subset of the
|
|
71
|
+
* original — the monorepo-only `packages/core/src/dev` predicate is
|
|
72
|
+
* dropped (see report 005's V1 guard set table). */
|
|
73
|
+
const DEV_ONLY_PATH_PATTERNS = [
|
|
74
|
+
/\.spec\.[tj]sx?$/,
|
|
75
|
+
/\.test\.[tj]sx?$/,
|
|
76
|
+
/^scripts\//,
|
|
77
|
+
];
|
|
78
|
+
const DEV_ONLY_KEYS = new Set(["ANTHROPIC_API_KEY"]);
|
|
79
|
+
const OPT_OUT_MARKER = /\/\/\s*guard:allow-env-credential\b[^\n]*/;
|
|
80
|
+
const OPT_OUT_REQUIRES_REASON = /\/\/\s*guard:allow-env-credential\s*[—-]\s*\S/;
|
|
81
|
+
const ENV_READ_REGEX = /process\.env(?:\.([A-Z][A-Z0-9_]*)|\[\s*["']([A-Z][A-Z0-9_]*)["']\s*\])/g;
|
|
82
|
+
const ENV_DYNAMIC_READ_REGEX = /process\.env(?:\?\.)?\s*\[\s*(?!["'])([^\]\n]+?)\s*\]/g;
|
|
83
|
+
function isAllowlistedKey(key) {
|
|
84
|
+
if (ALLOWLIST_EXACT.has(key))
|
|
85
|
+
return true;
|
|
86
|
+
return ALLOWLIST_PREFIX.some((prefix) => key.startsWith(prefix));
|
|
87
|
+
}
|
|
88
|
+
function isDevOnlyPath(rel) {
|
|
89
|
+
return DEV_ONLY_PATH_PATTERNS.some((re) => re.test(rel));
|
|
90
|
+
}
|
|
91
|
+
function hasOptOutOnLine(lines, lineIdx) {
|
|
92
|
+
const cur = lines[lineIdx] ?? "";
|
|
93
|
+
if (OPT_OUT_MARKER.test(cur))
|
|
94
|
+
return true;
|
|
95
|
+
const prev = lines[lineIdx - 1] ?? "";
|
|
96
|
+
if (/^\s*\/\//.test(prev) && OPT_OUT_MARKER.test(prev))
|
|
97
|
+
return true;
|
|
98
|
+
return false;
|
|
99
|
+
}
|
|
100
|
+
function optOutOnLineIsValid(lines, lineIdx, key, rel) {
|
|
101
|
+
const cur = lines[lineIdx] ?? "";
|
|
102
|
+
const prev = lines[lineIdx - 1] ?? "";
|
|
103
|
+
const candidate = OPT_OUT_REQUIRES_REASON.test(cur)
|
|
104
|
+
? cur
|
|
105
|
+
: OPT_OUT_REQUIRES_REASON.test(prev)
|
|
106
|
+
? prev
|
|
107
|
+
: null;
|
|
108
|
+
if (!candidate)
|
|
109
|
+
return { ok: false, why: "missing or empty reason" };
|
|
110
|
+
if (/dev-only\b/i.test(candidate)) {
|
|
111
|
+
if (!DEV_ONLY_KEYS.has(key)) {
|
|
112
|
+
return {
|
|
113
|
+
ok: false,
|
|
114
|
+
why: `key "${key}" is not in the dev-only credential allowlist`,
|
|
115
|
+
};
|
|
116
|
+
}
|
|
117
|
+
if (!isDevOnlyPath(rel)) {
|
|
118
|
+
return {
|
|
119
|
+
ok: false,
|
|
120
|
+
why: "dev-only opt-out used outside dev / scripts / test paths",
|
|
121
|
+
};
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
return { ok: true };
|
|
125
|
+
}
|
|
126
|
+
export function scanEnvCredentials(options) {
|
|
127
|
+
const { root } = options;
|
|
128
|
+
const findings = [];
|
|
129
|
+
for (const file of walk(root)) {
|
|
130
|
+
if (!/\.(ts|tsx|mts|cts|js|mjs|cjs)$/.test(file))
|
|
131
|
+
continue;
|
|
132
|
+
if (file.endsWith(".d.ts"))
|
|
133
|
+
continue;
|
|
134
|
+
const rel = relPosix(root, file);
|
|
135
|
+
const contents = readFileSafe(file);
|
|
136
|
+
if (contents === null || !contents.includes("process.env"))
|
|
137
|
+
continue;
|
|
138
|
+
const lines = contents.split("\n");
|
|
139
|
+
ENV_READ_REGEX.lastIndex = 0;
|
|
140
|
+
let m;
|
|
141
|
+
while ((m = ENV_READ_REGEX.exec(contents)) !== null) {
|
|
142
|
+
const key = m[1] ?? m[2];
|
|
143
|
+
if (!key)
|
|
144
|
+
continue;
|
|
145
|
+
const { line } = lineColForOffset(contents, m.index);
|
|
146
|
+
const lineIdx = line - 1;
|
|
147
|
+
const lineText = lines[lineIdx] ?? "";
|
|
148
|
+
const trimmed = lineText.trimStart();
|
|
149
|
+
if (trimmed.startsWith("*") ||
|
|
150
|
+
trimmed.startsWith("//") ||
|
|
151
|
+
trimmed.startsWith("/*")) {
|
|
152
|
+
continue;
|
|
153
|
+
}
|
|
154
|
+
if (isAllowlistedKey(key))
|
|
155
|
+
continue;
|
|
156
|
+
if (hasOptOutOnLine(lines, lineIdx)) {
|
|
157
|
+
const verdict = optOutOnLineIsValid(lines, lineIdx, key, rel);
|
|
158
|
+
if (verdict.ok)
|
|
159
|
+
continue;
|
|
160
|
+
findings.push({
|
|
161
|
+
file: rel,
|
|
162
|
+
line,
|
|
163
|
+
message: `process.env.${key} opt-out invalid: ${verdict.why}`,
|
|
164
|
+
});
|
|
165
|
+
continue;
|
|
166
|
+
}
|
|
167
|
+
findings.push({
|
|
168
|
+
file: rel,
|
|
169
|
+
line,
|
|
170
|
+
message: `process.env.${key} read — not a deploy-level allowlisted key. User credentials must be read via resolveCredential(key, { userEmail, orgId }), never process.env.`,
|
|
171
|
+
});
|
|
172
|
+
}
|
|
173
|
+
ENV_DYNAMIC_READ_REGEX.lastIndex = 0;
|
|
174
|
+
while ((m = ENV_DYNAMIC_READ_REGEX.exec(contents)) !== null) {
|
|
175
|
+
const { line } = lineColForOffset(contents, m.index);
|
|
176
|
+
const lineIdx = line - 1;
|
|
177
|
+
const lineText = lines[lineIdx] ?? "";
|
|
178
|
+
const trimmed = lineText.trimStart();
|
|
179
|
+
if (trimmed.startsWith("*") ||
|
|
180
|
+
trimmed.startsWith("//") ||
|
|
181
|
+
trimmed.startsWith("/*")) {
|
|
182
|
+
continue;
|
|
183
|
+
}
|
|
184
|
+
if (hasOptOutOnLine(lines, lineIdx)) {
|
|
185
|
+
const verdict = optOutOnLineIsValid(lines, lineIdx, "<dynamic>", rel);
|
|
186
|
+
if (verdict.ok)
|
|
187
|
+
continue;
|
|
188
|
+
findings.push({
|
|
189
|
+
file: rel,
|
|
190
|
+
line,
|
|
191
|
+
message: `process.env[<dynamic>] opt-out invalid: ${verdict.why}`,
|
|
192
|
+
});
|
|
193
|
+
continue;
|
|
194
|
+
}
|
|
195
|
+
findings.push({
|
|
196
|
+
file: rel,
|
|
197
|
+
line,
|
|
198
|
+
message: `process.env[<dynamic key>] read — dynamic keys can never be allowlisted safely.`,
|
|
199
|
+
});
|
|
200
|
+
}
|
|
201
|
+
}
|
|
202
|
+
return { name: "no-env-credentials", findings };
|
|
203
|
+
}
|
|
204
|
+
//# sourceMappingURL=no-env-credentials.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"no-env-credentials.js","sourceRoot":"","sources":["../../src/guards/no-env-credentials.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCG;AAEH,OAAO,EACL,gBAAgB,EAChB,YAAY,EACZ,QAAQ,EACR,IAAI,GACL,MAAM,iBAAiB,CAAC;AAGzB,MAAM,eAAe,GAAG,IAAI,GAAG,C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AU,CAAC,IAAI,CAAC,EACxB,CAAC;gBACD,SAAS;YACX,CAAC;YACD,IAAI,eAAe,CAAC,KAAK,EAAE,OAAO,CAAC,EAAE,CAAC;gBACpC,MAAM,OAAO,GAAG,mBAAmB,CAAC,KAAK,EAAE,OAAO,EAAE,WAAW,EAAE,GAAG,CAAC,CAAC;gBACtE,IAAI,OAAO,CAAC,EAAE;oBAAE,SAAS;gBACzB,QAAQ,CAAC,IAAI,CAAC;oBACZ,IAAI,EAAE,GAAG;oBACT,IAAI;oBACJ,OAAO,EAAE,2CAA2C,OAAO,CAAC,GAAG,EAAE;iBAClE,CAAC,CAAC;gBACH,SAAS;YACX,CAAC;YACD,QAAQ,CAAC,IAAI,CAAC;gBACZ,IAAI,EAAE,GAAG;gBACT,IAAI;gBACJ,OAAO,EAAE,iFAAiF;aAC3F,CAAC,CAAC;QACL,CAAC;IACH,CAAC;IAED,OAAO,EAAE,IAAI,EAAE,oBAAoB,EAAE,QAAQ,EAAE,CAAC;AAClD,CAAC","sourcesContent":["/**\n * scanEnvCredentials — ported from `scripts/guard-no-env-credentials.mjs`.\n *\n * User credentials are per-user (or per-org) data. They MUST live in SQL,\n * scoped by `userEmail` / `orgId`, never in `process.env` — a deployment's\n * env vars are shared by every signed-in user. This guard flags any\n * `process.env.<KEY>` / `process.env[\"KEY\"]` read whose key is not on the\n * deploy-level allowlist (`DATABASE_URL`, `BETTER_AUTH_SECRET`, etc.), plus\n * any dynamic `process.env[key]` read (the key is only known at runtime, so\n * it can never be allowlisted safely).\n *\n * Conditional guard — per report 005's V1 guard set table, this is \"the big\n * one\": the original only scans a curated set of monorepo subtrees\n * (`packages/core/src/{credentials,secrets,vault,agent}/`, template\n * credential libs/routes) via `FORBIDDEN_PATH_PREDICATES` — none of which\n * exist in a generated app, so nothing would ever be scanned. This port\n * replaces that default-allow-outside-a-curated-subtree behavior with\n * default-deny across the whole app source tree: every `process.env.<KEY>`\n * read anywhere in app source must be on the deploy-var allowlist (kept\n * verbatim) or carry the opt-out marker. `HIGH_RISK_ENV_KEY_ALLOWLIST`,\n * `HIGH_RISK_PROCESS_ENV_ALLOWLIST`, and `HIGH_RISK_ENV_VARS_WRITE_ALLOWLIST`\n * — the three monorepo-file-keyed exception maps for specific template\n * platform-adapter files — are dropped entirely per the report; with\n * default-deny scanning already covering every `process.env` read\n * everywhere, the narrower `env-config.ts`/`core-routes.ts`-specific\n * registration checks those maps supported become redundant (any\n * high-risk key would already be caught by the general scan) and are\n * dropped along with them. The per-line `// guard:allow-env-credential`\n * marker remains the only escape hatch.\n *\n * Opt-out (same line, or the line immediately above):\n * process.env.SOMETHING // guard:allow-env-credential — short reason\n */\n\nimport {\n lineColForOffset,\n readFileSafe,\n relPosix,\n walk,\n} from \"./scan-utils.js\";\nimport type { GuardFinding, GuardResult, GuardScanOptions } from \"./types.js\";\n\nconst ALLOWLIST_EXACT = new Set([\n \"DATABASE_URL\",\n \"DATABASE_AUTH_TOKEN\",\n \"NODE_ENV\",\n \"CI\",\n \"DEBUG\",\n \"NETLIFY\",\n \"VERCEL\",\n \"RENDER\",\n \"FLY_APP_NAME\",\n \"K_SERVICE\",\n \"AWS_LAMBDA_FUNCTION_NAME\",\n \"BETTER_AUTH_SECRET\",\n \"BETTER_AUTH_URL\",\n \"NOTION_CLIENT_ID\",\n \"NOTION_CLIENT_SECRET\",\n \"NOTION_STATE_SECRET\",\n \"GOOGLE_SIGN_IN_CLIENT_ID\",\n \"GOOGLE_SIGN_IN_CLIENT_SECRET\",\n \"AUTH_SECRET\",\n \"A2A_SECRET\",\n \"ACCESS_TOKEN\",\n \"PORT\",\n \"HOST\",\n \"SECRETS_ENCRYPTION_KEY\",\n]);\n\nconst ALLOWLIST_PREFIX = [\n \"npm_\",\n \"AGENT_NATIVE_\",\n \"AGENT_\",\n \"NETLIFY_\",\n \"VERCEL_\",\n \"CF_\",\n];\n\n/** Dev-only paths where ANTHROPIC_API_KEY etc. may legitimately be read\n * from env (local dev tooling, scripts, tests). Portable subset of the\n * original — the monorepo-only `packages/core/src/dev` predicate is\n * dropped (see report 005's V1 guard set table). */\nconst DEV_ONLY_PATH_PATTERNS = [\n /\\.spec\\.[tj]sx?$/,\n /\\.test\\.[tj]sx?$/,\n /^scripts\\//,\n];\n\nconst DEV_ONLY_KEYS = new Set([\"ANTHROPIC_API_KEY\"]);\n\nconst OPT_OUT_MARKER = /\\/\\/\\s*guard:allow-env-credential\\b[^\\n]*/;\nconst OPT_OUT_REQUIRES_REASON = /\\/\\/\\s*guard:allow-env-credential\\s*[—-]\\s*\\S/;\n\nconst ENV_READ_REGEX =\n /process\\.env(?:\\.([A-Z][A-Z0-9_]*)|\\[\\s*[\"']([A-Z][A-Z0-9_]*)[\"']\\s*\\])/g;\n\nconst ENV_DYNAMIC_READ_REGEX =\n /process\\.env(?:\\?\\.)?\\s*\\[\\s*(?![\"'])([^\\]\\n]+?)\\s*\\]/g;\n\nfunction isAllowlistedKey(key: string): boolean {\n if (ALLOWLIST_EXACT.has(key)) return true;\n return ALLOWLIST_PREFIX.some((prefix) => key.startsWith(prefix));\n}\n\nfunction isDevOnlyPath(rel: string): boolean {\n return DEV_ONLY_PATH_PATTERNS.some((re) => re.test(rel));\n}\n\nfunction hasOptOutOnLine(lines: string[], lineIdx: number): boolean {\n const cur = lines[lineIdx] ?? \"\";\n if (OPT_OUT_MARKER.test(cur)) return true;\n const prev = lines[lineIdx - 1] ?? \"\";\n if (/^\\s*\\/\\//.test(prev) && OPT_OUT_MARKER.test(prev)) return true;\n return false;\n}\n\nfunction optOutOnLineIsValid(\n lines: string[],\n lineIdx: number,\n key: string,\n rel: string,\n): { ok: boolean; why?: string } {\n const cur = lines[lineIdx] ?? \"\";\n const prev = lines[lineIdx - 1] ?? \"\";\n const candidate = OPT_OUT_REQUIRES_REASON.test(cur)\n ? cur\n : OPT_OUT_REQUIRES_REASON.test(prev)\n ? prev\n : null;\n if (!candidate) return { ok: false, why: \"missing or empty reason\" };\n\n if (/dev-only\\b/i.test(candidate)) {\n if (!DEV_ONLY_KEYS.has(key)) {\n return {\n ok: false,\n why: `key \"${key}\" is not in the dev-only credential allowlist`,\n };\n }\n if (!isDevOnlyPath(rel)) {\n return {\n ok: false,\n why: \"dev-only opt-out used outside dev / scripts / test paths\",\n };\n }\n }\n return { ok: true };\n}\n\nexport function scanEnvCredentials(options: GuardScanOptions): GuardResult {\n const { root } = options;\n const findings: GuardFinding[] = [];\n\n for (const file of walk(root)) {\n if (!/\\.(ts|tsx|mts|cts|js|mjs|cjs)$/.test(file)) continue;\n if (file.endsWith(\".d.ts\")) continue;\n const rel = relPosix(root, file);\n\n const contents = readFileSafe(file);\n if (contents === null || !contents.includes(\"process.env\")) continue;\n\n const lines = contents.split(\"\\n\");\n\n ENV_READ_REGEX.lastIndex = 0;\n let m: RegExpExecArray | null;\n while ((m = ENV_READ_REGEX.exec(contents)) !== null) {\n const key = m[1] ?? m[2];\n if (!key) continue;\n const { line } = lineColForOffset(contents, m.index);\n const lineIdx = line - 1;\n const lineText = lines[lineIdx] ?? \"\";\n const trimmed = lineText.trimStart();\n if (\n trimmed.startsWith(\"*\") ||\n trimmed.startsWith(\"//\") ||\n trimmed.startsWith(\"/*\")\n ) {\n continue;\n }\n if (isAllowlistedKey(key)) continue;\n if (hasOptOutOnLine(lines, lineIdx)) {\n const verdict = optOutOnLineIsValid(lines, lineIdx, key, rel);\n if (verdict.ok) continue;\n findings.push({\n file: rel,\n line,\n message: `process.env.${key} opt-out invalid: ${verdict.why}`,\n });\n continue;\n }\n findings.push({\n file: rel,\n line,\n message: `process.env.${key} read — not a deploy-level allowlisted key. User credentials must be read via resolveCredential(key, { userEmail, orgId }), never process.env.`,\n });\n }\n\n ENV_DYNAMIC_READ_REGEX.lastIndex = 0;\n while ((m = ENV_DYNAMIC_READ_REGEX.exec(contents)) !== null) {\n const { line } = lineColForOffset(contents, m.index);\n const lineIdx = line - 1;\n const lineText = lines[lineIdx] ?? \"\";\n const trimmed = lineText.trimStart();\n if (\n trimmed.startsWith(\"*\") ||\n trimmed.startsWith(\"//\") ||\n trimmed.startsWith(\"/*\")\n ) {\n continue;\n }\n if (hasOptOutOnLine(lines, lineIdx)) {\n const verdict = optOutOnLineIsValid(lines, lineIdx, \"<dynamic>\", rel);\n if (verdict.ok) continue;\n findings.push({\n file: rel,\n line,\n message: `process.env[<dynamic>] opt-out invalid: ${verdict.why}`,\n });\n continue;\n }\n findings.push({\n file: rel,\n line,\n message: `process.env[<dynamic key>] read — dynamic keys can never be allowlisted safely.`,\n });\n }\n }\n\n return { name: \"no-env-credentials\", findings };\n}\n"]}
|