@tryarcanist/cli 0.1.198 → 0.1.200

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.
Files changed (2) hide show
  1. package/dist/index.js +81 -25
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -17,31 +17,46 @@ function normalizeBaseUrl(url) {
17
17
  return url.replace(/\/+$/, "");
18
18
  }
19
19
 
20
+ // ../../shared/utils/api-error-envelope.ts
21
+ function parseApiErrorEnvelope(body) {
22
+ if (!body || typeof body !== "object") return null;
23
+ const record = body;
24
+ const topLevelCode = typeof record.code === "string" && record.code ? record.code : null;
25
+ const topLevelMessage = typeof record.message === "string" && record.message ? record.message : null;
26
+ if (typeof record.error === "string" && record.error) {
27
+ return {
28
+ code: topLevelCode ?? record.error,
29
+ message: topLevelMessage ?? record.error,
30
+ raw: record.error
31
+ };
32
+ }
33
+ if (record.error && typeof record.error === "object") {
34
+ const nested = record.error;
35
+ const code = typeof nested.code === "string" && nested.code ? nested.code : topLevelCode;
36
+ const message = typeof nested.message === "string" && nested.message ? nested.message : topLevelMessage;
37
+ return code || message ? { code, message, raw: record.error } : null;
38
+ }
39
+ return topLevelCode || topLevelMessage ? { code: topLevelCode, message: topLevelMessage, raw: body } : null;
40
+ }
41
+
20
42
  // src/utils/api-error.ts
