@xmoon76/dsh-pi-tui 0.5.5 → 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.
- package/README.en.md +30 -47
- package/README.md +30 -30
- package/cordis.patch.yml +77 -7
- package/dist/{bootstrap-DLOydLLj.mjs → bootstrap-DQ4YPL-7.mjs} +12416 -7243
- package/dist/builtins.mjs +3 -8
- package/dist/{application-runtime-CbBO4bY-.mjs → client-bootstrap-Cr1JCaF5.mjs} +3098 -1747
- package/dist/{dist-C7QMk0ws.mjs → dist-CIsR7cz4.mjs} +510 -224
- package/dist/{extensions-pcFiH7Qe.mjs → extensions-Bp0L37lP.mjs} +527 -249
- package/dist/extensions.mjs +1 -1
- package/dist/{host-bootstrap-CKdfLkNS.mjs → host-bootstrap-DilsvA6f.mjs} +106 -13
- package/dist/host-foundation-probe--5jtvHVe.mjs +413 -0
- package/dist/host-runtime.d.mts +10 -6
- package/dist/host-runtime.mjs +877 -10
- package/dist/index.d.mts +11 -17
- package/dist/index.mjs +13328 -6828
- package/dist/local-client.mjs +408 -61
- package/dist/{local-discovery-CXnLT4GF.mjs → local-discovery-C9VMjc0K.mjs} +10 -6
- package/dist/{local-discovery-DVFFpfBG.mjs → local-discovery-CDaQHA_R.mjs} +1 -1
- package/dist/local-host.mjs +188 -36
- package/dist/{local-transport-C9aonplC.mjs → local-transport-BVwFYq_Y.mjs} +1 -1
- package/dist/{context-summary-D9mhxPXL.mjs → pasted-path-range-CMnxuGPx.mjs} +6166 -227
- package/dist/{context-summary-Bz0AGXa1.mjs → pasted-path-range-r6qzV_tC.mjs} +5927 -444
- package/dist/{pi-tui-remote-contribution-DRk6Tl3J.mjs → pi-tui-remote-contribution-B0EQsP0N.mjs} +27 -20
- package/dist/{pi-tui-terminal-progress-contract-XTQKj-WW.mjs → pi-tui-terminal-progress-contract-MLXZ-i3t.mjs} +2 -2
- package/dist/pi-tui-web-access-contract-BN8Cc_Ho.mjs +118 -0
- package/dist/{runtime-status-0lp9CM0V.mjs → runtime-status-Cj1nFOdS.mjs} +72 -214
- package/dist/{session-4keoXjk0.mjs → session-BKGXyh80.mjs} +7487 -2562
- package/dist/{session-B2zqv4wr.mjs → session-CPt_U8_f.mjs} +7486 -2560
- package/dist/{startup-Ct2UUjUL.mjs → startup-7BYWuvBU.mjs} +121 -6
- package/dist/startup.mjs +1 -1
- package/dist/{terminal-progress-source-BhufrZ74.mjs → terminal-progress-source-DrqQhtT8.mjs} +305 -45
- package/dist/visual-tools.d.mts +2 -2
- package/dist/visual-tools.mjs +26 -31
- package/dist/web-preferences.d.mts +29 -0
- package/dist/web-preferences.mjs +15 -0
- package/dist/web-roster-CjqnUXNk.mjs +285 -0
- package/generated/dsh-presets/cordis.patch.yml +5 -3
- package/generated/dsh-presets/ptc.patch.yml +7 -7
- package/generated/dsh-presets/standard.patch.yml +6 -4
- package/package.json +182 -168
- package/dist/client-bootstrap-DwSFzcTW.mjs +0 -872
- package/dist/custom-items-CKrOBCox.mjs +0 -655
- package/dist/dispose-cause-BzcXo4hu.mjs +0 -123
- package/dist/host-foundation-probe-CYHsbAw6.mjs +0 -143
- package/dist/host-prerequisites-9JBTtVNu.mjs +0 -36
- package/dist/runtime-Bh5OsftD.mjs +0 -6798
- package/dist/runtime-C5ROZqFj.mjs +0 -2
- package/dist/terminal-progress-source-CsBinCJ_.mjs +0 -965
|
@@ -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.
|
|
36
|
-
"requires": "DeepSeek Harness 0.2.
|
|
37
|
-
"upgradeDsh": "0.2.
|
|
38
|
-
"upgradeCommand": "npm install -g --allow-scripts=@deepseek-ai/dsh-subprocess-local,koffi,node-pty @deepseek-ai/dsh@0.2.
|
|
39
|
-
"guidance": "The 0.5.
|
|
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",
|
|
@@ -128,6 +129,11 @@ var dsh_compat_matrix_default = {
|
|
|
128
129
|
"0.2.1-rc.4",
|
|
129
130
|
"0.2.1-rc.5"
|
|
130
131
|
]
|
|
132
|
+
},
|
|
133
|
+
{
|
|
134
|
+
"dshFrom": "0.2.2-rc.1",
|
|
135
|
+
"tui": "0.5.6",
|
|
136
|
+
"versions": ["0.2.2-rc.1"]
|
|
131
137
|
}
|
|
132
138
|
]
|
|
133
139
|
};
|
|
@@ -318,6 +324,114 @@ Examples:
|
|
|
318
324
|
dsh --profile pi-tui --preset minimal fresh session on the minimal preset
|
|
319
325
|
`);
|
|
320
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
|
+
}
|
|
321
435
|
/**
|
|
322
436
|
* Parse and provide the TUI invocation as an ordinary Cordis service. The
|
|
323
437
|
* command's action publishes the flags this invocation named; on `--help`
|
|
@@ -327,6 +441,7 @@ Examples:
|
|
|
327
441
|
function apply(ctx) {
|
|
328
442
|
const program = tuiCommand();
|
|
329
443
|
program.action(() => {
|
|
444
|
+
if (!isHostOnlyRole()) ctx.effect(() => installModelListingLogInterceptor(), "tui-startup model-listing log interception");
|
|
330
445
|
const installed = installedDshVersion();
|
|
331
446
|
if (installed !== void 0) {
|
|
332
447
|
const entry = harnessCompatEntryFor(installed);
|
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-
|
|
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 };
|
package/dist/{terminal-progress-source-BhufrZ74.mjs → terminal-progress-source-DrqQhtT8.mjs}
RENAMED
|
@@ -1,8 +1,10 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { n as isCancellation, o as safeErrorMessage } from "./tasks-D_z5Yjjr.mjs";
|
|
2
|
+
import { F as parseKey, M as isKeyRelease, N as isKeyRepeat, ut as stripControlChars } from "./dist-CIsR7cz4.mjs";
|
|
2
3
|
import { r as parsePiTuiTerminalProgressFrame } from "./pi-tui-terminal-progress-contract-CdBH9j78.mjs";
|
|
3
4
|
import "node:module";
|
|
4
5
|
import { readFileSync, realpathSync } from "node:fs";
|
|
5
6
|
import { dirname, join } from "node:path";
|
|
7
|
+
import "node:os";
|
|
6
8
|
import "commander";
|
|
7
9
|
import "@deepseek-ai/dsh-cmdline";
|
|
8
10
|
import { parseCommand } from "@deepseek-ai/dsh-commands";
|
|
@@ -51,11 +53,11 @@ const COMPAT = {
|
|
|
51
53
|
"not by itself qualify every such prerelease."
|
|
52
54
|
],
|
|
53
55
|
current: {
|
|
54
|
-
"since": "0.5.
|
|
55
|
-
"requires": "DeepSeek Harness 0.2.
|
|
56
|
-
"upgradeDsh": "0.2.
|
|
57
|
-
"upgradeCommand": "npm install -g --allow-scripts=@deepseek-ai/dsh-subprocess-local,koffi,node-pty @deepseek-ai/dsh@0.2.
|
|
58
|
-
"guidance": "The 0.5.
|
|
56
|
+
"since": "0.5.6",
|
|
57
|
+
"requires": "DeepSeek Harness 0.2.2-rc.1 or later",
|
|
58
|
+
"upgradeDsh": "0.2.2-rc.1",
|
|
59
|
+
"upgradeCommand": "npm install -g --allow-scripts=@deepseek-ai/dsh-subprocess-local,koffi,node-pty @deepseek-ai/dsh@0.2.2-rc.1",
|
|
60
|
+
"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."
|
|
59
61
|
},
|
|
60
62
|
floor: {
|
|
61
63
|
"below": "0.1.0-rc.8",
|
|
@@ -147,6 +149,11 @@ const COMPAT = {
|
|
|
147
149
|
"0.2.1-rc.4",
|
|
148
150
|
"0.2.1-rc.5"
|
|
149
151
|
]
|
|
152
|
+
},
|
|
153
|
+
{
|
|
154
|
+
"dshFrom": "0.2.2-rc.1",
|
|
155
|
+
"tui": "0.5.6",
|
|
156
|
+
"versions": ["0.2.2-rc.1"]
|
|
150
157
|
}
|
|
151
158
|
]
|
|
152
159
|
};
|
|
@@ -1077,6 +1084,14 @@ const APP_KEYBINDINGS = {
|
|
|
1077
1084
|
scope: "question",
|
|
1078
1085
|
configurable: false
|
|
1079
1086
|
},
|
|
1087
|
+
"interaction.navigateWorkspace": {
|
|
1088
|
+
id: "interaction.navigateWorkspace",
|
|
1089
|
+
defaultKeys: ["alt+w"],
|
|
1090
|
+
description: "Open the Session Workspace without answering the pending interaction",
|
|
1091
|
+
category: "Question",
|
|
1092
|
+
scope: "overlay",
|
|
1093
|
+
configurable: false
|
|
1094
|
+
},
|
|
1080
1095
|
"tasks.open": {
|
|
1081
1096
|
id: "tasks.open",
|
|
1082
1097
|
defaultKeys: ["enter"],
|
|
@@ -1490,6 +1505,25 @@ function parseUserKeybindings(raw, options = {}) {
|
|
|
1490
1505
|
const DEFAULT_LEADER_TIMEOUT_MS = 1500;
|
|
1491
1506
|
//#endregion
|
|
1492
1507
|
//#region src/runtime/session-lifecycle-port.ts
|
|
1508
|
+
/**
|
|
1509
|
+
* A workspace pre-selection failure. `refused` is a proven Host business
|
|
1510
|
+
* refusal (invalid path, unknown Workspace); `unavailable` means the Host
|
|
1511
|
+
* Workspace authority could not be read or the directory could not be
|
|
1512
|
+
* confirmed; `superseded` means the caller's generation/lifetime changed while
|
|
1513
|
+
* the selection was in flight and the result must not reach a newer surface.
|
|
1514
|
+
* In every case ZERO Session creates were dispatched.
|
|
1515
|
+
*/
|
|
1516
|
+
var WorkspaceSelectionError = class extends Error {
|
|
1517
|
+
kind;
|
|
1518
|
+
/** Stable machine-readable cause when the Host supplied one. */
|
|
1519
|
+
code;
|
|
1520
|
+
constructor(kind, message, code) {
|
|
1521
|
+
super(message);
|
|
1522
|
+
this.name = "WorkspaceSelectionError";
|
|
1523
|
+
this.kind = kind;
|
|
1524
|
+
this.code = code;
|
|
1525
|
+
}
|
|
1526
|
+
};
|
|
1493
1527
|
/** A lifecycle outcome that must ABORT the caller's transition, carrying the
|
|
1494
1528
|
* two independent axes so a Remote caller never has to parse a string. */
|
|
1495
1529
|
var LifecycleError = class extends Error {
|
|
@@ -2046,12 +2080,14 @@ const SESSIONLESS_COMMANDS = /* @__PURE__ */ new Set([
|
|
|
2046
2080
|
"preset",
|
|
2047
2081
|
"keybindings",
|
|
2048
2082
|
"plugins",
|
|
2083
|
+
"web",
|
|
2049
2084
|
"quit",
|
|
2050
2085
|
"statusline",
|
|
2051
2086
|
"status",
|
|
2052
2087
|
"view-image",
|
|
2053
2088
|
"deliverables",
|
|
2054
|
-
"reload-client"
|
|
2089
|
+
"reload-client",
|
|
2090
|
+
"schedule"
|
|
2055
2091
|
]);
|
|
2056
2092
|
/**
|
|
2057
2093
|
* The LOCAL-execute command set (PR5 v2 §1C-6 narrows its semantic role):
|
|
@@ -2110,10 +2146,12 @@ const LOCAL_COMMANDS = /* @__PURE__ */ new Set([
|
|
|
2110
2146
|
"title",
|
|
2111
2147
|
"transcript",
|
|
2112
2148
|
"yolo",
|
|
2149
|
+
"web",
|
|
2113
2150
|
"view-image",
|
|
2114
2151
|
"deliverables",
|
|
2115
2152
|
"statusline",
|
|
2116
|
-
"reload-client"
|
|
2153
|
+
"reload-client",
|
|
2154
|
+
"schedule"
|
|
2117
2155
|
]);
|
|
2118
2156
|
/**
|
|
2119
2157
|
* The STATIC host-owned command catalog (P1-04): the ownership sets
|
|
@@ -5332,41 +5370,35 @@ function apply(ctx) {
|
|
|
5332
5370
|
new PiTuiExtensionServiceImpl(ctx, packageVersion(), () => {}, HOST_COMMAND_CATALOG);
|
|
5333
5371
|
}
|
|
5334
5372
|
//#endregion
|
|
5335
|
-
//#region src/runtime/
|
|
5336
|
-
/**
|
|
5337
|
-
*
|
|
5338
|
-
*
|
|
5339
|
-
*
|
|
5340
|
-
|
|
5341
|
-
|
|
5342
|
-
|
|
5343
|
-
"
|
|
5344
|
-
|
|
5345
|
-
|
|
5346
|
-
|
|
5347
|
-
|
|
5348
|
-
|
|
5349
|
-
|
|
5350
|
-
|
|
5351
|
-
|
|
5352
|
-
|
|
5353
|
-
|
|
5354
|
-
|
|
5355
|
-
*
|
|
5356
|
-
|
|
5357
|
-
|
|
5358
|
-
"
|
|
5359
|
-
|
|
5360
|
-
|
|
5361
|
-
|
|
5362
|
-
|
|
5363
|
-
|
|
5364
|
-
"host-file",
|
|
5365
|
-
"session-archive",
|
|
5366
|
-
"host-command",
|
|
5367
|
-
"plugin-manager",
|
|
5368
|
-
"job-observation"
|
|
5369
|
-
];
|
|
5373
|
+
//#region src/runtime/schedule-port.ts
|
|
5374
|
+
/**
|
|
5375
|
+
* The ONE truthful "this backend serves no Schedule domain" failure. It is
|
|
5376
|
+
* thrown when the Direct Host mounts no `schedule` service or the authenticated
|
|
5377
|
+
* Remote composition exposes no `schedule` namespace; it is never replaced by
|
|
5378
|
+
* an empty catalog, a Client-side store or a Direct fallback write.
|
|
5379
|
+
*/
|
|
5380
|
+
var ScheduleUnavailableError = class extends Error {
|
|
5381
|
+
code = "schedule_unavailable";
|
|
5382
|
+
constructor(message, options) {
|
|
5383
|
+
super(message, options);
|
|
5384
|
+
this.name = "ScheduleUnavailableError";
|
|
5385
|
+
}
|
|
5386
|
+
};
|
|
5387
|
+
/**
|
|
5388
|
+
* A mutation that was DISPATCHED but whose settlement the current Client can no
|
|
5389
|
+
* longer prove (the Connection generation was replaced, the transport failed,
|
|
5390
|
+
* or a cancellation raced the Host transaction). The Host may still have
|
|
5391
|
+
* committed it, so the caller must re-read the authoritative catalog and must
|
|
5392
|
+
* NEVER replay the write. This is the ONE unknown-outcome error: an official
|
|
5393
|
+
* refusal keeps its own code and is never reported through this type.
|
|
5394
|
+
*/
|
|
5395
|
+
var ScheduleOutcomeUnknownError = class extends Error {
|
|
5396
|
+
code = "schedule_outcome_unknown";
|
|
5397
|
+
constructor(message, options) {
|
|
5398
|
+
super(message, options);
|
|
5399
|
+
this.name = "ScheduleOutcomeUnknownError";
|
|
5400
|
+
}
|
|
5401
|
+
};
|
|
5370
5402
|
//#endregion
|
|
5371
5403
|
//#region src/runtime/write-outcome.ts
|
|
5372
5404
|
/**
|
|
@@ -5393,7 +5425,8 @@ const GATEWAY_PRE_INVOCATION_CODES = /* @__PURE__ */ new Set([
|
|
|
5393
5425
|
"gateway/method-unavailable",
|
|
5394
5426
|
"gateway/provider-mismatch",
|
|
5395
5427
|
"gateway/service-unavailable",
|
|
5396
|
-
"gateway/signature-invalid"
|
|
5428
|
+
"gateway/signature-invalid",
|
|
5429
|
+
"gateway/interactions-forbidden"
|
|
5397
5430
|
]);
|
|
5398
5431
|
/**
|
|
5399
5432
|
* Whether a failure code PROVES the addressed operation was refused: domain
|
|
@@ -5417,6 +5450,179 @@ function isRemoteBusinessRefusalCode(code) {
|
|
|
5417
5450
|
return true;
|
|
5418
5451
|
}
|
|
5419
5452
|
//#endregion
|
|
5453
|
+
//#region src/runtime/remote/write-failure.ts
|
|
5454
|
+
/**
|
|
5455
|
+
* Remote write settlement classification (D2.2): map one official Client
|
|
5456
|
+
* `RemoteResult` failure into the shared `WriteOutcome` vocabulary without
|
|
5457
|
+
* inventing a second Remote-only taxonomy.
|
|
5458
|
+
*
|
|
5459
|
+
* The official failure vocabulary is code-discriminated. Business refusals
|
|
5460
|
+
* carry their domain code (`session/*`, `subagent/*`, `agent-preset/*`, ...),
|
|
5461
|
+
* the gateway's own admission code (`gateway/bad-request`), or one of the
|
|
5462
|
+
* pinned Gateway's infrastructure codes that are raised BEFORE the addressed
|
|
5463
|
+
* business method runs (descriptor/argument/receiver/endpoint resolution and
|
|
5464
|
+
* context/lookup provider resolution), so the operation definitely did not
|
|
5465
|
+
* commit. `gateway/cancelled` is a caller cancellation; `gateway/internal` and
|
|
5466
|
+
* `gateway/result-invalid` (which the Gateway raises AFTER the method returned)
|
|
5467
|
+
* leave the commit state unproven. A failure this classifier cannot prove was a
|
|
5468
|
+
* refusal must never be reported as `rejected` — it stays `indeterminate`,
|
|
5469
|
+
* because the write may still have committed.
|
|
5470
|
+
*
|
|
5471
|
+
* @module @xmoon76/dsh-pi-tui/runtime/remote/write-failure
|
|
5472
|
+
*/
|
|
5473
|
+
/** Read the stable code off a structural official failure. */
|
|
5474
|
+
function remoteFailureCode(error) {
|
|
5475
|
+
if (typeof error !== "object" || error === null) return void 0;
|
|
5476
|
+
const code = error.code;
|
|
5477
|
+
return typeof code === "string" && code !== "" ? code : void 0;
|
|
5478
|
+
}
|
|
5479
|
+
/**
|
|
5480
|
+
* The official Client carrier rebuilds a failure as a plain `{code, message,
|
|
5481
|
+
* details}` value across the wire, not necessarily an `Error` instance.
|
|
5482
|
+
* `safeErrorMessage` would `String()` such an object to `[object Object]`, so
|
|
5483
|
+
* prefer the structural `message` string before falling back.
|
|
5484
|
+
*/
|
|
5485
|
+
function remoteFailureMessage(error) {
|
|
5486
|
+
if (typeof error === "object" && error !== null) {
|
|
5487
|
+
const message = error.message;
|
|
5488
|
+
if (typeof message === "string") return message;
|
|
5489
|
+
}
|
|
5490
|
+
return safeErrorMessage(error);
|
|
5491
|
+
}
|
|
5492
|
+
/** A caller/backend cancellation proved by the official code or the error name. */
|
|
5493
|
+
function isRemoteCancellation(error) {
|
|
5494
|
+
if (isCancellation(error)) return true;
|
|
5495
|
+
return remoteFailureCode(error) === "gateway/cancelled";
|
|
5496
|
+
}
|
|
5497
|
+
/** Whether one value is a structurally-owned wire record (never an array, a
|
|
5498
|
+
* class instance, or a primitive). */
|
|
5499
|
+
function isPlainRecord(value) {
|
|
5500
|
+
if (typeof value !== "object" || value === null || Array.isArray(value)) return false;
|
|
5501
|
+
const prototype = Object.getPrototypeOf(value);
|
|
5502
|
+
return prototype === Object.prototype || prototype === null;
|
|
5503
|
+
}
|
|
5504
|
+
/**
|
|
5505
|
+
* Copy one wire-shaped value into an owned frozen plain tree.
|
|
5506
|
+
*
|
|
5507
|
+
* The official failure `details` crosses the wire as JSON — nested `issues`
|
|
5508
|
+
* arrays and objects included — so plain objects, arrays and scalars are the
|
|
5509
|
+
* only transferable shapes. A non-plain value (a Host class instance,
|
|
5510
|
+
* function, symbol or bigint) is not wire data: it is detached to `undefined`
|
|
5511
|
+
* rather than escaping as a live Host object.
|
|
5512
|
+
*/
|
|
5513
|
+
function detachWireValue(value) {
|
|
5514
|
+
if (typeof value === "function" || typeof value === "symbol" || typeof value === "bigint") return void 0;
|
|
5515
|
+
if (value === null || typeof value !== "object") return value;
|
|
5516
|
+
if (Array.isArray(value)) return Object.freeze(value.map(detachWireValue));
|
|
5517
|
+
if (!isPlainRecord(value)) return void 0;
|
|
5518
|
+
const copy = {};
|
|
5519
|
+
for (const [key, entry] of Object.entries(value)) copy[key] = detachWireValue(entry);
|
|
5520
|
+
return Object.freeze(copy);
|
|
5521
|
+
}
|
|
5522
|
+
/**
|
|
5523
|
+
* Copy the official failure `details` into an owned, deeply frozen plain tree
|
|
5524
|
+
* so no Host-owned object — nested arrays/objects included — escapes the
|
|
5525
|
+
* adapter. A non-record `details` value, and an empty one that carries no
|
|
5526
|
+
* structural payload, is dropped.
|
|
5527
|
+
*/
|
|
5528
|
+
function copyFailureDetails(error) {
|
|
5529
|
+
if (typeof error !== "object" || error === null) return void 0;
|
|
5530
|
+
if (!isPlainRecord(error.details)) return void 0;
|
|
5531
|
+
const copy = {};
|
|
5532
|
+
for (const [key, entry] of Object.entries(error.details)) copy[key] = detachWireValue(entry);
|
|
5533
|
+
const detached = Object.freeze(copy);
|
|
5534
|
+
return Object.keys(detached).length === 0 ? void 0 : detached;
|
|
5535
|
+
}
|
|
5536
|
+
/** Actionable recovery guidance for `session/writer-held`.
|
|
5537
|
+
*
|
|
5538
|
+
* The official Host reports only that a Session writer handle is held; it
|
|
5539
|
+
* cannot tell which process or context owns it, and the TUI must never take
|
|
5540
|
+
* over, kill a holder, force a resume, or retry automatically. The guidance is
|
|
5541
|
+
* therefore a recovery action for the user, and it must not claim a specific
|
|
5542
|
+
* holder. */
|
|
5543
|
+
const SESSION_WRITER_HELD_GUIDANCE = "this Session is already in use, possibly by another running DSH instance or context; exit the instance or context holding it, then retry";
|
|
5544
|
+
/** The user-facing message for one settled failure code. `session/writer-held`
|
|
5545
|
+
* replaces the Host's internal diagnostic with actionable recovery guidance —
|
|
5546
|
+
* the code and `details` keep the machine-readable facts. */
|
|
5547
|
+
function settledWriteMessage(code, error) {
|
|
5548
|
+
return code === "session/writer-held" ? SESSION_WRITER_HELD_GUIDANCE : remoteFailureMessage(error);
|
|
5549
|
+
}
|
|
5550
|
+
/**
|
|
5551
|
+
* Classify one failed official write (a `RemoteResult` error branch) into the
|
|
5552
|
+
* shared non-committed outcome vocabulary.
|
|
5553
|
+
*/
|
|
5554
|
+
function classifyRemoteWriteFailure(error) {
|
|
5555
|
+
if (isRemoteCancellation(error)) return { kind: "cancelled" };
|
|
5556
|
+
const code = remoteFailureCode(error);
|
|
5557
|
+
const details = copyFailureDetails(error);
|
|
5558
|
+
if (isRemoteBusinessRefusalCode(code)) return {
|
|
5559
|
+
kind: "rejected",
|
|
5560
|
+
error: {
|
|
5561
|
+
code,
|
|
5562
|
+
message: settledWriteMessage(code, error),
|
|
5563
|
+
...details === void 0 ? {} : { details }
|
|
5564
|
+
}
|
|
5565
|
+
};
|
|
5566
|
+
return {
|
|
5567
|
+
kind: "indeterminate",
|
|
5568
|
+
error: {
|
|
5569
|
+
code: code ?? "session/write-indeterminate",
|
|
5570
|
+
message: settledWriteMessage(code, error),
|
|
5571
|
+
...details === void 0 ? {} : { details }
|
|
5572
|
+
}
|
|
5573
|
+
};
|
|
5574
|
+
}
|
|
5575
|
+
/** A rejection the adapter itself proved before any Host dispatch. */
|
|
5576
|
+
function remoteRejected(code, message) {
|
|
5577
|
+
return {
|
|
5578
|
+
kind: "rejected",
|
|
5579
|
+
error: {
|
|
5580
|
+
code,
|
|
5581
|
+
message
|
|
5582
|
+
}
|
|
5583
|
+
};
|
|
5584
|
+
}
|
|
5585
|
+
/** A pre-dispatch fence refusal: the operation is known not to have been sent. */
|
|
5586
|
+
function remoteNotDispatched() {
|
|
5587
|
+
return { kind: "cancelled" };
|
|
5588
|
+
}
|
|
5589
|
+
//#endregion
|
|
5590
|
+
//#region src/runtime/capability.ts
|
|
5591
|
+
/** The capabilities the experimental Remote backend serves: exactly the
|
|
5592
|
+
* ports its M3-3B assembly provides. A capability is added HERE only when its
|
|
5593
|
+
* Remote port genuinely serves the semantic contract (no misleading empty
|
|
5594
|
+
* defaults), so the set is deliberately explicit rather than derived. */
|
|
5595
|
+
const REMOTE_IMPLEMENTED_CAPABILITIES = [
|
|
5596
|
+
"session-read",
|
|
5597
|
+
"session-write",
|
|
5598
|
+
"session-lifecycle",
|
|
5599
|
+
"subagent",
|
|
5600
|
+
"interaction",
|
|
5601
|
+
"catalog",
|
|
5602
|
+
"config",
|
|
5603
|
+
"host-file",
|
|
5604
|
+
"session-archive",
|
|
5605
|
+
"host-command",
|
|
5606
|
+
"plugin-manager",
|
|
5607
|
+
"job-observation"
|
|
5608
|
+
];
|
|
5609
|
+
/** The capabilities the Direct backend ACTUALLY serves today: one port per
|
|
5610
|
+
* entry, nothing more — never advertise what is not served. */
|
|
5611
|
+
const DIRECT_IMPLEMENTED_CAPABILITIES = [
|
|
5612
|
+
"session-read",
|
|
5613
|
+
"session-write",
|
|
5614
|
+
"session-lifecycle",
|
|
5615
|
+
"subagent",
|
|
5616
|
+
"interaction",
|
|
5617
|
+
"catalog",
|
|
5618
|
+
"config",
|
|
5619
|
+
"host-file",
|
|
5620
|
+
"session-archive",
|
|
5621
|
+
"host-command",
|
|
5622
|
+
"plugin-manager",
|
|
5623
|
+
"job-observation"
|
|
5624
|
+
];
|
|
5625
|
+
//#endregion
|
|
5420
5626
|
//#region src/runtime/subagent-outcome.ts
|
|
5421
5627
|
/**
|
|
5422
5628
|
* Backend-neutral outcome/error classification for one subagent viewer prompt
|
|
@@ -5752,11 +5958,13 @@ function detachBundle(bundle) {
|
|
|
5752
5958
|
...bundle.version === void 0 ? {} : { version: bundle.version },
|
|
5753
5959
|
...bundle.meta === void 0 ? {} : pickMeta(bundle.meta),
|
|
5754
5960
|
...bundle.description === void 0 ? {} : { description: bundle.description },
|
|
5961
|
+
...bundle.listedByDefault === void 0 ? {} : { listedByDefault: bundle.listedByDefault },
|
|
5755
5962
|
enabled: bundle.enabled,
|
|
5756
5963
|
installed: bundle.installed,
|
|
5757
5964
|
optional: bundle.optional,
|
|
5758
5965
|
...bundle.source === void 0 ? {} : { source: bundle.source },
|
|
5759
5966
|
removable: bundle.removable,
|
|
5967
|
+
updatable: bundle.updatable,
|
|
5760
5968
|
...bundle.readOnlyReason === void 0 ? {} : { readOnlyReason: bundle.readOnlyReason },
|
|
5761
5969
|
...bundle.error === void 0 ? {} : { error: detachError(bundle.error) },
|
|
5762
5970
|
rows: Object.freeze(rows),
|
|
@@ -5867,6 +6075,58 @@ function detachLog(chunk) {
|
|
|
5867
6075
|
text: chunk.text
|
|
5868
6076
|
});
|
|
5869
6077
|
}
|
|
6078
|
+
function detachRegistryAttempt(attempt) {
|
|
6079
|
+
return Object.freeze({
|
|
6080
|
+
registry: attempt.registry,
|
|
6081
|
+
...attempt.problem === void 0 ? {} : { problem: attempt.problem },
|
|
6082
|
+
...attempt.reason === void 0 ? {} : { reason: attempt.reason }
|
|
6083
|
+
});
|
|
6084
|
+
}
|
|
6085
|
+
function detachVersion(version) {
|
|
6086
|
+
return Object.freeze({
|
|
6087
|
+
version: version.version,
|
|
6088
|
+
...version.publishedAt === void 0 ? {} : { publishedAt: version.publishedAt },
|
|
6089
|
+
tags: Object.freeze([...version.tags]),
|
|
6090
|
+
prerelease: version.prerelease,
|
|
6091
|
+
...version.deprecated === void 0 ? {} : { deprecated: version.deprecated },
|
|
6092
|
+
bundle: version.bundle,
|
|
6093
|
+
...version.incompatible === void 0 ? {} : { incompatible: detachIncompatible(version.incompatible) }
|
|
6094
|
+
});
|
|
6095
|
+
}
|
|
6096
|
+
/** Map one version listing with the Host's order, facts and omitted count intact. */
|
|
6097
|
+
function detachPluginVersionList(list) {
|
|
6098
|
+
if (list.status === "refused") return Object.freeze({
|
|
6099
|
+
status: "refused",
|
|
6100
|
+
problem: list.problem,
|
|
6101
|
+
reason: list.reason,
|
|
6102
|
+
attempts: Object.freeze(list.attempts.map(detachRegistryAttempt))
|
|
6103
|
+
});
|
|
6104
|
+
return Object.freeze({
|
|
6105
|
+
status: "listed",
|
|
6106
|
+
installed: list.installed,
|
|
6107
|
+
registry: list.registry,
|
|
6108
|
+
attempts: Object.freeze(list.attempts.map(detachRegistryAttempt)),
|
|
6109
|
+
versions: Object.freeze(list.versions.map(detachVersion)),
|
|
6110
|
+
omitted: list.omitted
|
|
6111
|
+
});
|
|
6112
|
+
}
|
|
6113
|
+
/** Map one update step announcement. */
|
|
6114
|
+
function detachPluginUpdateProgress(progress) {
|
|
6115
|
+
return Object.freeze({
|
|
6116
|
+
requestId: String(progress.requestId),
|
|
6117
|
+
step: progress.step
|
|
6118
|
+
});
|
|
6119
|
+
}
|
|
6120
|
+
/** Map the target outcome and the automatic restore as TWO independent results. */
|
|
6121
|
+
function detachPluginUpdateResult(result) {
|
|
6122
|
+
return Object.freeze({
|
|
6123
|
+
from: result.from,
|
|
6124
|
+
to: result.to,
|
|
6125
|
+
step: result.step,
|
|
6126
|
+
result: detachChange(result.result),
|
|
6127
|
+
...result.restore === void 0 ? {} : { restore: detachChange(result.restore) }
|
|
6128
|
+
});
|
|
6129
|
+
}
|
|
5870
6130
|
//#endregion
|
|
5871
6131
|
//#region src/runtime/plugin-manager-port.ts
|
|
5872
6132
|
/**
|
|
@@ -5997,4 +6257,4 @@ function createRemoteTerminalProgressSource(deps) {
|
|
|
5997
6257
|
} };
|
|
5998
6258
|
}
|
|
5999
6259
|
//#endregion
|
|
6000
|
-
export {
|
|
6260
|
+
export { ownerHandleOf as $, settledWriteMessage as A, classifyCommandLine as B, classifyRemoteWriteFailure as C, dshVersion as Ct, remoteFailureMessage as D, remoteFailureCode as E, __exportAll as Et, extensions_exports as F, shouldConsumeAdvertisedMiss as G, isPlainExitPrompt as H, PI_TUI_EXTENSIONS_SERVICE as I, deliveredFileReadErrorFrom as J, normalizeInputEvent as K, InvalidateBatcher as L, isRemoteBusinessRefusalCode as M, ScheduleOutcomeUnknownError as N, remoteNotDispatched as O, ScheduleUnavailableError as P, directAgentOf as Q, LOCAL_COMMANDS as R, REMOTE_IMPLEMENTED_CAPABILITIES as S, bundleVersion as St, isRemoteCancellation as T, TUI_STARTUP_SERVICE as Tt, localCommandMayWrite as U, isBareCommandLine as V, normalizeSkillInvocation as W, WorkspaceSelectionError as X, LifecycleError as Y, clientOwnerOf as Z, detachedSessionStatus as _, getPath as _t, detachInspection as a, isTerminalAmbiguousKeyId as at, safeSubagentErrorMessage as b, SupersededReadError as bt, detachPluginManagerSnapshot as c, VIEWER_BLOCKED_PARENT_ACTIONS as ct, detachPluginVersionList as d, isTextProducingKeyId as dt, requireCreated as et, pluginInstallRequestId as f, isValidKeyId as ft, questionAnswerError as g, deriveKeyRef as gt, QuestionAnswerError as h, classifyCredentialArg as ht, detachChange as i, isPhysicalEscapeAction as it, GATEWAY_PRE_INVOCATION_CODES as j, remoteRejected as k, detachPluginUpdateProgress as l, canonicalizeKeyId as lt, QUESTION_REPLY_QUEUED as m, ROUTE_PATTERN as mt, createRemoteTerminalProgressSource as n, DEFAULT_LEADER_TIMEOUT_MS as nt, detachLog as o, parseUserKeybindings as ot, QUESTION_BAD_ANSWER as p, PROTOCOL_CHOICES as pt, DeliveredFileReadError as q, PluginManagerStaleResultError as r, isEditorSubmitPreSubmitKey as rt, detachPhase as s, APP_KEYBINDINGS as st, consumeRemoteTerminalProgress as t, requireOpened as tt, detachPluginUpdateResult as u, isRuntimeBindableKeyId as ut, detachedTurnOutline as v, providerOptionsFor as vt, copyFailureDetails as w, packageVersion$1 as wt, DIRECT_IMPLEMENTED_CAPABILITIES as x, contextPressureOccupancy as xt, classifySubagentPromptSettlement as y, providerProfileProjectionOf as yt, SESSIONLESS_COMMANDS as z };
|
package/dist/visual-tools.d.mts
CHANGED
|
@@ -6,8 +6,8 @@ import z from "@deepseek-ai/schemastery";
|
|
|
6
6
|
declare const name = "pi-tui-visual-tools";
|
|
7
7
|
/**
|
|
8
8
|
* The Host services this row uses: the registry it owns, the live Agent (the
|
|
9
|
-
* executing Session identity
|
|
10
|
-
* returns a committed observation.
|
|
9
|
+
* executing Session identity plus the official turn-boundary reader) and the
|
|
10
|
+
* official Session read service that returns a committed observation.
|
|
11
11
|
*/
|
|
12
12
|
declare const inject: string[];
|
|
13
13
|
/**
|