@xmoon76/dsh-pi-tui 0.5.3 → 0.5.5

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 (59) hide show
  1. package/README.en.md +195 -150
  2. package/README.md +137 -103
  3. package/cordis.patch.yml +54 -2
  4. package/dist/application-runtime-CbBO4bY-.mjs +6860 -0
  5. package/dist/bootstrap-DLOydLLj.mjs +108410 -0
  6. package/dist/builtins.mjs +2 -3
  7. package/dist/client-bootstrap-DwSFzcTW.mjs +872 -0
  8. package/dist/context-summary-Bz0AGXa1.mjs +12027 -0
  9. package/dist/context-summary-D9mhxPXL.mjs +10015 -0
  10. package/dist/custom-items-CKrOBCox.mjs +655 -0
  11. package/dist/disposal-BYBbEpVY.mjs +54 -0
  12. package/dist/dispose-cause-BzcXo4hu.mjs +123 -0
  13. package/dist/dispose-cause-CNFuUnjR.mjs +24 -0
  14. package/dist/dist-C7QMk0ws.mjs +15431 -0
  15. package/dist/entry-control-DnduyDiw.mjs +92 -0
  16. package/dist/extension/advanced.d.mts +1 -1
  17. package/dist/extension/unstable.d.mts +1 -1
  18. package/dist/{extensions-DzpBiiYb.d.mts → extensions-Bte3XOt5.d.mts} +1 -1
  19. package/dist/{extensions-a-rxanjw.mjs → extensions-pcFiH7Qe.mjs} +1498 -410
  20. package/dist/extensions.d.mts +2 -2
  21. package/dist/extensions.mjs +1 -1
  22. package/dist/host-bootstrap-CKdfLkNS.mjs +188 -0
  23. package/dist/host-foundation-probe-CYHsbAw6.mjs +143 -0
  24. package/dist/host-prerequisites-9JBTtVNu.mjs +36 -0
  25. package/dist/host-runtime.d.mts +26 -0
  26. package/dist/host-runtime.mjs +450 -0
  27. package/dist/index.d.mts +9 -2
  28. package/dist/index.mjs +45779 -24480
  29. package/dist/local-client.mjs +1816 -0
  30. package/dist/local-discovery-CXnLT4GF.mjs +755 -0
  31. package/dist/local-discovery-DVFFpfBG.mjs +2 -0
  32. package/dist/local-host.mjs +1025 -0
  33. package/dist/local-transport-C9aonplC.mjs +513 -0
  34. package/dist/performance-host.d.mts +2 -2
  35. package/dist/performance-host.mjs +258 -1
  36. package/dist/{performance-view-jvvd8Jn7.mjs → performance-view-CfGvLZyD.mjs} +1 -1
  37. package/dist/pi-tui-remote-contribution-DRk6Tl3J.mjs +78 -0
  38. package/dist/pi-tui-terminal-progress-contract-CdBH9j78.mjs +70 -0
  39. package/dist/pi-tui-terminal-progress-contract-XTQKj-WW.mjs +905 -0
  40. package/dist/{public-types-gZi3iFNh.d.mts → public-types-Dgf1bDke.d.mts} +3 -3
  41. package/dist/{runtime-BtPH-UUb.mjs → runtime-Bh5OsftD.mjs} +1311 -1024
  42. package/dist/runtime-C5ROZqFj.mjs +2 -0
  43. package/dist/runtime-status-0lp9CM0V.mjs +1923 -0
  44. package/dist/session-4keoXjk0.mjs +10869 -0
  45. package/dist/session-B2zqv4wr.mjs +10869 -0
  46. package/dist/{startup-D5Xu8diR.mjs → startup-Ct2UUjUL.mjs} +55 -13
  47. package/dist/startup.d.mts +2 -1
  48. package/dist/startup.mjs +1 -1
  49. package/dist/terminal-progress-source-BhufrZ74.mjs +6000 -0
  50. package/dist/terminal-progress-source-CsBinCJ_.mjs +965 -0
  51. package/dist/visual-tools.d.mts +62 -0
  52. package/dist/visual-tools.mjs +556 -0
  53. package/generated/dsh-presets/README.md +1 -1
  54. package/package.json +145 -117
  55. package/dist/context-summary-CxUpNkA9.mjs +0 -2951
  56. package/dist/performance-host-BJT6scGF.mjs +0 -266
  57. package/dist/rolldown-runtime-8H4AJuhK.mjs +0 -14
  58. package/dist/session-BZLxhrPQ.mjs +0 -5697
  59. package/dist/terminal-progress-source-BlmksrSD.mjs +0 -2200
