@xmoon76/dsh-pi-tui 0.5.7 → 0.5.8
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 +13 -11
- package/README.md +13 -11
- package/dist/{bootstrap-C9nl6e13.mjs → bootstrap-CMIjGyuk.mjs} +532 -416
- package/dist/builtins.mjs +2 -2
- package/dist/{client-bootstrap-CGezi85O.mjs → client-bootstrap-BjGPc-DM.mjs} +826 -3
- package/dist/{daemon-launcher-H_1r5Cqs.mjs → daemon-launcher-Dult7Jxv.mjs} +121 -4
- package/dist/daemon-launcher.mjs +1 -1
- package/dist/{entry-control-jBfKn1qO.mjs → entry-control-DjNsE3I0.mjs} +1 -1
- package/dist/{extensions-6a5vvJUT.mjs → extensions-B4uLpSTv.mjs} +1 -4
- package/dist/extensions.mjs +1 -1
- package/dist/{host-foundation-probe-DK7n5jDu.mjs → host-foundation-probe-DMNTmNrH.mjs} +1 -1
- package/dist/index.mjs +532 -298
- package/dist/{local-acp-listener-CNkguN5-.mjs → local-acp-listener-B65J0Bx4.mjs} +561 -12
- package/dist/local-client.mjs +442 -45
- package/dist/{local-daemon-control-Cu_4FIdd.mjs → local-daemon-control-C14q9KnD.mjs} +5 -2
- package/dist/{local-daemon-control-Bg9s2aYi.mjs → local-daemon-control-TCnERL7n.mjs} +3 -3
- package/dist/{local-discovery-Bq3jLAn1.mjs → local-discovery-DOSsCh9q.mjs} +1 -1
- package/dist/{local-discovery-BMoNXZjJ.mjs → local-discovery-egN4_gsQ.mjs} +1 -1
- package/dist/{local-discovery-BPZw1wEd.mjs → local-discovery-uOBfFq5j.mjs} +1 -1
- package/dist/local-host.mjs +24 -6
- package/dist/local-profile-daemon-admin-BmQSdzT0.mjs +210 -0
- package/dist/{local-scope-DEuGAy8l.mjs → local-scope-DamiMqPd.mjs} +118 -1
- package/dist/{local-transport-X4ZCe2uE.mjs → local-transport-Iwo0mtu3.mjs} +2 -2
- package/dist/{local-web-control-DKWtXIkr.mjs → local-web-control-DMrjwCkl.mjs} +2 -2
- package/dist/{session-DC0XQr5O.mjs → session-C6tSs86s.mjs} +2 -2
- package/dist/{session-Cihe8PPS.mjs → session-CstInGIA.mjs} +1 -1
- package/dist/{startup-CARqn3kV.mjs → startup-EG5UqIcd.mjs} +3 -3
- package/dist/startup.mjs +1 -1
- package/dist/{terminal-progress-source-D4DHyXDo.mjs → terminal-progress-source-CpfpQO_h.mjs} +3 -6
- package/dist/{transcript-view-hvNVkPtv.mjs → transcript-view-C1YtJ49Y.mjs} +191 -192
- package/dist/{transcript-view-a7cROAaI.mjs → transcript-view-CuJYWkhp.mjs} +190 -191
- package/package.json +6 -6
- package/dist/local-profile-daemon-admin-AXgVH-6y.mjs +0 -91
package/dist/local-client.mjs
CHANGED
|
@@ -1,18 +1,348 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import { d as readInstalledDshVersion, h as scopeFromInstalledProfile, n as LocalScopeError, o as bindProfileKernelSeat, p as readProcessStartDiagnostic, r as NO_PROCESS_SEAT, s as computeBuildId, u as installedPackageRootFromEntry, v as parseProcessStatStarttime, y as readKernelProcess } from "./local-scope-
|
|
2
|
+
import { d as readInstalledDshVersion, h as scopeFromInstalledProfile, n as LocalScopeError, o as bindProfileKernelSeat, p as readProcessStartDiagnostic, r as NO_PROCESS_SEAT, s as computeBuildId, u as installedPackageRootFromEntry, v as parseProcessStatStarttime, y as readKernelProcess } from "./local-scope-DamiMqPd.mjs";
|
|
3
3
|
import { t as runSyncDisposalSteps } from "./disposal-BYBbEpVY.mjs";
|
|
4
|
-
import { n as createEntryDiag, r as writeEntryRecord, t as attachEntryControl } from "./entry-control-
|
|
5
|
-
import { i as runDetached } from "./tasks-D_z5Yjjr.mjs";
|
|
4
|
+
import { n as createEntryDiag, r as writeEntryRecord, t as attachEntryControl } from "./entry-control-DjNsE3I0.mjs";
|
|
5
|
+
import { i as runDetached, o as safeErrorMessage } from "./tasks-D_z5Yjjr.mjs";
|
|
6
6
|
import { r as observeHostWorkspaceObject } from "./local-workspace-object-D06GL0UO.mjs";
|
|
7
|
-
import { c as ensureLocalHost, m as sameLocalInstanceRecord, p as readLocalRecord, r as assertRecordedHostKernelIdentityCurrent } from "./local-discovery-
|
|
7
|
+
import { c as ensureLocalHost, m as sameLocalInstanceRecord, p as readLocalRecord, r as assertRecordedHostKernelIdentityCurrent } from "./local-discovery-DOSsCh9q.mjs";
|
|
8
8
|
import { t as mergeCause } from "./dispose-cause-CNFuUnjR.mjs";
|
|
9
|
-
import { n as profileDaemonAdminRun, t as createProfileDaemonAdmin } from "./local-profile-daemon-admin-
|
|
9
|
+
import { a as dshHome, n as profileDaemonAdminRun, t as createProfileDaemonAdmin } from "./local-profile-daemon-admin-BmQSdzT0.mjs";
|
|
10
10
|
import { createRequire } from "node:module";
|
|
11
|
-
import {
|
|
11
|
+
import { randomUUID } from "node:crypto";
|
|
12
|
+
import { chmodSync, closeSync, constants, existsSync, fchmodSync, fstatSync, lstatSync, mkdirSync, openSync, readFileSync, realpathSync, rmSync, statSync, writeSync } from "node:fs";
|
|
12
13
|
import { dirname, isAbsolute, join } from "node:path";
|
|
13
14
|
import { pathToFileURL } from "node:url";
|
|
14
15
|
import { constants as constants$1 } from "node:os";
|
|
15
16
|
import { spawn } from "node:child_process";
|
|
17
|
+
//#region src/app/remote-process/client-fatal-diagnostics.ts
|
|
18
|
+
/**
|
|
19
|
+
* Private Client fatal diagnostics.
|
|
20
|
+
*
|
|
21
|
+
* The Split Client runs in its own process; its launcher inherits this
|
|
22
|
+
* process's terminal but cannot report the child's cause, and the official
|
|
23
|
+
* `daemon logs` command must remain a Host-only source. This module is the ONE
|
|
24
|
+
* Client-owned fatal artifact writer: on a real surface fatal it stores a
|
|
25
|
+
* bounded, redacted, human-readable report under the private
|
|
26
|
+
* `$DSH_HOME/logs/pi-tui-client/` directory and returns a terminal-safe
|
|
27
|
+
* locator. It writes nothing on a successful start, depends on no Cordis /
|
|
28
|
+
* Host / Remote state, and an IO failure is a secondary result that never
|
|
29
|
+
* replaces the primary failure.
|
|
30
|
+
*
|
|
31
|
+
* The file is private incident data, not a shareable report: mode 0600 is
|
|
32
|
+
* mandatory, and redaction covers only the well-known credential carriers.
|
|
33
|
+
* Arbitrary secrets embedded in a user-thrown error cannot be fully
|
|
34
|
+
* recognized; never treat this file as safe to share anonymously.
|
|
35
|
+
* @module app/remote-process/client-fatal-diagnostics
|
|
36
|
+
*/
|
|
37
|
+
const HEADER = "dsh-pi-tui client fatal v1";
|
|
38
|
+
const MAX_FILE_BYTES = 32768;
|
|
39
|
+
const MAX_MESSAGE_BYTES = 2048;
|
|
40
|
+
const MAX_STACK_BYTES = 12288;
|
|
41
|
+
const MAX_CAUSE_DEPTH = 4;
|
|
42
|
+
const MAX_NAME_BYTES = 128;
|
|
43
|
+
const ERROR_CODE_PATTERN = /^[A-Z][A-Z0-9_]{0,63}$/u;
|
|
44
|
+
/** Only the Node module-loader codes are Client dependency misses. */
|
|
45
|
+
const MODULE_MISSING_CODE_PATTERN = /^(?:ERR_MODULE_NOT_FOUND|MODULE_NOT_FOUND)$/u;
|
|
46
|
+
const SAFE_MODULE_SPECIFIER_PATTERN = /^[A-Za-z0-9@._/-]{1,96}$/u;
|
|
47
|
+
const SAFE_ERRNO_PATTERN = /^[A-Z][A-Z0-9_]{0,31}$/u;
|
|
48
|
+
const MODULE_NOT_FOUND_SENTENCE = /Cannot find (?:package|module) '([^']+)'/u;
|
|
49
|
+
/** A deliberate policy refusal with a controlled errno-shaped code. */
|
|
50
|
+
var DiagnosticWriteRefusal = class extends Error {
|
|
51
|
+
code;
|
|
52
|
+
constructor(code) {
|
|
53
|
+
super(code);
|
|
54
|
+
this.name = "DiagnosticWriteRefusal";
|
|
55
|
+
this.code = code;
|
|
56
|
+
}
|
|
57
|
+
};
|
|
58
|
+
/** Read one error-like field without letting a hostile getter or proxy escape. */
|
|
59
|
+
function readField(value, field) {
|
|
60
|
+
try {
|
|
61
|
+
return value[field];
|
|
62
|
+
} catch {
|
|
63
|
+
return;
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
/** The controlled errno name of a thrown IO/policy failure, or `UNKNOWN`. */
|
|
67
|
+
function controlledErrno(error) {
|
|
68
|
+
const code = readField(error, "code");
|
|
69
|
+
return typeof code === "string" && SAFE_ERRNO_PATTERN.test(code) ? code : "UNKNOWN";
|
|
70
|
+
}
|
|
71
|
+
/** The legal error code of a thrown value, if it has one. */
|
|
72
|
+
function legalErrorCode(error) {
|
|
73
|
+
const code = readField(error, "code");
|
|
74
|
+
return typeof code === "string" && ERROR_CODE_PATTERN.test(code) ? code : void 0;
|
|
75
|
+
}
|
|
76
|
+
/** Whether this is the exact Node loader shape of a missing Client dependency. */
|
|
77
|
+
function isModuleMissing(error) {
|
|
78
|
+
const code = legalErrorCode(error);
|
|
79
|
+
return code !== void 0 && MODULE_MISSING_CODE_PATTERN.test(code);
|
|
80
|
+
}
|
|
81
|
+
/**
|
|
82
|
+
* The only module specifier that may reach the terminal: the standard Node
|
|
83
|
+
* `Cannot find ...` sentence, a bounded package-shaped name with no path or
|
|
84
|
+
* URL shape. An unknown shape stays unknown rather than guessing.
|
|
85
|
+
*/
|
|
86
|
+
function clientModuleSpecifier(error) {
|
|
87
|
+
const specifier = MODULE_NOT_FOUND_SENTENCE.exec(safeErrorMessage(error))?.[1];
|
|
88
|
+
if (specifier === void 0) return void 0;
|
|
89
|
+
if (!SAFE_MODULE_SPECIFIER_PATTERN.test(specifier)) return void 0;
|
|
90
|
+
if (specifier.startsWith("/") || specifier.startsWith("./") || specifier.startsWith("../")) return void 0;
|
|
91
|
+
if (specifier.includes("/../") || specifier.includes("//") || specifier.includes("\\")) return void 0;
|
|
92
|
+
return specifier;
|
|
93
|
+
}
|
|
94
|
+
/** The controlled classification of one fatal observation. */
|
|
95
|
+
function clientFatalKind(error, phase) {
|
|
96
|
+
if (isModuleMissing(error)) return "CLIENT_MODULE_MISSING";
|
|
97
|
+
return phase === "client-runtime" ? "CLIENT_RUNTIME_FAILED" : "CLIENT_STARTUP_FAILED";
|
|
98
|
+
}
|
|
99
|
+
/**
|
|
100
|
+
* Redact the known credential carriers from private diagnostic text. Bounded
|
|
101
|
+
* on purpose: the file contract states that arbitrary secret formats cannot
|
|
102
|
+
* be fully recognized.
|
|
103
|
+
*/
|
|
104
|
+
function redactPrivateText(text) {
|
|
105
|
+
return text.replace(/\b(Authorization|Cookie|Set-Cookie)\s*:\s*[^\r\n]*/giu, "$1: <redacted>").replace(/\b[a-zA-Z][a-zA-Z0-9+.-]*:\/\/[^\s'"]+/gu, "<url>").replace(/([?&](?:token|access_token|cookie)=)[^&#\s]+/giu, "$1<redacted>").replace(/\b(token|access_token|password)\s*=\s*(?:\\?"(?:\\.|[^"\\])*\\?"|\\?'(?:\\.|[^'\\])*\\?'|[^\s&;,]+)/giu, "$1=<redacted>");
|
|
106
|
+
}
|
|
107
|
+
/** Truncate a string to at most `maxBytes` UTF-8 bytes without splitting a code point. */
|
|
108
|
+
function truncateUtf8(text, maxBytes) {
|
|
109
|
+
const buffer = Buffer.from(text, "utf8");
|
|
110
|
+
if (buffer.length <= maxBytes) return text;
|
|
111
|
+
let end = maxBytes;
|
|
112
|
+
while (end > 0 && (buffer[end] & 192) === 128) end -= 1;
|
|
113
|
+
return buffer.subarray(0, end).toString("utf8");
|
|
114
|
+
}
|
|
115
|
+
/** Collapse a single-line field without letting control characters cross fields. */
|
|
116
|
+
function singleLine(text, maxBytes) {
|
|
117
|
+
return truncateUtf8(redactPrivateText(text).replace(/[\r\n]+/gu, " "), maxBytes);
|
|
118
|
+
}
|
|
119
|
+
/** Observe Error/AggregateError identity without a hostile trap escaping. */
|
|
120
|
+
function isErrorLike(value) {
|
|
121
|
+
try {
|
|
122
|
+
return value instanceof Error;
|
|
123
|
+
} catch {
|
|
124
|
+
return false;
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
function isAggregateErrorLike(value) {
|
|
128
|
+
try {
|
|
129
|
+
return value instanceof AggregateError;
|
|
130
|
+
} catch {
|
|
131
|
+
return false;
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
/** The error branches of one AggregateError, without the wrapper itself. */
|
|
135
|
+
function aggregateBranches(value) {
|
|
136
|
+
const errors = readField(value, "errors");
|
|
137
|
+
try {
|
|
138
|
+
return Array.isArray(errors) ? [...errors] : [];
|
|
139
|
+
} catch {
|
|
140
|
+
return [];
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
/** The direct cause branches of one error layer, including an AggregateError's
|
|
144
|
+
* own standard `.cause` alongside its `.errors` branches. */
|
|
145
|
+
function causeBranches(value) {
|
|
146
|
+
if (isAggregateErrorLike(value)) {
|
|
147
|
+
const branches = aggregateBranches(value);
|
|
148
|
+
const cause = readField(value, "cause");
|
|
149
|
+
if (cause !== void 0) branches.push(cause);
|
|
150
|
+
if (branches.length > 0) return branches;
|
|
151
|
+
}
|
|
152
|
+
const cause = readField(value, "cause");
|
|
153
|
+
return cause === void 0 ? [] : [cause];
|
|
154
|
+
}
|
|
155
|
+
/** Append one primary/cause layer to the fixed field list. */
|
|
156
|
+
function appendErrorFields(lines, error, depth) {
|
|
157
|
+
const prefix = depth === 0 ? "error" : `cause[${depth}]`;
|
|
158
|
+
const name = readField(error, "name");
|
|
159
|
+
const fallbackName = isErrorLike(error) ? "Error" : "NonError";
|
|
160
|
+
lines.push(`${prefix}.name: ${typeof name === "string" && name !== "" ? singleLine(name, MAX_NAME_BYTES) : fallbackName}`);
|
|
161
|
+
const code = legalErrorCode(error);
|
|
162
|
+
if (code !== void 0) lines.push(`${prefix}.code: ${code}`);
|
|
163
|
+
lines.push(`${prefix}.message: ${truncateUtf8(redactPrivateText(safeErrorMessage(error)), MAX_MESSAGE_BYTES)}`);
|
|
164
|
+
const stack = readField(error, "stack");
|
|
165
|
+
if (typeof stack === "string" && stack !== "") lines.push(`${prefix}.stack: ${truncateUtf8(redactPrivateText(stack), MAX_STACK_BYTES)}`);
|
|
166
|
+
}
|
|
167
|
+
/**
|
|
168
|
+
* Append at most MAX_CAUSE_DEPTH REAL causes. `AggregateError` wrappers are
|
|
169
|
+
* flattening devices: their branches occupy the same cause slots, so the
|
|
170
|
+
* cleanup merge can expose both sides without spending a slot on the wrapper.
|
|
171
|
+
*/
|
|
172
|
+
function appendCauseChain(lines, root) {
|
|
173
|
+
const seen = /* @__PURE__ */ new Set();
|
|
174
|
+
let count = 0;
|
|
175
|
+
let circular = false;
|
|
176
|
+
const visit = (value) => {
|
|
177
|
+
if (value === void 0 || count >= MAX_CAUSE_DEPTH) return;
|
|
178
|
+
if (seen.has(value)) {
|
|
179
|
+
circular = true;
|
|
180
|
+
return;
|
|
181
|
+
}
|
|
182
|
+
seen.add(value);
|
|
183
|
+
const branches = causeBranches(value);
|
|
184
|
+
if (isAggregateErrorLike(value) && branches.length > 0) {
|
|
185
|
+
for (const branch of branches) visit(branch);
|
|
186
|
+
return;
|
|
187
|
+
}
|
|
188
|
+
count += 1;
|
|
189
|
+
appendErrorFields(lines, value, count);
|
|
190
|
+
if (count >= MAX_CAUSE_DEPTH) return;
|
|
191
|
+
for (const child of branches) visit(child);
|
|
192
|
+
};
|
|
193
|
+
for (const child of causeBranches(root)) visit(child);
|
|
194
|
+
if (circular) lines.push("cause: <circular cause>");
|
|
195
|
+
}
|
|
196
|
+
/** Bound the whole document to the frozen 32 KiB contract. */
|
|
197
|
+
function boundFileText(text) {
|
|
198
|
+
if (Buffer.from(text, "utf8").length <= MAX_FILE_BYTES) return text;
|
|
199
|
+
const marker = "\n[truncated]\n";
|
|
200
|
+
return `${truncateUtf8(text, MAX_FILE_BYTES - Buffer.byteLength(marker, "utf8"))}${marker}`;
|
|
201
|
+
}
|
|
202
|
+
/**
|
|
203
|
+
* Build the bounded, redacted private text for one fatal. Shared with the
|
|
204
|
+
* writer so the security/size rules live in exactly one implementation.
|
|
205
|
+
*/
|
|
206
|
+
function clientFatalErrorDetails(error, phase) {
|
|
207
|
+
const kind = clientFatalKind(error, phase);
|
|
208
|
+
const lines = [
|
|
209
|
+
HEADER,
|
|
210
|
+
`time: ${(/* @__PURE__ */ new Date()).toISOString()}`,
|
|
211
|
+
`phase: ${phase}`,
|
|
212
|
+
`kind: ${kind}`
|
|
213
|
+
];
|
|
214
|
+
appendErrorFields(lines, error, 0);
|
|
215
|
+
appendCauseChain(lines, error);
|
|
216
|
+
return {
|
|
217
|
+
kind,
|
|
218
|
+
text: boundFileText(`${lines.join("\n")}\n`)
|
|
219
|
+
};
|
|
220
|
+
}
|
|
221
|
+
/** The terminal-safe locator for one write result: never a private absolute path. */
|
|
222
|
+
function clientDiagnosticLocation(result) {
|
|
223
|
+
if (result.kind === "written") return `Client diagnostics: $DSH_HOME/logs/pi-tui-client/${result.fileName} (default DSH_HOME: ~/.dsh)`;
|
|
224
|
+
if (result.kind === "disabled") return "Client diagnostic file disabled (DSH_PI_TUI_LOG=off)";
|
|
225
|
+
return `Client diagnostics unavailable (DIAGNOSTIC_WRITE_FAILURE: ${result.errno})`;
|
|
226
|
+
}
|
|
227
|
+
/** Create (or tighten) the Client-only directory and prove it is a private 0700 real directory. */
|
|
228
|
+
function ensurePrivateClientDirectory(path, uid) {
|
|
229
|
+
let info;
|
|
230
|
+
try {
|
|
231
|
+
info = lstatSync(path);
|
|
232
|
+
} catch (error) {
|
|
233
|
+
if (controlledErrno(error) !== "ENOENT") throw error;
|
|
234
|
+
try {
|
|
235
|
+
mkdirSync(path, { mode: 448 });
|
|
236
|
+
} catch (mkdirError) {
|
|
237
|
+
if (controlledErrno(mkdirError) !== "EEXIST") throw mkdirError;
|
|
238
|
+
}
|
|
239
|
+
info = lstatSync(path);
|
|
240
|
+
}
|
|
241
|
+
if (info.isSymbolicLink() || !info.isDirectory()) throw new DiagnosticWriteRefusal("ELOOP");
|
|
242
|
+
if (uid !== void 0 && info.uid !== uid) throw new DiagnosticWriteRefusal("EPERM");
|
|
243
|
+
if ((info.mode & 511) !== 448) {
|
|
244
|
+
chmodSync(path, 448);
|
|
245
|
+
info = lstatSync(path);
|
|
246
|
+
if (info.isSymbolicLink() || !info.isDirectory() || (info.mode & 511) !== 448) throw new DiagnosticWriteRefusal("EPERM");
|
|
247
|
+
if (uid !== void 0 && info.uid !== uid) throw new DiagnosticWriteRefusal("EPERM");
|
|
248
|
+
}
|
|
249
|
+
return path;
|
|
250
|
+
}
|
|
251
|
+
/**
|
|
252
|
+
* Resolve the real DSH home, prove the actual `logs` parent and the Client-only
|
|
253
|
+
* child are uid-owned real directories, and create only the Client-specific
|
|
254
|
+
* directory when missing. The shared `logs` directory is never chmodded.
|
|
255
|
+
*/
|
|
256
|
+
function prepareDiagnosticDirectory(env) {
|
|
257
|
+
const home = realpathSync(dshHome(env));
|
|
258
|
+
const uid = typeof process.getuid === "function" ? process.getuid() : void 0;
|
|
259
|
+
const homeInfo = statSync(home);
|
|
260
|
+
if (!homeInfo.isDirectory()) throw new DiagnosticWriteRefusal("ENOTDIR");
|
|
261
|
+
if (uid !== void 0 && homeInfo.uid !== uid) throw new DiagnosticWriteRefusal("EPERM");
|
|
262
|
+
const logs = join(home, "logs");
|
|
263
|
+
let logsInfo;
|
|
264
|
+
try {
|
|
265
|
+
logsInfo = lstatSync(logs);
|
|
266
|
+
} catch (error) {
|
|
267
|
+
if (controlledErrno(error) !== "ENOENT") throw error;
|
|
268
|
+
mkdirSync(logs, { mode: 448 });
|
|
269
|
+
logsInfo = lstatSync(logs);
|
|
270
|
+
}
|
|
271
|
+
if (logsInfo.isSymbolicLink() || !logsInfo.isDirectory()) throw new DiagnosticWriteRefusal("ELOOP");
|
|
272
|
+
if (uid !== void 0 && logsInfo.uid !== uid) throw new DiagnosticWriteRefusal("EPERM");
|
|
273
|
+
if ((logsInfo.mode & 18) !== 0) throw new DiagnosticWriteRefusal("EPERM");
|
|
274
|
+
const directory = ensurePrivateClientDirectory(join(logs, "pi-tui-client"), uid);
|
|
275
|
+
if (realpathSync(directory) !== directory) throw new DiagnosticWriteRefusal("ELOOP");
|
|
276
|
+
return directory;
|
|
277
|
+
}
|
|
278
|
+
/**
|
|
279
|
+
* Write the whole UTF-8 buffer. `writeSync` may legally return a short count
|
|
280
|
+
* for a regular file (for example a full disk); a short/zero write is an IO
|
|
281
|
+
* failure, never a successful `written` result.
|
|
282
|
+
*/
|
|
283
|
+
function writeAllBytes(fd, text, write = writeSync) {
|
|
284
|
+
const buffer = Buffer.from(text, "utf8");
|
|
285
|
+
let offset = 0;
|
|
286
|
+
while (offset < buffer.length) {
|
|
287
|
+
const written = write(fd, buffer, offset, buffer.length - offset);
|
|
288
|
+
if (written <= 0) throw new DiagnosticWriteRefusal("EIO");
|
|
289
|
+
offset += written;
|
|
290
|
+
}
|
|
291
|
+
}
|
|
292
|
+
/**
|
|
293
|
+
* Write ONE Client fatal artifact. Returns the terminal-safe locator facts; a
|
|
294
|
+
* disabled or failed write is reported explicitly and never throws into the
|
|
295
|
+
* application startup root.
|
|
296
|
+
*/
|
|
297
|
+
function writeClientFatalDiagnostic(error, phase, env) {
|
|
298
|
+
const configured = env.DSH_PI_TUI_LOG;
|
|
299
|
+
if (configured === "off" || configured === "") return { kind: "disabled" };
|
|
300
|
+
let directory;
|
|
301
|
+
try {
|
|
302
|
+
directory = prepareDiagnosticDirectory(env);
|
|
303
|
+
} catch (ioError) {
|
|
304
|
+
return {
|
|
305
|
+
kind: "unavailable",
|
|
306
|
+
errno: controlledErrno(ioError)
|
|
307
|
+
};
|
|
308
|
+
}
|
|
309
|
+
const fileName = `startup-${randomUUID()}.log`;
|
|
310
|
+
const target = join(directory, fileName);
|
|
311
|
+
let fd;
|
|
312
|
+
let created = false;
|
|
313
|
+
try {
|
|
314
|
+
fd = openSync(target, constants.O_WRONLY | constants.O_CREAT | constants.O_EXCL | constants.O_NOFOLLOW, 384);
|
|
315
|
+
created = true;
|
|
316
|
+
let info = fstatSync(fd);
|
|
317
|
+
if (!info.isFile()) throw new DiagnosticWriteRefusal("EPERM");
|
|
318
|
+
const uid = typeof process.getuid === "function" ? process.getuid() : void 0;
|
|
319
|
+
if (uid !== void 0 && info.uid !== uid) throw new DiagnosticWriteRefusal("EPERM");
|
|
320
|
+
if ((info.mode & 511) !== 384) {
|
|
321
|
+
fchmodSync(fd, 384);
|
|
322
|
+
info = fstatSync(fd);
|
|
323
|
+
}
|
|
324
|
+
if (!info.isFile() || (info.mode & 511) !== 384 || uid !== void 0 && info.uid !== uid) throw new DiagnosticWriteRefusal("EPERM");
|
|
325
|
+
writeAllBytes(fd, clientFatalErrorDetails(error, phase).text);
|
|
326
|
+
closeSync(fd);
|
|
327
|
+
fd = void 0;
|
|
328
|
+
return {
|
|
329
|
+
kind: "written",
|
|
330
|
+
fileName
|
|
331
|
+
};
|
|
332
|
+
} catch (ioError) {
|
|
333
|
+
if (fd !== void 0) try {
|
|
334
|
+
closeSync(fd);
|
|
335
|
+
} catch {}
|
|
336
|
+
if (created) try {
|
|
337
|
+
rmSync(target, { force: true });
|
|
338
|
+
} catch {}
|
|
339
|
+
return {
|
|
340
|
+
kind: "unavailable",
|
|
341
|
+
errno: controlledErrno(ioError)
|
|
342
|
+
};
|
|
343
|
+
}
|
|
344
|
+
}
|
|
345
|
+
//#endregion
|
|
16
346
|
//#region src/app/remote-process/local-workspace-equivalence.ts
|
|
17
347
|
/**
|
|
18
348
|
* The Client-local launch-cwd / Host-directory equivalence classifier
|
|
@@ -913,6 +1243,46 @@ const OLD_CLIENT_ENVIRONMENT = [
|
|
|
913
1243
|
function failureMessage(error) {
|
|
914
1244
|
return error instanceof Error ? error.message : String(error);
|
|
915
1245
|
}
|
|
1246
|
+
/** Observe Error identity without a hostile Proxy `getPrototypeOf` trap escaping. */
|
|
1247
|
+
function isErrorValue(value) {
|
|
1248
|
+
try {
|
|
1249
|
+
return value instanceof Error;
|
|
1250
|
+
} catch {
|
|
1251
|
+
return false;
|
|
1252
|
+
}
|
|
1253
|
+
}
|
|
1254
|
+
/** Observe LocalScopeError identity through the same safe boundary. */
|
|
1255
|
+
function isLocalScopeErrorValue(value) {
|
|
1256
|
+
try {
|
|
1257
|
+
return value instanceof LocalScopeError;
|
|
1258
|
+
} catch {
|
|
1259
|
+
return false;
|
|
1260
|
+
}
|
|
1261
|
+
}
|
|
1262
|
+
/**
|
|
1263
|
+
* Merge the stop coordinator's cleanup errors into the ONE primary error that
|
|
1264
|
+
* the incident file records. The terminal classification keeps the original
|
|
1265
|
+
* failure; only the artifact needs the cleanup cause chain.
|
|
1266
|
+
*/
|
|
1267
|
+
function clientFatalPrimaryWithCleanup(failure, cleanupErrors) {
|
|
1268
|
+
const primary = isErrorValue(failure) ? failure : new Error(safeErrorMessage(failure));
|
|
1269
|
+
if (cleanupErrors.length === 0) return primary;
|
|
1270
|
+
try {
|
|
1271
|
+
let merged = primary;
|
|
1272
|
+
for (const cleanupError of cleanupErrors) merged = mergeCause(merged, cleanupError);
|
|
1273
|
+
return merged;
|
|
1274
|
+
} catch {
|
|
1275
|
+
const root = new Error(safeErrorMessage(failure));
|
|
1276
|
+
if (isErrorValue(failure)) try {
|
|
1277
|
+
root.name = failure.name;
|
|
1278
|
+
root.stack = failure.stack;
|
|
1279
|
+
const code = failure.code;
|
|
1280
|
+
if (typeof code === "string") root.code = code;
|
|
1281
|
+
} catch {}
|
|
1282
|
+
root.cause = new AggregateError([failure, ...cleanupErrors], "local client entry: fatal failure with cleanup causes");
|
|
1283
|
+
return root;
|
|
1284
|
+
}
|
|
1285
|
+
}
|
|
916
1286
|
function isRecord(value) {
|
|
917
1287
|
return value !== null && typeof value === "object" && !Array.isArray(value);
|
|
918
1288
|
}
|
|
@@ -1694,7 +2064,10 @@ async function runLocalClientEntry(options) {
|
|
|
1694
2064
|
process.exitCode = code;
|
|
1695
2065
|
if (code === 0 && reexecIntent !== void 0) reexecTeardownSucceeded = true;
|
|
1696
2066
|
}
|
|
1697
|
-
if (options.mode === "surface" && failure !== void 0)
|
|
2067
|
+
if (options.mode === "surface" && failure !== void 0) {
|
|
2068
|
+
const phase = handle !== void 0 ? "client-runtime" : context === void 0 ? "pre-context" : "client-assembly";
|
|
2069
|
+
process.stderr.write(`${reportStopClientFatal(failure, options.profile, phase, expectedHostInstanceId !== void 0, process.env, errors)}\n`);
|
|
2070
|
+
}
|
|
1698
2071
|
process.stdin.pause();
|
|
1699
2072
|
resolveStopped?.();
|
|
1700
2073
|
emit({
|
|
@@ -1787,8 +2160,8 @@ async function runLocalClientEntry(options) {
|
|
|
1787
2160
|
pid: process.pid,
|
|
1788
2161
|
phase: "context-ready"
|
|
1789
2162
|
});
|
|
1790
|
-
const transportModule = await import("./local-transport-
|
|
1791
|
-
const { mountSurfaceClientDomainPrerequisites, startLocalClient } = await import("./client-bootstrap-
|
|
2163
|
+
const transportModule = await import("./local-transport-Iwo0mtu3.mjs");
|
|
2164
|
+
const { mountSurfaceClientDomainPrerequisites, startLocalClient } = await import("./client-bootstrap-BjGPc-DM.mjs");
|
|
1792
2165
|
const onTransportFatal = (error) => {
|
|
1793
2166
|
terminalError ??= error;
|
|
1794
2167
|
if (compositionDone) runDetached("local client: terminal transport identity failure", () => stop(1, terminalError), { diag });
|
|
@@ -2347,7 +2720,7 @@ async function runLocalClientEntry(options) {
|
|
|
2347
2720
|
runDetached("local client: surface exit", () => stop(code), { diag });
|
|
2348
2721
|
});
|
|
2349
2722
|
activeBridge = bridge;
|
|
2350
|
-
const { applyRunnerWithRuntime } = await import("./bootstrap-
|
|
2723
|
+
const { applyRunnerWithRuntime } = await import("./bootstrap-CMIjGyuk.mjs");
|
|
2351
2724
|
const launchWorkspace = await classifyLaunchWorkspace(host.identity, CLIENT_LAUNCH_CWD, {
|
|
2352
2725
|
...CLIENT_LAUNCH_OBJECT === void 0 ? {} : { launchObject: CLIENT_LAUNCH_OBJECT },
|
|
2353
2726
|
scope,
|
|
@@ -2570,7 +2943,7 @@ async function runLocalClientEntry(options) {
|
|
|
2570
2943
|
if (workspaceResume === true && workspacePath === void 0) throw new Error("local client entry: the generation-resume control requires a workspacePath");
|
|
2571
2944
|
const schedule = qualificationRequest.schedule;
|
|
2572
2945
|
if (schedule !== void 0 && schedule !== true) throw new Error("local client entry: schedule must be the boolean true when supplied");
|
|
2573
|
-
const { runHostFoundationProbe } = await import("./host-foundation-probe-
|
|
2946
|
+
const { runHostFoundationProbe } = await import("./host-foundation-probe-DMNTmNrH.mjs");
|
|
2574
2947
|
const proof = await runHostFoundationProbe(context, {
|
|
2575
2948
|
dshAnchor: options.dshAnchor,
|
|
2576
2949
|
host,
|
|
@@ -2612,7 +2985,7 @@ async function runLocalClientEntry(options) {
|
|
|
2612
2985
|
return;
|
|
2613
2986
|
}
|
|
2614
2987
|
const failure = terminalError ?? error;
|
|
2615
|
-
|
|
2988
|
+
const primary = isErrorValue(failure) ? failure : new Error(safeErrorMessage(failure));
|
|
2616
2989
|
const cleanupErrors = [];
|
|
2617
2990
|
const timedOut = await disposeWithinDeadline(async () => {
|
|
2618
2991
|
if (rootReleased) return;
|
|
@@ -2663,22 +3036,22 @@ async function runLocalClientEntry(options) {
|
|
|
2663
3036
|
}
|
|
2664
3037
|
rootReleased = true;
|
|
2665
3038
|
}, cleanupErrors);
|
|
2666
|
-
|
|
2667
|
-
const transportCleanupFailed = error
|
|
3039
|
+
const filePrimary = clientFatalPrimaryWithCleanup(primary, cleanupErrors);
|
|
3040
|
+
const transportCleanupFailed = isErrorValue(error) && error.cleanupFailed === true || cleanupErrors.some((cleanupError) => isErrorValue(cleanupError) && cleanupError.cleanupFailed === true);
|
|
2668
3041
|
emit({
|
|
2669
3042
|
m4a0: "failure",
|
|
2670
3043
|
processRole: "client",
|
|
2671
3044
|
phase: context === void 0 ? "startup" : "after-context",
|
|
2672
3045
|
pid: process.pid,
|
|
2673
3046
|
...traceTransportStatus(),
|
|
2674
|
-
...failure
|
|
2675
|
-
error:
|
|
2676
|
-
...
|
|
2677
|
-
...
|
|
3047
|
+
...isLocalScopeErrorValue(failure) ? { code: failure.code } : {},
|
|
3048
|
+
error: filePrimary.message,
|
|
3049
|
+
...filePrimary.stack === void 0 ? {} : { stack: filePrimary.stack },
|
|
3050
|
+
...filePrimary.cause === void 0 ? {} : { cause: isErrorValue(filePrimary.cause) ? filePrimary.cause.message : safeErrorMessage(filePrimary.cause) }
|
|
2678
3051
|
});
|
|
2679
3052
|
if (options.mode === "surface") {
|
|
2680
|
-
const
|
|
2681
|
-
process.stderr.write(`${
|
|
3053
|
+
const phase = handle === void 0 ? context === void 0 ? "pre-context" : "client-assembly" : "client-runtime";
|
|
3054
|
+
process.stderr.write(`${reportSurfaceClientFatal(failure, options.profile, phase, expectedHostInstanceId !== void 0, process.env, filePrimary)}\n`);
|
|
2682
3055
|
}
|
|
2683
3056
|
process.stdin.pause();
|
|
2684
3057
|
if (cleanupErrors.length === 0 && !timedOut && !transportCleanupFailed) emit({
|
|
@@ -2764,37 +3137,61 @@ function shellProfileArg(profile) {
|
|
|
2764
3137
|
return `'${profile.replace(/'/gu, "'\\''")}'`;
|
|
2765
3138
|
}
|
|
2766
3139
|
/**
|
|
2767
|
-
* The human-facing surface line for one startup failure.
|
|
2768
|
-
* protocol/
|
|
2769
|
-
*
|
|
2770
|
-
*
|
|
2771
|
-
*
|
|
2772
|
-
*
|
|
2773
|
-
* guidance.
|
|
3140
|
+
* The human-facing surface line for one startup failure. Host Typed
|
|
3141
|
+
* protocol/auth/scope refusals keep their dedicated actionable line: the code,
|
|
3142
|
+
* the untouched Host and the public daemon management commands for THIS
|
|
3143
|
+
* official Profile. A Client-local failure is classified on the Client side
|
|
3144
|
+
* and never pretends `daemon logs` contains its detail. It never includes the
|
|
3145
|
+
* registry PID, the launch URL/token or a private profile path.
|
|
2774
3146
|
*/
|
|
2775
|
-
function surfaceStartupFailureLine(error, profile) {
|
|
3147
|
+
function surfaceStartupFailureLine(error, profile, phase = "client-assembly") {
|
|
2776
3148
|
const daemon = (verb) => `dsh --profile ${shellProfileArg(profile)} daemon ${verb}`;
|
|
2777
|
-
if (error
|
|
3149
|
+
if (isLocalScopeErrorValue(error)) {
|
|
2778
3150
|
if (error.code === "HOST_PROTOCOL_INCOMPATIBLE") return `HOST_PROTOCOL_INCOMPATIBLE: Another live local Host for this profile uses a different local protocol or DSH runtime. The Host has not been stopped or replaced. Inspect it with: ${daemon("status")}; read its logs with: ${daemon("logs")}. If you decide this Profile service is yours to recover, run: ${daemon("restart")}. Recovery is not guaranteed; Automatic upgrade and migration of in-memory work are not supported.`;
|
|
2779
3151
|
return `split client surface: cannot establish the local Host (${error.code}); the Host was not stopped. Inspect it with: ${daemon("status")}; read its logs with: ${daemon("logs")}. If you choose to recover, run: ${daemon("restart")}; recovery is not guaranteed.`;
|
|
2780
3152
|
}
|
|
2781
|
-
return `split client surface: ${controlledSurfaceReason(error,
|
|
3153
|
+
return `split client surface: ${controlledSurfaceReason(error, phase)}`;
|
|
3154
|
+
}
|
|
3155
|
+
/**
|
|
3156
|
+
* The ONE pure Client-local terminal summary. A missing Client module names
|
|
3157
|
+
* only the safely extracted specifier and points at reinstalling the TUI
|
|
3158
|
+
* plugin; every other failure stays a fixed controlled reason and never
|
|
3159
|
+
* suggests a Host restart, because the Host is not the failing component.
|
|
3160
|
+
*/
|
|
3161
|
+
function controlledSurfaceReason(error, phase) {
|
|
3162
|
+
if (clientFatalKind(error, phase) === "CLIENT_MODULE_MISSING") return `CLIENT_MODULE_MISSING: required Client module ${clientModuleSpecifier(error) ?? "unknown"} was not found; reinstall the TUI plugin with the supported DSH version. The Host was not stopped.`;
|
|
3163
|
+
if (phase === "client-runtime") return "CLIENT_RUNTIME_FAILED: the Client terminated unexpectedly. The Host was not stopped.";
|
|
3164
|
+
const entryPrefix = "local client entry: ";
|
|
3165
|
+
let raw;
|
|
3166
|
+
try {
|
|
3167
|
+
raw = isErrorValue(error) ? error.message : String(error);
|
|
3168
|
+
} catch {
|
|
3169
|
+
raw = "";
|
|
3170
|
+
}
|
|
3171
|
+
if (raw.startsWith(entryPrefix)) return `CLIENT_STARTUP_FAILED: ${sanitizeSurfaceText(raw.slice(20))}. The Host was not stopped.`;
|
|
3172
|
+
return "CLIENT_STARTUP_FAILED: startup failed before the TUI mounted. The Host was not stopped.";
|
|
3173
|
+
}
|
|
3174
|
+
/**
|
|
3175
|
+
* The ONE surface fatal reporter: build the pure terminal summary, append the
|
|
3176
|
+
* terminal-safe private-file locator, and write exactly one Client artifact.
|
|
3177
|
+
* Used only at the three real fatal entry points (outer catch, body catch and
|
|
3178
|
+
* the stop coordinator), never from an ordinary pure-function test path.
|
|
3179
|
+
*/
|
|
3180
|
+
function reportSurfaceClientFatal(failure, profile, phase, isHandoff, env, primary = failure) {
|
|
3181
|
+
return `${isHandoff ? handoffStartupFailureLine(failure) : surfaceStartupFailureLine(failure, profile, phase)} ${clientDiagnosticLocation(writeClientFatalDiagnostic(primary, phase, env))}`;
|
|
2782
3182
|
}
|
|
2783
3183
|
/**
|
|
2784
|
-
* The
|
|
2785
|
-
*
|
|
2786
|
-
*
|
|
2787
|
-
* in the controlled Client/Host log; the TTY never receives a raw error, a path
|
|
2788
|
-
* or a Host launch URL.
|
|
3184
|
+
* The stop-coordinator report entry: merge its collected cleanup causes into
|
|
3185
|
+
* the ONE artifact primary while the terminal classification stays on the
|
|
3186
|
+
* original failure.
|
|
2789
3187
|
*/
|
|
2790
|
-
function
|
|
2791
|
-
|
|
2792
|
-
if (raw.startsWith("local client entry: ")) return `${sanitizeSurfaceText(raw.slice(20))} The Host was not stopped. Inspect with: ${daemon("status")} and ${daemon("logs")}; if you choose to recover, run ${daemon("restart")} (not guaranteed).`;
|
|
2793
|
-
return `startup failed before the TUI mounted; see the Host log for detail. The Host was not stopped. Inspect with: ${daemon("status")} and ${daemon("logs")}; if you choose to recover, run ${daemon("restart")} (not guaranteed).`;
|
|
3188
|
+
function reportStopClientFatal(failure, profile, phase, isHandoff, env, cleanupErrors) {
|
|
3189
|
+
return reportSurfaceClientFatal(failure, profile, phase, isHandoff, env, clientFatalPrimaryWithCleanup(failure, cleanupErrors));
|
|
2794
3190
|
}
|
|
2795
|
-
/** Strip control characters, URLs and absolute paths; bound the length. */
|
|
3191
|
+
/** Strip control characters, known credential carriers, URLs and absolute paths; bound the length. */
|
|
2796
3192
|
function sanitizeSurfaceText(text) {
|
|
2797
|
-
let out = text.replace(
|
|
3193
|
+
let out = text.replace(/\b(Authorization|Cookie|Set-Cookie)\s*:\s*[^\r\n]*/giu, "$1: <redacted>").replace(/([?&](?:token|access_token|cookie)=)[^&#\s]+/giu, "$1<redacted>").replace(/\b(token|access_token|password)\s*=\s*(?:\\?"(?:\\.|[^"\\])*\\?"|\\?'(?:\\.|[^'\\])*\\?'|[^\s&;,]+)/giu, "$1=<redacted>");
|
|
3194
|
+
out = out.replace(/[\u0000-\u001f\u007f]/gu, " ");
|
|
2798
3195
|
out = out.replace(/[a-zA-Z][a-zA-Z0-9+.-]*:\/\/[^\s'"]+/gu, "<url>");
|
|
2799
3196
|
out = out.replace(/(?:\/[\w.@+-]+){2,}\/?/gu, "<path>");
|
|
2800
3197
|
out = out.replace(/\s+/gu, " ").trim().slice(0, 200);
|
|
@@ -2812,12 +3209,12 @@ function sanitizeSurfaceText(text) {
|
|
|
2812
3209
|
*/
|
|
2813
3210
|
function handoffStartupFailureLine(error) {
|
|
2814
3211
|
let reason;
|
|
2815
|
-
if (error
|
|
3212
|
+
if (isLocalScopeErrorValue(error)) {
|
|
2816
3213
|
if (error.code === "HOST_HANDOFF_UNAVAILABLE") reason = "the expected Host is no longer available";
|
|
2817
3214
|
else if (error.code === "HOST_IDENTITY_MISMATCH") reason = "the live local Host is not the expected instance";
|
|
2818
3215
|
else if (error.code === "HOST_PROTOCOL_INCOMPATIBLE") reason = "the expected Host uses a different local protocol or DSH runtime";
|
|
2819
3216
|
else reason = "the expected Host could not be authenticated";
|
|
2820
|
-
} else if (error
|
|
3217
|
+
} else if (isErrorValue(error) && (error.message.startsWith("local client entry: ") || error.message.startsWith("local client reexec: "))) reason = sanitizeSurfaceText(error.message.slice(error.message.indexOf(": ") + 2));
|
|
2821
3218
|
else reason = "the replacement Client could not restore the expected Host and Session";
|
|
2822
3219
|
return `Client handoff failed: ${reason}. The Host was not stopped or replaced. Start a compatible Client manually to continue.`;
|
|
2823
3220
|
}
|
|
@@ -2856,10 +3253,10 @@ if (import.meta.main) try {
|
|
|
2856
3253
|
};
|
|
2857
3254
|
if (process.env.SPLIT_PROCESS_CLIENT_MODE === "surface") {
|
|
2858
3255
|
const handoff = process.env.SPLIT_PROCESS_CLIENT_EXPECTED_INSTANCE_ID;
|
|
2859
|
-
const line =
|
|
3256
|
+
const line = reportSurfaceClientFatal(error, process.env.SPLIT_PROCESS_PROFILE ?? "pi-tui", "pre-entry", handoff !== void 0 && handoff !== "", process.env);
|
|
2860
3257
|
process.stderr.write(`${line}\n`);
|
|
2861
3258
|
} else writeEntryRecord(record);
|
|
2862
3259
|
process.exit(1);
|
|
2863
3260
|
}
|
|
2864
3261
|
//#endregion
|
|
2865
|
-
export { ClientReexecRefusal, INTERACTION_STARTUP_GATE, assertHandoffRestored, assertHandoffSignalExclusivity, assertInteractionStartupReady, createClientReexecChildEnvironment, createClientReexecRequestHandler, createInteractionStartupGate, decodeClientLaunchEnvelope, expectedHostInstanceFromEnvironment, finishClientEntryShutdown, handoffStartupFailureLine, inspectClientReexecTarget, prepareClientReexec, resolveProfileInstalledClientTarget, routeReexecTermination, runLocalClientEntry, sanitizeSurfaceText, stopLocalClient, surfaceStartupFacts, surfaceStartupFailureLine };
|
|
3262
|
+
export { ClientReexecRefusal, INTERACTION_STARTUP_GATE, assertHandoffRestored, assertHandoffSignalExclusivity, assertInteractionStartupReady, clientFatalPrimaryWithCleanup, createClientReexecChildEnvironment, createClientReexecRequestHandler, createInteractionStartupGate, decodeClientLaunchEnvelope, expectedHostInstanceFromEnvironment, finishClientEntryShutdown, handoffStartupFailureLine, inspectClientReexecTarget, prepareClientReexec, reportStopClientFatal, reportSurfaceClientFatal, resolveProfileInstalledClientTarget, routeReexecTermination, runLocalClientEntry, sanitizeSurfaceText, stopLocalClient, surfaceStartupFacts, surfaceStartupFailureLine };
|
|
@@ -1,11 +1,14 @@
|
|
|
1
|
-
import { D as sameKernelProcess, S as scopeFromInstalledProfile, T as readKernelProcess, _ as darwinHostProfileSeatDir, h as bindProcessSeat, m as bindDarwinKernelSeat, p as LocalScopeError, v as inspectInstalledProfileScope, x as readLinuxStarttime } from "./daemon-launcher-
|
|
1
|
+
import { D as sameKernelProcess, S as scopeFromInstalledProfile, T as readKernelProcess, _ as darwinHostProfileSeatDir, h as bindProcessSeat, m as bindDarwinKernelSeat, p as LocalScopeError, v as inspectInstalledProfileScope, x as readLinuxStarttime } from "./daemon-launcher-Dult7Jxv.mjs";
|
|
2
2
|
import { i as parsePiTuiAcpAccessStatus } from "./pi-tui-acp-access-contract-BdLwduU6.mjs";
|
|
3
|
-
import { C as prepareOwnedLaunchdForCurrentInstall, S as launchdServiceMatches, T as uninstallLaunchdUnit, _ as uninstallOwnedProfileUnit, a as inspectHostProcess, b as installLaunchdUnit, c as collectUnitFacts, d as prepareOwnedProfileUnitForCurrentInstall, f as profileIdentityDigest, g as stopOwnedProfileUnit, h as selectRuntimeDir, i as ensureLocalHost, l as inspectOwnedProfileUnit, m as runSystemctl, n as assertRecordedHostKernelIdentityCurrent, o as readLocalRecord, p as queryOwnedProfileUnit, r as authenticateLocalHost, t as assertClientHostCompatible, u as installProfileHostUnit, v as inspectLaunchdService, w as stopLaunchdService, x as launchdLogPaths, y as inspectOwnedLaunchdUnit } from "./local-discovery-
|
|
3
|
+
import { C as prepareOwnedLaunchdForCurrentInstall, S as launchdServiceMatches, T as uninstallLaunchdUnit, _ as uninstallOwnedProfileUnit, a as inspectHostProcess, b as installLaunchdUnit, c as collectUnitFacts, d as prepareOwnedProfileUnitForCurrentInstall, f as profileIdentityDigest, g as stopOwnedProfileUnit, h as selectRuntimeDir, i as ensureLocalHost, l as inspectOwnedProfileUnit, m as runSystemctl, n as assertRecordedHostKernelIdentityCurrent, o as readLocalRecord, p as queryOwnedProfileUnit, r as authenticateLocalHost, t as assertClientHostCompatible, u as installProfileHostUnit, v as inspectLaunchdService, w as stopLaunchdService, x as launchdLogPaths, y as inspectOwnedLaunchdUnit } from "./local-discovery-uOBfFq5j.mjs";
|
|
4
4
|
import { closeSync, constants, existsSync, fstatSync, lstatSync, openSync, readFileSync, readSync, realpathSync } from "node:fs";
|
|
5
5
|
import { dirname, join } from "node:path";
|
|
6
|
+
import "node:crypto";
|
|
6
7
|
import { spawn } from "node:child_process";
|
|
7
8
|
import "node:net";
|
|
8
9
|
import "@agentclientprotocol/sdk";
|
|
10
|
+
JSON.stringify(["unset"]);
|
|
11
|
+
//#endregion
|
|
9
12
|
//#region src/app/remote-process/local-acp-listener.ts
|
|
10
13
|
/** The logical socket file name inside the 0700 scope directory. */
|
|
11
14
|
const SOCKET_FILE = "acp.sock";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { a as bindProcessSeat, c as darwinHostProfileSeatDir, f as readLinuxStarttime, h as scopeFromInstalledProfile, i as bindDarwinKernelSeat, l as inspectInstalledProfileScope, n as LocalScopeError, x as sameKernelProcess, y as readKernelProcess } from "./local-scope-
|
|
2
|
-
import {
|
|
3
|
-
import { A as launchdLogPaths, C as runSystemctl, D as inspectLaunchdService, E as uninstallOwnedProfileUnit, M as prepareOwnedLaunchdForCurrentInstall, N as stopLaunchdService, O as inspectOwnedLaunchdUnit, P as uninstallLaunchdUnit, S as queryOwnedProfileUnit, T as stopOwnedProfileUnit, _ as collectUnitFacts, b as prepareOwnedProfileUnitForCurrentInstall, c as ensureLocalHost, i as authenticateLocalHost, j as launchdServiceMatches, k as installLaunchdUnit, l as inspectHostProcess, p as readLocalRecord, r as assertRecordedHostKernelIdentityCurrent, t as assertClientHostCompatible, v as inspectOwnedProfileUnit, w as selectRuntimeDir, x as profileIdentityDigest, y as installProfileHostUnit } from "./local-discovery-
|
|
1
|
+
import { a as bindProcessSeat, c as darwinHostProfileSeatDir, f as readLinuxStarttime, h as scopeFromInstalledProfile, i as bindDarwinKernelSeat, l as inspectInstalledProfileScope, n as LocalScopeError, x as sameKernelProcess, y as readKernelProcess } from "./local-scope-DamiMqPd.mjs";
|
|
2
|
+
import { n as darwinAcpSocketPaths, u as observeAuthenticatedLocalAcpStatus } from "./local-acp-listener-B65J0Bx4.mjs";
|
|
3
|
+
import { A as launchdLogPaths, C as runSystemctl, D as inspectLaunchdService, E as uninstallOwnedProfileUnit, M as prepareOwnedLaunchdForCurrentInstall, N as stopLaunchdService, O as inspectOwnedLaunchdUnit, P as uninstallLaunchdUnit, S as queryOwnedProfileUnit, T as stopOwnedProfileUnit, _ as collectUnitFacts, b as prepareOwnedProfileUnitForCurrentInstall, c as ensureLocalHost, i as authenticateLocalHost, j as launchdServiceMatches, k as installLaunchdUnit, l as inspectHostProcess, p as readLocalRecord, r as assertRecordedHostKernelIdentityCurrent, t as assertClientHostCompatible, v as inspectOwnedProfileUnit, w as selectRuntimeDir, x as profileIdentityDigest, y as installProfileHostUnit } from "./local-discovery-DOSsCh9q.mjs";
|
|
4
4
|
import { closeSync, constants, existsSync, fstatSync, lstatSync, openSync, readFileSync, readSync, realpathSync } from "node:fs";
|
|
5
5
|
import { dirname, join } from "node:path";
|
|
6
6
|
import { spawn } from "node:child_process";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { _ as parseProcessStat, b as readProcessStarttime, d as readInstalledDshVersion, f as readLinuxStarttime, n as LocalScopeError, s as computeBuildId, u as installedPackageRootFromEntry, x as sameKernelProcess, y as readKernelProcess } from "./local-scope-
|
|
1
|
+
import { _ as parseProcessStat, b as readProcessStarttime, d as readInstalledDshVersion, f as readLinuxStarttime, n as LocalScopeError, s as computeBuildId, u as installedPackageRootFromEntry, x as sameKernelProcess, y as readKernelProcess } from "./local-scope-DamiMqPd.mjs";
|
|
2
2
|
import { createHash, randomUUID } from "node:crypto";
|
|
3
3
|
import { accessSync, closeSync, constants, existsSync, fchmodSync, fstatSync, fsyncSync, linkSync, lstatSync, mkdirSync, openSync, readFileSync, realpathSync, renameSync, statSync, unlinkSync, writeFileSync, writeSync } from "node:fs";
|
|
4
4
|
import { basename, dirname, isAbsolute, join } from "node:path";
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { g as writeLocalRecord, h as writeLaunchMaterial } from "./local-discovery-
|
|
1
|
+
import { g as writeLocalRecord, h as writeLaunchMaterial } from "./local-discovery-DOSsCh9q.mjs";
|
|
2
2
|
export { writeLaunchMaterial, writeLocalRecord };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { D as sameKernelProcess, E as readProcessStarttime, T as readKernelProcess, b as readInstalledDshVersion, g as computeBuildId, p as LocalScopeError, w as parseProcessStat, y as installedPackageRootFromEntry } from "./daemon-launcher-
|
|
1
|
+
import { D as sameKernelProcess, E as readProcessStarttime, T as readKernelProcess, b as readInstalledDshVersion, g as computeBuildId, p as LocalScopeError, w as parseProcessStat, y as installedPackageRootFromEntry } from "./daemon-launcher-Dult7Jxv.mjs";
|
|
2
2
|
import { accessSync, closeSync, constants, existsSync, fchmodSync, fstatSync, fsyncSync, linkSync, lstatSync, mkdirSync, openSync, readFileSync, realpathSync, renameSync, statSync, unlinkSync, writeSync } from "node:fs";
|
|
3
3
|
import { userInfo } from "node:os";
|
|
4
4
|
import { basename, dirname, isAbsolute, join } from "node:path";
|