@dxos/assistant 0.8.4-main.b97322e → 0.8.4-main.c4373fc
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-CWGVG235.mjs +380 -0
- package/dist/lib/browser/chunk-CWGVG235.mjs.map +7 -0
- package/dist/lib/browser/chunk-UB26N5UF.mjs +89 -0
- package/dist/lib/browser/chunk-UB26N5UF.mjs.map +7 -0
- package/dist/lib/browser/extraction/index.mjs +272 -0
- package/dist/lib/browser/extraction/index.mjs.map +7 -0
- package/dist/lib/browser/index.mjs +687 -1649
- package/dist/lib/browser/index.mjs.map +4 -4
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/named-entity-recognition-QPYHML66.mjs +13 -0
- package/dist/lib/browser/named-entity-recognition-QPYHML66.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-BCFXTNSK.mjs +91 -0
- package/dist/lib/node-esm/chunk-BCFXTNSK.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-OV5PMQPB.mjs +382 -0
- package/dist/lib/node-esm/chunk-OV5PMQPB.mjs.map +7 -0
- package/dist/lib/node-esm/extraction/index.mjs +273 -0
- package/dist/lib/node-esm/extraction/index.mjs.map +7 -0
- package/dist/lib/node-esm/index.mjs +686 -1649
- package/dist/lib/node-esm/index.mjs.map +4 -4
- package/dist/lib/node-esm/meta.json +1 -1
- package/dist/lib/node-esm/named-entity-recognition-2HDF46YX.mjs +14 -0
- package/dist/lib/node-esm/named-entity-recognition-2HDF46YX.mjs.map +7 -0
- package/dist/types/src/conversation/context.d.ts +97 -0
- package/dist/types/src/conversation/context.d.ts.map +1 -0
- package/dist/types/src/conversation/conversation.d.ts +25 -22
- package/dist/types/src/conversation/conversation.d.ts.map +1 -1
- package/dist/types/src/conversation/index.d.ts +1 -0
- package/dist/types/src/conversation/index.d.ts.map +1 -1
- package/dist/types/src/diff.d.ts +15 -0
- package/dist/types/src/diff.d.ts.map +1 -0
- package/dist/types/src/diff.test.d.ts +2 -0
- package/dist/types/src/diff.test.d.ts.map +1 -0
- package/dist/types/src/errors.d.ts +46 -9
- package/dist/types/src/errors.d.ts.map +1 -1
- package/dist/types/src/execution-graph.d.ts +82 -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 +1 -1
- 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 +103 -64
- package/dist/types/src/extraction/extraction-ner-function/extraction-ner-function.d.ts.map +1 -1
- package/dist/types/src/extraction/extraction-ner-function/named-entity-recognition.d.ts.map +1 -1
- package/dist/types/src/extraction/extraction.d.ts +252 -218
- 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 +17 -4
- package/dist/types/src/functions/services.d.ts.map +1 -1
- package/dist/types/src/index.d.ts +3 -3
- package/dist/types/src/index.d.ts.map +1 -1
- package/dist/types/src/session/artifact-diff.d.ts +27 -0
- package/dist/types/src/session/artifact-diff.d.ts.map +1 -0
- package/dist/types/src/session/error-handling.d.ts +4 -0
- package/dist/types/src/session/error-handling.d.ts.map +1 -0
- package/dist/types/src/session/format.d.ts +184 -0
- package/dist/types/src/session/format.d.ts.map +1 -0
- package/dist/types/src/session/format.test.d.ts +2 -0
- package/dist/types/src/session/format.test.d.ts.map +1 -0
- package/dist/types/src/session/index.d.ts +3 -0
- package/dist/types/src/session/index.d.ts.map +1 -1
- package/dist/types/src/session/observer.d.ts +22 -0
- package/dist/types/src/session/observer.d.ts.map +1 -0
- package/dist/types/src/session/session.d.ts +27 -236
- package/dist/types/src/session/session.d.ts.map +1 -1
- package/dist/types/src/session/toolkit.d.ts +15 -0
- package/dist/types/src/session/toolkit.d.ts.map +1 -0
- 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/templates/index.d.ts +1 -1
- package/dist/types/src/templates/system.d.ts +18 -0
- package/dist/types/src/templates/system.d.ts.map +1 -0
- package/dist/types/src/types.d.ts +5 -2
- package/dist/types/src/types.d.ts.map +1 -1
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +44 -32
- package/src/conversation/context.ts +156 -0
- package/src/conversation/conversation.ts +78 -53
- package/src/conversation/index.ts +1 -0
- package/src/diff.test.ts +43 -0
- package/src/diff.ts +79 -0
- package/src/errors.ts +6 -1
- package/src/execution-graph.test.ts +738 -0
- package/src/execution-graph.ts +500 -0
- package/src/extraction/extraction-llm-function/extraction-llm-function.test.ts +8 -7
- package/src/extraction/extraction-llm-function/extraction-llm-function.ts +13 -11
- package/src/extraction/extraction-ner-function/extraction-ner-function.test.ts +9 -9
- package/src/extraction/extraction-ner-function/extraction-ner-function.ts +15 -8
- package/src/extraction/extraction-ner-function/named-entity-recognition.test.ts +2 -1
- package/src/extraction/extraction-ner-function/named-entity-recognition.ts +2 -0
- package/src/extraction/extraction.ts +2 -2
- package/src/extraction/quotes.test.ts +3 -3
- package/src/extraction/quotes.ts +4 -4
- package/src/functions/services.ts +114 -95
- package/src/index.ts +3 -3
- package/src/session/artifact-diff.ts +41 -0
- package/src/session/error-handling.ts +41 -0
- package/src/session/format.test.ts +60 -0
- package/src/session/format.ts +142 -0
- package/src/session/index.ts +3 -0
- package/src/session/observer.ts +59 -0
- package/src/session/session.conversations.json +1 -0
- package/src/session/session.test.ts +37 -198
- package/src/session/session.ts +125 -249
- package/src/session/toolkit.ts +48 -0
- package/src/session/version-pin.ts +5 -5
- package/src/summarization/summarization.test.ts +16 -22
- package/src/templates/format.tpl +60 -0
- package/src/templates/index.ts +1 -1
- package/src/templates/system.tpl +48 -0
- package/src/templates/system.ts +41 -0
- package/src/types.ts +12 -7
- package/src/typings.d.ts +5 -0
- package/dist/types/bin/chat.d.ts +0 -2
- package/dist/types/bin/chat.d.ts.map +0 -1
- package/dist/types/src/context/binder.d.ts +0 -34
- package/dist/types/src/context/binder.d.ts.map +0 -1
- package/dist/types/src/context/binding.d.ts +0 -56
- package/dist/types/src/context/binding.d.ts.map +0 -1
- package/dist/types/src/context/index.d.ts +0 -3
- package/dist/types/src/context/index.d.ts.map +0 -1
- package/dist/types/src/research/exa.d.ts +0 -12
- package/dist/types/src/research/exa.d.ts.map +0 -1
- package/dist/types/src/research/graph.d.ts +0 -51
- package/dist/types/src/research/graph.d.ts.map +0 -1
- package/dist/types/src/research/graph.test.d.ts +0 -2
- package/dist/types/src/research/graph.test.d.ts.map +0 -1
- package/dist/types/src/research/index.d.ts +0 -4
- package/dist/types/src/research/index.d.ts.map +0 -1
- package/dist/types/src/research/research.d.ts +0 -10
- package/dist/types/src/research/research.d.ts.map +0 -1
- package/dist/types/src/research/research.test.d.ts +0 -2
- package/dist/types/src/research/research.test.d.ts.map +0 -1
- 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/templates/prompt.d.ts +0 -30
- package/dist/types/src/templates/prompt.d.ts.map +0 -1
- package/dist/types/src/testing/exa-search-1748337321991.d.ts +0 -38
- package/dist/types/src/testing/exa-search-1748337321991.d.ts.map +0 -1
- package/dist/types/src/testing/exa-search-1748337331526.d.ts +0 -37
- package/dist/types/src/testing/exa-search-1748337331526.d.ts.map +0 -1
- package/dist/types/src/testing/exa-search-1748337344119.d.ts +0 -58
- package/dist/types/src/testing/exa-search-1748337344119.d.ts.map +0 -1
- package/dist/types/src/testing/index.d.ts +0 -3
- package/dist/types/src/testing/index.d.ts.map +0 -1
- package/src/context/binder.ts +0 -103
- package/src/context/binding.ts +0 -32
- package/src/context/index.ts +0 -6
- package/src/research/exa.ts +0 -97
- package/src/research/graph.test.ts +0 -64
- package/src/research/graph.ts +0 -369
- package/src/research/index.ts +0 -7
- package/src/research/instructions-research.tpl +0 -98
- package/src/research/research.test.ts +0 -190
- package/src/research/research.ts +0 -87
- package/src/session/__snapshots__/session.test.ts.snap +0 -32
- package/src/session/version-pin.test.ts +0 -7
- package/src/templates/assistant.tpl +0 -111
- package/src/templates/prompt.ts +0 -45
- package/src/testing/exa-search-1748337321991.ts +0 -131
- package/src/testing/exa-search-1748337331526.ts +0 -144
- package/src/testing/exa-search-1748337344119.ts +0 -133
- package/src/testing/index.ts +0 -11
- package/src/typedefs.d.ts +0 -8
|
@@ -1,6 +1,19 @@
|
|
|
1
|
-
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';
|
|
2
4
|
import { ToolExecutionService, ToolResolverService } from '@dxos/ai';
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
|
|
5
|
+
import { DatabaseService, FunctionDefinition, FunctionInvocationService } from '@dxos/functions';
|
|
6
|
+
/**
|
|
7
|
+
* Constructs a `ToolResolverService` whose `resolve(id)` looks up tools in the following order:
|
|
8
|
+
* 1. Toolkit: return an existing tool from the provided `toolkit` if one is present under `id`.
|
|
9
|
+
* 2. Functions in DB: query `FunctionType` by `key=id`; if found, deserialize and project to a tool
|
|
10
|
+
* (propagating any `deployedFunctionId` discovered in the object's metadata).
|
|
11
|
+
* 3. Functions passed in: fall back to a matching `FunctionDefinition` from the `functions` array.
|
|
12
|
+
*
|
|
13
|
+
* If none of the above yield a match, the effect fails with `AiToolNotFoundError`.
|
|
14
|
+
*
|
|
15
|
+
* Requires `DatabaseService` in the environment.
|
|
16
|
+
*/
|
|
17
|
+
export declare const makeToolResolverFromFunctions: (functions: FunctionDefinition<any, any>[], toolkit: Toolkit.Toolkit<any>) => Layer.Layer<ToolResolverService, never, DatabaseService>;
|
|
18
|
+
export declare const makeToolExecutionServiceFromFunctions: (toolkit: Toolkit.Toolkit<any>, handlersLayer: Layer.Layer<Tool.Handler<any>, never, never>) => Layer.Layer<ToolExecutionService, never, FunctionInvocationService>;
|
|
6
19
|
//# sourceMappingURL=services.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"services.d.ts","sourceRoot":"","sources":["../../../../src/functions/services.ts"],"names":[],"mappings":"
|
|
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,kBAAkB,EAAE,yBAAyB,EAAgB,MAAM,iBAAiB,CAAC;AAG/G;;;;;;;;;;GAUG;AACH,eAAO,MAAM,6BAA6B,GACxC,WAAW,kBAAkB,CAAC,GAAG,EAAE,GAAG,CAAC,EAAE,EACzC,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,CAmCpE,CAAC"}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
export * from './context';
|
|
2
1
|
export * from './conversation';
|
|
3
|
-
export * from './
|
|
2
|
+
export * from './diff';
|
|
3
|
+
export * from './errors';
|
|
4
|
+
export * from './execution-graph';
|
|
4
5
|
export * from './functions';
|
|
5
|
-
export * from './research';
|
|
6
6
|
export * from './session';
|
|
7
7
|
export * from './templates';
|
|
8
8
|
export * from './types';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/index.ts"],"names":[],"mappings":"AAIA,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,27 @@
|
|
|
1
|
+
import * as Context from 'effect/Context';
|
|
2
|
+
import { type ObjectId } from '@dxos/echo/internal';
|
|
3
|
+
import { type ObjectVersion } from '@dxos/echo-db';
|
|
4
|
+
declare const ArtifactDiffResolver_base: Context.TagClass<ArtifactDiffResolver, "@dxos/assistant/ArtifactDiffResolver", ArtifactDiffResolver.Service>;
|
|
5
|
+
/**
|
|
6
|
+
* Resolves artifact ids to their versions.
|
|
7
|
+
* Used to give the model a sense of the changes to the artifacts made by users during the conversation.
|
|
8
|
+
* The artifacts versions are pinned in the history, and whenever the artifact changes in-between assistant's steps,
|
|
9
|
+
* a diff is inserted into the conversation.
|
|
10
|
+
*
|
|
11
|
+
* Can be optionally provided to the session run call.
|
|
12
|
+
*/
|
|
13
|
+
export declare class ArtifactDiffResolver extends ArtifactDiffResolver_base {
|
|
14
|
+
}
|
|
15
|
+
export declare namespace ArtifactDiffResolver {
|
|
16
|
+
type Service = {
|
|
17
|
+
resolve: (artifacts: {
|
|
18
|
+
id: ObjectId;
|
|
19
|
+
lastVersion: ObjectVersion;
|
|
20
|
+
}[]) => Promise<Map<ObjectId, {
|
|
21
|
+
version: ObjectVersion;
|
|
22
|
+
diff?: string;
|
|
23
|
+
}>>;
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
export {};
|
|
27
|
+
//# sourceMappingURL=artifact-diff.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
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"}
|
|
@@ -0,0 +1 @@
|
|
|
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"}
|
|
@@ -0,0 +1,184 @@
|
|
|
1
|
+
import * as Effect from 'effect/Effect';
|
|
2
|
+
import { type AiSessionRunParams } from './session';
|
|
3
|
+
/**
|
|
4
|
+
* Formats the system prompt.
|
|
5
|
+
*/
|
|
6
|
+
export declare const formatSystemPrompt: ({ system, blueprints, objects, }: Pick<AiSessionRunParams<any>, "system" | "blueprints" | "objects">) => Effect.Effect<string, never, never>;
|
|
7
|
+
/**
|
|
8
|
+
* Formats the user prompt.
|
|
9
|
+
*/
|
|
10
|
+
export declare const formatUserPrompt: ({ prompt, history }: Pick<AiSessionRunParams<any>, "prompt" | "history">) => Effect.Effect<import("@dxos/live-object").Live<import("@dxos/echo/Type").OfKind<import("@dxos/echo/internal").EntityKind.Object> & {
|
|
11
|
+
id: string;
|
|
12
|
+
parentMessage?: string | undefined;
|
|
13
|
+
created: string;
|
|
14
|
+
sender: {
|
|
15
|
+
contact?: import("@dxos/echo/internal").Ref<import("@dxos/echo/Type").OfKind<import("@dxos/echo/internal").EntityKind.Object> & {
|
|
16
|
+
fullName?: string | undefined;
|
|
17
|
+
preferredName?: string | undefined;
|
|
18
|
+
nickname?: string | undefined;
|
|
19
|
+
image?: string | undefined;
|
|
20
|
+
organization?: import("@dxos/echo/internal").Ref<import("@dxos/echo/Type").OfKind<import("@dxos/echo/internal").EntityKind.Object> & {
|
|
21
|
+
id: string;
|
|
22
|
+
description?: string | undefined;
|
|
23
|
+
name?: string | undefined;
|
|
24
|
+
status?: "prospect" | "qualified" | "active" | "commit" | "reject" | undefined;
|
|
25
|
+
image?: string | undefined;
|
|
26
|
+
website?: string | undefined;
|
|
27
|
+
}> | undefined;
|
|
28
|
+
jobTitle?: string | undefined;
|
|
29
|
+
department?: string | undefined;
|
|
30
|
+
notes?: string | undefined;
|
|
31
|
+
emails?: {
|
|
32
|
+
readonly label?: string | undefined;
|
|
33
|
+
readonly value: string;
|
|
34
|
+
}[] | undefined;
|
|
35
|
+
identities?: {
|
|
36
|
+
readonly label?: string | undefined;
|
|
37
|
+
readonly value: string;
|
|
38
|
+
}[] | undefined;
|
|
39
|
+
phoneNumbers?: {
|
|
40
|
+
readonly label?: string | undefined;
|
|
41
|
+
readonly value: string;
|
|
42
|
+
}[] | undefined;
|
|
43
|
+
addresses?: {
|
|
44
|
+
readonly label?: string | undefined;
|
|
45
|
+
readonly value: {
|
|
46
|
+
readonly street?: string | undefined;
|
|
47
|
+
readonly extended?: string | undefined;
|
|
48
|
+
readonly locality?: string | undefined;
|
|
49
|
+
readonly region?: string | undefined;
|
|
50
|
+
readonly postalCode?: string | undefined;
|
|
51
|
+
readonly postOfficeBoxNumber?: string | undefined;
|
|
52
|
+
readonly country?: string | undefined;
|
|
53
|
+
};
|
|
54
|
+
}[] | undefined;
|
|
55
|
+
urls?: {
|
|
56
|
+
readonly label?: string | undefined;
|
|
57
|
+
readonly value: string;
|
|
58
|
+
}[] | undefined;
|
|
59
|
+
birthday?: string | undefined;
|
|
60
|
+
fields?: {
|
|
61
|
+
readonly label: string;
|
|
62
|
+
readonly value: string;
|
|
63
|
+
readonly category?: string | undefined;
|
|
64
|
+
}[] | undefined;
|
|
65
|
+
}> | undefined;
|
|
66
|
+
identityDid?: string | undefined;
|
|
67
|
+
identityKey?: string | undefined;
|
|
68
|
+
email?: string | undefined;
|
|
69
|
+
name?: string | undefined;
|
|
70
|
+
role?: "user" | "assistant" | "tool" | 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
|
+
pending?: boolean | undefined;
|
|
81
|
+
url: string;
|
|
82
|
+
mediaType?: string | undefined;
|
|
83
|
+
} | {
|
|
84
|
+
id?: string | undefined;
|
|
85
|
+
_tag: "image";
|
|
86
|
+
pending?: boolean | undefined;
|
|
87
|
+
source?: {
|
|
88
|
+
mediaType: string;
|
|
89
|
+
type: "base64";
|
|
90
|
+
data: string;
|
|
91
|
+
} | {
|
|
92
|
+
url: string;
|
|
93
|
+
type: "http";
|
|
94
|
+
} | 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
|
+
pending?: boolean | undefined;
|
|
107
|
+
reasoningText?: string | undefined;
|
|
108
|
+
redactedText?: string | undefined;
|
|
109
|
+
signature?: string | undefined;
|
|
110
|
+
} | {
|
|
111
|
+
reference: import("@dxos/echo/internal").Ref<import("@dxos/echo/Type").Expando>;
|
|
112
|
+
_tag: "reference";
|
|
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
|
+
pending?: boolean | undefined;
|
|
129
|
+
mimeType?: string | undefined;
|
|
130
|
+
message?: string | undefined;
|
|
131
|
+
model?: string | undefined;
|
|
132
|
+
usage?: {
|
|
133
|
+
readonly inputTokens?: number | undefined;
|
|
134
|
+
readonly outputTokens?: number | undefined;
|
|
135
|
+
readonly totalTokens?: number | undefined;
|
|
136
|
+
} | 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
|
+
providerExecuted: boolean;
|
|
156
|
+
} | {
|
|
157
|
+
name: string;
|
|
158
|
+
_tag: "toolResult";
|
|
159
|
+
pending?: boolean | undefined;
|
|
160
|
+
toolCallId: string;
|
|
161
|
+
providerExecuted: boolean;
|
|
162
|
+
result?: string | undefined;
|
|
163
|
+
error?: string | undefined;
|
|
164
|
+
} | {
|
|
165
|
+
text: string;
|
|
166
|
+
_tag: "transcript";
|
|
167
|
+
pending?: boolean | undefined;
|
|
168
|
+
started: string;
|
|
169
|
+
})[];
|
|
170
|
+
properties?: {
|
|
171
|
+
[x: string]: any;
|
|
172
|
+
} | undefined;
|
|
173
|
+
}>, {
|
|
174
|
+
"__#private@#code": "AI_ASSISTANT_ERROR";
|
|
175
|
+
"__#private@#context": Record<string, unknown>;
|
|
176
|
+
readonly name: "AI_ASSISTANT_ERROR";
|
|
177
|
+
readonly message: string;
|
|
178
|
+
readonly code: "AI_ASSISTANT_ERROR";
|
|
179
|
+
readonly _tag: "AI_ASSISTANT_ERROR";
|
|
180
|
+
readonly context: Record<string, unknown>;
|
|
181
|
+
stack?: string;
|
|
182
|
+
cause?: unknown;
|
|
183
|
+
}, never>;
|
|
184
|
+
//# sourceMappingURL=format.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"format.d.ts","sourceRoot":"","sources":["../../../../src/session/format.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,MAAM,MAAM,eAAe,CAAC;AAgBxC,OAAO,EAAE,KAAK,kBAAkB,EAAE,MAAM,WAAW,CAAC;AAEpD;;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,qBAA0B,IAAI,CAAC,kBAAkB,CAAC,GAAG,CAAC,EAAE,QAAQ,GAAG,SAAS,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;SAoC1G,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"format.test.d.ts","sourceRoot":"","sources":["../../../../src/session/format.test.ts"],"names":[],"mappings":""}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/session/index.ts"],"names":[],"mappings":"AAIA,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"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import * as Effect from 'effect/Effect';
|
|
2
|
+
import { type AiParser, type ConsolePrinter } from '@dxos/ai';
|
|
3
|
+
import { type DataType } from '@dxos/schema';
|
|
4
|
+
/**
|
|
5
|
+
* Live observer of the generation process.
|
|
6
|
+
*/
|
|
7
|
+
export interface GenerationObserver extends AiParser.ParseResponseCallbacks {
|
|
8
|
+
/**
|
|
9
|
+
* Complete messages fired during the session, both from the model and from the user.
|
|
10
|
+
* This message will contain all message blocks emitted through the `onBlock` callback.
|
|
11
|
+
*/
|
|
12
|
+
onMessage: (message: DataType.Message) => Effect.Effect<void>;
|
|
13
|
+
}
|
|
14
|
+
export declare const GenerationObserver: Readonly<{
|
|
15
|
+
make: ({ onBegin, onPart, onBlock, onEnd, onMessage, }?: Partial<GenerationObserver>) => GenerationObserver;
|
|
16
|
+
noop: () => GenerationObserver;
|
|
17
|
+
/**
|
|
18
|
+
* Debug printer to be used in unit-tests and browser devtools.
|
|
19
|
+
*/
|
|
20
|
+
fromPrinter: (printer: ConsolePrinter) => GenerationObserver;
|
|
21
|
+
}>;
|
|
22
|
+
//# sourceMappingURL=observer.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
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,QAAQ,EAAE,MAAM,cAAc,CAAC;AAE7C;;GAEG;AACH,MAAM,WAAW,kBAAmB,SAAQ,QAAQ,CAAC,sBAAsB;IACzE;;;OAGG;IACH,SAAS,EAAE,CAAC,OAAO,EAAE,QAAQ,CAAC,OAAO,KAAK,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;CAC/D;AAED,eAAO,MAAM,kBAAkB;6DAO1B,OAAO,CAAC,kBAAkB,CAAC,KAAQ,kBAAkB;;IAUxD;;OAEG;2BACoB,cAAc;EAiBrC,CAAC"}
|
|
@@ -1,20 +1,28 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
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';
|
|
5
8
|
import { type Blueprint } from '@dxos/blueprints';
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
9
|
+
import { Obj } from '@dxos/echo';
|
|
10
|
+
import { TracingService } from '@dxos/functions';
|
|
8
11
|
import { DataType } from '@dxos/schema';
|
|
9
|
-
import { AiAssistantError } from '../errors';
|
|
10
|
-
|
|
11
|
-
export type
|
|
12
|
+
import { type AiAssistantError } from '../errors';
|
|
13
|
+
import { GenerationObserver } from './observer';
|
|
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>> = {
|
|
12
17
|
prompt: string;
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
18
|
+
system?: string;
|
|
19
|
+
history?: DataType.Message[];
|
|
20
|
+
objects?: Obj.Any[];
|
|
16
21
|
blueprints?: Blueprint.Blueprint[];
|
|
22
|
+
toolkit?: Toolkit.WithHandler<Tools>;
|
|
23
|
+
observer?: GenerationObserver;
|
|
17
24
|
};
|
|
25
|
+
export type AiSessionOptions = {};
|
|
18
26
|
/**
|
|
19
27
|
* Contains message history, tools, current context.
|
|
20
28
|
* Current context means the state of the app, time of day, and other contextual information.
|
|
@@ -27,234 +35,17 @@ export type SessionRunOptions<Tools extends AiTool.Any> = {
|
|
|
27
35
|
*/
|
|
28
36
|
export declare class AiSession {
|
|
29
37
|
private readonly _options;
|
|
38
|
+
/** Prevents concurrent execution of session. */
|
|
30
39
|
private readonly _semaphore;
|
|
31
|
-
/**
|
|
32
|
-
private _pending;
|
|
33
|
-
/** Current streaming response. */
|
|
34
|
-
private _stream;
|
|
35
|
-
/** Prior history from queue. */
|
|
40
|
+
/** Message history from queue. */
|
|
36
41
|
private _history;
|
|
37
|
-
/**
|
|
38
|
-
|
|
39
|
-
*/
|
|
40
|
-
readonly message: Event<import("@dxos/schema").Message>;
|
|
41
|
-
/**
|
|
42
|
-
* Complete block added to Message.
|
|
43
|
-
*/
|
|
44
|
-
readonly block: Event<{
|
|
45
|
-
version: unknown;
|
|
46
|
-
_tag: "anchor";
|
|
47
|
-
pending?: boolean | undefined;
|
|
48
|
-
objectId: string;
|
|
49
|
-
} | {
|
|
50
|
-
name?: string | undefined;
|
|
51
|
-
_tag: "file";
|
|
52
|
-
pending?: boolean | undefined;
|
|
53
|
-
url: string;
|
|
54
|
-
mediaType?: string | undefined;
|
|
55
|
-
} | {
|
|
56
|
-
id?: string | undefined;
|
|
57
|
-
source?: {
|
|
58
|
-
type: "base64";
|
|
59
|
-
mediaType: string;
|
|
60
|
-
data: string;
|
|
61
|
-
} | {
|
|
62
|
-
type: "http";
|
|
63
|
-
url: string;
|
|
64
|
-
} | undefined;
|
|
65
|
-
_tag: "image";
|
|
66
|
-
pending?: boolean | undefined;
|
|
67
|
-
} | {
|
|
68
|
-
_tag: "json";
|
|
69
|
-
pending?: boolean | undefined;
|
|
70
|
-
data: string;
|
|
71
|
-
disposition?: string | undefined;
|
|
72
|
-
} | {
|
|
73
|
-
text: string;
|
|
74
|
-
_tag: "proposal";
|
|
75
|
-
pending?: boolean | undefined;
|
|
76
|
-
} | {
|
|
77
|
-
_tag: "reasoning";
|
|
78
|
-
pending?: boolean | undefined;
|
|
79
|
-
reasoningText?: string | undefined;
|
|
80
|
-
redactedText?: string | undefined;
|
|
81
|
-
signature?: string | undefined;
|
|
82
|
-
} | {
|
|
83
|
-
reference: import("@dxos/echo-schema").Ref<import("@dxos/echo/Type").Expando>;
|
|
84
|
-
_tag: "reference";
|
|
85
|
-
pending?: boolean | undefined;
|
|
86
|
-
} | {
|
|
87
|
-
_tag: "select";
|
|
88
|
-
pending?: boolean | undefined;
|
|
89
|
-
options: readonly string[];
|
|
90
|
-
} | {
|
|
91
|
-
_tag: "status";
|
|
92
|
-
pending?: boolean | undefined;
|
|
93
|
-
statusText: string;
|
|
94
|
-
} | {
|
|
95
|
-
text: string;
|
|
96
|
-
_tag: "suggest";
|
|
97
|
-
pending?: boolean | undefined;
|
|
98
|
-
} | {
|
|
99
|
-
text: string;
|
|
100
|
-
_tag: "text";
|
|
101
|
-
pending?: boolean | undefined;
|
|
102
|
-
disposition?: string | undefined;
|
|
103
|
-
mimeType?: string | undefined;
|
|
104
|
-
} | {
|
|
105
|
-
name: string;
|
|
106
|
-
input: unknown;
|
|
107
|
-
_tag: "toolCall";
|
|
108
|
-
pending?: boolean | undefined;
|
|
109
|
-
toolCallId: string;
|
|
110
|
-
} | {
|
|
111
|
-
_tag: "toolList";
|
|
112
|
-
pending?: boolean | undefined;
|
|
113
|
-
} | {
|
|
114
|
-
name: string;
|
|
115
|
-
_tag: "toolResult";
|
|
116
|
-
pending?: boolean | undefined;
|
|
117
|
-
toolCallId: string;
|
|
118
|
-
result: unknown;
|
|
119
|
-
} | {
|
|
120
|
-
text: string;
|
|
121
|
-
_tag: "transcript";
|
|
122
|
-
pending?: boolean | undefined;
|
|
123
|
-
started: string;
|
|
124
|
-
}>;
|
|
125
|
-
/**
|
|
126
|
-
* Update partial block (while streaming).
|
|
127
|
-
*/
|
|
128
|
-
readonly update: Event<{
|
|
129
|
-
version: unknown;
|
|
130
|
-
_tag: "anchor";
|
|
131
|
-
pending?: boolean | undefined;
|
|
132
|
-
objectId: string;
|
|
133
|
-
} | {
|
|
134
|
-
name?: string | undefined;
|
|
135
|
-
_tag: "file";
|
|
136
|
-
pending?: boolean | undefined;
|
|
137
|
-
url: string;
|
|
138
|
-
mediaType?: string | undefined;
|
|
139
|
-
} | {
|
|
140
|
-
id?: string | undefined;
|
|
141
|
-
source?: {
|
|
142
|
-
type: "base64";
|
|
143
|
-
mediaType: string;
|
|
144
|
-
data: string;
|
|
145
|
-
} | {
|
|
146
|
-
type: "http";
|
|
147
|
-
url: string;
|
|
148
|
-
} | undefined;
|
|
149
|
-
_tag: "image";
|
|
150
|
-
pending?: boolean | undefined;
|
|
151
|
-
} | {
|
|
152
|
-
_tag: "json";
|
|
153
|
-
pending?: boolean | undefined;
|
|
154
|
-
data: string;
|
|
155
|
-
disposition?: string | undefined;
|
|
156
|
-
} | {
|
|
157
|
-
text: string;
|
|
158
|
-
_tag: "proposal";
|
|
159
|
-
pending?: boolean | undefined;
|
|
160
|
-
} | {
|
|
161
|
-
_tag: "reasoning";
|
|
162
|
-
pending?: boolean | undefined;
|
|
163
|
-
reasoningText?: string | undefined;
|
|
164
|
-
redactedText?: string | undefined;
|
|
165
|
-
signature?: string | undefined;
|
|
166
|
-
} | {
|
|
167
|
-
reference: import("@dxos/echo-schema").Ref<import("@dxos/echo/Type").Expando>;
|
|
168
|
-
_tag: "reference";
|
|
169
|
-
pending?: boolean | undefined;
|
|
170
|
-
} | {
|
|
171
|
-
_tag: "select";
|
|
172
|
-
pending?: boolean | undefined;
|
|
173
|
-
options: readonly string[];
|
|
174
|
-
} | {
|
|
175
|
-
_tag: "status";
|
|
176
|
-
pending?: boolean | undefined;
|
|
177
|
-
statusText: string;
|
|
178
|
-
} | {
|
|
179
|
-
text: string;
|
|
180
|
-
_tag: "suggest";
|
|
181
|
-
pending?: boolean | undefined;
|
|
182
|
-
} | {
|
|
183
|
-
text: string;
|
|
184
|
-
_tag: "text";
|
|
185
|
-
pending?: boolean | undefined;
|
|
186
|
-
disposition?: string | undefined;
|
|
187
|
-
mimeType?: string | undefined;
|
|
188
|
-
} | {
|
|
189
|
-
name: string;
|
|
190
|
-
input: unknown;
|
|
191
|
-
_tag: "toolCall";
|
|
192
|
-
pending?: boolean | undefined;
|
|
193
|
-
toolCallId: string;
|
|
194
|
-
} | {
|
|
195
|
-
_tag: "toolList";
|
|
196
|
-
pending?: boolean | undefined;
|
|
197
|
-
} | {
|
|
198
|
-
name: string;
|
|
199
|
-
_tag: "toolResult";
|
|
200
|
-
pending?: boolean | undefined;
|
|
201
|
-
toolCallId: string;
|
|
202
|
-
result: unknown;
|
|
203
|
-
} | {
|
|
204
|
-
text: string;
|
|
205
|
-
_tag: "transcript";
|
|
206
|
-
pending?: boolean | undefined;
|
|
207
|
-
started: string;
|
|
208
|
-
}>;
|
|
209
|
-
/**
|
|
210
|
-
* Unparsed events from the underlying generation stream.
|
|
211
|
-
*/
|
|
212
|
-
readonly streamEvent: Event<AiResponse.TextPart | AiResponse.ReasoningPart | AiResponse.RedactedReasoningPart | AiResponse.ToolCallPart | AiResponse.MetadataPart | AiResponse.FinishPart>;
|
|
213
|
-
/**
|
|
214
|
-
* User prompt or tool result.
|
|
215
|
-
*/
|
|
216
|
-
readonly userMessage: Event<import("@dxos/schema").Message>;
|
|
217
|
-
/**
|
|
218
|
-
* Agent self-reporting its status.
|
|
219
|
-
* Triggered by the model.
|
|
220
|
-
*/
|
|
221
|
-
readonly statusReport: Event<AgentStatus>;
|
|
222
|
-
/**
|
|
223
|
-
* Emits when the session is done.
|
|
224
|
-
*/
|
|
225
|
-
readonly done: Event<void>;
|
|
42
|
+
/** Pending messages for this session (incl. the current prompt). */
|
|
43
|
+
private _pending;
|
|
226
44
|
constructor(_options?: AiSessionOptions);
|
|
45
|
+
run: <Tools extends Record<string, Tool.Any>>({ prompt, system: systemTemplate, history, objects, blueprints, toolkit, observer, }: AiSessionRunParams<Tools>) => Effect.Effect<DataType.Message[], AiSessionRunError, AiSessionRunRequirements>;
|
|
227
46
|
/**
|
|
228
|
-
*
|
|
229
|
-
* @param options - The session options.
|
|
230
|
-
* @returns The messages generated by the session, including the user's prompt.
|
|
47
|
+
* @deprecated
|
|
231
48
|
*/
|
|
232
|
-
|
|
233
|
-
runStructured<S extends Schema.Schema.AnyNoContext>(schema: S, options: SessionRunOptions<AiTool.Any>): Promise<Schema.Schema.Type<S>>;
|
|
234
|
-
private _formatUserPrompt;
|
|
235
|
-
abort(): void;
|
|
236
|
-
}
|
|
237
|
-
declare const ArtifactDiffResolver_base: Context.TagClass<ArtifactDiffResolver, "ArtifactDiffResolver", ArtifactDiffResolver.Service>;
|
|
238
|
-
/**
|
|
239
|
-
* Resolves artifact ids to their versions.
|
|
240
|
-
* Used to give the model a sense of the changes to the artifacts made by users during the conversation.
|
|
241
|
-
* The artifacts versions are pinned in the history, and whenever the artifact changes in-between assistant's steps,
|
|
242
|
-
* a diff is inserted into the conversation.
|
|
243
|
-
*
|
|
244
|
-
* Can be optionally provided to the session run call.
|
|
245
|
-
*/
|
|
246
|
-
export declare class ArtifactDiffResolver extends ArtifactDiffResolver_base {
|
|
247
|
-
}
|
|
248
|
-
export declare namespace ArtifactDiffResolver {
|
|
249
|
-
type Service = {
|
|
250
|
-
resolve: (artifacts: {
|
|
251
|
-
id: ObjectId;
|
|
252
|
-
lastVersion: ObjectVersion;
|
|
253
|
-
}[]) => Promise<Map<ObjectId, {
|
|
254
|
-
version: ObjectVersion;
|
|
255
|
-
diff?: string;
|
|
256
|
-
}>>;
|
|
257
|
-
};
|
|
49
|
+
runStructured<S extends Schema.Schema.AnyNoContext>(_schema: S, _options: AiSessionRunParams<any>): Promise<Schema.Schema.Type<S>>;
|
|
258
50
|
}
|
|
259
|
-
export {};
|
|
260
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,KAAK,KAAK,MAAM,MAAM,eAAe,CAAC;AAG7C,OAAO,EAGL,KAAK,mBAAmB,EACxB,KAAK,wBAAwB,EAC7B,KAAK,oBAAoB,EACzB,KAAK,mBAAmB,EAGzB,MAAM,UAAU,CAAC;AAClB,OAAO,EAAE,KAAK,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAElD,OAAO,EAAE,GAAG,EAAE,MAAM,YAAY,CAAC;AACjC,OAAO,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AAEjD,OAAO,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;AAExC,OAAO,EAAE,KAAK,gBAAgB,EAAE,MAAM,WAAW,CAAC;AAGlD,OAAO,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAC;AAEhD,MAAM,MAAM,iBAAiB,GAAG,OAAO,CAAC,OAAO,GAAG,wBAAwB,GAAG,mBAAmB,GAAG,gBAAgB,CAAC;AAEpH,MAAM,MAAM,wBAAwB,GAChC,aAAa,CAAC,aAAa,GAC3B,oBAAoB,GACpB,mBAAmB,GACnB,cAAc,CAAC;AAEnB,MAAM,MAAM,kBAAkB,CAAC,KAAK,SAAS,MAAM,CAAC,MAAM,EAAE,IAAI,CAAC,GAAG,CAAC,IAAI;IACvE,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,OAAO,CAAC,EAAE,QAAQ,CAAC,OAAO,EAAE,CAAC;IAC7B,OAAO,CAAC,EAAE,GAAG,CAAC,GAAG,EAAE,CAAC;IACpB,UAAU,CAAC,EAAE,SAAS,CAAC,SAAS,EAAE,CAAC;IACnC,OAAO,CAAC,EAAE,OAAO,CAAC,WAAW,CAAC,KAAK,CAAC,CAAC;IACrC,QAAQ,CAAC,EAAE,kBAAkB,CAAC;CAC/B,CAAC;AAEF,MAAM,MAAM,gBAAgB,GAAG,EAAE,CAAC;AAElC;;;;;;;;;GASG;AACH,qBAAa,SAAS;IAWR,OAAO,CAAC,QAAQ,CAAC,QAAQ;IAVrC,gDAAgD;IAChD,OAAO,CAAC,QAAQ,CAAC,UAAU,CAA2C;IAEtE,kCAAkC;IAElC,OAAO,CAAC,QAAQ,CAA0B;IAE1C,oEAAoE;IACpE,OAAO,CAAC,QAAQ,CAA0B;gBAEb,QAAQ,GAAE,gBAAqB;IAE5D,GAAG,GAAI,KAAK,SAAS,MAAM,CAAC,MAAM,EAAE,IAAI,CAAC,GAAG,CAAC,EAAE,sFAQ5C,kBAAkB,CAAC,KAAK,CAAC,KAAG,MAAM,CAAC,MAAM,CAAC,QAAQ,CAAC,OAAO,EAAE,EAAE,iBAAiB,EAAE,wBAAwB,CAAC,CA+FjC;IAE5E;;OAEG;IAEG,aAAa,CAAC,CAAC,SAAS,MAAM,CAAC,MAAM,CAAC,YAAY,EACtD,OAAO,EAAE,CAAC,EACV,QAAQ,EAAE,kBAAkB,CAAC,GAAG,CAAC,GAChC,OAAO,CAAC,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;CASlC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
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 { type AiToolNotFoundError, ToolExecutionService, type ToolId, ToolResolverService } from '@dxos/ai';
|
|
5
|
+
import { type Blueprint } from '@dxos/blueprints';
|
|
6
|
+
export type ToolkitParams<Tools extends Record<string, Tool.Any>> = {
|
|
7
|
+
toolkit?: Toolkit.Toolkit<Tools>;
|
|
8
|
+
toolIds?: ToolId[];
|
|
9
|
+
blueprints?: Blueprint.Blueprint[];
|
|
10
|
+
};
|
|
11
|
+
/**
|
|
12
|
+
* Build a combined toolkit from the blueprint tools and the provided toolkit.
|
|
13
|
+
*/
|
|
14
|
+
export declare const createToolkit: <Tools extends Record<string, Tool.Any> = {}>({ toolkit: toolkitParam, toolIds, blueprints, }: ToolkitParams<Tools>) => Effect.Effect<Toolkit.WithHandler<any>, AiToolNotFoundError, ToolResolverService | ToolExecutionService | Tool.HandlersFor<Tools>>;
|
|
15
|
+
//# sourceMappingURL=toolkit.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"toolkit.d.ts","sourceRoot":"","sources":["../../../../src/session/toolkit.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,KAAK,IAAI,MAAM,iBAAiB,CAAC;AAC7C,OAAO,KAAK,OAAO,MAAM,oBAAoB,CAAC;AAE9C,OAAO,KAAK,MAAM,MAAM,eAAe,CAAC;AAExC,OAAO,EAAE,KAAK,mBAAmB,EAAE,oBAAoB,EAAE,KAAK,MAAM,EAAE,mBAAmB,EAAE,MAAM,UAAU,CAAC;AAC5G,OAAO,EAAE,KAAK,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAGlD,MAAM,MAAM,aAAa,CAAC,KAAK,SAAS,MAAM,CAAC,MAAM,EAAE,IAAI,CAAC,GAAG,CAAC,IAAI;IAClE,OAAO,CAAC,EAAE,OAAO,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;IACjC,OAAO,CAAC,EAAE,MAAM,EAAE,CAAC;IACnB,UAAU,CAAC,EAAE,SAAS,CAAC,SAAS,EAAE,CAAC;CACpC,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,aAAa,GAAI,KAAK,SAAS,MAAM,CAAC,MAAM,EAAE,IAAI,CAAC,GAAG,CAAC,GAAG,EAAE,EAAE,iDAIxE,aAAa,CAAC,KAAK,CAAC,KAAG,MAAM,CAAC,MAAM,CACrC,OAAO,CAAC,WAAW,CAAC,GAAG,CAAC,EACxB,mBAAmB,EACnB,mBAAmB,GAAG,oBAAoB,GAAG,IAAI,CAAC,WAAW,CAAC,KAAK,CAAC,CAkBlE,CAAC"}
|