overlord-cli 0.2608181022.0 → 0.2608181255.0
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/dist/index.js +39 -38
- package/dist/index.js.map +3 -3
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -17134,7 +17134,7 @@ var init_latch_session_absent = __esm({
|
|
|
17134
17134
|
});
|
|
17135
17135
|
|
|
17136
17136
|
// ../packages/core/dist/service/latch-session.js
|
|
17137
|
-
import {
|
|
17137
|
+
import { execFile } from "node:child_process";
|
|
17138
17138
|
function latchSessionCommandError(detail) {
|
|
17139
17139
|
const message = detail || "Latch command failed.";
|
|
17140
17140
|
return isLatchSessionAbsentMessage(message) ? new LatchSessionAbsentError(message) : new LatchSessionCommandError(message);
|
|
@@ -17156,24 +17156,25 @@ function parseState(value) {
|
|
|
17156
17156
|
return null;
|
|
17157
17157
|
}
|
|
17158
17158
|
}
|
|
17159
|
-
function runLatchJson({ executable, args }) {
|
|
17159
|
+
async function runLatchJson({ executable, args }) {
|
|
17160
17160
|
const binary = resolveLatchBinaryPath(executable);
|
|
17161
17161
|
if (!binary)
|
|
17162
17162
|
throw new LatchSessionCommandError(latchBinaryMissingMessage(executable));
|
|
17163
|
-
const result =
|
|
17164
|
-
|
|
17165
|
-
|
|
17166
|
-
|
|
17167
|
-
|
|
17168
|
-
|
|
17163
|
+
const result = await new Promise((resolve, reject) => {
|
|
17164
|
+
execFile(binary, args, {
|
|
17165
|
+
encoding: "utf8",
|
|
17166
|
+
timeout: 1e4,
|
|
17167
|
+
maxBuffer: 1024 * 1024,
|
|
17168
|
+
env: latchChildEnvironment()
|
|
17169
|
+
}, (error, stdout, stderr) => {
|
|
17170
|
+
if (error) {
|
|
17171
|
+
const detail = (stderr || stdout || error.message).trim().slice(0, 500);
|
|
17172
|
+
reject(latchSessionCommandError(detail));
|
|
17173
|
+
return;
|
|
17174
|
+
}
|
|
17175
|
+
resolve({ stdout, stderr });
|
|
17176
|
+
});
|
|
17169
17177
|
});
|
|
17170
|
-
if (result.error) {
|
|
17171
|
-
throw new LatchSessionCommandError(result.error.message);
|
|
17172
|
-
}
|
|
17173
|
-
if (result.status !== 0) {
|
|
17174
|
-
const detail = (result.stderr || result.stdout || `exit ${result.status ?? "unknown"}`).trim().slice(0, 500);
|
|
17175
|
-
throw latchSessionCommandError(detail);
|
|
17176
|
-
}
|
|
17177
17178
|
try {
|
|
17178
17179
|
const parsed = JSON.parse(result.stdout);
|
|
17179
17180
|
if (!parsed || typeof parsed !== "object" || Array.isArray(parsed)) {
|
|
@@ -17184,11 +17185,11 @@ function runLatchJson({ executable, args }) {
|
|
|
17184
17185
|
throw new LatchSessionCommandError("Latch returned an invalid JSON response.");
|
|
17185
17186
|
}
|
|
17186
17187
|
}
|
|
17187
|
-
function inspectLatchSession({ executable = "latch", providerSessionId }) {
|
|
17188
|
+
async function inspectLatchSession({ executable = "latch", providerSessionId }) {
|
|
17188
17189
|
const sessionId = trimmed5(providerSessionId);
|
|
17189
17190
|
if (!sessionId)
|
|
17190
17191
|
throw new LatchSessionCommandError("A Latch session id is required.");
|
|
17191
|
-
const report = runLatchJson({
|
|
17192
|
+
const report = await runLatchJson({
|
|
17192
17193
|
executable: trimmed5(executable) ?? "latch",
|
|
17193
17194
|
args: ["inspect", sessionId, "--json"]
|
|
17194
17195
|
});
|
|
@@ -17204,14 +17205,14 @@ function inspectLatchSession({ executable = "latch", providerSessionId }) {
|
|
|
17204
17205
|
inspectedAt: (/* @__PURE__ */ new Date()).toISOString()
|
|
17205
17206
|
};
|
|
17206
17207
|
}
|
|
17207
|
-
function readLatchProductVersion(executable) {
|
|
17208
|
+
async function readLatchProductVersion(executable) {
|
|
17208
17209
|
try {
|
|
17209
|
-
return trimmed5(runLatchJson({ executable, args: ["capabilities", "--json"] }).productVersion);
|
|
17210
|
+
return trimmed5((await runLatchJson({ executable, args: ["capabilities", "--json"] })).productVersion);
|
|
17210
17211
|
} catch {
|
|
17211
17212
|
return null;
|
|
17212
17213
|
}
|
|
17213
17214
|
}
|
|
17214
|
-
function openLatchSession({ executable = "latch", providerSessionId, viewerKind, openAs }) {
|
|
17215
|
+
async function openLatchSession({ executable = "latch", providerSessionId, viewerKind, openAs }) {
|
|
17215
17216
|
const sessionId = trimmed5(providerSessionId);
|
|
17216
17217
|
if (!sessionId)
|
|
17217
17218
|
throw new LatchSessionCommandError("A Latch session id is required.");
|
|
@@ -17220,13 +17221,13 @@ function openLatchSession({ executable = "latch", providerSessionId, viewerKind,
|
|
|
17220
17221
|
throw new LatchSessionCommandError(`Latch cannot open the configured viewer "${viewerKind}".`);
|
|
17221
17222
|
}
|
|
17222
17223
|
const exe = trimmed5(executable) ?? "latch";
|
|
17223
|
-
const report = runLatchJson({
|
|
17224
|
+
const report = await runLatchJson({
|
|
17224
17225
|
executable: exe,
|
|
17225
17226
|
args: buildLatchOpenArgs({
|
|
17226
17227
|
providerSessionId: sessionId,
|
|
17227
17228
|
viewer,
|
|
17228
17229
|
openAs,
|
|
17229
|
-
productVersion: openAs ? readLatchProductVersion(exe) : null
|
|
17230
|
+
productVersion: openAs ? await readLatchProductVersion(exe) : null
|
|
17230
17231
|
})
|
|
17231
17232
|
});
|
|
17232
17233
|
if (report.opened !== true) {
|
|
@@ -17239,11 +17240,11 @@ function openLatchSession({ executable = "latch", providerSessionId, viewerKind,
|
|
|
17239
17240
|
behavior: trimmed5(report.behavior) ? parseViewerOpenAs(report.behavior) : null
|
|
17240
17241
|
};
|
|
17241
17242
|
}
|
|
17242
|
-
function stopLatchSession({ executable = "latch", providerSessionId }) {
|
|
17243
|
+
async function stopLatchSession({ executable = "latch", providerSessionId }) {
|
|
17243
17244
|
const sessionId = trimmed5(providerSessionId);
|
|
17244
17245
|
if (!sessionId)
|
|
17245
17246
|
throw new LatchSessionCommandError("A Latch session id is required.");
|
|
17246
|
-
const report = runLatchJson({
|
|
17247
|
+
const report = await runLatchJson({
|
|
17247
17248
|
executable: trimmed5(executable) ?? "latch",
|
|
17248
17249
|
args: ["stop", sessionId, "--json"]
|
|
17249
17250
|
});
|
|
@@ -17821,7 +17822,7 @@ var init_git_tree = __esm({
|
|
|
17821
17822
|
});
|
|
17822
17823
|
|
|
17823
17824
|
// ../packages/core/dist/service/latch-send.js
|
|
17824
|
-
import { spawnSync as
|
|
17825
|
+
import { spawnSync as spawnSync2 } from "node:child_process";
|
|
17825
17826
|
function trimmed7(value) {
|
|
17826
17827
|
return typeof value === "string" && value.trim() ? value.trim() : null;
|
|
17827
17828
|
}
|
|
@@ -17844,7 +17845,7 @@ function probeLatchInteractionCapabilities({ executable = "latch", providerSessi
|
|
|
17844
17845
|
canSend: { ok: false, reason: latchBinaryMissingMessage(executable) }
|
|
17845
17846
|
};
|
|
17846
17847
|
}
|
|
17847
|
-
const help =
|
|
17848
|
+
const help = spawnSync2(bin, ["send", "--help"], {
|
|
17848
17849
|
encoding: "utf8",
|
|
17849
17850
|
shell: false,
|
|
17850
17851
|
timeout: 5e3,
|
|
@@ -17889,7 +17890,7 @@ function resolveLatchInput({ executable = "latch", providerSessionId, requestId,
|
|
|
17889
17890
|
const bin = resolveLatchBinaryPath(executable);
|
|
17890
17891
|
if (!bin)
|
|
17891
17892
|
throw new LatchSessionCommandError(latchBinaryMissingMessage(executable));
|
|
17892
|
-
const result =
|
|
17893
|
+
const result = spawnSync2(bin, ["send", sessionId, "--resolve", `${id}=${selected}`, "--json"], {
|
|
17893
17894
|
encoding: "utf8",
|
|
17894
17895
|
shell: false,
|
|
17895
17896
|
timeout: 1e4,
|
|
@@ -18525,7 +18526,7 @@ var init_in_process_provider = __esm({
|
|
|
18525
18526
|
}
|
|
18526
18527
|
async inspectLatchSession(input) {
|
|
18527
18528
|
try {
|
|
18528
|
-
return ok(this.target, inspectLatchSession(input));
|
|
18529
|
+
return ok(this.target, await inspectLatchSession(input));
|
|
18529
18530
|
} catch (error) {
|
|
18530
18531
|
return failLatchCommand({
|
|
18531
18532
|
target: this.target,
|
|
@@ -18536,7 +18537,7 @@ var init_in_process_provider = __esm({
|
|
|
18536
18537
|
}
|
|
18537
18538
|
async openLatchSession(input) {
|
|
18538
18539
|
try {
|
|
18539
|
-
return ok(this.target, openLatchSession(input));
|
|
18540
|
+
return ok(this.target, await openLatchSession(input));
|
|
18540
18541
|
} catch (error) {
|
|
18541
18542
|
return failLatchCommand({
|
|
18542
18543
|
target: this.target,
|
|
@@ -18547,7 +18548,7 @@ var init_in_process_provider = __esm({
|
|
|
18547
18548
|
}
|
|
18548
18549
|
async stopLatchSession(input) {
|
|
18549
18550
|
try {
|
|
18550
|
-
return ok(this.target, stopLatchSession(input));
|
|
18551
|
+
return ok(this.target, await stopLatchSession(input));
|
|
18551
18552
|
} catch (error) {
|
|
18552
18553
|
return failLatchCommand({
|
|
18553
18554
|
target: this.target,
|
|
@@ -19585,13 +19586,13 @@ var init_latch_discovery2 = __esm({
|
|
|
19585
19586
|
});
|
|
19586
19587
|
|
|
19587
19588
|
// src/latch-launch.ts
|
|
19588
|
-
import { spawnSync as
|
|
19589
|
+
import { spawnSync as spawnSync3 } from "node:child_process";
|
|
19589
19590
|
function spawnLatchJson({
|
|
19590
19591
|
executable,
|
|
19591
19592
|
args,
|
|
19592
19593
|
stdin
|
|
19593
19594
|
}) {
|
|
19594
|
-
const result =
|
|
19595
|
+
const result = spawnSync3(executable, args, {
|
|
19595
19596
|
encoding: "utf8",
|
|
19596
19597
|
input: stdin,
|
|
19597
19598
|
env: latchChildEnvironment(),
|
|
@@ -20089,7 +20090,7 @@ var init_terminal_launcher = __esm({
|
|
|
20089
20090
|
});
|
|
20090
20091
|
|
|
20091
20092
|
// src/launch.ts
|
|
20092
|
-
import { spawnSync as
|
|
20093
|
+
import { spawnSync as spawnSync4 } from "node:child_process";
|
|
20093
20094
|
import { chmodSync as chmodSync4, writeFileSync as writeFileSync9 } from "node:fs";
|
|
20094
20095
|
import path24 from "node:path";
|
|
20095
20096
|
function overlordLaunchEnv({
|
|
@@ -20433,7 +20434,7 @@ async function launchAgent({
|
|
|
20433
20434
|
}) : null;
|
|
20434
20435
|
if (existingProviderSession && plan.latchCommandString) {
|
|
20435
20436
|
const shell = process.env.SHELL?.trim() || "/bin/bash";
|
|
20436
|
-
const result2 =
|
|
20437
|
+
const result2 = spawnSync4(shell, ["-ilc", plan.latchCommandString], {
|
|
20437
20438
|
cwd: options.workingDirectory,
|
|
20438
20439
|
env,
|
|
20439
20440
|
stdio: "inherit"
|
|
@@ -20523,12 +20524,12 @@ async function launchAgent({
|
|
|
20523
20524
|
};
|
|
20524
20525
|
}
|
|
20525
20526
|
const { execution } = plan;
|
|
20526
|
-
const result = execution.useShell ?
|
|
20527
|
+
const result = execution.useShell ? spawnSync4(execution.command, {
|
|
20527
20528
|
cwd: options.workingDirectory,
|
|
20528
20529
|
env,
|
|
20529
20530
|
shell: true,
|
|
20530
20531
|
stdio: "inherit"
|
|
20531
|
-
}) :
|
|
20532
|
+
}) : spawnSync4(execution.command, execution.args, {
|
|
20532
20533
|
cwd: options.workingDirectory,
|
|
20533
20534
|
env,
|
|
20534
20535
|
stdio: "inherit"
|
|
@@ -22270,7 +22271,7 @@ var init_runner_identity = __esm({
|
|
|
22270
22271
|
});
|
|
22271
22272
|
|
|
22272
22273
|
// src/runner-service.ts
|
|
22273
|
-
import { execFile } from "node:child_process";
|
|
22274
|
+
import { execFile as execFile2 } from "node:child_process";
|
|
22274
22275
|
import {
|
|
22275
22276
|
chmodSync as chmodSync5,
|
|
22276
22277
|
existsSync as existsSync27,
|
|
@@ -22519,7 +22520,7 @@ var init_runner_service = __esm({
|
|
|
22519
22520
|
"src/runner-service.ts"() {
|
|
22520
22521
|
"use strict";
|
|
22521
22522
|
init_config();
|
|
22522
|
-
execFileAsync = promisify(
|
|
22523
|
+
execFileAsync = promisify(execFile2);
|
|
22523
22524
|
RUNNER_SERVICE_STATE_FILENAME = "runner-service.json";
|
|
22524
22525
|
LAUNCHD_LABEL = "io.overlord.runner";
|
|
22525
22526
|
SYSTEMD_UNIT_NAME = "overlord-runner";
|