@cydm/pie 4.12.0 → 4.12.2
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/dist/builtin/extensions/im-forward/index.js +40 -15
- package/dist/builtin/extensions/pie-proc/index.js +2 -2
- package/dist/builtin/skills/chrome-devtools-axi/SKILL.md +15 -6
- package/dist/builtin/skills/chrome-devtools-axi/chrome-devtools-axi-bridge.js +163 -14
- package/dist/builtin/skills/chrome-devtools-axi/chrome-devtools-axi-runtime.js +1 -1
- package/dist/builtin/skills/chrome-devtools-axi/chunk-NL3FSRAW.js +1575 -0
- package/dist/builtin/skills/chrome-devtools-axi/{cli-K7ESY3XD.js → cli-QAJYAXI4.js} +98 -109
- package/dist/builtin/skills/computer-use-axi/SKILL.md +11 -7
- package/dist/builtin/skills/computer-use-axi/computer-use-axi-broker.js +43 -17
- package/dist/chunks/chunk-Q4NJEPIZ.js +210 -0
- package/dist/chunks/{chunk-322WLBDY.js → chunk-Q5PSWX3B.js} +3 -3
- package/dist/chunks/{chunk-6U6UGM4C.js → chunk-Y6AVNVOD.js} +31 -1
- package/dist/chunks/chunk-ZB5FVHI7.js +618 -0
- package/dist/chunks/{manager-cli-B6GIYTI7.js → manager-cli-OTIMAWO6.js} +246 -287
- package/dist/chunks/{manager-upgrade-WHER3WTJ.js → manager-upgrade-DYRQ7YZ5.js} +70 -213
- package/dist/cli.js +3 -3
- package/package.json +1 -1
- package/dist/builtin/skills/chrome-devtools-axi/chunk-HAUDUMDO.js +0 -795
- package/dist/chunks/chunk-BSITHT43.js +0 -127
|
@@ -0,0 +1,1575 @@
|
|
|
1
|
+
import { createRequire as __axiRequire } from "node:module"; const require = __axiRequire(import.meta.url);
|
|
2
|
+
|
|
3
|
+
// vendor/chrome-devtools-axi/src/pages.ts
|
|
4
|
+
var PAGE_SCOPED_TOOLS = /* @__PURE__ */ new Set([
|
|
5
|
+
"click",
|
|
6
|
+
"drag",
|
|
7
|
+
"emulate",
|
|
8
|
+
"evaluate_script",
|
|
9
|
+
"fill",
|
|
10
|
+
"fill_form",
|
|
11
|
+
"get_console_message",
|
|
12
|
+
"get_network_request",
|
|
13
|
+
"handle_dialog",
|
|
14
|
+
"hover",
|
|
15
|
+
"lighthouse_audit",
|
|
16
|
+
"list_console_messages",
|
|
17
|
+
"list_network_requests",
|
|
18
|
+
"navigate_page",
|
|
19
|
+
"performance_analyze_insight",
|
|
20
|
+
"performance_start_trace",
|
|
21
|
+
"performance_stop_trace",
|
|
22
|
+
"press_key",
|
|
23
|
+
"resize_page",
|
|
24
|
+
"take_heapsnapshot",
|
|
25
|
+
"take_screenshot",
|
|
26
|
+
"take_snapshot",
|
|
27
|
+
"type_text",
|
|
28
|
+
"upload_file",
|
|
29
|
+
"wait_for"
|
|
30
|
+
]);
|
|
31
|
+
function needsPageId(name, args = {}) {
|
|
32
|
+
if (typeof args.pageId === "number") return false;
|
|
33
|
+
if (name === "evaluate_script" && typeof args.serviceWorkerId === "string" && args.serviceWorkerId.length > 0) {
|
|
34
|
+
return false;
|
|
35
|
+
}
|
|
36
|
+
return PAGE_SCOPED_TOOLS.has(name);
|
|
37
|
+
}
|
|
38
|
+
var GENERIC_SCHEME_SLASH_URL = /^[a-z][a-z0-9+.-]*:\/\//i;
|
|
39
|
+
var COLON_ONLY_SCHEME_URL = /^(?:about:|data:|view-source:|blob:)/i;
|
|
40
|
+
function isPageSchemeUrl(label) {
|
|
41
|
+
return GENERIC_SCHEME_SLASH_URL.test(label) || COLON_ONLY_SCHEME_URL.test(label);
|
|
42
|
+
}
|
|
43
|
+
var MCP_SECTION_HEADER = /^##\s+(Pages|Extension Pages|Extension Service Workers|Third-party developer tools|WebMCP tools)$/;
|
|
44
|
+
var PAGE_ID_LINE = /^\d+:(?:\s+|$)/;
|
|
45
|
+
var OPEN_DIALOG_HEADER = /^# Open dialog$/;
|
|
46
|
+
var HANDLE_DIALOG_FOOTER = /^Call handle_dialog to handle it before continuing\.$/;
|
|
47
|
+
function stripTrailingIsolatedContext(label) {
|
|
48
|
+
const match = label.match(/^(.*)\s+isolatedContext=.*$/);
|
|
49
|
+
if (!match) return label;
|
|
50
|
+
const before = match[1];
|
|
51
|
+
const withoutSelected = before.replace(/\s*\[selected\]\s*$/, "").trimEnd();
|
|
52
|
+
if (matchTrailingUrl(withoutSelected) !== null) return before;
|
|
53
|
+
if (isPageSchemeUrl(withoutSelected)) return before;
|
|
54
|
+
return label;
|
|
55
|
+
}
|
|
56
|
+
function stripPageSuffixes(rest) {
|
|
57
|
+
let label = stripTrailingIsolatedContext(rest);
|
|
58
|
+
if (/(?:^|\s)\[selected\]\s*$/.test(label)) {
|
|
59
|
+
label = label.replace(/\s*\[selected\]\s*$/, "").trimEnd();
|
|
60
|
+
}
|
|
61
|
+
return label;
|
|
62
|
+
}
|
|
63
|
+
function matchTrailingUrl(label) {
|
|
64
|
+
const trimmed = label.trimEnd();
|
|
65
|
+
if (!trimmed.endsWith(")")) return null;
|
|
66
|
+
const close = trimmed.length - 1;
|
|
67
|
+
let from = close;
|
|
68
|
+
while (from > 0) {
|
|
69
|
+
const open = trimmed.lastIndexOf(" (", from - 1);
|
|
70
|
+
if (open === -1) return null;
|
|
71
|
+
const url = trimmed.slice(open + 2, close);
|
|
72
|
+
if (isPageSchemeUrl(url)) {
|
|
73
|
+
return { title: trimmed.slice(0, open), url };
|
|
74
|
+
}
|
|
75
|
+
from = open;
|
|
76
|
+
}
|
|
77
|
+
return null;
|
|
78
|
+
}
|
|
79
|
+
function hasSchemeUrl(label) {
|
|
80
|
+
const rest = stripPageSuffixes(label);
|
|
81
|
+
return matchTrailingUrl(rest) !== null || isPageSchemeUrl(rest);
|
|
82
|
+
}
|
|
83
|
+
function isCompletePageRow(row) {
|
|
84
|
+
return hasSchemeUrl(row.replace(/^\d+:\s*/, ""));
|
|
85
|
+
}
|
|
86
|
+
function isTitleContinuationLine(line) {
|
|
87
|
+
const m = line.match(/^(\d+):\s+(.+)$/);
|
|
88
|
+
if (!m) return false;
|
|
89
|
+
const rest = stripPageSuffixes(m[2]);
|
|
90
|
+
if (matchTrailingUrl(rest) !== null) return false;
|
|
91
|
+
if (isPageSchemeUrl(rest)) return false;
|
|
92
|
+
return /(?:^|\s)\[selected\]\s*$/.test(stripTrailingIsolatedContext(m[2]));
|
|
93
|
+
}
|
|
94
|
+
function extractPageUrl(label) {
|
|
95
|
+
const match = matchTrailingUrl(label);
|
|
96
|
+
return match ? match.url : label.trim();
|
|
97
|
+
}
|
|
98
|
+
function pageRowRest(row) {
|
|
99
|
+
return stripPageSuffixes(row.replace(/^\d+:\s*/, ""));
|
|
100
|
+
}
|
|
101
|
+
function stripDialogPreamble(text) {
|
|
102
|
+
const lines = text.split(/\r?\n/);
|
|
103
|
+
const kept = [];
|
|
104
|
+
for (let i = 0; i < lines.length; ) {
|
|
105
|
+
if (OPEN_DIALOG_HEADER.test(lines[i].trim())) {
|
|
106
|
+
let end = -1;
|
|
107
|
+
for (let idx = i + 1; idx < lines.length; idx++) {
|
|
108
|
+
if (HANDLE_DIALOG_FOOTER.test(lines[idx].trim())) end = idx;
|
|
109
|
+
}
|
|
110
|
+
if (end !== -1) {
|
|
111
|
+
i = end + 1;
|
|
112
|
+
continue;
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
kept.push(lines[i]);
|
|
116
|
+
i++;
|
|
117
|
+
}
|
|
118
|
+
return kept.join("\n");
|
|
119
|
+
}
|
|
120
|
+
function followingLinesCompleteTitle(rawLines, headerIndex, currentRow) {
|
|
121
|
+
let acc = `${currentRow} ## Pages`;
|
|
122
|
+
for (let i = headerIndex + 1; i < rawLines.length; i++) {
|
|
123
|
+
const next = rawLines[i].trim();
|
|
124
|
+
if (next.length === 0) continue;
|
|
125
|
+
if (next.match(MCP_SECTION_HEADER) !== null) return false;
|
|
126
|
+
if (PAGE_ID_LINE.test(next)) {
|
|
127
|
+
const rest = stripPageSuffixes(next.replace(/^\d+:\s*/, ""));
|
|
128
|
+
if (isPageSchemeUrl(rest) && matchTrailingUrl(rest) === null) {
|
|
129
|
+
return false;
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
acc += ` ${next}`;
|
|
133
|
+
if (matchTrailingUrl(pageRowRest(acc)) !== null) return true;
|
|
134
|
+
}
|
|
135
|
+
return false;
|
|
136
|
+
}
|
|
137
|
+
function collapsePageRows(text) {
|
|
138
|
+
const rows = [];
|
|
139
|
+
let inPageBlock = false;
|
|
140
|
+
const rawLines = stripDialogPreamble(text).split(/\r?\n/);
|
|
141
|
+
for (let index = 0; index < rawLines.length; index++) {
|
|
142
|
+
const line = rawLines[index].trim();
|
|
143
|
+
if (line.length === 0) continue;
|
|
144
|
+
const section = line.match(MCP_SECTION_HEADER)?.[1];
|
|
145
|
+
if (section !== void 0) {
|
|
146
|
+
const prev = rows[rows.length - 1];
|
|
147
|
+
if (section === "Pages" && inPageBlock && prev !== void 0 && !isCompletePageRow(prev) && followingLinesCompleteTitle(rawLines, index, prev)) {
|
|
148
|
+
rows[rows.length - 1] += ` ${line}`;
|
|
149
|
+
continue;
|
|
150
|
+
}
|
|
151
|
+
if (section === "Pages") {
|
|
152
|
+
rows.length = 0;
|
|
153
|
+
inPageBlock = true;
|
|
154
|
+
} else if (section === "Extension Pages") {
|
|
155
|
+
inPageBlock = true;
|
|
156
|
+
} else {
|
|
157
|
+
inPageBlock = false;
|
|
158
|
+
}
|
|
159
|
+
continue;
|
|
160
|
+
}
|
|
161
|
+
if (!inPageBlock) continue;
|
|
162
|
+
if (PAGE_ID_LINE.test(line)) {
|
|
163
|
+
const prev = rows[rows.length - 1];
|
|
164
|
+
if (prev !== void 0 && (!isCompletePageRow(prev) || isTitleContinuationLine(line))) {
|
|
165
|
+
rows[rows.length - 1] += ` ${line}`;
|
|
166
|
+
} else {
|
|
167
|
+
rows.push(line);
|
|
168
|
+
}
|
|
169
|
+
continue;
|
|
170
|
+
}
|
|
171
|
+
if (rows.length > 0) {
|
|
172
|
+
rows[rows.length - 1] += ` ${line}`;
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
return rows.map((row) => row.replace(/\s+/g, " "));
|
|
176
|
+
}
|
|
177
|
+
function parsePagesList(text) {
|
|
178
|
+
const pages = [];
|
|
179
|
+
for (const line of collapsePageRows(text)) {
|
|
180
|
+
const m = line.match(/^(\d+):\s+(.+)$/);
|
|
181
|
+
if (!m) continue;
|
|
182
|
+
const id = Number.parseInt(m[1], 10);
|
|
183
|
+
let rest = stripTrailingIsolatedContext(m[2]);
|
|
184
|
+
const selected = /(?:^|\s)\[selected\]\s*$/.test(rest);
|
|
185
|
+
if (selected) {
|
|
186
|
+
rest = rest.replace(/\s*\[selected\]\s*$/, "").trimEnd();
|
|
187
|
+
}
|
|
188
|
+
const url = extractPageUrl(rest);
|
|
189
|
+
pages.push({ id, url, selected });
|
|
190
|
+
}
|
|
191
|
+
return pages;
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
// vendor/chrome-devtools-axi/src/selected-page.ts
|
|
195
|
+
import {
|
|
196
|
+
existsSync as existsSync2,
|
|
197
|
+
mkdirSync as mkdirSync2,
|
|
198
|
+
readFileSync as readFileSync2,
|
|
199
|
+
unlinkSync as unlinkSync2,
|
|
200
|
+
writeFileSync as writeFileSync2
|
|
201
|
+
} from "node:fs";
|
|
202
|
+
import { dirname as dirname2, join as join2 } from "node:path";
|
|
203
|
+
|
|
204
|
+
// vendor/chrome-devtools-axi/src/sessions.ts
|
|
205
|
+
import { createHash, randomBytes, randomUUID } from "node:crypto";
|
|
206
|
+
import {
|
|
207
|
+
existsSync,
|
|
208
|
+
linkSync,
|
|
209
|
+
lstatSync,
|
|
210
|
+
mkdirSync,
|
|
211
|
+
readdirSync,
|
|
212
|
+
readFileSync,
|
|
213
|
+
realpathSync,
|
|
214
|
+
rmSync,
|
|
215
|
+
unlinkSync,
|
|
216
|
+
writeFileSync
|
|
217
|
+
} from "node:fs";
|
|
218
|
+
import { dirname, join, resolve } from "node:path";
|
|
219
|
+
import { homedir } from "node:os";
|
|
220
|
+
|
|
221
|
+
// vendor/chrome-devtools-axi/src/process-identity.ts
|
|
222
|
+
import { execFileSync } from "node:child_process";
|
|
223
|
+
function inspectProcessIdentity(pid) {
|
|
224
|
+
if (!Number.isInteger(pid) || pid <= 0) return {};
|
|
225
|
+
if (process.platform === "win32") {
|
|
226
|
+
try {
|
|
227
|
+
const output = execFileSync(
|
|
228
|
+
"powershell",
|
|
229
|
+
[
|
|
230
|
+
"-NoProfile",
|
|
231
|
+
"-NonInteractive",
|
|
232
|
+
"-Command",
|
|
233
|
+
`$p = Get-CimInstance Win32_Process -Filter "ProcessId=<pid>"; if ($p) { $p.CommandLine; $p.CreationDate.ToString('o') }`.replace("<pid>", String(pid))
|
|
234
|
+
],
|
|
235
|
+
// Cold PowerShell+CIM startup can exceed four seconds on Windows,
|
|
236
|
+
// even for an owned live child. Keep a finite query budget without
|
|
237
|
+
// treating an unreadable identity as permission to signal that pid.
|
|
238
|
+
{ encoding: "utf-8", timeout: 1e4, windowsHide: true }
|
|
239
|
+
);
|
|
240
|
+
const lines = output.split(/\r?\n/).filter((line) => line.length > 0);
|
|
241
|
+
if (lines.length === 0) return {};
|
|
242
|
+
const startTime = lines.length >= 2 ? lines[lines.length - 1] : void 0;
|
|
243
|
+
return { command: lines.slice(0, lines.length - 1).join("\n"), startTime };
|
|
244
|
+
} catch {
|
|
245
|
+
return {};
|
|
246
|
+
}
|
|
247
|
+
}
|
|
248
|
+
try {
|
|
249
|
+
const psEnv = { ...process.env, LC_ALL: "C", LANG: "C", TZ: "UTC0" };
|
|
250
|
+
const output = execFileSync(
|
|
251
|
+
"ps",
|
|
252
|
+
["-p", String(pid), "-o", "lstart=", "-o", "command="],
|
|
253
|
+
{ encoding: "utf-8", timeout: 1e3, env: psEnv }
|
|
254
|
+
);
|
|
255
|
+
const firstNewline = output.indexOf("\n");
|
|
256
|
+
const firstLine = firstNewline === -1 ? output : output.slice(0, firstNewline);
|
|
257
|
+
const lstart = /^(?:Mon|Tue|Wed|Thu|Fri|Sat|Sun)\s+(?:Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)\s+\d{1,2}\s+\d{1,2}:\d{2}:\d{2}\s+\d{4}\s+/.exec(firstLine);
|
|
258
|
+
if (lstart) {
|
|
259
|
+
return { startTime: lstart[0].trimEnd(), command: output.slice(lstart[0].length) };
|
|
260
|
+
}
|
|
261
|
+
try {
|
|
262
|
+
const command = execFileSync("ps", ["-p", String(pid), "-o", "command="], {
|
|
263
|
+
encoding: "utf-8",
|
|
264
|
+
timeout: 1e3,
|
|
265
|
+
env: psEnv
|
|
266
|
+
});
|
|
267
|
+
return { command };
|
|
268
|
+
} catch {
|
|
269
|
+
return {};
|
|
270
|
+
}
|
|
271
|
+
} catch {
|
|
272
|
+
return {};
|
|
273
|
+
}
|
|
274
|
+
}
|
|
275
|
+
function readProcessStartTime(pid) {
|
|
276
|
+
return inspectProcessIdentity(pid).startTime;
|
|
277
|
+
}
|
|
278
|
+
function readSelfStartTime() {
|
|
279
|
+
return readProcessStartTime(process.pid);
|
|
280
|
+
}
|
|
281
|
+
|
|
282
|
+
// vendor/chrome-devtools-axi/src/supervisor-anchor-shared.ts
|
|
283
|
+
var SUPERVISOR_PID_ENV = "PIE_SUPERVISOR_PID";
|
|
284
|
+
var SUPERVISOR_START_TIME_ENV = "PIE_SUPERVISOR_START_TIME";
|
|
285
|
+
function parseSupervisorAnchor(env = process.env) {
|
|
286
|
+
const pidText = env[SUPERVISOR_PID_ENV]?.trim();
|
|
287
|
+
if (!pidText || !/^\d+$/.test(pidText)) return void 0;
|
|
288
|
+
const pid = Number(pidText);
|
|
289
|
+
if (!Number.isSafeInteger(pid) || pid <= 0) return void 0;
|
|
290
|
+
const startTime = env[SUPERVISOR_START_TIME_ENV]?.trim();
|
|
291
|
+
return startTime ? { pid, startTime } : { pid };
|
|
292
|
+
}
|
|
293
|
+
function isSupervisorGone(anchor, readIdentity) {
|
|
294
|
+
try {
|
|
295
|
+
process.kill(anchor.pid, 0);
|
|
296
|
+
} catch (error) {
|
|
297
|
+
return error.code === "ESRCH";
|
|
298
|
+
}
|
|
299
|
+
let identity;
|
|
300
|
+
try {
|
|
301
|
+
identity = readIdentity(anchor.pid);
|
|
302
|
+
} catch {
|
|
303
|
+
return false;
|
|
304
|
+
}
|
|
305
|
+
if (identity.startTime === void 0) return false;
|
|
306
|
+
if (anchor.startTime === void 0) return false;
|
|
307
|
+
return identity.startTime !== anchor.startTime;
|
|
308
|
+
}
|
|
309
|
+
|
|
310
|
+
// vendor/chrome-devtools-axi/src/sessions.ts
|
|
311
|
+
var DEFAULT_SESSION_NAME = "default";
|
|
312
|
+
var DEFAULT_BASE_PORT = 9224;
|
|
313
|
+
var DEFAULT_SESSION_PRUNE_MAX_AGE_MS = 24 * 60 * 60 * 1e3;
|
|
314
|
+
var DEFAULT_SESSION_PRUNE_MAX_RETAINED = 64;
|
|
315
|
+
var DEFAULT_SESSION_PRUNE_SAFETY_AGE_MS = 6e4;
|
|
316
|
+
var DEFAULT_START_LOCK_FRESH_MS = 3e4;
|
|
317
|
+
var SESSION_PORT_RANGE = 1e3;
|
|
318
|
+
var STATE_DIR_NAME = ".chrome-devtools-axi";
|
|
319
|
+
function resolveSessionName() {
|
|
320
|
+
const raw = process.env.CHROME_DEVTOOLS_AXI_SESSION?.trim();
|
|
321
|
+
const name = raw && raw.length > 0 ? raw : DEFAULT_SESSION_NAME;
|
|
322
|
+
validateSessionName(name);
|
|
323
|
+
return name;
|
|
324
|
+
}
|
|
325
|
+
function validateSessionName(name) {
|
|
326
|
+
if (name === DEFAULT_SESSION_NAME) return;
|
|
327
|
+
if (!/^[A-Za-z0-9._-]{1,64}$/.test(name)) {
|
|
328
|
+
throw new Error(
|
|
329
|
+
`Invalid CHROME_DEVTOOLS_AXI_SESSION "${name}": use 1-64 chars from [A-Za-z0-9._-]`
|
|
330
|
+
);
|
|
331
|
+
}
|
|
332
|
+
if (/^\.+$/.test(name)) {
|
|
333
|
+
throw new Error(
|
|
334
|
+
`Invalid CHROME_DEVTOOLS_AXI_SESSION "${name}": a name made only of dots would collapse onto the default session's state directory`
|
|
335
|
+
);
|
|
336
|
+
}
|
|
337
|
+
}
|
|
338
|
+
function defaultPortForSession(name) {
|
|
339
|
+
if (name === DEFAULT_SESSION_NAME) return DEFAULT_BASE_PORT;
|
|
340
|
+
let hash = 2166136261;
|
|
341
|
+
for (let i = 0; i < name.length; i++) {
|
|
342
|
+
hash ^= name.charCodeAt(i);
|
|
343
|
+
hash = Math.imul(hash, 16777619);
|
|
344
|
+
}
|
|
345
|
+
return DEFAULT_BASE_PORT + Math.abs(hash) % SESSION_PORT_RANGE + 1;
|
|
346
|
+
}
|
|
347
|
+
function parseStrictPort(raw, envVarName = "CHROME_DEVTOOLS_AXI_PORT") {
|
|
348
|
+
const trimmed = raw.trim();
|
|
349
|
+
if (!/^\d+$/.test(trimmed)) {
|
|
350
|
+
throw new Error(
|
|
351
|
+
`Invalid ${envVarName} "${raw}": must be a whole integer port between 1 and 65535`
|
|
352
|
+
);
|
|
353
|
+
}
|
|
354
|
+
const parsed = Number(trimmed);
|
|
355
|
+
if (!Number.isSafeInteger(parsed) || parsed < 1 || parsed > 65535) {
|
|
356
|
+
throw new Error(
|
|
357
|
+
`Invalid ${envVarName} "${raw}": must be a whole integer port between 1 and 65535`
|
|
358
|
+
);
|
|
359
|
+
}
|
|
360
|
+
return parsed;
|
|
361
|
+
}
|
|
362
|
+
function resolveSessionAllocatedPortFile(name = resolveSessionName()) {
|
|
363
|
+
return join(resolveSessionStateDir(name), "bridge.port");
|
|
364
|
+
}
|
|
365
|
+
function readAllocatedSessionPort(name = resolveSessionName()) {
|
|
366
|
+
if (name === DEFAULT_SESSION_NAME) return null;
|
|
367
|
+
const file = resolveSessionAllocatedPortFile(name);
|
|
368
|
+
if (!existsSync(file)) return null;
|
|
369
|
+
try {
|
|
370
|
+
const raw = readFileSync(file, "utf-8").trim();
|
|
371
|
+
if (!/^\d+$/.test(raw)) return null;
|
|
372
|
+
const port = Number(raw);
|
|
373
|
+
return Number.isSafeInteger(port) && port >= 1 && port <= 65535 ? port : null;
|
|
374
|
+
} catch {
|
|
375
|
+
return null;
|
|
376
|
+
}
|
|
377
|
+
}
|
|
378
|
+
function writeAllocatedSessionPort(name, port) {
|
|
379
|
+
if (name === DEFAULT_SESSION_NAME) return;
|
|
380
|
+
const file = resolveSessionAllocatedPortFile(name);
|
|
381
|
+
mkdirSync(dirname(file), { recursive: true });
|
|
382
|
+
writeFileSync(file, `${port}
|
|
383
|
+
`, "utf-8");
|
|
384
|
+
}
|
|
385
|
+
function clearAllocatedSessionPort(name = resolveSessionName()) {
|
|
386
|
+
if (name === DEFAULT_SESSION_NAME) return;
|
|
387
|
+
const file = resolveSessionAllocatedPortFile(name);
|
|
388
|
+
try {
|
|
389
|
+
if (existsSync(file)) unlinkSync(file);
|
|
390
|
+
} catch {
|
|
391
|
+
}
|
|
392
|
+
}
|
|
393
|
+
function resolveSessionPort(name = resolveSessionName()) {
|
|
394
|
+
const explicit = process.env.CHROME_DEVTOOLS_AXI_PORT;
|
|
395
|
+
if (explicit !== void 0 && explicit.trim().length > 0) {
|
|
396
|
+
return parseStrictPort(explicit, "CHROME_DEVTOOLS_AXI_PORT");
|
|
397
|
+
}
|
|
398
|
+
return readAllocatedSessionPort(name) ?? defaultPortForSession(name);
|
|
399
|
+
}
|
|
400
|
+
function resolveSessionStateDir(name = resolveSessionName()) {
|
|
401
|
+
const base = join(homedir(), STATE_DIR_NAME);
|
|
402
|
+
return name === DEFAULT_SESSION_NAME ? base : join(base, "sessions", name);
|
|
403
|
+
}
|
|
404
|
+
function resolveSessionPidFile(name = resolveSessionName()) {
|
|
405
|
+
return join(resolveSessionStateDir(name), "bridge.pid");
|
|
406
|
+
}
|
|
407
|
+
function resolveSessionLogFile(name = resolveSessionName()) {
|
|
408
|
+
return join(resolveSessionStateDir(name), "bridge.log");
|
|
409
|
+
}
|
|
410
|
+
function resolveSessionStartLockFile(name = resolveSessionName()) {
|
|
411
|
+
if (name === DEFAULT_SESSION_NAME) {
|
|
412
|
+
return join(resolveSessionStateDir(name), "bridge.start.lock");
|
|
413
|
+
}
|
|
414
|
+
validateSessionName(name);
|
|
415
|
+
return join(homedir(), STATE_DIR_NAME, "session-locks", `${name}.lock`);
|
|
416
|
+
}
|
|
417
|
+
function validateProfileName(name) {
|
|
418
|
+
if (!/^[A-Za-z0-9._-]{1,64}$/.test(name)) {
|
|
419
|
+
throw new Error(
|
|
420
|
+
`Invalid CHROME_DEVTOOLS_AXI_PROFILE "${name}": use 1-64 chars from [A-Za-z0-9._-]`
|
|
421
|
+
);
|
|
422
|
+
}
|
|
423
|
+
if (/^\.+$/.test(name)) {
|
|
424
|
+
throw new Error(
|
|
425
|
+
`Invalid CHROME_DEVTOOLS_AXI_PROFILE "${name}": a name made only of dots is not allowed`
|
|
426
|
+
);
|
|
427
|
+
}
|
|
428
|
+
}
|
|
429
|
+
function resolveNamedProfileDir(name) {
|
|
430
|
+
const trimmed = name.trim();
|
|
431
|
+
validateProfileName(trimmed);
|
|
432
|
+
return join(homedir(), STATE_DIR_NAME, "profiles", trimmed);
|
|
433
|
+
}
|
|
434
|
+
function resolveProfileLeasesDir() {
|
|
435
|
+
return join(homedir(), STATE_DIR_NAME, "profile-leases");
|
|
436
|
+
}
|
|
437
|
+
function canonicalizeProfileDir(profileDir) {
|
|
438
|
+
const abs = resolve(profileDir);
|
|
439
|
+
const tail = [];
|
|
440
|
+
let cursor = abs;
|
|
441
|
+
while (!existsSync(cursor)) {
|
|
442
|
+
const parent = dirname(cursor);
|
|
443
|
+
if (parent === cursor) return abs;
|
|
444
|
+
tail.unshift(cursor.slice(parent.length).replace(/^[/\\]+/, ""));
|
|
445
|
+
cursor = parent;
|
|
446
|
+
}
|
|
447
|
+
try {
|
|
448
|
+
const realBase = realpathSync.native(cursor);
|
|
449
|
+
return tail.length > 0 ? join(realBase, ...tail) : realBase;
|
|
450
|
+
} catch {
|
|
451
|
+
return abs;
|
|
452
|
+
}
|
|
453
|
+
}
|
|
454
|
+
function persistentProfileLeasePath(profileDir) {
|
|
455
|
+
const normalized = canonicalizeProfileDir(profileDir);
|
|
456
|
+
const keyInput = process.platform === "win32" ? normalized.toLowerCase() : normalized;
|
|
457
|
+
const key = createHash("sha256").update(keyInput).digest("hex").slice(0, 24);
|
|
458
|
+
return join(resolveProfileLeasesDir(), `${key}.json`);
|
|
459
|
+
}
|
|
460
|
+
function readAtomicLockRecord(lockFile) {
|
|
461
|
+
try {
|
|
462
|
+
const raw = readFileSync(lockFile, "utf-8");
|
|
463
|
+
const parsed = JSON.parse(raw);
|
|
464
|
+
if (typeof parsed.pid === "number" && Number.isInteger(parsed.pid) && parsed.pid > 0 && typeof parsed.token === "string" && parsed.token.length > 0) {
|
|
465
|
+
return {
|
|
466
|
+
pid: parsed.pid,
|
|
467
|
+
...typeof parsed.startTime === "string" && parsed.startTime.length > 0 ? { startTime: parsed.startTime } : {},
|
|
468
|
+
token: parsed.token,
|
|
469
|
+
createdAt: typeof parsed.createdAt === "number" ? parsed.createdAt : 0
|
|
470
|
+
};
|
|
471
|
+
}
|
|
472
|
+
return null;
|
|
473
|
+
} catch {
|
|
474
|
+
return null;
|
|
475
|
+
}
|
|
476
|
+
}
|
|
477
|
+
function isLockRecordOwnerGone(record) {
|
|
478
|
+
return isSupervisorGone(
|
|
479
|
+
{
|
|
480
|
+
pid: record.pid,
|
|
481
|
+
...record.startTime ? { startTime: record.startTime } : {}
|
|
482
|
+
},
|
|
483
|
+
inspectProcessIdentity
|
|
484
|
+
);
|
|
485
|
+
}
|
|
486
|
+
function tryCreateCompleteLockFile(lockFile, content) {
|
|
487
|
+
mkdirSync(dirname(lockFile), { recursive: true });
|
|
488
|
+
const tmpPath = `${lockFile}.tmp-${process.pid}-${randomBytes(6).toString("hex")}`;
|
|
489
|
+
try {
|
|
490
|
+
writeFileSync(tmpPath, content, { mode: 384, encoding: "utf-8" });
|
|
491
|
+
linkSync(tmpPath, lockFile);
|
|
492
|
+
return true;
|
|
493
|
+
} catch {
|
|
494
|
+
return false;
|
|
495
|
+
} finally {
|
|
496
|
+
try {
|
|
497
|
+
unlinkSync(tmpPath);
|
|
498
|
+
} catch {
|
|
499
|
+
}
|
|
500
|
+
}
|
|
501
|
+
}
|
|
502
|
+
function reclaimDeadLockUnderGate(lockFile, expectedToken) {
|
|
503
|
+
const reclaimPath = `${lockFile}.reclaim`;
|
|
504
|
+
const reclaimToken = randomUUID();
|
|
505
|
+
const reclaimPayload = JSON.stringify({
|
|
506
|
+
pid: process.pid,
|
|
507
|
+
...readSelfStartTime() ? { startTime: readSelfStartTime() } : {},
|
|
508
|
+
token: reclaimToken,
|
|
509
|
+
createdAt: Date.now()
|
|
510
|
+
});
|
|
511
|
+
if (!tryCreateCompleteLockFile(reclaimPath, reclaimPayload)) {
|
|
512
|
+
return;
|
|
513
|
+
}
|
|
514
|
+
try {
|
|
515
|
+
const current = readAtomicLockRecord(lockFile);
|
|
516
|
+
if (current && current.token === expectedToken && isLockRecordOwnerGone(current)) {
|
|
517
|
+
try {
|
|
518
|
+
unlinkSync(lockFile);
|
|
519
|
+
} catch {
|
|
520
|
+
}
|
|
521
|
+
}
|
|
522
|
+
} finally {
|
|
523
|
+
const gate = readAtomicLockRecord(reclaimPath);
|
|
524
|
+
if (gate && gate.token === reclaimToken) {
|
|
525
|
+
try {
|
|
526
|
+
unlinkSync(reclaimPath);
|
|
527
|
+
} catch {
|
|
528
|
+
}
|
|
529
|
+
}
|
|
530
|
+
}
|
|
531
|
+
}
|
|
532
|
+
function tryAcquireAtomicLockFile(lockFile) {
|
|
533
|
+
mkdirSync(dirname(lockFile), { recursive: true });
|
|
534
|
+
const token = randomUUID();
|
|
535
|
+
const payload = JSON.stringify({
|
|
536
|
+
pid: process.pid,
|
|
537
|
+
...readSelfStartTime() ? { startTime: readSelfStartTime() } : {},
|
|
538
|
+
token,
|
|
539
|
+
createdAt: Date.now()
|
|
540
|
+
});
|
|
541
|
+
for (let attempt = 0; attempt < 2; attempt += 1) {
|
|
542
|
+
if (tryCreateCompleteLockFile(lockFile, payload)) {
|
|
543
|
+
let released = false;
|
|
544
|
+
return {
|
|
545
|
+
token,
|
|
546
|
+
release: () => {
|
|
547
|
+
if (released) return;
|
|
548
|
+
released = true;
|
|
549
|
+
const current = readAtomicLockRecord(lockFile);
|
|
550
|
+
if (current && current.token === token) {
|
|
551
|
+
try {
|
|
552
|
+
unlinkSync(lockFile);
|
|
553
|
+
} catch {
|
|
554
|
+
}
|
|
555
|
+
}
|
|
556
|
+
}
|
|
557
|
+
};
|
|
558
|
+
}
|
|
559
|
+
const existing = readAtomicLockRecord(lockFile);
|
|
560
|
+
if (!existing) {
|
|
561
|
+
return null;
|
|
562
|
+
}
|
|
563
|
+
if (isLockRecordOwnerGone(existing)) {
|
|
564
|
+
reclaimDeadLockUnderGate(lockFile, existing.token);
|
|
565
|
+
continue;
|
|
566
|
+
}
|
|
567
|
+
return null;
|
|
568
|
+
}
|
|
569
|
+
return null;
|
|
570
|
+
}
|
|
571
|
+
function isPidAliveForPrune(pid) {
|
|
572
|
+
try {
|
|
573
|
+
process.kill(pid, 0);
|
|
574
|
+
return true;
|
|
575
|
+
} catch (error) {
|
|
576
|
+
return error?.code !== "ESRCH";
|
|
577
|
+
}
|
|
578
|
+
}
|
|
579
|
+
function hasUnrecoveredPersistentLease(profileDir, bridgePid, bridgeStartTime) {
|
|
580
|
+
const leasePath = persistentProfileLeasePath(profileDir);
|
|
581
|
+
if (!existsSync(leasePath)) return false;
|
|
582
|
+
try {
|
|
583
|
+
const parsed = JSON.parse(readFileSync(leasePath, "utf-8"));
|
|
584
|
+
if (parsed.state === "cleaning" && typeof parsed.cleanerPid === "number" && parsed.cleanerPid > 0) {
|
|
585
|
+
if (isPidAliveForPrune(parsed.cleanerPid)) return true;
|
|
586
|
+
}
|
|
587
|
+
if (parsed.bridgePid !== bridgePid) return false;
|
|
588
|
+
if (typeof parsed.bridgeStartTime === "string" && typeof bridgeStartTime === "string" && parsed.bridgeStartTime !== bridgeStartTime) {
|
|
589
|
+
return false;
|
|
590
|
+
}
|
|
591
|
+
return true;
|
|
592
|
+
} catch {
|
|
593
|
+
return true;
|
|
594
|
+
}
|
|
595
|
+
}
|
|
596
|
+
function sessionDirHasLiveState(dir, now, minSafetyAgeMs) {
|
|
597
|
+
const pidFile = join(dir, "bridge.pid");
|
|
598
|
+
if (existsSync(pidFile)) {
|
|
599
|
+
try {
|
|
600
|
+
const parsed = JSON.parse(readFileSync(pidFile, "utf-8"));
|
|
601
|
+
if (typeof parsed.pid === "number" && Number.isInteger(parsed.pid) && parsed.pid > 0) {
|
|
602
|
+
if (isPidAliveForPrune(parsed.pid)) return true;
|
|
603
|
+
if (typeof parsed.ownedProfileDir === "string" && parsed.ownedProfileDir.trim().length > 0 && (existsSync(parsed.ownedProfileDir) || existsSync(`${parsed.ownedProfileDir}.manifest.json`))) {
|
|
604
|
+
return true;
|
|
605
|
+
}
|
|
606
|
+
if (typeof parsed.persistentProfileDir === "string" && parsed.persistentProfileDir.trim().length > 0 && hasUnrecoveredPersistentLease(
|
|
607
|
+
parsed.persistentProfileDir,
|
|
608
|
+
parsed.pid,
|
|
609
|
+
typeof parsed.startTime === "string" ? parsed.startTime : void 0
|
|
610
|
+
)) {
|
|
611
|
+
return true;
|
|
612
|
+
}
|
|
613
|
+
} else if (now - lstatSync(pidFile).mtimeMs < minSafetyAgeMs) {
|
|
614
|
+
return true;
|
|
615
|
+
}
|
|
616
|
+
} catch {
|
|
617
|
+
try {
|
|
618
|
+
if (now - lstatSync(pidFile).mtimeMs < minSafetyAgeMs) return true;
|
|
619
|
+
} catch {
|
|
620
|
+
}
|
|
621
|
+
}
|
|
622
|
+
}
|
|
623
|
+
const lockFile = join(dir, "bridge.start.lock");
|
|
624
|
+
if (existsSync(lockFile)) {
|
|
625
|
+
try {
|
|
626
|
+
const parsed = JSON.parse(readFileSync(lockFile, "utf-8"));
|
|
627
|
+
if (typeof parsed.pid === "number" && Number.isInteger(parsed.pid) && parsed.pid > 0) {
|
|
628
|
+
if (isPidAliveForPrune(parsed.pid)) return true;
|
|
629
|
+
}
|
|
630
|
+
if (typeof parsed.createdAt === "number" && now - parsed.createdAt < DEFAULT_START_LOCK_FRESH_MS) {
|
|
631
|
+
return true;
|
|
632
|
+
}
|
|
633
|
+
} catch {
|
|
634
|
+
try {
|
|
635
|
+
if (now - lstatSync(lockFile).mtimeMs < DEFAULT_START_LOCK_FRESH_MS) return true;
|
|
636
|
+
} catch {
|
|
637
|
+
}
|
|
638
|
+
}
|
|
639
|
+
}
|
|
640
|
+
const profilesDir = join(dir, "profiles");
|
|
641
|
+
if (existsSync(profilesDir)) {
|
|
642
|
+
try {
|
|
643
|
+
const entries = readdirSync(profilesDir);
|
|
644
|
+
if (entries.some((f) => f.endsWith(".manifest.json"))) {
|
|
645
|
+
return true;
|
|
646
|
+
}
|
|
647
|
+
} catch {
|
|
648
|
+
return true;
|
|
649
|
+
}
|
|
650
|
+
}
|
|
651
|
+
return false;
|
|
652
|
+
}
|
|
653
|
+
function latestSessionActivityMs(dir) {
|
|
654
|
+
let latest = 0;
|
|
655
|
+
try {
|
|
656
|
+
latest = Math.max(latest, lstatSync(dir).mtimeMs);
|
|
657
|
+
for (const entry of readdirSync(dir)) {
|
|
658
|
+
try {
|
|
659
|
+
latest = Math.max(latest, lstatSync(join(dir, entry)).mtimeMs);
|
|
660
|
+
} catch {
|
|
661
|
+
}
|
|
662
|
+
}
|
|
663
|
+
} catch {
|
|
664
|
+
return Date.now();
|
|
665
|
+
}
|
|
666
|
+
return latest;
|
|
667
|
+
}
|
|
668
|
+
function tryAcquireNonBlockingSessionPruneLock(sessionName) {
|
|
669
|
+
let lockFile;
|
|
670
|
+
try {
|
|
671
|
+
lockFile = resolveSessionStartLockFile(sessionName);
|
|
672
|
+
} catch {
|
|
673
|
+
return null;
|
|
674
|
+
}
|
|
675
|
+
return tryAcquireAtomicLockFile(lockFile);
|
|
676
|
+
}
|
|
677
|
+
function parseNonNegativeFinite(value, fallback) {
|
|
678
|
+
return typeof value === "number" && Number.isFinite(value) && value >= 0 ? value : fallback;
|
|
679
|
+
}
|
|
680
|
+
function resolveEnvSessionMaxAgeMs() {
|
|
681
|
+
const raw = process.env.CHROME_DEVTOOLS_AXI_SESSION_MAX_AGE_MS?.trim();
|
|
682
|
+
if (!raw) return DEFAULT_SESSION_PRUNE_MAX_AGE_MS;
|
|
683
|
+
const parsed = Number(raw);
|
|
684
|
+
return Number.isFinite(parsed) && parsed >= 0 ? parsed : DEFAULT_SESSION_PRUNE_MAX_AGE_MS;
|
|
685
|
+
}
|
|
686
|
+
function pruneStaleSessionDirs(opts = {}) {
|
|
687
|
+
const sessionsRoot = join(homedir(), STATE_DIR_NAME, "sessions");
|
|
688
|
+
if (!existsSync(sessionsRoot)) return { pruned: 0, skipped: 0 };
|
|
689
|
+
try {
|
|
690
|
+
const rootStat = lstatSync(sessionsRoot);
|
|
691
|
+
if (rootStat.isSymbolicLink() || !rootStat.isDirectory()) {
|
|
692
|
+
return { pruned: 0, skipped: 0 };
|
|
693
|
+
}
|
|
694
|
+
} catch {
|
|
695
|
+
return { pruned: 0, skipped: 0 };
|
|
696
|
+
}
|
|
697
|
+
const now = opts.now ?? Date.now();
|
|
698
|
+
const maxAgeMs = opts.maxAgeMs !== void 0 ? parseNonNegativeFinite(opts.maxAgeMs, DEFAULT_SESSION_PRUNE_MAX_AGE_MS) : resolveEnvSessionMaxAgeMs();
|
|
699
|
+
const maxRetainedInactive = opts.maxRetainedInactive !== void 0 && Number.isInteger(opts.maxRetainedInactive) && opts.maxRetainedInactive >= 0 ? opts.maxRetainedInactive : DEFAULT_SESSION_PRUNE_MAX_RETAINED;
|
|
700
|
+
const minSafetyAgeMs = parseNonNegativeFinite(
|
|
701
|
+
opts.minSafetyAgeMs,
|
|
702
|
+
DEFAULT_SESSION_PRUNE_SAFETY_AGE_MS
|
|
703
|
+
);
|
|
704
|
+
let entries;
|
|
705
|
+
try {
|
|
706
|
+
entries = readdirSync(sessionsRoot);
|
|
707
|
+
} catch {
|
|
708
|
+
return { pruned: 0, skipped: 0 };
|
|
709
|
+
}
|
|
710
|
+
let skipped = 0;
|
|
711
|
+
const candidates = [];
|
|
712
|
+
for (const name of entries) {
|
|
713
|
+
const dir = join(sessionsRoot, name);
|
|
714
|
+
try {
|
|
715
|
+
const st = lstatSync(dir);
|
|
716
|
+
if (st.isSymbolicLink() || !st.isDirectory()) {
|
|
717
|
+
skipped += 1;
|
|
718
|
+
continue;
|
|
719
|
+
}
|
|
720
|
+
} catch {
|
|
721
|
+
skipped += 1;
|
|
722
|
+
continue;
|
|
723
|
+
}
|
|
724
|
+
if (name === opts.excludeSession) {
|
|
725
|
+
skipped += 1;
|
|
726
|
+
continue;
|
|
727
|
+
}
|
|
728
|
+
if (sessionDirHasLiveState(dir, now, minSafetyAgeMs)) {
|
|
729
|
+
skipped += 1;
|
|
730
|
+
continue;
|
|
731
|
+
}
|
|
732
|
+
const latestMtimeMs = latestSessionActivityMs(dir);
|
|
733
|
+
if (now - latestMtimeMs < minSafetyAgeMs) {
|
|
734
|
+
skipped += 1;
|
|
735
|
+
continue;
|
|
736
|
+
}
|
|
737
|
+
candidates.push({ name, dir, latestMtimeMs });
|
|
738
|
+
}
|
|
739
|
+
candidates.sort((a, b) => a.latestMtimeMs - b.latestMtimeMs);
|
|
740
|
+
const toDelete = [];
|
|
741
|
+
const retained = [];
|
|
742
|
+
for (const candidate of candidates) {
|
|
743
|
+
if (now - candidate.latestMtimeMs >= maxAgeMs) {
|
|
744
|
+
toDelete.push({ ...candidate, reason: "expired" });
|
|
745
|
+
} else {
|
|
746
|
+
retained.push(candidate);
|
|
747
|
+
}
|
|
748
|
+
}
|
|
749
|
+
if (retained.length > maxRetainedInactive) {
|
|
750
|
+
const overflow = retained.length - maxRetainedInactive;
|
|
751
|
+
for (const candidate of retained.slice(0, overflow)) {
|
|
752
|
+
toDelete.push({ ...candidate, reason: "cap" });
|
|
753
|
+
}
|
|
754
|
+
}
|
|
755
|
+
let pruned = 0;
|
|
756
|
+
for (const candidate of toDelete) {
|
|
757
|
+
const pruneLock = tryAcquireNonBlockingSessionPruneLock(candidate.name);
|
|
758
|
+
if (!pruneLock) {
|
|
759
|
+
skipped += 1;
|
|
760
|
+
continue;
|
|
761
|
+
}
|
|
762
|
+
try {
|
|
763
|
+
const st = lstatSync(candidate.dir);
|
|
764
|
+
if (st.isSymbolicLink() || !st.isDirectory()) {
|
|
765
|
+
skipped += 1;
|
|
766
|
+
continue;
|
|
767
|
+
}
|
|
768
|
+
if (sessionDirHasLiveState(candidate.dir, now, minSafetyAgeMs)) {
|
|
769
|
+
skipped += 1;
|
|
770
|
+
continue;
|
|
771
|
+
}
|
|
772
|
+
const latestUnderLock = latestSessionActivityMs(candidate.dir);
|
|
773
|
+
if (now - latestUnderLock < minSafetyAgeMs) {
|
|
774
|
+
skipped += 1;
|
|
775
|
+
continue;
|
|
776
|
+
}
|
|
777
|
+
if (candidate.reason === "expired" && now - latestUnderLock < maxAgeMs) {
|
|
778
|
+
skipped += 1;
|
|
779
|
+
continue;
|
|
780
|
+
}
|
|
781
|
+
rmSync(candidate.dir, { recursive: true, force: true });
|
|
782
|
+
pruned += 1;
|
|
783
|
+
} catch {
|
|
784
|
+
skipped += 1;
|
|
785
|
+
} finally {
|
|
786
|
+
pruneLock.release();
|
|
787
|
+
}
|
|
788
|
+
}
|
|
789
|
+
return { pruned, skipped };
|
|
790
|
+
}
|
|
791
|
+
|
|
792
|
+
// vendor/chrome-devtools-axi/src/selected-page.ts
|
|
793
|
+
function selectedPageFile() {
|
|
794
|
+
return join2(resolveSessionStateDir(), "selected-page-id");
|
|
795
|
+
}
|
|
796
|
+
function getSelectedPageId() {
|
|
797
|
+
const file = selectedPageFile();
|
|
798
|
+
try {
|
|
799
|
+
if (!existsSync2(file)) return null;
|
|
800
|
+
const parsed = Number.parseInt(readFileSync2(file, "utf-8").trim(), 10);
|
|
801
|
+
return Number.isInteger(parsed) && parsed >= 0 ? parsed : null;
|
|
802
|
+
} catch {
|
|
803
|
+
return null;
|
|
804
|
+
}
|
|
805
|
+
}
|
|
806
|
+
function setSelectedPageId(pageId) {
|
|
807
|
+
const file = selectedPageFile();
|
|
808
|
+
try {
|
|
809
|
+
mkdirSync2(dirname2(file), { recursive: true });
|
|
810
|
+
writeFileSync2(file, String(pageId));
|
|
811
|
+
} catch {
|
|
812
|
+
}
|
|
813
|
+
}
|
|
814
|
+
function clearSelectedPageId() {
|
|
815
|
+
const hadSelection = getSelectedPageId() !== null;
|
|
816
|
+
const file = selectedPageFile();
|
|
817
|
+
try {
|
|
818
|
+
if (existsSync2(file)) unlinkSync2(file);
|
|
819
|
+
} catch {
|
|
820
|
+
}
|
|
821
|
+
return hadSelection && getSelectedPageId() === null;
|
|
822
|
+
}
|
|
823
|
+
function overlaySessionSelected(pages, selectedId = getSelectedPageId()) {
|
|
824
|
+
return pages.map((page) => ({
|
|
825
|
+
...page,
|
|
826
|
+
selected: selectedId !== null && page.id === selectedId
|
|
827
|
+
}));
|
|
828
|
+
}
|
|
829
|
+
function rememberToolRouting(name, args) {
|
|
830
|
+
if (name === "select_page" && typeof args.pageId === "number") {
|
|
831
|
+
setSelectedPageId(args.pageId);
|
|
832
|
+
return;
|
|
833
|
+
}
|
|
834
|
+
if (name === "close_page" && typeof args.pageId === "number") {
|
|
835
|
+
if (getSelectedPageId() === args.pageId) clearSelectedPageId();
|
|
836
|
+
}
|
|
837
|
+
}
|
|
838
|
+
function createdPageIdFromPageLists(beforeText, afterText) {
|
|
839
|
+
const beforeIds = new Set(parsePagesList(beforeText).map((page) => page.id));
|
|
840
|
+
const createdIds = parsePagesList(afterText).filter((page) => !beforeIds.has(page.id)).map((page) => page.id);
|
|
841
|
+
return createdIds.length === 1 ? createdIds[0] : null;
|
|
842
|
+
}
|
|
843
|
+
|
|
844
|
+
// vendor/chrome-devtools-axi/src/bridge-script.ts
|
|
845
|
+
import { existsSync as existsSync3 } from "node:fs";
|
|
846
|
+
import { resolve as resolve2 } from "node:path";
|
|
847
|
+
function resolveBridgeScript(importMetaDir) {
|
|
848
|
+
const bundled = resolve2(importMetaDir, "chrome-devtools-axi-bridge.js");
|
|
849
|
+
if (existsSync3(bundled)) return bundled;
|
|
850
|
+
const builtScript = resolve2(
|
|
851
|
+
importMetaDir,
|
|
852
|
+
"../bin/chrome-devtools-axi-bridge.js"
|
|
853
|
+
);
|
|
854
|
+
const sourceScript = builtScript.replace(/\.js$/, ".ts");
|
|
855
|
+
return existsSync3(sourceScript) ? sourceScript : builtScript;
|
|
856
|
+
}
|
|
857
|
+
var BRIDGE_PORT_IN_USE_EXIT_CODE = 48;
|
|
858
|
+
var BRIDGE_PROFILE_IN_USE_EXIT_CODE = 49;
|
|
859
|
+
var PAGE_IDENTITY_CHANGED_ERROR = "The browser reconnected and every page id changed, so this call did not target the page you selected";
|
|
860
|
+
function isAutoConnectMode() {
|
|
861
|
+
const freshInstance = process.env.CHROME_DEVTOOLS_AXI_FRESH === "1";
|
|
862
|
+
if (freshInstance) return false;
|
|
863
|
+
if (process.env.CHROME_DEVTOOLS_AXI_MCP_SERVER_URL?.trim()) return false;
|
|
864
|
+
return process.env.CHROME_DEVTOOLS_AXI_AUTO_CONNECT === "1" || process.env.CHROME_DEVTOOLS_AXI_ATTACH === "1";
|
|
865
|
+
}
|
|
866
|
+
function isAttachTransportMode() {
|
|
867
|
+
const freshInstance = process.env.CHROME_DEVTOOLS_AXI_FRESH === "1";
|
|
868
|
+
if (freshInstance) return false;
|
|
869
|
+
if (process.env.CHROME_DEVTOOLS_AXI_MCP_SERVER_URL?.trim()) return false;
|
|
870
|
+
const browserUrl = process.env.CHROME_DEVTOOLS_AXI_BROWSER_URL?.trim();
|
|
871
|
+
return isAutoConnectMode() || !!browserUrl;
|
|
872
|
+
}
|
|
873
|
+
function resolvePersistentProfileDir() {
|
|
874
|
+
const freshInstance = process.env.CHROME_DEVTOOLS_AXI_FRESH === "1";
|
|
875
|
+
if (freshInstance) return void 0;
|
|
876
|
+
if (process.env.CHROME_DEVTOOLS_AXI_MCP_SERVER_URL?.trim()) return void 0;
|
|
877
|
+
if (isAutoConnectMode()) return void 0;
|
|
878
|
+
if (process.env.CHROME_DEVTOOLS_AXI_BROWSER_URL?.trim()) return void 0;
|
|
879
|
+
const userDataDir = process.env.CHROME_DEVTOOLS_AXI_USER_DATA_DIR?.trim();
|
|
880
|
+
if (userDataDir) return resolve2(userDataDir);
|
|
881
|
+
const profileName = process.env.CHROME_DEVTOOLS_AXI_PROFILE?.trim();
|
|
882
|
+
if (profileName) return resolve2(resolveNamedProfileDir(profileName));
|
|
883
|
+
return void 0;
|
|
884
|
+
}
|
|
885
|
+
function isManagedIsolatedMode() {
|
|
886
|
+
const freshInstance = process.env.CHROME_DEVTOOLS_AXI_FRESH === "1";
|
|
887
|
+
if (freshInstance) return true;
|
|
888
|
+
if (process.env.CHROME_DEVTOOLS_AXI_MCP_SERVER_URL?.trim()) return false;
|
|
889
|
+
if (isAutoConnectMode()) return false;
|
|
890
|
+
if (process.env.CHROME_DEVTOOLS_AXI_BROWSER_URL?.trim()) return false;
|
|
891
|
+
if (resolvePersistentProfileDir()) return false;
|
|
892
|
+
return true;
|
|
893
|
+
}
|
|
894
|
+
function computeTransportModeFingerprint() {
|
|
895
|
+
const freshInstance = process.env.CHROME_DEVTOOLS_AXI_FRESH === "1";
|
|
896
|
+
const headed = process.env.CHROME_DEVTOOLS_AXI_HEADED === "1";
|
|
897
|
+
if (freshInstance) {
|
|
898
|
+
return headed ? "isolated-headed" : "isolated-headless";
|
|
899
|
+
}
|
|
900
|
+
const sharedUrl = process.env.CHROME_DEVTOOLS_AXI_MCP_SERVER_URL?.trim();
|
|
901
|
+
if (sharedUrl) {
|
|
902
|
+
const proxy = Boolean(process.env.CHROME_DEVTOOLS_AXI_MCP_PATH?.trim());
|
|
903
|
+
return `${proxy ? "shared-proxy" : "shared-direct"}:${sharedUrl}`;
|
|
904
|
+
}
|
|
905
|
+
if (isAutoConnectMode()) {
|
|
906
|
+
const channel = process.env.CHROME_DEVTOOLS_AXI_CHANNEL?.trim() || "stable";
|
|
907
|
+
return `attach-autoconnect:${channel}`;
|
|
908
|
+
}
|
|
909
|
+
const browserUrl = process.env.CHROME_DEVTOOLS_AXI_BROWSER_URL?.trim();
|
|
910
|
+
if (browserUrl) {
|
|
911
|
+
return `attach-url:${browserUrl}`;
|
|
912
|
+
}
|
|
913
|
+
const persistentProfileDir = resolvePersistentProfileDir();
|
|
914
|
+
if (persistentProfileDir) {
|
|
915
|
+
return `${headed ? "profile-headed" : "profile-headless"}:${persistentProfileDir}`;
|
|
916
|
+
}
|
|
917
|
+
return headed ? "isolated-headed" : "isolated-headless";
|
|
918
|
+
}
|
|
919
|
+
|
|
920
|
+
// vendor/chrome-devtools-axi/src/profile-reaper.ts
|
|
921
|
+
import { execFile } from "node:child_process";
|
|
922
|
+
import { randomBytes as randomBytes2, randomUUID as randomUUID2 } from "node:crypto";
|
|
923
|
+
import {
|
|
924
|
+
existsSync as existsSync4,
|
|
925
|
+
mkdirSync as mkdirSync3,
|
|
926
|
+
readdirSync as readdirSync2,
|
|
927
|
+
readFileSync as readFileSync3,
|
|
928
|
+
renameSync,
|
|
929
|
+
rmSync as rmSync2,
|
|
930
|
+
unlinkSync as unlinkSync3,
|
|
931
|
+
writeFileSync as writeFileSync3
|
|
932
|
+
} from "node:fs";
|
|
933
|
+
import { join as join3, resolve as resolve3 } from "node:path";
|
|
934
|
+
var CHROME_GENERATION_FLAG_PREFIX = "--pie-axi-gen=";
|
|
935
|
+
function escapeEre(value) {
|
|
936
|
+
return value.replace(/[\\^$.|?*+()[{]/g, (ch) => `\\${ch}`);
|
|
937
|
+
}
|
|
938
|
+
function profilesRootForSession(sessionStateDir) {
|
|
939
|
+
return join3(sessionStateDir, "profiles");
|
|
940
|
+
}
|
|
941
|
+
function manifestPathForProfileDir(profileDir) {
|
|
942
|
+
return `${profileDir}.manifest.json`;
|
|
943
|
+
}
|
|
944
|
+
function allocateOwnedProfileDir(sessionStateDir, bridgePid = process.pid) {
|
|
945
|
+
const root = profilesRootForSession(sessionStateDir);
|
|
946
|
+
mkdirSync3(root, { recursive: true, mode: 448 });
|
|
947
|
+
const runId = `run-${bridgePid}-${randomBytes2(6).toString("hex")}`;
|
|
948
|
+
const profileDir = resolve3(join3(root, runId));
|
|
949
|
+
mkdirSync3(profileDir, { recursive: true, mode: 448 });
|
|
950
|
+
const manifestPath = manifestPathForProfileDir(profileDir);
|
|
951
|
+
const manifest = {
|
|
952
|
+
bridgePid,
|
|
953
|
+
...readSelfStartTime() ? { bridgeStartTime: readSelfStartTime() } : {},
|
|
954
|
+
profileDir,
|
|
955
|
+
createdAt: (/* @__PURE__ */ new Date()).toISOString()
|
|
956
|
+
};
|
|
957
|
+
writeFileSync3(manifestPath, JSON.stringify(manifest), { mode: 384 });
|
|
958
|
+
return { profileDir, manifestPath };
|
|
959
|
+
}
|
|
960
|
+
function extractUserDataDirFromCmdline(cmdline) {
|
|
961
|
+
const patterns = [
|
|
962
|
+
/(?:^|\s)"--user-data-dir=([^"]+)"(?:\s|$)/i,
|
|
963
|
+
/(?:^|\s)'--user-data-dir=([^']+)'(?:\s|$)/i,
|
|
964
|
+
/(?:^|\s)--user-data-dir="([^"]+)"(?:\s|$)/i,
|
|
965
|
+
/(?:^|\s)--user-data-dir='([^']+)'(?:\s|$)/i,
|
|
966
|
+
/(?:^|\s)--user-data-dir=(\S+)(?:\s|$)/i
|
|
967
|
+
];
|
|
968
|
+
for (const re of patterns) {
|
|
969
|
+
const match = re.exec(cmdline);
|
|
970
|
+
if (match?.[1]) return match[1];
|
|
971
|
+
}
|
|
972
|
+
return null;
|
|
973
|
+
}
|
|
974
|
+
function sameProfilePath(a, b) {
|
|
975
|
+
const normA = canonicalizeProfileDir(a);
|
|
976
|
+
const normB = canonicalizeProfileDir(b);
|
|
977
|
+
return process.platform === "win32" ? normA.toLowerCase() === normB.toLowerCase() : normA === normB;
|
|
978
|
+
}
|
|
979
|
+
function commandLineMatchesProfile(cmdline, profileDir, generationToken) {
|
|
980
|
+
const candidates = Array.from(/* @__PURE__ */ new Set([profileDir, canonicalizeProfileDir(profileDir)]));
|
|
981
|
+
const flags = process.platform === "win32" ? "i" : "";
|
|
982
|
+
const literalMatch = candidates.some((candidate) => {
|
|
983
|
+
const escaped = candidate.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
984
|
+
const patterns = [
|
|
985
|
+
// Whole-argument double-quoted: "--user-data-dir=C:\Jane Doe\..."
|
|
986
|
+
new RegExp(`(?:^|\\s)"--user-data-dir=${escaped}"(?:\\s|$)`, flags),
|
|
987
|
+
// Whole-argument single-quoted: '--user-data-dir=/path with spaces'
|
|
988
|
+
new RegExp(`(?:^|\\s)'--user-data-dir=${escaped}'(?:\\s|$)`, flags),
|
|
989
|
+
// Value-only double-quoted: --user-data-dir="C:\Jane Doe\..."
|
|
990
|
+
new RegExp(`(?:^|\\s)--user-data-dir="${escaped}"(?:\\s|$)`, flags),
|
|
991
|
+
// Value-only single-quoted: --user-data-dir='/path with spaces'
|
|
992
|
+
new RegExp(`(?:^|\\s)--user-data-dir='${escaped}'(?:\\s|$)`, flags),
|
|
993
|
+
// Unquoted token: --user-data-dir=/path/without/spaces
|
|
994
|
+
new RegExp(`(?:^|\\s)--user-data-dir=${escaped}(?:\\s|$)`, flags)
|
|
995
|
+
];
|
|
996
|
+
return patterns.some((re) => re.test(cmdline));
|
|
997
|
+
});
|
|
998
|
+
let dirMatched = literalMatch;
|
|
999
|
+
if (!dirMatched) {
|
|
1000
|
+
const parsedDir = extractUserDataDirFromCmdline(cmdline);
|
|
1001
|
+
if (parsedDir && sameProfilePath(parsedDir, profileDir)) {
|
|
1002
|
+
dirMatched = true;
|
|
1003
|
+
}
|
|
1004
|
+
}
|
|
1005
|
+
if (!dirMatched) return false;
|
|
1006
|
+
if (generationToken !== void 0) {
|
|
1007
|
+
const escapedGen = generationToken.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
1008
|
+
const genPatterns = [
|
|
1009
|
+
new RegExp(`(?:^|\\s)"${CHROME_GENERATION_FLAG_PREFIX}${escapedGen}"(?:\\s|$)`),
|
|
1010
|
+
new RegExp(`(?:^|\\s)'${CHROME_GENERATION_FLAG_PREFIX}${escapedGen}'(?:\\s|$)`),
|
|
1011
|
+
new RegExp(`(?:^|\\s)${CHROME_GENERATION_FLAG_PREFIX}"${escapedGen}"(?:\\s|$)`),
|
|
1012
|
+
new RegExp(`(?:^|\\s)${CHROME_GENERATION_FLAG_PREFIX}'${escapedGen}'(?:\\s|$)`),
|
|
1013
|
+
new RegExp(`(?:^|\\s)${CHROME_GENERATION_FLAG_PREFIX}${escapedGen}(?:\\s|$)`)
|
|
1014
|
+
];
|
|
1015
|
+
return genPatterns.some((re) => re.test(cmdline));
|
|
1016
|
+
}
|
|
1017
|
+
return true;
|
|
1018
|
+
}
|
|
1019
|
+
function pidStillAlive(pid) {
|
|
1020
|
+
try {
|
|
1021
|
+
process.kill(pid, 0);
|
|
1022
|
+
return true;
|
|
1023
|
+
} catch (error) {
|
|
1024
|
+
return error.code === "EPERM";
|
|
1025
|
+
}
|
|
1026
|
+
}
|
|
1027
|
+
async function scanProfileHolders(profileDir, generationToken, opts = {}) {
|
|
1028
|
+
if (process.platform === "win32") {
|
|
1029
|
+
return await new Promise((resolveScan) => {
|
|
1030
|
+
const needle = generationToken ? `${CHROME_GENERATION_FLAG_PREFIX}${generationToken}` : opts.matchSymlinkAliases ? "--user-data-dir=" : profileDir;
|
|
1031
|
+
execFile(
|
|
1032
|
+
"powershell.exe",
|
|
1033
|
+
[
|
|
1034
|
+
"-NoProfile",
|
|
1035
|
+
"-NonInteractive",
|
|
1036
|
+
"-Command",
|
|
1037
|
+
"Get-CimInstance Win32_Process | Where-Object { $_.CommandLine -and $_.CommandLine.IndexOf($env:PIE_AXI_TARGET_NEEDLE, [System.StringComparison]::OrdinalIgnoreCase) -ge 0 } | Select-Object -ExpandProperty ProcessId"
|
|
1038
|
+
],
|
|
1039
|
+
{
|
|
1040
|
+
timeout: 3e3,
|
|
1041
|
+
windowsHide: true,
|
|
1042
|
+
env: { ...process.env, PIE_AXI_TARGET_NEEDLE: needle }
|
|
1043
|
+
},
|
|
1044
|
+
(error, stdout) => {
|
|
1045
|
+
if (error) {
|
|
1046
|
+
resolveScan({ kind: "unknown" });
|
|
1047
|
+
return;
|
|
1048
|
+
}
|
|
1049
|
+
const pids = String(stdout ?? "").split(/\s+/).map(Number).filter((n) => Number.isInteger(n) && n > 0 && n !== process.pid);
|
|
1050
|
+
resolveScan(pids.length > 0 ? { kind: "ok", pids } : { kind: "none" });
|
|
1051
|
+
}
|
|
1052
|
+
);
|
|
1053
|
+
});
|
|
1054
|
+
}
|
|
1055
|
+
const pattern = generationToken ? `pie-axi-gen=${escapeEre(generationToken)}([[:space:]"']|$)` : opts.matchSymlinkAliases ? `user-data-dir=` : Array.from(/* @__PURE__ */ new Set([profileDir, canonicalizeProfileDir(profileDir)])).map((d) => `user-data-dir=${escapeEre(d)}([[:space:]"']|$)`).join("|");
|
|
1056
|
+
return await new Promise((resolveScan) => {
|
|
1057
|
+
execFile("pgrep", ["-f", "--", pattern], { timeout: 1500 }, (error, stdout) => {
|
|
1058
|
+
if (!error) {
|
|
1059
|
+
const pids = String(stdout ?? "").split(/\s+/).map(Number).filter((n) => Number.isInteger(n) && n > 0 && n !== process.pid);
|
|
1060
|
+
resolveScan(pids.length > 0 ? { kind: "ok", pids } : { kind: "none" });
|
|
1061
|
+
return;
|
|
1062
|
+
}
|
|
1063
|
+
const code = error.code;
|
|
1064
|
+
if (code === 1) {
|
|
1065
|
+
resolveScan({ kind: "none" });
|
|
1066
|
+
return;
|
|
1067
|
+
}
|
|
1068
|
+
resolveScan({ kind: "unknown" });
|
|
1069
|
+
});
|
|
1070
|
+
});
|
|
1071
|
+
}
|
|
1072
|
+
async function verifyProfileHolderDetailed(pid, profileDir, generationToken) {
|
|
1073
|
+
if (process.platform === "win32") {
|
|
1074
|
+
return await new Promise((resolveVerify) => {
|
|
1075
|
+
execFile(
|
|
1076
|
+
"powershell.exe",
|
|
1077
|
+
[
|
|
1078
|
+
"-NoProfile",
|
|
1079
|
+
"-NonInteractive",
|
|
1080
|
+
"-Command",
|
|
1081
|
+
`Get-CimInstance Win32_Process -Filter "ProcessId=${pid}" | Select-Object -ExpandProperty CommandLine`
|
|
1082
|
+
],
|
|
1083
|
+
{ timeout: 2500, windowsHide: true },
|
|
1084
|
+
(error, stdout) => {
|
|
1085
|
+
if (error) {
|
|
1086
|
+
resolveVerify(pidStillAlive(pid) ? "unknown" : "no_match");
|
|
1087
|
+
return;
|
|
1088
|
+
}
|
|
1089
|
+
const cmd = String(stdout ?? "").trim();
|
|
1090
|
+
if (!cmd) {
|
|
1091
|
+
resolveVerify(pidStillAlive(pid) ? "unknown" : "no_match");
|
|
1092
|
+
return;
|
|
1093
|
+
}
|
|
1094
|
+
resolveVerify(
|
|
1095
|
+
commandLineMatchesProfile(cmd, profileDir, generationToken) ? "match" : "no_match"
|
|
1096
|
+
);
|
|
1097
|
+
}
|
|
1098
|
+
);
|
|
1099
|
+
});
|
|
1100
|
+
}
|
|
1101
|
+
return await new Promise((resolveVerify) => {
|
|
1102
|
+
execFile("ps", ["-p", String(pid), "-o", "command="], { timeout: 1500 }, (error, stdout) => {
|
|
1103
|
+
if (error) {
|
|
1104
|
+
resolveVerify(pidStillAlive(pid) ? "unknown" : "no_match");
|
|
1105
|
+
return;
|
|
1106
|
+
}
|
|
1107
|
+
const cmd = String(stdout ?? "").trim();
|
|
1108
|
+
if (!cmd) {
|
|
1109
|
+
resolveVerify(pidStillAlive(pid) ? "unknown" : "no_match");
|
|
1110
|
+
return;
|
|
1111
|
+
}
|
|
1112
|
+
resolveVerify(
|
|
1113
|
+
commandLineMatchesProfile(cmd, profileDir, generationToken) ? "match" : "no_match"
|
|
1114
|
+
);
|
|
1115
|
+
});
|
|
1116
|
+
});
|
|
1117
|
+
}
|
|
1118
|
+
async function sleep(ms) {
|
|
1119
|
+
await new Promise((r) => setTimeout(r, ms));
|
|
1120
|
+
}
|
|
1121
|
+
async function waitUntilAllDead(pids, timeoutMs) {
|
|
1122
|
+
const deadline = Date.now() + timeoutMs;
|
|
1123
|
+
let alive = pids.filter(pidStillAlive);
|
|
1124
|
+
while (alive.length > 0 && Date.now() < deadline) {
|
|
1125
|
+
await sleep(100);
|
|
1126
|
+
alive = alive.filter(pidStillAlive);
|
|
1127
|
+
}
|
|
1128
|
+
return alive;
|
|
1129
|
+
}
|
|
1130
|
+
var PROFILE_MUTEX_BUDGET_MS = 2e3;
|
|
1131
|
+
var SLEEP_BUF = new Int32Array(new SharedArrayBuffer(4));
|
|
1132
|
+
function sleepSyncMs(ms) {
|
|
1133
|
+
Atomics.wait(SLEEP_BUF, 0, 0, ms);
|
|
1134
|
+
}
|
|
1135
|
+
function writeFileAtomically(filePath, content) {
|
|
1136
|
+
const tmpPath = `${filePath}.tmp-${process.pid}-${randomBytes2(6).toString("hex")}`;
|
|
1137
|
+
try {
|
|
1138
|
+
writeFileSync3(tmpPath, content, { mode: 384, encoding: "utf-8" });
|
|
1139
|
+
renameSync(tmpPath, filePath);
|
|
1140
|
+
} catch (error) {
|
|
1141
|
+
try {
|
|
1142
|
+
unlinkSync3(tmpPath);
|
|
1143
|
+
} catch {
|
|
1144
|
+
}
|
|
1145
|
+
throw error;
|
|
1146
|
+
}
|
|
1147
|
+
}
|
|
1148
|
+
function withProfileLeaseMutex(profileDir, fn) {
|
|
1149
|
+
const leaseRoot = resolveProfileLeasesDir();
|
|
1150
|
+
mkdirSync3(leaseRoot, { recursive: true, mode: 448 });
|
|
1151
|
+
const leasePath = persistentProfileLeasePath(profileDir);
|
|
1152
|
+
const mutexPath = `${leasePath}.lock`;
|
|
1153
|
+
const deadline = Date.now() + PROFILE_MUTEX_BUDGET_MS;
|
|
1154
|
+
let handle = tryAcquireAtomicLockFile(mutexPath);
|
|
1155
|
+
while (!handle && Date.now() < deadline) {
|
|
1156
|
+
sleepSyncMs(15);
|
|
1157
|
+
handle = tryAcquireAtomicLockFile(mutexPath);
|
|
1158
|
+
}
|
|
1159
|
+
if (!handle) return { ok: false };
|
|
1160
|
+
try {
|
|
1161
|
+
return { ok: true, value: fn(leasePath) };
|
|
1162
|
+
} finally {
|
|
1163
|
+
handle.release();
|
|
1164
|
+
}
|
|
1165
|
+
}
|
|
1166
|
+
function readPersistentProfileLeaseDetailed(leasePath) {
|
|
1167
|
+
if (!existsSync4(leasePath)) return { kind: "missing" };
|
|
1168
|
+
try {
|
|
1169
|
+
const parsed = JSON.parse(readFileSync3(leasePath, "utf-8"));
|
|
1170
|
+
if ((parsed.state === "active" || parsed.state === "cleaning") && typeof parsed.token === "string" && parsed.token.length > 0 && typeof parsed.genToken === "string" && parsed.genToken.length > 0 && typeof parsed.bridgePid === "number" && Number.isInteger(parsed.bridgePid) && parsed.bridgePid > 0 && typeof parsed.profileDir === "string" && typeof parsed.sessionName === "string") {
|
|
1171
|
+
return { kind: "valid", lease: parsed };
|
|
1172
|
+
}
|
|
1173
|
+
return { kind: "unreadable" };
|
|
1174
|
+
} catch {
|
|
1175
|
+
return existsSync4(leasePath) ? { kind: "unreadable" } : { kind: "missing" };
|
|
1176
|
+
}
|
|
1177
|
+
}
|
|
1178
|
+
function readPersistentProfileLeaseFromPath(leasePath) {
|
|
1179
|
+
const res = readPersistentProfileLeaseDetailed(leasePath);
|
|
1180
|
+
return res.kind === "valid" ? res.lease : null;
|
|
1181
|
+
}
|
|
1182
|
+
function leaseMatchesOwner(lease, owner) {
|
|
1183
|
+
if (owner.token !== void 0) {
|
|
1184
|
+
return lease.token === owner.token;
|
|
1185
|
+
}
|
|
1186
|
+
if (lease.bridgePid !== owner.pid) return false;
|
|
1187
|
+
if (lease.bridgeStartTime && owner.startTime && lease.bridgeStartTime !== owner.startTime) {
|
|
1188
|
+
return false;
|
|
1189
|
+
}
|
|
1190
|
+
return true;
|
|
1191
|
+
}
|
|
1192
|
+
function isPersistentProfileLeaseOwnedBy(profileDir, owner) {
|
|
1193
|
+
const lease = readPersistentProfileLeaseFromPath(persistentProfileLeasePath(profileDir));
|
|
1194
|
+
if (!lease) return false;
|
|
1195
|
+
return leaseMatchesOwner(lease, owner);
|
|
1196
|
+
}
|
|
1197
|
+
function releasePersistentProfileLease(profileDir, owner) {
|
|
1198
|
+
const locked = withProfileLeaseMutex(profileDir, (leasePath) => {
|
|
1199
|
+
const lease = readPersistentProfileLeaseFromPath(leasePath);
|
|
1200
|
+
if (!lease) return true;
|
|
1201
|
+
if (!leaseMatchesOwner(lease, owner)) return false;
|
|
1202
|
+
try {
|
|
1203
|
+
unlinkSync3(leasePath);
|
|
1204
|
+
return true;
|
|
1205
|
+
} catch {
|
|
1206
|
+
return !existsSync4(leasePath);
|
|
1207
|
+
}
|
|
1208
|
+
});
|
|
1209
|
+
return locked.ok && locked.value;
|
|
1210
|
+
}
|
|
1211
|
+
function acquirePersistentProfileLease(profileDir, sessionName, bridgePid = process.pid, bridgeStartTime, genToken = `${bridgePid}-${randomBytes2(6).toString("hex")}`) {
|
|
1212
|
+
const normalized = canonicalizeProfileDir(profileDir);
|
|
1213
|
+
const resolvedStartTime = bridgeStartTime ?? (bridgePid === process.pid ? readSelfStartTime() : inspectProcessIdentity(bridgePid).startTime);
|
|
1214
|
+
const locked = withProfileLeaseMutex(normalized, (leasePath) => {
|
|
1215
|
+
const existingRes = readPersistentProfileLeaseDetailed(leasePath);
|
|
1216
|
+
if (existingRes.kind === "unreadable") {
|
|
1217
|
+
return { acquired: false };
|
|
1218
|
+
}
|
|
1219
|
+
if (existingRes.kind === "valid") {
|
|
1220
|
+
const existing = existingRes.lease;
|
|
1221
|
+
if (existing.state === "cleaning") {
|
|
1222
|
+
const cleanerAlive = existing.cleanerPid !== void 0 && existing.cleanerPid > 0 && !isSupervisorGone(
|
|
1223
|
+
{
|
|
1224
|
+
pid: existing.cleanerPid,
|
|
1225
|
+
...existing.cleanerStartTime ? { startTime: existing.cleanerStartTime } : {}
|
|
1226
|
+
},
|
|
1227
|
+
inspectProcessIdentity
|
|
1228
|
+
);
|
|
1229
|
+
if (cleanerAlive) {
|
|
1230
|
+
return {
|
|
1231
|
+
acquired: false,
|
|
1232
|
+
conflictPid: existing.cleanerPid,
|
|
1233
|
+
conflictSession: existing.sessionName
|
|
1234
|
+
};
|
|
1235
|
+
}
|
|
1236
|
+
return {
|
|
1237
|
+
acquired: false,
|
|
1238
|
+
recoveryRequired: {
|
|
1239
|
+
pid: existing.bridgePid,
|
|
1240
|
+
...existing.bridgeStartTime ? { startTime: existing.bridgeStartTime } : {},
|
|
1241
|
+
sessionName: existing.sessionName
|
|
1242
|
+
},
|
|
1243
|
+
conflictPid: existing.bridgePid,
|
|
1244
|
+
conflictSession: existing.sessionName
|
|
1245
|
+
};
|
|
1246
|
+
} else {
|
|
1247
|
+
const sameIdentity = existing.bridgePid === bridgePid && (!existing.bridgeStartTime || resolvedStartTime !== void 0 && existing.bridgeStartTime === resolvedStartTime);
|
|
1248
|
+
if (sameIdentity) {
|
|
1249
|
+
return {
|
|
1250
|
+
acquired: true,
|
|
1251
|
+
leasePath,
|
|
1252
|
+
token: existing.token,
|
|
1253
|
+
genToken: existing.genToken
|
|
1254
|
+
};
|
|
1255
|
+
}
|
|
1256
|
+
const gone = isSupervisorGone(
|
|
1257
|
+
{
|
|
1258
|
+
pid: existing.bridgePid,
|
|
1259
|
+
...existing.bridgeStartTime ? { startTime: existing.bridgeStartTime } : {}
|
|
1260
|
+
},
|
|
1261
|
+
inspectProcessIdentity
|
|
1262
|
+
);
|
|
1263
|
+
if (!gone) {
|
|
1264
|
+
return {
|
|
1265
|
+
acquired: false,
|
|
1266
|
+
conflictPid: existing.bridgePid,
|
|
1267
|
+
conflictSession: existing.sessionName
|
|
1268
|
+
};
|
|
1269
|
+
}
|
|
1270
|
+
return {
|
|
1271
|
+
acquired: false,
|
|
1272
|
+
recoveryRequired: {
|
|
1273
|
+
pid: existing.bridgePid,
|
|
1274
|
+
...existing.bridgeStartTime ? { startTime: existing.bridgeStartTime } : {},
|
|
1275
|
+
sessionName: existing.sessionName
|
|
1276
|
+
},
|
|
1277
|
+
conflictPid: existing.bridgePid,
|
|
1278
|
+
conflictSession: existing.sessionName
|
|
1279
|
+
};
|
|
1280
|
+
}
|
|
1281
|
+
}
|
|
1282
|
+
const token = randomUUID2();
|
|
1283
|
+
const payload = {
|
|
1284
|
+
state: "active",
|
|
1285
|
+
token,
|
|
1286
|
+
genToken,
|
|
1287
|
+
bridgePid,
|
|
1288
|
+
...resolvedStartTime ? { bridgeStartTime: resolvedStartTime } : {},
|
|
1289
|
+
sessionName,
|
|
1290
|
+
profileDir: normalized,
|
|
1291
|
+
createdAt: (/* @__PURE__ */ new Date()).toISOString()
|
|
1292
|
+
};
|
|
1293
|
+
writeFileAtomically(leasePath, JSON.stringify(payload));
|
|
1294
|
+
return { acquired: true, leasePath, token, genToken };
|
|
1295
|
+
});
|
|
1296
|
+
if (!locked.ok) return { acquired: false };
|
|
1297
|
+
return locked.value;
|
|
1298
|
+
}
|
|
1299
|
+
function claimPersistentProfileForCleanup(profileDir, expectedOwner) {
|
|
1300
|
+
const normalized = canonicalizeProfileDir(profileDir);
|
|
1301
|
+
const locked = withProfileLeaseMutex(normalized, (leasePath) => {
|
|
1302
|
+
const existingRes = readPersistentProfileLeaseDetailed(leasePath);
|
|
1303
|
+
if (existingRes.kind === "missing") return { status: "not_owned" };
|
|
1304
|
+
if (existingRes.kind === "unreadable") return { status: "busy" };
|
|
1305
|
+
const existing = existingRes.lease;
|
|
1306
|
+
if (!leaseMatchesOwner(existing, expectedOwner)) {
|
|
1307
|
+
return { status: "not_owned" };
|
|
1308
|
+
}
|
|
1309
|
+
if (existing.state === "cleaning") {
|
|
1310
|
+
const cleanerGone = existing.cleanerPid !== void 0 && existing.cleanerPid > 0 && isSupervisorGone(
|
|
1311
|
+
{
|
|
1312
|
+
pid: existing.cleanerPid,
|
|
1313
|
+
...existing.cleanerStartTime ? { startTime: existing.cleanerStartTime } : {}
|
|
1314
|
+
},
|
|
1315
|
+
inspectProcessIdentity
|
|
1316
|
+
);
|
|
1317
|
+
if (!cleanerGone) {
|
|
1318
|
+
return { status: "busy" };
|
|
1319
|
+
}
|
|
1320
|
+
} else {
|
|
1321
|
+
const bridgeGone = isSupervisorGone(
|
|
1322
|
+
{
|
|
1323
|
+
pid: existing.bridgePid,
|
|
1324
|
+
...existing.bridgeStartTime ? { startTime: existing.bridgeStartTime } : {}
|
|
1325
|
+
},
|
|
1326
|
+
inspectProcessIdentity
|
|
1327
|
+
);
|
|
1328
|
+
if (!bridgeGone) {
|
|
1329
|
+
return { status: "busy" };
|
|
1330
|
+
}
|
|
1331
|
+
}
|
|
1332
|
+
const cleanupToken = randomUUID2();
|
|
1333
|
+
const activeBaseline = {
|
|
1334
|
+
...existing,
|
|
1335
|
+
state: "active",
|
|
1336
|
+
cleanerPid: void 0,
|
|
1337
|
+
cleanerStartTime: void 0
|
|
1338
|
+
};
|
|
1339
|
+
const cleaningLease = {
|
|
1340
|
+
...activeBaseline,
|
|
1341
|
+
state: "cleaning",
|
|
1342
|
+
token: cleanupToken,
|
|
1343
|
+
cleanerPid: process.pid,
|
|
1344
|
+
...readSelfStartTime() ? { cleanerStartTime: readSelfStartTime() } : {}
|
|
1345
|
+
};
|
|
1346
|
+
writeFileAtomically(leasePath, JSON.stringify(cleaningLease));
|
|
1347
|
+
return { status: "claimed", cleanupToken, previousLease: activeBaseline };
|
|
1348
|
+
});
|
|
1349
|
+
if (!locked.ok) return { status: "busy" };
|
|
1350
|
+
return locked.value;
|
|
1351
|
+
}
|
|
1352
|
+
function finishPersistentProfileCleanup(profileDir, cleanupToken, clean, previousLease) {
|
|
1353
|
+
const normalized = canonicalizeProfileDir(profileDir);
|
|
1354
|
+
const locked = withProfileLeaseMutex(normalized, (leasePath) => {
|
|
1355
|
+
const current = readPersistentProfileLeaseFromPath(leasePath);
|
|
1356
|
+
if (!current) return clean;
|
|
1357
|
+
if (current.token !== cleanupToken) return false;
|
|
1358
|
+
if (clean) {
|
|
1359
|
+
try {
|
|
1360
|
+
unlinkSync3(leasePath);
|
|
1361
|
+
return true;
|
|
1362
|
+
} catch {
|
|
1363
|
+
return !existsSync4(leasePath);
|
|
1364
|
+
}
|
|
1365
|
+
}
|
|
1366
|
+
writeFileAtomically(leasePath, JSON.stringify(previousLease));
|
|
1367
|
+
return true;
|
|
1368
|
+
});
|
|
1369
|
+
return locked.ok && locked.value;
|
|
1370
|
+
}
|
|
1371
|
+
async function reapPersistentProfileForDeadOwner(profileDir, expectedOwner) {
|
|
1372
|
+
const claim = claimPersistentProfileForCleanup(profileDir, expectedOwner);
|
|
1373
|
+
if (claim.status === "not_owned") {
|
|
1374
|
+
return { status: "not_owned", remainingPids: [] };
|
|
1375
|
+
}
|
|
1376
|
+
if (claim.status === "busy") {
|
|
1377
|
+
return { status: "busy", remainingPids: [] };
|
|
1378
|
+
}
|
|
1379
|
+
let reaped = { clean: false, remainingPids: [] };
|
|
1380
|
+
let finalized = false;
|
|
1381
|
+
try {
|
|
1382
|
+
reaped = await terminateProfileHolders(profileDir, {
|
|
1383
|
+
generationToken: claim.previousLease.genToken
|
|
1384
|
+
});
|
|
1385
|
+
} finally {
|
|
1386
|
+
finalized = finishPersistentProfileCleanup(
|
|
1387
|
+
profileDir,
|
|
1388
|
+
claim.cleanupToken,
|
|
1389
|
+
reaped.clean,
|
|
1390
|
+
claim.previousLease
|
|
1391
|
+
);
|
|
1392
|
+
}
|
|
1393
|
+
if (reaped.clean && finalized) {
|
|
1394
|
+
return { status: "reaped", remainingPids: [] };
|
|
1395
|
+
}
|
|
1396
|
+
return { status: "failed", remainingPids: reaped.remainingPids };
|
|
1397
|
+
}
|
|
1398
|
+
async function preflightPersistentProfile(profileDir) {
|
|
1399
|
+
const normalized = canonicalizeProfileDir(profileDir);
|
|
1400
|
+
const scan = await scanProfileHolders(normalized, void 0, {
|
|
1401
|
+
matchSymlinkAliases: true
|
|
1402
|
+
});
|
|
1403
|
+
if (scan.kind === "none") return { kind: "free" };
|
|
1404
|
+
if (scan.kind === "unknown") {
|
|
1405
|
+
return { kind: "unknown", reason: "process scan unavailable" };
|
|
1406
|
+
}
|
|
1407
|
+
const verified = [];
|
|
1408
|
+
let anyUnknown = false;
|
|
1409
|
+
for (const pid of scan.pids) {
|
|
1410
|
+
const verdict = await verifyProfileHolderDetailed(pid, normalized);
|
|
1411
|
+
if (verdict === "match") verified.push(pid);
|
|
1412
|
+
else if (verdict === "unknown") anyUnknown = true;
|
|
1413
|
+
}
|
|
1414
|
+
if (verified.length > 0) {
|
|
1415
|
+
return { kind: "in_use", pids: verified };
|
|
1416
|
+
}
|
|
1417
|
+
if (anyUnknown) {
|
|
1418
|
+
return { kind: "unknown", reason: "candidate holder command line unreadable" };
|
|
1419
|
+
}
|
|
1420
|
+
return { kind: "free" };
|
|
1421
|
+
}
|
|
1422
|
+
async function terminateProfileHolders(profileDir, opts = {}) {
|
|
1423
|
+
const resolved = resolve3(profileDir);
|
|
1424
|
+
const genToken = opts.generationToken;
|
|
1425
|
+
const firstScan = await scanProfileHolders(resolved, genToken);
|
|
1426
|
+
if (firstScan.kind === "unknown") {
|
|
1427
|
+
return { clean: false, remainingPids: [] };
|
|
1428
|
+
}
|
|
1429
|
+
if (firstScan.kind === "ok") {
|
|
1430
|
+
const verified = [];
|
|
1431
|
+
let anyUnknown = false;
|
|
1432
|
+
for (const pid of firstScan.pids) {
|
|
1433
|
+
const verdict = await verifyProfileHolderDetailed(pid, resolved, genToken);
|
|
1434
|
+
if (verdict === "match") verified.push(pid);
|
|
1435
|
+
else if (verdict === "unknown") anyUnknown = true;
|
|
1436
|
+
}
|
|
1437
|
+
for (const pid of verified) {
|
|
1438
|
+
try {
|
|
1439
|
+
process.kill(pid, "SIGTERM");
|
|
1440
|
+
} catch {
|
|
1441
|
+
}
|
|
1442
|
+
}
|
|
1443
|
+
const afterTerm = await waitUntilAllDead(verified, 1500);
|
|
1444
|
+
for (const pid of afterTerm) {
|
|
1445
|
+
const recheck = await verifyProfileHolderDetailed(pid, resolved, genToken);
|
|
1446
|
+
if (recheck === "match") {
|
|
1447
|
+
try {
|
|
1448
|
+
process.kill(pid, "SIGKILL");
|
|
1449
|
+
} catch {
|
|
1450
|
+
}
|
|
1451
|
+
} else if (recheck === "unknown") {
|
|
1452
|
+
anyUnknown = true;
|
|
1453
|
+
}
|
|
1454
|
+
}
|
|
1455
|
+
if (afterTerm.length > 0) {
|
|
1456
|
+
await waitUntilAllDead(afterTerm, 1e3);
|
|
1457
|
+
}
|
|
1458
|
+
if (anyUnknown) {
|
|
1459
|
+
return { clean: false, remainingPids: afterTerm.filter(pidStillAlive) };
|
|
1460
|
+
}
|
|
1461
|
+
}
|
|
1462
|
+
const finalScan = await scanProfileHolders(resolved, genToken);
|
|
1463
|
+
if (finalScan.kind === "unknown") {
|
|
1464
|
+
return { clean: false, remainingPids: [] };
|
|
1465
|
+
}
|
|
1466
|
+
if (finalScan.kind === "ok") {
|
|
1467
|
+
const stillMatching = [];
|
|
1468
|
+
let anyFinalUnknown = false;
|
|
1469
|
+
for (const pid of finalScan.pids) {
|
|
1470
|
+
const verdict = await verifyProfileHolderDetailed(pid, resolved, genToken);
|
|
1471
|
+
if (verdict === "match") stillMatching.push(pid);
|
|
1472
|
+
else if (verdict === "unknown") anyFinalUnknown = true;
|
|
1473
|
+
}
|
|
1474
|
+
if (stillMatching.length > 0 || anyFinalUnknown) {
|
|
1475
|
+
return { clean: false, remainingPids: stillMatching };
|
|
1476
|
+
}
|
|
1477
|
+
}
|
|
1478
|
+
return { clean: true, remainingPids: [] };
|
|
1479
|
+
}
|
|
1480
|
+
async function cleanupOwnedProfileDir(profileDir, manifestPath = manifestPathForProfileDir(profileDir)) {
|
|
1481
|
+
const normalized = resolve3(profileDir);
|
|
1482
|
+
const terminated = await terminateProfileHolders(normalized);
|
|
1483
|
+
if (!terminated.clean) {
|
|
1484
|
+
return terminated;
|
|
1485
|
+
}
|
|
1486
|
+
try {
|
|
1487
|
+
rmSync2(normalized, { recursive: true, force: true });
|
|
1488
|
+
} catch {
|
|
1489
|
+
}
|
|
1490
|
+
try {
|
|
1491
|
+
if (existsSync4(manifestPath)) unlinkSync3(manifestPath);
|
|
1492
|
+
} catch {
|
|
1493
|
+
}
|
|
1494
|
+
return { clean: true, remainingPids: [] };
|
|
1495
|
+
}
|
|
1496
|
+
async function reapStaleOwnedProfiles(sessionStateDir, activeBridgePid) {
|
|
1497
|
+
const root = profilesRootForSession(sessionStateDir);
|
|
1498
|
+
if (!existsSync4(root)) return;
|
|
1499
|
+
let entries;
|
|
1500
|
+
try {
|
|
1501
|
+
entries = readdirSync2(root).filter((f) => f.endsWith(".manifest.json"));
|
|
1502
|
+
} catch {
|
|
1503
|
+
return;
|
|
1504
|
+
}
|
|
1505
|
+
for (const file of entries) {
|
|
1506
|
+
const manifestPath = join3(root, file);
|
|
1507
|
+
let manifest;
|
|
1508
|
+
try {
|
|
1509
|
+
const parsed = JSON.parse(readFileSync3(manifestPath, "utf-8"));
|
|
1510
|
+
if (typeof parsed.bridgePid !== "number" || !Number.isInteger(parsed.bridgePid) || parsed.bridgePid <= 0 || typeof parsed.profileDir !== "string" || parsed.profileDir.trim().length === 0) {
|
|
1511
|
+
continue;
|
|
1512
|
+
}
|
|
1513
|
+
manifest = parsed;
|
|
1514
|
+
} catch {
|
|
1515
|
+
continue;
|
|
1516
|
+
}
|
|
1517
|
+
if (activeBridgePid !== void 0 && manifest.bridgePid === activeBridgePid) {
|
|
1518
|
+
continue;
|
|
1519
|
+
}
|
|
1520
|
+
const gone = isSupervisorGone(
|
|
1521
|
+
{
|
|
1522
|
+
pid: manifest.bridgePid,
|
|
1523
|
+
...manifest.bridgeStartTime ? { startTime: manifest.bridgeStartTime } : {}
|
|
1524
|
+
},
|
|
1525
|
+
inspectProcessIdentity
|
|
1526
|
+
);
|
|
1527
|
+
if (!gone) continue;
|
|
1528
|
+
await cleanupOwnedProfileDir(manifest.profileDir, manifestPath);
|
|
1529
|
+
}
|
|
1530
|
+
}
|
|
1531
|
+
|
|
1532
|
+
export {
|
|
1533
|
+
inspectProcessIdentity,
|
|
1534
|
+
readSelfStartTime,
|
|
1535
|
+
parseSupervisorAnchor,
|
|
1536
|
+
isSupervisorGone,
|
|
1537
|
+
DEFAULT_SESSION_NAME,
|
|
1538
|
+
resolveSessionName,
|
|
1539
|
+
writeAllocatedSessionPort,
|
|
1540
|
+
clearAllocatedSessionPort,
|
|
1541
|
+
resolveSessionPort,
|
|
1542
|
+
resolveSessionStateDir,
|
|
1543
|
+
resolveSessionPidFile,
|
|
1544
|
+
resolveSessionLogFile,
|
|
1545
|
+
resolveSessionStartLockFile,
|
|
1546
|
+
tryAcquireAtomicLockFile,
|
|
1547
|
+
pruneStaleSessionDirs,
|
|
1548
|
+
resolveBridgeScript,
|
|
1549
|
+
BRIDGE_PORT_IN_USE_EXIT_CODE,
|
|
1550
|
+
BRIDGE_PROFILE_IN_USE_EXIT_CODE,
|
|
1551
|
+
PAGE_IDENTITY_CHANGED_ERROR,
|
|
1552
|
+
isAutoConnectMode,
|
|
1553
|
+
isAttachTransportMode,
|
|
1554
|
+
resolvePersistentProfileDir,
|
|
1555
|
+
isManagedIsolatedMode,
|
|
1556
|
+
computeTransportModeFingerprint,
|
|
1557
|
+
needsPageId,
|
|
1558
|
+
parsePagesList,
|
|
1559
|
+
CHROME_GENERATION_FLAG_PREFIX,
|
|
1560
|
+
allocateOwnedProfileDir,
|
|
1561
|
+
isPersistentProfileLeaseOwnedBy,
|
|
1562
|
+
releasePersistentProfileLease,
|
|
1563
|
+
acquirePersistentProfileLease,
|
|
1564
|
+
reapPersistentProfileForDeadOwner,
|
|
1565
|
+
preflightPersistentProfile,
|
|
1566
|
+
terminateProfileHolders,
|
|
1567
|
+
cleanupOwnedProfileDir,
|
|
1568
|
+
reapStaleOwnedProfiles,
|
|
1569
|
+
getSelectedPageId,
|
|
1570
|
+
setSelectedPageId,
|
|
1571
|
+
clearSelectedPageId,
|
|
1572
|
+
overlaySessionSelected,
|
|
1573
|
+
rememberToolRouting,
|
|
1574
|
+
createdPageIdFromPageLists
|
|
1575
|
+
};
|