@agent-native/core 0.99.3 → 0.100.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/corpus/README.md +2 -2
- package/corpus/core/CHANGELOG.md +21 -0
- package/corpus/core/docs/content/agent-surfaces.mdx +43 -0
- package/corpus/core/docs/content/external-agents.mdx +11 -0
- package/corpus/core/docs/content/locales/ar-SA/agent-surfaces.mdx +30 -0
- package/corpus/core/docs/content/locales/ar-SA/external-agents.mdx +9 -0
- package/corpus/core/docs/content/locales/de-DE/agent-surfaces.mdx +34 -0
- package/corpus/core/docs/content/locales/de-DE/external-agents.mdx +10 -0
- package/corpus/core/docs/content/locales/es-ES/agent-surfaces.mdx +34 -0
- package/corpus/core/docs/content/locales/es-ES/external-agents.mdx +10 -0
- package/corpus/core/docs/content/locales/fr-FR/agent-surfaces.mdx +34 -0
- package/corpus/core/docs/content/locales/fr-FR/external-agents.mdx +11 -0
- package/corpus/core/docs/content/locales/hi-IN/agent-surfaces.mdx +31 -0
- package/corpus/core/docs/content/locales/hi-IN/external-agents.mdx +9 -0
- package/corpus/core/docs/content/locales/ja-JP/agent-surfaces.mdx +32 -0
- package/corpus/core/docs/content/locales/ja-JP/external-agents.mdx +10 -0
- package/corpus/core/docs/content/locales/ko-KR/agent-surfaces.mdx +32 -0
- package/corpus/core/docs/content/locales/ko-KR/external-agents.mdx +9 -0
- package/corpus/core/docs/content/locales/pt-BR/agent-surfaces.mdx +33 -0
- package/corpus/core/docs/content/locales/pt-BR/external-agents.mdx +10 -0
- package/corpus/core/docs/content/locales/zh-CN/agent-surfaces.mdx +29 -0
- package/corpus/core/docs/content/locales/zh-CN/external-agents.mdx +8 -0
- package/corpus/core/docs/content/locales/zh-TW/agent-surfaces.mdx +29 -0
- package/corpus/core/docs/content/locales/zh-TW/external-agents.mdx +8 -0
- package/corpus/core/package.json +1 -1
- package/corpus/core/src/agent/context-xray/actions/context-evict.ts +11 -0
- package/corpus/core/src/agent/context-xray/actions/context-pin.ts +11 -0
- package/corpus/core/src/agent/context-xray/actions/context-preview-get.ts +134 -0
- package/corpus/core/src/agent/context-xray/actions/context-restore.ts +11 -0
- package/corpus/core/src/agent/context-xray/actions/errors.ts +20 -0
- package/corpus/core/src/agent/context-xray/manifest.ts +106 -7
- package/corpus/core/src/agent/engine/context-directives-transform.ts +5 -1
- package/corpus/core/src/agent/production-agent.ts +100 -38
- package/corpus/core/src/agent/run-loop-with-resume.ts +7 -2
- package/corpus/core/src/client/AgentPanel.tsx +35 -8
- package/corpus/core/src/client/agent-page/AgentContextTab.tsx +501 -0
- package/corpus/core/src/client/agent-page/AgentJobsTab.tsx +370 -0
- package/corpus/core/src/client/agent-page/AgentTabsPage.tsx +1084 -0
- package/corpus/core/src/client/agent-page/types.ts +18 -0
- package/corpus/core/src/client/agent-page/use-jobs.ts +150 -0
- package/corpus/core/src/client/context-xray/ContextMeter.tsx +22 -5
- package/corpus/core/src/client/context-xray/ContextTreemap.tsx +16 -1
- package/corpus/core/src/client/context-xray/ContextXRayPanel.tsx +168 -3
- package/corpus/core/src/client/context-xray/format.ts +6 -0
- package/corpus/core/src/client/index.ts +6 -0
- package/corpus/core/src/client/resources/ResourcesPanel.tsx +51 -23
- package/corpus/core/src/client/settings/AutomationsSection.tsx +407 -387
- package/corpus/core/src/jobs/actions/list-recurring-jobs.ts +105 -0
- package/corpus/core/src/jobs/actions/manage-recurring-job.ts +85 -0
- package/corpus/core/src/jobs/tools.ts +1 -1
- package/corpus/core/src/localization/default-messages.ts +110 -0
- package/corpus/core/src/mcp/build-server.ts +1 -0
- package/corpus/core/src/mcp/connect-route.ts +62 -65
- package/corpus/core/src/server/action-discovery.ts +23 -0
- package/corpus/core/src/server/agent-chat/prompt-resources.ts +174 -2
- package/corpus/core/src/server/agent-chat-plugin.ts +175 -2
- package/corpus/core/src/server/auth.ts +1 -7
- package/corpus/core/src/server/google-oauth.ts +1 -7
- package/corpus/core/src/server/workspace-oauth.ts +31 -0
- package/corpus/core/src/shared/context-xray.ts +84 -1
- package/corpus/core/src/shared/mcp-connect-content.ts +130 -0
- package/corpus/core/src/templates/default/app/routes/_index.tsx +11 -0
- package/corpus/core/src/templates/default/app/routes/agent.tsx +33 -0
- package/corpus/core/src/templates/workspace-core/.agents/skills/agent-native-toolkit/SKILL.md +6 -0
- package/corpus/core/src/templates/workspace-core/.agents/skills/agent-page/SKILL.md +59 -0
- package/corpus/core/src/templates/workspace-core/.agents/skills/context-xray/SKILL.md +25 -0
- package/corpus/core/src/templates/workspace-core/.agents/skills/external-agents/SKILL.md +7 -0
- package/corpus/core/src/templates/workspace-core/.agents/skills/recurring-jobs/SKILL.md +9 -0
- package/corpus/core/src/triggers/actions/list-automations.ts +99 -0
- package/corpus/core/src/triggers/actions/manage-automation.ts +78 -0
- package/corpus/templates/analytics/actions/data-source-status.ts +33 -15
- package/corpus/templates/analytics/actions/query-agent-native-analytics.ts +1 -1
- package/corpus/templates/analytics/app/components/dashboard/SqlChart.tsx +149 -24
- package/corpus/templates/analytics/app/components/layout/CommandPalette.tsx +17 -0
- package/corpus/templates/analytics/app/components/layout/Header.tsx +1 -0
- package/corpus/templates/analytics/app/components/layout/Layout.tsx +1 -0
- package/corpus/templates/analytics/app/components/layout/Sidebar.tsx +8 -0
- package/corpus/templates/analytics/app/i18n/zh-TW.ts +1 -0
- package/corpus/templates/analytics/app/i18n-data.ts +1 -0
- package/corpus/templates/analytics/app/routes/agent.tsx +5 -0
- package/corpus/templates/analytics/changelog/2026-07-13-a-full-agent-page-now-brings-context-files-connections-jobs-.md +6 -0
- package/corpus/templates/analytics/changelog/2026-07-13-analytics-answers-can-use-built-in-first-party-event-data.md +6 -0
- package/corpus/templates/analytics/changelog/2026-07-13-chart-legends-can-filter-to-one-series-or-hide-a-series-on-h.md +6 -0
- package/corpus/templates/analytics/changelog/2026-07-13-gpt-5-6-luna-answers-now-recover-normally-instead-of-showing.md +6 -0
- package/corpus/templates/analytics/server/plugins/agent-chat.ts +11 -2
- package/corpus/templates/assets/app/components/layout/Header.tsx +1 -0
- package/corpus/templates/assets/app/components/layout/Layout.tsx +1 -0
- package/corpus/templates/assets/app/components/layout/Sidebar.tsx +2 -0
- package/corpus/templates/assets/app/routes/agent.tsx +5 -0
- package/corpus/templates/assets/changelog/2026-07-13-a-full-agent-page-now-brings-context-files-connections-jobs-.md +6 -0
- package/corpus/templates/brain/app/components/layout/Layout.tsx +1 -0
- package/corpus/templates/brain/app/components/layout/Sidebar.tsx +4 -1
- package/corpus/templates/brain/app/lib/brain.ts +11 -0
- package/corpus/templates/brain/app/root.tsx +15 -1
- package/corpus/templates/brain/app/routes/agent.tsx +11 -0
- package/corpus/templates/brain/changelog/2026-07-13-a-full-agent-page-now-brings-context-files-connections-jobs-.md +6 -0
- package/corpus/templates/calendar/AGENTS.md +9 -0
- package/corpus/templates/calendar/actions/list-events.ts +659 -44
- package/corpus/templates/calendar/app/components/layout/AppLayout.tsx +1 -0
- package/corpus/templates/calendar/app/components/layout/Sidebar.tsx +2 -0
- package/corpus/templates/calendar/app/root.tsx +17 -1
- package/corpus/templates/calendar/app/routes/_app.agent.tsx +25 -0
- package/corpus/templates/calendar/changelog/2026-07-13-a-full-agent-page-now-brings-context-files-connections-jobs-.md +6 -0
- package/corpus/templates/calendar/changelog/2026-07-13-calendar-inventory-reads-report-source-coverage.md +6 -0
- package/corpus/templates/calendar/server/lib/calendar-connector-catalog.ts +8 -0
- package/corpus/templates/calendar/server/lib/google-calendar.ts +173 -51
- package/corpus/templates/calendar/server/lib/ical-fetcher.ts +13 -2
- package/corpus/templates/calendar/server/plugins/agent-chat.ts +5 -3
- package/corpus/templates/calendar/shared/api.ts +2 -0
- package/corpus/templates/chat/app/components/layout/Header.tsx +1 -0
- package/corpus/templates/chat/app/components/layout/Layout.tsx +1 -0
- package/corpus/templates/chat/app/components/layout/Sidebar.tsx +7 -0
- package/corpus/templates/chat/app/hooks/use-navigation-state.ts +3 -0
- package/corpus/templates/chat/app/root.tsx +24 -2
- package/corpus/templates/chat/app/routes/agent.tsx +15 -0
- package/corpus/templates/chat/changelog/2026-07-13-a-full-agent-page-now-brings-context-files-connections-jobs-.md +6 -0
- package/corpus/templates/clips/app/components/library/library-layout.tsx +8 -0
- package/corpus/templates/clips/app/i18n/ar-SA.ts +2 -0
- package/corpus/templates/clips/app/i18n/de-DE.ts +2 -0
- package/corpus/templates/clips/app/i18n/en-US.ts +2 -0
- package/corpus/templates/clips/app/i18n/es-ES.ts +2 -0
- package/corpus/templates/clips/app/i18n/fr-FR.ts +2 -0
- package/corpus/templates/clips/app/i18n/hi-IN.ts +2 -0
- package/corpus/templates/clips/app/i18n/ja-JP.ts +2 -0
- package/corpus/templates/clips/app/i18n/ko-KR.ts +2 -0
- package/corpus/templates/clips/app/i18n/pt-BR.ts +2 -0
- package/corpus/templates/clips/app/i18n/zh-CN.ts +2 -0
- package/corpus/templates/clips/app/i18n/zh-TW.ts +2 -0
- package/corpus/templates/clips/app/root.tsx +7 -1
- package/corpus/templates/clips/app/routes/_app.agent.tsx +15 -0
- package/corpus/templates/clips/changelog/2026-07-13-new-agent-page-see-and-manage-your-agent-s-context-files-con.md +6 -0
- package/corpus/templates/content/app/components/layout/Layout.tsx +1 -0
- package/corpus/templates/content/app/components/sidebar/DocumentSidebar.tsx +36 -0
- package/corpus/templates/content/app/i18n/zh-TW.ts +2 -0
- package/corpus/templates/content/app/i18n-data.ts +44 -6
- package/corpus/templates/content/app/root.tsx +8 -0
- package/corpus/templates/content/app/routes/_app.agent.tsx +15 -0
- package/corpus/templates/content/changelog/2026-07-13-new-agent-page-see-and-manage-your-agent-s-context-files-con.md +6 -0
- package/corpus/templates/design/app/components/layout/Layout.tsx +1 -0
- package/corpus/templates/design/app/components/layout/Sidebar.tsx +2 -0
- package/corpus/templates/design/app/i18n/zh-TW.ts +2 -0
- package/corpus/templates/design/app/i18n-data.ts +20 -0
- package/corpus/templates/design/app/root.tsx +7 -1
- package/corpus/templates/design/app/routes/agent.tsx +15 -0
- package/corpus/templates/design/changelog/2026-07-13-new-agent-page-see-and-manage-your-agent-s-context-files-con.md +6 -0
- package/corpus/templates/dispatch/app/dispatch-extensions.tsx +10 -1
- package/corpus/templates/dispatch/app/i18n/zh-TW.ts +2 -0
- package/corpus/templates/dispatch/app/i18n-data.ts +20 -0
- package/corpus/templates/dispatch/app/root.tsx +7 -2
- package/corpus/templates/dispatch/app/routes/agent.tsx +18 -0
- package/corpus/templates/dispatch/changelog/2026-07-13-new-agent-page-see-and-manage-your-agent-s-context-files-con.md +6 -0
- package/corpus/templates/forms/app/components/layout/Layout.tsx +1 -0
- package/corpus/templates/forms/app/components/layout/Sidebar.tsx +35 -0
- package/corpus/templates/forms/app/i18n/ar-SA.ts +2 -0
- package/corpus/templates/forms/app/i18n/de-DE.ts +2 -0
- package/corpus/templates/forms/app/i18n/en-US.ts +2 -0
- package/corpus/templates/forms/app/i18n/es-ES.ts +2 -0
- package/corpus/templates/forms/app/i18n/fr-FR.ts +2 -0
- package/corpus/templates/forms/app/i18n/hi-IN.ts +2 -0
- package/corpus/templates/forms/app/i18n/ja-JP.ts +2 -0
- package/corpus/templates/forms/app/i18n/ko-KR.ts +2 -0
- package/corpus/templates/forms/app/i18n/pt-BR.ts +2 -0
- package/corpus/templates/forms/app/i18n/zh-CN.ts +2 -0
- package/corpus/templates/forms/app/i18n/zh-TW.ts +2 -0
- package/corpus/templates/forms/app/root.tsx +6 -1
- package/corpus/templates/forms/app/routes/_app.agent.tsx +15 -0
- package/corpus/templates/forms/changelog/2026-07-13-new-agent-page-see-and-manage-your-agent-s-context-files-con.md +6 -0
- package/corpus/templates/macros/app/components/layout/AppLayout.tsx +14 -2
- package/corpus/templates/macros/app/components/layout/Header.tsx +1 -0
- package/corpus/templates/macros/app/root.tsx +17 -2
- package/corpus/templates/macros/app/routes/agent.tsx +15 -0
- package/corpus/templates/macros/changelog/2026-07-13-new-agent-page-see-and-manage-your-agent-s-context-files-con.md +6 -0
- package/corpus/templates/mail/AGENTS.md +12 -0
- package/corpus/templates/mail/actions/list-emails.ts +486 -4
- package/corpus/templates/mail/app/components/layout/AppLayout.tsx +42 -0
- package/corpus/templates/mail/app/components/layout/CommandPalette.tsx +6 -0
- package/corpus/templates/mail/app/routes/agent.tsx +15 -0
- package/corpus/templates/mail/changelog/2026-07-13-coverage-aware-connected-inbox-inventory.md +6 -0
- package/corpus/templates/mail/changelog/2026-07-13-new-agent-page-see-and-manage-your-agent-s-context-files-con.md +6 -0
- package/corpus/templates/mail/server/db/schema.ts +17 -0
- package/corpus/templates/mail/server/lib/google-auth.ts +33 -5
- package/corpus/templates/mail/server/lib/inventory-cursor.ts +406 -0
- package/corpus/templates/mail/server/lib/list-inbox-emails.ts +21 -2
- package/corpus/templates/mail/server/lib/mail-connector-catalog.ts +8 -0
- package/corpus/templates/mail/server/plugins/agent-chat.ts +4 -9
- package/corpus/templates/mail/server/plugins/db.ts +20 -0
- package/corpus/templates/plan/app/components/layout/Header.tsx +1 -0
- package/corpus/templates/plan/app/components/layout/Layout.tsx +1 -0
- package/corpus/templates/plan/app/components/layout/Sidebar.tsx +2 -0
- package/corpus/templates/plan/app/root.tsx +8 -0
- package/corpus/templates/plan/app/routes/agent.tsx +15 -0
- package/corpus/templates/plan/changelog/2026-07-13-new-agent-page-see-and-manage-your-agent-s-context-files-con.md +6 -0
- package/corpus/templates/slides/app/components/layout/Header.tsx +1 -0
- package/corpus/templates/slides/app/components/layout/Layout.tsx +1 -0
- package/corpus/templates/slides/app/components/layout/Sidebar.tsx +2 -0
- package/corpus/templates/slides/app/root.tsx +10 -1
- package/corpus/templates/slides/app/routes/agent.tsx +15 -0
- package/corpus/templates/slides/changelog/2026-07-13-new-agent-page-see-and-manage-your-agent-s-context-files-con.md +6 -0
- package/dist/agent/context-xray/actions/context-evict.js +5 -2
- package/dist/agent/context-xray/actions/context-evict.js.map +1 -1
- package/dist/agent/context-xray/actions/context-pin.js +5 -2
- package/dist/agent/context-xray/actions/context-pin.js.map +1 -1
- package/dist/agent/context-xray/actions/context-preview-get.d.ts +17 -0
- package/dist/agent/context-xray/actions/context-preview-get.d.ts.map +1 -0
- package/dist/agent/context-xray/actions/context-preview-get.js +94 -0
- package/dist/agent/context-xray/actions/context-preview-get.js.map +1 -0
- package/dist/agent/context-xray/actions/context-restore.js +5 -2
- package/dist/agent/context-xray/actions/context-restore.js.map +1 -1
- package/dist/agent/context-xray/actions/errors.d.ts +3 -0
- package/dist/agent/context-xray/actions/errors.d.ts.map +1 -1
- package/dist/agent/context-xray/actions/errors.js +6 -0
- package/dist/agent/context-xray/actions/errors.js.map +1 -1
- package/dist/agent/context-xray/manifest.d.ts +18 -1
- package/dist/agent/context-xray/manifest.d.ts.map +1 -1
- package/dist/agent/context-xray/manifest.js +68 -6
- package/dist/agent/context-xray/manifest.js.map +1 -1
- package/dist/agent/engine/context-directives-transform.d.ts +2 -0
- package/dist/agent/engine/context-directives-transform.d.ts.map +1 -1
- package/dist/agent/engine/context-directives-transform.js +2 -1
- package/dist/agent/engine/context-directives-transform.js.map +1 -1
- package/dist/agent/production-agent.d.ts +15 -0
- package/dist/agent/production-agent.d.ts.map +1 -1
- package/dist/agent/production-agent.js +74 -36
- package/dist/agent/production-agent.js.map +1 -1
- package/dist/agent/run-loop-with-resume.d.ts.map +1 -1
- package/dist/agent/run-loop-with-resume.js +6 -3
- package/dist/agent/run-loop-with-resume.js.map +1 -1
- package/dist/client/AgentPanel.d.ts +5 -1
- package/dist/client/AgentPanel.d.ts.map +1 -1
- package/dist/client/AgentPanel.js +9 -11
- package/dist/client/AgentPanel.js.map +1 -1
- package/dist/client/agent-page/AgentContextTab.d.ts +5 -0
- package/dist/client/agent-page/AgentContextTab.d.ts.map +1 -0
- package/dist/client/agent-page/AgentContextTab.js +202 -0
- package/dist/client/agent-page/AgentContextTab.js.map +1 -0
- package/dist/client/agent-page/AgentJobsTab.d.ts +3 -0
- package/dist/client/agent-page/AgentJobsTab.d.ts.map +1 -0
- package/dist/client/agent-page/AgentJobsTab.js +98 -0
- package/dist/client/agent-page/AgentJobsTab.js.map +1 -0
- package/dist/client/agent-page/AgentTabsPage.d.ts +20 -0
- package/dist/client/agent-page/AgentTabsPage.d.ts.map +1 -0
- package/dist/client/agent-page/AgentTabsPage.js +420 -0
- package/dist/client/agent-page/AgentTabsPage.js.map +1 -0
- package/dist/client/agent-page/types.d.ts +17 -0
- package/dist/client/agent-page/types.d.ts.map +1 -0
- package/dist/client/agent-page/types.js +9 -0
- package/dist/client/agent-page/types.js.map +1 -0
- package/dist/client/agent-page/use-jobs.d.ts +61 -0
- package/dist/client/agent-page/use-jobs.d.ts.map +1 -0
- package/dist/client/agent-page/use-jobs.js +71 -0
- package/dist/client/agent-page/use-jobs.js.map +1 -0
- package/dist/client/context-xray/ContextMeter.d.ts +3 -1
- package/dist/client/context-xray/ContextMeter.d.ts.map +1 -1
- package/dist/client/context-xray/ContextMeter.js +14 -5
- package/dist/client/context-xray/ContextMeter.js.map +1 -1
- package/dist/client/context-xray/ContextTreemap.d.ts +3 -2
- package/dist/client/context-xray/ContextTreemap.d.ts.map +1 -1
- package/dist/client/context-xray/ContextTreemap.js +9 -1
- package/dist/client/context-xray/ContextTreemap.js.map +1 -1
- package/dist/client/context-xray/ContextXRayPanel.d.ts.map +1 -1
- package/dist/client/context-xray/ContextXRayPanel.js +95 -20
- package/dist/client/context-xray/ContextXRayPanel.js.map +1 -1
- package/dist/client/context-xray/format.d.ts.map +1 -1
- package/dist/client/context-xray/format.js +12 -0
- package/dist/client/context-xray/format.js.map +1 -1
- package/dist/client/index.d.ts +3 -0
- package/dist/client/index.d.ts.map +1 -1
- package/dist/client/index.js +1 -0
- package/dist/client/index.js.map +1 -1
- package/dist/client/resources/ResourcesPanel.d.ts +9 -1
- package/dist/client/resources/ResourcesPanel.d.ts.map +1 -1
- package/dist/client/resources/ResourcesPanel.js +26 -10
- package/dist/client/resources/ResourcesPanel.js.map +1 -1
- package/dist/client/settings/AutomationsSection.d.ts +9 -0
- package/dist/client/settings/AutomationsSection.d.ts.map +1 -1
- package/dist/client/settings/AutomationsSection.js +128 -147
- package/dist/client/settings/AutomationsSection.js.map +1 -1
- package/dist/collab/routes.d.ts +1 -1
- package/dist/collab/struct-routes.d.ts +1 -1
- package/dist/file-upload/actions/upload-image.d.ts +1 -1
- package/dist/jobs/actions/list-recurring-jobs.d.ts +21 -0
- package/dist/jobs/actions/list-recurring-jobs.d.ts.map +1 -0
- package/dist/jobs/actions/list-recurring-jobs.js +74 -0
- package/dist/jobs/actions/list-recurring-jobs.js.map +1 -0
- package/dist/jobs/actions/manage-recurring-job.d.ts +18 -0
- package/dist/jobs/actions/manage-recurring-job.d.ts.map +1 -0
- package/dist/jobs/actions/manage-recurring-job.js +68 -0
- package/dist/jobs/actions/manage-recurring-job.js.map +1 -0
- package/dist/jobs/tools.d.ts +13 -0
- package/dist/jobs/tools.d.ts.map +1 -1
- package/dist/jobs/tools.js +1 -1
- package/dist/jobs/tools.js.map +1 -1
- package/dist/localization/default-messages.d.ts +96 -0
- package/dist/localization/default-messages.d.ts.map +1 -1
- package/dist/localization/default-messages.js +96 -0
- package/dist/localization/default-messages.js.map +1 -1
- package/dist/mcp/build-server.d.ts.map +1 -1
- package/dist/mcp/build-server.js +1 -0
- package/dist/mcp/build-server.js.map +1 -1
- package/dist/mcp/connect-route.d.ts.map +1 -1
- package/dist/mcp/connect-route.js +44 -59
- package/dist/mcp/connect-route.js.map +1 -1
- package/dist/notifications/routes.d.ts +1 -1
- package/dist/observability/routes.d.ts +5 -5
- package/dist/progress/routes.d.ts +1 -1
- package/dist/resources/handlers.d.ts +3 -3
- package/dist/secrets/routes.d.ts +9 -9
- package/dist/server/action-discovery.d.ts.map +1 -1
- package/dist/server/action-discovery.js +23 -0
- package/dist/server/action-discovery.js.map +1 -1
- package/dist/server/agent-chat/prompt-resources.d.ts +14 -0
- package/dist/server/agent-chat/prompt-resources.d.ts.map +1 -1
- package/dist/server/agent-chat/prompt-resources.js +139 -2
- package/dist/server/agent-chat/prompt-resources.js.map +1 -1
- package/dist/server/agent-chat-plugin.d.ts +1 -0
- package/dist/server/agent-chat-plugin.d.ts.map +1 -1
- package/dist/server/agent-chat-plugin.js +136 -3
- 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/auth.d.ts.map +1 -1
- package/dist/server/auth.js +1 -4
- package/dist/server/auth.js.map +1 -1
- package/dist/server/google-oauth.d.ts.map +1 -1
- package/dist/server/google-oauth.js +1 -4
- package/dist/server/google-oauth.js.map +1 -1
- package/dist/server/workspace-oauth.d.ts +11 -0
- package/dist/server/workspace-oauth.d.ts.map +1 -0
- package/dist/server/workspace-oauth.js +25 -0
- package/dist/server/workspace-oauth.js.map +1 -0
- package/dist/shared/context-xray.d.ts +45 -1
- package/dist/shared/context-xray.d.ts.map +1 -1
- package/dist/shared/context-xray.js +12 -0
- package/dist/shared/context-xray.js.map +1 -1
- package/dist/shared/mcp-connect-content.d.ts +37 -0
- package/dist/shared/mcp-connect-content.d.ts.map +1 -0
- package/dist/shared/mcp-connect-content.js +92 -0
- package/dist/shared/mcp-connect-content.js.map +1 -0
- package/dist/templates/default/app/routes/_index.tsx +11 -0
- package/dist/templates/default/app/routes/agent.tsx +33 -0
- package/dist/templates/workspace-core/.agents/skills/agent-native-toolkit/SKILL.md +6 -0
- package/dist/templates/workspace-core/.agents/skills/agent-page/SKILL.md +59 -0
- package/dist/templates/workspace-core/.agents/skills/context-xray/SKILL.md +25 -0
- package/dist/templates/workspace-core/.agents/skills/external-agents/SKILL.md +7 -0
- package/dist/templates/workspace-core/.agents/skills/recurring-jobs/SKILL.md +9 -0
- package/dist/triggers/actions/list-automations.d.ts +24 -0
- package/dist/triggers/actions/list-automations.d.ts.map +1 -0
- package/dist/triggers/actions/list-automations.js +72 -0
- package/dist/triggers/actions/list-automations.js.map +1 -0
- package/dist/triggers/actions/manage-automation.d.ts +18 -0
- package/dist/triggers/actions/manage-automation.d.ts.map +1 -0
- package/dist/triggers/actions/manage-automation.js +60 -0
- package/dist/triggers/actions/manage-automation.js.map +1 -0
- package/docs/content/agent-surfaces.mdx +43 -0
- package/docs/content/external-agents.mdx +11 -0
- package/docs/content/locales/ar-SA/agent-surfaces.mdx +30 -0
- package/docs/content/locales/ar-SA/external-agents.mdx +9 -0
- package/docs/content/locales/de-DE/agent-surfaces.mdx +34 -0
- package/docs/content/locales/de-DE/external-agents.mdx +10 -0
- package/docs/content/locales/es-ES/agent-surfaces.mdx +34 -0
- package/docs/content/locales/es-ES/external-agents.mdx +10 -0
- package/docs/content/locales/fr-FR/agent-surfaces.mdx +34 -0
- package/docs/content/locales/fr-FR/external-agents.mdx +11 -0
- package/docs/content/locales/hi-IN/agent-surfaces.mdx +31 -0
- package/docs/content/locales/hi-IN/external-agents.mdx +9 -0
- package/docs/content/locales/ja-JP/agent-surfaces.mdx +32 -0
- package/docs/content/locales/ja-JP/external-agents.mdx +10 -0
- package/docs/content/locales/ko-KR/agent-surfaces.mdx +32 -0
- package/docs/content/locales/ko-KR/external-agents.mdx +9 -0
- package/docs/content/locales/pt-BR/agent-surfaces.mdx +33 -0
- package/docs/content/locales/pt-BR/external-agents.mdx +10 -0
- package/docs/content/locales/zh-CN/agent-surfaces.mdx +29 -0
- package/docs/content/locales/zh-CN/external-agents.mdx +8 -0
- package/docs/content/locales/zh-TW/agent-surfaces.mdx +29 -0
- package/docs/content/locales/zh-TW/external-agents.mdx +8 -0
- package/package.json +1 -1
- package/src/templates/default/app/routes/_index.tsx +11 -0
- package/src/templates/default/app/routes/agent.tsx +33 -0
- package/src/templates/workspace-core/.agents/skills/agent-native-toolkit/SKILL.md +6 -0
- package/src/templates/workspace-core/.agents/skills/agent-page/SKILL.md +59 -0
- package/src/templates/workspace-core/.agents/skills/context-xray/SKILL.md +25 -0
- package/src/templates/workspace-core/.agents/skills/external-agents/SKILL.md +7 -0
- package/src/templates/workspace-core/.agents/skills/recurring-jobs/SKILL.md +9 -0
|
@@ -14,6 +14,11 @@ import {
|
|
|
14
14
|
sharedResourceOwner,
|
|
15
15
|
WORKSPACE_OWNER,
|
|
16
16
|
} from "../../resources/store.js";
|
|
17
|
+
import type {
|
|
18
|
+
ContextGovernanceTier,
|
|
19
|
+
ContextManifestSourceRef,
|
|
20
|
+
ContextSystemProvenance,
|
|
21
|
+
} from "../../shared/context-xray.js";
|
|
17
22
|
import { discoverAgents } from "../agent-discovery.js";
|
|
18
23
|
import { getRequestOrgId } from "../request-context.js";
|
|
19
24
|
import { parseSkillFrontmatter } from "./skill-frontmatter.js";
|
|
@@ -40,10 +45,177 @@ const PROMPT_SKILL_METADATA_READ_LIMIT = 80;
|
|
|
40
45
|
const PROMPT_INSTRUCTION_SUMMARY_LIMIT = 20;
|
|
41
46
|
const PROMPT_SUMMARY_DESCRIPTION_MAX_CHARS = 180;
|
|
42
47
|
|
|
48
|
+
export interface PromptResourceManifestSection {
|
|
49
|
+
label: string;
|
|
50
|
+
provenance: ContextSystemProvenance;
|
|
51
|
+
governance: ContextGovernanceTier;
|
|
52
|
+
content: string;
|
|
53
|
+
sourceRef?: ContextManifestSourceRef;
|
|
54
|
+
}
|
|
55
|
+
|
|
43
56
|
function normalizeResourcePathForPrompt(path: string): string {
|
|
44
57
|
return path.replace(/^\/+/, "").trim();
|
|
45
58
|
}
|
|
46
59
|
|
|
60
|
+
function xmlAttribute(attrs: string, name: string): string | undefined {
|
|
61
|
+
const match = new RegExp(`\\b${name}="([^"]*)"`).exec(attrs);
|
|
62
|
+
return match?.[1];
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
function resourceManifestClassification(
|
|
66
|
+
scope: string,
|
|
67
|
+
path: string,
|
|
68
|
+
index: number,
|
|
69
|
+
): {
|
|
70
|
+
provenance: ContextSystemProvenance;
|
|
71
|
+
governance: ContextGovernanceTier;
|
|
72
|
+
} {
|
|
73
|
+
const normalizedPath = normalizeResourcePathForPrompt(path);
|
|
74
|
+
if (scope === "template") {
|
|
75
|
+
return { provenance: "template", governance: "inherited" };
|
|
76
|
+
}
|
|
77
|
+
if (scope.startsWith("workspace")) {
|
|
78
|
+
return {
|
|
79
|
+
provenance:
|
|
80
|
+
scope === "workspace" && index === 0
|
|
81
|
+
? "enterprise-workspace-core"
|
|
82
|
+
: "sql-workspace",
|
|
83
|
+
governance:
|
|
84
|
+
scope === "workspace" && index === 0 ? "required" : "inherited",
|
|
85
|
+
};
|
|
86
|
+
}
|
|
87
|
+
if (scope.startsWith("personal")) {
|
|
88
|
+
return {
|
|
89
|
+
provenance: normalizedPath === "memory/MEMORY.md" ? "memory" : "personal",
|
|
90
|
+
governance: "user",
|
|
91
|
+
};
|
|
92
|
+
}
|
|
93
|
+
if (scope.startsWith("app-default")) {
|
|
94
|
+
return { provenance: "legacy-app-default", governance: "inherited" };
|
|
95
|
+
}
|
|
96
|
+
if (scope.startsWith("organization")) {
|
|
97
|
+
return { provenance: "organization", governance: "inherited" };
|
|
98
|
+
}
|
|
99
|
+
if (scope.startsWith("shared")) {
|
|
100
|
+
return {
|
|
101
|
+
provenance:
|
|
102
|
+
normalizedPath === "LEARNINGS.md"
|
|
103
|
+
? "organization"
|
|
104
|
+
: "legacy-app-default",
|
|
105
|
+
governance: "inherited",
|
|
106
|
+
};
|
|
107
|
+
}
|
|
108
|
+
return { provenance: "template", governance: "inherited" };
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
/**
|
|
112
|
+
* Extracts bounded-in-memory metadata from the already-composed resource
|
|
113
|
+
* prompt. The caller turns these inputs into hashed/previews before anything
|
|
114
|
+
* is persisted; this helper never writes or returns the full manifest.
|
|
115
|
+
*/
|
|
116
|
+
export function promptResourceManifestSections(
|
|
117
|
+
prompt: string,
|
|
118
|
+
): PromptResourceManifestSection[] {
|
|
119
|
+
const sections: PromptResourceManifestSection[] = [];
|
|
120
|
+
const resourcePattern = /<resource\b([^>]*)>([\s\S]*?)<\/resource>/g;
|
|
121
|
+
let match: RegExpExecArray | null;
|
|
122
|
+
let workspaceIndex = 0;
|
|
123
|
+
let sharedIndex = 0;
|
|
124
|
+
while ((match = resourcePattern.exec(prompt))) {
|
|
125
|
+
const attrs = match[1] ?? "";
|
|
126
|
+
const scope = xmlAttribute(attrs, "scope") ?? "resource";
|
|
127
|
+
const path =
|
|
128
|
+
xmlAttribute(attrs, "path") ?? xmlAttribute(attrs, "name") ?? "";
|
|
129
|
+
const name = xmlAttribute(attrs, "name") ?? (path || "resource");
|
|
130
|
+
const index = scope.startsWith("workspace")
|
|
131
|
+
? workspaceIndex++
|
|
132
|
+
: scope.startsWith("shared")
|
|
133
|
+
? sharedIndex++
|
|
134
|
+
: 0;
|
|
135
|
+
const classification = resourceManifestClassification(scope, path, index);
|
|
136
|
+
sections.push({
|
|
137
|
+
label: name,
|
|
138
|
+
...classification,
|
|
139
|
+
content: match[2] ?? "",
|
|
140
|
+
sourceRef: {
|
|
141
|
+
...(path ? { path } : {}),
|
|
142
|
+
scope,
|
|
143
|
+
},
|
|
144
|
+
});
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
const taggedSections = [
|
|
148
|
+
{
|
|
149
|
+
tag: "skills-summary",
|
|
150
|
+
label: "Workspace skills index",
|
|
151
|
+
provenance: "template" as const,
|
|
152
|
+
governance: "inherited" as const,
|
|
153
|
+
},
|
|
154
|
+
{
|
|
155
|
+
tag: "resource-skills",
|
|
156
|
+
label: "Workspace resource skills",
|
|
157
|
+
provenance: "template" as const,
|
|
158
|
+
governance: "inherited" as const,
|
|
159
|
+
},
|
|
160
|
+
{
|
|
161
|
+
tag: "instruction-resources",
|
|
162
|
+
label: "Instruction resources index",
|
|
163
|
+
provenance: "sql-workspace" as const,
|
|
164
|
+
governance: "inherited" as const,
|
|
165
|
+
},
|
|
166
|
+
{
|
|
167
|
+
tag: "workspace-resources",
|
|
168
|
+
label: "Workspace reference resources",
|
|
169
|
+
provenance: "sql-workspace" as const,
|
|
170
|
+
governance: "inherited" as const,
|
|
171
|
+
},
|
|
172
|
+
{
|
|
173
|
+
tag: "context-note",
|
|
174
|
+
label: "Resource availability note",
|
|
175
|
+
provenance: "framework-core" as const,
|
|
176
|
+
governance: "required" as const,
|
|
177
|
+
},
|
|
178
|
+
{
|
|
179
|
+
tag: "context-budget-note",
|
|
180
|
+
label: "Context budget note",
|
|
181
|
+
provenance: "framework-core" as const,
|
|
182
|
+
governance: "required" as const,
|
|
183
|
+
},
|
|
184
|
+
{
|
|
185
|
+
tag: "available-apps",
|
|
186
|
+
label: "Available workspace apps",
|
|
187
|
+
provenance: "tools" as const,
|
|
188
|
+
governance: "required" as const,
|
|
189
|
+
},
|
|
190
|
+
];
|
|
191
|
+
for (const tagged of taggedSections) {
|
|
192
|
+
const pattern = new RegExp(
|
|
193
|
+
`<${tagged.tag}\\b[^>]*>([\\s\\S]*?)</${tagged.tag}>`,
|
|
194
|
+
"g",
|
|
195
|
+
);
|
|
196
|
+
let taggedMatch: RegExpExecArray | null;
|
|
197
|
+
while ((taggedMatch = pattern.exec(prompt))) {
|
|
198
|
+
const taggedAttrs =
|
|
199
|
+
taggedMatch[0]?.slice(tagged.tag.length + 1).split(">")[0] ?? "";
|
|
200
|
+
const taggedScope = xmlAttribute(taggedAttrs, "scope");
|
|
201
|
+
const taggedClassification =
|
|
202
|
+
tagged.tag === "instruction-resources" && taggedScope
|
|
203
|
+
? resourceManifestClassification(taggedScope, "", 0)
|
|
204
|
+
: {
|
|
205
|
+
provenance: tagged.provenance,
|
|
206
|
+
governance: tagged.governance,
|
|
207
|
+
};
|
|
208
|
+
sections.push({
|
|
209
|
+
label: tagged.label,
|
|
210
|
+
...taggedClassification,
|
|
211
|
+
content: taggedMatch[1] ?? "",
|
|
212
|
+
...(taggedScope ? { sourceRef: { scope: taggedScope } } : {}),
|
|
213
|
+
});
|
|
214
|
+
}
|
|
215
|
+
}
|
|
216
|
+
return sections;
|
|
217
|
+
}
|
|
218
|
+
|
|
47
219
|
function resourceToolHint(
|
|
48
220
|
action: "list" | "read" | "effective" | "write" | "delete" | "promote",
|
|
49
221
|
extra?: string,
|
|
@@ -541,14 +713,14 @@ export async function loadResourcesForPrompt(
|
|
|
541
713
|
if (organizationOwner !== SHARED_OWNER) {
|
|
542
714
|
const organizationAgents = await loadAgentsResourceForPrompt(
|
|
543
715
|
organizationOwner,
|
|
544
|
-
"
|
|
716
|
+
"organization",
|
|
545
717
|
promptResourceMaxChars,
|
|
546
718
|
);
|
|
547
719
|
if (organizationAgents) sections.push(organizationAgents);
|
|
548
720
|
sections.push(
|
|
549
721
|
...(await loadInstructionResourcesForPrompt(
|
|
550
722
|
organizationOwner,
|
|
551
|
-
"
|
|
723
|
+
"organization-instruction",
|
|
552
724
|
promptResourceMaxChars,
|
|
553
725
|
compact,
|
|
554
726
|
)),
|
|
@@ -189,6 +189,10 @@ async function lazyFs(): Promise<typeof import("fs")> {
|
|
|
189
189
|
return _fs;
|
|
190
190
|
}
|
|
191
191
|
|
|
192
|
+
import {
|
|
193
|
+
buildSystemManifestSections,
|
|
194
|
+
setContextXraySystemSections,
|
|
195
|
+
} from "../agent/context-xray/manifest.js";
|
|
192
196
|
// ---------------------------------------------------------------------------
|
|
193
197
|
// The bulk of this file's former implementation now lives in focused sibling
|
|
194
198
|
// modules under `./agent-chat/`. This file re-imports them (and re-exports
|
|
@@ -233,6 +237,7 @@ import {
|
|
|
233
237
|
import { finalizeClaimedAgentChatProcessRunFailure } from "./agent-chat/process-run-failure.js";
|
|
234
238
|
import {
|
|
235
239
|
loadResourcesForPrompt,
|
|
240
|
+
promptResourceManifestSections,
|
|
236
241
|
resourceScopeForOwner,
|
|
237
242
|
} from "./agent-chat/prompt-resources.js";
|
|
238
243
|
import { shouldDisableRecurringJobsRuntime } from "./agent-chat/recurring-jobs-runtime.js";
|
|
@@ -265,6 +270,13 @@ export { loadRunCodeToolEntries };
|
|
|
265
270
|
export { shouldDisableRecurringJobsRuntime };
|
|
266
271
|
export { finalizeClaimedAgentChatProcessRunFailure };
|
|
267
272
|
|
|
273
|
+
export function buildLeanRunPolicyPrompt(
|
|
274
|
+
codeEditingSurfaceRestriction: string,
|
|
275
|
+
prodCodeExecPromptNote: string,
|
|
276
|
+
): string {
|
|
277
|
+
return codeEditingSurfaceRestriction + prodCodeExecPromptNote;
|
|
278
|
+
}
|
|
279
|
+
|
|
268
280
|
/**
|
|
269
281
|
* Returns whether `owner` has already finished (or explicitly skipped) the
|
|
270
282
|
* First-Session Personalization flow, via the owner-scoped
|
|
@@ -2329,6 +2341,104 @@ export function createAgentChatPlugin(
|
|
|
2329
2341
|
return prompt;
|
|
2330
2342
|
};
|
|
2331
2343
|
|
|
2344
|
+
const emitContextXraySystemSections = async (
|
|
2345
|
+
event: any,
|
|
2346
|
+
input: {
|
|
2347
|
+
frameworkPrompt?: string;
|
|
2348
|
+
actionsPrompt?: string;
|
|
2349
|
+
resources?: string;
|
|
2350
|
+
schemaBlock?: string;
|
|
2351
|
+
modelOverlay?: string;
|
|
2352
|
+
runtimeContext?: string;
|
|
2353
|
+
additionalFramework?: string;
|
|
2354
|
+
extra?: string;
|
|
2355
|
+
},
|
|
2356
|
+
): Promise<void> => {
|
|
2357
|
+
const sections = await buildSystemManifestSections([
|
|
2358
|
+
...(input.frameworkPrompt
|
|
2359
|
+
? [
|
|
2360
|
+
{
|
|
2361
|
+
label: "Framework core",
|
|
2362
|
+
provenance: "framework-core" as const,
|
|
2363
|
+
governance: "required" as const,
|
|
2364
|
+
content: input.frameworkPrompt,
|
|
2365
|
+
sourceRef: { scope: "framework" },
|
|
2366
|
+
},
|
|
2367
|
+
]
|
|
2368
|
+
: []),
|
|
2369
|
+
...(input.actionsPrompt
|
|
2370
|
+
? [
|
|
2371
|
+
{
|
|
2372
|
+
label: "Available actions prompt",
|
|
2373
|
+
provenance: "actions-prompt" as const,
|
|
2374
|
+
governance: "required" as const,
|
|
2375
|
+
content: input.actionsPrompt,
|
|
2376
|
+
sourceRef: { scope: "actions" },
|
|
2377
|
+
},
|
|
2378
|
+
]
|
|
2379
|
+
: []),
|
|
2380
|
+
...(input.resources
|
|
2381
|
+
? promptResourceManifestSections(input.resources)
|
|
2382
|
+
: []),
|
|
2383
|
+
...(input.schemaBlock
|
|
2384
|
+
? [
|
|
2385
|
+
{
|
|
2386
|
+
label: "SQL schema",
|
|
2387
|
+
provenance: "db-schema" as const,
|
|
2388
|
+
governance: "required" as const,
|
|
2389
|
+
content: input.schemaBlock,
|
|
2390
|
+
sourceRef: { scope: "sql" },
|
|
2391
|
+
},
|
|
2392
|
+
]
|
|
2393
|
+
: []),
|
|
2394
|
+
...(input.additionalFramework
|
|
2395
|
+
? [
|
|
2396
|
+
{
|
|
2397
|
+
label: "Framework run policy",
|
|
2398
|
+
provenance: "framework-core" as const,
|
|
2399
|
+
governance: "required" as const,
|
|
2400
|
+
content: input.additionalFramework,
|
|
2401
|
+
sourceRef: { scope: "framework" },
|
|
2402
|
+
},
|
|
2403
|
+
]
|
|
2404
|
+
: []),
|
|
2405
|
+
...(input.extra
|
|
2406
|
+
? [
|
|
2407
|
+
{
|
|
2408
|
+
label: "App runtime context",
|
|
2409
|
+
provenance: "runtime-context" as const,
|
|
2410
|
+
governance: "inherited" as const,
|
|
2411
|
+
content: input.extra,
|
|
2412
|
+
sourceRef: { scope: "app" },
|
|
2413
|
+
},
|
|
2414
|
+
]
|
|
2415
|
+
: []),
|
|
2416
|
+
...(input.modelOverlay
|
|
2417
|
+
? [
|
|
2418
|
+
{
|
|
2419
|
+
label: "Model overlay",
|
|
2420
|
+
provenance: "model-overlay" as const,
|
|
2421
|
+
governance: "required" as const,
|
|
2422
|
+
content: input.modelOverlay,
|
|
2423
|
+
sourceRef: { scope: "model" },
|
|
2424
|
+
},
|
|
2425
|
+
]
|
|
2426
|
+
: []),
|
|
2427
|
+
...(input.runtimeContext
|
|
2428
|
+
? [
|
|
2429
|
+
{
|
|
2430
|
+
label: "Runtime context",
|
|
2431
|
+
provenance: "runtime-context" as const,
|
|
2432
|
+
governance: "required" as const,
|
|
2433
|
+
content: input.runtimeContext,
|
|
2434
|
+
sourceRef: { scope: "runtime" },
|
|
2435
|
+
},
|
|
2436
|
+
]
|
|
2437
|
+
: []),
|
|
2438
|
+
]);
|
|
2439
|
+
setContextXraySystemSections(event, sections);
|
|
2440
|
+
};
|
|
2441
|
+
|
|
2332
2442
|
/**
|
|
2333
2443
|
* Read the model family overlay for the currently-resolved model.
|
|
2334
2444
|
* onEngineResolved sets runCtx.model before systemPrompt is called, so
|
|
@@ -2420,10 +2530,24 @@ Non-code requests are still fine on this surface: read data, navigate the UI, su
|
|
|
2420
2530
|
// everything that follows it — putting it last means a day
|
|
2421
2531
|
// rollover invalidates as little of the prefix as possible.
|
|
2422
2532
|
if (leanPrompt) {
|
|
2533
|
+
const leanRunPolicyPrompt = buildLeanRunPolicyPrompt(
|
|
2534
|
+
codeEditingSurfaceRestriction,
|
|
2535
|
+
prodCodeExecPromptNote,
|
|
2536
|
+
);
|
|
2537
|
+
await emitContextXraySystemSections(event, {
|
|
2538
|
+
frameworkPrompt: leanBasePrompt.slice(
|
|
2539
|
+
0,
|
|
2540
|
+
Math.max(0, leanBasePrompt.length - prodActionsPrompt.length),
|
|
2541
|
+
),
|
|
2542
|
+
actionsPrompt: prodActionsPrompt,
|
|
2543
|
+
additionalFramework: leanRunPolicyPrompt,
|
|
2544
|
+
extra,
|
|
2545
|
+
modelOverlay,
|
|
2546
|
+
runtimeContext,
|
|
2547
|
+
});
|
|
2423
2548
|
return setSystemPromptOnContext(
|
|
2424
2549
|
leanBasePrompt +
|
|
2425
|
-
|
|
2426
|
-
prodCodeExecPromptNote +
|
|
2550
|
+
leanRunPolicyPrompt +
|
|
2427
2551
|
extra +
|
|
2428
2552
|
modelOverlay +
|
|
2429
2553
|
runtimeContext,
|
|
@@ -2439,6 +2563,22 @@ Non-code requests are still fine on this surface: read data, navigate the UI, su
|
|
|
2439
2563
|
const schemaBlock = lazyContext
|
|
2440
2564
|
? ""
|
|
2441
2565
|
: await buildSchemaBlock(owner, databaseToolsMode);
|
|
2566
|
+
await emitContextXraySystemSections(event, {
|
|
2567
|
+
frameworkPrompt: basePrompt.slice(
|
|
2568
|
+
0,
|
|
2569
|
+
Math.max(0, basePrompt.length - prodActionsPrompt.length),
|
|
2570
|
+
),
|
|
2571
|
+
actionsPrompt: prodActionsPrompt,
|
|
2572
|
+
resources,
|
|
2573
|
+
schemaBlock,
|
|
2574
|
+
extra,
|
|
2575
|
+
modelOverlay,
|
|
2576
|
+
runtimeContext,
|
|
2577
|
+
additionalFramework:
|
|
2578
|
+
personalizationBlock +
|
|
2579
|
+
codeEditingSurfaceRestriction +
|
|
2580
|
+
prodCodeExecPromptNote,
|
|
2581
|
+
});
|
|
2442
2582
|
return setSystemPromptOnContext(
|
|
2443
2583
|
basePrompt +
|
|
2444
2584
|
personalizationBlock +
|
|
@@ -2548,6 +2688,11 @@ Non-code requests are still fine on this surface: read data, navigate the UI, su
|
|
|
2548
2688
|
actions: anonymousReadOnlyActions,
|
|
2549
2689
|
systemPrompt: async (event: any) => {
|
|
2550
2690
|
const { extra } = await prepareRun(event);
|
|
2691
|
+
await emitContextXraySystemSections(event, {
|
|
2692
|
+
frameworkPrompt: anonymousReadOnlyPrompt,
|
|
2693
|
+
extra,
|
|
2694
|
+
runtimeContext: runtimeContextForEvent(event),
|
|
2695
|
+
});
|
|
2551
2696
|
return setSystemPromptOnContext(
|
|
2552
2697
|
anonymousReadOnlyPrompt +
|
|
2553
2698
|
extra +
|
|
@@ -2668,6 +2813,16 @@ Non-code requests are still fine on this surface: read data, navigate the UI, su
|
|
|
2668
2813
|
// cached prompt prefix as possible. See the prod handler above
|
|
2669
2814
|
// for the same pattern.
|
|
2670
2815
|
if (leanPrompt) {
|
|
2816
|
+
await emitContextXraySystemSections(event, {
|
|
2817
|
+
frameworkPrompt: leanBasePrompt.slice(
|
|
2818
|
+
0,
|
|
2819
|
+
Math.max(0, leanBasePrompt.length - prodActionsPrompt.length),
|
|
2820
|
+
),
|
|
2821
|
+
actionsPrompt: prodActionsPrompt,
|
|
2822
|
+
extra,
|
|
2823
|
+
modelOverlay,
|
|
2824
|
+
runtimeContext,
|
|
2825
|
+
});
|
|
2671
2826
|
return setSystemPromptOnContext(
|
|
2672
2827
|
leanBasePrompt + extra + modelOverlay + runtimeContext,
|
|
2673
2828
|
);
|
|
@@ -2681,6 +2836,24 @@ Non-code requests are still fine on this surface: read data, navigate the UI, su
|
|
|
2681
2836
|
lazyContext || !databaseToolsEnabled
|
|
2682
2837
|
? ""
|
|
2683
2838
|
: await buildSchemaBlock(owner, databaseToolsMode);
|
|
2839
|
+
await emitContextXraySystemSections(event, {
|
|
2840
|
+
frameworkPrompt: devNative
|
|
2841
|
+
? basePrompt.slice(
|
|
2842
|
+
0,
|
|
2843
|
+
Math.max(0, basePrompt.length - prodActionsPrompt.length),
|
|
2844
|
+
)
|
|
2845
|
+
: devPrompt.slice(
|
|
2846
|
+
0,
|
|
2847
|
+
Math.max(0, devPrompt.length - devActionsPrompt.length),
|
|
2848
|
+
),
|
|
2849
|
+
actionsPrompt: devNative ? prodActionsPrompt : devActionsPrompt,
|
|
2850
|
+
resources,
|
|
2851
|
+
schemaBlock,
|
|
2852
|
+
extra,
|
|
2853
|
+
modelOverlay,
|
|
2854
|
+
runtimeContext,
|
|
2855
|
+
additionalFramework: personalizationBlock,
|
|
2856
|
+
});
|
|
2684
2857
|
return setSystemPromptOnContext(
|
|
2685
2858
|
devPrompt +
|
|
2686
2859
|
personalizationBlock +
|
|
@@ -144,6 +144,7 @@ import {
|
|
|
144
144
|
type OnboardingHtmlOptions,
|
|
145
145
|
} from "./onboarding-html.js";
|
|
146
146
|
import { captureAuthError } from "./sentry.js";
|
|
147
|
+
import { isWorkspaceOAuthCallbackRelayEnabled } from "./workspace-oauth.js";
|
|
147
148
|
|
|
148
149
|
/**
|
|
149
150
|
* Get the configured session max age. Desktop SSO broker writes from
|
|
@@ -1455,13 +1456,6 @@ function mountAuthCorsMiddleware(app: H3App): void {
|
|
|
1455
1456
|
app.use("/_agent-native/google", handler);
|
|
1456
1457
|
}
|
|
1457
1458
|
|
|
1458
|
-
function isWorkspaceOAuthCallbackRelayEnabled(): boolean {
|
|
1459
|
-
return (
|
|
1460
|
-
process.env.AGENT_NATIVE_WORKSPACE === "1" ||
|
|
1461
|
-
process.env.VITE_AGENT_NATIVE_WORKSPACE === "1"
|
|
1462
|
-
);
|
|
1463
|
-
}
|
|
1464
|
-
|
|
1465
1459
|
function isFrameworkOAuthCallbackPath(pathname: string): boolean {
|
|
1466
1460
|
return (
|
|
1467
1461
|
pathname.startsWith("/_agent-native/") &&
|
|
@@ -34,6 +34,7 @@ import {
|
|
|
34
34
|
import { getWorkspaceA2ADerivedSecret } from "./derived-secret.js";
|
|
35
35
|
import { writeDesktopSso } from "./desktop-sso.js";
|
|
36
36
|
import { appendSessionToOAuthReturnUrl } from "./oauth-return-url.js";
|
|
37
|
+
import { isWorkspaceOAuthCallbackRelayEnabled } from "./workspace-oauth.js";
|
|
37
38
|
|
|
38
39
|
// ─── Platform Detection ─────────────────────────────────────────────────────
|
|
39
40
|
|
|
@@ -294,13 +295,6 @@ export function getAppUrl(event: H3Event, path = "/"): string {
|
|
|
294
295
|
return `${getOrigin(event)}${getAppBasePath()}${cleanPath}`;
|
|
295
296
|
}
|
|
296
297
|
|
|
297
|
-
function isWorkspaceOAuthCallbackRelayEnabled(): boolean {
|
|
298
|
-
return (
|
|
299
|
-
process.env.AGENT_NATIVE_WORKSPACE === "1" ||
|
|
300
|
-
process.env.VITE_AGENT_NATIVE_WORKSPACE === "1"
|
|
301
|
-
);
|
|
302
|
-
}
|
|
303
|
-
|
|
304
298
|
function isFrameworkOAuthCallbackPath(pathname: string): boolean {
|
|
305
299
|
return (
|
|
306
300
|
pathname.startsWith("/_agent-native/") &&
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Whether workspace OAuth callbacks use the root framework relay.
|
|
3
|
+
*
|
|
4
|
+
* Workspace deploy wrappers normally provide the runtime flags, but mounted
|
|
5
|
+
* app bundles can retain only their workspace app id or build-time Vite env.
|
|
6
|
+
* Redirect construction and callback handling must use this exact same
|
|
7
|
+
* predicate so a callback sent to the root relay is always forwarded back to
|
|
8
|
+
* the mounted app that initiated it.
|
|
9
|
+
*/
|
|
10
|
+
export function isWorkspaceOAuthCallbackRelayEnabled(): boolean {
|
|
11
|
+
const metaEnv = (
|
|
12
|
+
import.meta as unknown as {
|
|
13
|
+
env?: Record<string, string | undefined>;
|
|
14
|
+
}
|
|
15
|
+
).env;
|
|
16
|
+
|
|
17
|
+
return (
|
|
18
|
+
[
|
|
19
|
+
process.env.AGENT_NATIVE_WORKSPACE,
|
|
20
|
+
process.env.VITE_AGENT_NATIVE_WORKSPACE,
|
|
21
|
+
metaEnv?.AGENT_NATIVE_WORKSPACE,
|
|
22
|
+
metaEnv?.VITE_AGENT_NATIVE_WORKSPACE,
|
|
23
|
+
].some((value) => value === "1" || value === "true") ||
|
|
24
|
+
[
|
|
25
|
+
process.env.AGENT_NATIVE_WORKSPACE_APP_ID,
|
|
26
|
+
process.env.VITE_AGENT_NATIVE_WORKSPACE_APP_ID,
|
|
27
|
+
metaEnv?.AGENT_NATIVE_WORKSPACE_APP_ID,
|
|
28
|
+
metaEnv?.VITE_AGENT_NATIVE_WORKSPACE_APP_ID,
|
|
29
|
+
].some((value) => typeof value === "string" && value.trim().length > 0)
|
|
30
|
+
);
|
|
31
|
+
}
|
|
@@ -16,7 +16,63 @@ export type ContextSegmentStatus =
|
|
|
16
16
|
| "evicted"
|
|
17
17
|
| "summarized";
|
|
18
18
|
export type ContextTokenCountMethod = "exact" | "estimate";
|
|
19
|
-
export type ContextManifestSource =
|
|
19
|
+
export type ContextManifestSource =
|
|
20
|
+
| "structured"
|
|
21
|
+
| "flattened"
|
|
22
|
+
| "external"
|
|
23
|
+
| "preview";
|
|
24
|
+
export type ContextSystemProvenance =
|
|
25
|
+
| "framework-core"
|
|
26
|
+
| "actions-prompt"
|
|
27
|
+
| "template"
|
|
28
|
+
| "enterprise-workspace-core"
|
|
29
|
+
| "sql-workspace"
|
|
30
|
+
| "legacy-app-default"
|
|
31
|
+
| "organization"
|
|
32
|
+
| "personal"
|
|
33
|
+
| "memory"
|
|
34
|
+
| "db-schema"
|
|
35
|
+
| "tools"
|
|
36
|
+
| "model-overlay"
|
|
37
|
+
| "runtime-context";
|
|
38
|
+
export type ContextGovernanceTier = "required" | "inherited" | "user";
|
|
39
|
+
|
|
40
|
+
export interface ContextManifestSourceRef {
|
|
41
|
+
resourceId?: string;
|
|
42
|
+
path?: string;
|
|
43
|
+
scope?: string;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
/**
|
|
47
|
+
* A non-evictable system-prompt contribution. This is intentionally separate
|
|
48
|
+
* from conversation segments so old manifests can be read without a schema
|
|
49
|
+
* migration and directive code can never accidentally evict system context.
|
|
50
|
+
*/
|
|
51
|
+
export interface ContextManifestSystemSection {
|
|
52
|
+
kind: "system";
|
|
53
|
+
segmentId: string;
|
|
54
|
+
group: string;
|
|
55
|
+
label: string;
|
|
56
|
+
provenance: ContextSystemProvenance;
|
|
57
|
+
governance: ContextGovernanceTier;
|
|
58
|
+
tokenCount: number;
|
|
59
|
+
tokenMethod: ContextTokenCountMethod;
|
|
60
|
+
sourceRef?: ContextManifestSourceRef;
|
|
61
|
+
contentHash: string;
|
|
62
|
+
preview: string;
|
|
63
|
+
timestamp: number;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
export interface ContextPreview {
|
|
67
|
+
computedAt: number;
|
|
68
|
+
model?: string;
|
|
69
|
+
scope: "user" | "org";
|
|
70
|
+
totalTokens: number;
|
|
71
|
+
systemTokens: number;
|
|
72
|
+
tokenCountMethod: ContextTokenCountMethod;
|
|
73
|
+
sections: ContextManifestSystemSection[];
|
|
74
|
+
source: "preview";
|
|
75
|
+
}
|
|
20
76
|
|
|
21
77
|
export interface ContextDirective {
|
|
22
78
|
id?: string;
|
|
@@ -58,12 +114,36 @@ export interface ContextManifest {
|
|
|
58
114
|
rawTokens: number;
|
|
59
115
|
reclaimedTokens: number;
|
|
60
116
|
tokenCountMethod: ContextTokenCountMethod;
|
|
117
|
+
/** Conversation-only total. Old manifests omit this and are conversation-only. */
|
|
118
|
+
conversationTokens?: number;
|
|
119
|
+
/** System-prompt total. Old manifests omit this and have no system sections. */
|
|
120
|
+
systemTokens?: number;
|
|
61
121
|
source: ContextManifestSource;
|
|
62
122
|
enforceable: boolean;
|
|
63
123
|
segments: ContextManifestSegment[];
|
|
124
|
+
/** Optional for strict backward compatibility with persisted old manifests. */
|
|
125
|
+
systemSections?: ContextManifestSystemSection[];
|
|
64
126
|
url?: string;
|
|
65
127
|
}
|
|
66
128
|
|
|
129
|
+
export function manifestSystemTokens(manifest: ContextManifest): number {
|
|
130
|
+
return (
|
|
131
|
+
manifest.systemTokens ??
|
|
132
|
+
manifest.systemSections?.reduce(
|
|
133
|
+
(total, section) => total + section.tokenCount,
|
|
134
|
+
0,
|
|
135
|
+
) ??
|
|
136
|
+
0
|
|
137
|
+
);
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
export function manifestConversationTokens(manifest: ContextManifest): number {
|
|
141
|
+
return (
|
|
142
|
+
manifest.conversationTokens ??
|
|
143
|
+
Math.max(0, manifest.totalTokens - manifestSystemTokens(manifest))
|
|
144
|
+
);
|
|
145
|
+
}
|
|
146
|
+
|
|
67
147
|
export function emptyContextManifest(
|
|
68
148
|
threadId: string,
|
|
69
149
|
opts: {
|
|
@@ -85,5 +165,8 @@ export function emptyContextManifest(
|
|
|
85
165
|
source: opts.source ?? "structured",
|
|
86
166
|
enforceable: opts.enforceable ?? true,
|
|
87
167
|
segments: [],
|
|
168
|
+
conversationTokens: 0,
|
|
169
|
+
systemTokens: 0,
|
|
170
|
+
systemSections: [],
|
|
88
171
|
};
|
|
89
172
|
}
|