deepline 0.1.119 → 0.1.121

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 (148) hide show
  1. package/README.md +4 -0
  2. package/dist/bundling-sources/apps/play-runner-workers/src/runtime/README.md +21 -0
  3. package/dist/bundling-sources/apps/play-runner-workers/src/runtime/batching.ts +185 -0
  4. package/dist/bundling-sources/apps/play-runner-workers/src/runtime/tool-batch.ts +107 -0
  5. package/dist/{repo → bundling-sources}/sdk/src/client.ts +116 -12
  6. package/dist/bundling-sources/sdk/src/compat.ts +191 -0
  7. package/dist/bundling-sources/sdk/src/gtm.ts +146 -0
  8. package/dist/bundling-sources/sdk/src/helpers.ts +12 -0
  9. package/dist/{repo → bundling-sources}/sdk/src/index.ts +2 -1
  10. package/dist/{repo → bundling-sources}/sdk/src/play.ts +3 -1
  11. package/dist/{repo → bundling-sources}/sdk/src/plays/bundle-play-file.ts +17 -5
  12. package/dist/{repo → bundling-sources}/sdk/src/release.ts +2 -2
  13. package/dist/{repo → bundling-sources}/sdk/src/runs/observe-transport.ts +2 -3
  14. package/dist/bundling-sources/shared_libs/play-data-plane/index.ts +3 -0
  15. package/dist/bundling-sources/shared_libs/play-runtime/app-runtime-api.ts +838 -0
  16. package/dist/bundling-sources/shared_libs/play-runtime/context.ts +5510 -0
  17. package/dist/bundling-sources/shared_libs/play-runtime/ctx-contract.ts +261 -0
  18. package/dist/bundling-sources/shared_libs/play-runtime/ctx-types.ts +828 -0
  19. package/dist/bundling-sources/shared_libs/play-runtime/dataset-id.ts +10 -0
  20. package/dist/bundling-sources/shared_libs/play-runtime/daytona-runtime-config.ts +50 -0
  21. package/dist/bundling-sources/shared_libs/play-runtime/durability-store.ts +20 -0
  22. package/dist/bundling-sources/shared_libs/play-runtime/event-wait-tools.ts +9 -0
  23. package/dist/bundling-sources/shared_libs/play-runtime/governor/in-memory-rate-state-backend.ts +171 -0
  24. package/dist/bundling-sources/shared_libs/play-runtime/hatchet-cold-execution-diagnosis.ts +321 -0
  25. package/dist/bundling-sources/shared_libs/play-runtime/hatchet-cold-execution-target.ts +158 -0
  26. package/dist/bundling-sources/shared_libs/play-runtime/internal-step-ids.ts +34 -0
  27. package/dist/bundling-sources/shared_libs/play-runtime/ledger-safe-payload.ts +34 -0
  28. package/dist/bundling-sources/shared_libs/play-runtime/live-state-contract.ts +50 -0
  29. package/dist/bundling-sources/shared_libs/play-runtime/map-execution-frame.ts +119 -0
  30. package/dist/{repo → bundling-sources}/shared_libs/play-runtime/map-row-identity.ts +1 -1
  31. package/dist/bundling-sources/shared_libs/play-runtime/play-latency-trace.ts +636 -0
  32. package/dist/bundling-sources/shared_libs/play-runtime/postgres-json.ts +9 -0
  33. package/dist/bundling-sources/shared_libs/play-runtime/progress-emitter.ts +197 -0
  34. package/dist/bundling-sources/shared_libs/play-runtime/projection.ts +262 -0
  35. package/dist/bundling-sources/shared_libs/play-runtime/protocol.ts +143 -0
  36. package/dist/bundling-sources/shared_libs/play-runtime/public-play-contract.ts +42 -0
  37. package/dist/bundling-sources/shared_libs/play-runtime/receipt-status.ts +40 -0
  38. package/dist/bundling-sources/shared_libs/play-runtime/runtime-actions.ts +178 -0
  39. package/dist/bundling-sources/shared_libs/play-runtime/runtime-api.ts +4015 -0
  40. package/dist/bundling-sources/shared_libs/play-runtime/runtime-constraints.ts +2 -0
  41. package/dist/bundling-sources/shared_libs/play-runtime/runtime-pg-driver-neon-serverless.ts +238 -0
  42. package/dist/bundling-sources/shared_libs/play-runtime/runtime-pg-driver-pg.ts +53 -0
  43. package/dist/bundling-sources/shared_libs/play-runtime/runtime-pg-driver.ts +149 -0
  44. package/dist/bundling-sources/shared_libs/play-runtime/suspension.ts +68 -0
  45. package/dist/bundling-sources/shared_libs/play-runtime/tool-batch-executor.ts +149 -0
  46. package/dist/bundling-sources/shared_libs/play-runtime/tool-result-types.ts +159 -0
  47. package/dist/bundling-sources/shared_libs/play-runtime/tracing.ts +33 -0
  48. package/dist/bundling-sources/shared_libs/play-runtime/waterfall-replay.ts +79 -0
  49. package/dist/bundling-sources/shared_libs/play-runtime/worker-api-types.ts +139 -0
  50. package/dist/bundling-sources/shared_libs/plays/artifact-transport.ts +14 -0
  51. package/dist/bundling-sources/shared_libs/plays/artifact-types.ts +49 -0
  52. package/dist/bundling-sources/shared_libs/plays/compiler-manifest.ts +41 -0
  53. package/dist/bundling-sources/shared_libs/plays/dataset-summary.ts +163 -0
  54. package/dist/bundling-sources/shared_libs/plays/definition.ts +267 -0
  55. package/dist/bundling-sources/shared_libs/plays/file-refs.ts +11 -0
  56. package/dist/bundling-sources/shared_libs/plays/input-contract.ts +146 -0
  57. package/dist/bundling-sources/shared_libs/plays/resolve-static-pipeline.ts +190 -0
  58. package/dist/bundling-sources/shared_libs/plays/runtime-validation.ts +417 -0
  59. package/dist/bundling-sources/shared_libs/plays/tool-codegen.ts +142 -0
  60. package/dist/bundling-sources/shared_libs/security/safe-outbound-fetch.ts +274 -0
  61. package/dist/bundling-sources/shared_libs/temporal/preview-config.ts +150 -0
  62. package/dist/cli/index.js +811 -2207
  63. package/dist/cli/index.mjs +847 -2258
  64. package/dist/compiler-manifest-BjoRENv9.d.mts +227 -0
  65. package/dist/compiler-manifest-BjoRENv9.d.ts +227 -0
  66. package/dist/index.d.mts +8 -231
  67. package/dist/index.d.ts +8 -231
  68. package/dist/index.js +101 -15
  69. package/dist/index.mjs +101 -15
  70. package/dist/plays/bundle-play-file.d.mts +120 -0
  71. package/dist/plays/bundle-play-file.d.ts +120 -0
  72. package/dist/plays/bundle-play-file.mjs +1830 -0
  73. package/package.json +4 -9
  74. /package/dist/{repo → bundling-sources}/apps/play-runner-workers/src/child-play-await.ts +0 -0
  75. /package/dist/{repo → bundling-sources}/apps/play-runner-workers/src/child-play-submit.ts +0 -0
  76. /package/dist/{repo → bundling-sources}/apps/play-runner-workers/src/coordinator-entry.ts +0 -0
  77. /package/dist/{repo → bundling-sources}/apps/play-runner-workers/src/dedup-do.ts +0 -0
  78. /package/dist/{repo → bundling-sources}/apps/play-runner-workers/src/entry.ts +0 -0
  79. /package/dist/{repo → bundling-sources}/apps/play-runner-workers/src/runtime/csv-rows.ts +0 -0
  80. /package/dist/{repo → bundling-sources}/apps/play-runner-workers/src/runtime/dataset-handles.ts +0 -0
  81. /package/dist/{repo → bundling-sources}/apps/play-runner-workers/src/runtime/harness-receipt-store.ts +0 -0
  82. /package/dist/{repo → bundling-sources}/apps/play-runner-workers/src/runtime/live-progress.ts +0 -0
  83. /package/dist/{repo → bundling-sources}/apps/play-runner-workers/src/runtime/map-chunk-plan.ts +0 -0
  84. /package/dist/{repo → bundling-sources}/apps/play-runner-workers/src/runtime/receipts.ts +0 -0
  85. /package/dist/{repo → bundling-sources}/apps/play-runner-workers/src/runtime/row-isolation.ts +0 -0
  86. /package/dist/{repo → bundling-sources}/apps/play-runner-workers/src/runtime/tool-http-errors.ts +0 -0
  87. /package/dist/{repo → bundling-sources}/apps/play-runner-workers/src/workflow-instance-create.ts +0 -0
  88. /package/dist/{repo → bundling-sources}/apps/play-runner-workers/src/workflow-retry-state.ts +0 -0
  89. /package/dist/{repo → bundling-sources}/apps/play-runner-workers/src/workflow-retry.ts +0 -0
  90. /package/dist/{repo → bundling-sources}/sdk/src/agent-runtime.ts +0 -0
  91. /package/dist/{repo → bundling-sources}/sdk/src/config.ts +0 -0
  92. /package/dist/{repo → bundling-sources}/sdk/src/errors.ts +0 -0
  93. /package/dist/{repo → bundling-sources}/sdk/src/http.ts +0 -0
  94. /package/dist/{repo → bundling-sources}/sdk/src/plays/harness-stub.ts +0 -0
  95. /package/dist/{repo → bundling-sources}/sdk/src/plays/local-file-discovery.ts +0 -0
  96. /package/dist/{repo → bundling-sources}/sdk/src/stream-reconnect.ts +0 -0
  97. /package/dist/{repo → bundling-sources}/sdk/src/tool-output.ts +0 -0
  98. /package/dist/{repo → bundling-sources}/sdk/src/types.ts +0 -0
  99. /package/dist/{repo → bundling-sources}/sdk/src/version.ts +0 -0
  100. /package/dist/{repo → bundling-sources}/sdk/src/worker-play-entry.ts +0 -0
  101. /package/dist/{repo → bundling-sources}/shared_libs/play-data-plane/cell-policy.ts +0 -0
  102. /package/dist/{repo → bundling-sources}/shared_libs/play-data-plane/column-names.ts +0 -0
  103. /package/dist/{repo → bundling-sources}/shared_libs/play-data-plane/sheet-contract.ts +0 -0
  104. /package/dist/{repo → bundling-sources}/shared_libs/play-runtime/backend.ts +0 -0
  105. /package/dist/{repo → bundling-sources}/shared_libs/play-runtime/batch-runtime.ts +0 -0
  106. /package/dist/{repo → bundling-sources}/shared_libs/play-runtime/batching-types.ts +0 -0
  107. /package/dist/{repo → bundling-sources}/shared_libs/play-runtime/cell-staleness.ts +0 -0
  108. /package/dist/{repo → bundling-sources}/shared_libs/play-runtime/coordinator-headers.ts +0 -0
  109. /package/dist/{repo → bundling-sources}/shared_libs/play-runtime/csv-rename.ts +0 -0
  110. /package/dist/{repo → bundling-sources}/shared_libs/play-runtime/db-session-crypto.ts +0 -0
  111. /package/dist/{repo → bundling-sources}/shared_libs/play-runtime/db-session-plan.ts +0 -0
  112. /package/dist/{repo → bundling-sources}/shared_libs/play-runtime/db-session.ts +0 -0
  113. /package/dist/{repo → bundling-sources}/shared_libs/play-runtime/dedup-backend.ts +0 -0
  114. /package/dist/{repo → bundling-sources}/shared_libs/play-runtime/default-batch-strategies.ts +0 -0
  115. /package/dist/{repo → bundling-sources}/shared_libs/play-runtime/email-status.ts +0 -0
  116. /package/dist/{repo → bundling-sources}/shared_libs/play-runtime/execution-plan.ts +0 -0
  117. /package/dist/{repo → bundling-sources}/shared_libs/play-runtime/extractor-targets.ts +0 -0
  118. /package/dist/{repo → bundling-sources}/shared_libs/play-runtime/fullenrich-batching.ts +0 -0
  119. /package/dist/{repo → bundling-sources}/shared_libs/play-runtime/governor/coordinator-rate-state-backend.ts +0 -0
  120. /package/dist/{repo → bundling-sources}/shared_libs/play-runtime/governor/governor.ts +0 -0
  121. /package/dist/{repo → bundling-sources}/shared_libs/play-runtime/governor/policy.ts +0 -0
  122. /package/dist/{repo → bundling-sources}/shared_libs/play-runtime/governor/rate-state-backend.ts +0 -0
  123. /package/dist/{repo → bundling-sources}/shared_libs/play-runtime/live-events.ts +0 -0
  124. /package/dist/{repo → bundling-sources}/shared_libs/play-runtime/play-runtime-batching-registry.ts +0 -0
  125. /package/dist/{repo → bundling-sources}/shared_libs/play-runtime/profiles.ts +0 -0
  126. /package/dist/{repo → bundling-sources}/shared_libs/play-runtime/providers.ts +0 -0
  127. /package/dist/{repo → bundling-sources}/shared_libs/play-runtime/run-failure.ts +0 -0
  128. /package/dist/{repo → bundling-sources}/shared_libs/play-runtime/run-ledger.ts +0 -0
  129. /package/dist/{repo → bundling-sources}/shared_libs/play-runtime/run-snapshot-stream.ts +0 -0
  130. /package/dist/{repo → bundling-sources}/shared_libs/play-runtime/scheduler-backend.ts +0 -0
  131. /package/dist/{repo → bundling-sources}/shared_libs/play-runtime/secret-capability.ts +0 -0
  132. /package/dist/{repo → bundling-sources}/shared_libs/play-runtime/secret-redaction.ts +0 -0
  133. /package/dist/{repo → bundling-sources}/shared_libs/play-runtime/step-lifecycle-tracker.ts +0 -0
  134. /package/dist/{repo → bundling-sources}/shared_libs/play-runtime/step-program-dataset-builder.ts +0 -0
  135. /package/dist/{repo → bundling-sources}/shared_libs/play-runtime/submit-limits.ts +0 -0
  136. /package/dist/{repo → bundling-sources}/shared_libs/play-runtime/tool-result.ts +0 -0
  137. /package/dist/{repo → bundling-sources}/shared_libs/play-runtime/work-receipts.ts +0 -0
  138. /package/dist/{repo → bundling-sources}/shared_libs/plays/bootstrap-routes.ts +0 -0
  139. /package/dist/{repo → bundling-sources}/shared_libs/plays/bundling/index.ts +0 -0
  140. /package/dist/{repo → bundling-sources}/shared_libs/plays/bundling/limits.ts +0 -0
  141. /package/dist/{repo → bundling-sources}/shared_libs/plays/contracts.ts +0 -0
  142. /package/dist/{repo → bundling-sources}/shared_libs/plays/dataset.ts +0 -0
  143. /package/dist/{repo → bundling-sources}/shared_libs/plays/row-identity.ts +0 -0
  144. /package/dist/{repo → bundling-sources}/shared_libs/plays/secret-guardrails.ts +0 -0
  145. /package/dist/{repo → bundling-sources}/shared_libs/plays/static-pipeline.ts +0 -0
  146. /package/dist/{repo → bundling-sources}/shared_libs/security/outbound-url-policy.ts +0 -0
  147. /package/dist/{repo → bundling-sources}/shared_libs/security/safe-fetch.ts +0 -0
  148. /package/dist/{repo → bundling-sources}/shared_libs/temporal/constants.ts +0 -0
