@xmoon76/dsh-pi-tui 0.5.1 → 0.5.3

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 (31) hide show
  1. package/README.en.md +130 -17
  2. package/README.md +76 -16
  3. package/cordis.patch.yml +17 -49
  4. package/dist/builtins.mjs +3 -2
  5. package/dist/context-summary-CxUpNkA9.mjs +2951 -0
  6. package/dist/extension/advanced.d.mts +2 -2
  7. package/dist/extension/unstable.d.mts +1 -1
  8. package/dist/{extensions-v3Rf-qJA.d.mts → extensions-DzpBiiYb.d.mts} +1 -1
  9. package/dist/{extensions-1WYBUQ8I.mjs → extensions-a-rxanjw.mjs} +3514 -2892
  10. package/dist/extensions.d.mts +2 -2
  11. package/dist/extensions.mjs +1 -1
  12. package/dist/index.d.mts +13 -11
  13. package/dist/index.mjs +20158 -7768
  14. package/dist/performance-host-BJT6scGF.mjs +266 -0
  15. package/dist/performance-host.d.mts +36 -0
  16. package/dist/performance-host.mjs +2 -0
  17. package/dist/performance-view-jvvd8Jn7.mjs +476 -0
  18. package/dist/{public-types-BEjj7FEb.d.mts → public-types-gZi3iFNh.d.mts} +1 -1
  19. package/dist/rolldown-runtime-8H4AJuhK.mjs +14 -0
  20. package/dist/{runtime-CcQyhIvI.mjs → runtime-BtPH-UUb.mjs} +625 -261
  21. package/dist/session-BZLxhrPQ.mjs +5697 -0
  22. package/dist/{startup-CmTYVTGC.mjs → startup-D5Xu8diR.mjs} +22 -7
  23. package/dist/startup.d.mts +1 -2
  24. package/dist/startup.mjs +1 -1
  25. package/dist/tasks-D_z5Yjjr.mjs +267 -0
  26. package/dist/{terminal-progress-source-BfiTKDT-.mjs → terminal-progress-source-BlmksrSD.mjs} +116 -265
  27. package/generated/dsh-presets/cordis.patch.yml +8 -26
  28. package/generated/dsh-presets/minimal.patch.yml +17 -0
  29. package/generated/dsh-presets/ptc.patch.yml +8 -26
  30. package/generated/dsh-presets/standard.patch.yml +8 -26
  31. package/package.json +166 -146
@@ -23,14 +23,20 @@ var dsh_compat_matrix_default = {
23
23
  "target and the recovery wording. The floor and the target are distinct values and",
24
24
  "must stay independently derived. Consumed by src/startup.ts (inlined by the bundler)",
25
25
  "and, through scripts/lib/dsh-compat.mjs, by the release tooling, the",
26
- "installation-doc gate and the release-notes tests."
26
+ "installation-doc gate and the release-notes tests.",
27
+ "package.json restates the newest row's `dshFrom` as `engines.dsh` `>=<dshFrom>`; DSH",
28
+ "prefers that field over the DSH peer ranges and only falls back to the peers when it",
29
+ "is absent, so the peers keep the npm-level fallback in sync with the same floor",
30
+ "rather than defining a second one. Upstream matches `engines.dsh` with prereleases",
31
+ "included, which is broader than npm's peer prerelease-tuple rule; an equal range does",
32
+ "not by itself qualify every such prerelease."
27
33
  ],
28
34
  current: {
29
- "since": "0.5.1",
30
- "requires": "DeepSeek Harness 0.2.0-rc.2 or later",
31
- "upgradeDsh": "0.2.0-rc.2",
32
- "upgradeCommand": "npm install -g --allow-scripts=@deepseek-ai/dsh-subprocess-local,koffi,node-pty @deepseek-ai/dsh@0.2.0-rc.2",
33
- "guidance": "This 0.5.1 line requires the published DeepSeek Harness 0.2.0-rc.2 family and is validated against that exact distribution; see docs/dsh-compatibility.md."
35
+ "since": "0.5.3",
36
+ "requires": "DeepSeek Harness 0.2.1-rc.2 or later",
37
+ "upgradeDsh": "0.2.1-rc.2",
38
+ "upgradeCommand": "npm install -g --allow-scripts=@deepseek-ai/dsh-subprocess-local,koffi,node-pty @deepseek-ai/dsh@0.2.1-rc.2",
39
+ "guidance": "This 0.5.3 release requires the published DeepSeek Harness 0.2.1-rc.2 family; see docs/dsh-compatibility.md for the pairing table."
34
40
  },
