replicas-cli 0.3.198 → 0.3.200
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.cjs +92 -15
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -351,6 +351,18 @@ var init_saved_order = __esm({
|
|
|
351
351
|
}
|
|
352
352
|
});
|
|
353
353
|
|
|
354
|
+
// ../shared/src/palette-search.ts
|
|
355
|
+
var DAY_MS, RECENCY_HALF_LIFE_MS, SEARCH_OPEN_DEDUPE_MS, PICK_WINDOW_MS;
|
|
356
|
+
var init_palette_search = __esm({
|
|
357
|
+
"../shared/src/palette-search.ts"() {
|
|
358
|
+
"use strict";
|
|
359
|
+
DAY_MS = 24 * 60 * 60 * 1e3;
|
|
360
|
+
RECENCY_HALF_LIFE_MS = 14 * DAY_MS;
|
|
361
|
+
SEARCH_OPEN_DEDUPE_MS = 10 * 60 * 1e3;
|
|
362
|
+
PICK_WINDOW_MS = 21 * DAY_MS;
|
|
363
|
+
}
|
|
364
|
+
});
|
|
365
|
+
|
|
354
366
|
// ../shared/src/agent.ts
|
|
355
367
|
function isValidAgentProvider(value) {
|
|
356
368
|
return VALID_AGENT_PROVIDERS.some((p) => p === value);
|
|
@@ -16651,7 +16663,7 @@ function parseCodexTurnRetryPayload(payload) {
|
|
|
16651
16663
|
const { attempt, maxAttempts, [CODEX_ASP_ITEM_ID_PAYLOAD_KEY]: turnId } = payload;
|
|
16652
16664
|
return typeof attempt === "number" && typeof maxAttempts === "number" && typeof turnId === "string" ? { attempt, maxAttempts, [CODEX_ASP_ITEM_ID_PAYLOAD_KEY]: turnId } : void 0;
|
|
16653
16665
|
}
|
|
16654
|
-
var CLAUDE_PARTIAL_MESSAGE_EVENT_TYPE, ACCEPTED_USER_MESSAGE_SOURCE, QUEUED_MESSAGE_REMOVED_EVENT_TYPE, REMOVED_MESSAGE_IDS_PAYLOAD_KEY, USER_MESSAGE_ID_PAYLOAD_KEY, REPLACED_MESSAGE_ID_PAYLOAD_KEY, CODEX_ASP_ITEM_ID_PAYLOAD_KEY, CODEX_ITEM_EVENT_TYPE, CODEX_ITEM_PARTIAL_EVENT_TYPE, CODEX_TURN_EVENT_TYPE, CODEX_TURN_RETRY_EVENT_TYPE, CODEX_QUOTA_STATUS_EVENT_TYPE, CHAT_INTERRUPTED_EVENT_TYPE, CHAT_MESSAGE_REJECTED_EVENT_TYPE, CHAT_TURN_LOST_EVENT_TYPE, AUTH_FALLBACK_EVENT_TYPE;
|
|
16666
|
+
var CLAUDE_PARTIAL_MESSAGE_EVENT_TYPE, ACCEPTED_USER_MESSAGE_SOURCE, QUEUED_MESSAGE_REMOVED_EVENT_TYPE, REMOVED_MESSAGE_IDS_PAYLOAD_KEY, USER_MESSAGE_ID_PAYLOAD_KEY, REPLACED_MESSAGE_ID_PAYLOAD_KEY, CODEX_ASP_ITEM_ID_PAYLOAD_KEY, CODEX_ITEM_EVENT_TYPE, CODEX_ITEM_PARTIAL_EVENT_TYPE, CODEX_TURN_EVENT_TYPE, CODEX_TURN_RETRY_EVENT_TYPE, CODEX_QUOTA_STATUS_EVENT_TYPE, CHAT_INTERRUPTED_EVENT_TYPE, CHAT_MESSAGE_REJECTED_EVENT_TYPE, CHAT_TURN_LOST_EVENT_TYPE, CLAUDE_PEER_MESSAGE_EVENT_TYPE, AUTH_FALLBACK_EVENT_TYPE;
|
|
16655
16667
|
var init_event = __esm({
|
|
16656
16668
|
"../shared/src/event.ts"() {
|
|
16657
16669
|
"use strict";
|
|
@@ -16674,6 +16686,7 @@ var init_event = __esm({
|
|
|
16674
16686
|
CHAT_INTERRUPTED_EVENT_TYPE = "replicas-interrupted";
|
|
16675
16687
|
CHAT_MESSAGE_REJECTED_EVENT_TYPE = "replicas-message-rejected";
|
|
16676
16688
|
CHAT_TURN_LOST_EVENT_TYPE = "replicas-turn-lost";
|
|
16689
|
+
CLAUDE_PEER_MESSAGE_EVENT_TYPE = "claude-peer-message";
|
|
16677
16690
|
AUTH_FALLBACK_EVENT_TYPE = "auth-fallback";
|
|
16678
16691
|
}
|
|
16679
16692
|
});
|
|
@@ -28348,7 +28361,32 @@ var init_html = __esm({
|
|
|
28348
28361
|
}
|
|
28349
28362
|
});
|
|
28350
28363
|
|
|
28364
|
+
// ../shared/src/user-message-parser/plan-quote.ts
|
|
28365
|
+
var init_plan_quote = __esm({
|
|
28366
|
+
"../shared/src/user-message-parser/plan-quote.ts"() {
|
|
28367
|
+
"use strict";
|
|
28368
|
+
}
|
|
28369
|
+
});
|
|
28370
|
+
|
|
28351
28371
|
// ../shared/src/user-message-attachments.ts
|
|
28372
|
+
function findAnnotationsNote(content) {
|
|
28373
|
+
const complete = content.match(ANNOTATIONS_NOTE_REGEX);
|
|
28374
|
+
if (complete) return { index: complete.index ?? 0, body: complete[1] };
|
|
28375
|
+
for (const { index } of content.matchAll(/(?:^|\n\n)(?=<r)/g)) {
|
|
28376
|
+
const note = content.slice(index).trimStart();
|
|
28377
|
+
if (note.startsWith(ANNOTATIONS_NOTE_OPENING) || ANNOTATIONS_NOTE_OPENING.startsWith(note)) return { index, body: note.slice("<replicas_annotations>\n".length) };
|
|
28378
|
+
}
|
|
28379
|
+
return null;
|
|
28380
|
+
}
|
|
28381
|
+
function parseAnnotationsNote(body) {
|
|
28382
|
+
return body.split(ANNOTATION_HEADER_REGEX).slice(1).map((entry) => {
|
|
28383
|
+
const lines = entry.trim().split("\n");
|
|
28384
|
+
const quoteLength = lines.findIndex((line) => !line.startsWith(">"));
|
|
28385
|
+
const quote = lines.slice(0, quoteLength === -1 ? void 0 : quoteLength).map((line) => line.replace(/^>\s?/, ""));
|
|
28386
|
+
const comment = quoteLength === -1 ? "" : lines.slice(quoteLength).join("\n").trim();
|
|
28387
|
+
return { text: quote.join("\n"), ...comment ? { comment } : {} };
|
|
28388
|
+
});
|
|
28389
|
+
}
|
|
28352
28390
|
function parseAppshot(match) {
|
|
28353
28391
|
return {
|
|
28354
28392
|
appName: unescapeXml(match[1] ?? ""),
|
|
@@ -28376,19 +28414,26 @@ function stripAttachmentNote(text3) {
|
|
|
28376
28414
|
};
|
|
28377
28415
|
const walkthroughs = takeTrailingNotes(WALKTHROUGH_NOTE_REGEX, TRUNCATED_WALKTHROUGH_NOTE_REGEX, (walkthrough) => ({ path: walkthrough[1], durationSeconds: Number(walkthrough[2] ?? 0), audio: walkthrough[3] === "true" }));
|
|
28378
28416
|
const appshots = takeTrailingNotes(APPSHOT_NOTE_REGEX, TRUNCATED_APPSHOT_NOTE_REGEX, parseAppshot);
|
|
28417
|
+
const annotationsNote = findAnnotationsNote(content);
|
|
28418
|
+
if (annotationsNote) content = content.slice(0, annotationsNote.index).trim();
|
|
28379
28419
|
return {
|
|
28380
28420
|
content,
|
|
28381
28421
|
files: match ? [...match[1].matchAll(/^- (.+)$/gm)].map(([, path10]) => path10) : [],
|
|
28382
28422
|
walkthroughs,
|
|
28383
|
-
appshots
|
|
28423
|
+
appshots,
|
|
28424
|
+
annotations: annotationsNote ? parseAnnotationsNote(annotationsNote.body) : []
|
|
28384
28425
|
};
|
|
28385
28426
|
}
|
|
28386
|
-
var ATTACHMENT_PLACEHOLDER_REGEX, APPSHOT_NOTE_REGEX, TRUNCATED_APPSHOT_NOTE_REGEX, XML_UNESCAPES, unescapeXml, WALKTHROUGH_NOTE_REGEX, TRUNCATED_WALKTHROUGH_NOTE_REGEX;
|
|
28427
|
+
var ATTACHMENT_PLACEHOLDER_REGEX, ANNOTATIONS_NOTE_OPENING, ANNOTATIONS_NOTE_REGEX, ANNOTATION_HEADER_REGEX, APPSHOT_NOTE_REGEX, TRUNCATED_APPSHOT_NOTE_REGEX, XML_UNESCAPES, unescapeXml, WALKTHROUGH_NOTE_REGEX, TRUNCATED_WALKTHROUGH_NOTE_REGEX;
|
|
28387
28428
|
var init_user_message_attachments = __esm({
|
|
28388
28429
|
"../shared/src/user-message-attachments.ts"() {
|
|
28389
28430
|
"use strict";
|
|
28390
28431
|
init_html();
|
|
28432
|
+
init_plan_quote();
|
|
28391
28433
|
ATTACHMENT_PLACEHOLDER_REGEX = /^\[\d+ (?:(?:images?|files?)(?: and \d+ files?)? attached|(?:image )?attachments?)\]$/;
|
|
28434
|
+
ANNOTATIONS_NOTE_OPENING = '<replicas_annotations>\nThe user quoted these passages, some with a comment. Address each annotation, and when you do, refer to it as "Annotation N".';
|
|
28435
|
+
ANNOTATIONS_NOTE_REGEX = /(?:^|\n\n)<replicas_annotations>\n([\s\S]*?)\n<\/replicas_annotations>$/;
|
|
28436
|
+
ANNOTATION_HEADER_REGEX = /^Annotation \d+$/m;
|
|
28392
28437
|
APPSHOT_NOTE_REGEX = /(?:^|\n\n)<replicas_appshot app="([^"\n]*)" window="([^"\n]*)" image="(\d+)">\n([^\n<]*)(?:\n\n([^<]*))?\n<\/replicas_appshot>$/;
|
|
28393
28438
|
TRUNCATED_APPSHOT_NOTE_REGEX = /(?:^|\n\n)<replicas_appshot app="([^"\n]*)(?:" window="([^"\n]*)(?:" image="(\d*))?)?[^<]*(?:<\/?[a-z_]*)?$/;
|
|
28394
28439
|
XML_UNESCAPES = { "&": "&", "<": "<", ">": ">", """: '"', "'": "'" };
|
|
@@ -29867,6 +29912,8 @@ function parseClaudeEvents(events, parentToolUseId) {
|
|
|
29867
29912
|
});
|
|
29868
29913
|
const toolCallMap = /* @__PURE__ */ new Map();
|
|
29869
29914
|
const taskMessageMap = /* @__PURE__ */ new Map();
|
|
29915
|
+
const peerNames = /* @__PURE__ */ new Map();
|
|
29916
|
+
const peerTimestamps = /* @__PURE__ */ new Map();
|
|
29870
29917
|
const workflowAgentMessageMap = /* @__PURE__ */ new Map();
|
|
29871
29918
|
const ambientTaskIds = /* @__PURE__ */ new Set();
|
|
29872
29919
|
const partialIndexes = /* @__PURE__ */ new Map();
|
|
@@ -29964,6 +30011,22 @@ function parseClaudeEvents(events, parentToolUseId) {
|
|
|
29964
30011
|
partialIndexes.set(payload.streamId, existing);
|
|
29965
30012
|
return;
|
|
29966
30013
|
}
|
|
30014
|
+
if (event.type === CLAUDE_PEER_MESSAGE_EVENT_TYPE) {
|
|
30015
|
+
const { name, from, body } = event.payload;
|
|
30016
|
+
if (typeof body !== "string") return;
|
|
30017
|
+
if (typeof name === "string" && typeof from === "string") peerNames.set(from, name);
|
|
30018
|
+
const sameTime = peerTimestamps.get(event.timestamp) ?? 0;
|
|
30019
|
+
peerTimestamps.set(event.timestamp, sameTime + 1);
|
|
30020
|
+
messages.push({
|
|
30021
|
+
id: `peer-${event.timestamp}-${sameTime}`,
|
|
30022
|
+
type: "peer_message",
|
|
30023
|
+
direction: "received",
|
|
30024
|
+
...typeof name === "string" ? { chat: name } : {},
|
|
30025
|
+
content: body,
|
|
30026
|
+
timestamp: event.timestamp
|
|
30027
|
+
});
|
|
30028
|
+
return;
|
|
30029
|
+
}
|
|
29967
30030
|
if (event.type === "claude-user") {
|
|
29968
30031
|
const content = normalizeContentBlocks(event.payload.message?.content);
|
|
29969
30032
|
const toolResult = content.find((c) => c.type === "tool_result");
|
|
@@ -30104,6 +30167,20 @@ function parseClaudeEvents(events, parentToolUseId) {
|
|
|
30104
30167
|
timestamp: event.timestamp
|
|
30105
30168
|
});
|
|
30106
30169
|
}
|
|
30170
|
+
} else if (toolName === "SendMessage") {
|
|
30171
|
+
const parsed = typeof toolInput === "string" ? safeJsonParse(toolInput, {}) : toolInput;
|
|
30172
|
+
const input = isRecord(parsed) ? parsed : {};
|
|
30173
|
+
const to = typeof input.to === "string" ? input.to.replace(/\s+\[[0-9a-f]+\]$/, "") : "";
|
|
30174
|
+
const chat2 = peerNames.get(to) ?? (to.startsWith("uds:") ? void 0 : to || void 0);
|
|
30175
|
+
messages.push({
|
|
30176
|
+
id: `peer-${toolUseId}`,
|
|
30177
|
+
type: "peer_message",
|
|
30178
|
+
direction: "sent",
|
|
30179
|
+
...chat2 ? { chat: chat2 } : {},
|
|
30180
|
+
content: typeof input.message === "string" ? input.message : "",
|
|
30181
|
+
status: "in_progress",
|
|
30182
|
+
timestamp: event.timestamp
|
|
30183
|
+
});
|
|
30107
30184
|
} else if (toolName === "WebSearch") {
|
|
30108
30185
|
const inputObj = typeof toolInput === "string" ? safeJsonParse(toolInput, {}) : toolInput;
|
|
30109
30186
|
const query = inputObj.query || "";
|
|
@@ -30274,6 +30351,9 @@ function parseClaudeEvents(events, parentToolUseId) {
|
|
|
30274
30351
|
message2.status = status;
|
|
30275
30352
|
} else if (message2.type === "web_search") {
|
|
30276
30353
|
message2.status = status;
|
|
30354
|
+
} else if (message2.type === "peer_message") {
|
|
30355
|
+
const result2 = safeJsonParse(resultContent, {});
|
|
30356
|
+
message2.status = isError || isRecord(result2) && result2.success === false ? "failed" : "completed";
|
|
30277
30357
|
} else if (message2.type === "tool_call") {
|
|
30278
30358
|
message2.output = resultContent;
|
|
30279
30359
|
message2.outputOmitted = outputOmitted;
|
|
@@ -30469,18 +30549,19 @@ function filterDisplayMessages(messages, provider2) {
|
|
|
30469
30549
|
}
|
|
30470
30550
|
result = result.flatMap((msg) => {
|
|
30471
30551
|
if (msg.type !== "user") return [msg];
|
|
30472
|
-
const { content, files, walkthroughs, appshots } = stripAttachmentNote(stripReplicasInstructionBlock(msg.content).trim());
|
|
30552
|
+
const { content, files, walkthroughs, appshots, annotations } = stripAttachmentNote(stripReplicasInstructionBlock(msg.content).trim());
|
|
30473
30553
|
if (INTERRUPTED_MESSAGE_REGEX.test(content)) {
|
|
30474
30554
|
return [{ id: msg.id, type: "interruption", timestamp: msg.timestamp }];
|
|
30475
30555
|
}
|
|
30476
30556
|
const cleaned = (msg.images?.length || files.length) && ATTACHMENT_PLACEHOLDER_REGEX.test(content) ? "" : content;
|
|
30477
|
-
if (cleaned.length === 0 && !msg.images?.length && files.length === 0 && walkthroughs.length === 0 && appshots.length === 0) return [];
|
|
30478
|
-
if (cleaned === msg.content && files.length === 0 && walkthroughs.length === 0 && appshots.length === 0) return [msg];
|
|
30557
|
+
if (cleaned.length === 0 && !msg.images?.length && files.length === 0 && walkthroughs.length === 0 && appshots.length === 0 && annotations.length === 0) return [];
|
|
30558
|
+
if (cleaned === msg.content && files.length === 0 && walkthroughs.length === 0 && appshots.length === 0 && annotations.length === 0) return [msg];
|
|
30479
30559
|
return [{
|
|
30480
30560
|
...msg,
|
|
30481
30561
|
content: cleaned,
|
|
30482
30562
|
...files.length > 0 ? { files } : {},
|
|
30483
30563
|
...walkthroughs.length > 0 ? { walkthroughs } : {},
|
|
30564
|
+
...annotations.length > 0 ? { annotations } : {},
|
|
30484
30565
|
...appshots.length > 0 ? { appshots } : {}
|
|
30485
30566
|
}];
|
|
30486
30567
|
});
|
|
@@ -30635,13 +30716,6 @@ var init_types7 = __esm({
|
|
|
30635
30716
|
}
|
|
30636
30717
|
});
|
|
30637
30718
|
|
|
30638
|
-
// ../shared/src/user-message-parser/plan-quote.ts
|
|
30639
|
-
var init_plan_quote = __esm({
|
|
30640
|
-
"../shared/src/user-message-parser/plan-quote.ts"() {
|
|
30641
|
-
"use strict";
|
|
30642
|
-
}
|
|
30643
|
-
});
|
|
30644
|
-
|
|
30645
30719
|
// ../shared/src/user-message-parser/inline-diff-comments.ts
|
|
30646
30720
|
var init_inline_diff_comments = __esm({
|
|
30647
30721
|
"../shared/src/user-message-parser/inline-diff-comments.ts"() {
|
|
@@ -31213,7 +31287,7 @@ var CLI_VERSION;
|
|
|
31213
31287
|
var init_cli_version = __esm({
|
|
31214
31288
|
"../shared/src/cli-version.ts"() {
|
|
31215
31289
|
"use strict";
|
|
31216
|
-
CLI_VERSION = "0.3.
|
|
31290
|
+
CLI_VERSION = "0.3.200";
|
|
31217
31291
|
}
|
|
31218
31292
|
});
|
|
31219
31293
|
|
|
@@ -31983,7 +32057,7 @@ var init_user = __esm({
|
|
|
31983
32057
|
});
|
|
31984
32058
|
|
|
31985
32059
|
// ../shared/src/routes/client-state.ts
|
|
31986
|
-
var MAX_CLIENT_STATE_REQUEST_BYTES, MAX_CLIENT_STATE_BYTES_PER_USER, WORKSPACE_LAST_VIEWED_AT_CLIENT_STATE_KEY_PREFIX, WORKSPACE_ATTENTION_DONE_CLIENT_STATE_KEY_PREFIX, WORKSPACE_SECTION_ORDER_CLIENT_STATE_KEY_PREFIX, WORKSPACE_STAGES_CLIENT_STATE_KEY_PREFIX, WORKSPACE_MARKED_UNREAD_CLIENT_STATE_KEY_PREFIX, PROMPT_HISTORY_CLIENT_STATE_KEY_PREFIX, orgUserClientStateKey, workspaceLastViewedAtClientStateKey, workspaceAttentionDoneClientStateKey, workspaceStagesClientStateKey, workspaceSectionOrderClientStateKey, workspaceMarkedUnreadClientStateKey, promptHistoryClientStateKey;
|
|
32060
|
+
var MAX_CLIENT_STATE_REQUEST_BYTES, MAX_CLIENT_STATE_BYTES_PER_USER, WORKSPACE_LAST_VIEWED_AT_CLIENT_STATE_KEY_PREFIX, WORKSPACE_ATTENTION_DONE_CLIENT_STATE_KEY_PREFIX, WORKSPACE_SECTION_ORDER_CLIENT_STATE_KEY_PREFIX, WORKSPACE_STAGES_CLIENT_STATE_KEY_PREFIX, WORKSPACE_MARKED_UNREAD_CLIENT_STATE_KEY_PREFIX, PROMPT_HISTORY_CLIENT_STATE_KEY_PREFIX, WORKSPACE_SEARCH_OPENS_CLIENT_STATE_KEY_PREFIX, orgUserClientStateKey, workspaceLastViewedAtClientStateKey, workspaceAttentionDoneClientStateKey, workspaceStagesClientStateKey, workspaceSectionOrderClientStateKey, workspaceMarkedUnreadClientStateKey, promptHistoryClientStateKey, workspaceSearchOpensClientStateKey;
|
|
31987
32061
|
var init_client_state = __esm({
|
|
31988
32062
|
"../shared/src/routes/client-state.ts"() {
|
|
31989
32063
|
"use strict";
|
|
@@ -31995,6 +32069,7 @@ var init_client_state = __esm({
|
|
|
31995
32069
|
WORKSPACE_STAGES_CLIENT_STATE_KEY_PREFIX = "replicas-workspace-stages-";
|
|
31996
32070
|
WORKSPACE_MARKED_UNREAD_CLIENT_STATE_KEY_PREFIX = "replicas-workspace-marked-unread-";
|
|
31997
32071
|
PROMPT_HISTORY_CLIENT_STATE_KEY_PREFIX = "replicas-prompt-history-";
|
|
32072
|
+
WORKSPACE_SEARCH_OPENS_CLIENT_STATE_KEY_PREFIX = "replicas-workspace-search-opens-";
|
|
31998
32073
|
orgUserClientStateKey = (prefix) => (organizationId, userId) => `${prefix}${organizationId}-${userId}`;
|
|
31999
32074
|
workspaceLastViewedAtClientStateKey = orgUserClientStateKey(WORKSPACE_LAST_VIEWED_AT_CLIENT_STATE_KEY_PREFIX);
|
|
32000
32075
|
workspaceAttentionDoneClientStateKey = orgUserClientStateKey(WORKSPACE_ATTENTION_DONE_CLIENT_STATE_KEY_PREFIX);
|
|
@@ -32002,6 +32077,7 @@ var init_client_state = __esm({
|
|
|
32002
32077
|
workspaceSectionOrderClientStateKey = orgUserClientStateKey(WORKSPACE_SECTION_ORDER_CLIENT_STATE_KEY_PREFIX);
|
|
32003
32078
|
workspaceMarkedUnreadClientStateKey = orgUserClientStateKey(WORKSPACE_MARKED_UNREAD_CLIENT_STATE_KEY_PREFIX);
|
|
32004
32079
|
promptHistoryClientStateKey = orgUserClientStateKey(PROMPT_HISTORY_CLIENT_STATE_KEY_PREFIX);
|
|
32080
|
+
workspaceSearchOpensClientStateKey = orgUserClientStateKey(WORKSPACE_SEARCH_OPENS_CLIENT_STATE_KEY_PREFIX);
|
|
32005
32081
|
}
|
|
32006
32082
|
});
|
|
32007
32083
|
|
|
@@ -32715,6 +32791,7 @@ var init_src = __esm({
|
|
|
32715
32791
|
init_result();
|
|
32716
32792
|
init_access();
|
|
32717
32793
|
init_saved_order();
|
|
32794
|
+
init_palette_search();
|
|
32718
32795
|
init_agent();
|
|
32719
32796
|
init_agent_availability();
|
|
32720
32797
|
init_agent_quota();
|