Merge branch 'master' into worktree/dsh-arg-parser

Integrate the Commander argument adapter with master's safe session-resume
feature and dsh web --dev flag.

- args.ts: add --dev to the web parser.
- tui.ts: keep master's process.execve in-place resume handoff, but take the
  adapter's parsed (config, resume); inject the resume id through boot's
  prepare(ctx) hook via ctx.provide(RESUME_SESSION_ID_KEY, id) instead of the
  RESUME_SESSION_ID env var; rebuild the re-exec argv as `dsh --resume <id>`.
- app-boot: drop master's replaceResumeArg (no longer needed) alongside the
  already-removed parseResumeArg; add RESUME_SESSION_ID_KEY.
- the four tui-agent/cordis configs read the ctx-provided resumeSessionId via a
  typeof-guarded !!js expression, so resume needs no env var.
- web.ts: keep master's client roster and --dev watch, take parsed host/port/dev.
This commit is contained in:
Turtle
2026-07-25 12:02:28 +08:00
1479 changed files with 60394 additions and 10691 deletions
+5 -3
View File
@@ -31,11 +31,12 @@ interface HeadlessInvocation {
prompt: string
}
/** Browser UI: `dsh web`. Host constrained to {@link LOOPBACK_HOST}/{@link ALL_INTERFACES_HOST}; port already coerced and range-checked. */
/** Browser UI: `dsh web`. Host constrained to {@link LOOPBACK_HOST}/{@link ALL_INTERFACES_HOST}; port already coerced and range-checked; `dev` mounts the client HMR driver and bundle watch. */
interface WebInvocation {
mode: 'web'
host: string
port: number
dev: boolean
}
/** `--help` or `--version` requested: `bin.ts` prints `text` to stdout and exits 0. */
@@ -108,10 +109,11 @@ function parseWeb(argv: readonly string[], version: string): DshInvocation {
.description('serve the browser UI')
.addOption(new Option('--host <host>', 'bind host').choices([LOOPBACK_HOST, ALL_INTERFACES_HOST]).default(LOOPBACK_HOST))
.addOption(new Option('--port <port>', 'listen port').default(DEFAULT_WEB_PORT).argParser(parsePort))
.option('--dev', 'mount the client HMR driver and watch plugin bundles for rebuilds')
const settled = settle(web, argv, sink)
if (settled !== undefined) return settled
const { host, port } = web.opts<{ host: string; port: number }>()
return { mode: 'web', host, port }
const { host, port, dev } = web.opts<{ host: string; port: number; dev?: boolean }>()
return { mode: 'web', host, port, dev: dev ?? false }
}
/** Parse the default (TUI / headless) arguments: `[config]`, `-p/--prompt`, `--resume`. */