@ddwang/magnitude-core 0.3.1-ddwang.1 → 0.3.1-ddwang.2

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.
Files changed (99) hide show
  1. package/dist/actions/desktopActions.js +2 -1
  2. package/dist/actions/index.d.ts +10 -9
  3. package/dist/actions/memoryActions.d.ts +9 -0
  4. package/dist/actions/memoryActions.js +34 -0
  5. package/dist/actions/types.d.ts +5 -1
  6. package/dist/actions/util.d.ts +2 -1
  7. package/dist/actions/util.js +6 -23
  8. package/dist/actions/webActions.d.ts +9 -1
  9. package/dist/actions/webActions.js +29 -5
  10. package/dist/actions/webActions.test.d.ts +1 -0
  11. package/dist/actions/webActions.test.js +43 -0
  12. package/dist/agent/browserAgent.d.ts +4 -2
  13. package/dist/agent/browserAgent.js +18 -4
  14. package/dist/agent/errors.d.ts +14 -0
  15. package/dist/agent/errors.js +29 -0
  16. package/dist/agent/index.d.ts +17 -6
  17. package/dist/agent/index.js +151 -23
  18. package/dist/ai/baml_client/async_client.d.ts +17 -26
  19. package/dist/ai/baml_client/async_client.js +175 -43
  20. package/dist/ai/baml_client/async_request.d.ts +13 -9
  21. package/dist/ai/baml_client/async_request.js +55 -19
  22. package/dist/ai/baml_client/index.d.ts +2 -1
  23. package/dist/ai/baml_client/index.js +6 -5
  24. package/dist/ai/baml_client/inlinedbaml.js +2 -2
  25. package/dist/ai/baml_client/parser.js +18 -18
  26. package/dist/ai/baml_client/sync_client.d.ts +12 -5
  27. package/dist/ai/baml_client/sync_client.js +64 -22
  28. package/dist/ai/baml_client/sync_request.d.ts +11 -9
  29. package/dist/ai/baml_client/sync_request.js +55 -19
  30. package/dist/ai/baml_client/type_builder.d.ts +2 -0
  31. package/dist/ai/baml_client/type_builder.js +25 -1
  32. package/dist/ai/baml_client/watchers.d.ts +32 -0
  33. package/dist/ai/baml_client/watchers.js +50 -0
  34. package/dist/ai/baseten.d.ts +4 -0
  35. package/dist/ai/baseten.js +10 -0
  36. package/dist/ai/modelHarness.d.ts +9 -9
  37. package/dist/ai/modelHarness.js +204 -69
  38. package/dist/ai/modelResponseError.d.ts +4 -0
  39. package/dist/ai/modelResponseError.js +8 -0
  40. package/dist/ai/multiModelHarness.d.ts +2 -5
  41. package/dist/ai/plannerResponse.d.ts +34 -0
  42. package/dist/ai/plannerResponse.js +96 -0
  43. package/dist/ai/plannerResponse.test.d.ts +1 -0
  44. package/dist/ai/plannerResponse.test.js +112 -0
  45. package/dist/ai/structuredOutput.d.ts +11 -0
  46. package/dist/ai/structuredOutput.js +94 -0
  47. package/dist/ai/structuredOutput.test.d.ts +1 -0
  48. package/dist/ai/structuredOutput.test.js +91 -0
  49. package/dist/ai/types.d.ts +30 -1
  50. package/dist/ai/util.js +38 -3
  51. package/dist/ai/util.test.d.ts +1 -0
  52. package/dist/ai/util.test.js +95 -0
  53. package/dist/common/events.d.ts +2 -0
  54. package/dist/common/operation.d.ts +31 -0
  55. package/dist/common/operation.js +102 -0
  56. package/dist/common/operation.test.d.ts +1 -0
  57. package/dist/common/operation.test.js +53 -0
  58. package/dist/common/retry.js +7 -2
  59. package/dist/common/util.js +9 -2
  60. package/dist/connectors/browserConnector.d.ts +13 -0
  61. package/dist/connectors/browserConnector.js +167 -4
  62. package/dist/connectors/index.d.ts +6 -2
  63. package/dist/index.cjs +1568 -355
  64. package/dist/index.d.cts +259 -74
  65. package/dist/index.d.ts +4 -0
  66. package/dist/index.js +2 -0
  67. package/dist/index.mjs +1563 -358
  68. package/dist/memory/agentMemory.d.ts +10 -0
  69. package/dist/memory/agentMemory.js +60 -14
  70. package/dist/memory/agentMemory.test.d.ts +1 -0
  71. package/dist/memory/agentMemory.test.js +150 -0
  72. package/dist/memory/image.d.ts +2 -0
  73. package/dist/memory/image.js +24 -35
  74. package/dist/memory/image.test.d.ts +1 -0
  75. package/dist/memory/image.test.js +46 -0
  76. package/dist/memory/notebook.d.ts +58 -0
  77. package/dist/memory/notebook.js +75 -0
  78. package/dist/memory/notebook.test.d.ts +1 -0
  79. package/dist/memory/notebook.test.js +99 -0
  80. package/dist/memory/rendering/renderJsonParts.test.js +2 -2
  81. package/dist/memory/serde.js +4 -18
  82. package/dist/memory/serde.test.d.ts +1 -0
  83. package/dist/memory/serde.test.js +64 -0
  84. package/dist/web/browserProvider.d.ts +1 -0
  85. package/dist/web/browserProvider.js +11 -0
  86. package/dist/web/browserProvider.test.d.ts +1 -0
  87. package/dist/web/browserProvider.test.js +44 -0
  88. package/dist/web/harness.d.ts +7 -0
  89. package/dist/web/harness.js +80 -19
  90. package/dist/web/recovery.d.ts +46 -0
  91. package/dist/web/recovery.js +137 -0
  92. package/dist/web/recovery.test.d.ts +1 -0
  93. package/dist/web/recovery.test.js +182 -0
  94. package/dist/web/stability.js +10 -3
  95. package/dist/web/types.d.ts +6 -1
  96. package/dist/web/visualizer/cursor.js +2 -1
  97. package/dist/web/zodReexport.test.d.ts +1 -0
  98. package/dist/web/zodReexport.test.js +14 -0
  99. package/package.json +2 -2
