@dxos/plugin-markdown 0.8.4-main.c4373fc → 0.8.4-main.c85a9c8dae
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/dist/lib/browser/MarkdownCard-5NPSEJ2M.mjs +61 -0
- package/dist/lib/browser/MarkdownCard-5NPSEJ2M.mjs.map +7 -0
- package/dist/lib/browser/MarkdownContainer-KER2N5M2.mjs +108 -0
- package/dist/lib/browser/MarkdownContainer-KER2N5M2.mjs.map +7 -0
- package/dist/lib/browser/MarkdownSettings-2N4TT2FG.mjs +106 -0
- package/dist/lib/browser/MarkdownSettings-2N4TT2FG.mjs.map +7 -0
- package/dist/lib/browser/anchor-sort-EHJGOCYW.mjs +34 -0
- package/dist/lib/browser/anchor-sort-EHJGOCYW.mjs.map +7 -0
- package/dist/lib/browser/app-graph-serializer-QBZDVASK.mjs +60 -0
- package/dist/lib/browser/app-graph-serializer-QBZDVASK.mjs.map +7 -0
- package/dist/lib/browser/blueprint-definition-ASGDSKKE.mjs +18 -0
- package/dist/lib/browser/blueprint-definition-ASGDSKKE.mjs.map +7 -0
- package/dist/lib/browser/blueprints/index.mjs +9 -0
- package/dist/lib/browser/chunk-7JEOX3X6.mjs +783 -0
- package/dist/lib/browser/chunk-7JEOX3X6.mjs.map +7 -0
- package/dist/lib/browser/chunk-HK6EGNP5.mjs +8 -0
- package/dist/lib/browser/chunk-HK6EGNP5.mjs.map +7 -0
- package/dist/lib/browser/chunk-P3TN2W6M.mjs +154 -0
- package/dist/lib/browser/chunk-P3TN2W6M.mjs.map +7 -0
- package/dist/lib/browser/{chunk-NGXGBWSS.mjs → chunk-RJO5W5YX.mjs} +12 -6
- package/dist/lib/browser/chunk-RJO5W5YX.mjs.map +7 -0
- package/dist/lib/browser/chunk-W24NJ6WB.mjs +178 -0
- package/dist/lib/browser/chunk-W24NJ6WB.mjs.map +7 -0
- package/dist/lib/browser/{chunk-ODB2PTBP.mjs → chunk-YBMRREXE.mjs} +4 -4
- package/dist/lib/browser/chunk-YBMRREXE.mjs.map +7 -0
- package/dist/lib/browser/cli/index.mjs +35 -0
- package/dist/lib/browser/cli/index.mjs.map +7 -0
- package/dist/lib/browser/index.mjs +127 -143
- package/dist/lib/browser/index.mjs.map +4 -4
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/operation-resolver-3KOXJM7P.mjs +54 -0
- package/dist/lib/browser/operation-resolver-3KOXJM7P.mjs.map +7 -0
- package/dist/lib/browser/react-surface-WU4VTE43.mjs +115 -0
- package/dist/lib/browser/react-surface-WU4VTE43.mjs.map +7 -0
- package/dist/lib/browser/settings-7FMWKB7N.mjs +38 -0
- package/dist/lib/browser/settings-7FMWKB7N.mjs.map +7 -0
- package/dist/lib/browser/state-7UJKJDGE.mjs +31 -0
- package/dist/lib/browser/state-7UJKJDGE.mjs.map +7 -0
- package/dist/lib/browser/types/index.mjs +11 -3
- package/dist/lib/node-esm/MarkdownCard-4MXS7AQR.mjs +62 -0
- package/dist/lib/node-esm/MarkdownCard-4MXS7AQR.mjs.map +7 -0
- package/dist/lib/node-esm/MarkdownContainer-BZ637MS3.mjs +109 -0
- package/dist/lib/node-esm/MarkdownContainer-BZ637MS3.mjs.map +7 -0
- package/dist/lib/node-esm/MarkdownSettings-FQTYCTD7.mjs +107 -0
- package/dist/lib/node-esm/MarkdownSettings-FQTYCTD7.mjs.map +7 -0
- package/dist/lib/node-esm/anchor-sort-QWZO6B2R.mjs +35 -0
- package/dist/lib/node-esm/anchor-sort-QWZO6B2R.mjs.map +7 -0
- package/dist/lib/node-esm/app-graph-serializer-3UVXEHJG.mjs +61 -0
- package/dist/lib/node-esm/app-graph-serializer-3UVXEHJG.mjs.map +7 -0
- package/dist/lib/node-esm/blueprint-definition-TG7OZIWW.mjs +19 -0
- package/dist/lib/node-esm/blueprint-definition-TG7OZIWW.mjs.map +7 -0
- package/dist/lib/node-esm/blueprints/index.mjs +10 -0
- package/dist/lib/node-esm/{chunk-YGSNWTGP.mjs → chunk-ANIFP6M2.mjs} +12 -6
- package/dist/lib/node-esm/chunk-ANIFP6M2.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-KCH3EL53.mjs +10 -0
- package/dist/lib/node-esm/chunk-KCH3EL53.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-N73JZ4CD.mjs +784 -0
- package/dist/lib/node-esm/chunk-N73JZ4CD.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-NBGAJPVH.mjs +179 -0
- package/dist/lib/node-esm/chunk-NBGAJPVH.mjs.map +7 -0
- package/dist/lib/node-esm/{chunk-VCG2U522.mjs → chunk-W7AM4HCG.mjs} +4 -4
- package/dist/lib/node-esm/chunk-W7AM4HCG.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-WBZQ246U.mjs +155 -0
- package/dist/lib/node-esm/chunk-WBZQ246U.mjs.map +7 -0
- package/dist/lib/node-esm/cli/index.mjs +36 -0
- package/dist/lib/node-esm/cli/index.mjs.map +7 -0
- package/dist/lib/node-esm/index.mjs +127 -143
- package/dist/lib/node-esm/index.mjs.map +4 -4
- package/dist/lib/node-esm/meta.json +1 -1
- package/dist/lib/node-esm/operation-resolver-2MEWKRFP.mjs +55 -0
- package/dist/lib/node-esm/operation-resolver-2MEWKRFP.mjs.map +7 -0
- package/dist/lib/node-esm/react-surface-LC5CI6VP.mjs +116 -0
- package/dist/lib/node-esm/react-surface-LC5CI6VP.mjs.map +7 -0
- package/dist/lib/node-esm/settings-DBK2SPWT.mjs +39 -0
- package/dist/lib/node-esm/settings-DBK2SPWT.mjs.map +7 -0
- package/dist/lib/node-esm/state-EEPLRAOT.mjs +32 -0
- package/dist/lib/node-esm/state-EEPLRAOT.mjs.map +7 -0
- package/dist/lib/node-esm/types/index.mjs +11 -3
- package/dist/types/src/MarkdownPlugin.d.ts +2 -1
- package/dist/types/src/MarkdownPlugin.d.ts.map +1 -1
- package/dist/types/src/{functions/open.d.ts → blueprints/functions/create.d.ts} +5 -4
- package/dist/types/src/blueprints/functions/create.d.ts.map +1 -0
- package/dist/types/src/blueprints/functions/create.test.d.ts +2 -0
- package/dist/types/src/blueprints/functions/create.test.d.ts.map +1 -0
- package/dist/types/src/blueprints/functions/index.d.ts +42 -0
- package/dist/types/src/blueprints/functions/index.d.ts.map +1 -0
- package/dist/types/src/blueprints/functions/open.d.ts +14 -0
- package/dist/types/src/blueprints/functions/open.d.ts.map +1 -0
- package/dist/types/src/blueprints/functions/update.d.ts +19 -0
- package/dist/types/src/blueprints/functions/update.d.ts.map +1 -0
- package/dist/types/src/blueprints/functions/update.test.d.ts +2 -0
- package/dist/types/src/blueprints/functions/update.test.d.ts.map +1 -0
- package/dist/types/src/blueprints/index.d.ts +2 -0
- package/dist/types/src/blueprints/index.d.ts.map +1 -0
- package/dist/types/src/blueprints/markdown-blueprint.d.ts +4 -0
- package/dist/types/src/blueprints/markdown-blueprint.d.ts.map +1 -0
- package/dist/types/src/capabilities/anchor-sort/anchor-sort.d.ts +6 -0
- package/dist/types/src/capabilities/anchor-sort/anchor-sort.d.ts.map +1 -0
- package/dist/types/src/capabilities/anchor-sort/index.d.ts +3 -0
- package/dist/types/src/capabilities/anchor-sort/index.d.ts.map +1 -0
- package/dist/types/src/capabilities/app-graph-serializer/app-graph-serializer.d.ts +5 -0
- package/dist/types/src/capabilities/app-graph-serializer/app-graph-serializer.d.ts.map +1 -0
- package/dist/types/src/capabilities/app-graph-serializer/index.d.ts +3 -0
- package/dist/types/src/capabilities/app-graph-serializer/index.d.ts.map +1 -0
- package/dist/types/src/capabilities/artifact-definition/artifact-definition.d.ts +5 -0
- package/dist/types/src/capabilities/artifact-definition/artifact-definition.d.ts.map +1 -0
- package/dist/types/src/capabilities/artifact-definition/index.d.ts +3 -0
- package/dist/types/src/capabilities/artifact-definition/index.d.ts.map +1 -0
- package/dist/types/src/capabilities/blueprint-definition/blueprint-definition.d.ts +6 -0
- package/dist/types/src/capabilities/blueprint-definition/blueprint-definition.d.ts.map +1 -0
- package/dist/types/src/capabilities/blueprint-definition/index.d.ts +3 -0
- package/dist/types/src/capabilities/blueprint-definition/index.d.ts.map +1 -0
- package/dist/types/src/capabilities/index.d.ts +6 -17
- package/dist/types/src/capabilities/index.d.ts.map +1 -1
- package/dist/types/src/capabilities/operation-resolver/index.d.ts +3 -0
- package/dist/types/src/capabilities/operation-resolver/index.d.ts.map +1 -0
- package/dist/types/src/capabilities/operation-resolver/operation-resolver.d.ts +5 -0
- package/dist/types/src/capabilities/operation-resolver/operation-resolver.d.ts.map +1 -0
- package/dist/types/src/capabilities/react-surface/index.d.ts +3 -0
- package/dist/types/src/capabilities/react-surface/index.d.ts.map +1 -0
- package/dist/types/src/capabilities/react-surface/react-surface.d.ts +5 -0
- package/dist/types/src/capabilities/react-surface/react-surface.d.ts.map +1 -0
- package/dist/types/src/capabilities/settings/index.d.ts +3 -0
- package/dist/types/src/capabilities/settings/index.d.ts.map +1 -0
- package/dist/types/src/capabilities/settings/settings.d.ts +7 -0
- package/dist/types/src/capabilities/settings/settings.d.ts.map +1 -0
- package/dist/types/src/capabilities/state/index.d.ts +3 -0
- package/dist/types/src/capabilities/state/index.d.ts.map +1 -0
- package/dist/types/src/capabilities/state/state.d.ts +5 -0
- package/dist/types/src/capabilities/state/state.d.ts.map +1 -0
- package/dist/types/src/cli/index.d.ts +2 -0
- package/dist/types/src/cli/index.d.ts.map +1 -0
- package/dist/types/src/cli/plugin.d.ts +3 -0
- package/dist/types/src/cli/plugin.d.ts.map +1 -0
- package/dist/types/src/components/MarkdownEditor/FileUpload.d.ts +11 -0
- package/dist/types/src/components/MarkdownEditor/FileUpload.d.ts.map +1 -0
- package/dist/types/src/components/MarkdownEditor/MarkdownEditor.d.ts +43 -23
- package/dist/types/src/components/MarkdownEditor/MarkdownEditor.d.ts.map +1 -1
- package/dist/types/src/components/MarkdownEditor/MarkdownEditor.stories.d.ts +5 -110
- package/dist/types/src/components/MarkdownEditor/MarkdownEditor.stories.d.ts.map +1 -1
- package/dist/types/src/components/MarkdownEditor/MarkdownEditorContent.d.ts +30 -0
- package/dist/types/src/components/MarkdownEditor/MarkdownEditorContent.d.ts.map +1 -0
- package/dist/types/src/components/MarkdownEditor/MarkdownEditorToolbar.d.ts +12 -0
- package/dist/types/src/components/MarkdownEditor/MarkdownEditorToolbar.d.ts.map +1 -0
- package/dist/types/src/components/index.d.ts +1 -3
- package/dist/types/src/components/index.d.ts.map +1 -1
- package/dist/types/src/containers/MarkdownCard/MarkdownCard.d.ts +8 -0
- package/dist/types/src/containers/MarkdownCard/MarkdownCard.d.ts.map +1 -0
- package/dist/types/src/containers/MarkdownCard/MarkdownCard.stories.d.ts +9 -0
- package/dist/types/src/containers/MarkdownCard/MarkdownCard.stories.d.ts.map +1 -0
- package/dist/types/src/{components → containers}/MarkdownCard/index.d.ts +0 -1
- package/dist/types/src/containers/MarkdownCard/index.d.ts.map +1 -0
- package/dist/types/src/containers/MarkdownContainer/MarkdownContainer.d.ts +27 -0
- package/dist/types/src/containers/MarkdownContainer/MarkdownContainer.d.ts.map +1 -0
- package/dist/types/src/{components → containers/MarkdownContainer}/MarkdownContainer.stories.d.ts +34 -1
- package/dist/types/src/containers/MarkdownContainer/MarkdownContainer.stories.d.ts.map +1 -0
- package/dist/types/src/containers/MarkdownContainer/index.d.ts +3 -0
- package/dist/types/src/containers/MarkdownContainer/index.d.ts.map +1 -0
- package/dist/types/src/containers/MarkdownSettings/MarkdownSettings.d.ts +8 -0
- package/dist/types/src/containers/MarkdownSettings/MarkdownSettings.d.ts.map +1 -0
- package/dist/types/src/containers/MarkdownSettings/index.d.ts +3 -0
- package/dist/types/src/containers/MarkdownSettings/index.d.ts.map +1 -0
- package/dist/types/src/containers/index.d.ts +6 -0
- package/dist/types/src/containers/index.d.ts.map +1 -0
- package/dist/types/src/hooks/index.d.ts +3 -0
- package/dist/types/src/hooks/index.d.ts.map +1 -1
- package/dist/types/src/hooks/useEditorMenuOptions.d.ts +9 -0
- package/dist/types/src/hooks/useEditorMenuOptions.d.ts.map +1 -0
- package/dist/types/src/hooks/useExtensions.d.ts +21 -0
- package/dist/types/src/hooks/useExtensions.d.ts.map +1 -0
- package/dist/types/src/hooks/useLinkQuery.d.ts +4 -0
- package/dist/types/src/hooks/useLinkQuery.d.ts.map +1 -0
- package/dist/types/src/hooks/useSelectCurrentThread.d.ts.map +1 -1
- package/dist/types/src/index.d.ts +2 -2
- package/dist/types/src/index.d.ts.map +1 -1
- package/dist/types/src/meta.d.ts +2 -2
- package/dist/types/src/meta.d.ts.map +1 -1
- package/dist/types/src/testing.d.ts +6 -0
- package/dist/types/src/testing.d.ts.map +1 -0
- package/dist/types/src/translations.d.ts +33 -0
- package/dist/types/src/translations.d.ts.map +1 -1
- package/dist/types/src/types/Markdown.d.ts +16 -14
- package/dist/types/src/types/Markdown.d.ts.map +1 -1
- package/dist/types/src/types/MarkdownAction.d.ts +63 -30
- package/dist/types/src/types/MarkdownAction.d.ts.map +1 -1
- package/dist/types/src/types/capabilities.d.ts +22 -0
- package/dist/types/src/types/capabilities.d.ts.map +1 -0
- package/dist/types/src/types/events.d.ts +5 -0
- package/dist/types/src/types/events.d.ts.map +1 -0
- package/dist/types/src/types/index.d.ts +3 -0
- package/dist/types/src/types/index.d.ts.map +1 -1
- package/dist/types/src/types/types.d.ts +2 -2
- package/dist/types/src/types/types.d.ts.map +1 -1
- package/dist/types/src/util.d.ts +6 -3
- package/dist/types/src/util.d.ts.map +1 -1
- package/dist/types/src/util.test.d.ts +2 -0
- package/dist/types/src/util.test.d.ts.map +1 -0
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +95 -57
- package/src/MarkdownPlugin.tsx +65 -94
- package/src/blueprints/functions/create.conversations.json +1 -0
- package/src/blueprints/functions/create.test.ts +92 -0
- package/src/blueprints/functions/create.ts +35 -0
- package/src/blueprints/functions/index.ts +15 -0
- package/src/{functions → blueprints/functions}/open.ts +11 -10
- package/src/blueprints/functions/update.conversations.json +1 -0
- package/src/blueprints/functions/update.test.ts +215 -0
- package/src/blueprints/functions/update.ts +79 -0
- package/src/blueprints/index.ts +5 -0
- package/src/blueprints/markdown-blueprint.ts +46 -0
- package/src/capabilities/anchor-sort/anchor-sort.ts +37 -0
- package/src/capabilities/anchor-sort/index.ts +7 -0
- package/src/capabilities/app-graph-serializer/app-graph-serializer.ts +60 -0
- package/src/capabilities/app-graph-serializer/index.ts +7 -0
- package/src/capabilities/artifact-definition/artifact-definition.ts +110 -0
- package/src/capabilities/artifact-definition/index.ts +7 -0
- package/src/capabilities/blueprint-definition/blueprint-definition.ts +17 -0
- package/src/capabilities/blueprint-definition/index.ts +7 -0
- package/src/capabilities/index.ts +6 -12
- package/src/capabilities/operation-resolver/index.ts +7 -0
- package/src/capabilities/operation-resolver/operation-resolver.ts +45 -0
- package/src/capabilities/react-surface/index.ts +7 -0
- package/src/capabilities/react-surface/react-surface.tsx +102 -0
- package/src/capabilities/settings/index.ts +7 -0
- package/src/capabilities/settings/settings.ts +37 -0
- package/src/capabilities/state/index.ts +7 -0
- package/src/capabilities/state/state.ts +31 -0
- package/src/cli/index.ts +5 -0
- package/src/cli/plugin.ts +30 -0
- package/src/components/MarkdownEditor/FileUpload.tsx +63 -0
- package/src/components/MarkdownEditor/MarkdownEditor.stories.tsx +59 -39
- package/src/components/MarkdownEditor/MarkdownEditor.tsx +235 -271
- package/src/components/MarkdownEditor/MarkdownEditorContent.tsx +161 -0
- package/src/components/MarkdownEditor/MarkdownEditorToolbar.tsx +67 -0
- package/src/components/index.ts +2 -7
- package/src/containers/MarkdownCard/MarkdownCard.stories.tsx +68 -0
- package/src/containers/MarkdownCard/MarkdownCard.tsx +61 -0
- package/src/{components → containers}/MarkdownCard/index.ts +0 -2
- package/src/containers/MarkdownContainer/MarkdownContainer.stories.tsx +136 -0
- package/src/containers/MarkdownContainer/MarkdownContainer.tsx +114 -0
- package/src/containers/MarkdownContainer/index.ts +7 -0
- package/src/containers/MarkdownSettings/MarkdownSettings.tsx +122 -0
- package/src/containers/MarkdownSettings/index.ts +7 -0
- package/src/containers/index.ts +11 -0
- package/src/hooks/index.ts +3 -0
- package/src/hooks/useEditorMenuOptions.ts +68 -0
- package/src/hooks/useExtensions.tsx +245 -0
- package/src/hooks/useLinkQuery.ts +83 -0
- package/src/hooks/useSelectCurrentThread.tsx +37 -32
- package/src/index.ts +3 -2
- package/src/meta.ts +5 -5
- package/src/testing.ts +27 -0
- package/src/translations.ts +6 -0
- package/src/types/Markdown.ts +20 -11
- package/src/types/MarkdownAction.ts +48 -18
- package/src/types/capabilities.ts +38 -0
- package/src/types/events.ts +14 -0
- package/src/types/index.ts +4 -0
- package/src/types/types.ts +3 -2
- package/src/util.test.ts +44 -0
- package/src/util.tsx +82 -7
- package/dist/lib/browser/MarkdownCard-ZHTH6EVA.mjs +0 -80
- package/dist/lib/browser/MarkdownCard-ZHTH6EVA.mjs.map +0 -7
- package/dist/lib/browser/MarkdownContainer-XDYFBDCI.mjs +0 -750
- package/dist/lib/browser/MarkdownContainer-XDYFBDCI.mjs.map +0 -7
- package/dist/lib/browser/anchor-sort-53E7TJGF.mjs +0 -32
- package/dist/lib/browser/anchor-sort-53E7TJGF.mjs.map +0 -7
- package/dist/lib/browser/app-graph-serializer-IEPNJZBR.mjs +0 -51
- package/dist/lib/browser/app-graph-serializer-IEPNJZBR.mjs.map +0 -7
- package/dist/lib/browser/blueprint-definition-XDLVVSUN.mjs +0 -11
- package/dist/lib/browser/chunk-EVQGTH3P.mjs +0 -22
- package/dist/lib/browser/chunk-EVQGTH3P.mjs.map +0 -7
- package/dist/lib/browser/chunk-NGXGBWSS.mjs.map +0 -7
- package/dist/lib/browser/chunk-ODB2PTBP.mjs.map +0 -7
- package/dist/lib/browser/chunk-OY6CGPOO.mjs +0 -16
- package/dist/lib/browser/chunk-OY6CGPOO.mjs.map +0 -7
- package/dist/lib/browser/chunk-PMBWHKDI.mjs +0 -78
- package/dist/lib/browser/chunk-PMBWHKDI.mjs.map +0 -7
- package/dist/lib/browser/chunk-VZU7BRGW.mjs +0 -106
- package/dist/lib/browser/chunk-VZU7BRGW.mjs.map +0 -7
- package/dist/lib/browser/chunk-XYQDM6PM.mjs +0 -50
- package/dist/lib/browser/chunk-XYQDM6PM.mjs.map +0 -7
- package/dist/lib/browser/intent-resolver-66ZUQ6JC.mjs +0 -62
- package/dist/lib/browser/intent-resolver-66ZUQ6JC.mjs.map +0 -7
- package/dist/lib/browser/react-surface-ONX5RNFM.mjs +0 -215
- package/dist/lib/browser/react-surface-ONX5RNFM.mjs.map +0 -7
- package/dist/lib/browser/settings-HXM36BCZ.mjs +0 -28
- package/dist/lib/browser/settings-HXM36BCZ.mjs.map +0 -7
- package/dist/lib/browser/state-6QODXCSZ.mjs +0 -37
- package/dist/lib/browser/state-6QODXCSZ.mjs.map +0 -7
- package/dist/lib/browser/toolkit-73U3A7SD.mjs +0 -76
- package/dist/lib/browser/toolkit-73U3A7SD.mjs.map +0 -7
- package/dist/lib/node-esm/MarkdownCard-MEA4QAAI.mjs +0 -81
- package/dist/lib/node-esm/MarkdownCard-MEA4QAAI.mjs.map +0 -7
- package/dist/lib/node-esm/MarkdownContainer-7GYMOJVT.mjs +0 -751
- package/dist/lib/node-esm/MarkdownContainer-7GYMOJVT.mjs.map +0 -7
- package/dist/lib/node-esm/anchor-sort-V2FWEYDN.mjs +0 -33
- package/dist/lib/node-esm/anchor-sort-V2FWEYDN.mjs.map +0 -7
- package/dist/lib/node-esm/app-graph-serializer-HIN4NMUG.mjs +0 -52
- package/dist/lib/node-esm/app-graph-serializer-HIN4NMUG.mjs.map +0 -7
- package/dist/lib/node-esm/blueprint-definition-PDXZ67UQ.mjs +0 -12
- package/dist/lib/node-esm/chunk-35WAARP4.mjs +0 -79
- package/dist/lib/node-esm/chunk-35WAARP4.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-CB2R4YIY.mjs +0 -17
- package/dist/lib/node-esm/chunk-CB2R4YIY.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-IOC54NCF.mjs +0 -51
- package/dist/lib/node-esm/chunk-IOC54NCF.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-VCG2U522.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-VELFUWUH.mjs +0 -107
- package/dist/lib/node-esm/chunk-VELFUWUH.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-W4XXBX33.mjs +0 -24
- package/dist/lib/node-esm/chunk-W4XXBX33.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-YGSNWTGP.mjs.map +0 -7
- package/dist/lib/node-esm/intent-resolver-TNRIFHNH.mjs +0 -63
- package/dist/lib/node-esm/intent-resolver-TNRIFHNH.mjs.map +0 -7
- package/dist/lib/node-esm/react-surface-X2GV6WQH.mjs +0 -216
- package/dist/lib/node-esm/react-surface-X2GV6WQH.mjs.map +0 -7
- package/dist/lib/node-esm/settings-KPLQ5ONI.mjs +0 -29
- package/dist/lib/node-esm/settings-KPLQ5ONI.mjs.map +0 -7
- package/dist/lib/node-esm/state-W3PECOJX.mjs +0 -38
- package/dist/lib/node-esm/state-W3PECOJX.mjs.map +0 -7
- package/dist/lib/node-esm/toolkit-GUBDYF72.mjs +0 -77
- package/dist/lib/node-esm/toolkit-GUBDYF72.mjs.map +0 -7
- package/dist/types/src/capabilities/anchor-sort.d.ts +0 -6
- package/dist/types/src/capabilities/anchor-sort.d.ts.map +0 -1
- package/dist/types/src/capabilities/app-graph-serializer.d.ts +0 -4
- package/dist/types/src/capabilities/app-graph-serializer.d.ts.map +0 -1
- package/dist/types/src/capabilities/artifact-definition.d.ts +0 -3
- package/dist/types/src/capabilities/artifact-definition.d.ts.map +0 -1
- package/dist/types/src/capabilities/blueprint-definition.d.ts +0 -5
- package/dist/types/src/capabilities/blueprint-definition.d.ts.map +0 -1
- package/dist/types/src/capabilities/capabilities.d.ts +0 -12
- package/dist/types/src/capabilities/capabilities.d.ts.map +0 -1
- package/dist/types/src/capabilities/intent-resolver.d.ts +0 -4
- package/dist/types/src/capabilities/intent-resolver.d.ts.map +0 -1
- package/dist/types/src/capabilities/react-surface.d.ts +0 -4
- package/dist/types/src/capabilities/react-surface.d.ts.map +0 -1
- package/dist/types/src/capabilities/settings.d.ts +0 -4
- package/dist/types/src/capabilities/settings.d.ts.map +0 -1
- package/dist/types/src/capabilities/state.d.ts +0 -11
- package/dist/types/src/capabilities/state.d.ts.map +0 -1
- package/dist/types/src/capabilities/toolkit.d.ts +0 -4
- package/dist/types/src/capabilities/toolkit.d.ts.map +0 -1
- package/dist/types/src/components/MarkdownCard/MarkdownCard.d.ts +0 -7
- package/dist/types/src/components/MarkdownCard/MarkdownCard.d.ts.map +0 -1
- package/dist/types/src/components/MarkdownCard/MarkdownCard.stories.d.ts +0 -9
- package/dist/types/src/components/MarkdownCard/MarkdownCard.stories.d.ts.map +0 -1
- package/dist/types/src/components/MarkdownCard/index.d.ts.map +0 -1
- package/dist/types/src/components/MarkdownContainer.d.ts +0 -18
- package/dist/types/src/components/MarkdownContainer.d.ts.map +0 -1
- package/dist/types/src/components/MarkdownContainer.stories.d.ts.map +0 -1
- package/dist/types/src/components/MarkdownSettings/MarkdownSettings.d.ts +0 -6
- package/dist/types/src/components/MarkdownSettings/MarkdownSettings.d.ts.map +0 -1
- package/dist/types/src/components/MarkdownSettings/index.d.ts +0 -2
- package/dist/types/src/components/MarkdownSettings/index.d.ts.map +0 -1
- package/dist/types/src/components/Suggestions.stories.d.ts +0 -11
- package/dist/types/src/components/Suggestions.stories.d.ts.map +0 -1
- package/dist/types/src/components/Toolbar.stories.d.ts +0 -48
- package/dist/types/src/components/Toolbar.stories.d.ts.map +0 -1
- package/dist/types/src/events.d.ts +0 -4
- package/dist/types/src/events.d.ts.map +0 -1
- package/dist/types/src/extensions.d.ts +0 -22
- package/dist/types/src/extensions.d.ts.map +0 -1
- package/dist/types/src/functions/diff.d.ts +0 -6
- package/dist/types/src/functions/diff.d.ts.map +0 -1
- package/dist/types/src/functions/index.d.ts +0 -3
- package/dist/types/src/functions/index.d.ts.map +0 -1
- package/dist/types/src/functions/open.d.ts.map +0 -1
- package/src/capabilities/anchor-sort.ts +0 -30
- package/src/capabilities/app-graph-serializer.ts +0 -54
- package/src/capabilities/artifact-definition.ts +0 -112
- package/src/capabilities/blueprint-definition.ts +0 -39
- package/src/capabilities/capabilities.ts +0 -21
- package/src/capabilities/intent-resolver.ts +0 -58
- package/src/capabilities/react-surface.tsx +0 -115
- package/src/capabilities/settings.ts +0 -25
- package/src/capabilities/state.ts +0 -31
- package/src/capabilities/toolkit.ts +0 -49
- package/src/components/MarkdownCard/MarkdownCard.stories.tsx +0 -76
- package/src/components/MarkdownCard/MarkdownCard.tsx +0 -75
- package/src/components/MarkdownContainer.stories.tsx +0 -109
- package/src/components/MarkdownContainer.tsx +0 -257
- package/src/components/MarkdownSettings/MarkdownSettings.tsx +0 -108
- package/src/components/MarkdownSettings/index.ts +0 -5
- package/src/components/Suggestions.stories.tsx +0 -221
- package/src/components/Toolbar.stories.tsx +0 -118
- package/src/events.ts +0 -11
- package/src/extensions.tsx +0 -300
- package/src/functions/diff.ts +0 -37
- package/src/functions/index.ts +0 -6
- /package/dist/lib/browser/{blueprint-definition-XDLVVSUN.mjs.map → blueprints/index.mjs.map} +0 -0
- /package/dist/lib/node-esm/{blueprint-definition-PDXZ67UQ.mjs.map → blueprints/index.mjs.map} +0 -0
|
@@ -0,0 +1,215 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2025 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import { describe, expect, it } from '@effect/vitest';
|
|
6
|
+
import * as Effect from 'effect/Effect';
|
|
7
|
+
import * as Layer from 'effect/Layer';
|
|
8
|
+
|
|
9
|
+
import { MemoizedAiService } from '@dxos/ai/testing';
|
|
10
|
+
import { AiContextService, AiConversationService } from '@dxos/assistant';
|
|
11
|
+
import { AssistantTestLayer } from '@dxos/assistant/testing';
|
|
12
|
+
import { Blueprint } from '@dxos/blueprints';
|
|
13
|
+
import { SpaceProperties } from '@dxos/client-protocol';
|
|
14
|
+
import { Database, Obj, Query, Ref } from '@dxos/echo';
|
|
15
|
+
import { Collection } from '@dxos/echo';
|
|
16
|
+
import { TestHelpers } from '@dxos/effect/testing';
|
|
17
|
+
import { FunctionInvocationService } from '@dxos/functions';
|
|
18
|
+
import { invariant } from '@dxos/invariant';
|
|
19
|
+
import { ObjectId } from '@dxos/keys';
|
|
20
|
+
import { Markdown } from '@dxos/plugin-markdown/types';
|
|
21
|
+
import { HasSubject } from '@dxos/types';
|
|
22
|
+
import { trim } from '@dxos/util';
|
|
23
|
+
|
|
24
|
+
import { WithProperties } from '../../testing';
|
|
25
|
+
import MarkdownBlueprint from '../markdown-blueprint';
|
|
26
|
+
|
|
27
|
+
import update from './update';
|
|
28
|
+
|
|
29
|
+
ObjectId.dangerouslyDisableRandomness();
|
|
30
|
+
|
|
31
|
+
const TestLayer = AssistantTestLayer({
|
|
32
|
+
functions: [...MarkdownBlueprint.functions],
|
|
33
|
+
types: [SpaceProperties, Collection.Collection, Blueprint.Blueprint, Markdown.Document, HasSubject.HasSubject],
|
|
34
|
+
tracing: 'pretty',
|
|
35
|
+
});
|
|
36
|
+
|
|
37
|
+
describe('update', () => {
|
|
38
|
+
it.effect(
|
|
39
|
+
'call a function to update a markdown document',
|
|
40
|
+
Effect.fnUntraced(
|
|
41
|
+
function* (_) {
|
|
42
|
+
const doc = Markdown.make({
|
|
43
|
+
name: 'BlueYard',
|
|
44
|
+
content: 'Founders and portfolio of BlueYard.',
|
|
45
|
+
});
|
|
46
|
+
yield* Database.add(doc);
|
|
47
|
+
|
|
48
|
+
yield* FunctionInvocationService.invokeFunction(update, {
|
|
49
|
+
doc: Ref.make(doc),
|
|
50
|
+
edits: [{ oldString: 'Founders', newString: '# Founders' }],
|
|
51
|
+
});
|
|
52
|
+
|
|
53
|
+
const updatedDoc = yield* Database.resolve(Obj.getDXN(doc), Markdown.Document);
|
|
54
|
+
expect(updatedDoc.name).toBe(doc.name);
|
|
55
|
+
const text = yield* Database.load(updatedDoc.content);
|
|
56
|
+
expect(text.content).toBe('# Founders and portfolio of BlueYard.');
|
|
57
|
+
},
|
|
58
|
+
WithProperties,
|
|
59
|
+
Effect.provide(TestLayer),
|
|
60
|
+
TestHelpers.provideTestContext,
|
|
61
|
+
),
|
|
62
|
+
);
|
|
63
|
+
|
|
64
|
+
it.scoped(
|
|
65
|
+
'create and update a markdown document',
|
|
66
|
+
Effect.fnUntraced(
|
|
67
|
+
function* (_) {
|
|
68
|
+
const markdownBlueprint = yield* Database.add(Obj.clone(MarkdownBlueprint.make()));
|
|
69
|
+
yield* AiContextService.bindContext({
|
|
70
|
+
blueprints: [Ref.make(markdownBlueprint)],
|
|
71
|
+
});
|
|
72
|
+
|
|
73
|
+
yield* AiConversationService.run({
|
|
74
|
+
prompt: `Create a document with a cookie recipe.`,
|
|
75
|
+
});
|
|
76
|
+
{
|
|
77
|
+
const docs = yield* Database.runQuery(Query.type(Markdown.Document));
|
|
78
|
+
if (docs.length !== 1) {
|
|
79
|
+
throw new Error(`Expected 1 document; got ${docs.length}: ${docs.map((_) => _.name)}`);
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
const doc = docs[0];
|
|
83
|
+
invariant(Obj.instanceOf(Markdown.Document, doc));
|
|
84
|
+
console.log({
|
|
85
|
+
name: doc.name,
|
|
86
|
+
content: yield* Database.load(doc.content).pipe(Effect.map((_) => _.content)),
|
|
87
|
+
});
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
yield* AiConversationService.run({
|
|
91
|
+
prompt: 'Add a section with a holiday-themed variation.',
|
|
92
|
+
});
|
|
93
|
+
{
|
|
94
|
+
const docs = yield* Database.runQuery(Query.type(Markdown.Document));
|
|
95
|
+
if (docs.length !== 1) {
|
|
96
|
+
throw new Error(`Expected 1 document; got ${docs.length}: ${docs.map((_) => _.name)}`);
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
const doc = docs[0];
|
|
100
|
+
invariant(Obj.instanceOf(Markdown.Document, doc));
|
|
101
|
+
console.log({
|
|
102
|
+
name: doc.name,
|
|
103
|
+
content: yield* Database.load(doc.content).pipe(Effect.map((_) => _.content)),
|
|
104
|
+
});
|
|
105
|
+
}
|
|
106
|
+
},
|
|
107
|
+
WithProperties,
|
|
108
|
+
Effect.provide(AiConversationService.layerNewQueue().pipe(Layer.provideMerge(TestLayer))),
|
|
109
|
+
TestHelpers.provideTestContext,
|
|
110
|
+
),
|
|
111
|
+
MemoizedAiService.isGenerationEnabled() ? 240_000 : 30_000,
|
|
112
|
+
);
|
|
113
|
+
|
|
114
|
+
it.scoped(
|
|
115
|
+
'update existing document',
|
|
116
|
+
Effect.fnUntraced(
|
|
117
|
+
function* (_) {
|
|
118
|
+
const document = yield* Database.add(
|
|
119
|
+
Markdown.make({
|
|
120
|
+
name: 'Cookie Recipe',
|
|
121
|
+
content: trim`
|
|
122
|
+
Ingredients:
|
|
123
|
+
- 2 cups of ???
|
|
124
|
+
- 1 cup of sugar
|
|
125
|
+
- 1 cup of butter
|
|
126
|
+
- 1 cup of eggs
|
|
127
|
+
`,
|
|
128
|
+
}),
|
|
129
|
+
);
|
|
130
|
+
const markdownBlueprint = yield* Database.add(Obj.clone(MarkdownBlueprint.make()));
|
|
131
|
+
yield* AiContextService.bindContext({
|
|
132
|
+
blueprints: [Ref.make(markdownBlueprint)],
|
|
133
|
+
objects: [Ref.make(document)],
|
|
134
|
+
});
|
|
135
|
+
|
|
136
|
+
yield* AiConversationService.run({
|
|
137
|
+
prompt: 'Add the missing ingredient (its flour).',
|
|
138
|
+
});
|
|
139
|
+
|
|
140
|
+
{
|
|
141
|
+
const docs = yield* Database.runQuery(Query.type(Markdown.Document));
|
|
142
|
+
if (docs.length !== 1) {
|
|
143
|
+
throw new Error(`Expected 1 document; got ${docs.length}: ${docs.map((_) => _.name)}`);
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
const doc = docs[0];
|
|
147
|
+
invariant(Obj.instanceOf(Markdown.Document, doc));
|
|
148
|
+
const content = yield* Database.load(doc.content).pipe(Effect.map((_) => _.content));
|
|
149
|
+
console.log({
|
|
150
|
+
name: doc.name,
|
|
151
|
+
content: yield* Database.load(doc.content).pipe(Effect.map((_) => _.content)),
|
|
152
|
+
});
|
|
153
|
+
expect(content.toLowerCase()).toContain('flour');
|
|
154
|
+
}
|
|
155
|
+
},
|
|
156
|
+
WithProperties,
|
|
157
|
+
Effect.provide(AiConversationService.layerNewQueue().pipe(Layer.provideMerge(TestLayer))),
|
|
158
|
+
TestHelpers.provideTestContext,
|
|
159
|
+
),
|
|
160
|
+
MemoizedAiService.isGenerationEnabled() ? 240_000 : 30_000,
|
|
161
|
+
);
|
|
162
|
+
|
|
163
|
+
it.scoped(
|
|
164
|
+
'add lines to document one by one',
|
|
165
|
+
Effect.fnUntraced(
|
|
166
|
+
function* (_) {
|
|
167
|
+
const document = yield* Database.add(
|
|
168
|
+
Markdown.make({
|
|
169
|
+
name: 'Shopping list',
|
|
170
|
+
content: trim`
|
|
171
|
+
# Shopping list
|
|
172
|
+
`,
|
|
173
|
+
}),
|
|
174
|
+
);
|
|
175
|
+
const markdownBlueprint = yield* Database.add(Obj.clone(MarkdownBlueprint.make()));
|
|
176
|
+
yield* AiContextService.bindContext({
|
|
177
|
+
blueprints: [Ref.make(markdownBlueprint)],
|
|
178
|
+
objects: [Ref.make(document)],
|
|
179
|
+
});
|
|
180
|
+
|
|
181
|
+
yield* AiConversationService.run({
|
|
182
|
+
prompt: 'Add milk to the shopping list.',
|
|
183
|
+
});
|
|
184
|
+
yield* AiConversationService.run({
|
|
185
|
+
prompt: 'Add bread to the shopping list.',
|
|
186
|
+
});
|
|
187
|
+
yield* AiConversationService.run({
|
|
188
|
+
prompt: 'Add eggs to the shopping list.',
|
|
189
|
+
});
|
|
190
|
+
|
|
191
|
+
{
|
|
192
|
+
const docs = yield* Database.runQuery(Query.type(Markdown.Document));
|
|
193
|
+
if (docs.length !== 1) {
|
|
194
|
+
throw new Error(`Expected 1 document; got ${docs.length}: ${docs.map((_) => _.name)}`);
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
const doc = docs[0];
|
|
198
|
+
invariant(Obj.instanceOf(Markdown.Document, doc));
|
|
199
|
+
const content = yield* Database.load(doc.content).pipe(Effect.map((_) => _.content));
|
|
200
|
+
console.log({
|
|
201
|
+
name: doc.name,
|
|
202
|
+
content: yield* Database.load(doc.content).pipe(Effect.map((_) => _.content)),
|
|
203
|
+
});
|
|
204
|
+
expect(content.toLowerCase()).toContain('milk');
|
|
205
|
+
expect(content.toLowerCase()).toContain('bread');
|
|
206
|
+
expect(content.toLowerCase()).toContain('eggs');
|
|
207
|
+
}
|
|
208
|
+
},
|
|
209
|
+
WithProperties,
|
|
210
|
+
Effect.provide(AiConversationService.layerNewQueue().pipe(Layer.provideMerge(TestLayer))),
|
|
211
|
+
TestHelpers.provideTestContext,
|
|
212
|
+
),
|
|
213
|
+
MemoizedAiService.isGenerationEnabled() ? 240_000 : 30_000,
|
|
214
|
+
);
|
|
215
|
+
});
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2025 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import { next as A, type Doc } from '@automerge/automerge';
|
|
6
|
+
import * as Effect from 'effect/Effect';
|
|
7
|
+
import * as Schema from 'effect/Schema';
|
|
8
|
+
|
|
9
|
+
import { Database, Ref } from '@dxos/echo';
|
|
10
|
+
import { DocAccessor, createDocAccessor } from '@dxos/echo-db';
|
|
11
|
+
import { defineFunction } from '@dxos/functions';
|
|
12
|
+
import { trim } from '@dxos/util';
|
|
13
|
+
|
|
14
|
+
import { Markdown } from '../../types';
|
|
15
|
+
|
|
16
|
+
const Edit = Schema.Struct({
|
|
17
|
+
oldString: Schema.String.annotations({
|
|
18
|
+
description: 'The text to find in the document.',
|
|
19
|
+
}),
|
|
20
|
+
newString: Schema.String.annotations({
|
|
21
|
+
description: 'The text to replace it with.',
|
|
22
|
+
}),
|
|
23
|
+
replaceAll: Schema.optional(Schema.Boolean).annotations({
|
|
24
|
+
description: 'If true, replaces all occurrences. Defaults to false (first occurrence only).',
|
|
25
|
+
}),
|
|
26
|
+
});
|
|
27
|
+
|
|
28
|
+
// TODO(wittjosiah): Reconcile with ThreadAction.AddProposal.
|
|
29
|
+
// Based on opencode's MutilEdit tool: https://deepwiki.com/search/how-does-text-edit-tool-work_a159bc76-5401-424e-b29f-f087d1ea4f78
|
|
30
|
+
export default defineFunction({
|
|
31
|
+
key: 'dxos.org/function/markdown/update',
|
|
32
|
+
name: 'Update',
|
|
33
|
+
description: trim`
|
|
34
|
+
Applies a set of edits to the markdown document.
|
|
35
|
+
`,
|
|
36
|
+
inputSchema: Schema.Struct({
|
|
37
|
+
doc: Ref.Ref(Markdown.Document).annotations({
|
|
38
|
+
description: 'The ID of the markdown document.',
|
|
39
|
+
}),
|
|
40
|
+
edits: Schema.Array(Edit).annotations({
|
|
41
|
+
description: 'The edits to apply to the document. Each edit finds oldString and replaces it with newString.',
|
|
42
|
+
}),
|
|
43
|
+
}),
|
|
44
|
+
outputSchema: Schema.Struct({
|
|
45
|
+
newContent: Schema.String,
|
|
46
|
+
}),
|
|
47
|
+
handler: Effect.fn(function* ({ data: { doc, edits } }) {
|
|
48
|
+
const content = yield* doc.pipe(
|
|
49
|
+
Database.load,
|
|
50
|
+
Effect.map((_) => _.content),
|
|
51
|
+
Effect.flatMap(Database.load),
|
|
52
|
+
);
|
|
53
|
+
const accessor = createDocAccessor(content, ['content']);
|
|
54
|
+
|
|
55
|
+
for (const edit of edits) {
|
|
56
|
+
accessor.handle.change((doc: Doc<typeof content>) => {
|
|
57
|
+
const text = DocAccessor.getValue<string>(accessor);
|
|
58
|
+
if (edit.replaceAll) {
|
|
59
|
+
let idx = text.indexOf(edit.oldString);
|
|
60
|
+
while (idx !== -1) {
|
|
61
|
+
A.splice(doc, accessor.path as A.Prop[], idx, edit.oldString.length, edit.newString);
|
|
62
|
+
const updated = DocAccessor.getValue<string>(accessor);
|
|
63
|
+
idx = updated.indexOf(edit.oldString, idx + edit.newString.length);
|
|
64
|
+
}
|
|
65
|
+
} else {
|
|
66
|
+
const idx = text.indexOf(edit.oldString);
|
|
67
|
+
if (idx === -1) {
|
|
68
|
+
throw new Error(`Edit not found: ${JSON.stringify(edit.oldString)}`);
|
|
69
|
+
}
|
|
70
|
+
A.splice(doc, accessor.path as A.Prop[], idx, edit.oldString.length, edit.newString);
|
|
71
|
+
}
|
|
72
|
+
});
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
return {
|
|
76
|
+
newContent: DocAccessor.getValue<string>(accessor),
|
|
77
|
+
};
|
|
78
|
+
}),
|
|
79
|
+
});
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2025 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import { type AppCapabilities } from '@dxos/app-toolkit';
|
|
6
|
+
import { Blueprint, Template } from '@dxos/blueprints';
|
|
7
|
+
import { trim } from '@dxos/util';
|
|
8
|
+
|
|
9
|
+
import { MarkdownFunctions } from './functions';
|
|
10
|
+
|
|
11
|
+
const BLUEPRINT_KEY = 'dxos.org/blueprint/markdown';
|
|
12
|
+
|
|
13
|
+
const functions = Object.values(MarkdownFunctions);
|
|
14
|
+
|
|
15
|
+
const make = () =>
|
|
16
|
+
Blueprint.make({
|
|
17
|
+
key: BLUEPRINT_KEY,
|
|
18
|
+
name: 'Markdown',
|
|
19
|
+
tools: Blueprint.toolDefinitions({ functions }),
|
|
20
|
+
instructions: Template.make({
|
|
21
|
+
// TODO(wittjosiah): Move example to function input schema annotation.
|
|
22
|
+
source: trim`
|
|
23
|
+
{{! Markdown }}
|
|
24
|
+
|
|
25
|
+
You can create, read and update markdown documents.
|
|
26
|
+
When asked to edit or update documents return updates as a set of compact diff string pairs.
|
|
27
|
+
For each diff, respond with the smallest possible matching span.
|
|
28
|
+
|
|
29
|
+
Example:
|
|
30
|
+
${'```'}diff
|
|
31
|
+
- "There is a tyop in this sentence."
|
|
32
|
+
+ "There is a typo in this sentence."
|
|
33
|
+
- "This id good."
|
|
34
|
+
+ "This sentence is really good."
|
|
35
|
+
${'```'}
|
|
36
|
+
`,
|
|
37
|
+
}),
|
|
38
|
+
});
|
|
39
|
+
|
|
40
|
+
const blueprint: AppCapabilities.BlueprintDefinition = {
|
|
41
|
+
key: BLUEPRINT_KEY,
|
|
42
|
+
functions,
|
|
43
|
+
make,
|
|
44
|
+
};
|
|
45
|
+
|
|
46
|
+
export default blueprint;
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2025 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import * as Effect from 'effect/Effect';
|
|
6
|
+
|
|
7
|
+
import { Capability } from '@dxos/app-framework';
|
|
8
|
+
import { AppCapabilities } from '@dxos/app-toolkit';
|
|
9
|
+
import { Relation } from '@dxos/echo';
|
|
10
|
+
import { createDocAccessor, getRangeFromCursor } from '@dxos/echo-db';
|
|
11
|
+
import { type AnchoredTo } from '@dxos/types';
|
|
12
|
+
|
|
13
|
+
import { Markdown } from '../../types';
|
|
14
|
+
|
|
15
|
+
export default Capability.makeModule(() =>
|
|
16
|
+
Effect.succeed(
|
|
17
|
+
Capability.contributes(AppCapabilities.AnchorSort, {
|
|
18
|
+
key: Markdown.Document.typename,
|
|
19
|
+
sort: (anchorA: AnchoredTo.AnchoredTo, anchorB: AnchoredTo.AnchoredTo) => {
|
|
20
|
+
const doc = Relation.getTarget(anchorA) as Markdown.Document;
|
|
21
|
+
const accessor = doc.content.target ? createDocAccessor(doc.content.target, ['content']) : undefined;
|
|
22
|
+
if (doc !== Relation.getTarget(anchorB) || !accessor) {
|
|
23
|
+
return 0;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
const getStartPosition = (cursor: string | undefined) => {
|
|
27
|
+
const range = cursor ? getRangeFromCursor(accessor, cursor) : undefined;
|
|
28
|
+
return range?.start ?? Number.MAX_SAFE_INTEGER;
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
const posA = getStartPosition(anchorA.anchor);
|
|
32
|
+
const posB = getStartPosition(anchorB.anchor);
|
|
33
|
+
return posA - posB;
|
|
34
|
+
},
|
|
35
|
+
}),
|
|
36
|
+
),
|
|
37
|
+
);
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2025 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import * as Effect from 'effect/Effect';
|
|
6
|
+
|
|
7
|
+
import { Capabilities, Capability } from '@dxos/app-framework';
|
|
8
|
+
import { AppCapabilities } from '@dxos/app-toolkit';
|
|
9
|
+
import { Obj } from '@dxos/echo';
|
|
10
|
+
import { Collection } from '@dxos/echo';
|
|
11
|
+
import { SpaceOperation } from '@dxos/plugin-space/types';
|
|
12
|
+
import { isSpace } from '@dxos/react-client/echo';
|
|
13
|
+
|
|
14
|
+
import { translations } from '../../translations';
|
|
15
|
+
import { Markdown, MarkdownOperation } from '../../types';
|
|
16
|
+
|
|
17
|
+
export default Capability.makeModule(
|
|
18
|
+
Effect.fnUntraced(function* () {
|
|
19
|
+
// Get context for lazy capability access in callbacks.
|
|
20
|
+
const capabilities = yield* Capability.Service;
|
|
21
|
+
|
|
22
|
+
return Capability.contributes(AppCapabilities.AppGraphSerializer, [
|
|
23
|
+
{
|
|
24
|
+
inputType: Markdown.Document.typename,
|
|
25
|
+
outputType: 'text/markdown',
|
|
26
|
+
// Reconcile with metadata serializers.
|
|
27
|
+
serialize: async (node) => {
|
|
28
|
+
const doc = node.data;
|
|
29
|
+
const content = await doc.content.load();
|
|
30
|
+
return {
|
|
31
|
+
name:
|
|
32
|
+
doc.name ||
|
|
33
|
+
doc.fallbackName ||
|
|
34
|
+
translations[0]['en-US'][Markdown.Document.typename]['object name placeholder'],
|
|
35
|
+
data: content.content,
|
|
36
|
+
type: 'text/markdown',
|
|
37
|
+
};
|
|
38
|
+
},
|
|
39
|
+
deserialize: async (data, ancestors) => {
|
|
40
|
+
const space = ancestors.find(isSpace);
|
|
41
|
+
const target =
|
|
42
|
+
ancestors.findLast((ancestor) => Obj.instanceOf(Collection.Collection, ancestor)) ??
|
|
43
|
+
space?.properties[Collection.Collection.typename]?.target;
|
|
44
|
+
if (!space || !target) {
|
|
45
|
+
return;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
const { invokePromise } = capabilities.get(Capabilities.OperationInvoker);
|
|
49
|
+
const createResult = await invokePromise(MarkdownOperation.Create, { name: data.name, content: data.data });
|
|
50
|
+
if (!createResult.data?.object) {
|
|
51
|
+
return undefined;
|
|
52
|
+
}
|
|
53
|
+
await invokePromise(SpaceOperation.AddObject, { target, object: createResult.data.object });
|
|
54
|
+
|
|
55
|
+
return createResult.data.object;
|
|
56
|
+
},
|
|
57
|
+
},
|
|
58
|
+
]);
|
|
59
|
+
}),
|
|
60
|
+
);
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2025 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
// ISSUE(burdon): defineArtifact
|
|
6
|
+
// @ts-nocheck
|
|
7
|
+
|
|
8
|
+
import * as Effect from 'effect/Effect';
|
|
9
|
+
import * as Schema from 'effect/Schema';
|
|
10
|
+
|
|
11
|
+
import { ToolResult, createTool } from '@dxos/ai';
|
|
12
|
+
import { Capabilities, Capability } from '@dxos/app-framework';
|
|
13
|
+
import { ArtifactId, createArtifactElement } from '@dxos/assistant';
|
|
14
|
+
import { defineArtifact } from '@dxos/blueprints';
|
|
15
|
+
import { Obj } from '@dxos/echo';
|
|
16
|
+
import { assertArgument, invariant } from '@dxos/invariant';
|
|
17
|
+
import { SpaceOperation } from '@dxos/plugin-space/types';
|
|
18
|
+
import { Filter } from '@dxos/react-client/echo';
|
|
19
|
+
|
|
20
|
+
import { meta } from '../../meta';
|
|
21
|
+
import { Markdown } from '../../types';
|
|
22
|
+
|
|
23
|
+
export default Capability.makeModule(() =>
|
|
24
|
+
Effect.sync(() => {
|
|
25
|
+
const definition = defineArtifact({
|
|
26
|
+
id: `artifact:${meta.id}`, // TODO(burdon): meta.id/artifact?
|
|
27
|
+
name: meta.name,
|
|
28
|
+
instructions: `
|
|
29
|
+
The markdown plugin allows you to work with text documents in the current space.
|
|
30
|
+
Use these tools to interact with documents, including listing available documents and retrieving their content.
|
|
31
|
+
Documents are stored in Markdown format.
|
|
32
|
+
`,
|
|
33
|
+
schema: Markdown.Document,
|
|
34
|
+
tools: [
|
|
35
|
+
createTool(meta.id, {
|
|
36
|
+
name: 'create',
|
|
37
|
+
description: 'Create a new markdown document',
|
|
38
|
+
caption: 'Creating document...',
|
|
39
|
+
schema: Schema.Struct({
|
|
40
|
+
name: Schema.optional(Schema.String).annotations({
|
|
41
|
+
description: 'Optional name for the document.',
|
|
42
|
+
}),
|
|
43
|
+
content: Schema.String.annotations({
|
|
44
|
+
description: 'The content of the document.',
|
|
45
|
+
}),
|
|
46
|
+
}),
|
|
47
|
+
execute: async ({ name, content }, { extensions }) => {
|
|
48
|
+
invariant(extensions?.space, 'No space');
|
|
49
|
+
invariant(extensions?.invoke, 'No operation invoker');
|
|
50
|
+
|
|
51
|
+
const document = Markdown.make({ name, content });
|
|
52
|
+
|
|
53
|
+
const { error } = await extensions.invoke(SpaceOperation.AddObject, {
|
|
54
|
+
target: extensions.space,
|
|
55
|
+
object: document,
|
|
56
|
+
});
|
|
57
|
+
if (error) {
|
|
58
|
+
return ToolResult.Error(error?.message ?? 'Failed to add document to space');
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
return ToolResult.Success(createArtifactElement(document.id));
|
|
62
|
+
},
|
|
63
|
+
}),
|
|
64
|
+
createTool(meta.id, {
|
|
65
|
+
name: 'list',
|
|
66
|
+
description: 'List all markdown documents in the current space.',
|
|
67
|
+
caption: 'Listing markdown documents...',
|
|
68
|
+
schema: Schema.Struct({}),
|
|
69
|
+
execute: async (_input, { extensions }) => {
|
|
70
|
+
invariant(extensions?.space, 'No space');
|
|
71
|
+
const space = extensions.space;
|
|
72
|
+
const { objects: documents } = await space.db.query(Filter.type(Markdown.Document)).run();
|
|
73
|
+
const documentInfo = documents.map((doc) => {
|
|
74
|
+
invariant(Obj.instanceOf(Markdown.Document, doc));
|
|
75
|
+
return {
|
|
76
|
+
id: Obj.getDXN(doc).toString(),
|
|
77
|
+
name: doc.name || doc.fallbackName || 'Unnamed Document',
|
|
78
|
+
// TODO(ZaymonFC): Include updatedAt?
|
|
79
|
+
};
|
|
80
|
+
});
|
|
81
|
+
|
|
82
|
+
return ToolResult.Success(documentInfo);
|
|
83
|
+
},
|
|
84
|
+
}),
|
|
85
|
+
createTool(meta.id, {
|
|
86
|
+
name: 'inspect',
|
|
87
|
+
description: 'Read the content of a markdown document.',
|
|
88
|
+
caption: 'Inspecting markdown document...',
|
|
89
|
+
schema: Schema.Struct({
|
|
90
|
+
id: ArtifactId,
|
|
91
|
+
}),
|
|
92
|
+
execute: async ({ id }, { extensions }) => {
|
|
93
|
+
invariant(extensions?.space, 'No space');
|
|
94
|
+
const document = await extensions.space.db.query(Filter.id(ArtifactId.toDXN(id).toString())).first();
|
|
95
|
+
assertArgument(Obj.instanceOf(Markdown.Document, document), 'document', 'Invalid type');
|
|
96
|
+
|
|
97
|
+
const { content } = await document.content?.load();
|
|
98
|
+
return ToolResult.Success({
|
|
99
|
+
id: Obj.getDXN(document).toString(),
|
|
100
|
+
name: document.name || document.fallbackName || 'Unnamed Document',
|
|
101
|
+
content,
|
|
102
|
+
});
|
|
103
|
+
},
|
|
104
|
+
}),
|
|
105
|
+
],
|
|
106
|
+
});
|
|
107
|
+
|
|
108
|
+
return Capability.contributes(Capabilities.ArtifactDefinition, definition);
|
|
109
|
+
}),
|
|
110
|
+
);
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2025 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import * as Effect from 'effect/Effect';
|
|
6
|
+
|
|
7
|
+
import { Capability } from '@dxos/app-framework';
|
|
8
|
+
import { AppCapabilities } from '@dxos/app-toolkit';
|
|
9
|
+
|
|
10
|
+
import { MarkdownBlueprint } from '../../blueprints';
|
|
11
|
+
|
|
12
|
+
const blueprintDefinition = Capability.makeModule<
|
|
13
|
+
[],
|
|
14
|
+
Capability.Capability<typeof AppCapabilities.BlueprintDefinition>[]
|
|
15
|
+
>(() => Effect.succeed([Capability.contributes(AppCapabilities.BlueprintDefinition, MarkdownBlueprint)]));
|
|
16
|
+
|
|
17
|
+
export default blueprintDefinition;
|
|
@@ -2,16 +2,10 @@
|
|
|
2
2
|
// Copyright 2025 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
export const AnchorSort = lazy(() => import('./anchor-sort'));
|
|
8
|
-
export const AppGraphSerializer = lazy(() => import('./app-graph-serializer'));
|
|
9
|
-
export const BlueprintDefinition = lazy(() => import('./blueprint-definition'));
|
|
10
|
-
export const IntentResolver = lazy(() => import('./intent-resolver'));
|
|
11
|
-
export const ReactSurface = lazy(() => import('./react-surface'));
|
|
12
|
-
export const MarkdownSettings = lazy(() => import('./settings'));
|
|
13
|
-
export const MarkdownState = lazy(() => import('./state'));
|
|
14
|
-
export const Toolkit = lazy(() => import('./toolkit'));
|
|
15
|
-
|
|
5
|
+
export * from './anchor-sort';
|
|
6
|
+
export * from './app-graph-serializer';
|
|
16
7
|
export * from './blueprint-definition';
|
|
17
|
-
export * from './
|
|
8
|
+
export * from './operation-resolver';
|
|
9
|
+
export * from './react-surface';
|
|
10
|
+
export * from './settings';
|
|
11
|
+
export * from './state';
|