@tryarcanist/cli 0.1.87 → 0.1.89

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 +45 -8
  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([
@@ -701,7 +711,7 @@ function getRawSessionEventKind(event) {
701
711
  return bridgeEventType ?? "agent_timeline";
702
712
  case "idle":
703
713
  return bridgeEventType ?? "session_idle";
704
- case "codex.session.create":
714
+ case "agent.session.create":
705
715
  case "git.push":
706
716
  case "pr.open":
707
717
  case "session.create":
@@ -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",
@@ -1094,7 +1121,7 @@ function projectRawCodex(data, index) {
1094
1121
  if (partType === "text") return null;
1095
1122
  if (eventType && RAW_CODEX_NOISE.has(eventType)) return null;
1096
1123
  return {
1097
- type: "raw_codex",
1124
+ type: "raw_agent_runtime",
1098
1125
  id: resolveEventId(data, "raw", index),
1099
1126
  ...resolvePromptId(data) ? { promptId: resolvePromptId(data) } : {},
1100
1127
  ...partType ? { partType } : {},
@@ -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,12 +1284,13 @@ 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":
1254
1291
  pushEvent(state, projectSessionResumedCold(data, state.merged.length));
1255
1292
  break;
1256
- case "raw_codex":
1293
+ case "raw_agent_runtime":
1257
1294
  pushEvent(state, projectRawCodex(data, state.merged.length));
1258
1295
  break;
1259
1296
  case "reasoning":
@@ -1560,7 +1597,7 @@ ${event.answer ? `**Answer:** ${event.answer}
1560
1597
  case "agent_progress":
1561
1598
  return `*[${event.label}]*
1562
1599
  `;
1563
- case "raw_codex":
1600
+ case "raw_agent_runtime":
1564
1601
  return "";
1565
1602
  }
1566
1603
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tryarcanist/cli",
3
- "version": "0.1.87",
3
+ "version": "0.1.89",
4
4
  "description": "CLI for Arcanist — create and manage coding agent sessions",
5
5
  "type": "module",
6
6
  "bin": {