deepline 0.3.201 → 0.3.202

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 (39) hide show
  1. package/dist/bundling-sources/sdk/src/client.ts +62 -1
  2. package/dist/bundling-sources/sdk/src/http.ts +55 -6
  3. package/dist/bundling-sources/sdk/src/index.ts +1 -0
  4. package/dist/bundling-sources/sdk/src/release.ts +1 -1
  5. package/dist/bundling-sources/sdk/src/types.ts +8 -0
  6. package/dist/bundling-sources/shared_libs/play-runtime/app-runtime-api.ts +4 -2
  7. package/dist/bundling-sources/shared_libs/play-runtime/context.ts +460 -96
  8. package/dist/bundling-sources/shared_libs/play-runtime/ctx-types.ts +11 -1
  9. package/dist/bundling-sources/shared_libs/play-runtime/execution-gateway-invocation-fence.ts +6 -2
  10. package/dist/bundling-sources/shared_libs/play-runtime/fixture-behavior.ts +401 -2
  11. package/dist/bundling-sources/shared_libs/play-runtime/output-size-limits.ts +458 -0
  12. package/dist/bundling-sources/shared_libs/play-runtime/provider-no-progress.ts +40 -0
  13. package/dist/bundling-sources/shared_libs/play-runtime/receipt-sql.ts +7 -0
  14. package/dist/bundling-sources/shared_libs/play-runtime/run-ledger.ts +25 -3
  15. package/dist/bundling-sources/shared_libs/play-runtime/runner-app/index.ts +1 -0
  16. package/dist/bundling-sources/shared_libs/play-runtime/runtime-api.ts +119 -171
  17. package/dist/bundling-sources/shared_libs/play-runtime/runtime-work-counters.ts +37 -0
  18. package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/postgres-rate-state.ts +16 -7
  19. package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/postgres.ts +136 -25
  20. package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/receipt-gateway.ts +21 -0
  21. package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/runtime-receipt-value-storage.ts +64 -15
  22. package/dist/bundling-sources/shared_libs/play-runtime/sheet-attempt-sql.ts +5 -5
  23. package/dist/bundling-sources/shared_libs/play-runtime/tool-call/index.ts +1 -0
  24. package/dist/bundling-sources/shared_libs/play-runtime/tool-call/result-receipt-policy.ts +46 -0
  25. package/dist/bundling-sources/shared_libs/play-runtime/tool-execute-retry-policy.ts +14 -5
  26. package/dist/bundling-sources/shared_libs/play-runtime/tool-http-errors.ts +5 -1
  27. package/dist/bundling-sources/shared_libs/play-runtime/work-receipt-state-machine.ts +3 -9
  28. package/dist/cli/index.js +343 -39
  29. package/dist/cli/index.mjs +346 -41
  30. package/dist/index.d.mts +129 -1
  31. package/dist/index.d.ts +129 -1
  32. package/dist/index.js +64 -7
  33. package/dist/index.mjs +64 -7
  34. package/dist/install-integrity.json +3 -0
  35. package/dist/release.d.mts +1 -1
  36. package/dist/release.d.ts +1 -1
  37. package/dist/release.js +1 -1
  38. package/dist/release.mjs +1 -1
  39. package/package.json +1 -1
