deepline 0.1.58 → 0.1.59

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/cli/index.js CHANGED
@@ -220,10 +220,10 @@ function resolveConfig(options) {
220
220
 
221
221
  // src/release.ts
222
222
  var SDK_RELEASE = {
223
- version: "0.1.58",
224
- apiContract: "2026-05-play-tool-describe-starters",
223
+ version: "0.1.59",
224
+ apiContract: "2026-05-play-bootstrap-dataset-summary",
225
225
  supportPolicy: {
226
- latest: "0.1.58",
226
+ latest: "0.1.59",
227
227
  minimumSupported: "0.1.53",
228
228
  deprecatedBelow: "0.1.53"
229
229
  }
@@ -3044,6 +3044,33 @@ Examples:
3044
3044
  // src/cli/dataset-stats.ts
3045
3045
  var import_node_fs4 = require("fs");
3046
3046
  var import_node_path5 = require("path");
3047
+
3048
+ // ../shared_libs/plays/dataset-summary.ts
3049
+ function datasetSummaryPercentText(numerator, denominator) {
3050
+ return denominator > 0 ? `${numerator}/${denominator} (${Math.round(100 * numerator / denominator)}%)` : "0/0 (0%)";
3051
+ }
3052
+ function readCount(value) {
3053
+ return typeof value === "number" && Number.isFinite(value) && value >= 0 ? Math.trunc(value) : 0;
3054
+ }
3055
+ function formatDatasetExecutionStats(raw, denominator) {
3056
+ return {
3057
+ queued: datasetSummaryPercentText(readCount(raw.queued), denominator),
3058
+ running: datasetSummaryPercentText(readCount(raw.running), denominator),
3059
+ "completed:executed": datasetSummaryPercentText(
3060
+ readCount(raw.completed),
3061
+ denominator
3062
+ ),
3063
+ "completed:reused": datasetSummaryPercentText(readCount(raw.cached), denominator),
3064
+ "skipped:condition": datasetSummaryPercentText(
3065
+ readCount(raw.skipped),
3066
+ denominator
3067
+ ),
3068
+ "skipped:missed": datasetSummaryPercentText(readCount(raw.missed), denominator),
3069
+ failed: datasetSummaryPercentText(readCount(raw.failed), denominator)
3070
+ };
3071
+ }
3072
+
3073
+ // src/cli/dataset-stats.ts
3047
3074
  var CSV_PROJECTED_FIELDS_KEY = "__deeplineCsvProjectedFields";
3048
3075
  function csvProjectedFields(row) {
3049
3076
  const serialized = row[CSV_PROJECTED_FIELDS_KEY];
@@ -3124,9 +3151,6 @@ function rowArray(value) {
3124
3151
  function readNumber(value) {
3125
3152
  return typeof value === "number" && Number.isFinite(value) && value >= 0 ? Math.trunc(value) : null;
3126
3153
  }
3127
- function numericStat(value) {
3128
- return readNumber(value) ?? 0;
3129
- }
3130
3154
  function inferColumns(rows) {
3131
3155
  const columns = [];
3132
3156
  const seen = /* @__PURE__ */ new Set();
@@ -3290,7 +3314,7 @@ function extractCanonicalRowsInfo(statusOrResult) {
3290
3314
  return collectCanonicalRowsInfos(statusOrResult)[0] ?? null;
3291
3315
  }
3292
3316
  function percentText(numerator, denominator) {
3293
- return denominator > 0 ? `${numerator}/${denominator} (${Math.round(100 * numerator / denominator)}%)` : "0/0 (0%)";
3317
+ return datasetSummaryPercentText(numerator, denominator);
3294
3318
  }
3295
3319
  function isDatasetExecutionStatsInput(value) {
3296
3320
  return isRecord2(value) && isRecord2(value.columnStats) && Object.values(value.columnStats).every(isRecord2);
@@ -3306,17 +3330,6 @@ function extractDatasetExecutionStats(statusOrResult) {
3306
3330
  const nested = isRecord2(statusOrResult.result) ? statusOrResult.result.dataset_execution_stats : null;
3307
3331
  return isDatasetExecutionStatsInput(nested) ? nested : null;
3308
3332
  }
3309
- function formatExecutionStats(raw, denominator) {
3310
- return {
3311
- queued: percentText(numericStat(raw.queued), denominator),
3312
- running: percentText(numericStat(raw.running), denominator),
3313
- "completed:executed": percentText(numericStat(raw.completed), denominator),
3314
- "completed:reused": percentText(numericStat(raw.cached), denominator),
3315
- "skipped:condition": percentText(numericStat(raw.skipped), denominator),
3316
- "skipped:missed": percentText(numericStat(raw.missed), denominator),
3317
- failed: percentText(numericStat(raw.failed), denominator)
3318
- };
3319
- }
3320
3333
  function countPercentText(count, denominator) {
3321
3334
  return denominator > 0 ? `${count} (${Math.round(100 * count / denominator)}%)` : "0 (0%)";
3322
3335
  }
@@ -3439,7 +3452,7 @@ function buildDatasetStats(rows, totalRows = rows.length, columns = inferColumns
3439
3452
  };
3440
3453
  const rawExecutionStats = executionStats?.columnStats[column];
3441
3454
  if (rawExecutionStats) {
3442
- stat3.execution = formatExecutionStats(rawExecutionStats, totalRows);
3455
+ stat3.execution = formatDatasetExecutionStats(rawExecutionStats, totalRows);
3443
3456
  }
3444
3457
  if (sampleValue !== void 0 && sampleValueType) {
3445
3458
  stat3.sample_value = sampleValue;
@@ -8677,7 +8690,7 @@ function isDatasetHandle(value) {
8677
8690
  value && typeof value === "object" && !Array.isArray(value) && value.kind === "dataset"
8678
8691
  );
8679
8692
  }
8680
- function collectDatasetHandleLines(value, path = "result") {
8693
+ function collectDatasetHandleLines(value, path = "result", datasetStats) {
8681
8694
  if (!value || typeof value !== "object" || Array.isArray(value)) {
8682
8695
  return [];
8683
8696
  }
@@ -8688,6 +8701,9 @@ function collectDatasetHandleLines(value, path = "result") {
8688
8701
  const lines2 = [
8689
8702
  ` dataset ${typeof record.path === "string" ? record.path : path}: rows=${count === null ? "-" : formatInteger(count)} preview=${formatInteger(preview.length)}`
8690
8703
  ];
8704
+ if (datasetStats && (datasetStats.source === path || datasetStats.source === record.path)) {
8705
+ lines2.push(...formatDatasetStatsLines(datasetStats.stats, " "));
8706
+ }
8691
8707
  if (typeof record.queryDatasetCommand === "string") {
8692
8708
  lines2.push(` query dataset: ${record.queryDatasetCommand}`);
8693
8709
  }
@@ -8701,7 +8717,9 @@ function collectDatasetHandleLines(value, path = "result") {
8701
8717
  if (key === "preview" || key === "access") {
8702
8718
  continue;
8703
8719
  }
8704
- lines.push(...collectDatasetHandleLines(child, `${path}.${key}`));
8720
+ lines.push(
8721
+ ...collectDatasetHandleLines(child, `${path}.${key}`, datasetStats)
8722
+ );
8705
8723
  }
8706
8724
  return lines;
8707
8725
  }
@@ -9060,13 +9078,26 @@ function compactPlayStatus(status) {
9060
9078
  };
9061
9079
  }
9062
9080
  function enrichPlayStatusWithDatasetStats(status) {
9063
- const rowsInfo = extractCanonicalRowsInfo(status);
9064
- if (!rowsInfo?.complete) {
9081
+ const datasetStats = datasetStatsForStatus(status);
9082
+ if (!datasetStats) {
9065
9083
  return status;
9066
9084
  }
9067
9085
  return {
9068
9086
  ...status,
9069
- dataset_stats: buildDatasetStats(
9087
+ result: attachDatasetStatsToResult(
9088
+ status.result,
9089
+ datasetStats
9090
+ )
9091
+ };
9092
+ }
9093
+ function datasetStatsForStatus(status) {
9094
+ const rowsInfo = extractCanonicalRowsInfo(status);
9095
+ if (!rowsInfo?.complete) {
9096
+ return null;
9097
+ }
9098
+ return {
9099
+ source: rowsInfo.source,
9100
+ stats: buildDatasetStats(
9070
9101
  rowsInfo.rows,
9071
9102
  rowsInfo.totalRows,
9072
9103
  rowsInfo.columns,
@@ -9074,6 +9105,52 @@ function enrichPlayStatusWithDatasetStats(status) {
9074
9105
  )
9075
9106
  };
9076
9107
  }
9108
+ function attachDatasetStatsToResult(result, datasetStats) {
9109
+ if (!result || typeof result !== "object" || Array.isArray(result)) {
9110
+ return result;
9111
+ }
9112
+ const sourcePath = datasetStats.source?.replace(/^result\.?/, "") ?? "";
9113
+ const attach = (value, path) => {
9114
+ if (!value || typeof value !== "object" || Array.isArray(value)) {
9115
+ return value;
9116
+ }
9117
+ const record = value;
9118
+ const isMatchingDataset = record.kind === "dataset" && (path === sourcePath || `result.${path}` === datasetStats.source);
9119
+ const next = { ...record };
9120
+ if (isMatchingDataset) {
9121
+ next.summary = datasetStats.stats;
9122
+ return next;
9123
+ }
9124
+ for (const [key, child] of Object.entries(record)) {
9125
+ if (key === "preview" || key === "access") continue;
9126
+ const childPath = path ? `${path}.${key}` : key;
9127
+ const attached = attach(child, childPath);
9128
+ if (attached !== child) {
9129
+ next[key] = attached;
9130
+ }
9131
+ }
9132
+ return next;
9133
+ };
9134
+ return attach(result, "");
9135
+ }
9136
+ function formatDatasetStatsLines(datasetStats, indent = " ") {
9137
+ if (!datasetStats) {
9138
+ return [];
9139
+ }
9140
+ const lines = [`${indent}summary:`];
9141
+ for (const [column, stat3] of Object.entries(datasetStats.columnStats).slice(
9142
+ 0,
9143
+ 12
9144
+ )) {
9145
+ const topValues = stat3.top_values ? `, top_values=${Object.entries(stat3.top_values).slice(0, 3).map(([value, count]) => `${value}=${count}`).join(", ")}` : "";
9146
+ const sample = stat3.sample_value !== void 0 ? `, sample_value=${JSON.stringify(stat3.sample_value)}` : "";
9147
+ const execution = stat3.execution ? `, execution=${Object.entries(stat3.execution).map(([bucket, count]) => `${bucket}=${count}`).join(", ")}` : "";
9148
+ lines.push(
9149
+ `${indent} ${column}: non_empty=${stat3.non_empty}, unique=${stat3.unique}${topValues}${sample}${execution}`
9150
+ );
9151
+ }
9152
+ return lines;
9153
+ }
9077
9154
  function readRunPackageRun(packaged) {
9078
9155
  return packaged.run && typeof packaged.run === "object" && !Array.isArray(packaged.run) ? packaged.run : {};
9079
9156
  }
@@ -9082,6 +9159,60 @@ function readRecordArray(value) {
9082
9159
  (item) => item !== null && typeof item === "object" && !Array.isArray(item)
9083
9160
  ) : [];
9084
9161
  }
9162
+ function readRecord(value) {
9163
+ return value && typeof value === "object" && !Array.isArray(value) ? value : null;
9164
+ }
9165
+ function formatSummaryScalar(value) {
9166
+ if (typeof value === "number") {
9167
+ return Number.isFinite(value) ? formatInteger(Math.trunc(value)) : null;
9168
+ }
9169
+ if (typeof value === "string" || typeof value === "boolean") {
9170
+ return String(value);
9171
+ }
9172
+ if (value === null) {
9173
+ return "null";
9174
+ }
9175
+ return null;
9176
+ }
9177
+ function formatSummaryScalarParts(record, skipKeys = /* @__PURE__ */ new Set()) {
9178
+ const parts = [];
9179
+ for (const [key, value] of Object.entries(record)) {
9180
+ if (skipKeys.has(key)) {
9181
+ continue;
9182
+ }
9183
+ const formatted = formatSummaryScalar(value);
9184
+ if (formatted !== null) {
9185
+ parts.push(`${key}=${formatted}`);
9186
+ }
9187
+ }
9188
+ return parts;
9189
+ }
9190
+ function formatPackageDatasetSummaryLines(summary, indent = " ") {
9191
+ const record = readRecord(summary);
9192
+ const columnStats = readRecord(record?.columnStats);
9193
+ if (!record || !columnStats) {
9194
+ return [];
9195
+ }
9196
+ const lines = [];
9197
+ const parts = formatSummaryScalarParts(record, /* @__PURE__ */ new Set(["columnStats"]));
9198
+ if (parts.length > 0) {
9199
+ lines.push(`${indent}summary: ${parts.join(" ")}`);
9200
+ }
9201
+ for (const [column, rawColumnSummary] of Object.entries(columnStats)) {
9202
+ const columnSummary = readRecord(rawColumnSummary);
9203
+ if (!columnSummary) continue;
9204
+ const execution = readRecord(columnSummary.execution);
9205
+ const executionText = execution ? Object.entries(execution).map(([bucket, value]) => `${bucket}=${String(value)}`).join(", ") : "";
9206
+ const columnParts = [
9207
+ ...formatSummaryScalarParts(columnSummary, /* @__PURE__ */ new Set(["execution"])),
9208
+ executionText ? `execution=${executionText}` : null
9209
+ ].filter(Boolean);
9210
+ if (columnParts.length > 0) {
9211
+ lines.push(`${indent} ${column}: ${columnParts.join(" ")}`);
9212
+ }
9213
+ }
9214
+ return lines;
9215
+ }
9085
9216
  function actionToCommand(action) {
9086
9217
  if (!action || typeof action !== "object" || Array.isArray(action)) {
9087
9218
  return null;
@@ -9130,8 +9261,11 @@ function buildRunPackageTextLines(packaged) {
9130
9261
  const rowCount = output && typeof output.rowCount === "number" ? ` rows=${formatInteger(output.rowCount)}` : "";
9131
9262
  const preview = output?.preview && typeof output.preview === "object" && !Array.isArray(output.preview) ? output.preview : null;
9132
9263
  const previewRows = Array.isArray(preview?.rows) ? preview.rows.length : null;
9133
- const previewLabel = previewRows !== null ? ` preview=${previewRows}${preview?.truncated ? " truncated" : ""}` : "";
9134
- lines.push(` ${kind} ${id}: ${stepStatus}${rowCount}${previewLabel}`);
9264
+ lines.push(` ${kind} ${id}: ${stepStatus}${rowCount}`);
9265
+ lines.push(...formatPackageDatasetSummaryLines(output?.summary));
9266
+ if (previewRows !== null) {
9267
+ lines.push(` preview=${previewRows}${preview?.truncated ? " truncated" : ""}`);
9268
+ }
9135
9269
  }
9136
9270
  const next = packaged.next && typeof packaged.next === "object" && !Array.isArray(packaged.next) ? packaged.next : {};
9137
9271
  const datasetActions = readFirstDatasetActions(packaged);
@@ -9145,8 +9279,13 @@ function buildRunPackageTextLines(packaged) {
9145
9279
  }
9146
9280
  function writePlayResult(status, jsonOutput, options) {
9147
9281
  const packaged = getPlayRunPackage(status);
9282
+ const datasetStats = datasetStatsForStatus(status);
9148
9283
  if (jsonOutput) {
9149
- const payload2 = options?.fullJson ? status : compactPlayStatus(status);
9284
+ const compact2 = compactPlayStatus(status);
9285
+ const payload2 = options?.fullJson ? enrichPlayStatusWithDatasetStats(status) : datasetStats ? {
9286
+ ...compact2,
9287
+ result: attachDatasetStatsToResult(compact2.result, datasetStats)
9288
+ } : compact2;
9150
9289
  printCommandEnvelope(payload2, { json: true });
9151
9290
  return;
9152
9291
  }
@@ -9182,13 +9321,17 @@ function writePlayResult(status, jsonOutput, options) {
9182
9321
  const renderedServerView = renderServerResultView(status.resultView);
9183
9322
  if (result) {
9184
9323
  lines.push(...formatReturnValue(result));
9185
- lines.push(...collectDatasetHandleLines(result));
9324
+ lines.push(...collectDatasetHandleLines(result, "result", datasetStats));
9186
9325
  }
9187
9326
  if (renderedServerView.lines.length > 0) {
9188
9327
  lines.push(...renderedServerView.lines);
9189
9328
  }
9190
9329
  lines.push(...renderedServerView.actions);
9191
- const payload = options?.fullJson ? enrichPlayStatusWithDatasetStats(status) : compactPlayStatus(status);
9330
+ const compact = compactPlayStatus(status);
9331
+ const payload = options?.fullJson ? enrichPlayStatusWithDatasetStats(status) : datasetStats ? {
9332
+ ...compact,
9333
+ result: attachDatasetStatsToResult(compact.result, datasetStats)
9334
+ } : compact;
9192
9335
  printCommandEnvelope(
9193
9336
  {
9194
9337
  ...payload,
@@ -9201,19 +9344,19 @@ function writePlayResult(status, jsonOutput, options) {
9201
9344
  );
9202
9345
  }
9203
9346
  async function resolvePlayRunOutputStatus(input) {
9204
- if (!input.fullJson || !getPlayRunPackage(input.status)) {
9347
+ if (!getPlayRunPackage(input.status)) {
9205
9348
  return input.status;
9206
9349
  }
9207
9350
  const runId = input.status.runId;
9208
9351
  if (!runId) {
9209
9352
  return input.status;
9210
9353
  }
9211
- const fullStatus = await input.client.getPlayStatus(runId, {
9354
+ const refreshedStatus = await input.client.getPlayStatus(runId, {
9212
9355
  billing: false,
9213
- full: true
9356
+ full: input.fullJson
9214
9357
  });
9215
9358
  const dashboardUrl = input.status.dashboardUrl;
9216
- return typeof dashboardUrl === "string" ? { ...fullStatus, dashboardUrl } : fullStatus;
9359
+ return typeof dashboardUrl === "string" ? { ...refreshedStatus, dashboardUrl } : refreshedStatus;
9217
9360
  }
9218
9361
  var RUN_EXPORT_PAGE_SIZE = 5e3;
9219
9362
  function shellSingleQuote(value) {
@@ -10721,20 +10864,8 @@ async function handlePlayVersions(args) {
10721
10864
  }
10722
10865
  async function handlePlayList(args) {
10723
10866
  const jsonOutput = argsWantJson(args);
10724
- const originArgIndex = args.findIndex((arg) => arg === "--origin");
10725
- const rawOrigin = originArgIndex >= 0 ? args[originArgIndex + 1] : void 0;
10726
- if (rawOrigin && rawOrigin !== "prebuilt" && rawOrigin !== "owned") {
10727
- throw new Error(`Invalid value for --origin: ${rawOrigin}`);
10728
- }
10729
- const origin = rawOrigin;
10730
10867
  const client = new DeeplineClient();
10731
- const plays = (await client.listPlays({
10732
- ...origin ? { origin } : {}
10733
- })).filter((play) => {
10734
- if (!origin) return true;
10735
- const isPrebuilt = play.origin === "prebuilt" || play.ownerType === "deepline";
10736
- return origin === "prebuilt" ? isPrebuilt : !isPrebuilt;
10737
- });
10868
+ const plays = await client.listPlays();
10738
10869
  if (jsonOutput) {
10739
10870
  process.stdout.write(`${JSON.stringify(plays)}
10740
10871
  `);
@@ -11313,12 +11444,10 @@ Notes:
11313
11444
 
11314
11445
  Examples:
11315
11446
  deepline plays list
11316
- deepline plays list --origin prebuilt --json
11317
11447
  deepline plays search email --json
11318
11448
  `
11319
- ).option("--origin <origin>", "Filter to prebuilt or owned plays").option("--json", "Emit JSON output. Also automatic when stdout is piped").action(async (options) => {
11449
+ ).option("--json", "Emit JSON output. Also automatic when stdout is piped").action(async (options) => {
11320
11450
  process.exitCode = await handlePlayList([
11321
- ...options.origin ? ["--origin", options.origin] : [],
11322
11451
  ...options.json ? ["--json"] : []
11323
11452
  ]);
11324
11453
  });
@@ -13674,6 +13803,6 @@ Examples:
13674
13803
  }
13675
13804
  process.exitCode = 1;
13676
13805
  }
13677
- process.exit(process.exitCode ?? 0);
13806
+ process.exitCode = process.exitCode ?? 0;
13678
13807
  }
13679
13808
  main();
@@ -197,10 +197,10 @@ function resolveConfig(options) {
197
197
 
198
198
  // src/release.ts
199
199
  var SDK_RELEASE = {
200
- version: "0.1.58",
201
- apiContract: "2026-05-play-tool-describe-starters",
200
+ version: "0.1.59",
201
+ apiContract: "2026-05-play-bootstrap-dataset-summary",
202
202
  supportPolicy: {
203
- latest: "0.1.58",
203
+ latest: "0.1.59",
204
204
  minimumSupported: "0.1.53",
205
205
  deprecatedBelow: "0.1.53"
206
206
  }
@@ -3026,6 +3026,33 @@ Examples:
3026
3026
  // src/cli/dataset-stats.ts
3027
3027
  import { writeFileSync as writeFileSync4 } from "fs";
3028
3028
  import { resolve as resolve4 } from "path";
3029
+
3030
+ // ../shared_libs/plays/dataset-summary.ts
3031
+ function datasetSummaryPercentText(numerator, denominator) {
3032
+ return denominator > 0 ? `${numerator}/${denominator} (${Math.round(100 * numerator / denominator)}%)` : "0/0 (0%)";
3033
+ }
3034
+ function readCount(value) {
3035
+ return typeof value === "number" && Number.isFinite(value) && value >= 0 ? Math.trunc(value) : 0;
3036
+ }
3037
+ function formatDatasetExecutionStats(raw, denominator) {
3038
+ return {
3039
+ queued: datasetSummaryPercentText(readCount(raw.queued), denominator),
3040
+ running: datasetSummaryPercentText(readCount(raw.running), denominator),
3041
+ "completed:executed": datasetSummaryPercentText(
3042
+ readCount(raw.completed),
3043
+ denominator
3044
+ ),
3045
+ "completed:reused": datasetSummaryPercentText(readCount(raw.cached), denominator),
3046
+ "skipped:condition": datasetSummaryPercentText(
3047
+ readCount(raw.skipped),
3048
+ denominator
3049
+ ),
3050
+ "skipped:missed": datasetSummaryPercentText(readCount(raw.missed), denominator),
3051
+ failed: datasetSummaryPercentText(readCount(raw.failed), denominator)
3052
+ };
3053
+ }
3054
+
3055
+ // src/cli/dataset-stats.ts
3029
3056
  var CSV_PROJECTED_FIELDS_KEY = "__deeplineCsvProjectedFields";
3030
3057
  function csvProjectedFields(row) {
3031
3058
  const serialized = row[CSV_PROJECTED_FIELDS_KEY];
@@ -3106,9 +3133,6 @@ function rowArray(value) {
3106
3133
  function readNumber(value) {
3107
3134
  return typeof value === "number" && Number.isFinite(value) && value >= 0 ? Math.trunc(value) : null;
3108
3135
  }
3109
- function numericStat(value) {
3110
- return readNumber(value) ?? 0;
3111
- }
3112
3136
  function inferColumns(rows) {
3113
3137
  const columns = [];
3114
3138
  const seen = /* @__PURE__ */ new Set();
@@ -3272,7 +3296,7 @@ function extractCanonicalRowsInfo(statusOrResult) {
3272
3296
  return collectCanonicalRowsInfos(statusOrResult)[0] ?? null;
3273
3297
  }
3274
3298
  function percentText(numerator, denominator) {
3275
- return denominator > 0 ? `${numerator}/${denominator} (${Math.round(100 * numerator / denominator)}%)` : "0/0 (0%)";
3299
+ return datasetSummaryPercentText(numerator, denominator);
3276
3300
  }
3277
3301
  function isDatasetExecutionStatsInput(value) {
3278
3302
  return isRecord2(value) && isRecord2(value.columnStats) && Object.values(value.columnStats).every(isRecord2);
@@ -3288,17 +3312,6 @@ function extractDatasetExecutionStats(statusOrResult) {
3288
3312
  const nested = isRecord2(statusOrResult.result) ? statusOrResult.result.dataset_execution_stats : null;
3289
3313
  return isDatasetExecutionStatsInput(nested) ? nested : null;
3290
3314
  }
3291
- function formatExecutionStats(raw, denominator) {
3292
- return {
3293
- queued: percentText(numericStat(raw.queued), denominator),
3294
- running: percentText(numericStat(raw.running), denominator),
3295
- "completed:executed": percentText(numericStat(raw.completed), denominator),
3296
- "completed:reused": percentText(numericStat(raw.cached), denominator),
3297
- "skipped:condition": percentText(numericStat(raw.skipped), denominator),
3298
- "skipped:missed": percentText(numericStat(raw.missed), denominator),
3299
- failed: percentText(numericStat(raw.failed), denominator)
3300
- };
3301
- }
3302
3315
  function countPercentText(count, denominator) {
3303
3316
  return denominator > 0 ? `${count} (${Math.round(100 * count / denominator)}%)` : "0 (0%)";
3304
3317
  }
@@ -3421,7 +3434,7 @@ function buildDatasetStats(rows, totalRows = rows.length, columns = inferColumns
3421
3434
  };
3422
3435
  const rawExecutionStats = executionStats?.columnStats[column];
3423
3436
  if (rawExecutionStats) {
3424
- stat3.execution = formatExecutionStats(rawExecutionStats, totalRows);
3437
+ stat3.execution = formatDatasetExecutionStats(rawExecutionStats, totalRows);
3425
3438
  }
3426
3439
  if (sampleValue !== void 0 && sampleValueType) {
3427
3440
  stat3.sample_value = sampleValue;
@@ -8671,7 +8684,7 @@ function isDatasetHandle(value) {
8671
8684
  value && typeof value === "object" && !Array.isArray(value) && value.kind === "dataset"
8672
8685
  );
8673
8686
  }
8674
- function collectDatasetHandleLines(value, path = "result") {
8687
+ function collectDatasetHandleLines(value, path = "result", datasetStats) {
8675
8688
  if (!value || typeof value !== "object" || Array.isArray(value)) {
8676
8689
  return [];
8677
8690
  }
@@ -8682,6 +8695,9 @@ function collectDatasetHandleLines(value, path = "result") {
8682
8695
  const lines2 = [
8683
8696
  ` dataset ${typeof record.path === "string" ? record.path : path}: rows=${count === null ? "-" : formatInteger(count)} preview=${formatInteger(preview.length)}`
8684
8697
  ];
8698
+ if (datasetStats && (datasetStats.source === path || datasetStats.source === record.path)) {
8699
+ lines2.push(...formatDatasetStatsLines(datasetStats.stats, " "));
8700
+ }
8685
8701
  if (typeof record.queryDatasetCommand === "string") {
8686
8702
  lines2.push(` query dataset: ${record.queryDatasetCommand}`);
8687
8703
  }
@@ -8695,7 +8711,9 @@ function collectDatasetHandleLines(value, path = "result") {
8695
8711
  if (key === "preview" || key === "access") {
8696
8712
  continue;
8697
8713
  }
8698
- lines.push(...collectDatasetHandleLines(child, `${path}.${key}`));
8714
+ lines.push(
8715
+ ...collectDatasetHandleLines(child, `${path}.${key}`, datasetStats)
8716
+ );
8699
8717
  }
8700
8718
  return lines;
8701
8719
  }
@@ -9054,13 +9072,26 @@ function compactPlayStatus(status) {
9054
9072
  };
9055
9073
  }
9056
9074
  function enrichPlayStatusWithDatasetStats(status) {
9057
- const rowsInfo = extractCanonicalRowsInfo(status);
9058
- if (!rowsInfo?.complete) {
9075
+ const datasetStats = datasetStatsForStatus(status);
9076
+ if (!datasetStats) {
9059
9077
  return status;
9060
9078
  }
9061
9079
  return {
9062
9080
  ...status,
9063
- dataset_stats: buildDatasetStats(
9081
+ result: attachDatasetStatsToResult(
9082
+ status.result,
9083
+ datasetStats
9084
+ )
9085
+ };
9086
+ }
9087
+ function datasetStatsForStatus(status) {
9088
+ const rowsInfo = extractCanonicalRowsInfo(status);
9089
+ if (!rowsInfo?.complete) {
9090
+ return null;
9091
+ }
9092
+ return {
9093
+ source: rowsInfo.source,
9094
+ stats: buildDatasetStats(
9064
9095
  rowsInfo.rows,
9065
9096
  rowsInfo.totalRows,
9066
9097
  rowsInfo.columns,
@@ -9068,6 +9099,52 @@ function enrichPlayStatusWithDatasetStats(status) {
9068
9099
  )
9069
9100
  };
9070
9101
  }
9102
+ function attachDatasetStatsToResult(result, datasetStats) {
9103
+ if (!result || typeof result !== "object" || Array.isArray(result)) {
9104
+ return result;
9105
+ }
9106
+ const sourcePath = datasetStats.source?.replace(/^result\.?/, "") ?? "";
9107
+ const attach = (value, path) => {
9108
+ if (!value || typeof value !== "object" || Array.isArray(value)) {
9109
+ return value;
9110
+ }
9111
+ const record = value;
9112
+ const isMatchingDataset = record.kind === "dataset" && (path === sourcePath || `result.${path}` === datasetStats.source);
9113
+ const next = { ...record };
9114
+ if (isMatchingDataset) {
9115
+ next.summary = datasetStats.stats;
9116
+ return next;
9117
+ }
9118
+ for (const [key, child] of Object.entries(record)) {
9119
+ if (key === "preview" || key === "access") continue;
9120
+ const childPath = path ? `${path}.${key}` : key;
9121
+ const attached = attach(child, childPath);
9122
+ if (attached !== child) {
9123
+ next[key] = attached;
9124
+ }
9125
+ }
9126
+ return next;
9127
+ };
9128
+ return attach(result, "");
9129
+ }
9130
+ function formatDatasetStatsLines(datasetStats, indent = " ") {
9131
+ if (!datasetStats) {
9132
+ return [];
9133
+ }
9134
+ const lines = [`${indent}summary:`];
9135
+ for (const [column, stat3] of Object.entries(datasetStats.columnStats).slice(
9136
+ 0,
9137
+ 12
9138
+ )) {
9139
+ const topValues = stat3.top_values ? `, top_values=${Object.entries(stat3.top_values).slice(0, 3).map(([value, count]) => `${value}=${count}`).join(", ")}` : "";
9140
+ const sample = stat3.sample_value !== void 0 ? `, sample_value=${JSON.stringify(stat3.sample_value)}` : "";
9141
+ const execution = stat3.execution ? `, execution=${Object.entries(stat3.execution).map(([bucket, count]) => `${bucket}=${count}`).join(", ")}` : "";
9142
+ lines.push(
9143
+ `${indent} ${column}: non_empty=${stat3.non_empty}, unique=${stat3.unique}${topValues}${sample}${execution}`
9144
+ );
9145
+ }
9146
+ return lines;
9147
+ }
9071
9148
  function readRunPackageRun(packaged) {
9072
9149
  return packaged.run && typeof packaged.run === "object" && !Array.isArray(packaged.run) ? packaged.run : {};
9073
9150
  }
@@ -9076,6 +9153,60 @@ function readRecordArray(value) {
9076
9153
  (item) => item !== null && typeof item === "object" && !Array.isArray(item)
9077
9154
  ) : [];
9078
9155
  }
9156
+ function readRecord(value) {
9157
+ return value && typeof value === "object" && !Array.isArray(value) ? value : null;
9158
+ }
9159
+ function formatSummaryScalar(value) {
9160
+ if (typeof value === "number") {
9161
+ return Number.isFinite(value) ? formatInteger(Math.trunc(value)) : null;
9162
+ }
9163
+ if (typeof value === "string" || typeof value === "boolean") {
9164
+ return String(value);
9165
+ }
9166
+ if (value === null) {
9167
+ return "null";
9168
+ }
9169
+ return null;
9170
+ }
9171
+ function formatSummaryScalarParts(record, skipKeys = /* @__PURE__ */ new Set()) {
9172
+ const parts = [];
9173
+ for (const [key, value] of Object.entries(record)) {
9174
+ if (skipKeys.has(key)) {
9175
+ continue;
9176
+ }
9177
+ const formatted = formatSummaryScalar(value);
9178
+ if (formatted !== null) {
9179
+ parts.push(`${key}=${formatted}`);
9180
+ }
9181
+ }
9182
+ return parts;
9183
+ }
9184
+ function formatPackageDatasetSummaryLines(summary, indent = " ") {
9185
+ const record = readRecord(summary);
9186
+ const columnStats = readRecord(record?.columnStats);
9187
+ if (!record || !columnStats) {
9188
+ return [];
9189
+ }
9190
+ const lines = [];
9191
+ const parts = formatSummaryScalarParts(record, /* @__PURE__ */ new Set(["columnStats"]));
9192
+ if (parts.length > 0) {
9193
+ lines.push(`${indent}summary: ${parts.join(" ")}`);
9194
+ }
9195
+ for (const [column, rawColumnSummary] of Object.entries(columnStats)) {
9196
+ const columnSummary = readRecord(rawColumnSummary);
9197
+ if (!columnSummary) continue;
9198
+ const execution = readRecord(columnSummary.execution);
9199
+ const executionText = execution ? Object.entries(execution).map(([bucket, value]) => `${bucket}=${String(value)}`).join(", ") : "";
9200
+ const columnParts = [
9201
+ ...formatSummaryScalarParts(columnSummary, /* @__PURE__ */ new Set(["execution"])),
9202
+ executionText ? `execution=${executionText}` : null
9203
+ ].filter(Boolean);
9204
+ if (columnParts.length > 0) {
9205
+ lines.push(`${indent} ${column}: ${columnParts.join(" ")}`);
9206
+ }
9207
+ }
9208
+ return lines;
9209
+ }
9079
9210
  function actionToCommand(action) {
9080
9211
  if (!action || typeof action !== "object" || Array.isArray(action)) {
9081
9212
  return null;
@@ -9124,8 +9255,11 @@ function buildRunPackageTextLines(packaged) {
9124
9255
  const rowCount = output && typeof output.rowCount === "number" ? ` rows=${formatInteger(output.rowCount)}` : "";
9125
9256
  const preview = output?.preview && typeof output.preview === "object" && !Array.isArray(output.preview) ? output.preview : null;
9126
9257
  const previewRows = Array.isArray(preview?.rows) ? preview.rows.length : null;
9127
- const previewLabel = previewRows !== null ? ` preview=${previewRows}${preview?.truncated ? " truncated" : ""}` : "";
9128
- lines.push(` ${kind} ${id}: ${stepStatus}${rowCount}${previewLabel}`);
9258
+ lines.push(` ${kind} ${id}: ${stepStatus}${rowCount}`);
9259
+ lines.push(...formatPackageDatasetSummaryLines(output?.summary));
9260
+ if (previewRows !== null) {
9261
+ lines.push(` preview=${previewRows}${preview?.truncated ? " truncated" : ""}`);
9262
+ }
9129
9263
  }
9130
9264
  const next = packaged.next && typeof packaged.next === "object" && !Array.isArray(packaged.next) ? packaged.next : {};
9131
9265
  const datasetActions = readFirstDatasetActions(packaged);
@@ -9139,8 +9273,13 @@ function buildRunPackageTextLines(packaged) {
9139
9273
  }
9140
9274
  function writePlayResult(status, jsonOutput, options) {
9141
9275
  const packaged = getPlayRunPackage(status);
9276
+ const datasetStats = datasetStatsForStatus(status);
9142
9277
  if (jsonOutput) {
9143
- const payload2 = options?.fullJson ? status : compactPlayStatus(status);
9278
+ const compact2 = compactPlayStatus(status);
9279
+ const payload2 = options?.fullJson ? enrichPlayStatusWithDatasetStats(status) : datasetStats ? {
9280
+ ...compact2,
9281
+ result: attachDatasetStatsToResult(compact2.result, datasetStats)
9282
+ } : compact2;
9144
9283
  printCommandEnvelope(payload2, { json: true });
9145
9284
  return;
9146
9285
  }
@@ -9176,13 +9315,17 @@ function writePlayResult(status, jsonOutput, options) {
9176
9315
  const renderedServerView = renderServerResultView(status.resultView);
9177
9316
  if (result) {
9178
9317
  lines.push(...formatReturnValue(result));
9179
- lines.push(...collectDatasetHandleLines(result));
9318
+ lines.push(...collectDatasetHandleLines(result, "result", datasetStats));
9180
9319
  }
9181
9320
  if (renderedServerView.lines.length > 0) {
9182
9321
  lines.push(...renderedServerView.lines);
9183
9322
  }
9184
9323
  lines.push(...renderedServerView.actions);
9185
- const payload = options?.fullJson ? enrichPlayStatusWithDatasetStats(status) : compactPlayStatus(status);
9324
+ const compact = compactPlayStatus(status);
9325
+ const payload = options?.fullJson ? enrichPlayStatusWithDatasetStats(status) : datasetStats ? {
9326
+ ...compact,
9327
+ result: attachDatasetStatsToResult(compact.result, datasetStats)
9328
+ } : compact;
9186
9329
  printCommandEnvelope(
9187
9330
  {
9188
9331
  ...payload,
@@ -9195,19 +9338,19 @@ function writePlayResult(status, jsonOutput, options) {
9195
9338
  );
9196
9339
  }
9197
9340
  async function resolvePlayRunOutputStatus(input) {
9198
- if (!input.fullJson || !getPlayRunPackage(input.status)) {
9341
+ if (!getPlayRunPackage(input.status)) {
9199
9342
  return input.status;
9200
9343
  }
9201
9344
  const runId = input.status.runId;
9202
9345
  if (!runId) {
9203
9346
  return input.status;
9204
9347
  }
9205
- const fullStatus = await input.client.getPlayStatus(runId, {
9348
+ const refreshedStatus = await input.client.getPlayStatus(runId, {
9206
9349
  billing: false,
9207
- full: true
9350
+ full: input.fullJson
9208
9351
  });
9209
9352
  const dashboardUrl = input.status.dashboardUrl;
9210
- return typeof dashboardUrl === "string" ? { ...fullStatus, dashboardUrl } : fullStatus;
9353
+ return typeof dashboardUrl === "string" ? { ...refreshedStatus, dashboardUrl } : refreshedStatus;
9211
9354
  }
9212
9355
  var RUN_EXPORT_PAGE_SIZE = 5e3;
9213
9356
  function shellSingleQuote(value) {
@@ -10715,20 +10858,8 @@ async function handlePlayVersions(args) {
10715
10858
  }
10716
10859
  async function handlePlayList(args) {
10717
10860
  const jsonOutput = argsWantJson(args);
10718
- const originArgIndex = args.findIndex((arg) => arg === "--origin");
10719
- const rawOrigin = originArgIndex >= 0 ? args[originArgIndex + 1] : void 0;
10720
- if (rawOrigin && rawOrigin !== "prebuilt" && rawOrigin !== "owned") {
10721
- throw new Error(`Invalid value for --origin: ${rawOrigin}`);
10722
- }
10723
- const origin = rawOrigin;
10724
10861
  const client = new DeeplineClient();
10725
- const plays = (await client.listPlays({
10726
- ...origin ? { origin } : {}
10727
- })).filter((play) => {
10728
- if (!origin) return true;
10729
- const isPrebuilt = play.origin === "prebuilt" || play.ownerType === "deepline";
10730
- return origin === "prebuilt" ? isPrebuilt : !isPrebuilt;
10731
- });
10862
+ const plays = await client.listPlays();
10732
10863
  if (jsonOutput) {
10733
10864
  process.stdout.write(`${JSON.stringify(plays)}
10734
10865
  `);
@@ -11307,12 +11438,10 @@ Notes:
11307
11438
 
11308
11439
  Examples:
11309
11440
  deepline plays list
11310
- deepline plays list --origin prebuilt --json
11311
11441
  deepline plays search email --json
11312
11442
  `
11313
- ).option("--origin <origin>", "Filter to prebuilt or owned plays").option("--json", "Emit JSON output. Also automatic when stdout is piped").action(async (options) => {
11443
+ ).option("--json", "Emit JSON output. Also automatic when stdout is piped").action(async (options) => {
11314
11444
  process.exitCode = await handlePlayList([
11315
- ...options.origin ? ["--origin", options.origin] : [],
11316
11445
  ...options.json ? ["--json"] : []
11317
11446
  ]);
11318
11447
  });
@@ -13668,6 +13797,6 @@ Examples:
13668
13797
  }
13669
13798
  process.exitCode = 1;
13670
13799
  }
13671
- process.exit(process.exitCode ?? 0);
13800
+ process.exitCode = process.exitCode ?? 0;
13672
13801
  }
13673
13802
  main();
package/dist/index.d.mts CHANGED
@@ -669,6 +669,7 @@ interface PlaySheetStats {
669
669
  running: number;
670
670
  completed: number;
671
671
  failed: number;
672
+ stale: number;
672
673
  }
673
674
  /**
674
675
  * Per-column processing stats within a play's sheet.
@@ -679,6 +680,8 @@ interface PlaySheetColumnStats {
679
680
  completed: number;
680
681
  failed: number;
681
682
  cached: number;
683
+ missed: number;
684
+ skipped: number;
682
685
  }
683
686
  /**
684
687
  * Summary of a play's data sheet state.
package/dist/index.d.ts CHANGED
@@ -669,6 +669,7 @@ interface PlaySheetStats {
669
669
  running: number;
670
670
  completed: number;
671
671
  failed: number;
672
+ stale: number;
672
673
  }
673
674
  /**
674
675
  * Per-column processing stats within a play's sheet.
@@ -679,6 +680,8 @@ interface PlaySheetColumnStats {
679
680
  completed: number;
680
681
  failed: number;
681
682
  cached: number;
683
+ missed: number;
684
+ skipped: number;
682
685
  }
683
686
  /**
684
687
  * Summary of a play's data sheet state.
package/dist/index.js CHANGED
@@ -232,10 +232,10 @@ function resolveConfig(options) {
232
232
 
233
233
  // src/release.ts
234
234
  var SDK_RELEASE = {
235
- version: "0.1.58",
236
- apiContract: "2026-05-play-tool-describe-starters",
235
+ version: "0.1.59",
236
+ apiContract: "2026-05-play-bootstrap-dataset-summary",
237
237
  supportPolicy: {
238
- latest: "0.1.58",
238
+ latest: "0.1.59",
239
239
  minimumSupported: "0.1.53",
240
240
  deprecatedBelow: "0.1.53"
241
241
  }
package/dist/index.mjs CHANGED
@@ -170,10 +170,10 @@ function resolveConfig(options) {
170
170
 
171
171
  // src/release.ts
172
172
  var SDK_RELEASE = {
173
- version: "0.1.58",
174
- apiContract: "2026-05-play-tool-describe-starters",
173
+ version: "0.1.59",
174
+ apiContract: "2026-05-play-bootstrap-dataset-summary",
175
175
  supportPolicy: {
176
- latest: "0.1.58",
176
+ latest: "0.1.59",
177
177
  minimumSupported: "0.1.53",
178
178
  deprecatedBelow: "0.1.53"
179
179
  }
@@ -50,10 +50,10 @@ export type SdkRelease = {
50
50
  };
51
51
 
52
52
  export const SDK_RELEASE = {
53
- version: '0.1.58',
54
- apiContract: '2026-05-play-tool-describe-starters',
53
+ version: '0.1.59',
54
+ apiContract: '2026-05-play-bootstrap-dataset-summary',
55
55
  supportPolicy: {
56
- latest: '0.1.58',
56
+ latest: '0.1.59',
57
57
  minimumSupported: '0.1.53',
58
58
  deprecatedBelow: '0.1.53',
59
59
  },
@@ -553,6 +553,7 @@ export interface PlaySheetStats {
553
553
  running: number;
554
554
  completed: number;
555
555
  failed: number;
556
+ stale: number;
556
557
  }
557
558
 
558
559
  /**
@@ -564,6 +565,8 @@ export interface PlaySheetColumnStats {
564
565
  completed: number;
565
566
  failed: number;
566
567
  cached: number;
568
+ missed: number;
569
+ skipped: number;
567
570
  }
568
571
 
569
572
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "deepline",
3
- "version": "0.1.58",
3
+ "version": "0.1.59",
4
4
  "description": "Deepline SDK + CLI — B2B data enrichment powered by durable cloud execution",
5
5
  "license": "MIT",
6
6
  "repository": {