deepline 0.1.101 → 0.1.103

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.mts CHANGED
@@ -978,7 +978,7 @@ interface ClearPlayHistoryResult {
978
978
  * Response from starting a play run.
979
979
  *
980
980
  * Internal/advanced payload returned by low-level play submission primitives.
981
- * Most callers should prefer `deepline play run`, {@link DeeplineClient.runPlay},
981
+ * Most callers should prefer `deepline plays run`, {@link DeeplineClient.runPlay},
982
982
  * or {@link PlayJob.get}.
983
983
  *
984
984
  * @example
@@ -1042,7 +1042,7 @@ interface PlayCheckToolGetterHint {
1042
1042
  * Request body for starting a play run via {@link DeeplineClient.startPlayRun}.
1043
1043
  *
1044
1044
  * Internal/advanced request shape for low-level submission primitives.
1045
- * Most callers should prefer `deepline play run`, {@link DeeplineClient.runPlay},
1045
+ * Most callers should prefer `deepline plays run`, {@link DeeplineClient.runPlay},
1046
1046
  * or {@link Deepline.connect}.
1047
1047
  *
1048
1048
  * Either `name` (for live plays) or `artifactStorageKey` (for packaged ad hoc runs) is required.
@@ -1505,7 +1505,7 @@ declare class DeeplineClient {
1505
1505
  * or {@link runPlay}.
1506
1506
  *
1507
1507
  * Supported invocation surfaces intentionally share this same run contract:
1508
- * `deepline play run`, repo scripts such as `bun run deepline -- play run`,
1508
+ * `deepline plays run`, repo scripts such as `bun run deepline -- plays run`,
1509
1509
  * SDK context calls like `Deepline.connect().play(name).run()`, and direct
1510
1510
  * `POST /api/v2/plays/run` calls all return a workflow/run id. The completed
1511
1511
  * output is always retrievable from `getPlayStatus(runId).result` (or from
@@ -1625,7 +1625,7 @@ declare class DeeplineClient {
1625
1625
  *
1626
1626
  * Unlike {@link registerPlayArtifact}, this does not store the artifact,
1627
1627
  * publish a revision, or start a run. It is the authoritative cloud validation
1628
- * path used by `deepline play check`.
1628
+ * path used by `deepline plays check`.
1629
1629
  */
1630
1630
  checkPlayArtifact(input: {
1631
1631
  name?: string;
@@ -1750,7 +1750,7 @@ declare class DeeplineClient {
1750
1750
  * Get the current status of a play execution.
1751
1751
  *
1752
1752
  * Internal/advanced primitive. Public callers should usually prefer
1753
- * {@link runPlay}, {@link PlayJob.get}, or `deepline play run --watch`.
1753
+ * {@link runPlay}, {@link PlayJob.get}, or `deepline plays run --watch`.
1754
1754
  *
1755
1755
  * @param workflowId - Play-run id from {@link startPlayRun}
1756
1756
  * @returns Current status with progress logs and partial results
@@ -3261,7 +3261,7 @@ interface DeeplinePlayRuntimeContext {
3261
3261
  * Provides methods to check status, stream logs, wait for completion,
3262
3262
  * or cancel the execution.
3263
3263
  *
3264
- * This handle is the SDK-context equivalent of `deepline play run --watch` and
3264
+ * This handle is the SDK-context equivalent of `deepline plays run --watch` and
3265
3265
  * `POST /api/v2/plays/run`: every surface returns a run id first, then exposes
3266
3266
  * the completed user output through `PlayJob.get()` or the status endpoint's
3267
3267
  * `result` field. Runtime logs are available from `status().progress.logs` and
package/dist/index.d.ts CHANGED
@@ -978,7 +978,7 @@ interface ClearPlayHistoryResult {
978
978
  * Response from starting a play run.
979
979
  *
980
980
  * Internal/advanced payload returned by low-level play submission primitives.
981
- * Most callers should prefer `deepline play run`, {@link DeeplineClient.runPlay},
981
+ * Most callers should prefer `deepline plays run`, {@link DeeplineClient.runPlay},
982
982
  * or {@link PlayJob.get}.
983
983
  *
984
984
  * @example
@@ -1042,7 +1042,7 @@ interface PlayCheckToolGetterHint {
1042
1042
  * Request body for starting a play run via {@link DeeplineClient.startPlayRun}.
1043
1043
  *
1044
1044
  * Internal/advanced request shape for low-level submission primitives.
1045
- * Most callers should prefer `deepline play run`, {@link DeeplineClient.runPlay},
1045
+ * Most callers should prefer `deepline plays run`, {@link DeeplineClient.runPlay},
1046
1046
  * or {@link Deepline.connect}.
1047
1047
  *
1048
1048
  * Either `name` (for live plays) or `artifactStorageKey` (for packaged ad hoc runs) is required.
@@ -1505,7 +1505,7 @@ declare class DeeplineClient {
1505
1505
  * or {@link runPlay}.
1506
1506
  *
1507
1507
  * Supported invocation surfaces intentionally share this same run contract:
1508
- * `deepline play run`, repo scripts such as `bun run deepline -- play run`,
1508
+ * `deepline plays run`, repo scripts such as `bun run deepline -- plays run`,
1509
1509
  * SDK context calls like `Deepline.connect().play(name).run()`, and direct
1510
1510
  * `POST /api/v2/plays/run` calls all return a workflow/run id. The completed
1511
1511
  * output is always retrievable from `getPlayStatus(runId).result` (or from
@@ -1625,7 +1625,7 @@ declare class DeeplineClient {
1625
1625
  *
1626
1626
  * Unlike {@link registerPlayArtifact}, this does not store the artifact,
1627
1627
  * publish a revision, or start a run. It is the authoritative cloud validation
1628
- * path used by `deepline play check`.
1628
+ * path used by `deepline plays check`.
1629
1629
  */
1630
1630
  checkPlayArtifact(input: {
1631
1631
  name?: string;
@@ -1750,7 +1750,7 @@ declare class DeeplineClient {
1750
1750
  * Get the current status of a play execution.
1751
1751
  *
1752
1752
  * Internal/advanced primitive. Public callers should usually prefer
1753
- * {@link runPlay}, {@link PlayJob.get}, or `deepline play run --watch`.
1753
+ * {@link runPlay}, {@link PlayJob.get}, or `deepline plays run --watch`.
1754
1754
  *
1755
1755
  * @param workflowId - Play-run id from {@link startPlayRun}
1756
1756
  * @returns Current status with progress logs and partial results
@@ -3261,7 +3261,7 @@ interface DeeplinePlayRuntimeContext {
3261
3261
  * Provides methods to check status, stream logs, wait for completion,
3262
3262
  * or cancel the execution.
3263
3263
  *
3264
- * This handle is the SDK-context equivalent of `deepline play run --watch` and
3264
+ * This handle is the SDK-context equivalent of `deepline plays run --watch` and
3265
3265
  * `POST /api/v2/plays/run`: every surface returns a run id first, then exposes
3266
3266
  * the completed user output through `PlayJob.get()` or the status endpoint's
3267
3267
  * `result` field. Runtime logs are available from `status().progress.logs` and
package/dist/index.js CHANGED
@@ -261,10 +261,15 @@ var SDK_RELEASE = {
261
261
  // 0.1.98 ships the duplicate-browser-tab fix (default-browser detection).
262
262
  // 0.1.99 ships prebuilt job-change source-column preservation and validation fixes.
263
263
  // 0.1.101 ships retryable play artifact publish failures and CI retry hardening.
264
- version: "0.1.101",
264
+ // 0.1.102 ships the job-change ledger fixes: recovered-dataset export on
265
+ // failed runs, persisted/succeeded/failed row counts, strict local CSV
266
+ // preflight (existence, data rows, quotes, duplicate headers), HTML error
267
+ // scrubbing, and word-boundary watch truncation.
268
+ // 0.1.103 ships the refined SDK CLI command surface.
269
+ version: "0.1.103",
265
270
  apiContract: "2026-06-dataset-column-cell-stale-hard-cutover",
266
271
  supportPolicy: {
267
- latest: "0.1.101",
272
+ latest: "0.1.103",
268
273
  minimumSupported: "0.1.53",
269
274
  deprecatedBelow: "0.1.53"
270
275
  }
@@ -415,6 +420,22 @@ var HttpClient = class {
415
420
  parsed = body;
416
421
  }
417
422
  if (!response.ok) {
423
+ const htmlError = detectHtmlErrorBody(
424
+ body,
425
+ response.headers.get("content-type")
426
+ );
427
+ if (htmlError) {
428
+ throw new DeeplineError(
429
+ htmlError.message(response.status),
430
+ response.status,
431
+ "API_ERROR",
432
+ {
433
+ htmlErrorPage: true,
434
+ ...htmlError.title ? { title: htmlError.title } : {},
435
+ ...htmlError.workerThrewException ? { workerThrewException: true } : {}
436
+ }
437
+ );
438
+ }
418
439
  const errorValue = typeof parsed === "object" && parsed && "error" in parsed ? parsed.error : void 0;
419
440
  const msg = typeof errorValue === "string" ? errorValue : errorValue && typeof errorValue === "object" && "message" in errorValue && typeof errorValue.message === "string" ? errorValue.message : typeof parsed === "object" && parsed && "message" in parsed && typeof parsed.message === "string" ? parsed.message : `HTTP ${response.status}`;
420
441
  throw new DeeplineError(msg, response.status, "API_ERROR", {
@@ -475,6 +496,22 @@ var HttpClient = class {
475
496
  }
476
497
  if (!response.ok) {
477
498
  const body = await response.text();
499
+ const htmlError = detectHtmlErrorBody(
500
+ body,
501
+ response.headers.get("content-type")
502
+ );
503
+ if (htmlError) {
504
+ throw new DeeplineError(
505
+ htmlError.message(response.status),
506
+ response.status,
507
+ "API_ERROR",
508
+ {
509
+ htmlErrorPage: true,
510
+ ...htmlError.title ? { title: htmlError.title } : {},
511
+ ...htmlError.workerThrewException ? { workerThrewException: true } : {}
512
+ }
513
+ );
514
+ }
478
515
  const parsed = parseResponseBody(body);
479
516
  throw new DeeplineError(
480
517
  apiErrorMessage(parsed, response.status),
@@ -540,6 +577,31 @@ function parseResponseBody(body) {
540
577
  return body;
541
578
  }
542
579
  }
580
+ function detectHtmlErrorBody(body, contentType) {
581
+ const trimmed = body.trim();
582
+ const lower = trimmed.toLowerCase();
583
+ const isHtml = (contentType ?? "").toLowerCase().includes("text/html") || lower.startsWith("<!doctype") || lower.startsWith("<html");
584
+ if (!isHtml) {
585
+ return null;
586
+ }
587
+ const titleMatch = trimmed.match(/<title[^>]*>([\s\S]*?)<\/title>/i);
588
+ const title = titleMatch?.[1]?.replace(/\s+/g, " ").trim() || void 0;
589
+ const workerThrewException = /worker threw exception/i.test(trimmed);
590
+ return {
591
+ title,
592
+ workerThrewException,
593
+ message: (status) => {
594
+ const segments = [`HTTP ${status}`];
595
+ if (workerThrewException) {
596
+ segments.push("Worker threw exception");
597
+ }
598
+ if (title) {
599
+ segments.push(title);
600
+ }
601
+ return `${segments.join(": ")} (Cloudflare HTML error page suppressed)`;
602
+ }
603
+ };
604
+ }
543
605
  function apiErrorMessage(parsed, status) {
544
606
  const errorValue = typeof parsed === "object" && parsed && "error" in parsed ? parsed.error : void 0;
545
607
  if (typeof errorValue === "string") {
@@ -635,7 +697,7 @@ function isTransientPlayStreamError(error) {
635
697
  return error.statusCode >= 500 && error.statusCode < 600;
636
698
  }
637
699
  const text = error instanceof Error ? error.message : String(error);
638
- return /auth validation backend timed out|fetch failed|eaddrnotavail|econnreset|etimedout|eai_again|socket hang up/i.test(
700
+ return /auth validation backend timed out|coordinator \/submit(?:\?[^ ]*)? 5\d\d|Worker threw exception|Internal Server Error|Service Unavailable|fetch failed|eaddrnotavail|econnreset|etimedout|eai_again|socket hang up/i.test(
639
701
  text
640
702
  );
641
703
  }
@@ -867,6 +929,10 @@ function buildSnapshotFromLedger(snapshot) {
867
929
  return {
868
930
  runId: snapshot.runId,
869
931
  status: normalizePlayRunLiveStatus(snapshot.status),
932
+ createdAt: snapshot.createdAt ?? null,
933
+ startedAt: snapshot.startedAt ?? null,
934
+ finishedAt: snapshot.finishedAt ?? null,
935
+ durationMs: snapshot.durationMs ?? null,
870
936
  updatedAt: snapshot.updatedAt ?? snapshot.finishedAt ?? snapshot.startedAt ?? null,
871
937
  logs: snapshot.logTail,
872
938
  totalLogCount: snapshot.totalLogCount,
@@ -1869,7 +1935,7 @@ var DeeplineClient = class {
1869
1935
  * or {@link runPlay}.
1870
1936
  *
1871
1937
  * Supported invocation surfaces intentionally share this same run contract:
1872
- * `deepline play run`, repo scripts such as `bun run deepline -- play run`,
1938
+ * `deepline plays run`, repo scripts such as `bun run deepline -- plays run`,
1873
1939
  * SDK context calls like `Deepline.connect().play(name).run()`, and direct
1874
1940
  * `POST /api/v2/plays/run` calls all return a workflow/run id. The completed
1875
1941
  * output is always retrievable from `getPlayStatus(runId).result` (or from
@@ -2038,7 +2104,7 @@ var DeeplineClient = class {
2038
2104
  *
2039
2105
  * Unlike {@link registerPlayArtifact}, this does not store the artifact,
2040
2106
  * publish a revision, or start a run. It is the authoritative cloud validation
2041
- * path used by `deepline play check`.
2107
+ * path used by `deepline plays check`.
2042
2108
  */
2043
2109
  async checkPlayArtifact(input) {
2044
2110
  return this.http.post("/api/v2/plays/check", input);
@@ -2231,7 +2297,7 @@ var DeeplineClient = class {
2231
2297
  * Get the current status of a play execution.
2232
2298
  *
2233
2299
  * Internal/advanced primitive. Public callers should usually prefer
2234
- * {@link runPlay}, {@link PlayJob.get}, or `deepline play run --watch`.
2300
+ * {@link runPlay}, {@link PlayJob.get}, or `deepline plays run --watch`.
2235
2301
  *
2236
2302
  * @param workflowId - Play-run id from {@link startPlayRun}
2237
2303
  * @returns Current status with progress logs and partial results
package/dist/index.mjs CHANGED
@@ -183,10 +183,15 @@ var SDK_RELEASE = {
183
183
  // 0.1.98 ships the duplicate-browser-tab fix (default-browser detection).
184
184
  // 0.1.99 ships prebuilt job-change source-column preservation and validation fixes.
185
185
  // 0.1.101 ships retryable play artifact publish failures and CI retry hardening.
186
- version: "0.1.101",
186
+ // 0.1.102 ships the job-change ledger fixes: recovered-dataset export on
187
+ // failed runs, persisted/succeeded/failed row counts, strict local CSV
188
+ // preflight (existence, data rows, quotes, duplicate headers), HTML error
189
+ // scrubbing, and word-boundary watch truncation.
190
+ // 0.1.103 ships the refined SDK CLI command surface.
191
+ version: "0.1.103",
187
192
  apiContract: "2026-06-dataset-column-cell-stale-hard-cutover",
188
193
  supportPolicy: {
189
- latest: "0.1.101",
194
+ latest: "0.1.103",
190
195
  minimumSupported: "0.1.53",
191
196
  deprecatedBelow: "0.1.53"
192
197
  }
@@ -337,6 +342,22 @@ var HttpClient = class {
337
342
  parsed = body;
338
343
  }
339
344
  if (!response.ok) {
345
+ const htmlError = detectHtmlErrorBody(
346
+ body,
347
+ response.headers.get("content-type")
348
+ );
349
+ if (htmlError) {
350
+ throw new DeeplineError(
351
+ htmlError.message(response.status),
352
+ response.status,
353
+ "API_ERROR",
354
+ {
355
+ htmlErrorPage: true,
356
+ ...htmlError.title ? { title: htmlError.title } : {},
357
+ ...htmlError.workerThrewException ? { workerThrewException: true } : {}
358
+ }
359
+ );
360
+ }
340
361
  const errorValue = typeof parsed === "object" && parsed && "error" in parsed ? parsed.error : void 0;
341
362
  const msg = typeof errorValue === "string" ? errorValue : errorValue && typeof errorValue === "object" && "message" in errorValue && typeof errorValue.message === "string" ? errorValue.message : typeof parsed === "object" && parsed && "message" in parsed && typeof parsed.message === "string" ? parsed.message : `HTTP ${response.status}`;
342
363
  throw new DeeplineError(msg, response.status, "API_ERROR", {
@@ -397,6 +418,22 @@ var HttpClient = class {
397
418
  }
398
419
  if (!response.ok) {
399
420
  const body = await response.text();
421
+ const htmlError = detectHtmlErrorBody(
422
+ body,
423
+ response.headers.get("content-type")
424
+ );
425
+ if (htmlError) {
426
+ throw new DeeplineError(
427
+ htmlError.message(response.status),
428
+ response.status,
429
+ "API_ERROR",
430
+ {
431
+ htmlErrorPage: true,
432
+ ...htmlError.title ? { title: htmlError.title } : {},
433
+ ...htmlError.workerThrewException ? { workerThrewException: true } : {}
434
+ }
435
+ );
436
+ }
400
437
  const parsed = parseResponseBody(body);
401
438
  throw new DeeplineError(
402
439
  apiErrorMessage(parsed, response.status),
@@ -462,6 +499,31 @@ function parseResponseBody(body) {
462
499
  return body;
463
500
  }
464
501
  }
502
+ function detectHtmlErrorBody(body, contentType) {
503
+ const trimmed = body.trim();
504
+ const lower = trimmed.toLowerCase();
505
+ const isHtml = (contentType ?? "").toLowerCase().includes("text/html") || lower.startsWith("<!doctype") || lower.startsWith("<html");
506
+ if (!isHtml) {
507
+ return null;
508
+ }
509
+ const titleMatch = trimmed.match(/<title[^>]*>([\s\S]*?)<\/title>/i);
510
+ const title = titleMatch?.[1]?.replace(/\s+/g, " ").trim() || void 0;
511
+ const workerThrewException = /worker threw exception/i.test(trimmed);
512
+ return {
513
+ title,
514
+ workerThrewException,
515
+ message: (status) => {
516
+ const segments = [`HTTP ${status}`];
517
+ if (workerThrewException) {
518
+ segments.push("Worker threw exception");
519
+ }
520
+ if (title) {
521
+ segments.push(title);
522
+ }
523
+ return `${segments.join(": ")} (Cloudflare HTML error page suppressed)`;
524
+ }
525
+ };
526
+ }
465
527
  function apiErrorMessage(parsed, status) {
466
528
  const errorValue = typeof parsed === "object" && parsed && "error" in parsed ? parsed.error : void 0;
467
529
  if (typeof errorValue === "string") {
@@ -557,7 +619,7 @@ function isTransientPlayStreamError(error) {
557
619
  return error.statusCode >= 500 && error.statusCode < 600;
558
620
  }
559
621
  const text = error instanceof Error ? error.message : String(error);
560
- return /auth validation backend timed out|fetch failed|eaddrnotavail|econnreset|etimedout|eai_again|socket hang up/i.test(
622
+ return /auth validation backend timed out|coordinator \/submit(?:\?[^ ]*)? 5\d\d|Worker threw exception|Internal Server Error|Service Unavailable|fetch failed|eaddrnotavail|econnreset|etimedout|eai_again|socket hang up/i.test(
561
623
  text
562
624
  );
563
625
  }
@@ -789,6 +851,10 @@ function buildSnapshotFromLedger(snapshot) {
789
851
  return {
790
852
  runId: snapshot.runId,
791
853
  status: normalizePlayRunLiveStatus(snapshot.status),
854
+ createdAt: snapshot.createdAt ?? null,
855
+ startedAt: snapshot.startedAt ?? null,
856
+ finishedAt: snapshot.finishedAt ?? null,
857
+ durationMs: snapshot.durationMs ?? null,
792
858
  updatedAt: snapshot.updatedAt ?? snapshot.finishedAt ?? snapshot.startedAt ?? null,
793
859
  logs: snapshot.logTail,
794
860
  totalLogCount: snapshot.totalLogCount,
@@ -1791,7 +1857,7 @@ var DeeplineClient = class {
1791
1857
  * or {@link runPlay}.
1792
1858
  *
1793
1859
  * Supported invocation surfaces intentionally share this same run contract:
1794
- * `deepline play run`, repo scripts such as `bun run deepline -- play run`,
1860
+ * `deepline plays run`, repo scripts such as `bun run deepline -- plays run`,
1795
1861
  * SDK context calls like `Deepline.connect().play(name).run()`, and direct
1796
1862
  * `POST /api/v2/plays/run` calls all return a workflow/run id. The completed
1797
1863
  * output is always retrievable from `getPlayStatus(runId).result` (or from
@@ -1960,7 +2026,7 @@ var DeeplineClient = class {
1960
2026
  *
1961
2027
  * Unlike {@link registerPlayArtifact}, this does not store the artifact,
1962
2028
  * publish a revision, or start a run. It is the authoritative cloud validation
1963
- * path used by `deepline play check`.
2029
+ * path used by `deepline plays check`.
1964
2030
  */
1965
2031
  async checkPlayArtifact(input) {
1966
2032
  return this.http.post("/api/v2/plays/check", input);
@@ -2153,7 +2219,7 @@ var DeeplineClient = class {
2153
2219
  * Get the current status of a play execution.
2154
2220
  *
2155
2221
  * Internal/advanced primitive. Public callers should usually prefer
2156
- * {@link runPlay}, {@link PlayJob.get}, or `deepline play run --watch`.
2222
+ * {@link runPlay}, {@link PlayJob.get}, or `deepline plays run --watch`.
2157
2223
  *
2158
2224
  * @param workflowId - Play-run id from {@link startPlayRun}
2159
2225
  * @returns Current status with progress logs and partial results