@aiwayds/dsh-tui-pi 2.37.1 → 2.38.1
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/README.md +1 -1
- package/README.zh-CN.md +2 -0
- package/bin/boot.mjs +4 -3
- package/bin/onboard-core.mjs +39 -19
- package/package.json +16 -16
- package/scripts/link-dsh-closure.mjs +13 -9
- package/lib/profile.d.ts +0 -82
- package/lib/profile.js +0 -665
- package/lib/profile.js.map +0 -1
- package/scripts/postinstall.mjs +0 -54
package/README.md
CHANGED
|
@@ -42,7 +42,7 @@ npm i -g @aiwayds/dsh-tui-pi
|
|
|
42
42
|
dsh-tui-pi # or the short form: dst
|
|
43
43
|
```
|
|
44
44
|
|
|
45
|
-
The
|
|
45
|
+
The package carries no install-time hook — the machine is set up on the first run of the launcher, which prints one progress line per step: it installs the `@deepseek-ai/dsh` host when missing (via npm, resolved as the newest of the `latest`/`next` dist-tags — the `latest` tag alone lags the rc line; if npm itself is not on PATH, it prints what to install and stops), installs pnpm, and creates the `tui` profile with this plugin and its bundled companions. The first run can take a few minutes — the host download is large. Host compatibility window: **0.2.2-rc.1 and newer** — a host at or above the floor is kept as-is; an older one is upgraded automatically. Whatever the first run cannot finish (e.g. an offline machine) completes automatically on a later launch. After a later `npm i -g` upgrade of this package, the profile's mounted copy is moved to the new version on the next launch — a profile that is newer than the global install (dev-upgraded ahead) is left untouched.
|
|
46
46
|
|
|
47
47
|
The manual steps do exactly what the onboarding runs, if you prefer them:
|
|
48
48
|
|
package/README.zh-CN.md
CHANGED
|
@@ -40,6 +40,8 @@ dsh plugin --profile tui add @aiwayds/dsh-tui-pi
|
|
|
40
40
|
dsh --profile tui # 启动(或:dsh-tui-pi)
|
|
41
41
|
```
|
|
42
42
|
|
|
43
|
+
本包不带任何安装期钩子——装机在启动器首次运行时完成,每步打一行进度:缺 `@deepseek-ai/dsh` 宿主时经 npm 全局安装(解析 `latest`/`next` 中更新的 dist-tag)、装 pnpm、创建带本插件与自带 companion 的 `tui` profile。首启要下载宿主,可能耗时数分钟;首次没装完的部分(如离线机器)下次启动自动补齐。之后升级本包,profile 的挂载副本在下次启动时随版本前移。
|
|
44
|
+
|
|
43
45
|
过去需要手工 patch 的一切——画布背景、`@deepseek-ai` 模块闭包、compaction 后端——现在都自动完成。发版后升级现有 profile:
|
|
44
46
|
|
|
45
47
|
```sh
|
package/bin/boot.mjs
CHANGED
|
@@ -12,9 +12,9 @@
|
|
|
12
12
|
* SyntaxError, so the guard stops with the paths and the removal commands.
|
|
13
13
|
*
|
|
14
14
|
* Version follow: after `npm i -g` upgrades this package, the profile still
|
|
15
|
-
* holds the old copy; the next launch
|
|
16
|
-
* the
|
|
17
|
-
*
|
|
15
|
+
* holds the old copy; the next launch re-runs the add to move the profile to
|
|
16
|
+
* the new version. A profile that is NEWER than the global install
|
|
17
|
+
* (dev-upgraded ahead) is left untouched.
|
|
18
18
|
*
|
|
19
19
|
* See bin/onboard-core.mjs for the setup logic and its failure contract.
|
|
20
20
|
*/
|
|
@@ -54,6 +54,7 @@ console.log('dsh-tui-pi setup (first run / upgrade only):')
|
|
|
54
54
|
const setup = runOnboard({ log: (line) => console.log(line) })
|
|
55
55
|
if (!setup.ok) {
|
|
56
56
|
console.error(`\ndsh-tui-pi: setup stopped at "${setup.step}".`)
|
|
57
|
+
if (setup.detail) console.error(`dsh-tui-pi: ${setup.step} — ${setup.detail}`)
|
|
57
58
|
console.error(`dsh-tui-pi: ${setup.hint}`)
|
|
58
59
|
process.exit(1)
|
|
59
60
|
}
|
package/bin/onboard-core.mjs
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* One-time onboarding for the `dsh-tui-pi` / `dst` launcher
|
|
3
|
-
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
2
|
+
* One-time onboarding for the `dsh-tui-pi` / `dst` launcher. The package
|
|
3
|
+
* carries no install hook — the historical `scripts/postinstall.mjs` was
|
|
4
|
+
* removed because pnpm 11's strictDepBuilds validation gates dependencies'
|
|
5
|
+
* install scripts (see docs/adr/0004-onboarding-first-launch-not-postinstall.md)
|
|
6
|
+
* — so `bin/boot.mjs` is the single entry point: it runs on the first
|
|
7
|
+
* `dsh-tui-pi` invocation and on any later one that finds the machine
|
|
8
|
+
* missing a piece (fresh machine, offline first run, profile behind after
|
|
9
|
+
* an upgrade, …).
|
|
9
10
|
*
|
|
10
11
|
* Contract:
|
|
11
12
|
* - idempotent: every step checks before it acts, so a re-run only prints
|
|
@@ -14,7 +15,9 @@
|
|
|
14
15
|
* step); npm itself is a prerequisite — when it is not on PATH we print
|
|
15
16
|
* what to install and stop instead of guessing;
|
|
16
17
|
* - all functions are synchronous and never throw past the boundary:
|
|
17
|
-
* failures come back as { ok: false, step, hint }
|
|
18
|
+
* failures come back as { ok: false, step, hint, detail } where detail
|
|
19
|
+
* carries how the underlying process died (exit code / signal / spawn
|
|
20
|
+
* error) — never swallowed behind a bare "stopped".
|
|
18
21
|
*/
|
|
19
22
|
|
|
20
23
|
import { execFileSync, spawnSync } from 'node:child_process'
|
|
@@ -125,14 +128,28 @@ export function dshBinPath() {
|
|
|
125
128
|
}
|
|
126
129
|
|
|
127
130
|
// Global installs always go through npm — one predictable path, regardless
|
|
128
|
-
// of which package manager pulled this package in.
|
|
131
|
+
// of which package manager pulled this package in. Returns { ok, detail }:
|
|
132
|
+
// on failure detail carries exactly how the npm child died (spawn error,
|
|
133
|
+
// signal, exit code). npm can die without ever printing an error — the
|
|
134
|
+
// kernel OOM killer SIGKILLs it under memory pressure (observed: exit 137
|
|
135
|
+
// installing @deepseek-ai/dsh on a 2 GiB podman VM) and a spawnSync timeout
|
|
136
|
+
// surfaces as a signal too — so a bare boolean would leave the launcher
|
|
137
|
+
// reporting "setup stopped" with no actionable cause.
|
|
129
138
|
function installGlobal(name) {
|
|
130
139
|
const result = spawnSync('npm', ['install', '-g', name], {
|
|
131
140
|
stdio: 'inherit',
|
|
132
141
|
timeout: INSTALL_TIMEOUT_MS,
|
|
133
142
|
shell: process.platform === 'win32',
|
|
134
143
|
})
|
|
135
|
-
|
|
144
|
+
if (result.status === 0) return { ok: true, detail: null }
|
|
145
|
+
const parts = []
|
|
146
|
+
if (result.error) {
|
|
147
|
+
parts.push(result.error.code ? `${result.error.code} (${result.error.message})` : result.error.message)
|
|
148
|
+
}
|
|
149
|
+
if (result.signal) parts.push(`killed by signal ${result.signal}`)
|
|
150
|
+
if (result.status !== null) parts.push(`exit code ${result.status}`)
|
|
151
|
+
if (parts.length === 0) parts.push('npm exited without an exit code or signal')
|
|
152
|
+
return { ok: false, detail: parts.join(', ') }
|
|
136
153
|
}
|
|
137
154
|
|
|
138
155
|
// Newest of the `latest` (stable) and `next` (rc) dist-tags — the same
|
|
@@ -214,10 +231,11 @@ export function compareVersions(a, b) {
|
|
|
214
231
|
}
|
|
215
232
|
|
|
216
233
|
// pnpm ≥10 fails a fresh `add` with ERR_PNPM_IGNORED_BUILDS when the added
|
|
217
|
-
// packages carry lifecycle scripts. The
|
|
218
|
-
// the closure
|
|
219
|
-
//
|
|
220
|
-
// approve-builds` would do interactively
|
|
234
|
+
// packages carry lifecycle scripts. The packages this suite ships declare
|
|
235
|
+
// none (the dev-tree closure linker is not wired as a hook in any published
|
|
236
|
+
// tarball), so filling the allowBuilds block approves nothing that can run
|
|
237
|
+
// unvetted — it is what `pnpm approve-builds` would do interactively, and it
|
|
238
|
+
// stays safe as companions evolve. pnpm sometimes records an
|
|
221
239
|
// allowBuilds skeleton in the profile's pnpm-workspace.yaml with a
|
|
222
240
|
// "set this to true or false" placeholder — fill those placeholders; when
|
|
223
241
|
// it does not (behavior varies by pnpm build and environment), write the
|
|
@@ -250,7 +268,7 @@ function approvePrintedBuilds() {
|
|
|
250
268
|
* 2/3 pnpm — the host's plugin manager shells out to it; installed
|
|
251
269
|
* globally when missing
|
|
252
270
|
* 3/3 tui profile — `dsh plugin --profile tui add` this package (+ companions)
|
|
253
|
-
* Returns { ok: true, dsh } or { ok: false, step, hint }.
|
|
271
|
+
* Returns { ok: true, dsh } or { ok: false, step, hint, detail }.
|
|
254
272
|
*/
|
|
255
273
|
export function runOnboard({ log = () => {} } = {}) {
|
|
256
274
|
let dsh = dshBinPath()
|
|
@@ -272,8 +290,9 @@ export function runOnboard({ log = () => {} } = {}) {
|
|
|
272
290
|
? `${foundVersion} is older than this plugin requires (>= ${minHostVersion()})`
|
|
273
291
|
: 'not found'
|
|
274
292
|
log(` [1/3] dsh host ${reason} — installing ${hostSpec} globally with npm (largest step, a few minutes)…`)
|
|
275
|
-
|
|
276
|
-
|
|
293
|
+
const hostInstall = installGlobal(hostSpec)
|
|
294
|
+
if (!hostInstall.ok) {
|
|
295
|
+
return { ok: false, step: 'dsh host install', hint: `install it with: npm install -g ${hostSpec} — then re-run dsh-tui-pi`, detail: hostInstall.detail }
|
|
277
296
|
}
|
|
278
297
|
dsh = dshBinPath()
|
|
279
298
|
if (!dsh) {
|
|
@@ -287,8 +306,9 @@ export function runOnboard({ log = () => {} } = {}) {
|
|
|
287
306
|
log(` [2/3] pnpm found ${queryVersion(pnpm, ['-v']) ?? ''}`)
|
|
288
307
|
} else {
|
|
289
308
|
log(' [2/3] pnpm not found — installing globally…')
|
|
290
|
-
|
|
291
|
-
|
|
309
|
+
const pnpmInstall = installGlobal('pnpm')
|
|
310
|
+
if (!pnpmInstall.ok) {
|
|
311
|
+
return { ok: false, step: 'pnpm install', hint: 'install it with: npm install -g pnpm — then re-run dsh-tui-pi', detail: pnpmInstall.detail }
|
|
292
312
|
}
|
|
293
313
|
log(` [2/3] pnpm installed ${queryVersion('pnpm', ['-v']) ?? ''}`)
|
|
294
314
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aiwayds/dsh-tui-pi",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.38.1",
|
|
4
4
|
"description": "A fully-featured pi-style terminal UI for DeepSeek Harness (dsh) — history look-back & fork-at-turn, guided preset switching, live subagent steering, model profiles & themes",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -59,24 +59,24 @@
|
|
|
59
59
|
"scripts": {
|
|
60
60
|
"link-closure": "node scripts/link-dsh-closure.mjs",
|
|
61
61
|
"build": "tsc -p tsconfig.json",
|
|
62
|
+
"prebuild": "node scripts/link-dsh-closure.mjs",
|
|
62
63
|
"check": "tsc --noEmit -p tsconfig.json",
|
|
63
64
|
"precheck": "node scripts/link-dsh-closure.mjs",
|
|
64
65
|
"pretest": "npm run build",
|
|
65
66
|
"test": "node --test test/*.test.mjs",
|
|
66
|
-
"smoke": "node scripts/smoke-boot.mjs"
|
|
67
|
-
"postinstall": "node scripts/postinstall.mjs"
|
|
67
|
+
"smoke": "node scripts/smoke-boot.mjs"
|
|
68
68
|
},
|
|
69
69
|
"dependencies": {
|
|
70
|
-
"@aiwayds/dsh-ask-router": "^0.
|
|
71
|
-
"@aiwayds/dsh-dcp": "^0.
|
|
72
|
-
"@aiwayds/dsh-jev-core": "^0.
|
|
73
|
-
"@aiwayds/dsh-llm-proxy": "^0.
|
|
74
|
-
"@aiwayds/dsh-llm-stats": "^0.
|
|
75
|
-
"@aiwayds/dsh-mcp-adapter": "^0.
|
|
76
|
-
"@aiwayds/dsh-model-sync": "^0.
|
|
77
|
-
"@aiwayds/dsh-profile-switch": "^0.
|
|
78
|
-
"@aiwayds/dsh-subagent-registry": "^0.
|
|
79
|
-
"@aiwayds/dsh-web-search-anysearch": "^0.
|
|
70
|
+
"@aiwayds/dsh-ask-router": "^0.7.0",
|
|
71
|
+
"@aiwayds/dsh-dcp": "^0.14.0",
|
|
72
|
+
"@aiwayds/dsh-jev-core": "^0.2.0",
|
|
73
|
+
"@aiwayds/dsh-llm-proxy": "^0.8.1",
|
|
74
|
+
"@aiwayds/dsh-llm-stats": "^0.9.0",
|
|
75
|
+
"@aiwayds/dsh-mcp-adapter": "^0.8.1",
|
|
76
|
+
"@aiwayds/dsh-model-sync": "^0.9.0",
|
|
77
|
+
"@aiwayds/dsh-profile-switch": "^0.4.1",
|
|
78
|
+
"@aiwayds/dsh-subagent-registry": "^0.20.1",
|
|
79
|
+
"@aiwayds/dsh-web-search-anysearch": "^0.9.0",
|
|
80
80
|
"@earendil-works/pi-tui": "0.85.1"
|
|
81
81
|
},
|
|
82
82
|
"peerDependencies": {
|
|
@@ -97,9 +97,9 @@
|
|
|
97
97
|
},
|
|
98
98
|
"devDependencies": {
|
|
99
99
|
"@deepseek-ai/cordis": "4.1.0",
|
|
100
|
-
"@deepseek-ai/dsh-settings": "0.2.2-rc.
|
|
101
|
-
"@deepseek-ai/dsh-skill": "0.2.2-rc.
|
|
102
|
-
"@deepseek-ai/dsh-user-questions": "0.2.2-rc.
|
|
100
|
+
"@deepseek-ai/dsh-settings": "0.2.2-rc.2",
|
|
101
|
+
"@deepseek-ai/dsh-skill": "0.2.2-rc.2",
|
|
102
|
+
"@deepseek-ai/dsh-user-questions": "0.2.2-rc.2",
|
|
103
103
|
"@types/node": "^24.0.0",
|
|
104
104
|
"typescript": "~5.9.0"
|
|
105
105
|
},
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
3
|
-
* global dsh closure.
|
|
2
|
+
* Dev-tree closure linker: point every `node_modules/@deepseek-ai/*` entry
|
|
3
|
+
* at the global dsh closure.
|
|
4
4
|
*
|
|
5
5
|
* Why this exists: dsh-tui-pi is a plugin that runs *inside* the installed
|
|
6
6
|
* dsh CLI, and its source imports the `@deepseek-ai/*` packages (cordis,
|
|
@@ -17,7 +17,10 @@
|
|
|
17
17
|
* (`Property 'settings' does not exist on type 'Context'`), so they must stay
|
|
18
18
|
* *undeclared*. pnpm then treats the closure links as extraneous — and, as
|
|
19
19
|
* it prunes entries it once managed, the links can still disappear after an
|
|
20
|
-
* install. This script re-creates them
|
|
20
|
+
* install. This script re-creates them after an install: in the dev tree it
|
|
21
|
+
* runs through the `link-closure` / `precheck` scripts — it is not wired as
|
|
22
|
+
* a lifecycle hook anywhere, and the published tarball carries no hooks at
|
|
23
|
+
* all (ADR 0004).
|
|
21
24
|
*
|
|
22
25
|
* It is a no-op (exit 0) when no global dsh install is found — a dev machine
|
|
23
26
|
* without dsh simply cannot typecheck against dsh types.
|
|
@@ -29,12 +32,13 @@ import { dirname, join } from 'node:path'
|
|
|
29
32
|
import { fileURLToPath } from 'node:url'
|
|
30
33
|
|
|
31
34
|
const repoRoot = dirname(dirname(fileURLToPath(import.meta.url)))
|
|
32
|
-
// Guard: this
|
|
33
|
-
// published tarball carries scripts/ but no
|
|
34
|
-
// consumer's node_modules (it would delete
|
|
35
|
-
// replace them with symlinks into their
|
|
36
|
-
//
|
|
37
|
-
//
|
|
35
|
+
// Guard: this linker is a dev-machine convenience for THIS repo, invoked
|
|
36
|
+
// only through the dev scripts. A published tarball carries scripts/ but no
|
|
37
|
+
// src/, and must never touch a consumer's node_modules (it would delete
|
|
38
|
+
// their @deepseek-ai packages and replace them with symlinks into their
|
|
39
|
+
// global dsh closure). npm would run a script wired under this name as a
|
|
40
|
+
// lifecycle hook — the published package wires none, and the guard stays as
|
|
41
|
+
// a hard boundary: exit silently outside the repo.
|
|
38
42
|
if (!existsSync(join(repoRoot, 'src'))) {
|
|
39
43
|
process.exit(0)
|
|
40
44
|
}
|
package/lib/profile.d.ts
DELETED
|
@@ -1,82 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* `/profile-switch` + `/profile-cfg` — user model profiles: named snapshots
|
|
3
|
-
* of the whole model configuration (default model + think level, every
|
|
4
|
-
* subagent's model/thinking) that switch in one step between contexts like
|
|
5
|
-
* work and personal.
|
|
6
|
-
*
|
|
7
|
-
* Layers, all on the select-panel framework (src/panels.ts):
|
|
8
|
-
*
|
|
9
|
-
* 1. `/profile-switch` switcher (TablePanel) — one row per profile (name |
|
|
10
|
-
* default model | think | agents). Enter applies the profile to the
|
|
11
|
-
* live selection AND the agent markdown files, and BINDS this directory
|
|
12
|
-
* tree (.dsh-profile) so new sessions here start on it — switching is
|
|
13
|
-
* workspace-scoped: other trees keep their own binding, or the global
|
|
14
|
-
* default. Esc backs out; p pins/unpins manually.
|
|
15
|
-
* 2. `/profile-cfg` manager (TablePanel) — the roster: n new, d delete
|
|
16
|
-
* (double-press confirm), Enter opens the profile's fields.
|
|
17
|
-
* 3. profile fields (FieldPanel) — model / think / agents rows plus the
|
|
18
|
-
* s save-current, r rename, v review shortcuts.
|
|
19
|
-
* 4. agents sub-table (TablePanel) — every discovered agent's recorded
|
|
20
|
-
* model/thinking; Enter picks through the SAME favorites/hidden model
|
|
21
|
-
* table /model uses (pickModel with the shared PanelHost), i sets
|
|
22
|
-
* explicit inherit, t edits think alone.
|
|
23
|
-
*
|
|
24
|
-
* Every edit persists to `$DSH_HOME/model-profiles.json` immediately
|
|
25
|
-
* (src/model-profiles.ts). Applying a profile sets the live default model,
|
|
26
|
-
* binds the workspace tree via `.dsh-profile` (src/model-profiles.ts) and
|
|
27
|
-
* records the last-applied pointer — it writes NO agent files: each agent's
|
|
28
|
-
* runtime model/thinking is composed at spawn from the frontmatter baseline
|
|
29
|
-
* ⊕ this pinned profile's per-agent overrides (src/agent-runtime.ts, the
|
|
30
|
-
* registry's profile-aware composer), so a switch is fully workspace-scoped.
|
|
31
|
-
* The live default model rides the bridge selection. The GLOBAL
|
|
32
|
-
* agent-default-model is written only by /model, never by a profile switch.
|
|
33
|
-
* The ● "current" marker is the tree's own binding (boundProfileName), not a
|
|
34
|
-
* machine-wide pointer.
|
|
35
|
-
*/
|
|
36
|
-
import type { Context } from '@deepseek-ai/cordis';
|
|
37
|
-
import type { ModelSelection } from '@deepseek-ai/dsh-agent';
|
|
38
|
-
import type { TUI } from '@earendil-works/pi-tui';
|
|
39
|
-
import { type ModelProfile, type ModelProfilesDoc } from './model-profiles.ts';
|
|
40
|
-
import { type TuiTheme } from './theme/index.ts';
|
|
41
|
-
/** Live-session handles the profile flows need (bridged in from index.ts). */
|
|
42
|
-
export interface ProfileDeps {
|
|
43
|
-
getSelection(): ModelSelection | undefined;
|
|
44
|
-
setSelection(selection: ModelSelection): void;
|
|
45
|
-
}
|
|
46
|
-
/**
|
|
47
|
-
* Apply `profile` end to end, scoped to the current workspace tree:
|
|
48
|
-
* default model + think level through the live selection ref (a profile
|
|
49
|
-
* without a default model leaves the selection alone), the tree binding
|
|
50
|
-
* (`.dsh-profile` in `cwd` — new sessions here assemble from this profile)
|
|
51
|
-
* and the store's informational last-applied pointer. Agent model/thinking
|
|
52
|
-
* values are NOT written anywhere here: each agent's runtime values compose
|
|
53
|
-
* at spawn from the frontmatter baseline ⊕ this pinned profile's overrides
|
|
54
|
-
* (src/agent-runtime.ts), which is what makes a switch workspace-scoped.
|
|
55
|
-
* Resolves the command summary text — failures ride along as ⚠ parts
|
|
56
|
-
* instead of aborting the rest. Deliberately does NOT touch the global
|
|
57
|
-
* agent-default-model: that is /model's write, and crossing tree boundaries
|
|
58
|
-
* is exactly what a profile switch must not do.
|
|
59
|
-
*/
|
|
60
|
-
export declare function applyProfile(path: string, doc: ModelProfilesDoc, profile: ModelProfile, deps: ProfileDeps, cwd: string): Promise<string>;
|
|
61
|
-
/**
|
|
62
|
-
* Open the `/profile-switch` switcher. Resolves the apply summary when a
|
|
63
|
-
* profile was switched, or `undefined` when cancelled / nothing applied.
|
|
64
|
-
*
|
|
65
|
-
* Enter is a WORKSPACE-SCOPED switch: apply to the live session, and bind
|
|
66
|
-
* this directory tree via `.dsh-profile` (see src/model-profiles.ts) so
|
|
67
|
-
* every NEW session here auto-loads it — agent model/think values are not
|
|
68
|
-
* written anywhere; each agent composes its runtime values at spawn from
|
|
69
|
-
* the frontmatter baseline ⊕ this pinned profile (src/agent-runtime.ts).
|
|
70
|
-
* Other trees are untouched. A
|
|
71
|
-
* hand-decorated pin file refuses the binding and says so in the summary.
|
|
72
|
-
* `p` binds/unbinds the cwd manually — pressing it on the already-bound
|
|
73
|
-
* profile unpins — unless the pin lives in an ancestor or was
|
|
74
|
-
* hand-decorated, which is reported in the status line instead.
|
|
75
|
-
*/
|
|
76
|
-
export declare function openProfileSwitcher(tui: TUI, theme: TuiTheme, deps: ProfileDeps, restoreFocus: () => void): Promise<string | undefined>;
|
|
77
|
-
/**
|
|
78
|
-
* Open the `/profile-cfg` manager. Resolves a summary when anything changed,
|
|
79
|
-
* or `undefined` when the manager closed untouched. `preselect` jumps
|
|
80
|
-
* straight into one profile's fields window.
|
|
81
|
-
*/
|
|
82
|
-
export declare function openProfileManager(ctx: Context, tui: TUI, theme: TuiTheme, deps: ProfileDeps, restoreFocus: () => void, preselect?: string): Promise<string | undefined>;
|
package/lib/profile.js
DELETED
|
@@ -1,665 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* `/profile-switch` + `/profile-cfg` — user model profiles: named snapshots
|
|
3
|
-
* of the whole model configuration (default model + think level, every
|
|
4
|
-
* subagent's model/thinking) that switch in one step between contexts like
|
|
5
|
-
* work and personal.
|
|
6
|
-
*
|
|
7
|
-
* Layers, all on the select-panel framework (src/panels.ts):
|
|
8
|
-
*
|
|
9
|
-
* 1. `/profile-switch` switcher (TablePanel) — one row per profile (name |
|
|
10
|
-
* default model | think | agents). Enter applies the profile to the
|
|
11
|
-
* live selection AND the agent markdown files, and BINDS this directory
|
|
12
|
-
* tree (.dsh-profile) so new sessions here start on it — switching is
|
|
13
|
-
* workspace-scoped: other trees keep their own binding, or the global
|
|
14
|
-
* default. Esc backs out; p pins/unpins manually.
|
|
15
|
-
* 2. `/profile-cfg` manager (TablePanel) — the roster: n new, d delete
|
|
16
|
-
* (double-press confirm), Enter opens the profile's fields.
|
|
17
|
-
* 3. profile fields (FieldPanel) — model / think / agents rows plus the
|
|
18
|
-
* s save-current, r rename, v review shortcuts.
|
|
19
|
-
* 4. agents sub-table (TablePanel) — every discovered agent's recorded
|
|
20
|
-
* model/thinking; Enter picks through the SAME favorites/hidden model
|
|
21
|
-
* table /model uses (pickModel with the shared PanelHost), i sets
|
|
22
|
-
* explicit inherit, t edits think alone.
|
|
23
|
-
*
|
|
24
|
-
* Every edit persists to `$DSH_HOME/model-profiles.json` immediately
|
|
25
|
-
* (src/model-profiles.ts). Applying a profile sets the live default model,
|
|
26
|
-
* binds the workspace tree via `.dsh-profile` (src/model-profiles.ts) and
|
|
27
|
-
* records the last-applied pointer — it writes NO agent files: each agent's
|
|
28
|
-
* runtime model/thinking is composed at spawn from the frontmatter baseline
|
|
29
|
-
* ⊕ this pinned profile's per-agent overrides (src/agent-runtime.ts, the
|
|
30
|
-
* registry's profile-aware composer), so a switch is fully workspace-scoped.
|
|
31
|
-
* The live default model rides the bridge selection. The GLOBAL
|
|
32
|
-
* agent-default-model is written only by /model, never by a profile switch.
|
|
33
|
-
* The ● "current" marker is the tree's own binding (boundProfileName), not a
|
|
34
|
-
* machine-wide pointer.
|
|
35
|
-
*/
|
|
36
|
-
import { agentsDir, listAgentFiles, } from "./agent-manager.js";
|
|
37
|
-
import { bindWorkspaceProfile, boundProfileName, captureAgentsSnapshot, createProfile, deleteProfile, findProfile, formatProfileRoute, loadModelProfiles, modelProfilesPath, profileReviewLines, readNearestProfilePin, removeProfilePin, renameProfile, saveModelProfiles, writeProfilePin, PROFILE_PIN_FILE, } from "./model-profiles.js";
|
|
38
|
-
import { join } from 'node:path';
|
|
39
|
-
import { openEffortPicker, pickModel } from "./selectors.js";
|
|
40
|
-
import { EditField } from "./settings.js";
|
|
41
|
-
import { autoColumns, FieldPanel, PanelHost, TablePanel, ViewerPanel, } from "./panels.js";
|
|
42
|
-
import { ansiFg, BOLD, RESET } from "./theme/index.js";
|
|
43
|
-
import { clipToWidth } from "./text.js";
|
|
44
|
-
/** How long a `d` delete arm stays confirmable (double-press window). */
|
|
45
|
-
const DELETE_CONFIRM_MS = 2500;
|
|
46
|
-
/** The profile table columns: NAME/MODEL/THINK fit (capped), AGENTS right-aligned tail. */
|
|
47
|
-
function profileColumns(profiles, current) {
|
|
48
|
-
return autoColumns([
|
|
49
|
-
{ key: 'name', title: 'Profile', cap: 18 },
|
|
50
|
-
{ key: 'model', title: 'Default model', cap: 36 },
|
|
51
|
-
{ key: 'think', title: 'Think', cap: 10 },
|
|
52
|
-
{ key: 'agents', title: 'Agents', align: 'right' },
|
|
53
|
-
], profiles, (profile, key) => profileCell(profile, key, current));
|
|
54
|
-
}
|
|
55
|
-
/** Cell text for one profile table row; the current profile gets the ● mark. */
|
|
56
|
-
function profileCell(profile, key, current) {
|
|
57
|
-
switch (key) {
|
|
58
|
-
case 'name': return current === profile.name ? `● ${profile.name}` : profile.name;
|
|
59
|
-
case 'model': return profile.defaultModel === undefined
|
|
60
|
-
? '(not set)'
|
|
61
|
-
: `${profile.defaultModel.provider}/${profile.defaultModel.model}`;
|
|
62
|
-
case 'think': return profile.defaultModel?.reasoningEffort ?? 'default';
|
|
63
|
-
default: return String(Object.keys(profile.agents).length);
|
|
64
|
-
}
|
|
65
|
-
}
|
|
66
|
-
/** A profile's default route as a ModelSelection (the /model handler shape). */
|
|
67
|
-
function routeToSelection(route) {
|
|
68
|
-
return {
|
|
69
|
-
provider: route.provider,
|
|
70
|
-
model: route.model,
|
|
71
|
-
...(route.reasoningEffort !== undefined
|
|
72
|
-
? { reasoningEffort: route.reasoningEffort }
|
|
73
|
-
: {}),
|
|
74
|
-
};
|
|
75
|
-
}
|
|
76
|
-
/** Record what a live selection says into a plain storable route. */
|
|
77
|
-
function selectionToRoute(selection) {
|
|
78
|
-
return selection.reasoningEffort === undefined
|
|
79
|
-
? { provider: selection.provider, model: selection.model }
|
|
80
|
-
: {
|
|
81
|
-
provider: selection.provider,
|
|
82
|
-
model: selection.model,
|
|
83
|
-
reasoningEffort: selection.reasoningEffort,
|
|
84
|
-
};
|
|
85
|
-
}
|
|
86
|
-
/**
|
|
87
|
-
* Apply `profile` end to end, scoped to the current workspace tree:
|
|
88
|
-
* default model + think level through the live selection ref (a profile
|
|
89
|
-
* without a default model leaves the selection alone), the tree binding
|
|
90
|
-
* (`.dsh-profile` in `cwd` — new sessions here assemble from this profile)
|
|
91
|
-
* and the store's informational last-applied pointer. Agent model/thinking
|
|
92
|
-
* values are NOT written anywhere here: each agent's runtime values compose
|
|
93
|
-
* at spawn from the frontmatter baseline ⊕ this pinned profile's overrides
|
|
94
|
-
* (src/agent-runtime.ts), which is what makes a switch workspace-scoped.
|
|
95
|
-
* Resolves the command summary text — failures ride along as ⚠ parts
|
|
96
|
-
* instead of aborting the rest. Deliberately does NOT touch the global
|
|
97
|
-
* agent-default-model: that is /model's write, and crossing tree boundaries
|
|
98
|
-
* is exactly what a profile switch must not do.
|
|
99
|
-
*/
|
|
100
|
-
export async function applyProfile(path, doc, profile, deps, cwd) {
|
|
101
|
-
const parts = [];
|
|
102
|
-
if (profile.defaultModel !== undefined) {
|
|
103
|
-
deps.setSelection(routeToSelection(profile.defaultModel));
|
|
104
|
-
}
|
|
105
|
-
// Bind the tree BEFORE reporting: an ancestor pin would otherwise keep
|
|
106
|
-
// winning at assembly while the summary claims the switch took. A
|
|
107
|
-
// hand-decorated pin file is refused by bindWorkspaceProfile — surfaced,
|
|
108
|
-
// never clobbered.
|
|
109
|
-
const ancestor = readNearestProfilePin(cwd);
|
|
110
|
-
const pinError = bindWorkspaceProfile(cwd, profile.name);
|
|
111
|
-
if (pinError !== undefined) {
|
|
112
|
-
parts.push(`⚠ ${pinError}`);
|
|
113
|
-
}
|
|
114
|
-
else if (ancestor !== undefined
|
|
115
|
-
&& ancestor.path !== join(cwd, PROFILE_PIN_FILE)
|
|
116
|
-
&& ancestor.name.toLowerCase() !== profile.name.toLowerCase()) {
|
|
117
|
-
parts.push(`overrides ancestor pin "${ancestor.name}"`);
|
|
118
|
-
}
|
|
119
|
-
doc.current = profile.name;
|
|
120
|
-
const saveError = saveModelProfiles(path, doc);
|
|
121
|
-
if (saveError !== undefined)
|
|
122
|
-
parts.push(`⚠ profile not saved: ${saveError}`);
|
|
123
|
-
const modelText = profile.defaultModel !== undefined
|
|
124
|
-
? formatProfileRoute(profile.defaultModel)
|
|
125
|
-
: 'model unchanged';
|
|
126
|
-
const pinText = pinError === undefined ? `pinned this tree (${PROFILE_PIN_FILE})` : '';
|
|
127
|
-
return [
|
|
128
|
-
`Profile → ${profile.name} · ${modelText} · agent values compose per-workspace at spawn`,
|
|
129
|
-
pinText,
|
|
130
|
-
...parts,
|
|
131
|
-
]
|
|
132
|
-
.filter(part => part !== '')
|
|
133
|
-
.join(' · ');
|
|
134
|
-
}
|
|
135
|
-
/**
|
|
136
|
-
* Open the `/profile-switch` switcher. Resolves the apply summary when a
|
|
137
|
-
* profile was switched, or `undefined` when cancelled / nothing applied.
|
|
138
|
-
*
|
|
139
|
-
* Enter is a WORKSPACE-SCOPED switch: apply to the live session, and bind
|
|
140
|
-
* this directory tree via `.dsh-profile` (see src/model-profiles.ts) so
|
|
141
|
-
* every NEW session here auto-loads it — agent model/think values are not
|
|
142
|
-
* written anywhere; each agent composes its runtime values at spawn from
|
|
143
|
-
* the frontmatter baseline ⊕ this pinned profile (src/agent-runtime.ts).
|
|
144
|
-
* Other trees are untouched. A
|
|
145
|
-
* hand-decorated pin file refuses the binding and says so in the summary.
|
|
146
|
-
* `p` binds/unbinds the cwd manually — pressing it on the already-bound
|
|
147
|
-
* profile unpins — unless the pin lives in an ancestor or was
|
|
148
|
-
* hand-decorated, which is reported in the status line instead.
|
|
149
|
-
*/
|
|
150
|
-
export async function openProfileSwitcher(tui, theme, deps, restoreFocus) {
|
|
151
|
-
const path = modelProfilesPath();
|
|
152
|
-
const doc = loadModelProfiles(path);
|
|
153
|
-
const cwd = process.cwd();
|
|
154
|
-
// The ● current marker is THIS tree's binding, not a machine-wide pointer.
|
|
155
|
-
const currentName = boundProfileName(doc, cwd);
|
|
156
|
-
let settle;
|
|
157
|
-
const host = new PanelHost(tui, theme, message => {
|
|
158
|
-
restoreFocus();
|
|
159
|
-
settle?.(`✘ failed to open the profile switcher: ${message}`);
|
|
160
|
-
});
|
|
161
|
-
return new Promise(resolve => {
|
|
162
|
-
settle = resolve;
|
|
163
|
-
// Enter can fire again while the async apply runs — resolve-once guard,
|
|
164
|
-
// the same settle discipline the pickers use.
|
|
165
|
-
let applying = false;
|
|
166
|
-
// Session-local status flash for the p-toggle outcome.
|
|
167
|
-
let pinStatus;
|
|
168
|
-
/** The nearest `.dsh-profile` binding for the cwd, resolved per render. */
|
|
169
|
-
const boundPin = () => readNearestProfilePin(cwd);
|
|
170
|
-
/**
|
|
171
|
-
* Show the table once through the host (a p-toggle swaps the whole panel:
|
|
172
|
-
* simplest way to refresh the `(dir)` markers, and PanelHost's
|
|
173
|
-
* show-new-then-hide-old keeps focus stable).
|
|
174
|
-
*/
|
|
175
|
-
const showTable = () => {
|
|
176
|
-
const pinnedName = boundPin()?.name;
|
|
177
|
-
const table = new TablePanel(theme, {
|
|
178
|
-
title: `● Model profiles · ${PROFILE_PIN_FILE} here: ${pinnedName ?? 'none'}`,
|
|
179
|
-
columns: profileColumns(doc.profiles, currentName),
|
|
180
|
-
rows: doc.profiles,
|
|
181
|
-
renderCell: (profile, column) => profileCell(profile, column.key, currentName),
|
|
182
|
-
preselect: Math.max(0, doc.profiles.findIndex(profile => profile.name === currentName)),
|
|
183
|
-
status: () => pinStatus,
|
|
184
|
-
onSelect: profile => { void switchTo(profile); },
|
|
185
|
-
onCancel: () => { host.close(); restoreFocus(); resolve(undefined); },
|
|
186
|
-
footer: '↑↓ navigate · Enter switch (binds this dir) · p pin/unpin · Esc back',
|
|
187
|
-
shortcuts: { p: () => togglePin(table) },
|
|
188
|
-
});
|
|
189
|
-
host.open(table);
|
|
190
|
-
};
|
|
191
|
-
/** Bind/unbind the cwd to the cursor profile; re-show to refresh markers. */
|
|
192
|
-
const togglePin = (table) => {
|
|
193
|
-
const profile = table.selectedRow();
|
|
194
|
-
if (profile === undefined)
|
|
195
|
-
return;
|
|
196
|
-
const existing = boundPin();
|
|
197
|
-
if (existing !== undefined
|
|
198
|
-
&& existing.name.toLowerCase() === profile.name.toLowerCase()
|
|
199
|
-
&& existing.path === join(cwd, PROFILE_PIN_FILE)) {
|
|
200
|
-
const error = removeProfilePin(cwd, profile.name);
|
|
201
|
-
pinStatus = error === undefined ? `unpinned ${cwd}` : `✘ ${error}`;
|
|
202
|
-
}
|
|
203
|
-
else {
|
|
204
|
-
const error = writeProfilePin(cwd, profile.name);
|
|
205
|
-
if (error !== undefined)
|
|
206
|
-
pinStatus = `✘ ${error}`;
|
|
207
|
-
else {
|
|
208
|
-
const inheritedNote = existing !== undefined && existing.path !== join(cwd, PROFILE_PIN_FILE)
|
|
209
|
-
? ` (overrides ancestor pin "${existing.name}")`
|
|
210
|
-
: '';
|
|
211
|
-
pinStatus = `pinned "${profile.name}" → .dsh-profile${inheritedNote}`;
|
|
212
|
-
}
|
|
213
|
-
}
|
|
214
|
-
showTable();
|
|
215
|
-
};
|
|
216
|
-
// First mount; a mount failure has already settled through the host's
|
|
217
|
-
// error path (this promise resolves there, everything below is no-op).
|
|
218
|
-
showTable();
|
|
219
|
-
const switchTo = async (profile) => {
|
|
220
|
-
if (applying)
|
|
221
|
-
return;
|
|
222
|
-
applying = true;
|
|
223
|
-
// The summary carries the whole outcome — binding result, ancestor
|
|
224
|
-
// overrides, refusals — as its tail parts.
|
|
225
|
-
const summary = await applyProfile(path, doc, profile, deps, cwd);
|
|
226
|
-
host.close();
|
|
227
|
-
restoreFocus();
|
|
228
|
-
resolve(summary);
|
|
229
|
-
};
|
|
230
|
-
});
|
|
231
|
-
}
|
|
232
|
-
/**
|
|
233
|
-
* Open the `/profile-cfg` manager. Resolves a summary when anything changed,
|
|
234
|
-
* or `undefined` when the manager closed untouched. `preselect` jumps
|
|
235
|
-
* straight into one profile's fields window.
|
|
236
|
-
*/
|
|
237
|
-
export async function openProfileManager(ctx, tui, theme, deps, restoreFocus, preselect) {
|
|
238
|
-
const path = modelProfilesPath();
|
|
239
|
-
const doc = loadModelProfiles(path);
|
|
240
|
-
// The ● current marker is THIS tree's binding, not a machine-wide pointer.
|
|
241
|
-
const currentName = boundProfileName(doc, process.cwd());
|
|
242
|
-
const changed = [];
|
|
243
|
-
let tableStatus;
|
|
244
|
-
let fieldsStatus;
|
|
245
|
-
let agentsStatus;
|
|
246
|
-
/** Armed double-press delete: profile name + when it was armed. */
|
|
247
|
-
let pendingDelete;
|
|
248
|
-
let pendingDeleteAt = 0;
|
|
249
|
-
let pendingPreselect = preselect;
|
|
250
|
-
let fieldsHandle;
|
|
251
|
-
let agentsHandle;
|
|
252
|
-
let agentsCursor;
|
|
253
|
-
/** Settles the manager promise (assigned inside the executor below). */
|
|
254
|
-
let settle;
|
|
255
|
-
const host = new PanelHost(tui, theme, message => {
|
|
256
|
-
restoreFocus();
|
|
257
|
-
settle?.(`✘ failed to open the profiles manager: ${message}`);
|
|
258
|
-
});
|
|
259
|
-
/** Persist the working doc; resolves a ✘ status line on failure. */
|
|
260
|
-
const persistDoc = () => {
|
|
261
|
-
const error = saveModelProfiles(path, doc);
|
|
262
|
-
return error === undefined ? undefined : `✘ could not save profiles: ${error}`;
|
|
263
|
-
};
|
|
264
|
-
/** Mark one profile as touched for the closing summary (first touch wins). */
|
|
265
|
-
const markChanged = (name) => {
|
|
266
|
-
if (!changed.includes(name))
|
|
267
|
-
changed.push(name);
|
|
268
|
-
};
|
|
269
|
-
return new Promise(resolve => {
|
|
270
|
-
settle = resolve;
|
|
271
|
-
const showTable = () => {
|
|
272
|
-
const preselectIndex = pendingPreselect === undefined
|
|
273
|
-
? undefined
|
|
274
|
-
: doc.profiles.findIndex(profile => profile.name === pendingPreselect);
|
|
275
|
-
pendingPreselect = undefined;
|
|
276
|
-
const table = new TablePanel(theme, {
|
|
277
|
-
title: '● Model profiles — configure',
|
|
278
|
-
columns: profileColumns(doc.profiles, currentName),
|
|
279
|
-
rows: doc.profiles,
|
|
280
|
-
renderCell: (profile, column) => profileCell(profile, column.key, currentName),
|
|
281
|
-
preselect: preselectIndex !== undefined && preselectIndex >= 0 ? preselectIndex : undefined,
|
|
282
|
-
status: () => tableStatus,
|
|
283
|
-
footer: '↑↓ navigate · Enter open · n new · d delete · Esc back',
|
|
284
|
-
onSelect: profile => showFields(profile),
|
|
285
|
-
onCancel: closeManager,
|
|
286
|
-
shortcuts: {
|
|
287
|
-
n: showNew,
|
|
288
|
-
d: () => {
|
|
289
|
-
const profile = table.selectedRow();
|
|
290
|
-
if (profile === undefined)
|
|
291
|
-
return;
|
|
292
|
-
// Double-press confirm, time-boxed: the armed state must NOT
|
|
293
|
-
// rebuild the table (a rebuild resets the cursor to row 0, so
|
|
294
|
-
// the confirming press would target a different profile), and
|
|
295
|
-
// the window expires so a stale arm can never fire one press
|
|
296
|
-
// after the user navigated away and back.
|
|
297
|
-
const armed = pendingDelete === profile.name
|
|
298
|
-
&& Date.now() - pendingDeleteAt < DELETE_CONFIRM_MS;
|
|
299
|
-
if (armed) {
|
|
300
|
-
pendingDelete = undefined;
|
|
301
|
-
const error = deleteProfile(doc, profile.name);
|
|
302
|
-
if (error !== undefined)
|
|
303
|
-
tableStatus = `✘ ${error}`;
|
|
304
|
-
else {
|
|
305
|
-
tableStatus = persistDoc() ?? `deleted profile "${profile.name}"`;
|
|
306
|
-
markChanged(`-${profile.name}`);
|
|
307
|
-
}
|
|
308
|
-
showTable();
|
|
309
|
-
}
|
|
310
|
-
else {
|
|
311
|
-
pendingDelete = profile.name;
|
|
312
|
-
pendingDeleteAt = Date.now();
|
|
313
|
-
tableStatus = `press d again to delete "${profile.name}"`;
|
|
314
|
-
tui.requestRender();
|
|
315
|
-
}
|
|
316
|
-
},
|
|
317
|
-
},
|
|
318
|
-
});
|
|
319
|
-
host.open(table);
|
|
320
|
-
};
|
|
321
|
-
const closeManager = () => {
|
|
322
|
-
host.close();
|
|
323
|
-
restoreFocus();
|
|
324
|
-
resolve(changed.length > 0 ? `Profiles updated: ${changed.join(', ')}` : undefined);
|
|
325
|
-
};
|
|
326
|
-
const showFields = (profile) => {
|
|
327
|
-
const content = [
|
|
328
|
-
`named model snapshot — /profile-switch applies it live and binds this directory tree · agent overrides compose per-workspace at spawn (frontmatter baseline ⊕ this profile — no global write)`,
|
|
329
|
-
];
|
|
330
|
-
const agentsSet = Object.keys(profile.agents).length;
|
|
331
|
-
const fields = [
|
|
332
|
-
{
|
|
333
|
-
key: 'model',
|
|
334
|
-
value: profile.defaultModel === undefined
|
|
335
|
-
? '(not set — switching keeps the current model)'
|
|
336
|
-
: formatProfileRoute(profile.defaultModel),
|
|
337
|
-
editable: true,
|
|
338
|
-
},
|
|
339
|
-
{
|
|
340
|
-
key: 'think',
|
|
341
|
-
value: profile.defaultModel?.reasoningEffort ?? '(provider default)',
|
|
342
|
-
editable: true,
|
|
343
|
-
},
|
|
344
|
-
{ key: 'agents', value: `${String(agentsSet)} agent override(s) recorded`, editable: true },
|
|
345
|
-
];
|
|
346
|
-
const view = new FieldPanel(theme, {
|
|
347
|
-
title: profileTitle(theme, profile, currentName),
|
|
348
|
-
content,
|
|
349
|
-
fields,
|
|
350
|
-
status: () => fieldsStatus,
|
|
351
|
-
footer: '↑↓ field · Enter edit (m model · t think · a agents) · s save current · r rename · v review · Esc back',
|
|
352
|
-
shortcuts: {
|
|
353
|
-
m: () => void changeModel(profile),
|
|
354
|
-
t: () => void changeThink(profile),
|
|
355
|
-
a: () => showAgentsTable(profile),
|
|
356
|
-
s: () => saveFromCurrent(profile),
|
|
357
|
-
r: () => showRename(profile),
|
|
358
|
-
v: () => showReview(profile),
|
|
359
|
-
},
|
|
360
|
-
onEdit: index => {
|
|
361
|
-
if (index === 0)
|
|
362
|
-
void changeModel(profile);
|
|
363
|
-
else if (index === 1)
|
|
364
|
-
void changeThink(profile);
|
|
365
|
-
else
|
|
366
|
-
showAgentsTable(profile);
|
|
367
|
-
},
|
|
368
|
-
onCancel: () => showTable(),
|
|
369
|
-
});
|
|
370
|
-
fieldsHandle = host.open(view);
|
|
371
|
-
};
|
|
372
|
-
/** Commit path shared by model/think/agent edits: flash and re-show. */
|
|
373
|
-
const writeFields = (profile, status, message) => {
|
|
374
|
-
if (status !== undefined)
|
|
375
|
-
fieldsStatus = status;
|
|
376
|
-
else {
|
|
377
|
-
markChanged(profile.name);
|
|
378
|
-
fieldsStatus = message;
|
|
379
|
-
}
|
|
380
|
-
showFields(profile);
|
|
381
|
-
};
|
|
382
|
-
const changeModel = async (profile) => {
|
|
383
|
-
const current = profile.defaultModel === undefined ? undefined : routeToSelection(profile.defaultModel);
|
|
384
|
-
const picked = await pickModel(ctx, tui, theme, current, () => { }, host);
|
|
385
|
-
if (picked === undefined) {
|
|
386
|
-
showFields(profile);
|
|
387
|
-
return;
|
|
388
|
-
}
|
|
389
|
-
profile.defaultModel = selectionToRoute(picked);
|
|
390
|
-
const status = persistDoc();
|
|
391
|
-
writeFields(profile, status, `saved ${profile.name} default model → ${formatProfileRoute(profile.defaultModel)}`);
|
|
392
|
-
};
|
|
393
|
-
const changeThink = async (profile) => {
|
|
394
|
-
if (profile.defaultModel === undefined) {
|
|
395
|
-
fieldsStatus = '✘ no default model set — pick a model first (m)';
|
|
396
|
-
showFields(profile);
|
|
397
|
-
return;
|
|
398
|
-
}
|
|
399
|
-
const llm = ctx.get('llm');
|
|
400
|
-
if (llm === undefined) {
|
|
401
|
-
fieldsStatus = '✘ llm service unavailable';
|
|
402
|
-
showFields(profile);
|
|
403
|
-
return;
|
|
404
|
-
}
|
|
405
|
-
const { provider, model } = profile.defaultModel;
|
|
406
|
-
let efforts;
|
|
407
|
-
try {
|
|
408
|
-
efforts = (await llm.resolveModelInfo(provider, model)).reasoning?.efforts;
|
|
409
|
-
}
|
|
410
|
-
catch {
|
|
411
|
-
efforts = undefined;
|
|
412
|
-
}
|
|
413
|
-
if (efforts === undefined || efforts.length === 0) {
|
|
414
|
-
fieldsStatus = `✘ ${provider}/${model} exposes no think levels`;
|
|
415
|
-
showFields(profile);
|
|
416
|
-
return;
|
|
417
|
-
}
|
|
418
|
-
const currentEffort = profile.defaultModel.reasoningEffort;
|
|
419
|
-
const chosen = await openEffortPicker(tui, theme, efforts, currentEffort, () => { }, () => fieldsHandle?.hide());
|
|
420
|
-
if (chosen === undefined) {
|
|
421
|
-
showFields(profile);
|
|
422
|
-
return;
|
|
423
|
-
}
|
|
424
|
-
profile.defaultModel.reasoningEffort = chosen.effort === 'default' ? undefined : chosen.effort;
|
|
425
|
-
const status = persistDoc();
|
|
426
|
-
const thinkText = profile.defaultModel.reasoningEffort === undefined
|
|
427
|
-
? 'provider default'
|
|
428
|
-
: `think ${String(profile.defaultModel.reasoningEffort)}`;
|
|
429
|
-
writeFields(profile, status, `saved ${profile.name} think → ${thinkText}`);
|
|
430
|
-
};
|
|
431
|
-
const saveFromCurrent = (profile) => {
|
|
432
|
-
const selection = deps.getSelection();
|
|
433
|
-
if (selection !== undefined)
|
|
434
|
-
profile.defaultModel = selectionToRoute(selection);
|
|
435
|
-
const { agents } = listAgentFiles(agentsDir());
|
|
436
|
-
profile.agents = captureAgentsSnapshot(agents);
|
|
437
|
-
const status = persistDoc();
|
|
438
|
-
const message = selection === undefined
|
|
439
|
-
? `saved ${String(agents.length)} agent(s) into "${profile.name}" · no live model selection — default model kept`
|
|
440
|
-
: `saved current configuration into "${profile.name}" (model + ${String(agents.length)} agent(s))`;
|
|
441
|
-
writeFields(profile, status, message);
|
|
442
|
-
};
|
|
443
|
-
const showAgentsTable = (profile) => {
|
|
444
|
-
const { agents } = listAgentFiles(agentsDir());
|
|
445
|
-
const rows = agents.map(agent => ({ agent, entry: profile.agents[agent.meta.name] }));
|
|
446
|
-
const cell = (row, key) => {
|
|
447
|
-
switch (key) {
|
|
448
|
-
case 'name': return row.agent.meta.displayName ?? row.agent.meta.name;
|
|
449
|
-
case 'model': return row.entry?.model ?? (row.entry === undefined ? '(not saved)' : '(inherit)');
|
|
450
|
-
default: return row.entry?.thinking ?? 'inherit';
|
|
451
|
-
}
|
|
452
|
-
};
|
|
453
|
-
const table = new TablePanel(theme, {
|
|
454
|
-
title: `● Agents — ${profile.name}`,
|
|
455
|
-
columns: autoColumns([
|
|
456
|
-
{ key: 'name', title: 'Agent', cap: 16 },
|
|
457
|
-
{ key: 'model', title: 'Model', cap: 36 },
|
|
458
|
-
{ key: 'thinking', title: 'Think', cap: 10 },
|
|
459
|
-
], rows, cell),
|
|
460
|
-
rows,
|
|
461
|
-
renderCell: (row, column) => cell(row, column.key),
|
|
462
|
-
preselect: Math.max(0, rows.findIndex(row => row.agent.meta.name === agentsCursor)),
|
|
463
|
-
status: () => agentsStatus,
|
|
464
|
-
footer: '↑↓ navigate · Enter pick model (i inherit · t think) · Esc back',
|
|
465
|
-
onSelect: row => {
|
|
466
|
-
agentsCursor = row.agent.meta.name;
|
|
467
|
-
void pickAgentModel(profile, row);
|
|
468
|
-
},
|
|
469
|
-
onCancel: () => showFields(profile),
|
|
470
|
-
shortcuts: {
|
|
471
|
-
i: () => {
|
|
472
|
-
const row = table.selectedRow();
|
|
473
|
-
if (row === undefined)
|
|
474
|
-
return;
|
|
475
|
-
profile.agents[row.agent.meta.name] = {};
|
|
476
|
-
const status = persistDoc();
|
|
477
|
-
agentsStatus = status ?? `saved ${row.agent.meta.name} → inherit`;
|
|
478
|
-
if (status === undefined)
|
|
479
|
-
markChanged(profile.name);
|
|
480
|
-
showAgentsTable(profile);
|
|
481
|
-
},
|
|
482
|
-
t: () => {
|
|
483
|
-
const row = table.selectedRow();
|
|
484
|
-
if (row === undefined)
|
|
485
|
-
return;
|
|
486
|
-
void changeAgentThinking(profile, row);
|
|
487
|
-
},
|
|
488
|
-
},
|
|
489
|
-
});
|
|
490
|
-
agentsHandle = host.open(table);
|
|
491
|
-
};
|
|
492
|
-
/** Pick one agent's model + think through the full /model picker. */
|
|
493
|
-
const pickAgentModel = async (profile, row) => {
|
|
494
|
-
const current = row.entry?.model === undefined
|
|
495
|
-
? undefined
|
|
496
|
-
: selectionFromRoute(row.entry.model, row.entry.thinking);
|
|
497
|
-
const picked = await pickModel(ctx, tui, theme, current, () => { }, host);
|
|
498
|
-
if (picked === undefined) {
|
|
499
|
-
showAgentsTable(profile);
|
|
500
|
-
return;
|
|
501
|
-
}
|
|
502
|
-
profile.agents[row.agent.meta.name] = picked.reasoningEffort === undefined
|
|
503
|
-
? { model: `${picked.provider}/${picked.model}` }
|
|
504
|
-
: { model: `${picked.provider}/${picked.model}`, thinking: picked.reasoningEffort };
|
|
505
|
-
const status = persistDoc();
|
|
506
|
-
const entry = profile.agents[row.agent.meta.name];
|
|
507
|
-
const thinkText = entry.thinking === undefined ? '' : ` · think ${entry.thinking}`;
|
|
508
|
-
agentsStatus = status ?? `saved ${row.agent.meta.name} → ${entry.model ?? ''}${thinkText}`;
|
|
509
|
-
if (status === undefined)
|
|
510
|
-
markChanged(profile.name);
|
|
511
|
-
showAgentsTable(profile);
|
|
512
|
-
};
|
|
513
|
-
/** Edit one agent's think level alone (its recorded model must be set). */
|
|
514
|
-
const changeAgentThinking = async (profile, row) => {
|
|
515
|
-
const route = row.entry?.model;
|
|
516
|
-
if (route === undefined) {
|
|
517
|
-
agentsStatus = '✘ no model recorded — pick a model first (Enter)';
|
|
518
|
-
showAgentsTable(profile);
|
|
519
|
-
return;
|
|
520
|
-
}
|
|
521
|
-
const llm = ctx.get('llm');
|
|
522
|
-
if (llm === undefined) {
|
|
523
|
-
agentsStatus = '✘ llm service unavailable';
|
|
524
|
-
showAgentsTable(profile);
|
|
525
|
-
return;
|
|
526
|
-
}
|
|
527
|
-
const slash = route.indexOf('/');
|
|
528
|
-
if (slash <= 0) {
|
|
529
|
-
agentsStatus = `✘ cannot resolve think levels for ${route}`;
|
|
530
|
-
showAgentsTable(profile);
|
|
531
|
-
return;
|
|
532
|
-
}
|
|
533
|
-
let efforts;
|
|
534
|
-
try {
|
|
535
|
-
efforts = (await llm.resolveModelInfo(route.slice(0, slash), route.slice(slash + 1))).reasoning?.efforts;
|
|
536
|
-
}
|
|
537
|
-
catch {
|
|
538
|
-
efforts = undefined;
|
|
539
|
-
}
|
|
540
|
-
if (efforts === undefined || efforts.length === 0) {
|
|
541
|
-
agentsStatus = `✘ ${route} exposes no think levels`;
|
|
542
|
-
showAgentsTable(profile);
|
|
543
|
-
return;
|
|
544
|
-
}
|
|
545
|
-
const entry = profile.agents[row.agent.meta.name] ?? {};
|
|
546
|
-
const currentEffort = entry.thinking;
|
|
547
|
-
const chosen = await openEffortPicker(tui, theme, efforts, currentEffort, () => { }, () => agentsHandle?.hide());
|
|
548
|
-
if (chosen === undefined) {
|
|
549
|
-
showAgentsTable(profile);
|
|
550
|
-
return;
|
|
551
|
-
}
|
|
552
|
-
const next = chosen.effort === 'default' ? undefined : chosen.effort;
|
|
553
|
-
if (next === undefined)
|
|
554
|
-
delete entry.thinking;
|
|
555
|
-
else
|
|
556
|
-
entry.thinking = next;
|
|
557
|
-
profile.agents[row.agent.meta.name] = entry;
|
|
558
|
-
const status = persistDoc();
|
|
559
|
-
agentsStatus = status ?? `saved ${row.agent.meta.name} → think ${next ?? 'inherit'}`;
|
|
560
|
-
if (status === undefined)
|
|
561
|
-
markChanged(profile.name);
|
|
562
|
-
showAgentsTable(profile);
|
|
563
|
-
};
|
|
564
|
-
const showRename = (profile) => {
|
|
565
|
-
let committed = false;
|
|
566
|
-
const field = new EditField(tui, {
|
|
567
|
-
title: `Rename profile — ${profile.name}`,
|
|
568
|
-
subtitle: 'letters, digits, dash, space · must stay unique',
|
|
569
|
-
initial: profile.name,
|
|
570
|
-
parse: text => parseProfileName(doc, profile.name, text),
|
|
571
|
-
onCommit: async (parsed) => {
|
|
572
|
-
if (parsed.kind !== 'value')
|
|
573
|
-
return undefined;
|
|
574
|
-
const name = parsed.value;
|
|
575
|
-
const error = renameProfile(doc, profile.name, name);
|
|
576
|
-
if (error !== undefined)
|
|
577
|
-
return { error };
|
|
578
|
-
committed = true;
|
|
579
|
-
pendingPreselect = name;
|
|
580
|
-
return undefined;
|
|
581
|
-
},
|
|
582
|
-
onDone: () => {
|
|
583
|
-
if (committed) {
|
|
584
|
-
const status = persistDoc();
|
|
585
|
-
tableStatus = status ?? `renamed → ${profile.name}`;
|
|
586
|
-
if (status === undefined)
|
|
587
|
-
markChanged(profile.name);
|
|
588
|
-
}
|
|
589
|
-
showTable();
|
|
590
|
-
},
|
|
591
|
-
onError: message => { tableStatus = `✘ ${message}`; },
|
|
592
|
-
}, theme);
|
|
593
|
-
host.open(field);
|
|
594
|
-
};
|
|
595
|
-
const showNew = () => {
|
|
596
|
-
let committed = false;
|
|
597
|
-
const field = new EditField(tui, {
|
|
598
|
-
title: 'New model profile',
|
|
599
|
-
subtitle: 'a name like "work" or "personal" · configured next',
|
|
600
|
-
initial: '',
|
|
601
|
-
parse: text => parseProfileName(doc, '', text),
|
|
602
|
-
onCommit: async (parsed) => {
|
|
603
|
-
if (parsed.kind !== 'value')
|
|
604
|
-
return undefined;
|
|
605
|
-
const { profile, error } = createProfile(doc, parsed.value);
|
|
606
|
-
if (error !== undefined || profile === undefined)
|
|
607
|
-
return { error: error ?? 'create failed' };
|
|
608
|
-
committed = true;
|
|
609
|
-
pendingPreselect = profile.name;
|
|
610
|
-
return undefined;
|
|
611
|
-
},
|
|
612
|
-
onDone: () => {
|
|
613
|
-
if (committed) {
|
|
614
|
-
const status = persistDoc();
|
|
615
|
-
tableStatus = status ?? `created profile "${pendingPreselect}"`;
|
|
616
|
-
if (status === undefined && pendingPreselect !== undefined)
|
|
617
|
-
markChanged(`+${pendingPreselect}`);
|
|
618
|
-
}
|
|
619
|
-
showTable();
|
|
620
|
-
},
|
|
621
|
-
onError: message => { tableStatus = `✘ ${message}`; },
|
|
622
|
-
}, theme);
|
|
623
|
-
host.open(field);
|
|
624
|
-
};
|
|
625
|
-
const showReview = (profile) => {
|
|
626
|
-
const { agents } = listAgentFiles(agentsDir());
|
|
627
|
-
host.open(new ViewerPanel(theme, {
|
|
628
|
-
title: `ⓘ Model profile — ${profile.name}`,
|
|
629
|
-
lines: profileReviewLines(profile, agents, currentName === profile.name),
|
|
630
|
-
footer: ' Esc to close',
|
|
631
|
-
onClose: () => showFields(profile),
|
|
632
|
-
}));
|
|
633
|
-
};
|
|
634
|
-
showTable();
|
|
635
|
-
});
|
|
636
|
-
}
|
|
637
|
-
/** The accent title line of the profile fields window (current profiles get the ● mark). */
|
|
638
|
-
function profileTitle(theme, profile, currentName) {
|
|
639
|
-
const mark = currentName === profile.name ? '● ' : '';
|
|
640
|
-
return ansiFg(theme.palette.accent) + BOLD + `${mark}${clipToWidth(profile.name, 100)}` + RESET;
|
|
641
|
-
}
|
|
642
|
-
/** Name-editor parse: trimmed non-empty, unique against the doc (case-insensitive). */
|
|
643
|
-
function parseProfileName(doc, currentName, text) {
|
|
644
|
-
const name = text.trim();
|
|
645
|
-
if (name === '')
|
|
646
|
-
return { kind: 'error', error: 'profile name must not be empty' };
|
|
647
|
-
if (name.length > 32)
|
|
648
|
-
return { kind: 'error', error: 'profile name must stay under 33 characters' };
|
|
649
|
-
if (name.toLowerCase() !== currentName.toLowerCase() && findProfile(doc, name) !== undefined) {
|
|
650
|
-
return { kind: 'error', error: `a profile named "${name}" already exists` };
|
|
651
|
-
}
|
|
652
|
-
return { kind: 'value', value: name };
|
|
653
|
-
}
|
|
654
|
-
/** An agent entry's `provider/model` route back into a picker preselection. */
|
|
655
|
-
function selectionFromRoute(route, thinking) {
|
|
656
|
-
const slash = route.indexOf('/');
|
|
657
|
-
if (slash <= 0)
|
|
658
|
-
return { provider: route, model: route };
|
|
659
|
-
return {
|
|
660
|
-
provider: route.slice(0, slash),
|
|
661
|
-
model: route.slice(slash + 1),
|
|
662
|
-
...(thinking !== undefined ? { reasoningEffort: thinking } : {}),
|
|
663
|
-
};
|
|
664
|
-
}
|
|
665
|
-
//# sourceMappingURL=profile.js.map
|
package/lib/profile.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"profile.js","sourceRoot":"","sources":["../src/profile.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkCG;AAMH,OAAO,EACL,SAAS,EACT,cAAc,GAEf,MAAM,oBAAoB,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CAAA;IACxD,OAAO;QACL,QAAQ,EAAE,KAAK,CAAC,KAAK,CAAC,CAAC,EAAE,KAAK,CAAC;QAC/B,KAAK,EAAE,KAAK,CAAC,KAAK,CAAC,KAAK,GAAG,CAAC,CAAC;QAC7B,GAAG,CAAC,QAAQ,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,eAAe,EAAE,QAA6B,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;KACtF,CAAA;AACH,CAAC"}
|
package/scripts/postinstall.mjs
DELETED
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
/**
|
|
3
|
-
* npm postinstall for `@aiwayds/dsh-tui-pi` — two jobs, in order:
|
|
4
|
-
*
|
|
5
|
-
* 1. The repo's dev linker (link-dsh-closure.mjs). It self-guards: on a
|
|
6
|
-
* published tarball (no src/) it exits 0 without touching anything, so
|
|
7
|
-
* this is a no-op for consumers and the dev-machine behavior is
|
|
8
|
-
* unchanged.
|
|
9
|
-
*
|
|
10
|
-
* 2. Global installs then run the one-time onboarding — dsh host, pnpm and
|
|
11
|
-
* the `tui` profile are in place by the time npm prints "added 1
|
|
12
|
-
* package", so the first `dsh-tui-pi` (or `dst`) boots straight into the
|
|
13
|
-
* TUI. Anything this cannot finish (offline machine, no npm on PATH, a
|
|
14
|
-
* package manager that skips lifecycle scripts) is deferred to the
|
|
15
|
-
* launcher's first run, which re-runs the same idempotent onboarding.
|
|
16
|
-
*
|
|
17
|
-
* Guards:
|
|
18
|
-
* - local/dev installs (`npm i` inside a project, `pnpm link`, CI
|
|
19
|
-
* checkouts) skip the onboarding silently — it is only meaningful for a
|
|
20
|
-
* user-wide install;
|
|
21
|
-
* - this script NEVER fails the install: every failure path exits 0.
|
|
22
|
-
*/
|
|
23
|
-
|
|
24
|
-
import { spawnSync } from 'node:child_process'
|
|
25
|
-
import { dirname, join } from 'node:path'
|
|
26
|
-
import { fileURLToPath } from 'node:url'
|
|
27
|
-
|
|
28
|
-
const scriptDir = dirname(fileURLToPath(import.meta.url))
|
|
29
|
-
|
|
30
|
-
// 1) dev closure linker — self-guarding, always safe to run
|
|
31
|
-
const linker = spawnSync(process.execPath, [join(scriptDir, 'link-dsh-closure.mjs')], {
|
|
32
|
-
stdio: 'inherit',
|
|
33
|
-
})
|
|
34
|
-
if (linker.error) {
|
|
35
|
-
console.warn(`[postinstall] closure linker skipped: ${linker.error.message}`)
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
// 2) onboarding — global installs only, never fails the install
|
|
39
|
-
if (process.env.npm_config_global !== 'true') process.exit(0)
|
|
40
|
-
|
|
41
|
-
console.log('dsh-tui-pi: preparing the dsh host, pnpm and the "tui" profile…')
|
|
42
|
-
try {
|
|
43
|
-
const { runOnboard } = await import('../bin/onboard-core.mjs')
|
|
44
|
-
const setup = runOnboard({ log: (line) => console.log(line) })
|
|
45
|
-
if (!setup.ok) {
|
|
46
|
-
console.log(`dsh-tui-pi: setup stopped at "${setup.step}" — ${setup.hint}`)
|
|
47
|
-
console.log('dsh-tui-pi: it will complete automatically on first launch.')
|
|
48
|
-
} else {
|
|
49
|
-
console.log('dsh-tui-pi: ready — launch with `dsh-tui-pi` (short: `dst`).')
|
|
50
|
-
}
|
|
51
|
-
} catch (error) {
|
|
52
|
-
console.log(`dsh-tui-pi: setup skipped (${error?.message ?? error}) — it will run on first launch.`)
|
|
53
|
-
}
|
|
54
|
-
process.exit(0)
|