agl 43.2.0 → 43.3.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 +29 -0
- package/dist_serve/bundle.js +2845 -2638
- package/dist_serve/bundle.js.map +2 -2
- package/dist_serve/bundle.js.third-party-notices.json +1 -1
- package/dist_serve/bundle.js.third-party-notices.txt +1 -1
- package/dist_ts/00_commitinfo_data.js +1 -1
- package/dist_ts/aglapi/aglapisurface.document.js +197 -17
- package/dist_ts/classes.accountsactions.d.ts +3 -1
- package/dist_ts/classes.accountsactions.js +21 -3
- package/dist_ts/classes.authstore.d.ts +7 -0
- package/dist_ts/classes.authstore.js +9 -1
- package/dist_ts/classes.claudeharness.d.ts +29 -2
- package/dist_ts/classes.claudeharness.js +35 -6
- package/dist_ts/classes.codexclientadapter.d.ts +11 -0
- package/dist_ts/classes.codexclientadapter.js +14 -2
- package/dist_ts/classes.controller.d.ts +187 -12
- package/dist_ts/classes.controller.js +1208 -186
- package/dist_ts/classes.controllerdevices.d.ts +2 -0
- package/dist_ts/classes.controllerdevices.js +6 -1
- package/dist_ts/classes.inbox.d.ts +72 -0
- package/dist_ts/classes.inbox.js +231 -0
- package/dist_ts/classes.inferencerouter.d.ts +10 -0
- package/dist_ts/classes.inferencerouter.js +5 -3
- package/dist_ts/classes.inferenceservice.js +2 -2
- package/dist_ts/classes.mcpclient.d.ts +1 -1
- package/dist_ts/classes.mcpclient.js +24 -6
- package/dist_ts/classes.mcpcontrollerhost.js +6 -1
- package/dist_ts/classes.mcptools.js +18 -8
- package/dist_ts/classes.mcpvalidation.d.ts +5 -0
- package/dist_ts/classes.mcpvalidation.js +32 -2
- package/dist_ts/classes.nativesessions.d.ts +29 -4
- package/dist_ts/classes.nativesessions.js +41 -9
- package/dist_ts/classes.opencodeclient.d.ts +23 -2
- package/dist_ts/classes.opencodeclient.js +47 -3
- package/dist_ts/classes.publishedset.d.ts +38 -0
- package/dist_ts/classes.publishedset.js +50 -0
- package/dist_ts/classes.sessionfeed.d.ts +3 -3
- package/dist_ts/classes.sessionfeed.js +18 -26
- package/dist_ts/classes.systemmetricssampler.d.ts +6 -0
- package/dist_ts/classes.systemmetricssampler.js +15 -3
- package/dist_ts/classes.ticketstore.d.ts +50 -3
- package/dist_ts/classes.ticketstore.js +45 -8
- package/dist_ts/classes.workercallers.js +4 -2
- package/dist_ts/driver/classes.directreports.d.ts +14 -4
- package/dist_ts/driver/classes.directreports.js +42 -23
- package/dist_ts/driver/classes.directreportstore.d.ts +8 -1
- package/dist_ts/driver/classes.directreportstore.js +20 -10
- package/dist_ts/driver/classes.driverservice.d.ts +44 -3
- package/dist_ts/driver/classes.driverservice.js +50 -16
- package/dist_ts/fleet/classes.claudeworkers.d.ts +21 -5
- package/dist_ts/fleet/classes.claudeworkers.js +142 -46
- package/dist_ts/fleet/classes.codexworkers.d.ts +16 -4
- package/dist_ts/fleet/classes.codexworkers.js +22 -5
- package/dist_ts/fleet/classes.workercommand.d.ts +6 -1
- package/dist_ts/fleet/classes.workercommand.js +15 -4
- package/dist_ts/fleet/classes.workers.d.ts +21 -1
- package/dist_ts/fleet/classes.workers.js +80 -40
- package/dist_ts/fleet/classes.workerstore.js +14 -8
- package/dist_ts/fleet/functions.unbounddrivers.js +2 -2
- package/dist_ts/fleet/functions.workervalidation.js +11 -4
- package/dist_ts/fleet/interfaces.workers.d.ts +27 -5
- package/dist_ts/fleet/interfaces.workers.js +8 -4
- package/dist_ts/functions.agentmessage.d.ts +3 -0
- package/dist_ts/functions.agentmessage.js +4 -1
- package/dist_ts/functions.deviceapi.d.ts +198 -4
- package/dist_ts/functions.deviceapi.js +1060 -38
- package/dist_ts/functions.exactpersistence.d.ts +3 -0
- package/dist_ts/functions.exactpersistence.js +4 -0
- package/dist_ts/functions.fleetworkercli.d.ts +1 -1
- package/dist_ts/functions.fleetworkercli.js +11 -8
- package/dist_ts/functions.inferencecli.js +3 -1
- package/dist_ts/functions.mcpfleetworkertools.js +3 -3
- package/dist_ts/functions.ticketactor.d.ts +17 -1
- package/dist_ts/functions.ticketactor.js +55 -15
- package/dist_ts/functions.ticketvalidation.js +11 -2
- package/dist_ts/interfaces.auth.d.ts +1 -1
- package/dist_ts/interfaces.auth.js +9 -1
- package/dist_ts/plugins.d.ts +3 -1
- package/dist_ts/plugins.js +7 -2
- package/dist_ts_authswitch/authority-contract.d.ts +25 -0
- package/dist_ts_authswitch/authority-contract.js +1 -1
- package/dist_ts_authswitch/authority-overview.d.ts +8 -0
- package/dist_ts_authswitch/authority-overview.js +17 -6
- package/dist_ts_authswitch/authority-placement.d.ts +20 -16
- package/dist_ts_authswitch/authority-placement.js +17 -10
- package/dist_ts_authswitch/authority-renewal.d.ts +34 -0
- package/dist_ts_authswitch/authority-renewal.js +56 -0
- package/dist_ts_authswitch/classes.authoritybroker.d.ts +8 -0
- package/dist_ts_authswitch/classes.authoritybroker.js +35 -2
- package/dist_ts_authswitch/classes.authoritycli.d.ts +1 -0
- package/dist_ts_authswitch/classes.authoritycli.js +44 -3
- package/dist_ts_authswitch/classes.authorityclient.d.ts +6 -1
- package/dist_ts_authswitch/classes.authorityclient.js +12 -4
- package/dist_ts_authswitch/classes.authoritydaemon.js +8 -1
- package/dist_ts_authswitch/classes.authoritydatabase.js +6 -2
- package/dist_ts_authswitch/classes.authoritymodels.d.ts +7 -0
- package/dist_ts_authswitch/classes.authoritymodels.js +21 -5
- package/dist_ts_interfaces/devices.d.ts +1027 -7
- package/dist_ts_interfaces/devices.js +68 -2
- package/dist_ts_interfaces/fleetworkers.d.ts +37 -10
- package/dist_ts_interfaces/fleetworkers.js +19 -8
- package/dist_ts_interfaces/inbox.d.ts +234 -0
- package/dist_ts_interfaces/inbox.js +101 -0
- package/dist_ts_interfaces/index.d.ts +1 -0
- package/dist_ts_interfaces/index.js +2 -1
- package/dist_ts_interfaces/interfaces.d.ts +10 -3
- package/dist_ts_interfaces/interfaces.js +4 -2
- package/dist_ts_interfaces/mcprequests.d.ts +34 -4
- package/dist_ts_interfaces/mcprequests.js +11 -1
- package/dist_ts_interfaces/mcpworkspacerequests.d.ts +4 -1
- package/dist_ts_interfaces/mcpworkspacerequests.js +1 -1
- package/dist_ts_interfaces/nativesessions.d.ts +16 -3
- package/dist_ts_interfaces/plugins.d.ts +2 -1
- package/dist_ts_interfaces/plugins.js +4 -2
- package/dist_ts_interfaces/requests.accounts.d.ts +21 -0
- package/dist_ts_interfaces/requests.accounts.js +3 -1
- package/dist_ts_interfaces/requests.d.ts +3 -2
- package/dist_ts_interfaces/requests.js +1 -1
- package/dist_ts_interfaces/workercallers.d.ts +2 -0
- package/dist_ts_migration/classes.documentmigrationrunner.d.ts +14 -0
- package/dist_ts_migration/classes.documentmigrationrunner.js +20 -1
- package/dist_ts_migration/index.d.ts +1 -0
- package/dist_ts_migration/index.js +2 -1
- package/dist_ts_migration/v43_ticketactornames.d.ts +32 -0
- package/dist_ts_migration/v43_ticketactornames.js +236 -0
- package/docs/authswitch.md +20 -1
- package/package.json +3 -3
- package/readme.md +144 -27
- package/ts/00_commitinfo_data.ts +1 -1
- package/ts/aglapi/aglapisurface.document.ts +196 -16
- package/ts/classes.accountsactions.ts +30 -3
- package/ts/classes.authstore.ts +10 -0
- package/ts/classes.claudeharness.ts +45 -5
- package/ts/classes.codexclientadapter.ts +14 -1
- package/ts/classes.controller.ts +1412 -262
- package/ts/classes.controllerdevices.ts +6 -0
- package/ts/classes.inbox.ts +239 -0
- package/ts/classes.inferencerouter.ts +15 -2
- package/ts/classes.inferenceservice.ts +1 -1
- package/ts/classes.mcpclient.ts +24 -3
- package/ts/classes.mcpcontrollerhost.ts +5 -0
- package/ts/classes.mcptools.ts +17 -7
- package/ts/classes.mcpvalidation.ts +27 -1
- package/ts/classes.nativesessions.ts +63 -12
- package/ts/classes.opencodeclient.ts +55 -4
- package/ts/classes.publishedset.ts +56 -0
- package/ts/classes.sessionfeed.ts +17 -20
- package/ts/classes.systemmetricssampler.ts +13 -2
- package/ts/classes.ticketstore.ts +73 -12
- package/ts/classes.workercallers.ts +3 -1
- package/ts/driver/classes.directreports.ts +42 -23
- package/ts/driver/classes.directreportstore.ts +20 -9
- package/ts/driver/classes.driverservice.ts +75 -14
- package/ts/fleet/classes.claudeworkers.ts +112 -39
- package/ts/fleet/classes.codexworkers.ts +21 -6
- package/ts/fleet/classes.workercommand.ts +14 -4
- package/ts/fleet/classes.workers.ts +75 -41
- package/ts/fleet/classes.workerstore.ts +11 -7
- package/ts/fleet/functions.unbounddrivers.ts +1 -1
- package/ts/fleet/functions.workervalidation.ts +8 -3
- package/ts/fleet/interfaces.workers.ts +26 -7
- package/ts/functions.agentmessage.ts +3 -0
- package/ts/functions.deviceapi.ts +1292 -34
- package/ts/functions.exactpersistence.ts +5 -0
- package/ts/functions.fleetworkercli.ts +10 -7
- package/ts/functions.inferencecli.ts +2 -0
- package/ts/functions.mcpfleetworkertools.ts +2 -2
- package/ts/functions.ticketactor.ts +58 -14
- package/ts/functions.ticketvalidation.ts +11 -1
- package/ts/interfaces.auth.ts +8 -0
- package/ts/plugins.ts +7 -0
- package/ts_authswitch/authority-contract.ts +20 -0
- package/ts_authswitch/authority-overview.ts +28 -6
- package/ts_authswitch/authority-placement.ts +25 -17
- package/ts_authswitch/authority-renewal.ts +64 -0
- package/ts_authswitch/classes.authoritybroker.ts +34 -1
- package/ts_authswitch/classes.authoritycli.ts +49 -2
- package/ts_authswitch/classes.authorityclient.ts +14 -4
- package/ts_authswitch/classes.authoritydaemon.ts +9 -1
- package/ts_authswitch/classes.authoritydatabase.ts +5 -1
- package/ts_authswitch/classes.authoritymodels.ts +23 -3
- package/ts_authswitch/native-contracts.md +21 -0
- package/ts_authswitch/readme.md +1 -1
- package/ts_interfaces/devices.schema.json +3576 -603
- package/ts_interfaces/devices.ts +1111 -6
- package/ts_interfaces/fleetworkers.ts +38 -10
- package/ts_interfaces/inbox.ts +287 -0
- package/ts_interfaces/index.ts +1 -0
- package/ts_interfaces/interfaces.ts +9 -2
- package/ts_interfaces/mcprequests.ts +43 -4
- package/ts_interfaces/mcpworkspacerequests.ts +4 -2
- package/ts_interfaces/nativesessions.ts +17 -3
- package/ts_interfaces/plugins.ts +3 -1
- package/ts_interfaces/requests.accounts.ts +20 -0
- package/ts_interfaces/requests.ts +4 -0
- package/ts_interfaces/workercallers.ts +2 -0
- package/ts_migration/classes.documentmigrationrunner.ts +21 -0
- package/ts_migration/index.ts +1 -0
- package/ts_migration/v43_ticketactornames.ts +225 -0
- package/ts_web/00_commitinfo_data.ts +1 -1
- package/ts_web/accounts.plugins.ts +4 -2
- package/ts_web/classes.accountsreadmodel.ts +33 -0
- package/ts_web/classes.browserpresentation.ts +10 -5
- package/ts_web/classes.inboxfeed.ts +329 -0
- package/ts_web/classes.nativesessionstate.ts +9 -23
- package/ts_web/elements.accounts.ts +81 -0
- package/ts_web/elements.deployments.ts +66 -2
- package/ts_web/elements.fleetworker.ts +4 -2
- package/ts_web/elements.harnesscontrollerapp.ts +107 -37
- package/ts_web/elements.inbox.ts +808 -0
- package/ts_web/functions.inbox.ts +95 -0
- package/ts_web/functions.sessioncards.ts +40 -0
- package/ts_web/plugins.ts +2 -0
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Where a new session goes: an account's lifecycle against its lapse date, and how much of its usage it can spend per
|
|
3
|
-
* hour before that usage resets
|
|
4
|
-
* command line and `agl proxy status` show it; an existing session keeps its account for the prompt cache and
|
|
5
|
-
* placed again by it.
|
|
3
|
+
* hour before that usage resets, the account lapses or it renews. The inference proxy places new sessions by it, and the
|
|
4
|
+
* authswitch command line and `agl proxy status` show it; an existing session keeps its account for the prompt cache and
|
|
5
|
+
* is never placed again by it.
|
|
6
6
|
*
|
|
7
|
-
* Besides types, the module imports only the limit rule of `authority-usagelimit.ts`, the window reader it uses
|
|
8
|
-
* spend month of `authority-spend.ts`, whose own imports carry nothing to a
|
|
9
|
-
* nothing behind it.
|
|
7
|
+
* Besides types, the module imports only the limit rule of `authority-usagelimit.ts`, the window reader it uses, the
|
|
8
|
+
* spend month of `authority-spend.ts` and the renewal of `authority-renewal.ts`, whose own imports carry nothing to a
|
|
9
|
+
* page, so it bundles for a browser with nothing behind it.
|
|
10
10
|
*/
|
|
11
11
|
import type { TAuthSwitchUsageReading } from './classes.authorityusage.js';
|
|
12
12
|
/**
|
|
@@ -26,8 +26,8 @@ export interface IAuthSwitchPlacement {
|
|
|
26
26
|
eligibility: TAuthSwitchPlacementEligibility;
|
|
27
27
|
/**
|
|
28
28
|
* The percent of its usage the account can spend per hour and still stay within every counted window before that
|
|
29
|
-
* window resets
|
|
30
|
-
* reading counts no window.
|
|
29
|
+
* window resets, the account lapses or it renews, whichever comes first; the smallest over its counted windows.
|
|
30
|
+
* `null` when the reading counts no window.
|
|
31
31
|
*/
|
|
32
32
|
score: number | null;
|
|
33
33
|
}
|
|
@@ -35,19 +35,23 @@ export interface IAuthSwitchPlacement {
|
|
|
35
35
|
export declare const authSwitchAccountLifecycle: (lapsesAtArg: string | null, nowArg: number) => TAuthSwitchAccountLifecycle;
|
|
36
36
|
/**
|
|
37
37
|
* Where an account stands for a new session at `nowArg`, from its usage reading (`null` when none is held), its usage
|
|
38
|
-
* threshold and its
|
|
38
|
+
* threshold, its lapse date and its renewal anchor (`IAuthSwitchAccount.renewsAt`, `null` when its owner set none).
|
|
39
39
|
*
|
|
40
40
|
* The score is taken over the windows the account's limit counts (`authSwitchCountedWindows`). Per window it is the
|
|
41
41
|
* headroom left below the threshold -- the percent the limit decides by, the estimate between reads where present --
|
|
42
|
-
* divided by the hours until the window's deadline: its reset,
|
|
43
|
-
* least an hour. Usage that resets soon, or is lost when the account
|
|
44
|
-
* days; placing by it uses that first and spares the accounts that
|
|
42
|
+
* divided by the hours until the window's deadline: the earliest of its reset, the account's lapse and its next renewal
|
|
43
|
+
* (`authSwitchNextRenewal` from `nowArg`), and at least an hour. Usage that resets soon, or is lost when the account
|
|
44
|
+
* lapses, is worth more now than usage that stays for days; placing by it uses that first and spares the accounts that
|
|
45
|
+
* reset later. Usage a window still holds at the renewal counts the same way, as spent by the renewal. Whether a
|
|
46
|
+
* provider's windows reset at a renewal is not known: the renewal is a scoring deadline only, and eligibility, lifecycle
|
|
47
|
+
* and capacity never read it. An account with a lapse date ignores its renewal, since a canceled subscription does not
|
|
48
|
+
* renew.
|
|
45
49
|
*
|
|
46
50
|
* An API key's spend reading whose month ended (`authSwitchSpendMonthEnded`, as `authSwitchUsageLimit` judges it) says
|
|
47
51
|
* nothing about the current month, which starts with nothing spent: its window counts as 0% used, with the end of the
|
|
48
52
|
* current month (`authSwitchSpendPeriod`) as its reset.
|
|
49
53
|
*/
|
|
50
|
-
export declare const authSwitchPlacement: (readingArg: TAuthSwitchUsageReading | null, maxUsagePercentArg: number | null, lapsesAtArg: string | null, nowArg: number, reserveLiftUntilArg?: string | null) => IAuthSwitchPlacement;
|
|
54
|
+
export declare const authSwitchPlacement: (readingArg: TAuthSwitchUsageReading | null, maxUsagePercentArg: number | null, lapsesAtArg: string | null, renewalAnchorArg: string | null, nowArg: number, reserveLiftUntilArg?: string | null) => IAuthSwitchPlacement;
|
|
51
55
|
/** An account as placement ranks it: its score, whether it is a last resort, and its headroom below its threshold. */
|
|
52
56
|
export interface IAuthSwitchPlacementRank {
|
|
53
57
|
id: string;
|
|
@@ -58,8 +62,8 @@ export interface IAuthSwitchPlacementRank {
|
|
|
58
62
|
/**
|
|
59
63
|
* The order a new session is placed in: an account that lapses within `lapseHorizonMs` only after every other one;
|
|
60
64
|
* then by the account's score shared among the requests it serves now -- `score / (1 + in flight)`, so new sessions
|
|
61
|
-
* spread over the accounts in proportion to what each can spend per hour, and usage that resets or
|
|
62
|
-
* spent first -- then by headroom and id. An account without a counted window comes after every scored
|
|
63
|
-
* busy of them first.
|
|
65
|
+
* spread over the accounts in proportion to what each can spend per hour, and usage that resets, lapses or meets a
|
|
66
|
+
* renewal soon is spent first -- then by headroom and id. An account without a counted window comes after every scored
|
|
67
|
+
* one, the least busy of them first.
|
|
64
68
|
*/
|
|
65
69
|
export declare const authSwitchPlacementOrder: (inFlightArg: (accountIdArg: string) => number) => (left: IAuthSwitchPlacementRank, right: IAuthSwitchPlacementRank) => number;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { authSwitchCountedWindows, authSwitchEffectiveMaxUsage } from './authority-usagelimit.js';
|
|
2
2
|
import { authSwitchUsageWindowPercent, authSwitchUsageWindowResetAt } from './authority-usagewindows.js';
|
|
3
3
|
import { authSwitchSpendMonthEnded, authSwitchSpendPeriod } from './authority-spend.js';
|
|
4
|
+
import { authSwitchNextRenewal } from './authority-renewal.js';
|
|
4
5
|
/** How close to its lapse an account takes new sessions only as a last resort: a day. */
|
|
5
6
|
export const lapseHorizonMs = 86_400_000;
|
|
6
7
|
/** The shortest time a window's headroom is spread over, so a window about to reset does not score without bound. */
|
|
@@ -9,21 +10,27 @@ const minimumDeadlineMs = 3_600_000;
|
|
|
9
10
|
export const authSwitchAccountLifecycle = (lapsesAtArg, nowArg) => lapsesAtArg === null ? 'active' : Date.parse(lapsesAtArg) <= nowArg ? 'lapsed' : 'canceled';
|
|
10
11
|
/**
|
|
11
12
|
* Where an account stands for a new session at `nowArg`, from its usage reading (`null` when none is held), its usage
|
|
12
|
-
* threshold and its
|
|
13
|
+
* threshold, its lapse date and its renewal anchor (`IAuthSwitchAccount.renewsAt`, `null` when its owner set none).
|
|
13
14
|
*
|
|
14
15
|
* The score is taken over the windows the account's limit counts (`authSwitchCountedWindows`). Per window it is the
|
|
15
16
|
* headroom left below the threshold -- the percent the limit decides by, the estimate between reads where present --
|
|
16
|
-
* divided by the hours until the window's deadline: its reset,
|
|
17
|
-
* least an hour. Usage that resets soon, or is lost when the account
|
|
18
|
-
* days; placing by it uses that first and spares the accounts that
|
|
17
|
+
* divided by the hours until the window's deadline: the earliest of its reset, the account's lapse and its next renewal
|
|
18
|
+
* (`authSwitchNextRenewal` from `nowArg`), and at least an hour. Usage that resets soon, or is lost when the account
|
|
19
|
+
* lapses, is worth more now than usage that stays for days; placing by it uses that first and spares the accounts that
|
|
20
|
+
* reset later. Usage a window still holds at the renewal counts the same way, as spent by the renewal. Whether a
|
|
21
|
+
* provider's windows reset at a renewal is not known: the renewal is a scoring deadline only, and eligibility, lifecycle
|
|
22
|
+
* and capacity never read it. An account with a lapse date ignores its renewal, since a canceled subscription does not
|
|
23
|
+
* renew.
|
|
19
24
|
*
|
|
20
25
|
* An API key's spend reading whose month ended (`authSwitchSpendMonthEnded`, as `authSwitchUsageLimit` judges it) says
|
|
21
26
|
* nothing about the current month, which starts with nothing spent: its window counts as 0% used, with the end of the
|
|
22
27
|
* current month (`authSwitchSpendPeriod`) as its reset.
|
|
23
28
|
*/
|
|
24
|
-
export const authSwitchPlacement = (readingArg, maxUsagePercentArg, lapsesAtArg, nowArg, reserveLiftUntilArg = null) => {
|
|
29
|
+
export const authSwitchPlacement = (readingArg, maxUsagePercentArg, lapsesAtArg, renewalAnchorArg, nowArg, reserveLiftUntilArg = null) => {
|
|
25
30
|
const lifecycle = authSwitchAccountLifecycle(lapsesAtArg, nowArg);
|
|
26
31
|
const lapsesAt = lapsesAtArg === null ? Infinity : Date.parse(lapsesAtArg);
|
|
32
|
+
const renewsAt = lapsesAtArg !== null || renewalAnchorArg === null ? Infinity
|
|
33
|
+
: authSwitchNextRenewal(renewalAnchorArg, nowArg);
|
|
27
34
|
const eligibility = lifecycle === 'lapsed' ? 'never'
|
|
28
35
|
: lapsesAt - nowArg <= lapseHorizonMs ? 'last_resort' : 'normal';
|
|
29
36
|
const threshold = authSwitchEffectiveMaxUsage(maxUsagePercentArg, reserveLiftUntilArg, nowArg) ?? 100;
|
|
@@ -32,7 +39,7 @@ export const authSwitchPlacement = (readingArg, maxUsagePercentArg, lapsesAtArg,
|
|
|
32
39
|
const scores = windows.map((windowArg) => {
|
|
33
40
|
const headroom = spendMonthEnded ? threshold : Math.max(0, threshold - authSwitchUsageWindowPercent(windowArg));
|
|
34
41
|
const resetAt = spendMonthEnded ? Date.parse(authSwitchSpendPeriod(nowArg).end) : authSwitchUsageWindowResetAt(windowArg, nowArg);
|
|
35
|
-
const deadline = Math.min(resetAt, lapsesAt);
|
|
42
|
+
const deadline = Math.min(resetAt, lapsesAt, renewsAt);
|
|
36
43
|
return headroom / (Math.max(deadline - nowArg, minimumDeadlineMs) / 3_600_000);
|
|
37
44
|
});
|
|
38
45
|
return { lifecycle, eligibility, score: scores.length ? Math.min(...scores) : null };
|
|
@@ -40,9 +47,9 @@ export const authSwitchPlacement = (readingArg, maxUsagePercentArg, lapsesAtArg,
|
|
|
40
47
|
/**
|
|
41
48
|
* The order a new session is placed in: an account that lapses within `lapseHorizonMs` only after every other one;
|
|
42
49
|
* then by the account's score shared among the requests it serves now -- `score / (1 + in flight)`, so new sessions
|
|
43
|
-
* spread over the accounts in proportion to what each can spend per hour, and usage that resets or
|
|
44
|
-
* spent first -- then by headroom and id. An account without a counted window comes after every scored
|
|
45
|
-
* busy of them first.
|
|
50
|
+
* spread over the accounts in proportion to what each can spend per hour, and usage that resets, lapses or meets a
|
|
51
|
+
* renewal soon is spent first -- then by headroom and id. An account without a counted window comes after every scored
|
|
52
|
+
* one, the least busy of them first.
|
|
46
53
|
*/
|
|
47
54
|
export const authSwitchPlacementOrder = (inFlightArg) => (left, right) => Number(left.lastResort) - Number(right.lastResort)
|
|
48
55
|
|| Number(left.score === null) - Number(right.score === null)
|
|
@@ -50,4 +57,4 @@ export const authSwitchPlacementOrder = (inFlightArg) => (left, right) => Number
|
|
|
50
57
|
? right.score / (1 + inFlightArg(right.id)) - left.score / (1 + inFlightArg(left.id))
|
|
51
58
|
: inFlightArg(left.id) - inFlightArg(right.id))
|
|
52
59
|
|| right.headroom - left.headroom || left.id.localeCompare(right.id);
|
|
53
|
-
//# sourceMappingURL=data:application/json;base64,
|
|
60
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiYXV0aG9yaXR5LXBsYWNlbWVudC5qcyIsInNvdXJjZVJvb3QiO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EdBQUcsTUFBTSxDQUFDLEtBQUssQ0FBQyxVQUFVLENBQUM7T0FDMUQsTUFBTSxDQUFDLElBQUksQ0FBQyxLQUFLLEtBQUssSUFBSSxDQUFDLEdBQUcsTUFBTSxDQUFDLEtBQUssQ0FBQyxLQUFLLEtBQUssSUFBSSxDQUFDO09BQzFELENBQUMsSUFBSSxDQUFDLEtBQUssS0FBSyxJQUFJLElBQUksS0FBSyxDQUFDLEtBQUssS0FBSyxJQUFJO1FBQzdDLENBQUMsQ0FBQyxLQUFLLENBQUMsS0FBSyxHQUFHLENBQUMsQ0FBQyxHQUFHLFdBQVcsQ0FBQyxLQUFLLENBQUMsRUFBRSxDQUFDLENBQUMsR0FBRyxJQUFJLENBQUMsS0FBSyxHQUFHLENBQUMsQ0FBQyxHQUFHLFdBQVcsQ0FBQyxJQUFJLENBQUMsRUFBRSxDQUFDLENBQUM7UUFDckYsQ0FBQyxDQUFDLFdBQVcsQ0FBQyxJQUFJLENBQUMsRUFBRSxDQUFDLEdBQUcsV0FBVyxDQUFDLEtBQUssQ0FBQyxFQUFFLENBQUMsQ0FBQztPQUM5QyxLQUFLLENBQUMsUUFBUSxHQUFHLElBQUksQ0FBQyxRQUFRLElBQUksSUFBSSxDQUFDLEVBQUUsQ0FBQyxhQUFhLENBQUMsS0FBSyxDQUFDLEVBQUUsQ0FBQyxDQUFDIn0=
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A Claude sign-in's monthly renewal (AGL-1644), as its owner set it: the anchor is one date and time the subscription
|
|
3
|
+
* renewed or renews (`IAuthSwitchAccount.renewsAt`), and every renewal is a calendar month from it. AGL derives no
|
|
4
|
+
* renewal from anything a provider states; the owner sets the anchor, and nothing else does.
|
|
5
|
+
*
|
|
6
|
+
* Whether a provider's usage windows reset at the renewal is not known. Placement uses the renewal only as a deadline
|
|
7
|
+
* (`authority-placement.ts`): usage still held at the renewal counts as spent by then.
|
|
8
|
+
*
|
|
9
|
+
* The module imports nothing, so it bundles for a browser as it is.
|
|
10
|
+
*/
|
|
11
|
+
/**
|
|
12
|
+
* The renewal anchor rule, the one the authority applies to `authswitch.authority.renewal`: a date-time `Date.parse`
|
|
13
|
+
* reads, in any year from 2000 to 9999, as the lapse date rule (`isAuthSwitchLapsesAt`). A past anchor is valid: the
|
|
14
|
+
* next renewal is a whole number of months after it. A consumer validates with this rather than restating it; the
|
|
15
|
+
* authority stores the anchor as its ISO 8601 UTC form and answers any other value with the `invalid_input` refusal.
|
|
16
|
+
*/
|
|
17
|
+
export declare const isAuthSwitchRenewsAt: (value: unknown) => value is string;
|
|
18
|
+
/**
|
|
19
|
+
* The first monthly renewal strictly after `nowArg` (epoch milliseconds), as epoch milliseconds, from the anchor
|
|
20
|
+
* `anchorArg` (`isAuthSwitchRenewsAt`). An anchor still ahead is itself the next renewal. Every renewal is computed from
|
|
21
|
+
* the anchor, never from the renewal before it: the anchor's UTC day, clamped to the month's last day, at the anchor's
|
|
22
|
+
* UTC time, so an anchor on January 31st renews on February 28th (29th in a leap year) and again on March 31st.
|
|
23
|
+
* Throws for an anchor the rule refuses or a `nowArg` that is not a finite number.
|
|
24
|
+
*/
|
|
25
|
+
export declare const authSwitchNextRenewal: (anchorArg: string, nowArg: number) => number;
|
|
26
|
+
/** An account's next renewal as the account lists and `agl proxy status` show it; `source` says who set it. */
|
|
27
|
+
export interface IAuthSwitchRenewal {
|
|
28
|
+
/** The next renewal, ISO 8601 UTC (`authSwitchNextRenewal`). */
|
|
29
|
+
at: string;
|
|
30
|
+
/** `manual`: the owner set the anchor. AGL derives no renewal, so there is no other source. */
|
|
31
|
+
source: 'manual';
|
|
32
|
+
}
|
|
33
|
+
/** The next renewal of an account with the anchor `renewsAtArg` at `nowArg`, or `null` without an anchor. */
|
|
34
|
+
export declare const authSwitchRenewal: (renewsAtArg: string | null, nowArg: number) => IAuthSwitchRenewal | null;
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A Claude sign-in's monthly renewal (AGL-1644), as its owner set it: the anchor is one date and time the subscription
|
|
3
|
+
* renewed or renews (`IAuthSwitchAccount.renewsAt`), and every renewal is a calendar month from it. AGL derives no
|
|
4
|
+
* renewal from anything a provider states; the owner sets the anchor, and nothing else does.
|
|
5
|
+
*
|
|
6
|
+
* Whether a provider's usage windows reset at the renewal is not known. Placement uses the renewal only as a deadline
|
|
7
|
+
* (`authority-placement.ts`): usage still held at the renewal counts as spent by then.
|
|
8
|
+
*
|
|
9
|
+
* The module imports nothing, so it bundles for a browser as it is.
|
|
10
|
+
*/
|
|
11
|
+
/**
|
|
12
|
+
* The renewal anchor rule, the one the authority applies to `authswitch.authority.renewal`: a date-time `Date.parse`
|
|
13
|
+
* reads, in any year from 2000 to 9999, as the lapse date rule (`isAuthSwitchLapsesAt`). A past anchor is valid: the
|
|
14
|
+
* next renewal is a whole number of months after it. A consumer validates with this rather than restating it; the
|
|
15
|
+
* authority stores the anchor as its ISO 8601 UTC form and answers any other value with the `invalid_input` refusal.
|
|
16
|
+
*/
|
|
17
|
+
export const isAuthSwitchRenewsAt = (value) => {
|
|
18
|
+
if (typeof value !== 'string' || value.length > 64)
|
|
19
|
+
return false;
|
|
20
|
+
const at = Date.parse(value);
|
|
21
|
+
return Number.isFinite(at) && at >= Date.UTC(2000, 0, 1) && at < Date.UTC(10000, 0, 1);
|
|
22
|
+
};
|
|
23
|
+
/** The renewal `monthsArg` months after the anchor: the anchor's UTC day clamped to that month, at the anchor's UTC time. */
|
|
24
|
+
const renewalAfter = (anchor, monthsArg) => {
|
|
25
|
+
const year = anchor.getUTCFullYear();
|
|
26
|
+
const month = anchor.getUTCMonth() + monthsArg;
|
|
27
|
+
// Day 0 of the following month is the last day of this one; `Date.UTC` carries a month past December into the year.
|
|
28
|
+
const lastDay = new Date(Date.UTC(year, month + 1, 0)).getUTCDate();
|
|
29
|
+
const timeOfDay = anchor.getTime() - Date.UTC(year, anchor.getUTCMonth(), anchor.getUTCDate());
|
|
30
|
+
return Date.UTC(year, month, Math.min(anchor.getUTCDate(), lastDay)) + timeOfDay;
|
|
31
|
+
};
|
|
32
|
+
/**
|
|
33
|
+
* The first monthly renewal strictly after `nowArg` (epoch milliseconds), as epoch milliseconds, from the anchor
|
|
34
|
+
* `anchorArg` (`isAuthSwitchRenewsAt`). An anchor still ahead is itself the next renewal. Every renewal is computed from
|
|
35
|
+
* the anchor, never from the renewal before it: the anchor's UTC day, clamped to the month's last day, at the anchor's
|
|
36
|
+
* UTC time, so an anchor on January 31st renews on February 28th (29th in a leap year) and again on March 31st.
|
|
37
|
+
* Throws for an anchor the rule refuses or a `nowArg` that is not a finite number.
|
|
38
|
+
*/
|
|
39
|
+
export const authSwitchNextRenewal = (anchorArg, nowArg) => {
|
|
40
|
+
if (!isAuthSwitchRenewsAt(anchorArg) || !Number.isFinite(nowArg))
|
|
41
|
+
throw new Error('Invalid renewal anchor or time.');
|
|
42
|
+
const anchor = new Date(Date.parse(anchorArg));
|
|
43
|
+
if (anchor.getTime() > nowArg)
|
|
44
|
+
return anchor.getTime();
|
|
45
|
+
const now = new Date(nowArg);
|
|
46
|
+
// The whole months between the two, less one, lie at or before now; count up from there.
|
|
47
|
+
let months = Math.max(0, (now.getUTCFullYear() - anchor.getUTCFullYear()) * 12
|
|
48
|
+
+ now.getUTCMonth() - anchor.getUTCMonth() - 1);
|
|
49
|
+
while (renewalAfter(anchor, months) <= nowArg)
|
|
50
|
+
months += 1;
|
|
51
|
+
return renewalAfter(anchor, months);
|
|
52
|
+
};
|
|
53
|
+
/** The next renewal of an account with the anchor `renewsAtArg` at `nowArg`, or `null` without an anchor. */
|
|
54
|
+
export const authSwitchRenewal = (renewsAtArg, nowArg) => renewsAtArg === null ? null
|
|
55
|
+
: { at: new Date(authSwitchNextRenewal(renewsAtArg, nowArg)).toISOString(), source: 'manual' };
|
|
56
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiYXV0aG9yaXR5LXJlbmV3YWwuanM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UFjLEVBQUUsR0FBRyxNQUFNLENBQUMsY0FBYyxFQUFFLENBQUMsR0FBRyxFQUFFO1VBQzFFLEdBQUcsQ0FBQyxXQUFXLEVBQUUsR0FBRyxNQUFNLENBQUMsV0FBVyxFQUFFLEdBQUcsQ0FBQyxDQUFDLENBQUM7SUFDbEQsT0FBTyxZQUFZLENBQUMsTUFBTSxFQUFFLE1BQU0sQ0FBQyxJQUFJLE1BQU07UUFBRSxNQUFNLElBQUksQ0FBQyxDQUFDO0lBQzNELE9BQU8sWUFBWSxDQUFDLE1BQU0sRUFBRSxNQUFNLENBQUMsQ0FBQztBQUN0QyxDQUFDLENBQUM7QUFVRiw2R0FBNkc7QUFDN0csTUFBTSxDQUFDLE1BQU0saUJBQWlCLEdBQUcsQ0FBQyxXQUEwQixFQUFFLE1BQWMsRUFBNkIsRUFBRSxDQUN6RyxXQUFXLEtBQUssSUFBSSxDQUFDLENBQUMsQ0FBQyxJQUFJO0lBQ3pCLENBQUMsQ0FBQyxFQUFFLEVBQUUsRUFBRSxJQUFJLElBQUksQ0FBQyxxQkFBcUIsQ0FBQyxXQUFXLEVBQUUsTUFBTSxDQUFDLENBQUMsQ0FBQyxXQUFXLEVBQUUsRUFBRSxNQUFNLEVBQUUsUUFBUSxFQUFFLENBQUMifQ==
|
|
@@ -153,6 +153,14 @@ export declare class AuthSwitchAuthorityBroker {
|
|
|
153
153
|
* stored in its ISO 8601 UTC form; a past one is kept as given and means the account lapsed already.
|
|
154
154
|
*/
|
|
155
155
|
setAccountLapse(accountId: string, expectedRevision: number, lapsesAt: string | null): Promise<IAuthSwitchAccount>;
|
|
156
|
+
/**
|
|
157
|
+
* Sets or clears the anchor of a Claude sign-in's monthly renewal, as `setAccountLapse` sets its lapse date. The
|
|
158
|
+
* anchor is stored in its ISO 8601 UTC form; a past one is kept as given, since every renewal is a whole number of
|
|
159
|
+
* months after it. Only an account on a Claude sign-in has one; any other account is refused as `invalid_input`.
|
|
160
|
+
* The stored record carries `renewsAt` only while it is set: clearing removes the member, so an account that never
|
|
161
|
+
* had one is the record an earlier accounts service reads.
|
|
162
|
+
*/
|
|
163
|
+
setAccountRenewal(accountId: string, expectedRevision: number, renewsAt: string | null): Promise<IAuthSwitchAccount>;
|
|
156
164
|
/** Refuses a removal that would not go ahead, changing nothing; `removeAccount` refuses the same. */
|
|
157
165
|
assertAccountRemovable(accountId: string, expectedRevision: number): Promise<void>;
|
|
158
166
|
/**
|