@tryarcanist/cli 0.1.156 → 0.1.158

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 +13 -7
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -13,6 +13,7 @@ function normalizeBaseUrl(url) {
13
13
  }
14
14
 
15
15
  // src/errors.ts
16
+ var EXIT_CODE_INTERRUPTED = 130;
16
17
  var CliError = class extends Error {
17
18
  code;
18
19
  exitCode;
@@ -203,6 +204,8 @@ function validateApiUrl(url) {
203
204
  // src/runtime.ts
204
205
  import { randomUUID } from "crypto";
205
206
  import { createInterface } from "readline/promises";
207
+ var ASCII_FIRST_PRINTABLE = 32;
208
+ var ASCII_DELETE = 127;
206
209
  var ANSI_CONTROL_SEQUENCE = /\u001b\[[0-9:;<=>?]*[ -/]*[@-~]/g;
207
210
  function getRuntimeOptions(command, options = {}) {
208
211
  const globals = command?.optsWithGlobals?.();
@@ -290,7 +293,7 @@ async function readHiddenPrompt(prompt) {
290
293
  return;
291
294
  }
292
295
  if (char === "") {
293
- fail2(new CliError("user", "Interrupted.", { exitCode: 130 }));
296
+ fail2(new CliError("user", "Interrupted.", { exitCode: EXIT_CODE_INTERRUPTED }));
294
297
  return;
295
298
  }
296
299
  if (char === "\x7F" || char === "\b") {
@@ -373,7 +376,7 @@ function matchAnsiControlSequence(text, startIndex) {
373
376
  }
374
377
  function isControlCharacter(char) {
375
378
  const code = char.charCodeAt(0);
376
- return code < 32 || code === 127;
379
+ return code < ASCII_FIRST_PRINTABLE || code === ASCII_DELETE;
377
380
  }
378
381
 
379
382
  // src/commands/auth.ts
@@ -2055,6 +2058,8 @@ function formatSessionErrorMessage(error, code) {
2055
2058
  }
2056
2059
 
2057
2060
  // src/utils/session-output.ts
2061
+ var SHORT_SESSION_ID_LENGTH = 8;
2062
+ var PROMPT_LABEL_MAX_CHARS = 80;
2058
2063
  var VALID_PHASES = /* @__PURE__ */ new Set([
2059
2064
  "idle",
2060
2065
  "running",
@@ -2186,7 +2191,7 @@ function renderSessionTranscript(exportData) {
2186
2191
  const eventBuckets = partitionEventsByPrompt(exportData.events, promptIds);
2187
2192
  lines.push("# Session transcript\n");
2188
2193
  if (exportData.session.repoUrl) lines.push(`**Repo:** ${exportData.session.repoUrl} `);
2189
- lines.push(`**Session:** ${exportData.session.id.slice(0, 8)} `);
2194
+ lines.push(`**Session:** ${exportData.session.id.slice(0, SHORT_SESSION_ID_LENGTH)} `);
2190
2195
  lines.push(`**Created:** ${formatDate(exportData.session.createdAt)} `);
2191
2196
  lines.push(`**Status:** ${exportData.session.status} `);
2192
2197
  const noChangeResult = latestCompletedPromptResult(exportData.prompts);
@@ -2347,7 +2352,7 @@ function formatPromptLabel(promptId, promptLabels) {
2347
2352
  function buildPromptLabelMap(prompts) {
2348
2353
  const labels = /* @__PURE__ */ new Map();
2349
2354
  for (const prompt of prompts) {
2350
- labels.set(prompt.promptId, prompt.prompt.replace(/\s+/g, " ").trim().slice(0, 80));
2355
+ labels.set(prompt.promptId, prompt.prompt.replace(/\s+/g, " ").trim().slice(0, PROMPT_LABEL_MAX_CHARS));
2351
2356
  }
2352
2357
  return labels;
2353
2358
  }
@@ -3584,6 +3589,7 @@ async function parseSandboxLayerSource(input) {
3584
3589
  // src/commands/sandbox.ts
3585
3590
  var DEFAULT_MANIFEST_PATH = SANDBOX_LAYER_MANIFEST_PATH;
3586
3591
  var DEFAULT_POLL_INTERVAL_MS = 2500;
3592
+ var MIN_POLL_INTERVAL_MS = 250;
3587
3593
  var TERMINAL_BUILD_STATUSES = /* @__PURE__ */ new Set(["completed", "failed", "canceled"]);
3588
3594
  function git(args) {
3589
3595
  try {
@@ -3633,8 +3639,8 @@ async function resolveBusinessId2(config, options) {
3633
3639
  function parsePollInterval2(value) {
3634
3640
  if (!value) return DEFAULT_POLL_INTERVAL_MS;
3635
3641
  const parsed = Number(value);
3636
- if (!Number.isInteger(parsed) || parsed < 250) {
3637
- throw new CliError("user", "--poll-interval must be an integer >= 250.");
3642
+ if (!Number.isInteger(parsed) || parsed < MIN_POLL_INTERVAL_MS) {
3643
+ throw new CliError("user", `--poll-interval must be an integer >= ${MIN_POLL_INTERVAL_MS}.`);
3638
3644
  }
3639
3645
  return parsed;
3640
3646
  }
@@ -4738,7 +4744,7 @@ async function main() {
4738
4744
  if (isCommanderHelpOrVersion(err)) {
4739
4745
  process.exit(0);
4740
4746
  }
4741
- if (err instanceof CliError && err.exitCode === 130) restoreTerminal();
4747
+ if (err instanceof CliError && err.exitCode === EXIT_CODE_INTERRUPTED) restoreTerminal();
4742
4748
  const cliError = toCliError(err);
4743
4749
  const options = program.opts();
4744
4750
  if (options.json) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tryarcanist/cli",
3
- "version": "0.1.156",
3
+ "version": "0.1.158",
4
4
  "description": "CLI for Arcanist — create and manage coding agent sessions",
5
5
  "type": "module",
6
6
  "bin": {