agl 43.2.0 → 43.3.1
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 +29 -0
- package/dist_serve/bundle.js +2845 -2638
- package/dist_serve/bundle.js.map +2 -2
- package/dist_serve/bundle.js.third-party-notices.json +1 -1
- package/dist_serve/bundle.js.third-party-notices.txt +1 -1
- package/dist_ts/00_commitinfo_data.js +1 -1
- package/dist_ts/aglapi/aglapisurface.document.js +197 -17
- package/dist_ts/classes.accountsactions.d.ts +3 -1
- package/dist_ts/classes.accountsactions.js +21 -3
- package/dist_ts/classes.authstore.d.ts +7 -0
- package/dist_ts/classes.authstore.js +9 -1
- package/dist_ts/classes.claudeharness.d.ts +29 -2
- package/dist_ts/classes.claudeharness.js +35 -6
- package/dist_ts/classes.codexclientadapter.d.ts +11 -0
- package/dist_ts/classes.codexclientadapter.js +14 -2
- package/dist_ts/classes.controller.d.ts +187 -12
- package/dist_ts/classes.controller.js +1208 -186
- package/dist_ts/classes.controllerdevices.d.ts +2 -0
- package/dist_ts/classes.controllerdevices.js +6 -1
- package/dist_ts/classes.inbox.d.ts +72 -0
- package/dist_ts/classes.inbox.js +231 -0
- package/dist_ts/classes.inferencerouter.d.ts +10 -0
- package/dist_ts/classes.inferencerouter.js +5 -3
- package/dist_ts/classes.inferenceservice.js +2 -2
- package/dist_ts/classes.mcpclient.d.ts +1 -1
- package/dist_ts/classes.mcpclient.js +24 -6
- package/dist_ts/classes.mcpcontrollerhost.js +6 -1
- package/dist_ts/classes.mcptools.js +18 -8
- package/dist_ts/classes.mcpvalidation.d.ts +5 -0
- package/dist_ts/classes.mcpvalidation.js +32 -2
- package/dist_ts/classes.nativesessions.d.ts +29 -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.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.workercallers.js +4 -2
- package/dist_ts/driver/classes.directreports.d.ts +14 -4
- package/dist_ts/driver/classes.directreports.js +42 -23
- package/dist_ts/driver/classes.directreportstore.d.ts +8 -1
- package/dist_ts/driver/classes.directreportstore.js +20 -10
- 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 +21 -1
- package/dist_ts/fleet/classes.workers.js +80 -40
- package/dist_ts/fleet/classes.workerstore.js +14 -8
- package/dist_ts/fleet/functions.unbounddrivers.js +2 -2
- package/dist_ts/fleet/functions.workervalidation.js +11 -4
- package/dist_ts/fleet/interfaces.workers.d.ts +27 -5
- package/dist_ts/fleet/interfaces.workers.js +8 -4
- package/dist_ts/functions.agentmessage.d.ts +3 -0
- package/dist_ts/functions.agentmessage.js +4 -1
- package/dist_ts/functions.deviceapi.d.ts +198 -4
- package/dist_ts/functions.deviceapi.js +1060 -38
- package/dist_ts/functions.exactpersistence.d.ts +3 -0
- package/dist_ts/functions.exactpersistence.js +4 -0
- package/dist_ts/functions.fleetworkercli.d.ts +1 -1
- package/dist_ts/functions.fleetworkercli.js +11 -8
- package/dist_ts/functions.inferencecli.js +3 -1
- package/dist_ts/functions.mcpfleetworkertools.js +3 -3
- package/dist_ts/functions.ticketactor.d.ts +17 -1
- package/dist_ts/functions.ticketactor.js +55 -15
- package/dist_ts/functions.ticketvalidation.js +11 -2
- package/dist_ts/interfaces.auth.d.ts +1 -1
- package/dist_ts/interfaces.auth.js +9 -1
- package/dist_ts/plugins.d.ts +3 -1
- package/dist_ts/plugins.js +7 -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 +17 -10
- package/dist_ts_authswitch/authority-renewal.d.ts +34 -0
- package/dist_ts_authswitch/authority-renewal.js +56 -0
- 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 +1027 -7
- package/dist_ts_interfaces/devices.js +68 -2
- package/dist_ts_interfaces/fleetworkers.d.ts +37 -10
- package/dist_ts_interfaces/fleetworkers.js +19 -8
- package/dist_ts_interfaces/inbox.d.ts +234 -0
- package/dist_ts_interfaces/inbox.js +101 -0
- package/dist_ts_interfaces/index.d.ts +1 -0
- package/dist_ts_interfaces/index.js +2 -1
- package/dist_ts_interfaces/interfaces.d.ts +10 -3
- package/dist_ts_interfaces/interfaces.js +4 -2
- package/dist_ts_interfaces/mcprequests.d.ts +34 -4
- package/dist_ts_interfaces/mcprequests.js +11 -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/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/dist_ts_interfaces/workercallers.d.ts +2 -0
- package/dist_ts_migration/classes.documentmigrationrunner.d.ts +14 -0
- package/dist_ts_migration/classes.documentmigrationrunner.js +20 -1
- package/dist_ts_migration/index.d.ts +1 -0
- package/dist_ts_migration/index.js +2 -1
- package/dist_ts_migration/v43_ticketactornames.d.ts +32 -0
- package/dist_ts_migration/v43_ticketactornames.js +236 -0
- package/docs/authswitch.md +20 -1
- package/package.json +3 -3
- package/readme.md +144 -27
- package/ts/00_commitinfo_data.ts +1 -1
- package/ts/aglapi/aglapisurface.document.ts +196 -16
- package/ts/classes.accountsactions.ts +30 -3
- package/ts/classes.authstore.ts +10 -0
- package/ts/classes.claudeharness.ts +45 -5
- package/ts/classes.codexclientadapter.ts +14 -1
- package/ts/classes.controller.ts +1412 -262
- package/ts/classes.controllerdevices.ts +6 -0
- package/ts/classes.inbox.ts +239 -0
- package/ts/classes.inferencerouter.ts +15 -2
- package/ts/classes.inferenceservice.ts +1 -1
- package/ts/classes.mcpclient.ts +24 -3
- package/ts/classes.mcpcontrollerhost.ts +5 -0
- package/ts/classes.mcptools.ts +17 -7
- package/ts/classes.mcpvalidation.ts +27 -1
- package/ts/classes.nativesessions.ts +63 -12
- package/ts/classes.opencodeclient.ts +55 -4
- 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.workercallers.ts +3 -1
- package/ts/driver/classes.directreports.ts +42 -23
- package/ts/driver/classes.directreportstore.ts +20 -9
- 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 +75 -41
- package/ts/fleet/classes.workerstore.ts +11 -7
- package/ts/fleet/functions.unbounddrivers.ts +1 -1
- package/ts/fleet/functions.workervalidation.ts +8 -3
- package/ts/fleet/interfaces.workers.ts +26 -7
- package/ts/functions.agentmessage.ts +3 -0
- package/ts/functions.deviceapi.ts +1292 -34
- package/ts/functions.exactpersistence.ts +5 -0
- package/ts/functions.fleetworkercli.ts +10 -7
- package/ts/functions.inferencecli.ts +2 -0
- package/ts/functions.mcpfleetworkertools.ts +2 -2
- package/ts/functions.ticketactor.ts +58 -14
- package/ts/functions.ticketvalidation.ts +11 -1
- package/ts/interfaces.auth.ts +8 -0
- package/ts/plugins.ts +7 -0
- package/ts_authswitch/authority-contract.ts +20 -0
- package/ts_authswitch/authority-overview.ts +28 -6
- package/ts_authswitch/authority-placement.ts +25 -17
- package/ts_authswitch/authority-renewal.ts +64 -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 +3576 -603
- package/ts_interfaces/devices.ts +1111 -6
- package/ts_interfaces/fleetworkers.ts +38 -10
- package/ts_interfaces/inbox.ts +287 -0
- package/ts_interfaces/index.ts +1 -0
- package/ts_interfaces/interfaces.ts +9 -2
- package/ts_interfaces/mcprequests.ts +43 -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/requests.accounts.ts +20 -0
- package/ts_interfaces/requests.ts +4 -0
- package/ts_interfaces/workercallers.ts +2 -0
- package/ts_migration/classes.documentmigrationrunner.ts +21 -0
- package/ts_migration/index.ts +1 -0
- package/ts_migration/v43_ticketactornames.ts +225 -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 +10 -5
- package/ts_web/classes.inboxfeed.ts +329 -0
- package/ts_web/classes.nativesessionstate.ts +9 -23
- package/ts_web/elements.accounts.ts +81 -0
- package/ts_web/elements.deployments.ts +66 -2
- package/ts_web/elements.fleetworker.ts +4 -2
- package/ts_web/elements.harnesscontrollerapp.ts +107 -37
- 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
|
@@ -264,14 +264,23 @@ export interface IFleetWorkerSummaryPage {
|
|
|
264
264
|
nextCursor?: string;
|
|
265
265
|
}
|
|
266
266
|
/**
|
|
267
|
-
* The refusals
|
|
268
|
-
* holds no such job of the owner (jobs are
|
|
269
|
-
*
|
|
270
|
-
*
|
|
271
|
-
*
|
|
272
|
-
* refused by request validation
|
|
267
|
+
* The fleet's own refusals, whose text AGL writes, passed to the caller with their message, thrown or as a failed job's
|
|
268
|
+
* `errorCode`. Of the worker reads: `job_unavailable`, the controller holds no such job of the owner (jobs are
|
|
269
|
+
* transient: a controller restart or eviction drops them; read the worker with `fleet_worker_get`); `worker_not_found`,
|
|
270
|
+
* the owner has no worker of that name or id; `list_cursor_mismatch`, the cursor belongs to another filter;
|
|
271
|
+
* `list_cursor_stale`, the worker the cursor continues after is no longer held as it was; `list_cursor_invalid`, the
|
|
272
|
+
* cursor is not one a summary list returned (a `limit` or `cursor` with the full view is refused by request validation
|
|
273
|
+
* instead). Of the jobs, the relaunch and the dispatch fences, by what the caller does next: `fleet_unavailable`, the
|
|
274
|
+
* fleet admits no job now (it is closing, holds its most jobs, or cannot prove its own process); try again later;
|
|
275
|
+
* `worker_fenced`, the worker's dispatch fence stands in the way (an unresolved or running dispatch, one resolved as
|
|
276
|
+
* lost, a reconfirmation without its ticket comment, a fence or record another job changed, no native session yet);
|
|
277
|
+
* inspect the worker before acting again; `worker_archived`, the worker is archived; `ticket_mismatch`, the worker is
|
|
278
|
+
* bound to another ticket; `worker_conflict`, the request does not fit what the fleet holds (the name is taken, the
|
|
279
|
+
* session is bound already, the harness has no relaunch or native sessions, the profile is not configured, the
|
|
280
|
+
* directory is none, the session cannot be adopted as that identity); change the request.
|
|
273
281
|
*/
|
|
274
|
-
export const fleetWorkerErrorCodes = ['job_unavailable', 'worker_not_found', 'list_cursor_mismatch', 'list_cursor_stale', 'list_cursor_invalid'
|
|
282
|
+
export const fleetWorkerErrorCodes = ['job_unavailable', 'worker_not_found', 'list_cursor_mismatch', 'list_cursor_stale', 'list_cursor_invalid',
|
|
283
|
+
'fleet_unavailable', 'worker_fenced', 'worker_archived', 'ticket_mismatch', 'worker_conflict'] as const;
|
|
275
284
|
export type TFleetWorkerErrorCode = (typeof fleetWorkerErrorCodes)[number];
|
|
276
285
|
export type TFleetWorkerRequest<T extends TFleetWorkerAction> = IFleetWorkerRequests[T];
|
|
277
286
|
export interface IFleetWorkerJob {
|
|
@@ -284,14 +293,33 @@ export interface IFleetWorkerJob {
|
|
|
284
293
|
ticketSync?: IFleetTicketSync;
|
|
285
294
|
/** What a `native-message` job delivered. */
|
|
286
295
|
nativeMessage?: IFleetNativeMessageReceipt;
|
|
296
|
+
/** Why the job failed, as its error said: the fleet's own refusal, or a dependency's text (a harness's output). */
|
|
287
297
|
error?: string;
|
|
298
|
+
/**
|
|
299
|
+
* Set on a failed job exactly when the fleet refused it itself (`fleetWorkerErrorCodes`): then `error` is AGL's own
|
|
300
|
+
* text, which the Driver view and a device show. Without it, `error` may be a dependency's output.
|
|
301
|
+
*/
|
|
302
|
+
errorCode?: TFleetWorkerErrorCode;
|
|
303
|
+
/**
|
|
304
|
+
* Set on a failed job: whether what it dispatched may have reached a native session, in the words of a failed native
|
|
305
|
+
* send (`native_session_failed`'s `outcome`). `refused`: the job failed before anything reached a native session,
|
|
306
|
+
* proved by a refusal before its first dispatch or by a dispatch that sent nothing: nothing was sent. `unknown`: it
|
|
307
|
+
* may have (a steer may have been delivered), which is every failure without that proof; read the worker before acting
|
|
308
|
+
* again and never send it again on your own. A failed job without it, from an older controller, is `unknown`.
|
|
309
|
+
*/
|
|
310
|
+
errorOutcome?: TFleetWorkerErrorOutcome;
|
|
288
311
|
}
|
|
312
|
+
/** How far a failed fleet worker job got (`IFleetWorkerJob.errorOutcome`). */
|
|
313
|
+
export const fleetWorkerErrorOutcomes = ['refused', 'unknown'] as const;
|
|
314
|
+
export type TFleetWorkerErrorOutcome = (typeof fleetWorkerErrorOutcomes)[number];
|
|
289
315
|
/**
|
|
290
|
-
* A
|
|
291
|
-
*
|
|
316
|
+
* A message to a Claude Code background job no fleet worker binds: a native wake of a settled job (`native-wake`) or a
|
|
317
|
+
* message into a running job's inbox through Claude Code's own SendMessage (`native-inbox`, accepted and queued, not
|
|
318
|
+
* read). It holds no dispatch fence, writes no ticket comment and does not observe the turn; `adopt` is the command that
|
|
319
|
+
* makes the job a fleet worker.
|
|
292
320
|
*/
|
|
293
321
|
export interface IFleetNativeMessageReceipt {
|
|
294
|
-
delivery: 'native-wake';
|
|
322
|
+
delivery: 'native-wake' | 'native-inbox';
|
|
295
323
|
/** The job's full session id. */
|
|
296
324
|
nativeId: string;
|
|
297
325
|
/** Claude Code's short job id. */
|
|
@@ -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
|
@@ -32,6 +32,7 @@ export * from './workercallers.js';
|
|
|
32
32
|
export * from './driver.js';
|
|
33
33
|
export * from './requests.driver.js';
|
|
34
34
|
export * from './sessionfeed.js';
|
|
35
|
+
export * from './inbox.js';
|
|
35
36
|
export * from './nativesessions.js';
|
|
36
37
|
export * from './metrics.js';
|
|
37
38
|
export * from './proxycapacity.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. */
|
|
@@ -17,7 +17,9 @@ import type {
|
|
|
17
17
|
TConfigurationNativeTargetId,
|
|
18
18
|
TConfigurationTargetId,
|
|
19
19
|
} from './configuration.js';
|
|
20
|
+
import type { IControllerNativeSession, TControllerNativeJobDelivery } from './nativesessions.js';
|
|
20
21
|
import type {
|
|
22
|
+
IControllerMessagePage,
|
|
21
23
|
IControllerProject,
|
|
22
24
|
IControllerSession,
|
|
23
25
|
IControllerSessionDetail,
|
|
@@ -326,9 +328,16 @@ export interface IReq_ControllerMcpProjectsList extends plugins.typedrequestInte
|
|
|
326
328
|
response: { projects: IControllerProject[] };
|
|
327
329
|
}
|
|
328
330
|
|
|
331
|
+
/** The most settled Claude Code sessions `agl.mcp.sessions.list` lists in `nativeSessions`; running ones are all listed. */
|
|
332
|
+
export const controllerMcpNativeSessionSettledLimit = 50;
|
|
333
|
+
|
|
329
334
|
/**
|
|
330
|
-
* Discovers a project's OpenCode, Flex and Codex tasks from its folder and
|
|
331
|
-
* tasks created outside AGL included
|
|
335
|
+
* Discovers a project's OpenCode, Flex and Codex tasks and AGL's own Claude Code conversations from its folder and
|
|
336
|
+
* configured connections, tasks created outside AGL included (`sessions`), and, apart from them, the Claude Code
|
|
337
|
+
* sessions of the host's own Claude Code home whose directory is the project folder itself (`nativeSessions`): running
|
|
338
|
+
* ones first, all of them, then at most `controllerMcpNativeSessionSettledLimit` settled ones, newest first
|
|
339
|
+
* (`nativeSessionsTruncated` when more may exist). `nativeSessionsError` names why the Claude Code inventory could not
|
|
340
|
+
* be read; `nativeSessions` is then empty.
|
|
332
341
|
*/
|
|
333
342
|
export interface IReq_ControllerMcpSessionsList extends plugins.typedrequestInterfaces.implementsTR<
|
|
334
343
|
plugins.typedrequestInterfaces.ITypedRequest,
|
|
@@ -336,9 +345,34 @@ export interface IReq_ControllerMcpSessionsList extends plugins.typedrequestInte
|
|
|
336
345
|
> {
|
|
337
346
|
method: 'agl.mcp.sessions.list';
|
|
338
347
|
request: { projectId: string };
|
|
339
|
-
response: {
|
|
348
|
+
response: {
|
|
349
|
+
sessions: IControllerSession[];
|
|
350
|
+
nativeSessions: IControllerNativeSession[];
|
|
351
|
+
nativeSessionsTruncated?: true;
|
|
352
|
+
nativeSessionsError?: string;
|
|
353
|
+
};
|
|
354
|
+
}
|
|
355
|
+
|
|
356
|
+
/**
|
|
357
|
+
* A Claude Code session outside AGL as `agl.mcp.session.read` answers it: the session with why it takes no message
|
|
358
|
+
* (`readOnly`) or how it takes one (`jobDelivery`), its newest transcript page and its scratchpad.
|
|
359
|
+
*/
|
|
360
|
+
export interface IControllerMcpNativeSessionDetail {
|
|
361
|
+
kind: 'native';
|
|
362
|
+
session: IControllerNativeSession;
|
|
363
|
+
messagePage: IControllerMessagePage;
|
|
364
|
+
scratchpad: IControllerSessionScratchpad;
|
|
340
365
|
}
|
|
341
366
|
|
|
367
|
+
/**
|
|
368
|
+
* How an agent message to a Claude Code background job was delivered, in `session_message`'s delivery terms: a wake
|
|
369
|
+
* starts the job's next turn, an inbox message waits in its queue until the job reads it.
|
|
370
|
+
*/
|
|
371
|
+
export const controllerMcpNativeDeliveries: Readonly<Record<TControllerNativeJobDelivery, TControllerPromptDelivery>> = {
|
|
372
|
+
wake: 'next-turn',
|
|
373
|
+
inbox: 'queue',
|
|
374
|
+
};
|
|
375
|
+
|
|
342
376
|
/**
|
|
343
377
|
* Reads the bounded current detail of one task: its newest messages, pending prompts, permissions,
|
|
344
378
|
* questions, todos, scratchpad, model and, for Codex, the running turn. Read it again to follow the
|
|
@@ -353,7 +387,7 @@ export interface IReq_ControllerMcpSessionRead extends plugins.typedrequestInter
|
|
|
353
387
|
projectId: string;
|
|
354
388
|
sessionId: IControllerRuntimeId;
|
|
355
389
|
};
|
|
356
|
-
response: TControllerMcpSessionDetail;
|
|
390
|
+
response: TControllerMcpSessionDetail | IControllerMcpNativeSessionDetail;
|
|
357
391
|
}
|
|
358
392
|
|
|
359
393
|
export interface IReq_ControllerMcpSessionSend extends plugins.typedrequestInterfaces.implementsTR<
|
|
@@ -410,6 +444,11 @@ export interface IReq_ControllerMcpSessionMessage extends plugins.typedrequestIn
|
|
|
410
444
|
delivery: TControllerPromptDelivery;
|
|
411
445
|
/** The Codex or Claude Code turn a steer went into. */
|
|
412
446
|
turnId?: string;
|
|
447
|
+
/**
|
|
448
|
+
* For a Claude Code background job outside AGL: how it took the message; `delivery` is then
|
|
449
|
+
* `controllerMcpNativeDeliveries[native]`.
|
|
450
|
+
*/
|
|
451
|
+
native?: TControllerNativeJobDelivery;
|
|
413
452
|
};
|
|
414
453
|
}
|
|
415
454
|
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import * as plugins from './plugins.js';
|
|
2
2
|
import type * as requests from './requests.js';
|
|
3
|
+
import type { IControllerNativeSession } from './nativesessions.js';
|
|
3
4
|
import type {
|
|
4
5
|
IControllerProject, IControllerSession, TControllerResourceKind, TControllerSessionId, TControllerTerminalAgentKind,
|
|
5
6
|
} from './interfaces.js';
|
|
@@ -240,14 +241,15 @@ export interface IReq_ControllerMcpWorkspaceReveal extends plugins.typedrequestI
|
|
|
240
241
|
|
|
241
242
|
/**
|
|
242
243
|
* Resolves an absolute project directory and, optionally, one of its existing native tasks to AGL's
|
|
243
|
-
* project and qualified session. It does not take over a running task.
|
|
244
|
+
* project and qualified session. It does not take over a running task. A Claude Code session outside
|
|
245
|
+
* AGL (`sessions_list`'s `nativeSessions`) answers as `nativeSession` and is recorded nowhere.
|
|
244
246
|
*/
|
|
245
247
|
export interface IReq_ControllerMcpContextResolve extends plugins.typedrequestInterfaces.implementsTR<
|
|
246
248
|
plugins.typedrequestInterfaces.ITypedRequest, IReq_ControllerMcpContextResolve
|
|
247
249
|
> {
|
|
248
250
|
method: 'agl.mcp.context.resolve';
|
|
249
251
|
request: { directory: string; sessionId?: TControllerSessionId };
|
|
250
|
-
response: { project: IControllerProject; session?: IControllerSession };
|
|
252
|
+
response: { project: IControllerProject; session?: IControllerSession; nativeSession?: IControllerNativeSession };
|
|
251
253
|
}
|
|
252
254
|
|
|
253
255
|
export const controllerMcpWorkspaceMethods = [
|
|
@@ -26,9 +26,20 @@ export interface IControllerNativeSessionRef {
|
|
|
26
26
|
profileId?: string;
|
|
27
27
|
}
|
|
28
28
|
|
|
29
|
+
/**
|
|
30
|
+
* How a message reaches a Claude Code background job (`claude --bg`) that AGL does not run: `wake` continues a settled
|
|
31
|
+
* (done, blocked or stopped) job through Claude Code's own `claude --bg --resume`, `inbox` puts it into a running job's
|
|
32
|
+
* inbox through Claude Code's own SendMessage, accepted and queued there, not yet read.
|
|
33
|
+
*/
|
|
34
|
+
export type TControllerNativeJobDelivery = 'wake' | 'inbox';
|
|
35
|
+
|
|
29
36
|
/**
|
|
30
37
|
* Why AGL does not write to a native session:
|
|
31
38
|
* `running`: another process runs it, and AGL never becomes its second writer;
|
|
39
|
+
* `unaddressable`: a running background job takes a message only by a session name no other running session shares, and
|
|
40
|
+
* it has none or shares it;
|
|
41
|
+
* `notBackgroundJob`: an agent reaches only a background job (MCP `session_message`); the owner's own native session view
|
|
42
|
+
* resumes another settled session;
|
|
32
43
|
* `profileHome`: it lives in a fleet profile's Claude Code home, which AGL's own Claude Code does not resume;
|
|
33
44
|
* `directoryMissing`: its directory is gone, so nothing resumes it;
|
|
34
45
|
* `projectConversation`: an AGL project conversation records it, and that project sends to it;
|
|
@@ -37,7 +48,7 @@ export interface IControllerNativeSessionRef {
|
|
|
37
48
|
* `jobHeld`: AGL's own Claude Code still holds a background job's conversation, so Claude Code would wake a copy.
|
|
38
49
|
*/
|
|
39
50
|
export type TControllerNativeSessionReadOnlyReason =
|
|
40
|
-
'running' | 'profileHome' | 'directoryMissing' | 'projectConversation' | 'fleetWorker' | 'jobFailed' | 'jobHeld';
|
|
51
|
+
'running' | 'unaddressable' | 'notBackgroundJob' | 'profileHome' | 'directoryMissing' | 'projectConversation' | 'fleetWorker' | 'jobFailed' | 'jobHeld';
|
|
41
52
|
|
|
42
53
|
export interface IControllerNativeSession extends IControllerNativeSessionRef {
|
|
43
54
|
cwd: string;
|
|
@@ -51,6 +62,8 @@ export interface IControllerNativeSession extends IControllerNativeSessionRef {
|
|
|
51
62
|
effort?: string;
|
|
52
63
|
/** Present while AGL does not write to the session; `message` is the reason the owner sees. */
|
|
53
64
|
readOnly?: { reason: TControllerNativeSessionReadOnlyReason; message: string };
|
|
65
|
+
/** How a message reaches the session, present exactly while it is a Claude Code background job that takes one. */
|
|
66
|
+
jobDelivery?: TControllerNativeJobDelivery;
|
|
54
67
|
}
|
|
55
68
|
|
|
56
69
|
/** A native session, its newest transcript page and its session state. */
|
|
@@ -90,8 +103,9 @@ export interface IReq_ControllerNativeSessionAuxiliaryGet extends plugins.typedr
|
|
|
90
103
|
|
|
91
104
|
/**
|
|
92
105
|
* Sends the owner's message to a native session that AGL may write to: a settled Claude Code session of the host's
|
|
93
|
-
* own home, resumed in its own directory, or a Codex thread through the
|
|
94
|
-
*
|
|
106
|
+
* own home, resumed in its own directory, a Claude Code background job (`jobDelivery`), or a Codex thread through the
|
|
107
|
+
* shared app-server that owns it. A job's inbox takes the text as the owner's agent message. Attachments follow the
|
|
108
|
+
* conversation send's contract and limits.
|
|
95
109
|
*/
|
|
96
110
|
export interface IReq_ControllerNativeSessionSend extends plugins.typedrequestInterfaces.implementsTR<
|
|
97
111
|
plugins.typedrequestInterfaces.ITypedRequest,
|
package/ts_interfaces/plugins.ts
CHANGED
|
@@ -8,6 +8,8 @@ import type * as browserRuntime from '@push.rocks/smartbrowser/runtime';
|
|
|
8
8
|
import * as authswitchAuthority from '../ts_authswitch/authority-contract.js';
|
|
9
9
|
// An API key's monthly spend: the spend limit rule and dollar amounts, a leaf that imports nothing.
|
|
10
10
|
import * as authswitchSpend from '../ts_authswitch/authority-spend.js';
|
|
11
|
+
// A Claude sign-in's monthly renewal: the anchor rule and the next renewal, a leaf that imports nothing.
|
|
12
|
+
import * as authswitchRenewal from '../ts_authswitch/authority-renewal.js';
|
|
11
13
|
import type {
|
|
12
14
|
AuthenticationResponseJSON,
|
|
13
15
|
PublicKeyCredentialCreationOptionsJSON,
|
|
@@ -17,7 +19,7 @@ import type {
|
|
|
17
19
|
|
|
18
20
|
export { typedrequestInterfaces };
|
|
19
21
|
export type { browserRuntime };
|
|
20
|
-
export { authswitchAuthority, authswitchSpend };
|
|
22
|
+
export { authswitchAuthority, authswitchRenewal, authswitchSpend };
|
|
21
23
|
|
|
22
24
|
export type {
|
|
23
25
|
AuthenticationResponseJSON,
|
|
@@ -201,6 +201,9 @@ export const isControllerSpendLimitMicroUsd = plugins.authswitchSpend.isAuthSwit
|
|
|
201
201
|
/** The range of a spend limit, in micro-dollars. */
|
|
202
202
|
export const controllerSpendLimitRange = plugins.authswitchSpend.authSwitchSpendLimitRange;
|
|
203
203
|
|
|
204
|
+
/** The renewal anchor rule of the accounts service (`IReq_ControllerAccountsRenewal`); a past date and time is valid. */
|
|
205
|
+
export const isControllerRenewsAt = plugins.authswitchRenewal.isAuthSwitchRenewsAt;
|
|
206
|
+
|
|
204
207
|
/** The longest API key the accounts service holds, in characters; a longer value is refused before it is sent. */
|
|
205
208
|
export const controllerApiKeyMaxLength = 512;
|
|
206
209
|
|
|
@@ -251,6 +254,23 @@ export interface IReq_ControllerAccountsClaudeCode extends plugins.typedrequestI
|
|
|
251
254
|
response: { answer: TControllerAccountsAnswer<TControllerAccount> };
|
|
252
255
|
}
|
|
253
256
|
|
|
257
|
+
/**
|
|
258
|
+
* Sets the anchor of a Claude sign-in's monthly renewal (AGL-1644), or clears it with `null`: any date and time the
|
|
259
|
+
* subscription renewed or renews, a past one too, by the accounts service's rule (`isControllerRenewsAt`). AGL's
|
|
260
|
+
* inference proxy then spends first the usage a window would still hold at the next renewal. `expectedRevision` is
|
|
261
|
+
* the revision the view showed, so a change of an account that changed meanwhile is refused as `account_changed`, and a
|
|
262
|
+
* value that breaks the rule, or an account other than a Claude sign-in, as `invalid_input`, both by the service. The
|
|
263
|
+
* answer arrives only once the projection shows the result.
|
|
264
|
+
*/
|
|
265
|
+
export interface IReq_ControllerAccountsRenewal extends plugins.typedrequestInterfaces.implementsTR<
|
|
266
|
+
plugins.typedrequestInterfaces.ITypedRequest,
|
|
267
|
+
IReq_ControllerAccountsRenewal
|
|
268
|
+
> {
|
|
269
|
+
method: 'controller.accounts.renewal';
|
|
270
|
+
request: { accountId: string; expectedRevision: number; renewsAt: string | null };
|
|
271
|
+
response: { answer: TControllerAccountsAnswer<TControllerAccount> };
|
|
272
|
+
}
|
|
273
|
+
|
|
254
274
|
/** Duration validation shared with the authority; no implicit duration is supplied. */
|
|
255
275
|
export const isControllerReserveLiftHours = plugins.authswitchAuthority.isAuthSwitchReserveLiftHours;
|
|
256
276
|
|
|
@@ -32,6 +32,7 @@ import type {
|
|
|
32
32
|
IReq_ControllerAccountsApiKeyAdd,
|
|
33
33
|
IReq_ControllerAccountsSpendLimit,
|
|
34
34
|
IReq_ControllerAccountsClaudeCode,
|
|
35
|
+
IReq_ControllerAccountsRenewal,
|
|
35
36
|
IReq_ControllerAccountsSnapshot,
|
|
36
37
|
IReq_ControllerAccountsUsageGet,
|
|
37
38
|
IReq_ControllerAccountsUsageRecheck,
|
|
@@ -59,6 +60,7 @@ import type {
|
|
|
59
60
|
} from './requests.fleetworkers.js';
|
|
60
61
|
import type { IReq_ControllerDirectReportAdopt, IReq_ControllerDirectReportAppoint, IReq_ControllerDirectReportPreflight, IReq_ControllerDirectReportList, IReq_ControllerDirectReportMessage, IReq_ControllerDirectReportRead } from './requests.directreports.js';
|
|
61
62
|
import type { IReq_ControllerSessionFeedAcknowledge, IReq_ControllerSessionFeedList } from './sessionfeed.js';
|
|
63
|
+
import type { IReq_ControllerInboxList } from './inbox.js';
|
|
62
64
|
import type { TControllerDeployTypedRequest } from './deployments.js';
|
|
63
65
|
import type {
|
|
64
66
|
IReq_ControllerNativeSessionAuxiliaryGet,
|
|
@@ -410,6 +412,7 @@ export type TControllerRequest =
|
|
|
410
412
|
| IReq_ControllerAccountsApiKeyAdd
|
|
411
413
|
| IReq_ControllerAccountsSpendLimit
|
|
412
414
|
| IReq_ControllerAccountsClaudeCode
|
|
415
|
+
| IReq_ControllerAccountsRenewal
|
|
413
416
|
| IReq_ControllerAccountsRemove
|
|
414
417
|
| IReq_ControllerAccountsAdd
|
|
415
418
|
| IReq_ControllerAccountsReauth
|
|
@@ -435,6 +438,7 @@ export type TControllerRequest =
|
|
|
435
438
|
| IReq_ControllerDevicesPairingBegin
|
|
436
439
|
| IReq_ControllerDevicesPairingCancel
|
|
437
440
|
| IReq_ControllerDevicesRevoke
|
|
441
|
+
| IReq_ControllerInboxList
|
|
438
442
|
| import('./requests.tickets.js').TControllerTicketTypedRequest
|
|
439
443
|
| IReq_ControllerEvent
|
|
440
444
|
| IReq_ControllerSessionChildEvent;
|