@tryarcanist/cli 0.1.164 → 0.1.166
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 +66 -26
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -7,6 +7,11 @@ import { Command } from "commander";
|
|
|
7
7
|
// src/api.ts
|
|
8
8
|
import { createRequire } from "module";
|
|
9
9
|
|
|
10
|
+
// ../../shared/utils/errors.ts
|
|
11
|
+
function stringifyError(error) {
|
|
12
|
+
return error instanceof Error ? error.message : String(error);
|
|
13
|
+
}
|
|
14
|
+
|
|
10
15
|
// ../../shared/utils/url.ts
|
|
11
16
|
function normalizeBaseUrl(url) {
|
|
12
17
|
return url.replace(/\/+$/, "");
|
|
@@ -122,7 +127,7 @@ async function apiRequest(config, path, init) {
|
|
|
122
127
|
headers
|
|
123
128
|
});
|
|
124
129
|
} catch (err) {
|
|
125
|
-
throw new CliError("server", `Network error: ${
|
|
130
|
+
throw new CliError("server", `Network error: ${stringifyError(err)}`);
|
|
126
131
|
}
|
|
127
132
|
if (!res.ok) {
|
|
128
133
|
const body = await res.text().catch(() => "");
|
|
@@ -504,6 +509,12 @@ var AGENT_RUNTIME_BACKENDS = [
|
|
|
504
509
|
CLAUDE_CODE_AGENT_RUNTIME_BACKEND,
|
|
505
510
|
OPENCODE_AGENT_RUNTIME_BACKEND
|
|
506
511
|
];
|
|
512
|
+
var AGENT_RUNTIME_BACKEND_NAMES = {
|
|
513
|
+
[CODEX_AGENT_RUNTIME_BACKEND]: "Codex",
|
|
514
|
+
[CLAUDE_CODE_AGENT_RUNTIME_BACKEND]: "Claude Code",
|
|
515
|
+
// "opencode" is intentionally lowercase to match the project's brand name.
|
|
516
|
+
[OPENCODE_AGENT_RUNTIME_BACKEND]: "opencode"
|
|
517
|
+
};
|
|
507
518
|
function isAgentRuntimeBackend(value) {
|
|
508
519
|
return AGENT_RUNTIME_BACKENDS.includes(value);
|
|
509
520
|
}
|
|
@@ -536,7 +547,9 @@ var AnthropicModel = {
|
|
|
536
547
|
Sonnet46: "claude-sonnet-4-6"
|
|
537
548
|
};
|
|
538
549
|
var BasetenModel = {
|
|
539
|
-
Glm47: "glm-4.7"
|
|
550
|
+
Glm47: "glm-4.7",
|
|
551
|
+
GptOss120B: "gpt-oss-120b",
|
|
552
|
+
KimiK27Code: "kimi-k2.7-code"
|
|
540
553
|
};
|
|
541
554
|
var MODEL_PROVIDERS_SET = /* @__PURE__ */ new Set([
|
|
542
555
|
"openai",
|
|
@@ -707,6 +720,33 @@ var MODEL_REGISTRY = [
|
|
|
707
720
|
providerModelId: "zai-org/GLM-4.7",
|
|
708
721
|
pricing: { inputPerMillion: 0.6, outputPerMillion: 2.2, cacheReadPerMillion: 0.12 },
|
|
709
722
|
sessionStart: { eligible: true, isDefault: true }
|
|
723
|
+
},
|
|
724
|
+
{
|
|
725
|
+
id: BasetenModel.GptOss120B,
|
|
726
|
+
name: "GPT OSS 120B",
|
|
727
|
+
provider: "baseten",
|
|
728
|
+
backends: [OPENCODE_AGENT_RUNTIME_BACKEND],
|
|
729
|
+
contextWindow: 128e3,
|
|
730
|
+
// Verified 2026-07-04 against Baseten Model APIs docs and model library:
|
|
731
|
+
// wire id `openai/gpt-oss-120b`, 128k served context/output, OpenAI SDK
|
|
732
|
+
// compatible, Apache 2.0, tool calling supported for all Model APIs.
|
|
733
|
+
providerModelId: "openai/gpt-oss-120b",
|
|
734
|
+
pricing: { inputPerMillion: 0.1, outputPerMillion: 0.5 },
|
|
735
|
+
sessionStart: { eligible: true }
|
|
736
|
+
},
|
|
737
|
+
{
|
|
738
|
+
id: BasetenModel.KimiK27Code,
|
|
739
|
+
name: "Kimi K2.7 Code",
|
|
740
|
+
provider: "baseten",
|
|
741
|
+
backends: [OPENCODE_AGENT_RUNTIME_BACKEND],
|
|
742
|
+
contextWindow: 262e3,
|
|
743
|
+
// Verified 2026-07-04 against Baseten Model APIs docs, model library, and
|
|
744
|
+
// changelog: wire id `moonshotai/Kimi-K2.7-Code`, 262k served
|
|
745
|
+
// context/output, OpenAI SDK compatible, MIT license, tool calling
|
|
746
|
+
// supported for all Model APIs.
|
|
747
|
+
providerModelId: "moonshotai/Kimi-K2.7-Code",
|
|
748
|
+
pricing: { inputPerMillion: 0.95, outputPerMillion: 4, cacheReadPerMillion: 0.16 },
|
|
749
|
+
sessionStart: { eligible: true }
|
|
710
750
|
}
|
|
711
751
|
];
|
|
712
752
|
var MODEL_PROVIDER_NAMES = {
|
|
@@ -1006,7 +1046,7 @@ async function automationApiFetchText(config, path, init) {
|
|
|
1006
1046
|
}
|
|
1007
1047
|
function mapAutomationApiError(err) {
|
|
1008
1048
|
if (!(err instanceof ApiError)) {
|
|
1009
|
-
return err instanceof CliError ? err : new CliError("server",
|
|
1049
|
+
return err instanceof CliError ? err : new CliError("server", stringifyError(err));
|
|
1010
1050
|
}
|
|
1011
1051
|
const parsed = parseApiErrorBody2(err.body);
|
|
1012
1052
|
const serverCode = parsed?.error;
|
|
@@ -1040,6 +1080,7 @@ function printAutomationRule(rule) {
|
|
|
1040
1080
|
console.log(`ID: ${rule.id}`);
|
|
1041
1081
|
console.log(`Repo: ${rule.repoOwner}/${rule.repoName}`);
|
|
1042
1082
|
console.log(`Cron: ${rule.normalizedCron}`);
|
|
1083
|
+
if (rule.modelId) console.log(`Model: ${rule.modelId}`);
|
|
1043
1084
|
console.log(`Next fire: ${formatTime(rule.nextFireAt)}`);
|
|
1044
1085
|
}
|
|
1045
1086
|
function formatTime(value) {
|
|
@@ -1052,6 +1093,19 @@ function sleep(ms) {
|
|
|
1052
1093
|
}
|
|
1053
1094
|
|
|
1054
1095
|
// ../../shared/session/phase.ts
|
|
1096
|
+
var PHASES = [
|
|
1097
|
+
"idle",
|
|
1098
|
+
"running",
|
|
1099
|
+
"waiting_for_input",
|
|
1100
|
+
"finalizing",
|
|
1101
|
+
"review_listening",
|
|
1102
|
+
"completed",
|
|
1103
|
+
"superseded",
|
|
1104
|
+
"blocked",
|
|
1105
|
+
"failed",
|
|
1106
|
+
"stopped",
|
|
1107
|
+
"archived"
|
|
1108
|
+
];
|
|
1055
1109
|
var TERMINAL_PHASES_ARRAY = [
|
|
1056
1110
|
"completed",
|
|
1057
1111
|
"superseded",
|
|
@@ -1185,7 +1239,7 @@ async function resolveUploadedFileOptions(files) {
|
|
|
1185
1239
|
try {
|
|
1186
1240
|
return { name, content: await readFile(path, "utf8") };
|
|
1187
1241
|
} catch (err) {
|
|
1188
|
-
const message =
|
|
1242
|
+
const message = stringifyError(err);
|
|
1189
1243
|
throw new CliError("user", `Failed to read uploaded file ${path}: ${message}`);
|
|
1190
1244
|
}
|
|
1191
1245
|
})
|
|
@@ -2161,6 +2215,7 @@ var ERROR_CODES = [
|
|
|
2161
2215
|
"api_error",
|
|
2162
2216
|
"config_error",
|
|
2163
2217
|
"failed_edits",
|
|
2218
|
+
"memory_enforcement_failed",
|
|
2164
2219
|
"failure_loop_suspected",
|
|
2165
2220
|
"empty_completion",
|
|
2166
2221
|
"followup_not_started",
|
|
@@ -2201,6 +2256,7 @@ var ERROR_CODE_LABELS = {
|
|
|
2201
2256
|
api_error: "Provider API error",
|
|
2202
2257
|
config_error: "Configuration error",
|
|
2203
2258
|
failed_edits: "Edit failure",
|
|
2259
|
+
memory_enforcement_failed: "Memory enforcement failed",
|
|
2204
2260
|
failure_loop_suspected: "Suspected failure loop",
|
|
2205
2261
|
empty_completion: "Empty completion",
|
|
2206
2262
|
followup_not_started: "Follow-up did not start",
|
|
@@ -2244,19 +2300,7 @@ function formatSessionErrorMessage(error, code) {
|
|
|
2244
2300
|
// src/utils/session-output.ts
|
|
2245
2301
|
var SHORT_SESSION_ID_LENGTH = 8;
|
|
2246
2302
|
var PROMPT_LABEL_MAX_CHARS = 80;
|
|
2247
|
-
var VALID_PHASES =
|
|
2248
|
-
"idle",
|
|
2249
|
-
"running",
|
|
2250
|
-
"waiting_for_input",
|
|
2251
|
-
"finalizing",
|
|
2252
|
-
"review_listening",
|
|
2253
|
-
"completed",
|
|
2254
|
-
"superseded",
|
|
2255
|
-
"blocked",
|
|
2256
|
-
"failed",
|
|
2257
|
-
"stopped",
|
|
2258
|
-
"archived"
|
|
2259
|
-
]);
|
|
2303
|
+
var VALID_PHASES = new Set(PHASES);
|
|
2260
2304
|
var VALID_SANDBOX_SUBSTATES = /* @__PURE__ */ new Set(["creating", "reconnecting", "stopping", "none"]);
|
|
2261
2305
|
var VALID_STOP_MODES = /* @__PURE__ */ new Set(["user", "resumable", "none"]);
|
|
2262
2306
|
var VALID_FINALIZING_STEPS = /* @__PURE__ */ new Set(["post_execution", "publishing", "none"]);
|
|
@@ -2525,7 +2569,7 @@ function parseJsonObject(value) {
|
|
|
2525
2569
|
const parsed = JSON.parse(value);
|
|
2526
2570
|
return parsed && typeof parsed === "object" ? parsed : {};
|
|
2527
2571
|
} catch (err) {
|
|
2528
|
-
throw new Error(`Malformed SSE JSON payload: ${
|
|
2572
|
+
throw new Error(`Malformed SSE JSON payload: ${stringifyError(err)}`);
|
|
2529
2573
|
}
|
|
2530
2574
|
}
|
|
2531
2575
|
function formatPromptLabel(promptId, promptLabels) {
|
|
@@ -2705,9 +2749,7 @@ async function watchCommand(sessionId, options, command) {
|
|
|
2705
2749
|
try {
|
|
2706
2750
|
promptLabels = await fetchPromptLabels(config, sessionId);
|
|
2707
2751
|
} catch (err) {
|
|
2708
|
-
console.error(
|
|
2709
|
-
`Warning: failed to fetch prompt labels for session ${sessionId}: ${err instanceof Error ? err.message : String(err)}`
|
|
2710
|
-
);
|
|
2752
|
+
console.error(`Warning: failed to fetch prompt labels for session ${sessionId}: ${stringifyError(err)}`);
|
|
2711
2753
|
}
|
|
2712
2754
|
}
|
|
2713
2755
|
const renderState = {
|
|
@@ -2968,7 +3010,7 @@ async function createCommand(repoUrl, promptArg, options, command) {
|
|
|
2968
3010
|
} catch (err) {
|
|
2969
3011
|
throw new CliError(
|
|
2970
3012
|
err instanceof CliError ? err.code : "server",
|
|
2971
|
-
`Session created (${sessionId}) but prompt failed: ${
|
|
3013
|
+
`Session created (${sessionId}) but prompt failed: ${stringifyError(err)}`,
|
|
2972
3014
|
{
|
|
2973
3015
|
exitCode: err instanceof CliError ? err.exitCode : void 0,
|
|
2974
3016
|
hint: `Retry with: arcanist sessions send ${sessionId} --prompt-stdin`,
|
|
@@ -3762,7 +3804,7 @@ function git(args) {
|
|
|
3762
3804
|
try {
|
|
3763
3805
|
return execFileSync("git", args, { encoding: "utf8", stdio: ["ignore", "pipe", "pipe"] }).trim();
|
|
3764
3806
|
} catch (err) {
|
|
3765
|
-
throw new CliError("user", `git ${args.join(" ")} failed: ${
|
|
3807
|
+
throw new CliError("user", `git ${args.join(" ")} failed: ${stringifyError(err)}`);
|
|
3766
3808
|
}
|
|
3767
3809
|
}
|
|
3768
3810
|
function currentRepo() {
|
|
@@ -4345,9 +4387,7 @@ async function sessionEventsCommand(sessionId, options, command) {
|
|
|
4345
4387
|
return;
|
|
4346
4388
|
}
|
|
4347
4389
|
const promptLabels = await fetchPromptLabels(config, sessionId).catch((err) => {
|
|
4348
|
-
console.error(
|
|
4349
|
-
`Warning: failed to fetch prompt labels for session ${sessionId}: ${err instanceof Error ? err.message : String(err)}`
|
|
4350
|
-
);
|
|
4390
|
+
console.error(`Warning: failed to fetch prompt labels for session ${sessionId}: ${stringifyError(err)}`);
|
|
4351
4391
|
return /* @__PURE__ */ new Map();
|
|
4352
4392
|
});
|
|
4353
4393
|
const state = { promptLabels, toolCalls: /* @__PURE__ */ new Map() };
|