@dxos/assistant-toolkit 0.8.4-main.ae835ea → 0.8.4-main.bc674ce

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.
Files changed (204) hide show
  1. package/dist/lib/browser/chunk-J5LGTIGS.mjs +10 -0
  2. package/dist/lib/browser/chunk-J5LGTIGS.mjs.map +7 -0
  3. package/dist/lib/browser/index.mjs +1091 -692
  4. package/dist/lib/browser/index.mjs.map +4 -4
  5. package/dist/lib/browser/meta.json +1 -1
  6. package/dist/lib/browser/testing/index.mjs +43 -0
  7. package/dist/lib/browser/testing/index.mjs.map +7 -0
  8. package/dist/lib/node-esm/chunk-HSLMI22Q.mjs +11 -0
  9. package/dist/lib/node-esm/chunk-HSLMI22Q.mjs.map +7 -0
  10. package/dist/lib/node-esm/index.mjs +1090 -692
  11. package/dist/lib/node-esm/index.mjs.map +4 -4
  12. package/dist/lib/node-esm/meta.json +1 -1
  13. package/dist/lib/node-esm/testing/index.mjs +44 -0
  14. package/dist/lib/node-esm/testing/index.mjs.map +7 -0
  15. package/dist/types/src/blueprints/design/design-blueprint.d.ts +17 -3
  16. package/dist/types/src/blueprints/design/design-blueprint.d.ts.map +1 -1
  17. package/dist/types/src/blueprints/design/index.d.ts +1 -1
  18. package/dist/types/src/blueprints/design/index.d.ts.map +1 -1
  19. package/dist/types/src/blueprints/discord/discord-blueprint.d.ts +13 -13
  20. package/dist/types/src/blueprints/discord/discord-blueprint.d.ts.map +1 -1
  21. package/dist/types/src/blueprints/discord/index.d.ts +1 -1
  22. package/dist/types/src/blueprints/discord/index.d.ts.map +1 -1
  23. package/dist/types/src/blueprints/linear/index.d.ts +1 -1
  24. package/dist/types/src/blueprints/linear/index.d.ts.map +1 -1
  25. package/dist/types/src/blueprints/linear/linear-blueprint.d.ts +13 -13
  26. package/dist/types/src/blueprints/linear/linear-blueprint.d.ts.map +1 -1
  27. package/dist/types/src/blueprints/planning/index.d.ts +1 -1
  28. package/dist/types/src/blueprints/planning/index.d.ts.map +1 -1
  29. package/dist/types/src/blueprints/planning/planning-blueprint.d.ts +17 -3
  30. package/dist/types/src/blueprints/planning/planning-blueprint.d.ts.map +1 -1
  31. package/dist/types/src/blueprints/research/index.d.ts +1 -1
  32. package/dist/types/src/blueprints/research/index.d.ts.map +1 -1
  33. package/dist/types/src/blueprints/research/research-blueprint.d.ts +17 -3
  34. package/dist/types/src/blueprints/research/research-blueprint.d.ts.map +1 -1
  35. package/dist/types/src/blueprints/testing.d.ts +2 -2
  36. package/dist/types/src/blueprints/testing.d.ts.map +1 -1
  37. package/dist/types/src/blueprints/websearch/index.d.ts +1 -1
  38. package/dist/types/src/blueprints/websearch/index.d.ts.map +1 -1
  39. package/dist/types/src/blueprints/websearch/websearch-blueprint.d.ts +17 -3
  40. package/dist/types/src/blueprints/websearch/websearch-blueprint.d.ts.map +1 -1
  41. package/dist/types/src/blueprints/websearch/websearch-toolkit.d.ts +1 -0
  42. package/dist/types/src/blueprints/websearch/websearch-toolkit.d.ts.map +1 -1
  43. package/dist/types/src/{functions/research → crud}/graph.d.ts +14 -11
  44. package/dist/types/src/crud/graph.d.ts.map +1 -0
  45. package/dist/types/src/crud/graph.test.d.ts.map +1 -0
  46. package/dist/types/src/crud/index.d.ts +2 -0
  47. package/dist/types/src/crud/index.d.ts.map +1 -0
  48. package/dist/types/src/functions/agent/prompt.d.ts +73 -8
  49. package/dist/types/src/functions/agent/prompt.d.ts.map +1 -1
  50. package/dist/types/src/functions/discord/fetch-messages.d.ts +1 -1
  51. package/dist/types/src/functions/discord/index.d.ts +1 -1
  52. package/dist/types/src/functions/discord/index.d.ts.map +1 -1
  53. package/dist/types/src/functions/document/index.d.ts +3 -2
  54. package/dist/types/src/functions/document/index.d.ts.map +1 -1
  55. package/dist/types/src/functions/document/read.d.ts +1 -1
  56. package/dist/types/src/functions/document/read.d.ts.map +1 -1
  57. package/dist/types/src/functions/document/update.d.ts +1 -1
  58. package/dist/types/src/functions/document/update.d.ts.map +1 -1
  59. package/dist/types/src/functions/entity-extraction/entity-extraction.d.ts +126 -125
  60. package/dist/types/src/functions/entity-extraction/entity-extraction.d.ts.map +1 -1
  61. package/dist/types/src/functions/entity-extraction/index.d.ts +126 -125
  62. package/dist/types/src/functions/entity-extraction/index.d.ts.map +1 -1
  63. package/dist/types/src/functions/exa/data/exa-search-1748337321991.d.ts.map +1 -0
  64. package/dist/types/src/functions/exa/data/exa-search-1748337331526.d.ts.map +1 -0
  65. package/dist/types/src/functions/exa/data/exa-search-1748337344119.d.ts.map +1 -0
  66. package/dist/types/src/functions/exa/data/index.d.ts.map +1 -0
  67. package/dist/types/src/functions/exa/exa.d.ts +1 -1
  68. package/dist/types/src/functions/exa/mock.d.ts +1 -1
  69. package/dist/types/src/functions/github/fetch-prs.d.ts +1 -1
  70. package/dist/types/src/functions/github/fetch-prs.d.ts.map +1 -1
  71. package/dist/types/src/functions/linear/index.d.ts +2 -2
  72. package/dist/types/src/functions/linear/index.d.ts.map +1 -1
  73. package/dist/types/src/functions/linear/sync-issues.d.ts +2 -2
  74. package/dist/types/src/functions/linear/sync-issues.d.ts.map +1 -1
  75. package/dist/types/src/functions/research/document-create.d.ts +9 -0
  76. package/dist/types/src/functions/research/document-create.d.ts.map +1 -0
  77. package/dist/types/src/functions/research/index.d.ts +8 -6
  78. package/dist/types/src/functions/research/index.d.ts.map +1 -1
  79. package/dist/types/src/functions/research/research-graph.d.ts +9 -8
  80. package/dist/types/src/functions/research/research-graph.d.ts.map +1 -1
  81. package/dist/types/src/functions/research/research.d.ts +4 -3
  82. package/dist/types/src/functions/research/research.d.ts.map +1 -1
  83. package/dist/types/src/functions/research/types.d.ts +2 -380
  84. package/dist/types/src/functions/research/types.d.ts.map +1 -1
  85. package/dist/types/src/functions/tasks/index.d.ts +2 -2
  86. package/dist/types/src/functions/tasks/index.d.ts.map +1 -1
  87. package/dist/types/src/functions/tasks/read.d.ts +1 -1
  88. package/dist/types/src/functions/tasks/read.d.ts.map +1 -1
  89. package/dist/types/src/functions/tasks/update.d.ts +1 -1
  90. package/dist/types/src/functions/tasks/update.d.ts.map +1 -1
  91. package/dist/types/src/index.d.ts +2 -1
  92. package/dist/types/src/index.d.ts.map +1 -1
  93. package/dist/types/src/initiative/Initiative.d.ts +84 -0
  94. package/dist/types/src/initiative/Initiative.d.ts.map +1 -0
  95. package/dist/types/src/initiative/InitiativeSchema.d.ts +19 -0
  96. package/dist/types/src/initiative/InitiativeSchema.d.ts.map +1 -0
  97. package/dist/types/src/initiative/functions/agent.d.ts +37 -0
  98. package/dist/types/src/initiative/functions/agent.d.ts.map +1 -0
  99. package/dist/types/src/initiative/functions/getContext.d.ts +17 -0
  100. package/dist/types/src/initiative/functions/getContext.d.ts.map +1 -0
  101. package/dist/types/src/initiative/functions/index.d.ts +4 -0
  102. package/dist/types/src/initiative/functions/index.d.ts.map +1 -0
  103. package/dist/types/src/{functions/research/create-document.d.ts → initiative/functions/update.d.ts} +3 -3
  104. package/dist/types/src/initiative/functions/update.d.ts.map +1 -0
  105. package/dist/types/src/initiative/index.d.ts +1 -0
  106. package/dist/types/src/initiative/index.d.ts.map +1 -0
  107. package/dist/types/src/initiative/initiative.test.d.ts +2 -0
  108. package/dist/types/src/initiative/initiative.test.d.ts.map +1 -0
  109. package/dist/types/src/sync/sync.d.ts +3 -3
  110. package/dist/types/src/sync/sync.d.ts.map +1 -1
  111. package/dist/types/src/testing/index.d.ts +1 -1
  112. package/dist/types/src/testing/index.d.ts.map +1 -1
  113. package/dist/types/src/testing/plugins.d.ts +19 -0
  114. package/dist/types/src/testing/plugins.d.ts.map +1 -0
  115. package/dist/types/src/toolkits/AssistantToolkit.d.ts +43 -0
  116. package/dist/types/src/toolkits/AssistantToolkit.d.ts.map +1 -0
  117. package/dist/types/src/toolkits/AssistantToolkit.test.d.ts +2 -0
  118. package/dist/types/src/toolkits/AssistantToolkit.test.d.ts.map +1 -0
  119. package/dist/types/src/toolkits/SystemToolkit.d.ts +99 -0
  120. package/dist/types/src/toolkits/SystemToolkit.d.ts.map +1 -0
  121. package/dist/types/src/toolkits/index.d.ts +3 -0
  122. package/dist/types/src/toolkits/index.d.ts.map +1 -0
  123. package/dist/types/tsconfig.tsbuildinfo +1 -1
  124. package/package.json +49 -33
  125. package/src/blueprints/design/design-blueprint.test.ts +17 -20
  126. package/src/blueprints/design/design-blueprint.ts +4 -6
  127. package/src/blueprints/design/index.ts +1 -1
  128. package/src/blueprints/discord/discord-blueprint.ts +4 -6
  129. package/src/blueprints/discord/index.ts +1 -1
  130. package/src/blueprints/linear/index.ts +1 -1
  131. package/src/blueprints/linear/linear-blueprint.ts +4 -6
  132. package/src/blueprints/planning/index.ts +1 -1
  133. package/src/blueprints/planning/planning-blueprint.test.ts +17 -20
  134. package/src/blueprints/planning/planning-blueprint.ts +4 -6
  135. package/src/blueprints/research/index.ts +1 -1
  136. package/src/blueprints/research/research-blueprint.ts +25 -19
  137. package/src/blueprints/testing.ts +2 -2
  138. package/src/blueprints/websearch/index.ts +2 -1
  139. package/src/blueprints/websearch/websearch-blueprint.ts +4 -6
  140. package/src/crud/graph.test.ts +46 -0
  141. package/src/{functions/research → crud}/graph.ts +32 -40
  142. package/src/crud/index.ts +5 -0
  143. package/src/experimental/feed.test.ts +12 -9
  144. package/src/functions/agent/prompt.ts +39 -22
  145. package/src/functions/discord/fetch-messages.test.ts +6 -7
  146. package/src/functions/discord/fetch-messages.ts +11 -10
  147. package/src/functions/document/index.ts +1 -0
  148. package/src/functions/document/read.ts +4 -3
  149. package/src/functions/document/update.ts +7 -4
  150. package/src/functions/entity-extraction/entity-extraction.conversations.json +6597 -1
  151. package/src/functions/entity-extraction/entity-extraction.test.ts +16 -23
  152. package/src/functions/entity-extraction/entity-extraction.ts +51 -31
  153. package/src/functions/exa/mock.ts +1 -1
  154. package/src/functions/github/fetch-prs.ts +3 -2
  155. package/src/functions/linear/linear.test.ts +18 -20
  156. package/src/functions/linear/sync-issues.ts +14 -12
  157. package/src/functions/research/document-create.ts +76 -0
  158. package/src/functions/research/index.ts +1 -2
  159. package/src/functions/research/research-graph.ts +13 -11
  160. package/src/functions/research/{instructions-research.tpl → research-instructions.tpl} +14 -6
  161. package/src/functions/research/research.conversations.json +1 -10714
  162. package/src/functions/research/research.test.ts +92 -161
  163. package/src/functions/research/research.ts +88 -54
  164. package/src/functions/research/types.ts +14 -12
  165. package/src/functions/tasks/read.ts +4 -3
  166. package/src/functions/tasks/update.ts +4 -3
  167. package/src/index.ts +2 -1
  168. package/src/initiative/Initiative.ts +99 -0
  169. package/src/initiative/InitiativeSchema.ts +37 -0
  170. package/src/initiative/functions/agent.ts +57 -0
  171. package/src/initiative/functions/getContext.ts +74 -0
  172. package/src/initiative/functions/index.ts +7 -0
  173. package/src/initiative/functions/update.ts +63 -0
  174. package/src/initiative/index.ts +3 -0
  175. package/src/initiative/initiative.conversations.json +1 -0
  176. package/src/initiative/initiative.test.ts +485 -0
  177. package/src/sync/sync.ts +38 -30
  178. package/src/testing/index.ts +1 -1
  179. package/src/{plugins.tsx → testing/plugins.tsx} +15 -15
  180. package/src/toolkits/AssistantToolkit.conversations.json +1 -0
  181. package/src/toolkits/AssistantToolkit.test.ts +94 -0
  182. package/src/toolkits/AssistantToolkit.ts +70 -0
  183. package/src/toolkits/SystemToolkit.ts +299 -0
  184. package/src/toolkits/index.ts +6 -0
  185. package/dist/types/src/functions/research/create-document.d.ts.map +0 -1
  186. package/dist/types/src/functions/research/graph.d.ts.map +0 -1
  187. package/dist/types/src/functions/research/graph.test.d.ts.map +0 -1
  188. package/dist/types/src/plugins.d.ts +0 -19
  189. package/dist/types/src/plugins.d.ts.map +0 -1
  190. package/dist/types/src/testing/data/exa-search-1748337321991.d.ts.map +0 -1
  191. package/dist/types/src/testing/data/exa-search-1748337331526.d.ts.map +0 -1
  192. package/dist/types/src/testing/data/exa-search-1748337344119.d.ts.map +0 -1
  193. package/dist/types/src/testing/data/index.d.ts.map +0 -1
  194. package/src/functions/research/create-document.ts +0 -69
  195. package/src/functions/research/graph.test.ts +0 -69
  196. /package/dist/types/src/{functions/research → crud}/graph.test.d.ts +0 -0
  197. /package/dist/types/src/{testing → functions/exa}/data/exa-search-1748337321991.d.ts +0 -0
  198. /package/dist/types/src/{testing → functions/exa}/data/exa-search-1748337331526.d.ts +0 -0
  199. /package/dist/types/src/{testing → functions/exa}/data/exa-search-1748337344119.d.ts +0 -0
  200. /package/dist/types/src/{testing → functions/exa}/data/index.d.ts +0 -0
  201. /package/src/{testing → functions/exa}/data/exa-search-1748337321991.ts +0 -0
  202. /package/src/{testing → functions/exa}/data/exa-search-1748337331526.ts +0 -0
  203. /package/src/{testing → functions/exa}/data/exa-search-1748337344119.ts +0 -0
  204. /package/src/{testing → functions/exa}/data/index.ts +0 -0
