@agent-native/core 0.99.2 → 0.100.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/corpus/README.md +2 -2
- package/corpus/core/CHANGELOG.md +21 -0
- package/corpus/core/docs/content/a2a-protocol.mdx +42 -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/a2a-protocol.mdx +42 -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/a2a-protocol.mdx +42 -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/a2a-protocol.mdx +42 -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/a2a-protocol.mdx +42 -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/a2a-protocol.mdx +42 -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/a2a-protocol.mdx +42 -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/a2a-protocol.mdx +42 -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/a2a-protocol.mdx +42 -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/a2a-protocol.mdx +42 -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/a2a-protocol.mdx +42 -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/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/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/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-new-agent-page-see-and-manage-your-agent-s-context-files-con.md +6 -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/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 +2 -2
- package/dist/resources/handlers.d.ts +1 -1
- 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/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/transcribe-voice.d.ts +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/a2a-protocol.mdx +42 -0
- package/docs/content/agent-surfaces.mdx +43 -0
- package/docs/content/external-agents.mdx +11 -0
- package/docs/content/locales/ar-SA/a2a-protocol.mdx +42 -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/a2a-protocol.mdx +42 -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/a2a-protocol.mdx +42 -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/a2a-protocol.mdx +42 -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/a2a-protocol.mdx +42 -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/a2a-protocol.mdx +42 -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/a2a-protocol.mdx +42 -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/a2a-protocol.mdx +42 -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/a2a-protocol.mdx +42 -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/a2a-protocol.mdx +42 -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
|
@@ -0,0 +1,501 @@
|
|
|
1
|
+
import {
|
|
2
|
+
IconChartTreemap,
|
|
3
|
+
IconInfoCircle,
|
|
4
|
+
IconList,
|
|
5
|
+
IconLock,
|
|
6
|
+
} from "@tabler/icons-react";
|
|
7
|
+
import { useMemo, useState } from "react";
|
|
8
|
+
|
|
9
|
+
import type {
|
|
10
|
+
ContextManifest,
|
|
11
|
+
ContextManifestSystemSection,
|
|
12
|
+
ContextPreview,
|
|
13
|
+
} from "../../shared/context-xray.js";
|
|
14
|
+
import { manifestConversationTokens } from "../../shared/context-xray.js";
|
|
15
|
+
import { ContextMeter } from "../context-xray/ContextMeter.js";
|
|
16
|
+
import { ContextTreemap } from "../context-xray/ContextTreemap.js";
|
|
17
|
+
import { formatTokens, resolveContextWindow } from "../context-xray/format.js";
|
|
18
|
+
import { useT } from "../i18n.js";
|
|
19
|
+
import { useActionQuery } from "../use-action.js";
|
|
20
|
+
import { useChatThreads, type ChatThreadSummary } from "../use-chat-threads.js";
|
|
21
|
+
import { cn } from "../utils.js";
|
|
22
|
+
import type { AgentPageTabProps } from "./types.js";
|
|
23
|
+
|
|
24
|
+
type PreviewQuery = {
|
|
25
|
+
data?: ContextPreview;
|
|
26
|
+
isLoading?: boolean;
|
|
27
|
+
error?: unknown;
|
|
28
|
+
};
|
|
29
|
+
type ManifestQuery = { data?: ContextManifest; isLoading?: boolean };
|
|
30
|
+
|
|
31
|
+
export function mostRecentlyUpdatedThread(
|
|
32
|
+
threads: ChatThreadSummary[],
|
|
33
|
+
): ChatThreadSummary | undefined {
|
|
34
|
+
return threads.reduce<ChatThreadSummary | undefined>(
|
|
35
|
+
(latest, thread) =>
|
|
36
|
+
!latest || thread.updatedAt > latest.updatedAt ? thread : latest,
|
|
37
|
+
undefined,
|
|
38
|
+
);
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
const PROVENANCE_ORDER = [
|
|
42
|
+
"framework-core",
|
|
43
|
+
"actions-prompt",
|
|
44
|
+
"enterprise-workspace-core",
|
|
45
|
+
"template",
|
|
46
|
+
"sql-workspace",
|
|
47
|
+
"legacy-app-default",
|
|
48
|
+
"organization",
|
|
49
|
+
"personal",
|
|
50
|
+
"memory",
|
|
51
|
+
"db-schema",
|
|
52
|
+
"tools",
|
|
53
|
+
"model-overlay",
|
|
54
|
+
"runtime-context",
|
|
55
|
+
] as const;
|
|
56
|
+
|
|
57
|
+
type Translate = (key: string, options?: Record<string, unknown>) => string;
|
|
58
|
+
|
|
59
|
+
function provenanceLabel(
|
|
60
|
+
provenance: ContextManifestSystemSection["provenance"],
|
|
61
|
+
t: Translate,
|
|
62
|
+
): string {
|
|
63
|
+
switch (provenance) {
|
|
64
|
+
case "framework-core":
|
|
65
|
+
return t("contextXray.provenance.frameworkCore", {
|
|
66
|
+
defaultValue: "Framework",
|
|
67
|
+
});
|
|
68
|
+
case "actions-prompt":
|
|
69
|
+
return t("contextXray.provenance.actionsPrompt", {
|
|
70
|
+
defaultValue: "Actions",
|
|
71
|
+
});
|
|
72
|
+
case "template":
|
|
73
|
+
return t("contextXray.provenance.template", {
|
|
74
|
+
defaultValue: "Template",
|
|
75
|
+
});
|
|
76
|
+
case "enterprise-workspace-core":
|
|
77
|
+
return t("contextXray.provenance.enterpriseWorkspaceCore", {
|
|
78
|
+
defaultValue: "Enterprise workspace core",
|
|
79
|
+
});
|
|
80
|
+
case "sql-workspace":
|
|
81
|
+
return t("contextXray.provenance.sqlWorkspace", {
|
|
82
|
+
defaultValue: "Workspace",
|
|
83
|
+
});
|
|
84
|
+
case "legacy-app-default":
|
|
85
|
+
return t("contextXray.provenance.legacyAppDefault", {
|
|
86
|
+
defaultValue: "App defaults",
|
|
87
|
+
});
|
|
88
|
+
case "organization":
|
|
89
|
+
return t("contextXray.provenance.organization", {
|
|
90
|
+
defaultValue: "Organization",
|
|
91
|
+
});
|
|
92
|
+
case "personal":
|
|
93
|
+
return t("contextXray.provenance.personal", {
|
|
94
|
+
defaultValue: "Personal",
|
|
95
|
+
});
|
|
96
|
+
case "memory":
|
|
97
|
+
return t("contextXray.provenance.memory", {
|
|
98
|
+
defaultValue: "Memory",
|
|
99
|
+
});
|
|
100
|
+
case "db-schema":
|
|
101
|
+
return t("contextXray.provenance.dbSchema", {
|
|
102
|
+
defaultValue: "SQL schema",
|
|
103
|
+
});
|
|
104
|
+
case "tools":
|
|
105
|
+
return t("contextXray.provenance.tools", { defaultValue: "Tools" });
|
|
106
|
+
case "model-overlay":
|
|
107
|
+
return t("contextXray.provenance.modelOverlay", {
|
|
108
|
+
defaultValue: "Model overlay",
|
|
109
|
+
});
|
|
110
|
+
case "runtime-context":
|
|
111
|
+
return t("contextXray.provenance.runtimeContext", {
|
|
112
|
+
defaultValue: "Runtime context",
|
|
113
|
+
});
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
function governanceLabel(
|
|
118
|
+
governance: ContextManifestSystemSection["governance"],
|
|
119
|
+
t: Translate,
|
|
120
|
+
): string {
|
|
121
|
+
switch (governance) {
|
|
122
|
+
case "required":
|
|
123
|
+
return t("contextXray.governance.required", {
|
|
124
|
+
defaultValue: "Required",
|
|
125
|
+
});
|
|
126
|
+
case "inherited":
|
|
127
|
+
return t("contextXray.governance.inherited", {
|
|
128
|
+
defaultValue: "Inherited",
|
|
129
|
+
});
|
|
130
|
+
case "user":
|
|
131
|
+
return t("contextXray.governance.user", {
|
|
132
|
+
defaultValue: "Your context",
|
|
133
|
+
});
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
function sourceLabel(section: ContextManifestSystemSection): string {
|
|
138
|
+
return (
|
|
139
|
+
section.sourceRef?.path ??
|
|
140
|
+
section.sourceRef?.resourceId ??
|
|
141
|
+
section.sourceRef?.scope ??
|
|
142
|
+
"framework"
|
|
143
|
+
);
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
function previewAsManifest(preview: ContextPreview): ContextManifest {
|
|
147
|
+
return {
|
|
148
|
+
threadId: "context-preview",
|
|
149
|
+
computedAt: preview.computedAt,
|
|
150
|
+
...(preview.model ? { model: preview.model } : {}),
|
|
151
|
+
totalTokens: preview.totalTokens,
|
|
152
|
+
rawTokens: preview.totalTokens,
|
|
153
|
+
reclaimedTokens: 0,
|
|
154
|
+
tokenCountMethod: preview.tokenCountMethod,
|
|
155
|
+
conversationTokens: 0,
|
|
156
|
+
systemTokens: preview.systemTokens,
|
|
157
|
+
source: "preview",
|
|
158
|
+
enforceable: false,
|
|
159
|
+
segments: [],
|
|
160
|
+
systemSections: preview.sections,
|
|
161
|
+
};
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
function ContextSplitMeter({
|
|
165
|
+
manifest,
|
|
166
|
+
budget,
|
|
167
|
+
}: {
|
|
168
|
+
manifest: ContextManifest;
|
|
169
|
+
budget: number;
|
|
170
|
+
}) {
|
|
171
|
+
const t = useT();
|
|
172
|
+
const systemTokens = manifest.systemTokens ?? 0;
|
|
173
|
+
const conversationTokens = manifestConversationTokens(manifest);
|
|
174
|
+
const total = Math.max(1, systemTokens + conversationTokens);
|
|
175
|
+
return (
|
|
176
|
+
<div className="space-y-2">
|
|
177
|
+
<div className="flex h-2 overflow-hidden rounded-full bg-muted">
|
|
178
|
+
<div
|
|
179
|
+
className="bg-slate-700 dark:bg-slate-400"
|
|
180
|
+
style={{ width: `${(systemTokens / total) * 100}%` }}
|
|
181
|
+
/>
|
|
182
|
+
<div
|
|
183
|
+
className="bg-sky-500"
|
|
184
|
+
style={{ width: `${(conversationTokens / total) * 100}%` }}
|
|
185
|
+
/>
|
|
186
|
+
</div>
|
|
187
|
+
<div className="flex flex-wrap gap-x-4 gap-y-1 text-xs text-muted-foreground">
|
|
188
|
+
<span>
|
|
189
|
+
<span className="mr-1.5 inline-block size-2 rounded-full bg-slate-700 dark:bg-slate-400" />
|
|
190
|
+
{t("contextXray.system", { defaultValue: "System" })}{" "}
|
|
191
|
+
{formatTokens(systemTokens)}
|
|
192
|
+
</span>
|
|
193
|
+
<span>
|
|
194
|
+
<span className="mr-1.5 inline-block size-2 rounded-full bg-sky-500" />
|
|
195
|
+
{t("contextXray.conversation", { defaultValue: "Conversation" })}{" "}
|
|
196
|
+
{formatTokens(conversationTokens)}
|
|
197
|
+
</span>
|
|
198
|
+
<span>
|
|
199
|
+
{formatTokens(Math.max(0, budget - manifest.totalTokens))}{" "}
|
|
200
|
+
{t("contextXray.free", { defaultValue: "free" })}
|
|
201
|
+
</span>
|
|
202
|
+
</div>
|
|
203
|
+
</div>
|
|
204
|
+
);
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
function SystemSectionList({
|
|
208
|
+
sections,
|
|
209
|
+
totalTokens,
|
|
210
|
+
}: {
|
|
211
|
+
sections: ContextManifestSystemSection[];
|
|
212
|
+
totalTokens: number;
|
|
213
|
+
}) {
|
|
214
|
+
const t = useT();
|
|
215
|
+
const grouped = useMemo(() => {
|
|
216
|
+
const map = new Map<
|
|
217
|
+
ContextManifestSystemSection["provenance"],
|
|
218
|
+
ContextManifestSystemSection[]
|
|
219
|
+
>();
|
|
220
|
+
for (const section of sections) {
|
|
221
|
+
const items = map.get(section.provenance) ?? [];
|
|
222
|
+
items.push(section);
|
|
223
|
+
map.set(section.provenance, items);
|
|
224
|
+
}
|
|
225
|
+
return PROVENANCE_ORDER.flatMap((provenance) => {
|
|
226
|
+
const items = map.get(provenance);
|
|
227
|
+
return items && items.length > 0 ? [{ provenance, items }] : [];
|
|
228
|
+
});
|
|
229
|
+
}, [sections]);
|
|
230
|
+
|
|
231
|
+
return (
|
|
232
|
+
<div className="space-y-4">
|
|
233
|
+
{grouped.map((group) => {
|
|
234
|
+
const tokens = group.items.reduce(
|
|
235
|
+
(sum, item) => sum + item.tokenCount,
|
|
236
|
+
0,
|
|
237
|
+
);
|
|
238
|
+
return (
|
|
239
|
+
<section key={group.provenance}>
|
|
240
|
+
<div className="mb-1 flex items-center justify-between gap-3">
|
|
241
|
+
<div className="flex min-w-0 items-center gap-2">
|
|
242
|
+
<span className="size-2 rounded-full bg-indigo-500" />
|
|
243
|
+
<h3 className="truncate text-sm font-medium">
|
|
244
|
+
{provenanceLabel(group.provenance, t)}
|
|
245
|
+
</h3>
|
|
246
|
+
<span className="text-[11px] text-muted-foreground">
|
|
247
|
+
{governanceLabel(
|
|
248
|
+
group.items[0]?.governance ?? "inherited",
|
|
249
|
+
t,
|
|
250
|
+
)}
|
|
251
|
+
</span>
|
|
252
|
+
</div>
|
|
253
|
+
<span className="shrink-0 text-xs tabular-nums text-muted-foreground">
|
|
254
|
+
{formatTokens(tokens)} ·{" "}
|
|
255
|
+
{totalTokens > 0 ? Math.round((tokens / totalTokens) * 100) : 0}
|
|
256
|
+
%
|
|
257
|
+
</span>
|
|
258
|
+
</div>
|
|
259
|
+
<div className="divide-y divide-border/60 rounded-md border border-border/60">
|
|
260
|
+
{group.items
|
|
261
|
+
.slice()
|
|
262
|
+
.sort((a, b) => b.tokenCount - a.tokenCount)
|
|
263
|
+
.map((section) => (
|
|
264
|
+
<div
|
|
265
|
+
key={section.segmentId}
|
|
266
|
+
className="flex gap-3 px-3 py-2.5"
|
|
267
|
+
>
|
|
268
|
+
<IconLock className="mt-0.5 size-4 shrink-0 text-muted-foreground" />
|
|
269
|
+
<div className="min-w-0 flex-1">
|
|
270
|
+
<div className="flex items-baseline justify-between gap-3">
|
|
271
|
+
<div className="truncate text-sm font-medium">
|
|
272
|
+
{section.label}
|
|
273
|
+
</div>
|
|
274
|
+
<div className="shrink-0 text-xs tabular-nums text-muted-foreground">
|
|
275
|
+
{formatTokens(section.tokenCount)} ·{" "}
|
|
276
|
+
{totalTokens > 0
|
|
277
|
+
? Math.round(
|
|
278
|
+
(section.tokenCount / totalTokens) * 100,
|
|
279
|
+
)
|
|
280
|
+
: 0}
|
|
281
|
+
%
|
|
282
|
+
</div>
|
|
283
|
+
</div>
|
|
284
|
+
<div className="truncate text-xs text-muted-foreground">
|
|
285
|
+
{sourceLabel(section)}
|
|
286
|
+
{section.tokenMethod === "estimate"
|
|
287
|
+
? " · estimated"
|
|
288
|
+
: ""}
|
|
289
|
+
</div>
|
|
290
|
+
{section.preview ? (
|
|
291
|
+
<div className="mt-1 line-clamp-2 text-xs text-muted-foreground/80">
|
|
292
|
+
{section.preview}
|
|
293
|
+
</div>
|
|
294
|
+
) : null}
|
|
295
|
+
</div>
|
|
296
|
+
</div>
|
|
297
|
+
))}
|
|
298
|
+
</div>
|
|
299
|
+
</section>
|
|
300
|
+
);
|
|
301
|
+
})}
|
|
302
|
+
{grouped.length === 0 ? (
|
|
303
|
+
<div className="rounded-md border border-dashed border-border p-6 text-center text-sm text-muted-foreground">
|
|
304
|
+
{t("contextXray.noSystemContext", {
|
|
305
|
+
defaultValue: "No system context is available for this scope yet.",
|
|
306
|
+
})}
|
|
307
|
+
</div>
|
|
308
|
+
) : null}
|
|
309
|
+
</div>
|
|
310
|
+
);
|
|
311
|
+
}
|
|
312
|
+
|
|
313
|
+
export function AgentContextTab({ scope }: AgentPageTabProps) {
|
|
314
|
+
const t = useT();
|
|
315
|
+
const [view, setView] = useState<"list" | "map">("list");
|
|
316
|
+
const previewQuery = useActionQuery(
|
|
317
|
+
"context-preview-get",
|
|
318
|
+
{ scope },
|
|
319
|
+
{ staleTime: 5_000 },
|
|
320
|
+
) as PreviewQuery;
|
|
321
|
+
const threads = useChatThreads(undefined, "agent-context-page", null, {
|
|
322
|
+
autoCreate: false,
|
|
323
|
+
restoreActiveThread: false,
|
|
324
|
+
});
|
|
325
|
+
const latestThread = mostRecentlyUpdatedThread(threads.threads);
|
|
326
|
+
const liveManifestQuery = useActionQuery(
|
|
327
|
+
"context-manifest-get",
|
|
328
|
+
latestThread ? { threadId: latestThread.id } : undefined,
|
|
329
|
+
{ enabled: Boolean(latestThread), staleTime: 1_000 },
|
|
330
|
+
) as ManifestQuery;
|
|
331
|
+
const preview = previewQuery.data;
|
|
332
|
+
const previewManifest = preview ? previewAsManifest(preview) : null;
|
|
333
|
+
const budget = resolveContextWindow(preview?.model);
|
|
334
|
+
const title = t("contextXray.pageTitle", { defaultValue: "Context" });
|
|
335
|
+
|
|
336
|
+
return (
|
|
337
|
+
<div className="mx-auto flex w-full max-w-5xl flex-col gap-8 p-6 lg:p-10">
|
|
338
|
+
<header className="space-y-3">
|
|
339
|
+
<div className="flex flex-wrap items-start justify-between gap-4">
|
|
340
|
+
<div>
|
|
341
|
+
<p className="text-xs font-medium uppercase tracking-[0.16em] text-muted-foreground">
|
|
342
|
+
{t("contextXray.agent", { defaultValue: "Agent" })}
|
|
343
|
+
</p>
|
|
344
|
+
<h1 className="text-2xl font-semibold tracking-tight">{title}</h1>
|
|
345
|
+
<p className="mt-1 max-w-2xl text-sm text-muted-foreground">
|
|
346
|
+
{t("contextXray.headerDescription", {
|
|
347
|
+
defaultValue:
|
|
348
|
+
"See the system instructions and conversation tokens that shape the agent.",
|
|
349
|
+
})}
|
|
350
|
+
</p>
|
|
351
|
+
</div>
|
|
352
|
+
{previewManifest ? (
|
|
353
|
+
<ContextMeter manifest={previewManifest} enabled />
|
|
354
|
+
) : null}
|
|
355
|
+
</div>
|
|
356
|
+
{previewManifest ? (
|
|
357
|
+
<ContextSplitMeter manifest={previewManifest} budget={budget} />
|
|
358
|
+
) : null}
|
|
359
|
+
</header>
|
|
360
|
+
|
|
361
|
+
<section className="space-y-4">
|
|
362
|
+
<div className="flex flex-wrap items-end justify-between gap-3">
|
|
363
|
+
<div>
|
|
364
|
+
<h2 className="text-lg font-semibold">
|
|
365
|
+
{t("contextXray.whatAgentKnows", {
|
|
366
|
+
defaultValue: "What the agent knows",
|
|
367
|
+
})}
|
|
368
|
+
</h2>
|
|
369
|
+
<p className="text-sm text-muted-foreground">
|
|
370
|
+
{t("contextXray.orderedSystemDescription", {
|
|
371
|
+
defaultValue:
|
|
372
|
+
"Ordered system context is grouped by where it comes from. System sections are visible here but cannot be evicted from a thread.",
|
|
373
|
+
})}
|
|
374
|
+
</p>
|
|
375
|
+
</div>
|
|
376
|
+
<div className="inline-flex rounded-md bg-muted/50 p-0.5">
|
|
377
|
+
<button
|
|
378
|
+
type="button"
|
|
379
|
+
onClick={() => setView("list")}
|
|
380
|
+
className={cn(
|
|
381
|
+
"flex cursor-pointer items-center gap-1.5 rounded px-2.5 py-1.5 text-xs",
|
|
382
|
+
view === "list"
|
|
383
|
+
? "bg-background text-foreground shadow-sm"
|
|
384
|
+
: "text-muted-foreground",
|
|
385
|
+
)}
|
|
386
|
+
>
|
|
387
|
+
<IconList className="size-3.5" />
|
|
388
|
+
{t("contextXray.list", { defaultValue: "List" })}
|
|
389
|
+
</button>
|
|
390
|
+
<button
|
|
391
|
+
type="button"
|
|
392
|
+
onClick={() => setView("map")}
|
|
393
|
+
className={cn(
|
|
394
|
+
"flex cursor-pointer items-center gap-1.5 rounded px-2.5 py-1.5 text-xs",
|
|
395
|
+
view === "map"
|
|
396
|
+
? "bg-background text-foreground shadow-sm"
|
|
397
|
+
: "text-muted-foreground",
|
|
398
|
+
)}
|
|
399
|
+
>
|
|
400
|
+
<IconChartTreemap className="size-3.5" />
|
|
401
|
+
{t("contextXray.treemap", { defaultValue: "Treemap" })}
|
|
402
|
+
</button>
|
|
403
|
+
</div>
|
|
404
|
+
</div>
|
|
405
|
+
{previewQuery.isLoading ? (
|
|
406
|
+
<div className="rounded-md border border-border/60 p-8 text-center text-sm text-muted-foreground">
|
|
407
|
+
{t("contextXray.loadingPreview", {
|
|
408
|
+
defaultValue: "Loading context preview…",
|
|
409
|
+
})}
|
|
410
|
+
</div>
|
|
411
|
+
) : previewQuery.error ? (
|
|
412
|
+
<div className="rounded-md border border-dashed border-border p-8 text-center text-sm text-muted-foreground">
|
|
413
|
+
{t("contextXray.previewUnavailable", {
|
|
414
|
+
defaultValue: "Context preview is not available yet.",
|
|
415
|
+
})}
|
|
416
|
+
</div>
|
|
417
|
+
) : previewManifest ? (
|
|
418
|
+
view === "map" ? (
|
|
419
|
+
<ContextTreemap
|
|
420
|
+
segments={[]}
|
|
421
|
+
systemSections={previewManifest.systemSections}
|
|
422
|
+
/>
|
|
423
|
+
) : (
|
|
424
|
+
<SystemSectionList
|
|
425
|
+
sections={previewManifest.systemSections ?? []}
|
|
426
|
+
totalTokens={previewManifest.totalTokens}
|
|
427
|
+
/>
|
|
428
|
+
)
|
|
429
|
+
) : (
|
|
430
|
+
<div className="rounded-md border border-dashed border-border p-8 text-center text-sm text-muted-foreground">
|
|
431
|
+
{t("contextXray.noPreview", {
|
|
432
|
+
defaultValue:
|
|
433
|
+
"No context preview is available for this scope yet.",
|
|
434
|
+
})}
|
|
435
|
+
</div>
|
|
436
|
+
)}
|
|
437
|
+
</section>
|
|
438
|
+
|
|
439
|
+
<section className="space-y-3">
|
|
440
|
+
<div>
|
|
441
|
+
<h2 className="text-lg font-semibold">
|
|
442
|
+
{t("contextXray.liveThread", { defaultValue: "Live thread" })}
|
|
443
|
+
</h2>
|
|
444
|
+
<p className="text-sm text-muted-foreground">
|
|
445
|
+
{t("contextXray.liveThreadDescription", {
|
|
446
|
+
defaultValue:
|
|
447
|
+
"The latest thread snapshot, when one exists. This is a single current snapshot, not an append-only history.",
|
|
448
|
+
})}
|
|
449
|
+
</p>
|
|
450
|
+
</div>
|
|
451
|
+
{latestThread && liveManifestQuery.data ? (
|
|
452
|
+
<div className="space-y-3 rounded-md border border-border/60 p-4">
|
|
453
|
+
<div className="flex flex-wrap items-center justify-between gap-2">
|
|
454
|
+
<div className="min-w-0">
|
|
455
|
+
<div className="truncate text-sm font-medium">
|
|
456
|
+
{latestThread.title ||
|
|
457
|
+
latestThread.preview ||
|
|
458
|
+
t("contextXray.latestThread", {
|
|
459
|
+
defaultValue: "Latest thread",
|
|
460
|
+
})}
|
|
461
|
+
</div>
|
|
462
|
+
<div className="text-xs text-muted-foreground">
|
|
463
|
+
{formatTokens(liveManifestQuery.data.totalTokens)} tokens ·{" "}
|
|
464
|
+
{latestThread.id}
|
|
465
|
+
</div>
|
|
466
|
+
</div>
|
|
467
|
+
<ContextMeter threadId={latestThread.id} />
|
|
468
|
+
</div>
|
|
469
|
+
<ContextTreemap
|
|
470
|
+
segments={liveManifestQuery.data.segments}
|
|
471
|
+
systemSections={liveManifestQuery.data.systemSections}
|
|
472
|
+
/>
|
|
473
|
+
</div>
|
|
474
|
+
) : (
|
|
475
|
+
<div className="rounded-md border border-dashed border-border p-8 text-center text-sm text-muted-foreground">
|
|
476
|
+
{t("contextXray.noLiveThread", {
|
|
477
|
+
defaultValue: "No live thread snapshot is available yet.",
|
|
478
|
+
})}
|
|
479
|
+
</div>
|
|
480
|
+
)}
|
|
481
|
+
</section>
|
|
482
|
+
|
|
483
|
+
<section className="flex gap-3 rounded-md border border-border/60 bg-muted/20 p-4">
|
|
484
|
+
<IconInfoCircle className="mt-0.5 size-4 shrink-0 text-muted-foreground" />
|
|
485
|
+
<div className="space-y-1 text-sm text-muted-foreground">
|
|
486
|
+
<p className="font-medium text-foreground">
|
|
487
|
+
{t("contextXray.orderedTokensTitle", {
|
|
488
|
+
defaultValue: "Context is ordered tokens, not weighted tokens.",
|
|
489
|
+
})}
|
|
490
|
+
</p>
|
|
491
|
+
<p>
|
|
492
|
+
{t("contextXray.orderedTokensDescription", {
|
|
493
|
+
defaultValue:
|
|
494
|
+
"Required framework and enterprise policy come first, followed by inherited template, workspace, and organization instructions. Personal instructions and memory arrive later and can narrow or override earlier guidance where the prompt permits. These system sections are not evictable; only run-local conversation segments support pin, evict, and restore.",
|
|
495
|
+
})}
|
|
496
|
+
</p>
|
|
497
|
+
</div>
|
|
498
|
+
</section>
|
|
499
|
+
</div>
|
|
500
|
+
);
|
|
501
|
+
}
|