deepline 0.1.167 → 0.1.169

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 (30) hide show
  1. package/dist/bundling-sources/apps/play-runner-workers/src/coordinator-entry.ts +317 -26
  2. package/dist/bundling-sources/apps/play-runner-workers/src/dedup-do.ts +99 -6
  3. package/dist/bundling-sources/apps/play-runner-workers/src/entry.ts +219 -73
  4. package/dist/bundling-sources/apps/play-runner-workers/src/runtime/map-chunk-plan.ts +119 -33
  5. package/dist/bundling-sources/apps/play-runner-workers/src/runtime/tool-receipts.ts +2 -0
  6. package/dist/bundling-sources/apps/play-runner-workers/src/workflow-instance-create.ts +3 -0
  7. package/dist/bundling-sources/sdk/src/client.ts +29 -1
  8. package/dist/bundling-sources/sdk/src/release.ts +2 -2
  9. package/dist/bundling-sources/sdk/src/types.ts +3 -0
  10. package/dist/bundling-sources/shared_libs/play-data-plane/column-names.ts +50 -8
  11. package/dist/bundling-sources/shared_libs/play-data-plane/sheet-contract.ts +40 -1
  12. package/dist/bundling-sources/shared_libs/play-runtime/app-runtime-api.ts +1 -0
  13. package/dist/bundling-sources/shared_libs/play-runtime/context.ts +3 -0
  14. package/dist/bundling-sources/shared_libs/play-runtime/ctx-types.ts +2 -0
  15. package/dist/bundling-sources/shared_libs/play-runtime/protocol.ts +1 -0
  16. package/dist/bundling-sources/shared_libs/play-runtime/runtime-api.ts +2 -0
  17. package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backend.ts +2 -0
  18. package/dist/bundling-sources/shared_libs/play-runtime/work-receipts.ts +1 -0
  19. package/dist/bundling-sources/shared_libs/plays/static-pipeline.ts +202 -45
  20. package/dist/cli/index.js +70 -113
  21. package/dist/cli/index.mjs +70 -113
  22. package/dist/{compiler-manifest-VhtM9n24.d.mts → compiler-manifest-OwORQ07f.d.mts} +1 -0
  23. package/dist/{compiler-manifest-VhtM9n24.d.ts → compiler-manifest-OwORQ07f.d.ts} +1 -0
  24. package/dist/index.d.mts +5 -1
  25. package/dist/index.d.ts +5 -1
  26. package/dist/index.js +26 -5
  27. package/dist/index.mjs +26 -5
  28. package/dist/plays/bundle-play-file.d.mts +2 -2
  29. package/dist/plays/bundle-play-file.d.ts +2 -2
  30. package/package.json +1 -1
