agl 42.2.2 → 43.0.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 +24 -0
- package/dist_serve/bundle.js +6697 -5287
- package/dist_serve/bundle.js.map +2 -2
- package/dist_serve/bundle.js.third-party-notices.json +29 -29
- package/dist_serve/bundle.js.third-party-notices.txt +29 -29
- package/dist_serve/third-party-notices.md +597 -8
- package/dist_ts/00_commitinfo_data.js +1 -1
- package/dist_ts/aglapi/aglapisurface.document.js +114 -16
- package/dist_ts/aglapi/interfaces.d.ts +30 -0
- package/dist_ts/aglapi/interfaces.js +7 -1
- package/dist_ts/classes.authstore.d.ts +7 -0
- package/dist_ts/classes.authstore.js +12 -1
- package/dist_ts/classes.browserpainttransport.d.ts +2 -2
- package/dist_ts/classes.browserpainttransport.js +9 -8
- package/dist_ts/classes.browserresourcehost.js +30 -20
- package/dist_ts/classes.cli.js +10 -1
- package/dist_ts/classes.controller.d.ts +41 -11
- package/dist_ts/classes.controller.js +232 -52
- package/dist_ts/classes.harnessoperationmanager.d.ts +44 -0
- package/dist_ts/classes.harnessoperationmanager.js +15 -10
- package/dist_ts/classes.mcpclient.d.ts +5 -0
- package/dist_ts/classes.mcpclient.js +15 -3
- package/dist_ts/classes.mcpcontrollerhost.d.ts +3 -0
- package/dist_ts/classes.mcpcontrollerhost.js +17 -3
- package/dist_ts/classes.mcptools.d.ts +4 -3
- package/dist_ts/classes.mcptools.js +20 -1
- package/dist_ts/classes.mcpvalidation.js +4 -1
- package/dist_ts/classes.ticketstore.d.ts +71 -3
- package/dist_ts/classes.ticketstore.js +299 -12
- package/dist_ts/classes.validation.d.ts +2 -0
- package/dist_ts/classes.validation.js +27 -5
- package/dist_ts/driver/classes.directreports.d.ts +23 -3
- package/dist_ts/driver/classes.directreports.js +59 -2
- package/dist_ts/driver/classes.drivereventrelay.js +3 -2
- package/dist_ts/driver/functions.driverinstructions.d.ts +1 -1
- package/dist_ts/driver/functions.driverinstructions.js +12 -3
- package/dist_ts/driver/functions.drivertools.d.ts +4 -0
- package/dist_ts/driver/functions.drivertools.js +8 -2
- package/dist_ts/fleet/classes.boardpump.d.ts +53 -3
- package/dist_ts/fleet/classes.boardpump.js +237 -32
- package/dist_ts/fleet/classes.claudeworkers.d.ts +10 -3
- package/dist_ts/fleet/classes.claudeworkers.js +43 -19
- package/dist_ts/fleet/classes.codexworkers.d.ts +5 -3
- package/dist_ts/fleet/classes.codexworkers.js +26 -9
- package/dist_ts/fleet/classes.deploymonitor.d.ts +253 -0
- package/dist_ts/fleet/classes.deploymonitor.js +821 -0
- package/dist_ts/fleet/classes.gitfacts.d.ts +61 -0
- package/dist_ts/fleet/classes.gitfacts.js +125 -0
- package/dist_ts/fleet/classes.releasereconciler.d.ts +51 -0
- package/dist_ts/fleet/classes.releasereconciler.js +101 -0
- package/dist_ts/fleet/classes.service.d.ts +13 -1
- package/dist_ts/fleet/classes.service.js +76 -7
- package/dist_ts/fleet/classes.ticketeffects.d.ts +13 -0
- package/dist_ts/fleet/classes.ticketeffects.js +42 -8
- package/dist_ts/fleet/classes.workers.d.ts +10 -3
- package/dist_ts/fleet/classes.workers.js +18 -3
- package/dist_ts/fleet/functions.controllerbuild.d.ts +23 -0
- package/dist_ts/fleet/functions.controllerbuild.js +75 -0
- package/dist_ts/fleet/functions.deployprobes.d.ts +39 -0
- package/dist_ts/fleet/functions.deployprobes.js +82 -0
- package/dist_ts/fleet/functions.deployvalidation.d.ts +27 -0
- package/dist_ts/fleet/functions.deployvalidation.js +43 -0
- package/dist_ts/fleet/functions.release.d.ts +2 -1
- package/dist_ts/fleet/functions.release.js +32 -5
- package/dist_ts/fleet/functions.releasefacts.d.ts +42 -0
- package/dist_ts/fleet/functions.releasefacts.js +46 -0
- package/dist_ts/fleet/functions.validation.d.ts +3 -3
- package/dist_ts/fleet/functions.validation.js +4 -7
- package/dist_ts/fleet/functions.watchprobes.js +7 -9
- package/dist_ts/fleet/functions.workervalidation.js +4 -3
- package/dist_ts/fleet/interfaces.workers.d.ts +30 -3
- package/dist_ts/fleet/interfaces.workers.js +14 -1
- package/dist_ts/functions.deploycli.d.ts +36 -0
- package/dist_ts/functions.deploycli.js +157 -0
- package/dist_ts/functions.mcpdeploytools.d.ts +13 -0
- package/dist_ts/functions.mcpdeploytools.js +16 -0
- package/dist_ts/functions.mcptickettools.d.ts +54 -0
- package/dist_ts/functions.mcptickettools.js +8 -7
- package/dist_ts/functions.ticketautolabels.d.ts +2 -0
- package/dist_ts/functions.ticketautolabels.js +9 -3
- package/dist_ts/functions.ticketcli.d.ts +16 -2
- package/dist_ts/functions.ticketcli.js +105 -27
- package/dist_ts/functions.ticketvalidation.d.ts +55 -0
- package/dist_ts/functions.ticketvalidation.js +26 -8
- package/dist_ts_interfaces/deployments.d.ts +241 -0
- package/dist_ts_interfaces/deployments.js +5 -6
- package/dist_ts_interfaces/fleet.d.ts +12 -0
- package/dist_ts_interfaces/fleetworkers.d.ts +21 -1
- package/dist_ts_interfaces/functions.fleetversion.d.ts +4 -0
- package/dist_ts_interfaces/functions.fleetversion.js +25 -0
- package/dist_ts_interfaces/interfaces.d.ts +4 -2
- package/dist_ts_interfaces/interfaces.js +4 -2
- package/dist_ts_interfaces/mcprequests.d.ts +3 -2
- package/dist_ts_interfaces/mcprequests.js +3 -1
- package/dist_ts_interfaces/requests.d.ts +3 -2
- package/dist_ts_interfaces/requests.directreports.d.ts +58 -6
- package/dist_ts_interfaces/requests.js +1 -1
- package/dist_ts_interfaces/requests.tickets.d.ts +25 -5
- package/dist_ts_interfaces/requests.tickets.js +2 -2
- package/dist_ts_interfaces/tickets.d.ts +71 -6
- package/dist_ts_interfaces/tickets.js +34 -6
- package/dist_ts_migration/classes.documentmigrationrunner.d.ts +7 -0
- package/dist_ts_migration/classes.documentmigrationrunner.js +14 -1
- package/dist_ts_migration/index.d.ts +2 -0
- package/dist_ts_migration/index.js +3 -1
- package/dist_ts_migration/v41_ticketclosedcolumn.d.ts +20 -0
- package/dist_ts_migration/v41_ticketclosedcolumn.js +118 -0
- package/dist_ts_migration/v41_ticketlinkrepos.d.ts +24 -0
- package/dist_ts_migration/v41_ticketlinkrepos.js +101 -0
- package/package.json +6 -2
- package/readme.md +308 -36
- package/third-party-notices.md +597 -8
- package/ts/00_commitinfo_data.ts +1 -1
- package/ts/aglapi/aglapisurface.document.ts +113 -15
- package/ts/aglapi/interfaces.ts +6 -0
- package/ts/classes.authstore.ts +13 -0
- package/ts/classes.browserpainttransport.ts +8 -7
- package/ts/classes.browserresourcehost.ts +38 -14
- package/ts/classes.cli.ts +9 -0
- package/ts/classes.controller.ts +244 -61
- package/ts/classes.harnessoperationmanager.ts +20 -14
- package/ts/classes.mcpclient.ts +17 -2
- package/ts/classes.mcpcontrollerhost.ts +18 -2
- package/ts/classes.mcptools.ts +21 -2
- package/ts/classes.mcpvalidation.ts +2 -0
- package/ts/classes.ticketstore.ts +312 -13
- package/ts/classes.validation.ts +28 -4
- package/ts/driver/classes.directreports.ts +58 -3
- package/ts/driver/classes.drivereventrelay.ts +2 -1
- package/ts/driver/functions.driverinstructions.ts +11 -2
- package/ts/driver/functions.drivertools.ts +10 -2
- package/ts/fleet/classes.boardpump.ts +235 -28
- package/ts/fleet/classes.claudeworkers.ts +36 -15
- package/ts/fleet/classes.codexworkers.ts +24 -7
- package/ts/fleet/classes.deploymonitor.ts +854 -0
- package/ts/fleet/classes.gitfacts.ts +135 -0
- package/ts/fleet/classes.releasereconciler.ts +103 -0
- package/ts/fleet/classes.service.ts +81 -8
- package/ts/fleet/classes.ticketeffects.ts +38 -6
- package/ts/fleet/classes.workers.ts +19 -5
- package/ts/fleet/functions.controllerbuild.ts +84 -0
- package/ts/fleet/functions.deployprobes.ts +84 -0
- package/ts/fleet/functions.deployvalidation.ts +50 -0
- package/ts/fleet/functions.release.ts +32 -3
- package/ts/fleet/functions.releasefacts.ts +74 -0
- package/ts/fleet/functions.validation.ts +3 -6
- package/ts/fleet/functions.watchprobes.ts +6 -8
- package/ts/fleet/functions.workervalidation.ts +3 -2
- package/ts/fleet/interfaces.workers.ts +23 -3
- package/ts/functions.deploycli.ts +156 -0
- package/ts/functions.mcpdeploytools.ts +18 -0
- package/ts/functions.mcptickettools.ts +7 -6
- package/ts/functions.ticketautolabels.ts +10 -2
- package/ts/functions.ticketcli.ts +100 -24
- package/ts/functions.ticketvalidation.ts +26 -7
- package/ts_interfaces/deployments.ts +194 -0
- package/ts_interfaces/fleet.ts +17 -2
- package/ts_interfaces/fleetworkers.ts +20 -0
- package/ts_interfaces/functions.fleetversion.ts +20 -0
- package/ts_interfaces/interfaces.ts +3 -1
- package/ts_interfaces/mcprequests.ts +3 -0
- package/ts_interfaces/requests.directreports.ts +52 -8
- package/ts_interfaces/requests.tickets.ts +20 -4
- package/ts_interfaces/requests.ts +6 -1
- package/ts_interfaces/tickets.ts +53 -6
- package/ts_migration/classes.documentmigrationrunner.ts +15 -0
- package/ts_migration/index.ts +2 -0
- package/ts_migration/v41_ticketclosedcolumn.ts +106 -0
- package/ts_migration/v41_ticketlinkrepos.ts +91 -0
- package/ts_web/00_commitinfo_data.ts +1 -1
- package/ts_web/elements.deployments.ts +1066 -0
- package/ts_web/elements.directreport.ts +2 -2
- package/ts_web/elements.directreportsession.ts +5 -5
- package/ts_web/elements.harnesscontrollerapp.ts +179 -13
- package/ts_web/elements.makedirectreport.ts +444 -0
- package/ts_web/elements.nativesession.ts +29 -1
- package/ts_web/elements.ticketboard.ts +74 -18
- package/ts_web/functions.deployments.ts +231 -0
- package/ts_web/functions.sessionchat.ts +2 -0
|
@@ -0,0 +1,444 @@
|
|
|
1
|
+
import * as plugins from './plugins.js';
|
|
2
|
+
import * as interfaces from '../ts_interfaces/index.js';
|
|
3
|
+
import { errorText, harnessNames, type IFleetWorkerSender } from './elements.fleetworker.js';
|
|
4
|
+
|
|
5
|
+
const { html, css } = plugins.deesElement;
|
|
6
|
+
|
|
7
|
+
/** How often an open dialog asks the controller again whether its session can become a direct report. */
|
|
8
|
+
export const makeDirectReportPreflightMs = 3_000;
|
|
9
|
+
|
|
10
|
+
/** A session the dialog can make a direct report, as a session feed row names it. */
|
|
11
|
+
export interface IMakeDirectReportCandidate {
|
|
12
|
+
/** The row's id. */
|
|
13
|
+
key: string;
|
|
14
|
+
label: string;
|
|
15
|
+
session: interfaces.IControllerNativeSessionRef;
|
|
16
|
+
/** Tickets bound to the session; the first is the driver ticket offered first. */
|
|
17
|
+
ticketKeys: string[];
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
/** A session view's ask to make its session a direct report, which the page answers with the dialog. */
|
|
21
|
+
export interface IMakeDirectReportRequestDetail {
|
|
22
|
+
session: interfaces.IControllerNativeSessionRef;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
/** Whether the dialog's footer offers the submit: the session can become a report and the form is complete. */
|
|
26
|
+
export interface IMakeDirectReportStateDetail {
|
|
27
|
+
ready: boolean;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
type TPreflight = interfaces.IReq_ControllerDirectReportPreflight['response'];
|
|
31
|
+
|
|
32
|
+
const pathNotes: Record<TPreflight['path'], string> = {
|
|
33
|
+
appoint: 'A fleet worker runs this session: it is appointed, and steered through its own ticket.',
|
|
34
|
+
reference: 'A Codex thread is adopted by reference: no fleet worker is created, and the report reads and messages the thread through the shared Codex server.',
|
|
35
|
+
relaunch: 'The fleet resumes this Claude Code session under its own control with the prompt below, as a worker bound to the driver ticket. A background session continues as a copy under a new session id.',
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
/** The tickets a driver ticket is picked from: those not landed or released. */
|
|
39
|
+
const settledColumns: ReadonlySet<interfaces.TTicketColumn> = new Set(['landed', 'released']);
|
|
40
|
+
|
|
41
|
+
/** A report name from a session's name: what the controller accepts, lower case. */
|
|
42
|
+
export const directReportNameFrom = (textArg: string): string => (
|
|
43
|
+
textArg.toLowerCase().replace(/[^a-z0-9._-]+/gu, '-').replace(/^[^a-z0-9]+/u, '').slice(0, 40).replace(/[-.]+$/u, '')
|
|
44
|
+
);
|
|
45
|
+
/** A report's and a fleet worker's name, as the controller accepts them. */
|
|
46
|
+
const namePattern = /^[a-zA-Z0-9][a-zA-Z0-9._-]{0,127}$/u;
|
|
47
|
+
|
|
48
|
+
const defaultPrompt = (ticketKeyArg: string): string => (
|
|
49
|
+
`You are now a direct report of the AGL driver, which reaches you through ticket ${ticketKeyArg || '(the driver ticket)'}. `
|
|
50
|
+
+ 'Carry on with your work and end each turn on a `result:` or `needs input:` line.'
|
|
51
|
+
);
|
|
52
|
+
|
|
53
|
+
/**
|
|
54
|
+
* Makes a session a direct report of the driver. It asks the controller which way the session takes (a fleet
|
|
55
|
+
* worker's session is appointed, a Codex thread adopted by reference, a Claude Code session relaunched under the
|
|
56
|
+
* fleet's control) and what refuses that now, and asks again every few seconds while it is open, so a session that
|
|
57
|
+
* settles or a project that lets go of it unblocks the dialog. The owner names the report and, unless it is
|
|
58
|
+
* appointed, its driver ticket; a relaunch also takes a Claude profile, a directory, a worker name and the prompt it
|
|
59
|
+
* resumes with. Submitting appoints or adopts, which checks everything again.
|
|
60
|
+
*/
|
|
61
|
+
@plugins.deesElement.customElement('agl-make-direct-report')
|
|
62
|
+
export class AglMakeDirectReport extends plugins.deesElement.DeesElement {
|
|
63
|
+
@plugins.deesElement.property({ attribute: false })
|
|
64
|
+
accessor sender: IFleetWorkerSender | undefined;
|
|
65
|
+
|
|
66
|
+
/** The sessions to choose from; with one, the dialog shows no choice. */
|
|
67
|
+
@plugins.deesElement.property({ attribute: false })
|
|
68
|
+
accessor candidates: IMakeDirectReportCandidate[] = [];
|
|
69
|
+
|
|
70
|
+
@plugins.deesElement.property()
|
|
71
|
+
accessor selectedKey = '';
|
|
72
|
+
|
|
73
|
+
@plugins.deesElement.state()
|
|
74
|
+
accessor preflight: TPreflight | undefined;
|
|
75
|
+
|
|
76
|
+
@plugins.deesElement.state()
|
|
77
|
+
accessor preflightError = '';
|
|
78
|
+
|
|
79
|
+
@plugins.deesElement.state()
|
|
80
|
+
accessor tickets: interfaces.ITicket[] = [];
|
|
81
|
+
|
|
82
|
+
/** The owner's own entries; undefined keeps the default the session suggests. */
|
|
83
|
+
@plugins.deesElement.state()
|
|
84
|
+
accessor name: string | undefined;
|
|
85
|
+
|
|
86
|
+
@plugins.deesElement.state()
|
|
87
|
+
accessor ticketKey: string | undefined;
|
|
88
|
+
|
|
89
|
+
@plugins.deesElement.state()
|
|
90
|
+
accessor profile: string | undefined;
|
|
91
|
+
|
|
92
|
+
@plugins.deesElement.state()
|
|
93
|
+
accessor cwd: string | undefined;
|
|
94
|
+
|
|
95
|
+
@plugins.deesElement.state()
|
|
96
|
+
accessor workerName = '';
|
|
97
|
+
|
|
98
|
+
@plugins.deesElement.state()
|
|
99
|
+
accessor prompt: string | undefined;
|
|
100
|
+
|
|
101
|
+
@plugins.deesElement.state()
|
|
102
|
+
accessor reportsTo = '';
|
|
103
|
+
|
|
104
|
+
@plugins.deesElement.state()
|
|
105
|
+
accessor submitting = false;
|
|
106
|
+
|
|
107
|
+
@plugins.deesElement.state()
|
|
108
|
+
accessor submitError = '';
|
|
109
|
+
|
|
110
|
+
/** Advances whenever the chosen session or what its preflight asks changes; older replies are dropped. */
|
|
111
|
+
private generation = 0;
|
|
112
|
+
private preflightTimer: ReturnType<typeof setTimeout> | undefined;
|
|
113
|
+
private preflightAbort: AbortController | undefined;
|
|
114
|
+
private ticketsRead = false;
|
|
115
|
+
private lastReady = false;
|
|
116
|
+
|
|
117
|
+
public static styles = [
|
|
118
|
+
plugins.deesElement.cssManager.defaultStyles,
|
|
119
|
+
css`
|
|
120
|
+
:host { display: block; }
|
|
121
|
+
.form { display: flex; flex-direction: column; gap: var(--dees-spacing-md); }
|
|
122
|
+
.session { color: var(--dees-color-text-secondary); font-size: var(--dees-font-caption1-size); overflow-wrap: anywhere; }
|
|
123
|
+
`,
|
|
124
|
+
];
|
|
125
|
+
|
|
126
|
+
public async connectedCallback(): Promise<void> {
|
|
127
|
+
const reconnected = this.hasUpdated;
|
|
128
|
+
await super.connectedCallback();
|
|
129
|
+
if (reconnected) {
|
|
130
|
+
this.readPreflight();
|
|
131
|
+
void this.readTickets();
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
public async disconnectedCallback(): Promise<void> {
|
|
136
|
+
this.stopPreflight();
|
|
137
|
+
await super.disconnectedCallback();
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
/** Chooses the first session within the same update, so the first preflight asks for it once. */
|
|
141
|
+
public willUpdate(changedArg: Map<PropertyKey, unknown>): void {
|
|
142
|
+
if (changedArg.has('candidates') && !this.candidate() && this.candidates[0]) this.selectedKey = this.candidates[0].key;
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
public updated(changedArg: Map<PropertyKey, unknown>): void {
|
|
146
|
+
if (changedArg.has('selectedKey') && changedArg.get('selectedKey') !== undefined) this.chooseSession();
|
|
147
|
+
else if (changedArg.has('sender') || changedArg.has('selectedKey')) {
|
|
148
|
+
this.readPreflight();
|
|
149
|
+
void this.readTickets();
|
|
150
|
+
}
|
|
151
|
+
const ready = this.ready();
|
|
152
|
+
if (ready !== this.lastReady) {
|
|
153
|
+
this.lastReady = ready;
|
|
154
|
+
this.dispatchEvent(new CustomEvent<IMakeDirectReportStateDetail>('agl-make-direct-report-state', { detail: { ready } }));
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
/** The chosen session, if the candidates still hold it. */
|
|
159
|
+
public candidate(): IMakeDirectReportCandidate | undefined {
|
|
160
|
+
return this.candidates.find((candidateArg) => candidateArg.key === this.selectedKey);
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
/** Whether the preflight names no refusal and the form holds what the path needs. */
|
|
164
|
+
public ready(): boolean {
|
|
165
|
+
const preflight = this.preflight;
|
|
166
|
+
if (!preflight || preflight.blockers.length > 0 || this.preflightError || !this.candidate()) return false;
|
|
167
|
+
if (!namePattern.test(this.reportName())) return false;
|
|
168
|
+
if (preflight.path === 'appoint') return Boolean(preflight.workerName);
|
|
169
|
+
if (!this.chosenTicketKey()) return false;
|
|
170
|
+
if (preflight.path === 'reference') return true;
|
|
171
|
+
return Boolean(preflight.profile) && this.relaunchPrompt().trim().length > 0
|
|
172
|
+
&& (!this.workerName || namePattern.test(this.workerName));
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
/**
|
|
176
|
+
* Appoints or adopts the chosen session as the preflight's path says. Resolves to the report it made, or to
|
|
177
|
+
* `undefined` once the controller refused, with the reason shown.
|
|
178
|
+
*/
|
|
179
|
+
public async submit(): Promise<interfaces.IDirectReportView | undefined> {
|
|
180
|
+
const { sender, preflight } = this;
|
|
181
|
+
const candidate = this.candidate();
|
|
182
|
+
if (!sender || !preflight || !candidate || this.submitting || !this.ready()) return undefined;
|
|
183
|
+
const name = this.reportName();
|
|
184
|
+
const superior = preflight.reportsTo.find((entryArg) => entryArg.superior.kind === this.reportsTo)?.superior
|
|
185
|
+
?? preflight.reportsTo[0]?.superior;
|
|
186
|
+
const reportsTo = superior ? { reportsTo: superior } : {};
|
|
187
|
+
this.submitting = true;
|
|
188
|
+
this.submitError = '';
|
|
189
|
+
try {
|
|
190
|
+
if (preflight.path === 'appoint') {
|
|
191
|
+
const { report } = await sender.fire<interfaces.IReq_ControllerDirectReportAppoint>('controller.directreport.appoint', {
|
|
192
|
+
name, workerName: preflight.workerName!, ...reportsTo,
|
|
193
|
+
});
|
|
194
|
+
return report;
|
|
195
|
+
}
|
|
196
|
+
const cwd = this.cwd?.trim();
|
|
197
|
+
const { report } = await sender.fire<interfaces.IReq_ControllerDirectReportAdopt>('controller.directreport.adopt', {
|
|
198
|
+
name,
|
|
199
|
+
harness: candidate.session.harness,
|
|
200
|
+
nativeId: candidate.session.nativeId,
|
|
201
|
+
driverTicketKey: this.chosenTicketKey(),
|
|
202
|
+
...(preflight.path === 'relaunch'
|
|
203
|
+
? {
|
|
204
|
+
relaunch: {
|
|
205
|
+
profile: preflight.profile!,
|
|
206
|
+
prompt: this.relaunchPrompt(),
|
|
207
|
+
...(cwd && cwd !== preflight.session?.cwd ? { cwd } : {}),
|
|
208
|
+
...(this.workerName ? { workerName: this.workerName } : {}),
|
|
209
|
+
},
|
|
210
|
+
}
|
|
211
|
+
: {}),
|
|
212
|
+
...reportsTo,
|
|
213
|
+
});
|
|
214
|
+
return report;
|
|
215
|
+
} catch (errorArg) {
|
|
216
|
+
this.submitError = errorText(errorArg);
|
|
217
|
+
this.readPreflight();
|
|
218
|
+
return undefined;
|
|
219
|
+
} finally {
|
|
220
|
+
this.submitting = false;
|
|
221
|
+
}
|
|
222
|
+
}
|
|
223
|
+
|
|
224
|
+
public render(): plugins.deesElement.TemplateResult {
|
|
225
|
+
const preflight = this.preflight;
|
|
226
|
+
const candidate = this.candidate();
|
|
227
|
+
const session = preflight?.session;
|
|
228
|
+
const options = this.candidates.map((candidateArg) => ({ option: candidateArg.label, key: candidateArg.key }));
|
|
229
|
+
const reportsToOptions = (preflight?.reportsTo ?? []).map((entryArg) => ({ option: entryArg.label, key: entryArg.superior.kind }));
|
|
230
|
+
const ticketOptions = this.ticketOptions();
|
|
231
|
+
const profileOptions = (preflight?.profiles ?? []).map((profileArg) => ({ option: profileArg, key: profileArg }));
|
|
232
|
+
const ticketKey = this.chosenTicketKey();
|
|
233
|
+
return html`
|
|
234
|
+
<div class="form">
|
|
235
|
+
${this.candidates.length > 1
|
|
236
|
+
? html`
|
|
237
|
+
<dees-input-dropdown class="sessionSelect" label="Session"
|
|
238
|
+
.options=${options}
|
|
239
|
+
.selectedOption=${options.find((optionArg) => optionArg.key === this.selectedKey) ?? null}
|
|
240
|
+
.enableSearch=${true}
|
|
241
|
+
@selectedOption=${(eventArg: CustomEvent<{ key?: unknown }>) => {
|
|
242
|
+
if (typeof eventArg.detail?.key === 'string') this.selectedKey = eventArg.detail.key;
|
|
243
|
+
}}></dees-input-dropdown>
|
|
244
|
+
`
|
|
245
|
+
: ''}
|
|
246
|
+
${candidate
|
|
247
|
+
? html`<div class="session">${harnessNames[candidate.session.harness]} · ${session?.title ?? candidate.label}
|
|
248
|
+
· ${session?.cwd ?? ''} · ${candidate.session.nativeId}</div>`
|
|
249
|
+
: html`<dees-hint .type=${'info'} .text=${'No session to make a direct report.'}></dees-hint>`}
|
|
250
|
+
${preflight ? html`<dees-hint class="pathNote" .type=${'info'} .text=${pathNotes[preflight.path]}></dees-hint>` : ''}
|
|
251
|
+
${this.preflightError ? html`<dees-hint class="blocker" .type=${'error'} .text=${this.preflightError}></dees-hint>` : ''}
|
|
252
|
+
${(preflight?.blockers ?? []).map((blockerArg) => html`
|
|
253
|
+
<dees-hint class="blocker" data-code=${blockerArg.code} .type=${'error'} .text=${blockerArg.message}></dees-hint>
|
|
254
|
+
`)}
|
|
255
|
+
<dees-input-dropdown class="reportsToSelect" label="Reports to"
|
|
256
|
+
.options=${reportsToOptions}
|
|
257
|
+
.selectedOption=${reportsToOptions.find((optionArg) => optionArg.key === this.reportsTo) ?? reportsToOptions[0] ?? null}
|
|
258
|
+
.enableSearch=${false}
|
|
259
|
+
@selectedOption=${(eventArg: CustomEvent<{ key?: unknown }>) => {
|
|
260
|
+
if (typeof eventArg.detail?.key === 'string') this.reportsTo = eventArg.detail.key;
|
|
261
|
+
}}></dees-input-dropdown>
|
|
262
|
+
<dees-input-text class="nameInput" label="Report name" .value=${this.reportName()}
|
|
263
|
+
description="Letters, digits, dots, dashes and underscores; a retired report's name stays taken."
|
|
264
|
+
@input=${(eventArg: Event) => { this.name = this.inputValue(eventArg); }}></dees-input-text>
|
|
265
|
+
${preflight && preflight.path !== 'appoint'
|
|
266
|
+
? html`
|
|
267
|
+
<dees-input-dropdown class="ticketSelect" label="Driver ticket"
|
|
268
|
+
.options=${ticketOptions}
|
|
269
|
+
.selectedOption=${ticketOptions.find((optionArg) => optionArg.key === ticketKey) ?? null}
|
|
270
|
+
.enableSearch=${true}
|
|
271
|
+
placeholder="Choose the ticket the driver reaches the report through"
|
|
272
|
+
@selectedOption=${(eventArg: CustomEvent<{ key?: unknown }>) => {
|
|
273
|
+
if (typeof eventArg.detail?.key === 'string') this.ticketKey = eventArg.detail.key;
|
|
274
|
+
}}></dees-input-dropdown>
|
|
275
|
+
`
|
|
276
|
+
: ''}
|
|
277
|
+
${preflight?.path === 'relaunch'
|
|
278
|
+
? html`
|
|
279
|
+
<dees-input-dropdown class="profileSelect" label="Claude profile"
|
|
280
|
+
.options=${profileOptions}
|
|
281
|
+
.selectedOption=${profileOptions.find((optionArg) => optionArg.key === preflight.profile) ?? null}
|
|
282
|
+
.enableSearch=${false}
|
|
283
|
+
@selectedOption=${(eventArg: CustomEvent<{ key?: unknown }>) => {
|
|
284
|
+
if (typeof eventArg.detail?.key !== 'string') return;
|
|
285
|
+
this.profile = eventArg.detail.key;
|
|
286
|
+
this.readPreflight(true);
|
|
287
|
+
}}></dees-input-dropdown>
|
|
288
|
+
<dees-input-text class="cwdInput" label="Directory" .value=${this.cwd ?? preflight.cwd ?? ''}
|
|
289
|
+
@input=${(eventArg: Event) => { this.cwd = this.inputValue(eventArg); }}
|
|
290
|
+
@change=${() => this.readPreflight(true)}></dees-input-text>
|
|
291
|
+
<dees-input-text class="workerNameInput" label="Worker name" .value=${this.workerName}
|
|
292
|
+
placeholder=${this.reportName() || 'the report name'}
|
|
293
|
+
description="The fleet worker's name; the report's name when left empty."
|
|
294
|
+
@input=${(eventArg: Event) => { this.workerName = this.inputValue(eventArg).trim(); }}></dees-input-text>
|
|
295
|
+
<dees-input-textarea class="promptInput" label="Relaunch prompt" .rows=${4} .value=${this.relaunchPrompt()}
|
|
296
|
+
@input=${(eventArg: Event) => { this.prompt = this.inputValue(eventArg); }}></dees-input-textarea>
|
|
297
|
+
`
|
|
298
|
+
: ''}
|
|
299
|
+
${this.submitError ? html`<dees-hint class="submitError" .type=${'error'} .text=${this.submitError}></dees-hint>` : ''}
|
|
300
|
+
</div>
|
|
301
|
+
`;
|
|
302
|
+
}
|
|
303
|
+
|
|
304
|
+
private inputValue(eventArg: Event): string {
|
|
305
|
+
const value = (eventArg.target as { value?: unknown } | null)?.value;
|
|
306
|
+
return typeof value === 'string' ? value : '';
|
|
307
|
+
}
|
|
308
|
+
|
|
309
|
+
/** The report name: the owner's, else the bound worker's, else one made from the session's name. */
|
|
310
|
+
private reportName(): string {
|
|
311
|
+
if (this.name !== undefined) return this.name.trim();
|
|
312
|
+
const preflight = this.preflight;
|
|
313
|
+
if (preflight?.workerName) return preflight.workerName;
|
|
314
|
+
return directReportNameFrom(preflight?.session?.title ?? this.candidate()?.label ?? '');
|
|
315
|
+
}
|
|
316
|
+
|
|
317
|
+
private chosenTicketKey(): string {
|
|
318
|
+
return this.ticketKey ?? this.candidate()?.ticketKeys[0] ?? '';
|
|
319
|
+
}
|
|
320
|
+
|
|
321
|
+
private relaunchPrompt(): string {
|
|
322
|
+
return this.prompt ?? defaultPrompt(this.chosenTicketKey());
|
|
323
|
+
}
|
|
324
|
+
|
|
325
|
+
/** The open tickets, and the chosen one whatever its column. */
|
|
326
|
+
private ticketOptions(): Array<{ option: string; key: string }> {
|
|
327
|
+
const chosen = this.chosenTicketKey();
|
|
328
|
+
const tickets = this.tickets.filter((ticketArg) => !settledColumns.has(ticketArg.columnId) || ticketArg.key === chosen);
|
|
329
|
+
const options = tickets.map((ticketArg) => ({ option: `${ticketArg.key} · ${ticketArg.title}`, key: ticketArg.key }));
|
|
330
|
+
return chosen && !options.some((optionArg) => optionArg.key === chosen) ? [{ option: chosen, key: chosen }, ...options] : options;
|
|
331
|
+
}
|
|
332
|
+
|
|
333
|
+
/** Another session: what was entered for the last one does not carry over. */
|
|
334
|
+
private chooseSession(): void {
|
|
335
|
+
this.preflight = undefined;
|
|
336
|
+
this.preflightError = '';
|
|
337
|
+
this.submitError = '';
|
|
338
|
+
this.name = undefined;
|
|
339
|
+
this.ticketKey = undefined;
|
|
340
|
+
this.profile = undefined;
|
|
341
|
+
this.cwd = undefined;
|
|
342
|
+
this.workerName = '';
|
|
343
|
+
this.prompt = undefined;
|
|
344
|
+
this.readPreflight();
|
|
345
|
+
}
|
|
346
|
+
|
|
347
|
+
private stopPreflight(): void {
|
|
348
|
+
this.generation += 1;
|
|
349
|
+
clearTimeout(this.preflightTimer);
|
|
350
|
+
this.preflightTimer = undefined;
|
|
351
|
+
this.preflightAbort?.abort();
|
|
352
|
+
this.preflightAbort = undefined;
|
|
353
|
+
}
|
|
354
|
+
|
|
355
|
+
/**
|
|
356
|
+
* Asks the controller now how the chosen session becomes a direct report, and again every few seconds while the
|
|
357
|
+
* dialog is open. `changedArg` says the profile or directory asked for changed, so the reply to the earlier ask is
|
|
358
|
+
* stale and the current one hides until the new reply arrives.
|
|
359
|
+
*/
|
|
360
|
+
private readPreflight(changedArg = false): void {
|
|
361
|
+
this.stopPreflight();
|
|
362
|
+
const { sender } = this;
|
|
363
|
+
const candidate = this.candidate();
|
|
364
|
+
if (!sender || !candidate || !this.isConnected) return;
|
|
365
|
+
if (changedArg) this.preflight = undefined;
|
|
366
|
+
const generation = this.generation;
|
|
367
|
+
const abort = new AbortController();
|
|
368
|
+
this.preflightAbort = abort;
|
|
369
|
+
const cwd = this.cwd?.trim();
|
|
370
|
+
sender.fire<interfaces.IReq_ControllerDirectReportPreflight>('controller.directreport.preflight', {
|
|
371
|
+
session: candidate.session,
|
|
372
|
+
...(this.profile ? { profile: this.profile } : {}),
|
|
373
|
+
...(cwd?.startsWith('/') ? { cwd } : {}),
|
|
374
|
+
}, { abortSignal: abort.signal }).then((responseArg) => {
|
|
375
|
+
if (generation !== this.generation) return;
|
|
376
|
+
this.preflight = responseArg;
|
|
377
|
+
this.preflightError = '';
|
|
378
|
+
}, (errorArg: unknown) => {
|
|
379
|
+
if (generation !== this.generation) return;
|
|
380
|
+
this.preflightError = errorText(errorArg);
|
|
381
|
+
}).finally(() => {
|
|
382
|
+
if (generation !== this.generation || !this.isConnected) return;
|
|
383
|
+
this.preflightAbort = undefined;
|
|
384
|
+
this.preflightTimer = setTimeout(() => this.readPreflight(), makeDirectReportPreflightMs);
|
|
385
|
+
});
|
|
386
|
+
}
|
|
387
|
+
|
|
388
|
+
/** Reads the board's tickets once; a host without tickets offers only the session's own. */
|
|
389
|
+
private async readTickets(): Promise<void> {
|
|
390
|
+
const { sender } = this;
|
|
391
|
+
if (!sender || this.ticketsRead) return;
|
|
392
|
+
this.ticketsRead = true;
|
|
393
|
+
try {
|
|
394
|
+
const { tickets } = await sender.fire<interfaces.TControllerTicketTypedRequest>('controller.ticket.list', {}) as
|
|
395
|
+
interfaces.TTicketResponse<'list'>;
|
|
396
|
+
this.tickets = [...tickets].sort((leftArg, rightArg) => rightArg.updatedAt.localeCompare(leftArg.updatedAt));
|
|
397
|
+
} catch {
|
|
398
|
+
this.ticketsRead = false;
|
|
399
|
+
}
|
|
400
|
+
}
|
|
401
|
+
}
|
|
402
|
+
|
|
403
|
+
/**
|
|
404
|
+
* Opens the Make direct report dialog over the page for `candidatesArg`, `selectedKeyArg` chosen first. Its footer
|
|
405
|
+
* submits once the session can become a report; `onMadeArg` runs with the report made, after the dialog closed.
|
|
406
|
+
*/
|
|
407
|
+
export const showMakeDirectReportDialog = async (optionsArg: {
|
|
408
|
+
sender: IFleetWorkerSender;
|
|
409
|
+
candidates: IMakeDirectReportCandidate[];
|
|
410
|
+
selectedKey?: string;
|
|
411
|
+
onMade?: (reportArg: interfaces.IDirectReportView) => void;
|
|
412
|
+
}): Promise<InstanceType<typeof plugins.deesCatalog.DeesModal>> => {
|
|
413
|
+
const element = new AglMakeDirectReport();
|
|
414
|
+
element.sender = optionsArg.sender;
|
|
415
|
+
element.candidates = optionsArg.candidates;
|
|
416
|
+
element.selectedKey = optionsArg.selectedKey ?? optionsArg.candidates[0]?.key ?? '';
|
|
417
|
+
const menuOptions = (stateArg: IMakeDirectReportStateDetail): plugins.deesCatalog.IActionFooterAction<
|
|
418
|
+
InstanceType<typeof plugins.deesCatalog.DeesModal>
|
|
419
|
+
>[] => [
|
|
420
|
+
{ name: 'Cancel', action: async (modalArg) => modalArg?.destroy() },
|
|
421
|
+
{
|
|
422
|
+
name: 'Make direct report',
|
|
423
|
+
primary: true,
|
|
424
|
+
disabled: !stateArg.ready,
|
|
425
|
+
action: async (modalArg) => {
|
|
426
|
+
const report = await element.submit();
|
|
427
|
+
if (!report) return;
|
|
428
|
+
await modalArg?.destroy();
|
|
429
|
+
optionsArg.onMade?.(report);
|
|
430
|
+
},
|
|
431
|
+
},
|
|
432
|
+
];
|
|
433
|
+
const modal = await plugins.deesCatalog.DeesModal.createAndShow({
|
|
434
|
+
heading: 'Make direct report',
|
|
435
|
+
width: 'medium',
|
|
436
|
+
content: html`${element}`,
|
|
437
|
+
menuOptions: menuOptions({ ready: false }),
|
|
438
|
+
});
|
|
439
|
+
element.addEventListener('agl-make-direct-report-state', (eventArg) => {
|
|
440
|
+
modal.menuOptions = menuOptions((eventArg as CustomEvent<IMakeDirectReportStateDetail>).detail);
|
|
441
|
+
});
|
|
442
|
+
modal.menuOptions = menuOptions({ ready: element.ready() });
|
|
443
|
+
return modal;
|
|
444
|
+
};
|
|
@@ -12,6 +12,7 @@ import {
|
|
|
12
12
|
type IFleetWorkerSender,
|
|
13
13
|
type ITranscript,
|
|
14
14
|
} from './elements.fleetworker.js';
|
|
15
|
+
import type { IMakeDirectReportRequestDetail } from './elements.makedirectreport.js';
|
|
15
16
|
|
|
16
17
|
const { html, css } = plugins.deesElement;
|
|
17
18
|
|
|
@@ -23,7 +24,8 @@ const refKey = (refArg: interfaces.IControllerNativeSessionRef | undefined): str
|
|
|
23
24
|
* A session AGL lists but does not host, opened where it runs, with no project: its transcript, its session panel
|
|
24
25
|
* and, while AGL may write to it, a composer. A Claude Code session takes a message once it settled and resumes in
|
|
25
26
|
* its own directory; a Codex thread takes one through the shared app-server that owns it, steering the turn it runs.
|
|
26
|
-
* A session AGL may not write to stays readable and says why.
|
|
27
|
+
* A session AGL may not write to stays readable and says why. Its toolbar asks the page to make it a direct report
|
|
28
|
+
* (`agl-make-direct-report`).
|
|
27
29
|
*/
|
|
28
30
|
@plugins.deesElement.customElement('agl-native-session')
|
|
29
31
|
export class AglNativeSession extends plugins.deesElement.DeesElement {
|
|
@@ -48,6 +50,7 @@ export class AglNativeSession extends plugins.deesElement.DeesElement {
|
|
|
48
50
|
|
|
49
51
|
private readonly state = new NativeSessionState(this, { initialLimit: nativeSessionPageBundles, pollWhileBusy: true });
|
|
50
52
|
private shownKey = '';
|
|
53
|
+
private toolbar: { key: string; actions: plugins.deesCatalog.IHarnessChatToolbarAction[] } | undefined;
|
|
51
54
|
private page: { response: interfaces.IReq_ControllerNativeSessionRead['response']; transcript: ITranscript } | undefined;
|
|
52
55
|
/** Advances whenever the shown session changes; a send's reply for another session is dropped. */
|
|
53
56
|
private generation = 0;
|
|
@@ -136,6 +139,7 @@ export class AglNativeSession extends plugins.deesElement.DeesElement {
|
|
|
136
139
|
maxAttachmentCount: interfaces.controllerMaxDraftAttachments,
|
|
137
140
|
...(session?.model ? { model: session.model } : {}),
|
|
138
141
|
...(session?.effort ? { reasoningEffort: session.effort } : {}),
|
|
142
|
+
toolbarActions: this.toolbarActions(ref),
|
|
139
143
|
heading: session?.title ?? ref?.nativeId ?? '',
|
|
140
144
|
subheading: session
|
|
141
145
|
? `${harnessNames[session.harness]} · ${session.cwd} · ${session.nativeId}`
|
|
@@ -152,6 +156,30 @@ export class AglNativeSession extends plugins.deesElement.DeesElement {
|
|
|
152
156
|
`;
|
|
153
157
|
}
|
|
154
158
|
|
|
159
|
+
/** The toolbar of the session `refArg`, the same array while it shows. */
|
|
160
|
+
private toolbarActions(refArg: interfaces.IControllerNativeSessionRef | undefined): plugins.deesCatalog.IHarnessChatToolbarAction[] | undefined {
|
|
161
|
+
if (!refArg) return undefined;
|
|
162
|
+
const key = refKey(refArg);
|
|
163
|
+
if (this.toolbar?.key !== key) {
|
|
164
|
+
const session = { ...refArg };
|
|
165
|
+
this.toolbar = {
|
|
166
|
+
key,
|
|
167
|
+
actions: [{
|
|
168
|
+
id: 'make-direct-report',
|
|
169
|
+
label: 'Make direct report…',
|
|
170
|
+
iconName: 'lucide:UserPlus',
|
|
171
|
+
tooltip: 'Make this session a direct report of the driver',
|
|
172
|
+
action: () => {
|
|
173
|
+
this.dispatchEvent(new CustomEvent<IMakeDirectReportRequestDetail>('agl-make-direct-report', {
|
|
174
|
+
detail: { session }, bubbles: true, composed: true,
|
|
175
|
+
}));
|
|
176
|
+
},
|
|
177
|
+
}],
|
|
178
|
+
};
|
|
179
|
+
}
|
|
180
|
+
return this.toolbar.actions;
|
|
181
|
+
}
|
|
182
|
+
|
|
155
183
|
private show(): void {
|
|
156
184
|
const key = refKey(this.ref);
|
|
157
185
|
if (key !== this.shownKey) {
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import * as plugins from './plugins.js';
|
|
2
2
|
import * as interfaces from '../ts_interfaces/index.js';
|
|
3
|
+
import { deployWindowRange, ticketDeploySections } from './functions.deployments.js';
|
|
3
4
|
|
|
4
5
|
const { html, css } = plugins.deesElement;
|
|
5
6
|
|
|
@@ -32,15 +33,26 @@ const ticketFields = new Set<string>([
|
|
|
32
33
|
const kanbanPerson = (personArg: interfaces.ITicketPerson): IKanbanPerson => ({ id: personArg.id, name: personArg.name });
|
|
33
34
|
|
|
34
35
|
/**
|
|
35
|
-
*
|
|
36
|
-
*
|
|
36
|
+
* The links as the kanban shows them; an `affects` link is "found in" on the card and in the detail. A release link that
|
|
37
|
+
* names no package shows its repository in the package's place.
|
|
37
38
|
*/
|
|
38
|
-
const kanbanLinks = (linksArg: interfaces.TTicketLink[]): plugins.deesCatalog.TKanbanLink[] => linksArg.
|
|
39
|
-
linkArg.kind === '
|
|
40
|
-
: linkArg.kind === 'release' ? [{ kind: 'release', package: linkArg.package ?? linkArg.repo ?? '', version: linkArg.version }]
|
|
41
|
-
: [{ ...linkArg }]
|
|
39
|
+
const kanbanLinks = (linksArg: interfaces.TTicketLink[]): plugins.deesCatalog.TKanbanLink[] => linksArg.map((linkArg) => (
|
|
40
|
+
linkArg.kind === 'release' ? { ...linkArg, package: linkArg.package ?? linkArg.repo ?? '' } : { ...linkArg }
|
|
42
41
|
));
|
|
43
42
|
|
|
43
|
+
/**
|
|
44
|
+
* The AutoLabels AGL computes, as the board names and colours them: the catalog's own `openQuestion`, `undeployed` in
|
|
45
|
+
* the warning tone and `planned` in the info tone, each with a filter chip.
|
|
46
|
+
*/
|
|
47
|
+
export const ticketAutoLabelDefinitions: plugins.deesCatalog.IKanbanAutoLabel[] = [
|
|
48
|
+
{ label: 'openQuestion' },
|
|
49
|
+
{ label: 'undeployed', name: 'undeployed', iconName: 'lucide:ServerOff', tone: 'warning',
|
|
50
|
+
description: 'Released in a version that some deploy target of its repository does not run yet.' },
|
|
51
|
+
{ label: 'planned', name: 'planned', iconName: 'lucide:CalendarClock', tone: 'info',
|
|
52
|
+
description: 'Plans a release, a deploy or a maintenance window, and is not done yet.' },
|
|
53
|
+
];
|
|
54
|
+
|
|
55
|
+
|
|
44
56
|
/** A ticket as the kanban shows it. */
|
|
45
57
|
export const kanbanTicket = (ticketArg: interfaces.ITicket): IKanbanTicket => ({
|
|
46
58
|
id: ticketArg.id,
|
|
@@ -58,6 +70,7 @@ export const kanbanTicket = (ticketArg: interfaces.ITicket): IKanbanTicket => ({
|
|
|
58
70
|
...(ticketArg.autoLabels === undefined ? {} : { autoLabels: [...ticketArg.autoLabels] }),
|
|
59
71
|
project: ticketArg.project,
|
|
60
72
|
links: kanbanLinks(ticketArg.links),
|
|
73
|
+
...(ticketArg.releasePlan === undefined ? {} : { releasePlan: { ...ticketArg.releasePlan } }),
|
|
61
74
|
source: {
|
|
62
75
|
label: sourceLabels[ticketArg.source.kind],
|
|
63
76
|
text: ticketArg.source.text,
|
|
@@ -99,20 +112,47 @@ export const kanbanQuestion = (questionArg: interfaces.ITicketQuestion): plugins
|
|
|
99
112
|
} }),
|
|
100
113
|
});
|
|
101
114
|
|
|
102
|
-
/**
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
}
|
|
115
|
+
/** What a change of a ticket's plans did, in the words of the history's sentence: its release plan, deploy plan and window. */
|
|
116
|
+
const planChangeText = (changesArg: interfaces.ITicketActivity['changes']): string | undefined => {
|
|
117
|
+
const words: string[] = [];
|
|
118
|
+
const release = changesArg.releasePlan as { before?: interfaces.ITicketReleasePlan; after?: interfaces.ITicketReleasePlan } | undefined;
|
|
119
|
+
if (release) {
|
|
120
|
+
words.push(release.after ? `planned the release ${release.after.repo} ${release.after.version ?? '(next)'}` : 'removed the release plan');
|
|
121
|
+
}
|
|
122
|
+
const deploy = changesArg.deployPlan as { before?: interfaces.ITicketDeployPlan; after?: interfaces.ITicketDeployPlan } | undefined;
|
|
123
|
+
if (deploy) words.push(deploy.after ? `planned the deploy of ${deploy.after.target} ${deploy.after.version}` : 'removed the deploy plan');
|
|
124
|
+
const window = changesArg.maintenanceWindow as { before?: interfaces.ITicketMaintenanceWindow; after?: interfaces.ITicketMaintenanceWindow } | undefined;
|
|
125
|
+
if (window) {
|
|
126
|
+
words.push(window.after ? `${window.before ? 'moved' : 'planned'} the maintenance window to ${deployWindowRange(window.after)} for ${window.after.targets.join(', ')}`
|
|
127
|
+
: 'removed the maintenance window');
|
|
128
|
+
}
|
|
129
|
+
return words.length ? words.join('; ') : undefined;
|
|
130
|
+
};
|
|
112
131
|
|
|
113
|
-
/**
|
|
132
|
+
/**
|
|
133
|
+
* A history entry as the kanban takes it; the kanban shows comments, questions and answers in the discussion, not the
|
|
134
|
+
* history. A change of plans reads as AGL's own sentence.
|
|
135
|
+
*/
|
|
136
|
+
export const kanbanActivity = (activityArg: interfaces.ITicketActivity): plugins.deesCatalog.IKanbanActivity => {
|
|
137
|
+
const summary = planChangeText(activityArg.changes);
|
|
138
|
+
return {
|
|
139
|
+
id: activityArg.id,
|
|
140
|
+
ticketId: activityArg.ticketId,
|
|
141
|
+
actor: kanbanPerson(activityArg.actor),
|
|
142
|
+
createdAt: activityArg.createdAt,
|
|
143
|
+
action: activityArg.action,
|
|
144
|
+
changes: Object.fromEntries(Object.entries(activityArg.changes).filter(([fieldArg]) => ticketFields.has(fieldArg))),
|
|
145
|
+
...(summary ? { summary } : {}),
|
|
146
|
+
};
|
|
147
|
+
};
|
|
148
|
+
|
|
149
|
+
/**
|
|
150
|
+
* A board column as the kanban shows it: Released and Closed, where finished tickets gather, start folded, and Closed,
|
|
151
|
+
* which ships nothing, has a grey ring apart from Released's.
|
|
152
|
+
*/
|
|
114
153
|
const kanbanColumn = (columnArg: interfaces.ITicketBoard['columns'][number]): plugins.deesCatalog.IKanbanColumn => (
|
|
115
|
-
interfaces.ticketDoneColumns.includes(columnArg.id)
|
|
154
|
+
interfaces.ticketDoneColumns.includes(columnArg.id)
|
|
155
|
+
? { ...columnArg, collapsible: 'collapsed', ...(columnArg.id === 'closed' ? { tone: 'neutral' as const } : {}) } : { ...columnArg }
|
|
116
156
|
);
|
|
117
157
|
|
|
118
158
|
/** The person a tracked conversation is assigned as: its runtime id is the session a worker proves. */
|
|
@@ -182,6 +222,12 @@ export class AglTicketBoard extends plugins.deesElement.DeesElement {
|
|
|
182
222
|
}
|
|
183
223
|
}
|
|
184
224
|
|
|
225
|
+
/** Loads the open ticket's own sections again, quietly; the controller's `deployments.changed` calls it. */
|
|
226
|
+
public async refreshDetailSections(): Promise<void> {
|
|
227
|
+
await this.updateComplete;
|
|
228
|
+
await this.kanban()?.refreshDetailSections(undefined, true);
|
|
229
|
+
}
|
|
230
|
+
|
|
185
231
|
/** Opens a ticket's detail; a session row's ticket chip calls it with the ticket's key. */
|
|
186
232
|
public async openTicket(keyArg: string): Promise<void> {
|
|
187
233
|
await this.updateComplete;
|
|
@@ -201,8 +247,16 @@ export class AglTicketBoard extends plugins.deesElement.DeesElement {
|
|
|
201
247
|
.projects=${this.projects.map((projectArg) => ({ id: projectArg.name, name: projectArg.name }))}
|
|
202
248
|
.projectRequired=${true}
|
|
203
249
|
.currentPersonId=${this.viewer?.id ?? ''}
|
|
250
|
+
.autoLabelDefinitions=${ticketAutoLabelDefinitions}
|
|
251
|
+
.autoLabelChips=${true}
|
|
204
252
|
.loading=${this.loading}
|
|
205
253
|
.error=${this.error}
|
|
254
|
+
@kanban-detail-section-link=${(eventArg: CustomEvent<plugins.deesCatalog.IKanbanSectionLinkDetail>) => {
|
|
255
|
+
// The app routes "Open in Deployments" itself; the board has closed the ticket on its way.
|
|
256
|
+
if (eventArg.detail?.actionId !== 'open-deployments') return;
|
|
257
|
+
eventArg.preventDefault();
|
|
258
|
+
this.dispatchEvent(new CustomEvent('deploy-open', { detail: { ticketId: eventArg.detail.ticketId }, bubbles: true, composed: true }));
|
|
259
|
+
}}
|
|
206
260
|
></dees-kanban>
|
|
207
261
|
`;
|
|
208
262
|
}
|
|
@@ -302,6 +356,8 @@ export class AglTicketBoard extends plugins.deesElement.DeesElement {
|
|
|
302
356
|
const { comments, questions } = await this.history(ticketIdArg, signalArg);
|
|
303
357
|
return [...comments.map(kanbanComment), ...questions.map(kanbanQuestion)];
|
|
304
358
|
},
|
|
359
|
+
loadDetailSections: async (ticketIdArg, signalArg) => ticketDeploySections(await this.sender!.fire<interfaces.TControllerDeployRequest<'ticket'>>(
|
|
360
|
+
'controller.deploy.ticket', { ticketKey: ticketIdArg }, signalArg ? { abortSignal: signalArg } : undefined)),
|
|
305
361
|
loadActivity: async (ticketIdArg, signalArg) => (await this.history(ticketIdArg, signalArg)).activity.map(kanbanActivity),
|
|
306
362
|
addComment: async (inputArg) => this.change(async () => (
|
|
307
363
|
kanbanComment((await this.fire('comment', { ticketId: inputArg.ticketId, body: inputArg.body })).comment)
|