deepline 0.3.144 → 0.3.145

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.
@@ -1960,6 +1960,21 @@ export type WorkspacesNamespace = {
1960
1960
  }) => Promise<WorkspaceCreateResult>;
1961
1961
  };
1962
1962
 
1963
+ /** One authenticated per-request usage event from `/api/v2/usage/events`. */
1964
+ export type BillingUsageEvent = {
1965
+ id: string | null;
1966
+ provider: string;
1967
+ operation: string;
1968
+ status: string;
1969
+ request_id: string;
1970
+ billing_outcome_reason: string | null;
1971
+ credits: number | null;
1972
+ billing_mode: string | null;
1973
+ pricing_model: string | null;
1974
+ policy_id: string | null;
1975
+ created_at: string;
1976
+ };
1977
+
1963
1978
  /**
1964
1979
  * Public `client.billing` namespace for CLI commands and programmatic callers.
1965
1980
  * Covers plans, subscription state, cancellation, and invoice/receipt history.
@@ -1989,6 +2004,8 @@ export type BillingNamespace = {
1989
2004
  /** Subscription invoices plus credit purchase receipts, newest first. */
1990
2005
  list: (options?: { limit?: number }) => Promise<BillingInvoicesResult>;
1991
2006
  };
2007
+ /** Read one exact execution outcome using the request_id returned by executeTool. */
2008
+ usageEvent: (requestId: string) => Promise<BillingUsageEvent>;
1992
2009
  /** Metronome-authored target catalog and current Contract projection. */
1993
2010
  targetPlans: () => Promise<TargetBillingPlansResult>;
1994
2011
  /** Normalized target billing state. */
