@tryarcanist/cli 0.1.165 → 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 +65 -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;
|
|
@@ -1053,6 +1093,19 @@ function sleep(ms) {
|
|
|
1053
1093
|
}
|
|
1054
1094
|
|
|
1055
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
|
+
];
|
|
1056
1109
|
var TERMINAL_PHASES_ARRAY = [
|
|
1057
1110
|
"completed",
|
|
1058
1111
|
"superseded",
|
|
@@ -1186,7 +1239,7 @@ async function resolveUploadedFileOptions(files) {
|
|
|
1186
1239
|
try {
|
|
1187
1240
|
return { name, content: await readFile(path, "utf8") };
|
|
1188
1241
|
} catch (err) {
|
|
1189
|
-
const message =
|
|
1242
|
+
const message = stringifyError(err);
|
|
1190
1243
|
throw new CliError("user", `Failed to read uploaded file ${path}: ${message}`);
|
|
1191
1244
|
}
|
|
1192
1245
|
})
|
|
@@ -2162,6 +2215,7 @@ var ERROR_CODES = [
|
|
|
2162
2215
|
"api_error",
|
|
2163
2216
|
"config_error",
|
|
2164
2217
|
"failed_edits",
|
|
2218
|
+
"memory_enforcement_failed",
|
|
2165
2219
|
"failure_loop_suspected",
|
|
2166
2220
|
"empty_completion",
|
|
2167
2221
|
"followup_not_started",
|
|
@@ -2202,6 +2256,7 @@ var ERROR_CODE_LABELS = {
|
|
|
2202
2256
|
api_error: "Provider API error",
|
|
2203
2257
|
config_error: "Configuration error",
|
|
2204
2258
|
failed_edits: "Edit failure",
|
|
2259
|
+
memory_enforcement_failed: "Memory enforcement failed",
|
|
2205
2260
|
failure_loop_suspected: "Suspected failure loop",
|
|
2206
2261
|
empty_completion: "Empty completion",
|
|
2207
2262
|
followup_not_started: "Follow-up did not start",
|
|
@@ -2245,19 +2300,7 @@ function formatSessionErrorMessage(error, code) {
|
|
|
2245
2300
|
// src/utils/session-output.ts
|
|
2246
2301
|
var SHORT_SESSION_ID_LENGTH = 8;
|
|
2247
2302
|
var PROMPT_LABEL_MAX_CHARS = 80;
|
|
2248
|
-
var VALID_PHASES =
|
|
2249
|
-
"idle",
|
|
2250
|
-
"running",
|
|
2251
|
-
"waiting_for_input",
|
|
2252
|
-
"finalizing",
|
|
2253
|
-
"review_listening",
|
|
2254
|
-
"completed",
|
|
2255
|
-
"superseded",
|
|
2256
|
-
"blocked",
|
|
2257
|
-
"failed",
|
|
2258
|
-
"stopped",
|
|
2259
|
-
"archived"
|
|
2260
|
-
]);
|
|
2303
|
+
var VALID_PHASES = new Set(PHASES);
|
|
2261
2304
|
var VALID_SANDBOX_SUBSTATES = /* @__PURE__ */ new Set(["creating", "reconnecting", "stopping", "none"]);
|
|
2262
2305
|
var VALID_STOP_MODES = /* @__PURE__ */ new Set(["user", "resumable", "none"]);
|
|
2263
2306
|
var VALID_FINALIZING_STEPS = /* @__PURE__ */ new Set(["post_execution", "publishing", "none"]);
|
|
@@ -2526,7 +2569,7 @@ function parseJsonObject(value) {
|
|
|
2526
2569
|
const parsed = JSON.parse(value);
|
|
2527
2570
|
return parsed && typeof parsed === "object" ? parsed : {};
|
|
2528
2571
|
} catch (err) {
|
|
2529
|
-
throw new Error(`Malformed SSE JSON payload: ${
|
|
2572
|
+
throw new Error(`Malformed SSE JSON payload: ${stringifyError(err)}`);
|
|
2530
2573
|
}
|
|
2531
2574
|
}
|
|
2532
2575
|
function formatPromptLabel(promptId, promptLabels) {
|
|
@@ -2706,9 +2749,7 @@ async function watchCommand(sessionId, options, command) {
|
|
|
2706
2749
|
try {
|
|
2707
2750
|
promptLabels = await fetchPromptLabels(config, sessionId);
|
|
2708
2751
|
} catch (err) {
|
|
2709
|
-
console.error(
|
|
2710
|
-
`Warning: failed to fetch prompt labels for session ${sessionId}: ${err instanceof Error ? err.message : String(err)}`
|
|
2711
|
-
);
|
|
2752
|
+
console.error(`Warning: failed to fetch prompt labels for session ${sessionId}: ${stringifyError(err)}`);
|
|
2712
2753
|
}
|
|
2713
2754
|
}
|
|
2714
2755
|
const renderState = {
|
|
@@ -2969,7 +3010,7 @@ async function createCommand(repoUrl, promptArg, options, command) {
|
|
|
2969
3010
|
} catch (err) {
|
|
2970
3011
|
throw new CliError(
|
|
2971
3012
|
err instanceof CliError ? err.code : "server",
|
|
2972
|
-
`Session created (${sessionId}) but prompt failed: ${
|
|
3013
|
+
`Session created (${sessionId}) but prompt failed: ${stringifyError(err)}`,
|
|
2973
3014
|
{
|
|
2974
3015
|
exitCode: err instanceof CliError ? err.exitCode : void 0,
|
|
2975
3016
|
hint: `Retry with: arcanist sessions send ${sessionId} --prompt-stdin`,
|
|
@@ -3763,7 +3804,7 @@ function git(args) {
|
|
|
3763
3804
|
try {
|
|
3764
3805
|
return execFileSync("git", args, { encoding: "utf8", stdio: ["ignore", "pipe", "pipe"] }).trim();
|
|
3765
3806
|
} catch (err) {
|
|
3766
|
-
throw new CliError("user", `git ${args.join(" ")} failed: ${
|
|
3807
|
+
throw new CliError("user", `git ${args.join(" ")} failed: ${stringifyError(err)}`);
|
|
3767
3808
|
}
|
|
3768
3809
|
}
|
|
3769
3810
|
function currentRepo() {
|
|
@@ -4346,9 +4387,7 @@ async function sessionEventsCommand(sessionId, options, command) {
|
|
|
4346
4387
|
return;
|
|
4347
4388
|
}
|
|
4348
4389
|
const promptLabels = await fetchPromptLabels(config, sessionId).catch((err) => {
|
|
4349
|
-
console.error(
|
|
4350
|
-
`Warning: failed to fetch prompt labels for session ${sessionId}: ${err instanceof Error ? err.message : String(err)}`
|
|
4351
|
-
);
|
|
4390
|
+
console.error(`Warning: failed to fetch prompt labels for session ${sessionId}: ${stringifyError(err)}`);
|
|
4352
4391
|
return /* @__PURE__ */ new Map();
|
|
4353
4392
|
});
|
|
4354
4393
|
const state = { promptLabels, toolCalls: /* @__PURE__ */ new Map() };
|