@adhdev/daemon-standalone 0.8.93 → 0.8.95
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 +411 -142
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/public/assets/index-BHooxeLf.js +79 -0
- package/public/assets/index-DHunFxdM.css +1 -0
- package/public/index.html +2 -2
- package/public/assets/index-B0yfK9dM.css +0 -1
- package/public/assets/index-BX2fAu2N.js +0 -79
package/dist/index.js
CHANGED
|
@@ -30353,7 +30353,7 @@ var require_dist2 = __commonJS({
|
|
|
30353
30353
|
`[${this.cliType}] Waiting for interactive prompt: hasPrompt=${hasPrompt} stableMs=${stableMs} recentOutputMs=${recentlyOutput} status=${status} startup=${startupLikelyActive} screen=${JSON.stringify(summarizeCliTraceText(screenText, 220)).slice(0, 260)}`
|
|
30354
30354
|
);
|
|
30355
30355
|
}
|
|
30356
|
-
await new Promise((
|
|
30356
|
+
await new Promise((resolve12) => setTimeout(resolve12, 50));
|
|
30357
30357
|
}
|
|
30358
30358
|
const finalScreenText = this.terminalScreen.getText() || "";
|
|
30359
30359
|
LOG2.warn(
|
|
@@ -30941,7 +30941,7 @@ var require_dist2 = __commonJS({
|
|
|
30941
30941
|
}
|
|
30942
30942
|
projectEffectiveStatus(startupModal = null) {
|
|
30943
30943
|
if (this.parseErrorMessage) return "error";
|
|
30944
|
-
if (startupModal) return "waiting_approval";
|
|
30944
|
+
if (startupModal || this.activeModal) return "waiting_approval";
|
|
30945
30945
|
if (this.isWaitingForResponse && this.currentTurnScope && this.currentStatus === "idle") return "generating";
|
|
30946
30946
|
return this.currentStatus;
|
|
30947
30947
|
}
|
|
@@ -30949,12 +30949,24 @@ var require_dist2 = __commonJS({
|
|
|
30949
30949
|
getStatus() {
|
|
30950
30950
|
const screenText = this.terminalScreen.getText() || "";
|
|
30951
30951
|
const startupModal = this.startupParseGate ? this.getStartupConfirmationModal(screenText) : null;
|
|
30952
|
-
|
|
30952
|
+
let effectiveStatus = this.projectEffectiveStatus(startupModal);
|
|
30953
|
+
let effectiveModal = startupModal || this.activeModal;
|
|
30954
|
+
if (!startupModal && !effectiveModal && typeof this.cliScripts?.parseOutput === "function") {
|
|
30955
|
+
try {
|
|
30956
|
+
const parsed = this.getScriptParsedStatus();
|
|
30957
|
+
const parsedModal = parsed?.activeModal && Array.isArray(parsed.activeModal.buttons) && parsed.activeModal.buttons.some((button) => typeof button === "string" && button.trim()) ? parsed.activeModal : null;
|
|
30958
|
+
if (parsed?.status === "waiting_approval" && parsedModal) {
|
|
30959
|
+
effectiveStatus = "waiting_approval";
|
|
30960
|
+
effectiveModal = parsedModal;
|
|
30961
|
+
}
|
|
30962
|
+
} catch {
|
|
30963
|
+
}
|
|
30964
|
+
}
|
|
30953
30965
|
return {
|
|
30954
30966
|
status: effectiveStatus,
|
|
30955
30967
|
messages: [...this.committedMessages],
|
|
30956
30968
|
workingDir: this.workingDir,
|
|
30957
|
-
activeModal:
|
|
30969
|
+
activeModal: effectiveModal,
|
|
30958
30970
|
errorMessage: this.parseErrorMessage || void 0,
|
|
30959
30971
|
errorReason: this.parseErrorMessage ? "parse_error" : void 0
|
|
30960
30972
|
};
|
|
@@ -30990,6 +31002,15 @@ var require_dist2 = __commonJS({
|
|
|
30990
31002
|
this.currentTurnScope,
|
|
30991
31003
|
screenText
|
|
30992
31004
|
);
|
|
31005
|
+
const parsedModal = parsed?.activeModal && Array.isArray(parsed.activeModal.buttons) && parsed.activeModal.buttons.some((button) => typeof button === "string" && button.trim()) ? parsed.activeModal : null;
|
|
31006
|
+
if (parsedModal && parsed?.status === "waiting_approval") {
|
|
31007
|
+
this.activeModal = parsedModal;
|
|
31008
|
+
this.isWaitingForResponse = true;
|
|
31009
|
+
if (this.currentStatus !== "waiting_approval") {
|
|
31010
|
+
this.setStatus("waiting_approval", "parsed_waiting_approval");
|
|
31011
|
+
this.onStatusChange?.();
|
|
31012
|
+
}
|
|
31013
|
+
}
|
|
30993
31014
|
if (this.maybeCommitVisibleIdleTranscript(parsed)) {
|
|
30994
31015
|
return this.getScriptParsedStatus();
|
|
30995
31016
|
}
|
|
@@ -31194,7 +31215,7 @@ ${data.message || ""}`.trim();
|
|
|
31194
31215
|
const deadline = Date.now() + 1e4;
|
|
31195
31216
|
while (this.startupParseGate && Date.now() < deadline) {
|
|
31196
31217
|
this.resolveStartupState("send_wait");
|
|
31197
|
-
await new Promise((
|
|
31218
|
+
await new Promise((resolve12) => setTimeout(resolve12, 50));
|
|
31198
31219
|
}
|
|
31199
31220
|
}
|
|
31200
31221
|
if (!allowInterventionPrompt) {
|
|
@@ -31286,12 +31307,12 @@ ${data.message || ""}`.trim();
|
|
|
31286
31307
|
if (this.isWaitingForResponse) this.finishResponse();
|
|
31287
31308
|
}, this.timeouts.maxResponse);
|
|
31288
31309
|
};
|
|
31289
|
-
await new Promise((
|
|
31310
|
+
await new Promise((resolve12) => {
|
|
31290
31311
|
let resolved = false;
|
|
31291
31312
|
const resolveOnce = () => {
|
|
31292
31313
|
if (resolved) return;
|
|
31293
31314
|
resolved = true;
|
|
31294
|
-
|
|
31315
|
+
resolve12();
|
|
31295
31316
|
};
|
|
31296
31317
|
const submit = () => {
|
|
31297
31318
|
if (!this.ptyProcess) {
|
|
@@ -31465,17 +31486,17 @@ ${data.message || ""}`.trim();
|
|
|
31465
31486
|
}
|
|
31466
31487
|
}
|
|
31467
31488
|
waitForStopped(timeoutMs) {
|
|
31468
|
-
return new Promise((
|
|
31489
|
+
return new Promise((resolve12) => {
|
|
31469
31490
|
const startedAt = Date.now();
|
|
31470
31491
|
const timer = setInterval(() => {
|
|
31471
31492
|
if (!this.ptyProcess || this.currentStatus === "stopped") {
|
|
31472
31493
|
clearInterval(timer);
|
|
31473
|
-
|
|
31494
|
+
resolve12(true);
|
|
31474
31495
|
return;
|
|
31475
31496
|
}
|
|
31476
31497
|
if (Date.now() - startedAt >= timeoutMs) {
|
|
31477
31498
|
clearInterval(timer);
|
|
31478
|
-
|
|
31499
|
+
resolve12(false);
|
|
31479
31500
|
}
|
|
31480
31501
|
}, 100);
|
|
31481
31502
|
});
|
|
@@ -31640,7 +31661,22 @@ ${data.message || ""}`.trim();
|
|
|
31640
31661
|
}
|
|
31641
31662
|
resolveModal(buttonIndex) {
|
|
31642
31663
|
const screenText = this.terminalScreen.getText() || "";
|
|
31643
|
-
|
|
31664
|
+
let modal = this.activeModal || this.getStartupConfirmationModal(screenText);
|
|
31665
|
+
if (!modal && typeof this.cliScripts?.parseOutput === "function") {
|
|
31666
|
+
try {
|
|
31667
|
+
const parsed = this.getScriptParsedStatus();
|
|
31668
|
+
const parsedModal = parsed?.activeModal && Array.isArray(parsed.activeModal.buttons) && parsed.activeModal.buttons.some((button) => typeof button === "string" && button.trim()) ? parsed.activeModal : null;
|
|
31669
|
+
if (parsed?.status === "waiting_approval" && parsedModal) {
|
|
31670
|
+
modal = parsedModal;
|
|
31671
|
+
this.activeModal = parsedModal;
|
|
31672
|
+
if (this.currentStatus !== "waiting_approval") {
|
|
31673
|
+
this.setStatus("waiting_approval", "resolve_modal_parse");
|
|
31674
|
+
this.onStatusChange?.();
|
|
31675
|
+
}
|
|
31676
|
+
}
|
|
31677
|
+
} catch {
|
|
31678
|
+
}
|
|
31679
|
+
}
|
|
31644
31680
|
if (!this.ptyProcess || this.currentStatus !== "waiting_approval" && !modal) return;
|
|
31645
31681
|
this.clearIdleFinishCandidate("resolve_modal");
|
|
31646
31682
|
this.recordTrace("resolve_modal", {
|
|
@@ -32580,15 +32616,15 @@ ${data.message || ""}`.trim();
|
|
|
32580
32616
|
return null;
|
|
32581
32617
|
}
|
|
32582
32618
|
function execAsync(cmd, timeoutMs = 5e3) {
|
|
32583
|
-
return new Promise((
|
|
32619
|
+
return new Promise((resolve12) => {
|
|
32584
32620
|
const child = (0, import_child_process2.exec)(cmd, { encoding: "utf-8", timeout: timeoutMs }, (err, stdout) => {
|
|
32585
32621
|
if (err || !stdout?.trim()) {
|
|
32586
|
-
|
|
32622
|
+
resolve12(null);
|
|
32587
32623
|
} else {
|
|
32588
|
-
|
|
32624
|
+
resolve12(stdout.trim());
|
|
32589
32625
|
}
|
|
32590
32626
|
});
|
|
32591
|
-
child.on("error", () =>
|
|
32627
|
+
child.on("error", () => resolve12(null));
|
|
32592
32628
|
});
|
|
32593
32629
|
}
|
|
32594
32630
|
async function detectCLIs(providerLoader, options) {
|
|
@@ -32940,7 +32976,7 @@ ${data.message || ""}`.trim();
|
|
|
32940
32976
|
* Returns multiple entries if multiple IDE windows are open on same port
|
|
32941
32977
|
*/
|
|
32942
32978
|
static listAllTargets(port) {
|
|
32943
|
-
return new Promise((
|
|
32979
|
+
return new Promise((resolve12) => {
|
|
32944
32980
|
const req = http.get(`http://127.0.0.1:${port}/json`, (res) => {
|
|
32945
32981
|
let data = "";
|
|
32946
32982
|
res.on("data", (chunk) => data += chunk.toString());
|
|
@@ -32956,16 +32992,16 @@ ${data.message || ""}`.trim();
|
|
|
32956
32992
|
(t) => !isNonMain(t.title || "") && t.url?.includes("workbench.html") && !t.url?.includes("agent")
|
|
32957
32993
|
);
|
|
32958
32994
|
const fallbackPages = pages.filter((t) => !isNonMain(t.title || ""));
|
|
32959
|
-
|
|
32995
|
+
resolve12(mainPages.length > 0 ? mainPages : fallbackPages);
|
|
32960
32996
|
} catch {
|
|
32961
|
-
|
|
32997
|
+
resolve12([]);
|
|
32962
32998
|
}
|
|
32963
32999
|
});
|
|
32964
33000
|
});
|
|
32965
|
-
req.on("error", () =>
|
|
33001
|
+
req.on("error", () => resolve12([]));
|
|
32966
33002
|
req.setTimeout(2e3, () => {
|
|
32967
33003
|
req.destroy();
|
|
32968
|
-
|
|
33004
|
+
resolve12([]);
|
|
32969
33005
|
});
|
|
32970
33006
|
});
|
|
32971
33007
|
}
|
|
@@ -33005,7 +33041,7 @@ ${data.message || ""}`.trim();
|
|
|
33005
33041
|
}
|
|
33006
33042
|
}
|
|
33007
33043
|
findTargetOnPort(port) {
|
|
33008
|
-
return new Promise((
|
|
33044
|
+
return new Promise((resolve12) => {
|
|
33009
33045
|
const req = http.get(`http://127.0.0.1:${port}/json`, (res) => {
|
|
33010
33046
|
let data = "";
|
|
33011
33047
|
res.on("data", (chunk) => data += chunk.toString());
|
|
@@ -33016,7 +33052,7 @@ ${data.message || ""}`.trim();
|
|
|
33016
33052
|
(t) => (t.type === "page" || t.type === "browser" || t.type === "Page") && t.webSocketDebuggerUrl
|
|
33017
33053
|
);
|
|
33018
33054
|
if (pages.length === 0) {
|
|
33019
|
-
|
|
33055
|
+
resolve12(targets.find((t) => t.webSocketDebuggerUrl) || null);
|
|
33020
33056
|
return;
|
|
33021
33057
|
}
|
|
33022
33058
|
const titleFilteredPages = pages.filter((t) => !this.isNonMainTitle(t.title || ""));
|
|
@@ -33035,25 +33071,25 @@ ${data.message || ""}`.trim();
|
|
|
33035
33071
|
this._targetId = selected.target.id;
|
|
33036
33072
|
}
|
|
33037
33073
|
this._pageTitle = selected.target.title || "";
|
|
33038
|
-
|
|
33074
|
+
resolve12(selected.target);
|
|
33039
33075
|
return;
|
|
33040
33076
|
}
|
|
33041
33077
|
if (previousTargetId) {
|
|
33042
33078
|
this.log(`[CDP] Target ${previousTargetId} not found in page list`);
|
|
33043
|
-
|
|
33079
|
+
resolve12(null);
|
|
33044
33080
|
return;
|
|
33045
33081
|
}
|
|
33046
33082
|
this._pageTitle = list[0]?.title || "";
|
|
33047
|
-
|
|
33083
|
+
resolve12(list[0]);
|
|
33048
33084
|
} catch {
|
|
33049
|
-
|
|
33085
|
+
resolve12(null);
|
|
33050
33086
|
}
|
|
33051
33087
|
});
|
|
33052
33088
|
});
|
|
33053
|
-
req.on("error", () =>
|
|
33089
|
+
req.on("error", () => resolve12(null));
|
|
33054
33090
|
req.setTimeout(2e3, () => {
|
|
33055
33091
|
req.destroy();
|
|
33056
|
-
|
|
33092
|
+
resolve12(null);
|
|
33057
33093
|
});
|
|
33058
33094
|
});
|
|
33059
33095
|
}
|
|
@@ -33064,7 +33100,7 @@ ${data.message || ""}`.trim();
|
|
|
33064
33100
|
this.extensionProviders = providers;
|
|
33065
33101
|
}
|
|
33066
33102
|
connectToTarget(wsUrl) {
|
|
33067
|
-
return new Promise((
|
|
33103
|
+
return new Promise((resolve12) => {
|
|
33068
33104
|
this.ws = new import_ws2.default(wsUrl);
|
|
33069
33105
|
this.ws.on("open", async () => {
|
|
33070
33106
|
this._connected = true;
|
|
@@ -33074,17 +33110,17 @@ ${data.message || ""}`.trim();
|
|
|
33074
33110
|
}
|
|
33075
33111
|
this.connectBrowserWs().catch(() => {
|
|
33076
33112
|
});
|
|
33077
|
-
|
|
33113
|
+
resolve12(true);
|
|
33078
33114
|
});
|
|
33079
33115
|
this.ws.on("message", (data) => {
|
|
33080
33116
|
try {
|
|
33081
33117
|
const msg = JSON.parse(data.toString());
|
|
33082
33118
|
if (msg.id && this.pending.has(msg.id)) {
|
|
33083
|
-
const { resolve:
|
|
33119
|
+
const { resolve: resolve13, reject } = this.pending.get(msg.id);
|
|
33084
33120
|
this.pending.delete(msg.id);
|
|
33085
33121
|
this.failureCount = 0;
|
|
33086
33122
|
if (msg.error) reject(new Error(msg.error.message));
|
|
33087
|
-
else
|
|
33123
|
+
else resolve13(msg.result);
|
|
33088
33124
|
} else if (msg.method === "Runtime.executionContextCreated") {
|
|
33089
33125
|
this.contexts.add(msg.params.context.id);
|
|
33090
33126
|
} else if (msg.method === "Runtime.executionContextDestroyed") {
|
|
@@ -33107,7 +33143,7 @@ ${data.message || ""}`.trim();
|
|
|
33107
33143
|
this.ws.on("error", (err) => {
|
|
33108
33144
|
this.log(`[CDP] WebSocket error: ${err.message}`);
|
|
33109
33145
|
this._connected = false;
|
|
33110
|
-
|
|
33146
|
+
resolve12(false);
|
|
33111
33147
|
});
|
|
33112
33148
|
});
|
|
33113
33149
|
}
|
|
@@ -33121,7 +33157,7 @@ ${data.message || ""}`.trim();
|
|
|
33121
33157
|
return;
|
|
33122
33158
|
}
|
|
33123
33159
|
this.log(`[CDP] Connecting browser WS for target discovery...`);
|
|
33124
|
-
await new Promise((
|
|
33160
|
+
await new Promise((resolve12, reject) => {
|
|
33125
33161
|
this.browserWs = new import_ws2.default(browserWsUrl);
|
|
33126
33162
|
this.browserWs.on("open", async () => {
|
|
33127
33163
|
this._browserConnected = true;
|
|
@@ -33131,16 +33167,16 @@ ${data.message || ""}`.trim();
|
|
|
33131
33167
|
} catch (e) {
|
|
33132
33168
|
this.log(`[CDP] setDiscoverTargets failed: ${e.message}`);
|
|
33133
33169
|
}
|
|
33134
|
-
|
|
33170
|
+
resolve12();
|
|
33135
33171
|
});
|
|
33136
33172
|
this.browserWs.on("message", (data) => {
|
|
33137
33173
|
try {
|
|
33138
33174
|
const msg = JSON.parse(data.toString());
|
|
33139
33175
|
if (msg.id && this.browserPending.has(msg.id)) {
|
|
33140
|
-
const { resolve:
|
|
33176
|
+
const { resolve: resolve13, reject: reject2 } = this.browserPending.get(msg.id);
|
|
33141
33177
|
this.browserPending.delete(msg.id);
|
|
33142
33178
|
if (msg.error) reject2(new Error(msg.error.message));
|
|
33143
|
-
else
|
|
33179
|
+
else resolve13(msg.result);
|
|
33144
33180
|
}
|
|
33145
33181
|
} catch {
|
|
33146
33182
|
}
|
|
@@ -33160,31 +33196,31 @@ ${data.message || ""}`.trim();
|
|
|
33160
33196
|
}
|
|
33161
33197
|
}
|
|
33162
33198
|
getBrowserWsUrl() {
|
|
33163
|
-
return new Promise((
|
|
33199
|
+
return new Promise((resolve12) => {
|
|
33164
33200
|
const req = http.get(`http://127.0.0.1:${this.port}/json/version`, (res) => {
|
|
33165
33201
|
let data = "";
|
|
33166
33202
|
res.on("data", (chunk) => data += chunk.toString());
|
|
33167
33203
|
res.on("end", () => {
|
|
33168
33204
|
try {
|
|
33169
33205
|
const info = JSON.parse(data);
|
|
33170
|
-
|
|
33206
|
+
resolve12(info.webSocketDebuggerUrl || null);
|
|
33171
33207
|
} catch {
|
|
33172
|
-
|
|
33208
|
+
resolve12(null);
|
|
33173
33209
|
}
|
|
33174
33210
|
});
|
|
33175
33211
|
});
|
|
33176
|
-
req.on("error", () =>
|
|
33212
|
+
req.on("error", () => resolve12(null));
|
|
33177
33213
|
req.setTimeout(3e3, () => {
|
|
33178
33214
|
req.destroy();
|
|
33179
|
-
|
|
33215
|
+
resolve12(null);
|
|
33180
33216
|
});
|
|
33181
33217
|
});
|
|
33182
33218
|
}
|
|
33183
33219
|
sendBrowser(method, params = {}, timeoutMs = 15e3) {
|
|
33184
|
-
return new Promise((
|
|
33220
|
+
return new Promise((resolve12, reject) => {
|
|
33185
33221
|
if (!this.browserWs || !this._browserConnected) return reject(new Error("Browser WS not connected"));
|
|
33186
33222
|
const id = this.browserMsgId++;
|
|
33187
|
-
this.browserPending.set(id, { resolve:
|
|
33223
|
+
this.browserPending.set(id, { resolve: resolve12, reject });
|
|
33188
33224
|
this.browserWs.send(JSON.stringify({ id, method, params }));
|
|
33189
33225
|
setTimeout(() => {
|
|
33190
33226
|
if (this.browserPending.has(id)) {
|
|
@@ -33224,11 +33260,11 @@ ${data.message || ""}`.trim();
|
|
|
33224
33260
|
}
|
|
33225
33261
|
// ─── CDP Protocol ────────────────────────────────────────
|
|
33226
33262
|
sendInternal(method, params = {}, timeoutMs = 15e3) {
|
|
33227
|
-
return new Promise((
|
|
33263
|
+
return new Promise((resolve12, reject) => {
|
|
33228
33264
|
if (!this.ws || !this._connected) return reject(new Error("CDP not connected"));
|
|
33229
33265
|
if (this.ws.readyState !== import_ws2.default.OPEN) return reject(new Error("WebSocket not open"));
|
|
33230
33266
|
const id = this.msgId++;
|
|
33231
|
-
this.pending.set(id, { resolve:
|
|
33267
|
+
this.pending.set(id, { resolve: resolve12, reject });
|
|
33232
33268
|
this.ws.send(JSON.stringify({ id, method, params }));
|
|
33233
33269
|
setTimeout(() => {
|
|
33234
33270
|
if (this.pending.has(id)) {
|
|
@@ -33477,7 +33513,7 @@ ${data.message || ""}`.trim();
|
|
|
33477
33513
|
const browserWs = this.browserWs;
|
|
33478
33514
|
let msgId = this.browserMsgId;
|
|
33479
33515
|
const sendWs = (method, params = {}, sessionId) => {
|
|
33480
|
-
return new Promise((
|
|
33516
|
+
return new Promise((resolve12, reject) => {
|
|
33481
33517
|
const mid = msgId++;
|
|
33482
33518
|
this.browserMsgId = msgId;
|
|
33483
33519
|
const handler = (raw) => {
|
|
@@ -33486,7 +33522,7 @@ ${data.message || ""}`.trim();
|
|
|
33486
33522
|
if (msg.id === mid) {
|
|
33487
33523
|
browserWs.removeListener("message", handler);
|
|
33488
33524
|
if (msg.error) reject(new Error(msg.error.message || JSON.stringify(msg.error)));
|
|
33489
|
-
else
|
|
33525
|
+
else resolve12(msg.result);
|
|
33490
33526
|
}
|
|
33491
33527
|
} catch {
|
|
33492
33528
|
}
|
|
@@ -33687,14 +33723,14 @@ ${data.message || ""}`.trim();
|
|
|
33687
33723
|
if (!ws2 || ws2.readyState !== import_ws2.default.OPEN) {
|
|
33688
33724
|
throw new Error("CDP not connected");
|
|
33689
33725
|
}
|
|
33690
|
-
return new Promise((
|
|
33726
|
+
return new Promise((resolve12, reject) => {
|
|
33691
33727
|
const id = getNextId();
|
|
33692
33728
|
pendingMap.set(id, {
|
|
33693
33729
|
resolve: (result) => {
|
|
33694
33730
|
if (result?.result?.subtype === "error") {
|
|
33695
33731
|
reject(new Error(result.result.description));
|
|
33696
33732
|
} else {
|
|
33697
|
-
|
|
33733
|
+
resolve12(result?.result?.value);
|
|
33698
33734
|
}
|
|
33699
33735
|
},
|
|
33700
33736
|
reject
|
|
@@ -33726,10 +33762,10 @@ ${data.message || ""}`.trim();
|
|
|
33726
33762
|
throw new Error("CDP not connected");
|
|
33727
33763
|
}
|
|
33728
33764
|
const sendViaSession = (method, params = {}) => {
|
|
33729
|
-
return new Promise((
|
|
33765
|
+
return new Promise((resolve12, reject) => {
|
|
33730
33766
|
const pendingMap = this._browserConnected ? this.browserPending : this.pending;
|
|
33731
33767
|
const id = this._browserConnected ? this.browserMsgId++ : this.msgId++;
|
|
33732
|
-
pendingMap.set(id, { resolve:
|
|
33768
|
+
pendingMap.set(id, { resolve: resolve12, reject });
|
|
33733
33769
|
ws2.send(JSON.stringify({ id, sessionId, method, params }));
|
|
33734
33770
|
setTimeout(() => {
|
|
33735
33771
|
if (pendingMap.has(id)) {
|
|
@@ -35441,6 +35477,125 @@ ${cleanBody}`;
|
|
|
35441
35477
|
return { sessions: [], hasMore: false };
|
|
35442
35478
|
}
|
|
35443
35479
|
}
|
|
35480
|
+
function normalizeCanonicalHermesMessageContent(content) {
|
|
35481
|
+
if (typeof content === "string") return content.trim();
|
|
35482
|
+
if (content == null) return "";
|
|
35483
|
+
try {
|
|
35484
|
+
return JSON.stringify(content).trim();
|
|
35485
|
+
} catch {
|
|
35486
|
+
return String(content).trim();
|
|
35487
|
+
}
|
|
35488
|
+
}
|
|
35489
|
+
function extractCanonicalHermesMessageTimestamp(message, fallbackTs) {
|
|
35490
|
+
const numericTimestamp = Number(message.receivedAt || message.timestamp || message.ts || 0);
|
|
35491
|
+
if (Number.isFinite(numericTimestamp) && numericTimestamp > 0) return numericTimestamp;
|
|
35492
|
+
const stringTimestamp = typeof message.ts === "string" ? Date.parse(message.ts) : typeof message.timestamp === "string" ? Date.parse(message.timestamp) : NaN;
|
|
35493
|
+
if (Number.isFinite(stringTimestamp) && stringTimestamp > 0) return stringTimestamp;
|
|
35494
|
+
return fallbackTs;
|
|
35495
|
+
}
|
|
35496
|
+
function readExistingHermesSessionStartRecord(historySessionId) {
|
|
35497
|
+
try {
|
|
35498
|
+
const dir = path7.join(HISTORY_DIR, "hermes-cli");
|
|
35499
|
+
if (!fs32.existsSync(dir)) return null;
|
|
35500
|
+
const files = listHistoryFiles(dir, historySessionId).sort();
|
|
35501
|
+
for (const file2 of files) {
|
|
35502
|
+
const lines = fs32.readFileSync(path7.join(dir, file2), "utf-8").split("\n").filter(Boolean);
|
|
35503
|
+
for (const line of lines) {
|
|
35504
|
+
try {
|
|
35505
|
+
const parsed = JSON.parse(line);
|
|
35506
|
+
if (parsed.historySessionId !== historySessionId) continue;
|
|
35507
|
+
if (parsed.kind === "session_start" && parsed.role === "system") {
|
|
35508
|
+
return parsed;
|
|
35509
|
+
}
|
|
35510
|
+
} catch {
|
|
35511
|
+
}
|
|
35512
|
+
}
|
|
35513
|
+
}
|
|
35514
|
+
return null;
|
|
35515
|
+
} catch {
|
|
35516
|
+
return null;
|
|
35517
|
+
}
|
|
35518
|
+
}
|
|
35519
|
+
function rebuildHermesSavedHistoryFromCanonicalSession(historySessionId) {
|
|
35520
|
+
const normalizedSessionId = normalizeSavedHistorySessionId("hermes-cli", historySessionId);
|
|
35521
|
+
if (!normalizedSessionId) return false;
|
|
35522
|
+
try {
|
|
35523
|
+
const sessionFilePath = path7.join(os52.homedir(), ".hermes", "sessions", `session_${normalizedSessionId}.json`);
|
|
35524
|
+
if (!fs32.existsSync(sessionFilePath)) return false;
|
|
35525
|
+
const raw = JSON.parse(fs32.readFileSync(sessionFilePath, "utf-8"));
|
|
35526
|
+
const canonicalMessages = Array.isArray(raw.messages) ? raw.messages : [];
|
|
35527
|
+
const dir = path7.join(HISTORY_DIR, "hermes-cli");
|
|
35528
|
+
fs32.mkdirSync(dir, { recursive: true });
|
|
35529
|
+
const existingSessionStart = readExistingHermesSessionStartRecord(normalizedSessionId);
|
|
35530
|
+
const records = [];
|
|
35531
|
+
if (existingSessionStart) {
|
|
35532
|
+
records.push({
|
|
35533
|
+
...existingSessionStart,
|
|
35534
|
+
historySessionId: normalizedSessionId
|
|
35535
|
+
});
|
|
35536
|
+
}
|
|
35537
|
+
let fallbackTs = Date.parse(raw.session_start || raw.last_updated || "") || Date.now();
|
|
35538
|
+
for (const message of canonicalMessages) {
|
|
35539
|
+
const role = String(message.role || "").trim();
|
|
35540
|
+
const content = normalizeCanonicalHermesMessageContent(message.content);
|
|
35541
|
+
if (!content) continue;
|
|
35542
|
+
const receivedAt = extractCanonicalHermesMessageTimestamp(message, fallbackTs);
|
|
35543
|
+
fallbackTs = receivedAt + 1;
|
|
35544
|
+
if (role === "user") {
|
|
35545
|
+
records.push({
|
|
35546
|
+
ts: new Date(receivedAt).toISOString(),
|
|
35547
|
+
receivedAt,
|
|
35548
|
+
role: "user",
|
|
35549
|
+
content,
|
|
35550
|
+
kind: "standard",
|
|
35551
|
+
agent: "hermes-cli",
|
|
35552
|
+
historySessionId: normalizedSessionId
|
|
35553
|
+
});
|
|
35554
|
+
continue;
|
|
35555
|
+
}
|
|
35556
|
+
if (role === "assistant") {
|
|
35557
|
+
records.push({
|
|
35558
|
+
ts: new Date(receivedAt).toISOString(),
|
|
35559
|
+
receivedAt,
|
|
35560
|
+
role: "assistant",
|
|
35561
|
+
content,
|
|
35562
|
+
kind: "standard",
|
|
35563
|
+
agent: "hermes-cli",
|
|
35564
|
+
historySessionId: normalizedSessionId
|
|
35565
|
+
});
|
|
35566
|
+
continue;
|
|
35567
|
+
}
|
|
35568
|
+
if (role === "tool") {
|
|
35569
|
+
records.push({
|
|
35570
|
+
ts: new Date(receivedAt).toISOString(),
|
|
35571
|
+
receivedAt,
|
|
35572
|
+
role: "assistant",
|
|
35573
|
+
content,
|
|
35574
|
+
kind: "tool",
|
|
35575
|
+
senderName: "Tool",
|
|
35576
|
+
agent: "hermes-cli",
|
|
35577
|
+
historySessionId: normalizedSessionId
|
|
35578
|
+
});
|
|
35579
|
+
}
|
|
35580
|
+
}
|
|
35581
|
+
if (records.length === 0) return false;
|
|
35582
|
+
const prefix = `${normalizedSessionId.replace(/[^a-zA-Z0-9_-]/g, "_")}_`;
|
|
35583
|
+
for (const file2 of fs32.readdirSync(dir)) {
|
|
35584
|
+
if (file2.startsWith(prefix) && file2.endsWith(".jsonl")) {
|
|
35585
|
+
fs32.unlinkSync(path7.join(dir, file2));
|
|
35586
|
+
}
|
|
35587
|
+
}
|
|
35588
|
+
const targetDate = new Date(records[records.length - 1].receivedAt || Date.now()).toISOString().slice(0, 10);
|
|
35589
|
+
const filePath = path7.join(dir, `${prefix}${targetDate}.jsonl`);
|
|
35590
|
+
fs32.writeFileSync(filePath, `${records.map((record2) => JSON.stringify(record2)).join("\n")}
|
|
35591
|
+
`, "utf-8");
|
|
35592
|
+
invalidatePersistedSavedHistoryIndex("hermes-cli", dir);
|
|
35593
|
+
savedHistorySessionCache.delete("hermes-cli");
|
|
35594
|
+
return true;
|
|
35595
|
+
} catch {
|
|
35596
|
+
return false;
|
|
35597
|
+
}
|
|
35598
|
+
}
|
|
35444
35599
|
function isControlValue(value) {
|
|
35445
35600
|
return typeof value === "string" || typeof value === "number" || typeof value === "boolean";
|
|
35446
35601
|
}
|
|
@@ -37568,7 +37723,9 @@ ${effect.notification.body || ""}`.trim();
|
|
|
37568
37723
|
const targetSessionId = typeof args?.targetSessionId === "string" ? args.targetSessionId.trim() : "";
|
|
37569
37724
|
const sessionId = targetSessionId || h.currentSession?.sessionId || "";
|
|
37570
37725
|
if (!sessionId) return null;
|
|
37571
|
-
|
|
37726
|
+
const session = h.ctx.sessionRegistry?.get(sessionId);
|
|
37727
|
+
const instanceKey = session?.adapterKey || session?.instanceKey || sessionId;
|
|
37728
|
+
return h.ctx.instanceManager?.getInstance(instanceKey) || null;
|
|
37572
37729
|
}
|
|
37573
37730
|
function getTargetTransport(h, provider) {
|
|
37574
37731
|
if (h.currentSession?.transport) return h.currentSession.transport;
|
|
@@ -37865,7 +38022,7 @@ ${effect.notification.body || ""}`.trim();
|
|
|
37865
38022
|
async function getStableExtensionBaseline(h) {
|
|
37866
38023
|
const first = await readExtensionChatState(h);
|
|
37867
38024
|
if (getStateMessageCount(first) > 0 || getStateLastSignature(first)) return first;
|
|
37868
|
-
await new Promise((
|
|
38025
|
+
await new Promise((resolve12) => setTimeout(resolve12, 150));
|
|
37869
38026
|
const second = await readExtensionChatState(h);
|
|
37870
38027
|
return getStateMessageCount(second) >= getStateMessageCount(first) ? second : first;
|
|
37871
38028
|
}
|
|
@@ -37873,7 +38030,7 @@ ${effect.notification.body || ""}`.trim();
|
|
|
37873
38030
|
const beforeCount = getStateMessageCount(before);
|
|
37874
38031
|
const beforeSignature = getStateLastSignature(before);
|
|
37875
38032
|
for (let attempt = 0; attempt < 12; attempt += 1) {
|
|
37876
|
-
await new Promise((
|
|
38033
|
+
await new Promise((resolve12) => setTimeout(resolve12, 250));
|
|
37877
38034
|
const state = await readExtensionChatState(h);
|
|
37878
38035
|
if (state?.status === "waiting_approval") return true;
|
|
37879
38036
|
const afterCount = getStateMessageCount(state);
|
|
@@ -38637,10 +38794,17 @@ ${effect.notification.body || ""}`.trim();
|
|
|
38637
38794
|
}
|
|
38638
38795
|
}
|
|
38639
38796
|
const status = adapter.getStatus();
|
|
38640
|
-
|
|
38797
|
+
const targetInstance = getTargetInstance(h, args);
|
|
38798
|
+
const targetState = targetInstance?.getState?.();
|
|
38799
|
+
const surfacedModal = targetState?.activeChat?.activeModal && Array.isArray(targetState.activeChat.activeModal.buttons) && targetState.activeChat.activeModal.buttons.some((candidate) => typeof candidate === "string" && candidate.trim()) ? targetState.activeChat.activeModal : null;
|
|
38800
|
+
const statusModal = status?.activeModal && Array.isArray(status.activeModal.buttons) && status.activeModal.buttons.some((candidate) => typeof candidate === "string" && candidate.trim()) ? status.activeModal : null;
|
|
38801
|
+
const effectiveModal = statusModal || surfacedModal;
|
|
38802
|
+
const effectiveStatus = status?.status === "waiting_approval" || targetState?.activeChat?.status === "waiting_approval" ? "waiting_approval" : status?.status;
|
|
38803
|
+
LOG2.info("Command", `[resolveAction] CLI PTY gate target=${String(args?.targetSessionId || "")} rawStatus=${String(status?.status || "")} effectiveStatus=${String(effectiveStatus || "")} statusModal=${statusModal ? "yes" : "no"} surfacedModal=${surfacedModal ? "yes" : "no"} instance=${targetInstance ? "yes" : "no"}`);
|
|
38804
|
+
if (effectiveStatus !== "waiting_approval" && !effectiveModal) {
|
|
38641
38805
|
return { success: false, error: "Not in approval state" };
|
|
38642
38806
|
}
|
|
38643
|
-
const buttons =
|
|
38807
|
+
const buttons = effectiveModal?.buttons || ["Allow once", "Always allow", "Deny"];
|
|
38644
38808
|
let buttonIndex = typeof args?.buttonIndex === "number" ? args.buttonIndex : -1;
|
|
38645
38809
|
if (buttonIndex < 0) {
|
|
38646
38810
|
const btnLower = button.toLowerCase();
|
|
@@ -40079,7 +40243,7 @@ ${effect.notification.body || ""}`.trim();
|
|
|
40079
40243
|
try {
|
|
40080
40244
|
const http3 = await import("http");
|
|
40081
40245
|
const postData = JSON.stringify(body);
|
|
40082
|
-
const result = await new Promise((
|
|
40246
|
+
const result = await new Promise((resolve12, reject) => {
|
|
40083
40247
|
const req = http3.request({
|
|
40084
40248
|
hostname: "127.0.0.1",
|
|
40085
40249
|
port: 19280,
|
|
@@ -40091,9 +40255,9 @@ ${effect.notification.body || ""}`.trim();
|
|
|
40091
40255
|
res.on("data", (chunk) => data += chunk);
|
|
40092
40256
|
res.on("end", () => {
|
|
40093
40257
|
try {
|
|
40094
|
-
|
|
40258
|
+
resolve12(JSON.parse(data));
|
|
40095
40259
|
} catch {
|
|
40096
|
-
|
|
40260
|
+
resolve12({ raw: data });
|
|
40097
40261
|
}
|
|
40098
40262
|
});
|
|
40099
40263
|
});
|
|
@@ -40111,15 +40275,15 @@ ${effect.notification.body || ""}`.trim();
|
|
|
40111
40275
|
if (!providerType) return { success: false, error: "providerType required" };
|
|
40112
40276
|
try {
|
|
40113
40277
|
const http3 = await import("http");
|
|
40114
|
-
const result = await new Promise((
|
|
40278
|
+
const result = await new Promise((resolve12, reject) => {
|
|
40115
40279
|
http3.get(`http://127.0.0.1:19280/api/providers/${providerType}/${endpoint}`, (res) => {
|
|
40116
40280
|
let data = "";
|
|
40117
40281
|
res.on("data", (chunk) => data += chunk);
|
|
40118
40282
|
res.on("end", () => {
|
|
40119
40283
|
try {
|
|
40120
|
-
|
|
40284
|
+
resolve12(JSON.parse(data));
|
|
40121
40285
|
} catch {
|
|
40122
|
-
|
|
40286
|
+
resolve12({ raw: data });
|
|
40123
40287
|
}
|
|
40124
40288
|
});
|
|
40125
40289
|
}).on("error", reject);
|
|
@@ -40133,7 +40297,7 @@ ${effect.notification.body || ""}`.trim();
|
|
|
40133
40297
|
try {
|
|
40134
40298
|
const http3 = await import("http");
|
|
40135
40299
|
const postData = JSON.stringify(args || {});
|
|
40136
|
-
const result = await new Promise((
|
|
40300
|
+
const result = await new Promise((resolve12, reject) => {
|
|
40137
40301
|
const req = http3.request({
|
|
40138
40302
|
hostname: "127.0.0.1",
|
|
40139
40303
|
port: 19280,
|
|
@@ -40145,9 +40309,9 @@ ${effect.notification.body || ""}`.trim();
|
|
|
40145
40309
|
res.on("data", (chunk) => data += chunk);
|
|
40146
40310
|
res.on("end", () => {
|
|
40147
40311
|
try {
|
|
40148
|
-
|
|
40312
|
+
resolve12(JSON.parse(data));
|
|
40149
40313
|
} catch {
|
|
40150
|
-
|
|
40314
|
+
resolve12({ raw: data });
|
|
40151
40315
|
}
|
|
40152
40316
|
});
|
|
40153
40317
|
});
|
|
@@ -40241,7 +40405,7 @@ ${effect.notification.body || ""}`.trim();
|
|
|
40241
40405
|
if (status === "stopped") {
|
|
40242
40406
|
throw new Error("CLI runtime stopped before it became ready");
|
|
40243
40407
|
}
|
|
40244
|
-
await new Promise((
|
|
40408
|
+
await new Promise((resolve12) => setTimeout(resolve12, pollMs));
|
|
40245
40409
|
}
|
|
40246
40410
|
throw new Error(`CLI runtime did not become ready within ${timeoutMs}ms`);
|
|
40247
40411
|
}
|
|
@@ -40278,6 +40442,7 @@ ${effect.notification.body || ""}`.trim();
|
|
|
40278
40442
|
historyWriter;
|
|
40279
40443
|
runtimeMessages = [];
|
|
40280
40444
|
lastPersistedHistoryMessages = [];
|
|
40445
|
+
lastCanonicalHermesSyncMtimeMs = 0;
|
|
40281
40446
|
instanceId;
|
|
40282
40447
|
suppressIdleHistoryReplay = false;
|
|
40283
40448
|
errorMessage = void 0;
|
|
@@ -40310,34 +40475,7 @@ ${effect.notification.body || ""}`.trim();
|
|
|
40310
40475
|
await this.enforceFreshSessionLaunchIfNeeded();
|
|
40311
40476
|
this.maybeAppendRuntimeRecoveryMessage(this.adapter.getRuntimeMetadata());
|
|
40312
40477
|
if (this.providerSessionId) {
|
|
40313
|
-
this.
|
|
40314
|
-
const restoredHistory = readChatHistory(this.type, 0, 200, this.providerSessionId);
|
|
40315
|
-
this.historyWriter.seedSessionHistory(
|
|
40316
|
-
this.type,
|
|
40317
|
-
restoredHistory.messages,
|
|
40318
|
-
this.providerSessionId,
|
|
40319
|
-
this.instanceId
|
|
40320
|
-
);
|
|
40321
|
-
this.lastPersistedHistoryMessages = restoredHistory.messages.map((message) => ({
|
|
40322
|
-
role: message.role,
|
|
40323
|
-
content: message.content,
|
|
40324
|
-
kind: message.kind,
|
|
40325
|
-
senderName: message.senderName,
|
|
40326
|
-
receivedAt: message.receivedAt
|
|
40327
|
-
}));
|
|
40328
|
-
this.suppressIdleHistoryReplay = restoredHistory.messages.length > 0;
|
|
40329
|
-
if (restoredHistory.messages.length > 0) {
|
|
40330
|
-
this.adapter.seedCommittedMessages(
|
|
40331
|
-
restoredHistory.messages.map((message) => ({
|
|
40332
|
-
role: message.role,
|
|
40333
|
-
content: message.content,
|
|
40334
|
-
timestamp: message.receivedAt,
|
|
40335
|
-
receivedAt: message.receivedAt,
|
|
40336
|
-
kind: message.kind,
|
|
40337
|
-
senderName: message.senderName
|
|
40338
|
-
}))
|
|
40339
|
-
);
|
|
40340
|
-
}
|
|
40478
|
+
this.restorePersistedHistoryFromCurrentSession();
|
|
40341
40479
|
}
|
|
40342
40480
|
if (this.providerSessionId && this.launchMode === "resume") {
|
|
40343
40481
|
const resumedAt = Date.now();
|
|
@@ -40446,6 +40584,7 @@ ${effect.notification.body || ""}`.trim();
|
|
|
40446
40584
|
parsedMessages = historyMessageCount > 0 ? parsedMessages.slice(-historyMessageCount) : [];
|
|
40447
40585
|
}
|
|
40448
40586
|
const mergedMessages = this.mergeConversationMessages(parsedMessages);
|
|
40587
|
+
const canonicalHermesBackedHistory = this.syncCanonicalHermesSavedHistoryIfNeeded();
|
|
40449
40588
|
const dirName = this.workingDir.split("/").filter(Boolean).pop() || "session";
|
|
40450
40589
|
if (parsedMessages.length > 0) {
|
|
40451
40590
|
const shouldSkipReplayPersist = this.suppressIdleHistoryReplay && adapterStatus.status === "idle" && parsedStatus?.status === "idle";
|
|
@@ -40463,7 +40602,7 @@ ${effect.notification.body || ""}`.trim();
|
|
|
40463
40602
|
senderName: typeof message.senderName === "string" ? message.senderName : void 0,
|
|
40464
40603
|
receivedAt: typeof message.receivedAt === "number" ? message.receivedAt : message.timestamp
|
|
40465
40604
|
}));
|
|
40466
|
-
if (!shouldSkipReplayPersist && normalizedMessagesToSave.length > 0) {
|
|
40605
|
+
if (!canonicalHermesBackedHistory && !shouldSkipReplayPersist && normalizedMessagesToSave.length > 0) {
|
|
40467
40606
|
const incrementalMessages = buildIncrementalHistoryAppendMessages(this.lastPersistedHistoryMessages, normalizedMessagesToSave);
|
|
40468
40607
|
this.historyWriter.appendNewMessages(
|
|
40469
40608
|
this.type,
|
|
@@ -40473,7 +40612,9 @@ ${effect.notification.body || ""}`.trim();
|
|
|
40473
40612
|
this.providerSessionId
|
|
40474
40613
|
);
|
|
40475
40614
|
}
|
|
40476
|
-
|
|
40615
|
+
if (!canonicalHermesBackedHistory) {
|
|
40616
|
+
this.lastPersistedHistoryMessages = normalizedMessagesToSave;
|
|
40617
|
+
}
|
|
40477
40618
|
}
|
|
40478
40619
|
this.applyProviderResponse(parsedStatus, { phase: "immediate" });
|
|
40479
40620
|
const surface = resolveProviderStateSurface({
|
|
@@ -40930,6 +41071,7 @@ ${effect.notification.body || ""}`.trim();
|
|
|
40930
41071
|
this.providerSessionId = nextSessionId;
|
|
40931
41072
|
this.historyWriter.promoteHistorySession(this.type, previousHistorySessionId, nextSessionId);
|
|
40932
41073
|
this.historyWriter.writeSessionStart(this.type, nextSessionId, this.workingDir, this.instanceId);
|
|
41074
|
+
this.restorePersistedHistoryFromCurrentSession();
|
|
40933
41075
|
this.adapter.updateRuntimeMeta({ providerSessionId: nextSessionId });
|
|
40934
41076
|
this.onProviderSessionResolved?.({
|
|
40935
41077
|
instanceId: this.instanceId,
|
|
@@ -40941,6 +41083,61 @@ ${effect.notification.body || ""}`.trim();
|
|
|
40941
41083
|
});
|
|
40942
41084
|
LOG2.info("CLI", `[${this.type}] discovered provider session id: ${nextSessionId}`);
|
|
40943
41085
|
}
|
|
41086
|
+
syncCanonicalHermesSavedHistoryIfNeeded() {
|
|
41087
|
+
if (this.type !== "hermes-cli" || !this.providerSessionId) return false;
|
|
41088
|
+
try {
|
|
41089
|
+
const canonicalPath = path11.join(os11.homedir(), ".hermes", "sessions", `session_${this.providerSessionId}.json`);
|
|
41090
|
+
if (!fs52.existsSync(canonicalPath)) return false;
|
|
41091
|
+
const stat4 = fs52.statSync(canonicalPath);
|
|
41092
|
+
if (stat4.mtimeMs <= this.lastCanonicalHermesSyncMtimeMs) return true;
|
|
41093
|
+
const rebuilt = rebuildHermesSavedHistoryFromCanonicalSession(this.providerSessionId);
|
|
41094
|
+
if (!rebuilt) return false;
|
|
41095
|
+
this.lastCanonicalHermesSyncMtimeMs = stat4.mtimeMs;
|
|
41096
|
+
const restoredHistory = readChatHistory(this.type, 0, 200, this.providerSessionId);
|
|
41097
|
+
this.lastPersistedHistoryMessages = restoredHistory.messages.map((message) => ({
|
|
41098
|
+
role: message.role,
|
|
41099
|
+
content: message.content,
|
|
41100
|
+
kind: message.kind,
|
|
41101
|
+
senderName: message.senderName,
|
|
41102
|
+
receivedAt: message.receivedAt
|
|
41103
|
+
}));
|
|
41104
|
+
return true;
|
|
41105
|
+
} catch {
|
|
41106
|
+
return false;
|
|
41107
|
+
}
|
|
41108
|
+
}
|
|
41109
|
+
restorePersistedHistoryFromCurrentSession() {
|
|
41110
|
+
if (!this.providerSessionId) return;
|
|
41111
|
+
this.syncCanonicalHermesSavedHistoryIfNeeded();
|
|
41112
|
+
this.historyWriter.compactHistorySession(this.type, this.providerSessionId);
|
|
41113
|
+
const restoredHistory = readChatHistory(this.type, 0, 200, this.providerSessionId);
|
|
41114
|
+
this.historyWriter.seedSessionHistory(
|
|
41115
|
+
this.type,
|
|
41116
|
+
restoredHistory.messages,
|
|
41117
|
+
this.providerSessionId,
|
|
41118
|
+
this.instanceId
|
|
41119
|
+
);
|
|
41120
|
+
this.lastPersistedHistoryMessages = restoredHistory.messages.map((message) => ({
|
|
41121
|
+
role: message.role,
|
|
41122
|
+
content: message.content,
|
|
41123
|
+
kind: message.kind,
|
|
41124
|
+
senderName: message.senderName,
|
|
41125
|
+
receivedAt: message.receivedAt
|
|
41126
|
+
}));
|
|
41127
|
+
this.suppressIdleHistoryReplay = restoredHistory.messages.length > 0;
|
|
41128
|
+
if (restoredHistory.messages.length > 0) {
|
|
41129
|
+
this.adapter.seedCommittedMessages(
|
|
41130
|
+
restoredHistory.messages.map((message) => ({
|
|
41131
|
+
role: message.role,
|
|
41132
|
+
content: message.content,
|
|
41133
|
+
timestamp: message.receivedAt,
|
|
41134
|
+
receivedAt: message.receivedAt,
|
|
41135
|
+
kind: message.kind,
|
|
41136
|
+
senderName: message.senderName
|
|
41137
|
+
}))
|
|
41138
|
+
);
|
|
41139
|
+
}
|
|
41140
|
+
}
|
|
40944
41141
|
getProbeDirectories() {
|
|
40945
41142
|
const dirs = /* @__PURE__ */ new Set();
|
|
40946
41143
|
const addDir = (value) => {
|
|
@@ -41543,13 +41740,13 @@ ${effect.notification.body || ""}`.trim();
|
|
|
41543
41740
|
}
|
|
41544
41741
|
this.currentStatus = "waiting_approval";
|
|
41545
41742
|
this.detectStatusTransition();
|
|
41546
|
-
const approved = await new Promise((
|
|
41547
|
-
this.permissionResolvers.push(
|
|
41743
|
+
const approved = await new Promise((resolve12) => {
|
|
41744
|
+
this.permissionResolvers.push(resolve12);
|
|
41548
41745
|
setTimeout(() => {
|
|
41549
|
-
const idx = this.permissionResolvers.indexOf(
|
|
41746
|
+
const idx = this.permissionResolvers.indexOf(resolve12);
|
|
41550
41747
|
if (idx >= 0) {
|
|
41551
41748
|
this.permissionResolvers.splice(idx, 1);
|
|
41552
|
-
|
|
41749
|
+
resolve12(false);
|
|
41553
41750
|
}
|
|
41554
41751
|
}, 3e5);
|
|
41555
41752
|
});
|
|
@@ -43077,10 +43274,75 @@ Run 'adhdev doctor' for detailed diagnostics.`
|
|
|
43077
43274
|
}
|
|
43078
43275
|
static GITHUB_TARBALL_URL = "https://github.com/vilmire/adhdev-providers/archive/refs/heads/main.tar.gz";
|
|
43079
43276
|
static META_FILE = ".meta.json";
|
|
43277
|
+
static REPO_PROVIDER_DIRNAME = "adhdev-providers";
|
|
43278
|
+
static SIBLING_MARKER_FILE = ".adhdev-provider-root";
|
|
43279
|
+
static SIBLING_ENV_VAR = "ADHDEV_USE_SIBLING_PROVIDERS";
|
|
43280
|
+
probeStarts = [];
|
|
43281
|
+
siblingLogged = false;
|
|
43282
|
+
userDirSource = "home-default";
|
|
43283
|
+
/** Process-level dedup for stderr sibling-adoption notices (shared across all ProviderLoader instances). */
|
|
43284
|
+
static siblingStderrLogged = /* @__PURE__ */ new Set();
|
|
43285
|
+
static looksLikeProviderRoot(candidate) {
|
|
43286
|
+
try {
|
|
43287
|
+
if (!fs6.existsSync(candidate) || !fs6.statSync(candidate).isDirectory()) return false;
|
|
43288
|
+
return ["ide", "extension", "cli", "acp"].some(
|
|
43289
|
+
(category) => fs6.existsSync(path13.join(candidate, category))
|
|
43290
|
+
);
|
|
43291
|
+
} catch {
|
|
43292
|
+
return false;
|
|
43293
|
+
}
|
|
43294
|
+
}
|
|
43295
|
+
static hasProviderRootMarker(candidate) {
|
|
43296
|
+
try {
|
|
43297
|
+
return fs6.existsSync(path13.join(candidate, _ProviderLoader.SIBLING_MARKER_FILE));
|
|
43298
|
+
} catch {
|
|
43299
|
+
return false;
|
|
43300
|
+
}
|
|
43301
|
+
}
|
|
43302
|
+
detectDefaultUserDir() {
|
|
43303
|
+
const fallback = path13.join(os13.homedir(), ".adhdev", "providers");
|
|
43304
|
+
const envOptIn = process.env[_ProviderLoader.SIBLING_ENV_VAR] === "1";
|
|
43305
|
+
const visited = /* @__PURE__ */ new Set();
|
|
43306
|
+
for (const start of this.probeStarts) {
|
|
43307
|
+
let current = path13.resolve(start);
|
|
43308
|
+
while (!visited.has(current)) {
|
|
43309
|
+
visited.add(current);
|
|
43310
|
+
const siblingCandidate = path13.join(path13.dirname(current), _ProviderLoader.REPO_PROVIDER_DIRNAME);
|
|
43311
|
+
if (_ProviderLoader.looksLikeProviderRoot(siblingCandidate)) {
|
|
43312
|
+
const hasMarker = _ProviderLoader.hasProviderRootMarker(siblingCandidate);
|
|
43313
|
+
if (envOptIn || hasMarker) {
|
|
43314
|
+
const source = hasMarker ? "sibling-marker" : "sibling-env";
|
|
43315
|
+
if (!this.siblingLogged) {
|
|
43316
|
+
this.log(`Using sibling provider checkout (${source}): ${siblingCandidate}`);
|
|
43317
|
+
this.siblingLogged = true;
|
|
43318
|
+
}
|
|
43319
|
+
if (!_ProviderLoader.siblingStderrLogged.has(siblingCandidate)) {
|
|
43320
|
+
_ProviderLoader.siblingStderrLogged.add(siblingCandidate);
|
|
43321
|
+
try {
|
|
43322
|
+
process.stderr.write(
|
|
43323
|
+
`[adhdev] Using sibling adhdev-providers checkout (${source}): ${siblingCandidate}
|
|
43324
|
+
`
|
|
43325
|
+
);
|
|
43326
|
+
} catch {
|
|
43327
|
+
}
|
|
43328
|
+
}
|
|
43329
|
+
return { path: siblingCandidate, source };
|
|
43330
|
+
}
|
|
43331
|
+
}
|
|
43332
|
+
const parent = path13.dirname(current);
|
|
43333
|
+
if (parent === current) break;
|
|
43334
|
+
current = parent;
|
|
43335
|
+
}
|
|
43336
|
+
}
|
|
43337
|
+
return { path: fallback, source: "home-default" };
|
|
43338
|
+
}
|
|
43080
43339
|
constructor(options) {
|
|
43081
43340
|
this.logFn = options?.logFn || LOG2.forComponent("Provider").asLogFn();
|
|
43341
|
+
this.probeStarts = options?.probeStarts ?? [process.cwd(), __dirname];
|
|
43082
43342
|
this.defaultProvidersDir = path13.join(os13.homedir(), ".adhdev", "providers");
|
|
43083
|
-
|
|
43343
|
+
const detected = this.detectDefaultUserDir();
|
|
43344
|
+
this.userDir = detected.path;
|
|
43345
|
+
this.userDirSource = detected.source;
|
|
43084
43346
|
this.upstreamDir = path13.join(this.defaultProvidersDir, ".upstream");
|
|
43085
43347
|
this.disableUpstream = false;
|
|
43086
43348
|
this.applySourceConfig({
|
|
@@ -43118,6 +43380,7 @@ Run 'adhdev doctor' for detailed diagnostics.`
|
|
|
43118
43380
|
disableUpstream: this.disableUpstream,
|
|
43119
43381
|
explicitProviderDir: this.explicitProviderDir,
|
|
43120
43382
|
userDir: this.userDir,
|
|
43383
|
+
userDirSource: this.userDirSource,
|
|
43121
43384
|
upstreamDir: this.upstreamDir,
|
|
43122
43385
|
providerRoots: this.getProviderRoots()
|
|
43123
43386
|
};
|
|
@@ -43128,7 +43391,14 @@ Run 'adhdev doctor' for detailed diagnostics.`
|
|
|
43128
43391
|
this.explicitProviderDir = options.userDir?.trim() ? options.userDir : null;
|
|
43129
43392
|
}
|
|
43130
43393
|
this.sourceMode = nextSourceMode;
|
|
43131
|
-
|
|
43394
|
+
if (this.explicitProviderDir) {
|
|
43395
|
+
this.userDir = this.explicitProviderDir;
|
|
43396
|
+
this.userDirSource = "explicit";
|
|
43397
|
+
} else {
|
|
43398
|
+
const detected = this.detectDefaultUserDir();
|
|
43399
|
+
this.userDir = detected.path;
|
|
43400
|
+
this.userDirSource = detected.source;
|
|
43401
|
+
}
|
|
43132
43402
|
this.upstreamDir = path13.join(this.defaultProvidersDir, ".upstream");
|
|
43133
43403
|
this.disableUpstream = this.sourceMode === "no-upstream";
|
|
43134
43404
|
if (this.explicitProviderDir) {
|
|
@@ -43722,7 +43992,7 @@ Run 'adhdev doctor' for detailed diagnostics.`
|
|
|
43722
43992
|
return { updated: false };
|
|
43723
43993
|
}
|
|
43724
43994
|
try {
|
|
43725
|
-
const etag = await new Promise((
|
|
43995
|
+
const etag = await new Promise((resolve12, reject) => {
|
|
43726
43996
|
const options = {
|
|
43727
43997
|
method: "HEAD",
|
|
43728
43998
|
hostname: "github.com",
|
|
@@ -43740,7 +44010,7 @@ Run 'adhdev doctor' for detailed diagnostics.`
|
|
|
43740
44010
|
headers: { "User-Agent": "adhdev-launcher" },
|
|
43741
44011
|
timeout: 1e4
|
|
43742
44012
|
}, (res2) => {
|
|
43743
|
-
|
|
44013
|
+
resolve12(res2.headers.etag || res2.headers["last-modified"] || "");
|
|
43744
44014
|
});
|
|
43745
44015
|
req2.on("error", reject);
|
|
43746
44016
|
req2.on("timeout", () => {
|
|
@@ -43749,7 +44019,7 @@ Run 'adhdev doctor' for detailed diagnostics.`
|
|
|
43749
44019
|
});
|
|
43750
44020
|
req2.end();
|
|
43751
44021
|
} else {
|
|
43752
|
-
|
|
44022
|
+
resolve12(res.headers.etag || res.headers["last-modified"] || "");
|
|
43753
44023
|
}
|
|
43754
44024
|
});
|
|
43755
44025
|
req.on("error", reject);
|
|
@@ -43813,7 +44083,7 @@ Run 'adhdev doctor' for detailed diagnostics.`
|
|
|
43813
44083
|
downloadFile(url2, destPath) {
|
|
43814
44084
|
const https = require("https");
|
|
43815
44085
|
const http3 = require("http");
|
|
43816
|
-
return new Promise((
|
|
44086
|
+
return new Promise((resolve12, reject) => {
|
|
43817
44087
|
const doRequest = (reqUrl, redirectCount = 0) => {
|
|
43818
44088
|
if (redirectCount > 5) {
|
|
43819
44089
|
reject(new Error("Too many redirects"));
|
|
@@ -43833,7 +44103,7 @@ Run 'adhdev doctor' for detailed diagnostics.`
|
|
|
43833
44103
|
res.pipe(ws2);
|
|
43834
44104
|
ws2.on("finish", () => {
|
|
43835
44105
|
ws2.close();
|
|
43836
|
-
|
|
44106
|
+
resolve12();
|
|
43837
44107
|
});
|
|
43838
44108
|
ws2.on("error", reject);
|
|
43839
44109
|
});
|
|
@@ -44306,17 +44576,17 @@ Run 'adhdev doctor' for detailed diagnostics.`
|
|
|
44306
44576
|
throw new Error("No free port found");
|
|
44307
44577
|
}
|
|
44308
44578
|
function checkPortFree(port) {
|
|
44309
|
-
return new Promise((
|
|
44579
|
+
return new Promise((resolve12) => {
|
|
44310
44580
|
const server = net3.createServer();
|
|
44311
44581
|
server.unref();
|
|
44312
|
-
server.on("error", () =>
|
|
44582
|
+
server.on("error", () => resolve12(false));
|
|
44313
44583
|
server.listen(port, "127.0.0.1", () => {
|
|
44314
|
-
server.close(() =>
|
|
44584
|
+
server.close(() => resolve12(true));
|
|
44315
44585
|
});
|
|
44316
44586
|
});
|
|
44317
44587
|
}
|
|
44318
44588
|
async function isCdpActive(port) {
|
|
44319
|
-
return new Promise((
|
|
44589
|
+
return new Promise((resolve12) => {
|
|
44320
44590
|
const req = require("http").get(`http://127.0.0.1:${port}/json/version`, {
|
|
44321
44591
|
timeout: 2e3
|
|
44322
44592
|
}, (res) => {
|
|
@@ -44325,16 +44595,16 @@ Run 'adhdev doctor' for detailed diagnostics.`
|
|
|
44325
44595
|
res.on("end", () => {
|
|
44326
44596
|
try {
|
|
44327
44597
|
const info = JSON.parse(data);
|
|
44328
|
-
|
|
44598
|
+
resolve12(!!info["WebKit-Version"] || !!info["Browser"]);
|
|
44329
44599
|
} catch {
|
|
44330
|
-
|
|
44600
|
+
resolve12(false);
|
|
44331
44601
|
}
|
|
44332
44602
|
});
|
|
44333
44603
|
});
|
|
44334
|
-
req.on("error", () =>
|
|
44604
|
+
req.on("error", () => resolve12(false));
|
|
44335
44605
|
req.on("timeout", () => {
|
|
44336
44606
|
req.destroy();
|
|
44337
|
-
|
|
44607
|
+
resolve12(false);
|
|
44338
44608
|
});
|
|
44339
44609
|
});
|
|
44340
44610
|
}
|
|
@@ -45116,7 +45386,7 @@ Run 'adhdev doctor' for detailed diagnostics.`
|
|
|
45116
45386
|
while (Date.now() - start < timeoutMs) {
|
|
45117
45387
|
try {
|
|
45118
45388
|
process.kill(pid, 0);
|
|
45119
|
-
await new Promise((
|
|
45389
|
+
await new Promise((resolve12) => setTimeout(resolve12, 250));
|
|
45120
45390
|
} catch {
|
|
45121
45391
|
return;
|
|
45122
45392
|
}
|
|
@@ -45231,7 +45501,7 @@ Run 'adhdev doctor' for detailed diagnostics.`
|
|
|
45231
45501
|
appendUpgradeLog(installOutput.trim());
|
|
45232
45502
|
}
|
|
45233
45503
|
if (process.platform === "win32") {
|
|
45234
|
-
await new Promise((
|
|
45504
|
+
await new Promise((resolve12) => setTimeout(resolve12, 500));
|
|
45235
45505
|
cleanupStaleGlobalInstallDirs(payload.packageName);
|
|
45236
45506
|
appendUpgradeLog("Post-install staging cleanup complete");
|
|
45237
45507
|
}
|
|
@@ -46559,7 +46829,7 @@ Run 'adhdev doctor' for detailed diagnostics.`
|
|
|
46559
46829
|
const beforeCount = this.messageCount(before);
|
|
46560
46830
|
const beforeSignature = this.lastMessageSignature(before);
|
|
46561
46831
|
for (let attempt = 0; attempt < 12; attempt += 1) {
|
|
46562
|
-
await new Promise((
|
|
46832
|
+
await new Promise((resolve12) => setTimeout(resolve12, 250));
|
|
46563
46833
|
let state;
|
|
46564
46834
|
try {
|
|
46565
46835
|
state = await this.readChat(evaluate);
|
|
@@ -46581,7 +46851,7 @@ Run 'adhdev doctor' for detailed diagnostics.`
|
|
|
46581
46851
|
if (this.messageCount(first) > 0 || this.lastMessageSignature(first)) {
|
|
46582
46852
|
return first;
|
|
46583
46853
|
}
|
|
46584
|
-
await new Promise((
|
|
46854
|
+
await new Promise((resolve12) => setTimeout(resolve12, 150));
|
|
46585
46855
|
const second = await this.readChat(evaluate);
|
|
46586
46856
|
return this.messageCount(second) >= this.messageCount(first) ? second : first;
|
|
46587
46857
|
}
|
|
@@ -46732,7 +47002,7 @@ Run 'adhdev doctor' for detailed diagnostics.`
|
|
|
46732
47002
|
if (typeof data.error === "string" && data.error.trim()) return false;
|
|
46733
47003
|
}
|
|
46734
47004
|
for (let attempt = 0; attempt < 6; attempt += 1) {
|
|
46735
|
-
await new Promise((
|
|
47005
|
+
await new Promise((resolve12) => setTimeout(resolve12, 250));
|
|
46736
47006
|
const state = await this.readChat(evaluate);
|
|
46737
47007
|
const title = this.getStateTitle(state);
|
|
46738
47008
|
if (this.titlesMatch(title, sessionId)) return true;
|
|
@@ -49236,7 +49506,7 @@ async (params) => {
|
|
|
49236
49506
|
return { target, instance, adapter };
|
|
49237
49507
|
}
|
|
49238
49508
|
function sleep(ms2) {
|
|
49239
|
-
return new Promise((
|
|
49509
|
+
return new Promise((resolve12) => setTimeout(resolve12, ms2));
|
|
49240
49510
|
}
|
|
49241
49511
|
async function waitForCliReady(ctx, type, instanceId, timeoutMs) {
|
|
49242
49512
|
const startedAt = Date.now();
|
|
@@ -51490,15 +51760,15 @@ data: ${JSON.stringify(msg.data)}
|
|
|
51490
51760
|
this.json(res, 500, { error: e.message });
|
|
51491
51761
|
}
|
|
51492
51762
|
});
|
|
51493
|
-
return new Promise((
|
|
51763
|
+
return new Promise((resolve12, reject) => {
|
|
51494
51764
|
this.server.listen(port, "127.0.0.1", () => {
|
|
51495
51765
|
this.log(`Dev server listening on http://127.0.0.1:${port}`);
|
|
51496
|
-
|
|
51766
|
+
resolve12();
|
|
51497
51767
|
});
|
|
51498
51768
|
this.server.on("error", (e) => {
|
|
51499
51769
|
if (e.code === "EADDRINUSE") {
|
|
51500
51770
|
this.log(`Port ${port} in use, skipping dev server`);
|
|
51501
|
-
|
|
51771
|
+
resolve12();
|
|
51502
51772
|
} else {
|
|
51503
51773
|
reject(e);
|
|
51504
51774
|
}
|
|
@@ -51580,20 +51850,20 @@ data: ${JSON.stringify(msg.data)}
|
|
|
51580
51850
|
child.stderr?.on("data", (d) => {
|
|
51581
51851
|
stderr += d.toString().slice(0, 2e3);
|
|
51582
51852
|
});
|
|
51583
|
-
await new Promise((
|
|
51853
|
+
await new Promise((resolve12) => {
|
|
51584
51854
|
const timer = setTimeout(() => {
|
|
51585
51855
|
child.kill();
|
|
51586
|
-
|
|
51856
|
+
resolve12();
|
|
51587
51857
|
}, 3e3);
|
|
51588
51858
|
child.on("exit", () => {
|
|
51589
51859
|
clearTimeout(timer);
|
|
51590
|
-
|
|
51860
|
+
resolve12();
|
|
51591
51861
|
});
|
|
51592
51862
|
child.stdout?.once("data", () => {
|
|
51593
51863
|
setTimeout(() => {
|
|
51594
51864
|
child.kill();
|
|
51595
51865
|
clearTimeout(timer);
|
|
51596
|
-
|
|
51866
|
+
resolve12();
|
|
51597
51867
|
}, 500);
|
|
51598
51868
|
});
|
|
51599
51869
|
});
|
|
@@ -52109,14 +52379,14 @@ data: ${JSON.stringify(msg.data)}
|
|
|
52109
52379
|
child.stderr?.on("data", (d) => {
|
|
52110
52380
|
stderr += d.toString();
|
|
52111
52381
|
});
|
|
52112
|
-
await new Promise((
|
|
52382
|
+
await new Promise((resolve12) => {
|
|
52113
52383
|
const timer = setTimeout(() => {
|
|
52114
52384
|
child.kill();
|
|
52115
|
-
|
|
52385
|
+
resolve12();
|
|
52116
52386
|
}, timeout);
|
|
52117
52387
|
child.on("exit", () => {
|
|
52118
52388
|
clearTimeout(timer);
|
|
52119
|
-
|
|
52389
|
+
resolve12();
|
|
52120
52390
|
});
|
|
52121
52391
|
});
|
|
52122
52392
|
const elapsed = Date.now() - start;
|
|
@@ -52786,14 +53056,14 @@ data: ${JSON.stringify(msg.data)}
|
|
|
52786
53056
|
res.end(JSON.stringify(data, null, 2));
|
|
52787
53057
|
}
|
|
52788
53058
|
async readBody(req) {
|
|
52789
|
-
return new Promise((
|
|
53059
|
+
return new Promise((resolve12) => {
|
|
52790
53060
|
let body = "";
|
|
52791
53061
|
req.on("data", (chunk) => body += chunk);
|
|
52792
53062
|
req.on("end", () => {
|
|
52793
53063
|
try {
|
|
52794
|
-
|
|
53064
|
+
resolve12(JSON.parse(body));
|
|
52795
53065
|
} catch {
|
|
52796
|
-
|
|
53066
|
+
resolve12({});
|
|
52797
53067
|
}
|
|
52798
53068
|
});
|
|
52799
53069
|
});
|
|
@@ -53293,7 +53563,7 @@ data: ${JSON.stringify(msg.data)}
|
|
|
53293
53563
|
const deadline = Date.now() + timeoutMs;
|
|
53294
53564
|
while (Date.now() < deadline) {
|
|
53295
53565
|
if (await canConnect(endpoint)) return;
|
|
53296
|
-
await new Promise((
|
|
53566
|
+
await new Promise((resolve12) => setTimeout(resolve12, STARTUP_POLL_MS));
|
|
53297
53567
|
}
|
|
53298
53568
|
throw new Error(`Session host did not become ready within ${timeoutMs}ms`);
|
|
53299
53569
|
}
|
|
@@ -53467,10 +53737,10 @@ data: ${JSON.stringify(msg.data)}
|
|
|
53467
53737
|
const buffer = Buffer.from(await res.arrayBuffer());
|
|
53468
53738
|
const fs15 = await import("fs");
|
|
53469
53739
|
fs15.writeFileSync(vsixPath, buffer);
|
|
53470
|
-
return new Promise((
|
|
53740
|
+
return new Promise((resolve12) => {
|
|
53471
53741
|
const cmd = `"${ide.cliCommand}" --install-extension "${vsixPath}" --force`;
|
|
53472
53742
|
(0, import_child_process10.exec)(cmd, { timeout: 6e4 }, (error48, _stdout, stderr) => {
|
|
53473
|
-
|
|
53743
|
+
resolve12({
|
|
53474
53744
|
extensionId: extension.id,
|
|
53475
53745
|
marketplaceId: extension.marketplaceId,
|
|
53476
53746
|
success: !error48,
|
|
@@ -53483,11 +53753,11 @@ data: ${JSON.stringify(msg.data)}
|
|
|
53483
53753
|
} catch (e) {
|
|
53484
53754
|
}
|
|
53485
53755
|
}
|
|
53486
|
-
return new Promise((
|
|
53756
|
+
return new Promise((resolve12) => {
|
|
53487
53757
|
const cmd = `"${ide.cliCommand}" --install-extension ${extension.marketplaceId} --force`;
|
|
53488
53758
|
(0, import_child_process10.exec)(cmd, { timeout: 6e4 }, (error48, stdout, stderr) => {
|
|
53489
53759
|
if (error48) {
|
|
53490
|
-
|
|
53760
|
+
resolve12({
|
|
53491
53761
|
extensionId: extension.id,
|
|
53492
53762
|
marketplaceId: extension.marketplaceId,
|
|
53493
53763
|
success: false,
|
|
@@ -53495,7 +53765,7 @@ data: ${JSON.stringify(msg.data)}
|
|
|
53495
53765
|
error: stderr || error48.message
|
|
53496
53766
|
});
|
|
53497
53767
|
} else {
|
|
53498
|
-
|
|
53768
|
+
resolve12({
|
|
53499
53769
|
extensionId: extension.id,
|
|
53500
53770
|
marketplaceId: extension.marketplaceId,
|
|
53501
53771
|
success: true,
|
|
@@ -55332,7 +55602,6 @@ var StandaloneServer = class {
|
|
|
55332
55602
|
const status = this.getWsStatus(this.buildSharedSnapshot("live"));
|
|
55333
55603
|
this.lastWsStatusSignature = this.buildWsStatusSignature(status);
|
|
55334
55604
|
ws2.send(JSON.stringify({ type: "status", data: status }));
|
|
55335
|
-
void this.pushWsRuntimeSnapshots(ws2);
|
|
55336
55605
|
ws2.on("message", async (raw) => {
|
|
55337
55606
|
try {
|
|
55338
55607
|
const msg = JSON.parse(raw.toString());
|