adhdev 0.8.46 → 0.8.48
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/cli/index.js +53 -21
- package/dist/cli/index.js.map +1 -1
- package/dist/index.js +53 -21
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1833,6 +1833,8 @@ var init_manager = __esm({
|
|
|
1833
1833
|
allTargets = result?.targetInfos || [];
|
|
1834
1834
|
}
|
|
1835
1835
|
const pageWebviewUrls = await this.getCurrentPageWebviewUrls();
|
|
1836
|
+
const pageWebviewOrder = /* @__PURE__ */ new Map();
|
|
1837
|
+
Array.from(pageWebviewUrls).forEach((url2, index) => pageWebviewOrder.set(url2, index));
|
|
1836
1838
|
const iframes = allTargets.filter((t) => t.type === "iframe");
|
|
1837
1839
|
const typeMap = /* @__PURE__ */ new Map();
|
|
1838
1840
|
for (const t of allTargets) {
|
|
@@ -1874,6 +1876,14 @@ var init_manager = __esm({
|
|
|
1874
1876
|
}
|
|
1875
1877
|
}
|
|
1876
1878
|
}
|
|
1879
|
+
agents.sort((lhs, rhs) => {
|
|
1880
|
+
const leftOrder = pageWebviewOrder.get(lhs.url);
|
|
1881
|
+
const rightOrder = pageWebviewOrder.get(rhs.url);
|
|
1882
|
+
if (leftOrder != null && rightOrder != null) return leftOrder - rightOrder;
|
|
1883
|
+
if (leftOrder != null) return -1;
|
|
1884
|
+
if (rightOrder != null) return 1;
|
|
1885
|
+
return lhs.url.localeCompare(rhs.url);
|
|
1886
|
+
});
|
|
1877
1887
|
this._lastDiscoveredTargets = new Set(agents.map((a) => a.targetId));
|
|
1878
1888
|
return agents;
|
|
1879
1889
|
} catch (e) {
|
|
@@ -2012,6 +2022,26 @@ var init_manager = __esm({
|
|
|
2012
2022
|
}
|
|
2013
2023
|
async getCurrentPageWebviewUrls() {
|
|
2014
2024
|
if (!this.isConnected) return /* @__PURE__ */ new Set();
|
|
2025
|
+
try {
|
|
2026
|
+
const raw = await this.evaluate(
|
|
2027
|
+
`JSON.stringify(Array.from(document.querySelectorAll('iframe,webview'))
|
|
2028
|
+
.filter((el) => {
|
|
2029
|
+
const rect = el.getBoundingClientRect();
|
|
2030
|
+
if (rect.width <= 8 || rect.height <= 8) return false;
|
|
2031
|
+
const style = window.getComputedStyle(el);
|
|
2032
|
+
return style.display !== 'none' && style.visibility !== 'hidden';
|
|
2033
|
+
})
|
|
2034
|
+
.map((el) => el.src || el.getAttribute('src') || '')
|
|
2035
|
+
.filter((src) => typeof src === 'string' && src.includes('vscode-webview')))`,
|
|
2036
|
+
5e3
|
|
2037
|
+
);
|
|
2038
|
+
const parsed = typeof raw === "string" ? JSON.parse(raw) : raw;
|
|
2039
|
+
if (Array.isArray(parsed)) {
|
|
2040
|
+
const urls = parsed.filter((src) => typeof src === "string" && src.length > 0);
|
|
2041
|
+
if (urls.length > 0) return new Set(urls);
|
|
2042
|
+
}
|
|
2043
|
+
} catch {
|
|
2044
|
+
}
|
|
2015
2045
|
try {
|
|
2016
2046
|
const urls = /* @__PURE__ */ new Set();
|
|
2017
2047
|
const { frameTree } = await this.sendInternal("Page.getFrameTree", {}, 5e3);
|
|
@@ -2023,19 +2053,7 @@ var init_manager = __esm({
|
|
|
2023
2053
|
for (const child of node?.childFrames || []) visit(child);
|
|
2024
2054
|
};
|
|
2025
2055
|
if (frameTree) visit(frameTree);
|
|
2026
|
-
|
|
2027
|
-
} catch {
|
|
2028
|
-
}
|
|
2029
|
-
try {
|
|
2030
|
-
const raw = await this.evaluate(
|
|
2031
|
-
`JSON.stringify(Array.from(document.querySelectorAll('iframe,webview'))
|
|
2032
|
-
.map((el) => el.src || el.getAttribute('src') || '')
|
|
2033
|
-
.filter((src) => typeof src === 'string' && src.includes('vscode-webview')))`,
|
|
2034
|
-
5e3
|
|
2035
|
-
);
|
|
2036
|
-
const parsed = typeof raw === "string" ? JSON.parse(raw) : raw;
|
|
2037
|
-
if (!Array.isArray(parsed)) return /* @__PURE__ */ new Set();
|
|
2038
|
-
return new Set(parsed.filter((src) => typeof src === "string" && src.length > 0));
|
|
2056
|
+
return urls;
|
|
2039
2057
|
} catch {
|
|
2040
2058
|
return /* @__PURE__ */ new Set();
|
|
2041
2059
|
}
|
|
@@ -6563,7 +6581,7 @@ async function executeProviderScript(h, args, scriptName) {
|
|
|
6563
6581
|
}
|
|
6564
6582
|
const managed = runtimeSessionId ? h.agentStream?.getManagedSession(runtimeSessionId) : null;
|
|
6565
6583
|
const targetSessionId = managed?.cdpSessionId || null;
|
|
6566
|
-
const IDE_LEVEL_SCRIPTS = ["listModes", "setMode", "listModels", "setModel"];
|
|
6584
|
+
const IDE_LEVEL_SCRIPTS = provider.type === "claude-code-vscode" ? ["listModes", "setMode"] : ["listModes", "setMode", "listModels", "setModel"];
|
|
6567
6585
|
if (IDE_LEVEL_SCRIPTS.includes(scriptName)) {
|
|
6568
6586
|
if (targetSessionId) {
|
|
6569
6587
|
try {
|
|
@@ -10267,14 +10285,18 @@ var init_cli_provider_instance = __esm({
|
|
|
10267
10285
|
}
|
|
10268
10286
|
const runtime = this.adapter.getRuntimeMetadata();
|
|
10269
10287
|
this.maybeAppendRuntimeRecoveryMessage(runtime);
|
|
10270
|
-
|
|
10288
|
+
let parsedMessages = Array.isArray(parsedStatus?.messages) ? parsedStatus.messages : [];
|
|
10289
|
+
const historyMessageCount = Number.isFinite(parsedStatus?.historyMessageCount) ? Math.max(0, Number(parsedStatus.historyMessageCount)) : null;
|
|
10290
|
+
if (historyMessageCount !== null) {
|
|
10291
|
+
parsedMessages = historyMessageCount > 0 ? parsedMessages.slice(-historyMessageCount) : [];
|
|
10292
|
+
}
|
|
10271
10293
|
const controlValues = extractProviderControlValues(this.provider.controls, parsedStatus);
|
|
10272
10294
|
if (controlValues) {
|
|
10273
|
-
this.controlValues = controlValues;
|
|
10274
|
-
} else if (Object.keys(this.controlValues).length > 0) {
|
|
10275
|
-
this.controlValues = {};
|
|
10295
|
+
this.controlValues = { ...this.controlValues, ...controlValues };
|
|
10276
10296
|
}
|
|
10277
10297
|
const mergedMessages = this.mergeConversationMessages(parsedMessages);
|
|
10298
|
+
const currentModel = typeof parsedStatus?.model === "string" && parsedStatus.model.trim() ? parsedStatus.model.trim() : typeof this.controlValues.model === "string" && this.controlValues.model.trim() ? this.controlValues.model.trim() : void 0;
|
|
10299
|
+
const currentPlan = typeof parsedStatus?.mode === "string" && parsedStatus.mode.trim() ? parsedStatus.mode.trim() : typeof this.controlValues.mode === "string" && this.controlValues.mode.trim() ? this.controlValues.mode.trim() : void 0;
|
|
10278
10300
|
const dirName = this.workingDir.split("/").filter(Boolean).pop() || "session";
|
|
10279
10301
|
if (parsedMessages.length > 0) {
|
|
10280
10302
|
const shouldSkipReplayPersist = this.suppressIdleHistoryReplay && adapterStatus.status === "idle" && parsedStatus?.status === "idle";
|
|
@@ -10311,6 +10333,8 @@ var init_cli_provider_instance = __esm({
|
|
|
10311
10333
|
inputContent: ""
|
|
10312
10334
|
},
|
|
10313
10335
|
workspace: this.workingDir,
|
|
10336
|
+
currentModel,
|
|
10337
|
+
currentPlan,
|
|
10314
10338
|
instanceId: this.instanceId,
|
|
10315
10339
|
providerSessionId: this.providerSessionId,
|
|
10316
10340
|
lastUpdated: Date.now(),
|
|
@@ -10500,6 +10524,15 @@ var init_cli_provider_instance = __esm({
|
|
|
10500
10524
|
}
|
|
10501
10525
|
applyProviderResponse(data, options) {
|
|
10502
10526
|
if (!data || typeof data !== "object") return;
|
|
10527
|
+
const patchedProviderSessionId = typeof data.providerSessionId === "string" ? data.providerSessionId.trim() : "";
|
|
10528
|
+
if (patchedProviderSessionId) {
|
|
10529
|
+
this.promoteProviderSessionId(patchedProviderSessionId);
|
|
10530
|
+
}
|
|
10531
|
+
if (data.sessionEvent === "new_session") {
|
|
10532
|
+
this.runtimeMessages = [];
|
|
10533
|
+
this.suppressIdleHistoryReplay = false;
|
|
10534
|
+
this.adapter.clearHistory();
|
|
10535
|
+
}
|
|
10503
10536
|
const controlValues = extractProviderControlValues(this.provider.controls, data);
|
|
10504
10537
|
if (controlValues) {
|
|
10505
10538
|
this.controlValues = { ...this.controlValues, ...controlValues };
|
|
@@ -41758,7 +41791,6 @@ async function initiateConnection(deps, peerId, sharePermission) {
|
|
|
41758
41791
|
const peer = deps.peers.get(pid);
|
|
41759
41792
|
if (!peer) return;
|
|
41760
41793
|
if (pcState === "connected") {
|
|
41761
|
-
peer.state = "connected";
|
|
41762
41794
|
try {
|
|
41763
41795
|
const pair = pc.getSelectedCandidatePair?.();
|
|
41764
41796
|
if (pair) {
|
|
@@ -41773,7 +41805,6 @@ async function initiateConnection(deps, peerId, sharePermission) {
|
|
|
41773
41805
|
clearTimeout(peer.failedCleanupTimer);
|
|
41774
41806
|
peer.failedCleanupTimer = void 0;
|
|
41775
41807
|
}
|
|
41776
|
-
startHeartbeat(deps.peers, pid, deps.notifyStateChange);
|
|
41777
41808
|
deps.notifyStateChange();
|
|
41778
41809
|
} else if (pcState === "failed" || pcState === "closed") {
|
|
41779
41810
|
peer.state = "failed";
|
|
@@ -41796,6 +41827,7 @@ async function initiateConnection(deps, peerId, sharePermission) {
|
|
|
41796
41827
|
const peer = deps.peers.get(pid);
|
|
41797
41828
|
if (peer) {
|
|
41798
41829
|
peer.state = "connected";
|
|
41830
|
+
startHeartbeat(deps.peers, pid, deps.notifyStateChange);
|
|
41799
41831
|
deps.notifyStateChange();
|
|
41800
41832
|
if (peer.screenshotActive) {
|
|
41801
41833
|
log(`Screenshots auto-starting for peer ${pid} (was waiting for channel open)`);
|
|
@@ -49526,7 +49558,7 @@ var init_adhdev_daemon = __esm({
|
|
|
49526
49558
|
import_ws3 = require("ws");
|
|
49527
49559
|
import_chalk2 = __toESM(require("chalk"));
|
|
49528
49560
|
init_version();
|
|
49529
|
-
pkgVersion = resolvePackageVersion({ injectedVersion: "0.8.
|
|
49561
|
+
pkgVersion = resolvePackageVersion({ injectedVersion: "0.8.48" });
|
|
49530
49562
|
ACTIVE_CHAT_POLL_STATUSES = /* @__PURE__ */ new Set([
|
|
49531
49563
|
"generating",
|
|
49532
49564
|
"waiting_approval",
|