feat(frontend): multiselect/artifact-gate/artifact widgets + linkage + no-limbo

This commit is contained in:
2026-06-28 12:36:13 +02:00
parent 2b55e96608
commit be9e761e0a
8 changed files with 389 additions and 1 deletions
+27
View File
@@ -0,0 +1,27 @@
import { useState } from "react";
import type { WidgetDescriptor, UiResponse } from "../api/types";
import { FreetextWidget } from "./FreetextWidget";
/**
* LinkageHost: when an artifact-gate option has `opens` (a child descriptor),
* this component renders the child widget and merges the parent choice with
* the child's text into a single combined UiResponse.
*/
export function LinkageHost({
parentResponse,
childDescriptor,
onRespond,
}: {
parentResponse: UiResponse;
childDescriptor: WidgetDescriptor;
onRespond: (r: UiResponse) => void;
}) {
function handleChildResponse(childResponse: UiResponse) {
// Merge parent choice + child text into one response
onRespond({ ...parentResponse, text: childResponse.text });
}
// Currently only freetext child is supported per spec.
// FreetextWidget is the canonical child for "opens".
return <FreetextWidget descriptor={childDescriptor} onRespond={handleChildResponse} />;
}