deepline 0.1.53 → 0.1.55

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.
@@ -1,80 +1,52 @@
1
- /**
2
- * Execution profile = the (scheduler, runner, dedup) tuple selected for a run.
3
- *
4
- * Profiles define the supported execution architectures:
5
- * - `workers_edge` — Full-CF: Dynamic Workers + Cloudflare Workflows + DO dedup (default)
6
- * - `local` — Local subprocess + in-process scheduler (for tests)
7
- *
8
- * Selection: the API hardcodes `workers_edge` as the default. Per-run
9
- * overrides happen via the `profile` field on POST /api/v2/plays/run
10
- * — never via env vars. The CLI does not decide profiles.
11
- */
12
-
13
- import { PLAY_RUNTIME_BACKENDS, type PlayRuntimeBackendId } from './backend';
14
- import {
15
- PLAY_SCHEDULER_BACKENDS,
16
- type PlaySchedulerBackendId,
17
- } from './scheduler-backend';
1
+ import type { PlayRuntimeBackendId } from './backend';
2
+ import type { PlayArtifactKind } from './backend';
3
+ import type { PlayDedupBackendId } from './dedup-backend';
4
+ import type { PlaySchedulerBackendId } from './scheduler-backend';
18
5
  import {
19
- PLAY_DEDUP_BACKENDS,
20
- type PlayDedupBackendId,
21
- } from './dedup-backend';
6
+ PLAY_RUNTIME_PROVIDERS,
7
+ PLAY_RUNTIME_PROVIDER_IDS,
8
+ defaultPlayRuntimeProvider,
9
+ resolvePlayRuntimeProvider,
10
+ type PlayRuntimeProviderId,
11
+ } from './providers';
22
12
 
23
13
  export type PlayExecutionProfile = {
24
14
  id: PlayExecutionProfileId;
25
15
  scheduler: PlaySchedulerBackendId;
26
16
  runner: PlayRuntimeBackendId;
27
17
  dedup: PlayDedupBackendId;
18
+ artifactKind: PlayArtifactKind;
28
19
  label: string;
29
20
  };
30
21
 
31
22
  export const PLAY_EXECUTION_PROFILE_IDS = {
32
- workersEdge: 'workers_edge',
33
- local: 'local',
34
- } as const;
23
+ ...PLAY_RUNTIME_PROVIDER_IDS,
24
+ };
35
25
 
36
- export type PlayExecutionProfileId =
37
- (typeof PLAY_EXECUTION_PROFILE_IDS)[keyof typeof PLAY_EXECUTION_PROFILE_IDS];
26
+ export type PlayExecutionProfileId = PlayRuntimeProviderId;
38
27
 
39
28
  export const PLAY_EXECUTION_PROFILES: Record<
40
29
  PlayExecutionProfileId,
41
30
  PlayExecutionProfile
42
- > = {
43
- workers_edge: {
44
- id: 'workers_edge',
45
- scheduler: PLAY_SCHEDULER_BACKENDS.cfWorkflows,
46
- runner: PLAY_RUNTIME_BACKENDS.cloudflareWorkers,
47
- dedup: PLAY_DEDUP_BACKENDS.durableObject,
48
- label: 'Cloudflare Dynamic Workflows + Dynamic Workers + DO dedup',
49
- },
50
- local: {
51
- id: 'local',
52
- scheduler: PLAY_SCHEDULER_BACKENDS.temporal,
53
- runner: PLAY_RUNTIME_BACKENDS.localProcess,
54
- dedup: PLAY_DEDUP_BACKENDS.inMemory,
55
- label: 'Local Temporal scheduler + local subprocess runner (tests)',
56
- },
57
- };
31
+ > = PLAY_RUNTIME_PROVIDERS;
58
32
 
59
33
  export function defaultExecutionProfile(): PlayExecutionProfile {
60
- // Hardcoded. The full-Cloudflare path is the only production execution
61
- // story: Dynamic Workflows + Dynamic Workers + DO dedup. local remains
62
- // selectable via the per-run `profile` body field on POST /api/v2/plays/run
63
- // for tests; do not reintroduce env-var-based switching here.
64
- return PLAY_EXECUTION_PROFILES.workers_edge;
34
+ return defaultPlayRuntimeProvider();
65
35
  }
66
36
 
