@dxos/assistant 0.8.4-main.c1de068 → 0.8.4-main.c85a9c8dae
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/chunk-BE6SRJ4N.mjs +193 -0
- package/dist/lib/neutral/chunk-BE6SRJ4N.mjs.map +7 -0
- package/dist/lib/neutral/extraction/index.mjs +223 -0
- package/dist/lib/neutral/extraction/index.mjs.map +7 -0
- package/dist/lib/neutral/index.mjs +1328 -0
- package/dist/lib/neutral/index.mjs.map +7 -0
- package/dist/lib/neutral/meta.json +1 -0
- package/dist/lib/neutral/testing/index.mjs +38 -0
- package/dist/lib/neutral/testing/index.mjs.map +7 -0
- package/dist/types/src/conversation/context.d.ts +146 -0
- package/dist/types/src/conversation/context.d.ts.map +1 -0
- 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/conversation.d.ts +53 -25
- package/dist/types/src/conversation/conversation.d.ts.map +1 -1
- package/dist/types/src/conversation/conversation.test.d.ts +2 -0
- package/dist/types/src/conversation/conversation.test.d.ts.map +1 -0
- 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 +17 -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 +47 -18
- package/dist/types/src/errors.d.ts.map +1 -1
- package/dist/types/src/execution-graph.d.ts +85 -0
- package/dist/types/src/execution-graph.d.ts.map +1 -0
- package/dist/types/src/execution-graph.test.d.ts +2 -0
- package/dist/types/src/execution-graph.test.d.ts.map +1 -0
- package/dist/types/src/extraction/extraction-llm-function/extraction-llm-function.d.ts +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 +290 -237
- 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 +349 -270
- package/dist/types/src/extraction/extraction.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 +17 -4
- package/dist/types/src/functions/services.d.ts.map +1 -1
- package/dist/types/src/functions.test.d.ts +2 -0
- package/dist/types/src/functions.test.d.ts.map +1 -0
- 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 +12 -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 +4 -0
- package/dist/types/src/session/index.d.ts.map +1 -1
- package/dist/types/src/session/observer.d.ts +23 -0
- package/dist/types/src/session/observer.d.ts.map +1 -0
- package/dist/types/src/session/session.d.ts +41 -240
- package/dist/types/src/session/session.d.ts.map +1 -1
- package/dist/types/src/session/toolkit.d.ts +18 -0
- package/dist/types/src/session/toolkit.d.ts.map +1 -0
- 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/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/testing/index.d.ts +1 -2
- package/dist/types/src/testing/index.d.ts.map +1 -1
- package/dist/types/src/testing/layer.d.ts +22 -0
- package/dist/types/src/testing/layer.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 +57 -35
- package/src/conversation/context.test.ts +46 -0
- package/src/conversation/context.ts +330 -0
- package/src/conversation/conversation.test.ts +65 -0
- package/src/conversation/conversation.ts +214 -63
- package/src/conversation/index.ts +1 -0
- package/src/diff.test.ts +74 -0
- package/src/diff.ts +93 -0
- package/src/errors.ts +6 -1
- package/src/execution-graph.test.ts +740 -0
- package/src/execution-graph.ts +509 -0
- package/src/extraction/extraction-llm-function/extraction-llm-function.test.ts +10 -9
- package/src/extraction/extraction-llm-function/extraction-llm-function.ts +48 -56
- package/src/extraction/extraction-ner-function/extraction-ner-function.test.ts +23 -22
- package/src/extraction/extraction-ner-function/extraction-ner-function.ts +42 -43
- 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 +10 -9
- package/src/extraction/quotes.test.ts +3 -3
- package/src/extraction/quotes.ts +6 -7
- package/src/functions/services.ts +165 -95
- package/src/functions.conversations.json +1 -0
- package/src/functions.test.ts +74 -0
- 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 +124 -0
- package/src/session/format.ts +143 -0
- package/src/session/index.ts +4 -0
- package/src/session/observer.ts +62 -0
- package/src/session/session.conversations.json +1 -0
- package/src/session/session.test.ts +81 -200
- package/src/session/session.ts +176 -261
- package/src/session/toolkit.ts +44 -0
- package/src/session/version-pin.ts +8 -8
- package/src/templates/index.ts +1 -1
- package/src/templates/instructions/format.tpl +57 -0
- package/src/templates/instructions/system.tpl +48 -0
- package/src/templates/system.ts +41 -0
- package/src/testing/index.ts +2 -8
- package/src/testing/layer.ts +85 -0
- package/src/types/artifact.ts +89 -0
- package/src/types/index.ts +5 -0
- package/src/typings.d.ts +5 -0
- package/dist/lib/browser/index.mjs +0 -1831
- package/dist/lib/browser/index.mjs.map +0 -7
- package/dist/lib/browser/meta.json +0 -1
- package/dist/lib/node-esm/index.mjs +0 -1833
- package/dist/lib/node-esm/index.mjs.map +0 -7
- package/dist/lib/node-esm/meta.json +0 -1
- 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/summarization/summarization.test.d.ts +0 -2
- package/dist/types/src/summarization/summarization.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/types.d.ts +0 -13
- package/dist/types/src/types.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/summarization/summarization.test.ts +0 -208
- 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/typedefs.d.ts +0 -8
- package/src/types.ts +0 -47
- /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;AAGxC,OAAO,EAAE,GAAG,EAAE,MAAM,YAAY,CAAC;AACjC,OAAO,EAAE,KAAK,kBAAkB,EAAE,MAAM,iBAAiB,CAAC;AAC1D,OAAO,EAAE,KAAK,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAIhE,eAAO,MAAM,eAAe;;;;;;yBAAC,CAAA;yBACJ,CAAC;4BAEd,CAAC;8BAMZ,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BAAiK,CAAC;;;;4BAA6H,CAAC;;;;4BAA2H,CAAC;;;;4BAA6H,CAAC;;;4BAA2F,CAAC;gCAAmD,CAAC;;;;;;;;;EAhD7mJ,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,kBAAkB,CAAC,eAAe,EAAE,gBAAgB,CAAC,CAAC;IAChE,QAAQ,EAAE,gBAAgB,CAAC;IAE3B,OAAO,CAAC,EAAE;QACR;;WAEG;QACH,OAAO,CAAC,EAAE,MAAM,CAAC;QAEjB;;;;WAIG;QACH,aAAa,CAAC,EAAE,OAAO,CAAC;KACzB,CAAC;CACH,CAAC;AAEF,MAAM,MAAM,kBAAkB,GAAG,kBAAkB,CAAC,eAAe,EAAE,gBAAgB,CAAC,CAAC;AAEvF;;GAEG;AAEH,eAAO,MAAM,wBAAwB,GAAU,QAAQ,6BAA6B,KAAG,OAAO,CAAC,gBAAgB,CAkB9G,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,GAAU,QAAQ,MAAM,EAAE,EAAE,IAAI,QAAQ,CAAC,QAAQ,KAAG,OAAO,CAAC,gBAAgB,CASlG,CAAC;AAEF;;GAEG;AAEH,eAAO,MAAM,gBAAgB,GAAI,MAAM,MAAM,EAAE,QAAQ,gBAAgB,WAYtE,CAAC"}
|
|
@@ -1,6 +1,19 @@
|
|
|
1
|
-
import
|
|
1
|
+
import * as Layer from 'effect/Layer';
|
|
2
2
|
import { ToolExecutionService, ToolResolverService } from '@dxos/ai';
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
|
|
3
|
+
import { GenericToolkit } from '@dxos/ai';
|
|
4
|
+
import { FunctionInvocationService } from '@dxos/functions';
|
|
5
|
+
/**
|
|
6
|
+
* Constructs a `ToolResolverService` whose `resolve(id)` looks up tools in the following order:
|
|
7
|
+
* 1. Toolkit: return an existing tool from the provided `toolkit` if one is present under `id`.
|
|
8
|
+
* 2. Functions in DB: query `FunctionType` by `key=id`; if found, deserialize and project to a tool
|
|
9
|
+
* (propagating any `deployedFunctionId` discovered in the object's metadata).
|
|
10
|
+
* 3. Functions passed in: fall back to a matching `FunctionDefinition` from the `functions` array.
|
|
11
|
+
*
|
|
12
|
+
* If none of the above yield a match, the effect fails with `AiToolNotFoundError`.
|
|
13
|
+
*
|
|
14
|
+
* Requires `Database.Service` in the environment.
|
|
15
|
+
*/
|
|
16
|
+
export declare const makeToolResolverFromFunctions: () => Layer.Layer<ToolResolverService, never, GenericToolkit.Provider | FunctionInvocationService>;
|
|
17
|
+
export declare const makeToolExecutionServiceFromFunctions: () => Layer.Layer<ToolExecutionService, never, FunctionInvocationService | GenericToolkit.Provider>;
|
|
18
|
+
export declare const ToolExecutionServices: Layer.Layer<ToolExecutionService | ToolResolverService, never, FunctionInvocationService | GenericToolkit.Provider>;
|
|
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":"AAQA,OAAO,KAAK,KAAK,MAAM,cAAc,CAAC;AAKtC,OAAO,EAAuB,oBAAoB,EAAE,mBAAmB,EAAE,MAAM,UAAU,CAAC;AAC1F,OAAO,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AAG1C,OAAO,EAA2B,yBAAyB,EAAE,MAAM,iBAAiB,CAAC;AAKrF;;;;;;;;;;GAUG;AACH,eAAO,MAAM,6BAA6B,QAAO,KAAK,CAAC,KAAK,CAC1D,mBAAmB,EACnB,KAAK,EACL,cAAc,CAAC,QAAQ,GAAG,yBAAyB,CAyBpD,CAAC;AAEF,eAAO,MAAM,qCAAqC,QAAO,KAAK,CAAC,KAAK,CAClE,oBAAoB,EACpB,KAAK,EACL,yBAAyB,GAAG,cAAc,CAAC,QAAQ,CAyCpD,CAAC;AAEF,eAAO,MAAM,qBAAqB,qHAGjC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"functions.test.d.ts","sourceRoot":"","sources":["../../../src/functions.test.ts"],"names":[],"mappings":""}
|
|
@@ -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 ObjectVersion } from '@dxos/echo-db';
|
|
3
|
+
import { type ObjectId } from '@dxos/keys';
|
|
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,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;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,12 @@
|
|
|
1
|
+
import * as Effect from 'effect/Effect';
|
|
2
|
+
import { Message } from '@dxos/types';
|
|
3
|
+
import { type AiSessionRunError, type AiSessionRunProps } from './session';
|
|
4
|
+
/**
|
|
5
|
+
* Formats the system prompt.
|
|
6
|
+
*/
|
|
7
|
+
export declare const formatSystemPrompt: ({ system, blueprints, objects, }: Pick<AiSessionRunProps<any>, "system" | "blueprints" | "objects">) => Effect.Effect<string, import("@dxos/echo/Err").ObjectNotFoundError | import("@dxos/functions").FunctionNotFoundError, import("@dxos/functions").FunctionInvocationService | import("@dxos/functions").TracingService>;
|
|
8
|
+
/**
|
|
9
|
+
* Formats the user prompt.
|
|
10
|
+
*/
|
|
11
|
+
export declare const formatUserPrompt: ({ prompt, history, }: Pick<AiSessionRunProps<any>, "prompt" | "history">) => Effect.Effect<Message.Message, AiSessionRunError>;
|
|
12
|
+
//# sourceMappingURL=format.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"format.d.ts","sourceRoot":"","sources":["../../../../src/session/format.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,MAAM,MAAM,eAAe,CAAC;AASxC,OAAO,EAAqB,OAAO,EAAE,MAAM,aAAa,CAAC;AAMzD,OAAO,EAAE,KAAK,iBAAiB,EAAE,KAAK,iBAAiB,EAAE,MAAM,WAAW,CAAC;AAE3E;;GAEG;AAEH,eAAO,MAAM,kBAAkB,GAAI,kCAIhC,IAAI,CAAC,iBAAiB,CAAC,GAAG,CAAC,EAAE,QAAQ,GAAG,YAAY,GAAG,SAAS,CAAC,0NAsChE,CAAC;AAEL;;GAEG;AAGH,eAAO,MAAM,gBAAgB,GAAI,sBAG9B,IAAI,CAAC,iBAAiB,CAAC,GAAG,CAAC,EAAE,QAAQ,GAAG,SAAS,CAAC,KAAG,MAAM,CAAC,MAAM,CAAC,OAAO,CAAC,OAAO,EAAE,iBAAiB,CAoCpG,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;AAC9B,cAAc,UAAU,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/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"}
|
|
@@ -1,19 +1,36 @@
|
|
|
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 AiToolNotFoundError, type PromptPreprocessingError, type ToolExecutionService, type ToolResolverService } from '@dxos/ai';
|
|
5
7
|
import { type Blueprint } from '@dxos/blueprints';
|
|
6
|
-
import {
|
|
7
|
-
import { type
|
|
8
|
-
import {
|
|
9
|
-
import { AiAssistantError } from '../errors';
|
|
10
|
-
|
|
11
|
-
export type
|
|
8
|
+
import { Obj } from '@dxos/echo';
|
|
9
|
+
import { type FunctionInvocationService, TracingService } from '@dxos/functions';
|
|
10
|
+
import { Message } from '@dxos/types';
|
|
11
|
+
import { type AiAssistantError } from '../errors';
|
|
12
|
+
import { GenerationObserver } from './observer';
|
|
13
|
+
export type AiSessionRunError = AiError.AiError | PromptPreprocessingError | AiToolNotFoundError | AiAssistantError;
|
|
14
|
+
export type AiSessionRunRequirements = LanguageModel.LanguageModel | ToolExecutionService | ToolResolverService | TracingService | FunctionInvocationService;
|
|
15
|
+
export type AiSessionOptions = {
|
|
16
|
+
/**
|
|
17
|
+
* Summarize before executing the prompt if the existing history exceeds this threshold.
|
|
18
|
+
*/
|
|
19
|
+
summarizationThreshold?: number;
|
|
20
|
+
};
|
|
21
|
+
export type AiSessionRunProps<Tools extends Record<string, Tool.Any>> = {
|
|
12
22
|
prompt: string;
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
blueprints?: Blueprint.Blueprint[];
|
|
23
|
+
system?: string;
|
|
24
|
+
history?: Message.Message[];
|
|
25
|
+
objects?: Obj.Unknown[];
|
|
26
|
+
blueprints?: readonly Blueprint.Blueprint[];
|
|
27
|
+
toolkit?: Toolkit.WithHandler<Tools>;
|
|
28
|
+
observer?: GenerationObserver<Tools>;
|
|
29
|
+
/**
|
|
30
|
+
* Callback for when a message is received from the user, model, or tool.
|
|
31
|
+
* This is useful for streaming the output to a queue.
|
|
32
|
+
*/
|
|
33
|
+
onOutput?: (message: Message.Message) => Effect.Effect<void, never, never>;
|
|
17
34
|
};
|
|
18
35
|
/**
|
|
19
36
|
* Contains message history, tools, current context.
|
|
@@ -27,234 +44,18 @@ export type SessionRunOptions<Tools extends AiTool.Any> = {
|
|
|
27
44
|
*/
|
|
28
45
|
export declare class AiSession {
|
|
29
46
|
private readonly _options;
|
|
47
|
+
/** Prevents concurrent execution of session. */
|
|
30
48
|
private readonly _semaphore;
|
|
31
|
-
/**
|
|
32
|
-
private _pending;
|
|
33
|
-
/** Current streaming response. */
|
|
34
|
-
private _stream;
|
|
35
|
-
/** Prior history from queue. */
|
|
49
|
+
/** Message history from queue. */
|
|
36
50
|
private _history;
|
|
37
|
-
/**
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
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>;
|
|
51
|
+
/** Pending messages for this session (incl. the current prompt). */
|
|
52
|
+
private _pending;
|
|
53
|
+
private _started;
|
|
54
|
+
private _ended;
|
|
55
|
+
private _toolCalls;
|
|
226
56
|
constructor(_options?: AiSessionOptions);
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
* @returns The messages generated by the session, including the user's prompt.
|
|
231
|
-
*/
|
|
232
|
-
run: <Tools extends AiTool.Any>(options: SessionRunOptions<Tools>) => Effect.Effect<DataType.Message[], AiAssistantError | AiInputPreprocessingError | AiToolNotFoundError | AiError.AiError, AiLanguageModel.AiLanguageModel | ToolResolverService | ToolExecutionService | AiTool.ToHandler<Tools>>;
|
|
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
|
-
};
|
|
57
|
+
get duration(): number;
|
|
58
|
+
get toolCalls(): number;
|
|
59
|
+
run: <Tools extends Record<string, Tool.Any>>({ prompt, system: systemTemplate, history, objects, blueprints, toolkit, observer, onOutput, }: AiSessionRunProps<Tools>) => Effect.Effect<Message.Message[], AiSessionRunError, AiSessionRunRequirements>;
|
|
258
60
|
}
|
|
259
|
-
export {};
|
|
260
61
|
//# 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","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effect';
|
|
4
|
+
import { type AiToolNotFoundError, GenericToolkit, ToolExecutionService, ToolResolverService } from '@dxos/ai';
|
|
5
|
+
import { type Blueprint } from '@dxos/blueprints';
|
|
6
|
+
export type CreateToolkitProps = {
|
|
7
|
+
toolkit?: Toolkit.Any;
|
|
8
|
+
blueprints?: readonly Blueprint.Blueprint[];
|
|
9
|
+
/**
|
|
10
|
+
* Self-contained with handlers toolkits.
|
|
11
|
+
*/
|
|
12
|
+
genericToolkits?: readonly GenericToolkit.GenericToolkit[];
|
|
13
|
+
};
|
|
14
|
+
/**
|
|
15
|
+
* Build a combined toolkit from the blueprint tools and the provided toolkit.
|
|
16
|
+
*/
|
|
17
|
+
export declare const createToolkit: ({ toolkit: toolkitProp, blueprints, genericToolkits, }: CreateToolkitProps) => Effect.Effect<Toolkit.WithHandler<any>, AiToolNotFoundError, ToolResolverService | ToolExecutionService | Tool.HandlersFor<any>>;
|
|
18
|
+
//# 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;AAC9C,OAAO,KAAK,MAAM,MAAM,eAAe,CAAC;AAExC,OAAO,EAAE,KAAK,mBAAmB,EAAE,cAAc,EAAE,oBAAoB,EAAE,mBAAmB,EAAE,MAAM,UAAU,CAAC;AAC/G,OAAO,EAAE,KAAK,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAGlD,MAAM,MAAM,kBAAkB,GAAG;IAC/B,OAAO,CAAC,EAAE,OAAO,CAAC,GAAG,CAAC;IACtB,UAAU,CAAC,EAAE,SAAS,SAAS,CAAC,SAAS,EAAE,CAAC;IAC5C;;OAEG;IACH,eAAe,CAAC,EAAE,SAAS,cAAc,CAAC,cAAc,EAAE,CAAC;CAC5D,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,aAAa,GAAI,wDAI3B,kBAAkB,KAAG,MAAM,CAAC,MAAM,CACnC,OAAO,CAAC,WAAW,CAAC,GAAG,CAAC,EACxB,mBAAmB,EACnB,mBAAmB,GAAG,oBAAoB,GAAG,IAAI,CAAC,WAAW,CAAC,GAAG,CAAC,CAYhE,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,2 +1,2 @@
|
|
|
1
|
-
export * from './
|
|
1
|
+
export * from './system';
|
|
2
2
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { type ModelCapabilities } from '@dxos/ai';
|
|
2
|
+
import { Template } from '@dxos/blueprints';
|
|
3
|
+
/**
|
|
4
|
+
* System template variables.
|
|
5
|
+
*/
|
|
6
|
+
export type SystemPromptOptions = ModelCapabilities & {
|
|
7
|
+
DATETIME: string;
|
|
8
|
+
};
|
|
9
|
+
/**
|
|
10
|
+
* Base system prompt.
|
|
11
|
+
* NOTE: This contains protocol instructions that can not be dynamically edited.
|
|
12
|
+
*/
|
|
13
|
+
export declare const createSystemPrompt: (options?: Partial<SystemPromptOptions>) => string;
|
|
14
|
+
export declare const templates: {
|
|
15
|
+
/** Editable system prompt.*/
|
|
16
|
+
system: Template.Template;
|
|
17
|
+
};
|
|
18
|
+
//# sourceMappingURL=system.d.ts.map
|
|
@@ -0,0 +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,kBAAkB,CAAC;AAK5C;;GAEG;AACH,MAAM,MAAM,mBAAmB,GAAG,iBAAiB,GAAG;IACpD,QAAQ,EAAE,MAAM,CAAC;CAClB,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,kBAAkB,GAAI,UAAS,OAAO,CAAC,mBAAmB,CAAM,WAM1E,CAAC;AAEJ,eAAO,MAAM,SAAS;IACpB,6BAA6B;;CAQ9B,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/testing/index.ts"],"names":[],"mappings":"AAIA,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/testing/index.ts"],"names":[],"mappings":"AAIA,cAAc,SAAS,CAAC"}
|