package/dist/index.mjs CHANGED
@@ -768,7 +768,7 @@ var SDK_RELEASE = {
768
768
  // getters keep their established compatibility behavior.
769
769
  // 0.3.1 deprecated the legacy `deepline enrich` command in favor of Plays.
770
770
  // 0.3.90 is the first deliberately versioned SDK release for API v3.
771
- version: "0.3.201",
771
+ version: "0.3.202",
772
772
  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.",
773
773
  packageCapabilities: {
774
774
  updatePreferences: 1
@@ -1332,6 +1332,11 @@ var MAX_DIAGNOSTIC_HEADER_LENGTH = 120;
1332
1332
  var COWORK_NETWORK_HINT = "Claude Cowork appears to be running Deepline in a network-restricted sandbox. In Claude Desktop, open Settings > Capabilities, turn on Allow network egress, and set Domain allowlist to All domains for the Cowork session.";
1333
1333
  var REQUEST_TIMEOUT_MARKER = Symbol("deeplineRequestTimeout");
1334
1334
  var REQUEST_ABORT_MARKER = Symbol("deeplineRequestAbort");
1335
+ function requestCancelledError(signal) {
1336
+ const error = withErrorCause(new Error("Request aborted"), signal.reason);
1337
+ error[REQUEST_ABORT_MARKER] = true;
1338
+ return error;
1339
+ }
1335
1340
  function normalizeRequestAbortError(error, input) {
1336
1341
  const normalized = error instanceof Error ? error : new Error(String(error));
1337
1342
  const tagged = normalized;
@@ -1510,14 +1515,27 @@ var HttpClient = class {
1510
1515
  const candidateUrls = options?.exactUrlOnly ? [url] : buildCandidateUrls(url);
1511
1516
  let retryAfterDelayMs = null;
1512
1517
  const maxRetries = options?.maxRetries ?? this.config.maxRetries;
1513
- for (let attempt = 0; attempt <= maxRetries; attempt++) {
1518
+ requestAttempts: for (let attempt = 0; attempt <= maxRetries; attempt++) {
1519
+ if (options?.signal?.aborted) {
1520
+ lastError = requestCancelledError(options.signal);
1521
+ break;
1522
+ }
1514
1523
  if (attempt > 0) {
1515
1524
  const backoffMs = Math.min(1e3 * Math.pow(2, attempt - 1), 3e4);
1516
1525
  const delayMs = retryAfterDelayMs === null ? backoffMs : Math.max(backoffMs, retryAfterDelayMs);
1517
1526
  retryAfterDelayMs = null;
1518
- await sleep(delayMs);
1527
+ try {
1528
+ await sleep(delayMs, options?.signal);
1529
+ } catch (error) {
1530
+ lastError = error instanceof Error ? error : new Error(String(error));
1531
+ break;
1532
+ }
1519
1533
  }
1520
1534
  for (const candidateUrl of candidateUrls) {
1535
+ if (options?.signal?.aborted) {
1536
+ lastError = requestCancelledError(options.signal);
1537
+ break requestAttempts;
1538
+ }
1521
1539
  const controller = new AbortController();
1522
1540
  const timeoutMs = options?.timeout ?? this.config.timeout;
1523
1541
  let requestTimedOut = false;
@@ -1525,6 +1543,10 @@ var HttpClient = class {
1525
1543
  requestTimedOut = true;
1526
1544
  controller.abort();
1527
1545
  }, timeoutMs);
1546
+ const abortRequest = () => controller.abort();
1547
+ options?.signal?.addEventListener("abort", abortRequest, {
1548
+ once: true
1549
+ });
1528
1550
  try {
1529
1551
  const response = await fetch(candidateUrl, {
1530
1552
  method,
@@ -1537,8 +1559,8 @@ var HttpClient = class {
1537
1559
  clearTimeout(timeoutId);
1538
1560
  return null;
1539
1561
  }
1540
- clearTimeout(timeoutId);
1541
1562
  const body = await response.text();
1563
+ clearTimeout(timeoutId);
1542
1564
  const parsed = parseResponseBody(body);
1543
1565
  const structuredToolError = options?.toolId && !response.ok ? deserializeToolExecutionFailure(
1544
1566
  apiErrorMessage(parsed, response.status),
@@ -1633,6 +1655,10 @@ var HttpClient = class {
1633
1655
  return parsed;
1634
1656
  } catch (error) {
1635
1657
  clearTimeout(timeoutId);
1658
+ if (options?.signal?.aborted) {
1659
+ lastError = requestCancelledError(options.signal);
1660
+ break requestAttempts;
1661
+ }
1636
1662
  if (error instanceof AuthError || error instanceof DeeplineError) {
1637
1663
  throw error;
1638
1664
  }
@@ -1644,6 +1670,9 @@ var HttpClient = class {
1644
1670
  timeoutMs,
1645
1671
  timedOut: requestTimedOut
1646
1672
  });
1673
+ } finally {
1674
+ clearTimeout(timeoutId);
1675
+ options?.signal?.removeEventListener("abort", abortRequest);
1647
1676
  }
1648
1677
  }
1649
1678
  if (attempt < maxRetries) continue;
@@ -1972,8 +2001,23 @@ function decodeSseFrame(frame) {
1972
2001
  }
1973
2002
  return parsed;
1974
2003
  }
1975
- function sleep(ms) {
1976
- return new Promise((resolve2) => setTimeout(resolve2, ms));
2004
+ function sleep(ms, signal) {
2005
+ return new Promise((resolve2, reject) => {
2006
+ if (signal?.aborted) {
2007
+ reject(requestCancelledError(signal));
2008
+ return;
2009
+ }
2010
+ const timeoutId = setTimeout(() => {
2011
+ signal?.removeEventListener("abort", abort);
2012
+ resolve2();
2013
+ }, ms);
2014
+ const abort = () => {
2015
+ clearTimeout(timeoutId);
2016
+ signal?.removeEventListener("abort", abort);
2017
+ reject(requestCancelledError(signal));
2018
+ };
2019
+ signal?.addEventListener("abort", abort, { once: true });
2020
+ });
1977
2021
  }
1978
2022
  function withCoworkNetworkHint(message) {
1979
2023
  if (!isCoworkLikeSandbox2() || message.includes(COWORK_NETWORK_HINT)) {
@@ -3135,9 +3179,13 @@ function normalizePlayRunLedgerSnapshot(value, fallback) {
3135
3179
  tableNamespace: optionalString(rawDataset.tableNamespace) ?? datasetId,
3136
3180
  phase,
3137
3181
  persistedRows: Math.max(0, finiteNumber(rawDataset.persistedRows) ?? 0),
3182
+ persistedRowsObserved: rawDataset.persistedRowsObserved === true,
3138
3183
  succeededRows: Math.max(0, finiteNumber(rawDataset.succeededRows) ?? 0),
3184
+ succeededRowsObserved: rawDataset.succeededRowsObserved === true,
3139
3185
  failedRows: Math.max(0, finiteNumber(rawDataset.failedRows) ?? 0),
3186
+ failedRowsObserved: rawDataset.failedRowsObserved === true,
3140
3187
  complete: rawDataset.complete === true,
3188
+ completeObserved: rawDataset.completeObserved === true,
3141
3189
  // ADR 0019 birth survives the snapshot round trip. A partial record is
3142
3190
  // dropped rather than half-admitted, so a dataset either states where its
3143
3191
  // rows came from or says nothing.
@@ -4798,6 +4846,7 @@ var DeeplineClient = class _DeeplineClient {
4798
4846
  this.http = new HttpClient(this.config);
4799
4847
  this.runs = {
4800
4848
  get: (runId, options2) => this.getRunStatus(runId, options2),
4849
+ status: (runId) => this.getRunLifecycleStatus(runId),
4801
4850
  list: (options2) => this.listRuns(options2),
4802
4851
  listPage: (options2) => this.listRunsPage(options2),
4803
4852
  tail: (runId, options2) => this.tailRun(runId, options2),
@@ -6210,6 +6259,13 @@ var DeeplineClient = class _DeeplineClient {
6210
6259
  }
6211
6260
  };
6212
6261
  }
6262
+ /** Read only the bounded scalar projection; does not hydrate the run package. */
6263
+ async getRunLifecycleStatus(runId) {
6264
+ const response = await this.http.get(
6265
+ `/api/v2/runs/${encodeURIComponent(runId)}/status`
6266
+ );
6267
+ return response;
6268
+ }
6213
6269
  /**
6214
6270
  * List play runs using the public runs resource model.
6215
6271
  *
@@ -6603,7 +6659,8 @@ var DeeplineClient = class _DeeplineClient {
6603
6659
  params.set("rowMode", "all");
6604
6660
  }
6605
6661
  const result = await this.http.get(
6606
- `/api/v2/plays/${encodeURIComponent(input.playName)}/sheet?${params.toString()}`
6662
+ `/api/v2/plays/${encodeURIComponent(input.playName)}/sheet?${params.toString()}`,
6663
+ { signal: input.signal }
6607
6664
  );
6608
6665
  const requestedRunId = input.runId?.trim() || "";
6609
6666
  if (requestedRunId) {
@@ -279,6 +279,7 @@
279
279
  "dist/bundling-sources/shared_libs/play-runtime/provider-capacity/provider-concurrency-policy.ts",
280
280
  "dist/bundling-sources/shared_libs/play-runtime/provider-capacity/provider-rate-policy.ts",
281
281
  "dist/bundling-sources/shared_libs/play-runtime/provider-capacity/provider-throttle-classifier.ts",
282
+ "dist/bundling-sources/shared_libs/play-runtime/provider-no-progress.ts",
282
283
  "dist/bundling-sources/shared_libs/play-runtime/providers.ts",
283
284
  "dist/bundling-sources/shared_libs/play-runtime/public-play-contract.ts",
284
285
  "dist/bundling-sources/shared_libs/play-runtime/query-result-dataset.ts",
@@ -357,6 +358,7 @@
357
358
  "dist/bundling-sources/shared_libs/play-runtime/runtime-sheet-session.ts",
358
359
  "dist/bundling-sources/shared_libs/play-runtime/runtime-telemetry.ts",
359
360
  "dist/bundling-sources/shared_libs/play-runtime/runtime-traffic-policy.ts",
361
+ "dist/bundling-sources/shared_libs/play-runtime/runtime-work-counters.ts",
360
362
  "dist/bundling-sources/shared_libs/play-runtime/sandbox-compute-usage.ts",
361
363
  "dist/bundling-sources/shared_libs/play-runtime/sandbox-runs/contract.ts",
362
364
  "dist/bundling-sources/shared_libs/play-runtime/sandbox-runs/index.ts",
@@ -431,6 +433,7 @@
431
433
  "dist/bundling-sources/shared_libs/play-runtime/tool-call/index.ts",
432
434
  "dist/bundling-sources/shared_libs/play-runtime/tool-call/native-batch.ts",
433
435
  "dist/bundling-sources/shared_libs/play-runtime/tool-call/receipt-cohort.ts",
436
+ "dist/bundling-sources/shared_libs/play-runtime/tool-call/result-receipt-policy.ts",
434
437
  "dist/bundling-sources/shared_libs/play-runtime/tool-call/runtime-step-receipts-adapter.ts",
435
438
  "dist/bundling-sources/shared_libs/play-runtime/tool-call/testkit.ts",
436
439
  "dist/bundling-sources/shared_libs/play-runtime/tool-execute-retry-policy.ts",
@@ -149,7 +149,7 @@ type SdkRelease = {
149
149
  supportPolicy: SdkSupportPolicy;
150
150
  };
151
151
  declare const SDK_RELEASE: {
152
- readonly version: "0.3.201";
152
+ readonly version: "0.3.202";
153
153
  readonly 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.";
154
154
  readonly packageCapabilities: {
155
155
  readonly updatePreferences: 1;
package/dist/release.d.ts CHANGED
@@ -149,7 +149,7 @@ type SdkRelease = {
149
149
  supportPolicy: SdkSupportPolicy;
150
150
  };
151
151
  declare const SDK_RELEASE: {
152
- readonly version: "0.3.201";
152
+ readonly version: "0.3.202";
153
153
  readonly 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.";
154
154
  readonly packageCapabilities: {
155
155
  readonly updatePreferences: 1;
package/dist/release.js CHANGED
@@ -74,7 +74,7 @@ var SDK_RELEASE = {
74
74
  // getters keep their established compatibility behavior.
75
75
  // 0.3.1 deprecated the legacy `deepline enrich` command in favor of Plays.
76
76
  // 0.3.90 is the first deliberately versioned SDK release for API v3.
77
- version: "0.3.201",
77
+ version: "0.3.202",
78
78
  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.",
79
79
  packageCapabilities: {
80
80
  updatePreferences: 1
package/dist/release.mjs CHANGED
@@ -48,7 +48,7 @@ var SDK_RELEASE = {
48
48
  // getters keep their established compatibility behavior.
49
49
  // 0.3.1 deprecated the legacy `deepline enrich` command in favor of Plays.
50
50
  // 0.3.90 is the first deliberately versioned SDK release for API v3.
51
- version: "0.3.201",
51
+ version: "0.3.202",
52
52
  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.",
53
53
  packageCapabilities: {
54
54
  updatePreferences: 1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "deepline",
3
- "version": "0.3.201",
3
+ "version": "0.3.202",
4
4
  "description": "GTM data CLI and TypeScript SDK for coding agents",
5
5
  "license": "MIT",
6
6
  "homepage": "https://code.deepline.com",