@xmoon76/dsh-pi-tui 0.5.4 → 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 (50) hide show
  1. package/README.en.md +46 -42
  2. package/README.md +46 -27
  3. package/cordis.patch.yml +77 -7
  4. package/dist/bootstrap-DQ4YPL-7.mjs +113583 -0
  5. package/dist/builtins.mjs +3 -9
  6. package/dist/{runtime-vc4mdr-R.mjs → client-bootstrap-Cr1JCaF5.mjs} +3670 -2277
  7. package/dist/disposal-BYBbEpVY.mjs +54 -0
  8. package/dist/dist-CIsR7cz4.mjs +15717 -0
  9. package/dist/{entry-control-DvSrndWd.mjs → entry-control-DnduyDiw.mjs} +12 -31
  10. package/dist/{extensions-CcuMY4n2.mjs → extensions-Bp0L37lP.mjs} +1239 -271
  11. package/dist/extensions.mjs +1 -1
  12. package/dist/host-bootstrap-DilsvA6f.mjs +281 -0
  13. package/dist/host-foundation-probe--5jtvHVe.mjs +413 -0
  14. package/dist/host-runtime.d.mts +30 -0
  15. package/dist/host-runtime.mjs +1317 -0
  16. package/dist/index.d.mts +19 -18
  17. package/dist/index.mjs +18410 -8836
  18. package/dist/local-client.mjs +2027 -187
  19. package/dist/local-discovery-C9VMjc0K.mjs +759 -0
  20. package/dist/local-discovery-CDaQHA_R.mjs +2 -0
  21. package/dist/local-host.mjs +1088 -87
  22. package/dist/local-transport-BVwFYq_Y.mjs +513 -0
  23. package/dist/{context-summary-DAisTA_7.mjs → pasted-path-range-CMnxuGPx.mjs} +7613 -216
  24. package/dist/pasted-path-range-r6qzV_tC.mjs +17510 -0
  25. package/dist/performance-host.d.mts +2 -2
  26. package/dist/performance-host.mjs +258 -1
  27. package/dist/pi-tui-remote-contribution-B0EQsP0N.mjs +85 -0
  28. package/dist/pi-tui-terminal-progress-contract-CdBH9j78.mjs +70 -0
  29. package/dist/pi-tui-terminal-progress-contract-MLXZ-i3t.mjs +905 -0
  30. package/dist/pi-tui-web-access-contract-BN8Cc_Ho.mjs +118 -0
  31. package/dist/{runtime-status-0lp9CM0V.mjs → runtime-status-Cj1nFOdS.mjs} +72 -214
  32. package/dist/session-BKGXyh80.mjs +15794 -0
  33. package/dist/{session-tdJHLnJR.mjs → session-CPt_U8_f.mjs} +10707 -3657
  34. package/dist/{startup-JaVZoTIl.mjs → startup-7BYWuvBU.mjs} +124 -8
  35. package/dist/startup.d.mts +1 -1
  36. package/dist/startup.mjs +1 -1
  37. package/dist/{client-bootstrap-F5DHFI9t.mjs → terminal-progress-source-DrqQhtT8.mjs} +3653 -2969
  38. package/dist/visual-tools.d.mts +2 -2
  39. package/dist/visual-tools.mjs +26 -31
  40. package/dist/web-preferences.d.mts +29 -0
  41. package/dist/web-preferences.mjs +15 -0
  42. package/dist/web-roster-CjqnUXNk.mjs +285 -0
  43. package/generated/dsh-presets/cordis.patch.yml +5 -3
  44. package/generated/dsh-presets/ptc.patch.yml +7 -7
  45. package/generated/dsh-presets/standard.patch.yml +6 -4
  46. package/package.json +195 -172
  47. package/dist/host-bootstrap-DAgKknbY.mjs +0 -119
  48. package/dist/performance-host-CcDJjjVA.mjs +0 -266
  49. package/dist/rolldown-runtime-8H4AJuhK.mjs +0 -14
  50. package/dist/terminal-progress-source-xor3vakJ.mjs +0 -2256
