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
package/ts/aglapi/interfaces.ts
CHANGED
|
@@ -59,6 +59,7 @@ const tickets: readonly TAglApiRole[] = ['session'];
|
|
|
59
59
|
*/
|
|
60
60
|
export const aglApiMethods = {
|
|
61
61
|
'agl.mcp.controller.status': { use: 'read' },
|
|
62
|
+
'agl.mcp.proxy.capacity': { use: 'observe' },
|
|
62
63
|
'agl.mcp.projects.list': { use: 'read' },
|
|
63
64
|
'agl.mcp.sessions.list': { use: 'read' },
|
|
64
65
|
'agl.mcp.session.read': { use: 'observe' },
|
|
@@ -28,6 +28,7 @@ import type {
|
|
|
28
28
|
IReq_ControllerAccountsApiKeyAdd,
|
|
29
29
|
IReq_ControllerAccountsSpendLimit,
|
|
30
30
|
IReq_ControllerAccountsClaudeCode,
|
|
31
|
+
IReq_ControllerAccountsRenewal,
|
|
31
32
|
IReq_ControllerAccountsUsageGet,
|
|
32
33
|
IReq_ControllerAccountsUsageRecheck,
|
|
33
34
|
TControllerAccountBinding,
|
|
@@ -100,11 +101,11 @@ const invalidRequest = (messageArg: string): plugins.typedrequest.TypedResponseE
|
|
|
100
101
|
|
|
101
102
|
/**
|
|
102
103
|
* Accepts exactly the named members, each of its declared type, and nothing else. `number | null` is a
|
|
103
|
-
* number or an explicit `null`.
|
|
104
|
+
* number or an explicit `null`, `string | null` a string or an explicit `null`.
|
|
104
105
|
*/
|
|
105
106
|
const assertRequestShape = (
|
|
106
107
|
requestArg: unknown,
|
|
107
|
-
membersArg: Readonly<Record<string, 'string' | 'number' | 'boolean' | 'number | null'>>,
|
|
108
|
+
membersArg: Readonly<Record<string, 'string' | 'number' | 'boolean' | 'number | null' | 'string | null'>>,
|
|
108
109
|
): Record<string, unknown> => {
|
|
109
110
|
if (typeof requestArg !== 'object' || requestArg === null || Array.isArray(requestArg)) {
|
|
110
111
|
throw invalidRequest('The account request is invalid.');
|
|
@@ -115,7 +116,9 @@ const assertRequestShape = (
|
|
|
115
116
|
Object.keys(request).length !== names.length
|
|
116
117
|
|| names.some((nameArg) => (membersArg[nameArg] === 'number | null'
|
|
117
118
|
? request[nameArg] !== null && typeof request[nameArg] !== 'number'
|
|
118
|
-
:
|
|
119
|
+
: membersArg[nameArg] === 'string | null'
|
|
120
|
+
? request[nameArg] !== null && typeof request[nameArg] !== 'string'
|
|
121
|
+
: typeof request[nameArg] !== membersArg[nameArg]))
|
|
119
122
|
) throw invalidRequest('The account request is invalid.');
|
|
120
123
|
for (const name of names) {
|
|
121
124
|
const value = request[name];
|
|
@@ -241,6 +244,18 @@ export class AccountsActions {
|
|
|
241
244
|
}));
|
|
242
245
|
},
|
|
243
246
|
);
|
|
247
|
+
routerArg.addHandler<IReq_ControllerAccountsRenewal>(
|
|
248
|
+
'controller.accounts.renewal',
|
|
249
|
+
async (requestArg, toolsArg) => {
|
|
250
|
+
const request = assertRequestShape(requestArg, {
|
|
251
|
+
accountId: 'string', expectedRevision: 'number', renewsAt: 'string | null',
|
|
252
|
+
}) as IReq_ControllerAccountsRenewal['request'];
|
|
253
|
+
// The audit names the action and the peer; the date is the account's, which the accounts service journals.
|
|
254
|
+
return hostArg.runAudited(toolsArg?.localData, 'accounts.renewal', async (signalArg) => ({
|
|
255
|
+
answer: await this.setRenewal(request, signalArg),
|
|
256
|
+
}));
|
|
257
|
+
},
|
|
258
|
+
);
|
|
244
259
|
routerArg.addHandler<IReq_ControllerAccountsRemove>(
|
|
245
260
|
'controller.accounts.remove',
|
|
246
261
|
async (requestArg, toolsArg) => {
|
|
@@ -532,6 +547,18 @@ export class AccountsActions {
|
|
|
532
547
|
return answer;
|
|
533
548
|
}
|
|
534
549
|
|
|
550
|
+
/** Sets or clears a Claude sign-in's renewal anchor, and answers once the projection shows it. */
|
|
551
|
+
public async setRenewal(
|
|
552
|
+
requestArg: IReq_ControllerAccountsRenewal['request'],
|
|
553
|
+
signalArg: AbortSignal,
|
|
554
|
+
): Promise<TControllerAccountsAnswer<plugins.authswitchAuthority.IAuthSwitchAccount>> {
|
|
555
|
+
const answer = await this.answer((clientArg) => clientArg.setAccountRenewal(
|
|
556
|
+
requestArg.accountId, requestArg.expectedRevision, requestArg.renewsAt, signalArg,
|
|
557
|
+
));
|
|
558
|
+
if (answer.state === 'done') await this.waitForAccountRevision(answer.value, signalArg);
|
|
559
|
+
return answer;
|
|
560
|
+
}
|
|
561
|
+
|
|
535
562
|
/** Waits until the controller's projection shows the account at `accountArg`'s revision or later. */
|
|
536
563
|
private async waitForAccountRevision(
|
|
537
564
|
accountArg: plugins.authswitchAuthority.IAuthSwitchAccount,
|
package/ts/classes.authmodels.ts
CHANGED
|
@@ -9,6 +9,7 @@ import {
|
|
|
9
9
|
controllerAuditEventTypes,
|
|
10
10
|
type IControllerAuditEvent,
|
|
11
11
|
type IControllerAuditRemoteEndpoint,
|
|
12
|
+
type IControllerAuditGateway,
|
|
12
13
|
type IControllerAuditRemoteMove,
|
|
13
14
|
type IControllerAuthDocument,
|
|
14
15
|
type IControllerTempPasswordDocument,
|
|
@@ -396,13 +397,31 @@ const isAuditRemoteMove = (valueArg: unknown): valueArg is IControllerAuditRemot
|
|
|
396
397
|
&& isAuditRemoteEndpoint(valueArg.previous)
|
|
397
398
|
&& isAuditRemoteEndpoint(valueArg.target);
|
|
398
399
|
|
|
400
|
+
const isAuditGatewayText = (valueArg: unknown, maximumArg: number): valueArg is string => (
|
|
401
|
+
isNonEmptyString(valueArg) && valueArg.length <= maximumArg && !/[\0\r\n]/u.test(valueArg)
|
|
402
|
+
);
|
|
403
|
+
|
|
404
|
+
const isAuditGateway = (typeArg: string, valueArg: unknown): valueArg is IControllerAuditGateway => isPlainObject(valueArg)
|
|
405
|
+
&& hasExactKeys(valueArg, ['gatewayUrl', 'gatewayClientId', 'appId', 'hostname', 'targetHost', 'targetPort', 'routeKey'],
|
|
406
|
+
typeArg === 'remote.gateway.sync' ? ['rotate'] : [])
|
|
407
|
+
&& isAuditGatewayText(valueArg.gatewayUrl, 2048)
|
|
408
|
+
&& isAuditGatewayText(valueArg.gatewayClientId, 128)
|
|
409
|
+
&& isAuditGatewayText(valueArg.appId, 128)
|
|
410
|
+
&& isAuditGatewayText(valueArg.hostname, 253)
|
|
411
|
+
&& isAuditGatewayText(valueArg.targetHost, 253)
|
|
412
|
+
&& isValidPort(valueArg.targetPort)
|
|
413
|
+
&& isAuditGatewayText(valueArg.routeKey, 1024)
|
|
414
|
+
&& (valueArg.rotate === undefined || typeof valueArg.rotate === 'boolean');
|
|
415
|
+
|
|
399
416
|
/**
|
|
400
417
|
* `details` on a type this release knows: only `remote.set` and `remote.unset` record a `remoteMove`, and only a move
|
|
401
|
-
* from one canonical origin and RP ID to another.
|
|
418
|
+
* from one canonical origin and RP ID to another; only `remote.gateway.*` records a `gateway`.
|
|
402
419
|
*/
|
|
403
420
|
const hasKnownAuditDetails = (typeArg: string, detailsArg: Record<string, unknown>): boolean =>
|
|
404
|
-
!Object.hasOwn(detailsArg, 'remoteMove')
|
|
405
|
-
|
|
421
|
+
(!Object.hasOwn(detailsArg, 'remoteMove')
|
|
422
|
+
|| ((typeArg === 'remote.set' || typeArg === 'remote.unset') && isAuditRemoteMove(detailsArg.remoteMove)))
|
|
423
|
+
&& (!Object.hasOwn(detailsArg, 'gateway')
|
|
424
|
+
|| (typeArg.startsWith('remote.gateway.') && isAuditGateway(typeArg, detailsArg.gateway)));
|
|
406
425
|
|
|
407
426
|
/**
|
|
408
427
|
* A stored audit event. The log is shared with later releases, so a type this release does not know (a later
|
package/ts/classes.authstore.ts
CHANGED
|
@@ -11,6 +11,7 @@ import { ControllerCodexOriginMigrationModel } from '../ts_migration/v29_codexor
|
|
|
11
11
|
import { ControllerCodexConnectionStore } from './classes.codexconnectionstore.js';
|
|
12
12
|
import { ControllerTrustedProxySecretModel } from './classes.trustedproxysecrets.js';
|
|
13
13
|
import { ControllerDeviceModel, deleteControllerDevices } from './classes.controllerdevices.js';
|
|
14
|
+
import { ControllerGatewayClientModel } from './classes.gatewayclientstore.js';
|
|
14
15
|
import { ControllerClaudeSessionStore } from './classes.claudesessionstore.js';
|
|
15
16
|
import { ControllerClaudeSessionModel } from './classes.claudesessionmodels.js';
|
|
16
17
|
import { ControllerPendingPromptStore } from './classes.pendingpromptstore.js';
|
|
@@ -807,6 +808,7 @@ const setAuthStoreModelManager = (
|
|
|
807
808
|
plugins.nosqldb.setDefaultManagerForDoc(managerArg, ControllerTrackedConversationModel);
|
|
808
809
|
plugins.nosqldb.setDefaultManagerForDoc(managerArg, ControllerTrustedProxySecretModel);
|
|
809
810
|
plugins.nosqldb.setDefaultManagerForDoc(managerArg, ControllerDeviceModel);
|
|
811
|
+
plugins.nosqldb.setDefaultManagerForDoc(managerArg, ControllerGatewayClientModel);
|
|
810
812
|
plugins.nosqldb.setDefaultManagerForDoc(
|
|
811
813
|
managerArg,
|
|
812
814
|
ControllerLegacyManagedSessionMigrationModel,
|
|
@@ -1097,6 +1099,7 @@ export class SmartDataAuthStore implements IAuthStore, IAuthStoreSessionIdentity
|
|
|
1097
1099
|
await ControllerTrackedConversationModel.init();
|
|
1098
1100
|
await ControllerTrustedProxySecretModel.init();
|
|
1099
1101
|
await ControllerDeviceModel.init();
|
|
1102
|
+
await ControllerGatewayClientModel.init();
|
|
1100
1103
|
// `moveRuntimeConfig` changes the configuration and deletes the paired devices in one transaction.
|
|
1101
1104
|
await ControllerAuthModel.exact.prepare();
|
|
1102
1105
|
await ControllerDeviceModel.exact.prepare();
|
|
@@ -1932,7 +1935,7 @@ export class SmartDataAuthStore implements IAuthStore, IAuthStoreSessionIdentity
|
|
|
1932
1935
|
...(eventArg.senderLabel === undefined ? {} : { senderLabel: eventArg.senderLabel }),
|
|
1933
1936
|
...(eventArg.localCli === undefined ? {} : { localCli: { ...eventArg.localCli } }),
|
|
1934
1937
|
...(eventArg.details === undefined ? {} : {
|
|
1935
|
-
details: {
|
|
1938
|
+
details: 'remoteMove' in eventArg.details ? {
|
|
1936
1939
|
remoteMove: {
|
|
1937
1940
|
previous: {
|
|
1938
1941
|
publicOrigin: eventArg.details.remoteMove.previous.publicOrigin,
|
|
@@ -1943,6 +1946,17 @@ export class SmartDataAuthStore implements IAuthStore, IAuthStoreSessionIdentity
|
|
|
1943
1946
|
rpId: eventArg.details.remoteMove.target.rpId,
|
|
1944
1947
|
},
|
|
1945
1948
|
},
|
|
1949
|
+
} : {
|
|
1950
|
+
gateway: {
|
|
1951
|
+
gatewayUrl: eventArg.details.gateway.gatewayUrl,
|
|
1952
|
+
gatewayClientId: eventArg.details.gateway.gatewayClientId,
|
|
1953
|
+
appId: eventArg.details.gateway.appId,
|
|
1954
|
+
hostname: eventArg.details.gateway.hostname,
|
|
1955
|
+
targetHost: eventArg.details.gateway.targetHost,
|
|
1956
|
+
targetPort: eventArg.details.gateway.targetPort,
|
|
1957
|
+
routeKey: eventArg.details.gateway.routeKey,
|
|
1958
|
+
...(eventArg.details.gateway.rotate === undefined ? {} : { rotate: eventArg.details.gateway.rotate }),
|
|
1959
|
+
},
|
|
1946
1960
|
},
|
|
1947
1961
|
}),
|
|
1948
1962
|
};
|
|
@@ -60,6 +60,11 @@ export interface IClaudeHarnessOptions {
|
|
|
60
60
|
emit: (eventArg: IControllerEvent) => void;
|
|
61
61
|
/** A conversation went idle: every message it was given ended and Claude Code runs nothing more. */
|
|
62
62
|
onSessionIdle?: (projectIdArg: string, nativeIdArg: string) => void;
|
|
63
|
+
/**
|
|
64
|
+
* The requests AGL holds for a native session (one outside every project, which `emit` never names) came or went: a
|
|
65
|
+
* permission, a question or an MCP form of a turn AGL runs there.
|
|
66
|
+
*/
|
|
67
|
+
onNativeAttention?: (nativeIdArg: string) => void;
|
|
63
68
|
sdk?: TClaudeSdk;
|
|
64
69
|
pathToClaudeCodeExecutable?: string;
|
|
65
70
|
clock?: IClaudeEventClock;
|
|
@@ -504,6 +509,22 @@ export class ClaudeHarness {
|
|
|
504
509
|
};
|
|
505
510
|
}
|
|
506
511
|
|
|
512
|
+
/**
|
|
513
|
+
* Every session with requests that wait for an answer, from the pending requests alone: its project (none for a
|
|
514
|
+
* native session), directory, title and requests.
|
|
515
|
+
*/
|
|
516
|
+
public pendingAttention(): Array<{ nativeId: string; projectId?: string; directory: string; title: string; attention: IControllerAttention }> {
|
|
517
|
+
const nativeIds = new Set([...this.pending.values()].map((requestArg) => requestArg.nativeId));
|
|
518
|
+
return [...nativeIds].flatMap((nativeId) => {
|
|
519
|
+
const state = this.states.get(nativeId);
|
|
520
|
+
if (!state) return [];
|
|
521
|
+
return [{
|
|
522
|
+
nativeId, ...(state.projectId === undefined ? {} : { projectId: state.projectId }),
|
|
523
|
+
directory: state.document.directory, title: state.document.title, attention: this.attention(nativeId),
|
|
524
|
+
}];
|
|
525
|
+
});
|
|
526
|
+
}
|
|
527
|
+
|
|
507
528
|
public replyPermission(nativeIdArg: string, idArg: string, replyArg: 'once' | 'reject'): void {
|
|
508
529
|
const request = this.pending.get(idArg);
|
|
509
530
|
if (!request?.permission || request.nativeId !== nativeIdArg) throw new Error('Claude Code approval is no longer pending in this conversation.');
|
|
@@ -1105,6 +1126,7 @@ export class ClaudeHarness {
|
|
|
1105
1126
|
// Claude Code always offers a written answer besides the options.
|
|
1106
1127
|
custom: true,
|
|
1107
1128
|
})),
|
|
1129
|
+
createdAt: Date.now(),
|
|
1108
1130
|
};
|
|
1109
1131
|
} else {
|
|
1110
1132
|
const title = contextArg.title ?? contextArg.displayName ?? claudeToolTitle(toolNameArg, inputArg) ?? toolNameArg;
|
|
@@ -1339,7 +1361,11 @@ export class ClaudeHarness {
|
|
|
1339
1361
|
}
|
|
1340
1362
|
|
|
1341
1363
|
private changed(stateArg: IClaudeSessionState, typeArg: IControllerEvent['type']): void {
|
|
1342
|
-
if (this.closed || this.states.get(stateArg.document.nativeId) !== stateArg
|
|
1364
|
+
if (this.closed || this.states.get(stateArg.document.nativeId) !== stateArg) return;
|
|
1365
|
+
if (stateArg.projectId === undefined) {
|
|
1366
|
+
if (typeArg === 'permissions.changed') this.options.onNativeAttention?.(stateArg.document.nativeId);
|
|
1367
|
+
return;
|
|
1368
|
+
}
|
|
1343
1369
|
this.options.emit({
|
|
1344
1370
|
type: typeArg, harnessId: 'claude', projectId: stateArg.projectId, sessionId: claudeRuntimeId(stateArg.document.nativeId),
|
|
1345
1371
|
...(typeArg === 'session.changed' ? { sessionStatus: this.session(stateArg.document.nativeId).status } : {}),
|
package/ts/classes.cli.ts
CHANGED
|
@@ -9,6 +9,7 @@ import {
|
|
|
9
9
|
controllerManagementProtocolVersion,
|
|
10
10
|
configurationOwnerTokenEnvironmentVariable,
|
|
11
11
|
describeBrowserPaintAvailability,
|
|
12
|
+
type IControllerManagementStatus,
|
|
12
13
|
type IControllerStatus,
|
|
13
14
|
} from '../ts_interfaces/index.js';
|
|
14
15
|
import { defaultControllerPort } from './classes.config.js';
|
|
@@ -143,6 +144,7 @@ Usage:
|
|
|
143
144
|
${currentCliName} foreground [options]
|
|
144
145
|
${currentCliName} temp-password [--port 4097] [--ttl-hours 24]
|
|
145
146
|
${currentCliName} remote set|unset|secret import [--port 4097] [options]
|
|
147
|
+
${currentCliName} remote gateway enrol|status|sync|remove [--port 4097] [options]
|
|
146
148
|
${currentCliName} feed list [--state failed] [--json] | acknowledge <row-id> --updated-at <ms> [--json]
|
|
147
149
|
${currentCliName} deploy status [TARGET] | history TARGET | probe TARGET [--json]
|
|
148
150
|
${currentCliName} release status [REPO] [--json]
|
|
@@ -167,7 +169,8 @@ Commands:
|
|
|
167
169
|
foreground Run ${currentRuntimeName} attached to this terminal
|
|
168
170
|
temp-password Mint a temporary browser login password (max 24 hours)
|
|
169
171
|
remote Move a stopped controller between localhost and a public origin behind a TLS
|
|
170
|
-
reverse proxy, or import the proxy's secret (remote --help)
|
|
172
|
+
reverse proxy, or import the proxy's secret (remote --help); keep the
|
|
173
|
+
controller's own route on a dcrouter gateway (remote gateway --help)
|
|
171
174
|
help Show this help
|
|
172
175
|
|
|
173
176
|
Startup options:
|
|
@@ -432,13 +435,14 @@ const assertStatus = (statusArg: unknown): IControllerStatus => assertController
|
|
|
432
435
|
export const queryControllerStatus = async (
|
|
433
436
|
portArg: number,
|
|
434
437
|
timeoutMsArg = 2_500,
|
|
435
|
-
): Promise<
|
|
438
|
+
): Promise<IControllerManagementStatus> => queryManagedControllerStatus(
|
|
436
439
|
portArg,
|
|
437
440
|
currentStatusExpectation,
|
|
438
441
|
timeoutMsArg,
|
|
439
442
|
);
|
|
440
443
|
|
|
441
|
-
|
|
444
|
+
/** The status of this release's controller on `portArg`, with its management sections, or `undefined` when none answers. */
|
|
445
|
+
export const tryQueryControllerStatus = async (portArg: number): Promise<IControllerManagementStatus | undefined> => {
|
|
442
446
|
return tryQueryManagedControllerStatus(portArg, currentStatusExpectation);
|
|
443
447
|
};
|
|
444
448
|
|
|
@@ -1103,6 +1103,18 @@ export class CodexClientAdapter {
|
|
|
1103
1103
|
return [...result.values()];
|
|
1104
1104
|
}
|
|
1105
1105
|
|
|
1106
|
+
/**
|
|
1107
|
+
* Every thread with requests that wait for an answer, from the pending requests alone, with the scope it was
|
|
1108
|
+
* registered in: its project (`fleet` for a fleet connection's native thread), directory and session.
|
|
1109
|
+
*/
|
|
1110
|
+
public pendingAttention(): Array<{ threadId: string; projectId: string; directory: string; session: IControllerSession; attention: IControllerAttention }> {
|
|
1111
|
+
const threadIds = new Set([...this.pending.values()].map((entryArg) => entryArg.request.params.threadId as string));
|
|
1112
|
+
return [...threadIds].flatMap((threadId) => {
|
|
1113
|
+
const scope = this.scopes.get(threadId);
|
|
1114
|
+
return scope ? [{ threadId, projectId: scope.projectId, directory: scope.directory, session: scope.session, attention: this.attention(threadId) }] : [];
|
|
1115
|
+
});
|
|
1116
|
+
}
|
|
1117
|
+
|
|
1106
1118
|
public attention(threadIdArg: string): IControllerAttention {
|
|
1107
1119
|
this.scope(threadIdArg);
|
|
1108
1120
|
const requests = [...this.pending.values()].filter((entry) => entry.request.params.threadId === threadIdArg);
|
|
@@ -1891,7 +1903,8 @@ export class CodexClientAdapter {
|
|
|
1891
1903
|
pending.question = { id: codexRuntimeId(id), sessionId: codexRuntimeId(threadId), toolCallId: codexRuntimeId(codexString(params.itemId, 512)),
|
|
1892
1904
|
questions: questions.map((question) => ({ question: codexString(question.question, 16 * 1024), header: codexString(question.header, 512),
|
|
1893
1905
|
custom: question.isOther === true || question.options === null,
|
|
1894
|
-
options: question.options === null ? [] : codexArray(question.options, 64).map((option) => ({ label: codexString(codexRecord(option).label, 1024), description: codexString(codexRecord(option).description, 4096) })) }))
|
|
1906
|
+
options: question.options === null ? [] : codexArray(question.options, 64).map((option) => ({ label: codexString(codexRecord(option).label, 1024), description: codexString(codexRecord(option).description, 4096) })) })),
|
|
1907
|
+
createdAt: Date.now() };
|
|
1895
1908
|
} else if (requestArg.method === 'mcpServer/elicitation/request') {
|
|
1896
1909
|
pending.elicitation = codexElicitation(id, threadId, params);
|
|
1897
1910
|
} else { client.rejectRequest(requestArg.id, -32601, 'This Codex host request is not supported by AGL.'); return; }
|