deepline 0.1.212 → 0.1.213

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 (36) hide show
  1. package/dist/bundling-sources/apps/play-runner-workers/src/entry.ts +167 -329
  2. package/dist/bundling-sources/sdk/src/index.ts +2 -0
  3. package/dist/bundling-sources/sdk/src/play.ts +8 -1
  4. package/dist/bundling-sources/sdk/src/plays/harness-stub.ts +11 -1
  5. package/dist/bundling-sources/sdk/src/release.ts +2 -2
  6. package/dist/bundling-sources/shared_libs/play-runtime/app-runtime-api.ts +49 -0
  7. package/dist/bundling-sources/shared_libs/play-runtime/child-execution-placement.ts +14 -0
  8. package/dist/bundling-sources/shared_libs/play-runtime/child-execution-strategy.ts +57 -23
  9. package/dist/bundling-sources/shared_libs/play-runtime/completed-receipt-cache.ts +166 -0
  10. package/dist/bundling-sources/shared_libs/play-runtime/context.ts +142 -101
  11. package/dist/bundling-sources/shared_libs/play-runtime/ctx-contract.ts +2 -0
  12. package/dist/bundling-sources/shared_libs/play-runtime/ctx-types.ts +30 -1
  13. package/dist/bundling-sources/shared_libs/play-runtime/durable-receipt-execution.ts +160 -2
  14. package/dist/bundling-sources/shared_libs/play-runtime/gateway-auth-session.ts +93 -0
  15. package/dist/bundling-sources/shared_libs/play-runtime/play-call-execution.ts +1 -0
  16. package/dist/bundling-sources/shared_libs/play-runtime/receipt-completion-sink.ts +16 -1
  17. package/dist/bundling-sources/shared_libs/play-runtime/receipt-state-sink.ts +10 -0
  18. package/dist/bundling-sources/shared_libs/play-runtime/resource-governor.ts +80 -3
  19. package/dist/bundling-sources/shared_libs/play-runtime/runner-backends/backends/daytona-session-execution.ts +94 -0
  20. package/dist/bundling-sources/shared_libs/play-runtime/runner-backends/backends/daytona.ts +54 -1
  21. package/dist/bundling-sources/shared_libs/play-runtime/runtime-api.ts +477 -85
  22. package/dist/bundling-sources/shared_libs/play-runtime/runtime-postgres-admission.ts +162 -0
  23. package/dist/bundling-sources/shared_libs/play-runtime/sheet-attempt-sql.ts +16 -17
  24. package/dist/bundling-sources/shared_libs/play-runtime/work-receipts.ts +1 -0
  25. package/dist/bundling-sources/shared_libs/plays/static-pipeline.ts +2 -4
  26. package/dist/cli/index.js +2 -2
  27. package/dist/cli/index.mjs +2 -2
  28. package/dist/{compiler-manifest-j6z8qzpd.d.mts → compiler-manifest-BhgZ23A4.d.mts} +1 -0
  29. package/dist/{compiler-manifest-j6z8qzpd.d.ts → compiler-manifest-BhgZ23A4.d.ts} +1 -0
  30. package/dist/index.d.mts +8 -5
  31. package/dist/index.d.ts +8 -5
  32. package/dist/index.js +2 -2
  33. package/dist/index.mjs +2 -2
  34. package/dist/plays/bundle-play-file.d.mts +2 -2
  35. package/dist/plays/bundle-play-file.d.ts +2 -2
  36. package/package.json +1 -1
@@ -32,7 +32,10 @@ import {
32
32
  validateDaytonaExecutionContext,
33
33
  } from './daytona-lifecycle';
34
34
  import { stageDaytonaRunnerPayload } from './daytona-payload-transport';
35
- import { startDetachedDaytonaCommand } from './daytona-session-execution';
35
+ import {
36
+ inspectDetachedDaytonaStartup,
37
+ startDetachedDaytonaCommand,
38
+ } from './daytona-session-execution';
36
39
 
