@dxos/assistant 0.8.4-main.dedc0f3 → 0.8.4-main.e8ec1fe
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.
- package/dist/lib/browser/chunk-J5LGTIGS.mjs +10 -0
- package/dist/lib/browser/extraction/index.mjs +119 -162
- package/dist/lib/browser/extraction/index.mjs.map +4 -4
- package/dist/lib/browser/index.mjs +978 -157
- package/dist/lib/browser/index.mjs.map +4 -4
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/node-esm/chunk-HSLMI22Q.mjs +11 -0
- package/dist/lib/node-esm/extraction/index.mjs +119 -162
- package/dist/lib/node-esm/extraction/index.mjs.map +4 -4
- package/dist/lib/node-esm/index.mjs +978 -157
- package/dist/lib/node-esm/index.mjs.map +4 -4
- package/dist/lib/node-esm/meta.json +1 -1
- package/dist/types/src/conversation/context.d.ts +14 -7
- package/dist/types/src/conversation/context.d.ts.map +1 -1
- package/dist/types/src/conversation/conversation.d.ts +11 -12
- package/dist/types/src/conversation/conversation.d.ts.map +1 -1
- package/dist/types/src/diff.d.ts.map +1 -1
- package/dist/types/src/errors.d.ts +38 -42
- package/dist/types/src/errors.d.ts.map +1 -1
- package/dist/types/src/execution-graph.d.ts +85 -0
- package/dist/types/src/execution-graph.d.ts.map +1 -0
- package/dist/types/src/execution-graph.test.d.ts +2 -0
- package/dist/types/src/execution-graph.test.d.ts.map +1 -0
- package/dist/types/src/extraction/extraction-llm-function/extraction-llm-function.d.ts.map +1 -1
- package/dist/types/src/extraction/extraction-ner-function/extraction-ner-function.d.ts +60 -52
- package/dist/types/src/extraction/extraction-ner-function/extraction-ner-function.d.ts.map +1 -1
- package/dist/types/src/extraction/extraction.d.ts +24 -13
- package/dist/types/src/extraction/extraction.d.ts.map +1 -1
- package/dist/types/src/extraction/quotes.d.ts +1 -1
- package/dist/types/src/extraction/quotes.d.ts.map +1 -1
- package/dist/types/src/functions/services.d.ts +18 -5
- package/dist/types/src/functions/services.d.ts.map +1 -1
- package/dist/types/src/index.d.ts +2 -1
- package/dist/types/src/index.d.ts.map +1 -1
- package/dist/types/src/session/GenericToolkit.d.ts +84 -0
- package/dist/types/src/session/GenericToolkit.d.ts.map +1 -0
- package/dist/types/src/session/artifact-diff.d.ts +2 -2
- package/dist/types/src/session/artifact-diff.d.ts.map +1 -1
- package/dist/types/src/session/error-handling.d.ts +2 -2
- package/dist/types/src/session/error-handling.d.ts.map +1 -1
- package/dist/types/src/session/format.d.ts +4 -174
- package/dist/types/src/session/format.d.ts.map +1 -1
- package/dist/types/src/session/index.d.ts +1 -0
- package/dist/types/src/session/index.d.ts.map +1 -1
- package/dist/types/src/session/observer.d.ts +3 -3
- package/dist/types/src/session/observer.d.ts.map +1 -1
- package/dist/types/src/session/session.d.ts +15 -11
- package/dist/types/src/session/session.d.ts.map +1 -1
- package/dist/types/src/session/toolkit.d.ts +7 -6
- package/dist/types/src/session/toolkit.d.ts.map +1 -1
- package/dist/types/src/session/version-pin.d.ts +3 -3
- package/dist/types/src/session/version-pin.d.ts.map +1 -1
- package/dist/types/src/types/artifact.d.ts +20 -0
- package/dist/types/src/types/artifact.d.ts.map +1 -0
- package/dist/types/src/types/index.d.ts +2 -0
- package/dist/types/src/types/index.d.ts.map +1 -0
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +28 -31
- package/src/conversation/context.ts +49 -17
- package/src/conversation/conversation.ts +28 -23
- package/src/diff.test.ts +3 -3
- package/src/diff.ts +5 -0
- package/src/errors.ts +4 -4
- package/src/execution-graph.test.ts +740 -0
- package/src/execution-graph.ts +509 -0
- package/src/extraction/extraction-llm-function/extraction-llm-function.test.ts +2 -2
- package/src/extraction/extraction-llm-function/extraction-llm-function.ts +46 -54
- package/src/extraction/extraction-ner-function/extraction-ner-function.test.ts +10 -9
- package/src/extraction/extraction-ner-function/extraction-ner-function.ts +38 -44
- package/src/extraction/extraction-ner-function/named-entity-recognition.test.ts +12 -6
- package/src/extraction/extraction.ts +7 -6
- package/src/extraction/quotes.test.ts +2 -2
- package/src/extraction/quotes.ts +3 -3
- package/src/functions/services.ts +93 -50
- package/src/index.ts +2 -1
- package/src/session/GenericToolkit.ts +130 -0
- package/src/session/artifact-diff.ts +2 -2
- package/src/session/error-handling.ts +11 -6
- package/src/session/format.test.ts +5 -4
- package/src/session/format.ts +18 -13
- package/src/session/index.ts +2 -0
- package/src/session/observer.ts +4 -3
- package/src/session/session.conversations.json +1 -0
- package/src/session/session.test.ts +51 -210
- package/src/session/session.ts +40 -28
- package/src/session/toolkit.ts +19 -13
- package/src/session/version-pin.ts +4 -5
- package/src/templates/{format.tpl → instructions/format.tpl} +1 -0
- package/src/templates/{system.tpl → instructions/system.tpl} +10 -12
- package/src/templates/system.ts +2 -2
- package/src/{types.ts → types/artifact.ts} +22 -3
- package/src/types/index.ts +5 -0
- package/dist/lib/browser/chunk-5GJYG2ML.mjs +0 -396
- package/dist/lib/browser/chunk-5GJYG2ML.mjs.map +0 -7
- package/dist/lib/browser/chunk-UB26N5UF.mjs +0 -89
- package/dist/lib/browser/chunk-UB26N5UF.mjs.map +0 -7
- package/dist/lib/browser/named-entity-recognition-QPYHML66.mjs +0 -13
- package/dist/lib/node-esm/chunk-BCFXTNSK.mjs +0 -91
- package/dist/lib/node-esm/chunk-BCFXTNSK.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-FLFCEB4P.mjs +0 -398
- package/dist/lib/node-esm/chunk-FLFCEB4P.mjs.map +0 -7
- package/dist/lib/node-esm/named-entity-recognition-2HDF46YX.mjs +0 -14
- package/dist/types/src/session/version-pin.test.d.ts +0 -2
- package/dist/types/src/session/version-pin.test.d.ts.map +0 -1
- package/dist/types/src/summarization/summarization.test.d.ts +0 -2
- package/dist/types/src/summarization/summarization.test.d.ts.map +0 -1
- package/dist/types/src/types.d.ts +0 -16
- package/dist/types/src/types.d.ts.map +0 -1
- package/src/session/__snapshots__/session.test.ts.snap +0 -32
- package/src/session/version-pin.test.ts +0 -7
- package/src/summarization/summarization.test.ts +0 -197
- /package/dist/lib/browser/{named-entity-recognition-QPYHML66.mjs.map → chunk-J5LGTIGS.mjs.map} +0 -0
- /package/dist/lib/node-esm/{named-entity-recognition-2HDF46YX.mjs.map → chunk-HSLMI22Q.mjs.map} +0 -0
- /package/src/extraction/extraction-llm-function/{instructions.tpl → transcription-instructions.tpl} +0 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"extraction-ner-function.d.ts","sourceRoot":"","sources":["../../../../../src/extraction/extraction-ner-function/extraction-ner-function.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"extraction-ner-function.d.ts","sourceRoot":"","sources":["../../../../../src/extraction/extraction-ner-function/extraction-ner-function.ts"],"names":[],"mappings":"AAQA;;GAEG;AAEH,eAAO,MAAM,qBAAqB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;8CA2ChC,CAAC"}
|
|
@@ -1,24 +1,26 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { Expando } from '@dxos/echo
|
|
3
|
-
import { type FunctionDefinition
|
|
1
|
+
import * as Schema from 'effect/Schema';
|
|
2
|
+
import { Expando } from '@dxos/echo/internal';
|
|
3
|
+
import { type FunctionDefinition } from '@dxos/functions';
|
|
4
|
+
import { type FunctionExecutor } from '@dxos/functions-runtime';
|
|
4
5
|
export declare const ExtractionInput: Schema.Struct<{
|
|
5
6
|
message: import("@dxos/echo/Type").obj<Schema.Struct<{
|
|
6
7
|
id: import("@dxos/keys").ObjectIdClass;
|
|
7
8
|
parentMessage: Schema.optional<import("@dxos/keys").ObjectIdClass>;
|
|
8
9
|
created: Schema.SchemaClass<string, string, never>;
|
|
9
10
|
sender: Schema.mutable<Schema.Struct<{
|
|
10
|
-
contact: Schema.optional<import("@dxos/echo/Type").ref<import("@dxos/echo/Type").obj<Schema.Struct<{
|
|
11
|
+
contact: Schema.optional<import("@dxos/echo/Type").ref<import("@dxos/echo/Type").obj<Schema.extend<Schema.Struct<{
|
|
11
12
|
fullName: Schema.optional<Schema.SchemaClass<string, string, never>>;
|
|
12
13
|
preferredName: Schema.optional<Schema.SchemaClass<string, string, never>>;
|
|
13
14
|
nickname: Schema.optional<Schema.SchemaClass<string, string, never>>;
|
|
14
15
|
image: Schema.optional<Schema.SchemaClass<string, string, never>>;
|
|
15
|
-
organization: Schema.optional<Schema.Schema<import("@dxos/echo
|
|
16
|
-
id: string;
|
|
16
|
+
organization: Schema.optional<Schema.Schema<import("@dxos/echo/internal").Ref<import("@dxos/echo/Type").OfKind<import("@dxos/echo/internal").EntityKind.Object> & {
|
|
17
17
|
description?: string | undefined;
|
|
18
|
+
id: string;
|
|
18
19
|
name?: string | undefined;
|
|
19
20
|
status?: "prospect" | "qualified" | "active" | "commit" | "reject" | undefined;
|
|
20
21
|
image?: string | undefined;
|
|
21
22
|
website?: string | undefined;
|
|
23
|
+
location?: readonly [number, number, (number | undefined)?] | undefined;
|
|
22
24
|
}>, import("@dxos/echo-protocol").EncodedReference, never>>;
|
|
23
25
|
jobTitle: Schema.optional<Schema.SchemaClass<string, string, never>>;
|
|
24
26
|
department: Schema.optional<Schema.SchemaClass<string, string, never>>;
|
|
@@ -57,12 +59,14 @@ export declare const ExtractionInput: Schema.Struct<{
|
|
|
57
59
|
label: typeof Schema.String;
|
|
58
60
|
value: typeof Schema.String;
|
|
59
61
|
}>>>>;
|
|
60
|
-
}
|
|
62
|
+
}>, Schema.Struct<{
|
|
63
|
+
location: Schema.optional<Schema.Tuple<[Schema.filter<Schema.transform<Schema.SchemaClass<number, number, never>, Schema.filter<Schema.SchemaClass<number, number, never>>>>, Schema.filter<Schema.transform<Schema.SchemaClass<number, number, never>, Schema.filter<Schema.SchemaClass<number, number, never>>>>, Schema.Element<typeof Schema.Number, "?">]>>;
|
|
64
|
+
}>>>>>;
|
|
61
65
|
identityDid: Schema.optional<typeof Schema.String>;
|
|
62
66
|
identityKey: Schema.optional<typeof Schema.String>;
|
|
63
67
|
email: Schema.optional<typeof Schema.String>;
|
|
64
68
|
name: Schema.optional<typeof Schema.String>;
|
|
65
|
-
role: Schema.optional<Schema.Literal<["user", "assistant"]>>;
|
|
69
|
+
role: Schema.optional<Schema.Literal<["user", "assistant", "tool"]>>;
|
|
66
70
|
}>>;
|
|
67
71
|
blocks: Schema.mutable<Schema.Array$<Schema.Union<[Schema.mutable<Schema.TaggedStruct<"anchor", {
|
|
68
72
|
pending: Schema.optional<typeof Schema.Boolean>;
|
|
@@ -136,12 +140,14 @@ export declare const ExtractionInput: Schema.Struct<{
|
|
|
136
140
|
toolCallId: typeof Schema.String;
|
|
137
141
|
name: typeof Schema.String;
|
|
138
142
|
input: typeof Schema.String;
|
|
143
|
+
providerExecuted: typeof Schema.Boolean;
|
|
139
144
|
}>>, Schema.mutable<Schema.TaggedStruct<"toolResult", {
|
|
140
145
|
pending: Schema.optional<typeof Schema.Boolean>;
|
|
141
146
|
toolCallId: typeof Schema.String;
|
|
142
147
|
name: typeof Schema.String;
|
|
143
148
|
result: Schema.optional<typeof Schema.String>;
|
|
144
149
|
error: Schema.optional<typeof Schema.String>;
|
|
150
|
+
providerExecuted: typeof Schema.Boolean;
|
|
145
151
|
}>>, Schema.mutable<Schema.TaggedStruct<"transcript", {
|
|
146
152
|
pending: Schema.optional<typeof Schema.Boolean>;
|
|
147
153
|
started: typeof Schema.String;
|
|
@@ -163,18 +169,19 @@ export declare const ExtractionOutput: Schema.Struct<{
|
|
|
163
169
|
parentMessage: Schema.optional<import("@dxos/keys").ObjectIdClass>;
|
|
164
170
|
created: Schema.SchemaClass<string, string, never>;
|
|
165
171
|
sender: Schema.mutable<Schema.Struct<{
|
|
166
|
-
contact: Schema.optional<import("@dxos/echo/Type").ref<import("@dxos/echo/Type").obj<Schema.Struct<{
|
|
172
|
+
contact: Schema.optional<import("@dxos/echo/Type").ref<import("@dxos/echo/Type").obj<Schema.extend<Schema.Struct<{
|
|
167
173
|
fullName: Schema.optional<Schema.SchemaClass<string, string, never>>;
|
|
168
174
|
preferredName: Schema.optional<Schema.SchemaClass<string, string, never>>;
|
|
169
175
|
nickname: Schema.optional<Schema.SchemaClass<string, string, never>>;
|
|
170
176
|
image: Schema.optional<Schema.SchemaClass<string, string, never>>;
|
|
171
|
-
organization: Schema.optional<Schema.Schema<import("@dxos/echo
|
|
172
|
-
id: string;
|
|
177
|
+
organization: Schema.optional<Schema.Schema<import("@dxos/echo/internal").Ref<import("@dxos/echo/Type").OfKind<import("@dxos/echo/internal").EntityKind.Object> & {
|
|
173
178
|
description?: string | undefined;
|
|
179
|
+
id: string;
|
|
174
180
|
name?: string | undefined;
|
|
175
181
|
status?: "prospect" | "qualified" | "active" | "commit" | "reject" | undefined;
|
|
176
182
|
image?: string | undefined;
|
|
177
183
|
website?: string | undefined;
|
|
184
|
+
location?: readonly [number, number, (number | undefined)?] | undefined;
|
|
178
185
|
}>, import("@dxos/echo-protocol").EncodedReference, never>>;
|
|
179
186
|
jobTitle: Schema.optional<Schema.SchemaClass<string, string, never>>;
|
|
180
187
|
department: Schema.optional<Schema.SchemaClass<string, string, never>>;
|
|
@@ -213,12 +220,14 @@ export declare const ExtractionOutput: Schema.Struct<{
|
|
|
213
220
|
label: typeof Schema.String;
|
|
214
221
|
value: typeof Schema.String;
|
|
215
222
|
}>>>>;
|
|
216
|
-
}
|
|
223
|
+
}>, Schema.Struct<{
|
|
224
|
+
location: Schema.optional<Schema.Tuple<[Schema.filter<Schema.transform<Schema.SchemaClass<number, number, never>, Schema.filter<Schema.SchemaClass<number, number, never>>>>, Schema.filter<Schema.transform<Schema.SchemaClass<number, number, never>, Schema.filter<Schema.SchemaClass<number, number, never>>>>, Schema.Element<typeof Schema.Number, "?">]>>;
|
|
225
|
+
}>>>>>;
|
|
217
226
|
identityDid: Schema.optional<typeof Schema.String>;
|
|
218
227
|
identityKey: Schema.optional<typeof Schema.String>;
|
|
219
228
|
email: Schema.optional<typeof Schema.String>;
|
|
220
229
|
name: Schema.optional<typeof Schema.String>;
|
|
221
|
-
role: Schema.optional<Schema.Literal<["user", "assistant"]>>;
|
|
230
|
+
role: Schema.optional<Schema.Literal<["user", "assistant", "tool"]>>;
|
|
222
231
|
}>>;
|
|
223
232
|
blocks: Schema.mutable<Schema.Array$<Schema.Union<[Schema.mutable<Schema.TaggedStruct<"anchor", {
|
|
224
233
|
pending: Schema.optional<typeof Schema.Boolean>;
|
|
@@ -292,12 +301,14 @@ export declare const ExtractionOutput: Schema.Struct<{
|
|
|
292
301
|
toolCallId: typeof Schema.String;
|
|
293
302
|
name: typeof Schema.String;
|
|
294
303
|
input: typeof Schema.String;
|
|
304
|
+
providerExecuted: typeof Schema.Boolean;
|
|
295
305
|
}>>, Schema.mutable<Schema.TaggedStruct<"toolResult", {
|
|
296
306
|
pending: Schema.optional<typeof Schema.Boolean>;
|
|
297
307
|
toolCallId: typeof Schema.String;
|
|
298
308
|
name: typeof Schema.String;
|
|
299
309
|
result: Schema.optional<typeof Schema.String>;
|
|
300
310
|
error: Schema.optional<typeof Schema.String>;
|
|
311
|
+
providerExecuted: typeof Schema.Boolean;
|
|
301
312
|
}>>, Schema.mutable<Schema.TaggedStruct<"transcript", {
|
|
302
313
|
pending: Schema.optional<typeof Schema.Boolean>;
|
|
303
314
|
started: typeof Schema.String;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"extraction.d.ts","sourceRoot":"","sources":["../../../../src/extraction/extraction.ts"],"names":[],"mappings":"AAI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AAE,gBAAgB,CAAC;IAE3B,OAAO,CAAC,EAAE;QACR;;WAEG;QACH,OAAO,CAAC,EAAE,MAAM,CAAC;QAEjB;;;;WAIG;QACH,aAAa,CAAC,EAAE,OAAO,CAAC;KACzB,CAAC;CACH,CAAC;AAEF,MAAM,MAAM,kBAAkB,GAAG,kBAAkB,CAAC,eAAe,EAAE,gBAAgB,CAAC,CAAC;AAEvF;;GAEG;AAEH,eAAO,MAAM,wBAAwB,GAAU,QAAQ,8BAA8B,KAAG,OAAO,CAAC,gBAAgB,CAkB/G,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"quotes.d.ts","sourceRoot":"","sources":["../../../../src/extraction/quotes.ts"],"names":[],"mappings":"AAIA,OAAO,
|
|
1
|
+
{"version":3,"file":"quotes.d.ts","sourceRoot":"","sources":["../../../../src/extraction/quotes.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,MAAM,MAAM,eAAe,CAAC;AAIxC,OAAO,EAAE,KAAK,YAAY,EAAE,MAAM,eAAe,CAAC;AAIlD,eAAO,MAAM,gBAAgB;;;;;EAe3B,CAAC;AACH,MAAM,MAAM,gBAAgB,GAAG,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,gBAAgB,CAAC,CAAC;AAE3E,eAAO,MAAM,UAAU,GAAU,QAAQ,MAAM,EAAE,EAAE,IAAI,YAAY,KAAG,OAAO,CAAC,gBAAgB,CAS7F,CAAC;AAEF;;GAEG;AAEH,eAAO,MAAM,gBAAgB,GAAI,MAAM,MAAM,EAAE,QAAQ,gBAAgB,WAYtE,CAAC"}
|
|
@@ -1,7 +1,20 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
1
|
+
import * as Tool from '@effect/ai/Tool';
|
|
2
|
+
import type * as Toolkit from '@effect/ai/Toolkit';
|
|
3
|
+
import * as Layer from 'effect/Layer';
|
|
3
4
|
import { ToolExecutionService, ToolResolverService } from '@dxos/ai';
|
|
4
|
-
import {
|
|
5
|
-
|
|
6
|
-
|
|
5
|
+
import { DatabaseService } from '@dxos/echo-db';
|
|
6
|
+
import { FunctionDefinition, FunctionInvocationService } from '@dxos/functions';
|
|
7
|
+
/**
|
|
8
|
+
* Constructs a `ToolResolverService` whose `resolve(id)` looks up tools in the following order:
|
|
9
|
+
* 1. Toolkit: return an existing tool from the provided `toolkit` if one is present under `id`.
|
|
10
|
+
* 2. Functions in DB: query `FunctionType` by `key=id`; if found, deserialize and project to a tool
|
|
11
|
+
* (propagating any `deployedFunctionId` discovered in the object's metadata).
|
|
12
|
+
* 3. Functions passed in: fall back to a matching `FunctionDefinition` from the `functions` array.
|
|
13
|
+
*
|
|
14
|
+
* If none of the above yield a match, the effect fails with `AiToolNotFoundError`.
|
|
15
|
+
*
|
|
16
|
+
* Requires `DatabaseService` in the environment.
|
|
17
|
+
*/
|
|
18
|
+
export declare const makeToolResolverFromFunctions: (functions: FunctionDefinition.Any[], toolkit: Toolkit.Toolkit<any>) => Layer.Layer<ToolResolverService, never, DatabaseService>;
|
|
19
|
+
export declare const makeToolExecutionServiceFromFunctions: (toolkit: Toolkit.Toolkit<any>, handlersLayer: Layer.Layer<Tool.Handler<any>, never, never>) => Layer.Layer<ToolExecutionService, never, FunctionInvocationService>;
|
|
7
20
|
//# sourceMappingURL=services.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"services.d.ts","sourceRoot":"","sources":["../../../../src/functions/services.ts"],"names":[],"mappings":"AAIA,OAAO,
|
|
1
|
+
{"version":3,"file":"services.d.ts","sourceRoot":"","sources":["../../../../src/functions/services.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,IAAI,MAAM,iBAAiB,CAAC;AACxC,OAAO,KAAK,KAAK,OAAO,MAAM,oBAAoB,CAAC;AAGnD,OAAO,KAAK,KAAK,MAAM,cAAc,CAAC;AAItC,OAAO,EAAuB,oBAAoB,EAAE,mBAAmB,EAAE,MAAM,UAAU,CAAC;AAG1F,OAAO,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AAChD,OAAO,EAAY,kBAAkB,EAAE,yBAAyB,EAAE,MAAM,iBAAiB,CAAC;AAG1F;;;;;;;;;;GAUG;AACH,eAAO,MAAM,6BAA6B,GACxC,WAAW,kBAAkB,CAAC,GAAG,EAAE,EACnC,SAAS,OAAO,CAAC,OAAO,CAAC,GAAG,CAAC,KAC5B,KAAK,CAAC,KAAK,CAAC,mBAAmB,EAAE,KAAK,EAAE,eAAe,CA8BzD,CAAC;AAEF,eAAO,MAAM,qCAAqC,GAChD,SAAS,OAAO,CAAC,OAAO,CAAC,GAAG,CAAC,EAC7B,eAAe,KAAK,CAAC,KAAK,CAAC,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,EAAE,KAAK,EAAE,KAAK,CAAC,KAC1D,KAAK,CAAC,KAAK,CAAC,oBAAoB,EAAE,KAAK,EAAE,yBAAyB,CAoCpE,CAAC"}
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
export * from './conversation';
|
|
2
2
|
export * from './diff';
|
|
3
|
+
export * from './errors';
|
|
4
|
+
export * from './execution-graph';
|
|
3
5
|
export * from './functions';
|
|
4
6
|
export * from './session';
|
|
5
7
|
export * from './templates';
|
|
6
8
|
export * from './types';
|
|
7
|
-
export * from './errors';
|
|
8
9
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/index.ts"],"names":[],"mappings":"AAIA,cAAc,gBAAgB,CAAC;AAC/B,cAAc,QAAQ,CAAC;AACvB,cAAc,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/index.ts"],"names":[],"mappings":"AAIA,cAAc,gBAAgB,CAAC;AAC/B,cAAc,QAAQ,CAAC;AACvB,cAAc,UAAU,CAAC;AACzB,cAAc,mBAAmB,CAAC;AAClC,cAAc,aAAa,CAAC;AAC5B,cAAc,WAAW,CAAC;AAC1B,cAAc,aAAa,CAAC;AAC5B,cAAc,SAAS,CAAC"}
|
|
@@ -0,0 +1,84 @@
|
|
|
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
|
+
}, R>>;
|
|
74
|
+
export interface AnyStructSchemaNoContext extends Pipeable.Pipeable {
|
|
75
|
+
readonly [Schema.TypeId]: any;
|
|
76
|
+
readonly make: any;
|
|
77
|
+
readonly Type: any;
|
|
78
|
+
readonly Encoded: any;
|
|
79
|
+
readonly Context: never;
|
|
80
|
+
readonly ast: SchemaAST.AST;
|
|
81
|
+
readonly fields: Schema.Struct.Fields;
|
|
82
|
+
readonly annotations: any;
|
|
83
|
+
}
|
|
84
|
+
//# sourceMappingURL=GenericToolkit.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"GenericToolkit.d.ts","sourceRoot":"","sources":["../../../../src/session/GenericToolkit.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,KAAK,IAAI,MAAM,iBAAiB,CAAC;AAC7C,OAAO,KAAK,OAAO,MAAM,oBAAoB,CAAC;AAC9C,OAAO,KAAK,MAAM,MAAM,eAAe,CAAC;AACxC,OAAO,KAAK,KAAK,MAAM,cAAc,CAAC;AACtC,OAAO,KAAK,QAAQ,MAAM,iBAAiB,CAAC;AAC5C,OAAO,KAAK,KAAK,MAAM,MAAM,eAAe,CAAC;AAC7C,OAAO,KAAK,KAAK,SAAS,MAAM,kBAAkB,CAAC;AAEnD;;GAEG;AACH,eAAO,MAAM,MAAM,oCAAoC,CAAC;AAExD;;GAEG;AACH,MAAM,MAAM,MAAM,GAAG,OAAO,MAAM,CAAC;AAEnC;;;;;;;;;GASG;AACH,MAAM,WAAW,cAAc,CAAC,EAAE,GAAG,KAAK,EAAE,CAAC,GAAG,KAAK,EAAE,CAAC,GAAG,KAAK,CAAE,SAAQ,QAAQ,CAAC,QAAQ;IACzF,QAAQ,CAAC,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC;IAE1B;;OAEG;IACH,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAC,OAAO,CAAC,YAAY,CAAC,EAAE,CAAC,CAAC,CAAC;IAEpD;;OAEG;IACH,QAAQ,CAAC,KAAK,EAAE,KAAK,C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
|
|
1
|
+
import * as Context from 'effect/Context';
|
|
2
|
+
import { type ObjectId } from '@dxos/echo/internal';
|
|
2
3
|
import { type ObjectVersion } from '@dxos/echo-db';
|
|
3
|
-
import { type ObjectId } from '@dxos/echo-schema';
|
|
4
4
|
declare const ArtifactDiffResolver_base: Context.TagClass<ArtifactDiffResolver, "@dxos/assistant/ArtifactDiffResolver", ArtifactDiffResolver.Service>;
|
|
5
5
|
/**
|
|
6
6
|
* Resolves artifact ids to their versions.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"artifact-diff.d.ts","sourceRoot":"","sources":["../../../../src/session/artifact-diff.ts"],"names":[],"mappings":"AAIA,OAAO,
|
|
1
|
+
{"version":3,"file":"artifact-diff.d.ts","sourceRoot":"","sources":["../../../../src/session/artifact-diff.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,OAAO,MAAM,gBAAgB,CAAC;AAE1C,OAAO,EAAE,KAAK,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AACpD,OAAO,EAAE,KAAK,aAAa,EAAE,MAAM,eAAe,CAAC;;AAEnD;;;;;;;GAOG;AAEH,qBAAa,oBAAqB,SAAQ,yBAGvC;CAAG;AAEN,yBAAiB,oBAAoB,CAAC;IACpC,KAAY,OAAO,GAAG;QACpB,OAAO,EAAE,CACP,SAAS,EAAE;YACT,EAAE,EAAE,QAAQ,CAAC;YACb,WAAW,EAAE,aAAa,CAAC;SAC5B,EAAE,KACA,OAAO,CACV,GAAG,CACD,QAAQ,EACR;YACE,OAAO,EAAE,aAAa,CAAC;YACvB,IAAI,CAAC,EAAE,MAAM,CAAC;SACf,CACF,CACF,CAAC;KACH,CAAC;CACH"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
1
|
+
import * as AiError from '@effect/ai/AiError';
|
|
2
|
+
import * as Effect from 'effect/Effect';
|
|
3
3
|
export declare const mapAiError: (err: AiError.AiError) => Effect.Effect<AiError.AiError>;
|
|
4
4
|
//# sourceMappingURL=error-handling.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"error-handling.d.ts","sourceRoot":"","sources":["../../../../src/session/error-handling.ts"],"names":[],"mappings":"AAIA,OAAO,
|
|
1
|
+
{"version":3,"file":"error-handling.d.ts","sourceRoot":"","sources":["../../../../src/session/error-handling.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,OAAO,MAAM,oBAAoB,CAAC;AAE9C,OAAO,KAAK,MAAM,MAAM,eAAe,CAAC;AAcxC,eAAO,MAAM,UAAU,GAAI,KAAK,OAAO,CAAC,OAAO,KAAG,MAAM,CAAC,MAAM,CAAC,OAAO,CAAC,OAAO,CAoB1B,CAAC"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import
|
|
2
|
-
import {
|
|
1
|
+
import * as Effect from 'effect/Effect';
|
|
2
|
+
import { Message } from '@dxos/types';
|
|
3
|
+
import { type AiSessionRunError, type AiSessionRunParams } from './session';
|
|
3
4
|
/**
|
|
4
5
|
* Formats the system prompt.
|
|
5
6
|
*/
|
|
@@ -7,176 +8,5 @@ export declare const formatSystemPrompt: ({ system, blueprints, objects, }: Pick
|
|
|
7
8
|
/**
|
|
8
9
|
* Formats the user prompt.
|
|
9
10
|
*/
|
|
10
|
-
export declare const formatUserPrompt: ({ prompt, history }: Pick<AiSessionRunParams<any>, "prompt" | "history">) => Effect.Effect<
|
|
11
|
-
id: string;
|
|
12
|
-
parentMessage?: string | undefined;
|
|
13
|
-
created: string;
|
|
14
|
-
sender: {
|
|
15
|
-
name?: string | undefined;
|
|
16
|
-
contact?: import("@dxos/echo-schema").Ref<import("@dxos/echo/Type").OfKind<import("@dxos/echo-schema").EntityKind.Object> & {
|
|
17
|
-
fields?: {
|
|
18
|
-
readonly value: string;
|
|
19
|
-
readonly category?: string | undefined;
|
|
20
|
-
readonly label: string;
|
|
21
|
-
}[] | undefined;
|
|
22
|
-
image?: string | undefined;
|
|
23
|
-
fullName?: string | undefined;
|
|
24
|
-
preferredName?: string | undefined;
|
|
25
|
-
nickname?: string | undefined;
|
|
26
|
-
organization?: import("@dxos/echo-schema").Ref<import("@dxos/echo/Type").OfKind<import("@dxos/echo-schema").EntityKind.Object> & {
|
|
27
|
-
id: string;
|
|
28
|
-
description?: string | undefined;
|
|
29
|
-
name?: string | undefined;
|
|
30
|
-
status?: "prospect" | "qualified" | "active" | "commit" | "reject" | undefined;
|
|
31
|
-
image?: string | undefined;
|
|
32
|
-
website?: string | undefined;
|
|
33
|
-
}> | undefined;
|
|
34
|
-
jobTitle?: string | undefined;
|
|
35
|
-
department?: string | undefined;
|
|
36
|
-
notes?: string | undefined;
|
|
37
|
-
emails?: {
|
|
38
|
-
readonly value: string;
|
|
39
|
-
readonly label?: string | undefined;
|
|
40
|
-
}[] | undefined;
|
|
41
|
-
identities?: {
|
|
42
|
-
readonly value: string;
|
|
43
|
-
readonly label?: string | undefined;
|
|
44
|
-
}[] | undefined;
|
|
45
|
-
phoneNumbers?: {
|
|
46
|
-
readonly value: string;
|
|
47
|
-
readonly label?: string | undefined;
|
|
48
|
-
}[] | undefined;
|
|
49
|
-
addresses?: {
|
|
50
|
-
readonly value: {
|
|
51
|
-
readonly street?: string | undefined;
|
|
52
|
-
readonly extended?: string | undefined;
|
|
53
|
-
readonly locality?: string | undefined;
|
|
54
|
-
readonly region?: string | undefined;
|
|
55
|
-
readonly postalCode?: string | undefined;
|
|
56
|
-
readonly postOfficeBoxNumber?: string | undefined;
|
|
57
|
-
readonly country?: string | undefined;
|
|
58
|
-
};
|
|
59
|
-
readonly label?: string | undefined;
|
|
60
|
-
}[] | undefined;
|
|
61
|
-
urls?: {
|
|
62
|
-
readonly value: string;
|
|
63
|
-
readonly label?: string | undefined;
|
|
64
|
-
}[] | undefined;
|
|
65
|
-
birthday?: string | undefined;
|
|
66
|
-
}> | undefined;
|
|
67
|
-
identityDid?: string | undefined;
|
|
68
|
-
identityKey?: string | undefined;
|
|
69
|
-
email?: string | undefined;
|
|
70
|
-
role?: "user" | "assistant" | undefined;
|
|
71
|
-
};
|
|
72
|
-
blocks: ({
|
|
73
|
-
version: unknown;
|
|
74
|
-
_tag: "anchor";
|
|
75
|
-
pending?: boolean | undefined;
|
|
76
|
-
objectId: string;
|
|
77
|
-
} | {
|
|
78
|
-
name?: string | undefined;
|
|
79
|
-
_tag: "file";
|
|
80
|
-
url: string;
|
|
81
|
-
pending?: boolean | undefined;
|
|
82
|
-
mediaType?: string | undefined;
|
|
83
|
-
} | {
|
|
84
|
-
id?: string | undefined;
|
|
85
|
-
source?: {
|
|
86
|
-
type: "base64";
|
|
87
|
-
mediaType: string;
|
|
88
|
-
data: string;
|
|
89
|
-
} | {
|
|
90
|
-
type: "http";
|
|
91
|
-
url: string;
|
|
92
|
-
} | undefined;
|
|
93
|
-
_tag: "image";
|
|
94
|
-
pending?: boolean | undefined;
|
|
95
|
-
} | {
|
|
96
|
-
_tag: "json";
|
|
97
|
-
pending?: boolean | undefined;
|
|
98
|
-
data: string;
|
|
99
|
-
disposition?: string | undefined;
|
|
100
|
-
} | {
|
|
101
|
-
text: string;
|
|
102
|
-
_tag: "proposal";
|
|
103
|
-
pending?: boolean | undefined;
|
|
104
|
-
} | {
|
|
105
|
-
_tag: "reasoning";
|
|
106
|
-
reasoningText?: string | undefined;
|
|
107
|
-
signature?: string | undefined;
|
|
108
|
-
redactedText?: string | undefined;
|
|
109
|
-
pending?: boolean | undefined;
|
|
110
|
-
} | {
|
|
111
|
-
_tag: "reference";
|
|
112
|
-
reference: import("@dxos/echo-schema").Ref<import("@dxos/echo/Type").Expando>;
|
|
113
|
-
pending?: boolean | undefined;
|
|
114
|
-
} | {
|
|
115
|
-
_tag: "select";
|
|
116
|
-
pending?: boolean | undefined;
|
|
117
|
-
options: readonly string[];
|
|
118
|
-
} | {
|
|
119
|
-
_tag: "status";
|
|
120
|
-
pending?: boolean | undefined;
|
|
121
|
-
statusText: string;
|
|
122
|
-
} | {
|
|
123
|
-
text: string;
|
|
124
|
-
_tag: "suggestion";
|
|
125
|
-
pending?: boolean | undefined;
|
|
126
|
-
} | {
|
|
127
|
-
_tag: "summary";
|
|
128
|
-
model?: string | undefined;
|
|
129
|
-
usage?: {
|
|
130
|
-
readonly inputTokens?: number | undefined;
|
|
131
|
-
readonly outputTokens?: number | undefined;
|
|
132
|
-
readonly totalTokens?: number | undefined;
|
|
133
|
-
} | undefined;
|
|
134
|
-
pending?: boolean | undefined;
|
|
135
|
-
mimeType?: string | undefined;
|
|
136
|
-
message?: string | undefined;
|
|
137
|
-
toolCalls?: number | undefined;
|
|
138
|
-
errors?: number | undefined;
|
|
139
|
-
duration?: number | undefined;
|
|
140
|
-
} | {
|
|
141
|
-
text: string;
|
|
142
|
-
_tag: "text";
|
|
143
|
-
pending?: boolean | undefined;
|
|
144
|
-
disposition?: string | undefined;
|
|
145
|
-
mimeType?: string | undefined;
|
|
146
|
-
} | {
|
|
147
|
-
_tag: "toolkit";
|
|
148
|
-
pending?: boolean | undefined;
|
|
149
|
-
} | {
|
|
150
|
-
name: string;
|
|
151
|
-
_tag: "toolCall";
|
|
152
|
-
pending?: boolean | undefined;
|
|
153
|
-
toolCallId: string;
|
|
154
|
-
input: string;
|
|
155
|
-
} | {
|
|
156
|
-
name: string;
|
|
157
|
-
_tag: "toolResult";
|
|
158
|
-
error?: string | undefined;
|
|
159
|
-
pending?: boolean | undefined;
|
|
160
|
-
toolCallId: string;
|
|
161
|
-
result?: string | undefined;
|
|
162
|
-
} | {
|
|
163
|
-
text: string;
|
|
164
|
-
_tag: "transcript";
|
|
165
|
-
pending?: boolean | undefined;
|
|
166
|
-
started: string;
|
|
167
|
-
})[];
|
|
168
|
-
properties?: {
|
|
169
|
-
[x: string]: any;
|
|
170
|
-
} | undefined;
|
|
171
|
-
}>, {
|
|
172
|
-
#code: "AI_ASSISTANT_ERROR";
|
|
173
|
-
#context: Record<string, unknown>;
|
|
174
|
-
readonly name: "AI_ASSISTANT_ERROR";
|
|
175
|
-
readonly code: "AI_ASSISTANT_ERROR";
|
|
176
|
-
readonly _tag: "AI_ASSISTANT_ERROR";
|
|
177
|
-
readonly context: Record<string, unknown>;
|
|
178
|
-
message: string;
|
|
179
|
-
stack?: string;
|
|
180
|
-
cause?: unknown;
|
|
181
|
-
}, never>;
|
|
11
|
+
export declare const formatUserPrompt: ({ prompt, history, }: Pick<AiSessionRunParams<any>, "prompt" | "history">) => Effect.Effect<Message.Message, AiSessionRunError>;
|
|
182
12
|
//# sourceMappingURL=format.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"format.d.ts","sourceRoot":"","sources":["../../../../src/session/format.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"format.d.ts","sourceRoot":"","sources":["../../../../src/session/format.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,MAAM,MAAM,eAAe,CAAC;AASxC,OAAO,EAAqB,OAAO,EAAE,MAAM,aAAa,CAAC;AAMzD,OAAO,EAAE,KAAK,iBAAiB,EAAE,KAAK,kBAAkB,EAAE,MAAM,WAAW,CAAC;AAE5E;;GAEG;AAEH,eAAO,MAAM,kBAAkB,GAAI,kCAIhC,IAAI,CAAC,kBAAkB,CAAC,GAAG,CAAC,EAAE,QAAQ,GAAG,YAAY,GAAG,SAAS,CAAC,wCAsCjE,CAAC;AAEL;;GAEG;AAGH,eAAO,MAAM,gBAAgB,GAAI,sBAG9B,IAAI,CAAC,kBAAkB,CAAC,GAAG,CAAC,EAAE,QAAQ,GAAG,SAAS,CAAC,KAAG,MAAM,CAAC,MAAM,CAAC,OAAO,CAAC,OAAO,EAAE,iBAAiB,CAoCrG,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/session/index.ts"],"names":[],"mappings":"AAIA,cAAc,iBAAiB,CAAC;AAChC,cAAc,YAAY,CAAC;AAC3B,cAAc,WAAW,CAAC;AAC1B,cAAc,WAAW,CAAC;AAC1B,cAAc,eAAe,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/session/index.ts"],"names":[],"mappings":"AAIA,cAAc,iBAAiB,CAAC;AAChC,cAAc,YAAY,CAAC;AAC3B,cAAc,WAAW,CAAC;AAC1B,cAAc,WAAW,CAAC;AAC1B,cAAc,eAAe,CAAC;AAE9B,OAAO,KAAK,cAAc,MAAM,kBAAkB,CAAC"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import
|
|
1
|
+
import * as Effect from 'effect/Effect';
|
|
2
2
|
import { type AiParser, type ConsolePrinter } from '@dxos/ai';
|
|
3
|
-
import { type
|
|
3
|
+
import { type Message } from '@dxos/types';
|
|
4
4
|
/**
|
|
5
5
|
* Live observer of the generation process.
|
|
6
6
|
*/
|
|
@@ -9,7 +9,7 @@ export interface GenerationObserver extends AiParser.ParseResponseCallbacks {
|
|
|
9
9
|
* Complete messages fired during the session, both from the model and from the user.
|
|
10
10
|
* This message will contain all message blocks emitted through the `onBlock` callback.
|
|
11
11
|
*/
|
|
12
|
-
onMessage: (message:
|
|
12
|
+
onMessage: (message: Message.Message) => Effect.Effect<void>;
|
|
13
13
|
}
|
|
14
14
|
export declare const GenerationObserver: Readonly<{
|
|
15
15
|
make: ({ onBegin, onPart, onBlock, onEnd, onMessage, }?: Partial<GenerationObserver>) => GenerationObserver;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"observer.d.ts","sourceRoot":"","sources":["../../../../src/session/observer.ts"],"names":[],"mappings":"AAIA,OAAO,
|
|
1
|
+
{"version":3,"file":"observer.d.ts","sourceRoot":"","sources":["../../../../src/session/observer.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,MAAM,MAAM,eAAe,CAAC;AAGxC,OAAO,EAAE,KAAK,QAAQ,EAAE,KAAK,cAAc,EAAE,MAAM,UAAU,CAAC;AAC9D,OAAO,EAAE,KAAK,OAAO,EAAE,MAAM,aAAa,CAAC;AAE3C;;GAEG;AACH,MAAM,WAAW,kBAAmB,SAAQ,QAAQ,CAAC,sBAAsB;IACzE;;;OAGG;IACH,SAAS,EAAE,CAAC,OAAO,EAAE,OAAO,CAAC,OAAO,KAAK,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;CAC9D;AAED,eAAO,MAAM,kBAAkB;6DAO1B,OAAO,CAAC,kBAAkB,CAAC,KAAQ,kBAAkB;;IAUxD;;OAEG;2BACoB,cAAc;EAiBrC,CAAC"}
|
|
@@ -1,21 +1,25 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
1
|
+
import type * as AiError from '@effect/ai/AiError';
|
|
2
|
+
import * as LanguageModel from '@effect/ai/LanguageModel';
|
|
3
|
+
import type * as Tool from '@effect/ai/Tool';
|
|
4
|
+
import type * as Toolkit from '@effect/ai/Toolkit';
|
|
5
|
+
import * as Effect from 'effect/Effect';
|
|
6
|
+
import type * as Schema from 'effect/Schema';
|
|
7
|
+
import { type AiToolNotFoundError, type PromptPreprocessingError, type ToolExecutionService, type ToolResolverService } from '@dxos/ai';
|
|
4
8
|
import { type Blueprint } from '@dxos/blueprints';
|
|
5
9
|
import { Obj } from '@dxos/echo';
|
|
6
10
|
import { TracingService } from '@dxos/functions';
|
|
7
|
-
import {
|
|
11
|
+
import { Message } from '@dxos/types';
|
|
8
12
|
import { type AiAssistantError } from '../errors';
|
|
9
13
|
import { GenerationObserver } from './observer';
|
|
10
|
-
export type AiSessionRunError = AiError.AiError |
|
|
11
|
-
export type AiSessionRunRequirements =
|
|
12
|
-
export type AiSessionRunParams<Tools extends
|
|
14
|
+
export type AiSessionRunError = AiError.AiError | PromptPreprocessingError | AiToolNotFoundError | AiAssistantError;
|
|
15
|
+
export type AiSessionRunRequirements = LanguageModel.LanguageModel | ToolExecutionService | ToolResolverService | TracingService;
|
|
16
|
+
export type AiSessionRunParams<Tools extends Record<string, Tool.Any>> = {
|
|
13
17
|
prompt: string;
|
|
14
18
|
system?: string;
|
|
15
|
-
history?:
|
|
19
|
+
history?: Message.Message[];
|
|
16
20
|
objects?: Obj.Any[];
|
|
17
21
|
blueprints?: Blueprint.Blueprint[];
|
|
18
|
-
toolkit?:
|
|
22
|
+
toolkit?: Toolkit.WithHandler<Tools>;
|
|
19
23
|
observer?: GenerationObserver;
|
|
20
24
|
};
|
|
21
25
|
export type AiSessionOptions = {};
|
|
@@ -38,10 +42,10 @@ export declare class AiSession {
|
|
|
38
42
|
/** Pending messages for this session (incl. the current prompt). */
|
|
39
43
|
private _pending;
|
|
40
44
|
constructor(_options?: AiSessionOptions);
|
|
41
|
-
run: <Tools extends
|
|
45
|
+
run: <Tools extends Record<string, Tool.Any>>({ prompt, system: systemTemplate, history, objects, blueprints, toolkit, observer, }: AiSessionRunParams<Tools>) => Effect.Effect<Message.Message[], AiSessionRunError, AiSessionRunRequirements>;
|
|
42
46
|
/**
|
|
43
47
|
* @deprecated
|
|
44
48
|
*/
|
|
45
|
-
runStructured<S extends Schema.Schema.AnyNoContext>(_schema: S, _options: AiSessionRunParams<
|
|
49
|
+
runStructured<S extends Schema.Schema.AnyNoContext>(_schema: S, _options: AiSessionRunParams<any>): Promise<Schema.Schema.Type<S>>;
|
|
46
50
|
}
|
|
47
51
|
//# sourceMappingURL=session.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"session.d.ts","sourceRoot":"","sources":["../../../../src/session/session.ts"],"names":[],"mappings":"AAIA,OAAO,
|
|
1
|
+
{"version":3,"file":"session.d.ts","sourceRoot":"","sources":["../../../../src/session/session.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,KAAK,OAAO,MAAM,oBAAoB,CAAC;AACnD,OAAO,KAAK,aAAa,MAAM,0BAA0B,CAAC;AAC1D,OAAO,KAAK,KAAK,IAAI,MAAM,iBAAiB,CAAC;AAC7C,OAAO,KAAK,KAAK,OAAO,MAAM,oBAAoB,CAAC;AAEnD,OAAO,KAAK,MAAM,MAAM,eAAe,CAAC;AACxC,OAAO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