deepline 0.1.122 → 0.1.124

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/README.md CHANGED
@@ -320,14 +320,13 @@ scripts/repro-rate-limit-enrich.sh redis_429
320
320
  scripts/repro-rate-limit-enrich.sh redis_429_waterfall
321
321
  ```
322
322
 
323
- ## Transpiling native plays
323
+ ## Prebuilt plays
324
324
 
325
- Convert V1 native `PlayDocument` definitions to V2 `definePlay()` files:
325
+ V2 prebuilt play sources are authored directly in `src/lib/plays/v2/`. After
326
+ editing them, regenerate the committed Workers and share-page artifacts:
326
327
 
327
328
  ```bash
328
- bun scripts/transpile-native-plays.ts # all -> src/lib/plays/generated/v2/
329
- bun scripts/transpile-native-plays.ts --play test_play # single play
330
- bun scripts/transpile-native-plays.ts --stdout # print to stdout
329
+ bun scripts/regen.ts workers-prebuilt prebuilt-share-pages
331
330
  ```
332
331
 
333
332
  ## File structure
@@ -1655,6 +1655,8 @@ async function registerInlineChildRunWithRuntime(input: {
1655
1655
  action: 'start_inline_child_run',
1656
1656
  playName: input.childPlayName,
1657
1657
  runId: input.childRunId,
1658
+ parentRunId: input.governance.parentRunId,
1659
+ rootRunId: input.governance.rootRunId,
1658
1660
  workflowFamilyKey:
1659
1661
  input.governance.rootRunId ??
1660
1662
  input.governance.parentRunId ??
@@ -1762,6 +1764,7 @@ async function prepareInlineChildRunWithRuntime(input: {
1762
1764
  body: {
1763
1765
  action: 'prepare_inline_child_run',
1764
1766
  parentRunId: input.parentRunId,
1767
+ rootRunId: input.governance.rootRunId,
1765
1768
  parentPlayName: input.parentPlayName,
1766
1769
  childRunId: input.childRunId,
1767
1770
  childPlayName: input.childPlayName,
@@ -5567,6 +5567,8 @@ async function registerInlineChildRun(req: RunRequest): Promise<void> {
5567
5567
  action: 'start_inline_child_run',
5568
5568
  playName: req.playName,
5569
5569
  runId: req.runId,
5570
+ parentRunId: governance?.parentRunId,
5571
+ rootRunId: governance?.rootRunId,
5570
5572
  workflowFamilyKey:
5571
5573
  governance?.rootRunId ?? governance?.parentRunId ?? req.runId,
5572
5574
  artifactStorageKey:
@@ -60,6 +60,7 @@ import type {
60
60
  PlayListItem,
61
61
  PlayDescription,
62
62
  StopPlayRunResult,
63
+ StopAllPlayRunsResult,
63
64
  ClearPlayHistoryRequest,
64
65
  ClearPlayHistoryResult,
65
66
  PublishPlayVersionRequest,
@@ -186,8 +187,9 @@ export type ToolExecution<TData = unknown, TMeta = Record<string, unknown>> = {
186
187
 
187
188
  /** Filters for `client.runs.list(...)`. */
188
189
  export type RunsListOptions = {
189
- play: string;
190
+ play?: string;
190
191
  status?: string;
192
+ limit?: number;
191
193
  };
192
194
 
193
195
  /** Streaming options for `client.runs.tail(...)`. */
@@ -323,6 +325,8 @@ export type RunsNamespace = {
323
325
  runId: string,
324
326
  options?: { reason?: string },
325
327
  ) => Promise<StopPlayRunResult>;
328
+ /** Stop active runs across the current workspace. */
329
+ stopAll: (options?: { reason?: string }) => Promise<StopAllPlayRunsResult>;
326
330
  };
327
331
 
328
332
  /** One credit grant pool reported by the billing subscription status endpoint. */
@@ -822,6 +826,7 @@ export class DeeplineClient {
822
826
  logs: (runId, options) => this.getRunLogs(runId, options),
823
827
  exportDatasetRows: (input) => this.getPlaySheetRows(input),
824
828
  stop: (runId, options) => this.stopRun(runId, options),
829
+ stopAll: (options) => this.stopAllRuns(options),
825
830
  };
826
831
  this.billing = {
827
832
  plans: () => this.getBillingPlans(),
@@ -927,12 +932,18 @@ export class DeeplineClient {
927
932
  play.outputSchema,
928
933
  'rowOutputSchema',
929
934
  );
935
+ const description =
936
+ play.description?.trim() ||
937
+ play.currentRevision?.description?.trim() ||
938
+ play.liveRevision?.description?.trim() ||
939
+ null;
930
940
  const runCommand = this.playRunCommand(play, { csvInput });
931
941
  const cloneEditStarter = this.playCloneEditStarter(play);
932
942
  return {
933
943
  name: play.name,
934
944
  ...(play.reference ? { reference: play.reference } : {}),
935
945
  ...(play.displayName ? { displayName: play.displayName } : {}),
946
+ ...(description ? { description } : {}),
936
947
  origin: play.origin,
937
948
  ownerType: play.ownerType,
938
949
  canEdit: play.canEdit,
@@ -1207,6 +1218,7 @@ export class DeeplineClient {
1207
1218
  : {}),
1208
1219
  ...(request.sourceCode ? { sourceCode: request.sourceCode } : {}),
1209
1220
  ...(request.sourceFiles ? { sourceFiles: request.sourceFiles } : {}),
1221
+ ...(request.description ? { description: request.description } : {}),
1210
1222
  ...('staticPipeline' in request
1211
1223
  ? { staticPipeline: request.staticPipeline }
1212
1224
  : {}),
@@ -1265,6 +1277,7 @@ export class DeeplineClient {
1265
1277
  : {}),
1266
1278
  ...(request.sourceCode ? { sourceCode: request.sourceCode } : {}),
1267
1279
  ...(request.sourceFiles ? { sourceFiles: request.sourceFiles } : {}),
1280
+ ...(request.description ? { description: request.description } : {}),
1268
1281
  ...('staticPipeline' in request
1269
1282
  ? { staticPipeline: request.staticPipeline }
1270
1283
  : {}),
@@ -1317,6 +1330,7 @@ export class DeeplineClient {
1317
1330
  name: string;
1318
1331
  sourceCode: string;
1319
1332
  sourceFiles?: Record<string, string>;
1333
+ description?: string;
1320
1334
  artifact: Record<string, unknown>;
1321
1335
  compilerManifest?: PlayCompilerManifest;
1322
1336
  publish?: boolean;
@@ -1366,6 +1380,7 @@ export class DeeplineClient {
1366
1380
  name: string;
1367
1381
  sourceCode: string;
1368
1382
  sourceFiles?: Record<string, string>;
1383
+ description?: string;
1369
1384
  artifact: Record<string, unknown>;
1370
1385
  compilerManifest?: PlayCompilerManifest;
1371
1386
  publish?: boolean;
@@ -1491,6 +1506,7 @@ export class DeeplineClient {
1491
1506
  name?: string;
1492
1507
  sourceCode: string;
1493
1508
  sourceFiles?: Record<string, string>;
1509
+ description?: string;
1494
1510
  artifact: Record<string, unknown>;
1495
1511
  }): Promise<PlayCheckResult> {
1496
1512
  return this.http.post('/api/v2/plays/check', input);
@@ -1520,6 +1536,7 @@ export class DeeplineClient {
1520
1536
  name: string;
1521
1537
  sourceCode: string;
1522
1538
  sourceFiles?: Record<string, string>;
1539
+ description?: string;
1523
1540
  artifact: Record<string, unknown>;
1524
1541
  compilerManifest?: PlayCompilerManifest;
1525
1542
  input?: Record<string, unknown>;
@@ -1539,6 +1556,7 @@ export class DeeplineClient {
1539
1556
  name: input.name,
1540
1557
  sourceCode: input.sourceCode,
1541
1558
  sourceFiles: input.sourceFiles,
1559
+ description: input.description,
1542
1560
  artifact: input.artifact,
1543
1561
  compilerManifest,
1544
1562
  publish: false,
@@ -1552,6 +1570,7 @@ export class DeeplineClient {
1552
1570
  return this.startPlayRun({
1553
1571
  name: input.name,
1554
1572
  artifactStorageKey: registeredArtifact.artifactStorageKey,
1573
+ description: input.description,
1555
1574
  compilerManifest,
1556
1575
  ...(input.input ? { input: input.input } : {}),
1557
1576
  ...(input.inputFile ? { inputFile: input.inputFile } : {}),
@@ -1593,6 +1612,7 @@ export class DeeplineClient {
1593
1612
  options?: {
1594
1613
  sourceCode?: string;
1595
1614
  sourceFiles?: Record<string, string>;
1615
+ description?: string;
1596
1616
  artifact?: Record<string, unknown>;
1597
1617
  compilerManifest?: PlayCompilerManifest;
1598
1618
  input?: Record<string, unknown>;
@@ -1628,6 +1648,7 @@ export class DeeplineClient {
1628
1648
  name,
1629
1649
  sourceCode,
1630
1650
  sourceFiles: options?.sourceFiles,
1651
+ description: options?.description,
1631
1652
  artifact,
1632
1653
  compilerManifest,
1633
1654
  publish: false,
@@ -1642,6 +1663,7 @@ export class DeeplineClient {
1642
1663
  name,
1643
1664
  artifactStorageKey: registeredArtifact.artifactStorageKey,
1644
1665
  sourceCode,
1666
+ description: options?.description,
1645
1667
  staticPipeline: registeredArtifact.staticPipeline ?? null,
1646
1668
  artifactHash:
1647
1669
  typeof artifact.artifactHash === 'string'
@@ -2034,15 +2056,21 @@ export class DeeplineClient {
2034
2056
  * ```
