deepline 0.1.300 → 0.1.302

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 (37) hide show
  1. package/dist/bundling-sources/sdk/src/client.ts +8 -0
  2. package/dist/bundling-sources/sdk/src/errors.ts +57 -15
  3. package/dist/bundling-sources/sdk/src/http.ts +82 -5
  4. package/dist/bundling-sources/sdk/src/index.ts +4 -0
  5. package/dist/bundling-sources/sdk/src/play.ts +29 -1
  6. package/dist/bundling-sources/sdk/src/release.ts +5 -3
  7. package/dist/bundling-sources/shared_libs/play-runtime/context.ts +120 -14
  8. package/dist/bundling-sources/shared_libs/play-runtime/ctx-types.ts +10 -0
  9. package/dist/bundling-sources/shared_libs/play-runtime/durable-receipt-execution.ts +59 -11
  10. package/dist/bundling-sources/shared_libs/play-runtime/execution-ledger-store.ts +3 -3
  11. package/dist/bundling-sources/shared_libs/play-runtime/execution-plan.ts +0 -15
  12. package/dist/bundling-sources/shared_libs/play-runtime/protocol.ts +3 -0
  13. package/dist/bundling-sources/shared_libs/play-runtime/runtime-actions.ts +3 -0
  14. package/dist/bundling-sources/shared_libs/play-runtime/runtime-api.ts +136 -36
  15. package/dist/bundling-sources/shared_libs/play-runtime/runtime-receipt-store-adapter.ts +103 -0
  16. package/dist/bundling-sources/shared_libs/play-runtime/runtime-receipt-writer.ts +78 -5
  17. package/dist/bundling-sources/shared_libs/play-runtime/tool-execute-retry-policy.ts +17 -12
  18. package/dist/bundling-sources/shared_libs/play-runtime/tool-http-errors.ts +210 -5
  19. package/dist/bundling-sources/shared_libs/play-runtime/work-receipts.ts +4 -0
  20. package/dist/bundling-sources/shared_libs/plays/artifact-contract-version.ts +6 -0
  21. package/dist/bundling-sources/shared_libs/plays/artifact-types.ts +4 -0
  22. package/dist/bundling-sources/shared_libs/plays/bundling/index.ts +159 -12
  23. package/dist/bundling-sources/shared_libs/plays/contracts.ts +69 -1
  24. package/dist/bundling-sources/shared_libs/tool-execution-error.ts +428 -0
  25. package/dist/cli/index.js +501 -179
  26. package/dist/cli/index.mjs +501 -179
  27. package/dist/index.d.mts +39 -18
  28. package/dist/index.d.ts +39 -18
  29. package/dist/index.js +394 -59
  30. package/dist/index.mjs +391 -59
  31. package/dist/plays/bundle-play-file.d.mts +4 -2
  32. package/dist/plays/bundle-play-file.d.ts +4 -2
  33. package/dist/plays/bundle-play-file.mjs +116 -19
  34. package/dist/{compiler-manifest-BjopNIqx.d.mts → tool-execution-error-9mH4i-mJ.d.mts} +79 -1
  35. package/dist/{compiler-manifest-BjopNIqx.d.ts → tool-execution-error-9mH4i-mJ.d.ts} +79 -1
  36. package/package.json +1 -1
  37. package/dist/bundling-sources/shared_libs/play-runtime/completed-receipt-cache.ts +0 -166
package/dist/cli/index.js CHANGED
@@ -191,19 +191,252 @@ var import_node_fs = require("fs");
191
191
  var import_node_os = require("os");
192
192
  var import_node_path = require("path");
193
193
 
