deepline 0.3.144 → 0.3.146

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 (32) hide show
  1. package/dist/bundling-sources/sdk/src/client.ts +53 -1
  2. package/dist/bundling-sources/sdk/src/index.ts +1 -0
  3. package/dist/bundling-sources/sdk/src/release.ts +1 -1
  4. package/dist/bundling-sources/shared_libs/play-runtime/async-operation.ts +40 -4
  5. package/dist/bundling-sources/shared_libs/play-runtime/context.ts +259 -7
  6. package/dist/bundling-sources/shared_libs/play-runtime/ctx-types.ts +10 -0
  7. package/dist/bundling-sources/shared_libs/play-runtime/protocol.ts +10 -0
  8. package/dist/bundling-sources/shared_libs/play-runtime/run-ledger.ts +58 -19
  9. package/dist/bundling-sources/shared_libs/play-runtime/run-snapshot-stream.ts +17 -11
  10. package/dist/bundling-sources/shared_libs/play-runtime/runner-app/index.ts +57 -2
  11. package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/postgres-progress.ts +73 -16
  12. package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/postgres.ts +57 -3
  13. package/dist/bundling-sources/shared_libs/play-runtime/step-progress.ts +7 -0
  14. package/dist/bundling-sources/shared_libs/play-runtime/tool-result.ts +35 -3
  15. package/dist/bundling-sources/shared_libs/play-runtime/worker-api-types.ts +1 -0
  16. package/dist/bundling-sources/shared_libs/plays/tool-result-types.ts +11 -1
  17. package/dist/cli/index.js +85 -17
  18. package/dist/cli/index.mjs +85 -17
  19. package/dist/{compiler-manifest-BIqRyj5m.d.mts → compiler-manifest-BJBNPTWt.d.mts} +2 -1
  20. package/dist/{compiler-manifest-BIqRyj5m.d.ts → compiler-manifest-BJBNPTWt.d.ts} +2 -1
  21. package/dist/index.d.mts +26 -4
  22. package/dist/index.d.ts +26 -4
  23. package/dist/index.js +78 -10
  24. package/dist/index.mjs +78 -10
  25. package/dist/install-integrity.json +2 -2
  26. package/dist/plays/bundle-play-file.d.mts +2 -2
  27. package/dist/plays/bundle-play-file.d.ts +2 -2
  28. package/dist/release.d.mts +1 -1
  29. package/dist/release.d.ts +1 -1
  30. package/dist/release.js +1 -1
  31. package/dist/release.mjs +1 -1
  32. 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.144",
771
+ version: "0.3.146",
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
@@ -2970,19 +2970,32 @@ function summarizeRunRowOutcomes(snapshot) {
2970
2970
  let completedRows = 0;
2971
2971
  let failedRows = 0;
2972
2972
  let totalRows = 0;
2973
+ let supersededRows = 0;
2973
2974
  for (const step of Object.values(snapshot.stepsById)) {
2974
2975
  const progress = step.progress;
2975
2976
  if (!progress) continue;
2976
2977
  completedRows += Math.max(0, finiteNumber(progress.completed) ?? 0);
2977
2978
  failedRows += Math.max(0, finiteNumber(progress.failed) ?? 0);
2979
+ supersededRows += Math.max(0, finiteNumber(progress.supersededRows) ?? 0);
2978
2980
  const stepTotal = finiteNumber(progress.total);
2979
- totalRows += stepTotal !== null && stepTotal >= 0 ? stepTotal : Math.max(0, finiteNumber(progress.completed) ?? 0) + Math.max(0, finiteNumber(progress.failed) ?? 0);
2980
- }
2981
+ totalRows += stepTotal !== null && stepTotal >= 0 ? stepTotal : Math.max(0, finiteNumber(progress.completed) ?? 0) + Math.max(0, finiteNumber(progress.failed) ?? 0) + Math.max(0, finiteNumber(progress.supersededRows) ?? 0);
2982
+ }
2983
+ const resultSummary = isRecord5(snapshot.resultSummary) ? snapshot.resultSummary : null;
2984
+ const resultRowOutcomes = isRecord5(resultSummary?.rowOutcomes) ? resultSummary.rowOutcomes : null;
2985
+ const terminalCompletedRows = finiteNumber(resultRowOutcomes?.completedRows);
2986
+ const terminalFailedRows = finiteNumber(resultRowOutcomes?.failedRows);
2987
+ const terminalTotalRows = finiteNumber(resultRowOutcomes?.totalRows);
2988
+ const terminalSupersededRows = finiteNumber(
2989
+ resultRowOutcomes?.supersededRows
2990
+ );
2991
+ const settledCompletedRows = terminalCompletedRows ?? completedRows;
2992
+ const settledFailedRows = terminalFailedRows ?? failedRows;
2981
2993
  return {
2982
- completedRows,
2983
- failedRows,
2984
- totalRows,
2985
- hasRowFailures: failedRows > 0
2994
+ completedRows: settledCompletedRows,
2995
+ failedRows: settledFailedRows,
2996
+ totalRows: terminalTotalRows ?? totalRows,
2997
+ hasRowFailures: settledFailedRows > 0,
2998
+ ...(terminalSupersededRows ?? supersededRows) > 0 ? { supersededRows: terminalSupersededRows ?? supersededRows } : {}
2986
2999
  };
