@codexhost/cli-win32-x64 0.32.0 → 0.32.1
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/README.md +1 -1
- package/app/codexhost-distribution.json +1 -1
- package/app/console-server.mjs +217 -20
- package/app/console-web.js +123 -2
- package/app/desktop-controller.mjs +526 -143
- package/app/host-runtime.mjs +414 -148
- package/app/plugins/antigravity/plugin.mjs +10 -0
- package/app/plugins/claude-code/plugin.mjs +13 -0
- package/app/plugins/codebuddy/plugin.mjs +21 -2
- package/app/plugins/codex-usage/plugin.mjs +10 -0
- package/app/plugins/copilot/plugin.mjs +10 -0
- package/app/plugins/cursor-cli/plugin.mjs +10 -0
- package/app/plugins/deepseek-harness/plugin.mjs +10 -0
- package/app/plugins/devin/plugin.mjs +10 -0
- package/app/plugins/grok/plugin.mjs +10 -0
- package/app/plugins/hermes/plugin.mjs +10 -0
- package/app/plugins/kimi-code/plugin.mjs +10 -0
- package/app/plugins/kiro-cli/plugin.mjs +10 -0
- package/app/plugins/omp/plugin.mjs +10 -0
- package/app/plugins/opencode/plugin.mjs +10 -0
- package/app/plugins/pi/plugin.mjs +10 -0
- package/app/plugins/qoder/plugin.mjs +10 -0
- package/app/plugins/qoder-cn/plugin.mjs +10 -0
- package/app/plugins/qwen-code/plugin.mjs +10 -0
- package/app/plugins/workbuddy/plugin.mjs +21 -2
- package/app/plugins/zcode/plugin.mjs +10 -0
- package/app/renderer-extension.js +124 -4
- package/app/web/assets/{abnfDiagram-XWFEHMT6-CnJyN70L.js → abnfDiagram-XWFEHMT6-7XITZmBH.js} +1 -1
- package/app/web/assets/{architectureDiagram-CSQXQB3N-DH0ITYVE.js → architectureDiagram-CSQXQB3N-C8Usdzd8.js} +1 -1
- package/app/web/assets/{blockDiagram-BEDRHYPZ-WL3ZKoKg.js → blockDiagram-BEDRHYPZ-CyN9yE_Q.js} +1 -1
- package/app/web/assets/{c4Diagram-M2UUVUY5-XwSPKj5H.js → c4Diagram-M2UUVUY5-CjhY1l3g.js} +1 -1
- package/app/web/assets/{chunk-2Q5K7J3B-CKEzexjg.js → chunk-2Q5K7J3B-o24_rh4_.js} +1 -1
- package/app/web/assets/{chunk-3GCGMST5-BdEgLpab.js → chunk-3GCGMST5-D7bw3E1a.js} +1 -1
- package/app/web/assets/{chunk-5VM5RSS4-DyxL5-Ts.js → chunk-5VM5RSS4-D0v4acf7.js} +1 -1
- package/app/web/assets/{chunk-7U7NFRK5-FXLb4tYa.js → chunk-7U7NFRK5-CYJxP4rV.js} +1 -1
- package/app/web/assets/{chunk-CNRTWJTD-DcdC1OYr.js → chunk-CNRTWJTD-DTgCtcCl.js} +1 -1
- package/app/web/assets/{chunk-D5HYT7QG-BOz9vBX9.js → chunk-D5HYT7QG-qRNelehW.js} +1 -1
- package/app/web/assets/{chunk-EBZ3SEQC-Dmc_Z53x.js → chunk-EBZ3SEQC-BgJPPYdu.js} +2 -2
- package/app/web/assets/{chunk-JWPE2WC7-CrFwSwYi.js → chunk-JWPE2WC7-C50ZnSQQ.js} +1 -1
- package/app/web/assets/{chunk-KTR4FSNJ-BY3AzFaI.js → chunk-KTR4FSNJ-Cifh4XHc.js} +1 -1
- package/app/web/assets/{chunk-XXDRQBXY-CHgNy82n.js → chunk-XXDRQBXY-D23WAHPW.js} +1 -1
- package/app/web/assets/{classDiagram-v2-KXABOMEV-ClM3-y5Z.js → classDiagram-v2-KXABOMEV-B3cezFGj.js} +1 -1
- package/app/web/assets/{cose-bilkent-JH36ORCC-I7nd8GgO.js → cose-bilkent-JH36ORCC-VSMi4La2.js} +1 -1
- package/app/web/assets/{cynefin-EF2NZ3EQ-DzsXmyBH.js → cynefin-EF2NZ3EQ-qQnfHq16.js} +1 -1
- package/app/web/assets/{cynefinDiagram-NJNITYFG-DLHq6igy.js → cynefinDiagram-NJNITYFG-BJELApXD.js} +1 -1
- package/app/web/assets/{dagre-KIHZ2IZ3-BK991Mno.js → dagre-KIHZ2IZ3-C8B5ZMVs.js} +1 -1
- package/app/web/assets/{diagram-7YQZDPLS-C4qiWdQU.js → diagram-7YQZDPLS-HIWoNpzV.js} +1 -1
- package/app/web/assets/{diagram-QBROCOUO-C_ZyBohC.js → diagram-QBROCOUO-3_vS1jbp.js} +1 -1
- package/app/web/assets/{diagram-RJJCUUZO-C5Aezm94.js → diagram-RJJCUUZO-C_Kndn_e.js} +1 -1
- package/app/web/assets/{diagram-WERXNKYE-Ckc_umlF.js → diagram-WERXNKYE-BLWdOwya.js} +1 -1
- package/app/web/assets/{diagram-YHHI257C-BHjReoZZ.js → diagram-YHHI257C-DJeOs6eS.js} +1 -1
- package/app/web/assets/{diagram-YR4HJLHV-DVTGi_y9.js → diagram-YR4HJLHV-BKNULu-g.js} +1 -1
- package/app/web/assets/{ebnfDiagram-N527522P-getuz1AR.js → ebnfDiagram-N527522P-Bu8aReoF.js} +1 -1
- package/app/web/assets/{elk-O5DQBFGD-C7mhTIuK.js → elk-O5DQBFGD-CIp7Z0ER.js} +1 -1
- package/app/web/assets/{erDiagram-K3K3BIDK-sV-HZvUV.js → erDiagram-K3K3BIDK-BTsor1Lp.js} +1 -1
- package/app/web/assets/{flowDiagram-Z6JWZHQI-D0L4wXUs.js → flowDiagram-Z6JWZHQI-p_h5PKQr.js} +1 -1
- package/app/web/assets/{ganttDiagram-3PRQTZWP-BNt9Bjjo.js → ganttDiagram-3PRQTZWP-DKjfPPJ1.js} +1 -1
- package/app/web/assets/{gitGraphDiagram-VXDFKS5L-BABZzhHw.js → gitGraphDiagram-VXDFKS5L-RnPOf2fj.js} +1 -1
- package/app/web/assets/{grid-E2QIVN74-DLe2FQ_d.js → grid-E2QIVN74-C96GnBO1.js} +1 -1
- package/app/web/assets/{index-BLmkBEoq.js → index-CDRWzs-u.js} +67 -67
- package/app/web/assets/{infoDiagram-EZ3ZOAHP-BKDuUqcr.js → infoDiagram-EZ3ZOAHP-B68eZHsb.js} +1 -1
- package/app/web/assets/{ishikawaDiagram-S3EKX5GW-C75EGghg.js → ishikawaDiagram-S3EKX5GW-BLj7PFLt.js} +1 -1
- package/app/web/assets/{journeyDiagram-POQNLL5X-q7Obruqa.js → journeyDiagram-POQNLL5X-Bo-_In0d.js} +1 -1
- package/app/web/assets/{kanban-definition-BH5XI6FM-CzAqhFED.js → kanban-definition-BH5XI6FM-BpHvxprW.js} +1 -1
- package/app/web/assets/{mermaid.core-Bysx44LR.js → mermaid.core-COb9i2Gl.js} +4 -4
- package/app/web/assets/{mindmap-definition-WVAN44T4-Ds5rXTrF.js → mindmap-definition-WVAN44T4-DG15AlXd.js} +1 -1
- package/app/web/assets/{pegDiagram-D4NLKWP3-hmdERwtT.js → pegDiagram-D4NLKWP3-GMBk8RM6.js} +1 -1
- package/app/web/assets/{pieDiagram-36ENHN4W-DfTnyG8D.js → pieDiagram-36ENHN4W-BzeJgVnn.js} +1 -1
- package/app/web/assets/{quadrantDiagram-ZQUDMS73-CreQWjZQ.js → quadrantDiagram-ZQUDMS73-C--Kif6a.js} +1 -1
- package/app/web/assets/{railroadDiagram-JIZHGYPL-Bhc_eO9G.js → railroadDiagram-JIZHGYPL-NPLVu_R7.js} +1 -1
- package/app/web/assets/{render-VIF2ZAQL-BS1Zgk8K.js → render-VIF2ZAQL-DdpQ8E0J.js} +2 -2
- package/app/web/assets/{requirementDiagram-AXW2TVFA-Dlp7d6QT.js → requirementDiagram-AXW2TVFA-WWRwRbkA.js} +1 -1
- package/app/web/assets/{sankeyDiagram-FBCJTAIF-DGBchL30.js → sankeyDiagram-FBCJTAIF-hBr6pZ0V.js} +1 -1
- package/app/web/assets/{sequenceDiagram-3LA2ROMG-DauFg5_R.js → sequenceDiagram-3LA2ROMG-DvzZWy5J.js} +1 -1
- package/app/web/assets/{sizeCapture-2Q2CQKSF-DR-zy7an.js → sizeCapture-2Q2CQKSF-C2B86W70.js} +1 -1
- package/app/web/assets/{stateDiagram-v2-ATKHQDJO-BSRBSGUi.js → stateDiagram-v2-ATKHQDJO-Jwj3XqMx.js} +1 -1
- package/app/web/assets/{swimlanes-YQL5WMAO-BwzOr5Dv.js → swimlanes-YQL5WMAO-DxI0hC09.js} +1 -1
- package/app/web/assets/swimlanesDiagram-UCCPES4V-CR0nv8kJ.js +8 -0
- package/app/web/assets/{timeline-definition-7Z437IG3-BoZ-mNKc.js → timeline-definition-7Z437IG3-m8Ew8iuN.js} +1 -1
- package/app/web/assets/{usecaseDiagram-RDK6N6HP-DikhgH2m.js → usecaseDiagram-RDK6N6HP-BsiPSzIT.js} +1 -1
- package/app/web/assets/{vennDiagram-SHRQU5PJ-DY_oIxwl.js → vennDiagram-SHRQU5PJ-yYfXhiGp.js} +1 -1
- package/app/web/assets/{wardleyDiagram-F3OXNVQS-DrRIiB_M.js → wardleyDiagram-F3OXNVQS-DHLEfnsg.js} +1 -1
- package/app/web/assets/{xychartDiagram-GDYJKCDI-CzSPgHV7.js → xychartDiagram-GDYJKCDI-Drn_UxYt.js} +1 -1
- package/app/web/codexhost-settings.js +54 -54
- package/app/web/index.html +1 -1
- package/app/web/plugins/deepseek-ai__dsh-api-remotes/client.js +1 -1
- package/app/web/plugins/deepseek-ai__dsh-api-session-controller/client.js +8 -8
- package/app/web/plugins/deepseek-ai__dsh-client-ui-attachment/client.js +1 -1
- package/app/web/plugins/deepseek-ai__dsh-client-ui-chat/client.js +13 -13
- package/app/web/plugins/deepseek-ai__dsh-client-ui-codexhost/client.js +66 -66
- package/app/web/plugins/deepseek-ai__dsh-client-ui-conversation/client.js +16 -16
- package/app/web/plugins/deepseek-ai__dsh-client-ui-tool/client.js +18 -18
- package/app/web/plugins/deepseek-ai__dsh-client-ui-workspace/client.js +8 -8
- package/app/web-modules/server.mjs +44 -7
- package/bin/codexhost.exe +0 -0
- package/libexec/codexhost-node-repl.exe +0 -0
- package/libexec/codexhost-screenshot.exe +0 -0
- package/libexec/codexhost-shell.exe +0 -0
- package/libexec/codexhost-shim.exe +0 -0
- package/libexec/codexhost-updater.exe +0 -0
- package/package.json +1 -1
- package/app/web/assets/swimlanesDiagram-UCCPES4V-CNV63-us.js +0 -8
|
@@ -99,14 +99,14 @@ var require_polyfills = __commonJS({
|
|
|
99
99
|
fs2.fstatSync = statFixSync(fs2.fstatSync);
|
|
100
100
|
fs2.lstatSync = statFixSync(fs2.lstatSync);
|
|
101
101
|
if (fs2.chmod && !fs2.lchmod) {
|
|
102
|
-
fs2.lchmod = function(
|
|
102
|
+
fs2.lchmod = function(path7, mode, cb) {
|
|
103
103
|
if (cb) process.nextTick(cb);
|
|
104
104
|
};
|
|
105
105
|
fs2.lchmodSync = function() {
|
|
106
106
|
};
|
|
107
107
|
}
|
|
108
108
|
if (fs2.chown && !fs2.lchown) {
|
|
109
|
-
fs2.lchown = function(
|
|
109
|
+
fs2.lchown = function(path7, uid, gid, cb) {
|
|
110
110
|
if (cb) process.nextTick(cb);
|
|
111
111
|
};
|
|
112
112
|
fs2.lchownSync = function() {
|
|
@@ -114,7 +114,7 @@ var require_polyfills = __commonJS({
|
|
|
114
114
|
}
|
|
115
115
|
if (platform === "win32") {
|
|
116
116
|
fs2.rename = typeof fs2.rename !== "function" ? fs2.rename : (function(fs$rename) {
|
|
117
|
-
function
|
|
117
|
+
function rename4(from, to2, cb) {
|
|
118
118
|
var start = Date.now();
|
|
119
119
|
var backoff = 0;
|
|
120
120
|
fs$rename(from, to2, function CB(er2) {
|
|
@@ -134,8 +134,8 @@ var require_polyfills = __commonJS({
|
|
|
134
134
|
if (cb) cb(er2);
|
|
135
135
|
});
|
|
136
136
|
}
|
|
137
|
-
if (Object.setPrototypeOf) Object.setPrototypeOf(
|
|
138
|
-
return
|
|
137
|
+
if (Object.setPrototypeOf) Object.setPrototypeOf(rename4, fs$rename);
|
|
138
|
+
return rename4;
|
|
139
139
|
})(fs2.rename);
|
|
140
140
|
}
|
|
141
141
|
fs2.read = typeof fs2.read !== "function" ? fs2.read : (function(fs$read) {
|
|
@@ -173,9 +173,9 @@ var require_polyfills = __commonJS({
|
|
|
173
173
|
};
|
|
174
174
|
})(fs2.readSync);
|
|
175
175
|
function patchLchmod(fs3) {
|
|
176
|
-
fs3.lchmod = function(
|
|
176
|
+
fs3.lchmod = function(path7, mode, callback) {
|
|
177
177
|
fs3.open(
|
|
178
|
-
|
|
178
|
+
path7,
|
|
179
179
|
constants2.O_WRONLY | constants2.O_SYMLINK,
|
|
180
180
|
mode,
|
|
181
181
|
function(err, fd2) {
|
|
@@ -191,8 +191,8 @@ var require_polyfills = __commonJS({
|
|
|
191
191
|
}
|
|
192
192
|
);
|
|
193
193
|
};
|
|
194
|
-
fs3.lchmodSync = function(
|
|
195
|
-
var fd2 = fs3.openSync(
|
|
194
|
+
fs3.lchmodSync = function(path7, mode) {
|
|
195
|
+
var fd2 = fs3.openSync(path7, constants2.O_WRONLY | constants2.O_SYMLINK, mode);
|
|
196
196
|
var threw = true;
|
|
197
197
|
var ret;
|
|
198
198
|
try {
|
|
@@ -213,8 +213,8 @@ var require_polyfills = __commonJS({
|
|
|
213
213
|
}
|
|
214
214
|
function patchLutimes(fs3) {
|
|
215
215
|
if (constants2.hasOwnProperty("O_SYMLINK") && fs3.futimes) {
|
|
216
|
-
fs3.lutimes = function(
|
|
217
|
-
fs3.open(
|
|
216
|
+
fs3.lutimes = function(path7, at2, mt2, cb) {
|
|
217
|
+
fs3.open(path7, constants2.O_SYMLINK, function(er2, fd2) {
|
|
218
218
|
if (er2) {
|
|
219
219
|
if (cb) cb(er2);
|
|
220
220
|
return;
|
|
@@ -226,8 +226,8 @@ var require_polyfills = __commonJS({
|
|
|
226
226
|
});
|
|
227
227
|
});
|
|
228
228
|
};
|
|
229
|
-
fs3.lutimesSync = function(
|
|
230
|
-
var fd2 = fs3.openSync(
|
|
229
|
+
fs3.lutimesSync = function(path7, at2, mt2) {
|
|
230
|
+
var fd2 = fs3.openSync(path7, constants2.O_SYMLINK);
|
|
231
231
|
var ret;
|
|
232
232
|
var threw = true;
|
|
233
233
|
try {
|
|
@@ -345,11 +345,11 @@ var require_legacy_streams = __commonJS({
|
|
|
345
345
|
ReadStream,
|
|
346
346
|
WriteStream
|
|
347
347
|
};
|
|
348
|
-
function ReadStream(
|
|
349
|
-
if (!(this instanceof ReadStream)) return new ReadStream(
|
|
348
|
+
function ReadStream(path7, options) {
|
|
349
|
+
if (!(this instanceof ReadStream)) return new ReadStream(path7, options);
|
|
350
350
|
Stream.call(this);
|
|
351
351
|
var self2 = this;
|
|
352
|
-
this.path =
|
|
352
|
+
this.path = path7;
|
|
353
353
|
this.fd = null;
|
|
354
354
|
this.readable = true;
|
|
355
355
|
this.paused = false;
|
|
@@ -394,10 +394,10 @@ var require_legacy_streams = __commonJS({
|
|
|
394
394
|
self2._read();
|
|
395
395
|
});
|
|
396
396
|
}
|
|
397
|
-
function WriteStream(
|
|
398
|
-
if (!(this instanceof WriteStream)) return new WriteStream(
|
|
397
|
+
function WriteStream(path7, options) {
|
|
398
|
+
if (!(this instanceof WriteStream)) return new WriteStream(path7, options);
|
|
399
399
|
Stream.call(this);
|
|
400
|
-
this.path =
|
|
400
|
+
this.path = path7;
|
|
401
401
|
this.fd = null;
|
|
402
402
|
this.writable = true;
|
|
403
403
|
this.flags = "w";
|
|
@@ -539,15 +539,15 @@ var require_graceful_fs = __commonJS({
|
|
|
539
539
|
fs3.createReadStream = createReadStream;
|
|
540
540
|
fs3.createWriteStream = createWriteStream;
|
|
541
541
|
var fs$readFile = fs3.readFile;
|
|
542
|
-
fs3.readFile =
|
|
543
|
-
function
|
|
542
|
+
fs3.readFile = readFile3;
|
|
543
|
+
function readFile3(path7, options, cb) {
|
|
544
544
|
if (typeof options === "function")
|
|
545
545
|
cb = options, options = null;
|
|
546
|
-
return go$readFile(
|
|
547
|
-
function go$readFile(
|
|
548
|
-
return fs$readFile(
|
|
546
|
+
return go$readFile(path7, options, cb);
|
|
547
|
+
function go$readFile(path8, options2, cb2, startTime) {
|
|
548
|
+
return fs$readFile(path8, options2, function(err) {
|
|
549
549
|
if (err && (err.code === "EMFILE" || err.code === "ENFILE"))
|
|
550
|
-
enqueue([go$readFile, [
|
|
550
|
+
enqueue([go$readFile, [path8, options2, cb2], err, startTime || Date.now(), Date.now()]);
|
|
551
551
|
else {
|
|
552
552
|
if (typeof cb2 === "function")
|
|
553
553
|
cb2.apply(this, arguments);
|
|
@@ -556,15 +556,15 @@ var require_graceful_fs = __commonJS({
|
|
|
556
556
|
}
|
|
557
557
|
}
|
|
558
558
|
var fs$writeFile = fs3.writeFile;
|
|
559
|
-
fs3.writeFile =
|
|
560
|
-
function
|
|
559
|
+
fs3.writeFile = writeFile6;
|
|
560
|
+
function writeFile6(path7, data, options, cb) {
|
|
561
561
|
if (typeof options === "function")
|
|
562
562
|
cb = options, options = null;
|
|
563
|
-
return go$writeFile(
|
|
564
|
-
function go$writeFile(
|
|
565
|
-
return fs$writeFile(
|
|
563
|
+
return go$writeFile(path7, data, options, cb);
|
|
564
|
+
function go$writeFile(path8, data2, options2, cb2, startTime) {
|
|
565
|
+
return fs$writeFile(path8, data2, options2, function(err) {
|
|
566
566
|
if (err && (err.code === "EMFILE" || err.code === "ENFILE"))
|
|
567
|
-
enqueue([go$writeFile, [
|
|
567
|
+
enqueue([go$writeFile, [path8, data2, options2, cb2], err, startTime || Date.now(), Date.now()]);
|
|
568
568
|
else {
|
|
569
569
|
if (typeof cb2 === "function")
|
|
570
570
|
cb2.apply(this, arguments);
|
|
@@ -575,14 +575,14 @@ var require_graceful_fs = __commonJS({
|
|
|
575
575
|
var fs$appendFile = fs3.appendFile;
|
|
576
576
|
if (fs$appendFile)
|
|
577
577
|
fs3.appendFile = appendFile;
|
|
578
|
-
function appendFile(
|
|
578
|
+
function appendFile(path7, data, options, cb) {
|
|
579
579
|
if (typeof options === "function")
|
|
580
580
|
cb = options, options = null;
|
|
581
|
-
return go$appendFile(
|
|
582
|
-
function go$appendFile(
|
|
583
|
-
return fs$appendFile(
|
|
581
|
+
return go$appendFile(path7, data, options, cb);
|
|
582
|
+
function go$appendFile(path8, data2, options2, cb2, startTime) {
|
|
583
|
+
return fs$appendFile(path8, data2, options2, function(err) {
|
|
584
584
|
if (err && (err.code === "EMFILE" || err.code === "ENFILE"))
|
|
585
|
-
enqueue([go$appendFile, [
|
|
585
|
+
enqueue([go$appendFile, [path8, data2, options2, cb2], err, startTime || Date.now(), Date.now()]);
|
|
586
586
|
else {
|
|
587
587
|
if (typeof cb2 === "function")
|
|
588
588
|
cb2.apply(this, arguments);
|
|
@@ -613,31 +613,31 @@ var require_graceful_fs = __commonJS({
|
|
|
613
613
|
var fs$readdir = fs3.readdir;
|
|
614
614
|
fs3.readdir = readdir2;
|
|
615
615
|
var noReaddirOptionVersions = /^v[0-5]\./;
|
|
616
|
-
function readdir2(
|
|
616
|
+
function readdir2(path7, options, cb) {
|
|
617
617
|
if (typeof options === "function")
|
|
618
618
|
cb = options, options = null;
|
|
619
|
-
var go$readdir = noReaddirOptionVersions.test(process.version) ? function go$readdir2(
|
|
620
|
-
return fs$readdir(
|
|
621
|
-
|
|
619
|
+
var go$readdir = noReaddirOptionVersions.test(process.version) ? function go$readdir2(path8, options2, cb2, startTime) {
|
|
620
|
+
return fs$readdir(path8, fs$readdirCallback(
|
|
621
|
+
path8,
|
|
622
622
|
options2,
|
|
623
623
|
cb2,
|
|
624
624
|
startTime
|
|
625
625
|
));
|
|
626
|
-
} : function go$readdir2(
|
|
627
|
-
return fs$readdir(
|
|
628
|
-
|
|
626
|
+
} : function go$readdir2(path8, options2, cb2, startTime) {
|
|
627
|
+
return fs$readdir(path8, options2, fs$readdirCallback(
|
|
628
|
+
path8,
|
|
629
629
|
options2,
|
|
630
630
|
cb2,
|
|
631
631
|
startTime
|
|
632
632
|
));
|
|
633
633
|
};
|
|
634
|
-
return go$readdir(
|
|
635
|
-
function fs$readdirCallback(
|
|
634
|
+
return go$readdir(path7, options, cb);
|
|
635
|
+
function fs$readdirCallback(path8, options2, cb2, startTime) {
|
|
636
636
|
return function(err, files) {
|
|
637
637
|
if (err && (err.code === "EMFILE" || err.code === "ENFILE"))
|
|
638
638
|
enqueue([
|
|
639
639
|
go$readdir,
|
|
640
|
-
[
|
|
640
|
+
[path8, options2, cb2],
|
|
641
641
|
err,
|
|
642
642
|
startTime || Date.now(),
|
|
643
643
|
Date.now()
|
|
@@ -708,7 +708,7 @@ var require_graceful_fs = __commonJS({
|
|
|
708
708
|
enumerable: true,
|
|
709
709
|
configurable: true
|
|
710
710
|
});
|
|
711
|
-
function ReadStream(
|
|
711
|
+
function ReadStream(path7, options) {
|
|
712
712
|
if (this instanceof ReadStream)
|
|
713
713
|
return fs$ReadStream.apply(this, arguments), this;
|
|
714
714
|
else
|
|
@@ -728,7 +728,7 @@ var require_graceful_fs = __commonJS({
|
|
|
728
728
|
}
|
|
729
729
|
});
|
|
730
730
|
}
|
|
731
|
-
function WriteStream(
|
|
731
|
+
function WriteStream(path7, options) {
|
|
732
732
|
if (this instanceof WriteStream)
|
|
733
733
|
return fs$WriteStream.apply(this, arguments), this;
|
|
734
734
|
else
|
|
@@ -746,22 +746,22 @@ var require_graceful_fs = __commonJS({
|
|
|
746
746
|
}
|
|
747
747
|
});
|
|
748
748
|
}
|
|
749
|
-
function createReadStream(
|
|
750
|
-
return new fs3.ReadStream(
|
|
749
|
+
function createReadStream(path7, options) {
|
|
750
|
+
return new fs3.ReadStream(path7, options);
|
|
751
751
|
}
|
|
752
|
-
function createWriteStream(
|
|
753
|
-
return new fs3.WriteStream(
|
|
752
|
+
function createWriteStream(path7, options) {
|
|
753
|
+
return new fs3.WriteStream(path7, options);
|
|
754
754
|
}
|
|
755
755
|
var fs$open = fs3.open;
|
|
756
756
|
fs3.open = open3;
|
|
757
|
-
function open3(
|
|
757
|
+
function open3(path7, flags, mode, cb) {
|
|
758
758
|
if (typeof mode === "function")
|
|
759
759
|
cb = mode, mode = null;
|
|
760
|
-
return go$open(
|
|
761
|
-
function go$open(
|
|
762
|
-
return fs$open(
|
|
760
|
+
return go$open(path7, flags, mode, cb);
|
|
761
|
+
function go$open(path8, flags2, mode2, cb2, startTime) {
|
|
762
|
+
return fs$open(path8, flags2, mode2, function(err, fd2) {
|
|
763
763
|
if (err && (err.code === "EMFILE" || err.code === "ENFILE"))
|
|
764
|
-
enqueue([go$open, [
|
|
764
|
+
enqueue([go$open, [path8, flags2, mode2, cb2], err, startTime || Date.now(), Date.now()]);
|
|
765
765
|
else {
|
|
766
766
|
if (typeof cb2 === "function")
|
|
767
767
|
cb2.apply(this, arguments);
|
|
@@ -1252,11 +1252,11 @@ var require_mtime_precision = __commonJS({
|
|
|
1252
1252
|
function probe(file2, fs2, callback) {
|
|
1253
1253
|
const cachedPrecision = fs2[cacheSymbol];
|
|
1254
1254
|
if (cachedPrecision) {
|
|
1255
|
-
return fs2.stat(file2, (err,
|
|
1255
|
+
return fs2.stat(file2, (err, stat2) => {
|
|
1256
1256
|
if (err) {
|
|
1257
1257
|
return callback(err);
|
|
1258
1258
|
}
|
|
1259
|
-
callback(null,
|
|
1259
|
+
callback(null, stat2.mtime, cachedPrecision);
|
|
1260
1260
|
});
|
|
1261
1261
|
}
|
|
1262
1262
|
const mtime = new Date(Math.ceil(Date.now() / 1e3) * 1e3 + 5);
|
|
@@ -1264,13 +1264,13 @@ var require_mtime_precision = __commonJS({
|
|
|
1264
1264
|
if (err) {
|
|
1265
1265
|
return callback(err);
|
|
1266
1266
|
}
|
|
1267
|
-
fs2.stat(file2, (err2,
|
|
1267
|
+
fs2.stat(file2, (err2, stat2) => {
|
|
1268
1268
|
if (err2) {
|
|
1269
1269
|
return callback(err2);
|
|
1270
1270
|
}
|
|
1271
|
-
const precision =
|
|
1271
|
+
const precision = stat2.mtime.getTime() % 1e3 === 0 ? "s" : "ms";
|
|
1272
1272
|
Object.defineProperty(fs2, cacheSymbol, { value: precision });
|
|
1273
|
-
callback(null,
|
|
1273
|
+
callback(null, stat2.mtime, precision);
|
|
1274
1274
|
});
|
|
1275
1275
|
});
|
|
1276
1276
|
}
|
|
@@ -1290,7 +1290,7 @@ var require_mtime_precision = __commonJS({
|
|
|
1290
1290
|
var require_lockfile = __commonJS({
|
|
1291
1291
|
"node_modules/proper-lockfile/lib/lockfile.js"(exports, module) {
|
|
1292
1292
|
"use strict";
|
|
1293
|
-
var
|
|
1293
|
+
var path7 = __require("path");
|
|
1294
1294
|
var fs2 = require_graceful_fs();
|
|
1295
1295
|
var retry = require_retry2();
|
|
1296
1296
|
var onExit = require_signal_exit();
|
|
@@ -1301,7 +1301,7 @@ var require_lockfile = __commonJS({
|
|
|
1301
1301
|
}
|
|
1302
1302
|
function resolveCanonicalPath(file2, options, callback) {
|
|
1303
1303
|
if (!options.realpath) {
|
|
1304
|
-
return callback(null,
|
|
1304
|
+
return callback(null, path7.resolve(file2));
|
|
1305
1305
|
}
|
|
1306
1306
|
options.fs.realpath(file2, callback);
|
|
1307
1307
|
}
|
|
@@ -1324,14 +1324,14 @@ var require_lockfile = __commonJS({
|
|
|
1324
1324
|
if (options.stale <= 0) {
|
|
1325
1325
|
return callback(Object.assign(new Error("Lock file is already being held"), { code: "ELOCKED", file: file2 }));
|
|
1326
1326
|
}
|
|
1327
|
-
options.fs.stat(lockfilePath, (err2,
|
|
1327
|
+
options.fs.stat(lockfilePath, (err2, stat2) => {
|
|
1328
1328
|
if (err2) {
|
|
1329
1329
|
if (err2.code === "ENOENT") {
|
|
1330
1330
|
return acquireLock(file2, { ...options, stale: 0 }, callback);
|
|
1331
1331
|
}
|
|
1332
1332
|
return callback(err2);
|
|
1333
1333
|
}
|
|
1334
|
-
if (!isLockStale(
|
|
1334
|
+
if (!isLockStale(stat2, options)) {
|
|
1335
1335
|
return callback(Object.assign(new Error("Lock file is already being held"), { code: "ELOCKED", file: file2 }));
|
|
1336
1336
|
}
|
|
1337
1337
|
removeLock(file2, options, (err3) => {
|
|
@@ -1343,8 +1343,8 @@ var require_lockfile = __commonJS({
|
|
|
1343
1343
|
});
|
|
1344
1344
|
});
|
|
1345
1345
|
}
|
|
1346
|
-
function isLockStale(
|
|
1347
|
-
return
|
|
1346
|
+
function isLockStale(stat2, options) {
|
|
1347
|
+
return stat2.mtime.getTime() < Date.now() - options.stale;
|
|
1348
1348
|
}
|
|
1349
1349
|
function removeLock(file2, options, callback) {
|
|
1350
1350
|
options.fs.rmdir(getLockFile(file2, options), (err) => {
|
|
@@ -1362,7 +1362,7 @@ var require_lockfile = __commonJS({
|
|
|
1362
1362
|
lock2.updateDelay = lock2.updateDelay || options.update;
|
|
1363
1363
|
lock2.updateTimeout = setTimeout(() => {
|
|
1364
1364
|
lock2.updateTimeout = null;
|
|
1365
|
-
options.fs.stat(lock2.lockfilePath, (err,
|
|
1365
|
+
options.fs.stat(lock2.lockfilePath, (err, stat2) => {
|
|
1366
1366
|
const isOverThreshold = lock2.lastUpdate + options.stale < Date.now();
|
|
1367
1367
|
if (err) {
|
|
1368
1368
|
if (err.code === "ENOENT" || isOverThreshold) {
|
|
@@ -1371,7 +1371,7 @@ var require_lockfile = __commonJS({
|
|
|
1371
1371
|
lock2.updateDelay = 1e3;
|
|
1372
1372
|
return updateLock(file2, options);
|
|
1373
1373
|
}
|
|
1374
|
-
const isMtimeOurs = lock2.mtime.getTime() ===
|
|
1374
|
+
const isMtimeOurs = lock2.mtime.getTime() === stat2.mtime.getTime();
|
|
1375
1375
|
if (!isMtimeOurs) {
|
|
1376
1376
|
return setLockAsCompromised(
|
|
1377
1377
|
file2,
|
|
@@ -1496,11 +1496,11 @@ var require_lockfile = __commonJS({
|
|
|
1496
1496
|
if (err) {
|
|
1497
1497
|
return callback(err);
|
|
1498
1498
|
}
|
|
1499
|
-
options.fs.stat(getLockFile(file3, options), (err2,
|
|
1499
|
+
options.fs.stat(getLockFile(file3, options), (err2, stat2) => {
|
|
1500
1500
|
if (err2) {
|
|
1501
1501
|
return err2.code === "ENOENT" ? callback(null, false) : callback(err2);
|
|
1502
1502
|
}
|
|
1503
|
-
return callback(null, !isLockStale(
|
|
1503
|
+
return callback(null, !isLockStale(stat2, options));
|
|
1504
1504
|
});
|
|
1505
1505
|
});
|
|
1506
1506
|
}
|
|
@@ -11405,8 +11405,8 @@ function controllerLifecycle(key, context, stop2) {
|
|
|
11405
11405
|
}
|
|
11406
11406
|
|
|
11407
11407
|
// packages/desktop-control/src/production-controller.ts
|
|
11408
|
-
import { readFile } from "node:fs/promises";
|
|
11409
|
-
import
|
|
11408
|
+
import { readFile as readFile2 } from "node:fs/promises";
|
|
11409
|
+
import path6 from "node:path";
|
|
11410
11410
|
|
|
11411
11411
|
// packages/desktop-control/src/renderer-local-page.ts
|
|
11412
11412
|
import { randomUUID } from "node:crypto";
|
|
@@ -13190,10 +13190,10 @@ function mergeDefs(...defs) {
|
|
|
13190
13190
|
function cloneDef(schema) {
|
|
13191
13191
|
return mergeDefs(schema._zod.def);
|
|
13192
13192
|
}
|
|
13193
|
-
function getElementAtPath(obj,
|
|
13194
|
-
if (!
|
|
13193
|
+
function getElementAtPath(obj, path7) {
|
|
13194
|
+
if (!path7)
|
|
13195
13195
|
return obj;
|
|
13196
|
-
return
|
|
13196
|
+
return path7.reduce((acc, key) => acc?.[key], obj);
|
|
13197
13197
|
}
|
|
13198
13198
|
function promiseAllObject(promisesObj) {
|
|
13199
13199
|
const keys = Object.keys(promisesObj);
|
|
@@ -13533,11 +13533,11 @@ function explicitlyAborted(x2, startIndex = 0) {
|
|
|
13533
13533
|
}
|
|
13534
13534
|
return false;
|
|
13535
13535
|
}
|
|
13536
|
-
function prefixIssues(
|
|
13536
|
+
function prefixIssues(path7, issues) {
|
|
13537
13537
|
return issues.map((iss) => {
|
|
13538
13538
|
var _a4;
|
|
13539
13539
|
(_a4 = iss).path ?? (_a4.path = []);
|
|
13540
|
-
iss.path.unshift(
|
|
13540
|
+
iss.path.unshift(path7);
|
|
13541
13541
|
return iss;
|
|
13542
13542
|
});
|
|
13543
13543
|
}
|
|
@@ -13999,16 +13999,16 @@ function flattenError(error62, mapper = (issue2) => issue2.message) {
|
|
|
13999
13999
|
}
|
|
14000
14000
|
function formatError(error62, mapper = (issue2) => issue2.message) {
|
|
14001
14001
|
const fieldErrors = { _errors: [] };
|
|
14002
|
-
const processError = (error63,
|
|
14002
|
+
const processError = (error63, path7 = []) => {
|
|
14003
14003
|
for (const issue2 of error63.issues) {
|
|
14004
14004
|
if (issue2.code === "invalid_union" && issue2.errors.length) {
|
|
14005
|
-
issue2.errors.map((issues) => processError({ issues }, [...
|
|
14005
|
+
issue2.errors.map((issues) => processError({ issues }, [...path7, ...issue2.path]));
|
|
14006
14006
|
} else if (issue2.code === "invalid_key") {
|
|
14007
|
-
processError({ issues: issue2.issues }, [...
|
|
14007
|
+
processError({ issues: issue2.issues }, [...path7, ...issue2.path]);
|
|
14008
14008
|
} else if (issue2.code === "invalid_element") {
|
|
14009
|
-
processError({ issues: issue2.issues }, [...
|
|
14009
|
+
processError({ issues: issue2.issues }, [...path7, ...issue2.path]);
|
|
14010
14010
|
} else {
|
|
14011
|
-
const fullpath = [...
|
|
14011
|
+
const fullpath = [...path7, ...issue2.path];
|
|
14012
14012
|
if (fullpath.length === 0) {
|
|
14013
14013
|
fieldErrors._errors.push(mapper(issue2));
|
|
14014
14014
|
} else {
|
|
@@ -14047,17 +14047,17 @@ function formatError(error62, mapper = (issue2) => issue2.message) {
|
|
|
14047
14047
|
}
|
|
14048
14048
|
function treeifyError(error62, mapper = (issue2) => issue2.message) {
|
|
14049
14049
|
const result = { errors: [] };
|
|
14050
|
-
const processError = (error63,
|
|
14050
|
+
const processError = (error63, path7 = []) => {
|
|
14051
14051
|
var _a4;
|
|
14052
14052
|
for (const issue2 of error63.issues) {
|
|
14053
14053
|
if (issue2.code === "invalid_union" && issue2.errors.length) {
|
|
14054
|
-
issue2.errors.map((issues) => processError({ issues }, [...
|
|
14054
|
+
issue2.errors.map((issues) => processError({ issues }, [...path7, ...issue2.path]));
|
|
14055
14055
|
} else if (issue2.code === "invalid_key") {
|
|
14056
|
-
processError({ issues: issue2.issues }, [...
|
|
14056
|
+
processError({ issues: issue2.issues }, [...path7, ...issue2.path]);
|
|
14057
14057
|
} else if (issue2.code === "invalid_element") {
|
|
14058
|
-
processError({ issues: issue2.issues }, [...
|
|
14058
|
+
processError({ issues: issue2.issues }, [...path7, ...issue2.path]);
|
|
14059
14059
|
} else {
|
|
14060
|
-
const fullpath = [...
|
|
14060
|
+
const fullpath = [...path7, ...issue2.path];
|
|
14061
14061
|
if (fullpath.length === 0) {
|
|
14062
14062
|
result.errors.push(mapper(issue2));
|
|
14063
14063
|
continue;
|
|
@@ -14096,8 +14096,8 @@ function treeifyError(error62, mapper = (issue2) => issue2.message) {
|
|
|
14096
14096
|
}
|
|
14097
14097
|
function toDotPath(_path) {
|
|
14098
14098
|
const segs = [];
|
|
14099
|
-
const
|
|
14100
|
-
for (const seg of
|
|
14099
|
+
const path7 = _path.map((seg) => typeof seg === "object" ? seg.key : seg);
|
|
14100
|
+
for (const seg of path7) {
|
|
14101
14101
|
if (typeof seg === "number")
|
|
14102
14102
|
segs.push(`[${seg}]`);
|
|
14103
14103
|
else if (typeof seg === "symbol")
|
|
@@ -31235,13 +31235,13 @@ function resolveRef(ref, ctx) {
|
|
|
31235
31235
|
if (!ref.startsWith("#")) {
|
|
31236
31236
|
throw new Error("External $ref is not supported, only local refs (#/...) are allowed");
|
|
31237
31237
|
}
|
|
31238
|
-
const
|
|
31239
|
-
if (
|
|
31238
|
+
const path7 = ref.slice(1).split("/").filter(Boolean);
|
|
31239
|
+
if (path7.length === 0) {
|
|
31240
31240
|
return ctx.rootSchema;
|
|
31241
31241
|
}
|
|
31242
31242
|
const defsKey = ctx.version === "draft-2020-12" ? "$defs" : "definitions";
|
|
31243
|
-
if (
|
|
31244
|
-
const key =
|
|
31243
|
+
if (path7[0] === defsKey) {
|
|
31244
|
+
const key = path7[1] === void 0 ? void 0 : decodeJSONPointerSegment(path7[1]);
|
|
31245
31245
|
if (!key || !ctx.defs[key]) {
|
|
31246
31246
|
throw new Error(`Reference not found: ${ref}`);
|
|
31247
31247
|
}
|
|
@@ -32926,7 +32926,7 @@ var desktopExtensionSettingFieldSchema = external_exports.discriminatedUnion("ty
|
|
|
32926
32926
|
default: external_exports.string().optional()
|
|
32927
32927
|
})
|
|
32928
32928
|
]).superRefine((field2, ctx) => {
|
|
32929
|
-
const issue2 = (
|
|
32929
|
+
const issue2 = (path7, message) => ctx.addIssue({ code: "custom", path: [path7], message });
|
|
32930
32930
|
if (field2.type === "number" || field2.type === "range") {
|
|
32931
32931
|
const { min = -Infinity, max = Infinity, default: value } = field2;
|
|
32932
32932
|
if (min > max)
|
|
@@ -33065,18 +33065,18 @@ var hostExtensionIdSchema = desktopExtensionIdSchema.refine((id3) => !reservedNa
|
|
|
33065
33065
|
var hostExtensionTargetSchema = external_exports.enum(["desktop", "web"]);
|
|
33066
33066
|
var hostExtensionDigestSchema = desktopExtensionHashSchema;
|
|
33067
33067
|
var hostExtensionActivationIdSchema = external_exports.uuid();
|
|
33068
|
-
var hostExtensionResourcePathSchema = pluginRelativeResourceSchema.refine((resource) => !/[\x00-\x1f\x7f<>"|*]/u.test(resource) && resource.split("/").every((part) => !/[. ]$/u.test(part) && !reservedName.test(part)), "Expected a portable relative resource path").refine((
|
|
33068
|
+
var hostExtensionResourcePathSchema = pluginRelativeResourceSchema.refine((resource) => !/[\x00-\x1f\x7f<>"|*]/u.test(resource) && resource.split("/").every((part) => !/[. ]$/u.test(part) && !reservedName.test(part)), "Expected a portable relative resource path").refine((path7) => path7.split("/").length <= 32, "Extension resources may be at most 32 segments deep");
|
|
33069
33069
|
var legacy = desktopExtensionManifestSchema.shape;
|
|
33070
33070
|
var localized = (max, min = 0) => external_exports.strictObject({
|
|
33071
33071
|
en: external_exports.string().trim().min(min).max(max),
|
|
33072
33072
|
"zh-CN": external_exports.string().trim().min(min).max(max)
|
|
33073
33073
|
});
|
|
33074
|
-
var resourceWithSuffix = (suffix) => hostExtensionResourcePathSchema.refine((
|
|
33074
|
+
var resourceWithSuffix = (suffix) => hostExtensionResourcePathSchema.refine((path7) => path7.endsWith(suffix), `Expected a ${suffix} file`);
|
|
33075
33075
|
var moduleEntry = resourceWithSuffix(".mjs");
|
|
33076
33076
|
var style = resourceWithSuffix(".css").optional();
|
|
33077
|
-
var hostExtensionCanonicalPath = (
|
|
33078
|
-
function hostExtensionStaticAssetMimeType(
|
|
33079
|
-
switch (/\.([^./]+)$/u.exec(
|
|
33077
|
+
var hostExtensionCanonicalPath = (path7) => path7.normalize("NFC").toLowerCase();
|
|
33078
|
+
function hostExtensionStaticAssetMimeType(path7) {
|
|
33079
|
+
switch (/\.([^./]+)$/u.exec(path7)?.[1]?.toLowerCase()) {
|
|
33080
33080
|
case "png":
|
|
33081
33081
|
return "image/png";
|
|
33082
33082
|
case "jpg":
|
|
@@ -33103,8 +33103,8 @@ var hostExtensionManifestV2Schema = external_exports.strictObject({
|
|
|
33103
33103
|
details: localized(16384).optional(),
|
|
33104
33104
|
author: legacy.author,
|
|
33105
33105
|
repository: legacy.repository,
|
|
33106
|
-
icon: legacy.icon.refine((
|
|
33107
|
-
screenshots: legacy.screenshots.refine((paths) => paths === void 0 || paths.every((
|
|
33106
|
+
icon: legacy.icon.refine((path7) => path7 === void 0 || hostExtensionResourcePathSchema.safeParse(path7).success),
|
|
33107
|
+
screenshots: legacy.screenshots.refine((paths) => paths === void 0 || paths.every((path7) => hostExtensionResourcePathSchema.safeParse(path7).success)),
|
|
33108
33108
|
categories: legacy.categories,
|
|
33109
33109
|
settingsSchema: legacy.settingsSchema,
|
|
33110
33110
|
slots: legacy.slots.removeDefault().optional(),
|
|
@@ -33256,7 +33256,7 @@ var active = {
|
|
|
33256
33256
|
digest: hostExtensionDigestSchema
|
|
33257
33257
|
};
|
|
33258
33258
|
var optionalActivation = { ...id, activationId: active.activationId.optional() };
|
|
33259
|
-
var filePath = external_exports.string().min(1).max(4096).refine((
|
|
33259
|
+
var filePath = external_exports.string().min(1).max(4096).refine((path7) => /^(?:\/|[a-z]:[/\\])/iu.test(path7) && !path7.includes("\0") && !path7.split(/[/\\]/u).some((part) => part === "." || part === ".."), "Expected an absolute local path without dot segments");
|
|
33260
33260
|
var gitRef = external_exports.string().min(1).max(256).refine((ref) => ref.split("/").every((part) => part && /^[a-z0-9_.-]+$/iu.test(part) && part !== "." && part !== ".."), "Invalid GitHub ref");
|
|
33261
33261
|
function base643(maxBytes) {
|
|
33262
33262
|
return external_exports.string().max(4 * Math.ceil(maxBytes / 3)).refine((value) => {
|
|
@@ -33332,6 +33332,7 @@ var HOST_EXTENSIONS_RPC = {
|
|
|
33332
33332
|
snapshot: "codexhost/extensions/snapshot",
|
|
33333
33333
|
catalog: "codexhost/extensions/catalog",
|
|
33334
33334
|
catalogIcon: "codexhost/extensions/catalogIcon",
|
|
33335
|
+
catalogScreenshot: "codexhost/extensions/catalogScreenshot",
|
|
33335
33336
|
install: "codexhost/extensions/install",
|
|
33336
33337
|
update: "codexhost/extensions/update",
|
|
33337
33338
|
enable: "codexhost/extensions/enable",
|
|
@@ -33368,6 +33369,11 @@ var hostExtensionsCatalogIconResultSchema = external_exports.strictObject({
|
|
|
33368
33369
|
mimeType: external_exports.enum(["image/png", "image/jpeg", "image/webp"]),
|
|
33369
33370
|
base64: base643(DESKTOP_EXTENSION_ICON_MAX_BYTES)
|
|
33370
33371
|
});
|
|
33372
|
+
var hostExtensionCatalogScreenshotIndexSchema = external_exports.int().min(0).max(DESKTOP_EXTENSION_SCREENSHOT_LIMIT - 1);
|
|
33373
|
+
var hostExtensionsCatalogScreenshotResultSchema = external_exports.strictObject({
|
|
33374
|
+
mimeType: external_exports.enum(["image/png", "image/jpeg", "image/webp"]),
|
|
33375
|
+
base64: base643(DESKTOP_EXTENSION_SCREENSHOT_MAX_BYTES)
|
|
33376
|
+
});
|
|
33371
33377
|
var hostExtensionSettingsSchema = external_exports.strictObject({
|
|
33372
33378
|
settingsRevision: hostExtensionRevisionSchema,
|
|
33373
33379
|
values: jsonObjectSchema
|
|
@@ -33386,6 +33392,10 @@ var hostExtensionsRpcSchemas = {
|
|
|
33386
33392
|
params: external_exports.strictObject({ ...id }),
|
|
33387
33393
|
result: hostExtensionsCatalogIconResultSchema
|
|
33388
33394
|
},
|
|
33395
|
+
[HOST_EXTENSIONS_RPC.catalogScreenshot]: {
|
|
33396
|
+
params: external_exports.strictObject({ ...id, index: hostExtensionCatalogScreenshotIndexSchema }),
|
|
33397
|
+
result: hostExtensionsCatalogScreenshotResultSchema
|
|
33398
|
+
},
|
|
33389
33399
|
[HOST_EXTENSIONS_RPC.install]: {
|
|
33390
33400
|
params: external_exports.strictObject({ source: hostExtensionInstallSourceSchema }),
|
|
33391
33401
|
result: installationResult
|
|
@@ -36111,13 +36121,13 @@ function committedReactAncestors(value) {
|
|
|
36111
36121
|
const current2 = fiber(rootState.current);
|
|
36112
36122
|
if (!current2) return [];
|
|
36113
36123
|
const alternate = fiber(first.alternate);
|
|
36114
|
-
const
|
|
36124
|
+
const path7 = [current2];
|
|
36115
36125
|
seen.clear();
|
|
36116
36126
|
seen.add(current2);
|
|
36117
36127
|
for (let index = previous.length - 2; index >= 0; index -= 1) {
|
|
36118
36128
|
const expected = previous[index];
|
|
36119
36129
|
const expectedAlternate = fiber(expected?.alternate);
|
|
36120
|
-
let child = fiber(
|
|
36130
|
+
let child = fiber(path7.at(-1)?.child);
|
|
36121
36131
|
let matched = false;
|
|
36122
36132
|
while (child && !seen.has(child) && seen.size < MAX_VISITED_FIBERS) {
|
|
36123
36133
|
seen.add(child);
|
|
@@ -36128,10 +36138,10 @@ function committedReactAncestors(value) {
|
|
|
36128
36138
|
child = fiber(child.sibling);
|
|
36129
36139
|
}
|
|
36130
36140
|
if (!matched || !child) break;
|
|
36131
|
-
|
|
36141
|
+
path7.push(child);
|
|
36132
36142
|
}
|
|
36133
|
-
if (
|
|
36134
|
-
return
|
|
36143
|
+
if (path7.length === previous.length && (path7.at(-1) === first || path7.at(-1) === alternate)) {
|
|
36144
|
+
return path7.reverse();
|
|
36135
36145
|
}
|
|
36136
36146
|
const stack = [{ node: current2, parent: null }];
|
|
36137
36147
|
seen.clear();
|
|
@@ -37313,25 +37323,25 @@ function installRendererHostRpcRouting(root, target2, dependencies) {
|
|
|
37313
37323
|
const expression = message[1];
|
|
37314
37324
|
if (!Array.isArray(expression) || expression.length !== 4 || expression[0] !== "pipeline")
|
|
37315
37325
|
return message;
|
|
37316
|
-
const [, importId,
|
|
37317
|
-
if (!Array.isArray(
|
|
37326
|
+
const [, importId, path7, args] = expression;
|
|
37327
|
+
if (!Array.isArray(path7) || path7.length !== 1 || !Array.isArray(args)) return message;
|
|
37318
37328
|
const [input3, options] = args;
|
|
37319
37329
|
if (!isRecord3(input3) || !isRecord3(input3.collaborationMode)) return message;
|
|
37320
37330
|
const settings = input3.collaborationMode.settings;
|
|
37321
37331
|
if (!isRecord3(settings)) return message;
|
|
37322
37332
|
const nativeModel = typeof settings.model === "string" ? settings.model : null;
|
|
37323
37333
|
let model2 = null;
|
|
37324
|
-
if (
|
|
37334
|
+
if (path7[0] === "startConversation") {
|
|
37325
37335
|
const draftId = isRecord3(options) ? options.clientThreadId : null;
|
|
37326
37336
|
model2 = typeof draftId === "string" ? externalDrafts.get(draftId)?.model ?? null : null;
|
|
37327
|
-
} else if (
|
|
37337
|
+
} else if (path7[0] === "prewarmConversation") {
|
|
37328
37338
|
if (input3.ephemeral !== true) publishDraftWorkspace("local", input3.cwd);
|
|
37329
37339
|
const selected = selectedModels.get("local") ?? null;
|
|
37330
37340
|
const carrier = nativeModel?.startsWith("codexhost/") ? nativeModel : selected;
|
|
37331
37341
|
model2 = carrier ? prewarmCarrier(carrier) : null;
|
|
37332
37342
|
}
|
|
37333
37343
|
if (!model2) return message;
|
|
37334
|
-
if (
|
|
37344
|
+
if (path7[0] === "startConversation" && nativeModel?.startsWith("codexhost/"))
|
|
37335
37345
|
model2 = nativeModel;
|
|
37336
37346
|
const config2 = input3.config == null ? { model: model2 } : isRecord3(input3.config) ? { model: model2, ...input3.config } : input3.config;
|
|
37337
37347
|
return [
|
|
@@ -37339,11 +37349,11 @@ function installRendererHostRpcRouting(root, target2, dependencies) {
|
|
|
37339
37349
|
[
|
|
37340
37350
|
"pipeline",
|
|
37341
37351
|
importId,
|
|
37342
|
-
|
|
37352
|
+
path7,
|
|
37343
37353
|
[
|
|
37344
37354
|
{
|
|
37345
37355
|
...input3,
|
|
37346
|
-
...
|
|
37356
|
+
...path7[0] === "startConversation" ? { config: config2 } : {},
|
|
37347
37357
|
collaborationMode: { ...input3.collaborationMode, settings: { ...settings, model: model2 } }
|
|
37348
37358
|
},
|
|
37349
37359
|
...args.slice(1)
|
|
@@ -38615,8 +38625,8 @@ async function installRendererRpcSteeringDirect(client, now = Date.now) {
|
|
|
38615
38625
|
return true;
|
|
38616
38626
|
} catch (error62) {
|
|
38617
38627
|
const attempts = (retry?.attempts ?? 0) + 1;
|
|
38618
|
-
const
|
|
38619
|
-
retries.set(client, { attempts, nextAt: now() +
|
|
38628
|
+
const delay3 = Math.min(RETRY_BASE_MS * 2 ** (attempts - 1), RETRY_MAX_MS);
|
|
38629
|
+
retries.set(client, { attempts, nextAt: now() + delay3 });
|
|
38620
38630
|
console.error(
|
|
38621
38631
|
`codexhost native steering discovery failed (attempt ${attempts}):`,
|
|
38622
38632
|
error62 instanceof Error ? error62.message : String(error62)
|
|
@@ -39047,8 +39057,8 @@ function installRendererCdpControlSession(options) {
|
|
|
39047
39057
|
// packages/desktop-control/src/renderer-desktop-extensions.ts
|
|
39048
39058
|
import { createHash as createHash3, randomUUID as randomUUID2 } from "node:crypto";
|
|
39049
39059
|
import { watch } from "node:fs";
|
|
39050
|
-
import { mkdir as
|
|
39051
|
-
import
|
|
39060
|
+
import { mkdir as mkdir5, rename as rename3, rm as rm4, writeFile as writeFile5 } from "node:fs/promises";
|
|
39061
|
+
import path5 from "node:path";
|
|
39052
39062
|
import { Script as Script2 } from "node:vm";
|
|
39053
39063
|
|
|
39054
39064
|
// packages/harness-plugin-files/dist/host-extension-io.js
|
|
@@ -39056,6 +39066,27 @@ var import_proper_lockfile = __toESM(require_proper_lockfile(), 1);
|
|
|
39056
39066
|
import { constants } from "node:fs";
|
|
39057
39067
|
import { lstat, mkdir as mkdir2, open as open2, realpath, rm as rm2, writeFile as writeFile2 } from "node:fs/promises";
|
|
39058
39068
|
import path2 from "node:path";
|
|
39069
|
+
|
|
39070
|
+
// packages/harness-plugin-files/dist/rename-with-windows-retry.js
|
|
39071
|
+
import { rename as rename2 } from "node:fs/promises";
|
|
39072
|
+
import { setTimeout as delay } from "node:timers/promises";
|
|
39073
|
+
var WINDOWS_RENAME_DELAYS_MS = [10, 30, 70, 150, 300];
|
|
39074
|
+
async function renameWithWindowsRetry(temporary, destination) {
|
|
39075
|
+
for (let attempt = 0; ; attempt++) {
|
|
39076
|
+
try {
|
|
39077
|
+
await rename2(temporary, destination);
|
|
39078
|
+
return;
|
|
39079
|
+
} catch (error62) {
|
|
39080
|
+
const wait = WINDOWS_RENAME_DELAYS_MS[attempt];
|
|
39081
|
+
const code = error62.code;
|
|
39082
|
+
if (process.platform !== "win32" || wait === void 0 || !["EPERM", "EACCES", "EBUSY"].includes(code ?? ""))
|
|
39083
|
+
throw error62;
|
|
39084
|
+
await delay(wait);
|
|
39085
|
+
}
|
|
39086
|
+
}
|
|
39087
|
+
}
|
|
39088
|
+
|
|
39089
|
+
// packages/harness-plugin-files/dist/host-extension-io.js
|
|
39059
39090
|
function desktopExtensionsStatusPath(dataDirectory) {
|
|
39060
39091
|
return path2.join(dataDirectory, "diagnostics", "desktop-extensions-v1.json");
|
|
39061
39092
|
}
|
|
@@ -39146,6 +39177,142 @@ var jpegSignature = Buffer.from([255, 216, 255]);
|
|
|
39146
39177
|
var riffSignature = Buffer.from("RIFF");
|
|
39147
39178
|
var webpSignature = Buffer.from("WEBP");
|
|
39148
39179
|
|
|
39180
|
+
// packages/harness-plugin-files/dist/desktop-extension-download.js
|
|
39181
|
+
import { setTimeout as delay2 } from "node:timers/promises";
|
|
39182
|
+
var githubHeaders = {
|
|
39183
|
+
accept: "application/vnd.github+json",
|
|
39184
|
+
"user-agent": "codexhost-desktop-extensions"
|
|
39185
|
+
};
|
|
39186
|
+
var DEFAULT_TIMEOUT_MS = 12e3;
|
|
39187
|
+
var DEFAULT_RETRY_BASE_DELAY_MS = 400;
|
|
39188
|
+
var RETRYABLE_HTTP_STATUSES = /* @__PURE__ */ new Set([408, 429, 500, 502, 503, 504]);
|
|
39189
|
+
var ExtensionDownloadError = class extends Error {
|
|
39190
|
+
};
|
|
39191
|
+
var ExtensionHttpError = class extends ExtensionDownloadError {
|
|
39192
|
+
status;
|
|
39193
|
+
constructor(status) {
|
|
39194
|
+
super(`Download returned HTTP ${status}`);
|
|
39195
|
+
this.status = status;
|
|
39196
|
+
}
|
|
39197
|
+
};
|
|
39198
|
+
function isRetryableDownloadError(error62) {
|
|
39199
|
+
if (error62 instanceof ExtensionHttpError)
|
|
39200
|
+
return RETRYABLE_HTTP_STATUSES.has(error62.status);
|
|
39201
|
+
return !(error62 instanceof ExtensionDownloadError);
|
|
39202
|
+
}
|
|
39203
|
+
async function downloadExtensionBytes(url2, limit, headers, { signal: callerSignal, allowUrl, allowContentType, timeoutMs = DEFAULT_TIMEOUT_MS, idleTimeoutMs, retries: retries2 = 0, retryBaseDelayMs = DEFAULT_RETRY_BASE_DELAY_MS }) {
|
|
39204
|
+
const parsed = desktopExtensionHttpUrlSchema.safeParse(url2);
|
|
39205
|
+
if (!parsed.success)
|
|
39206
|
+
throw new ExtensionDownloadError("Expected a credential-free HTTP(S) URL");
|
|
39207
|
+
const initialTarget = new URL(parsed.data);
|
|
39208
|
+
const requestHeaders = headers ?? (isGitHubDesktopExtensionZipballUrl(initialTarget) ? githubHeaders : void 0);
|
|
39209
|
+
const effectiveIdleMs = Math.min(idleTimeoutMs ?? timeoutMs, timeoutMs);
|
|
39210
|
+
const totalTimeout = AbortSignal.timeout(timeoutMs);
|
|
39211
|
+
const overallSignal = callerSignal ? AbortSignal.any([totalTimeout, callerSignal]) : totalTimeout;
|
|
39212
|
+
for (let attempt = 0; ; attempt++) {
|
|
39213
|
+
if (callerSignal?.aborted)
|
|
39214
|
+
throw new ExtensionDownloadError("Download aborted", { cause: callerSignal.reason });
|
|
39215
|
+
if (totalTimeout.aborted)
|
|
39216
|
+
throw new ExtensionDownloadError("Download timed out", { cause: totalTimeout.reason });
|
|
39217
|
+
const attemptController = new AbortController();
|
|
39218
|
+
const signal = AbortSignal.any([overallSignal, attemptController.signal]);
|
|
39219
|
+
let idleTimedOut = false;
|
|
39220
|
+
let idleTimer;
|
|
39221
|
+
const resetIdle = () => {
|
|
39222
|
+
if (idleTimer !== void 0)
|
|
39223
|
+
clearTimeout(idleTimer);
|
|
39224
|
+
idleTimer = setTimeout(() => {
|
|
39225
|
+
idleTimedOut = true;
|
|
39226
|
+
attemptController.abort(new Error("Download timed out"));
|
|
39227
|
+
}, effectiveIdleMs);
|
|
39228
|
+
};
|
|
39229
|
+
const clearIdle = () => {
|
|
39230
|
+
if (idleTimer !== void 0) {
|
|
39231
|
+
clearTimeout(idleTimer);
|
|
39232
|
+
idleTimer = void 0;
|
|
39233
|
+
}
|
|
39234
|
+
};
|
|
39235
|
+
try {
|
|
39236
|
+
let target2 = new URL(initialTarget.href);
|
|
39237
|
+
let response;
|
|
39238
|
+
for (let redirects = 0; ; redirects++) {
|
|
39239
|
+
if (!allowUrl(target2) || target2.username || target2.password)
|
|
39240
|
+
throw new ExtensionDownloadError("Unsafe download URL");
|
|
39241
|
+
resetIdle();
|
|
39242
|
+
response = await fetch(target2.href, {
|
|
39243
|
+
signal,
|
|
39244
|
+
redirect: "manual",
|
|
39245
|
+
...requestHeaders ? { headers: requestHeaders } : {}
|
|
39246
|
+
});
|
|
39247
|
+
const location = response.headers.get("location");
|
|
39248
|
+
if (!location || ![301, 302, 303, 307, 308].includes(response.status))
|
|
39249
|
+
break;
|
|
39250
|
+
await response.body?.cancel().catch(() => void 0);
|
|
39251
|
+
if (redirects >= 4)
|
|
39252
|
+
throw new ExtensionDownloadError("Too many download redirects");
|
|
39253
|
+
try {
|
|
39254
|
+
target2 = new URL(location, target2);
|
|
39255
|
+
} catch {
|
|
39256
|
+
throw new ExtensionDownloadError("Invalid download redirect URL");
|
|
39257
|
+
}
|
|
39258
|
+
}
|
|
39259
|
+
const body = response.body;
|
|
39260
|
+
if (!response.ok || !body || Number(response.headers.get("content-length")) > limit) {
|
|
39261
|
+
await body?.cancel().catch(() => void 0);
|
|
39262
|
+
if (!response.ok)
|
|
39263
|
+
throw new ExtensionHttpError(response.status);
|
|
39264
|
+
throw new ExtensionDownloadError("Download is empty or exceeds the size limit");
|
|
39265
|
+
}
|
|
39266
|
+
if (allowContentType && !allowContentType(response.headers.get("content-type"))) {
|
|
39267
|
+
await body.cancel().catch(() => void 0);
|
|
39268
|
+
throw new ExtensionDownloadError("Unsupported download content type");
|
|
39269
|
+
}
|
|
39270
|
+
const reader = body.getReader();
|
|
39271
|
+
const chunks = [];
|
|
39272
|
+
let size = 0;
|
|
39273
|
+
try {
|
|
39274
|
+
for (; ; ) {
|
|
39275
|
+
resetIdle();
|
|
39276
|
+
const { done, value } = await reader.read();
|
|
39277
|
+
if (done)
|
|
39278
|
+
break;
|
|
39279
|
+
size += value.byteLength;
|
|
39280
|
+
if (size > limit)
|
|
39281
|
+
throw new ExtensionDownloadError("Download exceeds the size limit");
|
|
39282
|
+
chunks.push(value);
|
|
39283
|
+
}
|
|
39284
|
+
} finally {
|
|
39285
|
+
clearIdle();
|
|
39286
|
+
await reader.cancel().catch(() => void 0);
|
|
39287
|
+
}
|
|
39288
|
+
return Buffer.concat(chunks, size);
|
|
39289
|
+
} catch (error62) {
|
|
39290
|
+
clearIdle();
|
|
39291
|
+
if (callerSignal?.aborted)
|
|
39292
|
+
throw new ExtensionDownloadError("Download aborted", { cause: callerSignal.reason });
|
|
39293
|
+
if (totalTimeout.aborted)
|
|
39294
|
+
throw new ExtensionDownloadError("Download timed out", { cause: totalTimeout.reason });
|
|
39295
|
+
if (attempt < retries2 && isRetryableDownloadError(error62)) {
|
|
39296
|
+
const waitMs = retryBaseDelayMs * 2 ** attempt;
|
|
39297
|
+
try {
|
|
39298
|
+
if (waitMs > 0)
|
|
39299
|
+
await delay2(waitMs, void 0, { signal: overallSignal });
|
|
39300
|
+
} catch (delayError) {
|
|
39301
|
+
if (callerSignal?.aborted)
|
|
39302
|
+
throw new ExtensionDownloadError("Download aborted", { cause: callerSignal.reason });
|
|
39303
|
+
throw new ExtensionDownloadError("Download timed out", { cause: delayError });
|
|
39304
|
+
}
|
|
39305
|
+
continue;
|
|
39306
|
+
}
|
|
39307
|
+
if (error62 instanceof ExtensionDownloadError)
|
|
39308
|
+
throw error62;
|
|
39309
|
+
throw new ExtensionDownloadError(idleTimedOut ? "Download timed out" : "Download failed", {
|
|
39310
|
+
cause: error62
|
|
39311
|
+
});
|
|
39312
|
+
}
|
|
39313
|
+
}
|
|
39314
|
+
}
|
|
39315
|
+
|
|
39149
39316
|
// packages/harness-plugin-files/dist/host-extension-package.js
|
|
39150
39317
|
import { createHash as createHash2 } from "node:crypto";
|
|
39151
39318
|
import path3 from "node:path";
|
|
@@ -39382,6 +39549,11 @@ async function readHostExtensionAsset({ dataDir, id: id3, path: resource, ...exp
|
|
|
39382
39549
|
// packages/harness-plugin-files/dist/host-extension-default-seeds.js
|
|
39383
39550
|
var MAX_DEFAULT_SEEDS_BYTES = 32 * 1024;
|
|
39384
39551
|
|
|
39552
|
+
// packages/harness-plugin-files/dist/host-extension-sources.js
|
|
39553
|
+
import { lstat as lstat2, mkdir as mkdir4, readFile, realpath as realpath2, stat, unlink, writeFile as writeFile4 } from "node:fs/promises";
|
|
39554
|
+
import { isIP } from "node:net";
|
|
39555
|
+
import path4 from "node:path";
|
|
39556
|
+
|
|
39385
39557
|
// packages/harness-plugin-files/dist/extension-zip.js
|
|
39386
39558
|
import { promisify } from "node:util";
|
|
39387
39559
|
import { crc32, inflateRaw, inflateRawSync } from "node:zlib";
|
|
@@ -39394,11 +39566,222 @@ var inflate = promisify(inflateRaw);
|
|
|
39394
39566
|
var TTL = 5 * 60 * 1e3;
|
|
39395
39567
|
var STALE_FALLBACK_MAX_AGE_MS = 30 * 60 * 1e3;
|
|
39396
39568
|
var DISK_CATALOG_MAX_AGE_MS = 7 * 24 * 60 * 60 * 1e3;
|
|
39569
|
+
var ICON_TIMEOUT_MS = 12e3;
|
|
39570
|
+
var ICON_RETRIES = 1;
|
|
39571
|
+
var ICON_MEMORY_LIMIT = 200;
|
|
39572
|
+
var SCREENSHOT_TIMEOUT_MS = 15e3;
|
|
39573
|
+
var SCREENSHOT_RETRIES = 1;
|
|
39574
|
+
var SCREENSHOT_MEMORY_LIMIT = 64;
|
|
39575
|
+
var IMAGE_FAIL_BACKOFF_MS = 6e4;
|
|
39397
39576
|
var STATS_MAX_BYTES = 256 * 1024;
|
|
39577
|
+
var httpsDownload = (url2) => url2.protocol === "https:" && !url2.username && !url2.password;
|
|
39578
|
+
function isPrivateOrLoopbackIPv4(a2, b2) {
|
|
39579
|
+
return a2 === 0 || a2 === 10 || a2 === 127 || a2 === 169 && b2 === 254 || a2 === 172 && b2 >= 16 && b2 <= 31 || a2 === 192 && b2 === 168;
|
|
39580
|
+
}
|
|
39581
|
+
function parseIPv6Groups(host) {
|
|
39582
|
+
let normalized = host;
|
|
39583
|
+
const lastColon = normalized.lastIndexOf(":");
|
|
39584
|
+
if (lastColon !== -1 && normalized.slice(lastColon + 1).includes(".")) {
|
|
39585
|
+
const ipv4Parts = normalized.slice(lastColon + 1).split(".").map(Number);
|
|
39586
|
+
if (ipv4Parts.length !== 4 || ipv4Parts.some((n2) => !Number.isInteger(n2) || n2 < 0 || n2 > 255))
|
|
39587
|
+
return null;
|
|
39588
|
+
const high = (ipv4Parts[0] << 8 | ipv4Parts[1]).toString(16);
|
|
39589
|
+
const low = (ipv4Parts[2] << 8 | ipv4Parts[3]).toString(16);
|
|
39590
|
+
normalized = `${normalized.slice(0, lastColon + 1)}${high}:${low}`;
|
|
39591
|
+
}
|
|
39592
|
+
const parts = normalized.split("::");
|
|
39593
|
+
if (parts.length > 2)
|
|
39594
|
+
return null;
|
|
39595
|
+
const parseSide = (side) => side ? side.split(":").map((segment) => Number.parseInt(segment, 16)) : [];
|
|
39596
|
+
const left = parseSide(parts[0]);
|
|
39597
|
+
const right = parts.length === 2 ? parseSide(parts[1]) : [];
|
|
39598
|
+
if ([...left, ...right].some((n2) => !Number.isInteger(n2) || n2 < 0 || n2 > 65535))
|
|
39599
|
+
return null;
|
|
39600
|
+
if (parts.length === 1)
|
|
39601
|
+
return left.length === 8 ? left : null;
|
|
39602
|
+
const missing = 8 - left.length - right.length;
|
|
39603
|
+
if (missing < 1)
|
|
39604
|
+
return null;
|
|
39605
|
+
return [...left, ...Array(missing).fill(0), ...right];
|
|
39606
|
+
}
|
|
39607
|
+
function isPrivateOrLoopbackHostname(rawHostname) {
|
|
39608
|
+
const unbracketed = rawHostname.startsWith("[") && rawHostname.endsWith("]") ? rawHostname.slice(1, -1) : rawHostname;
|
|
39609
|
+
const host = unbracketed.toLowerCase().replace(/\.+$/u, "");
|
|
39610
|
+
if (!host || host === "localhost" || host.endsWith(".localhost"))
|
|
39611
|
+
return true;
|
|
39612
|
+
const ipVersion = isIP(host);
|
|
39613
|
+
if (ipVersion === 4) {
|
|
39614
|
+
const octets = host.split(".").map(Number);
|
|
39615
|
+
return octets.length !== 4 || isPrivateOrLoopbackIPv4(octets[0], octets[1]);
|
|
39616
|
+
}
|
|
39617
|
+
if (ipVersion === 6) {
|
|
39618
|
+
const groups = parseIPv6Groups(host);
|
|
39619
|
+
if (!groups)
|
|
39620
|
+
return true;
|
|
39621
|
+
const isZeroPrefix7 = groups.slice(0, 7).every((g2) => g2 === 0);
|
|
39622
|
+
if (isZeroPrefix7 && (groups[7] === 0 || groups[7] === 1))
|
|
39623
|
+
return true;
|
|
39624
|
+
if ((groups[0] & 65024) === 64512)
|
|
39625
|
+
return true;
|
|
39626
|
+
if ((groups[0] & 65472) === 65152)
|
|
39627
|
+
return true;
|
|
39628
|
+
if (groups.slice(0, 5).every((g2) => g2 === 0) && groups[5] === 65535) {
|
|
39629
|
+
return isPrivateOrLoopbackIPv4(groups[6] >> 8, groups[6] & 255);
|
|
39630
|
+
}
|
|
39631
|
+
}
|
|
39632
|
+
return false;
|
|
39633
|
+
}
|
|
39634
|
+
var publicHttpsDownload = (url2) => httpsDownload(url2) && !isPrivateOrLoopbackHostname(url2.hostname);
|
|
39398
39635
|
var PNG_SIG = Buffer.from([137, 80, 78, 71, 13, 10, 26, 10]);
|
|
39399
39636
|
var JPEG_SIG = Buffer.from([255, 216, 255]);
|
|
39400
39637
|
var RIFF_SIG = Buffer.from("RIFF");
|
|
39401
39638
|
var WEBP_SIG = Buffer.from("WEBP");
|
|
39639
|
+
var ALLOWED_CATALOG_IMAGE_CONTENT_TYPES = /* @__PURE__ */ new Set([
|
|
39640
|
+
"image/png",
|
|
39641
|
+
"image/jpeg",
|
|
39642
|
+
"image/webp",
|
|
39643
|
+
"application/octet-stream"
|
|
39644
|
+
]);
|
|
39645
|
+
function isAllowedCatalogImageContentType(contentType) {
|
|
39646
|
+
if (!contentType)
|
|
39647
|
+
return true;
|
|
39648
|
+
const mediaType = contentType.split(";", 1)[0]?.trim().toLowerCase();
|
|
39649
|
+
return !mediaType || ALLOWED_CATALOG_IMAGE_CONTENT_TYPES.has(mediaType);
|
|
39650
|
+
}
|
|
39651
|
+
function detectRasterMimeType(bytes) {
|
|
39652
|
+
if (bytes.length >= 8 && bytes.subarray(0, 8).equals(PNG_SIG))
|
|
39653
|
+
return "image/png";
|
|
39654
|
+
if (bytes.length >= 3 && bytes.subarray(0, 3).equals(JPEG_SIG))
|
|
39655
|
+
return "image/jpeg";
|
|
39656
|
+
if (bytes.length >= 12 && bytes.subarray(0, 4).equals(RIFF_SIG) && bytes.subarray(8, 12).equals(WEBP_SIG)) {
|
|
39657
|
+
return "image/webp";
|
|
39658
|
+
}
|
|
39659
|
+
return null;
|
|
39660
|
+
}
|
|
39661
|
+
function createCatalogImageCache({ cacheSubdir, maxBytes, memoryLimit, label, timeoutMs, retries: retries2, allowContentType }) {
|
|
39662
|
+
const memoryCache = /* @__PURE__ */ new Map();
|
|
39663
|
+
const pendingDownloads = /* @__PURE__ */ new Map();
|
|
39664
|
+
const retryAt = /* @__PURE__ */ new Map();
|
|
39665
|
+
const remember = (hash2, image2) => {
|
|
39666
|
+
memoryCache.delete(hash2);
|
|
39667
|
+
memoryCache.set(hash2, image2);
|
|
39668
|
+
if (memoryCache.size > memoryLimit) {
|
|
39669
|
+
const oldest = memoryCache.keys().next().value;
|
|
39670
|
+
if (oldest !== void 0)
|
|
39671
|
+
memoryCache.delete(oldest);
|
|
39672
|
+
}
|
|
39673
|
+
return image2;
|
|
39674
|
+
};
|
|
39675
|
+
return async function fetchCachedImage({ dataDir, url: url2, signal }) {
|
|
39676
|
+
const parsedUrl = desktopExtensionHttpUrlSchema.safeParse(url2);
|
|
39677
|
+
if (!parsedUrl.success) {
|
|
39678
|
+
throw new ExtensionDownloadError("Expected a credential-free HTTP(S) URL");
|
|
39679
|
+
}
|
|
39680
|
+
const targetUrl = new URL(parsedUrl.data);
|
|
39681
|
+
if (!httpsDownload(targetUrl)) {
|
|
39682
|
+
throw new ExtensionDownloadError(`Catalog ${label} must use HTTPS`);
|
|
39683
|
+
}
|
|
39684
|
+
if (isPrivateOrLoopbackHostname(targetUrl.hostname)) {
|
|
39685
|
+
throw new ExtensionDownloadError("Unsafe download URL");
|
|
39686
|
+
}
|
|
39687
|
+
const hash2 = sha256(Buffer.from(targetUrl.href, "utf8"));
|
|
39688
|
+
const memoryHit = memoryCache.get(hash2);
|
|
39689
|
+
if (memoryHit) {
|
|
39690
|
+
return remember(hash2, memoryHit);
|
|
39691
|
+
}
|
|
39692
|
+
const diskFile = path4.join(dataDir, "cache", cacheSubdir, `${hash2}.img`);
|
|
39693
|
+
const diskInfo = await stat(diskFile).catch(() => void 0);
|
|
39694
|
+
if (diskInfo?.isFile() && diskInfo.size > 0 && diskInfo.size <= maxBytes) {
|
|
39695
|
+
const diskBytes = await readFile(diskFile).catch(() => void 0);
|
|
39696
|
+
if (diskBytes && diskBytes.length <= maxBytes) {
|
|
39697
|
+
const mimeType = detectRasterMimeType(diskBytes);
|
|
39698
|
+
if (mimeType) {
|
|
39699
|
+
return remember(hash2, { mimeType, bytes: diskBytes });
|
|
39700
|
+
}
|
|
39701
|
+
}
|
|
39702
|
+
}
|
|
39703
|
+
const retryUntil = retryAt.get(hash2);
|
|
39704
|
+
if (retryUntil !== void 0 && Date.now() < retryUntil) {
|
|
39705
|
+
throw new ExtensionDownloadError(`Catalog ${label} temporarily unavailable`);
|
|
39706
|
+
}
|
|
39707
|
+
let flight = pendingDownloads.get(hash2);
|
|
39708
|
+
if (!flight) {
|
|
39709
|
+
const created = (async () => {
|
|
39710
|
+
try {
|
|
39711
|
+
const bytes = await downloadExtensionBytes(targetUrl.href, maxBytes, { accept: "image/webp,image/png,image/jpeg,*/*;q=0.5" }, {
|
|
39712
|
+
allowUrl: publicHttpsDownload,
|
|
39713
|
+
allowContentType,
|
|
39714
|
+
timeoutMs,
|
|
39715
|
+
retries: retries2
|
|
39716
|
+
});
|
|
39717
|
+
const mimeType = detectRasterMimeType(bytes);
|
|
39718
|
+
if (!mimeType) {
|
|
39719
|
+
throw new ExtensionDownloadError(`Unsupported catalog ${label} image signature`);
|
|
39720
|
+
}
|
|
39721
|
+
retryAt.delete(hash2);
|
|
39722
|
+
const entry = remember(hash2, { mimeType, bytes });
|
|
39723
|
+
await atomicWriteFile(diskFile, bytes).catch(() => void 0);
|
|
39724
|
+
return entry;
|
|
39725
|
+
} catch (error62) {
|
|
39726
|
+
retryAt.set(hash2, Date.now() + IMAGE_FAIL_BACKOFF_MS);
|
|
39727
|
+
throw error62;
|
|
39728
|
+
}
|
|
39729
|
+
})().finally(() => {
|
|
39730
|
+
if (pendingDownloads.get(hash2) === created)
|
|
39731
|
+
pendingDownloads.delete(hash2);
|
|
39732
|
+
});
|
|
39733
|
+
created.catch(() => void 0);
|
|
39734
|
+
pendingDownloads.set(hash2, created);
|
|
39735
|
+
flight = created;
|
|
39736
|
+
}
|
|
39737
|
+
return raceWithSignal(flight, signal);
|
|
39738
|
+
};
|
|
39739
|
+
}
|
|
39740
|
+
var fetchCatalogIconImage = createCatalogImageCache({
|
|
39741
|
+
cacheSubdir: "extension-icons",
|
|
39742
|
+
maxBytes: DESKTOP_EXTENSION_ICON_MAX_BYTES,
|
|
39743
|
+
memoryLimit: ICON_MEMORY_LIMIT,
|
|
39744
|
+
label: "icon",
|
|
39745
|
+
timeoutMs: ICON_TIMEOUT_MS,
|
|
39746
|
+
retries: ICON_RETRIES
|
|
39747
|
+
});
|
|
39748
|
+
var fetchCatalogScreenshotImage = createCatalogImageCache({
|
|
39749
|
+
cacheSubdir: "extension-screenshots",
|
|
39750
|
+
maxBytes: DESKTOP_EXTENSION_SCREENSHOT_MAX_BYTES,
|
|
39751
|
+
memoryLimit: SCREENSHOT_MEMORY_LIMIT,
|
|
39752
|
+
label: "screenshot",
|
|
39753
|
+
timeoutMs: SCREENSHOT_TIMEOUT_MS,
|
|
39754
|
+
retries: SCREENSHOT_RETRIES,
|
|
39755
|
+
allowContentType: isAllowedCatalogImageContentType
|
|
39756
|
+
});
|
|
39757
|
+
async function atomicWriteFile(filePath2, data) {
|
|
39758
|
+
const dir = path4.dirname(filePath2);
|
|
39759
|
+
const tempPath = `${filePath2}.tmp-${process.pid}-${Math.random().toString(36).slice(2, 10)}`;
|
|
39760
|
+
try {
|
|
39761
|
+
await mkdir4(dir, { recursive: true });
|
|
39762
|
+
await writeFile4(tempPath, data);
|
|
39763
|
+
await renameWithWindowsRetry(tempPath, filePath2);
|
|
39764
|
+
} catch {
|
|
39765
|
+
await unlink(tempPath).catch(() => void 0);
|
|
39766
|
+
}
|
|
39767
|
+
}
|
|
39768
|
+
function raceWithSignal(promise2, signal) {
|
|
39769
|
+
if (!signal)
|
|
39770
|
+
return promise2;
|
|
39771
|
+
if (signal.aborted)
|
|
39772
|
+
return Promise.reject(new ExtensionDownloadError("Download aborted", { cause: signal.reason }));
|
|
39773
|
+
return new Promise((resolve, reject) => {
|
|
39774
|
+
const onAbort = () => reject(new ExtensionDownloadError("Download aborted", { cause: signal.reason }));
|
|
39775
|
+
signal.addEventListener("abort", onAbort, { once: true });
|
|
39776
|
+
promise2.then((value) => {
|
|
39777
|
+
signal.removeEventListener("abort", onAbort);
|
|
39778
|
+
resolve(value);
|
|
39779
|
+
}, (error62) => {
|
|
39780
|
+
signal.removeEventListener("abort", onAbort);
|
|
39781
|
+
reject(error62);
|
|
39782
|
+
});
|
|
39783
|
+
});
|
|
39784
|
+
}
|
|
39402
39785
|
|
|
39403
39786
|
// packages/desktop-control/src/renderer-extension-module.ts
|
|
39404
39787
|
import { posix } from "node:path";
|
|
@@ -39439,12 +39822,12 @@ async function linkRendererExtensionModule(dataDir, { id: id3, activationId, dig
|
|
|
39439
39822
|
name: "host-extension-assets",
|
|
39440
39823
|
resolveId(source, importer) {
|
|
39441
39824
|
try {
|
|
39442
|
-
const
|
|
39443
|
-
if (!
|
|
39444
|
-
hostExtensionResourcePathSchema.parse(
|
|
39445
|
-
if (hostExtensionCanonicalPath(
|
|
39446
|
-
throw new Error(`Cannot import backend.entry: ${
|
|
39447
|
-
return VIRTUAL +
|
|
39825
|
+
const path7 = importer ? resolveModule(importer.slice(VIRTUAL.length), source) : entry;
|
|
39826
|
+
if (!path7.endsWith(".mjs")) throw new Error(`Expected a .mjs module: ${source}`);
|
|
39827
|
+
hostExtensionResourcePathSchema.parse(path7);
|
|
39828
|
+
if (hostExtensionCanonicalPath(path7) === backend)
|
|
39829
|
+
throw new Error(`Cannot import backend.entry: ${path7}`);
|
|
39830
|
+
return VIRTUAL + path7;
|
|
39448
39831
|
} catch (error62) {
|
|
39449
39832
|
throw new Error(
|
|
39450
39833
|
`${importer?.slice(VIRTUAL.length) ?? entry}: ${error62 instanceof Error ? error62.message : String(error62)}`
|
|
@@ -39457,9 +39840,9 @@ async function linkRendererExtensionModule(dataDir, { id: id3, activationId, dig
|
|
|
39457
39840
|
);
|
|
39458
39841
|
},
|
|
39459
39842
|
async load(moduleId) {
|
|
39460
|
-
const
|
|
39843
|
+
const path7 = moduleId.slice(VIRTUAL.length);
|
|
39461
39844
|
if (++count2 > MAX_MODULES2) throw new Error(`Module graph exceeds ${MAX_MODULES2} files`);
|
|
39462
|
-
const asset = await readHostExtensionAsset({ dataDir, id: id3, activationId, digest, path:
|
|
39845
|
+
const asset = await readHostExtensionAsset({ dataDir, id: id3, activationId, digest, path: path7 });
|
|
39463
39846
|
const buffer = Buffer.from(asset.base64, "base64");
|
|
39464
39847
|
bytes += buffer.length;
|
|
39465
39848
|
if (bytes > DESKTOP_EXTENSION_SNAPSHOT_MAX_BYTES)
|
|
@@ -39480,9 +39863,9 @@ async function linkRendererExtensionModule(dataDir, { id: id3, activationId, dig
|
|
|
39480
39863
|
if (warning.code !== "CIRCULAR_DEPENDENCY") warn(warning);
|
|
39481
39864
|
}
|
|
39482
39865
|
}).catch((error62) => {
|
|
39483
|
-
const
|
|
39866
|
+
const path7 = error62.id?.startsWith(VIRTUAL) ? error62.id.slice(VIRTUAL.length) : entry;
|
|
39484
39867
|
const loc = error62.loc ? `:${error62.loc.line}:${error62.loc.column + 1}` : "";
|
|
39485
|
-
throw new Error(`${
|
|
39868
|
+
throw new Error(`${path7}${loc}: ${error62.message}`, { cause: error62 });
|
|
39486
39869
|
});
|
|
39487
39870
|
try {
|
|
39488
39871
|
const { output: output2 } = await bundle.generate({ format: "system", compact: true });
|
|
@@ -39532,8 +39915,8 @@ async function application(dataDir, item) {
|
|
|
39532
39915
|
try {
|
|
39533
39916
|
const desktop = manifest.desktop;
|
|
39534
39917
|
if (!desktop) throw new Error("Missing desktop manifest entry");
|
|
39535
|
-
const read = async (
|
|
39536
|
-
(await readHostExtensionAsset({ dataDir, id: id3, activationId, digest, path:
|
|
39918
|
+
const read = async (path7) => Buffer.from(
|
|
39919
|
+
(await readHostExtensionAsset({ dataDir, id: id3, activationId, digest, path: path7 })).base64,
|
|
39537
39920
|
"base64"
|
|
39538
39921
|
).toString("utf8");
|
|
39539
39922
|
const [script, style2] = await Promise.all([
|
|
@@ -39568,14 +39951,14 @@ async function surfaceApplication(dataDir, item, kind) {
|
|
|
39568
39951
|
const hash2 = renderHash(item);
|
|
39569
39952
|
const surface = manifest[kind];
|
|
39570
39953
|
if (!surface) throw new Error(`Missing ${kind} manifest entry`);
|
|
39571
|
-
const
|
|
39572
|
-
const reference = JSON.stringify({ id: id3, activationId, digest, hash: hash2, kind, path:
|
|
39954
|
+
const path7 = surface.entry;
|
|
39955
|
+
const reference = JSON.stringify({ id: id3, activationId, digest, hash: hash2, kind, path: path7 });
|
|
39573
39956
|
const identity2 = { id: `${id3}:${kind}`, hash: hash2, reference };
|
|
39574
39957
|
try {
|
|
39575
|
-
const factory = await linkRendererExtensionModule(dataDir, item,
|
|
39958
|
+
const factory = await linkRendererExtensionModule(dataDir, item, path7);
|
|
39576
39959
|
return { ...identity2, expression: `{...${reference}, create: ${factory}}` };
|
|
39577
39960
|
} catch (cause) {
|
|
39578
|
-
const error62 = (cause instanceof Error ? cause.message : `${
|
|
39961
|
+
const error62 = (cause instanceof Error ? cause.message : `${path7}: ${String(cause)}`).slice(
|
|
39579
39962
|
0,
|
|
39580
39963
|
2048
|
|
39581
39964
|
);
|
|
@@ -39919,11 +40302,11 @@ var RendererDesktopExtensions = class {
|
|
|
39919
40302
|
extensions: target2.extensions,
|
|
39920
40303
|
...Object.keys(target2.surfaces).length ? { surfaces: target2.surfaces } : {}
|
|
39921
40304
|
};
|
|
39922
|
-
await
|
|
40305
|
+
await mkdir5(path5.dirname(this.#statusPath), { recursive: true, mode: 448 });
|
|
39923
40306
|
const temporary = `${this.#statusPath}.${randomUUID2()}.tmp`;
|
|
39924
40307
|
try {
|
|
39925
|
-
await
|
|
39926
|
-
await
|
|
40308
|
+
await writeFile5(temporary, JSON.stringify(doc), { mode: 384, flag: "wx" });
|
|
40309
|
+
await rename3(temporary, this.#statusPath);
|
|
39927
40310
|
} finally {
|
|
39928
40311
|
await rm4(temporary, { force: true });
|
|
39929
40312
|
}
|
|
@@ -39972,7 +40355,7 @@ function serializeDesktopControllerReadiness(readiness) {
|
|
|
39972
40355
|
return line;
|
|
39973
40356
|
}
|
|
39974
40357
|
var defaultDependencies = {
|
|
39975
|
-
readRenderer: (filePath2) =>
|
|
40358
|
+
readRenderer: (filePath2) => readFile2(filePath2, "utf8"),
|
|
39976
40359
|
install: installRendererCdpControlSession,
|
|
39977
40360
|
startAttachmentServer: startControllerAttachmentServer,
|
|
39978
40361
|
ready: (readiness) => {
|
|
@@ -40010,8 +40393,8 @@ function parseDesktopControllerArguments(arguments_) {
|
|
|
40010
40393
|
if (argument === "--renderer") {
|
|
40011
40394
|
if (rendererPath !== void 0) throw new Error("--renderer may only be provided once");
|
|
40012
40395
|
if (!value) throw new Error("--renderer requires a value");
|
|
40013
|
-
if (!
|
|
40014
|
-
rendererPath =
|
|
40396
|
+
if (!path6.isAbsolute(value)) throw new Error("--renderer must be an absolute path");
|
|
40397
|
+
rendererPath = path6.normalize(value);
|
|
40015
40398
|
index += 1;
|
|
40016
40399
|
continue;
|
|
40017
40400
|
}
|
|
@@ -40080,7 +40463,7 @@ async function installProductionSession(options, dependencies) {
|
|
|
40080
40463
|
async function runDesktopController(options, signal, dependencies = defaultDependencies, lifecycle) {
|
|
40081
40464
|
const now = dependencies.now ?? Date.now;
|
|
40082
40465
|
const desktopExtensions = dependencies === defaultDependencies ? new RendererDesktopExtensions(
|
|
40083
|
-
|
|
40466
|
+
path6.dirname(path6.dirname(defaultControllerStatusPath())),
|
|
40084
40467
|
(error62) => {
|
|
40085
40468
|
process.stderr.write(`codexhost Desktop extensions: ${String(error62)}
|
|
40086
40469
|
`);
|