agl 43.0.5 → 43.2.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 +30 -0
- package/dist_serve/bundle.js +5996 -5280
- package/dist_serve/bundle.js.map +2 -2
- package/dist_serve/bundle.js.third-party-notices.json +30 -30
- package/dist_serve/bundle.js.third-party-notices.txt +30 -30
- package/dist_serve/third-party-notices.md +1 -1
- package/dist_ts/00_commitinfo_data.js +1 -1
- package/dist_ts/aglapi/aglapisurface.document.js +805 -10
- package/dist_ts/aglapi/interfaces.d.ts +13 -0
- package/dist_ts/aglapi/interfaces.js +4 -1
- package/dist_ts/classes.authmodels.js +17 -4
- package/dist_ts/classes.authstore.js +16 -2
- package/dist_ts/classes.claudeharness.d.ts +14 -5
- package/dist_ts/classes.claudeharness.js +62 -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 +7 -5
- package/dist_ts/classes.codexclientadapter.js +38 -3
- package/dist_ts/classes.controller.d.ts +19 -2
- package/dist_ts/classes.controller.js +234 -27
- 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.inferencegateway.d.ts +8 -5
- package/dist_ts/classes.inferencegateway.js +62 -19
- package/dist_ts/classes.inferencerouter.d.ts +9 -0
- package/dist_ts/classes.inferencerouter.js +11 -1
- package/dist_ts/classes.inferenceservice.d.ts +9 -0
- package/dist_ts/classes.inferenceservice.js +27 -1
- package/dist_ts/classes.inferencespend.d.ts +9 -3
- package/dist_ts/classes.inferencespend.js +44 -16
- package/dist_ts/classes.mcpclient.d.ts +9 -4
- package/dist_ts/classes.mcpclient.js +24 -2
- package/dist_ts/classes.mcpcontrollerhost.d.ts +3 -1
- package/dist_ts/classes.mcpcontrollerhost.js +13 -1
- package/dist_ts/classes.mcptools.d.ts +3 -3
- package/dist_ts/classes.mcptools.js +42 -4
- package/dist_ts/classes.mcpvalidation.js +7 -1
- package/dist_ts/classes.opencodeclient.js +3 -1
- package/dist_ts/classes.proxycontrol.d.ts +33 -11
- package/dist_ts/classes.proxycontrol.js +12 -3
- package/dist_ts/classes.proxycontrolclient.d.ts +23 -5
- package/dist_ts/classes.proxycontrolclient.js +42 -6
- package/dist_ts/classes.proxydaemon.d.ts +8 -6
- package/dist_ts/classes.proxydaemon.js +42 -21
- package/dist_ts/classes.proxyleaseholder.d.ts +12 -4
- package/dist_ts/classes.proxyleaseholder.js +39 -9
- package/dist_ts/classes.proxymonitor.d.ts +7 -0
- package/dist_ts/classes.proxymonitor.js +13 -1
- package/dist_ts/classes.proxystore.d.ts +4 -3
- package/dist_ts/classes.proxystore.js +17 -7
- package/dist_ts/classes.sessionfeed.d.ts +1 -1
- package/dist_ts/classes.trustedproxysecrets.d.ts +2 -0
- package/dist_ts/classes.trustedproxysecrets.js +5 -1
- package/dist_ts/classes.validation.d.ts +7 -0
- package/dist_ts/classes.validation.js +49 -2
- package/dist_ts/driver/functions.drivertools.js +2 -2
- package/dist_ts/fleet/classes.codexworkers.d.ts +4 -11
- package/dist_ts/fleet/classes.codexworkers.js +6 -3
- package/dist_ts/fleet/classes.workers.d.ts +25 -13
- package/dist_ts/fleet/classes.workers.js +105 -9
- package/dist_ts/fleet/functions.workervalidation.d.ts +26 -1
- package/dist_ts/fleet/functions.workervalidation.js +40 -11
- package/dist_ts/fleet/interfaces.workers.d.ts +17 -11
- package/dist_ts/fleet/interfaces.workers.js +10 -1
- package/dist_ts/functions.confinedrelay.d.ts +21 -0
- package/dist_ts/functions.confinedrelay.js +65 -0
- package/dist_ts/functions.controllermanagementsurface.d.ts +4 -0
- package/dist_ts/functions.controllermanagementsurface.js +15 -1
- package/dist_ts/functions.deviceapi.d.ts +4 -2
- package/dist_ts/functions.deviceapi.js +20 -2
- package/dist_ts/functions.elicitation.d.ts +49 -0
- package/dist_ts/functions.elicitation.js +418 -0
- 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.d.ts +3 -3
- package/dist_ts/functions.inferencecli.js +62 -10
- package/dist_ts/functions.inferencecliarguments.d.ts +9 -2
- package/dist_ts/functions.inferencecliarguments.js +59 -10
- package/dist_ts/functions.inferencelaunch.d.ts +35 -7
- package/dist_ts/functions.inferencelaunch.js +143 -16
- package/dist_ts/functions.mcpfleetworkertools.d.ts +63 -70
- package/dist_ts/functions.mcpfleetworkertools.js +32 -4
- 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.proxycontract.d.ts +21 -4
- package/dist_ts/functions.proxycontract.js +12 -5
- package/dist_ts/functions.proxyharnessconfig.d.ts +7 -0
- package/dist_ts/functions.proxyharnessconfig.js +11 -1
- package/dist_ts/functions.remotecli.d.ts +30 -3
- package/dist_ts/functions.remotecli.js +44 -18
- package/dist_ts/interfaces.auth.d.ts +25 -4
- package/dist_ts/interfaces.auth.js +8 -1
- package/dist_ts/plugins.d.ts +2 -0
- package/dist_ts/plugins.js +4 -1
- package/dist_ts_authswitch/authority-placement.js +3 -17
- 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_interfaces/devices.d.ts +133 -3
- package/dist_ts_interfaces/devices.js +3 -2
- package/dist_ts_interfaces/elicitations.d.ts +125 -0
- package/dist_ts_interfaces/elicitations.js +7 -0
- package/dist_ts_interfaces/fleetworkers.d.ts +119 -5
- package/dist_ts_interfaces/fleetworkers.js +14 -2
- package/dist_ts_interfaces/gateway.d.ts +151 -0
- package/dist_ts_interfaces/gateway.js +66 -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 +3 -1
- package/dist_ts_interfaces/interfaces.js +2 -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 +18 -2
- package/dist_ts_interfaces/mcprequests.js +3 -1
- package/dist_ts_interfaces/nativesessions.d.ts +14 -0
- package/dist_ts_interfaces/proxycapacity.d.ts +99 -0
- package/dist_ts_interfaces/proxycapacity.js +74 -0
- package/dist_ts_interfaces/requests.d.ts +3 -3
- package/dist_ts_interfaces/requests.fleetworkers.js +2 -2
- package/dist_ts_interfaces/requests.js +1 -1
- package/dist_ts_interfaces/requests.promptreply.d.ts +18 -0
- package/dist_ts_interfaces/sessionfeed.d.ts +3 -2
- package/dist_ts_interfaces/sessionfeed.js +1 -1
- package/package.json +5 -4
- package/readme.md +267 -26
- package/third-party-notices.md +1 -1
- package/ts/00_commitinfo_data.ts +1 -1
- package/ts/aglapi/aglapisurface.document.ts +804 -9
- package/ts/aglapi/interfaces.ts +3 -0
- package/ts/classes.authmodels.ts +22 -3
- package/ts/classes.authstore.ts +15 -1
- package/ts/classes.claudeharness.ts +80 -9
- package/ts/classes.cli.ts +7 -3
- package/ts/classes.codexclientadapter.ts +41 -5
- package/ts/classes.controller.ts +276 -32
- package/ts/classes.controllermanagement.ts +40 -7
- package/ts/classes.gatewayclient.ts +401 -0
- package/ts/classes.gatewayclientstore.ts +272 -0
- package/ts/classes.inferencegateway.ts +69 -23
- package/ts/classes.inferencerouter.ts +12 -0
- package/ts/classes.inferenceservice.ts +27 -0
- package/ts/classes.inferencespend.ts +46 -13
- package/ts/classes.mcpclient.ts +26 -4
- package/ts/classes.mcpcontrollerhost.ts +17 -0
- package/ts/classes.mcptools.ts +47 -5
- package/ts/classes.mcpvalidation.ts +5 -0
- package/ts/classes.opencodeclient.ts +2 -0
- package/ts/classes.proxycontrol.ts +43 -13
- package/ts/classes.proxycontrolclient.ts +39 -6
- package/ts/classes.proxydaemon.ts +57 -27
- package/ts/classes.proxyleaseholder.ts +43 -11
- package/ts/classes.proxymonitor.ts +12 -0
- package/ts/classes.proxystore.ts +21 -8
- package/ts/classes.sessionfeed.ts +1 -1
- package/ts/classes.trustedproxysecrets.ts +5 -0
- package/ts/classes.validation.ts +52 -0
- package/ts/driver/functions.drivertools.ts +1 -1
- package/ts/fleet/classes.codexworkers.ts +8 -6
- package/ts/fleet/classes.workers.ts +101 -17
- package/ts/fleet/functions.workervalidation.ts +35 -9
- package/ts/fleet/interfaces.workers.ts +11 -4
- package/ts/functions.confinedrelay.ts +65 -0
- package/ts/functions.controllermanagementsurface.ts +15 -0
- package/ts/functions.deviceapi.ts +24 -1
- package/ts/functions.elicitation.ts +443 -0
- package/ts/functions.gatewaycli.ts +436 -0
- package/ts/functions.gatewayroute.ts +429 -0
- package/ts/functions.inferencecli.ts +62 -13
- package/ts/functions.inferencecliarguments.ts +56 -9
- package/ts/functions.inferencelaunch.ts +143 -16
- package/ts/functions.mcpfleetworkertools.ts +34 -4
- package/ts/functions.proxycapacity.ts +191 -0
- package/ts/functions.proxycapacitycli.ts +104 -0
- package/ts/functions.proxycontract.ts +17 -4
- package/ts/functions.proxyharnessconfig.ts +11 -0
- package/ts/functions.remotecli.ts +56 -20
- package/ts/interfaces.auth.ts +29 -4
- package/ts/plugins.ts +5 -0
- package/ts_authswitch/authority-placement.ts +2 -15
- package/ts_authswitch/authority-usagelimit.ts +84 -1
- package/ts_authswitch/authority-usagewindows.ts +13 -0
- package/ts_interfaces/devices.schema.json +476 -2
- package/ts_interfaces/devices.ts +146 -2
- package/ts_interfaces/elicitations.ts +148 -0
- package/ts_interfaces/fleetworkers.ts +96 -4
- package/ts_interfaces/gateway.ts +242 -0
- package/ts_interfaces/index.ts +3 -0
- package/ts_interfaces/interfaces.ts +3 -1
- package/ts_interfaces/management.ts +6 -4
- package/ts_interfaces/mcprequests.ts +19 -0
- package/ts_interfaces/nativesessions.ts +16 -0
- package/ts_interfaces/proxycapacity.ts +162 -0
- package/ts_interfaces/requests.fleetworkers.ts +1 -1
- package/ts_interfaces/requests.promptreply.ts +22 -0
- package/ts_interfaces/requests.ts +4 -0
- package/ts_interfaces/sessionfeed.ts +3 -2
- package/ts_web/00_commitinfo_data.ts +1 -1
- package/ts_web/classes.browserpresentation.ts +13 -5
- package/ts_web/classes.elicitationcards.ts +106 -0
- package/ts_web/classes.nativesessionstate.ts +38 -1
- package/ts_web/elements.accounts.ts +40 -113
- package/ts_web/elements.configurationpane.ts +24 -37
- package/ts_web/elements.devices.ts +4 -17
- package/ts_web/elements.fleetworker.ts +27 -2
- package/ts_web/elements.flexlimitstrip.ts +21 -70
- package/ts_web/elements.harnesscontrollerapp.ts +159 -186
- package/ts_web/functions.sessionchat.ts +5 -0
|
@@ -0,0 +1,148 @@
|
|
|
1
|
+
import type { IControllerPermission, IControllerQuestion, IControllerRuntimeId } from './interfaces.js';
|
|
2
|
+
|
|
3
|
+
/** What every elicitation card carries, whatever it asks for. */
|
|
4
|
+
interface IControllerElicitationBase {
|
|
5
|
+
id: IControllerRuntimeId;
|
|
6
|
+
sessionId: IControllerRuntimeId;
|
|
7
|
+
/** The MCP server that asks, as the harness names it. */
|
|
8
|
+
serverName: string;
|
|
9
|
+
/** What the server asks, in its words. */
|
|
10
|
+
message: string;
|
|
11
|
+
createdAt: number;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
/** A form AGL collects on the card: every field the server asked for, in its order. */
|
|
15
|
+
export interface IControllerElicitationForm extends IControllerElicitationBase {
|
|
16
|
+
mode: 'form';
|
|
17
|
+
schema: IControllerElicitationSchema;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* The server asks the owner to visit `url`, which AGL shows as plain text and never opens or fetches; accepting
|
|
22
|
+
* reports that the owner has done it and carries no content.
|
|
23
|
+
*/
|
|
24
|
+
export interface IControllerElicitationUrl extends IControllerElicitationBase {
|
|
25
|
+
mode: 'url';
|
|
26
|
+
url: string;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* A request AGL cannot collect (another mode, a nested or otherwise unknown field, a form too large to show), with
|
|
31
|
+
* the reason in AGL's words. Only decline or cancel answer it; it is never answered for the owner.
|
|
32
|
+
*/
|
|
33
|
+
export interface IControllerElicitationUnsupported extends IControllerElicitationBase {
|
|
34
|
+
mode: 'unsupported';
|
|
35
|
+
reason: string;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* MCP elicitation (`elicitation/create`, MCP 2025-11-25): an MCP server of a Claude Code or Codex session asks the
|
|
40
|
+
* owner for input. AGL holds the request as a card beside the session's permissions and questions until the owner
|
|
41
|
+
* answers it; nothing answers one on the owner's behalf, auto-accept included. A form takes MCP's flat primitive
|
|
42
|
+
* subset only: text, numbers, a yes or no, and a single or multiple choice of strings; everything else is
|
|
43
|
+
* `unsupported`, never a form with a field left out.
|
|
44
|
+
*/
|
|
45
|
+
export type TControllerElicitation = IControllerElicitationForm | IControllerElicitationUrl | IControllerElicitationUnsupported;
|
|
46
|
+
|
|
47
|
+
/** A form's fields in the order the server lists them. */
|
|
48
|
+
export interface IControllerElicitationSchema {
|
|
49
|
+
fields: TControllerElicitationField[];
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
export type TControllerElicitationField =
|
|
53
|
+
| IControllerElicitationTextField
|
|
54
|
+
| IControllerElicitationNumberField
|
|
55
|
+
| IControllerElicitationBooleanField
|
|
56
|
+
| IControllerElicitationChoiceField
|
|
57
|
+
| IControllerElicitationChoicesField;
|
|
58
|
+
|
|
59
|
+
interface IControllerElicitationFieldBase {
|
|
60
|
+
/** The property name the answer carries the value under. */
|
|
61
|
+
name: string;
|
|
62
|
+
title?: string;
|
|
63
|
+
description?: string;
|
|
64
|
+
/** The answer must carry a value for it. */
|
|
65
|
+
required: boolean;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
/** The string formats MCP names; a value is checked against its format before it is sent. */
|
|
69
|
+
export type TControllerElicitationTextFormat = 'email' | 'uri' | 'date' | 'date-time';
|
|
70
|
+
|
|
71
|
+
export interface IControllerElicitationTextField extends IControllerElicitationFieldBase {
|
|
72
|
+
kind: 'text';
|
|
73
|
+
format?: TControllerElicitationTextFormat;
|
|
74
|
+
/** In characters (Unicode code points), as JSON Schema counts them. */
|
|
75
|
+
minLength?: number;
|
|
76
|
+
maxLength?: number;
|
|
77
|
+
default?: string;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
export interface IControllerElicitationNumberField extends IControllerElicitationFieldBase {
|
|
81
|
+
kind: 'number';
|
|
82
|
+
/** Whole numbers only (JSON Schema `integer`). */
|
|
83
|
+
integer: boolean;
|
|
84
|
+
/** Inclusive bounds. */
|
|
85
|
+
minimum?: number;
|
|
86
|
+
maximum?: number;
|
|
87
|
+
default?: number;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
export interface IControllerElicitationBooleanField extends IControllerElicitationFieldBase {
|
|
91
|
+
kind: 'boolean';
|
|
92
|
+
default?: boolean;
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
/** One choice: the value the answer carries, and the label the server gave it (its value when it gave none). */
|
|
96
|
+
export interface IControllerElicitationOption {
|
|
97
|
+
value: string;
|
|
98
|
+
label: string;
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
/** A single choice among strings. */
|
|
102
|
+
export interface IControllerElicitationChoiceField extends IControllerElicitationFieldBase {
|
|
103
|
+
kind: 'choice';
|
|
104
|
+
options: IControllerElicitationOption[];
|
|
105
|
+
default?: string;
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
/** Several choices among strings, each at most once. */
|
|
109
|
+
export interface IControllerElicitationChoicesField extends IControllerElicitationFieldBase {
|
|
110
|
+
kind: 'choices';
|
|
111
|
+
options: IControllerElicitationOption[];
|
|
112
|
+
minItems?: number;
|
|
113
|
+
maxItems?: number;
|
|
114
|
+
default?: string[];
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
/** A value of a form's field: text or a single choice, a number, a yes or no, or several choices. */
|
|
118
|
+
export type TControllerElicitationValue = string | number | boolean | string[];
|
|
119
|
+
|
|
120
|
+
/** A form's answer: one value per field the owner filled in, by field name. */
|
|
121
|
+
export type TControllerElicitationContent = Record<string, TControllerElicitationValue>;
|
|
122
|
+
|
|
123
|
+
/**
|
|
124
|
+
* The owner's answer. `accept` sends a form's `content` (every field it carries is checked against the form first; a
|
|
125
|
+
* mismatch is refused, nothing is sent) or, in URL mode, reports the visit done without content; an unsupported
|
|
126
|
+
* request refuses it. `decline` refuses what the server asks; `cancel` dismisses it without a decision.
|
|
127
|
+
*/
|
|
128
|
+
export type TControllerElicitationReply =
|
|
129
|
+
| { action: 'accept'; content?: TControllerElicitationContent }
|
|
130
|
+
| { action: 'decline' }
|
|
131
|
+
| { action: 'cancel' };
|
|
132
|
+
|
|
133
|
+
/** At most this many fields, choices per field and bytes of UTF-8 JSON in one answer. */
|
|
134
|
+
export const controllerElicitationMaxFields = 64;
|
|
135
|
+
export const controllerElicitationMaxOptions = 256;
|
|
136
|
+
export const controllerElicitationMaxContentBytes = 64 * 1024;
|
|
137
|
+
|
|
138
|
+
/** The requests of a conversation that wait for the owner's answer. */
|
|
139
|
+
export interface IControllerAttention {
|
|
140
|
+
permissions: IControllerPermission[];
|
|
141
|
+
questions: IControllerQuestion[];
|
|
142
|
+
elicitations: TControllerElicitation[];
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
/** A session waits for the owner while any of its requests does. */
|
|
146
|
+
export const controllerAttentionPending = (attentionArg: IControllerAttention): boolean => (
|
|
147
|
+
attentionArg.permissions.length > 0 || attentionArg.questions.length > 0 || attentionArg.elicitations.length > 0
|
|
148
|
+
);
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import type { IControllerSystemMetrics, TControllerModelLimitKind } from './interfaces.js';
|
|
1
|
+
import type { IControllerNativeWait, IControllerSystemMetrics, TControllerModelLimitKind } from './interfaces.js';
|
|
2
2
|
import type { ITicketActor } from './tickets.js';
|
|
3
3
|
import type { IFleetTicketSync } from './fleet.js';
|
|
4
|
+
import type { IControllerFleetWorkerView } from './requests.fleetworkers.js';
|
|
4
5
|
|
|
5
6
|
export type TFleetWorkerHarness = 'claude' | 'codex';
|
|
6
7
|
export interface IFleetWorkerDispatchHolder {
|
|
@@ -186,8 +187,21 @@ export interface IFleetWorkerRequests {
|
|
|
186
187
|
*/
|
|
187
188
|
refresh: { name: string; nextName: string; profile?: string; handoff: string; note?: string; ticketKey: string };
|
|
188
189
|
move: { name: string; nextName: string; profile: string; handoff: string; note?: string; ticketKey: string };
|
|
189
|
-
|
|
190
|
+
/**
|
|
191
|
+
* Lists the owner's workers. `view` `full` (the default of this request) returns every matching public record at
|
|
192
|
+
* once; `summary` returns pages of `limit` (1-100, default 50) `IFleetWorkerSummary` rows, newest first, continued
|
|
193
|
+
* with the `cursor` of the page before. MCP `fleet_worker_list` asks for `summary` unless told otherwise. `state` and
|
|
194
|
+
* `harness` narrow either view; archived workers are listed only with `archived`.
|
|
195
|
+
*/
|
|
196
|
+
list: { archived?: boolean; ticketKey?: string; view?: TFleetWorkerListView; limit?: number; cursor?: string; state?: IFleetWorker['state']; harness?: TFleetWorkerHarness };
|
|
197
|
+
/** One worker of the owner by its `name` or its `id`, archived ones included. */
|
|
198
|
+
get: ({ name: string; id?: never } | { id: string; name?: never }) & { /** A point read names no ticket. */ ticketKey?: never };
|
|
190
199
|
status: { id: string; ticketKey?: string };
|
|
200
|
+
/**
|
|
201
|
+
* Waits until the fleet worker job `id` succeeded or failed, at most `timeoutMs` (0-240000). Waiting, timing out
|
|
202
|
+
* or abandoning the wait never cancels the job.
|
|
203
|
+
*/
|
|
204
|
+
'job-wait': { id: string; timeoutMs: number; /** Jobs are the owner's; the wait names no ticket. */ ticketKey?: never };
|
|
191
205
|
watch: { cursor?: IFleetEventCursor; timeoutMs?: number; ticketKey?: string };
|
|
192
206
|
/**
|
|
193
207
|
* Wakes a settled Claude Code background job that no fleet worker binds with an attributed message, through Claude
|
|
@@ -197,7 +211,68 @@ export interface IFleetWorkerRequests {
|
|
|
197
211
|
'native-message': { nativeId: string; text: string; sender: string; /** A native wake belongs to no ticket. */ ticketKey?: never };
|
|
198
212
|
}
|
|
199
213
|
export type TFleetWorkerAction = keyof IFleetWorkerRequests;
|
|
200
|
-
|
|
214
|
+
/** The actions that read and never start a job. */
|
|
215
|
+
export const fleetWorkerReadActions = ['list', 'get', 'status', 'job-wait', 'watch'] as const satisfies readonly TFleetWorkerAction[];
|
|
216
|
+
export type TFleetWorkerJobAction = Exclude<TFleetWorkerAction, (typeof fleetWorkerReadActions)[number]>;
|
|
217
|
+
export type TFleetWorkerListView = 'summary' | 'full';
|
|
218
|
+
/** The longest fleet worker job wait one request asks for. */
|
|
219
|
+
export const fleetWorkerJobWaitMaximumMs = 240_000;
|
|
220
|
+
/**
|
|
221
|
+
* A worker as a summary list shows it: identity, binding, what the controller observed and which fences it holds,
|
|
222
|
+
* without attribution, proof or error bodies; `fleet_worker_get` returns the whole record.
|
|
223
|
+
*/
|
|
224
|
+
export interface IFleetWorkerSummary {
|
|
225
|
+
id: string;
|
|
226
|
+
name: string;
|
|
227
|
+
harness: TFleetWorkerHarness;
|
|
228
|
+
profileId: string;
|
|
229
|
+
ticketKey?: string;
|
|
230
|
+
state: IFleetWorker['state'];
|
|
231
|
+
nativeId?: string;
|
|
232
|
+
cwd: string;
|
|
233
|
+
updatedAt: string;
|
|
234
|
+
observed: {
|
|
235
|
+
/** The native status the controller last observed; absent until it observed the worker. */
|
|
236
|
+
status?: IFleetWorkerReport['status'];
|
|
237
|
+
/** How the newest observed turn ended; see `IFleetWorkerReport.outcome`. */
|
|
238
|
+
outcome?: IFleetWorkerTurnOutcome;
|
|
239
|
+
/** The wait for a person in the harness's own client the controller last observed; see `IControllerFleetWorkerView.nativeWait`. */
|
|
240
|
+
nativeWait?: IControllerNativeWait;
|
|
241
|
+
};
|
|
242
|
+
fence: {
|
|
243
|
+
/** An unresolved dispatch: its action and since when it holds the worker. */
|
|
244
|
+
pending?: { action: string; since: string };
|
|
245
|
+
/** The worker holds an attributed lost-dispatch resolution (`lostDispatch`). */
|
|
246
|
+
lostDispatch?: true;
|
|
247
|
+
/** The worker holds an attributed reconfirmation of a steer fence (`reconfirmedDispatch`). */
|
|
248
|
+
reconfirmed?: true;
|
|
249
|
+
/** The worker records an error (`error`). */
|
|
250
|
+
error?: true;
|
|
251
|
+
};
|
|
252
|
+
}
|
|
253
|
+
/**
|
|
254
|
+
* One page of a summary list. `total`, `fenced` (workers with an unresolved dispatch) and `failed` (workers that
|
|
255
|
+
* record an error or whose newest observed turn failed) count the whole filtered set, not the page. `nextCursor` continues after the page's last row and
|
|
256
|
+
* is absent on the last page.
|
|
257
|
+
*/
|
|
258
|
+
export interface IFleetWorkerSummaryPage {
|
|
259
|
+
view: 'summary';
|
|
260
|
+
workers: IFleetWorkerSummary[];
|
|
261
|
+
total: number;
|
|
262
|
+
fenced: number;
|
|
263
|
+
failed: number;
|
|
264
|
+
nextCursor?: string;
|
|
265
|
+
}
|
|
266
|
+
/**
|
|
267
|
+
* The refusals of the fleet worker reads, passed to the caller with their message: `job_unavailable`, the controller
|
|
268
|
+
* holds no such job of the owner (jobs are transient: a controller restart or eviction drops them; read the worker
|
|
269
|
+
* with `fleet_worker_get`); `worker_not_found`, the owner has no worker of that name or id; `list_cursor_mismatch`, the
|
|
270
|
+
* cursor belongs to another filter; `list_cursor_stale`, the worker the cursor continues after is no longer held as
|
|
271
|
+
* it was; `list_cursor_invalid`, the cursor is not one a summary list returned (a `limit` or `cursor` with the full view is
|
|
272
|
+
* refused by request validation instead).
|
|
273
|
+
*/
|
|
274
|
+
export const fleetWorkerErrorCodes = ['job_unavailable', 'worker_not_found', 'list_cursor_mismatch', 'list_cursor_stale', 'list_cursor_invalid'] as const;
|
|
275
|
+
export type TFleetWorkerErrorCode = (typeof fleetWorkerErrorCodes)[number];
|
|
201
276
|
export type TFleetWorkerRequest<T extends TFleetWorkerAction> = IFleetWorkerRequests[T];
|
|
202
277
|
export interface IFleetWorkerJob {
|
|
203
278
|
id: string;
|
|
@@ -286,7 +361,24 @@ export interface IFleetWorkerResponses {
|
|
|
286
361
|
steer: { job: IFleetWorkerJob };
|
|
287
362
|
report: { job: IFleetWorkerJob }; stop: { job: IFleetWorkerJob }; archive: { job: IFleetWorkerJob };
|
|
288
363
|
refresh: { job: IFleetWorkerJob }; move: { job: IFleetWorkerJob };
|
|
289
|
-
|
|
364
|
+
/** The full view returns `{ workers }`, the summary view one page. */
|
|
365
|
+
list: IFleetWorkerFullList | IFleetWorkerSummaryPage;
|
|
366
|
+
/** The public record and the native status and excerpt the controller last observed. */
|
|
367
|
+
get: IControllerFleetWorkerView;
|
|
368
|
+
status: { job: IFleetWorkerJob };
|
|
369
|
+
/** The job as it is when it settled or the wait ended; `timedOut`, it still runs. */
|
|
370
|
+
'job-wait': { job: IFleetWorkerJob; timedOut: boolean };
|
|
371
|
+
watch: IFleetWatchResult;
|
|
290
372
|
'native-message': { job: IFleetWorkerJob };
|
|
291
373
|
}
|
|
292
374
|
export type TFleetWorkerResponse<T extends TFleetWorkerAction> = IFleetWorkerResponses[T];
|
|
375
|
+
/** Every matching public record of a full list. */
|
|
376
|
+
export interface IFleetWorkerFullList { workers: IFleetWorker[] }
|
|
377
|
+
/**
|
|
378
|
+
* What the request `R` of `T` gets back: a list answers a summary page to `view: 'summary'` and the full records to a
|
|
379
|
+
* request without `view` (the private request's default) or with `view: 'full'`.
|
|
380
|
+
*/
|
|
381
|
+
export type TFleetWorkerResponseTo<T extends TFleetWorkerAction, R> = T extends 'list'
|
|
382
|
+
? 'view' extends keyof R ? R extends { view: 'summary' } ? IFleetWorkerSummaryPage : R extends { view: 'full' } ? IFleetWorkerFullList : TFleetWorkerResponse<'list'>
|
|
383
|
+
: IFleetWorkerFullList
|
|
384
|
+
: TFleetWorkerResponse<T>;
|
|
@@ -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
|
+
}
|
package/ts_interfaces/index.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
export * from './interfaces.js';
|
|
2
|
+
export * from './elicitations.js';
|
|
2
3
|
export * from './functions.livetoolcoverage.js';
|
|
3
4
|
export * from './functions.workspacepaths.js';
|
|
4
5
|
export * from './functions.projectid.js';
|
|
@@ -10,6 +11,7 @@ export * from './devtools.js';
|
|
|
10
11
|
export * from './requests.js';
|
|
11
12
|
export * from './mcprequests.js';
|
|
12
13
|
export * from './management.js';
|
|
14
|
+
export * from './gateway.js';
|
|
13
15
|
export * from './codex.js';
|
|
14
16
|
export * from './mcpworkspacerequests.js';
|
|
15
17
|
export * from './mcpjobrequests.js';
|
|
@@ -32,5 +34,6 @@ export * from './requests.driver.js';
|
|
|
32
34
|
export * from './sessionfeed.js';
|
|
33
35
|
export * from './nativesessions.js';
|
|
34
36
|
export * from './metrics.js';
|
|
37
|
+
export * from './proxycapacity.js';
|
|
35
38
|
export * from './devices.js';
|
|
36
39
|
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 = 52 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. */
|
|
@@ -1555,6 +1555,8 @@ export interface IControllerSessionDetail {
|
|
|
1555
1555
|
pendingPrompts: IControllerPendingPrompt[];
|
|
1556
1556
|
permissions: IControllerPermission[];
|
|
1557
1557
|
questions: IControllerQuestion[];
|
|
1558
|
+
/** MCP elicitations of a Claude Code or Codex conversation; empty for every other harness. */
|
|
1559
|
+
elicitations: import('./elicitations.js').TControllerElicitation[];
|
|
1558
1560
|
todos: IControllerTodo[];
|
|
1559
1561
|
scratchpad: IControllerSessionScratchpad;
|
|
1560
1562
|
intelligenceExchanges: IControllerIntelligenceExchange[];
|
|
@@ -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;
|
|
@@ -6,6 +6,7 @@ import { controllerMcpFleetMethods, type TControllerMcpFleetTypedRequest } from
|
|
|
6
6
|
import { controllerMcpSessionFeedMethods, type TControllerMcpSessionFeedTypedRequest } from './sessionfeed.js';
|
|
7
7
|
import { controllerMcpDeployMethods, type TControllerMcpDeployTypedRequest } from './deployments.js';
|
|
8
8
|
import * as plugins from './plugins.js';
|
|
9
|
+
import type { IProxyCapacityAnswer, IProxyCapacityRequest } from './proxycapacity.js';
|
|
9
10
|
import type { IReq_ControllerMcpWorkerEnroll, IWorkerCallerSubject } from './workercallers.js';
|
|
10
11
|
import type { IReq_ControllerSettingsGet, IReq_ControllerSettingsUpdate } from './requests.js';
|
|
11
12
|
import type {
|
|
@@ -44,6 +45,7 @@ export const controllerMcpMethods = [
|
|
|
44
45
|
'agl.mcp.session.scratchpad.read',
|
|
45
46
|
'agl.mcp.session.scratchpad.update',
|
|
46
47
|
'agl.mcp.session.message',
|
|
48
|
+
'agl.mcp.proxy.capacity',
|
|
47
49
|
...controllerMcpWorkspaceMethods,
|
|
48
50
|
...controllerMcpJobMethods,
|
|
49
51
|
'agl.mcp.controller.settings.get',
|
|
@@ -105,6 +107,7 @@ export const controllerMcpSessionDetailFields = {
|
|
|
105
107
|
pendingPrompts: { kind: 'array', optional: false },
|
|
106
108
|
permissions: { kind: 'array', optional: false },
|
|
107
109
|
questions: { kind: 'array', optional: false },
|
|
110
|
+
elicitations: { kind: 'array', optional: false },
|
|
108
111
|
todos: { kind: 'array', optional: false },
|
|
109
112
|
scratchpad: { kind: 'record', optional: false },
|
|
110
113
|
intelligenceExchanges: { kind: 'array', optional: false },
|
|
@@ -298,6 +301,21 @@ export interface IReq_ControllerMcpStatus extends plugins.typedrequestInterfaces
|
|
|
298
301
|
response: IControllerMcpStatusResponse;
|
|
299
302
|
}
|
|
300
303
|
|
|
304
|
+
/**
|
|
305
|
+
* A pool's room for new work in AGL's inference proxy, or both pools' when `provider` is absent: each counted account by
|
|
306
|
+
* its id with its plan, state, headroom, binding window and when its headroom next grows, the newest provider 429 on
|
|
307
|
+
* the pool, and an `open` or `wait` verdict against `minHeadroom` (15 unless given). The controller asks the proxy; the
|
|
308
|
+
* answer names no account by label or email.
|
|
309
|
+
*/
|
|
310
|
+
export interface IReq_ControllerMcpProxyCapacity extends plugins.typedrequestInterfaces.implementsTR<
|
|
311
|
+
plugins.typedrequestInterfaces.ITypedRequest,
|
|
312
|
+
IReq_ControllerMcpProxyCapacity
|
|
313
|
+
> {
|
|
314
|
+
method: 'agl.mcp.proxy.capacity';
|
|
315
|
+
request: IProxyCapacityRequest;
|
|
316
|
+
response: IProxyCapacityAnswer;
|
|
317
|
+
}
|
|
318
|
+
|
|
301
319
|
/** Lists the projects registered with the running AGL controller. */
|
|
302
320
|
export interface IReq_ControllerMcpProjectsList extends plugins.typedrequestInterfaces.implementsTR<
|
|
303
321
|
plugins.typedrequestInterfaces.ITypedRequest,
|
|
@@ -440,6 +458,7 @@ export type TControllerMcpTypedRequest =
|
|
|
440
458
|
| TControllerMcpWorkspaceTypedRequest
|
|
441
459
|
| TControllerMcpJobTypedRequest
|
|
442
460
|
| IReq_ControllerMcpStatus
|
|
461
|
+
| IReq_ControllerMcpProxyCapacity
|
|
443
462
|
| IReq_ControllerMcpProjectsList
|
|
444
463
|
| IReq_ControllerMcpSessionsList
|
|
445
464
|
| IReq_ControllerMcpSessionRead
|