deepline 0.1.24 → 0.1.26

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/index.d.mts CHANGED
@@ -142,6 +142,8 @@ type PlayStaticSubstepSnapshot = PlayStaticSubstepMetadataSnapshot & ({
142
142
  });
143
143
  type PlayCompilerDependencyManifest = {
144
144
  playName: string;
145
+ /** Original source path for direct imported definePlay dependencies. */
146
+ filePath?: string;
145
147
  sourceHash: string;
146
148
  graphHash: string;
147
149
  artifactHash: string;
@@ -1399,7 +1401,7 @@ declare class DeeplineClient {
1399
1401
  }>;
1400
1402
  }
1401
1403
 
1402
- declare const SDK_VERSION = "0.1.24";
1404
+ declare const SDK_VERSION = "0.1.26";
1403
1405
  declare const SDK_API_CONTRACT = "2026-05-runs-v2";
1404
1406
 
1405
1407
  /**
package/dist/index.d.ts CHANGED
@@ -142,6 +142,8 @@ type PlayStaticSubstepSnapshot = PlayStaticSubstepMetadataSnapshot & ({
142
142
  });
143
143
  type PlayCompilerDependencyManifest = {
144
144
  playName: string;
145
+ /** Original source path for direct imported definePlay dependencies. */
146
+ filePath?: string;
145
147
  sourceHash: string;
146
148
  graphHash: string;
147
149
  artifactHash: string;
@@ -1399,7 +1401,7 @@ declare class DeeplineClient {
1399
1401
  }>;
1400
1402
  }
1401
1403
 
1402
- declare const SDK_VERSION = "0.1.24";
1404
+ declare const SDK_VERSION = "0.1.26";
1403
1405
  declare const SDK_API_CONTRACT = "2026-05-runs-v2";
1404
1406
 