@@ -0,0 +1,450 @@
1
+ import { a as listPiTuiHostFileReferences, i as createTerminalProgressInterval, o as DirectHostDiscoveryDriver, s as hostPathQueryEnvironment, t as PI_TUI_TERMINAL_PROGRESS_NAMESPACE } from "./pi-tui-terminal-progress-contract-XTQKj-WW.mjs";
2
+ import { i as PI_TUI_FILE_REFERENCES_NAMESPACE, r as PI_TUI_HOST_CONTRIBUTION, t as mergeCause } from "./dispose-cause-BzcXo4hu.mjs";
3
+ import { TypertRemoteService } from "@deepseek-ai/dsh-typert-protocol";
4
+ //#region src/runtime/remote/pi-tui-file-reference-host-bridge.ts
5
+ /**
6
+ * The Remote Host-side bridge for the private `piTuiFileReferences` endpoint
7
+ * (TS8-HF1): a CONSTRUCTION/ADAPTATION seam ONLY. It binds the private Remote
8
+ * method to the SAME Host-scoped completion authority the Direct adapter uses
9
+ * (`runtime/direct/host-file-augmentation-direct.ts` + the Direct Host
10
+ * discovery driver) and returns a transport-neutral `list` runtime.
11
+ *
12
+ * It owns NO Cordis service, NO Typert registration and NO lifecycle policy —
13
+ * the Cordis service, its Typert contribution registration and its disposal
14
+ * remain with the built-in PiTui Host Runtime
15
+ * (`app/host/features/file-reference.ts`). The dependency direction is
16
+ * therefore `app/host/features/** -> runtime/remote/** -> runtime/direct/**`,
17
+ * never `app/host/** -> runtime/direct/**`.
18
+ *
19
+ * The bridge lives in `runtime/remote/**` because that layer may consume the
20
+ * Direct Host implementation; the composition layer may not.
21
+ *
22
+ * @module @xmoon76/dsh-pi-tui/runtime/remote/pi-tui-file-reference-host-bridge
23
+ */
24
+ /**
25
+ * Bind the private Remote method to the Host-scoped completion authority.
26
+ * The Host finder is resolved ONCE for the runtime's lifetime (it is a pure
27
+ * PATH pin; a later PATH change is not a Host completion fact).
28
+ */
29
+ function createPiTuiHostFileReferenceRuntime(deps) {
30
+ const driver = new DirectHostDiscoveryDriver(deps.fdPath);
31
+ const environment = hostPathQueryEnvironment();
32
+ return { async list(sessionId, query, signal) {
33
+ signal.throwIfAborted();
34
+ const agent = deps.agentFor(sessionId);
35
+ if (agent === void 0) return {
36
+ kind: "unavailable",
37
+ reason: "the requested Session has no live Host Agent"
38
+ };
39
+ return await listPiTuiHostFileReferences(agent, query, signal, {
40
+ official: deps.official(),
41
+ driver,
42
+ environment,
43
+ workingDirectory: deps.workingDirectory?.()
44
+ });
45
+ } };
46
+ }
47
+ //#endregion
48
+ //#region src/app/host/features/file-reference.ts
49
+ /**
50
+ * The Host endpoint of the private augmentation. One instance per built-in
51
+ * Host Runtime; the descriptor leaves with the owning fiber.
52
+ */
53
+ var PiTuiFileReferenceHostService = class extends TypertRemoteService {
54
+ /** The Typert registry owns the explicit invocation definitions. */
55
+ static inject = ["typert"];
56
+ runtime;
57
+ /**
58
+ * @param ctx - the Host context this row is mounted in.
59
+ * @param deps - the narrow Host facts the built-in Host Runtime resolved.
60
+ */
61
+ constructor(ctx, deps) {
62
+ super(ctx, PI_TUI_FILE_REFERENCES_NAMESPACE);
63
+ this.runtime = createPiTuiHostFileReferenceRuntime({
64
+ ...deps,
65
+ workingDirectory: () => ctx.get("workingDirectory")
66
+ });
67
+ }
68
+ /**
69
+ * The private Remote method (`piTuiFileReferences/list`, see
70
+ * `pi-tui-file-reference-contract.ts`). Cancellation outranks every outcome.
71
+ */
72
+ list(sessionId, query, signal) {
73
+ return this.runtime.list(sessionId, query, signal);
74
+ }
75
+ };
76
+ //#endregion
77
+ //#region src/app/host/features/terminal-progress.ts
78
+ /** The structural `turn/start` / `turn/end` payload read (never a guessed shape). */
79
+ function turnOf(data) {
80
+ const turn = data?.turn;
81
+ return typeof turn === "number" ? turn : void 0;
82
+ }
83
+ /** The merge-extensible `turn/end.reason.kind` discriminant. */
84
+ function reasonKindOf(data) {
85
+ const reason = data?.reason;
86
+ return typeof reason?.kind === "string" ? reason.kind : void 0;
87
+ }
88
+ /**
89
+ * Frames one subscriber may fall behind by before the stream is failed instead
90
+ * of silently losing an edge. A real run produces a handful of transitions, so
91
+ * only a consumer that stopped draining can reach it.
92
+ */
93
+ const SUBSCRIBER_QUEUE_LIMIT = 64;
94
+ /**
95
+ * One subscriber's ordered frame queue. The Host ALWAYS mutates the record
96
+ * before pushing, so a queue can never observe a frame the record has not
97
+ * committed, and `close()` is idempotent.
98
+ *
99
+ * An overflowing queue FAILS the reader: dropping frames and continuing would
100
+ * let a stream report a settlement whose running edge it lost (plan §6.5).
101
+ */
102
+ var FrameQueue = class {
103
+ frames = [];
104
+ wake;
105
+ closed = false;
106
+ failure;
107
+ limit = SUBSCRIBER_QUEUE_LIMIT;
108
+ push(frame) {
109
+ if (this.closed || this.failure !== void 0) return;
110
+ if (this.frames.length >= this.limit) {
111
+ this.failure = /* @__PURE__ */ new Error("piTuiTerminalProgress: the subscriber queue overflowed");
112
+ this.frames.length = 0;
113
+ const wake = this.wake;
114
+ this.wake = void 0;
115
+ wake?.();
116
+ return;
117
+ }
118
+ this.frames.push(frame);
119
+ const wake = this.wake;
120
+ this.wake = void 0;
121
+ wake?.();
122
+ }
123
+ /**
124
+ * End the consumer's read AFTER every frame already committed to it: a
125
+ * disposal publishes the retired interval BEFORE it ends the watchers, and a
126
+ * committed terminal fact must never be dropped in flight.
127
+ */
128
+ close() {
129
+ if (this.closed) return;
130
+ this.closed = true;
131
+ const wake = this.wake;
132
+ this.wake = void 0;
133
+ wake?.();
134
+ }
135
+ async next() {
136
+ for (;;) {
137
+ const frame = this.frames.shift();
138
+ if (frame !== void 0) return {
139
+ value: frame,
140
+ done: false
141
+ };
142
+ if (this.failure !== void 0) throw this.failure;
143
+ if (this.closed) return {
144
+ value: void 0,
145
+ done: true
146
+ };
147
+ await new Promise((resolve) => {
148
+ this.wake = resolve;
149
+ });
150
+ }
151
+ }
152
+ };
153
+ /**
154
+ * The Host endpoint of the private stream. One instance per built-in Host
155
+ * Runtime; the descriptors and the subscriptions leave with the fiber.
156
+ */
157
+ var PiTuiTerminalProgressHostService = class extends TypertRemoteService {
158
+ /** The Typert registry owns the explicit invocation definition. */
159
+ static inject = ["typert"];
160
+ /** The narrow Host facts the built-in Host Runtime resolved (explicit field:
161
+ * the strip-only TS loader rejects parameter properties). */
162
+ deps;
163
+ /** One opaque identity per Host plugin instance: a Host restart, a new
164
+ * composition or a re-mounted fiber all invalidate older frames. */
165
+ hostEpoch = `host-${randomEpoch()}`;
166
+ records = /* @__PURE__ */ new Map();
167
+ /** Monotonic Agent-lifetime counter: a replacement ALWAYS outranks every
168
+ * earlier lifetime of the same session, even after its record was dropped. */
169
+ epochCounter = 0;
170
+ disposed = false;
171
+ /**
172
+ * @param ctx - the Host context this row is mounted in.
173
+ * @param deps - the narrow Host facts the built-in Host Runtime resolved.
174
+ */
175
+ constructor(ctx, deps) {
176
+ super(ctx, PI_TUI_TERMINAL_PROGRESS_NAMESPACE);
177
+ this.deps = deps;
178
+ ctx.on("agent/status", ({ agent, status }) => {
179
+ this.onAgentStatus(agent, status);
180
+ }, { global: true });
181
+ ctx.on("session/event", (session, event) => {
182
+ this.onSessionEvent(session, event.type, event.data);
183
+ }, { global: true });
184
+ ctx.on("agent/disposed", ({ agent }) => {
185
+ this.onAgentDisposed(agent);
186
+ }, { global: true });
187
+ ctx.effect(() => () => {
188
+ this.closeAll();
189
+ }, "pi-tui-terminal-progress-watchers");
190
+ }
191
+ /**
192
+ * The private Remote method (`piTuiTerminalProgress/watch`): the ONE
193
+ * per-session ordered stream, opening with the authoritative snapshot of the
194
+ * instant it subscribes and then every real Host-side change (plan §6.5).
195
+ *
196
+ * The subscriber is registered and the cut (revision + current state) is
197
+ * captured in the SAME synchronous block before the first `yield`, so an
198
+ * update can neither be lost between the snapshot and the subscription nor be
199
+ * replayed twice.
200
+ */
201
+ async *watch(sessionId, signal) {
202
+ const record = this.recordFor(sessionId);
203
+ const queue = new FrameQueue();
204
+ const cut = record.revision;
205
+ const snapshot = {
206
+ kind: "snapshot",
207
+ sessionId,
208
+ hostEpoch: this.hostEpoch,
209
+ agentEpoch: record.agentEpoch,
210
+ revision: cut,
211
+ running: record.running,
212
+ outcome: record.outcome
213
+ };
214
+ record.subscribers.add(queue);
215
+ const onAbort = () => {
216
+ queue.close();
217
+ };
218
+ if (signal.aborted) queue.close();
219
+ else signal.addEventListener("abort", onAbort, { once: true });
220
+ try {
221
+ yield snapshot;
222
+ for (;;) {
223
+ const next = await queue.next();
224
+ if (next.done === true) return;
225
+ yield next.value;
226
+ }
227
+ } finally {
228
+ signal.removeEventListener("abort", onAbort);
229
+ record.subscribers.delete(queue);
230
+ this.reclaim(record);
231
+ }
232
+ }
233
+ /**
234
+ * Drop a record nobody watches and no Agent owns. A watch of a session that
235
+ * has no live Agent must not leave an empty record behind for the rest of the
236
+ * Host's life: it is observable by nothing, and the next Agent lifetime starts
237
+ * a FRESH record carrying a HIGHER `agentEpoch` (the epoch counter never
238
+ * rewinds), so no Client provenance can be resurrected across the gap.
239
+ */
240
+ reclaim(record) {
241
+ if (record.subscribers.size > 0 || record.agent !== void 0) return;
242
+ if (this.records.get(record.sessionId) === record) this.records.delete(record.sessionId);
243
+ }
244
+ /** The live `agent/status` transition of one Agent (plan §6.4). */
245
+ onAgentStatus(agent, status) {
246
+ if (this.deps.agentFor(agent.session.id) !== agent) return;
247
+ const record = this.recordFor(agent.session.id);
248
+ if (record.agent !== agent) return;
249
+ this.publish(record, record.fold.status(status === "running"));
250
+ }
251
+ /** One durable Session event (plan §6.4): evidence only, never an interim commit. */
252
+ onSessionEvent(session, type, data) {
253
+ const record = this.records.get(session.id);
254
+ if (record === void 0 || record.agent === void 0) return;
255
+ if (record.session !== session) return;
256
+ if (type === "turn/start") {
257
+ const turn = turnOf(data);
258
+ if (turn !== void 0) record.fold.turnStart(turn);
259
+ return;
260
+ }
261
+ if (type === "turn/end") {
262
+ const turn = turnOf(data);
263
+ const kind = reasonKindOf(data);
264
+ if (turn !== void 0 && kind !== void 0) record.fold.turnEnd(turn, kind);
265
+ }
266
+ }
267
+ /** The Agent lifetime ended (plan §6.4): retire honestly, end the watchers. */
268
+ onAgentDisposed(agent) {
269
+ const record = this.records.get(agent.session.id);
270
+ if (record === void 0 || record.agent !== agent) return;
271
+ const retired = record.fold.retire();
272
+ if (retired !== void 0) this.publish(record, retired);
273
+ this.records.delete(agent.session.id);
274
+ for (const subscriber of record.subscribers) subscriber.close();
275
+ }
276
+ /**
277
+ * The record of one session, bound to the live Agent the authoritative Host
278
+ * registry currently holds. Creation AND a replaced Agent lifetime consume a
279
+ * new `agentEpoch` and reset the interval: a new Agent can never inherit the
280
+ * previous lifetime's evidence (plan §6.3/§6.4).
281
+ */
282
+ recordFor(sessionId) {
283
+ let record = this.records.get(sessionId);
284
+ if (record === void 0) {
285
+ record = {
286
+ sessionId,
287
+ agent: void 0,
288
+ session: void 0,
289
+ agentEpoch: 0,
290
+ fold: createTerminalProgressInterval((kind) => {
291
+ this.deps.onUnknownReason(kind);
292
+ }),
293
+ revision: 0,
294
+ running: false,
295
+ outcome: "idle",
296
+ subscribers: /* @__PURE__ */ new Set()
297
+ };
298
+ this.records.set(sessionId, record);
299
+ }
300
+ const live = this.deps.agentFor(sessionId);
301
+ if (live !== void 0 && live !== record.agent) this.rebind(record, live);
302
+ return record;
303
+ }
304
+ /**
305
+ * Bind one Agent lifetime: the running truth is read from the Agent's OWN
306
+ * current status (a plugin mounted mid-run may therefore report `working`),
307
+ * but the outcome starts at `idle` — an unobserved start can never prove a
308
+ * settlement. The rebind is ALWAYS published, because the epoch change is
309
+ * itself a fact the Client must fence on.
310
+ */
311
+ rebind(record, agent) {
312
+ record.agent = agent;
313
+ record.session = agent.session;
314
+ record.agentEpoch = ++this.epochCounter;
315
+ const running = agent.status === "running";
316
+ record.fold.apply({
317
+ active: running,
318
+ outcome: "idle"
319
+ });
320
+ record.running = running;
321
+ record.outcome = "idle";
322
+ record.revision += 1;
323
+ this.broadcast(record, "update");
324
+ }
325
+ /** Commit one fold transition: mutate the record FIRST, then broadcast. */
326
+ publish(record, next) {
327
+ if (next === void 0) return;
328
+ if (next.active === record.running && next.outcome === record.outcome) return;
329
+ record.running = next.active;
330
+ record.outcome = next.outcome;
331
+ record.revision += 1;
332
+ this.broadcast(record, "update");
333
+ }
334
+ broadcast(record, kind) {
335
+ const frame = {
336
+ kind,
337
+ sessionId: record.sessionId,
338
+ hostEpoch: this.hostEpoch,
339
+ agentEpoch: record.agentEpoch,
340
+ revision: record.revision,
341
+ running: record.running,
342
+ outcome: record.outcome
343
+ };
344
+ for (const subscriber of record.subscribers) subscriber.push(frame);
345
+ }
346
+ /** End every watcher (the row's fiber is going away). */
347
+ closeAll() {
348
+ if (this.disposed) return;
349
+ this.disposed = true;
350
+ for (const record of this.records.values()) for (const subscriber of record.subscribers) subscriber.close();
351
+ }
352
+ };
353
+ /** An opaque, process-unique Host-plugin identity (the wire sees only a string). */
354
+ function randomEpoch() {
355
+ return `${Date.now().toString(36)}-${Math.random().toString(36).slice(2, 10)}`;
356
+ }
357
+ //#endregion
358
+ //#region src/app/host/pi-tui-host-runtime.ts
359
+ /** Stable Cordis plugin name (the Loader row id in the Host-only overlay). */
360
+ const name = "pi-tui-host-runtime";
361
+ /**
362
+ * Explicit Host dependencies: the private Typert registry plus the two live
363
+ * Host facts the business rows resolve per call. `tuiStartup` remains a Loader
364
+ * row gate (see the Host-only overlay), not a plugin inject.
365
+ */
366
+ const inject = [
367
+ "typert",
368
+ "agents",
369
+ "fileReferences",
370
+ "workingDirectory"
371
+ ];
372
+ /** Data-free readiness gate published after the whole built-in runtime is live. */
373
+ const PI_TUI_HOST_READY_SERVICE = "piTuiHostReady";
374
+ /**
375
+ * Read the LIVE Agent of one Session through the authoritative Host registry
376
+ * PER CALL: a replaced registry or Agent must be observed, never a
377
+ * composition-time snapshot.
378
+ */
379
+ function agentFor(ctx, sessionId) {
380
+ return ctx.reflect.get("agents")?.get(sessionId);
381
+ }
382
+ /**
383
+ * Assert one private Typert service is readable through its exact Cordis
384
+ * service key and carries the expected wire namespace. A truthy service alone
385
+ * is not proof: the Gateway dispatches on the binding, not the service object.
386
+ */
387
+ function assertPrivateBinding(ctx, serviceKey, namespace) {
388
+ const service = ctx.reflect.get(serviceKey);
389
+ if (service === void 0) throw new Error(`pi-tui-host-runtime: the "${serviceKey}" service is not readable`);
390
+ const binding = service.typertRemote;
391
+ if (binding === void 0) throw new Error(`pi-tui-host-runtime: the "${serviceKey}" service has no Typert binding`);
392
+ if (binding.serviceKey !== serviceKey) throw new Error(`pi-tui-host-runtime: the "${serviceKey}" Typert service key is ${JSON.stringify(binding.serviceKey)}`);
393
+ if (binding.namespace !== namespace) throw new Error(`pi-tui-host-runtime: the "${serviceKey}" Typert namespace is ${JSON.stringify(binding.namespace)}`);
394
+ }
395
+ /**
396
+ * Mount the built-in PiTui Host Runtime on the launching Host Context.
397
+ *
398
+ * Startup order is fixed: register the package's ONE contribution, mount the
399
+ * file-reference service, mount the terminal-progress service, verify both
400
+ * live bindings, then publish the readiness gate. Every child fiber is recorded
401
+ * BEFORE it is awaited; a partial rejection disposes the recorded children in
402
+ * reverse order (contribution last) while keeping the original error primary
403
+ * and attaching cleanup failures to its cause chain.
404
+ */
405
+ async function apply(ctx) {
406
+ const fibers = [];
407
+ let disposeContribution;
408
+ try {
409
+ disposeContribution = ctx.effect(() => ctx.typert.register(PI_TUI_HOST_CONTRIBUTION), "pi-tui-private-remote-host");
410
+ const fileReferenceFiber = ctx.inject(PiTuiFileReferenceHostService.inject, (pluginCtx) => {
411
+ new PiTuiFileReferenceHostService(pluginCtx, {
412
+ agentFor: (sessionId) => agentFor(ctx, sessionId),
413
+ official: () => ctx.reflect.get("fileReferences")
414
+ });
415
+ });
416
+ fibers.push(fileReferenceFiber);
417
+ await fileReferenceFiber;
418
+ const terminalProgressFiber = ctx.inject(PiTuiTerminalProgressHostService.inject, (pluginCtx) => {
419
+ new PiTuiTerminalProgressHostService(pluginCtx, {
420
+ agentFor: (sessionId) => agentFor(ctx, sessionId),
421
+ onUnknownReason: (kind) => {
422
+ ctx.logger("pi-tui-host-runtime").warn("terminal progress: unknown turn/end reason", { kind });
423
+ }
424
+ });
425
+ });
426
+ fibers.push(terminalProgressFiber);
427
+ await terminalProgressFiber;
428
+ assertPrivateBinding(ctx, "piTuiFileReferences", PI_TUI_FILE_REFERENCES_NAMESPACE);
429
+ assertPrivateBinding(ctx, "piTuiTerminalProgress", PI_TUI_TERMINAL_PROGRESS_NAMESPACE);
430
+ ctx.provide(PI_TUI_HOST_READY_SERVICE, {});
431
+ } catch (error) {
432
+ const cleanupErrors = [];
433
+ for (let index = fibers.length - 1; index >= 0; index -= 1) try {
434
+ await fibers[index].dispose();
435
+ } catch (cleanupError) {
436
+ cleanupErrors.push(cleanupError);
437
+ }
438
+ if (disposeContribution !== void 0) try {
439
+ await disposeContribution();
440
+ } catch (cleanupError) {
441
+ cleanupErrors.push(cleanupError);
442
+ }
443
+ const primary = error instanceof Error ? error : new Error(String(error));
444
+ if (cleanupErrors.length === 0) throw primary;
445
+ const secondary = cleanupErrors.length === 1 ? cleanupErrors[0] : new AggregateError(cleanupErrors, "pi-tui-host-runtime: child disposal failures");
446
+ throw mergeCause(primary, secondary);
447
+ }
448
+ }
449
+ //#endregion
450
+ export { PI_TUI_HOST_READY_SERVICE, apply, inject, name };
package/dist/index.d.mts CHANGED
@@ -1,4 +1,4 @@
1
- import { H as TuiAction } from "./public-types-gZi3iFNh.mjs";
1
+ import { H as TuiAction } from "./public-types-Dgf1bDke.mjs";
2
2
  import { SessionId } from "@deepseek-ai/dsh-session";