2987
3000
  }
2988
3001
  function createEmptyPlayRunLedgerSnapshot(input) {
@@ -3140,6 +3153,7 @@ function normalizeStepProgress(value) {
3140
3153
  ...optionalFiniteNumber(value.activeRows) !== void 0 ? { activeRows: optionalFiniteNumber(value.activeRows) } : {},
3141
3154
  ...optionalFiniteNumber(value.waitingRows) !== void 0 ? { waitingRows: optionalFiniteNumber(value.waitingRows) } : {},
3142
3155
  ...optionalFiniteNumber(value.completedRows) !== void 0 ? { completedRows: optionalFiniteNumber(value.completedRows) } : {},
3156
+ ...optionalFiniteNumber(value.supersededRows) !== void 0 ? { supersededRows: optionalFiniteNumber(value.supersededRows) } : {},
3143
3157
  ...optionalString(value.message) ? { message: optionalString(value.message) } : {},
3144
3158
  ...optionalNullableString(value.artifactTableNamespace) !== void 0 ? {
3145
3159
  artifactTableNamespace: optionalNullableString(
@@ -3291,6 +3305,7 @@ function buildSnapshotFromLedger(snapshot) {
3291
3305
  activeRows: step.progress.activeRows,
3292
3306
  waitingRows: step.progress.waitingRows,
3293
3307
  completedRows: step.progress.completedRows,
3308
+ supersededRows: step.progress.supersededRows,
3294
3309
  message: step.progress.message,
3295
3310
  artifactTableNamespace: step.progress.artifactTableNamespace ?? step.artifactTableNamespace ?? null,
3296
3311
  startedAt: step.startedAt ?? null,
@@ -3304,7 +3319,8 @@ function buildSnapshotFromLedger(snapshot) {
3304
3319
  ...step.progress?.nodeIo ? { nodeIo: step.progress.nodeIo } : {}
3305
3320
  }));
3306
3321
  const liveStatus = normalizePlayRunLiveStatus(snapshot.status);
3307
- const rowOutcomes = isTerminalPlayRunLiveStatus(liveStatus) && Object.keys(snapshot.stepsById).length > 0 ? summarizeRunRowOutcomes(snapshot) : null;
3322
+ const terminalRowOutcomes = isTerminalPlayRunLiveStatus(liveStatus) ? summarizeRunRowOutcomes(snapshot) : null;
3323
+ const rowOutcomes = terminalRowOutcomes && (Object.keys(snapshot.stepsById).length > 0 || terminalRowOutcomes.totalRows > 0 || (terminalRowOutcomes.supersededRows ?? 0) > 0) ? terminalRowOutcomes : null;
3308
3324
  return {
3309
3325
  runId: snapshot.runId,
3310
3326
  status: liveStatus,
@@ -4678,6 +4694,7 @@ var DeeplineClient = class _DeeplineClient {
4678
4694
  invoices: {
4679
4695
  list: (options2) => this.listBillingInvoices(options2)
4680
4696
  },
4697
+ usageEvent: (requestId) => this.getBillingUsageEvent(requestId),
4681
4698
  targetPlans: () => this.getTargetBillingPlans(),
4682
4699
  targetStatus: () => this.getTargetBillingStatus(),
4683
4700
  autoRecharge: {
@@ -5012,7 +5029,7 @@ var DeeplineClient = class _DeeplineClient {
5012
5029
  * guaranteed support for every model. Runtime AI SDK/Gateway errors remain
5013
5030
  * authoritative for model-gated values.
5014
5031
  *
5015
- * @param model - Gateway model id such as `"openai/gpt-5.5"`
5032
+ * @param model - Exact-case Gateway model id such as `"openai/gpt-5.6-luna"`
5016
5033
  * @returns Model metadata, provider option shapes, and runnable examples
5017
5034
  */
5018
5035
  async describeModel(model) {
@@ -7049,6 +7066,33 @@ var DeeplineClient = class _DeeplineClient {
7049
7066
  async getBillingPlans() {
7050
7067
  return this.http.get("/api/v2/billing/catalog/current");
7051
7068
  }
7069
+ /**
7070
+ * Read the authenticated usage record for one execution request. The
7071
+ * request id comes from the original `executeTool` result and is not a
7072
+ * retry or idempotency token.
7073
+ */
7074
+ async getBillingUsageEvent(requestId) {
7075
+ const normalizedRequestId = requestId.trim();
7076
+ if (normalizedRequestId.length === 0 || normalizedRequestId.length > 200 || normalizedRequestId !== requestId) {
7077
+ throw new DeeplineError(
7078
+ "Usage request_id must contain 1\u2013200 characters with no leading or trailing whitespace.",
7079
+ void 0,
7080
+ "INVALID_USAGE_REQUEST_ID"
7081
+ );
7082
+ }
7083
+ const response = await this.http.get(
7084
+ `/api/v2/usage/events?request_id=${encodeURIComponent(normalizedRequestId)}`
7085
+ );
7086
+ const event = response.entries?.[0];
7087
+ if (!event) {
7088
+ throw new DeeplineError(
7089
+ "No usage event was found for this request_id.",
7090
+ void 0,
7091
+ "USAGE_EVENT_NOT_FOUND"
7092
+ );
7093
+ }
7094
+ return event;
7095
+ }
7052
7096
  /**
7053
7097
  * Charge the saved payment method and add Deepline credits to the active
7054
7098
  * workspace. Prefer `client.billing.topUp(...)`.
@@ -8748,6 +8792,17 @@ function findFirstTargetByPath(result, paths) {
8748
8792
  }
8749
8793
  return null;
8750
8794
  }
8795
+ function findFirstExplicitNullTargetByPath(result, paths) {
8796
+ for (const path of paths ?? []) {
8797
+ for (const candidate of candidateResultPaths(path)) {
8798
+ const explicitNull = valuesAtSegments(result, parsePath(candidate)).find(
8799
+ (entry) => entry.value === null
8800
+ );
8801
+ if (explicitNull) return { value: null, path: explicitNull.path };
8802
+ }
8803
+ }
8804
+ return null;
8805
+ }
8751
8806
  function firstValueForPaths(result, paths) {
8752
8807
  return findFirstTargetByPath(result, paths);
8753
8808
  }
@@ -9007,7 +9062,11 @@ function buildTargets(result, extractors, targetGetters) {
9007
9062
  continue;
9008
9063
  }
9009
9064
  const fromExtractor = findFirstTargetByPath(result, descriptor.paths);
9010
- if (!fromExtractor) continue;
9065
+ if (!fromExtractor) {
9066
+ const explicitNull = isSemanticStatus ? null : findFirstExplicitNullTargetByPath(result, descriptor.paths);
9067
+ if (explicitNull) targets[target] = explicitNull;
9068
+ continue;
9069
+ }
9011
9070
  const transformed = coerceToEnum(
9012
9071
  applyExtractorTransforms(fromExtractor.value, descriptor),
9013
9072
  descriptor
@@ -9030,6 +9089,14 @@ function buildTargets(result, extractors, targetGetters) {
9030
9089
  targets[target] = fromMetadata;
9031
9090
  continue;
9032
9091
  }
9092
+ const explicitNull = findFirstExplicitNullTargetByPath(
9093
+ result,
9094
+ targetGetters?.[target]
9095
+ );
9096
+ if (explicitNull) {
9097
+ targets[target] = explicitNull;
9098
+ continue;
9099
+ }
9033
9100
  const fallback = findFirstTargetByKey(result, target);
9034
9101
  if (fallback) {
9035
9102
  targets[target] = fallback;
@@ -9037,6 +9104,7 @@ function buildTargets(result, extractors, targetGetters) {
9037
9104
  }
9038
9105
  if (metadataTargets.size === 0) {
9039
9106
  for (const target of ["email", "phone", "linkedin", "domain", "status"]) {
9107
+ if (targets[target]) continue;
9040
9108
  const found = findFirstTargetByKey(result, target);
9041
9109
  if (found) targets[target] = found;
9042
9110
  }
@@ -552,8 +552,8 @@
552
552
  "dist/cli/index.js",
553
553
  "dist/cli/index.mjs",
554
554
  "dist/cli/text-imports.d.ts",
555
- "dist/compiler-manifest-BIqRyj5m.d.mts",
556
- "dist/compiler-manifest-BIqRyj5m.d.ts",
555
+ "dist/compiler-manifest-BJBNPTWt.d.mts",
556
+ "dist/compiler-manifest-BJBNPTWt.d.ts",
557
557
  "dist/helpers.d.mts",
558
558
  "dist/helpers.d.ts",
559
559
  "dist/helpers.js",
@@ -1,6 +1,6 @@
1
1
  /// <reference path="./text-imports.d.ts" />
2
- import { P as PlayArtifactKind, a as PlayBundleArtifact, b as PlaySandboxRuntimeDeclaration, c as PlayCompilerManifest } from '../compiler-manifest-BIqRyj5m.mjs';
3
- export { d as PLAY_ARTIFACT_KINDS, e as PlayArtifactCompatibility, f as PlayImportPolicy, g as PlayPackageImport, h as PlayRuntimeFeature } from '../compiler-manifest-BIqRyj5m.mjs';
2
+ import { P as PlayArtifactKind, a as PlayBundleArtifact, b as PlaySandboxRuntimeDeclaration, c as PlayCompilerManifest } from '../compiler-manifest-BJBNPTWt.mjs';
3
+ export { d as PLAY_ARTIFACT_KINDS, e as PlayArtifactCompatibility, f as PlayImportPolicy, g as PlayPackageImport, h as PlayRuntimeFeature } from '../compiler-manifest-BJBNPTWt.mjs';
4
4
  import '@sinclair/typebox';
5
5
 
6
6
  type ImportedPlayDependency = {
@@ -1,6 +1,6 @@
1
1
  /// <reference path="./text-imports.d.ts" />
2
- import { P as PlayArtifactKind, a as PlayBundleArtifact, b as PlaySandboxRuntimeDeclaration, c as PlayCompilerManifest } from '../compiler-manifest-BIqRyj5m.js';
3
- export { d as PLAY_ARTIFACT_KINDS, e as PlayArtifactCompatibility, f as PlayImportPolicy, g as PlayPackageImport, h as PlayRuntimeFeature } from '../compiler-manifest-BIqRyj5m.js';
2
+ import { P as PlayArtifactKind, a as PlayBundleArtifact, b as PlaySandboxRuntimeDeclaration, c as PlayCompilerManifest } from '../compiler-manifest-BJBNPTWt.js';
3
+ export { d as PLAY_ARTIFACT_KINDS, e as PlayArtifactCompatibility, f as PlayImportPolicy, g as PlayPackageImport, h as PlayRuntimeFeature } from '../compiler-manifest-BJBNPTWt.js';
4
4
  import '@sinclair/typebox';
5
5
 
6
6
  type ImportedPlayDependency = {
@@ -149,7 +149,7 @@ type SdkRelease = {
149
149
  supportPolicy: SdkSupportPolicy;
150
150
  };
151
151
  declare const SDK_RELEASE: {
152
- readonly version: "0.3.144";
152
+ readonly version: "0.3.146";
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.144";
152
+ readonly version: "0.3.146";
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.144",
77
+ version: "0.3.146",
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.144",
51
+ version: "0.3.146",
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.144",
3
+ "version": "0.3.146",
4
4
  "description": "GTM data CLI and TypeScript SDK for coding agents",
5
5
  "license": "MIT",
6
6
  "homepage": "https://code.deepline.com",