@dxos/assistant 0.7.4-df37807 → 0.7.5-feature-compute.4d9d99a

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 (96) hide show
  1. package/dist/lib/browser/{chunk-AKP45LQH.mjs → chunk-LVLSJQB3.mjs} +506 -357
  2. package/dist/lib/browser/chunk-LVLSJQB3.mjs.map +7 -0
  3. package/dist/lib/browser/index.mjs +17 -17
  4. package/dist/lib/browser/meta.json +1 -1
  5. package/dist/lib/browser/testing/index.mjs +10 -3
  6. package/dist/lib/browser/testing/index.mjs.map +4 -4
  7. package/dist/lib/node/{chunk-G6CGWEMO.cjs → chunk-SHOSAIOD.cjs} +507 -362
  8. package/dist/lib/node/chunk-SHOSAIOD.cjs.map +7 -0
  9. package/dist/lib/node/index.cjs +42 -42
  10. package/dist/lib/node/index.cjs.map +1 -1
  11. package/dist/lib/node/meta.json +1 -1
  12. package/dist/lib/node/testing/index.cjs +18 -12
  13. package/dist/lib/node/testing/index.cjs.map +4 -4
  14. package/dist/lib/node-esm/{chunk-WUPUPEFB.mjs → chunk-ZLBTRSUY.mjs} +506 -357
  15. package/dist/lib/node-esm/chunk-ZLBTRSUY.mjs.map +7 -0
  16. package/dist/lib/node-esm/index.mjs +17 -17
  17. package/dist/lib/node-esm/meta.json +1 -1
  18. package/dist/lib/node-esm/testing/index.mjs +10 -3
  19. package/dist/lib/node-esm/testing/index.mjs.map +4 -4
  20. package/dist/types/src/ai-service/client.d.ts +15 -32
  21. package/dist/types/src/ai-service/client.d.ts.map +1 -1
  22. package/dist/types/src/ai-service/index.d.ts +2 -1
  23. package/dist/types/src/ai-service/index.d.ts.map +1 -1
  24. package/dist/types/src/ai-service/stream.d.ts +34 -0
  25. package/dist/types/src/ai-service/stream.d.ts.map +1 -0
  26. package/dist/types/src/ai-service/stream.test.d.ts +2 -0
  27. package/dist/types/src/ai-service/stream.test.d.ts.map +1 -0
  28. package/dist/types/src/ai-service/types/index.d.ts +3 -0
  29. package/dist/types/src/ai-service/types/index.d.ts.map +1 -0
  30. package/dist/types/src/ai-service/types/message.d.ts +191 -0
  31. package/dist/types/src/ai-service/types/message.d.ts.map +1 -0
  32. package/dist/types/src/ai-service/types/schema.d.ts +175 -0
  33. package/dist/types/src/ai-service/types/schema.d.ts.map +1 -0
  34. package/dist/types/src/ai-service/util/index.d.ts +2 -0
  35. package/dist/types/src/ai-service/util/index.d.ts.map +1 -0
  36. package/dist/types/src/ai-service/{sse.d.ts → util/sse.d.ts} +5 -0
  37. package/dist/types/src/ai-service/util/sse.d.ts.map +1 -0
  38. package/dist/types/src/conversation/conversation.d.ts +54 -4
  39. package/dist/types/src/conversation/conversation.d.ts.map +1 -1
  40. package/dist/types/src/conversation/types.d.ts +35 -4
  41. package/dist/types/src/conversation/types.d.ts.map +1 -1
  42. package/dist/types/src/cypher/combinators.d.ts.map +1 -1
  43. package/dist/types/src/cypher/parjs.d.ts +1 -1
  44. package/dist/types/src/cypher/parjs.d.ts.map +1 -1
  45. package/dist/types/src/cypher/schema.d.ts.map +1 -1
  46. package/dist/types/src/testing/artifacts.test.d.ts +1 -0
  47. package/dist/types/src/testing/artifacts.test.d.ts.map +1 -0
  48. package/dist/types/src/testing/data.d.ts +2 -0
  49. package/dist/types/src/testing/data.d.ts.map +1 -0
  50. package/dist/types/src/testing/defs.d.ts +5 -0
  51. package/dist/types/src/testing/defs.d.ts.map +1 -0
  52. package/dist/types/src/testing/index.d.ts +1 -0
  53. package/dist/types/src/testing/index.d.ts.map +1 -1
  54. package/dist/types/src/testing/test-data.d.ts +1 -1
  55. package/dist/types/src/testing/test-data.d.ts.map +1 -1
  56. package/package.json +20 -18
  57. package/src/ai-service/client.test.ts +25 -26
  58. package/src/ai-service/client.ts +29 -177
  59. package/src/ai-service/index.ts +2 -1
  60. package/src/ai-service/stream.test.ts +186 -0
  61. package/src/ai-service/stream.ts +181 -0
  62. package/src/ai-service/types/index.ts +6 -0
  63. package/src/ai-service/types/message.ts +147 -0
  64. package/src/ai-service/types/schema.ts +128 -0
  65. package/src/ai-service/util/index.ts +5 -0
  66. package/src/ai-service/{sse.ts → util/sse.ts} +5 -0
  67. package/src/bin/chat.ts +6 -9
  68. package/src/conversation/conversation.test.ts +10 -14
  69. package/src/conversation/conversation.ts +109 -14
  70. package/src/conversation/types.ts +47 -6
  71. package/src/cypher/combinators.test.ts +3 -3
  72. package/src/cypher/combinators.ts +0 -1
  73. package/src/cypher/execution-plan.test.ts +5 -3
  74. package/src/cypher/parjs-shims.d.ts +4 -0
  75. package/src/cypher/parjs.ts +2 -2
  76. package/src/cypher/query-executor.test.ts +1 -1
  77. package/src/cypher/schema.ts +0 -1
  78. package/src/index.ts +1 -1
  79. package/src/testing/artifacts.test.ts +182 -0
  80. package/src/testing/data.ts +13 -0
  81. package/src/testing/defs.ts +8 -0
  82. package/src/testing/index.ts +1 -0
  83. package/src/testing/query.test.ts +9 -9
  84. package/src/testing/test-data.ts +1 -1
  85. package/vendor/parjs-browser.mjs +4 -0
  86. package/vendor/parjs-default.mjs +8 -0
  87. package/dist/lib/browser/chunk-AKP45LQH.mjs.map +0 -7
  88. package/dist/lib/node/chunk-G6CGWEMO.cjs.map +0 -7
  89. package/dist/lib/node-esm/chunk-WUPUPEFB.mjs.map +0 -7
  90. package/dist/types/src/ai-service/schema.d.ts +0 -296
  91. package/dist/types/src/ai-service/schema.d.ts.map +0 -1
  92. package/dist/types/src/ai-service/sse.d.ts.map +0 -1
  93. package/dist/types/src/sanity.test.d.ts +0 -2
  94. package/dist/types/src/sanity.test.d.ts.map +0 -1
  95. package/src/ai-service/schema.ts +0 -260
  96. package/src/sanity.test.ts +0 -9
