@xmoon76/dsh-pi-tui 0.5.4 → 0.5.6

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.
Files changed (50) hide show
  1. package/README.en.md +46 -42
  2. package/README.md +46 -27
  3. package/cordis.patch.yml +77 -7
  4. package/dist/bootstrap-DQ4YPL-7.mjs +113583 -0
  5. package/dist/builtins.mjs +3 -9
  6. package/dist/{runtime-vc4mdr-R.mjs → client-bootstrap-Cr1JCaF5.mjs} +3670 -2277
  7. package/dist/disposal-BYBbEpVY.mjs +54 -0
  8. package/dist/dist-CIsR7cz4.mjs +15717 -0
  9. package/dist/{entry-control-DvSrndWd.mjs → entry-control-DnduyDiw.mjs} +12 -31
  10. package/dist/{extensions-CcuMY4n2.mjs → extensions-Bp0L37lP.mjs} +1239 -271
  11. package/dist/extensions.mjs +1 -1
  12. package/dist/host-bootstrap-DilsvA6f.mjs +281 -0
  13. package/dist/host-foundation-probe--5jtvHVe.mjs +413 -0
  14. package/dist/host-runtime.d.mts +30 -0
  15. package/dist/host-runtime.mjs +1317 -0
  16. package/dist/index.d.mts +19 -18
  17. package/dist/index.mjs +18410 -8836
  18. package/dist/local-client.mjs +2027 -187
  19. package/dist/local-discovery-C9VMjc0K.mjs +759 -0
  20. package/dist/local-discovery-CDaQHA_R.mjs +2 -0
  21. package/dist/local-host.mjs +1088 -87
  22. package/dist/local-transport-BVwFYq_Y.mjs +513 -0
  23. package/dist/{context-summary-DAisTA_7.mjs → pasted-path-range-CMnxuGPx.mjs} +7613 -216
  24. package/dist/pasted-path-range-r6qzV_tC.mjs +17510 -0
  25. package/dist/performance-host.d.mts +2 -2
  26. package/dist/performance-host.mjs +258 -1
  27. package/dist/pi-tui-remote-contribution-B0EQsP0N.mjs +85 -0
  28. package/dist/pi-tui-terminal-progress-contract-CdBH9j78.mjs +70 -0
  29. package/dist/pi-tui-terminal-progress-contract-MLXZ-i3t.mjs +905 -0
  30. package/dist/pi-tui-web-access-contract-BN8Cc_Ho.mjs +118 -0
  31. package/dist/{runtime-status-0lp9CM0V.mjs → runtime-status-Cj1nFOdS.mjs} +72 -214
  32. package/dist/session-BKGXyh80.mjs +15794 -0
  33. package/dist/{session-tdJHLnJR.mjs → session-CPt_U8_f.mjs} +10707 -3657
  34. package/dist/{startup-JaVZoTIl.mjs → startup-7BYWuvBU.mjs} +124 -8
  35. package/dist/startup.d.mts +1 -1
  36. package/dist/startup.mjs +1 -1
  37. package/dist/{client-bootstrap-F5DHFI9t.mjs → terminal-progress-source-DrqQhtT8.mjs} +3653 -2969
  38. package/dist/visual-tools.d.mts +2 -2
  39. package/dist/visual-tools.mjs +26 -31
  40. package/dist/web-preferences.d.mts +29 -0
  41. package/dist/web-preferences.mjs +15 -0
  42. package/dist/web-roster-CjqnUXNk.mjs +285 -0
  43. package/generated/dsh-presets/cordis.patch.yml +5 -3
  44. package/generated/dsh-presets/ptc.patch.yml +7 -7
  45. package/generated/dsh-presets/standard.patch.yml +6 -4
  46. package/package.json +195 -172
  47. package/dist/host-bootstrap-DAgKknbY.mjs +0 -119
  48. package/dist/performance-host-CcDJjjVA.mjs +0 -266
  49. package/dist/rolldown-runtime-8H4AJuhK.mjs +0 -14
  50. package/dist/terminal-progress-source-xor3vakJ.mjs +0 -2256
@@ -1,5 +1,6 @@
1
1
  import { Command } from "commander";
2
- import { readFileSync, realpathSync } from "node:fs";
2
+ import { closeSync, mkdirSync, openSync, readFileSync, realpathSync, writeSync } from "node:fs";
3
+ import { homedir } from "node:os";
3
4
  import { basename, dirname, join } from "node:path";
4
5
  import { parseCmdline } from "@deepseek-ai/dsh-cmdline";
5
6
  //#region src/dsh-compat-matrix.json
@@ -32,11 +33,11 @@ var dsh_compat_matrix_default = {
32
33
  "not by itself qualify every such prerelease."
33
34
  ],
