deepline 0.1.152 → 0.1.154

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (48) hide show
  1. package/dist/bundling-sources/apps/play-runner-workers/src/coordinator-entry.ts +46 -6
  2. package/dist/bundling-sources/apps/play-runner-workers/src/entry.ts +1180 -825
  3. package/dist/bundling-sources/apps/play-runner-workers/src/runtime/batching.ts +34 -18
  4. package/dist/bundling-sources/apps/play-runner-workers/src/runtime/harness-receipt-store.ts +41 -0
  5. package/dist/bundling-sources/apps/play-runner-workers/src/runtime/receipts.ts +143 -8
  6. package/dist/bundling-sources/apps/play-runner-workers/src/runtime/tool-receipts.ts +104 -0
  7. package/dist/bundling-sources/sdk/src/index.ts +0 -1
  8. package/dist/bundling-sources/sdk/src/play.ts +3 -48
  9. package/dist/bundling-sources/sdk/src/plays/harness-stub.ts +27 -2
  10. package/dist/bundling-sources/sdk/src/release.ts +2 -2
  11. package/dist/bundling-sources/sdk/src/worker-play-entry.ts +0 -10
  12. package/dist/bundling-sources/shared_libs/play-data-plane/index.ts +0 -1
  13. package/dist/bundling-sources/shared_libs/play-runtime/app-runtime-api.ts +87 -0
  14. package/dist/bundling-sources/shared_libs/play-runtime/batch-runtime.ts +0 -59
  15. package/dist/bundling-sources/shared_libs/play-runtime/cell-staleness.ts +0 -253
  16. package/dist/bundling-sources/shared_libs/play-runtime/context.ts +805 -1570
  17. package/dist/bundling-sources/shared_libs/play-runtime/ctx-types.ts +47 -74
  18. package/dist/bundling-sources/shared_libs/play-runtime/default-batch-strategies.ts +36 -14
  19. package/dist/bundling-sources/shared_libs/play-runtime/durable-call-cache.ts +145 -0
  20. package/dist/bundling-sources/shared_libs/play-runtime/durable-receipt-execution.ts +284 -0
  21. package/dist/bundling-sources/shared_libs/play-runtime/postgres-json.ts +12 -5
  22. package/dist/bundling-sources/shared_libs/play-runtime/run-lifecycle-policy.ts +78 -0
  23. package/dist/bundling-sources/shared_libs/play-runtime/run-snapshot-stream.ts +10 -45
  24. package/dist/bundling-sources/shared_libs/play-runtime/runtime-actions.ts +1 -0
  25. package/dist/bundling-sources/shared_libs/play-runtime/runtime-api.ts +923 -535
  26. package/dist/bundling-sources/shared_libs/play-runtime/runtime-pg-driver-neon-serverless.ts +58 -78
  27. package/dist/bundling-sources/shared_libs/play-runtime/runtime-pg-driver.ts +12 -1
  28. package/dist/bundling-sources/shared_libs/play-runtime/step-program-dataset-builder.ts +1 -14
  29. package/dist/bundling-sources/shared_libs/play-runtime/tool-execution-outcome.ts +159 -0
  30. package/dist/bundling-sources/shared_libs/play-runtime/tool-result-types.ts +4 -1
  31. package/dist/bundling-sources/shared_libs/play-runtime/work-receipts.ts +32 -0
  32. package/dist/bundling-sources/shared_libs/plays/definition.ts +4 -2
  33. package/dist/bundling-sources/shared_libs/plays/runtime-validation.ts +3 -14
  34. package/dist/bundling-sources/shared_libs/plays/static-pipeline.ts +1 -43
  35. package/dist/cli/index.js +1301 -399
  36. package/dist/cli/index.mjs +1269 -361
  37. package/dist/{compiler-manifest-BjoRENv9.d.ts → compiler-manifest-DW1flrHk.d.mts} +0 -9
  38. package/dist/{compiler-manifest-BjoRENv9.d.mts → compiler-manifest-DW1flrHk.d.ts} +0 -9
  39. package/dist/index.d.mts +9 -38
  40. package/dist/index.d.ts +9 -38
  41. package/dist/index.js +22 -11
  42. package/dist/index.mjs +22 -11
  43. package/dist/plays/bundle-play-file.d.mts +2 -2
  44. package/dist/plays/bundle-play-file.d.ts +2 -2
  45. package/package.json +1 -1
  46. package/dist/bundling-sources/shared_libs/play-data-plane/cell-policy.ts +0 -76
  47. package/dist/bundling-sources/shared_libs/play-runtime/progress-emitter.ts +0 -197
  48. package/dist/bundling-sources/shared_libs/play-runtime/waterfall-replay.ts +0 -79
