@livx.cc/agentx 0.99.53 → 0.99.55

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 CHANGED
@@ -3031,15 +3031,25 @@ var askUserQuestionTool = {
3031
3031
  multiSelect: { type: "boolean" }
3032
3032
  }
3033
3033
  },
3034
- async run(args, ctx) {
3034
+ async run(input, ctx) {
3035
+ const args = normalizeQuestion(input);
3036
+ if (typeof args === "string") return args;
3035
3037
  if (!ctx.host?.ask) {
3036
3038
  ctx.needsInput = args;
3037
3039
  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.";
3038
3040
  }
3039
3041
  const answer = ctx.host.ask(args);
3040
- return ctx.parkHuman ? ctx.parkHuman(answer) : answer;
3042
+ return String(await (ctx.parkHuman ? ctx.parkHuman(answer) : answer) ?? "");
3041
3043
  }
3042
3044
  };
3045
+ function normalizeQuestion(input) {
3046
+ const raw = input?.questions?.[0] ?? input;
3047
+ const q2 = raw ?? {};
3048
+ const options = (Array.isArray(q2.options) ? q2.options : []).map((o) => typeof o === "string" ? { label: o } : { label: String(o?.label ?? ""), description: o?.description }).filter((o) => o.label.trim());
3049
+ if (typeof q2.question !== "string" || !q2.question.trim() || !options.length)
3050
+ return "Error: AskUserQuestion needs {question: string, options: [{label, description?}] (non-empty)}.";
3051
+ return { question: q2.question, header: typeof q2.header === "string" ? q2.header : void 0, options, multiSelect: q2.multiSelect === true };
3052
+ }
3043
3053
 
3044
3054
  // src/relevance.ts
