agl 43.0.4 → 43.1.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.
Files changed (165) hide show
  1. package/changelog.md +25 -0
  2. package/dist_serve/bundle.js +5186 -4683
  3. package/dist_serve/bundle.js.map +2 -2
  4. package/dist_serve/bundle.js.third-party-notices.json +29 -29
  5. package/dist_serve/bundle.js.third-party-notices.txt +29 -29
  6. package/dist_serve/third-party-notices.md +1 -1
  7. package/dist_ts/00_commitinfo_data.js +1 -1
  8. package/dist_ts/aglapi/aglapisurface.document.js +475 -4
  9. package/dist_ts/aglapi/interfaces.d.ts +10 -0
  10. package/dist_ts/aglapi/interfaces.js +3 -1
  11. package/dist_ts/classes.claudeharness.d.ts +14 -5
  12. package/dist_ts/classes.claudeharness.js +62 -2
  13. package/dist_ts/classes.codexclientadapter.d.ts +7 -5
  14. package/dist_ts/classes.codexclientadapter.js +38 -3
  15. package/dist_ts/classes.controller.d.ts +9 -2
  16. package/dist_ts/classes.controller.js +116 -24
  17. package/dist_ts/classes.flexservice.d.ts +6 -7
  18. package/dist_ts/classes.flexservice.js +12 -45
  19. package/dist_ts/classes.flexsupervisor.d.ts +37 -3
  20. package/dist_ts/classes.flexsupervisor.js +164 -37
  21. package/dist_ts/classes.inferencegateway.d.ts +8 -5
  22. package/dist_ts/classes.inferencegateway.js +62 -19
  23. package/dist_ts/classes.inferencespend.d.ts +9 -3
  24. package/dist_ts/classes.inferencespend.js +44 -16
  25. package/dist_ts/classes.mcpclient.d.ts +6 -4
  26. package/dist_ts/classes.mcpclient.js +6 -2
  27. package/dist_ts/classes.mcpcontrollerhost.js +5 -1
  28. package/dist_ts/classes.mcptools.d.ts +1 -1
  29. package/dist_ts/classes.mcptools.js +17 -4
  30. package/dist_ts/classes.opencodeclient.js +3 -1
  31. package/dist_ts/classes.proxycontrol.d.ts +22 -11
  32. package/dist_ts/classes.proxycontrol.js +6 -3
  33. package/dist_ts/classes.proxycontrolclient.d.ts +6 -5
  34. package/dist_ts/classes.proxycontrolclient.js +8 -6
  35. package/dist_ts/classes.proxydaemon.d.ts +8 -6
  36. package/dist_ts/classes.proxydaemon.js +35 -21
  37. package/dist_ts/classes.proxyleaseholder.d.ts +12 -4
  38. package/dist_ts/classes.proxyleaseholder.js +39 -9
  39. package/dist_ts/classes.proxystore.d.ts +4 -3
  40. package/dist_ts/classes.proxystore.js +17 -7
  41. package/dist_ts/classes.sessionfeed.d.ts +1 -1
  42. package/dist_ts/classes.validation.d.ts +7 -0
  43. package/dist_ts/classes.validation.js +49 -2
  44. package/dist_ts/driver/functions.drivertools.js +2 -2
  45. package/dist_ts/fleet/classes.codexworkers.d.ts +4 -11
  46. package/dist_ts/fleet/classes.codexworkers.js +6 -3
  47. package/dist_ts/fleet/classes.workers.d.ts +25 -13
  48. package/dist_ts/fleet/classes.workers.js +105 -9
  49. package/dist_ts/fleet/functions.workervalidation.d.ts +26 -1
  50. package/dist_ts/fleet/functions.workervalidation.js +40 -11
  51. package/dist_ts/fleet/interfaces.workers.d.ts +17 -11
  52. package/dist_ts/fleet/interfaces.workers.js +10 -1
  53. package/dist_ts/flexharness.child.js +9 -4
  54. package/dist_ts/functions.confinedrelay.d.ts +21 -0
  55. package/dist_ts/functions.confinedrelay.js +65 -0
  56. package/dist_ts/functions.deviceapi.d.ts +4 -2
  57. package/dist_ts/functions.deviceapi.js +20 -2
  58. package/dist_ts/functions.elicitation.d.ts +49 -0
  59. package/dist_ts/functions.elicitation.js +418 -0
  60. package/dist_ts/functions.flexchildshutdown.d.ts +7 -0
  61. package/dist_ts/functions.flexchildshutdown.js +18 -1
  62. package/dist_ts/functions.inferencecli.d.ts +3 -3
  63. package/dist_ts/functions.inferencecli.js +33 -10
  64. package/dist_ts/functions.inferencecliarguments.d.ts +2 -1
  65. package/dist_ts/functions.inferencecliarguments.js +29 -8
  66. package/dist_ts/functions.inferencelaunch.d.ts +35 -7
  67. package/dist_ts/functions.inferencelaunch.js +143 -16
  68. package/dist_ts/functions.mcpfleetworkertools.d.ts +63 -70
  69. package/dist_ts/functions.mcpfleetworkertools.js +32 -4
  70. package/dist_ts/functions.proxycontract.d.ts +21 -4
  71. package/dist_ts/functions.proxycontract.js +12 -5
  72. package/dist_ts/functions.proxyharnessconfig.d.ts +7 -0
  73. package/dist_ts/functions.proxyharnessconfig.js +11 -1
  74. package/dist_ts/interfaces.auth.d.ts +1 -1
  75. package/dist_ts/interfaces.auth.js +2 -1
  76. package/dist_ts_interfaces/devices.d.ts +133 -3
  77. package/dist_ts_interfaces/devices.js +3 -2
  78. package/dist_ts_interfaces/elicitations.d.ts +125 -0
  79. package/dist_ts_interfaces/elicitations.js +7 -0
  80. package/dist_ts_interfaces/fleetworkers.d.ts +119 -5
  81. package/dist_ts_interfaces/fleetworkers.js +14 -2
  82. package/dist_ts_interfaces/index.d.ts +1 -0
  83. package/dist_ts_interfaces/index.js +2 -1
  84. package/dist_ts_interfaces/interfaces.d.ts +3 -1
  85. package/dist_ts_interfaces/interfaces.js +2 -2
  86. package/dist_ts_interfaces/mcprequests.d.ts +5 -1
  87. package/dist_ts_interfaces/mcprequests.js +2 -1
  88. package/dist_ts_interfaces/nativesessions.d.ts +14 -0
  89. package/dist_ts_interfaces/requests.d.ts +3 -3
  90. package/dist_ts_interfaces/requests.fleetworkers.js +2 -2
  91. package/dist_ts_interfaces/requests.js +1 -1
  92. package/dist_ts_interfaces/requests.promptreply.d.ts +18 -0
  93. package/dist_ts_interfaces/sessionfeed.d.ts +3 -2
  94. package/dist_ts_interfaces/sessionfeed.js +1 -1
  95. package/dist_ts_migration/index.d.ts +0 -2
  96. package/dist_ts_migration/index.js +1 -3
  97. package/dist_ts_migration/v43_flexpostharnessmigrationmarkers.d.ts +6 -17
  98. package/dist_ts_migration/v43_flexpostharnessmigrationmarkers.js +6 -36
  99. package/package.json +3 -3
  100. package/readme.md +191 -24
  101. package/third-party-notices.md +1 -1
  102. package/ts/00_commitinfo_data.ts +1 -1
  103. package/ts/aglapi/aglapisurface.document.ts +474 -3
  104. package/ts/aglapi/interfaces.ts +2 -0
  105. package/ts/classes.claudeharness.ts +80 -9
  106. package/ts/classes.codexclientadapter.ts +41 -5
  107. package/ts/classes.controller.ts +142 -29
  108. package/ts/classes.flexservice.ts +10 -66
  109. package/ts/classes.flexsupervisor.ts +214 -37
  110. package/ts/classes.inferencegateway.ts +69 -23
  111. package/ts/classes.inferencespend.ts +46 -13
  112. package/ts/classes.mcpclient.ts +8 -4
  113. package/ts/classes.mcpcontrollerhost.ts +4 -0
  114. package/ts/classes.mcptools.ts +17 -3
  115. package/ts/classes.opencodeclient.ts +2 -0
  116. package/ts/classes.proxycontrol.ts +27 -13
  117. package/ts/classes.proxycontrolclient.ts +9 -6
  118. package/ts/classes.proxydaemon.ts +49 -27
  119. package/ts/classes.proxyleaseholder.ts +43 -11
  120. package/ts/classes.proxystore.ts +21 -8
  121. package/ts/classes.sessionfeed.ts +1 -1
  122. package/ts/classes.validation.ts +52 -0
  123. package/ts/driver/functions.drivertools.ts +1 -1
  124. package/ts/fleet/classes.codexworkers.ts +8 -6
  125. package/ts/fleet/classes.workers.ts +101 -17
  126. package/ts/fleet/functions.workervalidation.ts +35 -9
  127. package/ts/fleet/interfaces.workers.ts +11 -4
  128. package/ts/flexharness.child.ts +8 -3
  129. package/ts/functions.confinedrelay.ts +65 -0
  130. package/ts/functions.deviceapi.ts +24 -1
  131. package/ts/functions.elicitation.ts +443 -0
  132. package/ts/functions.flexchildshutdown.ts +22 -0
  133. package/ts/functions.inferencecli.ts +38 -13
  134. package/ts/functions.inferencecliarguments.ts +26 -5
  135. package/ts/functions.inferencelaunch.ts +143 -16
  136. package/ts/functions.mcpfleetworkertools.ts +34 -4
  137. package/ts/functions.proxycontract.ts +17 -4
  138. package/ts/functions.proxyharnessconfig.ts +11 -0
  139. package/ts/interfaces.auth.ts +1 -0
  140. package/ts_interfaces/devices.schema.json +476 -2
  141. package/ts_interfaces/devices.ts +146 -2
  142. package/ts_interfaces/elicitations.ts +148 -0
  143. package/ts_interfaces/fleetworkers.ts +96 -4
  144. package/ts_interfaces/index.ts +1 -0
  145. package/ts_interfaces/interfaces.ts +3 -1
  146. package/ts_interfaces/mcprequests.ts +1 -0
  147. package/ts_interfaces/nativesessions.ts +16 -0
  148. package/ts_interfaces/requests.fleetworkers.ts +1 -1
  149. package/ts_interfaces/requests.promptreply.ts +22 -0
  150. package/ts_interfaces/requests.ts +4 -0
  151. package/ts_interfaces/sessionfeed.ts +3 -2
  152. package/ts_migration/index.ts +0 -2
  153. package/ts_migration/v43_flexpostharnessmigrationmarkers.ts +6 -49
  154. package/ts_web/00_commitinfo_data.ts +1 -1
  155. package/ts_web/classes.elicitationcards.ts +106 -0
  156. package/ts_web/classes.nativesessionstate.ts +38 -1
  157. package/ts_web/elements.fleetworker.ts +27 -2
  158. package/ts_web/elements.harnesscontrollerapp.ts +68 -1
  159. package/ts_web/functions.sessionchat.ts +5 -0
  160. package/dist_ts_migration/classes.flexpostharnessmigrationrunner.d.ts +0 -19
  161. package/dist_ts_migration/classes.flexpostharnessmigrationrunner.js +0 -34
  162. package/dist_ts_migration/v19_flexprojectmanagement.d.ts +0 -14
  163. package/dist_ts_migration/v19_flexprojectmanagement.js +0 -23
  164. package/ts_migration/classes.flexpostharnessmigrationrunner.ts +0 -54
  165. package/ts_migration/v19_flexprojectmanagement.ts +0 -32
