@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
|
@@ -0,0 +1,321 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2025 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import { describe, expect, it } from '@effect/vitest';
|
|
6
|
+
import * as Effect from 'effect/Effect';
|
|
7
|
+
import * as Layer from 'effect/Layer';
|
|
8
|
+
|
|
9
|
+
import { AiContextService, AiConversationService } from '@dxos/assistant';
|
|
10
|
+
import { AssistantTestLayer } from '@dxos/assistant/testing';
|
|
11
|
+
import { Blueprint } from '@dxos/blueprints';
|
|
12
|
+
import { Database, Entity, Obj, Query, Ref, Relation, Tag } from '@dxos/echo';
|
|
13
|
+
import { TestHelpers } from '@dxos/effect/testing';
|
|
14
|
+
import { ObjectId } from '@dxos/keys';
|
|
15
|
+
import { Employer, Organization, Person } from '@dxos/types';
|
|
16
|
+
|
|
17
|
+
import DatabaseBlueprint from './blueprint';
|
|
18
|
+
import { DatabaseFunctions } from './functions';
|
|
19
|
+
|
|
20
|
+
ObjectId.dangerouslyDisableRandomness();
|
|
21
|
+
|
|
22
|
+
const TestLayer = AssistantTestLayer({
|
|
23
|
+
functions: [...Object.values(DatabaseFunctions)],
|
|
24
|
+
types: [Organization.Organization, Person.Person, Employer.Employer, Tag.Tag, Blueprint.Blueprint],
|
|
25
|
+
tracing: 'pretty',
|
|
26
|
+
});
|
|
27
|
+
|
|
28
|
+
const provideTestLayers = Effect.provide(AiConversationService.layerNewQueue().pipe(Layer.provideMerge(TestLayer)));
|
|
29
|
+
|
|
30
|
+
const addDatabaseBlueprint = Effect.fnUntraced(function* () {
|
|
31
|
+
yield* AiContextService.bindContext({
|
|
32
|
+
blueprints: [Ref.make(yield* Database.add(Obj.clone(DatabaseBlueprint.make(), { deep: true })))],
|
|
33
|
+
});
|
|
34
|
+
});
|
|
35
|
+
|
|
36
|
+
describe('Database Blueprint', () => {
|
|
37
|
+
//
|
|
38
|
+
// Schema
|
|
39
|
+
//
|
|
40
|
+
|
|
41
|
+
it.effect(
|
|
42
|
+
'schema-list: list available schemas',
|
|
43
|
+
Effect.fnUntraced(
|
|
44
|
+
function* (_) {
|
|
45
|
+
yield* addDatabaseBlueprint();
|
|
46
|
+
const messages = yield* AiConversationService.run({
|
|
47
|
+
prompt: 'List all available schemas. Tell me what typenames are available.',
|
|
48
|
+
});
|
|
49
|
+
const lastMessage = messages.at(-1);
|
|
50
|
+
expect(lastMessage).toBeDefined();
|
|
51
|
+
},
|
|
52
|
+
provideTestLayers,
|
|
53
|
+
TestHelpers.provideTestContext,
|
|
54
|
+
),
|
|
55
|
+
{ timeout: 60_000 },
|
|
56
|
+
);
|
|
57
|
+
|
|
58
|
+
it.effect(
|
|
59
|
+
'schema-add: add a new schema',
|
|
60
|
+
Effect.fnUntraced(
|
|
61
|
+
function* (_) {
|
|
62
|
+
yield* addDatabaseBlueprint();
|
|
63
|
+
yield* AiConversationService.run({
|
|
64
|
+
prompt:
|
|
65
|
+
'Add a new schema called "Project" with typename "example.com/type/Project" and fields: name (string), description (string), and status (string).',
|
|
66
|
+
});
|
|
67
|
+
const { db } = yield* Database.Service;
|
|
68
|
+
const schemas = yield* Effect.promise(() =>
|
|
69
|
+
db.schemaRegistry.query({ typename: 'example.com/type/Project', location: ['database', 'runtime'] }).run(),
|
|
70
|
+
);
|
|
71
|
+
expect(schemas.length).toBeGreaterThanOrEqual(1);
|
|
72
|
+
},
|
|
73
|
+
provideTestLayers,
|
|
74
|
+
TestHelpers.provideTestContext,
|
|
75
|
+
),
|
|
76
|
+
{ timeout: 60_000 },
|
|
77
|
+
);
|
|
78
|
+
|
|
79
|
+
//
|
|
80
|
+
// Objects
|
|
81
|
+
//
|
|
82
|
+
|
|
83
|
+
it.effect(
|
|
84
|
+
'object-create: create an object',
|
|
85
|
+
Effect.fnUntraced(
|
|
86
|
+
function* (_) {
|
|
87
|
+
yield* addDatabaseBlueprint();
|
|
88
|
+
yield* AiConversationService.run({
|
|
89
|
+
prompt: 'Create a new organization called "Cyberdyne Systems".',
|
|
90
|
+
});
|
|
91
|
+
const orgs = yield* Database.runQuery(Query.type(Organization.Organization, { name: 'Cyberdyne Systems' }));
|
|
92
|
+
expect(orgs).toHaveLength(1);
|
|
93
|
+
},
|
|
94
|
+
provideTestLayers,
|
|
95
|
+
TestHelpers.provideTestContext,
|
|
96
|
+
),
|
|
97
|
+
{ timeout: 60_000 },
|
|
98
|
+
);
|
|
99
|
+
|
|
100
|
+
it.effect(
|
|
101
|
+
'object-delete: delete an object',
|
|
102
|
+
Effect.fnUntraced(
|
|
103
|
+
function* (_) {
|
|
104
|
+
yield* addDatabaseBlueprint();
|
|
105
|
+
const org = yield* Database.add(Obj.make(Organization.Organization, { name: 'Obsolete Corp' }));
|
|
106
|
+
yield* AiConversationService.run({
|
|
107
|
+
prompt: `Delete the organization "Obsolete Corp".`,
|
|
108
|
+
});
|
|
109
|
+
expect(Obj.isDeleted(org)).toBe(true);
|
|
110
|
+
},
|
|
111
|
+
provideTestLayers,
|
|
112
|
+
TestHelpers.provideTestContext,
|
|
113
|
+
),
|
|
114
|
+
{ timeout: 60_000 },
|
|
115
|
+
);
|
|
116
|
+
|
|
117
|
+
it.effect(
|
|
118
|
+
'object-update: update an object',
|
|
119
|
+
Effect.fnUntraced(
|
|
120
|
+
function* (_) {
|
|
121
|
+
yield* addDatabaseBlueprint();
|
|
122
|
+
const org = yield* Database.add(Obj.make(Organization.Organization, { name: 'Old Name Inc' }));
|
|
123
|
+
yield* AiConversationService.run({
|
|
124
|
+
prompt: `Update the organization "Old Name Inc" and change its name to "New Name Corp".`,
|
|
125
|
+
});
|
|
126
|
+
expect(org.name).toBe('New Name Corp');
|
|
127
|
+
},
|
|
128
|
+
provideTestLayers,
|
|
129
|
+
TestHelpers.provideTestContext,
|
|
130
|
+
),
|
|
131
|
+
{ timeout: 60_000 },
|
|
132
|
+
);
|
|
133
|
+
|
|
134
|
+
//
|
|
135
|
+
// Query & Load
|
|
136
|
+
//
|
|
137
|
+
|
|
138
|
+
it.effect(
|
|
139
|
+
'query: search for objects',
|
|
140
|
+
Effect.fnUntraced(
|
|
141
|
+
function* (_) {
|
|
142
|
+
yield* addDatabaseBlueprint();
|
|
143
|
+
yield* Database.add(Obj.make(Organization.Organization, { name: 'Acme Corp' }));
|
|
144
|
+
yield* Database.add(Obj.make(Organization.Organization, { name: 'Globex Industries' }));
|
|
145
|
+
const messages = yield* AiConversationService.run({
|
|
146
|
+
prompt: 'Search for all organizations. How many are there?',
|
|
147
|
+
});
|
|
148
|
+
const lastMessage = messages.at(-1);
|
|
149
|
+
expect(lastMessage).toBeDefined();
|
|
150
|
+
},
|
|
151
|
+
provideTestLayers,
|
|
152
|
+
TestHelpers.provideTestContext,
|
|
153
|
+
),
|
|
154
|
+
{ timeout: 60_000 },
|
|
155
|
+
);
|
|
156
|
+
|
|
157
|
+
it.effect(
|
|
158
|
+
'load: load object details',
|
|
159
|
+
Effect.fnUntraced(
|
|
160
|
+
function* (_) {
|
|
161
|
+
yield* addDatabaseBlueprint();
|
|
162
|
+
const org = yield* Database.add(
|
|
163
|
+
Obj.make(Organization.Organization, { name: 'Detail Corp', description: 'A detailed organization.' }),
|
|
164
|
+
);
|
|
165
|
+
const dxn = Obj.getDXN(org).toString();
|
|
166
|
+
const messages = yield* AiConversationService.run({
|
|
167
|
+
prompt: `Load the full details of object ${dxn}. What is its description?`,
|
|
168
|
+
});
|
|
169
|
+
const lastMessage = messages.at(-1);
|
|
170
|
+
expect(lastMessage).toBeDefined();
|
|
171
|
+
},
|
|
172
|
+
provideTestLayers,
|
|
173
|
+
TestHelpers.provideTestContext,
|
|
174
|
+
),
|
|
175
|
+
{ timeout: 60_000 },
|
|
176
|
+
);
|
|
177
|
+
|
|
178
|
+
//
|
|
179
|
+
// Relations
|
|
180
|
+
//
|
|
181
|
+
|
|
182
|
+
it.effect(
|
|
183
|
+
'relation-create: create a relation between objects',
|
|
184
|
+
Effect.fnUntraced(
|
|
185
|
+
function* (_) {
|
|
186
|
+
yield* addDatabaseBlueprint();
|
|
187
|
+
const person = yield* Database.add(Obj.make(Person.Person, { fullName: 'John Connor' }));
|
|
188
|
+
const org = yield* Database.add(Obj.make(Organization.Organization, { name: 'Cyberdyne Systems' }));
|
|
189
|
+
yield* AiConversationService.run({
|
|
190
|
+
prompt: `Create an Employer relation from person "John Connor" to organization "Cyberdyne Systems" with role "Engineer". List schemas first to find the relation typename.`,
|
|
191
|
+
});
|
|
192
|
+
const relations = yield* Database.runQuery(Query.type(Employer.Employer));
|
|
193
|
+
expect(relations.length).toBeGreaterThanOrEqual(1);
|
|
194
|
+
},
|
|
195
|
+
provideTestLayers,
|
|
196
|
+
TestHelpers.provideTestContext,
|
|
197
|
+
),
|
|
198
|
+
{ timeout: 60_000 },
|
|
199
|
+
);
|
|
200
|
+
|
|
201
|
+
it.effect(
|
|
202
|
+
'relation-delete: delete a relation',
|
|
203
|
+
Effect.fnUntraced(
|
|
204
|
+
function* (_) {
|
|
205
|
+
yield* addDatabaseBlueprint();
|
|
206
|
+
const person = yield* Database.add(Obj.make(Person.Person, { fullName: 'Sarah Connor' }));
|
|
207
|
+
const org = yield* Database.add(Obj.make(Organization.Organization, { name: 'Cyberdyne Systems' }));
|
|
208
|
+
const relation = yield* Database.add(
|
|
209
|
+
Relation.make(Employer.Employer, {
|
|
210
|
+
[Relation.Source]: person,
|
|
211
|
+
[Relation.Target]: org,
|
|
212
|
+
role: 'Director',
|
|
213
|
+
}),
|
|
214
|
+
);
|
|
215
|
+
const relationDxn = Relation.getDXN(relation).toString();
|
|
216
|
+
yield* AiConversationService.run({
|
|
217
|
+
prompt: `Delete the relation ${relationDxn}.`,
|
|
218
|
+
});
|
|
219
|
+
expect(Relation.isDeleted(relation)).toBe(true);
|
|
220
|
+
},
|
|
221
|
+
provideTestLayers,
|
|
222
|
+
TestHelpers.provideTestContext,
|
|
223
|
+
),
|
|
224
|
+
{ timeout: 60_000 },
|
|
225
|
+
);
|
|
226
|
+
|
|
227
|
+
//
|
|
228
|
+
// Tags
|
|
229
|
+
//
|
|
230
|
+
|
|
231
|
+
it.effect(
|
|
232
|
+
'tag-add: add a tag to an object',
|
|
233
|
+
Effect.fnUntraced(
|
|
234
|
+
function* (_) {
|
|
235
|
+
yield* addDatabaseBlueprint();
|
|
236
|
+
const org = yield* Database.add(Obj.make(Organization.Organization, { name: 'Tagged Corp' }));
|
|
237
|
+
const tag = yield* Database.add(Tag.make({ label: 'important' }));
|
|
238
|
+
yield* AiConversationService.run({
|
|
239
|
+
prompt: `Add tag "important" to the organization "Tagged Corp".`,
|
|
240
|
+
});
|
|
241
|
+
const tags = Obj.getMeta(org).tags ?? [];
|
|
242
|
+
// TODO(dmaretskyi): matcher doesnt work with echo proxies.
|
|
243
|
+
expect([...tags]).toContain(Obj.getDXN(tag).toString());
|
|
244
|
+
},
|
|
245
|
+
provideTestLayers,
|
|
246
|
+
TestHelpers.provideTestContext,
|
|
247
|
+
),
|
|
248
|
+
{ timeout: 60_000 },
|
|
249
|
+
);
|
|
250
|
+
|
|
251
|
+
it.effect(
|
|
252
|
+
'tag-remove: remove a tag from an object',
|
|
253
|
+
Effect.fnUntraced(
|
|
254
|
+
function* (_) {
|
|
255
|
+
yield* addDatabaseBlueprint();
|
|
256
|
+
const org = yield* Database.add(Obj.make(Organization.Organization, { name: 'Untagged Corp' }));
|
|
257
|
+
const tag = yield* Database.add(Tag.make({ label: 'obsolete' }));
|
|
258
|
+
const tagDxn = Obj.getDXN(tag).toString();
|
|
259
|
+
Entity.change(org, (obj) => Entity.addTag(obj, tagDxn));
|
|
260
|
+
expect(Obj.getMeta(org).tags ?? []).toContain(tagDxn);
|
|
261
|
+
yield* AiConversationService.run({
|
|
262
|
+
prompt: `Remove tag "obsolete" from the organization "Untagged Corp".`,
|
|
263
|
+
});
|
|
264
|
+
const tags = Obj.getMeta(org).tags ?? [];
|
|
265
|
+
// TODO(dmaretskyi): matcher doesnt work with echo proxies.
|
|
266
|
+
expect([...tags]).not.toContain(tagDxn);
|
|
267
|
+
},
|
|
268
|
+
provideTestLayers,
|
|
269
|
+
TestHelpers.provideTestContext,
|
|
270
|
+
),
|
|
271
|
+
{ timeout: 60_000 },
|
|
272
|
+
);
|
|
273
|
+
|
|
274
|
+
//
|
|
275
|
+
// Context
|
|
276
|
+
//
|
|
277
|
+
|
|
278
|
+
it.effect(
|
|
279
|
+
'context-add: add object to chat context',
|
|
280
|
+
Effect.fnUntraced(
|
|
281
|
+
function* (_) {
|
|
282
|
+
yield* addDatabaseBlueprint();
|
|
283
|
+
const org = yield* Database.add(Obj.make(Organization.Organization, { name: 'Context Corp' }));
|
|
284
|
+
yield* AiConversationService.run({
|
|
285
|
+
prompt: `Add the organization "Context Corp" to the chat context.`,
|
|
286
|
+
});
|
|
287
|
+
const conversation = yield* AiConversationService;
|
|
288
|
+
const objects = conversation.context.getObjects();
|
|
289
|
+
expect(objects.length).toBeGreaterThanOrEqual(1);
|
|
290
|
+
},
|
|
291
|
+
provideTestLayers,
|
|
292
|
+
TestHelpers.provideTestContext,
|
|
293
|
+
),
|
|
294
|
+
{ timeout: 60_000 },
|
|
295
|
+
);
|
|
296
|
+
|
|
297
|
+
it.effect(
|
|
298
|
+
'context-remove: remove object from chat context',
|
|
299
|
+
Effect.fnUntraced(
|
|
300
|
+
function* (_) {
|
|
301
|
+
yield* addDatabaseBlueprint();
|
|
302
|
+
const org = yield* Database.add(Obj.make(Organization.Organization, { name: 'Remove Context Corp' }));
|
|
303
|
+
const { db } = yield* Database.Service;
|
|
304
|
+
const ref = db.makeRef(Obj.getDXN(org)) as Ref.Ref<any>;
|
|
305
|
+
const { binder } = yield* AiContextService;
|
|
306
|
+
yield* Effect.promise(() => binder.bind({ blueprints: [], objects: [ref] }));
|
|
307
|
+
const dxn = Obj.getDXN(org).toString();
|
|
308
|
+
yield* AiConversationService.run({
|
|
309
|
+
prompt: `Remove the organization "Remove Context Corp" from the chat context.`,
|
|
310
|
+
});
|
|
311
|
+
const conversation = yield* AiConversationService;
|
|
312
|
+
const objects = conversation.context.getObjects();
|
|
313
|
+
const found = objects.find((obj) => Obj.getDXN(obj).toString() === dxn);
|
|
314
|
+
expect(found).toBeUndefined();
|
|
315
|
+
},
|
|
316
|
+
provideTestLayers,
|
|
317
|
+
TestHelpers.provideTestContext,
|
|
318
|
+
),
|
|
319
|
+
{ timeout: 60_000 },
|
|
320
|
+
);
|
|
321
|
+
});
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2025 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import { type AppCapabilities } from '@dxos/app-toolkit';
|
|
6
|
+
import { Blueprint } from '@dxos/blueprints';
|
|
7
|
+
import { Ref } from '@dxos/echo';
|
|
8
|
+
import { Text } from '@dxos/schema';
|
|
9
|
+
import { trim } from '@dxos/util';
|
|
10
|
+
|
|
11
|
+
import { DatabaseFunctions } from './functions';
|
|
12
|
+
|
|
13
|
+
const BLUEPRINT_KEY = 'dxos.org/blueprint/database';
|
|
14
|
+
|
|
15
|
+
const instructions = trim`
|
|
16
|
+
You can query, create, update, and delete objects in ECHO.
|
|
17
|
+
You can manage schemas, relations, tags, and add objects to the chat context.
|
|
18
|
+
`;
|
|
19
|
+
|
|
20
|
+
const functions = Object.values(DatabaseFunctions);
|
|
21
|
+
|
|
22
|
+
const make = () =>
|
|
23
|
+
Blueprint.make({
|
|
24
|
+
key: BLUEPRINT_KEY,
|
|
25
|
+
name: 'Database',
|
|
26
|
+
description: 'Query and manipulate objects in the ECHO database.',
|
|
27
|
+
instructions: {
|
|
28
|
+
source: Ref.make(Text.make(instructions)),
|
|
29
|
+
},
|
|
30
|
+
tools: Blueprint.toolDefinitions({ functions }),
|
|
31
|
+
});
|
|
32
|
+
|
|
33
|
+
const blueprint: AppCapabilities.BlueprintDefinition = {
|
|
34
|
+
key: BLUEPRINT_KEY,
|
|
35
|
+
functions,
|
|
36
|
+
make,
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
export default blueprint;
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2025 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import * as Effect from 'effect/Effect';
|
|
6
|
+
import * as Schema from 'effect/Schema';
|
|
7
|
+
|
|
8
|
+
import { AiContextService } from '@dxos/assistant';
|
|
9
|
+
import { Obj, Ref } from '@dxos/echo';
|
|
10
|
+
import { defineFunction } from '@dxos/functions';
|
|
11
|
+
import { trim } from '@dxos/util';
|
|
12
|
+
|
|
13
|
+
export default defineFunction({
|
|
14
|
+
key: 'dxos.org/function/database/context-add',
|
|
15
|
+
name: 'Add to context',
|
|
16
|
+
description: trim`
|
|
17
|
+
Adds the object to the chat context.
|
|
18
|
+
Use this it for objects that are useful long-term for the conversation.
|
|
19
|
+
`,
|
|
20
|
+
inputSchema: Schema.Struct({
|
|
21
|
+
obj: Ref.Ref(Obj.Unknown).annotations({
|
|
22
|
+
description: 'Object to add to the chat context.',
|
|
23
|
+
}),
|
|
24
|
+
}),
|
|
25
|
+
outputSchema: Schema.Void,
|
|
26
|
+
handler: Effect.fn(function* ({ data: { obj } }) {
|
|
27
|
+
const { binder } = yield* AiContextService;
|
|
28
|
+
yield* Effect.promise(() =>
|
|
29
|
+
binder.bind({
|
|
30
|
+
blueprints: [],
|
|
31
|
+
objects: [obj],
|
|
32
|
+
}),
|
|
33
|
+
);
|
|
34
|
+
}, AiContextService.fixFunctionHandlerType),
|
|
35
|
+
});
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2025 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import * as Effect from 'effect/Effect';
|
|
6
|
+
import * as Schema from 'effect/Schema';
|
|
7
|
+
|
|
8
|
+
import { AiContextService } from '@dxos/assistant';
|
|
9
|
+
import { Obj, Ref } from '@dxos/echo';
|
|
10
|
+
import { defineFunction } from '@dxos/functions';
|
|
11
|
+
import { trim } from '@dxos/util';
|
|
12
|
+
|
|
13
|
+
export default defineFunction({
|
|
14
|
+
key: 'dxos.org/function/database/context-remove',
|
|
15
|
+
name: 'Remove from context',
|
|
16
|
+
description: trim`
|
|
17
|
+
Removes the object from the chat context.
|
|
18
|
+
Use this it for objects that are no longer useful for the conversation.
|
|
19
|
+
`,
|
|
20
|
+
inputSchema: Schema.Struct({
|
|
21
|
+
obj: Ref.Ref(Obj.Unknown).annotations({
|
|
22
|
+
description: 'Object to remove from the chat context.',
|
|
23
|
+
}),
|
|
24
|
+
}),
|
|
25
|
+
outputSchema: Schema.Void,
|
|
26
|
+
handler: Effect.fn(function* ({ data: { obj } }) {
|
|
27
|
+
const { binder } = yield* AiContextService;
|
|
28
|
+
yield* Effect.promise(() =>
|
|
29
|
+
binder.unbind({
|
|
30
|
+
blueprints: [],
|
|
31
|
+
objects: [obj],
|
|
32
|
+
}),
|
|
33
|
+
);
|
|
34
|
+
}, AiContextService.fixFunctionHandlerType),
|
|
35
|
+
});
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2025 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import { default as ContextAdd } from './context-add';
|
|
6
|
+
import { default as ContextRemove } from './context-remove';
|
|
7
|
+
import { default as Load } from './load';
|
|
8
|
+
import { default as ObjectCreate } from './object-create';
|
|
9
|
+
import { default as ObjectDelete } from './object-delete';
|
|
10
|
+
import { default as ObjectUpdate } from './object-update';
|
|
11
|
+
import { default as Query } from './query';
|
|
12
|
+
import { default as RelationCreate } from './relation-create';
|
|
13
|
+
import { default as RelationDelete } from './relation-delete';
|
|
14
|
+
import { default as SchemaAdd } from './schema-add';
|
|
15
|
+
import { default as SchemaList } from './schema-list';
|
|
16
|
+
import { default as TagAdd } from './tag-add';
|
|
17
|
+
import { default as TagRemove } from './tag-remove';
|
|
18
|
+
|
|
19
|
+
export const DatabaseFunctions = {
|
|
20
|
+
ContextAdd,
|
|
21
|
+
ContextRemove,
|
|
22
|
+
Load,
|
|
23
|
+
ObjectCreate,
|
|
24
|
+
ObjectDelete,
|
|
25
|
+
ObjectUpdate,
|
|
26
|
+
Query,
|
|
27
|
+
RelationCreate,
|
|
28
|
+
RelationDelete,
|
|
29
|
+
SchemaAdd,
|
|
30
|
+
SchemaList,
|
|
31
|
+
TagAdd,
|
|
32
|
+
TagRemove,
|
|
33
|
+
};
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2025 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import * as Array from 'effect/Array';
|
|
6
|
+
import * as Effect from 'effect/Effect';
|
|
7
|
+
import * as Schema from 'effect/Schema';
|
|
8
|
+
|
|
9
|
+
import { Database, Entity, Obj, Ref } from '@dxos/echo';
|
|
10
|
+
import { defineFunction } from '@dxos/functions';
|
|
11
|
+
import { trim } from '@dxos/util';
|
|
12
|
+
|
|
13
|
+
export default defineFunction({
|
|
14
|
+
key: 'dxos.org/function/database/load',
|
|
15
|
+
name: 'Load object',
|
|
16
|
+
description: trim`
|
|
17
|
+
Loads the object or relation content.
|
|
18
|
+
Can load multiple objects at at time.
|
|
19
|
+
Use the to read the data when you have a DXN.
|
|
20
|
+
Call this tool with an array of one or more DXNs or object IDs.
|
|
21
|
+
When use see a reference ({ '/': 'dxn:...' }), you can call this function to load the object.
|
|
22
|
+
Note that returned data is only a snapshot in time, and might have changed since the object was last loaded.
|
|
23
|
+
`,
|
|
24
|
+
inputSchema: Schema.Struct({
|
|
25
|
+
refs: Schema.Array(Ref.Ref(Obj.Unknown)),
|
|
26
|
+
}),
|
|
27
|
+
outputSchema: Schema.Unknown,
|
|
28
|
+
handler: Effect.fn(function* ({ data: { refs } }) {
|
|
29
|
+
return yield* Effect.forEach(refs, Database.load).pipe(Effect.map(Array.map(Entity.toJSON)));
|
|
30
|
+
}),
|
|
31
|
+
});
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2025 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import * as Effect from 'effect/Effect';
|
|
6
|
+
import * as Schema from 'effect/Schema';
|
|
7
|
+
|
|
8
|
+
import { Database, Entity, Obj, Type } from '@dxos/echo';
|
|
9
|
+
import { defineFunction } from '@dxos/functions';
|
|
10
|
+
import { invariant } from '@dxos/invariant';
|
|
11
|
+
import { trim } from '@dxos/util';
|
|
12
|
+
|
|
13
|
+
export default defineFunction({
|
|
14
|
+
key: 'dxos.org/function/database/object-create',
|
|
15
|
+
name: 'Create object',
|
|
16
|
+
description: trim`
|
|
17
|
+
Creates a new object and adds it to the current space.
|
|
18
|
+
Get the schema from the schema-list tool and ensure that the data matches the corresponding schema.
|
|
19
|
+
`,
|
|
20
|
+
inputSchema: Schema.Struct({
|
|
21
|
+
typename: Schema.String,
|
|
22
|
+
data: Schema.Any,
|
|
23
|
+
}),
|
|
24
|
+
outputSchema: Schema.Unknown,
|
|
25
|
+
handler: Effect.fn(function* ({ data: { typename, data } }) {
|
|
26
|
+
const { db } = yield* Database.Service;
|
|
27
|
+
const schema = yield* Effect.promise(() =>
|
|
28
|
+
db.schemaRegistry.query({ typename, location: ['database', 'runtime'] }).first(),
|
|
29
|
+
);
|
|
30
|
+
invariant(Type.isObjectSchema(schema), 'Schema is not an object schema');
|
|
31
|
+
|
|
32
|
+
const object = db.add(Obj.make(schema, data));
|
|
33
|
+
return Entity.toJSON(object);
|
|
34
|
+
}),
|
|
35
|
+
});
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2025 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import * as Effect from 'effect/Effect';
|
|
6
|
+
import * as Schema from 'effect/Schema';
|
|
7
|
+
|
|
8
|
+
import { Database, Obj, Ref } from '@dxos/echo';
|
|
9
|
+
import { defineFunction } from '@dxos/functions';
|
|
10
|
+
import { trim } from '@dxos/util';
|
|
11
|
+
|
|
12
|
+
export default defineFunction({
|
|
13
|
+
key: 'dxos.org/function/database/object-delete',
|
|
14
|
+
name: 'Delete object',
|
|
15
|
+
description: trim`
|
|
16
|
+
Deletes the object.
|
|
17
|
+
`,
|
|
18
|
+
inputSchema: Schema.Struct({
|
|
19
|
+
obj: Ref.Ref(Obj.Unknown),
|
|
20
|
+
}),
|
|
21
|
+
outputSchema: Schema.Void,
|
|
22
|
+
handler: Effect.fn(function* ({ data: { obj } }) {
|
|
23
|
+
const { db } = yield* Database.Service;
|
|
24
|
+
const object = yield* Database.load(obj);
|
|
25
|
+
db.remove(object);
|
|
26
|
+
}),
|
|
27
|
+
});
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2025 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import * as Effect from 'effect/Effect';
|
|
6
|
+
import * as Schema from 'effect/Schema';
|
|
7
|
+
|
|
8
|
+
import { Database, Entity, Obj, Ref } from '@dxos/echo';
|
|
9
|
+
import { defineFunction } from '@dxos/functions';
|
|
10
|
+
import { trim } from '@dxos/util';
|
|
11
|
+
|
|
12
|
+
export default defineFunction({
|
|
13
|
+
key: 'dxos.org/function/database/object-update',
|
|
14
|
+
name: 'Update object',
|
|
15
|
+
description: trim`
|
|
16
|
+
Updates the object properties.
|
|
17
|
+
`,
|
|
18
|
+
inputSchema: Schema.Struct({
|
|
19
|
+
obj: Ref.Ref(Obj.Unknown),
|
|
20
|
+
properties: Schema.Record({ key: Schema.String, value: Schema.Any }),
|
|
21
|
+
}),
|
|
22
|
+
outputSchema: Schema.Unknown,
|
|
23
|
+
handler: Effect.fn(function* ({ data: { obj, properties } }) {
|
|
24
|
+
const object = yield* Database.load(obj);
|
|
25
|
+
Entity.change(object as Entity.Any, (obj) => {
|
|
26
|
+
for (const [key, value] of Object.entries(properties)) {
|
|
27
|
+
obj[key] = value;
|
|
28
|
+
}
|
|
29
|
+
});
|
|
30
|
+
return Entity.toJSON(object);
|
|
31
|
+
}),
|
|
32
|
+
});
|