replicas-cli 0.2.467 → 0.2.470
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 +74 -27
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -10004,8 +10004,11 @@ var DEFAULT_RELAY_SUBAGENT_PROVIDERS = [...VALID_RELAY_SUBAGENT_PROVIDERS];
|
|
|
10004
10004
|
var DEFAULT_USER_PREFERENCES = {
|
|
10005
10005
|
default_agent: "codex",
|
|
10006
10006
|
default_model: null,
|
|
10007
|
+
claude_models: null,
|
|
10008
|
+
codex_models: null,
|
|
10007
10009
|
cursor_models: null,
|
|
10008
10010
|
openrouter_models: null,
|
|
10011
|
+
relay_models: null,
|
|
10009
10012
|
close_workspace_on_pr_close: true,
|
|
10010
10013
|
close_workspace_on_pr_merge: true,
|
|
10011
10014
|
default_environment_id: null,
|
|
@@ -10081,7 +10084,7 @@ function formatTurnElapsed(ms) {
|
|
|
10081
10084
|
}
|
|
10082
10085
|
|
|
10083
10086
|
// ../shared/src/cli-version.ts
|
|
10084
|
-
var CLI_VERSION = "0.2.
|
|
10087
|
+
var CLI_VERSION = "0.2.470";
|
|
10085
10088
|
|
|
10086
10089
|
// ../shared/src/version.ts
|
|
10087
10090
|
function compareVersions(v1, v2) {
|
|
@@ -25680,8 +25683,9 @@ function parseOpencodeEvents(events) {
|
|
|
25680
25683
|
if (event.type === "event_msg" && event.payload.type === "user_message") {
|
|
25681
25684
|
const message = event.payload.message;
|
|
25682
25685
|
if (typeof message === "string" && message.trim()) {
|
|
25686
|
+
const messageId = event.payload[USER_MESSAGE_ID_PAYLOAD_KEY];
|
|
25683
25687
|
messages.push({
|
|
25684
|
-
id: `opencode-user-${event.timestamp}
|
|
25688
|
+
id: typeof messageId === "string" ? messageId : `opencode-user-${event.timestamp}`,
|
|
25685
25689
|
type: "user",
|
|
25686
25690
|
content: message,
|
|
25687
25691
|
timestamp: event.timestamp
|
|
@@ -25693,7 +25697,7 @@ function parseOpencodeEvents(events) {
|
|
|
25693
25697
|
const error51 = assistantError(event.payload.info);
|
|
25694
25698
|
if (error51) {
|
|
25695
25699
|
messages.push({
|
|
25696
|
-
id: `opencode
|
|
25700
|
+
id: `opencode-${event.type}-${event.timestamp}`,
|
|
25697
25701
|
type: "error",
|
|
25698
25702
|
message: error51,
|
|
25699
25703
|
timestamp: event.timestamp
|
|
@@ -25704,7 +25708,7 @@ function parseOpencodeEvents(events) {
|
|
|
25704
25708
|
if (event.type === "opencode-error") {
|
|
25705
25709
|
const message = typeof event.payload.message === "string" ? event.payload.message : "Opencode run failed";
|
|
25706
25710
|
messages.push({
|
|
25707
|
-
id: `opencode
|
|
25711
|
+
id: `opencode-${event.type}-${event.timestamp}`,
|
|
25708
25712
|
type: "error",
|
|
25709
25713
|
message,
|
|
25710
25714
|
timestamp: event.timestamp
|
|
@@ -25715,7 +25719,7 @@ function parseOpencodeEvents(events) {
|
|
|
25715
25719
|
const tool = typeof event.payload.tool === "string" ? event.payload.tool : "tool";
|
|
25716
25720
|
const input = event.payload.input ?? event.payload.arguments;
|
|
25717
25721
|
const callId = typeof event.payload.callID === "string" ? event.payload.callID : null;
|
|
25718
|
-
const id2 = callId ? `opencode-${callId}` : `opencode-${event.
|
|
25722
|
+
const id2 = callId ? `opencode-${callId}` : `opencode-${event.type}-${event.timestamp}`;
|
|
25719
25723
|
upsertDisplayMessage(messages, createCallDisplayMessage({
|
|
25720
25724
|
id: id2,
|
|
25721
25725
|
server: "opencode",
|
|
@@ -25728,7 +25732,7 @@ function parseOpencodeEvents(events) {
|
|
|
25728
25732
|
}
|
|
25729
25733
|
const part = partFromEvent(event);
|
|
25730
25734
|
if (!part) continue;
|
|
25731
|
-
let id = `opencode-${event.
|
|
25735
|
+
let id = `opencode-${event.type}-${event.timestamp}`;
|
|
25732
25736
|
if (typeof part.callID === "string") id = `opencode-${part.callID}`;
|
|
25733
25737
|
else if (typeof part.id === "string") id = `opencode-${part.id}`;
|
|
25734
25738
|
const time3 = isRecord(part.time) ? part.time : null;
|
|
@@ -26670,38 +26674,81 @@ function stableString(value) {
|
|
|
26670
26674
|
return String(value);
|
|
26671
26675
|
}
|
|
26672
26676
|
}
|
|
26673
|
-
function
|
|
26674
|
-
if (
|
|
26675
|
-
|
|
26676
|
-
return false;
|
|
26677
|
+
function duplicateKey(message) {
|
|
26678
|
+
if (message.type === "user" || message.type === "agent" || message.type === "reasoning") {
|
|
26679
|
+
return JSON.stringify([message.type, message.content]);
|
|
26677
26680
|
}
|
|
26678
|
-
if (
|
|
26679
|
-
if (
|
|
26680
|
-
if (
|
|
26681
|
-
|
|
26682
|
-
|
|
26683
|
-
|
|
26684
|
-
|
|
26681
|
+
if (message.type === "command") return JSON.stringify([message.type, message.command]);
|
|
26682
|
+
if (message.type === "web_search") return JSON.stringify([message.type, message.query]);
|
|
26683
|
+
if (message.type === "subagent") {
|
|
26684
|
+
return JSON.stringify([
|
|
26685
|
+
message.type,
|
|
26686
|
+
message.description,
|
|
26687
|
+
message.prompt,
|
|
26688
|
+
message.subagentType,
|
|
26689
|
+
message.model
|
|
26690
|
+
]);
|
|
26685
26691
|
}
|
|
26686
|
-
if (
|
|
26687
|
-
return
|
|
26692
|
+
if (message.type === "todo_list") {
|
|
26693
|
+
return JSON.stringify([message.type, stableString(message.items)]);
|
|
26688
26694
|
}
|
|
26689
|
-
if (
|
|
26690
|
-
return
|
|
26695
|
+
if (message.type === "patch") {
|
|
26696
|
+
return JSON.stringify([message.type, stableString(message.operations)]);
|
|
26691
26697
|
}
|
|
26692
|
-
if (
|
|
26693
|
-
return
|
|
26698
|
+
if (message.type === "tool_call") {
|
|
26699
|
+
return JSON.stringify([
|
|
26700
|
+
message.type,
|
|
26701
|
+
message.server,
|
|
26702
|
+
message.tool,
|
|
26703
|
+
stableString(message.input)
|
|
26704
|
+
]);
|
|
26694
26705
|
}
|
|
26695
|
-
return
|
|
26706
|
+
return null;
|
|
26707
|
+
}
|
|
26708
|
+
function duplicateBucketKey(message, bucketOffset = 0) {
|
|
26709
|
+
const key = duplicateKey(message);
|
|
26710
|
+
if (key === null) return null;
|
|
26711
|
+
const bucket = Math.floor(parseTimestampMs(message.timestamp) / DUPLICATE_WINDOW_MS) + bucketOffset;
|
|
26712
|
+
return JSON.stringify([bucket, key]);
|
|
26696
26713
|
}
|
|
26697
26714
|
function mergeCodexAspDisplayMessages(primary, supplemental) {
|
|
26698
26715
|
const merged = [...primary];
|
|
26716
|
+
const firstIndexById = /* @__PURE__ */ new Map();
|
|
26717
|
+
const indexesByDuplicateBucket = /* @__PURE__ */ new Map();
|
|
26718
|
+
const indexMessage = (message, index) => {
|
|
26719
|
+
if (!firstIndexById.has(message.id)) firstIndexById.set(message.id, index);
|
|
26720
|
+
const key = duplicateBucketKey(message);
|
|
26721
|
+
if (key === null) return;
|
|
26722
|
+
const indexes = indexesByDuplicateBucket.get(key) ?? /* @__PURE__ */ new Set();
|
|
26723
|
+
indexes.add(index);
|
|
26724
|
+
indexesByDuplicateBucket.set(key, indexes);
|
|
26725
|
+
};
|
|
26726
|
+
const unindexMessage = (message, index) => {
|
|
26727
|
+
const key = duplicateBucketKey(message);
|
|
26728
|
+
if (key === null) return;
|
|
26729
|
+
const indexes = indexesByDuplicateBucket.get(key);
|
|
26730
|
+
indexes?.delete(index);
|
|
26731
|
+
if (indexes?.size === 0) indexesByDuplicateBucket.delete(key);
|
|
26732
|
+
};
|
|
26733
|
+
merged.forEach(indexMessage);
|
|
26699
26734
|
for (const message of supplemental) {
|
|
26700
|
-
|
|
26701
|
-
if (duplicateIndex ===
|
|
26702
|
-
|
|
26735
|
+
let duplicateIndex = firstIndexById.get(message.id);
|
|
26736
|
+
if (duplicateIndex === void 0) {
|
|
26737
|
+
for (let bucketOffset = -1; bucketOffset <= 1; bucketOffset += 1) {
|
|
26738
|
+
const key = duplicateBucketKey(message, bucketOffset);
|
|
26739
|
+
for (const index of (key === null ? void 0 : indexesByDuplicateBucket.get(key)) ?? []) {
|
|
26740
|
+
if (nearTimestamp(merged[index].timestamp, message.timestamp) && (duplicateIndex === void 0 || index < duplicateIndex)) {
|
|
26741
|
+
duplicateIndex = index;
|
|
26742
|
+
}
|
|
26743
|
+
}
|
|
26744
|
+
}
|
|
26745
|
+
}
|
|
26746
|
+
if (duplicateIndex === void 0) {
|
|
26747
|
+
indexMessage(message, merged.push(message) - 1);
|
|
26703
26748
|
} else if (message.type === "user") {
|
|
26749
|
+
unindexMessage(merged[duplicateIndex], duplicateIndex);
|
|
26704
26750
|
merged[duplicateIndex] = { ...merged[duplicateIndex], timestamp: message.timestamp };
|
|
26751
|
+
indexMessage(merged[duplicateIndex], duplicateIndex);
|
|
26705
26752
|
}
|
|
26706
26753
|
}
|
|
26707
26754
|
return merged.map((message, index) => ({ message, index })).sort((a, b) => parseTimestampMs(a.message.timestamp) - parseTimestampMs(b.message.timestamp) || a.index - b.index).map(({ message }) => message);
|