@@ -0,0 +1,175 @@
1
+ import { Schema as S } from '@effect/schema';
2
+ import { JsonSchemaType } from '@dxos/echo-schema';
3
+ import { Message, type MessageContentBlock } from './message';
4
+ export declare const LLMModel: S.Literal<["@hf/nousresearch/hermes-2-pro-mistral-7b", "@anthropic/claude-3-5-sonnet-20241022", "@anthropic/claude-3-5-haiku-20241022", "@ollama/llama-3-2-3b", "@ollama/llama-3-1-nemotron-70b-instruct", "@ollama/llama-3-1-nemotron-mini-4b-instruct", "@cf/deepseek-ai/deepseek-r1-distill-qwen-32b"]>;
5
+ export type LLMModel = S.Schema.Type<typeof LLMModel>;
6
+ export declare const ToolTypes: Readonly<{
7
+ TextToImage: "text_to_image";
8
+ }>;
9
+ export declare const LLMTool: S.Struct<{
10
+ name: typeof S.String;
11
+ /**
12
+ * If the tool is implemented by the service a type should be provided.
13
+ * For user-implemented tools, this field should be omitted.
14
+ * See {@link ToolTypes} for the list of supported types.
15
+ */
16
+ type: S.optional<typeof S.String>;
17
+ /**
18
+ * Required for user-implemented tools.
19
+ */
20
+ description: S.optional<typeof S.String>;
21
+ /**
22
+ * Input schema for the tool in the JSON Schema format.
23
+ * Required for user-implemented tools.
24
+ */
25
+ parameters: S.optional<S.Schema<JsonSchemaType, JsonSchemaType, never>>;
26
+ /**
27
+ * Tool-specific options.
28
+ */
29
+ options: S.optional<typeof S.Any>;
30
+ /**
31
+ * Javascript function to execute the tool.
32
+ */
33
+ execute: S.optional<typeof S.Any>;
34
+ }>;
35
+ export interface LLMTool extends S.Schema.Type<typeof LLMTool> {
36
+ }
37
+ export declare const GenerateRequest: S.Struct<{
38
+ model: S.Literal<["@hf/nousresearch/hermes-2-pro-mistral-7b", "@anthropic/claude-3-5-sonnet-20241022", "@anthropic/claude-3-5-haiku-20241022", "@ollama/llama-3-2-3b", "@ollama/llama-3-1-nemotron-70b-instruct", "@ollama/llama-3-1-nemotron-mini-4b-instruct", "@cf/deepseek-ai/deepseek-r1-distill-qwen-32b"]>;
39
+ spaceId: S.optional<S.Schema<import("packages/common/keys/dist/types/src").SpaceId, string, never>>;
40
+ threadId: S.optional<import("@dxos/echo-schema").ObjectIdClass>;
41
+ /**
42
+ * History of messages to include in the context window.
43
+ */
44
+ history: S.optional<S.Array$<S.Schema<{
45
+ readonly id: string;
46
+ spaceId?: import("packages/common/keys/dist/types/src").SpaceId | undefined;
47
+ content: ({
48
+ type: "tag";
49
+ tag: string;
50
+ text: string;
51
+ } | {
52
+ type: "text";
53
+ text: string;
54
+ } | {
55
+ id?: string | undefined;
56
+ type: "image";
57
+ source?: {
58
+ type: "base64";
59
+ media_type: "image/jpeg" | "image/png" | "image/gif" | "image/webp";
60
+ data: string;
61
+ } | undefined;
62
+ } | {
63
+ id: string;
64
+ type: "tool_use";
65
+ name: string;
66
+ input: unknown;
67
+ inputJson?: string | undefined;
68
+ } | {
69
+ readonly type: "tool_result";
70
+ readonly toolUseId: string;
71
+ readonly content: string;
72
+ readonly isError?: boolean | undefined;
73
+ })[];
74
+ threadId?: string | undefined;
75
+ foreignId?: string | undefined;
76
+ role: "user" | "assistant";
77
+ }, {
78
+ readonly id: string;
79
+ spaceId?: import("packages/common/keys/dist/types/src").SpaceId | undefined;
80
+ content: ({
81
+ type: "tag";
82
+ tag: string;
83
+ text: string;
84
+ } | {
85
+ type: "text";
86
+ text: string;
87
+ } | {
88
+ id?: string | undefined;
89
+ type: "image";
90
+ source?: {
91
+ type: "base64";
92
+ media_type: "image/jpeg" | "image/png" | "image/gif" | "image/webp";
93
+ data: string;
94
+ } | undefined;
95
+ } | {
96
+ id: string;
97
+ type: "tool_use";
98
+ name: string;
99
+ input: unknown;
100
+ inputJson?: string | undefined;
101
+ } | {
102
+ readonly type: "tool_result";
103
+ readonly toolUseId: string;
104
+ readonly content: string;
105
+ readonly isError?: boolean | undefined;
106
+ })[];
107
+ threadId?: string | undefined;
108
+ foreignId?: string | undefined;
109
+ role: "user" | "assistant";
110
+ }, never>>>;
111
+ /**
112
+ * System instructions to the LLM.
113
+ */
114
+ systemPrompt: S.optional<typeof S.String>;
115
+ /**
116
+ * Tools available for the LLM.
117
+ */
118
+ tools: S.optional<S.mutable<S.Array$<S.Struct<{
119
+ name: typeof S.String;
120
+ /**
121
+ * If the tool is implemented by the service a type should be provided.
122
+ * For user-implemented tools, this field should be omitted.
123
+ * See {@link ToolTypes} for the list of supported types.
124
+ */
125
+ type: S.optional<typeof S.String>;
126
+ /**
127
+ * Required for user-implemented tools.
128
+ */
129
+ description: S.optional<typeof S.String>;
130
+ /**
131
+ * Input schema for the tool in the JSON Schema format.
132
+ * Required for user-implemented tools.
133
+ */
134
+ parameters: S.optional<S.Schema<JsonSchemaType, JsonSchemaType, never>>;
135
+ /**
136
+ * Tool-specific options.
137
+ */
138
+ options: S.optional<typeof S.Any>;
139
+ /**
140
+ * Javascript function to execute the tool.
141
+ */
142
+ execute: S.optional<typeof S.Any>;
143
+ }>>>>;
144
+ }>;
145
+ export type GenerateRequest = S.Schema.Type<typeof GenerateRequest>;
146
+ export type LLMStopReason = 'tool_use' | 'end_turn';
147
+ export type ResultStreamEvent = {
148
+ type: 'message_start';
149
+ message: Omit<Message, 'spaceId' | 'threadId'>;
150
+ } | {
151
+ type: 'message_delta';
152
+ delta: {
153
+ stopReason: LLMStopReason;
154
+ };
155
+ } | {
156
+ type: 'message_stop';
157
+ } | {
158
+ type: 'content_block_start';
159
+ index: number;
160
+ content: MessageContentBlock;
161
+ } | {
162
+ type: 'content_block_delta';
163
+ index: number;
164
+ delta: {
165
+ type: 'text_delta';
166
+ text: string;
167
+ } | {
168
+ partial_json: string;
169
+ type: 'input_json_delta';
170
+ };
171
+ } | {
172
+ type: 'content_block_stop';
173
+ index: number;
174
+ };
175
+ //# sourceMappingURL=schema.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../../../../../src/ai-service/types/schema.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,MAAM,IAAI,CAAC,EAAE,MAAM,gBAAgB,CAAC;AAE7C,OAAO,EAAE,cAAc,EAAY,MAAM,mBAAmB,CAAC;AAE7D,OAAO,EAAE,OAAO,EAAE,KAAK,mBAAmB,EAAiB,MAAM,WAAW,CAAC;AAE7E,eAAO,MAAM,QAAQ,4SAQpB,CAAC;AACF,MAAM,MAAM,QAAQ,GAAG,CA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D;QACE,YAAY,EAAE,MAAM,CAAC;QAErB,IAAI,EAAE,kBAAkB,CAAC;KAC1B,CAAC;CACP,GACD;IACE,IAAI,EAAE,oBAAoB,CAAC;IAC3B,KAAK,EAAE,MAAM,CAAC;CACf,CAAC"}
@@ -0,0 +1,2 @@
1
+ export * from './sse';
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/ai-service/util/index.ts"],"names":[],"mappings":"AAIA,cAAc,OAAO,CAAC"}
@@ -1,3 +1,8 @@
1
+ /**
2
+ * Server sent events (SSE) iterator.
3
+ * @param response
4
+ * @param controller
5
+ */
1
6
  export declare function iterSSEMessages(response: Response, controller: AbortController): AsyncGenerator<ServerSentEvent, void, unknown>;
