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