67
37
  export function resolveExecutionProfile(
68
38
  override?: string | null,
69
39
  ): PlayExecutionProfile {
70
- if (override?.trim()) {
71
- const id = override.trim();
72
- if (id in PLAY_EXECUTION_PROFILES) {
73
- return PLAY_EXECUTION_PROFILES[id as PlayExecutionProfileId];
40
+ try {
41
+ return resolvePlayRuntimeProvider(override);
42
+ } catch (error) {
43
+ if (override?.trim()) {
44
+ throw new Error(
45
+ `Unknown execution profile "${override.trim()}". Expected one of: ${Object.keys(
46
+ PLAY_EXECUTION_PROFILES,
47
+ ).join(', ')}.`,
48
+ );
74
49
  }
75
- throw new Error(
76
- `Unknown execution profile "${id}". Expected one of: ${Object.keys(PLAY_EXECUTION_PROFILES).join(', ')}.`,
77
- );
50
+ throw error;
78
51
  }
79
- return defaultExecutionProfile();
80
52
  }
@@ -0,0 +1,71 @@
1
+ import {
2
+ PLAY_RUNTIME_BACKENDS,
3
+ PLAY_ARTIFACT_KINDS,
4
+ type PlayArtifactKind,
5
+ type PlayRuntimeBackendId,
6
+ } from './backend';
7
+ import { PLAY_DEDUP_BACKENDS, type PlayDedupBackendId } from './dedup-backend';
8
+ import {
9
+ PLAY_SCHEDULER_BACKENDS,
10
+ type PlaySchedulerBackendId,
11
+ } from './scheduler-backend';
12
+
13
+ export const PLAY_RUNTIME_PROVIDER_IDS = {
14
+ workersEdge: 'workers_edge',
15
+ local: 'local',
16
+ } as const;
17
+
18
+ export type PlayRuntimeProviderId =
19
+ (typeof PLAY_RUNTIME_PROVIDER_IDS)[keyof typeof PLAY_RUNTIME_PROVIDER_IDS];
20
+
21
+ export type PlayRuntimeProviderDescriptor = {
22
+ id: PlayRuntimeProviderId;
23
+ scheduler: PlaySchedulerBackendId;
24
+ runner: PlayRuntimeBackendId;
25
+ dedup: PlayDedupBackendId;
26
+ artifactKind: PlayArtifactKind;
27
+ label: string;
28
+ };
29
+
30
+ export const PLAY_RUNTIME_PROVIDERS: Record<
31
+ PlayRuntimeProviderId,
32
+ PlayRuntimeProviderDescriptor
33
+ > = {
34
+ workers_edge: {
35
+ id: PLAY_RUNTIME_PROVIDER_IDS.workersEdge,
36
+ scheduler: PLAY_SCHEDULER_BACKENDS.cfWorkflows,
37
+ runner: PLAY_RUNTIME_BACKENDS.cloudflareWorkers,
38
+ dedup: PLAY_DEDUP_BACKENDS.durableObject,
39
+ artifactKind: PLAY_ARTIFACT_KINDS.esmWorkers,
40
+ label: 'Cloudflare Dynamic Workflows + Dynamic Workers + DO dedup',
41
+ },
42
+ local: {
43
+ id: PLAY_RUNTIME_PROVIDER_IDS.local,
44
+ scheduler: PLAY_SCHEDULER_BACKENDS.temporal,
45
+ runner: PLAY_RUNTIME_BACKENDS.localProcess,
46
+ dedup: PLAY_DEDUP_BACKENDS.inMemory,
47
+ artifactKind: PLAY_ARTIFACT_KINDS.cjsNode20,
48
+ label: 'Local Temporal scheduler + local subprocess runner (tests)',
49
+ },
50
+ };
51
+
52
+ export function defaultPlayRuntimeProvider(): PlayRuntimeProviderDescriptor {
53
+ return PLAY_RUNTIME_PROVIDERS.workers_edge;
54
+ }
55
+
56
+ export function resolvePlayRuntimeProvider(
57
+ override?: string | null,
58
+ ): PlayRuntimeProviderDescriptor {
59
+ if (override?.trim()) {
60
+ const id = override.trim();
61
+ if (id in PLAY_RUNTIME_PROVIDERS) {
62
+ return PLAY_RUNTIME_PROVIDERS[id as PlayRuntimeProviderId];
63
+ }
64
+ throw new Error(
65
+ `Unknown play runtime provider "${id}". Expected one of: ${Object.keys(
66
+ PLAY_RUNTIME_PROVIDERS,
67
+ ).join(', ')}.`,
68
+ );
69
+ }
70
+ return defaultPlayRuntimeProvider();
71
+ }
@@ -42,6 +42,12 @@ export type PlaySchedulerSubmitInput = {
42
42
  playId: string;
43
43
  playName: string;
44
44
  artifactStorageKey: string;
45
+ /**
46
+ * Optional inline artifact for schedulers that run the legacy Temporal
47
+ * workflow path. Workers-edge schedulers use artifactStorageKey plus
48
+ * dynamicWorkerCode instead.
49
+ */
50
+ runtimeArtifact?: unknown;
45
51
  artifactHash: string;
46
52
  graphHash: string;
47
53
  input: Record<string, unknown>;
@@ -116,7 +122,9 @@ export type PlaySchedulerRunHandle = {
116
122
  * Stream live progress events. Implementations may use SSE, polling, etc.
117
123
  * The contract: yields events in order until terminal status.
118
124
  */
119
- observe(options?: { signal?: AbortSignal }): AsyncIterable<PlaySchedulerProgressEvent>;
125
+ observe(options?: {
126
+ signal?: AbortSignal;
127
+ }): AsyncIterable<PlaySchedulerProgressEvent>;
120
128
  /** Cooperatively cancel the run. */
121
129
  cancel(): Promise<void>;
122
130
  /** Inject an external event (HITL, webhook). */