@dxos/assistant 0.8.4-main.fd6878d → 0.8.4-staging.60fe92afc8
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/LICENSE +102 -5
- package/README.md +2 -1
- package/dist/lib/neutral/chunk-J5LGTIGS.mjs +10 -0
- package/dist/lib/neutral/extraction/index.mjs +208 -0
- package/dist/lib/neutral/extraction/index.mjs.map +7 -0
- package/dist/lib/neutral/index.mjs +1886 -0
- package/dist/lib/neutral/index.mjs.map +7 -0
- package/dist/lib/neutral/meta.json +1 -0
- 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 +1650 -281
- 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 +16 -5
- package/dist/types/src/functions/services.d.ts.map +1 -1
- package/dist/types/src/index.d.ts +2 -3
- package/dist/types/src/index.d.ts.map +1 -1
- package/dist/types/src/request/AiRequest.d.ts +308 -0
- package/dist/types/src/request/AiRequest.d.ts.map +1 -0
- package/dist/types/src/{session → request}/artifact-diff.d.ts +5 -5
- package/dist/types/src/request/artifact-diff.d.ts.map +1 -0
- package/dist/types/src/request/format.d.ts +15 -0
- package/dist/types/src/request/format.d.ts.map +1 -0
- package/dist/types/src/request/index.d.ts +4 -0
- package/dist/types/src/request/index.d.ts.map +1 -0
- package/dist/types/src/request/observer.d.ts +23 -0
- package/dist/types/src/request/observer.d.ts.map +1 -0
- package/dist/types/src/{session → request}/version-pin.d.ts +6 -6
- package/dist/types/src/request/version-pin.d.ts.map +1 -0
- package/dist/types/src/session/AiContext.d.ts +178 -0
- package/dist/types/src/session/AiContext.d.ts.map +1 -0
- package/dist/types/src/session/AiContext.test.d.ts +2 -0
- package/dist/types/src/session/AiContext.test.d.ts.map +1 -0
- package/dist/types/src/session/AiSession.d.ts +79 -0
- package/dist/types/src/session/AiSession.d.ts.map +1 -0
- package/dist/types/src/session/AiSession.test.d.ts +2 -0
- package/dist/types/src/session/AiSession.test.d.ts.map +1 -0
- package/dist/types/src/session/SessionLink.d.ts +17 -0
- package/dist/types/src/session/SessionLink.d.ts.map +1 -0
- package/dist/types/src/session/SessionLoader.d.ts +15 -0
- package/dist/types/src/session/SessionLoader.d.ts.map +1 -0
- package/dist/types/src/session/SessionLoader.test.d.ts +2 -0
- package/dist/types/src/session/SessionLoader.test.d.ts.map +1 -0
- package/dist/types/src/session/index.d.ts +5 -3
- package/dist/types/src/session/index.d.ts.map +1 -1
- package/dist/types/src/session/toolkit.d.ts +16 -0
- package/dist/types/src/session/toolkit.d.ts.map +1 -0
- package/dist/types/src/templates/system.d.ts +19 -14
- package/dist/types/src/templates/system.d.ts.map +1 -1
- package/dist/types/src/util/artifact.d.ts +18 -0
- package/dist/types/src/util/artifact.d.ts.map +1 -0
- package/dist/types/src/util/diff.d.ts +17 -0
- package/dist/types/src/util/diff.d.ts.map +1 -0
- package/dist/types/src/util/diff.test.d.ts +2 -0
- package/dist/types/src/util/diff.test.d.ts.map +1 -0
- package/dist/types/src/util/error-handling.d.ts +4 -0
- package/dist/types/src/util/error-handling.d.ts.map +1 -0
- package/dist/types/src/util/errors.d.ts +67 -0
- package/dist/types/src/util/errors.d.ts.map +1 -0
- package/dist/types/src/util/execution-graph.d.ts +85 -0
- package/dist/types/src/util/execution-graph.d.ts.map +1 -0
- package/dist/types/src/util/execution-graph.test.d.ts +2 -0
- package/dist/types/src/util/execution-graph.test.d.ts.map +1 -0
- package/dist/types/src/util/index.d.ts +7 -0
- package/dist/types/src/util/index.d.ts.map +1 -0
- package/dist/types/src/util/tracing.d.ts +296 -0
- package/dist/types/src/util/tracing.d.ts.map +1 -0
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +37 -47
- package/src/extraction/extraction-ner-function/index.ts +0 -1
- package/src/extraction/extraction-ner-function/named-entity-recognition.test.ts +12 -6
- package/src/extraction/extraction-ner-function/named-entity-recognition.ts +2 -0
- package/src/extraction/extraction.ts +49 -19
- package/src/extraction/index.ts +0 -1
- package/src/extraction/quotes.test.ts +2 -2
- package/src/extraction/quotes.ts +7 -9
- package/src/functions/services.ts +180 -66
- package/src/index.ts +2 -3
- package/src/request/AiRequest.ts +387 -0
- package/src/{session → request}/artifact-diff.ts +10 -6
- package/src/{session → request}/format.ts +45 -37
- package/src/request/index.ts +8 -0
- package/src/request/observer.ts +62 -0
- package/src/{session → request}/version-pin.ts +8 -8
- package/src/session/AiContext.test.ts +49 -0
- package/src/session/AiContext.ts +420 -0
- package/src/session/AiSession.test.ts +111 -0
- package/src/session/AiSession.ts +328 -0
- package/src/session/SessionLink.ts +23 -0
- package/src/session/SessionLoader.test.ts +115 -0
- package/src/session/SessionLoader.ts +55 -0
- package/src/session/index.ts +6 -3
- package/src/session/toolkit.ts +47 -0
- package/src/templates/{format.tpl → instructions/format.tpl} +6 -4
- package/src/templates/instructions/system.tpl +96 -0
- package/src/templates/system.ts +26 -16
- package/src/util/artifact.ts +96 -0
- package/src/util/diff.test.ts +74 -0
- package/src/util/diff.ts +93 -0
- package/src/util/error-handling.ts +42 -0
- package/src/util/errors.ts +15 -0
- package/src/util/execution-graph.test.ts +740 -0
- package/src/util/execution-graph.ts +520 -0
- package/src/util/index.ts +10 -0
- package/src/util/tracing.ts +60 -0
- package/dist/lib/browser/chunk-6WRGDEMH.mjs +0 -89
- package/dist/lib/browser/chunk-6WRGDEMH.mjs.map +0 -7
- package/dist/lib/browser/chunk-NZGGCEF3.mjs +0 -341
- package/dist/lib/browser/chunk-NZGGCEF3.mjs.map +0 -7
- package/dist/lib/browser/extraction/index.mjs +0 -269
- package/dist/lib/browser/extraction/index.mjs.map +0 -7
- package/dist/lib/browser/index.mjs +0 -354
- package/dist/lib/browser/index.mjs.map +0 -7
- package/dist/lib/browser/meta.json +0 -1
- package/dist/lib/browser/named-entity-recognition-O46UTCLR.mjs +0 -13
- package/dist/lib/node-esm/chunk-3UU5V4FS.mjs +0 -91
- package/dist/lib/node-esm/chunk-3UU5V4FS.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-XOOPGSGW.mjs +0 -343
- package/dist/lib/node-esm/chunk-XOOPGSGW.mjs.map +0 -7
- package/dist/lib/node-esm/extraction/index.mjs +0 -270
- package/dist/lib/node-esm/extraction/index.mjs.map +0 -7
- package/dist/lib/node-esm/index.mjs +0 -355
- 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-W4VMRCH6.mjs +0 -14
- package/dist/lib/node-esm/named-entity-recognition-W4VMRCH6.mjs.map +0 -7
- package/dist/types/src/conversation/context.d.ts +0 -90
- package/dist/types/src/conversation/context.d.ts.map +0 -1
- package/dist/types/src/conversation/conversation.d.ts +0 -50
- package/dist/types/src/conversation/conversation.d.ts.map +0 -1
- package/dist/types/src/conversation/index.d.ts +0 -3
- package/dist/types/src/conversation/index.d.ts.map +0 -1
- package/dist/types/src/errors.d.ts +0 -39
- package/dist/types/src/errors.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 -306
- 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/artifact-diff.d.ts.map +0 -1
- package/dist/types/src/session/format.d.ts +0 -168
- package/dist/types/src/session/format.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 -167
- 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/session/version-pin.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/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/context.ts +0 -133
- package/src/conversation/conversation.ts +0 -125
- package/src/conversation/index.ts +0 -6
- package/src/errors.ts +0 -10
- package/src/extraction/extraction-llm-function/extraction-llm-function.test.ts +0 -84
- package/src/extraction/extraction-llm-function/extraction-llm-function.ts +0 -71
- package/src/extraction/extraction-llm-function/index.ts +0 -5
- package/src/extraction/extraction-ner-function/extraction-ner-function.test.ts +0 -116
- package/src/extraction/extraction-ner-function/extraction-ner-function.ts +0 -57
- package/src/session/__snapshots__/session.test.ts.snap +0 -32
- package/src/session/format.test.ts +0 -60
- package/src/session/session.test.ts +0 -305
- package/src/session/session.ts +0 -279
- package/src/session/version-pin.test.ts +0 -7
- package/src/summarization/summarization.test.ts +0 -197
- package/src/templates/system.tpl +0 -47
- package/src/types.ts +0 -52
- /package/dist/lib/{browser/named-entity-recognition-O46UTCLR.mjs.map → neutral/chunk-J5LGTIGS.mjs.map} +0 -0
- /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,EAAQ,MAAM,YAAY,CAAC;AAKvC,eAAO,MAAM,eAAe;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAS1B,CAAC;AACH,MAAM,MAAM,eAAe,GAAG,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,eAAe,CAAC,CAAC;AACzE,eAAO,MAAM,gBAAgB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;SAStC,CAAC;AAEH;;;GAGG;AACH,eAAO,MAAM,qBAAqB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;SAShC,CAAC;AAEH;;GAEG;AAEH,eAAO,MAAM,wBAAwB,WAAkB,6BAA6B,KAAG,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;AAI1D,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,7 +1,18 @@
|
|
|
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
|
-
|
|
6
|
+
import { OpaqueToolkit } from '@dxos/ai';
|
|
7
|
+
import { Operation } from '@dxos/compute';
|
|
8
|
+
import { Registry } from '@dxos/echo';
|
|
9
|
+
export declare const makeToolResolverFromOperations: <R = never>({ toolkit: extraToolkit, }?: {
|
|
10
|
+
toolkit?: OpaqueToolkit.OpaqueToolkit<never, never, R>;
|
|
11
|
+
}) => Layer.Layer<ToolResolverService, never, OpaqueToolkit.OpaqueToolkitProvider | Registry.Service | R>;
|
|
12
|
+
export declare const makeToolExecutionService: <E, R>(opts: {
|
|
13
|
+
invoke: (tool: Tool.Any, input: unknown) => Effect.Effect<unknown>;
|
|
14
|
+
}) => Layer.Layer<ToolExecutionService, never, OpaqueToolkit.OpaqueToolkitProvider>;
|
|
15
|
+
export declare const makeToolExecutionServiceFromOperationInvoker: () => Layer.Layer<ToolExecutionService, never, Operation.Service | OpaqueToolkit.OpaqueToolkitProvider>;
|
|
16
|
+
export declare const ToolExecutionServices: Layer.Layer<ToolExecutionService | ToolResolverService, never, OpaqueToolkit.OpaqueToolkitProvider | Registry.Service | Operation.Service>;
|
|
17
|
+
export declare const getOperationFromTool: (tool: Tool.Any) => Option.Option<Operation.Definition.Any>;
|
|
7
18
|
//# 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,MAAM,eAAe,CAAC;AAE1C,OAAO,EAAoB,QAAQ,EAAE,MAAM,YAAY,CAAC;AAKxD,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,QAAQ,CAAC,OAAO,GAAG,CAAC,CA8B3D,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,4IAGjC,CAAC;AAOF,eAAO,MAAM,oBAAoB,SAAU,IAAI,CAAC,GAAG,KAAG,MAAM,CAAC,MAAM,CAAC,SAAS,CAAC,UAAU,CAAC,GAAG,CAE3F,CAAC"}
|
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
export * from './conversation';
|
|
2
1
|
export * from './functions';
|
|
2
|
+
export * from './request';
|
|
3
3
|
export * from './session';
|
|
4
4
|
export * from './templates';
|
|
5
|
-
export * from './
|
|
6
|
-
export * from './errors';
|
|
5
|
+
export * from './util';
|
|
7
6
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -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,aAAa,CAAC;AAC5B,cAAc,WAAW,CAAC;AAC1B,cAAc,WAAW,CAAC;AAC1B,cAAc,aAAa,CAAC;AAC5B,cAAc,QAAQ,CAAC"}
|
|
@@ -0,0 +1,308 @@
|
|
|
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 } from '@dxos/compute';
|
|
6
|
+
import { Database, Obj, Registry } from '@dxos/echo';
|
|
7
|
+
import { ContentBlock, Message } from '@dxos/types';
|
|
8
|
+
import { type AiAssistantError } from '../util';
|
|
9
|
+
import { GenerationObserver } from './observer';
|
|
10
|
+
export type RunError = AiError.AiError | PromptPreprocessingError | AiToolNotFoundError | AiAssistantError;
|
|
11
|
+
export type RunRequirements = LanguageModel.LanguageModel | ToolExecutionService | ToolResolverService | Database.Service | Operation.Service | Registry.Service | Trace.TraceService;
|
|
12
|
+
export type Options = {
|
|
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 RunProps<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 BeginProps = {
|
|
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 TurnProps<R = never> = {
|
|
40
|
+
system: string;
|
|
41
|
+
toolkit?: OpaqueToolkit.OpaqueToolkit<R>;
|
|
42
|
+
};
|
|
43
|
+
export type TurnResult = {
|
|
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 Request {
|
|
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?: Options);
|
|
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
|
+
readonly operationKey?: string | undefined;
|
|
84
|
+
readonly operationName?: string | undefined;
|
|
85
|
+
readonly operationIcon?: string | undefined;
|
|
86
|
+
};
|
|
87
|
+
message: {
|
|
88
|
+
readonly id: string;
|
|
89
|
+
readonly parentMessage?: string | undefined;
|
|
90
|
+
readonly threadId?: string | undefined;
|
|
91
|
+
readonly created: string;
|
|
92
|
+
readonly sender: {
|
|
93
|
+
readonly role?: "assistant" | "tool" | "user" | undefined;
|
|
94
|
+
readonly contact?: import("@dxos/echo/internal").Ref<{
|
|
95
|
+
readonly fullName?: string | undefined;
|
|
96
|
+
readonly preferredName?: string | undefined;
|
|
97
|
+
readonly nickname?: string | undefined;
|
|
98
|
+
readonly image?: string | undefined;
|
|
99
|
+
readonly organization?: import("@dxos/echo/internal").Ref<{
|
|
100
|
+
readonly name?: string | undefined;
|
|
101
|
+
readonly description?: string | undefined;
|
|
102
|
+
readonly status?: "active" | "commit" | "prospect" | "qualified" | "reject" | undefined;
|
|
103
|
+
readonly image?: string | undefined;
|
|
104
|
+
readonly website?: string | undefined;
|
|
105
|
+
} & {
|
|
106
|
+
readonly location?: readonly [number, number, (number | undefined)?] | undefined;
|
|
107
|
+
} & import("@dxos/echo/Entity").OfKind<import("@dxos/echo/internal").EntityKind.Object> & Obj.Unknown> | undefined;
|
|
108
|
+
readonly jobTitle?: string | undefined;
|
|
109
|
+
readonly department?: string | undefined;
|
|
110
|
+
readonly notes?: string | undefined;
|
|
111
|
+
readonly emails?: readonly {
|
|
112
|
+
readonly label?: string | undefined;
|
|
113
|
+
readonly value: string;
|
|
114
|
+
}[] | undefined;
|
|
115
|
+
readonly identities?: readonly {
|
|
116
|
+
readonly label?: string | undefined;
|
|
117
|
+
readonly value: string;
|
|
118
|
+
}[] | undefined;
|
|
119
|
+
readonly phoneNumbers?: readonly {
|
|
120
|
+
readonly label?: string | undefined;
|
|
121
|
+
readonly value: string;
|
|
122
|
+
}[] | undefined;
|
|
123
|
+
readonly addresses?: readonly {
|
|
124
|
+
readonly label?: string | undefined;
|
|
125
|
+
readonly value: {
|
|
126
|
+
readonly street?: string | undefined;
|
|
127
|
+
readonly extended?: string | undefined;
|
|
128
|
+
readonly locality?: string | undefined;
|
|
129
|
+
readonly region?: string | undefined;
|
|
130
|
+
readonly postalCode?: string | undefined;
|
|
131
|
+
readonly postOfficeBoxNumber?: string | undefined;
|
|
132
|
+
readonly country?: string | undefined;
|
|
133
|
+
};
|
|
134
|
+
}[] | undefined;
|
|
135
|
+
readonly urls?: readonly {
|
|
136
|
+
readonly label?: string | undefined;
|
|
137
|
+
readonly value: string;
|
|
138
|
+
}[] | undefined;
|
|
139
|
+
readonly birthday?: string | undefined;
|
|
140
|
+
readonly fields?: readonly {
|
|
141
|
+
readonly category?: string | undefined;
|
|
142
|
+
readonly label: string;
|
|
143
|
+
readonly value: string;
|
|
144
|
+
}[] | undefined;
|
|
145
|
+
} & {
|
|
146
|
+
readonly location?: readonly [number, number, (number | undefined)?] | undefined;
|
|
147
|
+
} & import("@dxos/echo/Entity").OfKind<import("@dxos/echo/internal").EntityKind.Object> & Obj.Unknown> | undefined;
|
|
148
|
+
readonly identityDid?: string | undefined;
|
|
149
|
+
readonly identityKey?: string | undefined;
|
|
150
|
+
readonly email?: string | undefined;
|
|
151
|
+
readonly name?: string | undefined;
|
|
152
|
+
};
|
|
153
|
+
readonly blocks: readonly ({
|
|
154
|
+
readonly _tag: "anchor";
|
|
155
|
+
readonly pending?: boolean | undefined;
|
|
156
|
+
readonly objectId: string;
|
|
157
|
+
readonly version: unknown;
|
|
158
|
+
} | {
|
|
159
|
+
readonly _tag: "file";
|
|
160
|
+
readonly pending?: boolean | undefined;
|
|
161
|
+
readonly url: string;
|
|
162
|
+
readonly name?: string | undefined;
|
|
163
|
+
readonly mediaType?: string | undefined;
|
|
164
|
+
} | {
|
|
165
|
+
readonly _tag: "image";
|
|
166
|
+
readonly pending?: boolean | undefined;
|
|
167
|
+
readonly id?: string | undefined;
|
|
168
|
+
readonly source?: {
|
|
169
|
+
readonly type: "base64";
|
|
170
|
+
readonly mediaType: string;
|
|
171
|
+
readonly data: string;
|
|
172
|
+
} | {
|
|
173
|
+
readonly type: "http";
|
|
174
|
+
readonly url: string;
|
|
175
|
+
} | undefined;
|
|
176
|
+
} | {
|
|
177
|
+
readonly _tag: "json";
|
|
178
|
+
readonly pending?: boolean | undefined;
|
|
179
|
+
readonly disposition?: "cot" | "synthetic" | "user" | "version-pin" | undefined;
|
|
180
|
+
readonly data: string;
|
|
181
|
+
} | {
|
|
182
|
+
readonly _tag: "proposal";
|
|
183
|
+
readonly pending?: boolean | undefined;
|
|
184
|
+
readonly text: string;
|
|
185
|
+
} | {
|
|
186
|
+
readonly _tag: "reasoning";
|
|
187
|
+
readonly pending?: boolean | undefined;
|
|
188
|
+
readonly reasoningText?: string | undefined;
|
|
189
|
+
readonly redactedText?: string | undefined;
|
|
190
|
+
readonly signature?: string | undefined;
|
|
191
|
+
} | {
|
|
192
|
+
readonly _tag: "reference";
|
|
193
|
+
readonly pending?: boolean | undefined;
|
|
194
|
+
readonly reference: import("@dxos/echo/internal").Ref<Obj.Unknown>;
|
|
195
|
+
} | {
|
|
196
|
+
readonly _tag: "select";
|
|
197
|
+
readonly pending?: boolean | undefined;
|
|
198
|
+
readonly options: string[];
|
|
199
|
+
} | {
|
|
200
|
+
readonly _tag: "status";
|
|
201
|
+
readonly pending?: boolean | undefined;
|
|
202
|
+
readonly statusText: string;
|
|
203
|
+
} | {
|
|
204
|
+
readonly _tag: "suggestion";
|
|
205
|
+
readonly pending?: boolean | undefined;
|
|
206
|
+
readonly text: string;
|
|
207
|
+
} | {
|
|
208
|
+
readonly _tag: "stats";
|
|
209
|
+
readonly pending?: boolean | undefined;
|
|
210
|
+
readonly mimeType?: string | undefined;
|
|
211
|
+
readonly message?: string | undefined;
|
|
212
|
+
readonly model?: string | undefined;
|
|
213
|
+
readonly usage?: {
|
|
214
|
+
readonly inputTokens?: number | undefined;
|
|
215
|
+
readonly outputTokens?: number | undefined;
|
|
216
|
+
readonly totalTokens?: number | undefined;
|
|
217
|
+
} | undefined;
|
|
218
|
+
readonly toolCalls?: number | undefined;
|
|
219
|
+
readonly errors?: number | undefined;
|
|
220
|
+
readonly duration?: number | undefined;
|
|
221
|
+
} | {
|
|
222
|
+
readonly _tag: "text";
|
|
223
|
+
readonly pending?: boolean | undefined;
|
|
224
|
+
readonly mimeType?: string | undefined;
|
|
225
|
+
readonly text: string;
|
|
226
|
+
readonly disposition?: "cot" | "synthetic" | "user" | "version-pin" | undefined;
|
|
227
|
+
} | {
|
|
228
|
+
readonly _tag: "summary";
|
|
229
|
+
readonly pending?: boolean | undefined;
|
|
230
|
+
readonly content: string;
|
|
231
|
+
} | {
|
|
232
|
+
readonly _tag: "toolkit";
|
|
233
|
+
readonly pending?: boolean | undefined;
|
|
234
|
+
} | {
|
|
235
|
+
readonly _tag: "toolCall";
|
|
236
|
+
readonly pending?: boolean | undefined;
|
|
237
|
+
readonly toolCallId: string;
|
|
238
|
+
readonly name: string;
|
|
239
|
+
readonly input: string;
|
|
240
|
+
readonly providerExecuted: boolean;
|
|
241
|
+
readonly operationKey?: string | undefined;
|
|
242
|
+
readonly operationName?: string | undefined;
|
|
243
|
+
readonly operationIcon?: string | undefined;
|
|
244
|
+
} | {
|
|
245
|
+
readonly _tag: "toolResult";
|
|
246
|
+
readonly pending?: boolean | undefined;
|
|
247
|
+
readonly toolCallId: string;
|
|
248
|
+
readonly name: string;
|
|
249
|
+
readonly result?: string | {
|
|
250
|
+
readonly _tag: "~@dxos/types/ContentBlock.ContentBlockResult";
|
|
251
|
+
readonly content: readonly ({
|
|
252
|
+
readonly _tag: "file";
|
|
253
|
+
readonly pending?: boolean | undefined;
|
|
254
|
+
readonly url: string;
|
|
255
|
+
readonly name?: string | undefined;
|
|
256
|
+
readonly mediaType?: string | undefined;
|
|
257
|
+
} | {
|
|
258
|
+
readonly _tag: "image";
|
|
259
|
+
readonly pending?: boolean | undefined;
|
|
260
|
+
readonly id?: string | undefined;
|
|
261
|
+
readonly source?: {
|
|
262
|
+
readonly type: "base64";
|
|
263
|
+
readonly mediaType: string;
|
|
264
|
+
readonly data: string;
|
|
265
|
+
} | {
|
|
266
|
+
readonly type: "http";
|
|
267
|
+
readonly url: string;
|
|
268
|
+
} | undefined;
|
|
269
|
+
} | {
|
|
270
|
+
readonly _tag: "text";
|
|
271
|
+
readonly pending?: boolean | undefined;
|
|
272
|
+
readonly mimeType?: string | undefined;
|
|
273
|
+
readonly text: string;
|
|
274
|
+
readonly disposition?: "cot" | "synthetic" | "user" | "version-pin" | undefined;
|
|
275
|
+
})[];
|
|
276
|
+
} | undefined;
|
|
277
|
+
readonly error?: string | undefined;
|
|
278
|
+
readonly providerExecuted: boolean;
|
|
279
|
+
} | {
|
|
280
|
+
readonly _tag: "transcript";
|
|
281
|
+
readonly pending?: boolean | undefined;
|
|
282
|
+
readonly started: string;
|
|
283
|
+
readonly text: string;
|
|
284
|
+
})[];
|
|
285
|
+
readonly properties?: {
|
|
286
|
+
readonly [x: string]: any;
|
|
287
|
+
} | undefined;
|
|
288
|
+
} & import("@dxos/echo/Entity").OfKind<import("@dxos/echo/internal").EntityKind.Object>;
|
|
289
|
+
}[];
|
|
290
|
+
/**
|
|
291
|
+
* Initialize a session: set up history, perform summarization if needed, and submit the user prompt.
|
|
292
|
+
* Must be called before `runTurn()`.
|
|
293
|
+
*/
|
|
294
|
+
begin: ({ prompt, system, history, blueprints, objects, }: BeginProps) => Effect.Effect<void, RunError, RunRequirements>;
|
|
295
|
+
/**
|
|
296
|
+
* Execute a single turn: one LLM generation followed by tool execution.
|
|
297
|
+
* The toolkit and system prompt can be updated between turns to reflect context changes (e.g. dynamically enabled blueprints).
|
|
298
|
+
*/
|
|
299
|
+
runAgentTurn: <const R = never>({ system, toolkit: opaqueToolkit, }: TurnProps<R>) => Effect.Effect<TurnResult, RunError, RunRequirements | R>;
|
|
300
|
+
runTools: <const R = never>({ toolkit: opaqueToolkit, }: {
|
|
301
|
+
toolkit?: OpaqueToolkit.OpaqueToolkit<R>;
|
|
302
|
+
}) => Effect.Effect<void, RunError, RunRequirements | R>;
|
|
303
|
+
/**
|
|
304
|
+
* Run a full conversation turn loop. Equivalent to calling `begin()` then `runTurn()` in a loop.
|
|
305
|
+
*/
|
|
306
|
+
run: <const R = never>({ prompt, system: systemTemplate, history, objects, blueprints, toolkit, }: RunProps<R>) => Effect.Effect<Message.Message[], RunError, RunRequirements | R>;
|
|
307
|
+
}
|
|
308
|
+
//# sourceMappingURL=AiRequest.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AiRequest.d.ts","sourceRoot":"","sources":["../../../../src/request/AiRequest.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,KAAK,OAAO,MAAM,oBAAoB,CAAC;AACnD,OAAO,KAAK,aAAa,MAAM,0BAA0B,CAAC;AAI1D,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,MAAM,eAAe,CAAC;AACjE,OAAO,EAAE,QAAQ,EAAE,GAAG,EAA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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;QAQR;IAEJ;;;OAGG;IACH,KAAK,sDAMF,UAAU,KAAG,MAAM,CAAC,MAAM,CAAC,IAAI,EAAE,QAAQ,EAAE,eAAe,CAAC,CAqBhB;IAE9C;;;OAGG;IACH,YAAY,GAAI,KAAK,CAAC,CAAC,GAAG,KAAK,uCAG5B,SAAS,CAAC,CAAC,CAAC,KAAG,MAAM,CAAC,MAAM,CAAC,UAAU,EAAE,QAAQ,EAAE,eAAe,GAAG,CAAC,CAAC,CA4ErB;IAErD,QAAQ,GAAI,KAAK,CAAC,CAAC,GAAG,KAAK,+BAExB;QACD,OAAO,CAAC,EAAE,aAAa,CAAC,aAAa,CAAC,CAAC,CAAC,CAAC;KAC1C,KAAG,MAAM,CAAC,MAAM,CAAC,IAAI,EAAE,QAAQ,EAAE,eAAe,GAAG,CAAC,CAAC,CAoBL;IAEjD;;OAEG;IACH,GAAG,GAAI,KAAK,CAAC,CAAC,GAAG,KAAK,8EAOnB,QAAQ,CAAC,CAAC,CAAC,KAAG,MAAM,CAAC,MAAM,CAAC,OAAO,CAAC,OAAO,EAAE,EAAE,QAAQ,EAAE,eAAe,GAAG,CAAC,CAAC,CAgBJ;CAC7E"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { type ObjectVersion } from '@dxos/echo-
|
|
3
|
-
import { type
|
|
1
|
+
import * as Context from 'effect/Context';
|
|
2
|
+
import { type ObjectVersion } from '@dxos/echo-client';
|
|
3
|
+
import { type EntityId } 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.
|
|
@@ -15,9 +15,9 @@ export declare class ArtifactDiffResolver extends ArtifactDiffResolver_base {
|
|
|
15
15
|
export declare namespace ArtifactDiffResolver {
|
|
16
16
|
type Service = {
|
|
17
17
|
resolve: (artifacts: {
|
|
18
|
-
id:
|
|
18
|
+
id: EntityId;
|
|
19
19
|
lastVersion: ObjectVersion;
|
|
20
|
-
}[]) => Promise<Map<
|
|
20
|
+
}[]) => Promise<Map<EntityId, {
|
|
21
21
|
version: ObjectVersion;
|
|
22
22
|
diff?: string;
|
|
23
23
|
}>>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"artifact-diff.d.ts","sourceRoot":"","sources":["../../../../src/request/artifact-diff.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,OAAO,MAAM,gBAAgB,CAAC;AAE1C,OAAO,EAAE,KAAK,aAAa,EAAE,MAAM,mBAAmB,CAAC;AACvD,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"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import * as Effect from 'effect/Effect';
|
|
2
|
+
import { type FunctionNotFoundError, type Operation } from '@dxos/compute';
|
|
3
|
+
import { type Database, type Registry } from '@dxos/echo';
|
|
4
|
+
import { type EntityNotFoundError } from '@dxos/echo/Err';
|
|
5
|
+
import { Message } from '@dxos/types';
|
|
6
|
+
import type * as AiRequest from './AiRequest';
|
|
7
|
+
/**
|
|
8
|
+
* Formats the system prompt.
|
|
9
|
+
*/
|
|
10
|
+
export declare const formatSystemPrompt: ({ system, blueprints, objects, }: Pick<AiRequest.RunProps, 'system' | 'blueprints' | 'objects'>) => Effect.Effect<string, FunctionNotFoundError | EntityNotFoundError, Database.Service | Registry.Service | Operation.Service>;
|
|
11
|
+
/**
|
|
12
|
+
* Formats the user prompt.
|
|
13
|
+
*/
|
|
14
|
+
export declare const formatUserPrompt: ({ prompt, history, }: Pick<AiRequest.RunProps, 'prompt' | 'history'>) => Effect.Effect<Message.Message, AiRequest.RunError>;
|
|
15
|
+
//# sourceMappingURL=format.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"format.d.ts","sourceRoot":"","sources":["../../../../src/request/format.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,MAAM,MAAM,eAAe,CAAC;AAIxC,OAAO,EAAE,KAAK,qBAAqB,EAAE,KAAK,SAAS,EAAY,MAAM,eAAe,CAAC;AACrF,OAAO,EAAE,KAAK,QAAQ,EAAO,KAAK,QAAQ,EAAE,MAAM,YAAY,CAAC;AAE/D,OAAO,EAAE,KAAK,mBAAmB,EAAE,MAAM,gBAAgB,CAAC;AAG1D,OAAO,EAAqB,OAAO,EAAE,MAAM,aAAa,CAAC;AAIzD,OAAO,KAAK,KAAK,SAAS,MAAM,aAAa,CAAC;AAG9C;;GAEG;AAEH,eAAO,MAAM,kBAAkB,qCAI5B,IAAI,CAAC,SAAS,CAAC,QAAQ,EAAE,QAAQ,GAAG,YAAY,GAAG,SAAS,CAAC,KAAG,MAAM,CAAC,MAAM,CAC9E,MAAM,EACN,qBAAqB,GAAG,mBAAmB,EAC3C,QAAQ,CAAC,OAAO,GAAG,QAAQ,CAAC,OAAO,GAAG,SAAS,CAAC,OAAO,CAuCT,CAAC;AAEjD;;GAEG;AAGH,eAAO,MAAM,gBAAgB,yBAG1B,IAAI,CAAC,SAAS,CAAC,QAAQ,EAAE,QAAQ,GAAG,SAAS,CAAC,KAAG,MAAM,CAAC,MAAM,CAAC,OAAO,CAAC,OAAO,EAAE,SAAS,CAAC,QAAQ,CAoCvD,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/request/index.ts"],"names":[],"mappings":"AAIA,cAAc,UAAU,CAAC;AACzB,cAAc,YAAY,CAAC;AAE3B,OAAO,KAAK,SAAS,MAAM,aAAa,CAAC"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import type * as Tool from '@effect/ai/Tool';
|
|
2
|
+
import * as Effect from 'effect/Effect';
|
|
3
|
+
import { type AiParser, type ConsolePrinter } from '@dxos/ai';
|
|
4
|
+
import { type Message } from '@dxos/types';
|
|
5
|
+
/**
|
|
6
|
+
* Live observer of the generation process.
|
|
7
|
+
*/
|
|
8
|
+
export interface GenerationObserver<Tools extends Record<string, Tool.Any> = any> extends AiParser.ParseResponseCallbacks<Tools> {
|
|
9
|
+
/**
|
|
10
|
+
* Complete messages fired during the session, both from the model and from the user.
|
|
11
|
+
* This message will contain all message blocks emitted through the `onBlock` callback.
|
|
12
|
+
*/
|
|
13
|
+
onMessage: (message: Message.Message) => Effect.Effect<void>;
|
|
14
|
+
}
|
|
15
|
+
export declare const GenerationObserver: Readonly<{
|
|
16
|
+
make: ({ onBegin, onPart, onBlock, onEnd, onMessage, }?: Partial<GenerationObserver>) => GenerationObserver;
|
|
17
|
+
noop: () => GenerationObserver<any>;
|
|
18
|
+
/**
|
|
19
|
+
* Debug printer to be used in unit-tests and browser devtools.
|
|
20
|
+
*/
|
|
21
|
+
fromPrinter: (printer: ConsolePrinter) => GenerationObserver<any>;
|
|
22
|
+
}>;
|
|
23
|
+
//# sourceMappingURL=observer.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"observer.d.ts","sourceRoot":"","sources":["../../../../src/request/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"}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { type
|
|
3
|
-
import { type
|
|
4
|
-
import { type ContentBlock } from '@dxos/
|
|
1
|
+
import * as Schema from 'effect/Schema';
|
|
2
|
+
import { type Obj } from '@dxos/echo';
|
|
3
|
+
import { type ObjectVersion } from '@dxos/echo-client';
|
|
4
|
+
import { type ContentBlock } from '@dxos/types';
|
|
5
5
|
declare const VersionPinSchema: Schema.Struct<{
|
|
6
|
-
objectId: import("@dxos/keys").
|
|
6
|
+
objectId: import("@dxos/keys").EntityIdClass;
|
|
7
7
|
version: Schema.Schema<ObjectVersion, ObjectVersion, never>;
|
|
8
8
|
}>;
|
|
9
9
|
/**
|
|
@@ -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 {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"version-pin.d.ts","sourceRoot":"","sources":["../../../../src/request/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,mBAAmB,CAAC;AAEnE,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"}
|