agl 43.1.0 → 43.3.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 +32 -0
- package/dist_serve/bundle.js +5950 -5530
- package/dist_serve/bundle.js.map +2 -2
- package/dist_serve/bundle.js.third-party-notices.json +31 -31
- package/dist_serve/bundle.js.third-party-notices.txt +31 -31
- package/dist_ts/00_commitinfo_data.js +1 -1
- package/dist_ts/aglapi/aglapisurface.document.js +521 -17
- package/dist_ts/aglapi/interfaces.d.ts +3 -0
- package/dist_ts/aglapi/interfaces.js +2 -1
- package/dist_ts/classes.accountsactions.d.ts +3 -1
- package/dist_ts/classes.accountsactions.js +21 -3
- package/dist_ts/classes.authmodels.js +17 -4
- package/dist_ts/classes.authstore.js +16 -2
- package/dist_ts/classes.claudeharness.d.ts +16 -0
- package/dist_ts/classes.claudeharness.js +24 -2
- package/dist_ts/classes.cli.d.ts +4 -2
- package/dist_ts/classes.cli.js +6 -3
- package/dist_ts/classes.codexclientadapter.d.ts +11 -0
- package/dist_ts/classes.codexclientadapter.js +14 -2
- package/dist_ts/classes.controller.d.ts +175 -11
- package/dist_ts/classes.controller.js +1213 -173
- package/dist_ts/classes.controllerdevices.d.ts +2 -0
- package/dist_ts/classes.controllerdevices.js +6 -1
- package/dist_ts/classes.controllermanagement.d.ts +14 -4
- package/dist_ts/classes.controllermanagement.js +20 -2
- package/dist_ts/classes.gatewayclient.d.ts +115 -0
- package/dist_ts/classes.gatewayclient.js +336 -0
- package/dist_ts/classes.gatewayclientstore.d.ts +97 -0
- package/dist_ts/classes.gatewayclientstore.js +261 -0
- package/dist_ts/classes.inbox.d.ts +72 -0
- package/dist_ts/classes.inbox.js +231 -0
- package/dist_ts/classes.inferencerouter.d.ts +19 -0
- package/dist_ts/classes.inferencerouter.js +15 -3
- package/dist_ts/classes.inferenceservice.d.ts +9 -0
- package/dist_ts/classes.inferenceservice.js +28 -2
- package/dist_ts/classes.mcpclient.d.ts +4 -1
- package/dist_ts/classes.mcpclient.js +42 -6
- package/dist_ts/classes.mcpcontrollerhost.d.ts +3 -1
- package/dist_ts/classes.mcpcontrollerhost.js +11 -1
- package/dist_ts/classes.mcptools.d.ts +3 -3
- package/dist_ts/classes.mcptools.js +38 -8
- package/dist_ts/classes.mcpvalidation.d.ts +5 -0
- package/dist_ts/classes.mcpvalidation.js +38 -2
- package/dist_ts/classes.nativesessions.d.ts +17 -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.proxycontrol.d.ts +11 -0
- package/dist_ts/classes.proxycontrol.js +7 -1
- package/dist_ts/classes.proxycontrolclient.d.ts +17 -0
- package/dist_ts/classes.proxycontrolclient.js +35 -1
- package/dist_ts/classes.proxydaemon.js +8 -1
- package/dist_ts/classes.proxymonitor.d.ts +7 -0
- package/dist_ts/classes.proxymonitor.js +13 -1
- 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.trustedproxysecrets.d.ts +2 -0
- package/dist_ts/classes.trustedproxysecrets.js +5 -1
- package/dist_ts/driver/classes.directreports.d.ts +14 -4
- package/dist_ts/driver/classes.directreports.js +25 -6
- 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 +5 -1
- package/dist_ts/fleet/classes.workers.js +8 -2
- package/dist_ts/fleet/functions.unbounddrivers.js +2 -2
- package/dist_ts/fleet/functions.workervalidation.js +2 -2
- package/dist_ts/fleet/interfaces.workers.d.ts +21 -3
- package/dist_ts/fleet/interfaces.workers.js +1 -1
- package/dist_ts/functions.agentmessage.d.ts +3 -0
- package/dist_ts/functions.agentmessage.js +4 -1
- package/dist_ts/functions.controllermanagementsurface.d.ts +4 -0
- package/dist_ts/functions.controllermanagementsurface.js +15 -1
- package/dist_ts/functions.deviceapi.d.ts +151 -4
- package/dist_ts/functions.deviceapi.js +893 -38
- package/dist_ts/functions.fleetworkercli.d.ts +1 -1
- package/dist_ts/functions.fleetworkercli.js +11 -8
- package/dist_ts/functions.gatewaycli.d.ts +24 -0
- package/dist_ts/functions.gatewaycli.js +395 -0
- package/dist_ts/functions.gatewayroute.d.ts +135 -0
- package/dist_ts/functions.gatewayroute.js +366 -0
- package/dist_ts/functions.inferencecli.js +32 -1
- package/dist_ts/functions.inferencecliarguments.d.ts +8 -2
- package/dist_ts/functions.inferencecliarguments.js +31 -3
- package/dist_ts/functions.mcpfleetworkertools.js +2 -2
- package/dist_ts/functions.proxycapacity.d.ts +50 -0
- package/dist_ts/functions.proxycapacity.js +142 -0
- package/dist_ts/functions.proxycapacitycli.d.ts +30 -0
- package/dist_ts/functions.proxycapacitycli.js +65 -0
- package/dist_ts/functions.remotecli.d.ts +30 -3
- package/dist_ts/functions.remotecli.js +44 -18
- package/dist_ts/functions.ticketvalidation.js +11 -2
- package/dist_ts/interfaces.auth.d.ts +25 -4
- package/dist_ts/interfaces.auth.js +15 -1
- package/dist_ts/plugins.d.ts +5 -1
- package/dist_ts/plugins.js +10 -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 +19 -26
- package/dist_ts_authswitch/authority-renewal.d.ts +34 -0
- package/dist_ts_authswitch/authority-renewal.js +56 -0
- package/dist_ts_authswitch/authority-usagelimit.d.ts +29 -0
- package/dist_ts_authswitch/authority-usagelimit.js +66 -2
- package/dist_ts_authswitch/authority-usagewindows.d.ts +6 -0
- package/dist_ts_authswitch/authority-usagewindows.js +15 -1
- 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 +1012 -5
- package/dist_ts_interfaces/devices.js +68 -2
- package/dist_ts_interfaces/fleetworkers.d.ts +5 -3
- package/dist_ts_interfaces/gateway.d.ts +151 -0
- package/dist_ts_interfaces/gateway.js +66 -0
- package/dist_ts_interfaces/inbox.d.ts +234 -0
- package/dist_ts_interfaces/inbox.js +101 -0
- package/dist_ts_interfaces/index.d.ts +3 -0
- package/dist_ts_interfaces/index.js +4 -1
- package/dist_ts_interfaces/interfaces.d.ts +10 -3
- package/dist_ts_interfaces/interfaces.js +4 -2
- package/dist_ts_interfaces/management.d.ts +4 -4
- package/dist_ts_interfaces/management.js +3 -2
- package/dist_ts_interfaces/mcprequests.d.ts +48 -6
- package/dist_ts_interfaces/mcprequests.js +12 -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/proxycapacity.d.ts +99 -0
- package/dist_ts_interfaces/proxycapacity.js +74 -0
- 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/docs/authswitch.md +20 -1
- package/package.json +6 -5
- package/readme.md +191 -31
- package/ts/00_commitinfo_data.ts +1 -1
- package/ts/aglapi/aglapisurface.document.ts +520 -16
- package/ts/aglapi/interfaces.ts +1 -0
- package/ts/classes.accountsactions.ts +30 -3
- package/ts/classes.authmodels.ts +22 -3
- package/ts/classes.authstore.ts +15 -1
- package/ts/classes.claudeharness.ts +27 -1
- package/ts/classes.cli.ts +7 -3
- package/ts/classes.codexclientadapter.ts +14 -1
- package/ts/classes.controller.ts +1428 -249
- package/ts/classes.controllerdevices.ts +6 -0
- package/ts/classes.controllermanagement.ts +40 -7
- package/ts/classes.gatewayclient.ts +401 -0
- package/ts/classes.gatewayclientstore.ts +272 -0
- package/ts/classes.inbox.ts +239 -0
- package/ts/classes.inferencerouter.ts +27 -2
- package/ts/classes.inferenceservice.ts +28 -1
- package/ts/classes.mcpclient.ts +42 -3
- package/ts/classes.mcpcontrollerhost.ts +15 -0
- package/ts/classes.mcptools.ts +42 -9
- package/ts/classes.mcpvalidation.ts +32 -1
- package/ts/classes.nativesessions.ts +50 -12
- package/ts/classes.opencodeclient.ts +55 -4
- package/ts/classes.proxycontrol.ts +16 -0
- package/ts/classes.proxycontrolclient.ts +30 -0
- package/ts/classes.proxydaemon.ts +8 -0
- package/ts/classes.proxymonitor.ts +12 -0
- 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.trustedproxysecrets.ts +5 -0
- package/ts/driver/classes.directreports.ts +25 -6
- 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 +9 -2
- package/ts/fleet/functions.unbounddrivers.ts +1 -1
- package/ts/fleet/functions.workervalidation.ts +1 -1
- package/ts/fleet/interfaces.workers.ts +20 -5
- package/ts/functions.agentmessage.ts +3 -0
- package/ts/functions.controllermanagementsurface.ts +15 -0
- package/ts/functions.deviceapi.ts +1071 -34
- package/ts/functions.fleetworkercli.ts +10 -7
- package/ts/functions.gatewaycli.ts +436 -0
- package/ts/functions.gatewayroute.ts +429 -0
- package/ts/functions.inferencecli.ts +26 -0
- package/ts/functions.inferencecliarguments.ts +30 -4
- package/ts/functions.mcpfleetworkertools.ts +1 -1
- package/ts/functions.proxycapacity.ts +191 -0
- package/ts/functions.proxycapacitycli.ts +104 -0
- package/ts/functions.remotecli.ts +56 -20
- package/ts/functions.ticketvalidation.ts +11 -1
- package/ts/interfaces.auth.ts +36 -4
- package/ts/plugins.ts +12 -0
- package/ts_authswitch/authority-contract.ts +20 -0
- package/ts_authswitch/authority-overview.ts +28 -6
- package/ts_authswitch/authority-placement.ts +27 -32
- package/ts_authswitch/authority-renewal.ts +64 -0
- package/ts_authswitch/authority-usagelimit.ts +84 -1
- package/ts_authswitch/authority-usagewindows.ts +13 -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 +3573 -603
- package/ts_interfaces/devices.ts +1093 -4
- package/ts_interfaces/fleetworkers.ts +5 -3
- package/ts_interfaces/gateway.ts +242 -0
- package/ts_interfaces/inbox.ts +287 -0
- package/ts_interfaces/index.ts +3 -0
- package/ts_interfaces/interfaces.ts +9 -2
- package/ts_interfaces/management.ts +6 -4
- package/ts_interfaces/mcprequests.ts +61 -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/proxycapacity.ts +162 -0
- package/ts_interfaces/requests.accounts.ts +20 -0
- package/ts_interfaces/requests.ts +4 -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 +19 -6
- package/ts_web/classes.inboxfeed.ts +329 -0
- package/ts_web/classes.nativesessionstate.ts +9 -23
- package/ts_web/elements.accounts.ts +121 -113
- package/ts_web/elements.configurationpane.ts +24 -37
- package/ts_web/elements.deployments.ts +66 -2
- package/ts_web/elements.devices.ts +4 -17
- package/ts_web/elements.flexlimitstrip.ts +21 -70
- package/ts_web/elements.harnesscontrollerapp.ts +198 -222
- 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
|
@@ -8,7 +8,7 @@ import type {
|
|
|
8
8
|
IReq_AuthSwitchRepairClaudeHost,
|
|
9
9
|
IReq_AuthSwitchEvents, IReq_AuthSwitchGetBinding, IReq_AuthSwitchGetOperation, IReq_AuthSwitchListOperations,
|
|
10
10
|
IReq_AuthSwitchRemoveAccount,
|
|
11
|
-
IReq_AuthSwitchRenameAccount, IReq_AuthSwitchSetAccountLapse, IReq_AuthSwitchSetAccountMaxUsage, IReq_AuthSwitchSetAccountSpendLimit, IReq_AuthSwitchSetAccountClaudeCode, IReq_AuthSwitchLiftAccountReserve, IReq_AuthSwitchSnapshot,
|
|
11
|
+
IReq_AuthSwitchRenameAccount, IReq_AuthSwitchSetAccountLapse, IReq_AuthSwitchSetAccountRenewal, IReq_AuthSwitchSetAccountMaxUsage, IReq_AuthSwitchSetAccountSpendLimit, IReq_AuthSwitchSetAccountClaudeCode, IReq_AuthSwitchLiftAccountReserve, IReq_AuthSwitchSnapshot,
|
|
12
12
|
IReq_AuthSwitchCancelPreuse, IReq_AuthSwitchGetPreuse, IReq_AuthSwitchStartPreuse, IReq_AuthSwitchUsage,
|
|
13
13
|
IReq_AuthSwitchObserveUsage, IReq_AuthSwitchReportPaymentProblem, IReq_AuthSwitchRecheckUsage, IReq_AuthSwitchRecordSpend,
|
|
14
14
|
IReq_AuthSwitchMoveClaudeHomeIn, IReq_AuthSwitchMoveClaudeHomeOut, IReq_AuthSwitchRegisterClaudeHome,
|
|
@@ -754,6 +754,14 @@ export class AuthSwitchAuthorityDaemon {
|
|
|
754
754
|
return { account: await this.broker.setAccountLapse(request.accountId, request.expectedRevision,
|
|
755
755
|
request.lapsesAt) };
|
|
756
756
|
}));
|
|
757
|
+
this.managementRouter.addTypedHandler(this.handler<IReq_AuthSwitchSetAccountRenewal>(
|
|
758
|
+
'authswitch.authority.renewal', async request => {
|
|
759
|
+
if (!hasKeys(request, ['accountId', 'expectedRevision', 'renewsAt']) || typeof request.accountId !== 'string'
|
|
760
|
+
|| typeof request.expectedRevision !== 'number'
|
|
761
|
+
|| (request.renewsAt !== null && typeof request.renewsAt !== 'string')) invalid();
|
|
762
|
+
return { account: await this.broker.setAccountRenewal(request.accountId, request.expectedRevision,
|
|
763
|
+
request.renewsAt) };
|
|
764
|
+
}));
|
|
757
765
|
this.managementRouter.addTypedHandler(this.handler<IReq_AuthSwitchGetBinding>(
|
|
758
766
|
'authswitch.authority.binding', async request => {
|
|
759
767
|
if (!hasKeys(request, ['bindingId']) || !validBindingId(request.bindingId)) invalid();
|
|
@@ -1577,7 +1577,11 @@ export class AuthSwitchAuthorityDatabase {
|
|
|
1577
1577
|
|| draft.subject !== prior.subject || draft.workspaceId !== prior.workspaceId
|
|
1578
1578
|
|| draft.id !== prior.id) throw new Error('Account identity cannot change.');
|
|
1579
1579
|
const result = await AuthSwitchAuthorityAccountModel.exact.transition({
|
|
1580
|
-
current, change: model =>
|
|
1580
|
+
current, change: model => {
|
|
1581
|
+
Object.assign(model, draft);
|
|
1582
|
+
// Optional: a draft without it drops it, which `Object.assign` alone would keep (AGENTS.md, rollback floor).
|
|
1583
|
+
model.renewsAt = draft.renewsAt;
|
|
1584
|
+
},
|
|
1581
1585
|
}, { session });
|
|
1582
1586
|
if (result.status !== 'transitioned') throw new Error('Account changed concurrently.');
|
|
1583
1587
|
} else {
|
|
@@ -6,6 +6,7 @@ import type { IAuthSwitchStoredUsage, IAuthSwitchStoredUsageEstimate } from './c
|
|
|
6
6
|
import { isAuthSwitchUsageEstimateState } from './classes.authorityusageestimate.js';
|
|
7
7
|
import { isAuthSwitchUsageObservation } from './authority-usageheaders.js';
|
|
8
8
|
import { authSwitchSpendPeriod, isAuthSwitchSpendLimitMicroUsd, isAuthSwitchSpendPeriodKey } from './authority-spend.js';
|
|
9
|
+
import { isAuthSwitchRenewsAt } from './authority-renewal.js';
|
|
9
10
|
|
|
10
11
|
export interface IStoredAuthorityMeta {
|
|
11
12
|
id: 'authswitch-authority';
|
|
@@ -30,6 +31,12 @@ export interface IStoredAuthorityAccount {
|
|
|
30
31
|
reserveLiftUntil: string | null;
|
|
31
32
|
/** When the account's subscription ends, ISO 8601 UTC, or `null` while it renews (`IAuthSwitchAccount.lapsesAt`). */
|
|
32
33
|
lapsesAt: string | null;
|
|
34
|
+
/**
|
|
35
|
+
* A Claude sign-in's renewal anchor, ISO 8601 UTC (`IAuthSwitchAccount.renewsAt`, AGL-1644). Present only while the
|
|
36
|
+
* owner holds one set: a record without it is the record an earlier accounts service reads, so clearing it removes the
|
|
37
|
+
* member (the transition sets it to `undefined`), never stores null.
|
|
38
|
+
*/
|
|
39
|
+
renewsAt?: string;
|
|
33
40
|
/** An API key account's monthly spend limit in micro-dollars, or `null` (`IAuthSwitchAccount.spendLimitMicroUsd`). */
|
|
34
41
|
spendLimitMicroUsd: number | null;
|
|
35
42
|
/** How an API key account's key ends, or `null` (`IAuthSwitchAccount.keyHint`). */
|
|
@@ -727,10 +734,22 @@ export const assertStoredAuthorityMeta: (value: unknown) => asserts value is ISt
|
|
|
727
734
|
|| !revision(value.revision) || !uuid(value.updateId)) throw new Error('Invalid authswitch authority metadata.');
|
|
728
735
|
};
|
|
729
736
|
|
|
737
|
+
const storedAccountKeys = ['id', 'providerId', 'issuer', 'subject', 'workspaceId', 'label', 'email', 'plan',
|
|
738
|
+
'primaryGrantId', 'maxUsagePercent', 'reserveLiftUntil', 'lapsesAt', 'spendLimitMicroUsd', 'keyHint', 'claudeCode',
|
|
739
|
+
'removed', 'revision', 'statusObservedAt', 'updateId'] as const;
|
|
740
|
+
|
|
741
|
+
/**
|
|
742
|
+
* An account record holds every member of `storedAccountKeys` and nothing else, or those and a renewal anchor
|
|
743
|
+
* (`renewsAt`, only on a Claude sign-in). The optional member is checked on its own: a record that holds it holds a
|
|
744
|
+
* valid anchor, never null.
|
|
745
|
+
*/
|
|
746
|
+
const storedAccountMembers = (value: Record<string, unknown>): boolean =>
|
|
747
|
+
exactKeys(value, storedAccountKeys)
|
|
748
|
+
|| (exactKeys(value, [...storedAccountKeys, 'renewsAt']) && iso(value.renewsAt) && isAuthSwitchRenewsAt(value.renewsAt)
|
|
749
|
+
&& value.providerId === 'anthropic' && value.workspaceId !== 'api-key');
|
|
750
|
+
|
|
730
751
|
export const assertStoredAuthorityAccount: (value: unknown) => asserts value is IStoredAuthorityAccount = value => {
|
|
731
|
-
if (!object(value) || !
|
|
732
|
-
'email', 'plan', 'primaryGrantId', 'maxUsagePercent', 'reserveLiftUntil', 'lapsesAt', 'spendLimitMicroUsd', 'keyHint',
|
|
733
|
-
'claudeCode', 'removed', 'revision', 'statusObservedAt', 'updateId'])
|
|
752
|
+
if (!object(value) || !storedAccountMembers(value)
|
|
734
753
|
|| !hash(value.id) || typeof value.providerId !== 'string'
|
|
735
754
|
|| !/^[a-z][a-z0-9-]{0,63}$/.test(value.providerId)
|
|
736
755
|
|| !bounded(value.issuer) || !bounded(value.subject) || !bounded(value.workspaceId)
|
|
@@ -1301,6 +1320,7 @@ export class AuthSwitchAuthorityAccountModel extends plugins.nosqldb.SmartDataDb
|
|
|
1301
1320
|
@plugins.nosqldb.svDb() public maxUsagePercent!: number | null;
|
|
1302
1321
|
@plugins.nosqldb.svDb() public reserveLiftUntil!: string | null;
|
|
1303
1322
|
@plugins.nosqldb.svDb() public lapsesAt!: string | null;
|
|
1323
|
+
@plugins.nosqldb.svDb() public renewsAt?: string;
|
|
1304
1324
|
@plugins.nosqldb.svDb() public spendLimitMicroUsd!: number | null;
|
|
1305
1325
|
@plugins.nosqldb.svDb() public keyHint!: string | null;
|
|
1306
1326
|
@plugins.nosqldb.svDb() public claudeCode!: boolean;
|
|
@@ -562,6 +562,10 @@ are marked:
|
|
|
562
562
|
as an option; workspace trust in `.claude.json` (`projects[<dir>].hasTrustDialogAccepted`).
|
|
563
563
|
- Relay stream-json: `system`/`init` and `result` (`subtype`, `is_error`, `permission_denials`, `api_error_status`,
|
|
564
564
|
`terminal_reason`, `errors`).
|
|
565
|
+
- Relay tools (AGL-382): `--tools=SendMessage,Read,ToolSearch` (one `=` argument) and `--strict-mcp-config` must leave
|
|
566
|
+
exactly `Read`, `SendMessage` and `ToolSearch` in the init record's `tools`, in every permission mode, bypassPermissions
|
|
567
|
+
included, and the init record must come before the model is called. The relay refuses every run whose init record
|
|
568
|
+
lists anything else, so a change fails visibly: relays stop.
|
|
565
569
|
- Transcript growth against the 4 MiB window: the fleet reads a transcript's last 4 MiB and refuses an incremental read
|
|
566
570
|
of more as an observation gap. Measure what the release adds and how much time and how many turns the window still
|
|
567
571
|
covers, and check that the Agent SDK's chain reader (`getSessionMessages`, used for history) skips record types it does
|
|
@@ -653,6 +657,23 @@ contradicts the bundle read gets a fix ticket:
|
|
|
653
657
|
of the dispatcher is 2.1.282's.
|
|
654
658
|
- Relay stream-json (bundle only): `system`/`init` (@33617187), and the `result` fields `permission_denials`, `api_error_status`,
|
|
655
659
|
`terminal_reason`, `errors` and `is_api_error_message` are in the bundle. No relay ran on 2.1.306.
|
|
660
|
+
- Relay tools (AGL-382, 2026-11-11), run on 2.1.306 itself in a disposable home without any credential, in a user, mount
|
|
661
|
+
and network namespace (no network, private `/run/user` and `/tmp`), `claude -p --output-format stream-json --verbose`:
|
|
662
|
+
- `--tools=SendMessage,Read,ToolSearch --strict-mcp-config` prints `system`/`init` first, before any model call, with
|
|
663
|
+
`tools` `["Read","SendMessage","ToolSearch"]` (sorted, whatever order was passed) and `mcp_servers` `[]`, in the
|
|
664
|
+
modes `default`, `acceptEdits` and `bypassPermissions` (run as a mapped non-root user: Claude Code refuses
|
|
665
|
+
bypassPermissions for root). Without `--tools` the same init lists 21 tools, `Bash`, `Edit` and `Write` among them.
|
|
666
|
+
- `--tools` alone does not reach MCP tools: a user-scoped stdio MCP server's tool (`mcp__probe__probe`) stays in `tools`
|
|
667
|
+
until `--strict-mcp-config` drops the server. The host's user config names the `agl` and `playwright` servers, so
|
|
668
|
+
before AGL-382 a relay in bypassPermissions could run their tools.
|
|
669
|
+
- `--tools` takes several values: `--tools SendMessage,Read,ToolSearch <prompt>` takes the prompt as a tool name and
|
|
670
|
+
exits 1 with `Input must be provided either through stdin or as a prompt argument`. An unknown name is dropped
|
|
671
|
+
without an error (`--tools=…,Bogus` lists the three), so only the init record proves the list.
|
|
672
|
+
- Without a credential the run ends after init with the synthetic `Not logged in · Please run /login`
|
|
673
|
+
(`authentication_failed`), exit 1; with a made-up key it retries the unreachable API (`api_retry`). The init record
|
|
674
|
+
names the run's own socket (`messaging_socket_path`, under `$XDG_RUNTIME_DIR/cc-socks`).
|
|
675
|
+
- Not checked here: plugin MCP servers under `--strict-mcp-config` (the host's settings enable no plugin), and a real relay's
|
|
676
|
+
delivery with the restricted tools (it needs a model call). The relay's init check refuses either change.
|
|
656
677
|
- Transcript growth. `api-request`, `api-request-shape` and `api-request-blob` records are 27 % of the bytes written after
|
|
657
678
|
each file's first 2.1.306 record (26 of 95 MB, three quarters of it blobs), and 26 % of the two driver workers' 4 MiB
|
|
658
679
|
windows.
|
package/ts_authswitch/readme.md
CHANGED
|
@@ -8,6 +8,6 @@ Keep the authority in its own process. The controller never owns refresh grants.
|
|
|
8
8
|
|
|
9
9
|
Native credential files belong to their tools: the authority writes one only through a verified, journaled handoff, and never destroys or overwrites a native credential it has not first proven it can restore. Every operation that stops the owned Codex app-server restarts it on both success and failure. Structured authority state uses the existing NoSQLDB models and versioned migrations.
|
|
10
10
|
|
|
11
|
-
Tests isolate all harness homes and use injected provider/process adapters. Never run account-mutating tests against the developer's own installations. Module import, CLI help/version and the browser leaves (`authority-contract.ts`, `authority-spend.ts`, `authority-usagewindows.ts`, `authority-usagelimit.ts`, `authority-usageheaders.ts`, `authority-usagetokens.ts`, `authority-placement.ts`, `authority-subscription.ts`, `preuse-text.ts`) must not initialize a controller or touch credentials. `authority-subscription.ts` holds the one map of what Claude's `subscription_status` values mean (empty until a value is confirmed) and the words of a payment problem and a re-check, which the command line and the Accounts screen share; `classes.authorityusage.ts` holds a payment problem on the usage record (`reportPaymentProblem`) and clears it on a read that finds a changed subscription or a healthy re-check (`recheck`); a problem held without a subscription takes the one the next healthy read finds, and that read clears nothing. `authority-placement.ts` is the one rule of an account's lifecycle against its `lapsesAt` and of the placement score the proxy places new sessions by. `authority-usageheaders.ts` reads the usage a provider's answer headers state and joins it to the authority's own reading; the authority holds such observations in memory and answers every usage read with them (`authswitch.authority.usage.observe`). `classes.authorityusage.ts` owns the one usage-read schedule: each account is read from the provider every 10 minutes on the authority's timer and at once after an inference 429, a failed read keeps the held reading `stale` and waits for `retry-after` or the next slot, and no question waits for a read or an unseal. `authority-usagetokens.ts` (browser-safe) weighs the tokens the proxy reports by Anthropic's published prices, and `classes.authorityusageestimate.ts` carries each Claude window forward between reads with a ratio learned per account and window, in memory only. `authority-usagelimit.ts` is the one rule of whether an account's usage, against its `maxUsagePercent`, lets it take work -- a switch on the reading's `kind`, where an API key's `spend` reading is judged by its spend limit alone; the proxy, Flex, the CLI and the Accounts screen all call it rather than restating it. `authority-spend.ts` (imports nothing) is the calendar month in UTC a key's spend counts in (`authSwitchSpendPeriod`, the one calendar function), the spend reading, the spend limit rule and dollar amounts. `authority-apikeys.ts` holds the key verifier (`authSwitchApiKeyVerifier`, a read of the provider's model list) and the guard against a key of the other provider; `AuthSwitchAuthorityDatabase.recordSpend` / `readSpend` keep the monthly ledger (`authswitch_authority_spend_entries`, `authswitch_authority_spend_periods`), and `classes.authorityusage.ts` answers a key's usage from it and holds a key's payment problem, by cause, on the key's usage record. A sealed key is `{ kind: 'anthropicApiKey' | 'openaiApiKey', apiKey }`, one kind per provider; never add a kind a reader must keep forever.
|
|
11
|
+
Tests isolate all harness homes and use injected provider/process adapters. Never run account-mutating tests against the developer's own installations. Module import, CLI help/version and the browser leaves (`authority-contract.ts`, `authority-spend.ts`, `authority-usagewindows.ts`, `authority-usagelimit.ts`, `authority-usageheaders.ts`, `authority-usagetokens.ts`, `authority-placement.ts`, `authority-subscription.ts`, `preuse-text.ts`) must not initialize a controller or touch credentials. `authority-subscription.ts` holds the one map of what Claude's `subscription_status` values mean (empty until a value is confirmed) and the words of a payment problem and a re-check, which the command line and the Accounts screen share; `classes.authorityusage.ts` holds a payment problem on the usage record (`reportPaymentProblem`) and clears it on a read that finds a changed subscription or a healthy re-check (`recheck`); a problem held without a subscription takes the one the next healthy read finds, and that read clears nothing. `authority-placement.ts` is the one rule of an account's lifecycle against its `lapsesAt` and of the placement score the proxy places new sessions by; `authority-renewal.ts` (imports nothing) is the one rule of a Claude sign-in's monthly renewal as its owner set it (`renewsAt`), which placement counts as a window deadline. `authority-usageheaders.ts` reads the usage a provider's answer headers state and joins it to the authority's own reading; the authority holds such observations in memory and answers every usage read with them (`authswitch.authority.usage.observe`). `classes.authorityusage.ts` owns the one usage-read schedule: each account is read from the provider every 10 minutes on the authority's timer and at once after an inference 429, a failed read keeps the held reading `stale` and waits for `retry-after` or the next slot, and no question waits for a read or an unseal. `authority-usagetokens.ts` (browser-safe) weighs the tokens the proxy reports by Anthropic's published prices, and `classes.authorityusageestimate.ts` carries each Claude window forward between reads with a ratio learned per account and window, in memory only. `authority-usagelimit.ts` is the one rule of whether an account's usage, against its `maxUsagePercent`, lets it take work -- a switch on the reading's `kind`, where an API key's `spend` reading is judged by its spend limit alone; the proxy, Flex, the CLI and the Accounts screen all call it rather than restating it. `authority-spend.ts` (imports nothing) is the calendar month in UTC a key's spend counts in (`authSwitchSpendPeriod`, the one calendar function), the spend reading, the spend limit rule and dollar amounts. `authority-apikeys.ts` holds the key verifier (`authSwitchApiKeyVerifier`, a read of the provider's model list) and the guard against a key of the other provider; `AuthSwitchAuthorityDatabase.recordSpend` / `readSpend` keep the monthly ledger (`authswitch_authority_spend_entries`, `authswitch_authority_spend_periods`), and `classes.authorityusage.ts` answers a key's usage from it and holds a key's payment problem, by cause, on the key's usage record. A sealed key is `{ kind: 'anthropicApiKey' | 'openaiApiKey', apiKey }`, one kind per provider; never add a kind a reader must keep forever.
|
|
12
12
|
|
|
13
13
|
Imported from authswitch 11.4.1, commit `c3fed26`; future fixes and releases belong to AGL. OpenAI adaptations retain their headers and the notices in the repository's `third-party-notices.md` and `openai-codex-license.txt`.
|