@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
package/app/host-runtime.mjs
CHANGED
|
@@ -62,15 +62,15 @@ var require_windows = __commonJS({
|
|
|
62
62
|
}
|
|
63
63
|
return false;
|
|
64
64
|
}
|
|
65
|
-
function checkStat(
|
|
66
|
-
if (!
|
|
65
|
+
function checkStat(stat20, path88, options) {
|
|
66
|
+
if (!stat20.isSymbolicLink() && !stat20.isFile()) {
|
|
67
67
|
return false;
|
|
68
68
|
}
|
|
69
69
|
return checkPathExt(path88, options);
|
|
70
70
|
}
|
|
71
71
|
function isexe(path88, options, cb) {
|
|
72
|
-
fs2.stat(path88, function(er,
|
|
73
|
-
cb(er, er ? false : checkStat(
|
|
72
|
+
fs2.stat(path88, function(er, stat20) {
|
|
73
|
+
cb(er, er ? false : checkStat(stat20, path88, options));
|
|
74
74
|
});
|
|
75
75
|
}
|
|
76
76
|
function sync(path88, options) {
|
|
@@ -86,20 +86,20 @@ var require_mode = __commonJS({
|
|
|
86
86
|
isexe.sync = sync;
|
|
87
87
|
var fs2 = __require("fs");
|
|
88
88
|
function isexe(path88, options, cb) {
|
|
89
|
-
fs2.stat(path88, function(er,
|
|
90
|
-
cb(er, er ? false : checkStat(
|
|
89
|
+
fs2.stat(path88, function(er, stat20) {
|
|
90
|
+
cb(er, er ? false : checkStat(stat20, options));
|
|
91
91
|
});
|
|
92
92
|
}
|
|
93
93
|
function sync(path88, options) {
|
|
94
94
|
return checkStat(fs2.statSync(path88), options);
|
|
95
95
|
}
|
|
96
|
-
function checkStat(
|
|
97
|
-
return
|
|
96
|
+
function checkStat(stat20, options) {
|
|
97
|
+
return stat20.isFile() && checkMode(stat20, options);
|
|
98
98
|
}
|
|
99
|
-
function checkMode(
|
|
100
|
-
var mod =
|
|
101
|
-
var uid =
|
|
102
|
-
var gid =
|
|
99
|
+
function checkMode(stat20, options) {
|
|
100
|
+
var mod = stat20.mode;
|
|
101
|
+
var uid = stat20.uid;
|
|
102
|
+
var gid = stat20.gid;
|
|
103
103
|
var myUid = options.uid !== void 0 ? options.uid : process.getuid && process.getuid();
|
|
104
104
|
var myGid = options.gid !== void 0 ? options.gid : process.getgid && process.getgid();
|
|
105
105
|
var u = parseInt("100", 8);
|
|
@@ -1845,11 +1845,11 @@ var require_mtime_precision = __commonJS({
|
|
|
1845
1845
|
function probe(file2, fs2, callback) {
|
|
1846
1846
|
const cachedPrecision = fs2[cacheSymbol];
|
|
1847
1847
|
if (cachedPrecision) {
|
|
1848
|
-
return fs2.stat(file2, (err,
|
|
1848
|
+
return fs2.stat(file2, (err, stat20) => {
|
|
1849
1849
|
if (err) {
|
|
1850
1850
|
return callback(err);
|
|
1851
1851
|
}
|
|
1852
|
-
callback(null,
|
|
1852
|
+
callback(null, stat20.mtime, cachedPrecision);
|
|
1853
1853
|
});
|
|
1854
1854
|
}
|
|
1855
1855
|
const mtime = new Date(Math.ceil(Date.now() / 1e3) * 1e3 + 5);
|
|
@@ -1857,13 +1857,13 @@ var require_mtime_precision = __commonJS({
|
|
|
1857
1857
|
if (err) {
|
|
1858
1858
|
return callback(err);
|
|
1859
1859
|
}
|
|
1860
|
-
fs2.stat(file2, (err2,
|
|
1860
|
+
fs2.stat(file2, (err2, stat20) => {
|
|
1861
1861
|
if (err2) {
|
|
1862
1862
|
return callback(err2);
|
|
1863
1863
|
}
|
|
1864
|
-
const precision =
|
|
1864
|
+
const precision = stat20.mtime.getTime() % 1e3 === 0 ? "s" : "ms";
|
|
1865
1865
|
Object.defineProperty(fs2, cacheSymbol, { value: precision });
|
|
1866
|
-
callback(null,
|
|
1866
|
+
callback(null, stat20.mtime, precision);
|
|
1867
1867
|
});
|
|
1868
1868
|
});
|
|
1869
1869
|
}
|
|
@@ -1917,14 +1917,14 @@ var require_lockfile = __commonJS({
|
|
|
1917
1917
|
if (options.stale <= 0) {
|
|
1918
1918
|
return callback(Object.assign(new Error("Lock file is already being held"), { code: "ELOCKED", file: file2 }));
|
|
1919
1919
|
}
|
|
1920
|
-
options.fs.stat(lockfilePath, (err2,
|
|
1920
|
+
options.fs.stat(lockfilePath, (err2, stat20) => {
|
|
1921
1921
|
if (err2) {
|
|
1922
1922
|
if (err2.code === "ENOENT") {
|
|
1923
1923
|
return acquireLock(file2, { ...options, stale: 0 }, callback);
|
|
1924
1924
|
}
|
|
1925
1925
|
return callback(err2);
|
|
1926
1926
|
}
|
|
1927
|
-
if (!isLockStale(
|
|
1927
|
+
if (!isLockStale(stat20, options)) {
|
|
1928
1928
|
return callback(Object.assign(new Error("Lock file is already being held"), { code: "ELOCKED", file: file2 }));
|
|
1929
1929
|
}
|
|
1930
1930
|
removeLock(file2, options, (err3) => {
|
|
@@ -1936,8 +1936,8 @@ var require_lockfile = __commonJS({
|
|
|
1936
1936
|
});
|
|
1937
1937
|
});
|
|
1938
1938
|
}
|
|
1939
|
-
function isLockStale(
|
|
1940
|
-
return
|
|
1939
|
+
function isLockStale(stat20, options) {
|
|
1940
|
+
return stat20.mtime.getTime() < Date.now() - options.stale;
|
|
1941
1941
|
}
|
|
1942
1942
|
function removeLock(file2, options, callback) {
|
|
1943
1943
|
options.fs.rmdir(getLockFile(file2, options), (err) => {
|
|
@@ -1955,7 +1955,7 @@ var require_lockfile = __commonJS({
|
|
|
1955
1955
|
lock2.updateDelay = lock2.updateDelay || options.update;
|
|
1956
1956
|
lock2.updateTimeout = setTimeout(() => {
|
|
1957
1957
|
lock2.updateTimeout = null;
|
|
1958
|
-
options.fs.stat(lock2.lockfilePath, (err,
|
|
1958
|
+
options.fs.stat(lock2.lockfilePath, (err, stat20) => {
|
|
1959
1959
|
const isOverThreshold = lock2.lastUpdate + options.stale < Date.now();
|
|
1960
1960
|
if (err) {
|
|
1961
1961
|
if (err.code === "ENOENT" || isOverThreshold) {
|
|
@@ -1964,7 +1964,7 @@ var require_lockfile = __commonJS({
|
|
|
1964
1964
|
lock2.updateDelay = 1e3;
|
|
1965
1965
|
return updateLock(file2, options);
|
|
1966
1966
|
}
|
|
1967
|
-
const isMtimeOurs = lock2.mtime.getTime() ===
|
|
1967
|
+
const isMtimeOurs = lock2.mtime.getTime() === stat20.mtime.getTime();
|
|
1968
1968
|
if (!isMtimeOurs) {
|
|
1969
1969
|
return setLockAsCompromised(
|
|
1970
1970
|
file2,
|
|
@@ -2089,11 +2089,11 @@ var require_lockfile = __commonJS({
|
|
|
2089
2089
|
if (err) {
|
|
2090
2090
|
return callback(err);
|
|
2091
2091
|
}
|
|
2092
|
-
options.fs.stat(getLockFile(file3, options), (err2,
|
|
2092
|
+
options.fs.stat(getLockFile(file3, options), (err2, stat20) => {
|
|
2093
2093
|
if (err2) {
|
|
2094
2094
|
return err2.code === "ENOENT" ? callback(null, false) : callback(err2);
|
|
2095
2095
|
}
|
|
2096
|
-
return callback(null, !isLockStale(
|
|
2096
|
+
return callback(null, !isLockStale(stat20, options));
|
|
2097
2097
|
});
|
|
2098
2098
|
});
|
|
2099
2099
|
}
|
|
@@ -38225,6 +38225,7 @@ var HOST_EXTENSIONS_RPC = {
|
|
|
38225
38225
|
snapshot: "codexhost/extensions/snapshot",
|
|
38226
38226
|
catalog: "codexhost/extensions/catalog",
|
|
38227
38227
|
catalogIcon: "codexhost/extensions/catalogIcon",
|
|
38228
|
+
catalogScreenshot: "codexhost/extensions/catalogScreenshot",
|
|
38228
38229
|
install: "codexhost/extensions/install",
|
|
38229
38230
|
update: "codexhost/extensions/update",
|
|
38230
38231
|
enable: "codexhost/extensions/enable",
|
|
@@ -38264,6 +38265,11 @@ var hostExtensionsCatalogIconResultSchema = external_exports.strictObject({
|
|
|
38264
38265
|
mimeType: external_exports.enum(["image/png", "image/jpeg", "image/webp"]),
|
|
38265
38266
|
base64: base643(DESKTOP_EXTENSION_ICON_MAX_BYTES)
|
|
38266
38267
|
});
|
|
38268
|
+
var hostExtensionCatalogScreenshotIndexSchema = external_exports.int().min(0).max(DESKTOP_EXTENSION_SCREENSHOT_LIMIT - 1);
|
|
38269
|
+
var hostExtensionsCatalogScreenshotResultSchema = external_exports.strictObject({
|
|
38270
|
+
mimeType: external_exports.enum(["image/png", "image/jpeg", "image/webp"]),
|
|
38271
|
+
base64: base643(DESKTOP_EXTENSION_SCREENSHOT_MAX_BYTES)
|
|
38272
|
+
});
|
|
38267
38273
|
var hostExtensionSettingsSchema = external_exports.strictObject({
|
|
38268
38274
|
settingsRevision: hostExtensionRevisionSchema,
|
|
38269
38275
|
values: jsonObjectSchema
|
|
@@ -38282,6 +38288,10 @@ var hostExtensionsRpcSchemas = {
|
|
|
38282
38288
|
params: external_exports.strictObject({ ...id }),
|
|
38283
38289
|
result: hostExtensionsCatalogIconResultSchema
|
|
38284
38290
|
},
|
|
38291
|
+
[HOST_EXTENSIONS_RPC.catalogScreenshot]: {
|
|
38292
|
+
params: external_exports.strictObject({ ...id, index: hostExtensionCatalogScreenshotIndexSchema }),
|
|
38293
|
+
result: hostExtensionsCatalogScreenshotResultSchema
|
|
38294
|
+
},
|
|
38285
38295
|
[HOST_EXTENSIONS_RPC.install]: {
|
|
38286
38296
|
params: external_exports.strictObject({ source: hostExtensionInstallSourceSchema }),
|
|
38287
38297
|
result: installationResult
|
|
@@ -49007,12 +49017,12 @@ async function readBridgeDescriptorFile(filePath2) {
|
|
|
49007
49017
|
let handle;
|
|
49008
49018
|
try {
|
|
49009
49019
|
handle = await open8(filePath2, constants7.O_RDONLY | (constants7.O_NOFOLLOW ?? 0));
|
|
49010
|
-
const
|
|
49011
|
-
if (!
|
|
49020
|
+
const stat20 = await handle.stat();
|
|
49021
|
+
if (!stat20.isFile() || stat20.size <= 0 || stat20.size > MAX_BRIDGE_DESCRIPTOR_BYTES) {
|
|
49012
49022
|
return void 0;
|
|
49013
49023
|
}
|
|
49014
49024
|
if (process.platform !== "win32" && typeof process.getuid === "function") {
|
|
49015
|
-
if (
|
|
49025
|
+
if (stat20.uid !== process.getuid() || (stat20.mode & 63) !== 0) {
|
|
49016
49026
|
return void 0;
|
|
49017
49027
|
}
|
|
49018
49028
|
}
|
|
@@ -50065,8 +50075,8 @@ function integer2(value2, name, fallback, maximum) {
|
|
|
50065
50075
|
}
|
|
50066
50076
|
return resolved;
|
|
50067
50077
|
}
|
|
50068
|
-
function revision(
|
|
50069
|
-
return createHash5("sha256").update(JSON.stringify([
|
|
50078
|
+
function revision(stat20) {
|
|
50079
|
+
return createHash5("sha256").update(JSON.stringify([stat20.dev, stat20.ino, stat20.size, stat20.mtimeMs, stat20.ctimeMs])).digest("hex");
|
|
50070
50080
|
}
|
|
50071
50081
|
async function readThreadResultFile(api, input3) {
|
|
50072
50082
|
if (typeof input3.threadId !== "string" || !input3.threadId.trim() || typeof input3.path !== "string" || !input3.path.trim()) {
|
|
@@ -53439,8 +53449,8 @@ async function discoverHostClientChannel(directory2) {
|
|
|
53439
53449
|
try {
|
|
53440
53450
|
const handle = await open12(path19.join(directory2, name), constants10.O_RDONLY | (constants10.O_NOFOLLOW ?? 0));
|
|
53441
53451
|
try {
|
|
53442
|
-
const
|
|
53443
|
-
if (!
|
|
53452
|
+
const stat20 = await handle.stat();
|
|
53453
|
+
if (!stat20.isFile() || stat20.size > 4096 || process.platform !== "win32" && (stat20.uid !== process.getuid?.() || (stat20.mode & 63) !== 0))
|
|
53444
53454
|
continue;
|
|
53445
53455
|
const descriptor = clientChannelDescriptorSchema.parse(JSON.parse(await handle.readFile("utf8")));
|
|
53446
53456
|
process.kill(descriptor.pid, 0);
|
|
@@ -59315,8 +59325,8 @@ async function readImportIndex(codexHome) {
|
|
|
59315
59325
|
try {
|
|
59316
59326
|
const handle = await open16(path31.join(codexHome, IMPORT_INDEX_FILE), "r");
|
|
59317
59327
|
try {
|
|
59318
|
-
const
|
|
59319
|
-
if (!
|
|
59328
|
+
const stat20 = await handle.stat();
|
|
59329
|
+
if (!stat20.isFile() || stat20.size > IMPORT_INDEX_MAX_BYTES) return [];
|
|
59320
59330
|
return importRecords(JSON.parse(await handle.readFile("utf8")));
|
|
59321
59331
|
} finally {
|
|
59322
59332
|
await handle.close();
|
|
@@ -60871,7 +60881,7 @@ function isRetryableDownloadError(error62) {
|
|
|
60871
60881
|
return RETRYABLE_HTTP_STATUSES.has(error62.status);
|
|
60872
60882
|
return !(error62 instanceof ExtensionDownloadError);
|
|
60873
60883
|
}
|
|
60874
|
-
async function downloadExtensionBytes(url2, limit, headers, { signal: callerSignal, allowUrl, timeoutMs = DEFAULT_TIMEOUT_MS, idleTimeoutMs, retries = 0, retryBaseDelayMs = DEFAULT_RETRY_BASE_DELAY_MS }) {
|
|
60884
|
+
async function downloadExtensionBytes(url2, limit, headers, { signal: callerSignal, allowUrl, allowContentType, timeoutMs = DEFAULT_TIMEOUT_MS, idleTimeoutMs, retries = 0, retryBaseDelayMs = DEFAULT_RETRY_BASE_DELAY_MS }) {
|
|
60875
60885
|
const parsed2 = desktopExtensionHttpUrlSchema.safeParse(url2);
|
|
60876
60886
|
if (!parsed2.success)
|
|
60877
60887
|
throw new ExtensionDownloadError("Expected a credential-free HTTP(S) URL");
|
|
@@ -60934,6 +60944,10 @@ async function downloadExtensionBytes(url2, limit, headers, { signal: callerSign
|
|
|
60934
60944
|
throw new ExtensionHttpError(response.status);
|
|
60935
60945
|
throw new ExtensionDownloadError("Download is empty or exceeds the size limit");
|
|
60936
60946
|
}
|
|
60947
|
+
if (allowContentType && !allowContentType(response.headers.get("content-type"))) {
|
|
60948
|
+
await body2.cancel().catch(() => void 0);
|
|
60949
|
+
throw new ExtensionDownloadError("Unsupported download content type");
|
|
60950
|
+
}
|
|
60937
60951
|
const reader = body2.getReader();
|
|
60938
60952
|
const chunks = [];
|
|
60939
60953
|
let size = 0;
|
|
@@ -61827,7 +61841,8 @@ async function markDefaultHostExtensionSeeded(dataDir, id3) {
|
|
|
61827
61841
|
}
|
|
61828
61842
|
|
|
61829
61843
|
// packages/harness-plugin-files/dist/host-extension-sources.js
|
|
61830
|
-
import { lstat as lstat13, mkdir as mkdir19, readFile as readFile23, realpath as realpath11, unlink as unlink3, writeFile as writeFile15 } from "node:fs/promises";
|
|
61844
|
+
import { lstat as lstat13, mkdir as mkdir19, readFile as readFile23, realpath as realpath11, stat as stat10, unlink as unlink3, writeFile as writeFile15 } from "node:fs/promises";
|
|
61845
|
+
import { isIP } from "node:net";
|
|
61831
61846
|
import path41 from "node:path";
|
|
61832
61847
|
|
|
61833
61848
|
// packages/harness-plugin-files/dist/extension-zip.js
|
|
@@ -61991,11 +62006,71 @@ var ZIP_RETRIES = 2;
|
|
|
61991
62006
|
var ICON_TIMEOUT_MS = 12e3;
|
|
61992
62007
|
var ICON_RETRIES = 1;
|
|
61993
62008
|
var ICON_MEMORY_LIMIT = 200;
|
|
61994
|
-
var
|
|
62009
|
+
var SCREENSHOT_TIMEOUT_MS = 15e3;
|
|
62010
|
+
var SCREENSHOT_RETRIES = 1;
|
|
62011
|
+
var SCREENSHOT_MEMORY_LIMIT = 64;
|
|
62012
|
+
var IMAGE_FAIL_BACKOFF_MS = 6e4;
|
|
61995
62013
|
var STATS_MAX_BYTES = 256 * 1024;
|
|
61996
62014
|
var STATS_TIMEOUT_MS = 2e3;
|
|
61997
62015
|
var STATS_INLINE_GRACE_MS = 600;
|
|
61998
62016
|
var httpsDownload = (url2) => url2.protocol === "https:" && !url2.username && !url2.password;
|
|
62017
|
+
function isPrivateOrLoopbackIPv4(a, b) {
|
|
62018
|
+
return a === 0 || a === 10 || a === 127 || a === 169 && b === 254 || a === 172 && b >= 16 && b <= 31 || a === 192 && b === 168;
|
|
62019
|
+
}
|
|
62020
|
+
function parseIPv6Groups(host) {
|
|
62021
|
+
let normalized = host;
|
|
62022
|
+
const lastColon = normalized.lastIndexOf(":");
|
|
62023
|
+
if (lastColon !== -1 && normalized.slice(lastColon + 1).includes(".")) {
|
|
62024
|
+
const ipv4Parts = normalized.slice(lastColon + 1).split(".").map(Number);
|
|
62025
|
+
if (ipv4Parts.length !== 4 || ipv4Parts.some((n) => !Number.isInteger(n) || n < 0 || n > 255))
|
|
62026
|
+
return null;
|
|
62027
|
+
const high = (ipv4Parts[0] << 8 | ipv4Parts[1]).toString(16);
|
|
62028
|
+
const low = (ipv4Parts[2] << 8 | ipv4Parts[3]).toString(16);
|
|
62029
|
+
normalized = `${normalized.slice(0, lastColon + 1)}${high}:${low}`;
|
|
62030
|
+
}
|
|
62031
|
+
const parts = normalized.split("::");
|
|
62032
|
+
if (parts.length > 2)
|
|
62033
|
+
return null;
|
|
62034
|
+
const parseSide = (side) => side ? side.split(":").map((segment) => Number.parseInt(segment, 16)) : [];
|
|
62035
|
+
const left = parseSide(parts[0]);
|
|
62036
|
+
const right = parts.length === 2 ? parseSide(parts[1]) : [];
|
|
62037
|
+
if ([...left, ...right].some((n) => !Number.isInteger(n) || n < 0 || n > 65535))
|
|
62038
|
+
return null;
|
|
62039
|
+
if (parts.length === 1)
|
|
62040
|
+
return left.length === 8 ? left : null;
|
|
62041
|
+
const missing2 = 8 - left.length - right.length;
|
|
62042
|
+
if (missing2 < 1)
|
|
62043
|
+
return null;
|
|
62044
|
+
return [...left, ...Array(missing2).fill(0), ...right];
|
|
62045
|
+
}
|
|
62046
|
+
function isPrivateOrLoopbackHostname(rawHostname) {
|
|
62047
|
+
const unbracketed = rawHostname.startsWith("[") && rawHostname.endsWith("]") ? rawHostname.slice(1, -1) : rawHostname;
|
|
62048
|
+
const host = unbracketed.toLowerCase().replace(/\.+$/u, "");
|
|
62049
|
+
if (!host || host === "localhost" || host.endsWith(".localhost"))
|
|
62050
|
+
return true;
|
|
62051
|
+
const ipVersion = isIP(host);
|
|
62052
|
+
if (ipVersion === 4) {
|
|
62053
|
+
const octets = host.split(".").map(Number);
|
|
62054
|
+
return octets.length !== 4 || isPrivateOrLoopbackIPv4(octets[0], octets[1]);
|
|
62055
|
+
}
|
|
62056
|
+
if (ipVersion === 6) {
|
|
62057
|
+
const groups = parseIPv6Groups(host);
|
|
62058
|
+
if (!groups)
|
|
62059
|
+
return true;
|
|
62060
|
+
const isZeroPrefix7 = groups.slice(0, 7).every((g) => g === 0);
|
|
62061
|
+
if (isZeroPrefix7 && (groups[7] === 0 || groups[7] === 1))
|
|
62062
|
+
return true;
|
|
62063
|
+
if ((groups[0] & 65024) === 64512)
|
|
62064
|
+
return true;
|
|
62065
|
+
if ((groups[0] & 65472) === 65152)
|
|
62066
|
+
return true;
|
|
62067
|
+
if (groups.slice(0, 5).every((g) => g === 0) && groups[5] === 65535) {
|
|
62068
|
+
return isPrivateOrLoopbackIPv4(groups[6] >> 8, groups[6] & 255);
|
|
62069
|
+
}
|
|
62070
|
+
}
|
|
62071
|
+
return false;
|
|
62072
|
+
}
|
|
62073
|
+
var publicHttpsDownload = (url2) => httpsDownload(url2) && !isPrivateOrLoopbackHostname(url2.hostname);
|
|
61999
62074
|
var githubDownload = (url2) => httpsDownload(url2) && [
|
|
62000
62075
|
"https://github.com",
|
|
62001
62076
|
"https://api.github.com",
|
|
@@ -62008,13 +62083,22 @@ var pending;
|
|
|
62008
62083
|
var catalogGeneration = 0;
|
|
62009
62084
|
var cacheWrittenGeneration = 0;
|
|
62010
62085
|
var lastKnownDownloadStats;
|
|
62011
|
-
var iconMemoryCache = /* @__PURE__ */ new Map();
|
|
62012
|
-
var iconPending = /* @__PURE__ */ new Map();
|
|
62013
|
-
var iconRetryAt = /* @__PURE__ */ new Map();
|
|
62014
62086
|
var PNG_SIG = Buffer.from([137, 80, 78, 71, 13, 10, 26, 10]);
|
|
62015
62087
|
var JPEG_SIG = Buffer.from([255, 216, 255]);
|
|
62016
62088
|
var RIFF_SIG = Buffer.from("RIFF");
|
|
62017
62089
|
var WEBP_SIG = Buffer.from("WEBP");
|
|
62090
|
+
var ALLOWED_CATALOG_IMAGE_CONTENT_TYPES = /* @__PURE__ */ new Set([
|
|
62091
|
+
"image/png",
|
|
62092
|
+
"image/jpeg",
|
|
62093
|
+
"image/webp",
|
|
62094
|
+
"application/octet-stream"
|
|
62095
|
+
]);
|
|
62096
|
+
function isAllowedCatalogImageContentType(contentType2) {
|
|
62097
|
+
if (!contentType2)
|
|
62098
|
+
return true;
|
|
62099
|
+
const mediaType = contentType2.split(";", 1)[0]?.trim().toLowerCase();
|
|
62100
|
+
return !mediaType || ALLOWED_CATALOG_IMAGE_CONTENT_TYPES.has(mediaType);
|
|
62101
|
+
}
|
|
62018
62102
|
function detectRasterMimeType(bytes2) {
|
|
62019
62103
|
if (bytes2.length >= 8 && bytes2.subarray(0, 8).equals(PNG_SIG))
|
|
62020
62104
|
return "image/png";
|
|
@@ -62025,16 +62109,102 @@ function detectRasterMimeType(bytes2) {
|
|
|
62025
62109
|
}
|
|
62026
62110
|
return null;
|
|
62027
62111
|
}
|
|
62028
|
-
function
|
|
62029
|
-
|
|
62030
|
-
|
|
62031
|
-
|
|
62032
|
-
|
|
62033
|
-
|
|
62034
|
-
|
|
62035
|
-
|
|
62036
|
-
|
|
62037
|
-
|
|
62112
|
+
function createCatalogImageCache({ cacheSubdir, maxBytes, memoryLimit, label, timeoutMs, retries, allowContentType }) {
|
|
62113
|
+
const memoryCache = /* @__PURE__ */ new Map();
|
|
62114
|
+
const pendingDownloads = /* @__PURE__ */ new Map();
|
|
62115
|
+
const retryAt = /* @__PURE__ */ new Map();
|
|
62116
|
+
const remember = (hash2, image2) => {
|
|
62117
|
+
memoryCache.delete(hash2);
|
|
62118
|
+
memoryCache.set(hash2, image2);
|
|
62119
|
+
if (memoryCache.size > memoryLimit) {
|
|
62120
|
+
const oldest = memoryCache.keys().next().value;
|
|
62121
|
+
if (oldest !== void 0)
|
|
62122
|
+
memoryCache.delete(oldest);
|
|
62123
|
+
}
|
|
62124
|
+
return image2;
|
|
62125
|
+
};
|
|
62126
|
+
return async function fetchCachedImage({ dataDir, url: url2, signal }) {
|
|
62127
|
+
const parsedUrl = desktopExtensionHttpUrlSchema.safeParse(url2);
|
|
62128
|
+
if (!parsedUrl.success) {
|
|
62129
|
+
throw new ExtensionDownloadError("Expected a credential-free HTTP(S) URL");
|
|
62130
|
+
}
|
|
62131
|
+
const targetUrl = new URL(parsedUrl.data);
|
|
62132
|
+
if (!httpsDownload(targetUrl)) {
|
|
62133
|
+
throw new ExtensionDownloadError(`Catalog ${label} must use HTTPS`);
|
|
62134
|
+
}
|
|
62135
|
+
if (isPrivateOrLoopbackHostname(targetUrl.hostname)) {
|
|
62136
|
+
throw new ExtensionDownloadError("Unsafe download URL");
|
|
62137
|
+
}
|
|
62138
|
+
const hash2 = sha2562(Buffer.from(targetUrl.href, "utf8"));
|
|
62139
|
+
const memoryHit = memoryCache.get(hash2);
|
|
62140
|
+
if (memoryHit) {
|
|
62141
|
+
return remember(hash2, memoryHit);
|
|
62142
|
+
}
|
|
62143
|
+
const diskFile = path41.join(dataDir, "cache", cacheSubdir, `${hash2}.img`);
|
|
62144
|
+
const diskInfo = await stat10(diskFile).catch(() => void 0);
|
|
62145
|
+
if (diskInfo?.isFile() && diskInfo.size > 0 && diskInfo.size <= maxBytes) {
|
|
62146
|
+
const diskBytes = await readFile23(diskFile).catch(() => void 0);
|
|
62147
|
+
if (diskBytes && diskBytes.length <= maxBytes) {
|
|
62148
|
+
const mimeType = detectRasterMimeType(diskBytes);
|
|
62149
|
+
if (mimeType) {
|
|
62150
|
+
return remember(hash2, { mimeType, bytes: diskBytes });
|
|
62151
|
+
}
|
|
62152
|
+
}
|
|
62153
|
+
}
|
|
62154
|
+
const retryUntil = retryAt.get(hash2);
|
|
62155
|
+
if (retryUntil !== void 0 && Date.now() < retryUntil) {
|
|
62156
|
+
throw new ExtensionDownloadError(`Catalog ${label} temporarily unavailable`);
|
|
62157
|
+
}
|
|
62158
|
+
let flight = pendingDownloads.get(hash2);
|
|
62159
|
+
if (!flight) {
|
|
62160
|
+
const created = (async () => {
|
|
62161
|
+
try {
|
|
62162
|
+
const bytes2 = await downloadExtensionBytes(targetUrl.href, maxBytes, { accept: "image/webp,image/png,image/jpeg,*/*;q=0.5" }, {
|
|
62163
|
+
allowUrl: publicHttpsDownload,
|
|
62164
|
+
allowContentType,
|
|
62165
|
+
timeoutMs,
|
|
62166
|
+
retries
|
|
62167
|
+
});
|
|
62168
|
+
const mimeType = detectRasterMimeType(bytes2);
|
|
62169
|
+
if (!mimeType) {
|
|
62170
|
+
throw new ExtensionDownloadError(`Unsupported catalog ${label} image signature`);
|
|
62171
|
+
}
|
|
62172
|
+
retryAt.delete(hash2);
|
|
62173
|
+
const entry = remember(hash2, { mimeType, bytes: bytes2 });
|
|
62174
|
+
await atomicWriteFile(diskFile, bytes2).catch(() => void 0);
|
|
62175
|
+
return entry;
|
|
62176
|
+
} catch (error62) {
|
|
62177
|
+
retryAt.set(hash2, Date.now() + IMAGE_FAIL_BACKOFF_MS);
|
|
62178
|
+
throw error62;
|
|
62179
|
+
}
|
|
62180
|
+
})().finally(() => {
|
|
62181
|
+
if (pendingDownloads.get(hash2) === created)
|
|
62182
|
+
pendingDownloads.delete(hash2);
|
|
62183
|
+
});
|
|
62184
|
+
created.catch(() => void 0);
|
|
62185
|
+
pendingDownloads.set(hash2, created);
|
|
62186
|
+
flight = created;
|
|
62187
|
+
}
|
|
62188
|
+
return raceWithSignal(flight, signal);
|
|
62189
|
+
};
|
|
62190
|
+
}
|
|
62191
|
+
var fetchCatalogIconImage = createCatalogImageCache({
|
|
62192
|
+
cacheSubdir: "extension-icons",
|
|
62193
|
+
maxBytes: DESKTOP_EXTENSION_ICON_MAX_BYTES,
|
|
62194
|
+
memoryLimit: ICON_MEMORY_LIMIT,
|
|
62195
|
+
label: "icon",
|
|
62196
|
+
timeoutMs: ICON_TIMEOUT_MS,
|
|
62197
|
+
retries: ICON_RETRIES
|
|
62198
|
+
});
|
|
62199
|
+
var fetchCatalogScreenshotImage = createCatalogImageCache({
|
|
62200
|
+
cacheSubdir: "extension-screenshots",
|
|
62201
|
+
maxBytes: DESKTOP_EXTENSION_SCREENSHOT_MAX_BYTES,
|
|
62202
|
+
memoryLimit: SCREENSHOT_MEMORY_LIMIT,
|
|
62203
|
+
label: "screenshot",
|
|
62204
|
+
timeoutMs: SCREENSHOT_TIMEOUT_MS,
|
|
62205
|
+
retries: SCREENSHOT_RETRIES,
|
|
62206
|
+
allowContentType: isAllowedCatalogImageContentType
|
|
62207
|
+
});
|
|
62038
62208
|
async function atomicWriteFile(filePath2, data) {
|
|
62039
62209
|
const dir = path41.dirname(filePath2);
|
|
62040
62210
|
const tempPath = `${filePath2}.tmp-${process.pid}-${Math.random().toString(36).slice(2, 10)}`;
|
|
@@ -62049,9 +62219,6 @@ async function atomicWriteFile(filePath2, data) {
|
|
|
62049
62219
|
function catalogDiskCachePath(dataDir) {
|
|
62050
62220
|
return path41.join(dataDir, "cache", "host-extension-catalog.v2.json");
|
|
62051
62221
|
}
|
|
62052
|
-
function iconDiskCachePath(dataDir, hash2) {
|
|
62053
|
-
return path41.join(dataDir, "cache", "extension-icons", `${hash2}.img`);
|
|
62054
|
-
}
|
|
62055
62222
|
async function readDiskCatalogCache(dataDir) {
|
|
62056
62223
|
try {
|
|
62057
62224
|
const raw = await readFile23(catalogDiskCachePath(dataDir), "utf8");
|
|
@@ -62073,61 +62240,10 @@ async function writeDiskCatalogCache(dataDir, result) {
|
|
|
62073
62240
|
await atomicWriteFile(catalogDiskCachePath(dataDir), JSON.stringify(result));
|
|
62074
62241
|
}
|
|
62075
62242
|
async function fetchCachedCatalogIcon({ dataDir, iconUrl, signal }) {
|
|
62076
|
-
|
|
62077
|
-
|
|
62078
|
-
|
|
62079
|
-
}
|
|
62080
|
-
const targetUrl = new URL(parsedUrl.data);
|
|
62081
|
-
if (!httpsDownload(targetUrl)) {
|
|
62082
|
-
throw new ExtensionDownloadError("Catalog icon must use HTTPS");
|
|
62083
|
-
}
|
|
62084
|
-
const hash2 = sha2562(Buffer.from(targetUrl.href, "utf8"));
|
|
62085
|
-
const memoryHit = iconMemoryCache.get(hash2);
|
|
62086
|
-
if (memoryHit) {
|
|
62087
|
-
return rememberIcon(hash2, memoryHit);
|
|
62088
|
-
}
|
|
62089
|
-
const diskFile = iconDiskCachePath(dataDir, hash2);
|
|
62090
|
-
const diskBytes = await readFile23(diskFile).catch(() => void 0);
|
|
62091
|
-
if (diskBytes && diskBytes.length <= DESKTOP_EXTENSION_ICON_MAX_BYTES) {
|
|
62092
|
-
const mimeType = detectRasterMimeType(diskBytes);
|
|
62093
|
-
if (mimeType) {
|
|
62094
|
-
return rememberIcon(hash2, { mimeType, bytes: diskBytes });
|
|
62095
|
-
}
|
|
62096
|
-
}
|
|
62097
|
-
const retryUntil = iconRetryAt.get(hash2);
|
|
62098
|
-
if (retryUntil !== void 0 && Date.now() < retryUntil) {
|
|
62099
|
-
throw new ExtensionDownloadError("Catalog icon temporarily unavailable");
|
|
62100
|
-
}
|
|
62101
|
-
let flight = iconPending.get(hash2);
|
|
62102
|
-
if (!flight) {
|
|
62103
|
-
const created = (async () => {
|
|
62104
|
-
try {
|
|
62105
|
-
const bytes2 = await downloadExtensionBytes(targetUrl.href, DESKTOP_EXTENSION_ICON_MAX_BYTES, { accept: "image/webp,image/png,image/jpeg,*/*;q=0.5" }, {
|
|
62106
|
-
allowUrl: httpsDownload,
|
|
62107
|
-
timeoutMs: ICON_TIMEOUT_MS,
|
|
62108
|
-
retries: ICON_RETRIES
|
|
62109
|
-
});
|
|
62110
|
-
const mimeType = detectRasterMimeType(bytes2);
|
|
62111
|
-
if (!mimeType) {
|
|
62112
|
-
throw new ExtensionDownloadError("Unsupported catalog icon image signature");
|
|
62113
|
-
}
|
|
62114
|
-
iconRetryAt.delete(hash2);
|
|
62115
|
-
const entry = rememberIcon(hash2, { mimeType, bytes: bytes2 });
|
|
62116
|
-
void atomicWriteFile(diskFile, bytes2);
|
|
62117
|
-
return entry;
|
|
62118
|
-
} catch (error62) {
|
|
62119
|
-
iconRetryAt.set(hash2, Date.now() + ICON_FAIL_BACKOFF_MS);
|
|
62120
|
-
throw error62;
|
|
62121
|
-
}
|
|
62122
|
-
})().finally(() => {
|
|
62123
|
-
if (iconPending.get(hash2) === created)
|
|
62124
|
-
iconPending.delete(hash2);
|
|
62125
|
-
});
|
|
62126
|
-
created.catch(() => void 0);
|
|
62127
|
-
iconPending.set(hash2, created);
|
|
62128
|
-
flight = created;
|
|
62129
|
-
}
|
|
62130
|
-
return raceWithSignal(flight, signal);
|
|
62243
|
+
return fetchCatalogIconImage({ dataDir, url: iconUrl, signal });
|
|
62244
|
+
}
|
|
62245
|
+
async function fetchCachedCatalogScreenshot({ dataDir, screenshotUrl, signal }) {
|
|
62246
|
+
return fetchCatalogScreenshotImage({ dataDir, url: screenshotUrl, signal });
|
|
62131
62247
|
}
|
|
62132
62248
|
function raceWithSignal(promise2, signal) {
|
|
62133
62249
|
if (!signal)
|
|
@@ -62740,7 +62856,7 @@ import { mkdir as mkdir22, readFile as readFile26, rename as rename18, rm as rm2
|
|
|
62740
62856
|
import path44 from "node:path";
|
|
62741
62857
|
|
|
62742
62858
|
// packages/host-runtime/src/model-prices.ts
|
|
62743
|
-
import { mkdir as mkdir21, readFile as readFile25, rename as rename17, stat as
|
|
62859
|
+
import { mkdir as mkdir21, readFile as readFile25, rename as rename17, stat as stat11, writeFile as writeFile17 } from "node:fs/promises";
|
|
62744
62860
|
import os7 from "node:os";
|
|
62745
62861
|
import path43 from "node:path";
|
|
62746
62862
|
|
|
@@ -63609,7 +63725,7 @@ var ModelPriceCatalog = class {
|
|
|
63609
63725
|
async #reloadOverrides(overridesPath) {
|
|
63610
63726
|
let version2;
|
|
63611
63727
|
try {
|
|
63612
|
-
const info = await
|
|
63728
|
+
const info = await stat11(overridesPath);
|
|
63613
63729
|
version2 = `${info.mtimeMs}:${info.size}`;
|
|
63614
63730
|
} catch {
|
|
63615
63731
|
version2 = null;
|
|
@@ -63735,7 +63851,7 @@ async function handleModelPriceOverridesRequest(catalog, method, params2) {
|
|
|
63735
63851
|
|
|
63736
63852
|
// packages/host-runtime/src/delegation-skill.ts
|
|
63737
63853
|
import { createHash as createHash14, randomUUID as randomUUID26 } from "node:crypto";
|
|
63738
|
-
import { mkdir as mkdir23, open as open20, readFile as readFile27, rename as rename19, rm as rm22, stat as
|
|
63854
|
+
import { mkdir as mkdir23, open as open20, readFile as readFile27, rename as rename19, rm as rm22, stat as stat12 } from "node:fs/promises";
|
|
63739
63855
|
import os8 from "node:os";
|
|
63740
63856
|
import path45 from "node:path";
|
|
63741
63857
|
var SKILL_VERSION = 16;
|
|
@@ -63869,8 +63985,17 @@ async function atomicWrite(filePath2, content) {
|
|
|
63869
63985
|
await rm22(temporaryPath, { force: true });
|
|
63870
63986
|
}
|
|
63871
63987
|
}
|
|
63988
|
+
function delegationSkillHomeDirectory(input3) {
|
|
63989
|
+
if (input3.homeDirectory) return input3.homeDirectory;
|
|
63990
|
+
const environment = input3.environment;
|
|
63991
|
+
if (environment) {
|
|
63992
|
+
const configured = process.platform === "win32" ? environment.USERPROFILE || environment.HOME : environment.HOME;
|
|
63993
|
+
if (configured) return configured;
|
|
63994
|
+
}
|
|
63995
|
+
return os8.homedir();
|
|
63996
|
+
}
|
|
63872
63997
|
async function installDelegationSkills(input3 = {}) {
|
|
63873
|
-
const home = input3
|
|
63998
|
+
const home = delegationSkillHomeDirectory(input3);
|
|
63874
63999
|
const destinations = [
|
|
63875
64000
|
path45.join(home, ".agents", SKILL_RELATIVE_PATH),
|
|
63876
64001
|
path45.join(home, ".claude", SKILL_RELATIVE_PATH)
|
|
@@ -63919,7 +64044,7 @@ async function installDelegationSkills(input3 = {}) {
|
|
|
63919
64044
|
for (const result of results) {
|
|
63920
64045
|
if (result.status === "conflict") continue;
|
|
63921
64046
|
const source = await readFile27(result.path, "utf8");
|
|
63922
|
-
const metadata2 = await
|
|
64047
|
+
const metadata2 = await stat12(result.path);
|
|
63923
64048
|
if (!metadata2.isFile() || source !== CODEXHOST_DELEGATION_SKILL) {
|
|
63924
64049
|
throw new Error(`Delegation Skill verification failed: ${result.path}`);
|
|
63925
64050
|
}
|
|
@@ -63937,7 +64062,7 @@ async function installDelegationSkills(input3 = {}) {
|
|
|
63937
64062
|
return results;
|
|
63938
64063
|
}
|
|
63939
64064
|
async function managedDelegationSkillReference(input3 = {}) {
|
|
63940
|
-
const filePath2 = path45.join(input3
|
|
64065
|
+
const filePath2 = path45.join(delegationSkillHomeDirectory(input3), ".agents", SKILL_RELATIVE_PATH);
|
|
63941
64066
|
try {
|
|
63942
64067
|
return await readOptional(filePath2) === CODEXHOST_DELEGATION_SKILL ? { name: DELEGATION_SKILL_NAME, path: filePath2 } : null;
|
|
63943
64068
|
} catch {
|
|
@@ -63946,6 +64071,27 @@ async function managedDelegationSkillReference(input3 = {}) {
|
|
|
63946
64071
|
}
|
|
63947
64072
|
|
|
63948
64073
|
// packages/host-runtime/src/delegation-mention-rewrite.ts
|
|
64074
|
+
var THREAD_TEXT_REFERENCE_RE = /\]\((?:<(thread:\/\/[^\s<>]+)>|(thread:\/\/[^\s<>()]+))\)|(?<![\w:/])(thread:\/\/[^\s<>()[\]`"',。!?;:、]+)/gu;
|
|
64075
|
+
function parseThreadReferenceUri(uri) {
|
|
64076
|
+
const match = /^thread:\/\/([^/?#]+)(?:\?hostId=([^&#]+))?$/u.exec(uri);
|
|
64077
|
+
if (!match?.[1]) return null;
|
|
64078
|
+
let threadId2;
|
|
64079
|
+
try {
|
|
64080
|
+
threadId2 = decodeURIComponent(match[1]);
|
|
64081
|
+
} catch {
|
|
64082
|
+
return null;
|
|
64083
|
+
}
|
|
64084
|
+
if (!threadId2 || /[\u0000-\u001f\u007f/]/u.test(threadId2)) return null;
|
|
64085
|
+
if (match[2] === void 0) return { threadId: threadId2 };
|
|
64086
|
+
let hostId2;
|
|
64087
|
+
try {
|
|
64088
|
+
hostId2 = decodeURIComponent(match[2]);
|
|
64089
|
+
} catch {
|
|
64090
|
+
return null;
|
|
64091
|
+
}
|
|
64092
|
+
if (!hostId2.trim() || /[\u0000-\u001f\u007f]/u.test(hostId2)) return null;
|
|
64093
|
+
return { threadId: threadId2, hostId: hostId2 };
|
|
64094
|
+
}
|
|
63949
64095
|
function isRemoteTarget(mention) {
|
|
63950
64096
|
return mention.hostId !== void 0 && mention.hostId !== "local";
|
|
63951
64097
|
}
|
|
@@ -64010,6 +64156,39 @@ function rewriteDelegationMentionText(text5) {
|
|
|
64010
64156
|
function isRecord15(value2) {
|
|
64011
64157
|
return typeof value2 === "object" && value2 !== null && !Array.isArray(value2);
|
|
64012
64158
|
}
|
|
64159
|
+
function hasDelegationSkill(input3, skill) {
|
|
64160
|
+
return input3.some((item) => isRecord15(item) && item.type === "skill" && item.name === skill.name);
|
|
64161
|
+
}
|
|
64162
|
+
function extractThreadReferencesFromInput(input3) {
|
|
64163
|
+
const references = [];
|
|
64164
|
+
const seen = /* @__PURE__ */ new Set();
|
|
64165
|
+
const recordTarget = (target2) => {
|
|
64166
|
+
if (!target2) return;
|
|
64167
|
+
const key = `${target2.hostId ?? ""}::${target2.threadId}`;
|
|
64168
|
+
if (seen.has(key)) return;
|
|
64169
|
+
seen.add(key);
|
|
64170
|
+
references.push(target2);
|
|
64171
|
+
};
|
|
64172
|
+
for (const item of input3) {
|
|
64173
|
+
if (!isRecord15(item)) continue;
|
|
64174
|
+
if (item.type === "mention" && typeof item.path === "string" && item.path.startsWith("thread://")) {
|
|
64175
|
+
recordTarget(parseThreadReferenceUri(item.path));
|
|
64176
|
+
continue;
|
|
64177
|
+
}
|
|
64178
|
+
if (item.type === "text" && typeof item.text === "string" && item.text.includes("thread://")) {
|
|
64179
|
+
for (const match of item.text.matchAll(THREAD_TEXT_REFERENCE_RE)) {
|
|
64180
|
+
const markdownUri = match[1] ?? match[2];
|
|
64181
|
+
const uri = markdownUri ?? match[3]?.replace(/[.,;:!?]+$/u, "");
|
|
64182
|
+
if (uri) recordTarget(parseThreadReferenceUri(uri));
|
|
64183
|
+
}
|
|
64184
|
+
}
|
|
64185
|
+
}
|
|
64186
|
+
return references;
|
|
64187
|
+
}
|
|
64188
|
+
function attachDelegationSkillInput(input3, skill) {
|
|
64189
|
+
if (!skill || hasDelegationSkill(input3, skill)) return null;
|
|
64190
|
+
return [...input3, { type: "skill", name: skill.name, path: skill.path }];
|
|
64191
|
+
}
|
|
64013
64192
|
function rewriteDelegationMentionInput(input3, skill) {
|
|
64014
64193
|
const mentions = [];
|
|
64015
64194
|
const seen = /* @__PURE__ */ new Set();
|
|
@@ -64035,10 +64214,9 @@ function rewriteDelegationMentionInput(input3, skill) {
|
|
|
64035
64214
|
text: appendInstruction(target2.text, mentions)
|
|
64036
64215
|
};
|
|
64037
64216
|
}
|
|
64038
|
-
|
|
64039
|
-
(
|
|
64040
|
-
|
|
64041
|
-
if (skill && !hasSkill) rewritten.push({ type: "skill", name: skill.name, path: skill.path });
|
|
64217
|
+
if (skill && !hasDelegationSkill(rewritten, skill)) {
|
|
64218
|
+
rewritten.push({ type: "skill", name: skill.name, path: skill.path });
|
|
64219
|
+
}
|
|
64042
64220
|
return rewritten;
|
|
64043
64221
|
}
|
|
64044
64222
|
|
|
@@ -72444,7 +72622,7 @@ var SingleNativeCodexAccount = class {
|
|
|
72444
72622
|
|
|
72445
72623
|
// packages/host-runtime/src/product-telemetry.ts
|
|
72446
72624
|
import { randomBytes as randomBytes7 } from "node:crypto";
|
|
72447
|
-
import { mkdir as mkdir24, readFile as readFile28, rename as rename20, rm as rm23, stat as
|
|
72625
|
+
import { mkdir as mkdir24, readFile as readFile28, rename as rename20, rm as rm23, stat as stat13, writeFile as writeFile19 } from "node:fs/promises";
|
|
72448
72626
|
import { join as join7 } from "node:path";
|
|
72449
72627
|
var TELEMETRY_STATE_FILE = "telemetry-v1.json";
|
|
72450
72628
|
var MAX_STATE_FILE_BYTES = 64 * 1024;
|
|
@@ -72550,7 +72728,7 @@ function currentUiLanguage() {
|
|
|
72550
72728
|
async function readCodexDesktopVersion(dataDir) {
|
|
72551
72729
|
const filePath2 = join7(dataDir, "diagnostics", "launcher-startup-v1.json");
|
|
72552
72730
|
try {
|
|
72553
|
-
const meta3 = await
|
|
72731
|
+
const meta3 = await stat13(filePath2);
|
|
72554
72732
|
if (!meta3.isFile() || meta3.size > MAX_STARTUP_FILE_BYTES) return void 0;
|
|
72555
72733
|
const doc = JSON.parse(await readFile28(filePath2, "utf8"));
|
|
72556
72734
|
if (!doc || typeof doc !== "object" || !Array.isArray(doc.records)) {
|
|
@@ -72846,7 +73024,7 @@ var HostProductTelemetry = class {
|
|
|
72846
73024
|
}
|
|
72847
73025
|
async #readOrCreateState() {
|
|
72848
73026
|
try {
|
|
72849
|
-
const meta3 = await
|
|
73027
|
+
const meta3 = await stat13(this.#file);
|
|
72850
73028
|
if (meta3.isFile() && meta3.size <= MAX_STATE_FILE_BYTES) {
|
|
72851
73029
|
const parsed2 = JSON.parse(await readFile28(this.#file, "utf8"));
|
|
72852
73030
|
if (parsed2 && typeof parsed2 === "object") {
|
|
@@ -75764,8 +75942,8 @@ async function allocateProjectlessWorkspace(environment, prompt, options = {}) {
|
|
|
75764
75942
|
if (!path52.isAbsolute(workspaceRoot))
|
|
75765
75943
|
throw new Error("Projectless workspace root must be absolute");
|
|
75766
75944
|
const realDirectory = async (directory2) => {
|
|
75767
|
-
const
|
|
75768
|
-
if (!
|
|
75945
|
+
const stat20 = await lstat14(directory2);
|
|
75946
|
+
if (!stat20.isDirectory() || stat20.isSymbolicLink())
|
|
75769
75947
|
throw new Error("Projectless workspace must be a real directory");
|
|
75770
75948
|
};
|
|
75771
75949
|
await mkdir25(workspaceRoot, { recursive: true, mode: 448 });
|
|
@@ -76277,7 +76455,7 @@ var ClientChannelHost = class {
|
|
|
76277
76455
|
};
|
|
76278
76456
|
|
|
76279
76457
|
// packages/host-runtime/src/host-extension-manager.ts
|
|
76280
|
-
import { stat as
|
|
76458
|
+
import { stat as stat14 } from "node:fs/promises";
|
|
76281
76459
|
import { pathToFileURL as pathToFileURL2 } from "node:url";
|
|
76282
76460
|
|
|
76283
76461
|
// packages/extension-backend/dist/index.js
|
|
@@ -77097,6 +77275,24 @@ var HostExtensionManager = class {
|
|
|
77097
77275
|
});
|
|
77098
77276
|
return { mimeType, base64: bytes2.toString("base64") };
|
|
77099
77277
|
}
|
|
77278
|
+
async catalogScreenshot(input3) {
|
|
77279
|
+
const catalog = await fetchHostExtensionCatalog({
|
|
77280
|
+
dataDir: this.dataDir,
|
|
77281
|
+
staleWhileRevalidate: true,
|
|
77282
|
+
fallbackToCache: true
|
|
77283
|
+
});
|
|
77284
|
+
const entry = catalog.extensions.find((item) => item.id === input3.id);
|
|
77285
|
+
const screenshotUrl = entry?.screenshots?.[input3.index];
|
|
77286
|
+
if (!screenshotUrl) {
|
|
77287
|
+
throw new Error("Extension screenshot is not available");
|
|
77288
|
+
}
|
|
77289
|
+
const { mimeType, bytes: bytes2 } = await fetchCachedCatalogScreenshot({
|
|
77290
|
+
dataDir: this.dataDir,
|
|
77291
|
+
screenshotUrl,
|
|
77292
|
+
signal: this.#closeController.signal
|
|
77293
|
+
});
|
|
77294
|
+
return { mimeType, base64: bytes2.toString("base64") };
|
|
77295
|
+
}
|
|
77100
77296
|
install({ source }) {
|
|
77101
77297
|
return this.#trackInFlight(async () => {
|
|
77102
77298
|
await this.start();
|
|
@@ -77437,7 +77633,7 @@ var HostExtensionManager = class {
|
|
|
77437
77633
|
const entry = await readHostExtensionBackend({ ...location, digest: digest2 });
|
|
77438
77634
|
if (!entry) throw new Error("Missing backend entry");
|
|
77439
77635
|
const dataDir = await hostExtensionDataDirectory(location, true);
|
|
77440
|
-
const info = await
|
|
77636
|
+
const info = await stat14(entry.directory, { bigint: true });
|
|
77441
77637
|
if (this.#closing) return true;
|
|
77442
77638
|
const readActivity = this.services.readActivity;
|
|
77443
77639
|
const process4 = new ExtensionBackendProcess({
|
|
@@ -77944,6 +78140,8 @@ async function dispatch(manager, method, input3) {
|
|
|
77944
78140
|
return manager.catalog(params(method, input3));
|
|
77945
78141
|
case HOST_EXTENSIONS_RPC.catalogIcon:
|
|
77946
78142
|
return manager.catalogIcon(params(method, input3));
|
|
78143
|
+
case HOST_EXTENSIONS_RPC.catalogScreenshot:
|
|
78144
|
+
return manager.catalogScreenshot(params(method, input3));
|
|
77947
78145
|
case HOST_EXTENSIONS_RPC.install:
|
|
77948
78146
|
case HOST_EXTENSIONS_RPC.update: {
|
|
77949
78147
|
const { source } = params(method, input3);
|
|
@@ -80447,6 +80645,21 @@ function sandboxResult(params2) {
|
|
|
80447
80645
|
excludeSlashTmp: false
|
|
80448
80646
|
};
|
|
80449
80647
|
}
|
|
80648
|
+
var EXTERNAL_THREAD_REF_SHARED_LOOKUP_TIMEOUT_MS = 300;
|
|
80649
|
+
async function withOptionalTimeout(promise2, timeoutMs) {
|
|
80650
|
+
let timer;
|
|
80651
|
+
try {
|
|
80652
|
+
return await Promise.race([
|
|
80653
|
+
promise2.catch(() => null),
|
|
80654
|
+
new Promise((resolve3) => {
|
|
80655
|
+
timer = setTimeout(() => resolve3(null), timeoutMs);
|
|
80656
|
+
timer.unref?.();
|
|
80657
|
+
})
|
|
80658
|
+
]);
|
|
80659
|
+
} finally {
|
|
80660
|
+
if (timer !== void 0) clearTimeout(timer);
|
|
80661
|
+
}
|
|
80662
|
+
}
|
|
80450
80663
|
function turnProjectionGate() {
|
|
80451
80664
|
let resolve3 = () => void 0;
|
|
80452
80665
|
const promise2 = new Promise((complete) => {
|
|
@@ -81965,23 +82178,76 @@ var AppServerHost = class {
|
|
|
81965
82178
|
await this.#rewriteOfficialDelegationMentions(request, frame)
|
|
81966
82179
|
);
|
|
81967
82180
|
}
|
|
81968
|
-
/**
|
|
82181
|
+
/**
|
|
82182
|
+
* Native Codex Turns: turn `#` delegation chips into an explicit Skill-backed request,
|
|
82183
|
+
* and attach the managed delegation Skill (without altering user text or mention items)
|
|
82184
|
+
* when a `thread://` reference points to a known external Harness Thread.
|
|
82185
|
+
*/
|
|
81969
82186
|
async #rewriteOfficialDelegationMentions(request, frame) {
|
|
81970
82187
|
if (request.method !== "turn/start" && request.method !== "turn/steer") return frame;
|
|
81971
82188
|
if (!isRecord25(request.params) || !Array.isArray(request.params.input)) return frame;
|
|
81972
82189
|
const input3 = request.params.input;
|
|
81973
|
-
|
|
82190
|
+
const hasDelegationMention = input3.some(
|
|
81974
82191
|
(item) => isRecord25(item) && typeof item.text === "string" && item.text.includes(DELEGATION_MENTION_PATH_PREFIX)
|
|
81975
|
-
)
|
|
81976
|
-
|
|
82192
|
+
);
|
|
82193
|
+
const threadReferences = extractThreadReferencesFromInput(input3);
|
|
82194
|
+
if (!hasDelegationMention && threadReferences.length === 0) return frame;
|
|
82195
|
+
let cachedSkill;
|
|
82196
|
+
const readSkill = async () => {
|
|
82197
|
+
if (cachedSkill === void 0) {
|
|
82198
|
+
cachedSkill = await managedDelegationSkillReference(
|
|
82199
|
+
this.#options.environment ? { environment: this.#options.environment } : {}
|
|
82200
|
+
);
|
|
82201
|
+
}
|
|
82202
|
+
return cachedSkill;
|
|
82203
|
+
};
|
|
82204
|
+
let rewritten = hasDelegationMention ? rewriteDelegationMentionInput(input3, await readSkill()) : null;
|
|
82205
|
+
const currentInput = rewritten ?? input3;
|
|
82206
|
+
if (threadReferences.length > 0 && await this.#referencesKnownExternalThread(request.method, request.params, threadReferences)) {
|
|
82207
|
+
const withSkill = attachDelegationSkillInput(currentInput, await readSkill());
|
|
82208
|
+
if (withSkill) rewritten = withSkill;
|
|
81977
82209
|
}
|
|
81978
|
-
const rewritten = rewriteDelegationMentionInput(input3, await managedDelegationSkillReference());
|
|
81979
82210
|
if (!rewritten) return frame;
|
|
81980
82211
|
return encodeJsonFrame({
|
|
81981
82212
|
...request,
|
|
81982
82213
|
params: { ...request.params, input: rewritten }
|
|
81983
82214
|
});
|
|
81984
82215
|
}
|
|
82216
|
+
async #referencesKnownExternalThread(method, params2, references) {
|
|
82217
|
+
const sourceHostId = threadReferenceSourceHost(params2) ?? (method === "turn/steer" && typeof params2.threadId === "string" ? this.#officialRuntimeScope.owner.executionHostId(params2.threadId) : void 0);
|
|
82218
|
+
const candidateIds = [];
|
|
82219
|
+
const seen = /* @__PURE__ */ new Set();
|
|
82220
|
+
for (const ref of references) {
|
|
82221
|
+
const matchesHost = ref.hostId === void 0 || ref.hostId === "local" || sourceHostId !== void 0 && ref.hostId === sourceHostId;
|
|
82222
|
+
if (!matchesHost || seen.has(ref.threadId)) continue;
|
|
82223
|
+
seen.add(ref.threadId);
|
|
82224
|
+
candidateIds.push(ref.threadId);
|
|
82225
|
+
}
|
|
82226
|
+
if (candidateIds.length === 0) return false;
|
|
82227
|
+
return this.#hasKnownExternalThread(candidateIds);
|
|
82228
|
+
}
|
|
82229
|
+
async #hasKnownExternalThread(threadIds) {
|
|
82230
|
+
const remaining = [];
|
|
82231
|
+
for (const threadId2 of threadIds) {
|
|
82232
|
+
if (this.#externalRuntime.get(threadId2) !== void 0) return true;
|
|
82233
|
+
if (this.#options.sharedThreads?.knowsTreeOwner(threadId2)) return true;
|
|
82234
|
+
remaining.push(threadId2);
|
|
82235
|
+
}
|
|
82236
|
+
for (const threadId2 of remaining) {
|
|
82237
|
+
try {
|
|
82238
|
+
const record7 = await this.#repository.find(threadId2);
|
|
82239
|
+
if (record7 !== null && record7.harnessId !== "codex") return true;
|
|
82240
|
+
} catch {
|
|
82241
|
+
}
|
|
82242
|
+
}
|
|
82243
|
+
const shared = this.#options.sharedThreads;
|
|
82244
|
+
if (!shared) return false;
|
|
82245
|
+
const owners = await withOptionalTimeout(
|
|
82246
|
+
shared.ownership(remaining),
|
|
82247
|
+
EXTERNAL_THREAD_REF_SHARED_LOOKUP_TIMEOUT_MS
|
|
82248
|
+
);
|
|
82249
|
+
return owners !== null && owners.size > 0;
|
|
82250
|
+
}
|
|
81985
82251
|
async #forwardOfficialNonRequest(value2, frame) {
|
|
81986
82252
|
if (this.#options.externalOnly) return;
|
|
81987
82253
|
const response = isRecord25(value2) ? value2 : null;
|
|
@@ -88385,7 +88651,7 @@ function createRemoteAppServerWebSocketListener(input3) {
|
|
|
88385
88651
|
// packages/host-runtime/src/remote-official-app-server.ts
|
|
88386
88652
|
import { spawn as spawn8 } from "node:child_process";
|
|
88387
88653
|
import { randomUUID as randomUUID41 } from "node:crypto";
|
|
88388
|
-
import { lstat as lstat17, rm as rm28, stat as
|
|
88654
|
+
import { lstat as lstat17, rm as rm28, stat as stat15 } from "node:fs/promises";
|
|
88389
88655
|
import path59 from "node:path";
|
|
88390
88656
|
var DEFAULT_CLOSE_TIMEOUT_MS = 2e3;
|
|
88391
88657
|
var DEFAULT_LISTEN_TIMEOUT_MS = 1e4;
|
|
@@ -88416,7 +88682,7 @@ async function inspectSocket(socketPath) {
|
|
|
88416
88682
|
`Shared official app-server link must belong to the current user: ${socketPath}`
|
|
88417
88683
|
);
|
|
88418
88684
|
}
|
|
88419
|
-
const target2 = await
|
|
88685
|
+
const target2 = await stat15(socketPath).catch((error62) => {
|
|
88420
88686
|
if (error62.code === "ENOENT") return null;
|
|
88421
88687
|
throw error62;
|
|
88422
88688
|
});
|
|
@@ -91758,7 +92024,7 @@ function externalClientEventStream(events, clients) {
|
|
|
91758
92024
|
|
|
91759
92025
|
// packages/host-runtime/src/host-inventory.ts
|
|
91760
92026
|
import { execFile as execFile9 } from "node:child_process";
|
|
91761
|
-
import { readFile as readFile37, stat as
|
|
92027
|
+
import { readFile as readFile37, stat as stat16 } from "node:fs/promises";
|
|
91762
92028
|
import os13 from "node:os";
|
|
91763
92029
|
import path69 from "node:path";
|
|
91764
92030
|
|
|
@@ -91983,7 +92249,7 @@ function integer4(value2, name, fallback, maximum) {
|
|
|
91983
92249
|
return result;
|
|
91984
92250
|
}
|
|
91985
92251
|
async function directory(file2) {
|
|
91986
|
-
return
|
|
92252
|
+
return stat16(file2).then(
|
|
91987
92253
|
(info) => info.isDirectory(),
|
|
91988
92254
|
() => false
|
|
91989
92255
|
);
|
|
@@ -94275,7 +94541,7 @@ function shiftUsageDate(date5, days) {
|
|
|
94275
94541
|
|
|
94276
94542
|
// packages/host-runtime/src/usage-statistics-store.ts
|
|
94277
94543
|
import { randomUUID as randomUUID47 } from "node:crypto";
|
|
94278
|
-
import { mkdir as mkdir36, open as open26, rename as rename28, rm as rm34, stat as
|
|
94544
|
+
import { mkdir as mkdir36, open as open26, rename as rename28, rm as rm34, stat as stat17 } from "node:fs/promises";
|
|
94279
94545
|
import { createRequire } from "node:module";
|
|
94280
94546
|
import path77 from "node:path";
|
|
94281
94547
|
var USAGE_CACHE_VERSION = 9;
|
|
@@ -94791,7 +95057,7 @@ async function persistHarnessCacheSerial(filePath2, cache2, nowMs) {
|
|
|
94791
95057
|
for (let pass = 0; pass < 4 && cache2.dirty; pass += 1) {
|
|
94792
95058
|
const rebuilding = !cache2.persistedOnDisk;
|
|
94793
95059
|
if (!rebuilding) {
|
|
94794
|
-
const info = await
|
|
95060
|
+
const info = await stat17(filePath2);
|
|
94795
95061
|
if (!info.isFile()) {
|
|
94796
95062
|
throw new Error(`Cache path is not a regular file: ${filePath2}`);
|
|
94797
95063
|
}
|
|
@@ -95809,7 +96075,7 @@ async function prepareDelegationRuntime(input3) {
|
|
|
95809
96075
|
[DELEGATION_RUNTIME_ENDPOINT_ENV]: server.endpoint,
|
|
95810
96076
|
[DELEGATION_RUNTIME_TOKEN_ENV]: token
|
|
95811
96077
|
};
|
|
95812
|
-
await installDelegationSkills().then((results) => {
|
|
96078
|
+
await installDelegationSkills({ environment: input3.environment }).then((results) => {
|
|
95813
96079
|
for (const result of results) {
|
|
95814
96080
|
if (result.status === "conflict") {
|
|
95815
96081
|
process.stderr.write(
|
|
@@ -96626,7 +96892,7 @@ import {
|
|
|
96626
96892
|
rename as rename30,
|
|
96627
96893
|
rm as rm37,
|
|
96628
96894
|
rmdir as rmdir3,
|
|
96629
|
-
stat as
|
|
96895
|
+
stat as stat18,
|
|
96630
96896
|
writeFile as writeFile28
|
|
96631
96897
|
} from "node:fs/promises";
|
|
96632
96898
|
import path83 from "node:path";
|
|
@@ -96679,7 +96945,7 @@ async function fileSha256(filePath2) {
|
|
|
96679
96945
|
async function executable(filePath2, label) {
|
|
96680
96946
|
const absolute2 = path83.resolve(filePath2);
|
|
96681
96947
|
try {
|
|
96682
|
-
if (!(await
|
|
96948
|
+
if (!(await stat18(absolute2)).isFile()) throw new Error("not a regular file");
|
|
96683
96949
|
await access4(absolute2, fsConstants.X_OK);
|
|
96684
96950
|
} catch {
|
|
96685
96951
|
throw new Error(`${label} is not an executable file: ${absolute2}`);
|
|
@@ -96689,7 +96955,7 @@ async function executable(filePath2, label) {
|
|
|
96689
96955
|
async function existingFile(filePath2, label) {
|
|
96690
96956
|
const absolute2 = path83.resolve(filePath2);
|
|
96691
96957
|
try {
|
|
96692
|
-
const metadata2 = await
|
|
96958
|
+
const metadata2 = await stat18(absolute2);
|
|
96693
96959
|
if (!metadata2.isFile()) throw new Error("not a regular file");
|
|
96694
96960
|
} catch {
|
|
96695
96961
|
throw new Error(`${label} is not a regular file: ${absolute2}`);
|
|
@@ -96877,7 +97143,7 @@ async function readManifest(filePath2) {
|
|
|
96877
97143
|
async function backupProfile(profilePath, contents, action) {
|
|
96878
97144
|
const timestamp = (/* @__PURE__ */ new Date()).toISOString().replaceAll(/[-:.TZ]/gu, "");
|
|
96879
97145
|
const backupPath = `${profilePath}.codexhost-${action}-${timestamp}.bak`;
|
|
96880
|
-
const metadata2 = await
|
|
97146
|
+
const metadata2 = await stat18(profilePath).catch(() => null);
|
|
96881
97147
|
await writeAtomic(backupPath, contents, metadata2?.mode ?? 384);
|
|
96882
97148
|
return backupPath;
|
|
96883
97149
|
}
|
|
@@ -96901,7 +97167,7 @@ async function installRemoteHost(options) {
|
|
|
96901
97167
|
}
|
|
96902
97168
|
const previousManifestFile = previousManifest ? {
|
|
96903
97169
|
contents: await readFile38(paths.manifestPath),
|
|
96904
|
-
mode: (await
|
|
97170
|
+
mode: (await stat18(paths.manifestPath)).mode & 511
|
|
96905
97171
|
} : null;
|
|
96906
97172
|
const existingEntrypoint = await lstat20(paths.wrapperPath).catch(
|
|
96907
97173
|
(error62) => {
|
|
@@ -96969,7 +97235,7 @@ async function installRemoteHost(options) {
|
|
|
96969
97235
|
const existingProfile = existingProfileSource ?? "";
|
|
96970
97236
|
const nextProfile = installManagedProfileBlock(existingProfile, manifest);
|
|
96971
97237
|
const profileChanged = nextProfile !== existingProfile;
|
|
96972
|
-
const profileMetadata = await
|
|
97238
|
+
const profileMetadata = await stat18(profilePath).catch(() => null);
|
|
96973
97239
|
try {
|
|
96974
97240
|
if (profileChanged) {
|
|
96975
97241
|
const profileBackupPath = await backupProfile(profilePath, existingProfile, "install");
|
|
@@ -97060,7 +97326,7 @@ async function inspectRemoteHostInstallation(options) {
|
|
|
97060
97326
|
if (!profileMatches && profileIssue === null)
|
|
97061
97327
|
profileIssue = "shell profile does not configure the managed native entrypoint";
|
|
97062
97328
|
if (profileIssue !== null) issues.push(profileIssue);
|
|
97063
|
-
const dataDirectory = await
|
|
97329
|
+
const dataDirectory = await stat18(manifest.dataDirectory).catch(() => null);
|
|
97064
97330
|
if (!dataDirectory?.isDirectory()) issues.push("remote Host data directory is unavailable");
|
|
97065
97331
|
for (const [label, filePath2, requiresExecutable] of [
|
|
97066
97332
|
["stock Codex", manifest.stockCodexPath, true],
|
|
@@ -97070,7 +97336,7 @@ async function inspectRemoteHostInstallation(options) {
|
|
|
97070
97336
|
]) {
|
|
97071
97337
|
try {
|
|
97072
97338
|
if (requiresExecutable) await executable(filePath2, label);
|
|
97073
|
-
else if (!(await
|
|
97339
|
+
else if (!(await stat18(filePath2)).isFile()) throw new Error("not a regular file");
|
|
97074
97340
|
} catch {
|
|
97075
97341
|
issues.push(`${label} is unavailable`);
|
|
97076
97342
|
}
|
|
@@ -97099,7 +97365,7 @@ async function uninstallRemoteHost(options) {
|
|
|
97099
97365
|
const nextProfile = removeManagedProfileBlock(profile);
|
|
97100
97366
|
if (nextProfile !== profile) {
|
|
97101
97367
|
await backupProfile(manifest.profilePath, profile, "uninstall");
|
|
97102
|
-
const metadata2 = await
|
|
97368
|
+
const metadata2 = await stat18(manifest.profilePath).catch(() => null);
|
|
97103
97369
|
await writeAtomic(manifest.profilePath, nextProfile, metadata2?.mode ?? 384);
|
|
97104
97370
|
}
|
|
97105
97371
|
await rm37(manifest.wrapperPath, { force: true });
|
|
@@ -97114,7 +97380,7 @@ async function uninstallRemoteHost(options) {
|
|
|
97114
97380
|
|
|
97115
97381
|
// packages/host-runtime/src/remote-host-lifecycle.ts
|
|
97116
97382
|
import { spawn as spawn12 } from "node:child_process";
|
|
97117
|
-
import { stat as
|
|
97383
|
+
import { stat as stat19 } from "node:fs/promises";
|
|
97118
97384
|
import net3 from "node:net";
|
|
97119
97385
|
import path84 from "node:path";
|
|
97120
97386
|
import { Duplex } from "node:stream";
|
|
@@ -97140,7 +97406,7 @@ function socketPathFor(environment) {
|
|
|
97140
97406
|
return path84.join(codexHome, "app-server-control", "app-server-control.sock");
|
|
97141
97407
|
}
|
|
97142
97408
|
async function defaultSocketExists(socketPath) {
|
|
97143
|
-
const metadata2 = await
|
|
97409
|
+
const metadata2 = await stat19(socketPath).catch((error62) => {
|
|
97144
97410
|
if (error62.code === "ENOENT") return null;
|
|
97145
97411
|
throw error62;
|
|
97146
97412
|
});
|