@xmoon76/dsh-pi-tui 0.5.4 → 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 (46) hide show
  1. package/README.en.md +28 -7
  2. package/README.md +25 -6
  3. package/dist/application-runtime-CbBO4bY-.mjs +6860 -0
  4. package/dist/bootstrap-DLOydLLj.mjs +108410 -0
  5. package/dist/builtins.mjs +2 -3
  6. package/dist/client-bootstrap-DwSFzcTW.mjs +872 -0
  7. package/dist/context-summary-Bz0AGXa1.mjs +12027 -0
  8. package/dist/{context-summary-DAisTA_7.mjs → context-summary-D9mhxPXL.mjs} +1468 -10
  9. package/dist/custom-items-CKrOBCox.mjs +655 -0
  10. package/dist/disposal-BYBbEpVY.mjs +54 -0
  11. package/dist/dispose-cause-BzcXo4hu.mjs +123 -0
  12. package/dist/dist-C7QMk0ws.mjs +15431 -0
  13. package/dist/{entry-control-DvSrndWd.mjs → entry-control-DnduyDiw.mjs} +12 -31
  14. package/dist/{extensions-CcuMY4n2.mjs → extensions-pcFiH7Qe.mjs} +758 -68
  15. package/dist/extensions.mjs +1 -1
  16. package/dist/host-bootstrap-CKdfLkNS.mjs +188 -0
  17. package/dist/host-foundation-probe-CYHsbAw6.mjs +143 -0
  18. package/dist/host-prerequisites-9JBTtVNu.mjs +36 -0
  19. package/dist/host-runtime.d.mts +26 -0
  20. package/dist/host-runtime.mjs +450 -0
  21. package/dist/index.d.mts +8 -1
  22. package/dist/index.mjs +5192 -2118
  23. package/dist/local-client.mjs +1681 -188
  24. package/dist/local-discovery-CXnLT4GF.mjs +755 -0
  25. package/dist/local-discovery-DVFFpfBG.mjs +2 -0
  26. package/dist/local-host.mjs +927 -78
  27. package/dist/local-transport-C9aonplC.mjs +513 -0
  28. package/dist/performance-host.d.mts +2 -2
  29. package/dist/performance-host.mjs +258 -1
  30. package/dist/pi-tui-remote-contribution-DRk6Tl3J.mjs +78 -0
  31. package/dist/pi-tui-terminal-progress-contract-CdBH9j78.mjs +70 -0
  32. package/dist/pi-tui-terminal-progress-contract-XTQKj-WW.mjs +905 -0
  33. package/dist/{runtime-vc4mdr-R.mjs → runtime-Bh5OsftD.mjs} +655 -675
  34. package/dist/runtime-C5ROZqFj.mjs +2 -0
  35. package/dist/{session-tdJHLnJR.mjs → session-4keoXjk0.mjs} +2341 -217
  36. package/dist/session-B2zqv4wr.mjs +10869 -0
  37. package/dist/{startup-JaVZoTIl.mjs → startup-Ct2UUjUL.mjs} +7 -6
  38. package/dist/startup.d.mts +1 -1
  39. package/dist/startup.mjs +1 -1
  40. package/dist/{client-bootstrap-F5DHFI9t.mjs → terminal-progress-source-BhufrZ74.mjs} +3431 -3007
  41. package/dist/terminal-progress-source-CsBinCJ_.mjs +965 -0
  42. package/package.json +125 -116
  43. package/dist/host-bootstrap-DAgKknbY.mjs +0 -119
  44. package/dist/performance-host-CcDJjjVA.mjs +0 -266
  45. package/dist/rolldown-runtime-8H4AJuhK.mjs +0 -14
  46. package/dist/terminal-progress-source-xor3vakJ.mjs +0 -2256