3
3
  import { ContentBlock } from "@deepseek-ai/dsh-llm";
4
4
  import { Context, Volatile } from "@deepseek-ai/cordis";
@@ -703,10 +703,17 @@ declare function resolveSubmitDelivery(parsed: {
703
703
  //#endregion
704
704
  //#region src/app/session/interrupt.d.ts
705
705
  /**
706
- * The live-turn interrupt helper (web Stop parity): abort the current
706
+ * The public live-turn interrupt helper (web Stop parity): abort the current
707
707
  * turn/tool run while PRESERVING the pending queue. Kept out of the
708
708
  * composition root so the rule is testable headless, and its structural
709
709
  * faces keep the internal runtime port module out of the published entry.
710
+ *
711
+ * This is the PUBLIC, session-id-addressed writer convenience. The TUI's own
712
+ * Busy Esc / extension `cancel-activity` path does NOT use it: that path goes
713
+ * through `SessionRuntime.interrupt`, which addresses the EXACT captured owner
714
+ * generation under the session control admission (so a navigation transition
715
+ * that froze the ordinary writers cannot refuse it, and a same-id owner
716
+ * rollover cannot receive the wrong generation's cancel).
710
717
  * @module @xmoon76/dsh-pi-tui/app/session/interrupt
711
718
  */
712
719
  /** Public settlement shape for the interrupt helper. Kept local so the