@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,306 +0,0 @@
|
|
|
1
|
-
import Image, { type ImageOptions } from "@tiptap/extension-image";
|
|
2
|
-
import { Plugin, PluginKey } from "@tiptap/pm/state";
|
|
3
|
-
import type { EditorView } from "@tiptap/pm/view";
|
|
4
|
-
|
|
5
|
-
/**
|
|
6
|
-
* The injectable async upload contract for the shared image block.
|
|
7
|
-
*
|
|
8
|
-
* An app provides this to turn a picked / pasted / dropped {@link File} into a
|
|
9
|
-
* hosted image. It returns the final `src` (a hosted URL) plus an optional
|
|
10
|
-
* `alt`. Plans wire it to the framework `upload-image` action; Content keeps its
|
|
11
|
-
* own richer image block and does not use this contract.
|
|
12
|
-
*
|
|
13
|
-
* When NO upload function is supplied, the shared block still renders images and
|
|
14
|
-
* round-trips `` markdown — it just cannot ingest local files (paste
|
|
15
|
-
* of an image URL / markdown still works via the base node's input rules).
|
|
16
|
-
*/
|
|
17
|
-
export type ImageUploadFn = (
|
|
18
|
-
file: File,
|
|
19
|
-
) => Promise<{ src: string; alt?: string }>;
|
|
20
|
-
|
|
21
|
-
export interface SharedImageOptions extends ImageOptions {
|
|
22
|
-
/**
|
|
23
|
-
* App-injected uploader. When present, the shared block accepts pasted /
|
|
24
|
-
* dropped image files and the `/image` slash command, uploading each file
|
|
25
|
-
* through this function and patching the node's `src` on resolve.
|
|
26
|
-
*/
|
|
27
|
-
onImageUpload?: ImageUploadFn | null;
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
const sharedImageUploadPluginKey = new PluginKey("an-shared-image-upload");
|
|
31
|
-
|
|
32
|
-
/** A monotonically increasing id so concurrent uploads patch the right node. */
|
|
33
|
-
let uploadCounter = 0;
|
|
34
|
-
function nextUploadId(): string {
|
|
35
|
-
uploadCounter += 1;
|
|
36
|
-
return `an-img-${Date.now()}-${uploadCounter}`;
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
/** Image files only — never ingest non-image clipboard/drop payloads. */
|
|
40
|
-
function imageFilesFrom(data: DataTransfer | null | undefined): File[] {
|
|
41
|
-
if (!data) return [];
|
|
42
|
-
return Array.from(data.files ?? []).filter((file) =>
|
|
43
|
-
file.type.startsWith("image/"),
|
|
44
|
-
);
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
/**
|
|
48
|
-
* Insert a placeholder `image` node (empty `src`, transient `uploadId`) at
|
|
49
|
-
* `pos` for every file, then resolve each upload and patch the matching node's
|
|
50
|
-
* `src`. Mirrors Content's optimistic upload flow but is self-contained in the
|
|
51
|
-
* shared extension so it works for ANY editor wrapper (the plan's
|
|
52
|
-
* `SharedRichEditor` and Content's hand-rolled `useEditor` alike) without a new
|
|
53
|
-
* `editorProps` seam.
|
|
54
|
-
*/
|
|
55
|
-
function uploadAndInsertImages(
|
|
56
|
-
view: EditorView,
|
|
57
|
-
files: File[],
|
|
58
|
-
pos: number,
|
|
59
|
-
upload: ImageUploadFn,
|
|
60
|
-
): void {
|
|
61
|
-
if (files.length === 0) return;
|
|
62
|
-
|
|
63
|
-
const pending: Array<{ uploadId: string; file: File }> = [];
|
|
64
|
-
|
|
65
|
-
// Insert all placeholders first, top-down from `pos`, so multi-file
|
|
66
|
-
// paste/drop keeps source order.
|
|
67
|
-
let insertAt = pos;
|
|
68
|
-
for (const file of files) {
|
|
69
|
-
const uploadId = nextUploadId();
|
|
70
|
-
const node = view.state.schema.nodes.image?.create({
|
|
71
|
-
src: "",
|
|
72
|
-
alt: "",
|
|
73
|
-
uploadId,
|
|
74
|
-
});
|
|
75
|
-
if (!node) continue;
|
|
76
|
-
const tr = view.state.tr.insert(insertAt, node);
|
|
77
|
-
view.dispatch(tr);
|
|
78
|
-
pending.push({ uploadId, file });
|
|
79
|
-
// Advance past the inserted atom for the next placeholder.
|
|
80
|
-
insertAt += node.nodeSize;
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
for (const item of pending) {
|
|
84
|
-
void (async () => {
|
|
85
|
-
try {
|
|
86
|
-
const { src, alt } = await upload(item.file);
|
|
87
|
-
if (!view.dom.isConnected || view.isDestroyed) return;
|
|
88
|
-
patchUploadNode(view, item.uploadId, { src, alt: alt ?? "" });
|
|
89
|
-
} catch (error) {
|
|
90
|
-
console.error("Image upload failed:", error);
|
|
91
|
-
// Drop the placeholder so a failed upload does not leave an empty box.
|
|
92
|
-
if (view.dom.isConnected && !view.isDestroyed) {
|
|
93
|
-
removeUploadNode(view, item.uploadId);
|
|
94
|
-
}
|
|
95
|
-
}
|
|
96
|
-
})();
|
|
97
|
-
}
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
/** Find a placeholder node by its transient `uploadId` and return its position. */
|
|
101
|
-
function findUploadNode(
|
|
102
|
-
view: EditorView,
|
|
103
|
-
uploadId: string,
|
|
104
|
-
): { pos: number; nodeSize: number } | null {
|
|
105
|
-
let found: { pos: number; nodeSize: number } | null = null;
|
|
106
|
-
view.state.doc.descendants((node, pos) => {
|
|
107
|
-
if (found) return false;
|
|
108
|
-
if (node.type.name === "image" && node.attrs.uploadId === uploadId) {
|
|
109
|
-
found = { pos, nodeSize: node.nodeSize };
|
|
110
|
-
return false;
|
|
111
|
-
}
|
|
112
|
-
return true;
|
|
113
|
-
});
|
|
114
|
-
return found;
|
|
115
|
-
}
|
|
116
|
-
|
|
117
|
-
/** Patch the resolved `src`/`alt` onto the placeholder and clear `uploadId`. */
|
|
118
|
-
function patchUploadNode(
|
|
119
|
-
view: EditorView,
|
|
120
|
-
uploadId: string,
|
|
121
|
-
attrs: { src: string; alt: string },
|
|
122
|
-
): void {
|
|
123
|
-
const target = findUploadNode(view, uploadId);
|
|
124
|
-
if (!target) return;
|
|
125
|
-
const node = view.state.doc.nodeAt(target.pos);
|
|
126
|
-
if (!node) return;
|
|
127
|
-
const tr = view.state.tr.setNodeMarkup(target.pos, undefined, {
|
|
128
|
-
...node.attrs,
|
|
129
|
-
src: attrs.src,
|
|
130
|
-
alt: attrs.alt,
|
|
131
|
-
uploadId: null,
|
|
132
|
-
});
|
|
133
|
-
view.dispatch(tr);
|
|
134
|
-
}
|
|
135
|
-
|
|
136
|
-
/** Remove a placeholder whose upload failed. */
|
|
137
|
-
function removeUploadNode(view: EditorView, uploadId: string): void {
|
|
138
|
-
const target = findUploadNode(view, uploadId);
|
|
139
|
-
if (!target) return;
|
|
140
|
-
const tr = view.state.tr.delete(target.pos, target.pos + target.nodeSize);
|
|
141
|
-
view.dispatch(tr);
|
|
142
|
-
}
|
|
143
|
-
|
|
144
|
-
/**
|
|
145
|
-
* The SHARED block-level image node. Built on `@tiptap/extension-image` (a
|
|
146
|
-
* node named `image`), so:
|
|
147
|
-
*
|
|
148
|
-
* - **GFM serialization** emits pure `` markdown via a block-aware
|
|
149
|
-
* `addStorage().markdown.serialize` (it calls `closeBlock` so a block image
|
|
150
|
-
* keeps its blank-line separator, byte-stable). It emits NO `<img width>`
|
|
151
|
-
* HTML, so plans stay source-syncable under the GFM `html:false` contract.
|
|
152
|
-
* - **Paste / drop** of local image files is handled by a self-contained
|
|
153
|
-
* ProseMirror plugin that calls the injected {@link ImageUploadFn}. Pasting
|
|
154
|
-
* an image URL or `` markdown works through the base node's input
|
|
155
|
-
* rules even when no uploader is supplied.
|
|
156
|
-
*
|
|
157
|
-
* The node adds one transient `uploadId` attribute (never parsed/rendered to
|
|
158
|
-
* HTML, never serialized to markdown) used to track an in-flight upload.
|
|
159
|
-
*
|
|
160
|
-
* Content keeps its own richer `ImageNode` (Assets picker, AI alt-text, resize,
|
|
161
|
-
* NFM `{color}` serialization) and does NOT use this shared node — both nodes
|
|
162
|
-
* are named `image` but never coexist in the same editor because Content leaves
|
|
163
|
-
* `features.image` off and injects its own via `extraExtensions`.
|
|
164
|
-
*/
|
|
165
|
-
export const SharedImage = Image.extend<SharedImageOptions>({
|
|
166
|
-
// Block-level atom (Content's image is also a block atom). The base extension
|
|
167
|
-
// is block when `inline:false`.
|
|
168
|
-
inline: false,
|
|
169
|
-
group: "block",
|
|
170
|
-
|
|
171
|
-
addOptions() {
|
|
172
|
-
return {
|
|
173
|
-
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
174
|
-
...this.parent!(),
|
|
175
|
-
onImageUpload: null,
|
|
176
|
-
};
|
|
177
|
-
},
|
|
178
|
-
|
|
179
|
-
addAttributes() {
|
|
180
|
-
return {
|
|
181
|
-
...this.parent?.(),
|
|
182
|
-
// Transient: marks an in-flight upload so the plugin can patch `src` on
|
|
183
|
-
// resolve. Never written to HTML or markdown.
|
|
184
|
-
uploadId: {
|
|
185
|
-
default: null,
|
|
186
|
-
parseHTML: () => null,
|
|
187
|
-
renderHTML: () => ({}),
|
|
188
|
-
},
|
|
189
|
-
};
|
|
190
|
-
},
|
|
191
|
-
|
|
192
|
-
addStorage() {
|
|
193
|
-
return {
|
|
194
|
-
...this.parent?.(),
|
|
195
|
-
// A BLOCK-aware markdown serializer. tiptap-markdown's built-in fallback
|
|
196
|
-
// for the `image` node is prosemirror-markdown's INLINE image serializer,
|
|
197
|
-
// which omits the trailing block separator — so an image immediately
|
|
198
|
-
// followed by a paragraph loses its blank line on round-trip. This
|
|
199
|
-
// node-level spec (merged OVER the fallback by tiptap-markdown's
|
|
200
|
-
// `getMarkdownSpec`) emits the same pure `` markdown but calls
|
|
201
|
-
// `closeBlock`, so a block image stays byte-stable and source-syncable.
|
|
202
|
-
// No `<img width>` / HTML is emitted, so the GFM `html:false` contract and
|
|
203
|
-
// the plan round-trip corpus are preserved.
|
|
204
|
-
markdown: {
|
|
205
|
-
serialize(
|
|
206
|
-
state: {
|
|
207
|
-
esc: (s: string) => string;
|
|
208
|
-
write: (s: string) => void;
|
|
209
|
-
closeBlock: (n: unknown) => void;
|
|
210
|
-
},
|
|
211
|
-
node: { attrs: { src?: string; alt?: string; title?: string } },
|
|
212
|
-
) {
|
|
213
|
-
const src = node.attrs.src ?? "";
|
|
214
|
-
const alt = node.attrs.alt ?? "";
|
|
215
|
-
const title = node.attrs.title ?? "";
|
|
216
|
-
const titleSuffix = title ? ` "${title.replace(/"/g, '\\"')}"` : "";
|
|
217
|
-
state.write(`}${titleSuffix})`);
|
|
218
|
-
state.closeBlock(node);
|
|
219
|
-
},
|
|
220
|
-
parse: {
|
|
221
|
-
// Parsing `` is handled by markdown-it + the base node's
|
|
222
|
-
// markdown input rule.
|
|
223
|
-
},
|
|
224
|
-
},
|
|
225
|
-
};
|
|
226
|
-
},
|
|
227
|
-
|
|
228
|
-
addProseMirrorPlugins() {
|
|
229
|
-
const upload = this.options.onImageUpload;
|
|
230
|
-
const parentPlugins = this.parent?.() ?? [];
|
|
231
|
-
if (!upload) return parentPlugins;
|
|
232
|
-
|
|
233
|
-
return [
|
|
234
|
-
...parentPlugins,
|
|
235
|
-
new Plugin({
|
|
236
|
-
key: sharedImageUploadPluginKey,
|
|
237
|
-
props: {
|
|
238
|
-
handlePaste(view, event) {
|
|
239
|
-
const files = imageFilesFrom(event.clipboardData);
|
|
240
|
-
if (files.length === 0) return false;
|
|
241
|
-
event.preventDefault();
|
|
242
|
-
uploadAndInsertImages(
|
|
243
|
-
view,
|
|
244
|
-
files,
|
|
245
|
-
view.state.selection.from,
|
|
246
|
-
upload,
|
|
247
|
-
);
|
|
248
|
-
return true;
|
|
249
|
-
},
|
|
250
|
-
handleDrop(view, event) {
|
|
251
|
-
const files = imageFilesFrom(event.dataTransfer);
|
|
252
|
-
if (files.length === 0) return false;
|
|
253
|
-
event.preventDefault();
|
|
254
|
-
const coords = view.posAtCoords({
|
|
255
|
-
left: event.clientX,
|
|
256
|
-
top: event.clientY,
|
|
257
|
-
});
|
|
258
|
-
const pos = coords?.pos ?? view.state.selection.from;
|
|
259
|
-
uploadAndInsertImages(view, files, pos, upload);
|
|
260
|
-
return true;
|
|
261
|
-
},
|
|
262
|
-
},
|
|
263
|
-
}),
|
|
264
|
-
];
|
|
265
|
-
},
|
|
266
|
-
});
|
|
267
|
-
|
|
268
|
-
/**
|
|
269
|
-
* Build the shared image extension, optionally wired with an app uploader.
|
|
270
|
-
*
|
|
271
|
-
* @example
|
|
272
|
-
* createImageExtension({ onImageUpload: uploadEditorImage })
|
|
273
|
-
*/
|
|
274
|
-
export function createImageExtension(
|
|
275
|
-
options: { onImageUpload?: ImageUploadFn | null } = {},
|
|
276
|
-
) {
|
|
277
|
-
return SharedImage.configure({
|
|
278
|
-
onImageUpload: options.onImageUpload ?? null,
|
|
279
|
-
HTMLAttributes: { class: "an-rich-md-image" },
|
|
280
|
-
});
|
|
281
|
-
}
|
|
282
|
-
|
|
283
|
-
/**
|
|
284
|
-
* Open a native file picker, then upload + insert the chosen image(s) through
|
|
285
|
-
* the same flow as paste/drop. Used by the `/image` slash command.
|
|
286
|
-
*/
|
|
287
|
-
export function pickAndInsertImage(
|
|
288
|
-
view: EditorView,
|
|
289
|
-
upload: ImageUploadFn,
|
|
290
|
-
): void {
|
|
291
|
-
const input = document.createElement("input");
|
|
292
|
-
input.type = "file";
|
|
293
|
-
input.accept = "image/*";
|
|
294
|
-
input.multiple = true;
|
|
295
|
-
input.style.display = "none";
|
|
296
|
-
input.addEventListener("change", () => {
|
|
297
|
-
const files = Array.from(input.files ?? []).filter((file) =>
|
|
298
|
-
file.type.startsWith("image/"),
|
|
299
|
-
);
|
|
300
|
-
input.remove();
|
|
301
|
-
if (files.length === 0) return;
|
|
302
|
-
uploadAndInsertImages(view, files, view.state.selection.from, upload);
|
|
303
|
-
});
|
|
304
|
-
document.body.appendChild(input);
|
|
305
|
-
input.click();
|
|
306
|
-
}
|
|
@@ -1,80 +0,0 @@
|
|
|
1
|
-
import type { Awareness } from "y-protocols/awareness";
|
|
2
|
-
import type { Doc as YDoc } from "yjs";
|
|
3
|
-
|
|
4
|
-
/**
|
|
5
|
-
* Back-compat surface for the shared rich markdown editor.
|
|
6
|
-
*
|
|
7
|
-
* The editor core now lives in dedicated modules:
|
|
8
|
-
* - {@link createSharedEditorExtensions} — the ONE extension factory.
|
|
9
|
-
* - {@link useCollabReconcile} — seed / reconcile / lead-client logic.
|
|
10
|
-
* - {@link SlashCommandMenu} / {@link BubbleToolbar} — shared menus.
|
|
11
|
-
* - {@link SharedRichEditor} — the editor component.
|
|
12
|
-
*
|
|
13
|
-
* This file keeps the historical `RichMarkdownEditor` component name (aliased to
|
|
14
|
-
* {@link SharedRichEditor}) and the `createRichMarkdownExtensions` factory so
|
|
15
|
-
* existing embedders and the round-trip / collab specs keep working unchanged.
|
|
16
|
-
*/
|
|
17
|
-
import {
|
|
18
|
-
createSharedEditorExtensions,
|
|
19
|
-
type RichMarkdownDialect,
|
|
20
|
-
type RichMarkdownEditorPreset,
|
|
21
|
-
type RichMarkdownCollabUser,
|
|
22
|
-
} from "./extensions.js";
|
|
23
|
-
import {
|
|
24
|
-
SharedRichEditor,
|
|
25
|
-
type SharedRichEditorProps,
|
|
26
|
-
} from "./SharedRichEditor.js";
|
|
27
|
-
|
|
28
|
-
export type {
|
|
29
|
-
RichMarkdownDialect,
|
|
30
|
-
RichMarkdownEditorPreset,
|
|
31
|
-
RichMarkdownCollabUser,
|
|
32
|
-
};
|
|
33
|
-
|
|
34
|
-
/** @deprecated Prefer {@link CreateSharedEditorExtensionsOptions}. */
|
|
35
|
-
export interface CreateRichMarkdownExtensionsOptions {
|
|
36
|
-
dialect?: RichMarkdownDialect;
|
|
37
|
-
placeholder?: string;
|
|
38
|
-
/**
|
|
39
|
-
* Yjs document for collaborative editing. When present, the editor binds the
|
|
40
|
-
* shared Collaboration + CollaborationCaret extensions and StarterKit's
|
|
41
|
-
* built-in undo/redo is disabled (Yjs owns history).
|
|
42
|
-
*/
|
|
43
|
-
ydoc?: YDoc | null;
|
|
44
|
-
/** Shared awareness instance for live multi-user cursors. */
|
|
45
|
-
awareness?: Awareness | null;
|
|
46
|
-
/** Current user info for the collaborative cursor label. */
|
|
47
|
-
user?: RichMarkdownCollabUser | null;
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
/**
|
|
51
|
-
* Back-compat factory preserving today's GFM/plan behavior EXACTLY. Implemented
|
|
52
|
-
* in terms of {@link createSharedEditorExtensions}: it maps the flat
|
|
53
|
-
* `{ ydoc, awareness, user }` collab options into the nested `collab` shape the
|
|
54
|
-
* shared factory expects. The round-trip and collab specs build their `Editor`
|
|
55
|
-
* from this, so its output must stay byte-stable.
|
|
56
|
-
*/
|
|
57
|
-
export function createRichMarkdownExtensions({
|
|
58
|
-
dialect = "gfm",
|
|
59
|
-
placeholder = "Type '/' for commands...",
|
|
60
|
-
ydoc = null,
|
|
61
|
-
awareness = null,
|
|
62
|
-
user = null,
|
|
63
|
-
}: CreateRichMarkdownExtensionsOptions = {}) {
|
|
64
|
-
return createSharedEditorExtensions({
|
|
65
|
-
dialect,
|
|
66
|
-
placeholder,
|
|
67
|
-
collab: ydoc ? { ydoc, awareness, user } : null,
|
|
68
|
-
});
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
/** @deprecated Prefer {@link SharedRichEditorProps}. */
|
|
72
|
-
export type RichMarkdownEditorProps = SharedRichEditorProps;
|
|
73
|
-
|
|
74
|
-
/**
|
|
75
|
-
* Historical name for {@link SharedRichEditor}. Kept so existing imports
|
|
76
|
-
* (`import { RichMarkdownEditor } from "@agent-native/core/client"`) and the
|
|
77
|
-
* plan editor tests (which assert the source mentions `RichMarkdownEditor`)
|
|
78
|
-
* keep working. New code should import `SharedRichEditor`.
|
|
79
|
-
*/
|
|
80
|
-
export const RichMarkdownEditor = SharedRichEditor;
|
|
@@ -1,61 +0,0 @@
|
|
|
1
|
-
import { Extension } from "@tiptap/core";
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* Node types that carry the optional `runId` attribute.
|
|
5
|
-
*
|
|
6
|
-
* These are exactly the top-level block nodes a plan's `rich-text` block can
|
|
7
|
-
* serialize to. The plan's `doc ↔ blocks[]` bridge stamps `runId` onto the
|
|
8
|
-
* FIRST node of each rich-text run so a re-parse can map the run back to its
|
|
9
|
-
* originating block id (stable ids across edits). Atom/structured blocks live
|
|
10
|
-
* in their own `planBlock` node and do not need this attribute.
|
|
11
|
-
*/
|
|
12
|
-
export const RUN_ID_NODE_TYPES = [
|
|
13
|
-
"paragraph",
|
|
14
|
-
"heading",
|
|
15
|
-
"bulletList",
|
|
16
|
-
"orderedList",
|
|
17
|
-
"taskList",
|
|
18
|
-
"blockquote",
|
|
19
|
-
"codeBlock",
|
|
20
|
-
] as const;
|
|
21
|
-
|
|
22
|
-
/**
|
|
23
|
-
* Tiptap extension that adds a GLOBAL `runId` attribute (default `null`) to the
|
|
24
|
-
* block node types in {@link RUN_ID_NODE_TYPES}.
|
|
25
|
-
*
|
|
26
|
-
* - `renderHTML` emits `data-run-id` only when the attribute is set, so the
|
|
27
|
-
* live editor's DOM carries the id for the doc↔blocks bridge.
|
|
28
|
-
* - `parseHTML` reads `data-run-id` back so a paste / re-parse preserves it.
|
|
29
|
-
* - Markdown serialization deliberately IGNORES `runId`: GFM never emits it.
|
|
30
|
-
* `tiptap-markdown` drops attributes it has no serializer for, so we simply
|
|
31
|
-
* don't register a markdown serializer here — the attribute is invisible to
|
|
32
|
-
* the GFM round-trip and only lives in the ProseMirror JSON / DOM.
|
|
33
|
-
*
|
|
34
|
-
* Used by BOTH the headless `gfmDoc` editor and the live plan editor so the
|
|
35
|
-
* schema is identical on both sides of the bridge.
|
|
36
|
-
*/
|
|
37
|
-
export const RunId = Extension.create({
|
|
38
|
-
name: "runId",
|
|
39
|
-
|
|
40
|
-
addGlobalAttributes() {
|
|
41
|
-
return [
|
|
42
|
-
{
|
|
43
|
-
types: [...RUN_ID_NODE_TYPES],
|
|
44
|
-
attributes: {
|
|
45
|
-
runId: {
|
|
46
|
-
default: null,
|
|
47
|
-
// Read the id off the rendered DOM so paste / re-parse round-trips.
|
|
48
|
-
parseHTML: (element) => element.getAttribute("data-run-id"),
|
|
49
|
-
// Only emit the attribute when set; an unset (null) runId adds
|
|
50
|
-
// nothing to the DOM so untouched nodes stay clean.
|
|
51
|
-
renderHTML: (attributes) => {
|
|
52
|
-
const runId = (attributes as { runId?: string | null }).runId;
|
|
53
|
-
if (!runId) return {};
|
|
54
|
-
return { "data-run-id": runId };
|
|
55
|
-
},
|
|
56
|
-
},
|
|
57
|
-
},
|
|
58
|
-
},
|
|
59
|
-
];
|
|
60
|
-
},
|
|
61
|
-
});
|