@moxt-ai/cli 0.11.0-beta.8 → 0.11.0-beta.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +34 -8
- package/dist/index.cjs.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -9395,6 +9395,7 @@ var init_local_file_source = __esm({
|
|
|
9395
9395
|
import_promises12 = require("fs/promises");
|
|
9396
9396
|
import_node_path9 = require("path");
|
|
9397
9397
|
import_ignore = __toESM(require_ignore(), 1);
|
|
9398
|
+
init_image_viewer();
|
|
9398
9399
|
maximumReadBytes = 5 * 1024 * 1024;
|
|
9399
9400
|
defaultPageSize = 100;
|
|
9400
9401
|
maximumPageSize = 200;
|
|
@@ -9501,6 +9502,15 @@ var init_local_file_source = __esm({
|
|
|
9501
9502
|
...kind === "file" ? { size: stat6.size } : {}
|
|
9502
9503
|
};
|
|
9503
9504
|
}
|
|
9505
|
+
async validateImage(path4) {
|
|
9506
|
+
const entry = await this.validate(path4, "file");
|
|
9507
|
+
if (entry.size === void 0 || entry.size > maximumReadBytes) {
|
|
9508
|
+
throw new Error(`Local image exceeds the ${maximumReadBytes}-byte limit`);
|
|
9509
|
+
}
|
|
9510
|
+
const target = await this.resolveFile(path4);
|
|
9511
|
+
detectSupportedImageType(await (0, import_promises12.readFile)(target));
|
|
9512
|
+
return entry;
|
|
9513
|
+
}
|
|
9504
9514
|
async resolveDirectory(path4) {
|
|
9505
9515
|
const absolute = resolveWithin(this.workingDirectory, path4);
|
|
9506
9516
|
const directStat = await (0, import_promises12.lstat)(absolute);
|
|
@@ -10495,15 +10505,23 @@ async function toCodexInput(items, pairedRoot, relativeWorkingDirectory) {
|
|
|
10495
10505
|
};
|
|
10496
10506
|
}
|
|
10497
10507
|
if (item.itemType === "image") {
|
|
10508
|
+
const url = optionalString3(payload.url).value;
|
|
10509
|
+
if (url === void 0 || !isSecureImageUrl(url)) {
|
|
10510
|
+
throw new Error("Remote image input requires a valid HTTPS URL");
|
|
10511
|
+
}
|
|
10498
10512
|
return {
|
|
10499
10513
|
type: "image",
|
|
10500
|
-
url
|
|
10514
|
+
url
|
|
10501
10515
|
};
|
|
10502
10516
|
}
|
|
10503
10517
|
if (item.itemType === "local_image") {
|
|
10518
|
+
const path4 = optionalString3(payload.path).value;
|
|
10519
|
+
if (path4 === void 0)
|
|
10520
|
+
throw new Error("Local image input has no path");
|
|
10521
|
+
await source.validateImage(path4);
|
|
10504
10522
|
return {
|
|
10505
10523
|
type: "localImage",
|
|
10506
|
-
path:
|
|
10524
|
+
path: path4
|
|
10507
10525
|
};
|
|
10508
10526
|
}
|
|
10509
10527
|
if (item.itemType === "local_file") {
|
|
@@ -10521,6 +10539,14 @@ async function toCodexInput(items, pairedRoot, relativeWorkingDirectory) {
|
|
|
10521
10539
|
throw new Error(`Unsupported Local Codex input ${item.itemType}`);
|
|
10522
10540
|
}));
|
|
10523
10541
|
}
|
|
10542
|
+
function isSecureImageUrl(value) {
|
|
10543
|
+
try {
|
|
10544
|
+
const url = new URL(value);
|
|
10545
|
+
return url.protocol === "https:" && url.username === "" && url.password === "" && url.hostname !== "";
|
|
10546
|
+
} catch {
|
|
10547
|
+
return false;
|
|
10548
|
+
}
|
|
10549
|
+
}
|
|
10524
10550
|
function localCodexInputItems(value) {
|
|
10525
10551
|
if (!Array.isArray(value)) {
|
|
10526
10552
|
return [];
|
|
@@ -16505,7 +16531,7 @@ function getApiKeyOrUndefined() {
|
|
|
16505
16531
|
|
|
16506
16532
|
// src/utils/http.ts
|
|
16507
16533
|
function getUserAgent() {
|
|
16508
|
-
return `moxt-cli/${"0.11.0-beta.
|
|
16534
|
+
return `moxt-cli/${"0.11.0-beta.9"} (${(0, import_os.platform)()}/${(0, import_os.arch)()}) node/${process.versions.node}`;
|
|
16509
16535
|
}
|
|
16510
16536
|
async function sendRequest(method, path4, init) {
|
|
16511
16537
|
return await fetch(`${getApiBaseUrl()}${path4}`, {
|
|
@@ -31091,7 +31117,7 @@ var FLUSH_TIMEOUT_MS = 3e3;
|
|
|
31091
31117
|
var MAX_BATCH_SIZE = 100;
|
|
31092
31118
|
function commonLabels() {
|
|
31093
31119
|
return {
|
|
31094
|
-
cli_version: "0.11.0-beta.
|
|
31120
|
+
cli_version: "0.11.0-beta.9",
|
|
31095
31121
|
node_version: process.versions.node,
|
|
31096
31122
|
os: (0, import_node_os11.platform)(),
|
|
31097
31123
|
arch: (0, import_node_os11.arch)(),
|
|
@@ -31137,7 +31163,7 @@ async function flush() {
|
|
|
31137
31163
|
}
|
|
31138
31164
|
const batch = buffer.splice(0, MAX_BATCH_SIZE);
|
|
31139
31165
|
const payload = {
|
|
31140
|
-
release_id: "0.11.0-beta.
|
|
31166
|
+
release_id: "0.11.0-beta.9",
|
|
31141
31167
|
client_type: "cli",
|
|
31142
31168
|
metric_data_list: batch.map((m) => ({
|
|
31143
31169
|
profile: "cli",
|
|
@@ -31520,9 +31546,9 @@ function commandPath3(command) {
|
|
|
31520
31546
|
}
|
|
31521
31547
|
|
|
31522
31548
|
// src/index.ts
|
|
31523
|
-
var program2 = createProgram("0.11.0-beta.
|
|
31524
|
-
installDaemonReconcileHook(program2, "0.11.0-beta.
|
|
31525
|
-
installUpdateHook(program2, "0.11.0-beta.
|
|
31549
|
+
var program2 = createProgram("0.11.0-beta.9");
|
|
31550
|
+
installDaemonReconcileHook(program2, "0.11.0-beta.9");
|
|
31551
|
+
installUpdateHook(program2, "0.11.0-beta.9");
|
|
31526
31552
|
instrumentProgram(program2);
|
|
31527
31553
|
installExitHandler();
|
|
31528
31554
|
program2.parseAsync(process.argv).then(async () => {
|