fix: make join review read only
This commit is contained in:
@@ -31,6 +31,7 @@ import {
|
||||
buildMultiselectRequest,
|
||||
buildArtifactGate,
|
||||
buildSchemaLinkingRequest,
|
||||
buildJoinReviewRequest,
|
||||
} from "./gate/builders.js";
|
||||
import {
|
||||
validateCtePlanV2,
|
||||
@@ -728,6 +729,9 @@ export default function (pi) {
|
||||
const meritOptions = opts
|
||||
.filter((o) => !isReserved(o.label))
|
||||
.map((o) => ({ id: o.id, label: o.label }));
|
||||
const joinOnly = meritOptions.length > 0 && opts
|
||||
.filter((o) => !isReserved(o.label))
|
||||
.every((o) => o.decision.type === "join_modified");
|
||||
if (shouldSkipEmptyDecide({ meritCount: meritOptions.length, allowEmpty: params.allow_empty ?? false, advance })) {
|
||||
await ctx.ui.notify(
|
||||
"Nessuna memory riutilizzabile per questa domanda — passo alla fase successiva.",
|
||||
@@ -738,14 +742,28 @@ export default function (pi) {
|
||||
"Fase memoria vuota: nessuna decisione da registrare, avanzamento automatico alla fase successiva.",
|
||||
);
|
||||
}
|
||||
const widget = buildMultiselectRequest({
|
||||
id: `u${Date.now()}`,
|
||||
phase,
|
||||
title: phase === "F2" ? memorySelectionWidgetProps(opts).title : title,
|
||||
allowEmpty: params.allow_empty ?? false,
|
||||
options: meritOptions,
|
||||
...(phase === "F2" ? memorySelectionWidgetProps(opts) : {}),
|
||||
});
|
||||
const widget = joinOnly
|
||||
? buildJoinReviewRequest({
|
||||
id: `u${Date.now()}`,
|
||||
phase,
|
||||
title,
|
||||
options: opts
|
||||
.filter((o) => !isReserved(o.label))
|
||||
.map((o) => ({
|
||||
id: o.id,
|
||||
label: o.label,
|
||||
detail: o.decision.detail ?? "",
|
||||
rationale: o.decision.rationale ?? "",
|
||||
})),
|
||||
})
|
||||
: buildMultiselectRequest({
|
||||
id: `u${Date.now()}`,
|
||||
phase,
|
||||
title: phase === "F2" ? memorySelectionWidgetProps(opts).title : title,
|
||||
allowEmpty: params.allow_empty ?? false,
|
||||
options: meritOptions,
|
||||
...(phase === "F2" ? memorySelectionWidgetProps(opts) : {}),
|
||||
});
|
||||
const resp = await emitAndWait(ctx, widget);
|
||||
if (resp.control === "freetext") {
|
||||
return textResult(
|
||||
@@ -756,7 +774,9 @@ export default function (pi) {
|
||||
return textResult("Il reviewer vuole tornare indietro.");
|
||||
if (resp.control === "exit")
|
||||
return textResult("Il reviewer vuole uscire.");
|
||||
const chosen = opts.filter((o) => (resp.choices ?? []).includes(o.id));
|
||||
const chosen = joinOnly
|
||||
? opts.filter((o) => !isReserved(o.label))
|
||||
: opts.filter((o) => (resp.choices ?? []).includes(o.id));
|
||||
for (const c of chosen) {
|
||||
const d = c.decision;
|
||||
const err = relayIfThtFails(ctx, decisionAddArgs(session, d), "");
|
||||
|
||||
Reference in New Issue
Block a user