deepline 0.2.53 → 0.2.55

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 (44) hide show
  1. package/dist/bundling-sources/sdk/src/client.ts +17 -1
  2. package/dist/bundling-sources/sdk/src/plays/bundle-play-file.ts +1 -1
  3. package/dist/bundling-sources/sdk/src/release.ts +1 -1
  4. package/dist/bundling-sources/sdk/src/types.ts +43 -1
  5. package/dist/bundling-sources/shared_libs/play-runtime/app-runtime-api.ts +30 -1
  6. package/dist/bundling-sources/shared_libs/play-runtime/cell-provenance.ts +231 -0
  7. package/dist/bundling-sources/shared_libs/play-runtime/context.ts +1094 -128
  8. package/dist/bundling-sources/shared_libs/play-runtime/ctx-types.ts +178 -9
  9. package/dist/bundling-sources/shared_libs/play-runtime/docflow-node-io.ts +634 -0
  10. package/dist/bundling-sources/shared_libs/play-runtime/docflow-observation.ts +64 -0
  11. package/dist/bundling-sources/shared_libs/play-runtime/dynamic-worker-version.ts +1 -1
  12. package/dist/bundling-sources/shared_libs/play-runtime/execution-capabilities.ts +18 -0
  13. package/dist/bundling-sources/shared_libs/play-runtime/live-state-contract.ts +33 -0
  14. package/dist/bundling-sources/shared_libs/play-runtime/log-provenance.ts +251 -0
  15. package/dist/bundling-sources/shared_libs/play-runtime/play-node-scope.ts +160 -0
  16. package/dist/bundling-sources/shared_libs/play-runtime/protocol.ts +6 -0
  17. package/dist/bundling-sources/shared_libs/play-runtime/run-failure.ts +27 -0
  18. package/dist/bundling-sources/shared_libs/play-runtime/run-ledger.ts +43 -5
  19. package/dist/bundling-sources/shared_libs/play-runtime/run-snapshot-stream.ts +12 -0
  20. package/dist/bundling-sources/shared_libs/play-runtime/runner-backends/backends/local-process.ts +26 -4
  21. package/dist/bundling-sources/shared_libs/play-runtime/runtime-actions.ts +6 -1
  22. package/dist/bundling-sources/shared_libs/play-runtime/runtime-api.ts +83 -0
  23. package/dist/bundling-sources/shared_libs/play-runtime/worker-api-types.ts +3 -0
  24. package/dist/bundling-sources/shared_libs/plays/authoring-contract.ts +49 -1
  25. package/dist/bundling-sources/shared_libs/plays/bundling/index.ts +375 -29
  26. package/dist/bundling-sources/shared_libs/plays/docflow-binding-owner.ts +636 -0
  27. package/dist/bundling-sources/shared_libs/plays/docflow-binding.ts +598 -0
  28. package/dist/bundling-sources/shared_libs/plays/docflow.ts +1645 -0
  29. package/dist/bundling-sources/shared_libs/plays/play-exports.ts +202 -0
  30. package/dist/bundling-sources/shared_libs/plays/static-pipeline.ts +16 -1
  31. package/dist/bundling-sources/shared_libs/plays/ts-ast.ts +48 -0
  32. package/dist/cli/index.js +994 -312
  33. package/dist/cli/index.mjs +994 -312
  34. package/dist/{compiler-manifest-Cj3--4ZJ.d.mts → compiler-manifest-Bl8kmLx9.d.mts} +118 -0
  35. package/dist/{compiler-manifest-Cj3--4ZJ.d.ts → compiler-manifest-Bl8kmLx9.d.ts} +118 -0
  36. package/dist/index.d.mts +47 -2
  37. package/dist/index.d.ts +47 -2
  38. package/dist/index.js +419 -59
  39. package/dist/index.mjs +419 -59
  40. package/dist/install-integrity.json +12 -2
  41. package/dist/plays/bundle-play-file.d.mts +2 -2
  42. package/dist/plays/bundle-play-file.d.ts +2 -2
  43. package/dist/plays/bundle-play-file.mjs +1361 -45
  44. package/package.json +1 -1