1405
1407
  /**
package/dist/index.js CHANGED
@@ -241,7 +241,7 @@ function resolveConfig(options) {
241
241
  }
242
242
 
243
243
  // src/version.ts
244
- var SDK_VERSION = "0.1.24";
244
+ var SDK_VERSION = "0.1.26";
245
245
  var SDK_API_CONTRACT = "2026-05-runs-v2";
246
246
 
247
247
  // ../shared_libs/play-runtime/coordinator-headers.ts
@@ -586,7 +586,7 @@ function updatePlayLiveStatusState(state, event) {
586
586
  const runId = typeof payload.runId === "string" && payload.runId ? payload.runId : state.runId;
587
587
  const status = normalizeLiveStatus(payload.status) ?? state.status;
588
588
  const logs = readStringArray(payload.logs);
589
- if (logs.length > 0 || event.type === "play.run.snapshot") {
589
+ if (logs.length > 0 || event.type === "play.run.snapshot" || event.type === "play.run.final_status") {
590
590
  state.logs = logs;
591
591
  }
592
592
  if ("result" in payload) {
package/dist/index.mjs CHANGED
@@ -195,7 +195,7 @@ function resolveConfig(options) {
195
195
  }
196
196
 
197
197
  // src/version.ts
198
- var SDK_VERSION = "0.1.24";
198
+ var SDK_VERSION = "0.1.26";
199
199
  var SDK_API_CONTRACT = "2026-05-runs-v2";
200
200
 
201
201
  // ../shared_libs/play-runtime/coordinator-headers.ts
@@ -540,7 +540,7 @@ function updatePlayLiveStatusState(state, event) {
540
540
  const runId = typeof payload.runId === "string" && payload.runId ? payload.runId : state.runId;
541
541
  const status = normalizeLiveStatus(payload.status) ?? state.status;
542
542
  const logs = readStringArray(payload.logs);
543
- if (logs.length > 0 || event.type === "play.run.snapshot") {
543
+ if (logs.length > 0 || event.type === "play.run.snapshot" || event.type === "play.run.final_status") {
544
544
  state.logs = logs;
545
545
  }
546
546
  if ("result" in payload) {
@@ -28,7 +28,7 @@ import type {
28
28
  PlayRuntimeManifest,
29
29
  PlayRuntimeManifestMap,
30
30
  } from '../../../shared_libs/plays/compiler-manifest';
31
- import { runtimeRunActions } from '../../../shared_libs/play-runtime/runtime-actions';
31
+ import type { PlayRunLedgerEvent } from '../../../shared_libs/play-runtime/run-ledger';
32
32
  import {
33
33
  COORDINATOR_INTERNAL_TOKEN_HEADER,
34
34
  COORDINATOR_RUN_SCOPE_HEADER,
@@ -45,11 +45,22 @@ export type PlayWorkflowParams = {
45
45
  artifactHash: string;
46
46
  graphHash: string;
47
47
  input: Record<string, unknown>;
48
- inputFile?: { name?: string; r2Key?: string; path?: string } | null;
48
+ inputFile?: {
49
+ name?: string;
50
+ r2Key?: string;
51
+ storageKey?: string;
52
+ path?: string;
53
+ fileName?: string;
54
+ logicalPath?: string;
55
+ contentType?: string;
56
+ bytes?: number;
57
+ } | null;
49
58
  inlineCsv?: { name: string; rows: Record<string, unknown>[] } | null;
50
59
  packagedFiles?: Array<{
51
60
  playPath: string;
52
61
  storageKey: string;
62
+ contentType?: string;
63
+ bytes?: number;
53
64
  inlineText?: string;
54
65
  }> | null;
55
66
  contractSnapshot?: unknown;
@@ -508,6 +519,8 @@ type DynamicWorkflowMetadata = {
508
519
  packagedFiles?: Array<{
509
520
  playPath: string;
510
521
  storageKey: string;
522
+ contentType?: string;
523
+ bytes?: number;
511
524
  inlineText?: string;
512
525
  }> | null;
513
526
  };
@@ -1311,16 +1324,21 @@ async function markWorkflowRuntimeFailure(input: {
1311
1324
  });
1312
1325
  const bypass = input.env.VERCEL_PROTECTION_BYPASS_TOKEN?.trim();
1313
1326
  if (bypass) headers.set('x-vercel-protection-bypass', bypass);
1314
- const body = JSON.stringify(
1315
- runtimeRunActions.updateStatus({
1316
- playId: runId,
1317
- status: 'failed',
1318
- error: `DynamicWorkflow runner failed: ${errorName}: ${errorMessage}${
1319
- errorStack ? `\n${errorStack}` : ''
1320
- }`,
1321
- runtimeBackend: 'cf_workflows_dynamic_worker',
1322
- }),
1323
- );
1327
+ const body = JSON.stringify({
1328
+ action: 'append_run_events',
1329
+ playId: runId,
1330
+ events: [
1331
+ {
1332
+ type: 'run.failed',
1333
+ runId,
1334
+ source: 'coordinator',
1335
+ occurredAt: Date.now(),
1336
+ error: `DynamicWorkflow runner failed: ${errorName}: ${errorMessage}${
1337
+ errorStack ? `\n${errorStack}` : ''
1338
+ }`,
1339
+ } satisfies PlayRunLedgerEvent,
1340
+ ],
1341
+ });
1324
1342
  const url = `${baseUrl.replace(/\/$/, '')}/api/v2/plays/internal/runtime`;
1325
1343
  const backoffMs = [200, 500, 1500];
1326
1344
  let lastError: unknown = null;
@@ -1621,6 +1639,15 @@ function buildChildWorkflowParams(input: {
1621
1639
  function runRequestFromPlayWorkflowParams(
1622
1640
  params: PlayWorkflowParams,
1623
1641
  ): Record<string, unknown> {
1642
+ const inputFileName = String(
1643
+ params.inputFile?.name ??
1644
+ params.inputFile?.fileName ??
1645
+ params.inputFile?.logicalPath ??
1646
+ params.inputFile?.path ??
1647
+ '',
1648
+ );
1649
+ const inputStorageKey =
1650
+ params.inputFile?.r2Key ?? params.inputFile?.storageKey ?? null;
1624
1651
  return {
1625
1652
  runId: params.runId,
1626
1653
  callbackUrl: params.baseUrl,
@@ -1632,12 +1659,22 @@ function runRequestFromPlayWorkflowParams(
1632
1659
  userEmail: params.userEmail,
1633
1660
  runtimeInput: params.input,
1634
1661
  inlineCsv: params.inlineCsv ?? null,
1635
- inputR2Keys:
1636
- params.inputFile?.r2Key &&
1637
- (params.inputFile.name || params.inputFile.path)
1662
+ inputFiles:
1663
+ inputStorageKey && inputFileName
1638
1664
  ? {
1639
- [String(params.inputFile.name ?? params.inputFile.path)]:
1640
- params.inputFile.r2Key,
1665
+ [inputFileName]: {
1666
+ logicalPath:
1667
+ params.inputFile?.logicalPath ??
1668
+ params.inputFile?.path ??
1669
+ inputFileName,
1670
+ fileName: params.inputFile?.fileName ?? inputFileName,
1671
+ storageKey: inputStorageKey,
1672
+ contentType: params.inputFile?.contentType ?? null,
1673
+ bytes:
1674
+ typeof params.inputFile?.bytes === 'number'
1675
+ ? params.inputFile.bytes
1676
+ : null,
1677
+ },
1641
1678
  }
1642
1679
  : null,
1643
1680
  packagedFiles: params.packagedFiles ?? null,
@@ -1996,13 +2033,6 @@ export class RuntimeApi extends WorkerEntrypoint<CoordinatorEnv, undefined> {
1996
2033
  ? this.env.DEEPLINE_API_BASE_URL.trim()
1997
2034
  : 'https://code.deepline.com';
1998
2035
  const target = new URL(incoming.pathname + incoming.search, apiBaseUrl);
1999
- const runtimeStatusBody =
2000
- incoming.pathname === '/api/v2/plays/internal/runtime'
2001
- ? await request
2002
- .clone()
2003
- .json()
2004
- .catch(() => null)
2005
- : null;
2006
2036
  const forwarded = new Request(target.toString(), request);
2007
2037
  const bypassToken = this.env.VERCEL_PROTECTION_BYPASS_TOKEN;
2008
2038
  if (typeof bypassToken === 'string' && bypassToken) {
@@ -2018,41 +2048,9 @@ export class RuntimeApi extends WorkerEntrypoint<CoordinatorEnv, undefined> {
2018
2048
  `[RUNTIME_API] ${incoming.pathname} failed: status=${res.status} ` +
2019
2049
  `target=${target.toString()} body=${body.slice(0, 500)}`,
2020
2050
  );
2021
- } else {
2022
- await this.recordRuntimeStatusEvent(runtimeStatusBody).catch(() => null);
2023
2051
  }
2024
2052
  return res;
2025
2053
  }
2026
-
2027
- private async recordRuntimeStatusEvent(body: unknown): Promise<void> {
2028
- if (!isRecord(body) || body.action !== 'update_run_status') {
2029
- return;
2030
- }
2031
- const runId = typeof body.playId === 'string' ? body.playId : '';
2032
- const status = typeof body.status === 'string' ? body.status : '';
2033
- if (!runId || !status) {
2034
- return;
2035
- }
2036
- await appendCoordinatorRunEvent(this.env, {
2037
- runId,
2038
- type: 'progress',
2039
- status,
2040
- ts: Date.now(),
2041
- logs: sanitizeLiveLogLines(body.liveLogs) ?? undefined,
2042
- activeNodeId:
2043
- typeof body.activeNodeId === 'string' ? body.activeNodeId : null,
2044
- activeArtifactTableNamespace:
2045
- typeof body.activeArtifactTableNamespace === 'string'
2046
- ? body.activeArtifactTableNamespace
2047
- : null,
2048
- updatedAt:
2049
- typeof body.lastCheckpointAt === 'number'
2050
- ? body.lastCheckpointAt
2051
- : null,
2052
- liveNodeProgress:
2053
- body.liveNodeProgress !== undefined ? body.liveNodeProgress : undefined,
2054
- });
2055
- }
2056
2054
  }
2057
2055
 
2058
2056
  export class CoordinatorControl extends WorkerEntrypoint<
@@ -3252,7 +3250,7 @@ function stableHash(value: string): string {
3252
3250
  return (hash >>> 0).toString(36);
3253
3251
  }
3254
3252
 
3255
- const DYNAMIC_PLAY_WORKER_HARNESS_VERSION = 'h7-skip-high-volume-tool-traces';
3253
+ const DYNAMIC_PLAY_WORKER_HARNESS_VERSION = 'h11-full-row-dataset-handles';
3256
3254
  const DYNAMIC_WORKER_BUNDLED_CODE_CACHE_MAX_ENTRIES = 64;
3257
3255
  const dynamicWorkerBundledCodeCache = new Map<string, string>();
3258
3256
 
@@ -3548,6 +3546,14 @@ function normalizePackagedFiles(
3548
3546
  .map((entry) => ({
3549
3547
  playPath: String(entry.playPath ?? '').replace(/^\.\//, ''),
3550
3548
  storageKey: String(entry.storageKey ?? ''),
3549
+ contentType:
3550
+ typeof entry.contentType === 'string' ? entry.contentType : undefined,
3551
+ bytes:
3552
+ typeof entry.bytes === 'number' &&
3553
+ Number.isSafeInteger(entry.bytes) &&
3554
+ entry.bytes >= 0
3555
+ ? entry.bytes
3556
+ : undefined,
3551
3557
  inlineText:
3552
3558
  typeof entry.inlineText === 'string' ? entry.inlineText : undefined,
3553
3559
  }))
@@ -4062,8 +4068,13 @@ function mapWorkflowResult(
4062
4068
  runId: string,
4063
4069
  status: InstanceStatus,
4064
4070
  ): Record<string, unknown> {
4065
- const error = readWorkflowError(status);
4066
- const mapped = resolveTerminalStatus(status, error);
4071
+ const rawError = readWorkflowError(status);
4072
+ const mapped = resolveTerminalStatus(status, rawError);
4073
+ const error =
4074
+ rawError ??
4075
+ (mapped === 'failed'
4076
+ ? `Cloudflare workflow reported ${String(status.status ?? 'failed')} without an error payload.`
4077
+ : null);
4067
4078
  const output =
4068
4079
  status.output && typeof status.output === 'object'
4069
4080
  ? (status.output as Record<string, unknown>)
@@ -4131,9 +4142,11 @@ function resolveTerminalStatus(
4131
4142
  function readWorkflowError(status: InstanceStatus): string | null {
4132
4143
  const error = status.error as unknown;
4133
4144
  if (!error) return null;
4134
- if (typeof error === 'string') return error;
4145
+ if (typeof error === 'string') return error.trim() || null;
4135
4146
  if (typeof error === 'object' && 'message' in error) {
4136
- return String((error as { message?: unknown }).message ?? '');
4147
+ const message = String((error as { message?: unknown }).message ?? '');
4148
+ return message.trim() || null;
4137
4149
  }
4138
- return String(error);
4150
+ const message = String(error);
4151
+ return message.trim() || null;
4139
4152
  }
@@ -1061,7 +1061,12 @@ export class PlayDedup implements DurableObject {
1061
1061
  runId: body.runId,
1062
1062
  status: body.status,
1063
1063
  result: body.result,
1064
- error: typeof body.error === 'string' ? body.error : null,
1064
+ error:
1065
+ typeof body.error === 'string' && body.error.trim()
1066
+ ? body.error.trim()
1067
+ : body.status === 'failed'
1068
+ ? 'Cloudflare workflow failed before the runner reported an error.'
1069
+ : null,
1065
1070
  totalRows: body.totalRows,
1066
1071
  durationMs: body.durationMs,
1067
1072
  playName: typeof body.playName === 'string' ? body.playName : null,