3045
3055
  var STOP = /* @__PURE__ */ new Set([
@@ -3546,7 +3556,9 @@ import { join as join4 } from "path";
3546
3556
  var MODEL_ALIASES = {
3547
3557
  fable: "claude-fable-5",
3548
3558
  "fable-5": "claude-fable-5",
3549
- opus: "claude-opus-4-8",
3559
+ opus: "claude-opus-5-5",
3560
+ "opus-5-5": "claude-opus-5-5",
3561
+ "opus-5": "claude-opus-5",
3550
3562
  "opus-4-8": "claude-opus-4-8",
3551
3563
  "opus-4-7": "claude-opus-4-7",
3552
3564
  "opus-4-6": "claude-opus-4-6",
@@ -8188,8 +8200,8 @@ ${nowLine()}. Anchor every relative or time-sensitive reference \u2014 "today",
8188
8200
  this.emitHost({ ...ev, message: safe });
8189
8201
  return;
8190
8202
  }
8191
- const held = this.reflexBuf.length - this.reflexForwarded;
8192
- const partial = held > 0 && /\[\s*t?a?s?k?$/i.test(this.reflexBuf.slice(-Math.min(held, 6)));
8203
+ const held2 = this.reflexBuf.length - this.reflexForwarded;
8204
+ const partial = held2 > 0 && /\[\s*t?a?s?k?$/i.test(this.reflexBuf.slice(-Math.min(held2, 6)));
8193
8205
  let upto = partial ? this.reflexBuf.length - this.reflexBuf.slice(-6).match(/\[\s*t?a?s?k?$/i)[0].length : this.reflexBuf.length;
8194
8206
  const paren = this.reflexBuf.lastIndexOf("(");
8195
8207
  if (paren >= this.reflexForwarded && !this.reflexBuf.includes(")", paren) && this.reflexBuf.length - paren <= 80)
@@ -13006,8 +13018,37 @@ function createLineEditor(out, input = keyInput) {
13006
13018
  }
13007
13019
  var menusOpen = 0;
13008
13020
  var isMenuActive = () => menusOpen > 0;
13009
- function selectMenu(out, opts) {
13010
- if (!out.isTTY || !process.stdin.isTTY || !opts.items.length) return Promise.resolve(null);
13021
+ var held = null;
13022
+ function holdOutput() {
13023
+ if (held) return;
13024
+ const h = { orig: /* @__PURE__ */ new Map(), queue: [] };
13025
+ for (const s of [process.stdout, process.stderr]) {
13026
+ h.orig.set(s, s.write);
13027
+ s.write = ((...a) => {
13028
+ h.queue.push([s, a]);
13029
+ const cb = a.find((x) => typeof x === "function");
13030
+ cb?.();
13031
+ return true;
13032
+ });
13033
+ }
13034
+ held = h;
13035
+ process.once("exit", releaseOutput);
13036
+ }
13037
+ function releaseOutput() {
13038
+ if (!held) return;
13039
+ const h = held;
13040
+ held = null;
13041
+ process.off("exit", releaseOutput);
13042
+ for (const [s, w] of h.orig) s.write = w;
13043
+ for (const [s, a] of h.queue) s.write(...a.filter((x) => typeof x !== "function"));
13044
+ }
13045
+ function selectMenu(stream, opts) {
13046
+ if (!stream.isTTY || !process.stdin.isTTY || !opts.items.length) return Promise.resolve(null);
13047
+ holdOutput();
13048
+ const raw = held.orig.get(stream);
13049
+ const out = { get columns() {
13050
+ return stream.columns;
13051
+ }, write: (x) => raw ? raw.call(stream, x) : stream.write(x) };
13011
13052
  const maxVisible = opts.maxVisible ?? 10;
13012
13053
  const dim2 = (x) => `\x1B[2m${x}\x1B[0m`;
13013
13054
  const inverse = (x) => `\x1B[7m${x}\x1B[0m`;
@@ -13075,6 +13116,7 @@ function selectMenu(out, opts) {
13075
13116
  keyInput.off("keypress", onKey);
13076
13117
  if (prevLines > 1) out.write(`\x1B[${prevLines - 1}A`);
13077
13118
  out.write("\r\x1B[J");
13119
+ if (!menusOpen) releaseOutput();
13078
13120
  if (!wasRaw) {
13079
13121
  try {
13080
13122
  keyInput.setRawMode(false);
@@ -13640,6 +13682,7 @@ var spinner = /* @__PURE__ */ (() => {
13640
13682
  if (!tty || timer) return;
13641
13683
  t0 = this.turnStart || Date.now();
13642
13684
  timer = setInterval(() => {
13685
+ if (isMenuActive()) return;
13643
13686
  const secs2 = Math.round((Date.now() - t0) / 1e3);
13644
13687
  const tail = this.tail?.();
13645
13688
  err("\r\x1B[2K" + dim(` ${frames[i = (i + 1) % frames.length]} ${label} ${secs2 ? `${secs2}s \xB7 ` : ""}esc to interrupt`) + (tail ? " " + tail : ""));
@@ -14001,6 +14044,10 @@ function makeHost(format = "text", opts) {
14001
14044
  process.stdout.write(JSON.stringify({ type: "tool_activity", id: a.id, name: a.name, input: a.input, output: a.output, status: a.status }) + "\n");
14002
14045
  return;
14003
14046
  }
14047
+ if (a.input?.providerIdentifier === "custom-user-tools") {
14048
+ spinner.start();
14049
+ return;
14050
+ }
14004
14051
  const clip = (s) => s.length > 200 ? s.slice(0, 200) + "\u2026" : s;
14005
14052
  const terminal = a.status === "completed" || a.status === "error";
14006
14053
  if (!terminal || !a.id || !activitySeen.has(a.id)) {
@@ -14054,6 +14101,7 @@ function makeHost(format = "text", opts) {
14054
14101
  ...canPrompt ? {
14055
14102
  async ask(q2) {
14056
14103
  const title = `? ${q2.header ? "[" + q2.header + "] " : ""}${q2.question}`;
14104
+ spinner.stop();
14057
14105
  const v = await selectMenu(process.stderr, { title, items: q2.options.map((o) => ({ label: o.label, value: o.label, desc: o.description })) });
14058
14106
  if (v !== null) return v;
14059
14107
  const io = createInterface({ input: keyInput, output: process.stderr });