@dxos/assistant-toolkit 0.8.4-main.bc674ce → 0.8.4-main.c85a9c8dae
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/lib/{browser → neutral}/index.mjs +3244 -2496
- 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/{initiative/functions/update.d.ts → blueprints/database/functions/schema-add.d.ts} +3 -3
- 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/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 +3 -3
- 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/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.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/{functions/linear → blueprints/linear/functions}/index.d.ts +3 -3
- 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/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/document/update.d.ts → blueprints/markdown/functions/create.d.ts} +2 -2
- 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/{functions/research → blueprints/research/functions}/document-create.d.ts +2 -1
- package/dist/types/src/blueprints/research/functions/document-create.d.ts.map +1 -0
- package/dist/types/src/{functions/research → blueprints/research/functions}/index.d.ts +6 -8
- 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 +1 -1
- 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/{functions/research/research-graph.d.ts → blueprints/research/types/ResearchGraph.d.ts} +5 -6
- 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 +17 -3
- 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} +1 -1
- package/dist/types/src/blueprints/websearch/toolkit.d.ts.map +1 -0
- package/dist/types/src/crud/graph.d.ts +6 -6
- package/dist/types/src/crud/graph.d.ts.map +1 -1
- 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 +9 -1
- package/dist/types/src/functions/agent/prompt.d.ts.map +1 -1
- package/dist/types/src/functions/entity-extraction/entity-extraction.d.ts +8 -3
- package/dist/types/src/functions/entity-extraction/entity-extraction.d.ts.map +1 -1
- package/dist/types/src/functions/entity-extraction/index.d.ts +10 -6
- package/dist/types/src/functions/entity-extraction/index.d.ts.map +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/index.d.ts +1 -5
- package/dist/types/src/functions/index.d.ts.map +1 -1
- package/dist/types/src/index.d.ts +2 -1
- package/dist/types/src/index.d.ts.map +1 -1
- package/dist/types/src/testing/index.d.ts +1 -0
- package/dist/types/src/testing/index.d.ts.map +1 -1
- package/dist/types/src/testing/plugins.d.ts.map +1 -1
- 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 +1 -2
- package/dist/types/src/toolkits/index.d.ts.map +1 -1
- 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 +38 -43
- 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} +12 -21
- package/src/blueprints/design/{design-blueprint.ts → blueprint.ts} +25 -10
- 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 +4 -7
- package/src/blueprints/discord/functions/index.ts +9 -0
- package/src/blueprints/discord/index.ts +1 -3
- package/src/blueprints/github/functions/index.ts +9 -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 +6 -6
- 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 +5 -6
- 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} +12 -16
- package/src/blueprints/{planning/planning-blueprint.ts → planning-old/blueprint.ts} +24 -10
- package/src/blueprints/planning-old/functions/index.ts +11 -0
- package/src/{functions/tasks → blueprints/planning-old/functions}/read.ts +5 -6
- package/src/{functions/tasks → blueprints/planning-old/functions}/update.ts +5 -6
- package/src/blueprints/planning-old/index.ts +5 -0
- package/src/{initiative/initiative.test.ts → blueprints/project/blueprint.test.ts} +138 -44
- 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/{research-blueprint.ts → blueprint.ts} +25 -11
- package/src/{functions/research → blueprints/research/functions}/document-create.ts +8 -11
- package/src/blueprints/research/functions/index.ts +11 -0
- package/src/blueprints/research/functions/research.conversations.json +1 -0
- package/src/{functions/research → blueprints/research/functions}/research.test.ts +33 -55
- package/src/{functions/research → blueprints/research/functions}/research.ts +13 -27
- package/src/blueprints/research/index.ts +2 -3
- package/src/blueprints/research/types/ResearchGraph.ts +49 -0
- package/src/{functions/research/types.ts → blueprints/research/types/index.ts} +12 -6
- package/src/blueprints/testing.ts +35 -4
- package/src/blueprints/websearch/blueprint.ts +32 -0
- package/src/blueprints/websearch/index.ts +2 -5
- package/src/crud/graph.test.ts +2 -2
- package/src/crud/graph.ts +9 -9
- package/src/functions/READ_THIS.md +5 -0
- package/src/functions/agent/index.ts +4 -6
- package/src/functions/agent/prompt.ts +15 -25
- package/src/functions/entity-extraction/entity-extraction.conversations.json +1 -6597
- package/src/functions/entity-extraction/entity-extraction.test.ts +11 -30
- package/src/functions/entity-extraction/entity-extraction.ts +12 -14
- 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/index.ts +1 -5
- package/src/index.ts +2 -1
- package/src/sync/sync.ts +2 -2
- package/src/testing/index.ts +1 -0
- package/src/testing/plugins.tsx +21 -17
- package/src/toolkits/WebToolkit.ts +33 -0
- package/src/toolkits/index.ts +1 -2
- 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/browser/testing/index.mjs +0 -43
- package/dist/lib/browser/testing/index.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-HSLMI22Q.mjs +0 -11
- package/dist/lib/node-esm/chunk-HSLMI22Q.mjs.map +0 -7
- package/dist/lib/node-esm/index.mjs +0 -2881
- package/dist/lib/node-esm/index.mjs.map +0 -7
- package/dist/lib/node-esm/meta.json +0 -1
- package/dist/lib/node-esm/testing/index.mjs +0 -44
- package/dist/lib/node-esm/testing/index.mjs.map +0 -7
- package/dist/types/src/blueprints/design/design-blueprint.d.ts +0 -18
- 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 -18
- 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 -18
- 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 -18
- 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 -13
- 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.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.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/document-create.d.ts.map +0 -1
- package/dist/types/src/functions/research/index.d.ts.map +0 -1
- 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 -6
- 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/initiative/Initiative.d.ts +0 -84
- package/dist/types/src/initiative/Initiative.d.ts.map +0 -1
- package/dist/types/src/initiative/InitiativeSchema.d.ts +0 -19
- package/dist/types/src/initiative/InitiativeSchema.d.ts.map +0 -1
- package/dist/types/src/initiative/functions/agent.d.ts +0 -37
- package/dist/types/src/initiative/functions/agent.d.ts.map +0 -1
- package/dist/types/src/initiative/functions/getContext.d.ts +0 -17
- package/dist/types/src/initiative/functions/getContext.d.ts.map +0 -1
- package/dist/types/src/initiative/functions/index.d.ts +0 -4
- package/dist/types/src/initiative/functions/index.d.ts.map +0 -1
- package/dist/types/src/initiative/functions/update.d.ts.map +0 -1
- package/dist/types/src/initiative/index.d.ts.map +0 -1
- package/dist/types/src/initiative/initiative.test.d.ts +0 -2
- package/dist/types/src/initiative/initiative.test.d.ts.map +0 -1
- package/dist/types/src/toolkits/AssistantToolkit.d.ts +0 -43
- package/dist/types/src/toolkits/AssistantToolkit.d.ts.map +0 -1
- package/dist/types/src/toolkits/AssistantToolkit.test.d.ts +0 -2
- package/dist/types/src/toolkits/AssistantToolkit.test.d.ts.map +0 -1
- package/dist/types/src/toolkits/SystemToolkit.d.ts +0 -99
- package/dist/types/src/toolkits/SystemToolkit.d.ts.map +0 -1
- package/src/blueprints/discord/discord-blueprint.ts +0 -32
- package/src/blueprints/linear/linear-blueprint.ts +0 -33
- package/src/blueprints/websearch/websearch-blueprint.ts +0 -18
- package/src/experimental/feed.test.ts +0 -111
- package/src/functions/discord/index.ts +0 -9
- package/src/functions/document/index.ts +0 -12
- package/src/functions/document/read.ts +0 -30
- package/src/functions/linear/index.ts +0 -9
- package/src/functions/linear/linear.test.ts +0 -84
- package/src/functions/research/index.ts +0 -14
- package/src/functions/research/research-graph.ts +0 -49
- package/src/functions/research/research.conversations.json +0 -1
- package/src/functions/tasks/index.ts +0 -11
- package/src/initiative/Initiative.ts +0 -99
- package/src/initiative/InitiativeSchema.ts +0 -37
- package/src/initiative/functions/agent.ts +0 -57
- package/src/initiative/functions/getContext.ts +0 -74
- package/src/initiative/functions/index.ts +0 -7
- package/src/initiative/functions/update.ts +0 -63
- package/src/initiative/initiative.conversations.json +0 -1
- package/src/toolkits/AssistantToolkit.conversations.json +0 -1
- package/src/toolkits/AssistantToolkit.test.ts +0 -94
- package/src/toolkits/AssistantToolkit.ts +0 -70
- package/src/toolkits/SystemToolkit.ts +0 -299
- /package/dist/lib/{browser → neutral}/chunk-J5LGTIGS.mjs +0 -0
- /package/dist/lib/{browser → neutral}/chunk-J5LGTIGS.mjs.map +0 -0
- /package/dist/types/src/{functions/discord → blueprints/discord/functions}/fetch-messages.d.ts +0 -0
- /package/dist/types/src/{functions/discord → blueprints/discord/functions}/fetch-messages.test.d.ts +0 -0
- /package/dist/types/src/{functions/github → blueprints/github/functions}/fetch-prs.d.ts +0 -0
- /package/dist/types/src/{initiative → blueprints/github}/index.d.ts +0 -0
- /package/dist/types/src/{functions/linear → blueprints/linear/functions}/linear.test.d.ts +0 -0
- /package/dist/types/src/{functions/linear → blueprints/linear/functions}/sync-issues.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/src/{functions/discord → blueprints/discord/functions}/fetch-messages.ts +0 -0
- /package/src/{functions/github → blueprints/github/functions}/fetch-prs.ts +0 -0
- /package/src/{initiative → blueprints/github}/index.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/{functions/research → blueprints/research/functions}/research-instructions.tpl +0 -0
- /package/src/blueprints/websearch/{websearch-toolkit.ts → toolkit.ts} +0 -0
|
@@ -6,75 +6,53 @@ import { inspect } from 'node:util';
|
|
|
6
6
|
|
|
7
7
|
import { describe, it } from '@effect/vitest';
|
|
8
8
|
import * as Effect from 'effect/Effect';
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
14
|
-
AiConversation,
|
|
15
|
-
type ContextBinding,
|
|
16
|
-
GenerationObserver,
|
|
17
|
-
makeToolExecutionServiceFromFunctions,
|
|
18
|
-
makeToolResolverFromFunctions,
|
|
19
|
-
} from '@dxos/assistant';
|
|
9
|
+
|
|
10
|
+
import { ConsolePrinter } from '@dxos/ai';
|
|
11
|
+
import { MemoizedAiService } from '@dxos/ai/testing';
|
|
12
|
+
import { AiConversation, type ContextBinding, GenerationObserver } from '@dxos/assistant';
|
|
13
|
+
import { AssistantTestLayer } from '@dxos/assistant/testing';
|
|
20
14
|
import { Blueprint } from '@dxos/blueprints';
|
|
21
15
|
import { Database, Filter, Obj, Query, Ref } from '@dxos/echo';
|
|
22
16
|
import { acquireReleaseResource } from '@dxos/effect';
|
|
23
17
|
import { TestHelpers } from '@dxos/effect/testing';
|
|
24
|
-
import {
|
|
25
|
-
import { FunctionInvocationServiceLayerTest, TestDatabaseLayer } from '@dxos/functions-runtime/testing';
|
|
18
|
+
import { FunctionInvocationService, QueueService } from '@dxos/functions';
|
|
26
19
|
import { invariant } from '@dxos/invariant';
|
|
27
20
|
import { ObjectId } from '@dxos/keys';
|
|
28
21
|
import { MarkdownBlueprint } from '@dxos/plugin-markdown/blueprints';
|
|
29
22
|
import { Markdown } from '@dxos/plugin-markdown/types';
|
|
30
23
|
import { HasSubject, type Message, Organization } from '@dxos/types';
|
|
31
24
|
|
|
32
|
-
import
|
|
33
|
-
import {
|
|
25
|
+
import ResearchBlueprint from '../blueprint';
|
|
26
|
+
import { ResearchDataTypes, ResearchGraph } from '../types';
|
|
34
27
|
|
|
35
28
|
import { default as createDocument } from './document-create';
|
|
36
29
|
import { default as research } from './research';
|
|
37
|
-
import { ResearchGraph, queryResearchGraph } from './research-graph';
|
|
38
|
-
import { ResearchDataTypes } from './types';
|
|
39
30
|
|
|
40
31
|
ObjectId.dangerouslyDisableRandomness();
|
|
41
32
|
|
|
42
|
-
const TestLayer =
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
Layer.provideMerge(
|
|
53
|
-
Layer.mergeAll(
|
|
54
|
-
TestAiService(),
|
|
55
|
-
TestDatabaseLayer({
|
|
56
|
-
spaceKey: 'fixed',
|
|
57
|
-
indexing: { vector: true },
|
|
58
|
-
types: [...ResearchDataTypes, ResearchGraph, Blueprint.Blueprint, Markdown.Document, HasSubject.HasSubject],
|
|
59
|
-
}),
|
|
60
|
-
CredentialsService.configuredLayer([]),
|
|
61
|
-
TracingService.layerNoop,
|
|
62
|
-
),
|
|
63
|
-
),
|
|
64
|
-
);
|
|
33
|
+
const TestLayer = AssistantTestLayer({
|
|
34
|
+
functions: [research, createDocument, ...MarkdownBlueprint.functions],
|
|
35
|
+
types: [
|
|
36
|
+
...ResearchDataTypes,
|
|
37
|
+
ResearchGraph.ResearchGraph,
|
|
38
|
+
Blueprint.Blueprint,
|
|
39
|
+
Markdown.Document,
|
|
40
|
+
HasSubject.HasSubject,
|
|
41
|
+
],
|
|
42
|
+
});
|
|
65
43
|
|
|
66
44
|
describe('Research', () => {
|
|
67
45
|
it.effect(
|
|
68
46
|
'call a function to generate a research report',
|
|
69
47
|
Effect.fnUntraced(
|
|
70
48
|
function* (_) {
|
|
71
|
-
yield* Database.
|
|
49
|
+
yield* Database.add(
|
|
72
50
|
Obj.make(Organization.Organization, {
|
|
73
51
|
name: 'BlueYard',
|
|
74
52
|
website: 'https://blueyard.com',
|
|
75
53
|
}),
|
|
76
54
|
);
|
|
77
|
-
yield* Database.
|
|
55
|
+
yield* Database.flush({ indexes: true });
|
|
78
56
|
const result = yield* FunctionInvocationService.invokeFunction(research, {
|
|
79
57
|
query: 'Founders and portfolio of BlueYard.',
|
|
80
58
|
});
|
|
@@ -82,10 +60,10 @@ describe('Research', () => {
|
|
|
82
60
|
console.log(inspect(result, { depth: null, colors: true }));
|
|
83
61
|
console.log(JSON.stringify(result, null, 2));
|
|
84
62
|
|
|
85
|
-
yield* Database.
|
|
86
|
-
const researchGraph = yield*
|
|
63
|
+
yield* Database.flush({ indexes: true });
|
|
64
|
+
const researchGraph = yield* ResearchGraph.query();
|
|
87
65
|
if (researchGraph) {
|
|
88
|
-
const data = yield* Database.
|
|
66
|
+
const data = yield* Database.load(researchGraph.queue).pipe(
|
|
89
67
|
Effect.flatMap((queue) => Effect.promise(() => queue.queryObjects())),
|
|
90
68
|
);
|
|
91
69
|
console.log(inspect(data, { depth: null, colors: true }));
|
|
@@ -101,7 +79,7 @@ describe('Research', () => {
|
|
|
101
79
|
'create and update research report',
|
|
102
80
|
Effect.fnUntraced(
|
|
103
81
|
function* (_) {
|
|
104
|
-
const organization = yield* Database.
|
|
82
|
+
const organization = yield* Database.add(
|
|
105
83
|
Obj.make(Organization.Organization, {
|
|
106
84
|
name: 'BlueYard',
|
|
107
85
|
website: 'https://blueyard.com',
|
|
@@ -111,9 +89,9 @@ describe('Research', () => {
|
|
|
111
89
|
const queue = yield* QueueService.createQueue<Message.Message | ContextBinding>();
|
|
112
90
|
const conversation = yield* acquireReleaseResource(() => new AiConversation({ queue }));
|
|
113
91
|
|
|
114
|
-
yield* Database.
|
|
115
|
-
const researchBlueprint = yield* Database.
|
|
116
|
-
const markdownBlueprint = yield* Database.
|
|
92
|
+
yield* Database.flush({ indexes: true });
|
|
93
|
+
const researchBlueprint = yield* Database.add(Obj.clone(ResearchBlueprint.make()));
|
|
94
|
+
const markdownBlueprint = yield* Database.add(Obj.clone(MarkdownBlueprint.make()));
|
|
117
95
|
yield* Effect.promise(() =>
|
|
118
96
|
conversation.context.bind({
|
|
119
97
|
blueprints: [Ref.make(researchBlueprint), Ref.make(markdownBlueprint)],
|
|
@@ -128,18 +106,18 @@ describe('Research', () => {
|
|
|
128
106
|
prompt: `Create a research summary about ${organization.name}.`,
|
|
129
107
|
});
|
|
130
108
|
{
|
|
131
|
-
const docs = yield* Database.
|
|
109
|
+
const docs = yield* Database.runQuery(
|
|
132
110
|
Query.select(Filter.id(organization.id)).targetOf(HasSubject.HasSubject).source(),
|
|
133
111
|
);
|
|
134
112
|
if (docs.length !== 1) {
|
|
135
|
-
throw new Error(`Expected 1 research document; got ${docs.length}: ${docs.map((_) => _.name)}`);
|
|
113
|
+
throw new Error(`Expected 1 research document; got ${docs.length}: ${docs.map((_) => (_ as any).name)}`);
|
|
136
114
|
}
|
|
137
115
|
|
|
138
116
|
const doc = docs[0];
|
|
139
117
|
invariant(Obj.instanceOf(Markdown.Document, doc));
|
|
140
118
|
console.log({
|
|
141
119
|
name: doc.name,
|
|
142
|
-
content: yield* Database.
|
|
120
|
+
content: yield* Database.load(doc.content).pipe(Effect.map((_) => _.content)),
|
|
143
121
|
});
|
|
144
122
|
}
|
|
145
123
|
|
|
@@ -148,18 +126,18 @@ describe('Research', () => {
|
|
|
148
126
|
prompt: 'Add a section about their portfolio.',
|
|
149
127
|
});
|
|
150
128
|
{
|
|
151
|
-
const docs = yield* Database.
|
|
129
|
+
const docs = yield* Database.runQuery(
|
|
152
130
|
Query.select(Filter.id(organization.id)).targetOf(HasSubject.HasSubject).source(),
|
|
153
131
|
);
|
|
154
132
|
if (docs.length !== 1) {
|
|
155
|
-
throw new Error(`Expected 1 research document; got ${docs.length}: ${docs.map((_) => _.name)}`);
|
|
133
|
+
throw new Error(`Expected 1 research document; got ${docs.length}: ${docs.map((_) => (_ as any).name)}`);
|
|
156
134
|
}
|
|
157
135
|
|
|
158
136
|
const doc = docs[0];
|
|
159
137
|
invariant(Obj.instanceOf(Markdown.Document, doc));
|
|
160
138
|
console.log({
|
|
161
139
|
name: doc.name,
|
|
162
|
-
content: yield* Database.
|
|
140
|
+
content: yield* Database.load(doc.content).pipe(Effect.map((_) => _.content)),
|
|
163
141
|
});
|
|
164
142
|
}
|
|
165
143
|
},
|
|
@@ -13,27 +13,20 @@ import * as Schema from 'effect/Schema';
|
|
|
13
13
|
import * as String from 'effect/String';
|
|
14
14
|
|
|
15
15
|
import { AiService, ConsolePrinter } from '@dxos/ai';
|
|
16
|
-
import {
|
|
17
|
-
|
|
18
|
-
GenerationObserver,
|
|
19
|
-
createToolkit,
|
|
20
|
-
makeToolExecutionServiceFromFunctions,
|
|
21
|
-
makeToolResolverFromFunctions,
|
|
22
|
-
} from '@dxos/assistant';
|
|
16
|
+
import { GenericToolkit } from '@dxos/ai';
|
|
17
|
+
import { AiSession, GenerationObserver, ToolExecutionServices, createToolkit } from '@dxos/assistant';
|
|
23
18
|
import { Template } from '@dxos/blueprints';
|
|
24
19
|
import { type DXN, Entity, Obj } from '@dxos/echo';
|
|
25
20
|
import { Database } from '@dxos/echo';
|
|
26
21
|
import { TracingService, defineFunction } from '@dxos/functions';
|
|
27
|
-
import { FunctionInvocationServiceLayerTestMocked } from '@dxos/functions-runtime/testing';
|
|
28
22
|
import { type Message, Person } from '@dxos/types';
|
|
29
23
|
import { trim } from '@dxos/util';
|
|
30
24
|
|
|
31
|
-
import { LocalSearchHandler, LocalSearchToolkit, makeGraphWriterHandler, makeGraphWriterToolkit } from '
|
|
32
|
-
import {
|
|
25
|
+
import { LocalSearchHandler, LocalSearchToolkit, makeGraphWriterHandler, makeGraphWriterToolkit } from '../../../crud';
|
|
26
|
+
import { ResearchGraph } from '../types';
|
|
27
|
+
import { ResearchDataTypes } from '../types';
|
|
33
28
|
|
|
34
|
-
import { contextQueueLayerFromResearchGraph } from './research-graph';
|
|
35
29
|
import PROMPT from './research-instructions.tpl?raw';
|
|
36
|
-
import { ResearchDataTypes } from './types';
|
|
37
30
|
|
|
38
31
|
/**
|
|
39
32
|
* Exec external service and return the results as a Subgraph.
|
|
@@ -85,7 +78,7 @@ export default defineFunction({
|
|
|
85
78
|
handler: Effect.fnUntraced(
|
|
86
79
|
function* ({ data: { query, instructions, mockSearch = false, entityExtraction = false } }) {
|
|
87
80
|
if (mockSearch) {
|
|
88
|
-
const mockPerson = yield* Database.
|
|
81
|
+
const mockPerson = yield* Database.add(
|
|
89
82
|
Obj.make(Person.Person, {
|
|
90
83
|
preferredName: 'John Doe',
|
|
91
84
|
emails: [{ value: 'john.doe@example.com' }],
|
|
@@ -102,7 +95,7 @@ export default defineFunction({
|
|
|
102
95
|
};
|
|
103
96
|
}
|
|
104
97
|
|
|
105
|
-
yield* Database.
|
|
98
|
+
yield* Database.flush({ indexes: true });
|
|
106
99
|
yield* TracingService.emitStatus({ message: 'Starting research...' });
|
|
107
100
|
|
|
108
101
|
const NativeWebSearch = Toolkit.make(AnthropicTool.WebSearch_20250305({}));
|
|
@@ -119,7 +112,7 @@ export default defineFunction({
|
|
|
119
112
|
|
|
120
113
|
toolkit = Toolkit.merge(toolkit, LocalSearchToolkit, GraphWriterToolkit);
|
|
121
114
|
handlers = Layer.mergeAll(handlers, LocalSearchHandler, GraphWriterHandler).pipe(
|
|
122
|
-
Layer.provide(
|
|
115
|
+
Layer.provide(ResearchGraph.contextQueueLayer),
|
|
123
116
|
) as any;
|
|
124
117
|
}
|
|
125
118
|
|
|
@@ -136,7 +129,7 @@ export default defineFunction({
|
|
|
136
129
|
observer: GenerationObserver.fromPrinter(new ConsolePrinter({ tag: 'research' })),
|
|
137
130
|
});
|
|
138
131
|
|
|
139
|
-
const objects = yield* Effect.forEach(objectDXNs, (dxn) => Database.
|
|
132
|
+
const objects = yield* Effect.forEach(objectDXNs, (dxn) => Database.resolve(dxn)).pipe(
|
|
140
133
|
Effect.map(Array.map((obj) => Entity.toJSON(obj))),
|
|
141
134
|
);
|
|
142
135
|
|
|
@@ -146,16 +139,9 @@ export default defineFunction({
|
|
|
146
139
|
};
|
|
147
140
|
},
|
|
148
141
|
Effect.provide(
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
makeToolResolverFromFunctions([exaFunction, exaMockFunction], Toolkit.make()),
|
|
153
|
-
makeToolExecutionServiceFromFunctions(Toolkit.make() as any, Layer.empty as any),
|
|
154
|
-
).pipe(
|
|
155
|
-
Layer.provide(
|
|
156
|
-
// TODO(dmaretskyi): This should be provided by environment.
|
|
157
|
-
Layer.mergeAll(FunctionInvocationServiceLayerTestMocked({ functions: [exaFunction, exaMockFunction] })),
|
|
158
|
-
),
|
|
142
|
+
AiService.model('@anthropic/claude-sonnet-4-0').pipe(
|
|
143
|
+
Layer.merge(ToolExecutionServices),
|
|
144
|
+
Layer.provide(GenericToolkit.providerEmpty),
|
|
159
145
|
),
|
|
160
146
|
),
|
|
161
147
|
),
|
|
@@ -177,7 +163,7 @@ const extractLastTextBlock = (result: Message.Message[]) => {
|
|
|
177
163
|
Function.flow(
|
|
178
164
|
(_: Message.Message) => _.blocks,
|
|
179
165
|
Array.reverse,
|
|
180
|
-
Array.dropWhile((_: any) => _._tag === '
|
|
166
|
+
Array.dropWhile((_: any) => _._tag === 'stats'),
|
|
181
167
|
Array.takeWhile((_: any) => _._tag === 'text'),
|
|
182
168
|
Array.reverse,
|
|
183
169
|
Array.map((_: any) => _.text),
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2025 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import * as Effect from 'effect/Effect';
|
|
6
|
+
import * as Layer from 'effect/Layer';
|
|
7
|
+
import * as Schema from 'effect/Schema';
|
|
8
|
+
|
|
9
|
+
import { Database, Obj, Query, Ref, Type } from '@dxos/echo';
|
|
10
|
+
import { SystemTypeAnnotation } from '@dxos/echo/internal';
|
|
11
|
+
import { Queue } from '@dxos/echo-db';
|
|
12
|
+
import { ContextQueueService, QueueService } from '@dxos/functions';
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* Container for a set of ephemeral research results.
|
|
16
|
+
*/
|
|
17
|
+
export const ResearchGraph = Schema.Struct({
|
|
18
|
+
queue: Ref.Ref(Queue),
|
|
19
|
+
}).pipe(
|
|
20
|
+
Type.object({
|
|
21
|
+
typename: 'dxos.org/type/ResearchGraph',
|
|
22
|
+
version: '0.1.0',
|
|
23
|
+
}),
|
|
24
|
+
SystemTypeAnnotation.set(true),
|
|
25
|
+
);
|
|
26
|
+
|
|
27
|
+
export interface ResearchGraph extends Schema.Schema.Type<typeof ResearchGraph> {}
|
|
28
|
+
|
|
29
|
+
export const create: () => Effect.Effect<ResearchGraph, never, Database.Service | QueueService> = Effect.fn(
|
|
30
|
+
'createResearchGraph',
|
|
31
|
+
)(function* () {
|
|
32
|
+
const queue = yield* QueueService.createQueue();
|
|
33
|
+
return yield* Database.add(Obj.make(ResearchGraph, { queue: Ref.fromDXN(queue.dxn) }));
|
|
34
|
+
});
|
|
35
|
+
|
|
36
|
+
export const query: () => Effect.Effect<ResearchGraph | undefined, never, Database.Service> = Effect.fn(
|
|
37
|
+
'queryResearchGraph',
|
|
38
|
+
)(function* () {
|
|
39
|
+
const objects = yield* Database.runQuery(Query.type(ResearchGraph));
|
|
40
|
+
return objects.at(0);
|
|
41
|
+
});
|
|
42
|
+
|
|
43
|
+
export const contextQueueLayer = Layer.unwrapEffect(
|
|
44
|
+
Effect.gen(function* () {
|
|
45
|
+
const researchGraph = (yield* query()) ?? (yield* create());
|
|
46
|
+
const researchQueue = yield* Database.load(researchGraph.queue);
|
|
47
|
+
return ContextQueueService.layer(researchQueue);
|
|
48
|
+
}),
|
|
49
|
+
);
|
|
@@ -1,26 +1,32 @@
|
|
|
1
1
|
//
|
|
2
|
-
// Copyright
|
|
2
|
+
// Copyright 2026 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
5
|
import { type Type } from '@dxos/echo';
|
|
6
6
|
import { Text } from '@dxos/schema';
|
|
7
|
-
import { Event, HasConnection, HasRelationship, LegacyOrganization, LegacyPerson,
|
|
7
|
+
import { Event, HasConnection, HasRelationship, LegacyOrganization, LegacyPerson, Pipeline, Task } from '@dxos/types';
|
|
8
|
+
|
|
9
|
+
export * as ResearchGraph from './ResearchGraph';
|
|
8
10
|
|
|
9
11
|
/**
|
|
10
12
|
* Data types for research.
|
|
11
13
|
*/
|
|
12
|
-
|
|
14
|
+
// TODO(burdon): This should not be hardcoded.
|
|
15
|
+
export const ResearchDataTypes: Type.AnyEntity[] = [
|
|
13
16
|
// Objects
|
|
14
17
|
Event.Event,
|
|
15
|
-
LegacyOrganization,
|
|
16
18
|
Task.Task,
|
|
17
19
|
Text.Text,
|
|
18
20
|
|
|
19
|
-
// Relations
|
|
20
21
|
// TODO(wittjosiah): Until views (e.g., Table) support relations this needs to be expressed via organization ref.
|
|
21
22
|
// Employer.Employer,
|
|
23
|
+
// Organization.Organization,
|
|
22
24
|
LegacyPerson,
|
|
23
|
-
|
|
25
|
+
LegacyOrganization,
|
|
26
|
+
|
|
27
|
+
Pipeline.Pipeline,
|
|
28
|
+
|
|
29
|
+
// Relations
|
|
24
30
|
HasRelationship.HasRelationship,
|
|
25
31
|
HasConnection.HasConnection,
|
|
26
32
|
];
|
|
@@ -2,17 +2,36 @@
|
|
|
2
2
|
// Copyright 2025 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import * as
|
|
5
|
+
import * as Arr from 'effect/Array';
|
|
6
6
|
import * as Effect from 'effect/Effect';
|
|
7
|
+
import { pipe } from 'effect/Function';
|
|
7
8
|
|
|
8
9
|
import { ConsolePrinter } from '@dxos/ai';
|
|
9
|
-
import {
|
|
10
|
+
import {
|
|
11
|
+
AiContextService,
|
|
12
|
+
type AiConversation,
|
|
13
|
+
type AiConversationRunProps,
|
|
14
|
+
GenerationObserver,
|
|
15
|
+
} from '@dxos/assistant';
|
|
16
|
+
import type { Blueprint } from '@dxos/blueprints';
|
|
17
|
+
import { Database, Ref } from '@dxos/echo';
|
|
18
|
+
import { type FunctionDefinition } from '@dxos/functions';
|
|
10
19
|
import { log } from '@dxos/log';
|
|
11
20
|
|
|
12
21
|
export type TestStep = Pick<AiConversationRunProps, 'prompt' | 'system'> & {
|
|
13
22
|
test?: () => Promise<void>;
|
|
14
23
|
};
|
|
15
24
|
|
|
25
|
+
/**
|
|
26
|
+
* Blueprint definition type for testing.
|
|
27
|
+
* Mirrors AppCapabilities.BlueprintDefinition to avoid circular dependency with app-toolkit.
|
|
28
|
+
*/
|
|
29
|
+
export interface BlueprintDefinition {
|
|
30
|
+
key: string;
|
|
31
|
+
functions: FunctionDefinition.Any[];
|
|
32
|
+
make: () => Blueprint.Blueprint;
|
|
33
|
+
}
|
|
34
|
+
|
|
16
35
|
/**
|
|
17
36
|
* Runs the prompt steps, calling the test function after each step.
|
|
18
37
|
*/
|
|
@@ -30,5 +49,17 @@ export const runSteps = Effect.fn(function* (conversation: AiConversation, steps
|
|
|
30
49
|
}
|
|
31
50
|
});
|
|
32
51
|
|
|
33
|
-
|
|
34
|
-
|
|
52
|
+
/**
|
|
53
|
+
* Binds blueprints from the blueprint definitions.
|
|
54
|
+
*/
|
|
55
|
+
// TODO(dmaretskyi): Potentially the agent will auto-bind the blueprints.
|
|
56
|
+
export const addBlueprints = Effect.fnUntraced(function* (blueprints: BlueprintDefinition[]) {
|
|
57
|
+
yield* AiContextService.bindContext({
|
|
58
|
+
blueprints: yield* pipe(
|
|
59
|
+
blueprints,
|
|
60
|
+
Arr.map((blueprint) => blueprint.make()),
|
|
61
|
+
Effect.forEach(Database.add),
|
|
62
|
+
Effect.map(Arr.map(Ref.make)),
|
|
63
|
+
),
|
|
64
|
+
});
|
|
65
|
+
});
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2025 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import { ToolId } from '@dxos/ai';
|
|
6
|
+
import { type AppCapabilities } from '@dxos/app-toolkit';
|
|
7
|
+
import { Blueprint } from '@dxos/blueprints';
|
|
8
|
+
import { Ref } from '@dxos/echo';
|
|
9
|
+
import { Text } from '@dxos/schema';
|
|
10
|
+
|
|
11
|
+
const BLUEPRINT_KEY = 'dxos.org/blueprint/web-search';
|
|
12
|
+
|
|
13
|
+
const functions: AppCapabilities.BlueprintDefinition['functions'] = [];
|
|
14
|
+
|
|
15
|
+
const make = () =>
|
|
16
|
+
Blueprint.make({
|
|
17
|
+
key: BLUEPRINT_KEY,
|
|
18
|
+
name: 'Web Search',
|
|
19
|
+
description: 'Search the web.',
|
|
20
|
+
instructions: {
|
|
21
|
+
source: Ref.make(Text.make()),
|
|
22
|
+
},
|
|
23
|
+
tools: [ToolId.make('AnthropicWebSearch')],
|
|
24
|
+
});
|
|
25
|
+
|
|
26
|
+
const blueprint: AppCapabilities.BlueprintDefinition = {
|
|
27
|
+
key: BLUEPRINT_KEY,
|
|
28
|
+
functions,
|
|
29
|
+
make,
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
export default blueprint;
|
|
@@ -2,8 +2,5 @@
|
|
|
2
2
|
// Copyright 2025 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
export { WebSearchToolkit } from './websearch-toolkit';
|
|
8
|
-
|
|
9
|
-
export default blueprint;
|
|
5
|
+
export { default as WebSearchBlueprint } from './blueprint';
|
|
6
|
+
export { WebSearchToolkit } from './toolkit';
|
package/src/crud/graph.test.ts
CHANGED
|
@@ -10,7 +10,7 @@ import { AiSession } from '@dxos/assistant';
|
|
|
10
10
|
import { AssistantTestLayer } from '@dxos/assistant/testing';
|
|
11
11
|
import { TestHelpers } from '@dxos/effect/testing';
|
|
12
12
|
import { log } from '@dxos/log';
|
|
13
|
-
import {
|
|
13
|
+
import { Pipeline } from '@dxos/types';
|
|
14
14
|
|
|
15
15
|
import { makeGraphWriterHandler, makeGraphWriterToolkit } from './graph';
|
|
16
16
|
|
|
@@ -23,7 +23,7 @@ describe('graph', () => {
|
|
|
23
23
|
// const relatedSchemas = await findRelatedSchema(db, Schema.Struct({}));
|
|
24
24
|
// });
|
|
25
25
|
|
|
26
|
-
const Toolkit = makeGraphWriterToolkit({ schema: [
|
|
26
|
+
const Toolkit = makeGraphWriterToolkit({ schema: [Pipeline.Pipeline] });
|
|
27
27
|
const ToolkitLayer = makeGraphWriterHandler(Toolkit);
|
|
28
28
|
|
|
29
29
|
it.effect.skip(
|
package/src/crud/graph.ts
CHANGED
|
@@ -40,7 +40,7 @@ export const Subgraph = Schema.Struct({
|
|
|
40
40
|
export interface Subgraph extends Schema.Schema.Type<typeof Subgraph> {}
|
|
41
41
|
|
|
42
42
|
export type RelatedSchema = {
|
|
43
|
-
schema: Type.
|
|
43
|
+
schema: Type.AnyEntity;
|
|
44
44
|
kind: 'reference' | 'relation';
|
|
45
45
|
};
|
|
46
46
|
|
|
@@ -51,7 +51,7 @@ export type RelatedSchema = {
|
|
|
51
51
|
* @param schema
|
|
52
52
|
* @returns
|
|
53
53
|
*/
|
|
54
|
-
export const findRelatedSchema = async (db: Database.Database, anchor: Type.
|
|
54
|
+
export const findRelatedSchema = async (db: Database.Database, anchor: Type.AnyEntity): Promise<RelatedSchema[]> => {
|
|
55
55
|
// TODO(dmaretskyi): Query stored schemas.
|
|
56
56
|
const allSchemas = await db.graph.schemaRegistry.query().run();
|
|
57
57
|
|
|
@@ -79,7 +79,7 @@ export const findRelatedSchema = async (db: Database.Database, anchor: Type.Enti
|
|
|
79
79
|
* Non-strict DXN comparison.
|
|
80
80
|
* Returns true if the DXN could be resolved to the schema.
|
|
81
81
|
*/
|
|
82
|
-
const isSchemaAddressableByDxn = (schema: Type.
|
|
82
|
+
const isSchemaAddressableByDxn = (schema: Type.AnyEntity, dxn: DXN): boolean => {
|
|
83
83
|
if (getTypeIdentifierAnnotation(schema) === dxn.toString()) {
|
|
84
84
|
return true;
|
|
85
85
|
}
|
|
@@ -112,7 +112,7 @@ export const LocalSearchToolkit = Toolkit.make(
|
|
|
112
112
|
|
|
113
113
|
export const LocalSearchHandler = LocalSearchToolkit.toLayer({
|
|
114
114
|
search_local_search: Effect.fn(function* ({ query }) {
|
|
115
|
-
const objects = yield* Database.
|
|
115
|
+
const objects = yield* Database.runQuery(Query.select(Filter.text(query, { type: 'vector' })));
|
|
116
116
|
const results = [...objects];
|
|
117
117
|
|
|
118
118
|
const option = yield* Effect.serviceOption(ContextQueueService);
|
|
@@ -136,14 +136,14 @@ export const LocalSearchHandler = LocalSearchToolkit.toLayer({
|
|
|
136
136
|
class GraphWriterSchema extends Context.Tag('@dxos/assistant/GraphWriterSchema')<
|
|
137
137
|
GraphWriterSchema,
|
|
138
138
|
{
|
|
139
|
-
schema: Type.
|
|
139
|
+
schema: Type.AnyEntity[];
|
|
140
140
|
}
|
|
141
141
|
>() {}
|
|
142
142
|
|
|
143
143
|
/**
|
|
144
144
|
* Forms typed objects that can be written to the graph database.
|
|
145
145
|
*/
|
|
146
|
-
export const makeGraphWriterToolkit = ({ schema }: { schema: Type.
|
|
146
|
+
export const makeGraphWriterToolkit = ({ schema }: { schema: Type.AnyEntity[] }) => {
|
|
147
147
|
return Toolkit.make(
|
|
148
148
|
Tool.make('graph_writer', {
|
|
149
149
|
description: 'Write to the local graph database',
|
|
@@ -185,7 +185,7 @@ export const makeGraphWriterHandler = (
|
|
|
185
185
|
/**
|
|
186
186
|
* Create a schema for structured data extraction.
|
|
187
187
|
*/
|
|
188
|
-
export const createExtractionSchema = (types: Type.
|
|
188
|
+
export const createExtractionSchema = (types: Type.AnyEntity[]) => {
|
|
189
189
|
return Schema.Struct({
|
|
190
190
|
...Object.fromEntries(
|
|
191
191
|
types.map(preprocessSchema).map((schema, index) => [
|
|
@@ -198,14 +198,14 @@ export const createExtractionSchema = (types: Type.Entity.Any[]) => {
|
|
|
198
198
|
});
|
|
199
199
|
};
|
|
200
200
|
|
|
201
|
-
export const getSanitizedSchemaName = (schema: Type.
|
|
201
|
+
export const getSanitizedSchemaName = (schema: Type.AnyEntity) => {
|
|
202
202
|
return Type.getDXN(schema)!
|
|
203
203
|
.asTypeDXN()!
|
|
204
204
|
.type.replaceAll(/[^a-zA-Z0-9]+/g, '_');
|
|
205
205
|
};
|
|
206
206
|
|
|
207
207
|
export const sanitizeObjects = async (
|
|
208
|
-
types: Type.
|
|
208
|
+
types: Type.AnyEntity[],
|
|
209
209
|
data: Record<string, readonly unknown[]>,
|
|
210
210
|
db: Database.Database,
|
|
211
211
|
queue?: Queue,
|
|
@@ -2,10 +2,8 @@
|
|
|
2
2
|
// Copyright 2025 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import
|
|
5
|
+
import Prompt from './prompt';
|
|
6
6
|
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
export const prompt: FunctionDefinition.Any = prompt$; // TODO(burdon): Temp fix for TS error.
|
|
11
|
-
}
|
|
7
|
+
export const AgentFunctions = {
|
|
8
|
+
Prompt,
|
|
9
|
+
};
|