21
43
  function parseApiErrorBody(body) {
22
44
  try {
23
45
  const parsed = JSON.parse(body);
24
46
  if (!parsed || typeof parsed !== "object") return null;
25
- const record = parsed;
26
- const topLevelMessage = typeof record.message === "string" && record.message ? record.message : void 0;
27
- if (typeof record.error === "string" && record.error) {
47
+ const envelope = parseApiErrorEnvelope(parsed);
48
+ if (!envelope) return null;
49
+ if (typeof envelope.raw === "string" && envelope.raw) {
28
50
  return {
29
- serverCode: typeof record.code === "string" && record.code ? record.code : record.error,
30
- rawError: record.error,
31
- message: topLevelMessage ?? record.error
51
+ ...envelope.code ? { serverCode: envelope.code } : {},
52
+ rawError: envelope.raw,
53
+ ...envelope.message ? { message: envelope.message } : {}
32
54
  };
33
55
  }
34
- if (record.error && typeof record.error === "object") {
35
- const error = record.error;
36
- const message = typeof error.message === "string" && error.message ? error.message : topLevelMessage;
37
- const serverCode = typeof error.code === "string" && error.code ? error.code : void 0;
38
- return message || serverCode ? {
39
- ...message ? { message } : {},
40
- ...serverCode ? { serverCode } : {},
41
- ...serverCode ? { rawError: serverCode } : {}
42
- } : null;
43
- }
44
- return topLevelMessage ? { message: topLevelMessage } : null;
56
+ return envelope.message || envelope.code ? {
57
+ ...envelope.message ? { message: envelope.message } : {},
58
+ ...envelope.code ? { serverCode: envelope.code, rawError: envelope.code } : {}
59
+ } : null;
45
60
  } catch {
46
61
  return null;
47
62
  }
@@ -529,11 +544,11 @@ function randomIdempotencyKey() {
529
544
  }
530
545
  function assertArcanistSessionMutationAllowed(subcommand) {
531
546
  const role = process.env.ARCANIST_AGENT_ROLE?.trim();
532
- if (role !== "verification") return;
547
+ if (role !== "verification" && role !== "review") return;
533
548
  if (subcommand === "respond") {
534
549
  throw new CliError(
535
550
  "user",
536
- "`arcanist sessions respond` is disabled inside verification sessions because verification agents cannot mutate the session under review.",
551
+ `\`arcanist sessions respond\` is disabled inside ${role} sessions because read-only agents cannot mutate the session under review.`,
537
552
  {
538
553
  hint: "Report the unanswered question as a verification blocker instead."
539
554
  }
@@ -541,7 +556,7 @@ function assertArcanistSessionMutationAllowed(subcommand) {
541
556
  }
542
557
  throw new CliError(
543
558
  "user",
544
- `\`arcanist sessions ${subcommand}\` is disabled inside ${role} sessions because nested Arcanist sessions are not observable to the verifier.`,
559
+ `\`arcanist sessions ${subcommand}\` is disabled inside ${role} sessions because nested Arcanist sessions are not observable to read-only agents.`,
545
560
  {
546
561
  hint: "Use direct local/sandbox evidence instead, or report a verification gap rather than spawning another Arcanist session."
547
562
  }
@@ -705,9 +720,20 @@ var MODEL_REGISTRY = [
705
720
  capabilities: { codexToolSearch: true },
706
721
  contextWindow: 105e4,
707
722
  // Verified 2026-07-09 against OpenAI's GPT-5.6 migration guide and model
708
- // catalog: the alias routes to gpt-5.6-sol and supports max effort.
723
+ // catalog: the alias routes to gpt-5.6-sol and supports max effort. Pricing
724
+ // mirrors gpt-5.6-sol since the alias resolves to it.
709
725
  reasoning: { efforts: ["none", "low", "medium", "high", "xhigh", "max"], default: "medium" },
710
- costTracked: false,
726
+ pricing: {
727
+ inputPerMillion: 5,
728
+ outputPerMillion: 30,
729
+ cacheReadPerMillion: 0.5,
730
+ longContext: {
731
+ thresholdTokens: 272e3,
732
+ inputPerMillion: 10,
733
+ outputPerMillion: 45,
734
+ cacheReadPerMillion: 1
735
+ }
736
+ },
711
737
  sessionStart: { eligible: true }
712
738
  },
713
739
  {
@@ -718,7 +744,17 @@ var MODEL_REGISTRY = [
718
744
  capabilities: { codexToolSearch: true },
719
745
  contextWindow: 105e4,
720
746
  reasoning: { efforts: ["none", "low", "medium", "high", "xhigh", "max"], default: "medium" },
721
- costTracked: false,
747
+ pricing: {
748
+ inputPerMillion: 5,
749
+ outputPerMillion: 30,
750
+ cacheReadPerMillion: 0.5,
751
+ longContext: {
752
+ thresholdTokens: 272e3,
753
+ inputPerMillion: 10,
754
+ outputPerMillion: 45,
755
+ cacheReadPerMillion: 1
756
+ }
757
+ },
722
758
  sessionStart: { eligible: true }
723
759
  },
724
760
  {
@@ -729,7 +765,17 @@ var MODEL_REGISTRY = [
729
765
  capabilities: { codexToolSearch: true },
730
766
  contextWindow: 105e4,
731
767
  reasoning: { efforts: ["none", "low", "medium", "high", "xhigh", "max"], default: "medium" },
732
- costTracked: false,
768
+ pricing: {
769
+ inputPerMillion: 2.5,
770
+ outputPerMillion: 15,
771
+ cacheReadPerMillion: 0.25,
772
+ longContext: {
773
+ thresholdTokens: 272e3,
774
+ inputPerMillion: 5,
775
+ outputPerMillion: 22.5,
776
+ cacheReadPerMillion: 0.5
777
+ }
778
+ },
733
779
  sessionStart: { eligible: true }
734
780
  },
735
781
  {
@@ -740,7 +786,17 @@ var MODEL_REGISTRY = [
740
786
  capabilities: { codexToolSearch: true },
741
787
  contextWindow: 105e4,
742
788
  reasoning: { efforts: ["none", "low", "medium", "high", "xhigh", "max"], default: "medium" },
743
- costTracked: false,
789
+ pricing: {
790
+ inputPerMillion: 1,
791
+ outputPerMillion: 6,
792
+ cacheReadPerMillion: 0.1,
793
+ longContext: {
794
+ thresholdTokens: 272e3,
795
+ inputPerMillion: 2,
796
+ outputPerMillion: 9,
797
+ cacheReadPerMillion: 0.2
798
+ }
799
+ },
744
800
  sessionStart: { eligible: true }
745
801
  },
746
802
  {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tryarcanist/cli",
3
- "version": "0.1.198",
3
+ "version": "0.1.200",
4
4
  "description": "CLI for Arcanist — create and manage coding agent sessions",
5
5
  "type": "module",
6
6
  "bin": {