deepline 0.3.22 → 0.3.23
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.
- package/dist/bundling-sources/sdk/src/client.ts +64 -0
- package/dist/bundling-sources/sdk/src/release.ts +1 -1
- package/dist/bundling-sources/sdk/src/types.ts +14 -0
- package/dist/cli/index.js +152 -1
- package/dist/cli/index.mjs +152 -1
- package/dist/index.d.mts +40 -0
- package/dist/index.d.ts +40 -0
- package/dist/index.js +27 -1
- package/dist/index.mjs +27 -1
- package/package.json +1 -1
|
@@ -1033,6 +1033,28 @@ export type TargetBillingStatusResult = {
|
|
|
1033
1033
|
as_of: string | null;
|
|
1034
1034
|
};
|
|
1035
1035
|
|
|
1036
|
+
export type TargetAutoRechargeResult = {
|
|
1037
|
+
org_id: string;
|
|
1038
|
+
enabled: boolean;
|
|
1039
|
+
available: boolean;
|
|
1040
|
+
reason: string | null;
|
|
1041
|
+
threshold_credits: number | null;
|
|
1042
|
+
refill_to_credits: number | null;
|
|
1043
|
+
rolling_limit_cents: null;
|
|
1044
|
+
};
|
|
1045
|
+
|
|
1046
|
+
export type TargetAutoRechargeUpdateOptions =
|
|
1047
|
+
| {
|
|
1048
|
+
enabled: false;
|
|
1049
|
+
idempotencyKey: string;
|
|
1050
|
+
}
|
|
1051
|
+
| {
|
|
1052
|
+
enabled: true;
|
|
1053
|
+
thresholdCredits: number;
|
|
1054
|
+
refillToCredits: number;
|
|
1055
|
+
idempotencyKey: string;
|
|
1056
|
+
};
|
|
1057
|
+
|
|
1036
1058
|
export type TargetBillingMutationResult = {
|
|
1037
1059
|
data: Record<string, unknown>;
|
|
1038
1060
|
operation: TargetBillingOperation;
|
|
@@ -1158,6 +1180,13 @@ export type BillingNamespace = {
|
|
|
1158
1180
|
targetPlans: () => Promise<TargetBillingPlansResult>;
|
|
1159
1181
|
/** Normalized target billing state. */
|
|
1160
1182
|
targetStatus: () => Promise<TargetBillingStatusResult>;
|
|
1183
|
+
/** Read and manage the Metronome-backed automatic recharge configuration. */
|
|
1184
|
+
autoRecharge: {
|
|
1185
|
+
get: () => Promise<TargetAutoRechargeResult>;
|
|
1186
|
+
update: (
|
|
1187
|
+
options: TargetAutoRechargeUpdateOptions,
|
|
1188
|
+
) => Promise<TargetAutoRechargeResult>;
|
|
1189
|
+
};
|
|
1161
1190
|
/** Buy Deepline credits through a payment-gated Metronome commit. */
|
|
1162
1191
|
purchaseCredits: (options: {
|
|
1163
1192
|
credits: number;
|
|
@@ -1750,6 +1779,10 @@ export class DeeplineClient {
|
|
|
1750
1779
|
},
|
|
1751
1780
|
targetPlans: () => this.getTargetBillingPlans(),
|
|
1752
1781
|
targetStatus: () => this.getTargetBillingStatus(),
|
|
1782
|
+
autoRecharge: {
|
|
1783
|
+
get: () => this.getTargetAutoRecharge(),
|
|
1784
|
+
update: (options) => this.updateTargetAutoRecharge(options),
|
|
1785
|
+
},
|
|
1753
1786
|
purchaseCredits: (options) => this.purchaseTargetBillingCredits(options),
|
|
1754
1787
|
transitionPlan: (options) => this.transitionTargetBillingPlan(options),
|
|
1755
1788
|
portalSession: () => this.createTargetBillingPortalSession(),
|
|
@@ -4537,6 +4570,37 @@ export class DeeplineClient {
|
|
|
4537
4570
|
return this.http.get<TargetBillingStatusResult>('/api/v2/billing/status');
|
|
4538
4571
|
}
|
|
4539
4572
|
|
|
4573
|
+
/** Read the canonical Metronome automatic recharge configuration. */
|
|
4574
|
+
async getTargetAutoRecharge(): Promise<TargetAutoRechargeResult> {
|
|
4575
|
+
return this.http.get<TargetAutoRechargeResult>(
|
|
4576
|
+
'/api/v2/billing/auto-recharge',
|
|
4577
|
+
);
|
|
4578
|
+
}
|
|
4579
|
+
|
|
4580
|
+
/** Update automatic recharge and return the server-verified configuration. */
|
|
4581
|
+
async updateTargetAutoRecharge(
|
|
4582
|
+
options: TargetAutoRechargeUpdateOptions,
|
|
4583
|
+
): Promise<TargetAutoRechargeResult> {
|
|
4584
|
+
const idempotencyKey = requireTargetBillingIdempotencyKey(
|
|
4585
|
+
options.idempotencyKey,
|
|
4586
|
+
);
|
|
4587
|
+
const response = await this.http.put<{
|
|
4588
|
+
data: TargetAutoRechargeResult;
|
|
4589
|
+
request_id?: string;
|
|
4590
|
+
}>(
|
|
4591
|
+
'/api/v2/billing/auto-recharge',
|
|
4592
|
+
options.enabled
|
|
4593
|
+
? {
|
|
4594
|
+
enabled: true,
|
|
4595
|
+
threshold_credits: options.thresholdCredits,
|
|
4596
|
+
refill_to_credits: options.refillToCredits,
|
|
4597
|
+
}
|
|
4598
|
+
: { enabled: false },
|
|
4599
|
+
{ 'Idempotency-Key': idempotencyKey },
|
|
4600
|
+
);
|
|
4601
|
+
return response.data;
|
|
4602
|
+
}
|
|
4603
|
+
|
|
4540
4604
|
/**
|
|
4541
4605
|
* Purchase target-billing credits through the durable commercial operation
|
|
4542
4606
|
* flow. The caller supplies an idempotency key for safe retries.
|
|
@@ -192,7 +192,7 @@ export const SDK_RELEASE = {
|
|
|
192
192
|
// 0.3.0 introduces raw-v2: complete scrubbed provider responses are
|
|
193
193
|
// available at toolResponse.rawV2 while toolResponse.raw and all declared
|
|
194
194
|
// getters keep their established compatibility behavior.
|
|
195
|
-
version: '0.3.
|
|
195
|
+
version: '0.3.23',
|
|
196
196
|
updateSummary:
|
|
197
197
|
'New raw-v2 tool responses preserve complete scrubbed provider envelopes at toolResponse.rawV2, including JSON:API included resources, links, cursors, and totals. Existing toolResponse.raw and declared getters keep working unchanged.',
|
|
198
198
|
contracts: {
|
|
@@ -1308,6 +1308,11 @@ export interface PlayCheckResult {
|
|
|
1308
1308
|
* `1 trigger · 2 tools · 1 dataset · 14 columns`.
|
|
1309
1309
|
*/
|
|
1310
1310
|
summary?: string;
|
|
1311
|
+
/**
|
|
1312
|
+
* Feature-gated validation paths that were enabled for this exact cloud
|
|
1313
|
+
* check. Present as an empty array when no feature gate affected the result.
|
|
1314
|
+
*/
|
|
1315
|
+
featureFlags?: PlayCheckFeatureFlag[];
|
|
1311
1316
|
artifactHash?: string | null;
|
|
1312
1317
|
graphHash?: string | null;
|
|
1313
1318
|
/** SHA-256 of the exact source bytes checked by Deepline. */
|
|
@@ -1341,6 +1346,14 @@ export interface PlayCheckResult {
|
|
|
1341
1346
|
};
|
|
1342
1347
|
}
|
|
1343
1348
|
|
|
1349
|
+
/** An enabled server-side feature flag that affected a Play check. */
|
|
1350
|
+
export interface PlayCheckFeatureFlag {
|
|
1351
|
+
id: string;
|
|
1352
|
+
label: string;
|
|
1353
|
+
enabled: true;
|
|
1354
|
+
reason: string;
|
|
1355
|
+
}
|
|
1356
|
+
|
|
1344
1357
|
/**
|
|
1345
1358
|
* One exported play's check result inside a multi-play file. Carries the same
|
|
1346
1359
|
* per-play fields as {@link PlayCheckResult}, unprefixed and unaggregated, so a
|
|
@@ -1360,6 +1373,7 @@ export interface PlayCheckExportResult {
|
|
|
1360
1373
|
graphHash?: string | null;
|
|
1361
1374
|
sourceHash?: string | null;
|
|
1362
1375
|
summary?: string;
|
|
1376
|
+
featureFlags?: PlayCheckFeatureFlag[];
|
|
1363
1377
|
recognized?: PlayCheckRecognizedSummary;
|
|
1364
1378
|
triggers?: PlayCheckTriggersSummary | null;
|
|
1365
1379
|
}
|
package/dist/cli/index.js
CHANGED
|
@@ -1047,7 +1047,7 @@ var SDK_RELEASE = {
|
|
|
1047
1047
|
// 0.3.0 introduces raw-v2: complete scrubbed provider responses are
|
|
1048
1048
|
// available at toolResponse.rawV2 while toolResponse.raw and all declared
|
|
1049
1049
|
// getters keep their established compatibility behavior.
|
|
1050
|
-
version: "0.3.
|
|
1050
|
+
version: "0.3.23",
|
|
1051
1051
|
updateSummary: "New raw-v2 tool responses preserve complete scrubbed provider envelopes at toolResponse.rawV2, including JSON:API included resources, links, cursors, and totals. Existing toolResponse.raw and declared getters keep working unchanged.",
|
|
1052
1052
|
contracts: {
|
|
1053
1053
|
api: {
|
|
@@ -4647,6 +4647,10 @@ var DeeplineClient = class {
|
|
|
4647
4647
|
},
|
|
4648
4648
|
targetPlans: () => this.getTargetBillingPlans(),
|
|
4649
4649
|
targetStatus: () => this.getTargetBillingStatus(),
|
|
4650
|
+
autoRecharge: {
|
|
4651
|
+
get: () => this.getTargetAutoRecharge(),
|
|
4652
|
+
update: (options2) => this.updateTargetAutoRecharge(options2)
|
|
4653
|
+
},
|
|
4650
4654
|
purchaseCredits: (options2) => this.purchaseTargetBillingCredits(options2),
|
|
4651
4655
|
transitionPlan: (options2) => this.transitionTargetBillingPlan(options2),
|
|
4652
4656
|
portalSession: () => this.createTargetBillingPortalSession()
|
|
@@ -6732,6 +6736,28 @@ var DeeplineClient = class {
|
|
|
6732
6736
|
async getTargetBillingStatus() {
|
|
6733
6737
|
return this.http.get("/api/v2/billing/status");
|
|
6734
6738
|
}
|
|
6739
|
+
/** Read the canonical Metronome automatic recharge configuration. */
|
|
6740
|
+
async getTargetAutoRecharge() {
|
|
6741
|
+
return this.http.get(
|
|
6742
|
+
"/api/v2/billing/auto-recharge"
|
|
6743
|
+
);
|
|
6744
|
+
}
|
|
6745
|
+
/** Update automatic recharge and return the server-verified configuration. */
|
|
6746
|
+
async updateTargetAutoRecharge(options) {
|
|
6747
|
+
const idempotencyKey = requireTargetBillingIdempotencyKey(
|
|
6748
|
+
options.idempotencyKey
|
|
6749
|
+
);
|
|
6750
|
+
const response = await this.http.put(
|
|
6751
|
+
"/api/v2/billing/auto-recharge",
|
|
6752
|
+
options.enabled ? {
|
|
6753
|
+
enabled: true,
|
|
6754
|
+
threshold_credits: options.thresholdCredits,
|
|
6755
|
+
refill_to_credits: options.refillToCredits
|
|
6756
|
+
} : { enabled: false },
|
|
6757
|
+
{ "Idempotency-Key": idempotencyKey }
|
|
6758
|
+
);
|
|
6759
|
+
return response.data;
|
|
6760
|
+
}
|
|
6735
6761
|
/**
|
|
6736
6762
|
* Purchase target-billing credits through the durable commercial operation
|
|
6737
6763
|
* flow. The caller supplies an idempotency key for safe retries.
|
|
@@ -9464,6 +9490,96 @@ async function handleTargetStatus(options) {
|
|
|
9464
9490
|
{ json: options.json }
|
|
9465
9491
|
);
|
|
9466
9492
|
}
|
|
9493
|
+
async function handleAutoRechargeStatus(options) {
|
|
9494
|
+
const payload = await new DeeplineClient().billing.autoRecharge.get();
|
|
9495
|
+
const state = payload.available ? payload.enabled ? "on" : "off" : "unavailable";
|
|
9496
|
+
const lines = [
|
|
9497
|
+
`State: ${state}`,
|
|
9498
|
+
...payload.threshold_credits !== null ? [`Threshold: ${payload.threshold_credits} credits`] : [],
|
|
9499
|
+
...payload.refill_to_credits !== null ? [`Refill balance to: ${payload.refill_to_credits} credits`] : []
|
|
9500
|
+
];
|
|
9501
|
+
printCommandEnvelope(
|
|
9502
|
+
{
|
|
9503
|
+
ok: true,
|
|
9504
|
+
...payload,
|
|
9505
|
+
render: { sections: [{ title: "automatic recharge", lines }] }
|
|
9506
|
+
},
|
|
9507
|
+
{ json: options.json }
|
|
9508
|
+
);
|
|
9509
|
+
}
|
|
9510
|
+
async function handleAutoRechargeSet(options) {
|
|
9511
|
+
const thresholdCredits = parseTopUpCredits(options.thresholdCredits);
|
|
9512
|
+
const refillToCredits = parseTopUpCredits(options.refillToCredits);
|
|
9513
|
+
if (thresholdCredits === null || refillToCredits === null || refillToCredits <= thresholdCredits) {
|
|
9514
|
+
reportBillingFailure(
|
|
9515
|
+
{
|
|
9516
|
+
exitCode: 2,
|
|
9517
|
+
code: "INVALID_AUTO_RECHARGE_CONFIGURATION",
|
|
9518
|
+
message: "--threshold-credits and --refill-to-credits must be positive whole credits, and refill-to must be greater."
|
|
9519
|
+
},
|
|
9520
|
+
options
|
|
9521
|
+
);
|
|
9522
|
+
return;
|
|
9523
|
+
}
|
|
9524
|
+
const idempotencyKey = targetBillingIdempotencyKey(options.idempotencyKey);
|
|
9525
|
+
if (options.dryRun) {
|
|
9526
|
+
printCommandEnvelope(
|
|
9527
|
+
{
|
|
9528
|
+
ok: true,
|
|
9529
|
+
dry_run: true,
|
|
9530
|
+
idempotency_key: idempotencyKey,
|
|
9531
|
+
planned_request: {
|
|
9532
|
+
method: "PUT",
|
|
9533
|
+
path: "/api/v2/billing/auto-recharge",
|
|
9534
|
+
body: {
|
|
9535
|
+
enabled: true,
|
|
9536
|
+
threshold_credits: thresholdCredits,
|
|
9537
|
+
refill_to_credits: refillToCredits
|
|
9538
|
+
}
|
|
9539
|
+
}
|
|
9540
|
+
},
|
|
9541
|
+
{ json: options.json }
|
|
9542
|
+
);
|
|
9543
|
+
return;
|
|
9544
|
+
}
|
|
9545
|
+
const payload = await new DeeplineClient().billing.autoRecharge.update({
|
|
9546
|
+
enabled: true,
|
|
9547
|
+
thresholdCredits,
|
|
9548
|
+
refillToCredits,
|
|
9549
|
+
idempotencyKey
|
|
9550
|
+
});
|
|
9551
|
+
printCommandEnvelope(
|
|
9552
|
+
{ ok: true, idempotency_key: idempotencyKey, ...payload },
|
|
9553
|
+
{ json: options.json }
|
|
9554
|
+
);
|
|
9555
|
+
}
|
|
9556
|
+
async function handleAutoRechargeOff(options) {
|
|
9557
|
+
const idempotencyKey = targetBillingIdempotencyKey(options.idempotencyKey);
|
|
9558
|
+
if (options.dryRun) {
|
|
9559
|
+
printCommandEnvelope(
|
|
9560
|
+
{
|
|
9561
|
+
ok: true,
|
|
9562
|
+
dry_run: true,
|
|
9563
|
+
idempotency_key: idempotencyKey,
|
|
9564
|
+
planned_request: {
|
|
9565
|
+
method: "PUT",
|
|
9566
|
+
path: "/api/v2/billing/auto-recharge",
|
|
9567
|
+
body: { enabled: false }
|
|
9568
|
+
}
|
|
9569
|
+
},
|
|
9570
|
+
{ json: options.json }
|
|
9571
|
+
);
|
|
9572
|
+
return;
|
|
9573
|
+
}
|
|
9574
|
+
const payload = await new DeeplineClient().billing.autoRecharge.update({
|
|
9575
|
+
enabled: false,
|
|
9576
|
+
idempotencyKey
|
|
9577
|
+
});
|
|
9578
|
+
printCommandEnvelope(
|
|
9579
|
+
{ ok: true, idempotency_key: idempotencyKey, ...payload },
|
|
9580
|
+
{ json: options.json }
|
|
9581
|
+
);
|
|
9582
|
+
}
|
|
9467
9583
|
async function handleBuyCredits(creditsRaw, options) {
|
|
9468
9584
|
const credits = parseTopUpCredits(creditsRaw);
|
|
9469
9585
|
if (credits === null) {
|
|
@@ -9725,6 +9841,31 @@ Examples:
|
|
|
9725
9841
|
).option("--dry-run", "Print the planned top-up without charging").option("--compact", "Keep only high-signal fields in JSON output").option("--json", "Emit JSON output. Also automatic when stdout is piped").action(handleTopUp);
|
|
9726
9842
|
billing.command("buy").description("Buy credits through the target billing contract.").argument("<credits>", "Positive integer Deepline credit amount").option("--idempotency-key <key>", "Stable retry key").option("--json", "Emit JSON output").action(handleBuyCredits);
|
|
9727
9843
|
billing.command("status").description("Show normalized target billing state.").option("--json", "Emit JSON output").action(handleTargetStatus);
|
|
9844
|
+
billing.command("auto-recharge").description("Inspect and manage automatic Deepline credit recharge.").addHelpText(
|
|
9845
|
+
"after",
|
|
9846
|
+
`
|
|
9847
|
+
Examples:
|
|
9848
|
+
deepline billing auto-recharge status --json
|
|
9849
|
+
deepline billing auto-recharge set --threshold-credits 1000 --refill-to-credits 3500 --dry-run --json
|
|
9850
|
+
deepline billing auto-recharge off --dry-run --json
|
|
9851
|
+
`
|
|
9852
|
+
).addCommand(
|
|
9853
|
+
new import_commander.Command("status").description("Show the canonical automatic recharge configuration.").option("--json", "Emit JSON output").action(handleAutoRechargeStatus)
|
|
9854
|
+
).addCommand(
|
|
9855
|
+
new import_commander.Command("set").description(
|
|
9856
|
+
"Enable automatic recharge with a threshold and refill target."
|
|
9857
|
+
).requiredOption(
|
|
9858
|
+
"--threshold-credits <credits>",
|
|
9859
|
+
"Recharge when the balance reaches this amount"
|
|
9860
|
+
).requiredOption(
|
|
9861
|
+
"--refill-to-credits <credits>",
|
|
9862
|
+
"Recharge the balance to this amount"
|
|
9863
|
+
).option("--idempotency-key <key>", "Stable retry key").option("--dry-run", "Print the planned update without applying it").option("--json", "Emit JSON output").action(handleAutoRechargeSet)
|
|
9864
|
+
).addCommand(
|
|
9865
|
+
new import_commander.Command("off").description(
|
|
9866
|
+
"Disable automatic recharge without clearing saved amounts."
|
|
9867
|
+
).option("--idempotency-key <key>", "Stable retry key").option("--dry-run", "Print the planned update without applying it").option("--json", "Emit JSON output").action(handleAutoRechargeOff)
|
|
9868
|
+
);
|
|
9728
9869
|
billing.command("change-plan").description("Start or change the target billing plan.").argument("<plan_sku>", "payg-v1, builder-v1, or team-v1").option("--idempotency-key <key>", "Stable retry key").option("--json", "Emit JSON output").action(handleTargetPlan);
|
|
9729
9870
|
billing.command("cancel-plan").description("Cancel a target subscription at period end, or undo it.").option("--undo", "Undo a pending period-end cancellation").option("--idempotency-key <key>", "Stable retry key").option("--json", "Emit JSON output").action(handleTargetPlanCancellation);
|
|
9730
9871
|
billing.command("portal").description("Open the Stripe-hosted billing recovery portal.").option("--no-open", "Print the URL without opening a browser").option("--json", "Emit JSON output").action(handleTargetPortal);
|
|
@@ -23655,6 +23796,10 @@ function printPlayCheckOutcome(outcome, target, prefix) {
|
|
|
23655
23796
|
console.error(
|
|
23656
23797
|
`\u2717 ${prefix}${playName} failed ${playCheckFailureStage(outcome)}`
|
|
23657
23798
|
);
|
|
23799
|
+
printPlayCheckFeatureFlags(
|
|
23800
|
+
result.featureFlags,
|
|
23801
|
+
(line) => console.error(line)
|
|
23802
|
+
);
|
|
23658
23803
|
const { unstructuredErrors } = partitionMirroredErrors(
|
|
23659
23804
|
result.errors,
|
|
23660
23805
|
result.issues
|
|
@@ -23674,6 +23819,7 @@ function printPlayCheckOutcome(outcome, target, prefix) {
|
|
|
23674
23819
|
console.log(
|
|
23675
23820
|
summary ? `\u2713 ${prefix}${playName} valid \u2014 ${summary}` : `\u2713 ${prefix}${playName} passed ${result.limits ? "cloud" : "local"} play check`
|
|
23676
23821
|
);
|
|
23822
|
+
printPlayCheckFeatureFlags(result.featureFlags, (line) => console.log(line));
|
|
23677
23823
|
if (result.artifactHash) {
|
|
23678
23824
|
console.log(` artifact: ${result.artifactHash.slice(0, 12)}`);
|
|
23679
23825
|
}
|
|
@@ -23695,6 +23841,11 @@ function printPlayCheckOutcome(outcome, target, prefix) {
|
|
|
23695
23841
|
);
|
|
23696
23842
|
printToolGetterHints(result.toolGetterHints);
|
|
23697
23843
|
}
|
|
23844
|
+
function printPlayCheckFeatureFlags(flags, write) {
|
|
23845
|
+
for (const flag of flags ?? []) {
|
|
23846
|
+
write(` feature flag enabled: ${flag.label} \u2014 ${flag.reason}`);
|
|
23847
|
+
}
|
|
23848
|
+
}
|
|
23698
23849
|
function printPlayCheckOutcomes(outcomes, target) {
|
|
23699
23850
|
if (outcomes.length === 1) {
|
|
23700
23851
|
printPlayCheckOutcome(outcomes[0], target, "");
|
package/dist/cli/index.mjs
CHANGED
|
@@ -1033,7 +1033,7 @@ var SDK_RELEASE = {
|
|
|
1033
1033
|
// 0.3.0 introduces raw-v2: complete scrubbed provider responses are
|
|
1034
1034
|
// available at toolResponse.rawV2 while toolResponse.raw and all declared
|
|
1035
1035
|
// getters keep their established compatibility behavior.
|
|
1036
|
-
version: "0.3.
|
|
1036
|
+
version: "0.3.23",
|
|
1037
1037
|
updateSummary: "New raw-v2 tool responses preserve complete scrubbed provider envelopes at toolResponse.rawV2, including JSON:API included resources, links, cursors, and totals. Existing toolResponse.raw and declared getters keep working unchanged.",
|
|
1038
1038
|
contracts: {
|
|
1039
1039
|
api: {
|
|
@@ -4633,6 +4633,10 @@ var DeeplineClient = class {
|
|
|
4633
4633
|
},
|
|
4634
4634
|
targetPlans: () => this.getTargetBillingPlans(),
|
|
4635
4635
|
targetStatus: () => this.getTargetBillingStatus(),
|
|
4636
|
+
autoRecharge: {
|
|
4637
|
+
get: () => this.getTargetAutoRecharge(),
|
|
4638
|
+
update: (options2) => this.updateTargetAutoRecharge(options2)
|
|
4639
|
+
},
|
|
4636
4640
|
purchaseCredits: (options2) => this.purchaseTargetBillingCredits(options2),
|
|
4637
4641
|
transitionPlan: (options2) => this.transitionTargetBillingPlan(options2),
|
|
4638
4642
|
portalSession: () => this.createTargetBillingPortalSession()
|
|
@@ -6718,6 +6722,28 @@ var DeeplineClient = class {
|
|
|
6718
6722
|
async getTargetBillingStatus() {
|
|
6719
6723
|
return this.http.get("/api/v2/billing/status");
|
|
6720
6724
|
}
|
|
6725
|
+
/** Read the canonical Metronome automatic recharge configuration. */
|
|
6726
|
+
async getTargetAutoRecharge() {
|
|
6727
|
+
return this.http.get(
|
|
6728
|
+
"/api/v2/billing/auto-recharge"
|
|
6729
|
+
);
|
|
6730
|
+
}
|
|
6731
|
+
/** Update automatic recharge and return the server-verified configuration. */
|
|
6732
|
+
async updateTargetAutoRecharge(options) {
|
|
6733
|
+
const idempotencyKey = requireTargetBillingIdempotencyKey(
|
|
6734
|
+
options.idempotencyKey
|
|
6735
|
+
);
|
|
6736
|
+
const response = await this.http.put(
|
|
6737
|
+
"/api/v2/billing/auto-recharge",
|
|
6738
|
+
options.enabled ? {
|
|
6739
|
+
enabled: true,
|
|
6740
|
+
threshold_credits: options.thresholdCredits,
|
|
6741
|
+
refill_to_credits: options.refillToCredits
|
|
6742
|
+
} : { enabled: false },
|
|
6743
|
+
{ "Idempotency-Key": idempotencyKey }
|
|
6744
|
+
);
|
|
6745
|
+
return response.data;
|
|
6746
|
+
}
|
|
6721
6747
|
/**
|
|
6722
6748
|
* Purchase target-billing credits through the durable commercial operation
|
|
6723
6749
|
* flow. The caller supplies an idempotency key for safe retries.
|
|
@@ -9462,6 +9488,96 @@ async function handleTargetStatus(options) {
|
|
|
9462
9488
|
{ json: options.json }
|
|
9463
9489
|
);
|
|
9464
9490
|
}
|
|
9491
|
+
async function handleAutoRechargeStatus(options) {
|
|
9492
|
+
const payload = await new DeeplineClient().billing.autoRecharge.get();
|
|
9493
|
+
const state = payload.available ? payload.enabled ? "on" : "off" : "unavailable";
|
|
9494
|
+
const lines = [
|
|
9495
|
+
`State: ${state}`,
|
|
9496
|
+
...payload.threshold_credits !== null ? [`Threshold: ${payload.threshold_credits} credits`] : [],
|
|
9497
|
+
...payload.refill_to_credits !== null ? [`Refill balance to: ${payload.refill_to_credits} credits`] : []
|
|
9498
|
+
];
|
|
9499
|
+
printCommandEnvelope(
|
|
9500
|
+
{
|
|
9501
|
+
ok: true,
|
|
9502
|
+
...payload,
|
|
9503
|
+
render: { sections: [{ title: "automatic recharge", lines }] }
|
|
9504
|
+
},
|
|
9505
|
+
{ json: options.json }
|
|
9506
|
+
);
|
|
9507
|
+
}
|
|
9508
|
+
async function handleAutoRechargeSet(options) {
|
|
9509
|
+
const thresholdCredits = parseTopUpCredits(options.thresholdCredits);
|
|
9510
|
+
const refillToCredits = parseTopUpCredits(options.refillToCredits);
|
|
9511
|
+
if (thresholdCredits === null || refillToCredits === null || refillToCredits <= thresholdCredits) {
|
|
9512
|
+
reportBillingFailure(
|
|
9513
|
+
{
|
|
9514
|
+
exitCode: 2,
|
|
9515
|
+
code: "INVALID_AUTO_RECHARGE_CONFIGURATION",
|
|
9516
|
+
message: "--threshold-credits and --refill-to-credits must be positive whole credits, and refill-to must be greater."
|
|
9517
|
+
},
|
|
9518
|
+
options
|
|
9519
|
+
);
|
|
9520
|
+
return;
|
|
9521
|
+
}
|
|
9522
|
+
const idempotencyKey = targetBillingIdempotencyKey(options.idempotencyKey);
|
|
9523
|
+
if (options.dryRun) {
|
|
9524
|
+
printCommandEnvelope(
|
|
9525
|
+
{
|
|
9526
|
+
ok: true,
|
|
9527
|
+
dry_run: true,
|
|
9528
|
+
idempotency_key: idempotencyKey,
|
|
9529
|
+
planned_request: {
|
|
9530
|
+
method: "PUT",
|
|
9531
|
+
path: "/api/v2/billing/auto-recharge",
|
|
9532
|
+
body: {
|
|
9533
|
+
enabled: true,
|
|
9534
|
+
threshold_credits: thresholdCredits,
|
|
9535
|
+
refill_to_credits: refillToCredits
|
|
9536
|
+
}
|
|
9537
|
+
}
|
|
9538
|
+
},
|
|
9539
|
+
{ json: options.json }
|
|
9540
|
+
);
|
|
9541
|
+
return;
|
|
9542
|
+
}
|
|
9543
|
+
const payload = await new DeeplineClient().billing.autoRecharge.update({
|
|
9544
|
+
enabled: true,
|
|
9545
|
+
thresholdCredits,
|
|
9546
|
+
refillToCredits,
|
|
9547
|
+
idempotencyKey
|
|
9548
|
+
});
|
|
9549
|
+
printCommandEnvelope(
|
|
9550
|
+
{ ok: true, idempotency_key: idempotencyKey, ...payload },
|
|
9551
|
+
{ json: options.json }
|
|
9552
|
+
);
|
|
9553
|
+
}
|
|
9554
|
+
async function handleAutoRechargeOff(options) {
|
|
9555
|
+
const idempotencyKey = targetBillingIdempotencyKey(options.idempotencyKey);
|
|
9556
|
+
if (options.dryRun) {
|
|
9557
|
+
printCommandEnvelope(
|
|
9558
|
+
{
|
|
9559
|
+
ok: true,
|
|
9560
|
+
dry_run: true,
|
|
9561
|
+
idempotency_key: idempotencyKey,
|
|
9562
|
+
planned_request: {
|
|
9563
|
+
method: "PUT",
|
|
9564
|
+
path: "/api/v2/billing/auto-recharge",
|
|
9565
|
+
body: { enabled: false }
|
|
9566
|
+
}
|
|
9567
|
+
},
|
|
9568
|
+
{ json: options.json }
|
|
9569
|
+
);
|
|
9570
|
+
return;
|
|
9571
|
+
}
|
|
9572
|
+
const payload = await new DeeplineClient().billing.autoRecharge.update({
|
|
9573
|
+
enabled: false,
|
|
9574
|
+
idempotencyKey
|
|
9575
|
+
});
|
|
9576
|
+
printCommandEnvelope(
|
|
9577
|
+
{ ok: true, idempotency_key: idempotencyKey, ...payload },
|
|
9578
|
+
{ json: options.json }
|
|
9579
|
+
);
|
|
9580
|
+
}
|
|
9465
9581
|
async function handleBuyCredits(creditsRaw, options) {
|
|
9466
9582
|
const credits = parseTopUpCredits(creditsRaw);
|
|
9467
9583
|
if (credits === null) {
|
|
@@ -9723,6 +9839,31 @@ Examples:
|
|
|
9723
9839
|
).option("--dry-run", "Print the planned top-up without charging").option("--compact", "Keep only high-signal fields in JSON output").option("--json", "Emit JSON output. Also automatic when stdout is piped").action(handleTopUp);
|
|
9724
9840
|
billing.command("buy").description("Buy credits through the target billing contract.").argument("<credits>", "Positive integer Deepline credit amount").option("--idempotency-key <key>", "Stable retry key").option("--json", "Emit JSON output").action(handleBuyCredits);
|
|
9725
9841
|
billing.command("status").description("Show normalized target billing state.").option("--json", "Emit JSON output").action(handleTargetStatus);
|
|
9842
|
+
billing.command("auto-recharge").description("Inspect and manage automatic Deepline credit recharge.").addHelpText(
|
|
9843
|
+
"after",
|
|
9844
|
+
`
|
|
9845
|
+
Examples:
|
|
9846
|
+
deepline billing auto-recharge status --json
|
|
9847
|
+
deepline billing auto-recharge set --threshold-credits 1000 --refill-to-credits 3500 --dry-run --json
|
|
9848
|
+
deepline billing auto-recharge off --dry-run --json
|
|
9849
|
+
`
|
|
9850
|
+
).addCommand(
|
|
9851
|
+
new Command("status").description("Show the canonical automatic recharge configuration.").option("--json", "Emit JSON output").action(handleAutoRechargeStatus)
|
|
9852
|
+
).addCommand(
|
|
9853
|
+
new Command("set").description(
|
|
9854
|
+
"Enable automatic recharge with a threshold and refill target."
|
|
9855
|
+
).requiredOption(
|
|
9856
|
+
"--threshold-credits <credits>",
|
|
9857
|
+
"Recharge when the balance reaches this amount"
|
|
9858
|
+
).requiredOption(
|
|
9859
|
+
"--refill-to-credits <credits>",
|
|
9860
|
+
"Recharge the balance to this amount"
|
|
9861
|
+
).option("--idempotency-key <key>", "Stable retry key").option("--dry-run", "Print the planned update without applying it").option("--json", "Emit JSON output").action(handleAutoRechargeSet)
|
|
9862
|
+
).addCommand(
|
|
9863
|
+
new Command("off").description(
|
|
9864
|
+
"Disable automatic recharge without clearing saved amounts."
|
|
9865
|
+
).option("--idempotency-key <key>", "Stable retry key").option("--dry-run", "Print the planned update without applying it").option("--json", "Emit JSON output").action(handleAutoRechargeOff)
|
|
9866
|
+
);
|
|
9726
9867
|
billing.command("change-plan").description("Start or change the target billing plan.").argument("<plan_sku>", "payg-v1, builder-v1, or team-v1").option("--idempotency-key <key>", "Stable retry key").option("--json", "Emit JSON output").action(handleTargetPlan);
|
|
9727
9868
|
billing.command("cancel-plan").description("Cancel a target subscription at period end, or undo it.").option("--undo", "Undo a pending period-end cancellation").option("--idempotency-key <key>", "Stable retry key").option("--json", "Emit JSON output").action(handleTargetPlanCancellation);
|
|
9728
9869
|
billing.command("portal").description("Open the Stripe-hosted billing recovery portal.").option("--no-open", "Print the URL without opening a browser").option("--json", "Emit JSON output").action(handleTargetPortal);
|
|
@@ -23718,6 +23859,10 @@ function printPlayCheckOutcome(outcome, target, prefix) {
|
|
|
23718
23859
|
console.error(
|
|
23719
23860
|
`\u2717 ${prefix}${playName} failed ${playCheckFailureStage(outcome)}`
|
|
23720
23861
|
);
|
|
23862
|
+
printPlayCheckFeatureFlags(
|
|
23863
|
+
result.featureFlags,
|
|
23864
|
+
(line) => console.error(line)
|
|
23865
|
+
);
|
|
23721
23866
|
const { unstructuredErrors } = partitionMirroredErrors(
|
|
23722
23867
|
result.errors,
|
|
23723
23868
|
result.issues
|
|
@@ -23737,6 +23882,7 @@ function printPlayCheckOutcome(outcome, target, prefix) {
|
|
|
23737
23882
|
console.log(
|
|
23738
23883
|
summary ? `\u2713 ${prefix}${playName} valid \u2014 ${summary}` : `\u2713 ${prefix}${playName} passed ${result.limits ? "cloud" : "local"} play check`
|
|
23739
23884
|
);
|
|
23885
|
+
printPlayCheckFeatureFlags(result.featureFlags, (line) => console.log(line));
|
|
23740
23886
|
if (result.artifactHash) {
|
|
23741
23887
|
console.log(` artifact: ${result.artifactHash.slice(0, 12)}`);
|
|
23742
23888
|
}
|
|
@@ -23758,6 +23904,11 @@ function printPlayCheckOutcome(outcome, target, prefix) {
|
|
|
23758
23904
|
);
|
|
23759
23905
|
printToolGetterHints(result.toolGetterHints);
|
|
23760
23906
|
}
|
|
23907
|
+
function printPlayCheckFeatureFlags(flags, write) {
|
|
23908
|
+
for (const flag of flags ?? []) {
|
|
23909
|
+
write(` feature flag enabled: ${flag.label} \u2014 ${flag.reason}`);
|
|
23910
|
+
}
|
|
23911
|
+
}
|
|
23761
23912
|
function printPlayCheckOutcomes(outcomes, target) {
|
|
23762
23913
|
if (outcomes.length === 1) {
|
|
23763
23914
|
printPlayCheckOutcome(outcomes[0], target, "");
|
package/dist/index.d.mts
CHANGED
|
@@ -1413,6 +1413,11 @@ interface PlayCheckResult {
|
|
|
1413
1413
|
* `1 trigger · 2 tools · 1 dataset · 14 columns`.
|
|
1414
1414
|
*/
|
|
1415
1415
|
summary?: string;
|
|
1416
|
+
/**
|
|
1417
|
+
* Feature-gated validation paths that were enabled for this exact cloud
|
|
1418
|
+
* check. Present as an empty array when no feature gate affected the result.
|
|
1419
|
+
*/
|
|
1420
|
+
featureFlags?: PlayCheckFeatureFlag[];
|
|
1416
1421
|
artifactHash?: string | null;
|
|
1417
1422
|
graphHash?: string | null;
|
|
1418
1423
|
/** SHA-256 of the exact source bytes checked by Deepline. */
|
|
@@ -1445,6 +1450,13 @@ interface PlayCheckResult {
|
|
|
1445
1450
|
};
|
|
1446
1451
|
};
|
|
1447
1452
|
}
|
|
1453
|
+
/** An enabled server-side feature flag that affected a Play check. */
|
|
1454
|
+
interface PlayCheckFeatureFlag {
|
|
1455
|
+
id: string;
|
|
1456
|
+
label: string;
|
|
1457
|
+
enabled: true;
|
|
1458
|
+
reason: string;
|
|
1459
|
+
}
|
|
1448
1460
|
/**
|
|
1449
1461
|
* One exported play's check result inside a multi-play file. Carries the same
|
|
1450
1462
|
* per-play fields as {@link PlayCheckResult}, unprefixed and unaggregated, so a
|
|
@@ -1464,6 +1476,7 @@ interface PlayCheckExportResult {
|
|
|
1464
1476
|
graphHash?: string | null;
|
|
1465
1477
|
sourceHash?: string | null;
|
|
1466
1478
|
summary?: string;
|
|
1479
|
+
featureFlags?: PlayCheckFeatureFlag[];
|
|
1467
1480
|
recognized?: PlayCheckRecognizedSummary;
|
|
1468
1481
|
triggers?: PlayCheckTriggersSummary | null;
|
|
1469
1482
|
}
|
|
@@ -2498,6 +2511,24 @@ type TargetBillingStatusResult = {
|
|
|
2498
2511
|
pending_plan_sku: string | null;
|
|
2499
2512
|
as_of: string | null;
|
|
2500
2513
|
};
|
|
2514
|
+
type TargetAutoRechargeResult = {
|
|
2515
|
+
org_id: string;
|
|
2516
|
+
enabled: boolean;
|
|
2517
|
+
available: boolean;
|
|
2518
|
+
reason: string | null;
|
|
2519
|
+
threshold_credits: number | null;
|
|
2520
|
+
refill_to_credits: number | null;
|
|
2521
|
+
rolling_limit_cents: null;
|
|
2522
|
+
};
|
|
2523
|
+
type TargetAutoRechargeUpdateOptions = {
|
|
2524
|
+
enabled: false;
|
|
2525
|
+
idempotencyKey: string;
|
|
2526
|
+
} | {
|
|
2527
|
+
enabled: true;
|
|
2528
|
+
thresholdCredits: number;
|
|
2529
|
+
refillToCredits: number;
|
|
2530
|
+
idempotencyKey: string;
|
|
2531
|
+
};
|
|
2501
2532
|
type TargetBillingMutationResult = {
|
|
2502
2533
|
data: Record<string, unknown>;
|
|
2503
2534
|
operation: TargetBillingOperation;
|
|
@@ -2617,6 +2648,11 @@ type BillingNamespace = {
|
|
|
2617
2648
|
targetPlans: () => Promise<TargetBillingPlansResult>;
|
|
2618
2649
|
/** Normalized target billing state. */
|
|
2619
2650
|
targetStatus: () => Promise<TargetBillingStatusResult>;
|
|
2651
|
+
/** Read and manage the Metronome-backed automatic recharge configuration. */
|
|
2652
|
+
autoRecharge: {
|
|
2653
|
+
get: () => Promise<TargetAutoRechargeResult>;
|
|
2654
|
+
update: (options: TargetAutoRechargeUpdateOptions) => Promise<TargetAutoRechargeResult>;
|
|
2655
|
+
};
|
|
2620
2656
|
/** Buy Deepline credits through a payment-gated Metronome commit. */
|
|
2621
2657
|
purchaseCredits: (options: {
|
|
2622
2658
|
credits: number;
|
|
@@ -3662,6 +3698,10 @@ declare class DeeplineClient {
|
|
|
3662
3698
|
getTargetBillingPlans(): Promise<TargetBillingPlansResult>;
|
|
3663
3699
|
/** Read the workspace's normalized target plan, payment, and balance state. */
|
|
3664
3700
|
getTargetBillingStatus(): Promise<TargetBillingStatusResult>;
|
|
3701
|
+
/** Read the canonical Metronome automatic recharge configuration. */
|
|
3702
|
+
getTargetAutoRecharge(): Promise<TargetAutoRechargeResult>;
|
|
3703
|
+
/** Update automatic recharge and return the server-verified configuration. */
|
|
3704
|
+
updateTargetAutoRecharge(options: TargetAutoRechargeUpdateOptions): Promise<TargetAutoRechargeResult>;
|
|
3665
3705
|
/**
|
|
3666
3706
|
* Purchase target-billing credits through the durable commercial operation
|
|
3667
3707
|
* flow. The caller supplies an idempotency key for safe retries.
|
package/dist/index.d.ts
CHANGED
|
@@ -1413,6 +1413,11 @@ interface PlayCheckResult {
|
|
|
1413
1413
|
* `1 trigger · 2 tools · 1 dataset · 14 columns`.
|
|
1414
1414
|
*/
|
|
1415
1415
|
summary?: string;
|
|
1416
|
+
/**
|
|
1417
|
+
* Feature-gated validation paths that were enabled for this exact cloud
|
|
1418
|
+
* check. Present as an empty array when no feature gate affected the result.
|
|
1419
|
+
*/
|
|
1420
|
+
featureFlags?: PlayCheckFeatureFlag[];
|
|
1416
1421
|
artifactHash?: string | null;
|
|
1417
1422
|
graphHash?: string | null;
|
|
1418
1423
|
/** SHA-256 of the exact source bytes checked by Deepline. */
|
|
@@ -1445,6 +1450,13 @@ interface PlayCheckResult {
|
|
|
1445
1450
|
};
|
|
1446
1451
|
};
|
|
1447
1452
|
}
|
|
1453
|
+
/** An enabled server-side feature flag that affected a Play check. */
|
|
1454
|
+
interface PlayCheckFeatureFlag {
|
|
1455
|
+
id: string;
|
|
1456
|
+
label: string;
|
|
1457
|
+
enabled: true;
|
|
1458
|
+
reason: string;
|
|
1459
|
+
}
|
|
1448
1460
|
/**
|
|
1449
1461
|
* One exported play's check result inside a multi-play file. Carries the same
|
|
1450
1462
|
* per-play fields as {@link PlayCheckResult}, unprefixed and unaggregated, so a
|
|
@@ -1464,6 +1476,7 @@ interface PlayCheckExportResult {
|
|
|
1464
1476
|
graphHash?: string | null;
|
|
1465
1477
|
sourceHash?: string | null;
|
|
1466
1478
|
summary?: string;
|
|
1479
|
+
featureFlags?: PlayCheckFeatureFlag[];
|
|
1467
1480
|
recognized?: PlayCheckRecognizedSummary;
|
|
1468
1481
|
triggers?: PlayCheckTriggersSummary | null;
|
|
1469
1482
|
}
|
|
@@ -2498,6 +2511,24 @@ type TargetBillingStatusResult = {
|
|
|
2498
2511
|
pending_plan_sku: string | null;
|
|
2499
2512
|
as_of: string | null;
|
|
2500
2513
|
};
|
|
2514
|
+
type TargetAutoRechargeResult = {
|
|
2515
|
+
org_id: string;
|
|
2516
|
+
enabled: boolean;
|
|
2517
|
+
available: boolean;
|
|
2518
|
+
reason: string | null;
|
|
2519
|
+
threshold_credits: number | null;
|
|
2520
|
+
refill_to_credits: number | null;
|
|
2521
|
+
rolling_limit_cents: null;
|
|
2522
|
+
};
|
|
2523
|
+
type TargetAutoRechargeUpdateOptions = {
|
|
2524
|
+
enabled: false;
|
|
2525
|
+
idempotencyKey: string;
|
|
2526
|
+
} | {
|
|
2527
|
+
enabled: true;
|
|
2528
|
+
thresholdCredits: number;
|
|
2529
|
+
refillToCredits: number;
|
|
2530
|
+
idempotencyKey: string;
|
|
2531
|
+
};
|
|
2501
2532
|
type TargetBillingMutationResult = {
|
|
2502
2533
|
data: Record<string, unknown>;
|
|
2503
2534
|
operation: TargetBillingOperation;
|
|
@@ -2617,6 +2648,11 @@ type BillingNamespace = {
|
|
|
2617
2648
|
targetPlans: () => Promise<TargetBillingPlansResult>;
|
|
2618
2649
|
/** Normalized target billing state. */
|
|
2619
2650
|
targetStatus: () => Promise<TargetBillingStatusResult>;
|
|
2651
|
+
/** Read and manage the Metronome-backed automatic recharge configuration. */
|
|
2652
|
+
autoRecharge: {
|
|
2653
|
+
get: () => Promise<TargetAutoRechargeResult>;
|
|
2654
|
+
update: (options: TargetAutoRechargeUpdateOptions) => Promise<TargetAutoRechargeResult>;
|
|
2655
|
+
};
|
|
2620
2656
|
/** Buy Deepline credits through a payment-gated Metronome commit. */
|
|
2621
2657
|
purchaseCredits: (options: {
|
|
2622
2658
|
credits: number;
|
|
@@ -3662,6 +3698,10 @@ declare class DeeplineClient {
|
|
|
3662
3698
|
getTargetBillingPlans(): Promise<TargetBillingPlansResult>;
|
|
3663
3699
|
/** Read the workspace's normalized target plan, payment, and balance state. */
|
|
3664
3700
|
getTargetBillingStatus(): Promise<TargetBillingStatusResult>;
|
|
3701
|
+
/** Read the canonical Metronome automatic recharge configuration. */
|
|
3702
|
+
getTargetAutoRecharge(): Promise<TargetAutoRechargeResult>;
|
|
3703
|
+
/** Update automatic recharge and return the server-verified configuration. */
|
|
3704
|
+
updateTargetAutoRecharge(options: TargetAutoRechargeUpdateOptions): Promise<TargetAutoRechargeResult>;
|
|
3665
3705
|
/**
|
|
3666
3706
|
* Purchase target-billing credits through the durable commercial operation
|
|
3667
3707
|
* flow. The caller supplies an idempotency key for safe retries.
|
package/dist/index.js
CHANGED
|
@@ -783,7 +783,7 @@ var SDK_RELEASE = {
|
|
|
783
783
|
// 0.3.0 introduces raw-v2: complete scrubbed provider responses are
|
|
784
784
|
// available at toolResponse.rawV2 while toolResponse.raw and all declared
|
|
785
785
|
// getters keep their established compatibility behavior.
|
|
786
|
-
version: "0.3.
|
|
786
|
+
version: "0.3.23",
|
|
787
787
|
updateSummary: "New raw-v2 tool responses preserve complete scrubbed provider envelopes at toolResponse.rawV2, including JSON:API included resources, links, cursors, and totals. Existing toolResponse.raw and declared getters keep working unchanged.",
|
|
788
788
|
contracts: {
|
|
789
789
|
api: {
|
|
@@ -4358,6 +4358,10 @@ var DeeplineClient = class {
|
|
|
4358
4358
|
},
|
|
4359
4359
|
targetPlans: () => this.getTargetBillingPlans(),
|
|
4360
4360
|
targetStatus: () => this.getTargetBillingStatus(),
|
|
4361
|
+
autoRecharge: {
|
|
4362
|
+
get: () => this.getTargetAutoRecharge(),
|
|
4363
|
+
update: (options2) => this.updateTargetAutoRecharge(options2)
|
|
4364
|
+
},
|
|
4361
4365
|
purchaseCredits: (options2) => this.purchaseTargetBillingCredits(options2),
|
|
4362
4366
|
transitionPlan: (options2) => this.transitionTargetBillingPlan(options2),
|
|
4363
4367
|
portalSession: () => this.createTargetBillingPortalSession()
|
|
@@ -6443,6 +6447,28 @@ var DeeplineClient = class {
|
|
|
6443
6447
|
async getTargetBillingStatus() {
|
|
6444
6448
|
return this.http.get("/api/v2/billing/status");
|
|
6445
6449
|
}
|
|
6450
|
+
/** Read the canonical Metronome automatic recharge configuration. */
|
|
6451
|
+
async getTargetAutoRecharge() {
|
|
6452
|
+
return this.http.get(
|
|
6453
|
+
"/api/v2/billing/auto-recharge"
|
|
6454
|
+
);
|
|
6455
|
+
}
|
|
6456
|
+
/** Update automatic recharge and return the server-verified configuration. */
|
|
6457
|
+
async updateTargetAutoRecharge(options) {
|
|
6458
|
+
const idempotencyKey = requireTargetBillingIdempotencyKey(
|
|
6459
|
+
options.idempotencyKey
|
|
6460
|
+
);
|
|
6461
|
+
const response = await this.http.put(
|
|
6462
|
+
"/api/v2/billing/auto-recharge",
|
|
6463
|
+
options.enabled ? {
|
|
6464
|
+
enabled: true,
|
|
6465
|
+
threshold_credits: options.thresholdCredits,
|
|
6466
|
+
refill_to_credits: options.refillToCredits
|
|
6467
|
+
} : { enabled: false },
|
|
6468
|
+
{ "Idempotency-Key": idempotencyKey }
|
|
6469
|
+
);
|
|
6470
|
+
return response.data;
|
|
6471
|
+
}
|
|
6446
6472
|
/**
|
|
6447
6473
|
* Purchase target-billing credits through the durable commercial operation
|
|
6448
6474
|
* flow. The caller supplies an idempotency key for safe retries.
|
package/dist/index.mjs
CHANGED
|
@@ -706,7 +706,7 @@ var SDK_RELEASE = {
|
|
|
706
706
|
// 0.3.0 introduces raw-v2: complete scrubbed provider responses are
|
|
707
707
|
// available at toolResponse.rawV2 while toolResponse.raw and all declared
|
|
708
708
|
// getters keep their established compatibility behavior.
|
|
709
|
-
version: "0.3.
|
|
709
|
+
version: "0.3.23",
|
|
710
710
|
updateSummary: "New raw-v2 tool responses preserve complete scrubbed provider envelopes at toolResponse.rawV2, including JSON:API included resources, links, cursors, and totals. Existing toolResponse.raw and declared getters keep working unchanged.",
|
|
711
711
|
contracts: {
|
|
712
712
|
api: {
|
|
@@ -4281,6 +4281,10 @@ var DeeplineClient = class {
|
|
|
4281
4281
|
},
|
|
4282
4282
|
targetPlans: () => this.getTargetBillingPlans(),
|
|
4283
4283
|
targetStatus: () => this.getTargetBillingStatus(),
|
|
4284
|
+
autoRecharge: {
|
|
4285
|
+
get: () => this.getTargetAutoRecharge(),
|
|
4286
|
+
update: (options2) => this.updateTargetAutoRecharge(options2)
|
|
4287
|
+
},
|
|
4284
4288
|
purchaseCredits: (options2) => this.purchaseTargetBillingCredits(options2),
|
|
4285
4289
|
transitionPlan: (options2) => this.transitionTargetBillingPlan(options2),
|
|
4286
4290
|
portalSession: () => this.createTargetBillingPortalSession()
|
|
@@ -6366,6 +6370,28 @@ var DeeplineClient = class {
|
|
|
6366
6370
|
async getTargetBillingStatus() {
|
|
6367
6371
|
return this.http.get("/api/v2/billing/status");
|
|
6368
6372
|
}
|
|
6373
|
+
/** Read the canonical Metronome automatic recharge configuration. */
|
|
6374
|
+
async getTargetAutoRecharge() {
|
|
6375
|
+
return this.http.get(
|
|
6376
|
+
"/api/v2/billing/auto-recharge"
|
|
6377
|
+
);
|
|
6378
|
+
}
|
|
6379
|
+
/** Update automatic recharge and return the server-verified configuration. */
|
|
6380
|
+
async updateTargetAutoRecharge(options) {
|
|
6381
|
+
const idempotencyKey = requireTargetBillingIdempotencyKey(
|
|
6382
|
+
options.idempotencyKey
|
|
6383
|
+
);
|
|
6384
|
+
const response = await this.http.put(
|
|
6385
|
+
"/api/v2/billing/auto-recharge",
|
|
6386
|
+
options.enabled ? {
|
|
6387
|
+
enabled: true,
|
|
6388
|
+
threshold_credits: options.thresholdCredits,
|
|
6389
|
+
refill_to_credits: options.refillToCredits
|
|
6390
|
+
} : { enabled: false },
|
|
6391
|
+
{ "Idempotency-Key": idempotencyKey }
|
|
6392
|
+
);
|
|
6393
|
+
return response.data;
|
|
6394
|
+
}
|
|
6369
6395
|
/**
|
|
6370
6396
|
* Purchase target-billing credits through the durable commercial operation
|
|
6371
6397
|
* flow. The caller supplies an idempotency key for safe retries.
|