@dxos/assistant 0.8.4-main.a4bbb77 → 0.8.4-main.abd8ff62ef
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/README.md +1 -0
- package/dist/lib/neutral/extraction/index.mjs +202 -0
- package/dist/lib/neutral/extraction/index.mjs.map +7 -0
- package/dist/lib/neutral/index.mjs +1731 -0
- package/dist/lib/neutral/index.mjs.map +7 -0
- package/dist/lib/neutral/meta.json +1 -0
- package/dist/types/src/conversation/context.d.ts +120 -64
- package/dist/types/src/conversation/context.d.ts.map +1 -1
- package/dist/types/src/conversation/context.test.d.ts +2 -0
- package/dist/types/src/conversation/context.test.d.ts.map +1 -0
- package/dist/types/src/conversation/index.d.ts +1 -1
- package/dist/types/src/conversation/index.d.ts.map +1 -1
- package/dist/types/src/conversation/session.d.ts +78 -0
- package/dist/types/src/conversation/session.d.ts.map +1 -0
- package/dist/types/src/diff.d.ts +3 -1
- package/dist/types/src/diff.d.ts.map +1 -1
- package/dist/types/src/errors.d.ts +32 -40
- package/dist/types/src/errors.d.ts.map +1 -1
- package/dist/types/src/execution-graph.d.ts +5 -2
- package/dist/types/src/execution-graph.d.ts.map +1 -1
- package/dist/types/src/extraction/extraction-ner-function/index.d.ts +0 -1
- package/dist/types/src/extraction/extraction-ner-function/index.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 +1066 -307
- package/dist/types/src/extraction/extraction.d.ts.map +1 -1
- package/dist/types/src/extraction/index.d.ts +0 -1
- package/dist/types/src/extraction/index.d.ts.map +1 -1
- package/dist/types/src/extraction/quotes.d.ts +3 -3
- package/dist/types/src/extraction/quotes.d.ts.map +1 -1
- package/dist/types/src/functions/services.d.ts +15 -16
- package/dist/types/src/functions/services.d.ts.map +1 -1
- package/dist/types/src/index.d.ts +1 -0
- package/dist/types/src/index.d.ts.map +1 -1
- 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 +8 -177
- package/dist/types/src/session/format.d.ts.map +1 -1
- package/dist/types/src/session/index.d.ts +2 -1
- package/dist/types/src/session/index.d.ts.map +1 -1
- package/dist/types/src/session/observer.d.ts +7 -6
- package/dist/types/src/session/observer.d.ts.map +1 -1
- package/dist/types/src/session/request.d.ts +104 -0
- package/dist/types/src/session/request.d.ts.map +1 -0
- package/dist/types/src/session/toolkit.d.ts +11 -9
- package/dist/types/src/session/toolkit.d.ts.map +1 -1
- package/dist/types/src/session/version-pin.d.ts +4 -4
- package/dist/types/src/session/version-pin.d.ts.map +1 -1
- package/dist/types/src/templates/system.d.ts +1 -2
- package/dist/types/src/templates/system.d.ts.map +1 -1
- package/dist/types/src/tracing.d.ts +233 -0
- package/dist/types/src/tracing.d.ts.map +1 -0
- package/dist/types/src/types/artifact.d.ts +28 -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 +35 -47
- package/src/conversation/context.test.ts +52 -0
- package/src/conversation/context.ts +324 -75
- package/src/conversation/index.ts +1 -1
- package/src/conversation/session.ts +334 -0
- package/src/diff.test.ts +37 -6
- package/src/diff.ts +18 -4
- package/src/errors.ts +2 -2
- package/src/execution-graph.test.ts +47 -45
- package/src/execution-graph.ts +41 -22
- package/src/extraction/extraction-ner-function/index.ts +0 -1
- package/src/extraction/extraction-ner-function/named-entity-recognition.test.ts +10 -5
- package/src/extraction/extraction.ts +44 -15
- package/src/extraction/index.ts +0 -1
- package/src/extraction/quotes.ts +5 -6
- package/src/functions/services.ts +126 -65
- package/src/functions.conversations.json +1 -0
- package/src/index.ts +1 -0
- package/src/session/artifact-diff.ts +2 -2
- package/src/session/error-handling.ts +4 -3
- package/src/session/format.ts +34 -26
- package/src/session/index.ts +2 -1
- package/src/session/observer.ts +8 -4
- package/src/session/request.conversations.json +1 -0
- package/src/session/request.ts +342 -0
- package/src/session/toolkit.ts +29 -28
- package/src/session/version-pin.ts +7 -7
- package/src/templates/{format.tpl → instructions/format.tpl} +1 -4
- package/src/templates/{system.tpl → instructions/system.tpl} +50 -2
- package/src/templates/system.ts +9 -8
- package/src/tracing.ts +57 -0
- package/src/{types.ts → types/artifact.ts} +44 -7
- package/src/types/index.ts +5 -0
- package/dist/lib/browser/chunk-ILL2CN3G.mjs +0 -374
- package/dist/lib/browser/chunk-ILL2CN3G.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/extraction/index.mjs +0 -272
- package/dist/lib/browser/extraction/index.mjs.map +0 -7
- package/dist/lib/browser/index.mjs +0 -861
- package/dist/lib/browser/index.mjs.map +0 -7
- package/dist/lib/browser/meta.json +0 -1
- package/dist/lib/browser/named-entity-recognition-QPYHML66.mjs +0 -13
- package/dist/lib/browser/named-entity-recognition-QPYHML66.mjs.map +0 -7
- 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-GVKA7VL3.mjs +0 -376
- package/dist/lib/node-esm/chunk-GVKA7VL3.mjs.map +0 -7
- package/dist/lib/node-esm/extraction/index.mjs +0 -273
- package/dist/lib/node-esm/extraction/index.mjs.map +0 -7
- package/dist/lib/node-esm/index.mjs +0 -862
- package/dist/lib/node-esm/index.mjs.map +0 -7
- package/dist/lib/node-esm/meta.json +0 -1
- package/dist/lib/node-esm/named-entity-recognition-2HDF46YX.mjs +0 -14
- package/dist/lib/node-esm/named-entity-recognition-2HDF46YX.mjs.map +0 -7
- package/dist/types/src/conversation/conversation.d.ts +0 -41
- package/dist/types/src/conversation/conversation.d.ts.map +0 -1
- package/dist/types/src/extraction/extraction-llm-function/extraction-llm-function.d.ts +0 -4
- package/dist/types/src/extraction/extraction-llm-function/extraction-llm-function.d.ts.map +0 -1
- package/dist/types/src/extraction/extraction-llm-function/extraction-llm-function.test.d.ts +0 -2
- package/dist/types/src/extraction/extraction-llm-function/extraction-llm-function.test.d.ts.map +0 -1
- package/dist/types/src/extraction/extraction-llm-function/index.d.ts +0 -2
- package/dist/types/src/extraction/extraction-llm-function/index.d.ts.map +0 -1
- package/dist/types/src/extraction/extraction-ner-function/extraction-ner-function.d.ts +0 -341
- package/dist/types/src/extraction/extraction-ner-function/extraction-ner-function.d.ts.map +0 -1
- package/dist/types/src/extraction/extraction-ner-function/extraction-ner-function.test.d.ts +0 -2
- package/dist/types/src/extraction/extraction-ner-function/extraction-ner-function.test.d.ts.map +0 -1
- package/dist/types/src/session/format.test.d.ts +0 -2
- package/dist/types/src/session/format.test.d.ts.map +0 -1
- package/dist/types/src/session/session.d.ts +0 -47
- package/dist/types/src/session/session.d.ts.map +0 -1
- package/dist/types/src/session/session.test.d.ts +0 -2
- package/dist/types/src/session/session.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/conversation/conversation.ts +0 -119
- package/src/extraction/extraction-llm-function/extraction-llm-function.test.ts +0 -84
- package/src/extraction/extraction-llm-function/extraction-llm-function.ts +0 -72
- package/src/extraction/extraction-llm-function/index.ts +0 -5
- package/src/extraction/extraction-ner-function/extraction-ner-function.test.ts +0 -115
- package/src/extraction/extraction-ner-function/extraction-ner-function.ts +0 -64
- package/src/session/format.test.ts +0 -60
- package/src/session/session.conversations.json +0 -1
- package/src/session/session.test.ts +0 -146
- package/src/session/session.ts +0 -206
- package/src/summarization/summarization.test.ts +0 -201
- /package/src/extraction/extraction-llm-function/{instructions.tpl → transcription-instructions.tpl} +0 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"extraction.d.ts","sourceRoot":"","sources":["../../../../src/extraction/extraction.ts"],"names":[],"mappings":"AAIA,OAAO,
|
|
1
|
+
{"version":3,"file":"extraction.d.ts","sourceRoot":"","sources":["../../../../src/extraction/extraction.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,MAAM,MAAM,eAAe,CAAC;AAExC,OAAO,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAC1C,OAAO,EAAE,GAAG,EAAE,MAAM,YAAY,CAAC;AAIjC,eAAO,MAAM,eAAe;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAS1B,CAAC;AACH,MAAM,WAAW,eAAgB,SAAQ,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,eAAe,CAAC;CAAG;AAEtF,eAAO,MAAM,gBAAgB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAG3B,CAAC;AACH,MAAM,WAAW,gBAAiB,SAAQ,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,gBAAgB,CAAC;CAAG;AAExF,MAAM,MAAM,6BAA6B,GAAG;IAC1C,KAAK,EAAE,eAAe,CAAC;IACvB,QAAQ,EAAE,SAAS,CAAC,UAAU,CAAC,eAAe,EAAE,gBAAgB,CAAC,CAAC;IAElE,OAAO,CAA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OAAO,CAAC,gBAAgB,CAqB9G,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/extraction/index.ts"],"names":[],"mappings":"AAIA,cAAc,cAAc,CAAC;AAC7B,cAAc,2BAA2B,CAAC;AAC1C,cAAc,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/extraction/index.ts"],"names":[],"mappings":"AAIA,cAAc,cAAc,CAAC;AAC7B,cAAc,2BAA2B,CAAC;AAC1C,cAAc,UAAU,CAAC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { type
|
|
1
|
+
import * as Schema from 'effect/Schema';
|
|
2
|
+
import { type Database } from '@dxos/echo';
|
|
3
3
|
export declare const ReferencedQuotes: Schema.Struct<{
|
|
4
4
|
references: Schema.mutable<Schema.Array$<Schema.Struct<{
|
|
5
5
|
id: typeof Schema.String;
|
|
@@ -7,7 +7,7 @@ export declare const ReferencedQuotes: Schema.Struct<{
|
|
|
7
7
|
}>>>;
|
|
8
8
|
}>;
|
|
9
9
|
export type ReferencedQuotes = Schema.Schema.Type<typeof ReferencedQuotes>;
|
|
10
|
-
export declare const findQuotes: (quotes: string[], db:
|
|
10
|
+
export declare const findQuotes: (quotes: string[], db: Database.Database) => Promise<ReferencedQuotes>;
|
|
11
11
|
/**
|
|
12
12
|
* Finds and replaces all quotes with DXNs references.
|
|
13
13
|
*/
|
|
@@ -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;AAExC,OAAO,EAAE,KAAK,QAAQ,EAAiB,MAAM,YAAY,CAAC;AAK1D,eAAO,MAAM,gBAAgB;;;;;EAe3B,CAAC;AACH,MAAM,MAAM,gBAAgB,GAAG,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,gBAAgB,CAAC,CAAC;AAE3E,eAAO,MAAM,UAAU,WAAkB,MAAM,EAAE,MAAM,QAAQ,CAAC,QAAQ,KAAG,OAAO,CAAC,gBAAgB,CASlG,CAAC;AAEF;;GAEG;AAEH,eAAO,MAAM,gBAAgB,SAAU,MAAM,UAAU,gBAAgB,WAYtE,CAAC"}
|
|
@@ -1,18 +1,17 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
1
|
+
import * as Tool from '@effect/ai/Tool';
|
|
2
|
+
import * as Effect from 'effect/Effect';
|
|
3
|
+
import * as Layer from 'effect/Layer';
|
|
4
|
+
import * as Option from 'effect/Option';
|
|
3
5
|
import { ToolExecutionService, ToolResolverService } from '@dxos/ai';
|
|
4
|
-
import {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
*/
|
|
16
|
-
export declare const makeToolResolverFromFunctions: (functions: FunctionDefinition<any, any>[], toolkit: Toolkit.Toolkit<any>) => Layer.Layer<ToolResolverService, never, DatabaseService>;
|
|
17
|
-
export declare const makeToolExecutionServiceFromFunctions: (toolkit: Toolkit.Toolkit<any>, handlersLayer: Layer.Layer<Tool.Handler<any>, never, never>) => Layer.Layer<ToolExecutionService, never, FunctionInvocationService>;
|
|
6
|
+
import { OpaqueToolkit } from '@dxos/ai';
|
|
7
|
+
import { Operation, OperationRegistry } from '@dxos/compute';
|
|
8
|
+
export declare const makeToolResolverFromOperations: <R = never>({ toolkit: extraToolkit, }?: {
|
|
9
|
+
toolkit?: OpaqueToolkit.OpaqueToolkit<never, never, R>;
|
|
10
|
+
}) => Layer.Layer<ToolResolverService, never, OpaqueToolkit.OpaqueToolkitProvider | OperationRegistry.Service | R>;
|
|
11
|
+
export declare const makeToolExecutionService: <E, R>(opts: {
|
|
12
|
+
invoke: (tool: Tool.Any, input: unknown) => Effect.Effect<unknown>;
|
|
13
|
+
}) => Layer.Layer<ToolExecutionService, never, OpaqueToolkit.OpaqueToolkitProvider>;
|
|
14
|
+
export declare const makeToolExecutionServiceFromOperationInvoker: () => Layer.Layer<ToolExecutionService, never, Operation.Service | OpaqueToolkit.OpaqueToolkitProvider>;
|
|
15
|
+
export declare const ToolExecutionServices: Layer.Layer<ToolExecutionService | ToolResolverService, never, OpaqueToolkit.OpaqueToolkitProvider | Operation.Service | OperationRegistry.Service>;
|
|
16
|
+
export declare const getOperationFromTool: (tool: Tool.Any) => Option.Option<Operation.Definition.Any>;
|
|
18
17
|
//# 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;AAGxC,OAAO,KAAK,MAAM,MAAM,eAAe,CAAC;AACxC,OAAO,KAAK,KAAK,MAAM,cAAc,CAAC;AACtC,OAAO,KAAK,MAAM,MAAM,eAAe,CAAC;AAKxC,OAAO,EAAuB,oBAAoB,EAAE,mBAAmB,EAAE,MAAM,UAAU,CAAC;AAC1F,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AACzC,OAAO,EAAE,SAAS,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAC;AAO7D,eAAO,MAAM,8BAA8B,GAAI,CAAC,GAAG,KAAK,+BAErD;IAAE,OAAO,CAAC,EAAE,aAAa,CAAC,aAAa,CAAC,KAAK,EAAE,KAAK,EAAE,CAAC,CAAC,CAAA;CAAE,KAAQ,KAAK,CAAC,KAAK,CAC9E,mBAAmB,EACnB,KAAK,EACL,aAAa,CAAC,qBAAqB,GAAG,iBAAiB,CAAC,OAAO,GAAG,CAAC,CA6BpE,CAAC;AAEF,eAAO,MAAM,wBAAwB,GAAI,CAAC,EAAE,CAAC,QAAQ;IACnD,MAAM,EAAE,CAAC,IAAI,EAAE,IAAI,CAAC,GAAG,EAAE,KAAK,EAAE,OAAO,KAAK,MAAM,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;CACpE,KAAG,KAAK,CAAC,KAAK,CAAC,oBAAoB,EAAE,KAAK,EAAE,aAAa,CAAC,qBAAqB,CAkC7E,CAAC;AAEJ,eAAO,MAAM,4CAA4C,QAAO,KAAK,CAAC,KAAK,CACzE,oBAAoB,EACpB,KAAK,EACL,SAAS,CAAC,OAAO,GAAG,aAAa,CAAC,qBAAqB,CAgBxD,CAAC;AAEF,eAAO,MAAM,qBAAqB,qJAGjC,CAAC;AAOF,eAAO,MAAM,oBAAoB,SAAU,IAAI,CAAC,GAAG,KAAG,MAAM,CAAC,MAAM,CAAC,SAAS,CAAC,UAAU,CAAC,GAAG,CAE3F,CAAC"}
|
|
@@ -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,UAAU,CAAC;AACzB,cAAc,mBAAmB,CAAC;AAClC,cAAc,aAAa,CAAC;AAC5B,cAAc,WAAW,CAAC;AAC1B,cAAc,aAAa,CAAC;AAC5B,cAAc,SAAS,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;AACxB,cAAc,WAAW,CAAC"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import
|
|
1
|
+
import * as Context from 'effect/Context';
|
|
2
2
|
import { type ObjectVersion } from '@dxos/echo-db';
|
|
3
|
-
import { type ObjectId } from '@dxos/
|
|
3
|
+
import { type ObjectId } from '@dxos/keys';
|
|
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,aAAa,EAAE,MAAM,eAAe,CAAC;AACnD,OAAO,EAAE,KAAK,QAAQ,EAAE,MAAM,YAAY,CAAC;;AAE3C;;;;;;;GAOG;AAEH,qBAAa,oBAAqB,SAAQ,yBAGvC;CAAG;AAEN,yBAAiB,oBAAoB,CAAC,CAAC;IACrC,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,QAAS,OAAO,CAAC,OAAO,KAAG,MAAM,CAAC,MAAM,CAAC,OAAO,CAAC,OAAO,CAoB1B,CAAC"}
|
|
@@ -1,184 +1,15 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { type
|
|
1
|
+
import * as Effect from 'effect/Effect';
|
|
2
|
+
import { type FunctionNotFoundError, type Operation, type OperationRegistry } from '@dxos/compute';
|
|
3
|
+
import { type Database } from '@dxos/echo';
|
|
4
|
+
import type { ObjectNotFoundError } from '@dxos/echo/Err';
|
|
5
|
+
import { Message } from '@dxos/types';
|
|
6
|
+
import { type AiRequestRunError, type AiRequestRunProps } from './request';
|
|
3
7
|
/**
|
|
4
8
|
* Formats the system prompt.
|
|
5
9
|
*/
|
|
6
|
-
export declare const formatSystemPrompt: ({ system, blueprints, objects, }: Pick<
|
|
10
|
+
export declare const formatSystemPrompt: ({ system, blueprints, objects, }: Pick<AiRequestRunProps, 'system' | 'blueprints' | 'objects'>) => Effect.Effect<string, FunctionNotFoundError | ObjectNotFoundError, Database.Service | OperationRegistry.Service | Operation.Service>;
|
|
7
11
|
/**
|
|
8
12
|
* Formats the user prompt.
|
|
9
13
|
*/
|
|
10
|
-
export declare const formatUserPrompt: ({ prompt, history }: Pick<
|
|
11
|
-
id: string;
|
|
12
|
-
parentMessage?: string | undefined;
|
|
13
|
-
created: string;
|
|
14
|
-
sender: {
|
|
15
|
-
contact?: import("@dxos/echo-schema").Ref<import("@dxos/echo/Type").OfKind<import("@dxos/echo-schema").EntityKind.Object> & {
|
|
16
|
-
fullName?: string | undefined;
|
|
17
|
-
preferredName?: string | undefined;
|
|
18
|
-
nickname?: string | undefined;
|
|
19
|
-
image?: string | undefined;
|
|
20
|
-
organization?: import("@dxos/echo-schema").Ref<import("@dxos/echo/Type").OfKind<import("@dxos/echo-schema").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-schema").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>;
|
|
14
|
+
export declare const formatUserPrompt: ({ prompt, history, }: Pick<AiRequestRunProps, 'prompt' | 'history'>) => Effect.Effect<Message.Message, AiRequestRunError>;
|
|
184
15
|
//# sourceMappingURL=format.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"format.d.ts","sourceRoot":"","sources":["../../../../src/session/format.ts"],"names":[],"mappings":"AAIA,OAAO,
|
|
1
|
+
{"version":3,"file":"format.d.ts","sourceRoot":"","sources":["../../../../src/session/format.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,MAAM,MAAM,eAAe,CAAC;AAIxC,OAAO,EAAE,KAAK,qBAAqB,EAAE,KAAK,SAAS,EAAE,KAAK,iBAAiB,EAAY,MAAM,eAAe,CAAC;AAC7G,OAAO,EAAE,KAAK,QAAQ,EAAO,MAAM,YAAY,CAAC;AAEhD,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,gBAAgB,CAAC;AAG1D,OAAO,EAAqB,OAAO,EAAE,MAAM,aAAa,CAAC;AAKzD,OAAO,EAAE,KAAK,iBAAiB,EAAE,KAAK,iBAAiB,EAAE,MAAM,WAAW,CAAC;AAE3E;;GAEG;AAEH,eAAO,MAAM,kBAAkB,qCAI5B,IAAI,CAAC,iBAAiB,EAAE,QAAQ,GAAG,YAAY,GAAG,SAAS,CAAC,KAAG,MAAM,CAAC,MAAM,CAC7E,MAAM,EACN,qBAAqB,GAAG,mBAAmB,EAC3C,QAAQ,CAAC,OAAO,GAAG,iBAAiB,CAAC,OAAO,GAAG,SAAS,CAAC,OAAO,CAuClB,CAAC;AAEjD;;GAEG;AAGH,eAAO,MAAM,gBAAgB,yBAG1B,IAAI,CAAC,iBAAiB,EAAE,QAAQ,GAAG,SAAS,CAAC,KAAG,MAAM,CAAC,MAAM,CAAC,OAAO,CAAC,OAAO,EAAE,iBAAiB,CAoCrD,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;AAC9B,cAAc,UAAU,CAAC"}
|
|
@@ -1,22 +1,23 @@
|
|
|
1
|
-
import
|
|
1
|
+
import type * as Tool from '@effect/ai/Tool';
|
|
2
|
+
import * as Effect from 'effect/Effect';
|
|
2
3
|
import { type AiParser, type ConsolePrinter } from '@dxos/ai';
|
|
3
|
-
import { type
|
|
4
|
+
import { type Message } from '@dxos/types';
|
|
4
5
|
/**
|
|
5
6
|
* Live observer of the generation process.
|
|
6
7
|
*/
|
|
7
|
-
export interface GenerationObserver extends AiParser.ParseResponseCallbacks {
|
|
8
|
+
export interface GenerationObserver<Tools extends Record<string, Tool.Any> = any> extends AiParser.ParseResponseCallbacks<Tools> {
|
|
8
9
|
/**
|
|
9
10
|
* Complete messages fired during the session, both from the model and from the user.
|
|
10
11
|
* This message will contain all message blocks emitted through the `onBlock` callback.
|
|
11
12
|
*/
|
|
12
|
-
onMessage: (message:
|
|
13
|
+
onMessage: (message: Message.Message) => Effect.Effect<void>;
|
|
13
14
|
}
|
|
14
15
|
export declare const GenerationObserver: Readonly<{
|
|
15
16
|
make: ({ onBegin, onPart, onBlock, onEnd, onMessage, }?: Partial<GenerationObserver>) => GenerationObserver;
|
|
16
|
-
noop: () => GenerationObserver
|
|
17
|
+
noop: () => GenerationObserver<any>;
|
|
17
18
|
/**
|
|
18
19
|
* Debug printer to be used in unit-tests and browser devtools.
|
|
19
20
|
*/
|
|
20
|
-
fromPrinter: (printer: ConsolePrinter) => GenerationObserver
|
|
21
|
+
fromPrinter: (printer: ConsolePrinter) => GenerationObserver<any>;
|
|
21
22
|
}>;
|
|
22
23
|
//# sourceMappingURL=observer.d.ts.map
|
|
@@ -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,KAAK,IAAI,MAAM,iBAAiB,CAAC;AAC7C,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,kBAAkB,CACjC,KAAK,SAAS,MAAM,CAAC,MAAM,EAAE,IAAI,CAAC,GAAG,CAAC,GAAG,GAAG,CAC5C,SAAQ,QAAQ,CAAC,sBAAsB,CAAC,KAAK,CAAC;IAC9C;;;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"}
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
import type * as AiError from '@effect/ai/AiError';
|
|
2
|
+
import * as LanguageModel from '@effect/ai/LanguageModel';
|
|
3
|
+
import * as Effect from 'effect/Effect';
|
|
4
|
+
import { type AiToolNotFoundError, type OpaqueToolkit, type PromptPreprocessingError, type ToolExecutionService, type ToolResolverService } from '@dxos/ai';
|
|
5
|
+
import { type Blueprint, Trace, Operation, OperationRegistry } from '@dxos/compute';
|
|
6
|
+
import { Database, Obj } from '@dxos/echo';
|
|
7
|
+
import { ContentBlock, Message } from '@dxos/types';
|
|
8
|
+
import { type AiAssistantError } from '../errors';
|
|
9
|
+
import { GenerationObserver } from './observer';
|
|
10
|
+
export type AiRequestRunError = AiError.AiError | PromptPreprocessingError | AiToolNotFoundError | AiAssistantError;
|
|
11
|
+
export type AiRequestRunRequirements = LanguageModel.LanguageModel | ToolExecutionService | ToolResolverService | Database.Service | Operation.Service | OperationRegistry.Service | Trace.TraceService;
|
|
12
|
+
export type AiRequestOptions = {
|
|
13
|
+
/**
|
|
14
|
+
* Summarize before executing the prompt if the existing history exceeds this threshold.
|
|
15
|
+
*/
|
|
16
|
+
summarizationThreshold?: number;
|
|
17
|
+
observer?: GenerationObserver;
|
|
18
|
+
/**
|
|
19
|
+
* Callback for when a message is received from the user, model, or tool.
|
|
20
|
+
* This is useful for streaming the output to a queue.
|
|
21
|
+
*/
|
|
22
|
+
onOutput?: (message: Message.Message) => Effect.Effect<void, never, never>;
|
|
23
|
+
};
|
|
24
|
+
export type AiRequestRunProps<R = never> = {
|
|
25
|
+
prompt: string | ContentBlock.Any[];
|
|
26
|
+
system?: string;
|
|
27
|
+
history?: Message.Message[];
|
|
28
|
+
objects?: Obj.Unknown[];
|
|
29
|
+
blueprints?: readonly Blueprint.Blueprint[];
|
|
30
|
+
toolkit?: OpaqueToolkit.OpaqueToolkit<R>;
|
|
31
|
+
};
|
|
32
|
+
export type AiRequestBeginProps = {
|
|
33
|
+
prompt: string | ContentBlock.Any[];
|
|
34
|
+
system?: string;
|
|
35
|
+
history?: Message.Message[];
|
|
36
|
+
objects?: Obj.Unknown[];
|
|
37
|
+
blueprints?: readonly Blueprint.Blueprint[];
|
|
38
|
+
};
|
|
39
|
+
export type AiRequestTurnProps<R = never> = {
|
|
40
|
+
system: string;
|
|
41
|
+
toolkit?: OpaqueToolkit.OpaqueToolkit<R>;
|
|
42
|
+
};
|
|
43
|
+
export type AiRequestTurnResult = {
|
|
44
|
+
messages: Message.Message[];
|
|
45
|
+
done: boolean;
|
|
46
|
+
};
|
|
47
|
+
/**
|
|
48
|
+
* Contains message history, tools, current context.
|
|
49
|
+
* Current context means the state of the app, time of day, and other contextual information.
|
|
50
|
+
* It makes requests to the model, its a state machine.
|
|
51
|
+
* It keeps track of the current goal.
|
|
52
|
+
* It manages the context window.
|
|
53
|
+
* Tracks the success criteria of reaching the goal, exposing metrics (stretch).
|
|
54
|
+
* Could be run locally in the app or remotely.
|
|
55
|
+
* Could be personal or shared.
|
|
56
|
+
*/
|
|
57
|
+
export declare class AiRequest {
|
|
58
|
+
private readonly _options;
|
|
59
|
+
/** Prevents concurrent execution of session. */
|
|
60
|
+
private readonly _semaphore;
|
|
61
|
+
private readonly _observer;
|
|
62
|
+
private readonly _onOutput;
|
|
63
|
+
/** Message history from queue. */
|
|
64
|
+
private _history;
|
|
65
|
+
/** Pending messages for this session (incl. the current prompt). */
|
|
66
|
+
private _pending;
|
|
67
|
+
private _started;
|
|
68
|
+
private _ended;
|
|
69
|
+
private _toolCalls;
|
|
70
|
+
constructor(_options?: AiRequestOptions);
|
|
71
|
+
get duration(): number;
|
|
72
|
+
get toolCalls(): number;
|
|
73
|
+
get pending(): readonly Message.Message[];
|
|
74
|
+
private _submitMessage;
|
|
75
|
+
getToolCalls: () => {
|
|
76
|
+
block: {
|
|
77
|
+
readonly _tag: "toolCall";
|
|
78
|
+
readonly pending?: boolean | undefined;
|
|
79
|
+
readonly toolCallId: string;
|
|
80
|
+
readonly name: string;
|
|
81
|
+
readonly input: string;
|
|
82
|
+
readonly providerExecuted: boolean;
|
|
83
|
+
};
|
|
84
|
+
message: Message.Message;
|
|
85
|
+
}[];
|
|
86
|
+
/**
|
|
87
|
+
* Initialize a session: set up history, perform summarization if needed, and submit the user prompt.
|
|
88
|
+
* Must be called before `runTurn()`.
|
|
89
|
+
*/
|
|
90
|
+
begin: ({ prompt, system, history, blueprints, objects, }: AiRequestBeginProps) => Effect.Effect<void, AiRequestRunError, AiRequestRunRequirements>;
|
|
91
|
+
/**
|
|
92
|
+
* Execute a single turn: one LLM generation followed by tool execution.
|
|
93
|
+
* The toolkit and system prompt can be updated between turns to reflect context changes (e.g. dynamically enabled blueprints).
|
|
94
|
+
*/
|
|
95
|
+
runAgentTurn: <const R = never>({ system, toolkit: opaqueToolkit, }: AiRequestTurnProps<R>) => Effect.Effect<AiRequestTurnResult, AiRequestRunError, AiRequestRunRequirements | R>;
|
|
96
|
+
runTools: <const R = never>({ toolkit: opaqueToolkit, }: {
|
|
97
|
+
toolkit?: OpaqueToolkit.OpaqueToolkit<R>;
|
|
98
|
+
}) => Effect.Effect<void, AiRequestRunError, AiRequestRunRequirements | R>;
|
|
99
|
+
/**
|
|
100
|
+
* Run a full conversation turn loop. Equivalent to calling `begin()` then `runTurn()` in a loop.
|
|
101
|
+
*/
|
|
102
|
+
run: <const R = never>({ prompt, system: systemTemplate, history, objects, blueprints, toolkit, }: AiRequestRunProps<R>) => Effect.Effect<Message.Message[], AiRequestRunError, AiRequestRunRequirements | R>;
|
|
103
|
+
}
|
|
104
|
+
//# sourceMappingURL=request.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"request.d.ts","sourceRoot":"","sources":["../../../../src/session/request.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,KAAK,OAAO,MAAM,oBAAoB,CAAC;AACnD,OAAO,KAAK,aAAa,MAAM,0BAA0B,CAAC;AAG1D,OAAO,KAAK,MAAM,MAAM,eAAe,CAAC;AAKxC,OAAO,EAIL,KAAK,mBAAmB,EAExB,KAAK,aAAa,EAClB,KAAK,wBAAwB,EAC7B,KAAK,oBAAoB,EACzB,KAAK,mBAAmB,EAEzB,MAAM,UAAU,CAAC;AAClB,OAAO,EAAE,KAAK,SAAS,EAAE,KAAK,EAAE,SAAS,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAC;AACpF,OAAO,EAAE,QAAQ,EAAE,GAAG,EAAE,MAAM,YAAY,CAAC;AAE3C,OAAO,EAAE,YAAY,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AAEpD,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,QAAQ,CAAC,OAAO,GAChB,SAAS,CAAC,OAAO,GACjB,iBAAiB,CAAC,OAAO,GACzB,KAAK,CAAC,YAAY,CAAC;AAEvB,MAAM,MAAM,gBAAgB,GAAG;IAC7B;;OAEG;IACH,sBAAsB,CAAC,EAAE,MAAM,CAAC;IAGhC,QAAQ,CAAC,EAAE,kBAAkB,CAAC;IAC9B;;;OAGG;IACH,QAAQ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,OAAO,EAAE,EAAE,iBAAiB,EAAE,wBAAwB,GAAG,CAAC,CAAC,CAgB/B;CAC7E"}
|
|
@@ -1,14 +1,16 @@
|
|
|
1
|
-
import
|
|
2
|
-
import {
|
|
3
|
-
import { type
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
1
|
+
import * as Effect from 'effect/Effect';
|
|
2
|
+
import { type AiToolNotFoundError, OpaqueToolkit, ToolExecutionService, ToolResolverService } from '@dxos/ai';
|
|
3
|
+
import { type Blueprint } from '@dxos/compute';
|
|
4
|
+
export type CreateToolkitProps = {
|
|
5
|
+
toolkit?: OpaqueToolkit.Any;
|
|
6
|
+
blueprints?: readonly Blueprint.Blueprint[];
|
|
7
|
+
/**
|
|
8
|
+
* Self-contained with handlers toolkits.
|
|
9
|
+
*/
|
|
10
|
+
opaqueToolkits?: readonly OpaqueToolkit.Any[];
|
|
9
11
|
};
|
|
10
12
|
/**
|
|
11
13
|
* Build a combined toolkit from the blueprint tools and the provided toolkit.
|
|
12
14
|
*/
|
|
13
|
-
export declare const createToolkit:
|
|
15
|
+
export declare const createToolkit: ({ toolkit: toolkitProp, blueprints, opaqueToolkits, }: CreateToolkitProps) => Effect.Effect<OpaqueToolkit.OpaqueToolkit, AiToolNotFoundError, ToolResolverService | ToolExecutionService>;
|
|
14
16
|
//# sourceMappingURL=toolkit.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"toolkit.d.ts","sourceRoot":"","sources":["../../../../src/session/toolkit.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"toolkit.d.ts","sourceRoot":"","sources":["../../../../src/session/toolkit.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,MAAM,MAAM,eAAe,CAAC;AAGxC,OAAO,EAAE,KAAK,mBAAmB,EAAE,aAAa,EAAE,oBAAoB,EAAE,mBAAmB,EAAE,MAAM,UAAU,CAAC;AAC9G,OAAO,EAAE,KAAK,SAAS,EAAE,MAAM,eAAe,CAAC;AAG/C,MAAM,MAAM,kBAAkB,GAAG;IAC/B,OAAO,CAAC,EAAE,aAAa,CAAC,GAAG,CAAC;IAC5B,UAAU,CAAC,EAAE,SAAS,SAAS,CAAC,SAAS,EAAE,CAAC;IAC5C;;OAEG;IACH,cAAc,CAAC,EAAE,SAAS,aAAa,CAAC,GAAG,EAAE,CAAC;CAC/C,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,aAAa,0DAIvB,kBAAkB,KAAG,MAAM,CAAC,MAAM,CACnC,aAAa,CAAC,aAAa,EAC3B,mBAAmB,EACnB,mBAAmB,GAAG,oBAAoB,CAeuE,CAAC"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import
|
|
1
|
+
import * as Schema from 'effect/Schema';
|
|
2
|
+
import { type Obj } from '@dxos/echo';
|
|
2
3
|
import { type ObjectVersion } from '@dxos/echo-db';
|
|
3
|
-
import { type
|
|
4
|
-
import { type ContentBlock } from '@dxos/schema';
|
|
4
|
+
import { type ContentBlock } from '@dxos/types';
|
|
5
5
|
declare const VersionPinSchema: Schema.Struct<{
|
|
6
6
|
objectId: import("@dxos/keys").ObjectIdClass;
|
|
7
7
|
version: Schema.Schema<ObjectVersion, ObjectVersion, never>;
|
|
@@ -14,7 +14,7 @@ export interface VersionPin extends Schema.Schema.Type<typeof VersionPinSchema>
|
|
|
14
14
|
}
|
|
15
15
|
export declare const VersionPin: typeof VersionPinSchema & {
|
|
16
16
|
DISPOSITION: 'version-pin';
|
|
17
|
-
fromObject: (object:
|
|
17
|
+
fromObject: (object: Obj.Unknown) => VersionPin;
|
|
18
18
|
createBlock: (pin: VersionPin) => ContentBlock.Any;
|
|
19
19
|
};
|
|
20
20
|
export {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"version-pin.d.ts","sourceRoot":"","sources":["../../../../src/session/version-pin.ts"],"names":[],"mappings":"AAIA,OAAO,
|
|
1
|
+
{"version":3,"file":"version-pin.d.ts","sourceRoot":"","sources":["../../../../src/session/version-pin.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,MAAM,MAAM,eAAe,CAAC;AAExC,OAAO,EAAE,KAAK,GAAG,EAAE,MAAM,YAAY,CAAC;AACtC,OAAO,EAAE,KAAK,aAAa,EAAc,MAAM,eAAe,CAAC;AAE/D,OAAO,EAAE,KAAK,YAAY,EAAE,MAAM,aAAa,CAAC;AAKhD,QAAA,MAAM,gBAAgB;;;EAKpB,CAAC;AAEH;;;GAGG;AACH,MAAM,WAAW,UAAW,SAAQ,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,gBAAgB,CAAC;CAAG;AAElF,eAAO,MAAM,UAAU,EAAE,OAAO,gBAAgB,GAAG;IACjD,WAAW,EAAE,aAAa,CAAC;IAC3B,UAAU,EAAE,CAAC,MAAM,EAAE,GAAG,CAAC,OAAO,KAAK,UAAU,CAAC;IAChD,WAAW,EAAE,CAAC,GAAG,EAAE,UAAU,KAAK,YAAY,CAAC,GAAG,CAAC;CAiBpD,CAAC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { type ModelCapabilities } from '@dxos/ai';
|
|
2
|
-
import { Template } from '@dxos/
|
|
2
|
+
import { Template } from '@dxos/compute';
|
|
3
3
|
/**
|
|
4
4
|
* System template variables.
|
|
5
5
|
*/
|
|
@@ -12,7 +12,6 @@ export type SystemPromptOptions = ModelCapabilities & {
|
|
|
12
12
|
*/
|
|
13
13
|
export declare const createSystemPrompt: (options?: Partial<SystemPromptOptions>) => string;
|
|
14
14
|
export declare const templates: {
|
|
15
|
-
/** Editable system prompt.*/
|
|
16
15
|
system: Template.Template;
|
|
17
16
|
};
|
|
18
17
|
//# sourceMappingURL=system.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"system.d.ts","sourceRoot":"","sources":["../../../../src/templates/system.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,KAAK,iBAAiB,EAAE,MAAM,UAAU,CAAC;AAClD,OAAO,EAAE,QAAQ,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"system.d.ts","sourceRoot":"","sources":["../../../../src/templates/system.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,KAAK,iBAAiB,EAAE,MAAM,UAAU,CAAC;AAClD,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAKzC;;GAEG;AACH,MAAM,MAAM,mBAAmB,GAAG,iBAAiB,GAAG;IACpD,QAAQ,EAAE,MAAM,CAAC;CAClB,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,kBAAkB,aAAa,OAAO,CAAC,mBAAmB,CAAC,WAMrE,CAAC;AAOJ,eAAO,MAAM,SAAS;IACpB,MAAM;CAIP,CAAC"}
|