@dxos/assistant 0.8.2-main.5885341 → 0.8.2-main.5ca3450

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 (63) hide show
  1. package/dist/lib/browser/{chunk-DEIGOD4U.mjs → chunk-OLO6SVOL.mjs} +21 -21
  2. package/dist/lib/browser/chunk-OLO6SVOL.mjs.map +7 -0
  3. package/dist/lib/browser/index.mjs +14 -14
  4. package/dist/lib/browser/index.mjs.map +3 -3
  5. package/dist/lib/browser/meta.json +1 -1
  6. package/dist/lib/browser/testing/index.mjs +23 -27
  7. package/dist/lib/browser/testing/index.mjs.map +3 -3
  8. package/dist/lib/node/{chunk-7VH7NMIM.cjs → chunk-CI5Q7FBG.cjs} +6 -6
  9. package/dist/lib/node/chunk-CI5Q7FBG.cjs.map +7 -0
  10. package/dist/lib/node/index.cjs +34 -34
  11. package/dist/lib/node/index.cjs.map +3 -3
  12. package/dist/lib/node/meta.json +1 -1
  13. package/dist/lib/node/testing/index.cjs +13 -18
  14. package/dist/lib/node/testing/index.cjs.map +3 -3
  15. package/dist/lib/node-esm/{chunk-7JI4MDGL.mjs → chunk-Y3SYOFFJ.mjs} +21 -21
  16. package/dist/lib/node-esm/chunk-Y3SYOFFJ.mjs.map +7 -0
  17. package/dist/lib/node-esm/index.mjs +14 -14
  18. package/dist/lib/node-esm/index.mjs.map +3 -3
  19. package/dist/lib/node-esm/meta.json +1 -1
  20. package/dist/lib/node-esm/testing/index.mjs +23 -27
  21. package/dist/lib/node-esm/testing/index.mjs.map +3 -3
  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 +130 -130
  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/conversation.d.ts.map +1 -1
  29. package/dist/types/src/conversation/types.d.ts +9 -9
  30. package/dist/types/src/conversation/types.d.ts.map +1 -1
  31. package/dist/types/src/cypher/echo-data-source.d.ts.map +1 -1
  32. package/dist/types/src/cypher/execution-plan.d.ts.map +1 -1
  33. package/dist/types/src/cypher/parser.d.ts.map +1 -1
  34. package/dist/types/src/cypher/query-executor.d.ts.map +1 -1
  35. package/dist/types/src/cypher/schema.d.ts.map +1 -1
  36. package/dist/types/src/session/session.d.ts +3 -3
  37. package/dist/types/src/session/session.d.ts.map +1 -1
  38. package/dist/types/src/testing/logger.d.ts.map +1 -1
  39. package/dist/types/src/testing/ollama.d.ts.map +1 -1
  40. package/dist/types/src/testing/query-promts.d.ts +3 -3
  41. package/dist/types/src/testing/query-promts.d.ts.map +1 -1
  42. package/dist/types/src/testing/test-data.d.ts +4 -4
  43. package/dist/types/src/testing/test-data.d.ts.map +1 -1
  44. package/dist/types/src/testing/test-schema.d.ts +25 -23
  45. package/dist/types/src/testing/test-schema.d.ts.map +1 -1
  46. package/dist/types/src/util/trim.d.ts.map +1 -1
  47. package/dist/types/tsconfig.tsbuildinfo +1 -1
  48. package/package.json +14 -13
  49. package/src/ai-service/client.test.ts +5 -5
  50. package/src/ai-service/ollama-client.ts +7 -7
  51. package/src/ai-service/types.ts +14 -14
  52. package/src/conversation/conversation.test.ts +3 -3
  53. package/src/conversation/types.ts +10 -10
  54. package/src/cypher/echo-data-source.ts +7 -5
  55. package/src/session/session.test.ts +22 -16
  56. package/src/session/session.ts +14 -14
  57. package/src/testing/artifacts.test.ts +22 -22
  58. package/src/testing/query-promts.ts +5 -5
  59. package/src/testing/test-data.ts +4 -4
  60. package/src/testing/test-schema.ts +27 -28
  61. package/dist/lib/browser/chunk-DEIGOD4U.mjs.map +0 -7
  62. package/dist/lib/node/chunk-7VH7NMIM.cjs.map +0 -7
  63. package/dist/lib/node-esm/chunk-7JI4MDGL.mjs.map +0 -7
