@dxos/assistant-toolkit 0.8.4-main.ae835ea → 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/neutral/chunk-J5LGTIGS.mjs +10 -0
- package/dist/lib/neutral/chunk-J5LGTIGS.mjs.map +7 -0
- package/dist/lib/{browser → neutral}/index.mjs +2989 -1842
- package/dist/lib/neutral/index.mjs.map +7 -0
- package/dist/lib/neutral/meta.json +1 -0
- package/dist/lib/neutral/testing/index.mjs +81 -0
- package/dist/lib/neutral/testing/index.mjs.map +7 -0
- package/dist/types/src/blueprints/browser/blueprint.d.ts +4 -0
- package/dist/types/src/blueprints/browser/blueprint.d.ts.map +1 -0
- package/dist/types/src/blueprints/browser/blueprint.test.d.ts +2 -0
- package/dist/types/src/blueprints/browser/blueprint.test.d.ts.map +1 -0
- package/dist/types/src/blueprints/browser/index.d.ts +2 -0
- package/dist/types/src/blueprints/browser/index.d.ts.map +1 -0
- package/dist/types/src/blueprints/database/blueprint.d.ts +4 -0
- package/dist/types/src/blueprints/database/blueprint.d.ts.map +1 -0
- package/dist/types/src/blueprints/database/blueprint.test.d.ts +2 -0
- package/dist/types/src/blueprints/database/blueprint.test.d.ts.map +1 -0
- package/dist/types/src/blueprints/database/functions/context-add.d.ts +6 -0
- package/dist/types/src/blueprints/database/functions/context-add.d.ts.map +1 -0
- package/dist/types/src/blueprints/database/functions/context-remove.d.ts +6 -0
- package/dist/types/src/blueprints/database/functions/context-remove.d.ts.map +1 -0
- package/dist/types/src/blueprints/database/functions/index.d.ts +57 -0
- package/dist/types/src/blueprints/database/functions/index.d.ts.map +1 -0
- package/dist/types/src/blueprints/database/functions/load.d.ts +6 -0
- package/dist/types/src/blueprints/database/functions/load.d.ts.map +1 -0
- package/dist/types/src/blueprints/database/functions/object-create.d.ts +6 -0
- package/dist/types/src/blueprints/database/functions/object-create.d.ts.map +1 -0
- package/dist/types/src/blueprints/database/functions/object-delete.d.ts +6 -0
- package/dist/types/src/blueprints/database/functions/object-delete.d.ts.map +1 -0
- package/dist/types/src/blueprints/database/functions/object-update.d.ts +9 -0
- package/dist/types/src/blueprints/database/functions/object-update.d.ts.map +1 -0
- package/dist/types/src/blueprints/database/functions/query.d.ts +9 -0
- package/dist/types/src/blueprints/database/functions/query.d.ts.map +1 -0
- package/dist/types/src/blueprints/database/functions/relation-create.d.ts +9 -0
- package/dist/types/src/blueprints/database/functions/relation-create.d.ts.map +1 -0
- package/dist/types/src/blueprints/database/functions/relation-delete.d.ts +6 -0
- package/dist/types/src/blueprints/database/functions/relation-delete.d.ts.map +1 -0
- package/dist/types/src/blueprints/database/functions/schema-add.d.ts +7 -0
- package/dist/types/src/blueprints/database/functions/schema-add.d.ts.map +1 -0
- package/dist/types/src/blueprints/database/functions/schema-list.d.ts +5 -0
- package/dist/types/src/blueprints/database/functions/schema-list.d.ts.map +1 -0
- package/dist/types/src/blueprints/database/functions/tag-add.d.ts +7 -0
- package/dist/types/src/blueprints/database/functions/tag-add.d.ts.map +1 -0
- package/dist/types/src/blueprints/database/functions/tag-remove.d.ts +7 -0
- package/dist/types/src/blueprints/database/functions/tag-remove.d.ts.map +1 -0
- package/dist/types/src/blueprints/database/index.d.ts +3 -0
- package/dist/types/src/blueprints/database/index.d.ts.map +1 -0
- package/dist/types/src/blueprints/design/blueprint.d.ts +4 -0
- package/dist/types/src/blueprints/design/blueprint.d.ts.map +1 -0
- package/dist/types/src/blueprints/design/blueprint.test.d.ts +2 -0
- package/dist/types/src/blueprints/design/blueprint.test.d.ts.map +1 -0
- package/dist/types/src/blueprints/design/index.d.ts +1 -2
- package/dist/types/src/blueprints/design/index.d.ts.map +1 -1
- package/dist/types/src/blueprints/discord/blueprint.d.ts +4 -0
- package/dist/types/src/blueprints/discord/blueprint.d.ts.map +1 -0
- package/dist/types/src/{functions/discord → blueprints/discord/functions}/fetch-messages.d.ts +1 -1
- package/dist/types/src/blueprints/discord/functions/fetch-messages.d.ts.map +1 -0
- package/dist/types/src/blueprints/discord/functions/fetch-messages.test.d.ts.map +1 -0
- package/dist/types/src/{functions/discord → blueprints/discord/functions}/index.d.ts +4 -4
- package/dist/types/src/blueprints/discord/functions/index.d.ts.map +1 -0
- package/dist/types/src/blueprints/discord/index.d.ts +1 -2
- package/dist/types/src/blueprints/discord/index.d.ts.map +1 -1
- package/dist/types/src/{functions/github → blueprints/github/functions}/fetch-prs.d.ts +1 -1
- package/dist/types/src/blueprints/github/functions/fetch-prs.d.ts.map +1 -0
- package/dist/types/src/blueprints/github/functions/index.d.ts +7 -0
- package/dist/types/src/blueprints/github/functions/index.d.ts.map +1 -0
- package/dist/types/src/blueprints/github/index.d.ts +1 -0
- package/dist/types/src/blueprints/github/index.d.ts.map +1 -0
- package/dist/types/src/blueprints/index.d.ts +10 -6
- package/dist/types/src/blueprints/index.d.ts.map +1 -1
- package/dist/types/src/blueprints/linear/blueprint.d.ts +4 -0
- package/dist/types/src/blueprints/linear/blueprint.d.ts.map +1 -0
- package/dist/types/src/blueprints/linear/functions/index.d.ts +9 -0
- package/dist/types/src/blueprints/linear/functions/index.d.ts.map +1 -0
- package/dist/types/src/blueprints/linear/functions/linear.test.d.ts.map +1 -0
- package/dist/types/src/{functions/linear → blueprints/linear/functions}/sync-issues.d.ts +2 -2
- package/dist/types/src/blueprints/linear/functions/sync-issues.d.ts.map +1 -0
- package/dist/types/src/blueprints/linear/index.d.ts +1 -2
- package/dist/types/src/blueprints/linear/index.d.ts.map +1 -1
- 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/{functions/research/create-document.d.ts → blueprints/markdown/functions/create.d.ts} +2 -3
- package/dist/types/src/blueprints/markdown/functions/create.d.ts.map +1 -0
- package/dist/types/src/blueprints/markdown/functions/index.d.ts +30 -0
- package/dist/types/src/blueprints/markdown/functions/index.d.ts.map +1 -0
- package/dist/types/src/blueprints/markdown/functions/read.d.ts +14 -0
- package/dist/types/src/blueprints/markdown/functions/read.d.ts.map +1 -0
- package/dist/types/src/blueprints/markdown/functions/update.d.ts +13 -0
- package/dist/types/src/blueprints/markdown/functions/update.d.ts.map +1 -0
- package/dist/types/src/blueprints/markdown/index.d.ts +3 -0
- package/dist/types/src/blueprints/markdown/index.d.ts.map +1 -0
- package/dist/types/src/blueprints/planning/blueprint.d.ts +4 -0
- package/dist/types/src/blueprints/planning/blueprint.d.ts.map +1 -0
- package/dist/types/src/blueprints/planning/functions/index.d.ts +10 -0
- package/dist/types/src/blueprints/planning/functions/index.d.ts.map +1 -0
- package/dist/types/src/blueprints/planning/functions/update-tasks.d.ts +9 -0
- package/dist/types/src/blueprints/planning/functions/update-tasks.d.ts.map +1 -0
- package/dist/types/src/blueprints/planning/index.d.ts +1 -2
- package/dist/types/src/blueprints/planning/index.d.ts.map +1 -1
- package/dist/types/src/blueprints/planning-old/blueprint.d.ts +4 -0
- package/dist/types/src/blueprints/planning-old/blueprint.d.ts.map +1 -0
- package/dist/types/src/blueprints/planning-old/blueprint.test.d.ts +2 -0
- package/dist/types/src/blueprints/planning-old/blueprint.test.d.ts.map +1 -0
- package/dist/types/src/blueprints/planning-old/functions/index.d.ts +29 -0
- package/dist/types/src/blueprints/planning-old/functions/index.d.ts.map +1 -0
- package/dist/types/src/blueprints/planning-old/functions/read.d.ts +14 -0
- package/dist/types/src/blueprints/planning-old/functions/read.d.ts.map +1 -0
- package/dist/types/src/blueprints/planning-old/functions/task-list.d.ts.map +1 -0
- package/dist/types/src/blueprints/planning-old/functions/task-list.test.d.ts.map +1 -0
- package/dist/types/src/blueprints/planning-old/functions/update.d.ts +16 -0
- package/dist/types/src/blueprints/planning-old/functions/update.d.ts.map +1 -0
- package/dist/types/src/blueprints/planning-old/index.d.ts +2 -0
- package/dist/types/src/blueprints/planning-old/index.d.ts.map +1 -0
- package/dist/types/src/blueprints/project/blueprint.d.ts +4 -0
- package/dist/types/src/blueprints/project/blueprint.d.ts.map +1 -0
- package/dist/types/src/blueprints/project/blueprint.test.d.ts +2 -0
- package/dist/types/src/blueprints/project/blueprint.test.d.ts.map +1 -0
- package/dist/types/src/blueprints/project/functions/add-artifact.d.ts +7 -0
- package/dist/types/src/blueprints/project/functions/add-artifact.d.ts.map +1 -0
- package/dist/types/src/blueprints/project/functions/agent.d.ts +62 -0
- package/dist/types/src/blueprints/project/functions/agent.d.ts.map +1 -0
- package/dist/types/src/blueprints/project/functions/get-context.d.ts +13 -0
- package/dist/types/src/blueprints/project/functions/get-context.d.ts.map +1 -0
- package/dist/types/src/blueprints/project/functions/index.d.ts +133 -0
- package/dist/types/src/blueprints/project/functions/index.d.ts.map +1 -0
- package/dist/types/src/blueprints/project/functions/qualifier.d.ts +60 -0
- package/dist/types/src/blueprints/project/functions/qualifier.d.ts.map +1 -0
- package/dist/types/src/blueprints/project/index.d.ts +3 -0
- package/dist/types/src/blueprints/project/index.d.ts.map +1 -0
- package/dist/types/src/blueprints/research/blueprint.d.ts +4 -0
- package/dist/types/src/blueprints/research/blueprint.d.ts.map +1 -0
- package/dist/types/src/blueprints/research/blueprint.test.d.ts +2 -0
- package/dist/types/src/blueprints/research/blueprint.test.d.ts.map +1 -0
- package/dist/types/src/blueprints/research/functions/document-create.d.ts +10 -0
- package/dist/types/src/blueprints/research/functions/document-create.d.ts.map +1 -0
- package/dist/types/src/blueprints/research/functions/index.d.ts +19 -0
- package/dist/types/src/blueprints/research/functions/index.d.ts.map +1 -0
- package/dist/types/src/{functions/research → blueprints/research/functions}/research.d.ts +4 -3
- package/dist/types/src/blueprints/research/functions/research.d.ts.map +1 -0
- package/dist/types/src/blueprints/research/functions/research.test.d.ts.map +1 -0
- package/dist/types/src/blueprints/research/index.d.ts +2 -2
- package/dist/types/src/blueprints/research/index.d.ts.map +1 -1
- package/dist/types/src/blueprints/research/types/ResearchGraph.d.ts +18 -0
- package/dist/types/src/blueprints/research/types/ResearchGraph.d.ts.map +1 -0
- package/dist/types/src/blueprints/research/types/index.d.ts +7 -0
- package/dist/types/src/blueprints/research/types/index.d.ts.map +1 -0
- package/dist/types/src/blueprints/testing.d.ts +18 -4
- package/dist/types/src/blueprints/testing.d.ts.map +1 -1
- package/dist/types/src/blueprints/websearch/blueprint.d.ts +4 -0
- package/dist/types/src/blueprints/websearch/blueprint.d.ts.map +1 -0
- package/dist/types/src/blueprints/websearch/index.d.ts +2 -3
- package/dist/types/src/blueprints/websearch/index.d.ts.map +1 -1
- package/dist/types/src/blueprints/websearch/{websearch-toolkit.d.ts → toolkit.d.ts} +2 -1
- package/dist/types/src/blueprints/websearch/toolkit.d.ts.map +1 -0
- package/dist/types/src/{functions/research → crud}/graph.d.ts +14 -11
- package/dist/types/src/crud/graph.d.ts.map +1 -0
- package/dist/types/src/crud/graph.test.d.ts.map +1 -0
- package/dist/types/src/crud/index.d.ts +2 -0
- package/dist/types/src/crud/index.d.ts.map +1 -0
- package/dist/types/src/functions/agent/index.d.ts +84 -4
- package/dist/types/src/functions/agent/index.d.ts.map +1 -1
- package/dist/types/src/functions/agent/prompt.d.ts +81 -8
- package/dist/types/src/functions/agent/prompt.d.ts.map +1 -1
- package/dist/types/src/functions/entity-extraction/entity-extraction.d.ts +142 -136
- package/dist/types/src/functions/entity-extraction/entity-extraction.d.ts.map +1 -1
- package/dist/types/src/functions/entity-extraction/index.d.ts +144 -139
- package/dist/types/src/functions/entity-extraction/index.d.ts.map +1 -1
- package/dist/types/src/functions/exa/data/exa-search-1748337321991.d.ts.map +1 -0
- package/dist/types/src/functions/exa/data/exa-search-1748337331526.d.ts.map +1 -0
- package/dist/types/src/functions/exa/data/exa-search-1748337344119.d.ts.map +1 -0
- package/dist/types/src/functions/exa/data/index.d.ts.map +1 -0
- package/dist/types/src/functions/exa/exa.d.ts +1 -1
- package/dist/types/src/functions/exa/index.d.ts +8 -2
- package/dist/types/src/functions/exa/index.d.ts.map +1 -1
- package/dist/types/src/functions/exa/mock.d.ts +1 -1
- package/dist/types/src/functions/index.d.ts +1 -5
- package/dist/types/src/functions/index.d.ts.map +1 -1
- package/dist/types/src/index.d.ts +3 -1
- package/dist/types/src/index.d.ts.map +1 -1
- package/dist/types/src/sync/sync.d.ts +3 -3
- package/dist/types/src/sync/sync.d.ts.map +1 -1
- package/dist/types/src/testing/index.d.ts +2 -1
- package/dist/types/src/testing/index.d.ts.map +1 -1
- package/dist/types/src/testing/plugins.d.ts +19 -0
- package/dist/types/src/testing/plugins.d.ts.map +1 -0
- package/dist/types/src/toolkits/WebToolkit.d.ts +38 -0
- package/dist/types/src/toolkits/WebToolkit.d.ts.map +1 -0
- package/dist/types/src/toolkits/index.d.ts +2 -0
- package/dist/types/src/toolkits/index.d.ts.map +1 -0
- package/dist/types/src/types/Chat.d.ts +31 -0
- package/dist/types/src/types/Chat.d.ts.map +1 -0
- package/dist/types/src/types/Plan.d.ts +77 -0
- package/dist/types/src/types/Plan.d.ts.map +1 -0
- package/dist/types/src/types/Project.d.ts +67 -0
- package/dist/types/src/types/Project.d.ts.map +1 -0
- package/dist/types/src/types/index.d.ts +4 -0
- package/dist/types/src/types/index.d.ts.map +1 -0
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +49 -38
- package/src/blueprints/browser/blueprint.conversations.json +1 -0
- package/src/blueprints/browser/blueprint.test.ts +70 -0
- package/src/blueprints/browser/blueprint.ts +41 -0
- package/src/blueprints/browser/index.ts +5 -0
- package/src/blueprints/database/blueprint.conversations.json +1 -0
- package/src/blueprints/database/blueprint.test.ts +321 -0
- package/src/blueprints/database/blueprint.ts +39 -0
- package/src/blueprints/database/functions/context-add.ts +35 -0
- package/src/blueprints/database/functions/context-remove.ts +35 -0
- package/src/blueprints/database/functions/index.ts +33 -0
- package/src/blueprints/database/functions/load.ts +31 -0
- package/src/blueprints/database/functions/object-create.ts +35 -0
- package/src/blueprints/database/functions/object-delete.ts +27 -0
- package/src/blueprints/database/functions/object-update.ts +32 -0
- package/src/blueprints/database/functions/query.ts +126 -0
- package/src/blueprints/database/functions/relation-create.ts +47 -0
- package/src/blueprints/database/functions/relation-delete.ts +28 -0
- package/src/blueprints/database/functions/schema-add.ts +40 -0
- package/src/blueprints/database/functions/schema-list.ts +34 -0
- package/src/blueprints/database/functions/tag-add.ts +31 -0
- package/src/blueprints/database/functions/tag-remove.ts +30 -0
- package/src/blueprints/database/index.ts +6 -0
- package/src/blueprints/design/{design-blueprint.test.ts → blueprint.test.ts} +25 -37
- package/src/blueprints/design/blueprint.ts +46 -0
- package/src/blueprints/design/index.ts +1 -3
- package/src/blueprints/discord/blueprint.ts +46 -0
- package/src/{functions/discord → blueprints/discord/functions}/fetch-messages.test.ts +10 -14
- package/src/{functions/discord → blueprints/discord/functions}/fetch-messages.ts +11 -10
- package/src/blueprints/discord/functions/index.ts +9 -0
- package/src/blueprints/discord/index.ts +1 -3
- package/src/{functions/github → blueprints/github/functions}/fetch-prs.ts +3 -2
- package/src/blueprints/github/functions/index.ts +9 -0
- package/src/blueprints/github/index.ts +3 -0
- package/src/blueprints/index.ts +10 -6
- package/src/blueprints/linear/blueprint.ts +47 -0
- package/src/blueprints/linear/functions/index.ts +9 -0
- package/src/blueprints/linear/functions/linear.test.ts +58 -0
- package/src/{functions/linear → blueprints/linear/functions}/sync-issues.ts +17 -15
- package/src/blueprints/linear/index.ts +1 -3
- package/src/blueprints/markdown/blueprint.ts +38 -0
- package/src/blueprints/markdown/functions/create.ts +29 -0
- package/src/blueprints/markdown/functions/index.ts +13 -0
- package/src/blueprints/markdown/functions/read.ts +32 -0
- package/src/{functions/document → blueprints/markdown/functions}/update.ts +9 -7
- package/src/blueprints/markdown/index.ts +6 -0
- package/src/blueprints/planning/blueprint.ts +28 -0
- package/src/blueprints/planning/functions/index.ts +9 -0
- package/src/blueprints/planning/functions/update-tasks.ts +168 -0
- package/src/blueprints/planning/index.ts +2 -4
- package/src/blueprints/{planning/planning-blueprint.test.ts → planning-old/blueprint.test.ts} +25 -32
- package/src/blueprints/{planning/planning-blueprint.ts → planning-old/blueprint.ts} +24 -12
- package/src/blueprints/planning-old/functions/index.ts +11 -0
- package/src/{functions/tasks → blueprints/planning-old/functions}/read.ts +6 -6
- package/src/{functions/tasks → blueprints/planning-old/functions}/update.ts +6 -6
- package/src/blueprints/planning-old/index.ts +5 -0
- package/src/blueprints/project/blueprint.test.ts +579 -0
- package/src/blueprints/project/blueprint.ts +68 -0
- package/src/blueprints/project/functions/add-artifact.ts +41 -0
- package/src/blueprints/project/functions/agent.ts +72 -0
- package/src/blueprints/project/functions/get-context.ts +63 -0
- package/src/blueprints/project/functions/index.ts +15 -0
- package/src/blueprints/project/functions/qualifier.ts +96 -0
- package/src/blueprints/project/index.ts +6 -0
- package/src/blueprints/research/blueprint.ts +65 -0
- package/src/blueprints/research/functions/document-create.ts +73 -0
- package/src/blueprints/research/functions/index.ts +11 -0
- package/src/{functions/research/instructions-research.tpl → blueprints/research/functions/research-instructions.tpl} +14 -6
- package/src/blueprints/research/functions/research.conversations.json +1 -0
- package/src/blueprints/research/functions/research.test.ts +149 -0
- package/src/blueprints/research/functions/research.ts +175 -0
- package/src/blueprints/research/index.ts +2 -3
- package/src/blueprints/research/types/ResearchGraph.ts +49 -0
- package/src/blueprints/research/types/index.ts +32 -0
- package/src/blueprints/testing.ts +36 -5
- package/src/blueprints/websearch/blueprint.ts +32 -0
- package/src/blueprints/websearch/index.ts +2 -4
- package/src/crud/graph.test.ts +46 -0
- package/src/{functions/research → crud}/graph.ts +32 -40
- package/src/crud/index.ts +5 -0
- package/src/functions/READ_THIS.md +5 -0
- package/src/functions/agent/index.ts +4 -6
- package/src/functions/agent/prompt.ts +32 -25
- package/src/functions/entity-extraction/entity-extraction.conversations.json +1 -1
- package/src/functions/entity-extraction/entity-extraction.test.ts +17 -43
- package/src/functions/entity-extraction/entity-extraction.ts +54 -36
- package/src/functions/entity-extraction/index.ts +4 -4
- package/src/functions/exa/exa.ts +2 -2
- package/src/functions/exa/index.ts +7 -2
- package/src/functions/exa/mock.ts +1 -1
- package/src/functions/index.ts +1 -5
- package/src/index.ts +3 -1
- package/src/sync/sync.ts +38 -30
- package/src/testing/index.ts +2 -1
- package/src/testing/plugins.tsx +72 -0
- package/src/toolkits/WebToolkit.ts +33 -0
- package/src/toolkits/index.ts +5 -0
- package/src/types/Chat.ts +49 -0
- package/src/types/Plan.ts +107 -0
- package/src/types/Project.ts +196 -0
- package/src/types/index.ts +7 -0
- package/dist/lib/browser/index.mjs.map +0 -7
- package/dist/lib/browser/meta.json +0 -1
- package/dist/lib/node-esm/index.mjs +0 -2483
- package/dist/lib/node-esm/index.mjs.map +0 -7
- package/dist/lib/node-esm/meta.json +0 -1
- package/dist/types/src/blueprints/design/design-blueprint.d.ts +0 -4
- package/dist/types/src/blueprints/design/design-blueprint.d.ts.map +0 -1
- package/dist/types/src/blueprints/design/design-blueprint.test.d.ts +0 -2
- package/dist/types/src/blueprints/design/design-blueprint.test.d.ts.map +0 -1
- package/dist/types/src/blueprints/discord/discord-blueprint.d.ts +0 -18
- package/dist/types/src/blueprints/discord/discord-blueprint.d.ts.map +0 -1
- package/dist/types/src/blueprints/linear/linear-blueprint.d.ts +0 -18
- package/dist/types/src/blueprints/linear/linear-blueprint.d.ts.map +0 -1
- package/dist/types/src/blueprints/planning/planning-blueprint.d.ts +0 -4
- package/dist/types/src/blueprints/planning/planning-blueprint.d.ts.map +0 -1
- package/dist/types/src/blueprints/planning/planning-blueprint.test.d.ts +0 -2
- package/dist/types/src/blueprints/planning/planning-blueprint.test.d.ts.map +0 -1
- package/dist/types/src/blueprints/research/research-blueprint.d.ts +0 -4
- package/dist/types/src/blueprints/research/research-blueprint.d.ts.map +0 -1
- package/dist/types/src/blueprints/research/research-blueprint.test.d.ts +0 -2
- package/dist/types/src/blueprints/research/research-blueprint.test.d.ts.map +0 -1
- package/dist/types/src/blueprints/websearch/websearch-blueprint.d.ts +0 -4
- package/dist/types/src/blueprints/websearch/websearch-blueprint.d.ts.map +0 -1
- package/dist/types/src/blueprints/websearch/websearch-toolkit.d.ts.map +0 -1
- package/dist/types/src/experimental/feed.test.d.ts +0 -2
- package/dist/types/src/experimental/feed.test.d.ts.map +0 -1
- package/dist/types/src/functions/discord/fetch-messages.d.ts.map +0 -1
- package/dist/types/src/functions/discord/fetch-messages.test.d.ts.map +0 -1
- package/dist/types/src/functions/discord/index.d.ts.map +0 -1
- package/dist/types/src/functions/document/index.d.ts +0 -12
- package/dist/types/src/functions/document/index.d.ts.map +0 -1
- package/dist/types/src/functions/document/read.d.ts +0 -7
- package/dist/types/src/functions/document/read.d.ts.map +0 -1
- package/dist/types/src/functions/document/update.d.ts +0 -6
- package/dist/types/src/functions/document/update.d.ts.map +0 -1
- package/dist/types/src/functions/github/fetch-prs.d.ts.map +0 -1
- package/dist/types/src/functions/linear/index.d.ts +0 -9
- package/dist/types/src/functions/linear/index.d.ts.map +0 -1
- package/dist/types/src/functions/linear/linear.test.d.ts.map +0 -1
- package/dist/types/src/functions/linear/sync-issues.d.ts.map +0 -1
- package/dist/types/src/functions/research/create-document.d.ts.map +0 -1
- package/dist/types/src/functions/research/graph.d.ts.map +0 -1
- package/dist/types/src/functions/research/graph.test.d.ts.map +0 -1
- package/dist/types/src/functions/research/index.d.ts +0 -19
- package/dist/types/src/functions/research/index.d.ts.map +0 -1
- package/dist/types/src/functions/research/research-graph.d.ts +0 -18
- package/dist/types/src/functions/research/research-graph.d.ts.map +0 -1
- package/dist/types/src/functions/research/research.d.ts.map +0 -1
- package/dist/types/src/functions/research/research.test.d.ts.map +0 -1
- package/dist/types/src/functions/research/types.d.ts +0 -384
- package/dist/types/src/functions/research/types.d.ts.map +0 -1
- package/dist/types/src/functions/tasks/index.d.ts +0 -15
- package/dist/types/src/functions/tasks/index.d.ts.map +0 -1
- package/dist/types/src/functions/tasks/read.d.ts +0 -7
- package/dist/types/src/functions/tasks/read.d.ts.map +0 -1
- package/dist/types/src/functions/tasks/task-list.d.ts.map +0 -1
- package/dist/types/src/functions/tasks/task-list.test.d.ts.map +0 -1
- package/dist/types/src/functions/tasks/update.d.ts +0 -9
- package/dist/types/src/functions/tasks/update.d.ts.map +0 -1
- package/dist/types/src/plugins.d.ts +0 -19
- package/dist/types/src/plugins.d.ts.map +0 -1
- package/dist/types/src/testing/data/exa-search-1748337321991.d.ts.map +0 -1
- package/dist/types/src/testing/data/exa-search-1748337331526.d.ts.map +0 -1
- package/dist/types/src/testing/data/exa-search-1748337344119.d.ts.map +0 -1
- package/dist/types/src/testing/data/index.d.ts.map +0 -1
- package/src/blueprints/design/design-blueprint.ts +0 -33
- package/src/blueprints/discord/discord-blueprint.ts +0 -34
- package/src/blueprints/linear/linear-blueprint.ts +0 -35
- package/src/blueprints/research/research-blueprint.ts +0 -45
- package/src/blueprints/websearch/websearch-blueprint.ts +0 -20
- package/src/experimental/feed.test.ts +0 -108
- package/src/functions/discord/index.ts +0 -9
- package/src/functions/document/index.ts +0 -11
- package/src/functions/document/read.ts +0 -29
- package/src/functions/linear/index.ts +0 -9
- package/src/functions/linear/linear.test.ts +0 -86
- package/src/functions/research/create-document.ts +0 -69
- package/src/functions/research/graph.test.ts +0 -69
- package/src/functions/research/index.ts +0 -15
- package/src/functions/research/research-graph.ts +0 -47
- package/src/functions/research/research.conversations.json +0 -10714
- package/src/functions/research/research.test.ts +0 -240
- package/src/functions/research/research.ts +0 -155
- package/src/functions/research/types.ts +0 -24
- package/src/functions/tasks/index.ts +0 -11
- package/src/plugins.tsx +0 -68
- /package/dist/types/src/{functions/discord → blueprints/discord/functions}/fetch-messages.test.d.ts +0 -0
- /package/dist/types/src/{functions/linear → blueprints/linear/functions}/linear.test.d.ts +0 -0
- /package/dist/types/src/{functions/tasks → blueprints/planning-old/functions}/task-list.d.ts +0 -0
- /package/dist/types/src/{functions/tasks → blueprints/planning-old/functions}/task-list.test.d.ts +0 -0
- /package/dist/types/src/{functions/research → blueprints/research/functions}/research.test.d.ts +0 -0
- /package/dist/types/src/{functions/research → crud}/graph.test.d.ts +0 -0
- /package/dist/types/src/{testing → functions/exa}/data/exa-search-1748337321991.d.ts +0 -0
- /package/dist/types/src/{testing → functions/exa}/data/exa-search-1748337331526.d.ts +0 -0
- /package/dist/types/src/{testing → functions/exa}/data/exa-search-1748337344119.d.ts +0 -0
- /package/dist/types/src/{testing → functions/exa}/data/index.d.ts +0 -0
- /package/src/{functions/tasks → blueprints/planning-old/functions}/task-list.test.ts +0 -0
- /package/src/{functions/tasks → blueprints/planning-old/functions}/task-list.ts +0 -0
- /package/src/blueprints/research/{research-blueprint.test.ts → blueprint.test.ts} +0 -0
- /package/src/blueprints/websearch/{websearch-toolkit.ts → toolkit.ts} +0 -0
- /package/src/{testing → functions/exa}/data/exa-search-1748337321991.ts +0 -0
- /package/src/{testing → functions/exa}/data/exa-search-1748337331526.ts +0 -0
- /package/src/{testing → functions/exa}/data/exa-search-1748337344119.ts +0 -0
- /package/src/{testing → functions/exa}/data/index.ts +0 -0
|
@@ -2,53 +2,62 @@
|
|
|
2
2
|
// Copyright 2025 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import * as Toolkit from '@effect/ai/Toolkit';
|
|
6
5
|
import * as Effect from 'effect/Effect';
|
|
7
6
|
import * as Layer from 'effect/Layer';
|
|
8
7
|
import * as Predicate from 'effect/Predicate';
|
|
9
8
|
import * as Schema from 'effect/Schema';
|
|
10
9
|
|
|
11
10
|
import { AiService } from '@dxos/ai';
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
14
|
-
import {
|
|
11
|
+
import { GenericToolkit } from '@dxos/ai';
|
|
12
|
+
import { AiSession, ToolExecutionServices } from '@dxos/assistant';
|
|
13
|
+
import { Database, Filter, Obj, Ref } from '@dxos/echo';
|
|
14
|
+
import { defineFunction } from '@dxos/functions';
|
|
15
|
+
import { FunctionInvocationServiceLayerTest } from '@dxos/functions-runtime/testing';
|
|
15
16
|
import { type DXN } from '@dxos/keys';
|
|
16
17
|
import { log } from '@dxos/log';
|
|
17
|
-
import {
|
|
18
|
+
import { type Actor, LegacyOrganization, Message, Organization, Person } from '@dxos/types';
|
|
18
19
|
import { trim } from '@dxos/util';
|
|
19
20
|
|
|
20
|
-
import {
|
|
21
|
+
import { ResearchGraph } from '../../blueprints';
|
|
22
|
+
import { makeGraphWriterHandler, makeGraphWriterToolkit } from '../../crud';
|
|
21
23
|
|
|
22
24
|
export default defineFunction({
|
|
23
25
|
key: 'dxos.org/functions/entity-extraction',
|
|
24
26
|
name: 'Entity Extraction',
|
|
25
27
|
description: 'Extracts entities from emails and transcripts.',
|
|
26
28
|
inputSchema: Schema.Struct({
|
|
27
|
-
source:
|
|
29
|
+
source: Message.Message.annotations({
|
|
30
|
+
description: 'Email or transcript to extract entities from.',
|
|
31
|
+
}),
|
|
28
32
|
|
|
29
33
|
// TODO(dmaretskyi): Consider making this an array of blueprints instead.
|
|
30
|
-
instructions: Schema.optional(Schema.String).annotations({
|
|
34
|
+
instructions: Schema.optional(Schema.String).annotations({
|
|
35
|
+
description: 'Instructions extraction process.',
|
|
36
|
+
}),
|
|
31
37
|
}),
|
|
32
38
|
outputSchema: Schema.Struct({
|
|
33
39
|
entities: Schema.optional(
|
|
34
|
-
Schema.Array(Obj.
|
|
40
|
+
Schema.Array(Obj.Unknown).annotations({
|
|
35
41
|
description: 'Extracted entities.',
|
|
36
42
|
}),
|
|
37
43
|
),
|
|
38
44
|
}),
|
|
39
45
|
handler: Effect.fnUntraced(
|
|
40
|
-
function* ({ data: { source, instructions } }) {
|
|
41
|
-
const
|
|
42
|
-
|
|
46
|
+
function* ({ data: { source: message, instructions } }) {
|
|
47
|
+
const tags = Obj.getMeta(message)?.tags;
|
|
48
|
+
const contact = yield* extractContact(message.sender, tags);
|
|
49
|
+
let organization: Organization.Organization | null = null;
|
|
43
50
|
|
|
44
51
|
if (contact && !contact.organization) {
|
|
45
52
|
const created: DXN[] = [];
|
|
46
|
-
const GraphWriterToolkit = makeGraphWriterToolkit({
|
|
53
|
+
const GraphWriterToolkit = makeGraphWriterToolkit({
|
|
54
|
+
schema: [LegacyOrganization],
|
|
55
|
+
}).pipe();
|
|
47
56
|
const GraphWriterHandler = makeGraphWriterHandler(GraphWriterToolkit, {
|
|
48
57
|
onAppend: (dxns) => created.push(...dxns),
|
|
49
58
|
});
|
|
50
59
|
const toolkit = yield* GraphWriterToolkit.pipe(
|
|
51
|
-
Effect.provide(GraphWriterHandler.pipe(Layer.provide(
|
|
60
|
+
Effect.provide(GraphWriterHandler.pipe(Layer.provide(ResearchGraph.contextQueueLayer))),
|
|
52
61
|
);
|
|
53
62
|
|
|
54
63
|
yield* new AiSession().run({
|
|
@@ -57,17 +66,22 @@ export default defineFunction({
|
|
|
57
66
|
The extracted organization URL must match the sender's email domain.
|
|
58
67
|
${instructions ? '<user_intructions>' + instructions + '</user_intructions>' : ''},
|
|
59
68
|
`,
|
|
60
|
-
prompt: JSON.stringify({ source, contact }),
|
|
69
|
+
prompt: JSON.stringify({ source: message, contact }),
|
|
61
70
|
toolkit,
|
|
62
71
|
});
|
|
63
72
|
|
|
64
73
|
if (created.length > 1) {
|
|
65
74
|
throw new Error('Multiple organizations created');
|
|
66
75
|
} else if (created.length === 1) {
|
|
67
|
-
organization = yield*
|
|
68
|
-
Obj.
|
|
69
|
-
|
|
70
|
-
|
|
76
|
+
organization = yield* Database.resolve(created[0], Organization.Organization);
|
|
77
|
+
Obj.change(organization, (org) => {
|
|
78
|
+
const meta = Obj.getMeta(org);
|
|
79
|
+
meta.tags ??= [];
|
|
80
|
+
meta.tags.push(...(tags ?? []));
|
|
81
|
+
});
|
|
82
|
+
Obj.change(contact, (c) => {
|
|
83
|
+
c.organization = Ref.make(organization!);
|
|
84
|
+
});
|
|
71
85
|
}
|
|
72
86
|
}
|
|
73
87
|
|
|
@@ -78,27 +92,26 @@ export default defineFunction({
|
|
|
78
92
|
Effect.provide(
|
|
79
93
|
Layer.mergeAll(
|
|
80
94
|
AiService.model('@anthropic/claude-sonnet-4-0'), // TODO(dmaretskyi): Extract.
|
|
81
|
-
|
|
82
|
-
makeToolExecutionServiceFromFunctions(Toolkit.make() as any, Layer.empty as any),
|
|
95
|
+
ToolExecutionServices,
|
|
83
96
|
).pipe(
|
|
84
97
|
Layer.provide(
|
|
85
98
|
// TODO(dmaretskyi): This should be provided by environment.
|
|
86
|
-
Layer.mergeAll(
|
|
99
|
+
Layer.mergeAll(GenericToolkit.providerEmpty, FunctionInvocationServiceLayerTest()),
|
|
87
100
|
),
|
|
88
101
|
),
|
|
89
102
|
),
|
|
90
103
|
),
|
|
91
104
|
});
|
|
92
105
|
|
|
93
|
-
const extractContact = Effect.fn('extractContact')(function* (
|
|
94
|
-
const name =
|
|
95
|
-
const email =
|
|
106
|
+
const extractContact = Effect.fn('extractContact')(function* (actor: Actor.Actor, tags?: readonly string[]) {
|
|
107
|
+
const name = actor.name;
|
|
108
|
+
const email = actor.email;
|
|
96
109
|
if (!email) {
|
|
97
|
-
log.warn('email is required for contact extraction', {
|
|
110
|
+
log.warn('email is required for contact extraction', { actor });
|
|
98
111
|
return undefined;
|
|
99
112
|
}
|
|
100
113
|
|
|
101
|
-
const
|
|
114
|
+
const existingContacts = yield* Database.runQuery(Filter.type(Person.Person));
|
|
102
115
|
|
|
103
116
|
// Check for existing contact
|
|
104
117
|
// TODO(dmaretskyi): Query filter DSL - https://linear.app/dxos/issue/DX-541/filtercontains-should-work-with-partial-objects
|
|
@@ -111,16 +124,16 @@ const extractContact = Effect.fn('extractContact')(function* (message: DataType.
|
|
|
111
124
|
return existingContact;
|
|
112
125
|
}
|
|
113
126
|
|
|
114
|
-
const newContact = Obj.make(
|
|
115
|
-
[Obj.Meta]: {
|
|
116
|
-
tags: Obj.getMeta(message)?.tags,
|
|
117
|
-
},
|
|
127
|
+
const newContact = Obj.make(Person.Person, {
|
|
128
|
+
...(tags ? { [Obj.Meta]: { tags: [...tags] } } : {}),
|
|
118
129
|
emails: [{ value: email }],
|
|
119
130
|
});
|
|
120
|
-
yield*
|
|
131
|
+
yield* Database.add(newContact);
|
|
121
132
|
|
|
122
133
|
if (name) {
|
|
123
|
-
newContact
|
|
134
|
+
Obj.change(newContact, (c) => {
|
|
135
|
+
c.fullName = name;
|
|
136
|
+
});
|
|
124
137
|
}
|
|
125
138
|
|
|
126
139
|
const emailDomain = email.split('@')[1]?.toLowerCase();
|
|
@@ -131,7 +144,7 @@ const extractContact = Effect.fn('extractContact')(function* (message: DataType.
|
|
|
131
144
|
|
|
132
145
|
log.info('extracted email domain', { emailDomain });
|
|
133
146
|
|
|
134
|
-
const
|
|
147
|
+
const existingOrganisations = yield* Database.runQuery(Filter.type(Organization.Organization));
|
|
135
148
|
const matchingOrg = existingOrganisations.find((org) => {
|
|
136
149
|
if (org.website) {
|
|
137
150
|
try {
|
|
@@ -147,7 +160,10 @@ const extractContact = Effect.fn('extractContact')(function* (message: DataType.
|
|
|
147
160
|
emailDomain.endsWith(`.${websiteDomain}`)
|
|
148
161
|
);
|
|
149
162
|
} catch (e) {
|
|
150
|
-
log.warn('Error parsing website URL', {
|
|
163
|
+
log.warn('Error parsing website URL', {
|
|
164
|
+
website: org.website,
|
|
165
|
+
error: e,
|
|
166
|
+
});
|
|
151
167
|
return false;
|
|
152
168
|
}
|
|
153
169
|
}
|
|
@@ -156,7 +172,9 @@ const extractContact = Effect.fn('extractContact')(function* (message: DataType.
|
|
|
156
172
|
|
|
157
173
|
if (matchingOrg) {
|
|
158
174
|
log.info('found matching organization', { organization: matchingOrg });
|
|
159
|
-
newContact
|
|
175
|
+
Obj.change(newContact, (c) => {
|
|
176
|
+
c.organization = Ref.make(matchingOrg);
|
|
177
|
+
});
|
|
160
178
|
}
|
|
161
179
|
|
|
162
180
|
return newContact;
|
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
// Copyright 2025 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import
|
|
5
|
+
import Extract from './entity-extraction';
|
|
6
6
|
|
|
7
|
-
export
|
|
8
|
-
|
|
9
|
-
}
|
|
7
|
+
export const EntityExtractionFunctions = {
|
|
8
|
+
Extract,
|
|
9
|
+
};
|
package/src/functions/exa/exa.ts
CHANGED
|
@@ -9,8 +9,8 @@ import Exa from 'exa-js';
|
|
|
9
9
|
import { CredentialsService, defineFunction } from '@dxos/functions';
|
|
10
10
|
|
|
11
11
|
export default defineFunction({
|
|
12
|
-
key: 'dxos.org/function/exa',
|
|
13
|
-
name: 'Exa',
|
|
12
|
+
key: 'dxos.org/function/exa-search',
|
|
13
|
+
name: 'Exa Search',
|
|
14
14
|
description: 'Search the web for information',
|
|
15
15
|
inputSchema: Schema.Struct({
|
|
16
16
|
query: Schema.String.annotations({
|
|
@@ -7,7 +7,7 @@ import * as Schema from 'effect/Schema';
|
|
|
7
7
|
|
|
8
8
|
import { defineFunction } from '@dxos/functions';
|
|
9
9
|
|
|
10
|
-
import { SEARCH_RESULTS } from '
|
|
10
|
+
import { SEARCH_RESULTS } from './data';
|
|
11
11
|
|
|
12
12
|
export default defineFunction({
|
|
13
13
|
key: 'dxos.org/function/exa-mock',
|
package/src/functions/index.ts
CHANGED
package/src/index.ts
CHANGED
package/src/sync/sync.ts
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
import * as Effect from 'effect/Effect';
|
|
6
6
|
|
|
7
7
|
import { Filter, Obj, Query, Ref } from '@dxos/echo';
|
|
8
|
-
import {
|
|
8
|
+
import { Database } from '@dxos/echo';
|
|
9
9
|
import { failedInvariant } from '@dxos/invariant';
|
|
10
10
|
import { log } from '@dxos/log';
|
|
11
11
|
|
|
@@ -18,9 +18,12 @@ import { log } from '@dxos/log';
|
|
|
18
18
|
* @param opts.foreignKeyId - The key to use for matching objects.
|
|
19
19
|
*/
|
|
20
20
|
export const syncObjects: (
|
|
21
|
-
objs: Obj.
|
|
21
|
+
objs: Obj.Unknown[],
|
|
22
22
|
opts: { foreignKeyId: string },
|
|
23
|
-
) => Effect.Effect<Obj.
|
|
23
|
+
) => Effect.Effect<Obj.Unknown[], never, Database.Service> = Effect.fn('syncObjects')(function* (
|
|
24
|
+
objs,
|
|
25
|
+
{ foreignKeyId },
|
|
26
|
+
) {
|
|
24
27
|
return yield* Effect.forEach(
|
|
25
28
|
objs,
|
|
26
29
|
Effect.fnUntraced(function* (obj) {
|
|
@@ -28,7 +31,7 @@ export const syncObjects: (
|
|
|
28
31
|
for (const key of Object.keys(obj)) {
|
|
29
32
|
if (typeof key !== 'string' || key === 'id') continue;
|
|
30
33
|
if (!Ref.isRef((obj as any)[key])) continue;
|
|
31
|
-
const ref: Ref.
|
|
34
|
+
const ref: Ref.Unknown = (obj as any)[key];
|
|
32
35
|
if (!ref.target) continue;
|
|
33
36
|
if (Obj.getDXN(ref.target).isLocalObjectId()) {
|
|
34
37
|
// obj not persisted to db.
|
|
@@ -39,9 +42,7 @@ export const syncObjects: (
|
|
|
39
42
|
|
|
40
43
|
const schema = Obj.getSchema(obj) ?? failedInvariant('No schema.');
|
|
41
44
|
const foreignId = Obj.getKeys(obj, foreignKeyId)[0]?.id ?? failedInvariant('No foreign key.');
|
|
42
|
-
const
|
|
43
|
-
objects: [existing],
|
|
44
|
-
} = yield* DatabaseService.runQuery(
|
|
45
|
+
const [existing] = yield* Database.runQuery(
|
|
45
46
|
Query.select(Filter.foreignKeys(schema, [{ source: foreignKeyId, id: foreignId }])),
|
|
46
47
|
);
|
|
47
48
|
log('sync object', {
|
|
@@ -50,7 +51,7 @@ export const syncObjects: (
|
|
|
50
51
|
existing: existing ? Obj.getDXN(existing) : undefined,
|
|
51
52
|
});
|
|
52
53
|
if (!existing) {
|
|
53
|
-
yield*
|
|
54
|
+
yield* Database.add(obj);
|
|
54
55
|
return obj;
|
|
55
56
|
} else {
|
|
56
57
|
copyObjectData(existing, obj);
|
|
@@ -61,27 +62,34 @@ export const syncObjects: (
|
|
|
61
62
|
);
|
|
62
63
|
});
|
|
63
64
|
|
|
64
|
-
const copyObjectData = (existing: Obj.
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
if (typeof key !== 'string' || key === 'id') continue;
|
|
78
|
-
if (!(key in newObj)) {
|
|
79
|
-
delete (existing as any)[key];
|
|
65
|
+
const copyObjectData = (existing: Obj.Unknown, newObj: Obj.Unknown) => {
|
|
66
|
+
Obj.change(existing, (obj) => {
|
|
67
|
+
// Copy properties from newObj to existing.
|
|
68
|
+
for (const key of Object.keys(newObj)) {
|
|
69
|
+
if (typeof key !== 'string' || key === 'id') continue;
|
|
70
|
+
if (
|
|
71
|
+
typeof (newObj as any)[key] !== 'string' &&
|
|
72
|
+
typeof (newObj as any)[key] !== 'number' &&
|
|
73
|
+
typeof (newObj as any)[key] !== 'boolean' &&
|
|
74
|
+
!Ref.isRef((newObj as any)[key])
|
|
75
|
+
)
|
|
76
|
+
continue;
|
|
77
|
+
(obj as any)[key] = (newObj as any)[key];
|
|
80
78
|
}
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
79
|
+
|
|
80
|
+
// Delete properties that don't exist in newObj.
|
|
81
|
+
for (const key of Object.keys(obj)) {
|
|
82
|
+
if (typeof key !== 'string' || key === 'id') continue;
|
|
83
|
+
if (!(key in newObj)) {
|
|
84
|
+
delete (obj as any)[key];
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
// Update foreign keys.
|
|
89
|
+
for (const foreignKey of Obj.getMeta(newObj).keys) {
|
|
90
|
+
Obj.deleteKeys(obj, foreignKey.source);
|
|
91
|
+
// TODO(dmaretskyi): Doesn't work: `Obj.getMeta(existing).keys.push(foreignKey);`
|
|
92
|
+
Obj.getMeta(obj).keys.push({ ...foreignKey });
|
|
93
|
+
}
|
|
94
|
+
});
|
|
87
95
|
};
|
package/src/testing/index.ts
CHANGED
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2025 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import * as Schema from 'effect/Schema';
|
|
6
|
+
import React from 'react';
|
|
7
|
+
|
|
8
|
+
import { Capabilities, Capability } from '@dxos/app-framework';
|
|
9
|
+
import { Surface } from '@dxos/app-framework/ui';
|
|
10
|
+
import { Format, type Obj, Type } from '@dxos/echo';
|
|
11
|
+
import { Card } from '@dxos/react-ui';
|
|
12
|
+
import { JsonFilter } from '@dxos/react-ui-syntax-highlighter';
|
|
13
|
+
|
|
14
|
+
export const MapSchema = Schema.Struct({
|
|
15
|
+
coordinates: Format.GeoPoint,
|
|
16
|
+
}).pipe(
|
|
17
|
+
Type.object({
|
|
18
|
+
typename: 'example.com/type/Map',
|
|
19
|
+
version: '0.1.0',
|
|
20
|
+
}),
|
|
21
|
+
);
|
|
22
|
+
|
|
23
|
+
export type MapSchema = Schema.Schema.Type<typeof MapSchema>;
|
|
24
|
+
|
|
25
|
+
// TODO(burdon): Move to ECHO def.
|
|
26
|
+
export type ArtifactsContext = {
|
|
27
|
+
items: Obj.Unknown[];
|
|
28
|
+
getArtifacts: () => Obj.Unknown[];
|
|
29
|
+
addArtifact: (artifact: Obj.Unknown) => void;
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
declare global {
|
|
33
|
+
interface ToolContextExtensions {
|
|
34
|
+
artifacts?: ArtifactsContext;
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
// TODO(dmaretskyi): Removed images from conductor GPT implementation.
|
|
39
|
+
const isImage = (data: any): data is any => false;
|
|
40
|
+
|
|
41
|
+
export const capabilities: Capability.Any[] = [
|
|
42
|
+
Capability.contributes(
|
|
43
|
+
Capabilities.ReactSurface,
|
|
44
|
+
Surface.create({
|
|
45
|
+
id: 'plugin-image',
|
|
46
|
+
role: 'card--content',
|
|
47
|
+
filter: (data: any): data is any => isImage(data.value),
|
|
48
|
+
component: ({ data }) => (
|
|
49
|
+
<Card.Content>
|
|
50
|
+
<img
|
|
51
|
+
className='grow object-cover'
|
|
52
|
+
src={`data:image/jpeg;base64,${data.value.source.data}`}
|
|
53
|
+
alt={data.value.prompt ?? `Generated image [id=${data.value.id}]`}
|
|
54
|
+
/>
|
|
55
|
+
</Card.Content>
|
|
56
|
+
),
|
|
57
|
+
}),
|
|
58
|
+
),
|
|
59
|
+
Capability.contributes(
|
|
60
|
+
Capabilities.ReactSurface,
|
|
61
|
+
Surface.create({
|
|
62
|
+
id: 'plugin-default',
|
|
63
|
+
role: 'card--content',
|
|
64
|
+
position: 'fallback',
|
|
65
|
+
component: ({ data }) => (
|
|
66
|
+
<Card.Content>
|
|
67
|
+
<JsonFilter data={data} />
|
|
68
|
+
</Card.Content>
|
|
69
|
+
),
|
|
70
|
+
}),
|
|
71
|
+
),
|
|
72
|
+
];
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2025 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import * as Tool from '@effect/ai/Tool';
|
|
6
|
+
import * as Toolkit from '@effect/ai/Toolkit';
|
|
7
|
+
import * as AnthropicTool from '@effect/ai-anthropic/AnthropicTool';
|
|
8
|
+
import * as Effect from 'effect/Effect';
|
|
9
|
+
import * as Schema from 'effect/Schema';
|
|
10
|
+
|
|
11
|
+
// TODO(dmaretskyi): Testing only.
|
|
12
|
+
export const WebToolkit = Toolkit.make(
|
|
13
|
+
AnthropicTool.WebSearch_20250305({}).pipe(
|
|
14
|
+
// TODO(dmaretskyi): Effect bug -- provider-defined tools don't support annotations.
|
|
15
|
+
// ToolFormatter.assign({
|
|
16
|
+
// debugFormatResult: (result) =>
|
|
17
|
+
// Array.isArray(result) ? result.map(Struct.pick('title', 'type', 'url', 'page_age')) : result,
|
|
18
|
+
// }),
|
|
19
|
+
),
|
|
20
|
+
Tool.make('WebFetch', {
|
|
21
|
+
parameters: {
|
|
22
|
+
url: Schema.String,
|
|
23
|
+
},
|
|
24
|
+
success: Schema.String,
|
|
25
|
+
}),
|
|
26
|
+
);
|
|
27
|
+
|
|
28
|
+
export const layer = WebToolkit.toLayer({
|
|
29
|
+
WebFetch: Effect.fnUntraced(function* ({ url }) {
|
|
30
|
+
const response = yield* Effect.promise(() => fetch(url).then((response) => response.text()));
|
|
31
|
+
return response;
|
|
32
|
+
}),
|
|
33
|
+
});
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2024 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import * as Schema from 'effect/Schema';
|
|
6
|
+
|
|
7
|
+
import { Annotation, Obj, Ref, Type } from '@dxos/echo';
|
|
8
|
+
import { FormInputAnnotation, LabelAnnotation } from '@dxos/echo/internal';
|
|
9
|
+
import { Queue } from '@dxos/echo-db';
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* AI chat.
|
|
13
|
+
*/
|
|
14
|
+
export const Chat = Schema.Struct({
|
|
15
|
+
name: Schema.String.pipe(Schema.optional),
|
|
16
|
+
queue: Ref.Ref(Queue).pipe(FormInputAnnotation.set(false)),
|
|
17
|
+
// TODO(dmaretskyi): Eventually this and the message queue will be the same.
|
|
18
|
+
traceQueue: Ref.Ref(Queue).pipe(FormInputAnnotation.set(false), Schema.optional),
|
|
19
|
+
}).pipe(
|
|
20
|
+
Type.object({
|
|
21
|
+
typename: 'dxos.org/type/assistant/Chat',
|
|
22
|
+
version: '0.2.0',
|
|
23
|
+
}),
|
|
24
|
+
LabelAnnotation.set(['name']),
|
|
25
|
+
Annotation.IconAnnotation.set({
|
|
26
|
+
icon: 'ph--atom--regular',
|
|
27
|
+
hue: 'blue',
|
|
28
|
+
}),
|
|
29
|
+
);
|
|
30
|
+
|
|
31
|
+
export interface Chat extends Schema.Schema.Type<typeof Chat> {}
|
|
32
|
+
|
|
33
|
+
export const make = (props: Obj.MakeProps<typeof Chat>) => Obj.make(Chat, props);
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* Relation between a Chat and companion objects (e.g., artifacts).
|
|
37
|
+
*/
|
|
38
|
+
export const CompanionTo = Schema.Struct({
|
|
39
|
+
id: Obj.ID,
|
|
40
|
+
}).pipe(
|
|
41
|
+
Type.relation({
|
|
42
|
+
typename: 'dxos.org/relation/assistant/CompanionTo',
|
|
43
|
+
version: '0.1.0',
|
|
44
|
+
source: Chat,
|
|
45
|
+
target: Obj.Unknown,
|
|
46
|
+
}),
|
|
47
|
+
);
|
|
48
|
+
|
|
49
|
+
export interface CompanionTo extends Schema.Schema.Type<typeof CompanionTo> {}
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2026 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import * as Schema from 'effect/Schema';
|
|
6
|
+
|
|
7
|
+
import { Obj, Ref, Type } from '@dxos/echo';
|
|
8
|
+
|
|
9
|
+
import * as Chat from './Chat';
|
|
10
|
+
|
|
11
|
+
export const TaskId = Schema.String.pipe(Schema.brand('@dxos/assistant-toolkit/TaskId'));
|
|
12
|
+
export type TaskId = Schema.Schema.Type<typeof TaskId>;
|
|
13
|
+
|
|
14
|
+
export const Task = Schema.Struct({
|
|
15
|
+
/**
|
|
16
|
+
* Short task ID unique within the plan.
|
|
17
|
+
*/
|
|
18
|
+
id: TaskId,
|
|
19
|
+
|
|
20
|
+
title: Schema.String.annotations({
|
|
21
|
+
description: 'Task title and description.',
|
|
22
|
+
}),
|
|
23
|
+
|
|
24
|
+
status: Schema.Literal('todo', 'in-progress', 'done'),
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* Parent task ID.
|
|
28
|
+
*/
|
|
29
|
+
parent: Schema.optional(TaskId).annotations({
|
|
30
|
+
description: 'Parent task ID.',
|
|
31
|
+
}),
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* Chat object that this task is associated with.
|
|
35
|
+
*/
|
|
36
|
+
chat: Schema.optional(Ref.Ref(Chat.Chat)),
|
|
37
|
+
});
|
|
38
|
+
export interface Task extends Schema.Schema.Type<typeof Task> {}
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* Hierarchical collection of tasks for humans and agents to track progress.
|
|
42
|
+
*/
|
|
43
|
+
export const Plan = Schema.Struct({
|
|
44
|
+
tasks: Schema.Array(Task),
|
|
45
|
+
}).pipe(
|
|
46
|
+
Type.object({
|
|
47
|
+
typename: 'dxos.org/type/Plan',
|
|
48
|
+
version: '0.1.0',
|
|
49
|
+
}),
|
|
50
|
+
);
|
|
51
|
+
export interface Plan extends Schema.Schema.Type<typeof Plan> {}
|
|
52
|
+
|
|
53
|
+
export const generateTaskId = (plan: Plan): TaskId => {
|
|
54
|
+
const existingIds = plan.tasks
|
|
55
|
+
.map((task) => {
|
|
56
|
+
const [num, letter] = task.id.split('-');
|
|
57
|
+
return parseInt(num);
|
|
58
|
+
})
|
|
59
|
+
.filter((_) => !isNaN(_));
|
|
60
|
+
let newId;
|
|
61
|
+
if (existingIds.length === 0) {
|
|
62
|
+
newId = 1;
|
|
63
|
+
} else {
|
|
64
|
+
newId = Math.max(...existingIds) + 1;
|
|
65
|
+
}
|
|
66
|
+
// Add random suffix to avoid collisions.
|
|
67
|
+
return TaskId.make(`${newId}-${crypto.randomUUID().slice(0, 2)}`);
|
|
68
|
+
};
|
|
69
|
+
|
|
70
|
+
/**
|
|
71
|
+
* Add new tasks to a plan, generating IDs for new tasks.
|
|
72
|
+
* Use inside an `Obj.change` callback.
|
|
73
|
+
*/
|
|
74
|
+
export const addTasks = (
|
|
75
|
+
plan: Obj.Mutable<Plan>,
|
|
76
|
+
tasks: (Pick<Task, 'title'> & Partial<Pick<Task, 'status' | 'parent' | 'chat'>>)[],
|
|
77
|
+
) => {
|
|
78
|
+
for (const task of tasks) {
|
|
79
|
+
const taskId = generateTaskId(plan);
|
|
80
|
+
plan.tasks.push({ id: taskId, ...task, status: task.status ?? 'todo' });
|
|
81
|
+
}
|
|
82
|
+
return plan;
|
|
83
|
+
};
|
|
84
|
+
|
|
85
|
+
interface MakePlanProps {
|
|
86
|
+
tasks: {
|
|
87
|
+
title: string;
|
|
88
|
+
status?: 'todo' | 'in-progress' | 'done';
|
|
89
|
+
}[];
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
export const makePlan = (props: MakePlanProps): Plan => {
|
|
93
|
+
const plan = Obj.make(Plan, { tasks: [] });
|
|
94
|
+
Obj.change(plan, (plan) => {
|
|
95
|
+
addTasks(plan, props.tasks);
|
|
96
|
+
});
|
|
97
|
+
return plan;
|
|
98
|
+
};
|
|
99
|
+
|
|
100
|
+
/**
|
|
101
|
+
* Formats plan to markdown format.
|
|
102
|
+
*/
|
|
103
|
+
export const formatPlan = (plan: Plan): string => {
|
|
104
|
+
return plan.tasks
|
|
105
|
+
.map((task) => `- **${task.status?.toLocaleUpperCase()}**: ${task.title ?? 'No title'} <!-- id=${task.id} -->`)
|
|
106
|
+
.join('\n');
|
|
107
|
+
};
|