@tryarcanist/cli 0.1.161 → 0.1.163
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.
- package/dist/index.js +30 -9
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -434,7 +434,7 @@ function randomIdempotencyKey() {
|
|
|
434
434
|
}
|
|
435
435
|
function assertArcanistSessionMutationAllowed(subcommand) {
|
|
436
436
|
const role = process.env.ARCANIST_AGENT_ROLE?.trim();
|
|
437
|
-
if (role !== "verification"
|
|
437
|
+
if (role !== "verification") return;
|
|
438
438
|
throw new CliError(
|
|
439
439
|
"user",
|
|
440
440
|
`\`arcanist sessions ${subcommand}\` is disabled inside ${role} sessions because nested Arcanist sessions are not observable to the verifier.`,
|
|
@@ -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
|
-
|
|
1507
|
+
const appendableText = shouldAppendTextDelta(existingText, text);
|
|
1508
|
+
if (existingIdx !== void 0) {
|
|
1489
1509
|
const existing = events[existingIdx];
|
|
1490
|
-
if (existing.type === type &&
|
|
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 && !
|
|
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",
|