agl 43.0.4 → 43.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/changelog.md +25 -0
- package/dist_serve/bundle.js +5186 -4683
- 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 +1 -1
- package/dist_ts/00_commitinfo_data.js +1 -1
- package/dist_ts/aglapi/aglapisurface.document.js +475 -4
- package/dist_ts/aglapi/interfaces.d.ts +10 -0
- package/dist_ts/aglapi/interfaces.js +3 -1
- package/dist_ts/classes.claudeharness.d.ts +14 -5
- package/dist_ts/classes.claudeharness.js +62 -2
- package/dist_ts/classes.codexclientadapter.d.ts +7 -5
- package/dist_ts/classes.codexclientadapter.js +38 -3
- package/dist_ts/classes.controller.d.ts +9 -2
- package/dist_ts/classes.controller.js +116 -24
- package/dist_ts/classes.flexservice.d.ts +6 -7
- package/dist_ts/classes.flexservice.js +12 -45
- package/dist_ts/classes.flexsupervisor.d.ts +37 -3
- package/dist_ts/classes.flexsupervisor.js +164 -37
- package/dist_ts/classes.inferencegateway.d.ts +8 -5
- package/dist_ts/classes.inferencegateway.js +62 -19
- package/dist_ts/classes.inferencespend.d.ts +9 -3
- package/dist_ts/classes.inferencespend.js +44 -16
- package/dist_ts/classes.mcpclient.d.ts +6 -4
- package/dist_ts/classes.mcpclient.js +6 -2
- package/dist_ts/classes.mcpcontrollerhost.js +5 -1
- package/dist_ts/classes.mcptools.d.ts +1 -1
- package/dist_ts/classes.mcptools.js +17 -4
- package/dist_ts/classes.opencodeclient.js +3 -1
- package/dist_ts/classes.proxycontrol.d.ts +22 -11
- package/dist_ts/classes.proxycontrol.js +6 -3
- package/dist_ts/classes.proxycontrolclient.d.ts +6 -5
- package/dist_ts/classes.proxycontrolclient.js +8 -6
- package/dist_ts/classes.proxydaemon.d.ts +8 -6
- package/dist_ts/classes.proxydaemon.js +35 -21
- package/dist_ts/classes.proxyleaseholder.d.ts +12 -4
- package/dist_ts/classes.proxyleaseholder.js +39 -9
- package/dist_ts/classes.proxystore.d.ts +4 -3
- package/dist_ts/classes.proxystore.js +17 -7
- package/dist_ts/classes.sessionfeed.d.ts +1 -1
- package/dist_ts/classes.validation.d.ts +7 -0
- package/dist_ts/classes.validation.js +49 -2
- package/dist_ts/driver/functions.drivertools.js +2 -2
- package/dist_ts/fleet/classes.codexworkers.d.ts +4 -11
- package/dist_ts/fleet/classes.codexworkers.js +6 -3
- package/dist_ts/fleet/classes.workers.d.ts +25 -13
- package/dist_ts/fleet/classes.workers.js +105 -9
- package/dist_ts/fleet/functions.workervalidation.d.ts +26 -1
- package/dist_ts/fleet/functions.workervalidation.js +40 -11
- package/dist_ts/fleet/interfaces.workers.d.ts +17 -11
- package/dist_ts/fleet/interfaces.workers.js +10 -1
- package/dist_ts/flexharness.child.js +9 -4
- package/dist_ts/functions.confinedrelay.d.ts +21 -0
- package/dist_ts/functions.confinedrelay.js +65 -0
- package/dist_ts/functions.deviceapi.d.ts +4 -2
- package/dist_ts/functions.deviceapi.js +20 -2
- package/dist_ts/functions.elicitation.d.ts +49 -0
- package/dist_ts/functions.elicitation.js +418 -0
- package/dist_ts/functions.flexchildshutdown.d.ts +7 -0
- package/dist_ts/functions.flexchildshutdown.js +18 -1
- package/dist_ts/functions.inferencecli.d.ts +3 -3
- package/dist_ts/functions.inferencecli.js +33 -10
- package/dist_ts/functions.inferencecliarguments.d.ts +2 -1
- package/dist_ts/functions.inferencecliarguments.js +29 -8
- package/dist_ts/functions.inferencelaunch.d.ts +35 -7
- package/dist_ts/functions.inferencelaunch.js +143 -16
- package/dist_ts/functions.mcpfleetworkertools.d.ts +63 -70
- package/dist_ts/functions.mcpfleetworkertools.js +32 -4
- package/dist_ts/functions.proxycontract.d.ts +21 -4
- package/dist_ts/functions.proxycontract.js +12 -5
- package/dist_ts/functions.proxyharnessconfig.d.ts +7 -0
- package/dist_ts/functions.proxyharnessconfig.js +11 -1
- package/dist_ts/interfaces.auth.d.ts +1 -1
- package/dist_ts/interfaces.auth.js +2 -1
- package/dist_ts_interfaces/devices.d.ts +133 -3
- package/dist_ts_interfaces/devices.js +3 -2
- package/dist_ts_interfaces/elicitations.d.ts +125 -0
- package/dist_ts_interfaces/elicitations.js +7 -0
- package/dist_ts_interfaces/fleetworkers.d.ts +119 -5
- package/dist_ts_interfaces/fleetworkers.js +14 -2
- package/dist_ts_interfaces/index.d.ts +1 -0
- package/dist_ts_interfaces/index.js +2 -1
- package/dist_ts_interfaces/interfaces.d.ts +3 -1
- package/dist_ts_interfaces/interfaces.js +2 -2
- package/dist_ts_interfaces/mcprequests.d.ts +5 -1
- package/dist_ts_interfaces/mcprequests.js +2 -1
- package/dist_ts_interfaces/nativesessions.d.ts +14 -0
- package/dist_ts_interfaces/requests.d.ts +3 -3
- package/dist_ts_interfaces/requests.fleetworkers.js +2 -2
- package/dist_ts_interfaces/requests.js +1 -1
- package/dist_ts_interfaces/requests.promptreply.d.ts +18 -0
- package/dist_ts_interfaces/sessionfeed.d.ts +3 -2
- package/dist_ts_interfaces/sessionfeed.js +1 -1
- package/dist_ts_migration/index.d.ts +0 -2
- package/dist_ts_migration/index.js +1 -3
- package/dist_ts_migration/v43_flexpostharnessmigrationmarkers.d.ts +6 -17
- package/dist_ts_migration/v43_flexpostharnessmigrationmarkers.js +6 -36
- package/package.json +3 -3
- package/readme.md +191 -24
- package/third-party-notices.md +1 -1
- package/ts/00_commitinfo_data.ts +1 -1
- package/ts/aglapi/aglapisurface.document.ts +474 -3
- package/ts/aglapi/interfaces.ts +2 -0
- package/ts/classes.claudeharness.ts +80 -9
- package/ts/classes.codexclientadapter.ts +41 -5
- package/ts/classes.controller.ts +142 -29
- package/ts/classes.flexservice.ts +10 -66
- package/ts/classes.flexsupervisor.ts +214 -37
- package/ts/classes.inferencegateway.ts +69 -23
- package/ts/classes.inferencespend.ts +46 -13
- package/ts/classes.mcpclient.ts +8 -4
- package/ts/classes.mcpcontrollerhost.ts +4 -0
- package/ts/classes.mcptools.ts +17 -3
- package/ts/classes.opencodeclient.ts +2 -0
- package/ts/classes.proxycontrol.ts +27 -13
- package/ts/classes.proxycontrolclient.ts +9 -6
- package/ts/classes.proxydaemon.ts +49 -27
- package/ts/classes.proxyleaseholder.ts +43 -11
- package/ts/classes.proxystore.ts +21 -8
- package/ts/classes.sessionfeed.ts +1 -1
- package/ts/classes.validation.ts +52 -0
- package/ts/driver/functions.drivertools.ts +1 -1
- package/ts/fleet/classes.codexworkers.ts +8 -6
- package/ts/fleet/classes.workers.ts +101 -17
- package/ts/fleet/functions.workervalidation.ts +35 -9
- package/ts/fleet/interfaces.workers.ts +11 -4
- package/ts/flexharness.child.ts +8 -3
- package/ts/functions.confinedrelay.ts +65 -0
- package/ts/functions.deviceapi.ts +24 -1
- package/ts/functions.elicitation.ts +443 -0
- package/ts/functions.flexchildshutdown.ts +22 -0
- package/ts/functions.inferencecli.ts +38 -13
- package/ts/functions.inferencecliarguments.ts +26 -5
- package/ts/functions.inferencelaunch.ts +143 -16
- package/ts/functions.mcpfleetworkertools.ts +34 -4
- package/ts/functions.proxycontract.ts +17 -4
- package/ts/functions.proxyharnessconfig.ts +11 -0
- package/ts/interfaces.auth.ts +1 -0
- package/ts_interfaces/devices.schema.json +476 -2
- package/ts_interfaces/devices.ts +146 -2
- package/ts_interfaces/elicitations.ts +148 -0
- package/ts_interfaces/fleetworkers.ts +96 -4
- package/ts_interfaces/index.ts +1 -0
- package/ts_interfaces/interfaces.ts +3 -1
- package/ts_interfaces/mcprequests.ts +1 -0
- package/ts_interfaces/nativesessions.ts +16 -0
- package/ts_interfaces/requests.fleetworkers.ts +1 -1
- package/ts_interfaces/requests.promptreply.ts +22 -0
- package/ts_interfaces/requests.ts +4 -0
- package/ts_interfaces/sessionfeed.ts +3 -2
- package/ts_migration/index.ts +0 -2
- package/ts_migration/v43_flexpostharnessmigrationmarkers.ts +6 -49
- package/ts_web/00_commitinfo_data.ts +1 -1
- package/ts_web/classes.elicitationcards.ts +106 -0
- package/ts_web/classes.nativesessionstate.ts +38 -1
- package/ts_web/elements.fleetworker.ts +27 -2
- package/ts_web/elements.harnesscontrollerapp.ts +68 -1
- package/ts_web/functions.sessionchat.ts +5 -0
- package/dist_ts_migration/classes.flexpostharnessmigrationrunner.d.ts +0 -19
- package/dist_ts_migration/classes.flexpostharnessmigrationrunner.js +0 -34
- package/dist_ts_migration/v19_flexprojectmanagement.d.ts +0 -14
- package/dist_ts_migration/v19_flexprojectmanagement.js +0 -23
- package/ts_migration/classes.flexpostharnessmigrationrunner.ts +0 -54
- package/ts_migration/v19_flexprojectmanagement.ts +0 -32
|
@@ -3,6 +3,7 @@ import * as interfaces from '../ts_interfaces/index.js';
|
|
|
3
3
|
import type { ISessionChatHandlers, ISessionChatView } from './functions.sessionchat.js';
|
|
4
4
|
import { sessionIntelligenceAvailabilityAction } from './functions.sessionchat.js';
|
|
5
5
|
import { errorText, type IFleetWorkerSender } from './elements.fleetworker.js';
|
|
6
|
+
import { ElicitationCards, elicitationReply } from './classes.elicitationcards.js';
|
|
6
7
|
|
|
7
8
|
/** The element a session's state belongs to: it renders the state and hears the settings remedy. */
|
|
8
9
|
export interface INativeSessionStateHost {
|
|
@@ -61,6 +62,8 @@ export class NativeSessionState {
|
|
|
61
62
|
private intelligenceAction: plugins.deesCatalog.IHarnessIntelligenceAvailabilityAction | undefined;
|
|
62
63
|
private permissionCards: plugins.deesCatalog.IHarnessPermissionRequest[] = [];
|
|
63
64
|
private questionCards: plugins.deesCatalog.IHarnessQuestionRequest[] = [];
|
|
65
|
+
private readonly elicitations = new ElicitationCards((idArg) => idArg.nativeId);
|
|
66
|
+
private elicitationCards: plugins.deesCatalog.IHarnessElicitationRequest[] = [];
|
|
64
67
|
private readonly answeredPermissions = new Map<string, plugins.deesCatalog.IHarnessPermissionRequest>();
|
|
65
68
|
private readonly answeredQuestions = new Map<string, plugins.deesCatalog.IHarnessQuestionRequest>();
|
|
66
69
|
private readonly questionBatches = new Map<string, Map<number, string[]>>();
|
|
@@ -118,6 +121,8 @@ export class NativeSessionState {
|
|
|
118
121
|
this.questionBatches.clear();
|
|
119
122
|
this.permissionCards = [];
|
|
120
123
|
this.questionCards = [];
|
|
124
|
+
this.elicitations.clear();
|
|
125
|
+
this.elicitationCards = [];
|
|
121
126
|
}
|
|
122
127
|
|
|
123
128
|
/** Reads the session again; a read under way reads once more after it. */
|
|
@@ -205,13 +210,14 @@ export class NativeSessionState {
|
|
|
205
210
|
: ''),
|
|
206
211
|
permissions: this.permissionCards,
|
|
207
212
|
questions: this.questionCards,
|
|
213
|
+
elicitations: this.elicitationCards,
|
|
208
214
|
};
|
|
209
215
|
}
|
|
210
216
|
|
|
211
217
|
/** The chat events of the session state. */
|
|
212
218
|
public readonly handlers: Pick<
|
|
213
219
|
ISessionChatHandlers,
|
|
214
|
-
'scratchpadSave' | 'intelligenceAsk' | 'intelligenceAvailabilityAction' | 'permissionResponse' | 'questionResponse'
|
|
220
|
+
'scratchpadSave' | 'intelligenceAsk' | 'intelligenceAvailabilityAction' | 'permissionResponse' | 'questionResponse' | 'elicitationResponse'
|
|
215
221
|
> = {
|
|
216
222
|
scratchpadSave: (eventArg: CustomEvent<plugins.deesCatalog.IHarnessScratchpadSaveDetail>) => {
|
|
217
223
|
const detail = eventArg.detail;
|
|
@@ -269,6 +275,12 @@ export class NativeSessionState {
|
|
|
269
275
|
return;
|
|
270
276
|
}
|
|
271
277
|
},
|
|
278
|
+
elicitationResponse: (eventArg: CustomEvent<plugins.deesCatalog.IHarnessElicitationResponseDetail>) => {
|
|
279
|
+
const cardId = eventArg.detail?.requestId;
|
|
280
|
+
if (typeof cardId !== 'string') return;
|
|
281
|
+
const request = this.elicitations.request(cardId), reply = elicitationReply(eventArg.detail);
|
|
282
|
+
if (request && reply) void this.answerElicitation(cardId, request.id, reply);
|
|
283
|
+
},
|
|
272
284
|
};
|
|
273
285
|
|
|
274
286
|
private async read(generationArg: number): Promise<void> {
|
|
@@ -369,6 +381,30 @@ export class NativeSessionState {
|
|
|
369
381
|
if (generation === this.generation) void this.refresh();
|
|
370
382
|
}
|
|
371
383
|
|
|
384
|
+
/**
|
|
385
|
+
* Sends the owner's answer to an MCP elicitation and reads the session again. A refusal, or an answer that did not
|
|
386
|
+
* reach the controller, shows on the card, which takes an answer again; the answer itself is kept nowhere.
|
|
387
|
+
*/
|
|
388
|
+
private async answerElicitation(
|
|
389
|
+
cardIdArg: string,
|
|
390
|
+
requestIdArg: interfaces.IControllerRuntimeId,
|
|
391
|
+
replyArg: interfaces.TControllerElicitationReply,
|
|
392
|
+
): Promise<void> {
|
|
393
|
+
const { ref, sender, generation } = this;
|
|
394
|
+
if (!ref || !sender) return;
|
|
395
|
+
try {
|
|
396
|
+
await sender.fire<interfaces.IReq_ControllerNativeSessionElicitationReply>(
|
|
397
|
+
'controller.nativesession.elicitation.reply',
|
|
398
|
+
{ session: ref, requestId: requestIdArg, reply: replyArg },
|
|
399
|
+
);
|
|
400
|
+
} catch (errorArg) {
|
|
401
|
+
if (generation !== this.generation) return;
|
|
402
|
+
this.elicitations.refuse(cardIdArg, errorText(errorArg));
|
|
403
|
+
this.rebuildCards();
|
|
404
|
+
}
|
|
405
|
+
if (generation === this.generation) void this.refresh();
|
|
406
|
+
}
|
|
407
|
+
|
|
372
408
|
/** The request cards: pending ones as asked, or as answered while the reply is on its way. */
|
|
373
409
|
private rebuildCards(): void {
|
|
374
410
|
const response = this.response;
|
|
@@ -394,6 +430,7 @@ export class NativeSessionState {
|
|
|
394
430
|
}
|
|
395
431
|
for (const id of this.answeredQuestions.keys()) if (!pendingQuestions.has(id)) this.answeredQuestions.delete(id);
|
|
396
432
|
this.questionCards = cards;
|
|
433
|
+
this.elicitationCards = this.elicitations.cards(response?.elicitations ?? []);
|
|
397
434
|
this.host.requestUpdate();
|
|
398
435
|
}
|
|
399
436
|
|
|
@@ -66,7 +66,12 @@ const workerPage = (
|
|
|
66
66
|
responseArg: interfaces.IReq_ControllerFleetWorkerRead['response'],
|
|
67
67
|
previousArg: IWorkerPage | undefined,
|
|
68
68
|
): IWorkerPage => ({
|
|
69
|
-
view: {
|
|
69
|
+
view: {
|
|
70
|
+
worker: responseArg.worker,
|
|
71
|
+
...(responseArg.status ? { status: responseArg.status } : {}),
|
|
72
|
+
...(responseArg.outcome ? { outcome: responseArg.outcome } : {}),
|
|
73
|
+
...(responseArg.nativeWait ? { nativeWait: responseArg.nativeWait } : {}),
|
|
74
|
+
},
|
|
70
75
|
earlier: responseArg.earlier,
|
|
71
76
|
...transcript(responseArg.bundles, previousArg),
|
|
72
77
|
});
|
|
@@ -75,6 +80,20 @@ export const errorText = (errorArg: unknown): string => (
|
|
|
75
80
|
errorArg instanceof Error && errorArg.message ? errorArg.message : 'The request failed.'
|
|
76
81
|
);
|
|
77
82
|
|
|
83
|
+
/** Where a worker's harness waits for the owner in its own client, in the session list's words. */
|
|
84
|
+
const nativeWaitNotes: Record<interfaces.TControllerNativeWaitReason, string> = {
|
|
85
|
+
approval: 'Approve in', user_input: 'Reply in', native_prompt: 'Answer in', unrecognized: 'Waiting in',
|
|
86
|
+
};
|
|
87
|
+
const limitNames: Record<interfaces.TControllerModelLimitKind, string> = {
|
|
88
|
+
usage_limit: 'usage limit reached', usage_reserve: 'usage reserve reached', rate_limit: 'rate limit reached',
|
|
89
|
+
};
|
|
90
|
+
/** A failed newest turn as the chat's status, with the limit that ended it; any other outcome leaves the status as it is. */
|
|
91
|
+
const fleetWorkerOutcomeStatus = (
|
|
92
|
+
outcomeArg: interfaces.IFleetWorkerTurnOutcome | undefined,
|
|
93
|
+
): plugins.deesCatalog.IHarnessStatus | undefined => outcomeArg?.state === 'failed'
|
|
94
|
+
? { type: 'error', message: `The last turn failed${outcomeArg.limit ? `: ${limitNames[outcomeArg.limit]}` : ''}.` }
|
|
95
|
+
: undefined;
|
|
96
|
+
|
|
78
97
|
export const noAttachments: plugins.deesCatalog.IHarnessAttachment[] = [];
|
|
79
98
|
export const steerDelivery: plugins.deesCatalog.THarnessBusyDelivery[] = ['steer'];
|
|
80
99
|
|
|
@@ -208,7 +227,7 @@ export class AglFleetWorker extends plugins.deesElement.DeesElement {
|
|
|
208
227
|
? { type: 'error', message: this.readError }
|
|
209
228
|
: this.steering
|
|
210
229
|
? { type: 'busy', message: 'Steering the worker…' }
|
|
211
|
-
: busy ? { type: 'busy', message: 'Working' } : { type: 'idle' };
|
|
230
|
+
: busy ? { type: 'busy', message: 'Working' } : fleetWorkerOutcomeStatus(view?.outcome) ?? { type: 'idle' };
|
|
212
231
|
return html`
|
|
213
232
|
<div class="chatStack">
|
|
214
233
|
${this.page?.earlier
|
|
@@ -218,6 +237,12 @@ export class AglFleetWorker extends plugins.deesElement.DeesElement {
|
|
|
218
237
|
? html`<div class="notice warning" role="note">Only its driver steers this worker: it is bound to no ticket.</div>`
|
|
219
238
|
: ''}
|
|
220
239
|
${this.steerError ? html`<div class="notice error" role="alert">${this.steerError}</div>` : ''}
|
|
240
|
+
${worker && view?.nativeWait
|
|
241
|
+
? html`<div class="notice warning nativeWait" role="note">${nativeWaitNotes[view.nativeWait.reason]} ${harnessNames[worker.harness]}: the worker waits there for an answer AGL cannot give.</div>`
|
|
242
|
+
: ''}
|
|
243
|
+
${!busy && view?.outcome?.state === 'interrupted'
|
|
244
|
+
? html`<div class="notice interrupted" role="note">The last turn was interrupted.</div>`
|
|
245
|
+
: ''}
|
|
221
246
|
${!this.report && this.session.readError
|
|
222
247
|
? html`<div class="notice error" role="alert">The worker's session panel: ${this.session.readError}</div>`
|
|
223
248
|
: ''}
|
|
@@ -35,6 +35,7 @@ import { deploymentsAttentionCount, deploymentsHref } from './functions.deployme
|
|
|
35
35
|
import { AglFleetWorker } from './elements.fleetworker.js';
|
|
36
36
|
import { AglNativeSession } from './elements.nativesession.js';
|
|
37
37
|
import type { ISessionIntelligenceRemedyDetail } from './classes.nativesessionstate.js';
|
|
38
|
+
import { ElicitationCards, elicitationReply } from './classes.elicitationcards.js';
|
|
38
39
|
import {
|
|
39
40
|
renderSessionChat,
|
|
40
41
|
sessionIntelligenceAvailabilityAction,
|
|
@@ -229,6 +230,7 @@ interface IConversationChatView extends Pick<
|
|
|
229
230
|
| 'loadEarlierHistory'
|
|
230
231
|
| 'permissions'
|
|
231
232
|
| 'questions'
|
|
233
|
+
| 'elicitations'
|
|
232
234
|
| 'transcriptKey'
|
|
233
235
|
| 'hasEarlierMessages'
|
|
234
236
|
| 'loadingEarlier'
|
|
@@ -673,6 +675,7 @@ const globalAutoAcceptModeOptions: plugins.deesCatalog.IHarnessComposerOption[]
|
|
|
673
675
|
{ label: 'Yolo', value: 'Yolo', description: 'Settings accept every permission request automatically.' },
|
|
674
676
|
];
|
|
675
677
|
const emptyHarnessQuestions: plugins.deesCatalog.IHarnessQuestionRequest[] = [];
|
|
678
|
+
const emptyHarnessElicitations: plugins.deesCatalog.IHarnessElicitationRequest[] = [];
|
|
676
679
|
const emptyHarnessAttachments: plugins.deesCatalog.IHarnessAttachment[] = [];
|
|
677
680
|
const emptyHarnessPermissions: plugins.deesCatalog.IHarnessPermissionRequest[] = [];
|
|
678
681
|
const emptyHarnessTodos: plugins.deesCatalog.IHarnessTodoItem[] = [];
|
|
@@ -1179,7 +1182,11 @@ export const boundedNewestMessageBundles = (
|
|
|
1179
1182
|
return { bundles, limited: bundles.length !== bundlesArg.length };
|
|
1180
1183
|
};
|
|
1181
1184
|
|
|
1182
|
-
/**
|
|
1185
|
+
/**
|
|
1186
|
+
* The list's row of a feed row: the same fields without where it opens, which only the app acts on. A row's native
|
|
1187
|
+
* wait and its interrupted label are the list's own fields too: it says where a needs-input row waits and that a
|
|
1188
|
+
* completed row's turn was interrupted (dees-catalog ≥ 24.2.0).
|
|
1189
|
+
*/
|
|
1183
1190
|
const sessionFeedListRow = (
|
|
1184
1191
|
{ open: _open, ...rowArg }: interfaces.IControllerSessionFeedRow,
|
|
1185
1192
|
): plugins.deesCatalog.IHarnessSessionRow => rowArg;
|
|
@@ -1277,6 +1284,10 @@ const concatBytes = (chunksArg: readonly Uint8Array[]): Uint8Array => {
|
|
|
1277
1284
|
return bytes;
|
|
1278
1285
|
};
|
|
1279
1286
|
|
|
1287
|
+
/** The controller refused an elicitation answer: it does not fit the request, or the request is gone. */
|
|
1288
|
+
const isElicitationRefusal = (errorArg: unknown): boolean => errorArg instanceof plugins.typedrequest.TypedResponseError
|
|
1289
|
+
&& (errorArg.errorData?.code === 'invalid_request' || errorArg.errorData?.code === 'not_found');
|
|
1290
|
+
|
|
1280
1291
|
const errorMessage = (errorArg: unknown): string => {
|
|
1281
1292
|
if (errorArg instanceof Error && errorArg.message) {
|
|
1282
1293
|
return errorArg.message;
|
|
@@ -2348,6 +2359,8 @@ export class HarnessControllerApp extends plugins.deesElement.DeesElement {
|
|
|
2348
2359
|
// OpenCode drops them from its pending lists; cleared on session switch.
|
|
2349
2360
|
private readonly answeredQuestionCards = new Map<string, plugins.deesCatalog.IHarnessQuestionRequest>();
|
|
2350
2361
|
private readonly answeredPermissionCards = new Map<string, plugins.deesCatalog.IHarnessPermissionRequest>();
|
|
2362
|
+
// MCP elicitation cards of the viewed session: a card and its refusal keep their objects across renders.
|
|
2363
|
+
private readonly elicitationCards = new ElicitationCards(controllerRuntimeIdToUiKey);
|
|
2351
2364
|
// Multi-question requests answer card-by-card; the reply fires once all
|
|
2352
2365
|
// cards of the request are in.
|
|
2353
2366
|
private readonly pendingQuestionBatchAnswers = new Map<string, Map<number, string[]>>();
|
|
@@ -13950,6 +13963,55 @@ ${entry.detail.stack}`}</pre>`}
|
|
|
13950
13963
|
if (request) void this.replyToPermission(request.id, reply, childAttention);
|
|
13951
13964
|
};
|
|
13952
13965
|
|
|
13966
|
+
/** The owner's answer to an MCP elicitation card: sent as it is, and kept nowhere but the card. */
|
|
13967
|
+
private readonly handleElicitationResponse = (
|
|
13968
|
+
eventArg: CustomEvent<plugins.deesCatalog.IHarnessElicitationResponseDetail>,
|
|
13969
|
+
): void => {
|
|
13970
|
+
const cardId = eventArg.detail?.requestId;
|
|
13971
|
+
if (!isNonEmptyString(cardId)) return;
|
|
13972
|
+
const request = this.elicitationCards.request(cardId), reply = elicitationReply(eventArg.detail);
|
|
13973
|
+
if (request && reply) void this.replyToElicitation(cardId, request.id, reply);
|
|
13974
|
+
};
|
|
13975
|
+
|
|
13976
|
+
/**
|
|
13977
|
+
* Answers an MCP elicitation of the conversation on screen. The controller checks the answer against the request; its
|
|
13978
|
+
* refusal, or an answer that could not be sent, shows on the card, which then takes an answer again. A refusal is
|
|
13979
|
+
* the card's to show; any other failure is recorded as well.
|
|
13980
|
+
*/
|
|
13981
|
+
private async replyToElicitation(
|
|
13982
|
+
cardIdArg: string,
|
|
13983
|
+
requestIdArg: interfaces.IControllerRuntimeId,
|
|
13984
|
+
replyArg: interfaces.TControllerElicitationReply,
|
|
13985
|
+
): Promise<void> {
|
|
13986
|
+
const scope = this.composerMutationScope();
|
|
13987
|
+
const sessionId = this.selectedSessionId;
|
|
13988
|
+
const mutationId = isSessionRuntimeId(sessionId) ? this.beginMutation(scope) : undefined;
|
|
13989
|
+
if (!mutationId || !isSessionRuntimeId(sessionId)) {
|
|
13990
|
+
this.finishMutation(mutationId);
|
|
13991
|
+
this.elicitationCards.refuse(cardIdArg, this.sendRefusalReason(scope));
|
|
13992
|
+
this.requestUpdate();
|
|
13993
|
+
return;
|
|
13994
|
+
}
|
|
13995
|
+
const generation = this.connectionGeneration;
|
|
13996
|
+
try {
|
|
13997
|
+
await this.socketClient.fire<interfaces.IReq_ControllerElicitationReply>(
|
|
13998
|
+
'controller.elicitation.reply',
|
|
13999
|
+
{ projectId: this.selectedProjectId, sessionId, requestId: requestIdArg, reply: replyArg },
|
|
14000
|
+
);
|
|
14001
|
+
if (this.isCurrentMutation(mutationId, generation, sessionId)) {
|
|
14002
|
+
await this.loadSessionDetail(sessionId);
|
|
14003
|
+
}
|
|
14004
|
+
} catch (error) {
|
|
14005
|
+
if (this.isCurrentMutation(mutationId, generation, sessionId)) {
|
|
14006
|
+
this.elicitationCards.refuse(cardIdArg, errorMessage(error));
|
|
14007
|
+
if (!isElicitationRefusal(error)) this.reportWorkspaceError('Answer the MCP request', error);
|
|
14008
|
+
this.requestUpdate();
|
|
14009
|
+
}
|
|
14010
|
+
} finally {
|
|
14011
|
+
this.finishMutation(mutationId);
|
|
14012
|
+
}
|
|
14013
|
+
}
|
|
14014
|
+
|
|
13953
14015
|
// The open subagent drill-in modal; refreshed on that child's session events.
|
|
13954
14016
|
private subagentModalSessionId: TBrowserSessionId | undefined;
|
|
13955
14017
|
private subagentModalParentSessionId: TBrowserSessionId | undefined;
|
|
@@ -14688,6 +14750,7 @@ ${entry.detail.stack}`}</pre>`}
|
|
|
14688
14750
|
this.answeredQuestionCards.clear();
|
|
14689
14751
|
this.answeredPermissionCards.clear();
|
|
14690
14752
|
this.pendingQuestionBatchAnswers.clear();
|
|
14753
|
+
this.elicitationCards.clear();
|
|
14691
14754
|
}
|
|
14692
14755
|
|
|
14693
14756
|
private async submitQuestionReply(
|
|
@@ -21773,6 +21836,7 @@ ${entry.detail.stack}`}</pre>`}
|
|
|
21773
21836
|
loadEarlierHistory: undefined,
|
|
21774
21837
|
permissions: emptyHarnessPermissions,
|
|
21775
21838
|
questions: emptyHarnessQuestions,
|
|
21839
|
+
elicitations: emptyHarnessElicitations,
|
|
21776
21840
|
transcriptKey: draftKey,
|
|
21777
21841
|
hasEarlierMessages: false,
|
|
21778
21842
|
loadingEarlier: false,
|
|
@@ -22141,6 +22205,8 @@ ${entry.detail.stack}`}</pre>`}
|
|
|
22141
22205
|
'chat.questions',
|
|
22142
22206
|
sessionId.harnessId !== 'flex' ? harnessQuestions : emptyHarnessQuestions,
|
|
22143
22207
|
),
|
|
22208
|
+
// Not through stableRenderValue: a refusal that reads as the last one is a new array the card must see.
|
|
22209
|
+
elicitations: this.elicitationCards.cards(detailArg.elicitations),
|
|
22144
22210
|
transcriptKey: `${this.selectedProjectId}\u0000${controllerRuntimeIdToUiKey(sessionId)}`,
|
|
22145
22211
|
hasEarlierMessages: this.detailHistoryCursor !== undefined,
|
|
22146
22212
|
loadingEarlier: this.detailHistoryStatus === 'backfilling',
|
|
@@ -22269,6 +22335,7 @@ ${entry.detail.stack}`}</pre>`}
|
|
|
22269
22335
|
modeChange: started ? this.handleModeChange : undefined,
|
|
22270
22336
|
permissionResponse: started ? this.handlePermissionResponse : undefined,
|
|
22271
22337
|
questionResponse: started ? this.handleQuestionResponse : undefined,
|
|
22338
|
+
elicitationResponse: started ? this.handleElicitationResponse : undefined,
|
|
22272
22339
|
subtaskOpen: started ? this.handleSubtaskOpen : undefined,
|
|
22273
22340
|
heldResend: started ? this.handleHeldResend : undefined,
|
|
22274
22341
|
heldDiscard: started ? this.handleHeldDiscard : undefined,
|
|
@@ -13,6 +13,7 @@ type TSessionChatProperty =
|
|
|
13
13
|
| 'loadEarlierHistory'
|
|
14
14
|
| 'permissions'
|
|
15
15
|
| 'questions'
|
|
16
|
+
| 'elicitations'
|
|
16
17
|
| 'transcriptKey'
|
|
17
18
|
| 'hasEarlierMessages'
|
|
18
19
|
| 'loadingEarlier'
|
|
@@ -84,6 +85,8 @@ export interface ISessionChatHandlers {
|
|
|
84
85
|
modeChange?: TSessionChatListener;
|
|
85
86
|
permissionResponse?: TSessionChatListener;
|
|
86
87
|
questionResponse?: TSessionChatListener;
|
|
88
|
+
/** The one event that carries what the owner entered in an MCP elicitation card: send it, keep nothing of it. */
|
|
89
|
+
elicitationResponse?: TSessionChatListener;
|
|
87
90
|
subtaskOpen?: TSessionChatListener;
|
|
88
91
|
heldResend?: TSessionChatListener;
|
|
89
92
|
heldDiscard?: TSessionChatListener;
|
|
@@ -120,6 +123,7 @@ export const renderSessionChat = (viewArg: ISessionChatView): plugins.deesElemen
|
|
|
120
123
|
.loadEarlierHistory=${viewArg.loadEarlierHistory}
|
|
121
124
|
.permissions=${viewArg.permissions ?? emptyList}
|
|
122
125
|
.questions=${viewArg.questions ?? emptyList}
|
|
126
|
+
.elicitations=${viewArg.elicitations ?? emptyList}
|
|
123
127
|
.transcriptKey=${viewArg.transcriptKey ?? ''}
|
|
124
128
|
.hasEarlierMessages=${viewArg.hasEarlierMessages ?? false}
|
|
125
129
|
.loadingEarlier=${viewArg.loadingEarlier ?? false}
|
|
@@ -192,6 +196,7 @@ export const renderSessionChat = (viewArg: ISessionChatView): plugins.deesElemen
|
|
|
192
196
|
@harness-mode-change=${on.modeChange}
|
|
193
197
|
@harness-permission-response=${on.permissionResponse}
|
|
194
198
|
@harness-question-response=${on.questionResponse}
|
|
199
|
+
@harness-elicitation-response=${on.elicitationResponse}
|
|
195
200
|
@harness-subtask-open=${on.subtaskOpen}
|
|
196
201
|
@harness-held-resend=${on.heldResend}
|
|
197
202
|
@harness-held-discard=${on.heldDiscard}
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import * as plugins from './plugins.js';
|
|
2
|
-
import type { IFlexPostHarnessMigrationMarkers } from './v43_flexpostharnessmigrationmarkers.js';
|
|
3
|
-
export interface IFlexPostHarnessMigrationRunnerOptions<TScope> {
|
|
4
|
-
harness: plugins.flexharness.FlexHarness<TScope>;
|
|
5
|
-
/** The storage keys each migration already completed for, which it never walks again. */
|
|
6
|
-
markers: IFlexPostHarnessMigrationMarkers;
|
|
7
|
-
scopeIds: Iterable<string>;
|
|
8
|
-
}
|
|
9
|
-
/**
|
|
10
|
-
* Runs each post-harness migration for every storage key it has not completed for, and records
|
|
11
|
-
* the completion only once the key's walk finished: a failed or aborted walk records nothing.
|
|
12
|
-
*/
|
|
13
|
-
export declare class FlexPostHarnessMigrationRunner<TScope> {
|
|
14
|
-
private readonly markers;
|
|
15
|
-
private readonly scopeIds;
|
|
16
|
-
private readonly migrations;
|
|
17
|
-
constructor(optionsArg: IFlexPostHarnessMigrationRunnerOptions<TScope>);
|
|
18
|
-
run(signalArg?: AbortSignal): Promise<void>;
|
|
19
|
-
}
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
import * as plugins from './plugins.js';
|
|
2
|
-
import { FlexProjectManagementMigration, flexProjectManagementMigrationId, } from './v19_flexprojectmanagement.js';
|
|
3
|
-
/**
|
|
4
|
-
* Runs each post-harness migration for every storage key it has not completed for, and records
|
|
5
|
-
* the completion only once the key's walk finished: a failed or aborted walk records nothing.
|
|
6
|
-
*/
|
|
7
|
-
export class FlexPostHarnessMigrationRunner {
|
|
8
|
-
markers;
|
|
9
|
-
scopeIds;
|
|
10
|
-
migrations;
|
|
11
|
-
constructor(optionsArg) {
|
|
12
|
-
this.markers = optionsArg.markers;
|
|
13
|
-
this.scopeIds = [...new Set(optionsArg.scopeIds)].sort();
|
|
14
|
-
this.migrations = [{
|
|
15
|
-
id: flexProjectManagementMigrationId,
|
|
16
|
-
run: (scopeIdArg, signalArg) => new FlexProjectManagementMigration({
|
|
17
|
-
harness: optionsArg.harness,
|
|
18
|
-
scopeIds: [scopeIdArg],
|
|
19
|
-
}).run(signalArg),
|
|
20
|
-
}];
|
|
21
|
-
}
|
|
22
|
-
async run(signalArg) {
|
|
23
|
-
for (const migration of this.migrations) {
|
|
24
|
-
for (const scopeId of this.scopeIds) {
|
|
25
|
-
signalArg?.throwIfAborted();
|
|
26
|
-
if (await this.markers.completed(scopeId, migration.id))
|
|
27
|
-
continue;
|
|
28
|
-
await migration.run(scopeId, signalArg);
|
|
29
|
-
await this.markers.record(scopeId, migration.id);
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiY2xhc3Nlcy5mbGV4cG9zdGhhcm5lc3NtaWdyYXRpb25ydW5uZXIuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi90c19taWdyYXRpb24vY2xhc3Nlcy5mbGV4cG9zdGhhcm5lc3NtaWdyYXRpb25ydW5uZXIudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUEsT0FBTyxLQUFLLE9BQU8sTUFBTSxjQUFjLENBQUM7QUFDeEMsT0FBTyxFQUNMLDhCQUE4QixFQUM5QixnQ0FBZ0MsR0FDakMsTUFBTSxnQ0FBZ0MsQ0FBQztBQWtCeEM7OztHQUdHO0FBQ0gsTUFBTSxPQUFPLDhCQUE4QjtJQUN4QixPQUFPLENBQW1DO0lBQzFDLFFBQVEsQ0FBVztJQUNuQixVQUFVLENBQThCO0lBRXpELFlBQVksVUFBMEQ7UUFDcEUsSUFBSSxDQUFDLE9BQU8sR0FBRyxVQUFVLENBQUMsT0FBTyxDQUFDO1FBQ2xDLElBQUksQ0FBQyxRQUFRLEdBQUcsQ0FBQyxHQUFHLElBQUksR0FBRyxDQUFDLFVBQVUsQ0FBQyxRQUFRLENBQUMsQ0FBQyxDQUFDLElBQUksRUFBRSxDQUFDO1FBQ3pELElBQUksQ0FBQyxVQUFVLEdBQUcsQ0FBQztnQkFDakIsRUFBRSxFQUFFLGdDQUFnQztnQkFDcEMsR0FBRyxFQUFFLENBQUMsVUFBVSxFQUFFLFNBQVMsRUFBRSxFQUFFLENBQUMsSUFBSSw4QkFBOEIsQ0FBQztvQkFDakUsT0FBTyxFQUFFLFVBQVUsQ0FBQyxPQUFPO29CQUMzQixRQUFRLEVBQUUsQ0FBQyxVQUFVLENBQUM7aUJBQ3ZCLENBQUMsQ0FBQyxHQUFHLENBQUMsU0FBUyxDQUFDO2FBQ2xCLENBQUMsQ0FBQztJQUNMLENBQUM7SUFFTSxLQUFLLENBQUMsR0FBRyxDQUFDLFNBQXVCO1FBQ3RDLEtBQUssTUFBTSxTQUFTLElBQUksSUFBSSxDQUFDLFVBQVUsRUFBRSxDQUFDO1lBQ3hDLEtBQUssTUFBTSxPQUFPLElBQUksSUFBSSxDQUFDLFFBQVEsRUFBRSxDQUFDO2dCQUNwQyxTQUFTLEVBQUUsY0FBYyxFQUFFLENBQUM7Z0JBQzVCLElBQUksTUFBTSxJQUFJLENBQUMsT0FBTyxDQUFDLFNBQVMsQ0FBQyxPQUFPLEVBQUUsU0FBUyxDQUFDLEVBQUUsQ0FBQztvQkFBRSxTQUFTO2dCQUNsRSxNQUFNLFNBQVMsQ0FBQyxHQUFHLENBQUMsT0FBTyxFQUFFLFNBQVMsQ0FBQyxDQUFDO2dCQUN4QyxNQUFNLElBQUksQ0FBQyxPQUFPLENBQUMsTUFBTSxDQUFDLE9BQU8sRUFBRSxTQUFTLENBQUMsRUFBRSxDQUFDLENBQUM7WUFDbkQsQ0FBQztRQUNILENBQUM7SUFDSCxDQUFDO0NBQ0YifQ==
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import * as plugins from './plugins.js';
|
|
2
|
-
import type { TFlexPostHarnessMigrationId } from './v43_flexpostharnessmigrationmarkers.js';
|
|
3
|
-
/** The name its completion is recorded under (`FlexPostHarnessMigrationMarkers`). */
|
|
4
|
-
export declare const flexProjectManagementMigrationId: TFlexPostHarnessMigrationId;
|
|
5
|
-
export interface IFlexProjectManagementMigrationOptions<TScope> {
|
|
6
|
-
harness: plugins.flexharness.FlexHarness<TScope>;
|
|
7
|
-
scopeIds: Iterable<string>;
|
|
8
|
-
}
|
|
9
|
-
export declare class FlexProjectManagementMigration<TScope> {
|
|
10
|
-
private readonly harness;
|
|
11
|
-
private readonly scopeIds;
|
|
12
|
-
constructor(optionsArg: IFlexProjectManagementMigrationOptions<TScope>);
|
|
13
|
-
run(signalArg?: AbortSignal): Promise<void>;
|
|
14
|
-
}
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import * as plugins from './plugins.js';
|
|
2
|
-
/** The name its completion is recorded under (`FlexPostHarnessMigrationMarkers`). */
|
|
3
|
-
export const flexProjectManagementMigrationId = 'v19_flexprojectmanagement';
|
|
4
|
-
export class FlexProjectManagementMigration {
|
|
5
|
-
harness;
|
|
6
|
-
scopeIds;
|
|
7
|
-
constructor(optionsArg) {
|
|
8
|
-
this.harness = optionsArg.harness;
|
|
9
|
-
this.scopeIds = [...new Set(optionsArg.scopeIds)].sort();
|
|
10
|
-
}
|
|
11
|
-
async run(signalArg) {
|
|
12
|
-
for (const scopeId of this.scopeIds) {
|
|
13
|
-
signalArg?.throwIfAborted();
|
|
14
|
-
// listSessions durably repairs legacy session generations before PM state is loaded.
|
|
15
|
-
const sessions = await this.harness.listSessions(scopeId);
|
|
16
|
-
for (const session of sessions) {
|
|
17
|
-
signalArg?.throwIfAborted();
|
|
18
|
-
await this.harness.getProjectState(scopeId, session.sessionId);
|
|
19
|
-
}
|
|
20
|
-
}
|
|
21
|
-
}
|
|
22
|
-
}
|
|
23
|
-
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidjE5X2ZsZXhwcm9qZWN0bWFuYWdlbWVudC5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uL3RzX21pZ3JhdGlvbi92MTlfZmxleHByb2plY3RtYW5hZ2VtZW50LnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBLE9BQU8sS0FBSyxPQUFPLE1BQU0sY0FBYyxDQUFDO0FBR3hDLHFGQUFxRjtBQUNyRixNQUFNLENBQUMsTUFBTSxnQ0FBZ0MsR0FBZ0MsMkJBQTJCLENBQUM7QUFPekcsTUFBTSxPQUFPLDhCQUE4QjtJQUN4QixPQUFPLENBQTBDO0lBQ2pELFFBQVEsQ0FBVztJQUVwQyxZQUFZLFVBQTBEO1FBQ3BFLElBQUksQ0FBQyxPQUFPLEdBQUcsVUFBVSxDQUFDLE9BQU8sQ0FBQztRQUNsQyxJQUFJLENBQUMsUUFBUSxHQUFHLENBQUMsR0FBRyxJQUFJLEdBQUcsQ0FBQyxVQUFVLENBQUMsUUFBUSxDQUFDLENBQUMsQ0FBQyxJQUFJLEVBQUUsQ0FBQztJQUMzRCxDQUFDO0lBRU0sS0FBSyxDQUFDLEdBQUcsQ0FBQyxTQUF1QjtRQUN0QyxLQUFLLE1BQU0sT0FBTyxJQUFJLElBQUksQ0FBQyxRQUFRLEVBQUUsQ0FBQztZQUNwQyxTQUFTLEVBQUUsY0FBYyxFQUFFLENBQUM7WUFDNUIscUZBQXFGO1lBQ3JGLE1BQU0sUUFBUSxHQUFHLE1BQU0sSUFBSSxDQUFDLE9BQU8sQ0FBQyxZQUFZLENBQUMsT0FBTyxDQUFDLENBQUM7WUFDMUQsS0FBSyxNQUFNLE9BQU8sSUFBSSxRQUFRLEVBQUUsQ0FBQztnQkFDL0IsU0FBUyxFQUFFLGNBQWMsRUFBRSxDQUFDO2dCQUM1QixNQUFNLElBQUksQ0FBQyxPQUFPLENBQUMsZUFBZSxDQUFDLE9BQU8sRUFBRSxPQUFPLENBQUMsU0FBUyxDQUFDLENBQUM7WUFDakUsQ0FBQztRQUNILENBQUM7SUFDSCxDQUFDO0NBQ0YifQ==
|
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
import * as plugins from './plugins.js';
|
|
2
|
-
import {
|
|
3
|
-
FlexProjectManagementMigration,
|
|
4
|
-
flexProjectManagementMigrationId,
|
|
5
|
-
} from './v19_flexprojectmanagement.js';
|
|
6
|
-
import type {
|
|
7
|
-
IFlexPostHarnessMigrationMarkers,
|
|
8
|
-
TFlexPostHarnessMigrationId,
|
|
9
|
-
} from './v43_flexpostharnessmigrationmarkers.js';
|
|
10
|
-
|
|
11
|
-
export interface IFlexPostHarnessMigrationRunnerOptions<TScope> {
|
|
12
|
-
harness: plugins.flexharness.FlexHarness<TScope>;
|
|
13
|
-
/** The storage keys each migration already completed for, which it never walks again. */
|
|
14
|
-
markers: IFlexPostHarnessMigrationMarkers;
|
|
15
|
-
scopeIds: Iterable<string>;
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
interface IFlexPostHarnessMigration {
|
|
19
|
-
readonly id: TFlexPostHarnessMigrationId;
|
|
20
|
-
run(scopeIdArg: string, signalArg?: AbortSignal): Promise<void>;
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
/**
|
|
24
|
-
* Runs each post-harness migration for every storage key it has not completed for, and records
|
|
25
|
-
* the completion only once the key's walk finished: a failed or aborted walk records nothing.
|
|
26
|
-
*/
|
|
27
|
-
export class FlexPostHarnessMigrationRunner<TScope> {
|
|
28
|
-
private readonly markers: IFlexPostHarnessMigrationMarkers;
|
|
29
|
-
private readonly scopeIds: string[];
|
|
30
|
-
private readonly migrations: IFlexPostHarnessMigration[];
|
|
31
|
-
|
|
32
|
-
constructor(optionsArg: IFlexPostHarnessMigrationRunnerOptions<TScope>) {
|
|
33
|
-
this.markers = optionsArg.markers;
|
|
34
|
-
this.scopeIds = [...new Set(optionsArg.scopeIds)].sort();
|
|
35
|
-
this.migrations = [{
|
|
36
|
-
id: flexProjectManagementMigrationId,
|
|
37
|
-
run: (scopeIdArg, signalArg) => new FlexProjectManagementMigration({
|
|
38
|
-
harness: optionsArg.harness,
|
|
39
|
-
scopeIds: [scopeIdArg],
|
|
40
|
-
}).run(signalArg),
|
|
41
|
-
}];
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
public async run(signalArg?: AbortSignal): Promise<void> {
|
|
45
|
-
for (const migration of this.migrations) {
|
|
46
|
-
for (const scopeId of this.scopeIds) {
|
|
47
|
-
signalArg?.throwIfAborted();
|
|
48
|
-
if (await this.markers.completed(scopeId, migration.id)) continue;
|
|
49
|
-
await migration.run(scopeId, signalArg);
|
|
50
|
-
await this.markers.record(scopeId, migration.id);
|
|
51
|
-
}
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
|
-
}
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
import * as plugins from './plugins.js';
|
|
2
|
-
import type { TFlexPostHarnessMigrationId } from './v43_flexpostharnessmigrationmarkers.js';
|
|
3
|
-
|
|
4
|
-
/** The name its completion is recorded under (`FlexPostHarnessMigrationMarkers`). */
|
|
5
|
-
export const flexProjectManagementMigrationId: TFlexPostHarnessMigrationId = 'v19_flexprojectmanagement';
|
|
6
|
-
|
|
7
|
-
export interface IFlexProjectManagementMigrationOptions<TScope> {
|
|
8
|
-
harness: plugins.flexharness.FlexHarness<TScope>;
|
|
9
|
-
scopeIds: Iterable<string>;
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
export class FlexProjectManagementMigration<TScope> {
|
|
13
|
-
private readonly harness: plugins.flexharness.FlexHarness<TScope>;
|
|
14
|
-
private readonly scopeIds: string[];
|
|
15
|
-
|
|
16
|
-
constructor(optionsArg: IFlexProjectManagementMigrationOptions<TScope>) {
|
|
17
|
-
this.harness = optionsArg.harness;
|
|
18
|
-
this.scopeIds = [...new Set(optionsArg.scopeIds)].sort();
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
public async run(signalArg?: AbortSignal): Promise<void> {
|
|
22
|
-
for (const scopeId of this.scopeIds) {
|
|
23
|
-
signalArg?.throwIfAborted();
|
|
24
|
-
// listSessions durably repairs legacy session generations before PM state is loaded.
|
|
25
|
-
const sessions = await this.harness.listSessions(scopeId);
|
|
26
|
-
for (const session of sessions) {
|
|
27
|
-
signalArg?.throwIfAborted();
|
|
28
|
-
await this.harness.getProjectState(scopeId, session.sessionId);
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
}
|