package/dist/index.d.ts CHANGED
@@ -1,228 +1,4 @@
1
- /**
2
- * The runtime shape of a built play artifact. Different runner backends need
3
- * different bundle outputs:
4
- * - cjs_node20: Daytona + local-process (full Node.js sandbox).
5
- * - esm_workers: Cloudflare Workers (V8 isolate, no `fs`/`child_process`).
6
- *
7
- * The CLI selects which kind to build based on the target backend; the worker
8
- * validates the kind matches the backend it's about to dispatch to.
9
- */
10
- declare const PLAY_ARTIFACT_KINDS: {
11
- readonly cjsNode20: "cjs_node20";
12
- readonly esmWorkers: "esm_workers";
13
- };
14
- type PlayArtifactKind = (typeof PLAY_ARTIFACT_KINDS)[keyof typeof PLAY_ARTIFACT_KINDS];
15
-
16
- /**
17
- * A top-level key the play's function literally `return`s. Derived from the
18
- * `return { ... }` object literal — NOT from dataset `.withColumn(...)` names —
19
- * so the "Returns" graph node mirrors the function's real output shape.
20
- * `isDataset` is true when the key's value is a `PlayDataset` handle (a table).
21
- */
22
- interface PlayStaticReturnField {
23
- name: string;
24
- isDataset: boolean;
25
- }
26
- interface PlayStaticPipeline {
27
- tableNamespace?: string;
28
- inputFields?: string[];
29
- rowKeyFields?: string[];
30
- csvArg?: string;
31
- hasInlineData?: boolean;
32
- csvDescription?: string;
33
- datasetDescription?: string;
34
- fields: string[];
35
- /**
36
- * Top-level keys of the play's `return { ... }` object literal, in source
37
- * order. Undefined when the terminal return isn't a statically-known object
38
- * literal (bare value, dataset handle, conditional returns, etc.).
39
- */
40
- returnFields?: PlayStaticReturnField[];
41
- stages?: PlayStaticSubstep[];
42
- substeps: PlayStaticSubstep[];
43
- sheetContract?: PlaySheetContract | null;
44
- sheetContractErrors?: string[];
45
- }
46
- type PlaySheetColumnSource = 'input' | 'datasetColumn' | 'waterfallStep' | 'childPlayColumn';
47
- interface PlaySheetColumnContract {
48
- id: string;
49
- sqlName: string;
50
- source: PlaySheetColumnSource;
51
- field?: string;
52
- parentField?: string;
53
- playId?: string;
54
- waterfallId?: string;
55
- outputField?: string;
56
- outputSqlName?: string;
57
- stepId?: string;
58
- toolId?: string;
59
- isRowKey?: boolean;
60
- }
61
- interface PlaySheetContract {
62
- tableNamespace: string;
63
- columns: PlaySheetColumnContract[];
64
- }
65
- type PlayStaticColumnProducerKind = 'tool' | 'waterfall' | 'stepProgram' | 'playCall' | 'controlFlow' | 'transform';
66
- interface PlayStaticColumnProducer {
67
- id: string;
68
- kind: PlayStaticColumnProducerKind;
69
- field: string;
70
- toolId?: string;
71
- playId?: string;
72
- dependsOnFields?: string[];
73
- recompute?: boolean;
74
- recomputeOnError?: boolean;
75
- staleAfterSeconds?: number;
76
- conditional?: boolean;
77
- sourceRange?: PlayStaticSourceRange;
78
- steps?: PlayStaticColumnProducer[];
79
- substep: PlayStaticSubstep;
80
- }
81
- interface PlayStaticDatasetColumn {
82
- id: string;
83
- source: PlaySheetColumnSource;
84
- sqlName?: string;
85
- recompute?: boolean;
86
- recomputeOnError?: boolean;
87
- staleAfterSeconds?: number;
88
- producers: PlayStaticColumnProducer[];
89
- }
90
- interface PlayStaticSourceRange {
91
- sourcePath?: string;
92
- startLine: number;
93
- endLine: number;
94
- startColumn: number;
95
- endColumn: number;
96
- }
97
- type PlayStaticSubstepMetadata = {
98
- conditional?: boolean;
99
- dependsOnFields?: string[];
100
- recompute?: boolean;
101
- recomputeOnError?: boolean;
102
- staleAfterSeconds?: number;
103
- };
104
- type PlayStaticSubstep = PlayStaticSubstepMetadata & ({
105
- type: 'csv';
106
- field: string;
107
- path?: string;
108
- description?: string;
109
- sourceRange?: PlayStaticSourceRange;
110
- callDepth?: number;
111
- callPath?: string[];
112
- } | {
113
- type: 'dataset';
114
- field: string;
115
- name?: string;
116
- tableNamespace?: string;
117
- inputFields?: string[];
118
- rowKeyFields?: string[];
119
- outputFields?: string[];
120
- columns?: PlayStaticDatasetColumn[];
121
- waterfallIds?: string[];
122
- steps?: PlayStaticSubstep[];
123
- sheetContract?: PlaySheetContract | null;
124
- description?: string;
125
- sourceRange?: PlayStaticSourceRange;
126
- callDepth?: number;
127
- callPath?: string[];
128
- } | {
129
- type: 'tool';
130
- toolId: string;
131
- field: string;
132
- paramsSource?: string;
133
- sourceText?: string;
134
- description?: string;
135
- inLoop?: boolean;
136
- isEventWait?: boolean;
137
- sourceRange?: PlayStaticSourceRange;
138
- callDepth?: number;
139
- callPath?: string[];
140
- } | {
141
- type: 'waterfall';
142
- tool?: string;
143
- field: string;
144
- inLoop?: boolean;
145
- id?: string;
146
- output?: string;
147
- minResults?: number;
148
- sourceText?: string;
149
- steps?: Array<{
150
- id: string;
151
- kind?: 'tool' | 'code';
152
- toolId?: string;
153
- paramsSource?: string;
154
- }>;
155
- description?: string;
156
- sourceRange?: PlayStaticSourceRange;
157
- callDepth?: number;
158
- callPath?: string[];
159
- } | {
160
- type: 'step_suite';
161
- field: string;
162
- steps: PlayStaticSubstep[];
163
- returnSource?: string;
164
- description?: string;
165
- sourceRange?: PlayStaticSourceRange;
166
- callDepth?: number;
167
- callPath?: string[];
168
- } | {
169
- type: 'play_call';
170
- playId: string;
171
- field: string;
172
- inLoop?: boolean;
173
- pipeline?: PlayStaticPipeline | null;
174
- cycleDetected?: boolean;
175
- resolutionError?: string;
176
- description?: string;
177
- sourceRange?: PlayStaticSourceRange;
178
- callDepth?: number;
179
- callPath?: string[];
180
- } | {
181
- type: 'control_flow';
182
- kind: 'conditional' | 'loop';
183
- field: string;
184
- steps: PlayStaticSubstep[];
185
- description?: string;
186
- sourceRange?: PlayStaticSourceRange;
187
- callDepth?: number;
188
- callPath?: string[];
189
- } | {
190
- type: 'run_javascript';
191
- alias: string;
192
- sourceText?: string;
193
- description?: string;
194
- sourceRange?: PlayStaticSourceRange;
195
- callDepth?: number;
196
- callPath?: string[];
197
- } | {
198
- type: 'code';
199
- field: string;
200
- sourceText?: string;
201
- description?: string;
202
- sourceRange?: PlayStaticSourceRange;
203
- callDepth?: number;
204
- callPath?: string[];
205
- });
206
-
207
- type PlayCompilerDependencyManifest = {
208
- playName: string;
209
- /** Original source path for direct imported definePlay dependencies. */
210
- filePath?: string;
211
- sourceHash: string;
212
- graphHash: string;
213
- artifactHash: string;
214
- staticPipeline: PlayStaticPipeline;
215
- };
216
- type PlayCompilerManifest = {
217
- compilerVersion: number;
218
- playName: string;
219
- sourceHash: string;
220
- graphHash: string;
221
- artifactHash: string;
222
- artifactKind?: PlayArtifactKind;
223
- staticPipeline: PlayStaticPipeline;
224
- importedPlayDependencies: PlayCompilerDependencyManifest[];
225
- };
1
+ import { a as PlayCompilerManifest } from './compiler-manifest-BjoRENv9.js';
226
2
 