37
40
  const DAYTONA_EXECUTE_TIMEOUT_SECONDS = STANDARD_PLAY_RUNTIME_LIMIT_SECONDS;
38
41
  const STANDARD_WORKFLOW_RUNTIME_LIMIT_ERROR = `Based on this plan, max runtime is ${STANDARD_PLAY_RUNTIME_LIMIT_LABEL}. Use smaller batches; ask for runtime.`;
@@ -42,6 +45,8 @@ const DAYTONA_RUNTIME_INITIALIZATION_MAX_ATTEMPTS = 2;
42
45
  const DAYTONA_INFRASTRUCTURE_MAX_ATTEMPTS = 2;
43
46
  const DAYTONA_UPLOAD_MAX_ATTEMPTS = 2;
44
47
  const DAYTONA_UPLOAD_ATTEMPT_DEADLINE_MS = 90_000;
48
+ const DAYTONA_STARTUP_DIAGNOSTIC_DELAY_MS = 15_000;
49
+ const DAYTONA_STARTUP_TRACE_ENV = 'DEEPLINE_DAYTONA_STARTUP_TRACE';
45
50
 
46
51
  const RUNTIME_POSTGRES_CONNECT_RETRY_PATTERN =
47
52
  /\bRuntime Postgres\b.*\b(connection timed out|connect timeout|ETIMEDOUT|ECONNRESET|ECONNREFUSED|Connection terminated|Connection ended unexpectedly)\b/i;
@@ -749,8 +754,56 @@ export const daytonaPlayRunnerBackend: PlayRunnerBackend = {
749
754
  cmdId: start.cmdId,
750
755
  runnerAttempt,
751
756
  ceilingSeconds: DAYTONA_EXECUTE_TIMEOUT_SECONDS,
757
+ outputPath: stagedPayload.outputPath,
758
+ exitCodePath: stagedPayload.exitCodePath,
752
759
  elapsedMs: Date.now() - startedAt,
753
760
  });
761
+ // Daytona acknowledges an async command with only a cmdId. It does
762
+ // not expose a queued/running state, and the backend parks before the
763
+ // runner contacts the runtime sheet. During startup investigations,
764
+ // retain a bounded snapshot while the sandbox is still alive; the
765
+ // normal cancellation path otherwise deletes the only evidence.
766
+ // This is opt-in because it adds Daytona control-plane calls to every
767
+ // run. The diagnostic excludes command lines and environment values.
768
+ if (process.env[DAYTONA_STARTUP_TRACE_ENV] === '1') {
769
+ const diagnosticTimer = setTimeout(() => {
770
+ void inspectDetachedDaytonaStartup({
771
+ sandbox,
772
+ sessionId: start.sessionId,
773
+ cmdId: start.cmdId,
774
+ exitCodePath: stagedPayload.exitCodePath,
775
+ }).then(
776
+ (diagnostic) =>
777
+ emitDaytonaStage(
778
+ callbacks,
779
+ config.context,
780
+ 'execute:startup_diagnostic',
781
+ {
782
+ sandboxId: sandbox.id,
783
+ sessionId: start.sessionId,
784
+ cmdId: start.cmdId,
785
+ diagnostic,
786
+ elapsedMs: Date.now() - startedAt,
787
+ },
788
+ ),
789
+ (error: unknown) =>
790
+ emitDaytonaStage(
791
+ callbacks,
792
+ config.context,
793
+ 'execute:startup_diagnostic_failed',
794
+ {
795
+ sandboxId: sandbox.id,
796
+ sessionId: start.sessionId,
797
+ cmdId: start.cmdId,
798
+ errorType:
799
+ error instanceof Error ? error.name : 'unknown',
800
+ elapsedMs: Date.now() - startedAt,
801
+ },
802
+ ),
803
+ );
804
+ }, DAYTONA_STARTUP_DIAGNOSTIC_DELAY_MS);
805
+ diagnosticTimer.unref?.();
806
+ }
754
807
  return {
755
808
  status: 'suspended',
756
809
  suspension: {