@@ -1,2 +1,2 @@
1
- import { a as PI_TUI_EXTENSIONS_SERVICE, i as name, o as API_VERSION, r as inject, s as describeKey, t as apply } from "./extensions-CcuMY4n2.mjs";
1
+ import { a as API_VERSION, i as PI_TUI_EXTENSIONS_SERVICE, n as inject, o as describeKey, r as name, t as apply } from "./extensions-Bp0L37lP.mjs";
2
2
  export { API_VERSION, PI_TUI_EXTENSIONS_SERVICE, apply, describeKey, inject, name };
@@ -0,0 +1,281 @@
1
+ import { t as PI_TUI_WEB_ACCESS_ROWS } from "./web-roster-CjqnUXNk.mjs";
2
+ import { r as PI_TUI_WEB_ACCESS_NAMESPACE } from "./pi-tui-web-access-contract-BN8Cc_Ho.mjs";
3
+ import { t as PI_TUI_TERMINAL_PROGRESS_NAMESPACE } from "./pi-tui-terminal-progress-contract-CdBH9j78.mjs";
4
+ import { n as PI_TUI_FILE_REFERENCES_NAMESPACE } from "./pi-tui-remote-contribution-B0EQsP0N.mjs";
5
+ import { symbols } from "@deepseek-ai/cordis";
6
+ import "@deepseek-ai/dsh-typert-protocol";
7
+ //#region src/app/remote/host-prerequisites.ts
8
+ /**
9
+ * Host services the ordinary Host Context must already expose before any
10
+ * Remote Host row mounts. The check fails fast with the missing service named
11
+ * instead of parking the runtime.
12
+ */
13
+ const REMOTE_HOST_PREREQUISITE_SERVICES = [
14
+ "credentials",
15
+ "userQuestions",
16
+ "typert",
17
+ "typertGateway",
18
+ "agents",
19
+ "agentDefaultModel",
20
+ "attachments",
21
+ "commands",
22
+ "fileReferences",
23
+ "fs",
24
+ "workingDirectory",
25
+ "llm",
26
+ "sessions",
27
+ "sessionProjections",
28
+ "sessionQuery",
29
+ "workspaceRegistry",
30
+ "jobController",
31
+ "workspaceFiles"
32
+ ];
33
+ /**
34
+ * Fail fast when the ordinary Host lacks one of the required base services.
35
+ * Reads via the reflect store so the diagnostic can name the missing key
36
+ * without depending on any one service's shape.
37
+ */
38
+ function assertRemoteHostPrerequisites(hostContext) {
39
+ 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`);
40
+ }
41
+ //#endregion
42
+ //#region src/app/host/features/web-access.ts
43
+ /** The Browser graph rows that must be assembled first and released last. */
44
+ const BROWSER_GRAPH_ROWS = [
45
+ "modules",
46
+ "client-hmr",
47
+ "cordis-client-runner",
48
+ "terminal-controller"
49
+ ];
50
+ const SPA_ROW = "web-runtime";
51
+ /** The Browser presentation rows, in the overlay's canonical order. */
52
+ const PRESENTATION_ROWS = PI_TUI_WEB_ACCESS_ROWS.map((row) => row.id).filter((id) => id !== SPA_ROW && !BROWSER_GRAPH_ROWS.includes(id));
53
+ [...BROWSER_GRAPH_ROWS, ...PRESENTATION_ROWS];
54
+ [...[...PRESENTATION_ROWS].reverse(), ...[...BROWSER_GRAPH_ROWS].reverse()];
55
+ new Map(PI_TUI_WEB_ACCESS_ROWS.map((row) => [row.id, row.name]));
56
+ new Set(PI_TUI_WEB_ACCESS_ROWS.map((row) => row.name));
57
+ //#endregion
58
+ //#region src/app/host/pi-tui-host-runtime.ts
59
+ /** Data-free readiness gate published after the whole built-in runtime is live. */
60
+ const PI_TUI_HOST_READY_SERVICE = "piTuiHostReady";
61
+ //#endregion
62
+ //#region src/app/remote-process/host-bootstrap.ts
63
+ /**
64
+ * Host-only readiness audit for the M4-B1 process entry.
65
+ *
66
+ * The entry boots the ordinary DSH profile through the real launcher
67
+ * (`@deepseek-ai/dsh/profile-boot`). This module runs after that boot and owns
68
+ * only the Host verdict: the shared Remote Host prerequisite set must be live,
69
+ * the B1-only Connection/API-remotes rows must be the sole active owners, the
70
+ * base Gateway must be active exactly once, the ONE official Workspace registry
71
+ * and Workspace Controller rows must be the sole owners of their packages (the
72
+ * controller with a real `workspace` Typert binding), the loopback webserver
73
+ * must be bound, and the TUI/Client-UI rows the Host-only overlay disables must
74
+ * not be active. It never composes a second Host graph.
75
+ *
76
+ * @module app/remote-process/host-bootstrap
77
+ */
78
+ /** Cordis `FiberState.ACTIVE` (the enum is a const enum with no runtime value). */
79
+ const FIBER_ACTIVE = 2;
80
+ /** Loader rows that must never be active in the Host-only process. */
81
+ const FORBIDDEN_HOST_ENTRY_IDS = [
82
+ "tui-app",
83
+ "pi-tui-extension-host",
84
+ "pi-tui-builtins"
85
+ ];
86
+ function loaderOf(context) {
87
+ const loader = context.loader;
88
+ if (loader === void 0) throw new Error("local host entry: the booted profile has no Loader service");
89
+ return loader;
90
+ }
91
+ /** A stable label for one fiber state, or `absent` for a disabled/never-started row. */
92
+ function fiberStateLabel(entry) {
93
+ const state = entry.fiber?.state;
94
+ if (state === void 0) return "absent";
95
+ if (state === FIBER_ACTIVE) return "active";
96
+ return `state-${String(state)}`;
97
+ }
98
+ /**
99
+ * Count the Host-side terminal-progress subscribers that are still live. This
100
+ * is qualification evidence only: a Client-local iterator ending does not
101
+ * prove the Host watch was cancelled, so the split-process smoke reads this
102
+ * count from the Host status after the probe.
103
+ */
104
+ function terminalProgressWatchCount(context) {
105
+ const service = context.reflect.get("piTuiTerminalProgress");
106
+ if (service === void 0) throw new Error("local host entry: the private terminal-progress service is not readable");
107
+ const records = (service[symbols.original] ?? service).records;
108
+ if (!(records instanceof Map)) throw new Error("local host entry: the private terminal-progress service has no watch registry");
109
+ let watches = 0;
110
+ for (const record of records.values()) watches += record.subscribers?.size ?? 0;
111
+ return watches;
112
+ }
113
+ /** The official Session-serving services whose Typert namespace must be real. */
114
+ const OFFICIAL_TYPERT_BINDINGS = [
115
+ {
116
+ serviceKey: "sessionController",
117
+ namespace: "session"
118
+ },
119
+ {
120
+ serviceKey: "fileUploads",
121
+ namespace: "fileUploads"
122
+ },
123
+ {
124
+ serviceKey: "settingsController",
125
+ namespace: "settings"
126
+ },
127
+ {
128
+ serviceKey: "workspaceController",
129
+ namespace: "workspace"
130
+ }
131
+ ];
132
+ /**
133
+ * The two official Workspace owners, identified by their PACKAGE as well as
134
+ * their row id. A same-namespace competitor registered under a different Loader
135
+ * id would keep the `exactly one <id> row` check green while owning the service
136
+ * or the `workspace` namespace a second time, so uniqueness is proven on the
137
+ * package identity the Host actually imported.
138
+ */
139
+ const WORKSPACE_OWNER_PACKAGES = [{
140
+ owner: "workspaceRegistry",
141
+ id: "workspace",
142
+ name: "@deepseek-ai/dsh-workspace"
143
+ }, {
144
+ owner: "workspaceController",
145
+ id: "workspace-controller",
146
+ name: "@deepseek-ai/dsh-api-workspace-controller"
147
+ }];
148
+ /** The package's three private endpoint bindings. */
149
+ const PRIVATE_TYPERT_BINDINGS = [
150
+ {
151
+ serviceKey: "piTuiFileReferences",
152
+ namespace: PI_TUI_FILE_REFERENCES_NAMESPACE
153
+ },
154
+ {
155
+ serviceKey: "piTuiTerminalProgress",
156
+ namespace: PI_TUI_TERMINAL_PROGRESS_NAMESPACE
157
+ },
158
+ {
159
+ serviceKey: "piTuiWebAccess",
160
+ namespace: PI_TUI_WEB_ACCESS_NAMESPACE
161
+ }
162
+ ];
163
+ /**
164
+ * Assert one Host service is readable AND carries the expected Typert binding.
165
+ * A truthy service alone is not proof: the Gateway dispatches on the binding.
166
+ */
167
+ function assertTypertBinding(context, serviceKey, namespace) {
168
+ const service = context.reflect.get(serviceKey);
169
+ if (service === void 0) throw new Error(`local host entry: the Host did not publish the "${serviceKey}" service`);
170
+ const binding = service.typertRemote;
171
+ if (binding === void 0 || binding.serviceKey !== serviceKey || binding.namespace !== namespace) throw new Error(`local host entry: the "${serviceKey}" Typert binding is not ${serviceKey}/${namespace}`);
172
+ }
173
+ /**
174
+ * Assert the disabled TUI rows stayed disabled AND did not activate despite the
175
+ * profile patch. The declaration check is what makes an overlay mutation
176
+ * (`disabled: false`) a deterministic Host startup failure even when the
177
+ * re-enabled TUI plugin fails to mount without a terminal.
178
+ */
179
+ function assertHostOnlyComposition(context) {
180
+ const forbidden = [...loaderOf(context).entries()].filter((entry) => FORBIDDEN_HOST_ENTRY_IDS.includes(entry.options.id));
181
+ const activeForbidden = forbidden.filter((entry) => entry.fiber?.state === FIBER_ACTIVE).map((entry) => entry.options.id);
182
+ if (activeForbidden.length > 0) throw new Error(`local host entry: forbidden TUI/Client-UI rows are active: ${activeForbidden.join(", ")}`);
183
+ const enabledForbidden = forbidden.filter((entry) => entry.options.disabled !== true).map((entry) => entry.options.id);
184
+ if (enabledForbidden.length > 0) throw new Error(`local host entry: forbidden TUI/Client-UI rows are not disabled: ${enabledForbidden.join(", ")}`);
185
+ }
186
+ /** Wait for every Loader entry to settle after the profile boot returned. */
187
+ async function settleHostEntries(context) {
188
+ await loaderOf(context).await();
189
+ }
190
+ /**
191
+ * Prove the production Host prerequisite set is live and collect the readiness
192
+ * facts. Must run after {@link settleHostEntries}; a missing prerequisite is a
193
+ * hard failure, never a degraded ready.
194
+ */
195
+ function collectHostEntryStatus(context, identity) {
196
+ assertRemoteHostPrerequisites(context);
197
+ assertHostOnlyComposition(context);
198
+ const entries = [...loaderOf(context).entries()];
199
+ const services = {};
200
+ for (const service of REMOTE_HOST_PREREQUISITE_SERVICES) services[service] = context.reflect.get(service) !== void 0;
201
+ for (const service of [
202
+ "sessionController",
203
+ "fileUploads",
204
+ "settingsController",
205
+ "workspaceController",
206
+ PI_TUI_FILE_REFERENCES_NAMESPACE,
207
+ PI_TUI_TERMINAL_PROGRESS_NAMESPACE,
208
+ PI_TUI_WEB_ACCESS_NAMESPACE,
209
+ PI_TUI_HOST_READY_SERVICE,
210
+ "piTuiPerformanceReady"
211
+ ]) services[service] = context.reflect.get(service) !== void 0;
212
+ /** Only ACTIVE rows own a service; a disabled/absent row proves nothing. */
213
+ const activeIds = (id) => entries.filter((entry) => entry.options.id === id && entry.fiber?.state === FIBER_ACTIVE).map((entry) => entry.options.id);
214
+ const ownerEntries = {
215
+ agents: activeIds("agent"),
216
+ sessions: activeIds("session"),
217
+ jobController: activeIds("job-controller"),
218
+ connection: activeIds("split-host-connection"),
219
+ apiRemotes: activeIds("split-host-api-remotes"),
220
+ typertGateway: activeIds("typert-gateway"),
221
+ fileUpload: activeIds("split-host-file-upload"),
222
+ sessionStats: activeIds("split-host-session-stats"),
223
+ turnOutline: activeIds("split-host-turn-outline"),
224
+ sessionController: activeIds("split-host-session-controller"),
225
+ settingsController: activeIds("split-host-settings-controller"),
226
+ sessionLogExport: activeIds("split-host-session-log-download"),
227
+ piTuiHostRuntime: activeIds("split-host-pi-tui-runtime"),
228
+ performance: activeIds("pi-tui-performance-host"),
229
+ visualTools: activeIds("pi-tui-visual-tools"),
230
+ workspaceRegistry: activeIds("workspace"),
231
+ workspaceController: activeIds("workspace-controller")
232
+ };
233
+ for (const [owner, ids] of Object.entries(ownerEntries)) if (ids.length !== 1) {
234
+ const visible = entries.map((entry) => `${entry.options.id}:${fiberStateLabel(entry)}`);
235
+ throw new Error(`local host entry: expected exactly one active ${owner} owner row, found ${String(ids.length)}; entries=${visible.join(",")}`);
236
+ }
237
+ for (const { owner, id, name } of WORKSPACE_OWNER_PACKAGES) {
238
+ const active = entries.filter((entry) => entry.fiber?.state === FIBER_ACTIVE && entry.options.name === name);
239
+ if (active.length !== 1 || active[0].options.id !== id) {
240
+ const visible = active.length === 0 ? "none" : active.map((entry) => entry.options.id).join(",");
241
+ throw new Error(`local host entry: expected exactly one active ${owner} row for "${name}" named "${id}", found ${visible}`);
242
+ }
243
+ }
244
+ for (const { serviceKey, namespace } of [...OFFICIAL_TYPERT_BINDINGS, ...PRIVATE_TYPERT_BINDINGS]) assertTypertBinding(context, serviceKey, namespace);
245
+ if (context.reflect.get("piTuiHostReady") === void 0) throw new Error(`local host entry: the built-in PiTui Host Runtime did not publish "${PI_TUI_HOST_READY_SERVICE}"`);
246
+ if (context.reflect.get("piTuiPerformanceReady") === void 0) throw new Error("local host entry: the existing pi-tui-performance-host row did not publish piTuiPerformanceReady");
247
+ if (context.reflect.get("connection") === void 0) throw new Error("local host entry: the Host did not publish the official Connection service");
248
+ const webServer = context.reflect.get("webServer");
249
+ if (webServer?.host !== "127.0.0.1" || webServer.port === void 0 || webServer.port < 1) throw new Error("local host entry: the Host webserver must bind 127.0.0.1 on an OS-assigned port");
250
+ if (webServer.protocol === "https:") throw new Error("local host entry: B1 requires the plain loopback HTTP webserver");
251
+ const origin = webServer.getOrigin();
252
+ if (!origin.startsWith("http://127.0.0.1:") || !/^\d+$/u.test(origin.slice(17))) throw new Error(`local host entry: the Host webserver origin is not loopback HTTP (${origin})`);
253
+ const rootFiber = context.fiber;
254
+ return {
255
+ processRole: "host",
256
+ pid: process.pid,
257
+ ...identity.processStartIdentity === void 0 ? {} : { processStartIdentity: identity.processStartIdentity },
258
+ phase: "ready",
259
+ fiberOwner: "dsh-profile-root",
260
+ ...rootFiber?.uid == null ? {} : { rootFiberUid: rootFiber.uid },
261
+ transport: "listening",
262
+ sessionOpen: false,
263
+ profile: identity.profile,
264
+ services,
265
+ terminalProgressWatches: terminalProgressWatchCount(context),
266
+ ownerEntries,
267
+ entries: entries.map((entry) => ({
268
+ id: entry.options.id,
269
+ name: entry.options.name,
270
+ state: fiberStateLabel(entry),
271
+ ...typeof entry.fiber?.uid === "number" ? { fiberUid: entry.fiber.uid } : {}
272
+ })),
273
+ forbiddenActive: [],
274
+ webServer: {
275
+ host: webServer.host,
276
+ port: webServer.port
277
+ }
278
+ };
279
+ }
280
+ //#endregion
281
+ export { collectHostEntryStatus, settleHostEntries };