deepline 0.2.12 → 0.2.14

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 +159 -3
  2. package/dist/bundling-sources/sdk/src/index.ts +3 -0
  3. package/dist/bundling-sources/sdk/src/play.ts +150 -691
  4. package/dist/bundling-sources/sdk/src/release.ts +1 -1
  5. package/dist/bundling-sources/shared_libs/play-runtime/child-execution-strategy.ts +7 -1
  6. package/dist/bundling-sources/shared_libs/play-runtime/context.ts +319 -138
  7. package/dist/bundling-sources/shared_libs/play-runtime/csv-rename.ts +10 -6
  8. package/dist/bundling-sources/shared_libs/play-runtime/ctx-types.ts +34 -52
  9. package/dist/bundling-sources/shared_libs/play-runtime/durable-call-cache.ts +11 -22
  10. package/dist/bundling-sources/shared_libs/play-runtime/durable-call-policy.ts +34 -0
  11. package/dist/bundling-sources/shared_libs/play-runtime/play-call-execution.ts +2 -1
  12. package/dist/bundling-sources/shared_libs/play-runtime/run-ledger-projection-contract.ts +95 -0
  13. package/dist/bundling-sources/shared_libs/play-runtime/runtime-actions.ts +2 -1
  14. package/dist/bundling-sources/shared_libs/play-runtime/runtime-api.ts +24 -7
  15. package/dist/bundling-sources/shared_libs/play-runtime/runtime-contract.ts +8 -1
  16. package/dist/bundling-sources/shared_libs/play-runtime/runtime-receipt-store-adapter.ts +7 -4
  17. package/dist/bundling-sources/shared_libs/play-runtime/secret-capability.ts +23 -15
  18. package/dist/bundling-sources/shared_libs/plays/artifact-types.ts +3 -0
  19. package/dist/bundling-sources/shared_libs/plays/authoring-contract.ts +2222 -0
  20. package/dist/bundling-sources/shared_libs/plays/bundling/index.ts +3 -2
  21. package/dist/bundling-sources/shared_libs/plays/compiler-manifest.ts +2 -0
  22. package/dist/bundling-sources/shared_libs/plays/contracts.ts +16 -0
  23. package/dist/bundling-sources/shared_libs/plays/input-contract-definition.ts +28 -0
  24. package/dist/bundling-sources/shared_libs/plays/input-contract.ts +3 -3
  25. package/dist/cli/index.js +5231 -830
  26. package/dist/cli/index.mjs +5178 -762
  27. package/dist/compiler-manifest-xFkbJX2B.d.mts +2517 -0
  28. package/dist/compiler-manifest-xFkbJX2B.d.ts +2517 -0
  29. package/dist/index.d.mts +126 -1014
  30. package/dist/index.d.ts +126 -1014
  31. package/dist/index.js +88 -8
  32. package/dist/index.mjs +88 -8
  33. package/dist/plays/bundle-play-file.d.mts +5 -8
  34. package/dist/plays/bundle-play-file.d.ts +5 -8
  35. package/dist/plays/bundle-play-file.mjs +3844 -3
  36. package/package.json +1 -1
  37. package/dist/bundling-sources/shared_libs/plays/source-metadata.ts +0 -240
  38. package/dist/tool-execution-error-4-rhemLQ.d.mts +0 -446
  39. package/dist/tool-execution-error-4-rhemLQ.d.ts +0 -446
@@ -902,6 +902,66 @@ export type BillingInvoicesResult = {
902
902
  entries: BillingInvoiceEntry[];
903
903
  };
904
904
 