@@ -0,0 +1,54 @@
1
+ //#region src/runtime/process/disposal.ts
2
+ /**
3
+ * The ONE synchronous disposal primitive (M3-6 PR3 plan D1): attempt every
4
+ * cleanup step in caller-provided order, then surface the collected failure.
5
+ *
6
+ * The helper answers exactly one question — "attempt every synchronous
7
+ * cleanup step in this order, then surface collected failure(s)" — and owns
8
+ * nothing else: no async support, no ownership state, no logging, no retries
9
+ * and no fallback. Ownership slots stay inside the owning module; every
10
+ * orchestrator (bootstrap, TuiApp, SurfaceRuntime, the per-owner dispose
11
+ * methods) keeps its own order and passes it here.
12
+ *
13
+ * Failure contract:
14
+ * - zero failures: return;
15
+ * - exactly one failure: rethrow the EXACT original thrown value;
16
+ * - two or more failures: throw `AggregateError(failures, label)`.
17
+ *
18
+ * A throwing step never truncates its siblings.
19
+ * @module @xmoon76/dsh-pi-tui/runtime/process/disposal
20
+ */
21
+ /** Attempt every synchronous disposal step in order, surfacing failures. */
22
+ function runSyncDisposalSteps(label, steps) {
23
+ const failures = [];
24
+ for (const step of steps) try {
25
+ step();
26
+ } catch (error) {
27
+ failures.push(error);
28
+ }
29
+ if (failures.length === 1) throw failures[0];
30
+ if (failures.length > 1) throw new AggregateError(failures, label);
31
+ }
32
+ /**
33
+ * The same non-truncating attempt, for a batch that rolls back a PRIMARY failure:
34
+ * every rollback step is attempted in caller-provided order, then the PRIMARY
35
+ * value is thrown — aggregated by IDENTITY with the collected rollback failures,
36
+ * the primary first and the rollback values FLAT, in step order
37
+ * (`AggregateError([primary, r1, r2])`). One rollback obligation must never be
38
+ * skipped because an earlier one threw, and every value a step threw stays ONE
39
+ * entry — a user `AggregateError` is never flattened into its `.errors`. The step
40
+ * loop is inlined (not delegated to {@link runSyncDisposalSteps}, which would
41
+ * nest its own aggregate one level down).
42
+ */
43
+ function runSyncDisposalStepsWithPrimary(label, primary, steps) {
44
+ const failures = [];
45
+ for (const step of steps) try {
46
+ step();
47
+ } catch (error) {
48
+ failures.push(error);
49
+ }
50
+ if (failures.length === 0) throw primary;
51
+ throw new AggregateError([primary, ...failures], label);
52
+ }
53
+ //#endregion
54
+ export { runSyncDisposalStepsWithPrimary as n, runSyncDisposalSteps as t };
@@ -0,0 +1,123 @@
1
+ import { n as PI_TUI_TERMINAL_PROGRESS_WATCH } from "./pi-tui-terminal-progress-contract-XTQKj-WW.mjs";
2
+ //#region src/runtime/remote/pi-tui-file-reference-contract.ts
3
+ /** The wire namespace (and Host Cordis service key) of the augmentation. */
4
+ const PI_TUI_FILE_REFERENCES_NAMESPACE = "piTuiFileReferences";
5
+ /** The private method's stable endpoint identity. */
6
+ const PI_TUI_FILE_REFERENCES_LIST_ENDPOINT = "@xmoon76/dsh-pi-tui#piTuiFileReferences/list";
7
+ /** One strict JSON codec that validates a wire string. */
8
+ function stringCodec(typeSymbol) {
9
+ return {
10
+ mode: "strict",
11
+ typeSymbol,
12
+ create: () => ({ parse: (value) => {
13
+ if (typeof value !== "string") throw new TypeError(`${typeSymbol}: the wire value must be a string`);
14
+ return value;
15
+ } })
16
+ };
17
+ }
18
+ /**
19
+ * Validate and detach one wire `HostFileListResult`. The result is produced by
20
+ * this package's own Host router, but it is still a wire boundary on the Client
21
+ * and the ONLY place the shape crosses.
22
+ */
23
+ function decodeHostFileListResult(value) {
24
+ if (typeof value !== "object" || value === null) throw new TypeError("piTuiFileReferences/list: the result must be an object");
25
+ const record = value;
26
+ if (record.kind === "unavailable") {
27
+ if (typeof record.reason !== "string") throw new TypeError("piTuiFileReferences/list: an unavailable result needs a reason");
28
+ return {
29
+ kind: "unavailable",
30
+ reason: record.reason
31
+ };
32
+ }
33
+ if (record.kind !== "ok" || !Array.isArray(record.items)) throw new TypeError("piTuiFileReferences/list: the result must be ok(items) or unavailable(reason)");
34
+ return {
35
+ kind: "ok",
36
+ items: record.items.map((entry) => {
37
+ if (typeof entry !== "object" || entry === null) throw new TypeError("piTuiFileReferences/list: every candidate must be an object");
38
+ const candidate = entry;
39
+ if (typeof candidate.path !== "string" || candidate.kind !== "file" && candidate.kind !== "directory") throw new TypeError("piTuiFileReferences/list: every candidate needs a string path and a file/directory kind");
40
+ return {
41
+ path: candidate.path,
42
+ kind: candidate.kind
43
+ };
44
+ })
45
+ };
46
+ }
47
+ const HOST_FILE_LIST_RESULT_CODEC = {
48
+ mode: "strict",
49
+ typeSymbol: "@xmoon76/dsh-pi-tui#piTuiFileReferences/list:result",
50
+ create: () => ({ parse: decodeHostFileListResult }),
51
+ decode: decodeHostFileListResult
52
+ };
53
+ /**
54
+ * The ONE shared invocation descriptor both contributions derive from. The
55
+ * Host registers this exact object; the Client mounts this exact object.
56
+ */
57
+ const PI_TUI_FILE_REFERENCES_LIST = {
58
+ id: PI_TUI_FILE_REFERENCES_LIST_ENDPOINT,
59
+ service: PI_TUI_FILE_REFERENCES_NAMESPACE,
60
+ namespace: PI_TUI_FILE_REFERENCES_NAMESPACE,
61
+ method: "list",
62
+ invocation: { kind: "direct" },
63
+ parameters: [{
64
+ name: "sessionId",
65
+ wire: "sessionId",
66
+ source: "json",
67
+ codec: stringCodec("@xmoon76/dsh-pi-tui#piTuiFileReferences/list:sessionId")
68
+ }, {
69
+ name: "query",
70
+ wire: "query",
71
+ source: "json",
72
+ codec: stringCodec("@xmoon76/dsh-pi-tui#piTuiFileReferences/list:query")
73
+ }],
74
+ cancellation: { parameter: "signal" },
75
+ result: HOST_FILE_LIST_RESULT_CODEC
76
+ };
77
+ //#endregion
78
+ //#region src/runtime/remote/pi-tui-remote-contribution.ts
79
+ /** The npm package that owns every private Remote invocation here. A test
80
+ * guards that it equals each contract module's own package constant. */
81
+ const PI_TUI_REMOTE_PACKAGE = "@xmoon76/dsh-pi-tui";
82
+ /** The explicit Host contribution registered once with `ctx.typert.register`. */
83
+ const PI_TUI_HOST_CONTRIBUTION = {
84
+ package: PI_TUI_REMOTE_PACKAGE,
85
+ face: "host",
86
+ schemas: [],
87
+ model: {
88
+ services: [],
89
+ events: [],
90
+ objects: []
91
+ },
92
+ invocations: [PI_TUI_FILE_REFERENCES_LIST, PI_TUI_TERMINAL_PROGRESS_WATCH]
93
+ };
94
+ /** The explicit Client contribution mounted once with `ctx.remote.$mount`. */
95
+ const PI_TUI_CLIENT_CONTRIBUTION = {
96
+ package: PI_TUI_REMOTE_PACKAGE,
97
+ descriptors: [PI_TUI_FILE_REFERENCES_LIST, PI_TUI_TERMINAL_PROGRESS_WATCH]
98
+ };
99
+ //#endregion
100
+ //#region src/app/remote/dispose-cause.ts
101
+ /**
102
+ * Transport-neutral disposal failure chaining for the Remote composition.
103
+ *
104
+ * The helper is shared by the Host composition, the official Client runtime,
105
+ * the Client UI subtree and the application aggregate. It deliberately lives
106
+ * beside them (not inside `host-runtime.ts`) so a Client-only process entry can
107
+ * reuse it without importing a Host-only value graph.
108
+ *
109
+ * @module app/remote/dispose-cause
110
+ */
111
+ /**
112
+ * Attach one secondary failure to `failure`'s cause chain without losing an
113
+ * existing cause: when the failure already carries a cause, both aggregate
114
+ * into a single `AggregateError`. A `undefined` secondary is a no-op.
115
+ */
116
+ function mergeCause(failure, secondary) {
117
+ if (secondary === void 0) return failure;
118
+ const existingCause = failure.cause;
119
+ failure.cause = existingCause === void 0 ? secondary : new AggregateError([existingCause, secondary], "remote composition: aggregated failure causes");
120
+ return failure;
121
+ }
122
+ //#endregion
123
+ export { PI_TUI_FILE_REFERENCES_NAMESPACE as i, PI_TUI_CLIENT_CONTRIBUTION as n, PI_TUI_HOST_CONTRIBUTION as r, mergeCause as t };