@@ -1,23 +1,24 @@
1
- import { Schema as S } from 'effect';
2
- export declare const ObjectId: S.SchemaClass<string, string, never>;
3
- export declare 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 Organization: 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 Organization extends S.Schema.Type<typeof Organization> {
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,YAAY;;;;;;;;;;;;;GAcrB,CAAC;AACL,MAAM,WAAW,YAAa,SAAQ,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,YAAY,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.5885341",
3
+ "version": "0.8.2-main.5ca3450",
4
4
  "description": "Natural language interface to DXOS",
5
5
  "homepage": "https://dxos.org",
6
6
  "bugs": "https://github.com/dxos/dxos/issues",
@@ -40,18 +40,19 @@
40
40
  "parjs": "^1.3.9",
41
41
  "parsimmon": "^1.18.1",
42
42
  "ulidx": "^2.3.0",
43
- "@dxos/artifact": "0.8.2-main.5885341",
44
- "@dxos/async": "0.8.2-main.5885341",
45
- "@dxos/context": "0.8.2-main.5885341",
46
- "@dxos/echo-db": "0.8.2-main.5885341",
47
- "@dxos/echo-schema": "0.8.2-main.5885341",
48
- "@dxos/debug": "0.8.2-main.5885341",
49
- "@dxos/invariant": "0.8.2-main.5885341",
50
- "@dxos/live-object": "0.8.2-main.5885341",
51
- "@dxos/log": "0.8.2-main.5885341",
52
- "@dxos/keys": "0.8.2-main.5885341",
53
- "@dxos/node-std": "0.8.2-main.5885341",
54
- "@dxos/util": "0.8.2-main.5885341"
43
+ "@dxos/artifact": "0.8.2-main.5ca3450",
44
+ "@dxos/context": "0.8.2-main.5ca3450",
45
+ "@dxos/debug": "0.8.2-main.5ca3450",
46
+ "@dxos/async": "0.8.2-main.5ca3450",
47
+ "@dxos/echo": "0.8.2-main.5ca3450",
48
+ "@dxos/echo-schema": "0.8.2-main.5ca3450",
49
+ "@dxos/echo-db": "0.8.2-main.5ca3450",
50
+ "@dxos/invariant": "0.8.2-main.5ca3450",
51
+ "@dxos/live-object": "0.8.2-main.5ca3450",
52
+ "@dxos/keys": "0.8.2-main.5ca3450",
53
+ "@dxos/log": "0.8.2-main.5ca3450",
54
+ "@dxos/node-std": "0.8.2-main.5ca3450",
55
+ "@dxos/util": "0.8.2-main.5ca3450"
55
56
  },
