deepline 0.3.47 → 0.3.49

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.
@@ -15,6 +15,7 @@ import {
15
15
  type ToolExecutionErrorOptions,
16
16
  type ToolExecutionNetworkKind,
17
17
  type ToolExecutionNetworkScope,
18
+ type ToolExecutionPublicDetails,
18
19
  } from '../../shared_libs/plays/tool-execution-error';
19
20
 
20
21
  export {
@@ -33,6 +34,7 @@ export {
33
34
  type ToolExecutionErrorOptions,
34
35
  type ToolExecutionNetworkKind,
35
36
  type ToolExecutionNetworkScope,
37
+ type ToolExecutionPublicDetails,
36
38
  } from '../../shared_libs/plays/tool-execution-error';
37
39
 
38
40
  /**
@@ -145,6 +147,8 @@ export class ToolRateLimitError extends RateLimitError {
145
147
  readonly networkKind: ToolExecutionError['networkKind'];
146
148
  /** Network boundary that failed, or `null` for non-network failures. */
147
149
  readonly networkScope: ToolExecutionError['networkScope'];
150
+ /** Explicitly allowlisted diagnostics safe for SDK callers. */
151
+ readonly publicDetails: ToolExecutionError['publicDetails'];
148
152
 
149
153
  /** Constructed by the SDK after a structured tool HTTP 429. */
150
154
  constructor(message: string, options: ToolExecutionErrorOptions) {
@@ -161,6 +165,7 @@ export class ToolRateLimitError extends RateLimitError {
161
165
  this.requestId = options.requestId;
162
166
  this.networkKind = options.networkKind;
163
167
  this.networkScope = options.networkScope;
168
+ this.publicDetails = options.publicDetails ?? null;
164
169
  this.details = options.details;
165
170
  brandAsToolExecutionError(this);
166
171
  if (isProviderTransientFailure(this)) {
@@ -145,6 +145,7 @@ export type {
145
145
  ToolExecutionErrorOptions,
146
146
  ToolExecutionNetworkKind,
147
147
  ToolExecutionNetworkScope,
148
+ ToolExecutionPublicDetails,
148
149
  } from './errors.js';
149
150
 
150
151
  // ——— Config ———
@@ -199,7 +199,7 @@ export const SDK_RELEASE = {
199
199
  // available at toolResponse.rawV2 while toolResponse.raw and all declared
200
200
  // getters keep their established compatibility behavior.
201
201
  // 0.3.1 deprecated the legacy `deepline enrich` command in favor of Plays.
202
- version: '0.3.47',
202
+ version: '0.3.49',
203
203
  updateSummary:
204
204
  'Automatic CLI updates are now enabled by default. To opt out, run `deepline settings autoupdate off`; use `deepline settings autoupdate on` to re-enable updates or `deepline settings autoupdate pin <version>` to hold an exact release. This release also adds raw-v2 tool responses at toolResponse.rawV2 while preserving existing toolResponse.raw and declared getters.',
205
205
  packageCapabilities: {
@@ -103,6 +103,7 @@ class StructuredToolHttpError extends ToolExecutionError {
103
103
  retryAfterMs: input.options.retryAfterMs ?? null,
104
104
  networkKind: input.options.networkKind ?? null,
105
105
  networkScope: input.options.networkScope ?? null,
106
+ publicDetails: input.options.publicDetails ?? null,
106
107
  });
107
108
  this.billing = input.billing;
108
109
  this.status = input.status;
@@ -447,6 +448,7 @@ export function normalizeToolHttpErrorMessage(input: {
447
448
  (origin === 'provider' && category === 'network'
448
449
  ? 'deepline_to_provider'
449
450
  : null),
451
+ publicDetails: hydratedFailure?.publicDetails ?? null,
450
452
  };
451
453
  const billing = getObjectField(parsed, 'billing');
452
454
  if (isInsufficientCreditsBilling(billing)) {
@@ -84,6 +84,17 @@ export type ToolExecutionNetworkScope =
84
84
  | 'runtime_to_deepline'
85
85
  | 'deepline_to_provider';
86
86
 
87
+ /**
88
+ * Bounded, primitive-only diagnostics explicitly approved for customers.
89
+ * Raw provider bodies, credentials, prompts, stacks, and causes never belong
90
+ * in this shared API/SDK/Play contract.
91
+ *
92
+ * @sdkReference errors 063
93
+ */
94
+ export type ToolExecutionPublicDetails = Readonly<
95
+ Record<string, string | number | boolean | null>
96
+ >;
97
+
87
98
  /**
88
99
  * Portable version-1 `tool_error` payload.
89
100
  *
@@ -120,6 +131,8 @@ export type ToolExecutionFailureV1 = {
120
131
  networkKind: ToolExecutionNetworkKind | null;
121
132
  /** Network boundary that failed, or `null`. */
122
133
  networkScope: ToolExecutionNetworkScope | null;
134
+ /** Explicitly allowlisted customer diagnostics, when present. */
135
+ publicDetails?: ToolExecutionPublicDetails | null;
123
136
  };
124
137
 
125
138
  /**
@@ -265,6 +278,8 @@ export class ToolExecutionError extends DeeplineError {
265
278
  readonly networkKind: ToolExecutionNetworkKind | null;
266
279
  /** Network boundary that failed, or `null` for non-network failures. */
267
280
  readonly networkScope: ToolExecutionNetworkScope | null;
281
+ /** Explicitly allowlisted diagnostics safe for SDK and Play callers. */
282
+ readonly publicDetails: ToolExecutionPublicDetails | null;
268
283
 
269
284
  /**
270
285
  * Construct a structured tool error.
@@ -290,6 +305,7 @@ export class ToolExecutionError extends DeeplineError {
290
305
  this.retryAfterMs = options.retryAfterMs;
291
306
  this.networkKind = options.networkKind;
292
307
  this.networkScope = options.networkScope;
308
+ this.publicDetails = options.publicDetails ?? null;
293
309
  applyBrand(this, TOOL_EXECUTION_ERROR_BRAND);
294
310
  if (isProviderTransientFailure(options)) {
295
311
  applyBrand(this, PROVIDER_TRANSIENT_ERROR_BRAND);
@@ -547,6 +563,69 @@ function isRecord(value: unknown): value is Record<string, unknown> {
547
563
  return value !== null && typeof value === 'object' && !Array.isArray(value);
548
564
  }
549
565
 
566
+ const MAX_PUBLIC_DETAIL_ENTRIES = 20;
567
+ const MAX_PUBLIC_DETAIL_KEY_LENGTH = 80;
568
+ const MAX_PUBLIC_DETAIL_STRING_LENGTH = 512;
569
+ const publicDetailsByError = new WeakMap<Error, ToolExecutionPublicDetails>();
570
+
571
+ /**
572
+ * Normalizes the one public-detail shape at every transport boundary. Nested
573
+ * values are rejected to prevent accidental disclosure of provider responses.
574
+ */
575
+ export function normalizeToolExecutionPublicDetails(
576
+ value: unknown,
577
+ ): ToolExecutionPublicDetails | null {
578
+ if (!isRecord(value)) return null;
579
+ const details: Record<string, string | number | boolean | null> = {};
580
+ for (const [key, entry] of Object.entries(value)) {
581
+ if (Object.keys(details).length >= MAX_PUBLIC_DETAIL_ENTRIES) break;
582
+ if (
583
+ key.length === 0 ||
584
+ key.length > MAX_PUBLIC_DETAIL_KEY_LENGTH ||
585
+ !/^[a-z][a-zA-Z0-9_]*$/.test(key)
586
+ ) {
587
+ continue;
588
+ }
589
+ if (typeof entry === 'string') {
590
+ if (entry.length <= MAX_PUBLIC_DETAIL_STRING_LENGTH) details[key] = entry;
591
+ continue;
592
+ }
593
+ if (typeof entry === 'number') {
594
+ if (Number.isFinite(entry)) details[key] = entry;
595
+ continue;
596
+ }
597
+ if (typeof entry === 'boolean') {
598
+ details[key] = entry;
599
+ continue;
600
+ }
601
+ if (entry === null) details[key] = null;
602
+ }
603
+ return Object.keys(details).length > 0 ? details : null;
604
+ }
605
+
606
+ /**
607
+ * Attaches allowlisted details to an in-process error without making them
608
+ * enumerable. The execute boundary can later serialize them through the
609
+ * portable `tool_error.publicDetails` field.
610
+ */
611
+ export function withToolExecutionPublicDetails<T extends Error>(
612
+ error: T,
613
+ details: unknown,
614
+ ): T {
615
+ const normalized = normalizeToolExecutionPublicDetails(details);
616
+ if (normalized) publicDetailsByError.set(error, normalized);
617
+ return error;
618
+ }
619
+
620
+ /** Reads details deliberately attached through `withToolExecutionPublicDetails`. */
621
+ export function getToolExecutionPublicDetails(
622
+ error: unknown,
623
+ ): ToolExecutionPublicDetails | null {
624
+ return error instanceof Error
625
+ ? (publicDetailsByError.get(error) ?? null)
626
+ : null;
627
+ }
628
+
550
629
  export function normalizeToolExecutionFailure(
551
630
  value: unknown,
552
631
  ): ToolExecutionFailureV1 | null {
@@ -565,6 +644,7 @@ export function normalizeToolExecutionFailure(
565
644
  operation,
566
645
  });
567
646
  const category = normalizeToolExecutionCategory(value.category);
647
+ const publicDetails = normalizeToolExecutionPublicDetails(value.publicDetails);
568
648
  const trustworthy =
569
649
  origin !== 'unknown' &&
570
650
  category !== 'unknown' &&
@@ -583,6 +663,7 @@ export function normalizeToolExecutionFailure(
583
663
  retryAfterMs: finiteNonNegativeInteger(value.retryAfterMs),
584
664
  networkKind: normalizeNetworkKind(value.networkKind),
585
665
  networkScope: normalizeNetworkScope(value.networkScope),
666
+ ...(publicDetails ? { publicDetails } : {}),
586
667
  };
587
668
  }
588
669
 
@@ -604,6 +685,7 @@ export function serializeToolExecutionFailure(
604
685
  retryAfterMs: error.retryAfterMs,
605
686
  networkKind: error.networkKind,
606
687
  networkScope: error.networkScope,
688
+ publicDetails: error.publicDetails,
607
689
  });
608
690
  }
609
691
 
@@ -84,6 +84,17 @@ export type ToolExecutionNetworkScope =
84
84
  | 'runtime_to_deepline'
85
85
  | 'deepline_to_provider';
86
86
 
87
+ /**
88
+ * Bounded, primitive-only diagnostics explicitly approved for customers.
89
+ * Raw provider bodies, credentials, prompts, stacks, and causes never belong
90
+ * in this shared API/SDK/Play contract.
91
+ *
92
+ * @sdkReference errors 063
93
+ */
94
+ export type ToolExecutionPublicDetails = Readonly<
95
+ Record<string, string | number | boolean | null>
96
+ >;
97
+
87
98
  /**
88
99
  * Portable version-1 `tool_error` payload.
89
100
  *
@@ -120,6 +131,8 @@ export type ToolExecutionFailureV1 = {
120
131
  networkKind: ToolExecutionNetworkKind | null;
121
132
  /** Network boundary that failed, or `null`. */
122
133
  networkScope: ToolExecutionNetworkScope | null;
134
+ /** Explicitly allowlisted customer diagnostics, when present. */
135
+ publicDetails?: ToolExecutionPublicDetails | null;
123
136
  };
124
137
 
125
138
  /**
@@ -265,6 +278,8 @@ export class ToolExecutionError extends DeeplineError {
265
278
  readonly networkKind: ToolExecutionNetworkKind | null;
266
279
  /** Network boundary that failed, or `null` for non-network failures. */
267
280
  readonly networkScope: ToolExecutionNetworkScope | null;
281
+ /** Explicitly allowlisted diagnostics safe for SDK and Play callers. */
282
+ readonly publicDetails: ToolExecutionPublicDetails | null;
268
283
 
269
284
  /**
270
285
  * Construct a structured tool error.
@@ -290,6 +305,7 @@ export class ToolExecutionError extends DeeplineError {
290
305
  this.retryAfterMs = options.retryAfterMs;
291
306
  this.networkKind = options.networkKind;
292
307
  this.networkScope = options.networkScope;
308
+ this.publicDetails = options.publicDetails ?? null;
293
309
  applyBrand(this, TOOL_EXECUTION_ERROR_BRAND);
294
310
  if (isProviderTransientFailure(options)) {
295
311
  applyBrand(this, PROVIDER_TRANSIENT_ERROR_BRAND);
@@ -547,6 +563,69 @@ function isRecord(value: unknown): value is Record<string, unknown> {
547
563
  return value !== null && typeof value === 'object' && !Array.isArray(value);
548
564
  }
549
565
 
566
+ const MAX_PUBLIC_DETAIL_ENTRIES = 20;
567
+ const MAX_PUBLIC_DETAIL_KEY_LENGTH = 80;
568
+ const MAX_PUBLIC_DETAIL_STRING_LENGTH = 512;
569
+ const publicDetailsByError = new WeakMap<Error, ToolExecutionPublicDetails>();
570
+
571
+ /**
572
+ * Normalizes the one public-detail shape at every transport boundary. Nested
573
+ * values are rejected to prevent accidental disclosure of provider responses.
574
+ */
575
+ export function normalizeToolExecutionPublicDetails(
576
+ value: unknown,
577
+ ): ToolExecutionPublicDetails | null {
578
+ if (!isRecord(value)) return null;
579
+ const details: Record<string, string | number | boolean | null> = {};
580
+ for (const [key, entry] of Object.entries(value)) {
581
+ if (Object.keys(details).length >= MAX_PUBLIC_DETAIL_ENTRIES) break;
582
+ if (
583
+ key.length === 0 ||
584
+ key.length > MAX_PUBLIC_DETAIL_KEY_LENGTH ||
585
+ !/^[a-z][a-zA-Z0-9_]*$/.test(key)
586
+ ) {
587
+ continue;
588
+ }
589
+ if (typeof entry === 'string') {
590
+ if (entry.length <= MAX_PUBLIC_DETAIL_STRING_LENGTH) details[key] = entry;
591
+ continue;
592
+ }
593
+ if (typeof entry === 'number') {
594
+ if (Number.isFinite(entry)) details[key] = entry;
595
+ continue;
596
+ }
597
+ if (typeof entry === 'boolean') {
598
+ details[key] = entry;
599
+ continue;
600
+ }
601
+ if (entry === null) details[key] = null;
602
+ }
603
+ return Object.keys(details).length > 0 ? details : null;
604
+ }
605
+
606
+ /**
607
+ * Attaches allowlisted details to an in-process error without making them
608
+ * enumerable. The execute boundary can later serialize them through the
609
+ * portable `tool_error.publicDetails` field.
610
+ */
611
+ export function withToolExecutionPublicDetails<T extends Error>(
612
+ error: T,
613
+ details: unknown,
614
+ ): T {
615
+ const normalized = normalizeToolExecutionPublicDetails(details);
616
+ if (normalized) publicDetailsByError.set(error, normalized);
617
+ return error;
618
+ }
619
+
620
+ /** Reads details deliberately attached through `withToolExecutionPublicDetails`. */
621
+ export function getToolExecutionPublicDetails(
622
+ error: unknown,
623
+ ): ToolExecutionPublicDetails | null {
624
+ return error instanceof Error
625
+ ? (publicDetailsByError.get(error) ?? null)
626
+ : null;
627
+ }
628
+
550
629
  export function normalizeToolExecutionFailure(
551
630
  value: unknown,
552
631
  ): ToolExecutionFailureV1 | null {
@@ -565,6 +644,7 @@ export function normalizeToolExecutionFailure(
565
644
  operation,
566
645
  });
567
646
  const category = normalizeToolExecutionCategory(value.category);
647
+ const publicDetails = normalizeToolExecutionPublicDetails(value.publicDetails);
568
648
  const trustworthy =
569
649
  origin !== 'unknown' &&
570
650
  category !== 'unknown' &&
@@ -583,6 +663,7 @@ export function normalizeToolExecutionFailure(
583
663
  retryAfterMs: finiteNonNegativeInteger(value.retryAfterMs),
584
664
  networkKind: normalizeNetworkKind(value.networkKind),
585
665
  networkScope: normalizeNetworkScope(value.networkScope),
666
+ ...(publicDetails ? { publicDetails } : {}),
586
667
  };
587
668
  }
588
669
 
@@ -604,6 +685,7 @@ export function serializeToolExecutionFailure(
604
685
  retryAfterMs: error.retryAfterMs,
605
686
  networkKind: error.networkKind,
606
687
  networkScope: error.networkScope,
688
+ publicDetails: error.publicDetails,
607
689
  });
