@beacon-build/sdk 2.17.1 → 3.0.0
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/CHANGELOG.md +33 -0
- package/dist/clients/billing-requests.types.d.ts +48 -0
- package/dist/clients/billing-requests.types.d.ts.map +1 -0
- package/dist/clients/billing-requests.types.js +2 -0
- package/dist/clients/billing-requests.types.js.map +1 -0
- package/dist/clients/billing-seat-fees.types.d.ts +105 -0
- package/dist/clients/billing-seat-fees.types.d.ts.map +1 -0
- package/dist/clients/billing-seat-fees.types.js +2 -0
- package/dist/clients/billing-seat-fees.types.js.map +1 -0
- package/dist/clients/billing.client.d.ts +121 -0
- package/dist/clients/billing.client.d.ts.map +1 -0
- package/dist/clients/billing.client.js +116 -0
- package/dist/clients/billing.client.js.map +1 -0
- package/dist/clients/capture.client.d.ts +5 -1
- package/dist/clients/capture.client.d.ts.map +1 -1
- package/dist/clients/capture.client.js.map +1 -1
- package/dist/factory/agent-sdk.d.ts +5 -2
- package/dist/factory/agent-sdk.d.ts.map +1 -1
- package/dist/factory/agent-sdk.js +2 -1
- package/dist/factory/agent-sdk.js.map +1 -1
- package/dist/factory/tenant-agent-sdk.d.ts +27 -0
- package/dist/factory/tenant-agent-sdk.d.ts.map +1 -0
- package/dist/factory/tenant-agent-sdk.js +136 -0
- package/dist/factory/tenant-agent-sdk.js.map +1 -0
- package/dist/factory/user-sdk.d.ts +11 -0
- package/dist/factory/user-sdk.d.ts.map +1 -1
- package/dist/factory/user-sdk.js +16 -0
- package/dist/factory/user-sdk.js.map +1 -1
- package/dist/index.d.ts +7 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +8 -2
- package/dist/index.js.map +1 -1
- package/dist/manifest.negative-list.d.ts.map +1 -1
- package/dist/manifest.negative-list.js +11 -1
- package/dist/manifest.negative-list.js.map +1 -1
- package/dist/manifest.public-entries.d.ts +1 -1
- package/dist/manifest.public-entries.d.ts.map +1 -1
- package/dist/manifest.public-entries.js +3 -1
- package/dist/manifest.public-entries.js.map +1 -1
- package/dist/transport/errors.d.ts +7 -1
- package/dist/transport/errors.d.ts.map +1 -1
- package/dist/transport/errors.js +6 -1
- package/dist/transport/errors.js.map +1 -1
- package/dist/transport/http-client.d.ts +14 -2
- package/dist/transport/http-client.d.ts.map +1 -1
- package/dist/transport/http-client.js +24 -10
- package/dist/transport/http-client.js.map +1 -1
- package/dist/transport/request-origin.d.ts +44 -0
- package/dist/transport/request-origin.d.ts.map +1 -0
- package/dist/transport/request-origin.js +99 -0
- package/dist/transport/request-origin.js.map +1 -0
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,38 @@
|
|
|
1
1
|
# @beacon-build/sdk Changelog
|
|
2
2
|
|
|
3
|
+
## 3.0.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- b32af03: F564 seat fees & gating (FS64-B): seat tiers from the role history (highest role held in the month), fee-bearing periods (trial free, pro-rata start/reactivation month, deploy-backfill start), company/personal seat fees with forecast and cost-centre allocation, invoice positions (first, monthly, reactivation; credits carried), write-once seat snapshots with the billing-tier-snapshot / billing-start-snapshot workers, GET /api/v1/billing/seat-fees and /billing/entities (scoped) + SDK, company-wide contributor gating on every org-role write path with ceiling degradation, onboarding Solo/Community choice, readable gating errors in the org administration. The SDK reads apiCode also from the nested { error: { code } } envelope. `@beacon-build/ops`'s `clean-completed-jobs.mjs` gains the new `billing-tier-snapshot`/`billing-start-snapshot` queue names to its known-queues cleanup list.
|
|
8
|
+
- 14ea748: FS64 billing read side and model spend. C907: billable windows (activation periods ∩ metering start ∩ inactive cut) shared by seat fees, the new GET /api/v1/billing/requests read API (+ SDK `billing.getBillableRequests`) and a fail-closed monthly request compaction (`billing_request_months`, 35-day minute detail, 10-year aggregate). F567: Cost Cockpit with two tabs — "Platform-Gebühr" (default; tier/segment, billable requests human vs agents, seat fee to date + forecast, collar band, seat table, read-only price table editable by vendors, requests drilldown person → agent → project, org-admin link) and "Modell-Spend (BYOK)" with spend-vs-budget; seat-fee read carries the period price version and the company-fee forecast. F706: payment method per turn (`api_key | oauth_quota | unknown`) and quota account on messages, ledger and rollup; reconcile never treats OAuth-quota turns as unpriced; BYOK payment split, quota cards and quota settings (`quota.config`), GET /api/v1/usage/quota; budget DM notifier, user/org budgets and weekly periods.
|
|
9
|
+
|
|
10
|
+
### Patch Changes
|
|
11
|
+
|
|
12
|
+
- 23d25e1: F709: add the new public asset read route and asset content route to the API<->SDK negative list — both are browser byte streams with no SDK method, verified by the INV-3 drift test.
|
|
13
|
+
- Updated dependencies [27eb246]
|
|
14
|
+
- Updated dependencies [55a8d7d]
|
|
15
|
+
- Updated dependencies [b32af03]
|
|
16
|
+
- Updated dependencies [e952551]
|
|
17
|
+
- Updated dependencies [9514f22]
|
|
18
|
+
- Updated dependencies [14ea748]
|
|
19
|
+
- Updated dependencies [02227ba]
|
|
20
|
+
- Updated dependencies [23d25e1]
|
|
21
|
+
- Updated dependencies [b1cb09c]
|
|
22
|
+
- @beacon-build/core@3.0.0
|
|
23
|
+
|
|
24
|
+
## 2.18.0
|
|
25
|
+
|
|
26
|
+
### Minor Changes
|
|
27
|
+
|
|
28
|
+
- aee9435: feat(auth): tenant credential foundation on the F691 authorization server (B987) — OAuth client secrets are stored as scrypt hashes (async compareClientSecret override, legacy plaintext verified until the one-shot rehash data pass); new `agent_tokens` table and tenant-API-key columns on `oauth_clients`; primitives to create tenant API keys, mint 8h AS-signed tenant tokens and revoke them (DB-authoritative + Redis deny entry, cross-replica); `/v1/oauth/token-exchange` gains a fail-closed `tenant-agent` branch that mints agent tokens carrying `onBehalfOfUserId` + `tenantCredential` from the credential row; `extraTokenClaims` fails loud instead of issuing claimless tokens; SDK `createTenantAgentClient` performs exchange + refresh transparently.
|
|
29
|
+
|
|
30
|
+
### Patch Changes
|
|
31
|
+
|
|
32
|
+
- Updated dependencies [aee9435]
|
|
33
|
+
- Updated dependencies [e533e94]
|
|
34
|
+
- @beacon-build/core@2.18.0
|
|
35
|
+
|
|
3
36
|
## 2.17.1
|
|
4
37
|
|
|
5
38
|
### Patch Changes
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* C907 AC-6 — wire types of `GET /api/v1/billing/requests`: billable requests of one billing
|
|
3
|
+
* entity × UTC month, final (reconciled) vs. provisional, per person / agent / project / cost
|
|
4
|
+
* centre, plus the coverage gap (`unattributed`).
|
|
5
|
+
*/
|
|
6
|
+
import type { SeatFeesQuery } from './billing-seat-fees.types.js';
|
|
7
|
+
/** Same addressing as the seat-fee read (C907 D7 default without billingOrgId / userId). */
|
|
8
|
+
export type BillableRequestsQuery = SeatFeesQuery;
|
|
9
|
+
export interface ProjectRequestsDto {
|
|
10
|
+
project: string;
|
|
11
|
+
requests: number;
|
|
12
|
+
}
|
|
13
|
+
export interface BillableRequestsPersonDto {
|
|
14
|
+
userId: string;
|
|
15
|
+
billableFinal: number;
|
|
16
|
+
billableProvisional: number;
|
|
17
|
+
human: number;
|
|
18
|
+
agents: Array<{
|
|
19
|
+
agentId: string;
|
|
20
|
+
name: string;
|
|
21
|
+
requests: number;
|
|
22
|
+
byProject: ProjectRequestsDto[];
|
|
23
|
+
}>;
|
|
24
|
+
byProject: ProjectRequestsDto[];
|
|
25
|
+
byCostCenter: Array<{
|
|
26
|
+
orgId: string;
|
|
27
|
+
requests: number;
|
|
28
|
+
}>;
|
|
29
|
+
}
|
|
30
|
+
export interface BillableRequestsDto {
|
|
31
|
+
period: string;
|
|
32
|
+
billingEntity: {
|
|
33
|
+
type: 'org' | 'user';
|
|
34
|
+
id: string;
|
|
35
|
+
};
|
|
36
|
+
isFinal: boolean;
|
|
37
|
+
reconciledThrough: string | null;
|
|
38
|
+
persons: BillableRequestsPersonDto[];
|
|
39
|
+
unattributed: {
|
|
40
|
+
requests: number;
|
|
41
|
+
};
|
|
42
|
+
totals: {
|
|
43
|
+
billableFinal: number;
|
|
44
|
+
billableProvisional: number;
|
|
45
|
+
unattributed: number;
|
|
46
|
+
};
|
|
47
|
+
}
|
|
48
|
+
//# sourceMappingURL=billing-requests.types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"billing-requests.types.d.ts","sourceRoot":"","sources":["../../src/clients/billing-requests.types.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,8BAA8B,CAAA;AAEjE,4FAA4F;AAC5F,MAAM,MAAM,qBAAqB,GAAG,aAAa,CAAA;AAEjD,MAAM,WAAW,kBAAkB;IAC/B,OAAO,EAAE,MAAM,CAAA;IACf,QAAQ,EAAE,MAAM,CAAA;CACnB;AAED,MAAM,WAAW,yBAAyB;IACtC,MAAM,EAAE,MAAM,CAAA;IACd,aAAa,EAAE,MAAM,CAAA;IACrB,mBAAmB,EAAE,MAAM,CAAA;IAC3B,KAAK,EAAE,MAAM,CAAA;IACb,MAAM,EAAE,KAAK,CAAC;QACV,OAAO,EAAE,MAAM,CAAA;QACf,IAAI,EAAE,MAAM,CAAA;QACZ,QAAQ,EAAE,MAAM,CAAA;QAChB,SAAS,EAAE,kBAAkB,EAAE,CAAA;KAClC,CAAC,CAAA;IACF,SAAS,EAAE,kBAAkB,EAAE,CAAA;IAC/B,YAAY,EAAE,KAAK,CAAC;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,QAAQ,EAAE,MAAM,CAAA;KAAE,CAAC,CAAA;CAC3D;AAED,MAAM,WAAW,mBAAmB;IAChC,MAAM,EAAE,MAAM,CAAA;IACd,aAAa,EAAE;QAAE,IAAI,EAAE,KAAK,GAAG,MAAM,CAAC;QAAC,EAAE,EAAE,MAAM,CAAA;KAAE,CAAA;IACnD,OAAO,EAAE,OAAO,CAAA;IAChB,iBAAiB,EAAE,MAAM,GAAG,IAAI,CAAA;IAChC,OAAO,EAAE,yBAAyB,EAAE,CAAA;IACpC,YAAY,EAAE;QAAE,QAAQ,EAAE,MAAM,CAAA;KAAE,CAAA;IAClC,MAAM,EAAE;QAAE,aAAa,EAAE,MAAM,CAAC;QAAC,mBAAmB,EAAE,MAAM,CAAC;QAAC,YAAY,EAAE,MAAM,CAAA;KAAE,CAAA;CACvF"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"billing-requests.types.js","sourceRoot":"","sources":["../../src/clients/billing-requests.types.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* F564 Scope 8 — wire types of `GET /api/v1/billing/seat-fees` and `GET /api/v1/billing/entities`
|
|
3
|
+
* (canonical field names, amounts as 2-digit decimal strings, ISO instants).
|
|
4
|
+
*/
|
|
5
|
+
import type { BillingStatusValue, InactiveReasonValue } from './billing.client.js';
|
|
6
|
+
export type LadderRoleDto = 'viewer' | 'reviewer' | 'contributor';
|
|
7
|
+
export type BillingTierDto = 'viewer' | 'community' | 'solo' | 'org_contributor' | 'org_reviewer';
|
|
8
|
+
export interface InvoiceDto {
|
|
9
|
+
invoiceDate: string | null;
|
|
10
|
+
isFirstInvoice: boolean;
|
|
11
|
+
isReactivationInvoice: boolean;
|
|
12
|
+
hasPositions: boolean;
|
|
13
|
+
advanceFloorChf: string | null;
|
|
14
|
+
trueUpChf: string | null;
|
|
15
|
+
creditBroughtForwardChf: string;
|
|
16
|
+
amountDueChf: string;
|
|
17
|
+
creditCarriedChf: string;
|
|
18
|
+
}
|
|
19
|
+
export interface SeatFeePersonDto {
|
|
20
|
+
userId: string;
|
|
21
|
+
name: string;
|
|
22
|
+
tier: BillingTierDto;
|
|
23
|
+
highestRoleSource: Array<{
|
|
24
|
+
orgId: string;
|
|
25
|
+
role: LadderRoleDto;
|
|
26
|
+
}>;
|
|
27
|
+
departmentRoles: Array<{
|
|
28
|
+
orgId: string;
|
|
29
|
+
orgName: string | null;
|
|
30
|
+
role: LadderRoleDto;
|
|
31
|
+
heldUntil: string | null;
|
|
32
|
+
}>;
|
|
33
|
+
requests: number;
|
|
34
|
+
feeChf: string;
|
|
35
|
+
forecastFeeChf: string | null;
|
|
36
|
+
byCostCenter: Array<{
|
|
37
|
+
orgId: string;
|
|
38
|
+
requests: number;
|
|
39
|
+
feeShareChf: string;
|
|
40
|
+
}>;
|
|
41
|
+
}
|
|
42
|
+
export interface SeatFeesDto {
|
|
43
|
+
period: string;
|
|
44
|
+
isFinal: boolean;
|
|
45
|
+
billingEntity: {
|
|
46
|
+
type: 'org' | 'user';
|
|
47
|
+
id: string;
|
|
48
|
+
name: string;
|
|
49
|
+
billingStatus: BillingStatusValue;
|
|
50
|
+
inactiveReason: InactiveReasonValue | null;
|
|
51
|
+
trialEndsAt: string | null;
|
|
52
|
+
billingStartsAt: string | null;
|
|
53
|
+
reactivatedAt: string | null;
|
|
54
|
+
proRataDays: number | null;
|
|
55
|
+
proRataFactor: string | null;
|
|
56
|
+
firstInvoiceChf: string | null;
|
|
57
|
+
cancelEffectiveAt: string | null;
|
|
58
|
+
};
|
|
59
|
+
orgFee: {
|
|
60
|
+
sum: string;
|
|
61
|
+
total: string;
|
|
62
|
+
floorApplied: boolean;
|
|
63
|
+
/** Company fee at month end — running month only, else `null`. */
|
|
64
|
+
forecastTotal: string | null;
|
|
65
|
+
} | null;
|
|
66
|
+
/** The price version in effect for this period (collar formula / band). */
|
|
67
|
+
pricing: {
|
|
68
|
+
version: number;
|
|
69
|
+
unitPriceChf: string;
|
|
70
|
+
tiers: Array<{
|
|
71
|
+
tier: BillingTierDto;
|
|
72
|
+
floorChf: string;
|
|
73
|
+
capChf: string;
|
|
74
|
+
}>;
|
|
75
|
+
};
|
|
76
|
+
invoice: InvoiceDto | null;
|
|
77
|
+
reactivationInvoice: InvoiceDto | null;
|
|
78
|
+
persons: SeatFeePersonDto[];
|
|
79
|
+
}
|
|
80
|
+
export interface SeatFeesQuery {
|
|
81
|
+
period: string;
|
|
82
|
+
billingOrgId?: string;
|
|
83
|
+
userId?: string;
|
|
84
|
+
costCenterOrgId?: string;
|
|
85
|
+
}
|
|
86
|
+
export interface BillingEntityRowDto {
|
|
87
|
+
id: string;
|
|
88
|
+
type: 'org' | 'user';
|
|
89
|
+
name: string;
|
|
90
|
+
segment: string | null;
|
|
91
|
+
billingStatus: BillingStatusValue;
|
|
92
|
+
inactiveReason: InactiveReasonValue | null;
|
|
93
|
+
trialEndsAt: string | null;
|
|
94
|
+
billingStartsAt: string | null;
|
|
95
|
+
firstInvoiceChf: string | null;
|
|
96
|
+
cancelEffectiveAt: string | null;
|
|
97
|
+
persons: number;
|
|
98
|
+
requests: number;
|
|
99
|
+
feeSoFarChf: string | null;
|
|
100
|
+
feeError: {
|
|
101
|
+
code: string;
|
|
102
|
+
message: string;
|
|
103
|
+
} | null;
|
|
104
|
+
}
|
|
105
|
+
//# sourceMappingURL=billing-seat-fees.types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"billing-seat-fees.types.d.ts","sourceRoot":"","sources":["../../src/clients/billing-seat-fees.types.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,KAAK,EAAE,kBAAkB,EAAE,mBAAmB,EAAE,MAAM,qBAAqB,CAAA;AAElF,MAAM,MAAM,aAAa,GAAG,QAAQ,GAAG,UAAU,GAAG,aAAa,CAAA;AACjE,MAAM,MAAM,cAAc,GAAG,QAAQ,GAAG,WAAW,GAAG,MAAM,GAAG,iBAAiB,GAAG,cAAc,CAAA;AAEjG,MAAM,WAAW,UAAU;IACvB,WAAW,EAAE,MAAM,GAAG,IAAI,CAAA;IAC1B,cAAc,EAAE,OAAO,CAAA;IACvB,qBAAqB,EAAE,OAAO,CAAA;IAC9B,YAAY,EAAE,OAAO,CAAA;IACrB,eAAe,EAAE,MAAM,GAAG,IAAI,CAAA;IAC9B,SAAS,EAAE,MAAM,GAAG,IAAI,CAAA;IACxB,uBAAuB,EAAE,MAAM,CAAA;IAC/B,YAAY,EAAE,MAAM,CAAA;IACpB,gBAAgB,EAAE,MAAM,CAAA;CAC3B;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,CAAA;IAChB,WAAW,EAAE,MAAM,GAAG,IAAI,CAAA;IAC1B,QAAQ,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,MAAM,CAAA;KAAE,GAAG,IAAI,CAAA;CACrD"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"billing-seat-fees.types.js","sourceRoot":"","sources":["../../src/clients/billing-seat-fees.types.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* billing.client.ts — FS64: typed SDK client for pricing (F564) and the subscription lifecycle
|
|
3
|
+
* (F705). `pricing()` is PUBLIC (no token needed) — beacon-web reads the same values as the
|
|
4
|
+
* cockpit (one source, no drift). Billing errors surface as typed subclasses of SdkError.
|
|
5
|
+
*/
|
|
6
|
+
import type { HttpClient } from '../transport/http-client.js';
|
|
7
|
+
import { SdkError } from '../transport/errors.js';
|
|
8
|
+
import type { BillingEntityRowDto, SeatFeesDto, SeatFeesQuery } from './billing-seat-fees.types.js';
|
|
9
|
+
import type { BillableRequestsDto, BillableRequestsQuery } from './billing-requests.types.js';
|
|
10
|
+
export type BillingStatusValue = 'trialing' | 'active' | 'cancelling' | 'past_due' | 'inactive';
|
|
11
|
+
export type InactiveReasonValue = 'cancelled' | 'payment_overdue' | 'payment_required';
|
|
12
|
+
export interface PricingTierDto {
|
|
13
|
+
tier: 'community' | 'solo' | 'org_contributor' | 'org_reviewer' | 'viewer';
|
|
14
|
+
segment: 'individual' | 'org' | 'any';
|
|
15
|
+
floorChf: string;
|
|
16
|
+
capChf: string;
|
|
17
|
+
condition: 'osi_public_repo' | 'requires_active_contributor' | null;
|
|
18
|
+
}
|
|
19
|
+
export interface PricingDto {
|
|
20
|
+
version: number;
|
|
21
|
+
effectiveFrom: string;
|
|
22
|
+
unitPriceChf: string;
|
|
23
|
+
trialDays: number;
|
|
24
|
+
tiers: PricingTierDto[];
|
|
25
|
+
}
|
|
26
|
+
export interface PricingVersionDto extends PricingDto {
|
|
27
|
+
id: string;
|
|
28
|
+
createdAt: string;
|
|
29
|
+
createdBy: string;
|
|
30
|
+
isEffective: boolean;
|
|
31
|
+
isPending: boolean;
|
|
32
|
+
}
|
|
33
|
+
export interface PricingInputDto {
|
|
34
|
+
unitPriceChf: string;
|
|
35
|
+
trialDays: number;
|
|
36
|
+
tiers: Array<{
|
|
37
|
+
tier: 'community' | 'solo' | 'org_contributor' | 'org_reviewer';
|
|
38
|
+
floorChf: string;
|
|
39
|
+
capChf: string;
|
|
40
|
+
}>;
|
|
41
|
+
}
|
|
42
|
+
export interface BillingStatusDto {
|
|
43
|
+
status: BillingStatusValue;
|
|
44
|
+
inactiveReason: InactiveReasonValue | null;
|
|
45
|
+
subscribedAt: string | null;
|
|
46
|
+
trialEndsAt: string | null;
|
|
47
|
+
billingStartsAt: string | null;
|
|
48
|
+
cancelledAt: string | null;
|
|
49
|
+
cancelEffectiveAt: string | null;
|
|
50
|
+
reactivatedAt: string | null;
|
|
51
|
+
pastDueAt: string | null;
|
|
52
|
+
}
|
|
53
|
+
export interface CompanyBillingStatusDto {
|
|
54
|
+
rootOrgId: string;
|
|
55
|
+
rootOrgName: string;
|
|
56
|
+
status: BillingStatusValue;
|
|
57
|
+
inactiveReason: InactiveReasonValue | null;
|
|
58
|
+
trialEndsAt: string | null;
|
|
59
|
+
billingStartsAt: string | null;
|
|
60
|
+
cancelEffectiveAt: string | null;
|
|
61
|
+
}
|
|
62
|
+
export interface UserBillingStatusDto {
|
|
63
|
+
personal: (BillingStatusDto & {
|
|
64
|
+
segment: 'solo' | 'community' | null;
|
|
65
|
+
}) | null;
|
|
66
|
+
companies: CompanyBillingStatusDto[];
|
|
67
|
+
}
|
|
68
|
+
/** 403/409 BILLING_ENTITY_INACTIVE — writes to a resource of an inactive entity. */
|
|
69
|
+
export declare class BillingEntityInactiveError extends SdkError {
|
|
70
|
+
readonly entity: 'company' | 'personal';
|
|
71
|
+
readonly rootOrgId: string | null;
|
|
72
|
+
readonly inactiveReason: InactiveReasonValue | null;
|
|
73
|
+
constructor(e: SdkError);
|
|
74
|
+
}
|
|
75
|
+
export declare class PersonalSubscriptionRequiredError extends SdkError {
|
|
76
|
+
}
|
|
77
|
+
export declare class ProjectOwnerRequiredError extends SdkError {
|
|
78
|
+
}
|
|
79
|
+
export declare class PaymentOverdueError extends SdkError {
|
|
80
|
+
}
|
|
81
|
+
export declare class PaymentRequiredError extends SdkError {
|
|
82
|
+
}
|
|
83
|
+
/** Maps a raw SdkError to its typed billing subclass (unchanged when not a billing code). */
|
|
84
|
+
export declare function toTypedBillingError(err: unknown): unknown;
|
|
85
|
+
export declare class BillingClient {
|
|
86
|
+
private http;
|
|
87
|
+
constructor(http: HttpClient);
|
|
88
|
+
/** GET /pricing — the currently effective price version (public, F564 AC-3). */
|
|
89
|
+
pricing(): Promise<PricingDto>;
|
|
90
|
+
/** GET /pricing/versions — history + pending version (vendor-only). */
|
|
91
|
+
pricingVersions(): Promise<PricingVersionDto[]>;
|
|
92
|
+
/** PUT /pricing — new version effective next UTC month (vendor-only). */
|
|
93
|
+
updatePricing(input: PricingInputDto): Promise<{
|
|
94
|
+
version: number;
|
|
95
|
+
effectiveFrom: string;
|
|
96
|
+
}>;
|
|
97
|
+
/** GET /users/me/billing/status — personal subscription + companies (banner source). */
|
|
98
|
+
myStatus(): Promise<UserBillingStatusDto>;
|
|
99
|
+
/** POST /users/me/billing/subscribe — take out the personal subscription. */
|
|
100
|
+
subscribe(input: {
|
|
101
|
+
segment: 'solo' | 'community';
|
|
102
|
+
repoUrl?: string | null;
|
|
103
|
+
}): Promise<BillingStatusDto & {
|
|
104
|
+
segment: 'solo' | 'community';
|
|
105
|
+
}>;
|
|
106
|
+
cancelPersonal(): Promise<BillingStatusDto>;
|
|
107
|
+
revokePersonalCancellation(): Promise<BillingStatusDto>;
|
|
108
|
+
reactivatePersonal(): Promise<BillingStatusDto>;
|
|
109
|
+
/** Company (root org) subscription — root-org admin for writes, any member for status. */
|
|
110
|
+
orgStatus(orgId: string): Promise<BillingStatusDto>;
|
|
111
|
+
cancelOrg(orgId: string): Promise<BillingStatusDto>;
|
|
112
|
+
revokeOrgCancellation(orgId: string): Promise<BillingStatusDto>;
|
|
113
|
+
reactivateOrg(orgId: string): Promise<BillingStatusDto>;
|
|
114
|
+
/** GET /billing/seat-fees — seat fees of one entity × month, scoped by the caller (F564). */
|
|
115
|
+
seatFees(query: SeatFeesQuery): Promise<SeatFeesDto>;
|
|
116
|
+
/** GET /billing/requests — billable requests of one entity × month, scoped (C907 AC-6). */
|
|
117
|
+
getBillableRequests(query: BillableRequestsQuery): Promise<BillableRequestsDto>;
|
|
118
|
+
/** GET /billing/entities — every billing entity with status and fees so far (vendor-only). */
|
|
119
|
+
entities(period?: string): Promise<BillingEntityRowDto[]>;
|
|
120
|
+
}
|
|
121
|
+
//# sourceMappingURL=billing.client.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"billing.client.d.ts","sourceRoot":"","sources":["../../src/clients/billing.client.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,6BAA6B,CAAA;AAC7D,OAAO,EAAE,QAAQ,EAAE,MAAM,wBAAwB,CAAA;AACjD,OAAO,KAAK,EAAE,mBAAmB,EAAE,WAAW,EAAE,aAAa,EAAE,MAAM,8BAA8B,CAAA;AACnG,OAAO,KAAK,EAAE,mBAAmB,EAAE,qBAAqB,EAAE,MAAM,6BAA6B,CAAA;AAE7F,MAAM,MAAM,kBAAkB,GAAG,UAAU,GAAG,QAAQ,GAAG,YAAY,GAAG,UAAU,GAAG,UAAU,CAAA;AAC/F,MAAM,MAAM,mBAAmB,GAAG,WAAW,GAAG,iBAAiB,GAAG,kBAAkB,CAAA;AAEtF,MAAM,WAAW,cAAc;IAC3B,IAAI,EAAE,WAAW,GAAG,MAAM,GAAG,iBAAiB,GAAG,cAAc,GAAG,QAAQ,CAAA;IAC1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resource of an inactive entity. */
|
|
3
|
+
export class BillingEntityInactiveError extends SdkError {
|
|
4
|
+
entity;
|
|
5
|
+
rootOrgId;
|
|
6
|
+
inactiveReason;
|
|
7
|
+
constructor(e) {
|
|
8
|
+
super(e.code, e.message, e.status, e.apiCode, e.details);
|
|
9
|
+
this.name = 'BillingEntityInactiveError';
|
|
10
|
+
this.entity = e.details?.entity ?? 'company';
|
|
11
|
+
this.rootOrgId = e.details?.rootOrgId ?? null;
|
|
12
|
+
this.inactiveReason = e.details?.inactiveReason ?? null;
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
export class PersonalSubscriptionRequiredError extends SdkError {
|
|
16
|
+
}
|
|
17
|
+
export class ProjectOwnerRequiredError extends SdkError {
|
|
18
|
+
}
|
|
19
|
+
export class PaymentOverdueError extends SdkError {
|
|
20
|
+
}
|
|
21
|
+
export class PaymentRequiredError extends SdkError {
|
|
22
|
+
}
|
|
23
|
+
const TYPED = {
|
|
24
|
+
BILLING_ENTITY_INACTIVE: (e) => new BillingEntityInactiveError(e),
|
|
25
|
+
PERSONAL_SUBSCRIPTION_REQUIRED: (e) => new PersonalSubscriptionRequiredError(e.code, e.message, e.status, e.apiCode, e.details),
|
|
26
|
+
PROJECT_OWNER_REQUIRED: (e) => new ProjectOwnerRequiredError(e.code, e.message, e.status, e.apiCode, e.details),
|
|
27
|
+
PAYMENT_OVERDUE: (e) => new PaymentOverdueError(e.code, e.message, e.status, e.apiCode, e.details),
|
|
28
|
+
PAYMENT_REQUIRED: (e) => new PaymentRequiredError(e.code, e.message, e.status, e.apiCode, e.details),
|
|
29
|
+
};
|
|
30
|
+
/** Maps a raw SdkError to its typed billing subclass (unchanged when not a billing code). */
|
|
31
|
+
export function toTypedBillingError(err) {
|
|
32
|
+
if (err instanceof SdkError && err.apiCode && TYPED[err.apiCode])
|
|
33
|
+
return TYPED[err.apiCode](err);
|
|
34
|
+
return err;
|
|
35
|
+
}
|
|
36
|
+
async function typed(p) {
|
|
37
|
+
try {
|
|
38
|
+
return await p;
|
|
39
|
+
}
|
|
40
|
+
catch (err) {
|
|
41
|
+
throw toTypedBillingError(err);
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
/** Query string of the billing read endpoints (seat fees, requests). */
|
|
45
|
+
function readQuery(query) {
|
|
46
|
+
const params = new URLSearchParams({ period: query.period });
|
|
47
|
+
if (query.billingOrgId)
|
|
48
|
+
params.set('billingOrgId', query.billingOrgId);
|
|
49
|
+
if (query.userId)
|
|
50
|
+
params.set('userId', query.userId);
|
|
51
|
+
if (query.costCenterOrgId)
|
|
52
|
+
params.set('costCenterOrgId', query.costCenterOrgId);
|
|
53
|
+
return params.toString();
|
|
54
|
+
}
|
|
55
|
+
export class BillingClient {
|
|
56
|
+
http;
|
|
57
|
+
constructor(http) {
|
|
58
|
+
this.http = http;
|
|
59
|
+
}
|
|
60
|
+
/** GET /pricing — the currently effective price version (public, F564 AC-3). */
|
|
61
|
+
pricing() {
|
|
62
|
+
return this.http.get('/pricing');
|
|
63
|
+
}
|
|
64
|
+
/** GET /pricing/versions — history + pending version (vendor-only). */
|
|
65
|
+
pricingVersions() {
|
|
66
|
+
return this.http.get('/pricing/versions');
|
|
67
|
+
}
|
|
68
|
+
/** PUT /pricing — new version effective next UTC month (vendor-only). */
|
|
69
|
+
updatePricing(input) {
|
|
70
|
+
return this.http.put('/pricing', input);
|
|
71
|
+
}
|
|
72
|
+
/** GET /users/me/billing/status — personal subscription + companies (banner source). */
|
|
73
|
+
myStatus() {
|
|
74
|
+
return typed(this.http.get('/users/me/billing/status'));
|
|
75
|
+
}
|
|
76
|
+
/** POST /users/me/billing/subscribe — take out the personal subscription. */
|
|
77
|
+
subscribe(input) {
|
|
78
|
+
return typed(this.http.post('/users/me/billing/subscribe', input));
|
|
79
|
+
}
|
|
80
|
+
cancelPersonal() {
|
|
81
|
+
return typed(this.http.post('/users/me/billing/cancel', {}));
|
|
82
|
+
}
|
|
83
|
+
revokePersonalCancellation() {
|
|
84
|
+
return typed(this.http.post('/users/me/billing/cancel/revoke', {}));
|
|
85
|
+
}
|
|
86
|
+
reactivatePersonal() {
|
|
87
|
+
return typed(this.http.post('/users/me/billing/reactivate', {}));
|
|
88
|
+
}
|
|
89
|
+
/** Company (root org) subscription — root-org admin for writes, any member for status. */
|
|
90
|
+
orgStatus(orgId) {
|
|
91
|
+
return typed(this.http.get(`/organizations/${encodeURIComponent(orgId)}/billing/status`));
|
|
92
|
+
}
|
|
93
|
+
cancelOrg(orgId) {
|
|
94
|
+
return typed(this.http.post(`/organizations/${encodeURIComponent(orgId)}/billing/cancel`, {}));
|
|
95
|
+
}
|
|
96
|
+
revokeOrgCancellation(orgId) {
|
|
97
|
+
return typed(this.http.post(`/organizations/${encodeURIComponent(orgId)}/billing/cancel/revoke`, {}));
|
|
98
|
+
}
|
|
99
|
+
reactivateOrg(orgId) {
|
|
100
|
+
return typed(this.http.post(`/organizations/${encodeURIComponent(orgId)}/billing/reactivate`, {}));
|
|
101
|
+
}
|
|
102
|
+
/** GET /billing/seat-fees — seat fees of one entity × month, scoped by the caller (F564). */
|
|
103
|
+
seatFees(query) {
|
|
104
|
+
return typed(this.http.get(`/billing/seat-fees?${readQuery(query)}`));
|
|
105
|
+
}
|
|
106
|
+
/** GET /billing/requests — billable requests of one entity × month, scoped (C907 AC-6). */
|
|
107
|
+
getBillableRequests(query) {
|
|
108
|
+
return typed(this.http.get(`/billing/requests?${readQuery(query)}`));
|
|
109
|
+
}
|
|
110
|
+
/** GET /billing/entities — every billing entity with status and fees so far (vendor-only). */
|
|
111
|
+
entities(period) {
|
|
112
|
+
const qs = period ? `?period=${encodeURIComponent(period)}` : '';
|
|
113
|
+
return typed(this.http.get(`/billing/entities${qs}`));
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
//# sourceMappingURL=billing.client.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"billing.client.js","sourceRoot":"","sources":["../../src/clients/billing.client.ts"],"names":[],"mappings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,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,CAAwB,oBAAoB,EAAE,EAAE,CAAC,CAAC,CAAA;IAChF,CAAC;CACJ"}
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
* Retry: on 503/network failure the caller retains the batch and retries on the
|
|
14
14
|
* next flush cycle (max 3 attempts, then log.warn + discard).
|
|
15
15
|
*/
|
|
16
|
-
import type { SessionClient } from '@beacon-build/core';
|
|
16
|
+
import type { PaymentMethod, SessionClient } from '@beacon-build/core';
|
|
17
17
|
export interface CapturedToolUse {
|
|
18
18
|
id: string;
|
|
19
19
|
name: string;
|
|
@@ -52,6 +52,10 @@ export interface CapturedEntry {
|
|
|
52
52
|
isSidechain: boolean;
|
|
53
53
|
subagentSessionId?: string | null;
|
|
54
54
|
agentType?: string | null;
|
|
55
|
+
/** F706: how this turn was paid (missing ⇒ server stores 'unknown'). */
|
|
56
|
+
paymentMethod?: PaymentMethod;
|
|
57
|
+
/** F706: `<provider>:user:<userId>` — only meaningful for `oauth_quota`. */
|
|
58
|
+
quotaAccount?: string | null;
|
|
55
59
|
toolUses: CapturedToolUse[];
|
|
56
60
|
}
|
|
57
61
|
export interface CaptureJob {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"capture.client.d.ts","sourceRoot":"","sources":["../../src/clients/capture.client.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAA;
|
|
1
|
+
{"version":3,"file":"capture.client.d.ts","sourceRoot":"","sources":["../../src/clients/capture.client.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,KAAK,EAAE,aAAa,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAA;AAOtE,MAAM,WAAW,eAAe;IAC5B,EAAE,EAAE,MAAM,CAAA;IACV,IAAI,EAAE,MAAM,CAAA;IACZ,KAAK,EAAE,MAAM,CAAC,MAAM,EA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EAAE,OAAO,GAAG,OAAO,GAAG,IAAI,CAAA;IAC7B,OAAO,EAAE,aAAa,EAAE,CAAA;CAC3B;AAED,qBAAa,aAAa;IAYlB,OAAO,CAAC,QAAQ,CAAC,OAAO;IAX5B,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAQ;IAQlC,OAAO,CAAC,QAAQ,CAAC,YAAY,CAAgC;gBAGxC,OAAO,EAAE,MAAM,EAChC,SAAS,EAAE,MAAM,GAAG,CAAC,MAAM,MAAM,GAAG,SAAS,GAAG,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC,CAAC;IAS1E,MAAM,CAAC,GAAG,EAAE,UAAU,GAAG,OAAO,CAAC;QAAE,QAAQ,EAAE,MAAM,CAAA;KAAE,CAAC;CAoB/D"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"capture.client.js","sourceRoot":"","sources":["../../src/clients/capture.client.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;
|
|
1
|
+
{"version":3,"file":"capture.client.js","sourceRoot":"","sources":["../../src/clients/capture.client.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAiEH,MAAM,OAAO,aAAa;IAYD;IAXJ,SAAS,CAAQ;IAClC,2FAA2F;IAC3F,4FAA4F;IAC5F,yEAAyE;IACzE,yFAAyF;IACzF,+EAA+E;IAC/E,yFAAyF;IACzF,qBAAqB;IACJ,YAAY,CAAgC;IAE7D,YACqB,OAAe,EAChC,SAA4E;QAD3D,YAAO,GAAP,OAAO,CAAQ;QAGhC,IAAI,CAAC,SAAS,GAAG,GAAG,OAAO,CAAC,OAAO,CAAC,KAAK,EAAE,EAAE,CAAC,qCAAqC,CAAA;QACnF,IAAI,CAAC,YAAY;YACb,OAAO,SAAS,KAAK,UAAU;gBAC3B,CAAC,CAAC,KAAK,IAAI,EAAE,CAAC,CAAC,MAAM,SAAS,EAAE,CAAC,IAAI,EAAE;gBACvC,CAAC,CAAC,GAAG,EAAE,CAAC,SAAS,CAAA;IAC7B,CAAC;IAED,KAAK,CAAC,MAAM,CAAC,GAAe;QACxB,MAAM,GAAG,GAAG,MAAM,KAAK,CAAC,IAAI,CAAC,SAAS,EAAE;YACpC,MAAM,EAAE,MAAM;YACd,OAAO,EAAE;gBACL,cAAc,EAAE,kBAAkB;gBAClC,aAAa,EAAE,UAAU,MAAM,IAAI,CAAC,YAAY,EAAE,EAAE;aACvD;YACD,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC;SAC5B,CAAC,CAAA;QAEF,IAAI,CAAC,GAAG,CAAC,EAAE,EAAE,CAAC;YACV,wEAAwE;YACxE,0EAA0E;YAC1E,uEAAuE;YACvE,MAAM,IAAI,KAAK,CAAC,0BAA0B,GAAG,CAAC,MAAM,IAAI,GAAG,CAAC,UAAU,EAAE,CAAC,CAAA;QAC7E,CAAC;QAED,MAAM,IAAI,GAAG,CAAC,MAAM,GAAG,CAAC,IAAI,EAAE,CAAC,KAAK,CAAC,GAAG,EAAE,CAAC,CAAC,EAAE,CAAC,CAAC,CAAqC,CAAA;QACrF,OAAO,EAAE,QAAQ,EAAE,IAAI,CAAC,IAAI,EAAE,QAAQ,IAAI,GAAG,CAAC,OAAO,CAAC,MAAM,EAAE,CAAA;IAClE,CAAC;CACJ"}
|
|
@@ -8,8 +8,9 @@ import { ProjectsClient } from '../clients/projects.client.js';
|
|
|
8
8
|
export interface AgentSdkConfig {
|
|
9
9
|
/** Base URL for the beacon API (e.g. 'https://api.beacon.build') */
|
|
10
10
|
baseUrl: string;
|
|
11
|
-
/** Agent-JWT (project-scoped, issued by POST /api/v1/agent-token)
|
|
12
|
-
|
|
11
|
+
/** Agent-JWT (project-scoped, issued by POST /api/v1/agent-token) — or a provider that
|
|
12
|
+
* returns a current one (B987: `createTenantAgentClient` re-obtains it transparently). */
|
|
13
|
+
agentToken: string | (() => string | Promise<string>);
|
|
13
14
|
/**
|
|
14
15
|
* F460/AC-10: widened to match `HttpClientConfig.onUnauthorized` — was structurally
|
|
15
16
|
* `() => void`, which could never hand back a fresh token and so could never trigger
|
|
@@ -19,6 +20,8 @@ export interface AgentSdkConfig {
|
|
|
19
20
|
* as before (Superset — every pre-F460 `() => void` callback keeps working unchanged).
|
|
20
21
|
*/
|
|
21
22
|
onUnauthorized?: () => void | Promise<string | null | void>;
|
|
23
|
+
/** Optional fetch implementation (B987: shared with createTenantAgentClient's token calls). */
|
|
24
|
+
fetch?: typeof fetch;
|
|
22
25
|
}
|
|
23
26
|
export interface AgentSdk {
|
|
24
27
|
tasks: AgentTasksClient;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"agent-sdk.d.ts","sourceRoot":"","sources":["../../src/factory/agent-sdk.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,gBAAgB,EAAE,MAAM,kCAAkC,CAAA;AACnE,OAAO,EAAE,iBAAiB,EAAE,MAAM,mCAAmC,CAAA;AACrE,OAAO,EAAE,qBAAqB,EAAE,MAAM,uCAAuC,CAAA;AAC7E,OAAO,EAAE,qBAAqB,EAAE,MAAM,6CAA6C,CAAA;AACnF,OAAO,EAAE,gBAAgB,EAAE,MAAM,yCAAyC,CAAA;AAC1E,OAAO,EAAE,eAAe,EAAE,MAAM,uCAAuC,CAAA;AACvE,OAAO,EAAE,cAAc,EAAE,MAAM,+BAA+B,CAAA;AAE9D,MAAM,WAAW,cAAc;IAC3B,oEAAoE;IACpE,OAAO,EAAE,MAAM,CAAA;IACf
|
|
1
|
+
{"version":3,"file":"agent-sdk.d.ts","sourceRoot":"","sources":["../../src/factory/agent-sdk.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,gBAAgB,EAAE,MAAM,kCAAkC,CAAA;AACnE,OAAO,EAAE,iBAAiB,EAAE,MAAM,mCAAmC,CAAA;AACrE,OAAO,EAAE,qBAAqB,EAAE,MAAM,uCAAuC,CAAA;AAC7E,OAAO,EAAE,qBAAqB,EAAE,MAAM,6CAA6C,CAAA;AACnF,OAAO,EAAE,gBAAgB,EAAE,MAAM,yCAAyC,CAAA;AAC1E,OAAO,EAAE,eAAe,EAAE,MAAM,uCAAuC,CAAA;AACvE,OAAO,EAAE,cAAc,EAAE,MAAM,+BAA+B,CAAA;AAE9D,MAAM,WAAW,cAAc;IAC3B,oEAAoE;IACpE,OAAO,EAAE,MAAM,CAAA;IACf;+FAC2F;IAC3F,UAAU,EAAE,MAAM,GAAG,CAAC,MAAM,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC,CAAA;IACrD;;;;;;;OAOG;IACH,cAAc,CAAC,EAAE,MAAM,IAAI,GAAG,OAAO,CAAC,MAAM,GAAG,IAAI,GAAG,IAAI,CAAC,CAAA;IAC3D,+FAA+F;IAC/F,KAAK,CAAC,EAAE,OAAO,KAAK,CAAA;CACvB;AAED,MAAM,WAAW,QAAQ;IACrB,KAAK,EAAE,gBAAgB,CAAA;IACvB,qDAAqD;IACrD,QAAQ,EAAE,cAAc,CAAA;IACxB,gFAAgF;IAChF,MAAM,CAAC,EAAE,iBAAiB,CAAA;IAC1B,uEAAuE;IACvE,YAAY,CAAC,EAAE,qBAAqB,CAAA;IACpC,4DAA4D;IAC5D,UAAU,EAAE,gBAAgB,CAAA;IAC5B,kEAAkE;IAClE,gBAAgB,EAAE,qBAAqB,CAAA;IACvC,0FAA0F;IAC1F,SAAS,EAAE,eAAe,CAAA;CAC7B;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,cAAc,GAAG,QAAQ,CAwBlE"}
|
|
@@ -21,8 +21,9 @@ export function createAgentClient(config) {
|
|
|
21
21
|
const v1Http = new HttpClient({
|
|
22
22
|
baseUrl: config.baseUrl,
|
|
23
23
|
basePath: '/api/v1',
|
|
24
|
-
getToken: () => config.agentToken,
|
|
24
|
+
getToken: () => typeof config.agentToken === 'function' ? config.agentToken() : config.agentToken,
|
|
25
25
|
onUnauthorized: config.onUnauthorized,
|
|
26
|
+
...(config.fetch ? { fetch: config.fetch } : {}),
|
|
26
27
|
});
|
|
27
28
|
return {
|
|
28
29
|
// C565: tasks canonical under /api/v1/tasks.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"agent-sdk.js","sourceRoot":"","sources":["../../src/factory/agent-sdk.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,6BAA6B,CAAA;AACxD,OAAO,EAAE,gBAAgB,EAAE,MAAM,kCAAkC,CAAA;AACnE,OAAO,EAAE,iBAAiB,EAAE,MAAM,mCAAmC,CAAA;AACrE,OAAO,EAAE,qBAAqB,EAAE,MAAM,uCAAuC,CAAA;AAC7E,OAAO,EAAE,qBAAqB,EAAE,MAAM,6CAA6C,CAAA;AACnF,OAAO,EAAE,gBAAgB,EAAE,MAAM,yCAAyC,CAAA;AAC1E,OAAO,EAAE,eAAe,EAAE,MAAM,uCAAuC,CAAA;AACvE,OAAO,EAAE,cAAc,EAAE,MAAM,+BAA+B,CAAA;
|
|
1
|
+
{"version":3,"file":"agent-sdk.js","sourceRoot":"","sources":["../../src/factory/agent-sdk.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,6BAA6B,CAAA;AACxD,OAAO,EAAE,gBAAgB,EAAE,MAAM,kCAAkC,CAAA;AACnE,OAAO,EAAE,iBAAiB,EAAE,MAAM,mCAAmC,CAAA;AACrE,OAAO,EAAE,qBAAqB,EAAE,MAAM,uCAAuC,CAAA;AAC7E,OAAO,EAAE,qBAAqB,EAAE,MAAM,6CAA6C,CAAA;AACnF,OAAO,EAAE,gBAAgB,EAAE,MAAM,yCAAyC,CAAA;AAC1E,OAAO,EAAE,eAAe,EAAE,MAAM,uCAAuC,CAAA;AACvE,OAAO,EAAE,cAAc,EAAE,MAAM,+BAA+B,CAAA;AAqC9D;;;;;;;;;;GAUG;AACH,MAAM,UAAU,iBAAiB,CAAC,MAAsB;IACpD,MAAM,MAAM,GAAG,IAAI,UAAU,CAAC;QAC1B,OAAO,EAAE,MAAM,CAAC,OAAO;QACvB,QAAQ,EAAE,SAAS;QACnB,QAAQ,EAAE,GAAG,EAAE,CACX,OAAO,MAAM,CAAC,UAAU,KAAK,UAAU,CAAC,CAAC,CAAC,MAAM,CAAC,UAAU,EAAE,CAAC,CAAC,CAAC,MAAM,CAAC,UAAU;QACrF,cAAc,EAAE,MAAM,CAAC,cAAc;QACrC,GAAG,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,MAAM,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;KACnD,CAAC,CAAA;IAEF,OAAO;QACH,6CAA6C;QAC7C,KAAK,EAAE,IAAI,gBAAgB,CAAC,MAAM,CAAC;QACnC,mDAAmD;QACnD,QAAQ,EAAE,IAAI,cAAc,CAAC,MAAM,CAAC;QACpC,iEAAiE;QACjE,MAAM,EAAE,IAAI,iBAAiB,CAAC,MAAM,CAAC;QACrC,YAAY,EAAE,IAAI,qBAAqB,CAAC,MAAM,CAAC;QAC/C,UAAU,EAAE,IAAI,gBAAgB,CAAC,MAAM,CAAC;QACxC,mFAAmF;QACnF,gBAAgB,EAAE,IAAI,qBAAqB,CAAC,MAAM,CAAC;QACnD,4EAA4E;QAC5E,SAAS,EAAE,IAAI,eAAe,CAAC,MAAM,CAAC;KACzC,CAAA;AACL,CAAC"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { type AgentSdk } from './agent-sdk.js';
|
|
2
|
+
export type TenantCredential = {
|
|
3
|
+
kind: 'minted_token';
|
|
4
|
+
token: string;
|
|
5
|
+
} | {
|
|
6
|
+
kind: 'api_key';
|
|
7
|
+
clientId: string;
|
|
8
|
+
clientSecret: string;
|
|
9
|
+
};
|
|
10
|
+
export interface TenantAgentSdkConfig {
|
|
11
|
+
baseUrl: string;
|
|
12
|
+
credential: TenantCredential;
|
|
13
|
+
/** Test seam — defaults to the global fetch. */
|
|
14
|
+
fetch?: typeof fetch;
|
|
15
|
+
/** Seconds before expiry at which a cached token is treated as expired (default 30). */
|
|
16
|
+
refreshSkewSeconds?: number;
|
|
17
|
+
}
|
|
18
|
+
export interface TenantAgentTokenProvider {
|
|
19
|
+
/** A current internal agent token (exchanging/re-obtaining when needed). */
|
|
20
|
+
getToken(): Promise<string>;
|
|
21
|
+
/** Drop every cached token and obtain a fresh one (what a 401 triggers). */
|
|
22
|
+
refresh(): Promise<string>;
|
|
23
|
+
}
|
|
24
|
+
export declare function createTenantAgentTokenProvider(config: TenantAgentSdkConfig): TenantAgentTokenProvider;
|
|
25
|
+
/** An Agent SDK authenticated with a tenant credential (exchange + refresh transparent). */
|
|
26
|
+
export declare function createTenantAgentClient(config: TenantAgentSdkConfig): AgentSdk;
|
|
27
|
+
//# sourceMappingURL=tenant-agent-sdk.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tenant-agent-sdk.d.ts","sourceRoot":"","sources":["../../src/factory/tenant-agent-sdk.ts"],"names":[],"mappings":"AAgBA,OAAO,EAAqB,KAAK,QAAQ,EAAE,MAAM,gBAAgB,CAAA;AAEjE,MAAM,MAAM,gBAAgB,GACtB;IAAE,IAAI,EAAE,cAAc,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,GACvC;IAAE,IAAI,EAAE,SAAS,CAAC;IAAC,QAAQ,EAAE,MAAM,CAAC;IAAC,YAAY,EAAE,MAAM,CAAA;CAAE,CAAA;AAEjE,MAAM,WAAW,oBAAoB;IACjC,OAAO,EAAE,MAAM,CAAA;IACf,UAAU,EAAE,gBAAgB,CAAA;IAC5B,gDAAgD;IAChD,KAAK,CAAC,EAAE,OAAO,KAAK,CAAA;IACpB,wFAAwF;IACxF,kBAAkB,CAAC,EAAE,MAAM,CAAA;CAC9B;AAED,MAAM,WAAW,wBAAwB;IACrC,4EAA4E;IAC5E,QAAQ,IAAI,OAAO,CAAC,MAAM,CAAC,CAAA;IAC3B,4EAA4E;IAC5E,OAAO,IAAI,OAAO,CAAC,MAAM,CAAC,CAAA;CAC7B;AA2CD,wBAAgB,8BAA8B,CAC1C,MAAM,EAAE,oBAAoB,GAC7B,wBAAwB,CA4E1B;AAED,4FAA4F;AAC5F,wBAAgB,uBAAuB,CAAC,MAAM,EAAE,oBAAoB,GAAG,QAAQ,CAQ9E"}
|