56
57
  "devDependencies": {
57
58
  "@types/parsimmon": "^1.10.9",
@@ -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';
@@ -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.
@@ -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';
@@ -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') {
@@ -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
 
7
7
  import { type Message, type MessageContentBlock } from '@dxos/artifact';
8
8
  import { toJsonSchema, JsonSchemaType, ObjectId } from '@dxos/echo-schema';
@@ -17,11 +17,11 @@ export const createUserMessage = (text: string): Message => ({
17
17
  /**
18
18
  * @deprecated Use {@link LLMTool} instead.
19
19
  */
20
- export const ToolDefinition = S.Struct({
21
- name: S.String,
22
- description: S.String,
20
+ export const ToolDefinition = Schema.Struct({
21
+ name: Schema.String,
22
+ description: Schema.String,
23
23
  parameters: JsonSchemaType,
24
- execute: S.Any,
24
+ execute: Schema.Any,
25
25
  });
26
26
 
27
27
  /**
@@ -83,14 +83,14 @@ export const ToolResult = Object.freeze({
83
83
  Break: (result: unknown): ToolResult => ({ kind: 'break', result }),
84
84
  });
85
85
 
86
- export type DefineToolParams<Params extends S.Schema.AnyNoContext> = {
86
+ export type DefineToolParams<Params extends Schema.Schema.AnyNoContext> = {
87
87
  name: string;
88
88
  description: string;
89
89
  schema: Params;
90
- execute: (params: S.Schema.Type<Params>, context: ToolExecutionContext) => Promise<ToolResult>;
90
+ execute: (params: Schema.Schema.Type<Params>, context: ToolExecutionContext) => Promise<ToolResult>;
91
91
  };
92
92
 
93
- export const defineTool = <Params extends S.Schema.AnyNoContext>({
93
+ export const defineTool = <Params extends Schema.Schema.AnyNoContext>({
94
94
  name,
95
95
  description,
96
96
  schema,
@@ -101,7 +101,7 @@ export const defineTool = <Params extends S.Schema.AnyNoContext>({
101
101
  description,
102
102
  parameters: toFunctionParameterSchema(schema),
103
103
  execute: (params, context) => {
104
- const sanitized = S.decodeSync(schema)(params);
104
+ const sanitized = Schema.decodeSync(schema)(params);
105
105
  return execute(sanitized, context);
106
106
  },
107
107
  };
@@ -110,7 +110,7 @@ export const defineTool = <Params extends S.Schema.AnyNoContext>({
110
110
  /**
111
111
  * Adapts schems to be able to pass to AI providers.
112
112
  */
113
- const toFunctionParameterSchema = (schema: S.Schema.All) => {
113
+ const toFunctionParameterSchema = (schema: Schema.Schema.All) => {
114
114
  const jsonSchema = toJsonSchema(schema);
115
115
  log('tool schema', { jsonSchema });
116
116
  delete jsonSchema.anyOf;
@@ -2,9 +2,11 @@
2
2
  // Copyright 2025 DXOS.org
3
3
  //
4
4
 
5
+ import { type Schema } from 'effect';
6
+
5
7
  import { raise } from '@dxos/debug';
6
- import { type EchoDatabase, Filter, type ReactiveEchoObject } from '@dxos/echo-db';
7
- import { getSchema, getSchemaTypename, type S, StoredSchema, toJsonSchema } from '@dxos/echo-schema';
8
+ import { type EchoDatabase, Filter, type AnyLiveObject } from '@dxos/echo-db';
9
+ import { getSchema, getSchemaTypename, StoredSchema, toJsonSchema } from '@dxos/echo-schema';
8
10
  import { log } from '@dxos/log';
9
11
 
10
12
  import type { DataSource, Node, Relationship } from './query-executor';
@@ -62,7 +64,7 @@ export class EchoDataSource implements DataSource {
62
64
  ).flat();
63
65
  }
64
66
 
65
- private async _getAllSchema(): Promise<S.Schema.AnyNoContext[]> {
67
+ private async _getAllSchema(): Promise<Schema.Schema.AnyNoContext[]> {
66
68
  return [
67
69
  ...(await this._db.schemaRegistry.query().run()),
68
70
  // TODO(dmaretskyi): Remove once we can serialize recursive schema.
@@ -70,7 +72,7 @@ export class EchoDataSource implements DataSource {
70
72
  ].filter((schema) => getSchemaTypename(schema) !== StoredSchema.typename);
71
73
  }
72
74
 
73
- private _objectToNode(object: ReactiveEchoObject<any>): Node {
75
+ private _objectToNode(object: AnyLiveObject<any>): Node {
74
76
  const { id, ...properties } = object;
75
77
  return {
76
78
  id,
@@ -80,7 +82,7 @@ export class EchoDataSource implements DataSource {
80
82
  };
81
83
  }
82
84
 
83
- private async _projectRefRelationship(object: ReactiveEchoObject<any>, prop: string): Promise<Relationship[]> {
85
+ private async _projectRefRelationship(object: AnyLiveObject<any>, prop: string): Promise<Relationship[]> {
84
86
  if (!object[prop]) {
85
87
  return [];
86
88
  }
@@ -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
  import { inspect } from 'node:util';
7
7
  import { describe, test } from 'vitest';
8
8
 
@@ -15,7 +15,8 @@ import {
15
15
  type MessageContentBlock,
16
16
  } from '@dxos/artifact';
17
17
  import { AIServiceEdgeClient } from '@dxos/assistant';
18
- import { create, EchoObject, ObjectId } from '@dxos/echo-schema';
18
+ import { Type } from '@dxos/echo';
19
+ import { create, ObjectId } from '@dxos/echo-schema';
19
20
  import { DXN } from '@dxos/keys';
20
21
  import { log } from '@dxos/log';
21
22
 
@@ -23,14 +24,19 @@ import { AISession } from './session';
23
24
  import { AI_SERVICE_ENDPOINT } from '../testing';
24
25
 
25
26
  // Define a calendar event artifact schema.
26
- const CalendarEventSchema = S.Struct({
27
- title: S.String,
28
- startTime: S.String,
29
- endTime: S.String,
30
- description: S.String,
31
- }).pipe(EchoObject({ typename: 'example.com/type/CalendarEvent', version: '0.1.0' }));
27
+ const CalendarEventSchema = Schema.Struct({
28
+ title: Schema.String,
29
+ startTime: Schema.String,
30
+ endTime: Schema.String,
31
+ description: Schema.String,
32
+ }).pipe(
33
+ Type.def({
34
+ typename: 'example.com/type/CalendarEvent',
35
+ version: '0.1.0',
36
+ }),
37
+ );
32
38
 
33
- type CalendarEvent = S.Schema.Type<typeof CalendarEventSchema>;
39
+ type CalendarEvent = Schema.Schema.Type<typeof CalendarEventSchema>;
34
40
 
35
41
  // TODO(burdon): Flaky.
36
42
  describe.skip('AISession with Ollama', () => {
@@ -53,7 +59,7 @@ describe.skip('AISession with Ollama', () => {
53
59
  defineTool('calendar', {
54
60
  name: 'query',
55
61
  description: 'Query the calendar for events',
56
- schema: S.Struct({}),
62
+ schema: Schema.Struct({}),
57
63
  execute: async () => {
58
64
  return ToolResult.Success(CALENDAR_EVENTS);
59
65
  },
@@ -65,13 +71,13 @@ describe.skip('AISession with Ollama', () => {
65
71
  id: 'artifact:dxos.org/plugin/table',
66
72
  name: 'Table',
67
73
  instructions: 'Use this to create and manage tables. Each table has a unique id.',
68
- schema: S.Struct({}),
74
+ schema: Schema.Struct({}),
69
75
  tools: [
70
76
  defineTool('table', {
71
77
  name: 'create',
72
78
  description: 'Create a table',
73
- schema: S.Struct({
74
- data: S.Array(S.Any).annotations({ description: 'Array of data payloads to add as rows' }),
79
+ schema: Schema.Struct({
80
+ data: Schema.Array(Schema.Any).annotations({ description: 'Array of data payloads to add as rows' }),
75
81
  }),
76
82
  execute: async ({ data }) => {
77
83
  log('create table', { data });
@@ -89,12 +95,12 @@ describe.skip('AISession with Ollama', () => {
89
95
  name: 'Map',
90
96
  instructions:
91
97
  'Use this to create and manage maps. Maps source data from tables. Table id is required to create a map.',
92
- schema: S.Struct({}),
98
+ schema: Schema.Struct({}),
93
99
  tools: [
94
100
  defineTool('map', {
95
101
  name: 'create',
96
102
  description: 'Create a map',
97
- schema: S.Struct({
103
+ schema: Schema.Struct({
98
104
  source: ArtifactId.annotations({
99
105
  description: 'The table that will be used as the source of the map',
100
106
  }),
@@ -119,7 +125,7 @@ describe.skip('AISession with Ollama', () => {
119
125
  id: 'artifact:dxos.org/plugin/script',
120
126
  name: 'Script',
121
127
  instructions: 'Use this to create and manage scripts',
122
- schema: S.Struct({}),
128
+ schema: Schema.Struct({}),
123
129
  tools: [],
124
130
  });
125
131
 
@@ -2,7 +2,7 @@
2
2
  // Copyright 2025 DXOS.org
3
3
  //
4
4
 
5
- import { Option, Schema as S } from 'effect';
5
+ import { Option, Schema } from 'effect';
6
6
 
7
7
  import {
8
8
  defineTool,
@@ -287,7 +287,7 @@ export class AISession {
287
287
  return defineTool('system', {
288
288
  name: 'query_artifact_definitions',
289
289
  description: 'Query the available artifact definitions',
290
- schema: S.Struct({}),
290
+ schema: Schema.Struct({}),
291
291
  execute: async () => {
292
292
  return ToolResult.Success({
293
293
  artifactDefinitions: artifacts.map((artifact) => ({
@@ -308,8 +308,8 @@ export class AISession {
308
308
  name: 'require_artifact_definitions',
309
309
  description:
310
310
  'Require the use of specific artifact definitions. This will allow the model to interact with artifact definitions and use their tools.',
311
- schema: S.Struct({
312
- artifactDefinitionIds: S.Array(S.String).annotations({
311
+ schema: Schema.Struct({
312
+ artifactDefinitionIds: Schema.Array(Schema.String).annotations({
313
313
  description: 'The ids of the artifact definitions to require',
314
314
  examples: [['artifact:dxos.org/example/Test']],
315
315
  }),
@@ -336,20 +336,20 @@ export class AISession {
336
336
  name: 'create_plan',
337
337
  description:
338
338
  'Create a plan. Make sure that each step is independent and can be executed solely on the data returned by the previous step. The steps only share the data that is specified in the plan.',
339
- schema: S.Struct({
340
- goal: S.String.annotations({ description: 'The goal that the plan will achieve.' }),
341
- steps: S.Array(
342
- S.Struct({
343
- action: S.String.annotations({
339
+ schema: Schema.Struct({
340
+ goal: Schema.String.annotations({ description: 'The goal that the plan will achieve.' }),
341
+ steps: Schema.Array(
342
+ Schema.Struct({
343
+ action: Schema.String.annotations({
344
344
  description: 'Complete, detailed action to perform.',
345
345
  }),
346
- input: S.String.annotations({
346
+ input: Schema.String.annotations({
347
347
  description: 'The required input data for this step. First step must not require any data.',
348
348
  }),
349
- output: S.String.annotations({
349
+ output: Schema.String.annotations({
350
350
  description: 'The output data from this step. This is passed to the next step as input.',
351
351
  }),
352
- requiredArtifactIds: S.Array(S.String).annotations({
352
+ requiredArtifactIds: Schema.Array(Schema.String).annotations({
353
353
  description: 'The ids of the artifacts required to perform this step.',
354
354
  examples: [['artifact:dxos.org/example/Test']],
355
355
  }),
@@ -473,7 +473,7 @@ const createBaseInstructions = ({
473
473
  ${availableArtifacts.length > 0 ? `Artifacts already in context: ${availableArtifacts.join('\n')}` : ''}
474
474
  `;
475
475
 
476
- export class AIServiecOverloadedError extends S.TaggedError<AIServiecOverloadedError>()(
476
+ export class AIServiecOverloadedError extends Schema.TaggedError<AIServiecOverloadedError>()(
477
477
  'AIServiecOverloadedError',
478
478
  {},
479
479
  ) {}
@@ -483,7 +483,7 @@ const gatherObjectVersions = (messages: Message[]): Map<ObjectId, ObjectVersion>
483
483
  for (const message of messages) {
484
484
  for (const block of message.content) {
485
485
  if (block.type === 'json' && block.disposition === VersionPin.DISPOSITION) {
486
- const pin = VersionPin.pipe(S.decodeOption)(JSON.parse(block.json)).pipe(Option.getOrUndefined);
486
+ const pin = VersionPin.pipe(Schema.decodeOption)(JSON.parse(block.json)).pipe(Option.getOrUndefined);
487
487
  if (!pin) {
488
488
  continue;
489
489
  }