@evident-ai/cli 3.1.1-dev.3b9fb81 → 3.1.1-dev.51bb5fa
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 +89 -12
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -734,7 +734,7 @@ function buildOpenCodeVersionWarning(version2) {
|
|
|
734
734
|
if (isQueueValidatedVersion(version2)) return null;
|
|
735
735
|
const detected = version2 ? `v${version2}` : "unknown";
|
|
736
736
|
const validated = QUEUE_VALIDATED_OPENCODE_VERSIONS.map((v) => `v${v}`).join(", ");
|
|
737
|
-
return `Warning: opencode ${detected} is not a queue-validated version (validated: ${validated}). Native message queuing \u2014 which channel (Slack
|
|
737
|
+
return `Warning: opencode ${detected} is not a queue-validated version (validated: ${validated}). Native message queuing \u2014 which channel (Slack) message handling relies on \u2014 is unverified on this version; queued/follow-up messages may behave unexpectedly. Continuing anyway. Bumping the validated set requires re-running the queue validation.`;
|
|
738
738
|
}
|
|
739
739
|
|
|
740
740
|
// src/lib/opencode/process.ts
|
|
@@ -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}`;
|
|
@@ -1228,6 +1234,11 @@ async function getModelAttachmentCapability(port, model) {
|
|
|
1228
1234
|
}
|
|
1229
1235
|
const entry = provider.models[modelId];
|
|
1230
1236
|
if (!entry || typeof entry !== "object") return null;
|
|
1237
|
+
if (entry.capabilities && typeof entry.capabilities === "object") {
|
|
1238
|
+
if (typeof entry.capabilities.attachment === "boolean") {
|
|
1239
|
+
return entry.capabilities.attachment;
|
|
1240
|
+
}
|
|
1241
|
+
}
|
|
1231
1242
|
return typeof entry.attachment === "boolean" ? entry.attachment : null;
|
|
1232
1243
|
} catch (err) {
|
|
1233
1244
|
console.error(
|
|
@@ -1484,6 +1495,37 @@ function hasRunningAssistantExcept(messages, exceptUserMessageId) {
|
|
|
1484
1495
|
(m) => roleOf(m) === "assistant" && parentIdOf(m) !== exceptUserMessageId && isAssistantInFlight(m)
|
|
1485
1496
|
);
|
|
1486
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
|
+
}
|
|
1487
1529
|
|
|
1488
1530
|
// src/lib/opencode/session-cleanup.ts
|
|
1489
1531
|
var DURATION_UNIT_MS = {
|
|
@@ -2021,7 +2063,7 @@ function backoffDelay(attempt, policy) {
|
|
|
2021
2063
|
function isRetryableStatus(status) {
|
|
2022
2064
|
return status === 429 || status >= 500 && status <= 599;
|
|
2023
2065
|
}
|
|
2024
|
-
var ChannelDriver = class {
|
|
2066
|
+
var ChannelDriver = class _ChannelDriver {
|
|
2025
2067
|
agentId;
|
|
2026
2068
|
port;
|
|
2027
2069
|
apiUrl;
|
|
@@ -2146,9 +2188,12 @@ var ChannelDriver = class {
|
|
|
2146
2188
|
sessionParents = /* @__PURE__ */ new Map();
|
|
2147
2189
|
/**
|
|
2148
2190
|
* Per-session OpenCode title cache (#310), keyed by sessionId. Only a resolved
|
|
2149
|
-
* NON-EMPTY name is stored (terminal — a real session name
|
|
2150
|
-
* so we do NOT re-GET `/session/:id` every tick.
|
|
2151
|
-
*
|
|
2191
|
+
* NON-EMPTY, non-placeholder name is stored (terminal — a real session name
|
|
2192
|
+
* won't later un-name), so we do NOT re-GET `/session/:id` every tick. "Non-empty"
|
|
2193
|
+
* excludes OpenCode's synchronous default title (see
|
|
2194
|
+
* `OPENCODE_DEFAULT_TITLE_PREFIX`, #549) — that placeholder is treated the same
|
|
2195
|
+
* as an empty title so it never latches. A missing entry = not yet resolved OR
|
|
2196
|
+
* resolved-but-still-empty/placeholder → re-fetch on next need, since OpenCode
|
|
2152
2197
|
* names sessions asynchronously mid-turn. Driver-level (not per-watcher) so both
|
|
2153
2198
|
* the watcher completion path AND the restart-recovery re-adopt path (which has
|
|
2154
2199
|
* no watcher) can resolve the title.
|
|
@@ -3616,19 +3661,36 @@ var ChannelDriver = class {
|
|
|
3616
3661
|
if (parent !== void 0) this.sessionParents.set(sessionId, parent);
|
|
3617
3662
|
return parent;
|
|
3618
3663
|
}
|
|
3664
|
+
/**
|
|
3665
|
+
* OpenCode's synchronous default session title (e.g.
|
|
3666
|
+
* `"New session - 1737800000000"`), assigned immediately when a session is
|
|
3667
|
+
* created — before OpenCode's async LLM-based auto-titling later renames it
|
|
3668
|
+
* mid-turn (#549). Matched by this literal, case-sensitive prefix only; the
|
|
3669
|
+
* timestamp suffix's exact format is deliberately NOT matched, since the prefix
|
|
3670
|
+
* alone is the stable, cheap signal and over-anchoring on the timestamp
|
|
3671
|
+
* representation risks silently breaking if OpenCode ever changes it. Accepted
|
|
3672
|
+
* trade-off: a genuine LLM-assigned title that happens to literally start with
|
|
3673
|
+
* this prefix would also fail to latch (see `resolveSessionTitle`) —
|
|
3674
|
+
* vanishingly unlikely in practice, and deliberately not engineered around.
|
|
3675
|
+
*/
|
|
3676
|
+
static OPENCODE_DEFAULT_TITLE_PREFIX = /^New session - /;
|
|
3619
3677
|
/**
|
|
3620
3678
|
* Resolve (and cache in `sessionTitles`) the OpenCode session TITLE (#310) so the
|
|
3621
3679
|
* status PATCH can carry it into the "Live sessions" list. Driver-level cache so
|
|
3622
3680
|
* BOTH the watcher completion path and the restart-recovery re-adopt path (which
|
|
3623
3681
|
* has no watcher) can use it. `conversationId` is passed only for log context.
|
|
3624
3682
|
* Best-effort:
|
|
3625
|
-
* - a resolved NON-EMPTY title
|
|
3683
|
+
* - a resolved NON-EMPTY title that does NOT match
|
|
3684
|
+
* `OPENCODE_DEFAULT_TITLE_PREFIX` is cached and terminal (a real session name
|
|
3626
3685
|
* won't later un-name), so we do NOT re-GET `/session/:id` every tick;
|
|
3627
|
-
* - while the title is still absent
|
|
3628
|
-
*
|
|
3629
|
-
*
|
|
3630
|
-
*
|
|
3631
|
-
*
|
|
3686
|
+
* - while the title is still absent, empty, or matches the OpenCode
|
|
3687
|
+
* placeholder prefix (#549) we do NOT latch it — OpenCode names sessions
|
|
3688
|
+
* asynchronously mid-turn, so an early call (e.g. at `processing`) must leave
|
|
3689
|
+
* the cache unresolved and re-fetch on the next need so a later call (e.g. at
|
|
3690
|
+
* `done`) picks up the name assigned in the meantime. Such a call returns
|
|
3691
|
+
* `null` (omit the title on THIS PATCH) without caching. If a session is
|
|
3692
|
+
* never renamed, the title is omitted forever rather than ever persisting
|
|
3693
|
+
* the placeholder as a last resort;
|
|
3632
3694
|
* - a failed request likewise leaves the cache unresolved (retry next need)
|
|
3633
3695
|
* and returns `null` — it must NEVER throw or block completion.
|
|
3634
3696
|
* A failure is logged with agent/session context (no silent catch).
|
|
@@ -3641,7 +3703,7 @@ var ChannelDriver = class {
|
|
|
3641
3703
|
if (res.ok) {
|
|
3642
3704
|
const body = await res.json();
|
|
3643
3705
|
const title = body && typeof body.title === "string" ? body.title.trim() : "";
|
|
3644
|
-
if (title.length > 0) {
|
|
3706
|
+
if (title.length > 0 && !_ChannelDriver.OPENCODE_DEFAULT_TITLE_PREFIX.test(title)) {
|
|
3645
3707
|
this.sessionTitles.set(sessionId, title);
|
|
3646
3708
|
return title;
|
|
3647
3709
|
}
|
|
@@ -4872,6 +4934,21 @@ async function run(options) {
|
|
|
4872
4934
|
logActivity(state, { type: "info", level: "warn", message: versionWarning });
|
|
4873
4935
|
}
|
|
4874
4936
|
}
|
|
4937
|
+
const noProviderWarning = buildNoProviderWarning(await hasAnyConfiguredProvider(state.port));
|
|
4938
|
+
if (noProviderWarning) {
|
|
4939
|
+
log2(state, noProviderWarning, "warn");
|
|
4940
|
+
if (state.interactive && !state.json) {
|
|
4941
|
+
logActivity(state, { type: "info", level: "warn", message: noProviderWarning });
|
|
4942
|
+
blank();
|
|
4943
|
+
console.log(chalk6.yellow("\u26A0 No OpenCode model provider is configured."));
|
|
4944
|
+
console.log(
|
|
4945
|
+
chalk6.dim(
|
|
4946
|
+
`Run ${chalk6.cyan("opencode auth login")} to set one up \u2014 messages will fail until then.`
|
|
4947
|
+
)
|
|
4948
|
+
);
|
|
4949
|
+
blank();
|
|
4950
|
+
}
|
|
4951
|
+
}
|
|
4875
4952
|
} catch (error2) {
|
|
4876
4953
|
ocSpinner?.fail(error2.message);
|
|
4877
4954
|
throw error2;
|