deepline 0.1.193 → 0.1.195

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.
@@ -494,6 +494,29 @@ export type BillingInvoicesResult = {
494
494
  entries: BillingInvoiceEntry[];
495
495
  };
496
496
 
497
+ /** Saved payment method details returned by one-click billing top-up. */
498
+ export type BillingPaymentMethodSummary = {
499
+ brand?: string | null;
500
+ last4?: string | null;
501
+ exp_month?: number | null;
502
+ exp_year?: number | null;
503
+ label?: string | null;
504
+ };
505
+
506
+ /**
507
+ * Result of `POST /api/v2/billing/top-up`: a saved-card charge and purchased
508
+ * Deepline credit grant for the active workspace.
509
+ */
510
+ export type BillingTopUpResult = {
511
+ ok: true;
512
+ credits: number;
513
+ amount_cents: number;
514
+ currency: string;
515
+ balance: number;
516
+ stripe_payment_intent_id: string;
517
+ payment_method?: BillingPaymentMethodSummary | null;
518
+ };
519
+
497
520
  /** One published plan from `GET /api/v2/billing/catalog/current`. */
498
521
  export type BillingPlanEntry = {
499
522
  plan_family_id: string;
@@ -553,6 +576,11 @@ export type BillingPlansResult = {
553
576
  * @sdkReference client 030 client.billing
554
577
  */
555
578
  export type BillingNamespace = {
579
+ /** Charge the saved payment method and add Deepline credits to the active workspace. */
580
+ topUp: (options: {
581
+ credits: number;
582
+ idempotencyKey?: string;
583
+ }) => Promise<BillingTopUpResult>;
556
584
  /** Published plans plus the plan you are on ("what plans exist and what am I on"). */
557
585
  plans: () => Promise<BillingPlansResult>;
558
586
  subscription: {
@@ -701,7 +729,10 @@ const STAGE_LEGACY_MULTIPART_MAX_BYTES = 4_000_000;
701
729
 
702
730
  const STAGE_DIRECT_UPLOAD_MAX_ATTEMPTS = 3;
703
731
 
704
- function stagedUploadIdentity(logicalPath: string, contentHash: string): string {
732
+ function stagedUploadIdentity(
733
+ logicalPath: string,
734
+ contentHash: string,
735
+ ): string {
705
736
  return `${contentHash}:${logicalPath}`;
706
737
  }
707
738
 
@@ -1021,6 +1052,7 @@ export class DeeplineClient {
1021
1052
  stopAll: (options) => this.stopAllRuns(options),
1022
1053
  };
1023
1054
  this.billing = {
1055
+ topUp: (options) => this.topUpBillingBalance(options),
1024
1056
  plans: () => this.getBillingPlans(),
1025
1057
  subscription: {
1026
1058
  status: () => this.getBillingSubscriptionStatus(),
@@ -3251,6 +3283,34 @@ export class DeeplineClient {
3251
3283
  return this.http.get<BillingPlansResult>('/api/v2/billing/catalog/current');
3252
3284
  }
3253
3285
 
3286
+ /**
3287
+ * Charge the saved payment method and add Deepline credits to the active
3288
+ * workspace. Prefer `client.billing.topUp(...)`.
3289
+ *
3290
+ * @throws {@link DeeplineError} with `statusCode: 409` when checkout is
3291
+ * required because the workspace has no saved payment method or the card
3292
+ * requires confirmation.
3293
+ */
3294
+ async topUpBillingBalance(options: {
3295
+ credits: number;
3296
+ idempotencyKey?: string;
3297
+ }): Promise<BillingTopUpResult> {
3298
+ return this.http.post<BillingTopUpResult>(
3299
+ '/api/v2/billing/top-up',
3300
+ {
3301
+ credits: options.credits,
3302
+ ...(options.idempotencyKey
3303
+ ? { idempotency_key: options.idempotencyKey }
3304
+ : {}),
3305
+ },
3306
+ undefined,
3307
+ // The idempotency key makes a retry at the product layer safe, but the
3308
+ // CLI should not hide ambiguous local delivery failures behind implicit
3309
+ // transport retries for a payment mutation.
3310
+ { maxRetries: 0, exactUrlOnly: true },
3311
+ );
3312
+ }
3313
+
3254
3314
  /**
3255
3315
  * Subscription state for the active workspace: active plan, whether a
3256
3316
  * Stripe subscription backs it, renewal/cancellation facts, and remaining
@@ -62,8 +62,10 @@ export type {
62
62
  BillingInvoiceEntry,
63
63
  BillingInvoicesResult,
64
64
  BillingNamespace,
65
+ BillingPaymentMethodSummary,
65
66
  BillingSubscriptionCancelResult,
66
67
  BillingSubscriptionStatus,
68
+ BillingTopUpResult,
67
69
  PlayStatus,
68
70
  PlaySheetRow,
69
71
  PlaySheetRowsResult,
@@ -105,10 +105,10 @@ export const SDK_RELEASE = {
105
105
  // 0.1.154 removes the short-lived generated enrich StepOptions recompute
106
106
  // fields shipped in 0.1.153.
107
107
  // 0.1.175 ships loud `deepline enrich` empty-waterfall reporting.
108
- version: '0.1.193',
108
+ version: '0.1.195',
109
109
  apiContract: '2026-06-dataset-handle-results-hard-cutover',
110
110
  supportPolicy: {
111
- latest: '0.1.193',
111
+ latest: '0.1.195',
112
112
  minimumSupported: '0.1.53',
113
113
  deprecatedBelow: '0.1.53',
114
114
  commandMinimumSupported: [
@@ -2,6 +2,8 @@ const CLOUDFLARE_DURABLE_OBJECT_RESET_RE =
2
2
  /Durable Object.*(?:code (?:was|has been) updated|storage caused object)/;
3
3
  const CLOUDFLARE_WORKER_SUBREQUEST_LIMIT_RE =
4
4
  /Too many subrequests by single Worker invocation/i;
5
+ const VERCEL_RUNTIME_API_DEPLOYMENT_MISSING_RE =
6
+ /runtime API 404:[\s\S]*(?:DeploymentNotFound|DEPLOYMENT_NOT_FOUND|requested deployment .*exist|deployment could not be found on Vercel)/i;
5
7
 
6
8
  export const PLATFORM_DEPLOY_INTERRUPTED_MESSAGE =
7
9
  'Run interrupted by a platform deploy. Deepline retries this automatically when possible; if this error is still visible, re-run the same command.';
@@ -68,6 +70,15 @@ export function normalizePlayRunFailure(error: unknown): PlayRunFailureDetails {
68
70
  cause,
69
71
  };
70
72
  }
73
+ if (VERCEL_RUNTIME_API_DEPLOYMENT_MISSING_RE.test(cause)) {
74
+ return {
75
+ code: 'PLATFORM_DEPLOY_INTERRUPTED',
76
+ phase: 'runtime',
77
+ message: PLATFORM_DEPLOY_INTERRUPTED_MESSAGE,
78
+ retryable: true,
79
+ cause,
80
+ };
81
+ }
71
82
  if (CLOUDFLARE_WORKER_SUBREQUEST_LIMIT_RE.test(cause)) {
72
83
  return {
73
84
  code: 'PLATFORM_WORKER_SUBREQUEST_INTERRUPTED',