@evident-ai/cli 3.1.1-dev.3a785a9 → 3.1.1-dev.4159d3a
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 +52 -0
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1026,6 +1026,12 @@ async function promptOpenCodeInstall(interactive) {
|
|
|
1026
1026
|
return action;
|
|
1027
1027
|
}
|
|
1028
1028
|
|
|
1029
|
+
// src/lib/opencode/provider-check.ts
|
|
1030
|
+
function buildNoProviderWarning(hasProvider) {
|
|
1031
|
+
if (hasProvider !== false) return null;
|
|
1032
|
+
return "Warning: opencode has no authenticated model provider configured, so it won't be able to answer prompts. Run `opencode auth login` to set one up (see https://opencode.ai for details).";
|
|
1033
|
+
}
|
|
1034
|
+
|
|
1029
1035
|
// src/lib/opencode/session.ts
|
|
1030
1036
|
function opencodeBase(port) {
|
|
1031
1037
|
return `http://127.0.0.1:${port}`;
|
|
@@ -1489,6 +1495,37 @@ function hasRunningAssistantExcept(messages, exceptUserMessageId) {
|
|
|
1489
1495
|
(m) => roleOf(m) === "assistant" && parentIdOf(m) !== exceptUserMessageId && isAssistantInFlight(m)
|
|
1490
1496
|
);
|
|
1491
1497
|
}
|
|
1498
|
+
async function hasAnyConfiguredProvider(port) {
|
|
1499
|
+
try {
|
|
1500
|
+
const res = await fetch(`${opencodeBase(port)}/config/providers`);
|
|
1501
|
+
if (!res.ok) {
|
|
1502
|
+
console.error(
|
|
1503
|
+
`[hasAnyConfiguredProvider] GET /config/providers returned HTTP ${res.status} (port ${port})`
|
|
1504
|
+
);
|
|
1505
|
+
return null;
|
|
1506
|
+
}
|
|
1507
|
+
const body = await res.json();
|
|
1508
|
+
if (!body || typeof body !== "object" || Array.isArray(body)) {
|
|
1509
|
+
console.error(
|
|
1510
|
+
`[hasAnyConfiguredProvider] GET /config/providers body was not a plain object (port ${port})`
|
|
1511
|
+
);
|
|
1512
|
+
return null;
|
|
1513
|
+
}
|
|
1514
|
+
const defaults2 = body.default;
|
|
1515
|
+
if (!defaults2 || typeof defaults2 !== "object" || Array.isArray(defaults2)) {
|
|
1516
|
+
console.error(
|
|
1517
|
+
`[hasAnyConfiguredProvider] GET /config/providers body had no \`default\` object (port ${port})`
|
|
1518
|
+
);
|
|
1519
|
+
return null;
|
|
1520
|
+
}
|
|
1521
|
+
return Object.keys(defaults2).length > 0;
|
|
1522
|
+
} catch (err) {
|
|
1523
|
+
console.error(
|
|
1524
|
+
`[hasAnyConfiguredProvider] GET /config/providers failed (port ${port}): ${err instanceof Error ? err.message : String(err)}`
|
|
1525
|
+
);
|
|
1526
|
+
return null;
|
|
1527
|
+
}
|
|
1528
|
+
}
|
|
1492
1529
|
|
|
1493
1530
|
// src/lib/opencode/session-cleanup.ts
|
|
1494
1531
|
var DURATION_UNIT_MS = {
|
|
@@ -4877,6 +4914,21 @@ async function run(options) {
|
|
|
4877
4914
|
logActivity(state, { type: "info", level: "warn", message: versionWarning });
|
|
4878
4915
|
}
|
|
4879
4916
|
}
|
|
4917
|
+
const noProviderWarning = buildNoProviderWarning(await hasAnyConfiguredProvider(state.port));
|
|
4918
|
+
if (noProviderWarning) {
|
|
4919
|
+
log2(state, noProviderWarning, "warn");
|
|
4920
|
+
if (state.interactive && !state.json) {
|
|
4921
|
+
logActivity(state, { type: "info", level: "warn", message: noProviderWarning });
|
|
4922
|
+
blank();
|
|
4923
|
+
console.log(chalk6.yellow("\u26A0 No OpenCode model provider is configured."));
|
|
4924
|
+
console.log(
|
|
4925
|
+
chalk6.dim(
|
|
4926
|
+
`Run ${chalk6.cyan("opencode auth login")} to set one up \u2014 messages will fail until then.`
|
|
4927
|
+
)
|
|
4928
|
+
);
|
|
4929
|
+
blank();
|
|
4930
|
+
}
|
|
4931
|
+
}
|
|
4880
4932
|
} catch (error2) {
|
|
4881
4933
|
ocSpinner?.fail(error2.message);
|
|
4882
4934
|
throw error2;
|