The dashboard could not name a workflow's declared inputs, so POST /api/work-requests admitted a pr-review task with no pr_number, which then failed at the workflow's intake stage (archie-core-06nq). The handler now takes `inputs`, checks it against the workflow's declared interface before admitting the task, and carries it through SpawnRequest.Inputs -> EnqueueChatTaskRequest; the form renders one field per declared input, sends a declared number as a number, and keeps Start disabled while a required input is empty. Item 2 of the lane brief -- archie-core-afbk.12, review.precision_gate / review.approve_before_post in the dashboard Config tab -- is deliberately NOT in this commit. The surface it describes no longer exists in this tree; the supervisor's decision was to stop it and re-scope it as its own lane, and the facts it must start from belong in the branch's record: * The Config-tab components were deleted by5f08625d(2026-09-25, "the legacy config catalog stops advertising fields the control plane owns"): ConfigSections.vue, ConfigRow.vue, ConfigControl.vue, ConfigList.vue, ConfigNotices.vue, ConfigUnavailable.vue, config-field.ts and sections.ts all went, because no page used them. Descriptor entries in internal/webui/config_schema.go would therefore change nothing a person can see: the only consumer of GET /api/config is SystemModelsPage reading `catalog`; the per-field `schema` has no renderer. * The config write seams went earlier, in2311529d(2026-09-21, "delete the runtime config overlay"): UpdateConfig, ResetConfig and UpdateRepoField are gone and internal/webui/server.go serves only GET /api/config. Configuration is written through the control plane. * No control-plane resource carries review settings. executionSettingsDocument (internal/app/controlplane/workflow_settings.go) and workflow.ExecutionSettings carry only the four budget fields, and runtimeConfigFrom never layers cfg.Review. That is exactly why the budget descriptors survive in the catalog and review.* cannot: budgets are saved through workflow-execution-settings, edited on the Task-execution page, so those entries match a real write path. * The brief's precedent name is wrong: TestToolSettingsProjectionCarriesEveryMCPServerField does not exist. The precedent is TestToolSettingsProjectionCarriesEveryMirroredField (internal/app/controlplane/runtime_config_test.go:349). Making review.* genuinely editable needs a carrying control-plane resource (extend workflow-execution-settings or add a review-settings kind), a layering step in internal/app/archied/control_plane.go, and the round-trip test that precedent sets -- an unsettled design decision spanning packages this lane does not own.
96 lines
3.1 KiB
TypeScript
96 lines
3.1 KiB
TypeScript
/**
|
|
* The work-request form's input vocabulary: what the chosen workflow declares,
|
|
* and how one field's text becomes the typed value the daemon checks.
|
|
*
|
|
* A workflow is startable only by naming what it declares. pr-review requires
|
|
* pr_number, so a request that does not set it is refused by the handler
|
|
* (archie-core-06nq) rather than admitted and then parked at dispatch. The
|
|
* declaration comes from the definitions endpoint, so a workflow that starts
|
|
* declaring inputs needs no change here.
|
|
*/
|
|
|
|
import type { WorkflowDefinition } from "./workflow-rows";
|
|
|
|
/** One input a workflow declares, as the form renders it. */
|
|
export interface DeclaredInput {
|
|
name: string;
|
|
/** The declared type: string, number, bool, object, array or any. */
|
|
type: string;
|
|
required: boolean;
|
|
}
|
|
|
|
/**
|
|
* declaredInputs lists the inputs a workflow declares, by name. Sorted, so the
|
|
* fields keep their places while the operator types and across re-renders.
|
|
*/
|
|
export function declaredInputs(
|
|
definition?: WorkflowDefinition,
|
|
): DeclaredInput[] {
|
|
return Object.entries(definition?.inputs ?? {})
|
|
.map(([name, spec]) => ({
|
|
name,
|
|
type: spec.type,
|
|
required: spec.required === true,
|
|
}))
|
|
.sort((a, b) => a.name.localeCompare(b.name));
|
|
}
|
|
|
|
/**
|
|
* missingRequiredInputs names the declared inputs that are required and still
|
|
* empty, so the form disables Start instead of earning the server's refusal.
|
|
*/
|
|
export function missingRequiredInputs(
|
|
declared: DeclaredInput[],
|
|
text: Record<string, string>,
|
|
): string[] {
|
|
return declared
|
|
.filter((input) => input.required && !(text[input.name] ?? "").trim())
|
|
.map((input) => input.name);
|
|
}
|
|
|
|
/**
|
|
* inputValue is the typed value one field's text stands for. Text that does not
|
|
* read as the declared type travels as it was typed, so the server's check
|
|
* names the mismatch rather than this guessing at a value nobody typed.
|
|
*/
|
|
export function inputValue(text: string, type: string): unknown {
|
|
switch (type) {
|
|
case "number": {
|
|
const trimmed = text.trim();
|
|
return trimmed !== "" && !Number.isNaN(Number(trimmed))
|
|
? Number(trimmed)
|
|
: text;
|
|
}
|
|
case "bool":
|
|
return text === "true" ? true : text === "false" ? false : text;
|
|
case "string":
|
|
return text;
|
|
default:
|
|
// object, array and any: the field's text is JSON.
|
|
try {
|
|
return JSON.parse(text);
|
|
} catch {
|
|
return text;
|
|
}
|
|
}
|
|
}
|
|
|
|
/**
|
|
* inputValues builds the `inputs` object the request carries: the declared
|
|
* inputs the operator filled in. An input left empty is absent rather than an
|
|
* empty string, so an optional input is simply unset and a required one is
|
|
* caught by missingRequiredInputs before the request is sent.
|
|
*/
|
|
export function inputValues(
|
|
declared: DeclaredInput[],
|
|
text: Record<string, string>,
|
|
): Record<string, unknown> {
|
|
const inputs: Record<string, unknown> = {};
|
|
for (const input of declared) {
|
|
const value = text[input.name];
|
|
if (value === undefined || value === "") continue;
|
|
inputs[input.name] = inputValue(value, input.type);
|
|
}
|
|
return inputs;
|
|
}
|