@dxos/plugin-markdown 0.8.4-main.7ace549 → 0.8.4-main.9735255
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-WHK3ORP7.mjs +12 -0
- package/dist/lib/browser/MarkdownContainer-V7EAADMF.mjs +12 -0
- package/dist/lib/browser/{anchor-sort-3MYLO74J.mjs → anchor-sort-WQ3TL7ZI.mjs} +7 -7
- package/dist/lib/browser/anchor-sort-WQ3TL7ZI.mjs.map +7 -0
- package/dist/lib/browser/app-graph-serializer-ULZUJKOD.mjs +58 -0
- package/dist/lib/browser/app-graph-serializer-ULZUJKOD.mjs.map +7 -0
- package/dist/lib/browser/blueprint-definition-TLV4PNZW.mjs +19 -0
- package/dist/lib/browser/blueprint-definition-TLV4PNZW.mjs.map +7 -0
- package/dist/lib/browser/blueprints/index.mjs +8 -0
- package/dist/lib/browser/chunk-BX73DASG.mjs +702 -0
- package/dist/lib/browser/chunk-BX73DASG.mjs.map +7 -0
- package/dist/lib/browser/chunk-CUGDX7KA.mjs +8 -0
- package/dist/lib/browser/chunk-CUGDX7KA.mjs.map +7 -0
- package/dist/lib/browser/{chunk-BE3IO2CM.mjs → chunk-FWQQW6KU.mjs} +41 -47
- package/dist/lib/browser/chunk-FWQQW6KU.mjs.map +7 -0
- package/dist/lib/browser/{chunk-NXT2E2BG.mjs → chunk-JOXYQLKH.mjs} +3 -5
- package/dist/lib/browser/{chunk-NXT2E2BG.mjs.map → chunk-JOXYQLKH.mjs.map} +1 -1
- package/dist/lib/browser/chunk-KDKXFKDN.mjs +104 -0
- package/dist/lib/browser/chunk-KDKXFKDN.mjs.map +7 -0
- package/dist/lib/browser/chunk-LMO5UVKL.mjs +167 -0
- package/dist/lib/browser/chunk-LMO5UVKL.mjs.map +7 -0
- package/dist/lib/browser/chunk-S45ULIOG.mjs +101 -0
- package/dist/lib/browser/chunk-S45ULIOG.mjs.map +7 -0
- package/dist/lib/browser/chunk-WIPSLZ6L.mjs +60 -0
- package/dist/lib/browser/chunk-WIPSLZ6L.mjs.map +7 -0
- package/dist/lib/browser/cli/index.mjs +32 -0
- package/dist/lib/browser/cli/index.mjs.map +7 -0
- package/dist/lib/browser/index.mjs +121 -129
- package/dist/lib/browser/index.mjs.map +4 -4
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/operation-resolver-EGCWOQKJ.mjs +53 -0
- package/dist/lib/browser/operation-resolver-EGCWOQKJ.mjs.map +7 -0
- package/dist/lib/browser/react-surface-SRPLD3ED.mjs +213 -0
- package/dist/lib/browser/react-surface-SRPLD3ED.mjs.map +7 -0
- package/dist/lib/browser/settings-JY5JE7MI.mjs +35 -0
- package/dist/lib/browser/settings-JY5JE7MI.mjs.map +7 -0
- package/dist/lib/browser/state-QE7VSJWJ.mjs +29 -0
- package/dist/lib/browser/state-QE7VSJWJ.mjs.map +7 -0
- package/dist/lib/browser/types/index.mjs +10 -3
- package/dist/lib/node-esm/{MarkdownCard-FTEHVH7P.mjs → MarkdownCard-WJPLQTFS.mjs} +5 -5
- package/dist/lib/node-esm/MarkdownContainer-LUSMORP2.mjs +13 -0
- package/dist/lib/node-esm/{anchor-sort-W4HCTYUQ.mjs → anchor-sort-G7D5TAI6.mjs} +7 -7
- package/dist/lib/node-esm/anchor-sort-G7D5TAI6.mjs.map +7 -0
- package/dist/lib/node-esm/app-graph-serializer-W5YMQP7P.mjs +59 -0
- package/dist/lib/node-esm/app-graph-serializer-W5YMQP7P.mjs.map +7 -0
- package/dist/lib/node-esm/blueprint-definition-HYFA7BKQ.mjs +20 -0
- package/dist/lib/node-esm/blueprint-definition-HYFA7BKQ.mjs.map +7 -0
- package/dist/lib/node-esm/blueprints/index.mjs +9 -0
- package/dist/lib/node-esm/chunk-3JYPCC7M.mjs +105 -0
- package/dist/lib/node-esm/chunk-3JYPCC7M.mjs.map +7 -0
- package/dist/lib/node-esm/{chunk-I5JSQBPI.mjs → chunk-44VJC3QF.mjs} +3 -5
- package/dist/lib/node-esm/{chunk-I5JSQBPI.mjs.map → chunk-44VJC3QF.mjs.map} +1 -1
- package/dist/lib/node-esm/chunk-D4BCFPKK.mjs +703 -0
- package/dist/lib/node-esm/chunk-D4BCFPKK.mjs.map +7 -0
- package/dist/lib/node-esm/{chunk-3DN4DPVA.mjs → chunk-EYAFC4N7.mjs} +41 -47
- package/dist/lib/node-esm/chunk-EYAFC4N7.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-PRV35A7Z.mjs +168 -0
- package/dist/lib/node-esm/chunk-PRV35A7Z.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-RQP7G7XW.mjs +61 -0
- package/dist/lib/node-esm/chunk-RQP7G7XW.mjs.map +7 -0
- package/dist/lib/node-esm/{chunk-7GN66TDQ.mjs → chunk-SDTYEGGL.mjs} +56 -6
- package/dist/lib/node-esm/chunk-SDTYEGGL.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-W3IIKDV5.mjs +10 -0
- package/dist/lib/node-esm/chunk-W3IIKDV5.mjs.map +7 -0
- package/dist/lib/node-esm/cli/index.mjs +33 -0
- package/dist/lib/node-esm/cli/index.mjs.map +7 -0
- package/dist/lib/node-esm/index.mjs +121 -129
- 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-2HIS2AQZ.mjs +54 -0
- package/dist/lib/node-esm/operation-resolver-2HIS2AQZ.mjs.map +7 -0
- package/dist/lib/node-esm/react-surface-RONSOJIQ.mjs +214 -0
- package/dist/lib/node-esm/react-surface-RONSOJIQ.mjs.map +7 -0
- package/dist/lib/node-esm/settings-4UGMPIRY.mjs +36 -0
- package/dist/lib/node-esm/settings-4UGMPIRY.mjs.map +7 -0
- package/dist/lib/node-esm/state-LXE5XIN4.mjs +30 -0
- package/dist/lib/node-esm/state-LXE5XIN4.mjs.map +7 -0
- package/dist/lib/node-esm/types/index.mjs +10 -3
- package/dist/types/src/MarkdownPlugin.d.ts +2 -1
- package/dist/types/src/MarkdownPlugin.d.ts.map +1 -1
- package/dist/types/src/blueprints/functions/create.d.ts.map +1 -0
- package/dist/types/src/blueprints/functions/create.test.d.ts.map +1 -0
- package/dist/types/src/blueprints/functions/index.d.ts +4 -0
- package/dist/types/src/blueprints/functions/index.d.ts.map +1 -0
- package/dist/types/src/blueprints/functions/open.d.ts.map +1 -0
- package/dist/types/src/blueprints/functions/update.d.ts.map +1 -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 +21 -0
- package/dist/types/src/blueprints/markdown-blueprint.d.ts.map +1 -0
- package/dist/types/src/capabilities/anchor-sort/anchor-sort.d.ts +5 -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 +10 -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 -13
- 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 +6 -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/MarkdownCard/MarkdownCard.d.ts +4 -3
- package/dist/types/src/components/MarkdownCard/MarkdownCard.d.ts.map +1 -1
- package/dist/types/src/components/MarkdownCard/MarkdownCard.stories.d.ts +5 -5
- package/dist/types/src/components/MarkdownCard/MarkdownCard.stories.d.ts.map +1 -1
- package/dist/types/src/components/MarkdownContainer.d.ts +19 -5
- package/dist/types/src/components/MarkdownContainer.d.ts.map +1 -1
- package/dist/types/src/components/MarkdownContainer.stories.d.ts.map +1 -1
- package/dist/types/src/components/MarkdownEditor/FileUpload.d.ts +2 -2
- package/dist/types/src/components/MarkdownEditor/FileUpload.d.ts.map +1 -1
- package/dist/types/src/components/MarkdownEditor/MarkdownEditor.d.ts +8 -7
- package/dist/types/src/components/MarkdownEditor/MarkdownEditor.d.ts.map +1 -1
- package/dist/types/src/components/MarkdownEditor/MarkdownEditor.stories.d.ts.map +1 -1
- package/dist/types/src/components/MarkdownEditor/MarkdownEditorContent.d.ts +12 -8
- package/dist/types/src/components/MarkdownEditor/MarkdownEditorContent.d.ts.map +1 -1
- package/dist/types/src/components/MarkdownEditor/MarkdownEditorToolbar.d.ts +4 -4
- package/dist/types/src/components/MarkdownEditor/MarkdownEditorToolbar.d.ts.map +1 -1
- package/dist/types/src/components/MarkdownSettings/MarkdownSettings.d.ts +4 -2
- package/dist/types/src/components/MarkdownSettings/MarkdownSettings.d.ts.map +1 -1
- package/dist/types/src/components/Suggestions.stories.d.ts.map +1 -1
- package/dist/types/src/components/index.d.ts +5 -2
- package/dist/types/src/components/index.d.ts.map +1 -1
- package/dist/types/src/hooks/useEditorMenuOptions.d.ts.map +1 -1
- package/dist/types/src/hooks/useExtensions.d.ts +3 -3
- package/dist/types/src/hooks/useExtensions.d.ts.map +1 -1
- package/dist/types/src/hooks/useLinkQuery.d.ts +2 -2
- package/dist/types/src/hooks/useLinkQuery.d.ts.map +1 -1
- package/dist/types/src/hooks/useSelectCurrentThread.d.ts.map +1 -1
- package/dist/types/src/index.d.ts +1 -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 +2 -2
- package/dist/types/src/testing.d.ts.map +1 -1
- package/dist/types/src/types/Markdown.d.ts +12 -12
- package/dist/types/src/types/Markdown.d.ts.map +1 -1
- package/dist/types/src/types/MarkdownAction.d.ts +62 -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 +3 -0
- 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 +81 -66
- package/src/MarkdownPlugin.tsx +61 -74
- package/src/blueprints/functions/create.conversations.json +1 -0
- package/src/{functions → blueprints/functions}/create.test.ts +20 -23
- package/src/{functions → blueprints/functions}/create.ts +1 -1
- package/src/blueprints/functions/index.ts +7 -0
- package/src/{functions → blueprints/functions}/open.ts +4 -3
- package/src/blueprints/functions/update.conversations.json +1 -0
- package/src/{functions → blueprints/functions}/update.test.ts +23 -25
- package/src/{functions → blueprints/functions}/update.ts +4 -3
- package/src/blueprints/index.ts +5 -0
- package/src/blueprints/markdown-blueprint.ts +38 -0
- package/src/capabilities/anchor-sort/anchor-sort.ts +36 -0
- package/src/capabilities/anchor-sort/index.ts +7 -0
- package/src/capabilities/app-graph-serializer/app-graph-serializer.ts +59 -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 +25 -0
- package/src/capabilities/blueprint-definition/index.ts +7 -0
- package/src/capabilities/index.ts +6 -11
- 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 +100 -0
- package/src/capabilities/settings/index.ts +7 -0
- package/src/capabilities/settings/settings.ts +36 -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 +29 -0
- package/src/components/MarkdownCard/MarkdownCard.stories.tsx +25 -43
- package/src/components/MarkdownCard/MarkdownCard.tsx +22 -47
- package/src/components/MarkdownContainer.stories.tsx +47 -60
- package/src/components/MarkdownContainer.tsx +86 -88
- package/src/components/MarkdownEditor/FileUpload.tsx +3 -3
- package/src/components/MarkdownEditor/MarkdownEditor.stories.tsx +16 -17
- package/src/components/MarkdownEditor/MarkdownEditor.tsx +14 -15
- package/src/components/MarkdownEditor/MarkdownEditorContent.tsx +44 -18
- package/src/components/MarkdownEditor/MarkdownEditorToolbar.tsx +7 -4
- package/src/components/MarkdownSettings/MarkdownSettings.tsx +24 -10
- package/src/components/Suggestions.stories.tsx +21 -32
- package/src/components/index.ts +8 -3
- package/src/hooks/useEditorMenuOptions.ts +10 -13
- package/src/hooks/useExtensions.tsx +23 -28
- package/src/hooks/useLinkQuery.ts +13 -13
- package/src/hooks/useSelectCurrentThread.tsx +37 -42
- package/src/index.ts +1 -2
- package/src/meta.ts +2 -2
- package/src/testing.ts +3 -3
- package/src/types/Markdown.ts +2 -2
- package/src/types/MarkdownAction.ts +48 -18
- package/src/types/capabilities.ts +38 -0
- package/src/types/events.ts +13 -0
- package/src/types/index.ts +3 -0
- package/src/types/types.ts +3 -2
- package/src/util.test.ts +44 -0
- package/src/util.tsx +75 -5
- package/dist/lib/browser/MarkdownCard-TC3GGUSX.mjs +0 -12
- package/dist/lib/browser/MarkdownContainer-YF22DV4M.mjs +0 -15
- package/dist/lib/browser/anchor-sort-3MYLO74J.mjs.map +0 -7
- package/dist/lib/browser/app-graph-serializer-BZJ4TQOE.mjs +0 -51
- package/dist/lib/browser/app-graph-serializer-BZJ4TQOE.mjs.map +0 -7
- package/dist/lib/browser/blueprint-definition-HED54GGW.mjs +0 -13
- package/dist/lib/browser/chunk-3IPVL3E4.mjs +0 -20
- package/dist/lib/browser/chunk-3IPVL3E4.mjs.map +0 -7
- package/dist/lib/browser/chunk-BE3IO2CM.mjs.map +0 -7
- package/dist/lib/browser/chunk-BQTYJOFB.mjs +0 -28
- package/dist/lib/browser/chunk-BQTYJOFB.mjs.map +0 -7
- package/dist/lib/browser/chunk-CN35HEBX.mjs +0 -79
- package/dist/lib/browser/chunk-CN35HEBX.mjs.map +0 -7
- package/dist/lib/browser/chunk-DLZ5RR3P.mjs +0 -96
- package/dist/lib/browser/chunk-DLZ5RR3P.mjs.map +0 -7
- package/dist/lib/browser/chunk-IBCHVMZW.mjs +0 -16
- package/dist/lib/browser/chunk-IBCHVMZW.mjs.map +0 -7
- package/dist/lib/browser/chunk-OKNQ57GF.mjs +0 -51
- package/dist/lib/browser/chunk-OKNQ57GF.mjs.map +0 -7
- package/dist/lib/browser/chunk-V7P7EIWG.mjs +0 -829
- package/dist/lib/browser/chunk-V7P7EIWG.mjs.map +0 -7
- package/dist/lib/browser/intent-resolver-55ASQRIW.mjs +0 -62
- package/dist/lib/browser/intent-resolver-55ASQRIW.mjs.map +0 -7
- package/dist/lib/browser/react-surface-GPD6T435.mjs +0 -211
- package/dist/lib/browser/react-surface-GPD6T435.mjs.map +0 -7
- package/dist/lib/browser/settings-G3ZOXJQY.mjs +0 -28
- package/dist/lib/browser/settings-G3ZOXJQY.mjs.map +0 -7
- package/dist/lib/browser/state-BTUKVZHY.mjs +0 -37
- package/dist/lib/browser/state-BTUKVZHY.mjs.map +0 -7
- package/dist/lib/browser/toolkit.mjs +0 -13
- package/dist/lib/node-esm/MarkdownContainer-L75AIJFM.mjs +0 -16
- package/dist/lib/node-esm/anchor-sort-W4HCTYUQ.mjs.map +0 -7
- package/dist/lib/node-esm/app-graph-serializer-OCTHXWLF.mjs +0 -52
- package/dist/lib/node-esm/app-graph-serializer-OCTHXWLF.mjs.map +0 -7
- package/dist/lib/node-esm/blueprint-definition-HAQGJOMQ.mjs +0 -14
- package/dist/lib/node-esm/blueprint-definition-HAQGJOMQ.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-3DN4DPVA.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-7GN66TDQ.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-GMMVSXQ6.mjs +0 -17
- package/dist/lib/node-esm/chunk-GMMVSXQ6.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-SHAMSMKQ.mjs +0 -29
- package/dist/lib/node-esm/chunk-SHAMSMKQ.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-TYUGABTD.mjs +0 -22
- package/dist/lib/node-esm/chunk-TYUGABTD.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-UVLACSAE.mjs +0 -830
- package/dist/lib/node-esm/chunk-UVLACSAE.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-YFRTKXTB.mjs +0 -80
- package/dist/lib/node-esm/chunk-YFRTKXTB.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-ZNS55FS3.mjs +0 -97
- package/dist/lib/node-esm/chunk-ZNS55FS3.mjs.map +0 -7
- package/dist/lib/node-esm/intent-resolver-DTBVWCNO.mjs +0 -63
- package/dist/lib/node-esm/intent-resolver-DTBVWCNO.mjs.map +0 -7
- package/dist/lib/node-esm/react-surface-QWG7CJ5U.mjs +0 -212
- package/dist/lib/node-esm/react-surface-QWG7CJ5U.mjs.map +0 -7
- package/dist/lib/node-esm/settings-IBFFCGNL.mjs +0 -29
- package/dist/lib/node-esm/settings-IBFFCGNL.mjs.map +0 -7
- package/dist/lib/node-esm/state-K6EH7SRZ.mjs +0 -38
- package/dist/lib/node-esm/state-K6EH7SRZ.mjs.map +0 -7
- package/dist/lib/node-esm/toolkit.mjs +0 -14
- package/dist/lib/node-esm/toolkit.mjs.map +0 -7
- package/dist/types/src/capabilities/anchor-sort.d.ts +0 -4
- 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 -7
- 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/events.d.ts +0 -4
- package/dist/types/src/events.d.ts.map +0 -1
- package/dist/types/src/functions/create.d.ts.map +0 -1
- package/dist/types/src/functions/create.test.d.ts.map +0 -1
- package/dist/types/src/functions/index.d.ts +0 -18
- package/dist/types/src/functions/index.d.ts.map +0 -1
- package/dist/types/src/functions/open.d.ts.map +0 -1
- package/dist/types/src/functions/update.d.ts.map +0 -1
- package/dist/types/src/functions/update.test.d.ts.map +0 -1
- package/dist/types/src/toolkit.d.ts +0 -3
- package/dist/types/src/toolkit.d.ts.map +0 -1
- package/src/capabilities/anchor-sort.ts +0 -31
- package/src/capabilities/app-graph-serializer.ts +0 -54
- package/src/capabilities/artifact-definition.ts +0 -112
- package/src/capabilities/blueprint-definition.ts +0 -43
- package/src/capabilities/capabilities.ts +0 -22
- package/src/capabilities/intent-resolver.ts +0 -58
- package/src/capabilities/react-surface.tsx +0 -93
- package/src/capabilities/settings.ts +0 -25
- package/src/capabilities/state.ts +0 -31
- package/src/events.ts +0 -11
- package/src/functions/create.conversations.json +0 -1
- package/src/functions/index.ts +0 -13
- package/src/functions/update.conversations.json +0 -1
- package/src/toolkit.ts +0 -6
- /package/dist/lib/browser/{MarkdownCard-TC3GGUSX.mjs.map → MarkdownCard-WHK3ORP7.mjs.map} +0 -0
- /package/dist/lib/browser/{MarkdownContainer-YF22DV4M.mjs.map → MarkdownContainer-V7EAADMF.mjs.map} +0 -0
- /package/dist/lib/browser/{blueprint-definition-HED54GGW.mjs.map → blueprints/index.mjs.map} +0 -0
- /package/dist/lib/{browser/toolkit.mjs.map → node-esm/MarkdownCard-WJPLQTFS.mjs.map} +0 -0
- /package/dist/lib/node-esm/{MarkdownCard-FTEHVH7P.mjs.map → MarkdownContainer-LUSMORP2.mjs.map} +0 -0
- /package/dist/lib/node-esm/{MarkdownContainer-L75AIJFM.mjs.map → blueprints/index.mjs.map} +0 -0
- /package/dist/types/src/{functions → blueprints/functions}/create.d.ts +0 -0
- /package/dist/types/src/{functions → blueprints/functions}/create.test.d.ts +0 -0
- /package/dist/types/src/{functions → blueprints/functions}/open.d.ts +0 -0
- /package/dist/types/src/{functions → blueprints/functions}/update.d.ts +0 -0
- /package/dist/types/src/{functions → blueprints/functions}/update.test.d.ts +0 -0
|
@@ -6,8 +6,8 @@ import { describe, expect, it } from '@effect/vitest';
|
|
|
6
6
|
import * as Effect from 'effect/Effect';
|
|
7
7
|
import * as Layer from 'effect/Layer';
|
|
8
8
|
|
|
9
|
-
import { AiService, ConsolePrinter
|
|
10
|
-
import { TestAiService } from '@dxos/ai/testing';
|
|
9
|
+
import { AiService, ConsolePrinter } from '@dxos/ai';
|
|
10
|
+
import { MemoizedAiService, TestAiService } from '@dxos/ai/testing';
|
|
11
11
|
import {
|
|
12
12
|
AiConversation,
|
|
13
13
|
type ContextBinding,
|
|
@@ -18,14 +18,10 @@ import {
|
|
|
18
18
|
import { Blueprint } from '@dxos/blueprints';
|
|
19
19
|
import { SpaceProperties } from '@dxos/client-protocol';
|
|
20
20
|
import { Obj, Query, Ref } from '@dxos/echo';
|
|
21
|
-
import {
|
|
22
|
-
import {
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
FunctionInvocationService,
|
|
26
|
-
QueueService,
|
|
27
|
-
TracingService,
|
|
28
|
-
} from '@dxos/functions';
|
|
21
|
+
import { Database } from '@dxos/echo';
|
|
22
|
+
import { acquireReleaseResource } from '@dxos/effect';
|
|
23
|
+
import { TestHelpers } from '@dxos/effect/testing';
|
|
24
|
+
import { CredentialsService, FunctionInvocationService, QueueService, TracingService } from '@dxos/functions';
|
|
29
25
|
import { FunctionInvocationServiceLayerTest, TestDatabaseLayer } from '@dxos/functions-runtime/testing';
|
|
30
26
|
import { invariant } from '@dxos/invariant';
|
|
31
27
|
import { ObjectId } from '@dxos/keys';
|
|
@@ -33,19 +29,21 @@ import { Markdown } from '@dxos/plugin-markdown/types';
|
|
|
33
29
|
import { Collection } from '@dxos/schema';
|
|
34
30
|
import { HasSubject, type Message } from '@dxos/types';
|
|
35
31
|
|
|
36
|
-
import { WithProperties, testToolkit } from '
|
|
37
|
-
import
|
|
32
|
+
import { WithProperties, testToolkit } from '../../testing';
|
|
33
|
+
import * as MarkdownBlueprint from '../markdown-blueprint';
|
|
34
|
+
|
|
35
|
+
import update from './update';
|
|
38
36
|
|
|
39
37
|
ObjectId.dangerouslyDisableRandomness();
|
|
40
38
|
|
|
41
39
|
const TestLayer = Layer.mergeAll(
|
|
42
40
|
AiService.model('@anthropic/claude-opus-4-0'),
|
|
43
|
-
makeToolResolverFromFunctions(
|
|
41
|
+
makeToolResolverFromFunctions(MarkdownBlueprint.functions, testToolkit),
|
|
44
42
|
makeToolExecutionServiceFromFunctions(testToolkit, testToolkit.toLayer({}) as any),
|
|
45
43
|
).pipe(
|
|
46
44
|
Layer.provideMerge(
|
|
47
45
|
FunctionInvocationServiceLayerTest({
|
|
48
|
-
functions:
|
|
46
|
+
functions: MarkdownBlueprint.functions,
|
|
49
47
|
}),
|
|
50
48
|
),
|
|
51
49
|
Layer.provideMerge(
|
|
@@ -71,16 +69,16 @@ describe('update', () => {
|
|
|
71
69
|
name: 'BlueYard',
|
|
72
70
|
content: 'Founders and portfolio of BlueYard.',
|
|
73
71
|
});
|
|
74
|
-
yield*
|
|
72
|
+
yield* Database.Service.add(doc);
|
|
75
73
|
|
|
76
|
-
yield* FunctionInvocationService.invokeFunction(
|
|
74
|
+
yield* FunctionInvocationService.invokeFunction(update, {
|
|
77
75
|
id: doc.id,
|
|
78
76
|
diffs: ['- Founders', '+ # Founders'],
|
|
79
77
|
});
|
|
80
78
|
|
|
81
|
-
const updatedDoc = yield*
|
|
79
|
+
const updatedDoc = yield* Database.Service.resolve(Obj.getDXN(doc), Markdown.Document);
|
|
82
80
|
expect(updatedDoc.name).toBe(doc.name);
|
|
83
|
-
const text = yield*
|
|
81
|
+
const text = yield* Database.Service.load(updatedDoc.content);
|
|
84
82
|
expect(text.content).toBe('# Founders and portfolio of BlueYard.');
|
|
85
83
|
},
|
|
86
84
|
WithProperties,
|
|
@@ -94,10 +92,10 @@ describe('update', () => {
|
|
|
94
92
|
Effect.fnUntraced(
|
|
95
93
|
function* (_) {
|
|
96
94
|
const queue = yield* QueueService.createQueue<Message.Message | ContextBinding>();
|
|
97
|
-
const conversation = yield* acquireReleaseResource(() => new AiConversation(queue));
|
|
95
|
+
const conversation = yield* acquireReleaseResource(() => new AiConversation({ queue }));
|
|
98
96
|
|
|
99
|
-
yield*
|
|
100
|
-
const markdownBlueprint = yield*
|
|
97
|
+
yield* Database.Service.flush({ indexes: true });
|
|
98
|
+
const markdownBlueprint = yield* Database.Service.add(Obj.clone(MarkdownBlueprint.make()));
|
|
101
99
|
yield* Effect.promise(() =>
|
|
102
100
|
conversation.context.bind({
|
|
103
101
|
blueprints: [Ref.make(markdownBlueprint)],
|
|
@@ -111,7 +109,7 @@ describe('update', () => {
|
|
|
111
109
|
prompt: `Create a document with a cookie recipe.`,
|
|
112
110
|
});
|
|
113
111
|
{
|
|
114
|
-
const
|
|
112
|
+
const docs = yield* Database.Service.runQuery(Query.type(Markdown.Document));
|
|
115
113
|
if (docs.length !== 1) {
|
|
116
114
|
throw new Error(`Expected 1 document; got ${docs.length}: ${docs.map((_) => _.name)}`);
|
|
117
115
|
}
|
|
@@ -120,7 +118,7 @@ describe('update', () => {
|
|
|
120
118
|
invariant(Obj.instanceOf(Markdown.Document, doc));
|
|
121
119
|
console.log({
|
|
122
120
|
name: doc.name,
|
|
123
|
-
content: yield*
|
|
121
|
+
content: yield* Database.Service.load(doc.content).pipe(Effect.map((_) => _.content)),
|
|
124
122
|
});
|
|
125
123
|
}
|
|
126
124
|
|
|
@@ -129,7 +127,7 @@ describe('update', () => {
|
|
|
129
127
|
prompt: 'Add a section with a holiday-themed variation.',
|
|
130
128
|
});
|
|
131
129
|
{
|
|
132
|
-
const
|
|
130
|
+
const docs = yield* Database.Service.runQuery(Query.type(Markdown.Document));
|
|
133
131
|
if (docs.length !== 1) {
|
|
134
132
|
throw new Error(`Expected 1 document; got ${docs.length}: ${docs.map((_) => _.name)}`);
|
|
135
133
|
}
|
|
@@ -138,7 +136,7 @@ describe('update', () => {
|
|
|
138
136
|
invariant(Obj.instanceOf(Markdown.Document, doc));
|
|
139
137
|
console.log({
|
|
140
138
|
name: doc.name,
|
|
141
|
-
content: yield*
|
|
139
|
+
content: yield* Database.Service.load(doc.content).pipe(Effect.map((_) => _.content)),
|
|
142
140
|
});
|
|
143
141
|
}
|
|
144
142
|
},
|
|
@@ -6,11 +6,12 @@ import * as Effect from 'effect/Effect';
|
|
|
6
6
|
import * as Schema from 'effect/Schema';
|
|
7
7
|
|
|
8
8
|
import { ArtifactId, applyDiffs } from '@dxos/assistant';
|
|
9
|
+
import { Database } from '@dxos/echo';
|
|
9
10
|
import { createDocAccessor } from '@dxos/echo-db';
|
|
10
|
-
import {
|
|
11
|
+
import { defineFunction } from '@dxos/functions';
|
|
11
12
|
import { trim } from '@dxos/util';
|
|
12
13
|
|
|
13
|
-
import { Markdown } from '
|
|
14
|
+
import { Markdown } from '../../types';
|
|
14
15
|
|
|
15
16
|
// TODO(wittjosiah): Reconcile with ThreadAction.AddProposal.
|
|
16
17
|
export default defineFunction({
|
|
@@ -29,7 +30,7 @@ export default defineFunction({
|
|
|
29
30
|
}),
|
|
30
31
|
outputSchema: Schema.Void,
|
|
31
32
|
handler: Effect.fn(function* ({ data: { id, diffs } }) {
|
|
32
|
-
const object = yield*
|
|
33
|
+
const object = yield* Database.Service.resolve(ArtifactId.toDXN(id), Markdown.Document);
|
|
33
34
|
const content = yield* Effect.promise(() => object.content.load());
|
|
34
35
|
const accessor = createDocAccessor(content, ['content']);
|
|
35
36
|
applyDiffs(accessor, diffs);
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2025 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import { Blueprint, Template } from '@dxos/blueprints';
|
|
6
|
+
import { type FunctionDefinition } from '@dxos/functions';
|
|
7
|
+
import { trim } from '@dxos/util';
|
|
8
|
+
|
|
9
|
+
import { create, open, update } from './functions';
|
|
10
|
+
|
|
11
|
+
export const functions: FunctionDefinition[] = [create, open, update];
|
|
12
|
+
|
|
13
|
+
export const Key = 'dxos.org/blueprint/markdown';
|
|
14
|
+
|
|
15
|
+
export const make = () =>
|
|
16
|
+
Blueprint.make({
|
|
17
|
+
key: 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
|
+
});
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2025 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import * as Effect from 'effect/Effect';
|
|
6
|
+
|
|
7
|
+
import { Capability, Common } from '@dxos/app-framework';
|
|
8
|
+
import { Relation } from '@dxos/echo';
|
|
9
|
+
import { createDocAccessor, getRangeFromCursor } from '@dxos/echo-db';
|
|
10
|
+
import { type AnchoredTo } from '@dxos/types';
|
|
11
|
+
|
|
12
|
+
import { Markdown } from '../../types';
|
|
13
|
+
|
|
14
|
+
export default Capability.makeModule(() =>
|
|
15
|
+
Effect.succeed(
|
|
16
|
+
Capability.contributes(Common.Capability.AnchorSort, {
|
|
17
|
+
key: Markdown.Document.typename,
|
|
18
|
+
sort: (anchorA: AnchoredTo.AnchoredTo, anchorB: AnchoredTo.AnchoredTo) => {
|
|
19
|
+
const doc = Relation.getTarget(anchorA) as Markdown.Document;
|
|
20
|
+
const accessor = doc.content.target ? createDocAccessor(doc.content.target, ['content']) : undefined;
|
|
21
|
+
if (doc !== Relation.getTarget(anchorB) || !accessor) {
|
|
22
|
+
return 0;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
const getStartPosition = (cursor: string | undefined) => {
|
|
26
|
+
const range = cursor ? getRangeFromCursor(accessor, cursor) : undefined;
|
|
27
|
+
return range?.start ?? Number.MAX_SAFE_INTEGER;
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
const posA = getStartPosition(anchorA.anchor);
|
|
31
|
+
const posB = getStartPosition(anchorB.anchor);
|
|
32
|
+
return posA - posB;
|
|
33
|
+
},
|
|
34
|
+
}),
|
|
35
|
+
),
|
|
36
|
+
);
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2025 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import * as Effect from 'effect/Effect';
|
|
6
|
+
|
|
7
|
+
import { Capability, Common } from '@dxos/app-framework';
|
|
8
|
+
import { Obj } from '@dxos/echo';
|
|
9
|
+
import { SpaceOperation } from '@dxos/plugin-space/types';
|
|
10
|
+
import { isSpace } from '@dxos/react-client/echo';
|
|
11
|
+
import { Collection } from '@dxos/schema';
|
|
12
|
+
|
|
13
|
+
import { translations } from '../../translations';
|
|
14
|
+
import { Markdown, MarkdownOperation } from '../../types';
|
|
15
|
+
|
|
16
|
+
export default Capability.makeModule(
|
|
17
|
+
Effect.fnUntraced(function* () {
|
|
18
|
+
// Get context for lazy capability access in callbacks.
|
|
19
|
+
const capabilities = yield* Capability.Service;
|
|
20
|
+
|
|
21
|
+
return Capability.contributes(Common.Capability.AppGraphSerializer, [
|
|
22
|
+
{
|
|
23
|
+
inputType: Markdown.Document.typename,
|
|
24
|
+
outputType: 'text/markdown',
|
|
25
|
+
// Reconcile with metadata serializers.
|
|
26
|
+
serialize: async (node) => {
|
|
27
|
+
const doc = node.data;
|
|
28
|
+
const content = await doc.content.load();
|
|
29
|
+
return {
|
|
30
|
+
name:
|
|
31
|
+
doc.name ||
|
|
32
|
+
doc.fallbackName ||
|
|
33
|
+
translations[0]['en-US'][Markdown.Document.typename]['object name placeholder'],
|
|
34
|
+
data: content.content,
|
|
35
|
+
type: 'text/markdown',
|
|
36
|
+
};
|
|
37
|
+
},
|
|
38
|
+
deserialize: async (data, ancestors) => {
|
|
39
|
+
const space = ancestors.find(isSpace);
|
|
40
|
+
const target =
|
|
41
|
+
ancestors.findLast((ancestor) => Obj.instanceOf(Collection.Collection, ancestor)) ??
|
|
42
|
+
space?.properties[Collection.Collection.typename]?.target;
|
|
43
|
+
if (!space || !target) {
|
|
44
|
+
return;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
const { invokePromise } = capabilities.get(Common.Capability.OperationInvoker);
|
|
48
|
+
const createResult = await invokePromise(MarkdownOperation.Create, { name: data.name, content: data.data });
|
|
49
|
+
if (!createResult.data?.object) {
|
|
50
|
+
return undefined;
|
|
51
|
+
}
|
|
52
|
+
await invokePromise(SpaceOperation.AddObject, { target, object: createResult.data.object });
|
|
53
|
+
|
|
54
|
+
return createResult.data.object;
|
|
55
|
+
},
|
|
56
|
+
},
|
|
57
|
+
]);
|
|
58
|
+
}),
|
|
59
|
+
);
|
|
@@ -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 { Capability, Common } 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(Common.Capability.ArtifactDefinition, definition);
|
|
109
|
+
}),
|
|
110
|
+
);
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2025 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import * as Effect from 'effect/Effect';
|
|
6
|
+
|
|
7
|
+
import { Capability, Common } from '@dxos/app-framework';
|
|
8
|
+
|
|
9
|
+
import { MarkdownBlueprint } from '../../blueprints';
|
|
10
|
+
|
|
11
|
+
export const functions = MarkdownBlueprint.functions;
|
|
12
|
+
|
|
13
|
+
export type BlueprintCapabilities = [
|
|
14
|
+
Capability.Capability<typeof Common.Capability.Functions>,
|
|
15
|
+
Capability.Capability<typeof Common.Capability.BlueprintDefinition>,
|
|
16
|
+
];
|
|
17
|
+
|
|
18
|
+
const blueprintDefinition = Capability.makeModule<[], BlueprintCapabilities>(() =>
|
|
19
|
+
Effect.succeed([
|
|
20
|
+
Capability.contributes(Common.Capability.Functions, functions),
|
|
21
|
+
Capability.contributes(Common.Capability.BlueprintDefinition, MarkdownBlueprint.make()),
|
|
22
|
+
]),
|
|
23
|
+
);
|
|
24
|
+
|
|
25
|
+
export default blueprintDefinition;
|
|
@@ -2,15 +2,10 @@
|
|
|
2
2
|
// Copyright 2025 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
export const AnchorSort: any = 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
|
-
|
|
5
|
+
export * from './anchor-sort';
|
|
6
|
+
export * from './app-graph-serializer';
|
|
15
7
|
export * from './blueprint-definition';
|
|
16
|
-
export * from './
|
|
8
|
+
export * from './operation-resolver';
|
|
9
|
+
export * from './react-surface';
|
|
10
|
+
export * from './settings';
|
|
11
|
+
export * from './state';
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2025 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import * as Effect from 'effect/Effect';
|
|
6
|
+
|
|
7
|
+
import { Capability, Common } from '@dxos/app-framework';
|
|
8
|
+
import { Obj, Ref, Type } from '@dxos/echo';
|
|
9
|
+
import { OperationResolver } from '@dxos/operation';
|
|
10
|
+
import { Collection } from '@dxos/schema';
|
|
11
|
+
|
|
12
|
+
import { Markdown, MarkdownCapabilities, MarkdownOperation } from '../../types';
|
|
13
|
+
|
|
14
|
+
export default Capability.makeModule(
|
|
15
|
+
Effect.fnUntraced(function* () {
|
|
16
|
+
return Capability.contributes(Common.Capability.OperationResolver, [
|
|
17
|
+
OperationResolver.make({
|
|
18
|
+
operation: MarkdownOperation.OnCreateSpace,
|
|
19
|
+
handler: Effect.fnUntraced(function* ({ rootCollection }) {
|
|
20
|
+
const collection = Collection.makeManaged({ key: Type.getTypename(Markdown.Document) });
|
|
21
|
+
Obj.change(rootCollection, (c) => {
|
|
22
|
+
c.objects.push(Ref.make(collection));
|
|
23
|
+
});
|
|
24
|
+
}),
|
|
25
|
+
}),
|
|
26
|
+
OperationResolver.make({
|
|
27
|
+
operation: MarkdownOperation.Create,
|
|
28
|
+
handler: ({ name, content }) =>
|
|
29
|
+
Effect.succeed({
|
|
30
|
+
object: Markdown.make({ name, content }),
|
|
31
|
+
}),
|
|
32
|
+
}),
|
|
33
|
+
// TODO(wittjosiah): This appears to be unused.
|
|
34
|
+
OperationResolver.make({
|
|
35
|
+
operation: MarkdownOperation.SetViewMode,
|
|
36
|
+
handler: Effect.fnUntraced(function* ({ id, viewMode }) {
|
|
37
|
+
yield* Common.Capability.updateAtomValue(MarkdownCapabilities.State, (current) => ({
|
|
38
|
+
...current,
|
|
39
|
+
viewMode: { ...current.viewMode, [id]: viewMode },
|
|
40
|
+
}));
|
|
41
|
+
}),
|
|
42
|
+
}),
|
|
43
|
+
]);
|
|
44
|
+
}),
|
|
45
|
+
);
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2025 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import * as Effect from 'effect/Effect';
|
|
6
|
+
import React, { forwardRef, useCallback, useMemo } from 'react';
|
|
7
|
+
|
|
8
|
+
import { Capability, Common } from '@dxos/app-framework';
|
|
9
|
+
import {
|
|
10
|
+
type SurfaceComponentProps,
|
|
11
|
+
useAtomCapability,
|
|
12
|
+
useAtomCapabilityState,
|
|
13
|
+
useCapability,
|
|
14
|
+
useSettingsState,
|
|
15
|
+
} from '@dxos/app-framework/react';
|
|
16
|
+
import { Obj } from '@dxos/echo';
|
|
17
|
+
import { AttentionCapabilities } from '@dxos/plugin-attention';
|
|
18
|
+
import { Text } from '@dxos/schema';
|
|
19
|
+
import { type EditorViewMode } from '@dxos/ui-editor';
|
|
20
|
+
|
|
21
|
+
import { MarkdownCard, MarkdownContainer, type MarkdownContainerProps, MarkdownSettings } from '../../components';
|
|
22
|
+
import { meta } from '../../meta';
|
|
23
|
+
import { Markdown, MarkdownCapabilities } from '../../types';
|
|
24
|
+
|
|
25
|
+
export default Capability.makeModule(() =>
|
|
26
|
+
Effect.succeed(
|
|
27
|
+
Capability.contributes(Common.Capability.ReactSurface, [
|
|
28
|
+
Common.createSurface({
|
|
29
|
+
id: `${meta.id}/surface/document`,
|
|
30
|
+
role: ['article', 'section', 'tabpanel'],
|
|
31
|
+
filter: (data): data is { subject: Markdown.Document; variant: undefined } =>
|
|
32
|
+
Obj.instanceOf(Markdown.Document, data.subject) && !data.variant,
|
|
33
|
+
component: ({ data, role, ref }) => {
|
|
34
|
+
return <Container id={Obj.getDXN(data.subject).toString()} subject={data.subject} role={role} ref={ref} />;
|
|
35
|
+
},
|
|
36
|
+
}),
|
|
37
|
+
Common.createSurface({
|
|
38
|
+
id: `${meta.id}/surface/text`,
|
|
39
|
+
role: ['article', 'section', 'tabpanel'],
|
|
40
|
+
filter: (data): data is { id: string; subject: Text.Text } =>
|
|
41
|
+
typeof data.id === 'string' && Obj.instanceOf(Text.Text, data.subject),
|
|
42
|
+
component: ({ data, role }) => {
|
|
43
|
+
return <Container id={data.id} subject={data.subject} role={role} />;
|
|
44
|
+
},
|
|
45
|
+
}),
|
|
46
|
+
Common.createSurface({
|
|
47
|
+
id: `${meta.id}/surface/plugin-settings`,
|
|
48
|
+
role: 'article',
|
|
49
|
+
filter: (data): data is { subject: Common.Capability.Settings } =>
|
|
50
|
+
Common.Capability.isSettings(data.subject) && data.subject.prefix === meta.id,
|
|
51
|
+
component: ({ data: { subject } }) => {
|
|
52
|
+
const { settings, updateSettings } = useSettingsState<Markdown.Settings>(subject.atom);
|
|
53
|
+
return <MarkdownSettings settings={settings} onSettingsChange={updateSettings} />;
|
|
54
|
+
},
|
|
55
|
+
}),
|
|
56
|
+
Common.createSurface({
|
|
57
|
+
id: `${meta.id}/surface/preview`,
|
|
58
|
+
role: 'card--content',
|
|
59
|
+
filter: (data): data is { subject: Markdown.Document | Text.Text } =>
|
|
60
|
+
Obj.instanceOf(Markdown.Document, data.subject) || Obj.instanceOf(Text.Text, data.subject),
|
|
61
|
+
component: ({ data }) => <MarkdownCard {...data} />,
|
|
62
|
+
}),
|
|
63
|
+
]),
|
|
64
|
+
),
|
|
65
|
+
);
|
|
66
|
+
|
|
67
|
+
/**
|
|
68
|
+
* Common wrapper.
|
|
69
|
+
*/
|
|
70
|
+
const Container = forwardRef<HTMLDivElement, SurfaceComponentProps<Markdown.Document | Text.Text, { id: string }>>(
|
|
71
|
+
({ id, subject, role }, forwardedRef) => {
|
|
72
|
+
const selectionManager = useCapability(AttentionCapabilities.Selection);
|
|
73
|
+
const settings = useAtomCapability(MarkdownCapabilities.Settings);
|
|
74
|
+
const [state, setState] = useAtomCapabilityState(MarkdownCapabilities.State);
|
|
75
|
+
const editorState = useCapability(MarkdownCapabilities.EditorState);
|
|
76
|
+
const extensions = useCapability(MarkdownCapabilities.Extensions);
|
|
77
|
+
const extensionProviders = useMemo(() => extensions.flat(), [extensions]);
|
|
78
|
+
|
|
79
|
+
const viewMode: EditorViewMode = (id && state.viewMode[id]) || settings?.defaultViewMode || 'source';
|
|
80
|
+
const handleViewModeChange = useCallback<NonNullable<MarkdownContainerProps['onViewModeChange']>>(
|
|
81
|
+
(mode) => setState((current) => ({ ...current, viewMode: { ...current.viewMode, [id]: mode } })),
|
|
82
|
+
[id, setState],
|
|
83
|
+
);
|
|
84
|
+
|
|
85
|
+
return (
|
|
86
|
+
<MarkdownContainer
|
|
87
|
+
role={role}
|
|
88
|
+
subject={subject}
|
|
89
|
+
id={id}
|
|
90
|
+
settings={settings}
|
|
91
|
+
selectionManager={selectionManager}
|
|
92
|
+
extensionProviders={extensionProviders}
|
|
93
|
+
editorStateStore={editorState}
|
|
94
|
+
viewMode={viewMode}
|
|
95
|
+
onViewModeChange={handleViewModeChange}
|
|
96
|
+
ref={forwardedRef}
|
|
97
|
+
/>
|
|
98
|
+
);
|
|
99
|
+
},
|
|
100
|
+
);
|