@aiwayds/dsh-opentui 0.17.2 → 0.18.0
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 +27 -0
- package/README.md +61 -0
- package/bin/dsh-opentui.mjs +43 -2
- package/bin/lib/launcher.mjs +129 -1
- package/dist/client/index.js +162 -22
- package/dist/locales/en.json +4 -1
- package/dist/locales/zh-CN.json +4 -1
- package/package.json +1 -1
- package/scripts/lib/provision-plan.mjs +64 -7
- package/scripts/lib/upgrade-plan.mjs +406 -0
- package/scripts/provision-opentui-profile.mjs +43 -2
- package/scripts/upgrade.mjs +929 -0
package/CHANGELOG.md
CHANGED
|
@@ -5,6 +5,33 @@ 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.18.0] - 2026-11-16
|
|
9
|
+
|
|
10
|
+
### Added
|
|
11
|
+
|
|
12
|
+
- **`upgrade` subcommand.** `dsh-opentui upgrade` moves the launcher and the opentui profile's plugins to the latest npm version, with `--dry-run`, a confirmation prompt, backup/rollback on a failed install, and an `upgrade-overrides.json` that stops provisioning from restoring the shipped pins.
|
|
13
|
+
|
|
14
|
+
### Fixed
|
|
15
|
+
|
|
16
|
+
- **A profile upgrade survives the next start.** Provisioning now reads `upgrade-overrides.json` from the profile and treats the versions recorded there as the effective pins, so a plugin installed past its built-in pin is no longer replaced by it on the following boot. A missing file keeps the old behavior, and an unreadable one degrades to the shipped pins with a warning.
|
|
17
|
+
- **An undeterminable target version fails the run.** When the registry query cannot resolve a package, `upgrade` exits non-zero and writes nothing — no `node_modules` change, no lockfile, no override file, `--dry-run` included — instead of reporting success.
|
|
18
|
+
- **A dead registry is answered in one request.** The version query runs with `--fetch-retries 0 --fetch-timeout 20000`, so an unreachable host reports `query-failed` without npm's retry ladder.
|
|
19
|
+
|
|
20
|
+
### Internal
|
|
21
|
+
|
|
22
|
+
- **`11-upgrade` e2e scenario** against a local registry fixture (`e2e/fixtures/upgrade-registry`), covering the profile upgrade path from query through `upgrade-overrides.json` to the next provision.
|
|
23
|
+
|
|
24
|
+
## [0.17.3] - 2026-11-16
|
|
25
|
+
|
|
26
|
+
### Added
|
|
27
|
+
|
|
28
|
+
- **Splash lists installed plugins.** The welcome hero shows the loaded plugin set tui-pi style — a root row plus `name@version` lines in loader order, a `+k more` overflow row and a `plugins N` summary. The row cap tracks the live terminal size (8 lines on tall terminals, down to a single example row below 30 rows, re-computed on resize without a restart); the list refreshes live through the plugin-change push channel, and the overflow/summary copy is localized (en/zh).
|
|
29
|
+
|
|
30
|
+
### Fixed
|
|
31
|
+
|
|
32
|
+
- **The footer msgs segment no longer fakes a count.** While the journal count is unknown the segment hides instead of falling back to the send count (which read like a turn counter), and its label rides the i18n table so /language hot-switches it.
|
|
33
|
+
- **The 🧠 context segment keeps its full used/window(x.x%) form on narrow terminals.** A long preset label (e.g. `dsh(Standard + Append)`) now degrades first instead of crowding the context segment down to a bare token count.
|
|
34
|
+
|
|
8
35
|
## [0.17.2] - 2026-11-15
|
|
9
36
|
|
|
10
37
|
### Added
|
package/README.md
CHANGED
|
@@ -33,6 +33,67 @@ npm i -g @aiwayds/dsh-opentui
|
|
|
33
33
|
dsh-opentui
|
|
34
34
|
```
|
|
35
35
|
|
|
36
|
+
## Upgrading
|
|
37
|
+
|
|
38
|
+
`dsh-opentui upgrade` moves the installed launcher itself to the newest npm
|
|
39
|
+
release (or another dist-tag via `--tag`) and upgrades the registry plugins
|
|
40
|
+
already installed in the `opentui` profile to their latest versions. It does
|
|
41
|
+
**not** upgrade the dsh host: the host is a separate global install.
|
|
42
|
+
|
|
43
|
+
```bash
|
|
44
|
+
dsh-opentui upgrade --dry-run # print the plan table, write nothing
|
|
45
|
+
dsh-opentui upgrade # confirm, then apply
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
| Flag | Effect |
|
|
49
|
+
|---|---|
|
|
50
|
+
| `--dry-run` | Print the plan table and exit; nothing is installed or written. |
|
|
51
|
+
| `-y`, `--yes` | Skip the confirmation prompt. Required when stdin is not a TTY. |
|
|
52
|
+
| `--tag <name>` | Resolve a dist-tag other than `latest` (`next`, for example). |
|
|
53
|
+
| `--no-self` | Skip the launcher; upgrade profile plugins only. |
|
|
54
|
+
| `--no-plugins` | Skip profile plugins; upgrade the launcher only. |
|
|
55
|
+
| `--reset-overrides` | Delete `upgrade-overrides.json` and exit (terminal; cannot be combined with `--no-self` / `--no-plugins`). |
|
|
56
|
+
| `-h`, `--help` | Print usage and exit. |
|
|
57
|
+
|
|
58
|
+
| Exit code | Meaning |
|
|
59
|
+
|---|---|
|
|
60
|
+
| `0` | Completed, nothing to upgrade, or `--dry-run` / `--help`. |
|
|
61
|
+
| `1` | Hard failure, already rolled back; a target version that cannot be resolved writes nothing. |
|
|
62
|
+
| `2` | Usage error. |
|
|
63
|
+
| `3` | Partial: some packages did not reach the target version, or overrides could not be recorded. |
|
|
64
|
+
|
|
65
|
+
### Why upgrades stick (upgrade-overrides)
|
|
66
|
+
|
|
67
|
+
Provisioning runs on every launch and converges the profile to the shipped
|
|
68
|
+
pins, so a plain upgrade would be undone on the next start. After a successful
|
|
69
|
+
upgrade the command records the new versions in
|
|
70
|
+
`$DSH_HOME/profiles/opentui/upgrade-overrides.json`, and provisioning honors
|
|
71
|
+
each entry instead of the pin. An entry applies only while it is **strictly
|
|
72
|
+
newer** than the built-in pin, so a later release that raises the pin past it
|
|
73
|
+
invalidates the entry by itself.
|
|
74
|
+
|
|
75
|
+
`--reset-overrides` deletes that file and exits. The next launch provisions
|
|
76
|
+
from the shipped pins again, which can **downgrade** a package the override
|
|
77
|
+
was holding above them.
|
|
78
|
+
|
|
79
|
+
### Mirrors
|
|
80
|
+
|
|
81
|
+
Queries go to `DSH_UPGRADE_REGISTRY` when set, otherwise the profile
|
|
82
|
+
`.npmrc`, `~/.npmrc`, or the public npm registry, always with
|
|
83
|
+
`--prefer-online`. A mirror's `latest` can lag behind npmjs; the command
|
|
84
|
+
prints a note when it resolves through one.
|
|
85
|
+
|
|
86
|
+
```bash
|
|
87
|
+
DSH_UPGRADE_REGISTRY=https://registry.npmmirror.com dsh-opentui upgrade --dry-run
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
### After upgrading
|
|
91
|
+
|
|
92
|
+
Quit the TUI and run `dsh-opentui` again. The host is a long-running process
|
|
93
|
+
and keeps the plugin set it booted with, so a plugin upgrade never applies to
|
|
94
|
+
the current one. CI and scripted runs must pass `--yes` — without a TTY the
|
|
95
|
+
confirmation prompt is refused.
|
|
96
|
+
|
|
36
97
|
## Client mode
|
|
37
98
|
|
|
38
99
|
`dsh-opentui` starts a thin client TUI (`dist/client/index.js` under Bun) that
|
package/bin/dsh-opentui.mjs
CHANGED
|
@@ -51,8 +51,8 @@ import { spawnSync } from 'node:child_process'
|
|
|
51
51
|
import { existsSync, lstatSync, mkdirSync, readFileSync, realpathSync, renameSync, symlinkSync, unlinkSync, writeFileSync } from 'node:fs'
|
|
52
52
|
import { homedir } from 'node:os'
|
|
53
53
|
import { dirname, join } from 'node:path'
|
|
54
|
-
import { fileURLToPath } from 'node:url'
|
|
55
|
-
import { ancestorPids, killStaleProcesses, parseLauncherArgs, parseProcessHomes, parseProcessRows, readLauncherVersion, selectStaleProcesses } from './lib/launcher.mjs'
|
|
54
|
+
import { fileURLToPath, pathToFileURL } from 'node:url'
|
|
55
|
+
import { ancestorPids, formatUpgradeUsage, killStaleProcesses, parseLauncherArgs, parseProcessHomes, parseProcessRows, parseUpgradeArgs, readLauncherVersion, selectStaleProcesses } from './lib/launcher.mjs'
|
|
56
56
|
|
|
57
57
|
const pkgRoot = dirname(dirname(fileURLToPath(import.meta.url)))
|
|
58
58
|
const dshHome = process.env.DSH_HOME || join(homedir(), '.dsh')
|
|
@@ -82,6 +82,47 @@ if (versionFlag) {
|
|
|
82
82
|
process.exit(0)
|
|
83
83
|
}
|
|
84
84
|
|
|
85
|
+
// --- 0.5 upgrade subcommand -------------------------------------------------
|
|
86
|
+
// `upgrade` is a positional subcommand: only the first remaining argument may
|
|
87
|
+
// select it, and here is its ONLY consumer. It must never reach the provision
|
|
88
|
+
// forwarder (step 3) or the client (step 6) — the client would take the bare
|
|
89
|
+
// `upgrade` for a session name. Placed after `--version` (whose absolute
|
|
90
|
+
// short-circuit is unchanged) and BEFORE the bun/dsh checks: upgrading needs
|
|
91
|
+
// `npm` and `dsh`, not bun, and must not provision or link anything.
|
|
92
|
+
const upgradeResult = parseUpgradeArgs(userArgs)
|
|
93
|
+
if (upgradeResult.isUpgrade) {
|
|
94
|
+
if (forceFlag) {
|
|
95
|
+
console.error('dsh-opentui: --force is not supported with upgrade.')
|
|
96
|
+
console.error(formatUpgradeUsage())
|
|
97
|
+
process.exit(2)
|
|
98
|
+
}
|
|
99
|
+
if (upgradeResult.error === 'unknown-flag') {
|
|
100
|
+
console.error(`dsh-opentui: unknown flag(s): ${upgradeResult.unknownFlags.join(', ')}`)
|
|
101
|
+
console.error(formatUpgradeUsage())
|
|
102
|
+
process.exit(2)
|
|
103
|
+
}
|
|
104
|
+
if (upgradeResult.error === 'missing-tag-value') {
|
|
105
|
+
console.error('dsh-opentui: --tag requires a non-empty value.')
|
|
106
|
+
console.error(formatUpgradeUsage())
|
|
107
|
+
process.exit(2)
|
|
108
|
+
}
|
|
109
|
+
if (upgradeResult.error === 'invalid-tag') {
|
|
110
|
+
console.error(
|
|
111
|
+
`dsh-opentui: invalid --tag value: ${upgradeResult.invalidTag} (allowed: A-Z a-z 0-9 . _ -)`,
|
|
112
|
+
)
|
|
113
|
+
console.error(formatUpgradeUsage())
|
|
114
|
+
process.exit(2)
|
|
115
|
+
}
|
|
116
|
+
if (upgradeResult.error === 'reset-overrides-conflict') {
|
|
117
|
+
console.error('dsh-opentui: --reset-overrides cannot be combined with --no-self or --no-plugins.')
|
|
118
|
+
console.error(formatUpgradeUsage())
|
|
119
|
+
process.exit(2)
|
|
120
|
+
}
|
|
121
|
+
// Loaded lazily so a normal launch never evaluates the upgrade body.
|
|
122
|
+
const { runUpgrade } = await import(pathToFileURL(join(pkgRoot, 'scripts', 'upgrade.mjs')).href)
|
|
123
|
+
process.exit(runUpgrade(upgradeResult.opts, { pkgRoot }))
|
|
124
|
+
}
|
|
125
|
+
|
|
85
126
|
// --- 1. bun: hard runtime dependency of the client chain -------------------
|
|
86
127
|
if (!spawnSync('which', ['bun'], { encoding: 'utf8' }).stdout.trim()) {
|
|
87
128
|
exitWithGuidance('bun', 'npm i -g bun')
|
package/bin/lib/launcher.mjs
CHANGED
|
@@ -7,11 +7,15 @@
|
|
|
7
7
|
* plain data so the flags can be unit-tested without a dsh, a profile or a
|
|
8
8
|
* running client. The bin stays the only thing that touches the process.
|
|
9
9
|
*
|
|
10
|
-
* The
|
|
10
|
+
* The capabilities:
|
|
11
11
|
* 1. `--version` — print `dsh-opentui <version>` and exit 0, BEFORE any
|
|
12
12
|
* provision/profile work (see the bin's step 0).
|
|
13
13
|
* 2. `--force` — kill this profile's stale instances (the resident `dsh
|
|
14
14
|
* host and the bun client) before starting.
|
|
15
|
+
* 3. `upgrade` — the positional upgrade subcommand: its argv is parsed
|
|
16
|
+
* here (pure) and dispatched by the bin to scripts/upgrade.mjs. The
|
|
17
|
+
* subcommand and its flags are consumed by the bin and NEVER forwarded
|
|
18
|
+
* to the client (which would take them for a session name).
|
|
15
19
|
*
|
|
16
20
|
* SCOPE (requirement: never touch another profile's instances):
|
|
17
21
|
* a candidate is "ours" only when BOTH hold:
|
|
@@ -281,3 +285,127 @@ export async function killStaleProcesses(targets, options = {}) {
|
|
|
281
285
|
survivors: survivors.filter((pid) => isAlive(pid)),
|
|
282
286
|
}
|
|
283
287
|
}
|
|
288
|
+
|
|
289
|
+
/** The dist-tag `upgrade` resolves against when none is given. */
|
|
290
|
+
export const UPGRADE_DEFAULT_TAG = 'latest'
|
|
291
|
+
// The tag becomes an argv value for `npm view` and must never be able to look
|
|
292
|
+
// like a flag or carry shell/URL syntax: npm dist-tags are [A-Za-z0-9._-].
|
|
293
|
+
const TAG_PATTERN = /^[A-Za-z0-9._-]+$/
|
|
294
|
+
|
|
295
|
+
/**
|
|
296
|
+
* Parse the argv of the `upgrade` subcommand.
|
|
297
|
+
*
|
|
298
|
+
* The subcommand is POSITIONAL and must be the first argument the launcher
|
|
299
|
+
* sees after `parseLauncherArgs` consumed `--version`/`--force`. A `upgrade`
|
|
300
|
+
* anywhere else (`foo upgrade`, `--model upgrade`) is NOT the subcommand: the
|
|
301
|
+
* argument vector is forwarded to the client exactly as before (requirement:
|
|
302
|
+
* an old release silently ignores a stray positional, and this release must
|
|
303
|
+
* not turn that into an error).
|
|
304
|
+
*
|
|
305
|
+
* `--force` is deliberately absent here — `parseLauncherArgs` consumes it
|
|
306
|
+
* before this function runs, so it can never reach an upgrade flag parse. The
|
|
307
|
+
* bin rejects the `--force upgrade` combination itself (a usage error).
|
|
308
|
+
*
|
|
309
|
+
* Unknown flags are reported once as `error: 'unknown-flag'` with the offending
|
|
310
|
+
* tokens in `unknownFlags`; the caller prints the usage and exits 2 without
|
|
311
|
+
* doing anything. `--reset-overrides` is a terminal action and is incompatible
|
|
312
|
+
* with every flag that shapes an upgrade (`--no-self`/`--no-plugins`/`--yes`
|
|
313
|
+
* and a non-default `--tag`): combining them would silently ignore one intent.
|
|
314
|
+
*
|
|
315
|
+
* @param {string[]} argv arguments after the bin-level flags
|
|
316
|
+
* @returns {{ isUpgrade: boolean, opts: {
|
|
317
|
+
* dryRun: boolean, yes: boolean, tag: string, noSelf: boolean,
|
|
318
|
+
* noPlugins: boolean, resetOverrides: boolean, help: boolean,
|
|
319
|
+
* }, error: null | 'unknown-flag' | 'missing-tag-value' | 'invalid-tag' |
|
|
320
|
+
* 'reset-overrides-conflict', unknownFlags?: string[], invalidTag?: string }}
|
|
321
|
+
*/
|
|
322
|
+
export function parseUpgradeArgs(argv) {
|
|
323
|
+
const args = Array.isArray(argv) ? argv : []
|
|
324
|
+
const opts = {
|
|
325
|
+
dryRun: false,
|
|
326
|
+
yes: false,
|
|
327
|
+
tag: UPGRADE_DEFAULT_TAG,
|
|
328
|
+
noSelf: false,
|
|
329
|
+
noPlugins: false,
|
|
330
|
+
resetOverrides: false,
|
|
331
|
+
help: false,
|
|
332
|
+
}
|
|
333
|
+
// Positional contract: only argv[0] selects the subcommand.
|
|
334
|
+
if (args[0] !== 'upgrade') return { isUpgrade: false, opts, error: null }
|
|
335
|
+
|
|
336
|
+
const unknownFlags = []
|
|
337
|
+
// Presence, not value: `--reset-overrides --tag latest` is still two
|
|
338
|
+
// intents, and the conflict report must not depend on the tag's spelling.
|
|
339
|
+
let tagGiven = false
|
|
340
|
+
for (let i = 1; i < args.length; i++) {
|
|
341
|
+
const arg = args[i]
|
|
342
|
+
if (arg === '--dry-run') {
|
|
343
|
+
opts.dryRun = true
|
|
344
|
+
} else if (arg === '-y' || arg === '--yes') {
|
|
345
|
+
opts.yes = true
|
|
346
|
+
} else if (arg === '--no-self') {
|
|
347
|
+
opts.noSelf = true
|
|
348
|
+
} else if (arg === '--no-plugins') {
|
|
349
|
+
opts.noPlugins = true
|
|
350
|
+
} else if (arg === '--reset-overrides') {
|
|
351
|
+
opts.resetOverrides = true
|
|
352
|
+
} else if (arg === '-h' || arg === '--help') {
|
|
353
|
+
opts.help = true
|
|
354
|
+
} else if (arg === '--tag') {
|
|
355
|
+
const value = args[i + 1]
|
|
356
|
+
if (value === undefined || value.startsWith('-')) {
|
|
357
|
+
return { isUpgrade: true, opts, error: 'missing-tag-value' }
|
|
358
|
+
}
|
|
359
|
+
if (!TAG_PATTERN.test(value)) {
|
|
360
|
+
return { isUpgrade: true, opts, error: 'invalid-tag', invalidTag: value }
|
|
361
|
+
}
|
|
362
|
+
opts.tag = value
|
|
363
|
+
tagGiven = true
|
|
364
|
+
i++
|
|
365
|
+
} else if (arg.startsWith('--tag=')) {
|
|
366
|
+
const value = arg.slice('--tag='.length)
|
|
367
|
+
if (value === '') return { isUpgrade: true, opts, error: 'missing-tag-value' }
|
|
368
|
+
if (!TAG_PATTERN.test(value)) {
|
|
369
|
+
return { isUpgrade: true, opts, error: 'invalid-tag', invalidTag: value }
|
|
370
|
+
}
|
|
371
|
+
opts.tag = value
|
|
372
|
+
tagGiven = true
|
|
373
|
+
} else {
|
|
374
|
+
unknownFlags.push(arg)
|
|
375
|
+
}
|
|
376
|
+
}
|
|
377
|
+
|
|
378
|
+
if (unknownFlags.length > 0) {
|
|
379
|
+
return { isUpgrade: true, opts, error: 'unknown-flag', unknownFlags }
|
|
380
|
+
}
|
|
381
|
+
if (opts.resetOverrides && (opts.noSelf || opts.noPlugins || opts.yes || tagGiven)) {
|
|
382
|
+
return { isUpgrade: true, opts, error: 'reset-overrides-conflict' }
|
|
383
|
+
}
|
|
384
|
+
return { isUpgrade: true, opts, error: null }
|
|
385
|
+
}
|
|
386
|
+
|
|
387
|
+
/** Usage text for `dsh-opentui upgrade` (also the `--help` body). Plain text,
|
|
388
|
+
* one flag per line; the exit-code block is part of the contract. */
|
|
389
|
+
export function formatUpgradeUsage() {
|
|
390
|
+
return [
|
|
391
|
+
'dsh-opentui upgrade — upgrade the launcher and the opentui profile plugins',
|
|
392
|
+
'',
|
|
393
|
+
'Usage: dsh-opentui upgrade [options]',
|
|
394
|
+
'',
|
|
395
|
+
'Options:',
|
|
396
|
+
' --dry-run print the plan and exit; write nothing',
|
|
397
|
+
' -y, --yes do not ask for confirmation',
|
|
398
|
+
' --tag <name> dist-tag to resolve (default: latest)',
|
|
399
|
+
' --no-self skip the dsh-opentui launcher itself',
|
|
400
|
+
' --no-plugins skip the opentui profile plugins',
|
|
401
|
+
' --reset-overrides delete upgrade-overrides.json and exit (terminal;',
|
|
402
|
+
' conflicts with --no-self/--no-plugins/--yes/--tag)',
|
|
403
|
+
' -h, --help print this help and exit',
|
|
404
|
+
'',
|
|
405
|
+
'Exit codes:',
|
|
406
|
+
' 0 already up to date, nothing to do, --dry-run, or --help',
|
|
407
|
+
' 1 hard failure (e.g. self-upgrade did not verify); profile untouched/rolled back',
|
|
408
|
+
' 2 usage error',
|
|
409
|
+
' 3 partial: a package did not reach the target version, or overrides could not be recorded',
|
|
410
|
+
].join('\n')
|
|
411
|
+
}
|
package/dist/client/index.js
CHANGED
|
@@ -8793,7 +8793,7 @@ class RemoteHostSession {
|
|
|
8793
8793
|
listPlugins() {
|
|
8794
8794
|
return [...this.#pluginsCache];
|
|
8795
8795
|
}
|
|
8796
|
-
async refreshPlugins() {
|
|
8796
|
+
async refreshPlugins(opts = {}) {
|
|
8797
8797
|
try {
|
|
8798
8798
|
const before = this.#pluginsCache.length;
|
|
8799
8799
|
const [plugins, bundles] = await Promise.all([
|
|
@@ -8821,7 +8821,7 @@ class RemoteHostSession {
|
|
|
8821
8821
|
const title = typeof meta.title === "string" ? meta.title : moduleName;
|
|
8822
8822
|
return { name: title, moduleName, version: versions.get(moduleName) ?? "" };
|
|
8823
8823
|
}).filter((p) => p.name && !p.moduleName.startsWith("@deepseek-ai/")).map(({ name, version }) => ({ name, version }));
|
|
8824
|
-
if (this.#pluginsCache.length !== before || before === 0 || bundlesChanged) {
|
|
8824
|
+
if (!opts.silent && (this.#pluginsCache.length !== before || before === 0 || bundlesChanged)) {
|
|
8825
8825
|
for (const listener of this.#pushListeners) {
|
|
8826
8826
|
try {
|
|
8827
8827
|
listener.onPluginsChanged?.();
|
|
@@ -9420,7 +9420,7 @@ class RemoteHostSession {
|
|
|
9420
9420
|
return;
|
|
9421
9421
|
}
|
|
9422
9422
|
if (event === "plugin-manager/changed") {
|
|
9423
|
-
this.refreshPlugins().catch(() => {}).then(() => {
|
|
9423
|
+
this.refreshPlugins({ silent: true }).catch(() => {}).then(() => {
|
|
9424
9424
|
for (const listener of this.#pushListeners) {
|
|
9425
9425
|
try {
|
|
9426
9426
|
listener.onPluginsChanged?.();
|
|
@@ -44618,23 +44618,69 @@ var init_gradient_text = __esm(() => {
|
|
|
44618
44618
|
});
|
|
44619
44619
|
|
|
44620
44620
|
// ../tui-base/src/routes/welcome-hero.tsx
|
|
44621
|
+
function splashRowCap(rows) {
|
|
44622
|
+
if (rows >= 40)
|
|
44623
|
+
return 8;
|
|
44624
|
+
if (rows >= COMPOSER_COMPACT_TERMINAL_ROWS)
|
|
44625
|
+
return 4;
|
|
44626
|
+
return 1;
|
|
44627
|
+
}
|
|
44628
|
+
function splashOverflowCount(total, cap) {
|
|
44629
|
+
return total > cap ? total - Math.max(1, cap - 1) : 0;
|
|
44630
|
+
}
|
|
44621
44631
|
function shortenCwd(cwd) {
|
|
44622
44632
|
const short = home && cwd.startsWith(home) ? `~${cwd.slice(home.length)}` : cwd;
|
|
44623
44633
|
if (short.length <= 60)
|
|
44624
44634
|
return short;
|
|
44625
44635
|
return `\u2026${short.slice(-59)}`;
|
|
44626
44636
|
}
|
|
44637
|
+
function pluginLabel(row) {
|
|
44638
|
+
return row.version === "" ? row.name : `${row.name}@${row.version}`;
|
|
44639
|
+
}
|
|
44640
|
+
function clipRow(line, maxWidth) {
|
|
44641
|
+
if (stringWidth(line) <= maxWidth)
|
|
44642
|
+
return line;
|
|
44643
|
+
const limit = Math.max(0, maxWidth - 1);
|
|
44644
|
+
let out = "";
|
|
44645
|
+
let width = 0;
|
|
44646
|
+
for (const grapheme of new Intl.Segmenter(undefined, {
|
|
44647
|
+
granularity: "grapheme"
|
|
44648
|
+
}).segment(line)) {
|
|
44649
|
+
const w = stringWidth(grapheme.segment);
|
|
44650
|
+
if (width + w > limit)
|
|
44651
|
+
break;
|
|
44652
|
+
out += grapheme.segment;
|
|
44653
|
+
width += w;
|
|
44654
|
+
}
|
|
44655
|
+
return `${out}\u2026`;
|
|
44656
|
+
}
|
|
44657
|
+
function fallbackSize() {
|
|
44658
|
+
return {
|
|
44659
|
+
width: typeof process !== "undefined" && process.stdout?.columns || 120,
|
|
44660
|
+
height: typeof process !== "undefined" && process.stdout?.rows || 40
|
|
44661
|
+
};
|
|
44662
|
+
}
|
|
44627
44663
|
function WelcomeHero(props) {
|
|
44628
44664
|
const quote = pickDailyQuote();
|
|
44665
|
+
const size = () => props.state.size?.() ?? fallbackSize();
|
|
44666
|
+
const cap = () => splashRowCap(size().height);
|
|
44667
|
+
const maxRowWidth = () => Math.max(20, size().width - 2);
|
|
44668
|
+
const pluginRows = () => props.state.plugins?.() ?? [];
|
|
44669
|
+
const overflowCount = () => splashOverflowCount(pluginRows().length, cap());
|
|
44670
|
+
const visibleRows = () => {
|
|
44671
|
+
const count = overflowCount();
|
|
44672
|
+
return count > 0 ? pluginRows().slice(0, pluginRows().length - count) : pluginRows();
|
|
44673
|
+
};
|
|
44674
|
+
const heroTitle = () => props.state.title?.();
|
|
44629
44675
|
return createComponent2(Show, {
|
|
44630
44676
|
get when() {
|
|
44631
44677
|
return props.state.visible();
|
|
44632
44678
|
},
|
|
44633
44679
|
get children() {
|
|
44634
|
-
var _el$ = createElement("box"), _el$2 = createElement("box"), _el$
|
|
44680
|
+
var _el$ = createElement("box"), _el$2 = createElement("box"), _el$7 = createElement("text"), _el$8 = createElement("text");
|
|
44635
44681
|
insertNode(_el$, _el$2);
|
|
44636
|
-
insertNode(_el$, _el$
|
|
44637
|
-
insertNode(_el$, _el$
|
|
44682
|
+
insertNode(_el$, _el$7);
|
|
44683
|
+
insertNode(_el$, _el$8);
|
|
44638
44684
|
setProp(_el$, "flexDirection", "column");
|
|
44639
44685
|
setProp(_el$, "flexShrink", 0);
|
|
44640
44686
|
setProp(_el$, "width", "100%");
|
|
@@ -44648,14 +44694,75 @@ function WelcomeHero(props) {
|
|
|
44648
44694
|
}), _el$2);
|
|
44649
44695
|
setProp(_el$2, "height", 1);
|
|
44650
44696
|
setProp(_el$2, "flexShrink", 0);
|
|
44651
|
-
|
|
44652
|
-
|
|
44653
|
-
|
|
44654
|
-
|
|
44697
|
+
insert(_el$, createComponent2(Show, {
|
|
44698
|
+
get when() {
|
|
44699
|
+
return pluginRows().length > 0;
|
|
44700
|
+
},
|
|
44701
|
+
get children() {
|
|
44702
|
+
return [createComponent2(Show, {
|
|
44703
|
+
get when() {
|
|
44704
|
+
return memo2(() => heroTitle() !== undefined)() && heroTitle() !== "";
|
|
44705
|
+
},
|
|
44706
|
+
get children() {
|
|
44707
|
+
var _el$3 = createElement("text");
|
|
44708
|
+
setProp(_el$3, "selectable", false);
|
|
44709
|
+
insert(_el$3, heroTitle);
|
|
44710
|
+
effect((_$p) => setProp(_el$3, "fg", props.state.muted?.(), _$p));
|
|
44711
|
+
return _el$3;
|
|
44712
|
+
}
|
|
44713
|
+
}), createComponent2(For, {
|
|
44714
|
+
get each() {
|
|
44715
|
+
return visibleRows();
|
|
44716
|
+
},
|
|
44717
|
+
children: (row, index) => (() => {
|
|
44718
|
+
var _el$9 = createElement("text");
|
|
44719
|
+
setProp(_el$9, "selectable", false);
|
|
44720
|
+
insert(_el$9, () => clipRow(`${index() === visibleRows().length - 1 && overflowCount() === 0 ? "\u2514\u2500" : "\u251C\u2500"} ${pluginLabel(row)}`, maxRowWidth()));
|
|
44721
|
+
effect((_$p) => setProp(_el$9, "fg", props.state.muted?.(), _$p));
|
|
44722
|
+
return _el$9;
|
|
44723
|
+
})()
|
|
44724
|
+
}), createComponent2(Show, {
|
|
44725
|
+
get when() {
|
|
44726
|
+
return overflowCount() > 0;
|
|
44727
|
+
},
|
|
44728
|
+
get children() {
|
|
44729
|
+
var _el$4 = createElement("text");
|
|
44730
|
+
setProp(_el$4, "selectable", false);
|
|
44731
|
+
insert(_el$4, () => clipRow(`\u2514\u2500 ${t("hero.plugins.more", {
|
|
44732
|
+
count: overflowCount()
|
|
44733
|
+
})}`, maxRowWidth()));
|
|
44734
|
+
effect((_$p) => setProp(_el$4, "fg", props.state.muted?.(), _$p));
|
|
44735
|
+
return _el$4;
|
|
44736
|
+
}
|
|
44737
|
+
}), (() => {
|
|
44738
|
+
var _el$5 = createElement("text");
|
|
44739
|
+
setProp(_el$5, "selectable", false);
|
|
44740
|
+
insert(_el$5, () => clipRow(t("hero.plugins.count", {
|
|
44741
|
+
count: pluginRows().length
|
|
44742
|
+
}), maxRowWidth()));
|
|
44743
|
+
effect((_$p) => setProp(_el$5, "fg", props.state.muted?.(), _$p));
|
|
44744
|
+
return _el$5;
|
|
44745
|
+
})(), createComponent2(Show, {
|
|
44746
|
+
get when() {
|
|
44747
|
+
return cap() > 1;
|
|
44748
|
+
},
|
|
44749
|
+
get children() {
|
|
44750
|
+
var _el$6 = createElement("box");
|
|
44751
|
+
setProp(_el$6, "height", 1);
|
|
44752
|
+
setProp(_el$6, "flexShrink", 0);
|
|
44753
|
+
return _el$6;
|
|
44754
|
+
}
|
|
44755
|
+
})];
|
|
44756
|
+
}
|
|
44757
|
+
}), _el$7);
|
|
44758
|
+
setProp(_el$7, "selectable", false);
|
|
44759
|
+
insert(_el$7, () => `${props.state.model() ? `${props.state.model()} \xB7 ` : ""}${shortenCwd(props.cwd)}`);
|
|
44760
|
+
setProp(_el$8, "selectable", false);
|
|
44761
|
+
insert(_el$8, `\u300C${quote}\u300D`);
|
|
44655
44762
|
effect((_p$) => {
|
|
44656
44763
|
var _v$ = props.state.muted?.(), _v$2 = props.state.muted?.();
|
|
44657
|
-
_v$ !== _p$.e && (_p$.e = setProp(_el$
|
|
44658
|
-
_v$2 !== _p$.t && (_p$.t = setProp(_el$
|
|
44764
|
+
_v$ !== _p$.e && (_p$.e = setProp(_el$7, "fg", _v$, _p$.e));
|
|
44765
|
+
_v$2 !== _p$.t && (_p$.t = setProp(_el$8, "fg", _v$2, _p$.t));
|
|
44659
44766
|
return _p$;
|
|
44660
44767
|
}, {
|
|
44661
44768
|
e: undefined,
|
|
@@ -44677,6 +44784,9 @@ var init_welcome_hero = __esm(() => {
|
|
|
44677
44784
|
init_server();
|
|
44678
44785
|
init_quotes();
|
|
44679
44786
|
init_gradient_text();
|
|
44787
|
+
init_semantic();
|
|
44788
|
+
init_i18n();
|
|
44789
|
+
init_string_width();
|
|
44680
44790
|
home = typeof process !== "undefined" && process.env.HOME || "";
|
|
44681
44791
|
});
|
|
44682
44792
|
|
|
@@ -46859,7 +46969,8 @@ function brandSegment(theme, presetLabel, mode = "dark") {
|
|
|
46859
46969
|
return {
|
|
46860
46970
|
text: label,
|
|
46861
46971
|
bg: brandBlue(mode),
|
|
46862
|
-
priority: 100
|
|
46972
|
+
priority: 100,
|
|
46973
|
+
degrade: "dsh"
|
|
46863
46974
|
};
|
|
46864
46975
|
}
|
|
46865
46976
|
function providerSegment(provider, theme, mode = "dark") {
|
|
@@ -46948,7 +47059,9 @@ function messagesSegment(n, theme) {
|
|
|
46948
47059
|
if (!Number.isFinite(n) || n < 0)
|
|
46949
47060
|
return null;
|
|
46950
47061
|
return {
|
|
46951
|
-
text:
|
|
47062
|
+
text: t("footer.messages", {
|
|
47063
|
+
n
|
|
47064
|
+
}),
|
|
46952
47065
|
bg: resolvePalette(theme).messages,
|
|
46953
47066
|
priority: 80
|
|
46954
47067
|
};
|
|
@@ -47223,7 +47336,8 @@ function sessionFooterSegments(data) {
|
|
|
47223
47336
|
add(modelSegment(data.model ?? "", effectiveEffort(data.effort), theme));
|
|
47224
47337
|
add(contextSegment(data.contextTokens ?? null, data.contextWindow ?? null, theme));
|
|
47225
47338
|
add(cacheSegment(data.cacheHitRate ?? null, theme));
|
|
47226
|
-
|
|
47339
|
+
if (data.messages !== undefined)
|
|
47340
|
+
add(messagesSegment(data.messages, theme));
|
|
47227
47341
|
add(toolSegment(data.tools ?? 0, theme));
|
|
47228
47342
|
add(elapsedSegment(data.elapsedSec ?? null, theme));
|
|
47229
47343
|
add(speedSegment(data.tps ?? null, theme));
|
|
@@ -47245,6 +47359,7 @@ var init_powerline = __esm(() => {
|
|
|
47245
47359
|
init_tool_summarize();
|
|
47246
47360
|
init_string_width();
|
|
47247
47361
|
init_terminal_size();
|
|
47362
|
+
init_i18n();
|
|
47248
47363
|
POWERLINE_COLORS = {
|
|
47249
47364
|
brand: "#4D6BFE",
|
|
47250
47365
|
provider: "#6A1B9A",
|
|
@@ -59630,7 +59745,7 @@ var init_subagents_viewer = __esm(() => {
|
|
|
59630
59745
|
import { TextAttributes as TextAttributes12 } from "@opentui/core";
|
|
59631
59746
|
function resolveVersion() {
|
|
59632
59747
|
try {
|
|
59633
|
-
return "0.
|
|
59748
|
+
return "0.18.0";
|
|
59634
59749
|
} catch {
|
|
59635
59750
|
return "dev";
|
|
59636
59751
|
}
|
|
@@ -61622,10 +61737,18 @@ class RemoteSessionSeam {
|
|
|
61622
61737
|
#unjournal;
|
|
61623
61738
|
#pluginsRevision = createSignal(0);
|
|
61624
61739
|
#unplugins;
|
|
61740
|
+
#pluginsPushListeners = [];
|
|
61625
61741
|
constructor(session) {
|
|
61626
61742
|
this.#session = session;
|
|
61627
61743
|
registerSubagentSteer((id, text) => this.#session.steerChild(id, text));
|
|
61628
|
-
this.#unplugins = session.onPluginsChanged?.(() =>
|
|
61744
|
+
this.#unplugins = session.onPluginsChanged?.(() => {
|
|
61745
|
+
this.#pluginsRevision[1]((n) => n + 1);
|
|
61746
|
+
for (const listener of this.#pluginsPushListeners) {
|
|
61747
|
+
try {
|
|
61748
|
+
listener();
|
|
61749
|
+
} catch {}
|
|
61750
|
+
}
|
|
61751
|
+
}) ?? undefined;
|
|
61629
61752
|
}
|
|
61630
61753
|
status() {
|
|
61631
61754
|
const s = this.#session.status;
|
|
@@ -61840,6 +61963,14 @@ class RemoteSessionSeam {
|
|
|
61840
61963
|
this.#pluginsRevision[0]();
|
|
61841
61964
|
return this.#session.listPlugins();
|
|
61842
61965
|
}
|
|
61966
|
+
onPluginsChanged(listener) {
|
|
61967
|
+
this.#pluginsPushListeners.push(listener);
|
|
61968
|
+
return () => {
|
|
61969
|
+
const index = this.#pluginsPushListeners.indexOf(listener);
|
|
61970
|
+
if (index >= 0)
|
|
61971
|
+
this.#pluginsPushListeners.splice(index, 1);
|
|
61972
|
+
};
|
|
61973
|
+
}
|
|
61843
61974
|
pluginBundles() {
|
|
61844
61975
|
this.#pluginsRevision[0]();
|
|
61845
61976
|
return this.#session.listBundles();
|
|
@@ -61997,6 +62128,7 @@ class RemoteSessionSeam {
|
|
|
61997
62128
|
this.#unplugins?.();
|
|
61998
62129
|
this.#unplugins = undefined;
|
|
61999
62130
|
this.#listeners.length = 0;
|
|
62131
|
+
this.#pluginsPushListeners.length = 0;
|
|
62000
62132
|
await this.#session.dispose();
|
|
62001
62133
|
}
|
|
62002
62134
|
#ensureJournalFeed() {
|
|
@@ -62126,7 +62258,6 @@ function V2SessionPage(props) {
|
|
|
62126
62258
|
const [turnBusy, setTurnBusy] = createSignal(false);
|
|
62127
62259
|
const busy = () => composerBusy() || turnBusy();
|
|
62128
62260
|
const [busySince, setBusySince] = createSignal(0);
|
|
62129
|
-
const [msgs, setMsgs] = createSignal(0);
|
|
62130
62261
|
const [model, setModel] = createSignal();
|
|
62131
62262
|
const [tools, setTools] = createSignal(0);
|
|
62132
62263
|
const [effort, setEffort] = createSignal();
|
|
@@ -62137,9 +62268,13 @@ function V2SessionPage(props) {
|
|
|
62137
62268
|
const [presetLabel, setPresetLabel] = createSignal();
|
|
62138
62269
|
const [skillRows, setSkillRows] = createSignal(props.skills ?? []);
|
|
62139
62270
|
const slashCommands = createMemo(() => withSkillCommands(coreCommands(), skillRows()));
|
|
62271
|
+
const [pluginRows, setPluginRows] = createSignal(seam.plugins?.() ?? []);
|
|
62140
62272
|
onMount(() => {
|
|
62141
62273
|
const off = seam.onSkillsChanged?.((rows) => setSkillRows(rows.map((row) => ({ name: row.name, description: row.description, path: "skills/list" }))));
|
|
62142
62274
|
onCleanup(() => off?.());
|
|
62275
|
+
const offPlugins = seam.onPluginsChanged?.(() => setPluginRows(seam.plugins?.() ?? []));
|
|
62276
|
+
onCleanup(() => offPlugins?.());
|
|
62277
|
+
setPluginRows(seam.plugins?.() ?? []);
|
|
62143
62278
|
});
|
|
62144
62279
|
const refreshPresetLabel = () => {
|
|
62145
62280
|
const face = seam.preset;
|
|
@@ -62150,6 +62285,7 @@ function V2SessionPage(props) {
|
|
|
62150
62285
|
let composerRef;
|
|
62151
62286
|
let transcriptScroll;
|
|
62152
62287
|
const renderer = useRenderer();
|
|
62288
|
+
const dimensions = useTerminalSize();
|
|
62153
62289
|
const paneFocus = createPaneFocus({
|
|
62154
62290
|
transcript: () => transcriptScroll,
|
|
62155
62291
|
composer: () => composerRef?.node()
|
|
@@ -62190,7 +62326,6 @@ function V2SessionPage(props) {
|
|
|
62190
62326
|
let turnAborted = false;
|
|
62191
62327
|
const send = (text) => {
|
|
62192
62328
|
turnAborted = false;
|
|
62193
|
-
setMsgs((n) => n + 1);
|
|
62194
62329
|
setTurnBusy(true);
|
|
62195
62330
|
setBusySince(Date.now());
|
|
62196
62331
|
setLastRequest(text);
|
|
@@ -62295,7 +62430,7 @@ function V2SessionPage(props) {
|
|
|
62295
62430
|
provider: model()?.providerID,
|
|
62296
62431
|
model: model()?.modelID,
|
|
62297
62432
|
effort: effort(),
|
|
62298
|
-
messages: remoteInfo()?.messageCount
|
|
62433
|
+
messages: remoteInfo()?.messageCount,
|
|
62299
62434
|
tools: tools(),
|
|
62300
62435
|
tps: remoteInfo()?.tps ?? null,
|
|
62301
62436
|
contextTokens: ctxTokens(),
|
|
@@ -62490,10 +62625,13 @@ function V2SessionPage(props) {
|
|
|
62490
62625
|
return [
|
|
62491
62626
|
createComponent2(WelcomeHero, {
|
|
62492
62627
|
state: {
|
|
62493
|
-
visible: () => projection.hydrated() &&
|
|
62628
|
+
visible: () => projection.hydrated() && projection.rows.length === 0,
|
|
62494
62629
|
model: () => model()?.modelID,
|
|
62495
62630
|
muted: () => theme.text.muted,
|
|
62496
|
-
mode: () => themeService.mode()
|
|
62631
|
+
mode: () => themeService.mode(),
|
|
62632
|
+
title: () => props.profileName,
|
|
62633
|
+
plugins: () => pluginRows(),
|
|
62634
|
+
size: () => dimensions()
|
|
62497
62635
|
},
|
|
62498
62636
|
cwd: props.workspace
|
|
62499
62637
|
}),
|
|
@@ -62837,6 +62975,7 @@ async function bootClientV2(options = {}) {
|
|
|
62837
62975
|
themeName,
|
|
62838
62976
|
quit: () => process.exit(0),
|
|
62839
62977
|
workspace,
|
|
62978
|
+
profileName: profile,
|
|
62840
62979
|
probeBranch: (cwd) => git.probeGitBranchOrSha(cwd),
|
|
62841
62980
|
initialSessionId,
|
|
62842
62981
|
resumeNotice,
|
|
@@ -62899,6 +63038,7 @@ var init_v2_entry = __esm(() => {
|
|
|
62899
63038
|
init_delivery_choice();
|
|
62900
63039
|
init_auto_resume();
|
|
62901
63040
|
init_welcome_hero();
|
|
63041
|
+
init_terminal_size();
|
|
62902
63042
|
init_subagents_picker();
|
|
62903
63043
|
init_subagent_markers();
|
|
62904
63044
|
init_seam_rows();
|
package/dist/locales/en.json
CHANGED
|
@@ -611,6 +611,7 @@
|
|
|
611
611
|
"turn.stop.confirmMessage": "Stop {parts} now? Queued prompts stay and the session remains resumable.",
|
|
612
612
|
"turn.stop.confirmLabel": "stop",
|
|
613
613
|
"turn.stop.cancelLabel": "keep running",
|
|
614
|
+
"footer.messages": "💬 {n} msgs",
|
|
614
615
|
"footer.hint.quit": "ctrl+c ×2 quit",
|
|
615
616
|
"footer.hint.scroll": "pgup/pgdn scroll",
|
|
616
617
|
"footer.hint.search": "ctrl+shift+f search",
|
|
@@ -906,5 +907,7 @@
|
|
|
906
907
|
"dialog.mcp.details.unknownError": "Unknown MCP connection error",
|
|
907
908
|
"dialog.mcp.details.context": "Status: {status}\nConfiguration: mcp.servers.{server}",
|
|
908
909
|
"dialog.mcp.details.integration": "\nIntegration: {id}",
|
|
909
|
-
"composer.placeholder": "Type a message (enter send, alt+enter newline)"
|
|
910
|
+
"composer.placeholder": "Type a message (enter send, alt+enter newline)",
|
|
911
|
+
"hero.plugins.count": "plugins {count}",
|
|
912
|
+
"hero.plugins.more": "… +{count} more"
|
|
910
913
|
}
|