nexrall-code 0.5.109 → 0.5.111
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.js +302 -102
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -3182,10 +3182,11 @@ var require_auth = __commonJS({
|
|
|
3182
3182
|
exports2.saveAuth = saveAuth2;
|
|
3183
3183
|
exports2.loadAuth = loadAuth2;
|
|
3184
3184
|
exports2.clearAuth = clearAuth2;
|
|
3185
|
-
exports2.isAuthenticated =
|
|
3185
|
+
exports2.isAuthenticated = isAuthenticated4;
|
|
3186
3186
|
exports2.getToken = getToken;
|
|
3187
3187
|
exports2.getRefreshToken = getRefreshToken;
|
|
3188
3188
|
exports2.updateTokens = updateTokens;
|
|
3189
|
+
exports2.getBillingTeamOverride = getBillingTeamOverride;
|
|
3189
3190
|
var fs9 = __importStar(__require("fs"));
|
|
3190
3191
|
var path8 = __importStar(__require("path"));
|
|
3191
3192
|
var os6 = __importStar(__require("os"));
|
|
@@ -3227,7 +3228,7 @@ var require_auth = __commonJS({
|
|
|
3227
3228
|
} catch {
|
|
3228
3229
|
}
|
|
3229
3230
|
}
|
|
3230
|
-
function
|
|
3231
|
+
function isAuthenticated4() {
|
|
3231
3232
|
const auth = loadAuth2();
|
|
3232
3233
|
return auth !== null && auth.token.length > 0;
|
|
3233
3234
|
}
|
|
@@ -3263,6 +3264,22 @@ var require_auth = __commonJS({
|
|
|
3263
3264
|
};
|
|
3264
3265
|
fs9.writeFileSync(CONFIG_FILE, JSON.stringify(next, null, 2), { mode: 384 });
|
|
3265
3266
|
}
|
|
3267
|
+
function getBillingTeamOverride() {
|
|
3268
|
+
const raw = process.env.NEXRALL_BILLING_TEAM;
|
|
3269
|
+
if (raw != null && raw !== "") {
|
|
3270
|
+
const trimmed = raw.trim();
|
|
3271
|
+
if (/^(personal|null|0)$/i.test(trimmed))
|
|
3272
|
+
return null;
|
|
3273
|
+
if (/^\d+$/.test(trimmed)) {
|
|
3274
|
+
const n = Number(trimmed);
|
|
3275
|
+
if (Number.isSafeInteger(n) && n > 0)
|
|
3276
|
+
return n;
|
|
3277
|
+
}
|
|
3278
|
+
}
|
|
3279
|
+
if (process.env.NEXRALL_TOKEN)
|
|
3280
|
+
return null;
|
|
3281
|
+
return void 0;
|
|
3282
|
+
}
|
|
3266
3283
|
}
|
|
3267
3284
|
});
|
|
3268
3285
|
|
|
@@ -9903,6 +9920,9 @@ var require_client = __commonJS({
|
|
|
9903
9920
|
exports2.revokeRefreshToken = revokeRefreshToken2;
|
|
9904
9921
|
exports2.describeAttachment = describeAttachment2;
|
|
9905
9922
|
exports2.getBalance = getBalance3;
|
|
9923
|
+
exports2.billingOverrideFields = billingOverrideFields2;
|
|
9924
|
+
exports2.setBillingTarget = setBillingTarget2;
|
|
9925
|
+
exports2.getOrgs = getOrgs2;
|
|
9906
9926
|
exports2.getCodeModels = getCodeModels;
|
|
9907
9927
|
exports2.getUsageDaily = getUsageDaily;
|
|
9908
9928
|
exports2.exchangeVscodeCode = exchangeVscodeCode;
|
|
@@ -10091,7 +10111,7 @@ var require_client = __commonJS({
|
|
|
10091
10111
|
{
|
|
10092
10112
|
method: "POST",
|
|
10093
10113
|
headers: authHeaders(),
|
|
10094
|
-
body: JSON.stringify({ messages, model, env: env4, editorContext, nexrallMd, mode, effort, clientType, extraTools, agents, skills, turnId, canWriteSharedMemory, hasOwnAgentStore, canSpawnSubAgents, canBrowseWeb }),
|
|
10114
|
+
body: JSON.stringify({ messages, model, env: env4, editorContext, nexrallMd, mode, effort, clientType, extraTools, agents, skills, turnId, canWriteSharedMemory, hasOwnAgentStore, canSpawnSubAgents, canBrowseWeb, ...billingOverrideFields2() }),
|
|
10095
10115
|
signal
|
|
10096
10116
|
}
|
|
10097
10117
|
];
|
|
@@ -10271,18 +10291,31 @@ var require_client = __commonJS({
|
|
|
10271
10291
|
const errText = errorBodyOverride ?? await response.text();
|
|
10272
10292
|
let errMsg = `API error ${response.status}`;
|
|
10273
10293
|
let balance;
|
|
10294
|
+
let code;
|
|
10295
|
+
let remaining;
|
|
10296
|
+
let teamId;
|
|
10274
10297
|
try {
|
|
10275
10298
|
const parsed = JSON.parse(errText);
|
|
10276
10299
|
if (parsed.error)
|
|
10277
10300
|
errMsg = parsed.error;
|
|
10278
10301
|
if (typeof parsed.balance === "number")
|
|
10279
10302
|
balance = parsed.balance;
|
|
10303
|
+
if (typeof parsed.code === "string")
|
|
10304
|
+
code = parsed.code;
|
|
10305
|
+
if (typeof parsed.remaining === "number")
|
|
10306
|
+
remaining = parsed.remaining;
|
|
10307
|
+
if (typeof parsed.teamId === "number")
|
|
10308
|
+
teamId = parsed.teamId;
|
|
10280
10309
|
} catch {
|
|
10281
10310
|
errMsg = errText || errMsg;
|
|
10282
10311
|
}
|
|
10283
10312
|
throw Object.assign(new Error(errMsg), {
|
|
10284
10313
|
status: response.status,
|
|
10285
10314
|
balance,
|
|
10315
|
+
// Team-billing context (migration 139) — see the parse above.
|
|
10316
|
+
...code ? { code } : {},
|
|
10317
|
+
...remaining !== void 0 ? { remaining } : {},
|
|
10318
|
+
...teamId !== void 0 ? { teamId } : {},
|
|
10286
10319
|
...forbiddenExhausted ? { retryable: true } : {},
|
|
10287
10320
|
...sessionExpired ? { authExpired: true } : {}
|
|
10288
10321
|
});
|
|
@@ -10650,7 +10683,7 @@ var require_client = __commonJS({
|
|
|
10650
10683
|
const fetchOnce = () => (0, node_fetch_1.default)(`${exports2.API_BASE}/api/code/assets/describe`, {
|
|
10651
10684
|
method: "POST",
|
|
10652
10685
|
headers: { ...authHeaders(), "Content-Type": "application/json" },
|
|
10653
|
-
body: JSON.stringify({ kind, data, media_type: mediaType, name })
|
|
10686
|
+
body: JSON.stringify({ kind, data, media_type: mediaType, name, ...billingOverrideFields2() })
|
|
10654
10687
|
});
|
|
10655
10688
|
let response = await fetchOnce();
|
|
10656
10689
|
if (response.status === 401 || response.status === 403) {
|
|
@@ -10695,6 +10728,48 @@ var require_client = __commonJS({
|
|
|
10695
10728
|
const data = await response.json();
|
|
10696
10729
|
return typeof data.balance === "number" ? data.balance : 0;
|
|
10697
10730
|
}
|
|
10731
|
+
function billingOverrideFields2() {
|
|
10732
|
+
const override = (0, index_1.getBillingTeamOverride)();
|
|
10733
|
+
return override === void 0 ? {} : { teamId: override };
|
|
10734
|
+
}
|
|
10735
|
+
async function setBillingTarget2(teamId) {
|
|
10736
|
+
const response = await (0, node_fetch_1.default)(`${exports2.API_BASE}/api/user/billing-target`, {
|
|
10737
|
+
method: "PUT",
|
|
10738
|
+
headers: authHeaders(),
|
|
10739
|
+
body: JSON.stringify({ teamId })
|
|
10740
|
+
});
|
|
10741
|
+
if (!response.ok) {
|
|
10742
|
+
let message = `API error ${response.status}`;
|
|
10743
|
+
try {
|
|
10744
|
+
const parsed = await response.json();
|
|
10745
|
+
if (parsed.error)
|
|
10746
|
+
message = parsed.error;
|
|
10747
|
+
} catch {
|
|
10748
|
+
}
|
|
10749
|
+
throw new Error(message);
|
|
10750
|
+
}
|
|
10751
|
+
}
|
|
10752
|
+
async function getOrgs2() {
|
|
10753
|
+
const fetchOnce = () => (0, node_fetch_1.default)(`${exports2.API_BASE}/api/code/orgs`, { method: "GET", headers: authHeaders() });
|
|
10754
|
+
let response = await fetchOnce();
|
|
10755
|
+
if (response.status === 401 || response.status === 403) {
|
|
10756
|
+
const body = await response.text().catch(() => "");
|
|
10757
|
+
if (isExpiredTokenResponse(response.status, body) && await refreshAccessToken()) {
|
|
10758
|
+
response = await fetchOnce();
|
|
10759
|
+
} else {
|
|
10760
|
+
throw new Error(`API error ${response.status}: ${body}`);
|
|
10761
|
+
}
|
|
10762
|
+
}
|
|
10763
|
+
if (!response.ok) {
|
|
10764
|
+
throw new Error(`API error ${response.status}`);
|
|
10765
|
+
}
|
|
10766
|
+
const json = await response.json();
|
|
10767
|
+
return {
|
|
10768
|
+
personal: { balance: typeof json.personal?.balance === "number" ? json.personal.balance : 0 },
|
|
10769
|
+
teams: Array.isArray(json.teams) ? json.teams : [],
|
|
10770
|
+
billingTargetTeamId: typeof json.billingTargetTeamId === "number" ? json.billingTargetTeamId : null
|
|
10771
|
+
};
|
|
10772
|
+
}
|
|
10698
10773
|
async function getCodeModels() {
|
|
10699
10774
|
const fetchOnce = () => (0, node_fetch_1.default)(`${exports2.API_BASE}/api/code/models`, { method: "GET", headers: authHeaders() });
|
|
10700
10775
|
let response = await fetchOnce();
|
|
@@ -100984,13 +101059,14 @@ var require_executor = __commonJS({
|
|
|
100984
101059
|
var child_process_1 = __require("child_process");
|
|
100985
101060
|
var sandbox_1 = require_sandbox();
|
|
100986
101061
|
var auth_1 = require_auth();
|
|
101062
|
+
var client_1 = require_client();
|
|
100987
101063
|
var editCompleteness_1 = require_editCompleteness();
|
|
100988
101064
|
var securityLint_1 = require_securityLint();
|
|
100989
101065
|
var memory_1 = require_memory();
|
|
100990
101066
|
var skills_1 = require_skills();
|
|
100991
101067
|
var testIntegrity_1 = require_testIntegrity();
|
|
100992
101068
|
var crossFile_1 = require_crossFile();
|
|
100993
|
-
var
|
|
101069
|
+
var client_2 = require_client();
|
|
100994
101070
|
var symbols_1 = require_symbols();
|
|
100995
101071
|
var tsLangService_1 = require_tsLangService();
|
|
100996
101072
|
var safeSlice_1 = require_safeSlice();
|
|
@@ -102947,7 +103023,7 @@ ${lines.join("\n")}`;
|
|
|
102947
103023
|
let cost;
|
|
102948
103024
|
let balance;
|
|
102949
103025
|
try {
|
|
102950
|
-
const r2 = await _httpsPost(`${
|
|
103026
|
+
const r2 = await _httpsPost(`${client_2.API_BASE}/api/code/assets/generate`, JSON.stringify({ prompt: prompt2, aspect_ratio: aspectRatio, ...(0, client_1.billingOverrideFields)() }), { "Content-Type": "application/json", Authorization: `Bearer ${token}` }, 17e4, abortSignal);
|
|
102951
103027
|
let json = {};
|
|
102952
103028
|
try {
|
|
102953
103029
|
json = JSON.parse(r2.body);
|
|
@@ -102996,7 +103072,7 @@ ${lines.join("\n")}`;
|
|
|
102996
103072
|
return { error: "Not authenticated. Run `nexrall-code login` first." };
|
|
102997
103073
|
let photos;
|
|
102998
103074
|
try {
|
|
102999
|
-
const u = new URL(`${
|
|
103075
|
+
const u = new URL(`${client_2.API_BASE}/api/code/assets/stock`);
|
|
103000
103076
|
u.searchParams.set("query", query);
|
|
103001
103077
|
u.searchParams.set("count", String(count));
|
|
103002
103078
|
if (orientation)
|
|
@@ -103052,7 +103128,7 @@ ${lines.join("\n")}` };
|
|
|
103052
103128
|
if (!token)
|
|
103053
103129
|
return { error: "Not authenticated. Run `nexrall-code login` first." };
|
|
103054
103130
|
try {
|
|
103055
|
-
const r2 = await _httpsPost(`${
|
|
103131
|
+
const r2 = await _httpsPost(`${client_2.API_BASE}/api/code/tools/web_search`, JSON.stringify({ query, ...(0, client_1.billingOverrideFields)() }), { "Content-Type": "application/json", Authorization: `Bearer ${token}` }, 3e4, abortSignal);
|
|
103056
103132
|
let json = {};
|
|
103057
103133
|
try {
|
|
103058
103134
|
json = JSON.parse(r2.body);
|
|
@@ -105015,6 +105091,14 @@ var require_loop = __commonJS({
|
|
|
105015
105091
|
case "no-balance":
|
|
105016
105092
|
return `
|
|
105017
105093
|
\u{1F4B3} Stopped: your balance is empty, so the request was rejected before it started. Top up and send "continue" \u2014 no tokens were used for this turn.
|
|
105094
|
+
`;
|
|
105095
|
+
case "no-team-budget":
|
|
105096
|
+
return `
|
|
105097
|
+
\u{1F4B3} Stopped: the team budget you are billing to is empty, so the request was rejected before it started. Ask your team admin to add funds \u2014 or switch "Bill to" back to Personal \u2014 and send "continue". No tokens were used for this turn.
|
|
105098
|
+
`;
|
|
105099
|
+
case "team-unavailable":
|
|
105100
|
+
return `
|
|
105101
|
+
\u26A0\uFE0F Stopped: that team is no longer available for billing (you may have been removed, or the team was suspended). "Bill to" has been reset to your Personal account, so sending "continue" will run on your own wallet.
|
|
105018
105102
|
`;
|
|
105019
105103
|
case "stalled":
|
|
105020
105104
|
return `
|
|
@@ -105037,6 +105121,13 @@ ${ctx.repeatError}
|
|
|
105037
105121
|
`;
|
|
105038
105122
|
}
|
|
105039
105123
|
}
|
|
105124
|
+
var TEAM_SCOPE_ERROR_CODES = /* @__PURE__ */ new Set([
|
|
105125
|
+
"team_unavailable",
|
|
105126
|
+
"team_not_found",
|
|
105127
|
+
"not_a_member",
|
|
105128
|
+
"member_suspended",
|
|
105129
|
+
"team_suspended"
|
|
105130
|
+
]);
|
|
105040
105131
|
function resolveMaxIterations(optionValue, settingsRaw) {
|
|
105041
105132
|
const fromEnv = Number(process.env.NEXRALL_MAX_ITERATIONS);
|
|
105042
105133
|
const fromSettings = Number(settingsRaw.maxIterations);
|
|
@@ -106356,12 +106447,24 @@ Continue the work from here.` }] });
|
|
|
106356
106447
|
break;
|
|
106357
106448
|
}
|
|
106358
106449
|
const status = err.status;
|
|
106450
|
+
const code = err.code;
|
|
106451
|
+
if (status === 402 && code === "team_budget_exhausted") {
|
|
106452
|
+
const remaining = err.remaining ?? 0;
|
|
106453
|
+
const teamId = err.teamId;
|
|
106454
|
+
options.onTeamBudgetStatus?.({ teamId, remaining });
|
|
106455
|
+
stopReason = options.onTeamBudgetStatus ? "reported-elsewhere" : "no-team-budget";
|
|
106456
|
+
break;
|
|
106457
|
+
}
|
|
106359
106458
|
if (status === 402) {
|
|
106360
106459
|
const balance = err.balance ?? 0;
|
|
106361
106460
|
options.onBalanceStatus?.(balance, true);
|
|
106362
106461
|
stopReason = options.onBalanceStatus ? "reported-elsewhere" : "no-balance";
|
|
106363
106462
|
break;
|
|
106364
106463
|
}
|
|
106464
|
+
if (status === 403 && typeof code === "string" && TEAM_SCOPE_ERROR_CODES.has(code)) {
|
|
106465
|
+
stopReason = "team-unavailable";
|
|
106466
|
+
break;
|
|
106467
|
+
}
|
|
106365
106468
|
runSimpleHooks(hooks.OnError, options.workDir);
|
|
106366
106469
|
throw new types_1.AgentTurnError(`Stream failed: ${err.message}`, trimToResumableBoundary(messages), completedRounds, err);
|
|
106367
106470
|
}
|
|
@@ -143261,7 +143364,7 @@ var chalkStderr = createChalk({ level: stderrColor ? stderrColor.level : 0 });
|
|
|
143261
143364
|
var source_default = chalk;
|
|
143262
143365
|
|
|
143263
143366
|
// src/index.ts
|
|
143264
|
-
var
|
|
143367
|
+
var import_code_core8 = __toESM(require_dist3(), 1);
|
|
143265
143368
|
|
|
143266
143369
|
// src/commands/auth.ts
|
|
143267
143370
|
import * as readline from "readline";
|
|
@@ -143385,6 +143488,90 @@ function stopSpinner(handle2) {
|
|
|
143385
143488
|
process.stdout.write("\r\x1B[K");
|
|
143386
143489
|
}
|
|
143387
143490
|
|
|
143491
|
+
// src/commands/billing.ts
|
|
143492
|
+
var import_code_core2 = __toESM(require_dist3(), 1);
|
|
143493
|
+
function money(usd) {
|
|
143494
|
+
return "$" + usd.toFixed(2);
|
|
143495
|
+
}
|
|
143496
|
+
async function requireAuth() {
|
|
143497
|
+
if ((0, import_code_core2.isAuthenticated)())
|
|
143498
|
+
return true;
|
|
143499
|
+
console.log(source_default.red("Not logged in. Run `nex auth` first."));
|
|
143500
|
+
return false;
|
|
143501
|
+
}
|
|
143502
|
+
async function billingStatusCommand() {
|
|
143503
|
+
if (!await requireAuth())
|
|
143504
|
+
return;
|
|
143505
|
+
let orgs;
|
|
143506
|
+
try {
|
|
143507
|
+
orgs = await (0, import_code_core2.getOrgs)();
|
|
143508
|
+
} catch {
|
|
143509
|
+
console.log(source_default.yellow("Could not read your billing target (offline, or a server without team support)."));
|
|
143510
|
+
return;
|
|
143511
|
+
}
|
|
143512
|
+
const targetId = orgs.billingTargetTeamId ?? null;
|
|
143513
|
+
const team = targetId == null ? null : orgs.teams.find((t2) => t2.id === targetId) ?? null;
|
|
143514
|
+
console.log("");
|
|
143515
|
+
console.log(source_default.bold("Billing target"));
|
|
143516
|
+
if (team) {
|
|
143517
|
+
console.log(` ${source_default.cyan(team.name)} ${source_default.gray(`(${money(team.remainingUsd)} left this month)`)}`);
|
|
143518
|
+
if (team.remainingUsd <= 0) {
|
|
143519
|
+
console.log(source_default.yellow(" \u26A0 This team has no budget left \u2014 ask a team admin to add funds."));
|
|
143520
|
+
}
|
|
143521
|
+
} else if (targetId != null) {
|
|
143522
|
+
console.log(` ${source_default.yellow(`team ${targetId}`)} ${source_default.gray("(not available to this account \u2014 usage falls back to your wallet)")}`);
|
|
143523
|
+
} else {
|
|
143524
|
+
console.log(` Personal wallet ${source_default.gray(`(${money(orgs.personal.balance)} available)`)}`);
|
|
143525
|
+
}
|
|
143526
|
+
if (orgs.teams.length > 0) {
|
|
143527
|
+
console.log("");
|
|
143528
|
+
console.log(source_default.gray("Teams you can bill to:"));
|
|
143529
|
+
for (const t2 of orgs.teams) {
|
|
143530
|
+
const marker = t2.id === targetId ? source_default.green(" \u2190 current") : "";
|
|
143531
|
+
const state = t2.remainingUsd > 0 ? source_default.gray(`${money(t2.remainingUsd)} left`) : source_default.yellow("no budget left");
|
|
143532
|
+
console.log(` ${source_default.bold(String(t2.id))} ${t2.name} ${state}${marker}`);
|
|
143533
|
+
}
|
|
143534
|
+
console.log("");
|
|
143535
|
+
console.log(source_default.gray("Change it with `nex billing use <id>` or `nex billing use personal`."));
|
|
143536
|
+
}
|
|
143537
|
+
const override = (0, import_code_core2.billingOverrideFields)();
|
|
143538
|
+
if ("teamId" in override) {
|
|
143539
|
+
console.log("");
|
|
143540
|
+
console.log(source_default.yellow(
|
|
143541
|
+
`Note: NEXRALL_BILLING_TEAM pins this run to ${override.teamId === null ? "your personal wallet" : `team ${override.teamId}`}, ignoring the account setting above.`
|
|
143542
|
+
));
|
|
143543
|
+
}
|
|
143544
|
+
console.log("");
|
|
143545
|
+
}
|
|
143546
|
+
async function billingUseCommand(target) {
|
|
143547
|
+
if (!await requireAuth())
|
|
143548
|
+
return;
|
|
143549
|
+
const raw = (target || "").trim();
|
|
143550
|
+
if (/^(personal|null|0)$/i.test(raw)) {
|
|
143551
|
+
await applyTarget(null, "your personal wallet");
|
|
143552
|
+
return;
|
|
143553
|
+
}
|
|
143554
|
+
if (!/^\d+$/.test(raw)) {
|
|
143555
|
+
console.log(source_default.red("Usage: nex billing use <team id|personal> (see `nex billing` for the ids)"));
|
|
143556
|
+
process.exitCode = 1;
|
|
143557
|
+
return;
|
|
143558
|
+
}
|
|
143559
|
+
await applyTarget(Number(raw), `team ${raw}`);
|
|
143560
|
+
}
|
|
143561
|
+
async function applyTarget(teamId, label) {
|
|
143562
|
+
try {
|
|
143563
|
+
await (0, import_code_core2.setBillingTarget)(teamId);
|
|
143564
|
+
} catch (e2) {
|
|
143565
|
+
console.log(source_default.red(e2.message));
|
|
143566
|
+
process.exitCode = 1;
|
|
143567
|
+
return;
|
|
143568
|
+
}
|
|
143569
|
+
console.log(source_default.green(`\u2713 Usage will now be billed to ${label}.`));
|
|
143570
|
+
if (teamId !== null) {
|
|
143571
|
+
console.log(source_default.gray(" This applies to every product and client on this account, not just the CLI."));
|
|
143572
|
+
}
|
|
143573
|
+
}
|
|
143574
|
+
|
|
143388
143575
|
// src/commands/chat.ts
|
|
143389
143576
|
import * as readline3 from "readline";
|
|
143390
143577
|
import * as path6 from "path";
|
|
@@ -143394,7 +143581,7 @@ import * as crypto4 from "crypto";
|
|
|
143394
143581
|
import { createRequire } from "module";
|
|
143395
143582
|
import { fileURLToPath as fileURLToPath2 } from "url";
|
|
143396
143583
|
import { execSync, execFileSync as execFileSync2 } from "child_process";
|
|
143397
|
-
var
|
|
143584
|
+
var import_code_core5 = __toESM(require_dist3(), 1);
|
|
143398
143585
|
|
|
143399
143586
|
// ../../node_modules/.pnpm/ansi-regex@6.2.2/node_modules/ansi-regex/index.js
|
|
143400
143587
|
function ansiRegex({ onlyFirst = false } = {}) {
|
|
@@ -144352,18 +144539,18 @@ function showDiff(filePath, oldContent, newContent) {
|
|
|
144352
144539
|
}
|
|
144353
144540
|
|
|
144354
144541
|
// src/permissions/handler.ts
|
|
144355
|
-
var
|
|
144542
|
+
var import_code_core3 = __toESM(require_dist3(), 1);
|
|
144356
144543
|
var autoApproved = /* @__PURE__ */ new Set();
|
|
144357
144544
|
var _rules = { allow: [], ask: [], deny: [] };
|
|
144358
144545
|
var _workDir = process.cwd();
|
|
144359
144546
|
var _mode = "ask";
|
|
144360
144547
|
function initPermissions(workDir) {
|
|
144361
144548
|
_workDir = workDir;
|
|
144362
|
-
_rules = (0,
|
|
144549
|
+
_rules = (0, import_code_core3.loadSettings)(workDir).permissions;
|
|
144363
144550
|
return _rules;
|
|
144364
144551
|
}
|
|
144365
144552
|
function setMode(mode) {
|
|
144366
|
-
_mode = (0,
|
|
144553
|
+
_mode = (0, import_code_core3.parseMode)(mode);
|
|
144367
144554
|
}
|
|
144368
144555
|
function setAutoApprove(category) {
|
|
144369
144556
|
autoApproved.add(category);
|
|
@@ -144407,12 +144594,12 @@ function askUser(question) {
|
|
|
144407
144594
|
}
|
|
144408
144595
|
async function requestPermission(req) {
|
|
144409
144596
|
const { tool, input } = req;
|
|
144410
|
-
const decision = (0,
|
|
144597
|
+
const decision = (0, import_code_core3.evaluatePermission)(_rules, tool, input, _workDir);
|
|
144411
144598
|
if (decision === "deny") {
|
|
144412
144599
|
console.error(source_default.red(` \u2716 Denied by permission rule: ${tool}`));
|
|
144413
144600
|
return false;
|
|
144414
144601
|
}
|
|
144415
|
-
const destructive = (0,
|
|
144602
|
+
const destructive = (0, import_code_core3.isDestructiveBash)(tool, input);
|
|
144416
144603
|
if (destructive && process.env.NEXRALL_ALLOW_DESTRUCTIVE !== "1") {
|
|
144417
144604
|
const command = input.command ?? input.cmd ?? "";
|
|
144418
144605
|
console.error();
|
|
@@ -144430,7 +144617,7 @@ async function requestPermission(req) {
|
|
|
144430
144617
|
}
|
|
144431
144618
|
if (decision === "allow")
|
|
144432
144619
|
return true;
|
|
144433
|
-
const verdict = (0,
|
|
144620
|
+
const verdict = (0, import_code_core3.decide)({
|
|
144434
144621
|
tool,
|
|
144435
144622
|
input,
|
|
144436
144623
|
mode: _mode,
|
|
@@ -144592,7 +144779,7 @@ async function requestPermission(req) {
|
|
|
144592
144779
|
}
|
|
144593
144780
|
|
|
144594
144781
|
// src/audit.ts
|
|
144595
|
-
var
|
|
144782
|
+
var import_code_core4 = __toESM(require_dist3(), 1);
|
|
144596
144783
|
import * as path from "path";
|
|
144597
144784
|
var _state;
|
|
144598
144785
|
var _sinks = /* @__PURE__ */ new Map();
|
|
@@ -144612,7 +144799,7 @@ function currentAudit() {
|
|
|
144612
144799
|
const target = resolveAuditPath(_state);
|
|
144613
144800
|
let sink = _sinks.get(target);
|
|
144614
144801
|
if (!sink) {
|
|
144615
|
-
sink = (0,
|
|
144802
|
+
sink = (0, import_code_core4.createJsonlAuditSink)(target);
|
|
144616
144803
|
_sinks.set(target, sink);
|
|
144617
144804
|
}
|
|
144618
144805
|
const cfg = {
|
|
@@ -144625,14 +144812,14 @@ function currentAudit() {
|
|
|
144625
144812
|
// request that caused it. Same trap as @nexrall/agent's and Desktop's.
|
|
144626
144813
|
sessionId: _state.getSessionId()
|
|
144627
144814
|
};
|
|
144628
|
-
const email = (0,
|
|
144815
|
+
const email = (0, import_code_core4.loadAuth)()?.email;
|
|
144629
144816
|
if (email)
|
|
144630
144817
|
cfg.userId = email;
|
|
144631
144818
|
return cfg;
|
|
144632
144819
|
}
|
|
144633
144820
|
|
|
144634
144821
|
// src/commands/chat.ts
|
|
144635
|
-
var
|
|
144822
|
+
var import_code_core6 = __toESM(require_dist3(), 1);
|
|
144636
144823
|
|
|
144637
144824
|
// src/commands/sessions.ts
|
|
144638
144825
|
import * as fs3 from "fs";
|
|
@@ -154737,8 +154924,8 @@ var CLI_VERSION = (() => {
|
|
|
154737
154924
|
})();
|
|
154738
154925
|
var MODEL_LABELS = {
|
|
154739
154926
|
"claude-sonnet-5": "Claude Sonnet 5",
|
|
154740
|
-
"claude-opus-5-5": "Claude Opus 5",
|
|
154741
|
-
"claude-fable-5-1": "Claude Fable 5",
|
|
154927
|
+
"claude-opus-5-5": "Claude Opus 5.5",
|
|
154928
|
+
"claude-fable-5-1": "Claude Fable 5.1",
|
|
154742
154929
|
"claude-haiku-4-5-20251001": "Claude Haiku 4.5",
|
|
154743
154930
|
"gpt-5.6-sol": "GPT-5.6 Sol",
|
|
154744
154931
|
"gpt-5.6-terra": "GPT-5.6 Terra",
|
|
@@ -154769,7 +154956,13 @@ var SELECTABLE_MODELS = [
|
|
|
154769
154956
|
"gpt-5.4-mini",
|
|
154770
154957
|
"gpt-4.1",
|
|
154771
154958
|
"deepseek-flash",
|
|
154772
|
-
|
|
154959
|
+
// qwen3.7-max deliberately NOT offered as of 2026-09-27 — it is
|
|
154960
|
+
// `selectable: false` in the backend's services/codeModels.js (every
|
|
154961
|
+
// request 400s with Alibaba's `Arrearage` error), so liveSelectableModelIds()
|
|
154962
|
+
// never returns it. Dropped from this static fallback too so an offline /
|
|
154963
|
+
// older-backend session offers the same list instead of a row that cannot
|
|
154964
|
+
// run. MODEL_LABELS keeps its entry so a session already saved on it still
|
|
154965
|
+
// shows a real name rather than the raw id. Re-add both together.
|
|
154773
154966
|
"glm-5.3"
|
|
154774
154967
|
];
|
|
154775
154968
|
var MODEL_COST_MULTIPLIER = {
|
|
@@ -154795,7 +154988,7 @@ var MODEL_COST_MULTIPLIER = {
|
|
|
154795
154988
|
"glm-5.3": 0.6
|
|
154796
154989
|
};
|
|
154797
154990
|
function modelWithCostHint(id) {
|
|
154798
|
-
const mult = (0,
|
|
154991
|
+
const mult = (0, import_code_core5.liveCostMultiplierFor)(id, MODEL_COST_MULTIPLIER[id]);
|
|
154799
154992
|
return mult === void 0 ? id : `${id} (${mult}x)`;
|
|
154800
154993
|
}
|
|
154801
154994
|
var NO_VISION_MODELS = /* @__PURE__ */ new Set(["qwen3.7-max", "glm-5.3"]);
|
|
@@ -154811,13 +155004,13 @@ var NO_PDF_MODELS = /* @__PURE__ */ new Set([
|
|
|
154811
155004
|
...NO_VISION_MODELS
|
|
154812
155005
|
]);
|
|
154813
155006
|
function needsVisionSidecar(model) {
|
|
154814
|
-
return !(0,
|
|
155007
|
+
return !(0, import_code_core5.liveSupportsImageInput)(model, !NO_VISION_MODELS.has(model));
|
|
154815
155008
|
}
|
|
154816
155009
|
function needsPdfSidecar(model) {
|
|
154817
|
-
return !(0,
|
|
155010
|
+
return !(0, import_code_core5.liveSupportsPdfInput)(model, !NO_PDF_MODELS.has(model));
|
|
154818
155011
|
}
|
|
154819
155012
|
function selectableModelIds() {
|
|
154820
|
-
return (0,
|
|
155013
|
+
return (0, import_code_core5.liveSelectableModelIds)() ?? SELECTABLE_MODELS;
|
|
154821
155014
|
}
|
|
154822
155015
|
function normaliseModelId(model) {
|
|
154823
155016
|
const raw = (model ?? "").trim();
|
|
@@ -154878,9 +155071,9 @@ var _BACKEND_STYLE_TO_LOCAL = {
|
|
|
154878
155071
|
};
|
|
154879
155072
|
function effortStyleFor(modelId) {
|
|
154880
155073
|
const id = normaliseModelId(modelId);
|
|
154881
|
-
if ((0,
|
|
155074
|
+
if ((0, import_code_core5.liveVendorFor)(id) === "Anthropic")
|
|
154882
155075
|
return "anthropic";
|
|
154883
|
-
const liveStyle = (0,
|
|
155076
|
+
const liveStyle = (0, import_code_core5.liveReasoningEffortStyle)(id);
|
|
154884
155077
|
if (liveStyle && _BACKEND_STYLE_TO_LOCAL[liveStyle])
|
|
154885
155078
|
return _BACKEND_STYLE_TO_LOCAL[liveStyle];
|
|
154886
155079
|
return MODEL_EFFORT_STYLE[id] ?? "anthropic";
|
|
@@ -154900,7 +155093,7 @@ function defaultEffortForModel(modelId) {
|
|
|
154900
155093
|
}
|
|
154901
155094
|
function resolveModelLabel(alias) {
|
|
154902
155095
|
const id = normaliseModelId(alias);
|
|
154903
|
-
return (0,
|
|
155096
|
+
return (0, import_code_core5.liveLabelFor)(id, MODEL_LABELS[id] ?? id);
|
|
154904
155097
|
}
|
|
154905
155098
|
function tryExec(cmd, cwd2) {
|
|
154906
155099
|
try {
|
|
@@ -154961,7 +155154,7 @@ var tryRead = (p) => {
|
|
|
154961
155154
|
};
|
|
154962
155155
|
function readNexrallMd(workDir) {
|
|
154963
155156
|
const parts = [];
|
|
154964
|
-
const memContent = (0,
|
|
155157
|
+
const memContent = (0, import_code_core5.readAllMemory)(workDir);
|
|
154965
155158
|
if (memContent)
|
|
154966
155159
|
parts.push(memContent);
|
|
154967
155160
|
const globalContent = tryRead(path6.join(os5.homedir(), ".nexrall", "nexrall.md"));
|
|
@@ -155071,12 +155264,12 @@ var Spinner = class {
|
|
|
155071
155264
|
var _mcpManager = null;
|
|
155072
155265
|
var _mcpConfig = null;
|
|
155073
155266
|
async function initMcp(workDir) {
|
|
155074
|
-
_mcpConfig =
|
|
155267
|
+
_mcpConfig = import_code_core5.McpManager.loadConfig(workDir);
|
|
155075
155268
|
if (Object.keys(_mcpConfig.mcpServers).length === 0) {
|
|
155076
155269
|
_mcpManager = null;
|
|
155077
155270
|
return;
|
|
155078
155271
|
}
|
|
155079
|
-
const manager = new
|
|
155272
|
+
const manager = new import_code_core5.McpManager();
|
|
155080
155273
|
await manager.connectAll(_mcpConfig);
|
|
155081
155274
|
_mcpManager = manager;
|
|
155082
155275
|
}
|
|
@@ -155097,10 +155290,10 @@ function formatMcpStatus() {
|
|
|
155097
155290
|
return lines.join("\n");
|
|
155098
155291
|
}
|
|
155099
155292
|
function formatContextUsage(messages, modelAlias) {
|
|
155100
|
-
const window2 = (0,
|
|
155101
|
-
const tokens = (0,
|
|
155102
|
-
const bytes = (0,
|
|
155103
|
-
const { prune, compact } = (0,
|
|
155293
|
+
const window2 = (0, import_code_core5.contextWindowFor)(modelAlias);
|
|
155294
|
+
const tokens = (0, import_code_core5.estimateTokensRough)(messages);
|
|
155295
|
+
const bytes = (0, import_code_core5.estimateBodyBytes)(messages);
|
|
155296
|
+
const { prune, compact } = (0, import_code_core5.compactionThresholds)();
|
|
155104
155297
|
const pct = Math.min(100, tokens / window2 * 100);
|
|
155105
155298
|
const barWidth = 30;
|
|
155106
155299
|
const filled = Math.round(pct / 100 * barWidth);
|
|
@@ -155117,7 +155310,7 @@ function formatContextUsage(messages, modelAlias) {
|
|
|
155117
155310
|
return lines.join("\n");
|
|
155118
155311
|
}
|
|
155119
155312
|
function formatAgentsList(workDir) {
|
|
155120
|
-
const { types: types3, warnings } = (0,
|
|
155313
|
+
const { types: types3, warnings } = (0, import_code_core5.loadAgentTypesWithWarnings)(workDir);
|
|
155121
155314
|
if (!types3.length)
|
|
155122
155315
|
return source_default.dim(" No agent types found (this should not happen \u2014 builtins always register).");
|
|
155123
155316
|
const lines = types3.map((t2) => {
|
|
@@ -155164,7 +155357,7 @@ async function runTurn(messages, modelAlias, workDir, abortSignal, env4, nexrall
|
|
|
155164
155357
|
setMode(mode);
|
|
155165
155358
|
console.log();
|
|
155166
155359
|
spinner.start("thinking\u2026", { hint: false });
|
|
155167
|
-
const result = await (0,
|
|
155360
|
+
const result = await (0, import_code_core5.runAgentLoop)(messages, {
|
|
155168
155361
|
workDir,
|
|
155169
155362
|
model: modelAlias,
|
|
155170
155363
|
env: env4,
|
|
@@ -155347,7 +155540,7 @@ async function runTurnHeadless(messages, modelAlias, workDir, _abortSignal, env4
|
|
|
155347
155540
|
process.stdout.write(JSON.stringify(obj2) + "\n");
|
|
155348
155541
|
};
|
|
155349
155542
|
emit({ type: "start", model: modelAlias, workDir });
|
|
155350
|
-
const result = await (0,
|
|
155543
|
+
const result = await (0, import_code_core5.runAgentLoop)(messages, {
|
|
155351
155544
|
workDir,
|
|
155352
155545
|
model: modelAlias,
|
|
155353
155546
|
env: env4,
|
|
@@ -155443,7 +155636,7 @@ async function runTurnHeadless(messages, modelAlias, workDir, _abortSignal, env4
|
|
|
155443
155636
|
// no human to confirm, they are denied unless NEXRALL_ALLOW_DESTRUCTIVE=1 is
|
|
155444
155637
|
// explicitly set for this CI run.
|
|
155445
155638
|
requestPermission: async ({ tool, input }) => {
|
|
155446
|
-
const d = (0,
|
|
155639
|
+
const d = (0, import_code_core5.isDestructiveBash)(tool, input);
|
|
155447
155640
|
if (d && process.env.NEXRALL_ALLOW_DESTRUCTIVE !== "1") {
|
|
155448
155641
|
emit({ type: "error", error: `Destructive command blocked in headless mode (${d.category}): ${d.reason}. Set NEXRALL_ALLOW_DESTRUCTIVE=1 to permit.` });
|
|
155449
155642
|
return false;
|
|
@@ -155548,7 +155741,7 @@ async function startChatSession(options) {
|
|
|
155548
155741
|
let peerInbox;
|
|
155549
155742
|
const peerInboxQueue = [];
|
|
155550
155743
|
let modelAlias = options.model;
|
|
155551
|
-
void (0,
|
|
155744
|
+
void (0, import_code_core5.getModelCatalogue)().catch(() => {
|
|
155552
155745
|
});
|
|
155553
155746
|
const canPrompt = !headless && !options.prompt && !options.stdinText && process.stdin.isTTY === true && process.stdout.isTTY === true;
|
|
155554
155747
|
if (!trustGrantedByEnv()) {
|
|
@@ -155576,9 +155769,9 @@ Set ${TRUST_ENV_VAR}=1 to confirm non-interactively, or run \`nex\` interactivel
|
|
|
155576
155769
|
}
|
|
155577
155770
|
if (options.worktree !== void 0) {
|
|
155578
155771
|
const requestedName = typeof options.worktree === "string" ? options.worktree : void 0;
|
|
155579
|
-
const existing = requestedName ? (0,
|
|
155772
|
+
const existing = requestedName ? (0, import_code_core5.findWorktreeByName)(requestedWorkDir, requestedName) : null;
|
|
155580
155773
|
if (existing) {
|
|
155581
|
-
const entered = (0,
|
|
155774
|
+
const entered = (0, import_code_core5.enterWorktree)(existing);
|
|
155582
155775
|
if (!entered.ok) {
|
|
155583
155776
|
process.stderr.write(`Failed to resume worktree "${requestedName}": ${entered.error}
|
|
155584
155777
|
`);
|
|
@@ -155588,7 +155781,7 @@ Set ${TRUST_ENV_VAR}=1 to confirm non-interactively, or run \`nex\` interactivel
|
|
|
155588
155781
|
if (!headless)
|
|
155589
155782
|
console.log(source_default.dim(` Resumed worktree: ${source_default.bold(existing.name)} (${existing.worktreePath})`));
|
|
155590
155783
|
} else {
|
|
155591
|
-
const created = (0,
|
|
155784
|
+
const created = (0, import_code_core5.createWorktree)(requestedWorkDir, requestedName);
|
|
155592
155785
|
if (!created.ok || !created.state) {
|
|
155593
155786
|
process.stderr.write(`Failed to create worktree: ${created.error ?? "unknown error"}
|
|
155594
155787
|
`);
|
|
@@ -155607,7 +155800,7 @@ Set ${TRUST_ENV_VAR}=1 to confirm non-interactively, or run \`nex\` interactivel
|
|
|
155607
155800
|
process.on("exit", () => {
|
|
155608
155801
|
if (!worktreeState)
|
|
155609
155802
|
return;
|
|
155610
|
-
const hadWork = (0,
|
|
155803
|
+
const hadWork = (0, import_code_core5.worktreeHasWork)(worktreeState);
|
|
155611
155804
|
if (hadWork) {
|
|
155612
155805
|
process.stderr.write(
|
|
155613
155806
|
`
|
|
@@ -155618,7 +155811,7 @@ Resume it with: nex --worktree ${worktreeState.name}
|
|
|
155618
155811
|
);
|
|
155619
155812
|
return;
|
|
155620
155813
|
}
|
|
155621
|
-
(0,
|
|
155814
|
+
(0, import_code_core5.removeWorktree)(worktreeState);
|
|
155622
155815
|
});
|
|
155623
155816
|
}
|
|
155624
155817
|
const env4 = collectEnv(workDir);
|
|
@@ -155626,8 +155819,8 @@ Resume it with: nex --worktree ${worktreeState.name}
|
|
|
155626
155819
|
const interactive = !headless && !options.prompt && !options.stdinText;
|
|
155627
155820
|
let peerHeartbeatTimer;
|
|
155628
155821
|
if (interactive) {
|
|
155629
|
-
const handle2 = (0,
|
|
155630
|
-
const inbox = (0,
|
|
155822
|
+
const handle2 = (0, import_code_core5.registerPeer)({ clientType: "cli", workDir: requestedWorkDir });
|
|
155823
|
+
const inbox = (0, import_code_core5.startPeerInbox)(handle2.record.id, { onMessage: (m2) => peerInboxQueue.push(m2) });
|
|
155631
155824
|
handle2.record.socketPath = inbox.socketPath;
|
|
155632
155825
|
handle2.heartbeat();
|
|
155633
155826
|
peerHandle = handle2;
|
|
@@ -155697,7 +155890,7 @@ Resume it with: nex --worktree ${worktreeState.name}
|
|
|
155697
155890
|
const ruleCount = permRules.allow.length + permRules.ask.length + permRules.deny.length;
|
|
155698
155891
|
if (ruleCount && !headless)
|
|
155699
155892
|
console.log(source_default.dim(` ${ruleCount} permission rule(s) loaded`));
|
|
155700
|
-
let skills = (0,
|
|
155893
|
+
let skills = (0, import_code_core5.loadSkills)(workDir);
|
|
155701
155894
|
if (skills.length && !headless)
|
|
155702
155895
|
console.log(source_default.dim(` ${skills.length} skill(s) loaded`));
|
|
155703
155896
|
const mcpStarted = (async () => {
|
|
@@ -155729,7 +155922,7 @@ Resume it with: nex --worktree ${worktreeState.name}
|
|
|
155729
155922
|
sessionId = stored.id;
|
|
155730
155923
|
sessionTitle = stored.title;
|
|
155731
155924
|
try {
|
|
155732
|
-
const compacted = await (0,
|
|
155925
|
+
const compacted = await (0, import_code_core5.compactMessagesForResume)(messages, {
|
|
155733
155926
|
workDir,
|
|
155734
155927
|
model: modelAlias,
|
|
155735
155928
|
clientType: "cli",
|
|
@@ -155746,7 +155939,7 @@ Resume it with: nex --worktree ${worktreeState.name}
|
|
|
155746
155939
|
console.log();
|
|
155747
155940
|
}
|
|
155748
155941
|
}
|
|
155749
|
-
const checkpoints = new
|
|
155942
|
+
const checkpoints = new import_code_core5.CheckpointManager(workDir, sessionId);
|
|
155750
155943
|
if (options.audit) {
|
|
155751
155944
|
const auditPath = enableAudit({
|
|
155752
155945
|
filePath: typeof options.audit === "string" ? options.audit : void 0,
|
|
@@ -155764,7 +155957,7 @@ Resume it with: nex --worktree ${worktreeState.name}
|
|
|
155764
155957
|
sessionTitle = raw.length > 60 ? raw.slice(0, 60) + "\u2026" : raw;
|
|
155765
155958
|
};
|
|
155766
155959
|
const recoverTurn = (err, current) => {
|
|
155767
|
-
const salvaged = (0,
|
|
155960
|
+
const salvaged = (0, import_code_core5.salvageHistory)(err);
|
|
155768
155961
|
console.error("\n" + source_default.red("Error: ") + String(err.message));
|
|
155769
155962
|
if (!salvaged)
|
|
155770
155963
|
return current;
|
|
@@ -155813,7 +156006,7 @@ ${text}` : "");
|
|
|
155813
156006
|
await new Promise((r2) => setImmediate(r2));
|
|
155814
156007
|
process.exit(0);
|
|
155815
156008
|
} catch (err) {
|
|
155816
|
-
const salvaged = (0,
|
|
156009
|
+
const salvaged = (0, import_code_core5.salvageHistory)(err);
|
|
155817
156010
|
if (salvaged) {
|
|
155818
156011
|
messages = salvaged;
|
|
155819
156012
|
try {
|
|
@@ -155918,7 +156111,7 @@ ${text}` : "");
|
|
|
155918
156111
|
messages = [];
|
|
155919
156112
|
sessionId = crypto4.randomBytes(8).toString("hex");
|
|
155920
156113
|
sessionTitle = "";
|
|
155921
|
-
(0,
|
|
156114
|
+
(0, import_code_core6.resetSessionSubAgentBudget)();
|
|
155922
156115
|
console.log(source_default.dim(" Conversation cleared. New session started."));
|
|
155923
156116
|
rl.prompt();
|
|
155924
156117
|
return;
|
|
@@ -155952,7 +156145,7 @@ ${text}` : "");
|
|
|
155952
156145
|
sessionId = stored.id;
|
|
155953
156146
|
sessionTitle = stored.title;
|
|
155954
156147
|
try {
|
|
155955
|
-
await (0,
|
|
156148
|
+
await (0, import_code_core5.compactMessagesForResume)(messages, {
|
|
155956
156149
|
workDir,
|
|
155957
156150
|
model: modelAlias,
|
|
155958
156151
|
clientType: "cli",
|
|
@@ -156127,13 +156320,13 @@ ${dirList}`;
|
|
|
156127
156320
|
const sub = arg.trim().toLowerCase();
|
|
156128
156321
|
console.log();
|
|
156129
156322
|
if (sub === "list") {
|
|
156130
|
-
const all = (0,
|
|
156323
|
+
const all = (0, import_code_core5.listWorktrees)(requestedWorkDir);
|
|
156131
156324
|
if (!all.length) {
|
|
156132
156325
|
console.log(source_default.dim(" No worktrees under this project."));
|
|
156133
156326
|
} else {
|
|
156134
156327
|
console.log(source_default.bold(` Worktrees (${all.length})`));
|
|
156135
156328
|
for (const w of all) {
|
|
156136
|
-
const dirty = (0,
|
|
156329
|
+
const dirty = (0, import_code_core5.worktreeHasWork)(w) ? source_default.yellow("dirty") : source_default.dim("clean");
|
|
156137
156330
|
console.log(` ${source_default.cyan(w.name)} ${source_default.dim(w.worktreePath)} [${dirty}]`);
|
|
156138
156331
|
}
|
|
156139
156332
|
console.log();
|
|
@@ -156171,7 +156364,7 @@ ${dirList}`;
|
|
|
156171
156364
|
if (!targetName || !text) {
|
|
156172
156365
|
console.log(source_default.dim(" Usage: /peers send <name> <message>"));
|
|
156173
156366
|
} else {
|
|
156174
|
-
const target = (0,
|
|
156367
|
+
const target = (0, import_code_core5.listPeers)().find((p) => p.name === targetName);
|
|
156175
156368
|
if (!target) {
|
|
156176
156369
|
console.log(source_default.red(` No live session named "${targetName}". Use /peers to list who's reachable.`));
|
|
156177
156370
|
} else if (!target.socketPath) {
|
|
@@ -156188,7 +156381,7 @@ ${dirList}`;
|
|
|
156188
156381
|
console.log(source_default.dim(" Usage: /peers broadcast <message>"));
|
|
156189
156382
|
} else {
|
|
156190
156383
|
const { broadcastPeerMessage } = await Promise.resolve().then(() => __toESM(require_dist3(), 1));
|
|
156191
|
-
const targets = (0,
|
|
156384
|
+
const targets = (0, import_code_core5.listPeers)(peerHandle.record.id).filter((p) => p.id !== peerHandle.record.id && p.socketPath && p.inbound !== "refuse").map((p) => ({ name: p.name, socketPath: p.socketPath }));
|
|
156192
156385
|
if (!targets.length) {
|
|
156193
156386
|
console.log(source_default.dim(" No other reachable Nexrall Code sessions to broadcast to."));
|
|
156194
156387
|
} else {
|
|
@@ -156200,7 +156393,7 @@ ${dirList}`;
|
|
|
156200
156393
|
}
|
|
156201
156394
|
}
|
|
156202
156395
|
} else {
|
|
156203
|
-
const peers = (0,
|
|
156396
|
+
const peers = (0, import_code_core5.listPeers)(peerHandle.record.id);
|
|
156204
156397
|
if (peers.length <= 1) {
|
|
156205
156398
|
console.log(source_default.dim(" No other Nexrall Code sessions are currently discoverable on this machine."));
|
|
156206
156399
|
} else {
|
|
@@ -156230,7 +156423,7 @@ ${dirList}`;
|
|
|
156230
156423
|
const label = memScope === "global" ? "GLOBAL" : "this PROJECT's";
|
|
156231
156424
|
const answer = await new Promise((resolve4) => rl.question(source_default.yellow(` Clear ${label} memory? This cannot be undone. [y/n] `), (a) => resolve4(a.trim())));
|
|
156232
156425
|
if (answer === "y" || answer === "yes") {
|
|
156233
|
-
(0,
|
|
156426
|
+
(0, import_code_core5.clearMemory)(memScope, workDir);
|
|
156234
156427
|
console.log(source_default.green(` ${memScope === "global" ? "Global" : "Project"} memory cleared.`));
|
|
156235
156428
|
} else {
|
|
156236
156429
|
console.log(source_default.dim(" Cancelled."));
|
|
@@ -156241,20 +156434,20 @@ ${dirList}`;
|
|
|
156241
156434
|
}
|
|
156242
156435
|
console.log();
|
|
156243
156436
|
if (wantsGlobalOnly) {
|
|
156244
|
-
const stats = (0,
|
|
156245
|
-
const content = (0,
|
|
156437
|
+
const stats = (0, import_code_core5.memoryStats)("global");
|
|
156438
|
+
const content = (0, import_code_core5.readMemory)("global", void 0, { includeArchived: wantsArchived });
|
|
156246
156439
|
const archivedNote = stats.archived > 0 ? `, ${stats.archived} archived` : "";
|
|
156247
156440
|
console.log(source_default.bold(" Global memory ") + source_default.dim(`(${stats.entries} entries${archivedNote}, ${(stats.bytes / 1024).toFixed(1)}KB) \u2014 ${stats.file}`));
|
|
156248
156441
|
console.log();
|
|
156249
156442
|
console.log(content || source_default.dim(" No global memories saved yet."));
|
|
156250
156443
|
} else {
|
|
156251
|
-
const projStats = (0,
|
|
156252
|
-
const globalStats = (0,
|
|
156444
|
+
const projStats = (0, import_code_core5.memoryStats)("project", workDir);
|
|
156445
|
+
const globalStats = (0, import_code_core5.memoryStats)("global");
|
|
156253
156446
|
const projArchived = projStats.archived > 0 ? `+${projStats.archived} archived ` : "";
|
|
156254
156447
|
const globalArchived = globalStats.archived > 0 ? `+${globalStats.archived} archived ` : "";
|
|
156255
156448
|
console.log(source_default.bold(" Memory") + source_default.dim(` \u2014 project: ${projStats.entries} ${projArchived}entries (${(projStats.bytes / 1024).toFixed(1)}KB) \xB7 global: ${globalStats.entries} ${globalArchived}entries (${(globalStats.bytes / 1024).toFixed(1)}KB)`));
|
|
156256
156449
|
console.log();
|
|
156257
|
-
const merged = (0,
|
|
156450
|
+
const merged = (0, import_code_core5.readAllMemory)(workDir, { includeArchived: wantsArchived });
|
|
156258
156451
|
console.log(merged || source_default.dim(" No memories saved yet."));
|
|
156259
156452
|
}
|
|
156260
156453
|
console.log();
|
|
@@ -156293,12 +156486,12 @@ ${dirList}`;
|
|
|
156293
156486
|
console.log(source_default.dim(` Current: ${source_default.cyan(agentMode)}`));
|
|
156294
156487
|
for (const m2 of ["ask", "edit", "auto", "plan"]) {
|
|
156295
156488
|
const marker = m2 === agentMode ? source_default.cyan("\u276F") : " ";
|
|
156296
|
-
console.log(` ${marker} ${source_default.bold(m2.padEnd(5))} ${source_default.dim((0,
|
|
156489
|
+
console.log(` ${marker} ${source_default.bold(m2.padEnd(5))} ${source_default.dim((0, import_code_core6.describeMode)(m2).replace(`${m2} \u2014 `, ""))}`);
|
|
156297
156490
|
}
|
|
156298
156491
|
} else if (["ask", "edit", "plan", "auto"].includes(modeArg)) {
|
|
156299
156492
|
agentMode = modeArg;
|
|
156300
156493
|
updateFooter();
|
|
156301
|
-
console.log(source_default.green(` Mode \u2192 ${source_default.bold(modeArg)}`) + source_default.dim(` ${(0,
|
|
156494
|
+
console.log(source_default.green(` Mode \u2192 ${source_default.bold(modeArg)}`) + source_default.dim(` ${(0, import_code_core6.describeMode)(modeArg).replace(`${modeArg} \u2014 `, "")}`));
|
|
156302
156495
|
} else {
|
|
156303
156496
|
console.log(source_default.red(` Unknown: ${modeArg}`));
|
|
156304
156497
|
}
|
|
@@ -156329,7 +156522,7 @@ ${dirList}`;
|
|
|
156329
156522
|
case "/balance": {
|
|
156330
156523
|
rl.pause();
|
|
156331
156524
|
try {
|
|
156332
|
-
const bal = await (0,
|
|
156525
|
+
const bal = await (0, import_code_core5.getBalance)();
|
|
156333
156526
|
console.log(source_default.dim(" Balance: ") + source_default.cyan(`$${bal.toFixed(4)}`));
|
|
156334
156527
|
} catch (err) {
|
|
156335
156528
|
console.error(source_default.red(" Failed: ") + String(err.message));
|
|
@@ -156415,7 +156608,7 @@ ${caption}` : `[Attached: ${rel}]`;
|
|
|
156415
156608
|
if (needsSidecar) {
|
|
156416
156609
|
console.log(source_default.dim(` ${resolveModelLabel(modelAlias)} can't read ${isPdf ? "PDFs" : "images"} directly \u2014 describing ${rel} with Claude Sonnet 5 first\u2026`));
|
|
156417
156610
|
try {
|
|
156418
|
-
const { text } = await (0,
|
|
156611
|
+
const { text } = await (0, import_code_core5.describeAttachment)(isPdf ? "pdf" : "image", data, mimeType, rel);
|
|
156419
156612
|
content.push({ type: "text", text: `<attachment_description>
|
|
156420
156613
|
${text}
|
|
156421
156614
|
</attachment_description>` });
|
|
@@ -156459,7 +156652,7 @@ ${text}
|
|
|
156459
156652
|
process.exit(0);
|
|
156460
156653
|
}
|
|
156461
156654
|
case "/plugins": {
|
|
156462
|
-
const plugins = (0,
|
|
156655
|
+
const plugins = (0, import_code_core5.loadPlugins)(workDir);
|
|
156463
156656
|
if (!plugins.length) {
|
|
156464
156657
|
console.log(source_default.dim(" No plugins installed. Install one: nex plugin install owner/repo"));
|
|
156465
156658
|
} else {
|
|
@@ -156472,7 +156665,7 @@ ${text}
|
|
|
156472
156665
|
}
|
|
156473
156666
|
console.log();
|
|
156474
156667
|
}
|
|
156475
|
-
skills = (0,
|
|
156668
|
+
skills = (0, import_code_core5.loadSkills)(workDir);
|
|
156476
156669
|
rl.prompt();
|
|
156477
156670
|
return;
|
|
156478
156671
|
}
|
|
@@ -156607,8 +156800,8 @@ ${text}
|
|
|
156607
156800
|
}
|
|
156608
156801
|
case "/skills":
|
|
156609
156802
|
case "/commands": {
|
|
156610
|
-
skills = (0,
|
|
156611
|
-
const invocable = (0,
|
|
156803
|
+
skills = (0, import_code_core5.loadSkills)(workDir);
|
|
156804
|
+
const invocable = (0, import_code_core5.userInvokableSkills)(skills);
|
|
156612
156805
|
if (!invocable.length) {
|
|
156613
156806
|
console.log(source_default.dim(" No skills. Add .nexrall/skills/<name>/SKILL.md (or .nexrall/commands/<name>.md) to create one."));
|
|
156614
156807
|
} else {
|
|
@@ -156625,14 +156818,14 @@ ${text}
|
|
|
156625
156818
|
return;
|
|
156626
156819
|
}
|
|
156627
156820
|
default: {
|
|
156628
|
-
const custom = (0,
|
|
156821
|
+
const custom = (0, import_code_core5.findSkill)(skills, cmd);
|
|
156629
156822
|
if (!custom) {
|
|
156630
156823
|
console.log(source_default.red(` Unknown command: ${cmd}`));
|
|
156631
156824
|
console.log(source_default.dim(" Type /help for built-ins or /skills for custom ones."));
|
|
156632
156825
|
rl.prompt();
|
|
156633
156826
|
return;
|
|
156634
156827
|
}
|
|
156635
|
-
const expanded = (0,
|
|
156828
|
+
const expanded = (0, import_code_core5.expandSkill)(custom, arg, workDir);
|
|
156636
156829
|
const turnModel = custom.model ?? modelAlias;
|
|
156637
156830
|
const turnMode = custom.mode ?? agentMode;
|
|
156638
156831
|
console.log(source_default.dim(` Running /${custom.name}\u2026`));
|
|
@@ -156694,7 +156887,7 @@ ${text}
|
|
|
156694
156887
|
|
|
156695
156888
|
// src/commands/plugin.ts
|
|
156696
156889
|
var import_prompts = __toESM(require_prompts3(), 1);
|
|
156697
|
-
var
|
|
156890
|
+
var import_code_core7 = __toESM(require_dist3(), 1);
|
|
156698
156891
|
function describeInspection(i2, name, ctx) {
|
|
156699
156892
|
console.log();
|
|
156700
156893
|
console.log(source_default.bold(` Plugin: ${name}`) + (i2.meta.version ? source_default.dim(` v${i2.meta.version}`) : ""));
|
|
@@ -156770,14 +156963,14 @@ async function pluginInstallCommand(spec, opts) {
|
|
|
156770
156963
|
let registryName;
|
|
156771
156964
|
const isShortName = /^[\w.-]+$/.test(spec.trim()) && !spec.includes("/");
|
|
156772
156965
|
if (isShortName) {
|
|
156773
|
-
const alias = (0,
|
|
156966
|
+
const alias = (0, import_code_core7.resolveSourceAlias)(spec.trim(), process.cwd(), { includeProject: true });
|
|
156774
156967
|
if (alias) {
|
|
156775
156968
|
source2 = alias.spec;
|
|
156776
156969
|
console.log(source_default.dim(` Source: ${alias.name} (${alias.tier}) \u2190 ${alias.spec}`));
|
|
156777
156970
|
}
|
|
156778
156971
|
}
|
|
156779
156972
|
if (isShortName && source2 === spec) {
|
|
156780
|
-
const entry = await (0,
|
|
156973
|
+
const entry = await (0, import_code_core7.getRegistryPlugin)(spec.trim()).catch(() => null);
|
|
156781
156974
|
if (entry) {
|
|
156782
156975
|
source2 = entry.source;
|
|
156783
156976
|
registryName = entry.name;
|
|
@@ -156792,7 +156985,7 @@ async function pluginInstallCommand(spec, opts) {
|
|
|
156792
156985
|
return;
|
|
156793
156986
|
}
|
|
156794
156987
|
}
|
|
156795
|
-
const res = await (0,
|
|
156988
|
+
const res = await (0, import_code_core7.installPlugin)(source2, {
|
|
156796
156989
|
scope,
|
|
156797
156990
|
workDir: process.cwd(),
|
|
156798
156991
|
name: opts.name ?? registryName,
|
|
@@ -156800,7 +156993,7 @@ async function pluginInstallCommand(spec, opts) {
|
|
|
156800
156993
|
confirm: (i2, name, ctx) => confirmInstall(i2, name, opts.yes === true, ctx)
|
|
156801
156994
|
});
|
|
156802
156995
|
if (registryName)
|
|
156803
|
-
(0,
|
|
156996
|
+
(0, import_code_core7.reportInstall)(registryName);
|
|
156804
156997
|
console.log();
|
|
156805
156998
|
console.log(source_default.green(` \u2713 Installed "${res.name}" (${res.scope}) \u2192 ${res.dir}`) + (res.sha ? source_default.dim(` @ ${res.sha.slice(0, 7)}`) : ""));
|
|
156806
156999
|
if (res.inspection.commands.length) {
|
|
@@ -156814,7 +157007,7 @@ async function pluginInstallCommand(spec, opts) {
|
|
|
156814
157007
|
}
|
|
156815
157008
|
function pluginRemoveCommand(name, opts) {
|
|
156816
157009
|
try {
|
|
156817
|
-
const dir = (0,
|
|
157010
|
+
const dir = (0, import_code_core7.removePlugin)(name, {
|
|
156818
157011
|
scope: opts.project ? "project" : void 0,
|
|
156819
157012
|
// no flag → search both scopes
|
|
156820
157013
|
workDir: process.cwd()
|
|
@@ -156827,14 +157020,14 @@ function pluginRemoveCommand(name, opts) {
|
|
|
156827
157020
|
}
|
|
156828
157021
|
async function pluginUpdateCommand(name, opts) {
|
|
156829
157022
|
const workDir = process.cwd();
|
|
156830
|
-
const targets = name ? [name] : (0,
|
|
157023
|
+
const targets = name ? [name] : (0, import_code_core7.loadPlugins)(workDir).filter((p) => (0, import_code_core7.readReceipt)(p.dir)?.kind === "github").map((p) => p.name);
|
|
156831
157024
|
if (!targets.length) {
|
|
156832
157025
|
console.log(source_default.dim(" No updatable plugins (only GitHub-installed plugins with receipts can update)."));
|
|
156833
157026
|
return;
|
|
156834
157027
|
}
|
|
156835
157028
|
for (const t2 of targets) {
|
|
156836
157029
|
try {
|
|
156837
|
-
const res = await (0,
|
|
157030
|
+
const res = await (0, import_code_core7.updatePlugin)(t2, {
|
|
156838
157031
|
workDir,
|
|
156839
157032
|
confirm: (i2, n, ctx) => confirmInstall(i2, n, opts.yes === true, ctx)
|
|
156840
157033
|
});
|
|
@@ -156851,7 +157044,7 @@ function badgeFor(p) {
|
|
|
156851
157044
|
}
|
|
156852
157045
|
async function pluginSearchCommand(query) {
|
|
156853
157046
|
try {
|
|
156854
|
-
const results = await (0,
|
|
157047
|
+
const results = await (0, import_code_core7.searchRegistry)(query);
|
|
156855
157048
|
if (!results.length) {
|
|
156856
157049
|
console.log(source_default.dim(query ? ` No plugins matching "${query}".` : " Registry is empty."));
|
|
156857
157050
|
return;
|
|
@@ -156874,7 +157067,7 @@ async function pluginSearchCommand(query) {
|
|
|
156874
157067
|
}
|
|
156875
157068
|
async function pluginInfoCommand(name) {
|
|
156876
157069
|
try {
|
|
156877
|
-
const p = await (0,
|
|
157070
|
+
const p = await (0, import_code_core7.getRegistryPlugin)(name);
|
|
156878
157071
|
if (!p) {
|
|
156879
157072
|
console.error(source_default.red(` \u2717 "${name}" not found in the registry.`));
|
|
156880
157073
|
process.exitCode = 1;
|
|
@@ -156910,7 +157103,7 @@ async function pluginInfoCommand(name) {
|
|
|
156910
157103
|
}
|
|
156911
157104
|
}
|
|
156912
157105
|
function pluginListCommand() {
|
|
156913
|
-
const plugins = (0,
|
|
157106
|
+
const plugins = (0, import_code_core7.loadPlugins)(process.cwd());
|
|
156914
157107
|
if (!plugins.length) {
|
|
156915
157108
|
console.log(source_default.dim(" No plugins installed."));
|
|
156916
157109
|
console.log(source_default.dim(" Install one: nex plugin install owner/repo"));
|
|
@@ -156919,10 +157112,10 @@ function pluginListCommand() {
|
|
|
156919
157112
|
console.log();
|
|
156920
157113
|
console.log(source_default.bold(" Installed plugins:"));
|
|
156921
157114
|
for (const p of plugins) {
|
|
156922
|
-
const receipt = (0,
|
|
157115
|
+
const receipt = (0, import_code_core7.readReceipt)(p.dir);
|
|
156923
157116
|
const src = receipt ? source_default.dim(` \u2190 ${receipt.source}`) : source_default.dim(" (manual)");
|
|
156924
157117
|
const at = receipt?.sha ? source_default.dim(` @ ${receipt.sha.slice(0, 7)}`) : "";
|
|
156925
|
-
const insp = (0,
|
|
157118
|
+
const insp = (0, import_code_core7.inspectPluginDir)(p.dir);
|
|
156926
157119
|
const runs = insp.hasHooks || insp.hasMcp ? source_default.yellow(` \u26A0 ${[insp.hasHooks && "hooks", insp.hasMcp && "mcp"].filter(Boolean).join("+")}`) : "";
|
|
156927
157120
|
console.log(
|
|
156928
157121
|
" " + source_default.cyan(p.name.padEnd(24)) + source_default.dim(`${(p.version ?? "").padEnd(10)}${p.scope.padEnd(9)}`) + src + at + runs
|
|
@@ -156932,8 +157125,8 @@ function pluginListCommand() {
|
|
|
156932
157125
|
}
|
|
156933
157126
|
function pluginSourceListCommand() {
|
|
156934
157127
|
const workDir = process.cwd();
|
|
156935
|
-
const sources = (0,
|
|
156936
|
-
const patterns = (0,
|
|
157128
|
+
const sources = (0, import_code_core7.loadDeclaredSources)(workDir, { includeProject: true });
|
|
157129
|
+
const patterns = (0, import_code_core7.allowedSourcePatterns)();
|
|
156937
157130
|
if (patterns) {
|
|
156938
157131
|
console.log();
|
|
156939
157132
|
console.log(source_default.bold(" Organisation policy: ") + source_default.dim(`installs restricted to ${patterns.join(", ")}`));
|
|
@@ -156948,7 +157141,7 @@ function pluginSourceListCommand() {
|
|
|
156948
157141
|
console.log(source_default.bold(" Declared plugin sources:"));
|
|
156949
157142
|
for (const s2 of sources) {
|
|
156950
157143
|
const tier = s2.tier === "project" ? source_default.yellow(s2.tier.padEnd(9)) : source_default.dim(s2.tier.padEnd(9));
|
|
156951
|
-
const blocked = !(0,
|
|
157144
|
+
const blocked = !(0, import_code_core7.isSourceAllowed)(s2.spec, patterns) ? source_default.red(" \u2717 blocked by policy") : "";
|
|
156952
157145
|
console.log(" " + source_default.cyan(s2.name.padEnd(20)) + tier + source_default.white(s2.spec) + blocked);
|
|
156953
157146
|
}
|
|
156954
157147
|
console.log();
|
|
@@ -156958,17 +157151,17 @@ function pluginSourceListCommand() {
|
|
|
156958
157151
|
}
|
|
156959
157152
|
function pluginSourceAddCommand(name, spec, opts) {
|
|
156960
157153
|
try {
|
|
156961
|
-
(0,
|
|
156962
|
-
const patterns = (0,
|
|
156963
|
-
if (patterns && !(0,
|
|
157154
|
+
(0, import_code_core7.parsePluginSource)(spec);
|
|
157155
|
+
const patterns = (0, import_code_core7.allowedSourcePatterns)();
|
|
157156
|
+
if (patterns && !(0, import_code_core7.isSourceAllowed)(spec, patterns)) {
|
|
156964
157157
|
console.error(source_default.red(` \u2717 "${spec}" is not permitted by your organisation's policy.`));
|
|
156965
157158
|
console.error(source_default.dim(` Allowed: ${patterns.join(", ")}`));
|
|
156966
157159
|
process.exitCode = 1;
|
|
156967
157160
|
return;
|
|
156968
157161
|
}
|
|
156969
157162
|
const scope = opts.project ? "project" : "user";
|
|
156970
|
-
const file = (0,
|
|
156971
|
-
(0,
|
|
157163
|
+
const file = (0, import_code_core7.sourcesFileFor)(scope, process.cwd());
|
|
157164
|
+
(0, import_code_core7.writeDeclaredSource)(file, name, spec);
|
|
156972
157165
|
console.log();
|
|
156973
157166
|
console.log(source_default.green(` \u2713 Declared "${name}" \u2192 ${spec}`) + source_default.dim(` (${scope})`));
|
|
156974
157167
|
console.log(source_default.dim(` ${file}`));
|
|
@@ -156982,13 +157175,13 @@ function pluginSourceAddCommand(name, spec, opts) {
|
|
|
156982
157175
|
function pluginSourceRemoveCommand(name, opts) {
|
|
156983
157176
|
const workDir = process.cwd();
|
|
156984
157177
|
const scope = opts.project ? "project" : "user";
|
|
156985
|
-
const file = (0,
|
|
156986
|
-
if ((0,
|
|
157178
|
+
const file = (0, import_code_core7.sourcesFileFor)(scope, workDir);
|
|
157179
|
+
if ((0, import_code_core7.removeDeclaredSource)(file, name)) {
|
|
156987
157180
|
console.log(source_default.green(` \u2713 Removed source "${name}" (${scope})`));
|
|
156988
157181
|
console.log(source_default.dim(" Plugins already installed from it are untouched \u2014 remove them with nex plugin remove <name>"));
|
|
156989
157182
|
return;
|
|
156990
157183
|
}
|
|
156991
|
-
const found = (0,
|
|
157184
|
+
const found = (0, import_code_core7.resolveSourceAlias)(name, workDir, { includeProject: true });
|
|
156992
157185
|
if (found) {
|
|
156993
157186
|
console.error(source_default.red(` \u2717 "${name}" is declared in the ${found.tier} tier, not ${scope}.`));
|
|
156994
157187
|
console.error(source_default.dim(` ${found.file}`));
|
|
@@ -157009,6 +157202,13 @@ var program2 = new Command();
|
|
|
157009
157202
|
program2.name("nex").description("Nexrall Code \u2014 AI coding assistant (powered by Nexrall)").version(NEX_VERSION).enablePositionalOptions();
|
|
157010
157203
|
program2.command("auth").description("Login to your Nexrall account").action(authCommand);
|
|
157011
157204
|
program2.command("logout").description("Log out of your Nexrall account").action(logoutCommand);
|
|
157205
|
+
var billing = program2.command("billing").description("Show, or change, which budget pays for your usage");
|
|
157206
|
+
billing.command("use <team|personal>").description("Bill to a team id (see `nex billing`) or back to your personal wallet").action(async (target) => {
|
|
157207
|
+
await billingUseCommand(target);
|
|
157208
|
+
});
|
|
157209
|
+
billing.action(async () => {
|
|
157210
|
+
await billingStatusCommand();
|
|
157211
|
+
});
|
|
157012
157212
|
program2.command("update").description("Update nex to the latest version").option("-c, --check", "Check for updates without installing").option("-y, --yes", "Skip confirmation prompt").action(async (opts) => {
|
|
157013
157213
|
await updateCommand({ check: opts.check, yes: opts.yes });
|
|
157014
157214
|
});
|
|
@@ -157078,7 +157278,7 @@ program2.command("sessions").description("List or delete saved chat sessions").o
|
|
|
157078
157278
|
console.log();
|
|
157079
157279
|
});
|
|
157080
157280
|
program2.option("-p, --pro", "Use Claude Opus 5 (most capable)").option("-t, --turbo", "Use Claude Sonnet 5 (fast, default)").option("-u, --ultra", "Use Claude Fable 5 (most powerful)").option("-y, --yolo", "Auto-approve all tool calls (no permission prompts)").option("-d, --dir <path>", "Set working directory (default: current directory)").option("-m, --model <name>", "Explicit model, e.g. claude-opus-5-5 | gpt-5.4 | gpt-4.1").option("-r, --resume [id]", "Resume last session, or a specific session id").option("-w, --worktree [name]", "Isolate this session in its own worktree \u2014 a separate directory (and, in a git repo, its own branch) so it can never overwrite files another session (or you) are touching in the main checkout. Omit a name for an auto-generated one; pass an existing name to resume that same worktree.").option("-e, --effort <level>", "Thinking effort \u2014 real levels depend on the model (e.g. DeepSeek: low|high|max, Qwen: low|high); run `nex --model <id>` then `/effort` with no argument to see a model's scale").option("--no-banner", "Skip the ASCII banner (useful in scripts/pipes)").option("--output-format <fmt>", "One-shot output format: text | json | stream-json (implies auto-approve)").option("--audit [path]", "Log every tool call (and refusal) to a JSONL trail (default: .nexrall/audit/<session>.jsonl)").argument("[prompt...]", "One-shot prompt \u2014 if omitted, starts interactive mode").action(async (promptParts, options) => {
|
|
157081
|
-
if (!(0,
|
|
157281
|
+
if (!(0, import_code_core8.isAuthenticated)()) {
|
|
157082
157282
|
console.error("Not logged in. Run: nex auth");
|
|
157083
157283
|
process.exit(1);
|
|
157084
157284
|
}
|