@a-t-h-i/bot-lobby 0.6.6 → 0.6.7

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.
@@ -296,7 +296,7 @@ async function handleClarify(task: Task, params: OrchestrateParams, deps: Workfl
296
296
  }
297
297
  const answer = params.options?.length ? await deps.choose(question, params.options) : await deps.ask(question);
298
298
  if (answer === undefined) {
299
- return `No answer captured. Ask the user this in your reply, then continue.\n\nQuestion: ${question}`;
299
+ return `The user did not answer. Do not assume an answer or pick the recommended option: ask the user this again in your reply, end your turn, and continue only once they have answered.\n\nQuestion: ${question}`;
300
300
  }
301
301
  return `User answered: ${answer}`;
302
302
  }
@@ -681,6 +681,10 @@ function workerRequest(deps: WorkflowDeps, task: Task, domain: Domain, instructi
681
681
  };
682
682
  }
683
683
 
684
+ const ANSWER_NOW = "Answer the questions now";
685
+ /** Times an agent's abandoned questions are put to the user again before it decides. */
686
+ const MAX_NUDGES = 5;
687
+
684
688
  /** Agents that may ask the user themselves: the designer, whose choices are the user's to see. */
685
689
  const ASKING_DOMAINS: ReadonlySet<Domain> = new Set(["designer"]);
686
690
 
@@ -706,7 +710,13 @@ function askRelay(task: Task, deps: WorkflowDeps, domain: Domain): { onAsk: Rela
706
710
  if (isAutoMode(deps.root, deps.configDir, task.id)) {
707
711
  return { answers: [], cancelled: true, globalNote: "Auto mode is on, so nobody can answer: decide with the options you recommend and say in your report what you chose and why." };
708
712
  }
709
- const result = await askQuestions(questions, label, signal);
713
+ let result = await askQuestions(questions, label, signal);
714
+ // Leaving the questions must not quietly hand the choice to the agent: ask whether it may decide.
715
+ for (let nudges = 0; result.answers.length === 0 && result.cancelled && !signal.aborted && nudges < MAX_NUDGES; nudges++) {
716
+ const choice = await deps.choose(`${label} is waiting for your answer${questions.length === 1 ? "" : "s"} (${questions.map((question) => question.header).join(", ")}).`, [ANSWER_NOW, `Let ${label} decide with its recommendation`]);
717
+ if (choice !== ANSWER_NOW && choice !== undefined) break;
718
+ result = await askQuestions(questions, label, signal);
719
+ }
710
720
  recordDecision(task, askedDecision(label, questions, result), domain);
711
721
  return result;
712
722
  });