@moxxy/cli 0.37.1 → 0.37.2
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/bin.js +102 -59
- package/package.json +2 -2
package/dist/bin.js
CHANGED
|
@@ -5,7 +5,7 @@ import * as fs35 from 'fs';
|
|
|
5
5
|
import fs35__default, { promises, readFileSync, existsSync, mkdirSync, writeFileSync, rmSync, openSync, closeSync, unlinkSync, renameSync, statSync, readdirSync, realpathSync, constants as constants$1, lstatSync, watch } from 'fs';
|
|
6
6
|
import * as path3 from 'path';
|
|
7
7
|
import path3__default, { join, dirname, resolve, relative, isAbsolute, posix, sep } from 'path';
|
|
8
|
-
import { ensurePrivateDir, moxxyHome, pruneStaleTempFiles, moxxyPath, hasProxy, installEgressProxy, readProxyEnv, writeFileAtomic, ensurePrivateFile, resolveChannelToken, rotateChannelToken, liveChannelStatus, spawnDedicatedChannel, stopDedicatedChannel, clearChannelStatus, MOXXY_WS_SUBPROTOCOL, bearerTokenMatches, PRIVATE_FILE_MODE, bearerGuard, tokenFromWsProtocolHeader, resolveOsPrincipal, redactProxyUrl, listLiveChannelStatuses, CrossProcessFireLock, writeChannelStatus,
|
|
8
|
+
import { ensurePrivateDir, moxxyHome, pruneStaleTempFiles, moxxyPath, hasProxy, installEgressProxy, readProxyEnv, writeFileAtomic, ensurePrivateFile, resolveChannelToken, rotateChannelToken, liveChannelStatus, spawnDedicatedChannel, stopDedicatedChannel, clearChannelStatus, MOXXY_WS_SUBPROTOCOL, bearerTokenMatches, PRIVATE_FILE_MODE, bearerGuard, tokenFromWsProtocolHeader, resolveOsPrincipal, redactProxyUrl, listLiveChannelStatuses, writeSignedNetworkCacheAtomic, CrossProcessFireLock, writeChannelStatus, writeBoundedNetworkCacheAtomicSync, writeBoundedDataCacheAtomic, readRequestBody } from '@moxxy/sdk/server';
|
|
9
9
|
import { spawn, execFile, spawnSync } from 'child_process';
|
|
10
10
|
import { fileURLToPath, pathToFileURL } from 'url';
|
|
11
11
|
import { MoxxyError, createMutex, defineMode, definePlugin, defineChannel, defineViewRenderer, DEFAULT_VIEW_TAGS, defineTunnelProvider, defineAuditExporter, defineAuditSink, z as z$1, defineTool, defineCommand, defineEmbedder, asPluginId, runReactLoop, createDeferredPermissionResolver, isSafeViewUrl, redactSecrets, asTurnId, defineCompactor, abortError, activeCompactionRanges, defineCacheStrategy, denyByDefaultResolver, runManualCompaction, assertDefined, defineWorkflowExecutor, MOXXY_PCM16_24KHZ_MIME, isFileDiffDisplay, summarizeWithProvider, toolResultBytes, isSelectableMode, summarizeSessionTokensFromEvents, summarizeTokensByModel, getInstallHint, toDiffRows, diffGutterNo, fileDiffVerb, fileDiffSummary, computeElisionState, toolResultStubbed, toolResultStub, conversationalStubbed, conversationalStub, isFirstPartyPackage, REDACTED_PLACEHOLDER, isSecretKey, addModelTotals, skillFrontmatterSchema, asSkillId, parseFrontmatter, createCallbackResolver, createAllowListResolver, countNodes, autoAllowResolver, SESSION_SOURCES, startChannelWith, EXIT_AFTER_PAIR_FLAG, renderFrontmatter, formatPrincipal, aggregateCapabilitySpecs, hostCredentialName, moxxyPackageSchema, auditActionOf, verifyEd25519, defineSecretProvider, redactSecretText, encodeLoginPrompt, ISOLATION_RANK, sleepWithAbort, asSessionId, migrateModeName, asToolCallId, parseFrontmatterFile, createJsonFileStore, evaluateToolRule, asEventId } from '@moxxy/sdk';
|
|
@@ -13221,25 +13221,26 @@ function hasPath(obj, segments) {
|
|
|
13221
13221
|
}
|
|
13222
13222
|
return true;
|
|
13223
13223
|
}
|
|
13224
|
-
function
|
|
13224
|
+
function withoutPath(obj, segments) {
|
|
13225
13225
|
const [head2, ...rest] = segments;
|
|
13226
13226
|
if (head2 === void 0)
|
|
13227
|
-
return;
|
|
13228
|
-
|
|
13229
|
-
|
|
13230
|
-
|
|
13231
|
-
|
|
13232
|
-
|
|
13233
|
-
|
|
13234
|
-
|
|
13235
|
-
|
|
13236
|
-
|
|
13237
|
-
|
|
13227
|
+
return { ...obj };
|
|
13228
|
+
return Object.fromEntries(Object.entries(obj).flatMap(([key, value2]) => {
|
|
13229
|
+
if (key !== head2)
|
|
13230
|
+
return [[key, value2]];
|
|
13231
|
+
if (rest.length === 0)
|
|
13232
|
+
return [];
|
|
13233
|
+
if (value2 === null || typeof value2 !== "object" || Array.isArray(value2)) {
|
|
13234
|
+
return [[key, value2]];
|
|
13235
|
+
}
|
|
13236
|
+
const child = withoutPath(value2, rest);
|
|
13237
|
+
return Object.keys(child).length === 0 ? [] : [[key, child]];
|
|
13238
|
+
}));
|
|
13238
13239
|
}
|
|
13239
13240
|
function stripLockedKeys(config, locked, scope) {
|
|
13240
13241
|
if (locked.length === 0)
|
|
13241
13242
|
return { config, overrides: [] };
|
|
13242
|
-
|
|
13243
|
+
let clone = structuredClone(config);
|
|
13243
13244
|
const overrides = [];
|
|
13244
13245
|
for (const key of locked) {
|
|
13245
13246
|
const segments = key.split(".").filter((s) => s.length > 0);
|
|
@@ -13248,7 +13249,7 @@ function stripLockedKeys(config, locked, scope) {
|
|
|
13248
13249
|
if (!hasPath(clone, segments))
|
|
13249
13250
|
continue;
|
|
13250
13251
|
overrides.push({ key, scope });
|
|
13251
|
-
|
|
13252
|
+
clone = withoutPath(clone, segments);
|
|
13252
13253
|
}
|
|
13253
13254
|
return { config: clone, overrides };
|
|
13254
13255
|
}
|
|
@@ -21279,15 +21280,16 @@ async function loadPolicyBundles(refs, opts = {}) {
|
|
|
21279
21280
|
for (const ref of refs) {
|
|
21280
21281
|
const cachePath = cacheFileFor(cacheDir, ref.url);
|
|
21281
21282
|
const remote = await fetchBundle(ref, opts);
|
|
21282
|
-
let bundle
|
|
21283
|
+
let bundle;
|
|
21283
21284
|
let from = "remote";
|
|
21284
21285
|
let staleReason;
|
|
21285
|
-
if (
|
|
21286
|
-
|
|
21286
|
+
if (remote.kind === "verified") {
|
|
21287
|
+
bundle = remote.bundle;
|
|
21288
|
+
await writeSignedNetworkCacheAtomic(cachePath, remote.bytes, remote.sig, ref.publicKey).catch(() => void 0);
|
|
21287
21289
|
} else {
|
|
21288
21290
|
const cached = await readVerifiedCache(cachePath, ref);
|
|
21289
21291
|
if (!cached)
|
|
21290
|
-
throw new PolicyLoadError(ref.url, remote.reason
|
|
21292
|
+
throw new PolicyLoadError(ref.url, remote.reason);
|
|
21291
21293
|
bundle = cached;
|
|
21292
21294
|
from = "cache";
|
|
21293
21295
|
staleReason = remote.reason;
|
|
@@ -21307,7 +21309,7 @@ async function loadPolicyBundles(refs, opts = {}) {
|
|
|
21307
21309
|
async function fetchBundle(ref, opts) {
|
|
21308
21310
|
const fetchImpl = opts.fetch ?? globalThis.fetch;
|
|
21309
21311
|
if (!fetchImpl)
|
|
21310
|
-
return { reason: "no fetch implementation available" };
|
|
21312
|
+
return { kind: "unavailable", reason: "no fetch implementation available" };
|
|
21311
21313
|
const deadline = AbortSignal.timeout(FETCH_TIMEOUT_MS);
|
|
21312
21314
|
let bytes;
|
|
21313
21315
|
let sig;
|
|
@@ -21317,31 +21319,30 @@ async function fetchBundle(ref, opts) {
|
|
|
21317
21319
|
fetchImpl(`${ref.url}.sig`, { signal: deadline })
|
|
21318
21320
|
]);
|
|
21319
21321
|
if (!bodyRes.ok || !sigRes.ok) {
|
|
21320
|
-
return { reason: `http ${bodyRes.status} / sig ${sigRes.status}` };
|
|
21322
|
+
return { kind: "unavailable", reason: `http ${bodyRes.status} / sig ${sigRes.status}` };
|
|
21321
21323
|
}
|
|
21322
21324
|
bytes = new Uint8Array(await bodyRes.arrayBuffer());
|
|
21323
21325
|
sig = (await sigRes.text()).trim();
|
|
21324
21326
|
} catch (err) {
|
|
21325
|
-
if (deadline.aborted)
|
|
21326
|
-
return { reason: `fetch exceeded ${FETCH_TIMEOUT_MS}ms` };
|
|
21327
|
-
|
|
21327
|
+
if (deadline.aborted) {
|
|
21328
|
+
return { kind: "unavailable", reason: `fetch exceeded ${FETCH_TIMEOUT_MS}ms` };
|
|
21329
|
+
}
|
|
21330
|
+
return { kind: "unavailable", reason: err instanceof Error ? err.message : String(err) };
|
|
21328
21331
|
}
|
|
21329
21332
|
const result = verifyPolicyBundle(bytes, sig, ref.publicKey, ref.id);
|
|
21330
21333
|
if (!result.ok || !result.bundle) {
|
|
21331
21334
|
throw new PolicyLoadError(ref.url, `${result.failure}: ${result.detail ?? ""}`.trim());
|
|
21332
21335
|
}
|
|
21333
|
-
return { bundle: result.bundle, bytes, sig };
|
|
21334
|
-
}
|
|
21335
|
-
async function writeCache(cachePath, bytes, sig) {
|
|
21336
|
-
const payload2 = JSON.stringify({ bytes: Buffer.from(bytes).toString("base64"), sig });
|
|
21337
|
-
await promises.writeFile(cachePath, payload2, { mode: 384 }).catch(() => void 0);
|
|
21336
|
+
return { kind: "verified", bundle: result.bundle, bytes, sig };
|
|
21338
21337
|
}
|
|
21339
21338
|
async function readVerifiedCache(cachePath, ref) {
|
|
21340
21339
|
try {
|
|
21341
21340
|
const raw = JSON.parse(await promises.readFile(cachePath, "utf8"));
|
|
21342
|
-
|
|
21341
|
+
const payloadB64 = raw.payloadB64 ?? raw.bytes;
|
|
21342
|
+
const signature = raw.signature ?? raw.sig;
|
|
21343
|
+
if (typeof payloadB64 !== "string" || typeof signature !== "string")
|
|
21343
21344
|
return void 0;
|
|
21344
|
-
const result = verifyPolicyBundle(new Uint8Array(Buffer.from(
|
|
21345
|
+
const result = verifyPolicyBundle(new Uint8Array(Buffer.from(payloadB64, "base64")), signature, ref.publicKey, ref.id);
|
|
21345
21346
|
return result.ok ? result.bundle : void 0;
|
|
21346
21347
|
} catch {
|
|
21347
21348
|
return void 0;
|
|
@@ -22929,12 +22930,9 @@ async function fetchSignedRegistry(opts = {}) {
|
|
|
22929
22930
|
return fallback("invalid-schema", "signed index failed schema validation");
|
|
22930
22931
|
}
|
|
22931
22932
|
try {
|
|
22932
|
-
|
|
22933
|
-
|
|
22934
|
-
|
|
22935
|
-
sig
|
|
22936
|
-
};
|
|
22937
|
-
await writeFileAtomic(cachePath, JSON.stringify(cacheBody));
|
|
22933
|
+
await writeSignedNetworkCacheAtomic(cachePath, bytes, sig, publicKeyPem, {
|
|
22934
|
+
writtenAtMs: now()
|
|
22935
|
+
});
|
|
22938
22936
|
} catch {
|
|
22939
22937
|
}
|
|
22940
22938
|
return { source: "remote", entries: index.entries };
|
|
@@ -22962,13 +22960,13 @@ async function readVerifiedCache2(cachePath, publicKeyPem) {
|
|
|
22962
22960
|
const parsed = cacheFileSchema.safeParse(raw);
|
|
22963
22961
|
if (!parsed.success)
|
|
22964
22962
|
return void 0;
|
|
22965
|
-
const bytes = Buffer.from(parsed.data.
|
|
22966
|
-
if (!verifyRegistryIndex(bytes, parsed.data.
|
|
22963
|
+
const bytes = Buffer.from(parsed.data.payloadB64, "base64");
|
|
22964
|
+
if (!verifyRegistryIndex(bytes, parsed.data.signature, publicKeyPem))
|
|
22967
22965
|
return void 0;
|
|
22968
22966
|
const index = parseRegistryIndex(bytes);
|
|
22969
22967
|
if (!index)
|
|
22970
22968
|
return void 0;
|
|
22971
|
-
return { fetchedAtMs: parsed.data.
|
|
22969
|
+
return { fetchedAtMs: parsed.data.writtenAtMs, index };
|
|
22972
22970
|
}
|
|
22973
22971
|
async function resolveInstallSource(idOrSpec, opts = {}) {
|
|
22974
22972
|
const registry = await fetchSignedRegistry(opts);
|
|
@@ -23098,11 +23096,24 @@ var init_registry2 = __esm({
|
|
|
23098
23096
|
// over entry-by-entry.
|
|
23099
23097
|
entries: z$1.array(registryEntrySchema).max(5e3)
|
|
23100
23098
|
});
|
|
23101
|
-
cacheFileSchema = z$1.
|
|
23102
|
-
|
|
23103
|
-
|
|
23104
|
-
|
|
23105
|
-
|
|
23099
|
+
cacheFileSchema = z$1.union([
|
|
23100
|
+
z$1.object({
|
|
23101
|
+
writtenAtMs: z$1.number().int().nonnegative(),
|
|
23102
|
+
payloadB64: z$1.string().min(1),
|
|
23103
|
+
signature: z$1.string().min(1)
|
|
23104
|
+
}),
|
|
23105
|
+
// Read the pre-0.38 cache shape during a rolling upgrade. New writes always
|
|
23106
|
+
// use the shared signed-cache envelope above.
|
|
23107
|
+
z$1.object({
|
|
23108
|
+
fetchedAtMs: z$1.number().int().nonnegative(),
|
|
23109
|
+
indexB64: z$1.string().min(1),
|
|
23110
|
+
sig: z$1.string().min(1)
|
|
23111
|
+
}).transform((legacy) => ({
|
|
23112
|
+
writtenAtMs: legacy.fetchedAtMs,
|
|
23113
|
+
payloadB64: legacy.indexB64,
|
|
23114
|
+
signature: legacy.sig
|
|
23115
|
+
}))
|
|
23116
|
+
]);
|
|
23106
23117
|
NET_RANK = { none: 0, allowlist: 1, any: 2 };
|
|
23107
23118
|
}
|
|
23108
23119
|
});
|
|
@@ -25579,10 +25590,11 @@ function defaultWebhookQueueDir() {
|
|
|
25579
25590
|
function safeId(id) {
|
|
25580
25591
|
return id.replace(/[^A-Za-z0-9._-]/g, "_");
|
|
25581
25592
|
}
|
|
25582
|
-
var WebhookDeliveryQueue;
|
|
25593
|
+
var MAX_QUEUED_DELIVERY_BYTES, WebhookDeliveryQueue;
|
|
25583
25594
|
var init_queue = __esm({
|
|
25584
25595
|
"../plugin-webhooks/dist/queue.js"() {
|
|
25585
25596
|
init_node();
|
|
25597
|
+
MAX_QUEUED_DELIVERY_BYTES = 8 * 1024 * 1024;
|
|
25586
25598
|
WebhookDeliveryQueue = class {
|
|
25587
25599
|
dir;
|
|
25588
25600
|
constructor(dir = defaultWebhookQueueDir()) {
|
|
@@ -25600,7 +25612,7 @@ var init_queue = __esm({
|
|
|
25600
25612
|
deliveryId: rec.deliveryId,
|
|
25601
25613
|
enqueuedAt: rec.enqueuedAt ?? Date.now()
|
|
25602
25614
|
};
|
|
25603
|
-
await
|
|
25615
|
+
await writeBoundedDataCacheAtomic(path3__default.join(this.dir, `${id}.json`), JSON.stringify(record), { maxBytes: MAX_QUEUED_DELIVERY_BYTES });
|
|
25604
25616
|
return id;
|
|
25605
25617
|
}
|
|
25606
25618
|
/** Every queued delivery for `ownerSessionId`, oldest first. Corrupt records
|
|
@@ -84220,6 +84232,7 @@ var init_focus_layout = __esm({
|
|
|
84220
84232
|
"../desktop-ipc-contract/dist/focus-layout.js"() {
|
|
84221
84233
|
FOCUS_PET_LAYOUT = Object.freeze({
|
|
84222
84234
|
collapsedWidth: 84,
|
|
84235
|
+
voiceActiveCollapsedWidth: 136,
|
|
84223
84236
|
collapsedHeight: 104,
|
|
84224
84237
|
activeAvatarWidth: 72,
|
|
84225
84238
|
activeHeight: 90,
|
|
@@ -84251,6 +84264,7 @@ var init_remote = __esm({
|
|
|
84251
84264
|
"desks.setActive",
|
|
84252
84265
|
// The conversation itself.
|
|
84253
84266
|
"session.info",
|
|
84267
|
+
"session.activeTurn",
|
|
84254
84268
|
"session.runTurn",
|
|
84255
84269
|
"session.abortTurn",
|
|
84256
84270
|
"session.setProvider",
|
|
@@ -84468,6 +84482,7 @@ var init_validation = __esm({
|
|
|
84468
84482
|
workspaceId: optionalWorkspace,
|
|
84469
84483
|
prompt: z.string().max(1e6),
|
|
84470
84484
|
model: z.string().min(1).max(256).optional(),
|
|
84485
|
+
visibility: z.enum(["foreground", "background"]).optional(),
|
|
84471
84486
|
attachments: z.array(z.object({
|
|
84472
84487
|
path: z.string().min(1).max(4096),
|
|
84473
84488
|
name: z.string().min(1).max(1024)
|
|
@@ -84503,6 +84518,7 @@ var init_validation = __esm({
|
|
|
84503
84518
|
}
|
|
84504
84519
|
}).optional()
|
|
84505
84520
|
}),
|
|
84521
|
+
"session.activeTurn": z.object({ workspaceId: optionalWorkspace }).optional(),
|
|
84506
84522
|
"session.previewAttachment": z.object({
|
|
84507
84523
|
workspaceId: optionalWorkspace,
|
|
84508
84524
|
path: z.string().min(1).max(4096),
|
|
@@ -85374,9 +85390,12 @@ var init_single_session_host = __esm({
|
|
|
85374
85390
|
return renamed;
|
|
85375
85391
|
});
|
|
85376
85392
|
this.bus.handle("session.info", async () => this.session.getInfo());
|
|
85393
|
+
this.bus.handle("session.activeTurn", async (args) => ({
|
|
85394
|
+
turnId: this.activeForegroundTurnId(args?.workspaceId ?? this.selectedSessionId)
|
|
85395
|
+
}));
|
|
85377
85396
|
this.bus.handle("session.runTurn", async (args) => this.runTurn(args));
|
|
85378
85397
|
this.bus.handle("session.abortTurn", async ({ turnId }) => {
|
|
85379
|
-
this.turns.get(turnId)?.abort();
|
|
85398
|
+
this.turns.get(turnId)?.controller.abort();
|
|
85380
85399
|
});
|
|
85381
85400
|
this.bus.handle("session.setAutoApprove", async ({ enabled }) => {
|
|
85382
85401
|
this.autoApprove = enabled;
|
|
@@ -85507,8 +85526,8 @@ var init_single_session_host = __esm({
|
|
|
85507
85526
|
/** Abort all in-flight turns and deny + clear all parked asks (clearing their
|
|
85508
85527
|
* timeout timers). Shared by `dispose()` and `onAllClientsDisconnected()`. */
|
|
85509
85528
|
abortAndDrain() {
|
|
85510
|
-
for (const
|
|
85511
|
-
controller.abort();
|
|
85529
|
+
for (const turn of this.turns.values())
|
|
85530
|
+
turn.controller.abort();
|
|
85512
85531
|
this.turns.clear();
|
|
85513
85532
|
for (const { resolve: resolve21, timer } of this.pendingAsks.values()) {
|
|
85514
85533
|
if (timer)
|
|
@@ -85580,8 +85599,8 @@ var init_single_session_host = __esm({
|
|
|
85580
85599
|
this.bus.broadcast("connection.changed", { workspaceId: id, phase: this.snapshot(id).phase });
|
|
85581
85600
|
}
|
|
85582
85601
|
async resetCurrentSession() {
|
|
85583
|
-
for (const
|
|
85584
|
-
controller.abort();
|
|
85602
|
+
for (const turn of this.turns.values())
|
|
85603
|
+
turn.controller.abort();
|
|
85585
85604
|
this.autoApprove = false;
|
|
85586
85605
|
if (this.session.reset)
|
|
85587
85606
|
await this.session.reset();
|
|
@@ -85593,7 +85612,11 @@ var init_single_session_host = __esm({
|
|
|
85593
85612
|
await this.selectRuntimeTarget(targetWorkspaceId);
|
|
85594
85613
|
const turnId = randomUUID();
|
|
85595
85614
|
const controller = new AbortController();
|
|
85596
|
-
this.turns.set(turnId,
|
|
85615
|
+
this.turns.set(turnId, {
|
|
85616
|
+
controller,
|
|
85617
|
+
visibility: args.visibility ?? "foreground",
|
|
85618
|
+
workspaceId: targetWorkspaceId
|
|
85619
|
+
});
|
|
85597
85620
|
void (async () => {
|
|
85598
85621
|
let error = null;
|
|
85599
85622
|
try {
|
|
@@ -85615,6 +85638,14 @@ var init_single_session_host = __esm({
|
|
|
85615
85638
|
});
|
|
85616
85639
|
return { turnId };
|
|
85617
85640
|
}
|
|
85641
|
+
activeForegroundTurnId(workspaceId) {
|
|
85642
|
+
let active2 = null;
|
|
85643
|
+
for (const [turnId, turn] of this.turns) {
|
|
85644
|
+
if (turn.visibility === "foreground" && turn.workspaceId === workspaceId)
|
|
85645
|
+
active2 = turnId;
|
|
85646
|
+
}
|
|
85647
|
+
return active2;
|
|
85648
|
+
}
|
|
85618
85649
|
async selectRuntimeTarget(sessionId) {
|
|
85619
85650
|
if (sessionId === this.selectedSessionId)
|
|
85620
85651
|
return;
|
|
@@ -98930,6 +98961,14 @@ var init_client_mode = __esm({
|
|
|
98930
98961
|
});
|
|
98931
98962
|
|
|
98932
98963
|
// src/update/registry.ts
|
|
98964
|
+
function normalizeStableSemver(value2) {
|
|
98965
|
+
if (typeof value2 !== "string") return null;
|
|
98966
|
+
const match = STABLE_SEMVER_RE.exec(value2);
|
|
98967
|
+
if (!match) return null;
|
|
98968
|
+
const [, major, minor, patch] = match;
|
|
98969
|
+
if (major === void 0 || minor === void 0 || patch === void 0) return null;
|
|
98970
|
+
return `${Number(major)}.${Number(minor)}.${Number(patch)}`;
|
|
98971
|
+
}
|
|
98933
98972
|
async function fetchLatest(pkg = DEFAULT_PKG, opts = {}) {
|
|
98934
98973
|
const fetchImpl = opts.fetchImpl ?? fetch;
|
|
98935
98974
|
const url = `${REGISTRY}/${encodeURIComponent(pkg)}/latest`;
|
|
@@ -98942,19 +98981,20 @@ async function fetchLatest(pkg = DEFAULT_PKG, opts = {}) {
|
|
|
98942
98981
|
});
|
|
98943
98982
|
if (!res.ok) return null;
|
|
98944
98983
|
const json = await res.json();
|
|
98945
|
-
return
|
|
98984
|
+
return normalizeStableSemver(json.version);
|
|
98946
98985
|
} catch {
|
|
98947
98986
|
return null;
|
|
98948
98987
|
} finally {
|
|
98949
98988
|
clearTimeout(timer);
|
|
98950
98989
|
}
|
|
98951
98990
|
}
|
|
98952
|
-
var REGISTRY, DEFAULT_PKG, DEFAULT_TIMEOUT_MS;
|
|
98991
|
+
var REGISTRY, DEFAULT_PKG, DEFAULT_TIMEOUT_MS, STABLE_SEMVER_RE;
|
|
98953
98992
|
var init_registry4 = __esm({
|
|
98954
98993
|
"src/update/registry.ts"() {
|
|
98955
98994
|
REGISTRY = "https://registry.npmjs.org";
|
|
98956
98995
|
DEFAULT_PKG = "@moxxy/cli";
|
|
98957
98996
|
DEFAULT_TIMEOUT_MS = 4e3;
|
|
98997
|
+
STABLE_SEMVER_RE = /^(0|[1-9]\d{0,8})\.(0|[1-9]\d{0,8})\.(0|[1-9]\d{0,8})$/;
|
|
98958
98998
|
}
|
|
98959
98999
|
});
|
|
98960
99000
|
function defaultCacheFile() {
|
|
@@ -98987,9 +99027,11 @@ function readCache(file) {
|
|
|
98987
99027
|
}
|
|
98988
99028
|
return null;
|
|
98989
99029
|
}
|
|
98990
|
-
function
|
|
99030
|
+
function writeCache(file, value2) {
|
|
98991
99031
|
try {
|
|
98992
|
-
|
|
99032
|
+
writeBoundedNetworkCacheAtomicSync(file, JSON.stringify(value2, null, 2), {
|
|
99033
|
+
maxBytes: MAX_UPDATE_CACHE_BYTES
|
|
99034
|
+
});
|
|
98993
99035
|
} catch {
|
|
98994
99036
|
}
|
|
98995
99037
|
}
|
|
@@ -99004,7 +99046,7 @@ function readCachedCheck(current, opts = {}) {
|
|
|
99004
99046
|
async function refreshCheck(current, opts = {}) {
|
|
99005
99047
|
const latest = await fetchLatest(PKG, opts);
|
|
99006
99048
|
if (latest) {
|
|
99007
|
-
|
|
99049
|
+
writeCache(opts.cacheFile ?? defaultCacheFile(), {
|
|
99008
99050
|
checkedAt: opts.now ?? Date.now(),
|
|
99009
99051
|
latest
|
|
99010
99052
|
});
|
|
@@ -99024,11 +99066,12 @@ async function checkForCliUpdate(current, opts = {}) {
|
|
|
99024
99066
|
const refreshed = await refreshCheck(current, { ...opts, cacheFile: file, now });
|
|
99025
99067
|
return refreshed ?? shape(current, readCache(file)?.latest ?? null);
|
|
99026
99068
|
}
|
|
99027
|
-
var CACHE_TTL_MS2, PKG;
|
|
99069
|
+
var CACHE_TTL_MS2, MAX_UPDATE_CACHE_BYTES, PKG;
|
|
99028
99070
|
var init_check = __esm({
|
|
99029
99071
|
"src/update/check.ts"() {
|
|
99030
99072
|
init_registry4();
|
|
99031
99073
|
CACHE_TTL_MS2 = 12 * 60 * 60 * 1e3;
|
|
99074
|
+
MAX_UPDATE_CACHE_BYTES = 1024;
|
|
99032
99075
|
PKG = "@moxxy/cli";
|
|
99033
99076
|
}
|
|
99034
99077
|
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@moxxy/cli",
|
|
3
|
-
"version": "0.37.
|
|
3
|
+
"version": "0.37.2",
|
|
4
4
|
"description": "moxxy command-line agent: TUI, one-shot prompts, setup, services, and API-key or installed-CLI subscription providers.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"moxxy",
|
|
@@ -49,7 +49,7 @@
|
|
|
49
49
|
"dependencies": {
|
|
50
50
|
"undici": "^6.28.0",
|
|
51
51
|
"zod": "^3.25.76",
|
|
52
|
-
"@moxxy/sdk": "0.37.
|
|
52
|
+
"@moxxy/sdk": "0.37.2"
|
|
53
53
|
},
|
|
54
54
|
"optionalDependencies": {
|
|
55
55
|
"@napi-rs/keyring": "^1.3.0"
|