@tryarcanist/cli 0.1.86 → 0.1.88

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 +48 -12
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -611,6 +611,16 @@ function isRecord(value) {
611
611
  return !!value && typeof value === "object" && !Array.isArray(value);
612
612
  }
613
613
 
614
+ // ../../shared/transcript/malformed-search.ts
615
+ var MALFORMED_SEARCH_BLOCKED_TRANSCRIPT_PREFIX = "Arcanist blocked this malformed search command before execution.";
616
+ var BASH_UNMATCHED_QUOTE_EOF_RE = /\/bin\/bash:\s+-c:\s+line\s+\d+:\s+unexpected EOF while looking for matching [`'"][`'"]?/i;
617
+ function isMalformedSearchBlockedError(value) {
618
+ return typeof value === "string" && value.includes(MALFORMED_SEARCH_BLOCKED_TRANSCRIPT_PREFIX);
619
+ }
620
+ function containsMalformedSearchBashEof(value) {
621
+ return BASH_UNMATCHED_QUOTE_EOF_RE.test(value);
622
+ }
623
+
614
624
  // ../../shared/transcript/projector.ts
615
625
  var DUPLICATE_TEXT_DELTA_MIN_CHARS = 24;
616
626
  var RAW_CODEX_NOISE = /* @__PURE__ */ new Set([
@@ -913,9 +923,17 @@ function createFlattenState() {
913
923
  streams: createStreamCoalescerState(),
914
924
  toolCallIndexById: /* @__PURE__ */ new Map(),
915
925
  agentProgressIndexByKey: /* @__PURE__ */ new Map(),
916
- questionIndexById: /* @__PURE__ */ new Map()
926
+ questionIndexById: /* @__PURE__ */ new Map(),
927
+ malformedSearchBlockedPromptIds: /* @__PURE__ */ new Set(),
928
+ malformedSearchBlockedWithoutPrompt: false
917
929
  };
918
930
  }
931
+ function seedMalformedSearchBlocks(state, events) {
932
+ for (const event of events) {
933
+ if (event.type !== "session_error") continue;
934
+ recordMalformedSearchBlock(event.data, state);
935
+ }
936
+ }
919
937
  function pushEvent(state, event) {
920
938
  if (event) state.merged.push(event);
921
939
  }
@@ -1079,6 +1097,15 @@ function projectSessionError(data, index) {
1079
1097
  ...typeof data?.code === "string" ? { code: data.code } : {}
1080
1098
  };
1081
1099
  }
1100
+ function recordMalformedSearchBlock(data, state) {
1101
+ if (!isMalformedSearchBlockedError(data?.error)) return;
1102
+ const promptId = resolvePromptId(data);
1103
+ if (promptId) {
1104
+ state.malformedSearchBlockedPromptIds.add(promptId);
1105
+ } else {
1106
+ state.malformedSearchBlockedWithoutPrompt = true;
1107
+ }
1108
+ }
1082
1109
  function projectSessionResumedCold(data, index) {
1083
1110
  return {
1084
1111
  type: "session_resumed_cold",
@@ -1113,13 +1140,20 @@ function projectPatch(data, index) {
1113
1140
  };
1114
1141
  }
1115
1142
  function projectStream(type, data, state) {
1143
+ const promptId = resolvePromptId(data);
1144
+ const text = resolveTextValue(data);
1145
+ const hasPromptScopedMalformedSearchBlock = promptId ? state.malformedSearchBlockedPromptIds.has(promptId) : false;
1146
+ const hasUnpromptedMalformedSearchBlock = !promptId && state.malformedSearchBlockedWithoutPrompt;
1147
+ if (type === "text" && (hasPromptScopedMalformedSearchBlock || hasUnpromptedMalformedSearchBlock && containsMalformedSearchBashEof(text))) {
1148
+ return;
1149
+ }
1116
1150
  coalesceStreamDelta(
1117
1151
  state.merged,
1118
1152
  state.streams,
1119
1153
  type,
1120
1154
  resolveEventId(data, type, state.merged.length),
1121
- resolveTextValue(data),
1122
- resolvePromptId(data)
1155
+ text,
1156
+ promptId
1123
1157
  );
1124
1158
  }
1125
1159
  function projectToolCall(data, state) {
@@ -1211,7 +1245,9 @@ function applyTodoUpdate(data, state) {
1211
1245
  }
1212
1246
  function flattenSessionEvents(raw) {
1213
1247
  const state = createFlattenState();
1214
- for (const normalized of normalizeRawSessionEvents(raw)) {
1248
+ const normalizedEvents = normalizeRawSessionEvents(raw);
1249
+ seedMalformedSearchBlocks(state, normalizedEvents);
1250
+ for (const normalized of normalizedEvents) {
1215
1251
  const { type } = normalized;
1216
1252
  const data = normalized.data;
1217
1253
  switch (type) {
@@ -1248,6 +1284,7 @@ function flattenSessionEvents(raw) {
1248
1284
  projectAgentProgressEvent(data, state);
1249
1285
  break;
1250
1286
  case "session_error":
1287
+ recordMalformedSearchBlock(data, state);
1251
1288
  pushEvent(state, projectSessionError(data, state.merged.length));
1252
1289
  break;
1253
1290
  case "session_resumed_cold":
@@ -1421,6 +1458,7 @@ var ERROR_CODES = [
1421
1458
  "codex_session_create_timeout",
1422
1459
  "codex_prompt_dispatch_timeout",
1423
1460
  "codex_not_ready",
1461
+ "codex_transport_closed",
1424
1462
  "codex_unrecoverable",
1425
1463
  "unknown"
1426
1464
  ];
@@ -1454,6 +1492,7 @@ var ERROR_CODE_LABELS = {
1454
1492
  codex_session_create_timeout: "Codex session creation timed out",
1455
1493
  codex_prompt_dispatch_timeout: "Codex prompt dispatch timed out",
1456
1494
  codex_not_ready: "Codex did not become ready",
1495
+ codex_transport_closed: "Codex transport closed",
1457
1496
  codex_unrecoverable: "Codex unrecoverable failure",
1458
1497
  unknown: "Unknown failure"
1459
1498
  };
@@ -2187,7 +2226,6 @@ async function listSessionsCommand(options, command) {
2187
2226
  if (options.status) query.set("status", options.status);
2188
2227
  if (options.scope) query.set("scope", options.scope);
2189
2228
  if (options.search) query.set("q", options.search);
2190
- if (options.tag) query.set("tag", options.tag);
2191
2229
  if (options.repo) query.set("repo", options.repo);
2192
2230
  if (options.limit) query.set("limit", options.limit);
2193
2231
  if (options.cursor) query.set("cursor", options.cursor);
@@ -2207,9 +2245,7 @@ async function listSessionsCommand(options, command) {
2207
2245
  const id = String(session.id ?? session.sessionId ?? "");
2208
2246
  const status = String(session.status ?? "");
2209
2247
  const title = typeof session.title === "string" ? ` ${session.title}` : "";
2210
- const tags = Array.isArray(session.titleTags) ? session.titleTags.filter((tag) => typeof tag === "string") : [];
2211
- const tagText = tags.length > 0 ? ` tags: ${tags.join(", ")}` : "";
2212
- console.log(`${id} ${status}${title}${tagText}`);
2248
+ console.log(`${id} ${status}${title}`);
2213
2249
  }
2214
2250
  if (payload.nextCursor) console.log(`Next cursor: ${payload.nextCursor}`);
2215
2251
  }
@@ -2606,21 +2642,21 @@ Examples:
2606
2642
  arcanist sessions get <session-id> --json
2607
2643
  `
2608
2644
  ).action((sessionId, options, command) => getSessionCommand(sessionId, options, command));
2609
- sessions.command("list").description("List sessions").option("--status <status>", "Filter by session status").option("--scope <scope>", "Session scope: mine or business").option("--search <query>", "Search session titles, tags, and repo metadata").option("--tag <tag>", "Filter by generated session tag").option("--repo <repo>", "Filter by repo metadata").option("--limit <n>", "Maximum sessions to return").option("--cursor <cursor>", "Pagination cursor").addHelpText(
2645
+ sessions.command("list").description("List sessions").option("--status <status>", "Filter by session status").option("--scope <scope>", "Session scope: mine or business").option("--search <query>", "Search session titles and repo metadata").option("--repo <repo>", "Filter by repo metadata").option("--limit <n>", "Maximum sessions to return").option("--cursor <cursor>", "Pagination cursor").addHelpText(
2610
2646
  "after",
2611
2647
  `
2612
2648
  Examples:
2613
2649
  arcanist sessions list
2614
2650
  arcanist sessions list --status idle --json
2615
- arcanist sessions list --search "architect agent" --tag codex
2651
+ arcanist sessions list --search "architect agent" --repo owner/repo
2616
2652
  `
2617
2653
  ).action((options, command) => listSessionsCommand(options, command));
2618
- sessions.command("search").description("Search sessions by title, tag, and repo metadata").argument("<query>", "Search query").option("--status <status>", "Filter by session status").option("--scope <scope>", "Session scope: mine or business").option("--tag <tag>", "Filter by generated session tag").option("--repo <repo>", "Filter by repo metadata").option("--limit <n>", "Maximum sessions to return").option("--cursor <cursor>", "Pagination cursor").addHelpText(
2654
+ sessions.command("search").description("Search sessions by title and repo metadata").argument("<query>", "Search query").option("--status <status>", "Filter by session status").option("--scope <scope>", "Session scope: mine or business").option("--repo <repo>", "Filter by repo metadata").option("--limit <n>", "Maximum sessions to return").option("--cursor <cursor>", "Pagination cursor").addHelpText(
2619
2655
  "after",
2620
2656
  `
2621
2657
  Examples:
2622
2658
  arcanist sessions search "architect agent"
2623
- arcanist sessions search "mcp debugging" --tag codex --json
2659
+ arcanist sessions search "mcp debugging" --repo owner/repo --json
2624
2660
  `
2625
2661
  ).action((query, options, command) => searchSessionsCommand(query, options, command));
2626
2662
  sessions.command("events").description("Read or follow session replay events").argument("<session-id>", "Session ID").option("--after-sequence <n>", "Return events after this sequence").option("--after <n>", "Alias for --after-sequence").option("--before-sequence <n>", "Return events before this sequence").option("--before <n>", "Alias for --before-sequence").option("--prompt-id <id>", "Filter events by prompt ID").option("--limit <n>", "Maximum events to return").option("--follow", "Follow events until the session is idle").option("--poll-interval <ms>", "Polling interval in milliseconds", String(DEFAULT_WATCH_POLL_INTERVAL_MS)).addHelpText(
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tryarcanist/cli",
3
- "version": "0.1.86",
3
+ "version": "0.1.88",
4
4
  "description": "CLI for Arcanist — create and manage coding agent sessions",
5
5
  "type": "module",
6
6
  "bin": {