deepline 0.1.301 → 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 (35) 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/tool-execute-retry-policy.ts +17 -12
  16. package/dist/bundling-sources/shared_libs/play-runtime/tool-http-errors.ts +210 -5
  17. package/dist/bundling-sources/shared_libs/play-runtime/work-receipts.ts +4 -0
  18. package/dist/bundling-sources/shared_libs/plays/artifact-contract-version.ts +6 -0
  19. package/dist/bundling-sources/shared_libs/plays/artifact-types.ts +4 -0
  20. package/dist/bundling-sources/shared_libs/plays/bundling/index.ts +159 -12
  21. package/dist/bundling-sources/shared_libs/plays/contracts.ts +69 -1
  22. package/dist/bundling-sources/shared_libs/tool-execution-error.ts +428 -0
  23. package/dist/cli/index.js +501 -179
  24. package/dist/cli/index.mjs +501 -179
  25. package/dist/index.d.mts +39 -18
  26. package/dist/index.d.ts +39 -18
  27. package/dist/index.js +394 -59
  28. package/dist/index.mjs +391 -59
  29. package/dist/plays/bundle-play-file.d.mts +4 -2
  30. package/dist/plays/bundle-play-file.d.ts +4 -2
  31. package/dist/plays/bundle-play-file.mjs +116 -19
  32. package/dist/{compiler-manifest-BjopNIqx.d.mts → tool-execution-error-9mH4i-mJ.d.mts} +79 -1
  33. package/dist/{compiler-manifest-BjopNIqx.d.ts → tool-execution-error-9mH4i-mJ.d.ts} +79 -1
  34. package/package.json +1 -1
  35. package/dist/bundling-sources/shared_libs/play-runtime/completed-receipt-cache.ts +0 -166
