deepline 0.3.47 → 0.3.48

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/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.48",
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
@@ -1932,7 +1968,7 @@ var HttpClient = class {
1932
1968
  body: options?.body !== void 0 ? JSON.stringify(options.body) : void 0,
1933
1969
  signal: options?.signal
1934
1970
  });
1935
- if (!response.ok) {
1971
+ if (!response.ok || response.status === 202) {
1936
1972
  const body = await response.text();
1937
1973
  const parsed = parseResponseBody(body);
1938
1974
  if (response.status === 401 && !isProviderOriginatedHttpError(parsed)) {
@@ -5661,12 +5697,26 @@ var DeeplineClient = class {
5661
5697
  const headers = options?.lastEventId && options.lastEventId.trim() ? { "Last-Event-ID": options.lastEventId.trim() } : void 0;
5662
5698
  const params = new URLSearchParams();
5663
5699
  params.set("mode", options?.mode ?? "cli");
5664
- for await (const event of this.http.streamSse(
5665
- `/api/v2/runs/${encodeURIComponent(workflowId)}/tail?${params.toString()}`,
5666
- { signal: options?.signal, headers }
5667
- )) {
5668
- if (event.scope === "play") {
5669
- yield event;
5700
+ const projectionDeadline = Date.now() + 3e4;
5701
+ let projectionAttempt = 0;
5702
+ for (; ; ) {
5703
+ let sawEvent = false;
5704
+ try {
5705
+ for await (const event of this.http.streamSse(
5706
+ `/api/v2/runs/${encodeURIComponent(workflowId)}/tail?${params.toString()}`,
5707
+ { signal: options?.signal, headers }
5708
+ )) {
5709
+ sawEvent = true;
5710
+ if (event.scope === "play") {
5711
+ yield event;
5712
+ }
5713
+ }
5714
+ return;
5715
+ } catch (error) {
5716
+ const projectionPending = options?.waitForProjection === true && !sawEvent && error instanceof DeeplineError && (error.statusCode === 404 || error.statusCode === 202 && error.code === "RUN_PROJECTION_PENDING") && Date.now() < projectionDeadline;
5717
+ if (!projectionPending) throw error;
5718
+ await sleep2(streamReconnectDelayMs(projectionAttempt));
5719
+ projectionAttempt += 1;
5670
5720
  }
5671
5721
  }
5672
5722
  }
@@ -6695,7 +6745,8 @@ var DeeplineClient = class {
6695
6745
  }
6696
6746
  for await (const event of this.streamPlayRunEvents(workflowId, {
6697
6747
  mode: "cli",
6698
- signal: options?.signal
6748
+ signal: options?.signal,
6749
+ waitForProjection: true
6699
6750
  })) {
6700
6751
  if (options?.signal?.aborted) {
6701
6752
  await this.cancelPlay(workflowId);
@@ -20728,7 +20779,7 @@ async function waitForPlayCompletionByStream(input2) {
20728
20779
  try {
20729
20780
  for await (const event of input2.client.streamPlayRunEvents(
20730
20781
  input2.workflowId,
20731
- { signal: controller.signal }
20782
+ { signal: controller.signal, waitForProjection: true }
20732
20783
  )) {
20733
20784
  sawEvent = true;
20734
20785
  const terminal = await handleLiveEvent(event);
@@ -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.48",
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
@@ -1918,7 +1954,7 @@ var HttpClient = class {
1918
1954
  body: options?.body !== void 0 ? JSON.stringify(options.body) : void 0,
1919
1955
  signal: options?.signal
1920
1956
  });
1921
- if (!response.ok) {
1957
+ if (!response.ok || response.status === 202) {
1922
1958
  const body = await response.text();
1923
1959
  const parsed = parseResponseBody(body);
1924
1960
  if (response.status === 401 && !isProviderOriginatedHttpError(parsed)) {
@@ -5647,12 +5683,26 @@ var DeeplineClient = class {
5647
5683
  const headers = options?.lastEventId && options.lastEventId.trim() ? { "Last-Event-ID": options.lastEventId.trim() } : void 0;
5648
5684
  const params = new URLSearchParams();
5649
5685
  params.set("mode", options?.mode ?? "cli");
5650
- for await (const event of this.http.streamSse(
5651
- `/api/v2/runs/${encodeURIComponent(workflowId)}/tail?${params.toString()}`,
5652
- { signal: options?.signal, headers }
5653
- )) {
5654
- if (event.scope === "play") {
5655
- yield event;
5686
+ const projectionDeadline = Date.now() + 3e4;
5687
+ let projectionAttempt = 0;
5688
+ for (; ; ) {
5689
+ let sawEvent = false;
5690
+ try {
5691
+ for await (const event of this.http.streamSse(
5692
+ `/api/v2/runs/${encodeURIComponent(workflowId)}/tail?${params.toString()}`,
5693
+ { signal: options?.signal, headers }
5694
+ )) {
5695
+ sawEvent = true;
5696
+ if (event.scope === "play") {
5697
+ yield event;
5698
+ }
5699
+ }
5700
+ return;
5701
+ } catch (error) {
5702
+ const projectionPending = options?.waitForProjection === true && !sawEvent && error instanceof DeeplineError && (error.statusCode === 404 || error.statusCode === 202 && error.code === "RUN_PROJECTION_PENDING") && Date.now() < projectionDeadline;
5703
+ if (!projectionPending) throw error;
5704
+ await sleep2(streamReconnectDelayMs(projectionAttempt));
5705
+ projectionAttempt += 1;
5656
5706
  }
5657
5707
  }
5658
5708
  }
@@ -6681,7 +6731,8 @@ var DeeplineClient = class {
6681
6731
  }
6682
6732
  for await (const event of this.streamPlayRunEvents(workflowId, {
6683
6733
  mode: "cli",
6684
- signal: options?.signal
6734
+ signal: options?.signal,
6735
+ waitForProjection: true
6685
6736
  })) {
6686
6737
  if (options?.signal?.aborted) {
6687
6738
  await this.cancelPlay(workflowId);
@@ -20791,7 +20842,7 @@ async function waitForPlayCompletionByStream(input2) {
20791
20842
  try {
20792
20843
  for await (const event of input2.client.streamPlayRunEvents(
20793
20844
  input2.workflowId,
20794
- { signal: controller.signal }
20845
+ { signal: controller.signal, waitForProjection: true }
20795
20846
  )) {
20796
20847
  sawEvent = true;
20797
20848
  const terminal = await handleLiveEvent(event);
@@ -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;
@@ -3213,6 +3213,14 @@ declare class DeeplineClient {
3213
3213
  signal?: AbortSignal;
3214
3214
  lastEventId?: string;
3215
3215
  mode?: 'cli' | 'ui';
3216
+ /**
3217
+ * A run just accepted by durable scheduler admission can take a short
3218
+ * time to appear in the asynchronous Convex read model. Callers that
3219
+ * received that admission may opt into a bounded retry of the initial
3220
+ * pending response; a normal arbitrary run id still fails loudly by
3221
+ * default.
3222
+ */
3223
+ waitForProjection?: boolean;
3216
3224
  }): AsyncGenerator<PlayLiveEvent>;
3217
3225
  /**
3218
3226
  * Cancel a running play execution.
@@ -3949,6 +3957,8 @@ declare class ToolRateLimitError extends RateLimitError {
3949
3957
  readonly networkKind: ToolExecutionError['networkKind'];
3950
3958
  /** Network boundary that failed, or `null` for non-network failures. */
3951
3959
  readonly networkScope: ToolExecutionError['networkScope'];
3960
+ /** Explicitly allowlisted diagnostics safe for SDK callers. */
3961
+ readonly publicDetails: ToolExecutionError['publicDetails'];
3952
3962
  /** Constructed by the SDK after a structured tool HTTP 429. */
3953
3963
  constructor(message: string, options: ToolExecutionErrorOptions);
3954
3964
  }
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;
@@ -3213,6 +3213,14 @@ declare class DeeplineClient {
3213
3213
  signal?: AbortSignal;
3214
3214
  lastEventId?: string;
3215
3215
  mode?: 'cli' | 'ui';
3216
+ /**
3217
+ * A run just accepted by durable scheduler admission can take a short
3218
+ * time to appear in the asynchronous Convex read model. Callers that
3219
+ * received that admission may opt into a bounded retry of the initial
3220
+ * pending response; a normal arbitrary run id still fails loudly by
3221
+ * default.
3222
+ */
3223
+ waitForProjection?: boolean;
3216
3224
  }): AsyncGenerator<PlayLiveEvent>;
3217
3225
  /**
3218
3226
  * Cancel a running play execution.
@@ -3949,6 +3957,8 @@ declare class ToolRateLimitError extends RateLimitError {
3949
3957
  readonly networkKind: ToolExecutionError['networkKind'];
3950
3958
  /** Network boundary that failed, or `null` for non-network failures. */
3951
3959
  readonly networkScope: ToolExecutionError['networkScope'];
3960
+ /** Explicitly allowlisted diagnostics safe for SDK callers. */
3961
+ readonly publicDetails: ToolExecutionError['publicDetails'];
3952
3962
  /** Constructed by the SDK after a structured tool HTTP 429. */
3953
3963
  constructor(message: string, options: ToolExecutionErrorOptions);
3954
3964
  }
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.48",
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
@@ -1659,7 +1695,7 @@ var HttpClient = class {
1659
1695
  body: options?.body !== void 0 ? JSON.stringify(options.body) : void 0,
1660
1696
  signal: options?.signal
1661
1697
  });
1662
- if (!response.ok) {
1698
+ if (!response.ok || response.status === 202) {
1663
1699
  const body = await response.text();
1664
1700
  const parsed = parseResponseBody(body);
1665
1701
  if (response.status === 401 && !isProviderOriginatedHttpError(parsed)) {
@@ -5363,12 +5399,26 @@ var DeeplineClient = class {
5363
5399
  const headers = options?.lastEventId && options.lastEventId.trim() ? { "Last-Event-ID": options.lastEventId.trim() } : void 0;
5364
5400
  const params = new URLSearchParams();
5365
5401
  params.set("mode", options?.mode ?? "cli");
5366
- for await (const event of this.http.streamSse(
5367
- `/api/v2/runs/${encodeURIComponent(workflowId)}/tail?${params.toString()}`,
5368
- { signal: options?.signal, headers }
5369
- )) {
5370
- if (event.scope === "play") {
5371
- yield event;
5402
+ const projectionDeadline = Date.now() + 3e4;
5403
+ let projectionAttempt = 0;
5404
+ for (; ; ) {
5405
+ let sawEvent = false;
5406
+ try {
5407
+ for await (const event of this.http.streamSse(
5408
+ `/api/v2/runs/${encodeURIComponent(workflowId)}/tail?${params.toString()}`,
5409
+ { signal: options?.signal, headers }
5410
+ )) {
5411
+ sawEvent = true;
5412
+ if (event.scope === "play") {
5413
+ yield event;
5414
+ }
5415
+ }
5416
+ return;
5417
+ } catch (error) {
5418
+ const projectionPending = options?.waitForProjection === true && !sawEvent && error instanceof DeeplineError && (error.statusCode === 404 || error.statusCode === 202 && error.code === "RUN_PROJECTION_PENDING") && Date.now() < projectionDeadline;
5419
+ if (!projectionPending) throw error;
5420
+ await sleep2(streamReconnectDelayMs(projectionAttempt));
5421
+ projectionAttempt += 1;
5372
5422
  }
5373
5423
  }
5374
5424
  }
@@ -6397,7 +6447,8 @@ var DeeplineClient = class {
6397
6447
  }
6398
6448
  for await (const event of this.streamPlayRunEvents(workflowId, {
6399
6449
  mode: "cli",
6400
- signal: options?.signal
6450
+ signal: options?.signal,
6451
+ waitForProjection: true
6401
6452
  })) {
6402
6453
  if (options?.signal?.aborted) {
6403
6454
  await this.cancelPlay(workflowId);