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
|
@@ -287,11 +287,13 @@ export interface IFleetWorkerJob {
|
|
|
287
287
|
error?: string;
|
|
288
288
|
}
|
|
289
289
|
/**
|
|
290
|
-
* A
|
|
291
|
-
*
|
|
290
|
+
* A message to a Claude Code background job no fleet worker binds: a native wake of a settled job (`native-wake`) or a
|
|
291
|
+
* message into a running job's inbox through Claude Code's own SendMessage (`native-inbox`, accepted and queued, not
|
|
292
|
+
* read). It holds no dispatch fence, writes no ticket comment and does not observe the turn; `adopt` is the command that
|
|
293
|
+
* makes the job a fleet worker.
|
|
292
294
|
*/
|
|
293
295
|
export interface IFleetNativeMessageReceipt {
|
|
294
|
-
delivery: 'native-wake';
|
|
296
|
+
delivery: 'native-wake' | 'native-inbox';
|
|
295
297
|
/** The job's full session id. */
|
|
296
298
|
nativeId: string;
|
|
297
299
|
/** Claude Code's short job id. */
|
|
@@ -0,0 +1,242 @@
|
|
|
1
|
+
import * as plugins from './plugins.js';
|
|
2
|
+
import type { IConfigurationLocalCliActor } from './configuration.js';
|
|
3
|
+
import type { IControllerStatus } from './interfaces.js';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* The controller's own gateway route (AGL-828): AGL is a gateway client of a dcrouter (`agl remote gateway enrol`)
|
|
7
|
+
* and keeps one route for its public hostname there, LOCAL NETWORK only. Only the CLI and `agl status --json` show
|
|
8
|
+
* it, over the loopback management endpoint; the browser contract does not carry it.
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* Where the gateway client stands.
|
|
13
|
+
* - `not_enrolled`: no enrolment; nothing is synced.
|
|
14
|
+
* - `finalize_pending`: `agl remote gateway enrol` stored a candidate credential the gateway has not confirmed yet.
|
|
15
|
+
* - `syncing`: a sync runs.
|
|
16
|
+
* - `synced`: the last sync wrote the route; the next one repairs drift after six hours.
|
|
17
|
+
* - `retrying`: the last sync failed in a way a later one can fix; it is retried with backoff.
|
|
18
|
+
* - `waiting`: the gateway lacks `routes.requestHeaders`, so no route is written; the controller asks again with
|
|
19
|
+
* backoff from 30 s to 15 min, then at every six-hour sync and every `agl remote gateway sync`, and writes the route
|
|
20
|
+
* as soon as the gateway announces it.
|
|
21
|
+
* - `failed`: the last sync failed in a way only the operator can fix (`problem`); nothing is retried on its own.
|
|
22
|
+
* - `stopped`: the controller does not run; `problem` and `lastSyncedAt` are what it last recorded.
|
|
23
|
+
*/
|
|
24
|
+
export type TControllerGatewayState =
|
|
25
|
+
| 'not_enrolled'
|
|
26
|
+
| 'finalize_pending'
|
|
27
|
+
| 'syncing'
|
|
28
|
+
| 'synced'
|
|
29
|
+
| 'retrying'
|
|
30
|
+
| 'waiting'
|
|
31
|
+
| 'failed'
|
|
32
|
+
| 'stopped';
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* Why a sync did not write the route. The transient ones (`unreachable`, `gateway_error`) are retried, a gateway
|
|
36
|
+
* without request headers is waited for (`request_headers_unsupported`); every other one is terminal and names what
|
|
37
|
+
* the operator does.
|
|
38
|
+
*/
|
|
39
|
+
export type TControllerGatewayProblemCode =
|
|
40
|
+
/** The gateway did not answer: network, timeout or an HTTP error in front of its API. */
|
|
41
|
+
| 'unreachable'
|
|
42
|
+
/** The gateway answered with a refusal a later sync may not meet (not initialized, DNS provider unavailable). */
|
|
43
|
+
| 'gateway_error'
|
|
44
|
+
/** The credential is unknown, revoked, or bound to a missing or disabled gateway client: enrol again. */
|
|
45
|
+
| 'credential_invalid'
|
|
46
|
+
/** An admin changed the gateway client's policy, which invalidates its credential: enrol again. */
|
|
47
|
+
| 'credential_stale'
|
|
48
|
+
/** The enrolment's candidate credential is not finalized: run `agl remote gateway enrol` again. */
|
|
49
|
+
| 'finalize_pending'
|
|
50
|
+
/** The credential lacks a capability the route needs, or the gateway does not write routes idempotently. */
|
|
51
|
+
| 'capability_missing'
|
|
52
|
+
/**
|
|
53
|
+
* The gateway lacks `routes.requestHeaders` (before dcrouter 34.5.0, or one downgraded): the route cannot carry the
|
|
54
|
+
* trusted-proxy secret, so none is written until the gateway announces it.
|
|
55
|
+
*/
|
|
56
|
+
| 'request_headers_unsupported'
|
|
57
|
+
/** The gateway refused the route itself (validation, policy, an unknown source profile). */
|
|
58
|
+
| 'route_refused'
|
|
59
|
+
/** DNS `record-conflict`: another owner or a manual record holds the hostname. */
|
|
60
|
+
| 'dns_record_conflict'
|
|
61
|
+
/** DNS `zone-unmanaged`: the gateway manages no zone holding the hostname. */
|
|
62
|
+
| 'dns_zone_unmanaged'
|
|
63
|
+
/** DNS `target-invalid`: the gateway cannot publish an address for the route. */
|
|
64
|
+
| 'dns_target_invalid'
|
|
65
|
+
/**
|
|
66
|
+
* The controller's public origin is no longer the hostname it was enrolled for: enrol again. `agl remote set`
|
|
67
|
+
* refuses such a move while enrolled, so only a leftover meets it (an interrupted change, or a move an earlier
|
|
68
|
+
* release made after a rollback).
|
|
69
|
+
*/
|
|
70
|
+
| 'origin_changed'
|
|
71
|
+
/** The controller is not behind a TLS reverse proxy (`agl remote set`), so it has no route. */
|
|
72
|
+
| 'not_proxied'
|
|
73
|
+
/** The enrolment's gateway URL is plain http off loopback, which no credential is sent over: enrol again with https. */
|
|
74
|
+
| 'gateway_url_insecure';
|
|
75
|
+
|
|
76
|
+
export const controllerGatewayProblemCodes = [
|
|
77
|
+
'unreachable', 'gateway_error', 'credential_invalid', 'credential_stale', 'finalize_pending', 'capability_missing',
|
|
78
|
+
'request_headers_unsupported', 'route_refused', 'dns_record_conflict', 'dns_zone_unmanaged', 'dns_target_invalid',
|
|
79
|
+
'origin_changed', 'not_proxied', 'gateway_url_insecure',
|
|
80
|
+
] as const satisfies readonly TControllerGatewayProblemCode[];
|
|
81
|
+
|
|
82
|
+
/**
|
|
83
|
+
* What follows a sync that ended with a problem: `transient` is retried with backoff, `waiting` is asked again with
|
|
84
|
+
* backoff and then at every six-hour sync, `terminal` waits for the operator (the next start or sync).
|
|
85
|
+
*/
|
|
86
|
+
export type TControllerGatewayProblemKind = 'transient' | 'waiting' | 'terminal';
|
|
87
|
+
|
|
88
|
+
export const controllerGatewayProblemKind: Record<TControllerGatewayProblemCode, TControllerGatewayProblemKind> = {
|
|
89
|
+
unreachable: 'transient',
|
|
90
|
+
gateway_error: 'transient',
|
|
91
|
+
request_headers_unsupported: 'waiting',
|
|
92
|
+
credential_invalid: 'terminal',
|
|
93
|
+
credential_stale: 'terminal',
|
|
94
|
+
finalize_pending: 'terminal',
|
|
95
|
+
capability_missing: 'terminal',
|
|
96
|
+
route_refused: 'terminal',
|
|
97
|
+
dns_record_conflict: 'terminal',
|
|
98
|
+
dns_zone_unmanaged: 'terminal',
|
|
99
|
+
dns_target_invalid: 'terminal',
|
|
100
|
+
origin_changed: 'terminal',
|
|
101
|
+
not_proxied: 'terminal',
|
|
102
|
+
gateway_url_insecure: 'terminal',
|
|
103
|
+
};
|
|
104
|
+
|
|
105
|
+
export interface IControllerGatewayProblem {
|
|
106
|
+
code: TControllerGatewayProblemCode;
|
|
107
|
+
/** What failed and what the operator does; never a credential. */
|
|
108
|
+
message: string;
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
/** What `agl remote gateway enrol` registered: the gateway, the client and the route it keeps. */
|
|
112
|
+
export interface IControllerGatewayEnrolment {
|
|
113
|
+
/** The gateway's API base URL; requests go to `<gatewayUrl>/typedrequest`. */
|
|
114
|
+
gatewayUrl: string;
|
|
115
|
+
/** The gateway client this controller is (`agl-<installation>-<port>`, type `custom`). */
|
|
116
|
+
gatewayClientId: string;
|
|
117
|
+
/** `controller-<port>`. */
|
|
118
|
+
appId: string;
|
|
119
|
+
/** The route's hostname: the public origin's when it enrolled. */
|
|
120
|
+
hostname: string;
|
|
121
|
+
/** Where the gateway forwards the route. */
|
|
122
|
+
target: { host: string; port: number };
|
|
123
|
+
/** Unix epoch milliseconds. */
|
|
124
|
+
enrolledAt: number;
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
/** The DNS outcome of the last sync that wrote the route. */
|
|
128
|
+
export interface IControllerGatewayDns {
|
|
129
|
+
/** The gateway's own DNS status, such as `managed-unchanged` or `manual-satisfied`. */
|
|
130
|
+
status: string;
|
|
131
|
+
/** False for `manual-satisfied`: records the gateway does not own satisfy the route. */
|
|
132
|
+
owned: boolean;
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
export interface IControllerGatewayStatus {
|
|
136
|
+
state: TControllerGatewayState;
|
|
137
|
+
enrolment?: IControllerGatewayEnrolment;
|
|
138
|
+
/** Unix epoch milliseconds of the last sync that wrote the route. */
|
|
139
|
+
lastSyncedAt?: number;
|
|
140
|
+
dns?: IControllerGatewayDns;
|
|
141
|
+
/**
|
|
142
|
+
* After the last sync that wrote the route: true when the gateway named its source profile as `LOCAL NETWORK`,
|
|
143
|
+
* false when the gateway names no profile (before dcrouter 34.5.0), so the binding is unverified.
|
|
144
|
+
*/
|
|
145
|
+
sourceProfileVerified?: boolean;
|
|
146
|
+
/** Why the last sync failed; absent after one that wrote the route. */
|
|
147
|
+
problem?: IControllerGatewayProblem;
|
|
148
|
+
/** Unix epoch milliseconds of the next sync the controller runs on its own. */
|
|
149
|
+
nextSyncAt?: number;
|
|
150
|
+
/** A trusted-proxy secret rotation waits for a sync that carries the new secret to its route. */
|
|
151
|
+
rotationPending?: boolean;
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
const gatewayStates: readonly TControllerGatewayState[] = [
|
|
155
|
+
'not_enrolled', 'finalize_pending', 'syncing', 'synced', 'retrying', 'waiting', 'failed', 'stopped',
|
|
156
|
+
];
|
|
157
|
+
|
|
158
|
+
const isRecord = (valueArg: unknown): valueArg is Record<string, unknown> => (
|
|
159
|
+
typeof valueArg === 'object' && valueArg !== null && !Array.isArray(valueArg)
|
|
160
|
+
);
|
|
161
|
+
|
|
162
|
+
const hasOnlyKeys = (valueArg: Record<string, unknown>, requiredArg: readonly string[], optionalArg: readonly string[]): boolean => (
|
|
163
|
+
requiredArg.every((keyArg) => Object.hasOwn(valueArg, keyArg))
|
|
164
|
+
&& Object.keys(valueArg).every((keyArg) => requiredArg.includes(keyArg) || optionalArg.includes(keyArg))
|
|
165
|
+
);
|
|
166
|
+
|
|
167
|
+
const isText = (valueArg: unknown, maximumArg: number): valueArg is string => (
|
|
168
|
+
typeof valueArg === 'string' && valueArg.length > 0 && valueArg.length <= maximumArg
|
|
169
|
+
);
|
|
170
|
+
|
|
171
|
+
const isTime = (valueArg: unknown): valueArg is number => Number.isSafeInteger(valueArg) && (valueArg as number) >= 0;
|
|
172
|
+
|
|
173
|
+
const isEnrolment = (valueArg: unknown): valueArg is IControllerGatewayEnrolment => {
|
|
174
|
+
if (!isRecord(valueArg) || !hasOnlyKeys(valueArg, ['gatewayUrl', 'gatewayClientId', 'appId', 'hostname', 'target', 'enrolledAt'], [])) {
|
|
175
|
+
return false;
|
|
176
|
+
}
|
|
177
|
+
const target = valueArg.target;
|
|
178
|
+
return isText(valueArg.gatewayUrl, 2048) && isText(valueArg.gatewayClientId, 128) && isText(valueArg.appId, 128)
|
|
179
|
+
&& isText(valueArg.hostname, 253) && isTime(valueArg.enrolledAt)
|
|
180
|
+
&& isRecord(target) && hasOnlyKeys(target, ['host', 'port'], []) && isText(target.host, 253)
|
|
181
|
+
&& Number.isSafeInteger(target.port) && (target.port as number) >= 1 && (target.port as number) <= 65_535;
|
|
182
|
+
};
|
|
183
|
+
|
|
184
|
+
/**
|
|
185
|
+
* Reads the gateway section of a controller's management status, or `undefined` when it is not one this release
|
|
186
|
+
* reads; never trusts a field it does not check.
|
|
187
|
+
*/
|
|
188
|
+
export const readControllerGatewayStatus = (valueArg: unknown): IControllerGatewayStatus | undefined => {
|
|
189
|
+
if (!isRecord(valueArg)
|
|
190
|
+
|| !hasOnlyKeys(valueArg, ['state'], ['enrolment', 'lastSyncedAt', 'dns', 'sourceProfileVerified', 'problem', 'nextSyncAt', 'rotationPending'])
|
|
191
|
+
|| !gatewayStates.includes(valueArg.state as TControllerGatewayState)
|
|
192
|
+
|| (valueArg.enrolment !== undefined && !isEnrolment(valueArg.enrolment))
|
|
193
|
+
|| (valueArg.lastSyncedAt !== undefined && !isTime(valueArg.lastSyncedAt))
|
|
194
|
+
|| (valueArg.nextSyncAt !== undefined && !isTime(valueArg.nextSyncAt))
|
|
195
|
+
|| (valueArg.rotationPending !== undefined && typeof valueArg.rotationPending !== 'boolean')
|
|
196
|
+
|| (valueArg.sourceProfileVerified !== undefined && typeof valueArg.sourceProfileVerified !== 'boolean')) return undefined;
|
|
197
|
+
const dns = valueArg.dns;
|
|
198
|
+
if (dns !== undefined && !(isRecord(dns) && hasOnlyKeys(dns, ['status', 'owned'], [])
|
|
199
|
+
&& isText(dns.status, 64) && typeof dns.owned === 'boolean')) return undefined;
|
|
200
|
+
const problem = valueArg.problem;
|
|
201
|
+
if (problem !== undefined && !(isRecord(problem) && hasOnlyKeys(problem, ['code', 'message'], [])
|
|
202
|
+
&& controllerGatewayProblemCodes.includes(problem.code as TControllerGatewayProblemCode)
|
|
203
|
+
&& isText(problem.message, 4096))) return undefined;
|
|
204
|
+
return valueArg as unknown as IControllerGatewayStatus;
|
|
205
|
+
};
|
|
206
|
+
|
|
207
|
+
/**
|
|
208
|
+
* The management endpoint's status: the controller's status and, from AGL-828 on, its gateway client. A controller
|
|
209
|
+
* of an earlier release reports no `gateway`.
|
|
210
|
+
*/
|
|
211
|
+
export interface IControllerManagementStatus extends IControllerStatus {
|
|
212
|
+
gateway?: IControllerGatewayStatus;
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
export interface IReq_ControllerManagementStatus extends plugins.typedrequestInterfaces.implementsTR<
|
|
216
|
+
plugins.typedrequestInterfaces.ITypedRequest,
|
|
217
|
+
IReq_ControllerManagementStatus
|
|
218
|
+
> {
|
|
219
|
+
method: 'controller.status';
|
|
220
|
+
request: Record<string, never>;
|
|
221
|
+
response: IControllerManagementStatus;
|
|
222
|
+
}
|
|
223
|
+
|
|
224
|
+
/**
|
|
225
|
+
* Syncs the controller's gateway route now (`agl remote gateway sync`), first rotating the trusted-proxy secret when
|
|
226
|
+
* `rotate` is set: the route then carries the new secret, and the previous one is refused once the gateway confirms
|
|
227
|
+
* it. Only over the loopback management endpoint, from a process of the controller's own OS user that holds the
|
|
228
|
+
* request's connection (`localCli` names it); the answer is the gateway status after that sync.
|
|
229
|
+
*/
|
|
230
|
+
export interface IReq_ControllerGatewaySync extends plugins.typedrequestInterfaces.implementsTR<
|
|
231
|
+
plugins.typedrequestInterfaces.ITypedRequest,
|
|
232
|
+
IReq_ControllerGatewaySync
|
|
233
|
+
> {
|
|
234
|
+
method: 'controller.gateway.sync';
|
|
235
|
+
request: {
|
|
236
|
+
rotate: boolean;
|
|
237
|
+
localCli: IConfigurationLocalCliActor;
|
|
238
|
+
};
|
|
239
|
+
response: {
|
|
240
|
+
gateway: IControllerGatewayStatus;
|
|
241
|
+
};
|
|
242
|
+
}
|
|
@@ -0,0 +1,287 @@
|
|
|
1
|
+
import type * as plugins from './plugins.js';
|
|
2
|
+
import type {
|
|
3
|
+
IControllerNativeWait,
|
|
4
|
+
IControllerPermission,
|
|
5
|
+
IControllerQuestion,
|
|
6
|
+
IControllerRuntimeId,
|
|
7
|
+
} from './interfaces.js';
|
|
8
|
+
import type { TControllerElicitation } from './elicitations.js';
|
|
9
|
+
import type { IControllerNativeSessionRef } from './nativesessions.js';
|
|
10
|
+
import type { TControllerSessionFeedHarness } from './sessionfeed.js';
|
|
11
|
+
import type { ITicketQuestion, TTicketColumn } from './tickets.js';
|
|
12
|
+
import type { TFleetDeployCondition } from './deployments.js';
|
|
13
|
+
|
|
14
|
+
/*
|
|
15
|
+
* The Inbox (AGL-1635): one list, kept by the controller, of what waits for the owner across sessions and the board.
|
|
16
|
+
* The browser and paired devices read the same list; each item names where it lives and how it is answered, and the
|
|
17
|
+
* answer goes to the item's owner (the harness of its session, or the ticket store). An answer in any client removes
|
|
18
|
+
* the item everywhere, because the list is recomputed from those owners.
|
|
19
|
+
*/
|
|
20
|
+
|
|
21
|
+
/** Every kind of Inbox item. */
|
|
22
|
+
export const controllerInboxKinds = [
|
|
23
|
+
'permission',
|
|
24
|
+
'question',
|
|
25
|
+
'elicitation',
|
|
26
|
+
'native_wait',
|
|
27
|
+
'driver',
|
|
28
|
+
'deploy_go',
|
|
29
|
+
'window_go',
|
|
30
|
+
'ticket_question',
|
|
31
|
+
] as const;
|
|
32
|
+
export type TControllerInboxKind = (typeof controllerInboxKinds)[number];
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* The order the Inbox lists its items in: the session prompts (a permission, a question, an MCP form, and a wait the
|
|
36
|
+
* harness shows in its own client), then the driver's `needs input:` turn, then the owner's go's, then ticket
|
|
37
|
+
* questions. Within a group the oldest comes first, whatever its kind. The controller sorts; clients show the order
|
|
38
|
+
* it sends.
|
|
39
|
+
*/
|
|
40
|
+
export const controllerInboxGroups: readonly (readonly TControllerInboxKind[])[] = [
|
|
41
|
+
['permission', 'question', 'elicitation', 'native_wait'],
|
|
42
|
+
['driver'],
|
|
43
|
+
['deploy_go', 'window_go'],
|
|
44
|
+
['ticket_question'],
|
|
45
|
+
];
|
|
46
|
+
|
|
47
|
+
const controllerInboxGroupOf = (kindArg: TControllerInboxKind): number => (
|
|
48
|
+
controllerInboxGroups.findIndex((groupArg) => groupArg.includes(kindArg))
|
|
49
|
+
);
|
|
50
|
+
|
|
51
|
+
/** The filter chips besides All, and the kinds each shows. All shows every kind. */
|
|
52
|
+
export const controllerInboxChipKinds = {
|
|
53
|
+
sessions: ['permission', 'question', 'elicitation', 'native_wait', 'driver'],
|
|
54
|
+
board: ['ticket_question'],
|
|
55
|
+
deploys: ['deploy_go', 'window_go'],
|
|
56
|
+
} as const satisfies Record<string, readonly TControllerInboxKind[]>;
|
|
57
|
+
export type TControllerInboxChip = 'all' | keyof typeof controllerInboxChipKinds;
|
|
58
|
+
export const controllerInboxChips: readonly TControllerInboxChip[] = ['all', 'sessions', 'board', 'deploys'];
|
|
59
|
+
|
|
60
|
+
/** The chip, besides All, that shows `kindArg`. */
|
|
61
|
+
export const controllerInboxChipOf = (kindArg: TControllerInboxKind): Exclude<TControllerInboxChip, 'all'> => {
|
|
62
|
+
for (const [chip, kinds] of Object.entries(controllerInboxChipKinds) as [Exclude<TControllerInboxChip, 'all'>, readonly TControllerInboxKind[]][]) {
|
|
63
|
+
if (kinds.includes(kindArg)) return chip;
|
|
64
|
+
}
|
|
65
|
+
throw new Error(`The Inbox kind ${kindArg} has no chip.`);
|
|
66
|
+
};
|
|
67
|
+
|
|
68
|
+
/**
|
|
69
|
+
* The Inbox's bounds. An item whose JSON is over `itemBytes` keeps its place without its payload (`omitted`) and is
|
|
70
|
+
* answered only in its own view; a payload is never cut short. The list holds at most `items` items and `listBytes` of
|
|
71
|
+
* JSON; `total` counts every item, and `limited` says some were left out. A change of more than `deltaItems` items
|
|
72
|
+
* publishes a reset. A title is one line of at most `titleChars` characters; a go names at most `ships` tickets.
|
|
73
|
+
*/
|
|
74
|
+
export const controllerInboxLimits = {
|
|
75
|
+
items: 200,
|
|
76
|
+
itemBytes: 64 * 1024,
|
|
77
|
+
listBytes: 2 * 1024 * 1024,
|
|
78
|
+
deltaItems: 100,
|
|
79
|
+
titleChars: 280,
|
|
80
|
+
ships: 20,
|
|
81
|
+
} as const;
|
|
82
|
+
|
|
83
|
+
/** Where an item lives. A session is named as the session feed names it (`rowId`) and as the browser opens it. */
|
|
84
|
+
export type TControllerInboxWhere =
|
|
85
|
+
/** A conversation AGL hosts. */
|
|
86
|
+
| {
|
|
87
|
+
kind: 'conversation';
|
|
88
|
+
projectId: string;
|
|
89
|
+
sessionId: IControllerRuntimeId;
|
|
90
|
+
harness: TControllerSessionFeedHarness;
|
|
91
|
+
rowId: string;
|
|
92
|
+
name: string;
|
|
93
|
+
}
|
|
94
|
+
/** A direct child (an OpenCode subagent) of the conversation `parentSessionId`, whose row is `rowId`. */
|
|
95
|
+
| {
|
|
96
|
+
kind: 'child';
|
|
97
|
+
projectId: string;
|
|
98
|
+
parentSessionId: IControllerRuntimeId & { harnessId: 'opencode' };
|
|
99
|
+
childSessionId: IControllerRuntimeId & { harnessId: 'opencode' };
|
|
100
|
+
harness: 'opencode';
|
|
101
|
+
rowId: string;
|
|
102
|
+
name: string;
|
|
103
|
+
childName: string;
|
|
104
|
+
}
|
|
105
|
+
/** A native session AGL does not host, on this controller's host. */
|
|
106
|
+
| {
|
|
107
|
+
kind: 'native';
|
|
108
|
+
session: IControllerNativeSessionRef;
|
|
109
|
+
harness: 'claude' | 'codex';
|
|
110
|
+
rowId: string;
|
|
111
|
+
name: string;
|
|
112
|
+
/** The host the session runs on: the controller's. */
|
|
113
|
+
host: string;
|
|
114
|
+
}
|
|
115
|
+
/** The host's driver, which no session list shows. */
|
|
116
|
+
| { kind: 'driver'; projectId: string; sessionId: IControllerRuntimeId }
|
|
117
|
+
| { kind: 'ticket'; ticketId: string; ticketKey: string; ticketTitle: string; project: string; columnId: TTicketColumn };
|
|
118
|
+
|
|
119
|
+
/**
|
|
120
|
+
* How an item is answered, through the request its owner already takes:
|
|
121
|
+
* `conversation`: `controller.permission.reply`, `controller.question.reply` or `controller.elicitation.reply` with the
|
|
122
|
+
* conversation's `projectId` and `sessionId` (the driver's own prompts too);
|
|
123
|
+
* `child`: `controller.session.child.get` for the child, then `controller.session.child.permission.reply` or
|
|
124
|
+
* `controller.session.child.question.reply`;
|
|
125
|
+
* `native`: `controller.nativesession.permission.reply`, `.question.reply` or `.elicitation.reply` with the session ref;
|
|
126
|
+
* `ticket`: `controller.ticket.answer` with the ticket and the question;
|
|
127
|
+
* `none`: not here. The driver's turn is answered in the Driver view, a native wait in the harness's own client, and an
|
|
128
|
+
* item whose payload was left out in its own view.
|
|
129
|
+
*/
|
|
130
|
+
export type TControllerInboxAnswer = 'conversation' | 'child' | 'native' | 'ticket' | 'none';
|
|
131
|
+
|
|
132
|
+
/** Why an item's payload was left out: its JSON is `bytes` long, over `controllerInboxLimits.itemBytes`. */
|
|
133
|
+
export interface IControllerInboxOmission {
|
|
134
|
+
reason: 'oversize';
|
|
135
|
+
bytes: number;
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
/** A deploy plan as its go shows it: what runs now, what it deploys, when, and what ships with it. */
|
|
139
|
+
export interface IControllerInboxDeployGo {
|
|
140
|
+
target: string;
|
|
141
|
+
targetName?: string;
|
|
142
|
+
environment?: string;
|
|
143
|
+
/** The release the target should run. */
|
|
144
|
+
version: string;
|
|
145
|
+
/** What the target runs now, as its newest observation says. */
|
|
146
|
+
runs?: string;
|
|
147
|
+
deployWhen?: TFleetDeployCondition;
|
|
148
|
+
/** The maintenance window the deploy would run in, the next one the owner gave for the target. */
|
|
149
|
+
window?: { from: string; to: string };
|
|
150
|
+
/** Tickets the deploy ships, at most `controllerInboxLimits.ships`; `shipsTotal` counts them all. */
|
|
151
|
+
ships: { key: string; title: string }[];
|
|
152
|
+
shipsTotal: number;
|
|
153
|
+
/** Who deploys it: the session the plan is assigned to; absent is the driver. */
|
|
154
|
+
assignee?: string;
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
/** A maintenance window the driver proposed, as its go shows it. */
|
|
158
|
+
export interface IControllerInboxWindowGo {
|
|
159
|
+
from: string;
|
|
160
|
+
to: string;
|
|
161
|
+
targets: string[];
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
interface IControllerInboxItemBase<TKind extends TControllerInboxKind, TWhere extends TControllerInboxWhere> {
|
|
165
|
+
/** Stable across clients and passes: the kind, where it lives and the request or question id. */
|
|
166
|
+
id: string;
|
|
167
|
+
kind: TKind;
|
|
168
|
+
/** Unix milliseconds since it waits. */
|
|
169
|
+
since: number;
|
|
170
|
+
/** One line: what is asked. */
|
|
171
|
+
title: string;
|
|
172
|
+
where: TWhere;
|
|
173
|
+
answer: TControllerInboxAnswer;
|
|
174
|
+
/** Set when the payload was left out; the item is then answered only in its own view (`answer: 'none'`). */
|
|
175
|
+
omitted?: IControllerInboxOmission;
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
type TSessionWhere = Extract<TControllerInboxWhere, { kind: 'conversation' | 'child' | 'native' | 'driver' }>;
|
|
179
|
+
|
|
180
|
+
export interface IControllerInboxPermissionItem extends IControllerInboxItemBase<'permission', TSessionWhere> {
|
|
181
|
+
permission?: IControllerPermission;
|
|
182
|
+
}
|
|
183
|
+
export interface IControllerInboxQuestionItem extends IControllerInboxItemBase<'question', TSessionWhere> {
|
|
184
|
+
question?: IControllerQuestion;
|
|
185
|
+
}
|
|
186
|
+
export interface IControllerInboxElicitationItem extends IControllerInboxItemBase<'elicitation', TSessionWhere> {
|
|
187
|
+
elicitation?: TControllerElicitation;
|
|
188
|
+
}
|
|
189
|
+
/** A wait the harness shows in its own client: AGL holds no request for it, so it is answered there (`answer: 'none'`). */
|
|
190
|
+
export interface IControllerInboxNativeWaitItem
|
|
191
|
+
extends IControllerInboxItemBase<'native_wait', Extract<TControllerInboxWhere, { kind: 'conversation' | 'native' }>> {
|
|
192
|
+
nativeWait: IControllerNativeWait;
|
|
193
|
+
/** The host the harness's client runs on: the controller's. */
|
|
194
|
+
host: string;
|
|
195
|
+
}
|
|
196
|
+
/** The driver's last turn ended on a `needs input:` line; the owner answers in the Driver view (`answer: 'none'`). */
|
|
197
|
+
export interface IControllerInboxDriverItem extends IControllerInboxItemBase<'driver', Extract<TControllerInboxWhere, { kind: 'driver' }>> {
|
|
198
|
+
/** The `needs input:` line. */
|
|
199
|
+
line?: string;
|
|
200
|
+
/** The transcript entry the line ends. */
|
|
201
|
+
messageId: string;
|
|
202
|
+
}
|
|
203
|
+
type TTicketWhere = Extract<TControllerInboxWhere, { kind: 'ticket' }>;
|
|
204
|
+
/** A deploy plan's question: only the owner's answer is a go. */
|
|
205
|
+
export interface IControllerInboxDeployGoItem extends IControllerInboxItemBase<'deploy_go', TTicketWhere> {
|
|
206
|
+
question?: ITicketQuestion;
|
|
207
|
+
plan: IControllerInboxDeployGo;
|
|
208
|
+
}
|
|
209
|
+
/** The question of a maintenance window the driver proposed: only the owner's answer is a go. */
|
|
210
|
+
export interface IControllerInboxWindowGoItem extends IControllerInboxItemBase<'window_go', TTicketWhere> {
|
|
211
|
+
question?: ITicketQuestion;
|
|
212
|
+
window: IControllerInboxWindowGo;
|
|
213
|
+
}
|
|
214
|
+
export interface IControllerInboxTicketQuestionItem extends IControllerInboxItemBase<'ticket_question', TTicketWhere> {
|
|
215
|
+
question?: ITicketQuestion;
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
export type TControllerInboxItem =
|
|
219
|
+
| IControllerInboxPermissionItem
|
|
220
|
+
| IControllerInboxQuestionItem
|
|
221
|
+
| IControllerInboxElicitationItem
|
|
222
|
+
| IControllerInboxNativeWaitItem
|
|
223
|
+
| IControllerInboxDriverItem
|
|
224
|
+
| IControllerInboxDeployGoItem
|
|
225
|
+
| IControllerInboxWindowGoItem
|
|
226
|
+
| IControllerInboxTicketQuestionItem;
|
|
227
|
+
|
|
228
|
+
/** The order of two items: by group as `controllerInboxGroups` lists them, then oldest first, then by id. */
|
|
229
|
+
export const compareControllerInboxItems = (leftArg: TControllerInboxItem, rightArg: TControllerInboxItem): number => (
|
|
230
|
+
controllerInboxGroupOf(leftArg.kind) - controllerInboxGroupOf(rightArg.kind)
|
|
231
|
+
|| leftArg.since - rightArg.since
|
|
232
|
+
|| (leftArg.id < rightArg.id ? -1 : leftArg.id > rightArg.id ? 1 : 0)
|
|
233
|
+
);
|
|
234
|
+
|
|
235
|
+
/** The words an item is found by: its title, where it lives and what it names. */
|
|
236
|
+
export const controllerInboxSearchText = (itemArg: TControllerInboxItem): string => {
|
|
237
|
+
const where = itemArg.where;
|
|
238
|
+
const words: string[] = [itemArg.title, itemArg.kind.replace('_', ' ')];
|
|
239
|
+
switch (where.kind) {
|
|
240
|
+
case 'conversation': words.push(where.name, where.harness); break;
|
|
241
|
+
case 'child': words.push(where.name, where.childName, where.harness); break;
|
|
242
|
+
case 'native': words.push(where.name, where.harness, where.host); break;
|
|
243
|
+
case 'driver': words.push('driver'); break;
|
|
244
|
+
case 'ticket': words.push(where.ticketKey, where.ticketTitle, where.project); break;
|
|
245
|
+
}
|
|
246
|
+
if (itemArg.kind === 'deploy_go') words.push(itemArg.plan.target, itemArg.plan.targetName ?? '', itemArg.plan.version);
|
|
247
|
+
if (itemArg.kind === 'window_go') words.push(...itemArg.window.targets);
|
|
248
|
+
return words.join(' ').toLowerCase();
|
|
249
|
+
};
|
|
250
|
+
|
|
251
|
+
/** Whether an item shows under `chipArg` and the search `queryArg` (every word of it, any case). */
|
|
252
|
+
export const controllerInboxItemShown = (itemArg: TControllerInboxItem, chipArg: TControllerInboxChip, queryArg = ''): boolean => {
|
|
253
|
+
if (chipArg !== 'all' && controllerInboxChipOf(itemArg.kind) !== chipArg) return false;
|
|
254
|
+
const words = queryArg.toLowerCase().split(/\s+/u).filter(Boolean);
|
|
255
|
+
if (words.length === 0) return true;
|
|
256
|
+
const text = controllerInboxSearchText(itemArg);
|
|
257
|
+
return words.every((wordArg) => text.includes(wordArg));
|
|
258
|
+
};
|
|
259
|
+
|
|
260
|
+
/** The list as the controller holds it, in its order. `total` counts every item, also those `limited` left out. */
|
|
261
|
+
export interface IControllerInboxSnapshot {
|
|
262
|
+
epoch: string;
|
|
263
|
+
revision: number;
|
|
264
|
+
items: TControllerInboxItem[];
|
|
265
|
+
total: number;
|
|
266
|
+
limited: boolean;
|
|
267
|
+
}
|
|
268
|
+
|
|
269
|
+
/**
|
|
270
|
+
* One change. `epoch` names the controller process's Inbox; a client applies a delta only on its epoch at the revision
|
|
271
|
+
* after the one it holds, and lists the Inbox again otherwise (and on `reset`). `order` is every listed item's id in
|
|
272
|
+
* the list's order.
|
|
273
|
+
*/
|
|
274
|
+
export type TControllerInboxDelta = { epoch: string; revision: number } & (
|
|
275
|
+
| { upserts: TControllerInboxItem[]; removed: string[]; order: string[]; total: number; limited: boolean }
|
|
276
|
+
| { reset: true }
|
|
277
|
+
);
|
|
278
|
+
|
|
279
|
+
/** The Inbox, after reading every source that changed. */
|
|
280
|
+
export interface IReq_ControllerInboxList extends plugins.typedrequestInterfaces.implementsTR<
|
|
281
|
+
plugins.typedrequestInterfaces.ITypedRequest,
|
|
282
|
+
IReq_ControllerInboxList
|
|
283
|
+
> {
|
|
284
|
+
method: 'controller.inbox.list';
|
|
285
|
+
request: Record<string, never>;
|
|
286
|
+
response: IControllerInboxSnapshot;
|
|
287
|
+
}
|
package/ts_interfaces/index.ts
CHANGED
|
@@ -11,6 +11,7 @@ export * from './devtools.js';
|
|
|
11
11
|
export * from './requests.js';
|
|
12
12
|
export * from './mcprequests.js';
|
|
13
13
|
export * from './management.js';
|
|
14
|
+
export * from './gateway.js';
|
|
14
15
|
export * from './codex.js';
|
|
15
16
|
export * from './mcpworkspacerequests.js';
|
|
16
17
|
export * from './mcpjobrequests.js';
|
|
@@ -31,7 +32,9 @@ export * from './workercallers.js';
|
|
|
31
32
|
export * from './driver.js';
|
|
32
33
|
export * from './requests.driver.js';
|
|
33
34
|
export * from './sessionfeed.js';
|
|
35
|
+
export * from './inbox.js';
|
|
34
36
|
export * from './nativesessions.js';
|
|
35
37
|
export * from './metrics.js';
|
|
38
|
+
export * from './proxycapacity.js';
|
|
36
39
|
export * from './devices.js';
|
|
37
40
|
export * from './requests.devices.js';
|
|
@@ -5,7 +5,7 @@ import type {
|
|
|
5
5
|
TControllerBrowserPaintAvailability,
|
|
6
6
|
TControllerBrowserPaintTermination,
|
|
7
7
|
} from './browserpaint.js';
|
|
8
|
-
export const controllerProtocolVersion =
|
|
8
|
+
export const controllerProtocolVersion = 53 as const;
|
|
9
9
|
export const controllerUpgradeManagementVersion = 2 as const;
|
|
10
10
|
export const controllerPackageName = 'agl' as const;
|
|
11
11
|
/** The systemd user unit `agl service install` writes; a controller it runs reports it in its status. */
|
|
@@ -1410,7 +1410,8 @@ export interface IControllerPermission {
|
|
|
1410
1410
|
type: string;
|
|
1411
1411
|
patterns: string[];
|
|
1412
1412
|
metadata: Record<string, unknown>;
|
|
1413
|
-
|
|
1413
|
+
/** Unix milliseconds when the request entered its harness's pending requests: the harness's own time where it has one. */
|
|
1414
|
+
createdAt: number;
|
|
1414
1415
|
}
|
|
1415
1416
|
|
|
1416
1417
|
export interface IControllerTodo {
|
|
@@ -1444,6 +1445,8 @@ export interface IControllerQuestion {
|
|
|
1444
1445
|
questions: IControllerQuestionItem[];
|
|
1445
1446
|
/** Tool call that raised the ask; links the request to its transcript entry. */
|
|
1446
1447
|
toolCallId?: IControllerRuntimeId;
|
|
1448
|
+
/** Unix milliseconds when the question entered its harness's pending requests. */
|
|
1449
|
+
createdAt: number;
|
|
1447
1450
|
}
|
|
1448
1451
|
|
|
1449
1452
|
export interface IControllerTerminal {
|
|
@@ -1805,6 +1808,8 @@ export const controllerEventTypes = [
|
|
|
1805
1808
|
'devices.changed',
|
|
1806
1809
|
/** What a deploy target runs, whether its probe answers, or which tickets run nowhere changed. */
|
|
1807
1810
|
'deployments.changed',
|
|
1811
|
+
/** The Inbox changed: what waits for the owner (`inbox`, a delta). */
|
|
1812
|
+
'inbox.changed',
|
|
1808
1813
|
] as const;
|
|
1809
1814
|
export type TControllerEventType = (typeof controllerEventTypes)[number];
|
|
1810
1815
|
|
|
@@ -1845,6 +1850,8 @@ export interface IControllerEvent {
|
|
|
1845
1850
|
driverStatus?: import('./driver.js').IControllerDriverStatus;
|
|
1846
1851
|
/** Present only on a sessionfeed.changed event. */
|
|
1847
1852
|
sessionFeed?: import('./sessionfeed.js').TControllerSessionFeedDelta;
|
|
1853
|
+
/** Present only on an inbox.changed event. */
|
|
1854
|
+
inbox?: import('./inbox.js').TControllerInboxDelta;
|
|
1848
1855
|
/** Present only on a usage.changed event, sent only to the browser that watches the window. */
|
|
1849
1856
|
usageDelta?: import('./metrics.js').TControllerUsageDelta;
|
|
1850
1857
|
/** Present only on the devices.changed event of a pairing: the code the device used, and the device. */
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { IReq_ControllerGatewaySync, IReq_ControllerManagementStatus } from './gateway.js';
|
|
2
2
|
import type {
|
|
3
3
|
IReq_ControllerUpgradeFinalize,
|
|
4
4
|
IReq_ControllerUpgradeLaunch,
|
|
@@ -36,17 +36,19 @@ export const controllerManagementMethods = [
|
|
|
36
36
|
'controller.upgrade.launch',
|
|
37
37
|
'controller.upgrade.prepare.begin',
|
|
38
38
|
'controller.upgrade.finalize',
|
|
39
|
+
'controller.gateway.sync',
|
|
39
40
|
] as const;
|
|
40
41
|
|
|
41
42
|
export type TControllerManagementMethod = typeof controllerManagementMethods[number];
|
|
42
43
|
|
|
43
44
|
export type TControllerManagementTypedRequest =
|
|
44
|
-
|
|
|
45
|
+
| IReq_ControllerManagementStatus
|
|
45
46
|
| IReq_ControllerUpgradeLaunch
|
|
46
47
|
| IReq_ControllerUpgradePrepareBegin
|
|
47
|
-
| IReq_ControllerUpgradeFinalize
|
|
48
|
+
| IReq_ControllerUpgradeFinalize
|
|
49
|
+
| IReq_ControllerGatewaySync;
|
|
48
50
|
|
|
49
|
-
/** A management request carries a token, a version and a mode at most. */
|
|
51
|
+
/** A management request carries a token, a version and a mode, or a local CLI's attribution, at most. */
|
|
50
52
|
export const controllerManagementRequestMaximumBodyBytes = 16 * 1024;
|
|
51
53
|
/** The status document with every harness profile and upgrade blocker it may report. */
|
|
52
54
|
export const controllerManagementResponseMaximumBytes = 1024 * 1024;
|