@@ -176,19 +176,252 @@ import {
176
176
  import { homedir } from "os";
177
177
  import { dirname, isAbsolute, join, resolve } from "path";
178
178
 
179
- // src/errors.ts
180
- var DeeplineError = class extends Error {
179
+ // ../shared_libs/tool-execution-error.ts
180
+ var DEEPLINE_ERROR_BRAND = /* @__PURE__ */ Symbol.for("deepline.error.v1");
181
+ var TOOL_EXECUTION_ERROR_BRAND = /* @__PURE__ */ Symbol.for(
182
+ "deepline.tool-execution-error.v1"
183
+ );
184
+ var PROVIDER_TRANSIENT_ERROR_BRAND = /* @__PURE__ */ Symbol.for(
185
+ "deepline.provider-transient-error.v1"
186
+ );
187
+ var LEGACY_TOOL_EXECUTION_ERROR_SCHEMA_VERSION = 0;
188
+ var TOOL_EXECUTION_ERROR_SCHEMA_VERSION = 1;
189
+ var TOOL_EXECUTION_ERROR_SCHEMA_HEADER = "x-deepline-tool-error-schema";
190
+ var MAX_IDENTIFIER_LENGTH = 200;
191
+ var MAX_CODE_LENGTH = 160;
192
+ function nativeInstanceOf(constructor, value) {
193
+ return Reflect.apply(Function.prototype[Symbol.hasInstance], constructor, [
194
+ value
195
+ ]);
196
+ }
197
+ function hasBrand(value, brand) {
198
+ return typeof value === "object" && value !== null && value[brand] === true;
199
+ }
200
+ function applyBrand(value, brand) {
201
+ if (hasBrand(value, brand)) return;
202
+ Object.defineProperty(value, brand, {
203
+ configurable: false,
204
+ enumerable: false,
205
+ writable: false,
206
+ value: true
207
+ });
208
+ }
209
+ var DeeplineError = class _DeeplineError extends Error {
181
210
  constructor(message, statusCode, code, details) {
182
211
  super(message);
183
212
  this.statusCode = statusCode;
184
213
  this.code = code;
185
214
  this.details = details;
186
215
  this.name = "DeeplineError";
216
+ applyBrand(this, DEEPLINE_ERROR_BRAND);
187
217
  }
188
218
  statusCode;
189
219
  code;
190
220
  details;
221
+ static [Symbol.hasInstance](value) {
222
+ if (this !== _DeeplineError) return nativeInstanceOf(this, value);
223
+ return hasBrand(value, DEEPLINE_ERROR_BRAND);
224
+ }
191
225
  };
226
+ var ToolExecutionError = class _ToolExecutionError extends DeeplineError {
227
+ toolId;
228
+ provider;
229
+ operation;
230
+ origin;
231
+ category;
232
+ retryable;
233
+ requestId;
234
+ retryAfterMs;
235
+ networkKind;
236
+ networkScope;
237
+ constructor(message, options) {
238
+ super(
239
+ message,
240
+ options.statusCode ?? void 0,
241
+ options.code ?? void 0,
242
+ options.details
243
+ );
244
+ this.name = "ToolExecutionError";
245
+ this.toolId = options.toolId;
246
+ this.provider = options.provider;
247
+ this.operation = options.operation;
248
+ this.origin = options.origin;
249
+ this.category = options.category;
250
+ this.retryable = options.retryable;
251
+ this.requestId = options.requestId;
252
+ this.retryAfterMs = options.retryAfterMs;
253
+ this.networkKind = options.networkKind;
254
+ this.networkScope = options.networkScope;
255
+ applyBrand(this, TOOL_EXECUTION_ERROR_BRAND);
256
+ if (isProviderTransientFailure(options)) {
257
+ applyBrand(this, PROVIDER_TRANSIENT_ERROR_BRAND);
258
+ }
259
+ }
260
+ static [Symbol.hasInstance](value) {
261
+ if (this !== _ToolExecutionError) return nativeInstanceOf(this, value);
262
+ return hasBrand(value, TOOL_EXECUTION_ERROR_BRAND);
263
+ }
264
+ };
265
+ function brandAsToolExecutionError(value) {
266
+ applyBrand(value, TOOL_EXECUTION_ERROR_BRAND);
267
+ }
268
+ function isProviderTransientFailure(input2) {
269
+ return input2.origin === "provider" && (input2.category === "rate_limit" || input2.category === "network" || input2.category === "upstream");
270
+ }
271
+ var ProviderTransientError = class _ProviderTransientError extends ToolExecutionError {
272
+ origin = "provider";
273
+ constructor(message, options) {
274
+ super(message, {
275
+ ...options,
276
+ origin: "provider",
277
+ category: options.category
278
+ });
279
+ this.name = "ProviderTransientError";
280
+ this.category = options.category;
281
+ applyBrand(this, PROVIDER_TRANSIENT_ERROR_BRAND);
282
+ }
283
+ static [Symbol.hasInstance](value) {
284
+ if (this !== _ProviderTransientError) return nativeInstanceOf(this, value);
285
+ return hasBrand(value, PROVIDER_TRANSIENT_ERROR_BRAND);
286
+ }
287
+ };
288
+ function brandAsProviderTransientError(value) {
289
+ applyBrand(value, PROVIDER_TRANSIENT_ERROR_BRAND);
290
+ }
291
+ function boundedString(value, maxLength = MAX_IDENTIFIER_LENGTH) {
292
+ if (typeof value !== "string") return null;
293
+ const normalized = value.trim();
294
+ return normalized ? normalized.slice(0, maxLength) : null;
295
+ }
296
+ function finiteNonNegativeInteger(value) {
297
+ return typeof value === "number" && Number.isFinite(value) && value >= 0 && Number.isInteger(value) ? value : null;
298
+ }
299
+ function normalizeToolExecutionOrigin(value, input2) {
300
+ const normalized = boundedString(value)?.toLowerCase();
301
+ if (normalized === "caller") return "caller";
302
+ if (normalized === "provider" || normalized === "provider_network") {
303
+ return "provider";
304
+ }
305
+ if (normalized === "upstream" && boundedString(input2?.provider) && boundedString(input2?.operation)) {
306
+ return "provider";
307
+ }
308
+ if (normalized === "deepline" || normalized === "deepline_billing" || normalized === "deepline_rate_limit" || normalized === "internal" || normalized === "server") {
309
+ return "deepline";
310
+ }
311
+ if (normalized === "provider_account") return "provider";
312
+ return "unknown";
313
+ }
314
+ function normalizeToolExecutionCategory(value) {
315
+ switch (boundedString(value)?.toLowerCase()) {
316
+ case "validation":
317
+ case "authorization":
318
+ case "rate_limit":
319
+ case "network":
320
+ case "upstream":
321
+ case "billing":
322
+ case "conflict":
323
+ case "internal":
324
+ return boundedString(value).toLowerCase();
325
+ case "authentication":
326
+ case "provider_auth":
327
+ case "provider_account":
328
+ return "authentication";
329
+ case "execution":
330
+ case "parse":
331
+ case "stub":
332
+ case "internal_native_search_performance":
333
+ return "internal";
334
+ default:
335
+ return "unknown";
336
+ }
337
+ }
338
+ function normalizeNetworkKind(value) {
339
+ switch (boundedString(value)?.toLowerCase()) {
340
+ case "timeout":
341
+ case "dns":
342
+ case "connect":
343
+ case "reset":
344
+ case "unavailable":
345
+ case "unknown":
346
+ return boundedString(value).toLowerCase();
347
+ default:
348
+ return null;
349
+ }
350
+ }
351
+ function normalizeNetworkScope(value) {
352
+ switch (boundedString(value)?.toLowerCase()) {
353
+ case "client_to_deepline":
354
+ case "runtime_to_deepline":
355
+ case "deepline_to_provider":
356
+ return boundedString(value).toLowerCase();
357
+ default:
358
+ return null;
359
+ }
360
+ }
361
+ function isRecord(value) {
362
+ return value !== null && typeof value === "object" && !Array.isArray(value);
363
+ }
364
+ function normalizeToolExecutionFailure(value) {
365
+ if (!isRecord(value) || value.schemaVersion !== TOOL_EXECUTION_ERROR_SCHEMA_VERSION) {
366
+ return null;
367
+ }
368
+ const toolId = boundedString(value.toolId);
369
+ if (!toolId) return null;
370
+ const provider = boundedString(value.provider);
371
+ const operation = boundedString(value.operation);
372
+ const origin = normalizeToolExecutionOrigin(value.origin, {
373
+ provider,
374
+ operation
375
+ });
376
+ const category = normalizeToolExecutionCategory(value.category);
377
+ const trustworthy = origin !== "unknown" && category !== "unknown" && typeof value.retryable === "boolean";
378
+ return {
379
+ schemaVersion: TOOL_EXECUTION_ERROR_SCHEMA_VERSION,
380
+ toolId,
381
+ provider,
382
+ operation,
383
+ code: boundedString(value.code, MAX_CODE_LENGTH),
384
+ origin,
385
+ category,
386
+ retryable: trustworthy ? value.retryable === true : false,
387
+ statusCode: finiteNonNegativeInteger(value.statusCode),
388
+ requestId: boundedString(value.requestId),
389
+ retryAfterMs: finiteNonNegativeInteger(value.retryAfterMs),
390
+ networkKind: normalizeNetworkKind(value.networkKind),
391
+ networkScope: normalizeNetworkScope(value.networkScope)
392
+ };
393
+ }
394
+ function serializeToolExecutionFailure(error) {
395
+ if (!(error instanceof ToolExecutionError)) return null;
396
+ return normalizeToolExecutionFailure({
397
+ schemaVersion: TOOL_EXECUTION_ERROR_SCHEMA_VERSION,
398
+ toolId: error.toolId,
399
+ provider: error.provider,
400
+ operation: error.operation,
401
+ code: error.code ?? null,
402
+ origin: error.origin,
403
+ category: error.category,
404
+ retryable: error.retryable,
405
+ statusCode: error.statusCode ?? null,
406
+ requestId: error.requestId,
407
+ retryAfterMs: error.retryAfterMs,
408
+ networkKind: error.networkKind,
409
+ networkScope: error.networkScope
410
+ });
411
+ }
412
+ function deserializeToolExecutionFailure(message, value, acceptedSchemaVersion) {
413
+ if (acceptedSchemaVersion === LEGACY_TOOL_EXECUTION_ERROR_SCHEMA_VERSION) {
414
+ return null;
415
+ }
416
+ const failure = normalizeToolExecutionFailure(value);
417
+ if (!failure) return null;
418
+ if (isProviderTransientFailure(failure)) {
419
+ return new ProviderTransientError(message, failure);
420
+ }
421
+ return new ToolExecutionError(message, failure);
422
+ }
423
+
424
+ // src/errors.ts
192
425
  var AuthError = class extends DeeplineError {
193
426
  constructor(message = "Authentication failed. Check your DEEPLINE_API_KEY.") {
194
427
  super(message, 401, "AUTH_ERROR");
@@ -208,6 +441,38 @@ var RateLimitError = class extends DeeplineError {
208
441
  this.retryAfterMs = retryAfterMs;
209
442
  }
210
443
  };
444
+ var ToolRateLimitError = class extends RateLimitError {
445
+ toolId;
446
+ provider;
447
+ operation;
448
+ code;
449
+ origin;
450
+ category;
451
+ retryable;
452
+ requestId;
453
+ networkKind;
454
+ networkScope;
455
+ constructor(message, options) {
456
+ super(options.retryAfterMs ?? 5e3, message);
457
+ this.name = "ToolRateLimitError";
458
+ this.statusCode = options.statusCode ?? 429;
459
+ this.code = options.code ?? void 0;
460
+ this.toolId = options.toolId;
461
+ this.provider = options.provider;
462
+ this.operation = options.operation;
463
+ this.origin = options.origin;
464
+ this.category = options.category;
465
+ this.retryable = options.retryable;
466
+ this.requestId = options.requestId;
467
+ this.networkKind = options.networkKind;
468
+ this.networkScope = options.networkScope;
469
+ this.details = options.details;
470
+ brandAsToolExecutionError(this);
471
+ if (isProviderTransientFailure(this)) {
472
+ brandAsProviderTransientError(this);
473
+ }
474
+ }
475
+ };
211
476
  var ConfigError = class extends DeeplineError {
212
477
  constructor(message) {
213
478
  super(message, void 0, "CONFIG_ERROR");
@@ -664,6 +929,9 @@ import { existsSync as existsSync2, readFileSync as readFileSync2 } from "fs";
664
929
  import { homedir as homedir3 } from "os";
665
930
  import { join as join2 } from "path";
666
931
 
932
+ // ../shared_libs/plays/artifact-contract-version.ts
933
+ var CURRENT_PLAY_ARTIFACT_CONTRACT_VERSION = 2;
934
+
667
935
  // src/release.ts
668
936
  var SDK_RELEASE = {
669
937
  // 0.1.94 is claimed by PR #1527 — this watch-render fix ships as 0.1.95.
@@ -703,7 +971,7 @@ var SDK_RELEASE = {
703
971
  // 0.1.253 makes play-page browser opening opt-in and retires --no-open.
704
972
  // 0.1.254 removes the internal operations tree from the published SDK CLI.
705
973
  // Operators use the checkout-local deepline-admin binary instead.
706
- version: "0.1.301",
974
+ version: "0.1.302",
707
975
  contracts: {
708
976
  api: {
709
977
  name: "sdk-http-api",
@@ -719,8 +987,8 @@ var SDK_RELEASE = {
719
987
  },
720
988
  playArtifact: {
721
989
  name: "play-artifact-runtime",
722
- currentVersion: 2,
723
- supportedVersions: [1, 2]
990
+ currentVersion: CURRENT_PLAY_ARTIFACT_CONTRACT_VERSION,
991
+ supportedVersions: [1, CURRENT_PLAY_ARTIFACT_CONTRACT_VERSION]
724
992
  },
725
993
  release: {
726
994
  name: "production-sdk-release",
@@ -952,6 +1220,9 @@ function providerLabelFromToolId(toolId) {
952
1220
  const provider = normalized.split(/[_:./-]+/)[0];
953
1221
  return provider || normalized || "provider";
954
1222
  }
1223
+ function isRecord2(value) {
1224
+ return value !== null && typeof value === "object" && !Array.isArray(value);
1225
+ }
955
1226
  var HttpClient = class {
956
1227
  constructor(config) {
957
1228
  this.config = config;
@@ -1087,6 +1358,29 @@ var HttpClient = class {
1087
1358
  signal: controller.signal
1088
1359
  });
1089
1360
  clearTimeout(timeoutId);
1361
+ const body = await response.text();
1362
+ const parsed = parseResponseBody(body);
1363
+ const structuredToolError = options?.toolId && !response.ok ? deserializeToolExecutionFailure(
1364
+ apiErrorMessage(parsed, response.status),
1365
+ isRecord2(parsed) ? parsed.tool_error : null,
1366
+ TOOL_EXECUTION_ERROR_SCHEMA_VERSION
1367
+ ) : null;
1368
+ if (structuredToolError) {
1369
+ if (response.status === 429) {
1370
+ const retryAfter = parseRetryAfter(response);
1371
+ const failure = serializeToolExecutionFailure(structuredToolError);
1372
+ lastError = failure === null ? structuredToolError : new ToolRateLimitError(structuredToolError.message, {
1373
+ ...failure,
1374
+ retryAfterMs: failure.retryAfterMs ?? Math.max(0, retryAfter)
1375
+ });
1376
+ if (attempt < maxRetries) {
1377
+ retryAfterDelayMs = retryAfter;
1378
+ break;
1379
+ }
1380
+ throw lastError;
1381
+ }
1382
+ throw structuredToolError;
1383
+ }
1090
1384
  if (response.status === 429) {
1091
1385
  const retryAfter = parseRetryAfter(response);
1092
1386
  lastError = new RateLimitError(retryAfter);
@@ -1096,8 +1390,6 @@ var HttpClient = class {
1096
1390
  }
1097
1391
  throw lastError;
1098
1392
  }
1099
- const body = await response.text();
1100
- const parsed = parseResponseBody(body);
1101
1393
  if (response.status === 401 && !isProviderOriginatedHttpError(parsed) || response.status === 403 && !options?.forbiddenAsApiError) {
1102
1394
  throw new AuthError();
1103
1395
  }
@@ -1162,6 +1454,29 @@ var HttpClient = class {
1162
1454
  lastError,
1163
1455
  describeRequestTarget(path)
1164
1456
  );
1457
+ if (options?.toolId) {
1458
+ const code = mappedNetworkError.code;
1459
+ throw new ToolExecutionError(
1460
+ withCoworkNetworkHint(mappedNetworkError.message),
1461
+ {
1462
+ toolId: options.toolId,
1463
+ provider: providerLabelFromToolId(options.toolId),
1464
+ operation: options.toolId,
1465
+ code,
1466
+ origin: "deepline",
1467
+ category: "network",
1468
+ // A direct client timeout has ambiguous delivery. Fail closed unless
1469
+ // the server returns the authoritative action delivery contract.
1470
+ retryable: false,
1471
+ statusCode: null,
1472
+ requestId: null,
1473
+ retryAfterMs: null,
1474
+ networkKind: code === "NETWORK_TIMEOUT" ? "timeout" : code === "NETWORK_ABORTED" ? "unknown" : "unavailable",
1475
+ networkScope: "client_to_deepline",
1476
+ details: mappedNetworkError.details
1477
+ }
1478
+ );
1479
+ }
1165
1480
  throw new DeeplineError(
1166
1481
  withCoworkNetworkHint(mappedNetworkError.message),
1167
1482
  void 0,
@@ -1603,11 +1918,11 @@ var RUNNER_POST_TERMINAL_DIAGNOSTIC_MAX_BYTES = 64 * 1024;
1603
1918
  var ledgerIngressRedactor = createSecretRedactionContext();
1604
1919
 
1605
1920
  // ../shared_libs/play-runtime/activity-observation.ts
1606
- function isRecord(value) {
1921
+ function isRecord3(value) {
1607
1922
  return Boolean(value && typeof value === "object" && !Array.isArray(value));
1608
1923
  }
1609
1924
  function isPlayActivityObservation(value) {
1610
- 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)) {
1925
+ 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)) {
1611
1926
  return false;
1612
1927
  }
1613
1928
  const targetKinds = /* @__PURE__ */ new Set([
@@ -1872,7 +2187,7 @@ function projectPlayRunActivity(input2) {
1872
2187
 
1873
2188
  // ../shared_libs/play-runtime/run-ledger.ts
1874
2189
  var LOG_TAIL_LIMIT = 100;
1875
- function isRecord2(value) {
2190
+ function isRecord4(value) {
1876
2191
  return Boolean(value && typeof value === "object" && !Array.isArray(value));
1877
2192
  }
1878
2193
  function finiteNumber(value) {
@@ -1968,21 +2283,21 @@ function createEmptyPlayRunLedgerSnapshot(input2) {
1968
2283
  };
1969
2284
  }
1970
2285
  function normalizePlayRunLedgerSnapshot(value, fallback) {
1971
- if (!isRecord2(value)) {
2286
+ if (!isRecord4(value)) {
1972
2287
  return createEmptyPlayRunLedgerSnapshot(fallback);
1973
2288
  }
1974
2289
  const orderedStepIds = Array.isArray(value.orderedStepIds) ? value.orderedStepIds.filter(
1975
2290
  (entry) => typeof entry === "string" && Boolean(entry.trim())
1976
2291
  ) : [];
1977
- const rawSteps = isRecord2(value.stepsById) ? value.stepsById : {};
2292
+ const rawSteps = isRecord4(value.stepsById) ? value.stepsById : {};
1978
2293
  const stepsById = {};
1979
2294
  for (const [stepId, rawStep] of Object.entries(rawSteps)) {
1980
- if (!stepId.trim() || !isRecord2(rawStep)) continue;
2295
+ if (!stepId.trim() || !isRecord4(rawStep)) continue;
1981
2296
  const rawStatus = normalizeStepStatus(rawStep.status);
1982
2297
  if (!rawStatus) continue;
1983
2298
  const completedAt = finiteNumber(rawStep.completedAt);
1984
2299
  const status = rawStatus === "running" && completedAt !== null ? "completed" : rawStatus;
1985
- const rawProgress = isRecord2(rawStep.progress) ? rawStep.progress : null;
2300
+ const rawProgress = isRecord4(rawStep.progress) ? rawStep.progress : null;
1986
2301
  stepsById[stepId] = {
1987
2302
  stepId,
1988
2303
  label: optionalString(rawStep.label),
@@ -1998,10 +2313,10 @@ function normalizePlayRunLedgerSnapshot(value, fallback) {
1998
2313
  progress: rawProgress ? normalizeStepProgress(rawProgress) : null
1999
2314
  };
2000
2315
  }
2001
- const rawDatasets = isRecord2(value.datasetsById) ? value.datasetsById : {};
2316
+ const rawDatasets = isRecord4(value.datasetsById) ? value.datasetsById : {};
2002
2317
  const datasetsById = {};
2003
2318
  for (const [datasetId, rawDataset] of Object.entries(rawDatasets)) {
2004
- if (!datasetId.trim() || !isRecord2(rawDataset)) continue;
2319
+ if (!datasetId.trim() || !isRecord4(rawDataset)) continue;
2005
2320
  const phase = rawDataset.phase === "available" || rawDataset.phase === "failed" ? rawDataset.phase : "registered";
2006
2321
  datasetsById[datasetId] = {
2007
2322
  datasetId,
@@ -2015,7 +2330,7 @@ function normalizePlayRunLedgerSnapshot(value, fallback) {
2015
2330
  updatedAt: finiteNumber(rawDataset.updatedAt) ?? 0
2016
2331
  };
2017
2332
  }
2018
- const rawActivities = isRecord2(value.activitiesById) ? value.activitiesById : {};
2333
+ const rawActivities = isRecord4(value.activitiesById) ? value.activitiesById : {};
2019
2334
  const activitiesById = {};
2020
2335
  for (const [activityId, rawActivity] of Object.entries(rawActivities)) {
2021
2336
  if (activityId.trim() && isPlayActivityObservation(rawActivity) && rawActivity.activityId === activityId) {
@@ -2164,18 +2479,18 @@ function normalizePlayRunLiveStatus(value) {
2164
2479
  function isTerminalPlayRunLiveStatus(status) {
2165
2480
  return isTerminalPlayRunLifecycleStatus(status);
2166
2481
  }
2167
- function isRecord3(value) {
2482
+ function isRecord5(value) {
2168
2483
  return Boolean(value && typeof value === "object" && !Array.isArray(value));
2169
2484
  }
2170
2485
  function finiteNumber2(value) {
2171
2486
  return typeof value === "number" && Number.isFinite(value) ? value : null;
2172
2487
  }
2173
2488
  function extractTerminalRunLogTail(result) {
2174
- if (!isRecord3(result) || !isRecord3(result._metadata)) {
2489
+ if (!isRecord5(result) || !isRecord5(result._metadata)) {
2175
2490
  return null;
2176
2491
  }
2177
2492
  const runLogTail = result._metadata.runLogTail;
2178
- if (!isRecord3(runLogTail) || !Array.isArray(runLogTail.tail)) {
2493
+ if (!isRecord5(runLogTail) || !Array.isArray(runLogTail.tail)) {
2179
2494
  return null;
2180
2495
  }
2181
2496
  const logTail = runLogTail.tail.filter(
@@ -3069,7 +3384,7 @@ function resolveToolExecuteTimeoutMs(toolId, input2) {
3069
3384
  }
3070
3385
  var RUNS_FAILED_LOG_LIMIT = 20;
3071
3386
  var RUN_LOGS_PAGE_LIMIT = 1e3;
3072
- function isRecord4(value) {
3387
+ function isRecord6(value) {
3073
3388
  return Boolean(value && typeof value === "object" && !Array.isArray(value));
3074
3389
  }
3075
3390
  function isPrebuiltPlayDescription(play) {
@@ -3232,7 +3547,7 @@ function updatePlayLiveStatusState(state, event) {
3232
3547
  }
3233
3548
  const runId = typeof payload.runId === "string" && payload.runId ? payload.runId : isPlayRunPackage(payload) ? payload.run.id : state.runId;
3234
3549
  const status = normalizeLiveStatus(payload.status) ?? (isPlayRunPackage(payload) ? normalizeLiveStatus(payload.run.status) : null) ?? state.status;
3235
- const progressPayload = isRecord4(payload.progress) ? payload.progress : {};
3550
+ const progressPayload = isRecord6(payload.progress) ? payload.progress : {};
3236
3551
  if (event.type === "play.run.final_status" && state.logs.length === 0 && state.lastLogSeq === 0) {
3237
3552
  const payloadLogs = readStringArray(payload.logs);
3238
3553
  const progressLogs = readStringArray(progressPayload.logs);
@@ -3366,9 +3681,9 @@ var DeeplineClient = class {
3366
3681
  return fields.length > 0 ? { fields } : schema;
3367
3682
  }
3368
3683
  schemaMetadata(schema, key) {
3369
- if (!isRecord4(schema)) return null;
3684
+ if (!isRecord6(schema)) return null;
3370
3685
  const value = schema[key];
3371
- return isRecord4(value) ? value : null;
3686
+ return isRecord6(value) ? value : null;
3372
3687
  }
3373
3688
  playRunCommand(play, options) {
3374
3689
  const target = play.reference || play.name;
@@ -3417,7 +3732,7 @@ var DeeplineClient = class {
3417
3732
  aliases,
3418
3733
  inputSchema: options?.compact ? this.compactSchema(play.inputSchema) : play.inputSchema ?? null,
3419
3734
  outputSchema: options?.compact ? this.compactSchema(play.outputSchema) : play.outputSchema ?? null,
3420
- staticPipeline: isRecord4(play.staticPipeline) ? play.staticPipeline : isRecord4(play.currentRevision?.staticPipeline) ? play.currentRevision.staticPipeline : isRecord4(play.liveRevision?.staticPipeline) ? play.liveRevision.staticPipeline : null,
3735
+ staticPipeline: isRecord6(play.staticPipeline) ? play.staticPipeline : isRecord6(play.currentRevision?.staticPipeline) ? play.currentRevision.staticPipeline : isRecord6(play.liveRevision?.staticPipeline) ? play.liveRevision.staticPipeline : null,
3421
3736
  ...csvInput ? { csvInput } : {},
3422
3737
  ...rowOutputSchema ? { rowOutputSchema } : {},
3423
3738
  runCommand: runCommand2,
@@ -3588,6 +3903,9 @@ var DeeplineClient = class {
3588
3903
  async executeTool(toolId, input2, options) {
3589
3904
  const headers = {
3590
3905
  [EXECUTE_RESPONSE_CONTRACT_HEADER]: V2_EXECUTE_RESPONSE_CONTRACT,
3906
+ [TOOL_EXECUTION_ERROR_SCHEMA_HEADER]: String(
3907
+ TOOL_EXECUTION_ERROR_SCHEMA_VERSION
3908
+ ),
3591
3909
  ...options?.includeToolMetadata ? { [INCLUDE_TOOL_METADATA_HEADER]: "true" } : {},
3592
3910
  [EXECUTE_RESPONSE_INTENT_HEADER]: options?.responseIntent ?? "raw"
3593
3911
  };
@@ -3602,7 +3920,8 @@ var DeeplineClient = class {
3602
3920
  forbiddenAsApiError: true,
3603
3921
  timeout: options?.timeout ?? resolveToolExecuteTimeoutMs(toolId, input2),
3604
3922
  maxRetries: options?.maxRetries ?? 0,
3605
- exactUrlOnly: true
3923
+ exactUrlOnly: true,
3924
+ toolId
3606
3925
  }
3607
3926
  );
3608
3927
  }
@@ -8283,14 +8602,14 @@ function sanitizeCsvProjectionInfo(input2) {
8283
8602
  const rows = input2.rows.map(stripCsvProjectionFields);
8284
8603
  return { rows, columns };
8285
8604
  }
8286
- function isRecord5(value) {
8605
+ function isRecord7(value) {
8287
8606
  return Boolean(value && typeof value === "object" && !Array.isArray(value));
8288
8607
  }
8289
8608
  function isSerializedDataset(value) {
8290
- return isRecord5(value) && value.kind === "dataset" && typeof value.count === "number" && (Array.isArray(value.preview) || typeof value.tableNamespace === "string");
8609
+ return isRecord7(value) && value.kind === "dataset" && typeof value.count === "number" && (Array.isArray(value.preview) || typeof value.tableNamespace === "string");
8291
8610
  }
8292
8611
  function isPackagedDatasetOutput(value) {
8293
- return isRecord5(value) && value.kind === "dataset" && isRecord5(value.preview) && Array.isArray(value.preview.rows);
8612
+ return isRecord7(value) && value.kind === "dataset" && isRecord7(value.preview) && Array.isArray(value.preview.rows);
8294
8613
  }
8295
8614
  function pathParts(path) {
8296
8615
  return path.split(".").map((part) => part.trim()).filter(Boolean);
@@ -8298,7 +8617,7 @@ function pathParts(path) {
8298
8617
  function valueAtPath(root, path) {
8299
8618
  let cursor = root;
8300
8619
  for (const part of pathParts(path)) {
8301
- if (!isRecord5(cursor)) {
8620
+ if (!isRecord7(cursor)) {
8302
8621
  return void 0;
8303
8622
  }
8304
8623
  cursor = cursor[part];
@@ -8306,17 +8625,17 @@ function valueAtPath(root, path) {
8306
8625
  return cursor;
8307
8626
  }
8308
8627
  function totalRowsForDataset(result, datasetPath) {
8309
- const metadata = isRecord5(result._metadata) ? result._metadata : null;
8628
+ const metadata = isRecord7(result._metadata) ? result._metadata : null;
8310
8629
  const parentPath = datasetPath.split(".").slice(0, -1).join(".");
8311
8630
  const parent = parentPath ? valueAtPath({ result }, parentPath) : result;
8312
- return metadata?.totalRows ?? metadata?.rowCount ?? metadata?.count ?? (isRecord5(parent) ? parent.totalRows ?? parent.rowCount ?? parent.count : void 0) ?? result.totalRows ?? result.rowCount ?? result.count;
8631
+ return metadata?.totalRows ?? metadata?.rowCount ?? metadata?.count ?? (isRecord7(parent) ? parent.totalRows ?? parent.rowCount ?? parent.count : void 0) ?? result.totalRows ?? result.rowCount ?? result.count;
8313
8632
  }
8314
8633
  function rowArray(value) {
8315
8634
  if (!Array.isArray(value)) {
8316
8635
  return null;
8317
8636
  }
8318
8637
  const rows = value.filter(
8319
- (row) => isRecord5(row)
8638
+ (row) => isRecord7(row)
8320
8639
  );
8321
8640
  return rows.length === value.length ? rows : null;
8322
8641
  }
@@ -8340,7 +8659,7 @@ function inferColumns(rows) {
8340
8659
  return columns;
8341
8660
  }
8342
8661
  function columnsFromDatasetSummary(summary) {
8343
- if (!isRecord5(summary) || !isRecord5(summary.columnStats)) {
8662
+ if (!isRecord7(summary) || !isRecord7(summary.columnStats)) {
8344
8663
  return [];
8345
8664
  }
8346
8665
  return Object.keys(summary.columnStats).filter((column) => column);
@@ -8388,7 +8707,7 @@ function canonicalRowsInfoFromCandidate(input2) {
8388
8707
  datasetId: typeof candidate.value.datasetId === "string" ? candidate.value.datasetId : null,
8389
8708
  tableNamespace: typeof candidate.value.tableNamespace === "string" ? candidate.value.tableNamespace : null,
8390
8709
  ...candidate.value.recovered === true ? { recovered: true } : {},
8391
- ...isRecord5(candidate.value.exportUnavailable) && (candidate.value.exportUnavailable.reason === "empty_dataset" || candidate.value.exportUnavailable.reason === "shared_table_namespace") ? {
8710
+ ...isRecord7(candidate.value.exportUnavailable) && (candidate.value.exportUnavailable.reason === "empty_dataset" || candidate.value.exportUnavailable.reason === "shared_table_namespace") ? {
8392
8711
  exportUnavailableReason: candidate.value.exportUnavailable.reason,
8393
8712
  ...typeof candidate.value.exportUnavailable.message === "string" ? {
8394
8713
  exportUnavailableMessage: candidate.value.exportUnavailable.message
@@ -8436,7 +8755,7 @@ function collectDatasetCandidates(input2) {
8436
8755
  });
8437
8756
  return;
8438
8757
  }
8439
- if (!isRecord5(input2.value)) {
8758
+ if (!isRecord7(input2.value)) {
8440
8759
  return;
8441
8760
  }
8442
8761
  for (const [key, child] of Object.entries(input2.value)) {
@@ -8453,12 +8772,12 @@ function collectDatasetCandidates(input2) {
8453
8772
  }
8454
8773
  }
8455
8774
  function collectCanonicalRowsInfos(statusOrResult) {
8456
- const root = isRecord5(statusOrResult) ? statusOrResult : null;
8457
- const result = isRecord5(root?.result) ? root.result : root;
8775
+ const root = isRecord7(statusOrResult) ? statusOrResult : null;
8776
+ const result = isRecord7(root?.result) ? root.result : root;
8458
8777
  if (!result) {
8459
8778
  return [];
8460
8779
  }
8461
- const metadata = isRecord5(result._metadata) ? result._metadata : null;
8780
+ const metadata = isRecord7(result._metadata) ? result._metadata : null;
8462
8781
  const totalFromMetadata = metadata?.totalRows ?? metadata?.rowCount ?? metadata?.count;
8463
8782
  const candidates = [
8464
8783
  {
@@ -8482,8 +8801,8 @@ function collectCanonicalRowsInfos(statusOrResult) {
8482
8801
  total: totalFromMetadata ?? result.totalRows ?? result.rowCount ?? result.count
8483
8802
  }
8484
8803
  ];
8485
- if (isRecord5(result.output)) {
8486
- const outputMetadata = isRecord5(result.output._metadata) ? result.output._metadata : null;
8804
+ if (isRecord7(result.output)) {
8805
+ const outputMetadata = isRecord7(result.output._metadata) ? result.output._metadata : null;
8487
8806
  const outputTotalFromMetadata = outputMetadata?.totalRows ?? outputMetadata?.rowCount ?? outputMetadata?.count;
8488
8807
  candidates.push(
8489
8808
  {
@@ -8510,14 +8829,14 @@ function collectCanonicalRowsInfos(statusOrResult) {
8510
8829
  }
8511
8830
  if (Array.isArray(result.steps)) {
8512
8831
  result.steps.forEach((step, index) => {
8513
- if (!isRecord5(step) || !isRecord5(step.output)) {
8832
+ if (!isRecord7(step) || !isRecord7(step.output)) {
8514
8833
  return;
8515
8834
  }
8516
8835
  const source = typeof step.output.path === "string" ? step.output.path : typeof step.id === "string" ? `steps.${step.id}.output` : `steps.${index}.output`;
8517
8836
  candidates.push({
8518
8837
  source,
8519
8838
  value: step.output,
8520
- total: step.output.rowCount ?? (isRecord5(step.output.preview) ? step.output.preview.totalRows : void 0) ?? (isRecord5(step.progress) ? step.progress.total : void 0)
8839
+ total: step.output.rowCount ?? (isRecord7(step.output.preview) ? step.output.preview.totalRows : void 0) ?? (isRecord7(step.progress) ? step.progress.total : void 0)
8521
8840
  });
8522
8841
  });
8523
8842
  }
@@ -8545,15 +8864,15 @@ function collectCanonicalRowsInfos(statusOrResult) {
8545
8864
  return infos;
8546
8865
  }
8547
8866
  function collectPackagedDatasetCandidates(statusOrResult) {
8548
- const root = isRecord5(statusOrResult) ? statusOrResult : null;
8867
+ const root = isRecord7(statusOrResult) ? statusOrResult : null;
8549
8868
  if (!root) {
8550
8869
  return [];
8551
8870
  }
8552
- const pkg = isRecord5(root.package) ? root.package : root;
8871
+ const pkg = isRecord7(root.package) ? root.package : root;
8553
8872
  const datasets = Array.isArray(pkg.datasets) ? pkg.datasets : [];
8554
8873
  const candidates = [];
8555
8874
  for (const output2 of datasets) {
8556
- if (!isRecord5(output2) || !isPackagedDatasetOutput(output2)) {
8875
+ if (!isRecord7(output2) || !isPackagedDatasetOutput(output2)) {
8557
8876
  continue;
8558
8877
  }
8559
8878
  const source = typeof output2.path === "string" && output2.path.trim() ? output2.path.trim() : null;
@@ -8563,18 +8882,18 @@ function collectPackagedDatasetCandidates(statusOrResult) {
8563
8882
  candidates.push({
8564
8883
  source,
8565
8884
  value: output2,
8566
- total: output2.rowCount ?? (isRecord5(output2.preview) ? output2.preview.totalRows : void 0)
8885
+ total: output2.rowCount ?? (isRecord7(output2.preview) ? output2.preview.totalRows : void 0)
8567
8886
  });
8568
8887
  }
8569
8888
  return candidates;
8570
8889
  }
8571
8890
  function collectPackagedStepDatasetCandidates(statusOrResult) {
8572
- const root = isRecord5(statusOrResult) ? statusOrResult : null;
8891
+ const root = isRecord7(statusOrResult) ? statusOrResult : null;
8573
8892
  if (!root) return [];
8574
- const pkg = isRecord5(root.package) ? root.package : root;
8893
+ const pkg = isRecord7(root.package) ? root.package : root;
8575
8894
  const steps = Array.isArray(pkg.steps) ? pkg.steps : [];
8576
8895
  return steps.flatMap((step) => {
8577
- if (!isRecord5(step) || !isPackagedDatasetOutput(step.output)) return [];
8896
+ if (!isRecord7(step) || !isPackagedDatasetOutput(step.output)) return [];
8578
8897
  const source = typeof step.output.path === "string" && step.output.path.trim() ? step.output.path.trim() : null;
8579
8898
  return source ? [
8580
8899
  {
@@ -8586,8 +8905,8 @@ function collectPackagedStepDatasetCandidates(statusOrResult) {
8586
8905
  });
8587
8906
  }
8588
8907
  function collectSerializedDatasetRowsInfos(statusOrResult) {
8589
- const root = isRecord5(statusOrResult) ? statusOrResult : null;
8590
- const result = isRecord5(root?.result) ? root.result : root;
8908
+ const root = isRecord7(statusOrResult) ? statusOrResult : null;
8909
+ const result = isRecord7(root?.result) ? root.result : root;
8591
8910
  const candidates = [];
8592
8911
  if (result) {
8593
8912
  collectDatasetCandidates({
@@ -8595,7 +8914,7 @@ function collectSerializedDatasetRowsInfos(statusOrResult) {
8595
8914
  path: "result",
8596
8915
  output: candidates
8597
8916
  });
8598
- if (isRecord5(result.output)) {
8917
+ if (isRecord7(result.output)) {
8599
8918
  collectDatasetCandidates({
8600
8919
  value: result.output,
8601
8920
  path: "result",
@@ -8673,13 +8992,13 @@ function summarizeSampleValue(value, depth = 0) {
8673
8992
  if (typeof parsed === "number" || typeof parsed === "boolean") return parsed;
8674
8993
  if (depth >= 3) {
8675
8994
  if (Array.isArray(parsed)) return [];
8676
- if (isRecord5(parsed)) return {};
8995
+ if (isRecord7(parsed)) return {};
8677
8996
  return compactScalar(parsed);
8678
8997
  }
8679
8998
  if (Array.isArray(parsed)) {
8680
8999
  return parsed.slice(0, 3).map((item) => summarizeSampleValue(item, depth + 1));
8681
9000
  }
8682
- if (isRecord5(parsed)) {
9001
+ if (isRecord7(parsed)) {
8683
9002
  const out = {};
8684
9003
  for (const [key, nested] of Object.entries(parsed)) {
8685
9004
  if (["__dl", "meta", "metadata"].includes(key)) {
@@ -8710,7 +9029,7 @@ function compactCell(value) {
8710
9029
  }
8711
9030
  return `[${parsed.length} items]`;
8712
9031
  }
8713
- if (isRecord5(parsed)) {
9032
+ if (isRecord7(parsed)) {
8714
9033
  for (const key of ["matched_result", "output"]) {
8715
9034
  if (parsed[key] !== null && parsed[key] !== void 0 && parsed[key] !== "") {
8716
9035
  return compactCell(parsed[key]);
@@ -9799,17 +10118,17 @@ function parsePositiveInteger2(value, flagName) {
9799
10118
  }
9800
10119
  return parsed;
9801
10120
  }
9802
- function isRecord6(value) {
10121
+ function isRecord8(value) {
9803
10122
  return Boolean(value && typeof value === "object" && !Array.isArray(value));
9804
10123
  }
9805
10124
  function stringValue(value) {
9806
10125
  return typeof value === "string" ? value.trim() : "";
9807
10126
  }
9808
10127
  function extractionEntries(value) {
9809
- if (Array.isArray(value)) return value.filter(isRecord6);
9810
- if (!isRecord6(value)) return [];
10128
+ if (Array.isArray(value)) return value.filter(isRecord8);
10129
+ if (!isRecord8(value)) return [];
9811
10130
  return Object.entries(value).map(
9812
- ([name, entry]) => isRecord6(entry) ? { name, ...entry } : { name }
10131
+ ([name, entry]) => isRecord8(entry) ? { name, ...entry } : { name }
9813
10132
  );
9814
10133
  }
9815
10134
  var PlayBootstrapError = class extends Error {
@@ -10371,7 +10690,7 @@ function readCsvSampleRows(sample) {
10371
10690
  relax_column_count: true,
10372
10691
  trim: true
10373
10692
  });
10374
- return Array.isArray(parsedRows) ? parsedRows.filter(isRecord6) : [];
10693
+ return Array.isArray(parsedRows) ? parsedRows.filter(isRecord8) : [];
10375
10694
  }
10376
10695
  function readSourceCsvColumnSpecs(csvPath) {
10377
10696
  const sample = readCsvSample(csvPath);
@@ -10404,16 +10723,16 @@ function packagedCsvPathForPlay(csvPath) {
10404
10723
  return portablePath.startsWith(".") ? portablePath : `./${portablePath}`;
10405
10724
  }
10406
10725
  function getterNamesFromTool(tool, kind) {
10407
- const usageGuidance = isRecord6(tool?.usageGuidance) ? tool.usageGuidance : {};
10408
- const resultGuidance = isRecord6(usageGuidance.toolExecutionResult) ? usageGuidance.toolExecutionResult : isRecord6(usageGuidance.tool_execution_result) ? usageGuidance.tool_execution_result : {};
10726
+ const usageGuidance = isRecord8(tool?.usageGuidance) ? tool.usageGuidance : {};
10727
+ const resultGuidance = isRecord8(usageGuidance.toolExecutionResult) ? usageGuidance.toolExecutionResult : isRecord8(usageGuidance.tool_execution_result) ? usageGuidance.tool_execution_result : {};
10409
10728
  const key = kind === "list" ? "extractedLists" : "extractedValues";
10410
10729
  const snakeKey = kind === "list" ? "extracted_lists" : "extracted_values";
10411
10730
  return extractionEntries(resultGuidance[key] ?? resultGuidance[snakeKey]).map((entry) => stringValue(entry.name)).filter(Boolean);
10412
10731
  }
10413
10732
  function targetGettersFromTool(tool) {
10414
- const record = isRecord6(tool) ? tool : {};
10733
+ const record = isRecord8(tool) ? tool : {};
10415
10734
  const raw = record.targetGetters ?? record.target_getters;
10416
- if (!isRecord6(raw)) return {};
10735
+ if (!isRecord8(raw)) return {};
10417
10736
  const entries = [];
10418
10737
  for (const [target, value] of Object.entries(raw)) {
10419
10738
  const paths = Array.isArray(value) ? value.map((path) => typeof path === "string" ? path.trim() : "").filter(Boolean) : [];
@@ -10434,10 +10753,10 @@ function listRowCandidateKeysFromTool(tool) {
10434
10753
  return [...keys].sort();
10435
10754
  }
10436
10755
  function inputPropertyNames(schema) {
10437
- if (!isRecord6(schema)) return [];
10438
- if (isRecord6(schema.properties)) return Object.keys(schema.properties);
10756
+ if (!isRecord8(schema)) return [];
10757
+ if (isRecord8(schema.properties)) return Object.keys(schema.properties);
10439
10758
  if (Array.isArray(schema.fields)) {
10440
- return schema.fields.filter(isRecord6).map((field) => stringValue(field.name)).filter(Boolean);
10759
+ return schema.fields.filter(isRecord8).map((field) => stringValue(field.name)).filter(Boolean);
10441
10760
  }
10442
10761
  return [];
10443
10762
  }
@@ -10451,7 +10770,7 @@ function schemaFieldDetails(schema) {
10451
10770
  return { required, optional };
10452
10771
  }
10453
10772
  function jsonSchemaTypeExpression(schema) {
10454
- if (!isRecord6(schema)) return "unknown";
10773
+ if (!isRecord8(schema)) return "unknown";
10455
10774
  const type = schema.type;
10456
10775
  if (Array.isArray(type)) {
10457
10776
  return type.map((entry) => jsonSchemaTypeExpression({ ...schema, type: entry })).join(" | ");
@@ -10481,7 +10800,7 @@ function jsonSchemaTypeExpression(schema) {
10481
10800
  }
10482
10801
  }
10483
10802
  function objectPropertySchema(schema, property) {
10484
- return isRecord6(schema) && isRecord6(schema.properties) ? schema.properties[property] : null;
10803
+ return isRecord8(schema) && isRecord8(schema.properties) ? schema.properties[property] : null;
10485
10804
  }
10486
10805
  function playOutputHasField(schema, field) {
10487
10806
  return objectPropertySchema(schema, field) != null;
@@ -10657,14 +10976,14 @@ ${indent2.slice(2)}}`;
10657
10976
  }
10658
10977
  function requiredPlayInputFields(play) {
10659
10978
  const schema = play?.inputSchema;
10660
- if (!isRecord6(schema)) return [];
10979
+ if (!isRecord8(schema)) return [];
10661
10980
  if (Array.isArray(schema.required)) {
10662
10981
  return schema.required.filter(
10663
10982
  (value) => typeof value === "string"
10664
10983
  );
10665
10984
  }
10666
10985
  if (Array.isArray(schema.fields)) {
10667
- return schema.fields.filter(isRecord6).filter(
10986
+ return schema.fields.filter(isRecord8).filter(
10668
10987
  (field) => field.required === true && typeof field.name === "string"
10669
10988
  ).map((field) => String(field.name));
10670
10989
  }
@@ -10845,7 +11164,7 @@ function validateBootstrapRoutes(input2) {
10845
11164
  }
10846
11165
  }
10847
11166
  function staticPipelineSubsteps(pipeline) {
10848
- if (!isRecord6(pipeline)) return [];
11167
+ if (!isRecord8(pipeline)) return [];
10849
11168
  return [
10850
11169
  ...extractionEntries(pipeline.stages),
10851
11170
  ...extractionEntries(pipeline.substeps)
@@ -10853,7 +11172,7 @@ function staticPipelineSubsteps(pipeline) {
10853
11172
  }
10854
11173
  function playUsesMapBackedRuntime(play) {
10855
11174
  const pipeline = play?.staticPipeline;
10856
- if (!isRecord6(pipeline)) return false;
11175
+ if (!isRecord8(pipeline)) return false;
10857
11176
  if (stringValue(pipeline.tableNamespace)) return true;
10858
11177
  return staticPipelineSubsteps(pipeline).some((substep) => {
10859
11178
  if (stringValue(substep.type) === "map") return true;
@@ -10862,7 +11181,7 @@ function playUsesMapBackedRuntime(play) {
10862
11181
  aliases: [],
10863
11182
  runCommand: "",
10864
11183
  examples: [],
10865
- staticPipeline: isRecord6(substep.pipeline) ? substep.pipeline : null
11184
+ staticPipeline: isRecord8(substep.pipeline) ? substep.pipeline : null
10866
11185
  });
10867
11186
  });
10868
11187
  }
@@ -15600,7 +15919,7 @@ function extractPlayValidationErrors(value) {
15600
15919
  if (value instanceof DeeplineError) {
15601
15920
  return extractPlayValidationErrors(value.details);
15602
15921
  }
15603
- if (!isRecord7(value)) {
15922
+ if (!isRecord9(value)) {
15604
15923
  return [];
15605
15924
  }
15606
15925
  const directErrors = stringArrayField(value, "errors");
@@ -16040,7 +16359,7 @@ function shouldUseLocalOnlyPlayCheck() {
16040
16359
  const value = process.env.DEEPLINE_PLAY_CHECK_LOCAL_ONLY?.trim().toLowerCase();
16041
16360
  return value === "1" || value === "true" || value === "yes" || value === "on";
16042
16361
  }
16043
- function isRecord7(value) {
16362
+ function isRecord9(value) {
16044
16363
  return Boolean(value && typeof value === "object" && !Array.isArray(value));
16045
16364
  }
16046
16365
  function stringValue2(value) {
@@ -16050,14 +16369,14 @@ function asArray(value) {
16050
16369
  return Array.isArray(value) ? value : [];
16051
16370
  }
16052
16371
  function extractionEntries2(value) {
16053
- if (Array.isArray(value)) return value.filter(isRecord7);
16054
- if (!isRecord7(value)) return [];
16372
+ if (Array.isArray(value)) return value.filter(isRecord9);
16373
+ if (!isRecord9(value)) return [];
16055
16374
  return Object.entries(value).map(
16056
- ([name, entry]) => isRecord7(entry) ? { name, ...entry } : { name }
16375
+ ([name, entry]) => isRecord9(entry) ? { name, ...entry } : { name }
16057
16376
  );
16058
16377
  }
16059
16378
  function firstRawPath(entry) {
16060
- const details = isRecord7(entry.details) ? entry.details : {};
16379
+ const details = isRecord9(entry.details) ? entry.details : {};
16061
16380
  const paths = [
16062
16381
  ...asArray(details.rawToolOutputPaths),
16063
16382
  ...asArray(details.raw_tool_output_paths),
@@ -16075,12 +16394,12 @@ function checkHintRawPath(value) {
16075
16394
  function collectStaticPipelineToolIds(staticPipeline) {
16076
16395
  const seen = /* @__PURE__ */ new Set();
16077
16396
  const visitPipeline = (pipeline) => {
16078
- if (!isRecord7(pipeline)) return;
16397
+ if (!isRecord9(pipeline)) return;
16079
16398
  for (const step of [
16080
16399
  ...asArray(pipeline.stages),
16081
16400
  ...asArray(pipeline.substeps)
16082
16401
  ]) {
16083
- if (!isRecord7(step)) continue;
16402
+ if (!isRecord9(step)) continue;
16084
16403
  if (step.type === "tool") {
16085
16404
  const toolId = stringValue2(step.toolId) || stringValue2(step.tool);
16086
16405
  if (toolId) seen.add(toolId);
@@ -16094,9 +16413,9 @@ function collectStaticPipelineToolIds(staticPipeline) {
16094
16413
  return [...seen].sort();
16095
16414
  }
16096
16415
  function toolGetterHintFromMetadata(toolId, tool) {
16097
- const usageGuidance = isRecord7(tool.usageGuidance) ? tool.usageGuidance : {};
16098
- const resultGuidance = isRecord7(usageGuidance.toolExecutionResult) ? usageGuidance.toolExecutionResult : isRecord7(usageGuidance.tool_execution_result) ? usageGuidance.tool_execution_result : {};
16099
- const toolResponse = isRecord7(resultGuidance.toolResponse) ? resultGuidance.toolResponse : isRecord7(resultGuidance.tool_response) ? resultGuidance.tool_response : {};
16416
+ const usageGuidance = isRecord9(tool.usageGuidance) ? tool.usageGuidance : {};
16417
+ const resultGuidance = isRecord9(usageGuidance.toolExecutionResult) ? usageGuidance.toolExecutionResult : isRecord9(usageGuidance.tool_execution_result) ? usageGuidance.tool_execution_result : {};
16418
+ const toolResponse = isRecord9(resultGuidance.toolResponse) ? resultGuidance.toolResponse : isRecord9(resultGuidance.tool_response) ? resultGuidance.tool_response : {};
16100
16419
  const lists = extractionEntries2(
16101
16420
  resultGuidance.extractedLists ?? resultGuidance.extracted_lists
16102
16421
  ).map((entry) => ({
@@ -19483,6 +19802,9 @@ function compileEnrichConfigToPlaySource(config, options = {}) {
19483
19802
  const inlineTypeImports = [
19484
19803
  ...new Set(inlineHandlers.flatMap((inline) => inline.typeImports ?? []))
19485
19804
  ].sort();
19805
+ const inlineRuntimeImports = [
19806
+ ...new Set(inlineHandlers.flatMap((inline) => inline.runtimeImports ?? []))
19807
+ ].sort();
19486
19808
  config.commands.forEach((command) => {
19487
19809
  if (isWaterfall(command)) {
19488
19810
  columnSteps.push(
@@ -19558,7 +19880,7 @@ function compileEnrichConfigToPlaySource(config, options = {}) {
19558
19880
  const typeImports = idiomaticGetters ? inlineTypeImports : [.../* @__PURE__ */ new Set([...inlineTypeImports, "DeeplinePlayRuntimeContext"])].sort();
19559
19881
  return [
19560
19882
  ...inlineRunJavascript && configHasRunJavascript(config) ? ["// @ts-nocheck", "/* eslint-disable */", ""] : [],
19561
- `import { definePlay, steps } from 'deepline';`,
19883
+ `import { ${["definePlay", "steps", ...inlineRuntimeImports].join(", ")} } from 'deepline';`,
19562
19884
  ...typeImports.length > 0 ? [`import type { ${typeImports.join(", ")} } from 'deepline';`] : [],
19563
19885
  ``,
19564
19886
  `type EnrichInput = { file: string; rowStart?: number | null; rowEnd?: number | null };`,
@@ -20374,7 +20696,7 @@ function isMarkedTestAiInferenceCommand(command) {
20374
20696
  if (normalizeEnrichPlayRef(command.tool) !== "run_javascript") {
20375
20697
  return false;
20376
20698
  }
20377
- return isRecord8(command.payload) && command.payload[ENRICH_TEST_AI_INFERENCE_PAYLOAD_MARKER] === true;
20699
+ return isRecord10(command.payload) && command.payload[ENRICH_TEST_AI_INFERENCE_PAYLOAD_MARKER] === true;
20378
20700
  }
20379
20701
  function enrichDebugEnabled(env = process.env) {
20380
20702
  const raw = String(env.DEEPLINE_DEBUG_ENRICH ?? "").trim().toLowerCase();
@@ -20638,7 +20960,7 @@ function rewriteGeneratedPlayRerunForEnrich(status, enrichCommand) {
20638
20960
  if (Array.isArray(value)) {
20639
20961
  return value.map(rewrite);
20640
20962
  }
20641
- if (!isRecord8(value)) {
20963
+ if (!isRecord10(value)) {
20642
20964
  return value;
20643
20965
  }
20644
20966
  const next = Object.fromEntries(
@@ -20647,7 +20969,7 @@ function rewriteGeneratedPlayRerunForEnrich(status, enrichCommand) {
20647
20969
  key === "rerunCommand" && typeof entry === "string" ? enrichCommand : rewrite(entry)
20648
20970
  ])
20649
20971
  );
20650
- if (isRecord8(next.next) && typeof next.next.run === "string") {
20972
+ if (isRecord10(next.next) && typeof next.next.run === "string") {
20651
20973
  next.next = { ...next.next, run: enrichCommand };
20652
20974
  }
20653
20975
  return next;
@@ -21118,7 +21440,7 @@ async function resolveWatchedGeneratedPlayStatus(input2) {
21118
21440
  }
21119
21441
  return input2.client.runs.get(runId, { full: true });
21120
21442
  }
21121
- function isRecord8(value) {
21443
+ function isRecord10(value) {
21122
21444
  return Boolean(value && typeof value === "object" && !Array.isArray(value));
21123
21445
  }
21124
21446
  async function captureStdout(run, options = {}) {
@@ -21370,15 +21692,15 @@ function readFirstEnrichDatasetActions(value) {
21370
21692
  return null;
21371
21693
  }
21372
21694
  const record = candidate;
21373
- const actions = isRecord8(record.actions) ? record.actions : null;
21374
- const currentQuery = isRecord8(actions?.queryCurrentTable) ? actions.queryCurrentTable : null;
21375
- const legacyQuery = isRecord8(actions?.query) ? actions.query : null;
21695
+ const actions = isRecord10(record.actions) ? record.actions : null;
21696
+ const currentQuery = isRecord10(actions?.queryCurrentTable) ? actions.queryCurrentTable : null;
21697
+ const legacyQuery = isRecord10(actions?.query) ? actions.query : null;
21376
21698
  const query = currentQuery?.kind === "deepline_db_query" ? currentQuery : legacyQuery?.kind === "deepline_db_query" ? legacyQuery : null;
21377
21699
  if (query?.kind === "deepline_db_query") {
21378
21700
  return {
21379
21701
  dataset: record,
21380
21702
  query,
21381
- ...isRecord8(actions?.exportCsv) ? { exportCsv: actions.exportCsv } : {}
21703
+ ...isRecord10(actions?.exportCsv) ? { exportCsv: actions.exportCsv } : {}
21382
21704
  };
21383
21705
  }
21384
21706
  if (options.allowLegacy && record.kind === "dataset" && typeof record.queryDatasetCommand === "string" && record.queryDatasetCommand.trim()) {
@@ -21431,7 +21753,7 @@ function enrichCustomerDbJson(input2) {
21431
21753
  const dataset = actions.dataset;
21432
21754
  const sql = actionStringField(query, "sql") ?? parseSqlFromDbQueryCommand(actions.queryDatasetCommand);
21433
21755
  const datasetPath = actionStringField(query, "datasetPath") ?? actionStringField(dataset, "path") ?? actionStringField(dataset, "tableNamespace");
21434
- const api = isRecord8(query.api) ? query.api : null;
21756
+ const api = isRecord10(query.api) ? query.api : null;
21435
21757
  const apiPath = actionStringField(api ?? {}, "path") ?? "/api/v2/db/query";
21436
21758
  const apiMethod = actionStringField(api ?? {}, "method") ?? "POST";
21437
21759
  if (!datasetPath) {
@@ -21500,11 +21822,11 @@ function sqlStringLiteral(value) {
21500
21822
  return `'${value.replace(/'/g, "''")}'`;
21501
21823
  }
21502
21824
  function failureAliasFromCellMeta(cellMeta) {
21503
- if (!isRecord8(cellMeta)) {
21825
+ if (!isRecord10(cellMeta)) {
21504
21826
  return null;
21505
21827
  }
21506
21828
  for (const [alias, meta] of Object.entries(cellMeta)) {
21507
- if (!isRecord8(meta)) {
21829
+ if (!isRecord10(meta)) {
21508
21830
  continue;
21509
21831
  }
21510
21832
  const failure = failureCellFromMeta(meta, {});
@@ -21997,7 +22319,7 @@ function exportableSheetRow2(row, sourceRowStart = 0) {
21997
22319
  return fallback;
21998
22320
  }
21999
22321
  function failureCellFromMeta(meta, fallback) {
22000
- if (!isRecord8(meta)) {
22322
+ if (!isRecord10(meta)) {
22001
22323
  return null;
22002
22324
  }
22003
22325
  const status = typeof meta.status === "string" ? meta.status.trim().toLowerCase() : "";
@@ -22017,7 +22339,7 @@ function failureCellFromMeta(meta, fallback) {
22017
22339
  };
22018
22340
  }
22019
22341
  function applyFailureCellMeta(row, cellMeta, fallback) {
22020
- if (!isRecord8(cellMeta)) {
22342
+ if (!isRecord10(cellMeta)) {
22021
22343
  return;
22022
22344
  }
22023
22345
  for (const [field, meta] of Object.entries(cellMeta)) {
@@ -22245,7 +22567,7 @@ function stableRowSnapshot(value) {
22245
22567
  }
22246
22568
  function cellFailureError(value) {
22247
22569
  const parsed = parseMaybeJsonObject(value);
22248
- if (!isRecord8(parsed)) {
22570
+ if (!isRecord10(parsed)) {
22249
22571
  const text = typeof parsed === "string" ? parsed.trim() : "";
22250
22572
  if (/^(?:[A-Za-z0-9_:-]+:\s*)?(?:Error|TypeError|ReferenceError|SyntaxError|RangeError):\s+/.test(
22251
22573
  text
@@ -22253,12 +22575,12 @@ function cellFailureError(value) {
22253
22575
  return { message: text };
22254
22576
  }
22255
22577
  }
22256
- if (!isRecord8(parsed)) {
22578
+ if (!isRecord10(parsed)) {
22257
22579
  return null;
22258
22580
  }
22259
22581
  const status = typeof parsed.status === "string" ? parsed.status.trim().toLowerCase() : "";
22260
22582
  const directError = typeof parsed.error === "string" ? parsed.error.trim() : typeof parsed.last_error === "string" ? parsed.last_error.trim() : "";
22261
- const result = isRecord8(parsed.result) ? parsed.result : null;
22583
+ const result = isRecord10(parsed.result) ? parsed.result : null;
22262
22584
  const resultError = typeof result?.error === "string" ? result.error.trim() : typeof result?.message === "string" ? result.message.trim() : "";
22263
22585
  if (!directError && !resultError && status !== "error" && status !== "failed") {
22264
22586
  return null;
@@ -22328,7 +22650,7 @@ function assignFlattenedFailurePath(target, field, value) {
22328
22650
  let cursor = target;
22329
22651
  for (const part of normalized.slice(0, -1)) {
22330
22652
  const existing = cursor[part];
22331
- if (!isRecord8(existing)) {
22653
+ if (!isRecord10(existing)) {
22332
22654
  const next = {};
22333
22655
  cursor[part] = next;
22334
22656
  cursor = next;
@@ -22492,10 +22814,10 @@ function waterfallExecutionSignal(status, spec) {
22492
22814
  let everyChildStatOnlyConditionSkipped = true;
22493
22815
  const childAliasesWithStats = /* @__PURE__ */ new Set();
22494
22816
  for (const childAlias of childAliases) {
22495
- for (const stat2 of summaries.map((summary) => summary[childAlias]).filter(isRecord8)) {
22817
+ for (const stat2 of summaries.map((summary) => summary[childAlias]).filter(isRecord10)) {
22496
22818
  sawChildStats = true;
22497
22819
  childAliasesWithStats.add(childAlias);
22498
- const execution = isRecord8(stat2.execution) ? stat2.execution : null;
22820
+ const execution = isRecord10(stat2.execution) ? stat2.execution : null;
22499
22821
  const executedSummary = parseExecutionSummary(
22500
22822
  execution?.["completed:executed"]
22501
22823
  );
@@ -22525,7 +22847,7 @@ function waterfallExecutionSignal(status, spec) {
22525
22847
  }
22526
22848
  function emptyWaterfallStatsEvidence(status, spec) {
22527
22849
  const summaries = collectColumnStats(status);
22528
- const parentStats = summaries.map((summary) => summary[spec.alias]).filter(isRecord8);
22850
+ const parentStats = summaries.map((summary) => summary[spec.alias]).filter(isRecord10);
22529
22851
  for (const stat2 of parentStats) {
22530
22852
  const nonEmpty = parseExecutionSummary(stat2.non_empty);
22531
22853
  if (nonEmpty?.total && nonEmpty.count === 0) {
@@ -22539,7 +22861,7 @@ function emptyWaterfallStatsEvidence(status, spec) {
22539
22861
  let selectedRows = 0;
22540
22862
  let sawStatsForEveryChild = true;
22541
22863
  for (const childAlias of childAliases) {
22542
- const stat2 = summaries.map((summary) => summary[childAlias]).find(isRecord8);
22864
+ const stat2 = summaries.map((summary) => summary[childAlias]).find(isRecord10);
22543
22865
  if (!stat2) {
22544
22866
  sawStatsForEveryChild = false;
22545
22867
  break;
@@ -22548,7 +22870,7 @@ function emptyWaterfallStatsEvidence(status, spec) {
22548
22870
  if ((nonEmpty?.count ?? 0) > 0) {
22549
22871
  return null;
22550
22872
  }
22551
- const execution = isRecord8(stat2.execution) ? stat2.execution : null;
22873
+ const execution = isRecord10(stat2.execution) ? stat2.execution : null;
22552
22874
  const executed = parseExecutionSummary(execution?.["completed:executed"]);
22553
22875
  const reused = parseExecutionSummary(execution?.["completed:reused"]);
22554
22876
  const skipped = parseExecutionSummary(execution?.["skipped:condition"]);
@@ -22590,11 +22912,11 @@ function collectStatusFailureJobs(input2) {
22590
22912
  const jobs = [];
22591
22913
  aliases.forEach((spec, aliasIndex) => {
22592
22914
  const { alias } = spec;
22593
- const stat2 = summaries.map((summary) => summary[alias]).find(isRecord8);
22915
+ const stat2 = summaries.map((summary) => summary[alias]).find(isRecord10);
22594
22916
  if (!stat2) {
22595
22917
  return;
22596
22918
  }
22597
- const execution = isRecord8(stat2.execution) ? stat2.execution : null;
22919
+ const execution = isRecord10(stat2.execution) ? stat2.execution : null;
22598
22920
  const failedCount = Math.min(
22599
22921
  selectedRows,
22600
22922
  Math.max(
@@ -22701,10 +23023,10 @@ function collectColumnStats(status) {
22701
23023
  value.forEach(visit);
22702
23024
  return;
22703
23025
  }
22704
- if (!isRecord8(value)) {
23026
+ if (!isRecord10(value)) {
22705
23027
  return;
22706
23028
  }
22707
- if (isRecord8(value.columnStats)) {
23029
+ if (isRecord10(value.columnStats)) {
22708
23030
  summaries.push(value.columnStats);
22709
23031
  }
22710
23032
  Object.values(value).forEach(visit);
@@ -22716,12 +23038,12 @@ function firstAliasExecutionCounts(input2) {
22716
23038
  const aliases = collectConfigScalarAliasOrder(input2.config);
22717
23039
  const summaries = collectColumnStats(input2.status);
22718
23040
  for (const alias of aliases) {
22719
- const stat2 = summaries.map((summary) => summary[alias]).find(isRecord8);
23041
+ const stat2 = summaries.map((summary) => summary[alias]).find(isRecord10);
22720
23042
  if (!stat2) continue;
22721
23043
  if (input2.forceAliases.has(normalizeAlias2(alias))) {
22722
23044
  return { executed: input2.selectedRows, reused: 0 };
22723
23045
  }
22724
- const execution = isRecord8(stat2.execution) ? stat2.execution : null;
23046
+ const execution = isRecord10(stat2.execution) ? stat2.execution : null;
22725
23047
  if (!execution) continue;
22726
23048
  return {
22727
23049
  executed: parseExecutionCount(execution["completed:executed"]),
@@ -22748,14 +23070,14 @@ function rewriteEnrichJsonStatus(input2) {
22748
23070
  if (Array.isArray(value)) {
22749
23071
  return value.map(rewrite);
22750
23072
  }
22751
- if (!isRecord8(value)) {
23073
+ if (!isRecord10(value)) {
22752
23074
  return value;
22753
23075
  }
22754
23076
  const next = {};
22755
23077
  for (const [key, entry] of Object.entries(value)) {
22756
23078
  next[key] = rewrite(entry);
22757
23079
  }
22758
- if (isRecord8(next.progress)) {
23080
+ if (isRecord10(next.progress)) {
22759
23081
  next.progress = {
22760
23082
  ...next.progress,
22761
23083
  ...selectedRows > 0 ? { total: selectedRows } : {},
@@ -22764,8 +23086,8 @@ function rewriteEnrichJsonStatus(input2) {
22764
23086
  ...failedRows > 0 ? { failed: failedRows, pending: 0 } : {}
22765
23087
  };
22766
23088
  }
22767
- if (isRecord8(next.summary)) {
22768
- const rowCounts = isRecord8(next.summary.rowCounts) ? next.summary.rowCounts : null;
23089
+ if (isRecord10(next.summary)) {
23090
+ const rowCounts = isRecord10(next.summary.rowCounts) ? next.summary.rowCounts : null;
22769
23091
  if (failedRows > 0) {
22770
23092
  next.summary = {
22771
23093
  ...next.summary,
@@ -22778,11 +23100,11 @@ function rewriteEnrichJsonStatus(input2) {
22778
23100
  };
22779
23101
  }
22780
23102
  }
22781
- if (isRecord8(next.columnStats) && selectedRows > 0) {
23103
+ if (isRecord10(next.columnStats) && selectedRows > 0) {
22782
23104
  const columnStats = { ...next.columnStats };
22783
23105
  for (const alias of forcedAliases) {
22784
- const stat2 = isRecord8(columnStats[alias]) ? columnStats[alias] : null;
22785
- const execution = isRecord8(stat2?.execution) ? stat2.execution : null;
23106
+ const stat2 = isRecord10(columnStats[alias]) ? columnStats[alias] : null;
23107
+ const execution = isRecord10(stat2?.execution) ? stat2.execution : null;
22786
23108
  if (!stat2 || !execution) continue;
22787
23109
  columnStats[alias] = {
22788
23110
  ...stat2,
@@ -22801,14 +23123,14 @@ function rewriteEnrichJsonStatus(input2) {
22801
23123
  return next;
22802
23124
  };
22803
23125
  const rewritten = rewrite(input2.status);
22804
- if (failedRows === 0 || !isRecord8(rewritten)) {
23126
+ if (failedRows === 0 || !isRecord10(rewritten)) {
22805
23127
  return rewritten;
22806
23128
  }
22807
23129
  const partialStatus = selectedRows > 0 && failedRows < selectedRows ? "partial_success" : "failed";
22808
23130
  return {
22809
23131
  ...rewritten,
22810
23132
  ...rewritten.status === "completed" || rewritten.status === "failed" ? { status: partialStatus } : {},
22811
- ...isRecord8(rewritten.run) && (rewritten.run.status === "completed" || rewritten.run.status === "failed") ? { run: { ...rewritten.run, status: partialStatus } } : {}
23133
+ ...isRecord10(rewritten.run) && (rewritten.run.status === "completed" || rewritten.run.status === "failed") ? { run: { ...rewritten.run, status: partialStatus } } : {}
22812
23134
  };
22813
23135
  }
22814
23136
  function summarizeFailedJobError(value) {
@@ -23414,7 +23736,7 @@ function materializeCsvCellValue(value) {
23414
23736
  return value;
23415
23737
  }
23416
23738
  function compactArrayEnvelopeCompleteValue(value) {
23417
- if (!isRecord8(value) || value.kind !== "array") {
23739
+ if (!isRecord10(value) || value.kind !== "array") {
23418
23740
  return null;
23419
23741
  }
23420
23742
  if (!Array.isArray(value.preview)) {
@@ -23428,7 +23750,7 @@ function compactArrayEnvelopeCompleteValue(value) {
23428
23750
  }
23429
23751
  function disambiguateCompactAiInferencePayload(value) {
23430
23752
  const parsed = parseMaybeJsonObject(value);
23431
- if (!isRecord8(parsed) || !cellFailureError(parsed)) {
23753
+ if (!isRecord10(parsed) || !cellFailureError(parsed)) {
23432
23754
  return value;
23433
23755
  }
23434
23756
  return {
@@ -23437,14 +23759,14 @@ function disambiguateCompactAiInferencePayload(value) {
23437
23759
  };
23438
23760
  }
23439
23761
  function compactAiInferenceCellForCsv(value) {
23440
- if (!isRecord8(value)) {
23762
+ if (!isRecord10(value)) {
23441
23763
  return value;
23442
23764
  }
23443
23765
  const extractedJson = value.extracted_json;
23444
23766
  if (extractedJson !== null && extractedJson !== void 0) {
23445
23767
  return disambiguateCompactAiInferencePayload(extractedJson);
23446
23768
  }
23447
- const result = isRecord8(value.result) ? value.result : null;
23769
+ const result = isRecord10(value.result) ? value.result : null;
23448
23770
  const object = result?.object;
23449
23771
  if (object !== null && object !== void 0) {
23450
23772
  return disambiguateCompactAiInferencePayload(object);
@@ -23461,12 +23783,12 @@ function compactAiInferenceCellForCsv(value) {
23461
23783
  }
23462
23784
  function materializeEnrichAliasCellForCsv(row, alias, options) {
23463
23785
  const direct = row[alias];
23464
- if (isRecord8(direct)) {
23786
+ if (isRecord10(direct)) {
23465
23787
  const completeArray = compactArrayEnvelopeCompleteValue(direct);
23466
23788
  if (completeArray) {
23467
23789
  return materializeCsvCellValue(completeArray);
23468
23790
  }
23469
- if (options?.compactAiCell && direct.status === "completed" && (isRecord8(direct.result) || Object.prototype.hasOwnProperty.call(direct, "extracted_json") || typeof direct.output === "string")) {
23791
+ if (options?.compactAiCell && direct.status === "completed" && (isRecord10(direct.result) || Object.prototype.hasOwnProperty.call(direct, "extracted_json") || typeof direct.output === "string")) {
23470
23792
  return materializeCsvCellValue(compactAiInferenceCellForCsv(direct));
23471
23793
  }
23472
23794
  if (Object.prototype.hasOwnProperty.call(direct, "matched_result") || Object.prototype.hasOwnProperty.call(direct, "matchedResult") || Object.prototype.hasOwnProperty.call(direct, "result")) {
@@ -23607,11 +23929,11 @@ function normalizeEnrichRowsForCsvExport(rows, config, options) {
23607
23929
  }
23608
23930
  function legacyMetadataFromRow(row) {
23609
23931
  const direct = parseLegacyMetadataCell(row._metadata);
23610
- if (direct && isRecord8(direct.columns)) {
23932
+ if (direct && isRecord10(direct.columns)) {
23611
23933
  return direct;
23612
23934
  }
23613
23935
  const relocated = parseLegacyMetadataCell(row.metadata);
23614
- if (relocated && isRecord8(relocated.columns)) {
23936
+ if (relocated && isRecord10(relocated.columns)) {
23615
23937
  return relocated;
23616
23938
  }
23617
23939
  const flattenedColumns = parseLegacyMetadataCell(row["metadata.columns"]);
@@ -23628,7 +23950,7 @@ function legacyMetadataFromRow(row) {
23628
23950
  }
23629
23951
  function parseLegacyMetadataCell(value) {
23630
23952
  const parsed = parseMaybeJsonObject(value);
23631
- if (isRecord8(parsed)) {
23953
+ if (isRecord10(parsed)) {
23632
23954
  return parsed;
23633
23955
  }
23634
23956
  if (typeof value !== "string") {
@@ -23645,12 +23967,12 @@ function parseLegacyMetadataCell(value) {
23645
23967
  for (const candidate of candidates) {
23646
23968
  try {
23647
23969
  const decoded = JSON.parse(candidate);
23648
- if (isRecord8(decoded)) {
23970
+ if (isRecord10(decoded)) {
23649
23971
  return decoded;
23650
23972
  }
23651
23973
  if (typeof decoded === "string") {
23652
23974
  const nested = JSON.parse(decoded);
23653
- if (isRecord8(nested)) {
23975
+ if (isRecord10(nested)) {
23654
23976
  return nested;
23655
23977
  }
23656
23978
  }
@@ -23660,8 +23982,8 @@ function parseLegacyMetadataCell(value) {
23660
23982
  return null;
23661
23983
  }
23662
23984
  function mergeLegacyMetadataRecords(base, enriched) {
23663
- const baseColumns = isRecord8(base.columns) ? base.columns : null;
23664
- const enrichedColumns = isRecord8(enriched.columns) ? enriched.columns : null;
23985
+ const baseColumns = isRecord10(base.columns) ? base.columns : null;
23986
+ const enrichedColumns = isRecord10(enriched.columns) ? enriched.columns : null;
23665
23987
  const merged = {
23666
23988
  ...base,
23667
23989
  ...enriched
@@ -28115,7 +28437,7 @@ function toolContractJsonForDescribe(tool, requestedToolId) {
28115
28437
  }
28116
28438
  function extractionContractEntries(entries) {
28117
28439
  return entries.flatMap((entry) => {
28118
- if (!isRecord9(entry)) return [];
28440
+ if (!isRecord11(entry)) return [];
28119
28441
  const name = stringField2(entry, "name");
28120
28442
  const expression = stringField2(entry, "expression");
28121
28443
  return name && expression ? [{ name, expression }] : [];
@@ -28136,7 +28458,7 @@ function printMonitorTypeFilters(tool) {
28136
28458
  }
28137
28459
  console.log("Deploy filters (set in the monitor payload):");
28138
28460
  for (const name of names) {
28139
- const field = isRecord9(properties[name]) ? properties[name] : {};
28461
+ const field = isRecord11(properties[name]) ? properties[name] : {};
28140
28462
  const star = required.has(name) ? "*" : "";
28141
28463
  const enumVals = arrayField2(field, "enum").filter(
28142
28464
  (v) => typeof v === "string"
@@ -28148,14 +28470,14 @@ function printMonitorTypeFilters(tool) {
28148
28470
  }
28149
28471
  function printMonitorTypeStreams(tool) {
28150
28472
  const streams = arrayField2(tool, "streams", "output_streams").filter(
28151
- isRecord9
28473
+ isRecord11
28152
28474
  );
28153
28475
  if (!streams.length) return;
28154
28476
  console.log("");
28155
28477
  console.log("Filter columns (a play's sqlListeners.where, per stream):");
28156
28478
  for (const stream of streams) {
28157
28479
  const name = stringField2(stream, "stream");
28158
- const cols = arrayField2(stream, "columns").filter(isRecord9).map((col) => stringField2(col, "name")).filter(Boolean);
28480
+ const cols = arrayField2(stream, "columns").filter(isRecord11).map((col) => stringField2(col, "name")).filter(Boolean);
28159
28481
  console.log(`- ${name}: ${cols.join(", ")}`);
28160
28482
  }
28161
28483
  }
@@ -28173,7 +28495,7 @@ function printMonitorTypePricing(tool) {
28173
28495
  }
28174
28496
  console.log("Pricing (Deepline credits per accepted event):");
28175
28497
  for (const key of keys) {
28176
- const entry = isRecord9(byType[key]) ? byType[key] : {};
28498
+ const entry = isRecord11(byType[key]) ? byType[key] : {};
28177
28499
  const credits = numberField2(entry, "deepline_credits", "deeplineCredits");
28178
28500
  const display = stringField2(entry, "display");
28179
28501
  const shown = display || (credits !== null ? `${formatDecimal(credits)} credits/event` : "see --json");
@@ -28218,8 +28540,8 @@ function printCompactToolContract(tool, requestedToolId) {
28218
28540
  return;
28219
28541
  }
28220
28542
  const contract = toolContractJsonForDescribe(tool, requestedToolId);
28221
- const cost = isRecord9(contract.cost) ? contract.cost : {};
28222
- const getters = isRecord9(contract.getters) ? contract.getters : {};
28543
+ const cost = isRecord11(contract.cost) ? contract.cost : {};
28544
+ const getters = isRecord11(contract.getters) ? contract.getters : {};
28223
28545
  const listGetters = Array.isArray(getters.extractedLists) ? getters.extractedLists : [];
28224
28546
  const valueGetters = Array.isArray(getters.extractedValues) ? getters.extractedValues : [];
28225
28547
  const inputFields = recursiveToolInputFieldsForDisplay(
@@ -28238,7 +28560,7 @@ function printCompactToolContract(tool, requestedToolId) {
28238
28560
  console.log("");
28239
28561
  console.log("Inputs:");
28240
28562
  for (const field of inputFields) {
28241
- if (!isRecord9(field)) continue;
28563
+ if (!isRecord11(field)) continue;
28242
28564
  const name = stringField2(field, "name");
28243
28565
  if (!name) continue;
28244
28566
  const required = field.required ? "*" : "";
@@ -28257,7 +28579,7 @@ function printCompactToolContract(tool, requestedToolId) {
28257
28579
  }
28258
28580
  console.log("");
28259
28581
  printToolExamplesOnly(tool, requestedToolId, { includeSamples: false });
28260
- const starterScript = isRecord9(contract.starterScript) ? contract.starterScript : {};
28582
+ const starterScript = isRecord11(contract.starterScript) ? contract.starterScript : {};
28261
28583
  const starterPath = stringField2(starterScript, "path");
28262
28584
  if (starterPath) {
28263
28585
  console.log("");
@@ -28271,14 +28593,14 @@ function printCompactToolContract(tool, requestedToolId) {
28271
28593
  console.log("Getters:");
28272
28594
  if (listGetters.length) console.log("Lists:");
28273
28595
  for (const entry of listGetters) {
28274
- if (isRecord9(entry))
28596
+ if (isRecord11(entry))
28275
28597
  console.log(
28276
28598
  `- ${stringField2(entry, "name")}: ${playResultExpression(entry)}`
28277
28599
  );
28278
28600
  }
28279
28601
  if (valueGetters.length) console.log("Values:");
28280
28602
  for (const entry of valueGetters) {
28281
- if (isRecord9(entry))
28603
+ if (isRecord11(entry))
28282
28604
  console.log(
28283
28605
  `- ${stringField2(entry, "name")}: ${playResultExpression(entry)}`
28284
28606
  );
@@ -28295,7 +28617,7 @@ function printToolPricingOnly(tool, requestedToolId, options = {}) {
28295
28617
  return;
28296
28618
  }
28297
28619
  const contract = toolContractJsonForDescribe(tool, requestedToolId);
28298
- const cost = isRecord9(contract.cost) ? contract.cost : {};
28620
+ const cost = isRecord11(contract.cost) ? contract.cost : {};
28299
28621
  const pricingModel = stringField2(cost, "pricingModel") || "unknown";
28300
28622
  const billingMode = stringField2(cost, "billingMode") || "unknown";
28301
28623
  const unit = pricingModel === "per_page" ? "page" : pricingModel === "per_result" ? "result" : pricingModel === "fixed" ? "call" : pricingModel.replace(/^per_/, "") || "unit";
@@ -28367,10 +28689,10 @@ function printToolExamplesOnly(tool, requestedToolId, options = {}) {
28367
28689
  ` input: ${JSON.stringify(sampleInput || {}, null, 2).replace(/\n/g, "\n ")},`
28368
28690
  );
28369
28691
  console.log("});");
28370
- const getters = isRecord9(contract.getters) ? contract.getters : {};
28692
+ const getters = isRecord11(contract.getters) ? contract.getters : {};
28371
28693
  const valueGetters = Array.isArray(getters.extractedValues) ? getters.extractedValues : [];
28372
28694
  const listGetters = Array.isArray(getters.extractedLists) ? getters.extractedLists : [];
28373
- const firstGetter = [...valueGetters, ...listGetters].find(isRecord9);
28695
+ const firstGetter = [...valueGetters, ...listGetters].find(isRecord11);
28374
28696
  if (firstGetter) {
28375
28697
  const name = stringField2(firstGetter, "name") || "value";
28376
28698
  const expression = stringField2(firstGetter, "expression");
@@ -28406,7 +28728,7 @@ function printPlayLikeToolUsage(tool, requestedToolId) {
28406
28728
  }
28407
28729
  function printToolGettersOnly(tool, requestedToolId) {
28408
28730
  const contract = toolContractJsonForDescribe(tool, requestedToolId);
28409
- const getters = isRecord9(contract.getters) ? contract.getters : {};
28731
+ const getters = isRecord11(contract.getters) ? contract.getters : {};
28410
28732
  const listGetters = Array.isArray(getters.extractedLists) ? getters.extractedLists : [];
28411
28733
  const valueGetters = Array.isArray(getters.extractedValues) ? getters.extractedValues : [];
28412
28734
  console.log(`Getters: ${contract.toolId}`);
@@ -28419,7 +28741,7 @@ function printToolGettersOnly(tool, requestedToolId) {
28419
28741
  if (listGetters.length) {
28420
28742
  console.log("Lists:");
28421
28743
  for (const entry of listGetters) {
28422
- if (isRecord9(entry))
28744
+ if (isRecord11(entry))
28423
28745
  console.log(
28424
28746
  `- ${stringField2(entry, "name")}: ${playResultExpression(entry)}`
28425
28747
  );
@@ -28428,7 +28750,7 @@ function printToolGettersOnly(tool, requestedToolId) {
28428
28750
  if (valueGetters.length) {
28429
28751
  console.log("Values:");
28430
28752
  for (const entry of valueGetters) {
28431
- if (isRecord9(entry))
28753
+ if (isRecord11(entry))
28432
28754
  console.log(
28433
28755
  `- ${stringField2(entry, "name")}: ${playResultExpression(entry)}`
28434
28756
  );
@@ -28454,7 +28776,7 @@ function sampleValueForField(field) {
28454
28776
  function samplePayloadForInputFields(fields) {
28455
28777
  return Object.fromEntries(
28456
28778
  fields.slice(0, 4).flatMap((field) => {
28457
- if (!isRecord9(field)) return [];
28779
+ if (!isRecord11(field)) return [];
28458
28780
  const name = stringField2(field, "name");
28459
28781
  if (!name) return [];
28460
28782
  return [[name, sampleValueForField(field)]];
@@ -28572,12 +28894,12 @@ function formatListedToolCost(tool) {
28572
28894
  }
28573
28895
  function toolInputFieldsForDisplay(inputSchema) {
28574
28896
  if (Array.isArray(inputSchema.fields))
28575
- return inputSchema.fields.filter(isRecord9);
28576
- const jsonSchema = isRecord9(inputSchema.jsonSchema) ? inputSchema.jsonSchema : inputSchema;
28577
- const properties = isRecord9(jsonSchema.properties) ? jsonSchema.properties : {};
28897
+ return inputSchema.fields.filter(isRecord11);
28898
+ const jsonSchema = isRecord11(inputSchema.jsonSchema) ? inputSchema.jsonSchema : inputSchema;
28899
+ const properties = isRecord11(jsonSchema.properties) ? jsonSchema.properties : {};
28578
28900
  const required = Array.isArray(jsonSchema.required) ? new Set(jsonSchema.required.map(String)) : /* @__PURE__ */ new Set();
28579
28901
  return Object.entries(properties).map(([name, value]) => {
28580
- const property = isRecord9(value) ? value : {};
28902
+ const property = isRecord11(value) ? value : {};
28581
28903
  return {
28582
28904
  name,
28583
28905
  type: typeof property.type === "string" ? property.type : "unknown",
@@ -28588,10 +28910,10 @@ function toolInputFieldsForDisplay(inputSchema) {
28588
28910
  });
28589
28911
  }
28590
28912
  function canonicalToolJsonSchema(inputSchema) {
28591
- return isRecord9(inputSchema.jsonSchema) ? inputSchema.jsonSchema : inputSchema;
28913
+ return isRecord11(inputSchema.jsonSchema) ? inputSchema.jsonSchema : inputSchema;
28592
28914
  }
28593
28915
  function declaredToolJsonSchema(inputSchema) {
28594
- if (isRecord9(inputSchema.jsonSchema)) {
28916
+ if (isRecord11(inputSchema.jsonSchema)) {
28595
28917
  return inputSchema.jsonSchema;
28596
28918
  }
28597
28919
  return Array.isArray(inputSchema.fields) ? null : inputSchema;
@@ -28616,7 +28938,7 @@ function publicToolInputSchemaForDescribe(inputSchema) {
28616
28938
  };
28617
28939
  const stripDescriptions = (value) => {
28618
28940
  if (Array.isArray(value)) return value.map(stripDescriptions);
28619
- if (!isRecord9(value)) return value;
28941
+ if (!isRecord11(value)) return value;
28620
28942
  return Object.fromEntries(
28621
28943
  Object.entries(value).flatMap(([key, nested]) => {
28622
28944
  if (key === "description" && typeof nested === "string" && exposesProviderSpend(nested)) {
@@ -28637,7 +28959,7 @@ function recursiveToolInputFieldsForDisplay(inputSchema) {
28637
28959
  for (const item of value) collectSchemaIds(item);
28638
28960
  return;
28639
28961
  }
28640
- if (!isRecord9(value)) return;
28962
+ if (!isRecord11(value)) return;
28641
28963
  if (typeof value.$id === "string" && value.$id.trim()) {
28642
28964
  schemasById.set(value.$id.trim(), value);
28643
28965
  }
@@ -28650,10 +28972,10 @@ function recursiveToolInputFieldsForDisplay(inputSchema) {
28650
28972
  let current = root;
28651
28973
  for (const rawSegment of ref.slice(2).split("/")) {
28652
28974
  const segment = rawSegment.replace(/~1/g, "/").replace(/~0/g, "~");
28653
- if (!isRecord9(current)) return schema;
28975
+ if (!isRecord11(current)) return schema;
28654
28976
  current = current[segment];
28655
28977
  }
28656
- return isRecord9(current) ? current : schema;
28978
+ return isRecord11(current) ? current : schema;
28657
28979
  };
28658
28980
  const addField = (field) => {
28659
28981
  const name = typeof field.name === "string" ? field.name : "";
@@ -28668,7 +28990,7 @@ function recursiveToolInputFieldsForDisplay(inputSchema) {
28668
28990
  if (ref && activeRefs.has(ref)) return;
28669
28991
  const schema = resolveRef(unresolvedSchema);
28670
28992
  const nextActiveRefs = ref ? /* @__PURE__ */ new Set([...activeRefs, ref]) : activeRefs;
28671
- 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";
28993
+ 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";
28672
28994
  if (path) {
28673
28995
  addField({
28674
28996
  name: path,
@@ -28679,12 +29001,12 @@ function recursiveToolInputFieldsForDisplay(inputSchema) {
28679
29001
  ...Object.prototype.hasOwnProperty.call(schema, "default") ? { default: schema.default } : {}
28680
29002
  });
28681
29003
  }
28682
- const properties = isRecord9(schema.properties) ? schema.properties : {};
29004
+ const properties = isRecord11(schema.properties) ? schema.properties : {};
28683
29005
  const requiredNames = new Set(
28684
29006
  Array.isArray(schema.required) ? schema.required.map(String) : []
28685
29007
  );
28686
29008
  for (const [name, value] of Object.entries(properties)) {
28687
- if (!isRecord9(value)) continue;
29009
+ if (!isRecord11(value)) continue;
28688
29010
  visit(
28689
29011
  value,
28690
29012
  path ? `${path}.${name}` : name,
@@ -28692,13 +29014,13 @@ function recursiveToolInputFieldsForDisplay(inputSchema) {
28692
29014
  nextActiveRefs
28693
29015
  );
28694
29016
  }
28695
- if (isRecord9(schema.items)) {
29017
+ if (isRecord11(schema.items)) {
28696
29018
  visit(schema.items, `${path}[]`, false, nextActiveRefs);
28697
29019
  }
28698
29020
  for (const keyword of ["anyOf", "oneOf", "allOf"]) {
28699
29021
  const branches = Array.isArray(schema[keyword]) ? schema[keyword] : [];
28700
29022
  for (const branch of branches) {
28701
- if (isRecord9(branch)) {
29023
+ if (isRecord11(branch)) {
28702
29024
  visit(branch, path, required, nextActiveRefs);
28703
29025
  }
28704
29026
  }
@@ -28726,14 +29048,14 @@ function printJsonPreview(label, payload) {
28726
29048
  }
28727
29049
  function samplePayload(samples, key) {
28728
29050
  const entry = samples[key];
28729
- if (!isRecord9(entry)) return void 0;
29051
+ if (!isRecord11(entry)) return void 0;
28730
29052
  return Object.prototype.hasOwnProperty.call(entry, "payload") ? entry.payload : entry;
28731
29053
  }
28732
29054
  function commandEnvelopeFromRawResponse(rawResponse) {
28733
- return isRecord9(rawResponse) ? { ...rawResponse } : { status: "completed", result: rawResponse };
29055
+ return isRecord11(rawResponse) ? { ...rawResponse } : { status: "completed", result: rawResponse };
28734
29056
  }
28735
29057
  function apifySyncRecoveryNext(rawResponse) {
28736
- if (!isRecord9(rawResponse) || rawResponse.status !== "running") return null;
29058
+ if (!isRecord11(rawResponse) || rawResponse.status !== "running") return null;
28737
29059
  const toolResponse = recordField2(rawResponse, "toolResponse");
28738
29060
  const raw = recordField2(toolResponse, "raw");
28739
29061
  if (raw.state !== "awaiting_apify") return null;
@@ -28756,7 +29078,7 @@ function apifySyncRecoveryNext(rawResponse) {
28756
29078
  }
28757
29079
  function listExtractorPathsFromUsageGuidance(tool) {
28758
29080
  const toolExecutionResult = tool.usageGuidance?.toolExecutionResult;
28759
- const extractedLists = Array.isArray(toolExecutionResult?.extractedLists) ? toolExecutionResult.extractedLists : isRecord9(toolExecutionResult?.extractedLists) ? Object.values(toolExecutionResult.extractedLists) : [];
29081
+ const extractedLists = Array.isArray(toolExecutionResult?.extractedLists) ? toolExecutionResult.extractedLists : isRecord11(toolExecutionResult?.extractedLists) ? Object.values(toolExecutionResult.extractedLists) : [];
28760
29082
  return extractedLists.flatMap((entry) => {
28761
29083
  const paths = entry.details?.candidatePaths ?? entry.details?.rawToolOutputPaths;
28762
29084
  if (!Array.isArray(paths)) return [];
@@ -28772,7 +29094,7 @@ function formatDecimal(value) {
28772
29094
  function formatUsd(value) {
28773
29095
  return `$${formatDecimal(value)}`;
28774
29096
  }
28775
- function isRecord9(value) {
29097
+ function isRecord11(value) {
28776
29098
  return Boolean(value && typeof value === "object" && !Array.isArray(value));
28777
29099
  }
28778
29100
  function stringField2(source, ...keys) {
@@ -28799,7 +29121,7 @@ function arrayField2(source, ...keys) {
28799
29121
  function recordField2(source, ...keys) {
28800
29122
  for (const key of keys) {
28801
29123
  const value = source[key];
28802
- if (isRecord9(value)) return value;
29124
+ if (isRecord11(value)) return value;
28803
29125
  }
28804
29126
  return {};
28805
29127
  }
@@ -28865,7 +29187,7 @@ function parseJsonObjectArgument(raw, flagName) {
28865
29187
  }
28866
29188
  throw invalidJsonError(flagName, message);
28867
29189
  }
28868
- if (!isRecord9(parsed)) {
29190
+ if (!isRecord11(parsed)) {
28869
29191
  throw invalidJsonError(flagName, "expected an object.");
28870
29192
  }
28871
29193
  return parsed;
@@ -29012,7 +29334,7 @@ function buildToolExecuteBaseEnvelope(input2) {
29012
29334
  kind: summaryEntries.length > 0 ? "object" : "raw",
29013
29335
  summary: input2.summary
29014
29336
  };
29015
- const envelopeHasCanonicalOutput = isRecord9(envelope.toolResponse) && Object.prototype.hasOwnProperty.call(envelope.toolResponse, "raw");
29337
+ const envelopeHasCanonicalOutput = isRecord11(envelope.toolResponse) && Object.prototype.hasOwnProperty.call(envelope.toolResponse, "raw");
29016
29338
  const envelopeHasDeclaredOutput = Object.prototype.hasOwnProperty.call(
29017
29339
  envelope,
29018
29340
  "output"
@@ -29242,7 +29564,7 @@ async function executeTool(args) {
29242
29564
  {
29243
29565
  ...baseEnvelope,
29244
29566
  local: {
29245
- ...isRecord9(baseEnvelope.local) ? baseEnvelope.local : {},
29567
+ ...isRecord11(baseEnvelope.local) ? baseEnvelope.local : {},
29246
29568
  payload_file: jsonPath
29247
29569
  }
29248
29570
  },