35
41
  floor: {
36
42
  "below": "0.1.0-rc.8",
@@ -106,8 +112,17 @@ var dsh_compat_matrix_default = {
106
112
  },
107
113
  {
108
114
  "dshFrom": "0.2.0-rc.2",
109
- "tui": "0.5.1",
115
+ "tui": "0.5.2-rc.1",
110
116
  "versions": ["0.2.0-rc.2"]
117
+ },
118
+ {
119
+ "dshFrom": "0.2.1-rc.1",
120
+ "versions": ["0.2.1-rc.1"]
121
+ },
122
+ {
123
+ "dshFrom": "0.2.1-rc.2",
124
+ "tui": "0.5.3",
125
+ "versions": ["0.2.1-rc.2"]
111
126
  }
112
127
  ]
113
128
  };
@@ -19,8 +19,7 @@ declare const inject: string[];
19
19
  * bundle's own version cannot be read, so the message stays truthful.
20
20
  *
21
21
  * The current line has a minimum of the published npm release
22
- * dsh-v0.2.0-rc.2 (M3-3B: the Question lifecycle consumes rc.2-only
23
- * published contracts). The recovery guidance names the recommended published
22
+ * dsh-v0.2.1-rc.2. The recovery guidance names the recommended published
24
23
  * upgrade target — which may be NEWER than the floor — and allows its native
25
24
  * install scripts. The already-published 0.5.0 line keeps its own
26
25
  * 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-CmTYVTGC.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-D5Xu8diR.mjs";
2
2
  export { HARNESS_COMPAT, TUI_STARTUP_SERVICE, apply, bundleVersionLabel, harnessCompatEntryFor, incompatibleHarnessMessage, inject, name };
