deepline 0.1.79 → 0.1.81

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 (29) hide show
  1. package/README.md +2 -1
  2. package/dist/cli/index.js +76 -42
  3. package/dist/cli/index.mjs +76 -42
  4. package/dist/index.d.mts +9 -1
  5. package/dist/index.d.ts +9 -1
  6. package/dist/index.js +13 -10
  7. package/dist/index.mjs +13 -10
  8. package/dist/repo/apps/play-runner-workers/src/child-play-await.ts +192 -0
  9. package/dist/repo/apps/play-runner-workers/src/coordinator-entry.ts +1103 -1617
  10. package/dist/repo/apps/play-runner-workers/src/dedup-do.ts +506 -654
  11. package/dist/repo/apps/play-runner-workers/src/entry.ts +1148 -598
  12. package/dist/repo/apps/play-runner-workers/src/runtime/tool-http-errors.ts +43 -1
  13. package/dist/repo/apps/play-runner-workers/src/workflow-retry-state.ts +8 -2
  14. package/dist/repo/sdk/src/client.ts +15 -8
  15. package/dist/repo/sdk/src/release.ts +2 -2
  16. package/dist/repo/sdk/src/types.ts +5 -0
  17. package/dist/repo/shared_libs/play-runtime/governor/coordinator-rate-state-backend.ts +231 -0
  18. package/dist/repo/shared_libs/play-runtime/governor/governor.ts +376 -0
  19. package/dist/repo/shared_libs/play-runtime/governor/policy.ts +179 -0
  20. package/dist/repo/shared_libs/play-runtime/governor/rate-state-backend.ts +87 -0
  21. package/dist/repo/shared_libs/play-runtime/run-failure.ts +12 -0
  22. package/dist/repo/shared_libs/play-runtime/scheduler-backend.ts +24 -0
  23. package/dist/repo/shared_libs/play-runtime/submit-limits.ts +35 -0
  24. package/dist/repo/shared_libs/plays/bundling/index.ts +4 -12
  25. package/dist/repo/shared_libs/plays/bundling/limits.ts +29 -0
  26. package/dist/repo/shared_libs/plays/static-pipeline.ts +56 -3
  27. package/dist/repo/shared_libs/temporal/constants.ts +38 -0
  28. package/package.json +1 -1
  29. package/dist/repo/shared_libs/play-runtime/tool-batch-executor.ts +0 -149
package/README.md CHANGED
@@ -113,7 +113,8 @@ surfaces we exercise in CI:
113
113
  - `ctx.runPlay(name, input)`
114
114
  4. Raw HTTP API
115
115
  - `POST /api/v2/plays/run`
116
- - `GET /api/v2/plays/run/:workflowId`
116
+ - `GET /api/v2/runs/:runId`
117
+ - `GET /api/v2/runs/:runId/tail`
117
118
  5. In-play composition
118
119
  - `ctx.runPlay(...)`
119
120
 
package/dist/cli/index.js CHANGED
@@ -229,10 +229,10 @@ var import_node_path2 = require("path");
229
229
 
230
230
  // src/release.ts
