@dxos/assistant 0.8.2-main.12df754 → 0.8.2-main.30e4dbb

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 (160) hide show
  1. package/dist/lib/browser/{chunk-DEIGOD4U.mjs → chunk-YSYP7S4W.mjs} +706 -242
  2. package/dist/lib/browser/chunk-YSYP7S4W.mjs.map +7 -0
  3. package/dist/lib/browser/index.mjs +5 -324
  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 +123 -86
  7. package/dist/lib/browser/testing/index.mjs.map +4 -4
  8. package/dist/lib/node/{chunk-7VH7NMIM.cjs → chunk-FTIDW4BA.cjs} +716 -259
  9. package/dist/lib/node/chunk-FTIDW4BA.cjs.map +7 -0
  10. package/dist/lib/node/index.cjs +35 -354
  11. package/dist/lib/node/index.cjs.map +4 -4
  12. package/dist/lib/node/meta.json +1 -1
  13. package/dist/lib/node/testing/index.cjs +112 -77
  14. package/dist/lib/node/testing/index.cjs.map +4 -4
  15. package/dist/lib/node-esm/{chunk-7JI4MDGL.mjs → chunk-GCJNPQDJ.mjs} +706 -242
  16. package/dist/lib/node-esm/chunk-GCJNPQDJ.mjs.map +7 -0
  17. package/dist/lib/node-esm/index.mjs +5 -324
  18. package/dist/lib/node-esm/index.mjs.map +4 -4
  19. package/dist/lib/node-esm/meta.json +1 -1
  20. package/dist/lib/node-esm/testing/index.mjs +123 -86
  21. package/dist/lib/node-esm/testing/index.mjs.map +4 -4
  22. package/dist/types/src/ai-service/parser.d.ts.map +1 -1
  23. package/dist/types/src/ai-service/stream.d.ts.map +1 -1
  24. package/dist/types/src/ai-service/testing/test-stream.d.ts.map +1 -1
  25. package/dist/types/src/ai-service/types.d.ts +133 -133
  26. package/dist/types/src/ai-service/types.d.ts.map +1 -1
  27. package/dist/types/src/ai-service/util/sse.d.ts.map +1 -1
  28. package/dist/types/src/{conversation → experimental/conversation}/conversation.d.ts +2 -18
  29. package/dist/types/src/experimental/conversation/conversation.d.ts.map +1 -0
  30. package/dist/types/src/experimental/conversation/conversation.test.d.ts.map +1 -0
  31. package/dist/types/src/experimental/conversation/index.d.ts.map +1 -0
  32. package/dist/types/src/{conversation → experimental/conversation}/types.d.ts +9 -9
  33. package/dist/types/src/experimental/conversation/types.d.ts.map +1 -0
  34. package/dist/types/src/experimental/cypher/ast.d.ts.map +1 -0
  35. package/dist/types/src/experimental/cypher/combinators.d.ts.map +1 -0
  36. package/dist/types/src/experimental/cypher/combinators.test.d.ts.map +1 -0
  37. package/dist/types/src/experimental/cypher/echo-data-source.d.ts.map +1 -0
  38. package/dist/types/src/experimental/cypher/execution-plan.d.ts.map +1 -0
  39. package/dist/types/src/experimental/cypher/execution-plan.test.d.ts.map +1 -0
  40. package/dist/types/src/experimental/cypher/index.d.ts.map +1 -0
  41. package/dist/types/src/experimental/cypher/parjs.d.ts.map +1 -0
  42. package/dist/types/src/experimental/cypher/parser.d.ts.map +1 -0
  43. package/dist/types/src/experimental/cypher/query-executor.d.ts.map +1 -0
  44. package/dist/types/src/experimental/cypher/query-executor.test.d.ts.map +1 -0
  45. package/dist/types/src/experimental/cypher/schema.d.ts.map +1 -0
  46. package/dist/types/src/experimental/cypher/schema.test.d.ts.map +1 -0
  47. package/dist/types/src/experimental/index.d.ts +3 -0
  48. package/dist/types/src/experimental/index.d.ts.map +1 -0
  49. package/dist/types/src/experimental/ner/ner.test.d.ts +2 -0
  50. package/dist/types/src/experimental/ner/ner.test.d.ts.map +1 -0
  51. package/dist/types/src/experimental/research/exa.d.ts +6 -0
  52. package/dist/types/src/experimental/research/exa.d.ts.map +1 -0
  53. package/dist/types/src/experimental/research/research.test.d.ts +2 -0
  54. package/dist/types/src/experimental/research/research.test.d.ts.map +1 -0
  55. package/dist/types/src/index.d.ts +1 -2
  56. package/dist/types/src/index.d.ts.map +1 -1
  57. package/dist/types/src/session/index.d.ts +2 -0
  58. package/dist/types/src/session/index.d.ts.map +1 -1
  59. package/dist/types/src/session/session.d.ts +33 -7
  60. package/dist/types/src/session/session.d.ts.map +1 -1
  61. package/dist/types/src/session/tools.d.ts +18 -0
  62. package/dist/types/src/session/tools.d.ts.map +1 -0
  63. package/dist/types/src/session/version-pin.d.ts +22 -0
  64. package/dist/types/src/session/version-pin.d.ts.map +1 -0
  65. package/dist/types/src/session/version-pin.test.d.ts +2 -0
  66. package/dist/types/src/session/version-pin.test.d.ts.map +1 -0
  67. package/dist/types/src/testing/index.d.ts +1 -0
  68. package/dist/types/src/testing/index.d.ts.map +1 -1
  69. package/dist/types/src/testing/logger.d.ts +1 -1
  70. package/dist/types/src/testing/logger.d.ts.map +1 -1
  71. package/dist/types/src/testing/ollama.d.ts.map +1 -1
  72. package/dist/types/src/testing/printer.d.ts +6 -0
  73. package/dist/types/src/testing/printer.d.ts.map +1 -0
  74. package/dist/types/src/testing/query-promts.d.ts +4 -4
  75. package/dist/types/src/testing/query-promts.d.ts.map +1 -1
  76. package/dist/types/src/testing/test-data.d.ts +5 -5
  77. package/dist/types/src/testing/test-data.d.ts.map +1 -1
  78. package/dist/types/src/testing/test-schema.d.ts +25 -23
  79. package/dist/types/src/testing/test-schema.d.ts.map +1 -1
  80. package/dist/types/src/util/trim.d.ts.map +1 -1
  81. package/dist/types/tsconfig.tsbuildinfo +1 -1
  82. package/package.json +20 -14
  83. package/src/ai-service/client.test.ts +5 -5
  84. package/src/ai-service/ollama-client.ts +8 -8
  85. package/src/ai-service/types.ts +14 -14
  86. package/src/bin/chat.ts +3 -3
  87. package/src/{conversation → experimental/conversation}/conversation.test.ts +5 -5
  88. package/src/{conversation → experimental/conversation}/conversation.ts +3 -112
  89. package/src/{conversation → experimental/conversation}/types.ts +10 -10
  90. package/src/{cypher → experimental/cypher}/combinators.test.ts +4 -4
  91. package/src/{cypher → experimental/cypher}/echo-data-source.ts +7 -5
  92. package/src/{cypher → experimental/cypher}/execution-plan.test.ts +1 -1
  93. package/src/{cypher → experimental/cypher}/query-executor.test.ts +2 -2
  94. package/src/{cypher → experimental/cypher}/schema.test.ts +3 -3
  95. package/src/{cypher → experimental/cypher}/schema.ts +1 -1
  96. package/src/experimental/index.ts +6 -0
  97. package/src/experimental/ner/ner.test.ts +163 -0
  98. package/src/experimental/research/exa.ts +38 -0
  99. package/src/experimental/research/instructions.tpl +64 -0
  100. package/src/experimental/research/research.test.ts +263 -0
  101. package/src/index.ts +3 -2
  102. package/src/session/index.ts +2 -0
  103. package/src/session/session.test.ts +30 -58
  104. package/src/session/session.ts +296 -150
  105. package/src/session/tools.ts +117 -0
  106. package/src/session/version-pin.test.ts +26 -0
  107. package/src/session/version-pin.ts +49 -0
  108. package/src/testing/artifacts.test.ts +22 -22
  109. package/src/testing/index.ts +1 -0
  110. package/src/testing/logger.ts +1 -1
  111. package/src/testing/printer.ts +41 -0
  112. package/src/testing/query-promts.ts +6 -6
  113. package/src/testing/query.test.ts +4 -5
  114. package/src/testing/test-data.ts +63 -56
  115. package/src/testing/test-schema.ts +28 -29
  116. package/src/typedefs.d.ts +8 -0
  117. package/dist/lib/browser/chunk-DEIGOD4U.mjs.map +0 -7
  118. package/dist/lib/node/chunk-7VH7NMIM.cjs.map +0 -7
  119. package/dist/lib/node-esm/chunk-7JI4MDGL.mjs.map +0 -7
  120. package/dist/types/src/conversation/conversation.d.ts.map +0 -1
  121. package/dist/types/src/conversation/conversation.test.d.ts.map +0 -1
  122. package/dist/types/src/conversation/index.d.ts.map +0 -1
  123. package/dist/types/src/conversation/types.d.ts.map +0 -1
  124. package/dist/types/src/cypher/ast.d.ts.map +0 -1
  125. package/dist/types/src/cypher/combinators.d.ts.map +0 -1
  126. package/dist/types/src/cypher/combinators.test.d.ts.map +0 -1
  127. package/dist/types/src/cypher/echo-data-source.d.ts.map +0 -1
  128. package/dist/types/src/cypher/execution-plan.d.ts.map +0 -1
  129. package/dist/types/src/cypher/execution-plan.test.d.ts.map +0 -1
  130. package/dist/types/src/cypher/index.d.ts.map +0 -1
  131. package/dist/types/src/cypher/parjs.d.ts.map +0 -1
  132. package/dist/types/src/cypher/parser.d.ts.map +0 -1
  133. package/dist/types/src/cypher/query-executor.d.ts.map +0 -1
  134. package/dist/types/src/cypher/query-executor.test.d.ts.map +0 -1
  135. package/dist/types/src/cypher/schema.d.ts.map +0 -1
  136. package/dist/types/src/cypher/schema.test.d.ts.map +0 -1
  137. /package/dist/types/src/{conversation → experimental/conversation}/conversation.test.d.ts +0 -0
  138. /package/dist/types/src/{conversation → experimental/conversation}/index.d.ts +0 -0
  139. /package/dist/types/src/{cypher → experimental/cypher}/ast.d.ts +0 -0
  140. /package/dist/types/src/{cypher → experimental/cypher}/combinators.d.ts +0 -0
  141. /package/dist/types/src/{cypher → experimental/cypher}/combinators.test.d.ts +0 -0
  142. /package/dist/types/src/{cypher → experimental/cypher}/echo-data-source.d.ts +0 -0
  143. /package/dist/types/src/{cypher → experimental/cypher}/execution-plan.d.ts +0 -0
  144. /package/dist/types/src/{cypher → experimental/cypher}/execution-plan.test.d.ts +0 -0
  145. /package/dist/types/src/{cypher → experimental/cypher}/index.d.ts +0 -0
  146. /package/dist/types/src/{cypher → experimental/cypher}/parjs.d.ts +0 -0
  147. /package/dist/types/src/{cypher → experimental/cypher}/parser.d.ts +0 -0
  148. /package/dist/types/src/{cypher → experimental/cypher}/query-executor.d.ts +0 -0
  149. /package/dist/types/src/{cypher → experimental/cypher}/query-executor.test.d.ts +0 -0
  150. /package/dist/types/src/{cypher → experimental/cypher}/schema.d.ts +0 -0
  151. /package/dist/types/src/{cypher → experimental/cypher}/schema.test.d.ts +0 -0
  152. /package/src/{conversation → experimental/conversation}/index.ts +0 -0
  153. /package/src/{cypher → experimental/cypher}/ast.ts +0 -0
  154. /package/src/{cypher → experimental/cypher}/combinators.ts +0 -0
  155. /package/src/{cypher → experimental/cypher}/execution-plan.ts +0 -0
  156. /package/src/{cypher → experimental/cypher}/index.ts +0 -0
  157. /package/src/{cypher → experimental/cypher}/parjs-shims.d.ts +0 -0
  158. /package/src/{cypher → experimental/cypher}/parjs.ts +0 -0
  159. /package/src/{cypher → experimental/cypher}/parser.ts +0 -0
  160. /package/src/{cypher → experimental/cypher}/query-executor.ts +0 -0
