Lines 241-281javascript
242async function cmdAnswerQuestion(flags) {
243 const taskId = flags.task || flags.taskId;
244 const messageId = flags.message || flags.messageId;
245 let answer = flags.answer;
246 if (!taskId || !messageId) {
247 throw new Error("Usage: relay answer-question --task TASK_ID --message MESSAGE_ID --answer ANSWER");
249 if (!answer) answer = await prompt("Answer: ");
250 const client = new RelayClient();
251 await client.answerHumanQuestion(taskId, messageId, {
252 answerMarkdown: answer,
253 idempotencyKey: `human_answer_${Date.now()}`,
255 console.log("Sent answer to Relay. The waiting task agent will resume on the next daemon poll.");
258/** Launch the desktop Relay companion pill (Electron overlay). */
260 const here = path.dirname(fileURLToPath(import.meta.url));
261 const overlayMain = path.resolve(here, "../overlay/main.cjs");
262 // require("electron") returns the path to the electron binary when resolved under node.
263 let electronPath;
MediumDynamic Require
Package source references dynamic require/import behavior.
bin/relay.jsView on unpkg · L261 265 const require = createRequire(import.meta.url);
266 electronPath = require("electron");
269 "Electron is not installed. Run `npm install` in packages/companion first. (" +
270 (error && error.message ? error.message : error) +
274 if (typeof electronPath !== "string") {
275 throw new Error("Could not resolve the Electron binary. Run `npm install` in packages/companion.");
277 const child = spawn(electronPath, [overlayMain], {
280 env: { ...process.env },