@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.
Files changed (48) hide show
  1. package/README.en.md +30 -47
  2. package/README.md +30 -30
  3. package/cordis.patch.yml +77 -7
  4. package/dist/{bootstrap-DLOydLLj.mjs → bootstrap-DQ4YPL-7.mjs} +12416 -7243
  5. package/dist/builtins.mjs +3 -8
  6. package/dist/{application-runtime-CbBO4bY-.mjs → client-bootstrap-Cr1JCaF5.mjs} +3098 -1747
  7. package/dist/{dist-C7QMk0ws.mjs → dist-CIsR7cz4.mjs} +510 -224
  8. package/dist/{extensions-pcFiH7Qe.mjs → extensions-Bp0L37lP.mjs} +527 -249
  9. package/dist/extensions.mjs +1 -1
  10. package/dist/{host-bootstrap-CKdfLkNS.mjs → host-bootstrap-DilsvA6f.mjs} +106 -13
  11. package/dist/host-foundation-probe--5jtvHVe.mjs +413 -0
  12. package/dist/host-runtime.d.mts +10 -6
  13. package/dist/host-runtime.mjs +877 -10
  14. package/dist/index.d.mts +11 -17
  15. package/dist/index.mjs +13328 -6828
  16. package/dist/local-client.mjs +408 -61
  17. package/dist/{local-discovery-CXnLT4GF.mjs → local-discovery-C9VMjc0K.mjs} +10 -6
  18. package/dist/{local-discovery-DVFFpfBG.mjs → local-discovery-CDaQHA_R.mjs} +1 -1
  19. package/dist/local-host.mjs +188 -36
  20. package/dist/{local-transport-C9aonplC.mjs → local-transport-BVwFYq_Y.mjs} +1 -1
  21. package/dist/{context-summary-D9mhxPXL.mjs → pasted-path-range-CMnxuGPx.mjs} +6166 -227
  22. package/dist/{context-summary-Bz0AGXa1.mjs → pasted-path-range-r6qzV_tC.mjs} +5927 -444
  23. package/dist/{pi-tui-remote-contribution-DRk6Tl3J.mjs → pi-tui-remote-contribution-B0EQsP0N.mjs} +27 -20
  24. package/dist/{pi-tui-terminal-progress-contract-XTQKj-WW.mjs → pi-tui-terminal-progress-contract-MLXZ-i3t.mjs} +2 -2
  25. package/dist/pi-tui-web-access-contract-BN8Cc_Ho.mjs +118 -0
  26. package/dist/{runtime-status-0lp9CM0V.mjs → runtime-status-Cj1nFOdS.mjs} +72 -214
  27. package/dist/{session-4keoXjk0.mjs → session-BKGXyh80.mjs} +7487 -2562
  28. package/dist/{session-B2zqv4wr.mjs → session-CPt_U8_f.mjs} +7486 -2560
  29. package/dist/{startup-Ct2UUjUL.mjs → startup-7BYWuvBU.mjs} +121 -6
  30. package/dist/startup.mjs +1 -1
  31. package/dist/{terminal-progress-source-BhufrZ74.mjs → terminal-progress-source-DrqQhtT8.mjs} +305 -45
  32. package/dist/visual-tools.d.mts +2 -2
  33. package/dist/visual-tools.mjs +26 -31
  34. package/dist/web-preferences.d.mts +29 -0
  35. package/dist/web-preferences.mjs +15 -0
  36. package/dist/web-roster-CjqnUXNk.mjs +285 -0
  37. package/generated/dsh-presets/cordis.patch.yml +5 -3
  38. package/generated/dsh-presets/ptc.patch.yml +7 -7
  39. package/generated/dsh-presets/standard.patch.yml +6 -4
  40. package/package.json +182 -168
  41. package/dist/client-bootstrap-DwSFzcTW.mjs +0 -872
  42. package/dist/custom-items-CKrOBCox.mjs +0 -655
  43. package/dist/dispose-cause-BzcXo4hu.mjs +0 -123
  44. package/dist/host-foundation-probe-CYHsbAw6.mjs +0 -143
  45. package/dist/host-prerequisites-9JBTtVNu.mjs +0 -36
  46. package/dist/runtime-Bh5OsftD.mjs +0 -6798
  47. package/dist/runtime-C5ROZqFj.mjs +0 -2
  48. package/dist/terminal-progress-source-CsBinCJ_.mjs +0 -965
