agl 40.4.0 → 40.5.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 +27 -0
- package/dist_serve/bundle.js +2228 -2177
- package/dist_serve/bundle.js.map +2 -2
- package/dist_ts/00_commitinfo_data.js +1 -1
- package/dist_ts/aglapi/aglapisurface.document.js +2 -2
- package/dist_ts/classes.accountsactions.d.ts +11 -1
- package/dist_ts/classes.accountsactions.js +59 -2
- package/dist_ts/classes.controller.js +5 -5
- package/dist_ts/classes.flexaccountaccess.js +3 -2
- package/dist_ts/classes.harnessreleases.d.ts +14 -4
- package/dist_ts/classes.harnessreleases.js +28 -4
- package/dist_ts/classes.inferencegateway.d.ts +28 -3
- package/dist_ts/classes.inferencegateway.js +177 -61
- package/dist_ts/classes.inferenceplacement.d.ts +5 -3
- package/dist_ts/classes.inferenceplacement.js +2 -2
- package/dist_ts/classes.inferencerouter.d.ts +349 -91
- package/dist_ts/classes.inferencerouter.js +804 -297
- package/dist_ts/classes.inferenceservice.d.ts +14 -2
- package/dist_ts/classes.inferenceservice.js +53 -14
- package/dist_ts/classes.inferencespend.d.ts +339 -0
- package/dist_ts/classes.inferencespend.js +815 -0
- package/dist_ts/classes.inferenceusagecache.d.ts +8 -0
- package/dist_ts/classes.inferenceusagecache.js +9 -5
- package/dist_ts/classes.inferenceusagetap.d.ts +50 -9
- package/dist_ts/classes.inferenceusagetap.js +185 -31
- package/dist_ts/classes.proxycontrol.d.ts +3 -2
- package/dist_ts/classes.proxycontrol.js +1 -2
- package/dist_ts/classes.proxydaemon.js +3 -2
- package/dist_ts/classes.proxystore.d.ts +6 -0
- package/dist_ts/classes.proxystore.js +11 -2
- package/dist_ts/fleet/classes.claudeworkers.d.ts +5 -4
- package/dist_ts/fleet/classes.claudeworkers.js +10 -9
- package/dist_ts/functions.claudecoderelease.d.ts +12 -6
- package/dist_ts/functions.claudecoderelease.js +13 -7
- package/dist_ts/functions.inferencecli.js +12 -8
- package/dist_ts/interfaces.auth.d.ts +1 -1
- package/dist_ts/interfaces.auth.js +3 -1
- package/dist_ts/plugins.d.ts +3 -1
- package/dist_ts/plugins.js +7 -2
- package/dist_ts_authswitch/authority-apikeys.d.ts +32 -0
- package/dist_ts_authswitch/authority-apikeys.js +65 -0
- package/dist_ts_authswitch/authority-contract.d.ts +142 -28
- package/dist_ts_authswitch/authority-contract.js +48 -1
- package/dist_ts_authswitch/authority-overview.js +8 -1
- package/dist_ts_authswitch/authority-placement.d.ts +7 -2
- package/dist_ts_authswitch/authority-placement.js +10 -3
- package/dist_ts_authswitch/authority-runtime-contract.d.ts +2 -2
- package/dist_ts_authswitch/authority-spend.d.ts +103 -0
- package/dist_ts_authswitch/authority-spend.js +110 -0
- package/dist_ts_authswitch/authority-subscription.d.ts +12 -1
- package/dist_ts_authswitch/authority-subscription.js +24 -1
- package/dist_ts_authswitch/authority-usagelimit.d.ts +7 -4
- package/dist_ts_authswitch/authority-usagelimit.js +89 -39
- package/dist_ts_authswitch/authority-usagewindows.d.ts +4 -1
- package/dist_ts_authswitch/authority-usagewindows.js +41 -16
- package/dist_ts_authswitch/classes.authoritybroker.d.ts +30 -19
- package/dist_ts_authswitch/classes.authoritybroker.js +152 -61
- package/dist_ts_authswitch/classes.authoritycli.d.ts +9 -4
- package/dist_ts_authswitch/classes.authoritycli.js +94 -29
- package/dist_ts_authswitch/classes.authorityclient.d.ts +24 -7
- package/dist_ts_authswitch/classes.authorityclient.js +31 -11
- package/dist_ts_authswitch/classes.authoritydaemon.js +39 -12
- package/dist_ts_authswitch/classes.authoritydatabase.d.ts +28 -5
- package/dist_ts_authswitch/classes.authoritydatabase.js +171 -9
- package/dist_ts_authswitch/classes.authorityimport.js +2 -2
- package/dist_ts_authswitch/classes.authoritymodels.d.ts +71 -3
- package/dist_ts_authswitch/classes.authoritymodels.js +249 -20
- package/dist_ts_authswitch/classes.authorityregistry.js +4 -2
- package/dist_ts_authswitch/classes.authorityusage.d.ts +69 -7
- package/dist_ts_authswitch/classes.authorityusage.js +118 -4
- package/dist_ts_authswitch/classes.claudenative.d.ts +16 -7
- package/dist_ts_authswitch/classes.claudenative.js +29 -16
- package/dist_ts_authswitch/classes.claudesignin.js +5 -2
- package/dist_ts_authswitch/testsupport.d.ts +24 -5
- package/dist_ts_authswitch/testsupport.js +56 -12
- package/dist_ts_authswitch/ts_migration/0011_account_api_key_fields.d.ts +12 -0
- package/dist_ts_authswitch/ts_migration/0011_account_api_key_fields.js +21 -0
- package/dist_ts_authswitch/ts_migration/index.js +3 -1
- package/dist_ts_interfaces/functions.authorityscope.d.ts +18 -7
- package/dist_ts_interfaces/functions.authorityscope.js +35 -8
- package/dist_ts_interfaces/interfaces.d.ts +1 -1
- package/dist_ts_interfaces/interfaces.js +1 -1
- package/dist_ts_interfaces/plugins.d.ts +2 -1
- package/dist_ts_interfaces/plugins.js +7 -4
- package/dist_ts_interfaces/requests.accounts.d.ts +56 -0
- package/dist_ts_interfaces/requests.accounts.js +11 -1
- package/dist_ts_interfaces/requests.d.ts +2 -2
- package/dist_ts_interfaces/requests.js +1 -1
- package/docs/authswitch.md +75 -12
- package/package.json +5 -5
- package/readme.md +198 -21
- package/ts/00_commitinfo_data.ts +1 -1
- package/ts/aglapi/aglapisurface.document.ts +2 -2
- package/ts/classes.accountsactions.ts +75 -1
- package/ts/classes.controller.ts +4 -4
- package/ts/classes.flexaccountaccess.ts +2 -1
- package/ts/classes.harnessreleases.ts +25 -4
- package/ts/classes.inferencegateway.ts +184 -64
- package/ts/classes.inferenceplacement.ts +6 -4
- package/ts/classes.inferencerouter.ts +1026 -314
- package/ts/classes.inferenceservice.ts +56 -13
- package/ts/classes.inferencespend.ts +870 -0
- package/ts/classes.inferenceusagecache.ts +16 -4
- package/ts/classes.inferenceusagetap.ts +159 -34
- package/ts/classes.proxycontrol.ts +3 -3
- package/ts/classes.proxydaemon.ts +2 -1
- package/ts/classes.proxystore.ts +11 -1
- package/ts/fleet/classes.claudeworkers.ts +9 -8
- package/ts/functions.claudecoderelease.ts +13 -6
- package/ts/functions.inferencecli.ts +11 -7
- package/ts/interfaces.auth.ts +2 -0
- package/ts/plugins.ts +7 -0
- package/ts_authswitch/authority-apikeys.ts +85 -0
- package/ts_authswitch/authority-contract.ts +167 -29
- package/ts_authswitch/authority-overview.ts +7 -0
- package/ts_authswitch/authority-placement.ts +12 -4
- package/ts_authswitch/authority-runtime-contract.ts +2 -2
- package/ts_authswitch/authority-spend.ts +168 -0
- package/ts_authswitch/authority-subscription.ts +28 -1
- package/ts_authswitch/authority-usagelimit.ts +95 -40
- package/ts_authswitch/authority-usagewindows.ts +42 -17
- package/ts_authswitch/classes.authoritybroker.ts +161 -68
- package/ts_authswitch/classes.authoritycli.ts +108 -32
- package/ts_authswitch/classes.authorityclient.ts +41 -10
- package/ts_authswitch/classes.authoritydaemon.ts +43 -13
- package/ts_authswitch/classes.authoritydatabase.ts +178 -8
- package/ts_authswitch/classes.authorityimport.ts +1 -1
- package/ts_authswitch/classes.authoritymodels.ts +165 -19
- package/ts_authswitch/classes.authorityregistry.ts +3 -0
- package/ts_authswitch/classes.authorityusage.ts +171 -10
- package/ts_authswitch/classes.claudenative.ts +28 -15
- package/ts_authswitch/classes.claudesignin.ts +4 -1
- package/ts_authswitch/native-contracts.md +81 -20
- package/ts_authswitch/readme.md +1 -1
- package/ts_authswitch/testsupport.ts +58 -11
- package/ts_authswitch/ts_migration/0011_account_api_key_fields.ts +20 -0
- package/ts_authswitch/ts_migration/index.ts +2 -0
- package/ts_interfaces/functions.authorityscope.ts +43 -8
- package/ts_interfaces/interfaces.ts +1 -1
- package/ts_interfaces/plugins.ts +6 -3
- package/ts_interfaces/requests.accounts.ts +48 -0
- package/ts_interfaces/requests.ts +4 -0
- package/ts_web/00_commitinfo_data.ts +1 -1
- package/ts_web/accounts.plugins.ts +3 -1
- package/ts_web/accounts.templates.ts +20 -11
- package/ts_web/classes.accountsreadmodel.ts +322 -70
- package/ts_web/elements.accounts.ts +219 -20
- package/ts_web/elements.codexconnections.ts +3 -1
- package/ts_web/plugins.ts +4 -2
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
import { AuthSwitchOpenAiProvider } from './classes.openaiprovider.js';
|
|
2
2
|
import type { IOpenAiOAuthCredential } from './interfaces.openai.js';
|
|
3
3
|
import type { IAuthSwitchAccount, IAuthSwitchAccountEvent, IAuthSwitchBinding, IAuthSwitchOperation, IAuthSwitchSnapshot, IReq_AuthSwitchSnapshot, TAuthSwitchRevocation } from './authority-contract.js';
|
|
4
|
-
import {
|
|
5
|
-
import
|
|
4
|
+
import { type TAuthSwitchApiKeyProvider } from './authority-contract.js';
|
|
5
|
+
import { type TAuthSwitchApiKeyVerifier } from './authority-apikeys.js';
|
|
6
|
+
import { AuthSwitchAuthorityDatabase, type TAuthSwitchBindPurpose } from './classes.authoritydatabase.js';
|
|
7
|
+
import { type IStoredAuthorityAccount, type IStoredAuthorityGrant } from './classes.authoritymodels.js';
|
|
6
8
|
import type { IAuthSwitchUsageContext } from './classes.authorityusage.js';
|
|
7
9
|
import type { IClaudeNativeLogin } from './classes.claudenative.js';
|
|
8
10
|
import { type IAuthSwitchSecretCodec } from './classes.authoritysecrets.js';
|
|
@@ -14,11 +16,10 @@ export interface IAuthSwitchAuthorityBrokerOptions {
|
|
|
14
16
|
now?: () => number;
|
|
15
17
|
proactive?: boolean;
|
|
16
18
|
/**
|
|
17
|
-
* Asks
|
|
18
|
-
*
|
|
19
|
-
* kept the question from being answered.
|
|
19
|
+
* Asks a provider whether it accepts an API key before the authority stores it (`TAuthSwitchApiKeyVerifier`): by
|
|
20
|
+
* default a read of the models the key may use (`authSwitchApiKeyVerifier`).
|
|
20
21
|
*/
|
|
21
|
-
|
|
22
|
+
verifyApiKey?: TAuthSwitchApiKeyVerifier;
|
|
22
23
|
}
|
|
23
24
|
export interface IAuthSwitchResolvedAccess {
|
|
24
25
|
accessToken: string;
|
|
@@ -48,7 +49,7 @@ export declare class AuthSwitchAuthorityBroker {
|
|
|
48
49
|
private readonly secrets;
|
|
49
50
|
private readonly now;
|
|
50
51
|
private readonly proactive;
|
|
51
|
-
private readonly
|
|
52
|
+
private readonly verifyApiKey;
|
|
52
53
|
private readonly starts;
|
|
53
54
|
private readonly operations;
|
|
54
55
|
private readonly refreshes;
|
|
@@ -130,6 +131,11 @@ export declare class AuthSwitchAuthorityBroker {
|
|
|
130
131
|
setAccountMaxUsage(accountId: string, expectedRevision: number, maxUsagePercent: number | null): Promise<IAuthSwitchAccount>;
|
|
131
132
|
/** Lifts only the reserve, atomically with the account revision; the original threshold stays saved. */
|
|
132
133
|
liftAccountReserve(accountId: string, expectedRevision: number, hours: number): Promise<IAuthSwitchAccount>;
|
|
134
|
+
/**
|
|
135
|
+
* Sets or clears an API key account's monthly spend limit, as `setAccountMaxUsage` changes a sign-in's threshold.
|
|
136
|
+
* A key's limit applies from the next request on, to the month's spend so far.
|
|
137
|
+
*/
|
|
138
|
+
setAccountSpendLimit(accountId: string, expectedRevision: number, spendLimitMicroUsd: number | null): Promise<IAuthSwitchAccount>;
|
|
133
139
|
/**
|
|
134
140
|
* Sets or clears the date an account's subscription ends, as `setAccountMaxUsage` changes its threshold. The date is
|
|
135
141
|
* stored in its ISO 8601 UTC form; a past one is kept as given and means the account lapsed already.
|
|
@@ -167,7 +173,7 @@ export declare class AuthSwitchAuthorityBroker {
|
|
|
167
173
|
bindAccount(input: {
|
|
168
174
|
accountId: string;
|
|
169
175
|
loginId: string;
|
|
170
|
-
purpose:
|
|
176
|
+
purpose: TAuthSwitchBindPurpose;
|
|
171
177
|
runtime: IAuthSwitchBinding['runtime'];
|
|
172
178
|
scopeId: string;
|
|
173
179
|
incarnationId: string;
|
|
@@ -215,20 +221,25 @@ export declare class AuthSwitchAuthorityBroker {
|
|
|
215
221
|
*/
|
|
216
222
|
private resolveClaudeAccess;
|
|
217
223
|
/**
|
|
218
|
-
* A bound Anthropic API key, with the refusals `resolveManagedAccess` gives. A key is never renewed: one
|
|
219
|
-
* rejected for exactly this generation ends (`needs_reauth`, `provider_rejected`), and only adding a key
|
|
220
|
-
* brings the account back.
|
|
224
|
+
* A bound Anthropic or OpenAI API key, with the refusals `resolveManagedAccess` gives. A key is never renewed: one its
|
|
225
|
+
* provider rejected for exactly this generation ends (`needs_reauth`, `provider_rejected`), and only adding a key the
|
|
226
|
+
* provider accepts brings the account back.
|
|
227
|
+
*/
|
|
228
|
+
private resolveApiKeyAccess;
|
|
229
|
+
/**
|
|
230
|
+
* The key a daemon-held API key grant seals, proven to be the key its account is named by: its provider's sealed
|
|
231
|
+
* kind (`apiKeySealedKinds`) and a key whose digest is the account's subject.
|
|
221
232
|
*/
|
|
222
|
-
private
|
|
223
|
-
/** The key a daemon-held Anthropic API key grant seals, proven to be the key its account is named by. */
|
|
224
|
-
private openAnthropicApiKeyAccess;
|
|
233
|
+
private openApiKeyAccess;
|
|
225
234
|
/**
|
|
226
|
-
* Adds an Anthropic API key as an account of its own once
|
|
227
|
-
* the
|
|
228
|
-
*
|
|
229
|
-
*
|
|
235
|
+
* Adds an Anthropic or OpenAI API key as an account of its own once its provider accepted it. A key that begins the
|
|
236
|
+
* way the other provider's keys do is refused before any request. The key is sealed like every login the authority
|
|
237
|
+
* holds and never answered on the management socket again; the account keeps only how it ends (`keyHint`). A key the
|
|
238
|
+
* authority holds already is refused while its account is ready; adding it after its account was removed, or after
|
|
239
|
+
* its provider rejected it, brings that account back with a new authorization, so a runtime bound to it binds again,
|
|
240
|
+
* and with the spend limit it had unless the request names one.
|
|
230
241
|
*/
|
|
231
|
-
|
|
242
|
+
addApiKey(providerId: TAuthSwitchApiKeyProvider, apiKey: string, label?: string, spendLimitMicroUsd?: number): Promise<{
|
|
232
243
|
account: IAuthSwitchAccount;
|
|
233
244
|
loginId: string;
|
|
234
245
|
}>;
|