231
231
  var SDK_RELEASE = {
232
- version: "0.1.79",
232
+ version: "0.1.81",
233
233
  apiContract: "2026-06-dataset-column-cell-stale-hard-cutover",
234
234
  supportPolicy: {
235
- latest: "0.1.79",
235
+ latest: "0.1.81",
236
236
  minimumSupported: "0.1.53",
237
237
  deprecatedBelow: "0.1.53"
238
238
  }
@@ -869,6 +869,7 @@ var DeeplineClient = class {
869
869
  params.set("grep", options.grep.trim());
870
870
  params.set("grep_mode", options.grepMode ?? "all");
871
871
  }
872
+ params.set("compact", options?.compact === true ? "true" : "false");
872
873
  const suffix = params.toString() ? `?${params.toString()}` : "";
873
874
  const res = await this.http.get(
874
875
  `/api/v2/tools${suffix}`
@@ -1308,7 +1309,7 @@ var DeeplineClient = class {
1308
1309
  }
1309
1310
  const query = params.size > 0 ? `?${params.toString()}` : "";
1310
1311
  const response = await this.http.get(
1311
- `/api/v2/plays/run/${encodeURIComponent(workflowId)}${query}`
1312
+ `/api/v2/runs/${encodeURIComponent(workflowId)}${query}`
1312
1313
  );
1313
1314
  return normalizePlayStatus(response);
1314
1315
  }
@@ -1320,10 +1321,10 @@ var DeeplineClient = class {
1320
1321
  */
1321
1322
  async *streamPlayRunEvents(workflowId, options) {
1322
1323
  const headers = options?.lastEventId && options.lastEventId.trim() ? { "Last-Event-ID": options.lastEventId.trim() } : void 0;
1323
- const params = new URLSearchParams({ stream: "true" });
1324
+ const params = new URLSearchParams();
1324
1325
  params.set("mode", options?.mode ?? "cli");
1325
1326
  for await (const event of this.http.streamSse(
1326
- `/api/v2/plays/run/${encodeURIComponent(workflowId)}?${params.toString()}`,
1327
+ `/api/v2/runs/${encodeURIComponent(workflowId)}/tail?${params.toString()}`,
1327
1328
  { signal: options?.signal, headers }
1328
1329
  )) {
1329
1330
  if (event.scope === "play") {
@@ -1345,7 +1346,7 @@ var DeeplineClient = class {
1345
1346
  */
1346
1347
  async cancelPlay(workflowId) {
1347
1348
  await this.http.request(
1348
- `/api/v2/plays/run/${encodeURIComponent(workflowId)}/stop`,
1349
+ `/api/v2/runs/${encodeURIComponent(workflowId)}/stop`,
1349
1350
  { method: "POST" }
1350
1351
  );
1351
1352
  }
@@ -1357,7 +1358,7 @@ var DeeplineClient = class {
1357
1358
  */
1358
1359
  async stopPlay(workflowId, options) {
1359
1360
  return this.http.post(
1360
- `/api/v2/plays/run/${encodeURIComponent(workflowId)}/stop`,
1361
+ `/api/v2/runs/${encodeURIComponent(workflowId)}/stop`,
1361
1362
  options?.reason ? { reason: options.reason } : {}
1362
1363
  );
1363
1364
  }
@@ -1424,6 +1425,7 @@ var DeeplineClient = class {
1424
1425
  if (status) {
1425
1426
  params.set("status", status);
1426
1427
  }
1428
+ params.set("compact", "true");
1427
1429
  const response = await this.http.get(
1428
1430
  `/api/v2/runs?${params.toString()}`
1429
1431
  );
@@ -1476,7 +1478,7 @@ var DeeplineClient = class {
1476
1478
  * ```
1477
1479
  */
1478
1480
  async getRunLogs(runId, options) {
1479
- const status = await this.getRunStatus(runId);
1481
+ const status = await this.getRunStatus(runId, { full: true });
1480
1482
  const logs = status.progress?.logs ?? [];
1481
1483
  const limit = typeof options?.limit === "number" && Number.isFinite(options.limit) ? Math.max(0, Math.trunc(options.limit)) : 200;
1482
1484
  const entries = logs.slice(Math.max(0, logs.length - limit));
@@ -1588,10 +1590,11 @@ var DeeplineClient = class {
1588
1590
  * @param name - Play name
1589
1591
  * @returns Version list (newest first)
1590
1592
  */
1591
- async listPlayVersions(name) {
1593
+ async listPlayVersions(name, options) {
1592
1594
  const encodedName = encodeURIComponent(name);
1595
+ const suffix = options?.full ? "?full=true" : "";
1593
1596
  const response = await this.http.get(
1594
- `/api/v2/plays/${encodedName}/versions`
1597
+ `/api/v2/plays/${encodedName}/versions${suffix}`
1595
1598
  );
1596
1599
  return response.versions ?? [];
1597
1600
  }
@@ -2866,9 +2869,9 @@ function recentUsageLines(entries) {
2866
2869
  for (const entry of entries) {
2867
2870
  const op = `${humanize(entry.provider)} ${humanize(entry.operation)}`.trim();
2868
2871
  const charge = entry.billing_mode === "no_bill" ? "free" : `${entry.credits ?? 0} cr`;
2869
- const status = entry.status || "completed";
2872
+ const state = entry.charge_state === "temporary_hold" ? "temporary hold, awaiting actual usage" : entry.status || "completed";
2870
2873
  lines.push(
2871
- `${op} | ${charge} | ${status} | ${entry.created_at || "unknown"}`
2874
+ `${op} | ${charge} | ${state} | ${entry.created_at || "unknown"}`
2872
2875
  );
2873
2876
  }
2874
2877
  return lines;
@@ -2952,9 +2955,12 @@ async function handleUsage(options) {
2952
2955
  const usage = payload.usage ?? {};
2953
2956
  const quota = payload.quota ?? {};
2954
2957
  const recent = payload.recent ?? {};
2958
+ const last30Usage = usage.last_30_days_usage_credits ?? usage.month_spent_credits;
2959
+ const temporaryHolds = Number(usage.temporary_hold_credits ?? 0);
2955
2960
  const lines = [
2956
2961
  `Balance: ${payload.balance ?? "(unknown)"}`,
2957
- `Last 30 days spent: ${usage.month_spent_credits ?? "(unknown)"}`,
2962
+ `Last 30 days usage: ${last30Usage ?? "(unknown)"}`,
2963
+ ...Number.isFinite(temporaryHolds) && temporaryHolds > 0 ? [`Temporary holds: ${temporaryHolds}`] : [],
2958
2964
  `Monthly limit: ${quota.enabled ? quota.monthly_credits_limit ?? "(unknown)" : "off"}`,
2959
2965
  ...recentUsageLines(
2960
2966
  Array.isArray(recent.entries) ? recent.entries : []
@@ -4417,10 +4423,12 @@ function validatePlaySourceFilesHaveNoInlineSecrets(sourceFiles) {
4417
4423
  }
4418
4424
  }
4419
4425
 
4420
- // ../shared_libs/plays/bundling/index.ts
4421
- var PLAY_BUNDLE_CACHE_VERSION = 24;
4426
+ // ../shared_libs/plays/bundling/limits.ts
4422
4427
  var MAX_PLAY_BUNDLE_BYTES = 30 * 1024 * 1024;
4423
4428
  var MAX_ESM_WORKERS_BUNDLE_BYTES = 115e4;
4429
+
4430
+ // ../shared_libs/plays/bundling/index.ts
4431
+ var PLAY_BUNDLE_CACHE_VERSION = 24;
4424
4432
  var PLAY_ARTIFACT_CACHE_DIR = (0, import_node_path8.join)(
4425
4433
  (0, import_node_os5.tmpdir)(),
4426
4434
  `deepline-play-artifacts-v${PLAY_BUNDLE_CACHE_VERSION}`
@@ -8478,7 +8486,7 @@ function buildPlayDashboardUrl(baseUrl, playName) {
8478
8486
  return `${trimmedBase}/dashboard/plays/${encodedPlayName}`;
8479
8487
  }
8480
8488
  function openPlayDashboard(input2) {
8481
- if (input2.jsonOutput || input2.noOpen || !input2.dashboardUrl) {
8489
+ if (input2.noOpen || !input2.dashboardUrl) {
8482
8490
  return;
8483
8491
  }
8484
8492
  openInBrowser(input2.dashboardUrl);
@@ -8560,13 +8568,20 @@ async function waitForPlayCompletionByStream(input2) {
8560
8568
  progress: input2.progress
8561
8569
  });
8562
8570
  }
8571
+ const finalStatus = getFinalStatusFromLiveEvent(event);
8572
+ if (finalStatus) {
8573
+ return input2.dashboardUrl ? { ...finalStatus, dashboardUrl: input2.dashboardUrl } : finalStatus;
8574
+ }
8563
8575
  const status = getStatusFromLiveEvent(event);
8564
8576
  if (status && TERMINAL_PLAY_STATUSES2.has(status)) {
8565
- const finalStatus = await input2.client.getPlayStatus(input2.workflowId, {
8566
- billing: false
8567
- });
8568
- if (TERMINAL_PLAY_STATUSES2.has(finalStatus.status)) {
8569
- return input2.dashboardUrl ? { ...finalStatus, dashboardUrl: input2.dashboardUrl } : finalStatus;
8577
+ const refreshedStatus = await input2.client.getPlayStatus(
8578
+ input2.workflowId,
8579
+ {
8580
+ billing: false
8581
+ }
8582
+ );
8583
+ if (TERMINAL_PLAY_STATUSES2.has(refreshedStatus.status)) {
8584
+ return input2.dashboardUrl ? { ...refreshedStatus, dashboardUrl: input2.dashboardUrl } : refreshedStatus;
8570
8585
  }
8571
8586
  }
8572
8587
  }
@@ -8668,7 +8683,6 @@ async function startAndWaitForPlayCompletionByStreamOnce(input2) {
8668
8683
  }
8669
8684
  openPlayDashboard({
8670
8685
  dashboardUrl,
8671
- jsonOutput: input2.jsonOutput,
8672
8686
  noOpen: input2.noOpen
8673
8687
  });
8674
8688
  input2.progress.phase(`loading play on ${dashboardUrl}`);
@@ -9607,7 +9621,7 @@ function writePlayResult(status, jsonOutput, options) {
9607
9621
  );
9608
9622
  }
9609
9623
  async function resolvePlayRunOutputStatus(input2) {
9610
- if (!getPlayRunPackage(input2.status)) {
9624
+ if (!input2.fullJson || !getPlayRunPackage(input2.status)) {
9611
9625
  return input2.status;
9612
9626
  }
9613
9627
  const runId = input2.status.runId;
@@ -10589,7 +10603,6 @@ async function handleFileBackedRun(options) {
10589
10603
  const resolvedDashboardUrl = buildPlayDashboardUrl(client.baseUrl, playName);
10590
10604
  openPlayDashboard({
10591
10605
  dashboardUrl: resolvedDashboardUrl,
10592
- jsonOutput: options.jsonOutput,
10593
10606
  noOpen: options.noOpen
10594
10607
  });
10595
10608
  progress.phase(`loading play on ${resolvedDashboardUrl}`);
@@ -10736,7 +10749,6 @@ async function handleNamedRun(options) {
10736
10749
  const resolvedDashboardUrl = buildPlayDashboardUrl(client.baseUrl, playName);
10737
10750
  openPlayDashboard({
10738
10751
  dashboardUrl: resolvedDashboardUrl,
10739
- jsonOutput: options.jsonOutput,
10740
10752
  noOpen: options.noOpen
10741
10753
  });
10742
10754
  progress.phase(`loading play on ${resolvedDashboardUrl}`);
@@ -10824,7 +10836,7 @@ async function handleRunsList(args) {
10824
10836
  for (let index = 0; index < args.length; index += 1) {
10825
10837
  const arg = args[index];
10826
10838
  if ((arg === "--play" || arg === "--name") && args[index + 1]) {
10827
- playName = parseReferencedPlayTarget2(args[++index]).playName;
10839
+ playName = args[++index].trim();
10828
10840
  continue;
10829
10841
  }
10830
10842
  if (arg === "--status" && args[index + 1]) {
@@ -10918,7 +10930,7 @@ async function handleRunLogs(args) {
10918
10930
  }
10919
10931
  }
10920
10932
  const client = new DeeplineClient();
10921
- const status = await client.runs.get(runId);
10933
+ const status = await client.runs.get(runId, { full: true });
10922
10934
  const logs = status.progress?.logs ?? [];
10923
10935
  if (outPath) {
10924
10936
  (0, import_node_fs10.writeFileSync)(outPath, `${logs.join("\n")}${logs.length > 0 ? "\n" : ""}`);
@@ -11213,7 +11225,7 @@ async function handlePlayList(args) {
11213
11225
  const reference = formatPlayListReference(play);
11214
11226
  process.stdout.write(` ${reference}${flags ? ` [${flags}]` : ""}
11215
11227
  `);
11216
- if (play.inputSchema) {
11228
+ if (play.inputSchema || play.hasInputSchema) {
11217
11229
  process.stdout.write(" inputSchema: yes\n");
11218
11230
  }
11219
11231
  process.stdout.write(` run: deepline plays run ${reference} --watch
@@ -11566,22 +11578,42 @@ async function handlePlayPublish(args) {
11566
11578
  }
11567
11579
  let graph;
11568
11580
  try {
11569
- graph = await collectBundledPlayGraph((0, import_node_path12.resolve)(playName));
11570
- await compileBundledPlayGraphManifests(client, graph);
11571
- await publishImportedPlayDependencies(client, graph);
11581
+ graph = await traceCliSpan(
11582
+ "cli.play_publish_bundle_graph",
11583
+ { targetKind: "file" },
11584
+ () => collectBundledPlayGraph((0, import_node_path12.resolve)(playName))
11585
+ );
11586
+ await traceCliSpan(
11587
+ "cli.play_publish_compile_manifests",
11588
+ { targetKind: "file", nodeCount: graph.nodes.size },
11589
+ () => compileBundledPlayGraphManifests(client, graph)
11590
+ );
11591
+ await traceCliSpan(
11592
+ "cli.play_publish_imports",
11593
+ { targetKind: "file", nodeCount: graph.nodes.size },
11594
+ () => publishImportedPlayDependencies(client, graph)
11595
+ );
11572
11596
  } catch (error) {
11573
11597
  console.error(error instanceof Error ? error.message : String(error));
11574
11598
  return 1;
11575
11599
  }
11576
11600
  const rootPlayName = graph.root.playName ?? extractPlayName(graph.root.sourceCode, graph.root.filePath);
11577
- const published = await client.registerPlayArtifact({
11578
- name: rootPlayName,
11579
- sourceCode: graph.root.sourceCode,
11580
- sourceFiles: graph.root.sourceFiles,
11581
- artifact: graph.root.artifact,
11582
- compilerManifest: requireCompilerManifest(graph.root),
11583
- publish: true
11584
- });
11601
+ const published = await traceCliSpan(
11602
+ "cli.play_publish_register_root",
11603
+ {
11604
+ targetKind: "file",
11605
+ playName: rootPlayName,
11606
+ artifactHash: graph.root.artifact.artifactHash
11607
+ },
11608
+ () => client.registerPlayArtifact({
11609
+ name: rootPlayName,
11610
+ sourceCode: graph.root.sourceCode,
11611
+ sourceFiles: graph.root.sourceFiles,
11612
+ artifact: graph.root.artifact,
11613
+ compilerManifest: requireCompilerManifest(graph.root),
11614
+ publish: true
11615
+ })
11616
+ );
11585
11617
  process.stdout.write(
11586
11618
  `${JSON.stringify({
11587
11619
  success: true,
@@ -14038,10 +14070,11 @@ async function listTools(args) {
14038
14070
  const client = new DeeplineClient();
14039
14071
  const categoryArgIndex = args.findIndex((arg) => arg === "--categories");
14040
14072
  const categoryFilter = categoryArgIndex >= 0 ? args[categoryArgIndex + 1] : "";
14041
- const compact = args.includes("--compact") || !args.includes("--json");
14073
+ const compact = !args.includes("--full");
14042
14074
  const requestedCategories = categoryFilter ? categoryFilter.split(",").map((item) => item.trim()).filter(Boolean) : [];
14043
14075
  const items = (await client.listTools({
14044
- ...categoryFilter ? { categories: categoryFilter } : {}
14076
+ ...categoryFilter ? { categories: categoryFilter } : {},
14077
+ compact
14045
14078
  })).map(toListedTool).filter(
14046
14079
  (item) => requestedCategories.length === 0 || requestedCategories.some(
14047
14080
  (category) => item.categories.includes(category)
@@ -14116,7 +14149,8 @@ async function grepTools(queryInput, options = {}) {
14116
14149
  const tools = (await client.listTools({
14117
14150
  grep: query,
14118
14151
  grepMode: mode,
14119
- ...options.categories ? { categories: options.categories } : {}
14152
+ ...options.categories ? { categories: options.categories } : {},
14153
+ compact: options.compact ?? true
14120
14154
  })).map(toListedTool).filter(
14121
14155
  (item) => requestedCategories.length === 0 || requestedCategories.some(
14122
14156
  (category) => item.categories.includes(category)
@@ -206,10 +206,10 @@ import { join as join2 } from "path";
206
206
 
207
207
  // src/release.ts
208
208
  var SDK_RELEASE = {
209
- version: "0.1.79",
209
+ version: "0.1.81",
210
210
  apiContract: "2026-06-dataset-column-cell-stale-hard-cutover",
211
211
  supportPolicy: {
212
- latest: "0.1.79",
212
+ latest: "0.1.81",
213
213
  minimumSupported: "0.1.53",
214
214
  deprecatedBelow: "0.1.53"
215
215
  }
@@ -846,6 +846,7 @@ var DeeplineClient = class {
846
846
  params.set("grep", options.grep.trim());
847
847
  params.set("grep_mode", options.grepMode ?? "all");
848
848
  }
849
+ params.set("compact", options?.compact === true ? "true" : "false");
849
850
  const suffix = params.toString() ? `?${params.toString()}` : "";
850
851
  const res = await this.http.get(
851
852
  `/api/v2/tools${suffix}`
@@ -1285,7 +1286,7 @@ var DeeplineClient = class {
1285
1286
  }
1286
1287
  const query = params.size > 0 ? `?${params.toString()}` : "";
1287
1288
  const response = await this.http.get(
1288
- `/api/v2/plays/run/${encodeURIComponent(workflowId)}${query}`
1289
+ `/api/v2/runs/${encodeURIComponent(workflowId)}${query}`
1289
1290
  );
1290
1291
  return normalizePlayStatus(response);
1291
1292
  }
@@ -1297,10 +1298,10 @@ var DeeplineClient = class {
1297
1298
  */
1298
1299
  async *streamPlayRunEvents(workflowId, options) {
1299
1300
  const headers = options?.lastEventId && options.lastEventId.trim() ? { "Last-Event-ID": options.lastEventId.trim() } : void 0;
1300
- const params = new URLSearchParams({ stream: "true" });
1301
+ const params = new URLSearchParams();
1301
1302
  params.set("mode", options?.mode ?? "cli");
1302
1303
  for await (const event of this.http.streamSse(
1303
- `/api/v2/plays/run/${encodeURIComponent(workflowId)}?${params.toString()}`,
1304
+ `/api/v2/runs/${encodeURIComponent(workflowId)}/tail?${params.toString()}`,
1304
1305
  { signal: options?.signal, headers }
1305
1306
  )) {
1306
1307
  if (event.scope === "play") {
@@ -1322,7 +1323,7 @@ var DeeplineClient = class {
1322
1323
  */
1323
1324
  async cancelPlay(workflowId) {
1324
1325
  await this.http.request(
1325
- `/api/v2/plays/run/${encodeURIComponent(workflowId)}/stop`,
1326
+ `/api/v2/runs/${encodeURIComponent(workflowId)}/stop`,
1326
1327
  { method: "POST" }
1327
1328
  );
1328
1329
  }
@@ -1334,7 +1335,7 @@ var DeeplineClient = class {
1334
1335
  */
1335
1336
  async stopPlay(workflowId, options) {
1336
1337
  return this.http.post(
1337
- `/api/v2/plays/run/${encodeURIComponent(workflowId)}/stop`,
1338
+ `/api/v2/runs/${encodeURIComponent(workflowId)}/stop`,
1338
1339
  options?.reason ? { reason: options.reason } : {}
1339
1340
  );
1340
1341
  }
@@ -1401,6 +1402,7 @@ var DeeplineClient = class {
1401
1402
  if (status) {
1402
1403
  params.set("status", status);
1403
1404
  }
1405
+ params.set("compact", "true");
1404
1406
  const response = await this.http.get(
1405
1407
  `/api/v2/runs?${params.toString()}`
1406
1408
  );
@@ -1453,7 +1455,7 @@ var DeeplineClient = class {
1453
1455
  * ```
1454
1456
  */
1455
1457
  async getRunLogs(runId, options) {
1456
- const status = await this.getRunStatus(runId);
1458
+ const status = await this.getRunStatus(runId, { full: true });
1457
1459
  const logs = status.progress?.logs ?? [];
1458
1460
  const limit = typeof options?.limit === "number" && Number.isFinite(options.limit) ? Math.max(0, Math.trunc(options.limit)) : 200;
1459
1461
  const entries = logs.slice(Math.max(0, logs.length - limit));
@@ -1565,10 +1567,11 @@ var DeeplineClient = class {
1565
1567
  * @param name - Play name
1566
1568
  * @returns Version list (newest first)
1567
1569
  */
1568
- async listPlayVersions(name) {
1570
+ async listPlayVersions(name, options) {
1569
1571
  const encodedName = encodeURIComponent(name);
1572
+ const suffix = options?.full ? "?full=true" : "";
1570
1573
  const response = await this.http.get(
1571
- `/api/v2/plays/${encodedName}/versions`
1574
+ `/api/v2/plays/${encodedName}/versions${suffix}`
1572
1575
  );
1573
1576
  return response.versions ?? [];
1574
1577
  }
@@ -2849,9 +2852,9 @@ function recentUsageLines(entries) {
2849
2852
  for (const entry of entries) {
2850
2853
  const op = `${humanize(entry.provider)} ${humanize(entry.operation)}`.trim();
2851
2854
  const charge = entry.billing_mode === "no_bill" ? "free" : `${entry.credits ?? 0} cr`;
2852
- const status = entry.status || "completed";
2855
+ const state = entry.charge_state === "temporary_hold" ? "temporary hold, awaiting actual usage" : entry.status || "completed";
2853
2856
  lines.push(
2854
- `${op} | ${charge} | ${status} | ${entry.created_at || "unknown"}`
2857
+ `${op} | ${charge} | ${state} | ${entry.created_at || "unknown"}`
2855
2858
  );
2856
2859
  }
2857
2860
  return lines;
@@ -2935,9 +2938,12 @@ async function handleUsage(options) {
2935
2938
  const usage = payload.usage ?? {};
2936
2939
  const quota = payload.quota ?? {};
2937
2940
  const recent = payload.recent ?? {};
2941
+ const last30Usage = usage.last_30_days_usage_credits ?? usage.month_spent_credits;
2942
+ const temporaryHolds = Number(usage.temporary_hold_credits ?? 0);
2938
2943
  const lines = [
2939
2944
  `Balance: ${payload.balance ?? "(unknown)"}`,
2940
- `Last 30 days spent: ${usage.month_spent_credits ?? "(unknown)"}`,
2945
+ `Last 30 days usage: ${last30Usage ?? "(unknown)"}`,
2946
+ ...Number.isFinite(temporaryHolds) && temporaryHolds > 0 ? [`Temporary holds: ${temporaryHolds}`] : [],
2941
2947
  `Monthly limit: ${quota.enabled ? quota.monthly_credits_limit ?? "(unknown)" : "off"}`,
2942
2948
  ...recentUsageLines(
2943
2949
  Array.isArray(recent.entries) ? recent.entries : []
@@ -4413,10 +4419,12 @@ function validatePlaySourceFilesHaveNoInlineSecrets(sourceFiles) {
4413
4419
  }
4414
4420
  }
4415
4421
 
4416
- // ../shared_libs/plays/bundling/index.ts
4417
- var PLAY_BUNDLE_CACHE_VERSION = 24;
4422
+ // ../shared_libs/plays/bundling/limits.ts
4418
4423
  var MAX_PLAY_BUNDLE_BYTES = 30 * 1024 * 1024;
4419
4424
  var MAX_ESM_WORKERS_BUNDLE_BYTES = 115e4;
4425
+
4426
+ // ../shared_libs/plays/bundling/index.ts
4427
+ var PLAY_BUNDLE_CACHE_VERSION = 24;
4420
4428
  var PLAY_ARTIFACT_CACHE_DIR = join4(
4421
4429
  tmpdir(),
4422
4430
  `deepline-play-artifacts-v${PLAY_BUNDLE_CACHE_VERSION}`
@@ -8481,7 +8489,7 @@ function buildPlayDashboardUrl(baseUrl, playName) {
8481
8489
  return `${trimmedBase}/dashboard/plays/${encodedPlayName}`;
8482
8490
  }
8483
8491
  function openPlayDashboard(input2) {
8484
- if (input2.jsonOutput || input2.noOpen || !input2.dashboardUrl) {
8492
+ if (input2.noOpen || !input2.dashboardUrl) {
8485
8493
  return;
8486
8494
  }
8487
8495
  openInBrowser(input2.dashboardUrl);
@@ -8563,13 +8571,20 @@ async function waitForPlayCompletionByStream(input2) {
8563
8571
  progress: input2.progress
8564
8572
  });
8565
8573
  }
8574
+ const finalStatus = getFinalStatusFromLiveEvent(event);
8575
+ if (finalStatus) {
8576
+ return input2.dashboardUrl ? { ...finalStatus, dashboardUrl: input2.dashboardUrl } : finalStatus;
8577
+ }
8566
8578
  const status = getStatusFromLiveEvent(event);
8567
8579
  if (status && TERMINAL_PLAY_STATUSES2.has(status)) {
8568
- const finalStatus = await input2.client.getPlayStatus(input2.workflowId, {
8569
- billing: false
8570
- });
8571
- if (TERMINAL_PLAY_STATUSES2.has(finalStatus.status)) {
8572
- return input2.dashboardUrl ? { ...finalStatus, dashboardUrl: input2.dashboardUrl } : finalStatus;
8580
+ const refreshedStatus = await input2.client.getPlayStatus(
8581
+ input2.workflowId,
8582
+ {
8583
+ billing: false
8584
+ }
8585
+ );
8586
+ if (TERMINAL_PLAY_STATUSES2.has(refreshedStatus.status)) {
8587
+ return input2.dashboardUrl ? { ...refreshedStatus, dashboardUrl: input2.dashboardUrl } : refreshedStatus;
8573
8588
  }
8574
8589
  }
8575
8590
  }
@@ -8671,7 +8686,6 @@ async function startAndWaitForPlayCompletionByStreamOnce(input2) {
8671
8686
  }
8672
8687
  openPlayDashboard({
8673
8688
  dashboardUrl,
8674
- jsonOutput: input2.jsonOutput,
8675
8689
  noOpen: input2.noOpen
8676
8690
  });
8677
8691
  input2.progress.phase(`loading play on ${dashboardUrl}`);
@@ -9610,7 +9624,7 @@ function writePlayResult(status, jsonOutput, options) {
9610
9624
  );
9611
9625
  }
9612
9626
  async function resolvePlayRunOutputStatus(input2) {
9613
- if (!getPlayRunPackage(input2.status)) {
9627
+ if (!input2.fullJson || !getPlayRunPackage(input2.status)) {
9614
9628
  return input2.status;
9615
9629
  }
9616
9630
  const runId = input2.status.runId;
@@ -10592,7 +10606,6 @@ async function handleFileBackedRun(options) {
10592
10606
  const resolvedDashboardUrl = buildPlayDashboardUrl(client.baseUrl, playName);
10593
10607
  openPlayDashboard({
10594
10608
  dashboardUrl: resolvedDashboardUrl,
10595
- jsonOutput: options.jsonOutput,
10596
10609
  noOpen: options.noOpen
10597
10610
  });
10598
10611
  progress.phase(`loading play on ${resolvedDashboardUrl}`);
@@ -10739,7 +10752,6 @@ async function handleNamedRun(options) {
10739
10752
  const resolvedDashboardUrl = buildPlayDashboardUrl(client.baseUrl, playName);
10740
10753
  openPlayDashboard({
10741
10754
  dashboardUrl: resolvedDashboardUrl,
10742
- jsonOutput: options.jsonOutput,
10743
10755
  noOpen: options.noOpen
10744
10756
  });
10745
10757
  progress.phase(`loading play on ${resolvedDashboardUrl}`);
@@ -10827,7 +10839,7 @@ async function handleRunsList(args) {
10827
10839
  for (let index = 0; index < args.length; index += 1) {
10828
10840
  const arg = args[index];
10829
10841
  if ((arg === "--play" || arg === "--name") && args[index + 1]) {
10830
- playName = parseReferencedPlayTarget2(args[++index]).playName;
10842
+ playName = args[++index].trim();
10831
10843
  continue;
10832
10844
  }
10833
10845
  if (arg === "--status" && args[index + 1]) {
@@ -10921,7 +10933,7 @@ async function handleRunLogs(args) {
10921
10933
  }
10922
10934
  }
10923
10935
  const client = new DeeplineClient();
10924
- const status = await client.runs.get(runId);
10936
+ const status = await client.runs.get(runId, { full: true });
10925
10937
  const logs = status.progress?.logs ?? [];
10926
10938
  if (outPath) {
10927
10939
  writeFileSync7(outPath, `${logs.join("\n")}${logs.length > 0 ? "\n" : ""}`);
@@ -11216,7 +11228,7 @@ async function handlePlayList(args) {
11216
11228
  const reference = formatPlayListReference(play);
11217
11229
  process.stdout.write(` ${reference}${flags ? ` [${flags}]` : ""}
11218
11230
  `);
11219
- if (play.inputSchema) {
11231
+ if (play.inputSchema || play.hasInputSchema) {
11220
11232
  process.stdout.write(" inputSchema: yes\n");
11221
11233
  }
11222
11234
  process.stdout.write(` run: deepline plays run ${reference} --watch
@@ -11569,22 +11581,42 @@ async function handlePlayPublish(args) {
11569
11581
  }
11570
11582
  let graph;
11571
11583
  try {
11572
- graph = await collectBundledPlayGraph(resolve10(playName));
11573
- await compileBundledPlayGraphManifests(client, graph);
11574
- await publishImportedPlayDependencies(client, graph);
11584
+ graph = await traceCliSpan(
11585
+ "cli.play_publish_bundle_graph",
11586
+ { targetKind: "file" },
11587
+ () => collectBundledPlayGraph(resolve10(playName))
11588
+ );
11589
+ await traceCliSpan(
11590
+ "cli.play_publish_compile_manifests",
11591
+ { targetKind: "file", nodeCount: graph.nodes.size },
11592
+ () => compileBundledPlayGraphManifests(client, graph)
11593
+ );
11594
+ await traceCliSpan(
11595
+ "cli.play_publish_imports",
11596
+ { targetKind: "file", nodeCount: graph.nodes.size },
11597
+ () => publishImportedPlayDependencies(client, graph)
11598
+ );
11575
11599
  } catch (error) {
11576
11600
  console.error(error instanceof Error ? error.message : String(error));
11577
11601
  return 1;
11578
11602
  }
11579
11603
  const rootPlayName = graph.root.playName ?? extractPlayName(graph.root.sourceCode, graph.root.filePath);
11580
- const published = await client.registerPlayArtifact({
11581
- name: rootPlayName,
11582
- sourceCode: graph.root.sourceCode,
11583
- sourceFiles: graph.root.sourceFiles,
11584
- artifact: graph.root.artifact,
11585
- compilerManifest: requireCompilerManifest(graph.root),
11586
- publish: true
11587
- });
11604
+ const published = await traceCliSpan(
11605
+ "cli.play_publish_register_root",
11606
+ {
11607
+ targetKind: "file",
11608
+ playName: rootPlayName,
11609
+ artifactHash: graph.root.artifact.artifactHash
11610
+ },
11611
+ () => client.registerPlayArtifact({
11612
+ name: rootPlayName,
11613
+ sourceCode: graph.root.sourceCode,
11614
+ sourceFiles: graph.root.sourceFiles,
11615
+ artifact: graph.root.artifact,
11616
+ compilerManifest: requireCompilerManifest(graph.root),
11617
+ publish: true
11618
+ })
11619
+ );
11588
11620
  process.stdout.write(
11589
11621
  `${JSON.stringify({
11590
11622
  success: true,
@@ -14041,10 +14073,11 @@ async function listTools(args) {
14041
14073
  const client = new DeeplineClient();
14042
14074
  const categoryArgIndex = args.findIndex((arg) => arg === "--categories");
14043
14075
  const categoryFilter = categoryArgIndex >= 0 ? args[categoryArgIndex + 1] : "";
14044
- const compact = args.includes("--compact") || !args.includes("--json");
14076
+ const compact = !args.includes("--full");
14045
14077
  const requestedCategories = categoryFilter ? categoryFilter.split(",").map((item) => item.trim()).filter(Boolean) : [];
14046
14078
  const items = (await client.listTools({
14047
- ...categoryFilter ? { categories: categoryFilter } : {}
14079
+ ...categoryFilter ? { categories: categoryFilter } : {},
14080
+ compact
14048
14081
  })).map(toListedTool).filter(
14049
14082
  (item) => requestedCategories.length === 0 || requestedCategories.some(
14050
14083
  (category) => item.categories.includes(category)
@@ -14119,7 +14152,8 @@ async function grepTools(queryInput, options = {}) {
14119
14152
  const tools = (await client.listTools({
14120
14153
  grep: query,
14121
14154
  grepMode: mode,
14122
- ...options.categories ? { categories: options.categories } : {}
14155
+ ...options.categories ? { categories: options.categories } : {},
14156
+ compact: options.compact ?? true
14123
14157
  })).map(toListedTool).filter(
14124
14158
  (item) => requestedCategories.length === 0 || requestedCategories.some(
14125
14159
  (category) => item.categories.includes(category)
package/dist/index.d.mts CHANGED
@@ -305,6 +305,10 @@ interface ToolDefinition {
305
305
  operationId?: string;
306
306
  /** Alternative names that resolve to this tool. */
307
307
  operationAliases?: string[];
308
+ /** Whether detailed input schema is available from `tools describe`. */
309
+ hasInputSchema?: boolean;
310
+ /** Whether detailed output schema is available from `tools describe`. */
311
+ hasOutputSchema?: boolean;
308
312
  /** JSON Schema describing the tool's input parameters. */
309
313
  inputSchema?: Record<string, unknown>;
310
314
  /** JSON Schema describing the tool's output shape. */
@@ -796,6 +800,7 @@ interface PlayListItem {
796
800
  currentPublishedVersion?: number | null;
797
801
  tableNamespace?: string | null;
798
802
  isDraftDirty?: boolean;
803
+ hasInputSchema?: boolean;
799
804
  inputSchema?: Record<string, unknown> | null;
800
805
  outputSchema?: Record<string, unknown> | null;
801
806
  staticPipeline?: unknown;
@@ -1263,6 +1268,7 @@ declare class DeeplineClient {
1263
1268
  categories?: string;
1264
1269
  grep?: string;
1265
1270
  grepMode?: 'all' | 'any' | 'phrase';
1271
+ compact?: boolean;
1266
1272
  }): Promise<ToolDefinition[]>;
1267
1273
  /**
1268
1274
  * Search available tools using Deepline's ranked backend search.
@@ -1676,7 +1682,9 @@ declare class DeeplineClient {
1676
1682
  * @param name - Play name
1677
1683
  * @returns Version list (newest first)
1678
1684
  */
1679
- listPlayVersions(name: string): Promise<PlayRevisionSummary[]>;
1685
+ listPlayVersions(name: string, options?: {
1686
+ full?: boolean;
1687
+ }): Promise<PlayRevisionSummary[]>;
1680
1688
  /**
1681
1689
  * Make a play revision live.
1682
1690
  *