agl 40.4.0 → 40.5.1
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_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 +172 -33
- package/dist_ts_authswitch/authority-contract.js +54 -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 +99 -30
- package/dist_ts_authswitch/classes.authorityclient.d.ts +24 -7
- package/dist_ts_authswitch/classes.authorityclient.js +45 -15
- 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 +23 -8
- package/dist_ts_authswitch/classes.claudenative.js +49 -21
- package/dist_ts_authswitch/classes.claudesignin.d.ts +14 -2
- package/dist_ts_authswitch/classes.claudesignin.js +72 -23
- package/dist_ts_authswitch/classes.codexmanaged.d.ts +8 -0
- package/dist_ts_authswitch/classes.codexmanaged.js +33 -18
- package/dist_ts_authswitch/classes.harnessprocesses.d.ts +8 -0
- package/dist_ts_authswitch/classes.harnessprocesses.js +41 -9
- 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 +199 -22
- 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 +201 -34
- 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 +112 -32
- package/ts_authswitch/classes.authorityclient.ts +66 -19
- 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 +51 -22
- package/ts_authswitch/classes.claudesignin.ts +74 -24
- package/ts_authswitch/classes.codexmanaged.ts +30 -16
- package/ts_authswitch/classes.harnessprocesses.ts +39 -8
- package/ts_authswitch/native-contracts.md +82 -21
- 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 +7 -1
- package/ts_web/accounts.templates.ts +20 -11
- package/ts_web/classes.accountsreadmodel.ts +326 -71
- package/ts_web/elements.accounts.ts +219 -20
- package/ts_web/elements.codexconnections.ts +3 -1
- package/ts_web/plugins.ts +4 -2
|
@@ -97,6 +97,8 @@ export type TControllerAccountNativeAssignment = plugins.authswitchAuthority.IAu
|
|
|
97
97
|
export type TControllerAccountOperation = plugins.authswitchAuthority.IAuthSwitchOperation;
|
|
98
98
|
export type TControllerAccountPreuse = plugins.authswitchAuthority.IAuthSwitchPreuseOperation;
|
|
99
99
|
export type TControllerAccountUsage = plugins.authswitchAuthority.IAuthSwitchUsageSnapshot;
|
|
100
|
+
/** An API key's month, the reading of an API key account's usage (`kind: 'spend'`). */
|
|
101
|
+
export type TControllerAccountSpendReading = plugins.authswitchAuthority.IAuthSwitchSpendReading;
|
|
100
102
|
/** A re-check of a Claude login: the usage held once its read finished, and how that read went. */
|
|
101
103
|
export type TControllerAccountUsageRecheck = plugins.authswitchAuthority.IAuthSwitchUsageRecheck;
|
|
102
104
|
export type TControllerAccountsDoctorPage = plugins.authswitchAuthority.IAuthSwitchDoctorPage;
|
|
@@ -187,6 +189,52 @@ export interface IReq_ControllerAccountsMaxUsage extends plugins.typedrequestInt
|
|
|
187
189
|
response: { answer: TControllerAccountsAnswer<TControllerAccount> };
|
|
188
190
|
}
|
|
189
191
|
|
|
192
|
+
/** The providers whose API keys the Accounts screen adds as accounts. */
|
|
193
|
+
export type TControllerApiKeyProvider = plugins.authswitchAuthority.TAuthSwitchApiKeyProvider;
|
|
194
|
+
|
|
195
|
+
/**
|
|
196
|
+
* The spend limit rule, as the accounts service publishes and applies it: a whole number of cents from
|
|
197
|
+
* `controllerSpendLimitRange.min` to `.max`, in micro-dollars. A view checks a value with it before it offers the
|
|
198
|
+
* change, and the service refuses any other value with `invalid_input`.
|
|
199
|
+
*/
|
|
200
|
+
export const isControllerSpendLimitMicroUsd = plugins.authswitchSpend.isAuthSwitchSpendLimitMicroUsd;
|
|
201
|
+
/** The range of a spend limit, in micro-dollars. */
|
|
202
|
+
export const controllerSpendLimitRange = plugins.authswitchSpend.authSwitchSpendLimitRange;
|
|
203
|
+
|
|
204
|
+
/** The longest API key the accounts service holds, in characters; a longer value is refused before it is sent. */
|
|
205
|
+
export const controllerApiKeyMaxLength = 512;
|
|
206
|
+
|
|
207
|
+
/**
|
|
208
|
+
* Adds an Anthropic or OpenAI API key as an account, with an optional label and monthly spend limit
|
|
209
|
+
* (`isControllerSpendLimitMicroUsd`). The accounts service asks the provider whether it accepts the key before it holds
|
|
210
|
+
* it, and answers why when it does not (`api_key_unverified`, `invalid_input`). The key is never answered, logged or
|
|
211
|
+
* audited; the account names it only by how it ends (`keyHint`). The answer arrives only once the controller's own
|
|
212
|
+
* projection shows the account; it can take up to 35 seconds, the provider's answer included.
|
|
213
|
+
*/
|
|
214
|
+
export interface IReq_ControllerAccountsApiKeyAdd extends plugins.typedrequestInterfaces.implementsTR<
|
|
215
|
+
plugins.typedrequestInterfaces.ITypedRequest,
|
|
216
|
+
IReq_ControllerAccountsApiKeyAdd
|
|
217
|
+
> {
|
|
218
|
+
method: 'controller.accounts.apikey.add';
|
|
219
|
+
request: { providerId: TControllerApiKeyProvider; apiKey: string; label?: string; spendLimitMicroUsd?: number };
|
|
220
|
+
response: { answer: TControllerAccountsAnswer<{ account: TControllerAccount; loginId: string }> };
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
/**
|
|
224
|
+
* Sets an API key account's monthly spend limit, or clears it with `null`: at the limit AGL's inference proxy places
|
|
225
|
+
* nothing more on the key until the month ends (UTC). `expectedRevision` is the revision the view showed, so a change of
|
|
226
|
+
* an account that changed meanwhile is refused as `account_changed`, and a value that breaks the rule, or an account on
|
|
227
|
+
* a sign-in, as `invalid_input`, both by the service. The answer arrives only once the projection shows the result.
|
|
228
|
+
*/
|
|
229
|
+
export interface IReq_ControllerAccountsSpendLimit extends plugins.typedrequestInterfaces.implementsTR<
|
|
230
|
+
plugins.typedrequestInterfaces.ITypedRequest,
|
|
231
|
+
IReq_ControllerAccountsSpendLimit
|
|
232
|
+
> {
|
|
233
|
+
method: 'controller.accounts.spendlimit';
|
|
234
|
+
request: { accountId: string; expectedRevision: number; spendLimitMicroUsd: number | null };
|
|
235
|
+
response: { answer: TControllerAccountsAnswer<TControllerAccount> };
|
|
236
|
+
}
|
|
237
|
+
|
|
190
238
|
/** Duration validation shared with the authority; no implicit duration is supplied. */
|
|
191
239
|
export const isControllerReserveLiftHours = plugins.authswitchAuthority.isAuthSwitchReserveLiftHours;
|
|
192
240
|
|
|
@@ -29,6 +29,8 @@ import type {
|
|
|
29
29
|
IReq_ControllerAccountsRename,
|
|
30
30
|
IReq_ControllerAccountsMaxUsage,
|
|
31
31
|
IReq_ControllerAccountsReserveLift,
|
|
32
|
+
IReq_ControllerAccountsApiKeyAdd,
|
|
33
|
+
IReq_ControllerAccountsSpendLimit,
|
|
32
34
|
IReq_ControllerAccountsSnapshot,
|
|
33
35
|
IReq_ControllerAccountsUsageGet,
|
|
34
36
|
IReq_ControllerAccountsUsageRecheck,
|
|
@@ -399,6 +401,8 @@ export type TControllerRequest =
|
|
|
399
401
|
| IReq_ControllerAccountsRename
|
|
400
402
|
| IReq_ControllerAccountsMaxUsage
|
|
401
403
|
| IReq_ControllerAccountsReserveLift
|
|
404
|
+
| IReq_ControllerAccountsApiKeyAdd
|
|
405
|
+
| IReq_ControllerAccountsSpendLimit
|
|
402
406
|
| IReq_ControllerAccountsRemove
|
|
403
407
|
| IReq_ControllerAccountsAdd
|
|
404
408
|
| IReq_ControllerAccountsReauth
|
|
@@ -11,5 +11,11 @@ import * as authswitchUsageWindows from '../ts_authswitch/authority-usagewindows
|
|
|
11
11
|
import * as authswitchUsageLimit from '../ts_authswitch/authority-usagelimit.js';
|
|
12
12
|
// A Claude account's subscription facts and payment problem, in the words the authswitch command line uses; types only behind it.
|
|
13
13
|
import * as authswitchSubscription from '../ts_authswitch/authority-subscription.js';
|
|
14
|
+
// An API key's month: the spend limit rule and dollar amounts, as the command line states them; it imports nothing.
|
|
15
|
+
import * as authswitchSpend from '../ts_authswitch/authority-spend.js';
|
|
16
|
+
// The service's contract, which the controller's interfaces load already: the processes holding a Claude sign-in, in
|
|
17
|
+
// the words the command line uses.
|
|
18
|
+
import * as authswitchAuthority from '../ts_authswitch/authority-contract.js';
|
|
14
19
|
|
|
15
|
-
export { authswitchPreuseText, authswitchSubscription, authswitchUsageLimit,
|
|
20
|
+
export { authswitchAuthority, authswitchPreuseText, authswitchSpend, authswitchSubscription, authswitchUsageLimit,
|
|
21
|
+
authswitchUsageWindows };
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import * as plugins from './plugins.js';
|
|
2
|
-
import
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
2
|
+
import {
|
|
3
|
+
spendAttentionPercent,
|
|
4
|
+
type IAccountActionSlot,
|
|
5
|
+
type IAccountFact,
|
|
6
|
+
type IAccountRow,
|
|
7
|
+
type IAccountsSummary,
|
|
8
|
+
type TAccountsTone,
|
|
8
9
|
} from './classes.accountsreadmodel.js';
|
|
9
10
|
|
|
10
11
|
/**
|
|
@@ -95,7 +96,10 @@ export const renderSlots = (
|
|
|
95
96
|
`;
|
|
96
97
|
};
|
|
97
98
|
|
|
98
|
-
/**
|
|
99
|
+
/**
|
|
100
|
+
* An account as one line of the list: mark, name and who uses it, its tightest window -- a key's month, which without a
|
|
101
|
+
* limit has its spend and no bar -- and its one status.
|
|
102
|
+
*/
|
|
99
103
|
export const renderListRow = (
|
|
100
104
|
rowArg: IAccountRow,
|
|
101
105
|
openArg: (rowArg: IAccountRow) => void,
|
|
@@ -113,8 +117,9 @@ export const renderListRow = (
|
|
|
113
117
|
${meter
|
|
114
118
|
? plugins.deesElement.html`
|
|
115
119
|
<span class="meterText"><span>${meter.label}</span><span class="meterValue">${meter.valueText}</span></span>
|
|
116
|
-
|
|
117
|
-
.
|
|
120
|
+
${meter.percent === null ? '' : plugins.deesElement.html`<dees-meter .size=${'sm'} .value=${meter.percent}
|
|
121
|
+
.threshold=${meter.threshold} .tone=${meterTone(meter.tone)} .label=${meter.label}
|
|
122
|
+
.valueText=${meter.valueText}></dees-meter>`}`
|
|
118
123
|
: plugins.deesElement.html`<span class="meterText"><span>No reading</span><span class="meterValue">—</span></span>`}
|
|
119
124
|
</span>
|
|
120
125
|
<dees-badge data-status .type=${badgeType(rowArg.pill.tone)} .text=${rowArg.pill.text}></dees-badge>
|
|
@@ -144,17 +149,21 @@ export const renderSummary = (summaryArg: IAccountsSummary): plugins.deesElement
|
|
|
144
149
|
</div>
|
|
145
150
|
`;
|
|
146
151
|
|
|
147
|
-
/**
|
|
152
|
+
/**
|
|
153
|
+
* An account's usage windows, each with its reset, ticked at its maximum; or why there is no reading. A key's month
|
|
154
|
+
* wants attention from `spendAttentionPercent` of its limit, with no tick: a key has no maximum usage.
|
|
155
|
+
*/
|
|
148
156
|
export const renderUsageMeters = (rowArg: IAccountRow, emptyArg: string): plugins.deesElement.TemplateResult => {
|
|
149
157
|
const meters = rowArg.usage?.meters ?? [];
|
|
150
158
|
const threshold = rowArg.maxUsagePercent !== null && rowArg.maxUsagePercent < 100 ? rowArg.maxUsagePercent : null;
|
|
159
|
+
const attentionAt = rowArg.apiKey ? spendAttentionPercent : threshold;
|
|
151
160
|
return plugins.deesElement.html`
|
|
152
161
|
<mp-usage-meters class=${rowArg.usage?.current === false ? 'stale' : ''} data-usage-meters
|
|
153
162
|
.windows=${meters.map((meterArg) => ({
|
|
154
163
|
label: meterArg.label,
|
|
155
164
|
percent: meterArg.percent,
|
|
156
165
|
resetText: meterArg.resetText,
|
|
157
|
-
tone: meterTone(meterArg.percent >= 100 ? 'neutral' :
|
|
166
|
+
tone: meterTone(meterArg.percent >= 100 ? 'neutral' : attentionAt !== null && meterArg.percent >= attentionAt
|
|
158
167
|
? 'attention' : 'positive'),
|
|
159
168
|
}))}
|
|
160
169
|
.threshold=${threshold}
|