@dxos/assistant 0.8.4-main.bc674ce → 0.8.4-main.bcb3aa67d6

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 (121) hide show
  1. package/README.md +1 -0
  2. package/dist/lib/neutral/chunk-KVYJFFLF.mjs +1805 -0
  3. package/dist/lib/neutral/chunk-KVYJFFLF.mjs.map +7 -0
  4. package/dist/lib/{browser → neutral}/extraction/index.mjs +26 -32
  5. package/dist/lib/neutral/extraction/index.mjs.map +7 -0
  6. package/dist/lib/{browser → neutral}/index.mjs +72 -371
  7. package/dist/lib/neutral/index.mjs.map +7 -0
  8. package/dist/lib/neutral/meta.json +1 -0
  9. package/dist/lib/neutral/testing/index.mjs +112 -0
  10. package/dist/lib/neutral/testing/index.mjs.map +7 -0
  11. package/dist/types/src/conversation/context.d.ts +24 -5
  12. package/dist/types/src/conversation/context.d.ts.map +1 -1
  13. package/dist/types/src/conversation/conversation.d.ts +29 -4
  14. package/dist/types/src/conversation/conversation.d.ts.map +1 -1
  15. package/dist/types/src/diff.d.ts +3 -1
  16. package/dist/types/src/diff.d.ts.map +1 -1
  17. package/dist/types/src/extraction/extraction-ner-function/index.d.ts +0 -1
  18. package/dist/types/src/extraction/extraction-ner-function/index.d.ts.map +1 -1
  19. package/dist/types/src/extraction/extraction.d.ts +729 -17
  20. package/dist/types/src/extraction/extraction.d.ts.map +1 -1
  21. package/dist/types/src/extraction/index.d.ts +0 -1
  22. package/dist/types/src/extraction/index.d.ts.map +1 -1
  23. package/dist/types/src/functions/services.d.ts +27 -8
  24. package/dist/types/src/functions/services.d.ts.map +1 -1
  25. package/dist/types/src/index.d.ts +2 -0
  26. package/dist/types/src/index.d.ts.map +1 -1
  27. package/dist/types/src/service/AgentService.d.ts +62 -0
  28. package/dist/types/src/service/AgentService.d.ts.map +1 -0
  29. package/dist/types/src/service/AgentService.test.d.ts +2 -0
  30. package/dist/types/src/service/AgentService.test.d.ts.map +1 -0
  31. package/dist/types/src/service/agent-process.d.ts +17 -0
  32. package/dist/types/src/service/agent-process.d.ts.map +1 -0
  33. package/dist/types/src/service/index.d.ts +3 -0
  34. package/dist/types/src/service/index.d.ts.map +1 -0
  35. package/dist/types/src/session/index.d.ts +1 -1
  36. package/dist/types/src/session/index.d.ts.map +1 -1
  37. package/dist/types/src/session/observer.d.ts.map +1 -1
  38. package/dist/types/src/session/session.d.ts +64 -8
  39. package/dist/types/src/session/session.d.ts.map +1 -1
  40. package/dist/types/src/session/toolkit.d.ts +6 -2
  41. package/dist/types/src/session/toolkit.d.ts.map +1 -1
  42. package/dist/types/src/templates/system.d.ts +0 -1
  43. package/dist/types/src/templates/system.d.ts.map +1 -1
  44. package/dist/types/src/testing/layer.d.ts +23 -9
  45. package/dist/types/src/testing/layer.d.ts.map +1 -1
  46. package/dist/types/src/tracing.d.ts +264 -0
  47. package/dist/types/src/tracing.d.ts.map +1 -0
  48. package/dist/types/src/types/artifact.d.ts +5 -5
  49. package/dist/types/src/types/artifact.d.ts.map +1 -1
  50. package/dist/types/tsconfig.tsbuildinfo +1 -1
  51. package/package.json +33 -33
  52. package/src/conversation/context.test.ts +1 -1
  53. package/src/conversation/context.ts +84 -18
  54. package/src/conversation/conversation.ts +173 -32
  55. package/src/diff.test.ts +36 -5
  56. package/src/diff.ts +13 -4
  57. package/src/execution-graph.test.ts +2 -2
  58. package/src/execution-graph.ts +2 -2
  59. package/src/extraction/extraction-ner-function/index.ts +0 -1
  60. package/src/extraction/extraction.ts +38 -10
  61. package/src/extraction/index.ts +0 -1
  62. package/src/functions/services.ts +199 -50
  63. package/src/functions.conversations.json +1 -1
  64. package/src/functions.test.ts +28 -20
  65. package/src/index.ts +2 -0
  66. package/src/service/AgentService.conversations.json +1 -0
  67. package/src/service/AgentService.test.ts +169 -0
  68. package/src/service/AgentService.ts +171 -0
  69. package/src/service/agent-process.ts +360 -0
  70. package/src/service/index.ts +6 -0
  71. package/src/session/format.test.ts +23 -14
  72. package/src/session/index.ts +1 -2
  73. package/src/session/observer.ts +3 -2
  74. package/src/session/session.conversations.json +1 -1
  75. package/src/session/session.test.ts +52 -4
  76. package/src/session/session.ts +231 -117
  77. package/src/session/toolkit.ts +12 -7
  78. package/src/templates/instructions/format.tpl +0 -4
  79. package/src/templates/instructions/system.tpl +11 -2
  80. package/src/templates/system.ts +6 -5
  81. package/src/testing/layer.ts +209 -24
  82. package/src/tracing.ts +112 -0
  83. package/src/types/artifact.ts +17 -10
  84. package/dist/lib/browser/chunk-7CDDG6LL.mjs +0 -578
  85. package/dist/lib/browser/chunk-7CDDG6LL.mjs.map +0 -7
  86. package/dist/lib/browser/extraction/index.mjs.map +0 -7
  87. package/dist/lib/browser/index.mjs.map +0 -7
  88. package/dist/lib/browser/meta.json +0 -1
  89. package/dist/lib/browser/testing/index.mjs +0 -32
  90. package/dist/lib/browser/testing/index.mjs.map +0 -7
  91. package/dist/lib/node-esm/chunk-CC7ER6Q3.mjs +0 -579
  92. package/dist/lib/node-esm/chunk-CC7ER6Q3.mjs.map +0 -7
  93. package/dist/lib/node-esm/chunk-HSLMI22Q.mjs +0 -11
  94. package/dist/lib/node-esm/chunk-HSLMI22Q.mjs.map +0 -7
  95. package/dist/lib/node-esm/extraction/index.mjs +0 -226
  96. package/dist/lib/node-esm/extraction/index.mjs.map +0 -7
  97. package/dist/lib/node-esm/index.mjs +0 -851
  98. package/dist/lib/node-esm/index.mjs.map +0 -7
  99. package/dist/lib/node-esm/meta.json +0 -1
  100. package/dist/lib/node-esm/testing/index.mjs +0 -33
  101. package/dist/lib/node-esm/testing/index.mjs.map +0 -7
  102. package/dist/types/src/extraction/extraction-llm-function/extraction-llm-function.d.ts +0 -4
  103. package/dist/types/src/extraction/extraction-llm-function/extraction-llm-function.d.ts.map +0 -1
  104. package/dist/types/src/extraction/extraction-llm-function/extraction-llm-function.test.d.ts +0 -2
  105. package/dist/types/src/extraction/extraction-llm-function/extraction-llm-function.test.d.ts.map +0 -1
  106. package/dist/types/src/extraction/extraction-llm-function/index.d.ts +0 -2
  107. package/dist/types/src/extraction/extraction-llm-function/index.d.ts.map +0 -1
  108. package/dist/types/src/extraction/extraction-ner-function/extraction-ner-function.d.ts +0 -347
  109. package/dist/types/src/extraction/extraction-ner-function/extraction-ner-function.d.ts.map +0 -1
  110. package/dist/types/src/extraction/extraction-ner-function/extraction-ner-function.test.d.ts +0 -2
  111. package/dist/types/src/extraction/extraction-ner-function/extraction-ner-function.test.d.ts.map +0 -1
  112. package/dist/types/src/session/GenericToolkit.d.ts +0 -85
  113. package/dist/types/src/session/GenericToolkit.d.ts.map +0 -1
  114. package/src/extraction/extraction-llm-function/extraction-llm-function.test.ts +0 -84
  115. package/src/extraction/extraction-llm-function/extraction-llm-function.ts +0 -62
  116. package/src/extraction/extraction-llm-function/index.ts +0 -5
  117. package/src/extraction/extraction-ner-function/extraction-ner-function.test.ts +0 -116
  118. package/src/extraction/extraction-ner-function/extraction-ner-function.ts +0 -56
  119. package/src/session/GenericToolkit.ts +0 -131
  120. /package/dist/lib/{browser → neutral}/chunk-J5LGTIGS.mjs +0 -0
  121. /package/dist/lib/{browser → neutral}/chunk-J5LGTIGS.mjs.map +0 -0
