@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.
- package/README.en.md +30 -47
- package/README.md +30 -30
- package/cordis.patch.yml +77 -7
- package/dist/{bootstrap-DLOydLLj.mjs → bootstrap-DQ4YPL-7.mjs} +12416 -7243
- package/dist/builtins.mjs +3 -8
- package/dist/{application-runtime-CbBO4bY-.mjs → client-bootstrap-Cr1JCaF5.mjs} +3098 -1747
- package/dist/{dist-C7QMk0ws.mjs → dist-CIsR7cz4.mjs} +510 -224
- package/dist/{extensions-pcFiH7Qe.mjs → extensions-Bp0L37lP.mjs} +527 -249
- package/dist/extensions.mjs +1 -1
- package/dist/{host-bootstrap-CKdfLkNS.mjs → host-bootstrap-DilsvA6f.mjs} +106 -13
- package/dist/host-foundation-probe--5jtvHVe.mjs +413 -0
- package/dist/host-runtime.d.mts +10 -6
- package/dist/host-runtime.mjs +877 -10
- package/dist/index.d.mts +11 -17
- package/dist/index.mjs +13328 -6828
- package/dist/local-client.mjs +408 -61
- package/dist/{local-discovery-CXnLT4GF.mjs → local-discovery-C9VMjc0K.mjs} +10 -6
- package/dist/{local-discovery-DVFFpfBG.mjs → local-discovery-CDaQHA_R.mjs} +1 -1
- package/dist/local-host.mjs +188 -36
- package/dist/{local-transport-C9aonplC.mjs → local-transport-BVwFYq_Y.mjs} +1 -1
- package/dist/{context-summary-D9mhxPXL.mjs → pasted-path-range-CMnxuGPx.mjs} +6166 -227
- package/dist/{context-summary-Bz0AGXa1.mjs → pasted-path-range-r6qzV_tC.mjs} +5927 -444
- package/dist/{pi-tui-remote-contribution-DRk6Tl3J.mjs → pi-tui-remote-contribution-B0EQsP0N.mjs} +27 -20
- package/dist/{pi-tui-terminal-progress-contract-XTQKj-WW.mjs → pi-tui-terminal-progress-contract-MLXZ-i3t.mjs} +2 -2
- package/dist/pi-tui-web-access-contract-BN8Cc_Ho.mjs +118 -0
- package/dist/{runtime-status-0lp9CM0V.mjs → runtime-status-Cj1nFOdS.mjs} +72 -214
- package/dist/{session-4keoXjk0.mjs → session-BKGXyh80.mjs} +7487 -2562
- package/dist/{session-B2zqv4wr.mjs → session-CPt_U8_f.mjs} +7486 -2560
- package/dist/{startup-Ct2UUjUL.mjs → startup-7BYWuvBU.mjs} +121 -6
- package/dist/startup.mjs +1 -1
- package/dist/{terminal-progress-source-BhufrZ74.mjs → terminal-progress-source-DrqQhtT8.mjs} +305 -45
- package/dist/visual-tools.d.mts +2 -2
- package/dist/visual-tools.mjs +26 -31
- package/dist/web-preferences.d.mts +29 -0
- package/dist/web-preferences.mjs +15 -0
- package/dist/web-roster-CjqnUXNk.mjs +285 -0
- package/generated/dsh-presets/cordis.patch.yml +5 -3
- package/generated/dsh-presets/ptc.patch.yml +7 -7
- package/generated/dsh-presets/standard.patch.yml +6 -4
- package/package.json +182 -168
- package/dist/client-bootstrap-DwSFzcTW.mjs +0 -872
- package/dist/custom-items-CKrOBCox.mjs +0 -655
- package/dist/dispose-cause-BzcXo4hu.mjs +0 -123
- package/dist/host-foundation-probe-CYHsbAw6.mjs +0 -143
- package/dist/host-prerequisites-9JBTtVNu.mjs +0 -36
- package/dist/runtime-Bh5OsftD.mjs +0 -6798
- package/dist/runtime-C5ROZqFj.mjs +0 -2
- package/dist/terminal-progress-source-CsBinCJ_.mjs +0 -965
package/dist/extensions.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { a as
|
|
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 };
|
|
@@ -1,8 +1,60 @@
|
|
|
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";
|
|
1
3
|
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-
|
|
3
|
-
import { n as assertRemoteHostPrerequisites, t as REMOTE_HOST_PREREQUISITE_SERVICES } from "./host-prerequisites-9JBTtVNu.mjs";
|
|
4
|
+
import { n as PI_TUI_FILE_REFERENCES_NAMESPACE } from "./pi-tui-remote-contribution-B0EQsP0N.mjs";
|
|
4
5
|
import { symbols } from "@deepseek-ai/cordis";
|
|
5
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
|
|
6
58
|
//#region src/app/host/pi-tui-host-runtime.ts
|
|
7
59
|
/** Data-free readiness gate published after the whole built-in runtime is live. */
|
|
8
60
|
const PI_TUI_HOST_READY_SERVICE = "piTuiHostReady";
|
|
@@ -15,9 +67,11 @@ const PI_TUI_HOST_READY_SERVICE = "piTuiHostReady";
|
|
|
15
67
|
* (`@deepseek-ai/dsh/profile-boot`). This module runs after that boot and owns
|
|
16
68
|
* only the Host verdict: the shared Remote Host prerequisite set must be live,
|
|
17
69
|
* the B1-only Connection/API-remotes rows must be the sole active owners, the
|
|
18
|
-
* base Gateway must be active exactly once, the
|
|
19
|
-
*
|
|
20
|
-
*
|
|
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.
|
|
21
75
|
*
|
|
22
76
|
* @module app/remote-process/host-bootstrap
|
|
23
77
|
*/
|
|
@@ -69,16 +123,43 @@ const OFFICIAL_TYPERT_BINDINGS = [
|
|
|
69
123
|
{
|
|
70
124
|
serviceKey: "settingsController",
|
|
71
125
|
namespace: "settings"
|
|
126
|
+
},
|
|
127
|
+
{
|
|
128
|
+
serviceKey: "workspaceController",
|
|
129
|
+
namespace: "workspace"
|
|
72
130
|
}
|
|
73
131
|
];
|
|
74
|
-
/**
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
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"
|
|
78
143
|
}, {
|
|
79
|
-
|
|
80
|
-
|
|
144
|
+
owner: "workspaceController",
|
|
145
|
+
id: "workspace-controller",
|
|
146
|
+
name: "@deepseek-ai/dsh-api-workspace-controller"
|
|
81
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
|
+
];
|
|
82
163
|
/**
|
|
83
164
|
* Assert one Host service is readable AND carries the expected Typert binding.
|
|
84
165
|
* A truthy service alone is not proof: the Gateway dispatches on the binding.
|
|
@@ -121,8 +202,10 @@ function collectHostEntryStatus(context, identity) {
|
|
|
121
202
|
"sessionController",
|
|
122
203
|
"fileUploads",
|
|
123
204
|
"settingsController",
|
|
205
|
+
"workspaceController",
|
|
124
206
|
PI_TUI_FILE_REFERENCES_NAMESPACE,
|
|
125
207
|
PI_TUI_TERMINAL_PROGRESS_NAMESPACE,
|
|
208
|
+
PI_TUI_WEB_ACCESS_NAMESPACE,
|
|
126
209
|
PI_TUI_HOST_READY_SERVICE,
|
|
127
210
|
"piTuiPerformanceReady"
|
|
128
211
|
]) services[service] = context.reflect.get(service) !== void 0;
|
|
@@ -143,12 +226,21 @@ function collectHostEntryStatus(context, identity) {
|
|
|
143
226
|
sessionLogExport: activeIds("split-host-session-log-download"),
|
|
144
227
|
piTuiHostRuntime: activeIds("split-host-pi-tui-runtime"),
|
|
145
228
|
performance: activeIds("pi-tui-performance-host"),
|
|
146
|
-
visualTools: activeIds("pi-tui-visual-tools")
|
|
229
|
+
visualTools: activeIds("pi-tui-visual-tools"),
|
|
230
|
+
workspaceRegistry: activeIds("workspace"),
|
|
231
|
+
workspaceController: activeIds("workspace-controller")
|
|
147
232
|
};
|
|
148
233
|
for (const [owner, ids] of Object.entries(ownerEntries)) if (ids.length !== 1) {
|
|
149
234
|
const visible = entries.map((entry) => `${entry.options.id}:${fiberStateLabel(entry)}`);
|
|
150
235
|
throw new Error(`local host entry: expected exactly one active ${owner} owner row, found ${String(ids.length)}; entries=${visible.join(",")}`);
|
|
151
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
|
+
}
|
|
152
244
|
for (const { serviceKey, namespace } of [...OFFICIAL_TYPERT_BINDINGS, ...PRIVATE_TYPERT_BINDINGS]) assertTypertBinding(context, serviceKey, namespace);
|
|
153
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}"`);
|
|
154
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");
|
|
@@ -175,7 +267,8 @@ function collectHostEntryStatus(context, identity) {
|
|
|
175
267
|
entries: entries.map((entry) => ({
|
|
176
268
|
id: entry.options.id,
|
|
177
269
|
name: entry.options.name,
|
|
178
|
-
state: fiberStateLabel(entry)
|
|
270
|
+
state: fiberStateLabel(entry),
|
|
271
|
+
...typeof entry.fiber?.uid === "number" ? { fiberUid: entry.fiber.uid } : {}
|
|
179
272
|
})),
|
|
180
273
|
forbiddenActive: [],
|
|
181
274
|
webServer: {
|
|
@@ -0,0 +1,413 @@
|
|
|
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-B0EQsP0N.mjs";
|
|
4
|
+
import { createRequire } from "node:module";
|
|
5
|
+
import { existsSync, realpathSync } from "node:fs";
|
|
6
|
+
import { isAbsolute } from "node:path";
|
|
7
|
+
import { pathToFileURL } from "node:url";
|
|
8
|
+
//#region src/app/remote-process/host-foundation-probe.ts
|
|
9
|
+
/**
|
|
10
|
+
* M4-B2-HF real Host RPC qualification probe.
|
|
11
|
+
*
|
|
12
|
+
* Runs ONLY on the existing B1 Client Context after the authenticated
|
|
13
|
+
* transport is live. It temporarily mounts the package's own private
|
|
14
|
+
* contribution and the official Session controller `/remote` contribution —
|
|
15
|
+
* plus the official Workspace controller `/remote` contribution when the caller
|
|
16
|
+
* requests the Workspace proof — calls the official `session/list` RPC, the
|
|
17
|
+
* private PiFile RPC, one private terminal-progress watch and (on request) the
|
|
18
|
+
* official `workspace` namespace (`follow` baseline then `create` identity),
|
|
19
|
+
* then unmounts them in reverse order. It creates no Context, no Connection and
|
|
20
|
+
* no Gateway.
|
|
21
|
+
*
|
|
22
|
+
* The probe is an internal qualification control (not an npm export, CLI
|
|
23
|
+
* command or user-facing API). The caller owns the control channel; this module
|
|
24
|
+
* owns only the contribution/stream lifetime and the structured proof.
|
|
25
|
+
*
|
|
26
|
+
* @module app/remote-process/host-foundation-probe
|
|
27
|
+
*/
|
|
28
|
+
/** The no-live-Agent Session id every negative business probe names. */
|
|
29
|
+
const PROBE_SESSION_ID = "m4-hf-no-live-agent";
|
|
30
|
+
/** Bounded wait for one Workspace stream frame; a timeout is a FAIL, never a PASS. */
|
|
31
|
+
const WORKSPACE_FRAME_TIMEOUT_MS = 2e4;
|
|
32
|
+
/** Bound on frames skipped while looking for one Workspace `upsert`. */
|
|
33
|
+
const WORKSPACE_FRAME_LIMIT = 64;
|
|
34
|
+
/**
|
|
35
|
+
* Load one official generated `/remote` contribution from the installed DSH
|
|
36
|
+
* anchor. This is the same installed-package resolution strategy the B1
|
|
37
|
+
* transport already uses; a source-tree module must never participate.
|
|
38
|
+
*/
|
|
39
|
+
async function loadInstalledRemote(dshAnchor, specifier) {
|
|
40
|
+
const resolved = createRequire(realpathSync(dshAnchor)).resolve(specifier);
|
|
41
|
+
const contribution = (await import(pathToFileURL(resolved).href)).default;
|
|
42
|
+
if (typeof contribution !== "object" || contribution === null || !Array.isArray(contribution.descriptors)) throw new Error(`host foundation probe: the installed ${specifier} export is not a Remote contribution`);
|
|
43
|
+
return contribution;
|
|
44
|
+
}
|
|
45
|
+
function remoteOf(context) {
|
|
46
|
+
const remote = context.remote;
|
|
47
|
+
if (remote === void 0) throw new Error("host foundation probe: the Client Context has no official Remote service");
|
|
48
|
+
return remote;
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* Wait at the qualification hold point so the split-process harness can read
|
|
52
|
+
* the live Host subscriber count while the watch is still open. Production
|
|
53
|
+
* never sets this environment variable.
|
|
54
|
+
*/
|
|
55
|
+
async function waitForQualificationBarrier(path) {
|
|
56
|
+
const deadline = Date.now() + 3e4;
|
|
57
|
+
while (!existsSync(path)) {
|
|
58
|
+
if (Date.now() > deadline) throw new Error(`host foundation probe: the qualification barrier was not released: ${path}`);
|
|
59
|
+
await new Promise((resolve) => setTimeout(resolve, 20));
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
/** Validate the opening terminal-progress snapshot required by T24. */
|
|
63
|
+
function assertOpeningSnapshot(frame) {
|
|
64
|
+
if (frame === void 0 || frame.kind !== "snapshot") throw new Error("host foundation probe: the terminal-progress watch did not open with a snapshot");
|
|
65
|
+
if (frame.sessionId !== PROBE_SESSION_ID) throw new Error("host foundation probe: the terminal-progress snapshot names another Session");
|
|
66
|
+
if (frame.running !== false || frame.outcome !== "idle") throw new Error("host foundation probe: the terminal-progress baseline is not idle");
|
|
67
|
+
if (typeof frame.hostEpoch !== "string" || frame.hostEpoch === "") throw new Error("host foundation probe: the terminal-progress snapshot has no Host epoch");
|
|
68
|
+
if (!Number.isSafeInteger(frame.agentEpoch) || !Number.isSafeInteger(frame.revision)) throw new Error("host foundation probe: the terminal-progress snapshot has invalid epoch/revision");
|
|
69
|
+
}
|
|
70
|
+
/**
|
|
71
|
+
* Await the next frame of one Workspace stream under the qualification bound.
|
|
72
|
+
* A stream that ends or stalls is a FAIL, never an empty success.
|
|
73
|
+
*/
|
|
74
|
+
async function nextWorkspaceFrame(iterator, label) {
|
|
75
|
+
let timer;
|
|
76
|
+
const timeout = new Promise((_resolve, reject) => {
|
|
77
|
+
timer = setTimeout(() => {
|
|
78
|
+
reject(/* @__PURE__ */ new Error(`host foundation probe: timed out waiting for ${label}`));
|
|
79
|
+
}, WORKSPACE_FRAME_TIMEOUT_MS);
|
|
80
|
+
});
|
|
81
|
+
try {
|
|
82
|
+
const next = await Promise.race([iterator.next(), timeout]);
|
|
83
|
+
if (next.done === true) throw new Error(`host foundation probe: the Workspace stream ended before ${label}`);
|
|
84
|
+
return next.value;
|
|
85
|
+
} finally {
|
|
86
|
+
clearTimeout(timer);
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
/** Bounded wait for one pull of a HELD stream, so a hang is classified separately. */
|
|
90
|
+
var HeldStreamWaitTimeout = class extends Error {};
|
|
91
|
+
/**
|
|
92
|
+
* Pull one HELD Workspace iterator once and classify the outcome. A frame means
|
|
93
|
+
* the obsolete generation still wrote into the Client (stale delivery); an ended
|
|
94
|
+
* iterator or a carrier failure means the generation is gone and wrote nothing.
|
|
95
|
+
*/
|
|
96
|
+
async function pullHeldStream(iterator) {
|
|
97
|
+
let timer;
|
|
98
|
+
const timeout = new Promise((_resolve, reject) => {
|
|
99
|
+
timer = setTimeout(() => {
|
|
100
|
+
reject(new HeldStreamWaitTimeout("held-stream-wait-timeout"));
|
|
101
|
+
}, WORKSPACE_FRAME_TIMEOUT_MS);
|
|
102
|
+
});
|
|
103
|
+
try {
|
|
104
|
+
const next = await Promise.race([iterator.next(), timeout]);
|
|
105
|
+
return next.done === true ? { kind: "ended" } : {
|
|
106
|
+
kind: "frame",
|
|
107
|
+
frame: next.value
|
|
108
|
+
};
|
|
109
|
+
} catch (error) {
|
|
110
|
+
if (error instanceof HeldStreamWaitTimeout) throw new Error("host foundation probe: the held Workspace stream neither ended nor reported a carrier failure within its bound");
|
|
111
|
+
return {
|
|
112
|
+
kind: "failed",
|
|
113
|
+
error
|
|
114
|
+
};
|
|
115
|
+
} finally {
|
|
116
|
+
clearTimeout(timer);
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
/** Read one Workspace projection out of an unknown Remote value, or fail loudly. */
|
|
120
|
+
function readWorkspaceFacts(value, label) {
|
|
121
|
+
const candidate = value;
|
|
122
|
+
if (candidate === void 0 || typeof candidate.workspaceId !== "string" || candidate.workspaceId === "" || typeof candidate.path !== "string" || !isAbsolute(candidate.path) || !Array.isArray(candidate.sessionIds) || !candidate.sessionIds.every((sessionId) => typeof sessionId === "string")) throw new Error(`host foundation probe: ${label} did not return a Workspace projection: ${JSON.stringify(value)}`);
|
|
123
|
+
return {
|
|
124
|
+
workspaceId: candidate.workspaceId,
|
|
125
|
+
path: candidate.path,
|
|
126
|
+
sessionIds: candidate.sessionIds
|
|
127
|
+
};
|
|
128
|
+
}
|
|
129
|
+
async function proveWorkspace(remote, workspacePath, resume) {
|
|
130
|
+
const expectedPath = realpathSync(workspacePath);
|
|
131
|
+
const stream = remote.workspace.follow();
|
|
132
|
+
const iterator = stream[Symbol.asyncIterator]();
|
|
133
|
+
let streamClosed = false;
|
|
134
|
+
try {
|
|
135
|
+
const opening = await nextWorkspaceFrame(iterator, "the Workspace baseline");
|
|
136
|
+
if (opening.type !== "baseline" || !Array.isArray(opening.value?.items)) throw new Error(`host foundation probe: workspace/follow did not open with a baseline: ${JSON.stringify(opening)}`);
|
|
137
|
+
const baselineIds = /* @__PURE__ */ new Set();
|
|
138
|
+
for (const item of opening.value.items) baselineIds.add(readWorkspaceFacts(item, "the Workspace baseline").workspaceId);
|
|
139
|
+
const first = await remote.workspace.create({ path: workspacePath });
|
|
140
|
+
if (first.ok !== true || first.value === void 0) throw new Error(`host foundation probe: workspace/create did not return ok: ${JSON.stringify(first)}`);
|
|
141
|
+
if (typeof first.value.created !== "boolean") throw new Error(`host foundation probe: workspace/create did not report "created": ${JSON.stringify(first.value)}`);
|
|
142
|
+
const createdWorkspace = readWorkspaceFacts(first.value.workspace, "workspace/create");
|
|
143
|
+
if (createdWorkspace.path !== expectedPath) throw new Error(`host foundation probe: workspace/create returned "${createdWorkspace.path}" instead of the Host canonical "${expectedPath}"`);
|
|
144
|
+
const inBaseline = baselineIds.has(createdWorkspace.workspaceId);
|
|
145
|
+
let upserted;
|
|
146
|
+
if (first.value.created) {
|
|
147
|
+
if (inBaseline) throw new Error(`host foundation probe: workspace/create reported a new Workspace while the baseline already carried "${createdWorkspace.workspaceId}"`);
|
|
148
|
+
for (let frames = 0; frames < WORKSPACE_FRAME_LIMIT; frames += 1) {
|
|
149
|
+
const frame = await nextWorkspaceFrame(iterator, `the "${createdWorkspace.workspaceId}" Workspace upsert`);
|
|
150
|
+
if (frame.type !== "upsert") continue;
|
|
151
|
+
const candidate = readWorkspaceFacts(frame.workspace, "a Workspace upsert frame");
|
|
152
|
+
if (candidate.workspaceId === createdWorkspace.workspaceId) {
|
|
153
|
+
upserted = candidate;
|
|
154
|
+
break;
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
if (upserted === void 0) throw new Error(`host foundation probe: workspace/follow never reported an upsert for "${createdWorkspace.workspaceId}"`);
|
|
158
|
+
if (upserted.path !== createdWorkspace.path || JSON.stringify(upserted.sessionIds) !== JSON.stringify(createdWorkspace.sessionIds)) throw new Error(`host foundation probe: the Workspace upsert disagrees with workspace/create: ${JSON.stringify(upserted)} vs ${JSON.stringify(createdWorkspace)}`);
|
|
159
|
+
} else if (!inBaseline) throw new Error(`host foundation probe: workspace/create resolved "${createdWorkspace.workspaceId}" but the baseline did not carry it`);
|
|
160
|
+
const second = await remote.workspace.create({ path: workspacePath });
|
|
161
|
+
if (second.ok !== true || second.value === void 0 || second.value.created !== false) throw new Error(`host foundation probe: a repeated workspace/create was not an idempotent resolve: ${JSON.stringify(second)}`);
|
|
162
|
+
const resolvedWorkspace = readWorkspaceFacts(second.value.workspace, "the repeated workspace/create");
|
|
163
|
+
if (resolvedWorkspace.workspaceId !== createdWorkspace.workspaceId) throw new Error(`host foundation probe: a repeated workspace/create returned "${resolvedWorkspace.workspaceId}" instead of "${createdWorkspace.workspaceId}"`);
|
|
164
|
+
let generationAdvanced = false;
|
|
165
|
+
let heldStreamClosed = false;
|
|
166
|
+
let restoredBaseline = false;
|
|
167
|
+
if (resume !== void 0) {
|
|
168
|
+
if (resume.requestId !== void 0) writeEntryRecord({
|
|
169
|
+
m4b2hf: "workspace-hold-open",
|
|
170
|
+
processRole: "client",
|
|
171
|
+
pid: process.pid,
|
|
172
|
+
requestId: resume.requestId
|
|
173
|
+
});
|
|
174
|
+
resume.dropCarrier();
|
|
175
|
+
const deadline = Date.now() + WORKSPACE_FRAME_TIMEOUT_MS;
|
|
176
|
+
let generationAfter = resume.readGeneration();
|
|
177
|
+
while (generationAfter === void 0 || resume.generationBefore === void 0 || generationAfter <= resume.generationBefore) {
|
|
178
|
+
if (Date.now() > deadline) throw new Error(`host foundation probe: the held Workspace stream did not observe a replacement Connection generation (${String(resume.generationBefore)} -> ${String(generationAfter)})`);
|
|
179
|
+
await new Promise((resolve) => setTimeout(resolve, 25));
|
|
180
|
+
generationAfter = resume.readGeneration();
|
|
181
|
+
}
|
|
182
|
+
generationAdvanced = true;
|
|
183
|
+
const held = await pullHeldStream(iterator);
|
|
184
|
+
if (held.kind === "frame") throw new Error(`host foundation probe: the held Workspace stream delivered a "${held.frame.type}" frame after its Connection generation was replaced`);
|
|
185
|
+
heldStreamClosed = true;
|
|
186
|
+
const restarted = remote.workspace.follow();
|
|
187
|
+
const restartedIterator = restarted[Symbol.asyncIterator]();
|
|
188
|
+
try {
|
|
189
|
+
const baseline = await nextWorkspaceFrame(restartedIterator, "the post-replacement Workspace baseline");
|
|
190
|
+
if (baseline.type !== "baseline" || !Array.isArray(baseline.value?.items)) throw new Error(`host foundation probe: the post-replacement stream did not open with a Host baseline: ${JSON.stringify(baseline)}`);
|
|
191
|
+
const restoredIds = baseline.value.items.map((item) => readWorkspaceFacts(item, "the post-replacement Workspace baseline").workspaceId);
|
|
192
|
+
if (!restoredIds.includes(createdWorkspace.workspaceId)) throw new Error(`host foundation probe: the post-replacement baseline dropped the Workspace the Host had already published (${JSON.stringify(restoredIds)})`);
|
|
193
|
+
restoredBaseline = true;
|
|
194
|
+
} finally {
|
|
195
|
+
restarted.dispose();
|
|
196
|
+
}
|
|
197
|
+
}
|
|
198
|
+
stream.dispose();
|
|
199
|
+
streamClosed = true;
|
|
200
|
+
if ((await iterator.next()).done !== true) throw new Error("host foundation probe: the Workspace stream did not end after dispose");
|
|
201
|
+
return {
|
|
202
|
+
baseline: true,
|
|
203
|
+
inBaseline,
|
|
204
|
+
created: first.value.created,
|
|
205
|
+
idempotent: true,
|
|
206
|
+
upsert: upserted !== void 0,
|
|
207
|
+
workspaceId: createdWorkspace.workspaceId,
|
|
208
|
+
path: createdWorkspace.path,
|
|
209
|
+
generationAdvanced,
|
|
210
|
+
heldStreamClosed,
|
|
211
|
+
restoredBaseline
|
|
212
|
+
};
|
|
213
|
+
} finally {
|
|
214
|
+
if (!streamClosed) try {
|
|
215
|
+
stream.dispose();
|
|
216
|
+
} catch {}
|
|
217
|
+
}
|
|
218
|
+
}
|
|
219
|
+
/** Wait until the Client's own Connection generation advances past `before`. */
|
|
220
|
+
async function waitForCarrierReplacement(readGeneration, before) {
|
|
221
|
+
const deadline = Date.now() + WORKSPACE_FRAME_TIMEOUT_MS;
|
|
222
|
+
let after = readGeneration();
|
|
223
|
+
while (after === void 0 || before === void 0 || after <= before) {
|
|
224
|
+
if (Date.now() > deadline) throw new Error(`host foundation probe: the Schedule catalog did not observe a replacement Connection generation (${String(before)} -> ${String(after)})`);
|
|
225
|
+
await new Promise((resolve) => setTimeout(resolve, 25));
|
|
226
|
+
after = readGeneration();
|
|
227
|
+
}
|
|
228
|
+
}
|
|
229
|
+
/**
|
|
230
|
+
* Prove the official `schedule` namespace over the authenticated link on the
|
|
231
|
+
* SAME live Client Context: a real `catalog`, a Host-created task returned with
|
|
232
|
+
* its identity, one CAS `edit`, and — when the resume control is supplied — a
|
|
233
|
+
* fresh `catalog` on a replacement Connection generation that STILL lists the
|
|
234
|
+
* created task. A failure in any stage throws; the probe never swallows a
|
|
235
|
+
* business/transport error into a false PASS.
|
|
236
|
+
*/
|
|
237
|
+
async function proveSchedule(remote, resume) {
|
|
238
|
+
const opening = await remote.schedule.catalog();
|
|
239
|
+
if (opening.ok !== true || !Array.isArray(opening.value)) throw new Error(`host foundation probe: schedule/catalog did not return ok with an entry array: ${JSON.stringify(opening)}`);
|
|
240
|
+
const baselineIds = new Set(opening.value.map((entry) => entry.id));
|
|
241
|
+
const title = `probe-schedule-${Date.now()}-${process.pid}`;
|
|
242
|
+
const created = await remote.schedule.create({
|
|
243
|
+
title,
|
|
244
|
+
prompt: "host foundation probe schedule task",
|
|
245
|
+
timing: {
|
|
246
|
+
kind: "after",
|
|
247
|
+
after_seconds: 3600
|
|
248
|
+
}
|
|
249
|
+
});
|
|
250
|
+
if (created.ok !== true || created.value === void 0) throw new Error(`host foundation probe: schedule/create did not return ok: ${JSON.stringify(created)}`);
|
|
251
|
+
const entry = created.value;
|
|
252
|
+
if (typeof entry.id !== "string" || entry.id === "" || entry.title !== title) throw new Error(`host foundation probe: schedule/create did not return the created task identity: ${JSON.stringify(entry)}`);
|
|
253
|
+
if (baselineIds.has(entry.id)) throw new Error(`host foundation probe: schedule/create returned an identity the opening catalog already held: ${entry.id}`);
|
|
254
|
+
const editedTitle = `${title}-edited`;
|
|
255
|
+
const edited = await remote.schedule.edit({
|
|
256
|
+
id: entry.id,
|
|
257
|
+
action: "update",
|
|
258
|
+
patch: { title: editedTitle }
|
|
259
|
+
});
|
|
260
|
+
if (edited.ok !== true || edited.value === void 0) throw new Error(`host foundation probe: schedule/edit did not return ok: ${JSON.stringify(edited)}`);
|
|
261
|
+
const editedEntry = edited.value;
|
|
262
|
+
if (editedEntry.id !== entry.id || editedEntry.title !== editedTitle) throw new Error(`host foundation probe: schedule/edit did not return the updated task: ${JSON.stringify(editedEntry)}`);
|
|
263
|
+
let reconnectCatalog;
|
|
264
|
+
if (resume !== void 0) {
|
|
265
|
+
const generationBefore = resume.readGeneration();
|
|
266
|
+
resume.dropCarrier();
|
|
267
|
+
await waitForCarrierReplacement(resume.readGeneration, generationBefore);
|
|
268
|
+
const after = await remote.schedule.catalog();
|
|
269
|
+
if (after.ok !== true || !Array.isArray(after.value)) throw new Error(`host foundation probe: the post-replacement schedule/catalog did not return ok: ${JSON.stringify(after)}`);
|
|
270
|
+
reconnectCatalog = after.value.some((candidate) => candidate.id === entry.id);
|
|
271
|
+
if (!reconnectCatalog) throw new Error(`host foundation probe: the post-replacement schedule/catalog dropped the task the Host had already created (${entry.id})`);
|
|
272
|
+
}
|
|
273
|
+
const deleted = await remote.schedule.edit({
|
|
274
|
+
id: entry.id,
|
|
275
|
+
action: "delete"
|
|
276
|
+
});
|
|
277
|
+
if (deleted.ok !== true) throw new Error(`host foundation probe: schedule/edit(delete) did not return ok: ${JSON.stringify(deleted)}`);
|
|
278
|
+
const afterDelete = await remote.schedule.catalog();
|
|
279
|
+
if (afterDelete.ok !== true || !Array.isArray(afterDelete.value)) throw new Error(`host foundation probe: the post-delete schedule/catalog did not return ok: ${JSON.stringify(afterDelete)}`);
|
|
280
|
+
if (afterDelete.value.some((candidate) => candidate.id === entry.id)) throw new Error(`host foundation probe: the deleted schedule task is still listed: ${entry.id}`);
|
|
281
|
+
return {
|
|
282
|
+
catalog: true,
|
|
283
|
+
create: true,
|
|
284
|
+
edit: true,
|
|
285
|
+
deleted: true,
|
|
286
|
+
...resume === void 0 ? {} : { reconnectCatalog }
|
|
287
|
+
};
|
|
288
|
+
}
|
|
289
|
+
/**
|
|
290
|
+
* Execute the real Host RPC proof on the caller's live Client Context.
|
|
291
|
+
*
|
|
292
|
+
* Contribution mounts are recorded immediately after each `$mount` resolves;
|
|
293
|
+
* cleanup runs in reverse order in `finally`, so a failed second mount still
|
|
294
|
+
* unmounts the first. Cleanup failures attach to the original RPC error as its
|
|
295
|
+
* cause chain instead of masking it. The result is returned only after the
|
|
296
|
+
* contribution unmounts and the stream cancellations both succeeded.
|
|
297
|
+
*/
|
|
298
|
+
async function runHostFoundationProbe(context, options) {
|
|
299
|
+
if (options.dropCarrier === void 0 !== (options.readGeneration === void 0)) throw new Error("host foundation probe: the generation-resume control requires BOTH dropCarrier and readGeneration");
|
|
300
|
+
if (options.dropCarrier !== void 0 && options.workspacePath === void 0) throw new Error("host foundation probe: the generation-resume control requires the Workspace proof");
|
|
301
|
+
const remote = remoteOf(context);
|
|
302
|
+
const sessionRemote = await loadInstalledRemote(options.dshAnchor, "@deepseek-ai/dsh-api-session-controller/remote");
|
|
303
|
+
const workspaceRequest = options.workspacePath;
|
|
304
|
+
const workspaceRemote = workspaceRequest === void 0 ? void 0 : await loadInstalledRemote(options.dshAnchor, "@deepseek-ai/dsh-api-workspace-controller/remote");
|
|
305
|
+
const scheduleRemote = options.schedule === true ? await loadInstalledRemote(options.dshAnchor, "@deepseek-ai/dsh-schedule/remote") : void 0;
|
|
306
|
+
const disposers = [];
|
|
307
|
+
const cleanupErrors = [];
|
|
308
|
+
let watch;
|
|
309
|
+
let watchIterator;
|
|
310
|
+
let result;
|
|
311
|
+
let primaryError;
|
|
312
|
+
try {
|
|
313
|
+
disposers.push(await remote.$mount(PI_TUI_CLIENT_CONTRIBUTION));
|
|
314
|
+
disposers.push(await remote.$mount(sessionRemote));
|
|
315
|
+
if (workspaceRemote !== void 0) disposers.push(await remote.$mount(workspaceRemote));
|
|
316
|
+
if (scheduleRemote !== void 0) disposers.push(await remote.$mount(scheduleRemote));
|
|
317
|
+
const list = await remote.session.list({});
|
|
318
|
+
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)}`);
|
|
319
|
+
const fileResult = await remote.piTuiFileReferences.list(PROBE_SESSION_ID, "notes");
|
|
320
|
+
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)}`);
|
|
321
|
+
watch = remote.piTuiTerminalProgress.watch(PROBE_SESSION_ID);
|
|
322
|
+
watchIterator = watch[Symbol.asyncIterator]();
|
|
323
|
+
const opening = await watchIterator.next();
|
|
324
|
+
if (opening.done) throw new Error("host foundation probe: the terminal-progress watch ended before its snapshot");
|
|
325
|
+
assertOpeningSnapshot(opening.value);
|
|
326
|
+
if (options.requestId !== void 0) writeEntryRecord({
|
|
327
|
+
m4b2hf: "host-rpc-watch-open",
|
|
328
|
+
processRole: "client",
|
|
329
|
+
pid: process.pid,
|
|
330
|
+
requestId: options.requestId
|
|
331
|
+
});
|
|
332
|
+
const barrier = process.env.SPLIT_PROCESS_HOST_FOUNDATION_BARRIER;
|
|
333
|
+
if (barrier !== void 0 && barrier !== "") await waitForQualificationBarrier(barrier);
|
|
334
|
+
watch.dispose();
|
|
335
|
+
if ((await watchIterator.next()).done !== true) throw new Error("host foundation probe: the terminal-progress watch did not end after dispose");
|
|
336
|
+
watch = void 0;
|
|
337
|
+
watchIterator = void 0;
|
|
338
|
+
const dropCarrier = options.dropCarrier;
|
|
339
|
+
const readGeneration = options.readGeneration;
|
|
340
|
+
if (dropCarrier === void 0 !== (readGeneration === void 0)) throw new Error("host foundation probe: the generation-resume control requires BOTH dropCarrier and readGeneration");
|
|
341
|
+
const workspace = workspaceRequest === void 0 ? void 0 : await proveWorkspace(remote, workspaceRequest, dropCarrier === void 0 || readGeneration === void 0 ? void 0 : {
|
|
342
|
+
readGeneration,
|
|
343
|
+
generationBefore: readGeneration(),
|
|
344
|
+
dropCarrier,
|
|
345
|
+
...options.requestId === void 0 ? {} : { requestId: options.requestId }
|
|
346
|
+
});
|
|
347
|
+
const schedule = options.schedule === true ? await proveSchedule(remote, dropCarrier === void 0 || readGeneration === void 0 ? void 0 : {
|
|
348
|
+
readGeneration,
|
|
349
|
+
dropCarrier
|
|
350
|
+
}) : void 0;
|
|
351
|
+
result = {
|
|
352
|
+
officialSessionList: true,
|
|
353
|
+
privateFileRpc: true,
|
|
354
|
+
terminalSnapshot: true,
|
|
355
|
+
...schedule === void 0 ? {} : {
|
|
356
|
+
scheduleRemote: true,
|
|
357
|
+
scheduleCatalog: schedule.catalog,
|
|
358
|
+
scheduleCreate: schedule.create,
|
|
359
|
+
scheduleEdit: schedule.edit,
|
|
360
|
+
scheduleDeleted: schedule.deleted,
|
|
361
|
+
...schedule.reconnectCatalog === void 0 ? {} : { scheduleReconnectCatalog: schedule.reconnectCatalog }
|
|
362
|
+
},
|
|
363
|
+
...workspace === void 0 ? {} : {
|
|
364
|
+
workspaceRemote: true,
|
|
365
|
+
workspaceBaseline: workspace.baseline,
|
|
366
|
+
workspaceInBaseline: workspace.inBaseline,
|
|
367
|
+
workspaceCreated: workspace.created,
|
|
368
|
+
workspaceIdempotent: workspace.idempotent,
|
|
369
|
+
workspaceUpsert: workspace.upsert,
|
|
370
|
+
workspaceId: workspace.workspaceId,
|
|
371
|
+
workspacePath: workspace.path,
|
|
372
|
+
...options.dropCarrier === void 0 ? {} : {
|
|
373
|
+
workspaceGenerationAdvanced: workspace.generationAdvanced,
|
|
374
|
+
workspaceHeldStreamClosed: workspace.heldStreamClosed,
|
|
375
|
+
workspaceRestoredBaseline: workspace.restoredBaseline
|
|
376
|
+
}
|
|
377
|
+
}
|
|
378
|
+
};
|
|
379
|
+
} catch (error) {
|
|
380
|
+
primaryError = error;
|
|
381
|
+
} finally {
|
|
382
|
+
if (watch !== void 0) try {
|
|
383
|
+
watch.dispose();
|
|
384
|
+
} catch (error) {
|
|
385
|
+
cleanupErrors.push(error);
|
|
386
|
+
}
|
|
387
|
+
for (let index = disposers.length - 1; index >= 0; index -= 1) try {
|
|
388
|
+
await disposers[index]();
|
|
389
|
+
} catch (error) {
|
|
390
|
+
cleanupErrors.push(error);
|
|
391
|
+
}
|
|
392
|
+
}
|
|
393
|
+
if (primaryError !== void 0) {
|
|
394
|
+
const primary = primaryError instanceof Error ? primaryError : new Error(String(primaryError));
|
|
395
|
+
if (cleanupErrors.length > 0) {
|
|
396
|
+
const secondary = cleanupErrors.length === 1 ? cleanupErrors[0] : new AggregateError(cleanupErrors, "host foundation probe: contribution cleanup failures");
|
|
397
|
+
throw mergeCause(primary, secondary);
|
|
398
|
+
}
|
|
399
|
+
throw primary;
|
|
400
|
+
}
|
|
401
|
+
if (result === void 0) throw new Error("host foundation probe: no proof was produced");
|
|
402
|
+
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"));
|
|
403
|
+
return {
|
|
404
|
+
m4b2hf: "host-rpc-proof",
|
|
405
|
+
hostPid: options.host.identity.hostPid,
|
|
406
|
+
hostInstanceId: options.host.identity.instanceId,
|
|
407
|
+
clientPid: process.pid,
|
|
408
|
+
...result,
|
|
409
|
+
cleaned: true
|
|
410
|
+
};
|
|
411
|
+
}
|
|
412
|
+
//#endregion
|
|
413
|
+
export { runHostFoundationProbe };
|
package/dist/host-runtime.d.mts
CHANGED
|
@@ -6,7 +6,10 @@ declare const name = "pi-tui-host-runtime";
|
|
|
6
6
|
/**
|
|
7
7
|
* Explicit Host dependencies: the private Typert registry plus the two live
|
|
8
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.
|
|
9
|
+
* row gate (see the Host-only overlay), not a plugin inject. The Web access row
|
|
10
|
+
* resolves the Host's OWN Loader through the service on every call, so this
|
|
11
|
+
* published row contract does not change: this row IS a Loader row, and a Host
|
|
12
|
+
* without a Loader fails closed (`unavailable`) instead of pending forever.
|
|
10
13
|
*/
|
|
11
14
|
declare const inject: string[];
|
|
12
15
|
/** Data-free readiness gate published after the whole built-in runtime is live. */
|
|
@@ -15,11 +18,12 @@ declare const PI_TUI_HOST_READY_SERVICE = "piTuiHostReady";
|
|
|
15
18
|
* Mount the built-in PiTui Host Runtime on the launching Host Context.
|
|
16
19
|
*
|
|
17
20
|
* Startup order is fixed: register the package's ONE contribution, mount the
|
|
18
|
-
* file-reference service, mount the terminal-progress service,
|
|
19
|
-
* live bindings, then publish the readiness gate.
|
|
20
|
-
* BEFORE it is awaited; a partial rejection
|
|
21
|
-
* reverse order (contribution last) while
|
|
22
|
-
* and attaching cleanup failures to its
|
|
21
|
+
* file-reference service, mount the terminal-progress service, mount the Web
|
|
22
|
+
* access service, verify ALL live bindings, then publish the readiness gate.
|
|
23
|
+
* Every child fiber is recorded BEFORE it is awaited; a partial rejection
|
|
24
|
+
* disposes the recorded children in reverse order (contribution last) while
|
|
25
|
+
* keeping the original error primary and attaching cleanup failures to its
|
|
26
|
+
* cause chain.
|
|
23
27
|
*/
|
|
24
28
|
declare function apply(ctx: Context): Promise<void>;
|
|
25
29
|
//#endregion
|