@@ -1101,12 +1101,11 @@ async function markWorkflowRuntimeFailure(input: {
1101
1101
  const shouldPreserveRawError =
1102
1102
  failure.code === 'RUN_FAILED' ||
1103
1103
  (failure.cause !== undefined && failure.message === failure.cause);
1104
- const normalizedError =
1105
- shouldPreserveRawError
1106
- ? `DynamicWorkflow runner failed: ${errorName}: ${errorMessage}${
1107
- errorStack ? `\n${errorStack}` : ''
1108
- }`
1109
- : `DynamicWorkflow runner failed: ${failure.message}`;
1104
+ const normalizedError = shouldPreserveRawError
1105
+ ? `DynamicWorkflow runner failed: ${errorName}: ${errorMessage}${
1106
+ errorStack ? `\n${errorStack}` : ''
1107
+ }`
1108
+ : `DynamicWorkflow runner failed: ${failure.message}`;
1110
1109
  const headers = new Headers({
1111
1110
  authorization: `Bearer ${executorToken}`,
1112
1111
  'content-type': 'application/json',
@@ -1499,6 +1498,7 @@ async function restartWorkflowAfterPlatformReset(input: {
1499
1498
 
1500
1499
  async function mintChildWorkflowExecutorToken(input: {
1501
1500
  env: CoordinatorEnv;
1501
+ baseUrl: string;
1502
1502
  parentExecutorToken: string;
1503
1503
  parentRunId: string;
1504
1504
  parentPlayName: string;
@@ -1508,6 +1508,7 @@ async function mintChildWorkflowExecutorToken(input: {
1508
1508
  }): Promise<string> {
1509
1509
  const response = await input.env.HARNESS.runtimeApiCall({
1510
1510
  executorToken: input.parentExecutorToken,
1511
+ baseUrl: input.baseUrl,
1511
1512
  path: '/api/v2/plays/internal/child-executor-token',
1512
1513
  headers: { 'x-deepline-request-id': crypto.randomUUID() },
1513
1514
  timeoutMs: 15_000,
@@ -1609,6 +1610,7 @@ async function reencryptChildDbSessionForExecutor(input: {
1609
1610
 
1610
1611
  async function createChildRuntimeDbSession(input: {
1611
1612
  env: CoordinatorEnv;
1613
+ baseUrl: string;
1612
1614
  childExecutorToken: string;
1613
1615
  childPlayName: string;
1614
1616
  requirement: RuntimeDbSessionRequirement;
@@ -1618,6 +1620,7 @@ async function createChildRuntimeDbSession(input: {
1618
1620
  const decryptionKey = await generateDbSessionPostgresUrlDecryptionKey();
1619
1621
  const response = await input.env.HARNESS.runtimeApiCall({
1620
1622
  executorToken: input.childExecutorToken,
1623
+ baseUrl: input.baseUrl,
1621
1624
  path: '/api/v2/plays/internal/runtime',
1622
1625
  headers: { 'x-deepline-request-id': crypto.randomUUID() },
1623
1626
  timeoutMs: 15_000,
@@ -1673,6 +1676,7 @@ async function createChildRuntimeDbSession(input: {
1673
1676
 
1674
1677
  async function preloadChildRuntimeDbSessions(input: {
1675
1678
  env: CoordinatorEnv;
1679
+ baseUrl: string;
1676
1680
  childExecutorToken: string;
1677
1681
  childRunId: string;
1678
1682
  childPlayName: string;
@@ -1692,6 +1696,7 @@ async function preloadChildRuntimeDbSessions(input: {
1692
1696
  ...(requirement.limits ? { limits: requirement.limits } : {}),
1693
1697
  session: await createChildRuntimeDbSession({
1694
1698
  env: input.env,
1699
+ baseUrl: input.baseUrl,
1695
1700
  childExecutorToken: input.childExecutorToken,
1696
1701
  childPlayName: input.childPlayName,
1697
1702
  requirement,
@@ -1712,6 +1717,7 @@ async function preloadChildRuntimeDbSessions(input: {
1712
1717
 
1713
1718
  async function registerInlineChildRunWithRuntime(input: {
1714
1719
  env: CoordinatorEnv;
1720
+ baseUrl: string;
1715
1721
  childExecutorToken: string;
1716
1722
  childRunId: string;
1717
1723
  childPlayName: string;
@@ -1720,6 +1726,7 @@ async function registerInlineChildRunWithRuntime(input: {
1720
1726
  }): Promise<void> {
1721
1727
  const response = await input.env.HARNESS.runtimeApiCall({
1722
1728
  executorToken: input.childExecutorToken,
1729
+ baseUrl: input.baseUrl,
1723
1730
  path: '/api/v2/plays/internal/runtime',
1724
1731
  headers: { 'x-deepline-request-id': crypto.randomUUID() },
1725
1732
  timeoutMs: 15_000,
@@ -1762,6 +1769,7 @@ type CoordinatorRuntimeApiTiming = {
1762
1769
 
1763
1770
  async function callRuntimeApiFromCoordinator(input: {
1764
1771
  env: CoordinatorEnv;
1772
+ baseUrl: string;
1765
1773
  executorToken: string;
1766
1774
  body: unknown;
1767
1775
  }): Promise<{
@@ -1793,6 +1801,7 @@ async function callRuntimeApiFromCoordinator(input: {
1793
1801
  const fetchStartedAt = Date.now();
1794
1802
  const response = await input.env.HARNESS.runtimeApiCall({
1795
1803
  executorToken: input.executorToken,
1804
+ baseUrl: input.baseUrl,
1796
1805
  path: '/api/v2/plays/internal/runtime',
1797
1806
  body,
1798
1807
  headers: {
@@ -1816,6 +1825,7 @@ async function callRuntimeApiFromCoordinator(input: {
1816
1825
 
1817
1826
  async function prepareInlineChildRunWithRuntime(input: {
1818
1827
  env: CoordinatorEnv;
1828
+ baseUrl: string;
1819
1829
  parentExecutorToken: string;
1820
1830
  parentRunId: string;
1821
1831
  parentPlayName: string;
@@ -1832,6 +1842,7 @@ async function prepareInlineChildRunWithRuntime(input: {
1832
1842
  }> {
1833
1843
  const response = await callRuntimeApiFromCoordinator({
1834
1844
  env: input.env,
1845
+ baseUrl: input.baseUrl,
1835
1846
  executorToken: input.parentExecutorToken,
1836
1847
  body: {
1837
1848
  action: 'prepare_inline_child_run',
@@ -2296,6 +2307,7 @@ async function executeChildInline(input: {
2296
2307
  const { childToken, preloadedDbSessions, prepareTimings, transportTimings } =
2297
2308
  await prepareInlineChildRunWithRuntime({
2298
2309
  env: input.env,
2310
+ baseUrl: resolveRuntimeBaseUrl(input.env, input.body),
2299
2311
  parentExecutorToken,
2300
2312
  parentRunId: input.parentRunId,
2301
2313
  parentPlayName,
@@ -2565,6 +2577,7 @@ async function submitChildWorkflowThroughCoordinator(input: {
2565
2577
  const tokenStartedAt = Date.now();
2566
2578
  const childToken = await mintChildWorkflowExecutorToken({
2567
2579
  env: input.env,
2580
+ baseUrl,
2568
2581
  parentExecutorToken,
2569
2582
  parentRunId: input.parentRunId,
2570
2583
  parentPlayName:
@@ -2584,6 +2597,7 @@ async function submitChildWorkflowThroughCoordinator(input: {
2584
2597
  const dbSessionStartedAt = Date.now();
2585
2598
  const preloadedDbSessions = await preloadChildRuntimeDbSessions({
2586
2599
  env: input.env,
2600
+ baseUrl,
2587
2601
  childExecutorToken: childToken,
2588
2602
  childRunId,
2589
2603
  childPlayName,
@@ -3283,6 +3297,32 @@ async function coordinatorRouteFetch(
3283
3297
  null,
3284
3298
  });
3285
3299
  }
3300
+ if (url.pathname === '/harness/probe') {
3301
+ const authError = authorizeCoordinatorControlRequest({ request, env });
3302
+ if (authError) return authError;
3303
+ try {
3304
+ const harness = await env.HARNESS.ping();
3305
+ return Response.json({
3306
+ ok: true,
3307
+ coordinatorDeployMarker: env.DEEPLINE_COORDINATOR_DEPLOY_MARKER ?? null,
3308
+ coordinatorRuntimeDeployVersion:
3309
+ env.CF_VERSION_METADATA?.id ??
3310
+ env.DEEPLINE_COORDINATOR_DEPLOY_MARKER ??
3311
+ null,
3312
+ harnessDeployMarker: harness.deployMarker,
3313
+ harnessRuntimeDeployVersion: harness.runtimeDeployVersion,
3314
+ harnessTs: harness.ts,
3315
+ });
3316
+ } catch (error) {
3317
+ return coordinatorRouteErrorResponse({
3318
+ logTag: '[coordinator.harness_probe.error]',
3319
+ code: 'COORDINATOR_HARNESS_PROBE_FAILED',
3320
+ phase: 'coordinator.harness_probe',
3321
+ runId: null,
3322
+ error,
3323
+ });
3324
+ }
3325
+ }
3286
3326
  if (url.pathname === '/staged-files/put') {
3287
3327
  const authError = authorizeCoordinatorControlRequest({ request, env });
3288
3328
  if (authError) return authError;