deepline 0.1.227 → 0.1.229

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 (46) hide show
  1. package/dist/bundling-sources/apps/play-runner-workers/src/coordinator-entry.ts +76 -1842
  2. package/dist/bundling-sources/apps/play-runner-workers/src/dedup-do.ts +0 -113
  3. package/dist/bundling-sources/apps/play-runner-workers/src/entry.ts +144 -1000
  4. package/dist/bundling-sources/apps/play-runner-workers/src/runtime/ledger-event-batches.ts +81 -0
  5. package/dist/bundling-sources/apps/play-runner-workers/src/workflow-retry-state.ts +1 -50
  6. package/dist/bundling-sources/sdk/src/client.ts +24 -2
  7. package/dist/bundling-sources/sdk/src/play.ts +2 -2
  8. package/dist/bundling-sources/sdk/src/release.ts +2 -2
  9. package/dist/bundling-sources/shared_libs/play-runtime/app-runtime-api.ts +382 -31
  10. package/dist/bundling-sources/shared_libs/play-runtime/child-execution-strategy.ts +84 -79
  11. package/dist/bundling-sources/shared_libs/play-runtime/context.ts +201 -705
  12. package/dist/bundling-sources/shared_libs/play-runtime/coordinator-headers.ts +3 -10
  13. package/dist/bundling-sources/shared_libs/play-runtime/ctx-contract.ts +2 -2
  14. package/dist/bundling-sources/shared_libs/play-runtime/ctx-types.ts +12 -47
  15. package/dist/bundling-sources/shared_libs/play-runtime/governor/block-reserving-budget-state-backend.ts +0 -2
  16. package/dist/bundling-sources/shared_libs/play-runtime/governor/governor.ts +12 -200
  17. package/dist/bundling-sources/shared_libs/play-runtime/governor/policy.ts +2 -17
  18. package/dist/bundling-sources/shared_libs/play-runtime/live-state-contract.ts +3 -9
  19. package/dist/bundling-sources/shared_libs/play-runtime/play-call-execution.ts +6 -1
  20. package/dist/bundling-sources/shared_libs/play-runtime/play-latency-trace.ts +28 -0
  21. package/dist/bundling-sources/shared_libs/play-runtime/run-execution-scope.ts +16 -64
  22. package/dist/bundling-sources/shared_libs/play-runtime/run-ledger.ts +26 -0
  23. package/dist/bundling-sources/shared_libs/play-runtime/run-lifecycle-policy.ts +5 -2
  24. package/dist/bundling-sources/shared_libs/play-runtime/runtime-api-paths.ts +0 -4
  25. package/dist/bundling-sources/shared_libs/play-runtime/runtime-api.ts +81 -18
  26. package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backend.ts +0 -36
  27. package/dist/bundling-sources/shared_libs/play-runtime/suspension.ts +3 -21
  28. package/dist/bundling-sources/shared_libs/play-runtime/test-runtime-seams.ts +9 -1
  29. package/dist/bundling-sources/shared_libs/play-runtime/transport-error-diagnostics.ts +63 -0
  30. package/dist/bundling-sources/shared_libs/plays/static-pipeline.ts +2 -0
  31. package/dist/cli/index.js +78 -11
  32. package/dist/cli/index.mjs +78 -11
  33. package/dist/{compiler-manifest-BhgZ23A4.d.ts → compiler-manifest-CYcwzSOJ.d.mts} +2 -0
  34. package/dist/{compiler-manifest-BhgZ23A4.d.mts → compiler-manifest-CYcwzSOJ.d.ts} +2 -0
  35. package/dist/index.d.mts +3 -3
  36. package/dist/index.d.ts +3 -3
  37. package/dist/index.js +14 -5
  38. package/dist/index.mjs +14 -5
  39. package/dist/plays/bundle-play-file.d.mts +2 -2
  40. package/dist/plays/bundle-play-file.d.ts +2 -2
  41. package/package.json +1 -1
  42. package/dist/bundling-sources/apps/play-runner-workers/src/child-manifest-resolver.ts +0 -108
  43. package/dist/bundling-sources/apps/play-runner-workers/src/child-play-await.ts +0 -374
  44. package/dist/bundling-sources/apps/play-runner-workers/src/child-play-submit.ts +0 -203
  45. package/dist/bundling-sources/shared_libs/play-runtime/child-execution-placement.ts +0 -14
  46. package/dist/bundling-sources/shared_libs/play-runtime/child-run-id.ts +0 -121
