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