deepline 0.1.141 → 0.1.143

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.
@@ -65,6 +65,11 @@ import {
65
65
  } from './workflow-retry-state';
66
66
  import { createOrAttachWorkflowInstance } from './workflow-instance-create';
67
67
  import { sanitizeLiveLogLines } from './runtime/live-progress';
68
+ import {
69
+ DURABLE_OBJECT_DEPLOY_HANDOFF_RETRY_DELAYS_MS,
70
+ durableObjectDeployHandoffMessage,
71
+ sleepForDurableObjectDeployHandoffRetry,
72
+ } from './durable-object-deploy-handoff';
68
73
 
69
74
  export { DynamicWorkflowBinding };
70
75
 
@@ -784,24 +789,58 @@ async function callRunScopedControl<T>(
784
789
  path: string,
785
790
  init?: RequestInit,
786
791
  ): Promise<T> {
787
- const response = await runScopedDurableObject(env, runId).fetch(
788
- `https://deepline.run-state.internal${path}`,
789
- {
790
- ...(init ?? {}),
791
- headers: {
792
- 'content-type': 'application/json',
793
- ...(init?.headers ?? {}),
794
- },
795
- },
796
- );
797
- if (!response.ok) {
792
+ const maxAttempts = DURABLE_OBJECT_DEPLOY_HANDOFF_RETRY_DELAYS_MS.length + 1;
793
+ for (let attempt = 1; attempt <= maxAttempts; attempt += 1) {
794
+ let response: Response;
795
+ try {
796
+ response = await runScopedDurableObject(env, runId).fetch(
797
+ `https://deepline.run-state.internal${path}`,
798
+ {
799
+ ...(init ?? {}),
800
+ headers: {
801
+ 'content-type': 'application/json',
802
+ ...(init?.headers ?? {}),
803
+ },
804
+ },
805
+ );
806
+ } catch (error) {
807
+ const handoffMessage = durableObjectDeployHandoffMessage(error);
808
+ if (handoffMessage && attempt < maxAttempts) {
809
+ console.warn('[coordinator] run state DO deploy handoff retry', {
810
+ runId,
811
+ path,
812
+ attempt,
813
+ error: handoffMessage,
814
+ });
815
+ await sleepForDurableObjectDeployHandoffRetry(attempt - 1);
816
+ continue;
817
+ }
818
+ throw error;
819
+ }
820
+
821
+ if (response.ok) {
822
+ return (await response.json()) as T;
823
+ }
824
+
825
+ const responseText = (await response.text().catch(() => '')).slice(0, 400);
826
+ const handoffMessage = durableObjectDeployHandoffMessage(responseText);
827
+ if (handoffMessage && attempt < maxAttempts) {
828
+ console.warn('[coordinator] run state DO deploy handoff retry', {
829
+ runId,
830
+ path,
831
+ attempt,
832
+ status: response.status,
833
+ error: handoffMessage,
834
+ });
835
+ await sleepForDurableObjectDeployHandoffRetry(attempt - 1);
836
+ continue;
837
+ }
838
+
798
839
  throw new Error(
799
- `run state ${path} failed ${response.status}: ${(
800
- await response.text().catch(() => '')
801
- ).slice(0, 400)}`,
840
+ `run state ${path} failed ${response.status}: ${responseText}`,
802
841
  );
803
842
  }
804
- return (await response.json()) as T;
843
+ throw new Error(`run state ${path} failed after deploy handoff retries`);
805
844
  }
806
845
 
807
846
  async function recordWorkflowInstanceId(input: {
@@ -0,0 +1,24 @@
1
+ export const DURABLE_OBJECT_DEPLOY_HANDOFF_STORAGE_ERROR =
2
+ "The Durable Object's code has been updated, this version can no longer access storage";
3
+
4
+ export const DURABLE_OBJECT_DEPLOY_HANDOFF_RETRY_DELAYS_MS = [50, 150, 350];
5
+
6
+ export function durableObjectDeployHandoffMessage(
7
+ value: unknown,
8
+ ): string | null {
9
+ const message = value instanceof Error ? value.message : String(value ?? '');
10
+ return message.includes(DURABLE_OBJECT_DEPLOY_HANDOFF_STORAGE_ERROR)
11
+ ? message
12
+ : null;
13
+ }
14
+
15
+ export async function sleepForDurableObjectDeployHandoffRetry(
16
+ attemptIndex: number,
17
+ ): Promise<void> {
18
+ const delayMs =
19
+ DURABLE_OBJECT_DEPLOY_HANDOFF_RETRY_DELAYS_MS[attemptIndex] ??
20
+ DURABLE_OBJECT_DEPLOY_HANDOFF_RETRY_DELAYS_MS[
21
+ DURABLE_OBJECT_DEPLOY_HANDOFF_RETRY_DELAYS_MS.length - 1
22
+ ];
23
+ await new Promise((resolve) => setTimeout(resolve, delayMs));
24
+ }
@@ -1247,7 +1247,10 @@ async function callToolDirect(
1247
1247
  [EXECUTE_RESPONSE_CONTRACT_HEADER]: V2_EXECUTE_RESPONSE_CONTRACT,
1248
1248
  [EXECUTE_TOOL_METADATA_HEADER]: 'true',
1249
1249
  },
1250
- body: JSON.stringify({ payload: input }),
1250
+ body: JSON.stringify({
1251
+ payload: input,
1252
+ metadata: { parent_run_id: req.runId },
1253
+ }),
1251
1254
  });
1252
1255
  } catch (error) {
1253
1256
  const message = error instanceof Error ? error.message : String(error);
@@ -101,10 +101,10 @@ export const SDK_RELEASE = {
101
101
  // 0.1.108 ships explicit dataset column/tool recompute policy and removes
102
102
  // the SDK enrich generator's one-second stale policy.
103
103
  // 0.1.110 ships authored V2 prebuilts and required top-level play descriptions.
104
- version: '0.1.141',
104
+ version: '0.1.143',
105
105
  apiContract: '2026-06-dataset-column-cell-stale-hard-cutover',
106
106
  supportPolicy: {
107
- latest: '0.1.141',
107
+ latest: '0.1.143',
108
108
  minimumSupported: '0.1.53',
109
109
  deprecatedBelow: '0.1.53',
110
110
  commandMinimumSupported: [
@@ -203,8 +203,6 @@ function isUnsafeOutboundUrlError(error: unknown): boolean {
203
203
 
204
204
  const EXECUTE_TOOL_METADATA_HEADER = 'x-deepline-include-tool-metadata';
205
205
  const EXECUTE_RESPONSE_CONTRACT_HEADER = 'x-deepline-execute-response-contract';
206
- const AUTH_ACTIVITY_SUPPRESS_SLACK_HEADER =
207
- 'x-deepline-suppress-auth-activity-slack';
208
206
  const V2_EXECUTE_RESPONSE_CONTRACT = 'v2-tool-response';
209
207
  const IN_MEMORY_STEP_RESULT_PREVIEW_LIMIT = 25;
210
208
  const WATERFALL_ROW_MATCH_LOG_SAMPLE_LIMIT = 10;
@@ -5554,7 +5552,6 @@ export class PlayContextImpl {
5554
5552
  [EXECUTE_RESPONSE_CONTRACT_HEADER]:
5555
5553
  V2_EXECUTE_RESPONSE_CONTRACT,
5556
5554
  [EXECUTE_TOOL_METADATA_HEADER]: 'true',
5557
- [AUTH_ACTIVITY_SUPPRESS_SLACK_HEADER]: 'true',
5558
5555
  ...(this.#options.vercelProtectionBypassToken?.trim()
5559
5556
  ? {
5560
5557
  'x-vercel-protection-bypass':
@@ -5562,7 +5559,10 @@ export class PlayContextImpl {
5562
5559
  }
5563
5560
  : {}),
5564
5561
  },
5565
- body: JSON.stringify({ payload: input }),
5562
+ body: JSON.stringify({
5563
+ payload: input,
5564
+ metadata: { parent_run_id: this.#options.runId },
5565
+ }),
5566
5566
  });
5567
5567
  } catch (error) {
5568
5568
  transportAttempt += 1;
package/dist/cli/index.js CHANGED
@@ -413,10 +413,10 @@ var SDK_RELEASE = {
413
413
  // 0.1.108 ships explicit dataset column/tool recompute policy and removes
414
414
  // the SDK enrich generator's one-second stale policy.
415
415
  // 0.1.110 ships authored V2 prebuilts and required top-level play descriptions.
416
- version: "0.1.141",
416
+ version: "0.1.143",
417
417
  apiContract: "2026-06-dataset-column-cell-stale-hard-cutover",
418
418
  supportPolicy: {
419
- latest: "0.1.141",
419
+ latest: "0.1.143",
420
420
  minimumSupported: "0.1.53",
421
421
  deprecatedBelow: "0.1.53",
422
422
  commandMinimumSupported: [
@@ -20799,6 +20799,10 @@ function buildToolExecuteBaseEnvelope(input2) {
20799
20799
  summary: input2.summary
20800
20800
  };
20801
20801
  const envelopeHasCanonicalOutput = isRecord8(envelope.toolResponse) && Object.prototype.hasOwnProperty.call(envelope.toolResponse, "raw");
20802
+ const envelopeHasDeclaredOutput = Object.prototype.hasOwnProperty.call(
20803
+ envelope,
20804
+ "output"
20805
+ );
20802
20806
  const inspectCommand = `deepline tools execute ${input2.toolId} --input ${shellQuote2(JSON.stringify(input2.params))} --json`;
20803
20807
  const actions = input2.listConversion ? [
20804
20808
  {
@@ -20808,7 +20812,7 @@ function buildToolExecuteBaseEnvelope(input2) {
20808
20812
  ] : [];
20809
20813
  return {
20810
20814
  ...envelope,
20811
- ...envelopeHasCanonicalOutput ? { output_preview: outputPreview } : { output: outputPreview },
20815
+ ...envelopeHasCanonicalOutput || envelopeHasDeclaredOutput ? { output_preview: outputPreview } : { output: outputPreview },
20812
20816
  ...summaryEntries.length > 0 ? { summary: input2.summary } : {},
20813
20817
  next: {
20814
20818
  inspect: inspectCommand,
@@ -390,10 +390,10 @@ var SDK_RELEASE = {
390
390
  // 0.1.108 ships explicit dataset column/tool recompute policy and removes
391
391
  // the SDK enrich generator's one-second stale policy.
392
392
  // 0.1.110 ships authored V2 prebuilts and required top-level play descriptions.
393
- version: "0.1.141",
393
+ version: "0.1.143",
394
394
  apiContract: "2026-06-dataset-column-cell-stale-hard-cutover",
395
395
  supportPolicy: {
396
- latest: "0.1.141",
396
+ latest: "0.1.143",
397
397
  minimumSupported: "0.1.53",
398
398
  deprecatedBelow: "0.1.53",
399
399
  commandMinimumSupported: [
@@ -20821,6 +20821,10 @@ function buildToolExecuteBaseEnvelope(input2) {
20821
20821
  summary: input2.summary
20822
20822
  };
20823
20823
  const envelopeHasCanonicalOutput = isRecord8(envelope.toolResponse) && Object.prototype.hasOwnProperty.call(envelope.toolResponse, "raw");
20824
+ const envelopeHasDeclaredOutput = Object.prototype.hasOwnProperty.call(
20825
+ envelope,
20826
+ "output"
20827
+ );
20824
20828
  const inspectCommand = `deepline tools execute ${input2.toolId} --input ${shellQuote2(JSON.stringify(input2.params))} --json`;
20825
20829
  const actions = input2.listConversion ? [
20826
20830
  {
@@ -20830,7 +20834,7 @@ function buildToolExecuteBaseEnvelope(input2) {
20830
20834
  ] : [];
20831
20835
  return {
20832
20836
  ...envelope,
20833
- ...envelopeHasCanonicalOutput ? { output_preview: outputPreview } : { output: outputPreview },
20837
+ ...envelopeHasCanonicalOutput || envelopeHasDeclaredOutput ? { output_preview: outputPreview } : { output: outputPreview },
20834
20838
  ...summaryEntries.length > 0 ? { summary: input2.summary } : {},
20835
20839
  next: {
20836
20840
  inspect: inspectCommand,
package/dist/index.js CHANGED
@@ -284,10 +284,10 @@ var SDK_RELEASE = {
284
284
  // 0.1.108 ships explicit dataset column/tool recompute policy and removes
285
285
  // the SDK enrich generator's one-second stale policy.
286
286
  // 0.1.110 ships authored V2 prebuilts and required top-level play descriptions.
287
- version: "0.1.141",
287
+ version: "0.1.143",
288
288
  apiContract: "2026-06-dataset-column-cell-stale-hard-cutover",
289
289
  supportPolicy: {
290
- latest: "0.1.141",
290
+ latest: "0.1.143",
291
291
  minimumSupported: "0.1.53",
292
292
  deprecatedBelow: "0.1.53",
293
293
  commandMinimumSupported: [
package/dist/index.mjs CHANGED
@@ -206,10 +206,10 @@ var SDK_RELEASE = {
206
206
  // 0.1.108 ships explicit dataset column/tool recompute policy and removes
207
207
  // the SDK enrich generator's one-second stale policy.
208
208
  // 0.1.110 ships authored V2 prebuilts and required top-level play descriptions.
209
- version: "0.1.141",
209
+ version: "0.1.143",
210
210
  apiContract: "2026-06-dataset-column-cell-stale-hard-cutover",
211
211
  supportPolicy: {
212
- latest: "0.1.141",
212
+ latest: "0.1.143",
213
213
  minimumSupported: "0.1.53",
214
214
  deprecatedBelow: "0.1.53",
215
215
  commandMinimumSupported: [
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "deepline",
3
- "version": "0.1.141",
3
+ "version": "0.1.143",
4
4
  "description": "Deepline SDK + CLI — B2B data enrichment powered by durable cloud execution",
5
5
  "license": "MIT",
6
6
  "repository": {