package/dist/cli/index.js CHANGED
@@ -1044,7 +1044,7 @@ var SDK_RELEASE = {
1044
1044
  // 0.2.0 makes Dataset Handles uniformly async-only after 0.1.320 briefly
1045
1045
  // exposed storage-dependent synchronous access. This deliberate minor
1046
1046
  // release keeps lazy paging semantics independent of row residency.
1047
- version: "0.2.53",
1047
+ version: "0.2.55",
1048
1048
  contracts: {
1049
1049
  api: {
1050
1050
  name: "sdk-http-api",
@@ -1979,7 +1979,7 @@ function createSecretRedactionContext(initialValues = []) {
1979
1979
  if (value.length >= 4) exactSecrets.add(value);
1980
1980
  }
1981
1981
  for (const value of initialValues) register(value);
1982
- function redactString(value) {
1982
+ function redactString2(value) {
1983
1983
  let output2 = value;
1984
1984
  for (const secret of exactSecrets) {
1985
1985
  output2 = output2.replace(
@@ -2000,7 +2000,7 @@ function createSecretRedactionContext(initialValues = []) {
2000
2000
  return redactSecretLikeString(output2);
2001
2001
  }
2002
2002
  function redact(value) {
2003
- if (typeof value === "string") return redactString(value);
2003
+ if (typeof value === "string") return redactString2(value);
2004
2004
  if (Array.isArray(value)) return value.map((entry) => redact(entry));
2005
2005
  if (value && typeof value === "object") {
2006
2006
  return Object.fromEntries(
@@ -2013,7 +2013,7 @@ function createSecretRedactionContext(initialValues = []) {
2013
2013
  return value;
2014
2014
  }
2015
2015
  function redactKnownSecrets(value) {
2016
- if (typeof value === "string") return redactString(value);
2016
+ if (typeof value === "string") return redactString2(value);
2017
2017
  if (Array.isArray(value)) {
2018
2018
  return value.map((entry) => redactKnownSecrets(entry));
2019
2019
  }
@@ -2029,7 +2029,7 @@ function createSecretRedactionContext(initialValues = []) {
2029
2029
  }
2030
2030
  return {
2031
2031
  register,
2032
- redactString,
2032
+ redactString: redactString2,
2033
2033
  redactKnownSecrets,
2034
2034
  redact
2035
2035
  };
@@ -2049,12 +2049,334 @@ var RUNNER_POST_TERMINAL_DIAGNOSTIC_MAX_BYTES = 64 * 1024;
2049
2049
  // ../shared_libs/play-runtime/ledger-safe-payload.ts
2050
2050
  var ledgerIngressRedactor = createSecretRedactionContext();
2051
2051
 
2052
- // ../shared_libs/play-runtime/activity-observation.ts
2052
+ // ../shared_libs/play-runtime/docflow-node-io.ts
2053
+ var DOCFLOW_NODE_IO_LIMITS = {
2054
+ maxPaths: 16,
2055
+ maxDepth: 3,
2056
+ maxObjectFields: 12,
2057
+ maxArrayItems: 3,
2058
+ maxStringBytes: 256,
2059
+ maxPhaseBytes: 2e3,
2060
+ maxErrorBytes: 512
2061
+ };
2062
+ var utf8Encoder = new TextEncoder();
2063
+ var PLAY_DATASET_BRAND = /* @__PURE__ */ Symbol.for("deepline.play.dataset");
2064
+ function ledgerSafeDocflowPreviewKey(key) {
2065
+ if (!key.startsWith("$")) return key;
2066
+ const stripped = key.replace(/^\$+/, "");
2067
+ return stripped || "output";
2068
+ }
2069
+ function utf8Bytes(value) {
2070
+ return utf8Encoder.encode(value).byteLength;
2071
+ }
2072
+ function truncateUtf8(value, maxBytes) {
2073
+ if (utf8Bytes(value) <= maxBytes) return value;
2074
+ let output2 = "";
2075
+ for (const character of value) {
2076
+ if (utf8Bytes(`${output2}${character}\u2026`) > maxBytes) break;
2077
+ output2 += character;
2078
+ }
2079
+ return `${output2}\u2026`;
2080
+ }
2081
+ function redactString(redactor, value, key) {
2082
+ if (!key) return redactor.redactString(value);
2083
+ const wrapped = redactor.redact({ [key]: value });
2084
+ return typeof wrapped[key] === "string" ? wrapped[key] : redactor.redactString(value);
2085
+ }
2086
+ function safeString(value, redactor, key) {
2087
+ if (typeof value !== "string") return void 0;
2088
+ return truncateUtf8(
2089
+ redactString(redactor, value, key),
2090
+ DOCFLOW_NODE_IO_LIMITS.maxStringBytes
2091
+ );
2092
+ }
2093
+ function previewValue(value, input2) {
2094
+ if (value === null) return { kind: "null" };
2095
+ if (value === void 0) return { kind: "unavailable", reason: "undefined" };
2096
+ if (typeof value === "string") {
2097
+ return {
2098
+ kind: "scalar",
2099
+ value: safeString(value, input2.redactor, input2.key) ?? ""
2100
+ };
2101
+ }
2102
+ if (typeof value === "number") {
2103
+ return Number.isFinite(value) ? { kind: "scalar", value } : { kind: "unavailable", reason: "unsupported" };
2104
+ }
2105
+ if (typeof value === "boolean") return { kind: "scalar", value };
2106
+ if (typeof value === "bigint") {
2107
+ return { kind: "unavailable", reason: "bigint" };
2108
+ }
2109
+ if (typeof value === "function") {
2110
+ return { kind: "unavailable", reason: "function" };
2111
+ }
2112
+ if (typeof value === "symbol") {
2113
+ return { kind: "unavailable", reason: "symbol" };
2114
+ }
2115
+ if (typeof value !== "object") {
2116
+ return { kind: "unavailable", reason: "unsupported" };
2117
+ }
2118
+ try {
2119
+ const brand = readDataProperty(value, PLAY_DATASET_BRAND);
2120
+ const datasetKind = readDataProperty(value, "datasetKind");
2121
+ const datasetId = readDataProperty(value, "datasetId");
2122
+ const tableNamespace = readDataProperty(value, "tableNamespace");
2123
+ if (brand.ok && brand.value === true && datasetKind.ok && (datasetKind.value === "csv" || datasetKind.value === "map") && datasetId.ok && typeof datasetId.value === "string") {
2124
+ return {
2125
+ kind: "dataset",
2126
+ datasetId: safeString(datasetId.value, input2.redactor, "datasetId") ?? "dataset",
2127
+ datasetKind: datasetKind.value,
2128
+ tableNamespace: tableNamespace.ok && tableNamespace.value === null ? null : tableNamespace.ok ? safeString(
2129
+ tableNamespace.value,
2130
+ input2.redactor,
2131
+ "tableNamespace"
2132
+ ) : void 0
2133
+ };
2134
+ }
2135
+ const kind = readDataProperty(value, "kind");
2136
+ const count = readDataProperty(value, "count");
2137
+ const preview = readDataProperty(value, "preview");
2138
+ if (kind.ok && kind.value === "dataset" && datasetKind.ok && (datasetKind.value === "csv" || datasetKind.value === "map") && datasetId.ok && typeof datasetId.value === "string" && count.ok && typeof count.value === "number" && preview.ok && Array.isArray(preview.value)) {
2139
+ return {
2140
+ kind: "dataset",
2141
+ datasetId: safeString(datasetId.value, input2.redactor, "datasetId") ?? "dataset",
2142
+ datasetKind: datasetKind.value,
2143
+ tableNamespace: tableNamespace.ok && tableNamespace.value === null ? null : tableNamespace.ok ? safeString(
2144
+ tableNamespace.value,
2145
+ input2.redactor,
2146
+ "tableNamespace"
2147
+ ) : void 0,
2148
+ rowCount: Math.max(0, Math.floor(count.value))
2149
+ };
2150
+ }
2151
+ } catch {
2152
+ return { kind: "unavailable", reason: "access_error" };
2153
+ }
2154
+ if (input2.ancestors.has(value)) {
2155
+ return { kind: "unavailable", reason: "cycle" };
2156
+ }
2157
+ if (input2.depth >= DOCFLOW_NODE_IO_LIMITS.maxDepth) {
2158
+ return { kind: "unavailable", reason: "depth" };
2159
+ }
2160
+ input2.ancestors.add(value);
2161
+ try {
2162
+ if (Array.isArray(value)) {
2163
+ const items = [];
2164
+ for (let index = 0; index < Math.min(value.length, DOCFLOW_NODE_IO_LIMITS.maxArrayItems); index += 1) {
2165
+ const descriptor = Object.getOwnPropertyDescriptor(
2166
+ value,
2167
+ String(index)
2168
+ );
2169
+ items.push(
2170
+ descriptor && "value" in descriptor ? previewValue(descriptor.value, {
2171
+ ...input2,
2172
+ depth: input2.depth + 1
2173
+ }) : { kind: "unavailable", reason: "access_error" }
2174
+ );
2175
+ }
2176
+ return {
2177
+ kind: "array",
2178
+ items,
2179
+ totalItems: value.length,
2180
+ ...value.length > items.length ? { truncated: true } : {}
2181
+ };
2182
+ }
2183
+ let descriptors;
2184
+ try {
2185
+ descriptors = Object.getOwnPropertyDescriptors(value);
2186
+ } catch {
2187
+ return { kind: "unavailable", reason: "access_error" };
2188
+ }
2189
+ const entries = Object.entries(descriptors).filter(
2190
+ ([, descriptor]) => descriptor.enumerable
2191
+ );
2192
+ const selected = entries.slice(0, DOCFLOW_NODE_IO_LIMITS.maxObjectFields);
2193
+ const fields = {};
2194
+ for (const [key, descriptor] of selected) {
2195
+ const safeKey = truncateUtf8(
2196
+ ledgerSafeDocflowPreviewKey(input2.redactor.redactString(key)),
2197
+ DOCFLOW_NODE_IO_LIMITS.maxStringBytes
2198
+ );
2199
+ fields[safeKey] = "value" in descriptor ? previewValue(descriptor.value, {
2200
+ ...input2,
2201
+ depth: input2.depth + 1,
2202
+ key
2203
+ }) : { kind: "unavailable", reason: "access_error" };
2204
+ }
2205
+ return {
2206
+ kind: "object",
2207
+ fields,
2208
+ totalFields: entries.length,
2209
+ ...entries.length > selected.length ? { truncated: true } : {}
2210
+ };
2211
+ } catch {
2212
+ return { kind: "unavailable", reason: "access_error" };
2213
+ } finally {
2214
+ input2.ancestors.delete(value);
2215
+ }
2216
+ }
2217
+ function readDataProperty(value, property) {
2218
+ if ((typeof value !== "object" || value === null) && typeof value !== "function") {
2219
+ return { ok: false };
2220
+ }
2221
+ try {
2222
+ let owner = value;
2223
+ while (owner) {
2224
+ const descriptor = Object.getOwnPropertyDescriptor(owner, property);
2225
+ if (descriptor) {
2226
+ return "value" in descriptor ? { ok: true, value: descriptor.value } : { ok: false };
2227
+ }
2228
+ owner = Object.getPrototypeOf(owner);
2229
+ }
2230
+ } catch {
2231
+ return { ok: false };
2232
+ }
2233
+ return { ok: false };
2234
+ }
2235
+ function buildPlayDocflowNodeErrorPreview(error, redactor = createSecretRedactionContext()) {
2236
+ try {
2237
+ const message = error instanceof Error ? error.message : String(error);
2238
+ return truncateUtf8(
2239
+ redactor.redactString(message),
2240
+ DOCFLOW_NODE_IO_LIMITS.maxErrorBytes
2241
+ );
2242
+ } catch {
2243
+ return "Non-Error value thrown (message unavailable)";
2244
+ }
2245
+ }
2053
2246
  function isRecord3(value) {
2054
2247
  return Boolean(value && typeof value === "object" && !Array.isArray(value));
2055
2248
  }
2249
+ function normalizePreview(value, depth) {
2250
+ if (!isRecord3(value) || typeof value.kind !== "string") return null;
2251
+ if (value.kind === "null") return { kind: "null" };
2252
+ if (value.kind === "scalar") {
2253
+ if (typeof value.value === "string" || typeof value.value === "boolean" || typeof value.value === "number" && Number.isFinite(value.value)) {
2254
+ return previewValue(value.value, {
2255
+ depth: 0,
2256
+ ancestors: /* @__PURE__ */ new WeakSet(),
2257
+ redactor: createSecretRedactionContext()
2258
+ });
2259
+ }
2260
+ return null;
2261
+ }
2262
+ if (value.kind === "unavailable") {
2263
+ const reason = value.reason;
2264
+ return typeof reason === "string" && [
2265
+ "undefined",
2266
+ "function",
2267
+ "symbol",
2268
+ "bigint",
2269
+ "cycle",
2270
+ "depth",
2271
+ "access_error",
2272
+ "limit",
2273
+ "unsupported"
2274
+ ].includes(reason) ? {
2275
+ kind: "unavailable",
2276
+ reason
2277
+ } : null;
2278
+ }
2279
+ if (value.kind === "dataset") {
2280
+ const datasetId = safeString(
2281
+ value.datasetId,
2282
+ createSecretRedactionContext(),
2283
+ "datasetId"
2284
+ );
2285
+ if (!datasetId || value.datasetKind !== "csv" && value.datasetKind !== "map") {
2286
+ return null;
2287
+ }
2288
+ return {
2289
+ kind: "dataset",
2290
+ datasetId,
2291
+ datasetKind: value.datasetKind,
2292
+ ...value.tableNamespace === null ? { tableNamespace: null } : typeof value.tableNamespace === "string" ? {
2293
+ tableNamespace: safeString(
2294
+ value.tableNamespace,
2295
+ createSecretRedactionContext(),
2296
+ "tableNamespace"
2297
+ )
2298
+ } : {},
2299
+ ...typeof value.rowCount === "number" && Number.isFinite(value.rowCount) ? { rowCount: Math.max(0, Math.floor(value.rowCount)) } : {}
2300
+ };
2301
+ }
2302
+ if (depth >= DOCFLOW_NODE_IO_LIMITS.maxDepth) {
2303
+ return { kind: "unavailable", reason: "depth" };
2304
+ }
2305
+ if (value.kind === "array" && Array.isArray(value.items)) {
2306
+ const items = value.items.slice(0, DOCFLOW_NODE_IO_LIMITS.maxArrayItems).map((item) => normalizePreview(item, depth + 1)).filter((item) => item !== null);
2307
+ const totalItems = typeof value.totalItems === "number" && Number.isFinite(value.totalItems) ? Math.max(items.length, Math.floor(value.totalItems)) : items.length;
2308
+ return {
2309
+ kind: "array",
2310
+ items,
2311
+ totalItems,
2312
+ ...value.truncated === true || totalItems > items.length ? { truncated: true } : {}
2313
+ };
2314
+ }
2315
+ if (value.kind === "object" && isRecord3(value.fields)) {
2316
+ const fields = {};
2317
+ for (const [key, field] of Object.entries(value.fields).slice(
2318
+ 0,
2319
+ DOCFLOW_NODE_IO_LIMITS.maxObjectFields
2320
+ )) {
2321
+ const normalized = normalizePreview(field, depth + 1);
2322
+ if (normalized) fields[ledgerSafeDocflowPreviewKey(key)] = normalized;
2323
+ }
2324
+ const totalFields = typeof value.totalFields === "number" && Number.isFinite(value.totalFields) ? Math.max(Object.keys(fields).length, Math.floor(value.totalFields)) : Object.keys(fields).length;
2325
+ return {
2326
+ kind: "object",
2327
+ fields,
2328
+ totalFields,
2329
+ ...value.truncated === true || totalFields > Object.keys(fields).length ? { truncated: true } : {}
2330
+ };
2331
+ }
2332
+ return null;
2333
+ }
2334
+ function normalizePlayDocflowNodeIoState(value) {
2335
+ if (!isRecord3(value)) return void 0;
2336
+ const attempt = typeof value.attempt === "number" && Number.isFinite(value.attempt) ? Math.max(0, Math.floor(value.attempt)) : 0;
2337
+ const normalizeMap = (raw) => {
2338
+ if (!isRecord3(raw)) return void 0;
2339
+ const output2 = {};
2340
+ for (const [path, preview] of Object.entries(raw).slice(
2341
+ 0,
2342
+ DOCFLOW_NODE_IO_LIMITS.maxPaths
2343
+ )) {
2344
+ const normalized = normalizePreview(preview, 0);
2345
+ if (!normalized) continue;
2346
+ const safePath = ledgerSafeDocflowPreviewKey(path);
2347
+ const candidate = { ...output2, [safePath]: normalized };
2348
+ if (utf8Bytes(JSON.stringify(candidate)) > DOCFLOW_NODE_IO_LIMITS.maxPhaseBytes) {
2349
+ break;
2350
+ }
2351
+ output2[safePath] = normalized;
2352
+ }
2353
+ return output2;
2354
+ };
2355
+ const inputs = normalizeMap(value.inputs);
2356
+ const outputs = normalizeMap(value.outputs);
2357
+ const error = typeof value.error === "string" ? buildPlayDocflowNodeErrorPreview(value.error) : value.error === null ? null : void 0;
2358
+ return {
2359
+ attempt,
2360
+ ...typeof value.invocationId === "string" && value.invocationId.trim() ? {
2361
+ invocationId: truncateUtf8(
2362
+ value.invocationId.trim(),
2363
+ DOCFLOW_NODE_IO_LIMITS.maxStringBytes
2364
+ )
2365
+ } : {},
2366
+ ...inputs ? { inputs } : {},
2367
+ ...outputs ? { outputs } : {},
2368
+ ...value.inputsTruncated === true ? { inputsTruncated: true } : {},
2369
+ ...value.outputsTruncated === true ? { outputsTruncated: true } : {},
2370
+ ...error !== void 0 ? { error } : {}
2371
+ };
2372
+ }
2373
+
2374
+ // ../shared_libs/play-runtime/activity-observation.ts
2375
+ function isRecord4(value) {
2376
+ return Boolean(value && typeof value === "object" && !Array.isArray(value));
2377
+ }
2056
2378
  function isPlayActivityObservation(value) {
2057
- if (!isRecord3(value) || value.schemaVersion !== 1 || typeof value.activityId !== "string" || !value.activityId.trim() || typeof value.observedAt !== "number" || !Number.isFinite(value.observedAt) || !isRecord3(value.target) || !isRecord3(value.state)) {
2379
+ if (!isRecord4(value) || value.schemaVersion !== 1 || typeof value.activityId !== "string" || !value.activityId.trim() || typeof value.observedAt !== "number" || !Number.isFinite(value.observedAt) || !isRecord4(value.target) || !isRecord4(value.state)) {
2058
2380
  return false;
2059
2381
  }
2060
2382
  const targetKinds = /* @__PURE__ */ new Set([
@@ -2324,9 +2646,30 @@ function projectPlayRunActivity(input2) {
2324
2646
  return projection(fallback, now, normalizedStatus !== "waiting");
2325
2647
  }
2326
2648
 
2649
+ // ../shared_libs/play-runtime/cell-provenance.ts
2650
+ function finiteNonNegativeInteger2(value) {
2651
+ if (typeof value !== "number" || !Number.isFinite(value) || value < 0) {
2652
+ return null;
2653
+ }
2654
+ return Math.trunc(value);
2655
+ }
2656
+ function nonEmptyString(value) {
2657
+ if (typeof value !== "string") return null;
2658
+ const trimmed = value.trim();
2659
+ return trimmed ? trimmed : null;
2660
+ }
2661
+ function normalizeDatasetBornFrom(value) {
2662
+ if (!value || typeof value !== "object" || Array.isArray(value)) return null;
2663
+ const record = value;
2664
+ const table = nonEmptyString(record.table);
2665
+ const rowCountIn = finiteNonNegativeInteger2(record.rowCountIn);
2666
+ if (!table || rowCountIn === null) return null;
2667
+ return { table, rowCountIn };
2668
+ }
2669
+
2327
2670
  // ../shared_libs/play-runtime/run-ledger.ts
2328
2671
  var LOG_TAIL_LIMIT = 100;
2329
- function isRecord4(value) {
2672
+ function isRecord5(value) {
2330
2673
  return Boolean(value && typeof value === "object" && !Array.isArray(value));
2331
2674
  }
2332
2675
  function finiteNumber(value) {
@@ -2422,21 +2765,21 @@ function createEmptyPlayRunLedgerSnapshot(input2) {
2422
2765
  };
2423
2766
  }
2424
2767
  function normalizePlayRunLedgerSnapshot(value, fallback) {
2425
- if (!isRecord4(value)) {
2768
+ if (!isRecord5(value)) {
2426
2769
  return createEmptyPlayRunLedgerSnapshot(fallback);
2427
2770
  }
2428
2771
  const orderedStepIds = Array.isArray(value.orderedStepIds) ? value.orderedStepIds.filter(
2429
2772
  (entry) => typeof entry === "string" && Boolean(entry.trim())
2430
2773
  ) : [];
2431
- const rawSteps = isRecord4(value.stepsById) ? value.stepsById : {};
2774
+ const rawSteps = isRecord5(value.stepsById) ? value.stepsById : {};
2432
2775
  const stepsById = {};
2433
2776
  for (const [stepId, rawStep] of Object.entries(rawSteps)) {
2434
- if (!stepId.trim() || !isRecord4(rawStep)) continue;
2777
+ if (!stepId.trim() || !isRecord5(rawStep)) continue;
2435
2778
  const rawStatus = normalizeStepStatus(rawStep.status);
2436
2779
  if (!rawStatus) continue;
2437
2780
  const completedAt = finiteNumber(rawStep.completedAt);
2438
2781
  const status = rawStatus === "running" && completedAt !== null ? "completed" : rawStatus;
2439
- const rawProgress = isRecord4(rawStep.progress) ? rawStep.progress : null;
2782
+ const rawProgress = isRecord5(rawStep.progress) ? rawStep.progress : null;
2440
2783
  stepsById[stepId] = {
2441
2784
  stepId,
2442
2785
  label: optionalString(rawStep.label),
@@ -2452,11 +2795,12 @@ function normalizePlayRunLedgerSnapshot(value, fallback) {
2452
2795
  progress: rawProgress ? normalizeStepProgress(rawProgress) : null
2453
2796
  };
2454
2797
  }
2455
- const rawDatasets = isRecord4(value.datasetsById) ? value.datasetsById : {};
2798
+ const rawDatasets = isRecord5(value.datasetsById) ? value.datasetsById : {};
2456
2799
  const datasetsById = {};
2457
2800
  for (const [datasetId, rawDataset] of Object.entries(rawDatasets)) {
2458
- if (!datasetId.trim() || !isRecord4(rawDataset)) continue;
2801
+ if (!datasetId.trim() || !isRecord5(rawDataset)) continue;
2459
2802
  const phase = rawDataset.phase === "available" || rawDataset.phase === "failed" ? rawDataset.phase : "registered";
2803
+ const datasetBornFrom = normalizeDatasetBornFrom(rawDataset.bornFrom);
2460
2804
  datasetsById[datasetId] = {
2461
2805
  datasetId,
2462
2806
  path: optionalString(rawDataset.path) ?? `datasets.${datasetId}`,
@@ -2466,10 +2810,14 @@ function normalizePlayRunLedgerSnapshot(value, fallback) {
2466
2810
  succeededRows: Math.max(0, finiteNumber(rawDataset.succeededRows) ?? 0),
2467
2811
  failedRows: Math.max(0, finiteNumber(rawDataset.failedRows) ?? 0),
2468
2812
  complete: rawDataset.complete === true,
2813
+ // ADR 0019 birth survives the snapshot round trip. A partial record is
2814
+ // dropped rather than half-admitted, so a dataset either states where its
2815
+ // rows came from or says nothing.
2816
+ ...datasetBornFrom ? { bornFrom: datasetBornFrom } : {},
2469
2817
  updatedAt: finiteNumber(rawDataset.updatedAt) ?? 0
2470
2818
  };
2471
2819
  }
2472
- const rawActivities = isRecord4(value.activitiesById) ? value.activitiesById : {};
2820
+ const rawActivities = isRecord5(value.activitiesById) ? value.activitiesById : {};
2473
2821
  const activitiesById = {};
2474
2822
  for (const [activityId, rawActivity] of Object.entries(rawActivities)) {
2475
2823
  if (activityId.trim() && isPlayActivityObservation(rawActivity) && rawActivity.activityId === activityId) {
@@ -2546,7 +2894,8 @@ function normalizeStepProgress(value) {
2546
2894
  } : {},
2547
2895
  ...finiteNumber(value.startedAt) !== null ? { startedAt: finiteNumber(value.startedAt) } : {},
2548
2896
  ...finiteNumber(value.completedAt) !== null ? { completedAt: finiteNumber(value.completedAt) } : {},
2549
- ...finiteNumber(value.updatedAt) !== null ? { updatedAt: finiteNumber(value.updatedAt) } : {}
2897
+ ...finiteNumber(value.updatedAt) !== null ? { updatedAt: finiteNumber(value.updatedAt) } : {},
2898
+ ...normalizePlayDocflowNodeIoState(value.nodeIo) ? { nodeIo: normalizePlayDocflowNodeIoState(value.nodeIo) } : {}
2550
2899
  };
2551
2900
  }
2552
2901
 
@@ -2618,18 +2967,18 @@ function normalizePlayRunLiveStatus(value) {
2618
2967
  function isTerminalPlayRunLiveStatus(status) {
2619
2968
  return isTerminalPlayRunLifecycleStatus(status);
2620
2969
  }
2621
- function isRecord5(value) {
2970
+ function isRecord6(value) {
2622
2971
  return Boolean(value && typeof value === "object" && !Array.isArray(value));
2623
2972
  }
2624
2973
  function finiteNumber2(value) {
2625
2974
  return typeof value === "number" && Number.isFinite(value) ? value : null;
2626
2975
  }
2627
2976
  function extractTerminalRunLogTail(result) {
2628
- if (!isRecord5(result) || !isRecord5(result._metadata)) {
2977
+ if (!isRecord6(result) || !isRecord6(result._metadata)) {
2629
2978
  return null;
2630
2979
  }
2631
2980
  const runLogTail = result._metadata.runLogTail;
2632
- if (!isRecord5(runLogTail) || !Array.isArray(runLogTail.tail)) {
2981
+ if (!isRecord6(runLogTail) || !Array.isArray(runLogTail.tail)) {
2633
2982
  return null;
2634
2983
  }
2635
2984
  const logTail = runLogTail.tail.filter(
@@ -2665,11 +3014,13 @@ function buildSnapshotFromLedger(snapshot) {
2665
3014
  artifactTableNamespace: step.progress.artifactTableNamespace ?? step.artifactTableNamespace ?? null,
2666
3015
  startedAt: step.startedAt ?? null,
2667
3016
  completedAt: step.completedAt ?? null,
2668
- updatedAt: step.progress.updatedAt ?? step.updatedAt ?? null
3017
+ updatedAt: step.progress.updatedAt ?? step.updatedAt ?? null,
3018
+ nodeIo: step.progress.nodeIo
2669
3019
  } : null,
2670
3020
  startedAt: step.startedAt ?? null,
2671
3021
  completedAt: step.completedAt ?? null,
2672
- updatedAt: step.updatedAt ?? null
3022
+ updatedAt: step.updatedAt ?? null,
3023
+ ...step.progress?.nodeIo ? { nodeIo: step.progress.nodeIo } : {}
2673
3024
  }));
2674
3025
  const liveStatus = normalizePlayRunLiveStatus(snapshot.status);
2675
3026
  const rowOutcomes = isTerminalPlayRunLiveStatus(liveStatus) && Object.keys(snapshot.stepsById).length > 0 ? summarizeRunRowOutcomes(snapshot) : null;
@@ -3419,8 +3770,17 @@ function resolvePlayRunRuntimeSelection(request) {
3419
3770
  const configuredToken = process.env.DEEPLINE_RUNTIME_ENVIRONMENT_TOKEN?.trim();
3420
3771
  if (!configured) {
3421
3772
  if (configuredNamespace || configuredToken) {
3773
+ const present = [];
3774
+ if (configuredNamespace) present.push("DEEPLINE_RUNTIME_NAMESPACE");
3775
+ if (configuredToken) present.push("DEEPLINE_RUNTIME_ENVIRONMENT_TOKEN");
3776
+ const isPlural = present.length > 1;
3422
3777
  throw new DeeplineError(
3423
- "DEEPLINE_RUNTIME_ENVIRONMENT=preview and DEEPLINE_RUNTIME_NAMESPACE are required when runtime selection configuration is present.",
3778
+ [
3779
+ `Incomplete play runtime selection: ${present.join(" and ")} ${isPlural ? "are" : "is"} set but DEEPLINE_RUNTIME_ENVIRONMENT is not.`,
3780
+ "Preview routing requires DEEPLINE_RUNTIME_ENVIRONMENT=preview together with DEEPLINE_RUNTIME_NAMESPACE; the token alone authorizes nothing.",
3781
+ `If you did not export ${isPlural ? "these" : "this"} yourself, ${isPlural ? "they were" : "it was"} most likely auto-loaded from a .env or .env.local in the current directory (bun loads those automatically, and in a git worktree .env.local is usually a symlink to the main checkout).`,
3782
+ `To run against the app-native runtime, clear ${isPlural ? "them" : "it"} for this command: ${present.map((name) => `${name}=`).join(" ")} <your deepline command>`
3783
+ ].join("\n"),
3424
3784
  void 0,
3425
3785
  "INVALID_RUNTIME_ENVIRONMENT"
3426
3786
  );
@@ -3588,7 +3948,7 @@ function requireTargetBillingIdempotencyKey(value) {
3588
3948
  }
3589
3949
  return normalized;
3590
3950
  }
3591
- function isRecord6(value) {
3951
+ function isRecord7(value) {
3592
3952
  return Boolean(value && typeof value === "object" && !Array.isArray(value));
3593
3953
  }
3594
3954
  function isPrebuiltPlayDescription(play) {
@@ -3760,7 +4120,7 @@ function updatePlayLiveStatusState(state, event) {
3760
4120
  }
3761
4121
  const runId = typeof payload.runId === "string" && payload.runId ? payload.runId : isPlayRunPackage(payload) ? payload.run.id : state.runId;
3762
4122
  const status = normalizeLiveStatus(payload.status) ?? (isPlayRunPackage(payload) ? normalizeLiveStatus(payload.run.status) : null) ?? state.status;
3763
- const progressPayload = isRecord6(payload.progress) ? payload.progress : {};
4123
+ const progressPayload = isRecord7(payload.progress) ? payload.progress : {};
3764
4124
  if (event.type === "play.run.final_status" && state.logs.length === 0 && state.lastLogSeq === 0) {
3765
4125
  const payloadLogs = readStringArray(payload.logs);
3766
4126
  const progressLogs = readStringArray(progressPayload.logs);
@@ -3903,9 +4263,9 @@ var DeeplineClient = class {
3903
4263
  return fields.length > 0 ? { fields } : schema;
3904
4264
  }
3905
4265
  schemaMetadata(schema, key) {
3906
- if (!isRecord6(schema)) return null;
4266
+ if (!isRecord7(schema)) return null;
3907
4267
  const value = schema[key];
3908
- return isRecord6(value) ? value : null;
4268
+ return isRecord7(value) ? value : null;
3909
4269
  }
3910
4270
  playRunCommand(play, options) {
3911
4271
  const target = play.reference || play.name;
@@ -3954,7 +4314,7 @@ var DeeplineClient = class {
3954
4314
  aliases,
3955
4315
  inputSchema: options?.compact ? this.compactSchema(play.inputSchema) : play.inputSchema ?? null,
3956
4316
  outputSchema: options?.compact ? this.compactSchema(play.outputSchema) : play.outputSchema ?? null,
3957
- staticPipeline: isRecord6(play.staticPipeline) ? play.staticPipeline : isRecord6(play.currentRevision?.staticPipeline) ? play.currentRevision.staticPipeline : isRecord6(play.liveRevision?.staticPipeline) ? play.liveRevision.staticPipeline : null,
4317
+ staticPipeline: isRecord7(play.staticPipeline) ? play.staticPipeline : isRecord7(play.currentRevision?.staticPipeline) ? play.currentRevision.staticPipeline : isRecord7(play.liveRevision?.staticPipeline) ? play.liveRevision.staticPipeline : null,
3958
4318
  ...csvInput ? { csvInput } : {},
3959
4319
  ...rowOutputSchema ? { rowOutputSchema } : {},
3960
4320
  runCommand: runCommand2,
@@ -9130,14 +9490,14 @@ function sanitizeCsvProjectionInfo(input2) {
9130
9490
  const rows = input2.rows.map(stripCsvProjectionFields);
9131
9491
  return { rows, columns };
9132
9492
  }
9133
- function isRecord7(value) {
9493
+ function isRecord8(value) {
9134
9494
  return Boolean(value && typeof value === "object" && !Array.isArray(value));
9135
9495
  }
9136
9496
  function isSerializedDataset(value) {
9137
- return isRecord7(value) && value.kind === "dataset" && typeof value.count === "number" && (Array.isArray(value.preview) || typeof value.tableNamespace === "string");
9497
+ return isRecord8(value) && value.kind === "dataset" && typeof value.count === "number" && (Array.isArray(value.preview) || typeof value.tableNamespace === "string");
9138
9498
  }
9139
9499
  function isPackagedDatasetOutput(value) {
9140
- return isRecord7(value) && value.kind === "dataset" && isRecord7(value.preview) && Array.isArray(value.preview.rows);
9500
+ return isRecord8(value) && value.kind === "dataset" && isRecord8(value.preview) && Array.isArray(value.preview.rows);
9141
9501
  }
9142
9502
  function pathParts(path) {
9143
9503
  return path.split(".").map((part) => part.trim()).filter(Boolean);
@@ -9145,7 +9505,7 @@ function pathParts(path) {
9145
9505
  function valueAtPath(root, path) {
9146
9506
  let cursor = root;
9147
9507
  for (const part of pathParts(path)) {
9148
- if (!isRecord7(cursor)) {
9508
+ if (!isRecord8(cursor)) {
9149
9509
  return void 0;
9150
9510
  }
9151
9511
  cursor = cursor[part];
@@ -9153,17 +9513,17 @@ function valueAtPath(root, path) {
9153
9513
  return cursor;
9154
9514
  }
9155
9515
  function totalRowsForDataset(result, datasetPath) {
9156
- const metadata = isRecord7(result._metadata) ? result._metadata : null;
9516
+ const metadata = isRecord8(result._metadata) ? result._metadata : null;
9157
9517
  const parentPath = datasetPath.split(".").slice(0, -1).join(".");
9158
9518
  const parent = parentPath ? valueAtPath({ result }, parentPath) : result;
9159
- return metadata?.totalRows ?? metadata?.rowCount ?? metadata?.count ?? (isRecord7(parent) ? parent.totalRows ?? parent.rowCount ?? parent.count : void 0) ?? result.totalRows ?? result.rowCount ?? result.count;
9519
+ return metadata?.totalRows ?? metadata?.rowCount ?? metadata?.count ?? (isRecord8(parent) ? parent.totalRows ?? parent.rowCount ?? parent.count : void 0) ?? result.totalRows ?? result.rowCount ?? result.count;
9160
9520
  }
9161
9521
  function rowArray(value) {
9162
9522
  if (!Array.isArray(value)) {
9163
9523
  return null;
9164
9524
  }
9165
9525
  const rows = value.filter(
9166
- (row) => isRecord7(row)
9526
+ (row) => isRecord8(row)
9167
9527
  );
9168
9528
  return rows.length === value.length ? rows : null;
9169
9529
  }
@@ -9187,7 +9547,7 @@ function inferColumns(rows) {
9187
9547
  return columns;
9188
9548
  }
9189
9549
  function columnsFromDatasetSummary(summary) {
9190
- if (!isRecord7(summary) || !isRecord7(summary.columnStats)) {
9550
+ if (!isRecord8(summary) || !isRecord8(summary.columnStats)) {
9191
9551
  return [];
9192
9552
  }
9193
9553
  return Object.keys(summary.columnStats).filter((column) => column);
@@ -9235,7 +9595,7 @@ function canonicalRowsInfoFromCandidate(input2) {
9235
9595
  datasetId: typeof candidate.value.datasetId === "string" ? candidate.value.datasetId : null,
9236
9596
  tableNamespace: typeof candidate.value.tableNamespace === "string" ? candidate.value.tableNamespace : null,
9237
9597
  ...candidate.value.recovered === true ? { recovered: true } : {},
9238
- ...isRecord7(candidate.value.exportUnavailable) && (candidate.value.exportUnavailable.reason === "empty_dataset" || candidate.value.exportUnavailable.reason === "shared_table_namespace") ? {
9598
+ ...isRecord8(candidate.value.exportUnavailable) && (candidate.value.exportUnavailable.reason === "empty_dataset" || candidate.value.exportUnavailable.reason === "shared_table_namespace") ? {
9239
9599
  exportUnavailableReason: candidate.value.exportUnavailable.reason,
9240
9600
  ...typeof candidate.value.exportUnavailable.message === "string" ? {
9241
9601
  exportUnavailableMessage: candidate.value.exportUnavailable.message
@@ -9283,7 +9643,7 @@ function collectDatasetCandidates(input2) {
9283
9643
  });
9284
9644
  return;
9285
9645
  }
9286
- if (!isRecord7(input2.value)) {
9646
+ if (!isRecord8(input2.value)) {
9287
9647
  return;
9288
9648
  }
9289
9649
  for (const [key, child] of Object.entries(input2.value)) {
@@ -9300,12 +9660,12 @@ function collectDatasetCandidates(input2) {
9300
9660
  }
9301
9661
  }
9302
9662
  function collectCanonicalRowsInfos(statusOrResult) {
9303
- const root = isRecord7(statusOrResult) ? statusOrResult : null;
9304
- const result = isRecord7(root?.result) ? root.result : root;
9663
+ const root = isRecord8(statusOrResult) ? statusOrResult : null;
9664
+ const result = isRecord8(root?.result) ? root.result : root;
9305
9665
  if (!result) {
9306
9666
  return [];
9307
9667
  }
9308
- const metadata = isRecord7(result._metadata) ? result._metadata : null;
9668
+ const metadata = isRecord8(result._metadata) ? result._metadata : null;
9309
9669
  const totalFromMetadata = metadata?.totalRows ?? metadata?.rowCount ?? metadata?.count;
9310
9670
  const candidates = [
9311
9671
  {
@@ -9329,8 +9689,8 @@ function collectCanonicalRowsInfos(statusOrResult) {
9329
9689
  total: totalFromMetadata ?? result.totalRows ?? result.rowCount ?? result.count
9330
9690
  }
9331
9691
  ];
9332
- if (isRecord7(result.output)) {
9333
- const outputMetadata = isRecord7(result.output._metadata) ? result.output._metadata : null;
9692
+ if (isRecord8(result.output)) {
9693
+ const outputMetadata = isRecord8(result.output._metadata) ? result.output._metadata : null;
9334
9694
  const outputTotalFromMetadata = outputMetadata?.totalRows ?? outputMetadata?.rowCount ?? outputMetadata?.count;
9335
9695
  candidates.push(
9336
9696
  {
@@ -9357,14 +9717,14 @@ function collectCanonicalRowsInfos(statusOrResult) {
9357
9717
  }
9358
9718
  if (Array.isArray(result.steps)) {
9359
9719
  result.steps.forEach((step, index) => {
9360
- if (!isRecord7(step) || !isRecord7(step.output)) {
9720
+ if (!isRecord8(step) || !isRecord8(step.output)) {
9361
9721
  return;
9362
9722
  }
9363
9723
  const source = typeof step.output.path === "string" ? step.output.path : typeof step.id === "string" ? `steps.${step.id}.output` : `steps.${index}.output`;
9364
9724
  candidates.push({
9365
9725
  source,
9366
9726
  value: step.output,
9367
- total: step.output.rowCount ?? (isRecord7(step.output.preview) ? step.output.preview.totalRows : void 0) ?? (isRecord7(step.progress) ? step.progress.total : void 0)
9727
+ total: step.output.rowCount ?? (isRecord8(step.output.preview) ? step.output.preview.totalRows : void 0) ?? (isRecord8(step.progress) ? step.progress.total : void 0)
9368
9728
  });
9369
9729
  });
9370
9730
  }
@@ -9392,15 +9752,15 @@ function collectCanonicalRowsInfos(statusOrResult) {
9392
9752
  return infos;
9393
9753
  }
9394
9754
  function collectPackagedDatasetCandidates(statusOrResult) {
9395
- const root = isRecord7(statusOrResult) ? statusOrResult : null;
9755
+ const root = isRecord8(statusOrResult) ? statusOrResult : null;
9396
9756
  if (!root) {
9397
9757
  return [];
9398
9758
  }
9399
- const pkg = isRecord7(root.package) ? root.package : root;
9759
+ const pkg = isRecord8(root.package) ? root.package : root;
9400
9760
  const datasets = Array.isArray(pkg.datasets) ? pkg.datasets : [];
9401
9761
  const candidates = [];
9402
9762
  for (const output2 of datasets) {
9403
- if (!isRecord7(output2) || !isPackagedDatasetOutput(output2)) {
9763
+ if (!isRecord8(output2) || !isPackagedDatasetOutput(output2)) {
9404
9764
  continue;
9405
9765
  }
9406
9766
  const source = typeof output2.path === "string" && output2.path.trim() ? output2.path.trim() : null;
@@ -9410,18 +9770,18 @@ function collectPackagedDatasetCandidates(statusOrResult) {
9410
9770
  candidates.push({
9411
9771
  source,
9412
9772
  value: output2,
9413
- total: output2.rowCount ?? (isRecord7(output2.preview) ? output2.preview.totalRows : void 0)
9773
+ total: output2.rowCount ?? (isRecord8(output2.preview) ? output2.preview.totalRows : void 0)
9414
9774
  });
9415
9775
  }
9416
9776
  return candidates;
9417
9777
  }
9418
9778
  function collectPackagedStepDatasetCandidates(statusOrResult) {
9419
- const root = isRecord7(statusOrResult) ? statusOrResult : null;
9779
+ const root = isRecord8(statusOrResult) ? statusOrResult : null;
9420
9780
  if (!root) return [];
9421
- const pkg = isRecord7(root.package) ? root.package : root;
9781
+ const pkg = isRecord8(root.package) ? root.package : root;
9422
9782
  const steps = Array.isArray(pkg.steps) ? pkg.steps : [];
9423
9783
  return steps.flatMap((step) => {
9424
- if (!isRecord7(step) || !isPackagedDatasetOutput(step.output)) return [];
9784
+ if (!isRecord8(step) || !isPackagedDatasetOutput(step.output)) return [];
9425
9785
  const source = typeof step.output.path === "string" && step.output.path.trim() ? step.output.path.trim() : null;
9426
9786
  return source ? [
9427
9787
  {
@@ -9433,8 +9793,8 @@ function collectPackagedStepDatasetCandidates(statusOrResult) {
9433
9793
  });
9434
9794
  }
9435
9795
  function collectSerializedDatasetRowsInfos(statusOrResult) {
9436
- const root = isRecord7(statusOrResult) ? statusOrResult : null;
9437
- const result = isRecord7(root?.result) ? root.result : root;
9796
+ const root = isRecord8(statusOrResult) ? statusOrResult : null;
9797
+ const result = isRecord8(root?.result) ? root.result : root;
9438
9798
  const candidates = [];
9439
9799
  if (result) {
9440
9800
  collectDatasetCandidates({
@@ -9442,7 +9802,7 @@ function collectSerializedDatasetRowsInfos(statusOrResult) {
9442
9802
  path: "result",
9443
9803
  output: candidates
9444
9804
  });
9445
- if (isRecord7(result.output)) {
9805
+ if (isRecord8(result.output)) {
9446
9806
  collectDatasetCandidates({
9447
9807
  value: result.output,
9448
9808
  path: "result",
@@ -9520,13 +9880,13 @@ function summarizeSampleValue(value, depth = 0) {
9520
9880
  if (typeof parsed === "number" || typeof parsed === "boolean") return parsed;
9521
9881
  if (depth >= 3) {
9522
9882
  if (Array.isArray(parsed)) return [];
9523
- if (isRecord7(parsed)) return {};
9883
+ if (isRecord8(parsed)) return {};
9524
9884
  return compactScalar(parsed);
9525
9885
  }
9526
9886
  if (Array.isArray(parsed)) {
9527
9887
  return parsed.slice(0, 3).map((item) => summarizeSampleValue(item, depth + 1));
9528
9888
  }
9529
- if (isRecord7(parsed)) {
9889
+ if (isRecord8(parsed)) {
9530
9890
  const out = {};
9531
9891
  for (const [key, nested] of Object.entries(parsed)) {
9532
9892
  if (["__dl", "meta", "metadata"].includes(key)) {
@@ -9557,7 +9917,7 @@ function compactCell(value) {
9557
9917
  }
9558
9918
  return `[${parsed.length} items]`;
9559
9919
  }
9560
- if (isRecord7(parsed)) {
9920
+ if (isRecord8(parsed)) {
9561
9921
  for (const key of ["matched_result", "output"]) {
9562
9922
  if (parsed[key] !== null && parsed[key] !== void 0 && parsed[key] !== "") {
9563
9923
  return compactCell(parsed[key]);
@@ -10622,17 +10982,17 @@ function parsePositiveInteger2(value, flagName) {
10622
10982
  }
10623
10983
  return parsed;
10624
10984
  }
10625
- function isRecord8(value) {
10985
+ function isRecord9(value) {
10626
10986
  return Boolean(value && typeof value === "object" && !Array.isArray(value));
10627
10987
  }
10628
10988
  function stringValue(value) {
10629
10989
  return typeof value === "string" ? value.trim() : "";
10630
10990
  }
10631
10991
  function extractionEntries(value) {
10632
- if (Array.isArray(value)) return value.filter(isRecord8);
10633
- if (!isRecord8(value)) return [];
10992
+ if (Array.isArray(value)) return value.filter(isRecord9);
10993
+ if (!isRecord9(value)) return [];
10634
10994
  return Object.entries(value).map(
10635
- ([name, entry]) => isRecord8(entry) ? { name, ...entry } : { name }
10995
+ ([name, entry]) => isRecord9(entry) ? { name, ...entry } : { name }
10636
10996
  );
10637
10997
  }
10638
10998
  var PlayBootstrapError = class extends Error {
@@ -11194,7 +11554,7 @@ function readCsvSampleRows(sample) {
11194
11554
  relax_column_count: true,
11195
11555
  trim: true
11196
11556
  });
11197
- return Array.isArray(parsedRows) ? parsedRows.filter(isRecord8) : [];
11557
+ return Array.isArray(parsedRows) ? parsedRows.filter(isRecord9) : [];
11198
11558
  }
11199
11559
  function readSourceCsvColumnSpecs(csvPath) {
11200
11560
  const sample = readCsvSample(csvPath);
@@ -11227,16 +11587,16 @@ function packagedCsvPathForPlay(csvPath) {
11227
11587
  return portablePath.startsWith(".") ? portablePath : `./${portablePath}`;
11228
11588
  }
11229
11589
  function getterNamesFromTool(tool, kind) {
11230
- const usageGuidance = isRecord8(tool?.usageGuidance) ? tool.usageGuidance : {};
11231
- const resultGuidance = isRecord8(usageGuidance.toolExecutionResult) ? usageGuidance.toolExecutionResult : isRecord8(usageGuidance.tool_execution_result) ? usageGuidance.tool_execution_result : {};
11590
+ const usageGuidance = isRecord9(tool?.usageGuidance) ? tool.usageGuidance : {};
11591
+ const resultGuidance = isRecord9(usageGuidance.toolExecutionResult) ? usageGuidance.toolExecutionResult : isRecord9(usageGuidance.tool_execution_result) ? usageGuidance.tool_execution_result : {};
11232
11592
  const key = kind === "list" ? "extractedLists" : "extractedValues";
11233
11593
  const snakeKey = kind === "list" ? "extracted_lists" : "extracted_values";
11234
11594
  return extractionEntries(resultGuidance[key] ?? resultGuidance[snakeKey]).map((entry) => stringValue(entry.name)).filter(Boolean);
11235
11595
  }
11236
11596
  function targetGettersFromTool(tool) {
11237
- const record = isRecord8(tool) ? tool : {};
11597
+ const record = isRecord9(tool) ? tool : {};
11238
11598
  const raw = record.targetGetters ?? record.target_getters;
11239
- if (!isRecord8(raw)) return {};
11599
+ if (!isRecord9(raw)) return {};
11240
11600
  const entries = [];
11241
11601
  for (const [target, value] of Object.entries(raw)) {
11242
11602
  const paths = Array.isArray(value) ? value.map((path) => typeof path === "string" ? path.trim() : "").filter(Boolean) : [];
@@ -11257,10 +11617,10 @@ function listRowCandidateKeysFromTool(tool) {
11257
11617
  return [...keys].sort();
11258
11618
  }
11259
11619
  function inputPropertyNames(schema) {
11260
- if (!isRecord8(schema)) return [];
11261
- if (isRecord8(schema.properties)) return Object.keys(schema.properties);
11620
+ if (!isRecord9(schema)) return [];
11621
+ if (isRecord9(schema.properties)) return Object.keys(schema.properties);
11262
11622
  if (Array.isArray(schema.fields)) {
11263
- return schema.fields.filter(isRecord8).map((field) => stringValue(field.name)).filter(Boolean);
11623
+ return schema.fields.filter(isRecord9).map((field) => stringValue(field.name)).filter(Boolean);
11264
11624
  }
11265
11625
  return [];
11266
11626
  }
@@ -11274,7 +11634,7 @@ function schemaFieldDetails(schema) {
11274
11634
  return { required, optional };
11275
11635
  }
11276
11636
  function jsonSchemaTypeExpression(schema) {
11277
- if (!isRecord8(schema)) return "unknown";
11637
+ if (!isRecord9(schema)) return "unknown";
11278
11638
  const type = schema.type;
11279
11639
  if (Array.isArray(type)) {
11280
11640
  return type.map((entry) => jsonSchemaTypeExpression({ ...schema, type: entry })).join(" | ");
@@ -11304,7 +11664,7 @@ function jsonSchemaTypeExpression(schema) {
11304
11664
  }
11305
11665
  }
11306
11666
  function objectPropertySchema(schema, property) {
11307
- return isRecord8(schema) && isRecord8(schema.properties) ? schema.properties[property] : null;
11667
+ return isRecord9(schema) && isRecord9(schema.properties) ? schema.properties[property] : null;
11308
11668
  }
11309
11669
  function playOutputHasField(schema, field) {
11310
11670
  return objectPropertySchema(schema, field) != null;
@@ -11480,14 +11840,14 @@ ${indent2.slice(2)}}`;
11480
11840
  }
11481
11841
  function requiredPlayInputFields(play) {
11482
11842
  const schema = play?.inputSchema;
11483
- if (!isRecord8(schema)) return [];
11843
+ if (!isRecord9(schema)) return [];
11484
11844
  if (Array.isArray(schema.required)) {
11485
11845
  return schema.required.filter(
11486
11846
  (value) => typeof value === "string"
11487
11847
  );
11488
11848
  }
11489
11849
  if (Array.isArray(schema.fields)) {
11490
- return schema.fields.filter(isRecord8).filter(
11850
+ return schema.fields.filter(isRecord9).filter(
11491
11851
  (field) => field.required === true && typeof field.name === "string"
11492
11852
  ).map((field) => String(field.name));
11493
11853
  }
@@ -11668,7 +12028,7 @@ function validateBootstrapRoutes(input2) {
11668
12028
  }
11669
12029
  }
11670
12030
  function staticPipelineSubsteps(pipeline) {
11671
- if (!isRecord8(pipeline)) return [];
12031
+ if (!isRecord9(pipeline)) return [];
11672
12032
  return [
11673
12033
  ...extractionEntries(pipeline.stages),
11674
12034
  ...extractionEntries(pipeline.substeps)
@@ -11676,7 +12036,7 @@ function staticPipelineSubsteps(pipeline) {
11676
12036
  }
11677
12037
  function playUsesMapBackedRuntime(play) {
11678
12038
  const pipeline = play?.staticPipeline;
11679
- if (!isRecord8(pipeline)) return false;
12039
+ if (!isRecord9(pipeline)) return false;
11680
12040
  if (stringValue(pipeline.tableNamespace)) return true;
11681
12041
  return staticPipelineSubsteps(pipeline).some((substep) => {
11682
12042
  if (stringValue(substep.type) === "map") return true;
@@ -11685,7 +12045,7 @@ function playUsesMapBackedRuntime(play) {
11685
12045
  aliases: [],
11686
12046
  runCommand: "",
11687
12047
  examples: [],
11688
- staticPipeline: isRecord8(substep.pipeline) ? substep.pipeline : null
12048
+ staticPipeline: isRecord9(substep.pipeline) ? substep.pipeline : null
11689
12049
  });
11690
12050
  });
11691
12051
  }
@@ -12280,8 +12640,7 @@ var import_promises3 = require("fs/promises");
12280
12640
  var import_node_os8 = require("os");
12281
12641
  var import_node_path11 = require("path");
12282
12642
  var import_node_module = require("module");
12283
- var import_acorn = require("acorn");
12284
- var import_acorn_typescript = require("acorn-typescript");
12643
+ var import_acorn2 = require("acorn");
12285
12644
  var import_esbuild = require("esbuild");
12286
12645
 
12287
12646
  // ../node_modules/@sinclair/typebox/build/esm/type/guard/value.mjs
@@ -15669,6 +16028,22 @@ var PLAY_AUTHORING_FIELD_REGISTRY = {
15669
16028
  description: "Whether the dataset returns all rows or only newly admitted rows.",
15670
16029
  errorMessage: 'ctx.dataset run mode must be "upsert" or "net_new".'
15671
16030
  },
16031
+ "ctx.dataset.run.undrawnColumns": {
16032
+ schema: Type.Array(Type.String({ minLength: 1 }), { minItems: 1 }),
16033
+ fixtures: {
16034
+ valid: ["miss_reason"],
16035
+ invalid: [],
16036
+ absent: void 0,
16037
+ unresolved: { expression: "undrawnColumns" },
16038
+ edition1: ["miss_reason"]
16039
+ },
16040
+ referenceType: "readonly string[]",
16041
+ required: false,
16042
+ resolution: "static-when-present",
16043
+ issueCode: "play_authoring_dataset_option_invalid",
16044
+ description: "Computed columns deliberately left out of the authored @mermaid diagram.",
16045
+ errorMessage: "ctx.dataset run undrawnColumns must be a non-empty array of static column-name strings."
16046
+ },
15672
16047
  "ctx.step.id": {
15673
16048
  schema: Type.String({ minLength: 1 }),
15674
16049
  fixtures: {
@@ -16156,7 +16531,7 @@ var PLAY_AUTHORING_CLOUD_TYPE_DECLARATIONS = [
16156
16531
  "export type StepProgramOutput<TProgram> = TProgram extends StepProgram<unknown, infer Output, unknown> ? Output : never;",
16157
16532
  "export type DatasetRowKey<InputRow extends object> = (keyof InputRow & string) | readonly (keyof InputRow & string)[] | ((row: InputRow, index: number) => string | number | readonly unknown[]);",
16158
16533
  "export type DatasetDefinitionOptions<InputRow extends object> = { key?: DatasetRowKey<InputRow> };",
16159
- `export type DatasetRunOptions<InputRow extends object> = { description?: ${cloudReferenceType("ctx.dataset.run.description")}; key?: DatasetRowKey<InputRow>; onRowError?: ${cloudReferenceType("ctx.dataset.run.onRowError")}; mode?: ${cloudReferenceType("ctx.dataset.run.mode")} };`,
16534
+ `export type DatasetRunOptions<InputRow extends object> = { description?: ${cloudReferenceType("ctx.dataset.run.description")}; key?: DatasetRowKey<InputRow>; onRowError?: ${cloudReferenceType("ctx.dataset.run.onRowError")}; mode?: ${cloudReferenceType("ctx.dataset.run.mode")}; undrawnColumns?: ${cloudReferenceType("ctx.dataset.run.undrawnColumns")} };`,
16160
16535
  "export type DatasetBuilder<InputRow extends object, OutputRow extends object> = {",
16161
16536
  " withColumn<Name extends string, Value>(name: Name, resolver: ColumnResolver<OutputRow, Value>): DatasetBuilder<InputRow, OutputRow & Record<Name, Value>>;",
16162
16537
  " withColumn<Name extends string, Value>(name: Name, definition: DatasetColumnDefinition<OutputRow, Value> & { readonly runIf: (row: OutputRow, index: number) => boolean | Promise<boolean> }): DatasetBuilder<InputRow, OutputRow & Record<Name, Value | null>>;",
@@ -16187,6 +16562,125 @@ var PLAY_AUTHORING_CLOUD_TYPE_DECLARATIONS = [
16187
16562
  "export type DefinedPlay<TInput, TOutput extends PlayReturnObject> = ((ctx: DeeplinePlayRuntimeContext, input: TInput) => Promise<TOutput>) & { readonly name: string; readonly __inputType?: TInput; readonly __outputType?: TOutput; readonly runtime?: PlayBindings['runtime']; readonly compatibility?: PlayBindings['compatibility'] };"
16188
16563
  ];
16189
16564
 
16565
+ // ../shared_libs/plays/ts-ast.ts
16566
+ var import_acorn = require("acorn");
16567
+ var import_acorn_typescript = require("acorn-typescript");
16568
+ var TypeScriptParser = import_acorn.Parser.extend(
16569
+ (0, import_acorn_typescript.tsPlugin)({
16570
+ allowSatisfies: true,
16571
+ jsx: {
16572
+ allowNamespaces: true,
16573
+ allowNamespacedObjects: true
16574
+ }
16575
+ })
16576
+ );
16577
+ function isAstNode(value) {
16578
+ return value !== null && typeof value === "object" && "type" in value;
16579
+ }
16580
+ function astArray(value) {
16581
+ return Array.isArray(value) ? value.filter(isAstNode) : [];
16582
+ }
16583
+ function parsePlaySourceForAnalysis(sourceCode) {
16584
+ try {
16585
+ return TypeScriptParser.parse(sourceCode, {
16586
+ ecmaVersion: "latest",
16587
+ sourceType: "module",
16588
+ allowHashBang: true
16589
+ });
16590
+ } catch {
16591
+ return null;
16592
+ }
16593
+ }
16594
+
16595
+ // ../shared_libs/plays/play-exports.ts
16596
+ var PLAY_DEFAULT_EXPORT = "default";
16597
+ function getIdentifierName(node) {
16598
+ return isAstNode(node) && node.type === "Identifier" ? typeof node.name === "string" ? node.name : null : null;
16599
+ }
16600
+ function unwrapStaticExpression(node) {
16601
+ let current = node;
16602
+ while (current && (current.type === "TSAsExpression" || current.type === "TSSatisfiesExpression" || current.type === "TSTypeAssertion" || current.type === "TSNonNullExpression" || current.type === "ParenthesizedExpression")) {
16603
+ current = isAstNode(current.expression) ? current.expression : null;
16604
+ }
16605
+ return current;
16606
+ }
16607
+ function isDefinePlayCall(node) {
16608
+ const expression = unwrapStaticExpression(node);
16609
+ if (!expression || expression.type !== "CallExpression") return false;
16610
+ const callee = isAstNode(expression.callee) ? expression.callee : null;
16611
+ if (!callee) return false;
16612
+ if (callee.type === "Identifier") {
16613
+ return callee.name === "definePlay" || callee.name === "defineWorkflow";
16614
+ }
16615
+ if (callee.type === "MemberExpression" && !callee.computed && isAstNode(callee.property) && callee.property.type === "Identifier") {
16616
+ return callee.property.name === "definePlay" || callee.property.name === "defineWorkflow";
16617
+ }
16618
+ return false;
16619
+ }
16620
+ function listPlayFileExports(sourceCode) {
16621
+ const ast = parsePlaySourceForAnalysis(sourceCode);
16622
+ if (!ast) return null;
16623
+ const declarations = /* @__PURE__ */ new Map();
16624
+ const namedExports = /* @__PURE__ */ new Map();
16625
+ let defaultExpression = null;
16626
+ const recordDeclarations = (declaration, exported) => {
16627
+ for (const declarator of astArray(declaration.declarations)) {
16628
+ const name = getIdentifierName(declarator.id);
16629
+ if (!name) continue;
16630
+ declarations.set(
16631
+ name,
16632
+ isAstNode(declarator.init) ? declarator.init : null
16633
+ );
16634
+ if (exported) namedExports.set(name, name);
16635
+ }
16636
+ };
16637
+ for (const statement of astArray(ast.body)) {
16638
+ if (statement.type === "VariableDeclaration") {
16639
+ recordDeclarations(statement, false);
16640
+ continue;
16641
+ }
16642
+ if (statement.type === "ExportDefaultDeclaration") {
16643
+ defaultExpression = isAstNode(statement.declaration) ? statement.declaration : null;
16644
+ continue;
16645
+ }
16646
+ if (statement.type === "TSExportAssignment") {
16647
+ defaultExpression = isAstNode(statement.expression) ? statement.expression : null;
16648
+ continue;
16649
+ }
16650
+ if (statement.type !== "ExportNamedDeclaration") continue;
16651
+ if (isAstNode(statement.declaration) && statement.declaration.type === "VariableDeclaration") {
16652
+ recordDeclarations(statement.declaration, true);
16653
+ }
16654
+ for (const specifier of astArray(statement.specifiers)) {
16655
+ const localName = getIdentifierName(specifier.local);
16656
+ const exportedName = getIdentifierName(specifier.exported);
16657
+ if (localName && exportedName) namedExports.set(exportedName, localName);
16658
+ }
16659
+ }
16660
+ const defaultLocalName = getIdentifierName(
16661
+ unwrapStaticExpression(defaultExpression)
16662
+ );
16663
+ const defaultIsPlay = defaultLocalName ? isDefinePlayCall(declarations.get(defaultLocalName) ?? null) : isDefinePlayCall(defaultExpression);
16664
+ const exports2 = [];
16665
+ const aliasedLocals = /* @__PURE__ */ new Set();
16666
+ if (defaultIsPlay) {
16667
+ const aliases = defaultLocalName ? [...namedExports.entries()].filter(([, local]) => local === defaultLocalName).map(([exported]) => exported) : [];
16668
+ if (defaultLocalName) aliasedLocals.add(defaultLocalName);
16669
+ exports2.push({ name: PLAY_DEFAULT_EXPORT, aliases });
16670
+ }
16671
+ for (const [exportedName, localName] of namedExports) {
16672
+ if (exportedName === PLAY_DEFAULT_EXPORT) continue;
16673
+ if (aliasedLocals.has(localName)) continue;
16674
+ if (!isDefinePlayCall(declarations.get(localName) ?? null)) continue;
16675
+ exports2.push({ name: exportedName, aliases: [] });
16676
+ }
16677
+ return exports2;
16678
+ }
16679
+
16680
+ // ../shared_libs/plays/docflow.ts
16681
+ var MERMAID_NODE_ATTRIBUTES = ["label", "type", "in", "out", "arm"];
16682
+ var LEGACY_DOCFLOW_ATTRIBUTES = ["id", ...MERMAID_NODE_ATTRIBUTES];
16683
+
16190
16684
  // ../shared_libs/plays/secret-guardrails.ts
16191
16685
  var SECRET_ENV_PATTERN = /\bprocess(?:\.env|\[['"]env['"]\])(?:\.|\[['"])([A-Z0-9_]*(?:API[_-]?KEY|TOKEN|SECRET|PASSWORD|PRIVATE[_-]?KEY|ACCESS[_-]?KEY)[A-Z0-9_]*)(?:['"]\])?/g;
16192
16686
  var PRIVATE_KEY_PATTERN = /-----BEGIN (?:RSA |EC |OPENSSH |PGP )?PRIVATE KEY-----/;
@@ -16210,7 +16704,7 @@ function collectInlineSecretFindings(sourceCode) {
16210
16704
  var MAX_PLAY_BUNDLE_BYTES = 30 * 1024 * 1024;
16211
16705
 
16212
16706
  // ../shared_libs/plays/bundling/index.ts
16213
- var PLAY_BUNDLE_CACHE_VERSION = 28;
16707
+ var PLAY_BUNDLE_CACHE_VERSION = 33;
16214
16708
  var PLAY_ARTIFACT_CACHE_DIR = (0, import_node_path11.join)(
16215
16709
  (0, import_node_os8.tmpdir)(),
16216
16710
  `deepline-play-artifacts-v${PLAY_BUNDLE_CACHE_VERSION}`
@@ -16223,15 +16717,6 @@ var NODE_BUILTIN_SET = new Set(
16223
16717
  function extractDefinedPlayName(sourceCode) {
16224
16718
  return extractDefinedPlayMetadata(sourceCode, null)?.name ?? null;
16225
16719
  }
16226
- var TypeScriptParser = import_acorn.Parser.extend(
16227
- (0, import_acorn_typescript.tsPlugin)({
16228
- allowSatisfies: true,
16229
- jsx: {
16230
- allowNamespaces: true,
16231
- allowNamespacedObjects: true
16232
- }
16233
- })
16234
- );
16235
16720
  function parsePlaySourceAst(sourceCode) {
16236
16721
  try {
16237
16722
  return TypeScriptParser.parse(sourceCode, {
@@ -16248,7 +16733,7 @@ function parsePlaySourceAst(sourceCode) {
16248
16733
  legalComments: "none",
16249
16734
  sourcemap: false
16250
16735
  }).code;
16251
- return import_acorn.Parser.parse(transformed, {
16736
+ return import_acorn2.Parser.parse(transformed, {
16252
16737
  ecmaVersion: "latest",
16253
16738
  sourceType: "module",
16254
16739
  allowHashBang: true
@@ -16258,17 +16743,11 @@ function parsePlaySourceAst(sourceCode) {
16258
16743
  }
16259
16744
  }
16260
16745
  }
16261
- function getIdentifierName(node) {
16746
+ function getIdentifierName2(node) {
16262
16747
  return isAstNode(node) && node.type === "Identifier" ? typeof node.name === "string" ? node.name : null : null;
16263
16748
  }
16264
- function isAstNode(value) {
16265
- return value !== null && typeof value === "object" && "type" in value;
16266
- }
16267
- function astArray(value) {
16268
- return Array.isArray(value) ? value.filter(isAstNode) : [];
16269
- }
16270
16749
  function memberExpressionPath(node) {
16271
- const expression = unwrapStaticExpression(node);
16750
+ const expression = unwrapStaticExpression2(node);
16272
16751
  if (!expression) return null;
16273
16752
  if (expression.type === "Identifier" && typeof expression.name === "string") {
16274
16753
  return [expression.name];
@@ -16326,7 +16805,7 @@ function buildPlayMetadataContext(ast) {
16326
16805
  for (const statement of astArray(ast.body)) {
16327
16806
  if (statement.type === "VariableDeclaration") {
16328
16807
  for (const declaration of astArray(statement.declarations)) {
16329
- const name = getIdentifierName(declaration.id);
16808
+ const name = getIdentifierName2(declaration.id);
16330
16809
  if (!name) continue;
16331
16810
  const initializer = isAstNode(declaration.init) ? declaration.init : null;
16332
16811
  declarations.set(
@@ -16349,7 +16828,7 @@ function buildPlayMetadataContext(ast) {
16349
16828
  for (const declaration of astArray(
16350
16829
  statement.declaration.declarations
16351
16830
  )) {
16352
- const name = getIdentifierName(declaration.id);
16831
+ const name = getIdentifierName2(declaration.id);
16353
16832
  if (!name) continue;
16354
16833
  const initializer = isAstNode(declaration.init) ? declaration.init : null;
16355
16834
  declarations.set(
@@ -16363,8 +16842,8 @@ function buildPlayMetadataContext(ast) {
16363
16842
  }
16364
16843
  }
16365
16844
  for (const specifier of astArray(statement.specifiers)) {
16366
- const localName = getIdentifierName(specifier.local);
16367
- const exportedName = getIdentifierName(specifier.exported) ?? (isAstNode(specifier.exported) && specifier.exported.type === "Literal" && typeof specifier.exported.value === "string" ? specifier.exported.value : null);
16845
+ const localName = getIdentifierName2(specifier.local);
16846
+ const exportedName = getIdentifierName2(specifier.exported) ?? (isAstNode(specifier.exported) && specifier.exported.type === "Literal" && typeof specifier.exported.value === "string" ? specifier.exported.value : null);
16368
16847
  if (localName && exportedName) {
16369
16848
  namedExports.set(exportedName, localName);
16370
16849
  }
@@ -16381,7 +16860,7 @@ function buildPlayMetadataContext(ast) {
16381
16860
  }
16382
16861
  return { declarations, namedExports, commonJsExports, defaultExport };
16383
16862
  }
16384
- function unwrapStaticExpression(node) {
16863
+ function unwrapStaticExpression2(node) {
16385
16864
  let current = node ?? null;
16386
16865
  while (current && (current.type === "TSAsExpression" || current.type === "TSSatisfiesExpression" || current.type === "TSTypeAssertion" || current.type === "TSNonNullExpression" || current.type === "ParenthesizedExpression")) {
16387
16866
  current = isAstNode(current.expression) ? current.expression : null;
@@ -16389,7 +16868,7 @@ function unwrapStaticExpression(node) {
16389
16868
  return current;
16390
16869
  }
16391
16870
  function staticStringFromExpression(node, context, seen = /* @__PURE__ */ new Set(), trimResult = true) {
16392
- const expression = unwrapStaticExpression(node);
16871
+ const expression = unwrapStaticExpression2(node);
16393
16872
  if (!expression) return null;
16394
16873
  if (expression.type === "Literal") {
16395
16874
  const value = expression.value;
@@ -16419,7 +16898,7 @@ function staticStringFromExpression(node, context, seen = /* @__PURE__ */ new Se
16419
16898
  if (!value?.trim()) return null;
16420
16899
  return trimResult ? value.trim() : value;
16421
16900
  }
16422
- const identifier = getIdentifierName(expression);
16901
+ const identifier = getIdentifierName2(expression);
16423
16902
  if (!identifier || seen.has(identifier)) return null;
16424
16903
  seen.add(identifier);
16425
16904
  return staticStringFromExpression(
@@ -16444,10 +16923,10 @@ function propertyNameFromKey(property) {
16444
16923
  return null;
16445
16924
  }
16446
16925
  function objectExpressionFromNode(node, context, seen = /* @__PURE__ */ new Set()) {
16447
- const expression = unwrapStaticExpression(node);
16926
+ const expression = unwrapStaticExpression2(node);
16448
16927
  if (!expression) return null;
16449
16928
  if (expression.type === "ObjectExpression") return expression;
16450
- const identifier = getIdentifierName(expression);
16929
+ const identifier = getIdentifierName2(expression);
16451
16930
  if (!identifier || seen.has(identifier)) return null;
16452
16931
  seen.add(identifier);
16453
16932
  return objectExpressionFromNode(
@@ -16514,12 +16993,12 @@ function staticPropertyNames(node, context, ancestors = /* @__PURE__ */ new Set(
16514
16993
  return names;
16515
16994
  }
16516
16995
  function staticNumberFromExpression(node, context, seen = /* @__PURE__ */ new Set()) {
16517
- const expression = unwrapStaticExpression(node);
16996
+ const expression = unwrapStaticExpression2(node);
16518
16997
  if (!expression) return null;
16519
16998
  if (expression.type === "Literal" && typeof expression.value === "number") {
16520
16999
  return expression.value;
16521
17000
  }
16522
- const identifier = getIdentifierName(expression);
17001
+ const identifier = getIdentifierName2(expression);
16523
17002
  if (!identifier || seen.has(identifier)) return null;
16524
17003
  seen.add(identifier);
16525
17004
  return staticNumberFromExpression(
@@ -16608,7 +17087,7 @@ function stringPropertyFromObjectExpression(node, propertyName, context, seenObj
16608
17087
  return value;
16609
17088
  }
16610
17089
  function isDefinePlayCallee(node) {
16611
- const callee = unwrapStaticExpression(node);
17090
+ const callee = unwrapStaticExpression2(node);
16612
17091
  if (!callee) return false;
16613
17092
  if (callee.type === "Identifier" && (callee.name === "definePlay" || callee.name === "defineWorkflow")) {
16614
17093
  return true;
@@ -16620,7 +17099,7 @@ function isDefinePlayCallee(node) {
16620
17099
  return false;
16621
17100
  }
16622
17101
  function playMetadataFromDefinePlayCall(node, context) {
16623
- const expression = unwrapStaticExpression(node);
17102
+ const expression = unwrapStaticExpression2(node);
16624
17103
  if (!expression || expression.type !== "CallExpression" || !isDefinePlayCallee(isAstNode(expression.callee) ? expression.callee : null)) {
16625
17104
  return null;
16626
17105
  }
@@ -16666,13 +17145,13 @@ function resolveExportExpression(exportName, context) {
16666
17145
  if (exportName === "default") {
16667
17146
  const commonJsDefault = context.commonJsExports.get("default");
16668
17147
  if (commonJsDefault) {
16669
- const commonJsDefaultIdentifier = getIdentifierName(
16670
- unwrapStaticExpression(commonJsDefault)
17148
+ const commonJsDefaultIdentifier = getIdentifierName2(
17149
+ unwrapStaticExpression2(commonJsDefault)
16671
17150
  );
16672
17151
  return commonJsDefaultIdentifier ? context.declarations.get(commonJsDefaultIdentifier) ?? commonJsDefault : commonJsDefault;
16673
17152
  }
16674
- const defaultExpression = unwrapStaticExpression(context.defaultExport);
16675
- const defaultIdentifier = getIdentifierName(defaultExpression);
17153
+ const defaultExpression = unwrapStaticExpression2(context.defaultExport);
17154
+ const defaultIdentifier = getIdentifierName2(defaultExpression);
16676
17155
  if (!defaultIdentifier) {
16677
17156
  const defaultExportName = context.namedExports.get("default");
16678
17157
  return defaultExportName ? context.declarations.get(defaultExportName) ?? null : defaultExpression;
@@ -16682,8 +17161,8 @@ function resolveExportExpression(exportName, context) {
16682
17161
  if (exportName) {
16683
17162
  const commonJsExport = context.commonJsExports.get(exportName);
16684
17163
  if (commonJsExport) {
16685
- const commonJsExportIdentifier = getIdentifierName(
16686
- unwrapStaticExpression(commonJsExport)
17164
+ const commonJsExportIdentifier = getIdentifierName2(
17165
+ unwrapStaticExpression2(commonJsExport)
16687
17166
  );
16688
17167
  return commonJsExportIdentifier ? context.declarations.get(commonJsExportIdentifier) ?? commonJsExport : commonJsExport;
16689
17168
  }
@@ -16709,7 +17188,7 @@ function extractDefinedPlayMetadata(sourceCode, exportName) {
16709
17188
  context
16710
17189
  );
16711
17190
  if (directDefaultMetadata) return directDefaultMetadata;
16712
- const defaultIdentifier = getIdentifierName(context.defaultExport);
17191
+ const defaultIdentifier = getIdentifierName2(context.defaultExport);
16713
17192
  if (defaultIdentifier) {
16714
17193
  const defaultMetadata = playMetadataFromDefinePlayCall(
16715
17194
  context.declarations.get(defaultIdentifier),
@@ -17246,6 +17725,79 @@ function isInternalGlueStepId(stepId) {
17246
17725
  return typeof stepId === "string" && stepId.startsWith(INTERNAL_GLUE_NODE_ID_PREFIX);
17247
17726
  }
17248
17727
 
17728
+ // ../shared_libs/play-runtime/log-provenance.ts
17729
+ var LOG_PROVENANCE_CLASSES = [
17730
+ "user",
17731
+ "lifecycle",
17732
+ "replay",
17733
+ "infra",
17734
+ "diagnostic",
17735
+ "receipt"
17736
+ ];
17737
+ var LOG_PROVENANCE_POLICY = {
17738
+ user: { watch: true, ui: true, debug: true },
17739
+ lifecycle: { watch: true, ui: true, debug: true },
17740
+ replay: { watch: false, ui: false, debug: true },
17741
+ infra: { watch: false, ui: false, debug: true },
17742
+ diagnostic: { watch: true, ui: true, debug: true },
17743
+ receipt: { watch: false, ui: false, debug: true }
17744
+ };
17745
+ function logProvenanceReaches(provenance, surface) {
17746
+ return LOG_PROVENANCE_POLICY[provenance][surface];
17747
+ }
17748
+ var PROVENANCE_SENTINEL = "";
17749
+ var PROVENANCE_PREFIX = `${PROVENANCE_SENTINEL}prov:`;
17750
+ function readProvenanceTag(line) {
17751
+ if (!line.startsWith(PROVENANCE_PREFIX)) {
17752
+ return { provenance: null, line };
17753
+ }
17754
+ const end = line.indexOf(PROVENANCE_SENTINEL, PROVENANCE_PREFIX.length);
17755
+ if (end === -1) {
17756
+ return { provenance: null, line };
17757
+ }
17758
+ const candidate = line.slice(PROVENANCE_PREFIX.length, end);
17759
+ const provenance = LOG_PROVENANCE_CLASSES.includes(
17760
+ candidate
17761
+ ) ? candidate : null;
17762
+ return { provenance, line: line.slice(end + 1) };
17763
+ }
17764
+ function classifyLegacyLogLine(line) {
17765
+ const message = stripLeadingTimestamp(line);
17766
+ if (/recovered (?:from checkpoint|response from checkpoint)/i.test(message)) {
17767
+ return "replay";
17768
+ }
17769
+ if (/^\[perf\] runtime receipt\b/i.test(message)) {
17770
+ return "receipt";
17771
+ }
17772
+ if (/^\[perf\] runtime (?:map|state)\b/i.test(message) || /\[worker\] picked up run\b/.test(message) || /\[worker\] heartbeat\b/.test(message) || /\[worker\] progress completedRows=\d+ totalRows=\d+ rowUpdates=\d+/.test(
17773
+ message
17774
+ ) || /\[worker\] step started\b/.test(message) || /\[worker\] Preparing run files\b/.test(message) || /\[worker\] Run files ready\b/.test(message) || /\[worker\] Runtime ready\b/.test(message) || /\[worker\] Sandbox (?:starting|create start|create done|workspace ready|upload start|runner uploaded)\b/.test(
17775
+ message
17776
+ ) || /^\[event\] play\.step\.progress\b/.test(message) || /^\[event\] play\.run\.snapshot\b/.test(message) || /^\[event\] play\.sheet\.summary\b/.test(message)) {
17777
+ return "infra";
17778
+ }
17779
+ if (/^\[warn\]/i.test(message) || /^\[error\]/i.test(message) || /^\[runtime\.[a-z_]*(?:failure|error)\]/i.test(message)) {
17780
+ return "diagnostic";
17781
+ }
17782
+ return "user";
17783
+ }
17784
+ function classifyLogLine(line) {
17785
+ const tagged = readProvenanceTag(line);
17786
+ if (tagged.provenance !== null) {
17787
+ return { provenance: tagged.provenance, line: tagged.line };
17788
+ }
17789
+ return { provenance: classifyLegacyLogLine(tagged.line), line: tagged.line };
17790
+ }
17791
+ function stripLeadingTimestamp(line) {
17792
+ const match = line.match(/^\[([^\]]+)\]\s*([\s\S]*)$/);
17793
+ if (!match) {
17794
+ return line;
17795
+ }
17796
+ const inner = match[1] ?? "";
17797
+ const isTimestamp = !Number.isNaN(new Date(inner).getTime());
17798
+ return isTimestamp ? match[2] ?? line : line;
17799
+ }
17800
+
17249
17801
  // ../shared_libs/play-runtime/fixture-behavior.ts
17250
17802
  var FIXTURE_BEHAVIOR_VERSION = 1;
17251
17803
  var FIXTURE_BEHAVIOR_RESPONSE_VERSION = 2;
@@ -18223,11 +18775,12 @@ function formatUnresolvedPackagedFiles(filePath, unresolvedFileReferences) {
18223
18775
  const details = unresolvedFileReferences.map((unresolved) => `${unresolved.sourceFragment}: ${unresolved.message}`).join("; ");
18224
18776
  return `Failed to package local ctx.csv(...) files in ${filePath}: ${details}`;
18225
18777
  }
18226
- async function collectBundledPlayGraph(entryFile, profile = null) {
18778
+ async function collectBundledPlayGraph(entryFile, profile = null, entryExportName = PLAY_DEFAULT_EXPORT) {
18227
18779
  const playBundler = await loadPlayBundler();
18228
18780
  const nodes = /* @__PURE__ */ new Map();
18229
18781
  const visiting = /* @__PURE__ */ new Set();
18230
18782
  const artifactKind = resolveEnabledExecutionProfile(profile).artifactKind;
18783
+ const rootPath = normalizePlayPath(entryFile);
18231
18784
  const visit = async (filePath) => {
18232
18785
  const absolutePath = normalizePlayPath(filePath);
18233
18786
  const cached = nodes.get(absolutePath);
@@ -18242,7 +18795,8 @@ async function collectBundledPlayGraph(entryFile, profile = null) {
18242
18795
  visiting.add(absolutePath);
18243
18796
  try {
18244
18797
  const bundleResult = await playBundler.bundlePlayFile(absolutePath, {
18245
- target: artifactKind
18798
+ target: artifactKind,
18799
+ ...absolutePath === rootPath && entryExportName !== PLAY_DEFAULT_EXPORT ? { exportName: entryExportName } : {}
18246
18800
  });
18247
18801
  if (bundleResult.success === false) {
18248
18802
  throw new Error(
@@ -18432,6 +18986,12 @@ var TERMINAL_PLAY_STATUSES2 = /* @__PURE__ */ new Set([
18432
18986
  var PLAY_START_TRANSIENT_RETRY_DELAYS_MS = [500, 1500];
18433
18987
  var PLAY_PROGRESS_HEARTBEAT_INTERVAL_MS = 15e3;
18434
18988
  var PLAY_STATUS_HEARTBEAT_INTERVAL_MS = 15e3;
18989
+ function watchSurfaceReaches(state, provenance) {
18990
+ if (logProvenanceReaches(provenance, "watch")) {
18991
+ return true;
18992
+ }
18993
+ return state.verbose === true && logProvenanceReaches(provenance, "debug");
18994
+ }
18435
18995
  function getEventPayload(event) {
18436
18996
  return event.payload && typeof event.payload === "object" ? event.payload : {};
18437
18997
  }
@@ -18468,6 +19028,13 @@ function getStatusFromLiveEvent(event) {
18468
19028
  }
18469
19029
  function readLiveRunField(event, field) {
18470
19030
  const payload = getEventPayload(event);
19031
+ if (field === "waitKind") {
19032
+ const wait = payload.wait ?? getRunRecordFromPackage(payload)?.wait;
19033
+ if (wait && typeof wait === "object" && !Array.isArray(wait)) {
19034
+ const kind = wait.kind;
19035
+ if (typeof kind === "string" && kind.trim()) return kind.trim();
19036
+ }
19037
+ }
18471
19038
  const run = getRunRecordFromPackage(payload);
18472
19039
  const records = [payload, payload.progress, run, run?.progress].filter(
18473
19040
  (value) => Boolean(value && typeof value === "object" && !Array.isArray(value))
@@ -18614,6 +19181,9 @@ function emitLiveDebugTableHints(input2) {
18614
19181
  process.stdout
18615
19182
  );
18616
19183
  }
19184
+ if (!watchSurfaceReaches(input2.state, "infra")) {
19185
+ return;
19186
+ }
18617
19187
  const tableNamespace = extractTableNamespaceFromLiveEvent(input2.event);
18618
19188
  if (!tableNamespace) {
18619
19189
  return;
@@ -18639,15 +19209,17 @@ function describeLiveEventPhase(event) {
18639
19209
  const runId = eventRunId ? ` ${eventRunId}` : "";
18640
19210
  return status ? `${status}${runId}` : null;
18641
19211
  }
18642
- if (event.type === "play.step.status" || event.type === "play.step.progress") {
19212
+ if (event.type === "play.step.progress") {
18643
19213
  const label = typeof payload.label === "string" && payload.label.trim() ? payload.label.trim() : formatStepLabelFromNodeId(payload.stepId);
18644
19214
  if (!label) {
18645
19215
  return null;
18646
19216
  }
18647
19217
  const completed = typeof payload.completed === "number" ? payload.completed : null;
18648
19218
  const total = typeof payload.total === "number" ? payload.total : null;
18649
- const progress = completed !== null && total !== null ? ` ${completed}/${total}` : "";
18650
- return `step ${label}${progress}`;
19219
+ if (completed === null || total === null) {
19220
+ return null;
19221
+ }
19222
+ return `step ${label} ${completed}/${total}`;
18651
19223
  }
18652
19224
  if (event.type === "play.sheet.summary" || event.type === "play.sheet.delta") {
18653
19225
  const table = typeof payload.tableNamespace === "string" ? payload.tableNamespace : "";
@@ -18686,6 +19258,7 @@ function formatStepLabelFromNodeId(raw) {
18686
19258
  return value;
18687
19259
  }
18688
19260
  }
19261
+ var TERMINAL_STEP_STATUSES = /* @__PURE__ */ new Set(["completed", "failed", "skipped"]);
18689
19262
  function getStepTransitionLineFromLiveEvent(event, state) {
18690
19263
  if (event.type !== "play.step.status") {
18691
19264
  return null;
@@ -18704,7 +19277,16 @@ function getStepTransitionLineFromLiveEvent(event, state) {
18704
19277
  if (state.printedStepStatuses.get(stepId) === status) {
18705
19278
  return null;
18706
19279
  }
19280
+ state.terminalStepIds ??= /* @__PURE__ */ new Set();
19281
+ const isTerminal = TERMINAL_STEP_STATUSES.has(status);
19282
+ const isReplayEcho = !isTerminal && state.terminalStepIds.has(stepId);
18707
19283
  state.printedStepStatuses.set(stepId, status);
19284
+ if (isTerminal) {
19285
+ state.terminalStepIds.add(stepId);
19286
+ }
19287
+ if (isReplayEcho && !watchSurfaceReaches(state, "replay")) {
19288
+ return null;
19289
+ }
18708
19290
  return `step ${label}: ${status}`;
18709
19291
  }
18710
19292
  function formatProgressCounts(input2) {
@@ -19095,6 +19677,7 @@ async function startAndWaitForPlayCompletionByStreamOnce(input2) {
19095
19677
  const state = {
19096
19678
  lastLogIndex: 0,
19097
19679
  emittedRunnerStarted: false,
19680
+ verbose: input2.verboseLogs === true,
19098
19681
  lastProgressSignature: null,
19099
19682
  lastProgressHeartbeatAt: 0,
19100
19683
  lastStatusHeartbeatAt: 0
@@ -19459,7 +20042,9 @@ var BULKY_RETURN_KEYS = /* @__PURE__ */ new Set([
19459
20042
  "sequenceTrace",
19460
20043
  "logs"
19461
20044
  ]);
19462
- function formatPlayLogLine(line, status, state) {
20045
+ function formatPlayLogLine(rawLine, status, state) {
20046
+ const classified = classifyLogLine(rawLine);
20047
+ const line = classified.line;
19463
20048
  const timestampMatch = line.match(/^\[([^\]]+)\]\s*(.*)$/);
19464
20049
  const parsedTimestamp = timestampMatch?.[1] ? new Date(timestampMatch[1]) : null;
19465
20050
  const timestamp = parsedTimestamp && !Number.isNaN(parsedTimestamp.getTime()) ? parsedTimestamp.toLocaleTimeString("en-US", {
@@ -19477,11 +20062,6 @@ function formatPlayLogLine(line, status, state) {
19477
20062
  state.emittedRunnerStarted = true;
19478
20063
  return `${prefix}runner started`;
19479
20064
  }
19480
- if (/\[worker\] step started\b/.test(message) || /\[worker\] Preparing run files\b/.test(message) || /\[worker\] Run files ready\b/.test(message) || /\[worker\] Runtime ready\b/.test(message) || /\[worker\] Sandbox (?:starting|create start|create done|workspace ready|upload start|runner uploaded)\b/.test(
19481
- message
19482
- )) {
19483
- return null;
19484
- }
19485
20065
  const stages = (status?.contract?.staticPipeline?.stages ?? []).filter((stage) => stage.tableNamespace);
19486
20066
  const sourceLabelForNamespace = (namespace) => {
19487
20067
  const stage = stages.find((entry) => entry.tableNamespace === namespace);
@@ -19502,6 +20082,9 @@ function formatPlayLogLine(line, status, state) {
19502
20082
  const [, results, executed, cached] = mapDone;
19503
20083
  return `${prefix}done: ${formatInteger(Number(results))} results, ${formatInteger(Number(executed))} executed, ${formatInteger(Number(cached))} cached`;
19504
20084
  }
20085
+ if (!watchSurfaceReaches(state, classified.provenance)) {
20086
+ return null;
20087
+ }
19505
20088
  return `${prefix}${message}`;
19506
20089
  }
19507
20090
  function isDatasetResultEnvelope(value) {
@@ -21081,7 +21664,7 @@ function extractPlayValidationErrors(value) {
21081
21664
  if (value instanceof DeeplineError) {
21082
21665
  return extractPlayValidationErrors(value.details);
21083
21666
  }
21084
- if (!isRecord9(value)) {
21667
+ if (!isRecord10(value)) {
21085
21668
  return [];
21086
21669
  }
21087
21670
  const directErrors = stringArrayField(value, "errors");
@@ -21318,6 +21901,7 @@ function parsePlayRunOptions(args) {
21318
21901
  const debugFixtureProviderPacing = args.includes(
21319
21902
  "--debug-fixture-provider-pacing"
21320
21903
  );
21904
+ const verboseLogs = args.includes("--logs") || debugMapLatency;
21321
21905
  let waitTimeoutMs = null;
21322
21906
  let profile = null;
21323
21907
  let fixtureBehavior = null;
@@ -21454,6 +22038,7 @@ function parsePlayRunOptions(args) {
21454
22038
  revisionSelector,
21455
22039
  watch,
21456
22040
  emitLogs,
22041
+ verboseLogs,
21457
22042
  jsonOutput,
21458
22043
  fullJson,
21459
22044
  waitTimeoutMs,
@@ -21540,7 +22125,7 @@ function printPlayCheckLimits(limits) {
21540
22125
  ` bundle: ${formatByteBudget(limits.bundle.usedBytes, limits.bundle.limitBytes)}`
21541
22126
  );
21542
22127
  }
21543
- function isRecord9(value) {
22128
+ function isRecord10(value) {
21544
22129
  return Boolean(value && typeof value === "object" && !Array.isArray(value));
21545
22130
  }
21546
22131
  function stringValue2(value) {
@@ -21550,14 +22135,14 @@ function asArray(value) {
21550
22135
  return Array.isArray(value) ? value : [];
21551
22136
  }
21552
22137
  function extractionEntries2(value) {
21553
- if (Array.isArray(value)) return value.filter(isRecord9);
21554
- if (!isRecord9(value)) return [];
22138
+ if (Array.isArray(value)) return value.filter(isRecord10);
22139
+ if (!isRecord10(value)) return [];
21555
22140
  return Object.entries(value).map(
21556
- ([name, entry]) => isRecord9(entry) ? { name, ...entry } : { name }
22141
+ ([name, entry]) => isRecord10(entry) ? { name, ...entry } : { name }
21557
22142
  );
21558
22143
  }
21559
22144
  function firstRawPath(entry) {
21560
- const details = isRecord9(entry.details) ? entry.details : {};
22145
+ const details = isRecord10(entry.details) ? entry.details : {};
21561
22146
  const paths = [
21562
22147
  ...asArray(details.rawToolOutputPaths),
21563
22148
  ...asArray(details.raw_tool_output_paths),
@@ -21575,12 +22160,12 @@ function checkHintRawPath(value) {
21575
22160
  function collectStaticPipelineToolIds(staticPipeline) {
21576
22161
  const seen = /* @__PURE__ */ new Set();
21577
22162
  const visitPipeline = (pipeline) => {
21578
- if (!isRecord9(pipeline)) return;
22163
+ if (!isRecord10(pipeline)) return;
21579
22164
  for (const step of [
21580
22165
  ...asArray(pipeline.stages),
21581
22166
  ...asArray(pipeline.substeps)
21582
22167
  ]) {
21583
- if (!isRecord9(step)) continue;
22168
+ if (!isRecord10(step)) continue;
21584
22169
  if (step.type === "tool") {
21585
22170
  const toolId = stringValue2(step.toolId) || stringValue2(step.tool);
21586
22171
  if (toolId) seen.add(toolId);
@@ -21594,9 +22179,9 @@ function collectStaticPipelineToolIds(staticPipeline) {
21594
22179
  return [...seen].sort();
21595
22180
  }
21596
22181
  function toolGetterHintFromMetadata(toolId, tool) {
21597
- const usageGuidance = isRecord9(tool.usageGuidance) ? tool.usageGuidance : {};
21598
- const resultGuidance = isRecord9(usageGuidance.toolExecutionResult) ? usageGuidance.toolExecutionResult : isRecord9(usageGuidance.tool_execution_result) ? usageGuidance.tool_execution_result : {};
21599
- const toolResponse = isRecord9(resultGuidance.toolResponse) ? resultGuidance.toolResponse : isRecord9(resultGuidance.tool_response) ? resultGuidance.tool_response : {};
22182
+ const usageGuidance = isRecord10(tool.usageGuidance) ? tool.usageGuidance : {};
22183
+ const resultGuidance = isRecord10(usageGuidance.toolExecutionResult) ? usageGuidance.toolExecutionResult : isRecord10(usageGuidance.tool_execution_result) ? usageGuidance.tool_execution_result : {};
22184
+ const toolResponse = isRecord10(resultGuidance.toolResponse) ? resultGuidance.toolResponse : isRecord10(resultGuidance.tool_response) ? resultGuidance.tool_response : {};
21600
22185
  const lists = extractionEntries2(
21601
22186
  resultGuidance.extractedLists ?? resultGuidance.extracted_lists
21602
22187
  ).map((entry) => ({
@@ -21692,6 +22277,11 @@ function printRecognizedSummary(recognized) {
21692
22277
  for (const dataset of recognized.datasets ?? []) {
21693
22278
  const columns = dataset.columns?.length ? ` (${dataset.columns.length} col${dataset.columns.length === 1 ? "" : "s"}: ${dataset.columns.join(", ")})` : "";
21694
22279
  console.log(` dataset ${dataset.name}${columns}`);
22280
+ if (dataset.undrawnColumns?.length) {
22281
+ console.log(
22282
+ ` undrawn (declared): ${dataset.undrawnColumns.join(", ")}`
22283
+ );
22284
+ }
21695
22285
  }
21696
22286
  if (recognized.inputs?.length) {
21697
22287
  console.log(` inputs: ${recognized.inputs.join(", ")}`);
@@ -21777,16 +22367,16 @@ function partitionMirroredErrors(errors, issues) {
21777
22367
  async function handlePlayCheck(args) {
21778
22368
  const options = parsePlayCheckOptions(args);
21779
22369
  if (!isFileTarget(options.target)) {
21780
- const client3 = new DeeplineClient();
22370
+ const client2 = new DeeplineClient();
21781
22371
  try {
21782
- await assertCanonicalNamedPlayReference(client3, options.target, {
22372
+ await assertCanonicalNamedPlayReference(client2, options.target, {
21783
22373
  command: "check"
21784
22374
  });
21785
- const play = await client3.describePlay(
22375
+ const play = await client2.describePlay(
21786
22376
  parseReferencedPlayTarget2(options.target).playName,
21787
22377
  { compact: true }
21788
22378
  );
21789
- const result2 = {
22379
+ const result = {
21790
22380
  valid: true,
21791
22381
  target: options.target,
21792
22382
  name: play.name,
@@ -21799,10 +22389,10 @@ async function handlePlayCheck(args) {
21799
22389
  note: "Named/prebuilt play contract is available. No run was started."
21800
22390
  };
21801
22391
  if (options.jsonOutput) {
21802
- process.stdout.write(`${JSON.stringify(result2)}
22392
+ process.stdout.write(`${JSON.stringify(result)}
21803
22393
  `);
21804
22394
  } else {
21805
- console.log(`\u2713 ${result2.reference} passed named play contract check`);
22395
+ console.log(`\u2713 ${result.reference} passed named play contract check`);
21806
22396
  console.log(" no run started; no Deepline credits spent");
21807
22397
  if (play.runCommand) console.log(` run: ${play.runCommand}`);
21808
22398
  }
@@ -21827,41 +22417,58 @@ async function handlePlayCheck(args) {
21827
22417
  }
21828
22418
  const absolutePlayPath = (0, import_node_path14.resolve)(options.target);
21829
22419
  const sourceCode = (0, import_node_fs12.readFileSync)(absolutePlayPath, "utf-8");
22420
+ const exportNames = resolvePlayCheckExportNames(sourceCode);
22421
+ const outcomes = [];
22422
+ for (const exportName of exportNames) {
22423
+ outcomes.push(
22424
+ await checkOneExportedPlay({
22425
+ absolutePlayPath,
22426
+ sourceCode,
22427
+ exportName,
22428
+ target: options.target
22429
+ })
22430
+ );
22431
+ }
22432
+ const merged = mergePlayCheckExportOutcomes(outcomes);
22433
+ if (options.jsonOutput) {
22434
+ process.stdout.write(`${JSON.stringify(merged.json)}
22435
+ `);
22436
+ } else {
22437
+ printPlayCheckOutcomes(outcomes, options.target);
22438
+ }
22439
+ return merged.valid ? 0 : 1;
22440
+ }
22441
+ function resolvePlayCheckExportNames(sourceCode) {
22442
+ const exports2 = listPlayFileExports(sourceCode);
22443
+ if (!exports2 || exports2.length === 0) return [PLAY_DEFAULT_EXPORT];
22444
+ return exports2.map((entry) => entry.name);
22445
+ }
22446
+ async function checkOneExportedPlay(input2) {
22447
+ const { absolutePlayPath, sourceCode, exportName } = input2;
22448
+ const fallbackName = extractPlayName(sourceCode, absolutePlayPath);
21830
22449
  let graph;
21831
22450
  try {
21832
- graph = await collectBundledPlayGraph(absolutePlayPath);
22451
+ graph = await collectBundledPlayGraph(absolutePlayPath, null, exportName);
21833
22452
  } catch (error) {
21834
- const message = error instanceof Error ? error.message : String(error);
21835
- if (options.jsonOutput) {
21836
- process.stdout.write(
21837
- `${JSON.stringify({ valid: false, stage: "bundle", errors: [message] })}
21838
- `
21839
- );
21840
- } else {
21841
- console.error(message);
21842
- }
21843
- return 1;
22453
+ return {
22454
+ exportName,
22455
+ playName: fallbackName,
22456
+ stage: "bundle",
22457
+ result: {
22458
+ valid: false,
22459
+ errors: [error instanceof Error ? error.message : String(error)]
22460
+ }
22461
+ };
21844
22462
  }
21845
- const playName = graph.root.playName ?? extractPlayName(sourceCode, absolutePlayPath);
22463
+ const playName = graph.root.playName ?? fallbackName;
21846
22464
  const descriptionErrors = collectMissingPlayDescriptionErrors(graph);
21847
22465
  if (descriptionErrors.length > 0) {
21848
- if (options.jsonOutput) {
21849
- process.stdout.write(
21850
- `${JSON.stringify({
21851
- name: playName,
21852
- valid: false,
21853
- stage: "authoring",
21854
- errors: descriptionErrors
21855
- })}
21856
- `
21857
- );
21858
- } else {
21859
- console.error(`\u2717 ${playName} failed local play check`);
21860
- for (const error of descriptionErrors) {
21861
- console.error(` ${error}`);
21862
- }
21863
- }
21864
- return 1;
22466
+ return {
22467
+ exportName,
22468
+ playName,
22469
+ stage: "authoring",
22470
+ result: { valid: false, errors: descriptionErrors }
22471
+ };
21865
22472
  }
21866
22473
  const client2 = new DeeplineClient();
21867
22474
  const integrationMode = resolveEvalIntegrationMode();
@@ -21876,64 +22483,136 @@ async function handlePlayCheck(args) {
21876
22483
  sourceFiles: graph.root.sourceFiles,
21877
22484
  description: graph.root.playDescription ?? void 0,
21878
22485
  artifact: graph.root.artifact,
22486
+ ...exportName === PLAY_DEFAULT_EXPORT ? {} : { exportName },
21879
22487
  ...importedPlays.length > 0 ? { importedPlays } : {},
21880
22488
  ...integrationMode ? { integrationMode } : {}
21881
22489
  });
21882
- const enrichedResult = {
21883
- ...result,
21884
- errors: result.valid ? result.errors : addPlayCheckRepairHints({
21885
- errors: result.errors,
21886
- sourceCode: graph.root.sourceCode
21887
- }),
21888
- toolGetterHints: result.toolGetterHints ?? await buildToolGetterHints(client2, result.staticPipeline)
21889
- };
21890
- if (options.jsonOutput) {
21891
- process.stdout.write(
21892
- `${JSON.stringify({ name: playName, ...enrichedResult })}
21893
- `
21894
- );
21895
- } else if (enrichedResult.valid) {
21896
- const summary = enrichedResult.summary?.trim();
21897
- console.log(
21898
- summary ? `\u2713 ${playName} valid \u2014 ${summary}` : `\u2713 ${playName} passed cloud play check`
21899
- );
21900
- if (enrichedResult.artifactHash) {
21901
- console.log(` artifact: ${enrichedResult.artifactHash.slice(0, 12)}`);
22490
+ return {
22491
+ exportName,
22492
+ playName,
22493
+ result: {
22494
+ ...result,
22495
+ errors: result.valid ? result.errors : addPlayCheckRepairHints({
22496
+ errors: result.errors,
22497
+ sourceCode: graph.root.sourceCode
22498
+ }),
22499
+ toolGetterHints: result.toolGetterHints ?? await buildToolGetterHints(client2, result.staticPipeline)
21902
22500
  }
21903
- if (enrichedResult.sourceHash) {
21904
- console.log(` source: ${enrichedResult.sourceHash.slice(0, 12)}`);
22501
+ };
22502
+ }
22503
+ function mergePlayCheckExportOutcomes(outcomes) {
22504
+ const primary = outcomes[0];
22505
+ const valid = outcomes.every((outcome) => outcome.result.valid);
22506
+ const base = {
22507
+ name: primary.playName,
22508
+ ...primary.stage ? { stage: primary.stage } : {},
22509
+ ...primary.result,
22510
+ valid
22511
+ };
22512
+ if (outcomes.length === 1) {
22513
+ return { valid, json: base };
22514
+ }
22515
+ const errors = [...primary.result.errors];
22516
+ const seenErrors = new Set(errors);
22517
+ const warnings = [...primary.result.warnings ?? []];
22518
+ const seenWarnings = new Set(warnings);
22519
+ const issues = [...primary.result.issues ?? []];
22520
+ const seenIssues = new Set(
22521
+ issues.map((issue) => `${issue.code} ${issue.path ?? ""} ${issue.message}`)
22522
+ );
22523
+ for (const outcome of outcomes.slice(1)) {
22524
+ for (const error of outcome.result.errors) {
22525
+ if (seenErrors.has(error)) continue;
22526
+ seenErrors.add(error);
22527
+ errors.push(`[export ${outcome.exportName}] ${error}`);
22528
+ }
22529
+ for (const warning of outcome.result.warnings ?? []) {
22530
+ if (seenWarnings.has(warning)) continue;
22531
+ seenWarnings.add(warning);
22532
+ warnings.push(`[export ${outcome.exportName}] ${warning}`);
22533
+ }
22534
+ for (const issue of outcome.result.issues ?? []) {
22535
+ const key = `${issue.code} ${issue.path ?? ""} ${issue.message}`;
22536
+ if (seenIssues.has(key)) continue;
22537
+ seenIssues.add(key);
22538
+ issues.push({ ...issue, exportName: outcome.exportName });
21905
22539
  }
21906
- printPlayCheckLimits(enrichedResult.limits);
21907
- if (enrichedResult.artifactHash) {
21908
- console.log(
21909
- ` publish: deepline plays publish ${shellQuote2(options.target)} --expected-artifact ${enrichedResult.artifactHash}`
21910
- );
22540
+ }
22541
+ return {
22542
+ valid,
22543
+ json: {
22544
+ ...base,
22545
+ errors,
22546
+ ...warnings.length > 0 || primary.result.warnings ? { warnings } : {},
22547
+ ...issues.length > 0 || primary.result.issues ? { issues } : {},
22548
+ exports: outcomes.map((outcome) => ({
22549
+ ...outcome.result,
22550
+ exportName: outcome.exportName,
22551
+ name: outcome.playName,
22552
+ ...outcome.stage ? { stage: outcome.stage } : {}
22553
+ }))
21911
22554
  }
21912
- printPlayTriggers(enrichedResult.triggers);
21913
- printRecognizedSummary(enrichedResult.recognized);
21914
- printPlayCheckIssues(
21915
- enrichedResult.issues,
21916
- (line) => console.log(line),
21917
- enrichedResult.warnings
22555
+ };
22556
+ }
22557
+ function playCheckFailureStage(outcome) {
22558
+ if (outcome.stage === "bundle") return "to bundle";
22559
+ if (outcome.stage === "authoring") return "local play check";
22560
+ return outcome.result.limits ? "cloud play check" : "local play check";
22561
+ }
22562
+ function printPlayCheckOutcome(outcome, target, prefix) {
22563
+ const { result, playName } = outcome;
22564
+ if (!result.valid) {
22565
+ console.error(
22566
+ `\u2717 ${prefix}${playName} failed ${playCheckFailureStage(outcome)}`
21918
22567
  );
21919
- printToolGetterHints(enrichedResult.toolGetterHints);
21920
- } else {
21921
- console.error(`\u2717 ${playName} failed cloud play check`);
21922
22568
  const { unstructuredErrors } = partitionMirroredErrors(
21923
- enrichedResult.errors,
21924
- enrichedResult.issues
22569
+ result.errors,
22570
+ result.issues
21925
22571
  );
21926
22572
  for (const error of unstructuredErrors) {
21927
22573
  console.error(` ${error}`);
21928
22574
  }
21929
22575
  printPlayCheckIssues(
21930
- enrichedResult.issues,
22576
+ result.issues,
21931
22577
  (line) => console.error(line),
21932
- enrichedResult.warnings
22578
+ result.warnings
21933
22579
  );
21934
- printToolGetterHints(enrichedResult.toolGetterHints);
22580
+ printToolGetterHints(result.toolGetterHints);
22581
+ return;
22582
+ }
22583
+ const summary = result.summary?.trim();
22584
+ console.log(
22585
+ summary ? `\u2713 ${prefix}${playName} valid \u2014 ${summary}` : `\u2713 ${prefix}${playName} passed ${result.limits ? "cloud" : "local"} play check`
22586
+ );
22587
+ if (result.artifactHash) {
22588
+ console.log(` artifact: ${result.artifactHash.slice(0, 12)}`);
22589
+ }
22590
+ if (result.sourceHash) {
22591
+ console.log(` source: ${result.sourceHash.slice(0, 12)}`);
22592
+ }
22593
+ printPlayCheckLimits(result.limits);
22594
+ if (result.artifactHash && outcome.exportName === PLAY_DEFAULT_EXPORT) {
22595
+ console.log(
22596
+ ` publish: deepline plays publish ${shellQuote2(target)} --expected-artifact ${result.artifactHash}`
22597
+ );
22598
+ }
22599
+ printPlayTriggers(result.triggers);
22600
+ printRecognizedSummary(result.recognized);
22601
+ printPlayCheckIssues(
22602
+ result.issues,
22603
+ (line) => console.log(line),
22604
+ result.warnings
22605
+ );
22606
+ printToolGetterHints(result.toolGetterHints);
22607
+ }
22608
+ function printPlayCheckOutcomes(outcomes, target) {
22609
+ if (outcomes.length === 1) {
22610
+ printPlayCheckOutcome(outcomes[0], target, "");
22611
+ return;
22612
+ }
22613
+ for (const outcome of outcomes) {
22614
+ printPlayCheckOutcome(outcome, target, `[${outcome.exportName}] `);
21935
22615
  }
21936
- return enrichedResult.valid ? 0 : 1;
21937
22616
  }
21938
22617
  async function handleFileBackedRun(options, hooks) {
21939
22618
  if (options.target.kind !== "file") {
@@ -22067,6 +22746,7 @@ async function handleFileBackedRun(options, hooks) {
22067
22746
  playName,
22068
22747
  jsonOutput: options.jsonOutput,
22069
22748
  emitLogs: options.emitLogs,
22749
+ verboseLogs: options.verboseLogs,
22070
22750
  waitTimeoutMs: options.waitTimeoutMs,
22071
22751
  open: options.open,
22072
22752
  progress,
@@ -22246,6 +22926,7 @@ async function handleNamedRun(options, hooks) {
22246
22926
  playName,
22247
22927
  jsonOutput: options.jsonOutput,
22248
22928
  emitLogs: options.emitLogs,
22929
+ verboseLogs: options.verboseLogs,
22249
22930
  waitTimeoutMs: options.waitTimeoutMs,
22250
22931
  open: options.open,
22251
22932
  progress,
@@ -26010,7 +26691,7 @@ function isMarkedTestAiInferenceCommand(command) {
26010
26691
  if (normalizeEnrichPlayRef(command.tool) !== "run_javascript") {
26011
26692
  return false;
26012
26693
  }
26013
- return isRecord10(command.payload) && command.payload[ENRICH_TEST_AI_INFERENCE_PAYLOAD_MARKER] === true;
26694
+ return isRecord11(command.payload) && command.payload[ENRICH_TEST_AI_INFERENCE_PAYLOAD_MARKER] === true;
26014
26695
  }
26015
26696
  function enrichDebugEnabled(env = process.env) {
26016
26697
  const raw = String(env.DEEPLINE_DEBUG_ENRICH ?? "").trim().toLowerCase();
@@ -26274,7 +26955,7 @@ function rewriteGeneratedPlayRerunForEnrich(status, enrichCommand) {
26274
26955
  if (Array.isArray(value)) {
26275
26956
  return value.map(rewrite);
26276
26957
  }
26277
- if (!isRecord10(value)) {
26958
+ if (!isRecord11(value)) {
26278
26959
  return value;
26279
26960
  }
26280
26961
  const next = Object.fromEntries(
@@ -26283,7 +26964,7 @@ function rewriteGeneratedPlayRerunForEnrich(status, enrichCommand) {
26283
26964
  key === "rerunCommand" && typeof entry === "string" ? enrichCommand : rewrite(entry)
26284
26965
  ])
26285
26966
  );
26286
- if (isRecord10(next.next) && typeof next.next.run === "string") {
26967
+ if (isRecord11(next.next) && typeof next.next.run === "string") {
26287
26968
  next.next = { ...next.next, run: enrichCommand };
26288
26969
  }
26289
26970
  return next;
@@ -26765,7 +27446,7 @@ async function resolveWatchedGeneratedPlayStatus(input2) {
26765
27446
  }
26766
27447
  return input2.client.runs.get(runId, { full: true });
26767
27448
  }
26768
- function isRecord10(value) {
27449
+ function isRecord11(value) {
26769
27450
  return Boolean(value && typeof value === "object" && !Array.isArray(value));
26770
27451
  }
26771
27452
  async function captureStdout(run, options = {}) {
@@ -27017,15 +27698,15 @@ function readFirstEnrichDatasetActions(value) {
27017
27698
  return null;
27018
27699
  }
27019
27700
  const record = candidate;
27020
- const actions = isRecord10(record.actions) ? record.actions : null;
27021
- const currentQuery = isRecord10(actions?.queryCurrentTable) ? actions.queryCurrentTable : null;
27022
- const legacyQuery = isRecord10(actions?.query) ? actions.query : null;
27701
+ const actions = isRecord11(record.actions) ? record.actions : null;
27702
+ const currentQuery = isRecord11(actions?.queryCurrentTable) ? actions.queryCurrentTable : null;
27703
+ const legacyQuery = isRecord11(actions?.query) ? actions.query : null;
27023
27704
  const query = currentQuery?.kind === "deepline_db_query" ? currentQuery : legacyQuery?.kind === "deepline_db_query" ? legacyQuery : null;
27024
27705
  if (query?.kind === "deepline_db_query") {
27025
27706
  return {
27026
27707
  dataset: record,
27027
27708
  query,
27028
- ...isRecord10(actions?.exportCsv) ? { exportCsv: actions.exportCsv } : {}
27709
+ ...isRecord11(actions?.exportCsv) ? { exportCsv: actions.exportCsv } : {}
27029
27710
  };
27030
27711
  }
27031
27712
  if (options.allowLegacy && record.kind === "dataset" && typeof record.queryDatasetCommand === "string" && record.queryDatasetCommand.trim()) {
@@ -27078,7 +27759,7 @@ function enrichCustomerDbJson(input2) {
27078
27759
  const dataset = actions.dataset;
27079
27760
  const sql = actionStringField(query, "sql") ?? parseSqlFromDbQueryCommand(actions.queryDatasetCommand);
27080
27761
  const datasetPath = actionStringField(query, "datasetPath") ?? actionStringField(dataset, "path") ?? actionStringField(dataset, "tableNamespace");
27081
- const api = isRecord10(query.api) ? query.api : null;
27762
+ const api = isRecord11(query.api) ? query.api : null;
27082
27763
  const apiPath = actionStringField(api ?? {}, "path") ?? "/api/v2/db/query";
27083
27764
  const apiMethod = actionStringField(api ?? {}, "method") ?? "POST";
27084
27765
  if (!datasetPath) {
@@ -27147,11 +27828,11 @@ function sqlStringLiteral(value) {
27147
27828
  return `'${value.replace(/'/g, "''")}'`;
27148
27829
  }
27149
27830
  function failureAliasFromCellMeta(cellMeta) {
27150
- if (!isRecord10(cellMeta)) {
27831
+ if (!isRecord11(cellMeta)) {
27151
27832
  return null;
27152
27833
  }
27153
27834
  for (const [alias, meta] of Object.entries(cellMeta)) {
27154
- if (!isRecord10(meta)) {
27835
+ if (!isRecord11(meta)) {
27155
27836
  continue;
27156
27837
  }
27157
27838
  const failure = failureCellFromMeta(meta, {});
@@ -27645,7 +28326,7 @@ function exportableSheetRow2(row, sourceRowStart = 0) {
27645
28326
  return fallback;
27646
28327
  }
27647
28328
  function failureCellFromMeta(meta, fallback) {
27648
- if (!isRecord10(meta)) {
28329
+ if (!isRecord11(meta)) {
27649
28330
  return null;
27650
28331
  }
27651
28332
  const status = typeof meta.status === "string" ? meta.status.trim().toLowerCase() : "";
@@ -27665,7 +28346,7 @@ function failureCellFromMeta(meta, fallback) {
27665
28346
  };
27666
28347
  }
27667
28348
  function applyFailureCellMeta(row, cellMeta, fallback) {
27668
- if (!isRecord10(cellMeta)) {
28349
+ if (!isRecord11(cellMeta)) {
27669
28350
  return;
27670
28351
  }
27671
28352
  for (const [field, meta] of Object.entries(cellMeta)) {
@@ -27893,7 +28574,7 @@ function stableRowSnapshot(value) {
27893
28574
  }
27894
28575
  function cellFailureError(value) {
27895
28576
  const parsed = parseMaybeJsonObject(value);
27896
- if (!isRecord10(parsed)) {
28577
+ if (!isRecord11(parsed)) {
27897
28578
  const text = typeof parsed === "string" ? parsed.trim() : "";
27898
28579
  if (/^(?:[A-Za-z0-9_:-]+:\s*)?(?:Error|TypeError|ReferenceError|SyntaxError|RangeError):\s+/.test(
27899
28580
  text
@@ -27901,12 +28582,12 @@ function cellFailureError(value) {
27901
28582
  return { message: text };
27902
28583
  }
27903
28584
  }
27904
- if (!isRecord10(parsed)) {
28585
+ if (!isRecord11(parsed)) {
27905
28586
  return null;
27906
28587
  }
27907
28588
  const status = typeof parsed.status === "string" ? parsed.status.trim().toLowerCase() : "";
27908
28589
  const directError = typeof parsed.error === "string" ? parsed.error.trim() : typeof parsed.last_error === "string" ? parsed.last_error.trim() : "";
27909
- const result = isRecord10(parsed.result) ? parsed.result : null;
28590
+ const result = isRecord11(parsed.result) ? parsed.result : null;
27910
28591
  const resultError = typeof result?.error === "string" ? result.error.trim() : typeof result?.message === "string" ? result.message.trim() : "";
27911
28592
  if (!directError && !resultError && status !== "error" && status !== "failed") {
27912
28593
  return null;
@@ -27976,7 +28657,7 @@ function assignFlattenedFailurePath(target, field, value) {
27976
28657
  let cursor = target;
27977
28658
  for (const part of normalized.slice(0, -1)) {
27978
28659
  const existing = cursor[part];
27979
- if (!isRecord10(existing)) {
28660
+ if (!isRecord11(existing)) {
27980
28661
  const next = {};
27981
28662
  cursor[part] = next;
27982
28663
  cursor = next;
@@ -28140,10 +28821,10 @@ function waterfallExecutionSignal(status, spec) {
28140
28821
  let everyChildStatOnlyConditionSkipped = true;
28141
28822
  const childAliasesWithStats = /* @__PURE__ */ new Set();
28142
28823
  for (const childAlias of childAliases) {
28143
- for (const stat4 of summaries.map((summary) => summary[childAlias]).filter(isRecord10)) {
28824
+ for (const stat4 of summaries.map((summary) => summary[childAlias]).filter(isRecord11)) {
28144
28825
  sawChildStats = true;
28145
28826
  childAliasesWithStats.add(childAlias);
28146
- const execution = isRecord10(stat4.execution) ? stat4.execution : null;
28827
+ const execution = isRecord11(stat4.execution) ? stat4.execution : null;
28147
28828
  const executedSummary = parseExecutionSummary(
28148
28829
  execution?.["completed:executed"]
28149
28830
  );
@@ -28173,7 +28854,7 @@ function waterfallExecutionSignal(status, spec) {
28173
28854
  }
28174
28855
  function emptyWaterfallStatsEvidence(status, spec) {
28175
28856
  const summaries = collectColumnStats(status);
28176
- const parentStats = summaries.map((summary) => summary[spec.alias]).filter(isRecord10);
28857
+ const parentStats = summaries.map((summary) => summary[spec.alias]).filter(isRecord11);
28177
28858
  for (const stat4 of parentStats) {
28178
28859
  const nonEmpty = parseExecutionSummary(stat4.non_empty);
28179
28860
  if (nonEmpty?.total && nonEmpty.count === 0) {
@@ -28187,7 +28868,7 @@ function emptyWaterfallStatsEvidence(status, spec) {
28187
28868
  let selectedRows = 0;
28188
28869
  let sawStatsForEveryChild = true;
28189
28870
  for (const childAlias of childAliases) {
28190
- const stat4 = summaries.map((summary) => summary[childAlias]).find(isRecord10);
28871
+ const stat4 = summaries.map((summary) => summary[childAlias]).find(isRecord11);
28191
28872
  if (!stat4) {
28192
28873
  sawStatsForEveryChild = false;
28193
28874
  break;
@@ -28196,7 +28877,7 @@ function emptyWaterfallStatsEvidence(status, spec) {
28196
28877
  if ((nonEmpty?.count ?? 0) > 0) {
28197
28878
  return null;
28198
28879
  }
28199
- const execution = isRecord10(stat4.execution) ? stat4.execution : null;
28880
+ const execution = isRecord11(stat4.execution) ? stat4.execution : null;
28200
28881
  const executed = parseExecutionSummary(execution?.["completed:executed"]);
28201
28882
  const reused = parseExecutionSummary(execution?.["completed:reused"]);
28202
28883
  const skipped = parseExecutionSummary(execution?.["skipped:condition"]);
@@ -28238,11 +28919,11 @@ function collectStatusFailureJobs(input2) {
28238
28919
  const jobs = [];
28239
28920
  aliases.forEach((spec, aliasIndex) => {
28240
28921
  const { alias } = spec;
28241
- const stat4 = summaries.map((summary) => summary[alias]).find(isRecord10);
28922
+ const stat4 = summaries.map((summary) => summary[alias]).find(isRecord11);
28242
28923
  if (!stat4) {
28243
28924
  return;
28244
28925
  }
28245
- const execution = isRecord10(stat4.execution) ? stat4.execution : null;
28926
+ const execution = isRecord11(stat4.execution) ? stat4.execution : null;
28246
28927
  const failedCount = Math.min(
28247
28928
  selectedRows,
28248
28929
  Math.max(
@@ -28349,10 +29030,10 @@ function collectColumnStats(status) {
28349
29030
  value.forEach(visit);
28350
29031
  return;
28351
29032
  }
28352
- if (!isRecord10(value)) {
29033
+ if (!isRecord11(value)) {
28353
29034
  return;
28354
29035
  }
28355
- if (isRecord10(value.columnStats)) {
29036
+ if (isRecord11(value.columnStats)) {
28356
29037
  summaries.push(value.columnStats);
28357
29038
  }
28358
29039
  Object.values(value).forEach(visit);
@@ -28364,12 +29045,12 @@ function firstAliasExecutionCounts(input2) {
28364
29045
  const aliases = collectConfigScalarAliasOrder(input2.config);
28365
29046
  const summaries = collectColumnStats(input2.status);
28366
29047
  for (const alias of aliases) {
28367
- const stat4 = summaries.map((summary) => summary[alias]).find(isRecord10);
29048
+ const stat4 = summaries.map((summary) => summary[alias]).find(isRecord11);
28368
29049
  if (!stat4) continue;
28369
29050
  if (input2.forceAliases.has(normalizeAlias2(alias))) {
28370
29051
  return { executed: input2.selectedRows, reused: 0 };
28371
29052
  }
28372
- const execution = isRecord10(stat4.execution) ? stat4.execution : null;
29053
+ const execution = isRecord11(stat4.execution) ? stat4.execution : null;
28373
29054
  if (!execution) continue;
28374
29055
  return {
28375
29056
  executed: parseExecutionCount(execution["completed:executed"]),
@@ -28396,14 +29077,14 @@ function rewriteEnrichJsonStatus(input2) {
28396
29077
  if (Array.isArray(value)) {
28397
29078
  return value.map(rewrite);
28398
29079
  }
28399
- if (!isRecord10(value)) {
29080
+ if (!isRecord11(value)) {
28400
29081
  return value;
28401
29082
  }
28402
29083
  const next = {};
28403
29084
  for (const [key, entry] of Object.entries(value)) {
28404
29085
  next[key] = rewrite(entry);
28405
29086
  }
28406
- if (isRecord10(next.progress)) {
29087
+ if (isRecord11(next.progress)) {
28407
29088
  next.progress = {
28408
29089
  ...next.progress,
28409
29090
  ...selectedRows > 0 ? { total: selectedRows } : {},
@@ -28412,8 +29093,8 @@ function rewriteEnrichJsonStatus(input2) {
28412
29093
  ...failedRows > 0 ? { failed: failedRows, pending: 0 } : {}
28413
29094
  };
28414
29095
  }
28415
- if (isRecord10(next.summary)) {
28416
- const rowCounts = isRecord10(next.summary.rowCounts) ? next.summary.rowCounts : null;
29096
+ if (isRecord11(next.summary)) {
29097
+ const rowCounts = isRecord11(next.summary.rowCounts) ? next.summary.rowCounts : null;
28417
29098
  if (failedRows > 0) {
28418
29099
  next.summary = {
28419
29100
  ...next.summary,
@@ -28426,11 +29107,11 @@ function rewriteEnrichJsonStatus(input2) {
28426
29107
  };
28427
29108
  }
28428
29109
  }
28429
- if (isRecord10(next.columnStats) && selectedRows > 0) {
29110
+ if (isRecord11(next.columnStats) && selectedRows > 0) {
28430
29111
  const columnStats = { ...next.columnStats };
28431
29112
  for (const alias of forcedAliases) {
28432
- const stat4 = isRecord10(columnStats[alias]) ? columnStats[alias] : null;
28433
- const execution = isRecord10(stat4?.execution) ? stat4.execution : null;
29113
+ const stat4 = isRecord11(columnStats[alias]) ? columnStats[alias] : null;
29114
+ const execution = isRecord11(stat4?.execution) ? stat4.execution : null;
28434
29115
  if (!stat4 || !execution) continue;
28435
29116
  columnStats[alias] = {
28436
29117
  ...stat4,
@@ -28449,14 +29130,14 @@ function rewriteEnrichJsonStatus(input2) {
28449
29130
  return next;
28450
29131
  };
28451
29132
  const rewritten = rewrite(input2.status);
28452
- if (failedRows === 0 || !isRecord10(rewritten)) {
29133
+ if (failedRows === 0 || !isRecord11(rewritten)) {
28453
29134
  return rewritten;
28454
29135
  }
28455
29136
  const partialStatus = selectedRows > 0 && failedRows < selectedRows ? "partial_success" : "failed";
28456
29137
  return {
28457
29138
  ...rewritten,
28458
29139
  ...rewritten.status === "completed" || rewritten.status === "failed" ? { status: partialStatus } : {},
28459
- ...isRecord10(rewritten.run) && (rewritten.run.status === "completed" || rewritten.run.status === "failed") ? { run: { ...rewritten.run, status: partialStatus } } : {}
29140
+ ...isRecord11(rewritten.run) && (rewritten.run.status === "completed" || rewritten.run.status === "failed") ? { run: { ...rewritten.run, status: partialStatus } } : {}
28460
29141
  };
28461
29142
  }
28462
29143
  function summarizeFailedJobError(value) {
@@ -29080,7 +29761,7 @@ function materializeCsvCellValue(value) {
29080
29761
  return value;
29081
29762
  }
29082
29763
  function compactArrayEnvelopeCompleteValue(value) {
29083
- if (!isRecord10(value) || value.kind !== "array") {
29764
+ if (!isRecord11(value) || value.kind !== "array") {
29084
29765
  return null;
29085
29766
  }
29086
29767
  if (!Array.isArray(value.preview)) {
@@ -29094,7 +29775,7 @@ function compactArrayEnvelopeCompleteValue(value) {
29094
29775
  }
29095
29776
  function disambiguateCompactAiInferencePayload(value) {
29096
29777
  const parsed = parseMaybeJsonObject(value);
29097
- if (!isRecord10(parsed) || !cellFailureError(parsed)) {
29778
+ if (!isRecord11(parsed) || !cellFailureError(parsed)) {
29098
29779
  return value;
29099
29780
  }
29100
29781
  return {
@@ -29103,14 +29784,14 @@ function disambiguateCompactAiInferencePayload(value) {
29103
29784
  };
29104
29785
  }
29105
29786
  function compactAiInferenceCellForCsv(value) {
29106
- if (!isRecord10(value)) {
29787
+ if (!isRecord11(value)) {
29107
29788
  return value;
29108
29789
  }
29109
29790
  const extractedJson = value.extracted_json;
29110
29791
  if (extractedJson !== null && extractedJson !== void 0) {
29111
29792
  return disambiguateCompactAiInferencePayload(extractedJson);
29112
29793
  }
29113
- const result = isRecord10(value.result) ? value.result : null;
29794
+ const result = isRecord11(value.result) ? value.result : null;
29114
29795
  const object = result?.object;
29115
29796
  if (object !== null && object !== void 0) {
29116
29797
  return disambiguateCompactAiInferencePayload(object);
@@ -29127,12 +29808,12 @@ function compactAiInferenceCellForCsv(value) {
29127
29808
  }
29128
29809
  function materializeEnrichAliasCellForCsv(row, alias, options) {
29129
29810
  const direct = row[alias];
29130
- if (isRecord10(direct)) {
29811
+ if (isRecord11(direct)) {
29131
29812
  const completeArray = compactArrayEnvelopeCompleteValue(direct);
29132
29813
  if (completeArray) {
29133
29814
  return materializeCsvCellValue(completeArray);
29134
29815
  }
29135
- if (options?.compactAiCell && direct.status === "completed" && (isRecord10(direct.result) || Object.prototype.hasOwnProperty.call(direct, "extracted_json") || typeof direct.output === "string")) {
29816
+ if (options?.compactAiCell && direct.status === "completed" && (isRecord11(direct.result) || Object.prototype.hasOwnProperty.call(direct, "extracted_json") || typeof direct.output === "string")) {
29136
29817
  return materializeCsvCellValue(compactAiInferenceCellForCsv(direct));
29137
29818
  }
29138
29819
  if (Object.prototype.hasOwnProperty.call(direct, "matched_result") || Object.prototype.hasOwnProperty.call(direct, "matchedResult") || Object.prototype.hasOwnProperty.call(direct, "result")) {
@@ -29273,11 +29954,11 @@ function normalizeEnrichRowsForCsvExport(rows, config, options) {
29273
29954
  }
29274
29955
  function legacyMetadataFromRow(row) {
29275
29956
  const direct = parseLegacyMetadataCell(row._metadata);
29276
- if (direct && isRecord10(direct.columns)) {
29957
+ if (direct && isRecord11(direct.columns)) {
29277
29958
  return direct;
29278
29959
  }
29279
29960
  const relocated = parseLegacyMetadataCell(row.metadata);
29280
- if (relocated && isRecord10(relocated.columns)) {
29961
+ if (relocated && isRecord11(relocated.columns)) {
29281
29962
  return relocated;
29282
29963
  }
29283
29964
  const flattenedColumns = parseLegacyMetadataCell(row["metadata.columns"]);
@@ -29294,7 +29975,7 @@ function legacyMetadataFromRow(row) {
29294
29975
  }
29295
29976
  function parseLegacyMetadataCell(value) {
29296
29977
  const parsed = parseMaybeJsonObject(value);
29297
- if (isRecord10(parsed)) {
29978
+ if (isRecord11(parsed)) {
29298
29979
  return parsed;
29299
29980
  }
29300
29981
  if (typeof value !== "string") {
@@ -29311,12 +29992,12 @@ function parseLegacyMetadataCell(value) {
29311
29992
  for (const candidate of candidates) {
29312
29993
  try {
29313
29994
  const decoded = JSON.parse(candidate);
29314
- if (isRecord10(decoded)) {
29995
+ if (isRecord11(decoded)) {
29315
29996
  return decoded;
29316
29997
  }
29317
29998
  if (typeof decoded === "string") {
29318
29999
  const nested = JSON.parse(decoded);
29319
- if (isRecord10(nested)) {
30000
+ if (isRecord11(nested)) {
29320
30001
  return nested;
29321
30002
  }
29322
30003
  }
@@ -29326,8 +30007,8 @@ function parseLegacyMetadataCell(value) {
29326
30007
  return null;
29327
30008
  }
29328
30009
  function mergeLegacyMetadataRecords(base, enriched) {
29329
- const baseColumns = isRecord10(base.columns) ? base.columns : null;
29330
- const enrichedColumns = isRecord10(enriched.columns) ? enriched.columns : null;
30010
+ const baseColumns = isRecord11(base.columns) ? base.columns : null;
30011
+ const enrichedColumns = isRecord11(enriched.columns) ? enriched.columns : null;
29331
30012
  const merged = {
29332
30013
  ...base,
29333
30014
  ...enriched
@@ -34128,7 +34809,7 @@ function toolContractJsonForDescribe(tool, requestedToolId) {
34128
34809
  }
34129
34810
  function extractionContractEntries(entries) {
34130
34811
  return entries.flatMap((entry) => {
34131
- if (!isRecord11(entry)) return [];
34812
+ if (!isRecord12(entry)) return [];
34132
34813
  const name = stringField2(entry, "name");
34133
34814
  const expression = stringField2(entry, "expression");
34134
34815
  return name && expression ? [{ name, expression }] : [];
@@ -34149,7 +34830,7 @@ function printMonitorTypeFilters(tool) {
34149
34830
  }
34150
34831
  console.log("Deploy filters (set in the monitor payload):");
34151
34832
  for (const name of names) {
34152
- const field = isRecord11(properties[name]) ? properties[name] : {};
34833
+ const field = isRecord12(properties[name]) ? properties[name] : {};
34153
34834
  const star = required.has(name) ? "*" : "";
34154
34835
  const enumVals = arrayField2(field, "enum").filter(
34155
34836
  (v) => typeof v === "string"
@@ -34161,14 +34842,14 @@ function printMonitorTypeFilters(tool) {
34161
34842
  }
34162
34843
  function printMonitorTypeStreams(tool) {
34163
34844
  const streams = arrayField2(tool, "streams", "output_streams").filter(
34164
- isRecord11
34845
+ isRecord12
34165
34846
  );
34166
34847
  if (!streams.length) return;
34167
34848
  console.log("");
34168
34849
  console.log("Filter columns (a play's sqlListeners.where, per stream):");
34169
34850
  for (const stream of streams) {
34170
34851
  const name = stringField2(stream, "stream");
34171
- const cols = arrayField2(stream, "columns").filter(isRecord11).map((col) => stringField2(col, "name")).filter(Boolean);
34852
+ const cols = arrayField2(stream, "columns").filter(isRecord12).map((col) => stringField2(col, "name")).filter(Boolean);
34172
34853
  console.log(`- ${name}: ${cols.join(", ")}`);
34173
34854
  }
34174
34855
  }
@@ -34186,7 +34867,7 @@ function printMonitorTypePricing(tool) {
34186
34867
  }
34187
34868
  console.log("Pricing (Deepline credits per accepted event):");
34188
34869
  for (const key of keys) {
34189
- const entry = isRecord11(byType[key]) ? byType[key] : {};
34870
+ const entry = isRecord12(byType[key]) ? byType[key] : {};
34190
34871
  const credits = numberField2(entry, "deepline_credits", "deeplineCredits");
34191
34872
  const display = stringField2(entry, "display");
34192
34873
  const shown = display || (credits !== null ? `${formatDecimal(credits)} credits/event` : "see --json");
@@ -34231,8 +34912,8 @@ function printCompactToolContract(tool, requestedToolId) {
34231
34912
  return;
34232
34913
  }
34233
34914
  const contract = toolContractJsonForDescribe(tool, requestedToolId);
34234
- const cost = isRecord11(contract.cost) ? contract.cost : {};
34235
- const getters = isRecord11(contract.getters) ? contract.getters : {};
34915
+ const cost = isRecord12(contract.cost) ? contract.cost : {};
34916
+ const getters = isRecord12(contract.getters) ? contract.getters : {};
34236
34917
  const listGetters = Array.isArray(getters.extractedLists) ? getters.extractedLists : [];
34237
34918
  const valueGetters = Array.isArray(getters.extractedValues) ? getters.extractedValues : [];
34238
34919
  const inputFields = recursiveToolInputFieldsForDisplay(
@@ -34247,7 +34928,7 @@ function printCompactToolContract(tool, requestedToolId) {
34247
34928
  console.log(`Tags: ${contract.categories.join(", ")}`);
34248
34929
  }
34249
34930
  if (contract.deprecated === true) {
34250
- const deprecation = isRecord11(contract.deprecation) ? contract.deprecation : {};
34931
+ const deprecation = isRecord12(contract.deprecation) ? contract.deprecation : {};
34251
34932
  const message = stringField2(deprecation, "message");
34252
34933
  const replacementToolId = stringField2(
34253
34934
  deprecation,
@@ -34274,7 +34955,7 @@ function printCompactToolContract(tool, requestedToolId) {
34274
34955
  console.log("");
34275
34956
  console.log("Inputs:");
34276
34957
  for (const field of inputFields) {
34277
- if (!isRecord11(field)) continue;
34958
+ if (!isRecord12(field)) continue;
34278
34959
  const name = stringField2(field, "name");
34279
34960
  if (!name) continue;
34280
34961
  const required = field.required ? "*" : "";
@@ -34293,7 +34974,7 @@ function printCompactToolContract(tool, requestedToolId) {
34293
34974
  }
34294
34975
  console.log("");
34295
34976
  printToolExamplesOnly(tool, requestedToolId, { includeSamples: false });
34296
- const starterScript = isRecord11(contract.starterScript) ? contract.starterScript : {};
34977
+ const starterScript = isRecord12(contract.starterScript) ? contract.starterScript : {};
34297
34978
  const starterPath = stringField2(starterScript, "path");
34298
34979
  if (starterPath) {
34299
34980
  console.log("");
@@ -34307,14 +34988,14 @@ function printCompactToolContract(tool, requestedToolId) {
34307
34988
  console.log("Getters:");
34308
34989
  if (listGetters.length) console.log("Lists:");
34309
34990
  for (const entry of listGetters) {
34310
- if (isRecord11(entry))
34991
+ if (isRecord12(entry))
34311
34992
  console.log(
34312
34993
  `- ${stringField2(entry, "name")}: ${playResultExpression(entry)}`
34313
34994
  );
34314
34995
  }
34315
34996
  if (valueGetters.length) console.log("Values:");
34316
34997
  for (const entry of valueGetters) {
34317
- if (isRecord11(entry))
34998
+ if (isRecord12(entry))
34318
34999
  console.log(
34319
35000
  `- ${stringField2(entry, "name")}: ${playResultExpression(entry)}`
34320
35001
  );
@@ -34331,7 +35012,7 @@ function printToolPricingOnly(tool, requestedToolId, options = {}) {
34331
35012
  return;
34332
35013
  }
34333
35014
  const contract = toolContractJsonForDescribe(tool, requestedToolId);
34334
- const cost = isRecord11(contract.cost) ? contract.cost : {};
35015
+ const cost = isRecord12(contract.cost) ? contract.cost : {};
34335
35016
  const pricingModel = stringField2(cost, "pricingModel") || "unknown";
34336
35017
  const billingMode = stringField2(cost, "billingMode") || "unknown";
34337
35018
  const unit = pricingModel === "per_page" ? "page" : pricingModel === "per_result" ? "result" : pricingModel === "fixed" ? "call" : pricingModel.replace(/^per_/, "") || "unit";
@@ -34403,10 +35084,10 @@ function printToolExamplesOnly(tool, requestedToolId, options = {}) {
34403
35084
  ` input: ${JSON.stringify(sampleInput || {}, null, 2).replace(/\n/g, "\n ")},`
34404
35085
  );
34405
35086
  console.log("});");
34406
- const getters = isRecord11(contract.getters) ? contract.getters : {};
35087
+ const getters = isRecord12(contract.getters) ? contract.getters : {};
34407
35088
  const valueGetters = Array.isArray(getters.extractedValues) ? getters.extractedValues : [];
34408
35089
  const listGetters = Array.isArray(getters.extractedLists) ? getters.extractedLists : [];
34409
- const firstGetter = [...valueGetters, ...listGetters].find(isRecord11);
35090
+ const firstGetter = [...valueGetters, ...listGetters].find(isRecord12);
34410
35091
  if (firstGetter) {
34411
35092
  const name = stringField2(firstGetter, "name") || "value";
34412
35093
  const expression = stringField2(firstGetter, "expression");
@@ -34442,7 +35123,7 @@ function printPlayLikeToolUsage(tool, requestedToolId) {
34442
35123
  }
34443
35124
  function printToolGettersOnly(tool, requestedToolId) {
34444
35125
  const contract = toolContractJsonForDescribe(tool, requestedToolId);
34445
- const getters = isRecord11(contract.getters) ? contract.getters : {};
35126
+ const getters = isRecord12(contract.getters) ? contract.getters : {};
34446
35127
  const listGetters = Array.isArray(getters.extractedLists) ? getters.extractedLists : [];
34447
35128
  const valueGetters = Array.isArray(getters.extractedValues) ? getters.extractedValues : [];
34448
35129
  console.log(`Getters: ${contract.toolId}`);
@@ -34455,7 +35136,7 @@ function printToolGettersOnly(tool, requestedToolId) {
34455
35136
  if (listGetters.length) {
34456
35137
  console.log("Lists:");
34457
35138
  for (const entry of listGetters) {
34458
- if (isRecord11(entry))
35139
+ if (isRecord12(entry))
34459
35140
  console.log(
34460
35141
  `- ${stringField2(entry, "name")}: ${playResultExpression(entry)}`
34461
35142
  );
@@ -34464,7 +35145,7 @@ function printToolGettersOnly(tool, requestedToolId) {
34464
35145
  if (valueGetters.length) {
34465
35146
  console.log("Values:");
34466
35147
  for (const entry of valueGetters) {
34467
- if (isRecord11(entry))
35148
+ if (isRecord12(entry))
34468
35149
  console.log(
34469
35150
  `- ${stringField2(entry, "name")}: ${playResultExpression(entry)}`
34470
35151
  );
@@ -34490,7 +35171,7 @@ function sampleValueForField(field) {
34490
35171
  function samplePayloadForInputFields(fields) {
34491
35172
  return Object.fromEntries(
34492
35173
  fields.slice(0, 4).flatMap((field) => {
34493
- if (!isRecord11(field)) return [];
35174
+ if (!isRecord12(field)) return [];
34494
35175
  const name = stringField2(field, "name");
34495
35176
  if (!name) return [];
34496
35177
  return [[name, sampleValueForField(field)]];
@@ -34608,12 +35289,12 @@ function formatListedToolCost(tool) {
34608
35289
  }
34609
35290
  function toolInputFieldsForDisplay(inputSchema) {
34610
35291
  if (Array.isArray(inputSchema.fields))
34611
- return inputSchema.fields.filter(isRecord11);
34612
- const jsonSchema = isRecord11(inputSchema.jsonSchema) ? inputSchema.jsonSchema : inputSchema;
34613
- const properties = isRecord11(jsonSchema.properties) ? jsonSchema.properties : {};
35292
+ return inputSchema.fields.filter(isRecord12);
35293
+ const jsonSchema = isRecord12(inputSchema.jsonSchema) ? inputSchema.jsonSchema : inputSchema;
35294
+ const properties = isRecord12(jsonSchema.properties) ? jsonSchema.properties : {};
34614
35295
  const required = Array.isArray(jsonSchema.required) ? new Set(jsonSchema.required.map(String)) : /* @__PURE__ */ new Set();
34615
35296
  return Object.entries(properties).map(([name, value]) => {
34616
- const property = isRecord11(value) ? value : {};
35297
+ const property = isRecord12(value) ? value : {};
34617
35298
  return {
34618
35299
  name,
34619
35300
  type: typeof property.type === "string" ? property.type : "unknown",
@@ -34624,10 +35305,10 @@ function toolInputFieldsForDisplay(inputSchema) {
34624
35305
  });
34625
35306
  }
34626
35307
  function canonicalToolJsonSchema(inputSchema) {
34627
- return isRecord11(inputSchema.jsonSchema) ? inputSchema.jsonSchema : inputSchema;
35308
+ return isRecord12(inputSchema.jsonSchema) ? inputSchema.jsonSchema : inputSchema;
34628
35309
  }
34629
35310
  function declaredToolJsonSchema(inputSchema) {
34630
- if (isRecord11(inputSchema.jsonSchema)) {
35311
+ if (isRecord12(inputSchema.jsonSchema)) {
34631
35312
  return inputSchema.jsonSchema;
34632
35313
  }
34633
35314
  return Array.isArray(inputSchema.fields) ? null : inputSchema;
@@ -34652,7 +35333,7 @@ function publicToolInputSchemaForDescribe(inputSchema) {
34652
35333
  };
34653
35334
  const stripDescriptions = (value) => {
34654
35335
  if (Array.isArray(value)) return value.map(stripDescriptions);
34655
- if (!isRecord11(value)) return value;
35336
+ if (!isRecord12(value)) return value;
34656
35337
  return Object.fromEntries(
34657
35338
  Object.entries(value).flatMap(([key, nested]) => {
34658
35339
  if (key === "description" && typeof nested === "string" && exposesProviderSpend(nested)) {
@@ -34673,7 +35354,7 @@ function recursiveToolInputFieldsForDisplay(inputSchema) {
34673
35354
  for (const item of value) collectSchemaIds(item);
34674
35355
  return;
34675
35356
  }
34676
- if (!isRecord11(value)) return;
35357
+ if (!isRecord12(value)) return;
34677
35358
  if (typeof value.$id === "string" && value.$id.trim()) {
34678
35359
  schemasById.set(value.$id.trim(), value);
34679
35360
  }
@@ -34686,10 +35367,10 @@ function recursiveToolInputFieldsForDisplay(inputSchema) {
34686
35367
  let current = root;
34687
35368
  for (const rawSegment of ref.slice(2).split("/")) {
34688
35369
  const segment = rawSegment.replace(/~1/g, "/").replace(/~0/g, "~");
34689
- if (!isRecord11(current)) return schema;
35370
+ if (!isRecord12(current)) return schema;
34690
35371
  current = current[segment];
34691
35372
  }
34692
- return isRecord11(current) ? current : schema;
35373
+ return isRecord12(current) ? current : schema;
34693
35374
  };
34694
35375
  const addField = (field) => {
34695
35376
  const name = typeof field.name === "string" ? field.name : "";
@@ -34704,7 +35385,7 @@ function recursiveToolInputFieldsForDisplay(inputSchema) {
34704
35385
  if (ref && activeRefs.has(ref)) return;
34705
35386
  const schema = resolveRef(unresolvedSchema);
34706
35387
  const nextActiveRefs = ref ? /* @__PURE__ */ new Set([...activeRefs, ref]) : activeRefs;
34707
- const type = Array.isArray(schema.type) ? schema.type.map(String).join("|") : typeof schema.type === "string" ? schema.type : isRecord11(schema.properties) ? "object" : schema.items ? "array" : "unknown";
35388
+ const type = Array.isArray(schema.type) ? schema.type.map(String).join("|") : typeof schema.type === "string" ? schema.type : isRecord12(schema.properties) ? "object" : schema.items ? "array" : "unknown";
34708
35389
  if (path) {
34709
35390
  addField({
34710
35391
  name: path,
@@ -34715,12 +35396,12 @@ function recursiveToolInputFieldsForDisplay(inputSchema) {
34715
35396
  ...Object.prototype.hasOwnProperty.call(schema, "default") ? { default: schema.default } : {}
34716
35397
  });
34717
35398
  }
34718
- const properties = isRecord11(schema.properties) ? schema.properties : {};
35399
+ const properties = isRecord12(schema.properties) ? schema.properties : {};
34719
35400
  const requiredNames = new Set(
34720
35401
  Array.isArray(schema.required) ? schema.required.map(String) : []
34721
35402
  );
34722
35403
  for (const [name, value] of Object.entries(properties)) {
34723
- if (!isRecord11(value)) continue;
35404
+ if (!isRecord12(value)) continue;
34724
35405
  visit(
34725
35406
  value,
34726
35407
  path ? `${path}.${name}` : name,
@@ -34728,13 +35409,13 @@ function recursiveToolInputFieldsForDisplay(inputSchema) {
34728
35409
  nextActiveRefs
34729
35410
  );
34730
35411
  }
34731
- if (isRecord11(schema.items)) {
35412
+ if (isRecord12(schema.items)) {
34732
35413
  visit(schema.items, `${path}[]`, false, nextActiveRefs);
34733
35414
  }
34734
35415
  for (const keyword of ["anyOf", "oneOf", "allOf"]) {
34735
35416
  const branches = Array.isArray(schema[keyword]) ? schema[keyword] : [];
34736
35417
  for (const branch of branches) {
34737
- if (isRecord11(branch)) {
35418
+ if (isRecord12(branch)) {
34738
35419
  visit(branch, path, required, nextActiveRefs);
34739
35420
  }
34740
35421
  }
@@ -34762,14 +35443,14 @@ function printJsonPreview(label, payload) {
34762
35443
  }
34763
35444
  function samplePayload(samples, key) {
34764
35445
  const entry = samples[key];
34765
- if (!isRecord11(entry)) return void 0;
35446
+ if (!isRecord12(entry)) return void 0;
34766
35447
  return Object.prototype.hasOwnProperty.call(entry, "payload") ? entry.payload : entry;
34767
35448
  }
34768
35449
  function commandEnvelopeFromRawResponse(rawResponse) {
34769
- return isRecord11(rawResponse) ? { ...rawResponse } : { status: "completed", result: rawResponse };
35450
+ return isRecord12(rawResponse) ? { ...rawResponse } : { status: "completed", result: rawResponse };
34770
35451
  }
34771
35452
  function extractToolExecutionWarningMessages(rawResponse) {
34772
- if (!isRecord11(rawResponse)) return [];
35453
+ if (!isRecord12(rawResponse)) return [];
34773
35454
  const candidates = [
34774
35455
  recordField2(recordField2(rawResponse, "toolResponse"), "meta"),
34775
35456
  recordField2(
@@ -34786,7 +35467,7 @@ function extractToolExecutionWarningMessages(rawResponse) {
34786
35467
  for (const warning of warnings) {
34787
35468
  if (typeof warning === "string" && warning.trim()) {
34788
35469
  messages.push(warning.trim());
34789
- } else if (isRecord11(warning)) {
35470
+ } else if (isRecord12(warning)) {
34790
35471
  const message = stringField2(warning, "message");
34791
35472
  if (message) messages.push(message);
34792
35473
  }
@@ -34795,7 +35476,7 @@ function extractToolExecutionWarningMessages(rawResponse) {
34795
35476
  return [...new Set(messages)];
34796
35477
  }
34797
35478
  function apifySyncRecoveryNext(rawResponse) {
34798
- if (!isRecord11(rawResponse) || rawResponse.status !== "running") return null;
35479
+ if (!isRecord12(rawResponse) || rawResponse.status !== "running") return null;
34799
35480
  const toolResponse = recordField2(rawResponse, "toolResponse");
34800
35481
  const raw = recordField2(toolResponse, "raw");
34801
35482
  if (raw.state !== "awaiting_apify") return null;
@@ -34818,7 +35499,7 @@ function apifySyncRecoveryNext(rawResponse) {
34818
35499
  }
34819
35500
  function listExtractorPathsFromUsageGuidance(tool) {
34820
35501
  const toolExecutionResult = tool.usageGuidance?.toolExecutionResult;
34821
- const extractedLists = Array.isArray(toolExecutionResult?.extractedLists) ? toolExecutionResult.extractedLists : isRecord11(toolExecutionResult?.extractedLists) ? Object.values(toolExecutionResult.extractedLists) : [];
35502
+ const extractedLists = Array.isArray(toolExecutionResult?.extractedLists) ? toolExecutionResult.extractedLists : isRecord12(toolExecutionResult?.extractedLists) ? Object.values(toolExecutionResult.extractedLists) : [];
34822
35503
  return extractedLists.flatMap((entry) => {
34823
35504
  const paths = entry.details?.candidatePaths ?? entry.details?.rawToolOutputPaths;
34824
35505
  if (!Array.isArray(paths)) return [];
@@ -34834,7 +35515,7 @@ function formatDecimal(value) {
34834
35515
  function formatUsd(value) {
34835
35516
  return `$${formatDecimal(value)}`;
34836
35517
  }
34837
- function isRecord11(value) {
35518
+ function isRecord12(value) {
34838
35519
  return Boolean(value && typeof value === "object" && !Array.isArray(value));
34839
35520
  }
34840
35521
  function stringField2(source, ...keys) {
@@ -34861,7 +35542,7 @@ function arrayField2(source, ...keys) {
34861
35542
  function recordField2(source, ...keys) {
34862
35543
  for (const key of keys) {
34863
35544
  const value = source[key];
34864
- if (isRecord11(value)) return value;
35545
+ if (isRecord12(value)) return value;
34865
35546
  }
34866
35547
  return {};
34867
35548
  }
@@ -34927,7 +35608,7 @@ function parseJsonObjectArgument(raw, flagName) {
34927
35608
  }
34928
35609
  throw invalidJsonError(flagName, message);
34929
35610
  }
34930
- if (!isRecord11(parsed)) {
35611
+ if (!isRecord12(parsed)) {
34931
35612
  throw invalidJsonError(flagName, "expected an object.");
34932
35613
  }
34933
35614
  return parsed;
@@ -35077,7 +35758,7 @@ function buildToolExecuteBaseEnvelope(input2) {
35077
35758
  kind: summaryEntries.length > 0 ? "object" : "raw",
35078
35759
  summary: input2.summary
35079
35760
  };
35080
- const envelopeHasCanonicalOutput = isRecord11(envelope.toolResponse) && Object.prototype.hasOwnProperty.call(envelope.toolResponse, "raw");
35761
+ const envelopeHasCanonicalOutput = isRecord12(envelope.toolResponse) && Object.prototype.hasOwnProperty.call(envelope.toolResponse, "raw");
35081
35762
  const envelopeHasDeclaredOutput = Object.prototype.hasOwnProperty.call(
35082
35763
  envelope,
35083
35764
  "output"
@@ -35310,7 +35991,7 @@ async function executeTool(args) {
35310
35991
  {
35311
35992
  ...baseEnvelope,
35312
35993
  local: {
35313
- ...isRecord11(baseEnvelope.local) ? baseEnvelope.local : {},
35994
+ ...isRecord12(baseEnvelope.local) ? baseEnvelope.local : {},
35314
35995
  payload_file: jsonPath
35315
35996
  }
35316
35997
  },
@@ -36020,6 +36701,7 @@ var DEFAULT_V1_SKILL_NAMES = [
36020
36701
  "build-tam",
36021
36702
  "clay-to-deepline",
36022
36703
  "deepline-analytics",
36704
+ "deepline-engine",
36023
36705
  "deepline-feedback",
36024
36706
  "deepline-gtm",
36025
36707
  "deepline-plays",