@qilin-agent/experimental-inspector 3.1.3 → 3.1.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.i18n.yaml +23 -23
- package/README.md +2 -2
- package/README.zh.md +3 -3
- package/icon.svg +18 -7
- package/lib/client.js +1 -1
- package/lib/client.page.js +2 -2
- package/lib/devtools/chunks/{accessibility-CwvHp3sj.js → accessibility-OQcgkXIB.js} +5 -5
- package/lib/devtools/chunks/{adorners-D4aU6nuY.js → adorners-Be2VY5BN.js} +2 -2
- package/lib/devtools/chunks/{ai_assistance-BU6E0Wio.js → ai_assistance-DRe9GF9j.js} +19 -19
- package/lib/devtools/chunks/{animation-TEwO5UI_.js → animation-TQzd9HO4.js} +4 -4
- package/lib/devtools/chunks/{application-SCf6MiCN.js → application-B8ko2TRt.js} +29 -29
- package/lib/devtools/chunks/{autofill-Dp3nMnuK.js → autofill-D_Bi6xxt.js} +5 -5
- package/lib/devtools/chunks/{autofill_manager-BXntqfdp.js → autofill_manager-Cw0wOndc.js} +1 -1
- package/lib/devtools/chunks/{bindings-DgoVEdsr.js → bindings-B7uzkbnH.js} +1 -1
- package/lib/devtools/chunks/{browser_debugger-p7Rr4IBR.js → browser_debugger-6syzh5He.js} +5 -5
- package/lib/devtools/chunks/{changes-k42bihtm.js → changes-8Dpo591z.js} +6 -6
- package/lib/devtools/chunks/{changes-DeW5MC9u.js → changes-Hp2cPKPp.js} +1 -1
- package/lib/devtools/chunks/{checkbox.css-CZJJ6atQ.js → checkbox.css-Cwxn2mfx.js} +1 -1
- package/lib/devtools/chunks/{code_highlighter-BnTPt9_G.js → code_highlighter-oWKo9plW.js} +1 -1
- package/lib/devtools/chunks/{color_picker-Cuh_X19Y.js → color_picker-CHmwJ7or.js} +2 -2
- package/lib/devtools/chunks/{common-Uu9A2glf.js → common-BGyPsfVb.js} +1 -1
- package/lib/devtools/chunks/{common-DjRFwulW.js → common-C6gzvSKg.js} +9 -9
- package/lib/devtools/chunks/{components-CnPGgDUW.js → components-B5xBXfXj.js} +3 -3
- package/lib/devtools/chunks/{components-EJwviLtZ.js → components-BkETO50Z.js} +5 -5
- package/lib/devtools/chunks/{components-Cw5tHQqN.js → components-DlE11Hk_.js} +14 -14
- package/lib/devtools/chunks/{console-D1WlMaFQ.js → console-DEk3riFh.js} +13 -13
- package/lib/devtools/chunks/{console-yMm3XVTY.js → console-OWEKC7bo.js} +1 -1
- package/lib/devtools/chunks/{console_counters-9SfIdrUo.js → console_counters-ClDYfPF6.js} +4 -4
- package/lib/devtools/chunks/{coverage-BbFH390Q.js → coverage-Dg9NvtX9.js} +3 -3
- package/lib/devtools/chunks/{coverage-CLBpovLw.js → coverage-uK2NUeVj.js} +1 -1
- package/lib/devtools/chunks/{css_overview-cITV9auE.js → css_overview-6FosuoNY.js} +10 -10
- package/lib/devtools/chunks/{data_grid-pC5qqfsJ.js → data_grid-6RZWyPx-.js} +2 -2
- package/lib/devtools/chunks/{developer_resources-4DqQIvy6.js → developer_resources-C6_2oeLF.js} +3 -3
- package/lib/devtools/chunks/{dom_extension-BfrKZ4JG.js → dom_extension-B0UaTHZj.js} +1 -1
- package/lib/devtools/chunks/{elements-CgEYz3mX.js → elements-CcvMWzGx.js} +1 -1
- package/lib/devtools/chunks/{elements-Dbx4q9-v.js → elements-Xw7oHKeq.js} +20 -20
- package/lib/devtools/chunks/{emulation-C6XKPPGu.js → emulation-B7sLFSxp.js} +6 -6
- package/lib/devtools/chunks/{emulation-cjFPXHT9.js → emulation-CvVuS_p0.js} +4 -4
- package/lib/devtools/chunks/{emulation-D8xbdsAj.js → emulation-DMC3TuHv.js} +1 -1
- package/lib/devtools/chunks/{emulation-EtJlEukP.js → emulation-_lA-Xb1h.js} +1 -1
- package/lib/devtools/chunks/{event_listeners-BeTH3gi2.js → event_listeners-CdGgpDsg.js} +5 -5
- package/lib/devtools/chunks/{explain-P_aDGFSD.js → explain-fG84ckui.js} +6 -6
- package/lib/devtools/chunks/{greendev-BU0QcVPX.js → greendev-DvYwqqmc.js} +3 -3
- package/lib/devtools/chunks/{helper-CI72KvIC.js → helper-DoR8dYRk.js} +2 -2
- package/lib/devtools/chunks/{helpers--xrfGSwQ.js → helpers-BypUnKdS.js} +2 -2
- package/lib/devtools/chunks/{i18n-DvFMqQdJ.js → i18n-DUXZnMbP.js} +1 -1
- package/lib/devtools/chunks/{icon_button-BebVdJD8.js → icon_button-mu37qw0h.js} +3 -3
- package/lib/devtools/chunks/{inline_editor-D54X5UUr.js → inline_editor-Dgctmf2_.js} +9 -9
- package/lib/devtools/chunks/{inspector_main-DRbdXLmF.js → inspector_main-yb83VyUs.js} +7 -7
- package/lib/devtools/chunks/{issue_counter-CeOjTNGW.js → issue_counter-COHuTTL3.js} +5 -5
- package/lib/devtools/chunks/{issues-CegBKEda.js → issues-C94onoob.js} +9 -9
- package/lib/devtools/chunks/{issues_manager-D7nfNPN1.js → issues_manager-7hP__vf-.js} +2 -2
- package/lib/devtools/chunks/{layer_viewer-CaFC5oyv.js → layer_viewer-BF3qEG7C.js} +4 -4
- package/lib/devtools/chunks/{layers-CXqlD9zH.js → layers-KW9wwW__.js} +2 -2
- package/lib/devtools/chunks/{legacy-Bqn4Q0Tf.js → legacy-C0IOfyhX.js} +8 -8
- package/lib/devtools/chunks/{lighthouse-T9ZpmENr.js → lighthouse-BUitD7KK.js} +1 -1
- package/lib/devtools/chunks/{lighthouse-DtpzvfT6.js → lighthouse-f3QbU2gw.js} +6 -6
- package/lib/devtools/chunks/{linear_memory_inspector-C50PtM45.js → linear_memory_inspector-Dhv8CzB6.js} +3 -3
- package/lib/devtools/chunks/{live-metrics-Bs7wxibB.js → live-metrics-DTntFi2I.js} +2 -2
- package/lib/devtools/chunks/{main-C5y6NscM.js → main---7244L8.js} +1 -1
- package/lib/devtools/chunks/{main-DcgYyEI0.js → main-CQ4zKr5A.js} +10 -10
- package/lib/devtools/chunks/{markdown_view-C67b2DdG.js → markdown_view-DN02v7_2.js} +4 -4
- package/lib/devtools/chunks/{media-BhuqASbO.js → media-BNfBOtUh.js} +6 -6
- package/lib/devtools/chunks/{media-Wfo1AbXC.js → media-eTuT8cbS.js} +1 -1
- package/lib/devtools/chunks/{menus-BAUukA5-.js → menus-DoacKucS.js} +5 -5
- package/lib/devtools/chunks/{mobile_throttling-Cw4AkJH4.js → mobile_throttling-BKeQegny.js} +3 -3
- package/lib/devtools/chunks/{mobile_throttling-C26zde8o.js → mobile_throttling-DXj04TKw.js} +1 -1
- package/lib/devtools/chunks/{network-C3gIloDN.js → network-BIhtpwBx.js} +1 -1
- package/lib/devtools/chunks/{network-CaxdpGU2.js → network-C1U3mkwJ.js} +26 -26
- package/lib/devtools/chunks/{objectValue.css-C9o9fdM2.js → objectValue.css-B7vmCz4R.js} +1 -1
- package/lib/devtools/chunks/{object_ui-E7eR7aD-.js → object_ui-B8MxYDLE.js} +1 -1
- package/lib/devtools/chunks/{object_ui-BYgPTK_b.js → object_ui-C8fCheVq.js} +6 -6
- package/lib/devtools/chunks/{perf_ui-BqzJrt4p.js → perf_ui-4xM6fYl7.js} +1 -1
- package/lib/devtools/chunks/{perf_ui-CQMkYfn3.js → perf_ui-Cp2qToEB.js} +7 -7
- package/lib/devtools/chunks/{performance_monitor-B2kUoCv0.js → performance_monitor-BUcbKqz4.js} +3 -3
- package/lib/devtools/chunks/{profiler-BGu3akEf.js → profiler-Dq2TBqy8.js} +11 -11
- package/lib/devtools/chunks/{protocol_monitor-CvLQ8ms1.js → protocol_monitor-BG2dkmPK.js} +8 -8
- package/lib/devtools/chunks/protocol_monitor-DC2CZGW5.js +2 -0
- package/lib/devtools/chunks/{puppeteer-CaOjgj3v.js → puppeteer-ZLIws8kb.js} +1 -1
- package/lib/devtools/chunks/{quick_open-C3IZ69m9.js → quick_open-B0xhg6ZL.js} +1 -1
- package/lib/devtools/chunks/{quick_open-DRITaPnZ.js → quick_open-Dfzyy8ve.js} +3 -3
- package/lib/devtools/chunks/{recorder-C0f1n95b.js → recorder-BwV8H_Us.js} +16 -16
- package/lib/devtools/chunks/{request_link_icon-fGy57GcW.js → request_link_icon-BjtC6uxv.js} +2 -2
- package/lib/devtools/chunks/{security-NbgKa3ux.js → security-BjoaTtpU.js} +1 -1
- package/lib/devtools/chunks/{sensors-nM7qcBE4.js → sensors-m9L9nmDB.js} +4 -4
- package/lib/devtools/chunks/{settings-aKtQC12v.js → settings-DvrCWlb3.js} +9 -9
- package/lib/devtools/chunks/{settings_ui-CzxAFzIb.js → settings_ui-Df8-TVsv.js} +5 -5
- package/lib/devtools/chunks/{snackbars-lPThuWYs.js → snackbars-DTKjs7om.js} +2 -2
- package/lib/devtools/chunks/{snippets-dIuBmVBv.js → snippets-DkuCZu-J.js} +4 -4
- package/lib/devtools/chunks/{source_frame-CSjno3kf.js → source_frame-CzY7luV4.js} +8 -8
- package/lib/devtools/chunks/{sources-Bf8QJxju.js → sources-CdvYPTNy.js} +1 -1
- package/lib/devtools/chunks/{sources-BIZssBei.js → sources-CoHLP03P.js} +22 -22
- package/lib/devtools/chunks/{suggestion_input-Duuu5pyd.js → suggestion_input-CpR9sfDn.js} +3 -3
- package/lib/devtools/chunks/{textInput.css-DPvwvIic.js → textInput.css-D9hN8XWo.js} +1 -1
- package/lib/devtools/chunks/{text_editor-Dq1P6D2J.js → text_editor-BH_W0fXD.js} +5 -5
- package/lib/devtools/chunks/{theme_support-CbSSLkbO.js → theme_support-DJK4CjXB.js} +1 -1
- package/lib/devtools/chunks/{timeline-C4vCX79k.js → timeline-D6VQ2WWf.js} +38 -38
- package/lib/devtools/chunks/{timeline-BE_ysZxO.js → timeline-DfcTNEAb.js} +1 -1
- package/lib/devtools/chunks/{utils-CELci976.js → utils-DqoFGxV_.js} +6 -6
- package/lib/devtools/chunks/{web_audio-IdfBLjwV.js → web_audio-CTM_kqxU.js} +1 -1
- package/lib/devtools/chunks/{webauthn-iRZlbjGV.js → webauthn-Bt1tTNVo.js} +4 -4
- package/lib/devtools/chunks/{whats_new-DOTPf2xJ.js → whats_new-Dv7HPSaK.js} +2 -2
- package/lib/devtools/entrypoints/device_mode_emulation_frame/device_mode_emulation_frame.js +1 -1
- package/lib/devtools/entrypoints/devtools_app/devtools_app.js +55 -55
- package/lib/devtools/entrypoints/lighthouse_worker/lighthouse_worker.js +1 -1
- package/lib/devtools/resource-manifest.json +266 -266
- package/lib/index.js +83 -38
- package/lib/types/host/plugin.d.ts +6 -1
- package/lib/worker.js +35 -31
- package/package.json +31 -35
- package/cordis.patch.yml +0 -5
- package/lib/devtools/chunks/protocol_monitor-B9nMqAAE.js +0 -2
- /package/lib/devtools/chunks/{_qilin-devtools_empty-BvRk9kiK.js → _dsh-devtools_empty-BvRk9kiK.js} +0 -0
package/lib/index.js
CHANGED
|
@@ -1,9 +1,6 @@
|
|
|
1
|
-
import { createRequire } from "node:module";
|
|
2
1
|
import z from "@qilin-agent/schemastery";
|
|
3
|
-
import { fileURLToPath
|
|
2
|
+
import { fileURLToPath } from "node:url";
|
|
4
3
|
import { connect } from "node:net";
|
|
5
|
-
import serveStatic from "serve-static";
|
|
6
|
-
import open, { apps } from "open";
|
|
7
4
|
import { randomBytes, randomUUID } from "node:crypto";
|
|
8
5
|
import { tmpdir } from "node:os";
|
|
9
6
|
import { MessageChannel, Worker } from "node:worker_threads";
|
|
@@ -23,6 +20,14 @@ const NETWORK_TOPICS = [
|
|
|
23
20
|
"fetch/error"
|
|
24
21
|
];
|
|
25
22
|
/**
|
|
23
|
+
* Keeps each wrapper-created Request reachable while the caller's response body stream is reachable.
|
|
24
|
+
* Node's fetch forwards the caller's abort signal only while that Request is reachable. The capture
|
|
25
|
+
* clone shares one source with the caller's body stream and keeps that stream reachable while capture
|
|
26
|
+
* reads. Entries are set after `response.clone()`, which replaces `response.body`. The map is
|
|
27
|
+
* module-level so that responses obtained before `stop()` keep their Request reachable afterwards.
|
|
28
|
+
*/
|
|
29
|
+
const requestsByBody = /* @__PURE__ */ new WeakMap();
|
|
30
|
+
/**
|
|
26
31
|
* Install full fetch capture for every later call through `globalThis.fetch`.
|
|
27
32
|
* @param publisher - Host source that receives fetch lifecycle records.
|
|
28
33
|
* @param options - Per-body capture limits.
|
|
@@ -115,6 +120,7 @@ function installFetchObserver(publisher, options) {
|
|
|
115
120
|
responseCaptureError: renderError$1(error)
|
|
116
121
|
});
|
|
117
122
|
}
|
|
123
|
+
if (response.body !== null) requestsByBody.set(response.body, request);
|
|
118
124
|
return response;
|
|
119
125
|
};
|
|
120
126
|
Object.defineProperty(observedFetch, "name", {
|
|
@@ -1804,7 +1810,7 @@ function resolveInspectorOptions(options = {}) {
|
|
|
1804
1810
|
async function startInspector(options = {}) {
|
|
1805
1811
|
const spec = resolveInspectorOptions(options);
|
|
1806
1812
|
const channel = new MessageChannel();
|
|
1807
|
-
const clientProtocol = `
|
|
1813
|
+
const clientProtocol = `dsh-inspector-v${String(0)}-${randomBytes(32).toString("base64url")}`;
|
|
1808
1814
|
const lifecycle = new InspectorWorkerLifecycle(spawnWorker({
|
|
1809
1815
|
config: {
|
|
1810
1816
|
host: spec.host,
|
|
@@ -1906,7 +1912,7 @@ function spawnWorker(boot) {
|
|
|
1906
1912
|
};
|
|
1907
1913
|
if (!import.meta.url.endsWith(".ts")) return new Worker(new URL("./worker.js", import.meta.url), options);
|
|
1908
1914
|
const workerEntry = new URL("../../worker/entry.ts", import.meta.url);
|
|
1909
|
-
const tsxEsmApiEntry =
|
|
1915
|
+
const tsxEsmApiEntry = import.meta.resolve("tsx/esm/api");
|
|
1910
1916
|
const bootstrap = [
|
|
1911
1917
|
`import { register } from ${JSON.stringify(tsxEsmApiEntry)}`,
|
|
1912
1918
|
"register()",
|
|
@@ -1917,14 +1923,6 @@ function spawnWorker(boot) {
|
|
|
1917
1923
|
env: sourceWorkerEnv()
|
|
1918
1924
|
});
|
|
1919
1925
|
}
|
|
1920
|
-
/** Resolve the tsx ESM loader API entry, as a file URL. */
|
|
1921
|
-
function resolveTsxEsmApi() {
|
|
1922
|
-
try {
|
|
1923
|
-
return import.meta.resolve("tsx/esm/api");
|
|
1924
|
-
} catch {
|
|
1925
|
-
return pathToFileURL(createRequire(import.meta.url).resolve("tsx/esm/api")).href;
|
|
1926
|
-
}
|
|
1927
|
-
}
|
|
1928
1926
|
function sourceWorkerEnv() {
|
|
1929
1927
|
const env = {};
|
|
1930
1928
|
if (process.platform === "win32") {
|
|
@@ -2368,23 +2366,39 @@ async function disposeInspectorResources(disposers, close, message) {
|
|
|
2368
2366
|
//#endregion
|
|
2369
2367
|
//#region lib/types/host/plugin.js
|
|
2370
2368
|
/** Host Cordis plugin for the cross-realm Inspector Worker and full fetch capture. */
|
|
2371
|
-
/** Resolve this package's manifest URL; Vitest's module runner lacks import.meta.resolve. */
|
|
2372
|
-
function resolvePackageManifest() {
|
|
2373
|
-
try {
|
|
2374
|
-
return import.meta.resolve("@qilin-agent/experimental-inspector/package.json");
|
|
2375
|
-
} catch {
|
|
2376
|
-
return pathToFileURL(createRequire(import.meta.url).resolve("@qilin-agent/experimental-inspector/package.json")).href;
|
|
2377
|
-
}
|
|
2378
|
-
}
|
|
2379
2369
|
const DEVTOOLS_PATH = "/inspector/devtools";
|
|
2380
|
-
/**
|
|
2370
|
+
/** Node's standard code for a feature the running platform cannot provide, such as `worker_threads` in a browser Worker host. */
|
|
2371
|
+
const FEATURE_UNAVAILABLE_ON_PLATFORM = "ERR_FEATURE_UNAVAILABLE_ON_PLATFORM";
|
|
2372
|
+
/**
|
|
2373
|
+
* Start the Worker, expose `ctx.inspector`, and inject the matching Client bootstrap.
|
|
2374
|
+
* The bootstrap route exists before the Worker is ready, so a Client published during startup waits instead of failing.
|
|
2375
|
+
* When the platform cannot run the Worker (`ERR_FEATURE_UNAVAILABLE_ON_PLATFORM`), the plugin warns once and stays active
|
|
2376
|
+
* with only that route, which answers 503; every other startup failure rolls back and rejects the fiber.
|
|
2377
|
+
*/
|
|
2381
2378
|
async function apply$1(ctx, config) {
|
|
2382
2379
|
await ctx.effect(async () => {
|
|
2383
2380
|
const spec = resolveInspectorOptions(config);
|
|
2384
|
-
const
|
|
2381
|
+
const ready = Promise.withResolvers();
|
|
2385
2382
|
const disposers = [];
|
|
2386
|
-
|
|
2383
|
+
let worker;
|
|
2384
|
+
const dispose = () => disposeInspectorResources(disposers, () => worker?.close(), "experimental-inspector: disposal failed");
|
|
2387
2385
|
try {
|
|
2386
|
+
disposers.push(ctx.connection.fetch.register({
|
|
2387
|
+
path: INSPECTOR_BOOTSTRAP_PATH,
|
|
2388
|
+
methods: ["GET"],
|
|
2389
|
+
requestBody: "buffered",
|
|
2390
|
+
fetch: (request) => bootstrapResponse(ready.promise, request.signal)
|
|
2391
|
+
}));
|
|
2392
|
+
const handle = await startInspector(spec).catch((error) => {
|
|
2393
|
+
if (!isUnavailableOnPlatform(error)) throw error;
|
|
2394
|
+
ctx.logger.warn("experimental-inspector: NodeJS Inspector is unavailable on this platform; Host inspection stays disabled", error);
|
|
2395
|
+
});
|
|
2396
|
+
if (handle === void 0) {
|
|
2397
|
+
ready.resolve(void 0);
|
|
2398
|
+
return dispose;
|
|
2399
|
+
}
|
|
2400
|
+
worker = handle;
|
|
2401
|
+
const { default: serveStatic } = await import("serve-static");
|
|
2388
2402
|
disposers.push(publishCordisTree(ctx, handle.source, {
|
|
2389
2403
|
maxNodes: spec.maxCordisNodes,
|
|
2390
2404
|
maxBytes: spec.maxSourceFrameBytes - 4096
|
|
@@ -2397,13 +2411,7 @@ async function apply$1(ctx, config) {
|
|
|
2397
2411
|
value: handle.endpoint.client
|
|
2398
2412
|
});
|
|
2399
2413
|
}));
|
|
2400
|
-
|
|
2401
|
-
path: INSPECTOR_BOOTSTRAP_PATH,
|
|
2402
|
-
methods: ["GET"],
|
|
2403
|
-
requestBody: "buffered",
|
|
2404
|
-
fetch: () => Promise.resolve(Response.json(handle.endpoint.client, { headers: { "cache-control": "no-store" } }))
|
|
2405
|
-
}));
|
|
2406
|
-
const assets = serveStatic(fileURLToPath(new URL("./lib/devtools/", resolvePackageManifest())), {
|
|
2414
|
+
const assets = serveStatic(fileURLToPath(new URL("./lib/devtools/", import.meta.resolve("@qilin-agent/experimental-inspector/package.json"))), {
|
|
2407
2415
|
index: false,
|
|
2408
2416
|
redirect: false,
|
|
2409
2417
|
fallthrough: true,
|
|
@@ -2492,13 +2500,18 @@ async function apply$1(ctx, config) {
|
|
|
2492
2500
|
}
|
|
2493
2501
|
}));
|
|
2494
2502
|
console.log(`qilin inspector: ${handle.endpoint.devtoolsFrontendUrl}`);
|
|
2495
|
-
|
|
2496
|
-
|
|
2497
|
-
|
|
2498
|
-
|
|
2499
|
-
|
|
2500
|
-
|
|
2503
|
+
ready.resolve(handle.endpoint.client);
|
|
2504
|
+
if (ctx.get("cmdlineArgs")?.get().includes("--inspect")) {
|
|
2505
|
+
const { default: open, apps } = await import("open");
|
|
2506
|
+
await open(handle.endpoint.devtoolsFrontendUrl, {
|
|
2507
|
+
app: { name: apps.chrome },
|
|
2508
|
+
wait: false
|
|
2509
|
+
}).catch((error) => {
|
|
2510
|
+
ctx.logger.error("experimental-inspector: Chrome could not open DevTools", error);
|
|
2511
|
+
});
|
|
2512
|
+
}
|
|
2501
2513
|
} catch (error) {
|
|
2514
|
+
ready.resolve(void 0);
|
|
2502
2515
|
await dispose().catch((cleanupError) => {
|
|
2503
2516
|
ctx.logger.error("experimental-inspector: initialization rollback failed", cleanupError);
|
|
2504
2517
|
});
|
|
@@ -2507,6 +2520,38 @@ async function apply$1(ctx, config) {
|
|
|
2507
2520
|
return dispose;
|
|
2508
2521
|
}, "experimental-inspector: Host Worker");
|
|
2509
2522
|
}
|
|
2523
|
+
/**
|
|
2524
|
+
* Report whether a Worker startup failure means this platform cannot run the Inspector at all.
|
|
2525
|
+
* @param error - Rejection from {@link startInspector}.
|
|
2526
|
+
* @returns True only for Node's `ERR_FEATURE_UNAVAILABLE_ON_PLATFORM` code; messages are never inspected.
|
|
2527
|
+
*/
|
|
2528
|
+
function isUnavailableOnPlatform(error) {
|
|
2529
|
+
return error instanceof Error && "code" in error && error.code === FEATURE_UNAVAILABLE_ON_PLATFORM;
|
|
2530
|
+
}
|
|
2531
|
+
/**
|
|
2532
|
+
* Answer one bootstrap request once Host initialization settles or the browser abandons the request.
|
|
2533
|
+
* @param ready - Resolves with the Client bootstrap, or with undefined after initialization failed or found the platform unavailable.
|
|
2534
|
+
* @param signal - Request signal; an aborted request stops waiting and receives no endpoint.
|
|
2535
|
+
* @returns The bootstrap JSON, or 503 when the Inspector is unavailable or the request was aborted.
|
|
2536
|
+
*/
|
|
2537
|
+
async function bootstrapResponse(ready, signal) {
|
|
2538
|
+
const headers = { "cache-control": "no-store" };
|
|
2539
|
+
const abandoned = Promise.withResolvers();
|
|
2540
|
+
const abandon = () => {
|
|
2541
|
+
abandoned.resolve(void 0);
|
|
2542
|
+
};
|
|
2543
|
+
if (signal.aborted) abandon();
|
|
2544
|
+
else signal.addEventListener("abort", abandon, { once: true });
|
|
2545
|
+
try {
|
|
2546
|
+
const client = await Promise.race([ready, abandoned.promise]);
|
|
2547
|
+
return client === void 0 ? new Response(null, {
|
|
2548
|
+
status: 503,
|
|
2549
|
+
headers
|
|
2550
|
+
}) : Response.json(client, { headers });
|
|
2551
|
+
} finally {
|
|
2552
|
+
signal.removeEventListener("abort", abandon);
|
|
2553
|
+
}
|
|
2554
|
+
}
|
|
2510
2555
|
//#endregion
|
|
2511
2556
|
//#region lib/types/index.js
|
|
2512
2557
|
/** Repository-facing Host package entry over the mirrored implementation tree. */
|
|
@@ -14,6 +14,11 @@ export interface HostPluginConfig extends Omit<InspectorOptions, 'clientOrigins'
|
|
|
14
14
|
/** Browser origins allowed to open the Client ingest WebSocket. */
|
|
15
15
|
clientOrigins?: string[];
|
|
16
16
|
}
|
|
17
|
-
/**
|
|
17
|
+
/**
|
|
18
|
+
* Start the Worker, expose `ctx.inspector`, and inject the matching Client bootstrap.
|
|
19
|
+
* The bootstrap route exists before the Worker is ready, so a Client published during startup waits instead of failing.
|
|
20
|
+
* When the platform cannot run the Worker (`ERR_FEATURE_UNAVAILABLE_ON_PLATFORM`), the plugin warns once and stays active
|
|
21
|
+
* with only that route, which answers 503; every other startup failure rolls back and rejects the fiber.
|
|
22
|
+
*/
|
|
18
23
|
export declare function apply(ctx: Context, config: HostPluginConfig): Promise<void>;
|
|
19
24
|
//# sourceMappingURL=plugin.d.ts.map
|
package/lib/worker.js
CHANGED
|
@@ -269,16 +269,16 @@ var NetworkDomain = class {
|
|
|
269
269
|
return {
|
|
270
270
|
body: Buffer$1.from(body.bytes).toString("base64"),
|
|
271
271
|
base64Encoded: true,
|
|
272
|
-
|
|
273
|
-
...body.captureError === void 0 ? {} : {
|
|
272
|
+
dshInspectorTruncated: body.truncated,
|
|
273
|
+
...body.captureError === void 0 ? {} : { dshInspectorCaptureError: body.captureError }
|
|
274
274
|
};
|
|
275
275
|
}
|
|
276
276
|
case "Network.getRequestPostData": {
|
|
277
277
|
const body = this.store.requestBody(params.requestId);
|
|
278
278
|
return {
|
|
279
279
|
postData: Buffer$1.from(body.bytes).toString("utf8"),
|
|
280
|
-
|
|
281
|
-
...body.captureError === void 0 ? {} : {
|
|
280
|
+
dshInspectorTruncated: body.truncated,
|
|
281
|
+
...body.captureError === void 0 ? {} : { dshInspectorCaptureError: body.captureError }
|
|
282
282
|
};
|
|
283
283
|
}
|
|
284
284
|
case "Network.streamResourceContent": {
|
|
@@ -322,8 +322,8 @@ var NetworkDomain = class {
|
|
|
322
322
|
this.sendRequestStart(session, event.requestKey, resourceType);
|
|
323
323
|
session.sendEvent("Network.responseReceived", {
|
|
324
324
|
requestId: event.requestId,
|
|
325
|
-
loaderId: "
|
|
326
|
-
frameId: "
|
|
325
|
+
loaderId: "dsh-inspector-loader",
|
|
326
|
+
frameId: "dsh-inspector-host-frame",
|
|
327
327
|
timestamp,
|
|
328
328
|
type: resourceType,
|
|
329
329
|
response: {
|
|
@@ -364,7 +364,7 @@ var NetworkDomain = class {
|
|
|
364
364
|
requestId: event.requestId,
|
|
365
365
|
timestamp,
|
|
366
366
|
encodedDataLength: event.encodedDataLength,
|
|
367
|
-
|
|
367
|
+
dshInspectorTruncated: event.truncated
|
|
368
368
|
});
|
|
369
369
|
this.stopRequest(session, event.requestKey);
|
|
370
370
|
return;
|
|
@@ -392,7 +392,7 @@ var NetworkDomain = class {
|
|
|
392
392
|
this.requestTypes.get(session)?.set(requestKey, resourceType);
|
|
393
393
|
session.sendEvent("Network.requestWillBeSent", {
|
|
394
394
|
requestId: event.requestId,
|
|
395
|
-
loaderId: "
|
|
395
|
+
loaderId: "dsh-inspector-loader",
|
|
396
396
|
documentURL: "qilin://host",
|
|
397
397
|
request: {
|
|
398
398
|
url: event.url,
|
|
@@ -2684,7 +2684,7 @@ var ClientRuntimeRouter = class {
|
|
|
2684
2684
|
if (capability === void 0) return;
|
|
2685
2685
|
const target = {
|
|
2686
2686
|
contextId: this.nextContextId--,
|
|
2687
|
-
uniqueContextId: `
|
|
2687
|
+
uniqueContextId: `dsh-client:${source.sourceId}:${source.generation}`,
|
|
2688
2688
|
source,
|
|
2689
2689
|
capability
|
|
2690
2690
|
};
|
|
@@ -3286,8 +3286,8 @@ const CDP_METHOD_NOT_HANDLED = Symbol("CDP_METHOD_NOT_HANDLED");
|
|
|
3286
3286
|
*/
|
|
3287
3287
|
function handleScaffold(request, target) {
|
|
3288
3288
|
const frame = {
|
|
3289
|
-
id: "
|
|
3290
|
-
loaderId: "
|
|
3289
|
+
id: "dsh-inspector-host-frame",
|
|
3290
|
+
loaderId: "dsh-inspector-loader",
|
|
3291
3291
|
url: "qilin://host",
|
|
3292
3292
|
domainAndRegistry: "",
|
|
3293
3293
|
securityOrigin: "qilin://host",
|
|
@@ -3334,9 +3334,9 @@ function handleScaffold(request, target) {
|
|
|
3334
3334
|
} };
|
|
3335
3335
|
case "Browser.getVersion": return {
|
|
3336
3336
|
protocolVersion: "1.3",
|
|
3337
|
-
product: "
|
|
3337
|
+
product: "dsh-experimental-inspector/0",
|
|
3338
3338
|
revision: "@experimental",
|
|
3339
|
-
userAgent: "
|
|
3339
|
+
userAgent: "dsh-experimental-inspector",
|
|
3340
3340
|
jsVersion: process.versions.v8
|
|
3341
3341
|
};
|
|
3342
3342
|
default: return CDP_METHOD_NOT_HANDLED;
|
|
@@ -4068,7 +4068,7 @@ var RuntimeDomainSession = class {
|
|
|
4068
4068
|
if (typeof unique === "string") {
|
|
4069
4069
|
const realm = this.realms.byUniqueContextId(unique);
|
|
4070
4070
|
if (realm !== void 0) return realm;
|
|
4071
|
-
if (unique.startsWith("
|
|
4071
|
+
if (unique.startsWith("dsh-client:")) throw new Error("Client execution context is no longer available");
|
|
4072
4072
|
return this.realms.host();
|
|
4073
4073
|
}
|
|
4074
4074
|
}
|
|
@@ -4104,7 +4104,7 @@ var RuntimeDomainSession = class {
|
|
|
4104
4104
|
if (typeof params.uniqueContextId === "string") {
|
|
4105
4105
|
const realm = this.realms.byUniqueContextId(params.uniqueContextId);
|
|
4106
4106
|
if (realm?.nativeDomains.state === "unsupported") return realm.nativeDomains.reason;
|
|
4107
|
-
if (params.uniqueContextId.startsWith("
|
|
4107
|
+
if (params.uniqueContextId.startsWith("dsh-client:") && realm === void 0) return "Client execution context is no longer available";
|
|
4108
4108
|
}
|
|
4109
4109
|
for (const [key, value] of Object.entries(params)) {
|
|
4110
4110
|
if (!key.endsWith("ObjectId") && key !== "objectId") continue;
|
|
@@ -4148,7 +4148,7 @@ var RuntimeDomainSession = class {
|
|
|
4148
4148
|
name: `Client — ${realm.descriptor.label}`,
|
|
4149
4149
|
auxData: {
|
|
4150
4150
|
isDefault: false,
|
|
4151
|
-
type: "
|
|
4151
|
+
type: "dsh-client",
|
|
4152
4152
|
sourceId: realm.descriptor.sourceId
|
|
4153
4153
|
}
|
|
4154
4154
|
} }
|
|
@@ -5077,7 +5077,7 @@ var InspectorEndpoint = class {
|
|
|
5077
5077
|
}
|
|
5078
5078
|
if (pathname === "/json/version") {
|
|
5079
5079
|
this.json(response, {
|
|
5080
|
-
Browser: "
|
|
5080
|
+
Browser: "dsh-experimental-inspector/0",
|
|
5081
5081
|
"Protocol-Version": "1.3",
|
|
5082
5082
|
webSocketDebuggerUrl: this.cdpUrl()
|
|
5083
5083
|
});
|
|
@@ -5129,7 +5129,7 @@ var InspectorEndpoint = class {
|
|
|
5129
5129
|
}
|
|
5130
5130
|
}, {
|
|
5131
5131
|
targetId: this.config.targetId,
|
|
5132
|
-
title: "
|
|
5132
|
+
title: "QiLin Host"
|
|
5133
5133
|
}, this.sources, this.network, this.realms, this.cordisDom, this.cordisTrees, clientSourceId);
|
|
5134
5134
|
this.cdpSessions.set(socket, session);
|
|
5135
5135
|
socket.on("message", (data) => {
|
|
@@ -5197,7 +5197,7 @@ var InspectorEndpoint = class {
|
|
|
5197
5197
|
return {
|
|
5198
5198
|
id: this.config.targetId,
|
|
5199
5199
|
type: "page",
|
|
5200
|
-
title: "
|
|
5200
|
+
title: "QiLin Host",
|
|
5201
5201
|
description: "Experimental cross-realm Inspector target",
|
|
5202
5202
|
url: "qilin://host",
|
|
5203
5203
|
webSocketDebuggerUrl: this.cdpUrl(),
|
|
@@ -7272,18 +7272,22 @@ controlPort.on("message", (message) => {
|
|
|
7272
7272
|
});
|
|
7273
7273
|
}
|
|
7274
7274
|
});
|
|
7275
|
-
|
|
7276
|
-
|
|
7277
|
-
|
|
7278
|
-
|
|
7279
|
-
|
|
7280
|
-
|
|
7281
|
-
|
|
7282
|
-
|
|
7283
|
-
|
|
7284
|
-
|
|
7285
|
-
|
|
7286
|
-
|
|
7275
|
+
/** Start the Worker server and report readiness, or report the failure and stop. */
|
|
7276
|
+
async function main() {
|
|
7277
|
+
try {
|
|
7278
|
+
runtime = await startInspectorWorker(boot);
|
|
7279
|
+
controlPort.postMessage({
|
|
7280
|
+
type: "ready",
|
|
7281
|
+
...runtime.endpoint
|
|
7282
|
+
});
|
|
7283
|
+
} catch (error) {
|
|
7284
|
+
controlPort.postMessage({
|
|
7285
|
+
type: "failure",
|
|
7286
|
+
message: error instanceof Error ? error.message : String(error)
|
|
7287
|
+
});
|
|
7288
|
+
await stop();
|
|
7289
|
+
}
|
|
7287
7290
|
}
|
|
7291
|
+
main();
|
|
7288
7292
|
//#endregion
|
|
7289
7293
|
export {};
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@qilin-agent/experimental-inspector",
|
|
3
3
|
"description": "Experimental cross-realm CDP hub for Host debugging and Client Runtime inspection",
|
|
4
|
-
"version": "3.1.
|
|
4
|
+
"version": "3.1.6",
|
|
5
5
|
"icon": "./icon.svg",
|
|
6
6
|
"publishConfig": {
|
|
7
7
|
"access": "public"
|
|
@@ -11,6 +11,9 @@
|
|
|
11
11
|
"url": "git+https://github.com/kkutysllb/QiLin.git",
|
|
12
12
|
"directory": "packages/experimental/inspector"
|
|
13
13
|
},
|
|
14
|
+
"engines": {
|
|
15
|
+
"node": "^22.19.0 || >=24.0.0"
|
|
16
|
+
},
|
|
14
17
|
"type": "module",
|
|
15
18
|
"main": "lib/index.js",
|
|
16
19
|
"types": "lib/types/index.d.ts",
|
|
@@ -23,7 +26,6 @@
|
|
|
23
26
|
"types": "./lib/types/client/index.d.ts",
|
|
24
27
|
"default": "./lib/client.js"
|
|
25
28
|
},
|
|
26
|
-
"./cordis.patch.yml": "./cordis.patch.yml",
|
|
27
29
|
"./locale/*.json": "./locale/*.json",
|
|
28
30
|
"./src/*": "./src/*",
|
|
29
31
|
"./package.json": "./package.json"
|
|
@@ -40,10 +42,9 @@
|
|
|
40
42
|
"locale/*.json",
|
|
41
43
|
"lib/index.js",
|
|
42
44
|
"lib/client.js",
|
|
43
|
-
"lib/worker.js",
|
|
44
45
|
"lib/client.*.js",
|
|
46
|
+
"lib/worker.js",
|
|
45
47
|
"lib/devtools/**",
|
|
46
|
-
"cordis.patch.yml",
|
|
47
48
|
"lib/types/**/*.d.ts"
|
|
48
49
|
],
|
|
49
50
|
"license": "MIT",
|
|
@@ -51,43 +52,38 @@
|
|
|
51
52
|
"open": "^11.0.0",
|
|
52
53
|
"serve-static": "^2.2.1",
|
|
53
54
|
"ws": "^8.21.0",
|
|
54
|
-
"@qilin-agent/
|
|
55
|
-
"@qilin-agent/
|
|
56
|
-
"@qilin-agent/
|
|
57
|
-
"@qilin-agent/schemastery": "~3.18.3"
|
|
55
|
+
"@qilin-agent/schemastery": "~3.18.5",
|
|
56
|
+
"@qilin-agent/util-crypto": "3.1.6",
|
|
57
|
+
"@qilin-agent/app-boot": "3.1.6"
|
|
58
58
|
},
|
|
59
59
|
"peerDependencies": {
|
|
60
|
-
"@qilin-agent/kylin": "~4.0.
|
|
61
|
-
"@qilin-agent/client-modules": "3.1.3",
|
|
62
|
-
"@qilin-agent/client-connection": "3.1.3",
|
|
63
|
-
"@qilin-agent/kylin-plugin-loader": "~1.0.4",
|
|
64
|
-
"@qilin-agent/host-webserver": "3.1.3"
|
|
60
|
+
"@qilin-agent/kylin": "~4.0.5"
|
|
65
61
|
},
|
|
66
62
|
"devDependencies": {
|
|
67
|
-
"
|
|
68
|
-
"@types/react": "~18.3.1",
|
|
63
|
+
"chrome-devtools-frontend": "1.0.1638082",
|
|
69
64
|
"@types/serve-static": "^2.2.0",
|
|
65
|
+
"@testing-library/react": "^16.3.2",
|
|
66
|
+
"react": "^18.2.0",
|
|
67
|
+
"@types/react": "~18.3.1",
|
|
68
|
+
"@types/react-dom": "~18.3.0",
|
|
70
69
|
"@types/ws": "^8.18.1",
|
|
71
|
-
"chrome-devtools-frontend": "1.0.1638082",
|
|
72
70
|
"playwright": "^1.49.0",
|
|
73
|
-
"
|
|
74
|
-
"
|
|
75
|
-
"@qilin-agent/client-
|
|
76
|
-
"@qilin-agent/client-
|
|
77
|
-
"@qilin-agent/client-shortcuts": "3.1.
|
|
78
|
-
"@qilin-agent/client-store": "3.1.
|
|
79
|
-
"@qilin-agent/client-
|
|
80
|
-
"@qilin-agent/client-ui-
|
|
81
|
-
"@qilin-agent/client-
|
|
82
|
-
"@qilin-agent/
|
|
83
|
-
"@qilin-agent/
|
|
84
|
-
"@qilin-agent/
|
|
85
|
-
"@qilin-agent/
|
|
86
|
-
"@qilin-agent/
|
|
87
|
-
"@qilin-agent/kylin": "~4.0.
|
|
88
|
-
"@qilin-agent/
|
|
89
|
-
|
|
90
|
-
"engines": {
|
|
91
|
-
"node": "^22.19.0 || >=24.0.0"
|
|
71
|
+
"tsx": "^4.22.4",
|
|
72
|
+
"@qilin-agent/client-ui-renderer": "3.1.6",
|
|
73
|
+
"@qilin-agent/client-test-runtime": "3.1.6",
|
|
74
|
+
"@qilin-agent/client-ui-layout": "3.1.6",
|
|
75
|
+
"@qilin-agent/client-shortcuts": "3.1.6",
|
|
76
|
+
"@qilin-agent/client-store": "3.1.6",
|
|
77
|
+
"@qilin-agent/client-ui-slots": "3.1.6",
|
|
78
|
+
"@qilin-agent/client-ui-primitives": "3.1.6",
|
|
79
|
+
"@qilin-agent/client-locale": "3.1.6",
|
|
80
|
+
"@qilin-agent/kylin-plugin-include": "~1.0.10",
|
|
81
|
+
"@qilin-agent/kylin-plugin-loader": "~1.0.6",
|
|
82
|
+
"@qilin-agent/host-webserver": "3.1.6",
|
|
83
|
+
"@qilin-agent/cmdline": "3.1.6",
|
|
84
|
+
"@qilin-agent/client-connection": "3.1.6",
|
|
85
|
+
"@qilin-agent/kylin": "~4.0.5",
|
|
86
|
+
"@qilin-agent/brand": "3.1.6",
|
|
87
|
+
"@qilin-agent/client-modules": "3.1.6"
|
|
92
88
|
}
|
|
93
89
|
}
|
package/cordis.patch.yml
DELETED
/package/lib/devtools/chunks/{_qilin-devtools_empty-BvRk9kiK.js → _dsh-devtools_empty-BvRk9kiK.js}
RENAMED
|
File without changes
|