@@ -1,123 +0,0 @@
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 };
@@ -1,143 +0,0 @@
1
- import { r as writeEntryRecord } from "./entry-control-DnduyDiw.mjs";
2
- import { t as mergeCause } from "./dispose-cause-CNFuUnjR.mjs";
3
- import { t as PI_TUI_CLIENT_CONTRIBUTION } from "./pi-tui-remote-contribution-DRk6Tl3J.mjs";
4
- import { createRequire } from "node:module";
5
- import { existsSync, realpathSync } from "node:fs";
6
- import { pathToFileURL } from "node:url";
7
- //#region src/app/remote-process/host-foundation-probe.ts
8
- /**
9
- * M4-B2-HF real Host RPC qualification probe.
10
- *
11
- * Runs ONLY on the existing B1 Client Context after the authenticated
12
- * transport is live. It temporarily mounts two Remote contributions — the
13
- * package's own private contribution and the official Session controller
14
- * `/remote` contribution — calls the official `session/list` RPC, the private
15
- * PiFile RPC and one private terminal-progress watch, then unmounts both in
16
- * reverse order. It creates no Context, no Connection and no Gateway.
17
- *
18
- * The probe is an internal qualification control (not an npm export, CLI
19
- * command or user-facing API). The caller owns the control channel; this module
20
- * owns only the contribution/watch lifetime and the structured proof.
21
- *
22
- * @module app/remote-process/host-foundation-probe
23
- */
24
- /** The no-live-Agent Session id every negative business probe names. */
25
- const PROBE_SESSION_ID = "m4-hf-no-live-agent";
26
- /**
27
- * Load the official Session controller Client contribution from the installed
28
- * DSH anchor. This is the same installed-package resolution strategy the B1
29
- * transport already uses; a source-tree module must never participate.
30
- */
31
- async function loadOfficialSessionRemote(dshAnchor) {
32
- const resolved = createRequire(realpathSync(dshAnchor)).resolve("@deepseek-ai/dsh-api-session-controller/remote");
33
- const contribution = (await import(pathToFileURL(resolved).href)).default;
34
- if (typeof contribution !== "object" || contribution === null || !Array.isArray(contribution.descriptors)) throw new Error("host foundation probe: the installed Session controller /remote export is not a Remote contribution");
35
- return contribution;
36
- }
37
- function remoteOf(context) {
38
- const remote = context.remote;
39
- if (remote === void 0) throw new Error("host foundation probe: the Client Context has no official Remote service");
40
- return remote;
41
- }
42
- /**
43
- * Wait at the qualification hold point so the split-process harness can read
44
- * the live Host subscriber count while the watch is still open. Production
45
- * never sets this environment variable.
46
- */
47
- async function waitForQualificationBarrier(path) {
48
- const deadline = Date.now() + 3e4;
49
- while (!existsSync(path)) {
50
- if (Date.now() > deadline) throw new Error(`host foundation probe: the qualification barrier was not released: ${path}`);
51
- await new Promise((resolve) => setTimeout(resolve, 20));
52
- }
53
- }
54
- /** Validate the opening terminal-progress snapshot required by T24. */
55
- function assertOpeningSnapshot(frame) {
56
- if (frame === void 0 || frame.kind !== "snapshot") throw new Error("host foundation probe: the terminal-progress watch did not open with a snapshot");
57
- if (frame.sessionId !== PROBE_SESSION_ID) throw new Error("host foundation probe: the terminal-progress snapshot names another Session");
58
- if (frame.running !== false || frame.outcome !== "idle") throw new Error("host foundation probe: the terminal-progress baseline is not idle");
59
- if (typeof frame.hostEpoch !== "string" || frame.hostEpoch === "") throw new Error("host foundation probe: the terminal-progress snapshot has no Host epoch");
60
- if (!Number.isSafeInteger(frame.agentEpoch) || !Number.isSafeInteger(frame.revision)) throw new Error("host foundation probe: the terminal-progress snapshot has invalid epoch/revision");
61
- }
62
- /**
63
- * Execute the real Host RPC proof on the caller's live Client Context.
64
- *
65
- * Contribution mounts are recorded immediately after each `$mount` resolves;
66
- * cleanup runs in reverse order in `finally`, so a failed second mount still
67
- * unmounts the first. Cleanup failures attach to the original RPC error as its
68
- * cause chain instead of masking it. The result is returned only after the
69
- * contribution unmounts and the watch cancellation both succeeded.
70
- */
71
- async function runHostFoundationProbe(context, options) {
72
- const remote = remoteOf(context);
73
- const sessionRemote = await loadOfficialSessionRemote(options.dshAnchor);
74
- const disposers = [];
75
- const cleanupErrors = [];
76
- let watch;
77
- let watchIterator;
78
- let result;
79
- let primaryError;
80
- try {
81
- disposers.push(await remote.$mount(PI_TUI_CLIENT_CONTRIBUTION));
82
- disposers.push(await remote.$mount(sessionRemote));
83
- const list = await remote.session.list({});
84
- if (list.ok !== true || !Array.isArray(list.value?.items)) throw new Error(`host foundation probe: official session/list did not return ok with an items array: ${JSON.stringify(list)}`);
85
- const fileResult = await remote.piTuiFileReferences.list(PROBE_SESSION_ID, "notes");
86
- if (fileResult.ok !== true || fileResult.value?.kind !== "unavailable") throw new Error(`host foundation probe: private PiFile RPC did not return ok/unavailable: ${JSON.stringify(fileResult)}`);
87
- watch = remote.piTuiTerminalProgress.watch(PROBE_SESSION_ID);
88
- watchIterator = watch[Symbol.asyncIterator]();
89
- const opening = await watchIterator.next();
90
- if (opening.done) throw new Error("host foundation probe: the terminal-progress watch ended before its snapshot");
91
- assertOpeningSnapshot(opening.value);
92
- if (options.requestId !== void 0) writeEntryRecord({
93
- m4b2hf: "host-rpc-watch-open",
94
- processRole: "client",
95
- pid: process.pid,
96
- requestId: options.requestId
97
- });
98
- const barrier = process.env.SPLIT_PROCESS_HOST_FOUNDATION_BARRIER;
99
- if (barrier !== void 0 && barrier !== "") await waitForQualificationBarrier(barrier);
100
- watch.dispose();
101
- if ((await watchIterator.next()).done !== true) throw new Error("host foundation probe: the terminal-progress watch did not end after dispose");
102
- watch = void 0;
103
- watchIterator = void 0;
104
- result = {
105
- officialSessionList: true,
106
- privateFileRpc: true,
107
- terminalSnapshot: true
108
- };
109
- } catch (error) {
110
- primaryError = error;
111
- } finally {
112
- if (watch !== void 0) try {
113
- watch.dispose();
114
- } catch (error) {
115
- cleanupErrors.push(error);
116
- }
117
- for (let index = disposers.length - 1; index >= 0; index -= 1) try {
118
- await disposers[index]();
119
- } catch (error) {
120
- cleanupErrors.push(error);
121
- }
122
- }
123
- if (primaryError !== void 0) {
124
- const primary = primaryError instanceof Error ? primaryError : new Error(String(primaryError));
125
- if (cleanupErrors.length > 0) {
126
- const secondary = cleanupErrors.length === 1 ? cleanupErrors[0] : new AggregateError(cleanupErrors, "host foundation probe: contribution cleanup failures");
127
- throw mergeCause(primary, secondary);
128
- }
129
- throw primary;
130
- }
131
- if (result === void 0) throw new Error("host foundation probe: no proof was produced");
132
- if (cleanupErrors.length > 0) throw mergeCause(/* @__PURE__ */ new Error("host foundation probe: contribution cleanup failed"), cleanupErrors.length === 1 ? cleanupErrors[0] : new AggregateError(cleanupErrors, "host foundation probe: contribution cleanup failures"));
133
- return {
134
- m4b2hf: "host-rpc-proof",
135
- hostPid: options.host.identity.hostPid,
136
- hostInstanceId: options.host.identity.instanceId,
137
- clientPid: process.pid,
138
- ...result,
139
- cleaned: true
140
- };
141
- }
142
- //#endregion
143
- export { runHostFoundationProbe };
@@ -1,36 +0,0 @@
1
- //#region src/app/remote/host-prerequisites.ts
2
- /**
3
- * Host services the ordinary Host Context must already expose before any
4
- * Remote Host row mounts. The check fails fast with the missing service named
5
- * instead of parking the runtime.
6
- */
7
- const REMOTE_HOST_PREREQUISITE_SERVICES = [
8
- "credentials",
9
- "userQuestions",
10
- "typert",
11
- "typertGateway",
12
- "agents",
13
- "agentDefaultModel",
14
- "attachments",
15
- "commands",
16
- "fileReferences",
17
- "fs",
18
- "workingDirectory",
19
- "llm",
20
- "sessions",
21
- "sessionProjections",
22
- "sessionQuery",
23
- "workspaceRegistry",
24
- "jobController",
25
- "workspaceFiles"
26
- ];
27
- /**
28
- * Fail fast when the ordinary Host lacks one of the required base services.
29
- * Reads via the reflect store so the diagnostic can name the missing key
30
- * without depending on any one service's shape.
31
- */
32
- function assertRemoteHostPrerequisites(hostContext) {
33
- for (const service of REMOTE_HOST_PREREQUISITE_SERVICES) if (hostContext.reflect.get(service) === void 0) throw new Error(`remote host runtime: the Host Context is missing the required "${service}" service`);
34
- }
35
- //#endregion
36
- export { assertRemoteHostPrerequisites as n, REMOTE_HOST_PREREQUISITE_SERVICES as t };