@xmoon76/dsh-pi-tui 0.5.8 → 0.5.9

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 (77) hide show
  1. package/README.en.md +61 -25
  2. package/README.md +61 -25
  3. package/cordis.patch.yml +13 -0
  4. package/dist/acp-stdio.mjs +151 -0
  5. package/dist/{bootstrap-CMIjGyuk.mjs → bootstrap-CVyHGQDX.mjs} +21901 -6575
  6. package/dist/browser-CDUSHIIr.mjs +76 -0
  7. package/dist/builtins.mjs +2 -2
  8. package/dist/{client-bootstrap-BjGPc-DM.mjs → client-bootstrap-4UoeVIHE.mjs} +2488 -2734
  9. package/dist/client-runtime-BHBlVUf5.mjs +1376 -0
  10. package/dist/{daemon-launcher-Dult7Jxv.mjs → daemon-launcher-DxIgjBHW.mjs} +1549 -172
  11. package/dist/daemon-launcher.d.mts +85 -14
  12. package/dist/daemon-launcher.mjs +2 -2
  13. package/dist/{local-profile-daemon-admin-BmQSdzT0.mjs → diagnostics-Db5iVcuJ.mjs} +3 -90
  14. package/dist/{entry-control-DjNsE3I0.mjs → entry-control-BDLZgg4m.mjs} +1 -1
  15. package/dist/{extensions-B4uLpSTv.mjs → extensions-Dx7ncPNA.mjs} +1 -1
  16. package/dist/extensions.mjs +1 -1
  17. package/dist/handoff-BjoEy3f8.mjs +106 -0
  18. package/dist/history-search-limits-Cx2UvRC2.mjs +16 -0
  19. package/dist/history-search-remote-BHuoellG.mjs +113 -0
  20. package/dist/history-search-remote-BzXdvrxk.mjs +26 -0
  21. package/dist/history-search-seat-BcHJTpeB.mjs +639 -0
  22. package/dist/history-search-seat-rZcq0XV6.mjs +639 -0
  23. package/dist/{host-bootstrap-MVxks641.mjs → host-bootstrap-BfnufpnW.mjs} +37 -72
  24. package/dist/{host-foundation-probe-DMNTmNrH.mjs → host-foundation-probe-DlD8-N_Q.mjs} +2 -2
  25. package/dist/host-runtime.mjs +5611 -290
  26. package/dist/index.d.mts +13 -6
  27. package/dist/index.mjs +22334 -6695
  28. package/dist/installed-dsh-BjUiJSwR.mjs +142 -0
  29. package/dist/interaction-port-D1Yv9zgu.mjs +45 -0
  30. package/dist/local-acp-control-CC5z4Xbq.mjs +304 -0
  31. package/dist/local-acp-endpoint-D1jYdJdv.mjs +41 -0
  32. package/dist/local-acp-listener-Cmgb5M0H.mjs +9493 -0
  33. package/dist/local-acp-status-B_25Q6kU.mjs +101 -0
  34. package/dist/local-client.mjs +292 -63
  35. package/dist/local-daemon-control-BFJAC8Kg.mjs +2199 -0
  36. package/dist/local-daemon-control-Bm3imctD.mjs +2101 -0
  37. package/dist/{local-discovery-uOBfFq5j.mjs → local-discovery-BMhaGIiJ.mjs} +254 -544
  38. package/dist/{local-discovery-egN4_gsQ.mjs → local-discovery-Ba7_-NNC.mjs} +1 -1
  39. package/dist/{local-discovery-DOSsCh9q.mjs → local-discovery-QSbFpjK2.mjs} +301 -544
  40. package/dist/local-host.mjs +952 -501
  41. package/dist/local-profile-daemon-admin-otpm69R6.mjs +469 -0
  42. package/dist/{local-scope-DamiMqPd.mjs → local-scope-5DEKA_lW.mjs} +1023 -96
  43. package/dist/{local-transport-Iwo0mtu3.mjs → local-transport-DeWmdZ5E.mjs} +14 -3
  44. package/dist/{local-web-control-DMrjwCkl.mjs → local-web-control-Dny93N-r.mjs} +10 -7
  45. package/dist/{local-workspace-object-D06GL0UO.mjs → local-workspace-object-D0RVQt8U.mjs} +33 -9
  46. package/dist/model-selection-CYlqg2DV.mjs +83 -0
  47. package/dist/native-client-domains-Dg4srzYt.mjs +2 -0
  48. package/dist/native-client.d.mts +735 -0
  49. package/dist/native-client.mjs +3534 -0
  50. package/dist/{open-CmOBxSjN.mjs → open-QQva8-ar.mjs} +24 -20
  51. package/dist/{pi-tui-remote-contribution-Do8ECrUy.mjs → pi-tui-remote-contribution-565wiLWp.mjs} +741 -150
  52. package/dist/preferences.mjs +1 -1
  53. package/dist/{profile-preferences-migration-CThz4rHH.mjs → profile-preferences-migration-CNOWIdnr.mjs} +1 -1
  54. package/dist/{profile-preferences-migration-BfUGdPZx.mjs → profile-preferences-migration-IrnXcJWK.mjs} +10 -8
  55. package/dist/{prompt-sections-DXmjB58H.mjs → prompt-sections-Bi-9_Gr_.mjs} +28 -10
  56. package/dist/{prompt-sections-DUKmWb8g.mjs → prompt-sections-DFS1dqsY.mjs} +342 -56
  57. package/dist/{dist-BFgC-5tL.mjs → recall-scope-9Nuoto_i.mjs} +353 -1
  58. package/dist/rolldown-runtime-8H4AJuhK.mjs +14 -0
  59. package/dist/schema-CCLvDa7Q.mjs +177 -0
  60. package/dist/{schema-qE_P09zJ.mjs → schema-t97l3aK8.mjs} +56 -3
  61. package/dist/{session-C6tSs86s.mjs → session-Cs8iLCEx.mjs} +784 -342
  62. package/dist/{session-CstInGIA.mjs → session-EBRZF6Ow.mjs} +783 -341
  63. package/dist/session-create-facts-CkfG5DpQ.mjs +20 -0
  64. package/dist/{startup-CarQxWwi.d.mts → startup-Dti3Udne.d.mts} +30 -3
  65. package/dist/{startup-EG5UqIcd.mjs → startup-UtFQSDe_.mjs} +90 -15
  66. package/dist/startup.d.mts +2 -2
  67. package/dist/startup.mjs +1 -1
  68. package/dist/task-read-remote-DRtkXDrZ.mjs +1083 -0
  69. package/dist/{terminal-progress-source-CpfpQO_h.mjs → terminal-progress-source-VsczdXA-.mjs} +610 -332
  70. package/dist/{transcript-view-CuJYWkhp.mjs → transcript-view-B6vCnukn.mjs} +2096 -977
  71. package/dist/{transcript-view-C1YtJ49Y.mjs → transcript-view-DSSdE2vK.mjs} +2078 -651
  72. package/dist/write-failure-xNKczXH7.mjs +189 -0
  73. package/package.json +20 -3
  74. package/dist/local-acp-listener-B65J0Bx4.mjs +0 -3115
  75. package/dist/local-daemon-control-C14q9KnD.mjs +0 -1588
  76. package/dist/local-daemon-control-TCnERL7n.mjs +0 -1424
  77. package/dist/preset-BcWqOtY7.mjs +0 -46
