@evident-ai/cli 3.1.1-dev.4159d3a → 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 +31 -11
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -2063,7 +2063,7 @@ function backoffDelay(attempt, policy) {
|
|
|
2063
2063
|
function isRetryableStatus(status) {
|
|
2064
2064
|
return status === 429 || status >= 500 && status <= 599;
|
|
2065
2065
|
}
|
|
2066
|
-
var ChannelDriver = class {
|
|
2066
|
+
var ChannelDriver = class _ChannelDriver {
|
|
2067
2067
|
agentId;
|
|
2068
2068
|
port;
|
|
2069
2069
|
apiUrl;
|
|
@@ -2188,9 +2188,12 @@ var ChannelDriver = class {
|
|
|
2188
2188
|
sessionParents = /* @__PURE__ */ new Map();
|
|
2189
2189
|
/**
|
|
2190
2190
|
* Per-session OpenCode title cache (#310), keyed by sessionId. Only a resolved
|
|
2191
|
-
* NON-EMPTY name is stored (terminal — a real session name
|
|
2192
|
-
* so we do NOT re-GET `/session/:id` every tick.
|
|
2193
|
-
*
|
|
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
|
|
2194
2197
|
* names sessions asynchronously mid-turn. Driver-level (not per-watcher) so both
|
|
2195
2198
|
* the watcher completion path AND the restart-recovery re-adopt path (which has
|
|
2196
2199
|
* no watcher) can resolve the title.
|
|
@@ -3658,19 +3661,36 @@ var ChannelDriver = class {
|
|
|
3658
3661
|
if (parent !== void 0) this.sessionParents.set(sessionId, parent);
|
|
3659
3662
|
return parent;
|
|
3660
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 - /;
|
|
3661
3677
|
/**
|
|
3662
3678
|
* Resolve (and cache in `sessionTitles`) the OpenCode session TITLE (#310) so the
|
|
3663
3679
|
* status PATCH can carry it into the "Live sessions" list. Driver-level cache so
|
|
3664
3680
|
* BOTH the watcher completion path and the restart-recovery re-adopt path (which
|
|
3665
3681
|
* has no watcher) can use it. `conversationId` is passed only for log context.
|
|
3666
3682
|
* Best-effort:
|
|
3667
|
-
* - 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
|
|
3668
3685
|
* won't later un-name), so we do NOT re-GET `/session/:id` every tick;
|
|
3669
|
-
* - while the title is still absent
|
|
3670
|
-
*
|
|
3671
|
-
*
|
|
3672
|
-
*
|
|
3673
|
-
*
|
|
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;
|
|
3674
3694
|
* - a failed request likewise leaves the cache unresolved (retry next need)
|
|
3675
3695
|
* and returns `null` — it must NEVER throw or block completion.
|
|
3676
3696
|
* A failure is logged with agent/session context (no silent catch).
|
|
@@ -3683,7 +3703,7 @@ var ChannelDriver = class {
|
|
|
3683
3703
|
if (res.ok) {
|
|
3684
3704
|
const body = await res.json();
|
|
3685
3705
|
const title = body && typeof body.title === "string" ? body.title.trim() : "";
|
|
3686
|
-
if (title.length > 0) {
|
|
3706
|
+
if (title.length > 0 && !_ChannelDriver.OPENCODE_DEFAULT_TITLE_PREFIX.test(title)) {
|
|
3687
3707
|
this.sessionTitles.set(sessionId, title);
|
|
3688
3708
|
return title;
|
|
3689
3709
|
}
|