@autohq/cli 0.1.360 → 0.1.361

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.
@@ -23492,7 +23492,7 @@ Object.assign(lookup, {
23492
23492
  // package.json
23493
23493
  var package_default = {
23494
23494
  name: "@autohq/cli",
23495
- version: "0.1.360",
23495
+ version: "0.1.361",
23496
23496
  license: "SEE LICENSE IN README.md",
23497
23497
  publishConfig: {
23498
23498
  access: "public"
@@ -24190,6 +24190,8 @@ var AuthScopeSchema = external_exports.enum([
24190
24190
  "provider_grants:write",
24191
24191
  "provider_grants:use",
24192
24192
  "members:read",
24193
+ "billing:read",
24194
+ "billing:write",
24193
24195
  "secrets:read",
24194
24196
  "secrets:write",
24195
24197
  "secrets:use",
@@ -27929,6 +27931,89 @@ var OrganizationIdentityPolicySchema = external_exports.object({
27929
27931
  });
27930
27932
  var UpdateOrganizationIdentityPolicyRequestSchema = OrganizationIdentityPolicySchema.strict();
27931
27933
 
27934
+ // ../../packages/schemas/src/billing.ts
27935
+ var FEE_CARD_2026_07_06 = {
27936
+ version: "2026-07-06",
27937
+ effectiveAt: "2026-07-06T00:00:00.000Z",
27938
+ feeRate: 0.05
27939
+ };
27940
+ var BILLING_FEE_CARDS = {
27941
+ [FEE_CARD_2026_07_06.version]: FEE_CARD_2026_07_06
27942
+ };
27943
+ var CURRENT_BILLING_FEE_VERSION = FEE_CARD_2026_07_06.version;
27944
+ var CREDIT_EVENT_TYPES = [
27945
+ "signup_grant",
27946
+ "purchase",
27947
+ "auto_topup",
27948
+ "adjustment"
27949
+ ];
27950
+ var CreditEventTypeSchema = external_exports.enum(CREDIT_EVENT_TYPES);
27951
+ var UsdAmountSchema = external_exports.number().finite();
27952
+ var NonNegativeUsdSchema = external_exports.number().finite().nonnegative();
27953
+ var PositiveUsdSchema = external_exports.number().finite().positive();
27954
+ var CreditEventSchema = external_exports.object({
27955
+ organizationId: OrganizationIdSchema,
27956
+ type: CreditEventTypeSchema,
27957
+ amountUsd: UsdAmountSchema,
27958
+ description: external_exports.string().trim().min(1).nullable().default(null),
27959
+ // The acting user for manual purchases/adjustments; null for system-issued
27960
+ // rows (signup grants, auto-top-ups).
27961
+ createdByUserId: external_exports.string().trim().min(1).nullable().default(null)
27962
+ }).refine(
27963
+ (event) => event.type === "adjustment" || event.amountUsd > 0,
27964
+ "Only adjustment credit events may carry a non-positive amount"
27965
+ );
27966
+ var CreditEventRecordSchema = external_exports.object({
27967
+ id: external_exports.string().trim().min(1),
27968
+ organizationId: OrganizationIdSchema,
27969
+ type: CreditEventTypeSchema,
27970
+ amountUsd: UsdAmountSchema,
27971
+ description: external_exports.string().trim().min(1).nullable(),
27972
+ createdByUserId: external_exports.string().trim().min(1).nullable(),
27973
+ createdAt: external_exports.string().datetime()
27974
+ });
27975
+ var SPENDING_LIMIT_WINDOWS = ["hour", "day", "week", "month"];
27976
+ var SpendingLimitWindowSchema = external_exports.enum(SPENDING_LIMIT_WINDOWS);
27977
+ var BilledSpendWindowsSchema = external_exports.object({
27978
+ hourUsd: NonNegativeUsdSchema,
27979
+ dayUsd: NonNegativeUsdSchema,
27980
+ weekUsd: NonNegativeUsdSchema,
27981
+ monthUsd: NonNegativeUsdSchema
27982
+ });
27983
+ var OrganizationBillingSettingsSchema = external_exports.object({
27984
+ organizationId: OrganizationIdSchema,
27985
+ // Null means no limit for that window.
27986
+ spendLimitHourUsd: PositiveUsdSchema.nullable(),
27987
+ spendLimitDayUsd: PositiveUsdSchema.nullable(),
27988
+ spendLimitWeekUsd: PositiveUsdSchema.nullable(),
27989
+ spendLimitMonthUsd: PositiveUsdSchema.nullable(),
27990
+ autoTopUpEnabled: external_exports.boolean(),
27991
+ // Balance at or below the threshold triggers a top-up of the configured
27992
+ // amount. Both must be set for auto-top-up to arm.
27993
+ autoTopUpThresholdUsd: NonNegativeUsdSchema.nullable(),
27994
+ autoTopUpAmountUsd: PositiveUsdSchema.nullable()
27995
+ });
27996
+ var UpdateOrganizationBillingSettingsRequestSchema = external_exports.object({
27997
+ spendLimitHourUsd: PositiveUsdSchema.nullable().optional(),
27998
+ spendLimitDayUsd: PositiveUsdSchema.nullable().optional(),
27999
+ spendLimitWeekUsd: PositiveUsdSchema.nullable().optional(),
28000
+ spendLimitMonthUsd: PositiveUsdSchema.nullable().optional(),
28001
+ autoTopUpEnabled: external_exports.boolean().optional(),
28002
+ autoTopUpThresholdUsd: NonNegativeUsdSchema.nullable().optional(),
28003
+ autoTopUpAmountUsd: PositiveUsdSchema.nullable().optional()
28004
+ }).strict();
28005
+ var OrganizationCreditsResponseSchema = external_exports.object({
28006
+ organizationId: OrganizationIdSchema,
28007
+ balanceUsd: UsdAmountSchema,
28008
+ totalCreditsUsd: UsdAmountSchema,
28009
+ totalBilledUsageUsd: NonNegativeUsdSchema,
28010
+ events: external_exports.array(CreditEventRecordSchema)
28011
+ });
28012
+ var AddOrganizationCreditsRequestSchema = external_exports.object({
28013
+ amountUsd: PositiveUsdSchema.max(1e4),
28014
+ description: external_exports.string().trim().min(1).max(500).optional()
28015
+ }).strict();
28016
+
27932
28017
  // ../../packages/schemas/src/pricing.ts
27933
28018
  var RATE_CARD_2026_06_23 = {
27934
28019
  version: "2026-06-23",
@@ -36705,7 +36790,7 @@ var ModelCredentialFundingSourceSchema = external_exports.enum([
36705
36790
  "tenant_provider_grant"
36706
36791
  ]);
36707
36792
  var NonNegativeTokenCountSchema = external_exports.number().int().nonnegative();
36708
- var NonNegativeUsdSchema = external_exports.number().nonnegative();
36793
+ var NonNegativeUsdSchema2 = external_exports.number().nonnegative();
36709
36794
  var UsageEventSchema = external_exports.object({
36710
36795
  // Tenant + lineage attribution. projectId is nullable because a resource can
36711
36796
  // belong directly to an organization with no project.
@@ -36724,11 +36809,16 @@ var UsageEventSchema = external_exports.object({
36724
36809
  cacheReadTokens: NonNegativeTokenCountSchema,
36725
36810
  // The provider's own cost when it reports one, kept only for reconciliation.
36726
36811
  // Nullable/absent because it can be 0 or missing — never the billing source.
36727
- providerCostUsd: NonNegativeUsdSchema.nullable(),
36812
+ providerCostUsd: NonNegativeUsdSchema2.nullable(),
36728
36813
  // Platform-derived cost and the rate-card version it was derived under, so a
36729
36814
  // later rate-card change never silently rewrites historical cost.
36730
- derivedCostUsd: NonNegativeUsdSchema,
36815
+ derivedCostUsd: NonNegativeUsdSchema2,
36731
36816
  pricingVersion: external_exports.string().trim().min(1),
36817
+ // What this call debits from the organization's credit balance, and the fee
36818
+ // card it was derived under (see `./billing`). Required — a writer that
36819
+ // forgets it would silently record unbilled usage, so there is no default.
36820
+ billedCostUsd: NonNegativeUsdSchema2,
36821
+ billingFeeVersion: external_exports.string().trim().min(1),
36732
36822
  // Historical funding attribution for the model call. The provider grant id is
36733
36823
  // denormalized and nullable for platform-funded usage, matching the ledger's
36734
36824
  // no-FK audit-trail contract.
@@ -36750,7 +36840,7 @@ var UsageTotalsSchema = external_exports.object({
36750
36840
  cacheCreationTokens: NonNegativeTokenCountSchema,
36751
36841
  cacheReadTokens: NonNegativeTokenCountSchema,
36752
36842
  totalTokens: NonNegativeTokenCountSchema,
36753
- derivedCostUsd: NonNegativeUsdSchema
36843
+ billedCostUsd: NonNegativeUsdSchema2
36754
36844
  });
36755
36845
  var SessionUsageModelSummarySchema = UsageTotalsSchema.extend({
36756
36846
  model: external_exports.string().trim().min(1)
@@ -36784,11 +36874,11 @@ var ProjectUsageModelSummarySchema = UsageTotalsSchema.extend({
36784
36874
  });
36785
36875
  var ProjectUsageDayAgentSliceSchema = external_exports.object({
36786
36876
  agentResourceId: external_exports.string().trim().min(1),
36787
- derivedCostUsd: NonNegativeUsdSchema
36877
+ billedCostUsd: NonNegativeUsdSchema2
36788
36878
  });
36789
36879
  var ProjectUsageDayModelSliceSchema = external_exports.object({
36790
36880
  model: external_exports.string().trim().min(1),
36791
- derivedCostUsd: NonNegativeUsdSchema
36881
+ billedCostUsd: NonNegativeUsdSchema2
36792
36882
  });
36793
36883
  var ProjectUsageDayPointSchema = UsageTotalsSchema.extend({
36794
36884
  date: UtcDateSchema,
package/dist/index.js CHANGED
@@ -15424,6 +15424,8 @@ var init_auth = __esm({
15424
15424
  "provider_grants:write",
15425
15425
  "provider_grants:use",
15426
15426
  "members:read",
15427
+ "billing:read",
15428
+ "billing:write",
15427
15429
  "secrets:read",
15428
15430
  "secrets:write",
15429
15431
  "secrets:use",
@@ -19554,6 +19556,97 @@ var init_organization_settings = __esm({
19554
19556
  }
19555
19557
  });
19556
19558
 
19559
+ // ../../packages/schemas/src/billing.ts
19560
+ var FEE_CARD_2026_07_06, BILLING_FEE_CARDS, CURRENT_BILLING_FEE_VERSION, CREDIT_EVENT_TYPES, CreditEventTypeSchema, UsdAmountSchema, NonNegativeUsdSchema, PositiveUsdSchema, CreditEventSchema, CreditEventRecordSchema, SPENDING_LIMIT_WINDOWS, SpendingLimitWindowSchema, BilledSpendWindowsSchema, OrganizationBillingSettingsSchema, UpdateOrganizationBillingSettingsRequestSchema, OrganizationCreditsResponseSchema, AddOrganizationCreditsRequestSchema;
19561
+ var init_billing = __esm({
19562
+ "../../packages/schemas/src/billing.ts"() {
19563
+ "use strict";
19564
+ init_zod();
19565
+ init_ids();
19566
+ FEE_CARD_2026_07_06 = {
19567
+ version: "2026-07-06",
19568
+ effectiveAt: "2026-07-06T00:00:00.000Z",
19569
+ feeRate: 0.05
19570
+ };
19571
+ BILLING_FEE_CARDS = {
19572
+ [FEE_CARD_2026_07_06.version]: FEE_CARD_2026_07_06
19573
+ };
19574
+ CURRENT_BILLING_FEE_VERSION = FEE_CARD_2026_07_06.version;
19575
+ CREDIT_EVENT_TYPES = [
19576
+ "signup_grant",
19577
+ "purchase",
19578
+ "auto_topup",
19579
+ "adjustment"
19580
+ ];
19581
+ CreditEventTypeSchema = external_exports.enum(CREDIT_EVENT_TYPES);
19582
+ UsdAmountSchema = external_exports.number().finite();
19583
+ NonNegativeUsdSchema = external_exports.number().finite().nonnegative();
19584
+ PositiveUsdSchema = external_exports.number().finite().positive();
19585
+ CreditEventSchema = external_exports.object({
19586
+ organizationId: OrganizationIdSchema,
19587
+ type: CreditEventTypeSchema,
19588
+ amountUsd: UsdAmountSchema,
19589
+ description: external_exports.string().trim().min(1).nullable().default(null),
19590
+ // The acting user for manual purchases/adjustments; null for system-issued
19591
+ // rows (signup grants, auto-top-ups).
19592
+ createdByUserId: external_exports.string().trim().min(1).nullable().default(null)
19593
+ }).refine(
19594
+ (event) => event.type === "adjustment" || event.amountUsd > 0,
19595
+ "Only adjustment credit events may carry a non-positive amount"
19596
+ );
19597
+ CreditEventRecordSchema = external_exports.object({
19598
+ id: external_exports.string().trim().min(1),
19599
+ organizationId: OrganizationIdSchema,
19600
+ type: CreditEventTypeSchema,
19601
+ amountUsd: UsdAmountSchema,
19602
+ description: external_exports.string().trim().min(1).nullable(),
19603
+ createdByUserId: external_exports.string().trim().min(1).nullable(),
19604
+ createdAt: external_exports.string().datetime()
19605
+ });
19606
+ SPENDING_LIMIT_WINDOWS = ["hour", "day", "week", "month"];
19607
+ SpendingLimitWindowSchema = external_exports.enum(SPENDING_LIMIT_WINDOWS);
19608
+ BilledSpendWindowsSchema = external_exports.object({
19609
+ hourUsd: NonNegativeUsdSchema,
19610
+ dayUsd: NonNegativeUsdSchema,
19611
+ weekUsd: NonNegativeUsdSchema,
19612
+ monthUsd: NonNegativeUsdSchema
19613
+ });
19614
+ OrganizationBillingSettingsSchema = external_exports.object({
19615
+ organizationId: OrganizationIdSchema,
19616
+ // Null means no limit for that window.
19617
+ spendLimitHourUsd: PositiveUsdSchema.nullable(),
19618
+ spendLimitDayUsd: PositiveUsdSchema.nullable(),
19619
+ spendLimitWeekUsd: PositiveUsdSchema.nullable(),
19620
+ spendLimitMonthUsd: PositiveUsdSchema.nullable(),
19621
+ autoTopUpEnabled: external_exports.boolean(),
19622
+ // Balance at or below the threshold triggers a top-up of the configured
19623
+ // amount. Both must be set for auto-top-up to arm.
19624
+ autoTopUpThresholdUsd: NonNegativeUsdSchema.nullable(),
19625
+ autoTopUpAmountUsd: PositiveUsdSchema.nullable()
19626
+ });
19627
+ UpdateOrganizationBillingSettingsRequestSchema = external_exports.object({
19628
+ spendLimitHourUsd: PositiveUsdSchema.nullable().optional(),
19629
+ spendLimitDayUsd: PositiveUsdSchema.nullable().optional(),
19630
+ spendLimitWeekUsd: PositiveUsdSchema.nullable().optional(),
19631
+ spendLimitMonthUsd: PositiveUsdSchema.nullable().optional(),
19632
+ autoTopUpEnabled: external_exports.boolean().optional(),
19633
+ autoTopUpThresholdUsd: NonNegativeUsdSchema.nullable().optional(),
19634
+ autoTopUpAmountUsd: PositiveUsdSchema.nullable().optional()
19635
+ }).strict();
19636
+ OrganizationCreditsResponseSchema = external_exports.object({
19637
+ organizationId: OrganizationIdSchema,
19638
+ balanceUsd: UsdAmountSchema,
19639
+ totalCreditsUsd: UsdAmountSchema,
19640
+ totalBilledUsageUsd: NonNegativeUsdSchema,
19641
+ events: external_exports.array(CreditEventRecordSchema)
19642
+ });
19643
+ AddOrganizationCreditsRequestSchema = external_exports.object({
19644
+ amountUsd: PositiveUsdSchema.max(1e4),
19645
+ description: external_exports.string().trim().min(1).max(500).optional()
19646
+ }).strict();
19647
+ }
19648
+ });
19649
+
19557
19650
  // ../../packages/schemas/src/pricing.ts
19558
19651
  function tier(inputUsdPerMtok, outputUsdPerMtok) {
19559
19652
  return {
@@ -28547,7 +28640,7 @@ var init_url_slugs = __esm({
28547
28640
  });
28548
28641
 
28549
28642
  // ../../packages/schemas/src/usage.ts
28550
- var UsageHarnessSchema, ModelCredentialFundingSourceSchema, NonNegativeTokenCountSchema, NonNegativeUsdSchema, UsageEventSchema, UsageEventRecordSchema, UsageTotalsSchema, SessionUsageModelSummarySchema, SessionUsageResponseSchema, PROJECT_USAGE_RANGE_KEYS, ProjectUsageRangeKeySchema, UtcDateSchema, ProjectUsageTotalsSchema, ProjectUsageAgentSummarySchema, ProjectUsageModelSummarySchema, ProjectUsageDayAgentSliceSchema, ProjectUsageDayModelSliceSchema, ProjectUsageDayPointSchema, ProjectUsageResponseSchema;
28643
+ var UsageHarnessSchema, ModelCredentialFundingSourceSchema, NonNegativeTokenCountSchema, NonNegativeUsdSchema2, UsageEventSchema, UsageEventRecordSchema, UsageTotalsSchema, SessionUsageModelSummarySchema, SessionUsageResponseSchema, PROJECT_USAGE_RANGE_KEYS, ProjectUsageRangeKeySchema, UtcDateSchema, ProjectUsageTotalsSchema, ProjectUsageAgentSummarySchema, ProjectUsageModelSummarySchema, ProjectUsageDayAgentSliceSchema, ProjectUsageDayModelSliceSchema, ProjectUsageDayPointSchema, ProjectUsageResponseSchema;
28551
28644
  var init_usage = __esm({
28552
28645
  "../../packages/schemas/src/usage.ts"() {
28553
28646
  "use strict";
@@ -28560,7 +28653,7 @@ var init_usage = __esm({
28560
28653
  "tenant_provider_grant"
28561
28654
  ]);
28562
28655
  NonNegativeTokenCountSchema = external_exports.number().int().nonnegative();
28563
- NonNegativeUsdSchema = external_exports.number().nonnegative();
28656
+ NonNegativeUsdSchema2 = external_exports.number().nonnegative();
28564
28657
  UsageEventSchema = external_exports.object({
28565
28658
  // Tenant + lineage attribution. projectId is nullable because a resource can
28566
28659
  // belong directly to an organization with no project.
@@ -28579,11 +28672,16 @@ var init_usage = __esm({
28579
28672
  cacheReadTokens: NonNegativeTokenCountSchema,
28580
28673
  // The provider's own cost when it reports one, kept only for reconciliation.
28581
28674
  // Nullable/absent because it can be 0 or missing — never the billing source.
28582
- providerCostUsd: NonNegativeUsdSchema.nullable(),
28675
+ providerCostUsd: NonNegativeUsdSchema2.nullable(),
28583
28676
  // Platform-derived cost and the rate-card version it was derived under, so a
28584
28677
  // later rate-card change never silently rewrites historical cost.
28585
- derivedCostUsd: NonNegativeUsdSchema,
28678
+ derivedCostUsd: NonNegativeUsdSchema2,
28586
28679
  pricingVersion: external_exports.string().trim().min(1),
28680
+ // What this call debits from the organization's credit balance, and the fee
28681
+ // card it was derived under (see `./billing`). Required — a writer that
28682
+ // forgets it would silently record unbilled usage, so there is no default.
28683
+ billedCostUsd: NonNegativeUsdSchema2,
28684
+ billingFeeVersion: external_exports.string().trim().min(1),
28587
28685
  // Historical funding attribution for the model call. The provider grant id is
28588
28686
  // denormalized and nullable for platform-funded usage, matching the ledger's
28589
28687
  // no-FK audit-trail contract.
@@ -28605,7 +28703,7 @@ var init_usage = __esm({
28605
28703
  cacheCreationTokens: NonNegativeTokenCountSchema,
28606
28704
  cacheReadTokens: NonNegativeTokenCountSchema,
28607
28705
  totalTokens: NonNegativeTokenCountSchema,
28608
- derivedCostUsd: NonNegativeUsdSchema
28706
+ billedCostUsd: NonNegativeUsdSchema2
28609
28707
  });
28610
28708
  SessionUsageModelSummarySchema = UsageTotalsSchema.extend({
28611
28709
  model: external_exports.string().trim().min(1)
@@ -28639,11 +28737,11 @@ var init_usage = __esm({
28639
28737
  });
28640
28738
  ProjectUsageDayAgentSliceSchema = external_exports.object({
28641
28739
  agentResourceId: external_exports.string().trim().min(1),
28642
- derivedCostUsd: NonNegativeUsdSchema
28740
+ billedCostUsd: NonNegativeUsdSchema2
28643
28741
  });
28644
28742
  ProjectUsageDayModelSliceSchema = external_exports.object({
28645
28743
  model: external_exports.string().trim().min(1),
28646
- derivedCostUsd: NonNegativeUsdSchema
28744
+ billedCostUsd: NonNegativeUsdSchema2
28647
28745
  });
28648
28746
  ProjectUsageDayPointSchema = UsageTotalsSchema.extend({
28649
28747
  date: UtcDateSchema,
@@ -28689,6 +28787,7 @@ var init_src = __esm({
28689
28787
  init_model_selection();
28690
28788
  init_mounts();
28691
28789
  init_organization_settings();
28790
+ init_billing();
28692
28791
  init_pricing();
28693
28792
  init_provider_grants();
28694
28793
  init_project_config();
@@ -31450,7 +31549,7 @@ var init_package = __esm({
31450
31549
  "package.json"() {
31451
31550
  package_default = {
31452
31551
  name: "@autohq/cli",
31453
- version: "0.1.360",
31552
+ version: "0.1.361",
31454
31553
  license: "SEE LICENSE IN README.md",
31455
31554
  publishConfig: {
31456
31555
  access: "public"
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@autohq/cli",
3
- "version": "0.1.360",
3
+ "version": "0.1.361",
4
4
  "license": "SEE LICENSE IN README.md",
5
5
  "publishConfig": {
6
6
  "access": "public"