@dxos/agent-runtime 0.0.0 → 0.11.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/chunk-AgentService.mjs +789 -0
- package/dist/lib/chunk-AgentService.mjs.map +1 -0
- package/dist/lib/index.mjs +2 -0
- package/dist/lib/testing.mjs +294 -0
- package/dist/lib/testing.mjs.map +1 -0
- package/dist/types/src/agent-service/AgentService.d.ts +4 -4
- package/dist/types/src/agent-service/AgentService.d.ts.map +1 -1
- package/dist/types/src/agent-service/agent-process.d.ts +173 -5
- package/dist/types/src/agent-service/agent-process.d.ts.map +1 -1
- package/dist/types/src/agent-service/delegation-scripted.test.d.ts +2 -0
- package/dist/types/src/agent-service/delegation-scripted.test.d.ts.map +1 -0
- package/dist/types/src/assistant-session-tests/scripted-loop.test.d.ts +2 -0
- package/dist/types/src/assistant-session-tests/scripted-loop.test.d.ts.map +1 -0
- package/dist/types/src/index.d.ts.map +1 -1
- package/dist/types/src/testing/assistant-test-layer.d.ts +6 -2
- package/dist/types/src/testing/assistant-test-layer.d.ts.map +1 -1
- package/dist/types/src/testing/index.d.ts +2 -0
- package/dist/types/src/testing/index.d.ts.map +1 -1
- package/dist/types/src/testing/test-agent.d.ts +70 -0
- package/dist/types/src/testing/test-agent.d.ts.map +1 -0
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +17 -16
- package/src/agent-service/AgentService.conversations.json +1 -1
- package/src/agent-service/AgentService.test.ts +115 -58
- package/src/agent-service/AgentService.ts +44 -15
- package/src/agent-service/README.md +4 -4
- package/src/agent-service/agent-process.ts +31 -12
- package/src/agent-service/delegation-scripted.test.ts +123 -0
- package/src/assistant-session-tests/request.conversations.json +1 -1
- package/src/assistant-session-tests/request.test.ts +2 -2
- package/src/assistant-session-tests/scripted-loop.test.ts +119 -0
- package/src/assistant-session-tests/xml-response.conversations.json +1 -1
- package/src/assistant-session-tests/xml-response.test.ts +2 -2
- package/src/functions.conversations.json +1 -1
- package/src/functions.test.ts +2 -2
- package/src/index.ts +0 -2
- package/src/testing/assistant-test-layer.ts +32 -1
- package/src/testing/index.ts +3 -0
- package/src/testing/test-agent.ts +104 -0
- package/dist/lib/neutral/chunk-EZKG2ZGG.mjs +0 -754
- package/dist/lib/neutral/chunk-EZKG2ZGG.mjs.map +0 -7
- package/dist/lib/neutral/index.mjs +0 -9
- package/dist/lib/neutral/index.mjs.map +0 -7
- package/dist/lib/neutral/meta.json +0 -1
- package/dist/lib/neutral/testing/index.mjs +0 -285
- package/dist/lib/neutral/testing/index.mjs.map +0 -7
|
@@ -10,18 +10,18 @@ import { DXN } from '@dxos/keys';
|
|
|
10
10
|
import { type DelegationStrategy } from './delegation-strategy';
|
|
11
11
|
interface AgentProcessOptions {
|
|
12
12
|
systemPrompt?: string;
|
|
13
|
+
/** Model identifier. */
|
|
13
14
|
model?: DXN.DXN;
|
|
14
|
-
provider?: DXN.DXN;
|
|
15
15
|
/**
|
|
16
|
-
*
|
|
16
|
+
* The catalog's shared model ids are served by several providers, so resolution needs the provider
|
|
17
|
+
* alongside the id; without it a local model id cannot be claimed by any resolver.
|
|
17
18
|
*/
|
|
18
|
-
|
|
19
|
+
provider?: DXN.DXN;
|
|
19
20
|
/**
|
|
20
21
|
* If true, long-running tool calls are moved to the background after `backgroundThreshold`
|
|
21
22
|
* and the agent is notified asynchronously when they complete.
|
|
22
23
|
*
|
|
23
24
|
* Currently unstable — disabled by default.
|
|
24
|
-
*
|
|
25
25
|
* @default false
|
|
26
26
|
*/
|
|
27
27
|
enableToolBackgrounding?: boolean;
|
|
@@ -31,17 +31,181 @@ interface AgentProcessOptions {
|
|
|
31
31
|
* (the default) the process behaves as a plain conversational agent.
|
|
32
32
|
*/
|
|
33
33
|
delegationStrategy?: DelegationStrategy;
|
|
34
|
+
/**
|
|
35
|
+
* Provider for space-level MCP server configs, called on each turn.
|
|
36
|
+
*/
|
|
37
|
+
getMcpServers?: () => McpServer.McpServer[];
|
|
34
38
|
}
|
|
35
39
|
export declare const AGENT_PROCESS_KEY = "org.dxos.testing.process.agent";
|
|
36
40
|
/**
|
|
37
41
|
* Hosts a persistent, suspendible AiAgent that can process a number of prompts.
|
|
38
42
|
* The process target is a queue DXN string.
|
|
39
43
|
*/
|
|
40
|
-
export declare const AgentProcess: (options: AgentProcessOptions) => Process.Process<string
|
|
44
|
+
export declare const AgentProcess: (options: AgentProcessOptions) => Process.Process<string | readonly ({
|
|
45
|
+
readonly _tag: "anchor";
|
|
46
|
+
readonly pending?: boolean | undefined;
|
|
47
|
+
readonly objectId: string;
|
|
48
|
+
readonly version: unknown;
|
|
49
|
+
} | {
|
|
50
|
+
readonly _tag: "change";
|
|
51
|
+
readonly pending?: boolean | undefined;
|
|
52
|
+
readonly before: string;
|
|
53
|
+
readonly after: string;
|
|
54
|
+
} | {
|
|
55
|
+
readonly _tag: "file";
|
|
56
|
+
readonly pending?: boolean | undefined;
|
|
57
|
+
readonly url: string;
|
|
58
|
+
readonly name?: string | undefined;
|
|
59
|
+
readonly mediaType?: string | undefined;
|
|
60
|
+
} | {
|
|
61
|
+
readonly _tag: "image";
|
|
62
|
+
readonly pending?: boolean | undefined;
|
|
63
|
+
readonly id?: string | undefined;
|
|
64
|
+
readonly source?: {
|
|
65
|
+
readonly type: "base64";
|
|
66
|
+
readonly mediaType: string;
|
|
67
|
+
readonly data: string;
|
|
68
|
+
} | {
|
|
69
|
+
readonly type: "http";
|
|
70
|
+
readonly url: string;
|
|
71
|
+
} | undefined;
|
|
72
|
+
} | {
|
|
73
|
+
readonly _tag: "json";
|
|
74
|
+
readonly pending?: boolean | undefined;
|
|
75
|
+
readonly disposition?: "cot" | "synthetic" | "user" | "version-pin" | undefined;
|
|
76
|
+
readonly data: string;
|
|
77
|
+
} | {
|
|
78
|
+
readonly _tag: "proposal";
|
|
79
|
+
readonly pending?: boolean | undefined;
|
|
80
|
+
readonly text: string;
|
|
81
|
+
} | {
|
|
82
|
+
readonly _tag: "reasoning";
|
|
83
|
+
readonly pending?: boolean | undefined;
|
|
84
|
+
readonly reasoningText?: string | undefined;
|
|
85
|
+
readonly redactedText?: string | undefined;
|
|
86
|
+
readonly signature?: string | undefined;
|
|
87
|
+
} | {
|
|
88
|
+
readonly _tag: "reference";
|
|
89
|
+
readonly pending?: boolean | undefined;
|
|
90
|
+
readonly reference: import("@dxos/echo/internal").Ref<Obj.Unknown>;
|
|
91
|
+
} | {
|
|
92
|
+
readonly _tag: "select";
|
|
93
|
+
readonly pending?: boolean | undefined;
|
|
94
|
+
readonly options: string[];
|
|
95
|
+
} | {
|
|
96
|
+
readonly _tag: "stats";
|
|
97
|
+
readonly pending?: boolean | undefined;
|
|
98
|
+
readonly mimeType?: string | undefined;
|
|
99
|
+
readonly message?: string | undefined;
|
|
100
|
+
readonly model?: string | undefined;
|
|
101
|
+
readonly usage?: {
|
|
102
|
+
readonly inputTokens?: number | undefined;
|
|
103
|
+
readonly outputTokens?: number | undefined;
|
|
104
|
+
readonly totalTokens?: number | undefined;
|
|
105
|
+
} | undefined;
|
|
106
|
+
readonly toolCalls?: number | undefined;
|
|
107
|
+
readonly errors?: number | undefined;
|
|
108
|
+
readonly duration?: number | undefined;
|
|
109
|
+
readonly finishReason?: "content-filter" | "error" | "length" | "other" | "pause" | "stop" | "tool-calls" | "unknown" | undefined;
|
|
110
|
+
} | {
|
|
111
|
+
readonly _tag: "status";
|
|
112
|
+
readonly pending?: boolean | undefined;
|
|
113
|
+
readonly statusText: string;
|
|
114
|
+
} | {
|
|
115
|
+
readonly _tag: "suggestion";
|
|
116
|
+
readonly pending?: boolean | undefined;
|
|
117
|
+
readonly text: string;
|
|
118
|
+
} | {
|
|
119
|
+
readonly _tag: "summary";
|
|
120
|
+
readonly pending?: boolean | undefined;
|
|
121
|
+
readonly content: string;
|
|
122
|
+
} | {
|
|
123
|
+
readonly _tag: "surface";
|
|
124
|
+
readonly pending?: boolean | undefined;
|
|
125
|
+
readonly role: string;
|
|
126
|
+
readonly data?: {
|
|
127
|
+
readonly [x: string]: unknown;
|
|
128
|
+
} | undefined;
|
|
129
|
+
} | {
|
|
130
|
+
readonly _tag: "text";
|
|
131
|
+
readonly pending?: boolean | undefined;
|
|
132
|
+
readonly mimeType?: string | undefined;
|
|
133
|
+
readonly text: string;
|
|
134
|
+
readonly disposition?: "cot" | "synthetic" | "user" | "version-pin" | undefined;
|
|
135
|
+
} | {
|
|
136
|
+
readonly _tag: "toolCall";
|
|
137
|
+
readonly pending?: boolean | undefined;
|
|
138
|
+
readonly toolCallId: string;
|
|
139
|
+
readonly name: string;
|
|
140
|
+
readonly input: string;
|
|
141
|
+
readonly providerExecuted: boolean;
|
|
142
|
+
readonly operationKey?: string | undefined;
|
|
143
|
+
readonly operationName?: string | undefined;
|
|
144
|
+
readonly operationIcon?: string | undefined;
|
|
145
|
+
} | {
|
|
146
|
+
readonly _tag: "toolResult";
|
|
147
|
+
readonly pending?: boolean | undefined;
|
|
148
|
+
readonly toolCallId: string;
|
|
149
|
+
readonly name: string;
|
|
150
|
+
readonly result?: string | {
|
|
151
|
+
readonly _tag: "~@dxos/types/ContentBlock.ContentBlockResult";
|
|
152
|
+
readonly content: readonly ({
|
|
153
|
+
readonly _tag: "text";
|
|
154
|
+
readonly pending?: boolean | undefined;
|
|
155
|
+
readonly mimeType?: string | undefined;
|
|
156
|
+
readonly text: string;
|
|
157
|
+
readonly disposition?: "cot" | "synthetic" | "user" | "version-pin" | undefined;
|
|
158
|
+
} | {
|
|
159
|
+
readonly _tag: "image";
|
|
160
|
+
readonly pending?: boolean | undefined;
|
|
161
|
+
readonly id?: string | undefined;
|
|
162
|
+
readonly source?: {
|
|
163
|
+
readonly type: "base64";
|
|
164
|
+
readonly mediaType: string;
|
|
165
|
+
readonly data: string;
|
|
166
|
+
} | {
|
|
167
|
+
readonly type: "http";
|
|
168
|
+
readonly url: string;
|
|
169
|
+
} | undefined;
|
|
170
|
+
} | {
|
|
171
|
+
readonly _tag: "file";
|
|
172
|
+
readonly pending?: boolean | undefined;
|
|
173
|
+
readonly url: string;
|
|
174
|
+
readonly name?: string | undefined;
|
|
175
|
+
readonly mediaType?: string | undefined;
|
|
176
|
+
})[];
|
|
177
|
+
} | undefined;
|
|
178
|
+
readonly error?: string | undefined;
|
|
179
|
+
readonly providerExecuted: boolean;
|
|
180
|
+
} | {
|
|
181
|
+
readonly _tag: "toolkit";
|
|
182
|
+
readonly pending?: boolean | undefined;
|
|
183
|
+
} | {
|
|
184
|
+
readonly _tag: "transcript";
|
|
185
|
+
readonly pending?: boolean | undefined;
|
|
186
|
+
readonly started: string;
|
|
187
|
+
readonly text: string;
|
|
188
|
+
readonly corrected?: string | undefined;
|
|
189
|
+
readonly references?: import("@dxos/echo/internal").Ref<Obj.Unknown>[] | undefined;
|
|
190
|
+
readonly candidates?: {
|
|
191
|
+
readonly text: string;
|
|
192
|
+
readonly kind: "noun" | "proper-noun";
|
|
193
|
+
readonly start: number;
|
|
194
|
+
readonly end: number;
|
|
195
|
+
readonly suggested?: {
|
|
196
|
+
readonly typename: string;
|
|
197
|
+
} | undefined;
|
|
198
|
+
}[] | undefined;
|
|
199
|
+
readonly translation?: string | undefined;
|
|
200
|
+
})[], void, AiService.AiService | Credential.CredentialsService | OpaqueToolkit.OpaqueToolkitProvider | Registry.Service | Database.Service | Operation.Service | ProcessManager.ProcessOperationInvoker.Service | StorageService.StorageService, import("@effect/rpc/Rpc").Rpc<"enqueueMessage", Schema.Struct<{
|
|
41
201
|
content: Schema.Array$<Schema.Union<[Schema.TaggedStruct<"anchor", {
|
|
42
202
|
pending: Schema.optional<typeof Schema.Boolean>;
|
|
43
203
|
objectId: import("@dxos/keys").EntityIdClass;
|
|
44
204
|
version: typeof Schema.Unknown;
|
|
205
|
+
}>, Schema.TaggedStruct<"change", {
|
|
206
|
+
pending: Schema.optional<typeof Schema.Boolean>;
|
|
207
|
+
before: typeof Schema.String;
|
|
208
|
+
after: typeof Schema.String;
|
|
45
209
|
}>, Schema.TaggedStruct<"file", {
|
|
46
210
|
pending: Schema.optional<typeof Schema.Boolean>;
|
|
47
211
|
url: typeof Schema.String;
|
|
@@ -206,6 +370,10 @@ declare const AgentEvent: Schema.Union<[Schema.TaggedStruct<"prompt", {
|
|
|
206
370
|
pending: Schema.optional<typeof Schema.Boolean>;
|
|
207
371
|
objectId: import("@dxos/keys").EntityIdClass;
|
|
208
372
|
version: typeof Schema.Unknown;
|
|
373
|
+
}>, Schema.TaggedStruct<"change", {
|
|
374
|
+
pending: Schema.optional<typeof Schema.Boolean>;
|
|
375
|
+
before: typeof Schema.String;
|
|
376
|
+
after: typeof Schema.String;
|
|
209
377
|
}>, Schema.TaggedStruct<"file", {
|
|
210
378
|
pending: Schema.optional<typeof Schema.Boolean>;
|
|
211
379
|
url: typeof Schema.String;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"agent-process.d.ts","sourceRoot":"","sources":["../../../../src/agent-service/agent-process.ts"],"names":[],"mappings":"AASA,OAAO,KAAK,MAAM,MAAM,eAAe,CAAC;AAKxC,OAAO,KAAK,MAAM,MAAM,eAAe,CAAC;AAExC,OAAO,EAAE,SAAS,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAWpD,OAAO,EAAE,UAAU,
|
|
1
|
+
{"version":3,"file":"agent-process.d.ts","sourceRoot":"","sources":["../../../../src/agent-service/agent-process.ts"],"names":[],"mappings":"AASA,OAAO,KAAK,MAAM,MAAM,eAAe,CAAC;AAKxC,OAAO,KAAK,MAAM,MAAM,eAAe,CAAC;AAExC,OAAO,EAAE,SAAS,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAWpD,OAAO,EAAE,UAAU,EAAgB,SAAS,EAAE,SAAS,EAAS,MAAM,eAAe,CAAC;AACtF,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AACxC,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AACvD,OAAO,KAAK,cAAc,MAAM,8BAA8B,CAAC;AAC/D,OAAO,EAAc,QAAQ,E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C3B,cAAc,EAAE,cAAc,CAAC,OAAO,CAAC;IACvC,QAAQ,EAAE,CAAC,OAAO,CAAC,EAAE,MAAM,KAAK,IAAI,CAAC;IAErC;;;OAGG;IACH,GAAG,CAAC,EAAE,MAAM,MAAM,CAAC;CACpB;AAED;;;;;GAKG;AACH,qBAAa,YAAY;;IAOvB,YAAY,EAAE,cAAc,EAAE,QAAQ,EAAE,GAAsB,EAAE,EAAE,mBAAmB,EAIpF;IAED,gFAAgF;IAChF,IAAI,MAAM,IAAI,MAAM,GAAG,IAAI,CAE1B;IAED,+FAA+F;IAC/F,IAAI,OAAO,IAAI,MAAM,GAAG,IAAI,CAE3B;IAED,GAAG,IAAI,MAAM,CAEZ;IAED,0CAA0C;IAC1C,IAAI,IAAI,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,CAM1B;IAED,0FAA0F;IAC1F,SAAS,CAAC,MAAM,EAAE,MAAM,EAAE,OAAO,GAAE,MAAM,GAAG,IAAW,GAAG,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,CAM5E;IAED;;;OAGG;IACH,cAAc,IAAI,MAAM,CAAC,MAAM,CAAC;QAAE,OAAO,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,MAAM,GAAG,IAAI,CAAA;KAAE,GAAG,IAAI,CAAC,CAYlF;IAED;;;OAGG;IACH,SAAS,CAAC,cAAc,EAAE,OAAO,GAAG,IAAI,CAKvC;CACF"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"delegation-scripted.test.d.ts","sourceRoot":"","sources":["../../../../src/agent-service/delegation-scripted.test.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"scripted-loop.test.d.ts","sourceRoot":"","sources":["../../../../src/assistant-session-tests/scripted-loop.test.ts"],"names":[],"mappings":""}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/index.ts"],"names":[],"mappings":"AAIA,cAAc,iBAAiB,CAAC"}
|
|
@@ -48,16 +48,20 @@ interface TestLayerOptions {
|
|
|
48
48
|
*/
|
|
49
49
|
extraServices?: Layer.Layer<never, never, never>;
|
|
50
50
|
}
|
|
51
|
-
export type AssistantTestServices = LanguageModel.LanguageModel | Credential.CredentialsService | AgentService.AgentService | AiService.AiService | Database.Service | Registry.Service | OpaqueToolkit.OpaqueToolkitProvider | Operation.Service | ProcessManager.Service | Process.ProcessMonitorService | AtomRegistry.AtomRegistry | OperationHandlerSet.OperationHandlerProvider | KeyValueStore.KeyValueStore | ServiceResolver.ServiceResolver | Trace.TraceService | Trace.TraceSink | FeedTraceSink.FeedTraceSink;
|
|
51
|
+
export type AssistantTestServices = LanguageModel.LanguageModel | Credential.CredentialsService | AgentService.AgentService | AiService.AiService | Database.Service | Registry.Service | OpaqueToolkit.OpaqueToolkitProvider | Operation.Service | ProcessManager.Service | ProcessManager.ProcessOperationInvoker.Service | Process.ProcessMonitorService | AtomRegistry.AtomRegistry | OperationHandlerSet.OperationHandlerProvider | KeyValueStore.KeyValueStore | ServiceResolver.ServiceResolver | Trace.TraceService | Trace.TraceSink | FeedTraceSink.FeedTraceSink;
|
|
52
52
|
export declare const AssistantTestLayer: (options?: TestLayerOptions) => Layer.Layer<AssistantTestServices, never, TestContextService>;
|
|
53
53
|
/** Late-bound reference to the {@link ProcessManager.Service}, filled once the manager is built. */
|
|
54
54
|
interface ProcessManagerHolder {
|
|
55
55
|
current?: Context.Tag.Service<ProcessManager.Service>;
|
|
56
56
|
}
|
|
57
|
+
/** Late-bound reference to the {@link AgentService.AgentService}, filled once the service is built. */
|
|
58
|
+
interface AgentServiceHolder {
|
|
59
|
+
current?: Context.Tag.Service<AgentService.AgentService>;
|
|
60
|
+
}
|
|
57
61
|
/**
|
|
58
62
|
* Service resolver for testing.
|
|
59
63
|
*/
|
|
60
|
-
export declare const AssistantTestServiceResolverLayer: ({ extraServices }: Pick<TestLayerOptions, 'extraServices'>, processManagerHolder: ProcessManagerHolder) => Layer.Layer<ServiceResolver.ServiceResolver, never, AiService.AiService | Credential.CredentialsService | OpaqueToolkit.OpaqueToolkitProvider | Registry.Service | Database.Service>;
|
|
64
|
+
export declare const AssistantTestServiceResolverLayer: ({ extraServices }: Pick<TestLayerOptions, 'extraServices'>, processManagerHolder: ProcessManagerHolder, agentServiceHolder?: AgentServiceHolder) => Layer.Layer<ServiceResolver.ServiceResolver, never, AiService.AiService | Credential.CredentialsService | OpaqueToolkit.OpaqueToolkitProvider | Registry.Service | Database.Service>;
|
|
61
65
|
/**
|
|
62
66
|
* Only storage + registry.
|
|
63
67
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"assistant-test-layer.d.ts","sourceRoot":"","sources":["../../../../src/testing/assistant-test-layer.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,QAAQ,IAAI,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAC7D,OAAO,KAAK,aAAa,MAAM,0BAA0B,CAAC;AAC1D,OAAO,KAAK,aAAa,MAAM,gCAAgC,CAAC;AAEhE,OAAO,KAAK,OAAO,MAAM,gBAAgB,CAAC;AAE1C,OAAO,KAAK,KAAK,MAAM,cAAc,CAAC;AAGtC,OAAO,EAAE,SAAS,EAAE,aAAa,EAAY,MAAM,UAAU,CAAC;AAG9D,OAAO,EACL,YAAY,EACZ,UAAU,EAEV,SAAS,EACT,mBAAmB,EACnB,OAAO,EAEP,eAAe,EACf,KAAK,EACL,KAAK,EAEN,MAAM,eAAe,CAAC;AACvB,OAAO,EACL,aAAa,EACb,cAAc,
|
|
1
|
+
{"version":3,"file":"assistant-test-layer.d.ts","sourceRoot":"","sources":["../../../../src/testing/assistant-test-layer.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,QAAQ,IAAI,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAC7D,OA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AU,kBAAkB;IAC1B,OAAO,CAAC,EAAE,OAAO,CAAC,GAAG,CAAC,OAAO,CAAC,YAAY,CAAC,YAAY,CAAC,CAAC;CAC1D;AAkBD;;GAEG;AACH,eAAO,MAAM,iCAAiC,sBACX,IAAI,CAAC,gBAAgB,EAAE,eAAe,CAAC,wBAClD,oBAAoB,uBACtB,kBAAkB,yLAiDrC,CAAC;AAEJ;;GAEG;AACH,eAAO,MAAM,sBAAsB,iEAMhC,IAAI,CAAC,gBAAgB,EAAE,mBAAmB,GAAG,UAAU,GAAG,OAAO,GAAG,QAAQ,GAAG,SAAS,GAAG,aAAa,CAAC,kPA0C3G,CAAC;AAaF,UAAU,4BAA6B,SAAQ,gBAAgB;CAAG;AAElE,MAAM,MAAM,iCAAiC,GAAG,qBAAqB,GAAG,iBAAiB,GAAG,iBAAiB,CAAC;AAE9G,eAAO,MAAM,8BAA8B,YAChC,4BAA4B,KACpC,KAAK,CAAC,KAAK,CAAC,iCAAiC,EAAE,KAAK,EAAE,kBAAkB,CAOjE,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/testing/index.ts"],"names":[],"mappings":"AAIA,cAAc,wBAAwB,CAAC;AACvC,cAAc,sBAAsB,CAAC;AACrC,OAAO,KAAK,eAAe,MAAM,mBAAmB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/testing/index.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AAEpD,cAAc,wBAAwB,CAAC;AACvC,cAAc,cAAc,CAAC;AAC7B,cAAc,sBAAsB,CAAC;AACrC,OAAO,KAAK,eAAe,MAAM,mBAAmB,CAAC"}
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import * as Effect from 'effect/Effect';
|
|
2
|
+
import type * as Scope from 'effect/Scope';
|
|
3
|
+
import { CompleteBlock, PartialBlock } from '@dxos/assistant';
|
|
4
|
+
import { type AgentService, Trace } from '@dxos/compute';
|
|
5
|
+
import { Database, Feed } from '@dxos/echo';
|
|
6
|
+
import { BaseError, type BaseErrorOptions } from '@dxos/errors';
|
|
7
|
+
import { Message } from '@dxos/types';
|
|
8
|
+
/**
|
|
9
|
+
* Buffered view of a session's ephemeral block events — the headless equivalent of what the chat
|
|
10
|
+
* UI renders while a request streams.
|
|
11
|
+
*/
|
|
12
|
+
export interface EphemeralCollector {
|
|
13
|
+
/** Snapshot of `PartialBlock` payloads observed so far, in arrival order. */
|
|
14
|
+
partialBlocks: () => readonly Trace.PayloadType<typeof PartialBlock>[];
|
|
15
|
+
/** Snapshot of `CompleteBlock` payloads observed so far, in arrival order. */
|
|
16
|
+
completeBlocks: () => readonly Trace.PayloadType<typeof CompleteBlock>[];
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Forks a collector over {@link AgentService.Session.subscribeEphemeral} so a test can assert the
|
|
20
|
+
* streaming path (partial → complete blocks) without a UI. The fork is scoped: use with
|
|
21
|
+
* `it.scoped` (or an explicit scope) so the subscription is interrupted on test close.
|
|
22
|
+
*/
|
|
23
|
+
export declare const collectEphemeral: (session: AgentService.Session) => Effect.Effect<EphemeralCollector, never, Scope.Scope>;
|
|
24
|
+
declare const WaitForMessageTimeoutError_base: {
|
|
25
|
+
new (options?: BaseErrorOptions): {
|
|
26
|
+
cause?: unknown;
|
|
27
|
+
stack?: string;
|
|
28
|
+
name: "WaitForMessageTimeoutError";
|
|
29
|
+
context: Record<string, unknown>;
|
|
30
|
+
readonly message: string;
|
|
31
|
+
readonly _tag: "WaitForMessageTimeoutError";
|
|
32
|
+
};
|
|
33
|
+
isError(error: unknown): error is Error;
|
|
34
|
+
name: "WaitForMessageTimeoutError";
|
|
35
|
+
is(error: unknown): error is BaseError;
|
|
36
|
+
wrap(options?: Omit<BaseErrorOptions, 'cause'> & {
|
|
37
|
+
ifTypeDiffers?: boolean;
|
|
38
|
+
}): (error: unknown) => {
|
|
39
|
+
cause?: unknown;
|
|
40
|
+
stack?: string;
|
|
41
|
+
name: "WaitForMessageTimeoutError";
|
|
42
|
+
context: Record<string, unknown>;
|
|
43
|
+
readonly message: string;
|
|
44
|
+
readonly _tag: "WaitForMessageTimeoutError";
|
|
45
|
+
};
|
|
46
|
+
extend<Name extends string = string>(name: Name, message?: string): any;
|
|
47
|
+
captureStackTrace(targetObject: object, constructorOpt?: Function): void;
|
|
48
|
+
prepareStackTrace?: ((err: Error, stackTraces: NodeJS.CallSite[]) => any) | undefined;
|
|
49
|
+
stackTraceLimit: number;
|
|
50
|
+
};
|
|
51
|
+
export declare class WaitForMessageTimeoutError extends WaitForMessageTimeoutError_base {
|
|
52
|
+
constructor(timeout: number, options?: Omit<BaseErrorOptions, 'context'>);
|
|
53
|
+
}
|
|
54
|
+
export interface WaitForMessageOptions {
|
|
55
|
+
/** Overall deadline in milliseconds. @default 10_000 */
|
|
56
|
+
timeout?: number;
|
|
57
|
+
/** Poll interval in milliseconds. @default 100 */
|
|
58
|
+
interval?: number;
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* Polls the conversation feed until a message matches. Covers the gap left by
|
|
62
|
+
* `Session.waitForCompletion`, which settles when the *turn* completes — background sub-agents
|
|
63
|
+
* report back later, out of band. Polls on the real clock (not the Effect `TestClock`), so it works
|
|
64
|
+
* under `it.effect` and `it.scoped` alike.
|
|
65
|
+
*/
|
|
66
|
+
export declare const waitForMessage: (feed: Feed.Feed, predicate: (message: Message.Message) => boolean, { timeout, interval }?: WaitForMessageOptions) => Effect.Effect<Message.Message, WaitForMessageTimeoutError, Database.Service>;
|
|
67
|
+
/** Convenience predicate: any block's text content contains the substring. */
|
|
68
|
+
export declare const messageTextIncludes: (needle: string) => (message: Message.Message) => boolean;
|
|
69
|
+
export {};
|
|
70
|
+
//# sourceMappingURL=test-agent.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"test-agent.d.ts","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