@@ -1,6 +1,8 @@
1
- import { Schema as S } from 'effect';
1
+ import { Schema } from 'effect';
2
2
  import { Message, type ArtifactDefinition, type Tool } from '@dxos/artifact';
3
3
  import { Event } from '@dxos/async';
4
+ import { ObjectVersion } from '@dxos/echo-db';
5
+ import { type ObjectId } from '@dxos/echo-schema';
4
6
  import { type AIServiceClient, type GenerateRequest } from '../ai-service';
5
7
  /**
6
8
  * Contains message history, tools, current context.
@@ -12,6 +14,19 @@ import { type AIServiceClient, type GenerateRequest } from '../ai-service';
12
14
  * Could be run locally in the app or remotely.
13
15
  * Could be personal or shared.
14
16
  */
17
+ /**
18
+ * Resolves artifact ids to their versions.
19
+ * Used to give the model a sense of the changes to the artifacts made by users during the conversation.
20
+ * The artifacts versions are pinned in the history, and whenever the artifact changes in-between assistant's steps,
21
+ * a diff is inserted into the conversation.
22
+ */
23
+ export type ArtifactDiffResolver = (artifacts: {
24
+ id: ObjectId;
25
+ lastVersion: ObjectVersion;
26
+ }[]) => Promise<Map<ObjectId, {
27
+ version: ObjectVersion;
28
+ diff?: string;
29
+ }>>;
15
30
  export type SessionRunOptions = {
16
31
  client: AIServiceClient;
17
32
  artifacts: ArtifactDefinition[];
@@ -28,13 +43,19 @@ export type SessionRunOptions = {
28
43
  * Pre-require artifacts.
29
44
  */
30
45
  requiredArtifactIds?: string[];
46
+ /**
47
+ * @see ArtifactDiffResolver
48
+ */
49
+ artifactDiffResolver?: ArtifactDiffResolver;
31
50
  };
32
- type OperationModel = 'planning' | 'immediate';
51
+ type OperationModel = 'planning' | 'importing' | 'configured';
33
52
  export type AiSessionOptions = {
34
53
  /**
35
- * In planning mode, the model will create a plan before executing the user's request.
36
- * The plan will determine the artifacts that will be used to perform the actions.
37
- * In require mode, the model will select the artifacts that will be used to perform the actions.
54
+ * Determines the agent's handling of the artifacts definitions:
55
+ *
56
+ * - `planning`: The model will create a plan with required artifacts for each step.
57
+ * - `importing`: The model can query registry and only pull in the artifacts that are required to complete the task.
58
+ * - `configured`: The available artifacts are pre-selected and the model cannot select additional artifacts.
38
59
  */
39
60
  operationModel: OperationModel;
40
61
  };
@@ -199,10 +220,15 @@ export declare class AISession {
199
220
  }>;
200
221
  constructor(_options: AiSessionOptions);
201
222
  run(options: SessionRunOptions): Promise<Message[]>;
223
+ runStructured<S extends Schema.Schema.AnyNoContext>(schema: S, options: SessionRunOptions): Promise<Schema.Schema.Type<S>>;
224
+ private _formatUserPrompt;
225
+ private _createQueryArtifactsTool;
226
+ private _createRequireTool;
227
+ private _createPlanningTool;
202
228
  abort(): void;
203
229
  }
