@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.
- package/README.en.md +195 -150
- package/README.md +137 -103
- package/cordis.patch.yml +54 -2
- package/dist/application-runtime-CbBO4bY-.mjs +6860 -0
- package/dist/bootstrap-DLOydLLj.mjs +108410 -0
- package/dist/builtins.mjs +2 -3
- package/dist/client-bootstrap-DwSFzcTW.mjs +872 -0
- package/dist/context-summary-Bz0AGXa1.mjs +12027 -0
- package/dist/context-summary-D9mhxPXL.mjs +10015 -0
- package/dist/custom-items-CKrOBCox.mjs +655 -0
- package/dist/disposal-BYBbEpVY.mjs +54 -0
- package/dist/dispose-cause-BzcXo4hu.mjs +123 -0
- package/dist/dispose-cause-CNFuUnjR.mjs +24 -0
- package/dist/dist-C7QMk0ws.mjs +15431 -0
- package/dist/entry-control-DnduyDiw.mjs +92 -0
- package/dist/extension/advanced.d.mts +1 -1
- package/dist/extension/unstable.d.mts +1 -1
- package/dist/{extensions-DzpBiiYb.d.mts → extensions-Bte3XOt5.d.mts} +1 -1
- package/dist/{extensions-a-rxanjw.mjs → extensions-pcFiH7Qe.mjs} +1498 -410
- package/dist/extensions.d.mts +2 -2
- package/dist/extensions.mjs +1 -1
- package/dist/host-bootstrap-CKdfLkNS.mjs +188 -0
- package/dist/host-foundation-probe-CYHsbAw6.mjs +143 -0
- package/dist/host-prerequisites-9JBTtVNu.mjs +36 -0
- package/dist/host-runtime.d.mts +26 -0
- package/dist/host-runtime.mjs +450 -0
- package/dist/index.d.mts +9 -2
- package/dist/index.mjs +45779 -24480
- package/dist/local-client.mjs +1816 -0
- package/dist/local-discovery-CXnLT4GF.mjs +755 -0
- package/dist/local-discovery-DVFFpfBG.mjs +2 -0
- package/dist/local-host.mjs +1025 -0
- package/dist/local-transport-C9aonplC.mjs +513 -0
- package/dist/performance-host.d.mts +2 -2
- package/dist/performance-host.mjs +258 -1
- package/dist/{performance-view-jvvd8Jn7.mjs → performance-view-CfGvLZyD.mjs} +1 -1
- package/dist/pi-tui-remote-contribution-DRk6Tl3J.mjs +78 -0
- package/dist/pi-tui-terminal-progress-contract-CdBH9j78.mjs +70 -0
- package/dist/pi-tui-terminal-progress-contract-XTQKj-WW.mjs +905 -0
- package/dist/{public-types-gZi3iFNh.d.mts → public-types-Dgf1bDke.d.mts} +3 -3
- package/dist/{runtime-BtPH-UUb.mjs → runtime-Bh5OsftD.mjs} +1311 -1024
- package/dist/runtime-C5ROZqFj.mjs +2 -0
- package/dist/runtime-status-0lp9CM0V.mjs +1923 -0
- package/dist/session-4keoXjk0.mjs +10869 -0
- package/dist/session-B2zqv4wr.mjs +10869 -0
- package/dist/{startup-D5Xu8diR.mjs → startup-Ct2UUjUL.mjs} +55 -13
- package/dist/startup.d.mts +2 -1
- package/dist/startup.mjs +1 -1
- package/dist/terminal-progress-source-BhufrZ74.mjs +6000 -0
- package/dist/terminal-progress-source-CsBinCJ_.mjs +965 -0
- package/dist/visual-tools.d.mts +62 -0
- package/dist/visual-tools.mjs +556 -0
- package/generated/dsh-presets/README.md +1 -1
- package/package.json +145 -117
- package/dist/context-summary-CxUpNkA9.mjs +0 -2951
- package/dist/performance-host-BJT6scGF.mjs +0 -266
- package/dist/rolldown-runtime-8H4AJuhK.mjs +0 -14
- package/dist/session-BZLxhrPQ.mjs +0 -5697
- package/dist/terminal-progress-source-BlmksrSD.mjs +0 -2200
package/dist/extensions.d.mts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { $ as TuiKeybindingContribution, A as PiTuiSlotSemantic, B as TextView, C as InputWidget, D as PiTuiApiInfo, E as NormalizedKey, F as SpacerView, G as TuiAutocompleteQuery, H as TuiAction, I as StackView, J as TuiColorPalette, K as TuiAutocompleteRegistryView, L as StyledSpan, M as RegistrationSpec, N as RowsView, O as PiTuiCapability, P as SessionSnapshot, Q as TuiCommandHandle, R as SurfaceSnapshot, S as HeaderBadge, T as MessagePresentationSnapshot, U as TuiAutocompleteItem, V as ToolPresentationSnapshot, W as TuiAutocompleteProvider, X as TuiCommandBridgeView, Y as TuiCommandBridgeSnapshot, Z as TuiCommandContribution, _t as TuiThemeRegistrySnapshot, a as ContributionHealth, at as TuiOverlayHandle, b as FooterSegment, bt as describeKey, c as DockItem, ct as TuiRendererRegistrySnapshot, d as EditorHost, dt as TuiSettingHandle, et as TuiKeybindingHandle, f as EditorHostAction, ft as TuiSettingsRegistrySnapshot, g as ExtensionEditor, gt as TuiThemeHandle, h as EditorSnapshot, ht as TuiThemeContribution, i as AutocompleteProviderContribution, it as TuiMessageRendererContribution, j as RegistrationHandle, k as PiTuiSlotName, l as EditorContribution, m as EditorInputEvent, mt as TuiSizeValue, n as ActivitySnapshot, nt as TuiKeybindingRegistryView, o as ContributionRecord, ot as TuiOverlayOptions, p as EditorHostActionResult, pt as TuiSettingsRegistryView, q as TuiAutocompleteSuggestions, r as AutocompleteHandle, rt as TuiLocalCommandHandler, s as ContributionState, st as TuiRendererHandle, t as API_VERSION, tt as TuiKeybindingRegistrySnapshot, u as EditorHandle, ut as TuiSettingContribution, v as ExtensionView, vt as TuiThemeRegistryView, w as MarkdownView, x as FrameView, y as FooterItemContribution, yt as TuiToolRendererContribution, z as SurfaceStateValues } from "./public-types-
|
|
2
|
-
import { a as PiTuiExtensionService, i as PI_TUI_EXTENSIONS_SERVICE, n as inject, r as name, t as apply } from "./extensions-
|
|
1
|
+
import { $ as TuiKeybindingContribution, A as PiTuiSlotSemantic, B as TextView, C as InputWidget, D as PiTuiApiInfo, E as NormalizedKey, F as SpacerView, G as TuiAutocompleteQuery, H as TuiAction, I as StackView, J as TuiColorPalette, K as TuiAutocompleteRegistryView, L as StyledSpan, M as RegistrationSpec, N as RowsView, O as PiTuiCapability, P as SessionSnapshot, Q as TuiCommandHandle, R as SurfaceSnapshot, S as HeaderBadge, T as MessagePresentationSnapshot, U as TuiAutocompleteItem, V as ToolPresentationSnapshot, W as TuiAutocompleteProvider, X as TuiCommandBridgeView, Y as TuiCommandBridgeSnapshot, Z as TuiCommandContribution, _t as TuiThemeRegistrySnapshot, a as ContributionHealth, at as TuiOverlayHandle, b as FooterSegment, bt as describeKey, c as DockItem, ct as TuiRendererRegistrySnapshot, d as EditorHost, dt as TuiSettingHandle, et as TuiKeybindingHandle, f as EditorHostAction, ft as TuiSettingsRegistrySnapshot, g as ExtensionEditor, gt as TuiThemeHandle, h as EditorSnapshot, ht as TuiThemeContribution, i as AutocompleteProviderContribution, it as TuiMessageRendererContribution, j as RegistrationHandle, k as PiTuiSlotName, l as EditorContribution, m as EditorInputEvent, mt as TuiSizeValue, n as ActivitySnapshot, nt as TuiKeybindingRegistryView, o as ContributionRecord, ot as TuiOverlayOptions, p as EditorHostActionResult, pt as TuiSettingsRegistryView, q as TuiAutocompleteSuggestions, r as AutocompleteHandle, rt as TuiLocalCommandHandler, s as ContributionState, st as TuiRendererHandle, t as API_VERSION, tt as TuiKeybindingRegistrySnapshot, u as EditorHandle, ut as TuiSettingContribution, v as ExtensionView, vt as TuiThemeRegistryView, w as MarkdownView, x as FrameView, y as FooterItemContribution, yt as TuiToolRendererContribution, z as SurfaceStateValues } from "./public-types-Dgf1bDke.mjs";
|
|
2
|
+
import { a as PiTuiExtensionService, i as PI_TUI_EXTENSIONS_SERVICE, n as inject, r as name, t as apply } from "./extensions-Bte3XOt5.mjs";
|
|
3
3
|
export { API_VERSION, type ActivitySnapshot, type AutocompleteHandle, type AutocompleteProviderContribution, type ContributionHealth, type ContributionRecord, type ContributionState, type DockItem, type EditorContribution, type EditorHandle, type EditorHost, type EditorHostAction, type EditorHostActionResult, type EditorInputEvent, type EditorSnapshot, type ExtensionEditor, type ExtensionView, type FooterItemContribution, type FooterSegment, type FrameView, type HeaderBadge, type InputWidget, type MarkdownView, type MessagePresentationSnapshot, type NormalizedKey, PI_TUI_EXTENSIONS_SERVICE, type PiTuiApiInfo, type PiTuiCapability, type PiTuiExtensionService, type PiTuiSlotName, type PiTuiSlotSemantic, type RegistrationHandle, type RegistrationSpec, type RowsView, type SessionSnapshot, type SpacerView, type StackView, type StyledSpan, type SurfaceSnapshot, type SurfaceStateValues, type TextView, type ToolPresentationSnapshot, type TuiAction, type TuiAutocompleteItem, type TuiAutocompleteProvider, type TuiAutocompleteQuery, type TuiAutocompleteRegistryView, type TuiAutocompleteSuggestions, type TuiColorPalette, type TuiCommandBridgeSnapshot, type TuiCommandBridgeView, type TuiCommandContribution, type TuiCommandHandle, type TuiKeybindingContribution, type TuiKeybindingHandle, type TuiKeybindingRegistrySnapshot, type TuiKeybindingRegistryView, type TuiLocalCommandHandler, type TuiMessageRendererContribution, type TuiOverlayHandle, type TuiOverlayOptions, type TuiRendererHandle, type TuiRendererRegistrySnapshot, type TuiSettingContribution, type TuiSettingHandle, type TuiSettingsRegistrySnapshot, type TuiSettingsRegistryView, type TuiSizeValue, type TuiThemeContribution, type TuiThemeHandle, type TuiThemeRegistrySnapshot, type TuiThemeRegistryView, type TuiToolRendererContribution, apply, describeKey, inject, name };
|
package/dist/extensions.mjs
CHANGED
|
@@ -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-
|
|
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-pcFiH7Qe.mjs";
|
|
2
2
|
export { API_VERSION, PI_TUI_EXTENSIONS_SERVICE, apply, describeKey, inject, name };
|
|
@@ -0,0 +1,188 @@
|
|
|
1
|
+
import { t as PI_TUI_TERMINAL_PROGRESS_NAMESPACE } from "./pi-tui-terminal-progress-contract-CdBH9j78.mjs";
|
|
2
|
+
import { n as PI_TUI_FILE_REFERENCES_NAMESPACE } from "./pi-tui-remote-contribution-DRk6Tl3J.mjs";
|
|
3
|
+
import { n as assertRemoteHostPrerequisites, t as REMOTE_HOST_PREREQUISITE_SERVICES } from "./host-prerequisites-9JBTtVNu.mjs";
|
|
4
|
+
import { symbols } from "@deepseek-ai/cordis";
|
|
5
|
+
import "@deepseek-ai/dsh-typert-protocol";
|
|
6
|
+
//#region src/app/host/pi-tui-host-runtime.ts
|
|
7
|
+
/** Data-free readiness gate published after the whole built-in runtime is live. */
|
|
8
|
+
const PI_TUI_HOST_READY_SERVICE = "piTuiHostReady";
|
|
9
|
+
//#endregion
|
|
10
|
+
//#region src/app/remote-process/host-bootstrap.ts
|
|
11
|
+
/**
|
|
12
|
+
* Host-only readiness audit for the M4-B1 process entry.
|
|
13
|
+
*
|
|
14
|
+
* The entry boots the ordinary DSH profile through the real launcher
|
|
15
|
+
* (`@deepseek-ai/dsh/profile-boot`). This module runs after that boot and owns
|
|
16
|
+
* only the Host verdict: the shared Remote Host prerequisite set must be live,
|
|
17
|
+
* the B1-only Connection/API-remotes rows must be the sole active owners, the
|
|
18
|
+
* base Gateway must be active exactly once, the loopback webserver must be
|
|
19
|
+
* bound, and the TUI/Client-UI rows the Host-only overlay disables must not be
|
|
20
|
+
* active. It never composes a second Host graph.
|
|
21
|
+
*
|
|
22
|
+
* @module app/remote-process/host-bootstrap
|
|
23
|
+
*/
|
|
24
|
+
/** Cordis `FiberState.ACTIVE` (the enum is a const enum with no runtime value). */
|
|
25
|
+
const FIBER_ACTIVE = 2;
|
|
26
|
+
/** Loader rows that must never be active in the Host-only process. */
|
|
27
|
+
const FORBIDDEN_HOST_ENTRY_IDS = [
|
|
28
|
+
"tui-app",
|
|
29
|
+
"pi-tui-extension-host",
|
|
30
|
+
"pi-tui-builtins"
|
|
31
|
+
];
|
|
32
|
+
function loaderOf(context) {
|
|
33
|
+
const loader = context.loader;
|
|
34
|
+
if (loader === void 0) throw new Error("local host entry: the booted profile has no Loader service");
|
|
35
|
+
return loader;
|
|
36
|
+
}
|
|
37
|
+
/** A stable label for one fiber state, or `absent` for a disabled/never-started row. */
|
|
38
|
+
function fiberStateLabel(entry) {
|
|
39
|
+
const state = entry.fiber?.state;
|
|
40
|
+
if (state === void 0) return "absent";
|
|
41
|
+
if (state === FIBER_ACTIVE) return "active";
|
|
42
|
+
return `state-${String(state)}`;
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* Count the Host-side terminal-progress subscribers that are still live. This
|
|
46
|
+
* is qualification evidence only: a Client-local iterator ending does not
|
|
47
|
+
* prove the Host watch was cancelled, so the split-process smoke reads this
|
|
48
|
+
* count from the Host status after the probe.
|
|
49
|
+
*/
|
|
50
|
+
function terminalProgressWatchCount(context) {
|
|
51
|
+
const service = context.reflect.get("piTuiTerminalProgress");
|
|
52
|
+
if (service === void 0) throw new Error("local host entry: the private terminal-progress service is not readable");
|
|
53
|
+
const records = (service[symbols.original] ?? service).records;
|
|
54
|
+
if (!(records instanceof Map)) throw new Error("local host entry: the private terminal-progress service has no watch registry");
|
|
55
|
+
let watches = 0;
|
|
56
|
+
for (const record of records.values()) watches += record.subscribers?.size ?? 0;
|
|
57
|
+
return watches;
|
|
58
|
+
}
|
|
59
|
+
/** The official Session-serving services whose Typert namespace must be real. */
|
|
60
|
+
const OFFICIAL_TYPERT_BINDINGS = [
|
|
61
|
+
{
|
|
62
|
+
serviceKey: "sessionController",
|
|
63
|
+
namespace: "session"
|
|
64
|
+
},
|
|
65
|
+
{
|
|
66
|
+
serviceKey: "fileUploads",
|
|
67
|
+
namespace: "fileUploads"
|
|
68
|
+
},
|
|
69
|
+
{
|
|
70
|
+
serviceKey: "settingsController",
|
|
71
|
+
namespace: "settings"
|
|
72
|
+
}
|
|
73
|
+
];
|
|
74
|
+
/** The package's two private endpoint bindings. */
|
|
75
|
+
const PRIVATE_TYPERT_BINDINGS = [{
|
|
76
|
+
serviceKey: "piTuiFileReferences",
|
|
77
|
+
namespace: PI_TUI_FILE_REFERENCES_NAMESPACE
|
|
78
|
+
}, {
|
|
79
|
+
serviceKey: "piTuiTerminalProgress",
|
|
80
|
+
namespace: PI_TUI_TERMINAL_PROGRESS_NAMESPACE
|
|
81
|
+
}];
|
|
82
|
+
/**
|
|
83
|
+
* Assert one Host service is readable AND carries the expected Typert binding.
|
|
84
|
+
* A truthy service alone is not proof: the Gateway dispatches on the binding.
|
|
85
|
+
*/
|
|
86
|
+
function assertTypertBinding(context, serviceKey, namespace) {
|
|
87
|
+
const service = context.reflect.get(serviceKey);
|
|
88
|
+
if (service === void 0) throw new Error(`local host entry: the Host did not publish the "${serviceKey}" service`);
|
|
89
|
+
const binding = service.typertRemote;
|
|
90
|
+
if (binding === void 0 || binding.serviceKey !== serviceKey || binding.namespace !== namespace) throw new Error(`local host entry: the "${serviceKey}" Typert binding is not ${serviceKey}/${namespace}`);
|
|
91
|
+
}
|
|
92
|
+
/**
|
|
93
|
+
* Assert the disabled TUI rows stayed disabled AND did not activate despite the
|
|
94
|
+
* profile patch. The declaration check is what makes an overlay mutation
|
|
95
|
+
* (`disabled: false`) a deterministic Host startup failure even when the
|
|
96
|
+
* re-enabled TUI plugin fails to mount without a terminal.
|
|
97
|
+
*/
|
|
98
|
+
function assertHostOnlyComposition(context) {
|
|
99
|
+
const forbidden = [...loaderOf(context).entries()].filter((entry) => FORBIDDEN_HOST_ENTRY_IDS.includes(entry.options.id));
|
|
100
|
+
const activeForbidden = forbidden.filter((entry) => entry.fiber?.state === FIBER_ACTIVE).map((entry) => entry.options.id);
|
|
101
|
+
if (activeForbidden.length > 0) throw new Error(`local host entry: forbidden TUI/Client-UI rows are active: ${activeForbidden.join(", ")}`);
|
|
102
|
+
const enabledForbidden = forbidden.filter((entry) => entry.options.disabled !== true).map((entry) => entry.options.id);
|
|
103
|
+
if (enabledForbidden.length > 0) throw new Error(`local host entry: forbidden TUI/Client-UI rows are not disabled: ${enabledForbidden.join(", ")}`);
|
|
104
|
+
}
|
|
105
|
+
/** Wait for every Loader entry to settle after the profile boot returned. */
|
|
106
|
+
async function settleHostEntries(context) {
|
|
107
|
+
await loaderOf(context).await();
|
|
108
|
+
}
|
|
109
|
+
/**
|
|
110
|
+
* Prove the production Host prerequisite set is live and collect the readiness
|
|
111
|
+
* facts. Must run after {@link settleHostEntries}; a missing prerequisite is a
|
|
112
|
+
* hard failure, never a degraded ready.
|
|
113
|
+
*/
|
|
114
|
+
function collectHostEntryStatus(context, identity) {
|
|
115
|
+
assertRemoteHostPrerequisites(context);
|
|
116
|
+
assertHostOnlyComposition(context);
|
|
117
|
+
const entries = [...loaderOf(context).entries()];
|
|
118
|
+
const services = {};
|
|
119
|
+
for (const service of REMOTE_HOST_PREREQUISITE_SERVICES) services[service] = context.reflect.get(service) !== void 0;
|
|
120
|
+
for (const service of [
|
|
121
|
+
"sessionController",
|
|
122
|
+
"fileUploads",
|
|
123
|
+
"settingsController",
|
|
124
|
+
PI_TUI_FILE_REFERENCES_NAMESPACE,
|
|
125
|
+
PI_TUI_TERMINAL_PROGRESS_NAMESPACE,
|
|
126
|
+
PI_TUI_HOST_READY_SERVICE,
|
|
127
|
+
"piTuiPerformanceReady"
|
|
128
|
+
]) services[service] = context.reflect.get(service) !== void 0;
|
|
129
|
+
/** Only ACTIVE rows own a service; a disabled/absent row proves nothing. */
|
|
130
|
+
const activeIds = (id) => entries.filter((entry) => entry.options.id === id && entry.fiber?.state === FIBER_ACTIVE).map((entry) => entry.options.id);
|
|
131
|
+
const ownerEntries = {
|
|
132
|
+
agents: activeIds("agent"),
|
|
133
|
+
sessions: activeIds("session"),
|
|
134
|
+
jobController: activeIds("job-controller"),
|
|
135
|
+
connection: activeIds("split-host-connection"),
|
|
136
|
+
apiRemotes: activeIds("split-host-api-remotes"),
|
|
137
|
+
typertGateway: activeIds("typert-gateway"),
|
|
138
|
+
fileUpload: activeIds("split-host-file-upload"),
|
|
139
|
+
sessionStats: activeIds("split-host-session-stats"),
|
|
140
|
+
turnOutline: activeIds("split-host-turn-outline"),
|
|
141
|
+
sessionController: activeIds("split-host-session-controller"),
|
|
142
|
+
settingsController: activeIds("split-host-settings-controller"),
|
|
143
|
+
sessionLogExport: activeIds("split-host-session-log-download"),
|
|
144
|
+
piTuiHostRuntime: activeIds("split-host-pi-tui-runtime"),
|
|
145
|
+
performance: activeIds("pi-tui-performance-host"),
|
|
146
|
+
visualTools: activeIds("pi-tui-visual-tools")
|
|
147
|
+
};
|
|
148
|
+
for (const [owner, ids] of Object.entries(ownerEntries)) if (ids.length !== 1) {
|
|
149
|
+
const visible = entries.map((entry) => `${entry.options.id}:${fiberStateLabel(entry)}`);
|
|
150
|
+
throw new Error(`local host entry: expected exactly one active ${owner} owner row, found ${String(ids.length)}; entries=${visible.join(",")}`);
|
|
151
|
+
}
|
|
152
|
+
for (const { serviceKey, namespace } of [...OFFICIAL_TYPERT_BINDINGS, ...PRIVATE_TYPERT_BINDINGS]) assertTypertBinding(context, serviceKey, namespace);
|
|
153
|
+
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}"`);
|
|
154
|
+
if (context.reflect.get("piTuiPerformanceReady") === void 0) throw new Error("local host entry: the existing pi-tui-performance-host row did not publish piTuiPerformanceReady");
|
|
155
|
+
if (context.reflect.get("connection") === void 0) throw new Error("local host entry: the Host did not publish the official Connection service");
|
|
156
|
+
const webServer = context.reflect.get("webServer");
|
|
157
|
+
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");
|
|
158
|
+
if (webServer.protocol === "https:") throw new Error("local host entry: B1 requires the plain loopback HTTP webserver");
|
|
159
|
+
const origin = webServer.getOrigin();
|
|
160
|
+
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})`);
|
|
161
|
+
const rootFiber = context.fiber;
|
|
162
|
+
return {
|
|
163
|
+
processRole: "host",
|
|
164
|
+
pid: process.pid,
|
|
165
|
+
...identity.processStartIdentity === void 0 ? {} : { processStartIdentity: identity.processStartIdentity },
|
|
166
|
+
phase: "ready",
|
|
167
|
+
fiberOwner: "dsh-profile-root",
|
|
168
|
+
...rootFiber?.uid == null ? {} : { rootFiberUid: rootFiber.uid },
|
|
169
|
+
transport: "listening",
|
|
170
|
+
sessionOpen: false,
|
|
171
|
+
profile: identity.profile,
|
|
172
|
+
services,
|
|
173
|
+
terminalProgressWatches: terminalProgressWatchCount(context),
|
|
174
|
+
ownerEntries,
|
|
175
|
+
entries: entries.map((entry) => ({
|
|
176
|
+
id: entry.options.id,
|
|
177
|
+
name: entry.options.name,
|
|
178
|
+
state: fiberStateLabel(entry)
|
|
179
|
+
})),
|
|
180
|
+
forbiddenActive: [],
|
|
181
|
+
webServer: {
|
|
182
|
+
host: webServer.host,
|
|
183
|
+
port: webServer.port
|
|
184
|
+
}
|
|
185
|
+
};
|
|
186
|
+
}
|
|
187
|
+
//#endregion
|
|
188
|
+
export { collectHostEntryStatus, settleHostEntries };
|
|
@@ -0,0 +1,143 @@
|
|
|
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 };
|
|
@@ -0,0 +1,36 @@
|
|
|
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 };
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { Context } from "@deepseek-ai/cordis";
|
|
2
|
+
|
|
3
|
+
//#region src/app/host/pi-tui-host-runtime.d.ts
|
|
4
|
+
/** Stable Cordis plugin name (the Loader row id in the Host-only overlay). */
|
|
5
|
+
declare const name = "pi-tui-host-runtime";
|
|
6
|
+
/**
|
|
7
|
+
* Explicit Host dependencies: the private Typert registry plus the two live
|
|
8
|
+
* Host facts the business rows resolve per call. `tuiStartup` remains a Loader
|
|
9
|
+
* row gate (see the Host-only overlay), not a plugin inject.
|
|
10
|
+
*/
|
|
11
|
+
declare const inject: string[];
|
|
12
|
+
/** Data-free readiness gate published after the whole built-in runtime is live. */
|
|
13
|
+
declare const PI_TUI_HOST_READY_SERVICE = "piTuiHostReady";
|
|
14
|
+
/**
|
|
15
|
+
* Mount the built-in PiTui Host Runtime on the launching Host Context.
|
|
16
|
+
*
|
|
17
|
+
* Startup order is fixed: register the package's ONE contribution, mount the
|
|
18
|
+
* file-reference service, mount the terminal-progress service, verify both
|
|
19
|
+
* live bindings, then publish the readiness gate. Every child fiber is recorded
|
|
20
|
+
* BEFORE it is awaited; a partial rejection disposes the recorded children in
|
|
21
|
+
* reverse order (contribution last) while keeping the original error primary
|
|
22
|
+
* and attaching cleanup failures to its cause chain.
|
|
23
|
+
*/
|
|
24
|
+
declare function apply(ctx: Context): Promise<void>;
|
|
25
|
+
//#endregion
|
|
26
|
+
export { PI_TUI_HOST_READY_SERVICE, apply, inject, name };
|