194
- // src/errors.ts
195
- var DeeplineError = class extends Error {
194
+ // ../shared_libs/tool-execution-error.ts
195
+ var DEEPLINE_ERROR_BRAND = /* @__PURE__ */ Symbol.for("deepline.error.v1");
196
+ var TOOL_EXECUTION_ERROR_BRAND = /* @__PURE__ */ Symbol.for(
197
+ "deepline.tool-execution-error.v1"
198
+ );
199
+ var PROVIDER_TRANSIENT_ERROR_BRAND = /* @__PURE__ */ Symbol.for(
200
+ "deepline.provider-transient-error.v1"
201
+ );
202
+ var LEGACY_TOOL_EXECUTION_ERROR_SCHEMA_VERSION = 0;
203
+ var TOOL_EXECUTION_ERROR_SCHEMA_VERSION = 1;
204
+ var TOOL_EXECUTION_ERROR_SCHEMA_HEADER = "x-deepline-tool-error-schema";
205
+ var MAX_IDENTIFIER_LENGTH = 200;
206
+ var MAX_CODE_LENGTH = 160;
207
+ function nativeInstanceOf(constructor, value) {
208
+ return Reflect.apply(Function.prototype[Symbol.hasInstance], constructor, [
209
+ value
210
+ ]);
211
+ }
212
+ function hasBrand(value, brand) {
213
+ return typeof value === "object" && value !== null && value[brand] === true;
214
+ }
215
+ function applyBrand(value, brand) {
216
+ if (hasBrand(value, brand)) return;
217
+ Object.defineProperty(value, brand, {
218
+ configurable: false,
219
+ enumerable: false,
220
+ writable: false,
221
+ value: true
222
+ });
223
+ }
224
+ var DeeplineError = class _DeeplineError extends Error {
196
225
  constructor(message, statusCode, code, details) {
197
226
  super(message);
198
227
  this.statusCode = statusCode;
199
228
  this.code = code;
200
229
  this.details = details;
201
230
  this.name = "DeeplineError";
231
+ applyBrand(this, DEEPLINE_ERROR_BRAND);
202
232
  }
203
233
  statusCode;
204
234
  code;
205
235
  details;
236
+ static [Symbol.hasInstance](value) {
237
+ if (this !== _DeeplineError) return nativeInstanceOf(this, value);
238
+ return hasBrand(value, DEEPLINE_ERROR_BRAND);
239
+ }
206
240
  };
241
+ var ToolExecutionError = class _ToolExecutionError extends DeeplineError {
242
+ toolId;
243
+ provider;
244
+ operation;
245
+ origin;
246
+ category;
247
+ retryable;
248
+ requestId;
249
+ retryAfterMs;
250
+ networkKind;
251
+ networkScope;
252
+ constructor(message, options) {
253
+ super(
254
+ message,
255
+ options.statusCode ?? void 0,
256
+ options.code ?? void 0,
257
+ options.details
258
+ );
259
+ this.name = "ToolExecutionError";
260
+ this.toolId = options.toolId;
261
+ this.provider = options.provider;
262
+ this.operation = options.operation;
263
+ this.origin = options.origin;
264
+ this.category = options.category;
265
+ this.retryable = options.retryable;
266
+ this.requestId = options.requestId;
267
+ this.retryAfterMs = options.retryAfterMs;
268
+ this.networkKind = options.networkKind;
269
+ this.networkScope = options.networkScope;
270
+ applyBrand(this, TOOL_EXECUTION_ERROR_BRAND);
271
+ if (isProviderTransientFailure(options)) {
272
+ applyBrand(this, PROVIDER_TRANSIENT_ERROR_BRAND);
273
+ }
274
+ }
275
+ static [Symbol.hasInstance](value) {
276
+ if (this !== _ToolExecutionError) return nativeInstanceOf(this, value);
277
+ return hasBrand(value, TOOL_EXECUTION_ERROR_BRAND);
278
+ }
279
+ };
280
+ function brandAsToolExecutionError(value) {
281
+ applyBrand(value, TOOL_EXECUTION_ERROR_BRAND);
282
+ }
283
+ function isProviderTransientFailure(input2) {
284
+ return input2.origin === "provider" && (input2.category === "rate_limit" || input2.category === "network" || input2.category === "upstream");
285
+ }
286
+ var ProviderTransientError = class _ProviderTransientError extends ToolExecutionError {
287
+ origin = "provider";
288
+ constructor(message, options) {
289
+ super(message, {
290
+ ...options,
291
+ origin: "provider",
292
+ category: options.category
293
+ });
294
+ this.name = "ProviderTransientError";
295
+ this.category = options.category;
296
+ applyBrand(this, PROVIDER_TRANSIENT_ERROR_BRAND);
297
+ }
298
+ static [Symbol.hasInstance](value) {
299
+ if (this !== _ProviderTransientError) return nativeInstanceOf(this, value);
300
+ return hasBrand(value, PROVIDER_TRANSIENT_ERROR_BRAND);
301
+ }
302
+ };
303
+ function brandAsProviderTransientError(value) {
304
+ applyBrand(value, PROVIDER_TRANSIENT_ERROR_BRAND);
305
+ }
306
+ function boundedString(value, maxLength = MAX_IDENTIFIER_LENGTH) {
307
+ if (typeof value !== "string") return null;
308
+ const normalized = value.trim();
309
+ return normalized ? normalized.slice(0, maxLength) : null;
310
+ }
311
+ function finiteNonNegativeInteger(value) {
312
+ return typeof value === "number" && Number.isFinite(value) && value >= 0 && Number.isInteger(value) ? value : null;
313
+ }
314
+ function normalizeToolExecutionOrigin(value, input2) {
315
+ const normalized = boundedString(value)?.toLowerCase();
316
+ if (normalized === "caller") return "caller";
317
+ if (normalized === "provider" || normalized === "provider_network") {
318
+ return "provider";
319
+ }
320
+ if (normalized === "upstream" && boundedString(input2?.provider) && boundedString(input2?.operation)) {
321
+ return "provider";
322
+ }
323
+ if (normalized === "deepline" || normalized === "deepline_billing" || normalized === "deepline_rate_limit" || normalized === "internal" || normalized === "server") {
324
+ return "deepline";
325
+ }
326
+ if (normalized === "provider_account") return "provider";
327
+ return "unknown";
328
+ }
329
+ function normalizeToolExecutionCategory(value) {
330
+ switch (boundedString(value)?.toLowerCase()) {
331
+ case "validation":
332
+ case "authorization":
333
+ case "rate_limit":
334
+ case "network":
335
+ case "upstream":
336
+ case "billing":
337
+ case "conflict":
338
+ case "internal":
339
+ return boundedString(value).toLowerCase();
340
+ case "authentication":
341
+ case "provider_auth":
342
+ case "provider_account":
343
+ return "authentication";
344
+ case "execution":
345
+ case "parse":
346
+ case "stub":
347
+ case "internal_native_search_performance":
348
+ return "internal";
349
+ default:
350
+ return "unknown";
351
+ }
352
+ }
353
+ function normalizeNetworkKind(value) {
354
+ switch (boundedString(value)?.toLowerCase()) {
355
+ case "timeout":
356
+ case "dns":
357
+ case "connect":
358
+ case "reset":
359
+ case "unavailable":
360
+ case "unknown":
361
+ return boundedString(value).toLowerCase();
362
+ default:
363
+ return null;
364
+ }
365
+ }
366
+ function normalizeNetworkScope(value) {
367
+ switch (boundedString(value)?.toLowerCase()) {
368
+ case "client_to_deepline":
369
+ case "runtime_to_deepline":
370
+ case "deepline_to_provider":
371
+ return boundedString(value).toLowerCase();
372
+ default:
373
+ return null;
374
+ }
375
+ }
376
+ function isRecord(value) {
377
+ return value !== null && typeof value === "object" && !Array.isArray(value);
378
+ }
379
+ function normalizeToolExecutionFailure(value) {
380
+ if (!isRecord(value) || value.schemaVersion !== TOOL_EXECUTION_ERROR_SCHEMA_VERSION) {
381
+ return null;
382
+ }
383
+ const toolId = boundedString(value.toolId);
384
+ if (!toolId) return null;
385
+ const provider = boundedString(value.provider);
386
+ const operation = boundedString(value.operation);
387
+ const origin = normalizeToolExecutionOrigin(value.origin, {
388
+ provider,
389
+ operation
390
+ });
391
+ const category = normalizeToolExecutionCategory(value.category);
392
+ const trustworthy = origin !== "unknown" && category !== "unknown" && typeof value.retryable === "boolean";
393
+ return {
394
+ schemaVersion: TOOL_EXECUTION_ERROR_SCHEMA_VERSION,
395
+ toolId,
396
+ provider,
397
+ operation,
398
+ code: boundedString(value.code, MAX_CODE_LENGTH),
399
+ origin,
400
+ category,
401
+ retryable: trustworthy ? value.retryable === true : false,
402
+ statusCode: finiteNonNegativeInteger(value.statusCode),
403
+ requestId: boundedString(value.requestId),
404
+ retryAfterMs: finiteNonNegativeInteger(value.retryAfterMs),
405
+ networkKind: normalizeNetworkKind(value.networkKind),
406
+ networkScope: normalizeNetworkScope(value.networkScope)
407
+ };
408
+ }
409
+ function serializeToolExecutionFailure(error) {
410
+ if (!(error instanceof ToolExecutionError)) return null;
411
+ return normalizeToolExecutionFailure({
412
+ schemaVersion: TOOL_EXECUTION_ERROR_SCHEMA_VERSION,
413
+ toolId: error.toolId,
414
+ provider: error.provider,
415
+ operation: error.operation,
416
+ code: error.code ?? null,
417
+ origin: error.origin,
418
+ category: error.category,
419
+ retryable: error.retryable,
420
+ statusCode: error.statusCode ?? null,
421
+ requestId: error.requestId,
422
+ retryAfterMs: error.retryAfterMs,
423
+ networkKind: error.networkKind,
424
+ networkScope: error.networkScope
425
+ });
426
+ }
427
+ function deserializeToolExecutionFailure(message, value, acceptedSchemaVersion) {
428
+ if (acceptedSchemaVersion === LEGACY_TOOL_EXECUTION_ERROR_SCHEMA_VERSION) {
429
+ return null;
430
+ }
431
+ const failure = normalizeToolExecutionFailure(value);
432
+ if (!failure) return null;
433
+ if (isProviderTransientFailure(failure)) {
434
+ return new ProviderTransientError(message, failure);
435
+ }
436
+ return new ToolExecutionError(message, failure);
437
+ }
438
+
439
+ // src/errors.ts
207
440
  var AuthError = class extends DeeplineError {
208
441
  constructor(message = "Authentication failed. Check your DEEPLINE_API_KEY.") {
209
442
  super(message, 401, "AUTH_ERROR");
@@ -223,6 +456,38 @@ var RateLimitError = class extends DeeplineError {
223
456
  this.retryAfterMs = retryAfterMs;
224
457
  }
225
458
  };
459
+ var ToolRateLimitError = class extends RateLimitError {
460
+ toolId;
461
+ provider;
462
+ operation;
463
+ code;
464
+ origin;
465
+ category;
466
+ retryable;
467
+ requestId;
468
+ networkKind;
469
+ networkScope;
470
+ constructor(message, options) {
471
+ super(options.retryAfterMs ?? 5e3, message);
472
+ this.name = "ToolRateLimitError";
473
+ this.statusCode = options.statusCode ?? 429;
474
+ this.code = options.code ?? void 0;
475
+ this.toolId = options.toolId;
476
+ this.provider = options.provider;
477
+ this.operation = options.operation;
478
+ this.origin = options.origin;
479
+ this.category = options.category;
480
+ this.retryable = options.retryable;
481
+ this.requestId = options.requestId;
482
+ this.networkKind = options.networkKind;
483
+ this.networkScope = options.networkScope;
484
+ this.details = options.details;
485
+ brandAsToolExecutionError(this);
486
+ if (isProviderTransientFailure(this)) {
487
+ brandAsProviderTransientError(this);
488
+ }
489
+ }
490
+ };
226
491
  var ConfigError = class extends DeeplineError {
227
492
  constructor(message) {
228
493
  super(message, void 0, "CONFIG_ERROR");
@@ -679,6 +944,9 @@ var import_node_fs2 = require("fs");
679
944
  var import_node_os3 = require("os");
680
945
  var import_node_path2 = require("path");
681
946
 
947
+ // ../shared_libs/plays/artifact-contract-version.ts
948
+ var CURRENT_PLAY_ARTIFACT_CONTRACT_VERSION = 2;
949
+
682
950
  // src/release.ts
683
951
  var SDK_RELEASE = {
684
952
  // 0.1.94 is claimed by PR #1527 — this watch-render fix ships as 0.1.95.
@@ -718,7 +986,7 @@ var SDK_RELEASE = {
718
986
  // 0.1.253 makes play-page browser opening opt-in and retires --no-open.
719
987
  // 0.1.254 removes the internal operations tree from the published SDK CLI.
720
988
  // Operators use the checkout-local deepline-admin binary instead.
721
- version: "0.1.300",
989
+ version: "0.1.302",
722
990
  contracts: {
723
991
  api: {
724
992
  name: "sdk-http-api",
@@ -734,8 +1002,8 @@ var SDK_RELEASE = {
734
1002
  },
735
1003
  playArtifact: {
736
1004
  name: "play-artifact-runtime",
737
- currentVersion: 2,
738
- supportedVersions: [1, 2]
1005
+ currentVersion: CURRENT_PLAY_ARTIFACT_CONTRACT_VERSION,
1006
+ supportedVersions: [1, CURRENT_PLAY_ARTIFACT_CONTRACT_VERSION]
739
1007
  },
740
1008
  release: {
741
1009
  name: "production-sdk-release",
@@ -967,6 +1235,9 @@ function providerLabelFromToolId(toolId) {
967
1235
  const provider = normalized.split(/[_:./-]+/)[0];
968
1236
  return provider || normalized || "provider";
969
1237
  }
1238
+ function isRecord2(value) {
1239
+ return value !== null && typeof value === "object" && !Array.isArray(value);
1240
+ }
970
1241
  var HttpClient = class {
971
1242
  constructor(config) {
972
1243
  this.config = config;
@@ -1102,6 +1373,29 @@ var HttpClient = class {
1102
1373
  signal: controller.signal
1103
1374
  });
1104
1375
  clearTimeout(timeoutId);
1376
+ const body = await response.text();
1377
+ const parsed = parseResponseBody(body);
1378
+ const structuredToolError = options?.toolId && !response.ok ? deserializeToolExecutionFailure(
1379
+ apiErrorMessage(parsed, response.status),
1380
+ isRecord2(parsed) ? parsed.tool_error : null,
1381
+ TOOL_EXECUTION_ERROR_SCHEMA_VERSION
1382
+ ) : null;
1383
+ if (structuredToolError) {
1384
+ if (response.status === 429) {
1385
+ const retryAfter = parseRetryAfter(response);
1386
+ const failure = serializeToolExecutionFailure(structuredToolError);
1387
+ lastError = failure === null ? structuredToolError : new ToolRateLimitError(structuredToolError.message, {
1388
+ ...failure,
1389
+ retryAfterMs: failure.retryAfterMs ?? Math.max(0, retryAfter)
1390
+ });
1391
+ if (attempt < maxRetries) {
1392
+ retryAfterDelayMs = retryAfter;
1393
+ break;
1394
+ }
1395
+ throw lastError;
1396
+ }
1397
+ throw structuredToolError;
1398
+ }
1105
1399
  if (response.status === 429) {
1106
1400
  const retryAfter = parseRetryAfter(response);
1107
1401
  lastError = new RateLimitError(retryAfter);
@@ -1111,8 +1405,6 @@ var HttpClient = class {
1111
1405
  }
1112
1406
  throw lastError;
1113
1407
  }
1114
- const body = await response.text();
1115
- const parsed = parseResponseBody(body);
1116
1408
  if (response.status === 401 && !isProviderOriginatedHttpError(parsed) || response.status === 403 && !options?.forbiddenAsApiError) {
1117
1409
  throw new AuthError();
1118
1410
  }
@@ -1177,6 +1469,29 @@ var HttpClient = class {
1177
1469
  lastError,
1178
1470
  describeRequestTarget(path)
1179
1471
  );
1472
+ if (options?.toolId) {
1473
+ const code = mappedNetworkError.code;
1474
+ throw new ToolExecutionError(
1475
+ withCoworkNetworkHint(mappedNetworkError.message),
1476
+ {
1477
+ toolId: options.toolId,
1478
+ provider: providerLabelFromToolId(options.toolId),
1479
+ operation: options.toolId,
1480
+ code,
1481
+ origin: "deepline",
1482
+ category: "network",
1483
+ // A direct client timeout has ambiguous delivery. Fail closed unless
1484
+ // the server returns the authoritative action delivery contract.
1485
+ retryable: false,
1486
+ statusCode: null,
1487
+ requestId: null,
1488
+ retryAfterMs: null,
1489
+ networkKind: code === "NETWORK_TIMEOUT" ? "timeout" : code === "NETWORK_ABORTED" ? "unknown" : "unavailable",
1490
+ networkScope: "client_to_deepline",
1491
+ details: mappedNetworkError.details
1492
+ }
1493
+ );
1494
+ }
1180
1495
  throw new DeeplineError(
1181
1496
  withCoworkNetworkHint(mappedNetworkError.message),
1182
1497
  void 0,
@@ -1618,11 +1933,11 @@ var RUNNER_POST_TERMINAL_DIAGNOSTIC_MAX_BYTES = 64 * 1024;
1618
1933
  var ledgerIngressRedactor = createSecretRedactionContext();
1619
1934
 
1620
1935
  // ../shared_libs/play-runtime/activity-observation.ts
1621
- function isRecord(value) {
1936
+ function isRecord3(value) {
1622
1937
  return Boolean(value && typeof value === "object" && !Array.isArray(value));
1623
1938
  }
1624
1939
  function isPlayActivityObservation(value) {
1625
- if (!isRecord(value) || value.schemaVersion !== 1 || typeof value.activityId !== "string" || !value.activityId.trim() || typeof value.observedAt !== "number" || !Number.isFinite(value.observedAt) || !isRecord(value.target) || !isRecord(value.state)) {
1940
+ if (!isRecord3(value) || value.schemaVersion !== 1 || typeof value.activityId !== "string" || !value.activityId.trim() || typeof value.observedAt !== "number" || !Number.isFinite(value.observedAt) || !isRecord3(value.target) || !isRecord3(value.state)) {
1626
1941
  return false;
1627
1942
  }
1628
1943
  const targetKinds = /* @__PURE__ */ new Set([
@@ -1887,7 +2202,7 @@ function projectPlayRunActivity(input2) {
1887
2202
 
1888
2203
  // ../shared_libs/play-runtime/run-ledger.ts
1889
2204
  var LOG_TAIL_LIMIT = 100;
1890
- function isRecord2(value) {
2205
+ function isRecord4(value) {
1891
2206
  return Boolean(value && typeof value === "object" && !Array.isArray(value));
1892
2207
  }
1893
2208
  function finiteNumber(value) {
@@ -1983,21 +2298,21 @@ function createEmptyPlayRunLedgerSnapshot(input2) {
1983
2298
  };
1984
2299
  }
1985
2300
  function normalizePlayRunLedgerSnapshot(value, fallback) {
1986
- if (!isRecord2(value)) {
2301
+ if (!isRecord4(value)) {
1987
2302
  return createEmptyPlayRunLedgerSnapshot(fallback);
1988
2303
  }
1989
2304
  const orderedStepIds = Array.isArray(value.orderedStepIds) ? value.orderedStepIds.filter(
1990
2305
  (entry) => typeof entry === "string" && Boolean(entry.trim())
1991
2306
  ) : [];
1992
- const rawSteps = isRecord2(value.stepsById) ? value.stepsById : {};
2307
+ const rawSteps = isRecord4(value.stepsById) ? value.stepsById : {};
1993
2308
  const stepsById = {};
1994
2309
  for (const [stepId, rawStep] of Object.entries(rawSteps)) {
1995
- if (!stepId.trim() || !isRecord2(rawStep)) continue;
2310
+ if (!stepId.trim() || !isRecord4(rawStep)) continue;
1996
2311
  const rawStatus = normalizeStepStatus(rawStep.status);
1997
2312
  if (!rawStatus) continue;
1998
2313
  const completedAt = finiteNumber(rawStep.completedAt);
1999
2314
  const status = rawStatus === "running" && completedAt !== null ? "completed" : rawStatus;
2000
- const rawProgress = isRecord2(rawStep.progress) ? rawStep.progress : null;
2315
+ const rawProgress = isRecord4(rawStep.progress) ? rawStep.progress : null;
2001
2316
  stepsById[stepId] = {
2002
2317
  stepId,
2003
2318
  label: optionalString(rawStep.label),
@@ -2013,10 +2328,10 @@ function normalizePlayRunLedgerSnapshot(value, fallback) {
2013
2328
  progress: rawProgress ? normalizeStepProgress(rawProgress) : null
2014
2329
  };
2015
2330
  }
2016
- const rawDatasets = isRecord2(value.datasetsById) ? value.datasetsById : {};
2331
+ const rawDatasets = isRecord4(value.datasetsById) ? value.datasetsById : {};
2017
2332
  const datasetsById = {};
2018
2333
  for (const [datasetId, rawDataset] of Object.entries(rawDatasets)) {
2019
- if (!datasetId.trim() || !isRecord2(rawDataset)) continue;
2334
+ if (!datasetId.trim() || !isRecord4(rawDataset)) continue;
2020
2335
  const phase = rawDataset.phase === "available" || rawDataset.phase === "failed" ? rawDataset.phase : "registered";
2021
2336
  datasetsById[datasetId] = {
2022
2337
  datasetId,
@@ -2030,7 +2345,7 @@ function normalizePlayRunLedgerSnapshot(value, fallback) {
2030
2345
  updatedAt: finiteNumber(rawDataset.updatedAt) ?? 0
2031
2346
  };
2032
2347
  }
2033
- const rawActivities = isRecord2(value.activitiesById) ? value.activitiesById : {};
2348
+ const rawActivities = isRecord4(value.activitiesById) ? value.activitiesById : {};
2034
2349
  const activitiesById = {};
2035
2350
  for (const [activityId, rawActivity] of Object.entries(rawActivities)) {
2036
2351
  if (activityId.trim() && isPlayActivityObservation(rawActivity) && rawActivity.activityId === activityId) {
@@ -2179,18 +2494,18 @@ function normalizePlayRunLiveStatus(value) {
2179
2494
  function isTerminalPlayRunLiveStatus(status) {
2180
2495
  return isTerminalPlayRunLifecycleStatus(status);
2181
2496
  }
2182
- function isRecord3(value) {
2497
+ function isRecord5(value) {
2183
2498
  return Boolean(value && typeof value === "object" && !Array.isArray(value));
2184
2499
  }
2185
2500
  function finiteNumber2(value) {
2186
2501
  return typeof value === "number" && Number.isFinite(value) ? value : null;
2187
2502
  }
2188
2503
  function extractTerminalRunLogTail(result) {
2189
- if (!isRecord3(result) || !isRecord3(result._metadata)) {
2504
+ if (!isRecord5(result) || !isRecord5(result._metadata)) {
2190
2505
  return null;
2191
2506
  }
2192
2507
  const runLogTail = result._metadata.runLogTail;
2193
- if (!isRecord3(runLogTail) || !Array.isArray(runLogTail.tail)) {
2508
+ if (!isRecord5(runLogTail) || !Array.isArray(runLogTail.tail)) {
2194
2509
  return null;
2195
2510
  }
2196
2511
  const logTail = runLogTail.tail.filter(
@@ -3084,7 +3399,7 @@ function resolveToolExecuteTimeoutMs(toolId, input2) {
3084
3399
  }
3085
3400
  var RUNS_FAILED_LOG_LIMIT = 20;
3086
3401
  var RUN_LOGS_PAGE_LIMIT = 1e3;
3087
- function isRecord4(value) {
3402
+ function isRecord6(value) {
3088
3403
  return Boolean(value && typeof value === "object" && !Array.isArray(value));
3089
3404
  }
3090
3405
  function isPrebuiltPlayDescription(play) {
@@ -3247,7 +3562,7 @@ function updatePlayLiveStatusState(state, event) {
3247
3562
  }
3248
3563
  const runId = typeof payload.runId === "string" && payload.runId ? payload.runId : isPlayRunPackage(payload) ? payload.run.id : state.runId;
3249
3564
  const status = normalizeLiveStatus(payload.status) ?? (isPlayRunPackage(payload) ? normalizeLiveStatus(payload.run.status) : null) ?? state.status;
3250
- const progressPayload = isRecord4(payload.progress) ? payload.progress : {};
3565
+ const progressPayload = isRecord6(payload.progress) ? payload.progress : {};
3251
3566
  if (event.type === "play.run.final_status" && state.logs.length === 0 && state.lastLogSeq === 0) {
3252
3567
  const payloadLogs = readStringArray(payload.logs);
3253
3568
  const progressLogs = readStringArray(progressPayload.logs);
@@ -3381,9 +3696,9 @@ var DeeplineClient = class {
3381
3696
  return fields.length > 0 ? { fields } : schema;
3382
3697
  }
3383
3698
  schemaMetadata(schema, key) {
3384
- if (!isRecord4(schema)) return null;
3699
+ if (!isRecord6(schema)) return null;
3385
3700
  const value = schema[key];
3386
- return isRecord4(value) ? value : null;
3701
+ return isRecord6(value) ? value : null;
3387
3702
  }
3388
3703
  playRunCommand(play, options) {
3389
3704
  const target = play.reference || play.name;
@@ -3432,7 +3747,7 @@ var DeeplineClient = class {
3432
3747
  aliases,
3433
3748
  inputSchema: options?.compact ? this.compactSchema(play.inputSchema) : play.inputSchema ?? null,
3434
3749
  outputSchema: options?.compact ? this.compactSchema(play.outputSchema) : play.outputSchema ?? null,
3435
- staticPipeline: isRecord4(play.staticPipeline) ? play.staticPipeline : isRecord4(play.currentRevision?.staticPipeline) ? play.currentRevision.staticPipeline : isRecord4(play.liveRevision?.staticPipeline) ? play.liveRevision.staticPipeline : null,
3750
+ staticPipeline: isRecord6(play.staticPipeline) ? play.staticPipeline : isRecord6(play.currentRevision?.staticPipeline) ? play.currentRevision.staticPipeline : isRecord6(play.liveRevision?.staticPipeline) ? play.liveRevision.staticPipeline : null,
3436
3751
  ...csvInput ? { csvInput } : {},
3437
3752
  ...rowOutputSchema ? { rowOutputSchema } : {},
3438
3753
  runCommand: runCommand2,
@@ -3603,6 +3918,9 @@ var DeeplineClient = class {
3603
3918
  async executeTool(toolId, input2, options) {
3604
3919
  const headers = {
3605
3920
  [EXECUTE_RESPONSE_CONTRACT_HEADER]: V2_EXECUTE_RESPONSE_CONTRACT,
3921
+ [TOOL_EXECUTION_ERROR_SCHEMA_HEADER]: String(
3922
+ TOOL_EXECUTION_ERROR_SCHEMA_VERSION
3923
+ ),
3606
3924
  ...options?.includeToolMetadata ? { [INCLUDE_TOOL_METADATA_HEADER]: "true" } : {},
3607
3925
  [EXECUTE_RESPONSE_INTENT_HEADER]: options?.responseIntent ?? "raw"
3608
3926
  };
@@ -3617,7 +3935,8 @@ var DeeplineClient = class {
3617
3935
  forbiddenAsApiError: true,
3618
3936
  timeout: options?.timeout ?? resolveToolExecuteTimeoutMs(toolId, input2),
3619
3937
  maxRetries: options?.maxRetries ?? 0,
3620
- exactUrlOnly: true
3938
+ exactUrlOnly: true,
3939
+ toolId
3621
3940
  }
3622
3941
  );
3623
3942
  }
@@ -8278,14 +8597,14 @@ function sanitizeCsvProjectionInfo(input2) {
8278
8597
  const rows = input2.rows.map(stripCsvProjectionFields);
8279
8598
  return { rows, columns };
8280
8599
  }
8281
- function isRecord5(value) {
8600
+ function isRecord7(value) {
8282
8601
  return Boolean(value && typeof value === "object" && !Array.isArray(value));
8283
8602
  }
8284
8603
  function isSerializedDataset(value) {
8285
- return isRecord5(value) && value.kind === "dataset" && typeof value.count === "number" && (Array.isArray(value.preview) || typeof value.tableNamespace === "string");
8604
+ return isRecord7(value) && value.kind === "dataset" && typeof value.count === "number" && (Array.isArray(value.preview) || typeof value.tableNamespace === "string");
8286
8605
  }
8287
8606
  function isPackagedDatasetOutput(value) {
8288
- return isRecord5(value) && value.kind === "dataset" && isRecord5(value.preview) && Array.isArray(value.preview.rows);
8607
+ return isRecord7(value) && value.kind === "dataset" && isRecord7(value.preview) && Array.isArray(value.preview.rows);
8289
8608
  }
8290
8609
  function pathParts(path) {
8291
8610
  return path.split(".").map((part) => part.trim()).filter(Boolean);
@@ -8293,7 +8612,7 @@ function pathParts(path) {
8293
8612
  function valueAtPath(root, path) {
8294
8613
  let cursor = root;
8295
8614
  for (const part of pathParts(path)) {
8296
- if (!isRecord5(cursor)) {
8615
+ if (!isRecord7(cursor)) {
8297
8616
  return void 0;
8298
8617
  }
8299
8618
  cursor = cursor[part];
@@ -8301,17 +8620,17 @@ function valueAtPath(root, path) {
8301
8620
  return cursor;
8302
8621
  }
8303
8622
  function totalRowsForDataset(result, datasetPath) {
8304
- const metadata = isRecord5(result._metadata) ? result._metadata : null;
8623
+ const metadata = isRecord7(result._metadata) ? result._metadata : null;
8305
8624
  const parentPath = datasetPath.split(".").slice(0, -1).join(".");
8306
8625
  const parent = parentPath ? valueAtPath({ result }, parentPath) : result;
8307
- return metadata?.totalRows ?? metadata?.rowCount ?? metadata?.count ?? (isRecord5(parent) ? parent.totalRows ?? parent.rowCount ?? parent.count : void 0) ?? result.totalRows ?? result.rowCount ?? result.count;
8626
+ return metadata?.totalRows ?? metadata?.rowCount ?? metadata?.count ?? (isRecord7(parent) ? parent.totalRows ?? parent.rowCount ?? parent.count : void 0) ?? result.totalRows ?? result.rowCount ?? result.count;
8308
8627
  }
8309
8628
  function rowArray(value) {
8310
8629
  if (!Array.isArray(value)) {
8311
8630
  return null;
8312
8631
  }
8313
8632
  const rows = value.filter(
8314
- (row) => isRecord5(row)
8633
+ (row) => isRecord7(row)
8315
8634
  );
8316
8635
  return rows.length === value.length ? rows : null;
8317
8636
  }
@@ -8335,7 +8654,7 @@ function inferColumns(rows) {
8335
8654
  return columns;
8336
8655
  }
8337
8656
  function columnsFromDatasetSummary(summary) {
8338
- if (!isRecord5(summary) || !isRecord5(summary.columnStats)) {
8657
+ if (!isRecord7(summary) || !isRecord7(summary.columnStats)) {
8339
8658
  return [];
8340
8659
  }
8341
8660
  return Object.keys(summary.columnStats).filter((column) => column);
@@ -8383,7 +8702,7 @@ function canonicalRowsInfoFromCandidate(input2) {
8383
8702
  datasetId: typeof candidate.value.datasetId === "string" ? candidate.value.datasetId : null,
8384
8703
  tableNamespace: typeof candidate.value.tableNamespace === "string" ? candidate.value.tableNamespace : null,
8385
8704
  ...candidate.value.recovered === true ? { recovered: true } : {},
8386
- ...isRecord5(candidate.value.exportUnavailable) && (candidate.value.exportUnavailable.reason === "empty_dataset" || candidate.value.exportUnavailable.reason === "shared_table_namespace") ? {
8705
+ ...isRecord7(candidate.value.exportUnavailable) && (candidate.value.exportUnavailable.reason === "empty_dataset" || candidate.value.exportUnavailable.reason === "shared_table_namespace") ? {
8387
8706
  exportUnavailableReason: candidate.value.exportUnavailable.reason,
8388
8707
  ...typeof candidate.value.exportUnavailable.message === "string" ? {
8389
8708
  exportUnavailableMessage: candidate.value.exportUnavailable.message
@@ -8431,7 +8750,7 @@ function collectDatasetCandidates(input2) {
8431
8750
  });
8432
8751
  return;
8433
8752
  }
8434
- if (!isRecord5(input2.value)) {
8753
+ if (!isRecord7(input2.value)) {
8435
8754
  return;
8436
8755
  }
8437
8756
  for (const [key, child] of Object.entries(input2.value)) {
@@ -8448,12 +8767,12 @@ function collectDatasetCandidates(input2) {
8448
8767
  }
8449
8768
  }
8450
8769
  function collectCanonicalRowsInfos(statusOrResult) {
8451
- const root = isRecord5(statusOrResult) ? statusOrResult : null;
8452
- const result = isRecord5(root?.result) ? root.result : root;
8770
+ const root = isRecord7(statusOrResult) ? statusOrResult : null;
8771
+ const result = isRecord7(root?.result) ? root.result : root;
8453
8772
  if (!result) {
8454
8773
  return [];
8455
8774
  }
8456
- const metadata = isRecord5(result._metadata) ? result._metadata : null;
8775
+ const metadata = isRecord7(result._metadata) ? result._metadata : null;
8457
8776
  const totalFromMetadata = metadata?.totalRows ?? metadata?.rowCount ?? metadata?.count;
8458
8777
  const candidates = [
8459
8778
  {
@@ -8477,8 +8796,8 @@ function collectCanonicalRowsInfos(statusOrResult) {
8477
8796
  total: totalFromMetadata ?? result.totalRows ?? result.rowCount ?? result.count
8478
8797
  }
8479
8798
  ];
8480
- if (isRecord5(result.output)) {
8481
- const outputMetadata = isRecord5(result.output._metadata) ? result.output._metadata : null;
8799
+ if (isRecord7(result.output)) {
8800
+ const outputMetadata = isRecord7(result.output._metadata) ? result.output._metadata : null;
8482
8801
  const outputTotalFromMetadata = outputMetadata?.totalRows ?? outputMetadata?.rowCount ?? outputMetadata?.count;
8483
8802
  candidates.push(
8484
8803
  {
@@ -8505,14 +8824,14 @@ function collectCanonicalRowsInfos(statusOrResult) {
8505
8824
  }
8506
8825
  if (Array.isArray(result.steps)) {
8507
8826
  result.steps.forEach((step, index) => {
8508
- if (!isRecord5(step) || !isRecord5(step.output)) {
8827
+ if (!isRecord7(step) || !isRecord7(step.output)) {
8509
8828
  return;
8510
8829
  }
8511
8830
  const source = typeof step.output.path === "string" ? step.output.path : typeof step.id === "string" ? `steps.${step.id}.output` : `steps.${index}.output`;
8512
8831
  candidates.push({
8513
8832
  source,
8514
8833
  value: step.output,
8515
- total: step.output.rowCount ?? (isRecord5(step.output.preview) ? step.output.preview.totalRows : void 0) ?? (isRecord5(step.progress) ? step.progress.total : void 0)
8834
+ total: step.output.rowCount ?? (isRecord7(step.output.preview) ? step.output.preview.totalRows : void 0) ?? (isRecord7(step.progress) ? step.progress.total : void 0)
8516
8835
  });
8517
8836
  });
8518
8837
  }
@@ -8540,15 +8859,15 @@ function collectCanonicalRowsInfos(statusOrResult) {
8540
8859
  return infos;
8541
8860
  }
8542
8861
  function collectPackagedDatasetCandidates(statusOrResult) {
8543
- const root = isRecord5(statusOrResult) ? statusOrResult : null;
8862
+ const root = isRecord7(statusOrResult) ? statusOrResult : null;
8544
8863
  if (!root) {
8545
8864
  return [];
8546
8865
  }
8547
- const pkg = isRecord5(root.package) ? root.package : root;
8866
+ const pkg = isRecord7(root.package) ? root.package : root;
8548
8867
  const datasets = Array.isArray(pkg.datasets) ? pkg.datasets : [];
8549
8868
  const candidates = [];
8550
8869
  for (const output2 of datasets) {
8551
- if (!isRecord5(output2) || !isPackagedDatasetOutput(output2)) {
8870
+ if (!isRecord7(output2) || !isPackagedDatasetOutput(output2)) {
8552
8871
  continue;
8553
8872
  }
8554
8873
  const source = typeof output2.path === "string" && output2.path.trim() ? output2.path.trim() : null;
@@ -8558,18 +8877,18 @@ function collectPackagedDatasetCandidates(statusOrResult) {
8558
8877
  candidates.push({
8559
8878
  source,
8560
8879
  value: output2,
8561
- total: output2.rowCount ?? (isRecord5(output2.preview) ? output2.preview.totalRows : void 0)
8880
+ total: output2.rowCount ?? (isRecord7(output2.preview) ? output2.preview.totalRows : void 0)
8562
8881
  });
8563
8882
  }
8564
8883
  return candidates;
8565
8884
  }
8566
8885
  function collectPackagedStepDatasetCandidates(statusOrResult) {
8567
- const root = isRecord5(statusOrResult) ? statusOrResult : null;
8886
+ const root = isRecord7(statusOrResult) ? statusOrResult : null;
8568
8887
  if (!root) return [];
8569
- const pkg = isRecord5(root.package) ? root.package : root;
8888
+ const pkg = isRecord7(root.package) ? root.package : root;
8570
8889
  const steps = Array.isArray(pkg.steps) ? pkg.steps : [];
8571
8890
  return steps.flatMap((step) => {
8572
- if (!isRecord5(step) || !isPackagedDatasetOutput(step.output)) return [];
8891
+ if (!isRecord7(step) || !isPackagedDatasetOutput(step.output)) return [];
8573
8892
  const source = typeof step.output.path === "string" && step.output.path.trim() ? step.output.path.trim() : null;
8574
8893
  return source ? [
8575
8894
  {
@@ -8581,8 +8900,8 @@ function collectPackagedStepDatasetCandidates(statusOrResult) {
8581
8900
  });
8582
8901
  }
8583
8902
  function collectSerializedDatasetRowsInfos(statusOrResult) {
8584
- const root = isRecord5(statusOrResult) ? statusOrResult : null;
8585
- const result = isRecord5(root?.result) ? root.result : root;
8903
+ const root = isRecord7(statusOrResult) ? statusOrResult : null;
8904
+ const result = isRecord7(root?.result) ? root.result : root;
8586
8905
  const candidates = [];
8587
8906
  if (result) {
8588
8907
  collectDatasetCandidates({
@@ -8590,7 +8909,7 @@ function collectSerializedDatasetRowsInfos(statusOrResult) {
8590
8909
  path: "result",
8591
8910
  output: candidates
8592
8911
  });
8593
- if (isRecord5(result.output)) {
8912
+ if (isRecord7(result.output)) {
8594
8913
  collectDatasetCandidates({
8595
8914
  value: result.output,
8596
8915
  path: "result",
@@ -8668,13 +8987,13 @@ function summarizeSampleValue(value, depth = 0) {
8668
8987
  if (typeof parsed === "number" || typeof parsed === "boolean") return parsed;
8669
8988
  if (depth >= 3) {
8670
8989
  if (Array.isArray(parsed)) return [];
8671
- if (isRecord5(parsed)) return {};
8990
+ if (isRecord7(parsed)) return {};
8672
8991
  return compactScalar(parsed);
8673
8992
  }
8674
8993
  if (Array.isArray(parsed)) {
8675
8994
  return parsed.slice(0, 3).map((item) => summarizeSampleValue(item, depth + 1));
8676
8995
  }
8677
- if (isRecord5(parsed)) {
8996
+ if (isRecord7(parsed)) {
8678
8997
  const out = {};
8679
8998
  for (const [key, nested] of Object.entries(parsed)) {
8680
8999
  if (["__dl", "meta", "metadata"].includes(key)) {
@@ -8705,7 +9024,7 @@ function compactCell(value) {
8705
9024
  }
8706
9025
  return `[${parsed.length} items]`;
8707
9026
  }
8708
- if (isRecord5(parsed)) {
9027
+ if (isRecord7(parsed)) {
8709
9028
  for (const key of ["matched_result", "output"]) {
8710
9029
  if (parsed[key] !== null && parsed[key] !== void 0 && parsed[key] !== "") {
8711
9030
  return compactCell(parsed[key]);
@@ -9770,17 +10089,17 @@ function parsePositiveInteger2(value, flagName) {
9770
10089
  }
9771
10090
  return parsed;
9772
10091
  }
9773
- function isRecord6(value) {
10092
+ function isRecord8(value) {
9774
10093
  return Boolean(value && typeof value === "object" && !Array.isArray(value));
9775
10094
  }
9776
10095
  function stringValue(value) {
9777
10096
  return typeof value === "string" ? value.trim() : "";
9778
10097
  }
9779
10098
  function extractionEntries(value) {
9780
- if (Array.isArray(value)) return value.filter(isRecord6);
9781
- if (!isRecord6(value)) return [];
10099
+ if (Array.isArray(value)) return value.filter(isRecord8);
10100
+ if (!isRecord8(value)) return [];
9782
10101
  return Object.entries(value).map(
9783
- ([name, entry]) => isRecord6(entry) ? { name, ...entry } : { name }
10102
+ ([name, entry]) => isRecord8(entry) ? { name, ...entry } : { name }
9784
10103
  );
9785
10104
  }
9786
10105
  var PlayBootstrapError = class extends Error {
@@ -10342,7 +10661,7 @@ function readCsvSampleRows(sample) {
10342
10661
  relax_column_count: true,
10343
10662
  trim: true
10344
10663
  });
10345
- return Array.isArray(parsedRows) ? parsedRows.filter(isRecord6) : [];
10664
+ return Array.isArray(parsedRows) ? parsedRows.filter(isRecord8) : [];
10346
10665
  }
10347
10666
  function readSourceCsvColumnSpecs(csvPath) {
10348
10667
  const sample = readCsvSample(csvPath);
@@ -10375,16 +10694,16 @@ function packagedCsvPathForPlay(csvPath) {
10375
10694
  return portablePath.startsWith(".") ? portablePath : `./${portablePath}`;
10376
10695
  }
10377
10696
  function getterNamesFromTool(tool, kind) {
10378
- const usageGuidance = isRecord6(tool?.usageGuidance) ? tool.usageGuidance : {};
10379
- const resultGuidance = isRecord6(usageGuidance.toolExecutionResult) ? usageGuidance.toolExecutionResult : isRecord6(usageGuidance.tool_execution_result) ? usageGuidance.tool_execution_result : {};
10697
+ const usageGuidance = isRecord8(tool?.usageGuidance) ? tool.usageGuidance : {};
10698
+ const resultGuidance = isRecord8(usageGuidance.toolExecutionResult) ? usageGuidance.toolExecutionResult : isRecord8(usageGuidance.tool_execution_result) ? usageGuidance.tool_execution_result : {};
10380
10699
  const key = kind === "list" ? "extractedLists" : "extractedValues";
10381
10700
  const snakeKey = kind === "list" ? "extracted_lists" : "extracted_values";
10382
10701
  return extractionEntries(resultGuidance[key] ?? resultGuidance[snakeKey]).map((entry) => stringValue(entry.name)).filter(Boolean);
10383
10702
  }
10384
10703
  function targetGettersFromTool(tool) {
10385
- const record = isRecord6(tool) ? tool : {};
10704
+ const record = isRecord8(tool) ? tool : {};
10386
10705
  const raw = record.targetGetters ?? record.target_getters;
10387
- if (!isRecord6(raw)) return {};
10706
+ if (!isRecord8(raw)) return {};
10388
10707
  const entries = [];
10389
10708
  for (const [target, value] of Object.entries(raw)) {
10390
10709
  const paths = Array.isArray(value) ? value.map((path) => typeof path === "string" ? path.trim() : "").filter(Boolean) : [];
@@ -10405,10 +10724,10 @@ function listRowCandidateKeysFromTool(tool) {
10405
10724
  return [...keys].sort();
10406
10725
  }
10407
10726
  function inputPropertyNames(schema) {
10408
- if (!isRecord6(schema)) return [];
10409
- if (isRecord6(schema.properties)) return Object.keys(schema.properties);
10727
+ if (!isRecord8(schema)) return [];
10728
+ if (isRecord8(schema.properties)) return Object.keys(schema.properties);
10410
10729
  if (Array.isArray(schema.fields)) {
10411
- return schema.fields.filter(isRecord6).map((field) => stringValue(field.name)).filter(Boolean);
10730
+ return schema.fields.filter(isRecord8).map((field) => stringValue(field.name)).filter(Boolean);
10412
10731
  }
10413
10732
  return [];
10414
10733
  }
@@ -10422,7 +10741,7 @@ function schemaFieldDetails(schema) {
10422
10741
  return { required, optional };
10423
10742
  }
10424
10743
  function jsonSchemaTypeExpression(schema) {
10425
- if (!isRecord6(schema)) return "unknown";
10744
+ if (!isRecord8(schema)) return "unknown";
10426
10745
  const type = schema.type;
10427
10746
  if (Array.isArray(type)) {
10428
10747
  return type.map((entry) => jsonSchemaTypeExpression({ ...schema, type: entry })).join(" | ");
@@ -10452,7 +10771,7 @@ function jsonSchemaTypeExpression(schema) {
10452
10771
  }
10453
10772
  }
10454
10773
  function objectPropertySchema(schema, property) {
10455
- return isRecord6(schema) && isRecord6(schema.properties) ? schema.properties[property] : null;
10774
+ return isRecord8(schema) && isRecord8(schema.properties) ? schema.properties[property] : null;
10456
10775
  }
10457
10776
  function playOutputHasField(schema, field) {
10458
10777
  return objectPropertySchema(schema, field) != null;
@@ -10628,14 +10947,14 @@ ${indent2.slice(2)}}`;
10628
10947
  }
10629
10948
  function requiredPlayInputFields(play) {
10630
10949
  const schema = play?.inputSchema;
10631
- if (!isRecord6(schema)) return [];
10950
+ if (!isRecord8(schema)) return [];
10632
10951
  if (Array.isArray(schema.required)) {
10633
10952
  return schema.required.filter(
10634
10953
  (value) => typeof value === "string"
10635
10954
  );
10636
10955
  }
10637
10956
  if (Array.isArray(schema.fields)) {
10638
- return schema.fields.filter(isRecord6).filter(
10957
+ return schema.fields.filter(isRecord8).filter(
10639
10958
  (field) => field.required === true && typeof field.name === "string"
10640
10959
  ).map((field) => String(field.name));
10641
10960
  }
@@ -10816,7 +11135,7 @@ function validateBootstrapRoutes(input2) {
10816
11135
  }
10817
11136
  }
10818
11137
  function staticPipelineSubsteps(pipeline) {
10819
- if (!isRecord6(pipeline)) return [];
11138
+ if (!isRecord8(pipeline)) return [];
10820
11139
  return [
10821
11140
  ...extractionEntries(pipeline.stages),
10822
11141
  ...extractionEntries(pipeline.substeps)
@@ -10824,7 +11143,7 @@ function staticPipelineSubsteps(pipeline) {
10824
11143
  }
10825
11144
  function playUsesMapBackedRuntime(play) {
10826
11145
  const pipeline = play?.staticPipeline;
10827
- if (!isRecord6(pipeline)) return false;
11146
+ if (!isRecord8(pipeline)) return false;
10828
11147
  if (stringValue(pipeline.tableNamespace)) return true;
10829
11148
  return staticPipelineSubsteps(pipeline).some((substep) => {
10830
11149
  if (stringValue(substep.type) === "map") return true;
@@ -10833,7 +11152,7 @@ function playUsesMapBackedRuntime(play) {
10833
11152
  aliases: [],
10834
11153
  runCommand: "",
10835
11154
  examples: [],
10836
- staticPipeline: isRecord6(substep.pipeline) ? substep.pipeline : null
11155
+ staticPipeline: isRecord8(substep.pipeline) ? substep.pipeline : null
10837
11156
  });
10838
11157
  });
10839
11158
  }
@@ -15571,7 +15890,7 @@ function extractPlayValidationErrors(value) {
15571
15890
  if (value instanceof DeeplineError) {
15572
15891
  return extractPlayValidationErrors(value.details);
15573
15892
  }
15574
- if (!isRecord7(value)) {
15893
+ if (!isRecord9(value)) {
15575
15894
  return [];
15576
15895
  }
15577
15896
  const directErrors = stringArrayField(value, "errors");
@@ -16011,7 +16330,7 @@ function shouldUseLocalOnlyPlayCheck() {
16011
16330
  const value = process.env.DEEPLINE_PLAY_CHECK_LOCAL_ONLY?.trim().toLowerCase();
16012
16331
  return value === "1" || value === "true" || value === "yes" || value === "on";
16013
16332
  }
16014
- function isRecord7(value) {
16333
+ function isRecord9(value) {
16015
16334
  return Boolean(value && typeof value === "object" && !Array.isArray(value));
16016
16335
  }
16017
16336
  function stringValue2(value) {
@@ -16021,14 +16340,14 @@ function asArray(value) {
16021
16340
  return Array.isArray(value) ? value : [];
16022
16341
  }
16023
16342
  function extractionEntries2(value) {
16024
- if (Array.isArray(value)) return value.filter(isRecord7);
16025
- if (!isRecord7(value)) return [];
16343
+ if (Array.isArray(value)) return value.filter(isRecord9);
16344
+ if (!isRecord9(value)) return [];
16026
16345
  return Object.entries(value).map(
16027
- ([name, entry]) => isRecord7(entry) ? { name, ...entry } : { name }
16346
+ ([name, entry]) => isRecord9(entry) ? { name, ...entry } : { name }
16028
16347
  );
16029
16348
  }
16030
16349
  function firstRawPath(entry) {
16031
- const details = isRecord7(entry.details) ? entry.details : {};
16350
+ const details = isRecord9(entry.details) ? entry.details : {};
16032
16351
  const paths = [
16033
16352
  ...asArray(details.rawToolOutputPaths),
16034
16353
  ...asArray(details.raw_tool_output_paths),
@@ -16046,12 +16365,12 @@ function checkHintRawPath(value) {
16046
16365
  function collectStaticPipelineToolIds(staticPipeline) {
16047
16366
  const seen = /* @__PURE__ */ new Set();
16048
16367
  const visitPipeline = (pipeline) => {
16049
- if (!isRecord7(pipeline)) return;
16368
+ if (!isRecord9(pipeline)) return;
16050
16369
  for (const step of [
16051
16370
  ...asArray(pipeline.stages),
16052
16371
  ...asArray(pipeline.substeps)
16053
16372
  ]) {
16054
- if (!isRecord7(step)) continue;
16373
+ if (!isRecord9(step)) continue;
16055
16374
  if (step.type === "tool") {
16056
16375
  const toolId = stringValue2(step.toolId) || stringValue2(step.tool);
16057
16376
  if (toolId) seen.add(toolId);
@@ -16065,9 +16384,9 @@ function collectStaticPipelineToolIds(staticPipeline) {
16065
16384
  return [...seen].sort();
16066
16385
  }
16067
16386
  function toolGetterHintFromMetadata(toolId, tool) {
16068
- const usageGuidance = isRecord7(tool.usageGuidance) ? tool.usageGuidance : {};
16069
- const resultGuidance = isRecord7(usageGuidance.toolExecutionResult) ? usageGuidance.toolExecutionResult : isRecord7(usageGuidance.tool_execution_result) ? usageGuidance.tool_execution_result : {};
16070
- const toolResponse = isRecord7(resultGuidance.toolResponse) ? resultGuidance.toolResponse : isRecord7(resultGuidance.tool_response) ? resultGuidance.tool_response : {};
16387
+ const usageGuidance = isRecord9(tool.usageGuidance) ? tool.usageGuidance : {};
16388
+ const resultGuidance = isRecord9(usageGuidance.toolExecutionResult) ? usageGuidance.toolExecutionResult : isRecord9(usageGuidance.tool_execution_result) ? usageGuidance.tool_execution_result : {};
16389
+ const toolResponse = isRecord9(resultGuidance.toolResponse) ? resultGuidance.toolResponse : isRecord9(resultGuidance.tool_response) ? resultGuidance.tool_response : {};
16071
16390
  const lists = extractionEntries2(
16072
16391
  resultGuidance.extractedLists ?? resultGuidance.extracted_lists
16073
16392
  ).map((entry) => ({
@@ -19454,6 +19773,9 @@ function compileEnrichConfigToPlaySource(config, options = {}) {
19454
19773
  const inlineTypeImports = [
19455
19774
  ...new Set(inlineHandlers.flatMap((inline) => inline.typeImports ?? []))
19456
19775
  ].sort();
19776
+ const inlineRuntimeImports = [
19777
+ ...new Set(inlineHandlers.flatMap((inline) => inline.runtimeImports ?? []))
19778
+ ].sort();
19457
19779
  config.commands.forEach((command) => {
19458
19780
  if (isWaterfall(command)) {
19459
19781
  columnSteps.push(
@@ -19529,7 +19851,7 @@ function compileEnrichConfigToPlaySource(config, options = {}) {
19529
19851
  const typeImports = idiomaticGetters ? inlineTypeImports : [.../* @__PURE__ */ new Set([...inlineTypeImports, "DeeplinePlayRuntimeContext"])].sort();
19530
19852
  return [
19531
19853
  ...inlineRunJavascript && configHasRunJavascript(config) ? ["// @ts-nocheck", "/* eslint-disable */", ""] : [],
19532
- `import { definePlay, steps } from 'deepline';`,
19854
+ `import { ${["definePlay", "steps", ...inlineRuntimeImports].join(", ")} } from 'deepline';`,
19533
19855
  ...typeImports.length > 0 ? [`import type { ${typeImports.join(", ")} } from 'deepline';`] : [],
19534
19856
  ``,
19535
19857
  `type EnrichInput = { file: string; rowStart?: number | null; rowEnd?: number | null };`,
@@ -20345,7 +20667,7 @@ function isMarkedTestAiInferenceCommand(command) {
20345
20667
  if (normalizeEnrichPlayRef(command.tool) !== "run_javascript") {
20346
20668
  return false;
20347
20669
  }
20348
- return isRecord8(command.payload) && command.payload[ENRICH_TEST_AI_INFERENCE_PAYLOAD_MARKER] === true;
20670
+ return isRecord10(command.payload) && command.payload[ENRICH_TEST_AI_INFERENCE_PAYLOAD_MARKER] === true;
20349
20671
  }
20350
20672
  function enrichDebugEnabled(env = process.env) {
20351
20673
  const raw = String(env.DEEPLINE_DEBUG_ENRICH ?? "").trim().toLowerCase();
@@ -20609,7 +20931,7 @@ function rewriteGeneratedPlayRerunForEnrich(status, enrichCommand) {
20609
20931
  if (Array.isArray(value)) {
20610
20932
  return value.map(rewrite);
20611
20933
  }
20612
- if (!isRecord8(value)) {
20934
+ if (!isRecord10(value)) {
20613
20935
  return value;
20614
20936
  }
20615
20937
  const next = Object.fromEntries(
@@ -20618,7 +20940,7 @@ function rewriteGeneratedPlayRerunForEnrich(status, enrichCommand) {
20618
20940
  key === "rerunCommand" && typeof entry === "string" ? enrichCommand : rewrite(entry)
20619
20941
  ])
20620
20942
  );
20621
- if (isRecord8(next.next) && typeof next.next.run === "string") {
20943
+ if (isRecord10(next.next) && typeof next.next.run === "string") {
20622
20944
  next.next = { ...next.next, run: enrichCommand };
20623
20945
  }
20624
20946
  return next;
@@ -21089,7 +21411,7 @@ async function resolveWatchedGeneratedPlayStatus(input2) {
21089
21411
  }
21090
21412
  return input2.client.runs.get(runId, { full: true });
21091
21413
  }
21092
- function isRecord8(value) {
21414
+ function isRecord10(value) {
21093
21415
  return Boolean(value && typeof value === "object" && !Array.isArray(value));
21094
21416
  }
21095
21417
  async function captureStdout(run, options = {}) {
@@ -21341,15 +21663,15 @@ function readFirstEnrichDatasetActions(value) {
21341
21663
  return null;
21342
21664
  }
21343
21665
  const record = candidate;
21344
- const actions = isRecord8(record.actions) ? record.actions : null;
21345
- const currentQuery = isRecord8(actions?.queryCurrentTable) ? actions.queryCurrentTable : null;
21346
- const legacyQuery = isRecord8(actions?.query) ? actions.query : null;
21666
+ const actions = isRecord10(record.actions) ? record.actions : null;
21667
+ const currentQuery = isRecord10(actions?.queryCurrentTable) ? actions.queryCurrentTable : null;
21668
+ const legacyQuery = isRecord10(actions?.query) ? actions.query : null;
21347
21669
  const query = currentQuery?.kind === "deepline_db_query" ? currentQuery : legacyQuery?.kind === "deepline_db_query" ? legacyQuery : null;
21348
21670
  if (query?.kind === "deepline_db_query") {
21349
21671
  return {
21350
21672
  dataset: record,
21351
21673
  query,
21352
- ...isRecord8(actions?.exportCsv) ? { exportCsv: actions.exportCsv } : {}
21674
+ ...isRecord10(actions?.exportCsv) ? { exportCsv: actions.exportCsv } : {}
21353
21675
  };
21354
21676
  }
21355
21677
  if (options.allowLegacy && record.kind === "dataset" && typeof record.queryDatasetCommand === "string" && record.queryDatasetCommand.trim()) {
@@ -21402,7 +21724,7 @@ function enrichCustomerDbJson(input2) {
21402
21724
  const dataset = actions.dataset;
21403
21725
  const sql = actionStringField(query, "sql") ?? parseSqlFromDbQueryCommand(actions.queryDatasetCommand);
21404
21726
  const datasetPath = actionStringField(query, "datasetPath") ?? actionStringField(dataset, "path") ?? actionStringField(dataset, "tableNamespace");
21405
- const api = isRecord8(query.api) ? query.api : null;
21727
+ const api = isRecord10(query.api) ? query.api : null;
21406
21728
  const apiPath = actionStringField(api ?? {}, "path") ?? "/api/v2/db/query";
21407
21729
  const apiMethod = actionStringField(api ?? {}, "method") ?? "POST";
21408
21730
  if (!datasetPath) {
@@ -21471,11 +21793,11 @@ function sqlStringLiteral(value) {
21471
21793
  return `'${value.replace(/'/g, "''")}'`;
21472
21794
  }
21473
21795
  function failureAliasFromCellMeta(cellMeta) {
21474
- if (!isRecord8(cellMeta)) {
21796
+ if (!isRecord10(cellMeta)) {
21475
21797
  return null;
21476
21798
  }
21477
21799
  for (const [alias, meta] of Object.entries(cellMeta)) {
21478
- if (!isRecord8(meta)) {
21800
+ if (!isRecord10(meta)) {
21479
21801
  continue;
21480
21802
  }
21481
21803
  const failure = failureCellFromMeta(meta, {});
@@ -21968,7 +22290,7 @@ function exportableSheetRow2(row, sourceRowStart = 0) {
21968
22290
  return fallback;
21969
22291
  }
21970
22292
  function failureCellFromMeta(meta, fallback) {
21971
- if (!isRecord8(meta)) {
22293
+ if (!isRecord10(meta)) {
21972
22294
  return null;
21973
22295
  }
21974
22296
  const status = typeof meta.status === "string" ? meta.status.trim().toLowerCase() : "";
@@ -21988,7 +22310,7 @@ function failureCellFromMeta(meta, fallback) {
21988
22310
  };
21989
22311
  }
21990
22312
  function applyFailureCellMeta(row, cellMeta, fallback) {
21991
- if (!isRecord8(cellMeta)) {
22313
+ if (!isRecord10(cellMeta)) {
21992
22314
  return;
21993
22315
  }
21994
22316
  for (const [field, meta] of Object.entries(cellMeta)) {
@@ -22216,7 +22538,7 @@ function stableRowSnapshot(value) {
22216
22538
  }
22217
22539
  function cellFailureError(value) {
22218
22540
  const parsed = parseMaybeJsonObject(value);
22219
- if (!isRecord8(parsed)) {
22541
+ if (!isRecord10(parsed)) {
22220
22542
  const text = typeof parsed === "string" ? parsed.trim() : "";
22221
22543
  if (/^(?:[A-Za-z0-9_:-]+:\s*)?(?:Error|TypeError|ReferenceError|SyntaxError|RangeError):\s+/.test(
22222
22544
  text
@@ -22224,12 +22546,12 @@ function cellFailureError(value) {
22224
22546
  return { message: text };
22225
22547
  }
22226
22548
  }
22227
- if (!isRecord8(parsed)) {
22549
+ if (!isRecord10(parsed)) {
22228
22550
  return null;
22229
22551
  }
22230
22552
  const status = typeof parsed.status === "string" ? parsed.status.trim().toLowerCase() : "";
22231
22553
  const directError = typeof parsed.error === "string" ? parsed.error.trim() : typeof parsed.last_error === "string" ? parsed.last_error.trim() : "";
22232
- const result = isRecord8(parsed.result) ? parsed.result : null;
22554
+ const result = isRecord10(parsed.result) ? parsed.result : null;
22233
22555
  const resultError = typeof result?.error === "string" ? result.error.trim() : typeof result?.message === "string" ? result.message.trim() : "";
22234
22556
  if (!directError && !resultError && status !== "error" && status !== "failed") {
22235
22557
  return null;
@@ -22299,7 +22621,7 @@ function assignFlattenedFailurePath(target, field, value) {
22299
22621
  let cursor = target;
22300
22622
  for (const part of normalized.slice(0, -1)) {
22301
22623
  const existing = cursor[part];
22302
- if (!isRecord8(existing)) {
22624
+ if (!isRecord10(existing)) {
22303
22625
  const next = {};
22304
22626
  cursor[part] = next;
22305
22627
  cursor = next;
@@ -22463,10 +22785,10 @@ function waterfallExecutionSignal(status, spec) {
22463
22785
  let everyChildStatOnlyConditionSkipped = true;
22464
22786
  const childAliasesWithStats = /* @__PURE__ */ new Set();
22465
22787
  for (const childAlias of childAliases) {
22466
- for (const stat2 of summaries.map((summary) => summary[childAlias]).filter(isRecord8)) {
22788
+ for (const stat2 of summaries.map((summary) => summary[childAlias]).filter(isRecord10)) {
22467
22789
  sawChildStats = true;
22468
22790
  childAliasesWithStats.add(childAlias);
22469
- const execution = isRecord8(stat2.execution) ? stat2.execution : null;
22791
+ const execution = isRecord10(stat2.execution) ? stat2.execution : null;
22470
22792
  const executedSummary = parseExecutionSummary(
22471
22793
  execution?.["completed:executed"]
22472
22794
  );
@@ -22496,7 +22818,7 @@ function waterfallExecutionSignal(status, spec) {
22496
22818
  }
22497
22819
  function emptyWaterfallStatsEvidence(status, spec) {
22498
22820
  const summaries = collectColumnStats(status);
22499
- const parentStats = summaries.map((summary) => summary[spec.alias]).filter(isRecord8);
22821
+ const parentStats = summaries.map((summary) => summary[spec.alias]).filter(isRecord10);
22500
22822
  for (const stat2 of parentStats) {
22501
22823
  const nonEmpty = parseExecutionSummary(stat2.non_empty);
22502
22824
  if (nonEmpty?.total && nonEmpty.count === 0) {
@@ -22510,7 +22832,7 @@ function emptyWaterfallStatsEvidence(status, spec) {
22510
22832
  let selectedRows = 0;
22511
22833
  let sawStatsForEveryChild = true;
22512
22834
  for (const childAlias of childAliases) {
22513
- const stat2 = summaries.map((summary) => summary[childAlias]).find(isRecord8);
22835
+ const stat2 = summaries.map((summary) => summary[childAlias]).find(isRecord10);
22514
22836
  if (!stat2) {
22515
22837
  sawStatsForEveryChild = false;
22516
22838
  break;
@@ -22519,7 +22841,7 @@ function emptyWaterfallStatsEvidence(status, spec) {
22519
22841
  if ((nonEmpty?.count ?? 0) > 0) {
22520
22842
  return null;
22521
22843
  }
22522
- const execution = isRecord8(stat2.execution) ? stat2.execution : null;
22844
+ const execution = isRecord10(stat2.execution) ? stat2.execution : null;
22523
22845
  const executed = parseExecutionSummary(execution?.["completed:executed"]);
22524
22846
  const reused = parseExecutionSummary(execution?.["completed:reused"]);
22525
22847
  const skipped = parseExecutionSummary(execution?.["skipped:condition"]);
@@ -22561,11 +22883,11 @@ function collectStatusFailureJobs(input2) {
22561
22883
  const jobs = [];
22562
22884
  aliases.forEach((spec, aliasIndex) => {
22563
22885
  const { alias } = spec;
22564
- const stat2 = summaries.map((summary) => summary[alias]).find(isRecord8);
22886
+ const stat2 = summaries.map((summary) => summary[alias]).find(isRecord10);
22565
22887
  if (!stat2) {
22566
22888
  return;
22567
22889
  }
22568
- const execution = isRecord8(stat2.execution) ? stat2.execution : null;
22890
+ const execution = isRecord10(stat2.execution) ? stat2.execution : null;
22569
22891
  const failedCount = Math.min(
22570
22892
  selectedRows,
22571
22893
  Math.max(
@@ -22672,10 +22994,10 @@ function collectColumnStats(status) {
22672
22994
  value.forEach(visit);
22673
22995
  return;
22674
22996
  }
22675
- if (!isRecord8(value)) {
22997
+ if (!isRecord10(value)) {
22676
22998
  return;
22677
22999
  }
22678
- if (isRecord8(value.columnStats)) {
23000
+ if (isRecord10(value.columnStats)) {
22679
23001
  summaries.push(value.columnStats);
22680
23002
  }
22681
23003
  Object.values(value).forEach(visit);
@@ -22687,12 +23009,12 @@ function firstAliasExecutionCounts(input2) {
22687
23009
  const aliases = collectConfigScalarAliasOrder(input2.config);
22688
23010
  const summaries = collectColumnStats(input2.status);
22689
23011
  for (const alias of aliases) {
22690
- const stat2 = summaries.map((summary) => summary[alias]).find(isRecord8);
23012
+ const stat2 = summaries.map((summary) => summary[alias]).find(isRecord10);
22691
23013
  if (!stat2) continue;
22692
23014
  if (input2.forceAliases.has(normalizeAlias2(alias))) {
22693
23015
  return { executed: input2.selectedRows, reused: 0 };
22694
23016
  }
22695
- const execution = isRecord8(stat2.execution) ? stat2.execution : null;
23017
+ const execution = isRecord10(stat2.execution) ? stat2.execution : null;
22696
23018
  if (!execution) continue;
22697
23019
  return {
22698
23020
  executed: parseExecutionCount(execution["completed:executed"]),
@@ -22719,14 +23041,14 @@ function rewriteEnrichJsonStatus(input2) {
22719
23041
  if (Array.isArray(value)) {
22720
23042
  return value.map(rewrite);
22721
23043
  }
22722
- if (!isRecord8(value)) {
23044
+ if (!isRecord10(value)) {
22723
23045
  return value;
22724
23046
  }
22725
23047
  const next = {};
22726
23048
  for (const [key, entry] of Object.entries(value)) {
22727
23049
  next[key] = rewrite(entry);
22728
23050
  }
22729
- if (isRecord8(next.progress)) {
23051
+ if (isRecord10(next.progress)) {
22730
23052
  next.progress = {
22731
23053
  ...next.progress,
22732
23054
  ...selectedRows > 0 ? { total: selectedRows } : {},
@@ -22735,8 +23057,8 @@ function rewriteEnrichJsonStatus(input2) {
22735
23057
  ...failedRows > 0 ? { failed: failedRows, pending: 0 } : {}
22736
23058
  };
22737
23059
  }
22738
- if (isRecord8(next.summary)) {
22739
- const rowCounts = isRecord8(next.summary.rowCounts) ? next.summary.rowCounts : null;
23060
+ if (isRecord10(next.summary)) {
23061
+ const rowCounts = isRecord10(next.summary.rowCounts) ? next.summary.rowCounts : null;
22740
23062
  if (failedRows > 0) {
22741
23063
  next.summary = {
22742
23064
  ...next.summary,
@@ -22749,11 +23071,11 @@ function rewriteEnrichJsonStatus(input2) {
22749
23071
  };
22750
23072
  }
22751
23073
  }
22752
- if (isRecord8(next.columnStats) && selectedRows > 0) {
23074
+ if (isRecord10(next.columnStats) && selectedRows > 0) {
22753
23075
  const columnStats = { ...next.columnStats };
22754
23076
  for (const alias of forcedAliases) {
22755
- const stat2 = isRecord8(columnStats[alias]) ? columnStats[alias] : null;
22756
- const execution = isRecord8(stat2?.execution) ? stat2.execution : null;
23077
+ const stat2 = isRecord10(columnStats[alias]) ? columnStats[alias] : null;
23078
+ const execution = isRecord10(stat2?.execution) ? stat2.execution : null;
22757
23079
  if (!stat2 || !execution) continue;
22758
23080
  columnStats[alias] = {
22759
23081
  ...stat2,
@@ -22772,14 +23094,14 @@ function rewriteEnrichJsonStatus(input2) {
22772
23094
  return next;
22773
23095
  };
22774
23096
  const rewritten = rewrite(input2.status);
22775
- if (failedRows === 0 || !isRecord8(rewritten)) {
23097
+ if (failedRows === 0 || !isRecord10(rewritten)) {
22776
23098
  return rewritten;
22777
23099
  }
22778
23100
  const partialStatus = selectedRows > 0 && failedRows < selectedRows ? "partial_success" : "failed";
22779
23101
  return {
22780
23102
  ...rewritten,
22781
23103
  ...rewritten.status === "completed" || rewritten.status === "failed" ? { status: partialStatus } : {},
22782
- ...isRecord8(rewritten.run) && (rewritten.run.status === "completed" || rewritten.run.status === "failed") ? { run: { ...rewritten.run, status: partialStatus } } : {}
23104
+ ...isRecord10(rewritten.run) && (rewritten.run.status === "completed" || rewritten.run.status === "failed") ? { run: { ...rewritten.run, status: partialStatus } } : {}
22783
23105
  };
22784
23106
  }
22785
23107
  function summarizeFailedJobError(value) {
@@ -23385,7 +23707,7 @@ function materializeCsvCellValue(value) {
23385
23707
  return value;
23386
23708
  }
23387
23709
  function compactArrayEnvelopeCompleteValue(value) {
23388
- if (!isRecord8(value) || value.kind !== "array") {
23710
+ if (!isRecord10(value) || value.kind !== "array") {
23389
23711
  return null;
23390
23712
  }
23391
23713
  if (!Array.isArray(value.preview)) {
@@ -23399,7 +23721,7 @@ function compactArrayEnvelopeCompleteValue(value) {
23399
23721
  }
23400
23722
  function disambiguateCompactAiInferencePayload(value) {
23401
23723
  const parsed = parseMaybeJsonObject(value);
23402
- if (!isRecord8(parsed) || !cellFailureError(parsed)) {
23724
+ if (!isRecord10(parsed) || !cellFailureError(parsed)) {
23403
23725
  return value;
23404
23726
  }
23405
23727
  return {
@@ -23408,14 +23730,14 @@ function disambiguateCompactAiInferencePayload(value) {
23408
23730
  };
23409
23731
  }
23410
23732
  function compactAiInferenceCellForCsv(value) {
23411
- if (!isRecord8(value)) {
23733
+ if (!isRecord10(value)) {
23412
23734
  return value;
23413
23735
  }
23414
23736
  const extractedJson = value.extracted_json;
23415
23737
  if (extractedJson !== null && extractedJson !== void 0) {
23416
23738
  return disambiguateCompactAiInferencePayload(extractedJson);
23417
23739
  }
23418
- const result = isRecord8(value.result) ? value.result : null;
23740
+ const result = isRecord10(value.result) ? value.result : null;
23419
23741
  const object = result?.object;
23420
23742
  if (object !== null && object !== void 0) {
23421
23743
  return disambiguateCompactAiInferencePayload(object);
@@ -23432,12 +23754,12 @@ function compactAiInferenceCellForCsv(value) {
23432
23754
  }
23433
23755
  function materializeEnrichAliasCellForCsv(row, alias, options) {
23434
23756
  const direct = row[alias];
23435
- if (isRecord8(direct)) {
23757
+ if (isRecord10(direct)) {
23436
23758
  const completeArray = compactArrayEnvelopeCompleteValue(direct);
23437
23759
  if (completeArray) {
23438
23760
  return materializeCsvCellValue(completeArray);
23439
23761
  }
23440
- if (options?.compactAiCell && direct.status === "completed" && (isRecord8(direct.result) || Object.prototype.hasOwnProperty.call(direct, "extracted_json") || typeof direct.output === "string")) {
23762
+ if (options?.compactAiCell && direct.status === "completed" && (isRecord10(direct.result) || Object.prototype.hasOwnProperty.call(direct, "extracted_json") || typeof direct.output === "string")) {
23441
23763
  return materializeCsvCellValue(compactAiInferenceCellForCsv(direct));
23442
23764
  }
23443
23765
  if (Object.prototype.hasOwnProperty.call(direct, "matched_result") || Object.prototype.hasOwnProperty.call(direct, "matchedResult") || Object.prototype.hasOwnProperty.call(direct, "result")) {
@@ -23578,11 +23900,11 @@ function normalizeEnrichRowsForCsvExport(rows, config, options) {
23578
23900
  }
23579
23901
  function legacyMetadataFromRow(row) {
23580
23902
  const direct = parseLegacyMetadataCell(row._metadata);
23581
- if (direct && isRecord8(direct.columns)) {
23903
+ if (direct && isRecord10(direct.columns)) {
23582
23904
  return direct;
23583
23905
  }
23584
23906
  const relocated = parseLegacyMetadataCell(row.metadata);
23585
- if (relocated && isRecord8(relocated.columns)) {
23907
+ if (relocated && isRecord10(relocated.columns)) {
23586
23908
  return relocated;
23587
23909
  }
23588
23910
  const flattenedColumns = parseLegacyMetadataCell(row["metadata.columns"]);
@@ -23599,7 +23921,7 @@ function legacyMetadataFromRow(row) {
23599
23921
  }
23600
23922
  function parseLegacyMetadataCell(value) {
23601
23923
  const parsed = parseMaybeJsonObject(value);
23602
- if (isRecord8(parsed)) {
23924
+ if (isRecord10(parsed)) {
23603
23925
  return parsed;
23604
23926
  }
23605
23927
  if (typeof value !== "string") {
@@ -23616,12 +23938,12 @@ function parseLegacyMetadataCell(value) {
23616
23938
  for (const candidate of candidates) {
23617
23939
  try {
23618
23940
  const decoded = JSON.parse(candidate);
23619
- if (isRecord8(decoded)) {
23941
+ if (isRecord10(decoded)) {
23620
23942
  return decoded;
23621
23943
  }
23622
23944
  if (typeof decoded === "string") {
23623
23945
  const nested = JSON.parse(decoded);
23624
- if (isRecord8(nested)) {
23946
+ if (isRecord10(nested)) {
23625
23947
  return nested;
23626
23948
  }
23627
23949
  }
@@ -23631,8 +23953,8 @@ function parseLegacyMetadataCell(value) {
23631
23953
  return null;
23632
23954
  }
23633
23955
  function mergeLegacyMetadataRecords(base, enriched) {
23634
- const baseColumns = isRecord8(base.columns) ? base.columns : null;
23635
- const enrichedColumns = isRecord8(enriched.columns) ? enriched.columns : null;
23956
+ const baseColumns = isRecord10(base.columns) ? base.columns : null;
23957
+ const enrichedColumns = isRecord10(enriched.columns) ? enriched.columns : null;
23636
23958
  const merged = {
23637
23959
  ...base,
23638
23960
  ...enriched
@@ -28067,7 +28389,7 @@ function toolContractJsonForDescribe(tool, requestedToolId) {
28067
28389
  }
28068
28390
  function extractionContractEntries(entries) {
28069
28391
  return entries.flatMap((entry) => {
28070
- if (!isRecord9(entry)) return [];
28392
+ if (!isRecord11(entry)) return [];
28071
28393
  const name = stringField2(entry, "name");
28072
28394
  const expression = stringField2(entry, "expression");
28073
28395
  return name && expression ? [{ name, expression }] : [];
@@ -28088,7 +28410,7 @@ function printMonitorTypeFilters(tool) {
28088
28410
  }
28089
28411
  console.log("Deploy filters (set in the monitor payload):");
28090
28412
  for (const name of names) {
28091
- const field = isRecord9(properties[name]) ? properties[name] : {};
28413
+ const field = isRecord11(properties[name]) ? properties[name] : {};
28092
28414
  const star = required.has(name) ? "*" : "";
28093
28415
  const enumVals = arrayField2(field, "enum").filter(
28094
28416
  (v) => typeof v === "string"
@@ -28100,14 +28422,14 @@ function printMonitorTypeFilters(tool) {
28100
28422
  }
28101
28423
  function printMonitorTypeStreams(tool) {
28102
28424
  const streams = arrayField2(tool, "streams", "output_streams").filter(
28103
- isRecord9
28425
+ isRecord11
28104
28426
  );
28105
28427
  if (!streams.length) return;
28106
28428
  console.log("");
28107
28429
  console.log("Filter columns (a play's sqlListeners.where, per stream):");
28108
28430
  for (const stream of streams) {
28109
28431
  const name = stringField2(stream, "stream");
28110
- const cols = arrayField2(stream, "columns").filter(isRecord9).map((col) => stringField2(col, "name")).filter(Boolean);
28432
+ const cols = arrayField2(stream, "columns").filter(isRecord11).map((col) => stringField2(col, "name")).filter(Boolean);
28111
28433
  console.log(`- ${name}: ${cols.join(", ")}`);
28112
28434
  }
28113
28435
  }
@@ -28125,7 +28447,7 @@ function printMonitorTypePricing(tool) {
28125
28447
  }
28126
28448
  console.log("Pricing (Deepline credits per accepted event):");
28127
28449
  for (const key of keys) {
28128
- const entry = isRecord9(byType[key]) ? byType[key] : {};
28450
+ const entry = isRecord11(byType[key]) ? byType[key] : {};
28129
28451
  const credits = numberField2(entry, "deepline_credits", "deeplineCredits");
28130
28452
  const display = stringField2(entry, "display");
28131
28453
  const shown = display || (credits !== null ? `${formatDecimal(credits)} credits/event` : "see --json");
@@ -28170,8 +28492,8 @@ function printCompactToolContract(tool, requestedToolId) {
28170
28492
  return;
28171
28493
  }
28172
28494
  const contract = toolContractJsonForDescribe(tool, requestedToolId);
28173
- const cost = isRecord9(contract.cost) ? contract.cost : {};
28174
- const getters = isRecord9(contract.getters) ? contract.getters : {};
28495
+ const cost = isRecord11(contract.cost) ? contract.cost : {};
28496
+ const getters = isRecord11(contract.getters) ? contract.getters : {};
28175
28497
  const listGetters = Array.isArray(getters.extractedLists) ? getters.extractedLists : [];
28176
28498
  const valueGetters = Array.isArray(getters.extractedValues) ? getters.extractedValues : [];
28177
28499
  const inputFields = recursiveToolInputFieldsForDisplay(
@@ -28190,7 +28512,7 @@ function printCompactToolContract(tool, requestedToolId) {
28190
28512
  console.log("");
28191
28513
  console.log("Inputs:");
28192
28514
  for (const field of inputFields) {
28193
- if (!isRecord9(field)) continue;
28515
+ if (!isRecord11(field)) continue;
28194
28516
  const name = stringField2(field, "name");
28195
28517
  if (!name) continue;
28196
28518
  const required = field.required ? "*" : "";
@@ -28209,7 +28531,7 @@ function printCompactToolContract(tool, requestedToolId) {
28209
28531
  }
28210
28532
  console.log("");
28211
28533
  printToolExamplesOnly(tool, requestedToolId, { includeSamples: false });
28212
- const starterScript = isRecord9(contract.starterScript) ? contract.starterScript : {};
28534
+ const starterScript = isRecord11(contract.starterScript) ? contract.starterScript : {};
28213
28535
  const starterPath = stringField2(starterScript, "path");
28214
28536
  if (starterPath) {
28215
28537
  console.log("");
@@ -28223,14 +28545,14 @@ function printCompactToolContract(tool, requestedToolId) {
28223
28545
  console.log("Getters:");
28224
28546
  if (listGetters.length) console.log("Lists:");
28225
28547
  for (const entry of listGetters) {
28226
- if (isRecord9(entry))
28548
+ if (isRecord11(entry))
28227
28549
  console.log(
28228
28550
  `- ${stringField2(entry, "name")}: ${playResultExpression(entry)}`
28229
28551
  );
28230
28552
  }
28231
28553
  if (valueGetters.length) console.log("Values:");
28232
28554
  for (const entry of valueGetters) {
28233
- if (isRecord9(entry))
28555
+ if (isRecord11(entry))
28234
28556
  console.log(
28235
28557
  `- ${stringField2(entry, "name")}: ${playResultExpression(entry)}`
28236
28558
  );
@@ -28247,7 +28569,7 @@ function printToolPricingOnly(tool, requestedToolId, options = {}) {
28247
28569
  return;
28248
28570
  }
28249
28571
  const contract = toolContractJsonForDescribe(tool, requestedToolId);
28250
- const cost = isRecord9(contract.cost) ? contract.cost : {};
28572
+ const cost = isRecord11(contract.cost) ? contract.cost : {};
28251
28573
  const pricingModel = stringField2(cost, "pricingModel") || "unknown";
28252
28574
  const billingMode = stringField2(cost, "billingMode") || "unknown";
28253
28575
  const unit = pricingModel === "per_page" ? "page" : pricingModel === "per_result" ? "result" : pricingModel === "fixed" ? "call" : pricingModel.replace(/^per_/, "") || "unit";
@@ -28319,10 +28641,10 @@ function printToolExamplesOnly(tool, requestedToolId, options = {}) {
28319
28641
  ` input: ${JSON.stringify(sampleInput || {}, null, 2).replace(/\n/g, "\n ")},`
28320
28642
  );
28321
28643
  console.log("});");
28322
- const getters = isRecord9(contract.getters) ? contract.getters : {};
28644
+ const getters = isRecord11(contract.getters) ? contract.getters : {};
28323
28645
  const valueGetters = Array.isArray(getters.extractedValues) ? getters.extractedValues : [];
28324
28646
  const listGetters = Array.isArray(getters.extractedLists) ? getters.extractedLists : [];
28325
- const firstGetter = [...valueGetters, ...listGetters].find(isRecord9);
28647
+ const firstGetter = [...valueGetters, ...listGetters].find(isRecord11);
28326
28648
  if (firstGetter) {
28327
28649
  const name = stringField2(firstGetter, "name") || "value";
28328
28650
  const expression = stringField2(firstGetter, "expression");
@@ -28358,7 +28680,7 @@ function printPlayLikeToolUsage(tool, requestedToolId) {
28358
28680
  }
28359
28681
  function printToolGettersOnly(tool, requestedToolId) {
28360
28682
  const contract = toolContractJsonForDescribe(tool, requestedToolId);
28361
- const getters = isRecord9(contract.getters) ? contract.getters : {};
28683
+ const getters = isRecord11(contract.getters) ? contract.getters : {};
28362
28684
  const listGetters = Array.isArray(getters.extractedLists) ? getters.extractedLists : [];
28363
28685
  const valueGetters = Array.isArray(getters.extractedValues) ? getters.extractedValues : [];
28364
28686
  console.log(`Getters: ${contract.toolId}`);
@@ -28371,7 +28693,7 @@ function printToolGettersOnly(tool, requestedToolId) {
28371
28693
  if (listGetters.length) {
28372
28694
  console.log("Lists:");
28373
28695
  for (const entry of listGetters) {
28374
- if (isRecord9(entry))
28696
+ if (isRecord11(entry))
28375
28697
  console.log(
28376
28698
  `- ${stringField2(entry, "name")}: ${playResultExpression(entry)}`
28377
28699
  );
@@ -28380,7 +28702,7 @@ function printToolGettersOnly(tool, requestedToolId) {
28380
28702
  if (valueGetters.length) {
28381
28703
  console.log("Values:");
28382
28704
  for (const entry of valueGetters) {
28383
- if (isRecord9(entry))
28705
+ if (isRecord11(entry))
28384
28706
  console.log(
28385
28707
  `- ${stringField2(entry, "name")}: ${playResultExpression(entry)}`
28386
28708
  );
@@ -28406,7 +28728,7 @@ function sampleValueForField(field) {
28406
28728
  function samplePayloadForInputFields(fields) {
28407
28729
  return Object.fromEntries(
28408
28730
  fields.slice(0, 4).flatMap((field) => {
28409
- if (!isRecord9(field)) return [];
28731
+ if (!isRecord11(field)) return [];
28410
28732
  const name = stringField2(field, "name");
28411
28733
  if (!name) return [];
28412
28734
  return [[name, sampleValueForField(field)]];
@@ -28524,12 +28846,12 @@ function formatListedToolCost(tool) {
28524
28846
  }
28525
28847
  function toolInputFieldsForDisplay(inputSchema) {
28526
28848
  if (Array.isArray(inputSchema.fields))
28527
- return inputSchema.fields.filter(isRecord9);
28528
- const jsonSchema = isRecord9(inputSchema.jsonSchema) ? inputSchema.jsonSchema : inputSchema;
28529
- const properties = isRecord9(jsonSchema.properties) ? jsonSchema.properties : {};
28849
+ return inputSchema.fields.filter(isRecord11);
28850
+ const jsonSchema = isRecord11(inputSchema.jsonSchema) ? inputSchema.jsonSchema : inputSchema;
28851
+ const properties = isRecord11(jsonSchema.properties) ? jsonSchema.properties : {};
28530
28852
  const required = Array.isArray(jsonSchema.required) ? new Set(jsonSchema.required.map(String)) : /* @__PURE__ */ new Set();
28531
28853
  return Object.entries(properties).map(([name, value]) => {
28532
- const property = isRecord9(value) ? value : {};
28854
+ const property = isRecord11(value) ? value : {};
28533
28855
  return {
28534
28856
  name,
28535
28857
  type: typeof property.type === "string" ? property.type : "unknown",
@@ -28540,10 +28862,10 @@ function toolInputFieldsForDisplay(inputSchema) {
28540
28862
  });
28541
28863
  }
28542
28864
  function canonicalToolJsonSchema(inputSchema) {
28543
- return isRecord9(inputSchema.jsonSchema) ? inputSchema.jsonSchema : inputSchema;
28865
+ return isRecord11(inputSchema.jsonSchema) ? inputSchema.jsonSchema : inputSchema;
28544
28866
  }
28545
28867
  function declaredToolJsonSchema(inputSchema) {
28546
- if (isRecord9(inputSchema.jsonSchema)) {
28868
+ if (isRecord11(inputSchema.jsonSchema)) {
28547
28869
  return inputSchema.jsonSchema;
28548
28870
  }
28549
28871
  return Array.isArray(inputSchema.fields) ? null : inputSchema;
@@ -28568,7 +28890,7 @@ function publicToolInputSchemaForDescribe(inputSchema) {
28568
28890
  };
28569
28891
  const stripDescriptions = (value) => {
28570
28892
  if (Array.isArray(value)) return value.map(stripDescriptions);
28571
- if (!isRecord9(value)) return value;
28893
+ if (!isRecord11(value)) return value;
28572
28894
  return Object.fromEntries(
28573
28895
  Object.entries(value).flatMap(([key, nested]) => {
28574
28896
  if (key === "description" && typeof nested === "string" && exposesProviderSpend(nested)) {
@@ -28589,7 +28911,7 @@ function recursiveToolInputFieldsForDisplay(inputSchema) {
28589
28911
  for (const item of value) collectSchemaIds(item);
28590
28912
  return;
28591
28913
  }
28592
- if (!isRecord9(value)) return;
28914
+ if (!isRecord11(value)) return;
28593
28915
  if (typeof value.$id === "string" && value.$id.trim()) {
28594
28916
  schemasById.set(value.$id.trim(), value);
28595
28917
  }
@@ -28602,10 +28924,10 @@ function recursiveToolInputFieldsForDisplay(inputSchema) {
28602
28924
  let current = root;
28603
28925
  for (const rawSegment of ref.slice(2).split("/")) {
28604
28926
  const segment = rawSegment.replace(/~1/g, "/").replace(/~0/g, "~");
28605
- if (!isRecord9(current)) return schema;
28927
+ if (!isRecord11(current)) return schema;
28606
28928
  current = current[segment];
28607
28929
  }
28608
- return isRecord9(current) ? current : schema;
28930
+ return isRecord11(current) ? current : schema;
28609
28931
  };
28610
28932
  const addField = (field) => {
28611
28933
  const name = typeof field.name === "string" ? field.name : "";
@@ -28620,7 +28942,7 @@ function recursiveToolInputFieldsForDisplay(inputSchema) {
28620
28942
  if (ref && activeRefs.has(ref)) return;
28621
28943
  const schema = resolveRef(unresolvedSchema);
28622
28944
  const nextActiveRefs = ref ? /* @__PURE__ */ new Set([...activeRefs, ref]) : activeRefs;
28623
- const type = Array.isArray(schema.type) ? schema.type.map(String).join("|") : typeof schema.type === "string" ? schema.type : isRecord9(schema.properties) ? "object" : schema.items ? "array" : "unknown";
28945
+ const type = Array.isArray(schema.type) ? schema.type.map(String).join("|") : typeof schema.type === "string" ? schema.type : isRecord11(schema.properties) ? "object" : schema.items ? "array" : "unknown";
28624
28946
  if (path) {
28625
28947
  addField({
28626
28948
  name: path,
@@ -28631,12 +28953,12 @@ function recursiveToolInputFieldsForDisplay(inputSchema) {
28631
28953
  ...Object.prototype.hasOwnProperty.call(schema, "default") ? { default: schema.default } : {}
28632
28954
  });
28633
28955
  }
28634
- const properties = isRecord9(schema.properties) ? schema.properties : {};
28956
+ const properties = isRecord11(schema.properties) ? schema.properties : {};
28635
28957
  const requiredNames = new Set(
28636
28958
  Array.isArray(schema.required) ? schema.required.map(String) : []
28637
28959
  );
28638
28960
  for (const [name, value] of Object.entries(properties)) {
28639
- if (!isRecord9(value)) continue;
28961
+ if (!isRecord11(value)) continue;
28640
28962
  visit(
28641
28963
  value,
28642
28964
  path ? `${path}.${name}` : name,
@@ -28644,13 +28966,13 @@ function recursiveToolInputFieldsForDisplay(inputSchema) {
28644
28966
  nextActiveRefs
28645
28967
  );
28646
28968
  }
28647
- if (isRecord9(schema.items)) {
28969
+ if (isRecord11(schema.items)) {
28648
28970
  visit(schema.items, `${path}[]`, false, nextActiveRefs);
28649
28971
  }
28650
28972
  for (const keyword of ["anyOf", "oneOf", "allOf"]) {
28651
28973
  const branches = Array.isArray(schema[keyword]) ? schema[keyword] : [];
28652
28974
  for (const branch of branches) {
28653
- if (isRecord9(branch)) {
28975
+ if (isRecord11(branch)) {
28654
28976
  visit(branch, path, required, nextActiveRefs);
28655
28977
  }
28656
28978
  }
@@ -28678,14 +29000,14 @@ function printJsonPreview(label, payload) {
28678
29000
  }
28679
29001
  function samplePayload(samples, key) {
28680
29002
  const entry = samples[key];
28681
- if (!isRecord9(entry)) return void 0;
29003
+ if (!isRecord11(entry)) return void 0;
28682
29004
  return Object.prototype.hasOwnProperty.call(entry, "payload") ? entry.payload : entry;
28683
29005
  }
28684
29006
  function commandEnvelopeFromRawResponse(rawResponse) {
28685
- return isRecord9(rawResponse) ? { ...rawResponse } : { status: "completed", result: rawResponse };
29007
+ return isRecord11(rawResponse) ? { ...rawResponse } : { status: "completed", result: rawResponse };
28686
29008
  }
28687
29009
  function apifySyncRecoveryNext(rawResponse) {
28688
- if (!isRecord9(rawResponse) || rawResponse.status !== "running") return null;
29010
+ if (!isRecord11(rawResponse) || rawResponse.status !== "running") return null;
28689
29011
  const toolResponse = recordField2(rawResponse, "toolResponse");
28690
29012
  const raw = recordField2(toolResponse, "raw");
28691
29013
  if (raw.state !== "awaiting_apify") return null;
@@ -28708,7 +29030,7 @@ function apifySyncRecoveryNext(rawResponse) {
28708
29030
  }
28709
29031
  function listExtractorPathsFromUsageGuidance(tool) {
28710
29032
  const toolExecutionResult = tool.usageGuidance?.toolExecutionResult;
28711
- const extractedLists = Array.isArray(toolExecutionResult?.extractedLists) ? toolExecutionResult.extractedLists : isRecord9(toolExecutionResult?.extractedLists) ? Object.values(toolExecutionResult.extractedLists) : [];
29033
+ const extractedLists = Array.isArray(toolExecutionResult?.extractedLists) ? toolExecutionResult.extractedLists : isRecord11(toolExecutionResult?.extractedLists) ? Object.values(toolExecutionResult.extractedLists) : [];
28712
29034
  return extractedLists.flatMap((entry) => {
28713
29035
  const paths = entry.details?.candidatePaths ?? entry.details?.rawToolOutputPaths;
28714
29036
  if (!Array.isArray(paths)) return [];
@@ -28724,7 +29046,7 @@ function formatDecimal(value) {
28724
29046
  function formatUsd(value) {
28725
29047
  return `$${formatDecimal(value)}`;
28726
29048
  }
28727
- function isRecord9(value) {
29049
+ function isRecord11(value) {
28728
29050
  return Boolean(value && typeof value === "object" && !Array.isArray(value));
28729
29051
  }
28730
29052
  function stringField2(source, ...keys) {
@@ -28751,7 +29073,7 @@ function arrayField2(source, ...keys) {
28751
29073
  function recordField2(source, ...keys) {
28752
29074
  for (const key of keys) {
28753
29075
  const value = source[key];
28754
- if (isRecord9(value)) return value;
29076
+ if (isRecord11(value)) return value;
28755
29077
  }
28756
29078
  return {};
28757
29079
  }
@@ -28817,7 +29139,7 @@ function parseJsonObjectArgument(raw, flagName) {
28817
29139
  }
28818
29140
  throw invalidJsonError(flagName, message);
28819
29141
  }
28820
- if (!isRecord9(parsed)) {
29142
+ if (!isRecord11(parsed)) {
28821
29143
  throw invalidJsonError(flagName, "expected an object.");
28822
29144
  }
28823
29145
  return parsed;
@@ -28964,7 +29286,7 @@ function buildToolExecuteBaseEnvelope(input2) {
28964
29286
  kind: summaryEntries.length > 0 ? "object" : "raw",
28965
29287
  summary: input2.summary
28966
29288
  };
28967
- const envelopeHasCanonicalOutput = isRecord9(envelope.toolResponse) && Object.prototype.hasOwnProperty.call(envelope.toolResponse, "raw");
29289
+ const envelopeHasCanonicalOutput = isRecord11(envelope.toolResponse) && Object.prototype.hasOwnProperty.call(envelope.toolResponse, "raw");
28968
29290
  const envelopeHasDeclaredOutput = Object.prototype.hasOwnProperty.call(
28969
29291
  envelope,
28970
29292
  "output"
@@ -29194,7 +29516,7 @@ async function executeTool(args) {
29194
29516
  {
29195
29517
  ...baseEnvelope,
29196
29518
  local: {
29197
- ...isRecord9(baseEnvelope.local) ? baseEnvelope.local : {},
29519
+ ...isRecord11(baseEnvelope.local) ? baseEnvelope.local : {},
29198
29520
  payload_file: jsonPath
29199
29521
  }
29200
29522
  },