agl 43.3.1 → 43.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/changelog.md +22 -0
- package/dist_serve/bundle.js +1377 -1375
- package/dist_serve/bundle.js.map +2 -2
- package/dist_ts/00_commitinfo_data.js +1 -1
- package/dist_ts/aglapi/interfaces.d.ts +5 -0
- package/dist_ts/aglapi/interfaces.js +2 -1
- package/dist_ts/classes.authstore.js +5 -2
- package/dist_ts/classes.claudeharness.js +4 -3
- package/dist_ts/classes.codexclientadapter.d.ts +5 -0
- package/dist_ts/classes.codexclientadapter.js +12 -6
- package/dist_ts/classes.controller.d.ts +33 -9
- package/dist_ts/classes.controller.js +173 -113
- package/dist_ts/classes.flexservice.d.ts +12 -1
- package/dist_ts/classes.flexservice.js +44 -13
- package/dist_ts/classes.flexstore.d.ts +20 -0
- package/dist_ts/classes.flexstore.js +30 -1
- package/dist_ts/classes.mcpclient.d.ts +2 -2
- package/dist_ts/classes.mcpclient.js +14 -9
- package/dist_ts/classes.mcptools.d.ts +1 -1
- package/dist_ts/classes.mcptools.js +2 -1
- package/dist_ts/classes.opencodeclient.js +20 -4
- package/dist_ts/driver/functions.driverinstructions.d.ts +1 -1
- package/dist_ts/driver/functions.driverinstructions.js +2 -1
- package/dist_ts/fleet/classes.deploymodels.d.ts +58 -1
- package/dist_ts/fleet/classes.deploymodels.js +121 -2
- package/dist_ts/fleet/classes.deploymonitor.d.ts +193 -47
- package/dist_ts/fleet/classes.deploymonitor.js +548 -180
- package/dist_ts/fleet/classes.gitfacts.d.ts +4 -1
- package/dist_ts/fleet/classes.gitfacts.js +13 -10
- package/dist_ts/fleet/classes.service.d.ts +2 -0
- package/dist_ts/fleet/classes.service.js +6 -3
- package/dist_ts/fleet/functions.deployprobes.js +21 -2
- package/dist_ts/fleet/functions.deploystatus.d.ts +26 -0
- package/dist_ts/fleet/functions.deploystatus.js +33 -0
- package/dist_ts/fleet/functions.deployvalidation.d.ts +1 -0
- package/dist_ts/fleet/functions.deployvalidation.js +5 -2
- package/dist_ts/functions.deploycli.js +3 -2
- package/dist_ts/functions.deviceapi.d.ts +7 -6
- package/dist_ts/functions.deviceapi.js +13 -5
- package/dist_ts/functions.mcpdeploytools.js +3 -1
- package/dist_ts/functions.promptreply.d.ts +13 -0
- package/dist_ts/functions.promptreply.js +17 -0
- package/dist_ts/interfaces.flexipc.d.ts +17 -9
- package/dist_ts/interfaces.flexipc.js +19 -20
- package/dist_ts_interfaces/deployments.d.ts +38 -6
- package/dist_ts_interfaces/deployments.js +7 -3
- package/dist_ts_interfaces/devices.d.ts +2 -1
- package/dist_ts_interfaces/devices.js +1 -1
- package/dist_ts_interfaces/inbox.d.ts +10 -1
- package/dist_ts_interfaces/inbox.js +1 -1
- package/dist_ts_interfaces/mcprequests.d.ts +1 -1
- package/package.json +5 -5
- package/readme.md +30 -12
- package/ts/00_commitinfo_data.ts +1 -1
- package/ts/aglapi/interfaces.ts +1 -0
- package/ts/classes.authstore.ts +4 -1
- package/ts/classes.claudeharness.ts +3 -2
- package/ts/classes.codexclientadapter.ts +11 -5
- package/ts/classes.controller.ts +188 -128
- package/ts/classes.flexservice.ts +57 -14
- package/ts/classes.flexstore.ts +40 -0
- package/ts/classes.mcpclient.ts +14 -5
- package/ts/classes.mcptools.ts +1 -0
- package/ts/classes.opencodeclient.ts +23 -3
- package/ts/driver/functions.driverinstructions.ts +1 -0
- package/ts/fleet/classes.deploymodels.ts +113 -1
- package/ts/fleet/classes.deploymonitor.ts +565 -179
- package/ts/fleet/classes.gitfacts.ts +10 -8
- package/ts/fleet/classes.service.ts +7 -1
- package/ts/fleet/functions.deployprobes.ts +16 -1
- package/ts/fleet/functions.deploystatus.ts +56 -0
- package/ts/fleet/functions.deployvalidation.ts +4 -1
- package/ts/functions.deploycli.ts +2 -1
- package/ts/functions.deviceapi.ts +19 -9
- package/ts/functions.mcpdeploytools.ts +2 -0
- package/ts/functions.promptreply.ts +20 -0
- package/ts/interfaces.flexipc.ts +43 -27
- package/ts_interfaces/deployments.ts +39 -6
- package/ts_interfaces/devices.schema.json +1 -1
- package/ts_interfaces/devices.ts +2 -1
- package/ts_interfaces/inbox.ts +8 -1
- package/ts_web/00_commitinfo_data.ts +1 -1
- package/ts_web/elements.deployments.ts +20 -4
- package/ts_web/elements.harnesscontrollerapp.ts +43 -13
- package/ts_web/elements.inbox.ts +3 -3
|
@@ -53,19 +53,21 @@ export class FleetGitFacts {
|
|
|
53
53
|
return result.code === 0 ? undefined : (result.stderr.trim() || `git fetch exited with ${result.code}`).slice(0, 512);
|
|
54
54
|
}
|
|
55
55
|
|
|
56
|
-
/**
|
|
56
|
+
/**
|
|
57
|
+
* Remote main and the remote's release tags as the last fetch mirrored them. Remote main is absent before the first
|
|
58
|
+
* fetch; tags that cannot be listed throw, since no release is not the same as releases that could not be read.
|
|
59
|
+
*/
|
|
57
60
|
public async remote(repoArg: IFleetRepository): Promise<IFleetRemoteState> {
|
|
58
61
|
const main = await this.git('git', ['rev-parse', '--verify', '--quiet', `${fleetRemoteMainRef}^{commit}`], repoArg.path);
|
|
59
62
|
const tags = await this.git('git', ['for-each-ref', '--format=%(refname:lstrip=3)%09%(objectname)%09%(*objectname)%09%(creatordate:iso-strict)',
|
|
60
63
|
`${fleetRemoteTagRefs}/v*`], repoArg.path);
|
|
64
|
+
if (tags.code !== 0) throw new Error((tags.stderr.trim() || `git for-each-ref exited with ${tags.code}`).slice(0, 512));
|
|
61
65
|
const releases: IFleetDeployRelease[] = [];
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
releases.push({ version, sha: peeled || object, ...(taggedAt ? { taggedAt: new Date(taggedAt).toISOString() } : {}) });
|
|
68
|
-
}
|
|
66
|
+
for (const line of tags.stdout.split('\n')) {
|
|
67
|
+
const [name = '', object = '', peeled = '', taggedAt = ''] = line.split('\t');
|
|
68
|
+
const version = fleetVersion(name);
|
|
69
|
+
if (!version || !name.startsWith('v')) continue;
|
|
70
|
+
releases.push({ version, sha: peeled || object, ...(taggedAt ? { taggedAt: new Date(taggedAt).toISOString() } : {}) });
|
|
69
71
|
}
|
|
70
72
|
const sha = main.code === 0 ? main.stdout.trim() : '';
|
|
71
73
|
return { ...(fullSha.test(sha) ? { main: sha } : {}), releases: releases.sort((leftArg, rightArg) => compareFleetVersions(rightArg.version, leftArg.version)) };
|
|
@@ -22,6 +22,8 @@ export interface IFleetServiceOptions {
|
|
|
22
22
|
tickets?: (signal: AbortSignal) => Promise<ITicket[]>;
|
|
23
23
|
/** A release went out: the release reconciler links and releases the landed tickets its tag holds, now rather than at its next pass. */
|
|
24
24
|
released?: (repo: IFleetRepository) => void;
|
|
25
|
+
/** A landing pushed remote main: the deploy status says what the next release ships from it now rather than at its next pass. */
|
|
26
|
+
landed?: (repo: IFleetRepository) => void;
|
|
25
27
|
}
|
|
26
28
|
interface IFleetOwnedOperation { owner: string; snapshot: IFleetOperation; completion: Promise<void> }
|
|
27
29
|
const queues = new Map<string, Promise<unknown>>();
|
|
@@ -131,7 +133,11 @@ export class FleetService {
|
|
|
131
133
|
const repo = withHostEnvironment(repositories[0]!, configuration.environment);
|
|
132
134
|
return this.exclusive(runtime, repo, async () => {
|
|
133
135
|
running();
|
|
134
|
-
if (operation === 'land')
|
|
136
|
+
if (operation === 'land') {
|
|
137
|
+
const landing = await this.land(runtime, repo, input as IFleetLandRequest);
|
|
138
|
+
this.options.landed?.(repo);
|
|
139
|
+
return landing as TFleetResult<T>;
|
|
140
|
+
}
|
|
135
141
|
if (operation === 'tooling') return await toolingFleetRepository(runtime, repo, input as TFleetRequest<'tooling'>) as TFleetResult<T>;
|
|
136
142
|
const release = await releaseFleetRepository(runtime, repo, input as TFleetRequest<'release'>, {},
|
|
137
143
|
await this.releaseGuard(runtime, repo, input as TFleetRequest<'release'>));
|
|
@@ -60,6 +60,21 @@ export const readJsonPointer = (valueArg: unknown, pointerArg: string): unknown
|
|
|
60
60
|
|
|
61
61
|
export type TFleetDeployProbeResult = { state: 'up'; version: string; sha?: string } | { state: 'down'; error: string };
|
|
62
62
|
|
|
63
|
+
/**
|
|
64
|
+
* A probe's failure text without its URL's query and fragment (AGL-1704): the Configuration master may give a probe a
|
|
65
|
+
* token there, and the text reaches the views, the stored deploy status and the driver. The URL is named without them.
|
|
66
|
+
*/
|
|
67
|
+
const probeErrorWithoutSecrets = (textArg: string, urlArg: string): string => {
|
|
68
|
+
if (!URL.canParse(urlArg)) return textArg.replaceAll(urlArg, 'the probe URL');
|
|
69
|
+
const url = new URL(urlArg);
|
|
70
|
+
const shown = new URL(urlArg);
|
|
71
|
+
shown.search = ''; shown.hash = '';
|
|
72
|
+
let text = textArg;
|
|
73
|
+
for (const full of new Set([urlArg, url.href])) text = text.replaceAll(full, shown.href);
|
|
74
|
+
for (const part of [url.search, url.hash]) if (part.length > 1) text = text.replaceAll(part, '');
|
|
75
|
+
return text;
|
|
76
|
+
};
|
|
77
|
+
|
|
63
78
|
/**
|
|
64
79
|
* Asks an HTTP target what it runs: a GET of its URL, the version at `versionPointer` (default `/version`) and the commit
|
|
65
80
|
* at `shaPointer`. An error status, an answer that is no JSON or holds no semantic version is down, with the reason.
|
|
@@ -71,7 +86,7 @@ export const probeFleetHttpTarget = async (probeArg: Extract<TFleetDeployProbe,
|
|
|
71
86
|
try { answer = await fetchFleetProbe(probeArg.url, optionsArg, { json: true, redirect: 'error' }); }
|
|
72
87
|
catch (errorArg) {
|
|
73
88
|
optionsArg.signal.throwIfAborted();
|
|
74
|
-
return { state: 'down', error: fleetProbeErrorText(errorArg).slice(0, 1024) };
|
|
89
|
+
return { state: 'down', error: probeErrorWithoutSecrets(fleetProbeErrorText(errorArg), probeArg.url).slice(0, 1024) };
|
|
75
90
|
}
|
|
76
91
|
if (answer.status >= 400) return { state: 'down', error: `HTTP ${answer.status}` };
|
|
77
92
|
const pointer = probeArg.versionPointer ?? '/version';
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import type {
|
|
2
|
+
IFleetDeployPlan, IFleetDeployStatus, IFleetDeployTargetStatus, IFleetDeployWindow, TFleetMaintenanceWindowState,
|
|
3
|
+
} from '../../ts_interfaces/deployments.js';
|
|
4
|
+
import type { TDeployStatusContent, TDeployStoredPlan, TDeployStoredTarget, TDeployStoredWindow } from './classes.deploymodels.js';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* What the deploy monitor computed, as the views read it at a moment (AGL-1704): the stored content and when it was
|
|
8
|
+
* computed. Where a window stands, whether a deploy may run and the busy sessions depend on the clock and the sessions,
|
|
9
|
+
* never on what was computed, so they are derived here when read, never stored.
|
|
10
|
+
*/
|
|
11
|
+
export interface IDeployStatusModel {
|
|
12
|
+
computedAt: string;
|
|
13
|
+
content: TDeployStatusContent;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
/** Where a maintenance window stands at `nowArg`: before it, in it, or after it. */
|
|
17
|
+
export const deployWindowState = (windowArg: Pick<TDeployStoredWindow, 'from' | 'to'>, nowArg: number): TFleetMaintenanceWindowState => (
|
|
18
|
+
nowArg < Date.parse(windowArg.from) ? 'scheduled' : nowArg < Date.parse(windowArg.to) ? 'active' : 'done'
|
|
19
|
+
);
|
|
20
|
+
|
|
21
|
+
/** A stored window as the views show it at `nowArg`. */
|
|
22
|
+
export const deployWindowAt = (windowArg: TDeployStoredWindow, nowArg: number): IFleetDeployWindow => ({
|
|
23
|
+
...structuredClone(windowArg), state: deployWindowState(windowArg, nowArg),
|
|
24
|
+
});
|
|
25
|
+
|
|
26
|
+
/** The windows planned for a target that have not ended, the earliest first as `windowsArg` lists them. */
|
|
27
|
+
export const deployTargetWindows = (windowsArg: IFleetDeployWindow[], targetIdArg: string): IFleetDeployWindow[] => (
|
|
28
|
+
windowsArg.filter((windowArg) => windowArg.state !== 'done' && windowArg.targets.includes(targetIdArg))
|
|
29
|
+
);
|
|
30
|
+
|
|
31
|
+
/** A target's deploy plans, each queued for `window` into the next window the owner gave for the target. */
|
|
32
|
+
export const deployPlansAt = (plansArg: TDeployStoredPlan[], targetWindowsArg: IFleetDeployWindow[]): IFleetDeployPlan[] => {
|
|
33
|
+
const next = targetWindowsArg.find((windowArg) => windowArg.go === 'given');
|
|
34
|
+
return plansArg.map((planArg) => ({ ...structuredClone(planArg), ...(planArg.go === 'window' && next ? { window: structuredClone(next) } : {}) }));
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* A stored target as the views show it, given every window at the moment read and the busy sessions: any time; in a
|
|
39
|
+
* window, open while one the owner gave is active; the AGL controller when no session is busy (AGL-909).
|
|
40
|
+
*/
|
|
41
|
+
export const deployTargetAt = (targetArg: TDeployStoredTarget, windowsArg: IFleetDeployWindow[], busySessionsArg: number): IFleetDeployTargetStatus => {
|
|
42
|
+
const { deployPlans, ...stored } = targetArg;
|
|
43
|
+
const windows = deployTargetWindows(windowsArg, targetArg.target.id);
|
|
44
|
+
const busySessions = targetArg.deployWhen === 'idle' ? busySessionsArg : undefined;
|
|
45
|
+
const deployOpen = targetArg.deployWhen === 'anytime'
|
|
46
|
+
|| (targetArg.deployWhen === 'window' ? windows.some((windowArg) => windowArg.state === 'active' && windowArg.go === 'given') : busySessions === 0);
|
|
47
|
+
return { ...structuredClone(stored), ...(busySessions === undefined ? {} : { busySessions }), deployOpen, windows: structuredClone(windows),
|
|
48
|
+
deployPlans: deployPlansAt(deployPlans, windows) };
|
|
49
|
+
};
|
|
50
|
+
|
|
51
|
+
/** The deploy status at `nowArg` with `busySessionsArg` sessions busy, from what was computed; it reads nothing else. */
|
|
52
|
+
export const deployStatusAt = (modelArg: IDeployStatusModel, nowArg: number, busySessionsArg: number): IFleetDeployStatus => {
|
|
53
|
+
const windows = modelArg.content.status.windows.map((windowArg) => deployWindowAt(windowArg, nowArg));
|
|
54
|
+
return { checkedAt: modelArg.computedAt, targets: modelArg.content.status.targets.map((targetArg) => deployTargetAt(targetArg, windows, busySessionsArg)),
|
|
55
|
+
windows };
|
|
56
|
+
};
|
|
@@ -11,6 +11,7 @@ export const fleetDeployRequestSchemas = {
|
|
|
11
11
|
probe: plugins.z.object({ targetId }).strict(),
|
|
12
12
|
release: plugins.z.object({ repo: plugins.z.string().min(1).max(1024).refine((valueArg) => !/[\0\r\n]/u.test(valueArg)).optional() }).strict(),
|
|
13
13
|
ticket: plugins.z.object({ ticketKey: plugins.z.string().regex(/^AGL-[1-9][0-9]*$/u) }).strict(),
|
|
14
|
+
refresh: plugins.z.object({}).strict(),
|
|
14
15
|
} as const satisfies Record<TFleetDeployOperation, plugins.z.ZodType>;
|
|
15
16
|
|
|
16
17
|
export const assertFleetDeployRequest = <TOperation extends TFleetDeployOperation>(
|
|
@@ -37,7 +38,8 @@ export const assertFleetDeployResponse = (methodArg: string, valueArg: unknown):
|
|
|
37
38
|
probe: plugins.z.object({ state: plugins.z.enum(['up', 'down', 'unknown']) }).passthrough() }).passthrough();
|
|
38
39
|
const schemas = {
|
|
39
40
|
status: plugins.z.object({ checkedAt: plugins.z.string(), targets: plugins.z.array(target),
|
|
40
|
-
windows: plugins.z.array(plugins.z.object({ key: plugins.z.string(), from: plugins.z.string(), to: plugins.z.string() }).passthrough())
|
|
41
|
+
windows: plugins.z.array(plugins.z.object({ key: plugins.z.string(), from: plugins.z.string(), to: plugins.z.string() }).passthrough()),
|
|
42
|
+
failure: plugins.z.object({ at: plugins.z.string(), message: plugins.z.string(), reference: plugins.z.string() }).strict().optional() }).strict(),
|
|
41
43
|
history: plugins.z.object({ targetId, observations: plugins.z.array(plugins.z.object({ targetId, version: plugins.z.string(),
|
|
42
44
|
observedAt: plugins.z.string() }).passthrough()) }).strict(),
|
|
43
45
|
probe: target,
|
|
@@ -45,6 +47,7 @@ export const assertFleetDeployResponse = (methodArg: string, valueArg: unknown):
|
|
|
45
47
|
id: plugins.z.string() }).passthrough()) }).strict(),
|
|
46
48
|
ticket: plugins.z.object({ ticketKey: plugins.z.string(), landed: plugins.z.array(plugins.z.unknown()), runs: plugins.z.array(plugins.z.unknown()),
|
|
47
49
|
foundIn: plugins.z.array(plugins.z.unknown()) }).passthrough(),
|
|
50
|
+
refresh: plugins.z.object({ state: plugins.z.enum(['refreshed', 'refreshing']), checkedAt: plugins.z.string().optional() }).strict(),
|
|
48
51
|
};
|
|
49
52
|
schemas[operation].parse(valueArg);
|
|
50
53
|
};
|
|
@@ -114,7 +114,8 @@ export const deployStatusLines = (statusArg: IFleetDeployStatus): string[] => [.
|
|
|
114
114
|
deployWhenText(targetArg),
|
|
115
115
|
targetArg.deployPlans.map(deployPlanText).join('; ') || '-',
|
|
116
116
|
]),
|
|
117
|
-
]), ...windowLines(statusArg.windows)
|
|
117
|
+
]), ...windowLines(statusArg.windows), ...(statusArg.failure ? ['', `The last check failed at ${minute(statusArg.failure.at)}: ${statusArg.failure.message} `
|
|
118
|
+
+ `What is shown is from ${minute(statusArg.checkedAt)}. (ref ${statusArg.failure.reference})`] : [])];
|
|
118
119
|
|
|
119
120
|
export const deployHistoryLines = (historyArg: { targetId: string; observations: IFleetDeployObservation[] }): string[] => (
|
|
120
121
|
historyArg.observations.length ? historyArg.observations.map((observationArg) => [minute(observationArg.observedAt), observationArg.version,
|
|
@@ -121,6 +121,7 @@ import { ticketColumns, ticketAutoLabels, type ticketErrorMessages } from '../ts
|
|
|
121
121
|
import type { TAuthErrorCode } from './interfaces.auth.js';
|
|
122
122
|
import { configurationErrorCodes, type TConfigurationErrorCode } from './configuration/classes.configurationerror.js';
|
|
123
123
|
import type { ControllerElicitationReplyError } from './functions.elicitation.js';
|
|
124
|
+
import type { ControllerPromptReplyError } from './functions.promptreply.js';
|
|
124
125
|
import type { FleetNativeTurnError } from './fleet/interfaces.workers.js';
|
|
125
126
|
import type { TClaudeDispatchRefusal } from './classes.claudeharness.js';
|
|
126
127
|
import type { INativeSessionFailedErrorData } from './classes.nativesessions.js';
|
|
@@ -178,14 +179,15 @@ export const deviceRefusalCodes: ReadonlySet<string> = new Set([...Object.keys({
|
|
|
178
179
|
/**
|
|
179
180
|
* Every code the controller refuses a device's request with before the device error translation: the codes of the
|
|
180
181
|
* typed errors `asTypedResponseError` passes on as their own (the auth store's, the configuration authority's, an
|
|
181
|
-
* elicitation reply's, a native Codex turn's), the codes it gives the others
|
|
182
|
-
* under a failure journal reference), and the codes the browser's shared
|
|
183
|
-
* reads and sends, native sessions, answers, direct children).
|
|
182
|
+
* elicitation reply's, a permission or question reply's, a native Codex turn's), the codes it gives the others
|
|
183
|
+
* (`controller_operation_failed` for a fault under a failure journal reference), and the codes the browser's shared
|
|
184
|
+
* functions a device runs refuse with (session reads and sends, native sessions, answers, direct children).
|
|
184
185
|
*/
|
|
185
186
|
export type TControllerRefusalCode =
|
|
186
187
|
| TAuthErrorCode
|
|
187
188
|
| TConfigurationErrorCode
|
|
188
189
|
| ControllerElicitationReplyError['code']
|
|
190
|
+
| ControllerPromptReplyError['code']
|
|
189
191
|
| FleetNativeTurnError['code']
|
|
190
192
|
| typeof controllerOperationFailedErrorCode
|
|
191
193
|
| 'concurrent_change'
|
|
@@ -268,7 +270,8 @@ export const deviceControllerRefusals: Readonly<Record<Exclude<TControllerRefusa
|
|
|
268
270
|
// The configuration authority the driver, the direct reports and the deploy monitor read.
|
|
269
271
|
invalid_argument: 'controller_failed',
|
|
270
272
|
conflict: 'concurrent_change',
|
|
271
|
-
//
|
|
273
|
+
// An elicitation answered or withdrawn meanwhile, or a configuration record gone (a permission or question the session
|
|
274
|
+
// no longer holds is refused `concurrent_change` already).
|
|
272
275
|
not_found: 'concurrent_change',
|
|
273
276
|
unsupported: 'controller_failed',
|
|
274
277
|
unbound: 'controller_unavailable',
|
|
@@ -666,8 +669,8 @@ const deviceAuthorityUnavailable: Readonly<Record<Exclude<TControllerAuthorityDa
|
|
|
666
669
|
|
|
667
670
|
/** What `device.host.get` reads besides the AGL and the device, each section from its owner. */
|
|
668
671
|
export interface IDeviceHostSources {
|
|
669
|
-
/** The deploy monitor's status of every target, as the Deployments view reads it; never a probe. */
|
|
670
|
-
deployStatus: () => Promise<IFleetDeployStatus>;
|
|
672
|
+
/** The deploy monitor's stored status of every target, as the Deployments view reads it; never a probe. */
|
|
673
|
+
deployStatus: (signalArg: AbortSignal) => Promise<IFleetDeployStatus>;
|
|
671
674
|
/** The inference proxy's pools; absent while no proxy runs here. */
|
|
672
675
|
capacity: ((signalArg: AbortSignal) => Promise<IProxyCapacityAnswer>) | undefined;
|
|
673
676
|
/** The accounts service as the controller holds it. */
|
|
@@ -720,10 +723,12 @@ const readDeviceApiKeys = async (sourcesArg: Pick<IDeviceHostSources, 'authority
|
|
|
720
723
|
|
|
721
724
|
/**
|
|
722
725
|
* Why a section's owner did not answer, when that is a state of the host rather than a fault: the configuration
|
|
723
|
-
* service the deploy monitor reads its targets from, or the inference proxy and the accounts service behind it.
|
|
726
|
+
* service the deploy monitor reads its targets from, or the inference proxy and the accounts service behind it. A
|
|
727
|
+
* deploy monitor whose first computation still runs or failed is running (AGL-1704): it reads as `failed`, with the
|
|
728
|
+
* monitor's own reference when it failed (see `readDeviceSection`).
|
|
724
729
|
*/
|
|
725
730
|
const deviceHostUnavailableReason = (errorArg: unknown): Exclude<TDeviceHostUnavailableReason, 'failed'> | undefined => {
|
|
726
|
-
if (errorArg instanceof DeployError) return errorArg.
|
|
731
|
+
if (errorArg instanceof DeployError) return errorArg.unavailable === 'not_running' ? 'not_running' : undefined;
|
|
727
732
|
if (errorArg instanceof AglProxyUnavailableError) return 'not_running';
|
|
728
733
|
if (errorArg instanceof AglProxyRefusedError) return errorArg.code === 'authority_unavailable' ? 'not_running' : undefined;
|
|
729
734
|
if (errorArg instanceof AglProxyOutdatedError) return 'outdated';
|
|
@@ -744,6 +749,11 @@ const readDeviceSection = async <T>(operationArg: string, whatArg: string, signa
|
|
|
744
749
|
if (signalArg.aborted) throw errorArg;
|
|
745
750
|
const reason = deviceHostUnavailableReason(errorArg);
|
|
746
751
|
if (reason !== undefined) return { state: 'unavailable', reason };
|
|
752
|
+
// A deploy monitor without a stored status (AGL-1704) is no fault of this read: nothing is journaled. A first
|
|
753
|
+
// computation that failed was journaled once by the monitor, whose reference the device gets; one that still runs has none.
|
|
754
|
+
if (errorArg instanceof DeployError && errorArg.unavailable) {
|
|
755
|
+
return { state: 'unavailable', reason: 'failed', ...(errorArg.reference ? { reference: errorArg.reference } : {}) };
|
|
756
|
+
}
|
|
747
757
|
const reference = controllerFailureJournal.record({ operation: operationArg, cause: errorArg });
|
|
748
758
|
console.error(`Reading ${whatArg} for a device failed (ref ${reference}):`, errorArg);
|
|
749
759
|
return { state: 'unavailable', reason: 'failed', reference };
|
|
@@ -759,7 +769,7 @@ const readDeviceHostSection = <T>(sectionArg: string, signalArg: AbortSignal,
|
|
|
759
769
|
export const readDeviceHostSections = async (sourcesArg: IDeviceHostSources, nowArg: number, signalArg: AbortSignal):
|
|
760
770
|
Promise<Pick<IReq_DeviceHostGet['response'], 'deploys' | 'pools' | 'apiKeys'>> => {
|
|
761
771
|
const [deploys, pools, apiKeys] = await Promise.all([
|
|
762
|
-
readDeviceHostSection<IDeviceHostDeploys>('deploys', signalArg, async () => deviceHostDeploys(await sourcesArg.deployStatus())),
|
|
772
|
+
readDeviceHostSection<IDeviceHostDeploys>('deploys', signalArg, async () => deviceHostDeploys(await sourcesArg.deployStatus(signalArg))),
|
|
763
773
|
readDeviceHostSection<IDeviceHostPools>('pools', signalArg, async () => (
|
|
764
774
|
sourcesArg.capacity === undefined ? { state: 'unavailable', reason: 'not_running' } : deviceHostPools(await sourcesArg.capacity(signalArg))
|
|
765
775
|
)),
|
|
@@ -13,6 +13,8 @@ export const deployToolDefinitions: readonly { name: string; operation: TFleetDe
|
|
|
13
13
|
description: 'The versions a deploy target ran, newest first: one observation each time its probe answered another version, with the version before it (a newer one means a rollback).' },
|
|
14
14
|
{ name: 'deploy_probe', operation: 'probe', readOnly: false, inputSchema: fleetDeployRequestSchemas.probe,
|
|
15
15
|
description: 'Probe one deploy target now and answer its status. Run it after any deploy; it records what the target answers and claims nothing itself.' },
|
|
16
|
+
{ name: 'deploy_refresh', operation: 'refresh', readOnly: false, inputSchema: fleetDeployRequestSchemas.refresh,
|
|
17
|
+
description: 'Check every deploy target now: fetch the repositories\' remotes and release tags, probe every target and compute the deploy status again, as the five-minute check does; a check already running is followed by one this call shares with any other. It waits at most 60 seconds: refreshed once the check ended, refreshing while it runs on (deploy_status then shows the stored status until it ends). checkedAt says when the status was computed. Call it when deploy_status must show a change at once, not by habit.' },
|
|
16
18
|
{ name: 'release_status', operation: 'release', readOnly: true, inputSchema: fleetDeployRequestSchemas.release,
|
|
17
19
|
description: 'The release state of a repository (repo as org/name, fleet id or checkout path), or of every repository a deploy target runs, a ticket plans or a landed ticket names: its newest release tag, the tickets planning its next release, and the landed tickets the newest release does not hold.' },
|
|
18
20
|
];
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A refused answer to a permission or question (AGL-1687): the session no longer holds the request, because it was
|
|
3
|
+
* answered meanwhile (in another client, or by auto-accept) or withdrawn as its turn moved on. AGL lost a race before it
|
|
4
|
+
* sent anything, so `concurrent_change`: nothing was done; read again, then decide. The component that holds the
|
|
5
|
+
* request throws it (Claude Code's harness, the Codex adapter, the OpenCode client), and the controller hands it on as
|
|
6
|
+
* the typed refusal it is, as it does `ControllerElicitationReplyError`.
|
|
7
|
+
*/
|
|
8
|
+
export class ControllerPromptReplyError extends Error {
|
|
9
|
+
public readonly code = 'concurrent_change';
|
|
10
|
+
|
|
11
|
+
constructor(messageArg: string) {
|
|
12
|
+
super(messageArg);
|
|
13
|
+
this.name = 'ControllerPromptReplyError';
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
/** The refusal of an answer to a permission or question the session no longer holds; nothing was sent. */
|
|
18
|
+
export const promptNoLongerPending = (kindArg: 'permission' | 'question'): ControllerPromptReplyError => (
|
|
19
|
+
new ControllerPromptReplyError(`This ${kindArg} was answered or changed meanwhile, so nothing was sent. Read it again, then decide.`)
|
|
20
|
+
);
|
package/ts/interfaces.flexipc.ts
CHANGED
|
@@ -67,8 +67,12 @@ export type TFlexTurnReversionCaptureInspectionV2 =
|
|
|
67
67
|
plugins.flexharness.TFlexTurnReversionCaptureInspectionV2;
|
|
68
68
|
export type TFlexTurnReversionApplyInspection =
|
|
69
69
|
plugins.flexharness.IFlexTurnReversionApplyInspection;
|
|
70
|
+
/** A session's identity as its project's metadata holds it, read without loading its history. */
|
|
71
|
+
export type TFlexSessionIdentity = plugins.flexharness.IFlexSessionIdentity;
|
|
72
|
+
/** What one FlexHarness load of a project's sessions took. */
|
|
73
|
+
export type TFlexScopeLoadMetrics = plugins.flexharness.IFlexScopeLoadMetrics;
|
|
70
74
|
|
|
71
|
-
export const flexIpcProtocolVersion =
|
|
75
|
+
export const flexIpcProtocolVersion = 40 as const;
|
|
72
76
|
/**
|
|
73
77
|
* The installation's own Flex runs, which belong to no project: the configuration projection's adapting run, and
|
|
74
78
|
* Session Intelligence over a session outside every project.
|
|
@@ -93,6 +97,8 @@ export const flexIpcMaximumPromptPayloadBytes = flexIpcMaximumFrameBytes - 64 *
|
|
|
93
97
|
export const flexIpcMaximumPromptQueueEntries = 128;
|
|
94
98
|
export const flexIpcMaximumQueuedSessionChanges = 256;
|
|
95
99
|
export const flexIpcMaximumQueuedSessionChangeBytes = 8 * 1024 * 1024;
|
|
100
|
+
/** The most sessions one project's `session.identities` answer names; more is refused, never cut. */
|
|
101
|
+
export const flexIpcMaximumSessionIdentities = 2_048;
|
|
96
102
|
export const flexGenerationLeaseCleanupTimeoutMs = 30_000;
|
|
97
103
|
export const flexIpcControlTimeoutMs = 35_000;
|
|
98
104
|
export const flexIpcMaximumHostTimeoutMs = 5 * 60 * 1000;
|
|
@@ -694,10 +700,9 @@ export interface IFlexJobAdmission {
|
|
|
694
700
|
jobId: string;
|
|
695
701
|
}
|
|
696
702
|
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
truncated: boolean;
|
|
703
|
+
/** Every session of a project, ordered by `sessionId` (UTF-16 code units), in one answer. */
|
|
704
|
+
export interface IFlexSessionIdentitiesResult {
|
|
705
|
+
sessions: TFlexSessionIdentity[];
|
|
701
706
|
}
|
|
702
707
|
|
|
703
708
|
export type TFlexSlashExecutionResult =
|
|
@@ -771,9 +776,14 @@ export interface IFlexRequestMap {
|
|
|
771
776
|
request: IFlexConfigurationAdaptationRequest;
|
|
772
777
|
response: IFlexConfigurationAdaptationResult;
|
|
773
778
|
};
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
779
|
+
/**
|
|
780
|
+
* The identities of a project's sessions, from its metadata: never waits for a load of their
|
|
781
|
+
* histories, so the controller's identity reconciliation after `project.register` stays within
|
|
782
|
+
* its control budget however long the project's history is (AGL-1713).
|
|
783
|
+
*/
|
|
784
|
+
'session.identities': {
|
|
785
|
+
request: { scopeId: string };
|
|
786
|
+
response: IFlexSessionIdentitiesResult;
|
|
777
787
|
};
|
|
778
788
|
'session.create': {
|
|
779
789
|
request: {
|
|
@@ -1363,7 +1373,7 @@ export type TFlexChildMessage =
|
|
|
1363
1373
|
export const readOnlyFlexRequestMethods: ReadonlySet<TFlexRequestMethod> = new Set<TFlexRequestMethod>([
|
|
1364
1374
|
'service.status',
|
|
1365
1375
|
'intelligence.get',
|
|
1366
|
-
'session.
|
|
1376
|
+
'session.identities',
|
|
1367
1377
|
'session.get',
|
|
1368
1378
|
'session.metrics',
|
|
1369
1379
|
'session.reversion.info',
|
|
@@ -1387,7 +1397,7 @@ const requestMethods: ReadonlySet<string> = new Set<TFlexRequestMethod>([
|
|
|
1387
1397
|
'intelligence.get',
|
|
1388
1398
|
'intelligence.cancel',
|
|
1389
1399
|
'configuration.adapt',
|
|
1390
|
-
'session.
|
|
1400
|
+
'session.identities',
|
|
1391
1401
|
'session.create',
|
|
1392
1402
|
'session.get',
|
|
1393
1403
|
'session.metrics',
|
|
@@ -1648,14 +1658,23 @@ const isFlexProjectCleanupCohortEntry = (
|
|
|
1648
1658
|
&& isFlexSessionGeneration(valueArg)
|
|
1649
1659
|
&& typeof valueArg.cleanupRoot === 'boolean';
|
|
1650
1660
|
|
|
1661
|
+
const isFlexSessionIdentity = (valueArg: unknown): valueArg is TFlexSessionIdentity =>
|
|
1662
|
+
isFlexPlainObject(valueArg)
|
|
1663
|
+
&& hasFlexExactKeys(
|
|
1664
|
+
valueArg,
|
|
1665
|
+
['sessionId', 'sessionGenerationId', 'sessionGenerationSequence'],
|
|
1666
|
+
['parentSessionId'],
|
|
1667
|
+
)
|
|
1668
|
+
&& isIdentifier(valueArg.sessionId)
|
|
1669
|
+
&& isFlexSessionGeneration(valueArg)
|
|
1670
|
+
&& (valueArg.parentSessionId === undefined || isIdentifier(valueArg.parentSessionId));
|
|
1671
|
+
|
|
1651
1672
|
const isStrictlyOrderedFlexCohort = <TEntry extends { sessionId: string }>(
|
|
1652
1673
|
valueArg: unknown,
|
|
1653
1674
|
entryCheckArg: (entryArg: unknown) => entryArg is TEntry,
|
|
1675
|
+
maximumEntriesArg: number = plugins.flexharness.FLEX_SESSION_GENERATION_COHORT_MAX_ENTRIES,
|
|
1654
1676
|
): valueArg is TEntry[] => {
|
|
1655
|
-
if (
|
|
1656
|
-
!Array.isArray(valueArg)
|
|
1657
|
-
|| valueArg.length > plugins.flexharness.FLEX_SESSION_GENERATION_COHORT_MAX_ENTRIES
|
|
1658
|
-
) return false;
|
|
1677
|
+
if (!Array.isArray(valueArg) || valueArg.length > maximumEntriesArg) return false;
|
|
1659
1678
|
let previousSessionId: string | undefined;
|
|
1660
1679
|
for (const entry of valueArg) {
|
|
1661
1680
|
if (
|
|
@@ -2547,13 +2566,9 @@ export const isFlexRequestPayload = <TMethod extends TFlexRequestMethod>(
|
|
|
2547
2566
|
&& configurationAdaptationTargets.has(String(harness.targetId))
|
|
2548
2567
|
&& isBoundedString(harness.source, 256 * 1024, true)
|
|
2549
2568
|
&& isBoundedString(harness.profile, 4 * 1024));
|
|
2550
|
-
case 'session.
|
|
2551
|
-
return hasFlexExactKeys(valueArg, ['scopeId']
|
|
2552
|
-
&& isControllerProjectId(valueArg.scopeId)
|
|
2553
|
-
&& (valueArg.offset === undefined || isNonNegativeInteger(valueArg.offset))
|
|
2554
|
-
&& (valueArg.limit === undefined
|
|
2555
|
-
|| (Number.isSafeInteger(valueArg.limit) && Number(valueArg.limit) >= 1
|
|
2556
|
-
&& Number(valueArg.limit) <= 50));
|
|
2569
|
+
case 'session.identities':
|
|
2570
|
+
return hasFlexExactKeys(valueArg, ['scopeId'])
|
|
2571
|
+
&& isControllerProjectId(valueArg.scopeId);
|
|
2557
2572
|
case 'session.create':
|
|
2558
2573
|
return hasFlexExactKeys(valueArg, ['scopeId', 'options'])
|
|
2559
2574
|
&& isControllerProjectId(valueArg.scopeId)
|
|
@@ -3436,13 +3451,14 @@ export const isFlexResponseResult = <TMethod extends TFlexRequestMethod>(
|
|
|
3436
3451
|
&& isFlexPlainObject(valueArg.instructions)
|
|
3437
3452
|
&& Object.entries(valueArg.instructions).every(([targetId, text]) => configurationAdaptationTargets.has(targetId)
|
|
3438
3453
|
&& isBoundedString(text, 256 * 1024, true));
|
|
3439
|
-
case 'session.
|
|
3454
|
+
case 'session.identities':
|
|
3440
3455
|
return isFlexPlainObject(valueArg)
|
|
3441
|
-
&& hasFlexExactKeys(valueArg, ['sessions'
|
|
3442
|
-
&&
|
|
3443
|
-
|
|
3444
|
-
|
|
3445
|
-
|
|
3456
|
+
&& hasFlexExactKeys(valueArg, ['sessions'])
|
|
3457
|
+
&& isStrictlyOrderedFlexCohort(
|
|
3458
|
+
valueArg.sessions,
|
|
3459
|
+
isFlexSessionIdentity,
|
|
3460
|
+
flexIpcMaximumSessionIdentities,
|
|
3461
|
+
);
|
|
3446
3462
|
case 'session.create':
|
|
3447
3463
|
case 'session.get':
|
|
3448
3464
|
case 'session.update':
|
|
@@ -4,7 +4,9 @@ import type { ITicketReleasePlan, TTicketColumn, TTicketPriority } from './ticke
|
|
|
4
4
|
/**
|
|
5
5
|
* Deployments (AGL-909): what runs where, observed rather than claimed. A release is the repository's tag `v<version>`;
|
|
6
6
|
* what a target runs is what its probe answers, recorded as an observation whenever it changes. Everything else (what a
|
|
7
|
-
* release holds, how far a target is behind, open bugs on the running version) is computed
|
|
7
|
+
* release holds, how far a target is behind, open bugs on the running version) is computed by the controller in the
|
|
8
|
+
* background and stored as its deploy status (AGL-1704), which the views read; what depends on the clock or the busy
|
|
9
|
+
* sessions is applied when it is read.
|
|
8
10
|
*/
|
|
9
11
|
|
|
10
12
|
/**
|
|
@@ -100,7 +102,7 @@ export interface IFleetDeployObservation {
|
|
|
100
102
|
artifacts: IFleetDeployArtifact[];
|
|
101
103
|
}
|
|
102
104
|
|
|
103
|
-
/** What the last probe of a target found
|
|
105
|
+
/** What the last probe of a target found, as the controller's last computation of the deploy status holds it. */
|
|
104
106
|
export interface IFleetDeployProbeState {
|
|
105
107
|
state: 'up' | 'down' | 'unknown';
|
|
106
108
|
checkedAt?: string;
|
|
@@ -185,7 +187,7 @@ export interface IFleetDeployBug extends IFleetDeployTicket {
|
|
|
185
187
|
fixedIn?: string;
|
|
186
188
|
}
|
|
187
189
|
|
|
188
|
-
/** One target as `agl deploy status` and the Deployments view show it,
|
|
190
|
+
/** One target as `agl deploy status` and the Deployments view show it, from the stored deploy status. */
|
|
189
191
|
export interface IFleetDeployTargetStatus {
|
|
190
192
|
target: IFleetDeployTarget & { builtIn?: true };
|
|
191
193
|
/** The repository's `org/name` as fleet discovery found its checkout; absent when no checkout holds it. */
|
|
@@ -216,11 +218,24 @@ export interface IFleetDeployTargetStatus {
|
|
|
216
218
|
deployPlans: IFleetDeployPlan[];
|
|
217
219
|
}
|
|
218
220
|
|
|
221
|
+
/**
|
|
222
|
+
* The newest computation of the deploy status, when it failed (AGL-1704): when, why in AGL's own words (naming the
|
|
223
|
+
* repository it could not read), and the failure journal reference its cause is kept under.
|
|
224
|
+
*/
|
|
225
|
+
export interface IFleetDeployStatusFailure {
|
|
226
|
+
at: string;
|
|
227
|
+
message: string;
|
|
228
|
+
reference: string;
|
|
229
|
+
}
|
|
230
|
+
|
|
219
231
|
export interface IFleetDeployStatus {
|
|
232
|
+
/** When the stored status was computed: at least once per pass, so when the targets were last checked. */
|
|
220
233
|
checkedAt: string;
|
|
221
234
|
targets: IFleetDeployTargetStatus[];
|
|
222
235
|
/** Every maintenance window on a ticket that is not done, scheduled, active or done, the earliest first. */
|
|
223
236
|
windows: IFleetDeployWindow[];
|
|
237
|
+
/** While the newest computation failed: that failure. The status is the last one computed, from `checkedAt`. */
|
|
238
|
+
failure?: IFleetDeployStatusFailure;
|
|
224
239
|
}
|
|
225
240
|
|
|
226
241
|
/** A repository's release state, as `agl release status` shows it. */
|
|
@@ -258,6 +273,22 @@ export interface IFleetDeployTicketPlacement {
|
|
|
258
273
|
deployPlan?: { plan: IFleetDeployPlan; targetName: string; environment?: string; deployWhen: TFleetDeployCondition };
|
|
259
274
|
}
|
|
260
275
|
|
|
276
|
+
/** How long `refresh` waits for its check before it answers `refreshing`; the check goes on, and `deployments.changed` tells of it. */
|
|
277
|
+
export const fleetDeployRefreshWaitMs = 60_000;
|
|
278
|
+
|
|
279
|
+
/** How much longer than `fleetDeployRefreshWaitMs` a caller waits for a `refresh` answer, so the controller's own bound answers first. */
|
|
280
|
+
export const fleetDeployRefreshClientMarginMs = 15_000;
|
|
281
|
+
|
|
282
|
+
/**
|
|
283
|
+
* A `refresh` answer: `refreshed` once a full check that started after the request (fetch, probes, computation) ended
|
|
284
|
+
* within `fleetDeployRefreshWaitMs`, `refreshing` while it still runs. `checkedAt` is the stored status's, absent only
|
|
285
|
+
* while none is stored yet.
|
|
286
|
+
*/
|
|
287
|
+
export interface IFleetDeployRefreshResult {
|
|
288
|
+
state: 'refreshed' | 'refreshing';
|
|
289
|
+
checkedAt?: string;
|
|
290
|
+
}
|
|
291
|
+
|
|
261
292
|
/** Every request of the deploy views; the browser sends the `controller.deploy.*` ones, `agl deploy` the `agl.mcp.deploy.*` ones. */
|
|
262
293
|
export interface IFleetDeployOperations {
|
|
263
294
|
status: { request: { targetId?: string }; response: IFleetDeployStatus };
|
|
@@ -265,13 +296,15 @@ export interface IFleetDeployOperations {
|
|
|
265
296
|
probe: { request: { targetId: string }; response: IFleetDeployTargetStatus };
|
|
266
297
|
release: { request: { repo?: string }; response: IFleetReleaseStatus };
|
|
267
298
|
ticket: { request: { ticketKey: string }; response: IFleetDeployTicketPlacement };
|
|
299
|
+
refresh: { request: Record<never, never>; response: IFleetDeployRefreshResult };
|
|
268
300
|
}
|
|
269
301
|
export type TFleetDeployOperation = keyof IFleetDeployOperations;
|
|
270
|
-
export const fleetDeployOperations = ['status', 'history', 'probe', 'release', 'ticket'] as const satisfies readonly TFleetDeployOperation[];
|
|
302
|
+
export const fleetDeployOperations = ['status', 'history', 'probe', 'release', 'ticket', 'refresh'] as const satisfies readonly TFleetDeployOperation[];
|
|
271
303
|
|
|
272
304
|
/**
|
|
273
305
|
* The deploy views in the browser. `status` and `history` read; `probe` asks for a probe of one target now and claims
|
|
274
|
-
* nothing (a deploy path calls it after a deploy); `release` reads a repository's release state
|
|
306
|
+
* nothing (a deploy path calls it after a deploy); `release` reads a repository's release state; `refresh` asks for one
|
|
307
|
+
* full check now and waits for it, at most `fleetDeployRefreshWaitMs` (AGL-1704).
|
|
275
308
|
*/
|
|
276
309
|
export type TControllerDeployRequest<TOperation extends TFleetDeployOperation> = {
|
|
277
310
|
method: `controller.deploy.${TOperation}`;
|
|
@@ -282,7 +315,7 @@ export type TControllerDeployTypedRequest = { [TOperation in TFleetDeployOperati
|
|
|
282
315
|
|
|
283
316
|
/** The same through the controller's private channel, for `agl deploy` and `agl release status`: the local owner capability. */
|
|
284
317
|
export const controllerMcpDeployMethods = ['agl.mcp.deploy.status', 'agl.mcp.deploy.history', 'agl.mcp.deploy.probe', 'agl.mcp.deploy.release',
|
|
285
|
-
'agl.mcp.deploy.ticket'] as const;
|
|
318
|
+
'agl.mcp.deploy.ticket', 'agl.mcp.deploy.refresh'] as const;
|
|
286
319
|
export type TControllerMcpDeployMethod = (typeof controllerMcpDeployMethods)[number];
|
|
287
320
|
export type TControllerMcpDeployRequest<TOperation extends TFleetDeployOperation> = {
|
|
288
321
|
method: `agl.mcp.deploy.${TOperation}`;
|
|
@@ -3906,7 +3906,7 @@
|
|
|
3906
3906
|
"ticket",
|
|
3907
3907
|
"none"
|
|
3908
3908
|
],
|
|
3909
|
-
"description": "How a device answers an item: `session` with `device.permission.reply`, `device.question.reply` or `device.elicitation.reply` for the session; `child
|
|
3909
|
+
"description": "How a device answers an item: `session` with `device.permission.reply`, `device.question.reply` or `device.elicitation.reply` for the session; `child`, only ever a permission or a question, with `device.permission.reply` or `device.question.reply` for the session and the child's `childSessionId`; `ticket` with `device.ticket.answer`; `none` not on a device (the driver's turn, the driver's own prompts, a native wait, an item whose payload was left out, or a session the feed does not list)."
|
|
3910
3910
|
},
|
|
3911
3911
|
"TDeviceInboxItem": {
|
|
3912
3912
|
"anyOf": [
|
package/ts_interfaces/devices.ts
CHANGED
|
@@ -467,7 +467,8 @@ export type TDeviceInboxWhere =
|
|
|
467
467
|
|
|
468
468
|
/**
|
|
469
469
|
* How a device answers an item: `session` with `device.permission.reply`, `device.question.reply` or
|
|
470
|
-
* `device.elicitation.reply` for the session; `child
|
|
470
|
+
* `device.elicitation.reply` for the session; `child`, only ever a permission or a question, with
|
|
471
|
+
* `device.permission.reply` or `device.question.reply` for the session and the child's `childSessionId`; `ticket`
|
|
471
472
|
* with `device.ticket.answer`; `none` not on a device (the driver's turn, the driver's own prompts, a native wait, an
|
|
472
473
|
* item whose payload was left out, or a session the feed does not list).
|
|
473
474
|
*/
|
package/ts_interfaces/inbox.ts
CHANGED
|
@@ -176,6 +176,11 @@ interface IControllerInboxItemBase<TKind extends TControllerInboxKind, TWhere ex
|
|
|
176
176
|
}
|
|
177
177
|
|
|
178
178
|
type TSessionWhere = Extract<TControllerInboxWhere, { kind: 'conversation' | 'child' | 'native' | 'driver' }>;
|
|
179
|
+
/**
|
|
180
|
+
* Where an MCP form lives: never a direct child, whose harness (OpenCode) hands AGL no MCP forms, so no child reply
|
|
181
|
+
* answers one (AGL-1701).
|
|
182
|
+
*/
|
|
183
|
+
type TElicitationWhere = Extract<TControllerInboxWhere, { kind: 'conversation' | 'native' | 'driver' }>;
|
|
179
184
|
|
|
180
185
|
export interface IControllerInboxPermissionItem extends IControllerInboxItemBase<'permission', TSessionWhere> {
|
|
181
186
|
permission?: IControllerPermission;
|
|
@@ -183,7 +188,9 @@ export interface IControllerInboxPermissionItem extends IControllerInboxItemBase
|
|
|
183
188
|
export interface IControllerInboxQuestionItem extends IControllerInboxItemBase<'question', TSessionWhere> {
|
|
184
189
|
question?: IControllerQuestion;
|
|
185
190
|
}
|
|
186
|
-
export interface IControllerInboxElicitationItem extends IControllerInboxItemBase<'elicitation',
|
|
191
|
+
export interface IControllerInboxElicitationItem extends IControllerInboxItemBase<'elicitation', TElicitationWhere> {
|
|
192
|
+
/** Never `child`: no child holds an MCP form. */
|
|
193
|
+
answer: Exclude<TControllerInboxAnswer, 'child'>;
|
|
187
194
|
elicitation?: TControllerElicitation;
|
|
188
195
|
}
|
|
189
196
|
/** A wait the harness shows in its own client: AGL holds no request for it, so it is answered there (`answer: 'none'`). */
|