@@ -1,121 +0,0 @@
1
- import { sha256Hex, stableStringify } from '../plays/row-identity';
2
-
3
- /**
4
- * Canonical derivation of a `ctx.runPlay(...)` child run id.
5
- *
6
- * Both substrates that launch child runs derive the id here so a child's
7
- * durable run id is stable across replays and shared code:
8
- *
9
- * - workers_edge: the coordinator (`apps/play-runner-workers`) derives the id
10
- * from the durable child idempotency key it receives from the parent's
11
- * runtime (`explicitIdempotencyKey`). Submit retries carry the same key, so
12
- * the retry attaches to the same child run row.
13
- * - in-process shared runtime (`context.ts`): there is no coordinator hop and
14
- * no per-child idempotency key, so the id is derived from the semantic
15
- * fallback (parent lineage + call key + input).
16
- *
17
- * The FORMAT (`play/<slug>/run/child-<digest>`) and the derivation CODE are
18
- * identical on both sides. The DIGEST INPUTS differ by substrate on purpose:
19
- *
20
- * - `explicitIdempotencyKey` is only present on workers_edge (the coordinator
21
- * path). When present it fully determines the digest; the other fields are
22
- * ignored (they already fed the idempotency key upstream).
23
- * - `graphHash` is only known on workers_edge (the compiled child manifest is
24
- * threaded through the coordinator). In-process has no per-child manifest,
25
- * so it passes `null`.
26
- *
27
- * Do NOT reorder or drop digest fields without accounting for coordinator
28
- * child-submit idempotency: two calls that must attach to the same child run
29
- * MUST produce the same id, byte-for-byte.
30
- */
31
- export interface ChildRunIdInputs {
32
- /** Name of the child play being launched (`ctx.runPlay` target). */
33
- childPlayName: string;
34
- /** Run id of the parent making the `ctx.runPlay` call. */
35
- parentRunId: string;
36
- /**
37
- * Durable child idempotency key when the launching substrate has one
38
- * (workers_edge coordinator path). When set, it alone determines the digest.
39
- */
40
- explicitIdempotencyKey?: string | null;
41
- /** Play name of the parent making the call (semantic-fallback input). */
42
- parentPlayName?: string | null;
43
- /** `ctx.runPlay(key, ...)` call key (semantic-fallback input). */
44
- key?: string | null;
45
- /**
46
- * Canonical durable runPlay semantic key when the launching substrate has one.
47
- * This scopes each fresh child invocation to its parent call site and row.
48
- */
49
- runPlaySemanticKey?: string | null;
50
- /** Child input payload (semantic-fallback input). */
51
- input?: unknown;
52
- /**
53
- * Compiled child graph hash. Only present on workers_edge; `null` in-process.
54
- */
55
- graphHash?: string | null;
56
- }
57
-
58
- /**
59
- * A failed child launch must use a fresh attempt identity while ordinary
60
- * transport retries keep attaching to the original child. The caller-provided
61
- * lease is the attempt fence.
62
- */
63
- export function childSubmitIdempotencyKey(input: {
64
- receiptKey: string;
65
- wasFailed: boolean;
66
- leaseId?: string | null;
67
- }): string {
68
- const leaseId = input.leaseId?.trim();
69
- return input.wasFailed && leaseId
70
- ? `${input.receiptKey}:claim:${leaseId}`
71
- : input.receiptKey;
72
- }
73
-
74
- function isRecord(value: unknown): value is Record<string, unknown> {
75
- return typeof value === 'object' && value !== null && !Array.isArray(value);
76
- }
77
-
78
- /** Slugify a play name into the `play/<slug>/...` path segment. */
79
- export function slugifyPlayNameForRunId(playName: string): string {
80
- return (
81
- playName
82
- .toLowerCase()
83
- .replace(/[^a-z0-9-]/g, '-')
84
- .replace(/-+/g, '-')
85
- .replace(/^-+|-+$/g, '')
86
- .slice(0, 64) || 'play'
87
- );
88
- }
89
-
90
- export function buildChildRunId(inputs: ChildRunIdInputs): string {
91
- const slug = slugifyPlayNameForRunId(inputs.childPlayName);
92
- const explicitKey =
93
- typeof inputs.explicitIdempotencyKey === 'string' &&
94
- inputs.explicitIdempotencyKey.trim()
95
- ? inputs.explicitIdempotencyKey.trim()
96
- : null;
97
- const runPlaySemanticKey =
98
- typeof inputs.runPlaySemanticKey === 'string' &&
99
- inputs.runPlaySemanticKey.trim()
100
- ? inputs.runPlaySemanticKey.trim()
101
- : null;
102
- const semanticKey =
103
- explicitKey ??
104
- stableStringify({
105
- parentRunId: inputs.parentRunId,
106
- parentPlayName:
107
- typeof inputs.parentPlayName === 'string'
108
- ? inputs.parentPlayName
109
- : null,
110
- childPlayName: inputs.childPlayName,
111
- key: typeof inputs.key === 'string' ? inputs.key : null,
112
- ...(runPlaySemanticKey ? { runPlaySemanticKey } : {}),
113
- input:
114
- isRecord(inputs.input) || Array.isArray(inputs.input)
115
- ? inputs.input
116
- : {},
117
- graphHash: typeof inputs.graphHash === 'string' ? inputs.graphHash : null,
118
- });
119
- const digest = sha256Hex(semanticKey).slice(0, 24);
120
- return `play/${slug}/run/child-${digest}`;
121
- }