@@ -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
- list: { archived?: boolean; ticketKey?: string };
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
- export type TFleetWorkerJobAction = Exclude<TFleetWorkerAction, 'list' | 'status' | 'watch'>;
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
- list: { workers: IFleetWorker[] }; status: { job: IFleetWorkerJob }; watch: IFleetWatchResult;
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>;
@@ -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';
@@ -5,7 +5,7 @@ import type {
5
5
  TControllerBrowserPaintAvailability,
6
6
  TControllerBrowserPaintTermination,
7
7
  } from './browserpaint.js';
8
- export const controllerProtocolVersion = 51 as const;
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[];
@@ -105,6 +105,7 @@ export const controllerMcpSessionDetailFields = {
105
105
  pendingPrompts: { kind: 'array', optional: false },
106
106
  permissions: { kind: 'array', optional: false },
107
107
  questions: { kind: 'array', optional: false },
108
+ elicitations: { kind: 'array', optional: false },
108
109
  todos: { kind: 'array', optional: false },
109
110
  scratchpad: { kind: 'record', optional: false },
110
111
  intelligenceExchanges: { kind: 'array', optional: false },
@@ -1,4 +1,5 @@
1
1
  import type * as plugins from './plugins.js';
2
+ import type { TControllerElicitation, TControllerElicitationReply } from './elicitations.js';
2
3
  import type {
3
4
  IControllerDraftAttachment,
4
5
  TControllerPermissionReply,
@@ -71,6 +72,7 @@ export interface IReq_ControllerNativeSessionRead extends plugins.typedrequestIn
71
72
  /** Requests of a turn AGL runs in the session that wait for the owner. */
72
73
  permissions: IControllerPermission[];
73
74
  questions: IControllerQuestion[];
75
+ elicitations: TControllerElicitation[];
74
76
  todos: IControllerTodo[];
75
77
  scratchpad: IControllerSessionScratchpad;
76
78
  intelligenceExchanges: IControllerIntelligenceExchange[];
@@ -157,3 +159,17 @@ export interface IReq_ControllerNativeSessionQuestionReply extends plugins.typed
157
159
  };
158
160
  response: { success: boolean };
159
161
  }
