deepline 0.3.273 → 0.3.275

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (29) hide show
  1. package/dist/bundling-sources/sdk/src/client.ts +143 -14
  2. package/dist/bundling-sources/sdk/src/index.ts +4 -1
  3. package/dist/bundling-sources/sdk/src/play.ts +5 -11
  4. package/dist/bundling-sources/sdk/src/release.ts +1 -1
  5. package/dist/bundling-sources/sdk/src/runs/log-cursor.ts +35 -0
  6. package/dist/bundling-sources/sdk/src/types.ts +10 -3
  7. package/dist/bundling-sources/shared_libs/observability/scheduled-jobs.json +12 -26
  8. package/dist/bundling-sources/shared_libs/observability/scheduled-work-manual.ts +7 -3
  9. package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backend.ts +15 -7
  10. package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/absurd.ts +18 -18
  11. package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/postgres.ts +1 -0
  12. package/dist/bundling-sources/shared_libs/plays/docflow-binding-owner.ts +7 -4
  13. package/dist/bundling-sources/shared_libs/plays/table-csv.ts +152 -0
  14. package/dist/cli/index.js +418 -103
  15. package/dist/cli/index.mjs +418 -103
  16. package/dist/{client-5xpuGpRn.d.ts → client-5zY7LsId.d.ts} +72 -7
  17. package/dist/{client-D9annc6K.d.mts → client-CbNvJLgV.d.mts} +72 -7
  18. package/dist/index.d.mts +6 -12
  19. package/dist/index.d.ts +6 -12
  20. package/dist/index.js +90 -12
  21. package/dist/index.mjs +90 -12
  22. package/dist/install-integrity.json +4 -2
  23. package/dist/plays/run-request.d.mts +1 -1
  24. package/dist/plays/run-request.d.ts +1 -1
  25. package/dist/release.d.mts +1 -1
  26. package/dist/release.d.ts +1 -1
  27. package/dist/release.js +1 -1
  28. package/dist/release.mjs +1 -1
  29. package/package.json +1 -1
package/dist/cli/index.js CHANGED
@@ -1966,7 +1966,7 @@ configureProxyFromEnv();
1966
1966
  var import_promises16 = require("fs/promises");
1967
1967
  var import_node_path35 = require("path");
1968
1968
  var import_node_os20 = require("os");
1969
- var import_commander6 = require("commander");
1969
+ var import_commander7 = require("commander");
1970
1970
 
1971
1971
  // ../plays/trigger-config-route.ts
