@adhdev/daemon-standalone 0.8.56 → 0.8.58
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 +311 -155
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/public/assets/index-CF-NeZlX.js +72 -0
- package/public/assets/{index-OHw5X7HM.css → index-DA7jOoZ9.css} +1 -1
- package/public/index.html +2 -2
- package/vendor/session-host-daemon/index.d.mts +1 -0
- package/vendor/session-host-daemon/index.d.ts +1 -0
- package/vendor/session-host-daemon/index.js +10 -1
- package/vendor/session-host-daemon/index.js.map +1 -1
- package/vendor/session-host-daemon/index.mjs +10 -1
- package/vendor/session-host-daemon/index.mjs.map +1 -1
- package/public/assets/index-C46eMfhn.js +0 -71
package/dist/index.js
CHANGED
|
@@ -27874,9 +27874,16 @@ var require_dist2 = __commonJS({
|
|
|
27874
27874
|
loadConfig: () => loadConfig2,
|
|
27875
27875
|
markSetupComplete: () => markSetupComplete,
|
|
27876
27876
|
resetConfig: () => resetConfig,
|
|
27877
|
+
resolveProviderSourceMode: () => resolveProviderSourceMode,
|
|
27877
27878
|
saveConfig: () => saveConfig,
|
|
27878
27879
|
updateConfig: () => updateConfig
|
|
27879
27880
|
});
|
|
27881
|
+
function resolveProviderSourceMode(providerSourceMode, legacyDisableUpstream) {
|
|
27882
|
+
if (providerSourceMode === "normal" || providerSourceMode === "no-upstream") {
|
|
27883
|
+
return providerSourceMode;
|
|
27884
|
+
}
|
|
27885
|
+
return legacyDisableUpstream === true ? "no-upstream" : "normal";
|
|
27886
|
+
}
|
|
27880
27887
|
function isPlainObject2(value) {
|
|
27881
27888
|
return !!value && typeof value === "object" && !Array.isArray(value);
|
|
27882
27889
|
}
|
|
@@ -27914,7 +27921,7 @@ var require_dist2 = __commonJS({
|
|
|
27914
27921
|
registeredMachineId: asOptionalString(parsed.registeredMachineId),
|
|
27915
27922
|
providerSettings: isPlainObject2(parsed.providerSettings) ? parsed.providerSettings : {},
|
|
27916
27923
|
ideSettings: isPlainObject2(parsed.ideSettings) ? parsed.ideSettings : {},
|
|
27917
|
-
|
|
27924
|
+
providerSourceMode: resolveProviderSourceMode(parsed.providerSourceMode, parsed.disableUpstream),
|
|
27918
27925
|
providerDir: asOptionalString(parsed.providerDir),
|
|
27919
27926
|
terminalSizingMode: parsed.terminalSizingMode === "fit" ? "fit" : "measured"
|
|
27920
27927
|
};
|
|
@@ -28068,7 +28075,7 @@ var require_dist2 = __commonJS({
|
|
|
28068
28075
|
registeredMachineId: void 0,
|
|
28069
28076
|
providerSettings: {},
|
|
28070
28077
|
ideSettings: {},
|
|
28071
|
-
|
|
28078
|
+
providerSourceMode: "normal",
|
|
28072
28079
|
terminalSizingMode: "measured"
|
|
28073
28080
|
};
|
|
28074
28081
|
MACHINE_ID_PREFIX = "mach_";
|
|
@@ -29747,7 +29754,7 @@ var require_dist2 = __commonJS({
|
|
|
29747
29754
|
`[${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)}`
|
|
29748
29755
|
);
|
|
29749
29756
|
}
|
|
29750
|
-
await new Promise((
|
|
29757
|
+
await new Promise((resolve11) => setTimeout(resolve11, 50));
|
|
29751
29758
|
}
|
|
29752
29759
|
const finalScreenText = this.terminalScreen.getText() || "";
|
|
29753
29760
|
LOG2.warn(
|
|
@@ -30320,7 +30327,7 @@ ${data.message || ""}`.trim();
|
|
|
30320
30327
|
const deadline = Date.now() + 1e4;
|
|
30321
30328
|
while (this.startupParseGate && Date.now() < deadline) {
|
|
30322
30329
|
this.resolveStartupState("send_wait");
|
|
30323
|
-
await new Promise((
|
|
30330
|
+
await new Promise((resolve11) => setTimeout(resolve11, 50));
|
|
30324
30331
|
}
|
|
30325
30332
|
}
|
|
30326
30333
|
await this.waitForInteractivePrompt();
|
|
@@ -30390,12 +30397,12 @@ ${data.message || ""}`.trim();
|
|
|
30390
30397
|
if (this.isWaitingForResponse) this.finishResponse();
|
|
30391
30398
|
}, this.timeouts.maxResponse);
|
|
30392
30399
|
};
|
|
30393
|
-
await new Promise((
|
|
30400
|
+
await new Promise((resolve11) => {
|
|
30394
30401
|
let resolved = false;
|
|
30395
30402
|
const resolveOnce = () => {
|
|
30396
30403
|
if (resolved) return;
|
|
30397
30404
|
resolved = true;
|
|
30398
|
-
|
|
30405
|
+
resolve11();
|
|
30399
30406
|
};
|
|
30400
30407
|
const submit = () => {
|
|
30401
30408
|
if (!this.ptyProcess) {
|
|
@@ -30569,17 +30576,17 @@ ${data.message || ""}`.trim();
|
|
|
30569
30576
|
}
|
|
30570
30577
|
}
|
|
30571
30578
|
waitForStopped(timeoutMs) {
|
|
30572
|
-
return new Promise((
|
|
30579
|
+
return new Promise((resolve11) => {
|
|
30573
30580
|
const startedAt = Date.now();
|
|
30574
30581
|
const timer = setInterval(() => {
|
|
30575
30582
|
if (!this.ptyProcess || this.currentStatus === "stopped") {
|
|
30576
30583
|
clearInterval(timer);
|
|
30577
|
-
|
|
30584
|
+
resolve11(true);
|
|
30578
30585
|
return;
|
|
30579
30586
|
}
|
|
30580
30587
|
if (Date.now() - startedAt >= timeoutMs) {
|
|
30581
30588
|
clearInterval(timer);
|
|
30582
|
-
|
|
30589
|
+
resolve11(false);
|
|
30583
30590
|
}
|
|
30584
30591
|
}, 100);
|
|
30585
30592
|
});
|
|
@@ -30932,6 +30939,7 @@ ${data.message || ""}`.trim();
|
|
|
30932
30939
|
normalizeInputEnvelope: () => normalizeInputEnvelope,
|
|
30933
30940
|
normalizeManagedStatus: () => normalizeManagedStatus,
|
|
30934
30941
|
normalizeMessageParts: () => normalizeMessageParts,
|
|
30942
|
+
parseProviderSourceConfigUpdate: () => parseProviderSourceConfigUpdate,
|
|
30935
30943
|
partitionSessionHostDiagnosticsSessions: () => partitionSessionHostDiagnosticsSessions,
|
|
30936
30944
|
partitionSessionHostRecords: () => partitionSessionHostRecords,
|
|
30937
30945
|
probeCdpPort: () => probeCdpPort,
|
|
@@ -31412,15 +31420,15 @@ ${data.message || ""}`.trim();
|
|
|
31412
31420
|
return null;
|
|
31413
31421
|
}
|
|
31414
31422
|
function execAsync(cmd, timeoutMs = 5e3) {
|
|
31415
|
-
return new Promise((
|
|
31423
|
+
return new Promise((resolve11) => {
|
|
31416
31424
|
const child = (0, import_child_process22.exec)(cmd, { encoding: "utf-8", timeout: timeoutMs }, (err, stdout) => {
|
|
31417
31425
|
if (err || !stdout?.trim()) {
|
|
31418
|
-
|
|
31426
|
+
resolve11(null);
|
|
31419
31427
|
} else {
|
|
31420
|
-
|
|
31428
|
+
resolve11(stdout.trim());
|
|
31421
31429
|
}
|
|
31422
31430
|
});
|
|
31423
|
-
child.on("error", () =>
|
|
31431
|
+
child.on("error", () => resolve11(null));
|
|
31424
31432
|
});
|
|
31425
31433
|
}
|
|
31426
31434
|
async function detectCLIs(providerLoader, options) {
|
|
@@ -31627,7 +31635,7 @@ ${data.message || ""}`.trim();
|
|
|
31627
31635
|
* Returns multiple entries if multiple IDE windows are open on same port
|
|
31628
31636
|
*/
|
|
31629
31637
|
static listAllTargets(port) {
|
|
31630
|
-
return new Promise((
|
|
31638
|
+
return new Promise((resolve11) => {
|
|
31631
31639
|
const req = http.get(`http://127.0.0.1:${port}/json`, (res) => {
|
|
31632
31640
|
let data = "";
|
|
31633
31641
|
res.on("data", (chunk) => data += chunk.toString());
|
|
@@ -31643,16 +31651,16 @@ ${data.message || ""}`.trim();
|
|
|
31643
31651
|
(t) => !isNonMain(t.title || "") && t.url?.includes("workbench.html") && !t.url?.includes("agent")
|
|
31644
31652
|
);
|
|
31645
31653
|
const fallbackPages = pages.filter((t) => !isNonMain(t.title || ""));
|
|
31646
|
-
|
|
31654
|
+
resolve11(mainPages.length > 0 ? mainPages : fallbackPages);
|
|
31647
31655
|
} catch {
|
|
31648
|
-
|
|
31656
|
+
resolve11([]);
|
|
31649
31657
|
}
|
|
31650
31658
|
});
|
|
31651
31659
|
});
|
|
31652
|
-
req.on("error", () =>
|
|
31660
|
+
req.on("error", () => resolve11([]));
|
|
31653
31661
|
req.setTimeout(2e3, () => {
|
|
31654
31662
|
req.destroy();
|
|
31655
|
-
|
|
31663
|
+
resolve11([]);
|
|
31656
31664
|
});
|
|
31657
31665
|
});
|
|
31658
31666
|
}
|
|
@@ -31692,7 +31700,7 @@ ${data.message || ""}`.trim();
|
|
|
31692
31700
|
}
|
|
31693
31701
|
}
|
|
31694
31702
|
findTargetOnPort(port) {
|
|
31695
|
-
return new Promise((
|
|
31703
|
+
return new Promise((resolve11) => {
|
|
31696
31704
|
const req = http.get(`http://127.0.0.1:${port}/json`, (res) => {
|
|
31697
31705
|
let data = "";
|
|
31698
31706
|
res.on("data", (chunk) => data += chunk.toString());
|
|
@@ -31703,7 +31711,7 @@ ${data.message || ""}`.trim();
|
|
|
31703
31711
|
(t) => (t.type === "page" || t.type === "browser" || t.type === "Page") && t.webSocketDebuggerUrl
|
|
31704
31712
|
);
|
|
31705
31713
|
if (pages.length === 0) {
|
|
31706
|
-
|
|
31714
|
+
resolve11(targets.find((t) => t.webSocketDebuggerUrl) || null);
|
|
31707
31715
|
return;
|
|
31708
31716
|
}
|
|
31709
31717
|
const mainPages = pages.filter((t) => !this.isNonMainTitle(t.title || ""));
|
|
@@ -31713,24 +31721,24 @@ ${data.message || ""}`.trim();
|
|
|
31713
31721
|
const specific = list.find((t) => t.id === this._targetId);
|
|
31714
31722
|
if (specific) {
|
|
31715
31723
|
this._pageTitle = specific.title || "";
|
|
31716
|
-
|
|
31724
|
+
resolve11(specific);
|
|
31717
31725
|
} else {
|
|
31718
31726
|
this.log(`[CDP] Target ${this._targetId} not found in page list`);
|
|
31719
|
-
|
|
31727
|
+
resolve11(null);
|
|
31720
31728
|
}
|
|
31721
31729
|
return;
|
|
31722
31730
|
}
|
|
31723
31731
|
this._pageTitle = list[0]?.title || "";
|
|
31724
|
-
|
|
31732
|
+
resolve11(list[0]);
|
|
31725
31733
|
} catch {
|
|
31726
|
-
|
|
31734
|
+
resolve11(null);
|
|
31727
31735
|
}
|
|
31728
31736
|
});
|
|
31729
31737
|
});
|
|
31730
|
-
req.on("error", () =>
|
|
31738
|
+
req.on("error", () => resolve11(null));
|
|
31731
31739
|
req.setTimeout(2e3, () => {
|
|
31732
31740
|
req.destroy();
|
|
31733
|
-
|
|
31741
|
+
resolve11(null);
|
|
31734
31742
|
});
|
|
31735
31743
|
});
|
|
31736
31744
|
}
|
|
@@ -31741,7 +31749,7 @@ ${data.message || ""}`.trim();
|
|
|
31741
31749
|
this.extensionProviders = providers;
|
|
31742
31750
|
}
|
|
31743
31751
|
connectToTarget(wsUrl) {
|
|
31744
|
-
return new Promise((
|
|
31752
|
+
return new Promise((resolve11) => {
|
|
31745
31753
|
this.ws = new import_ws2.default(wsUrl);
|
|
31746
31754
|
this.ws.on("open", async () => {
|
|
31747
31755
|
this._connected = true;
|
|
@@ -31751,17 +31759,17 @@ ${data.message || ""}`.trim();
|
|
|
31751
31759
|
}
|
|
31752
31760
|
this.connectBrowserWs().catch(() => {
|
|
31753
31761
|
});
|
|
31754
|
-
|
|
31762
|
+
resolve11(true);
|
|
31755
31763
|
});
|
|
31756
31764
|
this.ws.on("message", (data) => {
|
|
31757
31765
|
try {
|
|
31758
31766
|
const msg = JSON.parse(data.toString());
|
|
31759
31767
|
if (msg.id && this.pending.has(msg.id)) {
|
|
31760
|
-
const { resolve:
|
|
31768
|
+
const { resolve: resolve12, reject } = this.pending.get(msg.id);
|
|
31761
31769
|
this.pending.delete(msg.id);
|
|
31762
31770
|
this.failureCount = 0;
|
|
31763
31771
|
if (msg.error) reject(new Error(msg.error.message));
|
|
31764
|
-
else
|
|
31772
|
+
else resolve12(msg.result);
|
|
31765
31773
|
} else if (msg.method === "Runtime.executionContextCreated") {
|
|
31766
31774
|
this.contexts.add(msg.params.context.id);
|
|
31767
31775
|
} else if (msg.method === "Runtime.executionContextDestroyed") {
|
|
@@ -31784,7 +31792,7 @@ ${data.message || ""}`.trim();
|
|
|
31784
31792
|
this.ws.on("error", (err) => {
|
|
31785
31793
|
this.log(`[CDP] WebSocket error: ${err.message}`);
|
|
31786
31794
|
this._connected = false;
|
|
31787
|
-
|
|
31795
|
+
resolve11(false);
|
|
31788
31796
|
});
|
|
31789
31797
|
});
|
|
31790
31798
|
}
|
|
@@ -31798,7 +31806,7 @@ ${data.message || ""}`.trim();
|
|
|
31798
31806
|
return;
|
|
31799
31807
|
}
|
|
31800
31808
|
this.log(`[CDP] Connecting browser WS for target discovery...`);
|
|
31801
|
-
await new Promise((
|
|
31809
|
+
await new Promise((resolve11, reject) => {
|
|
31802
31810
|
this.browserWs = new import_ws2.default(browserWsUrl);
|
|
31803
31811
|
this.browserWs.on("open", async () => {
|
|
31804
31812
|
this._browserConnected = true;
|
|
@@ -31808,16 +31816,16 @@ ${data.message || ""}`.trim();
|
|
|
31808
31816
|
} catch (e) {
|
|
31809
31817
|
this.log(`[CDP] setDiscoverTargets failed: ${e.message}`);
|
|
31810
31818
|
}
|
|
31811
|
-
|
|
31819
|
+
resolve11();
|
|
31812
31820
|
});
|
|
31813
31821
|
this.browserWs.on("message", (data) => {
|
|
31814
31822
|
try {
|
|
31815
31823
|
const msg = JSON.parse(data.toString());
|
|
31816
31824
|
if (msg.id && this.browserPending.has(msg.id)) {
|
|
31817
|
-
const { resolve:
|
|
31825
|
+
const { resolve: resolve12, reject: reject2 } = this.browserPending.get(msg.id);
|
|
31818
31826
|
this.browserPending.delete(msg.id);
|
|
31819
31827
|
if (msg.error) reject2(new Error(msg.error.message));
|
|
31820
|
-
else
|
|
31828
|
+
else resolve12(msg.result);
|
|
31821
31829
|
}
|
|
31822
31830
|
} catch {
|
|
31823
31831
|
}
|
|
@@ -31837,31 +31845,31 @@ ${data.message || ""}`.trim();
|
|
|
31837
31845
|
}
|
|
31838
31846
|
}
|
|
31839
31847
|
getBrowserWsUrl() {
|
|
31840
|
-
return new Promise((
|
|
31848
|
+
return new Promise((resolve11) => {
|
|
31841
31849
|
const req = http.get(`http://127.0.0.1:${this.port}/json/version`, (res) => {
|
|
31842
31850
|
let data = "";
|
|
31843
31851
|
res.on("data", (chunk) => data += chunk.toString());
|
|
31844
31852
|
res.on("end", () => {
|
|
31845
31853
|
try {
|
|
31846
31854
|
const info = JSON.parse(data);
|
|
31847
|
-
|
|
31855
|
+
resolve11(info.webSocketDebuggerUrl || null);
|
|
31848
31856
|
} catch {
|
|
31849
|
-
|
|
31857
|
+
resolve11(null);
|
|
31850
31858
|
}
|
|
31851
31859
|
});
|
|
31852
31860
|
});
|
|
31853
|
-
req.on("error", () =>
|
|
31861
|
+
req.on("error", () => resolve11(null));
|
|
31854
31862
|
req.setTimeout(3e3, () => {
|
|
31855
31863
|
req.destroy();
|
|
31856
|
-
|
|
31864
|
+
resolve11(null);
|
|
31857
31865
|
});
|
|
31858
31866
|
});
|
|
31859
31867
|
}
|
|
31860
31868
|
sendBrowser(method, params = {}, timeoutMs = 15e3) {
|
|
31861
|
-
return new Promise((
|
|
31869
|
+
return new Promise((resolve11, reject) => {
|
|
31862
31870
|
if (!this.browserWs || !this._browserConnected) return reject(new Error("Browser WS not connected"));
|
|
31863
31871
|
const id = this.browserMsgId++;
|
|
31864
|
-
this.browserPending.set(id, { resolve:
|
|
31872
|
+
this.browserPending.set(id, { resolve: resolve11, reject });
|
|
31865
31873
|
this.browserWs.send(JSON.stringify({ id, method, params }));
|
|
31866
31874
|
setTimeout(() => {
|
|
31867
31875
|
if (this.browserPending.has(id)) {
|
|
@@ -31901,11 +31909,11 @@ ${data.message || ""}`.trim();
|
|
|
31901
31909
|
}
|
|
31902
31910
|
// ─── CDP Protocol ────────────────────────────────────────
|
|
31903
31911
|
sendInternal(method, params = {}, timeoutMs = 15e3) {
|
|
31904
|
-
return new Promise((
|
|
31912
|
+
return new Promise((resolve11, reject) => {
|
|
31905
31913
|
if (!this.ws || !this._connected) return reject(new Error("CDP not connected"));
|
|
31906
31914
|
if (this.ws.readyState !== import_ws2.default.OPEN) return reject(new Error("WebSocket not open"));
|
|
31907
31915
|
const id = this.msgId++;
|
|
31908
|
-
this.pending.set(id, { resolve:
|
|
31916
|
+
this.pending.set(id, { resolve: resolve11, reject });
|
|
31909
31917
|
this.ws.send(JSON.stringify({ id, method, params }));
|
|
31910
31918
|
setTimeout(() => {
|
|
31911
31919
|
if (this.pending.has(id)) {
|
|
@@ -32154,7 +32162,7 @@ ${data.message || ""}`.trim();
|
|
|
32154
32162
|
const browserWs = this.browserWs;
|
|
32155
32163
|
let msgId = this.browserMsgId;
|
|
32156
32164
|
const sendWs = (method, params = {}, sessionId) => {
|
|
32157
|
-
return new Promise((
|
|
32165
|
+
return new Promise((resolve11, reject) => {
|
|
32158
32166
|
const mid = msgId++;
|
|
32159
32167
|
this.browserMsgId = msgId;
|
|
32160
32168
|
const handler = (raw) => {
|
|
@@ -32163,7 +32171,7 @@ ${data.message || ""}`.trim();
|
|
|
32163
32171
|
if (msg.id === mid) {
|
|
32164
32172
|
browserWs.removeListener("message", handler);
|
|
32165
32173
|
if (msg.error) reject(new Error(msg.error.message || JSON.stringify(msg.error)));
|
|
32166
|
-
else
|
|
32174
|
+
else resolve11(msg.result);
|
|
32167
32175
|
}
|
|
32168
32176
|
} catch {
|
|
32169
32177
|
}
|
|
@@ -32364,14 +32372,14 @@ ${data.message || ""}`.trim();
|
|
|
32364
32372
|
if (!ws2 || ws2.readyState !== import_ws2.default.OPEN) {
|
|
32365
32373
|
throw new Error("CDP not connected");
|
|
32366
32374
|
}
|
|
32367
|
-
return new Promise((
|
|
32375
|
+
return new Promise((resolve11, reject) => {
|
|
32368
32376
|
const id = getNextId();
|
|
32369
32377
|
pendingMap.set(id, {
|
|
32370
32378
|
resolve: (result) => {
|
|
32371
32379
|
if (result?.result?.subtype === "error") {
|
|
32372
32380
|
reject(new Error(result.result.description));
|
|
32373
32381
|
} else {
|
|
32374
|
-
|
|
32382
|
+
resolve11(result?.result?.value);
|
|
32375
32383
|
}
|
|
32376
32384
|
},
|
|
32377
32385
|
reject
|
|
@@ -32403,10 +32411,10 @@ ${data.message || ""}`.trim();
|
|
|
32403
32411
|
throw new Error("CDP not connected");
|
|
32404
32412
|
}
|
|
32405
32413
|
const sendViaSession = (method, params = {}) => {
|
|
32406
|
-
return new Promise((
|
|
32414
|
+
return new Promise((resolve11, reject) => {
|
|
32407
32415
|
const pendingMap = this._browserConnected ? this.browserPending : this.pending;
|
|
32408
32416
|
const id = this._browserConnected ? this.browserMsgId++ : this.msgId++;
|
|
32409
|
-
pendingMap.set(id, { resolve:
|
|
32417
|
+
pendingMap.set(id, { resolve: resolve11, reject });
|
|
32410
32418
|
ws2.send(JSON.stringify({ id, sessionId, method, params }));
|
|
32411
32419
|
setTimeout(() => {
|
|
32412
32420
|
if (pendingMap.has(id)) {
|
|
@@ -33306,6 +33314,30 @@ ${data.message || ""}`.trim();
|
|
|
33306
33314
|
options.historySessionId
|
|
33307
33315
|
);
|
|
33308
33316
|
}
|
|
33317
|
+
writeSessionStart(agentType, historySessionId, workspace, instanceId) {
|
|
33318
|
+
const id = String(historySessionId || "").trim();
|
|
33319
|
+
const ws2 = String(workspace || "").trim();
|
|
33320
|
+
if (!id || !ws2) return;
|
|
33321
|
+
try {
|
|
33322
|
+
const dir = path7.join(HISTORY_DIR, this.sanitize(agentType));
|
|
33323
|
+
fs32.mkdirSync(dir, { recursive: true });
|
|
33324
|
+
const date5 = (/* @__PURE__ */ new Date()).toISOString().slice(0, 10);
|
|
33325
|
+
const filePath = path7.join(dir, `${this.sanitize(id)}_${date5}.jsonl`);
|
|
33326
|
+
const record2 = {
|
|
33327
|
+
ts: (/* @__PURE__ */ new Date()).toISOString(),
|
|
33328
|
+
receivedAt: Date.now(),
|
|
33329
|
+
role: "system",
|
|
33330
|
+
kind: "session_start",
|
|
33331
|
+
content: ws2,
|
|
33332
|
+
agent: agentType,
|
|
33333
|
+
instanceId,
|
|
33334
|
+
historySessionId: id,
|
|
33335
|
+
workspace: ws2
|
|
33336
|
+
};
|
|
33337
|
+
fs32.appendFileSync(filePath, JSON.stringify(record2) + "\n", "utf-8");
|
|
33338
|
+
} catch {
|
|
33339
|
+
}
|
|
33340
|
+
}
|
|
33309
33341
|
promoteHistorySession(agentType, previousHistorySessionId, nextHistorySessionId) {
|
|
33310
33342
|
const fromId = String(previousHistorySessionId || "").trim();
|
|
33311
33343
|
const toId = String(nextHistorySessionId || "").trim();
|
|
@@ -33525,6 +33557,7 @@ ${data.message || ""}`.trim();
|
|
|
33525
33557
|
let lastMessageAt = 0;
|
|
33526
33558
|
let sessionTitle = "";
|
|
33527
33559
|
let preview = "";
|
|
33560
|
+
let workspace = "";
|
|
33528
33561
|
for (const file2 of files.sort()) {
|
|
33529
33562
|
const filePath = path7.join(dir, file2);
|
|
33530
33563
|
const content = fs32.readFileSync(filePath, "utf-8");
|
|
@@ -33537,6 +33570,10 @@ ${data.message || ""}`.trim();
|
|
|
33537
33570
|
parsed = null;
|
|
33538
33571
|
}
|
|
33539
33572
|
if (!parsed || parsed.historySessionId !== historySessionId) continue;
|
|
33573
|
+
if (parsed.kind === "session_start") {
|
|
33574
|
+
if (!workspace && parsed.workspace) workspace = parsed.workspace;
|
|
33575
|
+
continue;
|
|
33576
|
+
}
|
|
33540
33577
|
messageCount += 1;
|
|
33541
33578
|
if (!firstMessageAt || parsed.receivedAt < firstMessageAt) firstMessageAt = parsed.receivedAt;
|
|
33542
33579
|
if (!lastMessageAt || parsed.receivedAt > lastMessageAt) lastMessageAt = parsed.receivedAt;
|
|
@@ -33551,7 +33588,8 @@ ${data.message || ""}`.trim();
|
|
|
33551
33588
|
messageCount,
|
|
33552
33589
|
firstMessageAt,
|
|
33553
33590
|
lastMessageAt,
|
|
33554
|
-
preview: preview || void 0
|
|
33591
|
+
preview: preview || void 0,
|
|
33592
|
+
workspace: workspace || void 0
|
|
33555
33593
|
});
|
|
33556
33594
|
}
|
|
33557
33595
|
summaries.sort((a, b2) => b2.lastMessageAt - a.lastMessageAt);
|
|
@@ -35892,7 +35930,7 @@ ${effect.notification.body || ""}`.trim();
|
|
|
35892
35930
|
async function getStableExtensionBaseline(h) {
|
|
35893
35931
|
const first = await readExtensionChatState(h);
|
|
35894
35932
|
if (getStateMessageCount(first) > 0 || getStateLastSignature(first)) return first;
|
|
35895
|
-
await new Promise((
|
|
35933
|
+
await new Promise((resolve11) => setTimeout(resolve11, 150));
|
|
35896
35934
|
const second = await readExtensionChatState(h);
|
|
35897
35935
|
return getStateMessageCount(second) >= getStateMessageCount(first) ? second : first;
|
|
35898
35936
|
}
|
|
@@ -35900,7 +35938,7 @@ ${effect.notification.body || ""}`.trim();
|
|
|
35900
35938
|
const beforeCount = getStateMessageCount(before);
|
|
35901
35939
|
const beforeSignature = getStateLastSignature(before);
|
|
35902
35940
|
for (let attempt = 0; attempt < 12; attempt += 1) {
|
|
35903
|
-
await new Promise((
|
|
35941
|
+
await new Promise((resolve11) => setTimeout(resolve11, 250));
|
|
35904
35942
|
const state = await readExtensionChatState(h);
|
|
35905
35943
|
if (state?.status === "waiting_approval") return true;
|
|
35906
35944
|
const afterCount = getStateMessageCount(state);
|
|
@@ -37089,6 +37127,26 @@ ${effect.notification.body || ""}`.trim();
|
|
|
37089
37127
|
return { success: false, error: e.message };
|
|
37090
37128
|
}
|
|
37091
37129
|
}
|
|
37130
|
+
init_config();
|
|
37131
|
+
function normalizeProviderDir(value) {
|
|
37132
|
+
if (typeof value !== "string") return void 0;
|
|
37133
|
+
const trimmed = value.trim();
|
|
37134
|
+
return trimmed ? trimmed : void 0;
|
|
37135
|
+
}
|
|
37136
|
+
function parseProviderSourceConfigUpdate(input) {
|
|
37137
|
+
const updates = {};
|
|
37138
|
+
if (Object.prototype.hasOwnProperty.call(input, "providerSourceMode")) {
|
|
37139
|
+
const { providerSourceMode } = input;
|
|
37140
|
+
if (providerSourceMode !== "normal" && providerSourceMode !== "no-upstream") {
|
|
37141
|
+
return { ok: false, error: "providerSourceMode must be 'normal' or 'no-upstream'" };
|
|
37142
|
+
}
|
|
37143
|
+
updates.providerSourceMode = providerSourceMode;
|
|
37144
|
+
}
|
|
37145
|
+
if (Object.prototype.hasOwnProperty.call(input, "providerDir")) {
|
|
37146
|
+
updates.providerDir = normalizeProviderDir(input.providerDir);
|
|
37147
|
+
}
|
|
37148
|
+
return { ok: true, updates };
|
|
37149
|
+
}
|
|
37092
37150
|
function parseCliScriptResult(result) {
|
|
37093
37151
|
if (typeof result === "string") {
|
|
37094
37152
|
try {
|
|
@@ -37198,6 +37256,38 @@ ${effect.notification.body || ""}`.trim();
|
|
|
37198
37256
|
}
|
|
37199
37257
|
return { success: false, error: `Failed to set ${providerType}.${key} \u2014 invalid key, value, or not a public setting` };
|
|
37200
37258
|
}
|
|
37259
|
+
function handleGetProviderSourceConfig(h, _args) {
|
|
37260
|
+
const loader = h.ctx.providerLoader;
|
|
37261
|
+
if (!loader) return { success: false, error: "providerLoader not available" };
|
|
37262
|
+
return { success: true, ...loader.getSourceConfig() };
|
|
37263
|
+
}
|
|
37264
|
+
async function handleSetProviderSourceConfig(h, args) {
|
|
37265
|
+
const loader = h.ctx.providerLoader;
|
|
37266
|
+
if (!loader) return { success: false, error: "providerLoader not available" };
|
|
37267
|
+
const parsed = parseProviderSourceConfigUpdate(args || {});
|
|
37268
|
+
if ("error" in parsed) {
|
|
37269
|
+
return { success: false, error: parsed.error };
|
|
37270
|
+
}
|
|
37271
|
+
const currentConfig2 = loadConfig2();
|
|
37272
|
+
const nextConfig = {
|
|
37273
|
+
...currentConfig2,
|
|
37274
|
+
...parsed.updates.providerSourceMode ? { providerSourceMode: parsed.updates.providerSourceMode } : {},
|
|
37275
|
+
...Object.prototype.hasOwnProperty.call(parsed.updates, "providerDir") ? { providerDir: parsed.updates.providerDir } : {}
|
|
37276
|
+
};
|
|
37277
|
+
saveConfig(nextConfig);
|
|
37278
|
+
const sourceConfig = loader.applySourceConfig({
|
|
37279
|
+
sourceMode: nextConfig.providerSourceMode,
|
|
37280
|
+
userDir: Object.prototype.hasOwnProperty.call(parsed.updates, "providerDir") ? parsed.updates.providerDir : loader.getSourceConfig().explicitProviderDir || void 0
|
|
37281
|
+
});
|
|
37282
|
+
loader.reload();
|
|
37283
|
+
loader.registerToDetector();
|
|
37284
|
+
await h.ctx.onProviderSourceConfigChanged?.();
|
|
37285
|
+
LOG2.info(
|
|
37286
|
+
"Command",
|
|
37287
|
+
`[set_provider_source_config] mode=${sourceConfig.sourceMode} explicitProviderDir=${sourceConfig.explicitProviderDir || "-"} userDir=${sourceConfig.userDir}`
|
|
37288
|
+
);
|
|
37289
|
+
return { success: true, reloaded: true, ...sourceConfig };
|
|
37290
|
+
}
|
|
37201
37291
|
function normalizeProviderScriptArgs(args) {
|
|
37202
37292
|
const normalizedArgs = { ...args || {} };
|
|
37203
37293
|
for (const key of ["mode", "model", "message", "action", "button", "text", "sessionId", "value"]) {
|
|
@@ -37887,6 +37977,10 @@ ${effect.notification.body || ""}`.trim();
|
|
|
37887
37977
|
return handleGetProviderSettings(this, args);
|
|
37888
37978
|
case "set_provider_setting":
|
|
37889
37979
|
return handleSetProviderSetting(this, args);
|
|
37980
|
+
case "get_provider_source_config":
|
|
37981
|
+
return handleGetProviderSourceConfig(this, args);
|
|
37982
|
+
case "set_provider_source_config":
|
|
37983
|
+
return handleSetProviderSourceConfig(this, args);
|
|
37890
37984
|
// ─── IDE Extension Settings (stream-commands.ts) ──────────
|
|
37891
37985
|
case "get_ide_extensions":
|
|
37892
37986
|
return handleGetIdeExtensions(this, args);
|
|
@@ -37926,7 +38020,7 @@ ${effect.notification.body || ""}`.trim();
|
|
|
37926
38020
|
try {
|
|
37927
38021
|
const http3 = await import("http");
|
|
37928
38022
|
const postData = JSON.stringify(body);
|
|
37929
|
-
const result = await new Promise((
|
|
38023
|
+
const result = await new Promise((resolve11, reject) => {
|
|
37930
38024
|
const req = http3.request({
|
|
37931
38025
|
hostname: "127.0.0.1",
|
|
37932
38026
|
port: 19280,
|
|
@@ -37938,9 +38032,9 @@ ${effect.notification.body || ""}`.trim();
|
|
|
37938
38032
|
res.on("data", (chunk) => data += chunk);
|
|
37939
38033
|
res.on("end", () => {
|
|
37940
38034
|
try {
|
|
37941
|
-
|
|
38035
|
+
resolve11(JSON.parse(data));
|
|
37942
38036
|
} catch {
|
|
37943
|
-
|
|
38037
|
+
resolve11({ raw: data });
|
|
37944
38038
|
}
|
|
37945
38039
|
});
|
|
37946
38040
|
});
|
|
@@ -37958,15 +38052,15 @@ ${effect.notification.body || ""}`.trim();
|
|
|
37958
38052
|
if (!providerType) return { success: false, error: "providerType required" };
|
|
37959
38053
|
try {
|
|
37960
38054
|
const http3 = await import("http");
|
|
37961
|
-
const result = await new Promise((
|
|
38055
|
+
const result = await new Promise((resolve11, reject) => {
|
|
37962
38056
|
http3.get(`http://127.0.0.1:19280/api/providers/${providerType}/${endpoint}`, (res) => {
|
|
37963
38057
|
let data = "";
|
|
37964
38058
|
res.on("data", (chunk) => data += chunk);
|
|
37965
38059
|
res.on("end", () => {
|
|
37966
38060
|
try {
|
|
37967
|
-
|
|
38061
|
+
resolve11(JSON.parse(data));
|
|
37968
38062
|
} catch {
|
|
37969
|
-
|
|
38063
|
+
resolve11({ raw: data });
|
|
37970
38064
|
}
|
|
37971
38065
|
});
|
|
37972
38066
|
}).on("error", reject);
|
|
@@ -37980,7 +38074,7 @@ ${effect.notification.body || ""}`.trim();
|
|
|
37980
38074
|
try {
|
|
37981
38075
|
const http3 = await import("http");
|
|
37982
38076
|
const postData = JSON.stringify(args || {});
|
|
37983
|
-
const result = await new Promise((
|
|
38077
|
+
const result = await new Promise((resolve11, reject) => {
|
|
37984
38078
|
const req = http3.request({
|
|
37985
38079
|
hostname: "127.0.0.1",
|
|
37986
38080
|
port: 19280,
|
|
@@ -37992,9 +38086,9 @@ ${effect.notification.body || ""}`.trim();
|
|
|
37992
38086
|
res.on("data", (chunk) => data += chunk);
|
|
37993
38087
|
res.on("end", () => {
|
|
37994
38088
|
try {
|
|
37995
|
-
|
|
38089
|
+
resolve11(JSON.parse(data));
|
|
37996
38090
|
} catch {
|
|
37997
|
-
|
|
38091
|
+
resolve11({ raw: data });
|
|
37998
38092
|
}
|
|
37999
38093
|
});
|
|
38000
38094
|
});
|
|
@@ -38040,6 +38134,9 @@ ${effect.notification.body || ""}`.trim();
|
|
|
38040
38134
|
const controls = Array.isArray(provider.controls) ? provider.controls : [];
|
|
38041
38135
|
for (const control of controls) {
|
|
38042
38136
|
if (control?.type !== "action") continue;
|
|
38137
|
+
if (typeof control?.confirmTitle === "string" && control.confirmTitle.trim()) continue;
|
|
38138
|
+
if (typeof control?.confirmMessage === "string" && control.confirmMessage.trim()) continue;
|
|
38139
|
+
if (typeof control?.confirmLabel === "string" && control.confirmLabel.trim()) continue;
|
|
38043
38140
|
const invokeScript = typeof control?.invokeScript === "string" ? control.invokeScript.trim() : "";
|
|
38044
38141
|
if (!invokeScript) continue;
|
|
38045
38142
|
const controlId = typeof control?.id === "string" ? control.id.trim() : "";
|
|
@@ -38049,6 +38146,20 @@ ${effect.notification.body || ""}`.trim();
|
|
|
38049
38146
|
}
|
|
38050
38147
|
return null;
|
|
38051
38148
|
}
|
|
38149
|
+
async function waitForCliAdapterReady(adapter, options) {
|
|
38150
|
+
const timeoutMs = Math.max(100, options?.timeoutMs ?? 15e3);
|
|
38151
|
+
const pollMs = Math.max(10, options?.pollMs ?? 50);
|
|
38152
|
+
const deadline = Date.now() + timeoutMs;
|
|
38153
|
+
while (Date.now() < deadline) {
|
|
38154
|
+
if (adapter?.isReady?.()) return;
|
|
38155
|
+
const status = adapter?.getStatus?.()?.status;
|
|
38156
|
+
if (status === "stopped") {
|
|
38157
|
+
throw new Error("CLI runtime stopped before it became ready");
|
|
38158
|
+
}
|
|
38159
|
+
await new Promise((resolve11) => setTimeout(resolve11, pollMs));
|
|
38160
|
+
}
|
|
38161
|
+
throw new Error(`CLI runtime did not become ready within ${timeoutMs}ms`);
|
|
38162
|
+
}
|
|
38052
38163
|
var CliProviderInstance = class {
|
|
38053
38164
|
constructor(provider, workingDir, cliArgs = [], instanceId, transportFactory, options) {
|
|
38054
38165
|
this.provider = provider;
|
|
@@ -38327,6 +38438,7 @@ ${effect.notification.body || ""}`.trim();
|
|
|
38327
38438
|
const scriptName = getForcedNewSessionScriptName(this.provider, this.launchMode);
|
|
38328
38439
|
if (!scriptName) return;
|
|
38329
38440
|
LOG2.info("CLI", `[${this.type}] forcing fresh session launch via script: ${scriptName}`);
|
|
38441
|
+
await waitForCliAdapterReady(this.adapter);
|
|
38330
38442
|
const raw = await this.adapter.invokeScript(scriptName, {});
|
|
38331
38443
|
const parsed = parseCliScriptResult(raw);
|
|
38332
38444
|
if (!parsed.success) {
|
|
@@ -38676,6 +38788,7 @@ ${effect.notification.body || ""}`.trim();
|
|
|
38676
38788
|
const previousProviderSessionId = this.providerSessionId;
|
|
38677
38789
|
this.providerSessionId = nextSessionId;
|
|
38678
38790
|
this.historyWriter.promoteHistorySession(this.type, previousHistorySessionId, nextSessionId);
|
|
38791
|
+
this.historyWriter.writeSessionStart(this.type, nextSessionId, this.workingDir, this.instanceId);
|
|
38679
38792
|
this.adapter.updateRuntimeMeta({ providerSessionId: nextSessionId });
|
|
38680
38793
|
this.onProviderSessionResolved?.({
|
|
38681
38794
|
instanceId: this.instanceId,
|
|
@@ -39255,13 +39368,13 @@ ${effect.notification.body || ""}`.trim();
|
|
|
39255
39368
|
}
|
|
39256
39369
|
this.currentStatus = "waiting_approval";
|
|
39257
39370
|
this.detectStatusTransition();
|
|
39258
|
-
const approved = await new Promise((
|
|
39259
|
-
this.permissionResolvers.push(
|
|
39371
|
+
const approved = await new Promise((resolve11) => {
|
|
39372
|
+
this.permissionResolvers.push(resolve11);
|
|
39260
39373
|
setTimeout(() => {
|
|
39261
|
-
const idx = this.permissionResolvers.indexOf(
|
|
39374
|
+
const idx = this.permissionResolvers.indexOf(resolve11);
|
|
39262
39375
|
if (idx >= 0) {
|
|
39263
39376
|
this.permissionResolvers.splice(idx, 1);
|
|
39264
|
-
|
|
39377
|
+
resolve11(false);
|
|
39265
39378
|
}
|
|
39266
39379
|
}, 3e5);
|
|
39267
39380
|
});
|
|
@@ -40565,6 +40678,9 @@ Run 'adhdev doctor' for detailed diagnostics.`
|
|
|
40565
40678
|
warnings.push(`Unknown provider field: ${key}`);
|
|
40566
40679
|
}
|
|
40567
40680
|
}
|
|
40681
|
+
if (provider.disableUpstream !== void 0) {
|
|
40682
|
+
warnings.push("disableUpstream is deprecated in provider definitions; use machine-level provider source policy instead");
|
|
40683
|
+
}
|
|
40568
40684
|
const category = provider.category;
|
|
40569
40685
|
if (category === "cli" || category === "acp") {
|
|
40570
40686
|
const spawn4 = provider.spawn;
|
|
@@ -40622,8 +40738,11 @@ Run 'adhdev doctor' for detailed diagnostics.`
|
|
|
40622
40738
|
var ProviderLoader = class _ProviderLoader {
|
|
40623
40739
|
providers = /* @__PURE__ */ new Map();
|
|
40624
40740
|
providerAvailability = /* @__PURE__ */ new Map();
|
|
40741
|
+
defaultProvidersDir;
|
|
40742
|
+
explicitProviderDir = null;
|
|
40625
40743
|
userDir;
|
|
40626
40744
|
upstreamDir;
|
|
40745
|
+
sourceMode = "normal";
|
|
40627
40746
|
disableUpstream;
|
|
40628
40747
|
watchers = [];
|
|
40629
40748
|
logFn;
|
|
@@ -40637,22 +40756,15 @@ Run 'adhdev doctor' for detailed diagnostics.`
|
|
|
40637
40756
|
static META_FILE = ".meta.json";
|
|
40638
40757
|
constructor(options) {
|
|
40639
40758
|
this.logFn = options?.logFn || LOG2.forComponent("Provider").asLogFn();
|
|
40640
|
-
|
|
40641
|
-
|
|
40642
|
-
|
|
40643
|
-
|
|
40644
|
-
|
|
40645
|
-
|
|
40646
|
-
|
|
40647
|
-
|
|
40648
|
-
|
|
40649
|
-
} else {
|
|
40650
|
-
this.userDir = defaultProvidersDir;
|
|
40651
|
-
this.log(`Using default user providers directory: ${this.userDir}`);
|
|
40652
|
-
}
|
|
40653
|
-
}
|
|
40654
|
-
this.upstreamDir = path14.join(defaultProvidersDir, ".upstream");
|
|
40655
|
-
this.disableUpstream = options?.disableUpstream ?? false;
|
|
40759
|
+
this.defaultProvidersDir = path14.join(os13.homedir(), ".adhdev", "providers");
|
|
40760
|
+
this.userDir = this.defaultProvidersDir;
|
|
40761
|
+
this.upstreamDir = path14.join(this.defaultProvidersDir, ".upstream");
|
|
40762
|
+
this.disableUpstream = false;
|
|
40763
|
+
this.applySourceConfig({
|
|
40764
|
+
userDir: options?.userDir,
|
|
40765
|
+
sourceMode: options?.sourceMode,
|
|
40766
|
+
disableUpstream: options?.disableUpstream
|
|
40767
|
+
});
|
|
40656
40768
|
}
|
|
40657
40769
|
log(msg) {
|
|
40658
40770
|
this.logFn(`[ProviderLoader] ${msg}`);
|
|
@@ -40677,6 +40789,33 @@ Run 'adhdev doctor' for detailed diagnostics.`
|
|
|
40677
40789
|
getProviderRoots() {
|
|
40678
40790
|
return [this.userDir, this.upstreamDir];
|
|
40679
40791
|
}
|
|
40792
|
+
getSourceConfig() {
|
|
40793
|
+
return {
|
|
40794
|
+
sourceMode: this.sourceMode,
|
|
40795
|
+
disableUpstream: this.disableUpstream,
|
|
40796
|
+
explicitProviderDir: this.explicitProviderDir,
|
|
40797
|
+
userDir: this.userDir,
|
|
40798
|
+
upstreamDir: this.upstreamDir,
|
|
40799
|
+
providerRoots: this.getProviderRoots()
|
|
40800
|
+
};
|
|
40801
|
+
}
|
|
40802
|
+
applySourceConfig(options) {
|
|
40803
|
+
const nextSourceMode = options?.sourceMode === "no-upstream" ? "no-upstream" : options?.sourceMode === "normal" ? "normal" : options?.disableUpstream ? "no-upstream" : this.sourceMode || "normal";
|
|
40804
|
+
if (options && Object.prototype.hasOwnProperty.call(options, "userDir")) {
|
|
40805
|
+
this.explicitProviderDir = options.userDir?.trim() ? options.userDir : null;
|
|
40806
|
+
}
|
|
40807
|
+
this.sourceMode = nextSourceMode;
|
|
40808
|
+
this.userDir = this.explicitProviderDir || this.defaultProvidersDir;
|
|
40809
|
+
this.upstreamDir = path14.join(this.defaultProvidersDir, ".upstream");
|
|
40810
|
+
this.disableUpstream = this.sourceMode === "no-upstream";
|
|
40811
|
+
if (this.explicitProviderDir) {
|
|
40812
|
+
this.log(`Config 'providerDir' applied: ${this.userDir}`);
|
|
40813
|
+
} else {
|
|
40814
|
+
this.log(`Using default user providers directory: ${this.userDir}`);
|
|
40815
|
+
}
|
|
40816
|
+
this.log(`Provider source config: mode=${this.sourceMode} explicitProviderDir=${this.explicitProviderDir || "-"} userDir=${this.userDir} upstreamDir=${this.upstreamDir}`);
|
|
40817
|
+
return this.getSourceConfig();
|
|
40818
|
+
}
|
|
40680
40819
|
/**
|
|
40681
40820
|
* Canonical provider directory shape for a given root.
|
|
40682
40821
|
*/
|
|
@@ -40727,7 +40866,7 @@ Run 'adhdev doctor' for detailed diagnostics.`
|
|
|
40727
40866
|
this.log(`Loaded ${upstreamCount} upstream providers (auto-updated)`);
|
|
40728
40867
|
}
|
|
40729
40868
|
} else if (this.disableUpstream) {
|
|
40730
|
-
this.log("Upstream loading disabled (
|
|
40869
|
+
this.log("Upstream loading disabled (sourceMode=no-upstream)");
|
|
40731
40870
|
}
|
|
40732
40871
|
if (fs6.existsSync(this.userDir)) {
|
|
40733
40872
|
const userCount = this.loadDir(this.userDir, [".upstream"]);
|
|
@@ -41238,7 +41377,7 @@ Run 'adhdev doctor' for detailed diagnostics.`
|
|
|
41238
41377
|
*/
|
|
41239
41378
|
async fetchLatest() {
|
|
41240
41379
|
if (this.disableUpstream) {
|
|
41241
|
-
this.log("Upstream fetch skipped (
|
|
41380
|
+
this.log("Upstream fetch skipped (sourceMode=no-upstream)");
|
|
41242
41381
|
return { updated: false };
|
|
41243
41382
|
}
|
|
41244
41383
|
const https = require("https");
|
|
@@ -41260,7 +41399,7 @@ Run 'adhdev doctor' for detailed diagnostics.`
|
|
|
41260
41399
|
return { updated: false };
|
|
41261
41400
|
}
|
|
41262
41401
|
try {
|
|
41263
|
-
const etag = await new Promise((
|
|
41402
|
+
const etag = await new Promise((resolve11, reject) => {
|
|
41264
41403
|
const options = {
|
|
41265
41404
|
method: "HEAD",
|
|
41266
41405
|
hostname: "github.com",
|
|
@@ -41278,7 +41417,7 @@ Run 'adhdev doctor' for detailed diagnostics.`
|
|
|
41278
41417
|
headers: { "User-Agent": "adhdev-launcher" },
|
|
41279
41418
|
timeout: 1e4
|
|
41280
41419
|
}, (res2) => {
|
|
41281
|
-
|
|
41420
|
+
resolve11(res2.headers.etag || res2.headers["last-modified"] || "");
|
|
41282
41421
|
});
|
|
41283
41422
|
req2.on("error", reject);
|
|
41284
41423
|
req2.on("timeout", () => {
|
|
@@ -41287,7 +41426,7 @@ Run 'adhdev doctor' for detailed diagnostics.`
|
|
|
41287
41426
|
});
|
|
41288
41427
|
req2.end();
|
|
41289
41428
|
} else {
|
|
41290
|
-
|
|
41429
|
+
resolve11(res.headers.etag || res.headers["last-modified"] || "");
|
|
41291
41430
|
}
|
|
41292
41431
|
});
|
|
41293
41432
|
req.on("error", reject);
|
|
@@ -41351,7 +41490,7 @@ Run 'adhdev doctor' for detailed diagnostics.`
|
|
|
41351
41490
|
downloadFile(url2, destPath) {
|
|
41352
41491
|
const https = require("https");
|
|
41353
41492
|
const http3 = require("http");
|
|
41354
|
-
return new Promise((
|
|
41493
|
+
return new Promise((resolve11, reject) => {
|
|
41355
41494
|
const doRequest = (reqUrl, redirectCount = 0) => {
|
|
41356
41495
|
if (redirectCount > 5) {
|
|
41357
41496
|
reject(new Error("Too many redirects"));
|
|
@@ -41371,7 +41510,7 @@ Run 'adhdev doctor' for detailed diagnostics.`
|
|
|
41371
41510
|
res.pipe(ws2);
|
|
41372
41511
|
ws2.on("finish", () => {
|
|
41373
41512
|
ws2.close();
|
|
41374
|
-
|
|
41513
|
+
resolve11();
|
|
41375
41514
|
});
|
|
41376
41515
|
ws2.on("error", reject);
|
|
41377
41516
|
});
|
|
@@ -41844,17 +41983,17 @@ Run 'adhdev doctor' for detailed diagnostics.`
|
|
|
41844
41983
|
throw new Error("No free port found");
|
|
41845
41984
|
}
|
|
41846
41985
|
function checkPortFree(port) {
|
|
41847
|
-
return new Promise((
|
|
41986
|
+
return new Promise((resolve11) => {
|
|
41848
41987
|
const server = net3.createServer();
|
|
41849
41988
|
server.unref();
|
|
41850
|
-
server.on("error", () =>
|
|
41989
|
+
server.on("error", () => resolve11(false));
|
|
41851
41990
|
server.listen(port, "127.0.0.1", () => {
|
|
41852
|
-
server.close(() =>
|
|
41991
|
+
server.close(() => resolve11(true));
|
|
41853
41992
|
});
|
|
41854
41993
|
});
|
|
41855
41994
|
}
|
|
41856
41995
|
async function isCdpActive(port) {
|
|
41857
|
-
return new Promise((
|
|
41996
|
+
return new Promise((resolve11) => {
|
|
41858
41997
|
const req = require("http").get(`http://127.0.0.1:${port}/json/version`, {
|
|
41859
41998
|
timeout: 2e3
|
|
41860
41999
|
}, (res) => {
|
|
@@ -41863,16 +42002,16 @@ Run 'adhdev doctor' for detailed diagnostics.`
|
|
|
41863
42002
|
res.on("end", () => {
|
|
41864
42003
|
try {
|
|
41865
42004
|
const info = JSON.parse(data);
|
|
41866
|
-
|
|
42005
|
+
resolve11(!!info["WebKit-Version"] || !!info["Browser"]);
|
|
41867
42006
|
} catch {
|
|
41868
|
-
|
|
42007
|
+
resolve11(false);
|
|
41869
42008
|
}
|
|
41870
42009
|
});
|
|
41871
42010
|
});
|
|
41872
|
-
req.on("error", () =>
|
|
42011
|
+
req.on("error", () => resolve11(false));
|
|
41873
42012
|
req.on("timeout", () => {
|
|
41874
42013
|
req.destroy();
|
|
41875
|
-
|
|
42014
|
+
resolve11(false);
|
|
41876
42015
|
});
|
|
41877
42016
|
});
|
|
41878
42017
|
}
|
|
@@ -42591,7 +42730,7 @@ Run 'adhdev doctor' for detailed diagnostics.`
|
|
|
42591
42730
|
while (Date.now() - start < timeoutMs) {
|
|
42592
42731
|
try {
|
|
42593
42732
|
process.kill(pid, 0);
|
|
42594
|
-
await new Promise((
|
|
42733
|
+
await new Promise((resolve11) => setTimeout(resolve11, 250));
|
|
42595
42734
|
} catch {
|
|
42596
42735
|
return;
|
|
42597
42736
|
}
|
|
@@ -42706,7 +42845,7 @@ Run 'adhdev doctor' for detailed diagnostics.`
|
|
|
42706
42845
|
appendUpgradeLog(installOutput.trim());
|
|
42707
42846
|
}
|
|
42708
42847
|
if (process.platform === "win32") {
|
|
42709
|
-
await new Promise((
|
|
42848
|
+
await new Promise((resolve11) => setTimeout(resolve11, 500));
|
|
42710
42849
|
cleanupStaleGlobalInstallDirs(payload.packageName);
|
|
42711
42850
|
appendUpgradeLog("Post-install staging cleanup complete");
|
|
42712
42851
|
}
|
|
@@ -42997,8 +43136,9 @@ Run 'adhdev doctor' for detailed diagnostics.`
|
|
|
42997
43136
|
if (!providerType) {
|
|
42998
43137
|
return { success: false, error: "providerType required" };
|
|
42999
43138
|
}
|
|
43000
|
-
const
|
|
43001
|
-
const
|
|
43139
|
+
const wantsAll = args?.all === true;
|
|
43140
|
+
const offset = wantsAll ? 0 : Math.max(0, Number(args?.offset) || 0);
|
|
43141
|
+
const limit = wantsAll ? Number.MAX_SAFE_INTEGER : Math.max(1, Math.min(100, Number(args?.limit) || 30));
|
|
43002
43142
|
const { sessions: historySessions, hasMore } = listSavedHistorySessions(providerType, { offset, limit });
|
|
43003
43143
|
const state = loadState();
|
|
43004
43144
|
const savedSessions = getSavedProviderSessions(state, { providerType, kind });
|
|
@@ -43019,13 +43159,13 @@ Run 'adhdev doctor' for detailed diagnostics.`
|
|
|
43019
43159
|
providerName: saved?.providerName || recent?.providerName || providerType,
|
|
43020
43160
|
kind: saved?.kind || recent?.kind || kind,
|
|
43021
43161
|
title: saved?.title || recent?.title || session.sessionTitle || session.preview || providerType,
|
|
43022
|
-
workspace: saved?.workspace || recent?.workspace,
|
|
43162
|
+
workspace: saved?.workspace || recent?.workspace || session.workspace,
|
|
43023
43163
|
currentModel: saved?.currentModel || recent?.currentModel,
|
|
43024
43164
|
preview: session.preview,
|
|
43025
43165
|
messageCount: session.messageCount,
|
|
43026
43166
|
firstMessageAt: session.firstMessageAt,
|
|
43027
43167
|
lastMessageAt: session.lastMessageAt,
|
|
43028
|
-
canResume: !!(saved?.workspace || recent?.workspace) && canResumeById
|
|
43168
|
+
canResume: !!(saved?.workspace || recent?.workspace || session.workspace) && canResumeById
|
|
43029
43169
|
};
|
|
43030
43170
|
}),
|
|
43031
43171
|
hasMore
|
|
@@ -43634,7 +43774,7 @@ Run 'adhdev doctor' for detailed diagnostics.`
|
|
|
43634
43774
|
const beforeCount = this.messageCount(before);
|
|
43635
43775
|
const beforeSignature = this.lastMessageSignature(before);
|
|
43636
43776
|
for (let attempt = 0; attempt < 12; attempt += 1) {
|
|
43637
|
-
await new Promise((
|
|
43777
|
+
await new Promise((resolve11) => setTimeout(resolve11, 250));
|
|
43638
43778
|
let state;
|
|
43639
43779
|
try {
|
|
43640
43780
|
state = await this.readChat(evaluate);
|
|
@@ -43656,7 +43796,7 @@ Run 'adhdev doctor' for detailed diagnostics.`
|
|
|
43656
43796
|
if (this.messageCount(first) > 0 || this.lastMessageSignature(first)) {
|
|
43657
43797
|
return first;
|
|
43658
43798
|
}
|
|
43659
|
-
await new Promise((
|
|
43799
|
+
await new Promise((resolve11) => setTimeout(resolve11, 150));
|
|
43660
43800
|
const second = await this.readChat(evaluate);
|
|
43661
43801
|
return this.messageCount(second) >= this.messageCount(first) ? second : first;
|
|
43662
43802
|
}
|
|
@@ -43796,7 +43936,7 @@ Run 'adhdev doctor' for detailed diagnostics.`
|
|
|
43796
43936
|
if (typeof data.error === "string" && data.error.trim()) return false;
|
|
43797
43937
|
}
|
|
43798
43938
|
for (let attempt = 0; attempt < 6; attempt += 1) {
|
|
43799
|
-
await new Promise((
|
|
43939
|
+
await new Promise((resolve11) => setTimeout(resolve11, 250));
|
|
43800
43940
|
const state = await this.readChat(evaluate);
|
|
43801
43941
|
const title = this.getStateTitle(state);
|
|
43802
43942
|
if (this.titlesMatch(title, sessionId)) return true;
|
|
@@ -44706,6 +44846,7 @@ Run 'adhdev doctor' for detailed diagnostics.`
|
|
|
44706
44846
|
var http2 = __toESM2(require("http"));
|
|
44707
44847
|
var fs14 = __toESM2(require("fs"));
|
|
44708
44848
|
var path222 = __toESM2(require("path"));
|
|
44849
|
+
init_config();
|
|
44709
44850
|
function generateFiles(type, name, category, opts = {}) {
|
|
44710
44851
|
const { cdpPorts, cli, processName, installPath, binary, extensionId, version: version2 = "0.1" } = opts;
|
|
44711
44852
|
if (category === "cli" || category === "acp") {
|
|
@@ -46234,7 +46375,7 @@ async (params) => {
|
|
|
46234
46375
|
return { target, instance, adapter };
|
|
46235
46376
|
}
|
|
46236
46377
|
function sleep(ms2) {
|
|
46237
|
-
return new Promise((
|
|
46378
|
+
return new Promise((resolve11) => setTimeout(resolve11, ms2));
|
|
46238
46379
|
}
|
|
46239
46380
|
async function waitForCliReady(ctx, type, instanceId, timeoutMs) {
|
|
46240
46381
|
const startedAt = Date.now();
|
|
@@ -47079,18 +47220,6 @@ async (params) => {
|
|
|
47079
47220
|
if (!fs13.existsSync(providerJson)) {
|
|
47080
47221
|
return { dir: null, reason: `provider.json not found in writable provider directory: ${desiredDir}` };
|
|
47081
47222
|
}
|
|
47082
|
-
try {
|
|
47083
|
-
const providerData = JSON.parse(fs13.readFileSync(providerJson, "utf-8"));
|
|
47084
|
-
if (providerData.disableUpstream !== true) {
|
|
47085
|
-
providerData.disableUpstream = true;
|
|
47086
|
-
fs13.writeFileSync(providerJson, JSON.stringify(providerData, null, 2));
|
|
47087
|
-
}
|
|
47088
|
-
} catch (error48) {
|
|
47089
|
-
return {
|
|
47090
|
-
dir: null,
|
|
47091
|
-
reason: `Failed to update provider.json in writable provider directory: ${error48.message}`
|
|
47092
|
-
};
|
|
47093
|
-
}
|
|
47094
47223
|
return { dir: desiredDir };
|
|
47095
47224
|
}
|
|
47096
47225
|
function loadAutoImplReferenceScripts(ctx, referenceType) {
|
|
@@ -48375,6 +48504,7 @@ data: ${JSON.stringify(msg.data)}
|
|
|
48375
48504
|
cdpManagers;
|
|
48376
48505
|
instanceManager;
|
|
48377
48506
|
cliManager;
|
|
48507
|
+
onProviderSourceConfigChanged;
|
|
48378
48508
|
logFn;
|
|
48379
48509
|
sseClients = [];
|
|
48380
48510
|
watchScriptPath = null;
|
|
@@ -48391,6 +48521,7 @@ data: ${JSON.stringify(msg.data)}
|
|
|
48391
48521
|
this.cdpManagers = options.cdpManagers;
|
|
48392
48522
|
this.instanceManager = options.instanceManager || null;
|
|
48393
48523
|
this.cliManager = options.cliManager || null;
|
|
48524
|
+
this.onProviderSourceConfigChanged = options.onProviderSourceConfigChanged || null;
|
|
48394
48525
|
this.logFn = options.logFn || LOG2.forComponent("DevServer").asLogFn();
|
|
48395
48526
|
}
|
|
48396
48527
|
log(msg) {
|
|
@@ -48400,6 +48531,8 @@ data: ${JSON.stringify(msg.data)}
|
|
|
48400
48531
|
routes = [
|
|
48401
48532
|
// Static routes
|
|
48402
48533
|
{ method: "GET", pattern: "/api/providers", handler: (q2, s15) => this.handleListProviders(q2, s15) },
|
|
48534
|
+
{ method: "GET", pattern: "/api/providers/source-config", handler: (q2, s15) => this.handleGetProviderSourceConfig(q2, s15) },
|
|
48535
|
+
{ method: "POST", pattern: "/api/providers/source-config", handler: (q2, s15) => this.handleSetProviderSourceConfig(q2, s15) },
|
|
48403
48536
|
{ method: "GET", pattern: "/api/providers/versions", handler: (q2, s15) => this.handleDetectVersions(q2, s15) },
|
|
48404
48537
|
{ method: "POST", pattern: "/api/providers/reload", handler: (q2, s15) => this.handleReload(q2, s15) },
|
|
48405
48538
|
{ method: "POST", pattern: "/api/cdp/evaluate", handler: (q2, s15) => this.handleCdpEvaluate(q2, s15) },
|
|
@@ -48497,15 +48630,15 @@ data: ${JSON.stringify(msg.data)}
|
|
|
48497
48630
|
this.json(res, 500, { error: e.message });
|
|
48498
48631
|
}
|
|
48499
48632
|
});
|
|
48500
|
-
return new Promise((
|
|
48633
|
+
return new Promise((resolve11, reject) => {
|
|
48501
48634
|
this.server.listen(port, "127.0.0.1", () => {
|
|
48502
48635
|
this.log(`Dev server listening on http://127.0.0.1:${port}`);
|
|
48503
|
-
|
|
48636
|
+
resolve11();
|
|
48504
48637
|
});
|
|
48505
48638
|
this.server.on("error", (e) => {
|
|
48506
48639
|
if (e.code === "EADDRINUSE") {
|
|
48507
48640
|
this.log(`Port ${port} in use, skipping dev server`);
|
|
48508
|
-
|
|
48641
|
+
resolve11();
|
|
48509
48642
|
} else {
|
|
48510
48643
|
reject(e);
|
|
48511
48644
|
}
|
|
@@ -48519,7 +48652,33 @@ data: ${JSON.stringify(msg.data)}
|
|
|
48519
48652
|
// ─── Handlers ───
|
|
48520
48653
|
async handleListProviders(_req, res) {
|
|
48521
48654
|
const providers = this.providerLoader.getAll().map(toProviderListEntry);
|
|
48522
|
-
this.json(res, 200, { providers, count: providers.length });
|
|
48655
|
+
this.json(res, 200, { providers, count: providers.length, sourceConfig: this.providerLoader.getSourceConfig() });
|
|
48656
|
+
}
|
|
48657
|
+
async handleGetProviderSourceConfig(_req, res) {
|
|
48658
|
+
this.json(res, 200, { success: true, sourceConfig: this.providerLoader.getSourceConfig() });
|
|
48659
|
+
}
|
|
48660
|
+
async handleSetProviderSourceConfig(req, res) {
|
|
48661
|
+
const body = await this.readBody(req);
|
|
48662
|
+
const parsed = parseProviderSourceConfigUpdate(body || {});
|
|
48663
|
+
if (!parsed.ok) {
|
|
48664
|
+
this.json(res, 400, { success: false, error: parsed.error });
|
|
48665
|
+
return;
|
|
48666
|
+
}
|
|
48667
|
+
const currentConfig2 = loadConfig2();
|
|
48668
|
+
const nextConfig = {
|
|
48669
|
+
...currentConfig2,
|
|
48670
|
+
...parsed.updates.providerSourceMode ? { providerSourceMode: parsed.updates.providerSourceMode } : {},
|
|
48671
|
+
...Object.prototype.hasOwnProperty.call(parsed.updates, "providerDir") ? { providerDir: parsed.updates.providerDir } : {}
|
|
48672
|
+
};
|
|
48673
|
+
saveConfig(nextConfig);
|
|
48674
|
+
const sourceConfig = this.providerLoader.applySourceConfig({
|
|
48675
|
+
sourceMode: nextConfig.providerSourceMode,
|
|
48676
|
+
userDir: Object.prototype.hasOwnProperty.call(parsed.updates, "providerDir") ? parsed.updates.providerDir : this.providerLoader.getSourceConfig().explicitProviderDir || void 0
|
|
48677
|
+
});
|
|
48678
|
+
this.providerLoader.reload();
|
|
48679
|
+
this.providerLoader.registerToDetector();
|
|
48680
|
+
await this.onProviderSourceConfigChanged?.();
|
|
48681
|
+
this.json(res, 200, { success: true, reloaded: true, sourceConfig });
|
|
48523
48682
|
}
|
|
48524
48683
|
async handleProviderConfig(type, _req, res) {
|
|
48525
48684
|
const provider = this.providerLoader.resolve(type);
|
|
@@ -48561,20 +48720,20 @@ data: ${JSON.stringify(msg.data)}
|
|
|
48561
48720
|
child.stderr?.on("data", (d) => {
|
|
48562
48721
|
stderr += d.toString().slice(0, 2e3);
|
|
48563
48722
|
});
|
|
48564
|
-
await new Promise((
|
|
48723
|
+
await new Promise((resolve11) => {
|
|
48565
48724
|
const timer = setTimeout(() => {
|
|
48566
48725
|
child.kill();
|
|
48567
|
-
|
|
48726
|
+
resolve11();
|
|
48568
48727
|
}, 3e3);
|
|
48569
48728
|
child.on("exit", () => {
|
|
48570
48729
|
clearTimeout(timer);
|
|
48571
|
-
|
|
48730
|
+
resolve11();
|
|
48572
48731
|
});
|
|
48573
48732
|
child.stdout?.once("data", () => {
|
|
48574
48733
|
setTimeout(() => {
|
|
48575
48734
|
child.kill();
|
|
48576
48735
|
clearTimeout(timer);
|
|
48577
|
-
|
|
48736
|
+
resolve11();
|
|
48578
48737
|
}, 500);
|
|
48579
48738
|
});
|
|
48580
48739
|
});
|
|
@@ -49070,14 +49229,14 @@ data: ${JSON.stringify(msg.data)}
|
|
|
49070
49229
|
child.stderr?.on("data", (d) => {
|
|
49071
49230
|
stderr += d.toString();
|
|
49072
49231
|
});
|
|
49073
|
-
await new Promise((
|
|
49232
|
+
await new Promise((resolve11) => {
|
|
49074
49233
|
const timer = setTimeout(() => {
|
|
49075
49234
|
child.kill();
|
|
49076
|
-
|
|
49235
|
+
resolve11();
|
|
49077
49236
|
}, timeout);
|
|
49078
49237
|
child.on("exit", () => {
|
|
49079
49238
|
clearTimeout(timer);
|
|
49080
|
-
|
|
49239
|
+
resolve11();
|
|
49081
49240
|
});
|
|
49082
49241
|
});
|
|
49083
49242
|
const elapsed = Date.now() - start;
|
|
@@ -49222,18 +49381,6 @@ data: ${JSON.stringify(msg.data)}
|
|
|
49222
49381
|
if (!fs14.existsSync(providerJson)) {
|
|
49223
49382
|
return { dir: null, reason: `provider.json not found in writable provider directory: ${desiredDir}` };
|
|
49224
49383
|
}
|
|
49225
|
-
try {
|
|
49226
|
-
const providerData = JSON.parse(fs14.readFileSync(providerJson, "utf-8"));
|
|
49227
|
-
if (providerData.disableUpstream !== true) {
|
|
49228
|
-
providerData.disableUpstream = true;
|
|
49229
|
-
fs14.writeFileSync(providerJson, JSON.stringify(providerData, null, 2));
|
|
49230
|
-
}
|
|
49231
|
-
} catch (error48) {
|
|
49232
|
-
return {
|
|
49233
|
-
dir: null,
|
|
49234
|
-
reason: `Failed to update provider.json in writable provider directory: ${error48.message}`
|
|
49235
|
-
};
|
|
49236
|
-
}
|
|
49237
49384
|
return { dir: desiredDir };
|
|
49238
49385
|
}
|
|
49239
49386
|
async handleAutoImplement(type, req, res) {
|
|
@@ -49759,14 +49906,14 @@ data: ${JSON.stringify(msg.data)}
|
|
|
49759
49906
|
res.end(JSON.stringify(data, null, 2));
|
|
49760
49907
|
}
|
|
49761
49908
|
async readBody(req) {
|
|
49762
|
-
return new Promise((
|
|
49909
|
+
return new Promise((resolve11) => {
|
|
49763
49910
|
let body = "";
|
|
49764
49911
|
req.on("data", (chunk) => body += chunk);
|
|
49765
49912
|
req.on("end", () => {
|
|
49766
49913
|
try {
|
|
49767
|
-
|
|
49914
|
+
resolve11(JSON.parse(body));
|
|
49768
49915
|
} catch {
|
|
49769
|
-
|
|
49916
|
+
resolve11({});
|
|
49770
49917
|
}
|
|
49771
49918
|
});
|
|
49772
49919
|
});
|
|
@@ -50236,7 +50383,7 @@ data: ${JSON.stringify(msg.data)}
|
|
|
50236
50383
|
const deadline = Date.now() + timeoutMs;
|
|
50237
50384
|
while (Date.now() < deadline) {
|
|
50238
50385
|
if (await canConnect(endpoint)) return;
|
|
50239
|
-
await new Promise((
|
|
50386
|
+
await new Promise((resolve11) => setTimeout(resolve11, STARTUP_POLL_MS));
|
|
50240
50387
|
}
|
|
50241
50388
|
throw new Error(`Session host did not become ready within ${timeoutMs}ms`);
|
|
50242
50389
|
}
|
|
@@ -50461,10 +50608,10 @@ data: ${JSON.stringify(msg.data)}
|
|
|
50461
50608
|
const buffer = Buffer.from(await res.arrayBuffer());
|
|
50462
50609
|
const fs15 = await import("fs");
|
|
50463
50610
|
fs15.writeFileSync(vsixPath, buffer);
|
|
50464
|
-
return new Promise((
|
|
50611
|
+
return new Promise((resolve11) => {
|
|
50465
50612
|
const cmd = `"${ide.cliCommand}" --install-extension "${vsixPath}" --force`;
|
|
50466
50613
|
(0, import_child_process10.exec)(cmd, { timeout: 6e4 }, (error48, _stdout, stderr) => {
|
|
50467
|
-
|
|
50614
|
+
resolve11({
|
|
50468
50615
|
extensionId: extension.id,
|
|
50469
50616
|
marketplaceId: extension.marketplaceId,
|
|
50470
50617
|
success: !error48,
|
|
@@ -50477,11 +50624,11 @@ data: ${JSON.stringify(msg.data)}
|
|
|
50477
50624
|
} catch (e) {
|
|
50478
50625
|
}
|
|
50479
50626
|
}
|
|
50480
|
-
return new Promise((
|
|
50627
|
+
return new Promise((resolve11) => {
|
|
50481
50628
|
const cmd = `"${ide.cliCommand}" --install-extension ${extension.marketplaceId} --force`;
|
|
50482
50629
|
(0, import_child_process10.exec)(cmd, { timeout: 6e4 }, (error48, stdout, stderr) => {
|
|
50483
50630
|
if (error48) {
|
|
50484
|
-
|
|
50631
|
+
resolve11({
|
|
50485
50632
|
extensionId: extension.id,
|
|
50486
50633
|
marketplaceId: extension.marketplaceId,
|
|
50487
50634
|
success: false,
|
|
@@ -50489,7 +50636,7 @@ data: ${JSON.stringify(msg.data)}
|
|
|
50489
50636
|
error: stderr || error48.message
|
|
50490
50637
|
});
|
|
50491
50638
|
} else {
|
|
50492
|
-
|
|
50639
|
+
resolve11({
|
|
50493
50640
|
extensionId: extension.id,
|
|
50494
50641
|
marketplaceId: extension.marketplaceId,
|
|
50495
50642
|
success: true,
|
|
@@ -50582,10 +50729,11 @@ data: ${JSON.stringify(msg.data)}
|
|
|
50582
50729
|
async function initDaemonComponents2(config2) {
|
|
50583
50730
|
installGlobalInterceptor();
|
|
50584
50731
|
const appConfig = loadConfig2();
|
|
50585
|
-
const
|
|
50732
|
+
const providerSourceMode = appConfig.providerSourceMode || "normal";
|
|
50733
|
+
const disableUpstream = providerSourceMode === "no-upstream";
|
|
50586
50734
|
const providerLoader = new ProviderLoader({
|
|
50587
50735
|
logFn: config2.providerLogFn,
|
|
50588
|
-
|
|
50736
|
+
sourceMode: providerSourceMode,
|
|
50589
50737
|
userDir: appConfig.providerDir
|
|
50590
50738
|
});
|
|
50591
50739
|
if (!disableUpstream && !providerLoader.hasUpstream()) {
|
|
@@ -50690,6 +50838,10 @@ data: ${JSON.stringify(msg.data)}
|
|
|
50690
50838
|
onProviderSettingChanged: async (providerType) => {
|
|
50691
50839
|
await refreshProviderAvailability(providerType);
|
|
50692
50840
|
config2.onStatusChange?.();
|
|
50841
|
+
},
|
|
50842
|
+
onProviderSourceConfigChanged: async () => {
|
|
50843
|
+
await refreshProviderAvailability();
|
|
50844
|
+
config2.onStatusChange?.();
|
|
50693
50845
|
}
|
|
50694
50846
|
});
|
|
50695
50847
|
agentStreamManager = new DaemonAgentStreamManager(
|
|
@@ -50739,7 +50891,8 @@ data: ${JSON.stringify(msg.data)}
|
|
|
50739
50891
|
cdpInitializer,
|
|
50740
50892
|
cdpManagers,
|
|
50741
50893
|
sessionRegistry,
|
|
50742
|
-
detectedIdes: detectedIdesRef
|
|
50894
|
+
detectedIdes: detectedIdesRef,
|
|
50895
|
+
refreshProviderAvailability
|
|
50743
50896
|
};
|
|
50744
50897
|
}
|
|
50745
50898
|
async function startDaemonDevSupport2(options) {
|
|
@@ -50748,7 +50901,10 @@ data: ${JSON.stringify(msg.data)}
|
|
|
50748
50901
|
cdpManagers: options.components.cdpManagers,
|
|
50749
50902
|
instanceManager: options.components.instanceManager,
|
|
50750
50903
|
cliManager: options.components.cliManager,
|
|
50751
|
-
logFn: options.logFn
|
|
50904
|
+
logFn: options.logFn,
|
|
50905
|
+
onProviderSourceConfigChanged: async () => {
|
|
50906
|
+
await options.components.refreshProviderAvailability();
|
|
50907
|
+
}
|
|
50752
50908
|
});
|
|
50753
50909
|
await devServer.start();
|
|
50754
50910
|
options.components.providerLoader.watch();
|