@@ -1,347 +0,0 @@
1
- /**
2
- * Named Entity Recognition model
3
- */
4
- export declare const extractionNerFunction: import("@dxos/functions").FunctionDefinition<{
5
- readonly options?: {
6
- readonly timeout?: number | undefined;
7
- readonly fallbackToRaw?: boolean | undefined;
8
- } | undefined;
9
- readonly message: import("@dxos/echo/Entity").OfKind<import("@dxos/echo/internal").EntityKind.Object> & {
10
- readonly id: string;
11
- readonly parentMessage?: string | undefined;
12
- readonly created: string;
13
- readonly sender: {
14
- readonly name?: string | undefined;
15
- readonly role?: "user" | "assistant" | "tool" | undefined;
16
- readonly contact?: import("@dxos/echo/internal").Ref<import("@dxos/echo/Entity").OfKind<import("@dxos/echo/internal").EntityKind.Object> & {
17
- readonly image?: string | undefined;
18
- readonly fullName?: string | undefined;
19
- readonly preferredName?: string | undefined;
20
- readonly nickname?: string | undefined;
21
- readonly organization?: import("@dxos/echo/internal").Ref<import("@dxos/echo/Entity").OfKind<import("@dxos/echo/internal").EntityKind.Object> & {
22
- readonly description?: string | undefined;
23
- readonly name?: string | undefined;
24
- readonly status?: "prospect" | "qualified" | "active" | "commit" | "reject" | undefined;
25
- readonly image?: string | undefined;
26
- readonly website?: string | undefined;
27
- } & {
28
- readonly location?: readonly [number, number, (number | undefined)?] | undefined;
29
- }> | undefined;
30
- readonly jobTitle?: string | undefined;
31
- readonly department?: string | undefined;
32
- readonly notes?: string | undefined;
33
- readonly emails?: readonly {
34
- readonly value: string;
35
- readonly label?: string | undefined;
36
- }[] | undefined;
37
- readonly identities?: readonly {
38
- readonly value: string;
39
- readonly label?: string | undefined;
40
- }[] | undefined;
41
- readonly phoneNumbers?: readonly {
42
- readonly value: string;
43
- readonly label?: string | undefined;
44
- }[] | undefined;
45
- readonly fields?: readonly {
46
- readonly value: string;
47
- readonly label: string;
48
- readonly category?: string | undefined;
49
- }[] | undefined;
50
- readonly addresses?: readonly {
51
- readonly value: {
52
- readonly street?: string | undefined;
53
- readonly extended?: string | undefined;
54
- readonly locality?: string | undefined;
55
- readonly region?: string | undefined;
56
- readonly postalCode?: string | undefined;
57
- readonly postOfficeBoxNumber?: string | undefined;
58
- readonly country?: string | undefined;
59
- };
60
- readonly label?: string | undefined;
61
- }[] | undefined;
62
- readonly urls?: readonly {
63
- readonly value: string;
64
- readonly label?: string | undefined;
65
- }[] | undefined;
66
- readonly birthday?: string | undefined;
67
- } & {
68
- readonly location?: readonly [number, number, (number | undefined)?] | undefined;
69
- }> | undefined;
70
- readonly identityDid?: string | undefined;
71
- readonly identityKey?: string | undefined;
72
- readonly email?: string | undefined;
73
- };
74
- readonly blocks: readonly ({
75
- readonly pending?: boolean | undefined;
76
- readonly text: string;
77
- readonly mimeType?: string | undefined;
78
- readonly disposition?: string | undefined;
79
- readonly _tag: "text";
80
- } | {
81
- readonly pending?: boolean | undefined;
82
- readonly _tag: "reasoning";
83
- readonly reasoningText?: string | undefined;
84
- readonly redactedText?: string | undefined;
85
- readonly signature?: string | undefined;
86
- } | {
87
- readonly name: string;
88
- readonly pending?: boolean | undefined;
89
- readonly _tag: "toolCall";
90
- readonly toolCallId: string;
91
- readonly input: string;
92
- readonly providerExecuted: boolean;
93
- } | {
94
- readonly name: string;
95
- readonly pending?: boolean | undefined;
96
- readonly _tag: "toolResult";
97
- readonly toolCallId: string;
98
- readonly providerExecuted: boolean;
99
- readonly result?: string | undefined;
100
- readonly error?: string | undefined;
101
- } | {
102
- readonly pending?: boolean | undefined;
103
- readonly mimeType?: string | undefined;
104
- readonly _tag: "summary";
105
- readonly message?: string | undefined;
106
- readonly model?: string | undefined;
107
- readonly usage?: {
108
- readonly inputTokens?: number | undefined;
109
- readonly outputTokens?: number | undefined;
110
- readonly totalTokens?: number | undefined;
111
- } | undefined;
112
- readonly toolCalls?: number | undefined;
113
- readonly errors?: number | undefined;
114
- readonly duration?: number | undefined;
115
- } | {
116
- readonly source?: {
117
- readonly type: "base64";
118
- readonly mediaType: string;
119
- readonly data: string;
120
- } | {
121
- readonly type: "http";
122
- readonly url: string;
123
- } | undefined;
124
- readonly id?: string | undefined;
125
- readonly pending?: boolean | undefined;
126
- readonly _tag: "image";
127
- } | {
128
- readonly name?: string | undefined;
129
- readonly pending?: boolean | undefined;
130
- readonly _tag: "file";
131
- readonly mediaType?: string | undefined;
132
- readonly url: string;
133
- } | {
134
- readonly pending?: boolean | undefined;
135
- readonly _tag: "reference";
136
- readonly reference: import("@dxos/echo/internal").Ref<any>;
137
- } | {
138
- readonly pending?: boolean | undefined;
139
- readonly text: string;
140
- readonly _tag: "transcript";
141
- readonly started: string;
142
- } | {
143
- readonly pending?: boolean | undefined;
144
- readonly _tag: "status";
145
- readonly statusText: string;
146
- } | {
147
- readonly pending?: boolean | undefined;
148
- readonly text: string;
149
- readonly _tag: "suggestion";
150
- } | {
151
- readonly pending?: boolean | undefined;
152
- readonly _tag: "select";
153
- readonly options: string[];
154
- } | {
155
- readonly version: unknown;
156
- readonly pending?: boolean | undefined;
157
- readonly _tag: "anchor";
158
- readonly objectId: string;
159
- } | {
160
- readonly pending?: boolean | undefined;
161
- readonly text: string;
162
- readonly _tag: "proposal";
163
- } | {
164
- readonly pending?: boolean | undefined;
165
- readonly _tag: "toolkit";
166
- } | {
167
- readonly pending?: boolean | undefined;
168
- readonly disposition?: string | undefined;
169
- readonly _tag: "json";
170
- readonly data: string;
171
- })[];
172
- readonly properties?: {
173
- readonly [x: string]: any;
174
- } | undefined;
175
- };
176
- readonly objects?: readonly any[] | undefined;
177
- }, {
178
- readonly message: import("@dxos/echo/Entity").OfKind<import("@dxos/echo/internal").EntityKind.Object> & {
179
- readonly id: string;
180
- readonly parentMessage?: string | undefined;
181
- readonly created: string;
182
- readonly sender: {
183
- readonly name?: string | undefined;
184
- readonly role?: "user" | "assistant" | "tool" | undefined;
185
- readonly contact?: import("@dxos/echo/internal").Ref<import("@dxos/echo/Entity").OfKind<import("@dxos/echo/internal").EntityKind.Object> & {
186
- readonly image?: string | undefined;
187
- readonly fullName?: string | undefined;
188
- readonly preferredName?: string | undefined;
189
- readonly nickname?: string | undefined;
190
- readonly organization?: import("@dxos/echo/internal").Ref<import("@dxos/echo/Entity").OfKind<import("@dxos/echo/internal").EntityKind.Object> & {
191
- readonly description?: string | undefined;
192
- readonly name?: string | undefined;
193
- readonly status?: "prospect" | "qualified" | "active" | "commit" | "reject" | undefined;
194
- readonly image?: string | undefined;
195
- readonly website?: string | undefined;
196
- } & {
197
- readonly location?: readonly [number, number, (number | undefined)?] | undefined;
198
- }> | undefined;
199
- readonly jobTitle?: string | undefined;
200
- readonly department?: string | undefined;
201
- readonly notes?: string | undefined;
202
- readonly emails?: readonly {
203
- readonly value: string;
204
- readonly label?: string | undefined;
205
- }[] | undefined;
206
- readonly identities?: readonly {
207
- readonly value: string;
208
- readonly label?: string | undefined;
209
- }[] | undefined;
210
- readonly phoneNumbers?: readonly {
211
- readonly value: string;
212
- readonly label?: string | undefined;
213
- }[] | undefined;
214
- readonly fields?: readonly {
215
- readonly value: string;
216
- readonly label: string;
217
- readonly category?: string | undefined;
218
- }[] | undefined;
219
- readonly addresses?: readonly {
220
- readonly value: {
221
- readonly street?: string | undefined;
222
- readonly extended?: string | undefined;
223
- readonly locality?: string | undefined;
224
- readonly region?: string | undefined;
225
- readonly postalCode?: string | undefined;
226
- readonly postOfficeBoxNumber?: string | undefined;
227
- readonly country?: string | undefined;
228
- };
229
- readonly label?: string | undefined;
230
- }[] | undefined;
231
- readonly urls?: readonly {
232
- readonly value: string;
233
- readonly label?: string | undefined;
234
- }[] | undefined;
235
- readonly birthday?: string | undefined;
236
- } & {
237
- readonly location?: readonly [number, number, (number | undefined)?] | undefined;
238
- }> | undefined;
239
- readonly identityDid?: string | undefined;
240
- readonly identityKey?: string | undefined;
241
- readonly email?: string | undefined;
242
- };
243
- readonly blocks: readonly ({
244
- readonly pending?: boolean | undefined;
245
- readonly text: string;
246
- readonly mimeType?: string | undefined;
247
- readonly disposition?: string | undefined;
248
- readonly _tag: "text";
249
- } | {
250
- readonly pending?: boolean | undefined;
251
- readonly _tag: "reasoning";
252
- readonly reasoningText?: string | undefined;
253
- readonly redactedText?: string | undefined;
254
- readonly signature?: string | undefined;
255
- } | {
256
- readonly name: string;
257
- readonly pending?: boolean | undefined;
258
- readonly _tag: "toolCall";
259
- readonly toolCallId: string;
260
- readonly input: string;
261
- readonly providerExecuted: boolean;
262
- } | {
263
- readonly name: string;
264
- readonly pending?: boolean | undefined;
265
- readonly _tag: "toolResult";
266
- readonly toolCallId: string;
267
- readonly providerExecuted: boolean;
268
- readonly result?: string | undefined;
269
- readonly error?: string | undefined;
270
- } | {
271
- readonly pending?: boolean | undefined;
272
- readonly mimeType?: string | undefined;
273
- readonly _tag: "summary";
274
- readonly message?: string | undefined;
275
- readonly model?: string | undefined;
276
- readonly usage?: {
277
- readonly inputTokens?: number | undefined;
278
- readonly outputTokens?: number | undefined;
279
- readonly totalTokens?: number | undefined;
280
- } | undefined;
281
- readonly toolCalls?: number | undefined;
282
- readonly errors?: number | undefined;
283
- readonly duration?: number | undefined;
284
- } | {
285
- readonly source?: {
286
- readonly type: "base64";
287
- readonly mediaType: string;
288
- readonly data: string;
289
- } | {
290
- readonly type: "http";
291
- readonly url: string;
292
- } | undefined;
293
- readonly id?: string | undefined;
294
- readonly pending?: boolean | undefined;
295
- readonly _tag: "image";
296
- } | {
297
- readonly name?: string | undefined;
298
- readonly pending?: boolean | undefined;
299
- readonly _tag: "file";
300
- readonly mediaType?: string | undefined;
301
- readonly url: string;
302
- } | {
303
- readonly pending?: boolean | undefined;
304
- readonly _tag: "reference";
305
- readonly reference: import("@dxos/echo/internal").Ref<any>;
306
- } | {
307
- readonly pending?: boolean | undefined;
308
- readonly text: string;
309
- readonly _tag: "transcript";
310
- readonly started: string;
311
- } | {
312
- readonly pending?: boolean | undefined;
313
- readonly _tag: "status";
314
- readonly statusText: string;
315
- } | {
316
- readonly pending?: boolean | undefined;
317
- readonly text: string;
318
- readonly _tag: "suggestion";
319
- } | {
320
- readonly pending?: boolean | undefined;
321
- readonly _tag: "select";
322
- readonly options: string[];
323
- } | {
324
- readonly version: unknown;
325
- readonly pending?: boolean | undefined;
326
- readonly _tag: "anchor";
327
- readonly objectId: string;
328
- } | {
329
- readonly pending?: boolean | undefined;
330
- readonly text: string;
331
- readonly _tag: "proposal";
332
- } | {
333
- readonly pending?: boolean | undefined;
334
- readonly _tag: "toolkit";
335
- } | {
336
- readonly pending?: boolean | undefined;
337
- readonly disposition?: string | undefined;
338
- readonly _tag: "json";
339
- readonly data: string;
340
- })[];
341
- readonly properties?: {
342
- readonly [x: string]: any;
343
- } | undefined;
344
- };
345
- readonly timeElapsed: number;
346
- }, import("@dxos/functions").FunctionServices>;
347
- //# sourceMappingURL=extraction-ner-function.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"extraction-ner-function.d.ts","sourceRoot":"","sources":["../../../../../src/extraction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CAAC;;;;4BAA6H,CAAC;;;;4BAA2H,CAAC;;;4BAA2F,CAAC;gCAAmD,CAAC;;;;;;;;;8CADtrJ,CAAC"}
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=extraction-ner-function.test.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"extraction-ner-function.test.d.ts","sourceRoot":"","sources":["../../../../../src/extraction/extraction-ner-function/extraction-ner-function.test.ts"],"names":[],"mappings":""}
@@ -1,85 +0,0 @@
1
- import type * as Tool from '@effect/ai/Tool';
2
- import * as Toolkit from '@effect/ai/Toolkit';
3
- import * as Effect from 'effect/Effect';
4
- import * as Layer from 'effect/Layer';
5
- import * as Pipeable from 'effect/Pipeable';
6
- import type * as Schema from 'effect/Schema';
7
- import type * as SchemaAST from 'effect/SchemaAST';
8
- /**
9
- * Unique identifier for generic toolkit instances.
10
- */
11
- export declare const TypeId = "~@dxos/assistant/GenericToolkit";
12
- /**
13
- * Type-level representation of the generic toolkit identifier.
14
- */
15
- export type TypeId = typeof TypeId;
16
- /**
17
- * Type-safe way to define toolkits where we don't know specific types of tools,
18
- * and we want to bundle definition and handlers together.
19
- *
20
- * Usefull for plugin-based systems, where tools are dynamically added.
21
- *
22
- * @param TR requirements type to the tool invocation.
23
- * @param E failure type to the handlers layer.
24
- * @param R requirements type to the handlers layer.
25
- */
26
- export interface GenericToolkit<TR = never, E = never, R = never> extends Pipeable.Pipeable {
27
- readonly [TypeId]: TypeId;
28
- /**
29
- * Toolkit definition.
30
- */
31
- readonly toolkit: Toolkit.Toolkit<GenericTools<TR>>;
32
- /**
33
- * Handlers layer.
34
- */
35
- readonly layer: Layer.Layer<unknown, E, R>;
36
- /**
37
- * Handlers effect.
38
- */
39
- readonly handlers: Effect.Effect<Toolkit.WithHandler<GenericTools<TR>>, E, R>;
40
- }
41
- /**
42
- * Generic constraint.
43
- *
44
- * NOTE: Only use in place of `T extends PortableToolkit.Any`. Not suitable for standalone use.
45
- */
46
- export interface Any {
47
- readonly [TypeId]: TypeId;
48
- readonly toolkit: Toolkit.Toolkit<any>;
49
- readonly layer: Layer.Layer<unknown, any, any>;
50
- }
51
- export type InvocationRequirements<T extends Any> = T extends GenericToolkit<infer TR, infer _E, infer _R> ? TR : never;
52
- export type Failure<T extends Any> = T extends GenericToolkit<infer _TR, infer E, infer _R> ? E : never;
53
- export type Requirements<T extends Any> = T extends GenericToolkit<infer _TR, infer _E, infer R> ? R : never;
54
- /**
55
- * Creates a portable toolkit from toolkit definition and handlers layer.
56
- */
57
- export declare const make: <Tools extends Record<string, Tool.Any>, E, R>(toolkit: Toolkit.Toolkit<Tools>, layer: Layer.Layer<Tool.HandlersFor<Tools>, E, R>) => GenericToolkit<E, R>;
58
- /**
59
- * Merges multiple portable toolkits into a single portable toolkit.
60
- */
61
- export declare const merge: <const Toolkits extends ReadonlyArray<Any>>(
62
- /**
63
- * The toolkits to merge together.
64
- */
65
- ...toolkits: Toolkits) => GenericToolkit<InvocationRequirements<Toolkits[number]>, Failure<Toolkits[number]>, Requirements<Toolkits[number]>>;
66
- /**
67
- * Generic tools type where we cannot statically enumerate individual tools.
68
- */
69
- export type GenericTools<R = never> = Record<string, Tool.Tool<string, {
70
- readonly parameters: AnyStructSchemaNoContext;
71
- readonly success: Schema.Schema.AnyNoContext;
72
- readonly failure: typeof Schema.Never;
73
- readonly failureMode: Tool.FailureMode;
74
- }, R>>;
75
- export interface AnyStructSchemaNoContext extends Pipeable.Pipeable {
76
- readonly [Schema.TypeId]: any;
77
- readonly make: any;
78
- readonly Type: any;
79
- readonly Encoded: any;
80
- readonly Context: never;
81
- readonly ast: SchemaAST.AST;
82
- readonly fields: Schema.Struct.Fields;
83
- readonly annotations: any;
84
- }
85
- //# sourceMappingURL=GenericToolkit.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"GenericToolkit.d.ts","sourceRoot":"","sources":["../../../../src/session/GenericToolkit.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,KAAK,IAAI,MAAM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C,MAAM,EACN,IAAI,CAAC,IAAI,CACP,MAAM,EACN;IACE,QAAQ,CAAC,UAAU,EAAE,wBAAwB,CAAC;IAC9C,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC,MAAM,CAAC,YAAY,CAAC;IAC7C,QAAQ,CAAC,OAAO,EAAE,OAAO,MAAM,CAAC,KAAK,CAAC;IACtC,QAAQ,CAAC,WAAW,EAAE,IAAI,CAAC,WAAW,CAAC;CACxC,EACD,CAAC,CACF,CACF,CAAC;AAEF,MAAM,WAAW,wBAAyB,SAAQ,QAAQ,CAAC,QAAQ;IACjE,QAAQ,CAAC,CAAC,MAAM,CAAC,MAAM,CAAC,EAAE,GAAG,CAAC;IAC9B,QAAQ,CAAC,IAAI,EAAE,GAAG,CAAC;IACnB,QAAQ,CAAC,IAAI,EAAE,GAAG,CAAC;IACnB,QAAQ,CAAC,OAAO,EAAE,GAAG,CAAC;IACtB,QAAQ,CAAC,OAAO,EAAE,KAAK,CAAC;IACxB,QAAQ,CAAC,GAAG,EAAE,SAAS,CAAC,GAAG,CAAC;IAC5B,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC;IACtC,QAAQ,CAAC,WAAW,EAAE,GAAG,CAAC;CAC3B"}
@@ -1,84 +0,0 @@
1
- //
2
- // Copyright 2025 DXOS.org
3
- //
4
-
5
- import { beforeAll, describe, test } from 'vitest';
6
-
7
- import { todo } from '@dxos/debug';
8
- import { FunctionExecutor } from '@dxos/functions-runtime';
9
- import { log } from '@dxos/log';
10
- import { createTestData } from '@dxos/types/testing';
11
- import { range } from '@dxos/util';
12
-
13
- import { processTranscriptMessage } from '../extraction';
14
-
15
- import { extractionAnthropicFunction } from './extraction-llm-function';
16
-
17
- // TODO(burdon): Rewrite test.
18
- describe.skip('LLM EntityExtraction', () => {
19
- let executor: FunctionExecutor;
20
-
21
- beforeAll(async () => {
22
- executor = new FunctionExecutor(todo());
23
- });
24
-
25
- test('should process a transcript block', async () => {
26
- const { transcriptMessages, documents, contacts } = createTestData();
27
- log.info('context', { documents, contacts });
28
-
29
- for (const message of transcriptMessages.slice(0, 1)) {
30
- log.info('input', message);
31
- const { message: enhancedMessage } = await processTranscriptMessage({
32
- input: {
33
- message,
34
- objects: [...documents, ...Object.values(contacts)],
35
- },
36
- function: extractionAnthropicFunction,
37
- executor,
38
- });
39
- log.info('output', enhancedMessage);
40
- }
41
- });
42
-
43
- test('computational irreducibility', async () => {
44
- const { transcriptWoflram, documents, contacts } = createTestData();
45
- log.info('context', { documents, contacts });
46
-
47
- const message = transcriptWoflram[0];
48
- log.info('input', message);
49
-
50
- await Promise.all(
51
- range(10).map(async () => {
52
- const { message: enhancedMessage, timeElapsed } = await processTranscriptMessage({
53
- input: {
54
- message,
55
- objects: [...documents, ...Object.values(contacts)],
56
- },
57
- function: extractionAnthropicFunction,
58
- executor,
59
- });
60
-
61
- log.info('output', { message: enhancedMessage.blocks[0], timeElapsed });
62
- }),
63
- );
64
- });
65
-
66
- test('org and document linking', async () => {
67
- const { transcriptJosiah, documents, contacts, organizations } = createTestData();
68
- log.info('context', { contacts, organizations, documents });
69
-
70
- for (const message of transcriptJosiah) {
71
- log.info('input', message);
72
- const { message: enhancedMessage } = await processTranscriptMessage({
73
- input: {
74
- message,
75
- objects: [...documents, ...Object.values(contacts), ...Object.values(organizations)],
76
- },
77
- function: extractionAnthropicFunction,
78
- executor,
79
- });
80
-
81
- log.info('output', enhancedMessage);
82
- }
83
- });
84
- });
@@ -1,62 +0,0 @@
1
- //
2
- // Copyright 2025 DXOS.org
3
- //
4
-
5
- import { type FunctionDefinition, defineFunction } from '@dxos/functions';
6
-
7
- import { ExtractionInput, ExtractionOutput } from '../extraction';
8
-
9
- export const extractionAnthropicFunction: FunctionDefinition<ExtractionInput, ExtractionOutput> = defineFunction({
10
- key: 'dxos.org/function/extraction/extract-entities',
11
- name: 'Extract Entities',
12
- description: 'Extract entities from the transcript message and add them to the message.',
13
- inputSchema: ExtractionInput,
14
- outputSchema: ExtractionOutput,
15
- handler: async ({ data: { message, objects }, context }) => {
16
- throw new Error('not implemented');
17
- // const startTime = performance.now();
18
- // const ai = context.getService(AiService.AiService);
19
- // const session = new AiSession({ operationModel: 'configured' });
20
- // const result = await session.runStructured(ReferencedQuotes, {
21
- // generationOptions: {
22
- // model: '@anthropic/claude-3-5-haiku-20241022',
23
- // },
24
- // client: ai.client,
25
- // systemPrompt: PROMPT,
26
- // history: [
27
- // Obj.make(DataType.Message.Message, {
28
- // created: new Date().toISOString(),
29
- // sender: { role: 'user' },
30
- // blocks: [
31
- // {
32
- // _tag: 'text',
33
- // text: `<context>${JSON.stringify(objects)}</context>`,
34
- // } satisfies DataType.ContentBlock.Text,
35
- // {
36
- // _tag: 'text',
37
- // text: `<transcript>${JSON.stringify(message.blocks)}</transcript>`,
38
- // } satisfies DataType.ContentBlock.Text,
39
- // ],
40
- // }),
41
- // ],
42
- // artifacts: [],
43
- // prompt: '',
44
- // tools: [],
45
- // } as any); // TODO(burdon): Rewrite test.
46
-
47
- // return {
48
- // timeElapsed: performance.now() - startTime,
49
- // message: create(DataType.Message.Message, {
50
- // ...message,
51
- // blocks: message.blocks.map((block) =>
52
- // block._tag !== 'transcript'
53
- // ? block
54
- // : {
55
- // ...block,
56
- // text: insertReferences(block.text, result),
57
- // },
58
- // ),
59
- // }),
60
- // };
61
- },
62
- });
@@ -1,5 +0,0 @@
1
- //
2
- // Copyright 2025 DXOS.org
3
- //
4
-
5
- export * from './extraction-llm-function';