@agent-native/core 0.109.2 → 0.109.4
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 +16 -0
- package/corpus/core/docs/content/agent-native-toolkit.mdx +46 -13
- package/corpus/core/docs/content/locales/ar-SA/agent-native-toolkit.mdx +79 -55
- package/corpus/core/docs/content/locales/ar-SA/toolkit-capability-packages.mdx +21 -0
- package/corpus/core/docs/content/locales/ar-SA/toolkit-context-knowledge.mdx +12 -0
- package/corpus/core/docs/content/locales/ar-SA/toolkit-editors-canvases.mdx +17 -0
- package/corpus/core/docs/content/locales/de-DE/agent-native-toolkit.mdx +82 -54
- package/corpus/core/docs/content/locales/de-DE/toolkit-capability-packages.mdx +21 -0
- package/corpus/core/docs/content/locales/de-DE/toolkit-context-knowledge.mdx +12 -0
- package/corpus/core/docs/content/locales/de-DE/toolkit-editors-canvases.mdx +17 -0
- package/corpus/core/docs/content/locales/es-ES/agent-native-toolkit.mdx +81 -52
- package/corpus/core/docs/content/locales/es-ES/toolkit-capability-packages.mdx +21 -0
- package/corpus/core/docs/content/locales/es-ES/toolkit-context-knowledge.mdx +12 -0
- package/corpus/core/docs/content/locales/es-ES/toolkit-editors-canvases.mdx +21 -0
- package/corpus/core/docs/content/locales/fr-FR/agent-native-toolkit.mdx +84 -54
- package/corpus/core/docs/content/locales/fr-FR/toolkit-capability-packages.mdx +21 -0
- package/corpus/core/docs/content/locales/fr-FR/toolkit-context-knowledge.mdx +12 -0
- package/corpus/core/docs/content/locales/fr-FR/toolkit-editors-canvases.mdx +21 -0
- package/corpus/core/docs/content/locales/hi-IN/agent-native-toolkit.mdx +69 -62
- package/corpus/core/docs/content/locales/hi-IN/toolkit-capability-packages.mdx +21 -0
- package/corpus/core/docs/content/locales/hi-IN/toolkit-context-knowledge.mdx +12 -0
- package/corpus/core/docs/content/locales/hi-IN/toolkit-editors-canvases.mdx +17 -0
- package/corpus/core/docs/content/locales/ja-JP/agent-native-toolkit.mdx +69 -62
- package/corpus/core/docs/content/locales/ja-JP/toolkit-capability-packages.mdx +21 -0
- package/corpus/core/docs/content/locales/ja-JP/toolkit-context-knowledge.mdx +12 -0
- package/corpus/core/docs/content/locales/ja-JP/toolkit-editors-canvases.mdx +17 -0
- package/corpus/core/docs/content/locales/ko-KR/agent-native-toolkit.mdx +69 -62
- package/corpus/core/docs/content/locales/ko-KR/toolkit-capability-packages.mdx +21 -0
- package/corpus/core/docs/content/locales/ko-KR/toolkit-context-knowledge.mdx +12 -0
- package/corpus/core/docs/content/locales/ko-KR/toolkit-editors-canvases.mdx +17 -0
- package/corpus/core/docs/content/locales/pt-BR/agent-native-toolkit.mdx +82 -54
- package/corpus/core/docs/content/locales/pt-BR/toolkit-capability-packages.mdx +21 -0
- package/corpus/core/docs/content/locales/pt-BR/toolkit-context-knowledge.mdx +12 -0
- package/corpus/core/docs/content/locales/pt-BR/toolkit-editors-canvases.mdx +17 -0
- package/corpus/core/docs/content/locales/zh-CN/agent-native-toolkit.mdx +69 -62
- package/corpus/core/docs/content/locales/zh-CN/toolkit-capability-packages.mdx +21 -0
- package/corpus/core/docs/content/locales/zh-CN/toolkit-context-knowledge.mdx +12 -0
- package/corpus/core/docs/content/locales/zh-CN/toolkit-editors-canvases.mdx +17 -0
- package/corpus/core/docs/content/locales/zh-TW/agent-native-toolkit.mdx +69 -62
- package/corpus/core/docs/content/locales/zh-TW/toolkit-capability-packages.mdx +21 -0
- package/corpus/core/docs/content/locales/zh-TW/toolkit-context-knowledge.mdx +12 -0
- package/corpus/core/docs/content/locales/zh-TW/toolkit-editors-canvases.mdx +17 -0
- package/corpus/core/docs/content/toolkit-capability-packages.mdx +52 -0
- package/corpus/core/docs/content/toolkit-context-knowledge.mdx +46 -0
- package/corpus/core/docs/content/toolkit-editors-canvases.mdx +55 -0
- package/corpus/core/package.json +35 -34
- package/corpus/core/src/cli/create.ts +57 -15
- package/corpus/core/src/cli/package-lifecycle.ts +2 -0
- package/corpus/core/src/cli/skills-content/visual-plan-skill.ts +2 -0
- package/corpus/core/src/client/context-xray/ContextMeter.tsx +31 -111
- package/corpus/core/src/client/context-xray/ContextSegmentRow.tsx +8 -111
- package/corpus/core/src/client/context-xray/ContextTreemap.tsx +6 -111
- package/corpus/core/src/client/context-xray/ContextXRayPanel.tsx +31 -391
- package/corpus/core/src/client/context-xray/SegmentProvenancePopover.tsx +4 -52
- package/corpus/core/src/client/context-xray/format.ts +0 -33
- package/corpus/core/src/client/require-session.tsx +19 -3
- package/corpus/core/src/client/rich-markdown-editor/index.ts +42 -57
- package/corpus/core/src/client/rich-markdown-editor/uploadEditorImage.ts +2 -1
- package/corpus/core/src/client/use-action.ts +145 -2
- package/corpus/core/src/client/use-session.ts +79 -48
- package/corpus/core/src/client/visual-style-controls.tsx +1 -1088
- package/corpus/core/src/collab/agent-identity.ts +5 -22
- package/corpus/core/src/collab/client.ts +1 -53
- package/corpus/core/src/db/client.ts +13 -7
- package/corpus/core/src/db/create-get-db.ts +20 -13
- package/corpus/core/src/db/request-telemetry.ts +154 -0
- package/corpus/core/src/integrations/index.ts +1 -0
- package/corpus/core/src/integrations/plugin.ts +9 -3
- package/corpus/core/src/integrations/remote-push-delivery-job.ts +48 -0
- package/corpus/core/src/integrations/remote-push-delivery.ts +370 -0
- package/corpus/core/src/integrations/remote-push-store.ts +275 -26
- package/corpus/core/src/server/better-auth-instance.ts +11 -3
- package/corpus/core/src/server/core-routes-plugin.ts +36 -14
- package/corpus/core/src/server/framework-request-handler.ts +11 -1
- package/corpus/core/src/server/http-response-telemetry.ts +233 -31
- package/corpus/core/src/styles/rich-markdown-editor.css +1 -510
- package/corpus/core/src/templates/workspace-core/.agents/skills/tracking/SKILL.md +19 -0
- package/corpus/core/src/testing.ts +1 -1
- package/corpus/core/src/vite/client.ts +3 -0
- package/corpus/templates/clips/actions/finalize-recording.ts +3 -1
- package/corpus/templates/clips/actions/set-mobile-capture-state.ts +4 -1
- package/corpus/templates/clips/app/components/library/library-layout.tsx +1 -6
- package/corpus/templates/clips/changelog/2026-07-18-new-recording-is-now-emphasized-as-the-primary-action-in-the.md +6 -0
- package/corpus/templates/clips/changelog/2026-07-18-recordings-now-remain-safely-recoverable-until-the-stored-me.md +6 -0
- package/corpus/templates/content/app/components/editor/VisualEditor.tsx +5 -3
- package/corpus/templates/content/app/components/editor/extensions/DragHandle.tsx +4 -4
- package/corpus/templates/content/package.json +25 -25
- package/corpus/templates/design/app/components/design/TweaksPanel.tsx +2 -1
- package/corpus/templates/design/package.json +1 -1
- package/corpus/templates/mail/package.json +9 -9
- package/corpus/templates/plan/.agents/skills/visual-plan/SKILL.md +2 -0
- package/corpus/templates/plan/app/components/editor/PlanDocumentEditor.tsx +8 -8
- package/corpus/templates/plan/app/components/editor/planSlashCommands.ts +6 -6
- package/corpus/templates/plan/app/components/plan/PlanImageNode.tsx +4 -7
- package/corpus/templates/plan/app/components/plan/PlanMarkdownEditor.tsx +6 -4
- package/corpus/templates/plan/app/components/plan/PlanVisualSurface.tsx +1 -1
- package/corpus/templates/plan/changelog/2026-07-18-visual-plans-now-open-on-wireframes-by-default-when-a-protot.md +6 -0
- package/corpus/templates/plan/package.json +3 -3
- package/corpus/templates/slides/app/components/editor/SlideStyleInspector.tsx +2 -2
- package/corpus/templates/slides/app/components/editor/TweaksPanel.tsx +2 -2
- package/corpus/templates/slides/package.json +13 -13
- package/corpus/templates/tasks/AGENTS.md +3 -0
- package/corpus/templates/tasks/actions/render-task-list-inline.ts +202 -0
- package/corpus/templates/tasks/changelog/2026-07-18-task-lists-can-now-appear-as-interactive-widgets-inline-in-c.md +6 -0
- package/corpus/templates/tasks/docs/features/f8-chat.mdx +2 -0
- package/corpus/templates/tasks/server/plugins/agent-chat.ts +2 -0
- package/dist/catalog.json +39 -1
- package/dist/cli/create.d.ts +10 -1
- package/dist/cli/create.d.ts.map +1 -1
- package/dist/cli/create.js +49 -16
- package/dist/cli/create.js.map +1 -1
- package/dist/cli/package-lifecycle.d.ts.map +1 -1
- package/dist/cli/package-lifecycle.js +2 -0
- package/dist/cli/package-lifecycle.js.map +1 -1
- package/dist/cli/skills-content/visual-plan-skill.d.ts +1 -1
- package/dist/cli/skills-content/visual-plan-skill.d.ts.map +1 -1
- package/dist/cli/skills-content/visual-plan-skill.js +2 -0
- package/dist/cli/skills-content/visual-plan-skill.js.map +1 -1
- package/dist/client/context-xray/ContextMeter.d.ts.map +1 -1
- package/dist/client/context-xray/ContextMeter.js +8 -23
- package/dist/client/context-xray/ContextMeter.js.map +1 -1
- package/dist/client/context-xray/ContextSegmentRow.d.ts.map +1 -1
- package/dist/client/context-xray/ContextSegmentRow.js +3 -19
- package/dist/client/context-xray/ContextSegmentRow.js.map +1 -1
- package/dist/client/context-xray/ContextTreemap.d.ts.map +1 -1
- package/dist/client/context-xray/ContextTreemap.js +3 -54
- 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 +21 -163
- package/dist/client/context-xray/ContextXRayPanel.js.map +1 -1
- package/dist/client/context-xray/SegmentProvenancePopover.d.ts.map +1 -1
- package/dist/client/context-xray/SegmentProvenancePopover.js +3 -4
- package/dist/client/context-xray/SegmentProvenancePopover.js.map +1 -1
- package/dist/client/context-xray/format.d.ts +0 -4
- package/dist/client/context-xray/format.d.ts.map +1 -1
- package/dist/client/context-xray/format.js +0 -49
- package/dist/client/context-xray/format.js.map +1 -1
- package/dist/client/require-session.d.ts.map +1 -1
- package/dist/client/require-session.js +6 -3
- package/dist/client/require-session.js.map +1 -1
- package/dist/client/rich-markdown-editor/index.d.ts +1 -12
- package/dist/client/rich-markdown-editor/index.d.ts.map +1 -1
- package/dist/client/rich-markdown-editor/index.js +1 -12
- package/dist/client/rich-markdown-editor/index.js.map +1 -1
- package/dist/client/rich-markdown-editor/uploadEditorImage.d.ts +1 -1
- package/dist/client/rich-markdown-editor/uploadEditorImage.d.ts.map +1 -1
- package/dist/client/rich-markdown-editor/uploadEditorImage.js.map +1 -1
- package/dist/client/use-action.d.ts.map +1 -1
- package/dist/client/use-action.js +117 -1
- package/dist/client/use-action.js.map +1 -1
- package/dist/client/use-session.d.ts.map +1 -1
- package/dist/client/use-session.js +72 -50
- package/dist/client/use-session.js.map +1 -1
- package/dist/client/visual-style-controls.d.ts +1 -89
- package/dist/client/visual-style-controls.d.ts.map +1 -1
- package/dist/client/visual-style-controls.js +1 -498
- package/dist/client/visual-style-controls.js.map +1 -1
- package/dist/collab/agent-identity.d.ts +1 -14
- package/dist/collab/agent-identity.d.ts.map +1 -1
- package/dist/collab/agent-identity.js +1 -13
- package/dist/collab/agent-identity.js.map +1 -1
- package/dist/collab/awareness.d.ts +2 -2
- package/dist/collab/awareness.d.ts.map +1 -1
- package/dist/collab/client.d.ts +1 -19
- package/dist/collab/client.d.ts.map +1 -1
- package/dist/collab/client.js +1 -53
- package/dist/collab/client.js.map +1 -1
- package/dist/collab/struct-routes.d.ts +1 -1
- package/dist/db/client.d.ts.map +1 -1
- package/dist/db/client.js +7 -1
- package/dist/db/client.js.map +1 -1
- package/dist/db/create-get-db.d.ts +3 -6
- package/dist/db/create-get-db.d.ts.map +1 -1
- package/dist/db/create-get-db.js +9 -2
- package/dist/db/create-get-db.js.map +1 -1
- package/dist/db/request-telemetry.d.ts +23 -0
- package/dist/db/request-telemetry.d.ts.map +1 -0
- package/dist/db/request-telemetry.js +95 -0
- package/dist/db/request-telemetry.js.map +1 -0
- package/dist/integrations/index.d.ts +1 -0
- package/dist/integrations/index.d.ts.map +1 -1
- package/dist/integrations/index.js +1 -0
- package/dist/integrations/index.js.map +1 -1
- package/dist/integrations/plugin.d.ts.map +1 -1
- package/dist/integrations/plugin.js +8 -3
- package/dist/integrations/plugin.js.map +1 -1
- package/dist/integrations/remote-push-delivery-job.d.ts +4 -0
- package/dist/integrations/remote-push-delivery-job.d.ts.map +1 -0
- package/dist/integrations/remote-push-delivery-job.js +44 -0
- package/dist/integrations/remote-push-delivery-job.js.map +1 -0
- package/dist/integrations/remote-push-delivery.d.ts +11 -0
- package/dist/integrations/remote-push-delivery.d.ts.map +1 -0
- package/dist/integrations/remote-push-delivery.js +265 -0
- package/dist/integrations/remote-push-delivery.js.map +1 -0
- package/dist/integrations/remote-push-store.d.ts +33 -0
- package/dist/integrations/remote-push-store.d.ts.map +1 -1
- package/dist/integrations/remote-push-store.js +195 -26
- package/dist/integrations/remote-push-store.js.map +1 -1
- package/dist/notifications/routes.d.ts +3 -3
- package/dist/progress/routes.d.ts +1 -1
- package/dist/provider-api/corpus-jobs.d.ts +2 -2
- package/dist/resources/handlers.d.ts +3 -3
- package/dist/secrets/routes.d.ts +9 -9
- package/dist/server/agent-engine-api-key-route.d.ts +1 -1
- package/dist/server/better-auth-instance.js +7 -3
- package/dist/server/better-auth-instance.js.map +1 -1
- package/dist/server/core-routes-plugin.d.ts +8 -0
- package/dist/server/core-routes-plugin.d.ts.map +1 -1
- package/dist/server/core-routes-plugin.js +23 -8
- package/dist/server/core-routes-plugin.js.map +1 -1
- package/dist/server/framework-request-handler.d.ts.map +1 -1
- package/dist/server/framework-request-handler.js +9 -1
- package/dist/server/framework-request-handler.js.map +1 -1
- package/dist/server/http-response-telemetry.d.ts +3 -2
- package/dist/server/http-response-telemetry.d.ts.map +1 -1
- package/dist/server/http-response-telemetry.js +160 -27
- package/dist/server/http-response-telemetry.js.map +1 -1
- package/dist/server/transcribe-voice.d.ts +1 -1
- package/dist/styles/rich-markdown-editor.css +1 -510
- package/dist/templates/workspace-core/.agents/skills/tracking/SKILL.md +19 -0
- package/dist/testing.d.ts +1 -1
- package/dist/testing.d.ts.map +1 -1
- package/dist/testing.js +1 -1
- package/dist/testing.js.map +1 -1
- package/dist/vite/client.d.ts.map +1 -1
- package/dist/vite/client.js +3 -0
- package/dist/vite/client.js.map +1 -1
- package/docs/content/agent-native-toolkit.mdx +46 -13
- package/docs/content/locales/ar-SA/agent-native-toolkit.mdx +79 -55
- package/docs/content/locales/ar-SA/toolkit-capability-packages.mdx +21 -0
- package/docs/content/locales/ar-SA/toolkit-context-knowledge.mdx +12 -0
- package/docs/content/locales/ar-SA/toolkit-editors-canvases.mdx +17 -0
- package/docs/content/locales/de-DE/agent-native-toolkit.mdx +82 -54
- package/docs/content/locales/de-DE/toolkit-capability-packages.mdx +21 -0
- package/docs/content/locales/de-DE/toolkit-context-knowledge.mdx +12 -0
- package/docs/content/locales/de-DE/toolkit-editors-canvases.mdx +17 -0
- package/docs/content/locales/es-ES/agent-native-toolkit.mdx +81 -52
- package/docs/content/locales/es-ES/toolkit-capability-packages.mdx +21 -0
- package/docs/content/locales/es-ES/toolkit-context-knowledge.mdx +12 -0
- package/docs/content/locales/es-ES/toolkit-editors-canvases.mdx +21 -0
- package/docs/content/locales/fr-FR/agent-native-toolkit.mdx +84 -54
- package/docs/content/locales/fr-FR/toolkit-capability-packages.mdx +21 -0
- package/docs/content/locales/fr-FR/toolkit-context-knowledge.mdx +12 -0
- package/docs/content/locales/fr-FR/toolkit-editors-canvases.mdx +21 -0
- package/docs/content/locales/hi-IN/agent-native-toolkit.mdx +69 -62
- package/docs/content/locales/hi-IN/toolkit-capability-packages.mdx +21 -0
- package/docs/content/locales/hi-IN/toolkit-context-knowledge.mdx +12 -0
- package/docs/content/locales/hi-IN/toolkit-editors-canvases.mdx +17 -0
- package/docs/content/locales/ja-JP/agent-native-toolkit.mdx +69 -62
- package/docs/content/locales/ja-JP/toolkit-capability-packages.mdx +21 -0
- package/docs/content/locales/ja-JP/toolkit-context-knowledge.mdx +12 -0
- package/docs/content/locales/ja-JP/toolkit-editors-canvases.mdx +17 -0
- package/docs/content/locales/ko-KR/agent-native-toolkit.mdx +69 -62
- package/docs/content/locales/ko-KR/toolkit-capability-packages.mdx +21 -0
- package/docs/content/locales/ko-KR/toolkit-context-knowledge.mdx +12 -0
- package/docs/content/locales/ko-KR/toolkit-editors-canvases.mdx +17 -0
- package/docs/content/locales/pt-BR/agent-native-toolkit.mdx +82 -54
- package/docs/content/locales/pt-BR/toolkit-capability-packages.mdx +21 -0
- package/docs/content/locales/pt-BR/toolkit-context-knowledge.mdx +12 -0
- package/docs/content/locales/pt-BR/toolkit-editors-canvases.mdx +17 -0
- package/docs/content/locales/zh-CN/agent-native-toolkit.mdx +69 -62
- package/docs/content/locales/zh-CN/toolkit-capability-packages.mdx +21 -0
- package/docs/content/locales/zh-CN/toolkit-context-knowledge.mdx +12 -0
- package/docs/content/locales/zh-CN/toolkit-editors-canvases.mdx +17 -0
- package/docs/content/locales/zh-TW/agent-native-toolkit.mdx +69 -62
- package/docs/content/locales/zh-TW/toolkit-capability-packages.mdx +21 -0
- package/docs/content/locales/zh-TW/toolkit-context-knowledge.mdx +12 -0
- package/docs/content/locales/zh-TW/toolkit-editors-canvases.mdx +17 -0
- package/docs/content/toolkit-capability-packages.mdx +52 -0
- package/docs/content/toolkit-context-knowledge.mdx +46 -0
- package/docs/content/toolkit-editors-canvases.mdx +55 -0
- package/package.json +27 -26
- package/src/templates/workspace-core/.agents/skills/tracking/SKILL.md +19 -0
- package/corpus/core/src/client/rich-markdown-editor/BubbleToolbar.tsx +0 -253
- package/corpus/core/src/client/rich-markdown-editor/CodeBlockNode.tsx +0 -258
- package/corpus/core/src/client/rich-markdown-editor/DragHandle.ts +0 -1437
- package/corpus/core/src/client/rich-markdown-editor/ImageExtension.ts +0 -306
- package/corpus/core/src/client/rich-markdown-editor/RichMarkdownEditor.tsx +0 -80
- package/corpus/core/src/client/rich-markdown-editor/RunId.ts +0 -61
- package/corpus/core/src/client/rich-markdown-editor/SharedRichEditor.tsx +0 -321
- package/corpus/core/src/client/rich-markdown-editor/SlashCommandMenu.tsx +0 -310
- package/corpus/core/src/client/rich-markdown-editor/extensions.ts +0 -402
- package/corpus/core/src/client/rich-markdown-editor/gfmDoc.ts +0 -92
- package/corpus/core/src/client/rich-markdown-editor/surgical-apply.ts +0 -192
- package/corpus/core/src/client/rich-markdown-editor/useCollabReconcile.ts +0 -590
- package/dist/client/rich-markdown-editor/BubbleToolbar.d.ts +0 -37
- package/dist/client/rich-markdown-editor/BubbleToolbar.d.ts.map +0 -1
- package/dist/client/rich-markdown-editor/BubbleToolbar.js +0 -171
- package/dist/client/rich-markdown-editor/BubbleToolbar.js.map +0 -1
- package/dist/client/rich-markdown-editor/CodeBlockNode.d.ts +0 -49
- package/dist/client/rich-markdown-editor/CodeBlockNode.d.ts.map +0 -1
- package/dist/client/rich-markdown-editor/CodeBlockNode.js +0 -127
- package/dist/client/rich-markdown-editor/CodeBlockNode.js.map +0 -1
- package/dist/client/rich-markdown-editor/DragHandle.d.ts +0 -97
- package/dist/client/rich-markdown-editor/DragHandle.d.ts.map +0 -1
- package/dist/client/rich-markdown-editor/DragHandle.js +0 -1066
- package/dist/client/rich-markdown-editor/DragHandle.js.map +0 -1
- package/dist/client/rich-markdown-editor/ImageExtension.d.ts +0 -63
- package/dist/client/rich-markdown-editor/ImageExtension.d.ts.map +0 -1
- package/dist/client/rich-markdown-editor/ImageExtension.js +0 -243
- package/dist/client/rich-markdown-editor/ImageExtension.js.map +0 -1
- package/dist/client/rich-markdown-editor/RichMarkdownEditor.d.ts +0 -51
- package/dist/client/rich-markdown-editor/RichMarkdownEditor.d.ts.map +0 -1
- package/dist/client/rich-markdown-editor/RichMarkdownEditor.js +0 -37
- package/dist/client/rich-markdown-editor/RichMarkdownEditor.js.map +0 -1
- package/dist/client/rich-markdown-editor/RunId.d.ts +0 -28
- package/dist/client/rich-markdown-editor/RunId.d.ts.map +0 -1
- package/dist/client/rich-markdown-editor/RunId.js +0 -60
- package/dist/client/rich-markdown-editor/RunId.js.map +0 -1
- package/dist/client/rich-markdown-editor/SharedRichEditor.d.ts +0 -110
- package/dist/client/rich-markdown-editor/SharedRichEditor.d.ts.map +0 -1
- package/dist/client/rich-markdown-editor/SharedRichEditor.js +0 -144
- package/dist/client/rich-markdown-editor/SharedRichEditor.js.map +0 -1
- package/dist/client/rich-markdown-editor/SlashCommandMenu.d.ts +0 -41
- package/dist/client/rich-markdown-editor/SlashCommandMenu.d.ts.map +0 -1
- package/dist/client/rich-markdown-editor/SlashCommandMenu.js +0 -221
- package/dist/client/rich-markdown-editor/SlashCommandMenu.js.map +0 -1
- package/dist/client/rich-markdown-editor/extensions.d.ts +0 -178
- package/dist/client/rich-markdown-editor/extensions.d.ts.map +0 -1
- package/dist/client/rich-markdown-editor/extensions.js +0 -224
- package/dist/client/rich-markdown-editor/extensions.js.map +0 -1
- package/dist/client/rich-markdown-editor/gfmDoc.d.ts +0 -24
- package/dist/client/rich-markdown-editor/gfmDoc.d.ts.map +0 -1
- package/dist/client/rich-markdown-editor/gfmDoc.js +0 -83
- package/dist/client/rich-markdown-editor/gfmDoc.js.map +0 -1
- package/dist/client/rich-markdown-editor/surgical-apply.d.ts +0 -66
- package/dist/client/rich-markdown-editor/surgical-apply.d.ts.map +0 -1
- package/dist/client/rich-markdown-editor/surgical-apply.js +0 -147
- package/dist/client/rich-markdown-editor/surgical-apply.js.map +0 -1
- package/dist/client/rich-markdown-editor/useCollabReconcile.d.ts +0 -110
- package/dist/client/rich-markdown-editor/useCollabReconcile.d.ts.map +0 -1
- package/dist/client/rich-markdown-editor/useCollabReconcile.js +0 -441
- package/dist/client/rich-markdown-editor/useCollabReconcile.js.map +0 -1
|
@@ -1,52 +1,9 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { Treemap } from "recharts";
|
|
1
|
+
import { ContextTreemapView } from "@agent-native/toolkit/context-ui";
|
|
3
2
|
|
|
4
3
|
import type {
|
|
5
4
|
ContextManifestSegment,
|
|
6
5
|
ContextManifestSystemSection,
|
|
7
6
|
} from "../../shared/context-xray.js";
|
|
8
|
-
import { formatTokens, groupFill } from "./format.js";
|
|
9
|
-
|
|
10
|
-
interface TreemapDatum {
|
|
11
|
-
name: string;
|
|
12
|
-
size: number;
|
|
13
|
-
group: string;
|
|
14
|
-
segmentId: string;
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
function TreemapContent(props: any) {
|
|
18
|
-
const { x, y, width, height, name, group, size } = props;
|
|
19
|
-
if (width < 8 || height < 8) return null;
|
|
20
|
-
const showLabel = width > 90 && height > 42;
|
|
21
|
-
return (
|
|
22
|
-
<g>
|
|
23
|
-
<rect
|
|
24
|
-
x={x}
|
|
25
|
-
y={y}
|
|
26
|
-
width={width}
|
|
27
|
-
height={height}
|
|
28
|
-
rx={3}
|
|
29
|
-
ry={3}
|
|
30
|
-
fill={groupFill(group)}
|
|
31
|
-
stroke="var(--background)"
|
|
32
|
-
strokeWidth={2}
|
|
33
|
-
/>
|
|
34
|
-
{showLabel && (
|
|
35
|
-
<foreignObject
|
|
36
|
-
x={x + 6}
|
|
37
|
-
y={y + 6}
|
|
38
|
-
width={width - 12}
|
|
39
|
-
height={height - 12}
|
|
40
|
-
>
|
|
41
|
-
<div className="flex h-full flex-col justify-between overflow-hidden text-[11px] leading-tight text-white">
|
|
42
|
-
<div className="truncate font-medium">{name}</div>
|
|
43
|
-
<div className="text-white/85">{formatTokens(size)}</div>
|
|
44
|
-
</div>
|
|
45
|
-
</foreignObject>
|
|
46
|
-
)}
|
|
47
|
-
</g>
|
|
48
|
-
);
|
|
49
|
-
}
|
|
50
7
|
|
|
51
8
|
export function ContextTreemap({
|
|
52
9
|
segments,
|
|
@@ -57,73 +14,11 @@ export function ContextTreemap({
|
|
|
57
14
|
systemSections?: ContextManifestSystemSection[];
|
|
58
15
|
onSelect?: (segmentId: string) => void;
|
|
59
16
|
}) {
|
|
60
|
-
const containerRef = useRef<HTMLDivElement>(null);
|
|
61
|
-
const [chartWidth, setChartWidth] = useState(0);
|
|
62
|
-
const data: TreemapDatum[] = segments
|
|
63
|
-
.filter((segment) => segment.status !== "evicted" && segment.tokenCount > 0)
|
|
64
|
-
.map((segment) => ({
|
|
65
|
-
name: segment.label,
|
|
66
|
-
size: segment.tokenCount,
|
|
67
|
-
group: segment.group,
|
|
68
|
-
segmentId: segment.segmentId,
|
|
69
|
-
}));
|
|
70
|
-
data.push(
|
|
71
|
-
...systemSections
|
|
72
|
-
.filter((section) => section.tokenCount > 0)
|
|
73
|
-
.map((section) => ({
|
|
74
|
-
name: section.label,
|
|
75
|
-
size: section.tokenCount,
|
|
76
|
-
group: `System · ${section.governance}`,
|
|
77
|
-
segmentId: section.segmentId,
|
|
78
|
-
})),
|
|
79
|
-
);
|
|
80
|
-
|
|
81
|
-
useEffect(() => {
|
|
82
|
-
const element = containerRef.current;
|
|
83
|
-
if (!element) return;
|
|
84
|
-
|
|
85
|
-
const updateWidth = () => {
|
|
86
|
-
setChartWidth(Math.max(0, Math.floor(element.clientWidth - 8)));
|
|
87
|
-
};
|
|
88
|
-
updateWidth();
|
|
89
|
-
|
|
90
|
-
const observer =
|
|
91
|
-
typeof ResizeObserver !== "undefined"
|
|
92
|
-
? new ResizeObserver(updateWidth)
|
|
93
|
-
: null;
|
|
94
|
-
observer?.observe(element);
|
|
95
|
-
window.addEventListener("resize", updateWidth);
|
|
96
|
-
return () => {
|
|
97
|
-
observer?.disconnect();
|
|
98
|
-
window.removeEventListener("resize", updateWidth);
|
|
99
|
-
};
|
|
100
|
-
}, []);
|
|
101
|
-
|
|
102
|
-
if (data.length === 0) {
|
|
103
|
-
return (
|
|
104
|
-
<div className="flex h-52 items-center justify-center rounded-md bg-muted/30 text-xs text-muted-foreground">
|
|
105
|
-
No active segments
|
|
106
|
-
</div>
|
|
107
|
-
);
|
|
108
|
-
}
|
|
109
|
-
|
|
110
17
|
return (
|
|
111
|
-
<
|
|
112
|
-
{
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
data={data as any}
|
|
117
|
-
dataKey="size"
|
|
118
|
-
nameKey="name"
|
|
119
|
-
aspectRatio={4 / 3}
|
|
120
|
-
isAnimationActive={false}
|
|
121
|
-
content={<TreemapContent />}
|
|
122
|
-
onClick={(datum: any) => {
|
|
123
|
-
if (datum?.segmentId) onSelect?.(datum.segmentId);
|
|
124
|
-
}}
|
|
125
|
-
/>
|
|
126
|
-
)}
|
|
127
|
-
</div>
|
|
18
|
+
<ContextTreemapView
|
|
19
|
+
segments={segments}
|
|
20
|
+
systemSections={systemSections}
|
|
21
|
+
onSelect={onSelect}
|
|
22
|
+
/>
|
|
128
23
|
);
|
|
129
24
|
}
|
|
@@ -1,146 +1,15 @@
|
|
|
1
|
-
import {
|
|
2
|
-
IconChartTreemap,
|
|
3
|
-
IconChevronDown,
|
|
4
|
-
IconChevronRight,
|
|
5
|
-
IconLock,
|
|
6
|
-
IconListDetails,
|
|
7
|
-
} from "@tabler/icons-react";
|
|
8
|
-
import { useMemo, useState } from "react";
|
|
1
|
+
import { ContextXRayPanelView } from "@agent-native/toolkit/context-ui";
|
|
9
2
|
|
|
10
3
|
import type {
|
|
11
4
|
ContextManifest,
|
|
12
|
-
ContextManifestSegment,
|
|
13
|
-
ContextManifestSystemSection,
|
|
14
5
|
ContextSegmentStatus,
|
|
15
6
|
} from "../../shared/context-xray.js";
|
|
16
7
|
import {
|
|
17
8
|
manifestConversationTokens,
|
|
18
9
|
manifestSystemTokens,
|
|
19
10
|
} from "../../shared/context-xray.js";
|
|
20
|
-
import {
|
|
21
|
-
Tooltip,
|
|
22
|
-
TooltipContent,
|
|
23
|
-
TooltipTrigger,
|
|
24
|
-
} from "../components/ui/tooltip.js";
|
|
25
11
|
import { useT } from "../i18n.js";
|
|
26
|
-
import {
|
|
27
|
-
import { ContextSegmentRow } from "./ContextSegmentRow.js";
|
|
28
|
-
import { ContextTreemap } from "./ContextTreemap.js";
|
|
29
|
-
import { formatTokens, groupColor, resolveContextWindow } from "./format.js";
|
|
30
|
-
|
|
31
|
-
interface Group {
|
|
32
|
-
name: string;
|
|
33
|
-
tokens: number;
|
|
34
|
-
segments: ContextManifestSegment[];
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
function applyOptimisticStatus(
|
|
38
|
-
segments: ContextManifestSegment[],
|
|
39
|
-
optimistic: Map<string, ContextSegmentStatus>,
|
|
40
|
-
): ContextManifestSegment[] {
|
|
41
|
-
if (optimistic.size === 0) return segments;
|
|
42
|
-
return segments.map((segment) => {
|
|
43
|
-
const status = optimistic.get(segment.segmentId);
|
|
44
|
-
return status ? { ...segment, status } : segment;
|
|
45
|
-
});
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
function groupedSegments(segments: ContextManifestSegment[]): Group[] {
|
|
49
|
-
const map = new Map<string, Group>();
|
|
50
|
-
for (const segment of segments) {
|
|
51
|
-
const groupName =
|
|
52
|
-
segment.status === "pinned"
|
|
53
|
-
? "Pinned"
|
|
54
|
-
: segment.status === "evicted"
|
|
55
|
-
? "Evicted"
|
|
56
|
-
: segment.group;
|
|
57
|
-
const group = map.get(groupName) ?? {
|
|
58
|
-
name: groupName,
|
|
59
|
-
tokens: 0,
|
|
60
|
-
segments: [],
|
|
61
|
-
};
|
|
62
|
-
group.tokens += segment.tokenCount;
|
|
63
|
-
group.segments.push(segment);
|
|
64
|
-
map.set(groupName, group);
|
|
65
|
-
}
|
|
66
|
-
const order = [
|
|
67
|
-
"Pinned",
|
|
68
|
-
"Tool results",
|
|
69
|
-
"Files read",
|
|
70
|
-
"Conversation",
|
|
71
|
-
"Thinking",
|
|
72
|
-
"Evicted",
|
|
73
|
-
];
|
|
74
|
-
return [...map.values()].sort((a, b) => {
|
|
75
|
-
const ai = order.indexOf(a.name);
|
|
76
|
-
const bi = order.indexOf(b.name);
|
|
77
|
-
if (ai >= 0 || bi >= 0) return (ai < 0 ? 99 : ai) - (bi < 0 ? 99 : bi);
|
|
78
|
-
return b.tokens - a.tokens;
|
|
79
|
-
});
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
const GOVERNANCE_ORDER = ["required", "inherited", "user"] as const;
|
|
83
|
-
|
|
84
|
-
function governanceLabel(
|
|
85
|
-
governance: ContextManifestSystemSection["governance"],
|
|
86
|
-
t: (key: string, options?: Record<string, unknown>) => string,
|
|
87
|
-
): string {
|
|
88
|
-
switch (governance) {
|
|
89
|
-
case "required":
|
|
90
|
-
return t("contextXray.governance.required", {
|
|
91
|
-
defaultValue: "Required",
|
|
92
|
-
});
|
|
93
|
-
case "inherited":
|
|
94
|
-
return t("contextXray.governance.inherited", {
|
|
95
|
-
defaultValue: "Inherited",
|
|
96
|
-
});
|
|
97
|
-
case "user":
|
|
98
|
-
return t("contextXray.governance.user", {
|
|
99
|
-
defaultValue: "Your context",
|
|
100
|
-
});
|
|
101
|
-
}
|
|
102
|
-
}
|
|
103
|
-
|
|
104
|
-
function sourceLabel(section: ContextManifestSystemSection): string {
|
|
105
|
-
return (
|
|
106
|
-
section.sourceRef?.path ??
|
|
107
|
-
section.sourceRef?.resourceId ??
|
|
108
|
-
section.sourceRef?.scope ??
|
|
109
|
-
"framework"
|
|
110
|
-
);
|
|
111
|
-
}
|
|
112
|
-
|
|
113
|
-
function SystemSectionRow({
|
|
114
|
-
section,
|
|
115
|
-
totalTokens,
|
|
116
|
-
}: {
|
|
117
|
-
section: ContextManifestSystemSection;
|
|
118
|
-
totalTokens: number;
|
|
119
|
-
}) {
|
|
120
|
-
const share =
|
|
121
|
-
totalTokens > 0 ? Math.round((section.tokenCount / totalTokens) * 100) : 0;
|
|
122
|
-
return (
|
|
123
|
-
<div className="flex min-h-12 items-start gap-2 rounded-sm px-2 py-1.5">
|
|
124
|
-
<span className="mt-1 flex size-6 shrink-0 items-center justify-center rounded-md text-muted-foreground">
|
|
125
|
-
<IconLock className="h-3.5 w-3.5" />
|
|
126
|
-
</span>
|
|
127
|
-
<div className="min-w-0 flex-1">
|
|
128
|
-
<div className="truncate text-[13px] font-medium leading-5 text-foreground">
|
|
129
|
-
{section.label}
|
|
130
|
-
</div>
|
|
131
|
-
<div className="truncate text-[11px] text-muted-foreground">
|
|
132
|
-
{sourceLabel(section)} · {formatTokens(section.tokenCount)} tokens ·{" "}
|
|
133
|
-
{share}%{section.tokenMethod === "estimate" ? " · estimated" : ""}
|
|
134
|
-
</div>
|
|
135
|
-
{section.preview ? (
|
|
136
|
-
<div className="mt-0.5 line-clamp-2 text-[11px] text-muted-foreground/80">
|
|
137
|
-
{section.preview}
|
|
138
|
-
</div>
|
|
139
|
-
) : null}
|
|
140
|
-
</div>
|
|
141
|
-
</div>
|
|
142
|
-
);
|
|
143
|
-
}
|
|
12
|
+
import { resolveContextWindow } from "./format.js";
|
|
144
13
|
|
|
145
14
|
export function ContextXRayPanel({
|
|
146
15
|
manifest,
|
|
@@ -156,264 +25,35 @@ export function ContextXRayPanel({
|
|
|
156
25
|
onRestore: (segmentId: string) => void;
|
|
157
26
|
}) {
|
|
158
27
|
const t = useT();
|
|
159
|
-
const [mode, setMode] = useState<"list" | "map">("list");
|
|
160
|
-
const [collapsed, setCollapsed] = useState<Set<string>>(new Set());
|
|
161
|
-
const segments = useMemo(
|
|
162
|
-
() => applyOptimisticStatus(manifest.segments, optimistic),
|
|
163
|
-
[manifest.segments, optimistic],
|
|
164
|
-
);
|
|
165
|
-
const groups = useMemo(() => groupedSegments(segments), [segments]);
|
|
166
|
-
const systemSections = manifest.systemSections ?? [];
|
|
167
|
-
const systemGroups = useMemo(() => {
|
|
168
|
-
const grouped = new Map<
|
|
169
|
-
ContextManifestSystemSection["governance"],
|
|
170
|
-
ContextManifestSystemSection[]
|
|
171
|
-
>();
|
|
172
|
-
for (const section of systemSections) {
|
|
173
|
-
const list = grouped.get(section.governance) ?? [];
|
|
174
|
-
list.push(section);
|
|
175
|
-
grouped.set(section.governance, list);
|
|
176
|
-
}
|
|
177
|
-
return GOVERNANCE_ORDER.flatMap((governance) => {
|
|
178
|
-
const sections = grouped.get(governance);
|
|
179
|
-
return sections && sections.length > 0
|
|
180
|
-
? [
|
|
181
|
-
{
|
|
182
|
-
governance,
|
|
183
|
-
sections,
|
|
184
|
-
tokens: sections.reduce(
|
|
185
|
-
(sum, section) => sum + section.tokenCount,
|
|
186
|
-
0,
|
|
187
|
-
),
|
|
188
|
-
},
|
|
189
|
-
]
|
|
190
|
-
: [];
|
|
191
|
-
});
|
|
192
|
-
}, [systemSections]);
|
|
193
|
-
const contextWindow = resolveContextWindow(manifest.model);
|
|
194
|
-
const pct = Math.min(
|
|
195
|
-
100,
|
|
196
|
-
Math.round((manifest.totalTokens / contextWindow) * 100),
|
|
197
|
-
);
|
|
198
|
-
const headroom = Math.max(0, contextWindow - manifest.totalTokens);
|
|
199
|
-
const pinned = segments.filter((s) => s.status === "pinned").length;
|
|
200
|
-
const evicted = segments.filter((s) => s.status === "evicted").length;
|
|
201
|
-
const systemTokens = manifestSystemTokens(manifest);
|
|
202
|
-
const conversationTokens = manifestConversationTokens(manifest);
|
|
203
|
-
const details = [
|
|
204
|
-
`${formatTokens(headroom)} free`,
|
|
205
|
-
systemTokens > 0 ? `${formatTokens(systemTokens)} system` : null,
|
|
206
|
-
`${formatTokens(conversationTokens)} conversation`,
|
|
207
|
-
pinned > 0 ? `${pinned} pinned` : null,
|
|
208
|
-
evicted > 0 ? `${evicted} evicted` : null,
|
|
209
|
-
manifest.tokenCountMethod === "estimate" ? "estimated" : null,
|
|
210
|
-
!manifest.enforceable ? "advisory" : null,
|
|
211
|
-
].filter((item): item is string => Boolean(item));
|
|
212
|
-
|
|
213
28
|
return (
|
|
214
|
-
<
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
</div>
|
|
244
|
-
|
|
245
|
-
<div className="overflow-y-auto px-2 py-2">
|
|
246
|
-
<div className="mb-1 flex items-center justify-end">
|
|
247
|
-
<div className="inline-flex rounded-md bg-muted/40 p-0.5">
|
|
248
|
-
<Tooltip>
|
|
249
|
-
<TooltipTrigger asChild>
|
|
250
|
-
<button
|
|
251
|
-
type="button"
|
|
252
|
-
onClick={() => setMode("list")}
|
|
253
|
-
aria-label="Show context list"
|
|
254
|
-
className={cn(
|
|
255
|
-
"flex size-7 cursor-pointer items-center justify-center rounded text-muted-foreground",
|
|
256
|
-
mode === "list"
|
|
257
|
-
? "bg-background text-foreground shadow-sm"
|
|
258
|
-
: "hover:text-foreground",
|
|
259
|
-
)}
|
|
260
|
-
>
|
|
261
|
-
<IconListDetails className="h-3.5 w-3.5" />
|
|
262
|
-
</button>
|
|
263
|
-
</TooltipTrigger>
|
|
264
|
-
<TooltipContent>List</TooltipContent>
|
|
265
|
-
</Tooltip>
|
|
266
|
-
<Tooltip>
|
|
267
|
-
<TooltipTrigger asChild>
|
|
268
|
-
<button
|
|
269
|
-
type="button"
|
|
270
|
-
onClick={() => setMode("map")}
|
|
271
|
-
aria-label="Show context map"
|
|
272
|
-
className={cn(
|
|
273
|
-
"flex size-7 cursor-pointer items-center justify-center rounded text-muted-foreground",
|
|
274
|
-
mode === "map"
|
|
275
|
-
? "bg-background text-foreground shadow-sm"
|
|
276
|
-
: "hover:text-foreground",
|
|
277
|
-
)}
|
|
278
|
-
>
|
|
279
|
-
<IconChartTreemap className="h-3.5 w-3.5" />
|
|
280
|
-
</button>
|
|
281
|
-
</TooltipTrigger>
|
|
282
|
-
<TooltipContent>Map</TooltipContent>
|
|
283
|
-
</Tooltip>
|
|
284
|
-
</div>
|
|
285
|
-
</div>
|
|
286
|
-
|
|
287
|
-
{mode === "map" ? (
|
|
288
|
-
<ContextTreemap
|
|
289
|
-
segments={segments}
|
|
290
|
-
systemSections={systemSections}
|
|
291
|
-
onSelect={(segmentId) => {
|
|
292
|
-
const segment = segments.find((s) => s.segmentId === segmentId);
|
|
293
|
-
if (segment) setCollapsed(new Set());
|
|
294
|
-
}}
|
|
295
|
-
/>
|
|
296
|
-
) : (
|
|
297
|
-
<div className="divide-y divide-border/60">
|
|
298
|
-
{systemGroups.length > 0 && (
|
|
299
|
-
<div>
|
|
300
|
-
<div className="px-1.5 pb-1 pt-2 text-[10px] font-semibold uppercase tracking-[0.12em] text-muted-foreground">
|
|
301
|
-
{t("contextXray.systemOrdered", {
|
|
302
|
-
defaultValue: "System · ordered, not evictable",
|
|
303
|
-
})}
|
|
304
|
-
</div>
|
|
305
|
-
{systemGroups.map((group) => {
|
|
306
|
-
const groupKey = `system:${group.governance}`;
|
|
307
|
-
const isCollapsed = collapsed.has(groupKey);
|
|
308
|
-
return (
|
|
309
|
-
<div key={groupKey}>
|
|
310
|
-
<button
|
|
311
|
-
type="button"
|
|
312
|
-
onClick={() => {
|
|
313
|
-
setCollapsed((prev) => {
|
|
314
|
-
const next = new Set(prev);
|
|
315
|
-
if (next.has(groupKey)) next.delete(groupKey);
|
|
316
|
-
else next.add(groupKey);
|
|
317
|
-
return next;
|
|
318
|
-
});
|
|
319
|
-
}}
|
|
320
|
-
className="flex w-full cursor-pointer items-center gap-2 rounded-sm px-1.5 py-2 text-left hover:bg-accent/35"
|
|
321
|
-
>
|
|
322
|
-
{isCollapsed ? (
|
|
323
|
-
<IconChevronRight className="h-3.5 w-3.5 text-muted-foreground" />
|
|
324
|
-
) : (
|
|
325
|
-
<IconChevronDown className="h-3.5 w-3.5 text-muted-foreground" />
|
|
326
|
-
)}
|
|
327
|
-
<IconLock className="h-3 w-3 text-muted-foreground" />
|
|
328
|
-
<span className="min-w-0 flex-1 truncate text-xs font-medium">
|
|
329
|
-
{governanceLabel(group.governance, t)}
|
|
330
|
-
</span>
|
|
331
|
-
<span className="text-[11px] text-muted-foreground">
|
|
332
|
-
{formatTokens(group.tokens)} ·{" "}
|
|
333
|
-
{manifest.totalTokens > 0
|
|
334
|
-
? Math.round(
|
|
335
|
-
(group.tokens / manifest.totalTokens) * 100,
|
|
336
|
-
)
|
|
337
|
-
: 0}
|
|
338
|
-
%
|
|
339
|
-
</span>
|
|
340
|
-
</button>
|
|
341
|
-
{!isCollapsed && (
|
|
342
|
-
<div className="pb-1">
|
|
343
|
-
{group.sections
|
|
344
|
-
.slice()
|
|
345
|
-
.sort((a, b) => b.tokenCount - a.tokenCount)
|
|
346
|
-
.map((section) => (
|
|
347
|
-
<SystemSectionRow
|
|
348
|
-
key={section.segmentId}
|
|
349
|
-
section={section}
|
|
350
|
-
totalTokens={manifest.totalTokens}
|
|
351
|
-
/>
|
|
352
|
-
))}
|
|
353
|
-
</div>
|
|
354
|
-
)}
|
|
355
|
-
</div>
|
|
356
|
-
);
|
|
357
|
-
})}
|
|
358
|
-
</div>
|
|
359
|
-
)}
|
|
360
|
-
{groups.map((group) => {
|
|
361
|
-
const isCollapsed = collapsed.has(group.name);
|
|
362
|
-
return (
|
|
363
|
-
<div key={group.name}>
|
|
364
|
-
<button
|
|
365
|
-
type="button"
|
|
366
|
-
onClick={() => {
|
|
367
|
-
setCollapsed((prev) => {
|
|
368
|
-
const next = new Set(prev);
|
|
369
|
-
if (next.has(group.name)) next.delete(group.name);
|
|
370
|
-
else next.add(group.name);
|
|
371
|
-
return next;
|
|
372
|
-
});
|
|
373
|
-
}}
|
|
374
|
-
className="flex w-full cursor-pointer items-center gap-2 rounded-sm px-1.5 py-2 text-left hover:bg-accent/35"
|
|
375
|
-
>
|
|
376
|
-
{isCollapsed ? (
|
|
377
|
-
<IconChevronRight className="h-3.5 w-3.5 text-muted-foreground" />
|
|
378
|
-
) : (
|
|
379
|
-
<IconChevronDown className="h-3.5 w-3.5 text-muted-foreground" />
|
|
380
|
-
)}
|
|
381
|
-
<span
|
|
382
|
-
className={cn(
|
|
383
|
-
"h-2 w-2 rounded-full",
|
|
384
|
-
groupColor(group.name),
|
|
385
|
-
)}
|
|
386
|
-
/>
|
|
387
|
-
<span className="min-w-0 flex-1 truncate text-xs font-medium">
|
|
388
|
-
{group.name}
|
|
389
|
-
</span>
|
|
390
|
-
<span className="text-[11px] text-muted-foreground">
|
|
391
|
-
{formatTokens(group.tokens)}
|
|
392
|
-
</span>
|
|
393
|
-
</button>
|
|
394
|
-
{!isCollapsed && (
|
|
395
|
-
<div className="pb-1">
|
|
396
|
-
{group.segments
|
|
397
|
-
.slice()
|
|
398
|
-
.sort((a, b) => b.tokenCount - a.tokenCount)
|
|
399
|
-
.map((segment) => (
|
|
400
|
-
<ContextSegmentRow
|
|
401
|
-
key={segment.segmentId}
|
|
402
|
-
segment={segment}
|
|
403
|
-
advisory={!manifest.enforceable}
|
|
404
|
-
onPin={() => onPin(segment.segmentId)}
|
|
405
|
-
onEvict={() => onEvict(segment.segmentId)}
|
|
406
|
-
onRestore={() => onRestore(segment.segmentId)}
|
|
407
|
-
/>
|
|
408
|
-
))}
|
|
409
|
-
</div>
|
|
410
|
-
)}
|
|
411
|
-
</div>
|
|
412
|
-
);
|
|
413
|
-
})}
|
|
414
|
-
</div>
|
|
415
|
-
)}
|
|
416
|
-
</div>
|
|
417
|
-
</div>
|
|
29
|
+
<ContextXRayPanelView
|
|
30
|
+
manifest={{
|
|
31
|
+
...manifest,
|
|
32
|
+
systemTokens: manifestSystemTokens(manifest),
|
|
33
|
+
conversationTokens: manifestConversationTokens(manifest),
|
|
34
|
+
}}
|
|
35
|
+
contextWindow={resolveContextWindow(manifest.model)}
|
|
36
|
+
optimistic={optimistic}
|
|
37
|
+
onPin={onPin}
|
|
38
|
+
onEvict={onEvict}
|
|
39
|
+
onRestore={onRestore}
|
|
40
|
+
titleLabel={t("contextXray.pageTitle", {
|
|
41
|
+
defaultValue: "Context X-Ray",
|
|
42
|
+
})}
|
|
43
|
+
systemOrderedLabel={t("contextXray.systemOrdered", {
|
|
44
|
+
defaultValue: "System · ordered, not evictable",
|
|
45
|
+
})}
|
|
46
|
+
governanceLabels={{
|
|
47
|
+
required: t("contextXray.governance.required", {
|
|
48
|
+
defaultValue: "Required",
|
|
49
|
+
}),
|
|
50
|
+
inherited: t("contextXray.governance.inherited", {
|
|
51
|
+
defaultValue: "Inherited",
|
|
52
|
+
}),
|
|
53
|
+
user: t("contextXray.governance.user", {
|
|
54
|
+
defaultValue: "Your context",
|
|
55
|
+
}),
|
|
56
|
+
}}
|
|
57
|
+
/>
|
|
418
58
|
);
|
|
419
59
|
}
|
|
@@ -1,12 +1,7 @@
|
|
|
1
|
+
import { SegmentProvenancePopoverView } from "@agent-native/toolkit/context-ui";
|
|
1
2
|
import type React from "react";
|
|
2
3
|
|
|
3
4
|
import type { ContextManifestSegment } from "../../shared/context-xray.js";
|
|
4
|
-
import {
|
|
5
|
-
Popover,
|
|
6
|
-
PopoverContent,
|
|
7
|
-
PopoverTrigger,
|
|
8
|
-
} from "../components/ui/popover.js";
|
|
9
|
-
import { formatTokens, statusLabel } from "./format.js";
|
|
10
5
|
|
|
11
6
|
export function SegmentProvenancePopover({
|
|
12
7
|
segment,
|
|
@@ -16,51 +11,8 @@ export function SegmentProvenancePopover({
|
|
|
16
11
|
children: React.ReactNode;
|
|
17
12
|
}) {
|
|
18
13
|
return (
|
|
19
|
-
<
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
<div className="space-y-2">
|
|
23
|
-
<div>
|
|
24
|
-
<div className="text-[11px] font-medium uppercase text-muted-foreground">
|
|
25
|
-
Segment
|
|
26
|
-
</div>
|
|
27
|
-
<div className="mt-0.5 break-words text-xs text-foreground">
|
|
28
|
-
{segment.label}
|
|
29
|
-
</div>
|
|
30
|
-
</div>
|
|
31
|
-
<div className="grid grid-cols-2 gap-2 text-[11px] text-muted-foreground">
|
|
32
|
-
<div>
|
|
33
|
-
<span className="block font-medium text-foreground">
|
|
34
|
-
{formatTokens(segment.tokenCount)}
|
|
35
|
-
</span>
|
|
36
|
-
tokens{segment.tokenMethod === "estimate" ? " estimated" : ""}
|
|
37
|
-
</div>
|
|
38
|
-
<div>
|
|
39
|
-
<span className="block font-medium text-foreground">
|
|
40
|
-
{statusLabel(segment)}
|
|
41
|
-
</span>
|
|
42
|
-
current status
|
|
43
|
-
</div>
|
|
44
|
-
<div>
|
|
45
|
-
<span className="block font-medium text-foreground">
|
|
46
|
-
{segment.msgIndex ?? "-"}
|
|
47
|
-
</span>
|
|
48
|
-
message index
|
|
49
|
-
</div>
|
|
50
|
-
<div>
|
|
51
|
-
<span className="block font-medium text-foreground">
|
|
52
|
-
{segment.partIndex ?? "-"}
|
|
53
|
-
</span>
|
|
54
|
-
part index
|
|
55
|
-
</div>
|
|
56
|
-
</div>
|
|
57
|
-
{segment.protected && (
|
|
58
|
-
<div className="rounded-md border border-border bg-muted/40 px-2 py-1.5 text-[11px] text-muted-foreground">
|
|
59
|
-
This segment is part of the active turn and cannot be evicted yet.
|
|
60
|
-
</div>
|
|
61
|
-
)}
|
|
62
|
-
</div>
|
|
63
|
-
</PopoverContent>
|
|
64
|
-
</Popover>
|
|
14
|
+
<SegmentProvenancePopoverView segment={segment}>
|
|
15
|
+
{children}
|
|
16
|
+
</SegmentProvenancePopoverView>
|
|
65
17
|
);
|
|
66
18
|
}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { getContextWindowForModel } from "../../agent/model-config.js";
|
|
2
|
-
import type { ContextManifestSegment } from "../../shared/context-xray.js";
|
|
3
2
|
|
|
4
3
|
/**
|
|
5
4
|
* Fallback context-window limit used when no model ID is available.
|
|
@@ -26,35 +25,3 @@ export function formatTokens(tokens: number | undefined): string {
|
|
|
26
25
|
}
|
|
27
26
|
return String(value);
|
|
28
27
|
}
|
|
29
|
-
|
|
30
|
-
export function statusLabel(segment: ContextManifestSegment): string {
|
|
31
|
-
if (segment.protected) return "Protected";
|
|
32
|
-
if (segment.status === "pinned") return "Pinned";
|
|
33
|
-
if (segment.status === "evicted") return "Evicted";
|
|
34
|
-
if (segment.status === "summarized") return "Summarized";
|
|
35
|
-
return "Active";
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
export function groupColor(group: string): string {
|
|
39
|
-
if (group === "Pinned") return "bg-emerald-500";
|
|
40
|
-
if (group === "Tool results") return "bg-amber-500";
|
|
41
|
-
if (group === "Files read") return "bg-sky-500";
|
|
42
|
-
if (group === "Thinking") return "bg-violet-500";
|
|
43
|
-
if (group === "Task & instructions") return "bg-rose-500";
|
|
44
|
-
if (group === "System · required") return "bg-slate-700";
|
|
45
|
-
if (group === "System · inherited") return "bg-indigo-500";
|
|
46
|
-
if (group === "System · user") return "bg-teal-500";
|
|
47
|
-
return "bg-slate-400";
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
export function groupFill(group: string): string {
|
|
51
|
-
if (group === "Pinned") return "#10b981";
|
|
52
|
-
if (group === "Tool results") return "#f59e0b";
|
|
53
|
-
if (group === "Files read") return "#0ea5e9";
|
|
54
|
-
if (group === "Thinking") return "#8b5cf6";
|
|
55
|
-
if (group === "Task & instructions") return "#f43f5e";
|
|
56
|
-
if (group === "System · required") return "#334155";
|
|
57
|
-
if (group === "System · inherited") return "#6366f1";
|
|
58
|
-
if (group === "System · user") return "#14b8a6";
|
|
59
|
-
return "#94a3b8";
|
|
60
|
-
}
|