dsh-wsr-execution 0.2.8 → 0.2.9
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/package.json
CHANGED
|
@@ -214,6 +214,40 @@ export class IntakeSessionBindingRepository {
|
|
|
214
214
|
return candidate;
|
|
215
215
|
}
|
|
216
216
|
|
|
217
|
+
async archiveTerminalResult(sessionKey, result) {
|
|
218
|
+
this.#ready();
|
|
219
|
+
if (typeof sessionKey !== "string" || sessionKey.length === 0
|
|
220
|
+
|| result === null || typeof result !== "object" || Array.isArray(result)
|
|
221
|
+
|| result.kind !== "TERMINAL"
|
|
222
|
+
|| typeof result.deliveryId !== "string" || result.deliveryId.length === 0
|
|
223
|
+
|| typeof result.worktree !== "string" || !isAbsolute(result.worktree)
|
|
224
|
+
|| !["SUCCEEDED", "FAILED", "CANCELLED"].includes(result.outcome)) {
|
|
225
|
+
throw new IntakeBindingError("INTAKE_BINDING_INVARIANT_VIOLATION");
|
|
226
|
+
}
|
|
227
|
+
const worktree = resolve(result.worktree);
|
|
228
|
+
const historical = this.#historical.find((entry) => entry.deliveryId === result.deliveryId);
|
|
229
|
+
if (historical !== undefined) {
|
|
230
|
+
if (historical.sessionKey === sessionKey && historical.worktree === worktree) return historical;
|
|
231
|
+
throw new IntakeBindingError("INTAKE_BINDING_INVARIANT_VIOLATION");
|
|
232
|
+
}
|
|
233
|
+
const active = this.#active.find((entry) => entry.deliveryId === result.deliveryId);
|
|
234
|
+
if (active === undefined || active.sessionKey !== sessionKey || active.worktree !== worktree) {
|
|
235
|
+
throw new IntakeBindingError("INTAKE_BINDING_INVARIANT_VIOLATION");
|
|
236
|
+
}
|
|
237
|
+
const candidate = exactHistorical({
|
|
238
|
+
sessionKey: active.sessionKey,
|
|
239
|
+
correlation: active.correlation,
|
|
240
|
+
deliveryId: active.deliveryId,
|
|
241
|
+
deliveryBindingIdentity: active.deliveryBindingIdentity,
|
|
242
|
+
worktree: active.worktree,
|
|
243
|
+
});
|
|
244
|
+
this.#active.splice(this.#active.indexOf(active), 1);
|
|
245
|
+
this.#historical.push(candidate);
|
|
246
|
+
validateTogether(this.#active, this.#historical);
|
|
247
|
+
await this.#persist();
|
|
248
|
+
return candidate;
|
|
249
|
+
}
|
|
250
|
+
|
|
217
251
|
async markDetached(deliveryId) {
|
|
218
252
|
this.#ready();
|
|
219
253
|
const index = this.#active.findIndex((entry) => entry.deliveryId === deliveryId);
|
package/src/intake/plugin.js
CHANGED
|
@@ -465,7 +465,7 @@ export async function createPluginRuntime(config, options = {}) {
|
|
|
465
465
|
const result = await service.invoke(Object.freeze({ operation: "abandon", deliveryId, correlation }));
|
|
466
466
|
if (result.kind === "TERMINAL") {
|
|
467
467
|
const detached = await bindings.byDelivery(deliveryId);
|
|
468
|
-
if (detached !== undefined) await
|
|
468
|
+
if (detached !== undefined) await bindings.archiveTerminalResult(detached.sessionKey, result);
|
|
469
469
|
if (detached !== undefined) sessionByCorrelation.delete(detached.correlation);
|
|
470
470
|
}
|
|
471
471
|
return result;
|