package/dist/cli/index.js CHANGED
@@ -622,10 +622,10 @@ var SDK_RELEASE = {
622
622
  // 0.1.111 ships dataset-native tool list getters and result row datasets.
623
623
  // 0.1.154 removes the short-lived generated enrich StepOptions recompute
624
624
  // fields shipped in 0.1.153.
625
- version: "0.1.167",
625
+ version: "0.1.169",
626
626
  apiContract: "2026-06-dataset-handle-results-hard-cutover",
627
627
  supportPolicy: {
628
- latest: "0.1.167",
628
+ latest: "0.1.169",
629
629
  minimumSupported: "0.1.53",
630
630
  deprecatedBelow: "0.1.53",
631
631
  commandMinimumSupported: [
@@ -2111,6 +2111,17 @@ var COMPILE_MANIFEST_RETRY_DELAYS_MS = [250, 1e3];
2111
2111
  var REGISTER_PLAY_ARTIFACTS_COMPILE_CONCURRENCY = 3;
2112
2112
  var REGISTER_PLAY_ARTIFACTS_MAX_BATCH_COUNT = 3;
2113
2113
  var REGISTER_PLAY_ARTIFACTS_MAX_BATCH_BYTES = 25e5;
2114
+ function normalizePlayRunIntegrationMode(value) {
2115
+ if (value === "live" || value === "eval_stub" || value === "fixture") {
2116
+ return value;
2117
+ }
2118
+ return void 0;
2119
+ }
2120
+ function resolvePlayRunIntegrationMode(request) {
2121
+ return normalizePlayRunIntegrationMode(
2122
+ request.integrationMode ?? process.env.DEEPLINE_EVAL_INTEGRATION_MODE
2123
+ );
2124
+ }
2114
2125
  function sleep2(ms) {
2115
2126
  return new Promise((resolve14) => setTimeout(resolve14, ms));
2116
2127
  }
@@ -2658,6 +2669,7 @@ var DeeplineClient = class {
2658
2669
  * ```
2659
2670
  */
2660
2671
  async startPlayRun(request) {
2672
+ const integrationMode = resolvePlayRunIntegrationMode(request);
2661
2673
  const response = await this.http.post(
2662
2674
  "/api/v2/plays/run",
2663
2675
  {
@@ -2682,7 +2694,8 @@ var DeeplineClient = class {
2682
2694
  // Profile selection is the API's job, not the CLI's. The server
2683
2695
  // defaults to workers_edge; tests and runtime probes that want a
2684
2696
  // different profile pass `request.profile` explicitly.
2685
- ...request.profile ? { profile: request.profile } : {}
2697
+ ...request.profile ? { profile: request.profile } : {},
2698
+ ...integrationMode ? { integrationMode } : {}
2686
2699
  }
2687
2700
  );
2688
2701
  return normalizePlayRunStart(response);
@@ -2699,6 +2712,7 @@ var DeeplineClient = class {
2699
2712
  * @returns Async stream of play-scoped live events.
2700
2713
  */
2701
2714
  async *startPlayRunStream(request, options) {
2715
+ const integrationMode = resolvePlayRunIntegrationMode(request);
2702
2716
  const body = {
2703
2717
  ...request.name ? { name: request.name } : {},
2704
2718
  ...request.revisionId ? { revisionId: request.revisionId } : {},
@@ -2718,7 +2732,8 @@ var DeeplineClient = class {
2718
2732
  ...request.packagedFiles?.length ? { packagedFiles: request.packagedFiles } : {},
2719
2733
  ...request.force ? { force: true } : {},
2720
2734
  ...typeof request.waitForCompletionMs === "number" ? { waitForCompletionMs: request.waitForCompletionMs } : {},
2721
- ...request.profile ? { profile: request.profile } : {}
2735
+ ...request.profile ? { profile: request.profile } : {},
2736
+ ...integrationMode ? { integrationMode } : {}
2722
2737
  };
2723
2738
  for await (const event of this.http.streamSse(
2724
2739
  "/api/v2/plays/run?stream=true",
@@ -2835,7 +2850,13 @@ var DeeplineClient = class {
2835
2850
  * path used by `deepline plays check`.
2836
2851
  */
2837
2852
  async checkPlayArtifact(input2) {
2838
- return this.http.post("/api/v2/plays/check", input2);
2853
+ const integrationMode = normalizePlayRunIntegrationMode(
2854
+ input2.integrationMode ?? process.env.DEEPLINE_EVAL_INTEGRATION_MODE
2855
+ );
2856
+ return this.http.post("/api/v2/plays/check", {
2857
+ ...input2,
2858
+ ...integrationMode ? { integrationMode } : {}
2859
+ });
2839
2860
  }
2840
2861
  /**
2841
2862
  * Compile legacy enrich command arguments into a runtime plan.
@@ -6659,20 +6680,6 @@ function extractCanonicalRowsInfo(statusOrResult) {
6659
6680
  function percentText(numerator, denominator) {
6660
6681
  return datasetSummaryPercentText(numerator, denominator);
6661
6682
  }
6662
- function isDatasetExecutionStatsInput(value) {
6663
- return isRecord4(value) && isRecord4(value.columnStats) && Object.values(value.columnStats).every(isRecord4);
6664
- }
6665
- function extractDatasetExecutionStats(statusOrResult) {
6666
- if (!isRecord4(statusOrResult)) {
6667
- return null;
6668
- }
6669
- const direct = statusOrResult.dataset_execution_stats;
6670
- if (isDatasetExecutionStatsInput(direct)) {
6671
- return direct;
6672
- }
6673
- const nested = isRecord4(statusOrResult.result) ? statusOrResult.result.dataset_execution_stats : null;
6674
- return isDatasetExecutionStatsInput(nested) ? nested : null;
6675
- }
6676
6683
  function countPercentText(count, denominator) {
6677
6684
  return denominator > 0 ? `${count} (${Math.round(100 * count / denominator)}%)` : "0 (0%)";
6678
6685
  }
@@ -9722,6 +9729,13 @@ function extractDefinedPlayName(code) {
9722
9729
  }
9723
9730
  return null;
9724
9731
  }
9732
+ function resolveEvalIntegrationMode() {
9733
+ const mode = process.env.DEEPLINE_EVAL_INTEGRATION_MODE;
9734
+ if (mode === "live" || mode === "eval_stub" || mode === "fixture") {
9735
+ return mode;
9736
+ }
9737
+ return void 0;
9738
+ }
9725
9739
  var PLAY_RUN_RESERVED_BOOLEAN_FLAGS = /* @__PURE__ */ new Set([
9726
9740
  "--json",
9727
9741
  "--wait",
@@ -11520,7 +11534,7 @@ function isDatasetHandle(value) {
11520
11534
  value && typeof value === "object" && !Array.isArray(value) && value.kind === "dataset"
11521
11535
  );
11522
11536
  }
11523
- function collectDatasetHandleLines(value, path = "result", datasetStats) {
11537
+ function collectDatasetHandleLines(value, path = "result") {
11524
11538
  if (!value || typeof value !== "object" || Array.isArray(value)) {
11525
11539
  return [];
11526
11540
  }
@@ -11531,8 +11545,8 @@ function collectDatasetHandleLines(value, path = "result", datasetStats) {
11531
11545
  const lines2 = [
11532
11546
  ` dataset ${typeof record.path === "string" ? record.path : path}: rows=${count === null ? "-" : formatInteger(count)} preview=${formatInteger(preview.length)}`
11533
11547
  ];
11534
- if (datasetStats && (datasetStats.source === path || datasetStats.source === record.path)) {
11535
- lines2.push(...formatDatasetStatsLines(datasetStats.stats, " "));
11548
+ if (typeof record.queryDatasetCommand === "string") {
11549
+ lines2.push(` query dataset: ${record.queryDatasetCommand}`);
11536
11550
  }
11537
11551
  if (typeof record.slowExportAsCsvCommand === "string") {
11538
11552
  lines2.push(` export CSV: ${record.slowExportAsCsvCommand}`);
@@ -11544,9 +11558,7 @@ function collectDatasetHandleLines(value, path = "result", datasetStats) {
11544
11558
  if (key === "preview" || key === "access") {
11545
11559
  continue;
11546
11560
  }
11547
- lines.push(
11548
- ...collectDatasetHandleLines(child, `${path}.${key}`, datasetStats)
11549
- );
11561
+ lines.push(...collectDatasetHandleLines(child, `${path}.${key}`));
11550
11562
  }
11551
11563
  return lines;
11552
11564
  }
@@ -11949,80 +11961,6 @@ function compactPlayStatus(status) {
11949
11961
  next: buildRunNextCommands(status)
11950
11962
  };
11951
11963
  }
11952
- function enrichPlayStatusWithDatasetStats(status) {
11953
- const datasetStats = datasetStatsForStatus(status);
11954
- if (!datasetStats) {
11955
- return status;
11956
- }
11957
- return {
11958
- ...status,
11959
- result: attachDatasetStatsToResult(
11960
- status.result,
11961
- datasetStats
11962
- )
11963
- };
11964
- }
11965
- function datasetStatsForStatus(status) {
11966
- const rowsInfo = extractCanonicalRowsInfo(status);
11967
- if (!rowsInfo?.complete) {
11968
- return null;
11969
- }
11970
- return {
11971
- source: rowsInfo.source,
11972
- stats: buildDatasetStats(
11973
- rowsInfo.rows,
11974
- rowsInfo.totalRows,
11975
- rowsInfo.columns,
11976
- extractDatasetExecutionStats(status)
11977
- )
11978
- };
11979
- }
11980
- function attachDatasetStatsToResult(result, datasetStats) {
11981
- if (!result || typeof result !== "object" || Array.isArray(result)) {
11982
- return result;
11983
- }
11984
- const sourcePath = datasetStats.source?.replace(/^result\.?/, "") ?? "";
11985
- const attach = (value, path) => {
11986
- if (!value || typeof value !== "object" || Array.isArray(value)) {
11987
- return value;
11988
- }
11989
- const record = value;
11990
- const isMatchingDataset = record.kind === "dataset" && (path === sourcePath || `result.${path}` === datasetStats.source);
11991
- const next = { ...record };
11992
- if (isMatchingDataset) {
11993
- next.summary = datasetStats.stats;
11994
- return next;
11995
- }
11996
- for (const [key, child] of Object.entries(record)) {
11997
- if (key === "preview" || key === "access") continue;
11998
- const childPath = path ? `${path}.${key}` : key;
11999
- const attached = attach(child, childPath);
12000
- if (attached !== child) {
12001
- next[key] = attached;
12002
- }
12003
- }
12004
- return next;
12005
- };
12006
- return attach(result, "");
12007
- }
12008
- function formatDatasetStatsLines(datasetStats, indent2 = " ") {
12009
- if (!datasetStats) {
12010
- return [];
12011
- }
12012
- const lines = [`${indent2}summary:`];
12013
- for (const [column, stat2] of Object.entries(datasetStats.columnStats).slice(
12014
- 0,
12015
- 12
12016
- )) {
12017
- const topValues = stat2.top_values ? `, top_values=${Object.entries(stat2.top_values).slice(0, 3).map(([value, count]) => `${value}=${count}`).join(", ")}` : "";
12018
- const sample = stat2.sample_value !== void 0 ? `, sample_value=${JSON.stringify(stat2.sample_value)}` : "";
12019
- const execution = stat2.execution ? `, execution=${Object.entries(stat2.execution).map(([bucket, count]) => `${bucket}=${count}`).join(", ")}` : "";
12020
- lines.push(
12021
- `${indent2} ${column}: non_empty=${stat2.non_empty}, unique=${stat2.unique}${topValues}${sample}${execution}`
12022
- );
12023
- }
12024
- return lines;
12025
- }
12026
11964
  function readRunPackageRun(packaged) {
12027
11965
  return packaged.run && typeof packaged.run === "object" && !Array.isArray(packaged.run) ? packaged.run : {};
12028
11966
  }
@@ -12062,6 +12000,21 @@ function formatSummaryScalarParts(record, skipKeys = /* @__PURE__ */ new Set())
12062
12000
  }
12063
12001
  return parts;
12064
12002
  }
12003
+ var DATASET_SUMMARY_TOP_VALUES_DISPLAY_LIMIT = 10;
12004
+ function formatTopValuesPart(value) {
12005
+ const topValues = readRecord(value);
12006
+ if (!topValues) {
12007
+ return null;
12008
+ }
12009
+ const entries = Object.entries(topValues).slice(
12010
+ 0,
12011
+ DATASET_SUMMARY_TOP_VALUES_DISPLAY_LIMIT
12012
+ );
12013
+ if (entries.length === 0) {
12014
+ return null;
12015
+ }
12016
+ return `top_values=${entries.map(([topValue, count]) => `${topValue}=${String(count)}`).join(", ")}`;
12017
+ }
12065
12018
  function formatPackageDatasetSummaryLines(summary, indent2 = " ") {
12066
12019
  const record = readRecord(summary);
12067
12020
  const columnStats = readRecord(record?.columnStats);
@@ -12096,8 +12049,13 @@ function formatPackageDatasetSummaryLines(summary, indent2 = " ") {
12096
12049
  if (!columnSummary) continue;
12097
12050
  const execution = readRecord(columnSummary.execution);
12098
12051
  const executionText = execution ? Object.entries(execution).map(([bucket, value]) => `${bucket}=${String(value)}`).join(", ") : "";
12052
+ const topValuesText = formatTopValuesPart(columnSummary.top_values);
12099
12053
  const columnParts = [
12100
- ...formatSummaryScalarParts(columnSummary, /* @__PURE__ */ new Set(["execution"])),
12054
+ ...formatSummaryScalarParts(
12055
+ columnSummary,
12056
+ /* @__PURE__ */ new Set(["execution", "top_values"])
12057
+ ),
12058
+ topValuesText,
12101
12059
  executionText ? `execution=${executionText}` : null
12102
12060
  ].filter(Boolean);
12103
12061
  if (columnParts.length > 0) {
@@ -12225,13 +12183,9 @@ function buildRunPackageTextLines(packaged) {
12225
12183
  }
12226
12184
  function writePlayResult(status, jsonOutput, options) {
12227
12185
  const packaged = getPlayRunPackage(status);
12228
- const datasetStats = datasetStatsForStatus(status);
12229
12186
  if (jsonOutput) {
12230
12187
  const compact2 = compactPlayStatus(status);
12231
- const payload2 = options?.fullJson ? enrichPlayStatusWithDatasetStats(status) : datasetStats ? {
12232
- ...compact2,
12233
- result: attachDatasetStatsToResult(compact2.result, datasetStats)
12234
- } : compact2;
12188
+ const payload2 = options?.fullJson ? status : compact2;
12235
12189
  printCommandEnvelope(payload2, { json: true });
12236
12190
  return;
12237
12191
  }
@@ -12267,17 +12221,14 @@ function writePlayResult(status, jsonOutput, options) {
12267
12221
  const renderedServerView = renderServerResultView(status.resultView);
12268
12222
  if (result) {
12269
12223
  lines.push(...formatReturnValue(result));
12270
- lines.push(...collectDatasetHandleLines(result, "result", datasetStats));
12224
+ lines.push(...collectDatasetHandleLines(result, "result"));
12271
12225
  }
12272
12226
  if (renderedServerView.lines.length > 0) {
12273
12227
  lines.push(...renderedServerView.lines);
12274
12228
  }
12275
12229
  lines.push(...renderedServerView.actions);
12276
12230
  const compact = compactPlayStatus(status);
12277
- const payload = options?.fullJson ? enrichPlayStatusWithDatasetStats(status) : datasetStats ? {
12278
- ...compact,
12279
- result: attachDatasetStatsToResult(compact.result, datasetStats)
12280
- } : compact;
12231
+ const payload = options?.fullJson ? status : compact;
12281
12232
  printCommandEnvelope(
12282
12233
  {
12283
12234
  ...payload,
@@ -13213,12 +13164,14 @@ async function handlePlayCheck(args) {
13213
13164
  return 0;
13214
13165
  }
13215
13166
  const client2 = new DeeplineClient();
13167
+ const integrationMode = resolveEvalIntegrationMode();
13216
13168
  const result = await client2.checkPlayArtifact({
13217
13169
  name: playName,
13218
13170
  sourceCode: graph.root.sourceCode,
13219
13171
  sourceFiles: graph.root.sourceFiles,
13220
13172
  description: graph.root.playDescription ?? void 0,
13221
- artifact: graph.root.artifact
13173
+ artifact: graph.root.artifact,
13174
+ ...integrationMode ? { integrationMode } : {}
13222
13175
  });
13223
13176
  const enrichedResult = {
13224
13177
  ...result,
@@ -13336,6 +13289,7 @@ async function handleFileBackedRun(options) {
13336
13289
  progress
13337
13290
  })
13338
13291
  );
13292
+ const integrationMode = resolveEvalIntegrationMode();
13339
13293
  const startRequest = {
13340
13294
  name: playName,
13341
13295
  sourceCode: bundleResult.sourceCode,
@@ -13348,7 +13302,8 @@ async function handleFileBackedRun(options) {
13348
13302
  ...stagedFileInputs.inputFile ? { inputFile: stagedFileInputs.inputFile } : {},
13349
13303
  ...stagedFileInputs.packagedFiles.length ? { packagedFiles: stagedFileInputs.packagedFiles } : {},
13350
13304
  ...options.force ? { force: true } : {},
13351
- ...options.profile ? { profile: options.profile } : {}
13305
+ ...options.profile ? { profile: options.profile } : {},
13306
+ ...integrationMode ? { integrationMode } : {}
13352
13307
  };
13353
13308
  if (options.watch) {
13354
13309
  progress.phase("starting run");
@@ -13498,6 +13453,7 @@ async function handleNamedRun(options) {
13498
13453
  progress
13499
13454
  })
13500
13455
  );
13456
+ const integrationMode = resolveEvalIntegrationMode();
13501
13457
  const startRequest = {
13502
13458
  name: playName,
13503
13459
  ...selectedRevisionId ? { revisionId: selectedRevisionId } : {},
@@ -13505,7 +13461,8 @@ async function handleNamedRun(options) {
13505
13461
  ...stagedFileInputs.inputFile ? { inputFile: stagedFileInputs.inputFile } : {},
13506
13462
  ...stagedFileInputs.packagedFiles.length ? { packagedFiles: stagedFileInputs.packagedFiles } : {},
13507
13463
  ...options.force ? { force: true } : {},
13508
- ...options.profile ? { profile: options.profile } : {}
13464
+ ...options.profile ? { profile: options.profile } : {},
13465
+ ...integrationMode ? { integrationMode } : {}
13509
13466
  };
13510
13467
  if (options.watch) {
13511
13468
  progress.phase("starting run");
@@ -607,10 +607,10 @@ var SDK_RELEASE = {
607
607
  // 0.1.111 ships dataset-native tool list getters and result row datasets.
608
608
  // 0.1.154 removes the short-lived generated enrich StepOptions recompute
609
609
  // fields shipped in 0.1.153.
610
- version: "0.1.167",
610
+ version: "0.1.169",
611
611
  apiContract: "2026-06-dataset-handle-results-hard-cutover",
612
612
  supportPolicy: {
613
- latest: "0.1.167",
613
+ latest: "0.1.169",
614
614
  minimumSupported: "0.1.53",
615
615
  deprecatedBelow: "0.1.53",
616
616
  commandMinimumSupported: [
@@ -2096,6 +2096,17 @@ var COMPILE_MANIFEST_RETRY_DELAYS_MS = [250, 1e3];
2096
2096
  var REGISTER_PLAY_ARTIFACTS_COMPILE_CONCURRENCY = 3;
2097
2097
  var REGISTER_PLAY_ARTIFACTS_MAX_BATCH_COUNT = 3;
2098
2098
  var REGISTER_PLAY_ARTIFACTS_MAX_BATCH_BYTES = 25e5;
2099
+ function normalizePlayRunIntegrationMode(value) {
2100
+ if (value === "live" || value === "eval_stub" || value === "fixture") {
2101
+ return value;
2102
+ }
2103
+ return void 0;
2104
+ }
2105
+ function resolvePlayRunIntegrationMode(request) {
2106
+ return normalizePlayRunIntegrationMode(
2107
+ request.integrationMode ?? process.env.DEEPLINE_EVAL_INTEGRATION_MODE
2108
+ );
2109
+ }
2099
2110
  function sleep2(ms) {
2100
2111
  return new Promise((resolve14) => setTimeout(resolve14, ms));
2101
2112
  }
@@ -2643,6 +2654,7 @@ var DeeplineClient = class {
2643
2654
  * ```
2644
2655
  */
2645
2656
  async startPlayRun(request) {
2657
+ const integrationMode = resolvePlayRunIntegrationMode(request);
2646
2658
  const response = await this.http.post(
2647
2659
  "/api/v2/plays/run",
2648
2660
  {
@@ -2667,7 +2679,8 @@ var DeeplineClient = class {
2667
2679
  // Profile selection is the API's job, not the CLI's. The server
2668
2680
  // defaults to workers_edge; tests and runtime probes that want a
2669
2681
  // different profile pass `request.profile` explicitly.
2670
- ...request.profile ? { profile: request.profile } : {}
2682
+ ...request.profile ? { profile: request.profile } : {},
2683
+ ...integrationMode ? { integrationMode } : {}
2671
2684
  }
2672
2685
  );
2673
2686
  return normalizePlayRunStart(response);
@@ -2684,6 +2697,7 @@ var DeeplineClient = class {
2684
2697
  * @returns Async stream of play-scoped live events.
2685
2698
  */
2686
2699
  async *startPlayRunStream(request, options) {
2700
+ const integrationMode = resolvePlayRunIntegrationMode(request);
2687
2701
  const body = {
2688
2702
  ...request.name ? { name: request.name } : {},
2689
2703
  ...request.revisionId ? { revisionId: request.revisionId } : {},
@@ -2703,7 +2717,8 @@ var DeeplineClient = class {
2703
2717
  ...request.packagedFiles?.length ? { packagedFiles: request.packagedFiles } : {},
2704
2718
  ...request.force ? { force: true } : {},
2705
2719
  ...typeof request.waitForCompletionMs === "number" ? { waitForCompletionMs: request.waitForCompletionMs } : {},
2706
- ...request.profile ? { profile: request.profile } : {}
2720
+ ...request.profile ? { profile: request.profile } : {},
2721
+ ...integrationMode ? { integrationMode } : {}
2707
2722
  };
2708
2723
  for await (const event of this.http.streamSse(
2709
2724
  "/api/v2/plays/run?stream=true",
@@ -2820,7 +2835,13 @@ var DeeplineClient = class {
2820
2835
  * path used by `deepline plays check`.
2821
2836
  */
2822
2837
  async checkPlayArtifact(input2) {
2823
- return this.http.post("/api/v2/plays/check", input2);
2838
+ const integrationMode = normalizePlayRunIntegrationMode(
2839
+ input2.integrationMode ?? process.env.DEEPLINE_EVAL_INTEGRATION_MODE
2840
+ );
2841
+ return this.http.post("/api/v2/plays/check", {
2842
+ ...input2,
2843
+ ...integrationMode ? { integrationMode } : {}
2844
+ });
2824
2845
  }
2825
2846
  /**
2826
2847
  * Compile legacy enrich command arguments into a runtime plan.
@@ -6662,20 +6683,6 @@ function extractCanonicalRowsInfo(statusOrResult) {
6662
6683
  function percentText(numerator, denominator) {
6663
6684
  return datasetSummaryPercentText(numerator, denominator);
6664
6685
  }
6665
- function isDatasetExecutionStatsInput(value) {
6666
- return isRecord4(value) && isRecord4(value.columnStats) && Object.values(value.columnStats).every(isRecord4);
6667
- }
6668
- function extractDatasetExecutionStats(statusOrResult) {
6669
- if (!isRecord4(statusOrResult)) {
6670
- return null;
6671
- }
6672
- const direct = statusOrResult.dataset_execution_stats;
6673
- if (isDatasetExecutionStatsInput(direct)) {
6674
- return direct;
6675
- }
6676
- const nested = isRecord4(statusOrResult.result) ? statusOrResult.result.dataset_execution_stats : null;
6677
- return isDatasetExecutionStatsInput(nested) ? nested : null;
6678
- }
6679
6686
  function countPercentText(count, denominator) {
6680
6687
  return denominator > 0 ? `${count} (${Math.round(100 * count / denominator)}%)` : "0 (0%)";
6681
6688
  }
@@ -9749,6 +9756,13 @@ function extractDefinedPlayName(code) {
9749
9756
  }
9750
9757
  return null;
9751
9758
  }
9759
+ function resolveEvalIntegrationMode() {
9760
+ const mode = process.env.DEEPLINE_EVAL_INTEGRATION_MODE;
9761
+ if (mode === "live" || mode === "eval_stub" || mode === "fixture") {
9762
+ return mode;
9763
+ }
9764
+ return void 0;
9765
+ }
9752
9766
  var PLAY_RUN_RESERVED_BOOLEAN_FLAGS = /* @__PURE__ */ new Set([
9753
9767
  "--json",
9754
9768
  "--wait",
@@ -11547,7 +11561,7 @@ function isDatasetHandle(value) {
11547
11561
  value && typeof value === "object" && !Array.isArray(value) && value.kind === "dataset"
11548
11562
  );
11549
11563
  }
11550
- function collectDatasetHandleLines(value, path = "result", datasetStats) {
11564
+ function collectDatasetHandleLines(value, path = "result") {
11551
11565
  if (!value || typeof value !== "object" || Array.isArray(value)) {
11552
11566
  return [];
11553
11567
  }
@@ -11558,8 +11572,8 @@ function collectDatasetHandleLines(value, path = "result", datasetStats) {
11558
11572
  const lines2 = [
11559
11573
  ` dataset ${typeof record.path === "string" ? record.path : path}: rows=${count === null ? "-" : formatInteger(count)} preview=${formatInteger(preview.length)}`
11560
11574
  ];
11561
- if (datasetStats && (datasetStats.source === path || datasetStats.source === record.path)) {
11562
- lines2.push(...formatDatasetStatsLines(datasetStats.stats, " "));
11575
+ if (typeof record.queryDatasetCommand === "string") {
11576
+ lines2.push(` query dataset: ${record.queryDatasetCommand}`);
11563
11577
  }
11564
11578
  if (typeof record.slowExportAsCsvCommand === "string") {
11565
11579
  lines2.push(` export CSV: ${record.slowExportAsCsvCommand}`);
@@ -11571,9 +11585,7 @@ function collectDatasetHandleLines(value, path = "result", datasetStats) {
11571
11585
  if (key === "preview" || key === "access") {
11572
11586
  continue;
11573
11587
  }
11574
- lines.push(
11575
- ...collectDatasetHandleLines(child, `${path}.${key}`, datasetStats)
11576
- );
11588
+ lines.push(...collectDatasetHandleLines(child, `${path}.${key}`));
11577
11589
  }
11578
11590
  return lines;
11579
11591
  }
@@ -11976,80 +11988,6 @@ function compactPlayStatus(status) {
11976
11988
  next: buildRunNextCommands(status)
11977
11989
  };
11978
11990
  }
11979
- function enrichPlayStatusWithDatasetStats(status) {
11980
- const datasetStats = datasetStatsForStatus(status);
11981
- if (!datasetStats) {
11982
- return status;
11983
- }
11984
- return {
11985
- ...status,
11986
- result: attachDatasetStatsToResult(
11987
- status.result,
11988
- datasetStats
11989
- )
11990
- };
11991
- }
11992
- function datasetStatsForStatus(status) {
11993
- const rowsInfo = extractCanonicalRowsInfo(status);
11994
- if (!rowsInfo?.complete) {
11995
- return null;
11996
- }
11997
- return {
11998
- source: rowsInfo.source,
11999
- stats: buildDatasetStats(
12000
- rowsInfo.rows,
12001
- rowsInfo.totalRows,
12002
- rowsInfo.columns,
12003
- extractDatasetExecutionStats(status)
12004
- )
12005
- };
12006
- }
12007
- function attachDatasetStatsToResult(result, datasetStats) {
12008
- if (!result || typeof result !== "object" || Array.isArray(result)) {
12009
- return result;
12010
- }
12011
- const sourcePath = datasetStats.source?.replace(/^result\.?/, "") ?? "";
12012
- const attach = (value, path) => {
12013
- if (!value || typeof value !== "object" || Array.isArray(value)) {
12014
- return value;
12015
- }
12016
- const record = value;
12017
- const isMatchingDataset = record.kind === "dataset" && (path === sourcePath || `result.${path}` === datasetStats.source);
12018
- const next = { ...record };
12019
- if (isMatchingDataset) {
12020
- next.summary = datasetStats.stats;
12021
- return next;
12022
- }
12023
- for (const [key, child] of Object.entries(record)) {
12024
- if (key === "preview" || key === "access") continue;
12025
- const childPath = path ? `${path}.${key}` : key;
12026
- const attached = attach(child, childPath);
12027
- if (attached !== child) {
12028
- next[key] = attached;
12029
- }
12030
- }
12031
- return next;
12032
- };
12033
- return attach(result, "");
12034
- }
12035
- function formatDatasetStatsLines(datasetStats, indent2 = " ") {
12036
- if (!datasetStats) {
12037
- return [];
12038
- }
12039
- const lines = [`${indent2}summary:`];
12040
- for (const [column, stat2] of Object.entries(datasetStats.columnStats).slice(
12041
- 0,
12042
- 12
12043
- )) {
12044
- const topValues = stat2.top_values ? `, top_values=${Object.entries(stat2.top_values).slice(0, 3).map(([value, count]) => `${value}=${count}`).join(", ")}` : "";
12045
- const sample = stat2.sample_value !== void 0 ? `, sample_value=${JSON.stringify(stat2.sample_value)}` : "";
12046
- const execution = stat2.execution ? `, execution=${Object.entries(stat2.execution).map(([bucket, count]) => `${bucket}=${count}`).join(", ")}` : "";
12047
- lines.push(
12048
- `${indent2} ${column}: non_empty=${stat2.non_empty}, unique=${stat2.unique}${topValues}${sample}${execution}`
12049
- );
12050
- }
12051
- return lines;
12052
- }
12053
11991
  function readRunPackageRun(packaged) {
12054
11992
  return packaged.run && typeof packaged.run === "object" && !Array.isArray(packaged.run) ? packaged.run : {};
12055
11993
  }
@@ -12089,6 +12027,21 @@ function formatSummaryScalarParts(record, skipKeys = /* @__PURE__ */ new Set())
12089
12027
  }
12090
12028
  return parts;
12091
12029
  }
12030
+ var DATASET_SUMMARY_TOP_VALUES_DISPLAY_LIMIT = 10;
12031
+ function formatTopValuesPart(value) {
12032
+ const topValues = readRecord(value);
12033
+ if (!topValues) {
12034
+ return null;
12035
+ }
12036
+ const entries = Object.entries(topValues).slice(
12037
+ 0,
12038
+ DATASET_SUMMARY_TOP_VALUES_DISPLAY_LIMIT
12039
+ );
12040
+ if (entries.length === 0) {
12041
+ return null;
12042
+ }
12043
+ return `top_values=${entries.map(([topValue, count]) => `${topValue}=${String(count)}`).join(", ")}`;
12044
+ }
12092
12045
  function formatPackageDatasetSummaryLines(summary, indent2 = " ") {
12093
12046
  const record = readRecord(summary);
12094
12047
  const columnStats = readRecord(record?.columnStats);
@@ -12123,8 +12076,13 @@ function formatPackageDatasetSummaryLines(summary, indent2 = " ") {
12123
12076
  if (!columnSummary) continue;
12124
12077
  const execution = readRecord(columnSummary.execution);
12125
12078
  const executionText = execution ? Object.entries(execution).map(([bucket, value]) => `${bucket}=${String(value)}`).join(", ") : "";
12079
+ const topValuesText = formatTopValuesPart(columnSummary.top_values);
12126
12080
  const columnParts = [
12127
- ...formatSummaryScalarParts(columnSummary, /* @__PURE__ */ new Set(["execution"])),
12081
+ ...formatSummaryScalarParts(
12082
+ columnSummary,
12083
+ /* @__PURE__ */ new Set(["execution", "top_values"])
12084
+ ),
12085
+ topValuesText,
12128
12086
  executionText ? `execution=${executionText}` : null
12129
12087
  ].filter(Boolean);
12130
12088
  if (columnParts.length > 0) {
@@ -12252,13 +12210,9 @@ function buildRunPackageTextLines(packaged) {
12252
12210
  }
12253
12211
  function writePlayResult(status, jsonOutput, options) {
12254
12212
  const packaged = getPlayRunPackage(status);
12255
- const datasetStats = datasetStatsForStatus(status);
12256
12213
  if (jsonOutput) {
12257
12214
  const compact2 = compactPlayStatus(status);
12258
- const payload2 = options?.fullJson ? enrichPlayStatusWithDatasetStats(status) : datasetStats ? {
12259
- ...compact2,
12260
- result: attachDatasetStatsToResult(compact2.result, datasetStats)
12261
- } : compact2;
12215
+ const payload2 = options?.fullJson ? status : compact2;
12262
12216
  printCommandEnvelope(payload2, { json: true });
12263
12217
  return;
12264
12218
  }
@@ -12294,17 +12248,14 @@ function writePlayResult(status, jsonOutput, options) {
12294
12248
  const renderedServerView = renderServerResultView(status.resultView);
12295
12249
  if (result) {
12296
12250
  lines.push(...formatReturnValue(result));
12297
- lines.push(...collectDatasetHandleLines(result, "result", datasetStats));
12251
+ lines.push(...collectDatasetHandleLines(result, "result"));
12298
12252
  }
12299
12253
  if (renderedServerView.lines.length > 0) {
12300
12254
  lines.push(...renderedServerView.lines);
12301
12255
  }
12302
12256
  lines.push(...renderedServerView.actions);
12303
12257
  const compact = compactPlayStatus(status);
12304
- const payload = options?.fullJson ? enrichPlayStatusWithDatasetStats(status) : datasetStats ? {
12305
- ...compact,
12306
- result: attachDatasetStatsToResult(compact.result, datasetStats)
12307
- } : compact;
12258
+ const payload = options?.fullJson ? status : compact;
12308
12259
  printCommandEnvelope(
12309
12260
  {
12310
12261
  ...payload,
@@ -13240,12 +13191,14 @@ async function handlePlayCheck(args) {
13240
13191
  return 0;
13241
13192
  }
13242
13193
  const client2 = new DeeplineClient();
13194
+ const integrationMode = resolveEvalIntegrationMode();
13243
13195
  const result = await client2.checkPlayArtifact({
13244
13196
  name: playName,
13245
13197
  sourceCode: graph.root.sourceCode,
13246
13198
  sourceFiles: graph.root.sourceFiles,
13247
13199
  description: graph.root.playDescription ?? void 0,
13248
- artifact: graph.root.artifact
13200
+ artifact: graph.root.artifact,
13201
+ ...integrationMode ? { integrationMode } : {}
13249
13202
  });
13250
13203
  const enrichedResult = {
13251
13204
  ...result,
@@ -13363,6 +13316,7 @@ async function handleFileBackedRun(options) {
13363
13316
  progress
13364
13317
  })
13365
13318
  );
13319
+ const integrationMode = resolveEvalIntegrationMode();
13366
13320
  const startRequest = {
13367
13321
  name: playName,
13368
13322
  sourceCode: bundleResult.sourceCode,
@@ -13375,7 +13329,8 @@ async function handleFileBackedRun(options) {
13375
13329
  ...stagedFileInputs.inputFile ? { inputFile: stagedFileInputs.inputFile } : {},
13376
13330
  ...stagedFileInputs.packagedFiles.length ? { packagedFiles: stagedFileInputs.packagedFiles } : {},
13377
13331
  ...options.force ? { force: true } : {},
13378
- ...options.profile ? { profile: options.profile } : {}
13332
+ ...options.profile ? { profile: options.profile } : {},
13333
+ ...integrationMode ? { integrationMode } : {}
13379
13334
  };
13380
13335
  if (options.watch) {
13381
13336
  progress.phase("starting run");
@@ -13525,6 +13480,7 @@ async function handleNamedRun(options) {
13525
13480
  progress
13526
13481
  })
13527
13482
  );
13483
+ const integrationMode = resolveEvalIntegrationMode();
13528
13484
  const startRequest = {
13529
13485
  name: playName,
13530
13486
  ...selectedRevisionId ? { revisionId: selectedRevisionId } : {},
@@ -13532,7 +13488,8 @@ async function handleNamedRun(options) {
13532
13488
  ...stagedFileInputs.inputFile ? { inputFile: stagedFileInputs.inputFile } : {},
13533
13489
  ...stagedFileInputs.packagedFiles.length ? { packagedFiles: stagedFileInputs.packagedFiles } : {},
13534
13490
  ...options.force ? { force: true } : {},
13535
- ...options.profile ? { profile: options.profile } : {}
13491
+ ...options.profile ? { profile: options.profile } : {},
13492
+ ...integrationMode ? { integrationMode } : {}
13536
13493
  };
13537
13494
  if (options.watch) {
13538
13495
  progress.phase("starting run");