@dxos/assistant 0.8.4-main.dedc0f3 → 0.8.4-main.dfabb4ec29
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -0
- package/dist/lib/neutral/extraction/index.mjs +202 -0
- package/dist/lib/neutral/extraction/index.mjs.map +7 -0
- package/dist/lib/neutral/index.mjs +1736 -0
- package/dist/lib/neutral/index.mjs.map +7 -0
- package/dist/lib/neutral/meta.json +1 -0
- package/dist/types/src/conversation/context.d.ts +124 -64
- package/dist/types/src/conversation/context.d.ts.map +1 -1
- package/dist/types/src/conversation/context.test.d.ts +2 -0
- package/dist/types/src/conversation/context.test.d.ts.map +1 -0
- package/dist/types/src/conversation/index.d.ts +1 -1
- package/dist/types/src/conversation/index.d.ts.map +1 -1
- package/dist/types/src/conversation/session.d.ts +73 -0
- package/dist/types/src/conversation/session.d.ts.map +1 -0
- package/dist/types/src/diff.d.ts +3 -1
- package/dist/types/src/diff.d.ts.map +1 -1
- package/dist/types/src/errors.d.ts +40 -48
- 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-ner-function/index.d.ts +0 -1
- package/dist/types/src/extraction/extraction-ner-function/index.d.ts.map +1 -1
- package/dist/types/src/extraction/extraction-ner-function/named-entity-recognition.d.ts.map +1 -1
- package/dist/types/src/extraction/extraction.d.ts +1066 -303
- package/dist/types/src/extraction/extraction.d.ts.map +1 -1
- package/dist/types/src/extraction/index.d.ts +0 -1
- package/dist/types/src/extraction/index.d.ts.map +1 -1
- package/dist/types/src/extraction/quotes.d.ts +3 -3
- package/dist/types/src/extraction/quotes.d.ts.map +1 -1
- package/dist/types/src/functions/services.d.ts +15 -5
- package/dist/types/src/functions/services.d.ts.map +1 -1
- package/dist/types/src/index.d.ts +3 -1
- package/dist/types/src/index.d.ts.map +1 -1
- package/dist/types/src/session/artifact-diff.d.ts +2 -2
- package/dist/types/src/session/artifact-diff.d.ts.map +1 -1
- package/dist/types/src/session/error-handling.d.ts +2 -2
- package/dist/types/src/session/error-handling.d.ts.map +1 -1
- package/dist/types/src/session/format.d.ts +8 -175
- package/dist/types/src/session/format.d.ts.map +1 -1
- package/dist/types/src/session/index.d.ts +2 -1
- package/dist/types/src/session/index.d.ts.map +1 -1
- package/dist/types/src/session/observer.d.ts +7 -6
- package/dist/types/src/session/observer.d.ts.map +1 -1
- package/dist/types/src/session/request.d.ts +104 -0
- package/dist/types/src/session/request.d.ts.map +1 -0
- package/dist/types/src/session/toolkit.d.ts +11 -9
- package/dist/types/src/session/toolkit.d.ts.map +1 -1
- package/dist/types/src/session/version-pin.d.ts +4 -4
- package/dist/types/src/session/version-pin.d.ts.map +1 -1
- package/dist/types/src/templates/system.d.ts +1 -2
- package/dist/types/src/templates/system.d.ts.map +1 -1
- package/dist/types/src/tracing.d.ts +233 -0
- package/dist/types/src/tracing.d.ts.map +1 -0
- package/dist/types/src/types/artifact.d.ts +28 -0
- package/dist/types/src/types/artifact.d.ts.map +1 -0
- package/dist/types/src/types/index.d.ts +2 -0
- package/dist/types/src/types/index.d.ts.map +1 -0
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +35 -46
- package/src/conversation/context.test.ts +52 -0
- package/src/conversation/context.ts +324 -75
- package/src/conversation/index.ts +1 -1
- package/src/conversation/session.ts +323 -0
- package/src/diff.test.ts +37 -6
- package/src/diff.ts +18 -4
- package/src/errors.ts +4 -4
- package/src/execution-graph.test.ts +740 -0
- package/src/execution-graph.ts +519 -0
- 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.ts +44 -15
- package/src/extraction/index.ts +0 -1
- package/src/extraction/quotes.test.ts +2 -2
- package/src/extraction/quotes.ts +6 -7
- package/src/functions/services.ts +156 -61
- package/src/index.ts +3 -1
- package/src/session/artifact-diff.ts +2 -2
- package/src/session/error-handling.ts +11 -6
- package/src/session/format.ts +35 -27
- package/src/session/index.ts +2 -1
- package/src/session/observer.ts +8 -4
- package/src/session/request.ts +347 -0
- package/src/session/toolkit.ts +32 -27
- package/src/session/version-pin.ts +7 -7
- package/src/templates/{format.tpl → instructions/format.tpl} +1 -4
- package/src/templates/instructions/system.tpl +96 -0
- package/src/templates/system.ts +9 -8
- package/src/tracing.ts +57 -0
- package/src/{types.ts → types/artifact.ts} +44 -7
- package/src/types/index.ts +5 -0
- package/dist/lib/browser/chunk-5GJYG2ML.mjs +0 -396
- package/dist/lib/browser/chunk-5GJYG2ML.mjs.map +0 -7
- package/dist/lib/browser/chunk-UB26N5UF.mjs +0 -89
- package/dist/lib/browser/chunk-UB26N5UF.mjs.map +0 -7
- package/dist/lib/browser/extraction/index.mjs +0 -268
- package/dist/lib/browser/extraction/index.mjs.map +0 -7
- package/dist/lib/browser/index.mjs +0 -469
- package/dist/lib/browser/index.mjs.map +0 -7
- package/dist/lib/browser/meta.json +0 -1
- package/dist/lib/browser/named-entity-recognition-QPYHML66.mjs +0 -13
- package/dist/lib/browser/named-entity-recognition-QPYHML66.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-BCFXTNSK.mjs +0 -91
- package/dist/lib/node-esm/chunk-BCFXTNSK.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-FLFCEB4P.mjs +0 -398
- package/dist/lib/node-esm/chunk-FLFCEB4P.mjs.map +0 -7
- package/dist/lib/node-esm/extraction/index.mjs +0 -269
- package/dist/lib/node-esm/extraction/index.mjs.map +0 -7
- package/dist/lib/node-esm/index.mjs +0 -470
- package/dist/lib/node-esm/index.mjs.map +0 -7
- package/dist/lib/node-esm/meta.json +0 -1
- package/dist/lib/node-esm/named-entity-recognition-2HDF46YX.mjs +0 -14
- package/dist/lib/node-esm/named-entity-recognition-2HDF46YX.mjs.map +0 -7
- package/dist/types/src/conversation/conversation.d.ts +0 -42
- package/dist/types/src/conversation/conversation.d.ts.map +0 -1
- package/dist/types/src/extraction/extraction-llm-function/extraction-llm-function.d.ts +0 -4
- package/dist/types/src/extraction/extraction-llm-function/extraction-llm-function.d.ts.map +0 -1
- package/dist/types/src/extraction/extraction-llm-function/extraction-llm-function.test.d.ts +0 -2
- package/dist/types/src/extraction/extraction-llm-function/extraction-llm-function.test.d.ts.map +0 -1
- package/dist/types/src/extraction/extraction-llm-function/index.d.ts +0 -2
- package/dist/types/src/extraction/extraction-llm-function/index.d.ts.map +0 -1
- package/dist/types/src/extraction/extraction-ner-function/extraction-ner-function.d.ts +0 -337
- package/dist/types/src/extraction/extraction-ner-function/extraction-ner-function.d.ts.map +0 -1
- package/dist/types/src/extraction/extraction-ner-function/extraction-ner-function.test.d.ts +0 -2
- package/dist/types/src/extraction/extraction-ner-function/extraction-ner-function.test.d.ts.map +0 -1
- package/dist/types/src/session/format.test.d.ts +0 -2
- package/dist/types/src/session/format.test.d.ts.map +0 -1
- package/dist/types/src/session/session.d.ts +0 -47
- package/dist/types/src/session/session.d.ts.map +0 -1
- package/dist/types/src/session/session.test.d.ts +0 -2
- package/dist/types/src/session/session.test.d.ts.map +0 -1
- package/dist/types/src/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/conversation.ts +0 -123
- package/src/extraction/extraction-llm-function/extraction-llm-function.test.ts +0 -84
- package/src/extraction/extraction-llm-function/extraction-llm-function.ts +0 -70
- package/src/extraction/extraction-llm-function/index.ts +0 -5
- package/src/extraction/extraction-ner-function/extraction-ner-function.test.ts +0 -115
- package/src/extraction/extraction-ner-function/extraction-ner-function.ts +0 -62
- 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 -308
- package/src/session/session.ts +0 -201
- package/src/session/version-pin.test.ts +0 -7
- package/src/summarization/summarization.test.ts +0 -197
- package/src/templates/system.tpl +0 -50
- /package/src/extraction/extraction-llm-function/{instructions.tpl → transcription-instructions.tpl} +0 -0
|
@@ -1,96 +1,156 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import
|
|
1
|
+
import { Atom, Registry } from '@effect-atom/atom-react';
|
|
2
|
+
import * as Context from 'effect/Context';
|
|
3
|
+
import * as Effect from 'effect/Effect';
|
|
4
|
+
import * as Runtime from 'effect/Runtime';
|
|
5
|
+
import * as Schema from 'effect/Schema';
|
|
6
|
+
import { Blueprint } from '@dxos/compute';
|
|
7
|
+
import { Resource } from '@dxos/context';
|
|
8
|
+
import { DXN, Feed, Obj, Ref, Type } from '@dxos/echo';
|
|
6
9
|
import { ComplexSet } from '@dxos/util';
|
|
7
10
|
/**
|
|
8
11
|
* Thread message that binds or unbinds contextual objects to a conversation.
|
|
9
12
|
*/
|
|
10
|
-
export declare const ContextBinding: Type.
|
|
11
|
-
blueprints:
|
|
12
|
-
added:
|
|
13
|
-
key:
|
|
14
|
-
name:
|
|
15
|
-
description
|
|
16
|
-
instructions:
|
|
17
|
-
source:
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
13
|
+
export declare const ContextBinding: Type.Obj<{
|
|
14
|
+
readonly blueprints: {
|
|
15
|
+
readonly added: readonly import("@dxos/echo/internal").Ref<import("@dxos/echo/Entity").OfKind<import("@dxos/echo/internal").EntityKind.Object> & {
|
|
16
|
+
readonly key: string;
|
|
17
|
+
readonly name: string;
|
|
18
|
+
readonly description?: string | undefined;
|
|
19
|
+
readonly instructions: {
|
|
20
|
+
readonly source: import("@dxos/echo/internal").Ref<import("@dxos/echo/Entity").OfKind<import("@dxos/echo/internal").EntityKind.Object> & {
|
|
21
|
+
readonly name?: string | undefined;
|
|
22
|
+
readonly content: string;
|
|
23
|
+
}>;
|
|
24
|
+
readonly inputs?: readonly {
|
|
25
|
+
readonly name: string;
|
|
26
|
+
readonly kind: "operation" | "value";
|
|
27
|
+
readonly default?: any;
|
|
28
|
+
readonly operation?: string | undefined;
|
|
29
|
+
}[] | undefined;
|
|
30
|
+
};
|
|
31
|
+
readonly tools: readonly (string & import("effect/Brand").Brand<"ToolId">)[];
|
|
32
|
+
readonly agentCanEnable?: boolean | undefined;
|
|
33
|
+
readonly mcpServers?: readonly {
|
|
34
|
+
readonly name?: string | undefined;
|
|
35
|
+
readonly url: string;
|
|
36
|
+
readonly protocol: "http" | "sse";
|
|
37
|
+
readonly apiKey?: string | undefined;
|
|
38
|
+
}[] | undefined;
|
|
39
|
+
}>[];
|
|
40
|
+
readonly removed: readonly import("@dxos/echo/internal").Ref<import("@dxos/echo/Entity").OfKind<import("@dxos/echo/internal").EntityKind.Object> & {
|
|
41
|
+
readonly key: string;
|
|
42
|
+
readonly name: string;
|
|
43
|
+
readonly description?: string | undefined;
|
|
44
|
+
readonly instructions: {
|
|
45
|
+
readonly source: import("@dxos/echo/internal").Ref<import("@dxos/echo/Entity").OfKind<import("@dxos/echo/internal").EntityKind.Object> & {
|
|
46
|
+
readonly name?: string | undefined;
|
|
47
|
+
readonly content: string;
|
|
48
|
+
}>;
|
|
49
|
+
readonly inputs?: readonly {
|
|
50
|
+
readonly name: string;
|
|
51
|
+
readonly kind: "operation" | "value";
|
|
52
|
+
readonly default?: any;
|
|
53
|
+
readonly operation?: string | undefined;
|
|
54
|
+
}[] | undefined;
|
|
55
|
+
};
|
|
56
|
+
readonly tools: readonly (string & import("effect/Brand").Brand<"ToolId">)[];
|
|
57
|
+
readonly agentCanEnable?: boolean | undefined;
|
|
58
|
+
readonly mcpServers?: readonly {
|
|
59
|
+
readonly name?: string | undefined;
|
|
60
|
+
readonly url: string;
|
|
61
|
+
readonly protocol: "http" | "sse";
|
|
62
|
+
readonly apiKey?: string | undefined;
|
|
63
|
+
}[] | undefined;
|
|
64
|
+
}>[];
|
|
65
|
+
};
|
|
66
|
+
readonly objects: {
|
|
67
|
+
readonly added: readonly import("@dxos/echo/internal").Ref<import("@dxos/echo/Entity").OfKind<import("@dxos/echo/internal").EntityKind.Object> & Obj.Unknown>[];
|
|
68
|
+
readonly removed: readonly import("@dxos/echo/internal").Ref<import("@dxos/echo/Entity").OfKind<import("@dxos/echo/internal").EntityKind.Object> & Obj.Unknown>[];
|
|
69
|
+
};
|
|
70
|
+
}, Schema.Struct.Fields>;
|
|
56
71
|
export interface ContextBinding extends Schema.Schema.Type<typeof ContextBinding> {
|
|
57
72
|
}
|
|
58
73
|
export type BindingProps = Partial<{
|
|
59
74
|
blueprints: Ref.Ref<Blueprint.Blueprint>[];
|
|
60
|
-
objects: Ref.Ref<
|
|
75
|
+
objects: Ref.Ref<Obj.Unknown>[];
|
|
61
76
|
}>;
|
|
62
77
|
export declare class Bindings {
|
|
63
78
|
readonly blueprints: ComplexSet<Ref.Ref<Blueprint.Blueprint>>;
|
|
64
|
-
readonly objects: ComplexSet<Ref.Ref<
|
|
79
|
+
readonly objects: ComplexSet<Ref.Ref<Obj.Unknown>>;
|
|
65
80
|
toJSON(): {
|
|
66
81
|
blueprints: DXN.String[];
|
|
67
82
|
objects: DXN.String[];
|
|
68
83
|
};
|
|
69
84
|
}
|
|
85
|
+
export type AiContextBinderOptions = {
|
|
86
|
+
feed: Feed.Feed;
|
|
87
|
+
runtime: Runtime.Runtime<Feed.FeedService>;
|
|
88
|
+
registry?: Registry.Registry;
|
|
89
|
+
};
|
|
70
90
|
/**
|
|
71
91
|
* Manages bindings of blueprints and objects to a conversation.
|
|
72
92
|
*/
|
|
73
|
-
export declare class AiContextBinder {
|
|
74
|
-
private
|
|
93
|
+
export declare class AiContextBinder extends Resource {
|
|
94
|
+
#private;
|
|
95
|
+
private readonly _blueprints;
|
|
96
|
+
private readonly _objects;
|
|
97
|
+
private readonly _registry;
|
|
98
|
+
private readonly _feed;
|
|
99
|
+
private readonly _runtime;
|
|
100
|
+
constructor(options: AiContextBinderOptions);
|
|
101
|
+
/**
|
|
102
|
+
* Returns the blueprints atom for subscription.
|
|
103
|
+
*/
|
|
104
|
+
get blueprints(): Atom.Atom<Blueprint.Blueprint[]>;
|
|
105
|
+
/**
|
|
106
|
+
* Returns the objects atom for subscription.
|
|
107
|
+
*/
|
|
108
|
+
get objects(): Atom.Atom<Obj.Unknown[]>;
|
|
109
|
+
/**
|
|
110
|
+
* Gets the current blueprints value.
|
|
111
|
+
*/
|
|
112
|
+
getBlueprints(): Blueprint.Blueprint[];
|
|
113
|
+
/**
|
|
114
|
+
* Gets the current objects value.
|
|
115
|
+
*/
|
|
116
|
+
getObjects(): Obj.Unknown[];
|
|
117
|
+
/**
|
|
118
|
+
* Subscribe to changes in blueprints.
|
|
119
|
+
*/
|
|
120
|
+
subscribeBlueprints(cb: (blueprints: Blueprint.Blueprint[]) => void): () => void;
|
|
121
|
+
/**
|
|
122
|
+
* Subscribe to changes in objects.
|
|
123
|
+
*/
|
|
124
|
+
subscribeObjects(cb: (objects: Obj.Unknown[]) => void): () => void;
|
|
125
|
+
protected _open(): Promise<void>;
|
|
75
126
|
/**
|
|
76
|
-
*
|
|
127
|
+
* Re-reads bindings from the feed to pick up changes made by other processes.
|
|
77
128
|
*/
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
129
|
+
sync(): Promise<void>;
|
|
130
|
+
private _updateBindings;
|
|
131
|
+
protected _close(): Promise<void>;
|
|
132
|
+
bind({ blueprints, objects }: BindingProps): Promise<void>;
|
|
133
|
+
unbind({ blueprints, objects }: BindingProps): Promise<void>;
|
|
82
134
|
/**
|
|
83
|
-
*
|
|
135
|
+
* Process bindings to filter duplicates and determine next state.
|
|
136
|
+
*/
|
|
137
|
+
private _processBindings;
|
|
138
|
+
/**
|
|
139
|
+
* Reduce results into sets of blueprints and objects.
|
|
84
140
|
*/
|
|
85
|
-
query(): Promise<Bindings>;
|
|
86
|
-
bind(props: BindingProps): Promise<void>;
|
|
87
|
-
unbind(props: BindingProps): Promise<void>;
|
|
88
141
|
private _reduce;
|
|
142
|
+
/**
|
|
143
|
+
* Merge resolved items into the current set, adding only items not already present (by DXN).
|
|
144
|
+
*/
|
|
145
|
+
private _mergeInto;
|
|
146
|
+
private _resolve;
|
|
89
147
|
}
|
|
90
148
|
declare const AiContextService_base: Context.TagClass<AiContextService, "@dxos/assistant/AiContextService", {
|
|
91
149
|
binder: AiContextBinder;
|
|
92
150
|
}>;
|
|
93
151
|
export declare class AiContextService extends AiContextService_base {
|
|
152
|
+
static bindContext: ({ blueprints, objects }: BindingProps) => Effect.Effect<void, never, AiContextService>;
|
|
153
|
+
static findObjects: <T extends Type.AnyEntity>(type: T) => Effect.Effect<Schema.Schema.Type<T>[], never, AiContextService>;
|
|
94
154
|
}
|
|
95
155
|
export {};
|
|
96
156
|
//# sourceMappingURL=context.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"context.d.ts","sourceRoot":"","sources":["../../../../src/conversation/context.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"context.d.ts","sourceRoot":"","sources":["../../../../src/conversation/context.ts"],"names":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,EAAE,OAAO,EAAE,EAAE,YAAY,GAAG,OAAO,CAAC,IAAI,CAAC,CAsCjE;IAED;;OAEG;IACH,OAAO,CAAC,gBAAgB;IA8BxB;;OAEG;IACH,OAAO,CAAC,OAAO;IAqBf;;OAEG;IACH,OAAO,CAAC,UAAU;YAgBJ,QAAQ;CAmBvB;;YAKW,eAAe;;AAH3B,qBAAa,gBAAiB,SAAQ,qBAKnC;IACD,MAAM,CAAC,WAAW,4BAA6B,YAAY,KAAG,MAAM,CAAC,MAAM,CAAC,IAAI,EAAE,KAAK,EAAE,gBAAgB,CAAC,CAIrG;IAEL,MAAM,CAAC,WAAW,GAAI,CAAC,SAAS,IAAI,CAAC,SAAS,QACtC,CAAC,KACN,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,KAAK,EAAE,gBAAgB,CAAC,CAKhE;CACH"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"context.test.d.ts","sourceRoot":"","sources":["../../../../src/conversation/context.test.ts"],"names":[],"mappings":""}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/conversation/index.ts"],"names":[],"mappings":"AAIA,cAAc,WAAW,CAAC;AAC1B,cAAc,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/conversation/index.ts"],"names":[],"mappings":"AAIA,cAAc,WAAW,CAAC;AAC1B,cAAc,WAAW,CAAC"}
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import type { Registry } from '@effect-atom/atom-react';
|
|
2
|
+
import * as Context from 'effect/Context';
|
|
3
|
+
import * as Effect from 'effect/Effect';
|
|
4
|
+
import * as Layer from 'effect/Layer';
|
|
5
|
+
import * as Runtime from 'effect/Runtime';
|
|
6
|
+
import { type OpaqueToolkit, type ToolExecutionService, type ToolResolverService } from '@dxos/ai';
|
|
7
|
+
import { type OperationRegistry, McpServer, Operation } from '@dxos/compute';
|
|
8
|
+
import { Resource } from '@dxos/context';
|
|
9
|
+
import { Database, Feed } from '@dxos/echo';
|
|
10
|
+
import { Message, type ContentBlock } from '@dxos/types';
|
|
11
|
+
import { type AiRequestRunError, type AiRequestRunRequirements, type GenerationObserver } from '../session';
|
|
12
|
+
import { AiContextBinder, AiContextService } from './context';
|
|
13
|
+
export interface AiSessionRunProps<R = never> {
|
|
14
|
+
prompt: string | ContentBlock.Any[];
|
|
15
|
+
system?: string;
|
|
16
|
+
observer?: GenerationObserver;
|
|
17
|
+
toolkit?: OpaqueToolkit.OpaqueToolkit<R>;
|
|
18
|
+
/**
|
|
19
|
+
* Space-level MCP servers to connect alongside blueprint-defined ones.
|
|
20
|
+
*/
|
|
21
|
+
mcpServers?: readonly McpServer.McpServer[];
|
|
22
|
+
}
|
|
23
|
+
export type AiSessionOptions = {
|
|
24
|
+
feed: Feed.Feed;
|
|
25
|
+
runtime: Runtime.Runtime<Feed.FeedService>;
|
|
26
|
+
registry?: Registry.Registry;
|
|
27
|
+
};
|
|
28
|
+
/**
|
|
29
|
+
* Durable conversation state (initiated by users and agents) backed by a Feed.
|
|
30
|
+
* Executes tools based on AI responses and supports cancellation of in-progress requests.
|
|
31
|
+
*/
|
|
32
|
+
export declare class AiSession extends Resource {
|
|
33
|
+
/**
|
|
34
|
+
* Blueprints and objects bound to the session.
|
|
35
|
+
*/
|
|
36
|
+
private readonly _binder;
|
|
37
|
+
private readonly _feed;
|
|
38
|
+
private readonly _runtime;
|
|
39
|
+
constructor(options: AiSessionOptions);
|
|
40
|
+
protected _open(): Promise<void>;
|
|
41
|
+
get feed(): Feed.Feed;
|
|
42
|
+
get context(): AiContextBinder;
|
|
43
|
+
getHistory(): Promise<Message.Message[]>;
|
|
44
|
+
getTools(): Effect.Effect<Record<string, import('@effect/ai/Tool').Any>, never, ToolExecutionService | ToolResolverService>;
|
|
45
|
+
/**
|
|
46
|
+
* Not provided by default, since users might want to override them.
|
|
47
|
+
*/
|
|
48
|
+
makeToolExecutionServices(): Layer.Layer<ToolExecutionService | ToolResolverService, never, OpaqueToolkit.OpaqueToolkitProvider | Operation.Service | OperationRegistry.Service>;
|
|
49
|
+
/**
|
|
50
|
+
* Creates a new cancelable request effect.
|
|
51
|
+
*/
|
|
52
|
+
createRequest<R = never>(params: AiSessionRunProps<R>): Effect.Effect<Message.Message[], AiRequestRunError, AiRequestRunRequirements | R>;
|
|
53
|
+
}
|
|
54
|
+
declare const AiSessionService_base: Context.TagClass<AiSessionService, "@dxos/assistant/AiSessionService", AiSession>;
|
|
55
|
+
/**
|
|
56
|
+
* Gives access to the ai session.
|
|
57
|
+
*/
|
|
58
|
+
export declare class AiSessionService extends AiSessionService_base {
|
|
59
|
+
/**
|
|
60
|
+
* Create a new session layer from options.
|
|
61
|
+
*/
|
|
62
|
+
static layer: (options: AiSessionOptions) => Layer.Layer<AiSessionService | AiContextService>;
|
|
63
|
+
/**
|
|
64
|
+
* Create a new session with a new feed.
|
|
65
|
+
*/
|
|
66
|
+
static layerNewFeed: (options?: Omit<AiSessionOptions, 'feed' | 'runtime'>) => Layer.Layer<AiSessionService | AiContextService, never, Database.Service | Feed.FeedService>;
|
|
67
|
+
/**
|
|
68
|
+
* Run a prompt in the current session.
|
|
69
|
+
*/
|
|
70
|
+
static run: <R = never>(params: AiSessionRunProps<R>) => Effect.Effect<Message.Message[], AiRequestRunError, AiRequestRunRequirements | AiSessionService | R>;
|
|
71
|
+
}
|
|
72
|
+
export {};
|
|
73
|
+
//# sourceMappingURL=session.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"session.d.ts","sourceRoot":"","sources":["../../../../src/conversation/session.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,yBAAyB,CAAC;AAExD,OAAO,KAAK,OAAO,MAAM,gBAAgB,CAAC;AAC1C,OAAO,KAAK,MAAM,MAAM,eAAe,CAAC;AAGx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AAC,WAAW,CAAC,CAO3F;IAEJ;;OAEG;IACH,MAAM,CAAC,GAAG,GAAI,CAAC,GAAG,KAAK,UACb,iBAAiB,CAAC,CAAC,CAAC,KAC3B,MAAM,CAAC,MAAM,CAAC,OAAO,CAAC,OAAO,EAAE,EAAE,iBAAiB,EAAE,wBAAwB,GAAG,gBAAgB,GAAG,CAAC,CAAC,CAIlG;CACN"}
|
package/dist/types/src/diff.d.ts
CHANGED
|
@@ -11,5 +11,7 @@ export declare const computeDiffsWithCursors: <T>(accessor: DocAccessor<T>, diff
|
|
|
11
11
|
cursor: string;
|
|
12
12
|
text: string;
|
|
13
13
|
}[];
|
|
14
|
-
export declare const applyDiffs: <T>(accessor: DocAccessor<T>, diffs: readonly string[]
|
|
14
|
+
export declare const applyDiffs: <T>(accessor: DocAccessor<T>, diffs: readonly string[], { errorOnNotFound }?: {
|
|
15
|
+
errorOnNotFound?: boolean;
|
|
16
|
+
}) => string;
|
|
15
17
|
//# sourceMappingURL=diff.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"diff.d.ts","sourceRoot":"","sources":["../../../src/diff.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,WAAW,EAAiB,MAAM,eAAe,CAAC;
|
|
1
|
+
{"version":3,"file":"diff.d.ts","sourceRoot":"","sources":["../../../src/diff.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,WAAW,EAAiB,MAAM,eAAe,CAAC;AAc3D,MAAM,MAAM,IAAI,GAAG;IACjB,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,MAAM,CAAC;CACjB,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,WAAW,UAAW,SAAS,MAAM,EAAE,KAAG,IAAI,EA0B1D,CAAC;AAEF,eAAO,MAAM,uBAAuB,GAAI,CAAC,YAAY,WAAW,CAAC,CAAC,CAAC,SAAS,SAAS,MAAM,EAAE;;;GAU5F,CAAC;AAEF,eAAO,MAAM,UAAU,GAAI,CAAC,YAChB,WAAW,CAAC,CAAC,CAAC,SACjB,SAAS,MAAM,EAAE,wBACK;IAAE,eAAe,CAAC,EAAE,OAAO,CAAA;CAAE,KACzD,MAoBF,CAAC"}
|
|
@@ -1,75 +1,67 @@
|
|
|
1
1
|
import { BaseError } from '@dxos/errors';
|
|
2
|
-
declare const
|
|
3
|
-
new (
|
|
4
|
-
#code: "AI_ASSISTANT_ERROR";
|
|
5
|
-
#context: Record<string, unknown>;
|
|
6
|
-
readonly name: "AI_ASSISTANT_ERROR";
|
|
7
|
-
readonly code: "AI_ASSISTANT_ERROR";
|
|
8
|
-
readonly _tag: "AI_ASSISTANT_ERROR";
|
|
9
|
-
readonly context: Record<string, unknown>;
|
|
10
|
-
message: string;
|
|
11
|
-
stack?: string;
|
|
2
|
+
declare const AiModelError_base: {
|
|
3
|
+
new (options?: import("@dxos/errors").BaseErrorOptions): {
|
|
12
4
|
cause?: unknown;
|
|
5
|
+
stack?: string;
|
|
6
|
+
name: "AiModelError";
|
|
7
|
+
context: Record<string, unknown>;
|
|
8
|
+
readonly message: string;
|
|
9
|
+
readonly _tag: "AiModelError";
|
|
13
10
|
};
|
|
14
|
-
|
|
11
|
+
isError(error: unknown): error is Error;
|
|
12
|
+
name: "AiModelError";
|
|
15
13
|
is(error: unknown): error is BaseError;
|
|
16
|
-
wrap(
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
readonly name: "AI_ASSISTANT_ERROR";
|
|
20
|
-
readonly code: "AI_ASSISTANT_ERROR";
|
|
21
|
-
readonly _tag: "AI_ASSISTANT_ERROR";
|
|
22
|
-
readonly context: Record<string, unknown>;
|
|
23
|
-
message: string;
|
|
24
|
-
stack?: string;
|
|
14
|
+
wrap(options?: Omit<import("@dxos/errors").BaseErrorOptions, 'cause'> & {
|
|
15
|
+
ifTypeDiffers?: boolean;
|
|
16
|
+
}): (error: unknown) => {
|
|
25
17
|
cause?: unknown;
|
|
18
|
+
stack?: string;
|
|
19
|
+
name: "AiModelError";
|
|
20
|
+
context: Record<string, unknown>;
|
|
21
|
+
readonly message: string;
|
|
22
|
+
readonly _tag: "AiModelError";
|
|
26
23
|
};
|
|
27
|
-
extend<
|
|
28
|
-
isError(error: unknown): error is Error;
|
|
24
|
+
extend<Name extends string = string>(name: Name, message?: string): any;
|
|
29
25
|
captureStackTrace(targetObject: object, constructorOpt?: Function): void;
|
|
30
26
|
prepareStackTrace?: ((err: Error, stackTraces: NodeJS.CallSite[]) => any) | undefined;
|
|
31
27
|
stackTraceLimit: number;
|
|
32
28
|
};
|
|
33
29
|
/**
|
|
34
|
-
* Generic error
|
|
30
|
+
* Generic error from AI model.
|
|
35
31
|
*/
|
|
36
|
-
export declare class
|
|
32
|
+
export declare class AiModelError extends AiModelError_base {
|
|
37
33
|
}
|
|
38
|
-
declare const
|
|
39
|
-
new (
|
|
40
|
-
#code: "ANTHROPIC_ERROR";
|
|
41
|
-
#context: Record<string, unknown>;
|
|
42
|
-
readonly name: "ANTHROPIC_ERROR";
|
|
43
|
-
readonly code: "ANTHROPIC_ERROR";
|
|
44
|
-
readonly _tag: "ANTHROPIC_ERROR";
|
|
45
|
-
readonly context: Record<string, unknown>;
|
|
46
|
-
message: string;
|
|
47
|
-
stack?: string;
|
|
34
|
+
declare const AiAssistantError_base: {
|
|
35
|
+
new (options?: import("@dxos/errors").BaseErrorOptions): {
|
|
48
36
|
cause?: unknown;
|
|
37
|
+
stack?: string;
|
|
38
|
+
name: "AiAssistantError";
|
|
39
|
+
context: Record<string, unknown>;
|
|
40
|
+
readonly message: string;
|
|
41
|
+
readonly _tag: "AiAssistantError";
|
|
49
42
|
};
|
|
50
|
-
|
|
43
|
+
isError(error: unknown): error is Error;
|
|
44
|
+
name: "AiAssistantError";
|
|
51
45
|
is(error: unknown): error is BaseError;
|
|
52
|
-
wrap(
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
readonly name: "ANTHROPIC_ERROR";
|
|
56
|
-
readonly code: "ANTHROPIC_ERROR";
|
|
57
|
-
readonly _tag: "ANTHROPIC_ERROR";
|
|
58
|
-
readonly context: Record<string, unknown>;
|
|
59
|
-
message: string;
|
|
60
|
-
stack?: string;
|
|
46
|
+
wrap(options?: Omit<import("@dxos/errors").BaseErrorOptions, 'cause'> & {
|
|
47
|
+
ifTypeDiffers?: boolean;
|
|
48
|
+
}): (error: unknown) => {
|
|
61
49
|
cause?: unknown;
|
|
50
|
+
stack?: string;
|
|
51
|
+
name: "AiAssistantError";
|
|
52
|
+
context: Record<string, unknown>;
|
|
53
|
+
readonly message: string;
|
|
54
|
+
readonly _tag: "AiAssistantError";
|
|
62
55
|
};
|
|
63
|
-
extend<
|
|
64
|
-
isError(error: unknown): error is Error;
|
|
56
|
+
extend<Name extends string = string>(name: Name, message?: string): any;
|
|
65
57
|
captureStackTrace(targetObject: object, constructorOpt?: Function): void;
|
|
66
58
|
prepareStackTrace?: ((err: Error, stackTraces: NodeJS.CallSite[]) => any) | undefined;
|
|
67
59
|
stackTraceLimit: number;
|
|
68
60
|
};
|
|
69
61
|
/**
|
|
70
|
-
*
|
|
62
|
+
* Generic error for AI agent execution.
|
|
71
63
|
*/
|
|
72
|
-
export declare class
|
|
64
|
+
export declare class AiAssistantError extends AiAssistantError_base {
|
|
73
65
|
}
|
|
74
66
|
export {};
|
|
75
67
|
//# sourceMappingURL=errors.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../../../src/errors.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC
|
|
1
|
+
{"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../../../src/errors.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEzC;;GAEG;AACH,qBAAa,YAAa,SAAQ,iBAAkD;CAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEvF;;GAEG;AACH,qBAAa,gBAAiB,SAAQ,qBAA0D;CAAG"}
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
import { type Entity } from '@dxos/echo';
|
|
2
|
+
import { LogLevel } from '@dxos/log';
|
|
3
|
+
import { ContentBlock } from '@dxos/types';
|
|
4
|
+
/**
|
|
5
|
+
* Mercurial-style Commit.
|
|
6
|
+
*/
|
|
7
|
+
export type Commit = {
|
|
8
|
+
id: string;
|
|
9
|
+
parents: string[];
|
|
10
|
+
branch: string;
|
|
11
|
+
icon?: string;
|
|
12
|
+
level?: LogLevel;
|
|
13
|
+
message: string;
|
|
14
|
+
timestamp?: Date;
|
|
15
|
+
tags?: string[];
|
|
16
|
+
};
|
|
17
|
+
/**
|
|
18
|
+
* Models the execution graph based on a stream of events.
|
|
19
|
+
*/
|
|
20
|
+
export declare class ExecutionGraph {
|
|
21
|
+
private readonly _skipBlocks;
|
|
22
|
+
private _commits;
|
|
23
|
+
private _branchNames;
|
|
24
|
+
private _lastBlockId;
|
|
25
|
+
private _toolCallCommitIds;
|
|
26
|
+
private _lastCommitByBranch;
|
|
27
|
+
private _pendingToolResults;
|
|
28
|
+
constructor(_skipBlocks?: ContentBlock.Any['_tag'][]);
|
|
29
|
+
/**
|
|
30
|
+
* Adds events to the graph.
|
|
31
|
+
*/
|
|
32
|
+
addEvents(events: Entity.Unknown[]): void;
|
|
33
|
+
/**
|
|
34
|
+
* Processes a message event and creates commits for its blocks.
|
|
35
|
+
*/
|
|
36
|
+
private _processMessage;
|
|
37
|
+
/**
|
|
38
|
+
* Processes an AgentStatus event.
|
|
39
|
+
*/
|
|
40
|
+
private _processAgentStatus;
|
|
41
|
+
/**
|
|
42
|
+
* Stable sort: objects with 'created' field are sorted by it, others remain in place.
|
|
43
|
+
*/
|
|
44
|
+
private sortObjectsByCreated;
|
|
45
|
+
/**
|
|
46
|
+
* Returns the current state of the graph.
|
|
47
|
+
*/
|
|
48
|
+
getGraph(lastRequest?: boolean): {
|
|
49
|
+
branches: string[];
|
|
50
|
+
commits: Commit[];
|
|
51
|
+
};
|
|
52
|
+
/**
|
|
53
|
+
* Tracks tool calls and handles pending tool result updates.
|
|
54
|
+
*/
|
|
55
|
+
private _trackToolCalls;
|
|
56
|
+
/**
|
|
57
|
+
* Updates pending tool results to point to an AgentStatus event.
|
|
58
|
+
*/
|
|
59
|
+
private _updatePendingToolResults;
|
|
60
|
+
/**
|
|
61
|
+
* Handles late updates when AgentStatus is processed before tool result.
|
|
62
|
+
*/
|
|
63
|
+
private _handleLateToolResultUpdate;
|
|
64
|
+
/**
|
|
65
|
+
* Gets the branch name for a tool call.
|
|
66
|
+
*/
|
|
67
|
+
private _getToolCallBranch;
|
|
68
|
+
/**
|
|
69
|
+
* Gets the parents for an AgentStatus commit.
|
|
70
|
+
*/
|
|
71
|
+
private _getAgentStatusParents;
|
|
72
|
+
/**
|
|
73
|
+
* Checks if a commit is a tool call commit.
|
|
74
|
+
*/
|
|
75
|
+
private _isToolCallCommit;
|
|
76
|
+
/**
|
|
77
|
+
* Checks if a commit is a tool result commit.
|
|
78
|
+
*/
|
|
79
|
+
private _isToolResultCommit;
|
|
80
|
+
/**
|
|
81
|
+
* Extracts tool call ID from a commit ID.
|
|
82
|
+
*/
|
|
83
|
+
private _extractToolCallId;
|
|
84
|
+
}
|
|
85
|
+
//# sourceMappingURL=execution-graph.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"execution-graph.d.ts","sourceRoot":"","sources":["../../../src/execution-graph.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,KAAK,MAAM,EAAiB,MAAM,YAAY,CAAC;AAGxD,OAAO,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;AACrC,OAAO,EAAE,YAAY,EAAW,MAAM,aAAa,CAAC;AAKpD;;GAEG;AAEH,MAAM,MAAM,MAAM,GAAG;IACnB,EAAE,EAAE,MAAM,CAAC;IACX,OAAO,EAAE,MAAM,EAAE,CAAC;IAClB,MAAM,EAAE,MAAM,CA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":3,"file":"execution-graph.test.d.ts","sourceRoot":"","sources":["../../../src/execution-graph.test.ts"],"names":[],"mappings":""}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/extraction/extraction-ner-function/index.ts"],"names":[],"mappings":"AAIA,cAAc,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/extraction/extraction-ner-function/index.ts"],"names":[],"mappings":"AAIA,cAAc,4BAA4B,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"named-entity-recognition.d.ts","sourceRoot":"","sources":["../../../../../src/extraction/extraction-ner-function/named-entity-recognition.ts"],"names":[],"mappings":"AAIA,OAAO,EAEL,KAAK,+BAA+B,EACpC,KAAK,yBAAyB,EAE/B,MAAM,sBAAsB,CAAC;AAM9B;;;;GAIG;AACH,eAAO,MAAM,MAAM,gDASlB,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,mBAAmB,
|
|
1
|
+
{"version":3,"file":"named-entity-recognition.d.ts","sourceRoot":"","sources":["../../../../../src/extraction/extraction-ner-function/named-entity-recognition.ts"],"names":[],"mappings":"AAIA,OAAO,EAEL,KAAK,+BAA+B,EACpC,KAAK,yBAAyB,EAE/B,MAAM,sBAAsB,CAAC;AAM9B;;;;GAIG;AACH,eAAO,MAAM,MAAM,gDASlB,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,mBAAmB,SAAgB,MAAM,KAAG,OAAO,CAAC,yBAAyB,EAAE,CAM3F,CAAC;AAEF,eAAO,MAAM,iBAAiB,WAAY,yBAAyB,EAAE,KAAG,yBAAyB,EAAE,EAmClG,CAAC;AAEF,eAAO,MAAM,gBAAgB,UAAW,yBAAyB,EAAE,KAAG,yBAmBrE,CAAC"}
|