package/package.json CHANGED
@@ -1,9 +1,13 @@
1
1
  {
2
2
  "name": "@dxos/assistant-toolkit",
3
- "version": "0.8.4-main.ae835ea",
3
+ "version": "0.8.4-main.bc674ce",
4
4
  "description": "Assistant toolkit, definitions, and utilities.",
5
5
  "homepage": "https://dxos.org",
6
6
  "bugs": "https://github.com/dxos/dxos/issues",
7
+ "repository": {
8
+ "type": "git",
9
+ "url": "https://github.com/dxos/dxos"
10
+ },
7
11
  "license": "MIT",
8
12
  "author": "DXOS.org",
9
13
  "type": "module",
@@ -13,53 +17,65 @@
13
17
  "types": "./dist/types/src/index.d.ts",
14
18
  "browser": "./dist/lib/browser/index.mjs",
15
19
  "node": "./dist/lib/node-esm/index.mjs"
20
+ },
21
+ "./testing": {
22
+ "source": "./src/testing/index.ts",
23
+ "types": "./dist/types/src/testing/index.d.ts",
24
+ "browser": "./dist/lib/browser/testing/index.mjs",
25
+ "node": "./dist/lib/node-esm/testing/index.mjs"
16
26
  }
17
27
  },
18
28
  "types": "dist/types/src/index.d.ts",
