@adhdev/daemon-core 0.8.45 → 0.8.47
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/index.js +32 -14
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +32 -14
- package/dist/index.mjs.map +1 -1
- package/node_modules/@adhdev/session-host-core/package.json +1 -1
- package/package.json +1 -1
- package/src/cdp/manager.ts +33 -14
- package/src/commands/stream-commands.ts +3 -1
package/dist/index.mjs
CHANGED
|
@@ -4330,6 +4330,8 @@ var DaemonCdpManager = class {
|
|
|
4330
4330
|
allTargets = result?.targetInfos || [];
|
|
4331
4331
|
}
|
|
4332
4332
|
const pageWebviewUrls = await this.getCurrentPageWebviewUrls();
|
|
4333
|
+
const pageWebviewOrder = /* @__PURE__ */ new Map();
|
|
4334
|
+
Array.from(pageWebviewUrls).forEach((url, index) => pageWebviewOrder.set(url, index));
|
|
4333
4335
|
const iframes = allTargets.filter((t) => t.type === "iframe");
|
|
4334
4336
|
const typeMap = /* @__PURE__ */ new Map();
|
|
4335
4337
|
for (const t of allTargets) {
|
|
@@ -4371,6 +4373,14 @@ var DaemonCdpManager = class {
|
|
|
4371
4373
|
}
|
|
4372
4374
|
}
|
|
4373
4375
|
}
|
|
4376
|
+
agents.sort((lhs, rhs) => {
|
|
4377
|
+
const leftOrder = pageWebviewOrder.get(lhs.url);
|
|
4378
|
+
const rightOrder = pageWebviewOrder.get(rhs.url);
|
|
4379
|
+
if (leftOrder != null && rightOrder != null) return leftOrder - rightOrder;
|
|
4380
|
+
if (leftOrder != null) return -1;
|
|
4381
|
+
if (rightOrder != null) return 1;
|
|
4382
|
+
return lhs.url.localeCompare(rhs.url);
|
|
4383
|
+
});
|
|
4374
4384
|
this._lastDiscoveredTargets = new Set(agents.map((a) => a.targetId));
|
|
4375
4385
|
return agents;
|
|
4376
4386
|
} catch (e) {
|
|
@@ -4509,6 +4519,26 @@ var DaemonCdpManager = class {
|
|
|
4509
4519
|
}
|
|
4510
4520
|
async getCurrentPageWebviewUrls() {
|
|
4511
4521
|
if (!this.isConnected) return /* @__PURE__ */ new Set();
|
|
4522
|
+
try {
|
|
4523
|
+
const raw = await this.evaluate(
|
|
4524
|
+
`JSON.stringify(Array.from(document.querySelectorAll('iframe,webview'))
|
|
4525
|
+
.filter((el) => {
|
|
4526
|
+
const rect = el.getBoundingClientRect();
|
|
4527
|
+
if (rect.width <= 8 || rect.height <= 8) return false;
|
|
4528
|
+
const style = window.getComputedStyle(el);
|
|
4529
|
+
return style.display !== 'none' && style.visibility !== 'hidden';
|
|
4530
|
+
})
|
|
4531
|
+
.map((el) => el.src || el.getAttribute('src') || '')
|
|
4532
|
+
.filter((src) => typeof src === 'string' && src.includes('vscode-webview')))`,
|
|
4533
|
+
5e3
|
|
4534
|
+
);
|
|
4535
|
+
const parsed = typeof raw === "string" ? JSON.parse(raw) : raw;
|
|
4536
|
+
if (Array.isArray(parsed)) {
|
|
4537
|
+
const urls = parsed.filter((src) => typeof src === "string" && src.length > 0);
|
|
4538
|
+
if (urls.length > 0) return new Set(urls);
|
|
4539
|
+
}
|
|
4540
|
+
} catch {
|
|
4541
|
+
}
|
|
4512
4542
|
try {
|
|
4513
4543
|
const urls = /* @__PURE__ */ new Set();
|
|
4514
4544
|
const { frameTree } = await this.sendInternal("Page.getFrameTree", {}, 5e3);
|
|
@@ -4520,19 +4550,7 @@ var DaemonCdpManager = class {
|
|
|
4520
4550
|
for (const child of node?.childFrames || []) visit(child);
|
|
4521
4551
|
};
|
|
4522
4552
|
if (frameTree) visit(frameTree);
|
|
4523
|
-
|
|
4524
|
-
} catch {
|
|
4525
|
-
}
|
|
4526
|
-
try {
|
|
4527
|
-
const raw = await this.evaluate(
|
|
4528
|
-
`JSON.stringify(Array.from(document.querySelectorAll('iframe,webview'))
|
|
4529
|
-
.map((el) => el.src || el.getAttribute('src') || '')
|
|
4530
|
-
.filter((src) => typeof src === 'string' && src.includes('vscode-webview')))`,
|
|
4531
|
-
5e3
|
|
4532
|
-
);
|
|
4533
|
-
const parsed = typeof raw === "string" ? JSON.parse(raw) : raw;
|
|
4534
|
-
if (!Array.isArray(parsed)) return /* @__PURE__ */ new Set();
|
|
4535
|
-
return new Set(parsed.filter((src) => typeof src === "string" && src.length > 0));
|
|
4553
|
+
return urls;
|
|
4536
4554
|
} catch {
|
|
4537
4555
|
return /* @__PURE__ */ new Set();
|
|
4538
4556
|
}
|
|
@@ -8956,7 +8974,7 @@ async function executeProviderScript(h, args, scriptName) {
|
|
|
8956
8974
|
}
|
|
8957
8975
|
const managed = runtimeSessionId ? h.agentStream?.getManagedSession(runtimeSessionId) : null;
|
|
8958
8976
|
const targetSessionId = managed?.cdpSessionId || null;
|
|
8959
|
-
const IDE_LEVEL_SCRIPTS = ["listModes", "setMode", "listModels", "setModel"];
|
|
8977
|
+
const IDE_LEVEL_SCRIPTS = provider.type === "claude-code-vscode" ? ["listModes", "setMode"] : ["listModes", "setMode", "listModels", "setModel"];
|
|
8960
8978
|
if (IDE_LEVEL_SCRIPTS.includes(scriptName)) {
|
|
8961
8979
|
if (targetSessionId) {
|
|
8962
8980
|
try {
|