905
+ export type TargetBillingOperation = {
906
+ id: string;
907
+ state: string;
908
+ version: number;
909
+ next_action?: string | null;
910
+ };
911
+
912
+ export type TargetBillingPlan = {
913
+ sku: 'payg-v1' | 'builder-v1' | 'team-v1';
914
+ name: string;
915
+ recurring_price_usd: number;
916
+ interval: 'month';
917
+ included_credits: number;
918
+ purchased_credit_price_usd: number;
919
+ };
920
+
921
+ export type TargetBillingPlansResult = {
922
+ org_id: string;
923
+ plans: TargetBillingPlan[];
924
+ current_plan_sku: string;
925
+ pending_plan_sku: string | null;
926
+ acquisition_enabled: boolean;
927
+ };
928
+
929
+ export type TargetBillingStatusResult = {
930
+ org_id: string;
931
+ plan: {
932
+ sku: string;
933
+ name: string;
934
+ recurring_price_usd: number | null;
935
+ interval: string | null;
936
+ included_credits: number | null;
937
+ };
938
+ state: string;
939
+ changes_allowed: boolean;
940
+ payment_state: string;
941
+ recharge_state: string;
942
+ next_action: string | null;
943
+ pending_plan_sku: string | null;
944
+ as_of: string | null;
945
+ };
946
+
947
+ export type TargetBillingMutationResult = {
948
+ data: Record<string, unknown>;
949
+ operation: TargetBillingOperation;
950
+ request_id?: string;
951
+ };
952
+
953
+ export type TargetBillingPlanTransitionOptions =
954
+ | {
955
+ action: 'start_or_change';
956
+ targetPlanSku: 'payg-v1' | 'builder-v1' | 'team-v1';
957
+ idempotencyKey: string;
958
+ }
959
+ | {
960
+ action: 'cancel' | 'undo_cancel';
961
+ targetPlanSku?: never;
962
+ idempotencyKey: string;
963
+ };
964
+
905
965
  /** Saved payment method details returned by one-click billing top-up. */
