la-machina-engine 0.19.6 → 0.19.7

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/index.cjs CHANGED
@@ -2098,6 +2098,7 @@ var AnthropicClient = class {
2098
2098
  if (betas.length > 0) {
2099
2099
  requestOptions.headers = { "anthropic-beta": betas.join(",") };
2100
2100
  }
2101
+ if (request.abortSignal !== void 0) requestOptions.signal = request.abortSignal;
2101
2102
  let stream;
2102
2103
  try {
2103
2104
  stream = this.sdk.messages.stream(params, requestOptions);
@@ -2284,6 +2285,7 @@ var AISdkAdapter = class {
2284
2285
  tools,
2285
2286
  ...request.maxTokens !== void 0 ? { maxOutputTokens: request.maxTokens } : {},
2286
2287
  ...request.temperature !== void 0 ? { temperature: request.temperature } : {},
2288
+ ...request.abortSignal !== void 0 ? { abortSignal: request.abortSignal } : {},
2287
2289
  // Plan 025 — pass through `'required'` so the AI SDK forwards it
2288
2290
  // to the provider as that provider's "force tool call" flag.
2289
2291
  ...request.toolChoice === "required" ? { toolChoice: "required" } : {},
@@ -3305,6 +3307,9 @@ async function emitInspectTurn(args) {
3305
3307
  ...cacheRead !== void 0 ? { cacheReadInput: cacheRead } : {}
3306
3308
  });
3307
3309
  }
3310
+ function isAbortSignalAborted(signal) {
3311
+ return signal?.aborted === true;
3312
+ }
3308
3313
  var DEFAULT_COMPACTION = {
3309
3314
  strategy: "drop-middle",
3310
3315
  threshold: 0.85,
@@ -3457,6 +3462,7 @@ async function agentLoop(options) {
3457
3462
  messages: normalizedMessages,
3458
3463
  system,
3459
3464
  tools: anthropicTools,
3465
+ ...options.runSignal !== void 0 ? { abortSignal: options.runSignal } : {},
3460
3466
  ...escalatedMaxTokens !== void 0 ? { maxTokens: escalatedMaxTokens } : {},
3461
3467
  ...options.toolChoice !== void 0 ? { toolChoice: options.toolChoice } : {}
3462
3468
  })) {
@@ -3470,6 +3476,9 @@ async function agentLoop(options) {
3470
3476
  }
3471
3477
  }
3472
3478
  } catch (err) {
3479
+ if (isAbortSignalAborted(options.runSignal)) {
3480
+ return failed(new RunTimeoutError(options.runTimeoutMs ?? 0), transcript);
3481
+ }
3473
3482
  if (isPromptTooLong(err) && !compactedThisTurn) {
3474
3483
  compactedThisTurn = true;
3475
3484
  const emergency = await compactIfNeeded({