19
29
  "typesVersions": {
20
- "*": {}
30
+ "*": {
31
+ "testing": [
32
+ "./dist/types/src/testing/index.d.ts"
33
+ ]
34
+ }
21
35
  },
22
36
  "files": [
23
37
  "dist",
24
38
  "src"
25
39
  ],
26
40
  "dependencies": {
27
- "@effect/ai": "0.29.1",
28
- "@effect/ai-anthropic": "0.19.2",
29
- "@effect/experimental": "0.56.0",
30
- "@effect/platform": "^0.92.1",
31
- "dfx": "^0.126.0",
41
+ "@effect/ai": "0.32.1",
42
+ "@effect/ai-anthropic": "0.22.0",
43
+ "@effect/experimental": "0.57.11",
44
+ "@effect/platform": "0.93.6",
45
+ "dfx": "^0.127.0",
32
46
  "exa-js": "^1.5.12",
33
- "@dxos/ai": "0.8.4-main.ae835ea",
34
- "@dxos/app-framework": "0.8.4-main.ae835ea",
35
- "@dxos/assistant": "0.8.4-main.ae835ea",
36
- "@dxos/blueprints": "0.8.4-main.ae835ea",
37
- "@dxos/context": "0.8.4-main.ae835ea",
38
- "@dxos/conductor": "0.8.4-main.ae835ea",
39
- "@dxos/echo-db": "0.8.4-main.ae835ea",
40
- "@dxos/echo": "0.8.4-main.ae835ea",
41
- "@dxos/echo-protocol": "0.8.4-main.ae835ea",
42
- "@dxos/edge-client": "0.8.4-main.ae835ea",
43
- "@dxos/functions": "0.8.4-main.ae835ea",
44
- "@dxos/errors": "0.8.4-main.ae835ea",
45
- "@dxos/invariant": "0.8.4-main.ae835ea",
46
- "@dxos/keys": "0.8.4-main.ae835ea",
47
- "@dxos/log": "0.8.4-main.ae835ea",
48
- "@dxos/react-ui-syntax-highlighter": "0.8.4-main.ae835ea",
49
- "@dxos/util": "0.8.4-main.ae835ea",
50
- "@dxos/effect": "0.8.4-main.ae835ea",
51
- "@dxos/plugin-markdown": "0.8.4-main.ae835ea",
52
- "@dxos/schema": "0.8.4-main.ae835ea"
47
+ "@dxos/ai": "0.8.4-main.bc674ce",
48
+ "@dxos/blueprints": "0.8.4-main.bc674ce",
49
+ "@dxos/app-framework": "0.8.4-main.bc674ce",
50
+ "@dxos/assistant": "0.8.4-main.bc674ce",
51
+ "@dxos/echo-db": "0.8.4-main.bc674ce",
52
+ "@dxos/context": "0.8.4-main.bc674ce",
53
+ "@dxos/echo": "0.8.4-main.bc674ce",
54
+ "@dxos/echo-protocol": "0.8.4-main.bc674ce",
55
+ "@dxos/edge-client": "0.8.4-main.bc674ce",
56
+ "@dxos/effect": "0.8.4-main.bc674ce",
57
+ "@dxos/errors": "0.8.4-main.bc674ce",
58
+ "@dxos/functions": "0.8.4-main.bc674ce",
59
+ "@dxos/functions-runtime": "0.8.4-main.bc674ce",
60
+ "@dxos/invariant": "0.8.4-main.bc674ce",
61
+ "@dxos/log": "0.8.4-main.bc674ce",
62
+ "@dxos/react-ui-syntax-highlighter": "0.8.4-main.bc674ce",
63
+ "@dxos/plugin-markdown": "0.8.4-main.bc674ce",
64
+ "@dxos/keys": "0.8.4-main.bc674ce",
65
+ "@dxos/types": "0.8.4-main.bc674ce",
66
+ "@dxos/util": "0.8.4-main.bc674ce",
67
+ "@dxos/schema": "0.8.4-main.bc674ce",
68
+ "@dxos/conductor": "0.8.4-main.bc674ce"
53
69
  },