227
3
  declare const DEEPLINE_TOOL_CATEGORIES: readonly ["company_search", "people_search", "people_enrich", "email_finder", "email_verify", "phone_finder", "phone_verify", "identity_resolution", "reverse_lookup", "enrichment", "batch", "premium", "free"];
228
4
  type DeeplineToolCategory = (typeof DEEPLINE_TOOL_CATEGORIES)[number] | (string & {});
@@ -2047,17 +1823,18 @@ declare class DeeplineClient {
2047
1823
  */
2048
1824
  listRuns(options: RunsListOptions): Promise<PlayRunListItem[]>;
2049
1825
  /**
2050
- * Observe one run's live events through the Convex Run Snapshot
2051
- * subscription transport (ADR-0008). Yields the same `play.*` event
2052
- * envelopes as {@link streamPlayRunEvents} and ends after the terminal
2053
- * snapshot. Throws {@link RunObserveTransportUnavailableError} when this
2054
- * server cannot serve the transport (older server, unconfigured grants, or
2055
- * unreachable Convex) — callers fall back to the SSE stream with a notice.
1826
+ * Observe one run's live events. Uses the Convex Run Snapshot subscription
1827
+ * transport first (ADR-0008), then falls back to the canonical SSE stream
1828
+ * when the subscription transport or its optional client modules are not
1829
+ * available. Pass `fallback: 'none'` to receive
1830
+ * {@link RunObserveTransportUnavailableError} instead.
2056
1831
  */
2057
1832
  observeRunEvents(runId: string, options?: {
2058
1833
  signal?: AbortSignal;
2059
1834
  onNotice?: (message: string) => void;
1835
+ fallback?: 'sse' | 'none';
2060
1836
  }): AsyncGenerator<PlayLiveEvent>;
1837
+ private streamPlayRunEventsUntilTerminal;
2061
1838
  /**
2062
1839
  * Tail one run through the subscription transport until terminal, then
2063
1840
  * return one durable REST status read (the final Run Response Package).
package/dist/index.js CHANGED
@@ -274,10 +274,10 @@ var SDK_RELEASE = {
274
274
  // skill on the sdk sync surface, and the people-search-to-email prebuilt.
275
275
  // 0.1.108 ships explicit dataset column/tool recompute policy and removes
276
276
  // the SDK enrich generator's one-second stale policy.
277
- version: "0.1.119",
277
+ version: "0.1.121",
278
278
  apiContract: "2026-06-dataset-column-cell-stale-hard-cutover",
279
279
  supportPolicy: {
280
- latest: "0.1.119",
280
+ latest: "0.1.121",
281
281
  minimumSupported: "0.1.53",
282
282
  deprecatedBelow: "0.1.53",
283
283
  commandMinimumSupported: [
@@ -2771,20 +2771,105 @@ var DeeplineClient = class {
2771
2771
  return response.runs ?? [];
2772
2772
  }
2773
2773
  /**
2774
- * Observe one run's live events through the Convex Run Snapshot
2775
- * subscription transport (ADR-0008). Yields the same `play.*` event
2776
- * envelopes as {@link streamPlayRunEvents} and ends after the terminal
2777
- * snapshot. Throws {@link RunObserveTransportUnavailableError} when this
2778
- * server cannot serve the transport (older server, unconfigured grants, or
2779
- * unreachable Convex) — callers fall back to the SSE stream with a notice.
2774
+ * Observe one run's live events. Uses the Convex Run Snapshot subscription
2775
+ * transport first (ADR-0008), then falls back to the canonical SSE stream
2776
+ * when the subscription transport or its optional client modules are not
2777
+ * available. Pass `fallback: 'none'` to receive
2778
+ * {@link RunObserveTransportUnavailableError} instead.
2780
2779
  */
2781
- observeRunEvents(runId, options) {
2782
- return observeRunEvents({
2783
- http: this.http,
2780
+ async *observeRunEvents(runId, options) {
2781
+ let yieldedObserveEvent = false;
2782
+ try {
2783
+ for await (const event of observeRunEvents({
2784
+ http: this.http,
2785
+ runId,
2786
+ signal: options?.signal,
2787
+ onNotice: options?.onNotice
2788
+ })) {
2789
+ yieldedObserveEvent = true;
2790
+ yield event;
2791
+ }
2792
+ } catch (error) {
2793
+ if (!(error instanceof RunObserveTransportUnavailableError) || yieldedObserveEvent || options?.fallback === "none") {
2794
+ throw error;
2795
+ }
2796
+ options?.onNotice?.(
2797
+ `[observe] live subscription unavailable (${error.reason}); falling back to SSE tail (support window, ADR-0008)`
2798
+ );
2799
+ yield* this.streamPlayRunEventsUntilTerminal(runId, options);
2800
+ }
2801
+ }
2802
+ async *streamPlayRunEventsUntilTerminal(runId, options) {
2803
+ const state = {
2784
2804
  runId,
2785
- signal: options?.signal,
2786
- onNotice: options?.onNotice
2787
- });
2805
+ status: "running",
2806
+ logs: [],
2807
+ lastLogSeq: 0,
2808
+ latest: null
2809
+ };
2810
+ let lastEventId;
2811
+ let reconnectAttempt = 0;
2812
+ for (; ; ) {
2813
+ if (options?.signal?.aborted) {
2814
+ return;
2815
+ }
2816
+ const connectedAt = Date.now();
2817
+ let sawEvent = false;
2818
+ let endedReason = "stream window ended before a terminal event";
2819
+ try {
2820
+ for await (const event of this.streamPlayRunEvents(runId, {
2821
+ mode: "cli",
2822
+ signal: options?.signal,
2823
+ ...lastEventId ? { lastEventId } : {}
2824
+ })) {
2825
+ sawEvent = true;
2826
+ if (event.cursor?.trim()) {
2827
+ lastEventId = event.cursor;
2828
+ }
2829
+ yield event;
2830
+ const status = updatePlayLiveStatusState(state, event);
2831
+ if (status && TERMINAL_PLAY_STATUSES.has(status.status)) {
2832
+ return;
2833
+ }
2834
+ }
2835
+ } catch (error) {
2836
+ if (options?.signal?.aborted) {
2837
+ return;
2838
+ }
2839
+ if (!isTransientPlayStreamError(error)) {
2840
+ throw error;
2841
+ }
2842
+ endedReason = error instanceof Error ? error.message : String(error);
2843
+ }
2844
+ let refreshed = null;
2845
+ try {
2846
+ refreshed = await this.getRunStatus(runId);
2847
+ } catch (error) {
2848
+ if (!isTransientPlayStreamError(error)) {
2849
+ throw error;
2850
+ }
2851
+ }
2852
+ if (refreshed && TERMINAL_PLAY_STATUSES.has(refreshed.status)) {
2853
+ yield {
2854
+ cursor: String(Date.now()),
2855
+ streamId: `sse-fallback:${runId}`,
2856
+ scope: "play",
2857
+ type: "play.run.status",
2858
+ at: (/* @__PURE__ */ new Date()).toISOString(),
2859
+ payload: refreshed
2860
+ };
2861
+ return;
2862
+ }
2863
+ if (sawEvent || Date.now() - connectedAt >= STREAM_HEALTHY_CONNECTION_MS) {
2864
+ reconnectAttempt = 0;
2865
+ }
2866
+ const delayMs = streamReconnectDelayMs(reconnectAttempt);
2867
+ reconnectAttempt += 1;
2868
+ options?.onNotice?.(
2869
+ `[observe] SSE tail window ended before terminal status (${endedReason}); reconnecting to run ${runId}`
2870
+ );
2871
+ await sleep2(delayMs);
2872
+ }
2788
2873
  }
2789
2874
  /**
2790
2875
  * Tail one run through the subscription transport until terminal, then
@@ -2800,7 +2885,8 @@ var DeeplineClient = class {
2800
2885
  };
2801
2886
  for await (const event of this.observeRunEvents(runId, {
2802
2887
  signal: options?.signal,
2803
- onNotice: options?.onNotice
2888
+ onNotice: options?.onNotice,
2889
+ fallback: "none"
2804
2890
  })) {
2805
2891
  const status = updatePlayLiveStatusState(state, event);
2806
2892
  if (!status || !TERMINAL_PLAY_STATUSES.has(status.status)) {
package/dist/index.mjs CHANGED
@@ -196,10 +196,10 @@ var SDK_RELEASE = {
196
196
  // skill on the sdk sync surface, and the people-search-to-email prebuilt.
197
197
  // 0.1.108 ships explicit dataset column/tool recompute policy and removes
198
198
  // the SDK enrich generator's one-second stale policy.
199
- version: "0.1.119",
199
+ version: "0.1.121",
200
200
  apiContract: "2026-06-dataset-column-cell-stale-hard-cutover",
201
201
  supportPolicy: {
202
- latest: "0.1.119",
202
+ latest: "0.1.121",
203
203
  minimumSupported: "0.1.53",
204
204
  deprecatedBelow: "0.1.53",
205
205
  commandMinimumSupported: [
@@ -2693,20 +2693,105 @@ var DeeplineClient = class {
2693
2693
  return response.runs ?? [];
2694
2694
  }
2695
2695
  /**
2696
- * Observe one run's live events through the Convex Run Snapshot
2697
- * subscription transport (ADR-0008). Yields the same `play.*` event
2698
- * envelopes as {@link streamPlayRunEvents} and ends after the terminal
2699
- * snapshot. Throws {@link RunObserveTransportUnavailableError} when this
2700
- * server cannot serve the transport (older server, unconfigured grants, or
2701
- * unreachable Convex) — callers fall back to the SSE stream with a notice.
2696
+ * Observe one run's live events. Uses the Convex Run Snapshot subscription
2697
+ * transport first (ADR-0008), then falls back to the canonical SSE stream
2698
+ * when the subscription transport or its optional client modules are not
2699
+ * available. Pass `fallback: 'none'` to receive
2700
+ * {@link RunObserveTransportUnavailableError} instead.
2702
2701
  */
2703
- observeRunEvents(runId, options) {
2704
- return observeRunEvents({
2705
- http: this.http,
2702
+ async *observeRunEvents(runId, options) {
2703
+ let yieldedObserveEvent = false;
2704
+ try {
2705
+ for await (const event of observeRunEvents({
2706
+ http: this.http,
2707
+ runId,
2708
+ signal: options?.signal,
2709
+ onNotice: options?.onNotice
2710
+ })) {
2711
+ yieldedObserveEvent = true;
2712
+ yield event;
2713
+ }
2714
+ } catch (error) {
2715
+ if (!(error instanceof RunObserveTransportUnavailableError) || yieldedObserveEvent || options?.fallback === "none") {
2716
+ throw error;
2717
+ }
2718
+ options?.onNotice?.(
2719
+ `[observe] live subscription unavailable (${error.reason}); falling back to SSE tail (support window, ADR-0008)`
2720
+ );
2721
+ yield* this.streamPlayRunEventsUntilTerminal(runId, options);
2722
+ }
2723
+ }
2724
+ async *streamPlayRunEventsUntilTerminal(runId, options) {
2725
+ const state = {
2706
2726
  runId,
2707
- signal: options?.signal,
2708
- onNotice: options?.onNotice
2709
- });
2727
+ status: "running",
2728
+ logs: [],
2729
+ lastLogSeq: 0,
2730
+ latest: null
2731
+ };
2732
+ let lastEventId;
2733
+ let reconnectAttempt = 0;
2734
+ for (; ; ) {
2735
+ if (options?.signal?.aborted) {
2736
+ return;
2737
+ }
2738
+ const connectedAt = Date.now();
2739
+ let sawEvent = false;
2740
+ let endedReason = "stream window ended before a terminal event";
2741
+ try {
2742
+ for await (const event of this.streamPlayRunEvents(runId, {
2743
+ mode: "cli",
2744
+ signal: options?.signal,
2745
+ ...lastEventId ? { lastEventId } : {}
2746
+ })) {
2747
+ sawEvent = true;
2748
+ if (event.cursor?.trim()) {
2749
+ lastEventId = event.cursor;
2750
+ }
2751
+ yield event;
2752
+ const status = updatePlayLiveStatusState(state, event);
2753
+ if (status && TERMINAL_PLAY_STATUSES.has(status.status)) {
2754
+ return;
2755
+ }
2756
+ }
2757
+ } catch (error) {
2758
+ if (options?.signal?.aborted) {
2759
+ return;
2760
+ }
2761
+ if (!isTransientPlayStreamError(error)) {
2762
+ throw error;
2763
+ }
2764
+ endedReason = error instanceof Error ? error.message : String(error);
2765
+ }
2766
+ let refreshed = null;
2767
+ try {
2768
+ refreshed = await this.getRunStatus(runId);
2769
+ } catch (error) {
2770
+ if (!isTransientPlayStreamError(error)) {
2771
+ throw error;
2772
+ }
2773
+ }
2774
+ if (refreshed && TERMINAL_PLAY_STATUSES.has(refreshed.status)) {
2775
+ yield {
2776
+ cursor: String(Date.now()),
2777
+ streamId: `sse-fallback:${runId}`,
2778
+ scope: "play",
2779
+ type: "play.run.status",
2780
+ at: (/* @__PURE__ */ new Date()).toISOString(),
2781
+ payload: refreshed
2782
+ };
2783
+ return;
2784
+ }
2785
+ if (sawEvent || Date.now() - connectedAt >= STREAM_HEALTHY_CONNECTION_MS) {
2786
+ reconnectAttempt = 0;
2787
+ }
2788
+ const delayMs = streamReconnectDelayMs(reconnectAttempt);
2789
+ reconnectAttempt += 1;
2790
+ options?.onNotice?.(
2791
+ `[observe] SSE tail window ended before terminal status (${endedReason}); reconnecting to run ${runId}`
2792
+ );
2793
+ await sleep2(delayMs);
2794
+ }
2710
2795
  }
2711
2796
  /**
2712
2797
  * Tail one run through the subscription transport until terminal, then
@@ -2722,7 +2807,8 @@ var DeeplineClient = class {
2722
2807
  };
2723
2808
  for await (const event of this.observeRunEvents(runId, {
2724
2809
  signal: options?.signal,
2725
- onNotice: options?.onNotice
2810
+ onNotice: options?.onNotice,
2811
+ fallback: "none"
2726
2812
  })) {
2727
2813
  const status = updatePlayLiveStatusState(state, event);
2728
2814
  if (!status || !TERMINAL_PLAY_STATUSES.has(status.status)) {
@@ -0,0 +1,120 @@
1
+ import { P as PlayArtifactKind$1, a as PlayCompilerManifest } from '../compiler-manifest-BjoRENv9.mjs';
2
+ export { b as PLAY_ARTIFACT_KINDS } from '../compiler-manifest-BjoRENv9.mjs';
3
+
4
+ type PlayPackageImport = {
5
+ name: string;
6
+ version: string | null;
7
+ };
8
+ type PlayImportPolicy = {
9
+ localFiles: string[];
10
+ nodeBuiltins: string[];
11
+ packages: PlayPackageImport[];
12
+ };
13
+ type PlayRuntimeFeature = 'artifact_storage' | 'checkpoint_resume' | 'durable_sleep' | 'packaged_files';
14
+ type PlayArtifactCompatibility = {
15
+ apiVersion: number;
16
+ artifactVersion: number;
17
+ minRunnerVersion: number;
18
+ runtimeFeatures: PlayRuntimeFeature[];
19
+ runtimeBackend?: string | null;
20
+ };
21
+ /**
22
+ * Identifies which runtime can consume this artifact:
23
+ * - cjs_node20: Daytona / local-process (Node.js)
24
+ * - esm_workers: Cloudflare Workers (V8 isolate)
25
+ */
26
+ type PlayArtifactKind = 'cjs_node20' | 'esm_workers';
27
+ type PlayBundleArtifact = {
28
+ codeFormat: 'cjs_module' | 'esm_module';
29
+ /** Defaults to cjs_node20 when not present (legacy artifacts). */
30
+ artifactKind?: PlayArtifactKind;
31
+ entryFile: string;
32
+ virtualFilename: string;
33
+ sourceHash: string;
34
+ graphHash: string;
35
+ artifactHash: string;
36
+ sourceMapHash: string;
37
+ bundledCode: string;
38
+ sourceMap: string;
39
+ importPolicy: PlayImportPolicy;
40
+ compatibility: PlayArtifactCompatibility;
41
+ generatedAt: number;
42
+ cacheHit: boolean;
43
+ };
44
+
45
+ type ImportedPlayDependency = {
46
+ filePath: string;
47
+ playName: string;
48
+ };
49
+ type PlayLocalFileReference = {
50
+ sourceFragment: string;
51
+ logicalPath: string;
52
+ absolutePath: string;
53
+ bytes: number;
54
+ contentHash: string;
55
+ contentType: string;
56
+ };
57
+ type PlayLocalFileDiscoveryError = {
58
+ sourceFragment: string;
59
+ message: string;
60
+ };
61
+ type PlayLocalFileDiscoveryResult = {
62
+ files: PlayLocalFileReference[];
63
+ unresolved: PlayLocalFileDiscoveryError[];
64
+ };
65
+ type PlayBundlingAdapter = {
66
+ projectRoot: string;
67
+ nodeModulesDir: string;
68
+ cacheDir?: string;
69
+ sdkSourceRoot: string;
70
+ sdkPackageJson: string;
71
+ sdkEntryFile: string;
72
+ sdkTypesEntryFile?: string;
73
+ sdkWorkersEntryFile: string;
74
+ workersHarnessEntryFile: string;
75
+ workersHarnessFilesDir: string;
76
+ workersRuntimeFingerprintDirs?: string[];
77
+ discoverPackagedLocalFiles(filePath: string): Promise<PlayLocalFileDiscoveryResult>;
78
+ typecheckPlaySource?(input: {
79
+ sourceCode: string;
80
+ sourcePath: string;
81
+ importedFilePaths: string[];
82
+ }): Promise<string[]> | string[];
83
+ warnAboutNonDevelopmentBundling?(filePath: string): void;
84
+ };
85
+ type BundledPlayFileSuccess = {
86
+ success: true;
87
+ artifact: PlayBundleArtifact;
88
+ sourceCode: string;
89
+ sourceFiles: Record<string, string>;
90
+ filePath: string;
91
+ playName: string | null;
92
+ compilerManifest?: PlayCompilerManifest;
93
+ packagedFiles: PlayLocalFileReference[];
94
+ unresolvedFileReferences: PlayLocalFileDiscoveryError[];
95
+ importedPlayDependencies: ImportedPlayDependency[];
96
+ };
97
+ type BundledPlayFileFailure = {
98
+ success: false;
99
+ errors: string[];
100
+ filePath: string;
101
+ };
102
+ type BundledPlayFileResult = BundledPlayFileSuccess | BundledPlayFileFailure;
103
+ declare function extractDefinedPlayName(sourceCode: string): string | null;
104
+ type BundlePlayFileOptions = {
105
+ /**
106
+ * Which artifact to produce. Defaults to `cjs_node20` (Daytona / local-process
107
+ * runner). Pass `esm_workers` to produce a Cloudflare Worker bundle that
108
+ * combines the play with the Workers harness.
109
+ *
110
+ * The CLI selects this from the execution profile or an explicit flag. Each
111
+ * kind is cached independently on disk.
112
+ */
113
+ target?: PlayArtifactKind$1;
114
+ exportName?: string;
115
+ };
116
+
117
+ declare function createSdkPlayBundlingAdapter(): PlayBundlingAdapter;
118
+ declare function bundlePlayFile(filePath: string, options?: BundlePlayFileOptions): Promise<BundledPlayFileResult>;
119
+
120
+ export { type BundlePlayFileOptions, type BundledPlayFileResult, type BundledPlayFileSuccess, type ImportedPlayDependency, type PlayArtifactCompatibility, type PlayBundleArtifact, type PlayImportPolicy, type PlayLocalFileDiscoveryError, type PlayLocalFileReference, type PlayPackageImport, type PlayRuntimeFeature, bundlePlayFile, createSdkPlayBundlingAdapter, extractDefinedPlayName };