@@ -0,0 +1,189 @@
1
+ import { n as isCancellation, o as safeErrorMessage } from "./tasks-D_z5Yjjr.mjs";
2
+ //#region src/runtime/write-outcome.ts
3
+ /**
4
+ * Pinned Gateway infrastructure codes raised strictly BEFORE the addressed
5
+ * business method is invoked (descriptor/argument/receiver/endpoint resolution
6
+ * and context/lookup provider resolution — all inside `prepareInvocation` and
7
+ * boundary decoding): such a failure proves the operation did not commit. The
8
+ * only Gateway code raised AFTER invocation is `gateway/result-invalid`, so it
9
+ * is deliberately absent.
10
+ */
11
+ const GATEWAY_PRE_INVOCATION_CODES = /* @__PURE__ */ new Set([
12
+ "gateway/ambiguous-endpoint",
13
+ "gateway/arguments-invalid",
14
+ "gateway/binding-invalid",
15
+ "gateway/context-failed",
16
+ "gateway/context-not-found",
17
+ "gateway/context-unavailable",
18
+ "gateway/definition-unavailable",
19
+ "gateway/input-invalid",
20
+ "gateway/invocation-unavailable",
21
+ "gateway/lookup-failed",
22
+ "gateway/lookup-not-found",
23
+ "gateway/lookup-unavailable",
24
+ "gateway/method-unavailable",
25
+ "gateway/provider-mismatch",
26
+ "gateway/service-unavailable",
27
+ "gateway/signature-invalid",
28
+ "gateway/interactions-forbidden"
29
+ ]);
30
+ /**
31
+ * Whether a failure code PROVES the addressed operation was refused: domain
32
+ * codes, `gateway/bad-request`, and the pinned pre-invocation Gateway
33
+ * infrastructure codes qualify. `gateway/cancelled`, `gateway/internal`,
34
+ * `gateway/result-invalid`, an unknown `gateway/*` code, or a code-less failure
35
+ * do NOT (the commit state stays unproven).
36
+ *
37
+ * SCOPE: this predicate expresses ONLY the D2.2-verified write vocabulary plus
38
+ * the pinned Gateway pre-invocation codes. It is NOT a general
39
+ * idempotency/commit judgement: a domain code does not universally prove that
40
+ * no mutation happened (e.g. `session/workspace-attach-failed` can follow a
41
+ * successful Session create/fork). Later operation families (D2.3/D2.4) must
42
+ * use their own operation-specific settlement table rather than extending this
43
+ * helper.
44
+ */
45
+ function isRemoteBusinessRefusalCode(code) {
46
+ if (code === void 0) return false;
47
+ if (code === "gateway/bad-request") return true;
48
+ if (code.startsWith("gateway/")) return GATEWAY_PRE_INVOCATION_CODES.has(code);
49
+ return true;
50
+ }
51
+ //#endregion
52
+ //#region src/runtime/remote/write-failure.ts
53
+ /**
54
+ * Remote write settlement classification (D2.2): map one official Client
55
+ * `RemoteResult` failure into the shared `WriteOutcome` vocabulary without
56
+ * inventing a second Remote-only taxonomy.
57
+ *
58
+ * The official failure vocabulary is code-discriminated. Business refusals
59
+ * carry their domain code (`session/*`, `subagent/*`, `agent-preset/*`, ...),
60
+ * the gateway's own admission code (`gateway/bad-request`), or one of the
61
+ * pinned Gateway's infrastructure codes that are raised BEFORE the addressed
62
+ * business method runs (descriptor/argument/receiver/endpoint resolution and
63
+ * context/lookup provider resolution), so the operation definitely did not
64
+ * commit. `gateway/cancelled` is a caller cancellation; `gateway/internal` and
65
+ * `gateway/result-invalid` (which the Gateway raises AFTER the method returned)
66
+ * leave the commit state unproven. A failure this classifier cannot prove was a
67
+ * refusal must never be reported as `rejected` — it stays `indeterminate`,
68
+ * because the write may still have committed.
69
+ *
70
+ * @module @xmoon76/dsh-pi-tui/runtime/remote/write-failure
71
+ */
72
+ /** Read the stable code off a structural official failure. */
73
+ function remoteFailureCode(error) {
74
+ if (typeof error !== "object" || error === null) return void 0;
75
+ const code = error.code;
76
+ return typeof code === "string" && code !== "" ? code : void 0;
77
+ }
78
+ /**
79
+ * The official Client carrier rebuilds a failure as a plain `{code, message,
80
+ * details}` value across the wire, not necessarily an `Error` instance.
81
+ * `safeErrorMessage` would `String()` such an object to `[object Object]`, so
82
+ * prefer the structural `message` string before falling back.
83
+ */
84
+ function remoteFailureMessage(error) {
85
+ if (typeof error === "object" && error !== null) {
86
+ const message = error.message;
87
+ if (typeof message === "string") return message;
88
+ }
89
+ return safeErrorMessage(error);
90
+ }
91
+ /** A caller/backend cancellation proved by the official code or the error name. */
92
+ function isRemoteCancellation(error) {
93
+ if (isCancellation(error)) return true;
94
+ return remoteFailureCode(error) === "gateway/cancelled";
95
+ }
96
+ /** Whether one value is a structurally-owned wire record (never an array, a
97
+ * class instance, or a primitive). */
98
+ function isPlainRecord(value) {
99
+ if (typeof value !== "object" || value === null || Array.isArray(value)) return false;
100
+ const prototype = Object.getPrototypeOf(value);
101
+ return prototype === Object.prototype || prototype === null;
102
+ }
103
+ /**
104
+ * Copy one wire-shaped value into an owned frozen plain tree.
105
+ *
106
+ * The official failure `details` crosses the wire as JSON — nested `issues`
107
+ * arrays and objects included — so plain objects, arrays and scalars are the
108
+ * only transferable shapes. A non-plain value (a Host class instance,
109
+ * function, symbol or bigint) is not wire data: it is detached to `undefined`
110
+ * rather than escaping as a live Host object.
111
+ */
112
+ function detachWireValue(value) {
113
+ if (typeof value === "function" || typeof value === "symbol" || typeof value === "bigint") return void 0;
114
+ if (value === null || typeof value !== "object") return value;
115
+ if (Array.isArray(value)) return Object.freeze(value.map(detachWireValue));
116
+ if (!isPlainRecord(value)) return void 0;
117
+ const copy = {};
118
+ for (const [key, entry] of Object.entries(value)) copy[key] = detachWireValue(entry);
119
+ return Object.freeze(copy);
120
+ }
121
+ /**
122
+ * Copy the official failure `details` into an owned, deeply frozen plain tree
123
+ * so no Host-owned object — nested arrays/objects included — escapes the
124
+ * adapter. A non-record `details` value, and an empty one that carries no
125
+ * structural payload, is dropped.
126
+ */
127
+ function copyFailureDetails(error) {
128
+ if (typeof error !== "object" || error === null) return void 0;
129
+ if (!isPlainRecord(error.details)) return void 0;
130
+ const copy = {};
131
+ for (const [key, entry] of Object.entries(error.details)) copy[key] = detachWireValue(entry);
132
+ const detached = Object.freeze(copy);
133
+ return Object.keys(detached).length === 0 ? void 0 : detached;
134
+ }
135
+ /** Actionable recovery guidance for `session/writer-held`.
136
+ *
137
+ * The official Host reports only that a Session writer handle is held; it
138
+ * cannot tell which process or context owns it, and the TUI must never take
139
+ * over, kill a holder, force a resume, or retry automatically. The guidance is
140
+ * therefore a recovery action for the user, and it must not claim a specific
141
+ * holder. */
142
+ 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";
143
+ /** The user-facing message for one settled failure code. `session/writer-held`
144
+ * replaces the Host's internal diagnostic with actionable recovery guidance —
145
+ * the code and `details` keep the machine-readable facts. */
146
+ function settledWriteMessage(code, error) {
147
+ return code === "session/writer-held" ? SESSION_WRITER_HELD_GUIDANCE : remoteFailureMessage(error);
148
+ }
149
+ /**
150
+ * Classify one failed official write (a `RemoteResult` error branch) into the
151
+ * shared non-committed outcome vocabulary.
152
+ */
153
+ function classifyRemoteWriteFailure(error) {
154
+ if (isRemoteCancellation(error)) return { kind: "cancelled" };
155
+ const code = remoteFailureCode(error);
156
+ const details = copyFailureDetails(error);
157
+ if (isRemoteBusinessRefusalCode(code)) return {
158
+ kind: "rejected",
159
+ error: {
160
+ code,
161
+ message: settledWriteMessage(code, error),
162
+ ...details === void 0 ? {} : { details }
163
+ }
164
+ };
165
+ return {
166
+ kind: "indeterminate",
167
+ error: {
168
+ code: code ?? "session/write-indeterminate",
169
+ message: settledWriteMessage(code, error),
170
+ ...details === void 0 ? {} : { details }
171
+ }
172
+ };
173
+ }
174
+ /** A rejection the adapter itself proved before any Host dispatch. */
175
+ function remoteRejected(code, message) {
176
+ return {
177
+ kind: "rejected",
178
+ error: {
179
+ code,
180
+ message
181
+ }
182
+ };
183
+ }
184
+ /** A pre-dispatch fence refusal: the operation is known not to have been sent. */
185
+ function remoteNotDispatched() {
186
+ return { kind: "cancelled" };
187
+ }
188
+ //#endregion
189
+ export { remoteFailureMessage as a, settledWriteMessage as c, remoteFailureCode as i, GATEWAY_PRE_INVOCATION_CODES as l, copyFailureDetails as n, remoteNotDispatched as o, isRemoteCancellation as r, remoteRejected as s, classifyRemoteWriteFailure as t, isRemoteBusinessRefusalCode as u };
package/package.json CHANGED
@@ -1,6 +1,9 @@
1
1
  {
2
2
  "name": "@xmoon76/dsh-pi-tui",
3
- "version": "0.5.8",
3
+ "version": "0.5.9",
4
+ "dshPiTuiInternalCapabilities": {
5
+ "osc7577ClientHandoff": 1
6
+ },
4
7
  "description": "The dsh-pi-tui bundle: a TUI surface for DeepSeek Harness profiles (dsh --profile pi-tui)",
5
8
  "license": "MIT",
6
9
  "author": "XMoon <xmoonox@gmail.com>",
@@ -68,6 +71,10 @@
68
71
  "types": "./dist/daemon-launcher.d.mts",
69
72
  "default": "./dist/daemon-launcher.mjs"
70
73
  },