34
35
  current: {
35
- "since": "0.5.4",
36
- "requires": "DeepSeek Harness 0.2.1-rc.2 or later",
37
- "upgradeDsh": "0.2.1-rc.4",
38
- "upgradeCommand": "npm install -g --allow-scripts=@deepseek-ai/dsh-subprocess-local,koffi,node-pty @deepseek-ai/dsh@0.2.1-rc.4",
39
- "guidance": "The published 0.5.4 release requires DeepSeek Harness 0.2.1-rc.2 or later; this checkout validates that runtime floor and targets 0.2.1-rc.4. See README.en.md for the DSH/TUI pairing table, and docs/guides/dsh-compatibility.md for compatibility/recovery rules."
36
+ "since": "0.5.6",
37
+ "requires": "DeepSeek Harness 0.2.2-rc.1 or later",
38
+ "upgradeDsh": "0.2.2-rc.1",
39
+ "upgradeCommand": "npm install -g --allow-scripts=@deepseek-ai/dsh-subprocess-local,koffi,node-pty @deepseek-ai/dsh@0.2.2-rc.1",
40
+ "guidance": "The 0.5.6 release requires DeepSeek Harness 0.2.2-rc.1 or later; this checkout validates that runtime floor and targets 0.2.2-rc.1. The previous 0.2.1-rc.* family is no longer supported, so finish in-flight turns and background jobs before upgrading. See README.en.md for the DSH/TUI pairing table, and docs/guides/dsh-compatibility.md for compatibility/recovery rules."
40
41
  },
41
42
  floor: {
42
43
  "below": "0.1.0-rc.8",
@@ -121,12 +122,18 @@ var dsh_compat_matrix_default = {
121
122
  },
122
123
  {
123
124
  "dshFrom": "0.2.1-rc.2",
124
- "tui": "0.5.4",
125
+ "tui": "0.5.5",
125
126
  "versions": [
126
127
  "0.2.1-rc.2",
127
128
  "0.2.1-rc.3",
128
- "0.2.1-rc.4"
129
+ "0.2.1-rc.4",
130
+ "0.2.1-rc.5"
129
131
  ]
132
+ },
133
+ {
134
+ "dshFrom": "0.2.2-rc.1",
135
+ "tui": "0.5.6",
136
+ "versions": ["0.2.2-rc.1"]
130
137
  }
131
138
  ]
132
139
  };
@@ -317,6 +324,114 @@ Examples:
317
324
  dsh --profile pi-tui --preset minimal fresh session on the minimal preset
