@dxos/assistant 0.8.4-main.f9ba587 → 0.8.4-main.fffef41
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/lib/browser/chunk-J5LGTIGS.mjs +10 -0
- package/dist/lib/browser/chunk-J5LGTIGS.mjs.map +7 -0
- package/dist/lib/browser/extraction/index.mjs +225 -0
- package/dist/lib/browser/extraction/index.mjs.map +7 -0
- package/dist/lib/browser/index.mjs +1114 -1843
- package/dist/lib/browser/index.mjs.map +4 -4
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/node-esm/chunk-HSLMI22Q.mjs +11 -0
- package/dist/lib/node-esm/chunk-HSLMI22Q.mjs.map +7 -0
- package/dist/lib/node-esm/extraction/index.mjs +226 -0
- package/dist/lib/node-esm/extraction/index.mjs.map +7 -0
- package/dist/lib/node-esm/index.mjs +1114 -1844
- package/dist/lib/node-esm/index.mjs.map +4 -4
- package/dist/lib/node-esm/meta.json +1 -1
- package/dist/types/src/conversation/context.d.ts +103 -0
- package/dist/types/src/conversation/context.d.ts.map +1 -0
- package/dist/types/src/conversation/conversation.d.ts +29 -32
- package/dist/types/src/conversation/conversation.d.ts.map +1 -1
- package/dist/types/src/conversation/index.d.ts +1 -0
- package/dist/types/src/conversation/index.d.ts.map +1 -1
- package/dist/types/src/diff.d.ts +15 -0
- package/dist/types/src/diff.d.ts.map +1 -0
- package/dist/types/src/diff.test.d.ts +2 -0
- package/dist/types/src/diff.test.d.ts.map +1 -0
- package/dist/types/src/errors.d.ts +71 -0
- package/dist/types/src/errors.d.ts.map +1 -0
- 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 +195 -58
- 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 +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 +264 -165
- package/dist/types/src/extraction/extraction.d.ts.map +1 -1
- package/dist/types/src/extraction/quotes.d.ts +1 -1
- package/dist/types/src/extraction/quotes.d.ts.map +1 -1
- package/dist/types/src/functions/index.d.ts +2 -0
- package/dist/types/src/functions/index.d.ts.map +1 -0
- package/dist/types/src/functions/services.d.ts +20 -0
- package/dist/types/src/functions/services.d.ts.map +1 -0
- package/dist/types/src/index.d.ts +5 -5
- package/dist/types/src/index.d.ts.map +1 -1
- package/dist/types/src/session/GenericToolkit.d.ts +84 -0
- package/dist/types/src/session/GenericToolkit.d.ts.map +1 -0
- package/dist/types/src/session/artifact-diff.d.ts +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 +22 -0
- package/dist/types/src/session/observer.d.ts.map +1 -0
- package/dist/types/src/session/session.d.ts +36 -268
- package/dist/types/src/session/session.d.ts.map +1 -1
- package/dist/types/src/session/toolkit.d.ts +15 -0
- package/dist/types/src/session/toolkit.d.ts.map +1 -0
- package/dist/types/src/session/version-pin.d.ts +5 -5
- package/dist/types/src/session/version-pin.d.ts.map +1 -1
- package/dist/types/src/templates/index.d.ts +2 -0
- package/dist/types/src/templates/index.d.ts.map +1 -0
- package/dist/types/src/templates/system.d.ts +18 -0
- package/dist/types/src/templates/system.d.ts.map +1 -0
- package/dist/types/src/types/artifact.d.ts +20 -0
- package/dist/types/src/types/artifact.d.ts.map +1 -0
- package/dist/types/src/types/index.d.ts +2 -0
- package/dist/types/src/types/index.d.ts.map +1 -0
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +48 -26
- package/src/conversation/context.ts +186 -0
- package/src/conversation/conversation.ts +101 -76
- package/src/conversation/index.ts +1 -0
- package/src/diff.test.ts +43 -0
- package/src/diff.ts +84 -0
- package/src/errors.ts +15 -0
- 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 +14 -25
- package/src/extraction/extraction-llm-function/extraction-llm-function.ts +48 -52
- package/src/extraction/extraction-ner-function/extraction-ner-function.test.ts +18 -17
- package/src/extraction/extraction-ner-function/extraction-ner-function.ts +43 -41
- package/src/extraction/extraction-ner-function/named-entity-recognition.test.ts +12 -6
- package/src/extraction/extraction-ner-function/named-entity-recognition.ts +3 -1
- package/src/extraction/extraction.ts +7 -6
- package/src/extraction/quotes.test.ts +3 -3
- package/src/extraction/quotes.ts +4 -4
- package/src/functions/index.ts +5 -0
- package/src/functions/services.ts +162 -0
- package/src/index.ts +5 -5
- package/src/session/GenericToolkit.ts +130 -0
- package/src/session/artifact-diff.ts +41 -0
- package/src/session/error-handling.ts +41 -0
- package/src/session/format.test.ts +61 -0
- package/src/session/format.ts +144 -0
- package/src/session/index.ts +5 -0
- package/src/session/observer.ts +59 -0
- package/src/session/session.conversations.json +1 -0
- package/src/session/session.test.ts +88 -214
- package/src/session/session.ts +170 -539
- package/src/session/toolkit.ts +48 -0
- package/src/session/version-pin.ts +11 -12
- package/src/templates/index.ts +5 -0
- package/src/templates/instructions/format.tpl +61 -0
- package/src/templates/instructions/system.tpl +48 -0
- package/src/templates/system.ts +41 -0
- package/src/types/artifact.ts +71 -0
- package/src/types/index.ts +5 -0
- package/src/typings.d.ts +5 -0
- package/dist/types/bin/chat.d.ts +0 -2
- package/dist/types/bin/chat.d.ts.map +0 -1
- package/dist/types/src/blueprint/blueprint.d.ts +0 -41
- package/dist/types/src/blueprint/blueprint.d.ts.map +0 -1
- package/dist/types/src/blueprint/index.d.ts +0 -3
- package/dist/types/src/blueprint/index.d.ts.map +0 -1
- package/dist/types/src/blueprint/registry.d.ts +0 -7
- package/dist/types/src/blueprint/registry.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 -38
- 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 -7
- package/dist/types/src/research/exa.d.ts.map +0 -1
- package/dist/types/src/research/graph.d.ts +0 -41
- 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/testing/exa-search-1748337321991.d.ts +0 -38
- package/dist/types/src/testing/exa-search-1748337321991.d.ts.map +0 -1
- package/dist/types/src/testing/exa-search-1748337331526.d.ts +0 -37
- package/dist/types/src/testing/exa-search-1748337331526.d.ts.map +0 -1
- package/dist/types/src/testing/exa-search-1748337344119.d.ts +0 -58
- package/dist/types/src/testing/exa-search-1748337344119.d.ts.map +0 -1
- package/dist/types/src/testing/index.d.ts +0 -3
- package/dist/types/src/testing/index.d.ts.map +0 -1
- package/dist/types/src/types.d.ts +0 -3
- package/dist/types/src/types.d.ts.map +0 -1
- package/src/blueprint/blueprint.ts +0 -75
- package/src/blueprint/index.ts +0 -6
- package/src/blueprint/registry.ts +0 -15
- package/src/context/binder.ts +0 -101
- package/src/context/binding.ts +0 -31
- package/src/context/index.ts +0 -6
- package/src/research/exa.ts +0 -100
- package/src/research/graph.test.ts +0 -15
- package/src/research/graph.ts +0 -337
- package/src/research/index.ts +0 -7
- package/src/research/instructions-research.tpl +0 -97
- package/src/research/research.test.ts +0 -190
- package/src/research/research.ts +0 -90
- package/src/session/version-pin.test.ts +0 -26
- package/src/summarization/summarization.test.ts +0 -221
- package/src/testing/exa-search-1748337321991.ts +0 -131
- package/src/testing/exa-search-1748337331526.ts +0 -144
- package/src/testing/exa-search-1748337344119.ts +0 -133
- package/src/testing/index.ts +0 -11
- package/src/typedefs.d.ts +0 -8
- package/src/types.ts +0 -8
- /package/src/extraction/extraction-llm-function/{instructions.tpl → transcription-instructions.tpl} +0 -0
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
import type * as Tool from '@effect/ai/Tool';
|
|
2
|
+
import * as Toolkit from '@effect/ai/Toolkit';
|
|
3
|
+
import * as Effect from 'effect/Effect';
|
|
4
|
+
import * as Layer from 'effect/Layer';
|
|
5
|
+
import * as Pipeable from 'effect/Pipeable';
|
|
6
|
+
import type * as Schema from 'effect/Schema';
|
|
7
|
+
import type * as SchemaAST from 'effect/SchemaAST';
|
|
8
|
+
/**
|
|
9
|
+
* Unique identifier for generic toolkit instances.
|
|
10
|
+
*/
|
|
11
|
+
export declare const TypeId = "~@dxos/assistant/GenericToolkit";
|
|
12
|
+
/**
|
|
13
|
+
* Type-level representation of the generic toolkit identifier.
|
|
14
|
+
*/
|
|
15
|
+
export type TypeId = typeof TypeId;
|
|
16
|
+
/**
|
|
17
|
+
* Type-safe way to define toolkits where we don't know specific types of tools,
|
|
18
|
+
* and we want to bundle definition and handlers together.
|
|
19
|
+
*
|
|
20
|
+
* Usefull for plugin-based systems, where tools are dynamically added.
|
|
21
|
+
*
|
|
22
|
+
* @param TR requirements type to the tool invocation.
|
|
23
|
+
* @param E failure type to the handlers layer.
|
|
24
|
+
* @param R requirements type to the handlers layer.
|
|
25
|
+
*/
|
|
26
|
+
export interface GenericToolkit<TR = never, E = never, R = never> extends Pipeable.Pipeable {
|
|
27
|
+
readonly [TypeId]: TypeId;
|
|
28
|
+
/**
|
|
29
|
+
* Toolkit definition.
|
|
30
|
+
*/
|
|
31
|
+
readonly toolkit: Toolkit.Toolkit<GenericTools<TR>>;
|
|
32
|
+
/**
|
|
33
|
+
* Handlers layer.
|
|
34
|
+
*/
|
|
35
|
+
readonly layer: Layer.Layer<unknown, E, R>;
|
|
36
|
+
/**
|
|
37
|
+
* Handlers effect.
|
|
38
|
+
*/
|
|
39
|
+
readonly handlers: Effect.Effect<Toolkit.WithHandler<GenericTools<TR>>, E, R>;
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* Generic constraint.
|
|
43
|
+
*
|
|
44
|
+
* NOTE: Only use in place of `T extends PortableToolkit.Any`. Not suitable for standalone use.
|
|
45
|
+
*/
|
|
46
|
+
export interface Any {
|
|
47
|
+
readonly [TypeId]: TypeId;
|
|
48
|
+
readonly toolkit: Toolkit.Toolkit<any>;
|
|
49
|
+
readonly layer: Layer.Layer<unknown, any, any>;
|
|
50
|
+
}
|
|
51
|
+
export type InvocationRequirements<T extends Any> = T extends GenericToolkit<infer TR, infer _E, infer _R> ? TR : never;
|
|
52
|
+
export type Failure<T extends Any> = T extends GenericToolkit<infer _TR, infer E, infer _R> ? E : never;
|
|
53
|
+
export type Requirements<T extends Any> = T extends GenericToolkit<infer _TR, infer _E, infer R> ? R : never;
|
|
54
|
+
/**
|
|
55
|
+
* Creates a portable toolkit from toolkit definition and handlers layer.
|
|
56
|
+
*/
|
|
57
|
+
export declare const make: <Tools extends Record<string, Tool.Any>, E, R>(toolkit: Toolkit.Toolkit<Tools>, layer: Layer.Layer<Tool.HandlersFor<Tools>, E, R>) => GenericToolkit<E, R>;
|
|
58
|
+
/**
|
|
59
|
+
* Merges multiple portable toolkits into a single portable toolkit.
|
|
60
|
+
*/
|
|
61
|
+
export declare const merge: <const Toolkits extends ReadonlyArray<Any>>(
|
|
62
|
+
/**
|
|
63
|
+
* The toolkits to merge together.
|
|
64
|
+
*/
|
|
65
|
+
...toolkits: Toolkits) => GenericToolkit<InvocationRequirements<Toolkits[number]>, Failure<Toolkits[number]>, Requirements<Toolkits[number]>>;
|
|
66
|
+
/**
|
|
67
|
+
* Generic tools type where we cannot statically enumerate individual tools.
|
|
68
|
+
*/
|
|
69
|
+
export type GenericTools<R = never> = Record<string, Tool.Tool<string, {
|
|
70
|
+
readonly parameters: AnyStructSchemaNoContext;
|
|
71
|
+
readonly success: Schema.Schema.AnyNoContext;
|
|
72
|
+
readonly failure: typeof Schema.Never;
|
|
73
|
+
}, R>>;
|
|
74
|
+
export interface AnyStructSchemaNoContext extends Pipeable.Pipeable {
|
|
75
|
+
readonly [Schema.TypeId]: any;
|
|
76
|
+
readonly make: any;
|
|
77
|
+
readonly Type: any;
|
|
78
|
+
readonly Encoded: any;
|
|
79
|
+
readonly Context: never;
|
|
80
|
+
readonly ast: SchemaAST.AST;
|
|
81
|
+
readonly fields: Schema.Struct.Fields;
|
|
82
|
+
readonly annotations: any;
|
|
83
|
+
}
|
|
84
|
+
//# sourceMappingURL=GenericToolkit.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"GenericToolkit.d.ts","sourceRoot":"","sources":["../../../../src/session/GenericToolkit.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,KAAK,IAAI,MAAM,iBAAiB,CAAC;AAC7C,OAAO,KAAK,OAAO,MAAM,oBAAoB,CAAC;AAC9C,OAAO,K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,wBAAwB,CAAC;IAC9C,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC,MAAM,CAAC,YAAY,CAAC;IAC7C,QAAQ,CAAC,OAAO,EAAE,OAAO,MAAM,CAAC,KAAK,CAAC;CACvC,EACD,CAAC,CACF,CACF,CAAC;AAEF,MAAM,WAAW,wBAAyB,SAAQ,QAAQ,CAAC,QAAQ;IACjE,QAAQ,CAAC,CAAC,MAAM,CAAC,MAAM,CAAC,EAAE,GAAG,CAAC;IAC9B,QAAQ,CAAC,IAAI,EAAE,GAAG,CAAC;IACnB,QAAQ,CAAC,IAAI,EAAE,GAAG,CAAC;IACnB,QAAQ,CAAC,OAAO,EAAE,GAAG,CAAC;IACtB,QAAQ,CAAC,OAAO,EAAE,KAAK,CAAC;IACxB,QAAQ,CAAC,GAAG,EAAE,SAAS,CAAC,GAAG,CAAC;IAC5B,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC;IACtC,QAAQ,CAAC,WAAW,EAAE,GAAG,CAAC;CAC3B"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import * as Context from 'effect/Context';
|
|
2
|
+
import { type ObjectId } from '@dxos/echo/internal';
|
|
3
|
+
import { type ObjectVersion } from '@dxos/echo-db';
|
|
4
|
+
declare const ArtifactDiffResolver_base: Context.TagClass<ArtifactDiffResolver, "@dxos/assistant/ArtifactDiffResolver", ArtifactDiffResolver.Service>;
|
|
5
|
+
/**
|
|
6
|
+
* Resolves artifact ids to their versions.
|
|
7
|
+
* Used to give the model a sense of the changes to the artifacts made by users during the conversation.
|
|
8
|
+
* The artifacts versions are pinned in the history, and whenever the artifact changes in-between assistant's steps,
|
|
9
|
+
* a diff is inserted into the conversation.
|
|
10
|
+
*
|
|
11
|
+
* Can be optionally provided to the session run call.
|
|
12
|
+
*/
|
|
13
|
+
export declare class ArtifactDiffResolver extends ArtifactDiffResolver_base {
|
|
14
|
+
}
|
|
15
|
+
export declare namespace ArtifactDiffResolver {
|
|
16
|
+
type Service = {
|
|
17
|
+
resolve: (artifacts: {
|
|
18
|
+
id: ObjectId;
|
|
19
|
+
lastVersion: ObjectVersion;
|
|
20
|
+
}[]) => Promise<Map<ObjectId, {
|
|
21
|
+
version: ObjectVersion;
|
|
22
|
+
diff?: string;
|
|
23
|
+
}>>;
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
export {};
|
|
27
|
+
//# sourceMappingURL=artifact-diff.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"artifact-diff.d.ts","sourceRoot":"","sources":["../../../../src/session/artifact-diff.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,OAAO,MAAM,gBAAgB,CAAC;AAE1C,OAAO,EAAE,KAAK,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AACpD,OAAO,EAAE,KAAK,aAAa,EAAE,MAAM,eAAe,CAAC;;AAEnD;;;;;;;GAOG;AAEH,qBAAa,oBAAqB,SAAQ,yBAGvC;CAAG;AAEN,yBAAiB,oBAAoB,CAAC;IACpC,KAAY,OAAO,GAAG;QACpB,OAAO,EAAE,CACP,SAAS,EAAE;YACT,EAAE,EAAE,QAAQ,CAAC;YACb,WAAW,EAAE,aAAa,CAAC;SAC5B,EAAE,KACA,OAAO,CACV,GAAG,CACD,QAAQ,EACR;YACE,OAAO,EAAE,aAAa,CAAC;YACvB,IAAI,CAAC,EAAE,MAAM,CAAC;SACf,CACF,CACF,CAAC;KACH,CAAC;CACH"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"error-handling.d.ts","sourceRoot":"","sources":["../../../../src/session/error-handling.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,OAAO,MAAM,oBAAoB,CAAC;AAE9C,OAAO,KAAK,MAAM,MAAM,eAAe,CAAC;AAcxC,eAAO,MAAM,UAAU,GAAI,KAAK,OAAO,CAAC,OAAO,KAAG,MAAM,CAAC,MAAM,CAAC,OAAO,CAAC,OAAO,CAoB1B,CAAC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import * as Effect from 'effect/Effect';
|
|
2
|
+
import { Message } from '@dxos/types';
|
|
3
|
+
import { type AiSessionRunError, type AiSessionRunParams } from './session';
|
|
4
|
+
/**
|
|
5
|
+
* Formats the system prompt.
|
|
6
|
+
*/
|
|
7
|
+
export declare const formatSystemPrompt: ({ system, blueprints, objects, }: Pick<AiSessionRunParams<any>, "system" | "blueprints" | "objects">) => Effect.Effect<string, never, never>;
|
|
8
|
+
/**
|
|
9
|
+
* Formats the user prompt.
|
|
10
|
+
*/
|
|
11
|
+
export declare const formatUserPrompt: ({ prompt, history, }: Pick<AiSessionRunParams<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":"AAKA,OAAO,KAAK,MAAM,MAAM,eAAe,CAAC;AASxC,OAAO,EAAqB,OAAO,EAAE,MAAM,aAAa,CAAC;AAMzD,OAAO,EAAE,KAAK,iBAAiB,EAAE,KAAK,kBAAkB,EAAE,MAAM,WAAW,CAAC;AAE5E;;GAEG;AAEH,eAAO,MAAM,kBAAkB,GAAI,kCAIhC,IAAI,CAAC,kBAAkB,CAAC,GAAG,CAAC,EAAE,QAAQ,GAAG,YAAY,GAAG,SAAS,CAAC,wCAsCjE,CAAC;AAEL;;GAEG;AAGH,eAAO,MAAM,gBAAgB,GAAI,sBAG9B,IAAI,CAAC,kBAAkB,CAAC,GAAG,CAAC,EAAE,QAAQ,GAAG,SAAS,CAAC,KAAG,MAAM,CAAC,MAAM,CAAC,OAAO,CAAC,OAAO,EAAE,iBAAiB,CAoCrG,CAAC"}
|
|
@@ -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;AAE9B,OAAO,KAAK,cAAc,MAAM,kBAAkB,CAAC"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import * as Effect from 'effect/Effect';
|
|
2
|
+
import { type AiParser, type ConsolePrinter } from '@dxos/ai';
|
|
3
|
+
import { type Message } from '@dxos/types';
|
|
4
|
+
/**
|
|
5
|
+
* Live observer of the generation process.
|
|
6
|
+
*/
|
|
7
|
+
export interface GenerationObserver extends AiParser.ParseResponseCallbacks {
|
|
8
|
+
/**
|
|
9
|
+
* Complete messages fired during the session, both from the model and from the user.
|
|
10
|
+
* This message will contain all message blocks emitted through the `onBlock` callback.
|
|
11
|
+
*/
|
|
12
|
+
onMessage: (message: Message.Message) => Effect.Effect<void>;
|
|
13
|
+
}
|
|
14
|
+
export declare const GenerationObserver: Readonly<{
|
|
15
|
+
make: ({ onBegin, onPart, onBlock, onEnd, onMessage, }?: Partial<GenerationObserver>) => GenerationObserver;
|
|
16
|
+
noop: () => GenerationObserver;
|
|
17
|
+
/**
|
|
18
|
+
* Debug printer to be used in unit-tests and browser devtools.
|
|
19
|
+
*/
|
|
20
|
+
fromPrinter: (printer: ConsolePrinter) => GenerationObserver;
|
|
21
|
+
}>;
|
|
22
|
+
//# sourceMappingURL=observer.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"observer.d.ts","sourceRoot":"","sources":["../../../../src/session/observer.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,MAAM,MAAM,eAAe,CAAC;AAGxC,OAAO,EAAE,KAAK,QAAQ,EAAE,KAAK,cAAc,EAAE,MAAM,UAAU,CAAC;AAC9D,OAAO,EAAE,KAAK,OAAO,EAAE,MAAM,aAAa,CAAC;AAE3C;;GAEG;AACH,MAAM,WAAW,kBAAmB,SAAQ,QAAQ,CAAC,sBAAsB;IACzE;;;OAGG;IACH,SAAS,EAAE,CAAC,OAAO,EAAE,OAAO,CAAC,OAAO,KAAK,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;CAC9D;AAED,eAAO,MAAM,kBAAkB;6DAO1B,OAAO,CAAC,kBAAkB,CAAC,KAAQ,kBAAkB;;IAUxD;;OAEG;2BACoB,cAAc;EAiBrC,CAAC"}
|
|
@@ -1,283 +1,51 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import
|
|
1
|
+
import type * as AiError from '@effect/ai/AiError';
|
|
2
|
+
import * as LanguageModel from '@effect/ai/LanguageModel';
|
|
3
|
+
import type * as Tool from '@effect/ai/Tool';
|
|
4
|
+
import type * as Toolkit from '@effect/ai/Toolkit';
|
|
5
|
+
import * as Effect from 'effect/Effect';
|
|
6
|
+
import type * as Schema from 'effect/Schema';
|
|
7
|
+
import { type AiToolNotFoundError, type PromptPreprocessingError, type ToolExecutionService, type ToolResolverService } from '@dxos/ai';
|
|
8
|
+
import { type Blueprint } from '@dxos/blueprints';
|
|
9
|
+
import { Obj } from '@dxos/echo';
|
|
10
|
+
import { TracingService } from '@dxos/functions';
|
|
11
|
+
import { Message } from '@dxos/types';
|
|
12
|
+
import { type AiAssistantError } from '../errors';
|
|
13
|
+
import { GenerationObserver } from './observer';
|
|
14
|
+
export type AiSessionRunError = AiError.AiError | PromptPreprocessingError | AiToolNotFoundError | AiAssistantError;
|
|
15
|
+
export type AiSessionRunRequirements = LanguageModel.LanguageModel | ToolExecutionService | ToolResolverService | TracingService;
|
|
16
|
+
export type AiSessionRunParams<Tools extends Record<string, Tool.Any>> = {
|
|
17
|
+
prompt: string;
|
|
18
|
+
system?: string;
|
|
19
|
+
history?: Message.Message[];
|
|
20
|
+
objects?: Obj.Any[];
|
|
21
|
+
blueprints?: Blueprint.Blueprint[];
|
|
22
|
+
toolkit?: Toolkit.WithHandler<Tools>;
|
|
23
|
+
observer?: GenerationObserver;
|
|
24
|
+
};
|
|
25
|
+
export type AiSessionOptions = {};
|
|
7
26
|
/**
|
|
8
27
|
* Contains message history, tools, current context.
|
|
9
28
|
* Current context means the state of the app, time of day, and other contextual information.
|
|
10
29
|
* It makes requests to the model, its a state machine.
|
|
11
30
|
* It keeps track of the current goal.
|
|
12
31
|
* It manages the context window.
|
|
13
|
-
* Tracks the success criteria of reaching the goal, exposing metrics (stretch)
|
|
32
|
+
* Tracks the success criteria of reaching the goal, exposing metrics (stretch).
|
|
14
33
|
* Could be run locally in the app or remotely.
|
|
15
34
|
* Could be personal or shared.
|
|
16
35
|
*/
|
|
17
|
-
|
|
18
|
-
* Resolves artifact ids to their versions.
|
|
19
|
-
* Used to give the model a sense of the changes to the artifacts made by users during the conversation.
|
|
20
|
-
* The artifacts versions are pinned in the history, and whenever the artifact changes in-between assistant's steps,
|
|
21
|
-
* a diff is inserted into the conversation.
|
|
22
|
-
*/
|
|
23
|
-
export type ArtifactDiffResolver = (artifacts: {
|
|
24
|
-
id: ObjectId;
|
|
25
|
-
lastVersion: ObjectVersion;
|
|
26
|
-
}[]) => Promise<Map<ObjectId, {
|
|
27
|
-
version: ObjectVersion;
|
|
28
|
-
diff?: string;
|
|
29
|
-
}>>;
|
|
30
|
-
export type SessionRunOptions = {
|
|
31
|
-
artifacts: ArtifactDefinition[];
|
|
32
|
-
/**
|
|
33
|
-
* Non-artifact specific tools.
|
|
34
|
-
*/
|
|
35
|
-
tools: ToolId[];
|
|
36
|
-
history: Message[];
|
|
37
|
-
prompt: string;
|
|
38
|
-
generationOptions?: Pick<GenerateRequest, 'model'>;
|
|
39
|
-
extensions?: ToolContextExtensions;
|
|
40
|
-
systemPrompt?: string;
|
|
41
|
-
/**
|
|
42
|
-
* Pre-require artifacts.
|
|
43
|
-
*/
|
|
44
|
-
requiredArtifactIds?: string[];
|
|
45
|
-
client: AiServiceClient;
|
|
46
|
-
toolResolver: ToolResolver;
|
|
47
|
-
/**
|
|
48
|
-
* Executable tools that do not go through the tool resolver.
|
|
49
|
-
*/
|
|
50
|
-
executableTools?: ExecutableTool[];
|
|
51
|
-
/**
|
|
52
|
-
* @see ArtifactDiffResolver
|
|
53
|
-
*/
|
|
54
|
-
artifactDiffResolver?: ArtifactDiffResolver;
|
|
55
|
-
};
|
|
56
|
-
type OperationModel = 'planning' | 'importing' | 'configured';
|
|
57
|
-
export type AiSessionOptions = {
|
|
58
|
-
/**
|
|
59
|
-
* Determines the agent's handling of the artifacts definitions:
|
|
60
|
-
*
|
|
61
|
-
* - `planning`: The model will create a plan with required artifacts for each step.
|
|
62
|
-
* - `importing`: The model can query registry and only pull in the artifacts that are required to complete the task.
|
|
63
|
-
* - `configured`: The available artifacts are pre-selected and the model cannot select additional artifacts.
|
|
64
|
-
*/
|
|
65
|
-
operationModel: OperationModel;
|
|
66
|
-
};
|
|
67
|
-
export declare class AISession {
|
|
36
|
+
export declare class AiSession {
|
|
68
37
|
private readonly _options;
|
|
69
|
-
/**
|
|
70
|
-
private readonly
|
|
71
|
-
/**
|
|
72
|
-
private _pending;
|
|
73
|
-
/** Current streaming response. */
|
|
74
|
-
private _stream;
|
|
75
|
-
/** Prior history from queue. */
|
|
38
|
+
/** Prevents concurrent execution of session. */
|
|
39
|
+
private readonly _semaphore;
|
|
40
|
+
/** Message history from queue. */
|
|
76
41
|
private _history;
|
|
42
|
+
/** Pending messages for this session (incl. the current prompt). */
|
|
43
|
+
private _pending;
|
|
44
|
+
constructor(_options?: AiSessionOptions);
|
|
45
|
+
run: <Tools extends Record<string, Tool.Any>>({ prompt, system: systemTemplate, history, objects, blueprints, toolkit, observer, }: AiSessionRunParams<Tools>) => Effect.Effect<Message.Message[], AiSessionRunError, AiSessionRunRequirements>;
|
|
77
46
|
/**
|
|
78
|
-
*
|
|
79
|
-
*/
|
|
80
|
-
readonly message: Event<import("@dxos/echo/Type").OfKind<import("@dxos/echo-schema").EntityKind.Object> & {
|
|
81
|
-
id: string;
|
|
82
|
-
content: ({
|
|
83
|
-
pending?: boolean | undefined;
|
|
84
|
-
type: "text";
|
|
85
|
-
text: string;
|
|
86
|
-
disposition?: string | undefined;
|
|
87
|
-
} | {
|
|
88
|
-
pending?: boolean | undefined;
|
|
89
|
-
type: "json";
|
|
90
|
-
disposition?: string | undefined;
|
|
91
|
-
json: string;
|
|
92
|
-
} | {
|
|
93
|
-
pending?: boolean | undefined;
|
|
94
|
-
id?: string | undefined;
|
|
95
|
-
type: "image";
|
|
96
|
-
source?: {
|
|
97
|
-
type: "base64";
|
|
98
|
-
mediaType: string;
|
|
99
|
-
data: string;
|
|
100
|
-
} | undefined;
|
|
101
|
-
} | {
|
|
102
|
-
pending?: boolean | undefined;
|
|
103
|
-
id: string;
|
|
104
|
-
type: "tool_use";
|
|
105
|
-
name: string;
|
|
106
|
-
input: unknown;
|
|
107
|
-
currentStatus?: {
|
|
108
|
-
readonly id: string;
|
|
109
|
-
message: string;
|
|
110
|
-
} | undefined;
|
|
111
|
-
} | {
|
|
112
|
-
pending?: boolean | undefined;
|
|
113
|
-
type: "tool_result";
|
|
114
|
-
toolUseId: string;
|
|
115
|
-
content: string;
|
|
116
|
-
isError?: boolean | undefined;
|
|
117
|
-
})[];
|
|
118
|
-
role: "user" | "assistant";
|
|
119
|
-
}>;
|
|
120
|
-
/**
|
|
121
|
-
* Complete block added to Message.
|
|
122
|
-
*/
|
|
123
|
-
readonly block: Event<{
|
|
124
|
-
pending?: boolean | undefined;
|
|
125
|
-
type: "text";
|
|
126
|
-
text: string;
|
|
127
|
-
disposition?: string | undefined;
|
|
128
|
-
} | {
|
|
129
|
-
pending?: boolean | undefined;
|
|
130
|
-
type: "json";
|
|
131
|
-
disposition?: string | undefined;
|
|
132
|
-
json: string;
|
|
133
|
-
} | {
|
|
134
|
-
pending?: boolean | undefined;
|
|
135
|
-
id?: string | undefined;
|
|
136
|
-
type: "image";
|
|
137
|
-
source?: {
|
|
138
|
-
type: "base64";
|
|
139
|
-
mediaType: string;
|
|
140
|
-
data: string;
|
|
141
|
-
} | undefined;
|
|
142
|
-
} | {
|
|
143
|
-
pending?: boolean | undefined;
|
|
144
|
-
id: string;
|
|
145
|
-
type: "tool_use";
|
|
146
|
-
name: string;
|
|
147
|
-
input: unknown;
|
|
148
|
-
currentStatus?: {
|
|
149
|
-
readonly id: string;
|
|
150
|
-
message: string;
|
|
151
|
-
} | undefined;
|
|
152
|
-
} | {
|
|
153
|
-
pending?: boolean | undefined;
|
|
154
|
-
type: "tool_result";
|
|
155
|
-
toolUseId: string;
|
|
156
|
-
content: string;
|
|
157
|
-
isError?: boolean | undefined;
|
|
158
|
-
}>;
|
|
159
|
-
/**
|
|
160
|
-
* Update partial block (while streaming).
|
|
161
|
-
*/
|
|
162
|
-
readonly update: Event<{
|
|
163
|
-
pending?: boolean | undefined;
|
|
164
|
-
type: "text";
|
|
165
|
-
text: string;
|
|
166
|
-
disposition?: string | undefined;
|
|
167
|
-
} | {
|
|
168
|
-
pending?: boolean | undefined;
|
|
169
|
-
type: "json";
|
|
170
|
-
disposition?: string | undefined;
|
|
171
|
-
json: string;
|
|
172
|
-
} | {
|
|
173
|
-
pending?: boolean | undefined;
|
|
174
|
-
id?: string | undefined;
|
|
175
|
-
type: "image";
|
|
176
|
-
source?: {
|
|
177
|
-
type: "base64";
|
|
178
|
-
mediaType: string;
|
|
179
|
-
data: string;
|
|
180
|
-
} | undefined;
|
|
181
|
-
} | {
|
|
182
|
-
pending?: boolean | undefined;
|
|
183
|
-
id: string;
|
|
184
|
-
type: "tool_use";
|
|
185
|
-
name: string;
|
|
186
|
-
input: unknown;
|
|
187
|
-
currentStatus?: {
|
|
188
|
-
readonly id: string;
|
|
189
|
-
message: string;
|
|
190
|
-
} | undefined;
|
|
191
|
-
} | {
|
|
192
|
-
pending?: boolean | undefined;
|
|
193
|
-
type: "tool_result";
|
|
194
|
-
toolUseId: string;
|
|
195
|
-
content: string;
|
|
196
|
-
isError?: boolean | undefined;
|
|
197
|
-
}>;
|
|
198
|
-
/**
|
|
199
|
-
* Unparsed events from the underlying generation stream.
|
|
200
|
-
*/
|
|
201
|
-
readonly streamEvent: Event<import("@dxos/ai").GenerationStreamEvent>;
|
|
202
|
-
/**
|
|
203
|
-
* User prompt or tool result.
|
|
204
|
-
*/
|
|
205
|
-
readonly userMessage: Event<import("@dxos/echo/Type").OfKind<import("@dxos/echo-schema").EntityKind.Object> & {
|
|
206
|
-
id: string;
|
|
207
|
-
role: "user" | "assistant";
|
|
208
|
-
content: ({
|
|
209
|
-
pending?: boolean | undefined;
|
|
210
|
-
type: "text";
|
|
211
|
-
disposition?: string | undefined;
|
|
212
|
-
text: string;
|
|
213
|
-
} | {
|
|
214
|
-
pending?: boolean | undefined;
|
|
215
|
-
type: "json";
|
|
216
|
-
disposition?: string | undefined;
|
|
217
|
-
json: string;
|
|
218
|
-
} | {
|
|
219
|
-
pending?: boolean | undefined;
|
|
220
|
-
id?: string | undefined;
|
|
221
|
-
type: "image";
|
|
222
|
-
source?: {
|
|
223
|
-
type: "base64";
|
|
224
|
-
mediaType: string;
|
|
225
|
-
data: string;
|
|
226
|
-
} | undefined;
|
|
227
|
-
} | {
|
|
228
|
-
pending?: boolean | undefined;
|
|
229
|
-
id: string;
|
|
230
|
-
name: string;
|
|
231
|
-
type: "tool_use";
|
|
232
|
-
input: unknown;
|
|
233
|
-
currentStatus?: {
|
|
234
|
-
readonly id: string;
|
|
235
|
-
message: string;
|
|
236
|
-
} | undefined;
|
|
237
|
-
} | {
|
|
238
|
-
pending?: boolean | undefined;
|
|
239
|
-
type: "tool_result";
|
|
240
|
-
content: string;
|
|
241
|
-
toolUseId: string;
|
|
242
|
-
isError?: boolean | undefined;
|
|
243
|
-
})[];
|
|
244
|
-
}>;
|
|
245
|
-
/**
|
|
246
|
-
* Agent self-reporting its status.
|
|
247
|
-
* Triggered by the model.
|
|
248
|
-
*/
|
|
249
|
-
readonly statusReport: Event<AgentStatus>;
|
|
250
|
-
/**
|
|
251
|
-
* Emits when the session is done.
|
|
252
|
-
*/
|
|
253
|
-
readonly done: Event<void>;
|
|
254
|
-
/**
|
|
255
|
-
* Emits when the tool reports its status.
|
|
256
|
-
* Triggered by the tool execution function.
|
|
257
|
-
*/
|
|
258
|
-
readonly toolStatusReport: Event<{
|
|
259
|
-
message: Message;
|
|
260
|
-
status: AgentStatus;
|
|
261
|
-
}>;
|
|
262
|
-
constructor(_options: AiSessionOptions);
|
|
263
|
-
/**
|
|
264
|
-
* Runs the AI model loop interacting with tools and artifacts.
|
|
265
|
-
* @param options - The session options.
|
|
266
|
-
* @returns The messages generated by the session, including the user's prompt.
|
|
47
|
+
* @deprecated
|
|
267
48
|
*/
|
|
268
|
-
|
|
269
|
-
runStructured<S extends Schema.Schema.AnyNoContext>(schema: S, options: SessionRunOptions): Promise<Schema.Schema.Type<S>>;
|
|
270
|
-
private _formatUserPrompt;
|
|
271
|
-
private _createQueryArtifactsTool;
|
|
272
|
-
private _createRequireTool;
|
|
273
|
-
private _createPlanningTool;
|
|
274
|
-
private _onToolStatusReport;
|
|
275
|
-
abort(): void;
|
|
276
|
-
}
|
|
277
|
-
declare const AIServiecOverloadedError_base: Schema.TaggedErrorClass<AIServiecOverloadedError, "AIServiecOverloadedError", {
|
|
278
|
-
readonly _tag: Schema.tag<"AIServiecOverloadedError">;
|
|
279
|
-
}>;
|
|
280
|
-
export declare class AIServiecOverloadedError extends AIServiecOverloadedError_base {
|
|
49
|
+
runStructured<S extends Schema.Schema.AnyNoContext>(_schema: S, _options: AiSessionRunParams<any>): Promise<Schema.Schema.Type<S>>;
|
|
281
50
|
}
|
|
282
|
-
export {};
|
|
283
51
|
//# sourceMappingURL=session.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"session.d.ts","sourceRoot":"","sources":["../../../../src/session/session.ts"],"names":[],"mappings":"AAIA,OAAO,
|
|
1
|
+
{"version":3,"file":"session.d.ts","sourceRoot":"","sources":["../../../../src/session/session.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,KAAK,OAAO,MAAM,oBAAoB,CAAC;AACnD,OAAO,KAAK,aAAa,MAAM,0BAA0B,CAAC;AAC1D,OAAO,KAAK,KAAK,IAAI,MAAM,iBAAiB,CAAC;AAC7C,OAAO,KAAK,KAAK,OAAO,MAAM,oBAAoB,CAAC;AAEnD,OAAO,KAAK,MAAM,MAAM,eAAe,CAAC;AACxC,OAAO,KAAK,KAAK,MAAM,MAAM,eAAe,CAAC;AAG7C,OAAO,EAGL,KAAK,mBAAmB,EACxB,KAAK,wBAAwB,EAC7B,KAAK,oBAAoB,EACzB,KAAK,mBAAmB,EAGzB,MAAM,UAAU,CAAC;AAClB,OAAO,EAAE,KAAK,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAElD,OAAO,EAAE,GAAG,EAAE,MAAM,YAAY,CAAC;AACjC,OAAO,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AAEjD,OAAO,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AAEtC,OAAO,EAAE,KAAK,gBAAgB,EAAE,MAAM,WAAW,CAAC;AAGlD,OAAO,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAC;AAEhD,MAAM,MAAM,iBAAiB,GAAG,OAAO,CAAC,OAAO,GAAG,wBAAwB,GAAG,mBAAmB,GAAG,gBAAgB,CAAC;AAEpH,MAAM,MAAM,wBAAwB,GAChC,aAAa,CAAC,aAAa,GAC3B,oBAAoB,GACpB,mBAAmB,GACnB,cAAc,CAAC;AAEnB,MAAM,MAAM,kBAAkB,CAAC,KAAK,SAAS,MAAM,CAAC,MA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ai/Toolkit';
|
|
3
|
+
import * as Effect from 'effect/Effect';
|
|
4
|
+
import { type AiToolNotFoundError, ToolExecutionService, type ToolId, ToolResolverService } from '@dxos/ai';
|
|
5
|
+
import { type Blueprint } from '@dxos/blueprints';
|
|
6
|
+
export type ToolkitParams<Tools extends Record<string, Tool.Any>> = {
|
|
7
|
+
toolkit?: Toolkit.Toolkit<Tools>;
|
|
8
|
+
toolIds?: ToolId[];
|
|
9
|
+
blueprints?: Blueprint.Blueprint[];
|
|
10
|
+
};
|
|
11
|
+
/**
|
|
12
|
+
* Build a combined toolkit from the blueprint tools and the provided toolkit.
|
|
13
|
+
*/
|
|
14
|
+
export declare const createToolkit: <Tools extends Record<string, Tool.Any> = {}>({ toolkit: toolkitParam, toolIds, blueprints, }: ToolkitParams<Tools>) => Effect.Effect<Toolkit.WithHandler<any>, AiToolNotFoundError, ToolResolverService | ToolExecutionService | Tool.HandlersFor<Tools>>;
|
|
15
|
+
//# sourceMappingURL=toolkit.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"toolkit.d.ts","sourceRoot":"","sources":["../../../../src/session/toolkit.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,KAAK,IAAI,MAAM,iBAAiB,CAAC;AAC7C,OAAO,KAAK,OAAO,MAAM,oBAAoB,CAAC;AAE9C,OAAO,KAAK,MAAM,MAAM,eAAe,CAAC;AAExC,OAAO,EAAE,KAAK,mBAAmB,EAAE,oBAAoB,EAAE,KAAK,MAAM,EAAE,mBAAmB,EAAE,MAAM,UAAU,CAAC;AAC5G,OAAO,EAAE,KAAK,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAGlD,MAAM,MAAM,aAAa,CAAC,KAAK,SAAS,MAAM,CAAC,MAAM,EAAE,IAAI,CAAC,GAAG,CAAC,IAAI;IAClE,OAAO,CAAC,EAAE,OAAO,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;IACjC,OAAO,CAAC,EAAE,MAAM,EAAE,CAAC;IACnB,UAAU,CAAC,EAAE,SAAS,CAAC,SAAS,EAAE,CAAC;CACpC,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,aAAa,GAAI,KAAK,SAAS,MAAM,CAAC,MAAM,EAAE,IAAI,CAAC,GAAG,CAAC,GAAG,EAAE,EAAE,iDAIxE,aAAa,CAAC,KAAK,CAAC,KAAG,MAAM,CAAC,MAAM,CACrC,OAAO,CAAC,WAAW,CAAC,GAAG,CAAC,EACxB,mBAAmB,EACnB,mBAAmB,GAAG,oBAAoB,GAAG,IAAI,CAAC,WAAW,CAAC,KAAK,CAAC,CAkBlE,CAAC"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { type
|
|
1
|
+
import * as Schema from 'effect/Schema';
|
|
2
|
+
import { type AnyEchoObject } from '@dxos/echo/internal';
|
|
3
3
|
import { type ObjectVersion } from '@dxos/echo-db';
|
|
4
|
-
import { type
|
|
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,8 +14,8 @@ 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:
|
|
18
|
-
createBlock: (pin: VersionPin) =>
|
|
17
|
+
fromObject: (object: AnyEchoObject) => VersionPin;
|
|
18
|
+
createBlock: (pin: VersionPin) => ContentBlock.Any;
|
|
19
19
|
};
|
|
20
20
|
export {};
|
|
21
21
|
//# sourceMappingURL=version-pin.d.ts.map
|
|
@@ -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,aAAa,EAAY,MAAM,qBAAqB,CAAC;AACnE,OAAO,EAAE,KAAK,aAAa,EAAc,MAAM,eAAe,CAAC;AAC/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,aAAa,KAAK,UAAU,CAAC;IAClD,WAAW,EAAE,CAAC,GAAG,EAAE,UAAU,KAAK,YAAY,CAAC,GAAG,CAAC;CAiBpD,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/templates/index.ts"],"names":[],"mappings":"AAIA,cAAc,UAAU,CAAC"}
|
|
@@ -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"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type * as Effect from 'effect/Effect';
|
|
2
|
+
import * as Schema from 'effect/Schema';
|
|
3
|
+
import { type ObjectNotFoundError, type Type } from '@dxos/echo';
|
|
4
|
+
import { type ObjectId } from '@dxos/echo/internal';
|
|
5
|
+
import { DatabaseService } from '@dxos/echo-db';
|
|
6
|
+
import { DXN, type SpaceId } from '@dxos/keys';
|
|
7
|
+
/**
|
|
8
|
+
* @deprecated
|
|
9
|
+
*/
|
|
10
|
+
export declare const createArtifactElement: (id: ObjectId) => string;
|
|
11
|
+
/**
|
|
12
|
+
* A model-friendly way to reference an object.
|
|
13
|
+
* Supports vairous formats that will be normalized to a DXN.
|
|
14
|
+
*/
|
|
15
|
+
export declare const ArtifactId: Schema.Schema<string> & {
|
|
16
|
+
toDXN: (reference: ArtifactId, owningSpaceId?: SpaceId) => DXN;
|
|
17
|
+
resolve: <S extends Type.Obj.Any | Type.Relation.Any>(schema: S, ref: ArtifactId) => Effect.Effect<Schema.Schema.Type<S>, ObjectNotFoundError, DatabaseService>;
|
|
18
|
+
};
|
|
19
|
+
export type ArtifactId = Schema.Schema.Type<typeof ArtifactId>;
|
|
20
|
+
//# sourceMappingURL=artifact.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"artifact.d.ts","sourceRoot":"","sources":["../../../../src/types/artifact.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,KAAK,MAAM,MAAM,eAAe,CAAC;AAC7C,OAAO,KAAK,MAAM,MAAM,eAAe,CAAC;AAExC,OAAO,EAAE,KAAK,mBAAmB,EAAE,KAAK,IAAI,EAAE,MAAM,YAAY,CAAC;AACjE,OAAO,EAAE,KAAK,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AACpD,OAAO,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AAChD,OAAO,EAAE,GAAG,EAAmB,KAAK,OAAO,EAAE,MAAM,YAAY,CAAC;AAGhE;;GAEG;AACH,eAAO,MAAM,qBAAqB,GAAI,IAAI,QAAQ,WAA4B,CAAC;AAE/E;;;GAGG;AAEH,eAAO,MAAM,UAAU,EAAE,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,GAAG;IAC/C,KAAK,EAAE,CAAC,SAAS,EAAE,UAAU,EAAE,aAAa,CAAC,EAAE,OAAO,KAAK,GAAG,CAAC;IAC/D,OAAO,EAAE,CAAC,CAAC,SAAS,IAAI,CAAC,GAAG,CAAC,GAAG,GAAG,IAAI,CAAC,QAAQ,CAAC,GAAG,EAClD,MAAM,EAAE,CAAC,EACT,GAAG,EAAE,UAAU,KACZ,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,mBAAmB,EAAE,eAAe,CAAC,CAAC;CAwCjF,CAAC;AAEF,MAAM,MAAM,UAAU,GAAG,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,UAAU,CAAC,CAAC"}
|