2035
2057
  */
2036
2058
  async listRuns(options: RunsListOptions): Promise<PlayRunListItem[]> {
2037
- const playName = options.play.trim();
2038
- if (!playName) {
2039
- throw new Error('runs.list requires options.play.');
2059
+ const playName = options.play?.trim();
2060
+ const params = new URLSearchParams();
2061
+ if (playName) {
2062
+ params.set('play', playName);
2040
2063
  }
2041
- const params = new URLSearchParams({ play: playName });
2042
2064
  const status = options.status?.trim();
2043
2065
  if (status) {
2044
2066
  params.set('status', status);
2045
2067
  }
2068
+ if (typeof options.limit === 'number' && Number.isFinite(options.limit)) {
2069
+ params.set('limit', String(Math.max(1, Math.floor(options.limit))));
2070
+ }
2071
+ if (!playName && !status) {
2072
+ throw new Error('runs.list requires options.play or options.status.');
2073
+ }
2046
2074
  params.set('compact', 'true');
2047
2075
  const response = await this.http.get<{ runs: PlayRunListItem[] }>(
2048
2076
  `/api/v2/runs?${params.toString()}`,
@@ -2415,6 +2443,27 @@ export class DeeplineClient {
2415
2443
  );
2416
2444
  }
2417
2445
 
2446
+ /**
2447
+ * Stop every active run visible to the current workspace.
2448
+ *
2449
+ * This is the SDK equivalent of:
2450
+ *
2451
+ * ```bash
2452
+ * deepline runs stop-all --reason "stale lock" --json
2453
+ * ```
2454
+ *
2455
+ * Use this when a failed parent run left child or waiting runs active and you
2456
+ * need to clear the workspace run-slot state without knowing each run id.
2457
+ */
2458
+ async stopAllRuns(options?: {
2459
+ reason?: string;
2460
+ }): Promise<StopAllPlayRunsResult> {
2461
+ return this.http.post<StopAllPlayRunsResult>(
2462
+ '/api/v2/runs/stop-all',
2463
+ options?.reason ? { reason: options.reason } : {},
2464
+ );
2465
+ }
2466
+
2418
2467
  /**
2419
2468
  * List callable plays visible to the workspace.
2420
2469
  *
@@ -135,6 +135,14 @@ import type { ToolExecution } from './client.js';
135
135
  * @sdkReference runtime 030
136
136
  */
137
137
  export type PlayBindings = {
138
+ /**
139
+ * Human-readable one-line description of what this play does.
140
+ *
141
+ * New SDK-authored file workflows require this in `plays check`, `plays run
142
+ * --file`, and `plays publish <file>`. The server API keeps it optional so
143
+ * older clients can continue to register revisions during the migration.
144
+ */
145
+ description?: string;
138
146
  /** Optional per-run billing controls enforced by the runtime. */
139
147
  billing?: {
140
148
  /** Stop the run before a billed action would push total run credits above this cap. */
@@ -1123,6 +1131,8 @@ export type PlayInputContract<TInput> = {
1123
1131
  export type DefinePlayConfig<TInput, TOutput extends PlayReturnObject> = {
1124
1132
  /** Play id/name. */
1125
1133
  id: string;
1134
+ /** Human-readable one-line description of what this play does. */
1135
+ description?: string;
1126
1136
  /** Input schema. */
1127
1137
  input: PlayInputContract<TInput>;
1128
1138
  /** Play function. */
@@ -1299,6 +1309,7 @@ export type DefinedPlay<TInput, TOutput extends PlayReturnObject> = ((
1299
1309
 
1300
1310
  type PlayMetadata = {
1301
1311
  name: string;
1312
+ description?: string;
1302
1313
  bindings?: PlayBindings;
1303
1314
  inputSchema?: Record<string, unknown>;
1304
1315
  billing?: PlayBindings['billing'];
@@ -1891,6 +1902,7 @@ export function definePlay<TInput, TOutput extends PlayReturnObject>(
1891
1902
  name: nameOrConfig,
1892
1903
  fn: maybeFn,
1893
1904
  bindings: maybeBindings,
1905
+ description: maybeBindings?.description,
1894
1906
  inputSchema: undefined,
1895
1907
  billing: maybeBindings?.billing,
1896
1908
  }
@@ -1898,12 +1910,14 @@ export function definePlay<TInput, TOutput extends PlayReturnObject>(
1898
1910
  name: nameOrConfig.id,
1899
1911
  fn: nameOrConfig.run,
1900
1912
  bindings: nameOrConfig.bindings,
1913
+ description: nameOrConfig.description,
1901
1914
  inputSchema: nameOrConfig.input.schema,
1902
1915
  billing: nameOrConfig.billing,
1903
1916
  };
1904
1917
  const name = config.name;
1905
1918
  const fn = config.fn;
1906
1919
  const bindings = config.bindings;
1920
+ const description = config.description?.trim();
1907
1921
  const billing = config.billing;
1908
1922
  const inputSchema = config.inputSchema;
1909
1923
  if (typeof fn !== 'function') {
@@ -1935,6 +1949,7 @@ export function definePlay<TInput, TOutput extends PlayReturnObject>(
1935
1949
 
1936
1950
  const metadata: PlayMetadata = {
1937
1951
  name,
1952
+ ...(description ? { description } : {}),
1938
1953
  ...(bindings ? { bindings } : {}),
1939
1954
  ...(inputSchema ? { inputSchema } : {}),
1940
1955
  ...(billing ? { billing } : {}),
@@ -55,6 +55,7 @@ export type SdkSupportPolicy = {
55
55
  */
56
56
  commandMinimumSupported?: ReadonlyArray<{
57
57
  command: string;
58
+ displayCommand?: string;
58
59
  minimumSupported: string;
59
60
  reason: string;
60
61
  }>;
@@ -99,10 +100,11 @@ export const SDK_RELEASE = {
99
100
  // skill on the sdk sync surface, and the people-search-to-email prebuilt.
100
101
  // 0.1.108 ships explicit dataset column/tool recompute policy and removes
101
102
  // the SDK enrich generator's one-second stale policy.
102
- version: '0.1.122',
103
+ // 0.1.110 ships authored V2 prebuilts and required top-level play descriptions.
104
+ version: '0.1.124',
103
105
  apiContract: '2026-06-dataset-column-cell-stale-hard-cutover',
104
106
  supportPolicy: {
105
- latest: '0.1.122',
107
+ latest: '0.1.124',
106
108
  minimumSupported: '0.1.53',
107
109
  deprecatedBelow: '0.1.53',
108
110
  commandMinimumSupported: [
@@ -112,6 +114,64 @@ export const SDK_RELEASE = {
112
114
  reason:
113
115
  'Older SDK CLI enrich generated stale play source for the current dataset API.',
114
116
  },
117
+ {
118
+ command: 'plays',
119
+ minimumSupported: '0.1.110',
120
+ reason:
121
+ 'Play file commands now require top-level definePlay descriptions so agents and play surfaces can explain local plays.',
122
+ },
123
+ {
124
+ command: 'plays run',
125
+ minimumSupported: '0.1.110',
126
+ reason:
127
+ 'Play file commands now require top-level definePlay descriptions so agents and play surfaces can explain local plays.',
128
+ },
129
+ {
130
+ command: 'run',
131
+ displayCommand: 'plays run',
132
+ minimumSupported: '0.1.110',
133
+ reason:
134
+ 'Play file commands now require top-level definePlay descriptions so agents and play surfaces can explain local plays.',
135
+ },
136
+ {
137
+ command: 'plays check',
138
+ minimumSupported: '0.1.110',
139
+ reason:
140
+ 'Play file commands now require top-level definePlay descriptions so agents and play surfaces can explain local plays.',
141
+ },
142
+ {
143
+ command: 'check',
144
+ displayCommand: 'plays check',
145
+ minimumSupported: '0.1.110',
146
+ reason:
147
+ 'Play file commands now require top-level definePlay descriptions so agents and play surfaces can explain local plays.',
148
+ },
149
+ {
150
+ command: 'plays publish',
151
+ minimumSupported: '0.1.110',
152
+ reason:
153
+ 'Play file commands now require top-level definePlay descriptions so agents and play surfaces can explain local plays.',
154
+ },
155
+ {
156
+ command: 'publish',
157
+ displayCommand: 'plays publish',
158
+ minimumSupported: '0.1.110',
159
+ reason:
160
+ 'Play file commands now require top-level definePlay descriptions so agents and play surfaces can explain local plays.',
161
+ },
162
+ {
163
+ command: 'plays set-live',
164
+ minimumSupported: '0.1.110',
165
+ reason:
166
+ 'Play file commands now require top-level definePlay descriptions so agents and play surfaces can explain local plays.',
167
+ },
168
+ {
169
+ command: 'set-live',
170
+ displayCommand: 'plays set-live',
171
+ minimumSupported: '0.1.110',
172
+ reason:
173
+ 'Play file commands now require top-level definePlay descriptions so agents and play surfaces can explain local plays.',
174
+ },
115
175
  ],
116
176
  autoUpdatePatchLag: 2,
117
177
  },
@@ -557,22 +557,40 @@ export interface StopPlayRunResult {
557
557
  error?: string;
558
558
  }
559
559
 
560
+ export interface StopAllPlayRunsResult {
561
+ stopped: number;
562
+ failed: number;
563
+ skipped: number;
564
+ partial?: boolean;
565
+ runs: Array<StopPlayRunResult & { status?: string | null }>;
566
+ }
567
+
560
568
  /**
561
569
  * Summary of a single play run, returned by {@link DeeplineClient.listPlayRuns}.
562
570
  */
563
571
  export interface PlayRunListItem {
564
572
  /** Public Deepline play-run id. */
565
573
  workflowId: string;
574
+ /** Saved play name for this run, when available. */
575
+ playName?: string | null;
566
576
  /** Backend run attempt id, when exposed. */
567
577
  runId: string;
578
+ /** Parent play-run id when this run was launched through ctx.runPlay. */
579
+ parentRunId?: string | null;
580
+ /** Root play-run id for nested ctx.runPlay descendants. */
581
+ rootRunId?: string | null;
568
582
  /** Workflow type (typically `'Workflow'`). */
569
583
  type: string;
570
584
  /** Human-readable status (e.g. `'Completed'`, `'Failed'`). */
571
585
  status: string;
572
586
  /** ISO 8601 timestamp when the run started. */
573
- startTime: string | null;
587
+ startTime?: string | null;
588
+ /** Unix epoch milliseconds when the run started, returned by normalized V2 run summaries. */
589
+ startedAt?: number | string | null;
574
590
  /** ISO 8601 timestamp when the run finished. */
575
- closeTime: string | null;
591
+ closeTime?: string | null;
592
+ /** Unix epoch milliseconds when the run finished, returned by normalized V2 run summaries. */
593
+ finishedAt?: number | string | null;
576
594
  /** Duration string (e.g. `'2.5s'`). */
577
595
  executionTime: string | null;
578
596
  /** Total Deepline credits charged for the run, when available. */
@@ -726,6 +744,7 @@ export interface PlayListItem {
726
744
  reference?: string;
727
745
  name: string;
728
746
  displayName?: string;
747
+ description?: string | null;
729
748
  origin?: 'prebuilt' | 'owned';
730
749
  ownerType?: 'deepline' | 'org';
731
750
  ownerSlug?: string;
@@ -752,6 +771,7 @@ export interface PlayDescription {
752
771
  name: string;
753
772
  reference?: string;
754
773
  displayName?: string;
774
+ description?: string | null;
755
775
  origin?: 'prebuilt' | 'owned';
756
776
  ownerType?: 'deepline' | 'org';
757
777
  canEdit?: boolean;
@@ -910,6 +930,8 @@ export interface StartPlayRunRequest {
910
930
  sourceCode?: string;
911
931
  /** Source graph snapshots for local helper files included in cloud preflight. */
912
932
  sourceFiles?: Record<string, string>;
933
+ /** Human-readable one-line description for the revision created by file-backed runs. */
934
+ description?: string;
913
935
  /** Static pipeline already produced while registering this artifact. */
914
936
  staticPipeline?: unknown;
915
937
  /** Artifact content hash already validated while registering this artifact. */
@@ -53,6 +53,7 @@ const PLAY_METADATA_SYMBOL = Symbol.for('deepline.play.metadata');
53
53
 
54
54
  type PlayMetadata = {
55
55
  name: string;
56
+ description?: string;
56
57
  bindings?: PlayBindings;
57
58
  inputSchema?: Record<string, unknown>;
58
59
  billing?: PlayBindings['billing'];
@@ -206,6 +207,7 @@ export function definePlay<TInput, TOutput extends PlayReturnObject>(
206
207
  name: nameOrConfig,
207
208
  fn: maybeFn,
208
209
  bindings: maybeBindings,
210
+ description: maybeBindings?.description,
209
211
  inputSchema: undefined,
210
212
  billing: maybeBindings?.billing,
211
213
  }
@@ -213,12 +215,14 @@ export function definePlay<TInput, TOutput extends PlayReturnObject>(
213
215
  name: nameOrConfig.id,
214
216
  fn: nameOrConfig.run,
215
217
  bindings: nameOrConfig.bindings,
218
+ description: nameOrConfig.description,
216
219
  inputSchema: nameOrConfig.input.schema,
217
220
  billing: nameOrConfig.billing,
218
221
  };
219
222
 
220
223
  const name = config.name;
221
224
  const fn = config.fn;
225
+ const description = config.description?.trim();
222
226
  if (typeof fn !== 'function') {
223
227
  throw new Error('definePlay run must be async');
224
228
  }
@@ -240,6 +244,7 @@ export function definePlay<TInput, TOutput extends PlayReturnObject>(
240
244
 
241
245
  const metadata: PlayMetadata = {
242
246
  name,
247
+ ...(description ? { description } : {}),
243
248
  ...(config.bindings ? { bindings: config.bindings } : {}),
244
249
  ...(config.inputSchema ? { inputSchema: config.inputSchema } : {}),
245
250
  ...(config.billing ? { billing: config.billing } : {}),
@@ -101,6 +101,8 @@ type RuntimeApiRequest =
101
101
  action: 'start_inline_child_run';
102
102
  playName: string;
103
103
  runId: string;
104
+ parentRunId?: string | null;
105
+ rootRunId?: string | null;
104
106
  workflowFamilyKey?: string | null;
105
107
  artifactStorageKey?: string | null;
106
108
  artifactHash?: string | null;
@@ -678,6 +680,8 @@ export async function startRunViaAppRuntime(
678
680
  input: {
679
681
  playName: string;
680
682
  runId: string;
683
+ parentRunId?: string | null;
684
+ rootRunId?: string | null;
681
685
  workflowFamilyKey?: string | null;
682
686
  artifactStorageKey?: string | null;
683
687
  artifactHash?: string | null;