u-foo 1.7.0 → 1.7.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
package/src/daemon/ops.js
CHANGED
|
@@ -9,8 +9,6 @@ const { isITerm2 } = require("../terminal/detect");
|
|
|
9
9
|
const { createTerminalAdapterRouter } = require("../terminal/adapterRouter");
|
|
10
10
|
const {
|
|
11
11
|
createSession: createHostSession,
|
|
12
|
-
closeSession: closeHostSession,
|
|
13
|
-
sendToSocket: sendHostSocketRequest,
|
|
14
12
|
} = require("../terminal/adapters/hostAdapter");
|
|
15
13
|
|
|
16
14
|
function normalizeLaunchAgent(agent = "") {
|
|
@@ -468,27 +466,12 @@ async function spawnManagedHostAgent(
|
|
|
468
466
|
createOptions.source_session_id = hostContext.hostSessionId;
|
|
469
467
|
}
|
|
470
468
|
|
|
471
|
-
const created = await createHostSession(hostContext.hostDaemonSock, createOptions);
|
|
472
|
-
const sessionId = normalizeOptionalString(created?.session_id);
|
|
473
|
-
const injectSock = normalizeOptionalString(created?.inject_sock);
|
|
474
|
-
if (!sessionId || !injectSock) {
|
|
475
|
-
throw new Error("host create_session returned incomplete session info");
|
|
476
|
-
}
|
|
477
|
-
|
|
478
469
|
const args = Array.isArray(extraArgs) ? extraArgs : [];
|
|
479
470
|
const argText = args.length > 0 ? ` ${args.map(shellEscape).join(" ")}` : "";
|
|
480
|
-
const envParts = [
|
|
481
|
-
"UFOO_LAUNCH_MODE=host",
|
|
482
|
-
`UFOO_HOST_DAEMON_SOCK=${shellEscape(hostContext.hostDaemonSock)}`,
|
|
483
|
-
`UFOO_HOST_SESSION_ID=${shellEscape(sessionId)}`,
|
|
484
|
-
`UFOO_HOST_INJECT_SOCK=${shellEscape(injectSock)}`,
|
|
485
|
-
];
|
|
471
|
+
const envParts = ["UFOO_LAUNCH_MODE=host"];
|
|
486
472
|
if (nickname) {
|
|
487
473
|
envParts.push(`UFOO_NICKNAME=${shellEscape(nickname)}`);
|
|
488
474
|
}
|
|
489
|
-
if (hostContext.hostName) {
|
|
490
|
-
envParts.push(`UFOO_HOST_NAME=${shellEscape(hostContext.hostName)}`);
|
|
491
|
-
}
|
|
492
475
|
if (extraEnv) {
|
|
493
476
|
envParts.push(String(extraEnv).trim());
|
|
494
477
|
}
|
|
@@ -498,16 +481,13 @@ async function spawnManagedHostAgent(
|
|
|
498
481
|
const runCmd = titleCmd
|
|
499
482
|
? `cd ${shellEscape(projectRoot)} && ${titleCmd} && ${launchCmd}`
|
|
500
483
|
: `cd ${shellEscape(projectRoot)} && ${launchCmd}`;
|
|
484
|
+
createOptions.command = runCmd;
|
|
501
485
|
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
} catch {
|
|
508
|
-
// ignore cleanup failures
|
|
509
|
-
}
|
|
510
|
-
throw err;
|
|
486
|
+
const created = await createHostSession(hostContext.hostDaemonSock, createOptions);
|
|
487
|
+
const sessionId = normalizeOptionalString(created?.session_id);
|
|
488
|
+
const injectSock = normalizeOptionalString(created?.inject_sock);
|
|
489
|
+
if (!sessionId || !injectSock) {
|
|
490
|
+
throw new Error("host create_session returned incomplete session info");
|
|
511
491
|
}
|
|
512
492
|
|
|
513
493
|
const subscriberId = await waitForNewSubscriber(projectRoot, agentType, existing, 20000);
|
|
@@ -334,7 +334,7 @@ async function requestCloseSession(sockPath) {
|
|
|
334
334
|
/**
|
|
335
335
|
* Create a new terminal session via the daemon management socket.
|
|
336
336
|
* @param {string} [daemonSock] - Override daemon socket path (defaults to env)
|
|
337
|
-
* @param {object} [opts] - Options: { group_id, source_session_id }
|
|
337
|
+
* @param {object} [opts] - Options: { group_id, source_session_id, command }
|
|
338
338
|
* @returns {Promise<{session_id: string, inject_sock: string}>}
|
|
339
339
|
*/
|
|
340
340
|
async function createSession(daemonSock, opts = {}) {
|
|
@@ -342,6 +342,7 @@ async function createSession(daemonSock, opts = {}) {
|
|
|
342
342
|
const req = { type: "create_session" };
|
|
343
343
|
if (opts.group_id) req.group_id = opts.group_id;
|
|
344
344
|
if (opts.source_session_id) req.source_session_id = opts.source_session_id;
|
|
345
|
+
if (opts.command) req.command = opts.command;
|
|
345
346
|
return sendToSocket(sock, req);
|
|
346
347
|
}
|
|
347
348
|
|