deepline 0.1.54 → 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.
- package/dist/cli/index.js +214 -67
- package/dist/cli/index.mjs +222 -68
- package/dist/index.js +2 -2
- package/dist/index.mjs +2 -2
- package/dist/repo/sdk/src/plays/bundle-play-file.ts +27 -18
- package/dist/repo/sdk/src/release.ts +2 -2
- package/dist/repo/shared_libs/play-runtime/profiles.ts +26 -54
- package/dist/repo/shared_libs/play-runtime/providers.ts +71 -0
- package/dist/repo/shared_libs/play-runtime/scheduler-backend.ts +9 -1
- package/dist/repo/shared_libs/plays/bundling/index.ts +225 -69
- package/package.json +1 -1
|
@@ -1,80 +1,52 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
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
|
-
|
|
20
|
-
|
|
21
|
-
|
|
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
|
-
|
|
33
|
-
|
|
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
|
-
|
|
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
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
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
|
|
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?: {
|
|
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). */
|