agl 43.3.2 → 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 +12 -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 +22 -5
- package/dist_ts/classes.controller.js +149 -61
- 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/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 +1 -1
- package/readme.md +29 -11
- 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 +161 -72
- 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/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
|
@@ -44,6 +44,7 @@ import type {
|
|
|
44
44
|
TOpenCodeSdkClient,
|
|
45
45
|
} from './interfaces.opencode.js';
|
|
46
46
|
import { boundLiveToolExecution } from './functions.livetoolbounding.js';
|
|
47
|
+
import { promptNoLongerPending } from './functions.promptreply.js';
|
|
47
48
|
import {
|
|
48
49
|
openCodeSessionIdentitySnapshotCapability,
|
|
49
50
|
openCodeSessionProviderGeneration,
|
|
@@ -140,6 +141,19 @@ const isOpenCodeNotFoundError = (valueArg: unknown): boolean => {
|
|
|
140
141
|
&& isOpenCodeNotFoundBody(valueArg.cause.body);
|
|
141
142
|
};
|
|
142
143
|
|
|
144
|
+
/**
|
|
145
|
+
* OpenCode's refusal of an answer to a permission or question it no longer holds (answered or withdrawn meanwhile): a
|
|
146
|
+
* 404 with its `PermissionNotFoundError` or `QuestionNotFoundError`, before it applies anything.
|
|
147
|
+
*/
|
|
148
|
+
const isOpenCodePromptNotFoundError = (
|
|
149
|
+
valueArg: unknown,
|
|
150
|
+
tagArg: 'PermissionNotFoundError' | 'QuestionNotFoundError',
|
|
151
|
+
): boolean => isRecord(valueArg)
|
|
152
|
+
&& isRecord(valueArg.cause)
|
|
153
|
+
&& valueArg.cause.status === 404
|
|
154
|
+
&& isRecord(valueArg.cause.body)
|
|
155
|
+
&& valueArg.cause.body._tag === tagArg;
|
|
156
|
+
|
|
143
157
|
const hasExactKeys = (
|
|
144
158
|
valueArg: Record<string, unknown>,
|
|
145
159
|
requiredArg: readonly string[],
|
|
@@ -3312,7 +3326,9 @@ export class OpenCodeClientAdapter implements IOpenCodeSessionIdentitySnapshotCa
|
|
|
3312
3326
|
},
|
|
3313
3327
|
{ signal: requestSignal }
|
|
3314
3328
|
)
|
|
3315
|
-
)
|
|
3329
|
+
).catch((errorArg: unknown) => {
|
|
3330
|
+
throw isOpenCodePromptNotFoundError(errorArg, 'QuestionNotFoundError') ? promptNoLongerPending('question') : errorArg;
|
|
3331
|
+
});
|
|
3316
3332
|
if (typeof response !== 'boolean') {
|
|
3317
3333
|
throw new Error('OpenCode returned an invalid question result.');
|
|
3318
3334
|
}
|
|
@@ -3333,7 +3349,9 @@ export class OpenCodeClientAdapter implements IOpenCodeSessionIdentitySnapshotCa
|
|
|
3333
3349
|
},
|
|
3334
3350
|
{ signal: requestSignal }
|
|
3335
3351
|
)
|
|
3336
|
-
)
|
|
3352
|
+
).catch((errorArg: unknown) => {
|
|
3353
|
+
throw isOpenCodePromptNotFoundError(errorArg, 'QuestionNotFoundError') ? promptNoLongerPending('question') : errorArg;
|
|
3354
|
+
});
|
|
3337
3355
|
if (typeof response !== 'boolean') {
|
|
3338
3356
|
throw new Error('OpenCode returned an invalid question result.');
|
|
3339
3357
|
}
|
|
@@ -3365,7 +3383,9 @@ export class OpenCodeClientAdapter implements IOpenCodeSessionIdentitySnapshotCa
|
|
|
3365
3383
|
},
|
|
3366
3384
|
{ signal: requestSignal }
|
|
3367
3385
|
)
|
|
3368
|
-
)
|
|
3386
|
+
).catch((errorArg: unknown) => {
|
|
3387
|
+
throw isOpenCodePromptNotFoundError(errorArg, 'PermissionNotFoundError') ? promptNoLongerPending('permission') : errorArg;
|
|
3388
|
+
});
|
|
3369
3389
|
if (typeof response !== 'boolean') {
|
|
3370
3390
|
throw new Error('OpenCode returned an invalid permission result.');
|
|
3371
3391
|
}
|
|
@@ -40,6 +40,7 @@ You keep the owner's board true and the work moving. The owner talks to you thro
|
|
|
40
40
|
|
|
41
41
|
## Deployments
|
|
42
42
|
- What runs where is deploy_status, never your notes or memory. release_status says what a repository's next release would ship.
|
|
43
|
+
- deploy_status answers the status AGL checked last (its checkedAt); AGL checks every five minutes. Call deploy_refresh to check now when the answer must be current: after a release or land of your own the board should show at once, when the owner asks about deployments, or when checkedAt looks stale. It waits up to a minute; refreshing means the check runs on.
|
|
43
44
|
- Every deploy needs the owner's word, given on a deploy plan: a ticket whose deployPlan names the target and the release. AGL asks the owner on it (deploy now, in the next window, or hold) and closes the ticket once the target runs the release. The board pump plans one for a target that runs behind a release out for a day; you may plan one yourself (ticket_create or ticket_update deployPlan). Never deploy what waits for the owner's answer or is held.
|
|
44
45
|
- A plan assigned to a direct report is that report's subject: it deploys, and the owner's answer reaches it; route the pump's notices about it to that report. An unassigned plan is yours to deploy.
|
|
45
46
|
- When a deploy may run is the target's (deploy_status deployWhen): any time; only inside a maintenance window planned for it; or, for the AGL controller, when no session is busy. "Deploy now" is the owner's word to deploy at once, outside a window too. "In the next window" waits for the target's next window the owner gave: propose one when none is (a ticket with a maintenanceWindow: from, to, targets), which asks the owner and counts once approved. Only the owner answers a deploy plan's or a window's question. The controller is deployed with agl upgrade, which keeps its own owner gate.
|
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
import * as plugins from '../plugins.js';
|
|
2
|
-
import {
|
|
2
|
+
import {
|
|
3
|
+
fleetDeployTargetIdPattern, type IFleetDeployObservation, type IFleetDeployPlan, type IFleetDeployStatusFailure, type IFleetDeployTargetStatus,
|
|
4
|
+
type IFleetDeployWindow, type IFleetRepositoryReleaseStatus,
|
|
5
|
+
} from '../../ts_interfaces/deployments.js';
|
|
6
|
+
import { ticketColumns } from '../../ts_interfaces/tickets.js';
|
|
3
7
|
|
|
4
8
|
const timestamp = plugins.z.iso.datetime();
|
|
5
9
|
const version = plugins.z.string().regex(/^\d+\.\d+\.\d+(?:-[0-9A-Za-z.-]+)?$/u);
|
|
@@ -42,3 +46,111 @@ export class DeployObservationModel extends plugins.nosqldb.SmartDataDbDoc<Deplo
|
|
|
42
46
|
@plugins.nosqldb.svDb() public previousVersion?: string;
|
|
43
47
|
@plugins.nosqldb.svDb() public artifacts!: IFleetDeployObservation['artifacts'];
|
|
44
48
|
}
|
|
49
|
+
|
|
50
|
+
/** A maintenance window as stored: where it stands (scheduled, active, done) is derived from the clock when read. */
|
|
51
|
+
export type TDeployStoredWindow = Omit<IFleetDeployWindow, 'state'>;
|
|
52
|
+
/** A deploy plan as stored: the window it is queued into is derived from the clock when read. */
|
|
53
|
+
export type TDeployStoredPlan = Omit<IFleetDeployPlan, 'window'>;
|
|
54
|
+
/** A target's status as stored: whether a deploy may run now, the busy sessions and its windows are derived when read. */
|
|
55
|
+
export type TDeployStoredTarget = Omit<IFleetDeployTargetStatus, 'busySessions' | 'deployOpen' | 'windows' | 'deployPlans'> & {
|
|
56
|
+
deployPlans: TDeployStoredPlan[];
|
|
57
|
+
};
|
|
58
|
+
/**
|
|
59
|
+
* What one computation of the deploy monitor found (AGL-1704): every target's status, every maintenance window of a
|
|
60
|
+
* ticket that is not done, the release state of the repositories the targets, landed tickets and release plans name,
|
|
61
|
+
* and the tickets the `undeployed` AutoLabel marks. Nothing in it depends on the clock or on the sessions busy now.
|
|
62
|
+
*/
|
|
63
|
+
export type TDeployStatusContent = {
|
|
64
|
+
status: { targets: TDeployStoredTarget[]; windows: TDeployStoredWindow[] };
|
|
65
|
+
release: { repositories: IFleetRepositoryReleaseStatus[] };
|
|
66
|
+
undeployed: string[];
|
|
67
|
+
};
|
|
68
|
+
|
|
69
|
+
const label = plugins.z.string().max(1024);
|
|
70
|
+
const repoName = plugins.z.string().min(1).max(1024);
|
|
71
|
+
const ticketKey = plugins.z.string().min(1).max(64);
|
|
72
|
+
const deployTicketFields = { key: ticketKey, title: plugins.z.string().max(256), priority: plugins.z.enum(['none', 'low', 'normal', 'high', 'urgent']),
|
|
73
|
+
columnId: plugins.z.enum(ticketColumns), version: label.optional() };
|
|
74
|
+
const deployTicket = plugins.z.object(deployTicketFields).strict();
|
|
75
|
+
const release = plugins.z.object({ version: label, sha: plugins.z.string().regex(/^[a-f0-9]{7,64}$/u), taggedAt: timestamp.optional() }).strict();
|
|
76
|
+
const maintenanceWindow = plugins.z.object({ ...deployTicketFields, from: timestamp, to: timestamp, targets: plugins.z.array(targetId),
|
|
77
|
+
go: plugins.z.enum(['given', 'waiting', 'declined']), questionId: label.optional() }).strict();
|
|
78
|
+
const plan = plugins.z.object({ ...deployTicketFields, target: targetId, version: label, questionId: label,
|
|
79
|
+
go: plugins.z.enum(['waiting', 'now', 'window', 'idle', 'hold']), answeredAt: timestamp.optional(), assignee: label.optional() }).strict();
|
|
80
|
+
const releasePlanTicket = plugins.z.object({ ...deployTicketFields, plannedVersion: label.optional() }).strict();
|
|
81
|
+
const target = plugins.z.object({
|
|
82
|
+
id: targetId, name: label.optional(), environment: label.optional(), repo: repoName, project: label, deploys: label.optional(), downtime: label.optional(),
|
|
83
|
+
deployWhen: plugins.z.enum(['anytime', 'window']).optional(), builtIn: plugins.z.literal(true).optional(),
|
|
84
|
+
probe: plugins.z.discriminatedUnion('kind', [
|
|
85
|
+
plugins.z.object({ kind: plugins.z.literal('controller') }).strict(),
|
|
86
|
+
plugins.z.object({ kind: plugins.z.literal('http'), url: plugins.z.string().max(2048), versionPointer: label.optional(), shaPointer: label.optional() }).strict(),
|
|
87
|
+
]),
|
|
88
|
+
}).strict();
|
|
89
|
+
const storedTarget = plugins.z.object({
|
|
90
|
+
target, repository: repoName.optional(),
|
|
91
|
+
running: plugins.z.object({ version: label, sha: plugins.z.string().regex(/^[a-f0-9]{7,64}$/u).optional(), since: timestamp, previousVersion: label.optional(),
|
|
92
|
+
rolledBack: plugins.z.literal(true).optional(), untagged: plugins.z.literal(true).optional() }).strict().optional(),
|
|
93
|
+
probe: plugins.z.object({ state: plugins.z.enum(['up', 'down', 'unknown']), checkedAt: timestamp.optional(), downSince: timestamp.optional(),
|
|
94
|
+
error: plugins.z.string().max(2048).optional() }).strict(),
|
|
95
|
+
latest: release.optional(),
|
|
96
|
+
notRunning: plugins.z.object({ releases: plugins.z.array(release), tickets: plugins.z.array(deployTicket) }).strict(),
|
|
97
|
+
landedAfterLatest: plugins.z.array(deployTicket),
|
|
98
|
+
openBugs: plugins.z.array(plugins.z.object({ ...deployTicketFields, foundIn: label, fixLandedSha: plugins.z.string().regex(/^[a-f0-9]{7,64}$/u).optional(),
|
|
99
|
+
fixedIn: label.optional() }).strict()),
|
|
100
|
+
plans: plugins.z.array(releasePlanTicket),
|
|
101
|
+
deployWhen: plugins.z.enum(['anytime', 'window', 'idle']),
|
|
102
|
+
deployPlans: plugins.z.array(plan),
|
|
103
|
+
}).strict();
|
|
104
|
+
/**
|
|
105
|
+
* The content of the stored deploy status, parsed as it is loaded. Content this release cannot parse (another release
|
|
106
|
+
* wrote it, or it is damaged) is not served: the controller starts cold and its next computation overwrites it.
|
|
107
|
+
*/
|
|
108
|
+
export const deployStatusContentSchema: plugins.z.ZodType<TDeployStatusContent> = plugins.z.object({
|
|
109
|
+
status: plugins.z.object({ targets: plugins.z.array(storedTarget), windows: plugins.z.array(maintenanceWindow) }).strict(),
|
|
110
|
+
release: plugins.z.object({ repositories: plugins.z.array(plugins.z.object({ repo: repoName, id: label, latest: release.optional(),
|
|
111
|
+
plans: plugins.z.array(releasePlanTicket), landedAfterLatest: plugins.z.array(deployTicket), targets: plugins.z.array(targetId) }).strict()) }).strict(),
|
|
112
|
+
undeployed: plugins.z.array(ticketKey),
|
|
113
|
+
}).strict();
|
|
114
|
+
/** The last computation that failed, as stored beside the content it left standing. */
|
|
115
|
+
export const deployStatusFailureSchema: plugins.z.ZodType<IFleetDeployStatusFailure> = plugins.z.object({
|
|
116
|
+
at: timestamp, message: plugins.z.string().min(1).max(2048), reference: plugins.z.string().min(1).max(128),
|
|
117
|
+
}).strict();
|
|
118
|
+
|
|
119
|
+
/** The one stored deploy status of a controller: `<controllerId>:deployments`. */
|
|
120
|
+
export const deployStatusId = (controllerIdArg: string): string => `${controllerIdArg}:deployments`;
|
|
121
|
+
|
|
122
|
+
/**
|
|
123
|
+
* The stored deploy status (AGL-1704): one document per controller, which the deploy monitor writes after each
|
|
124
|
+
* computation and serves every read from. Its top level is fixed for good, since the exact client refuses a stored
|
|
125
|
+
* top-level field its model does not declare: `revision` moves when the content changes, `computedAt` is when the
|
|
126
|
+
* content was last computed (at least once per pass), and `failure` is the last computation that failed while the
|
|
127
|
+
* content stands. `content` and `failure` are plain objects here and parsed by the monitor as it loads them, so a
|
|
128
|
+
* document another release wrote is still read, and overwritten, by this one.
|
|
129
|
+
*/
|
|
130
|
+
export interface IDeployStatusDocument {
|
|
131
|
+
id: string;
|
|
132
|
+
controllerId: string;
|
|
133
|
+
revision: number;
|
|
134
|
+
computedAt: string;
|
|
135
|
+
content: Record<string, unknown>;
|
|
136
|
+
failure?: Record<string, unknown>;
|
|
137
|
+
}
|
|
138
|
+
const statusDocumentSchema = plugins.z.object({
|
|
139
|
+
id: plugins.z.string().min(1).max(512), controllerId: plugins.z.string().min(1).max(256), revision: plugins.z.number().int().nonnegative(),
|
|
140
|
+
computedAt: timestamp, content: plugins.z.record(plugins.z.string(), plugins.z.unknown()), failure: plugins.z.record(plugins.z.string(), plugins.z.unknown()).optional(),
|
|
141
|
+
}).strict();
|
|
142
|
+
|
|
143
|
+
@plugins.nosqldb.managed({ collectionName: 'agl_fleet_deploy_status' })
|
|
144
|
+
@plugins.nosqldb.exactPersistence({ assertDocument: (input: unknown) => {
|
|
145
|
+
const doc = statusDocumentSchema.parse(input);
|
|
146
|
+
if (doc.id !== deployStatusId(doc.controllerId)) throw new Error('Deploy status identity mismatch.');
|
|
147
|
+
} })
|
|
148
|
+
export class DeployStatusModel extends plugins.nosqldb.SmartDataDbDoc<DeployStatusModel, IDeployStatusDocument> {
|
|
149
|
+
declare static exact: plugins.nosqldb.TExact<DeployStatusModel>;
|
|
150
|
+
@plugins.nosqldb.unI() public id!: string;
|
|
151
|
+
@plugins.nosqldb.svDb() public controllerId!: string;
|
|
152
|
+
@plugins.nosqldb.svDb() public revision!: number;
|
|
153
|
+
@plugins.nosqldb.svDb() public computedAt!: string;
|
|
154
|
+
@plugins.nosqldb.svDb() public content!: Record<string, unknown>;
|
|
155
|
+
@plugins.nosqldb.svDb() public failure?: Record<string, unknown>;
|
|
156
|
+
}
|