2
7
  export type ServerSentEvent = {
3
8
  event: string | null;
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sse.d.ts","sourceRoot":"","sources":["../../../../../src/ai-service/util/sse.ts"],"names":[],"mappings":"AAKA;;;;GAIG;AACH,wBAAuB,eAAe,CACpC,QAAQ,EAAE,QAAQ,EAClB,UAAU,EAAE,eAAe,GAC1B,cAAc,CAAC,eAAe,EAAE,IAAI,EAAE,OAAO,CAAC,CAyBhD;AAED,MAAM,MAAM,eAAe,GAAG;IAC5B,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IACrB,IAAI,EAAE,MAAM,CAAC;IACb,GAAG,EAAE,MAAM,EAAE,CAAC;CACf,CAAC;AA8HF,uEAAuE;AACvE,eAAO,MAAM,aAAa,WAAY,MAAM,EAAE,KAAG,MAAM,EAQtD,CAAC;AAWF;;;;;GAKG;AACH,wBAAgB,2BAA2B,CAAC,CAAC,EAAE,MAAM,EAAE,GAAG,GAAG,qBAAqB,CAAC,CAAC,CAAC,CA6BpF;AAED,MAAM,MAAM,KAAK,GAAG,MAAM,GAAG,WAAW,GAAG,UAAU,GAAG,MAAM,GAAG,IAAI,GAAG,SAAS,CAAC;AAElF;;;;;GAKG;AACH,qBAAa,WAAW;IAEtB,MAAM,CAAC,aAAa,cAAyB;IAC7C,MAAM,CAAC,cAAc,SAAkB;IAEvC,MAAM,EAAE,MAAM,EAAE,CAAC;IACjB,UAAU,EAAE,OAAO,CAAC;IACpB,WAAW,EAAE,GAAG,CAAC;;IAOjB,MAAM,CAAC,KAAK,EAAE,KAAK,GAAG,MAAM,EAAE;IA0C9B,UAAU,CAAC,KAAK,EAAE,KAAK,GAAG,MAAM;IAuChC,KAAK,IAAI,MAAM,EAAE;CAUlB"}
@@ -1,15 +1,16 @@
1
+ import { ObjectId } from '@dxos/echo-schema';
1
2
  import { type SpaceId } from '@dxos/keys';
2
- import { ObjectId, type LLMTool } from '../ai-service';
3
- import { type AIServiceClient, type Message, type ResultStreamEvent, type LLMModel } from '../ai-service';
3
+ import { type LLMTool, Message, type AIServiceClient, type ResultStreamEvent, type LLMModel } from '../ai-service';
4
4
  export type CreateLLMConversationParams = {
5
5
  model: LLMModel;
6
6
  /**
7
7
  * System prompt that specifies instructions for the LLM.
8
8
  */
9
9
  system?: string;
10
- spaceId: SpaceId;
11
- threadId: ObjectId;
10
+ spaceId?: SpaceId;
11
+ threadId?: ObjectId;
12
12
  tools: LLMTool[];
13
+ history?: Message[];
13
14
  client: AIServiceClient;
14
15
  logger?: (event: ConversationEvent) => void;
15
16
  };
@@ -19,5 +20,54 @@ export type ConversationEvent = {
19
20
  } | ResultStreamEvent;
20
21
  export declare const runLLM: (params: CreateLLMConversationParams) => Promise<{
21
22
  result: any;
23
+ history: {
24
+ readonly id: string;
25
+ spaceId?: SpaceId | undefined;
26
+ content: ({
27
+ type: "tag";
28
+ tag: string;
29
+ text: string;
30
+ } | {
31
+ type: "text";
32
+ text: string;
33
+ } | {
34
+ id?: string | undefined;
35
+ type: "image";
36
+ source?: {
37
+ type: "base64";
38
+ media_type: "image/jpeg" | "image/png" | "image/gif" | "image/webp";
39
+ data: string;
40
+ } | undefined;
41
+ } | {
42
+ id: string;
43
+ type: "tool_use";
44
+ name: string;
45
+ input: unknown;
46
+ inputJson?: string | undefined;
47
+ } | {
48
+ readonly type: "tool_result";
49
+ readonly toolUseId: string;
50
+ readonly content: string;
51
+ readonly isError?: boolean | undefined;
52
+ })[];
53
+ threadId?: string | undefined;
54
+ foreignId?: string | undefined;
55
+ role: "user" | "assistant";
56
+ }[];
22
57
  }>;
58
+ export declare const isToolUse: (message: Message) => boolean;
59
+ type RunToolsOptions = {
60
+ message: Message;
61
+ tools: LLMTool[];
62
+ extensions?: LLMToolContextExtensions;
63
+ };
64
+ export type RunToolsResult = {
65
+ type: 'continue';
66
+ message: Message;
67
+ } | {
68
+ type: 'break';
69
+ result: unknown;
70
+ };
71
+ export declare const runTools: ({ message, tools, extensions }: RunToolsOptions) => Promise<RunToolsResult>;
72
+ export {};
23
73
  //# sourceMappingURL=conversation.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"conversation.d.ts","sourceRoot":"","sources":["../../../../src/conversation/conversation.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,KAAK,OAAO,EAAE,MAAM,YAAY,CAAC;AAI1C,OAAO,EAAE,QAAQ,EAAE,KAAK,OAAO,EAAE,MAAM,eAAe,CAAC;AACvD,OAAO,EAAE,KAAK,eAAe,EAAE,KAAK,OAAO,EAAE,KAAK,iBAAiB,EAAE,KAAK,QAAQ,EAAE,MAAM,eAAe,CAAC;AAE1G,MAAM,MAAM,2BAA2B,GAAG;IACxC,KAAK,EAAE,QAAQ,CAAC;IAEhB;;OAEG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;IAEhB,OAAO,EAAE,OAAO,CAAC;IACjB,QAAQ,EAAE,QAAQ,CAAC;IAEnB,KAAK,EAAE,OAAO,EAAE,CAAC;IAEjB,MAAM,EAAE,eAAe,CAAC;IAExB,MAAM,CAAC,EAAE,CAAC,KAAK,EAAE,iBAAiB,KAAK,IAAI,CAAC;CAC7C,CAAC;AAEF,MAAM,MAAM,iBAAiB,GACzB;IACE,IAA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AC;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,mCAA0C,eAAe,KAAG,OAAO,CAAC,cAAc,CAkEtG,CAAC"}
@@ -1,24 +1,55 @@
1
1
  import { Schema as S } from '@effect/schema';
2
- import { JsonSchemaType } from '@dxos/echo-schema';
2
+ import { JsonSchemaType, ObjectId } from '@dxos/echo-schema';
3
3
  import type { SpaceId } from '@dxos/keys';
4
- import { ObjectId, type Message } from '../ai-service';
4
+ import { type Message, type MessageContentBlock } from '../ai-service';
5
5
  export declare const createUserMessage: (spaceId: SpaceId, threadId: ObjectId, text: string) => Message;
6
+ /**
7
+ * @deprecated Use {@link LLMTool} instead.
8
+ */
6
9
  export declare const LLMToolDefinition: S.Struct<{
7
10
  name: typeof S.String;
8
11
  description: typeof S.String;
9
12
  parameters: S.Schema<JsonSchemaType, JsonSchemaType, never>;
10
13
  execute: typeof S.Any;
11
14
  }>;
15
+ /**
16
+ * @deprecated Use {@link LLMTool} instead.
17
+ */
12
18
  export type LLMToolDefinition = {
13
19
  name: string;
14
20
  description: string;
15
21
  parameters: JsonSchemaType;
16
22
  execute: (params: unknown, context: ToolExecutionContext) => Promise<LLMToolResult>;
17
23
  };
18
- export type ToolExecutionContext = {};
24
+ declare global {
25
+ /**
26
+ * Extensions to the tool execution context.
27
+ *
28
+ * Different modules can extend this definition to add their own properties.
29
+ *
30
+ * @example
31
+ * ```ts
32
+ * declare global {
33
+ * interface LLMToolContextExtensions {
34
+ * chess: {
35
+ * board: string;
36
+ * };
37
+ * }
38
+ * }
39
+ * ```
40
+ *
41
+ * @see https://www.typescriptlang.org/docs/handbook/declaration-merging.html#global-augmentation
42
+ */
43
+ interface LLMToolContextExtensions {
44
+ }
45
+ }
46
+ export type ToolExecutionContext = {
47
+ extensions: LLMToolContextExtensions;
48
+ };
19
49
  export type LLMToolResult = {
20
50
  kind: 'success';
21
51
  result: unknown;
52
+ extractContentBlocks?: MessageContentBlock[];
22
53
  } | {
23
54
  kind: 'error';
24
55
  message: string;
@@ -31,7 +62,7 @@ export declare const LLMToolResult: Readonly<{
31
62
  * The tool execution was successful.
32
63
  * Gives the result back to the LLM.
33
64
  */
34
- Success: (result: unknown) => LLMToolResult;
65
+ Success: (result: unknown, extractContentBlocks?: MessageContentBlock[]) => LLMToolResult;
35
66
  Error: (message: string) => LLMToolResult;
36
67
  /**
37
68
  * Stop the conversation and return the result.
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/conversation/types.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,MAAM,IAAI,CAAC,EAAE,MAAM,gBAAgB,CAAC;AAG7C,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AACnD,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AAG1C,OAAO,EAAE,QAAQ,EAAE,KAAK,OAAO,EAAE,MAAM,eAAe,CAAC;AAEvD,eAAO,MAAM,iBAAiB,YAAa,OAAO,YAAY,QAAQ,QAAQ,MAAM,KAAG,OAMrF,CAAC;AAEH,eAAO,MAAM,iBAAiB;;;;;EAK5B,CAAC;AAEH,MAAM,MAAM,iBAAiB,GAAG;IAC9B,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,UAAU,EAAE,cAAc,CAAC;IAC3B,OAAO,EAAE,CAAC,MAAM,EAAE,OAAO,EAAE,OAAO,EAAE,oBAAoB,KAAK,OAAO,CAAC,aAAa,CAAC,CAAC;CACrF,CAAC;AAEF,MAAM,MAAM,oBAAoB,GAAG,EAAE,CAAC;AAEtC,MAAM,MAAM,aAAa,GACrB;IAAE,IAAI,EAAE,SAAS,CAAC;IAAC,MAAM,EAAE,OAAO,CAAA;CAAE,GACp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,CAAC,CAAC,MAAM,CAAC,YAAY,2CAK5D,gBAAgB,CAAC,MAAM,CAAC,KAAG,iBAU7B,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"combinators.d.ts","sourceRoot":"","sources":["../../../../src/cypher/combinators.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EACV,WAAW,EAEX,YAAY,EAEZ,UAAU,EACV,WAAW,EAEX,WAAW,EACX,UAAU,EACV,QAAQ,EACR,mBAAmB,EACnB,YAAY,EAEZ,WAAW,EACZ,MAAM,OAAO,CAAC;AAEf,OAAO,EAAE,OAAO,EAA2B,MAAM,SAAS,CAAC;AAgB3D,eAAO,MAAM,UAAU,qBAEtB,CAAC;AAUF,eAAO,MAAM,KAAK,qBAAwD,CAAC;AAC3E,eAAO,MAAM,QAAQ,mBAGpB,CAAC;AACF,eAAO,MAAM,UAAU,qBAItB,CAAC;AACF,eAAO,MAAM,WAAW,sBAQvB,CAAC;AAEF,eAAO,MAAM,mBAAmB,8BAa/B,CAAC;AAOF,eAAO,MAAM,YAAY,uBAIxB,CAAC;AAEF,eAAO,MAAM,WAAW,sBAIvB,CAAC;AAYF,eAAO,MAAM,WAAW,sBAOvB,CAAC;AAEF,eAAO,MAAM,YAAY,uBAaxB,CAAC;AAEF,eAAO,MAAM,WAAW,sBAUvB,CAAC"}
1
+ {"version":3,"file":"combinators.d.ts","sourceRoot":"","sources":["../../../../src/cypher/combinators.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EACV,WAAW,EAEX,YAAY,EAEZ,UAAU,EACV,WAAW,EAEX,WAAW,EACX,UAAU,EACV,QAAQ,EACR,mBAAmB,EACnB,YAAY,EAEZ,WAAW,EACZ,MAAM,OAAO,CAAC;AACf,OAAO,EAAE,OAAO,EAA2B,MAAM,SAAS,CAAC;AAgB3D,eAAO,MAAM,UAAU,qBAEtB,CAAC;AAUF,eAAO,MAAM,KAAK,qBAAwD,CAAC;AAC3E,eAAO,MAAM,QAAQ,mBAGpB,CAAC;AACF,eAAO,MAAM,UAAU,qBAItB,CAAC;AACF,eAAO,MAAM,WAAW,sBAQvB,CAAC;AAEF,eAAO,MAAM,mBAAmB,8BAa/B,CAAC;AAOF,eAAO,MAAM,YAAY,uBAIxB,CAAC;AAEF,eAAO,MAAM,WAAW,sBAIvB,CAAC;AAYF,eAAO,MAAM,WAAW,sBAOvB,CAAC;AAEF,eAAO,MAAM,YAAY,uBAaxB,CAAC;AAEF,eAAO,MAAM,WAAW,sBAUvB,CAAC"}
@@ -1,4 +1,4 @@
1
- import { parjsCombinators, parjs } from '#parjs';
2
1
  import type { Parjser } from 'parjs';
2
+ import { parjsCombinators, parjs } from '#parjs';
3
3
  export { type Parjser, parjsCombinators, parjs };
4
4
  //# sourceMappingURL=parjs.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"parjs.d.ts","sourceRoot":"","sources":["../../../../src/cypher/parjs.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,gBAAgB,EAAE,KAAK,EAAE,MAAM,QAAQ,CAAC;AAEjD,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,OAAO,CAAC;AAErC,OAAO,EAAE,KAAK,OAAO,EAAE,gBAAgB,EAAE,KAAK,EAAE,CAAC"}
1
+ {"version":3,"file":"parjs.d.ts","sourceRoot":"","sources":["../../../../src/cypher/parjs.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,OAAO,CAAC;AAErC,OAAO,EAAE,gBAAgB,EAAE,KAAK,EAAE,MAAM,QAAQ,CAAC;AAEjD,OAAO,EAAE,KAAK,OAAO,EAAE,gBAAgB,EAAE,KAAK,EAAE,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../../../../src/cypher/schema.ts"],"names":[],"mappings":"AAKA,OAAO,EAA2B,KAAK,cAAc,EAAE,MAAM,mBAAmB,CAAC;AAKjF;;;;;GAKG;AACH,eAAO,MAAM,sBAAsB,gBAAiB,cAAc,EAAE,KAAG,MAAM,EAK5E,CAAC;AAkDF,eAAO,MAAM,eAAe,aAAc,MAAM,WAE/C,CAAC;AAEF,eAAO,MAAM,+BAA+B,aAAc,MAAM,YAAY,MAAM,WAGjF,CAAC;AAEF,eAAO,MAAM,WAAW,WAAY,cAAc,YACoE,CAAC"}
1
+ {"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../../../../src/cypher/schema.ts"],"names":[],"mappings":"AAKA,OAAO,EAA2B,KAAK,cAAc,EAAE,MAAM,mBAAmB,CAAC;AAIjF;;;;;GAKG;AACH,eAAO,MAAM,sBAAsB,gBAAiB,cAAc,EAAE,KAAG,MAAM,EAK5E,CAAC;AAkDF,eAAO,MAAM,eAAe,aAAc,MAAM,WAE/C,CAAC;AAEF,eAAO,MAAM,+BAA+B,aAAc,MAAM,YAAY,MAAM,WAGjF,CAAC;AAEF,eAAO,MAAM,WAAW,WAAY,cAAc,YACoE,CAAC"}
@@ -0,0 +1 @@
1
+ //# sourceMappingURL=artifacts.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"artifacts.test.d.ts","sourceRoot":"","sources":["../../../../src/testing/artifacts.test.ts"],"names":[],"mappings":""}
@@ -0,0 +1,2 @@
1
+ export declare const DATA_MESSAGES: string[];
2
+ //# sourceMappingURL=data.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"data.d.ts","sourceRoot":"","sources":["../../../../src/testing/data.ts"],"names":[],"mappings":"AAIA,eAAO,MAAM,aAAa,UAQzB,CAAC"}
@@ -0,0 +1,5 @@
1
+ export declare const AI_SERVICE_ENDPOINT: {
2
+ LOCAL: string;
3
+ REMOTE: string;
4
+ };
5
+ //# sourceMappingURL=defs.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"defs.d.ts","sourceRoot":"","sources":["../../../../src/testing/defs.ts"],"names":[],"mappings":"AAIA,eAAO,MAAM,mBAAmB;;;CAG/B,CAAC"}
@@ -1,3 +1,4 @@
1
+ export * from './defs';
1
2
  export * from './logger';
2
3
  export * from './query-promts';
3
4
  export * from './test-data';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/testing/index.ts"],"names":[],"mappings":"AAIA,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,gBAAgB,CAAC;AAC/B,cAAc,aAAa,CAAC;AAC5B,cAAc,eAAe,CAAC"}
@@ -1,7 +1,7 @@
1
1
  import { type Schema as S } from '@effect/schema';
2
+ import type { EchoDatabase } from '@dxos/echo-db';
2
3
  import { type JsonSchemaType } from '@dxos/echo-schema';
3
4
  import { type DataSource, type Node, type Relationship } from '../cypher';
4
- import type { EchoDatabase } from '@dxos/echo-db';
5
5
  export declare const seedTestData: (db: EchoDatabase) => void;
6
6
  export declare const createTestData: () => MockDataSource;
7
7
  export declare class MockDataSource implements DataSource {
@@ -1 +1 @@
1
- {"version":3,"file":"test-data.d.ts","sourceRoot":"","sources":["../../../../src/testing/test-data.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,KAAK,MAAM,IAAI,CAAC,EAAE,MAAM,gBAAgB,CAAC;AAGlD,OAAO,EAAmD,KAAK,cAAc,EAAY,MAAM,mBAAmB,CAAC;AAInH,OAAO,EACL,KAAK,UAAU,EACf,KAAK,IAAI,EACT,KAAK,YAAY,EAGlB,MAAM,WAAW,CAAC;AAEnB,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAElD,eAAO,MAAM,YAAY,OAAQ,YAAY,SAoH5C,CAAC;AAGF,eAAO,MAAM,cAAc,QAAO,cAuGjC,CAAC;AAEF,qBAAa,cAAe,YAAW,UAAU;IAC/C,OAAO,EAAE,M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AE,MAAM,CACb,MAAM,EACN;QACE,MAAM,EAAE,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC;QACrB,OAAO,EAAE,MAAM,CAAC;QAChB,EAAE,EAAE,MAAM,CAAC;QACX,IAAI,EAAE,OAAO,CAAC;KACf,CACF,CAAM;IAEP,MAAM,EAAE,MAAM,CACZ,MAAM,EACN;QACE,IAAI,EAAE,cAAc,CAAC;QACrB,QAAQ,EAAE,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC;KACxB,CACF,CAAM;IAEP,KAAK,EAAE,IAAI,EAAE,CAAM;IACnB,aAAa,EAAE,YAAY,EAAE,CAAM;IAE7B,QAAQ,CAAC,EAAE,KAAK,EAAE,EAAE;QAAE,KAAK,CAAC,EAAE,MAAM,CAAA;KAAE;IAItC,gBAAgB,CAAC,EAAE,KAAK,EAAE,EAAE;QAAE,KAAK,CAAC,EAAE,MAAM,CAAA;KAAE;IAIpD,GAAG,CAAC,CAAC,SAAS,CAAC,CAAC,MAAM,CAAC,GAAG,EAAE,MAAM,EAAE,CAAC,EAAE,IAAI,EAAE,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC;IAsB7D,YAAY;CAoEb"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dxos/assistant",
3
- "version": "0.7.4-df37807",
3
+ "version": "0.7.5-feature-compute.4d9d99a",
4
4
  "description": "Natural language interface to DXOS",
5
5
  "homepage": "https://dxos.org",
6
6
  "bugs": "https://github.com/dxos/dxos/issues",
@@ -33,26 +33,25 @@
33
33
  "types": "dist/types/src/index.d.ts",
34
34
  "files": [
35
35
  "dist",
36
+ "vendor",
36
37
  "src"
37
38
  ],
38
- "scripts": {
39
- "run:chat": "tsx src/bin/chat.ts"
40
- },
41
39
  "dependencies": {
42
- "@dxos/async": "workspace:*",
43
- "@dxos/context": "workspace:*",
44
- "@dxos/debug": "workspace:*",
45
- "@dxos/echo-db": "workspace:*",
46
- "@dxos/echo-schema": "workspace:*",
47
- "@dxos/invariant": "workspace:*",
48
- "@dxos/keys": "workspace:*",
49
- "@dxos/live-object": "workspace:*",
50
- "@dxos/log": "workspace:*",
51
- "@dxos/node-std": "workspace:*",
52
- "@dxos/util": "workspace:*",
53
40
  "@effect/schema": "^0.75.5",
54
41
  "parjs": "^1.3.9",
55
- "ulidx": "^2.3.0"
42
+ "saxes": "^6.0.0",
43
+ "ulidx": "^2.3.0",
44
+ "@dxos/async": "0.7.5-feature-compute.4d9d99a",
45
+ "@dxos/context": "0.7.5-feature-compute.4d9d99a",
46
+ "@dxos/debug": "0.7.5-feature-compute.4d9d99a",
47
+ "@dxos/echo-db": "0.7.5-feature-compute.4d9d99a",
48
+ "@dxos/echo-schema": "0.7.5-feature-compute.4d9d99a",
49
+ "@dxos/invariant": "0.7.5-feature-compute.4d9d99a",
50
+ "@dxos/keys": "0.7.5-feature-compute.4d9d99a",
51
+ "@dxos/live-object": "0.7.5-feature-compute.4d9d99a",
52
+ "@dxos/log": "0.7.5-feature-compute.4d9d99a",
53
+ "@dxos/node-std": "0.7.5-feature-compute.4d9d99a",
54
+ "@dxos/util": "0.7.5-feature-compute.4d9d99a"
56
55
  },
57
56
  "devDependencies": {
58
57
  "inquirer": "^12.0.0"
@@ -60,5 +59,8 @@
60
59
  "publishConfig": {
61
60
  "access": "restricted"
62
61
  },
63
- "beast": {}
64
- }
62
+ "beast": {},
63
+ "scripts": {
64
+ "run:chat": "tsx src/bin/chat.ts"
65
+ }
66
+ }
@@ -5,26 +5,27 @@
5
5
  import { Schema as S } from '@effect/schema';
6
6
  import { test, describe } from 'vitest';
7
7
 
8
- import { toJsonSchema } from '@dxos/echo-schema';
8
+ import { toJsonSchema, ObjectId } from '@dxos/echo-schema';
9
9
  import { invariant } from '@dxos/invariant';
10
10
  import { SpaceId } from '@dxos/keys';
11
11
  import { log } from '@dxos/log';
12
12
 
13
13
  import { AIServiceClientImpl } from './client';
14
- import { ObjectId, ToolTypes, type LLMTool } from './schema';
14
+ import { ToolTypes, type LLMTool } from './types';
15
+ import { AI_SERVICE_ENDPOINT } from '../testing';
15
16
 
16
- const ENDPOINT = 'http://localhost:8787';
17
+ // log.config({ filter: 'debug' });
17
18
 
18
19
  describe('AI Service Client', () => {
19
20
  test('client generation', async () => {
20
21
  const client = new AIServiceClientImpl({
21
- endpoint: ENDPOINT,
22
+ endpoint: AI_SERVICE_ENDPOINT.LOCAL,
22
23
  });
23
24
 
24
25
  const spaceId = SpaceId.random();
25
26
  const threadId = ObjectId.random();
26
27
 
27
- await client.insertMessages([
28
+ await client.appendMessages([
28
29
  {
29
30
  id: ObjectId.random(),
30
31
  spaceId,
@@ -42,17 +43,17 @@ describe('AI Service Client', () => {
42
43
  tools: [],
43
44
  });
44
45
  for await (const event of stream) {
45
- log.info('event', event);
46
+ log('event', event);
46
47
  }
47
48
 
48
- log.info('full message', {
49
+ log('full message', {
49
50
  message: await stream.complete(),
50
51
  });
51
52
  });
52
53
 
53
54
  test('tool calls', async () => {
54
55
  const client = new AIServiceClientImpl({
55
- endpoint: ENDPOINT,
56
+ endpoint: AI_SERVICE_ENDPOINT.LOCAL,
56
57
  });
57
58
 
58
59
  const custodian: LLMTool = {
@@ -68,7 +69,7 @@ describe('AI Service Client', () => {
68
69
  const spaceId = SpaceId.random();
69
70
  const threadId = ObjectId.random();
70
71
 
71
- await client.insertMessages([
72
+ await client.appendMessages([
72
73
  {
73
74
  id: ObjectId.random(),
74
75
  spaceId,
@@ -86,17 +87,15 @@ describe('AI Service Client', () => {
86
87
  tools: [custodian],
87
88
  });
88
89
  for await (const event of stream) {
89
- log.info('event', event);
90
+ log('event', event);
90
91
  }
91
92
  const [message] = await stream.complete();
92
- log.info('full message', {
93
- message,
94
- });
95
- await client.insertMessages([message]);
93
+ log('full message', { message });
94
+ await client.appendMessages([message]);
96
95
 
97
96
  const toolUse = message.content.find(({ type }) => type === 'tool_use')!;
98
97
  invariant(toolUse.type === 'tool_use');
99
- await client.insertMessages([
98
+ await client.appendMessages([
100
99
  {
101
100
  id: ObjectId.random(),
102
101
  spaceId,
@@ -114,23 +113,21 @@ describe('AI Service Client', () => {
114
113
  tools: [custodian],
115
114
  });
116
115
  for await (const event of stream2) {
117
- log.info('event', event);
116
+ log('event', event);
118
117
  }
119
118
  const [message2] = await stream2.complete();
120
- log.info('full message', {
121
- message: message2,
122
- });
119
+ log('full message', { message: message2 });
123
120
  });
124
121
 
125
- test.only('image generation', async () => {
122
+ test.skip('image generation', async () => {
126
123
  const client = new AIServiceClientImpl({
127
- endpoint: ENDPOINT,
124
+ endpoint: AI_SERVICE_ENDPOINT.LOCAL,
128
125
  });
129
126
 
130
127
  const spaceId = SpaceId.random();
131
128
  const threadId = ObjectId.random();
132
129
 
133
- await client.insertMessages([
130
+ await client.appendMessages([
134
131
  {
135
132
  id: ObjectId.random(),
136
133
  spaceId,
@@ -148,15 +145,17 @@ describe('AI Service Client', () => {
148
145
  {
149
146
  name: 'text-to-image',
150
147
  type: ToolTypes.TextToImage,
148
+ // options: {
149
+ // model: '@cf/stabilityai/stable-diffusion-xl-base-1.0',
150
+ // },
151
151
  },
152
152
  ],
153
153
  });
154
+
154
155
  for await (const event of stream) {
155
- log.info('event', event);
156
+ log('event', event);
156
157
  }
157
158
 
158
- log.info('full message', {
159
- message: await stream.complete(),
160
- });
159
+ log('full message', { message: await stream.complete() });
161
160
  });
162
161
  });