@@ -2,9 +2,12 @@ import logger from '@/logger';
2
2
  import EventEmitter from "eventemitter3";
3
3
  import z from "zod";
4
4
  import { Observation } from '@/memory/observation';
5
- import { AgentError } from "@/agent/errors";
5
+ import { ActionLimitError, AgentBusyError, AgentError } from "@/agent/errors";
6
+ import { Operation, checkOperation, currentOperation, operationOptions, untilAborted } from '@/common/operation';
6
7
  import { AgentMemory } from "@/memory";
7
8
  import { taskActions } from "@/actions/taskActions";
9
+ import { memoryActions } from '@/actions/memoryActions';
10
+ import { NOTEBOOK_INSTRUCTIONS } from '@/memory/notebook';
8
11
  import { traceAsync } from "@/ai/baml_client";
9
12
  import { telemetrifyAgent } from '@/telemetry/events';
10
13
  import { isClaude } from '@/ai/util';
@@ -24,6 +27,7 @@ const DEFAULT_CONFIG = {
24
27
  },
25
28
  prompt: null,
26
29
  telemetry: true,
30
+ maxActions: Infinity,
27
31
  };
28
32
  export class Agent {
29
33
  // maybe remove conns/actions from options since stored sep
@@ -41,6 +45,9 @@ export class Agent {
41
45
  doneActing;
42
46
  _paused = false;
43
47
  _pauseResolve = null;
48
+ activeOperation;
49
+ idle = Promise.resolve();
50
+ stopped = false;
44
51
  latestTaskMemory; // | null = null;
45
52
  constructor(baseConfig = {}) {
46
53
  this.options = {
@@ -49,6 +56,9 @@ export class Agent {
49
56
  connectors: baseConfig.connectors ?? [],
50
57
  actions: [...(baseConfig.actions || DEFAULT_CONFIG.actions)],
51
58
  };
59
+ if (baseConfig.maxActions !== undefined && (!Number.isSafeInteger(baseConfig.maxActions) || baseConfig.maxActions < 1)) {
60
+ throw new Error('maxActions must be a positive integer');
61
+ }
52
62
  this.connectors = this.options.connectors;
53
63
  // Aggregate actions from connectors
54
64
  //const aggregatedActions = [...this.options.actions];
@@ -56,6 +66,11 @@ export class Agent {
56
66
  for (const connector of this.connectors) {
57
67
  this.actions.push(...(connector.getActionSpace ? connector.getActionSpace() : []));
58
68
  }
69
+ for (const action of memoryActions) {
70
+ if (this.actions.some(existing => existing.name === action.name))
71
+ throw new Error(`Action name '${action.name}' is reserved for task memory.`);
72
+ this.actions.push(action);
73
+ }
59
74
  // Deduplicate actions by name
60
75
  // TODO: maybe error instead, or automatically differentiate them?
61
76
  //this.options.actions = Array.from(new Map(aggregatedActions.map(actDef => [actDef.name, actDef])).values());
@@ -99,6 +114,9 @@ export class Agent {
99
114
  return connector;
100
115
  }
101
116
  async start() {
117
+ checkOperation();
118
+ if (this.busy)
119
+ throw new AgentBusyError();
102
120
  // Register telemetry if enabled - do on start instead of cons to prevent weird subclass event issues
103
121
  if (this.options.telemetry)
104
122
  telemetrifyAgent(this);
@@ -111,6 +129,7 @@ export class Agent {
111
129
  await connector.onStart();
112
130
  }
113
131
  this.events.emit('start');
132
+ this.stopped = false;
114
133
  logger.info("Agent: All connectors started.");
115
134
  // logger.info("Making initial observations...");
116
135
  // await this._recordConnectorObservations();
@@ -127,7 +146,46 @@ export class Agent {
127
146
  }
128
147
  return actionDefinition;
129
148
  }
130
- async exec(action, memory) {
149
+ /** True until underlying work settles, including after a cancelled caller returns. */
150
+ get busy() {
151
+ return this.activeOperation !== undefined;
152
+ }
153
+ whenIdle() {
154
+ return this.idle;
155
+ }
156
+ async runOperation(options, fn) {
157
+ const inherited = currentOperation();
158
+ if (inherited?.owner === this)
159
+ inherited.check();
160
+ if (this.busy)
161
+ throw new AgentBusyError();
162
+ if (this.stopped)
163
+ throw new AgentError('Agent is stopped; call start() before using it');
164
+ const operation = new Operation(this, options);
165
+ this.activeOperation = operation;
166
+ let markIdle;
167
+ this.idle = new Promise(resolve => { markIdle = resolve; });
168
+ const worker = operation.run(async () => {
169
+ operation.check();
170
+ try {
171
+ return await fn();
172
+ }
173
+ finally {
174
+ operation.check(); // Preserve the cancellation/deadline cause through downstream errors.
175
+ }
176
+ });
177
+ const settled = worker.finally(() => {
178
+ operation.dispose();
179
+ this.activeOperation = undefined;
180
+ markIdle();
181
+ });
182
+ return untilAborted(settled, operation.signal);
183
+ }
184
+ async exec(action, memory, options = {}) {
185
+ return this.runOperation(options, () => this._exec(action, memory));
186
+ }
187
+ async _exec(action, memory) {
188
+ checkOperation();
131
189
  /**
132
190
  * Execute an action that belongs to this Agent's action space.
133
191
  * Provide memory to record the action taken, its results, and any connector observations to that memory.
@@ -145,35 +203,54 @@ export class Agent {
145
203
  if (!parsed.success) {
146
204
  throw new AgentError(`Generated action '${action.variant}' violates input schema: ${parsed.error.message}`, { adaptable: true });
147
205
  }
206
+ const memoryOnly = memoryActions.includes(actionDefinition);
207
+ if (!memoryOnly)
208
+ for (const connector of this.connectors) {
209
+ await connector.beforeAction?.(action, operationOptions());
210
+ checkOperation();
211
+ }
148
212
  this.events.emit('actionStarted', action);
149
- const data = await actionDefinition.resolver({ input: parsed.data, agent: this });
213
+ checkOperation();
214
+ const data = await actionDefinition.resolver({ input: parsed.data, agent: this, memory, ...operationOptions() });
215
+ checkOperation();
150
216
  this.events.emit('actionDone', action);
217
+ checkOperation();
151
218
  if (memory) {
152
219
  // Record action taken
153
- memory.recordObservation(Observation.fromActionTaken(actionDefinition.name, JSON.stringify(action)));
220
+ memory.recordObservation(Observation.fromActionTaken(actionDefinition.name, JSON.stringify(action), memoryOnly ? { type: 'notebook-write' } : undefined));
154
221
  // Record results of action
155
222
  if (data) {
156
- memory.recordObservation(Observation.fromActionResult(actionDefinition.name, data));
223
+ memory.recordObservation(Observation.fromActionResult(actionDefinition.name, data, memoryOnly ? { type: 'notebook-result', limit: 1 } : undefined));
157
224
  }
158
225
  // Collect and record observations from connectors
159
- await this._recordConnectorObservations(memory);
226
+ if (memoryOnly)
227
+ this.events.emit('observationsRecorded'); // Checkpoint notes without another browser capture.
228
+ else
229
+ await this._recordConnectorObservations(memory);
160
230
  }
231
+ return data;
161
232
  }
162
233
  async _recordConnectorObservations(memory) {
234
+ checkOperation();
163
235
  for (const connector of this.connectors) {
164
236
  // could do Promise.all if matters
165
- const connObservations = connector.collectObservations ? await connector.collectObservations() : [];
237
+ const connObservations = connector.collectObservations ? await connector.collectObservations(operationOptions()) : [];
238
+ checkOperation();
166
239
  //observations.push(...connObservations);
167
240
  for (const obs of connObservations) {
168
241
  memory.recordObservation(obs);
169
242
  }
170
243
  }
244
+ this.events.emit('observationsRecorded');
171
245
  }
172
246
  get memory() {
173
247
  //if (!this.latestTaskMemory) throw new Error("No memory available");
174
248
  return this.latestTaskMemory;
175
249
  }
176
250
  async act(taskOrSteps, options = {}) {
251
+ return this.runOperation(options, () => this._runAct(taskOrSteps, options));
252
+ }
253
+ async _runAct(taskOrSteps, options) {
177
254
  const instructions = [
178
255
  ...(this.options.prompt ? [this.options.prompt] : []),
179
256
  ...(options.prompt ? [options.prompt] : []),
@@ -185,8 +262,10 @@ export class Agent {
185
262
  // trace overall task
186
263
  await (traceAsync('multistep', async (steps, options) => {
187
264
  for (const step of steps) {
265
+ checkOperation();
188
266
  this.events.emit('actStarted', step, options);
189
267
  await this._traceAct(step, taskMemory, options);
268
+ checkOperation();
190
269
  this.events.emit('actDone', step, options);
191
270
  }
192
271
  })(steps, options));
@@ -196,6 +275,7 @@ export class Agent {
196
275
  const task = taskOrSteps;
197
276
  this.events.emit('actStarted', task, options);
198
277
  await this._traceAct(task, taskMemory, options);
278
+ checkOperation();
199
279
  this.events.emit('actDone', task, options);
200
280
  }
201
281
  }
@@ -205,12 +285,15 @@ export class Agent {
205
285
  await this._act(task, memory, options);
206
286
  })(task));
207
287
  }
208
- async _buildContext(memory) {
209
- const messages = await memory.render();
288
+ async _buildContext(memory, options) {
289
+ checkOperation();
290
+ const messages = await memory.render(options);
291
+ checkOperation();
210
292
  const connectorInstructions = [];
211
293
  for (const connector of this.connectors) {
212
294
  if (connector.getInstructions) {
213
- const instructions = await connector.getInstructions();
295
+ const instructions = await connector.getInstructions(operationOptions());
296
+ checkOperation();
214
297
  if (instructions) {
215
298
  connectorInstructions.push({
216
299
  connectorId: connector.id,
@@ -227,7 +310,12 @@ export class Agent {
227
310
  };
228
311
  }
229
312
  async _act(description, memory, options = {}) {
313
+ checkOperation();
230
314
  this.doneActing = false;
315
+ for (const connector of this.connectors) {
316
+ connector.onTaskStart?.(operationOptions());
317
+ checkOperation();
318
+ }
231
319
  logger.info(`Act: ${description}`);
232
320
  // for now simply add data to task
233
321
  let dataContentParts = [];
@@ -247,20 +335,29 @@ export class Agent {
247
335
  //const testData = convertOptionsToTestData(options);
248
336
  // Initialize task memory and record initial observations
249
337
  // Combine any agent-level and task-level instructions
338
+ checkOperation();
250
339
  this.latestTaskMemory = memory;
251
340
  // record initial observations
252
341
  logger.info("Making initial observations...");
253
342
  await this._recordConnectorObservations(memory);
254
343
  logger.info("Initial observations recorded");
344
+ let actionCount = 0;
255
345
  while (true) {
346
+ checkOperation();
347
+ if (actionCount >= this.options.maxActions)
348
+ throw new ActionLimitError(this.options.maxActions);
256
349
  // Removed direct screenshot/tabState access here; it's part of memoryContext via connectors
257
350
  logger.info(`Creating partial recipe`);
258
351
  let reasoning = "";
259
352
  let actions = [];
353
+ let memoryUpdates = [];
260
354
  try {
355
+ this.events.emit('planningStarted');
261
356
  const memoryContext = await this._buildContext(memory);
357
+ memoryContext.connectorInstructions.unshift({ connectorId: 'task_memory', instructions: NOTEBOOK_INSTRUCTIONS });
262
358
  await retryOnError(async () => {
263
- ({ reasoning, actions } = await this.models.partialAct(memoryContext, description, dataContentParts, this.actions));
359
+ ({ reasoning, actions, memory_updates: memoryUpdates } = await this.models.partialAct(memoryContext, description, dataContentParts, this.actions));
360
+ checkOperation();
264
361
  if (actions.length === 0) {
265
362
  // Empty action list behavior - default wait else ... err? what if not in action space?
266
363
  //actions.push()
@@ -278,6 +375,7 @@ export class Agent {
278
375
  });
279
376
  }
280
377
  catch (error) {
378
+ checkOperation();
281
379
  logger.error(`Error planning actions: ${error instanceof Error ? error.message : String(error)}`);
282
380
  /**
283
381
  * (1) Failure to conform to JSON
@@ -293,13 +391,24 @@ export class Agent {
293
391
  logger.info({ reasoning, actions }, `Partial recipe created`);
294
392
  // Could be emitted in memory and bubbled up instead of recordThought was called in more places
295
393
  this.events.emit('thought', reasoning);
394
+ checkOperation();
296
395
  memory.recordThought(reasoning);
297
- // Execute partial recipe
298
- for (const action of actions) {
396
+ // Persist the review using the existing audited, budgeted note action.
397
+ // Empty reviews are free; each attempted write consumes one action.
398
+ const batch = [...memoryUpdates.map(note => ({ variant: 'memory:note', ...note })), ...actions];
399
+ for (const action of batch) {
299
400
  await this._waitIfPaused();
401
+ checkOperation();
300
402
  if (this.doneActing)
301
403
  break;
302
- await this.exec(action, memory);
404
+ if (actionCount >= this.options.maxActions)
405
+ throw new ActionLimitError(this.options.maxActions);
406
+ const result = await this._exec(action, memory);
407
+ actionCount++;
408
+ // Preserve the current page when an update fails. Successful
409
+ // earlier writes remain; the next plan sees the failure result.
410
+ if (action.variant === 'memory:note' && result?.saved === false)
411
+ break;
303
412
  // const postActionScreenshot = await this.screenshot();
304
413
  // const actionDescriptor: ActionDescriptor = { ...action, screenshot: postActionScreenshot.image } as ActionDescriptor;
305
414
  // this.events.emit('action', actionDescriptor);
@@ -318,28 +427,42 @@ export class Agent {
318
427
  //this.events.emit('stepSuccess');
319
428
  //this.currentTaskMemory = null;
320
429
  }
321
- async query(query, schema) {
322
- // Record observations in case no act() was used beforehand
323
- await this._recordConnectorObservations(this.latestTaskMemory);
324
- const memoryContext = await this._buildContext(this.memory); //this.memory.buildContext(this.connectors);
325
- return await this.models.query(memoryContext, query, schema);
430
+ async query(query, schema, options = {}) {
431
+ return this.runOperation(options, async () => {
432
+ // Record observations in case no act() was used beforehand
433
+ await this._recordConnectorObservations(this.latestTaskMemory);
434
+ const memoryContext = await this._buildContext(this.memory, options);
435
+ return await this.models.query(memoryContext, query, schema);
436
+ });
326
437
  }
327
438
  async queueDone() {
439
+ checkOperation();
328
440
  this.doneActing = true;
329
441
  }
330
442
  async _waitIfPaused() {
443
+ checkOperation();
331
444
  if (!this._paused)
332
445
  return;
333
446
  this.events.emit('pause');
447
+ checkOperation();
448
+ if (!this._paused)
449
+ return; // A pause listener may have resumed synchronously.
334
450
  logger.info("Agent: Paused");
335
- await new Promise((resolve) => {
336
- this._pauseResolve = resolve;
337
- });
451
+ try {
452
+ await untilAborted(new Promise((resolve) => {
453
+ this._pauseResolve = resolve;
454
+ }), currentOperation()?.signal);
455
+ }
456
+ finally {
457
+ this._pauseResolve = null;
458
+ }
338
459
  }
339
460
  pause() {
461
+ checkOperation();
340
462
  this._paused = true;
341
463
  }
342
464
  resume() {
465
+ checkOperation();
343
466
  this._paused = false;
344
467
  if (this._pauseResolve) {
345
468
  this._pauseResolve();
@@ -352,13 +475,18 @@ export class Agent {
352
475
  return this._paused;
353
476
  }
354
477
  async stop() {
478
+ checkOperation();
355
479
  /**
356
480
  * Stop the agent and close the browser context.
357
481
  * May be called asynchronously and interrupt an agent in the middle of a action sequence.
358
482
  */
483
+ this.stopped = true;
484
+ this.activeOperation?.cancel('Agent stopped');
359
485
  this.doneActing = true;
360
486
  if (this._paused) {
361
- this.resume(); // unblock so loop can see doneActing and exit
487
+ this._paused = false;
488
+ this._pauseResolve?.();
489
+ this._pauseResolve = null;
362
490
  }
363
491
  logger.info("Agent: Stopping connectors...");
364
492
  for (const connector of this.connectors) {
@@ -7,8 +7,8 @@ $ yarn add @boundaryml/baml
7
7
  $ pnpm add @boundaryml/baml
8
8
 
9
9
  *************************************************************************************************/
10
- import type { BamlRuntime, BamlCtxManager, ClientRegistry, Image, Collector } from "@boundaryml/baml";
11
- import { BamlStream } from "@boundaryml/baml";
10
+ import type { BamlRuntime, BamlCtxManager, Image, FunctionLog } from "@boundaryml/baml";
11
+ import { BamlStream, Collector, ClientRegistry } from "@boundaryml/baml";
12
12
  import type { RecursivePartialNull as MovedRecursivePartialNull } from "./types";
13
13
  import type { partial_types } from "./partial_types";
14
14
  import type * as types from "./types";
@@ -16,14 +16,20 @@ import type TypeBuilder from "./type_builder";
16
16
  import { AsyncHttpRequest, AsyncHttpStreamRequest } from "./async_request";
17
17
  import { LlmResponseParser, LlmStreamParser } from "./parser";
18
18
  /**
19
- * @deprecated Use RecursivePartialNull from 'baml_client/types' instead.
20
- */
19
+ * @deprecated Use RecursivePartialNull from 'baml_client/types' instead.
20
+ */
21
21
  export type RecursivePartialNull<T> = MovedRecursivePartialNull<T>;
22
- type BamlCallOptions = {
22
+ type TickReason = "Unknown";
23
+ type BamlCallOptions<WatchersT = never> = {
23
24
  tb?: TypeBuilder;
24
25
  clientRegistry?: ClientRegistry;
26
+ client?: string;
25
27
  collector?: Collector | Collector[];
26
28
  env?: Record<string, string | undefined>;
29
+ tags?: Record<string, string>;
30
+ signal?: AbortSignal;
31
+ onTick?: (reason: TickReason, log: FunctionLog | null) => void;
32
+ watchers?: WatchersT;
27
33
  };
28
34
  export declare class BamlAsyncClient {
29
35
  private runtime;
@@ -41,33 +47,18 @@ export declare class BamlAsyncClient {
41
47
  get streamRequest(): AsyncHttpStreamRequest;
42
48
  get parse(): LlmResponseParser;
43
49
  get parseStream(): LlmStreamParser;
44
- CreatePartialRecipe(memory: types.AgentContext, task: string, taskData: (Image | string)[], includeClaudeSpoof: boolean, __baml_options__?: BamlCallOptions): Promise<types.PartialRecipe>;
45
- ExtractData(instructions: string, screenshot: Image, domContent: string, includeClaudeSpoof: boolean, __baml_options__?: BamlCallOptions): Promise<types.ExtractedData>;
46
- QueryMemory(memory: types.AgentContext, query: string, includeClaudeSpoof: boolean, __baml_options__?: BamlCallOptions): Promise<types.QueryResponse>;
50
+ CreatePartialRecipe(memory: types.AgentContext, task: string, taskData: (Image | string)[], includeClaudeSpoof: boolean, __baml_options__?: BamlCallOptions<never>): Promise<types.PartialRecipe>;
51
+ ExtractData(instructions: string, screenshot: Image, domContent: string, includeClaudeSpoof: boolean, __baml_options__?: BamlCallOptions<never>): Promise<types.ExtractedData>;
52
+ QueryMemory(memory: types.AgentContext, query: string, includeClaudeSpoof: boolean, __baml_options__?: BamlCallOptions<never>): Promise<types.QueryResponse>;
47
53
  }
48
54
  declare class BamlStreamClient {
49
55
  private runtime;
50
56
  private ctxManager;
51
57
  private bamlOptions;
52
58
  constructor(runtime: BamlRuntime, ctxManager: BamlCtxManager, bamlOptions?: BamlCallOptions);
53
- CreatePartialRecipe(memory: types.AgentContext, task: string, taskData: (Image | string)[], includeClaudeSpoof: boolean, __baml_options__?: {
54
- tb?: TypeBuilder;
55
- clientRegistry?: ClientRegistry;
56
- collector?: Collector | Collector[];
57
- env?: Record<string, string | undefined>;
58
- }): BamlStream<partial_types.PartialRecipe, types.PartialRecipe>;
59
- ExtractData(instructions: string, screenshot: Image, domContent: string, includeClaudeSpoof: boolean, __baml_options__?: {
60
- tb?: TypeBuilder;
61
- clientRegistry?: ClientRegistry;
62
- collector?: Collector | Collector[];
63
- env?: Record<string, string | undefined>;
64
- }): BamlStream<partial_types.ExtractedData, types.ExtractedData>;
65
- QueryMemory(memory: types.AgentContext, query: string, includeClaudeSpoof: boolean, __baml_options__?: {
66
- tb?: TypeBuilder;
67
- clientRegistry?: ClientRegistry;
68
- collector?: Collector | Collector[];
69
- env?: Record<string, string | undefined>;
70
- }): BamlStream<partial_types.QueryResponse, types.QueryResponse>;
59
+ CreatePartialRecipe(memory: types.AgentContext, task: string, taskData: (Image | string)[], includeClaudeSpoof: boolean, __baml_options__?: BamlCallOptions<never>): BamlStream<partial_types.PartialRecipe, types.PartialRecipe>;
60
+ ExtractData(instructions: string, screenshot: Image, domContent: string, includeClaudeSpoof: boolean, __baml_options__?: BamlCallOptions<never>): BamlStream<partial_types.ExtractedData, types.ExtractedData>;
61
+ QueryMemory(memory: types.AgentContext, query: string, includeClaudeSpoof: boolean, __baml_options__?: BamlCallOptions<never>): BamlStream<partial_types.QueryResponse, types.QueryResponse>;
71
62
  }
72
63
  export declare const b: BamlAsyncClient;
73
64
  export {};