@livx.cc/agentx 0.99.53 → 0.99.54
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/dist/cli.js +52 -6
- package/dist/cli.js.map +1 -1
- package/dist/index.js +12 -2
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -2798,15 +2798,25 @@ var askUserQuestionTool = {
|
|
|
2798
2798
|
multiSelect: { type: "boolean" }
|
|
2799
2799
|
}
|
|
2800
2800
|
},
|
|
2801
|
-
async run(
|
|
2801
|
+
async run(input, ctx) {
|
|
2802
|
+
const args = normalizeQuestion(input);
|
|
2803
|
+
if (typeof args === "string") return args;
|
|
2802
2804
|
if (!ctx.host?.ask) {
|
|
2803
2805
|
ctx.needsInput = args;
|
|
2804
2806
|
return "PAUSED \u2014 no interactive user is reachable from this run, so your question has been raised to the caller that delegated this task. The run stops here; do not guess and do not continue. Their answer will arrive as the next user message when the run resumes.";
|
|
2805
2807
|
}
|
|
2806
2808
|
const answer = ctx.host.ask(args);
|
|
2807
|
-
return ctx.parkHuman ? ctx.parkHuman(answer) : answer;
|
|
2809
|
+
return String(await (ctx.parkHuman ? ctx.parkHuman(answer) : answer) ?? "");
|
|
2808
2810
|
}
|
|
2809
2811
|
};
|
|
2812
|
+
function normalizeQuestion(input) {
|
|
2813
|
+
const raw = input?.questions?.[0] ?? input;
|
|
2814
|
+
const q = raw ?? {};
|
|
2815
|
+
const options = (Array.isArray(q.options) ? q.options : []).map((o) => typeof o === "string" ? { label: o } : { label: String(o?.label ?? ""), description: o?.description }).filter((o) => o.label.trim());
|
|
2816
|
+
if (typeof q.question !== "string" || !q.question.trim() || !options.length)
|
|
2817
|
+
return "Error: AskUserQuestion needs {question: string, options: [{label, description?}] (non-empty)}.";
|
|
2818
|
+
return { question: q.question, header: typeof q.header === "string" ? q.header : void 0, options, multiSelect: q.multiSelect === true };
|
|
2819
|
+
}
|
|
2810
2820
|
var ScriptedHostBridge = class {
|
|
2811
2821
|
constructor(answers = [], confirmDefault = true) {
|
|
2812
2822
|
this.answers = answers;
|