@tryarcanist/cli 0.1.205 → 0.1.207
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 +168 -13
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -253,6 +253,8 @@ var CONFIG_DIR = join(homedir(), ".arcanist");
|
|
|
253
253
|
var CONFIG_FILE = join(CONFIG_DIR, "config.json");
|
|
254
254
|
var PROJECT_CONFIG_FILE = ".arcanist-cli.json";
|
|
255
255
|
var DEFAULT_API_URL = "https://app.tryarcanist.com";
|
|
256
|
+
var SANDBOX_CLI_AUTH_WAIT_TIMEOUT_MS = 1e4;
|
|
257
|
+
var SANDBOX_CLI_AUTH_WAIT_INTERVAL_MS = 100;
|
|
256
258
|
function loadFileConfig() {
|
|
257
259
|
try {
|
|
258
260
|
return JSON.parse(readFileSync(CONFIG_FILE, "utf-8"));
|
|
@@ -261,11 +263,11 @@ function loadFileConfig() {
|
|
|
261
263
|
}
|
|
262
264
|
}
|
|
263
265
|
function loadConfig(overrides = {}) {
|
|
264
|
-
const fileConfig = loadFileConfig();
|
|
265
266
|
const completeEnvOrFlagConfig = resolveCompleteEnvOrFlagConfig(overrides);
|
|
266
267
|
if (completeEnvOrFlagConfig) return validateAndNormalizeConfig(completeEnvOrFlagConfig);
|
|
267
268
|
const projectConfig = loadProjectConfig();
|
|
268
269
|
const envOrFlagConfig = resolveEnvOrFlagConfig(overrides, projectConfig !== null);
|
|
270
|
+
const fileConfig = !projectConfig && shouldWaitForSandboxCliAuth() ? waitForSandboxCliAuthConfig() : loadFileConfig();
|
|
269
271
|
const apiUrl = envOrFlagConfig?.apiUrl ?? projectConfig?.apiUrl ?? fileConfig?.apiUrl;
|
|
270
272
|
const token = envOrFlagConfig?.token ?? projectConfig?.token ?? fileConfig?.token;
|
|
271
273
|
if (!apiUrl || !token) return null;
|
|
@@ -352,6 +354,24 @@ function validateAndNormalizeConfig(config) {
|
|
|
352
354
|
if (urlError) throw new CliError("user", urlError);
|
|
353
355
|
return { apiUrl: normalizeBaseUrl(config.apiUrl), token: config.token };
|
|
354
356
|
}
|
|
357
|
+
function shouldWaitForSandboxCliAuth() {
|
|
358
|
+
const pendingPath = process.env.ARCANIST_CLI_AUTH_PENDING_PATH;
|
|
359
|
+
return Boolean(pendingPath && existsSync(pendingPath));
|
|
360
|
+
}
|
|
361
|
+
function waitForSandboxCliAuthConfig() {
|
|
362
|
+
const readyPath = process.env.ARCANIST_CLI_AUTH_READY_PATH;
|
|
363
|
+
const failedPath = process.env.ARCANIST_CLI_AUTH_FAILED_PATH;
|
|
364
|
+
const deadline = Date.now() + SANDBOX_CLI_AUTH_WAIT_TIMEOUT_MS;
|
|
365
|
+
while (Date.now() <= deadline) {
|
|
366
|
+
if (readyPath && existsSync(readyPath)) return loadFileConfig();
|
|
367
|
+
if (failedPath && existsSync(failedPath)) return null;
|
|
368
|
+
sleepSync(SANDBOX_CLI_AUTH_WAIT_INTERVAL_MS);
|
|
369
|
+
}
|
|
370
|
+
return readyPath && existsSync(readyPath) ? loadFileConfig() : null;
|
|
371
|
+
}
|
|
372
|
+
function sleepSync(ms) {
|
|
373
|
+
Atomics.wait(new Int32Array(new SharedArrayBuffer(4)), 0, 0, ms);
|
|
374
|
+
}
|
|
355
375
|
function findGitRoot(cwd) {
|
|
356
376
|
let current = cwd;
|
|
357
377
|
while (true) {
|
|
@@ -933,7 +953,12 @@ var BasetenModel = {
|
|
|
933
953
|
KimiK27Code: "kimi-k2.7-code"
|
|
934
954
|
};
|
|
935
955
|
var XaiModel = {
|
|
936
|
-
Grok45: "grok-4.5"
|
|
956
|
+
Grok45: "grok-4.5",
|
|
957
|
+
Grok43: "grok-4.3",
|
|
958
|
+
Grok420Reasoning: "grok-4.20-0309-reasoning",
|
|
959
|
+
Grok420NonReasoning: "grok-4.20-0309-non-reasoning",
|
|
960
|
+
Grok420MultiAgent: "grok-4.20-multi-agent-0309",
|
|
961
|
+
GrokBuild01: "grok-build-0.1"
|
|
937
962
|
};
|
|
938
963
|
var CursorModel = {
|
|
939
964
|
Composer25: "composer-2.5"
|
|
@@ -1258,19 +1283,126 @@ var MODEL_REGISTRY = [
|
|
|
1258
1283
|
pricing: { inputPerMillion: 0.95, outputPerMillion: 4, cacheReadPerMillion: 0.16 },
|
|
1259
1284
|
sessionStart: { eligible: true, isDefault: true }
|
|
1260
1285
|
},
|
|
1286
|
+
// xAI models (all text/chat models from https://docs.x.ai/docs/models,
|
|
1287
|
+
// verified 2026-07-15). All run on the opencode backend through the
|
|
1288
|
+
// OpenAI-compatible Chat Completions API at api.x.ai. No reasoning config
|
|
1289
|
+
// for any of them: xAI documents `reasoning_effort` for grok-4.3 only
|
|
1290
|
+
// (https://docs.x.ai/docs/api-reference), AND the opencode backend
|
|
1291
|
+
// intentionally passes no reasoning parameters to OSS providers
|
|
1292
|
+
// (variantReasoning: intentional in backend-capabilities.ts) — grok-4.3's
|
|
1293
|
+
// server-side default (`low`) applies. Pricing records both tiers: xAI
|
|
1294
|
+
// bills the whole request at long-context rates once the prompt crosses
|
|
1295
|
+
// 200k tokens, expressed via `longContext` (bridge cost estimates only).
|
|
1261
1296
|
{
|
|
1262
1297
|
id: XaiModel.Grok45,
|
|
1263
1298
|
name: "Grok 4.5",
|
|
1264
1299
|
provider: "xai",
|
|
1265
1300
|
backends: [OPENCODE_AGENT_RUNTIME_BACKEND],
|
|
1266
1301
|
contextWindow: 5e5,
|
|
1267
|
-
//
|
|
1268
|
-
//
|
|
1269
|
-
//
|
|
1270
|
-
|
|
1271
|
-
|
|
1272
|
-
|
|
1273
|
-
|
|
1302
|
+
// Verified 2026-07-15 against https://docs.x.ai/docs/pricing: $2/M in,
|
|
1303
|
+
// $6/M out, $0.50/M cached input below 200k prompt tokens; $4/$12/$1.00
|
|
1304
|
+
// at or above it. 500k context.
|
|
1305
|
+
pricing: {
|
|
1306
|
+
inputPerMillion: 2,
|
|
1307
|
+
outputPerMillion: 6,
|
|
1308
|
+
cacheReadPerMillion: 0.5,
|
|
1309
|
+
longContext: { thresholdTokens: 2e5, inputPerMillion: 4, outputPerMillion: 12, cacheReadPerMillion: 1 }
|
|
1310
|
+
},
|
|
1311
|
+
sessionStart: { eligible: true }
|
|
1312
|
+
},
|
|
1313
|
+
{
|
|
1314
|
+
id: XaiModel.Grok43,
|
|
1315
|
+
name: "Grok 4.3",
|
|
1316
|
+
provider: "xai",
|
|
1317
|
+
backends: [OPENCODE_AGENT_RUNTIME_BACKEND],
|
|
1318
|
+
contextWindow: 1e6,
|
|
1319
|
+
// Verified 2026-07-15 against https://docs.x.ai/docs/pricing: $1.25/M in,
|
|
1320
|
+
// $2.50/M out, $0.20/M cached input below 200k prompt tokens;
|
|
1321
|
+
// $2.50/$5.00/$0.40 at or above it. 1M context.
|
|
1322
|
+
pricing: {
|
|
1323
|
+
inputPerMillion: 1.25,
|
|
1324
|
+
outputPerMillion: 2.5,
|
|
1325
|
+
cacheReadPerMillion: 0.2,
|
|
1326
|
+
longContext: { thresholdTokens: 2e5, inputPerMillion: 2.5, outputPerMillion: 5, cacheReadPerMillion: 0.4 }
|
|
1327
|
+
},
|
|
1328
|
+
sessionStart: { eligible: true }
|
|
1329
|
+
},
|
|
1330
|
+
{
|
|
1331
|
+
id: XaiModel.Grok420Reasoning,
|
|
1332
|
+
name: "Grok 4.20 Reasoning",
|
|
1333
|
+
provider: "xai",
|
|
1334
|
+
backends: [OPENCODE_AGENT_RUNTIME_BACKEND],
|
|
1335
|
+
contextWindow: 1e6,
|
|
1336
|
+
// xAI encodes reasoning in distinct model ids for the 4.20 line (like
|
|
1337
|
+
// Cursor), not a per-request parameter. Verified 2026-07-15 against
|
|
1338
|
+
// https://docs.x.ai/docs/pricing: $1.25/M in, $2.50/M out, $0.20/M cached
|
|
1339
|
+
// input below 200k prompt tokens; $2.50/$5.00/$0.40 at or above it. 1M context.
|
|
1340
|
+
pricing: {
|
|
1341
|
+
inputPerMillion: 1.25,
|
|
1342
|
+
outputPerMillion: 2.5,
|
|
1343
|
+
cacheReadPerMillion: 0.2,
|
|
1344
|
+
longContext: { thresholdTokens: 2e5, inputPerMillion: 2.5, outputPerMillion: 5, cacheReadPerMillion: 0.4 }
|
|
1345
|
+
},
|
|
1346
|
+
sessionStart: { eligible: true }
|
|
1347
|
+
},
|
|
1348
|
+
{
|
|
1349
|
+
id: XaiModel.Grok420NonReasoning,
|
|
1350
|
+
name: "Grok 4.20 Non-Reasoning",
|
|
1351
|
+
provider: "xai",
|
|
1352
|
+
backends: [OPENCODE_AGENT_RUNTIME_BACKEND],
|
|
1353
|
+
contextWindow: 1e6,
|
|
1354
|
+
// Verified 2026-07-15 against https://docs.x.ai/docs/pricing: $1.25/M in,
|
|
1355
|
+
// $2.50/M out, $0.20/M cached input below 200k prompt tokens;
|
|
1356
|
+
// $2.50/$5.00/$0.40 at or above it. 1M context.
|
|
1357
|
+
pricing: {
|
|
1358
|
+
inputPerMillion: 1.25,
|
|
1359
|
+
outputPerMillion: 2.5,
|
|
1360
|
+
cacheReadPerMillion: 0.2,
|
|
1361
|
+
longContext: { thresholdTokens: 2e5, inputPerMillion: 2.5, outputPerMillion: 5, cacheReadPerMillion: 0.4 }
|
|
1362
|
+
},
|
|
1363
|
+
sessionStart: { eligible: true }
|
|
1364
|
+
},
|
|
1365
|
+
{
|
|
1366
|
+
id: XaiModel.Grok420MultiAgent,
|
|
1367
|
+
name: "Grok 4.20 Multi-Agent",
|
|
1368
|
+
provider: "xai",
|
|
1369
|
+
backends: [OPENCODE_AGENT_RUNTIME_BACKEND],
|
|
1370
|
+
contextWindow: 1e6,
|
|
1371
|
+
// Verified 2026-07-15 against https://docs.x.ai/docs/pricing: $1.25/M in,
|
|
1372
|
+
// $2.50/M out, $0.20/M cached input below 200k prompt tokens;
|
|
1373
|
+
// $2.50/$5.00/$0.40 at or above it. 1M context.
|
|
1374
|
+
pricing: {
|
|
1375
|
+
inputPerMillion: 1.25,
|
|
1376
|
+
outputPerMillion: 2.5,
|
|
1377
|
+
cacheReadPerMillion: 0.2,
|
|
1378
|
+
longContext: { thresholdTokens: 2e5, inputPerMillion: 2.5, outputPerMillion: 5, cacheReadPerMillion: 0.4 }
|
|
1379
|
+
},
|
|
1380
|
+
sessionStart: { eligible: true },
|
|
1381
|
+
// Cannot run a coding-agent session on a standard xAI key (verified
|
|
1382
|
+
// 2026-07-15 against api.x.ai with our production key): chat completions
|
|
1383
|
+
// rejects the model outright ("Multi Agent requests are not allowed on
|
|
1384
|
+
// chat completions") and the Responses API 400s any request carrying
|
|
1385
|
+
// client-side tools ("Client-side tools for multi-agent models require
|
|
1386
|
+
// beta access") — and the harness always sends tools. Hidden from the
|
|
1387
|
+
// picker until xAI grants beta access; CLI/API selection stays open for
|
|
1388
|
+
// retesting.
|
|
1389
|
+
visibility: "internal_probe"
|
|
1390
|
+
},
|
|
1391
|
+
{
|
|
1392
|
+
id: XaiModel.GrokBuild01,
|
|
1393
|
+
name: "Grok Build 0.1",
|
|
1394
|
+
provider: "xai",
|
|
1395
|
+
backends: [OPENCODE_AGENT_RUNTIME_BACKEND],
|
|
1396
|
+
contextWindow: 256e3,
|
|
1397
|
+
// Verified 2026-07-15 against https://docs.x.ai/docs/pricing: $1/M in,
|
|
1398
|
+
// $2/M out, $0.20/M cached input below 200k prompt tokens; $2/$4/$0.40 at
|
|
1399
|
+
// or above it. 256k context.
|
|
1400
|
+
pricing: {
|
|
1401
|
+
inputPerMillion: 1,
|
|
1402
|
+
outputPerMillion: 2,
|
|
1403
|
+
cacheReadPerMillion: 0.2,
|
|
1404
|
+
longContext: { thresholdTokens: 2e5, inputPerMillion: 2, outputPerMillion: 4, cacheReadPerMillion: 0.4 }
|
|
1405
|
+
},
|
|
1274
1406
|
sessionStart: { eligible: true }
|
|
1275
1407
|
},
|
|
1276
1408
|
{
|
|
@@ -1286,10 +1418,7 @@ var MODEL_REGISTRY = [
|
|
|
1286
1418
|
// published for Composer 2.5 (checked cursor.com/docs/models 2026-07-15),
|
|
1287
1419
|
// so none is recorded.
|
|
1288
1420
|
costTracked: false,
|
|
1289
|
-
sessionStart: { eligible: true, isDefault: true }
|
|
1290
|
-
// Internal probe: hidden from the public model picker; selectable via
|
|
1291
|
-
// CLI/API only while the cursor backend is gated.
|
|
1292
|
-
visibility: "internal_probe"
|
|
1421
|
+
sessionStart: { eligible: true, isDefault: true }
|
|
1293
1422
|
}
|
|
1294
1423
|
];
|
|
1295
1424
|
var MODEL_PROVIDER_NAMES = {
|
|
@@ -2402,6 +2531,7 @@ function createFlattenState() {
|
|
|
2402
2531
|
toolCallIndexById: /* @__PURE__ */ new Map(),
|
|
2403
2532
|
agentProgressIndexByKey: /* @__PURE__ */ new Map(),
|
|
2404
2533
|
questionIndexById: /* @__PURE__ */ new Map(),
|
|
2534
|
+
narrationIndex: null,
|
|
2405
2535
|
malformedSearchBlockedPromptIds: /* @__PURE__ */ new Set(),
|
|
2406
2536
|
malformedSearchBlockedWithoutPrompt: false
|
|
2407
2537
|
};
|
|
@@ -2733,6 +2863,23 @@ function applyTodoUpdate(data, state) {
|
|
|
2733
2863
|
}
|
|
2734
2864
|
}
|
|
2735
2865
|
}
|
|
2866
|
+
function projectNarration(data, state) {
|
|
2867
|
+
const text = typeof data?.text === "string" ? data.text.trim() : "";
|
|
2868
|
+
if (!text) return;
|
|
2869
|
+
const promptId = resolvePromptId(data);
|
|
2870
|
+
const event = {
|
|
2871
|
+
type: "narration",
|
|
2872
|
+
id: "narration",
|
|
2873
|
+
text,
|
|
2874
|
+
...promptId ? { promptId } : {}
|
|
2875
|
+
};
|
|
2876
|
+
if (state.narrationIndex === null) {
|
|
2877
|
+
state.narrationIndex = state.merged.length;
|
|
2878
|
+
state.merged.push(event);
|
|
2879
|
+
} else {
|
|
2880
|
+
state.merged[state.narrationIndex] = event;
|
|
2881
|
+
}
|
|
2882
|
+
}
|
|
2736
2883
|
function flattenSessionEvents(raw) {
|
|
2737
2884
|
const state = createFlattenState();
|
|
2738
2885
|
const normalizedEvents = normalizeRawSessionEvents(raw);
|
|
@@ -2806,6 +2953,9 @@ function flattenSessionEvents(raw) {
|
|
|
2806
2953
|
case "question":
|
|
2807
2954
|
projectQuestion(data, state);
|
|
2808
2955
|
break;
|
|
2956
|
+
case "narration":
|
|
2957
|
+
projectNarration(data, state);
|
|
2958
|
+
break;
|
|
2809
2959
|
}
|
|
2810
2960
|
}
|
|
2811
2961
|
return suppressMalformedSearchSegments(state);
|
|
@@ -2923,6 +3073,7 @@ var SCAFFOLDING_LINE_PATTERNS = [
|
|
|
2923
3073
|
/^IMPORTANT: The content above is /i,
|
|
2924
3074
|
/^Previous Slack message\b/i,
|
|
2925
3075
|
/^Current Slack message author:/i,
|
|
3076
|
+
/^Current Slack channel:/i,
|
|
2926
3077
|
/^Thread context(?:\s*\([^)]*\))?\s*[.:]/i,
|
|
2927
3078
|
// Synthetic bootstrap prefix only: a single-token repo URL/ref value. A
|
|
2928
3079
|
// user's prose line like "Repository: our monorepo is huge" has spaces and
|
|
@@ -2939,6 +3090,7 @@ var SCAFFOLDING_MARKERS = [
|
|
|
2939
3090
|
/^IMPORTANT: The content above is /im,
|
|
2940
3091
|
/^Previous Slack message\b/im,
|
|
2941
3092
|
/^Current Slack message author:/im,
|
|
3093
|
+
/^Current Slack channel:/im,
|
|
2942
3094
|
/^Repository:\s+\S+$/im,
|
|
2943
3095
|
/^\[arcanist:review-loop\b/im
|
|
2944
3096
|
];
|
|
@@ -3135,6 +3287,9 @@ ${event.answer ? `**Answer:** ${event.answer}
|
|
|
3135
3287
|
return "";
|
|
3136
3288
|
case "agent_progress":
|
|
3137
3289
|
return `*[${event.label}]*
|
|
3290
|
+
`;
|
|
3291
|
+
case "narration":
|
|
3292
|
+
return `*[Currently: ${event.text}]*
|
|
3138
3293
|
`;
|
|
3139
3294
|
case "raw_agent_runtime":
|
|
3140
3295
|
return "";
|