162
+
163
+ /** Answers an MCP elicitation of a turn AGL runs in a native session. */
164
+ export interface IReq_ControllerNativeSessionElicitationReply extends plugins.typedrequestInterfaces.implementsTR<
165
+ plugins.typedrequestInterfaces.ITypedRequest,
166
+ IReq_ControllerNativeSessionElicitationReply
167
+ > {
168
+ method: 'controller.nativesession.elicitation.reply';
169
+ request: {
170
+ session: IControllerNativeSessionRef;
171
+ requestId: IControllerRuntimeId;
172
+ reply: TControllerElicitationReply;
173
+ };
174
+ response: { success: boolean };
175
+ }
@@ -1,7 +1,7 @@
1
1
  import type * as plugins from './plugins.js';
2
2
  import type { IFleetWorker, IFleetWorkerJob, IFleetWorkerReport, IFleetWorkerTurnOutcome, TFleetWorkerAction, TFleetWorkerRequest, TFleetWorkerResponse } from './fleetworkers.js';
3
3
  import type { IControllerDraftAttachment, IControllerMessageBundle, IControllerNativeWait } from './interfaces.js';
4
- export const controllerMcpFleetWorkerMethods = ['start', 'adopt', 'resolve-lost', 'reconfirm', 'steer', 'report', 'stop', 'archive', 'refresh', 'move', 'list', 'status', 'watch', 'native-message'].map(
4
+ export const controllerMcpFleetWorkerMethods = ['start', 'adopt', 'resolve-lost', 'reconfirm', 'steer', 'report', 'stop', 'archive', 'refresh', 'move', 'list', 'get', 'status', 'job-wait', 'watch', 'native-message'].map(
5
5
  (action) => `agl.mcp.fleet.worker.${action}`,
6
6
  ) as Array<`agl.mcp.fleet.worker.${TFleetWorkerAction}`>;
7
7
  export type TControllerMcpFleetWorkerRequest<T extends TFleetWorkerAction> = {
@@ -1,5 +1,6 @@
1
1
  import * as plugins from './plugins.js';
2
2
  import type { IControllerRuntimeId, TControllerPermissionReply } from './interfaces.js';
3
+ import type { TControllerElicitationReply } from './elicitations.js';
3
4
 
4
5
  export interface IReq_ControllerPermissionReply extends plugins.typedrequestInterfaces.implementsTR<
5
6
  plugins.typedrequestInterfaces.ITypedRequest,
@@ -34,3 +35,24 @@ export interface IReq_ControllerQuestionReply extends plugins.typedrequestInterf
34
35
  success: boolean;
35
36
  };
36
37
  }
