@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
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@agent-native/core",
|
|
3
|
-
"version": "0.109.
|
|
3
|
+
"version": "0.109.4",
|
|
4
4
|
"description": "Framework for agent-native application development — where AI agents and UI share SQL state, actions, and context",
|
|
5
5
|
"homepage": "https://github.com/BuilderIO/agent-native#readme",
|
|
6
6
|
"bugs": {
|
|
@@ -31,6 +31,7 @@
|
|
|
31
31
|
"type": "module",
|
|
32
32
|
"sideEffects": [
|
|
33
33
|
"*.css",
|
|
34
|
+
"dist/client/index.js",
|
|
34
35
|
"dist/client/chat/widgets/builtin-tool-renderers.js",
|
|
35
36
|
"dist/client/dev-overlay/builtins.js"
|
|
36
37
|
],
|
|
@@ -269,12 +270,12 @@
|
|
|
269
270
|
"@mozilla/readability": "0.6.0",
|
|
270
271
|
"@neondatabase/serverless": "^1.1.0",
|
|
271
272
|
"@opentelemetry/sdk-trace-base": "^2.8.0",
|
|
272
|
-
"@radix-ui/react-dialog": "1.1.
|
|
273
|
-
"@radix-ui/react-dropdown-menu": "^2.1.
|
|
274
|
-
"@radix-ui/react-hover-card": "^1.1.
|
|
275
|
-
"@radix-ui/react-popover": "^1.1.
|
|
276
|
-
"@radix-ui/react-select": "^2.
|
|
277
|
-
"@radix-ui/react-tooltip": "^1.2.
|
|
273
|
+
"@radix-ui/react-dialog": "^1.1.19",
|
|
274
|
+
"@radix-ui/react-dropdown-menu": "^2.1.20",
|
|
275
|
+
"@radix-ui/react-hover-card": "^1.1.19",
|
|
276
|
+
"@radix-ui/react-popover": "^1.1.19",
|
|
277
|
+
"@radix-ui/react-select": "^2.3.3",
|
|
278
|
+
"@radix-ui/react-tooltip": "^1.2.12",
|
|
278
279
|
"@react-router/dev": "^8.1.0",
|
|
279
280
|
"@react-router/fs-routes": "^8.1.0",
|
|
280
281
|
"@resvg/resvg-js": "^2.6.2",
|
|
@@ -284,23 +285,23 @@
|
|
|
284
285
|
"@shadcn/react": "^0.2.0",
|
|
285
286
|
"@standard-schema/spec": "^1.1.0",
|
|
286
287
|
"@tanstack/react-table": "^8.21.3",
|
|
287
|
-
"@tiptap/core": "3.
|
|
288
|
-
"@tiptap/extension-code-block-lowlight": "3.
|
|
289
|
-
"@tiptap/extension-collaboration": "3.
|
|
290
|
-
"@tiptap/extension-collaboration-caret": "3.
|
|
291
|
-
"@tiptap/extension-image": "3.
|
|
292
|
-
"@tiptap/extension-link": "3.
|
|
293
|
-
"@tiptap/extension-placeholder": "3.
|
|
294
|
-
"@tiptap/extension-table": "3.
|
|
295
|
-
"@tiptap/extension-table-cell": "3.
|
|
296
|
-
"@tiptap/extension-table-header": "3.
|
|
297
|
-
"@tiptap/extension-table-row": "3.
|
|
298
|
-
"@tiptap/extension-task-item": "3.
|
|
299
|
-
"@tiptap/extension-task-list": "3.
|
|
300
|
-
"@tiptap/pm": "3.
|
|
301
|
-
"@tiptap/react": "3.
|
|
302
|
-
"@tiptap/starter-kit": "3.
|
|
303
|
-
"@tiptap/y-tiptap": "
|
|
288
|
+
"@tiptap/core": "3.28.0",
|
|
289
|
+
"@tiptap/extension-code-block-lowlight": "3.28.0",
|
|
290
|
+
"@tiptap/extension-collaboration": "3.28.0",
|
|
291
|
+
"@tiptap/extension-collaboration-caret": "3.28.0",
|
|
292
|
+
"@tiptap/extension-image": "3.28.0",
|
|
293
|
+
"@tiptap/extension-link": "3.28.0",
|
|
294
|
+
"@tiptap/extension-placeholder": "3.28.0",
|
|
295
|
+
"@tiptap/extension-table": "3.28.0",
|
|
296
|
+
"@tiptap/extension-table-cell": "3.28.0",
|
|
297
|
+
"@tiptap/extension-table-header": "3.28.0",
|
|
298
|
+
"@tiptap/extension-table-row": "3.28.0",
|
|
299
|
+
"@tiptap/extension-task-item": "3.28.0",
|
|
300
|
+
"@tiptap/extension-task-list": "3.28.0",
|
|
301
|
+
"@tiptap/pm": "3.28.0",
|
|
302
|
+
"@tiptap/react": "3.28.0",
|
|
303
|
+
"@tiptap/starter-kit": "3.28.0",
|
|
304
|
+
"@tiptap/y-tiptap": "3.0.7",
|
|
304
305
|
"@uiw/react-codemirror": "^4.25.10",
|
|
305
306
|
"ajv": "^8.20.0",
|
|
306
307
|
"better-auth": "1.6.16",
|
|
@@ -328,7 +329,7 @@
|
|
|
328
329
|
"prettier": "^3.8.3",
|
|
329
330
|
"react-i18next": "17.0.8",
|
|
330
331
|
"react-markdown": "^10.1.0",
|
|
331
|
-
"recharts": "^3.
|
|
332
|
+
"recharts": "^3.9.2",
|
|
332
333
|
"remark-gfm": "^4.0.1",
|
|
333
334
|
"roughjs": "4.6.6",
|
|
334
335
|
"safe-regex2": "5.1.1",
|
|
@@ -343,7 +344,7 @@
|
|
|
343
344
|
"yjs": "^13.6.31",
|
|
344
345
|
"zod": "^4.3.6",
|
|
345
346
|
"@agent-native/recap-cli": "0.4.4",
|
|
346
|
-
"@agent-native/toolkit": "^0.
|
|
347
|
+
"@agent-native/toolkit": "^0.5.0"
|
|
347
348
|
},
|
|
348
349
|
"devDependencies": {
|
|
349
350
|
"@ai-sdk/anthropic": "^3.0.71",
|
|
@@ -138,6 +138,25 @@ Attribution parsing is fully defensive and never blocks signup — a missing/mal
|
|
|
138
138
|
Other framework-level baseline events:
|
|
139
139
|
|
|
140
140
|
- `session status` from `useSession()`, with `signed_in`
|
|
141
|
+
- `action.response` from the browser action transport, with action name,
|
|
142
|
+
browser-perceived duration and TTFB, response status/outcome, response size
|
|
143
|
+
when known, and parsed `Server-Timing` phases for framework readiness and
|
|
144
|
+
database work. Its `request_id` joins the exact browser and server events.
|
|
145
|
+
This separates server time from CDN/network/body overhead.
|
|
146
|
+
- `http.response` from Nitro request/response hooks, with normalized path,
|
|
147
|
+
status, request duration, first-request-in-isolate cold marker, process age,
|
|
148
|
+
framework readiness wait, deploy/runtime fingerprint, database
|
|
149
|
+
connection/query counts and timings, retries, timeouts, and failures. It also
|
|
150
|
+
emits `Server-Timing` for `app`, `startup`, `db`, `db-connect`, and
|
|
151
|
+
`db-slowest` plus an `X-Agent-Native-Request-Id` correlation header where
|
|
152
|
+
applicable. Query text and parameters are never captured.
|
|
153
|
+
Database activity that begins during the first two minutes of process/plugin
|
|
154
|
+
initialization is reported separately as `startup_db_*` on the first
|
|
155
|
+
framework request that passes the readiness gate.
|
|
156
|
+
Slow, cold-isolate, server failures, and 4xx action routes are always
|
|
157
|
+
retained; fast successful requests default to 10% sampling. Override with
|
|
158
|
+
`AGENT_NATIVE_HTTP_TELEMETRY_SAMPLE_RATE` on the server and
|
|
159
|
+
`VITE_AGENT_NATIVE_ACTION_TELEMETRY_SAMPLE_RATE` in the browser.
|
|
141
160
|
- `signup` from Better Auth user creation, with `auth_provider`, `auth_user_id`, and first-touch referral attribution (`referral_source`, `referrer_user`, `referral_medium`, `referral_campaign`, `utm_*`, `first_touch_path`, `landing_referrer` — see "Referral / viral attribution" above)
|
|
142
161
|
- `builder connect clicked` and `builder connect popup blocked` from browser Connect Builder CTAs
|
|
143
162
|
- `builder connect started`, `builder connect succeeded`, `builder connect failed`, `builder disconnect succeeded`, and `builder disconnect failed` from the Builder connection routes, with LLM connection context when resolvable
|
|
@@ -1,253 +0,0 @@
|
|
|
1
|
-
import { TextSelection } from "@tiptap/pm/state";
|
|
2
|
-
import type { Editor } from "@tiptap/react";
|
|
3
|
-
import { useEffect, useState, type CSSProperties } from "react";
|
|
4
|
-
|
|
5
|
-
import { cn } from "../utils.js";
|
|
6
|
-
|
|
7
|
-
/** A bubble-toolbar button or a divider. */
|
|
8
|
-
export type BubbleToolbarItem =
|
|
9
|
-
| {
|
|
10
|
-
/** Short label/glyph shown on the button. */
|
|
11
|
-
label: string;
|
|
12
|
-
/** Accessible/title text. */
|
|
13
|
-
title: string;
|
|
14
|
-
action: () => void;
|
|
15
|
-
isActive: () => boolean;
|
|
16
|
-
style?: CSSProperties;
|
|
17
|
-
}
|
|
18
|
-
| { type: "divider" };
|
|
19
|
-
|
|
20
|
-
/**
|
|
21
|
-
* Builds the default selection-toolbar items (Plan's current set): bold,
|
|
22
|
-
* italic, strike, code, headings 1-3, and a link toggle. `toggleLink` is
|
|
23
|
-
* supplied by the toolbar so the link-editor input can be opened.
|
|
24
|
-
*/
|
|
25
|
-
export function buildDefaultBubbleItems(
|
|
26
|
-
editor: Editor,
|
|
27
|
-
toggleLink: () => void,
|
|
28
|
-
): BubbleToolbarItem[] {
|
|
29
|
-
return [
|
|
30
|
-
{
|
|
31
|
-
label: "B",
|
|
32
|
-
title: "Bold",
|
|
33
|
-
action: () => editor.chain().focus().toggleBold().run(),
|
|
34
|
-
isActive: () => editor.isActive("bold"),
|
|
35
|
-
style: { fontWeight: 700 },
|
|
36
|
-
},
|
|
37
|
-
{
|
|
38
|
-
label: "I",
|
|
39
|
-
title: "Italic",
|
|
40
|
-
action: () => editor.chain().focus().toggleItalic().run(),
|
|
41
|
-
isActive: () => editor.isActive("italic"),
|
|
42
|
-
style: { fontStyle: "italic" },
|
|
43
|
-
},
|
|
44
|
-
{
|
|
45
|
-
label: "S",
|
|
46
|
-
title: "Strikethrough",
|
|
47
|
-
action: () => editor.chain().focus().toggleStrike().run(),
|
|
48
|
-
isActive: () => editor.isActive("strike"),
|
|
49
|
-
style: { textDecoration: "line-through" },
|
|
50
|
-
},
|
|
51
|
-
{
|
|
52
|
-
label: "<>",
|
|
53
|
-
title: "Code",
|
|
54
|
-
action: () => editor.chain().focus().toggleCode().run(),
|
|
55
|
-
isActive: () => editor.isActive("code"),
|
|
56
|
-
style: { fontFamily: "monospace", fontSize: 11 },
|
|
57
|
-
},
|
|
58
|
-
{ type: "divider" },
|
|
59
|
-
{
|
|
60
|
-
label: "H1",
|
|
61
|
-
title: "Heading 1",
|
|
62
|
-
action: () => editor.chain().focus().toggleHeading({ level: 1 }).run(),
|
|
63
|
-
isActive: () => editor.isActive("heading", { level: 1 }),
|
|
64
|
-
},
|
|
65
|
-
{
|
|
66
|
-
label: "H2",
|
|
67
|
-
title: "Heading 2",
|
|
68
|
-
action: () => editor.chain().focus().toggleHeading({ level: 2 }).run(),
|
|
69
|
-
isActive: () => editor.isActive("heading", { level: 2 }),
|
|
70
|
-
},
|
|
71
|
-
{
|
|
72
|
-
label: "H3",
|
|
73
|
-
title: "Heading 3",
|
|
74
|
-
action: () => editor.chain().focus().toggleHeading({ level: 3 }).run(),
|
|
75
|
-
isActive: () => editor.isActive("heading", { level: 3 }),
|
|
76
|
-
},
|
|
77
|
-
{ type: "divider" },
|
|
78
|
-
{
|
|
79
|
-
label: "Link",
|
|
80
|
-
title: "Link",
|
|
81
|
-
action: toggleLink,
|
|
82
|
-
isActive: () => editor.isActive("link"),
|
|
83
|
-
},
|
|
84
|
-
];
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
export interface BubbleToolbarProps {
|
|
88
|
-
editor: Editor;
|
|
89
|
-
/**
|
|
90
|
-
* Custom item builder. Receives the editor and the `toggleLink` helper (so a
|
|
91
|
-
* custom set can still open the built-in link editor). Defaults to
|
|
92
|
-
* {@link buildDefaultBubbleItems}.
|
|
93
|
-
*/
|
|
94
|
-
buildItems?: (editor: Editor, toggleLink: () => void) => BubbleToolbarItem[];
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
/**
|
|
98
|
-
* The shared floating selection toolbar. Tracks the current text selection and
|
|
99
|
-
* positions a fixed toolbar above it, with an inline link editor. Extracted
|
|
100
|
-
* from the inline plan toolbar so embedders share one implementation; apps swap
|
|
101
|
-
* the item set via `buildItems`.
|
|
102
|
-
*/
|
|
103
|
-
export function BubbleToolbar({
|
|
104
|
-
editor,
|
|
105
|
-
buildItems = buildDefaultBubbleItems,
|
|
106
|
-
}: BubbleToolbarProps) {
|
|
107
|
-
const [visible, setVisible] = useState(false);
|
|
108
|
-
const [coords, setCoords] = useState({ top: 0, left: 0 });
|
|
109
|
-
const [showLinkInput, setShowLinkInput] = useState(false);
|
|
110
|
-
const [linkUrl, setLinkUrl] = useState("");
|
|
111
|
-
|
|
112
|
-
useEffect(() => {
|
|
113
|
-
const update = () => {
|
|
114
|
-
const selectionState = editor.state.selection;
|
|
115
|
-
const { from, to } = selectionState;
|
|
116
|
-
const selection = window.getSelection();
|
|
117
|
-
const selectionInsideEditor =
|
|
118
|
-
!!selection?.anchorNode &&
|
|
119
|
-
!!selection.focusNode &&
|
|
120
|
-
editor.view.dom.contains(selection.anchorNode) &&
|
|
121
|
-
editor.view.dom.contains(selection.focusNode);
|
|
122
|
-
if (
|
|
123
|
-
!(selectionState instanceof TextSelection) ||
|
|
124
|
-
from === to ||
|
|
125
|
-
!selectionInsideEditor
|
|
126
|
-
) {
|
|
127
|
-
setVisible(false);
|
|
128
|
-
return;
|
|
129
|
-
}
|
|
130
|
-
if (!selection || selection.rangeCount === 0) {
|
|
131
|
-
setVisible(false);
|
|
132
|
-
return;
|
|
133
|
-
}
|
|
134
|
-
const rect = selection.getRangeAt(0).getBoundingClientRect();
|
|
135
|
-
if (rect.width === 0 && rect.height === 0) {
|
|
136
|
-
setVisible(false);
|
|
137
|
-
return;
|
|
138
|
-
}
|
|
139
|
-
setCoords({
|
|
140
|
-
top: rect.top - 8,
|
|
141
|
-
left: rect.left + rect.width / 2,
|
|
142
|
-
});
|
|
143
|
-
setVisible(true);
|
|
144
|
-
};
|
|
145
|
-
editor.on("selectionUpdate", update);
|
|
146
|
-
editor.on("transaction", update);
|
|
147
|
-
document.addEventListener("selectionchange", update);
|
|
148
|
-
const onBlur = () => {
|
|
149
|
-
setTimeout(() => {
|
|
150
|
-
if (!editor.isFocused) setVisible(false);
|
|
151
|
-
}, 140);
|
|
152
|
-
};
|
|
153
|
-
editor.on("blur", onBlur);
|
|
154
|
-
return () => {
|
|
155
|
-
editor.off("selectionUpdate", update);
|
|
156
|
-
editor.off("transaction", update);
|
|
157
|
-
document.removeEventListener("selectionchange", update);
|
|
158
|
-
editor.off("blur", onBlur);
|
|
159
|
-
};
|
|
160
|
-
}, [editor]);
|
|
161
|
-
|
|
162
|
-
const handleSetLink = () => {
|
|
163
|
-
if (linkUrl.trim()) {
|
|
164
|
-
editor
|
|
165
|
-
.chain()
|
|
166
|
-
.focus()
|
|
167
|
-
.extendMarkRange("link")
|
|
168
|
-
.setLink({ href: linkUrl.trim() })
|
|
169
|
-
.run();
|
|
170
|
-
} else {
|
|
171
|
-
editor.chain().focus().extendMarkRange("link").unsetLink().run();
|
|
172
|
-
}
|
|
173
|
-
setShowLinkInput(false);
|
|
174
|
-
setLinkUrl("");
|
|
175
|
-
};
|
|
176
|
-
|
|
177
|
-
const toggleLink = () => {
|
|
178
|
-
if (editor.isActive("link")) {
|
|
179
|
-
editor.chain().focus().unsetLink().run();
|
|
180
|
-
return;
|
|
181
|
-
}
|
|
182
|
-
setLinkUrl(editor.getAttributes("link").href || "");
|
|
183
|
-
setShowLinkInput(true);
|
|
184
|
-
};
|
|
185
|
-
|
|
186
|
-
const items = buildItems(editor, toggleLink);
|
|
187
|
-
|
|
188
|
-
if (!visible) return null;
|
|
189
|
-
|
|
190
|
-
return (
|
|
191
|
-
<div
|
|
192
|
-
className="an-rich-md-bubble-toolbar"
|
|
193
|
-
style={{
|
|
194
|
-
position: "fixed",
|
|
195
|
-
top: coords.top,
|
|
196
|
-
left: coords.left,
|
|
197
|
-
transform: "translate(-50%, -100%)",
|
|
198
|
-
}}
|
|
199
|
-
onMouseDown={(event) => event.preventDefault()}
|
|
200
|
-
data-plan-interactive
|
|
201
|
-
>
|
|
202
|
-
{showLinkInput ? (
|
|
203
|
-
<div className="an-rich-md-link-editor">
|
|
204
|
-
<input
|
|
205
|
-
autoFocus
|
|
206
|
-
type="url"
|
|
207
|
-
placeholder="Paste link..."
|
|
208
|
-
value={linkUrl}
|
|
209
|
-
onChange={(event) => setLinkUrl(event.target.value)}
|
|
210
|
-
onKeyDown={(event) => {
|
|
211
|
-
if (event.key === "Enter") handleSetLink();
|
|
212
|
-
if (event.key === "Escape") {
|
|
213
|
-
setShowLinkInput(false);
|
|
214
|
-
setLinkUrl("");
|
|
215
|
-
}
|
|
216
|
-
}}
|
|
217
|
-
/>
|
|
218
|
-
<button type="button" onClick={handleSetLink}>
|
|
219
|
-
Apply
|
|
220
|
-
</button>
|
|
221
|
-
</div>
|
|
222
|
-
) : (
|
|
223
|
-
<div className="an-rich-md-bubble-items">
|
|
224
|
-
{items.map((item, index) => {
|
|
225
|
-
if ("type" in item) {
|
|
226
|
-
return (
|
|
227
|
-
<span
|
|
228
|
-
key={`divider-${index}`}
|
|
229
|
-
className="an-rich-md-bubble-divider"
|
|
230
|
-
/>
|
|
231
|
-
);
|
|
232
|
-
}
|
|
233
|
-
return (
|
|
234
|
-
<button
|
|
235
|
-
key={item.title}
|
|
236
|
-
type="button"
|
|
237
|
-
title={item.title}
|
|
238
|
-
className={cn(
|
|
239
|
-
"an-rich-md-bubble-button",
|
|
240
|
-
item.isActive() && "an-rich-md-bubble-button--active",
|
|
241
|
-
)}
|
|
242
|
-
style={item.style}
|
|
243
|
-
onClick={item.action}
|
|
244
|
-
>
|
|
245
|
-
{item.label}
|
|
246
|
-
</button>
|
|
247
|
-
);
|
|
248
|
-
})}
|
|
249
|
-
</div>
|
|
250
|
-
)}
|
|
251
|
-
</div>
|
|
252
|
-
);
|
|
253
|
-
}
|
|
@@ -1,258 +0,0 @@
|
|
|
1
|
-
import { IconCheck, IconChevronDown } from "@tabler/icons-react";
|
|
2
|
-
import type { Node as TiptapNode } from "@tiptap/core";
|
|
3
|
-
import { CodeBlockLowlight } from "@tiptap/extension-code-block-lowlight";
|
|
4
|
-
import {
|
|
5
|
-
NodeViewContent,
|
|
6
|
-
NodeViewWrapper,
|
|
7
|
-
ReactNodeViewRenderer,
|
|
8
|
-
type NodeViewProps,
|
|
9
|
-
} from "@tiptap/react";
|
|
10
|
-
import type { createLowlight } from "lowlight";
|
|
11
|
-
import { useMemo, useState } from "react";
|
|
12
|
-
|
|
13
|
-
import {
|
|
14
|
-
Popover,
|
|
15
|
-
PopoverContent,
|
|
16
|
-
PopoverTrigger,
|
|
17
|
-
} from "../components/ui/popover.js";
|
|
18
|
-
import { cn } from "../utils.js";
|
|
19
|
-
|
|
20
|
-
/**
|
|
21
|
-
* A selectable language for the code-block picker. `value === null` is the
|
|
22
|
-
* "Auto" sentinel: the block stores no language and the lowlight plugin
|
|
23
|
-
* auto-detects (biased toward the editor's registered, web-leaning grammar
|
|
24
|
-
* set). Keeping it first makes Auto the default, matching how plans skew toward
|
|
25
|
-
* JS/TS/JSON without the author having to choose.
|
|
26
|
-
*/
|
|
27
|
-
export interface CodeLanguageOption {
|
|
28
|
-
value: string | null;
|
|
29
|
-
label: string;
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
/** Default picker list — Auto first, then the web-leaning grammars plans use. */
|
|
33
|
-
export const DEFAULT_CODE_LANGUAGES: CodeLanguageOption[] = [
|
|
34
|
-
{ value: null, label: "Auto" },
|
|
35
|
-
{ value: "typescript", label: "TypeScript" },
|
|
36
|
-
{ value: "javascript", label: "JavaScript" },
|
|
37
|
-
{ value: "tsx", label: "TSX" },
|
|
38
|
-
{ value: "jsx", label: "JSX" },
|
|
39
|
-
{ value: "json", label: "JSON" },
|
|
40
|
-
{ value: "html", label: "HTML" },
|
|
41
|
-
{ value: "css", label: "CSS" },
|
|
42
|
-
{ value: "bash", label: "Bash" },
|
|
43
|
-
{ value: "python", label: "Python" },
|
|
44
|
-
{ value: "sql", label: "SQL" },
|
|
45
|
-
{ value: "yaml", label: "YAML" },
|
|
46
|
-
{ value: "markdown", label: "Markdown" },
|
|
47
|
-
{ value: "graphql", label: "GraphQL" },
|
|
48
|
-
{ value: "go", label: "Go" },
|
|
49
|
-
{ value: "rust", label: "Rust" },
|
|
50
|
-
{ value: "diff", label: "Diff" },
|
|
51
|
-
];
|
|
52
|
-
|
|
53
|
-
/** Class hooks so each app themes the shared node with its own palette. */
|
|
54
|
-
export interface CodeBlockClassNames {
|
|
55
|
-
wrapper: string;
|
|
56
|
-
header: string;
|
|
57
|
-
langButton: string;
|
|
58
|
-
langButtonReadonly: string;
|
|
59
|
-
picker: string;
|
|
60
|
-
search: string;
|
|
61
|
-
list: string;
|
|
62
|
-
option: string;
|
|
63
|
-
optionActive: string;
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
const DEFAULT_CLASS_NAMES: CodeBlockClassNames = {
|
|
67
|
-
wrapper: "an-code-block",
|
|
68
|
-
header: "an-code-block__header",
|
|
69
|
-
langButton: "an-code-block__lang",
|
|
70
|
-
langButtonReadonly: "an-code-block__lang--readonly",
|
|
71
|
-
picker: "an-code-block__picker",
|
|
72
|
-
search: "an-code-block__search",
|
|
73
|
-
list: "an-code-block__list",
|
|
74
|
-
option: "an-code-block__option",
|
|
75
|
-
optionActive: "is-active",
|
|
76
|
-
};
|
|
77
|
-
|
|
78
|
-
export interface CreateCodeBlockNodeOptions {
|
|
79
|
-
/** Lowlight instance backing syntax highlighting (same one the app registers). */
|
|
80
|
-
lowlight: ReturnType<typeof createLowlight>;
|
|
81
|
-
/** Picker languages. Defaults to {@link DEFAULT_CODE_LANGUAGES} (Auto first). */
|
|
82
|
-
languages?: CodeLanguageOption[];
|
|
83
|
-
/** Class hooks for per-app theming. Defaults to the shared `an-code-block__*`. */
|
|
84
|
-
classNames?: Partial<CodeBlockClassNames>;
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
function optionLabel(
|
|
88
|
-
language: string | null,
|
|
89
|
-
languages: CodeLanguageOption[],
|
|
90
|
-
): string {
|
|
91
|
-
if (!language) return languages[0]?.label ?? "Auto";
|
|
92
|
-
const match = languages.find((option) => option.value === language);
|
|
93
|
-
return match?.label ?? language;
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
interface CodeBlockNodeViewExtraOptions {
|
|
97
|
-
languagePickerOptions: CodeLanguageOption[];
|
|
98
|
-
codeBlockClassNames: CodeBlockClassNames;
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
function CodeBlockView({
|
|
102
|
-
node,
|
|
103
|
-
updateAttributes,
|
|
104
|
-
editor,
|
|
105
|
-
extension,
|
|
106
|
-
}: NodeViewProps) {
|
|
107
|
-
const options = extension.options as unknown as CodeBlockNodeViewExtraOptions;
|
|
108
|
-
const languages = options.languagePickerOptions;
|
|
109
|
-
const classNames = options.codeBlockClassNames;
|
|
110
|
-
|
|
111
|
-
const [open, setOpen] = useState(false);
|
|
112
|
-
const [filter, setFilter] = useState("");
|
|
113
|
-
const isEditable = editor.isEditable;
|
|
114
|
-
|
|
115
|
-
const current = (node.attrs.language as string | null) || null;
|
|
116
|
-
const label = optionLabel(current, languages);
|
|
117
|
-
|
|
118
|
-
const filtered = useMemo(() => {
|
|
119
|
-
const query = filter.trim().toLowerCase();
|
|
120
|
-
if (!query) return languages;
|
|
121
|
-
return languages.filter((option) =>
|
|
122
|
-
option.label.toLowerCase().includes(query),
|
|
123
|
-
);
|
|
124
|
-
}, [filter, languages]);
|
|
125
|
-
|
|
126
|
-
const select = (value: string | null) => {
|
|
127
|
-
// Store `""` for Auto so tiptap-markdown emits a bare fence (no language),
|
|
128
|
-
// matching the auto-detect read path.
|
|
129
|
-
updateAttributes({ language: value ?? "" });
|
|
130
|
-
setFilter("");
|
|
131
|
-
setOpen(false);
|
|
132
|
-
};
|
|
133
|
-
|
|
134
|
-
return (
|
|
135
|
-
<NodeViewWrapper className={classNames.wrapper}>
|
|
136
|
-
<div className={classNames.header} contentEditable={false}>
|
|
137
|
-
{isEditable ? (
|
|
138
|
-
<Popover
|
|
139
|
-
open={open}
|
|
140
|
-
onOpenChange={(next) => {
|
|
141
|
-
setOpen(next);
|
|
142
|
-
if (!next) setFilter("");
|
|
143
|
-
}}
|
|
144
|
-
>
|
|
145
|
-
<PopoverTrigger asChild>
|
|
146
|
-
<button type="button" className={classNames.langButton}>
|
|
147
|
-
{label}
|
|
148
|
-
<IconChevronDown className="size-3" />
|
|
149
|
-
</button>
|
|
150
|
-
</PopoverTrigger>
|
|
151
|
-
<PopoverContent align="start" side="bottom" className="w-52 p-0">
|
|
152
|
-
<input
|
|
153
|
-
autoFocus
|
|
154
|
-
type="text"
|
|
155
|
-
value={filter}
|
|
156
|
-
onChange={(event) => setFilter(event.target.value)}
|
|
157
|
-
onKeyDown={(event) => {
|
|
158
|
-
if (event.key === "Enter" && filtered.length > 0) {
|
|
159
|
-
event.preventDefault();
|
|
160
|
-
select(filtered[0].value);
|
|
161
|
-
}
|
|
162
|
-
}}
|
|
163
|
-
placeholder="Search languages…"
|
|
164
|
-
className={classNames.search}
|
|
165
|
-
/>
|
|
166
|
-
<div className={classNames.list}>
|
|
167
|
-
{filtered.map((option) => {
|
|
168
|
-
const active =
|
|
169
|
-
option.value === current || (!option.value && !current);
|
|
170
|
-
return (
|
|
171
|
-
<button
|
|
172
|
-
key={option.value ?? "auto"}
|
|
173
|
-
type="button"
|
|
174
|
-
className={cn(
|
|
175
|
-
classNames.option,
|
|
176
|
-
active && classNames.optionActive,
|
|
177
|
-
)}
|
|
178
|
-
onClick={() => select(option.value)}
|
|
179
|
-
>
|
|
180
|
-
{option.label}
|
|
181
|
-
{active && <IconCheck className="size-3.5" />}
|
|
182
|
-
</button>
|
|
183
|
-
);
|
|
184
|
-
})}
|
|
185
|
-
</div>
|
|
186
|
-
</PopoverContent>
|
|
187
|
-
</Popover>
|
|
188
|
-
) : (
|
|
189
|
-
label && (
|
|
190
|
-
<span
|
|
191
|
-
className={cn(
|
|
192
|
-
classNames.langButton,
|
|
193
|
-
classNames.langButtonReadonly,
|
|
194
|
-
)}
|
|
195
|
-
>
|
|
196
|
-
{label}
|
|
197
|
-
</span>
|
|
198
|
-
)
|
|
199
|
-
)}
|
|
200
|
-
</div>
|
|
201
|
-
<pre>
|
|
202
|
-
<NodeViewContent as={"code" as never} />
|
|
203
|
-
</pre>
|
|
204
|
-
</NodeViewWrapper>
|
|
205
|
-
);
|
|
206
|
-
}
|
|
207
|
-
|
|
208
|
-
/**
|
|
209
|
-
* The shared Notion-style code block: {@link CodeBlockLowlight} (so fenced
|
|
210
|
-
* markdown round-trips byte-identically — the node name and `language` attr are
|
|
211
|
-
* unchanged) plus a React node view that adds a language picker header instead
|
|
212
|
-
* of a bare highlighted `<pre>`. "Auto" stores no language and the lowlight
|
|
213
|
-
* plugin auto-detects.
|
|
214
|
-
*
|
|
215
|
-
* Lifted from the Content editor's bespoke code block so Plans (and any app
|
|
216
|
-
* opting into `features.codeBlock`) share one implementation. Theming is fully
|
|
217
|
-
* class-driven via {@link CreateCodeBlockNodeOptions.classNames}, so each app
|
|
218
|
-
* maps the hooks onto its own palette.
|
|
219
|
-
*/
|
|
220
|
-
export function createCodeBlockNode({
|
|
221
|
-
lowlight,
|
|
222
|
-
languages = DEFAULT_CODE_LANGUAGES,
|
|
223
|
-
classNames,
|
|
224
|
-
}: CreateCodeBlockNodeOptions): TiptapNode {
|
|
225
|
-
const resolvedClassNames: CodeBlockClassNames = {
|
|
226
|
-
...DEFAULT_CLASS_NAMES,
|
|
227
|
-
...(classNames ?? {}),
|
|
228
|
-
};
|
|
229
|
-
|
|
230
|
-
return CodeBlockLowlight.extend({
|
|
231
|
-
addOptions() {
|
|
232
|
-
return {
|
|
233
|
-
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
234
|
-
...this.parent!(),
|
|
235
|
-
languagePickerOptions: languages,
|
|
236
|
-
codeBlockClassNames: resolvedClassNames,
|
|
237
|
-
};
|
|
238
|
-
},
|
|
239
|
-
addNodeView() {
|
|
240
|
-
return ReactNodeViewRenderer(CodeBlockView);
|
|
241
|
-
},
|
|
242
|
-
addKeyboardShortcuts() {
|
|
243
|
-
return {
|
|
244
|
-
...this.parent?.(),
|
|
245
|
-
Tab: ({ editor }) => {
|
|
246
|
-
if (editor.isActive(this.name)) {
|
|
247
|
-
editor.commands.insertContent("\t");
|
|
248
|
-
return true;
|
|
249
|
-
}
|
|
250
|
-
return false;
|
|
251
|
-
},
|
|
252
|
-
};
|
|
253
|
-
},
|
|
254
|
-
}).configure({
|
|
255
|
-
lowlight,
|
|
256
|
-
defaultLanguage: null,
|
|
257
|
-
}) as unknown as TiptapNode;
|
|
258
|
-
}
|