608
690
  }
609
691
 
package/dist/cli/index.js CHANGED
@@ -282,6 +282,8 @@ var ToolExecutionError = class _ToolExecutionError extends DeeplineError {
282
282
  networkKind;
283
283
  /** Network boundary that failed, or `null` for non-network failures. */
284
284
  networkScope;
285
+ /** Explicitly allowlisted diagnostics safe for SDK and Play callers. */
286
+ publicDetails;
285
287
  /**
286
288
  * Construct a structured tool error.
287
289
  *
@@ -306,6 +308,7 @@ var ToolExecutionError = class _ToolExecutionError extends DeeplineError {
306
308
  this.retryAfterMs = options.retryAfterMs;
307
309
  this.networkKind = options.networkKind;
308
310
  this.networkScope = options.networkScope;
311
+ this.publicDetails = options.publicDetails ?? null;
309
312
  applyBrand(this, TOOL_EXECUTION_ERROR_BRAND);
310
313
  if (isProviderTransientFailure(options)) {
311
314
  applyBrand(this, PROVIDER_TRANSIENT_ERROR_BRAND);
@@ -417,6 +420,33 @@ function normalizeNetworkScope(value) {
417
420
  function isRecord(value) {
418
421
  return value !== null && typeof value === "object" && !Array.isArray(value);
419
422
  }
423
+ var MAX_PUBLIC_DETAIL_ENTRIES = 20;
424
+ var MAX_PUBLIC_DETAIL_KEY_LENGTH = 80;
425
+ var MAX_PUBLIC_DETAIL_STRING_LENGTH = 512;
426
+ function normalizeToolExecutionPublicDetails(value) {
427
+ if (!isRecord(value)) return null;
428
+ const details = {};
429
+ for (const [key, entry] of Object.entries(value)) {
430
+ if (Object.keys(details).length >= MAX_PUBLIC_DETAIL_ENTRIES) break;
431
+ if (key.length === 0 || key.length > MAX_PUBLIC_DETAIL_KEY_LENGTH || !/^[a-z][a-zA-Z0-9_]*$/.test(key)) {
432
+ continue;
433
+ }
434
+ if (typeof entry === "string") {
435
+ if (entry.length <= MAX_PUBLIC_DETAIL_STRING_LENGTH) details[key] = entry;
436
+ continue;
437
+ }
438
+ if (typeof entry === "number") {
439
+ if (Number.isFinite(entry)) details[key] = entry;
440
+ continue;
441
+ }
442
+ if (typeof entry === "boolean") {
443
+ details[key] = entry;
444
+ continue;
445
+ }
446
+ if (entry === null) details[key] = null;
447
+ }
448
+ return Object.keys(details).length > 0 ? details : null;
449
+ }
420
450
  function normalizeToolExecutionFailure(value) {
421
451
  if (!isRecord(value) || value.schemaVersion !== TOOL_EXECUTION_ERROR_SCHEMA_VERSION) {
422
452
  return null;
@@ -430,6 +460,7 @@ function normalizeToolExecutionFailure(value) {
430
460
  operation
431
461
  });
432
462
  const category = normalizeToolExecutionCategory(value.category);
463
+ const publicDetails = normalizeToolExecutionPublicDetails(value.publicDetails);
433
464
  const trustworthy = origin !== "unknown" && category !== "unknown" && typeof value.retryable === "boolean";
434
465
  return {
435
466
  schemaVersion: TOOL_EXECUTION_ERROR_SCHEMA_VERSION,
@@ -444,7 +475,8 @@ function normalizeToolExecutionFailure(value) {
444
475
  requestId: boundedString(value.requestId),
445
476
  retryAfterMs: finiteNonNegativeInteger(value.retryAfterMs),
446
477
  networkKind: normalizeNetworkKind(value.networkKind),
447
- networkScope: normalizeNetworkScope(value.networkScope)
478
+ networkScope: normalizeNetworkScope(value.networkScope),
479
+ ...publicDetails ? { publicDetails } : {}
448
480
  };
449
481
  }
450
482
  function serializeToolExecutionFailure(error) {
@@ -462,7 +494,8 @@ function serializeToolExecutionFailure(error) {
462
494
  requestId: error.requestId,
463
495
  retryAfterMs: error.retryAfterMs,
464
496
  networkKind: error.networkKind,
465
- networkScope: error.networkScope
497
+ networkScope: error.networkScope,
498
+ publicDetails: error.publicDetails
466
499
  });
467
500
  }
468
501
  function deserializeToolExecutionFailure(message, value, acceptedSchemaVersion) {
@@ -520,6 +553,8 @@ var ToolRateLimitError = class extends RateLimitError {
520
553
  networkKind;
521
554
  /** Network boundary that failed, or `null` for non-network failures. */
522
555
  networkScope;
556
+ /** Explicitly allowlisted diagnostics safe for SDK callers. */
557
+ publicDetails;
523
558
  /** Constructed by the SDK after a structured tool HTTP 429. */
524
559
  constructor(message, options) {
525
560
  super(options.retryAfterMs ?? 5e3, message);
@@ -535,6 +570,7 @@ var ToolRateLimitError = class extends RateLimitError {
535
570
  this.requestId = options.requestId;
536
571
  this.networkKind = options.networkKind;
537
572
  this.networkScope = options.networkScope;
573
+ this.publicDetails = options.publicDetails ?? null;
538
574
  this.details = options.details;
539
575
  brandAsToolExecutionError(this);
540
576
  if (isProviderTransientFailure(this)) {
@@ -1043,7 +1079,7 @@ var SDK_RELEASE = {
1043
1079
  // available at toolResponse.rawV2 while toolResponse.raw and all declared
1044
1080
  // getters keep their established compatibility behavior.
1045
1081
  // 0.3.1 deprecated the legacy `deepline enrich` command in favor of Plays.
1046
- version: "0.3.47",
1082
+ version: "0.3.49",
1047
1083
  updateSummary: "Automatic CLI updates are now enabled by default. To opt out, run `deepline settings autoupdate off`; use `deepline settings autoupdate on` to re-enable updates or `deepline settings autoupdate pin <version>` to hold an exact release. This release also adds raw-v2 tool responses at toolResponse.rawV2 while preserving existing toolResponse.raw and declared getters.",
1048
1084
  packageCapabilities: {
1049
1085
  updatePreferences: 1
@@ -268,6 +268,8 @@ var ToolExecutionError = class _ToolExecutionError extends DeeplineError {
268
268
  networkKind;
269
269
  /** Network boundary that failed, or `null` for non-network failures. */
270
270
  networkScope;
271
+ /** Explicitly allowlisted diagnostics safe for SDK and Play callers. */
272
+ publicDetails;
271
273
  /**
272
274
  * Construct a structured tool error.
273
275
  *
@@ -292,6 +294,7 @@ var ToolExecutionError = class _ToolExecutionError extends DeeplineError {
292
294
  this.retryAfterMs = options.retryAfterMs;
293
295
  this.networkKind = options.networkKind;
294
296
  this.networkScope = options.networkScope;
297
+ this.publicDetails = options.publicDetails ?? null;
295
298
  applyBrand(this, TOOL_EXECUTION_ERROR_BRAND);
296
299
  if (isProviderTransientFailure(options)) {
297
300
  applyBrand(this, PROVIDER_TRANSIENT_ERROR_BRAND);
@@ -403,6 +406,33 @@ function normalizeNetworkScope(value) {
403
406
  function isRecord(value) {
404
407
  return value !== null && typeof value === "object" && !Array.isArray(value);
405
408
  }
409
+ var MAX_PUBLIC_DETAIL_ENTRIES = 20;
410
+ var MAX_PUBLIC_DETAIL_KEY_LENGTH = 80;
411
+ var MAX_PUBLIC_DETAIL_STRING_LENGTH = 512;
412
+ function normalizeToolExecutionPublicDetails(value) {
413
+ if (!isRecord(value)) return null;
414
+ const details = {};
415
+ for (const [key, entry] of Object.entries(value)) {
416
+ if (Object.keys(details).length >= MAX_PUBLIC_DETAIL_ENTRIES) break;
417
+ if (key.length === 0 || key.length > MAX_PUBLIC_DETAIL_KEY_LENGTH || !/^[a-z][a-zA-Z0-9_]*$/.test(key)) {
418
+ continue;
419
+ }
420
+ if (typeof entry === "string") {
421
+ if (entry.length <= MAX_PUBLIC_DETAIL_STRING_LENGTH) details[key] = entry;
422
+ continue;
423
+ }
424
+ if (typeof entry === "number") {
425
+ if (Number.isFinite(entry)) details[key] = entry;
426
+ continue;
427
+ }
428
+ if (typeof entry === "boolean") {
429
+ details[key] = entry;
430
+ continue;
431
+ }
432
+ if (entry === null) details[key] = null;
433
+ }
434
+ return Object.keys(details).length > 0 ? details : null;
435
+ }
406
436
  function normalizeToolExecutionFailure(value) {
407
437
  if (!isRecord(value) || value.schemaVersion !== TOOL_EXECUTION_ERROR_SCHEMA_VERSION) {
408
438
  return null;
@@ -416,6 +446,7 @@ function normalizeToolExecutionFailure(value) {
416
446
  operation
417
447
  });
418
448
  const category = normalizeToolExecutionCategory(value.category);
449
+ const publicDetails = normalizeToolExecutionPublicDetails(value.publicDetails);
419
450
  const trustworthy = origin !== "unknown" && category !== "unknown" && typeof value.retryable === "boolean";
420
451
  return {
421
452
  schemaVersion: TOOL_EXECUTION_ERROR_SCHEMA_VERSION,
@@ -430,7 +461,8 @@ function normalizeToolExecutionFailure(value) {
430
461
  requestId: boundedString(value.requestId),
431
462
  retryAfterMs: finiteNonNegativeInteger(value.retryAfterMs),
432
463
  networkKind: normalizeNetworkKind(value.networkKind),
433
- networkScope: normalizeNetworkScope(value.networkScope)
464
+ networkScope: normalizeNetworkScope(value.networkScope),
465
+ ...publicDetails ? { publicDetails } : {}
434
466
  };
435
467
  }
436
468
  function serializeToolExecutionFailure(error) {
@@ -448,7 +480,8 @@ function serializeToolExecutionFailure(error) {
448
480
  requestId: error.requestId,
449
481
  retryAfterMs: error.retryAfterMs,
450
482
  networkKind: error.networkKind,
451
- networkScope: error.networkScope
483
+ networkScope: error.networkScope,
484
+ publicDetails: error.publicDetails
452
485
  });
453
486
  }
454
487
  function deserializeToolExecutionFailure(message, value, acceptedSchemaVersion) {
@@ -506,6 +539,8 @@ var ToolRateLimitError = class extends RateLimitError {
506
539
  networkKind;
507
540
  /** Network boundary that failed, or `null` for non-network failures. */
508
541
  networkScope;
542
+ /** Explicitly allowlisted diagnostics safe for SDK callers. */
543
+ publicDetails;
509
544
  /** Constructed by the SDK after a structured tool HTTP 429. */
510
545
  constructor(message, options) {
511
546
  super(options.retryAfterMs ?? 5e3, message);
@@ -521,6 +556,7 @@ var ToolRateLimitError = class extends RateLimitError {
521
556
  this.requestId = options.requestId;
522
557
  this.networkKind = options.networkKind;
523
558
  this.networkScope = options.networkScope;
559
+ this.publicDetails = options.publicDetails ?? null;
524
560
  this.details = options.details;
525
561
  brandAsToolExecutionError(this);
526
562
  if (isProviderTransientFailure(this)) {
@@ -1029,7 +1065,7 @@ var SDK_RELEASE = {
1029
1065
  // available at toolResponse.rawV2 while toolResponse.raw and all declared
1030
1066
  // getters keep their established compatibility behavior.
1031
1067
  // 0.3.1 deprecated the legacy `deepline enrich` command in favor of Plays.
1032
- version: "0.3.47",
1068
+ version: "0.3.49",
1033
1069
  updateSummary: "Automatic CLI updates are now enabled by default. To opt out, run `deepline settings autoupdate off`; use `deepline settings autoupdate on` to re-enable updates or `deepline settings autoupdate pin <version>` to hold an exact release. This release also adds raw-v2 tool responses at toolResponse.rawV2 while preserving existing toolResponse.raw and declared getters.",
1034
1070
  packageCapabilities: {
1035
1071
  updatePreferences: 1
@@ -42,6 +42,14 @@ type ToolExecutionNetworkKind = 'timeout' | 'dns' | 'connect' | 'reset' | 'unava
42
42
  * @sdkReference errors 050
43
43
  */
44
44
  type ToolExecutionNetworkScope = 'client_to_deepline' | 'runtime_to_deepline' | 'deepline_to_provider';
45
+ /**
46
+ * Bounded, primitive-only diagnostics explicitly approved for customers.
47
+ * Raw provider bodies, credentials, prompts, stacks, and causes never belong
48
+ * in this shared API/SDK/Play contract.
49
+ *
50
+ * @sdkReference errors 063
51
+ */
52
+ type ToolExecutionPublicDetails = Readonly<Record<string, string | number | boolean | null>>;
45
53
  /**
46
54
  * Portable version-1 `tool_error` payload.
47
55
  *
@@ -78,6 +86,8 @@ type ToolExecutionFailureV1 = {
78
86
  networkKind: ToolExecutionNetworkKind | null;
79
87
  /** Network boundary that failed, or `null`. */
80
88
  networkScope: ToolExecutionNetworkScope | null;
89
+ /** Explicitly allowlisted customer diagnostics, when present. */
90
+ publicDetails?: ToolExecutionPublicDetails | null;
81
91
  };
82
92
  /**
83
93
  * Constructor input for a structured tool failure.
@@ -170,6 +180,8 @@ declare class ToolExecutionError extends DeeplineError {
170
180
  readonly networkKind: ToolExecutionNetworkKind | null;
171
181
  /** Network boundary that failed, or `null` for non-network failures. */
172
182
  readonly networkScope: ToolExecutionNetworkScope | null;
183
+ /** Explicitly allowlisted diagnostics safe for SDK and Play callers. */
184
+ readonly publicDetails: ToolExecutionPublicDetails | null;
173
185
  /**
174
186
  * Construct a structured tool error.
175
187
  *
@@ -2941,4 +2953,4 @@ type PlayCompilerManifest = {
2941
2953
  authoringContract?: AdmittedPlayAuthoringContract;
2942
2954
  };
2943
2955
 
2944
- export { PHONE_STATUS_VALUES as $, type PlayAuthoringCallExecution as A, type PlayAuthoringCallOptions as B, type PlayAuthoringFetchResponse as C, DeeplineError as D, type PlayAuthoringInputContract as E, type PlayAuthoringStepProgramStep as F, type PlayAuthoringRuntimeStepOptions as G, type PlaySqlListenerDeclaration as H, type PlaySqlListenerEvent as I, type PlaySqlListenerOperation as J, type PlaySqlQuery as K, type PlayAuthoringStepOptions as L, type PlayAuthoringStepProgram as M, type PlayAuthoringStepProgramResolver as N, type PlayAuthoringStepResolver as O, type PlayArtifactKind as P, type PlayToolExecutionRequest as Q, type PlayAuthoringStepProgramOptions as R, DEEPLINE_EXTRACTOR_TARGETS as S, ToolExecutionError as T, DEEPLINE_EXTRACTOR_TARGET_DEFINITIONS as U, type DeeplineEmailStatusGetterValue as V, type DeeplineExtractorTarget as W, type DeeplineGetterValue as X, type DeeplineGetterValueMap as Y, JOB_CHANGE_STATUS_VALUES as Z, type JobChangeStatus as _, type PlayBundleArtifact as a, type PhoneStatus as a0, type PlayDataset as a1, type PlayDatasetInput as a2, type PreviousCell as a3, ProviderTransientError as a4, type ProviderTransientErrorCategory as a5, type ProviderUnavailableError as a6, type ProviderUnavailableReason as a7, type ToolExecutionErrorCategory as a8, type ToolExecutionErrorOrigin as a9, type ToolExecutionFailureV1 as aa, type ToolExecutionNetworkKind as ab, type ToolExecutionNetworkScope as ac, getProviderUnavailableReason as ad, isDeeplineExtractorTarget as ae, isProviderUnavailable as af, isProviderWaterfallUnavailableError as ag, type PlaySandboxRuntimeDeclaration as b, type PlayCompilerManifest as c, PLAY_ARTIFACT_KINDS as d, type PlayArtifactCompatibility as e, type PlayImportPolicy as f, type PlayPackageImport as g, type PlayRuntimeFeature as h, type ToolExecutionErrorOptions as i, type PlayAuthoringColumnMap as j, type PlayAuthoringColumnResolver as k, type PlayAuthoringRuntimeContext as l, type PlayAuthoringConditionalStepResolver as m, type PlayAuthoringCsvInput as n, type PlayAuthoringCsvOptions as o, type PlayAuthoringDatasetBuilder as p, type PlayAuthoringDatasetColumnDefinition as q, type PlayAuthoringDatasetColumnRunInput as r, type ToolExecuteResult as s, type PlayAuthoringReferenceLike as t, type PlayReturnObject as u, type PlayAuthoringDefineConfig as v, type PlayAuthoringDefinedPlay as w, type PlayAuthoringFetchOptions as x, type PlayAuthoringFileInput as y, type PlayAuthoringBindings as z };
2956
+ export { PHONE_STATUS_VALUES as $, type PlayAuthoringCallExecution as A, type PlayAuthoringCallOptions as B, type PlayAuthoringFetchResponse as C, DeeplineError as D, type PlayAuthoringInputContract as E, type PlayAuthoringStepProgramStep as F, type PlayAuthoringRuntimeStepOptions as G, type PlaySqlListenerDeclaration as H, type PlaySqlListenerEvent as I, type PlaySqlListenerOperation as J, type PlaySqlQuery as K, type PlayAuthoringStepOptions as L, type PlayAuthoringStepProgram as M, type PlayAuthoringStepProgramResolver as N, type PlayAuthoringStepResolver as O, type PlayArtifactKind as P, type PlayToolExecutionRequest as Q, type PlayAuthoringStepProgramOptions as R, DEEPLINE_EXTRACTOR_TARGETS as S, ToolExecutionError as T, DEEPLINE_EXTRACTOR_TARGET_DEFINITIONS as U, type DeeplineEmailStatusGetterValue as V, type DeeplineExtractorTarget as W, type DeeplineGetterValue as X, type DeeplineGetterValueMap as Y, JOB_CHANGE_STATUS_VALUES as Z, type JobChangeStatus as _, type PlayBundleArtifact as a, type PhoneStatus as a0, type PlayDataset as a1, type PlayDatasetInput as a2, type PreviousCell as a3, ProviderTransientError as a4, type ProviderTransientErrorCategory as a5, type ProviderUnavailableError as a6, type ProviderUnavailableReason as a7, type ToolExecutionErrorCategory as a8, type ToolExecutionErrorOrigin as a9, type ToolExecutionFailureV1 as aa, type ToolExecutionNetworkKind as ab, type ToolExecutionNetworkScope as ac, type ToolExecutionPublicDetails as ad, getProviderUnavailableReason as ae, isDeeplineExtractorTarget as af, isProviderUnavailable as ag, isProviderWaterfallUnavailableError as ah, type PlaySandboxRuntimeDeclaration as b, type PlayCompilerManifest as c, PLAY_ARTIFACT_KINDS as d, type PlayArtifactCompatibility as e, type PlayImportPolicy as f, type PlayPackageImport as g, type PlayRuntimeFeature as h, type ToolExecutionErrorOptions as i, type PlayAuthoringColumnMap as j, type PlayAuthoringColumnResolver as k, type PlayAuthoringRuntimeContext as l, type PlayAuthoringConditionalStepResolver as m, type PlayAuthoringCsvInput as n, type PlayAuthoringCsvOptions as o, type PlayAuthoringDatasetBuilder as p, type PlayAuthoringDatasetColumnDefinition as q, type PlayAuthoringDatasetColumnRunInput as r, type ToolExecuteResult as s, type PlayAuthoringReferenceLike as t, type PlayReturnObject as u, type PlayAuthoringDefineConfig as v, type PlayAuthoringDefinedPlay as w, type PlayAuthoringFetchOptions as x, type PlayAuthoringFileInput as y, type PlayAuthoringBindings as z };
@@ -42,6 +42,14 @@ type ToolExecutionNetworkKind = 'timeout' | 'dns' | 'connect' | 'reset' | 'unava
42
42
  * @sdkReference errors 050
43
43
  */
44
44
  type ToolExecutionNetworkScope = 'client_to_deepline' | 'runtime_to_deepline' | 'deepline_to_provider';
45
+ /**
46
+ * Bounded, primitive-only diagnostics explicitly approved for customers.
47
+ * Raw provider bodies, credentials, prompts, stacks, and causes never belong
48
+ * in this shared API/SDK/Play contract.
49
+ *
50
+ * @sdkReference errors 063
51
+ */
52
+ type ToolExecutionPublicDetails = Readonly<Record<string, string | number | boolean | null>>;
45
53
  /**
46
54
  * Portable version-1 `tool_error` payload.
47
55
  *
@@ -78,6 +86,8 @@ type ToolExecutionFailureV1 = {
78
86
  networkKind: ToolExecutionNetworkKind | null;
79
87
  /** Network boundary that failed, or `null`. */
80
88
  networkScope: ToolExecutionNetworkScope | null;
89
+ /** Explicitly allowlisted customer diagnostics, when present. */
90
+ publicDetails?: ToolExecutionPublicDetails | null;
81
91
  };
82
92
  /**
83
93
  * Constructor input for a structured tool failure.
@@ -170,6 +180,8 @@ declare class ToolExecutionError extends DeeplineError {
170
180
  readonly networkKind: ToolExecutionNetworkKind | null;
171
181
  /** Network boundary that failed, or `null` for non-network failures. */
172
182
  readonly networkScope: ToolExecutionNetworkScope | null;
183
+ /** Explicitly allowlisted diagnostics safe for SDK and Play callers. */
184
+ readonly publicDetails: ToolExecutionPublicDetails | null;
173
185
  /**
174
186
  * Construct a structured tool error.
175
187
  *
@@ -2941,4 +2953,4 @@ type PlayCompilerManifest = {
2941
2953
  authoringContract?: AdmittedPlayAuthoringContract;
2942
2954
  };
2943
2955
 
2944
- export { PHONE_STATUS_VALUES as $, type PlayAuthoringCallExecution as A, type PlayAuthoringCallOptions as B, type PlayAuthoringFetchResponse as C, DeeplineError as D, type PlayAuthoringInputContract as E, type PlayAuthoringStepProgramStep as F, type PlayAuthoringRuntimeStepOptions as G, type PlaySqlListenerDeclaration as H, type PlaySqlListenerEvent as I, type PlaySqlListenerOperation as J, type PlaySqlQuery as K, type PlayAuthoringStepOptions as L, type PlayAuthoringStepProgram as M, type PlayAuthoringStepProgramResolver as N, type PlayAuthoringStepResolver as O, type PlayArtifactKind as P, type PlayToolExecutionRequest as Q, type PlayAuthoringStepProgramOptions as R, DEEPLINE_EXTRACTOR_TARGETS as S, ToolExecutionError as T, DEEPLINE_EXTRACTOR_TARGET_DEFINITIONS as U, type DeeplineEmailStatusGetterValue as V, type DeeplineExtractorTarget as W, type DeeplineGetterValue as X, type DeeplineGetterValueMap as Y, JOB_CHANGE_STATUS_VALUES as Z, type JobChangeStatus as _, type PlayBundleArtifact as a, type PhoneStatus as a0, type PlayDataset as a1, type PlayDatasetInput as a2, type PreviousCell as a3, ProviderTransientError as a4, type ProviderTransientErrorCategory as a5, type ProviderUnavailableError as a6, type ProviderUnavailableReason as a7, type ToolExecutionErrorCategory as a8, type ToolExecutionErrorOrigin as a9, type ToolExecutionFailureV1 as aa, type ToolExecutionNetworkKind as ab, type ToolExecutionNetworkScope as ac, getProviderUnavailableReason as ad, isDeeplineExtractorTarget as ae, isProviderUnavailable as af, isProviderWaterfallUnavailableError as ag, type PlaySandboxRuntimeDeclaration as b, type PlayCompilerManifest as c, PLAY_ARTIFACT_KINDS as d, type PlayArtifactCompatibility as e, type PlayImportPolicy as f, type PlayPackageImport as g, type PlayRuntimeFeature as h, type ToolExecutionErrorOptions as i, type PlayAuthoringColumnMap as j, type PlayAuthoringColumnResolver as k, type PlayAuthoringRuntimeContext as l, type PlayAuthoringConditionalStepResolver as m, type PlayAuthoringCsvInput as n, type PlayAuthoringCsvOptions as o, type PlayAuthoringDatasetBuilder as p, type PlayAuthoringDatasetColumnDefinition as q, type PlayAuthoringDatasetColumnRunInput as r, type ToolExecuteResult as s, type PlayAuthoringReferenceLike as t, type PlayReturnObject as u, type PlayAuthoringDefineConfig as v, type PlayAuthoringDefinedPlay as w, type PlayAuthoringFetchOptions as x, type PlayAuthoringFileInput as y, type PlayAuthoringBindings as z };
2956
+ export { PHONE_STATUS_VALUES as $, type PlayAuthoringCallExecution as A, type PlayAuthoringCallOptions as B, type PlayAuthoringFetchResponse as C, DeeplineError as D, type PlayAuthoringInputContract as E, type PlayAuthoringStepProgramStep as F, type PlayAuthoringRuntimeStepOptions as G, type PlaySqlListenerDeclaration as H, type PlaySqlListenerEvent as I, type PlaySqlListenerOperation as J, type PlaySqlQuery as K, type PlayAuthoringStepOptions as L, type PlayAuthoringStepProgram as M, type PlayAuthoringStepProgramResolver as N, type PlayAuthoringStepResolver as O, type PlayArtifactKind as P, type PlayToolExecutionRequest as Q, type PlayAuthoringStepProgramOptions as R, DEEPLINE_EXTRACTOR_TARGETS as S, ToolExecutionError as T, DEEPLINE_EXTRACTOR_TARGET_DEFINITIONS as U, type DeeplineEmailStatusGetterValue as V, type DeeplineExtractorTarget as W, type DeeplineGetterValue as X, type DeeplineGetterValueMap as Y, JOB_CHANGE_STATUS_VALUES as Z, type JobChangeStatus as _, type PlayBundleArtifact as a, type PhoneStatus as a0, type PlayDataset as a1, type PlayDatasetInput as a2, type PreviousCell as a3, ProviderTransientError as a4, type ProviderTransientErrorCategory as a5, type ProviderUnavailableError as a6, type ProviderUnavailableReason as a7, type ToolExecutionErrorCategory as a8, type ToolExecutionErrorOrigin as a9, type ToolExecutionFailureV1 as aa, type ToolExecutionNetworkKind as ab, type ToolExecutionNetworkScope as ac, type ToolExecutionPublicDetails as ad, getProviderUnavailableReason as ae, isDeeplineExtractorTarget as af, isProviderUnavailable as ag, isProviderWaterfallUnavailableError as ah, type PlaySandboxRuntimeDeclaration as b, type PlayCompilerManifest as c, PLAY_ARTIFACT_KINDS as d, type PlayArtifactCompatibility as e, type PlayImportPolicy as f, type PlayPackageImport as g, type PlayRuntimeFeature as h, type ToolExecutionErrorOptions as i, type PlayAuthoringColumnMap as j, type PlayAuthoringColumnResolver as k, type PlayAuthoringRuntimeContext as l, type PlayAuthoringConditionalStepResolver as m, type PlayAuthoringCsvInput as n, type PlayAuthoringCsvOptions as o, type PlayAuthoringDatasetBuilder as p, type PlayAuthoringDatasetColumnDefinition as q, type PlayAuthoringDatasetColumnRunInput as r, type ToolExecuteResult as s, type PlayAuthoringReferenceLike as t, type PlayReturnObject as u, type PlayAuthoringDefineConfig as v, type PlayAuthoringDefinedPlay as w, type PlayAuthoringFetchOptions as x, type PlayAuthoringFileInput as y, type PlayAuthoringBindings as z };
package/dist/index.d.mts CHANGED
@@ -1,6 +1,6 @@
1
1
  /// <reference path="./text-imports.d.ts" />
2
- import { c as PlayCompilerManifest, D as DeeplineError, T as ToolExecutionError, i as ToolExecutionErrorOptions, j as PlayAuthoringColumnMap, k as PlayAuthoringColumnResolver, l as PlayAuthoringRuntimeContext, m as PlayAuthoringConditionalStepResolver, n as PlayAuthoringCsvInput, o as PlayAuthoringCsvOptions, p as PlayAuthoringDatasetBuilder, q as PlayAuthoringDatasetColumnDefinition, r as PlayAuthoringDatasetColumnRunInput, s as ToolExecuteResult, t as PlayAuthoringReferenceLike, u as PlayReturnObject$1, v as PlayAuthoringDefineConfig, w as PlayAuthoringDefinedPlay, x as PlayAuthoringFetchOptions, y as PlayAuthoringFileInput, z as PlayAuthoringBindings, A as PlayAuthoringCallExecution, B as PlayAuthoringCallOptions, C as PlayAuthoringFetchResponse, E as PlayAuthoringInputContract, F as PlayAuthoringStepProgramStep, G as PlayAuthoringRuntimeStepOptions, H as PlaySqlListenerDeclaration, I as PlaySqlListenerEvent, J as PlaySqlListenerOperation, K as PlaySqlQuery, L as PlayAuthoringStepOptions, M as PlayAuthoringStepProgram, N as PlayAuthoringStepProgramResolver, O as PlayAuthoringStepResolver, Q as PlayToolExecutionRequest, R as PlayAuthoringStepProgramOptions } from './compiler-manifest-BuoqasqI.mjs';
3
- export { S as DEEPLINE_EXTRACTOR_TARGETS, U as DEEPLINE_EXTRACTOR_TARGET_DEFINITIONS, V as DeeplineEmailStatusGetterValue, W as DeeplineExtractorTarget, X as DeeplineGetterValue, Y as DeeplineGetterValueMap, Z as JOB_CHANGE_STATUS_VALUES, _ as JobChangeStatus, $ as PHONE_STATUS_VALUES, a0 as PhoneStatus, a1 as PlayDataset, a2 as PlayDatasetInput, a3 as PreviousCell, a4 as ProviderTransientError, a5 as ProviderTransientErrorCategory, a6 as ProviderUnavailableError, a7 as ProviderUnavailableReason, a8 as ToolExecutionErrorCategory, a9 as ToolExecutionErrorOrigin, aa as ToolExecutionFailureV1, ab as ToolExecutionNetworkKind, ac as ToolExecutionNetworkScope, ad as getProviderUnavailableReason, ae as isDeeplineExtractorTarget, af as isProviderUnavailable, ag as isProviderWaterfallUnavailableError } from './compiler-manifest-BuoqasqI.mjs';
2
+ import { c as PlayCompilerManifest, D as DeeplineError, T as ToolExecutionError, i as ToolExecutionErrorOptions, j as PlayAuthoringColumnMap, k as PlayAuthoringColumnResolver, l as PlayAuthoringRuntimeContext, m as PlayAuthoringConditionalStepResolver, n as PlayAuthoringCsvInput, o as PlayAuthoringCsvOptions, p as PlayAuthoringDatasetBuilder, q as PlayAuthoringDatasetColumnDefinition, r as PlayAuthoringDatasetColumnRunInput, s as ToolExecuteResult, t as PlayAuthoringReferenceLike, u as PlayReturnObject$1, v as PlayAuthoringDefineConfig, w as PlayAuthoringDefinedPlay, x as PlayAuthoringFetchOptions, y as PlayAuthoringFileInput, z as PlayAuthoringBindings, A as PlayAuthoringCallExecution, B as PlayAuthoringCallOptions, C as PlayAuthoringFetchResponse, E as PlayAuthoringInputContract, F as PlayAuthoringStepProgramStep, G as PlayAuthoringRuntimeStepOptions, H as PlaySqlListenerDeclaration, I as PlaySqlListenerEvent, J as PlaySqlListenerOperation, K as PlaySqlQuery, L as PlayAuthoringStepOptions, M as PlayAuthoringStepProgram, N as PlayAuthoringStepProgramResolver, O as PlayAuthoringStepResolver, Q as PlayToolExecutionRequest, R as PlayAuthoringStepProgramOptions } from './compiler-manifest-CbzdZrJj.mjs';
3
+ export { S as DEEPLINE_EXTRACTOR_TARGETS, U as DEEPLINE_EXTRACTOR_TARGET_DEFINITIONS, V as DeeplineEmailStatusGetterValue, W as DeeplineExtractorTarget, X as DeeplineGetterValue, Y as DeeplineGetterValueMap, Z as JOB_CHANGE_STATUS_VALUES, _ as JobChangeStatus, $ as PHONE_STATUS_VALUES, a0 as PhoneStatus, a1 as PlayDataset, a2 as PlayDatasetInput, a3 as PreviousCell, a4 as ProviderTransientError, a5 as ProviderTransientErrorCategory, a6 as ProviderUnavailableError, a7 as ProviderUnavailableReason, a8 as ToolExecutionErrorCategory, a9 as ToolExecutionErrorOrigin, aa as ToolExecutionFailureV1, ab as ToolExecutionNetworkKind, ac as ToolExecutionNetworkScope, ad as ToolExecutionPublicDetails, ae as getProviderUnavailableReason, af as isDeeplineExtractorTarget, ag as isProviderUnavailable, ah as isProviderWaterfallUnavailableError } from './compiler-manifest-CbzdZrJj.mjs';
4
4
  import '@sinclair/typebox';
5
5
 
6
6
  declare const FIXTURE_BEHAVIOR_VERSION: 1;
@@ -3949,6 +3949,8 @@ declare class ToolRateLimitError extends RateLimitError {
3949
3949
  readonly networkKind: ToolExecutionError['networkKind'];
3950
3950
  /** Network boundary that failed, or `null` for non-network failures. */
3951
3951
  readonly networkScope: ToolExecutionError['networkScope'];
3952
+ /** Explicitly allowlisted diagnostics safe for SDK callers. */
3953
+ readonly publicDetails: ToolExecutionError['publicDetails'];
3952
3954
  /** Constructed by the SDK after a structured tool HTTP 429. */
3953
3955
  constructor(message: string, options: ToolExecutionErrorOptions);
3954
3956
  }
package/dist/index.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  /// <reference path="./text-imports.d.ts" />
2
- import { c as PlayCompilerManifest, D as DeeplineError, T as ToolExecutionError, i as ToolExecutionErrorOptions, j as PlayAuthoringColumnMap, k as PlayAuthoringColumnResolver, l as PlayAuthoringRuntimeContext, m as PlayAuthoringConditionalStepResolver, n as PlayAuthoringCsvInput, o as PlayAuthoringCsvOptions, p as PlayAuthoringDatasetBuilder, q as PlayAuthoringDatasetColumnDefinition, r as PlayAuthoringDatasetColumnRunInput, s as ToolExecuteResult, t as PlayAuthoringReferenceLike, u as PlayReturnObject$1, v as PlayAuthoringDefineConfig, w as PlayAuthoringDefinedPlay, x as PlayAuthoringFetchOptions, y as PlayAuthoringFileInput, z as PlayAuthoringBindings, A as PlayAuthoringCallExecution, B as PlayAuthoringCallOptions, C as PlayAuthoringFetchResponse, E as PlayAuthoringInputContract, F as PlayAuthoringStepProgramStep, G as PlayAuthoringRuntimeStepOptions, H as PlaySqlListenerDeclaration, I as PlaySqlListenerEvent, J as PlaySqlListenerOperation, K as PlaySqlQuery, L as PlayAuthoringStepOptions, M as PlayAuthoringStepProgram, N as PlayAuthoringStepProgramResolver, O as PlayAuthoringStepResolver, Q as PlayToolExecutionRequest, R as PlayAuthoringStepProgramOptions } from './compiler-manifest-BuoqasqI.js';
3
- export { S as DEEPLINE_EXTRACTOR_TARGETS, U as DEEPLINE_EXTRACTOR_TARGET_DEFINITIONS, V as DeeplineEmailStatusGetterValue, W as DeeplineExtractorTarget, X as DeeplineGetterValue, Y as DeeplineGetterValueMap, Z as JOB_CHANGE_STATUS_VALUES, _ as JobChangeStatus, $ as PHONE_STATUS_VALUES, a0 as PhoneStatus, a1 as PlayDataset, a2 as PlayDatasetInput, a3 as PreviousCell, a4 as ProviderTransientError, a5 as ProviderTransientErrorCategory, a6 as ProviderUnavailableError, a7 as ProviderUnavailableReason, a8 as ToolExecutionErrorCategory, a9 as ToolExecutionErrorOrigin, aa as ToolExecutionFailureV1, ab as ToolExecutionNetworkKind, ac as ToolExecutionNetworkScope, ad as getProviderUnavailableReason, ae as isDeeplineExtractorTarget, af as isProviderUnavailable, ag as isProviderWaterfallUnavailableError } from './compiler-manifest-BuoqasqI.js';
2
+ import { c as PlayCompilerManifest, D as DeeplineError, T as ToolExecutionError, i as ToolExecutionErrorOptions, j as PlayAuthoringColumnMap, k as PlayAuthoringColumnResolver, l as PlayAuthoringRuntimeContext, m as PlayAuthoringConditionalStepResolver, n as PlayAuthoringCsvInput, o as PlayAuthoringCsvOptions, p as PlayAuthoringDatasetBuilder, q as PlayAuthoringDatasetColumnDefinition, r as PlayAuthoringDatasetColumnRunInput, s as ToolExecuteResult, t as PlayAuthoringReferenceLike, u as PlayReturnObject$1, v as PlayAuthoringDefineConfig, w as PlayAuthoringDefinedPlay, x as PlayAuthoringFetchOptions, y as PlayAuthoringFileInput, z as PlayAuthoringBindings, A as PlayAuthoringCallExecution, B as PlayAuthoringCallOptions, C as PlayAuthoringFetchResponse, E as PlayAuthoringInputContract, F as PlayAuthoringStepProgramStep, G as PlayAuthoringRuntimeStepOptions, H as PlaySqlListenerDeclaration, I as PlaySqlListenerEvent, J as PlaySqlListenerOperation, K as PlaySqlQuery, L as PlayAuthoringStepOptions, M as PlayAuthoringStepProgram, N as PlayAuthoringStepProgramResolver, O as PlayAuthoringStepResolver, Q as PlayToolExecutionRequest, R as PlayAuthoringStepProgramOptions } from './compiler-manifest-CbzdZrJj.js';
3
+ export { S as DEEPLINE_EXTRACTOR_TARGETS, U as DEEPLINE_EXTRACTOR_TARGET_DEFINITIONS, V as DeeplineEmailStatusGetterValue, W as DeeplineExtractorTarget, X as DeeplineGetterValue, Y as DeeplineGetterValueMap, Z as JOB_CHANGE_STATUS_VALUES, _ as JobChangeStatus, $ as PHONE_STATUS_VALUES, a0 as PhoneStatus, a1 as PlayDataset, a2 as PlayDatasetInput, a3 as PreviousCell, a4 as ProviderTransientError, a5 as ProviderTransientErrorCategory, a6 as ProviderUnavailableError, a7 as ProviderUnavailableReason, a8 as ToolExecutionErrorCategory, a9 as ToolExecutionErrorOrigin, aa as ToolExecutionFailureV1, ab as ToolExecutionNetworkKind, ac as ToolExecutionNetworkScope, ad as ToolExecutionPublicDetails, ae as getProviderUnavailableReason, af as isDeeplineExtractorTarget, ag as isProviderUnavailable, ah as isProviderWaterfallUnavailableError } from './compiler-manifest-CbzdZrJj.js';
4
4
  import '@sinclair/typebox';
5
5
 
6
6
  declare const FIXTURE_BEHAVIOR_VERSION: 1;
@@ -3949,6 +3949,8 @@ declare class ToolRateLimitError extends RateLimitError {
3949
3949
  readonly networkKind: ToolExecutionError['networkKind'];
3950
3950
  /** Network boundary that failed, or `null` for non-network failures. */
3951
3951
  readonly networkScope: ToolExecutionError['networkScope'];
3952
+ /** Explicitly allowlisted diagnostics safe for SDK callers. */
3953
+ readonly publicDetails: ToolExecutionError['publicDetails'];
3952
3954
  /** Constructed by the SDK after a structured tool HTTP 429. */
3953
3955
  constructor(message: string, options: ToolExecutionErrorOptions);
3954
3956
  }
package/dist/index.js CHANGED
@@ -175,6 +175,8 @@ var ToolExecutionError = class _ToolExecutionError extends DeeplineError {
175
175
  networkKind;
176
176
  /** Network boundary that failed, or `null` for non-network failures. */
177
177
  networkScope;
178
+ /** Explicitly allowlisted diagnostics safe for SDK and Play callers. */
179
+ publicDetails;
178
180
  /**
179
181
  * Construct a structured tool error.
180
182
  *
@@ -199,6 +201,7 @@ var ToolExecutionError = class _ToolExecutionError extends DeeplineError {
199
201
  this.retryAfterMs = options.retryAfterMs;
200
202
  this.networkKind = options.networkKind;
201
203
  this.networkScope = options.networkScope;
204
+ this.publicDetails = options.publicDetails ?? null;
202
205
  applyBrand(this, TOOL_EXECUTION_ERROR_BRAND);
203
206
  if (isProviderTransientFailure(options)) {
204
207
  applyBrand(this, PROVIDER_TRANSIENT_ERROR_BRAND);
@@ -324,6 +327,33 @@ function normalizeNetworkScope(value) {
324
327
  function isRecord(value) {
325
328
  return value !== null && typeof value === "object" && !Array.isArray(value);
326
329
  }
330
+ var MAX_PUBLIC_DETAIL_ENTRIES = 20;
331
+ var MAX_PUBLIC_DETAIL_KEY_LENGTH = 80;
332
+ var MAX_PUBLIC_DETAIL_STRING_LENGTH = 512;
333
+ function normalizeToolExecutionPublicDetails(value) {
334
+ if (!isRecord(value)) return null;
335
+ const details = {};
336
+ for (const [key, entry] of Object.entries(value)) {
337
+ if (Object.keys(details).length >= MAX_PUBLIC_DETAIL_ENTRIES) break;
338
+ if (key.length === 0 || key.length > MAX_PUBLIC_DETAIL_KEY_LENGTH || !/^[a-z][a-zA-Z0-9_]*$/.test(key)) {
339
+ continue;
340
+ }
341
+ if (typeof entry === "string") {
342
+ if (entry.length <= MAX_PUBLIC_DETAIL_STRING_LENGTH) details[key] = entry;
343
+ continue;
344
+ }
345
+ if (typeof entry === "number") {
346
+ if (Number.isFinite(entry)) details[key] = entry;
347
+ continue;
348
+ }
349
+ if (typeof entry === "boolean") {
350
+ details[key] = entry;
351
+ continue;
352
+ }
353
+ if (entry === null) details[key] = null;
354
+ }
355
+ return Object.keys(details).length > 0 ? details : null;
356
+ }
327
357
  function normalizeToolExecutionFailure(value) {
328
358
  if (!isRecord(value) || value.schemaVersion !== TOOL_EXECUTION_ERROR_SCHEMA_VERSION) {
329
359
  return null;
@@ -337,6 +367,7 @@ function normalizeToolExecutionFailure(value) {
337
367
  operation
338
368
  });
339
369
  const category = normalizeToolExecutionCategory(value.category);
370
+ const publicDetails = normalizeToolExecutionPublicDetails(value.publicDetails);
340
371
  const trustworthy = origin !== "unknown" && category !== "unknown" && typeof value.retryable === "boolean";
341
372
  return {
342
373
  schemaVersion: TOOL_EXECUTION_ERROR_SCHEMA_VERSION,
@@ -351,7 +382,8 @@ function normalizeToolExecutionFailure(value) {
351
382
  requestId: boundedString(value.requestId),
352
383
  retryAfterMs: finiteNonNegativeInteger(value.retryAfterMs),
353
384
  networkKind: normalizeNetworkKind(value.networkKind),
354
- networkScope: normalizeNetworkScope(value.networkScope)
385
+ networkScope: normalizeNetworkScope(value.networkScope),
386
+ ...publicDetails ? { publicDetails } : {}
355
387
  };
356
388
  }
357
389
  function serializeToolExecutionFailure(error) {
@@ -369,7 +401,8 @@ function serializeToolExecutionFailure(error) {
369
401
  requestId: error.requestId,
370
402
  retryAfterMs: error.retryAfterMs,
371
403
  networkKind: error.networkKind,
372
- networkScope: error.networkScope
404
+ networkScope: error.networkScope,
405
+ publicDetails: error.publicDetails
373
406
  });
374
407
  }
375
408
  function deserializeToolExecutionFailure(message, value, acceptedSchemaVersion) {
@@ -427,6 +460,8 @@ var ToolRateLimitError = class extends RateLimitError {
427
460
  networkKind;
428
461
  /** Network boundary that failed, or `null` for non-network failures. */
429
462
  networkScope;
463
+ /** Explicitly allowlisted diagnostics safe for SDK callers. */
464
+ publicDetails;
430
465
  /** Constructed by the SDK after a structured tool HTTP 429. */
431
466
  constructor(message, options) {
432
467
  super(options.retryAfterMs ?? 5e3, message);
@@ -442,6 +477,7 @@ var ToolRateLimitError = class extends RateLimitError {
442
477
  this.requestId = options.requestId;
443
478
  this.networkKind = options.networkKind;
444
479
  this.networkScope = options.networkScope;
480
+ this.publicDetails = options.publicDetails ?? null;
445
481
  this.details = options.details;
446
482
  brandAsToolExecutionError(this);
447
483
  if (isProviderTransientFailure(this)) {
@@ -779,7 +815,7 @@ var SDK_RELEASE = {
779
815
  // available at toolResponse.rawV2 while toolResponse.raw and all declared
780
816
  // getters keep their established compatibility behavior.
781
817
  // 0.3.1 deprecated the legacy `deepline enrich` command in favor of Plays.
782
- version: "0.3.47",
818
+ version: "0.3.49",
783
819
  updateSummary: "Automatic CLI updates are now enabled by default. To opt out, run `deepline settings autoupdate off`; use `deepline settings autoupdate on` to re-enable updates or `deepline settings autoupdate pin <version>` to hold an exact release. This release also adds raw-v2 tool responses at toolResponse.rawV2 while preserving existing toolResponse.raw and declared getters.",
784
820
  packageCapabilities: {
785
821
  updatePreferences: 1
package/dist/index.mjs CHANGED
@@ -98,6 +98,8 @@ var ToolExecutionError = class _ToolExecutionError extends DeeplineError {
98
98
  networkKind;
99
99
  /** Network boundary that failed, or `null` for non-network failures. */
100
100
  networkScope;
101
+ /** Explicitly allowlisted diagnostics safe for SDK and Play callers. */
102
+ publicDetails;
101
103
  /**
102
104
  * Construct a structured tool error.
103
105
  *
@@ -122,6 +124,7 @@ var ToolExecutionError = class _ToolExecutionError extends DeeplineError {
122
124
  this.retryAfterMs = options.retryAfterMs;
123
125
  this.networkKind = options.networkKind;
124
126
  this.networkScope = options.networkScope;
127
+ this.publicDetails = options.publicDetails ?? null;
125
128
  applyBrand(this, TOOL_EXECUTION_ERROR_BRAND);
126
129
  if (isProviderTransientFailure(options)) {
127
130
  applyBrand(this, PROVIDER_TRANSIENT_ERROR_BRAND);
@@ -247,6 +250,33 @@ function normalizeNetworkScope(value) {
247
250
  function isRecord(value) {
248
251
  return value !== null && typeof value === "object" && !Array.isArray(value);
249
252
  }
253
+ var MAX_PUBLIC_DETAIL_ENTRIES = 20;
254
+ var MAX_PUBLIC_DETAIL_KEY_LENGTH = 80;
255
+ var MAX_PUBLIC_DETAIL_STRING_LENGTH = 512;
256
+ function normalizeToolExecutionPublicDetails(value) {
257
+ if (!isRecord(value)) return null;
258
+ const details = {};
259
+ for (const [key, entry] of Object.entries(value)) {
260
+ if (Object.keys(details).length >= MAX_PUBLIC_DETAIL_ENTRIES) break;
261
+ if (key.length === 0 || key.length > MAX_PUBLIC_DETAIL_KEY_LENGTH || !/^[a-z][a-zA-Z0-9_]*$/.test(key)) {
262
+ continue;
263
+ }
264
+ if (typeof entry === "string") {
265
+ if (entry.length <= MAX_PUBLIC_DETAIL_STRING_LENGTH) details[key] = entry;
266
+ continue;
267
+ }
268
+ if (typeof entry === "number") {
269
+ if (Number.isFinite(entry)) details[key] = entry;
270
+ continue;
271
+ }
272
+ if (typeof entry === "boolean") {
273
+ details[key] = entry;
274
+ continue;
275
+ }
276
+ if (entry === null) details[key] = null;
277
+ }
278
+ return Object.keys(details).length > 0 ? details : null;
279
+ }
250
280
  function normalizeToolExecutionFailure(value) {
251
281
  if (!isRecord(value) || value.schemaVersion !== TOOL_EXECUTION_ERROR_SCHEMA_VERSION) {
252
282
  return null;
@@ -260,6 +290,7 @@ function normalizeToolExecutionFailure(value) {
260
290
  operation
261
291
  });
262
292
  const category = normalizeToolExecutionCategory(value.category);
293
+ const publicDetails = normalizeToolExecutionPublicDetails(value.publicDetails);
263
294
  const trustworthy = origin !== "unknown" && category !== "unknown" && typeof value.retryable === "boolean";
264
295
  return {
265
296
  schemaVersion: TOOL_EXECUTION_ERROR_SCHEMA_VERSION,
@@ -274,7 +305,8 @@ function normalizeToolExecutionFailure(value) {
274
305
  requestId: boundedString(value.requestId),
275
306
  retryAfterMs: finiteNonNegativeInteger(value.retryAfterMs),
276
307
  networkKind: normalizeNetworkKind(value.networkKind),
277
- networkScope: normalizeNetworkScope(value.networkScope)
308
+ networkScope: normalizeNetworkScope(value.networkScope),
309
+ ...publicDetails ? { publicDetails } : {}
278
310
  };
279
311
  }
280
312
  function serializeToolExecutionFailure(error) {
@@ -292,7 +324,8 @@ function serializeToolExecutionFailure(error) {
292
324
  requestId: error.requestId,
293
325
  retryAfterMs: error.retryAfterMs,
294
326
  networkKind: error.networkKind,
295
- networkScope: error.networkScope
327
+ networkScope: error.networkScope,
328
+ publicDetails: error.publicDetails
296
329
  });
297
330
  }
298
331
  function deserializeToolExecutionFailure(message, value, acceptedSchemaVersion) {
@@ -350,6 +383,8 @@ var ToolRateLimitError = class extends RateLimitError {
350
383
  networkKind;
351
384
  /** Network boundary that failed, or `null` for non-network failures. */
352
385
  networkScope;
386
+ /** Explicitly allowlisted diagnostics safe for SDK callers. */
387
+ publicDetails;
353
388
  /** Constructed by the SDK after a structured tool HTTP 429. */
354
389
  constructor(message, options) {
355
390
  super(options.retryAfterMs ?? 5e3, message);
@@ -365,6 +400,7 @@ var ToolRateLimitError = class extends RateLimitError {
365
400
  this.requestId = options.requestId;
366
401
  this.networkKind = options.networkKind;
367
402
  this.networkScope = options.networkScope;
403
+ this.publicDetails = options.publicDetails ?? null;
368
404
  this.details = options.details;
369
405
  brandAsToolExecutionError(this);
370
406
  if (isProviderTransientFailure(this)) {
@@ -702,7 +738,7 @@ var SDK_RELEASE = {
702
738
  // available at toolResponse.rawV2 while toolResponse.raw and all declared
703
739
  // getters keep their established compatibility behavior.
704
740
  // 0.3.1 deprecated the legacy `deepline enrich` command in favor of Plays.
705
- version: "0.3.47",
741
+ version: "0.3.49",
706
742
  updateSummary: "Automatic CLI updates are now enabled by default. To opt out, run `deepline settings autoupdate off`; use `deepline settings autoupdate on` to re-enable updates or `deepline settings autoupdate pin <version>` to hold an exact release. This release also adds raw-v2 tool responses at toolResponse.rawV2 while preserving existing toolResponse.raw and declared getters.",
707
743
  packageCapabilities: {
708
744
  updatePreferences: 1
@@ -257,8 +257,8 @@
257
257
  "dist/cli/index.js",
258
258
  "dist/cli/index.mjs",
259
259
  "dist/cli/text-imports.d.ts",
260
- "dist/compiler-manifest-BuoqasqI.d.mts",
261
- "dist/compiler-manifest-BuoqasqI.d.ts",
260
+ "dist/compiler-manifest-CbzdZrJj.d.mts",
261
+ "dist/compiler-manifest-CbzdZrJj.d.ts",
262
262
  "dist/helpers.d.mts",
263
263
  "dist/helpers.d.ts",
264
264
  "dist/helpers.js",
@@ -1,6 +1,6 @@
1
1
  /// <reference path="./text-imports.d.ts" />
2
- import { P as PlayArtifactKind, a as PlayBundleArtifact, b as PlaySandboxRuntimeDeclaration, c as PlayCompilerManifest } from '../compiler-manifest-BuoqasqI.mjs';
3
- export { d as PLAY_ARTIFACT_KINDS, e as PlayArtifactCompatibility, f as PlayImportPolicy, g as PlayPackageImport, h as PlayRuntimeFeature } from '../compiler-manifest-BuoqasqI.mjs';
2
+ import { P as PlayArtifactKind, a as PlayBundleArtifact, b as PlaySandboxRuntimeDeclaration, c as PlayCompilerManifest } from '../compiler-manifest-CbzdZrJj.mjs';
3
+ export { d as PLAY_ARTIFACT_KINDS, e as PlayArtifactCompatibility, f as PlayImportPolicy, g as PlayPackageImport, h as PlayRuntimeFeature } from '../compiler-manifest-CbzdZrJj.mjs';
4
4
  import '@sinclair/typebox';
5
5
 
6
6
  type ImportedPlayDependency = {
@@ -1,6 +1,6 @@
1
1
  /// <reference path="./text-imports.d.ts" />
2
- import { P as PlayArtifactKind, a as PlayBundleArtifact, b as PlaySandboxRuntimeDeclaration, c as PlayCompilerManifest } from '../compiler-manifest-BuoqasqI.js';
3
- export { d as PLAY_ARTIFACT_KINDS, e as PlayArtifactCompatibility, f as PlayImportPolicy, g as PlayPackageImport, h as PlayRuntimeFeature } from '../compiler-manifest-BuoqasqI.js';
2
+ import { P as PlayArtifactKind, a as PlayBundleArtifact, b as PlaySandboxRuntimeDeclaration, c as PlayCompilerManifest } from '../compiler-manifest-CbzdZrJj.js';
3
+ export { d as PLAY_ARTIFACT_KINDS, e as PlayArtifactCompatibility, f as PlayImportPolicy, g as PlayPackageImport, h as PlayRuntimeFeature } from '../compiler-manifest-CbzdZrJj.js';
4
4
  import '@sinclair/typebox';
5
5
 
6
6
  type ImportedPlayDependency = {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "deepline",
3
- "version": "0.3.47",
3
+ "version": "0.3.49",
4
4
  "description": "GTM data CLI and TypeScript SDK for coding agents",
5
5
  "license": "MIT",
6
6
  "homepage": "https://code.deepline.com",