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
package/dist/index.js CHANGED
@@ -763,7 +763,7 @@ var SDK_RELEASE = {
763
763
  // 0.2.0 makes Dataset Handles uniformly async-only after 0.1.320 briefly
764
764
  // exposed storage-dependent synchronous access. This deliberate minor
765
765
  // release keeps lazy paging semantics independent of row residency.
766
- version: "0.2.12",
766
+ version: "0.2.14",
767
767
  contracts: {
768
768
  api: {
769
769
  name: "sdk-http-api",
@@ -3229,6 +3229,17 @@ function resolveToolExecuteTimeoutMs(toolId, input) {
3229
3229
  }
3230
3230
  var RUNS_FAILED_LOG_LIMIT = 20;
3231
3231
  var RUN_LOGS_PAGE_LIMIT = 1e3;
3232
+ function requireTargetBillingIdempotencyKey(value) {
3233
+ const normalized = value.trim();
3234
+ if (normalized.length === 0 || normalized.length > 200 || normalized !== value) {
3235
+ throw new DeeplineError(
3236
+ "Billing idempotencyKey must contain 1\u2013200 characters with no leading or trailing whitespace.",
3237
+ void 0,
3238
+ "INVALID_BILLING_IDEMPOTENCY_KEY"
3239
+ );
3240
+ }
3241
+ return normalized;
3242
+ }
3232
3243
  function isRecord6(value) {
3233
3244
  return Boolean(value && typeof value === "object" && !Array.isArray(value));
3234
3245
  }
@@ -3499,7 +3510,12 @@ var DeeplineClient = class {
3499
3510
  },
3500
3511
  invoices: {
3501
3512
  list: (options2) => this.listBillingInvoices(options2)
3502
- }
3513
+ },
3514
+ targetPlans: () => this.getTargetBillingPlans(),
3515
+ targetStatus: () => this.getTargetBillingStatus(),
3516
+ purchaseCredits: (options2) => this.purchaseTargetBillingCredits(options2),
3517
+ transitionPlan: (options2) => this.transitionTargetBillingPlan(options2),
3518
+ portalSession: () => this.createTargetBillingPortalSession()
3503
3519
  };
3504
3520
  this.monitors = {
3505
3521
  status: () => this.getMonitorsAccess(),
@@ -5413,6 +5429,52 @@ var DeeplineClient = class {
5413
5429
  `/api/v2/billing/invoices${suffix}`
5414
5430
  );
5415
5431
  }
5432
+ /** List the reviewed target plans and whether new acquisition is enabled. */
5433
+ async getTargetBillingPlans() {
5434
+ return this.http.get("/api/v2/billing/plans");
5435
+ }
5436
+ /** Read the workspace's normalized target plan, payment, and balance state. */
5437
+ async getTargetBillingStatus() {
5438
+ return this.http.get("/api/v2/billing/status");
5439
+ }
5440
+ /**
5441
+ * Purchase target-billing credits through the durable commercial operation
5442
+ * flow. The caller supplies an idempotency key for safe retries.
5443
+ */
5444
+ async purchaseTargetBillingCredits(options) {
5445
+ const idempotencyKey = requireTargetBillingIdempotencyKey(
5446
+ options.idempotencyKey
5447
+ );
5448
+ return this.http.post(
5449
+ "/api/v2/billing/credit-purchases",
5450
+ { credits: options.credits },
5451
+ { "Idempotency-Key": idempotencyKey },
5452
+ { maxRetries: 0, exactUrlOnly: true }
5453
+ );
5454
+ }
5455
+ /**
5456
+ * Start, change, cancel, or restore a target plan through one idempotent
5457
+ * commercial operation.
5458
+ */
5459
+ async transitionTargetBillingPlan(options) {
5460
+ const idempotencyKey = requireTargetBillingIdempotencyKey(
5461
+ options.idempotencyKey
5462
+ );
5463
+ return this.http.post(
5464
+ "/api/v2/billing/plan-transitions",
5465
+ {
5466
+ action: options.action,
5467
+ ...options.targetPlanSku ? { target_plan_sku: options.targetPlanSku } : {}
5468
+ },
5469
+ { "Idempotency-Key": idempotencyKey },
5470
+ { maxRetries: 0, exactUrlOnly: true }
5471
+ );
5472
+ }
5473
+ /** Create a Stripe-hosted portal session for payment recovery and invoices. */
5474
+ async createTargetBillingPortalSession() {
5475
+ const response = await this.http.post("/api/v2/billing/portal-sessions", {});
5476
+ return response.data;
5477
+ }
5416
5478
  // ——————————————————————————————————————————————————————————
5417
5479
  // Monitors
5418
5480
  // ——————————————————————————————————————————————————————————
@@ -7123,6 +7185,29 @@ function isQueryResultDatasetTool(toolId) {
7123
7185
  return isCustomerDbDatasetTool(toolId) || isSnowflakeQueryDatasetTool(toolId);
7124
7186
  }
7125
7187
 
7188
+ // ../shared_libs/plays/input-contract-definition.ts
7189
+ function freezeInputSchema(schema) {
7190
+ const visited = /* @__PURE__ */ new WeakSet();
7191
+ const freeze = (value) => {
7192
+ if (value === null || typeof value !== "object" || visited.has(value)) {
7193
+ return;
7194
+ }
7195
+ visited.add(value);
7196
+ for (const child of Object.values(value)) freeze(child);
7197
+ Object.freeze(value);
7198
+ };
7199
+ freeze(schema);
7200
+ return schema;
7201
+ }
7202
+ function createPlayInputContract(schema) {
7203
+ if (!schema || typeof schema !== "object" || Array.isArray(schema)) {
7204
+ throw new Error(
7205
+ "defineInput<T>(schema) requires a JSON-schema-like object."
7206
+ );
7207
+ }
7208
+ return Object.freeze({ schema: freezeInputSchema(schema) });
7209
+ }
7210
+
7126
7211
  // src/play.ts
7127
7212
  var DeeplineConditionalStepResolver = class _DeeplineConditionalStepResolver {
7128
7213
  constructor(when, run, elseValue) {
@@ -7641,12 +7726,7 @@ function toolExecutionEnvelopeToResult(fallbackToolId, response, options) {
7641
7726
  );
7642
7727
  }
7643
7728
  function defineInput(schema) {
7644
- if (!schema || typeof schema !== "object" || Array.isArray(schema)) {
7645
- throw new Error(
7646
- "defineInput<T>(schema) requires a JSON-schema-like object."
7647
- );
7648
- }
7649
- return { schema };
7729
+ return createPlayInputContract(schema);
7650
7730
  }
7651
7731
  function definePlay(nameOrConfig, maybeFn, maybeBindings) {
7652
7732
  const config = typeof nameOrConfig === "string" ? {
package/dist/index.mjs CHANGED
@@ -689,7 +689,7 @@ var SDK_RELEASE = {
689
689
  // 0.2.0 makes Dataset Handles uniformly async-only after 0.1.320 briefly
690
690
  // exposed storage-dependent synchronous access. This deliberate minor
691
691
  // release keeps lazy paging semantics independent of row residency.
692
- version: "0.2.12",
692
+ version: "0.2.14",
693
693
  contracts: {
694
694
  api: {
695
695
  name: "sdk-http-api",
@@ -3155,6 +3155,17 @@ function resolveToolExecuteTimeoutMs(toolId, input) {
3155
3155
  }
3156
3156
  var RUNS_FAILED_LOG_LIMIT = 20;
3157
3157
  var RUN_LOGS_PAGE_LIMIT = 1e3;
3158
+ function requireTargetBillingIdempotencyKey(value) {
3159
+ const normalized = value.trim();
3160
+ if (normalized.length === 0 || normalized.length > 200 || normalized !== value) {
3161
+ throw new DeeplineError(
3162
+ "Billing idempotencyKey must contain 1\u2013200 characters with no leading or trailing whitespace.",
3163
+ void 0,
3164
+ "INVALID_BILLING_IDEMPOTENCY_KEY"
3165
+ );
3166
+ }
3167
+ return normalized;
3168
+ }
3158
3169
  function isRecord6(value) {
3159
3170
  return Boolean(value && typeof value === "object" && !Array.isArray(value));
3160
3171
  }
@@ -3425,7 +3436,12 @@ var DeeplineClient = class {
3425
3436
  },
3426
3437
  invoices: {
3427
3438
  list: (options2) => this.listBillingInvoices(options2)
3428
- }
3439
+ },
3440
+ targetPlans: () => this.getTargetBillingPlans(),
3441
+ targetStatus: () => this.getTargetBillingStatus(),
3442
+ purchaseCredits: (options2) => this.purchaseTargetBillingCredits(options2),
3443
+ transitionPlan: (options2) => this.transitionTargetBillingPlan(options2),
3444
+ portalSession: () => this.createTargetBillingPortalSession()
3429
3445
  };
3430
3446
  this.monitors = {
3431
3447
  status: () => this.getMonitorsAccess(),
@@ -5339,6 +5355,52 @@ var DeeplineClient = class {
5339
5355
  `/api/v2/billing/invoices${suffix}`
5340
5356
  );
5341
5357
  }
5358
+ /** List the reviewed target plans and whether new acquisition is enabled. */
5359
+ async getTargetBillingPlans() {
5360
+ return this.http.get("/api/v2/billing/plans");
5361
+ }
5362
+ /** Read the workspace's normalized target plan, payment, and balance state. */
5363
+ async getTargetBillingStatus() {
5364
+ return this.http.get("/api/v2/billing/status");
5365
+ }
5366
+ /**
5367
+ * Purchase target-billing credits through the durable commercial operation
5368
+ * flow. The caller supplies an idempotency key for safe retries.
5369
+ */
5370
+ async purchaseTargetBillingCredits(options) {
5371
+ const idempotencyKey = requireTargetBillingIdempotencyKey(
5372
+ options.idempotencyKey
5373
+ );
5374
+ return this.http.post(
5375
+ "/api/v2/billing/credit-purchases",
5376
+ { credits: options.credits },
5377
+ { "Idempotency-Key": idempotencyKey },
5378
+ { maxRetries: 0, exactUrlOnly: true }
5379
+ );
5380
+ }
5381
+ /**
5382
+ * Start, change, cancel, or restore a target plan through one idempotent
5383
+ * commercial operation.
5384
+ */
5385
+ async transitionTargetBillingPlan(options) {
5386
+ const idempotencyKey = requireTargetBillingIdempotencyKey(
5387
+ options.idempotencyKey
5388
+ );
5389
+ return this.http.post(
5390
+ "/api/v2/billing/plan-transitions",
5391
+ {
5392
+ action: options.action,
5393
+ ...options.targetPlanSku ? { target_plan_sku: options.targetPlanSku } : {}
5394
+ },
5395
+ { "Idempotency-Key": idempotencyKey },
5396
+ { maxRetries: 0, exactUrlOnly: true }
5397
+ );
5398
+ }
5399
+ /** Create a Stripe-hosted portal session for payment recovery and invoices. */
5400
+ async createTargetBillingPortalSession() {
5401
+ const response = await this.http.post("/api/v2/billing/portal-sessions", {});
5402
+ return response.data;
5403
+ }
5342
5404
  // ——————————————————————————————————————————————————————————
5343
5405
  // Monitors
5344
5406
  // ——————————————————————————————————————————————————————————
@@ -7049,6 +7111,29 @@ function isQueryResultDatasetTool(toolId) {
7049
7111
  return isCustomerDbDatasetTool(toolId) || isSnowflakeQueryDatasetTool(toolId);
7050
7112
  }
7051
7113
 
7114
+ // ../shared_libs/plays/input-contract-definition.ts
7115
+ function freezeInputSchema(schema) {
7116
+ const visited = /* @__PURE__ */ new WeakSet();
7117
+ const freeze = (value) => {
7118
+ if (value === null || typeof value !== "object" || visited.has(value)) {
7119
+ return;
7120
+ }
7121
+ visited.add(value);
7122
+ for (const child of Object.values(value)) freeze(child);
7123
+ Object.freeze(value);
7124
+ };
7125
+ freeze(schema);
7126
+ return schema;
7127
+ }
7128
+ function createPlayInputContract(schema) {
7129
+ if (!schema || typeof schema !== "object" || Array.isArray(schema)) {
7130
+ throw new Error(
7131
+ "defineInput<T>(schema) requires a JSON-schema-like object."
7132
+ );
7133
+ }
7134
+ return Object.freeze({ schema: freezeInputSchema(schema) });
7135
+ }
7136
+
7052
7137
  // src/play.ts
7053
7138
  var DeeplineConditionalStepResolver = class _DeeplineConditionalStepResolver {
7054
7139
  constructor(when, run, elseValue) {
@@ -7567,12 +7652,7 @@ function toolExecutionEnvelopeToResult(fallbackToolId, response, options) {
7567
7652
  );
7568
7653
  }
7569
7654
  function defineInput(schema) {
7570
- if (!schema || typeof schema !== "object" || Array.isArray(schema)) {
7571
- throw new Error(
7572
- "defineInput<T>(schema) requires a JSON-schema-like object."
7573
- );
7574
- }
7575
- return { schema };
7655
+ return createPlayInputContract(schema);
7576
7656
  }
7577
7657
  function definePlay(nameOrConfig, maybeFn, maybeBindings) {
7578
7658
  const config = typeof nameOrConfig === "string" ? {
@@ -1,5 +1,6 @@
1
- import { T as ToolExecutionErrorSchemaVersion, P as PlayArtifactKind$1, a as PlayCompilerManifest } from '../tool-execution-error-4-rhemLQ.mjs';
2
- export { b as PLAY_ARTIFACT_KINDS } from '../tool-execution-error-4-rhemLQ.mjs';
1
+ import { T as ToolExecutionErrorSchemaVersion, P as PlayAuthoringContractEdition, a as PlayArtifactKind$1, b as PlaySandboxRuntimeDeclaration, c as PlayCompilerManifest } from '../compiler-manifest-xFkbJX2B.mjs';
2
+ export { d as PLAY_ARTIFACT_KINDS } from '../compiler-manifest-xFkbJX2B.mjs';
3
+ import '@sinclair/typebox';
3
4
 
4
5
  type PlayPackageImport = {
5
6
  name: string;
@@ -19,6 +20,8 @@ type PlayArtifactCompatibility = {
19
20
  runtimeBackend?: string | null;
20
21
  /** Missing preserves the legacy schema used before this field existed. */
21
22
  toolErrorSchemaVersion?: ToolExecutionErrorSchemaVersion;
23
+ /** Missing preserves edition 1 for artifacts created before authoring contracts were pinned. */
24
+ authoringContractEdition?: PlayAuthoringContractEdition;
22
25
  };
23
26
  /** The only executable Play artifact contract. */
24
27
  type PlayArtifactKind = 'cjs_node20';
@@ -40,12 +43,6 @@ type PlayBundleArtifact = {
40
43
  cacheHit: boolean;
41
44
  };
42
45
 
43
- type PlaySandboxSize = 'standard';
44
- type PlaySandboxRuntimeDeclaration = {
45
- timeout?: string;
46
- size?: PlaySandboxSize;
47
- };
48
-
49
46
  type ImportedPlayDependency = {
50
47
  filePath: string;
51
48
  playName: string;
@@ -1,5 +1,6 @@
1
- import { T as ToolExecutionErrorSchemaVersion, P as PlayArtifactKind$1, a as PlayCompilerManifest } from '../tool-execution-error-4-rhemLQ.js';
2
- export { b as PLAY_ARTIFACT_KINDS } from '../tool-execution-error-4-rhemLQ.js';
1
+ import { T as ToolExecutionErrorSchemaVersion, P as PlayAuthoringContractEdition, a as PlayArtifactKind$1, b as PlaySandboxRuntimeDeclaration, c as PlayCompilerManifest } from '../compiler-manifest-xFkbJX2B.js';
2
+ export { d as PLAY_ARTIFACT_KINDS } from '../compiler-manifest-xFkbJX2B.js';
3
+ import '@sinclair/typebox';
3
4
 
4
5
  type PlayPackageImport = {
5
6
  name: string;
@@ -19,6 +20,8 @@ type PlayArtifactCompatibility = {
19
20
  runtimeBackend?: string | null;
20
21
  /** Missing preserves the legacy schema used before this field existed. */
21
22
  toolErrorSchemaVersion?: ToolExecutionErrorSchemaVersion;
23
+ /** Missing preserves edition 1 for artifacts created before authoring contracts were pinned. */
24
+ authoringContractEdition?: PlayAuthoringContractEdition;
22
25
  };
23
26
  /** The only executable Play artifact contract. */
24
27
  type PlayArtifactKind = 'cjs_node20';
@@ -40,12 +43,6 @@ type PlayBundleArtifact = {
40
43
  cacheHit: boolean;
41
44
  };
42
45
 
43
- type PlaySandboxSize = 'standard';
44
- type PlaySandboxRuntimeDeclaration = {
45
- timeout?: string;
46
- size?: PlaySandboxSize;
47
- };
48
-
49
46
  type ImportedPlayDependency = {
50
47
  filePath: string;
51
48
  playName: string;