openclaw
Version:
Multi-channel AI gateway with extensible messaging integrations
40 lines (39 loc) • 1.32 kB
JavaScript
import { o as registerSecretValueForRedaction } from "./secret-redaction-registry-Cy0acctn.mjs";
//#region src/commands/gateway-wizard-step.ts
/** Project a Gateway wizard's input contract onto a terminal prompter. */
async function answerGatewayWizardStep(e, t, n = {}) {
const r = e.message ?? e.title ?? "Continue";
switch (e.type) {
case "text": {
const i = await t.text({
message: r,
sensitive: e.sensitive,
placeholder: e.placeholder,
initialValue: typeof e.initialValue === "string" ? e.initialValue : void 0,
...n.signal ? { signal: n.signal } : {}
});
if (e.sensitive) registerSecretValueForRedaction(i);
return i;
}
case "select": return await t.select({
message: r,
options: e.options ?? [],
initialValue: e.initialValue,
...n.searchable ? { searchable: true } : {}
});
case "multiselect": return await t.multiselect({
message: r,
options: e.options ?? [],
initialValues: Array.isArray(e.initialValue) ? e.initialValue : void 0,
...n.searchable ? { searchable: true } : {}
});
case "confirm":
case "action": return await t.confirm({
message: r,
initialValue: typeof e.initialValue === "boolean" ? e.initialValue : void 0
});
case "note": await t.note(r, e.title);
}
}
//#endregion
export { answerGatewayWizardStep as t };