@dxos/assistant 0.9.1-main.c7dcc2e112 → 0.10.0
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/neutral/extraction/index.mjs +1 -1
- package/dist/lib/neutral/extraction/index.mjs.map +1 -1
- package/dist/lib/neutral/index.mjs +387 -230
- package/dist/lib/neutral/index.mjs.map +4 -4
- package/dist/lib/neutral/meta.json +1 -1
- package/dist/types/src/extraction/extraction-llm-function/proper-noun-extraction.d.ts +1 -202
- package/dist/types/src/extraction/extraction-llm-function/proper-noun-extraction.d.ts.map +1 -1
- package/dist/types/src/index.d.ts +1 -1
- package/dist/types/src/index.d.ts.map +1 -1
- package/dist/types/src/request/AiRequest.d.ts +13 -208
- package/dist/types/src/request/AiRequest.d.ts.map +1 -1
- package/dist/types/src/request/format.d.ts +1 -1
- package/dist/types/src/request/format.d.ts.map +1 -1
- package/dist/types/src/session/AiContext.d.ts +27 -105
- package/dist/types/src/session/AiContext.d.ts.map +1 -1
- package/dist/types/src/session/AiSession.d.ts +5 -29
- package/dist/types/src/session/AiSession.d.ts.map +1 -1
- package/dist/types/src/session/Harness.d.ts +122 -0
- package/dist/types/src/session/Harness.d.ts.map +1 -0
- package/dist/types/src/session/SessionLink.d.ts +8 -11
- package/dist/types/src/session/SessionLink.d.ts.map +1 -1
- package/dist/types/src/session/SessionLoader.d.ts +2 -2
- package/dist/types/src/session/SessionLoader.d.ts.map +1 -1
- package/dist/types/src/session/SkillHooks.d.ts +28 -0
- package/dist/types/src/session/SkillHooks.d.ts.map +1 -0
- package/dist/types/src/session/harness-control.d.ts +177 -0
- package/dist/types/src/session/harness-control.d.ts.map +1 -0
- package/dist/types/src/session/index.d.ts +3 -0
- package/dist/types/src/session/index.d.ts.map +1 -1
- package/dist/types/src/session/toolkit.d.ts +4 -4
- package/dist/types/src/session/toolkit.d.ts.map +1 -1
- package/dist/types/src/templates/system.d.ts +4 -6
- package/dist/types/src/templates/system.d.ts.map +1 -1
- package/dist/types/src/tool-runtime/index.d.ts.map +1 -0
- package/dist/types/src/tool-runtime/services.d.ts.map +1 -0
- package/dist/types/src/util/artifact.d.ts.map +1 -1
- package/dist/types/src/util/diff.d.ts +9 -3
- package/dist/types/src/util/diff.d.ts.map +1 -1
- package/dist/types/src/util/tracing.d.ts +40 -0
- package/dist/types/src/util/tracing.d.ts.map +1 -1
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +28 -25
- package/src/extraction/extraction-llm-function/proper-noun-extraction.ts +1 -1
- package/src/index.ts +1 -1
- package/src/request/AiRequest.ts +35 -14
- package/src/request/format.ts +9 -11
- package/src/session/AiContext.test.ts +52 -32
- package/src/session/AiContext.ts +73 -95
- package/src/session/AiSession.test.ts +4 -4
- package/src/session/AiSession.ts +43 -83
- package/src/session/Harness.ts +241 -0
- package/src/session/SessionLink.ts +8 -8
- package/src/session/SessionLoader.ts +4 -4
- package/src/session/SkillHooks.ts +71 -0
- package/src/session/harness-control.ts +30 -0
- package/src/session/index.ts +3 -0
- package/src/session/toolkit.ts +8 -8
- package/src/templates/instructions/format.tpl +3 -3
- package/src/templates/instructions/system.tpl +10 -12
- package/src/templates/system.ts +6 -2
- package/src/util/artifact.ts +9 -2
- package/src/util/diff.test.ts +4 -4
- package/src/util/diff.ts +15 -8
- package/src/util/tracing.ts +1 -1
- package/dist/types/src/functions/index.d.ts.map +0 -1
- package/dist/types/src/functions/services.d.ts.map +0 -1
- /package/dist/types/src/{functions → tool-runtime}/index.d.ts +0 -0
- /package/dist/types/src/{functions → tool-runtime}/services.d.ts +0 -0
- /package/src/{functions → tool-runtime}/index.ts +0 -0
- /package/src/{functions → tool-runtime}/services.ts +0 -0
|
@@ -2,7 +2,7 @@ import type * as AiError from '@effect/ai/AiError';
|
|
|
2
2
|
import * as LanguageModel from '@effect/ai/LanguageModel';
|
|
3
3
|
import * as Effect from 'effect/Effect';
|
|
4
4
|
import { type AiToolNotFoundError, type OpaqueToolkit, type PromptPreprocessingError, type ToolExecutionService, type ToolResolverService } from '@dxos/ai';
|
|
5
|
-
import { type
|
|
5
|
+
import { Operation, type Skill, Trace } from '@dxos/compute';
|
|
6
6
|
import { Database, Obj, Registry } from '@dxos/echo';
|
|
7
7
|
import { ContentBlock, Message } from '@dxos/types';
|
|
8
8
|
import { type AiAssistantError } from '../util';
|
|
@@ -32,7 +32,7 @@ export type RunProps<R = never> = {
|
|
|
32
32
|
system?: string;
|
|
33
33
|
history?: Message.Message[];
|
|
34
34
|
objects?: Obj.Unknown[];
|
|
35
|
-
|
|
35
|
+
skills?: readonly Skill.Skill[];
|
|
36
36
|
toolkit?: OpaqueToolkit.OpaqueToolkit<R>;
|
|
37
37
|
};
|
|
38
38
|
export type BeginProps = {
|
|
@@ -40,7 +40,7 @@ export type BeginProps = {
|
|
|
40
40
|
system?: string;
|
|
41
41
|
history?: Message.Message[];
|
|
42
42
|
objects?: Obj.Unknown[];
|
|
43
|
-
|
|
43
|
+
skills?: readonly Skill.Skill[];
|
|
44
44
|
};
|
|
45
45
|
export type TurnProps<R = never> = {
|
|
46
46
|
system: string;
|
|
@@ -49,6 +49,12 @@ export type TurnProps<R = never> = {
|
|
|
49
49
|
export type TurnResult = {
|
|
50
50
|
messages: Message.Message[];
|
|
51
51
|
done: boolean;
|
|
52
|
+
/**
|
|
53
|
+
* Provider finish reason for this turn. `pause` means the provider paused a server-tool turn
|
|
54
|
+
* mid-execution (e.g. Anthropic `pause_turn`) and the turn must be resumed by issuing another
|
|
55
|
+
* request without mutating the trailing assistant content.
|
|
56
|
+
*/
|
|
57
|
+
finishReason?: ContentBlock.FinishReason;
|
|
52
58
|
};
|
|
53
59
|
/**
|
|
54
60
|
* Contains message history, tools, current context.
|
|
@@ -90,217 +96,16 @@ export declare class Request {
|
|
|
90
96
|
readonly operationName?: string | undefined;
|
|
91
97
|
readonly operationIcon?: string | undefined;
|
|
92
98
|
};
|
|
93
|
-
message:
|
|
94
|
-
readonly id: string;
|
|
95
|
-
readonly parentMessage?: string | undefined;
|
|
96
|
-
readonly threadId?: string | undefined;
|
|
97
|
-
readonly created: string;
|
|
98
|
-
readonly sender: {
|
|
99
|
-
readonly role?: "assistant" | "tool" | "user" | undefined;
|
|
100
|
-
readonly contact?: import("@dxos/echo/internal").Ref<{
|
|
101
|
-
readonly fullName?: string | undefined;
|
|
102
|
-
readonly preferredName?: string | undefined;
|
|
103
|
-
readonly nickname?: string | undefined;
|
|
104
|
-
readonly image?: string | undefined;
|
|
105
|
-
readonly organization?: import("@dxos/echo/internal").Ref<{
|
|
106
|
-
readonly name?: string | undefined;
|
|
107
|
-
readonly description?: string | undefined;
|
|
108
|
-
readonly status?: "active" | "commit" | "prospect" | "qualified" | "reject" | undefined;
|
|
109
|
-
readonly image?: string | undefined;
|
|
110
|
-
readonly website?: string | undefined;
|
|
111
|
-
} & {
|
|
112
|
-
readonly location?: readonly [number, number, (number | undefined)?] | undefined;
|
|
113
|
-
} & import("@dxos/echo/Entity").OfKind<import("@dxos/echo/internal").EntityKind.Object> & Obj.Unknown> | undefined;
|
|
114
|
-
readonly jobTitle?: string | undefined;
|
|
115
|
-
readonly department?: string | undefined;
|
|
116
|
-
readonly notes?: string | undefined;
|
|
117
|
-
readonly emails?: readonly {
|
|
118
|
-
readonly label?: string | undefined;
|
|
119
|
-
readonly value: string;
|
|
120
|
-
}[] | undefined;
|
|
121
|
-
readonly identities?: readonly {
|
|
122
|
-
readonly label?: string | undefined;
|
|
123
|
-
readonly value: string;
|
|
124
|
-
}[] | undefined;
|
|
125
|
-
readonly phoneNumbers?: readonly {
|
|
126
|
-
readonly label?: string | undefined;
|
|
127
|
-
readonly value: string;
|
|
128
|
-
}[] | undefined;
|
|
129
|
-
readonly addresses?: readonly {
|
|
130
|
-
readonly label?: string | undefined;
|
|
131
|
-
readonly value: {
|
|
132
|
-
readonly street?: string | undefined;
|
|
133
|
-
readonly extended?: string | undefined;
|
|
134
|
-
readonly locality?: string | undefined;
|
|
135
|
-
readonly region?: string | undefined;
|
|
136
|
-
readonly postalCode?: string | undefined;
|
|
137
|
-
readonly postOfficeBoxNumber?: string | undefined;
|
|
138
|
-
readonly country?: string | undefined;
|
|
139
|
-
};
|
|
140
|
-
}[] | undefined;
|
|
141
|
-
readonly urls?: readonly {
|
|
142
|
-
readonly label?: string | undefined;
|
|
143
|
-
readonly value: string;
|
|
144
|
-
}[] | undefined;
|
|
145
|
-
readonly birthday?: string | undefined;
|
|
146
|
-
readonly fields?: readonly {
|
|
147
|
-
readonly category?: string | undefined;
|
|
148
|
-
readonly label: string;
|
|
149
|
-
readonly value: string;
|
|
150
|
-
}[] | undefined;
|
|
151
|
-
} & {
|
|
152
|
-
readonly location?: readonly [number, number, (number | undefined)?] | undefined;
|
|
153
|
-
} & import("@dxos/echo/Entity").OfKind<import("@dxos/echo/internal").EntityKind.Object> & Obj.Unknown> | undefined;
|
|
154
|
-
readonly identityDid?: string | undefined;
|
|
155
|
-
readonly identityKey?: string | undefined;
|
|
156
|
-
readonly email?: string | undefined;
|
|
157
|
-
readonly name?: string | undefined;
|
|
158
|
-
};
|
|
159
|
-
readonly blocks: readonly ({
|
|
160
|
-
readonly _tag: "anchor";
|
|
161
|
-
readonly pending?: boolean | undefined;
|
|
162
|
-
readonly objectId: string;
|
|
163
|
-
readonly version: unknown;
|
|
164
|
-
} | {
|
|
165
|
-
readonly _tag: "file";
|
|
166
|
-
readonly pending?: boolean | undefined;
|
|
167
|
-
readonly url: string;
|
|
168
|
-
readonly name?: string | undefined;
|
|
169
|
-
readonly mediaType?: string | undefined;
|
|
170
|
-
} | {
|
|
171
|
-
readonly _tag: "image";
|
|
172
|
-
readonly pending?: boolean | undefined;
|
|
173
|
-
readonly id?: string | undefined;
|
|
174
|
-
readonly source?: {
|
|
175
|
-
readonly type: "base64";
|
|
176
|
-
readonly mediaType: string;
|
|
177
|
-
readonly data: string;
|
|
178
|
-
} | {
|
|
179
|
-
readonly type: "http";
|
|
180
|
-
readonly url: string;
|
|
181
|
-
} | undefined;
|
|
182
|
-
} | {
|
|
183
|
-
readonly _tag: "json";
|
|
184
|
-
readonly pending?: boolean | undefined;
|
|
185
|
-
readonly disposition?: "cot" | "synthetic" | "user" | "version-pin" | undefined;
|
|
186
|
-
readonly data: string;
|
|
187
|
-
} | {
|
|
188
|
-
readonly _tag: "proposal";
|
|
189
|
-
readonly pending?: boolean | undefined;
|
|
190
|
-
readonly text: string;
|
|
191
|
-
} | {
|
|
192
|
-
readonly _tag: "reasoning";
|
|
193
|
-
readonly pending?: boolean | undefined;
|
|
194
|
-
readonly reasoningText?: string | undefined;
|
|
195
|
-
readonly redactedText?: string | undefined;
|
|
196
|
-
readonly signature?: string | undefined;
|
|
197
|
-
} | {
|
|
198
|
-
readonly _tag: "reference";
|
|
199
|
-
readonly pending?: boolean | undefined;
|
|
200
|
-
readonly reference: import("@dxos/echo/internal").Ref<Obj.Unknown>;
|
|
201
|
-
} | {
|
|
202
|
-
readonly _tag: "select";
|
|
203
|
-
readonly pending?: boolean | undefined;
|
|
204
|
-
readonly options: string[];
|
|
205
|
-
} | {
|
|
206
|
-
readonly _tag: "status";
|
|
207
|
-
readonly pending?: boolean | undefined;
|
|
208
|
-
readonly statusText: string;
|
|
209
|
-
} | {
|
|
210
|
-
readonly _tag: "suggestion";
|
|
211
|
-
readonly pending?: boolean | undefined;
|
|
212
|
-
readonly text: string;
|
|
213
|
-
} | {
|
|
214
|
-
readonly _tag: "stats";
|
|
215
|
-
readonly pending?: boolean | undefined;
|
|
216
|
-
readonly mimeType?: string | undefined;
|
|
217
|
-
readonly message?: string | undefined;
|
|
218
|
-
readonly model?: string | undefined;
|
|
219
|
-
readonly usage?: {
|
|
220
|
-
readonly inputTokens?: number | undefined;
|
|
221
|
-
readonly outputTokens?: number | undefined;
|
|
222
|
-
readonly totalTokens?: number | undefined;
|
|
223
|
-
} | undefined;
|
|
224
|
-
readonly toolCalls?: number | undefined;
|
|
225
|
-
readonly errors?: number | undefined;
|
|
226
|
-
readonly duration?: number | undefined;
|
|
227
|
-
} | {
|
|
228
|
-
readonly _tag: "text";
|
|
229
|
-
readonly pending?: boolean | undefined;
|
|
230
|
-
readonly mimeType?: string | undefined;
|
|
231
|
-
readonly text: string;
|
|
232
|
-
readonly disposition?: "cot" | "synthetic" | "user" | "version-pin" | undefined;
|
|
233
|
-
} | {
|
|
234
|
-
readonly _tag: "summary";
|
|
235
|
-
readonly pending?: boolean | undefined;
|
|
236
|
-
readonly content: string;
|
|
237
|
-
} | {
|
|
238
|
-
readonly _tag: "toolkit";
|
|
239
|
-
readonly pending?: boolean | undefined;
|
|
240
|
-
} | {
|
|
241
|
-
readonly _tag: "toolCall";
|
|
242
|
-
readonly pending?: boolean | undefined;
|
|
243
|
-
readonly toolCallId: string;
|
|
244
|
-
readonly name: string;
|
|
245
|
-
readonly input: string;
|
|
246
|
-
readonly providerExecuted: boolean;
|
|
247
|
-
readonly operationKey?: string | undefined;
|
|
248
|
-
readonly operationName?: string | undefined;
|
|
249
|
-
readonly operationIcon?: string | undefined;
|
|
250
|
-
} | {
|
|
251
|
-
readonly _tag: "toolResult";
|
|
252
|
-
readonly pending?: boolean | undefined;
|
|
253
|
-
readonly toolCallId: string;
|
|
254
|
-
readonly name: string;
|
|
255
|
-
readonly result?: string | {
|
|
256
|
-
readonly _tag: "~@dxos/types/ContentBlock.ContentBlockResult";
|
|
257
|
-
readonly content: readonly ({
|
|
258
|
-
readonly _tag: "file";
|
|
259
|
-
readonly pending?: boolean | undefined;
|
|
260
|
-
readonly url: string;
|
|
261
|
-
readonly name?: string | undefined;
|
|
262
|
-
readonly mediaType?: string | undefined;
|
|
263
|
-
} | {
|
|
264
|
-
readonly _tag: "image";
|
|
265
|
-
readonly pending?: boolean | undefined;
|
|
266
|
-
readonly id?: string | undefined;
|
|
267
|
-
readonly source?: {
|
|
268
|
-
readonly type: "base64";
|
|
269
|
-
readonly mediaType: string;
|
|
270
|
-
readonly data: string;
|
|
271
|
-
} | {
|
|
272
|
-
readonly type: "http";
|
|
273
|
-
readonly url: string;
|
|
274
|
-
} | undefined;
|
|
275
|
-
} | {
|
|
276
|
-
readonly _tag: "text";
|
|
277
|
-
readonly pending?: boolean | undefined;
|
|
278
|
-
readonly mimeType?: string | undefined;
|
|
279
|
-
readonly text: string;
|
|
280
|
-
readonly disposition?: "cot" | "synthetic" | "user" | "version-pin" | undefined;
|
|
281
|
-
})[];
|
|
282
|
-
} | undefined;
|
|
283
|
-
readonly error?: string | undefined;
|
|
284
|
-
readonly providerExecuted: boolean;
|
|
285
|
-
} | {
|
|
286
|
-
readonly _tag: "transcript";
|
|
287
|
-
readonly pending?: boolean | undefined;
|
|
288
|
-
readonly started: string;
|
|
289
|
-
readonly text: string;
|
|
290
|
-
})[];
|
|
291
|
-
readonly properties?: {
|
|
292
|
-
readonly [x: string]: any;
|
|
293
|
-
} | undefined;
|
|
294
|
-
} & import("@dxos/echo/Entity").OfKind<import("@dxos/echo/internal").EntityKind.Object>;
|
|
99
|
+
message: Message.Message;
|
|
295
100
|
}[];
|
|
296
101
|
/**
|
|
297
102
|
* Initialize a session: set up history, perform summarization if needed, and submit the user prompt.
|
|
298
103
|
* Must be called before `runTurn()`.
|
|
299
104
|
*/
|
|
300
|
-
begin: ({ prompt, system, history,
|
|
105
|
+
begin: ({ prompt, system, history, skills, objects, }: BeginProps) => Effect.Effect<void, RunError, RunRequirements>;
|
|
301
106
|
/**
|
|
302
107
|
* Execute a single turn: one LLM generation followed by tool execution.
|
|
303
|
-
* The toolkit and system prompt can be updated between turns to reflect context changes (e.g. dynamically enabled
|
|
108
|
+
* The toolkit and system prompt can be updated between turns to reflect context changes (e.g. dynamically enabled skills).
|
|
304
109
|
*/
|
|
305
110
|
runAgentTurn: <const R = never>({ system, toolkit: opaqueToolkit, }: TurnProps<R>) => Effect.Effect<TurnResult, RunError, RunRequirements | R>;
|
|
306
111
|
runTools: <const R = never>({ toolkit: opaqueToolkit, }: {
|
|
@@ -309,6 +114,6 @@ export declare class Request {
|
|
|
309
114
|
/**
|
|
310
115
|
* Run a full conversation turn loop. Equivalent to calling `begin()` then `runTurn()` in a loop.
|
|
311
116
|
*/
|
|
312
|
-
run: <const R = never>({ prompt, system: systemTemplate, history, objects,
|
|
117
|
+
run: <const R = never>({ prompt, system: systemTemplate, history, objects, skills, toolkit, }: RunProps<R>) => Effect.Effect<Message.Message[], RunError, RunRequirements | R>;
|
|
313
118
|
}
|
|
314
119
|
//# sourceMappingURL=AiRequest.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AiRequest.d.ts","sourceRoot":"","sources":["../../../../src/request/AiRequest.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,KAAK,OAAO,MAAM,oBAAoB,CAAC;AACnD,OAAO,KAAK,aAAa,MAAM,0BAA0B,CAAC;AAI1D,OAAO,KAAK,MAAM,MAAM,eAAe,CAAC;AAKxC,OAAO,EAIL,KAAK,mBAAmB,
|
|
1
|
+
{"version":3,"file":"AiRequest.d.ts","sourceRoot":"","sources":["../../../../src/request/AiRequest.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,KAAK,OAAO,MAAM,oBAAoB,CAAC;AACnD,OAAO,KAAK,aAAa,MAAM,0BAA0B,CAAC;AAI1D,OAAO,KAAK,MAAM,MAAM,eAAe,CAAC;AAKxC,OAAO,EAIL,KAAK,mBAAmB,EACxB,KAAK,aAAa,EAClB,KAAK,wBAAwB,EAC7B,KAAK,oBAAoB,EACzB,KAAK,mBAAmB,EAGzB,MAAM,UAAU,CAAC;AAClB,OAAO,EAAE,SAAS,EAAE,KAAK,KAAK,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AAC7D,OAAO,EAAE,QAAQ,EAAE,GAAG,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAErD,OAAO,EAAE,YAAY,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AAGpD,OAAO,EAAE,KAAK,gBAAgB,EAA+B,MAAM,SAAS,CAAC;AAE7E,OAAO,EAAE,kBAAkB,EAAE,MAA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E9C;;;OAGG;IACH,YAAY,GAAI,KAAK,CAAC,CAAC,GAAG,KAAK,uCAG5B,SAAS,CAAC,CAAC,CAAC,KAAG,MAAM,CAAC,MAAM,CAAC,UAAU,EAAE,QAAQ,EAAE,eAAe,GAAG,CAAC,CAAC,CAuFrB;IAErD,QAAQ,GAAI,KAAK,CAAC,CAAC,GAAG,KAAK,+BAExB;QACD,OAAO,CAAC,EAAE,aAAa,CAAC,aAAa,CAAC,CAAC,CAAC,CAAC;KAC1C,KAAG,MAAM,CAAC,MAAM,CAAC,IAAI,EAAE,QAAQ,EAAE,eAAe,GAAG,CAAC,CAAC,CAoBL;IAEjD;;OAEG;IACH,GAAG,GAAI,KAAK,CAAC,CAAC,GAAG,KAAK,0EAOnB,QAAQ,CAAC,CAAC,CAAC,KAAG,MAAM,CAAC,MAAM,CAAC,OAAO,CAAC,OAAO,EAAE,EAAE,QAAQ,EAAE,eAAe,GAAG,CAAC,CAAC,CAoBJ;CAC7E"}
|
|
@@ -7,7 +7,7 @@ import type * as AiRequest from './AiRequest';
|
|
|
7
7
|
/**
|
|
8
8
|
* Formats the system prompt.
|
|
9
9
|
*/
|
|
10
|
-
export declare const formatSystemPrompt: ({ system,
|
|
10
|
+
export declare const formatSystemPrompt: ({ system, skills, objects, }: Pick<AiRequest.RunProps, 'system' | 'skills' | 'objects'>) => Effect.Effect<string, FunctionNotFoundError | EntityNotFoundError, Database.Service | Registry.Service | Operation.Service>;
|
|
11
11
|
/**
|
|
12
12
|
* Formats the user prompt.
|
|
13
13
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"format.d.ts","sourceRoot":"","sources":["../../../../src/request/format.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,MAAM,MAAM,eAAe,CAAC;AAIxC,OAAO,EAAE,KAAK,qBAAqB,EAAE,KAAK,SAAS,EAAY,MAAM,eAAe,CAAC;AACrF,OAAO,EAAE,KAAK,QAAQ,EAAO,KAAK,QAAQ,EAAE,MAAM,YAAY,CAAC;AAE/D,OAAO,EAAE,KAAK,mBAAmB,EAAE,MAAM,gBAAgB,CAAC;AAG1D,OAAO,EAAqB,OAAO,EAAE,MAAM,aAAa,CAAC;AAIzD,OAAO,KAAK,KAAK,SAAS,MAAM,aAAa,CAAC;AAG9C;;GAEG;AAEH,eAAO,MAAM,kBAAkB,
|
|
1
|
+
{"version":3,"file":"format.d.ts","sourceRoot":"","sources":["../../../../src/request/format.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,MAAM,MAAM,eAAe,CAAC;AAIxC,OAAO,EAAE,KAAK,qBAAqB,EAAE,KAAK,SAAS,EAAY,MAAM,eAAe,CAAC;AACrF,OAAO,EAAE,KAAK,QAAQ,EAAO,KAAK,QAAQ,EAAE,MAAM,YAAY,CAAC;AAE/D,OAAO,EAAE,KAAK,mBAAmB,EAAE,MAAM,gBAAgB,CAAC;AAG1D,OAAO,EAAqB,OAAO,EAAE,MAAM,aAAa,CAAC;AAIzD,OAAO,KAAK,KAAK,SAAS,MAAM,aAAa,CAAC;AAG9C;;GAEG;AAEH,eAAO,MAAM,kBAAkB,iCAI5B,IAAI,CAAC,SAAS,CAAC,QAAQ,EAAE,QAAQ,GAAG,QAAQ,GAAG,SAAS,CAAC,KAAG,MAAM,CAAC,MAAM,CAC1E,MAAM,EACN,qBAAqB,GAAG,mBAAmB,EAC3C,QAAQ,CAAC,OAAO,GAAG,QAAQ,CAAC,OAAO,GAAG,SAAS,CAAC,OAAO,CAqCT,CAAC;AAEjD;;GAEG;AAGH,eAAO,MAAM,gBAAgB,yBAG1B,IAAI,CAAC,SAAS,CAAC,QAAQ,EAAE,QAAQ,GAAG,SAAS,CAAC,KAAG,MAAM,CAAC,MAAM,CAAC,OAAO,CAAC,OAAO,EAAE,SAAS,CAAC,QAAQ,CAoCvD,CAAC"}
|
|
@@ -1,145 +1,74 @@
|
|
|
1
1
|
import { Atom, Registry as AtomRegistry } from '@effect-atom/atom-react';
|
|
2
|
-
import * as Context from 'effect/Context';
|
|
3
|
-
import * as Effect from 'effect/Effect';
|
|
4
2
|
import * as Runtime from 'effect/Runtime';
|
|
5
|
-
import
|
|
6
|
-
import { Blueprint } from '@dxos/compute';
|
|
3
|
+
import { Skill } from '@dxos/compute';
|
|
7
4
|
import { Resource } from '@dxos/context';
|
|
8
|
-
import { Feed, Obj, Ref, Type } from '@dxos/echo';
|
|
5
|
+
import { Database, Feed, Obj, Ref, Type } from '@dxos/echo';
|
|
9
6
|
import { type URI } from '@dxos/keys';
|
|
10
7
|
import { ComplexSet } from '@dxos/util';
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
readonly blueprints: {
|
|
16
|
-
readonly added: readonly import("@dxos/echo/internal").Ref<{
|
|
17
|
-
readonly name: string;
|
|
18
|
-
readonly description?: string | undefined;
|
|
19
|
-
readonly instructions: {
|
|
20
|
-
readonly source: import("@dxos/echo/internal").Ref<{
|
|
21
|
-
readonly name?: string | undefined;
|
|
22
|
-
readonly content: string;
|
|
23
|
-
} & import("@dxos/echo/Entity").OfKind<import("@dxos/echo/internal").EntityKind.Object> & Obj.Unknown>;
|
|
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
|
-
} & import("@dxos/echo/Entity").OfKind<import("@dxos/echo/internal").EntityKind.Object> & Obj.Unknown>[];
|
|
40
|
-
readonly removed: readonly import("@dxos/echo/internal").Ref<{
|
|
41
|
-
readonly name: string;
|
|
42
|
-
readonly description?: string | undefined;
|
|
43
|
-
readonly instructions: {
|
|
44
|
-
readonly source: import("@dxos/echo/internal").Ref<{
|
|
45
|
-
readonly name?: string | undefined;
|
|
46
|
-
readonly content: string;
|
|
47
|
-
} & import("@dxos/echo/Entity").OfKind<import("@dxos/echo/internal").EntityKind.Object> & Obj.Unknown>;
|
|
48
|
-
readonly inputs?: readonly {
|
|
49
|
-
readonly name: string;
|
|
50
|
-
readonly kind: "operation" | "value";
|
|
51
|
-
readonly default?: any;
|
|
52
|
-
readonly operation?: string | undefined;
|
|
53
|
-
}[] | undefined;
|
|
54
|
-
};
|
|
55
|
-
readonly tools: readonly (string & import("effect/Brand").Brand<"ToolId">)[];
|
|
56
|
-
readonly agentCanEnable?: boolean | undefined;
|
|
57
|
-
readonly mcpServers?: readonly {
|
|
58
|
-
readonly name?: string | undefined;
|
|
59
|
-
readonly url: string;
|
|
60
|
-
readonly protocol: "http" | "sse";
|
|
61
|
-
readonly apiKey?: string | undefined;
|
|
62
|
-
}[] | undefined;
|
|
63
|
-
} & import("@dxos/echo/Entity").OfKind<import("@dxos/echo/internal").EntityKind.Object> & Obj.Unknown>[];
|
|
8
|
+
declare const Binding_base: Type.ObjClass<Binding, {
|
|
9
|
+
readonly skills: {
|
|
10
|
+
readonly added: readonly import("@dxos/echo/internal").Ref<Skill.Skill & import("@dxos/echo/Entity").OfKind<import("@dxos/echo/internal").EntityKind.Object> & Obj.Unknown>[];
|
|
11
|
+
readonly removed: readonly import("@dxos/echo/internal").Ref<Skill.Skill & import("@dxos/echo/Entity").OfKind<import("@dxos/echo/internal").EntityKind.Object> & Obj.Unknown>[];
|
|
64
12
|
};
|
|
65
13
|
readonly objects: {
|
|
66
14
|
readonly added: readonly import("@dxos/echo/internal").Ref<Obj.Unknown>[];
|
|
67
15
|
readonly removed: readonly import("@dxos/echo/internal").Ref<Obj.Unknown>[];
|
|
68
16
|
};
|
|
69
|
-
},
|
|
70
|
-
|
|
17
|
+
}, {}>;
|
|
18
|
+
/**
|
|
19
|
+
* Thread message that binds or unbinds contextual objects to a conversation.
|
|
20
|
+
*/
|
|
21
|
+
export declare class Binding extends Binding_base {
|
|
22
|
+
}
|
|
71
23
|
export type BindingProps = Partial<{
|
|
72
|
-
|
|
24
|
+
skills: Ref.Ref<Skill.Skill>[];
|
|
73
25
|
objects: Ref.Ref<Obj.Unknown>[];
|
|
74
26
|
}>;
|
|
75
27
|
export declare class Bindings {
|
|
76
|
-
readonly
|
|
77
|
-
readonly name: string;
|
|
78
|
-
readonly description?: string | undefined;
|
|
79
|
-
readonly instructions: {
|
|
80
|
-
readonly source: import("@dxos/echo/internal").Ref<{
|
|
81
|
-
readonly name?: string | undefined;
|
|
82
|
-
readonly content: string;
|
|
83
|
-
} & import("@dxos/echo/Entity").OfKind<import("@dxos/echo/internal").EntityKind.Object> & Obj.Unknown>;
|
|
84
|
-
readonly inputs?: readonly {
|
|
85
|
-
readonly name: string;
|
|
86
|
-
readonly kind: "operation" | "value";
|
|
87
|
-
readonly default?: any;
|
|
88
|
-
readonly operation?: string | undefined;
|
|
89
|
-
}[] | undefined;
|
|
90
|
-
};
|
|
91
|
-
readonly tools: readonly (string & import("effect/Brand").Brand<"ToolId">)[];
|
|
92
|
-
readonly agentCanEnable?: boolean | undefined;
|
|
93
|
-
readonly mcpServers?: readonly {
|
|
94
|
-
readonly name?: string | undefined;
|
|
95
|
-
readonly url: string;
|
|
96
|
-
readonly protocol: "http" | "sse";
|
|
97
|
-
readonly apiKey?: string | undefined;
|
|
98
|
-
}[] | undefined;
|
|
99
|
-
} & import("@dxos/echo/Entity").OfKind<import("@dxos/echo/internal").EntityKind.Object>>>;
|
|
28
|
+
readonly skills: ComplexSet<Ref.Ref<Skill.Skill>>;
|
|
100
29
|
readonly objects: ComplexSet<Ref.Ref<Obj.Unknown>>;
|
|
101
30
|
toJSON(): {
|
|
102
|
-
|
|
31
|
+
skills: URI.URI[];
|
|
103
32
|
objects: URI.URI[];
|
|
104
33
|
};
|
|
105
34
|
}
|
|
106
35
|
export type BinderOptions = {
|
|
107
36
|
feed: Feed.Feed;
|
|
108
|
-
runtime: Runtime.Runtime<
|
|
37
|
+
runtime: Runtime.Runtime<Database.Service>;
|
|
109
38
|
/** @effect-atom/atom-react Registry for reactive state management. */
|
|
110
39
|
registry?: AtomRegistry.Registry;
|
|
111
40
|
};
|
|
112
41
|
/**
|
|
113
|
-
* Manages bindings of
|
|
42
|
+
* Manages bindings of skills and objects to a conversation.
|
|
114
43
|
*/
|
|
115
44
|
export declare class Binder extends Resource {
|
|
116
45
|
#private;
|
|
117
|
-
private readonly
|
|
46
|
+
private readonly _skills;
|
|
118
47
|
private readonly _objects;
|
|
119
48
|
private readonly _registry;
|
|
120
49
|
private readonly _feed;
|
|
121
50
|
private readonly _runtime;
|
|
122
51
|
constructor(options: BinderOptions);
|
|
123
52
|
/**
|
|
124
|
-
* Returns the
|
|
53
|
+
* Returns the skills atom for subscription.
|
|
125
54
|
*/
|
|
126
|
-
get
|
|
55
|
+
get skills(): Atom.Atom<Skill.Skill[]>;
|
|
127
56
|
/**
|
|
128
57
|
* Returns the objects atom for subscription.
|
|
129
58
|
*/
|
|
130
59
|
get objects(): Atom.Atom<Obj.Unknown[]>;
|
|
131
60
|
/**
|
|
132
|
-
* Gets the current
|
|
61
|
+
* Gets the current skills value.
|
|
133
62
|
*/
|
|
134
|
-
|
|
63
|
+
getSkills(): Skill.Skill[];
|
|
135
64
|
/**
|
|
136
65
|
* Gets the current objects value.
|
|
137
66
|
*/
|
|
138
67
|
getObjects(): Obj.Unknown[];
|
|
139
68
|
/**
|
|
140
|
-
* Subscribe to changes in
|
|
69
|
+
* Subscribe to changes in skills.
|
|
141
70
|
*/
|
|
142
|
-
|
|
71
|
+
subscribeSkills(cb: (skills: Skill.Skill[]) => void): () => void;
|
|
143
72
|
/**
|
|
144
73
|
* Subscribe to changes in objects.
|
|
145
74
|
*/
|
|
@@ -151,14 +80,14 @@ export declare class Binder extends Resource {
|
|
|
151
80
|
sync(): Promise<void>;
|
|
152
81
|
private _updateBindings;
|
|
153
82
|
protected _close(): Promise<void>;
|
|
154
|
-
bind({
|
|
155
|
-
unbind({
|
|
83
|
+
bind({ skills, objects }: BindingProps): Promise<void>;
|
|
84
|
+
unbind({ skills, objects }: BindingProps): Promise<void>;
|
|
156
85
|
/**
|
|
157
86
|
* Process bindings to filter duplicates and determine next state.
|
|
158
87
|
*/
|
|
159
88
|
private _processBindings;
|
|
160
89
|
/**
|
|
161
|
-
* Reduce results into sets of
|
|
90
|
+
* Reduce results into sets of skills and objects.
|
|
162
91
|
*/
|
|
163
92
|
private _reduce;
|
|
164
93
|
/**
|
|
@@ -167,12 +96,5 @@ export declare class Binder extends Resource {
|
|
|
167
96
|
private _mergeInto;
|
|
168
97
|
private _resolve;
|
|
169
98
|
}
|
|
170
|
-
declare const Service_base: Context.TagClass<Service, "@dxos/assistant/AiContextService", {
|
|
171
|
-
binder: Binder;
|
|
172
|
-
}>;
|
|
173
|
-
export declare class Service extends Service_base {
|
|
174
|
-
static bindContext: ({ blueprints, objects }: BindingProps) => Effect.Effect<void, never, Service>;
|
|
175
|
-
static findObjects: <T extends Type.AnyObj>(type: T) => Effect.Effect<Type.InstanceType<T>[], never, Service>;
|
|
176
|
-
}
|
|
177
99
|
export {};
|
|
178
100
|
//# sourceMappingURL=AiContext.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AiContext.d.ts","sourceRoot":"","sources":["../../../../src/session/AiContext.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,IAAI,EAAE,QAAQ,IAAI,YAAY,EAAE,MAAM,yBAAyB,CAAC;
|
|
1
|
+
{"version":3,"file":"AiContext.d.ts","sourceRoot":"","sources":["../../../../src/session/AiContext.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,IAAI,EAAE,QAAQ,IAAI,YAAY,EAAE,MAAM,yBAAyB,CAAC;AAG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
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { type Registry as AtomRegistry } from '@effect-atom/atom-react';
|
|
2
|
-
import * as Context from 'effect/Context';
|
|
3
2
|
import * as Effect from 'effect/Effect';
|
|
4
3
|
import * as Layer from 'effect/Layer';
|
|
5
4
|
import * as Runtime from 'effect/Runtime';
|
|
@@ -7,7 +6,7 @@ import { type OpaqueToolkit, type ToolExecutionService, type ToolResolverService
|
|
|
7
6
|
import { McpServer, Operation } from '@dxos/compute';
|
|
8
7
|
import { Resource } from '@dxos/context';
|
|
9
8
|
import { Database, Feed, Registry } from '@dxos/echo';
|
|
10
|
-
import {
|
|
9
|
+
import { type ContentBlock, Message } from '@dxos/types';
|
|
11
10
|
import { AiRequest, type GenerationObserver } from '../request';
|
|
12
11
|
import * as AiContext from './AiContext';
|
|
13
12
|
export type RunProps<R = never> = {
|
|
@@ -16,7 +15,7 @@ export type RunProps<R = never> = {
|
|
|
16
15
|
observer?: GenerationObserver;
|
|
17
16
|
toolkit?: OpaqueToolkit.OpaqueToolkit<R>;
|
|
18
17
|
/**
|
|
19
|
-
* Space-level MCP servers to connect alongside
|
|
18
|
+
* Space-level MCP servers to connect alongside skill-defined ones.
|
|
20
19
|
*/
|
|
21
20
|
mcpServers?: readonly McpServer.McpServer[];
|
|
22
21
|
/**
|
|
@@ -28,7 +27,7 @@ export type RunProps<R = never> = {
|
|
|
28
27
|
};
|
|
29
28
|
export type Options = {
|
|
30
29
|
feed: Feed.Feed;
|
|
31
|
-
runtime: Runtime.Runtime<
|
|
30
|
+
runtime: Runtime.Runtime<Database.Service>;
|
|
32
31
|
/** @effect-atom/atom-react Registry for reactive state. */
|
|
33
32
|
registry?: AtomRegistry.Registry;
|
|
34
33
|
};
|
|
@@ -38,7 +37,7 @@ export type Options = {
|
|
|
38
37
|
*/
|
|
39
38
|
export declare class Session extends Resource {
|
|
40
39
|
/**
|
|
41
|
-
*
|
|
40
|
+
* Skills and objects bound to the session.
|
|
42
41
|
*/
|
|
43
42
|
private readonly _binder;
|
|
44
43
|
private readonly _feed;
|
|
@@ -46,11 +45,7 @@ export declare class Session extends Resource {
|
|
|
46
45
|
private readonly _sessionLoader;
|
|
47
46
|
constructor(options: Options);
|
|
48
47
|
protected _open(): Promise<void>;
|
|
49
|
-
get feed():
|
|
50
|
-
readonly name?: string | undefined;
|
|
51
|
-
readonly kind?: string | undefined;
|
|
52
|
-
readonly namespace?: "data" | "trace" | undefined;
|
|
53
|
-
} & import("@dxos/echo/Entity").OfKind<import("@dxos/echo/internal").EntityKind.Object>;
|
|
48
|
+
get feed(): Feed.Feed;
|
|
54
49
|
get context(): AiContext.Binder;
|
|
55
50
|
getHistory(): Promise<Message.Message[]>;
|
|
56
51
|
getTools(): Effect.Effect<Record<string, import('@effect/ai/Tool').Any>, never, ToolExecutionService | ToolResolverService>;
|
|
@@ -63,23 +58,4 @@ export declare class Session extends Resource {
|
|
|
63
58
|
*/
|
|
64
59
|
createRequest<R = never>(params: RunProps<R>): Effect.Effect<Message.Message[], AiRequest.RunError, AiRequest.RunRequirements | R>;
|
|
65
60
|
}
|
|
66
|
-
declare const Service_base: Context.TagClass<Service, "@dxos/assistant/AiSessionService", Session>;
|
|
67
|
-
/**
|
|
68
|
-
* Gives access to the ai session.
|
|
69
|
-
*/
|
|
70
|
-
export declare class Service extends Service_base {
|
|
71
|
-
/**
|
|
72
|
-
* Create a new session layer from options.
|
|
73
|
-
*/
|
|
74
|
-
static layer: (options: Options) => Layer.Layer<Service | AiContext.Service>;
|
|
75
|
-
/**
|
|
76
|
-
* Create a new session with a new feed.
|
|
77
|
-
*/
|
|
78
|
-
static layerNewFeed: (options?: Omit<Options, 'feed' | 'runtime'>) => Layer.Layer<Service | AiContext.Service, never, Database.Service | Feed.FeedService>;
|
|
79
|
-
/**
|
|
80
|
-
* Run a prompt in the current session.
|
|
81
|
-
*/
|
|
82
|
-
static run: <R = never>(params: RunProps<R>) => Effect.Effect<Message.Message[], AiRequest.RunError, AiRequest.RunRequirements | Service | R>;
|
|
83
|
-
}
|
|
84
|
-
export {};
|
|
85
61
|
//# sourceMappingURL=AiSession.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AiSession.d.ts","sourceRoot":"","sources":["../../../../src/session/AiSession.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,KAAK,QAAQ,IAAI,YAAY,EAAE,MAAM,yBAAyB,CAAC;AAExE,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"AiSession.d.ts","sourceRoot":"","sources":["../../../../src/session/AiSession.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,KAAK,QAAQ,IAAI,YAAY,EAAE,MAAM,yBAAyB,CAAC;AAExE,OAAO,KAAK,MAAM,MAAM,eAAe,CAAC;AAGxC,OAAO,KAAK,KAAK,MAAM,cAAc,CAAC;AAEtC,OAAO,KAAK,OAAO,MAAM,gBAAgB,CAAC;AAE1C,OAAO,EAAE,KAAK,aAAa,EAAE,KAAK,oBAAoB,EAAE,KAAK,mBAAmB,EAAE,MAAM,UAAU,CAAC;AACnG,OAAO,EAAE,SAAS,EAAE,SAAS,EAAqB,MAAM,eAAe,CAAC;AACxE,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AACzC,OAAO,EAAE,QAAQ,EAAE,IAAI,EAAe,QAAQ,EAAE,MAAM,YAAY,CAAC;AAInE,OAAO,EAAE,KAAK,YAAY,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AAEzD,OAAO,EAAE,SAAS,EAAE,KAAK,kBAAkB,EAAsB,MAAM,YAAY,CAAC;AAGpF,OAAO,KAAK,SAAS,MAAM,aAAa,CAAC;AAMzC,MAAM,MAAM,QAAQ,CAAC,CAAC,GAAG,KAAK,IAAI;IAChC,MAAM,EAAE,MAAM,GAAG,YAAY,CAAC,GAAG,EAAE,CAAC;IACpC,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,QAAQ,CAAC,EAAE,kBAAkB,CAAC;IAC9B,OAAO,CA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