@@ -2600,6 +2617,7 @@ export class DeeplineClient {
2600
2617
  invoices: {
2601
2618
  list: (options) => this.listBillingInvoices(options),
2602
2619
  },
2620
+ usageEvent: (requestId) => this.getBillingUsageEvent(requestId),
2603
2621
  targetPlans: () => this.getTargetBillingPlans(),
2604
2622
  targetStatus: () => this.getTargetBillingStatus(),
2605
2623
  autoRecharge: {
@@ -5803,6 +5821,40 @@ export class DeeplineClient {
5803
5821
  return this.http.get<BillingPlansResult>('/api/v2/billing/catalog/current');
5804
5822
  }
5805
5823
 
5824
+ /**
5825
+ * Read the authenticated usage record for one execution request. The
5826
+ * request id comes from the original `executeTool` result and is not a
5827
+ * retry or idempotency token.
5828
+ */
5829
+ async getBillingUsageEvent(requestId: string): Promise<BillingUsageEvent> {
5830
+ const normalizedRequestId = requestId.trim();
5831
+ if (
5832
+ normalizedRequestId.length === 0 ||
5833
+ normalizedRequestId.length > 200 ||
5834
+ normalizedRequestId !== requestId
5835
+ ) {
5836
+ throw new DeeplineError(
5837
+ 'Usage request_id must contain 1–200 characters with no leading or trailing whitespace.',
5838
+ undefined,
5839
+ 'INVALID_USAGE_REQUEST_ID',
5840
+ );
5841
+ }
5842
+ const response = await this.http.get<{
5843
+ entries?: BillingUsageEvent[];
5844
+ }>(
5845
+ `/api/v2/usage/events?request_id=${encodeURIComponent(normalizedRequestId)}`,
5846
+ );
5847
+ const event = response.entries?.[0];
5848
+ if (!event) {
5849
+ throw new DeeplineError(
5850
+ 'No usage event was found for this request_id.',
5851
+ undefined,
5852
+ 'USAGE_EVENT_NOT_FOUND',
5853
+ );
5854
+ }
5855
+ return event;
5856
+ }
5857
+
5806
5858
  /**
5807
5859
  * Charge the saved payment method and add Deepline credits to the active
5808
5860
  * workspace. Prefer `client.billing.topUp(...)`.
@@ -73,6 +73,7 @@ export type {
73
73
  BillingSubscriptionCancelResult,
74
74
  BillingSubscriptionStatus,
75
75
  BillingTopUpResult,
76
+ BillingUsageEvent,
76
77
  WorkspaceCreateResult,
77
78
  WorkspacesNamespace,
78
79
  MonitorsNamespace,
@@ -200,7 +200,7 @@ export const SDK_RELEASE = {
200
200
  // getters keep their established compatibility behavior.
201
201
  // 0.3.1 deprecated the legacy `deepline enrich` command in favor of Plays.
202
202
  // 0.3.90 is the first deliberately versioned SDK release for API v3.
203
- version: '0.3.144',
203
+ version: '0.3.145',
204
204
  updateSummary:
205
205
  '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.',
206
206
  packageCapabilities: {
@@ -664,6 +664,21 @@ function findFirstTargetByPath(
664
664
  return null;
665
665
  }
666
666
 
667
+ function findFirstExplicitNullTargetByPath(
668
+ result: unknown,
669
+ paths: readonly string[] | undefined,
670
+ ): ToolResultTargetMetadata | null {
671
+ for (const path of paths ?? []) {
672
+ for (const candidate of candidateResultPaths(path)) {
673
+ const explicitNull = valuesAtSegments(result, parsePath(candidate)).find(
674
+ (entry) => entry.value === null,
675
+ );
676
+ if (explicitNull) return { value: null, path: explicitNull.path };
677
+ }
678
+ }
679
+ return null;
680
+ }
681
+
667
682
  function firstValueForPaths(
668
683
  result: unknown,
669
684
  paths: readonly string[] | undefined,
@@ -1015,7 +1030,15 @@ function buildTargets(
1015
1030
  continue;
1016
1031
  }
1017
1032
  const fromExtractor = findFirstTargetByPath(result, descriptor.paths);
1018
- if (!fromExtractor) continue;
1033
+ if (!fromExtractor) {
1034
+ // A declared null is an explicit provider answer, not permission to
1035
+ // guess from a similarly named sibling such as `emailDomain`.
1036
+ const explicitNull = isSemanticStatus
1037
+ ? null
1038
+ : findFirstExplicitNullTargetByPath(result, descriptor.paths);
1039
+ if (explicitNull) targets[target] = explicitNull;
1040
+ continue;
1041
+ }
1019
1042
  const transformed = coerceToEnum(
1020
1043
  applyExtractorTransforms(fromExtractor.value, descriptor),
1021
1044
  descriptor,
@@ -1038,6 +1061,14 @@ function buildTargets(
1038
1061
  targets[target] = fromMetadata;
1039
1062
  continue;
1040
1063
  }
1064
+ const explicitNull = findFirstExplicitNullTargetByPath(
1065
+ result,
1066
+ targetGetters?.[target],
1067
+ );
1068
+ if (explicitNull) {
1069
+ targets[target] = explicitNull;
1070
+ continue;
1071
+ }
1041
1072
  // Declared paths are routinely incomplete against the shape a provider
1042
1073
  // actually returns (zerobounce declares `result.data.email` and answers
1043
1074
  // with `address`), so the key scan stays as the rescue. It is bounded by
@@ -1053,6 +1084,7 @@ function buildTargets(
1053
1084
  }
1054
1085
  if (metadataTargets.size === 0) {
1055
1086
  for (const target of ['email', 'phone', 'linkedin', 'domain', 'status']) {
1087
+ if (targets[target]) continue;
1056
1088
  const found = findFirstTargetByKey(result, target);
1057
1089
  if (found) targets[target] = found;
1058
1090
  }
@@ -1333,8 +1365,8 @@ export function readValue(
1333
1365
  selector: readonly string[] | string,
1334
1366
  ): unknown {
1335
1367
  if (typeof selector === 'string') {
1336
- const declared = result.extractedValues[selector]?.get();
1337
- if (declared != null) return declared;
1368
+ const declared = result.extractedValues[selector];
1369
+ if (declared) return declared.get();
1338
1370
  }
1339
1371
  const root = resultRootOf(result);
1340
1372
  const paths = Array.isArray(selector) ? selector : [selector];
@@ -13,7 +13,17 @@ export type ToolResultBilling = {
13
13
  cost_usd?: number;
14
14
  /** Missing on historical responses. Pending pricing has no final amount. */
15
15
  pricing_status?: 'final' | 'pending';
16
- settlement_status?: 'pending' | 'queued' | 'settled' | 'requires_recovery';
16
+ settlement_status?:
17
+ | 'pending'
18
+ | 'queued'
19
+ | 'settled'
20
+ | 'released'
21
+ | 'requires_recovery';
22
+ billing_outcome_reason?:
23
+ | 'free_operation'
24
+ | 'provider_no_billable_result'
25
+ | 'provider_reported_zero_usage'
26
+ | 'zero_price';
17
27
  estimated_credits?: number;
18
28
  estimated_cost_usd?: number;
19
29
  /** Preserve additive public pricing details across runtime/deployment skew. */
package/dist/cli/index.js CHANGED
@@ -3068,7 +3068,7 @@ var SDK_RELEASE = {
3068
3068
  // getters keep their established compatibility behavior.
3069
3069
  // 0.3.1 deprecated the legacy `deepline enrich` command in favor of Plays.
3070
3070
  // 0.3.90 is the first deliberately versioned SDK release for API v3.
3071
- version: "0.3.144",
3071
+ version: "0.3.145",
3072
3072
  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.",
3073
3073
  packageCapabilities: {
3074
3074
  updatePreferences: 1
@@ -7100,6 +7100,7 @@ var DeeplineClient = class _DeeplineClient {
7100
7100
  invoices: {
7101
7101
  list: (options2) => this.listBillingInvoices(options2)
7102
7102
  },
7103
+ usageEvent: (requestId) => this.getBillingUsageEvent(requestId),
7103
7104
  targetPlans: () => this.getTargetBillingPlans(),
7104
7105
  targetStatus: () => this.getTargetBillingStatus(),
7105
7106
  autoRecharge: {
@@ -9471,6 +9472,33 @@ var DeeplineClient = class _DeeplineClient {
9471
9472
  async getBillingPlans() {
9472
9473
  return this.http.get("/api/v2/billing/catalog/current");
9473
9474
  }
9475
+ /**
9476
+ * Read the authenticated usage record for one execution request. The
9477
+ * request id comes from the original `executeTool` result and is not a
9478
+ * retry or idempotency token.
9479
+ */
9480
+ async getBillingUsageEvent(requestId) {
9481
+ const normalizedRequestId = requestId.trim();
9482
+ if (normalizedRequestId.length === 0 || normalizedRequestId.length > 200 || normalizedRequestId !== requestId) {
9483
+ throw new DeeplineError(
9484
+ "Usage request_id must contain 1\u2013200 characters with no leading or trailing whitespace.",
9485
+ void 0,
9486
+ "INVALID_USAGE_REQUEST_ID"
9487
+ );
9488
+ }
9489
+ const response = await this.http.get(
9490
+ `/api/v2/usage/events?request_id=${encodeURIComponent(normalizedRequestId)}`
9491
+ );
9492
+ const event = response.entries?.[0];
9493
+ if (!event) {
9494
+ throw new DeeplineError(
9495
+ "No usage event was found for this request_id.",
9496
+ void 0,
9497
+ "USAGE_EVENT_NOT_FOUND"
9498
+ );
9499
+ }
9500
+ return event;
9501
+ }
9474
9502
  /**
9475
9503
  * Charge the saved payment method and add Deepline credits to the active
9476
9504
  * workspace. Prefer `client.billing.topUp(...)`.
@@ -3063,7 +3063,7 @@ var SDK_RELEASE = {
3063
3063
  // getters keep their established compatibility behavior.
3064
3064
  // 0.3.1 deprecated the legacy `deepline enrich` command in favor of Plays.
3065
3065
  // 0.3.90 is the first deliberately versioned SDK release for API v3.
3066
- version: "0.3.144",
3066
+ version: "0.3.145",
3067
3067
  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.",
3068
3068
  packageCapabilities: {
3069
3069
  updatePreferences: 1
@@ -7095,6 +7095,7 @@ var DeeplineClient = class _DeeplineClient {
7095
7095
  invoices: {
7096
7096
  list: (options2) => this.listBillingInvoices(options2)
7097
7097
  },
7098
+ usageEvent: (requestId) => this.getBillingUsageEvent(requestId),
7098
7099
  targetPlans: () => this.getTargetBillingPlans(),
7099
7100
  targetStatus: () => this.getTargetBillingStatus(),
7100
7101
  autoRecharge: {
@@ -9466,6 +9467,33 @@ var DeeplineClient = class _DeeplineClient {
9466
9467
  async getBillingPlans() {
9467
9468
  return this.http.get("/api/v2/billing/catalog/current");
9468
9469
  }
9470
+ /**
9471
+ * Read the authenticated usage record for one execution request. The
9472
+ * request id comes from the original `executeTool` result and is not a
9473
+ * retry or idempotency token.
9474
+ */
9475
+ async getBillingUsageEvent(requestId) {
9476
+ const normalizedRequestId = requestId.trim();
9477
+ if (normalizedRequestId.length === 0 || normalizedRequestId.length > 200 || normalizedRequestId !== requestId) {
9478
+ throw new DeeplineError(
9479
+ "Usage request_id must contain 1\u2013200 characters with no leading or trailing whitespace.",
9480
+ void 0,
9481
+ "INVALID_USAGE_REQUEST_ID"
9482
+ );
9483
+ }
9484
+ const response = await this.http.get(
9485
+ `/api/v2/usage/events?request_id=${encodeURIComponent(normalizedRequestId)}`
9486
+ );
9487
+ const event = response.entries?.[0];
9488
+ if (!event) {
9489
+ throw new DeeplineError(
9490
+ "No usage event was found for this request_id.",
9491
+ void 0,
9492
+ "USAGE_EVENT_NOT_FOUND"
9493
+ );
9494
+ }
9495
+ return event;
9496
+ }
9469
9497
  /**
9470
9498
  * Charge the saved payment method and add Deepline credits to the active
9471
9499
  * workspace. Prefer `client.billing.topUp(...)`.
@@ -334,7 +334,8 @@ type ToolResultBilling = {
334
334
  cost_usd?: number;
335
335
  /** Missing on historical responses. Pending pricing has no final amount. */
336
336
  pricing_status?: 'final' | 'pending';
337
- settlement_status?: 'pending' | 'queued' | 'settled' | 'requires_recovery';
337
+ settlement_status?: 'pending' | 'queued' | 'settled' | 'released' | 'requires_recovery';
338
+ billing_outcome_reason?: 'free_operation' | 'provider_no_billable_result' | 'provider_reported_zero_usage' | 'zero_price';
338
339
  estimated_credits?: number;
339
340
  estimated_cost_usd?: number;
340
341
  /** Preserve additive public pricing details across runtime/deployment skew. */
@@ -334,7 +334,8 @@ type ToolResultBilling = {
334
334
  cost_usd?: number;
335
335
  /** Missing on historical responses. Pending pricing has no final amount. */
336
336
  pricing_status?: 'final' | 'pending';
337
- settlement_status?: 'pending' | 'queued' | 'settled' | 'requires_recovery';
337
+ settlement_status?: 'pending' | 'queued' | 'settled' | 'released' | 'requires_recovery';
338
+ billing_outcome_reason?: 'free_operation' | 'provider_no_billable_result' | 'provider_reported_zero_usage' | 'zero_price';
338
339
  estimated_credits?: number;
339
340
  estimated_cost_usd?: number;
340
341
  /** Preserve additive public pricing details across runtime/deployment skew. */
package/dist/index.d.mts CHANGED
@@ -1,6 +1,6 @@
1
1
  /// <reference path="./text-imports.d.ts" />
2
- import { c as PlayCompilerManifest, T as ToolResultBilling, A as AsyncPlayRunRef$1, i as PlayAuthoringColumnMap, j as PlayAuthoringColumnResolver, k as PlayAuthoringRuntimeContext, l as PlayAuthoringConditionalStepResolver, m as PlayAuthoringCsvInput, n as PlayAuthoringCsvOptions, o as PlayAuthoringDatasetBuilder, p as PlayAuthoringDatasetColumnDefinition, q as PlayAuthoringDatasetColumnRunInput, r as ToolExecuteResult, s as PlayAuthoringReferenceLike, t as PlayReturnObject$1, u as PlayAuthoringDefineConfig, v as PlayAuthoringDefinedPlay, w as PlayAuthoringFetchOptions, x as PlayAuthoringFileInput, y as PlayAuthoringAsyncCallOptions, z as PlayAuthoringBindings, B as PlayAuthoringCallExecution, C as PlayAuthoringCallOptions, D as PlayAuthoringFetchResponse, E as PlayAuthoringInputContract, F as PlayRunId$1, G as PlayAuthoringStepProgramStep, H as PlayAuthoringRuntimeStepOptions, I as PlaySqlListenerDeclaration, J as PlaySqlListenerEvent, K as PlaySqlListenerOperation, L as PlaySqlQuery, M as PlayAuthoringStepOptions, N as PlayAuthoringStepProgram, O as PlayAuthoringStepProgramResolver, Q as PlayAuthoringStepResolver, R as PlayToolExecutionRequest, S as PlayAuthoringStepProgramOptions, U as DeeplineError, V as ToolExecutionError, W as ToolExecutionErrorOptions } from './compiler-manifest-BIqRyj5m.mjs';
3
- export { X as CtxFetchHttpError, Y as DEEPLINE_EXTRACTOR_TARGETS, Z as DEEPLINE_EXTRACTOR_TARGET_DEFINITIONS, _ as DeeplineEmailStatusGetterValue, $ as DeeplineExtractorTarget, a0 as DeeplineGetterValue, a1 as DeeplineGetterValueMap, a2 as JOB_CHANGE_STATUS_VALUES, a3 as JobChangeStatus, a4 as PHONE_STATUS_VALUES, a5 as PhoneStatus, a6 as PlayDataset, a7 as PlayDatasetInput, a8 as PreviousCell, a9 as ProviderTransientError, aa as ProviderTransientErrorCategory, ab as ProviderUnavailableError, ac as ProviderUnavailableReason, ad as ToolExecutionErrorCategory, ae as ToolExecutionErrorOrigin, af as ToolExecutionFailureV1, ag as ToolExecutionNetworkKind, ah as ToolExecutionNetworkScope, ai as ToolExecutionPublicDetails, aj as getProviderUnavailableReason, ak as isDeeplineExtractorTarget, al as isProviderUnavailable, am as isProviderWaterfallUnavailableError } from './compiler-manifest-BIqRyj5m.mjs';
2
+ import { c as PlayCompilerManifest, T as ToolResultBilling, A as AsyncPlayRunRef$1, i as PlayAuthoringColumnMap, j as PlayAuthoringColumnResolver, k as PlayAuthoringRuntimeContext, l as PlayAuthoringConditionalStepResolver, m as PlayAuthoringCsvInput, n as PlayAuthoringCsvOptions, o as PlayAuthoringDatasetBuilder, p as PlayAuthoringDatasetColumnDefinition, q as PlayAuthoringDatasetColumnRunInput, r as ToolExecuteResult, s as PlayAuthoringReferenceLike, t as PlayReturnObject$1, u as PlayAuthoringDefineConfig, v as PlayAuthoringDefinedPlay, w as PlayAuthoringFetchOptions, x as PlayAuthoringFileInput, y as PlayAuthoringAsyncCallOptions, z as PlayAuthoringBindings, B as PlayAuthoringCallExecution, C as PlayAuthoringCallOptions, D as PlayAuthoringFetchResponse, E as PlayAuthoringInputContract, F as PlayRunId$1, G as PlayAuthoringStepProgramStep, H as PlayAuthoringRuntimeStepOptions, I as PlaySqlListenerDeclaration, J as PlaySqlListenerEvent, K as PlaySqlListenerOperation, L as PlaySqlQuery, M as PlayAuthoringStepOptions, N as PlayAuthoringStepProgram, O as PlayAuthoringStepProgramResolver, Q as PlayAuthoringStepResolver, R as PlayToolExecutionRequest, S as PlayAuthoringStepProgramOptions, U as DeeplineError, V as ToolExecutionError, W as ToolExecutionErrorOptions } from './compiler-manifest-BJBNPTWt.mjs';
3
+ export { X as CtxFetchHttpError, Y as DEEPLINE_EXTRACTOR_TARGETS, Z as DEEPLINE_EXTRACTOR_TARGET_DEFINITIONS, _ as DeeplineEmailStatusGetterValue, $ as DeeplineExtractorTarget, a0 as DeeplineGetterValue, a1 as DeeplineGetterValueMap, a2 as JOB_CHANGE_STATUS_VALUES, a3 as JobChangeStatus, a4 as PHONE_STATUS_VALUES, a5 as PhoneStatus, a6 as PlayDataset, a7 as PlayDatasetInput, a8 as PreviousCell, a9 as ProviderTransientError, aa as ProviderTransientErrorCategory, ab as ProviderUnavailableError, ac as ProviderUnavailableReason, ad as ToolExecutionErrorCategory, ae as ToolExecutionErrorOrigin, af as ToolExecutionFailureV1, ag as ToolExecutionNetworkKind, ah as ToolExecutionNetworkScope, ai as ToolExecutionPublicDetails, aj as getProviderUnavailableReason, ak as isDeeplineExtractorTarget, al as isProviderUnavailable, am as isProviderWaterfallUnavailableError } from './compiler-manifest-BJBNPTWt.mjs';
4
4
  import { MonitorFleetDefinition } from './monitor-fleet-contract.mjs';
5
5
  export { AdmittedMonitorFleetAuthoringContract, MONITOR_FLEET_AUTHORING_CONTRACT_CHANGELOG, MONITOR_FLEET_AUTHORING_CONTRACT_EDITION, MONITOR_FLEET_DOCUMENTATION, MONITOR_FLEET_FRONTIER_MAX_ROWS, MONITOR_FLEET_MAX_MEMBERS, MonitorFleetAuthoringContractEdition, MonitorFleetAuthoringContractResult, MonitorFleetColumn, MonitorFleetContractIssue, MonitorFleetExpression, MonitorFleetTemplate, admitMonitorFleetAuthoringContract, defineMonitorFleet, fleetColumn, fleetKey, lintMonitorFleetInput, validateMonitorFleetDefinition } from './monitor-fleet-contract.mjs';
6
6
  export { BatchMonitorInput, MonitorInputIssue, MonitorSpec as MonitorInputSpec, lintMonitorBatchInput, lintMonitorSpecTemplate, renderMonitorSpecTemplate } from './monitor-input-contract.mjs';
@@ -4273,6 +4273,20 @@ type WorkspacesNamespace = {
4273
4273
  idempotencyKey: string;
4274
4274
  }) => Promise<WorkspaceCreateResult>;
4275
4275
  };
4276
+ /** One authenticated per-request usage event from `/api/v2/usage/events`. */
4277
+ type BillingUsageEvent = {
4278
+ id: string | null;
4279
+ provider: string;
4280
+ operation: string;
4281
+ status: string;
4282
+ request_id: string;
4283
+ billing_outcome_reason: string | null;
4284
+ credits: number | null;
4285
+ billing_mode: string | null;
4286
+ pricing_model: string | null;
4287
+ policy_id: string | null;
4288
+ created_at: string;
4289
+ };
4276
4290
  /**
4277
4291
  * Public `client.billing` namespace for CLI commands and programmatic callers.
4278
4292
  * Covers plans, subscription state, cancellation, and invoice/receipt history.
@@ -4304,6 +4318,8 @@ type BillingNamespace = {
4304
4318
  limit?: number;
4305
4319
  }) => Promise<BillingInvoicesResult>;
4306
4320
  };
4321
+ /** Read one exact execution outcome using the request_id returned by executeTool. */
4322
+ usageEvent: (requestId: string) => Promise<BillingUsageEvent>;
4307
4323
  /** Metronome-authored target catalog and current Contract projection. */
4308
4324
  targetPlans: () => Promise<TargetBillingPlansResult>;
4309
4325
  /** Normalized target billing state. */
@@ -5368,6 +5384,12 @@ declare class DeeplineClient {
5368
5384
  * @returns Snake_case catalog from `GET /api/v2/billing/catalog/current`
5369
5385
  */
5370
5386
  getBillingPlans(): Promise<BillingPlansResult>;
5387
+ /**
5388
+ * Read the authenticated usage record for one execution request. The
5389
+ * request id comes from the original `executeTool` result and is not a
5390
+ * retry or idempotency token.
5391
+ */
5392
+ getBillingUsageEvent(requestId: string): Promise<BillingUsageEvent>;
5371
5393
  /**
5372
5394
  * Charge the saved payment method and add Deepline credits to the active
5373
5395
  * workspace. Prefer `client.billing.topUp(...)`.
@@ -6570,4 +6592,4 @@ declare function writeCsvOutputFile(rows: Array<Record<string, unknown>>, stem:
6570
6592
  */
6571
6593
  declare function extractSummaryFields(payload: unknown): Record<string, Scalar>;
6572
6594
 
6573
- export { type AsyncPlayRunRef, AuthError, type BillingCreditPool, type BillingInvoiceEntry, type BillingInvoicesResult, type BillingNamespace, type BillingPaymentMethodSummary, type BillingSubscriptionCancelResult, type BillingSubscriptionStatus, type BillingTopUpResult, type ClearPlayHistoryRequest, type ClearPlayHistoryResult, type ColumnMap, type ColumnResolver, type ConditionalStepResolver, ConfigError, type CreateNotificationGroupInput, type CreateNotificationGroupResult, type CsvInput, type CsvOptions, type CustomerDbQueryResult, DEEPLINE_TOOL_CATEGORIES, type DatasetBuilder, type DatasetColumnDefinition, type DatasetColumnRunInput, type DbNamespace, Deepline, DeeplineClient, type DeeplineClientOptions, DeeplineContext, DeeplineError, type DeeplineNamedPlay, type DeeplinePlayRuntimeContext, type DeeplinePlaysNamespace, type DeeplineToolCategory, type DeeplineToolsNamespace, type DefinePlayConfig, type DefinedPlay, type FetchOptions, type FileInput, type IngestionStorageRepairResult, type LegacyMonitorStatusFilter, type LiveEventEnvelope, MONITOR_JOB_PHASES, MONITOR_JOB_RECONCILIATION_STATES, MONITOR_JOB_STATES, type MonitorBatchNamespace, type MonitorCheckResult, type MonitorDefinition, type MonitorDeleteResult, type MonitorDependents, type MonitorDeployResult, type MonitorDetail, type MonitorFleetDeactivateOptions, MonitorFleetDefinition, type MonitorFleetGetOptions, type MonitorFleetReactivateOptions, type MonitorFleetResult, type MonitorFleetStatus, type MonitorFleetSyncOptions, type MonitorFleetWaitOptions, type MonitorFleetsNamespace, type MonitorJobDeployOptions, type MonitorJobLogsOptions, type MonitorJobPhase, type MonitorJobReconciliationState, type MonitorJobResult, type MonitorJobState, type MonitorJobWaitOptions, type MonitorJobsNamespace, type MonitorListEntry, type MonitorPayload, type MonitorReactivateResult, type MonitorSpec, type MonitorState, type MonitorStateFilter, type MonitorUpdateChangeSummary, type MonitorUpdateResult, type MonitorsAccessStatus, type MonitorsAvailableOptions, type MonitorsAvailableResult, type MonitorsListOptions, type MonitorsListResult, type MonitorsNamespace, PLAY_BOOTSTRAP_COMPANY_FIELDS, PLAY_BOOTSTRAP_COMPANY_PROVIDER_CATEGORY, PLAY_BOOTSTRAP_CONTACT_FIELDS, PLAY_BOOTSTRAP_FINDER_KINDS, PLAY_BOOTSTRAP_OUTPUT_FIELD_BY_FINDER, PLAY_BOOTSTRAP_PEOPLE_PROVIDER_CATEGORY, PLAY_BOOTSTRAP_PROVIDER_CATEGORY_BY_FINDER, PLAY_BOOTSTRAP_SOURCE_KINDS, PLAY_BOOTSTRAP_STAGE_KINDS, PLAY_BOOTSTRAP_TEMPLATES, PROD_URL, type PlayActivityObservation, type PlayActivityState, type PlayActivityTarget, type PlayAsyncCallOptions, type PlayBindings, type PlayBootstrapEntityKind, type PlayBootstrapFinderKind, type PlayCallExecution, type PlayCallOptions, type PlayCostEstimate, type PlayFetchResponse, type PlayInputContract, type PlayJob, type PlayListItem, type PlayLiveEvent, type PlayReferenceLike, type PlayRevisionSummary, type PlayRunActionPackage, type PlayRunActivityProjection, type PlayRunDatasetActions, type PlayRunId, type PlayRunPackage, type PlayRunResult, type PlayRunStart, type PlaySheetRow, type PlaySheetRowsResult, type PlayStatus, type PlayStepProgramStep, type PlaysListOptions, type PlaysListPage, type PrebuiltPlayRef, type PublishPlayVersionRequest, type PublishPlayVersionResult, RateLimitError, type RerunOptions, type RerunPlayRunResult, type ResolvedConfig, RunObserveTransportUnavailableError, type RunsListOptions, type RunsListPage, type RunsLogsOptions, type RunsLogsResult, type RunsNamespace, type RunsTailOptions, type RuntimeStepOptions, SDK_API_CONTRACT, SDK_VERSION, type SqlListenerDeclaration, type SqlListenerEvent, type SqlListenerOperation, type SqlQuery, type StartPlayRunRequest, type StepOptions, type StepProgram, type StepProgramResolver, type StepResolver, type StopAllCandidate, type StopAllPlayRunsDryRunResult, type StopAllPlayRunsResult, type StopAllPlayRunsStopResult, type StopAllRunsOptions, type StopPlayRunResult, type ToolDefinition, ToolExecuteResult, type ToolExecution, ToolExecutionError, ToolExecutionErrorOptions, type ToolExecutionRequest, type ToolMetadata, ToolRateLimitError, ToolResultBilling, type ToolSearchOptions, type ToolSearchResult, type WorkspaceCreateResult, type WorkspacesNamespace, defineInput, defineMonitor, definePlay, defineWorkflow, extractSummaryFields, formatPlayBootstrapFinderKinds, formatPlayBootstrapFinderKindsForSentence, formatPlayBootstrapTemplates, getDefinedPlayMetadata, isPlayBootstrapFinderKind, isPlayBootstrapTemplate, isStopAllPlayRunsDryRunResult, resolveConfig, runIf, steps, tryConvertToList, writeCsvOutputFile, writeJsonOutputFile };
6595
+ export { type AsyncPlayRunRef, AuthError, type BillingCreditPool, type BillingInvoiceEntry, type BillingInvoicesResult, type BillingNamespace, type BillingPaymentMethodSummary, type BillingSubscriptionCancelResult, type BillingSubscriptionStatus, type BillingTopUpResult, type BillingUsageEvent, type ClearPlayHistoryRequest, type ClearPlayHistoryResult, type ColumnMap, type ColumnResolver, type ConditionalStepResolver, ConfigError, type CreateNotificationGroupInput, type CreateNotificationGroupResult, type CsvInput, type CsvOptions, type CustomerDbQueryResult, DEEPLINE_TOOL_CATEGORIES, type DatasetBuilder, type DatasetColumnDefinition, type DatasetColumnRunInput, type DbNamespace, Deepline, DeeplineClient, type DeeplineClientOptions, DeeplineContext, DeeplineError, type DeeplineNamedPlay, type DeeplinePlayRuntimeContext, type DeeplinePlaysNamespace, type DeeplineToolCategory, type DeeplineToolsNamespace, type DefinePlayConfig, type DefinedPlay, type FetchOptions, type FileInput, type IngestionStorageRepairResult, type LegacyMonitorStatusFilter, type LiveEventEnvelope, MONITOR_JOB_PHASES, MONITOR_JOB_RECONCILIATION_STATES, MONITOR_JOB_STATES, type MonitorBatchNamespace, type MonitorCheckResult, type MonitorDefinition, type MonitorDeleteResult, type MonitorDependents, type MonitorDeployResult, type MonitorDetail, type MonitorFleetDeactivateOptions, MonitorFleetDefinition, type MonitorFleetGetOptions, type MonitorFleetReactivateOptions, type MonitorFleetResult, type MonitorFleetStatus, type MonitorFleetSyncOptions, type MonitorFleetWaitOptions, type MonitorFleetsNamespace, type MonitorJobDeployOptions, type MonitorJobLogsOptions, type MonitorJobPhase, type MonitorJobReconciliationState, type MonitorJobResult, type MonitorJobState, type MonitorJobWaitOptions, type MonitorJobsNamespace, type MonitorListEntry, type MonitorPayload, type MonitorReactivateResult, type MonitorSpec, type MonitorState, type MonitorStateFilter, type MonitorUpdateChangeSummary, type MonitorUpdateResult, type MonitorsAccessStatus, type MonitorsAvailableOptions, type MonitorsAvailableResult, type MonitorsListOptions, type MonitorsListResult, type MonitorsNamespace, PLAY_BOOTSTRAP_COMPANY_FIELDS, PLAY_BOOTSTRAP_COMPANY_PROVIDER_CATEGORY, PLAY_BOOTSTRAP_CONTACT_FIELDS, PLAY_BOOTSTRAP_FINDER_KINDS, PLAY_BOOTSTRAP_OUTPUT_FIELD_BY_FINDER, PLAY_BOOTSTRAP_PEOPLE_PROVIDER_CATEGORY, PLAY_BOOTSTRAP_PROVIDER_CATEGORY_BY_FINDER, PLAY_BOOTSTRAP_SOURCE_KINDS, PLAY_BOOTSTRAP_STAGE_KINDS, PLAY_BOOTSTRAP_TEMPLATES, PROD_URL, type PlayActivityObservation, type PlayActivityState, type PlayActivityTarget, type PlayAsyncCallOptions, type PlayBindings, type PlayBootstrapEntityKind, type PlayBootstrapFinderKind, type PlayCallExecution, type PlayCallOptions, type PlayCostEstimate, type PlayFetchResponse, type PlayInputContract, type PlayJob, type PlayListItem, type PlayLiveEvent, type PlayReferenceLike, type PlayRevisionSummary, type PlayRunActionPackage, type PlayRunActivityProjection, type PlayRunDatasetActions, type PlayRunId, type PlayRunPackage, type PlayRunResult, type PlayRunStart, type PlaySheetRow, type PlaySheetRowsResult, type PlayStatus, type PlayStepProgramStep, type PlaysListOptions, type PlaysListPage, type PrebuiltPlayRef, type PublishPlayVersionRequest, type PublishPlayVersionResult, RateLimitError, type RerunOptions, type RerunPlayRunResult, type ResolvedConfig, RunObserveTransportUnavailableError, type RunsListOptions, type RunsListPage, type RunsLogsOptions, type RunsLogsResult, type RunsNamespace, type RunsTailOptions, type RuntimeStepOptions, SDK_API_CONTRACT, SDK_VERSION, type SqlListenerDeclaration, type SqlListenerEvent, type SqlListenerOperation, type SqlQuery, type StartPlayRunRequest, type StepOptions, type StepProgram, type StepProgramResolver, type StepResolver, type StopAllCandidate, type StopAllPlayRunsDryRunResult, type StopAllPlayRunsResult, type StopAllPlayRunsStopResult, type StopAllRunsOptions, type StopPlayRunResult, type ToolDefinition, ToolExecuteResult, type ToolExecution, ToolExecutionError, ToolExecutionErrorOptions, type ToolExecutionRequest, type ToolMetadata, ToolRateLimitError, ToolResultBilling, type ToolSearchOptions, type ToolSearchResult, type WorkspaceCreateResult, type WorkspacesNamespace, defineInput, defineMonitor, definePlay, defineWorkflow, extractSummaryFields, formatPlayBootstrapFinderKinds, formatPlayBootstrapFinderKindsForSentence, formatPlayBootstrapTemplates, getDefinedPlayMetadata, isPlayBootstrapFinderKind, isPlayBootstrapTemplate, isStopAllPlayRunsDryRunResult, resolveConfig, runIf, steps, tryConvertToList, writeCsvOutputFile, writeJsonOutputFile };
package/dist/index.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  /// <reference path="./text-imports.d.ts" />
2
- import { c as PlayCompilerManifest, T as ToolResultBilling, A as AsyncPlayRunRef$1, i as PlayAuthoringColumnMap, j as PlayAuthoringColumnResolver, k as PlayAuthoringRuntimeContext, l as PlayAuthoringConditionalStepResolver, m as PlayAuthoringCsvInput, n as PlayAuthoringCsvOptions, o as PlayAuthoringDatasetBuilder, p as PlayAuthoringDatasetColumnDefinition, q as PlayAuthoringDatasetColumnRunInput, r as ToolExecuteResult, s as PlayAuthoringReferenceLike, t as PlayReturnObject$1, u as PlayAuthoringDefineConfig, v as PlayAuthoringDefinedPlay, w as PlayAuthoringFetchOptions, x as PlayAuthoringFileInput, y as PlayAuthoringAsyncCallOptions, z as PlayAuthoringBindings, B as PlayAuthoringCallExecution, C as PlayAuthoringCallOptions, D as PlayAuthoringFetchResponse, E as PlayAuthoringInputContract, F as PlayRunId$1, G as PlayAuthoringStepProgramStep, H as PlayAuthoringRuntimeStepOptions, I as PlaySqlListenerDeclaration, J as PlaySqlListenerEvent, K as PlaySqlListenerOperation, L as PlaySqlQuery, M as PlayAuthoringStepOptions, N as PlayAuthoringStepProgram, O as PlayAuthoringStepProgramResolver, Q as PlayAuthoringStepResolver, R as PlayToolExecutionRequest, S as PlayAuthoringStepProgramOptions, U as DeeplineError, V as ToolExecutionError, W as ToolExecutionErrorOptions } from './compiler-manifest-BIqRyj5m.js';
3
- export { X as CtxFetchHttpError, Y as DEEPLINE_EXTRACTOR_TARGETS, Z as DEEPLINE_EXTRACTOR_TARGET_DEFINITIONS, _ as DeeplineEmailStatusGetterValue, $ as DeeplineExtractorTarget, a0 as DeeplineGetterValue, a1 as DeeplineGetterValueMap, a2 as JOB_CHANGE_STATUS_VALUES, a3 as JobChangeStatus, a4 as PHONE_STATUS_VALUES, a5 as PhoneStatus, a6 as PlayDataset, a7 as PlayDatasetInput, a8 as PreviousCell, a9 as ProviderTransientError, aa as ProviderTransientErrorCategory, ab as ProviderUnavailableError, ac as ProviderUnavailableReason, ad as ToolExecutionErrorCategory, ae as ToolExecutionErrorOrigin, af as ToolExecutionFailureV1, ag as ToolExecutionNetworkKind, ah as ToolExecutionNetworkScope, ai as ToolExecutionPublicDetails, aj as getProviderUnavailableReason, ak as isDeeplineExtractorTarget, al as isProviderUnavailable, am as isProviderWaterfallUnavailableError } from './compiler-manifest-BIqRyj5m.js';
2
+ import { c as PlayCompilerManifest, T as ToolResultBilling, A as AsyncPlayRunRef$1, i as PlayAuthoringColumnMap, j as PlayAuthoringColumnResolver, k as PlayAuthoringRuntimeContext, l as PlayAuthoringConditionalStepResolver, m as PlayAuthoringCsvInput, n as PlayAuthoringCsvOptions, o as PlayAuthoringDatasetBuilder, p as PlayAuthoringDatasetColumnDefinition, q as PlayAuthoringDatasetColumnRunInput, r as ToolExecuteResult, s as PlayAuthoringReferenceLike, t as PlayReturnObject$1, u as PlayAuthoringDefineConfig, v as PlayAuthoringDefinedPlay, w as PlayAuthoringFetchOptions, x as PlayAuthoringFileInput, y as PlayAuthoringAsyncCallOptions, z as PlayAuthoringBindings, B as PlayAuthoringCallExecution, C as PlayAuthoringCallOptions, D as PlayAuthoringFetchResponse, E as PlayAuthoringInputContract, F as PlayRunId$1, G as PlayAuthoringStepProgramStep, H as PlayAuthoringRuntimeStepOptions, I as PlaySqlListenerDeclaration, J as PlaySqlListenerEvent, K as PlaySqlListenerOperation, L as PlaySqlQuery, M as PlayAuthoringStepOptions, N as PlayAuthoringStepProgram, O as PlayAuthoringStepProgramResolver, Q as PlayAuthoringStepResolver, R as PlayToolExecutionRequest, S as PlayAuthoringStepProgramOptions, U as DeeplineError, V as ToolExecutionError, W as ToolExecutionErrorOptions } from './compiler-manifest-BJBNPTWt.js';
3
+ export { X as CtxFetchHttpError, Y as DEEPLINE_EXTRACTOR_TARGETS, Z as DEEPLINE_EXTRACTOR_TARGET_DEFINITIONS, _ as DeeplineEmailStatusGetterValue, $ as DeeplineExtractorTarget, a0 as DeeplineGetterValue, a1 as DeeplineGetterValueMap, a2 as JOB_CHANGE_STATUS_VALUES, a3 as JobChangeStatus, a4 as PHONE_STATUS_VALUES, a5 as PhoneStatus, a6 as PlayDataset, a7 as PlayDatasetInput, a8 as PreviousCell, a9 as ProviderTransientError, aa as ProviderTransientErrorCategory, ab as ProviderUnavailableError, ac as ProviderUnavailableReason, ad as ToolExecutionErrorCategory, ae as ToolExecutionErrorOrigin, af as ToolExecutionFailureV1, ag as ToolExecutionNetworkKind, ah as ToolExecutionNetworkScope, ai as ToolExecutionPublicDetails, aj as getProviderUnavailableReason, ak as isDeeplineExtractorTarget, al as isProviderUnavailable, am as isProviderWaterfallUnavailableError } from './compiler-manifest-BJBNPTWt.js';
4
4
  import { MonitorFleetDefinition } from './monitor-fleet-contract.js';
5
5
  export { AdmittedMonitorFleetAuthoringContract, MONITOR_FLEET_AUTHORING_CONTRACT_CHANGELOG, MONITOR_FLEET_AUTHORING_CONTRACT_EDITION, MONITOR_FLEET_DOCUMENTATION, MONITOR_FLEET_FRONTIER_MAX_ROWS, MONITOR_FLEET_MAX_MEMBERS, MonitorFleetAuthoringContractEdition, MonitorFleetAuthoringContractResult, MonitorFleetColumn, MonitorFleetContractIssue, MonitorFleetExpression, MonitorFleetTemplate, admitMonitorFleetAuthoringContract, defineMonitorFleet, fleetColumn, fleetKey, lintMonitorFleetInput, validateMonitorFleetDefinition } from './monitor-fleet-contract.js';
6
6
  export { BatchMonitorInput, MonitorInputIssue, MonitorSpec as MonitorInputSpec, lintMonitorBatchInput, lintMonitorSpecTemplate, renderMonitorSpecTemplate } from './monitor-input-contract.js';
@@ -4273,6 +4273,20 @@ type WorkspacesNamespace = {
4273
4273
  idempotencyKey: string;
4274
4274
  }) => Promise<WorkspaceCreateResult>;
4275
4275
  };
4276
+ /** One authenticated per-request usage event from `/api/v2/usage/events`. */
4277
+ type BillingUsageEvent = {
4278
+ id: string | null;
4279
+ provider: string;
4280
+ operation: string;
4281
+ status: string;
4282
+ request_id: string;
4283
+ billing_outcome_reason: string | null;
4284
+ credits: number | null;
4285
+ billing_mode: string | null;
4286
+ pricing_model: string | null;
4287
+ policy_id: string | null;
4288
+ created_at: string;
4289
+ };
4276
4290
  /**
4277
4291
  * Public `client.billing` namespace for CLI commands and programmatic callers.
4278
4292
  * Covers plans, subscription state, cancellation, and invoice/receipt history.
@@ -4304,6 +4318,8 @@ type BillingNamespace = {
4304
4318
  limit?: number;
4305
4319
  }) => Promise<BillingInvoicesResult>;
4306
4320
  };
4321
+ /** Read one exact execution outcome using the request_id returned by executeTool. */
4322
+ usageEvent: (requestId: string) => Promise<BillingUsageEvent>;
4307
4323
  /** Metronome-authored target catalog and current Contract projection. */
4308
4324
  targetPlans: () => Promise<TargetBillingPlansResult>;
4309
4325
  /** Normalized target billing state. */
@@ -5368,6 +5384,12 @@ declare class DeeplineClient {
5368
5384
  * @returns Snake_case catalog from `GET /api/v2/billing/catalog/current`
5369
5385
  */
5370
5386
  getBillingPlans(): Promise<BillingPlansResult>;
5387
+ /**
5388
+ * Read the authenticated usage record for one execution request. The
5389
+ * request id comes from the original `executeTool` result and is not a
5390
+ * retry or idempotency token.
5391
+ */
5392
+ getBillingUsageEvent(requestId: string): Promise<BillingUsageEvent>;
5371
5393
  /**
5372
5394
  * Charge the saved payment method and add Deepline credits to the active
5373
5395
  * workspace. Prefer `client.billing.topUp(...)`.
@@ -6570,4 +6592,4 @@ declare function writeCsvOutputFile(rows: Array<Record<string, unknown>>, stem:
6570
6592
  */
6571
6593
  declare function extractSummaryFields(payload: unknown): Record<string, Scalar>;
6572
6594
 
6573
- export { type AsyncPlayRunRef, AuthError, type BillingCreditPool, type BillingInvoiceEntry, type BillingInvoicesResult, type BillingNamespace, type BillingPaymentMethodSummary, type BillingSubscriptionCancelResult, type BillingSubscriptionStatus, type BillingTopUpResult, type ClearPlayHistoryRequest, type ClearPlayHistoryResult, type ColumnMap, type ColumnResolver, type ConditionalStepResolver, ConfigError, type CreateNotificationGroupInput, type CreateNotificationGroupResult, type CsvInput, type CsvOptions, type CustomerDbQueryResult, DEEPLINE_TOOL_CATEGORIES, type DatasetBuilder, type DatasetColumnDefinition, type DatasetColumnRunInput, type DbNamespace, Deepline, DeeplineClient, type DeeplineClientOptions, DeeplineContext, DeeplineError, type DeeplineNamedPlay, type DeeplinePlayRuntimeContext, type DeeplinePlaysNamespace, type DeeplineToolCategory, type DeeplineToolsNamespace, type DefinePlayConfig, type DefinedPlay, type FetchOptions, type FileInput, type IngestionStorageRepairResult, type LegacyMonitorStatusFilter, type LiveEventEnvelope, MONITOR_JOB_PHASES, MONITOR_JOB_RECONCILIATION_STATES, MONITOR_JOB_STATES, type MonitorBatchNamespace, type MonitorCheckResult, type MonitorDefinition, type MonitorDeleteResult, type MonitorDependents, type MonitorDeployResult, type MonitorDetail, type MonitorFleetDeactivateOptions, MonitorFleetDefinition, type MonitorFleetGetOptions, type MonitorFleetReactivateOptions, type MonitorFleetResult, type MonitorFleetStatus, type MonitorFleetSyncOptions, type MonitorFleetWaitOptions, type MonitorFleetsNamespace, type MonitorJobDeployOptions, type MonitorJobLogsOptions, type MonitorJobPhase, type MonitorJobReconciliationState, type MonitorJobResult, type MonitorJobState, type MonitorJobWaitOptions, type MonitorJobsNamespace, type MonitorListEntry, type MonitorPayload, type MonitorReactivateResult, type MonitorSpec, type MonitorState, type MonitorStateFilter, type MonitorUpdateChangeSummary, type MonitorUpdateResult, type MonitorsAccessStatus, type MonitorsAvailableOptions, type MonitorsAvailableResult, type MonitorsListOptions, type MonitorsListResult, type MonitorsNamespace, PLAY_BOOTSTRAP_COMPANY_FIELDS, PLAY_BOOTSTRAP_COMPANY_PROVIDER_CATEGORY, PLAY_BOOTSTRAP_CONTACT_FIELDS, PLAY_BOOTSTRAP_FINDER_KINDS, PLAY_BOOTSTRAP_OUTPUT_FIELD_BY_FINDER, PLAY_BOOTSTRAP_PEOPLE_PROVIDER_CATEGORY, PLAY_BOOTSTRAP_PROVIDER_CATEGORY_BY_FINDER, PLAY_BOOTSTRAP_SOURCE_KINDS, PLAY_BOOTSTRAP_STAGE_KINDS, PLAY_BOOTSTRAP_TEMPLATES, PROD_URL, type PlayActivityObservation, type PlayActivityState, type PlayActivityTarget, type PlayAsyncCallOptions, type PlayBindings, type PlayBootstrapEntityKind, type PlayBootstrapFinderKind, type PlayCallExecution, type PlayCallOptions, type PlayCostEstimate, type PlayFetchResponse, type PlayInputContract, type PlayJob, type PlayListItem, type PlayLiveEvent, type PlayReferenceLike, type PlayRevisionSummary, type PlayRunActionPackage, type PlayRunActivityProjection, type PlayRunDatasetActions, type PlayRunId, type PlayRunPackage, type PlayRunResult, type PlayRunStart, type PlaySheetRow, type PlaySheetRowsResult, type PlayStatus, type PlayStepProgramStep, type PlaysListOptions, type PlaysListPage, type PrebuiltPlayRef, type PublishPlayVersionRequest, type PublishPlayVersionResult, RateLimitError, type RerunOptions, type RerunPlayRunResult, type ResolvedConfig, RunObserveTransportUnavailableError, type RunsListOptions, type RunsListPage, type RunsLogsOptions, type RunsLogsResult, type RunsNamespace, type RunsTailOptions, type RuntimeStepOptions, SDK_API_CONTRACT, SDK_VERSION, type SqlListenerDeclaration, type SqlListenerEvent, type SqlListenerOperation, type SqlQuery, type StartPlayRunRequest, type StepOptions, type StepProgram, type StepProgramResolver, type StepResolver, type StopAllCandidate, type StopAllPlayRunsDryRunResult, type StopAllPlayRunsResult, type StopAllPlayRunsStopResult, type StopAllRunsOptions, type StopPlayRunResult, type ToolDefinition, ToolExecuteResult, type ToolExecution, ToolExecutionError, ToolExecutionErrorOptions, type ToolExecutionRequest, type ToolMetadata, ToolRateLimitError, ToolResultBilling, type ToolSearchOptions, type ToolSearchResult, type WorkspaceCreateResult, type WorkspacesNamespace, defineInput, defineMonitor, definePlay, defineWorkflow, extractSummaryFields, formatPlayBootstrapFinderKinds, formatPlayBootstrapFinderKindsForSentence, formatPlayBootstrapTemplates, getDefinedPlayMetadata, isPlayBootstrapFinderKind, isPlayBootstrapTemplate, isStopAllPlayRunsDryRunResult, resolveConfig, runIf, steps, tryConvertToList, writeCsvOutputFile, writeJsonOutputFile };
6595
+ export { type AsyncPlayRunRef, AuthError, type BillingCreditPool, type BillingInvoiceEntry, type BillingInvoicesResult, type BillingNamespace, type BillingPaymentMethodSummary, type BillingSubscriptionCancelResult, type BillingSubscriptionStatus, type BillingTopUpResult, type BillingUsageEvent, type ClearPlayHistoryRequest, type ClearPlayHistoryResult, type ColumnMap, type ColumnResolver, type ConditionalStepResolver, ConfigError, type CreateNotificationGroupInput, type CreateNotificationGroupResult, type CsvInput, type CsvOptions, type CustomerDbQueryResult, DEEPLINE_TOOL_CATEGORIES, type DatasetBuilder, type DatasetColumnDefinition, type DatasetColumnRunInput, type DbNamespace, Deepline, DeeplineClient, type DeeplineClientOptions, DeeplineContext, DeeplineError, type DeeplineNamedPlay, type DeeplinePlayRuntimeContext, type DeeplinePlaysNamespace, type DeeplineToolCategory, type DeeplineToolsNamespace, type DefinePlayConfig, type DefinedPlay, type FetchOptions, type FileInput, type IngestionStorageRepairResult, type LegacyMonitorStatusFilter, type LiveEventEnvelope, MONITOR_JOB_PHASES, MONITOR_JOB_RECONCILIATION_STATES, MONITOR_JOB_STATES, type MonitorBatchNamespace, type MonitorCheckResult, type MonitorDefinition, type MonitorDeleteResult, type MonitorDependents, type MonitorDeployResult, type MonitorDetail, type MonitorFleetDeactivateOptions, MonitorFleetDefinition, type MonitorFleetGetOptions, type MonitorFleetReactivateOptions, type MonitorFleetResult, type MonitorFleetStatus, type MonitorFleetSyncOptions, type MonitorFleetWaitOptions, type MonitorFleetsNamespace, type MonitorJobDeployOptions, type MonitorJobLogsOptions, type MonitorJobPhase, type MonitorJobReconciliationState, type MonitorJobResult, type MonitorJobState, type MonitorJobWaitOptions, type MonitorJobsNamespace, type MonitorListEntry, type MonitorPayload, type MonitorReactivateResult, type MonitorSpec, type MonitorState, type MonitorStateFilter, type MonitorUpdateChangeSummary, type MonitorUpdateResult, type MonitorsAccessStatus, type MonitorsAvailableOptions, type MonitorsAvailableResult, type MonitorsListOptions, type MonitorsListResult, type MonitorsNamespace, PLAY_BOOTSTRAP_COMPANY_FIELDS, PLAY_BOOTSTRAP_COMPANY_PROVIDER_CATEGORY, PLAY_BOOTSTRAP_CONTACT_FIELDS, PLAY_BOOTSTRAP_FINDER_KINDS, PLAY_BOOTSTRAP_OUTPUT_FIELD_BY_FINDER, PLAY_BOOTSTRAP_PEOPLE_PROVIDER_CATEGORY, PLAY_BOOTSTRAP_PROVIDER_CATEGORY_BY_FINDER, PLAY_BOOTSTRAP_SOURCE_KINDS, PLAY_BOOTSTRAP_STAGE_KINDS, PLAY_BOOTSTRAP_TEMPLATES, PROD_URL, type PlayActivityObservation, type PlayActivityState, type PlayActivityTarget, type PlayAsyncCallOptions, type PlayBindings, type PlayBootstrapEntityKind, type PlayBootstrapFinderKind, type PlayCallExecution, type PlayCallOptions, type PlayCostEstimate, type PlayFetchResponse, type PlayInputContract, type PlayJob, type PlayListItem, type PlayLiveEvent, type PlayReferenceLike, type PlayRevisionSummary, type PlayRunActionPackage, type PlayRunActivityProjection, type PlayRunDatasetActions, type PlayRunId, type PlayRunPackage, type PlayRunResult, type PlayRunStart, type PlaySheetRow, type PlaySheetRowsResult, type PlayStatus, type PlayStepProgramStep, type PlaysListOptions, type PlaysListPage, type PrebuiltPlayRef, type PublishPlayVersionRequest, type PublishPlayVersionResult, RateLimitError, type RerunOptions, type RerunPlayRunResult, type ResolvedConfig, RunObserveTransportUnavailableError, type RunsListOptions, type RunsListPage, type RunsLogsOptions, type RunsLogsResult, type RunsNamespace, type RunsTailOptions, type RuntimeStepOptions, SDK_API_CONTRACT, SDK_VERSION, type SqlListenerDeclaration, type SqlListenerEvent, type SqlListenerOperation, type SqlQuery, type StartPlayRunRequest, type StepOptions, type StepProgram, type StepProgramResolver, type StepResolver, type StopAllCandidate, type StopAllPlayRunsDryRunResult, type StopAllPlayRunsResult, type StopAllPlayRunsStopResult, type StopAllRunsOptions, type StopPlayRunResult, type ToolDefinition, ToolExecuteResult, type ToolExecution, ToolExecutionError, ToolExecutionErrorOptions, type ToolExecutionRequest, type ToolMetadata, ToolRateLimitError, ToolResultBilling, type ToolSearchOptions, type ToolSearchResult, type WorkspaceCreateResult, type WorkspacesNamespace, defineInput, defineMonitor, definePlay, defineWorkflow, extractSummaryFields, formatPlayBootstrapFinderKinds, formatPlayBootstrapFinderKindsForSentence, formatPlayBootstrapTemplates, getDefinedPlayMetadata, isPlayBootstrapFinderKind, isPlayBootstrapTemplate, isStopAllPlayRunsDryRunResult, resolveConfig, runIf, steps, tryConvertToList, writeCsvOutputFile, writeJsonOutputFile };
package/dist/index.js CHANGED
@@ -864,7 +864,7 @@ var SDK_RELEASE = {
864
864
  // getters keep their established compatibility behavior.
865
865
  // 0.3.1 deprecated the legacy `deepline enrich` command in favor of Plays.
866
866
  // 0.3.90 is the first deliberately versioned SDK release for API v3.
867
- version: "0.3.144",
867
+ version: "0.3.145",
868
868
  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.",
869
869
  packageCapabilities: {
870
870
  updatePreferences: 1
@@ -4774,6 +4774,7 @@ var DeeplineClient = class _DeeplineClient {
4774
4774
  invoices: {
4775
4775
  list: (options2) => this.listBillingInvoices(options2)
4776
4776
  },
4777
+ usageEvent: (requestId) => this.getBillingUsageEvent(requestId),
4777
4778
  targetPlans: () => this.getTargetBillingPlans(),
4778
4779
  targetStatus: () => this.getTargetBillingStatus(),
4779
4780
  autoRecharge: {
@@ -7145,6 +7146,33 @@ var DeeplineClient = class _DeeplineClient {
7145
7146
  async getBillingPlans() {
7146
7147
  return this.http.get("/api/v2/billing/catalog/current");
7147
7148
  }
7149
+ /**
7150
+ * Read the authenticated usage record for one execution request. The
7151
+ * request id comes from the original `executeTool` result and is not a
7152
+ * retry or idempotency token.
7153
+ */
7154
+ async getBillingUsageEvent(requestId) {
7155
+ const normalizedRequestId = requestId.trim();
7156
+ if (normalizedRequestId.length === 0 || normalizedRequestId.length > 200 || normalizedRequestId !== requestId) {
7157
+ throw new DeeplineError(
7158
+ "Usage request_id must contain 1\u2013200 characters with no leading or trailing whitespace.",
7159
+ void 0,
7160
+ "INVALID_USAGE_REQUEST_ID"
7161
+ );
7162
+ }
7163
+ const response = await this.http.get(
7164
+ `/api/v2/usage/events?request_id=${encodeURIComponent(normalizedRequestId)}`
7165
+ );
7166
+ const event = response.entries?.[0];
7167
+ if (!event) {
7168
+ throw new DeeplineError(
7169
+ "No usage event was found for this request_id.",
7170
+ void 0,
7171
+ "USAGE_EVENT_NOT_FOUND"
7172
+ );
7173
+ }
7174
+ return event;
7175
+ }
7148
7176
  /**
7149
7177
  * Charge the saved payment method and add Deepline credits to the active
7150
7178
  * workspace. Prefer `client.billing.topUp(...)`.
@@ -8844,6 +8872,17 @@ function findFirstTargetByPath(result, paths) {
8844
8872
  }
8845
8873
  return null;
8846
8874
  }
8875
+ function findFirstExplicitNullTargetByPath(result, paths) {
8876
+ for (const path of paths ?? []) {
8877
+ for (const candidate of candidateResultPaths(path)) {
8878
+ const explicitNull = valuesAtSegments(result, parsePath(candidate)).find(
8879
+ (entry) => entry.value === null
8880
+ );
8881
+ if (explicitNull) return { value: null, path: explicitNull.path };
8882
+ }
8883
+ }
8884
+ return null;
8885
+ }
8847
8886
  function firstValueForPaths(result, paths) {
8848
8887
  return findFirstTargetByPath(result, paths);
8849
8888
  }
@@ -9103,7 +9142,11 @@ function buildTargets(result, extractors, targetGetters) {
9103
9142
  continue;
9104
9143
  }
9105
9144
  const fromExtractor = findFirstTargetByPath(result, descriptor.paths);
9106
- if (!fromExtractor) continue;
9145
+ if (!fromExtractor) {
9146
+ const explicitNull = isSemanticStatus ? null : findFirstExplicitNullTargetByPath(result, descriptor.paths);
9147
+ if (explicitNull) targets[target] = explicitNull;
9148
+ continue;
9149
+ }
9107
9150
  const transformed = coerceToEnum(
9108
9151
  applyExtractorTransforms(fromExtractor.value, descriptor),
9109
9152
  descriptor
@@ -9126,6 +9169,14 @@ function buildTargets(result, extractors, targetGetters) {
9126
9169
  targets[target] = fromMetadata;
9127
9170
  continue;
9128
9171
  }
9172
+ const explicitNull = findFirstExplicitNullTargetByPath(
9173
+ result,
9174
+ targetGetters?.[target]
9175
+ );
9176
+ if (explicitNull) {
9177
+ targets[target] = explicitNull;
9178
+ continue;
9179
+ }
9129
9180
  const fallback = findFirstTargetByKey(result, target);
9130
9181
  if (fallback) {
9131
9182
  targets[target] = fallback;
@@ -9133,6 +9184,7 @@ function buildTargets(result, extractors, targetGetters) {
9133
9184
  }
9134
9185
  if (metadataTargets.size === 0) {
9135
9186
  for (const target of ["email", "phone", "linkedin", "domain", "status"]) {
9187
+ if (targets[target]) continue;
9136
9188
  const found = findFirstTargetByKey(result, target);
9137
9189
  if (found) targets[target] = found;
9138
9190
  }
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.145",
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
@@ -4678,6 +4678,7 @@ var DeeplineClient = class _DeeplineClient {
4678
4678
  invoices: {
4679
4679
  list: (options2) => this.listBillingInvoices(options2)
4680
4680
  },
4681
+ usageEvent: (requestId) => this.getBillingUsageEvent(requestId),
4681
4682
  targetPlans: () => this.getTargetBillingPlans(),
4682
4683
  targetStatus: () => this.getTargetBillingStatus(),
4683
4684
  autoRecharge: {
@@ -7049,6 +7050,33 @@ var DeeplineClient = class _DeeplineClient {
7049
7050
  async getBillingPlans() {
7050
7051
  return this.http.get("/api/v2/billing/catalog/current");
7051
7052
  }
7053
+ /**
7054
+ * Read the authenticated usage record for one execution request. The
7055
+ * request id comes from the original `executeTool` result and is not a
7056
+ * retry or idempotency token.
7057
+ */
7058
+ async getBillingUsageEvent(requestId) {
7059
+ const normalizedRequestId = requestId.trim();
7060
+ if (normalizedRequestId.length === 0 || normalizedRequestId.length > 200 || normalizedRequestId !== requestId) {
7061
+ throw new DeeplineError(
7062
+ "Usage request_id must contain 1\u2013200 characters with no leading or trailing whitespace.",
7063
+ void 0,
7064
+ "INVALID_USAGE_REQUEST_ID"
7065
+ );
7066
+ }
7067
+ const response = await this.http.get(
7068
+ `/api/v2/usage/events?request_id=${encodeURIComponent(normalizedRequestId)}`
7069
+ );
7070
+ const event = response.entries?.[0];
7071
+ if (!event) {
7072
+ throw new DeeplineError(
7073
+ "No usage event was found for this request_id.",
7074
+ void 0,
7075
+ "USAGE_EVENT_NOT_FOUND"
7076
+ );
7077
+ }
7078
+ return event;
7079
+ }
7052
7080
  /**
7053
7081
  * Charge the saved payment method and add Deepline credits to the active
7054
7082
  * workspace. Prefer `client.billing.topUp(...)`.
@@ -8748,6 +8776,17 @@ function findFirstTargetByPath(result, paths) {
8748
8776
  }
8749
8777
  return null;
8750
8778
  }
8779
+ function findFirstExplicitNullTargetByPath(result, paths) {
8780
+ for (const path of paths ?? []) {
8781
+ for (const candidate of candidateResultPaths(path)) {
8782
+ const explicitNull = valuesAtSegments(result, parsePath(candidate)).find(
8783
+ (entry) => entry.value === null
8784
+ );
8785
+ if (explicitNull) return { value: null, path: explicitNull.path };
8786
+ }
8787
+ }
8788
+ return null;
8789
+ }
8751
8790
  function firstValueForPaths(result, paths) {
8752
8791
  return findFirstTargetByPath(result, paths);
8753
8792
  }
@@ -9007,7 +9046,11 @@ function buildTargets(result, extractors, targetGetters) {
9007
9046
  continue;
9008
9047
  }
9009
9048
  const fromExtractor = findFirstTargetByPath(result, descriptor.paths);
9010
- if (!fromExtractor) continue;
9049
+ if (!fromExtractor) {
9050
+ const explicitNull = isSemanticStatus ? null : findFirstExplicitNullTargetByPath(result, descriptor.paths);
9051
+ if (explicitNull) targets[target] = explicitNull;
9052
+ continue;
9053
+ }
9011
9054
  const transformed = coerceToEnum(
9012
9055
  applyExtractorTransforms(fromExtractor.value, descriptor),
9013
9056
  descriptor
@@ -9030,6 +9073,14 @@ function buildTargets(result, extractors, targetGetters) {
9030
9073
  targets[target] = fromMetadata;
9031
9074
  continue;
9032
9075
  }
9076
+ const explicitNull = findFirstExplicitNullTargetByPath(
9077
+ result,
9078
+ targetGetters?.[target]
9079
+ );
9080
+ if (explicitNull) {
9081
+ targets[target] = explicitNull;
9082
+ continue;
9083
+ }
9033
9084
  const fallback = findFirstTargetByKey(result, target);
9034
9085
  if (fallback) {
9035
9086
  targets[target] = fallback;
@@ -9037,6 +9088,7 @@ function buildTargets(result, extractors, targetGetters) {
9037
9088
  }
9038
9089
  if (metadataTargets.size === 0) {
9039
9090
  for (const target of ["email", "phone", "linkedin", "domain", "status"]) {
9091
+ if (targets[target]) continue;
9040
9092
  const found = findFirstTargetByKey(result, target);
9041
9093
  if (found) targets[target] = found;
9042
9094
  }
@@ -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.145";
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.145";
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.145",
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.145",
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.145",
4
4
  "description": "GTM data CLI and TypeScript SDK for coding agents",
5
5
  "license": "MIT",
6
6
  "homepage": "https://code.deepline.com",