204
- declare const AIServiecOverloadedError_base: S.TaggedErrorClass<AIServiecOverloadedError, "AIServiecOverloadedError", {
205
- readonly _tag: S.tag<"AIServiecOverloadedError">;
230
+ declare const AIServiecOverloadedError_base: Schema.TaggedErrorClass<AIServiecOverloadedError, "AIServiecOverloadedError", {
231
+ readonly _tag: Schema.tag<"AIServiecOverloadedError">;
206
232
  }>;
207
233
  export declare class AIServiecOverloadedError extends AIServiecOverloadedError_base {
208
234
  }
@@ -1 +1 @@
1
- {"version":3,"file":"session.d.ts","sourceRoot":"","sources":["../../../../src/session/session.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,MAAM,IAAI,CAAC,EAAE,MAAM,QAAQ,CAAC;AAErC,OAAO,EAAc,OAAO,EAAc,KAAK,kBAAkB,EAAE,KAAK,IAAI,EAAE,MAAM,gBAAgB,CAAC;AACrG,OAAO,EAAE,KAAK,EAAgB,MAAM,aAAa,CAAC;AAKlD,OAAO,EAAqB,KAAK,eAAe,EAAE,KAAK,eAAe,EAAyB,MAAM,eAAe,CAAC;AAErH;;;;;;;;;GASG;AAEH,MAAM,MAAM,iBAAiB,GAAG;IAC9B,MAAM,EAAE,eAAe,CAAC;IAExB,SAAS,EAAE,kBAAkB,E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Use: (message: Message, { onlyToolNames }?: {
3
+ onlyToolNames?: string[];
4
+ }) => boolean;
5
+ export type RunToolsOptions = {
6
+ message: Message;
7
+ tools: Tool[];
8
+ extensions?: ToolContextExtensions;
9
+ };
10
+ export type RunToolsResult = {
11
+ type: 'continue';
12
+ message: Message;
13
+ } | {
14
+ type: 'break';
15
+ result: unknown;
16
+ };
17
+ export declare const runTools: ({ message, tools, extensions }: RunToolsOptions) => Promise<RunToolsResult>;
18
+ //# sourceMappingURL=tools.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tools.d.ts","sourceRoot":"","sources":["../../../../src/session/tools.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,OAAO,EAAE,KAAK,IAAI,EAAc,MAAM,gBAAgB,CAAC;AAKhE,eAAO,MAAM,SAAS,GAAI,SAAS,OAAO,EAAE,oBAAmB;IAAE,aAAa,CAAC,EAAE,MAAM,EAAE,CAAA;CAAO,YAI/F,CAAC;AAEF,MAAM,MAAM,eAAe,GAAG;IAC5B,OAAO,EAAE,OAAO,CAAC;IACjB,KAAK,EAAE,IAAI,EAAE,CAAC;IACd,UAAU,CAAC,EAAE,qBAAqB,CAAC;CACpC,CAAC;AAEF,MAAM,MAAM,cAAc,GACtB;IACE,IAAI,EAAE,UAAU,CAAC;IACjB,OAAO,EAAE,OAAO,CAAC;CAClB,GACD;IACE,IAAI,EAAE,OAAO,CAAC;IACd,MAAM,EAAE,OAAO,CAAC;CACjB,CAAC;AAEN,eAAO,MAAM,QAAQ,GAAU,gCAAgC,eAAe,KAAG,OAAO,CAAC,cAAc,CAqFtG,CAAC"}
@@ -0,0 +1,22 @@
1
+ import { Schema } from 'effect';
2
+ import type { MessageContentBlock } from '@dxos/artifact';
3
+ import type { ObjectVersion } from '@dxos/echo-db';
4
+ import { type BaseEchoObject } from '@dxos/echo-schema';
5
+ declare const VersionPinSchema: Schema.Struct<{
6
+ objectId: import("@dxos/echo-schema").ObjectIdClass;
7
+ version: Schema.Schema<ObjectVersion, ObjectVersion, never>;
8
+ }>;
9
+ /**
10
+ * Used to pin a specific version of an object during the course of a conversation.
11
+ *
12
+ * This allows us to detect when the object changes during the course of the conversation.
13
+ */
14
+ export interface VersionPin extends Schema.Schema.Type<typeof VersionPinSchema> {
15
+ }
16
+ export declare const VersionPin: typeof VersionPinSchema & {
17
+ DISPOSITION: 'version-pin';
18
+ fromObject: (object: BaseEchoObject) => VersionPin;
19
+ createBlock: (pin: VersionPin) => MessageContentBlock;
20
+ };
21
+ export {};
22
+ //# sourceMappingURL=version-pin.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"version-pin.d.ts","sourceRoot":"","sources":["../../../../src/session/version-pin.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAEhC,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,gBAAgB,CAAC;AAC1D,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AAEnD,OAAO,EAAY,KAAK,cAAc,EAAE,MAAM,mBAAmB,CAAC;AAKlE,QAAA,MAAM,gBAAgB;;;EAKpB,CAAC;AAEH;;;;GAIG;AACH,MAAM,WAAW,UAAW,SAAQ,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,gBAAgB,CAAC;CAAG;AAElF,eAAO,MAAM,UAAU,EAAE,OAAO,gBAAgB,GAAG;IACjD,WAAW,EAAE,aAAa,CAAC;IAC3B,UAAU,EAAE,CAAC,MAAM,EAAE,cAAc,KAAK,UAAU,CAAC;IACnD,WAAW,EAAE,CAAC,GAAG,EAAE,UAAU,KAAK,mBAAmB,CAAC;CAiBvD,CAAC"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=version-pin.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"version-pin.test.d.ts","sourceRoot":"","sources":["../../../../src/session/version-pin.test.ts"],"names":[],"mappings":""}
@@ -4,4 +4,5 @@ export * from './ollama';
4
4
  export * from './query-promts';
5
5
  export * from './test-data';
6
6
  export * from './test-schema';
7
+ export * from './printer';
7
8
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/testing/index.ts"],"names":[],"mappings":"AAIA,cAAc,QAAQ,CAAC;AACvB,cAAc,UAAU,CAAC;AACzB,cAAc,UAAU,CAAC;AACzB,cAAc,gBAAgB,CAAC;AAC/B,cAAc,aAAa,CAAC;AAC5B,cAAc,eAAe,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/testing/index.ts"],"names":[],"mappings":"AAIA,cAAc,QAAQ,CAAC;AACvB,cAAc,UAAU,CAAC;AACzB,cAAc,UAAU,CAAC;AACzB,cAAc,gBAAgB,CAAC;AAC/B,cAAc,aAAa,CAAC;AAC5B,cAAc,eAAe,CAAC;AAC9B,cAAc,WAAW,CAAC"}
@@ -1,5 +1,5 @@
1
1
  import type { ImageSource } from '@dxos/artifact';
2
- import type { ConversationEvent } from '../conversation';
2
+ import type { ConversationEvent } from '../experimental';
3
3
  export declare const createLogger: ({ stream, filter, onImage, }?: {
4
4
  stream?: boolean;
5
5
  filter?: (event: ConversationEvent) => boolean;
@@ -1 +1 @@
1
- {"version":3,"file":"logger.d.ts","sourceRoot":"","sources":["../../../../src/testing/logger.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,WAAW,EAAuB,MAAM,gBAAgB,CAAC;AAEvE,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AAEzD,eAAO,MAAM,YAAY,kCAItB;IACD,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,MAAM,CAAC,EAAE,CAAC,KAAK,EAAE,iBAAiB,KAAK,OAAO,CAAC;IAC/C,OAAO,CAAC,EAAE,CAAC,GAAG,EAAE;QAAE,EAAE,EAAE,MAAM,CAAC;QAAC,WAAW,CAAC,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,WAAW,CAAA;KAAE,KAAK,IAAI,CAAC;CACpF,aAIgB,iBAAiB,SA4GjC,CAAC"}
1
+ {"version":3,"file":"logger.d.ts","sourceRoot":"","sources":["../../../../src/testing/logger.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,WAAW,EAAuB,MAAM,gBAAgB,CAAC;AAEvE,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AAEzD,eAAO,MAAM,YAAY,GAAI,+BAI1B;IACD,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,MAAM,CAAC,EAAE,CAAC,KAAK,EAAE,iBAAiB,KAAK,OAAO,CAAC;IAC/C,OAAO,CAAC,EAAE,CAAC,GAAG,EAAE;QAAE,EAAE,EAAE,MAAM,CAAC;QAAC,WAAW,CAAC,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,WAAW,CAAA;KAAE,KAAK,IAAI,CAAC;CAC/E,MAII,OAAO,iBAAiB,SA4GjC,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"ollama.d.ts","sourceRoot":"","sources":["../../../../src/testing/ollama.ts"],"names":[],"mappings":"AAIA,OAAO,EAAwB,YAAY,EAAE,KAAK,kBAAkB,EAAE,MAAM,eAAe,CAAC;AAE5F;;GAEG;AACH,eAAO,MAAM,sBAAsB,aAAc,IAAI,CAAC,kBAAkB,EAAE,OAAO,CAAC,iBAKjF,CAAC"}
1
+ {"version":3,"file":"ollama.d.ts","sourceRoot":"","sources":["../../../../src/testing/ollama.ts"],"names":[],"mappings":"AAIA,OAAO,EAAwB,YAAY,EAAE,KAAK,kBAAkB,EAAE,MAAM,eAAe,CAAC;AAE5F;;GAEG;AACH,eAAO,MAAM,sBAAsB,GAAI,UAAU,IAAI,CAAC,kBAAkB,EAAE,OAAO,CAAC,iBAKjF,CAAC"}
@@ -0,0 +1,6 @@
1
+ import type { Message, MessageContentBlock } from '@dxos/artifact';
2
+ export declare class ConsolePrinter {
3
+ printMessage: (message: Message) => void;
4
+ printContentBlock: (content: MessageContentBlock) => void;
5
+ }
6
+ //# sourceMappingURL=printer.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"printer.d.ts","sourceRoot":"","sources":["../../../../src/testing/printer.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,OAAO,EAAE,mBAAmB,EAAE,MAAM,gBAAgB,CAAC;AAEnE,qBAAa,cAAc;IACzB,YAAY,GAAI,SAAS,OAAO,UAM9B;IAEF,iBAAiB,GAAI,SAAS,mBAAmB,UAsB/C;CACH"}
@@ -1,5 +1,5 @@
1
- import { Schema as S } from 'effect';
2
- import { type DataSource } from '../cypher';
3
- export declare const createCypherTool: (dataSource: DataSource, schemaTypes?: S.Schema.Any[]) => import("@dxos/artifact").Tool;
4
- export declare const createSystemPrompt: (schemaTypes: S.Schema.Any[]) => string;
1
+ import { Schema } from 'effect';
2
+ import { type DataSource } from '../experimental';
3
+ export declare const createCypherTool: (dataSource: DataSource, schemaTypes?: Schema.Schema.Any[]) => import("@dxos/artifact").Tool;
4
+ export declare const createSystemPrompt: (schemaTypes: Schema.Schema.Any[]) => string;
5
5
  //# sourceMappingURL=query-promts.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"query-promts.d.ts","sourceRoot":"","sources":["../../../../src/testing/query-promts.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,MAAM,IAAI,CAAC,EAAE,MAAM,QAAQ,CAAC;AAMrC,OAAO,EAAwC,KAAK,UAAU,EAAE,MAAM,WAAW,CAAC;AAGlF,eAAO,MAAM,gBAAgB,eAAgB,UAAU,gBAAe,CAAC,CAAC,MAAM,CAAC,GAAG,EAAE,kCA0ChF,CAAC;AAEL,eAAO,MAAM,kBAAkB,gBAAiB,CAAC,CAAC,MAAM,CAAC,GAAG,EAAE,WAiB7D,CAAC"}
1
+ {"version":3,"file":"query-promts.d.ts","sourceRoot":"","sources":["../../../../src/testing/query-promts.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAMhC,OAAO,EAAwC,KAAK,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAGxF,eAAO,MAAM,gBAAgB,GAAI,YAAY,UAAU,EAAE,cAAa,MAAM,CAAC,MAAM,CAAC,GAAG,EAAO,kCA0C1F,CAAC;AAEL,eAAO,MAAM,kBAAkB,GAAI,aAAa,MAAM,CAAC,MAAM,CAAC,GAAG,EAAE,WAiBlE,CAAC"}
@@ -1,19 +1,19 @@
1
- import { type Schema as S } from 'effect';
1
+ import { type Schema } from 'effect';
2
2
  import type { EchoDatabase } from '@dxos/echo-db';
3
3
  import { type JsonSchemaType } from '@dxos/echo-schema';
4
- import { type DataSource, type Node, type Relationship } from '../cypher';
4
+ import { type DataSource, type Node, type Relationship } from '../experimental';
5
5
  export declare const seedTestData: (db: EchoDatabase) => void;
6
6
  export declare const createTestData: () => MockDataSource;
7
7
  export declare class MockDataSource implements DataSource {
8
8
  objects: Record<string, {
9
- schema: S.Schema.All;
9
+ schema: Schema.Schema.All;
10
10
  typeDxn: string;
11
11
  id: string;
12
12
  data: unknown;
13
13
  }>;
14
14
  schema: Record<string, {
15
15
  json: JsonSchemaType;
16
- instance: S.Schema.All;
16
+ instance: Schema.Schema.All;
17
17
  }>;
18
18
  nodes: Node[];
19
19
  relationships: Relationship[];
@@ -23,7 +23,7 @@ export declare class MockDataSource implements DataSource {
23
23
  getRelationships({ label }: {
24
24
  label?: string;
25
25
  }): Promise<Relationship[]>;
26
- add<S extends S.Schema.All>(schema: S, data: S.Schema.Type<S>): S.Schema.Type<S>;
26
+ add<S extends Schema.Schema.All>(schema: S, data: Schema.Schema.Type<S>): Schema.Schema.Type<S>;
27
27
  computeGraph(): void;
28
28
  }
29
29
  //# sourceMappingURL=test-data.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"test-data.d.ts","sourceRoot":"","sources":["../../../../src/testing/test-data.ts"],"names":[],"mappings":"AAIA,OAAO,EAA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const Contact: S.mutable<S.Struct<{
4
- id: S.SchemaClass<string, string, never>;
5
- name: S.SchemaClass<string, string, never>;
6
- email: S.optional<typeof S.String>;
1
+ import { Schema } from 'effect';
2
+ /** @deprecated */
3
+ export declare const Contact: Schema.mutable<Schema.Struct<{
4
+ id: import("@dxos/echo-schema").ObjectIdClass;
5
+ name: Schema.SchemaClass<string, string, never>;
6
+ email: Schema.optional<typeof Schema.String>;
7
7
  }>>;
8
- export interface Contact extends S.Schema.Type<typeof Contact> {
8
+ export interface Contact extends Schema.Schema.Type<typeof Contact> {
9
9
  }
10
- export declare const Project: S.mutable<S.Struct<{
11
- id: S.SchemaClass<string, string, never>;
12
- name: S.SchemaClass<string, string, never>;
13
- description: S.optional<typeof S.String>;
10
+ /** @deprecated */
11
+ export declare const Project: Schema.mutable<Schema.Struct<{
12
+ id: import("@dxos/echo-schema").ObjectIdClass;
13
+ name: Schema.SchemaClass<string, string, never>;
14
+ description: Schema.optional<typeof Schema.String>;
14
15
  }>>;
15
- export interface Project extends S.Schema.Type<typeof Project> {
16
+ export interface Project extends Schema.Schema.Type<typeof Project> {
16
17
  }
17
- export declare const Task: S.mutable<S.Struct<{
18
- id: S.SchemaClass<string, string, never>;
19
- name: S.SchemaClass<string, string, never>;
20
- description: S.optional<typeof S.String>;
18
+ export declare const Task: Schema.mutable<Schema.Struct<{
19
+ id: import("@dxos/echo-schema").ObjectIdClass;
20
+ name: Schema.SchemaClass<string, string, never>;
21
+ description: Schema.optional<typeof Schema.String>;
21
22
  project: import("@dxos/echo-schema").Ref$<{
22
23
  name: string;
23
24
  description?: string | undefined;
@@ -29,22 +30,23 @@ export declare const Task: S.mutable<S.Struct<{
29
30
  email?: string | undefined;
30
31
  }>;
31
32
  }>>;
32
- export interface Task extends S.Schema.Type<typeof Task> {
33
+ export interface Task extends Schema.Schema.Type<typeof Task> {
33
34
  }
34
- export declare const Org: S.mutable<S.Struct<{
35
- id: S.SchemaClass<string, string, never>;
36
- name: S.SchemaClass<string, string, never>;
37
- projects: S.Array$<import("@dxos/echo-schema").Ref$<{
35
+ /** @deprecated */
36
+ export declare const Organization: Schema.mutable<Schema.Struct<{
37
+ id: import("@dxos/echo-schema").ObjectIdClass;
38
+ name: Schema.SchemaClass<string, string, never>;
39
+ projects: Schema.Array$<import("@dxos/echo-schema").Ref$<{
38
40
  name: string;
39
41
  description?: string | undefined;
40
42
  id: string;
41
43
  }>>;
42
- employees: S.Array$<import("@dxos/echo-schema").Ref$<{
44
+ employees: Schema.Array$<import("@dxos/echo-schema").Ref$<{
43
45
  name: string;
44
46
  id: string;
45
47
  email?: string | undefined;
46
48
  }>>;
47
49
  }>>;
48
- export interface Org extends S.Schema.Type<typeof Org> {
50
+ export interface Organization extends Schema.Schema.Type<typeof Organization> {
49
51
  }
50
52
  //# sourceMappingURL=test-schema.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"test-schema.d.ts","sourceRoot":"","sources":["../../../../src/testing/test-schema.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,MAAM,IAAI,CAAC,EAAE,MAAM,QAAQ,CAAC;AAQrC,eAAO,MAAM,QAAQ,sCAAyE,CAAC;AAE/F,eAAO,MAAM,OAAO;;;;GAahB,CAAC;AACL,MAAM,WAAW,OAAQ,SAAQ,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,OAAO,CAAC;CAAG;AAEjE,eAAO,MAAM,OAAO;;;;GAahB,CAAC;AACL,MAAM,WAAW,OAAQ,SAAQ,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,OAAO,CAAC;CAAG;AAEjE,eAAO,MAAM,IAAI;;;;;;;;;;;;;;GAeb,CAAC;AACL,MAAM,WAAW,IAAK,SAAQ,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,IAAI,CAAC;CAAG;AAE3D,eAAO,MAAM,GAAG;;;;;;;;;;;;;GAcZ,CAAC;AACL,MAAM,WAAW,GAAI,SAAQ,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,GAAG,CAAC;CAAG"}
1
+ {"version":3,"file":"test-schema.d.ts","sourceRoot":"","sources":["../../../../src/testing/test-schema.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAMhC,kBAAkB;AAClB,eAAO,MAAM,OAAO;;;;GAahB,CAAC;AACL,MAAM,WAAW,OAAQ,SAAQ,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,OAAO,CAAC;CAAG;AAEtE,kBAAkB;AAClB,eAAO,MAAM,OAAO;;;;GAahB,CAAC;AACL,MAAM,WAAW,OAAQ,SAAQ,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,OAAO,CAAC;CAAG;AAEtE,eAAO,MAAM,IAAI;;;;;;;;;;;;;;GAeb,CAAC;AACL,MAAM,WAAW,IAAK,SAAQ,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,IAAI,CAAC;CAAG;AAEhE,kBAAkB;AAClB,eAAO,MAAM,YAAY;;;;;;;;;;;;;GAcrB,CAAC;AACL,MAAM,WAAW,YAAa,SAAQ,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,YAAY,CAAC;CAAG"}
@@ -1 +1 @@
1
- {"version":3,"file":"trim.d.ts","sourceRoot":"","sources":["../../../../src/util/trim.ts"],"names":[],"mappings":"AAIA;;GAEG;AAEH,eAAO,MAAM,IAAI,YAAa,oBAAoB,aAAa,GAAG,EAAE,WAMnE,CAAC"}
1
+ {"version":3,"file":"trim.d.ts","sourceRoot":"","sources":["../../../../src/util/trim.ts"],"names":[],"mappings":"AAIA;;GAEG;AAEH,eAAO,MAAM,IAAI,GAAI,SAAS,oBAAoB,EAAE,GAAG,QAAQ,GAAG,EAAE,WAMnE,CAAC"}
@@ -1 +1 @@
1
- {"version":"5.7.3"}
1
+ {"version":"5.8.3"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dxos/assistant",
3
- "version": "0.8.2-main.12df754",
3
+ "version": "0.8.2-main.30e4dbb",
4
4
  "description": "Natural language interface to DXOS",
5
5
  "homepage": "https://dxos.org",
6
6
  "bugs": "https://github.com/dxos/dxos/issues",
@@ -37,25 +37,31 @@
37
37
  "src"
38
38
  ],
39
39
  "dependencies": {
40
+ "@xenova/transformers": "^2.17.2",
41
+ "exa-js": "^1.5.12",
40
42
  "parjs": "^1.3.9",
41
43
  "parsimmon": "^1.18.1",
42
44
  "ulidx": "^2.3.0",
43
- "@dxos/artifact": "0.8.2-main.12df754",
44
- "@dxos/async": "0.8.2-main.12df754",
45
- "@dxos/debug": "0.8.2-main.12df754",
46
- "@dxos/context": "0.8.2-main.12df754",
47
- "@dxos/echo-db": "0.8.2-main.12df754",
48
- "@dxos/echo-schema": "0.8.2-main.12df754",
49
- "@dxos/invariant": "0.8.2-main.12df754",
50
- "@dxos/keys": "0.8.2-main.12df754",
51
- "@dxos/live-object": "0.8.2-main.12df754",
52
- "@dxos/log": "0.8.2-main.12df754",
53
- "@dxos/node-std": "0.8.2-main.12df754",
54
- "@dxos/util": "0.8.2-main.12df754"
45
+ "@dxos/artifact": "0.8.2-main.30e4dbb",
46
+ "@dxos/async": "0.8.2-main.30e4dbb",
47
+ "@dxos/context": "0.8.2-main.30e4dbb",
48
+ "@dxos/debug": "0.8.2-main.30e4dbb",
49
+ "@dxos/echo-db": "0.8.2-main.30e4dbb",
50
+ "@dxos/echo-protocol": "0.8.2-main.30e4dbb",
51
+ "@dxos/echo": "0.8.2-main.30e4dbb",
52
+ "@dxos/echo-schema": "0.8.2-main.30e4dbb",
53
+ "@dxos/invariant": "0.8.2-main.30e4dbb",
54
+ "@dxos/effect": "0.8.2-main.30e4dbb",
55
+ "@dxos/live-object": "0.8.2-main.30e4dbb",
56
+ "@dxos/keys": "0.8.2-main.30e4dbb",
57
+ "@dxos/node-std": "0.8.2-main.30e4dbb",
58
+ "@dxos/log": "0.8.2-main.30e4dbb",
59
+ "@dxos/schema": "0.8.2-main.30e4dbb",
60
+ "@dxos/util": "0.8.2-main.30e4dbb"
55
61
  },
56
62
  "devDependencies": {
57
63
  "@types/parsimmon": "^1.10.9",
58
- "effect": "3.13.3",
64
+ "effect": "3.14.21",
59
65
  "inquirer": "^12.0.0"
60
66
  },
61
67
  "peerDependencies": {
@@ -2,7 +2,7 @@
2
2
  // Copyright 2024 DXOS.org
3
3
  //
4
4
 
5
- import { Schema as S } from 'effect';
5
+ import { Schema } from 'effect';
6
6
  import { test, describe } from 'vitest';
7
7
 
8
8
  import { defineTool, Message, ToolResult, type Tool } from '@dxos/artifact';
@@ -58,8 +58,8 @@ describe.skip('AI Service Client', () => {
58
58
  name: 'custodian',
59
59
  description: 'Custodian can tell you the password if you say the magic word',
60
60
  parameters: toJsonSchema(
61
- S.Struct({
62
- magicWord: S.String.annotations({ description: 'The magic word. Should be exactly "pretty please"' }),
61
+ Schema.Struct({
62
+ magicWord: Schema.String.annotations({ description: 'The magic word. Should be exactly "pretty please"' }),
63
63
  }),
64
64
  ),
65
65
  };
@@ -194,8 +194,8 @@ describe.skip('Ollama Client', () => {
194
194
  defineTool('test', {
195
195
  name: 'encrypt',
196
196
  description: 'Encrypt a message',
197
- schema: S.Struct({
198
- message: S.String.annotations({ description: 'The message to encrypt' }),
197
+ schema: Schema.Struct({
198
+ message: Schema.String.annotations({ description: 'The message to encrypt' }),
199
199
  }),
200
200
  execute: async ({ message }) => ToolResult.Success(message.split('').reverse().join('')),
201
201
  }),
@@ -2,7 +2,7 @@
2
2
  // Copyright 2025 DXOS.org
3
3
  //
4
4
 
5
- import { Schema as S } from 'effect';
5
+ import { Schema } from 'effect';
6
6
 
7
7
  import { type MessageContentBlock, defineTool, type Tool, ToolResult } from '@dxos/artifact';
8
8
  import { ObjectId } from '@dxos/echo-schema';
@@ -14,7 +14,7 @@ import { MessageCollector, emitMessageAsEvents } from './message-collector';
14
14
  import { type AIServiceClient, type GenerationStream } from './service';
15
15
  import { GenerationStreamImpl } from './stream';
16
16
  import { ToolTypes, type GenerateRequest, type GenerateResponse, type GenerationStreamEvent } from './types';
17
- import { isToolUse, runTools } from '../conversation';
17
+ import { isToolUse, runTools } from '../session';
18
18
 
19
19
  export type OllamaClientParams = {
20
20
  endpoint?: string;
@@ -388,8 +388,8 @@ const WELL_KNOWN_TOOLS: Record<string, Tool> = {
388
388
  [ToolTypes.TextToImage]: defineTool('system', {
389
389
  name: 'text-to-image',
390
390
  description: 'Generate an image from a text prompt',
391
- schema: S.Struct({
392
- prompt: S.String.annotations({ description: 'The text prompt describing the image to generate' }),
391
+ schema: Schema.Struct({
392
+ prompt: Schema.String.annotations({ description: 'The text prompt describing the image to generate' }),
393
393
  }),
394
394
  execute: async ({ prompt }) => {
395
395
  const image = await fetch(SAMPLE_IMAGE_URL).then(async (res) => Buffer.from(await res.arrayBuffer()));
@@ -467,15 +467,15 @@ class OllamaDecoderStream extends TransformStream<string, OllamaResponseData> {
467
467
  }
468
468
  }
469
469
 
470
- class ModelDoesNotSupportToolsError extends S.TaggedError<ModelDoesNotSupportToolsError>()(
470
+ class ModelDoesNotSupportToolsError extends Schema.TaggedError<ModelDoesNotSupportToolsError>()(
471
471
  'ModelDoesNotSupportToolsError',
472
472
  {
473
- model: S.String,
473
+ model: Schema.String,
474
474
  },
475
475
  ) {}
476
476
 
477
- class ModelNotFoundError extends S.TaggedError<ModelNotFoundError>()('ModelNotFoundError', {
478
- model: S.String,
477
+ class ModelNotFoundError extends Schema.TaggedError<ModelNotFoundError>()('ModelNotFoundError', {
478
+ model: Schema.String,
479
479
  }) {}
480
480
 
481
481
  const parseOllamaError = (error: string): Error => {
@@ -2,7 +2,7 @@
2
2
  // Copyright 2025 DXOS.org
3
3
  //
4
4
 
5
- import { Schema as S } from 'effect';
5
+ import { Schema } from 'effect';
6
6
 
7
7
  import { Tool, Message, type MessageContentBlock } from '@dxos/artifact';
8
8
  import { type ObjectId } from '@dxos/echo-schema';
@@ -11,9 +11,9 @@ import { DEFAULT_EDGE_MODELS, DEFAULT_OLLAMA_MODELS } from './defs';
11
11
 
12
12
  export const createArtifactElement = (id: ObjectId) => `<artifact id=${id} />`;
13
13
 
14
- export const LLMModel = S.Literal(...DEFAULT_EDGE_MODELS, ...DEFAULT_OLLAMA_MODELS);
14
+ export const LLMModel = Schema.Literal(...DEFAULT_EDGE_MODELS, ...DEFAULT_OLLAMA_MODELS);
15
15
 
16
- export type LLMModel = S.Schema.Type<typeof LLMModel>;
16
+ export type LLMModel = Schema.Schema.Type<typeof LLMModel>;
17
17
 
18
18
  export const ToolTypes = Object.freeze({
19
19
  // TODO(dmaretskyi): Not implemented yet.
@@ -24,47 +24,47 @@ export const ToolTypes = Object.freeze({
24
24
  /**
25
25
  * Client GPT request.
26
26
  */
27
- export const GenerateRequest = S.Struct({
27
+ export const GenerateRequest = Schema.Struct({
28
28
  /**
29
29
  * Preferred model or system default.
30
30
  */
31
- model: S.optional(LLMModel),
31
+ model: Schema.optional(LLMModel),
32
32
 
33
33
  /**
34
34
  * Tools available for the LLM.
35
35
  */
36
- tools: S.optional(S.Array(Tool).pipe(S.mutable)),
36
+ tools: Schema.optional(Schema.Array(Tool).pipe(Schema.mutable)),
37
37
 
38
38
  /**
39
39
  * System instructions to the LLM.
40
40
  */
41
- systemPrompt: S.optional(S.String),
41
+ systemPrompt: Schema.optional(Schema.String),
42
42
 
43
43
  /**
44
44
  * History of messages to include in the context window.
45
45
  */
46
46
  // TODO(burdon): Rename messages.
47
- history: S.optional(S.Array(Message)),
47
+ history: Schema.optional(Schema.Array(Message)),
48
48
 
49
49
  /**
50
50
  * Current request.
51
51
  */
52
- prompt: S.optional(Message),
52
+ prompt: Schema.optional(Message),
53
53
  });
54
- export type GenerateRequest = S.Schema.Type<typeof GenerateRequest>;
54
+ export type GenerateRequest = Schema.Schema.Type<typeof GenerateRequest>;
55
55
 
56
56
  /**
57
57
  * Non-streaming response.
58
58
  */
59
- export const GenerateResponse = S.Struct({
60
- messages: S.Array(Message),
59
+ export const GenerateResponse = Schema.Struct({
60
+ messages: Schema.Array(Message),
61
61
 
62
62
  /**
63
63
  * Number of tokens used in the response.
64
64
  */
65
- tokenCount: S.optional(S.Number),
65
+ tokenCount: Schema.optional(Schema.Number),
66
66
  });
67
- export type GenerateResponse = S.Schema.Type<typeof GenerateResponse>;
67
+ export type GenerateResponse = Schema.Schema.Type<typeof GenerateResponse>;
68
68
 
69
69
  /**
70
70
  * Server-Sent Events (SSE) stream from the AI service.
package/src/bin/chat.ts CHANGED
@@ -11,7 +11,7 @@ import { SpaceId } from '@dxos/keys';
11
11
  import { log } from '@dxos/log';
12
12
 
13
13
  import { AIServiceEdgeClient, ToolTypes, DEFAULT_EDGE_MODEL } from '../ai-service';
14
- import { runLLM } from '../conversation';
14
+ import { runLLM } from '../experimental';
15
15
  import {
16
16
  AI_SERVICE_ENDPOINT,
17
17
  createLogger,
@@ -19,7 +19,7 @@ import {
19
19
  createSystemPrompt,
20
20
  createTestData,
21
21
  Contact,
22
- Org,
22
+ Organization,
23
23
  Project,
24
24
  Task,
25
25
  } from '../testing';
@@ -33,7 +33,7 @@ const dataSource = createTestData();
33
33
 
34
34
  const cypherTool = createCypherTool(dataSource);
35
35
 
36
- const schemaTypes = [Org, Project, Task, Contact];
36
+ const schemaTypes = [Organization, Project, Task, Contact];
37
37
 
38
38
  const spaceId = SpaceId.random();
39
39
  const threadId = ObjectId.random();
@@ -2,7 +2,7 @@
2
2
  // Copyright 2024 DXOS.org
3
3
  //
4
4
 
5
- import { Schema as S } from 'effect';
5
+ import { Schema } from 'effect';
6
6
  import { describe, test } from 'vitest';
7
7
 
8
8
  import { createUserMessage, defineTool, ToolResult } from '@dxos/artifact';
@@ -11,8 +11,8 @@ import { SpaceId } from '@dxos/keys';
11
11
  import { log } from '@dxos/log';
12
12
 
13
13
  import { runLLM, type ConversationEvent } from './conversation';
14
- import { AIServiceEdgeClient, DEFAULT_EDGE_MODEL } from '../ai-service';
15
- import { AI_SERVICE_ENDPOINT } from '../testing';
14
+ import { AIServiceEdgeClient, DEFAULT_EDGE_MODEL } from '../../ai-service';
15
+ import { AI_SERVICE_ENDPOINT } from '../../testing';
16
16
 
17
17
  // TODO(burdon): Local live LLM test.
18
18
  describe.skip('Conversation tests', () => {
@@ -40,8 +40,8 @@ describe.skip('Conversation tests', () => {
40
40
  const custodian = defineTool('testing', {
41
41
  name: 'custodian',
42
42
  description: 'Custodian can tell you the password if you say the magic word',
43
- schema: S.Struct({
44
- magicWord: S.String.annotations({ description: 'The magic word. Should be exactly "pretty please"' }),
43
+ schema: Schema.Struct({
44
+ magicWord: Schema.String.annotations({ description: 'The magic word. Should be exactly "pretty please"' }),
45
45
  }),
46
46
  execute: async ({ magicWord }) => {
47
47
  if (magicWord === 'pretty please') {