906
966
  export type BillingPaymentMethodSummary = {
907
967
  brand?: string | null;
@@ -977,9 +1037,8 @@ export type BillingPlansResult = {
977
1037
  /**
978
1038
  * Public billing namespace exposed as `client.billing`.
979
1039
  *
980
- * Carries the durable Deepline billing product model — plans, subscription
981
- * state, period-end cancellation, and invoice/receipt history so CLI
982
- * commands and programmatic callers share the same surface.
1040
+ * Carries plans, subscription state, cancellation, and invoice/receipt history
1041
+ * so CLI commands and programmatic callers share one surface.
983
1042
  *
984
1043
  * @sdkReference client 030 client.billing
985
1044
  */
@@ -1006,8 +1065,39 @@ export type BillingNamespace = {
1006
1065
  /** Subscription invoices plus credit purchase receipts, newest first. */
1007
1066
  list: (options?: { limit?: number }) => Promise<BillingInvoicesResult>;
1008
1067
  };
1068
+ /** Metronome-authored target catalog and current Contract projection. */
1069
+ targetPlans: () => Promise<TargetBillingPlansResult>;
1070
+ /** Normalized target billing state. */
1071
+ targetStatus: () => Promise<TargetBillingStatusResult>;
1072
+ /** Buy Deepline credits through a payment-gated Metronome commit. */
1073
+ purchaseCredits: (options: {
1074
+ credits: number;
1075
+ idempotencyKey: string;
1076
+ }) => Promise<TargetBillingMutationResult>;
1077
+ /** Start, change, cancel, or undo a target plan transition. */
1078
+ transitionPlan: (
1079
+ options: TargetBillingPlanTransitionOptions,
1080
+ ) => Promise<TargetBillingMutationResult>;
1081
+ /** Create a Stripe-hosted billing Portal session. */
1082
+ portalSession: () => Promise<{ url: string }>;
1009
1083
  };
1010
1084
 
1085
+ function requireTargetBillingIdempotencyKey(value: string): string {
1086
+ const normalized = value.trim();
1087
+ if (
1088
+ normalized.length === 0 ||
1089
+ normalized.length > 200 ||
1090
+ normalized !== value
1091
+ ) {
1092
+ throw new DeeplineError(
1093
+ 'Billing idempotencyKey must contain 1–200 characters with no leading or trailing whitespace.',
1094
+ undefined,
1095
+ 'INVALID_BILLING_IDEMPOTENCY_KEY',
1096
+ );
1097
+ }
1098
+ return normalized;
1099
+ }
1100
+
1011
1101
  function isRecord(value: unknown): value is Record<string, unknown> {
1012
1102
  return Boolean(value && typeof value === 'object' && !Array.isArray(value));
1013
1103
  }
@@ -1495,6 +1585,11 @@ export class DeeplineClient {
1495
1585
  invoices: {
1496
1586
  list: (options) => this.listBillingInvoices(options),
1497
1587
  },
1588
+ targetPlans: () => this.getTargetBillingPlans(),
1589
+ targetStatus: () => this.getTargetBillingStatus(),
1590
+ purchaseCredits: (options) => this.purchaseTargetBillingCredits(options),
1591
+ transitionPlan: (options) => this.transitionTargetBillingPlan(options),
1592
+ portalSession: () => this.createTargetBillingPortalSession(),
1498
1593
  };
1499
1594
  this.monitors = {
1500
1595
  status: () => this.getMonitorsAccess(),
@@ -4016,6 +4111,67 @@ export class DeeplineClient {
4016
4111
  );
4017
4112
  }
4018
4113
 
4114
+ /** List the reviewed target plans and whether new acquisition is enabled. */
4115
+ async getTargetBillingPlans(): Promise<TargetBillingPlansResult> {
4116
+ return this.http.get<TargetBillingPlansResult>('/api/v2/billing/plans');
4117
+ }
4118
+
4119
+ /** Read the workspace's normalized target plan, payment, and balance state. */
4120
+ async getTargetBillingStatus(): Promise<TargetBillingStatusResult> {
4121
+ return this.http.get<TargetBillingStatusResult>('/api/v2/billing/status');
4122
+ }
4123
+
4124
+ /**
4125
+ * Purchase target-billing credits through the durable commercial operation
4126
+ * flow. The caller supplies an idempotency key for safe retries.
4127
+ */
4128
+ async purchaseTargetBillingCredits(options: {
4129
+ credits: number;
4130
+ idempotencyKey: string;
4131
+ }): Promise<TargetBillingMutationResult> {
4132
+ const idempotencyKey = requireTargetBillingIdempotencyKey(
4133
+ options.idempotencyKey,
4134
+ );
4135
+ return this.http.post<TargetBillingMutationResult>(
4136
+ '/api/v2/billing/credit-purchases',
4137
+ { credits: options.credits },
4138
+ { 'Idempotency-Key': idempotencyKey },
4139
+ { maxRetries: 0, exactUrlOnly: true },
4140
+ );
4141
+ }
4142
+
4143
+ /**
4144
+ * Start, change, cancel, or restore a target plan through one idempotent
4145
+ * commercial operation.
4146
+ */
4147
+ async transitionTargetBillingPlan(
4148
+ options: TargetBillingPlanTransitionOptions,
4149
+ ): Promise<TargetBillingMutationResult> {
4150
+ const idempotencyKey = requireTargetBillingIdempotencyKey(
4151
+ options.idempotencyKey,
4152
+ );
4153
+ return this.http.post<TargetBillingMutationResult>(
4154
+ '/api/v2/billing/plan-transitions',
4155
+ {
4156
+ action: options.action,
4157
+ ...(options.targetPlanSku
4158
+ ? { target_plan_sku: options.targetPlanSku }
4159
+ : {}),
4160
+ },
4161
+ { 'Idempotency-Key': idempotencyKey },
4162
+ { maxRetries: 0, exactUrlOnly: true },
4163
+ );
4164
+ }
4165
+
4166
+ /** Create a Stripe-hosted portal session for payment recovery and invoices. */
4167
+ async createTargetBillingPortalSession(): Promise<{ url: string }> {
4168
+ const response = await this.http.post<{
4169
+ data: { url: string };
4170
+ request_id?: string;
4171
+ }>('/api/v2/billing/portal-sessions', {});
4172
+ return response.data;
4173
+ }
4174
+
4019
4175
  // ——————————————————————————————————————————————————————————
4020
4176
  // Monitors
4021
4177
  // ——————————————————————————————————————————————————————————
@@ -230,6 +230,9 @@ export type {
230
230
  PlayDatasetInput,
231
231
  PlayCallExecution,
232
232
  PlayCallOptions,
233
+ PlayFetchResponse,
234
+ RuntimeStepOptions,
235
+ FetchOptions,
233
236
  PlayStepProgramStep,
234
237
  PrebuiltPlayRef,
235
238
  StepOptions,