@moxxy/cli 0.48.2 → 0.48.4
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 +587 -75
- package/package.json +2 -2
package/dist/bin.js
CHANGED
|
@@ -5,8 +5,8 @@ import * as fs43 from 'fs';
|
|
|
5
5
|
import fs43__default, { promises, readFileSync, existsSync, statSync, readdirSync, mkdirSync, writeFileSync, realpathSync, unlinkSync, lstatSync, constants as constants$1, watch as watch$1 } from 'fs';
|
|
6
6
|
import * as path3 from 'path';
|
|
7
7
|
import path3__default, { dirname, join, posix, resolve, relative, sep, isAbsolute } from 'path';
|
|
8
|
-
import { utf8Locale, ensurePrivateDir, moxxyHome, pruneStaleTempFiles, moxxyPath, hasProxy, installEgressProxy, readProxyEnv, writeFileAtomic, ensurePrivateFile, killTree as killTree$1, liveChannelStatus, spawnDedicatedChannel, stopDedicatedChannel, clearChannelStatus, findExecutable, PRIVATE_FILE_MODE, resolveOsPrincipal, redactProxyUrl, resolveExecutableTarget, spawnExecutableTarget, listLiveChannelStatuses, rotateChannelToken, writeSignedNetworkCacheAtomic, CrossProcessFireLock, fetchNpmLatest, writeChannelStatus, writeBoundedNetworkCacheAtomicSync, writeBoundedDataCacheAtomic, readRequestBody, bearerTokenMatches } from '@moxxy/sdk/server';
|
|
9
|
-
import { spawn, spawnSync } from 'child_process';
|
|
8
|
+
import { utf8Locale, ensurePrivateDir, moxxyHome, pruneStaleTempFiles, moxxyPath, hasProxy, installEgressProxy, readProxyEnv, writeFileAtomic, ensurePrivateFile, killTree as killTree$1, liveChannelStatus, spawnDedicatedChannel, stopDedicatedChannel, clearChannelStatus, findExecutable, PRIVATE_FILE_MODE, resolveOsPrincipal, redactProxyUrl, resolveExecutableTarget, spawnExecutableTarget, listLiveChannelStatuses, rotateChannelToken, writeSignedNetworkCacheAtomic, CrossProcessFireLock, fetchNpmLatest, writeChannelStatus, withFileLock, writeBoundedNetworkCacheAtomicSync, writeBoundedDataCacheAtomic, readRequestBody, bearerTokenMatches } from '@moxxy/sdk/server';
|
|
9
|
+
import { spawn, spawnSync, execFile } from 'child_process';
|
|
10
10
|
import { fileURLToPath, pathToFileURL } from 'url';
|
|
11
11
|
import { MoxxyError, createMutex, defineChannel, definePlugin, defineViewRenderer, DEFAULT_VIEW_TAGS, defineTunnelProvider, defineAuditExporter, defineAuditSink, z as z$1, withAgentConduct, questionAnswersSchema, defineTool, defineEmbedder, defineMode, asPluginId, computerControlSnapshotSchema, createDeferredPermissionResolver, isSafeViewUrl, redactSecrets, questionAnswerDisplay, describeQuestionAnswers, searchConversation, conversationTurns, asTurnId, waitFor, unfinishedWorkCheckpoint, unfinishedStepCheckpoint, runReactLoop, defineCompactor, abortError, activeCompactionRanges, defineCacheStrategy, runManualCompaction, assertDefined, defineWorkflowExecutor, MOXXY_PCM16_24KHZ_MIME, isAgentNoReplyEvent, AGENT_NO_REPLY_TEXT, accountLimitOfEvent, isFileDiffDisplay, questionAnswerLines, stepListProgress, startingModel, fileDiffFromText, findAttachment, listAttachments, summarizeWithProvider, toolResultBytes, isSelectableMode, summarizeSessionTokensFromEvents, summarizeTokensByModel, getInstallHint, toDiffRows, diffGutterNo, fileDiffVerb, fileDiffSummary, openQuestionsFromEvents, emptyDraft, questionAnswersProblem, draftAnswers, computeElisionState, toolResultStubbed, toolResultStubText, conversationalStubbed, conversationalStub, chooseOption, typeOwnAnswer, isFirstPartyPackage, REDACTED_PLACEHOLDER, isSecretKey, addModelTotals, skillFrontmatterSchema, asSkillId, parseFrontmatter, denyByDefaultResolver, createCallbackResolver, createAllowListResolver, countNodes, autoAllowResolver, SESSION_SOURCES, startChannelWith, EXIT_AFTER_PAIR_FLAG, renderFrontmatter, formatPrincipal, aggregateCapabilitySpecs, hostCredentialName, verifyEd25519, mentionedSkills, skillAttachment, withoutTools, toolsForMode, moxxyPackageSchema, auditActionOf, asToolCallId, dispatchToolCall, matchLoadableTools, defineSecretProvider, encodeLoginAuthUrl, redactSecretText, encodeLoginPrompt, defineCommand, ISOLATION_RANK, sleepWithAbort, asSessionId, migrateModeName, autoApproveFromEvents, AUTO_APPROVE_SUBTYPE, AUTO_APPROVE_PLUGIN_ID, autoApproveFromAgent, autoApproveRecorded, agentActivityRecord, withRecordedContextWindows, recordedContextWindows, parseFrontmatterFile, createJsonFileStore, autoApproveSwitch, eventForClient, computerControlCommandSchema, historyPageForClient, readAttachmentChunk, computerApprovalFocusSchema, workflowApprovalItemsSchema, evaluateToolRule, asEventId, QUESTION_ASKED, questionCloseNote, QUESTION_RESOLVED, QUESTION_CLOSED_NEW_MESSAGE as QUESTION_CLOSED_NEW_MESSAGE$1, questionRecord as questionRecord$1, QUESTION_PLUGIN_ID } from '@moxxy/sdk';
|
|
12
12
|
import { createRequire as createRequire$1 } from 'module';
|
|
@@ -20129,7 +20129,7 @@ var init_scope = __esm({
|
|
|
20129
20129
|
|
|
20130
20130
|
// ../core/dist/agent-cli-watch.js
|
|
20131
20131
|
function differs(a2, b3) {
|
|
20132
|
-
return a2.state !== b3.state || a2.installed !== b3.installed || a2.latest !== b3.latest || a2.signedIn !== b3.signedIn || a2.account !== b3.account;
|
|
20132
|
+
return a2.state !== b3.state || a2.installed !== b3.installed || a2.latest !== b3.latest || a2.signedIn !== b3.signedIn || a2.account !== b3.account || a2.knownIssue?.version !== b3.knownIssue?.version || a2.knownIssue?.reason !== b3.knownIssue?.reason;
|
|
20133
20133
|
}
|
|
20134
20134
|
var HOUR_MS, AgentCliWatch;
|
|
20135
20135
|
var init_agent_cli_watch = __esm({
|
|
@@ -34281,7 +34281,7 @@ var init_provider = __esm({
|
|
|
34281
34281
|
scheduleReconnect() {
|
|
34282
34282
|
if (this.closed || this.reconnectTimer || this.targets.size === 0)
|
|
34283
34283
|
return;
|
|
34284
|
-
const
|
|
34284
|
+
const delay5 = this.reconnectMs;
|
|
34285
34285
|
this.reconnectMs = Math.min(this.reconnectMs * 2, RECONNECT_MAX_MS);
|
|
34286
34286
|
this.reconnectTimer = setTimeout(() => {
|
|
34287
34287
|
this.reconnectTimer = null;
|
|
@@ -34289,7 +34289,7 @@ var init_provider = __esm({
|
|
|
34289
34289
|
return;
|
|
34290
34290
|
this.connectControl().then(() => this.logger?.info?.("proxy: control reconnected")).catch(() => {
|
|
34291
34291
|
});
|
|
34292
|
-
},
|
|
34292
|
+
}, delay5);
|
|
34293
34293
|
this.reconnectTimer.unref?.();
|
|
34294
34294
|
}
|
|
34295
34295
|
/** Pipe one inbound peer (raw bytes over a `/data` WS) to its target's port. */
|
|
@@ -44718,9 +44718,9 @@ var require_scheduler_development = __commonJS({
|
|
|
44718
44718
|
var currentTime = exports.unstable_now();
|
|
44719
44719
|
var startTime2;
|
|
44720
44720
|
if (typeof options === "object" && options !== null) {
|
|
44721
|
-
var
|
|
44722
|
-
if (typeof
|
|
44723
|
-
startTime2 = currentTime +
|
|
44721
|
+
var delay5 = options.delay;
|
|
44722
|
+
if (typeof delay5 === "number" && delay5 > 0) {
|
|
44723
|
+
startTime2 = currentTime + delay5;
|
|
44724
44724
|
} else {
|
|
44725
44725
|
startTime2 = currentTime;
|
|
44726
44726
|
}
|
|
@@ -72817,19 +72817,39 @@ function agentCliNotice(connection) {
|
|
|
72817
72817
|
const file = agentCliFile(report2);
|
|
72818
72818
|
const where = file ? ` at ${file}` : "";
|
|
72819
72819
|
const app = agentCliApp(report2);
|
|
72820
|
+
const heldBack = agentCliHeldBack(report2, agent);
|
|
72820
72821
|
switch (report2.state) {
|
|
72821
72822
|
case "missing":
|
|
72822
72823
|
return { ...base, severity: "required", action: "install", text: `${agent} is not installed` };
|
|
72823
72824
|
case "update-required": {
|
|
72824
72825
|
const old = `${agent} ${report2.installed ?? ""}`.trim() + `${where} is older than Moxxy works with`;
|
|
72825
|
-
return app ? { ...base, severity: "required", action: null, text: `${old} \u2014 it is part of ${app}, which updates it` } : { ...base, severity: "required", action: "update", text: `${old} \u2014 update it to ${report2.minimum} or newer` };
|
|
72826
|
+
return app ? { ...base, severity: "required", action: null, text: `${old} \u2014 it is part of ${app}, which updates it` } : heldBack ? { ...base, severity: "required", action: null, text: `${old} \u2014 ${heldBack}` } : report2.manualUpdate ? { ...base, severity: "required", action: null, text: `${old} \u2014 ${report2.manualUpdate}` } : { ...base, severity: "required", action: "update", text: `${old} \u2014 update it to ${report2.minimum} or newer` };
|
|
72827
|
+
}
|
|
72828
|
+
case "update-available": {
|
|
72829
|
+
return report2.latest && !app ? { ...base, severity: "available", action: report2.manualUpdate ? null : "update", text: `${agent} ${report2.latest} is out \u2014 you have ${report2.installed ?? "an older one"}${where}${report2.manualUpdate ? ` \u2014 ${report2.manualUpdate}` : ""}` } : null;
|
|
72830
|
+
}
|
|
72831
|
+
case "current": {
|
|
72832
|
+
const text3 = agentCliKnownIssue(report2, agent);
|
|
72833
|
+
return text3 ? { ...base, severity: "issue", action: null, text: text3 } : null;
|
|
72826
72834
|
}
|
|
72827
|
-
case "update-available":
|
|
72828
|
-
return report2.latest && !app ? { ...base, severity: "available", action: "update", text: `${agent} ${report2.latest} is out \u2014 you have ${report2.installed ?? "an older one"}${where}` } : null;
|
|
72829
72835
|
default:
|
|
72830
72836
|
return null;
|
|
72831
72837
|
}
|
|
72832
72838
|
}
|
|
72839
|
+
function agentCliKnownIssue(report2, agent) {
|
|
72840
|
+
const issue2 = report2.knownIssue;
|
|
72841
|
+
if (!issue2 || issue2.version !== report2.installed)
|
|
72842
|
+
return null;
|
|
72843
|
+
const which = agent ? `${agent} ${issue2.version}` : issue2.version;
|
|
72844
|
+
return `${which} may not work well with Moxxy: ${issue2.reason}. A fixed version is on the way`;
|
|
72845
|
+
}
|
|
72846
|
+
function agentCliHeldBack(report2, agent) {
|
|
72847
|
+
const issue2 = report2.knownIssue;
|
|
72848
|
+
if (!issue2 || issue2.version === report2.installed)
|
|
72849
|
+
return null;
|
|
72850
|
+
const which = agent ? `${agent} ${issue2.version}` : issue2.version;
|
|
72851
|
+
return `${which} is out, but Moxxy holds it back: ${issue2.reason}`;
|
|
72852
|
+
}
|
|
72833
72853
|
function agentCliFile(report2) {
|
|
72834
72854
|
if (!report2.path)
|
|
72835
72855
|
return null;
|
|
@@ -72851,7 +72871,7 @@ function activeAgentCliNotice(providers, activeProvider) {
|
|
|
72851
72871
|
var ORIGIN_LABEL;
|
|
72852
72872
|
var init_agent_cli = __esm({
|
|
72853
72873
|
"../chat-model/dist/agent-cli.js"() {
|
|
72854
|
-
ORIGIN_LABEL = { installer: "", homebrew: "Homebrew", npm: "npm", app: "", unknown: "" };
|
|
72874
|
+
ORIGIN_LABEL = { installer: "", homebrew: "Homebrew", winget: "winget", npm: "npm", bun: "bun", pnpm: "pnpm", yarn: "yarn", volta: "Volta", "vite-plus": "Vite+", mise: "mise", app: "", unknown: "" };
|
|
72855
72875
|
}
|
|
72856
72876
|
});
|
|
72857
72877
|
|
|
@@ -94534,7 +94554,7 @@ async function readCliVersion(target, timeoutMs = 1e4) {
|
|
|
94534
94554
|
}
|
|
94535
94555
|
function printedVersion(target, timeoutMs) {
|
|
94536
94556
|
return new Promise((resolve20) => {
|
|
94537
|
-
const child = spawnExecutableTarget(target, ["--version"], { stdio: ["ignore", "pipe", "ignore"] });
|
|
94557
|
+
const child = spawnExecutableTarget(target, ["--version"], { stdio: ["ignore", "pipe", "ignore"], windowsHide: true });
|
|
94538
94558
|
let out = "";
|
|
94539
94559
|
const timer = setTimeout(() => child.kill(), timeoutMs);
|
|
94540
94560
|
child.stdout?.on("data", (chunk) => {
|
|
@@ -94558,6 +94578,87 @@ var init_cli_version = __esm({
|
|
|
94558
94578
|
isPreRelease = (char) => isDigit2(char) || isLetter(char) || char === "." || char === "-";
|
|
94559
94579
|
}
|
|
94560
94580
|
});
|
|
94581
|
+
|
|
94582
|
+
// ../agent-connection-kit/dist/agent-versions-blocked.json
|
|
94583
|
+
var agent_versions_blocked_default;
|
|
94584
|
+
var init_agent_versions_blocked = __esm({
|
|
94585
|
+
"../agent-connection-kit/dist/agent-versions-blocked.json"() {
|
|
94586
|
+
agent_versions_blocked_default = {
|
|
94587
|
+
$comment: 'Versions of the agent CLIs that break with Moxxy, by command. Moxxy does not offer them as an update and says what is wrong when one is installed. Read from the development branch at most once an hour; how to add or remove one: AGENTS.md, "Holding back a broken agent version".',
|
|
94588
|
+
claude: [],
|
|
94589
|
+
codex: [],
|
|
94590
|
+
opencode: []
|
|
94591
|
+
};
|
|
94592
|
+
}
|
|
94593
|
+
});
|
|
94594
|
+
function parseBlockedAgentVersions(value2) {
|
|
94595
|
+
if (!value2 || typeof value2 !== "object" || Array.isArray(value2))
|
|
94596
|
+
return null;
|
|
94597
|
+
const out = {};
|
|
94598
|
+
for (const [command, entries] of Object.entries(value2)) {
|
|
94599
|
+
if (!Array.isArray(entries))
|
|
94600
|
+
continue;
|
|
94601
|
+
out[command] = entries.flatMap((entry) => {
|
|
94602
|
+
const { version, reason } = entry && typeof entry === "object" ? entry : {};
|
|
94603
|
+
if (typeof version !== "string" || !VERSION.test(version) || typeof reason !== "string")
|
|
94604
|
+
return [];
|
|
94605
|
+
const said = reason.trim();
|
|
94606
|
+
return said && said.length <= MAX_REASON ? [{ version, reason: said }] : [];
|
|
94607
|
+
});
|
|
94608
|
+
}
|
|
94609
|
+
return out;
|
|
94610
|
+
}
|
|
94611
|
+
function blockedAgentVersion(list, command, version) {
|
|
94612
|
+
return list[command]?.find((entry) => compareVersions(entry.version, version.replace(/^v/, "")) === 0);
|
|
94613
|
+
}
|
|
94614
|
+
function defaultBlockedCacheFile() {
|
|
94615
|
+
return moxxyPath("cache", "agent-cli-blocked.json");
|
|
94616
|
+
}
|
|
94617
|
+
async function blockedAgentVersions(opts = {}) {
|
|
94618
|
+
const cacheFile = opts.cacheFile ?? defaultBlockedCacheFile();
|
|
94619
|
+
const now = (opts.now ?? Date.now)();
|
|
94620
|
+
const known = await readCache2(cacheFile);
|
|
94621
|
+
if (known && !opts.refresh && now - known.at < (opts.ttlMs ?? HOUR_MS2))
|
|
94622
|
+
return known.list;
|
|
94623
|
+
const fetched = await fetchList(opts.url ?? BLOCKED_AGENT_VERSIONS_URL, opts.fetchImpl ?? fetch);
|
|
94624
|
+
if (!fetched)
|
|
94625
|
+
return known?.list ?? BUNDLED_BLOCKED_AGENT_VERSIONS;
|
|
94626
|
+
await writeFileAtomic(cacheFile, JSON.stringify({ at: now, list: fetched })).catch(() => void 0);
|
|
94627
|
+
return fetched;
|
|
94628
|
+
}
|
|
94629
|
+
async function cachedBlockedAgentVersions(cacheFile = defaultBlockedCacheFile()) {
|
|
94630
|
+
return (await readCache2(cacheFile))?.list ?? BUNDLED_BLOCKED_AGENT_VERSIONS;
|
|
94631
|
+
}
|
|
94632
|
+
async function fetchList(url, fetchImpl) {
|
|
94633
|
+
try {
|
|
94634
|
+
const res = await fetchImpl(url, { signal: AbortSignal.timeout(FETCH_TIMEOUT_MS2) });
|
|
94635
|
+
return res.ok ? parseBlockedAgentVersions(JSON.parse(await res.text())) : null;
|
|
94636
|
+
} catch {
|
|
94637
|
+
return null;
|
|
94638
|
+
}
|
|
94639
|
+
}
|
|
94640
|
+
async function readCache2(file) {
|
|
94641
|
+
try {
|
|
94642
|
+
const { at, list } = JSON.parse(await readFile(file, "utf8"));
|
|
94643
|
+
const parsed = parseBlockedAgentVersions(list);
|
|
94644
|
+
return typeof at === "number" && parsed ? { at, list: parsed } : null;
|
|
94645
|
+
} catch {
|
|
94646
|
+
return null;
|
|
94647
|
+
}
|
|
94648
|
+
}
|
|
94649
|
+
var BLOCKED_AGENT_VERSIONS_URL, VERSION, MAX_REASON, HOUR_MS2, FETCH_TIMEOUT_MS2, BUNDLED_BLOCKED_AGENT_VERSIONS;
|
|
94650
|
+
var init_agent_versions_blocked2 = __esm({
|
|
94651
|
+
"../agent-connection-kit/dist/agent-versions-blocked.js"() {
|
|
94652
|
+
init_agent_versions_blocked();
|
|
94653
|
+
init_cli_version();
|
|
94654
|
+
BLOCKED_AGENT_VERSIONS_URL = "https://raw.githubusercontent.com/moxxy-ai/moxxy/development/packages/agent-connection-kit/src/agent-versions-blocked.json";
|
|
94655
|
+
VERSION = /^\d+(\.\d+)+$/;
|
|
94656
|
+
MAX_REASON = 300;
|
|
94657
|
+
HOUR_MS2 = 60 * 6e4;
|
|
94658
|
+
FETCH_TIMEOUT_MS2 = 1e4;
|
|
94659
|
+
BUNDLED_BLOCKED_AGENT_VERSIONS = parseBlockedAgentVersions(agent_versions_blocked_default) ?? {};
|
|
94660
|
+
}
|
|
94661
|
+
});
|
|
94561
94662
|
function codexWindowsPrograms(arch) {
|
|
94562
94663
|
const build2 = CODEX_WINDOWS_BUILDS[arch];
|
|
94563
94664
|
if (!build2)
|
|
@@ -94567,11 +94668,22 @@ function codexWindowsPrograms(arch) {
|
|
|
94567
94668
|
CODEX_MANAGED_BY_NPM: "1",
|
|
94568
94669
|
CODEX_MANAGED_PACKAGE_ROOT: path3__default.win32.join(shimDir, "node_modules", "@openai", "codex")
|
|
94569
94670
|
});
|
|
94570
|
-
|
|
94671
|
+
const shimRelative = [
|
|
94571
94672
|
`node_modules/@openai/codex/node_modules/@openai/${build2.pkg}/${program}`,
|
|
94572
94673
|
`node_modules/@openai/${build2.pkg}/${program}`,
|
|
94573
94674
|
`node_modules/@openai/codex/${program}`
|
|
94574
94675
|
].map((relative9) => ({ path: relative9, env: env3 }));
|
|
94676
|
+
const pnpm = {
|
|
94677
|
+
path: `../${build2.pkg}/${program}`,
|
|
94678
|
+
fromRealPackage: true,
|
|
94679
|
+
env: (packageRoot) => ({ CODEX_MANAGED_BY_PNPM: "1", CODEX_MANAGED_PACKAGE_ROOT: packageRoot })
|
|
94680
|
+
};
|
|
94681
|
+
const searched = {
|
|
94682
|
+
path: `@openai/${build2.pkg}/${program}`,
|
|
94683
|
+
fromNodeSearch: true,
|
|
94684
|
+
env: (packageRoot) => ({ CODEX_MANAGED_BY_NPM: "1", CODEX_MANAGED_PACKAGE_ROOT: packageRoot })
|
|
94685
|
+
};
|
|
94686
|
+
return [...shimRelative, pnpm, searched];
|
|
94575
94687
|
}
|
|
94576
94688
|
function searchOptions(desc, opts) {
|
|
94577
94689
|
const platform2 = opts.platform ?? process.platform;
|
|
@@ -94618,6 +94730,18 @@ function agentCliOrigin(desc, file, opts = {}) {
|
|
|
94618
94730
|
}
|
|
94619
94731
|
}
|
|
94620
94732
|
const slashed = real.replaceAll("\\", "/");
|
|
94733
|
+
const seen = [file.replaceAll("\\", "/").toLowerCase(), slashed.toLowerCase()];
|
|
94734
|
+
const shimmed = platform2 === "win32" ? windowsToolShim(desc, file, opts.read ?? ((f2) => readFileSync(f2, "utf8"))) : null;
|
|
94735
|
+
if (shimmed)
|
|
94736
|
+
return shimmed;
|
|
94737
|
+
const manager = PACKAGE_TOOLS.find((tool) => seen.some((p3) => tool.owns.test(p3)));
|
|
94738
|
+
if (manager)
|
|
94739
|
+
return { origin: manager.origin };
|
|
94740
|
+
const npmPrefix = npmGlobalPrefix(real, desc.npmPackage, platform2) ?? (platform2 === "win32" ? npmWindowsShimPrefix(file, desc.npmPackage, opts.exists ?? existsSync) : null);
|
|
94741
|
+
if (npmPrefix)
|
|
94742
|
+
return { origin: "npm", npmPrefix };
|
|
94743
|
+
if (seen.some((p3) => MISE_PATH.test(p3)))
|
|
94744
|
+
return { origin: "mise" };
|
|
94621
94745
|
for (const [folder2, cask] of [["Caskroom", true], ["Cellar", false]]) {
|
|
94622
94746
|
const marker = `/${folder2}/`;
|
|
94623
94747
|
const at = slashed.lastIndexOf(marker);
|
|
@@ -94625,6 +94749,9 @@ function agentCliOrigin(desc, file, opts = {}) {
|
|
|
94625
94749
|
if (name)
|
|
94626
94750
|
return { origin: "homebrew", homebrew: { prefix: real.slice(0, at), name, cask } };
|
|
94627
94751
|
}
|
|
94752
|
+
const winget = /\/Microsoft\/WinGet\/Packages\/([^/_]+)_/i.exec(slashed);
|
|
94753
|
+
if (winget?.[1])
|
|
94754
|
+
return { origin: "winget", winget: { id: winget[1] } };
|
|
94628
94755
|
if (comparable(slashed).includes(comparable(`/node_modules/${desc.npmPackage}/`)))
|
|
94629
94756
|
return { origin: "npm" };
|
|
94630
94757
|
const home = opts.home ?? homedir();
|
|
@@ -94633,6 +94760,122 @@ function agentCliOrigin(desc, file, opts = {}) {
|
|
|
94633
94760
|
return { origin: "installer" };
|
|
94634
94761
|
return { origin: "unknown" };
|
|
94635
94762
|
}
|
|
94763
|
+
function windowsToolShim(desc, file, read) {
|
|
94764
|
+
if (!WINDOWS_SHIMS.has(path3__default.win32.extname(file).toLowerCase()))
|
|
94765
|
+
return null;
|
|
94766
|
+
let text3;
|
|
94767
|
+
try {
|
|
94768
|
+
text3 = read(file);
|
|
94769
|
+
} catch {
|
|
94770
|
+
return null;
|
|
94771
|
+
}
|
|
94772
|
+
const dir = path3__default.win32.dirname(file);
|
|
94773
|
+
const home = path3__default.win32.dirname(dir);
|
|
94774
|
+
if (/\bvolta run\b/i.test(text3))
|
|
94775
|
+
return { origin: "volta", toolFolders: { env: { VOLTA_HOME: home } } };
|
|
94776
|
+
const targets = [...text3.matchAll(SHIM_TARGET)].map((match) => match[1] ?? "");
|
|
94777
|
+
const yarnGlobal = targets.map((target) => /^(.*\\global)\\node_modules\\\.bin\\[^\\]+\.cmd$/i.exec(target)?.[1]).find(Boolean);
|
|
94778
|
+
if (yarnGlobal)
|
|
94779
|
+
return { origin: "yarn", toolFolders: { args: ["--global-folder", path3__default.win32.resolve(dir, yarnGlobal), "--prefix", home] } };
|
|
94780
|
+
const pkg = `\\node_modules\\${desc.npmPackage.replaceAll("/", "\\").toLowerCase()}\\`;
|
|
94781
|
+
if (targets.some((target) => target.toLowerCase().includes(pkg) && /(?:^|\\)global\\/i.test(target))) {
|
|
94782
|
+
const pnpmHome = path3__default.win32.basename(dir).toLowerCase() === "bin" ? home : dir;
|
|
94783
|
+
return { origin: "pnpm", toolFolders: { env: { PNPM_HOME: pnpmHome } } };
|
|
94784
|
+
}
|
|
94785
|
+
return null;
|
|
94786
|
+
}
|
|
94787
|
+
function npmGlobalPrefix(real, pkg, platform2) {
|
|
94788
|
+
const lower2 = real.replaceAll("\\", "/").toLowerCase();
|
|
94789
|
+
const layout = platform2 === "win32" ? `/node_modules/${pkg.toLowerCase()}/` : `/lib/node_modules/${pkg.toLowerCase()}/`;
|
|
94790
|
+
const at = lower2.lastIndexOf(layout);
|
|
94791
|
+
if (at < 0 || lower2.slice(0, at).includes("/node_modules/"))
|
|
94792
|
+
return null;
|
|
94793
|
+
const mise = /\/mise\/installs\/([^/]+)\/[^/]+$/.exec(lower2.slice(0, at))?.[1];
|
|
94794
|
+
if (mise && mise !== "node")
|
|
94795
|
+
return null;
|
|
94796
|
+
return at === 0 ? "/" : real.slice(0, at);
|
|
94797
|
+
}
|
|
94798
|
+
function npmWindowsShimPrefix(file, pkg, exists3) {
|
|
94799
|
+
const dir = path3__default.win32.dirname(file);
|
|
94800
|
+
if (dir.replaceAll("\\", "/").toLowerCase().includes("/node_modules/"))
|
|
94801
|
+
return null;
|
|
94802
|
+
return exists3(path3__default.win32.join(dir, "node_modules", ...pkg.split("/"), "package.json")) ? dir : null;
|
|
94803
|
+
}
|
|
94804
|
+
function agentCliUpdatePlan(desc, file, source) {
|
|
94805
|
+
const tool = PACKAGE_TOOLS.find((candidate) => candidate.origin === source.origin);
|
|
94806
|
+
if (tool) {
|
|
94807
|
+
const args = [...tool.args(desc.npmPackage), ...source.toolFolders?.args ?? []];
|
|
94808
|
+
return { kind: "run", command: tool.command, args, ...source.toolFolders?.env ? { env: source.toolFolders.env } : {} };
|
|
94809
|
+
}
|
|
94810
|
+
if (source.origin === "mise")
|
|
94811
|
+
return { kind: "manual", hint: "update it with mise" };
|
|
94812
|
+
if (source.npmPrefix) {
|
|
94813
|
+
const args = ["install", "-g", "--prefix", source.npmPrefix, `--allow-scripts=${desc.npmPackage}`, `${desc.npmPackage}@latest`];
|
|
94814
|
+
return { kind: "run", command: "npm", args };
|
|
94815
|
+
}
|
|
94816
|
+
const slashed = file.replaceAll("\\", "/").toLowerCase();
|
|
94817
|
+
if (desc.legacyNpmPackages?.some((pkg) => slashed.includes(`/node_modules/${pkg.toLowerCase()}/`)))
|
|
94818
|
+
return { kind: "own" };
|
|
94819
|
+
if (source.origin === "unknown" && slashed.includes("/node_modules/")) {
|
|
94820
|
+
return { kind: "manual", hint: `update the project or tool that installed it (${desc.npmPackage})` };
|
|
94821
|
+
}
|
|
94822
|
+
if (source.origin === "npm")
|
|
94823
|
+
return { kind: "manual", hint: `update it with npm (npm install -g ${desc.npmPackage}@latest)` };
|
|
94824
|
+
return { kind: "own" };
|
|
94825
|
+
}
|
|
94826
|
+
function agentCliToolTarget(plan, file, opts = {}) {
|
|
94827
|
+
const dirs = (opts.pathEnv ?? process.env.PATH ?? "").split(path3__default.delimiter).filter(Boolean);
|
|
94828
|
+
try {
|
|
94829
|
+
return resolveExecutableTarget(plan.command, {
|
|
94830
|
+
platform: opts.platform ?? process.platform,
|
|
94831
|
+
pathEnv: "",
|
|
94832
|
+
extraPaths: [path3__default.dirname(file), ...dirs],
|
|
94833
|
+
...opts.electron !== void 0 ? { electron: opts.electron } : {}
|
|
94834
|
+
});
|
|
94835
|
+
} catch {
|
|
94836
|
+
return null;
|
|
94837
|
+
}
|
|
94838
|
+
}
|
|
94839
|
+
function manualUpdateOf(plan, file, opts) {
|
|
94840
|
+
if (plan.kind === "manual")
|
|
94841
|
+
return plan.hint;
|
|
94842
|
+
if (plan.kind === "run" && !agentCliToolTarget(plan, file, opts))
|
|
94843
|
+
return `run ${[plan.command, ...plan.args].join(" ")}`;
|
|
94844
|
+
return null;
|
|
94845
|
+
}
|
|
94846
|
+
function windowsShimRoot(desc, found, read) {
|
|
94847
|
+
const pkg = `${desc.npmPackage.replaceAll("/", "\\")}\\`.toLowerCase();
|
|
94848
|
+
let file = found;
|
|
94849
|
+
for (let hop = 0; hop < 2; hop++) {
|
|
94850
|
+
const dir = path3__default.win32.dirname(file);
|
|
94851
|
+
let text3;
|
|
94852
|
+
try {
|
|
94853
|
+
text3 = read(file);
|
|
94854
|
+
} catch {
|
|
94855
|
+
break;
|
|
94856
|
+
}
|
|
94857
|
+
if (/\bvolta run\b/i.test(text3))
|
|
94858
|
+
return path3__default.win32.join(dir, "..", "tools", "image", "packages", ...desc.npmPackage.split("/"));
|
|
94859
|
+
const targets = [...text3.matchAll(SHIM_TARGET)].map((match) => match[1] ?? "");
|
|
94860
|
+
const script = targets.find((target) => target.toLowerCase().includes(pkg));
|
|
94861
|
+
if (script)
|
|
94862
|
+
return path3__default.win32.dirname(path3__default.win32.join(dir, script.slice(0, script.toLowerCase().indexOf(pkg))));
|
|
94863
|
+
const next = targets.find((target) => target.toLowerCase().endsWith(".cmd"));
|
|
94864
|
+
if (!next)
|
|
94865
|
+
break;
|
|
94866
|
+
file = path3__default.win32.join(dir, next);
|
|
94867
|
+
}
|
|
94868
|
+
return path3__default.win32.dirname(found);
|
|
94869
|
+
}
|
|
94870
|
+
function nodeSearchFolders(from) {
|
|
94871
|
+
const folders = [];
|
|
94872
|
+
for (let dir = from; ; dir = path3__default.win32.dirname(dir)) {
|
|
94873
|
+
if (path3__default.win32.basename(dir).toLowerCase() !== "node_modules")
|
|
94874
|
+
folders.push(path3__default.win32.join(dir, "node_modules"));
|
|
94875
|
+
if (path3__default.win32.dirname(dir) === dir)
|
|
94876
|
+
return folders;
|
|
94877
|
+
}
|
|
94878
|
+
}
|
|
94636
94879
|
function agentCliTargetAt(desc, found, opts = {}) {
|
|
94637
94880
|
const platform2 = opts.platform ?? process.platform;
|
|
94638
94881
|
if (platform2 !== "win32")
|
|
@@ -94642,13 +94885,32 @@ function agentCliTargetAt(desc, found, opts = {}) {
|
|
|
94642
94885
|
return { kind: "direct", command: found };
|
|
94643
94886
|
if (!WINDOWS_SHIMS.has(extension2))
|
|
94644
94887
|
throw new Error(`Cannot run ${desc.name} from ${found}; install it again or point at ${desc.command}.exe.`);
|
|
94645
|
-
const dir =
|
|
94888
|
+
const dir = windowsShimRoot(desc, found, opts.read ?? ((file) => readFileSync(file, "utf8")));
|
|
94646
94889
|
const at = (relative9) => path3__default.win32.join(dir, ...relative9.split("/"));
|
|
94647
94890
|
const exists3 = opts.exists ?? existsSync;
|
|
94891
|
+
const realPackage = () => {
|
|
94892
|
+
try {
|
|
94893
|
+
return (opts.realpath ?? realpathSync.native)(at(`node_modules/${desc.npmPackage}`));
|
|
94894
|
+
} catch {
|
|
94895
|
+
return null;
|
|
94896
|
+
}
|
|
94897
|
+
};
|
|
94648
94898
|
for (const program of desc.windowsShim.native?.(opts.arch ?? process.arch) ?? []) {
|
|
94649
|
-
|
|
94899
|
+
if (program.fromNodeSearch) {
|
|
94900
|
+
const packageRoot = realPackage() ?? at(`node_modules/${desc.npmPackage}`);
|
|
94901
|
+
for (const modules of nodeSearchFolders(packageRoot)) {
|
|
94902
|
+
const command2 = path3__default.win32.join(modules, ...program.path.split("/"));
|
|
94903
|
+
if (exists3(command2))
|
|
94904
|
+
return program.env ? { kind: "direct", command: command2, env: program.env(packageRoot) } : { kind: "direct", command: command2 };
|
|
94905
|
+
}
|
|
94906
|
+
continue;
|
|
94907
|
+
}
|
|
94908
|
+
const root = program.fromRealPackage ? realPackage() : dir;
|
|
94909
|
+
if (!root)
|
|
94910
|
+
continue;
|
|
94911
|
+
const command = path3__default.win32.join(root, ...program.path.split("/"));
|
|
94650
94912
|
if (exists3(command))
|
|
94651
|
-
return program.env ? { kind: "direct", command, env: program.env(
|
|
94913
|
+
return program.env ? { kind: "direct", command, env: program.env(root) } : { kind: "direct", command };
|
|
94652
94914
|
}
|
|
94653
94915
|
const entry = at(desc.windowsShim.entry);
|
|
94654
94916
|
if (!exists3(entry))
|
|
@@ -94658,17 +94920,96 @@ function agentCliTargetAt(desc, found, opts = {}) {
|
|
|
94658
94920
|
const electron = opts.electron ?? Boolean(process.versions.electron);
|
|
94659
94921
|
return { kind: "node", command: process.execPath, entry, env: electron ? { ELECTRON_RUN_AS_NODE: "1" } : {} };
|
|
94660
94922
|
}
|
|
94923
|
+
function agentVersionSource(desc, source, opts = {}) {
|
|
94924
|
+
const fetchImpl = opts.fetchImpl ?? fetch;
|
|
94925
|
+
if (source.origin === "homebrew" && source.homebrew) {
|
|
94926
|
+
const { name, cask } = source.homebrew;
|
|
94927
|
+
const url = `https://formulae.brew.sh/api/${cask ? "cask" : "formula"}/${encodeURIComponent(name)}.json`;
|
|
94928
|
+
return {
|
|
94929
|
+
key: `homebrew:${cask ? "cask" : "formula"}:${name}`,
|
|
94930
|
+
fetch: async () => {
|
|
94931
|
+
const json = await readUrl(url, fetchImpl).then((text3) => JSON.parse(text3 ?? "null")).catch(() => null);
|
|
94932
|
+
const version = cask ? json?.version : json?.versions?.stable;
|
|
94933
|
+
return typeof version === "string" ? version.split(",")[0] ?? null : null;
|
|
94934
|
+
}
|
|
94935
|
+
};
|
|
94936
|
+
}
|
|
94937
|
+
if (source.origin === "winget" && source.winget) {
|
|
94938
|
+
const { id } = source.winget;
|
|
94939
|
+
const run2 = opts.run ?? runForOutput;
|
|
94940
|
+
return {
|
|
94941
|
+
key: `winget:${id}`,
|
|
94942
|
+
fetch: async () => {
|
|
94943
|
+
const output = await run2("winget", wingetArgs("show", id)).catch(() => "");
|
|
94944
|
+
return /^[^:\r\n]+:\s*v?(\d+(?:\.\d+)+)\s*$/m.exec(output)?.[1] ?? null;
|
|
94945
|
+
}
|
|
94946
|
+
};
|
|
94947
|
+
}
|
|
94948
|
+
const channel = desc.releaseChannel;
|
|
94949
|
+
if (source.origin === "installer" && channel) {
|
|
94950
|
+
return {
|
|
94951
|
+
key: `channel:${desc.command}`,
|
|
94952
|
+
fetch: async () => {
|
|
94953
|
+
const url = channel.url(await chosenChannel(channel, opts.home ?? homedir()));
|
|
94954
|
+
const text3 = await readUrl(url, fetchImpl).catch(() => null);
|
|
94955
|
+
return text3 && /^\d+(\.\d+)+/.test(text3.trim()) ? text3.trim() : null;
|
|
94956
|
+
}
|
|
94957
|
+
};
|
|
94958
|
+
}
|
|
94959
|
+
return { key: desc.npmPackage, fetch: () => fetchNpmLatest(desc.npmPackage, { fetchImpl }) };
|
|
94960
|
+
}
|
|
94961
|
+
function wingetArgs(command, id) {
|
|
94962
|
+
return [command, "--id", id, "--exact", "--disable-interactivity", "--accept-source-agreements"];
|
|
94963
|
+
}
|
|
94964
|
+
async function chosenChannel(channel, home) {
|
|
94965
|
+
try {
|
|
94966
|
+
const settings2 = JSON.parse(await readFile(path3__default.join(home, ...channel.settingsFile.split("/")), "utf8"));
|
|
94967
|
+
const chosen = settings2?.[channel.setting];
|
|
94968
|
+
return typeof chosen === "string" && chosen ? chosen : channel.fallback;
|
|
94969
|
+
} catch {
|
|
94970
|
+
return channel.fallback;
|
|
94971
|
+
}
|
|
94972
|
+
}
|
|
94973
|
+
async function readUrl(url, fetchImpl) {
|
|
94974
|
+
const res = await fetchImpl(url, { signal: AbortSignal.timeout(SOURCE_TIMEOUT_MS) });
|
|
94975
|
+
return res.ok ? res.text() : null;
|
|
94976
|
+
}
|
|
94977
|
+
function runForOutput(command, args) {
|
|
94978
|
+
return new Promise((resolve20, reject) => {
|
|
94979
|
+
execFile(command, [...args], { timeout: SOURCE_TIMEOUT_MS, windowsHide: true }, (err, stdout2) => err ? reject(err) : resolve20(stdout2));
|
|
94980
|
+
});
|
|
94981
|
+
}
|
|
94982
|
+
function rememberNotBrought(cacheFile, key) {
|
|
94983
|
+
return changeLatestCache(cacheFile, (cache4) => {
|
|
94984
|
+
const known = cache4[key];
|
|
94985
|
+
return known ? { ...cache4, [key]: { ...known, notBrought: known.version } } : null;
|
|
94986
|
+
});
|
|
94987
|
+
}
|
|
94988
|
+
function changeLatestCache(file, change) {
|
|
94989
|
+
const run2 = (cacheChanges.get(file) ?? Promise.resolve()).then(() => withFileLock(file, async () => {
|
|
94990
|
+
const next = change(await readLatestCache(file));
|
|
94991
|
+
if (next)
|
|
94992
|
+
await writeFileAtomic(file, JSON.stringify(next));
|
|
94993
|
+
}).catch(() => void 0));
|
|
94994
|
+
const settled = run2.catch(() => void 0);
|
|
94995
|
+
cacheChanges.set(file, settled);
|
|
94996
|
+
void settled.then(() => {
|
|
94997
|
+
if (cacheChanges.get(file) === settled)
|
|
94998
|
+
cacheChanges.delete(file);
|
|
94999
|
+
});
|
|
95000
|
+
return run2;
|
|
95001
|
+
}
|
|
94661
95002
|
async function latestAgentVersion(pkg, opts = {}) {
|
|
94662
|
-
const cacheFile = opts.cacheFile ??
|
|
95003
|
+
const cacheFile = opts.cacheFile ?? defaultCacheFile2();
|
|
94663
95004
|
const now = (opts.now ?? Date.now)();
|
|
94664
95005
|
const cache4 = await readLatestCache(cacheFile);
|
|
94665
95006
|
const known = cache4[pkg];
|
|
94666
|
-
if (known && !opts.refresh && now - known.at < (opts.ttlMs ??
|
|
95007
|
+
if (known && !opts.refresh && now - known.at < (opts.ttlMs ?? HOUR_MS3))
|
|
94667
95008
|
return known.version;
|
|
94668
95009
|
const fetched = await (opts.fetchLatest ?? ((name) => fetchNpmLatest(name)))(pkg);
|
|
94669
95010
|
if (!fetched)
|
|
94670
95011
|
return known ? known.version : null;
|
|
94671
|
-
await
|
|
95012
|
+
await changeLatestCache(cacheFile, (latest) => ({ ...latest, [pkg]: { ...latest[pkg], version: fetched, at: now } }));
|
|
94672
95013
|
return fetched;
|
|
94673
95014
|
}
|
|
94674
95015
|
async function readLatestCache(file) {
|
|
@@ -94678,9 +95019,10 @@ async function readLatestCache(file) {
|
|
|
94678
95019
|
return {};
|
|
94679
95020
|
const out = {};
|
|
94680
95021
|
for (const [pkg, entry] of Object.entries(parsed)) {
|
|
94681
|
-
const { version, at } = entry ?? {};
|
|
94682
|
-
if (typeof version === "string" && typeof at === "number")
|
|
94683
|
-
out[pkg] = { version, at };
|
|
95022
|
+
const { version, at, notBrought } = entry ?? {};
|
|
95023
|
+
if (typeof version === "string" && typeof at === "number") {
|
|
95024
|
+
out[pkg] = { version, at, ...typeof notBrought === "string" ? { notBrought } : {} };
|
|
95025
|
+
}
|
|
94684
95026
|
}
|
|
94685
95027
|
return out;
|
|
94686
95028
|
} catch {
|
|
@@ -94689,14 +95031,22 @@ async function readLatestCache(file) {
|
|
|
94689
95031
|
}
|
|
94690
95032
|
async function checkAgentCli(desc, opts = {}, deps = {}) {
|
|
94691
95033
|
const refresh = opts.refresh === true;
|
|
94692
|
-
const
|
|
94693
|
-
|
|
94694
|
-
|
|
94695
|
-
]
|
|
95034
|
+
const found = await installedVersion(desc, opts);
|
|
95035
|
+
const source = versionSourceOf(desc, found.file, opts);
|
|
95036
|
+
const offered = deps.latest ? await deps.latest(desc.npmPackage, { refresh }) : await latestAgentVersion(source.key, { refresh, fetchLatest: source.fetch, ...cacheOption(opts) });
|
|
95037
|
+
const notBrought = (await readLatestCache(opts.cacheFile ?? defaultCacheFile2()))[source.key]?.notBrought;
|
|
95038
|
+
const blocked = deps.blocked ? await deps.blocked({ refresh }) : deps.latest ? BUNDLED_BLOCKED_AGENT_VERSIONS : await blockedAgentVersions({ refresh, cacheFile: blockedCacheFileFor(opts), ...opts.fetchImpl ? { fetchImpl: opts.fetchImpl } : {} });
|
|
95039
|
+
const heldBack = offered ? blockedAgentVersion(blocked, desc.command, offered) : void 0;
|
|
95040
|
+
const latest = offered && (offered === notBrought || heldBack) ? found.version : offered;
|
|
95041
|
+
const brokenInstalled = found.version ? blockedAgentVersion(blocked, desc.command, found.version) : void 0;
|
|
95042
|
+
const knownIssue = brokenInstalled ?? heldBack;
|
|
95043
|
+
const origin = found.file ? agentCliOrigin(desc, found.file, originOptions(opts)) : null;
|
|
95044
|
+
const manualUpdate = found.file && origin ? manualUpdateOf(agentCliUpdatePlan(desc, found.file, origin), found.file, opts) : null;
|
|
94696
95045
|
const base = {
|
|
94697
95046
|
command: desc.command,
|
|
94698
95047
|
installed: found.version,
|
|
94699
|
-
...found.file ? { path: found.file, origin:
|
|
95048
|
+
...found.file && origin ? { path: found.file, origin: origin.origin } : {},
|
|
95049
|
+
...manualUpdate ? { manualUpdate } : {},
|
|
94700
95050
|
latest,
|
|
94701
95051
|
minimum: desc.minimumVersion,
|
|
94702
95052
|
checkedAt: (deps.now ?? Date.now)()
|
|
@@ -94704,7 +95054,11 @@ async function checkAgentCli(desc, opts = {}, deps = {}) {
|
|
|
94704
95054
|
if (!found.present)
|
|
94705
95055
|
return { state: "missing", ...base };
|
|
94706
95056
|
const signIn = deps.signIn ? await deps.signIn() : void 0;
|
|
94707
|
-
const known = {
|
|
95057
|
+
const known = {
|
|
95058
|
+
...base,
|
|
95059
|
+
...signIn ? { signedIn: signIn.signedIn, account: signIn.account ?? null } : {},
|
|
95060
|
+
...knownIssue ? { knownIssue } : {}
|
|
95061
|
+
};
|
|
94708
95062
|
if (!found.version)
|
|
94709
95063
|
return { state: "unknown", ...known };
|
|
94710
95064
|
if (compareVersions(found.version, desc.minimumVersion) < 0)
|
|
@@ -94713,6 +95067,26 @@ async function checkAgentCli(desc, opts = {}, deps = {}) {
|
|
|
94713
95067
|
return { state: "update-available", ...known };
|
|
94714
95068
|
return { state: "current", ...known };
|
|
94715
95069
|
}
|
|
95070
|
+
function defaultCacheFile2() {
|
|
95071
|
+
return moxxyPath("cache", "agent-cli-latest.json");
|
|
95072
|
+
}
|
|
95073
|
+
function cacheOption(opts) {
|
|
95074
|
+
return opts.cacheFile ? { cacheFile: opts.cacheFile } : {};
|
|
95075
|
+
}
|
|
95076
|
+
function blockedCacheFileFor(opts) {
|
|
95077
|
+
return opts.cacheFile ? path3__default.join(path3__default.dirname(opts.cacheFile), "agent-cli-blocked.json") : defaultBlockedCacheFile();
|
|
95078
|
+
}
|
|
95079
|
+
async function heldBackUpdate(desc, file, opts) {
|
|
95080
|
+
const latest = (await readLatestCache(opts.cacheFile ?? defaultCacheFile2()))[versionSourceOf(desc, file, opts).key]?.version;
|
|
95081
|
+
return latest ? blockedAgentVersion(await cachedBlockedAgentVersions(blockedCacheFileFor(opts)), desc.command, latest) : void 0;
|
|
95082
|
+
}
|
|
95083
|
+
function versionSourceOf(desc, file, opts) {
|
|
95084
|
+
const source = file ? agentCliOrigin(desc, file, originOptions(opts)) : { origin: "unknown" };
|
|
95085
|
+
return agentVersionSource(desc, source, {
|
|
95086
|
+
...opts.home !== void 0 ? { home: opts.home } : {},
|
|
95087
|
+
...opts.fetchImpl ? { fetchImpl: opts.fetchImpl } : {}
|
|
95088
|
+
});
|
|
95089
|
+
}
|
|
94716
95090
|
function originOptions(opts) {
|
|
94717
95091
|
return { ...opts.home !== void 0 ? { home: opts.home } : {}, ...opts.platform !== void 0 ? { platform: opts.platform } : {} };
|
|
94718
95092
|
}
|
|
@@ -94757,44 +95131,111 @@ function installInvocation(desc, platform2 = process.platform) {
|
|
|
94757
95131
|
}
|
|
94758
95132
|
async function runAgentCliAction(desc, action, opts = {}) {
|
|
94759
95133
|
const platform2 = opts.platform ?? process.platform;
|
|
94760
|
-
|
|
94761
|
-
|
|
94762
|
-
|
|
94763
|
-
|
|
94764
|
-
|
|
94765
|
-
|
|
95134
|
+
if (action === "update")
|
|
95135
|
+
return updateAgentCli(desc, opts, platform2);
|
|
95136
|
+
const { command, args } = installInvocation(desc, platform2);
|
|
95137
|
+
const child = spawn(command, [...args], {
|
|
95138
|
+
env: { ...process.env, ...desc.installEnv },
|
|
95139
|
+
stdio: UPDATER_STDIO,
|
|
95140
|
+
detached: platform2 !== "win32",
|
|
95141
|
+
windowsHide: true
|
|
95142
|
+
});
|
|
95143
|
+
return watch(child, opts, "the installer");
|
|
95144
|
+
}
|
|
95145
|
+
async function updateAgentCli(desc, opts, platform2) {
|
|
95146
|
+
const found = findAgentCli(desc, opts);
|
|
95147
|
+
if (!found)
|
|
95148
|
+
return { ok: false, message: `${desc.name} is not installed.` };
|
|
95149
|
+
const source = agentCliOrigin(desc, found, originOptions(opts));
|
|
95150
|
+
if (source.origin === "app")
|
|
95151
|
+
return { ok: false, message: `The ${desc.name} at ${found} is part of ${source.app ?? "an app"} and updates with it.` };
|
|
95152
|
+
const plan = agentCliUpdatePlan(desc, found, source);
|
|
95153
|
+
if (plan.kind === "manual")
|
|
95154
|
+
return { ok: false, message: `Moxxy cannot update the ${desc.name} at ${found}: ${plan.hint}.` };
|
|
95155
|
+
const held = opts.cacheFile ? await heldBackUpdate(desc, found, opts) : void 0;
|
|
95156
|
+
if (held) {
|
|
95157
|
+
return {
|
|
95158
|
+
ok: false,
|
|
95159
|
+
message: `${desc.name} ${held.version}, the newest, has a known problem with Moxxy: ${held.reason}. Moxxy holds the update back until a fixed version is out.`
|
|
95160
|
+
};
|
|
95161
|
+
}
|
|
95162
|
+
const before = opts.cacheFile ? (await installedVersion(desc, opts)).version : null;
|
|
95163
|
+
const updater = await startUpdater(desc, found, source, plan, opts, platform2);
|
|
95164
|
+
if ("refused" in updater)
|
|
95165
|
+
return updater.refused;
|
|
95166
|
+
const result = await watch(updater.child, opts, `"${updater.command}"`);
|
|
95167
|
+
return result.ok && before ? whatTheUpdateLeft(desc, found, before, result, opts) : result;
|
|
95168
|
+
}
|
|
95169
|
+
async function startUpdater(desc, found, source, plan, opts, platform2) {
|
|
95170
|
+
if (source.winget && platform2 === "win32") {
|
|
95171
|
+
const args2 = [...wingetArgs("upgrade", source.winget.id), "--silent", "--accept-package-agreements"];
|
|
95172
|
+
return { child: spawn("winget", args2, { stdio: UPDATER_STDIO, windowsHide: true }), command: ["winget", ...args2].join(" ") };
|
|
95173
|
+
}
|
|
95174
|
+
if (plan.kind === "run") {
|
|
95175
|
+
const command = [plan.command, ...plan.args].join(" ");
|
|
95176
|
+
const tool = agentCliToolTarget(plan, found, opts);
|
|
95177
|
+
if (!tool)
|
|
95178
|
+
return { refused: { ok: false, message: `Moxxy cannot update the ${desc.name} at ${found}: run ${command}.` } };
|
|
95179
|
+
const child2 = spawnExecutableTarget(tool, plan.args, {
|
|
95180
|
+
cwd: path3__default.dirname(found),
|
|
95181
|
+
...plan.env ? { env: plan.env } : {},
|
|
95182
|
+
stdio: UPDATER_STDIO,
|
|
94766
95183
|
detached: platform2 !== "win32",
|
|
94767
95184
|
windowsHide: true
|
|
94768
95185
|
});
|
|
94769
|
-
|
|
94770
|
-
|
|
94771
|
-
|
|
94772
|
-
|
|
94773
|
-
const
|
|
94774
|
-
|
|
94775
|
-
|
|
94776
|
-
|
|
94777
|
-
|
|
94778
|
-
|
|
94779
|
-
|
|
94780
|
-
|
|
94781
|
-
|
|
94782
|
-
|
|
94783
|
-
|
|
95186
|
+
return { child: child2, command };
|
|
95187
|
+
}
|
|
95188
|
+
const brew = source.homebrew && platform2 !== "win32" ? path3__default.posix.join(source.homebrew.prefix, "bin", "brew") : null;
|
|
95189
|
+
if (brew && source.homebrew && existsSync(brew)) {
|
|
95190
|
+
const args2 = ["upgrade", ...source.homebrew.cask ? ["--cask"] : [], source.homebrew.name];
|
|
95191
|
+
return { child: spawn(brew, args2, { stdio: UPDATER_STDIO, detached: true }), command: ["brew", ...args2].join(" ") };
|
|
95192
|
+
}
|
|
95193
|
+
let target;
|
|
95194
|
+
try {
|
|
95195
|
+
target = agentCliTargetAt(desc, found, { platform: platform2 });
|
|
95196
|
+
} catch (err) {
|
|
95197
|
+
return { refused: { ok: false, message: err instanceof Error ? err.message : String(err) } };
|
|
95198
|
+
}
|
|
95199
|
+
const args = await updateArgsFor(desc, target, opts);
|
|
95200
|
+
const child = spawnExecutableTarget(target, args, {
|
|
95201
|
+
env: updaterEnv(found, opts.hostPathDirs ?? [], process.env, platform2),
|
|
95202
|
+
stdio: UPDATER_STDIO,
|
|
95203
|
+
detached: platform2 !== "win32",
|
|
95204
|
+
windowsHide: true
|
|
95205
|
+
});
|
|
95206
|
+
return { child, command: [desc.command, ...args].join(" ") };
|
|
95207
|
+
}
|
|
95208
|
+
async function versionAfterUpdate(desc, opts) {
|
|
95209
|
+
for (let attempt = 1; ; attempt += 1) {
|
|
95210
|
+
const file = findAgentCli(desc, opts);
|
|
95211
|
+
let runs = false;
|
|
95212
|
+
if (file) {
|
|
94784
95213
|
try {
|
|
94785
|
-
target = agentCliTargetAt(desc,
|
|
94786
|
-
|
|
94787
|
-
|
|
95214
|
+
const target = agentCliTargetAt(desc, file, { platform: opts.platform ?? process.platform });
|
|
95215
|
+
runs = true;
|
|
95216
|
+
const version = await readCliVersion(target);
|
|
95217
|
+
if (version)
|
|
95218
|
+
return version;
|
|
95219
|
+
} catch {
|
|
95220
|
+
runs = false;
|
|
94788
95221
|
}
|
|
94789
|
-
child = spawnExecutableTarget(target, await updateArgsFor(desc, target, opts), {
|
|
94790
|
-
env: updaterEnv(found, opts.hostPathDirs ?? [], process.env, platform2),
|
|
94791
|
-
stdio: ["ignore", "pipe", "pipe"],
|
|
94792
|
-
detached: platform2 !== "win32",
|
|
94793
|
-
windowsHide: true
|
|
94794
|
-
});
|
|
94795
95222
|
}
|
|
95223
|
+
if (attempt === VERSION_TRIES)
|
|
95224
|
+
return runs ? "silent" : "gone";
|
|
95225
|
+
await setTimeout$1(opts.versionRetryMs ?? VERSION_RETRY_MS);
|
|
94796
95226
|
}
|
|
94797
|
-
|
|
95227
|
+
}
|
|
95228
|
+
async function whatTheUpdateLeft(desc, found, before, result, opts) {
|
|
95229
|
+
const after = await versionAfterUpdate(desc, opts);
|
|
95230
|
+
if (after === "gone")
|
|
95231
|
+
return { ok: false, outcome: "gone", message: `${desc.name} no longer runs after the update; install it again.` };
|
|
95232
|
+
if (after === "silent")
|
|
95233
|
+
return { ok: true, outcome: "unverified", message: `The update ended, but ${desc.name} did not say its version. It may need a restart.` };
|
|
95234
|
+
if (after !== before)
|
|
95235
|
+
return { ...result, outcome: "updated" };
|
|
95236
|
+
if (opts.cacheFile)
|
|
95237
|
+
await rememberNotBrought(opts.cacheFile, versionSourceOf(desc, found, opts).key);
|
|
95238
|
+
return { ok: true, outcome: "unchanged", message: `${desc.name} is still ${before}. A new version may show after a restart.` };
|
|
94798
95239
|
}
|
|
94799
95240
|
async function updateArgsFor(desc, target, opts) {
|
|
94800
95241
|
if (!desc.majorUpdateArgs)
|
|
@@ -94803,12 +95244,18 @@ async function updateArgsFor(desc, target, opts) {
|
|
|
94803
95244
|
readCliVersion(target),
|
|
94804
95245
|
(opts.latest ?? ((pkg) => latestAgentVersion(pkg)))(desc.npmPackage).catch(() => null)
|
|
94805
95246
|
]);
|
|
94806
|
-
|
|
95247
|
+
const canMove = installed && compareVersions(installed, desc.minimumVersion) >= 0;
|
|
95248
|
+
return canMove && latest && majorOf(installed) < majorOf(latest) ? desc.majorUpdateArgs : desc.updateArgs;
|
|
94807
95249
|
}
|
|
94808
95250
|
function majorOf(version) {
|
|
94809
95251
|
return Number.parseInt(version, 10);
|
|
94810
95252
|
}
|
|
94811
|
-
function
|
|
95253
|
+
function askedQuestion(text3) {
|
|
95254
|
+
const line = text3.split(/\r\n|\r|\n/).find((candidate) => ASKS_TO_CONFIRM.test(candidate)) ?? "";
|
|
95255
|
+
return line.replace(/^[^\p{L}\p{N}(]+/u, "").trim();
|
|
95256
|
+
}
|
|
95257
|
+
function watch(child, opts, runIt) {
|
|
95258
|
+
const limitMs = opts.silenceLimitMs ?? SILENCE_LIMIT_MS;
|
|
94812
95259
|
return new Promise((resolve20) => {
|
|
94813
95260
|
let settled = false;
|
|
94814
95261
|
const last = { stdout: "", stderr: "" };
|
|
@@ -94816,13 +95263,22 @@ function watch(child, opts) {
|
|
|
94816
95263
|
if (settled)
|
|
94817
95264
|
return;
|
|
94818
95265
|
settled = true;
|
|
95266
|
+
clearTimeout(silence);
|
|
94819
95267
|
opts.signal?.removeEventListener("abort", stop);
|
|
94820
95268
|
resolve20(result);
|
|
94821
95269
|
};
|
|
94822
|
-
const
|
|
95270
|
+
const end = (message) => {
|
|
94823
95271
|
killTree$1(child, "SIGTERM");
|
|
94824
|
-
finish({ ok: false, message
|
|
95272
|
+
finish({ ok: false, message });
|
|
95273
|
+
};
|
|
95274
|
+
const stop = () => end("Stopped.");
|
|
95275
|
+
let silence;
|
|
95276
|
+
const heard = () => {
|
|
95277
|
+
clearTimeout(silence);
|
|
95278
|
+
silence = setTimeout(() => end(`Stopped: nothing printed for ${Math.round(limitMs / 6e4)} minutes.`), limitMs);
|
|
95279
|
+
silence.unref();
|
|
94825
95280
|
};
|
|
95281
|
+
heard();
|
|
94826
95282
|
if (opts.signal?.aborted) {
|
|
94827
95283
|
stop();
|
|
94828
95284
|
return;
|
|
@@ -94841,6 +95297,12 @@ function watch(child, opts) {
|
|
|
94841
95297
|
for (const stream2 of ["stdout", "stderr"]) {
|
|
94842
95298
|
let pending = "";
|
|
94843
95299
|
child[stream2]?.on("data", (chunk) => {
|
|
95300
|
+
heard();
|
|
95301
|
+
const text3 = (pending + chunk.toString("utf8")).replace(ANSI, "");
|
|
95302
|
+
if (ASKS_TO_CONFIRM.test(text3)) {
|
|
95303
|
+
end(`It asked to confirm, and Moxxy cannot answer: "${askedQuestion(text3)}" Run ${runIt} in a terminal.`);
|
|
95304
|
+
return;
|
|
95305
|
+
}
|
|
94844
95306
|
const parts = (pending + chunk.toString("utf8")).split(/\r\n|\r|\n/);
|
|
94845
95307
|
pending = parts.pop() ?? "";
|
|
94846
95308
|
for (const part of parts)
|
|
@@ -94857,10 +95319,11 @@ function watch(child, opts) {
|
|
|
94857
95319
|
});
|
|
94858
95320
|
});
|
|
94859
95321
|
}
|
|
94860
|
-
var CLAUDE_CLI, CODEX_WINDOWS_BUILDS, CODEX_CLI, OPENCODE_CLI, AGENT_CLIS, PATH_FALLBACK_ENV, WINDOWS_NATIVE, WINDOWS_SHIMS,
|
|
95322
|
+
var CLAUDE_CLI, CODEX_WINDOWS_BUILDS, CODEX_CLI, OPENCODE_CLI, AGENT_CLIS, PATH_FALLBACK_ENV, PACKAGE_TOOLS, MISE_PATH, WINDOWS_NATIVE, WINDOWS_SHIMS, SHIM_TARGET, HOUR_MS3, SOURCE_TIMEOUT_MS, cacheChanges, UPDATER_STDIO, VERSION_TRIES, VERSION_RETRY_MS, SILENCE_LIMIT_MS, ASKS_TO_CONFIRM, ANSI, PERCENT;
|
|
94861
95323
|
var init_agent_cli2 = __esm({
|
|
94862
95324
|
"../agent-connection-kit/dist/agent-cli.js"() {
|
|
94863
95325
|
init_cli_version();
|
|
95326
|
+
init_agent_versions_blocked2();
|
|
94864
95327
|
CLAUDE_CLI = {
|
|
94865
95328
|
name: "Claude Code",
|
|
94866
95329
|
command: "claude",
|
|
@@ -94868,6 +95331,12 @@ var init_agent_cli2 = __esm({
|
|
|
94868
95331
|
npmPackage: "@anthropic-ai/claude-code",
|
|
94869
95332
|
minimumVersion: "2.1.296",
|
|
94870
95333
|
updateArgs: ["update"],
|
|
95334
|
+
releaseChannel: {
|
|
95335
|
+
url: (channel) => `https://downloads.claude.ai/claude-code-releases/${encodeURIComponent(channel)}`,
|
|
95336
|
+
settingsFile: ".claude/settings.json",
|
|
95337
|
+
setting: "autoUpdatesChannel",
|
|
95338
|
+
fallback: "latest"
|
|
95339
|
+
},
|
|
94871
95340
|
install: { posix: "curl -fsSL https://claude.ai/install.sh | bash", windows: "irm https://claude.ai/install.ps1 | iex" },
|
|
94872
95341
|
installDirs: [".local/bin"],
|
|
94873
95342
|
windowsShim: { entry: "node_modules/@anthropic-ai/claude-code/cli.js", runs: "node" }
|
|
@@ -94898,6 +95367,7 @@ var init_agent_cli2 = __esm({
|
|
|
94898
95367
|
command: "opencode",
|
|
94899
95368
|
executableEnv: "OPENCODE_EXECUTABLE",
|
|
94900
95369
|
npmPackage: "@opencode/cli",
|
|
95370
|
+
legacyNpmPackages: ["opencode-ai"],
|
|
94901
95371
|
minimumVersion: "1.19.0",
|
|
94902
95372
|
updateArgs: ["upgrade"],
|
|
94903
95373
|
// OpenCode 1's `upgrade` stays on 1; `--major` replaces it with OpenCode 2 the way it was installed.
|
|
@@ -94918,9 +95388,35 @@ var init_agent_cli2 = __esm({
|
|
|
94918
95388
|
opencode: OPENCODE_CLI
|
|
94919
95389
|
};
|
|
94920
95390
|
PATH_FALLBACK_ENV = "MOXXY_PATH_FALLBACK";
|
|
95391
|
+
PACKAGE_TOOLS = [
|
|
95392
|
+
{
|
|
95393
|
+
origin: "vite-plus",
|
|
95394
|
+
owns: /\/(?:\.vite-plus|\.local\/share\/vite-plus|appdata\/local\/vite-plus)\/bin\//,
|
|
95395
|
+
command: "vp",
|
|
95396
|
+
args: (pkg) => ["i", "-g", pkg]
|
|
95397
|
+
},
|
|
95398
|
+
{ origin: "bun", owns: /\/\.bun\/bin\//, command: "bun", args: (pkg) => ["i", "-g", `${pkg}@latest`] },
|
|
95399
|
+
{
|
|
95400
|
+
origin: "pnpm",
|
|
95401
|
+
owns: /\/(?:\.local\/share\/pnpm|library\/pnpm|local\/share\/pnpm|appdata\/local\/pnpm|pnpm\/global)\//,
|
|
95402
|
+
command: "pnpm",
|
|
95403
|
+
args: (pkg) => ["add", "-g", `${pkg}@latest`]
|
|
95404
|
+
},
|
|
95405
|
+
{ origin: "yarn", owns: /\/(?:\.yarn|local\/yarn)\/bin\/|\/yarn\/(?:data\/)?global\/node_modules\//, command: "yarn", args: (pkg) => ["global", "add", `${pkg}@latest`] },
|
|
95406
|
+
{ origin: "volta", owns: /\/(?:\.volta|local\/volta)\/bin\//, command: "volta", args: (pkg) => ["install", `${pkg}@latest`] }
|
|
95407
|
+
];
|
|
95408
|
+
MISE_PATH = /\/mise\/(?:installs|shims)\//;
|
|
94921
95409
|
WINDOWS_NATIVE = /* @__PURE__ */ new Set([".exe", ".com"]);
|
|
94922
95410
|
WINDOWS_SHIMS = /* @__PURE__ */ new Set([".cmd", ".bat", ".ps1"]);
|
|
94923
|
-
|
|
95411
|
+
SHIM_TARGET = /"%(?:~dp0|dp0%)\\?([^"]+)"/g;
|
|
95412
|
+
HOUR_MS3 = 60 * 6e4;
|
|
95413
|
+
SOURCE_TIMEOUT_MS = 2e4;
|
|
95414
|
+
cacheChanges = /* @__PURE__ */ new Map();
|
|
95415
|
+
UPDATER_STDIO = ["ignore", "pipe", "pipe"];
|
|
95416
|
+
VERSION_TRIES = 3;
|
|
95417
|
+
VERSION_RETRY_MS = 2e3;
|
|
95418
|
+
SILENCE_LIMIT_MS = 10 * 6e4;
|
|
95419
|
+
ASKS_TO_CONFIRM = /\b(?:install anyways|continue anyway|proceed)\?|\(y\/n\)|\[y\/n\]/i;
|
|
94924
95420
|
ANSI = /\x1b\[[0-9;?]*[A-Za-z]/g;
|
|
94925
95421
|
PERCENT = /(\d{1,3}(?:\.\d+)?)%/;
|
|
94926
95422
|
}
|
|
@@ -94948,6 +95444,12 @@ var init_stop_agent = __esm({
|
|
|
94948
95444
|
}
|
|
94949
95445
|
});
|
|
94950
95446
|
|
|
95447
|
+
// ../agent-connection-kit/dist/agent-env.js
|
|
95448
|
+
var init_agent_env = __esm({
|
|
95449
|
+
"../agent-connection-kit/dist/agent-env.js"() {
|
|
95450
|
+
}
|
|
95451
|
+
});
|
|
95452
|
+
|
|
94951
95453
|
// ../agent-connection-kit/dist/index.js
|
|
94952
95454
|
var init_dist34 = __esm({
|
|
94953
95455
|
"../agent-connection-kit/dist/index.js"() {
|
|
@@ -94959,10 +95461,12 @@ var init_dist34 = __esm({
|
|
|
94959
95461
|
init_modes3();
|
|
94960
95462
|
init_cli_version();
|
|
94961
95463
|
init_agent_cli2();
|
|
95464
|
+
init_agent_versions_blocked2();
|
|
94962
95465
|
init_inbox();
|
|
94963
95466
|
init_one_off_prompt();
|
|
94964
95467
|
init_resume();
|
|
94965
95468
|
init_stop_agent();
|
|
95469
|
+
init_agent_env();
|
|
94966
95470
|
}
|
|
94967
95471
|
});
|
|
94968
95472
|
|
|
@@ -94987,7 +95491,10 @@ async function runAgentsCommand(argv, deps = {}) {
|
|
|
94987
95491
|
if (action === "status") {
|
|
94988
95492
|
const reports = await Promise.all(
|
|
94989
95493
|
Object.entries(agents).map(
|
|
94990
|
-
async ([connection, desc2]) => [connection, desc2, await checkAgentCli(desc2, { ...search, refresh: true },
|
|
95494
|
+
async ([connection, desc2]) => [connection, desc2, await checkAgentCli(desc2, { ...search, refresh: true }, {
|
|
95495
|
+
...deps.latest ? { latest: deps.latest } : {},
|
|
95496
|
+
...deps.blocked ? { blocked: deps.blocked } : {}
|
|
95497
|
+
})]
|
|
94991
95498
|
)
|
|
94992
95499
|
);
|
|
94993
95500
|
if (hasBoolFlag(argv, "json")) {
|
|
@@ -95018,6 +95525,7 @@ async function runAgentsCommand(argv, deps = {}) {
|
|
|
95018
95525
|
}
|
|
95019
95526
|
const result = await runAgentCliAction(desc, action, {
|
|
95020
95527
|
...search,
|
|
95528
|
+
cacheFile: defaultCacheFile2(),
|
|
95021
95529
|
onLine: (line) => out(`${colors.dim(line)}
|
|
95022
95530
|
`)
|
|
95023
95531
|
});
|
|
@@ -95039,17 +95547,19 @@ function agentNames(agents) {
|
|
|
95039
95547
|
function describe2(desc, report2) {
|
|
95040
95548
|
const app = agentCliApp(report2);
|
|
95041
95549
|
const fix = app ? `part of ${app}, which updates it` : `moxxy agents update ${desc.command}`;
|
|
95550
|
+
const issue2 = agentCliKnownIssue(report2);
|
|
95551
|
+
const heldBack = agentCliHeldBack(report2);
|
|
95042
95552
|
switch (report2.state) {
|
|
95043
95553
|
case "missing":
|
|
95044
95554
|
return `not installed \xB7 moxxy agents install ${desc.command}`;
|
|
95045
95555
|
case "update-required":
|
|
95046
|
-
return colors.yellow(`update required \u2014 Moxxy works with ${report2.minimum} or newer \xB7 ${fix}`);
|
|
95556
|
+
return colors.yellow(`update required \u2014 Moxxy works with ${report2.minimum} or newer \xB7 ${heldBack ?? fix}`);
|
|
95047
95557
|
case "update-available":
|
|
95048
95558
|
return `${report2.latest ?? "a newer version"} is out \xB7 ${fix}`;
|
|
95049
95559
|
case "unknown":
|
|
95050
95560
|
return colors.yellow("installed, but its version could not be read");
|
|
95051
95561
|
case "current":
|
|
95052
|
-
return colors.green("up to date");
|
|
95562
|
+
return issue2 ? colors.yellow(issue2) : colors.green("up to date");
|
|
95053
95563
|
}
|
|
95054
95564
|
}
|
|
95055
95565
|
var HELP7;
|
|
@@ -98060,9 +98570,11 @@ function buildAgentCliDoctorChecks(entries, configured) {
|
|
|
98060
98570
|
const found = `${agentName} ${report2.installed ?? ""}`.trim() + (file ? ` at ${file}` : "");
|
|
98061
98571
|
const app = agentCliApp(report2);
|
|
98062
98572
|
const fix = app ? `it is part of ${app}, which updates it` : `moxxy agents update ${command}`;
|
|
98573
|
+
const issue2 = agentCliKnownIssue(report2);
|
|
98574
|
+
const heldBack = agentCliHeldBack(report2);
|
|
98063
98575
|
switch (report2.state) {
|
|
98064
98576
|
case "current":
|
|
98065
|
-
return { id, status: "ok", message: `${found}, the latest` };
|
|
98577
|
+
return issue2 ? { id, status: "warn", message: `${found}; ${issue2}` } : { id, status: "ok", message: `${found}, the latest` };
|
|
98066
98578
|
case "update-available":
|
|
98067
98579
|
return {
|
|
98068
98580
|
id,
|
|
@@ -98073,7 +98585,7 @@ function buildAgentCliDoctorChecks(entries, configured) {
|
|
|
98073
98585
|
return {
|
|
98074
98586
|
id,
|
|
98075
98587
|
status: used ? "fail" : "warn",
|
|
98076
|
-
message: `${found} is older than ${report2.minimum}, the oldest Moxxy works with \u2014 ${fix}`
|
|
98588
|
+
message: `${found} is older than ${report2.minimum}, the oldest Moxxy works with \u2014 ${heldBack ?? fix}`
|
|
98077
98589
|
};
|
|
98078
98590
|
case "missing":
|
|
98079
98591
|
return used ? { id, status: "fail", message: `${agentName} is not installed \u2014 moxxy agents install ${command}` } : { id, status: "ok", message: `${agentName} is not installed \u2014 moxxy agents install ${command} to use it` };
|
|
@@ -100877,7 +101389,7 @@ async function waitForChannelStatus(name, def) {
|
|
|
100877
101389
|
while (Date.now() < deadline) {
|
|
100878
101390
|
const status = liveChannelStatus(name);
|
|
100879
101391
|
if (status && (!needsUrl || status.requestUrl)) return status;
|
|
100880
|
-
await
|
|
101392
|
+
await delay4(POLL_MS);
|
|
100881
101393
|
}
|
|
100882
101394
|
return liveChannelStatus(name);
|
|
100883
101395
|
}
|
|
@@ -100885,7 +101397,7 @@ async function waitForChannelGone(name) {
|
|
|
100885
101397
|
const deadline = Date.now() + STOP_GRACE_MS2;
|
|
100886
101398
|
while (Date.now() < deadline) {
|
|
100887
101399
|
if (!liveChannelStatus(name)) return true;
|
|
100888
|
-
await
|
|
101400
|
+
await delay4(POLL_MS);
|
|
100889
101401
|
}
|
|
100890
101402
|
return liveChannelStatus(name) === null;
|
|
100891
101403
|
}
|
|
@@ -100928,7 +101440,7 @@ function formatSubcommandHelp(channelName, subName, sub) {
|
|
|
100928
101440
|
lines.push(` ${colors.dim(sub.description)}`);
|
|
100929
101441
|
return lines.join("\n") + "\n";
|
|
100930
101442
|
}
|
|
100931
|
-
var HELP22, START_TIMEOUT_MS2, STOP_GRACE_MS2, POLL_MS,
|
|
101443
|
+
var HELP22, START_TIMEOUT_MS2, STOP_GRACE_MS2, POLL_MS, delay4;
|
|
100932
101444
|
var init_channels2 = __esm({
|
|
100933
101445
|
async "src/commands/channels.ts"() {
|
|
100934
101446
|
await init_argv_helpers();
|
|
@@ -100958,7 +101470,7 @@ var init_channels2 = __esm({
|
|
|
100958
101470
|
START_TIMEOUT_MS2 = 15e3;
|
|
100959
101471
|
STOP_GRACE_MS2 = 4e3;
|
|
100960
101472
|
POLL_MS = 300;
|
|
100961
|
-
|
|
101473
|
+
delay4 = (ms) => new Promise((r2) => setTimeout(r2, ms));
|
|
100962
101474
|
}
|
|
100963
101475
|
});
|
|
100964
101476
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@moxxy/cli",
|
|
3
|
-
"version": "0.48.
|
|
3
|
+
"version": "0.48.4",
|
|
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": "^8.12.2",
|
|
51
51
|
"zod": "^4.6.7",
|
|
52
|
-
"@moxxy/sdk": "0.48.
|
|
52
|
+
"@moxxy/sdk": "0.48.4"
|
|
53
53
|
},
|
|
54
54
|
"optionalDependencies": {
|
|
55
55
|
"@napi-rs/keyring": "^2.1.2"
|