@tryarcanist/cli 0.1.161 → 0.1.162

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 +29 -8
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -1007,9 +1007,6 @@ function buildModelProviderGroups(models) {
1007
1007
  var SESSION_START_MODEL_ID_SET_ANY_BACKEND = new Set(
1008
1008
  AGENT_RUNTIME_BACKENDS.flatMap((backend) => [...SESSION_START_MODEL_IDS_BY_BACKEND[backend]])
1009
1009
  );
1010
- var SESSION_START_MODEL_PROVIDER_GROUPS = buildModelProviderGroups(
1011
- MODEL_REGISTRY.filter((model) => SESSION_START_MODEL_ID_SET_ANY_BACKEND.has(model.id))
1012
- );
1013
1010
  var PUBLIC_SESSION_START_MODEL_PROVIDER_GROUPS = buildModelProviderGroups(
1014
1011
  MODEL_REGISTRY.filter(
1015
1012
  (model) => SESSION_START_MODEL_ID_SET_ANY_BACKEND.has(model.id) && model.visibility !== "internal_probe"
@@ -1460,7 +1457,8 @@ function createStreamCoalescerState() {
1460
1457
  return {
1461
1458
  streamableIndexById: /* @__PURE__ */ new Map(),
1462
1459
  segmentOrdinalByStreamId: /* @__PURE__ */ new Map(),
1463
- concatByStreamId: /* @__PURE__ */ new Map()
1460
+ concatByStreamId: /* @__PURE__ */ new Map(),
1461
+ interstitialScanEndByStreamId: /* @__PURE__ */ new Map()
1464
1462
  };
1465
1463
  }
1466
1464
  function streamableKey(type, streamId) {
@@ -1478,6 +1476,27 @@ function resolveTextValue(data) {
1478
1476
  const content = data?.content;
1479
1477
  return typeof content === "string" ? content : "";
1480
1478
  }
1479
+ function isNonContentInterstitial(event) {
1480
+ switch (event.type) {
1481
+ case "agent_progress":
1482
+ case "retry_status":
1483
+ case "memory_usage":
1484
+ case "memory_recall_usage":
1485
+ case "agent_timeline":
1486
+ return true;
1487
+ default:
1488
+ return false;
1489
+ }
1490
+ }
1491
+ function canAppendAcrossNonContentInterstitials(events, state, key, existingIdx) {
1492
+ if (existingIdx === events.length - 1) return true;
1493
+ const scanStart = Math.max(existingIdx + 1, state.interstitialScanEndByStreamId.get(key) ?? existingIdx + 1);
1494
+ for (let i = scanStart; i < events.length; i++) {
1495
+ if (!isNonContentInterstitial(events[i])) return false;
1496
+ }
1497
+ state.interstitialScanEndByStreamId.set(key, events.length);
1498
+ return true;
1499
+ }
1481
1500
  function resolvePromptId(data) {
1482
1501
  return typeof data?.promptId === "string" ? data.promptId : void 0;
1483
1502
  }
@@ -1485,22 +1504,24 @@ function coalesceStreamDelta(events, state, type, streamId, text, promptId) {
1485
1504
  const key = streamableKey(type, streamId);
1486
1505
  const existingText = state.concatByStreamId.get(key) ?? "";
1487
1506
  const existingIdx = state.streamableIndexById.get(key);
1488
- if (existingIdx !== void 0 && existingIdx === events.length - 1) {
1507
+ const appendableText = shouldAppendTextDelta(existingText, text);
1508
+ if (existingIdx !== void 0) {
1489
1509
  const existing = events[existingIdx];
1490
- if (existing.type === type && shouldAppendTextDelta(existingText, text)) {
1510
+ if (existing.type === type && appendableText && canAppendAcrossNonContentInterstitials(events, state, key, existingIdx)) {
1491
1511
  existing.text += text;
1492
1512
  state.concatByStreamId.set(key, existingText + text);
1493
1513
  if (!existing.promptId && promptId) existing.promptId = promptId;
1494
1514
  return true;
1495
1515
  }
1496
- return false;
1516
+ if (existingIdx === events.length - 1 || !appendableText) return false;
1497
1517
  }
1498
- if (existingText && !shouldAppendTextDelta(existingText, text)) return false;
1518
+ if (existingText && !appendableText) return false;
1499
1519
  const previousOrdinal = state.segmentOrdinalByStreamId.get(key);
1500
1520
  const segmentOrdinal = previousOrdinal === void 0 ? 0 : previousOrdinal + 1;
1501
1521
  state.segmentOrdinalByStreamId.set(key, segmentOrdinal);
1502
1522
  state.streamableIndexById.set(key, events.length);
1503
1523
  state.concatByStreamId.set(key, existingText + text);
1524
+ state.interstitialScanEndByStreamId.set(key, events.length + 1);
1504
1525
  if (type === "text") {
1505
1526
  events.push({
1506
1527
  type: "text",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tryarcanist/cli",
3
- "version": "0.1.161",
3
+ "version": "0.1.162",
4
4
  "description": "CLI for Arcanist — create and manage coding agent sessions",
5
5
  "type": "module",
6
6
  "bin": {