38
+
39
+ /**
40
+ * Answers an MCP elicitation of a Claude Code or Codex conversation. An accepted form's content is checked against the
41
+ * form before anything is sent; a mismatch is refused with `invalid_request`, a request no longer pending with
42
+ * `not_found`.
43
+ */
44
+ export interface IReq_ControllerElicitationReply extends plugins.typedrequestInterfaces.implementsTR<
45
+ plugins.typedrequestInterfaces.ITypedRequest,
46
+ IReq_ControllerElicitationReply
47
+ > {
48
+ method: 'controller.elicitation.reply';
49
+ request: {
50
+ projectId: string;
51
+ sessionId: IControllerRuntimeId;
52
+ requestId: IControllerRuntimeId;
53
+ reply: TControllerElicitationReply;
54
+ };
55
+ response: {
56
+ success: boolean;
57
+ };
58
+ }
@@ -62,6 +62,7 @@ import type { IReq_ControllerSessionFeedAcknowledge, IReq_ControllerSessionFeedL
62
62
  import type { TControllerDeployTypedRequest } from './deployments.js';
63
63
  import type {
64
64
  IReq_ControllerNativeSessionAuxiliaryGet,
65
+ IReq_ControllerNativeSessionElicitationReply,
65
66
  IReq_ControllerNativeSessionIntelligenceAsk,
66
67
  IReq_ControllerNativeSessionPermissionReply,
67
68
  IReq_ControllerNativeSessionQuestionReply,
@@ -148,6 +149,7 @@ import type {
148
149
  IReq_ControllerSessionYolo,
149
150
  } from './requests.session.js';
150
151
  import type {
152
+ IReq_ControllerElicitationReply,
151
153
  IReq_ControllerPermissionReply,
152
154
  IReq_ControllerQuestionReply,
153
155
  } from './requests.promptreply.js';
@@ -277,6 +279,7 @@ export type TControllerRequest =
277
279
  | IReq_ControllerNativeSessionIntelligenceAsk
278
280
  | IReq_ControllerNativeSessionPermissionReply
279
281
  | IReq_ControllerNativeSessionQuestionReply
282
+ | IReq_ControllerNativeSessionElicitationReply
280
283
  | IReq_ControllerUsageWatch
281
284
  | IReq_ControllerUsageUnwatch
282
285
  | IReq_ControllerSystemMetrics
@@ -351,6 +354,7 @@ export type TControllerRequest =
351
354
  | IReq_ControllerSessionPendingPromptAction
352
355
  | IReq_ControllerPermissionReply
353
356
  | IReq_ControllerQuestionReply
357
+ | IReq_ControllerElicitationReply
354
358
  | IReq_ControllerSessionRename
355
359
  | IReq_ControllerSessionArchive
356
360
  | IReq_ControllerSessionGroupsGet
@@ -46,8 +46,9 @@ export interface IControllerSessionFeedRow {
46
46
  updatedAt: number;
47
47
  open: TControllerSessionFeedOpen;
48
48
  /**
49
- * On a `needs_input` row AGL holds no question or permission for: the harness waits in its own client, which AGL
50
- * cannot answer, for `reason`. A `needs_input` row without it holds a request the owner answers in AGL.
49
+ * On a `needs_input` row AGL holds no question, permission or MCP elicitation for: the harness waits in its own
50
+ * client, which AGL cannot answer, for `reason`. A `needs_input` row without it holds a request the owner answers in
51
+ * AGL.
51
52
  */
52
53
  nativeWait?: IControllerNativeWait;
53
54
  /** On a `completed` row: its newest turn was interrupted. */
@@ -3,8 +3,6 @@ export * from './v10_flexharnessv3migration.js';
3
3
  export * from './v16_flexprovidercredentials.js';
4
4
  export * from './v18_resourcelayout.js';
5
5
  export * from './v18_resourcelayoutmigration.js';
6
- export * from './classes.flexpostharnessmigrationrunner.js';
7
- export * from './v19_flexprojectmanagement.js';
8
6
  export * from './v22_projectfilesystemidentitymigration.js';
9
7
  export * from './v23_runtimeconfig.js';
10
8
  export * from './v24_legacyterminallayout.js';
@@ -1,6 +1,6 @@
1
1
  import * as plugins from './plugins.js';
2
2
 
3
- /** The Flex migrations that run through FlexHarness once the harness is up, by name. */
3
+ /** The one migration AGL 43.0.4 recorded markers for: its per-session project-management walk. */
4
4
  export type TFlexPostHarnessMigrationId = 'v19_flexprojectmanagement';
5
5
 
6
6
  /** One post-harness migration that completed for one storage key (a Flex project). */
@@ -35,9 +35,11 @@ export const flexPostHarnessMigrationMarkerId = (
35
35
  .digest('hex')}`;
36
36
 
37
37
  /**
38
- * One record per post-harness migration and storage key, written once the migration walked every
39
- * session of that key: a key with a marker is never walked again, by any later Flex child. A walk
40
- * that failed or was aborted records nothing, so the next registration walks the key again.
38
+ * One record per storage key whose v19 project-management walk AGL 43.0.4 completed. Nothing
39
+ * reads or writes them since registration stopped walking sessions: each session's state is
40
+ * read, and a legacy scratchpad copied into it, when it is first loaded. The model stays
41
+ * registered and prepared, so the Flex store prepares what 43.0.4 prepared, and the documents
42
+ * stay where 43.0.4 reads them.
41
43
  */
42
44
  @plugins.nosqldb.managed({ collectionName: 'flex_post_harness_migrations' })
43
45
  @plugins.nosqldb.exactPersistence({ assertDocument: (input: unknown) => { markerSchema.parse(input); } })
@@ -62,48 +64,3 @@ export const registerFlexPostHarnessMigrationMarkerModel = (
62
64
  export const initFlexPostHarnessMigrationMarkerModel = async (): Promise<void> => {
63
65
  await FlexPostHarnessMigrationMarkerModel.exact.prepare();
64
66
  };
65
-
66
- /** Which post-harness migrations completed for a storage key; see `FlexPostHarnessMigrationRunner`. */
67
- export interface IFlexPostHarnessMigrationMarkers {
68
- completed(storageKeyArg: string, migrationArg: TFlexPostHarnessMigrationId): Promise<boolean>;
69
- /** Records the completion; recording one that is already recorded changes nothing. */
70
- record(storageKeyArg: string, migrationArg: TFlexPostHarnessMigrationId): Promise<void>;
71
- }
72
-
73
- /** The markers of one controller, in its Flex database's `flex_post_harness_migrations`. */
74
- export class FlexPostHarnessMigrationMarkers implements IFlexPostHarnessMigrationMarkers {
75
- constructor(private readonly controllerId: string) {}
76
-
77
- public async completed(
78
- storageKeyArg: string,
79
- migrationArg: TFlexPostHarnessMigrationId,
80
- ): Promise<boolean> {
81
- const id = flexPostHarnessMigrationMarkerId(this.controllerId, storageKeyArg, migrationArg);
82
- const stored = await FlexPostHarnessMigrationMarkerModel.exact.findStoredOne({ id });
83
- if (!stored) return false;
84
- const marker = FlexPostHarnessMigrationMarkerModel.exact.toPersisted(stored);
85
- if (
86
- marker.controllerId !== this.controllerId
87
- || marker.storageKey !== storageKeyArg
88
- || marker.migration !== migrationArg
89
- ) throw new Error('The Flex post-harness migration marker names another migration.');
90
- return true;
91
- }
92
-
93
- public async record(
94
- storageKeyArg: string,
95
- migrationArg: TFlexPostHarnessMigrationId,
96
- ): Promise<void> {
97
- const inserted = await FlexPostHarnessMigrationMarkerModel.exact.insert({
98
- id: flexPostHarnessMigrationMarkerId(this.controllerId, storageKeyArg, migrationArg),
99
- controllerId: this.controllerId,
100
- storageKey: storageKeyArg,
101
- migration: migrationArg,
102
- completedAt: new Date().toISOString(),
103
- });
104
- // A conflict is a marker with the same id recorded earlier, with its own completion time.
105
- if (inserted.status === 'conflict' && !await this.completed(storageKeyArg, migrationArg)) {
106
- throw new Error('The Flex post-harness migration marker could not be recorded.');
107
- }
108
- }
109
- }
@@ -3,6 +3,6 @@
3
3
  */
4
4
  export const commitinfo = {
5
5
  name: 'agl',
6
- version: '43.0.4',
6
+ version: '43.1.0',
7
7
  description: 'Agent Gateway Layer for OpenCode, FlexHarness, and Codex sessions'
8
8
  }
@@ -0,0 +1,106 @@
1
+ import * as plugins from './plugins.js';
2
+ import type * as interfaces from '../ts_interfaces/index.js';
3
+
4
+ type TElicitationCard = plugins.deesCatalog.IHarnessElicitationRequest;
5
+ type TElicitationRefusals = readonly plugins.deesCatalog.IHarnessElicitationRefusal[];
6
+
7
+ /** A pending request, the card the chat shows for it, and the controller's refusal that stands on it. */
8
+ interface IElicitationCardEntry {
9
+ request: interfaces.TControllerElicitation;
10
+ /** The request as the controller sent it, to tell a changed request from the same one read again. */
11
+ signature: string;
12
+ refusals?: TElicitationRefusals;
13
+ card: TElicitationCard;
14
+ }
15
+
16
+ /** An MCP elicitation as its card: the same union on `mode`, under the card id `idArg`. */
17
+ export const elicitationCard = (
18
+ idArg: string,
19
+ requestArg: interfaces.TControllerElicitation,
20
+ refusalsArg?: TElicitationRefusals,
21
+ ): TElicitationCard => {
22
+ const shared = {
23
+ id: idArg,
24
+ serverName: requestArg.serverName,
25
+ message: requestArg.message,
26
+ createdAt: requestArg.createdAt,
27
+ ...(refusalsArg ? { refusals: refusalsArg } : {}),
28
+ };
29
+ switch (requestArg.mode) {
30
+ case 'form': return { ...shared, mode: 'form', fields: requestArg.schema.fields };
31
+ case 'url': return { ...shared, mode: 'url', url: requestArg.url };
32
+ case 'unsupported': return { ...shared, mode: 'unsupported', reason: requestArg.reason };
33
+ }
34
+ };
35
+
36
+ /**
37
+ * The owner's answer from a card's `harness-elicitation-response` as the controller takes it; `undefined` for an
38
+ * action the card does not send. Only an accept carries content, and only the reply request carries the reply: the
39
+ * caller sends it and keeps nothing of it.
40
+ */
41
+ export const elicitationReply = (
42
+ detailArg: plugins.deesCatalog.IHarnessElicitationResponseDetail | undefined,
43
+ ): interfaces.TControllerElicitationReply | undefined => {
44
+ switch (detailArg?.action) {
45
+ case 'accept': return detailArg.content === undefined ? { action: 'accept' } : { action: 'accept', content: detailArg.content };
46
+ case 'decline': return { action: 'decline' };
47
+ case 'cancel': return { action: 'cancel' };
48
+ default: return undefined;
49
+ }
50
+ };
51
+
52
+ /**
53
+ * The MCP elicitation cards of the session on screen. A card keeps its object while its request and the refusal on it
54
+ * stay, and the list its array while every card does, so a render or another read of the session changes nothing the
55
+ * card compares. A refusal of the controller is a new array each time, even one that reads as the last (the controller
56
+ * refused a new answer the same way), and the same array while it stands: that is how the card tells a refused new
57
+ * answer, which it takes again, from a render. A request that leaves the list takes its refusal along. What the owner
58
+ * enters stays in the card; nothing here holds it.
59
+ */
60
+ export class ElicitationCards {
61
+ private entries = new Map<string, IElicitationCardEntry>();
62
+ private list: TElicitationCard[] = [];
63
+
64
+ /** `keyOfArg` names a card by its request id, unique among the requests of one session. */
65
+ constructor(private readonly keyOfArg: (idArg: interfaces.IControllerRuntimeId) => string) {}
66
+
67
+ /** The cards of the controller's pending requests, in their order: the same array while none of them changed. */
68
+ public cards(pendingArg: readonly interfaces.TControllerElicitation[]): TElicitationCard[] {
69
+ const entries = new Map<string, IElicitationCardEntry>();
70
+ for (const request of pendingArg) {
71
+ const key = this.keyOfArg(request.id);
72
+ const signature = JSON.stringify(request);
73
+ const previous = this.entries.get(key);
74
+ entries.set(key, previous?.signature === signature
75
+ ? previous
76
+ // Another request under the same id is another question: the refusal of the last one does not stand on it.
77
+ : { request, signature, card: elicitationCard(key, request) });
78
+ }
79
+ this.entries = entries;
80
+ const cards = [...entries.values()].map((entryArg) => entryArg.card);
81
+ if (cards.length !== this.list.length || cards.some((cardArg, indexArg) => cardArg !== this.list[indexArg])) this.list = cards;
82
+ return this.list;
83
+ }
84
+
85
+ /** The pending request a card answers, as the last `cards` read it. */
86
+ public request(cardIdArg: string): interfaces.TControllerElicitation | undefined {
87
+ return this.entries.get(cardIdArg)?.request;
88
+ }
89
+
90
+ /**
91
+ * The controller refused the answer to a card, or it could not be sent: the card shows why under a new refusal and
92
+ * takes an answer again. A card no longer pending has nothing to show it on.
93
+ */
94
+ public refuse(cardIdArg: string, reasonArg: string): void {
95
+ const entry = this.entries.get(cardIdArg);
96
+ if (!entry) return;
97
+ const refusals: TElicitationRefusals = [{ reason: reasonArg }];
98
+ this.entries.set(cardIdArg, { ...entry, refusals, card: elicitationCard(cardIdArg, entry.request, refusals) });
99
+ }
100
+
101
+ /** Forgets every card, for another session or connection. */
102
+ public clear(): void {
103
+ this.entries = new Map();
104
+ this.list = [];
105
+ }
106
+ }