@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.js
CHANGED
|
@@ -4417,6 +4417,8 @@ var DaemonCdpManager = class {
|
|
|
4417
4417
|
allTargets = result?.targetInfos || [];
|
|
4418
4418
|
}
|
|
4419
4419
|
const pageWebviewUrls = await this.getCurrentPageWebviewUrls();
|
|
4420
|
+
const pageWebviewOrder = /* @__PURE__ */ new Map();
|
|
4421
|
+
Array.from(pageWebviewUrls).forEach((url, index) => pageWebviewOrder.set(url, index));
|
|
4420
4422
|
const iframes = allTargets.filter((t) => t.type === "iframe");
|
|
4421
4423
|
const typeMap = /* @__PURE__ */ new Map();
|
|
4422
4424
|
for (const t of allTargets) {
|
|
@@ -4458,6 +4460,14 @@ var DaemonCdpManager = class {
|
|
|
4458
4460
|
}
|
|
4459
4461
|
}
|
|
4460
4462
|
}
|
|
4463
|
+
agents.sort((lhs, rhs) => {
|
|
4464
|
+
const leftOrder = pageWebviewOrder.get(lhs.url);
|
|
4465
|
+
const rightOrder = pageWebviewOrder.get(rhs.url);
|
|
4466
|
+
if (leftOrder != null && rightOrder != null) return leftOrder - rightOrder;
|
|
4467
|
+
if (leftOrder != null) return -1;
|
|
4468
|
+
if (rightOrder != null) return 1;
|
|
4469
|
+
return lhs.url.localeCompare(rhs.url);
|
|
4470
|
+
});
|
|
4461
4471
|
this._lastDiscoveredTargets = new Set(agents.map((a) => a.targetId));
|
|
4462
4472
|
return agents;
|
|
4463
4473
|
} catch (e) {
|
|
@@ -4596,6 +4606,26 @@ var DaemonCdpManager = class {
|
|
|
4596
4606
|
}
|
|
4597
4607
|
async getCurrentPageWebviewUrls() {
|
|
4598
4608
|
if (!this.isConnected) return /* @__PURE__ */ new Set();
|
|
4609
|
+
try {
|
|
4610
|
+
const raw = await this.evaluate(
|
|
4611
|
+
`JSON.stringify(Array.from(document.querySelectorAll('iframe,webview'))
|
|
4612
|
+
.filter((el) => {
|
|
4613
|
+
const rect = el.getBoundingClientRect();
|
|
4614
|
+
if (rect.width <= 8 || rect.height <= 8) return false;
|
|
4615
|
+
const style = window.getComputedStyle(el);
|
|
4616
|
+
return style.display !== 'none' && style.visibility !== 'hidden';
|
|
4617
|
+
})
|
|
4618
|
+
.map((el) => el.src || el.getAttribute('src') || '')
|
|
4619
|
+
.filter((src) => typeof src === 'string' && src.includes('vscode-webview')))`,
|
|
4620
|
+
5e3
|
|
4621
|
+
);
|
|
4622
|
+
const parsed = typeof raw === "string" ? JSON.parse(raw) : raw;
|
|
4623
|
+
if (Array.isArray(parsed)) {
|
|
4624
|
+
const urls = parsed.filter((src) => typeof src === "string" && src.length > 0);
|
|
4625
|
+
if (urls.length > 0) return new Set(urls);
|
|
4626
|
+
}
|
|
4627
|
+
} catch {
|
|
4628
|
+
}
|
|
4599
4629
|
try {
|
|
4600
4630
|
const urls = /* @__PURE__ */ new Set();
|
|
4601
4631
|
const { frameTree } = await this.sendInternal("Page.getFrameTree", {}, 5e3);
|
|
@@ -4607,19 +4637,7 @@ var DaemonCdpManager = class {
|
|
|
4607
4637
|
for (const child of node?.childFrames || []) visit(child);
|
|
4608
4638
|
};
|
|
4609
4639
|
if (frameTree) visit(frameTree);
|
|
4610
|
-
|
|
4611
|
-
} catch {
|
|
4612
|
-
}
|
|
4613
|
-
try {
|
|
4614
|
-
const raw = await this.evaluate(
|
|
4615
|
-
`JSON.stringify(Array.from(document.querySelectorAll('iframe,webview'))
|
|
4616
|
-
.map((el) => el.src || el.getAttribute('src') || '')
|
|
4617
|
-
.filter((src) => typeof src === 'string' && src.includes('vscode-webview')))`,
|
|
4618
|
-
5e3
|
|
4619
|
-
);
|
|
4620
|
-
const parsed = typeof raw === "string" ? JSON.parse(raw) : raw;
|
|
4621
|
-
if (!Array.isArray(parsed)) return /* @__PURE__ */ new Set();
|
|
4622
|
-
return new Set(parsed.filter((src) => typeof src === "string" && src.length > 0));
|
|
4640
|
+
return urls;
|
|
4623
4641
|
} catch {
|
|
4624
4642
|
return /* @__PURE__ */ new Set();
|
|
4625
4643
|
}
|
|
@@ -9043,7 +9061,7 @@ async function executeProviderScript(h, args, scriptName) {
|
|
|
9043
9061
|
}
|
|
9044
9062
|
const managed = runtimeSessionId ? h.agentStream?.getManagedSession(runtimeSessionId) : null;
|
|
9045
9063
|
const targetSessionId = managed?.cdpSessionId || null;
|
|
9046
|
-
const IDE_LEVEL_SCRIPTS = ["listModes", "setMode", "listModels", "setModel"];
|
|
9064
|
+
const IDE_LEVEL_SCRIPTS = provider.type === "claude-code-vscode" ? ["listModes", "setMode"] : ["listModes", "setMode", "listModels", "setModel"];
|
|
9047
9065
|
if (IDE_LEVEL_SCRIPTS.includes(scriptName)) {
|
|
9048
9066
|
if (targetSessionId) {
|
|
9049
9067
|
try {
|