@@ -0,0 +1,267 @@
1
+ //#region src/runtime/process/errors.ts
2
+ /**
3
+ * Shared, TOTAL error-observation helpers for every async boundary in the
4
+ * TUI: the owned/detached entries (`tasks.ts`), the lifecycle roots
5
+ * (startup, exit, flush), the per-task callbacks and the diagnostics
6
+ * formatter. One implementation, one behavior — no drift between modules.
7
+ *
8
+ * CONTRACT (deliberately scoped, honestly worded): the SYNC boundary is
9
+ * total — observing any legal JavaScript value (a Proxy with a throwing
10
+ * `getPrototypeOf` trap, a throwing `message` getter, a throwing
11
+ * `toString`/`Symbol.toPrimitive`) can never make THIS code throw or
12
+ * reject; every observation is protected and every fallback is a fixed
13
+ * constant that never touches the value again. What is NOT guaranteed: an
14
+ * observer (getter/trap/coercion) that, WHILE being observed, spawns its
15
+ * OWN detached async work (e.g. `void Promise.reject(...)` inside
16
+ * `toString`) — that rejection belongs to the observer, not to this
17
+ * boundary, and no synchronous try/catch can intercept it. Callers must
18
+ * not describe this module as a strict "any legal value, zero side
19
+ * effects" guarantee.
20
+ * @module @xmoon76/dsh-pi-tui/runtime/process/errors
21
+ */
22
+ /**
23
+ * Describe an arbitrary thrown value as a string WITHOUT ever throwing:
24
+ * `instanceof`, property reads and coercion are all inside the protection,
25
+ * the fallbacks are FIXED constants that never touch the value again, and
26
+ * a hostile Proxy/getter/`Symbol.toPrimitive` yields a stable placeholder
27
+ * instead of escaping. (Best-effort beyond the sync boundary — see the
28
+ * module contract.)
29
+ */
30
+ function safeErrorMessage(value) {
31
+ try {
32
+ if (value instanceof Error) try {
33
+ const message = value.message;
34
+ return typeof message === "string" ? message : "<error with non-string message>";
35
+ } catch {
36
+ return "<error with unreadable message>";
37
+ }
38
+ return String(value);
39
+ } catch {
40
+ return "<unprintable error>";
41
+ }
42
+ }
43
+ /** Describe an arbitrary thrown value using its normal `String` form without
44
+ * allowing hostile coercion to escape the async boundary. */
45
+ function safeErrorString(value) {
46
+ try {
47
+ return String(value);
48
+ } catch {
49
+ return "<unprintable error>";
50
+ }
51
+ }
52
+ //#endregion
53
+ //#region src/runtime/process/tasks.ts
54
+ /**
55
+ * Whether an error represents an abort/cancel rather than a real failure.
56
+ * TOTAL over the whole `unknown` domain: every probe (prototype-chain
57
+ * walk, `name`/`code` getters) is inside the protection, and a hostile
58
+ * value that throws while being observed simply classifies as NOT a
59
+ * cancellation — recognizing a cancellation must never mint a new primary
60
+ * error.
61
+ */
62
+ function isCancellation(error) {
63
+ try {
64
+ if (!(error instanceof Error)) return false;
65
+ return error.name === "AbortError" || error.code === "ABORT_ERR";
66
+ } catch {
67
+ return false;
68
+ }
69
+ }
70
+ /** Build a cancellation-shaped error the classifier recognizes (a plain
71
+ * `new Error('...')` would route through the failure path). */
72
+ function cancellationError(message) {
73
+ const error = new Error(message);
74
+ error.name = "AbortError";
75
+ error.code = "ABORT_ERR";
76
+ return error;
77
+ }
78
+ /** Read the live session id for diagnostics WITHOUT ever throwing: a
79
+ * throwing `sessionId()` callback degrades to `undefined` (diagnostics
80
+ * must not crash classification or the final sink). */
81
+ function safeSessionId(options) {
82
+ try {
83
+ return options.sessionId?.();
84
+ } catch {
85
+ return;
86
+ }
87
+ }
88
+ /**
89
+ * Invoke the task factory SYNCHRONOUSLY (an ownership action inside the
90
+ * factory — a stop, a latch, a spawn — must take effect before the helper
91
+ * returns, so two calls in one input batch cannot both start), and convert
92
+ * a synchronous throw into a rejected promise so it classifies exactly like
93
+ * a rejection.
94
+ */
95
+ function invokeTask(task) {
96
+ try {
97
+ return Promise.resolve(task());
98
+ } catch (error) {
99
+ return Promise.reject(error);
100
+ }
101
+ }
102
+ /**
103
+ * Observe the settlement of an ALREADY-OWNED promise without taking ownership.
104
+ * The callback runs on fulfilment or rejection and its own result is dropped,
105
+ * so bookkeeping (for example removing a promise from a teardown-drained set)
106
+ * never adds a second, unhandled rejection branch next to the real owner's
107
+ * failure handling. Never use this to START work — that is `runDetached` /
108
+ * `runOwned`.
109
+ * @param promise - the promise whose failure semantics already have an owner.
110
+ * @param onSettled - runs once, on either settlement.
111
+ */
112
+ function observeSettled(promise, onSettled) {
113
+ promise.then(onSettled, onSettled);
114
+ }
115
+ /**
116
+ * Attach rejection handling to a fire-and-forget task. The factory is
117
+ * invoked synchronously (a synchronous throw is a rejection like any
118
+ * other); every rejection is caught and classified:
119
+ * - cancellation → debug diagnostics only (never a user error);
120
+ * - recoverable (per the options hook) → notify + warn;
121
+ * - anything else → warn.
122
+ * The log line carries the task label and the live session id — never the
123
+ * task payload (no API keys, prompt bodies, or shell output). A throwing
124
+ * notify/diag/sessionId path cannot escape: it lands in the handler-failure
125
+ * sink, which is itself total over the `unknown` domain.
126
+ */
127
+ function runDetached(label, task, options) {
128
+ invokeTask(task).catch((error) => {
129
+ if (isCancellation(error)) {
130
+ options.diag.debug(label, {
131
+ session: safeSessionId(options),
132
+ cancelled: true
133
+ });
134
+ return;
135
+ }
136
+ const message = safeErrorMessage(error);
137
+ options.diag.warn(label, {
138
+ session: safeSessionId(options),
139
+ error: message
140
+ });
141
+ if (options.recoverable?.(error) === true) options.notify?.(`${label}: ${message}`);
142
+ }).catch(handlerFailure(label, options));
143
+ }
144
+ /**
145
+ * The owned-workflow counterpart of {@link runDetached}: a fire-and-forget
146
+ * task whose RESULT drives user-visible state (a settled card, a restored
147
+ * draft, a queue mutation, a notification). The factory starts
148
+ * SYNCHRONOUSLY; the TASK phase (factory throw / task rejection) classifies
149
+ * with the error shape plus the task-local predicate; the onResult phase is
150
+ * classified as a PRIMARY failure — ERROR + onError, never a cancellation,
151
+ * regardless of error shape or task-local state; a terminal side-effect
152
+ * handler's (onCancel/onError/classifier) own sync/async throw is wrapped
153
+ * in a {@link HandlerFailure} and lands in the `${label} handler failed`
154
+ * sink exactly once, without mutating the thrown value. Never a bare
155
+ * `void somePromise()`: every owned flow goes through this entry
156
+ * (AGENTS.md).
157
+ */
158
+ function runOwned(label, task, options) {
159
+ invokeTask(task).then((result) => options.onResult?.(result), (error) => {
160
+ return classify(label, options, error, true);
161
+ }).catch((error) => {
162
+ if (isHandlerFailure(error)) throw error;
163
+ return classify(label, options, error, false);
164
+ }).catch(handlerFailure(label, options));
165
+ }
166
+ /**
167
+ * Classify one failure and record the classification diagnostics, then run
168
+ * the matching per-task callback. `allowCancellation` gates ALL cancellation
169
+ * classification: the task phase may treat an AbortError or a task-local
170
+ * state as a cancellation; the onResult phase may not (a result-consumer
171
+ * failure is a failure). A terminal side-effect handler's own sync/async
172
+ * failure is wrapped in {@link HandlerFailure} and propagated to the
173
+ * handler-failure sink — never re-classified, never repeated, never
174
+ * escaped. All diagnostics go through the never-throw helpers, so a
175
+ * hostile thrown value or a throwing sessionId/diag can never mint a new
176
+ * primary error.
177
+ */
178
+ function classify(label, options, error, allowCancellation) {
179
+ if (allowCancellation && (isCancellation(error) || taskLocalCancellation(options, error))) {
180
+ options.diag.debug(label, {
181
+ session: safeSessionId(options),
182
+ cancelled: true
183
+ });
184
+ if (options.onCancel !== void 0) return guardHandler(() => options.onCancel(error));
185
+ return;
186
+ }
187
+ options.diag.error(label, {
188
+ session: safeSessionId(options),
189
+ error: safeErrorMessage(error)
190
+ });
191
+ if (options.onError !== void 0) return guardHandler(() => options.onError(error));
192
+ }
193
+ /** The task-local predicate (cancellation classification is already gated
194
+ * by the caller). A throwing predicate is wrapped as a handler failure — it
195
+ * never re-routes the original error into the wrong classification and is
196
+ * never itself re-classified. */
197
+ function taskLocalCancellation(options, error) {
198
+ if (options.isCancellation === void 0) return false;
199
+ try {
200
+ return options.isCancellation(error) === true;
201
+ } catch (classifierError) {
202
+ throw new HandlerFailure(classifierError);
203
+ }
204
+ }
205
+ /**
206
+ * Immutable wrapper for a terminal side-effect handler's own failure. The
207
+ * thrown value is NEVER mutated (a primitive, null, or a frozen/non-
208
+ * extensible error must survive intact); the wrapper carries the original
209
+ * cause to the handler-failure sink, and the middle classification catch
210
+ * recognizes it and forwards it unchanged — so `onError`/`onCancel` run
211
+ * exactly once even when they throw.
212
+ */
213
+ var HandlerFailure = class {
214
+ cause;
215
+ constructor(cause) {
216
+ this.cause = cause;
217
+ handlerFailures.add(this);
218
+ }
219
+ };
220
+ /** Identity registry for the internal wrappers: `WeakSet.has` compares by
221
+ * identity and never walks the argument's prototype chain, so a hostile
222
+ * thrown value (a Proxy with a throwing `getPrototypeOf` trap) can be
223
+ * tested safely — `instanceof HandlerFailure` on an untrusted value could
224
+ * itself throw. */
225
+ const handlerFailures = /* @__PURE__ */ new WeakSet();
226
+ /** Whether a value is one of OUR wrapper instances (identity only; total
227
+ * over the whole `unknown` domain). */
228
+ function isHandlerFailure(value) {
229
+ return typeof value === "object" && value !== null && handlerFailures.has(value);
230
+ }
231
+ /** Run a per-task terminal callback; a sync or async failure is wrapped in
232
+ * {@link HandlerFailure} so the chain forwards it to the handler-failure
233
+ * sink instead of re-classifying it (and never repeats the callback). */
234
+ function guardHandler(invoke) {
235
+ try {
236
+ const outcome = invoke();
237
+ if (outcome !== void 0) return outcome.catch((error) => {
238
+ throw new HandlerFailure(error);
239
+ });
240
+ return;
241
+ } catch (error) {
242
+ throw new HandlerFailure(error);
243
+ }
244
+ }
245
+ /**
246
+ * The final sink of both helpers: a terminal side-effect handler
247
+ * (onResult's own invocation aside — see {@link runOwned}), a task-local
248
+ * classifier, or the diagnostics channel itself threw. The ENTIRE body is
249
+ * protected — wrapper unwrapping, error description, the session read and
250
+ * the diag call all live inside the try, and the fallback is a fixed
251
+ * constant that never touches the hostile value again — so the sink is a
252
+ * total function over the `unknown` domain: it can NEVER reject, and there
253
+ * is no lower sink to leak into.
254
+ */
255
+ function handlerFailure(label, options) {
256
+ return (error) => {
257
+ try {
258
+ const cause = isHandlerFailure(error) ? error.cause : error;
259
+ options.diag.error(`${label} handler failed`, {
260
+ session: safeSessionId(options),
261
+ error: safeErrorMessage(cause)
262
+ });
263
+ } catch {}
264
+ };
265
+ }
266
+ //#endregion
267
+ export { runOwned as a, runDetached as i, isCancellation as n, safeErrorMessage as o, observeSettled as r, safeErrorString as s, cancellationError as t };