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