74
+ "./native-client": {
75
+ "types": "./dist/native-client.d.mts",
76
+ "default": "./dist/native-client.mjs"
77
+ },
71
78
  "./acp-preferences": {
72
79
  "types": "./dist/acp-preferences.d.mts",
73
80
  "default": "./dist/acp-preferences.mjs"
@@ -107,7 +114,7 @@
107
114
  }
108
115
  },
109
116
  "dependencies": {
110
- "@agentclientprotocol/sdk": "1.4.0",
117
+ "@agentclientprotocol/sdk": "2.9.1",
111
118
  "@resvg/resvg-js": "2.6.2",
112
119
  "@stencil-hq/tern": "0.2.0",
113
120
  "chalk": "^5.4.1",
@@ -152,6 +159,7 @@
152
159
  "@deepseek-ai/dsh-jobs": ">=0.2.2-rc.3",
153
160
  "@deepseek-ai/dsh-llm": ">=0.2.2-rc.3",
154
161
  "@deepseek-ai/dsh-llm-retry": ">=0.2.2-rc.3",
162
+ "@deepseek-ai/dsh-mcp-client": ">=0.2.2-rc.3",
155
163
  "@deepseek-ai/dsh-mcp-manager": ">=0.2.2-rc.3",
156
164
  "@deepseek-ai/dsh-official-bundles": ">=0.2.2-rc.3",
157
165
  "@deepseek-ai/dsh-permission-presets": ">=0.2.2-rc.3",
@@ -164,6 +172,7 @@
164
172
  "@deepseek-ai/dsh-session-log-export": ">=0.2.2-rc.3",
165
173
  "@deepseek-ai/dsh-session-persistence": ">=0.2.2-rc.3",
166
174
  "@deepseek-ai/dsh-session-projection": ">=0.2.2-rc.3",
175
+ "@deepseek-ai/dsh-session-query": ">=0.2.2-rc.3",
167
176
  "@deepseek-ai/dsh-session-title": ">=0.2.2-rc.3",
168
177
  "@deepseek-ai/dsh-settings": ">=0.2.2-rc.3",
169
178
  "@deepseek-ai/dsh-shell": ">=0.2.2-rc.3",
@@ -314,6 +323,7 @@
314
323
  "@deepseek-ai/dsh-working-directory": "0.2.2-rc.5",
315
324
  "@deepseek-ai/dsh-workspace": "0.2.2-rc.5",
316
325
  "@deepseek-ai/schemastery": "3.19.0",
326
+ "@microsoft/tui-test": "0.1.1",
317
327
  "@types/node": "^22.0.0",
318
328
  "@types/ws": "8.18.1",
319
329
  "@xmoon76/pi-tui": "^1.1.0",
@@ -325,6 +335,8 @@
325
335
  "tsdown": "0.22.0",
326
336
  "tsx": "^4.23.12",
327
337
  "typescript": "^5.9.0",
338
+ "vite": "7.3.8",
339
+ "vitest": "5.1.1",
328
340
  "zustand": "4.5.7"
329
341
  },
