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