318
325
  `);
319
326
  }
327
+ /** The two official provider tags whose model-listing diagnostics leave the
328
+ * terminal. The tag is the provider plugin name in brackets, exactly as
329
+ * `createModelListingCache` builds it from its `owner` argument. */
330
+ const MODEL_LISTING_TAGS = ["[llm-deepseek-account]", "[llm-deepseek-api-key]"];
331
+ /**
332
+ * The process-wide interception. The workaround is a process-global resource:
333
+ * a row can be RE-APPLIED before its previous fiber unloads (HMR), so
334
+ * overlapping installs share ONE console chain and ONE log file instead of
335
+ * nesting wrappers. The log path is resolved once because it is process-scoped
336
+ * (`<pid>` plus `$DSH_HOME`).
337
+ */
338
+ let modelListingLog;
339
+ let modelListingLogOwners = 0;
340
+ let restoreModelListingConsole;
341
+ /** Append one diagnostic line to the workaround's log, reporting whether the
342
+ * write succeeded. A failure disables the file sink for the rest of the
343
+ * process and lets the caller fall back to the original console. */
344
+ function appendModelListingLine(log, tag, message) {
345
+ if (log.fileDisabled) return false;
346
+ if (log.fileHandle === void 0) try {
347
+ mkdirSync(dirname(log.logPath), { recursive: true });
348
+ log.fileHandle = openSync(log.logPath, "a", 384);
349
+ } catch {
350
+ log.fileDisabled = true;
351
+ return false;
352
+ }
353
+ try {
354
+ writeSync(log.fileHandle, `${(/* @__PURE__ */ new Date()).toISOString()} ${tag} ${message}\n`);
355
+ return true;
356
+ } catch {
357
+ log.fileDisabled = true;
358
+ return false;
359
+ }
360
+ }
361
+ /** Replace `console.error`/`console.warn` with the diverting wrappers for one
362
+ * log sink and return the disposer that restores them. Only the verified
363
+ * `(tag, message)` shape of the two official provider tags is diverted; every
364
+ * other call is handed back to the method captured here. */
365
+ function interceptModelListingConsole(log) {
366
+ const intercept = (original) => {
367
+ return (...args) => {
368
+ const [tag, message] = args;
369
+ if (log.active && args.length === 2 && typeof tag === "string" && MODEL_LISTING_TAGS.includes(tag) && typeof message === "string") {
370
+ if (appendModelListingLine(log, tag, message)) return;
371
+ }
372
+ original.apply(console, args);
373
+ };
374
+ };
375
+ const originalError = console.error;
376
+ const originalWarn = console.warn;
377
+ const errorWrapper = intercept(originalError);
378
+ const warnWrapper = intercept(originalWarn);
379
+ console.error = errorWrapper;
380
+ console.warn = warnWrapper;
381
+ return () => {
382
+ if (console.error === errorWrapper) console.error = originalError;
383
+ if (console.warn === warnWrapper) console.warn = originalWarn;
384
+ if (log.fileHandle !== void 0) {
385
+ try {
386
+ closeSync(log.fileHandle);
387
+ } catch {}
388
+ log.fileHandle = void 0;
389
+ }
390
+ };
391
+ }
392
+ /**
393
+ * Route the two official providers' model-listing diagnostics to a file
394
+ * instead of the interactive terminal.
395
+ *
396
+ * The interception is deliberately narrow: only a `console.error`/`console.warn`
397
+ * call with exactly two arguments — one of the two provider tags and a string
398
+ * message — is diverted. Every other call is handed back to the original
399
+ * method untouched.
400
+ *
401
+ * The log file is opened lazily (only when the first matching line arrives),
402
+ * so a plain `--help` run or a session that never lists models leaves no
403
+ * empty file behind. A write failure falls back to the original console
404
+ * output: a broken diagnostics directory must never keep the TUI from
405
+ * starting, and the diagnostic must never disappear silently.
406
+ *
407
+ * @returns the disposer that releases this owner; the console methods are
408
+ * restored when the LAST owner unloads.
409
+ */
410
+ function installModelListingLogInterceptor() {
411
+ if (modelListingLogOwners === 0) {
412
+ const log = {
413
+ logPath: join(process.env.DSH_HOME !== void 0 && process.env.DSH_HOME !== "" ? process.env.DSH_HOME : join(homedir(), ".dsh"), "logs", `dsh-model-listing-${process.pid}.log`),
414
+ fileDisabled: false,
415
+ active: true
416
+ };
417
+ modelListingLog = log;
418
+ restoreModelListingConsole = interceptModelListingConsole(log);
419
+ }
420
+ modelListingLogOwners += 1;
421
+ let released = false;
422
+ return () => {
423
+ if (released) return;
424
+ released = true;
425
+ modelListingLogOwners -= 1;
426
+ if (modelListingLogOwners > 0) return;
427
+ const log = modelListingLog;
428
+ modelListingLog = void 0;
429
+ if (log !== void 0) log.active = false;
430
+ const restore = restoreModelListingConsole;
431
+ restoreModelListingConsole = void 0;
432
+ restore?.();
433
+ };
434
+ }
320
435
  /**
321
436
  * Parse and provide the TUI invocation as an ordinary Cordis service. The
322
437
  * command's action publishes the flags this invocation named; on `--help`
@@ -326,6 +441,7 @@ Examples:
326
441
  function apply(ctx) {
327
442
  const program = tuiCommand();
328
443
  program.action(() => {
444
+ if (!isHostOnlyRole()) ctx.effect(() => installModelListingLogInterceptor(), "tui-startup model-listing log interception");
329
445
  const installed = installedDshVersion();
330
446
  if (installed !== void 0) {
331
447
  const entry = harnessCompatEntryFor(installed);
@@ -20,7 +20,7 @@ declare const inject: string[];
20
20
  *
21
21
  * The current line has a minimum of the published npm release
22
22
  * dsh-v0.2.1-rc.2 and a recommended upgrade target of the newer
23
- * dsh-v0.2.1-rc.4. The recovery guidance names the recommended published
23
+ * dsh-v0.2.1-rc.5. The recovery guidance names the recommended published
24
24
  * upgrade target — which may be NEWER than the floor — and allows its native
25
25
  * install scripts. The already-published 0.5.0 line keeps its own
26
26
  * rc.1-era contract and remains the compatible fallback for a
package/dist/startup.mjs CHANGED
@@ -1,2 +1,2 @@
1
- import { a as harnessCompatEntryFor, c as name, i as bundleVersionLabel, n as TUI_STARTUP_SERVICE, o as incompatibleHarnessMessage, r as apply, s as inject, t as HARNESS_COMPAT } from "./startup-JaVZoTIl.mjs";
1
+ import { a as harnessCompatEntryFor, c as name, i as bundleVersionLabel, n as TUI_STARTUP_SERVICE, o as incompatibleHarnessMessage, r as apply, s as inject, t as HARNESS_COMPAT } from "./startup-7BYWuvBU.mjs";
2
2
  export { HARNESS_COMPAT, TUI_STARTUP_SERVICE, apply, bundleVersionLabel, harnessCompatEntryFor, incompatibleHarnessMessage, inject, name };