@evident-ai/cli 3.5.1-dev.107f9e4 → 3.5.1-dev.18543a6
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 +5 -34
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1158,7 +1158,7 @@ import ora4 from "ora";
|
|
|
1158
1158
|
import { select as select4 } from "@inquirer/prompts";
|
|
1159
1159
|
|
|
1160
1160
|
// src/lib/telemetry.ts
|
|
1161
|
-
var CLI_VERSION = (true ? "3.5.1-dev.
|
|
1161
|
+
var CLI_VERSION = (true ? "3.5.1-dev.18543a6" : void 0) ?? process.env.npm_package_version ?? "unknown";
|
|
1162
1162
|
function getCliVersion() {
|
|
1163
1163
|
return CLI_VERSION;
|
|
1164
1164
|
}
|
|
@@ -1620,9 +1620,6 @@ async function checkOpenCodeHealth(port) {
|
|
|
1620
1620
|
signal: AbortSignal.timeout(2e3)
|
|
1621
1621
|
// 2 second timeout
|
|
1622
1622
|
});
|
|
1623
|
-
if (response.status === 401) {
|
|
1624
|
-
return { healthy: false, authFailed: true, error: "HTTP 401" };
|
|
1625
|
-
}
|
|
1626
1623
|
if (!response.ok) {
|
|
1627
1624
|
return { healthy: false, error: `HTTP ${response.status}` };
|
|
1628
1625
|
}
|
|
@@ -1687,7 +1684,7 @@ async function waitForOpenCodeHealth(port, timeoutMs = 3e4) {
|
|
|
1687
1684
|
const startTime = Date.now();
|
|
1688
1685
|
while (Date.now() - startTime < timeoutMs) {
|
|
1689
1686
|
const health = await checkOpenCodeHealth(port);
|
|
1690
|
-
if (health.healthy
|
|
1687
|
+
if (health.healthy) {
|
|
1691
1688
|
return health;
|
|
1692
1689
|
}
|
|
1693
1690
|
await new Promise((resolve4) => setTimeout(resolve4, 1e3));
|
|
@@ -4607,8 +4604,7 @@ async function startOpenCode(port, options = {}) {
|
|
|
4607
4604
|
const child = spawn3(command, args, {
|
|
4608
4605
|
detached: true,
|
|
4609
4606
|
stdio: options.inheritStdio ? "inherit" : "ignore",
|
|
4610
|
-
cwd: process.cwd()
|
|
4611
|
-
env: { ...process.env, OPENCODE_SERVER_PASSWORD: void 0 }
|
|
4607
|
+
cwd: process.cwd()
|
|
4612
4608
|
});
|
|
4613
4609
|
return child;
|
|
4614
4610
|
}
|
|
@@ -11286,16 +11282,8 @@ function checkNonInteractivePortConflict(port, isPortInUseFn) {
|
|
|
11286
11282
|
);
|
|
11287
11283
|
}
|
|
11288
11284
|
}
|
|
11289
|
-
function unknownPasswordError(port) {
|
|
11290
|
-
return new Error(
|
|
11291
|
-
`OpenCode is already running on port ${port}, but this runner cannot authenticate to it. It may have been started with OPENCODE_SERVER_PASSWORD set in its environment. Free the port or pass --port.`
|
|
11292
|
-
);
|
|
11293
|
-
}
|
|
11294
11285
|
async function ensureOpenCodeRunning(ctx) {
|
|
11295
11286
|
const healthCheck = await checkOpenCodeHealth(ctx.port);
|
|
11296
|
-
if (healthCheck.authFailed) {
|
|
11297
|
-
throw unknownPasswordError(ctx.port);
|
|
11298
|
-
}
|
|
11299
11287
|
if (healthCheck.healthy) {
|
|
11300
11288
|
return {
|
|
11301
11289
|
port: ctx.port,
|
|
@@ -11346,14 +11334,6 @@ async function ensureOpenCodeRunning(ctx) {
|
|
|
11346
11334
|
const proc = await startOpenCode(ctx.port, { inheritStdio: ctx.inheritStdio });
|
|
11347
11335
|
const health = await waitForOpenCodeHealth(ctx.port, ctx.startTimeoutMs);
|
|
11348
11336
|
if (!health.healthy) {
|
|
11349
|
-
if (health.authFailed) {
|
|
11350
|
-
return {
|
|
11351
|
-
port: ctx.port,
|
|
11352
|
-
process: proc,
|
|
11353
|
-
version: null,
|
|
11354
|
-
notReadyReason: "it is answering with an authentication challenge, likely because OPENCODE_SERVER_PASSWORD is set in the environment of the process that started it; a longer start timeout will not resolve this"
|
|
11355
|
-
};
|
|
11356
|
-
}
|
|
11357
11337
|
return {
|
|
11358
11338
|
port: ctx.port,
|
|
11359
11339
|
process: proc,
|
|
@@ -11423,9 +11403,6 @@ Port ${port} is already in use.`));
|
|
|
11423
11403
|
const health = await waitForOpenCodeHealth(port, INTERACTIVE_START_TIMEOUT_MS);
|
|
11424
11404
|
if (!health.healthy) {
|
|
11425
11405
|
spinner.fail("Failed to start OpenCode");
|
|
11426
|
-
if (health.authFailed) {
|
|
11427
|
-
throw unknownPasswordError(port);
|
|
11428
|
-
}
|
|
11429
11406
|
throw new Error("OpenCode failed to start");
|
|
11430
11407
|
}
|
|
11431
11408
|
spinner.stop();
|
|
@@ -11438,7 +11415,7 @@ Port ${port} is already in use.`));
|
|
|
11438
11415
|
import chalk6 from "chalk";
|
|
11439
11416
|
import ora3 from "ora";
|
|
11440
11417
|
import { select as select3 } from "@inquirer/prompts";
|
|
11441
|
-
function
|
|
11418
|
+
function unknownPasswordError(port) {
|
|
11442
11419
|
return new Error(
|
|
11443
11420
|
`OpenCode V2 (opencode2) is already running on port ${port} with a password this runner doesn't know. Free the port or pass --port.`
|
|
11444
11421
|
);
|
|
@@ -11447,7 +11424,7 @@ var INTERACTIVE_START_TIMEOUT_MS2 = 3e4;
|
|
|
11447
11424
|
async function ensureOpenCode2Running(ctx) {
|
|
11448
11425
|
const initialHealth = await checkOpenCode2Health(ctx.port);
|
|
11449
11426
|
if (initialHealth.authFailed) {
|
|
11450
|
-
throw
|
|
11427
|
+
throw unknownPasswordError(ctx.port);
|
|
11451
11428
|
}
|
|
11452
11429
|
if (initialHealth.healthy) {
|
|
11453
11430
|
return {
|
|
@@ -13394,12 +13371,6 @@ async function run(options) {
|
|
|
13394
13371
|
"Skipping session-DB restore: OpenCode is already serving this database",
|
|
13395
13372
|
"debug"
|
|
13396
13373
|
);
|
|
13397
|
-
} else if (health.authFailed) {
|
|
13398
|
-
log2(
|
|
13399
|
-
state,
|
|
13400
|
-
"Skipping session-DB restore: OpenCode answered with an authentication challenge; assuming this database is in use",
|
|
13401
|
-
"debug"
|
|
13402
|
-
);
|
|
13403
13374
|
} else {
|
|
13404
13375
|
const result = await restoreAndVerifySessionDb({
|
|
13405
13376
|
dbPath: sessionDbPath(),
|