54
70
  "devDependencies": {
55
- "effect": "3.18.3",
56
- "react": "~19.2.0",
57
- "react-dom": "~19.2.0"
71
+ "effect": "3.19.11",
72
+ "react": "~19.2.3",
73
+ "react-dom": "~19.2.3"
58
74
  },
59
75
  "peerDependencies": {
60
- "effect": "^3.13.3",
61
- "react": "^19.0.0",
62
- "react-dom": "^19.0.0"
76
+ "effect": "3.19.11",
77
+ "react": "~19.2.3",
78
+ "react-dom": "~19.2.3"
63
79
  },
64
80
  "publishConfig": {
65
81
  "access": "public"
@@ -17,24 +17,21 @@ import {
17
17
  } from '@dxos/assistant';
18
18
  import { Blueprint } from '@dxos/blueprints';
19
19
  import { Obj, Ref } from '@dxos/echo';
20
- import { TestHelpers, acquireReleaseResource } from '@dxos/effect';
21
- import {
22
- ComputeEventLogger,
23
- DatabaseService,
24
- FunctionInvocationService,
25
- QueueService,
26
- TracingService,
27
- } from '@dxos/functions';
28
- import { TestDatabaseLayer } from '@dxos/functions/testing';
20
+ import { Database } from '@dxos/echo';
21
+ import { acquireReleaseResource } from '@dxos/effect';
22
+ import { TestHelpers } from '@dxos/effect/testing';
23
+ import { QueueService, TracingService } from '@dxos/functions';
24
+ import { FunctionInvocationServiceLayerTestMocked, TestDatabaseLayer } from '@dxos/functions-runtime/testing';
29
25
  import { log } from '@dxos/log';
30
26
  import { Markdown } from '@dxos/plugin-markdown/types';
31
- import { DataType } from '@dxos/schema';
27
+ import { Text } from '@dxos/schema';
28
+ import { type Message } from '@dxos/types';
32
29
  import { trim } from '@dxos/util';
33
30
 
34
31
  import { Document } from '../../functions';
35
32
  import { testToolkit } from '../testing';
36
33
 
37
- import blueprint from './design-blueprint';
34
+ import { blueprint } from './design-blueprint';
38
35
 
39
36
  describe('Design Blueprint', { timeout: 120_000 }, () => {
40
37
  it.scoped(
@@ -42,22 +39,22 @@ describe('Design Blueprint', { timeout: 120_000 }, () => {
42
39
  Effect.fn(
43
40
  function* ({ expect }) {
44
41
  const observer = GenerationObserver.fromPrinter(new ConsolePrinter());
45
- const queue = yield* QueueService.createQueue<DataType.Message | ContextBinding>();
46
- const conversation = yield* acquireReleaseResource(() => new AiConversation(queue));
42
+ const queue = yield* QueueService.createQueue<Message.Message | ContextBinding>();
43
+ const conversation = yield* acquireReleaseResource(() => new AiConversation({ queue }));
47
44
 
48
- yield* DatabaseService.add(blueprint);
45
+ yield* Database.Service.add(blueprint);
49
46
  yield* Effect.promise(() =>
50
47
  conversation.context.bind({
51
48
  blueprints: [Ref.make(blueprint)],
52
49
  }),
53
50
  );
54
51
 
55
- const artifact = yield* DatabaseService.add(Markdown.makeDocument({ content: 'Hello, world!' }));
52
+ const artifact = yield* Database.Service.add(Markdown.make({ content: 'Hello, world!' }));
56
53
  let prevContent = artifact.content;
57
54
 
58
55
  {
59
56
  const prompt = trim`
60
- I want to design a new feature for our product.
57
+ I want to design a new feature for our product.
61
58
 
62
59
  We need to add a user profile system with the following requirements:
63
60
  1. Users should be able to create and edit their profiles
@@ -77,7 +74,7 @@ describe('Design Blueprint', { timeout: 120_000 }, () => {
77
74
 
78
75
  {
79
76
  const prompt = trim`
80
- I want this to be built on top of Durable Objects and SQLite database.
77
+ I want this to be built on top of Durable Objects and SQLite database.
81
78
  Adjust the spec to reflect this.
82
79
  `;
83
80
 
@@ -92,16 +89,16 @@ describe('Design Blueprint', { timeout: 120_000 }, () => {
92
89
  makeToolExecutionServiceFromFunctions(testToolkit, testToolkit.toLayer({}) as any),
93
90
  AiService.model('@anthropic/claude-3-5-sonnet-20241022'),
94
91
  ).pipe(
95
- Layer.provideMerge(TestDatabaseLayer({ types: [DataType.Text, Markdown.Document, Blueprint.Blueprint] })),
92
+ Layer.provideMerge(TestDatabaseLayer({ types: [Text.Text, Markdown.Document, Blueprint.Blueprint] })),
96
93
  Layer.provideMerge(AiServiceTestingPreset('direct')),
97
94
  Layer.provideMerge(
98
- FunctionInvocationService.layerTestMocked({ functions: [Document.read, Document.update] }).pipe(
99
- Layer.provideMerge(ComputeEventLogger.layerFromTracing),
95
+ FunctionInvocationServiceLayerTestMocked({ functions: [Document.read, Document.update] }).pipe(
100
96
  Layer.provideMerge(TracingService.layerNoop),
101
97
  ),
102
98
  ),
103
99
  ),
104
100
  ),
101
+ TestHelpers.provideTestContext,
105
102
  TestHelpers.taggedTest('llm'),
106
103
  ),
107
104
  );
@@ -4,8 +4,8 @@
4
4
 
5
5
  import { ToolId } from '@dxos/ai';
6
6
  import { Blueprint } from '@dxos/blueprints';
7
- import { Obj, Ref } from '@dxos/echo';
8
- import { DataType } from '@dxos/schema';
7
+ import { Ref } from '@dxos/echo';
8
+ import { Text } from '@dxos/schema';
9
9
  import { trim } from '@dxos/util';
10
10
 
11
11
  import { Document } from '../../functions';
@@ -20,14 +20,12 @@ const instructions = trim`
20
20
  Do not announce when you read or write the design spec document.
21
21
  `;
22
22
 
23
- const blueprint: Blueprint.Blueprint = Obj.make(Blueprint.Blueprint, {
23
+ export const blueprint = Blueprint.make({
24
24
  key: 'dxos.org/blueprint/design',
25
25
  name: 'Design Spec',
26
26
  description: 'Preserve the conversation in the design spec.',
27
27
  instructions: {
28
- source: Ref.make(DataType.makeText(instructions)),
28
+ source: Ref.make(Text.make(instructions)),
29
29
  },
30
30
  tools: [Document.read, Document.update].map((fn) => ToolId.make(fn.key)),
31
31
  });
32
-
33
- export default blueprint;
@@ -2,6 +2,6 @@
2
2
  // Copyright 2025 DXOS.org
3
3
  //
4
4
 
5
- import blueprint from './design-blueprint';
5
+ import { blueprint } from './design-blueprint';
6
6
 
7
7
  export default blueprint;
@@ -4,8 +4,8 @@
4
4
 
5
5
  import { ToolId } from '@dxos/ai';
6
6
  import { Blueprint } from '@dxos/blueprints';
7
- import { Obj, Ref } from '@dxos/echo';
8
- import { DataType } from '@dxos/schema';
7
+ import { Ref } from '@dxos/echo';
8
+ import { Text } from '@dxos/schema';
9
9
  import { trim } from '@dxos/util';
10
10
 
11
11
  import { Discord } from '../../functions';
@@ -21,14 +21,12 @@ const instructions = trim`
21
21
  DXOS serverId: 837138313172353095
22
22
  `;
23
23
 
24
- export const blueprint = Obj.make(Blueprint.Blueprint, {
24
+ export const blueprint = Blueprint.make({
25
25
  key: 'dxos.org/blueprint/discord',
26
26
  name: 'Discord',
27
27
  description: 'Discord integration.',
28
28
  instructions: {
29
- source: Ref.make(DataType.makeText(instructions)),
29
+ source: Ref.make(Text.make(instructions)),
30
30
  },
31
31
  tools: [ToolId.make(Discord.fetch.key)],
32
32
  });
33
-
34
- export default blueprint;
@@ -2,6 +2,6 @@
2
2
  // Copyright 2025 DXOS.org
3
3
  //
4
4
 
5
- import blueprint from './discord-blueprint';
5
+ import { blueprint } from './discord-blueprint';
6
6
 
7
7
  export default blueprint;
@@ -2,6 +2,6 @@
2
2
  // Copyright 2025 DXOS.org
3
3
  //
4
4
 
5
- import blueprint from './linear-blueprint';
5
+ import { blueprint } from './linear-blueprint';
6
6
 
7
7
  export default blueprint;
@@ -4,8 +4,8 @@
4
4
 
5
5
  import { ToolId } from '@dxos/ai';
6
6
  import { Blueprint } from '@dxos/blueprints';
7
- import { Obj, Ref } from '@dxos/echo';
8
- import { DataType } from '@dxos/schema';
7
+ import { Ref } from '@dxos/echo';
8
+ import { Text } from '@dxos/schema';
9
9
  import { trim } from '@dxos/util';
10
10
 
11
11
  import { Linear } from '../../functions';
@@ -22,14 +22,12 @@ const instructions = trim`
22
22
  DXOS teamId: 1127c63a-6f77-4725-9229-50f6cd47321c
23
23
  `;
24
24
 
25
- export const blueprint = Obj.make(Blueprint.Blueprint, {
25
+ export const blueprint = Blueprint.make({
26
26
  key: 'dxos.org/blueprint/linear',
27
27
  name: 'Linear',
28
28
  description: 'Syncs Linear workspaces.',
29
29
  instructions: {
30
- source: Ref.make(DataType.makeText(instructions)),
30
+ source: Ref.make(Text.make(instructions)),
31
31
  },
32
32
  tools: [Linear.sync].map((tool) => ToolId.make(tool.key)),
33
33
  });
34
-
35
- export default blueprint;
@@ -2,6 +2,6 @@
2
2
  // Copyright 2025 DXOS.org
3
3
  //
4
4
 
5
- import blueprint from './planning-blueprint';
5
+ import { blueprint } from './planning-blueprint';
6
6
 
7
7
  export default blueprint;
@@ -16,42 +16,39 @@ import {
16
16
  } from '@dxos/assistant';
17
17
  import { Blueprint } from '@dxos/blueprints';
18
18
  import { Obj, Ref } from '@dxos/echo';
19
- import { TestHelpers, acquireReleaseResource } from '@dxos/effect';
20
- import {
21
- ComputeEventLogger,
22
- DatabaseService,
23
- FunctionImplementationResolver,
24
- FunctionInvocationService,
25
- QueueService,
26
- TracingService,
27
- } from '@dxos/functions';
28
- import { TestDatabaseLayer } from '@dxos/functions/testing';
19
+ import { Database } from '@dxos/echo';
20
+ import { acquireReleaseResource } from '@dxos/effect';
21
+ import { TestHelpers } from '@dxos/effect/testing';
22
+ import { QueueService, TracingService } from '@dxos/functions';
23
+ import { FunctionImplementationResolver } from '@dxos/functions-runtime';
24
+ import { FunctionInvocationServiceLayerTestMocked, TestDatabaseLayer } from '@dxos/functions-runtime/testing';
29
25
  import { log } from '@dxos/log';
30
26
  import { Markdown } from '@dxos/plugin-markdown/types';
31
- import { DataType } from '@dxos/schema';
27
+ import { Text } from '@dxos/schema';
28
+ import { type Message } from '@dxos/types';
32
29
  import { trim } from '@dxos/util';
33
30
 
34
31
  import { Tasks } from '../../functions';
35
32
  import { type TestStep, runSteps, testToolkit } from '../testing';
36
33
 
37
- import blueprint from './planning-blueprint';
34
+ import { blueprint } from './planning-blueprint';
38
35
 
39
36
  describe('Planning Blueprint', { timeout: 120_000 }, () => {
40
37
  it.scoped(
41
38
  'planning blueprint',
42
39
  Effect.fn(
43
40
  function* ({ expect }) {
44
- const queue = yield* QueueService.createQueue<DataType.Message | ContextBinding>();
45
- const conversation = yield* acquireReleaseResource(() => new AiConversation(queue));
41
+ const queue = yield* QueueService.createQueue<Message.Message | ContextBinding>();
42
+ const conversation = yield* acquireReleaseResource(() => new AiConversation({ queue }));
46
43
 
47
- yield* DatabaseService.add(blueprint);
44
+ yield* Database.Service.add(blueprint);
48
45
  yield* Effect.promise(() =>
49
46
  conversation.context.bind({
50
47
  blueprints: [Ref.make(blueprint)],
51
48
  }),
52
49
  );
53
50
 
54
- const artifact = yield* DatabaseService.add(Markdown.makeDocument());
51
+ const artifact = yield* Database.Service.add(Markdown.make());
55
52
  let prevContent = artifact.content;
56
53
  const matchList =
57
54
  ({ includes = [], excludes = [] }: { includes: RegExp[]; excludes?: RegExp[] }) =>
@@ -107,22 +104,22 @@ describe('Planning Blueprint', { timeout: 120_000 }, () => {
107
104
  },
108
105
  Effect.provide(
109
106
  Layer.mergeAll(
110
- TestDatabaseLayer({ types: [DataType.Text, Markdown.Document, Blueprint.Blueprint] }),
107
+ TestDatabaseLayer({ types: [Text.Text, Markdown.Document, Blueprint.Blueprint] }),
111
108
  makeToolResolverFromFunctions([Tasks.read, Tasks.update], testToolkit),
112
109
  makeToolExecutionServiceFromFunctions(testToolkit, testToolkit.toLayer({}) as any),
113
110
  AiService.model('@anthropic/claude-3-5-sonnet-20241022'),
114
111
  ).pipe(
115
112
  Layer.provideMerge(
116
- FunctionInvocationService.layerTestMocked({ functions: [Tasks.read, Tasks.update] }).pipe(
117
- Layer.provideMerge(ComputeEventLogger.layerFromTracing),
113
+ FunctionInvocationServiceLayerTestMocked({ functions: [Tasks.read, Tasks.update] }).pipe(
118
114
  Layer.provideMerge(TracingService.layerNoop),
119
115
  ),
120
116
  ),
121
117
  Layer.provideMerge(FunctionImplementationResolver.layerTest({ functions: [Tasks.read, Tasks.update] })),
122
- Layer.provideMerge(TestDatabaseLayer({ types: [DataType.Text, Markdown.Document, Blueprint.Blueprint] })),
118
+ Layer.provideMerge(TestDatabaseLayer({ types: [Text.Text, Markdown.Document, Blueprint.Blueprint] })),
123
119
  Layer.provideMerge(AiServiceTestingPreset('direct')),
124
120
  ),
125
121
  ),
122
+ TestHelpers.provideTestContext,
126
123
  TestHelpers.taggedTest('llm'),
127
124
  ),
128
125
  );
@@ -4,8 +4,8 @@
4
4
 
5
5
  import { ToolId } from '@dxos/ai';
6
6
  import { Blueprint } from '@dxos/blueprints';
7
- import { Obj, Ref } from '@dxos/echo';
8
- import { DataType } from '@dxos/schema';
7
+ import { Ref } from '@dxos/echo';
8
+ import { Text } from '@dxos/schema';
9
9
  import { trim } from '@dxos/util';
10
10
 
11
11
  import { Tasks } from '../../functions';
@@ -85,14 +85,12 @@ const instructions = trim`
85
85
  - Be precise with task descriptions and hierarchy levels
86
86
  `;
87
87
 
88
- export const blueprint: Blueprint.Blueprint = Obj.make(Blueprint.Blueprint, {
88
+ export const blueprint = Blueprint.make({
89
89
  key: 'dxos.org/blueprint/planning',
90
90
  name: 'Planning',
91
91
  description: 'Plans and tracks complex tasks with artifact management.',
92
92
  instructions: {
93
- source: Ref.make(DataType.makeText(instructions)),
93
+ source: Ref.make(Text.make(instructions)),
94
94
  },
95
95
  tools: [Tasks.read, Tasks.update].map((fn) => ToolId.make(fn.key)),
96
96
  });
97
-
98
- export default blueprint;
@@ -2,6 +2,6 @@
2
2
  // Copyright 2025 DXOS.org
3
3
  //
4
4
 
5
- import blueprint from './research-blueprint';
5
+ import { blueprint } from './research-blueprint';
6
6
 
7
7
  export default blueprint;
@@ -4,8 +4,8 @@
4
4
 
5
5
  import { ToolId } from '@dxos/ai';
6
6
  import { Blueprint } from '@dxos/blueprints';
7
- import { Obj, Ref } from '@dxos/echo';
8
- import { DataType } from '@dxos/schema';
7
+ import { Ref } from '@dxos/echo';
8
+ import { Text } from '@dxos/schema';
9
9
  import { trim } from '@dxos/util';
10
10
 
11
11
  import { Research } from '../../functions';
@@ -17,29 +17,35 @@ const instructions = trim`
17
17
  {{! Research }}
18
18
 
19
19
  You are an analyst that does research tasks using tools that scrape the web and create structured data.
20
- The result of the research is a set of structured entities forming an interconnected graph.
21
- When you are done, reply with the created objects.
22
- Do not print the data, instead reply with inline references to the created objects.
23
- Those will be later substituted with the pills representing the created objects.
24
- Print the rest of the created objects as block references after the main note.
25
-
26
- <example>
27
- Based on my research, Google was founded by @dxn:queue:data:B6INSIBY3CBEF4M5VZRYBCMAHQMPYK5AJ:01K24XMVHSZHS97SG1VTVQDM5Z:01K24XPK464FSCKVQJAB2H662M and @dxn:queue:data:B6INSIBY3CBEF4M5VZRYBCMAHQMPYK5AJ:01K24XMVHSZHS97SG1VTVQDM5Z:01K24XPK46K31DDW62PBW9H2ZQ
28
-
29
- <object><dxn>dxn:queue:data:B6INSIBY3CBEF4M5VZRYBCMAHQMPYK5AJ:01K24XMVHSZHS97SG1VTVQDM5Z:01K24XPK464FSCKVQJAB2H662M</dxn></object>
30
- <object><dxn>dxn:queue:data:B6INSIBY3CBEF4M5VZRYBCMAHQMPYK5AJ:01K24XMVHSZHS97SG1VTVQDM5Z:01K24XPK46K31DDW62PBW9H2ZQ</dxn></object>
31
- <object><dxn>dxn:queue:data:B6INSIBY3CBEF4M5VZRYBCMAHQMPYK5AJ:01K24XMVHSZHS97SG1VTVQDM5Z:01K24XPK46K31DDW62PBW92333</dxn></object>
32
- </example>
20
+ Structured data extraction is an experimental feature -- only enable it if the user explicitly requests it in the prompt.
21
+ Prefer updating existing notes instead of creating new ones.
22
+
23
+ <strcutured_mode>
24
+ When you are done, reply with the created objects.
25
+ Do not print the data, instead reply with inline references to the created objects.
26
+ Those will be later substituted with the pills representing the created objects.
27
+ Print the rest of the created objects as block references after the main note.
28
+
29
+ <example>
30
+ Based on my research, Google was founded by @dxn:queue:data:B6INSIBY3CBEF4M5VZRYBCMAHQMPYK5AJ:01K24XMVHSZHS97SG1VTVQDM5Z:01K24XPK464FSCKVQJAB2H662M and @dxn:queue:data:B6INSIBY3CBEF4M5VZRYBCMAHQMPYK5AJ:01K24XMVHSZHS97SG1VTVQDM5Z:01K24XPK46K31DDW62PBW9H2ZQ
31
+
32
+ <object><dxn>dxn:queue:data:B6INSIBY3CBEF4M5VZRYBCMAHQMPYK5AJ:01K24XMVHSZHS97SG1VTVQDM5Z:01K24XPK464FSCKVQJAB2H662M</dxn></object>
33
+ <object><dxn>dxn:queue:data:B6INSIBY3CBEF4M5VZRYBCMAHQMPYK5AJ:01K24XMVHSZHS97SG1VTVQDM5Z:01K24XPK46K31DDW62PBW9H2ZQ</dxn></object>
34
+ <object><dxn>dxn:queue:data:B6INSIBY3CBEF4M5VZRYBCMAHQMPYK5AJ:01K24XMVHSZHS97SG1VTVQDM5Z:01K24XPK46K31DDW62PBW92333</dxn></object>
35
+ </example>
36
+ </structured_mode>
37
+
38
+ <unstructured_mode>
39
+ Reply normally with the text mode of the result of your research.
40
+ </unstructured_mode>
33
41
  `;
34
42
 
35
- export const blueprint: Blueprint.Blueprint = Obj.make(Blueprint.Blueprint, {
43
+ export const blueprint = Blueprint.make({
36
44
  key: 'dxos.org/blueprint/research',
37
45
  name: 'Research',
38
46
  description: 'Researches the web and creates structured data.',
39
47
  instructions: {
40
- source: Ref.make(DataType.makeText(instructions)),
48
+ source: Ref.make(Text.make(instructions)),
41
49
  },
42
50
  tools: [Research.create, Research.research].map((fn) => ToolId.make(fn.key)),
43
51
  });
44
-
45
- export default blueprint;
@@ -6,10 +6,10 @@ import * as Toolkit from '@effect/ai/Toolkit';
6
6
  import * as Effect from 'effect/Effect';
7
7
 
8
8
  import { ConsolePrinter } from '@dxos/ai';
9
- import { type AiConversation, type AiConversationRunParams, GenerationObserver } from '@dxos/assistant';
9
+ import { type AiConversation, type AiConversationRunProps, GenerationObserver } from '@dxos/assistant';
10
10
  import { log } from '@dxos/log';
11
11
 
12
- export type TestStep = Pick<AiConversationRunParams, 'prompt' | 'system'> & {
12
+ export type TestStep = Pick<AiConversationRunProps, 'prompt' | 'system'> & {
13
13
  test?: () => Promise<void>;
14
14
  };
15
15
 
@@ -2,7 +2,8 @@
2
2
  // Copyright 2025 DXOS.org
3
3
  //
4
4
 
5
- import blueprint from './websearch-blueprint';
5
+ import { blueprint } from './websearch-blueprint';
6
6
 
7
7
  export { WebSearchToolkit } from './websearch-toolkit';
8
+
8
9
  export default blueprint;
@@ -4,17 +4,15 @@
4
4
 
5
5
  import { ToolId } from '@dxos/ai';
6
6
  import { Blueprint } from '@dxos/blueprints';
7
- import { Obj, Ref } from '@dxos/echo';
8
- import { DataType } from '@dxos/schema';
7
+ import { Ref } from '@dxos/echo';
8
+ import { Text } from '@dxos/schema';
9
9
 
10
- const blueprint: Blueprint.Blueprint = Obj.make(Blueprint.Blueprint, {
10
+ export const blueprint = Blueprint.make({
11
11
  key: 'dxos.org/blueprint/web-search',
12
12
  name: 'Web Search',
13
13
  description: 'Search the web.',
14
14
  instructions: {
15
- source: Ref.make(DataType.makeText('')), // No instructions required.
15
+ source: Ref.make(Text.make()),
16
16
  },
17
17
  tools: [ToolId.make('AnthropicWebSearch')],
18
18
  });
19
-
20
- export default blueprint;
@@ -0,0 +1,46 @@
1
+ //
2
+ // Copyright 2025 DXOS.org
3
+ //
4
+
5
+ import { describe, it } from '@effect/vitest';
6
+ import * as Effect from 'effect/Effect';
7
+ import * as Layer from 'effect/Layer';
8
+
9
+ import { AiSession } from '@dxos/assistant';
10
+ import { AssistantTestLayer } from '@dxos/assistant/testing';
11
+ import { TestHelpers } from '@dxos/effect/testing';
12
+ import { log } from '@dxos/log';
13
+ import { Project } from '@dxos/types';
14
+
15
+ import { makeGraphWriterHandler, makeGraphWriterToolkit } from './graph';
16
+
17
+ const TestLayer = AssistantTestLayer({});
18
+
19
+ describe('graph', () => {
20
+ // let builder: EchoTestBuilder;
21
+ // test('findRelatedSchema', async () => {
22
+ // const db = await createEchoDatabase();
23
+ // const relatedSchemas = await findRelatedSchema(db, Schema.Struct({}));
24
+ // });
25
+
26
+ const Toolkit = makeGraphWriterToolkit({ schema: [Project.Project] });
27
+ const ToolkitLayer = makeGraphWriterHandler(Toolkit);
28
+
29
+ it.effect.skip(
30
+ 'calculator',
31
+ Effect.fn(
32
+ function* (_) {
33
+ const session = new AiSession();
34
+ const toolkit = yield* Toolkit;
35
+ const response = yield* session.run({
36
+ toolkit,
37
+ prompt: 'What is 10 + 20?',
38
+ });
39
+
40
+ log.info('response', { response });
41
+ },
42
+ Effect.provide(Layer.mergeAll(TestLayer, ToolkitLayer)),
43
+ TestHelpers.provideTestContext,
44
+ ),
45
+ );
46
+ });