@aiwayds/dsh-opentui 0.25.0 → 0.26.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/CHANGELOG.md +66 -0
- package/README.md +148 -53
- package/dist/bridge/bundle-fingerprint.json +1 -1
- package/dist/bridge/index.js +90 -8
- package/dist/client/index.js +316 -92
- package/dist/client/index.js.map +15 -13
- package/dist/locales/en.json +18 -0
- package/dist/locales/zh-CN.json +18 -0
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -5,6 +5,72 @@ 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.25.0] - 2026-11-22
|
|
9
|
+
|
|
10
|
+
### Added
|
|
11
|
+
|
|
12
|
+
- **Capability release is table-driven.** CapIR v3 adds per-method parameter /
|
|
13
|
+
service tables and a generated generic dispatch arm (ADR-0012); new capabilities
|
|
14
|
+
are released through an explicit per-id allowlist instead of a blanket grant.
|
|
15
|
+
The in-process host now wires **58 of 257** methods (28 hand-written adapters
|
|
16
|
+
plus 30 released generic ids); every other id fails explicitly as `NOT_WIRED`,
|
|
17
|
+
never a silent empty result. `scripts/check-capcontract.mjs` byte-compares the
|
|
18
|
+
generated tables with **22 assertions**.
|
|
19
|
+
- **New command faces ride real host data.** `/btw` answers a side question in a
|
|
20
|
+
throwaway side session alongside a busy main turn; `/plugins` opens a real
|
|
21
|
+
plugin-manager panel (list + detail, install / uninstall / enable / disable
|
|
22
|
+
behind a confirmation modal, bounded install-progress polling with cancel);
|
|
23
|
+
`/goals` exposes 7 goal operations with a TUI confirmation before each write;
|
|
24
|
+
`/model discover` queries the current provider for its model list; `/login` /
|
|
25
|
+
`/logout` and `/account` are separate provider-login and account domains;
|
|
26
|
+
`/search`, `/history` and `/subagents` read real host data. `/settings` shows a
|
|
27
|
+
real permission-preset row.
|
|
28
|
+
|
|
29
|
+
### Changed
|
|
30
|
+
|
|
31
|
+
- **The legacy podman `e2e/scenarios/` container layer was retired (ADR-0013).**
|
|
32
|
+
Its 21 scenarios were inventoried and each still-valid assertion was shown to
|
|
33
|
+
be taken over by the host families, the real-machine gate, unit tests and the
|
|
34
|
+
CI `pack-cold-start` gate before deletion. The container slot is recorded as
|
|
35
|
+
NOT RUN, never a fake green. The real-machine tmux recipe (historically
|
|
36
|
+
"verify70") closed at **64/64** items; the `pack-cold-start` gate is required.
|
|
37
|
+
|
|
38
|
+
### Known
|
|
39
|
+
|
|
40
|
+
- `/model discover`'s positive path is environment-dependent and was NOT RUN
|
|
41
|
+
where no discovery source is registered; the honest degrade path is verified
|
|
42
|
+
and no model list is fabricated. The real-machine CI job remains opt-in and
|
|
43
|
+
needs a self-hosted runner with `dsh`, tmux, a provisioned profile and a
|
|
44
|
+
provider key.
|
|
45
|
+
|
|
46
|
+
## [0.24.0] - 2026-11-21
|
|
47
|
+
|
|
48
|
+
### Added
|
|
49
|
+
|
|
50
|
+
- **The in-process bridge is the sole session seam.** All TUI traffic runs over
|
|
51
|
+
a stdio JSON-lines channel to a bridge loaded inside the `dsh --profile
|
|
52
|
+
opentui-inproc` host; the legacy remote thin-client seam and its
|
|
53
|
+
`DSH_OPENTUI_INPROC=0` escape hatch were removed. A boot handshake compares
|
|
54
|
+
the client's expected capability surface with the bridge and degrades honestly
|
|
55
|
+
on a mismatch.
|
|
56
|
+
- **The CapIR / capcontract layer** makes `capir/capir.json` the single source of
|
|
57
|
+
truth for capability interface shapes, with generated contract tables checked
|
|
58
|
+
byte-for-byte in CI.
|
|
59
|
+
- **A FocusRouter keymap with a four-tier capture stack** (ADR-0008), and the S1–S6
|
|
60
|
+
capability surface: a real `/model` catalog, credentials / account with PKCE
|
|
61
|
+
authorization, and real config / settings / agents faces (no degrade notice).
|
|
62
|
+
|
|
63
|
+
### Changed
|
|
64
|
+
|
|
65
|
+
- **The bridge is now a real directory copy** of this installation's bundled
|
|
66
|
+
artifact, guarded by a build-time fingerprint and a host-version compatibility
|
|
67
|
+
window — no absolute symlink, and no `@deepseek-ai/*` package copied into the
|
|
68
|
+
profile. It converges idempotently on every launch; `--repair-bridge` is still
|
|
69
|
+
accepted but is a no-op, while a fingerprint mismatch still fails loud.
|
|
70
|
+
- **28 methods are hand-wired and `@manual` reached 0.** The `pack-cold-start` CI
|
|
71
|
+
gate (npm pack → fresh install → bridge identity → stdio handshake) and the
|
|
72
|
+
real-machine `verify70` gate went green.
|
|
73
|
+
|
|
8
74
|
## [0.23.3] - 2026-11-20
|
|
9
75
|
|
|
10
76
|
### Changed
|
package/README.md
CHANGED
|
@@ -6,11 +6,11 @@ new architecture, not a reskin of dsh-tui-pi. Built on
|
|
|
6
6
|
running on Bun.
|
|
7
7
|
|
|
8
8
|
The repo's product is the **architecture**; the shipped Shell is a working
|
|
9
|
-
chat agent TUI on top of it.
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
0.23.0.
|
|
9
|
+
chat agent TUI on top of it. It boots an in-process session bridge inside the
|
|
10
|
+
dsh host and drives the OpenTUI client over a stdio JSON-lines channel — the
|
|
11
|
+
bridge is the only session seam. The legacy remote thin-client seam and its
|
|
12
|
+
`DSH_OPENTUI_INPROC=0` escape hatch were removed in 0.24.0; the `--remote`
|
|
13
|
+
flag was removed earlier, in 0.23.0.
|
|
14
14
|
|
|
15
15
|
| Package | What it is |
|
|
16
16
|
|---|---|
|
|
@@ -22,7 +22,9 @@ See [CONTEXT.md](CONTEXT.md) for the glossary and [docs/adr/](docs/adr/)
|
|
|
22
22
|
for decisions: Solid (0001), two integration channels with no compat shim
|
|
23
23
|
(0002), Bun single-process distribution (0003), host profile route (0004),
|
|
24
24
|
client mode (0005, superseded as the sole TUI path by the in-process bridge,
|
|
25
|
-
0009), session seam lifecycle (0010)
|
|
25
|
+
0009), session seam lifecycle (0010), the ask/permission channel (0011),
|
|
26
|
+
table-driven CapIR v3 dispatch (0012) and retirement of the legacy container
|
|
27
|
+
e2e layer (0013).
|
|
26
28
|
|
|
27
29
|
## Install
|
|
28
30
|
|
|
@@ -37,11 +39,13 @@ npm i -g @aiwayds/dsh-opentui
|
|
|
37
39
|
dsh-opentui
|
|
38
40
|
```
|
|
39
41
|
|
|
40
|
-
The first launch automatically provisions the `opentui-inproc` profile
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
42
|
+
The first launch automatically provisions the `opentui-inproc` profile: the
|
|
43
|
+
shipped bridge bundle is materialized as a real directory copy of this
|
|
44
|
+
installation (no symlink, no copy of any `@deepseek-ai/*` package into the
|
|
45
|
+
profile) and checked against a build-time fingerprint. The copy converges
|
|
46
|
+
idempotently on every launch, so a damaged or stale bridge is replaced on the
|
|
47
|
+
next start; `--repair-bridge` is still accepted for compatibility but is a
|
|
48
|
+
no-op (a fingerprint mismatch still fails loud).
|
|
45
49
|
|
|
46
50
|
Run `dsh-opentui --help` for the full list of launcher options.
|
|
47
51
|
|
|
@@ -106,45 +110,54 @@ and keeps the plugin set it booted with, so a plugin upgrade never applies to
|
|
|
106
110
|
the current one. CI and scripted runs must pass `--yes` — without a TTY the
|
|
107
111
|
confirmation prompt is refused.
|
|
108
112
|
|
|
109
|
-
##
|
|
110
|
-
|
|
111
|
-
> Since 0.
|
|
112
|
-
>
|
|
113
|
-
>
|
|
114
|
-
>
|
|
115
|
-
> error
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
113
|
+
## Session topology
|
|
114
|
+
|
|
115
|
+
> Since 0.24.0 the in-process session bridge (`opentui-inproc` profile, see
|
|
116
|
+
> ADR-0009) is the **only** session seam: the Bun TUI talks stdio JSON-lines to
|
|
117
|
+
> a bridge loaded inside a `dsh --profile opentui-inproc` host process. The
|
|
118
|
+
> legacy remote thin-client seam, its `DSH_OPENTUI_INPROC=0` escape hatch and
|
|
119
|
+
> the `--remote` flag are all gone (the flag has been a usage error, exit 2,
|
|
120
|
+
> since 0.23.0).
|
|
121
|
+
|
|
122
|
+
The Node launcher spawns the Bun TUI in the foreground (forwarding
|
|
123
|
+
SIGINT/SIGTERM/SIGHUP); the TUI starts the dsh host, which loads the bridge
|
|
124
|
+
in-process. A boot handshake compares the client's expected capability surface
|
|
125
|
+
with the bridge and degrades honestly on a mismatch.
|
|
126
|
+
|
|
127
|
+
Every launch provisions two profiles:
|
|
128
|
+
|
|
129
|
+
- **`opentui-inproc`** — the bridge profile, provisioned synchronously (a
|
|
130
|
+
failure here is fatal): a real directory copy of this installation's bundled
|
|
131
|
+
bridge, the session shim, a host-version compatibility exemption, the
|
|
132
|
+
approval gate and an inproc-only cordis patch. The copy converges on every
|
|
133
|
+
launch; `--repair-bridge` is accepted but is a no-op.
|
|
134
|
+
- **`opentui`** — provisioned on EVERY launch, best-effort (a no-op pass is
|
|
135
|
+
sub-second). Pass `--provider` / `--model` / `--reasoning-effort` to pin a
|
|
136
|
+
different default model (default `zai-coding-cn/glm-5.3-flash/high`).
|
|
137
|
+
Provisioning also handles:
|
|
138
|
+
- **Default plugins** — the first run installs the plugin set below into the
|
|
139
|
+
profile and prints its progress (`[3/5] plugins …`). Later runs only repair
|
|
140
|
+
what is missing: nothing is reinstalled when the dependency, the installed
|
|
141
|
+
version and the bundle entry already agree. `--dry-run` (or
|
|
142
|
+
`DSH_PROVISION_DRY_RUN=1`) prints the commands without executing them.
|
|
143
|
+
- **Legacy migration** — a pre-retirement `profiles/dsh-opentui` profile is
|
|
144
|
+
detected once and its theme / config preferences are conservatively copied
|
|
145
|
+
into the `opentui` profile (only keys the target does not already have).
|
|
146
|
+
The legacy profile is kept, never deleted.
|
|
147
|
+
- **SDK closure link** — the client still imports
|
|
148
|
+
`@deepseek-ai/dsh-client-connection` at runtime (host label/lifecycle).
|
|
149
|
+
That SDK is not on the public npm registry; it ships inside the
|
|
150
|
+
globally-installed dsh's own `node_modules` closure, and the launcher
|
|
151
|
+
symlinks it into the installed package's `node_modules` (idempotent). This
|
|
152
|
+
is why the dsh CLI is a hard prerequisite.
|
|
144
153
|
|
|
145
154
|
### Default plugins
|
|
146
155
|
|
|
147
|
-
|
|
156
|
+
The live session runs on the `opentui-inproc` profile, whose cordis patch
|
|
157
|
+
registers the tool, ask-user and MCP rows directly. The `opentui` profile below
|
|
158
|
+
is still provisioned on every launch and is what `upgrade` targets, but its
|
|
159
|
+
plugin set is not loaded by the in-process host. Every launch converges it to
|
|
160
|
+
this set (pinned versions):
|
|
148
161
|
|
|
149
162
|
| Tier | Package | Why |
|
|
150
163
|
|---|---|---|
|
|
@@ -155,7 +168,7 @@ Every launch converges the `opentui` profile to this set (pinned versions):
|
|
|
155
168
|
| core | `@aiwayds/dsh-mcp-adapter` | MCP catalog/dispatch meta-tools (`mcp_list` / `mcp_call`) |
|
|
156
169
|
| core | `@aiwayds/dsh-approval-policy` | tool-approval policy |
|
|
157
170
|
| core | `@aiwayds/dsh-model-sync` | keeps the model list in sync with the provider catalog |
|
|
158
|
-
| recommended | `@aiwayds/dsh-llm-stats` | token/cost accounting
|
|
171
|
+
| recommended | `@aiwayds/dsh-llm-stats` | token/cost accounting (usage limits) |
|
|
159
172
|
| recommended | `@aiwayds/dsh-topics-memory` | cross-session topic memory |
|
|
160
173
|
| recommended | `@aiwayds/dsh-cron` | scheduled prompts |
|
|
161
174
|
| recommended | `@aiwayds/dsh-workflow` | dynamic workflow runs |
|
|
@@ -230,9 +243,12 @@ The model's thinking streams
|
|
|
230
243
|
dim; write-class tool calls (bash / write / edit / apply_patch) pop an approval
|
|
231
244
|
card — **Enter** allows once, **Esc** declines (fail-closed); read-only tools
|
|
232
245
|
such as read_file pass straight through. `esc` ×2 + confirm stops a running
|
|
233
|
-
turn. Ctrl+C twice quits. Commands
|
|
234
|
-
`/help` `/model [provider/id]` `/
|
|
235
|
-
`/
|
|
246
|
+
turn. Ctrl+C twice quits. Commands (see `/help` inside the TUI for the full
|
|
247
|
+
list): `/help` `/model [provider/id]` `/model discover` `/btw` `/plugins`
|
|
248
|
+
`/goals` `/login` `/logout` `/account` `/settings` `/agents` `/skills`
|
|
249
|
+
`/search` `/history` `/subagents` `/session` `/export` `/think` `/preset`
|
|
250
|
+
`/theme` `/language` `/motion` `/hints` `/hotkeys` `/stop` `/resume` `/new`
|
|
251
|
+
`/clear` `/flush` `/quit`.
|
|
236
252
|
|
|
237
253
|
**Approval by default (inproc profile)**: the generated profile pins
|
|
238
254
|
`defaultPreset: workspace-write` (`approval: ask`) and arms the pre-execute
|
|
@@ -254,6 +270,50 @@ notice — set `"autoResume": "last"` in
|
|
|
254
270
|
the config). `--new` always starts fresh and wins over both; `--session <id>`
|
|
255
271
|
pins a specific session.
|
|
256
272
|
|
|
273
|
+
## Capability surface
|
|
274
|
+
|
|
275
|
+
The capability layer is table-driven: `capir/capir.json` (CapIR v3 — 257
|
|
276
|
+
wire→client methods over 43 host artifacts) is the single source of truth, and
|
|
277
|
+
`scripts/gen-capcontract.mjs` generates the id/kind/params/service tables plus
|
|
278
|
+
a generic dispatcher; `node scripts/check-capcontract.mjs` byte-compares the
|
|
279
|
+
generated files (22 assertions). Capabilities are released by an explicit
|
|
280
|
+
per-id allowlist, not a blanket grant. The in-process host currently wires
|
|
281
|
+
**58 of 257** methods (28 hand-written adapters + 30 released generic ids);
|
|
282
|
+
everything else fails explicitly as `NOT_WIRED`, never a silent empty result.
|
|
283
|
+
The `account` / `credentials` / `settings` families are deny-listed from the
|
|
284
|
+
generic arm and served only by hand-written faces with per-field whitelist
|
|
285
|
+
projection. Credential values are redacted to key name + presence before they
|
|
286
|
+
cross the stdio bridge and never land in logs or evidence.
|
|
287
|
+
|
|
288
|
+
Plugin write operations (install/uninstall/enable/disable) are gated twice —
|
|
289
|
+
a bridge-side confirm set (8 `pluginManager` write ids) and a TUI confirmation
|
|
290
|
+
modal. Goal edits confirm in the TUI before each write; they are exempt from
|
|
291
|
+
the bridge confirm set by risk grading (AMEND-5 §11.2) — goals only change
|
|
292
|
+
host-side goal state, with no FS, config or credential surface. Values crossing
|
|
293
|
+
the bridge pass through per-field whitelist projection in both cases.
|
|
294
|
+
|
|
295
|
+
Command faces backed by real host data (0.24–0.25):
|
|
296
|
+
|
|
297
|
+
- **`/btw`** — a side question answered in a throwaway side session; it runs
|
|
298
|
+
alongside a busy main turn (bare `/btw` reopens the last answer).
|
|
299
|
+
- **`/plugins`** — a plugin-manager panel with list + detail and install /
|
|
300
|
+
uninstall / enable / disable behind a confirmation modal; install progress
|
|
301
|
+
is polled with a bounded wait and can be cancelled.
|
|
302
|
+
- **`/goals`** — goal data with 7 operations: status, create, edit, pause,
|
|
303
|
+
resume, complete, clear; writes confirm first.
|
|
304
|
+
- **`/model discover`** — query the current provider for its model list. The
|
|
305
|
+
positive path is environment-dependent and was NOT RUN in the scratch gate
|
|
306
|
+
(no discovery source registered); the honest degrade path is verified.
|
|
307
|
+
- **`/login`** / **`/logout`** / **`/account`** — provider login picker
|
|
308
|
+
(including a Custom form) and account sign-in state, kept in separate
|
|
309
|
+
domains.
|
|
310
|
+
- **`/search`** / **`/history`** / **`/subagents`** — full-text search over
|
|
311
|
+
stored sessions, completed-turn browse/refill/switch/fork, and live subagent
|
|
312
|
+
transcripts with steer/stop.
|
|
313
|
+
- **`/settings`** — now shows a real permission-preset row; config/agents
|
|
314
|
+
faces became real (no degrade notice) in 0.24. `/model` has used the real
|
|
315
|
+
model catalog and selection since 0.24.
|
|
316
|
+
|
|
257
317
|
## Develop
|
|
258
318
|
|
|
259
319
|
```bash
|
|
@@ -281,7 +341,22 @@ Note on the @opentui/solid preload and bunfig scope:
|
|
|
281
341
|
|
|
282
342
|
To rebuild the client bundle that `prepack` ships: `bun scripts/build-client.mjs`.
|
|
283
343
|
|
|
284
|
-
### Verification gates
|
|
344
|
+
### Verification gates
|
|
345
|
+
|
|
346
|
+
CI runs the integrity and test gates: `node scripts/check-capcontract.mjs`
|
|
347
|
+
(22 byte-level/consistency assertions over the generated capability tables),
|
|
348
|
+
per-package `bun test`, `bun run test:ft`, `bun run typecheck:entry` and the
|
|
349
|
+
`^verify:` assembly tests, plus the `pack-cold-start` job (npm pack → fresh
|
|
350
|
+
install → bridge identity → stdio handshake). The real-machine tmux recipe
|
|
351
|
+
(`scripts/real-client-gate.sh`, historically named "verify70") runs **64**
|
|
352
|
+
items against a live TUI; its CI job is opt-in and needs a self-hosted runner
|
|
353
|
+
with `dsh`, tmux, a provisioned profile and a provider key, so a local run is
|
|
354
|
+
required before keymap/panel/command-surface changes. The legacy podman
|
|
355
|
+
`e2e/scenarios/` container layer was retired in 0.25 (ADR-0013); its still-valid
|
|
356
|
+
assertions moved to the host families, verify70, unit tests and the
|
|
357
|
+
`pack-cold-start` gate.
|
|
358
|
+
|
|
359
|
+
Live client-topology gates (local / self-hosted, not hosted CI):
|
|
285
360
|
|
|
286
361
|
```bash
|
|
287
362
|
node packages/shell/scripts/e2e-sweep.mjs # full command-surface sweep
|
|
@@ -329,4 +404,24 @@ scene UI matrix and a real-client e2e flow suite), hardens first-connect
|
|
|
329
404
|
HTTP + `$events`, retries capped at 3 with the host stderr tail surfaced),
|
|
330
405
|
and fixes footer wrapping on narrow terminals, tool-dock clipping, the
|
|
331
406
|
message count after `--resume-last`, and duplicate terminal-size listeners.
|
|
332
|
-
|
|
407
|
+
|
|
408
|
+
0.24.0 completes the in-process bridge as the sole session seam (the `--remote`
|
|
409
|
+
flag and the `DSH_OPENTUI_INPROC=0` escape hatch are both gone). It adds the
|
|
410
|
+
CapIR/capcontract layer with a startup capability handshake, a FocusRouter
|
|
411
|
+
keymap with a four-tier capture stack, and the S1–S6 capability surface: a real
|
|
412
|
+
`/model` catalog, credentials/account with PKCE authorization, and real
|
|
413
|
+
config/settings/agents faces. The `pack-cold-start` CI gate and the real-machine
|
|
414
|
+
verify70 gate went green; 28 methods were hand-wired and `@manual` reached 0.
|
|
415
|
+
|
|
416
|
+
0.25.0 (npm `latest`) makes capability release table-driven: CapIR v3 parameter
|
|
417
|
+
tables plus a generic dispatch arm (ADR-0012) and a per-id allowlist take the
|
|
418
|
+
wired set to 58/257 while `check-capcontract` stays green at 22/22 assertions.
|
|
419
|
+
New command faces ride real host data — `/btw` side sessions, a `/plugins`
|
|
420
|
+
manager panel with confirm-gated writes and bounded install progress, `/goals`
|
|
421
|
+
with 7 operations, `/model discover`, separate `/login` and `/account` domains,
|
|
422
|
+
and real `/search`, `/history` and `/subagents` data. The legacy podman
|
|
423
|
+
`e2e/scenarios/` container layer was retired (ADR-0013), verify70 closed at
|
|
424
|
+
64/64, and the `pack-cold-start` gate is required. `/model discover`'s positive
|
|
425
|
+
path is environment-dependent; it was NOT RUN where no discovery source is
|
|
426
|
+
registered, and is not faked. Current focus: capability-surface polish and
|
|
427
|
+
honest degradation.
|
package/dist/bridge/index.js
CHANGED
|
@@ -169,6 +169,12 @@ function validateAskRequest(value) {
|
|
|
169
169
|
const escalation = optionalBoolean(value.escalation, "escalation", code);
|
|
170
170
|
if (typeof escalation === "object")
|
|
171
171
|
return escalation;
|
|
172
|
+
const childSessionId = optionalString(value.childSessionId, "childSessionId", code);
|
|
173
|
+
if (typeof childSessionId === "object")
|
|
174
|
+
return childSessionId;
|
|
175
|
+
const parentSessionId = optionalString(value.parentSessionId, "parentSessionId", code);
|
|
176
|
+
if (typeof parentSessionId === "object")
|
|
177
|
+
return parentSessionId;
|
|
172
178
|
let questions;
|
|
173
179
|
if (value.questions !== undefined) {
|
|
174
180
|
if (!Array.isArray(value.questions))
|
|
@@ -193,7 +199,9 @@ function validateAskRequest(value) {
|
|
|
193
199
|
...questions !== undefined ? { questions } : {},
|
|
194
200
|
...deadlineAt !== undefined ? { deadlineAt } : {},
|
|
195
201
|
...detachGraceMs !== undefined ? { detachGraceMs } : {},
|
|
196
|
-
...escalation !== undefined ? { escalation } : {}
|
|
202
|
+
...escalation !== undefined ? { escalation } : {},
|
|
203
|
+
...childSessionId !== undefined ? { childSessionId } : {},
|
|
204
|
+
...parentSessionId !== undefined ? { parentSessionId } : {}
|
|
197
205
|
}
|
|
198
206
|
};
|
|
199
207
|
}
|
|
@@ -392,6 +400,7 @@ class SessionPermissionSummary {
|
|
|
392
400
|
|
|
393
401
|
// ../bridge/src/ask-registry.ts
|
|
394
402
|
var DEFAULT_RECORD_LIMIT = 256;
|
|
403
|
+
var DEFAULT_MAX_ASK_WAIT_MS = 3600000;
|
|
395
404
|
function remember(ids, id, limit) {
|
|
396
405
|
ids.add(id);
|
|
397
406
|
while (ids.size > limit) {
|
|
@@ -425,7 +434,7 @@ class AskRegistry {
|
|
|
425
434
|
constructor(options = {}) {
|
|
426
435
|
this.#askDeadlineMs = options.askDeadlineMs === undefined ? null : options.askDeadlineMs;
|
|
427
436
|
this.#detachGraceMs = options.detachGraceMs ?? 30000;
|
|
428
|
-
this.#maxAskWaitMs = options.maxAskWaitMs ??
|
|
437
|
+
this.#maxAskWaitMs = options.maxAskWaitMs ?? DEFAULT_MAX_ASK_WAIT_MS;
|
|
429
438
|
this.#recordLimit = options.recordLimit ?? DEFAULT_RECORD_LIMIT;
|
|
430
439
|
this.#now = options.now ?? Date.now;
|
|
431
440
|
this.#sink = options.sink ?? (() => {});
|
|
@@ -6614,7 +6623,8 @@ var CAP_GENERIC_ADAPTERS = new Set([
|
|
|
6614
6623
|
"@deepseek-ai/dsh-goal#goals/complete",
|
|
6615
6624
|
"@deepseek-ai/dsh-goal#goals/pause",
|
|
6616
6625
|
"@deepseek-ai/dsh-goal#goals/resume",
|
|
6617
|
-
"@deepseek-ai/dsh-goal#goals/clear"
|
|
6626
|
+
"@deepseek-ai/dsh-goal#goals/clear",
|
|
6627
|
+
"@deepseek-ai/dsh-commands#commands/execute"
|
|
6618
6628
|
]);
|
|
6619
6629
|
var CAP_WRITE_CONFIRM_IDS = new Set([
|
|
6620
6630
|
"@deepseek-ai/dsh-plugin-manager#pluginManager/installBundle",
|
|
@@ -7803,6 +7813,19 @@ function parseRequest(raw) {
|
|
|
7803
7813
|
const params = obj.params !== null && typeof obj.params === "object" && !Array.isArray(obj.params) ? obj.params : {};
|
|
7804
7814
|
return { id, method: obj.method, params };
|
|
7805
7815
|
}
|
|
7816
|
+
function resolveAskDeadlineMs(raw, maxAskWaitMs = DEFAULT_MAX_ASK_WAIT_MS, warn = () => {}) {
|
|
7817
|
+
if (raw === undefined || raw === null)
|
|
7818
|
+
return null;
|
|
7819
|
+
if (typeof raw !== "number" || Number.isNaN(raw) || raw < 0) {
|
|
7820
|
+
warn("[dsh-opentui-bridge] invalid askDeadlineMs %s ignored (no per-ask deadline)", String(raw));
|
|
7821
|
+
return null;
|
|
7822
|
+
}
|
|
7823
|
+
if (raw > maxAskWaitMs) {
|
|
7824
|
+
warn("[dsh-opentui-bridge] askDeadlineMs %d exceeds maxAskWaitMs %d; clamped to hard cap", raw, maxAskWaitMs);
|
|
7825
|
+
return maxAskWaitMs;
|
|
7826
|
+
}
|
|
7827
|
+
return raw;
|
|
7828
|
+
}
|
|
7806
7829
|
function apply(ctx, config) {
|
|
7807
7830
|
const logger = ctx.logger;
|
|
7808
7831
|
if (process.env[STDIO_SWITCH] !== "1") {
|
|
@@ -8257,7 +8280,10 @@ function apply(ctx, config) {
|
|
|
8257
8280
|
logger.warn("[dsh-opentui-bridge] ask journal append failed (decision unchanged): %s", err);
|
|
8258
8281
|
}
|
|
8259
8282
|
}
|
|
8283
|
+
const askDeadlineMsRaw = config !== null && typeof config === "object" ? config.askDeadlineMs : undefined;
|
|
8284
|
+
const askDeadlineMs = resolveAskDeadlineMs(askDeadlineMsRaw, DEFAULT_MAX_ASK_WAIT_MS, (fmt, ...params) => logger.warn(fmt, ...params));
|
|
8260
8285
|
const ask = new AskRegistry({
|
|
8286
|
+
askDeadlineMs,
|
|
8261
8287
|
logger,
|
|
8262
8288
|
journal: writeAskJournal,
|
|
8263
8289
|
sink: (frame) => {
|
|
@@ -8374,6 +8400,48 @@ function apply(ctx, config) {
|
|
|
8374
8400
|
logger.warn("[bridge:stat] turn=%s deltas=%d tokenFrames=%d textChars=%d reasonChars=%d", state.turnId, state.deltaCount, state.tokenFrameCount, state.textAcc.length, state.reasoningAcc.length);
|
|
8375
8401
|
}
|
|
8376
8402
|
}
|
|
8403
|
+
const repinnedChildren = new Set;
|
|
8404
|
+
function repinChildApprovalPolicy(childId, parentSessionId) {
|
|
8405
|
+
if (binding === undefined || parentSessionId !== binding.sessionId)
|
|
8406
|
+
return;
|
|
8407
|
+
if (repinnedChildren.has(childId))
|
|
8408
|
+
return;
|
|
8409
|
+
const get = ctx.get;
|
|
8410
|
+
if (typeof get !== "function")
|
|
8411
|
+
return;
|
|
8412
|
+
let sessions;
|
|
8413
|
+
let approval;
|
|
8414
|
+
try {
|
|
8415
|
+
sessions = get.call(ctx, "sessions");
|
|
8416
|
+
approval = get.call(ctx, "approval");
|
|
8417
|
+
} catch {
|
|
8418
|
+
return;
|
|
8419
|
+
}
|
|
8420
|
+
if (typeof sessions?.get !== "function")
|
|
8421
|
+
return;
|
|
8422
|
+
let childSession;
|
|
8423
|
+
try {
|
|
8424
|
+
childSession = sessions.get(childId);
|
|
8425
|
+
} catch {
|
|
8426
|
+
return;
|
|
8427
|
+
}
|
|
8428
|
+
if (childSession === undefined || typeof childSession.append !== "function")
|
|
8429
|
+
return;
|
|
8430
|
+
if (approval !== undefined && typeof approval.overrideOf === "function") {
|
|
8431
|
+
const current = approval.overrideOf(childSession);
|
|
8432
|
+
if (current !== undefined && current !== "never") {
|
|
8433
|
+
repinnedChildren.add(childId);
|
|
8434
|
+
return;
|
|
8435
|
+
}
|
|
8436
|
+
}
|
|
8437
|
+
try {
|
|
8438
|
+
childSession.append("approval/policy", { policy: "ask" });
|
|
8439
|
+
repinnedChildren.add(childId);
|
|
8440
|
+
logger.info("[dsh-opentui-bridge] child approval re-pinned to ask child=%s parent=%s (delegation never pin overridden)", childId, parentSessionId);
|
|
8441
|
+
} catch (err) {
|
|
8442
|
+
logger.warn("[dsh-opentui-bridge] child approval re-pin failed child=%s: %s", childId, String(err));
|
|
8443
|
+
}
|
|
8444
|
+
}
|
|
8377
8445
|
function onSessionEvent(session, event) {
|
|
8378
8446
|
const state = activeTurn;
|
|
8379
8447
|
const s = session;
|
|
@@ -8389,13 +8457,16 @@ function apply(ctx, config) {
|
|
|
8389
8457
|
if (!childId)
|
|
8390
8458
|
return;
|
|
8391
8459
|
getSubagentIndex(ctx).noteCatalog(childId, sessionId, typeof data.childCreatedAt === "number" ? data.childCreatedAt : undefined);
|
|
8460
|
+
repinChildApprovalPolicy(childId, sessionId);
|
|
8392
8461
|
const turnId = state !== undefined && !state.ended ? state.turnId : inFlightTurnId ?? "";
|
|
8393
8462
|
const label = typeof data.label === "string" && data.label !== "" ? data.label : typeof data.name === "string" ? data.name : "";
|
|
8463
|
+
const name = typeof data.name === "string" && data.name !== "" ? data.name : "";
|
|
8394
8464
|
emitEvent("agent.spawn", {
|
|
8395
8465
|
turnId,
|
|
8396
8466
|
sessionId: boundId,
|
|
8397
8467
|
childId,
|
|
8398
8468
|
label,
|
|
8469
|
+
...name !== "" ? { name } : {},
|
|
8399
8470
|
runId: `catalog:${childId}`,
|
|
8400
8471
|
seq: 0,
|
|
8401
8472
|
...typeof data.childCreatedAt === "number" ? { childCreatedAt: data.childCreatedAt } : {}
|
|
@@ -8528,10 +8599,18 @@ function apply(ctx, config) {
|
|
|
8528
8599
|
return;
|
|
8529
8600
|
if (state.sessionId !== binding.sessionId)
|
|
8530
8601
|
return;
|
|
8531
|
-
const
|
|
8532
|
-
if (
|
|
8602
|
+
const rawSessionId = agent?.session?.id;
|
|
8603
|
+
if (rawSessionId === undefined)
|
|
8604
|
+
return { turn: state, sessionId: binding.sessionId };
|
|
8605
|
+
const agentSessionId = idString(rawSessionId);
|
|
8606
|
+
if (agentSessionId === binding.sessionId)
|
|
8607
|
+
return { turn: state, sessionId: binding.sessionId };
|
|
8608
|
+
const child = getSubagentIndex(ctx).get(agentSessionId);
|
|
8609
|
+
if (child === undefined || child.parentSessionId !== binding.sessionId || child.status === "settled") {
|
|
8610
|
+
logger.warn("[dsh-opentui-bridge] ask target rejected child session=%s parent=%s (unknown/foreign/settled) — fail-closed", agentSessionId, binding.sessionId);
|
|
8533
8611
|
return;
|
|
8534
|
-
|
|
8612
|
+
}
|
|
8613
|
+
return { turn: state, sessionId: binding.sessionId, childSessionId: agentSessionId };
|
|
8535
8614
|
}
|
|
8536
8615
|
const FAIL_CLOSED_UNKNOWN_SESSION = "unknown";
|
|
8537
8616
|
function failClosedAsk(kind, turnId, sessionId, reason) {
|
|
@@ -8565,7 +8644,8 @@ function apply(ctx, config) {
|
|
|
8565
8644
|
...toolName !== undefined ? { toolName } : {},
|
|
8566
8645
|
...callId !== undefined ? { callId } : {},
|
|
8567
8646
|
...reason !== undefined ? { reason } : {},
|
|
8568
|
-
escalation: true
|
|
8647
|
+
escalation: true,
|
|
8648
|
+
...target.childSessionId !== undefined ? { childSessionId: target.childSessionId, parentSessionId: target.sessionId } : {}
|
|
8569
8649
|
});
|
|
8570
8650
|
} catch (err) {
|
|
8571
8651
|
logger.error("[dsh-opentui-bridge] ask.create(approval) failed: %s", err);
|
|
@@ -8614,7 +8694,8 @@ function apply(ctx, config) {
|
|
|
8614
8694
|
sessionId: target.sessionId,
|
|
8615
8695
|
kind: "questions",
|
|
8616
8696
|
questions,
|
|
8617
|
-
...callId !== undefined ? { callId } : {}
|
|
8697
|
+
...callId !== undefined ? { callId } : {},
|
|
8698
|
+
...target.childSessionId !== undefined ? { childSessionId: target.childSessionId, parentSessionId: target.sessionId } : {}
|
|
8618
8699
|
});
|
|
8619
8700
|
} catch (err) {
|
|
8620
8701
|
logger.error("[dsh-opentui-bridge] ask.create(questions) failed: %s", err);
|
|
@@ -9531,6 +9612,7 @@ export {
|
|
|
9531
9612
|
projectAccountScalarResult,
|
|
9532
9613
|
projectAccountViewForFrame,
|
|
9533
9614
|
redactIdentifier,
|
|
9615
|
+
resolveAskDeadlineMs,
|
|
9534
9616
|
sanitizeFrameForWire,
|
|
9535
9617
|
summarizeAnswers,
|
|
9536
9618
|
turnIdOf,
|