replicas-cli 0.2.404 → 0.2.405
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.mjs +32 -10
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -24395,7 +24395,7 @@ function formatTurnElapsed(ms) {
|
|
|
24395
24395
|
}
|
|
24396
24396
|
|
|
24397
24397
|
// ../shared/src/cli-version.ts
|
|
24398
|
-
var CLI_VERSION = "0.2.
|
|
24398
|
+
var CLI_VERSION = "0.2.405";
|
|
24399
24399
|
|
|
24400
24400
|
// ../shared/src/version.ts
|
|
24401
24401
|
function compareVersions(v1, v2) {
|
|
@@ -24730,17 +24730,23 @@ function normalizeBackgroundTaskStatus(status) {
|
|
|
24730
24730
|
return "in_progress";
|
|
24731
24731
|
}
|
|
24732
24732
|
|
|
24733
|
+
// ../shared/src/display-message/constants.ts
|
|
24734
|
+
var USER_MESSAGE_MATCH_GRACE_PERIOD_MS = 3e4;
|
|
24735
|
+
|
|
24733
24736
|
// ../shared/src/display-message/format.ts
|
|
24734
24737
|
function formatStoppedAfter(durationMs) {
|
|
24735
24738
|
if (durationMs === void 0) return "You stopped";
|
|
24736
24739
|
return `You stopped after ${formatTurnElapsed(durationMs)}`;
|
|
24737
24740
|
}
|
|
24738
24741
|
|
|
24739
|
-
// ../shared/src/
|
|
24742
|
+
// ../shared/src/user-message-matching.ts
|
|
24740
24743
|
function parseTimestampMs(timestamp) {
|
|
24741
24744
|
const value = Date.parse(timestamp);
|
|
24742
24745
|
return Number.isFinite(value) ? value : 0;
|
|
24743
24746
|
}
|
|
24747
|
+
function areUserMessagesWithinMatchWindow(a, b) {
|
|
24748
|
+
return a.content === b.content && Math.abs(parseTimestampMs(a.timestamp) - parseTimestampMs(b.timestamp)) <= USER_MESSAGE_MATCH_GRACE_PERIOD_MS;
|
|
24749
|
+
}
|
|
24744
24750
|
|
|
24745
24751
|
// ../shared/src/display-message/parsers/utils.ts
|
|
24746
24752
|
var INTERRUPTED_MESSAGE_REGEX = /^\[Request interrupted by user.*\]$/;
|
|
@@ -25566,6 +25572,13 @@ function parseClaudeEvents(events, parentToolUseId) {
|
|
|
25566
25572
|
const assistantThinking = /* @__PURE__ */ new Map();
|
|
25567
25573
|
const assistantTextCounts = /* @__PURE__ */ new Map();
|
|
25568
25574
|
const acceptedUserMessageIndexes = /* @__PURE__ */ new Set();
|
|
25575
|
+
const canonicalUserMessageIndexes = /* @__PURE__ */ new Set();
|
|
25576
|
+
const findMatchingUserMessageIndex = (indexes, content, timestamp) => {
|
|
25577
|
+
return [...indexes].find((index) => {
|
|
25578
|
+
const message = messages[index];
|
|
25579
|
+
return message?.type === "user" && areUserMessagesWithinMatchWindow(message, { content, timestamp });
|
|
25580
|
+
});
|
|
25581
|
+
};
|
|
25569
25582
|
let turnWasInterrupted = false;
|
|
25570
25583
|
const taskAccumulator = new TaskAccumulator();
|
|
25571
25584
|
const taskSnapshot = () => taskAccumulator.getTasks().map((task) => ({
|
|
@@ -25579,13 +25592,21 @@ function parseClaudeEvents(events, parentToolUseId) {
|
|
|
25579
25592
|
const images = userMessageImages(event.payload.images);
|
|
25580
25593
|
if (content || images) {
|
|
25581
25594
|
const messageId = event.payload[USER_MESSAGE_ID_PAYLOAD_KEY];
|
|
25582
|
-
|
|
25595
|
+
const canonicalIndex = findMatchingUserMessageIndex(canonicalUserMessageIndexes, content, event.timestamp);
|
|
25596
|
+
const canonical = canonicalIndex === void 0 ? void 0 : messages[canonicalIndex];
|
|
25597
|
+
const message = {
|
|
25583
25598
|
id: typeof messageId === "string" ? messageId : `user-${event.timestamp}`,
|
|
25584
25599
|
type: "user",
|
|
25585
25600
|
content,
|
|
25586
|
-
images,
|
|
25601
|
+
images: images?.length ? images : canonical?.type === "user" ? canonical.images : void 0,
|
|
25587
25602
|
timestamp: event.timestamp
|
|
25588
|
-
}
|
|
25603
|
+
};
|
|
25604
|
+
if (canonicalIndex === void 0) {
|
|
25605
|
+
acceptedUserMessageIndexes.add(messages.push(message) - 1);
|
|
25606
|
+
} else {
|
|
25607
|
+
messages[canonicalIndex] = message;
|
|
25608
|
+
canonicalUserMessageIndexes.delete(canonicalIndex);
|
|
25609
|
+
}
|
|
25589
25610
|
}
|
|
25590
25611
|
return;
|
|
25591
25612
|
}
|
|
@@ -25647,10 +25668,11 @@ function parseClaudeEvents(events, parentToolUseId) {
|
|
|
25647
25668
|
};
|
|
25648
25669
|
}).filter((img) => img.data);
|
|
25649
25670
|
if (textContent || images.length > 0) {
|
|
25650
|
-
const acceptedIndex =
|
|
25651
|
-
|
|
25652
|
-
|
|
25653
|
-
|
|
25671
|
+
const acceptedIndex = findMatchingUserMessageIndex(
|
|
25672
|
+
acceptedUserMessageIndexes,
|
|
25673
|
+
textContent,
|
|
25674
|
+
event.timestamp
|
|
25675
|
+
);
|
|
25654
25676
|
const accepted = acceptedIndex === void 0 ? void 0 : messages[acceptedIndex];
|
|
25655
25677
|
const message = {
|
|
25656
25678
|
id: accepted?.id ?? `user-${event.timestamp}`,
|
|
@@ -25660,7 +25682,7 @@ function parseClaudeEvents(events, parentToolUseId) {
|
|
|
25660
25682
|
timestamp: event.timestamp
|
|
25661
25683
|
};
|
|
25662
25684
|
if (acceptedIndex === void 0) {
|
|
25663
|
-
messages.push(message);
|
|
25685
|
+
canonicalUserMessageIndexes.add(messages.push(message) - 1);
|
|
25664
25686
|
} else {
|
|
25665
25687
|
messages[acceptedIndex] = message;
|
|
25666
25688
|
acceptedUserMessageIndexes.delete(acceptedIndex);
|