@aiwayds/dsh-opentui 0.9.6 → 0.9.7
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/CHANGELOG.md +14 -0
- package/dist/client/index.js +310 -19
- package/package.json +1 -1
- package/scripts/provision-opentui-profile.mjs +37 -8
package/CHANGELOG.md
CHANGED
|
@@ -5,6 +5,20 @@ All notable changes to this project will be documented in this file.
|
|
|
5
5
|
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
|
|
6
6
|
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
7
7
|
|
|
8
|
+
## [0.9.7] - 2026-11-12
|
|
9
|
+
|
|
10
|
+
### Fixed
|
|
11
|
+
|
|
12
|
+
- **Picking a model now applies it** — the picked route was read back through the staged value but the application step swallowed it, so a selection could silently fall back to the catalog default. Selection failures now surface in the transcript instead of vanishing into a console log, and bare `/model` asks for the effort level as one flow (`esc` abandons the whole pick).
|
|
13
|
+
- **The spin attention feed is back** — the per-turn attention feed lost in an earlier refactor is restored, refreshed at most once every 5 seconds.
|
|
14
|
+
- **The client bundle packs reliably** — the attention feed's optional probe import tripped the bundle leak guard in prepack; the probe specifier is now pinned so packaging succeeds, and a missing `@aiwayds/dsh-jev-core` still degrades silently at runtime.
|
|
15
|
+
- **Cold install retries a failed plugin add** — one flaky `pnpm add` used to be warned about and skipped, leaving the profile short a plugin; each failed spec is retried up to 3 times with a 5-second backoff and a final failure stays loud.
|
|
16
|
+
- **`ctrl+alt+f` opens session search** — keybind parity with `dsh-tui-pi`; `page.down` keeps pagedown.
|
|
17
|
+
|
|
18
|
+
### Changed
|
|
19
|
+
|
|
20
|
+
- **Cold plugin installs no longer false-fail on slow networks** — the e2e install wait for the npm-installed bin leg now allows up to 10 minutes (registry served 1.7–2.1 KB/s when measured), replacing the 3-minute timeout that fired before the 14-package install finished; the e2e round-limit staging also targets the profile `config.json` top-level keys the client ladder actually reads.
|
|
21
|
+
|
|
8
22
|
## [0.9.6] - 2026-11-11
|
|
9
23
|
|
|
10
24
|
### Added
|
package/dist/client/index.js
CHANGED
|
@@ -6277,6 +6277,22 @@ var init_remote_attachments = __esm(() => {
|
|
|
6277
6277
|
|
|
6278
6278
|
// src/client/remote-btw.ts
|
|
6279
6279
|
import { randomUUID as randomUUID2 } from "crypto";
|
|
6280
|
+
import { appendFileSync } from "fs";
|
|
6281
|
+
function btwTrace(message) {
|
|
6282
|
+
const line = `[btw ${new Date().toISOString().slice(11, 23)}] ${message}
|
|
6283
|
+
`;
|
|
6284
|
+
if (process.env.DSH_OPENTUI_DEBUG)
|
|
6285
|
+
process.stderr.write(line);
|
|
6286
|
+
const path = process.env.DSH_OPENTUI_TRACE_FILE;
|
|
6287
|
+
if (!path)
|
|
6288
|
+
return;
|
|
6289
|
+
try {
|
|
6290
|
+
appendFileSync(path, line);
|
|
6291
|
+
} catch {}
|
|
6292
|
+
}
|
|
6293
|
+
function btwOutPreview(out) {
|
|
6294
|
+
return `out len=${out.length} head=${JSON.stringify(out.slice(0, 40))} tail=${JSON.stringify(out.slice(-40))}`;
|
|
6295
|
+
}
|
|
6280
6296
|
async function askBtw(options) {
|
|
6281
6297
|
const timeoutMs = options.timeoutMs ?? 120000;
|
|
6282
6298
|
let sessionId = options.previousSessionId ?? "";
|
|
@@ -6297,6 +6313,10 @@ async function askBtw(options) {
|
|
|
6297
6313
|
let pump;
|
|
6298
6314
|
let timer;
|
|
6299
6315
|
let promptFailure;
|
|
6316
|
+
let deltas = 0;
|
|
6317
|
+
let turnEnds = 0;
|
|
6318
|
+
let streamEnds = 0;
|
|
6319
|
+
let streamFails = 0;
|
|
6300
6320
|
const settle = (errorText) => {
|
|
6301
6321
|
if (settled)
|
|
6302
6322
|
return;
|
|
@@ -6309,11 +6329,13 @@ async function askBtw(options) {
|
|
|
6309
6329
|
}).catch(() => {});
|
|
6310
6330
|
};
|
|
6311
6331
|
const answer = await new Promise((resolve) => {
|
|
6312
|
-
const finish = (errorText) => {
|
|
6332
|
+
const finish = (errorText, why) => {
|
|
6333
|
+
if (!settled)
|
|
6334
|
+
btwTrace(`settle why=${why} err=${errorText !== undefined} deltas=${deltas} turnEnds=${turnEnds} streamEnds=${streamEnds} streamFails=${streamFails} ${btwOutPreview(out)}${deltas === 0 && errorText === undefined ? " EARLY-EMPTY-SETTLE" : ""}`);
|
|
6313
6335
|
settle(errorText);
|
|
6314
6336
|
resolve(errorText !== undefined ? errorText : out.trim());
|
|
6315
6337
|
};
|
|
6316
|
-
timer = setTimeout(() => finish(undefined), timeoutMs);
|
|
6338
|
+
timer = setTimeout(() => finish(undefined, "timeout"), timeoutMs);
|
|
6317
6339
|
timer.unref?.();
|
|
6318
6340
|
pump = openRemoteStream(options.socketFactory, "session/follow", { request: { address: { kind: "session", sessionId }, assistantStream: true } }, {
|
|
6319
6341
|
onItem: (value) => {
|
|
@@ -6325,6 +6347,7 @@ async function askBtw(options) {
|
|
|
6325
6347
|
const chunk = typeof streamFrame.chunk === "object" && streamFrame.chunk !== null ? streamFrame.chunk : {};
|
|
6326
6348
|
if (chunk.type === "text-delta" && typeof chunk.text === "string" && chunk.text) {
|
|
6327
6349
|
out += chunk.text;
|
|
6350
|
+
deltas += 1;
|
|
6328
6351
|
try {
|
|
6329
6352
|
options.onDelta?.(out);
|
|
6330
6353
|
} catch {}
|
|
@@ -6337,16 +6360,26 @@ async function askBtw(options) {
|
|
|
6337
6360
|
return;
|
|
6338
6361
|
const data = typeof event.data === "object" && event.data !== null ? event.data : {};
|
|
6339
6362
|
const reason = typeof data.reason === "object" && data.reason !== null ? data.reason : {};
|
|
6363
|
+
turnEnds += 1;
|
|
6364
|
+
btwTrace(`recv turn/end #${turnEnds} reason=${JSON.stringify(reason.kind ?? null)} out=${out.length}`);
|
|
6340
6365
|
if (reason.kind === "error") {
|
|
6341
6366
|
const err = typeof reason.error === "object" && reason.error !== null ? reason.error : {};
|
|
6342
|
-
finish(`error: ${String(err.message ?? "unknown").slice(0, 200)}
|
|
6367
|
+
finish(`error: ${String(err.message ?? "unknown").slice(0, 200)}`, "turn-end-error");
|
|
6343
6368
|
return;
|
|
6344
6369
|
}
|
|
6345
|
-
finish(undefined);
|
|
6370
|
+
finish(undefined, "turn-end");
|
|
6346
6371
|
}
|
|
6347
6372
|
},
|
|
6348
|
-
onEnd: () =>
|
|
6349
|
-
|
|
6373
|
+
onEnd: () => {
|
|
6374
|
+
streamEnds += 1;
|
|
6375
|
+
btwTrace(`recv stream-end #${streamEnds} out=${out.length}`);
|
|
6376
|
+
finish(undefined, "stream-end");
|
|
6377
|
+
},
|
|
6378
|
+
onFailed: (error) => {
|
|
6379
|
+
streamFails += 1;
|
|
6380
|
+
btwTrace(`recv stream-failed #${streamFails} ${btwOutPreview(out)} err=${String(error?.message ?? error)}`);
|
|
6381
|
+
finish(undefined, "stream-failed");
|
|
6382
|
+
}
|
|
6350
6383
|
});
|
|
6351
6384
|
const snap = options.snapshot.length > 0 ? `Recent conversation context (for reference only):
|
|
6352
6385
|
${options.snapshot.join(`
|
|
@@ -6362,7 +6395,7 @@ ${options.snapshot.join(`
|
|
|
6362
6395
|
}
|
|
6363
6396
|
}).then(() => {}, (error) => {
|
|
6364
6397
|
promptFailure = { error };
|
|
6365
|
-
finish(undefined);
|
|
6398
|
+
finish(undefined, "prompt-rejected");
|
|
6366
6399
|
});
|
|
6367
6400
|
});
|
|
6368
6401
|
if (promptFailure !== undefined) {
|
|
@@ -6617,6 +6650,131 @@ var init_subagent_policy = __esm(() => {
|
|
|
6617
6650
|
FOREGROUND_LABEL_PREFIXES = ["[fg] ", "[use_agent foreground] "];
|
|
6618
6651
|
});
|
|
6619
6652
|
|
|
6653
|
+
// src/spin-attention.ts
|
|
6654
|
+
async function loadJevCore() {
|
|
6655
|
+
try {
|
|
6656
|
+
const mod = await import("@aiwayds/dsh-jev-core");
|
|
6657
|
+
if (typeof mod.classify !== "function" || typeof mod.isConfigured !== "function")
|
|
6658
|
+
return null;
|
|
6659
|
+
return mod;
|
|
6660
|
+
} catch {
|
|
6661
|
+
return null;
|
|
6662
|
+
}
|
|
6663
|
+
}
|
|
6664
|
+
function buildSpinQuestions(id8s) {
|
|
6665
|
+
const questions = {};
|
|
6666
|
+
for (const id8 of id8s) {
|
|
6667
|
+
questions[`spin_${id8}`] = {
|
|
6668
|
+
type: "noul",
|
|
6669
|
+
criteria: {
|
|
6670
|
+
true: "work is UNPRODUCTIVE \u2014 repeating the same tools or circling without forward motion",
|
|
6671
|
+
false: "work is productive \u2014 measurable forward progress"
|
|
6672
|
+
}
|
|
6673
|
+
};
|
|
6674
|
+
}
|
|
6675
|
+
return questions;
|
|
6676
|
+
}
|
|
6677
|
+
function buildSpinState(views, cap, now) {
|
|
6678
|
+
const lines = views.map((view) => {
|
|
6679
|
+
const parts = [
|
|
6680
|
+
`${view.childId.slice(0, 8)} ${view.label.slice(0, SPIN_LABEL_MAX_CHARS)}`,
|
|
6681
|
+
`rounds ${view.rounds}/${cap > 0 ? cap : "\u221E"}`,
|
|
6682
|
+
...view.startedAt !== undefined ? [`elapsed ${Math.round(Math.max(0, now - view.startedAt) / 1000)}s`] : []
|
|
6683
|
+
];
|
|
6684
|
+
return `- ${parts.join(" | ")}`;
|
|
6685
|
+
});
|
|
6686
|
+
const head = "Subagents under supervision; judge each child on the question keyed by its id.";
|
|
6687
|
+
return `${head}
|
|
6688
|
+
${lines.join(`
|
|
6689
|
+
`)}`.slice(0, SPIN_STATE_MAX_CHARS);
|
|
6690
|
+
}
|
|
6691
|
+
function parseSpinAnswers(answers, id8ToChild) {
|
|
6692
|
+
const out = [];
|
|
6693
|
+
for (const [id8, childId] of id8ToChild) {
|
|
6694
|
+
const answer = answers[`spin_${id8}`];
|
|
6695
|
+
if (answer === undefined || typeof answer.value !== "number" || !Number.isFinite(answer.value))
|
|
6696
|
+
continue;
|
|
6697
|
+
out.push([childId, answer.value]);
|
|
6698
|
+
}
|
|
6699
|
+
return out;
|
|
6700
|
+
}
|
|
6701
|
+
function spinAttentionEnabled(value) {
|
|
6702
|
+
if (value === null || typeof value !== "object")
|
|
6703
|
+
return true;
|
|
6704
|
+
return value.spinAttention !== false;
|
|
6705
|
+
}
|
|
6706
|
+
function spinAttentionEnabledFromRows(rows) {
|
|
6707
|
+
for (const row of rows) {
|
|
6708
|
+
if (row?.ns === "dsh-opentui")
|
|
6709
|
+
return spinAttentionEnabled(row.value);
|
|
6710
|
+
}
|
|
6711
|
+
return true;
|
|
6712
|
+
}
|
|
6713
|
+
function createSpinAttentionSource(options) {
|
|
6714
|
+
const now = options.now ?? Date.now;
|
|
6715
|
+
const minIntervalMs = options.minIntervalMs ?? SPIN_JEV_MIN_INTERVAL_MS;
|
|
6716
|
+
const env = options.env ?? process.env;
|
|
6717
|
+
let core;
|
|
6718
|
+
let loading;
|
|
6719
|
+
let lastDispatchAt = -Infinity;
|
|
6720
|
+
let inFlight = false;
|
|
6721
|
+
let failureCount = 0;
|
|
6722
|
+
const ensureLoaded = () => {
|
|
6723
|
+
if (options.module !== undefined)
|
|
6724
|
+
return Promise.resolve(options.module);
|
|
6725
|
+
if (core !== undefined)
|
|
6726
|
+
return Promise.resolve(core);
|
|
6727
|
+
loading ??= loadJevCore().then((mod) => {
|
|
6728
|
+
core = mod;
|
|
6729
|
+
return mod;
|
|
6730
|
+
});
|
|
6731
|
+
return loading;
|
|
6732
|
+
};
|
|
6733
|
+
return {
|
|
6734
|
+
failures: () => failureCount,
|
|
6735
|
+
tick(views, cap) {
|
|
6736
|
+
if (inFlight)
|
|
6737
|
+
return;
|
|
6738
|
+
if (!options.enabledReader())
|
|
6739
|
+
return;
|
|
6740
|
+
const live = views.filter((view) => view.running && view.childId);
|
|
6741
|
+
if (live.length === 0)
|
|
6742
|
+
return;
|
|
6743
|
+
const at = now();
|
|
6744
|
+
if (at - lastDispatchAt < minIntervalMs)
|
|
6745
|
+
return;
|
|
6746
|
+
ensureLoaded().then((mod) => {
|
|
6747
|
+
if (mod === null)
|
|
6748
|
+
return;
|
|
6749
|
+
if (!mod.isConfigured({ env }))
|
|
6750
|
+
return;
|
|
6751
|
+
const running = views.filter((view) => view.running && view.childId);
|
|
6752
|
+
if (running.length === 0)
|
|
6753
|
+
return;
|
|
6754
|
+
const id8ToChild = new Map(running.map((view) => [view.childId.slice(0, 8), view.childId]));
|
|
6755
|
+
const questions = buildSpinQuestions([...id8ToChild.keys()]);
|
|
6756
|
+
const state = buildSpinState(running, cap, now());
|
|
6757
|
+
if (state.trim() === "")
|
|
6758
|
+
return;
|
|
6759
|
+
inFlight = true;
|
|
6760
|
+
lastDispatchAt = at;
|
|
6761
|
+
mod.classify({ questions, state, env, timeoutMs: SPIN_JEV_TIMEOUT_MS }).then((result) => {
|
|
6762
|
+
for (const [childId, score] of parseSpinAnswers(result.answers, id8ToChild)) {
|
|
6763
|
+
try {
|
|
6764
|
+
options.onVerdict(childId, score);
|
|
6765
|
+
} catch {}
|
|
6766
|
+
}
|
|
6767
|
+
}).catch(() => {
|
|
6768
|
+
failureCount += 1;
|
|
6769
|
+
}).finally(() => {
|
|
6770
|
+
inFlight = false;
|
|
6771
|
+
});
|
|
6772
|
+
});
|
|
6773
|
+
}
|
|
6774
|
+
};
|
|
6775
|
+
}
|
|
6776
|
+
var SPIN_JEV_MIN_INTERVAL_MS = 30000, SPIN_JEV_TIMEOUT_MS = 8000, SPIN_STATE_MAX_CHARS = 1000, SPIN_LABEL_MAX_CHARS = 40;
|
|
6777
|
+
|
|
6620
6778
|
// src/client/remote-subagents.ts
|
|
6621
6779
|
import { randomUUID as randomUUID3 } from "crypto";
|
|
6622
6780
|
|
|
@@ -6627,6 +6785,7 @@ class RemoteSubagentPanel {
|
|
|
6627
6785
|
#pumps = new Map;
|
|
6628
6786
|
#stopped = false;
|
|
6629
6787
|
#policy;
|
|
6788
|
+
#spinAttention;
|
|
6630
6789
|
constructor(options) {
|
|
6631
6790
|
this.#options = options;
|
|
6632
6791
|
if (options.limits !== undefined) {
|
|
@@ -6670,6 +6829,13 @@ class RemoteSubagentPanel {
|
|
|
6670
6829
|
}
|
|
6671
6830
|
});
|
|
6672
6831
|
}
|
|
6832
|
+
if (options.spinEnabled !== undefined) {
|
|
6833
|
+
this.#spinAttention = createSpinAttentionSource({
|
|
6834
|
+
enabledReader: options.spinEnabled,
|
|
6835
|
+
onVerdict: (childId, score) => this.noteSpinVerdict(childId, score),
|
|
6836
|
+
...options.spinModule !== undefined ? { module: options.spinModule } : {}
|
|
6837
|
+
});
|
|
6838
|
+
}
|
|
6673
6839
|
}
|
|
6674
6840
|
foldParentRecord(entry) {
|
|
6675
6841
|
if (entry.type === "tool-workflow/agent-start") {
|
|
@@ -6957,6 +7123,7 @@ class RemoteSubagentPanel {
|
|
|
6957
7123
|
if (this.#policy !== undefined && options.feedLadder) {
|
|
6958
7124
|
this.#options.refreshLimits?.();
|
|
6959
7125
|
this.#policy.onRoundCount(id, next.rounds, next.label);
|
|
7126
|
+
this.#tickSpinAttention();
|
|
6960
7127
|
}
|
|
6961
7128
|
for (const line of text.split(`
|
|
6962
7129
|
`))
|
|
@@ -6986,6 +7153,19 @@ class RemoteSubagentPanel {
|
|
|
6986
7153
|
log.shift();
|
|
6987
7154
|
return changed;
|
|
6988
7155
|
}
|
|
7156
|
+
#tickSpinAttention() {
|
|
7157
|
+
if (this.#spinAttention === undefined)
|
|
7158
|
+
return;
|
|
7159
|
+
const cap = this.#options.limits?.().maxRounds ?? 0;
|
|
7160
|
+
const views = [];
|
|
7161
|
+
for (const [childId, view] of this.#children) {
|
|
7162
|
+
if (view.status !== "running")
|
|
7163
|
+
continue;
|
|
7164
|
+
views.push({ childId, label: view.label, rounds: view.rounds, running: true, startedAt: view.startedAt });
|
|
7165
|
+
}
|
|
7166
|
+
if (views.length > 0)
|
|
7167
|
+
this.#spinAttention.tick(views, cap);
|
|
7168
|
+
}
|
|
6989
7169
|
#emit() {
|
|
6990
7170
|
try {
|
|
6991
7171
|
this.#options.onUpdate?.(this.views());
|
|
@@ -7192,6 +7372,7 @@ __export(exports_remote_host_session, {
|
|
|
7192
7372
|
REATTACH_MAX_ATTEMPTS: () => REATTACH_MAX_ATTEMPTS,
|
|
7193
7373
|
REATTACH_RETRY_MS: () => REATTACH_RETRY_MS,
|
|
7194
7374
|
RemoteHostSession: () => RemoteHostSession,
|
|
7375
|
+
SPIN_REFRESH_TTL_MS: () => SPIN_REFRESH_TTL_MS,
|
|
7195
7376
|
openRemoteStream: () => openRemoteStream
|
|
7196
7377
|
});
|
|
7197
7378
|
import { randomUUID as randomUUID4 } from "crypto";
|
|
@@ -7204,6 +7385,9 @@ function trace(message) {
|
|
|
7204
7385
|
process.stderr.write(`[rhs ${new Date().toISOString().slice(11, 23)}] ${message}
|
|
7205
7386
|
`);
|
|
7206
7387
|
}
|
|
7388
|
+
function selectionErrorText(error) {
|
|
7389
|
+
return String(error instanceof Error ? error.message : error).slice(0, 150);
|
|
7390
|
+
}
|
|
7207
7391
|
|
|
7208
7392
|
class RemoteHostSession {
|
|
7209
7393
|
label = "dsh-host";
|
|
@@ -7245,6 +7429,7 @@ class RemoteHostSession {
|
|
|
7245
7429
|
#promptInFlight = false;
|
|
7246
7430
|
#interrupted = false;
|
|
7247
7431
|
#pendingModel;
|
|
7432
|
+
#selectionError;
|
|
7248
7433
|
#turns = 0;
|
|
7249
7434
|
#turnStartedAt = 0;
|
|
7250
7435
|
#turnUsageStart = { prompt: 0, completion: 0 };
|
|
@@ -7281,6 +7466,10 @@ class RemoteHostSession {
|
|
|
7281
7466
|
#lastRestartPid;
|
|
7282
7467
|
#btwBusy = false;
|
|
7283
7468
|
#subagents;
|
|
7469
|
+
#spinAttentionOn = true;
|
|
7470
|
+
#spinAttentionRefreshing = false;
|
|
7471
|
+
#spinRefreshTtlMs;
|
|
7472
|
+
#spinCheckedAt = -Infinity;
|
|
7284
7473
|
#overlayCache;
|
|
7285
7474
|
constructor(options) {
|
|
7286
7475
|
this.#connection = options.connection;
|
|
@@ -7293,6 +7482,7 @@ class RemoteHostSession {
|
|
|
7293
7482
|
this.#restartHost = options.restartHost;
|
|
7294
7483
|
this.#reattachRetryMs = options.reattachRetryMs ?? REATTACH_RETRY_MS;
|
|
7295
7484
|
this.#reattachMaxAttempts = options.reattachMaxAttempts ?? REATTACH_MAX_ATTEMPTS;
|
|
7485
|
+
this.#spinRefreshTtlMs = options.spinRefreshTtlMs ?? SPIN_REFRESH_TTL_MS;
|
|
7296
7486
|
this.#socketFactory = options.socketFactory ?? ((path) => this.#openMuxSocket(path));
|
|
7297
7487
|
}
|
|
7298
7488
|
#openMuxSocket(path) {
|
|
@@ -7569,8 +7759,12 @@ class RemoteHostSession {
|
|
|
7569
7759
|
}
|
|
7570
7760
|
this.#modelClient().selectModel(sessionId, selection).catch((error) => {
|
|
7571
7761
|
console.error("[remote-host-session] selectModel failed:", error);
|
|
7762
|
+
this.#selectionError = selectionErrorText(error);
|
|
7572
7763
|
});
|
|
7573
7764
|
}
|
|
7765
|
+
lastSelectionError() {
|
|
7766
|
+
return this.#selectionError;
|
|
7767
|
+
}
|
|
7574
7768
|
async selectModel(selection) {
|
|
7575
7769
|
this.label = `${selection.provider}/${selection.model}${selection.reasoningEffort ? ` (${selection.reasoningEffort})` : ""}`;
|
|
7576
7770
|
const sessionId = this.#sessionId;
|
|
@@ -7579,6 +7773,7 @@ class RemoteHostSession {
|
|
|
7579
7773
|
return selection;
|
|
7580
7774
|
}
|
|
7581
7775
|
const selected = await this.#modelClient().selectModel(sessionId, selection);
|
|
7776
|
+
this.#selectionError = undefined;
|
|
7582
7777
|
this.#invalidateContextProjections();
|
|
7583
7778
|
return selected;
|
|
7584
7779
|
}
|
|
@@ -7591,7 +7786,7 @@ class RemoteHostSession {
|
|
|
7591
7786
|
async currentModelSelection() {
|
|
7592
7787
|
const sessionId = this.#sessionId;
|
|
7593
7788
|
if (sessionId === undefined)
|
|
7594
|
-
return this.defaultModelSelection();
|
|
7789
|
+
return this.#pendingModel ?? await this.defaultModelSelection();
|
|
7595
7790
|
return this.#modelClient().sessionSelection(sessionId);
|
|
7596
7791
|
}
|
|
7597
7792
|
async initializeDefaultModel() {
|
|
@@ -8161,6 +8356,8 @@ class RemoteHostSession {
|
|
|
8161
8356
|
socketFactory: this.#socketFactory,
|
|
8162
8357
|
parentId: () => this.#sessionId,
|
|
8163
8358
|
limits: () => parseSubagentRoundLimits(this.configLoad()),
|
|
8359
|
+
refreshLimits: () => this.#refreshSpinAttention(),
|
|
8360
|
+
spinEnabled: () => this.#spinAttentionOn,
|
|
8164
8361
|
onHardStop: (record) => console.info(`[subagent-policy] force-stopped child ${record.childId} at round ${record.round} (cap ${record.cap} + grace ${record.grace})`),
|
|
8165
8362
|
onUpdate: (views) => {
|
|
8166
8363
|
for (const listener of this.#subagentListeners) {
|
|
@@ -8176,6 +8373,20 @@ class RemoteHostSession {
|
|
|
8176
8373
|
}
|
|
8177
8374
|
return this.#subagents;
|
|
8178
8375
|
}
|
|
8376
|
+
#refreshSpinAttention() {
|
|
8377
|
+
if (this.#spinAttentionRefreshing)
|
|
8378
|
+
return;
|
|
8379
|
+
const now = performance.now();
|
|
8380
|
+
if (now - this.#spinCheckedAt < this.#spinRefreshTtlMs)
|
|
8381
|
+
return;
|
|
8382
|
+
this.#spinAttentionRefreshing = true;
|
|
8383
|
+
this.#spinCheckedAt = now;
|
|
8384
|
+
this.settingsDescribe().then((rows) => {
|
|
8385
|
+
this.#spinAttentionOn = spinAttentionEnabledFromRows(rows);
|
|
8386
|
+
}).catch(() => {}).finally(() => {
|
|
8387
|
+
this.#spinAttentionRefreshing = false;
|
|
8388
|
+
});
|
|
8389
|
+
}
|
|
8179
8390
|
childTranscript(id) {
|
|
8180
8391
|
return this.#subagentPanel().transcript(id);
|
|
8181
8392
|
}
|
|
@@ -8285,8 +8496,10 @@ class RemoteHostSession {
|
|
|
8285
8496
|
this.#pendingModel = undefined;
|
|
8286
8497
|
try {
|
|
8287
8498
|
await this.#modelClient().selectModel(this.#sessionId, staged);
|
|
8499
|
+
this.#selectionError = undefined;
|
|
8288
8500
|
} catch (error) {
|
|
8289
8501
|
console.error("[remote-host-session] staged selectModel failed:", error);
|
|
8502
|
+
this.#selectionError = `staged ${staged.provider}/${staged.model} \u2014 ${selectionErrorText(error)}`;
|
|
8290
8503
|
}
|
|
8291
8504
|
}
|
|
8292
8505
|
const opening = await this.#attachFollow(false);
|
|
@@ -8718,7 +8931,7 @@ function asPermissionOptions(value) {
|
|
|
8718
8931
|
];
|
|
8719
8932
|
});
|
|
8720
8933
|
}
|
|
8721
|
-
var REATTACH_RETRY_MS = 1000, REATTACH_MAX_ATTEMPTS = 30, PRESET_ENGLISH_NAMES;
|
|
8934
|
+
var REATTACH_RETRY_MS = 1000, REATTACH_MAX_ATTEMPTS = 30, SPIN_REFRESH_TTL_MS = 5000, PRESET_ENGLISH_NAMES;
|
|
8722
8935
|
var init_remote_host_session = __esm(() => {
|
|
8723
8936
|
init_loop();
|
|
8724
8937
|
init_remote_follow();
|
|
@@ -20843,7 +21056,7 @@ var init_keybind = __esm(() => {
|
|
|
20843
21056
|
"variant.cycle": keybind("ctrl+t", "Cycle model variants"),
|
|
20844
21057
|
"variant.list": keybind("none", "List model variants"),
|
|
20845
21058
|
"session.page.up": keybind("pageup,ctrl+alt+b", "Scroll messages up by one page"),
|
|
20846
|
-
"session.page.down": keybind("pagedown
|
|
21059
|
+
"session.page.down": keybind("pagedown", "Scroll messages down by one page"),
|
|
20847
21060
|
"session.line.up": keybind("ctrl+alt+y", "Scroll messages up by one line"),
|
|
20848
21061
|
"session.line.down": keybind("ctrl+alt+e", "Scroll messages down by one line"),
|
|
20849
21062
|
"session.half.page.up": keybind("ctrl+alt+u", "Scroll messages up by half page"),
|
|
@@ -49026,6 +49239,9 @@ function persistHints(seam) {
|
|
|
49026
49239
|
console.error("[commands] hints persist failed:", error);
|
|
49027
49240
|
}
|
|
49028
49241
|
}
|
|
49242
|
+
function seamFailureReason(error) {
|
|
49243
|
+
return String(error instanceof Error ? error.message : error).slice(0, 150);
|
|
49244
|
+
}
|
|
49029
49245
|
function presetNextRow(rows, currentId) {
|
|
49030
49246
|
if (rows.length <= 1)
|
|
49031
49247
|
return;
|
|
@@ -49144,8 +49360,12 @@ function coreCommands() {
|
|
|
49144
49360
|
},
|
|
49145
49361
|
{
|
|
49146
49362
|
name: "/model",
|
|
49147
|
-
description: "switch model (bare opens the picker)",
|
|
49363
|
+
description: "switch model (bare opens the picker, then the effort picker)",
|
|
49148
49364
|
async run(ctx, argText) {
|
|
49365
|
+
const pendingSelectionError = ctx.seam.lastSelectionError?.();
|
|
49366
|
+
if (pendingSelectionError) {
|
|
49367
|
+
ctx.say(`model note: the last staged switch failed \u2014 ${pendingSelectionError}`);
|
|
49368
|
+
}
|
|
49149
49369
|
const arg = argText.trim();
|
|
49150
49370
|
if (arg) {
|
|
49151
49371
|
const [providerID, modelID] = arg.split("/");
|
|
@@ -49153,7 +49373,12 @@ function coreCommands() {
|
|
|
49153
49373
|
ctx.say(`usage: /model or /model provider/model (got "${arg}")`);
|
|
49154
49374
|
return;
|
|
49155
49375
|
}
|
|
49156
|
-
|
|
49376
|
+
try {
|
|
49377
|
+
await ctx.seam.selectModel(providerID, modelID);
|
|
49378
|
+
} catch (error) {
|
|
49379
|
+
ctx.say(`model switch failed \u2014 ${seamFailureReason(error)}`);
|
|
49380
|
+
return;
|
|
49381
|
+
}
|
|
49157
49382
|
ctx.say(`model \u2192 ${providerID}/${modelID}`);
|
|
49158
49383
|
ctx.refreshFooter?.();
|
|
49159
49384
|
return;
|
|
@@ -49172,8 +49397,65 @@ function coreCommands() {
|
|
|
49172
49397
|
if (!picked)
|
|
49173
49398
|
return;
|
|
49174
49399
|
const [providerID, modelID] = picked.split("/");
|
|
49175
|
-
|
|
49400
|
+
const thinking = ctx.seam.thinking;
|
|
49401
|
+
let ladder = [];
|
|
49402
|
+
try {
|
|
49403
|
+
ladder = await thinking?.effortsFor?.(providerID, modelID) ?? [];
|
|
49404
|
+
} catch {
|
|
49405
|
+
ladder = [];
|
|
49406
|
+
}
|
|
49407
|
+
if (ladder.length === 0) {
|
|
49408
|
+
const keptEffort = current?.providerID === providerID ? await thinking?.currentEffort() : undefined;
|
|
49409
|
+
try {
|
|
49410
|
+
await ctx.seam.selectModel(providerID, modelID);
|
|
49411
|
+
} catch (error) {
|
|
49412
|
+
ctx.say(`model switch failed \u2014 ${seamFailureReason(error)}`);
|
|
49413
|
+
return;
|
|
49414
|
+
}
|
|
49415
|
+
ctx.say(`model \u2192 ${picked} (no think levels)`);
|
|
49416
|
+
if (keptEffort !== undefined) {
|
|
49417
|
+
try {
|
|
49418
|
+
await thinking?.selectEffort(keptEffort);
|
|
49419
|
+
} catch (error) {
|
|
49420
|
+
ctx.say(`thinking switch failed \u2014 ${seamFailureReason(error)}`);
|
|
49421
|
+
ctx.refreshFooter?.();
|
|
49422
|
+
return;
|
|
49423
|
+
}
|
|
49424
|
+
ctx.say(`thinking \u2192 ${keptEffort} (next turn)`);
|
|
49425
|
+
}
|
|
49426
|
+
ctx.refreshFooter?.();
|
|
49427
|
+
return;
|
|
49428
|
+
}
|
|
49429
|
+
const effortNow = await thinking?.currentEffort();
|
|
49430
|
+
const effortPicked = await ctx.pickOne(`Select reasoning effort \u2014 ${picked}`, [
|
|
49431
|
+
{ title: "(model default)", value: MODEL_DEFAULT_EFFORT_PICK },
|
|
49432
|
+
...ladder.map((effort) => ({
|
|
49433
|
+
title: effort.name,
|
|
49434
|
+
value: effort.id,
|
|
49435
|
+
description: effort.id === effortNow ? "current" : effort.description
|
|
49436
|
+
}))
|
|
49437
|
+
]);
|
|
49438
|
+
if (!effortPicked) {
|
|
49439
|
+
ctx.say("model unchanged");
|
|
49440
|
+
return;
|
|
49441
|
+
}
|
|
49442
|
+
const effort = effortPicked === MODEL_DEFAULT_EFFORT_PICK ? undefined : effortPicked;
|
|
49443
|
+
ctx.invalidateFooter?.();
|
|
49444
|
+
try {
|
|
49445
|
+
await ctx.seam.selectModel(providerID, modelID);
|
|
49446
|
+
} catch (error) {
|
|
49447
|
+
ctx.say(`model switch failed \u2014 ${seamFailureReason(error)}`);
|
|
49448
|
+
return;
|
|
49449
|
+
}
|
|
49176
49450
|
ctx.say(`model \u2192 ${picked}`);
|
|
49451
|
+
try {
|
|
49452
|
+
await thinking?.selectEffort(effort);
|
|
49453
|
+
} catch (error) {
|
|
49454
|
+
ctx.say(`thinking switch failed \u2014 ${seamFailureReason(error)}`);
|
|
49455
|
+
ctx.refreshFooter?.();
|
|
49456
|
+
return;
|
|
49457
|
+
}
|
|
49458
|
+
ctx.say(`thinking \u2192 ${effortPicked === MODEL_DEFAULT_EFFORT_PICK ? "model default" : effortPicked} (next turn)`);
|
|
49177
49459
|
ctx.refreshFooter?.();
|
|
49178
49460
|
}
|
|
49179
49461
|
},
|
|
@@ -49378,7 +49660,12 @@ function coreCommands() {
|
|
|
49378
49660
|
if (!picked || picked === current)
|
|
49379
49661
|
return;
|
|
49380
49662
|
ctx.invalidateFooter?.();
|
|
49381
|
-
|
|
49663
|
+
try {
|
|
49664
|
+
await thinking.selectEffort(picked);
|
|
49665
|
+
} catch (error) {
|
|
49666
|
+
ctx.say(`thinking switch failed \u2014 ${seamFailureReason(error)}`);
|
|
49667
|
+
return;
|
|
49668
|
+
}
|
|
49382
49669
|
ctx.say(`thinking \u2192 ${picked} (next turn)`);
|
|
49383
49670
|
ctx.refreshFooter?.();
|
|
49384
49671
|
}
|
|
@@ -49584,6 +49871,7 @@ function dispatchLine(commands, line) {
|
|
|
49584
49871
|
function unknownCommandRow(name) {
|
|
49585
49872
|
return `unknown command: ${name} (try /help)`;
|
|
49586
49873
|
}
|
|
49874
|
+
var MODEL_DEFAULT_EFFORT_PICK = "__model_default__";
|
|
49587
49875
|
var init_commands = __esm(() => {
|
|
49588
49876
|
init_hotkeys();
|
|
49589
49877
|
init_login();
|
|
@@ -53621,7 +53909,10 @@ function BtwPanel(props) {
|
|
|
53621
53909
|
get fallback() {
|
|
53622
53910
|
return (() => {
|
|
53623
53911
|
var _el$0 = createElement("text");
|
|
53624
|
-
insert(_el$0, () =>
|
|
53912
|
+
insert(_el$0, (() => {
|
|
53913
|
+
var _c$2 = memo2(() => run().answer === "");
|
|
53914
|
+
return () => _c$2() ? "(empty answer)" : run().answer;
|
|
53915
|
+
})());
|
|
53625
53916
|
return _el$0;
|
|
53626
53917
|
})();
|
|
53627
53918
|
},
|
|
@@ -54146,10 +54437,11 @@ class RemoteSessionSeam {
|
|
|
54146
54437
|
selectModel(providerID, modelID) {
|
|
54147
54438
|
return this.#session.selectModel({ provider: providerID, model: modelID }).then(() => {
|
|
54148
54439
|
return;
|
|
54149
|
-
}).catch((error) => {
|
|
54150
|
-
console.error("[session-seam-adapter] selectModel failed:", error);
|
|
54151
54440
|
});
|
|
54152
54441
|
}
|
|
54442
|
+
lastSelectionError() {
|
|
54443
|
+
return this.#session.lastSelectionError();
|
|
54444
|
+
}
|
|
54153
54445
|
thinking = {
|
|
54154
54446
|
efforts: async () => {
|
|
54155
54447
|
try {
|
|
@@ -54171,6 +54463,7 @@ class RemoteSessionSeam {
|
|
|
54171
54463
|
return [];
|
|
54172
54464
|
}
|
|
54173
54465
|
},
|
|
54466
|
+
effortsFor: (providerID, modelID) => this.#session.modelEfforts(providerID, modelID),
|
|
54174
54467
|
currentEffort: async () => {
|
|
54175
54468
|
const selection = await this.#session.currentModelSelection();
|
|
54176
54469
|
return selection?.reasoningEffort;
|
|
@@ -54186,8 +54479,6 @@ class RemoteSessionSeam {
|
|
|
54186
54479
|
});
|
|
54187
54480
|
}).then(() => {
|
|
54188
54481
|
return;
|
|
54189
|
-
}).catch((error) => {
|
|
54190
|
-
console.error("[session-seam-adapter] selectEffort failed:", error);
|
|
54191
54482
|
});
|
|
54192
54483
|
}
|
|
54193
54484
|
};
|
package/package.json
CHANGED
|
@@ -43,8 +43,10 @@
|
|
|
43
43
|
// satisfied — a local development pin is never replaced by a registry version.
|
|
44
44
|
// Missing deps/versions → ONE batched `dsh plugin --profile opentui add
|
|
45
45
|
// <specs...>`; on failure the pnpm build-script skeleton is approved and each
|
|
46
|
-
// package is
|
|
47
|
-
//
|
|
46
|
+
// package is installed on its own with bounded spaced retries (a transient
|
|
47
|
+
// registry failure — TLS reset / ERR_PNPM_META_FETCH_FAIL — dies in seconds,
|
|
48
|
+
// a re-attempt after a short gap rides the burst out); a still-failing
|
|
49
|
+
// package is a WARN, never a hard stop (the client still launches).
|
|
48
50
|
//
|
|
49
51
|
// Step 4 reparses the profile manifest after the install: `dsh plugin add`
|
|
50
52
|
// already reconciles bundles for new dependencies, so this only fills the gaps
|
|
@@ -86,6 +88,14 @@ import {
|
|
|
86
88
|
|
|
87
89
|
const TEMPLATE = 'web'
|
|
88
90
|
const INSTALL_TIMEOUT_MS = 10 * 60 * 1000
|
|
91
|
+
// Bounded retry schedule for a single-spec install that failed (the fallback
|
|
92
|
+
// loop below). A transient registry failure (TLS reset / ERR_PNPM_META_FETCH_
|
|
93
|
+
// FAIL) exits within seconds, so 3 attempts spaced 5s apart ride the burst
|
|
94
|
+
// out without meaningfully extending a healthy provisioning run: the worst
|
|
95
|
+
// case adds ~2 fast failures + 2 x 5s per FAILING spec, and a hung `dsh
|
|
96
|
+
// plugin add` is still bounded by INSTALL_TIMEOUT_MS per invocation.
|
|
97
|
+
const PLUGIN_ADD_ATTEMPTS = 3
|
|
98
|
+
const PLUGIN_ADD_BACKOFF_MS = 5000
|
|
89
99
|
|
|
90
100
|
const args = process.argv.slice(2)
|
|
91
101
|
/** --name=value or --name value. */
|
|
@@ -340,6 +350,12 @@ function runPluginAdd(specs) {
|
|
|
340
350
|
})
|
|
341
351
|
}
|
|
342
352
|
|
|
353
|
+
/** Synchronous pause (this script is spawnSync end to end; there is no event
|
|
354
|
+
* loop to await on). */
|
|
355
|
+
function pauseSync(ms) {
|
|
356
|
+
Atomics.wait(new Int32Array(new SharedArrayBuffer(4)), 0, 0, ms)
|
|
357
|
+
}
|
|
358
|
+
|
|
343
359
|
const failedInstalls = []
|
|
344
360
|
let installedCount = 0
|
|
345
361
|
|
|
@@ -374,13 +390,26 @@ if (tier === 'none') {
|
|
|
374
390
|
say(3, 'plugins', 'approved the printed build scripts (pnpm allowBuilds) — retrying one by one…')
|
|
375
391
|
}
|
|
376
392
|
// Single-package fallback: one bad package must not sink the rest.
|
|
393
|
+
// Each failing spec gets bounded spaced retries (PLUGIN_ADD_ATTEMPTS /
|
|
394
|
+
// PLUGIN_ADD_BACKOFF_MS): a transient registry failure rides the burst
|
|
395
|
+
// out instead of WARN-ing the plugin away on the first drop. The
|
|
396
|
+
// terminal failure stays a WARN + failedInstalls entry — never a
|
|
397
|
+
// silent pass (the e2e npm-install boot leg asserts the delivered set).
|
|
377
398
|
for (const spec of specs) {
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
399
|
+
let installed = false
|
|
400
|
+
for (let attempt = 1; attempt <= PLUGIN_ADD_ATTEMPTS && !installed; attempt += 1) {
|
|
401
|
+
if (attempt > 1) {
|
|
402
|
+
say(3, 'plugins', `${spec} failed — retry ${attempt - 1}/${PLUGIN_ADD_ATTEMPTS - 1} in ${PLUGIN_ADD_BACKOFF_MS / 1000}s…`)
|
|
403
|
+
pauseSync(PLUGIN_ADD_BACKOFF_MS)
|
|
404
|
+
}
|
|
405
|
+
const retry = runPluginAdd([spec])
|
|
406
|
+
if (!retry.error && retry.status === 0) {
|
|
407
|
+
installedCount += 1
|
|
408
|
+
installed = true
|
|
409
|
+
} else if (attempt === PLUGIN_ADD_ATTEMPTS) {
|
|
410
|
+
failedInstalls.push(spec)
|
|
411
|
+
warn(`could not install ${spec}${retry.error ? `: ${retry.error.message}` : ` (exit ${retry.status})`} — continuing`)
|
|
412
|
+
}
|
|
384
413
|
}
|
|
385
414
|
}
|
|
386
415
|
}
|