330
342
  "engines": {
@@ -346,6 +358,12 @@
346
358
  "bench:smoke": "BENCH_SMOKE=1 node --expose-gc --import tsx/esm scripts/bench.mts",
347
359
  "test:fork": "node scripts/run-with-temp-root.mjs pnpm --dir packages/pi-tui test",
348
360
  "test:bundle": "pnpm test:product && pnpm test:tooling",
361
+ "test:split:upgrade": "vitest run --config vitest.split.config.ts --project split-upgrade",
362
+ "test:split:upgrade:systemd": "vitest run --config vitest.split.config.ts --project split-upgrade-systemd",
363
+ "test:split:upgrade:launchd": "vitest run --config vitest.split.config.ts --project split-upgrade-launchd",
364
+ "test:split:process": "vitest run --config vitest.split.config.ts --project split-process-business",
365
+ "test:split:process:optional": "vitest run --config vitest.split.config.ts --project split-process-optional",
366
+ "test:split:process:browser": "vitest run --config vitest.split.config.ts --project split-process-browser",
349
367
  "test:tmux": "node scripts/run-test-lane.mjs tmux",
350
368
  "test": "pnpm test:fork && pnpm test:product && pnpm test:tooling && pnpm test:tmux",
351
369
  "smoke": "node scripts/tarball-smoke.mjs",
@@ -368,7 +386,6 @@
368
386
  "smoke:split-process": "node scripts/split-process-smoke.mjs",
369
387
  "smoke:fresh-profile": "node scripts/fresh-profile-install-smoke.mjs",
370
388
  "smoke:macos-split": "node scripts/smoke/macos-split-parity.mjs",
371
- "smoke:split-upgrade": "node scripts/split-process-upgrade-smoke.mjs",
372
389
  "smoke:startup-strictness": "node scripts/startup-strictness-smoke.mjs",
373
390
  "dsh:source:pack": "node scripts/dsh-source-pack.mjs",
374
391
  "compat:dsh:source": "node scripts/dsh-source-verify.mjs",