1972
1972
  function playTriggerConfigPath(playName) {
@@ -1998,18 +1998,18 @@ function playInputExampleArgs(schema) {
1998
1998
  if (!schema) return " --input '@<input.json>'";
1999
1999
  if (schema.$ref || schema.allOf) return " --input '@<input.json>'";
2000
2000
  const csv = schema.csvInput;
2001
- const csvField = typeof csv?.inputField === "string" ? csv.inputField : null;
2001
+ const csvField2 = typeof csv?.inputField === "string" ? csv.inputField : null;
2002
2002
  const required = Array.isArray(schema.required) ? schema.required : [];
2003
- const csvOnlyRequired = required.every((key) => key === csvField);
2003
+ const csvOnlyRequired = required.every((key) => key === csvField2);
2004
2004
  const alternatives = schema.oneOf ?? schema.anyOf;
2005
2005
  const hasCsvAlternative = Array.isArray(alternatives) && alternatives.some((branch) => {
2006
2006
  if (!branch || typeof branch !== "object") return false;
2007
2007
  const keys = branch.required;
2008
- return Array.isArray(keys) && keys.includes(csvField) && keys.every((key) => key === csvField);
2008
+ return Array.isArray(keys) && keys.includes(csvField2) && keys.every((key) => key === csvField2);
2009
2009
  });
2010
- if (csvField && csvOnlyRequired && (!alternatives || hasCsvAlternative)) {
2011
- if (csvField === "csv") return " --csv '<contacts.csv>'";
2012
- const value = JSON.stringify({ [csvField]: "<contacts.csv>" });
2010
+ if (csvField2 && csvOnlyRequired && (!alternatives || hasCsvAlternative)) {
2011
+ if (csvField2 === "csv") return " --csv '<contacts.csv>'";
2012
+ const value = JSON.stringify({ [csvField2]: "<contacts.csv>" });
2013
2013
  return ` --input '${value.replace(/'/g, "'\\''")}'`;
2014
2014
  }
2015
2015
  if (Array.isArray(schema.required) && !required.length && !csv && !alternatives) {
@@ -3512,7 +3512,7 @@ var SDK_RELEASE = {
3512
3512
  // getters keep their established compatibility behavior.
3513
3513
  // 0.3.1 deprecated the legacy `deepline enrich` command in favor of Plays.
3514
3514
  // 0.3.90 is the first deliberately versioned SDK release for API v3.
3515
- version: "0.3.273",
3515
+ version: "0.3.275",
3516
3516
  updateSummary: "Play grep now returns concise results with the matched fields and terms. Automatic CLI updates are enabled by default; use `deepline settings autoupdate off` to opt out, `deepline settings autoupdate on` to re-enable updates, or `deepline settings autoupdate pin <version>` to hold an exact release.",
3517
3517
  packageCapabilities: {
3518
3518
  updatePreferences: 1
@@ -6215,6 +6215,28 @@ async function* watchRunEvents(options) {
6215
6215
  }
6216
6216
  }
6217
6217
 
6218
+ // src/runs/log-cursor.ts
6219
+ var RUN_LOGS_CURSOR_PREFIX = "before:";
6220
+ function encodeRunLogsCursor(beforeSequence) {
6221
+ return `${RUN_LOGS_CURSOR_PREFIX}${beforeSequence}`;
6222
+ }
6223
+ function isRunLogsCursor(value) {
6224
+ return value.startsWith(RUN_LOGS_CURSOR_PREFIX);
6225
+ }
6226
+ function parseRunLogsCursor(value) {
6227
+ const raw = isRunLogsCursor(value) ? value.slice(RUN_LOGS_CURSOR_PREFIX.length) : "";
6228
+ const parsed = /^[1-9]\d*$/.test(raw) ? Number(raw) : NaN;
6229
+ if (!Number.isSafeInteger(parsed)) {
6230
+ throw Object.assign(
6231
+ new Error(
6232
+ `Invalid run log cursor ${JSON.stringify(value)}. Pass the nextCursor value from a previous deepline runs logs result.`
6233
+ ),
6234
+ { exitCode: 2 }
6235
+ );
6236
+ }
6237
+ return parsed;
6238
+ }
6239
+
6218
6240
  // src/types.ts
6219
6241
  function isStopAllPlayRunsDryRunResult(result) {
6220
6242
  return "dryRun" in result && result.dryRun === true;
@@ -7165,6 +7187,7 @@ var DeeplineClient = class _DeeplineClient {
7165
7187
  status: (runId) => this.getRunLifecycleStatus(runId),
7166
7188
  list: (options2) => this.listRuns(options2),
7167
7189
  listPage: (options2) => this.listRunsPage(options2),
7190
+ history: (options2) => this.getRunsHistory(options2),
7168
7191
  watch: (runId, options2) => this.watchRunToTerminal(runId, options2),
7169
7192
  tail: (runId, options2) => this.tailRun(runId, options2),
7170
7193
  logs: (runId, options2) => this.getRunLogs(runId, options2),
@@ -7295,7 +7318,7 @@ var DeeplineClient = class _DeeplineClient {
7295
7318
  }
7296
7319
  playRunCommand(play) {
7297
7320
  const target = play.reference || play.name;
7298
- return `deepline plays run ${target}${playInputExampleArgs(play.inputSchema)} --watch`;
7321
+ return `deepline plays run ${target}${playInputExampleArgs(play.inputSchema)}`;
7299
7322
  }
7300
7323
  starterPlayPath(play) {
7301
7324
  const target = play.reference || play.name;
@@ -7856,7 +7879,7 @@ var DeeplineClient = class _DeeplineClient {
7856
7879
  * Convenience wrapper around {@link registerPlayArtifact} plus
7857
7880
  * {@link startPlayRun}. This is the canonical file-backed path used by wrappers.
7858
7881
  * The returned id can be passed to {@link getPlayStatus} to retrieve the same
7859
- * durable `{ result }` object that the CLI prints after `--watch` completes.
7882
+ * durable `{ result }` object that the CLI prints after `plays run` completes.
7860
7883
  *
7861
7884
  * @param code - Source string fallback; the bundled artifact should be passed in `options.artifact`
7862
7885
  * @param csvPath - Path to input CSV file, or `null`
@@ -7977,7 +8000,7 @@ var DeeplineClient = class _DeeplineClient {
7977
8000
  * Get the current status of a play execution.
7978
8001
  *
7979
8002
  * Internal/advanced primitive. Public callers should usually prefer
7980
- * {@link runPlay}, {@link PlayJob.get}, or `deepline plays run --watch`.
8003
+ * {@link runPlay}, {@link PlayJob.get}, or `deepline plays run`.
7981
8004
  *
7982
8005
  * @param workflowId - Play-run id from {@link startPlayRun}
7983
8006
  * @returns Current status with progress logs and partial results
@@ -8242,11 +8265,21 @@ var DeeplineClient = class _DeeplineClient {
8242
8265
  if (options?.full === true) {
8243
8266
  params.set("full", "true");
8244
8267
  }
8268
+ if (options?.configuration === true) {
8269
+ params.set("include", "configuration");
8270
+ }
8245
8271
  const query = params.size > 0 ? `?${params.toString()}` : "";
8246
8272
  const response = await this.http.get(
8247
8273
  `/api/v2/runs/${encodeURIComponent(runId)}${query}`,
8248
8274
  { headers: { "x-deepline-run-status": "1" } }
8249
8275
  );
8276
+ if (options?.configuration === true && !Object.hasOwn(response, "contract")) {
8277
+ throw new DeeplineError(
8278
+ "This server does not support recorded configuration reads.",
8279
+ void 0,
8280
+ "RUN_CONFIGURATION_UNAVAILABLE"
8281
+ );
8282
+ }
8250
8283
  const status = normalizePlayStatus(response);
8251
8284
  if (options?.failedLogs !== true || status.status !== "failed") {
8252
8285
  return status;
@@ -8334,6 +8367,33 @@ var DeeplineClient = class _DeeplineClient {
8334
8367
  async listRuns(options) {
8335
8368
  return (await this.listRunsPage(options)).runs;
8336
8369
  }
8370
+ /** The same tenant-scoped run history searched by the dashboard and CLI. */
8371
+ async getRunsHistory(options = {}) {
8372
+ const params = new URLSearchParams();
8373
+ const search = options.search?.trim();
8374
+ if (search && search.length > 200) {
8375
+ throw new Error("Run search must be at most 200 characters.");
8376
+ }
8377
+ if (options.type && options.type !== "all" && !search) {
8378
+ throw new Error("runs.history options.type requires options.search.");
8379
+ }
8380
+ if (search) params.set("search", search);
8381
+ if (search && options.type) params.set("type", options.type);
8382
+ if (options.cursor) params.set("cursor", options.cursor);
8383
+ if (options.orgId) params.set("orgId", options.orgId);
8384
+ if (options.limit !== void 0) {
8385
+ if (!Number.isSafeInteger(options.limit) || options.limit < 1) {
8386
+ throw new Error(
8387
+ "runs.history options.limit must be a positive integer."
8388
+ );
8389
+ }
8390
+ params.set("limit", String(options.limit));
8391
+ }
8392
+ return this.http.get(
8393
+ `/api/v2/dashboard/runs-history?${params.toString()}`,
8394
+ { signal: options.signal }
8395
+ );
8396
+ }
8337
8397
  /** Read one run page without discarding server pagination metadata. */
8338
8398
  async listRunsPage(options) {
8339
8399
  const playName = options.play?.trim();
@@ -8440,6 +8500,13 @@ var DeeplineClient = class _DeeplineClient {
8440
8500
  "INVALID_RUN_LOG_VIEW"
8441
8501
  );
8442
8502
  }
8503
+ if (options?.cursor !== void 0 && options.failed === true) {
8504
+ throw new DeeplineError(
8505
+ "runs.logs cannot combine failed with cursor.",
8506
+ void 0,
8507
+ "INVALID_RUN_LOG_VIEW"
8508
+ );
8509
+ }
8443
8510
  if (options?.failed === true) {
8444
8511
  const requestedLimit = typeof options.limit === "number" && Number.isFinite(options.limit) && options.limit > 0 ? Math.trunc(options.limit) : RUNS_FAILED_LOG_LIMIT;
8445
8512
  const failedLimit = Math.min(RUNS_FAILED_LOG_LIMIT, requestedLimit);
@@ -8465,6 +8532,7 @@ var DeeplineClient = class _DeeplineClient {
8465
8532
  ...page.logsTruncated ? { logsTruncated: true } : {}
8466
8533
  };
8467
8534
  }
8535
+ const beforeSequence = options?.cursor !== void 0 ? parseRunLogsCursor(options.cursor) : null;
8468
8536
  const limit = options?.all ? Number.MAX_SAFE_INTEGER : typeof options?.limit === "number" && Number.isFinite(options.limit) && options.limit > 0 ? Math.trunc(options.limit) : 200;
8469
8537
  const fetchPage = (afterSeq2, pageLimit) => this.http.get(
8470
8538
  `/api/v2/runs/${encodeURIComponent(runId)}/logs?afterSeq=${afterSeq2}&limit=${pageLimit}`,
@@ -8472,24 +8540,33 @@ var DeeplineClient = class _DeeplineClient {
8472
8540
  );
8473
8541
  const probe = await fetchPage(0, 1);
8474
8542
  const lastStoredSeq = probe.lastStoredSeq;
8475
- let afterSeq = options?.all ? 0 : Math.max(0, lastStoredSeq - limit);
8543
+ const oldestStoredSeq = probe.entries[0]?.seq ?? null;
8544
+ const upperSeq = beforeSequence === null ? Number.POSITIVE_INFINITY : Math.min(beforeSequence - 1, lastStoredSeq);
8545
+ const windowEndSeq = Math.min(upperSeq, lastStoredSeq);
8546
+ let afterSeq = options?.all ? 0 : Math.max(0, windowEndSeq - limit);
8476
8547
  const entries = [];
8477
- while (entries.length < limit) {
8548
+ while (entries.length < limit && afterSeq < upperSeq) {
8478
8549
  const page = await fetchPage(
8479
8550
  afterSeq,
8480
- Math.min(RUN_LOGS_PAGE_LIMIT, limit - entries.length)
8551
+ Math.min(
8552
+ RUN_LOGS_PAGE_LIMIT,
8553
+ limit - entries.length,
8554
+ upperSeq - afterSeq
8555
+ )
8481
8556
  );
8482
- if (page.entries.length === 0) {
8557
+ const inWindow = page.entries.filter((entry) => entry.seq <= upperSeq);
8558
+ if (inWindow.length === 0) {
8483
8559
  break;
8484
8560
  }
8485
- entries.push(...page.entries);
8486
- afterSeq = page.entries[page.entries.length - 1].seq;
8487
- if (!page.hasMore) {
8561
+ entries.push(...inWindow);
8562
+ afterSeq = inWindow[inWindow.length - 1].seq;
8563
+ if (!page.hasMore || inWindow.length < page.entries.length) {
8488
8564
  break;
8489
8565
  }
8490
8566
  }
8491
8567
  const firstSequence = entries.length > 0 ? entries[0].seq : null;
8492
8568
  const lastSequence = entries.length > 0 ? entries[entries.length - 1].seq : null;
8569
+ const olderLinesExist = firstSequence !== null && oldestStoredSeq !== null && firstSequence > oldestStoredSeq;
8493
8570
  return {
8494
8571
  runId: probe.runId,
8495
8572
  totalCount: probe.totalLogCount,
@@ -8497,7 +8574,8 @@ var DeeplineClient = class _DeeplineClient {
8497
8574
  firstSequence,
8498
8575
  lastSequence,
8499
8576
  truncated: entries.length < probe.totalLogCount,
8500
- hasMore: lastSequence !== null && lastSequence < lastStoredSeq,
8577
+ hasMore: olderLinesExist,
8578
+ nextCursor: olderLinesExist ? encodeRunLogsCursor(firstSequence) : null,
8501
8579
  entries: entries.map((entry) => entry.line),
8502
8580
  view: options?.all ? "all" : "tail",
8503
8581
  ...probe.logsTruncated ? { logsTruncated: true } : {}
@@ -10468,6 +10546,7 @@ var ROOTS = {
10468
10546
  check: "kind target checked scope name exportName valid stage issues inputSchema outputSchema recognized triggers runtimeLimit limits featureFlags sourceHash artifactHash graphHash toolGetterHints exports actions diagnostics reference origin ownerType activeScheduledPlays command_context",
10469
10547
  run: "schemaVersion kind run datasets actions apiVersion dashboardUrl progress rowOutcomes steps errors error warnings result resultState execution command_context diagnostics",
10470
10548
  get: "schemaVersion kind run runStatus steps failures errorDetails rowOutcomes warnings failedLogs datasets result resultState actions diagnostics command_context",
10549
+ config: "runId contract command_context",
10471
10550
  export: "runId datasets csv_path json_path format source rowCount columns notice metadata_path actions command_context"
10472
10551
  };
10473
10552
  function parseJsonFields(args, surface) {
@@ -14885,7 +14964,7 @@ Examples:
14885
14964
  var import_promises12 = require("fs/promises");
14886
14965
  var import_node_os10 = require("os");
14887
14966
  var import_node_path20 = require("path");
14888
- var import_commander3 = require("commander");
14967
+ var import_commander4 = require("commander");
14889
14968
 
14890
14969
  // ../plays/settings-contract.ts
14891
14970
  var import_zod = require("zod");
@@ -15788,12 +15867,12 @@ var SECTIONS = [
15788
15867
  title: "Choose the read",
15789
15868
  paragraphs: [
15790
15869
  "These commands read existing evidence; they do not start a run or execute a provider. Replace <run-id>, <play-name> and other angle-bracket values with identifiers returned by the CLI.",
15791
- "Text logs: runs logs <run-id> returns the last 200 retained lines by default. --out writes the full retained stream to a local file. --log-level filters text severity; debug includes all retained levels. --failed reads only a terminal-failed run\u2019s last 20 retained lines and reports retention limitations.",
15792
- "Event search: omit the run ID, or add any of --since, --until, --play, --kind, --where, --payloads, --cursor, --runtime-namespace or --runtime-backend. A supplied run ID then narrows the search. --limit and --json alone do not switch a run\u2019s text logs to event search. Text-only flags --out, --failed, --log-level, --logs and --debug cannot be combined with event search.",
15870
+ "Text logs: runs logs <run-id> returns the last 200 retained lines by default. When older lines exist, hasMore is true and nextCursor continues the next older page with --cursor. --out writes the full retained stream to a local file. --log-level filters text severity; debug includes all retained levels. --failed reads only a terminal-failed run\u2019s last 20 retained lines and reports retention limitations.",
15871
+ "Event search: omit the run ID, or add any of --since, --until, --play, --kind, --where, --payloads, --runtime-namespace or --runtime-backend. A supplied run ID then narrows the search. --cursor continues event search unless it is a returned before:<sequence> text-log cursor. --limit and --json alone do not switch a run\u2019s text logs to event search. Text-only flags --out, --failed and --log-level cannot be combined with event search.",
15793
15872
  "Current status and returned output selectors: runs get <run-id> --json. Live observation: runs watch <run-id>. Dataset rows: runs export <run-id> --dataset <returned-selector> --out rows.csv. A referenced tool response: runs receipt <run-id> --key <returned-receipt-key> --json. Read each command\u2019s --help for its options."
15794
15873
  ],
15795
15874
  commands: [
15796
- "deepline runs logs <run-id> --json",
15875
+ "deepline runs logs <run-id> --cursor before:1201 --json",
15797
15876
  "deepline runs logs <run-id> --out run.log --json",
15798
15877
  "deepline runs logs --kind run.failed --json",
15799
15878
  "deepline runs logs --kind step.failed --payloads --json",
@@ -15817,13 +15896,24 @@ var SECTIONS = [
15817
15896
  "Identity strings: orgId, runId, playName, runtimeScope. These come from authenticated execution state; filters only narrow your authorized organization/runtime. Preview reads require the existing runtime credential and an authorized --runtime-namespace; --runtime-backend selects daytona or modal.",
15818
15897
  "Event string: kind. Optional strings: source, stepId, stepKind, status, datasetId, phase, provider, operation. Optional positive integer: producerAttempt. These fields exist only when recorded; inspect a returned event before filtering on an optional field.",
15819
15898
  'stepId/stepKind describe recorded step work; datasetId/phase describe dataset lifecycle (registered, available, failed). provider/operation appear on typed provider activity.observed events, not every receipt or provider call. status is the recorded status or activity state when present: run.completed and step.completed do not imply status == "completed". Select lifecycle outcomes with --kind.',
15820
- "context.<key> matches an authored flat scalar log field: string, number or boolean. Context cannot override event identity. Missing fields do not match. --where supports only $.field == literal predicates joined with &&, at most eight predicates and 512 bytes. No OR, ranges, wildcards, nested payload paths or text search. Time uses --since/--until; level and message are not --where fields."
15899
+ "context.<key> matches an authored flat scalar log field: string, number or boolean. Context cannot override event identity. Missing fields do not match. --where supports only $.field == literal predicates joined with &&, at most eight predicates and 512 bytes. No OR, ranges, wildcards, nested payload paths or text search. Time uses --since/--until; level and message are not --where fields.",
15900
+ 'Wrap the entire predicate in single shell quotes so $ and && reach the CLI unchanged. Inside it, strings use double quotes; numbers and booleans are unquoted. Types must match: 2 differs from "2", false differs from "false". Examples use illustrative recorded values; use your own step IDs, dataset IDs, provider/operation names and authored context. The context examples assume ctx.log recorded companyId: "acme_123", attempt: 2 and cached: false.'
15821
15901
  ],
15822
15902
  commands: [
15903
+ "# Failed retained work with its stored error/result",
15823
15904
  `deepline runs logs --kind receipt.failed --where '$.status == "failed"' --payloads --json`,
15824
- `deepline runs logs <run-id> --where '$.source == "worker" && $.producerAttempt == 1' --json`,
15825
- `deepline runs logs --kind activity.observed --where '$.provider == "<returned-provider>" && $.operation == "<returned-operation>"' --json`,
15826
- `deepline runs logs --kind log.appended --where '$.context.<authored-key> == "<recorded-value>"' --json`
15905
+ "# Failure details for one named step",
15906
+ `deepline runs logs --kind step.failed --where '$.stepId == "company-lookup"' --payloads --json`,
15907
+ "# Typed provider observations matching both fields",
15908
+ `deepline runs logs --kind activity.observed --where '$.provider == "apollo" && $.operation == "company_lookup"' --json`,
15909
+ "# Failed lifecycle transitions for one dataset",
15910
+ `deepline runs logs --kind dataset.lifecycle --where '$.datasetId == "companies" && $.phase == "failed"' --payloads --json`,
15911
+ "# Authored string context on log lines",
15912
+ `deepline runs logs --kind log.appended --where '$.context.companyId == "acme_123"' --json`,
15913
+ "# Authored number and boolean context, both required to match",
15914
+ "deepline runs logs --kind log.appended --where '$.context.attempt == 2 && $.context.cached == false' --json",
15915
+ "# Known producer identity within one run",
15916
+ `deepline runs logs <run-id> --where '$.source == "worker" && $.producerAttempt == 1' --json`
15827
15917
  ]
15828
15918
  },
15829
15919
  {
@@ -16693,6 +16783,7 @@ ${JSON.stringify(value, null, 2)}` : `${key}: ${String(value)}`
16693
16783
  var import_node_fs13 = require("fs");
16694
16784
  var import_promises11 = require("fs/promises");
16695
16785
  var import_node_path19 = require("path");
16786
+ var import_commander3 = require("commander");
16696
16787
 
16697
16788
  // src/cli/commands/plays/bootstrap.ts
16698
16789
  var import_node_fs8 = require("fs");
@@ -17047,7 +17138,7 @@ Example: deepline plays bootstrap people-email --from csv:data/leads.csv --using
17047
17138
  `Unknown plays bootstrap template: ${rawTemplate}
17048
17139
  Supported templates: ${formatPlayBootstrapTemplates()}|${MONITOR_BOOTSTRAP_TEMPLATE}` + (looksLikePlayReference ? `
17049
17140
 
17050
- "${rawTemplate}" looks like an existing play reference or file, not a bootstrap template. Do not run plays bootstrap on prebuilt/<play-name>. Use "deepline plays run ${rawTemplate} --input '{...}' --watch" to run it directly, "deepline plays describe ${rawTemplate} --json" to inspect its contract, or "deepline plays get ${rawTemplate} --source --out scratchpad.play.ts" to clone/edit it.` : "")
17141
+ "${rawTemplate}" looks like an existing play reference or file, not a bootstrap template. Do not run plays bootstrap on prebuilt/<play-name>. Use "deepline plays run ${rawTemplate} --input '{...}'" to run it directly, "deepline plays describe ${rawTemplate} --json" to inspect its contract, or "deepline plays get ${rawTemplate} --source --out scratchpad.play.ts" to clone/edit it.` : "")
17051
17142
  );
17052
17143
  }
17053
17144
  return rawTemplate;
@@ -17816,7 +17907,7 @@ function playUsesMapBackedRuntime(play) {
17816
17907
  }
17817
17908
  function assertComposablePlayRoute(input2) {
17818
17909
  if (!input2.playRef || !playUsesMapBackedRuntime(input2.play)) return;
17819
- const runCommand2 = input2.play?.runCommand?.trim() || `deepline plays run ${input2.playRef} --input '{...}' --watch`;
17910
+ const runCommand2 = input2.play?.runCommand?.trim() || `deepline plays run ${input2.playRef} --input '{...}'`;
17820
17911
  throw new PlayBootstrapValidationError(
17821
17912
  `Cannot use ${input2.stageLabel} play:${input2.playRef} in plays bootstrap composition: the selected play is dataset-backed/direct-run-only. Child plays that use ctx.dataset() own durable table state and must be run directly, exported, or validated as their own play instead of wrapped with ctx.runPlay. Run it directly first: ${runCommand2}`
17822
17913
  );
@@ -17858,14 +17949,14 @@ function generatePlaySourceRowsBlock(input2) {
17858
17949
  sourcePlay: input2.sourcePlay
17859
17950
  })) {
17860
17951
  const sourcePlay = input2.sourcePlay;
17861
- const runCommand2 = sourcePlay?.runCommand?.trim() || `deepline plays run ${input2.source.value} --input '{...}' --watch`;
17952
+ const runCommand2 = sourcePlay?.runCommand?.trim() || `deepline plays run ${input2.source.value} --input '{...}'`;
17862
17953
  return `// Source play ${input2.source.value} is dataset-backed/direct-run-only, so this generated play is stage 2.
17863
17954
  // Stage 1:
17864
17955
  // ${runCommand2}
17865
17956
  // Stage 2:
17866
17957
  // deepline runs export <stage-1-run-id> --dataset 'result.rows' --out source-export.csv
17867
17958
  // Stage 3:
17868
- // deepline plays run <this-file.play.ts> --input '{"sourceCsv":"source-export.csv","limit":${input2.sourcePlay ? "5" : "5"}}' --watch
17959
+ // deepline plays run <this-file.play.ts> --input '{"sourceCsv":"source-export.csv","limit":${input2.sourcePlay ? "5" : "5"}}'
17869
17960
  const sourceDataset = await ctx.csv<${input2.collectionType}>(input.sourceCsv ?? './source-export.csv');
17870
17961
  const ${input2.collection}: ${input2.collectionType}[] = await sourceDataset.peek(limit);`;
17871
17962
  }
@@ -18345,7 +18436,7 @@ Notes:
18345
18436
  Examples:
18346
18437
  deepline plays bootstrap people-email --from csv:data/leads.csv --using play:prebuilt/name-and-domain-to-email-waterfall --limit 5 --out email-flow.play.ts
18347
18438
  deepline plays check email-flow.play.ts
18348
- deepline plays run email-flow.play.ts --input '{"limit":5}' --watch
18439
+ deepline plays run email-flow.play.ts --input '{"limit":5}'
18349
18440
 
18350
18441
  deepline plays bootstrap people-email --from provider:dropleads_search_people --using providers:hunter_email_finder,leadmagic_email_finder --limit 5 --out prospecting.play.ts
18351
18442
  deepline plays bootstrap company-people-email --from provider:crustdata_companydb_search --people play:prebuilt/company-to-contact --email play:prebuilt/name-and-domain-to-email-waterfall --limit 5 --out account-contacts.play.ts
@@ -18533,24 +18624,31 @@ includes nextCommand when another page is available.
18533
18624
 
18534
18625
  // src/cli/commands/plays/run-history.ts
18535
18626
  async function handleRunsHistory(options) {
18536
- const query = new URLSearchParams();
18537
- if (options.cursor) query.set("cursor", options.cursor);
18538
- if (options.org) query.set("orgId", options.org);
18627
+ let limit;
18628
+ if (options.type && !["all", "plays", "monitors"].includes(options.type)) {
18629
+ throw new Error("--type must be all, plays or monitors.");
18630
+ }
18539
18631
  if (options.limit !== void 0) {
18540
- const limit = Number(options.limit);
18632
+ limit = Number(options.limit);
18541
18633
  if (!/^\d+$/.test(options.limit) || !Number.isSafeInteger(limit) || limit < 1) {
18542
18634
  throw new Error("--limit must be a positive integer.");
18543
18635
  }
18544
- query.set("limit", String(limit));
18545
18636
  }
18546
- const search = query.toString();
18547
- const page = await new HttpClient(resolveConfig()).get(
18548
- `/api/v2/dashboard/runs-history${search ? `?${search}` : ""}`
18549
- );
18637
+ const page = await new DeeplineClient().runs.history({
18638
+ cursor: options.cursor,
18639
+ orgId: options.org,
18640
+ search: options.search,
18641
+ type: options.type,
18642
+ limit
18643
+ });
18550
18644
  const lines = page.runs.map(
18551
18645
  (run) => `${run.workflowName} \xB7 ${run.status} \xB7 ${run.runId}`
18552
18646
  );
18553
- if (lines.length === 0) lines.push("No runs found on this page.");
18647
+ if (lines.length === 0) {
18648
+ lines.push(
18649
+ options.search && page.hasMore ? "No matches in this page; continue searching with the next cursor." : "No runs found on this page."
18650
+ );
18651
+ }
18554
18652
  if (page.hasMore) lines.push(`Next cursor: ${page.nextCursor}`);
18555
18653
  printCommandEnvelope(
18556
18654
  { ...page, render: { sections: [{ title: "Run history", lines }] } },
@@ -18562,6 +18660,12 @@ function registerRunHistoryCommand(runs) {
18562
18660
  "--cursor <cursor>",
18563
18661
  "Opaque nextCursor returned by the previous page"
18564
18662
  ).option("--limit <count>", "Maximum runs on this page").option(
18663
+ "--search <text>",
18664
+ "Search Play/workflow names, run IDs and statuses"
18665
+ ).option(
18666
+ "--type <type>",
18667
+ "Search all, plays or monitors (requires --search)"
18668
+ ).option(
18565
18669
  "--org <id>",
18566
18670
  "Workspace ID (must match the authenticated workspace)"
18567
18671
  ).option("--json", "Emit JSON output. Also automatic when stdout is piped").addHelpText(
@@ -24272,6 +24376,63 @@ var SDK_TYPES_ENTRY_FILE = HAS_SOURCE_BUNDLING_SOURCES ? SDK_ENTRY_FILE : (0, im
24272
24376
  var import_node_fs11 = require("fs");
24273
24377
  var import_node_path13 = require("path");
24274
24378
 
24379
+ // ../plays/table-csv.ts
24380
+ var TABLE_EXPORT_ERROR_COLUMN = "_error";
24381
+ var UNRECORDED_FAILURE_REASON = "Row failed without a recorded reason.";
24382
+ function tableCellText(value) {
24383
+ if (value === null || value === void 0) return "";
24384
+ if (typeof value === "string") return value;
24385
+ if (typeof value === "number" || typeof value === "bigint" || typeof value === "boolean")
24386
+ return String(value);
24387
+ if (value instanceof Date) return value.toISOString();
24388
+ if (typeof value === "symbol" || typeof value === "function") return "";
24389
+ try {
24390
+ return JSON.stringify(
24391
+ value,
24392
+ (_key, nested) => typeof nested === "bigint" ? nested.toString() : nested
24393
+ ) ?? "";
24394
+ } catch {
24395
+ return String(value);
24396
+ }
24397
+ }
24398
+ function csvField(value) {
24399
+ const text = tableCellText(value);
24400
+ return /[",\r\n]/.test(text) ? `"${text.replaceAll('"', '""')}"` : text;
24401
+ }
24402
+ function csvRecord(values) {
24403
+ return `${values.map(csvField).join(",")}
24404
+ `;
24405
+ }
24406
+ function isFailedRow(row) {
24407
+ return row.status === "failed";
24408
+ }
24409
+ function tableExportHasFailedRows(rows) {
24410
+ for (const row of rows) if (isFailedRow(row)) return true;
24411
+ return false;
24412
+ }
24413
+ function tableExportErrorCell(row) {
24414
+ if (!isFailedRow(row)) return "";
24415
+ const reason = typeof row.error === "string" ? row.error.trim() : "";
24416
+ return reason || UNRECORDED_FAILURE_REASON;
24417
+ }
24418
+ function tableExportColumns(columns, withError) {
24419
+ if (!withError) return [...columns];
24420
+ return [
24421
+ ...columns.filter((column) => column !== TABLE_EXPORT_ERROR_COLUMN),
24422
+ TABLE_EXPORT_ERROR_COLUMN
24423
+ ];
24424
+ }
24425
+ function tableExportCells(row, columns, withError) {
24426
+ return tableExportColumns(columns, withError).map(
24427
+ (column) => column === TABLE_EXPORT_ERROR_COLUMN && withError ? tableExportErrorCell(row) : Object.hasOwn(row.data, column) ? row.data[column] : void 0
24428
+ );
24429
+ }
24430
+ function tableCsvText(header, records) {
24431
+ let text = csvRecord(header);
24432
+ for (const record5 of records) text += csvRecord(record5);
24433
+ return text;
24434
+ }
24435
+
24275
24436
  // src/cli/run-dataset-order.ts
24276
24437
  function underscoreKeysLast(keys) {
24277
24438
  return [...keys].sort(
@@ -24320,9 +24481,13 @@ var RunDatasetCsv = class _RunDatasetCsv {
24320
24481
  }
24321
24482
  write(outPath) {
24322
24483
  const absolutePath = (0, import_node_path13.resolve)(outPath);
24484
+ const { rows, columns } = this.#projection;
24323
24485
  (0, import_node_fs11.writeFileSync)(
24324
24486
  absolutePath,
24325
- csvStringFromRows(this.#projection.rows, this.#projection.columns),
24487
+ tableCsvText(
24488
+ columns,
24489
+ rows.map((data) => tableExportCells({ data }, columns, false))
24490
+ ),
24326
24491
  "utf-8"
24327
24492
  );
24328
24493
  return absolutePath;
@@ -28280,7 +28445,7 @@ function buildPlayReferenceNotFoundMessage(input2) {
28280
28445
  lines.push("", ` ${suggestion.reference}`);
28281
28446
  if (input2.command === "run") {
28282
28447
  lines.push(
28283
- ` deepline plays run ${suggestion.reference} --input '{...}' --watch`
28448
+ ` deepline plays run ${suggestion.reference} --input '{...}'`
28284
28449
  );
28285
28450
  } else if (input2.command === "get") {
28286
28451
  lines.push(` deepline plays get ${suggestion.reference} --json`);
@@ -31604,7 +31769,9 @@ function buildOrdinaryPlayRunCommand(options, resolvedRevisionId) {
31604
31769
  }
31605
31770
  if (options.open) parts.push("--open");
31606
31771
  if (options.fullJson) parts.push("--full");
31607
- if (options.jsonOutput && options.emitLogs) parts.push("--logs");
31772
+ if (options.jsonOutput && options.emitLogs) {
31773
+ parts.push("--log-level", "debug");
31774
+ }
31608
31775
  if (options.jsonOutput) parts.push("--json");
31609
31776
  return parts.join(" ");
31610
31777
  }
@@ -31916,7 +32083,20 @@ async function fetchBackingDatasetRows(input2) {
31916
32083
  }
31917
32084
  offset += page.rows.length;
31918
32085
  }
31919
- const rows = sheetRows.map(exportableSheetRow).filter((row) => Boolean(row));
32086
+ const withError = tableExportHasFailedRows(
32087
+ sheetRows.filter(
32088
+ (row) => Boolean(row) && typeof row === "object" && !Array.isArray(row)
32089
+ )
32090
+ );
32091
+ const rows = sheetRows.map((row) => {
32092
+ const data = exportableSheetRow(row);
32093
+ return data && withError ? {
32094
+ ...data,
32095
+ [TABLE_EXPORT_ERROR_COLUMN]: tableExportErrorCell(
32096
+ row
32097
+ )
32098
+ } : data;
32099
+ }).filter((row) => Boolean(row));
31920
32100
  const hasCompleteSettledPrefix = acceptsSettledRowsAsCompleteExport(input2.status) && settledTotal !== null && // A zero-row run-scoped read is not a settled export when the returned
31921
32101
  // Dataset Handle advertised rows. That shape is the replay/reuse case:
31922
32102
  // the rows belong to another writer (or the projection has not caught up)
@@ -32688,7 +32868,7 @@ function parsePlayRunOptions(args) {
32688
32868
  }
32689
32869
  if (arg === "--tail") {
32690
32870
  throw new Error(
32691
- "--tail is removed for `plays run`; use `--watch` to stream completion output."
32871
+ "--tail is removed for `plays run`; run waits and streams completion output by default."
32692
32872
  );
32693
32873
  }
32694
32874
  continue;
@@ -33898,9 +34078,12 @@ function renderRunOverviewText(overview, extras = {}) {
33898
34078
  ${renderCommandEnvelopeText({ render: { sections, actions: actions2 } })}`;
33899
34079
  }
33900
34080
  async function handleRunGet(args) {
33901
- const selection = parseJsonFields(args, "get");
34081
+ const selection = parseJsonFields(
34082
+ args,
34083
+ args.includes("--config") ? "config" : "get"
34084
+ );
33902
34085
  args = selection.args;
33903
- const usage2 = "Usage: deepline runs get <run-id> [--json] [--full] [--input] [--log-failed]";
34086
+ const usage2 = "Usage: deepline runs get <run-id> [--json] [--full] [--input] [--config] [--log-failed]";
33904
34087
  let runId;
33905
34088
  try {
33906
34089
  runId = parseRunIdPositional(args, usage2);
@@ -33909,6 +34092,25 @@ async function handleRunGet(args) {
33909
34092
  return 1;
33910
34093
  }
33911
34094
  const client2 = new DeeplineClient();
34095
+ if (args.includes("--config")) {
34096
+ if (args.some((arg) => ["--input", "--full", "--log-failed"].includes(arg))) {
34097
+ console.error(
34098
+ "--config cannot be combined with --input, --full or --log-failed."
34099
+ );
34100
+ return 1;
34101
+ }
34102
+ const status2 = await client2.runs.get(runId, { configuration: true });
34103
+ if (!Object.hasOwn(status2, "contract")) {
34104
+ throw new Error(
34105
+ "This server does not support recorded configuration reads."
34106
+ );
34107
+ }
34108
+ printCommandEnvelope(
34109
+ { runId, contract: status2.contract ?? null },
34110
+ { json: true, fields: selection.fields }
34111
+ );
34112
+ return 0;
34113
+ }
33912
34114
  if (args.includes("--input")) {
33913
34115
  const input2 = await client2.getRunInput(runId);
33914
34116
  printCommandEnvelope(input2, { json: true });
@@ -34414,15 +34616,17 @@ async function handleRunLogs(args) {
34414
34616
  "--play",
34415
34617
  "--kind",
34416
34618
  "--where",
34417
- "--cursor",
34418
34619
  "--payloads",
34419
34620
  "--runtime-namespace",
34420
34621
  "--runtime-backend"
34421
34622
  ]);
34422
- if (!args[0] || args[0].startsWith("--") || args.some((arg) => searchFlags.has(arg))) {
34623
+ const cursorIndex = args.indexOf("--cursor");
34624
+ const cursorValue = cursorIndex >= 0 ? args[cursorIndex + 1] : void 0;
34625
+ const continuesEventSearch = cursorIndex >= 0 && !(cursorValue && isRunLogsCursor(cursorValue));
34626
+ if (!args[0] || args[0].startsWith("--") || continuesEventSearch || args.some((arg) => searchFlags.has(arg))) {
34423
34627
  return handleRunEventSearch(args);
34424
34628
  }
34425
- const usage2 = "Usage: deepline runs logs <run-id> [--limit 200] [--failed] [--out run.log] [--log-level debug|info|warn|error] [--json]";
34629
+ const usage2 = "Usage: deepline runs logs <run-id> [--limit 200] [--cursor before:<seq>] [--failed] [--out run.log] [--log-level debug|info|warn|error] [--json]";
34426
34630
  let runId;
34427
34631
  try {
34428
34632
  runId = parseRunIdPositional(args, usage2);
@@ -34432,6 +34636,7 @@ async function handleRunLogs(args) {
34432
34636
  }
34433
34637
  let limit = 200;
34434
34638
  let outPath = null;
34639
+ let cursor;
34435
34640
  let logLevel = "debug";
34436
34641
  let hasExplicitLogLevel = false;
34437
34642
  let usesDebugAlias = false;
@@ -34470,6 +34675,10 @@ async function handleRunLogs(args) {
34470
34675
  outPath = (0, import_node_path19.resolve)(args[++index]);
34471
34676
  continue;
34472
34677
  }
34678
+ if (arg === "--cursor" && args[index + 1]) {
34679
+ cursor = args[++index];
34680
+ continue;
34681
+ }
34473
34682
  if (arg.startsWith("--")) {
34474
34683
  console.error(`${arg} is not supported by deepline runs logs.`);
34475
34684
  return 1;
@@ -34488,6 +34697,12 @@ async function handleRunLogs(args) {
34488
34697
  );
34489
34698
  return 1;
34490
34699
  }
34700
+ if (cursor !== void 0 && (failed || outPath)) {
34701
+ console.error(
34702
+ "--cursor pages the bounded log tail; it cannot be combined with --failed or --out."
34703
+ );
34704
+ return 1;
34705
+ }
34491
34706
  const client2 = new DeeplineClient();
34492
34707
  if (outPath) {
34493
34708
  const result2 = await client2.runs.logs(runId, { all: true });
@@ -34521,19 +34736,25 @@ async function handleRunLogs(args) {
34521
34736
  return 0;
34522
34737
  }
34523
34738
  const result = await client2.runs.logs(runId, {
34524
- ...failed ? { limit, failed: true } : { all: logLevel !== "debug", limit }
34525
- });
34526
- const matchingEntries = result.entries.filter(
34527
- (line) => logLevelReaches(classifyLogLine(line).level, logLevel)
34528
- );
34529
- const entries = failed ? matchingEntries : matchingEntries.slice(-limit);
34530
- const matchingEntriesTruncated = !failed && matchingEntries.length > limit;
34739
+ ...failed ? { limit, failed: true } : { all: logLevel !== "debug", limit },
34740
+ ...cursor !== void 0 ? { cursor } : {}
34741
+ });
34742
+ const page = failed ? {
34743
+ entries: result.entries,
34744
+ firstSequence: result.firstSequence,
34745
+ lastSequence: result.lastSequence,
34746
+ truncated: result.truncated,
34747
+ hasMore: result.hasMore,
34748
+ nextCursor: void 0
34749
+ } : selectRunLogTailPage(result, logLevel, limit);
34750
+ const entries = page.entries;
34751
+ const nextPage = page.nextCursor ? `deepline runs logs ${result.runId} --limit ${limit}${logLevel === "debug" ? "" : ` --log-level ${logLevel}`} --cursor ${page.nextCursor} --json` : null;
34531
34752
  const filteredResult = {
34532
34753
  ...result,
34533
34754
  entries,
34534
34755
  returnedCount: entries.length,
34535
- truncated: result.truncated || matchingEntriesTruncated,
34536
- hasMore: result.hasMore || matchingEntriesTruncated,
34756
+ truncated: page.truncated,
34757
+ hasMore: page.hasMore,
34537
34758
  view: failed ? result.view : "tail",
34538
34759
  next: {
34539
34760
  ...result.next ?? {},
@@ -34546,10 +34767,11 @@ async function handleRunLogs(args) {
34546
34767
  runId: result.runId,
34547
34768
  totalCount: result.totalCount,
34548
34769
  returnedCount: entries.length,
34549
- firstSequence: result.firstSequence,
34550
- lastSequence: result.lastSequence,
34770
+ firstSequence: page.firstSequence,
34771
+ lastSequence: page.lastSequence,
34551
34772
  truncated: filteredResult.truncated,
34552
34773
  hasMore: filteredResult.hasMore,
34774
+ ...page.nextCursor !== void 0 ? { nextCursor: page.nextCursor } : {},
34553
34775
  logLevel,
34554
34776
  ...result.logsTruncated ? { logsTruncated: true } : {},
34555
34777
  entries,
@@ -34558,6 +34780,7 @@ async function handleRunLogs(args) {
34558
34780
  ...result.warning ? { warning: result.warning } : {},
34559
34781
  next: {
34560
34782
  ...result.next ?? {},
34783
+ ...nextPage ? { page: nextPage } : {},
34561
34784
  export: `deepline runs logs ${result.runId} --out run.log --log-level ${logLevel} --json`
34562
34785
  },
34563
34786
  render: { sections: [{ title: "run logs", lines: entries }] }
@@ -34569,6 +34792,37 @@ async function handleRunLogs(args) {
34569
34792
  );
34570
34793
  return 0;
34571
34794
  }
34795
+ function selectRunLogTailPage(result, logLevel, limit) {
34796
+ if (logLevel === "debug") {
34797
+ return {
34798
+ entries: [...result.entries],
34799
+ firstSequence: result.firstSequence,
34800
+ lastSequence: result.lastSequence,
34801
+ truncated: result.truncated,
34802
+ hasMore: result.hasMore,
34803
+ nextCursor: result.nextCursor ?? null
34804
+ };
34805
+ }
34806
+ const first = result.firstSequence;
34807
+ if (result.entries.length > 0 && (first === null || result.lastSequence === null || result.lastSequence - first + 1 !== result.entries.length)) {
34808
+ throw new Error(
34809
+ `Run log window is not contiguous (sequences ${first}..${result.lastSequence} for ${result.entries.length} lines); cannot page by severity.`
34810
+ );
34811
+ }
34812
+ const matching = result.entries.map((line, index) => ({ line, seq: first + index })).filter(
34813
+ (entry) => logLevelReaches(classifyLogLine(entry.line).level, logLevel)
34814
+ );
34815
+ const selected = matching.slice(-limit);
34816
+ const olderMatchesExist = matching.length > selected.length;
34817
+ return {
34818
+ entries: selected.map((entry) => entry.line),
34819
+ firstSequence: selected[0]?.seq ?? null,
34820
+ lastSequence: selected.at(-1)?.seq ?? null,
34821
+ truncated: result.truncated || olderMatchesExist,
34822
+ hasMore: olderMatchesExist,
34823
+ nextCursor: olderMatchesExist ? encodeRunLogsCursor(selected[0].seq) : null
34824
+ };
34825
+ }
34572
34826
  async function handleRunEventSearch(args) {
34573
34827
  const usage2 = "Usage: deepline runs logs [run-id] [--since ISO] [--until ISO] [--play name] [--kind kind] [--where jsonpath] [--payloads] [--cursor token] [--limit 100] [--json]";
34574
34828
  const values = {};
@@ -34734,6 +34988,14 @@ function buildRunLogsText(result) {
34734
34988
  }
34735
34989
  return `${lines.join("\n")}${lines.length > 0 ? "\n" : ""}`;
34736
34990
  }
34991
+ function resolveRunStopState(result) {
34992
+ if (result.state) return result.state;
34993
+ if (result.cancelling === true) return "cancelling";
34994
+ if (result.stopped === false || result.staleSchedulerState === true) {
34995
+ return "failed";
34996
+ }
34997
+ return "stopped";
34998
+ }
34737
34999
  async function handleRunStop(args) {
34738
35000
  const usage2 = 'Usage: deepline runs stop <run-id> [--reason "text"] [--json]';
34739
35001
  let runId;
@@ -34752,15 +35014,25 @@ async function handleRunStop(args) {
34752
35014
  }
34753
35015
  const client2 = new DeeplineClient();
34754
35016
  const result = await client2.runs.stop(runId, { reason });
34755
- if (result.cancelling === true && result.hitlCancellationPending !== true) {
35017
+ const state = resolveRunStopState(result);
35018
+ const hitlCleanupIncomplete = state === "cancelling" && result.hitlCancellationPending === true;
35019
+ if (state === "cancelling" && !hitlCleanupIncomplete) {
35020
+ const {
35021
+ error: _legacyError,
35022
+ staleSchedulerState: _legacyStale,
35023
+ ...cancelling
35024
+ } = result;
34756
35025
  const lines2 = [
34757
- `Cancellation queued for ${result.runId || runId}; sandbox cleanup is pending`,
35026
+ `Cancelling run ${result.runId || runId}; sandbox cleanup and the final run update are pending.`,
34758
35027
  ...result.hitlCancelledCount > 0 ? [`cancelled HITL waits: ${result.hitlCancelledCount}`] : [],
34759
35028
  `inspect: deepline runs get ${runId} --full --json`
34760
35029
  ];
34761
35030
  printCommandEnvelope(
34762
35031
  {
34763
- ...result,
35032
+ ...cancelling,
35033
+ state,
35034
+ stopped: false,
35035
+ cancelling: true,
34764
35036
  render: {
34765
35037
  sections: [
34766
35038
  {
@@ -34774,9 +35046,8 @@ async function handleRunStop(args) {
34774
35046
  );
34775
35047
  return 0;
34776
35048
  }
34777
- const stopNotConfirmed = result.stopped === false || result.staleSchedulerState === true;
34778
- if (stopNotConfirmed) {
34779
- const detail = typeof result.error === "string" && result.error.trim() ? result.error.trim() : result.staleSchedulerState === true ? "scheduler state for the run is stale" : "the server did not confirm the stop";
35049
+ if (state === "failed" || hitlCleanupIncomplete) {
35050
+ const detail = typeof result.error === "string" && result.error.trim() ? result.error.trim() : hitlCleanupIncomplete ? "cancellation is queued, but HITL cleanup is still pending" : result.staleSchedulerState === true ? "scheduler state for the run is stale" : "the server did not confirm the stop";
34780
35051
  const lines2 = [
34781
35052
  `Failed to stop run ${runId}: ${detail}.`,
34782
35053
  ...result.hitlCancelledCount > 0 ? [`cancelled HITL waits: ${result.hitlCancelledCount}`] : [],
@@ -35318,7 +35589,7 @@ async function handlePlayList(args) {
35318
35589
  ` cost estimate: ${formatPlayCostEstimate(play.costEstimate)}`
35319
35590
  );
35320
35591
  }
35321
- lines.push(` run: deepline plays run ${reference} --watch`);
35592
+ lines.push(` run: deepline plays run ${reference}`);
35322
35593
  }
35323
35594
  if (page.hasMore) {
35324
35595
  lines.push("List truncated \u2014 more plays are available.");
@@ -36140,7 +36411,6 @@ Run and retrieve results:
36140
36411
  2. Start and follow a new run: deepline plays run workflow.play.ts --csv contacts.csv
36141
36412
  This example requires input.csv. Use the selected Play's actual input fields.
36142
36413
  Run waits and shows progress by default; --no-wait returns immediately.
36143
- --watch and --wait are redundant compatibility aliases for the default.
36144
36414
  3. Read its overview: deepline runs get <run-id> --json
36145
36415
  4. Export complete rows: deepline runs export <run-id> --dataset <returned-selector> --out results.csv
36146
36416
  If disconnected, attach to the SAME run with deepline runs tail <run-id>.
@@ -36229,8 +36499,7 @@ Notes:
36229
36499
  Named plays run the live saved revision.
36230
36500
  File args accept local paths; the CLI stages files before submit.
36231
36501
  By default, run waits for completion and prints logs, previews, stats, and
36232
- next commands. --watch and --wait are accepted compatibility aliases for the
36233
- default behavior. Use --no-wait only when you intentionally want
36502
+ next commands. Use --no-wait only when you intentionally want
36234
36503
  a fire-and-forget run id.
36235
36504
  --run-id-file writes the durable run id to a versioned JSON file as soon as
36236
36505
  the server accepts the run. The destination must not already exist.
@@ -36300,12 +36569,29 @@ Examples:
36300
36569
  ).option(
36301
36570
  "--fixture-behavior <json>",
36302
36571
  "Internal/testing: fixture response behavior JSON object or @file path"
36303
- ).option("--watch", "Compatibility alias; run waits by default").option("--wait", "Compatibility alias; run waits by default").option("--no-wait", "Start the run and return immediately").option(
36572
+ ).addOption(
36573
+ new import_commander3.Option(
36574
+ "--watch",
36575
+ "Compatibility alias; run waits by default"
36576
+ ).hideHelp()
36577
+ ).addOption(
36578
+ new import_commander3.Option(
36579
+ "--wait",
36580
+ "Compatibility alias; run waits by default"
36581
+ ).hideHelp()
36582
+ ).option("--no-wait", "Start the run and return immediately").option(
36304
36583
  "--run-id-file <path>",
36305
36584
  "Atomically write the accepted run id to a new JSON file"
36306
- ).option("--logs", "Compatibility alias for --log-level debug").option(
36307
- "--debug [value]",
36308
- "Compatibility alias for --log-level debug when bare; --debug <value> remains legacy Play input.debug"
36585
+ ).addOption(
36586
+ new import_commander3.Option(
36587
+ "--logs",
36588
+ "Compatibility alias for --log-level debug"
36589
+ ).hideHelp()
36590
+ ).addOption(
36591
+ new import_commander3.Option(
36592
+ "--debug [value]",
36593
+ "Compatibility alias for --log-level debug when bare; --debug <value> remains legacy Play input.debug"
36594
+ ).hideHelp()
36309
36595
  ).option(
36310
36596
  "--log-level <level>",
36311
36597
  "Minimum live log severity: debug, info (default), warn, or error"
@@ -36782,15 +37068,15 @@ Examples:
36782
37068
  ...options.json ? ["--json"] : []
36783
37069
  ]);
36784
37070
  });
36785
- const runs = program.command("runs").description("Inspect, tail, stop, and export play runs.").addHelpText(
37071
+ const runs = program.command("runs").description("Inspect, watch, stop, and export play runs.").addHelpText(
36786
37072
  "after",
36787
37073
  `
36788
37074
  Concepts:
36789
37075
  A run is one execution instance of a play. It has status, progress, logs,
36790
37076
  returned result, dataset previews, recovery metadata, and optional dataset export.
36791
37077
  plays run starts NEW work and follows it by default; --no-wait returns immediately.
36792
- runs tail attaches to EXISTING work and follows progress without starting a run.
36793
- Use tail after a disconnect or --no-wait; do not launch again to reconnect.
37078
+ runs watch attaches to EXISTING work and follows progress without starting a run.
37079
+ Use watch after a disconnect or --no-wait; do not launch again to reconnect.
36794
37080
  get reads the current overview once. logs fetches persisted log history.
36795
37081
  stop requests cancellation. rerun starts new work and may spend credits.
36796
37082
 
@@ -36804,14 +37090,15 @@ Retrieve results:
36804
37090
  not JSON rows. For a JSON row file, use --format json --out results.json.
36805
37091
 
36806
37092
  Follow existing work:
36807
- deepline runs tail <run-id>
36808
- tail --json waits for one terminal JSON document; --jsonl streams live events.
36809
- There is no runs watch command; tail is the live-follow command.
37093
+ deepline runs watch <run-id>
37094
+ watch --json waits for one terminal JSON document; --jsonl streams live events.
37095
+ runs tail is an alias of runs watch.
36810
37096
 
36811
37097
  More options:
36812
37098
  deepline runs get -h
36813
37099
  deepline runs children -h
36814
37100
  deepline runs tail -h
37101
+ deepline runs watch -h
36815
37102
  deepline runs export -h
36816
37103
  deepline plays -h
36817
37104
 
@@ -36858,6 +37145,7 @@ Notes:
36858
37145
  Run activity and status evidence retain provider cooldown and call progress.
36859
37146
  Use --input only when you intentionally need the original payload; it can
36860
37147
  contain customer data and is never included in ordinary status output.
37148
+ --config reads only the recorded graph and source; it never uses current Play code.
36861
37149
  --json run.status,datasets.name,actions selects fields without flattening.
36862
37150
  Selection changes stdout only, not the server query. Optional missing paths
36863
37151
  are omitted; array positions are preserved. --json diagnostics needs --full.
@@ -36869,6 +37157,7 @@ Examples:
36869
37157
  deepline runs get play/my-play/run/20260501t000000-000 --log-failed --json
36870
37158
  deepline runs get play/my-play/run/20260501t000000-000 --full --json
36871
37159
  deepline runs get play/my-play/run/20260501t000000-000 --input
37160
+ deepline runs get play/my-play/run/20260501t000000-000 --config --json
36872
37161
  `
36873
37162
  ).option(
36874
37163
  "--json [fields]",
@@ -36879,6 +37168,9 @@ Examples:
36879
37168
  ).option(
36880
37169
  "--input",
36881
37170
  "Explicitly print the original retained input JSON (may contain customer data)"
37171
+ ).option(
37172
+ "--config",
37173
+ "Explicitly print the recorded configuration, without full results"
36882
37174
  ).option(
36883
37175
  "--log-failed",
36884
37176
  "Attach a bounded terminal-failure log window for failed runs"
@@ -36888,6 +37180,7 @@ Examples:
36888
37180
  ...jsonFieldArgs(options.json),
36889
37181
  ...options.full ? ["--full"] : [],
36890
37182
  ...options.input ? ["--input"] : [],
37183
+ ...options.config ? ["--config"] : [],
36891
37184
  ...options.logFailed ? ["--log-failed"] : []
36892
37185
  ]);
36893
37186
  });
@@ -36987,9 +37280,8 @@ Notes:
36987
37280
  logs for persisted log history. In human output, --compact prints
36988
37281
  deduplicated step transitions and progress. --json emits one terminal
36989
37282
  package. --jsonl emits canonical watched events as JSON Lines and ends with
36990
- the same compact package shape as runs get --json. The tail command remains
36991
- an alias. --log-level
36992
- filters the rendered customer-safe runtime log lines; debug includes runtime
37283
+ the same compact package shape as runs get --json. --log-level filters the
37284
+ rendered customer-safe runtime log lines; debug includes runtime
36993
37285
  and receipt diagnostics and writes them to stderr alongside JSON output.
36994
37286
 
36995
37287
  Examples:
@@ -37005,7 +37297,17 @@ Examples:
37005
37297
  ).option(
37006
37298
  "--compact",
37007
37299
  "Show deduplicated human step transitions and progress"
37008
- ).option("--logs", "Compatibility alias for --log-level debug").option("--debug", "Compatibility alias for --log-level debug").option(
37300
+ ).addOption(
37301
+ new import_commander3.Option(
37302
+ "--logs",
37303
+ "Compatibility alias for --log-level debug"
37304
+ ).hideHelp()
37305
+ ).addOption(
37306
+ new import_commander3.Option(
37307
+ "--debug",
37308
+ "Compatibility alias for --log-level debug"
37309
+ ).hideHelp()
37310
+ ).option(
37009
37311
  "--log-level <level>",
37010
37312
  "Minimum severity: debug, info (default), warn, or error"
37011
37313
  ).action(async (runId, options) => {
@@ -37027,7 +37329,17 @@ Examples:
37027
37329
  ).option("--out <path>", "Write the full retained log stream to a file").option("--failed", "Show the bounded terminal-failure log window").option(
37028
37330
  "--log-level <level>",
37029
37331
  "Minimum severity: debug (default), info, warn, or error"
37030
- ).option("--logs", "Compatibility alias for --log-level debug").option("--debug", "Compatibility alias for --log-level debug").option("--json", "Emit JSON output. Also automatic when stdout is piped").option("--since <timestamp>", "Search events since this UTC timestamp").option("--until <timestamp>", "Search events before this UTC timestamp").option("--play <name>", "Filter events by Play name").option(
37332
+ ).addOption(
37333
+ new import_commander3.Option(
37334
+ "--logs",
37335
+ "Compatibility alias for --log-level debug"
37336
+ ).hideHelp()
37337
+ ).addOption(
37338
+ new import_commander3.Option(
37339
+ "--debug",
37340
+ "Compatibility alias for --log-level debug"
37341
+ ).hideHelp()
37342
+ ).option("--json", "Emit JSON output. Also automatic when stdout is piped").option("--since <timestamp>", "Search events since this UTC timestamp").option("--until <timestamp>", "Search events before this UTC timestamp").option("--play <name>", "Filter events by Play name").option(
37031
37343
  "--kind <kind>",
37032
37344
  "Search one exact event kind; complete catalog below"
37033
37345
  ).option(
@@ -37036,7 +37348,10 @@ Examples:
37036
37348
  ).option(
37037
37349
  "--payloads",
37038
37350
  "Search with canonical eventPayload or receipt payload; max 10 events, 16 MiB"
37039
- ).option("--cursor <token>", "Continue a bounded event search").option(
37351
+ ).option(
37352
+ "--cursor <token>",
37353
+ "Continue paging: older run-log lines (nextCursor) or a bounded event search"
37354
+ ).option(
37040
37355
  "--runtime-namespace <name>",
37041
37356
  "Search an explicitly authorized Preview namespace"
37042
37357
  ).option("--runtime-backend <backend>", "Preview backend: daytona or modal").action(async (runId, options) => {
@@ -37359,11 +37674,11 @@ async function handlePlaySharePublish(args) {
37359
37674
  ok: false,
37360
37675
  code: "NO_SUCCESSFUL_RUN",
37361
37676
  message,
37362
- next: `deepline plays run ${name} --wait`
37677
+ next: `deepline plays run ${name}`
37363
37678
  });
37364
37679
  } else {
37365
37680
  console.error(message);
37366
- console.error(` deepline plays run ${name} --wait`);
37681
+ console.error(` deepline plays run ${name}`);
37367
37682
  }
37368
37683
  return 7;
37369
37684
  }
@@ -42349,7 +42664,7 @@ function registerEnrichCommand(program) {
42349
42664
  "--open",
42350
42665
  "Open the generated play page in a browser after the run starts."
42351
42666
  ).addOption(
42352
- new import_commander3.Option(
42667
+ new import_commander4.Option(
42353
42668
  "--no-open [legacy-value]",
42354
42669
  "Removed legacy option"
42355
42670
  ).hideHelp()
@@ -42739,7 +43054,7 @@ function registerExecutionsCommands(program) {
42739
43054
  }
42740
43055
 
42741
43056
  // src/cli/commands/feedback.ts
42742
- var import_commander4 = require("commander");
43057
+ var import_commander5 = require("commander");
42743
43058
  var import_node_fs14 = require("fs");
42744
43059
  async function handleFeedback(text, options) {
42745
43060
  const message = resolveFeedbackText(text, options.file);
@@ -42805,7 +43120,7 @@ Notes:
42805
43120
  to submit the report.
42806
43121
 
42807
43122
  Examples:
42808
- deepline feedback send "plays run failed after upload" --command "deepline plays run my.play.ts --watch" --error-outcome terminal
43123
+ deepline feedback send "plays run failed after upload" --command "deepline plays run my.play.ts" --error-outcome terminal
42809
43124
  deepline feedback send "unexpected billing output" --payload '{"command":"billing usage"}' --json
42810
43125
  `
42811
43126
  );
@@ -42817,10 +43132,10 @@ Examples:
42817
43132
  deepline feedback send --file incident.md --requested --json
42818
43133
  cat incident.md | deepline feedback send --requested --json
42819
43134
  deepline feedback send "tools search returned stale results" --requested --json
42820
- deepline feedback send "plays run failed after upload" --command "deepline plays run my.play.ts --watch" --error-outcome terminal
43135
+ deepline feedback send "plays run failed after upload" --command "deepline plays run my.play.ts" --error-outcome terminal
42821
43136
  `
42822
43137
  ).argument("[text]", "Feedback text").option("--file <path>", "Read feedback text from a file, or - for stdin").option("--command <command>", "Command that reproduced the issue").option("--payload <payload>", "JSON or plain-text payload for the repro").addOption(
42823
- new import_commander4.Option(
43138
+ new import_commander5.Option(
42824
43139
  "--error-outcome <outcome>",
42825
43140
  "Error impact on the task: terminal or continued"
42826
43141
  ).choices(["terminal", "continued"])
@@ -54065,7 +54380,7 @@ Examples:
54065
54380
  }
54066
54381
 
54067
54382
  // src/cli/commands/tools.ts
54068
- var import_commander5 = require("commander");
54383
+ var import_commander6 = require("commander");
54069
54384
  var import_node_fs28 = require("fs");
54070
54385
  var import_node_os19 = require("os");
54071
54386
  var import_node_path33 = require("path");
@@ -55075,7 +55390,7 @@ function isMissingToolMetadataError(error) {
55075
55390
  function playAliasToolErrorMessage(toolId, play) {
55076
55391
  const playName = play.reference ?? play.name;
55077
55392
  return `${toolId} is a play, not a tool.
55078
- Use: deepline plays run ${playName} --input '{...}' --watch
55393
+ Use: deepline plays run ${playName} --input '{...}'
55079
55394
  Inspect its schema with: deepline plays describe ${playName} --json`;
55080
55395
  }
55081
55396
  function printPlayAliasToolError(toolId, play) {
@@ -55107,11 +55422,11 @@ function playRunCommandForTool(tool, toolId, input2) {
55107
55422
  const playReference = playReferenceForTool(tool);
55108
55423
  if (!playReference) return playSearchCommandForToolId(toolId);
55109
55424
  const inputArg = input2 === void 0 ? "'{...}'" : `'${JSON.stringify(input2)}'`;
55110
- return `deepline plays run ${playReference} --input ${inputArg} --watch`;
55425
+ return `deepline plays run ${playReference} --input ${inputArg}`;
55111
55426
  }
55112
55427
  function playLikeToolExecuteErrorMessage(toolId, tool) {
55113
55428
  const playReference = tool ? playReferenceForTool(tool) : null;
55114
- const nextStep = playReference ? `Use: deepline plays run ${playReference} --input '{...}' --watch` : `Find the maintained workflow with: ${playSearchCommandForToolId(toolId)}`;
55429
+ const nextStep = playReference ? `Use: deepline plays run ${playReference} --input '{...}'` : `Find the maintained workflow with: ${playSearchCommandForToolId(toolId)}`;
55115
55430
  return [
55116
55431
  `${toolId} is a workflow/play entry, not an atomic provider tool.`,
55117
55432
  nextStep,
@@ -55287,12 +55602,12 @@ Examples:
55287
55602
  "--examples-only",
55288
55603
  "Only print runnable examples and sample payloads"
55289
55604
  ).option("--getters-only", "Only print extracted list/value getters").addOption(
55290
- new import_commander5.Option(
55605
+ new import_commander6.Option(
55291
55606
  "--compact",
55292
55607
  "Compatibility alias for the default compact view"
55293
55608
  ).hideHelp()
55294
55609
  ).addOption(
55295
- new import_commander5.Option(
55610
+ new import_commander6.Option(
55296
55611
  "--contract-json",
55297
55612
  "Compatibility alias for compact contract JSON"
55298
55613
  ).hideHelp()
@@ -58307,7 +58622,7 @@ async function main() {
58307
58622
  if (printStartupPhase) {
58308
58623
  progress?.phase("loading deepline cli");
58309
58624
  }
58310
- const program = new import_commander6.Command();
58625
+ const program = new import_commander7.Command();
58311
58626
  program.name("deepline").description(
58312
58627
  "Deepline CLI \u2014 GTM enrichment tools, plays, and runs from your terminal."
58313
58628
  ).version(SDK_VERSION, "-v, --version", "Show version").exitOverride().showHelpAfterError().showSuggestionAfterError(true).addHelpText(