replicas-cli 0.3.198 → 0.3.199
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 +39 -13
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -28348,7 +28348,32 @@ var init_html = __esm({
|
|
|
28348
28348
|
}
|
|
28349
28349
|
});
|
|
28350
28350
|
|
|
28351
|
+
// ../shared/src/user-message-parser/plan-quote.ts
|
|
28352
|
+
var init_plan_quote = __esm({
|
|
28353
|
+
"../shared/src/user-message-parser/plan-quote.ts"() {
|
|
28354
|
+
"use strict";
|
|
28355
|
+
}
|
|
28356
|
+
});
|
|
28357
|
+
|
|
28351
28358
|
// ../shared/src/user-message-attachments.ts
|
|
28359
|
+
function findAnnotationsNote(content) {
|
|
28360
|
+
const complete = content.match(ANNOTATIONS_NOTE_REGEX);
|
|
28361
|
+
if (complete) return { index: complete.index ?? 0, body: complete[1] };
|
|
28362
|
+
for (const { index } of content.matchAll(/(?:^|\n\n)(?=<r)/g)) {
|
|
28363
|
+
const note = content.slice(index).trimStart();
|
|
28364
|
+
if (note.startsWith(ANNOTATIONS_NOTE_OPENING) || ANNOTATIONS_NOTE_OPENING.startsWith(note)) return { index, body: note.slice("<replicas_annotations>\n".length) };
|
|
28365
|
+
}
|
|
28366
|
+
return null;
|
|
28367
|
+
}
|
|
28368
|
+
function parseAnnotationsNote(body) {
|
|
28369
|
+
return body.split(ANNOTATION_HEADER_REGEX).slice(1).map((entry) => {
|
|
28370
|
+
const lines = entry.trim().split("\n");
|
|
28371
|
+
const quoteLength = lines.findIndex((line) => !line.startsWith(">"));
|
|
28372
|
+
const quote = lines.slice(0, quoteLength === -1 ? void 0 : quoteLength).map((line) => line.replace(/^>\s?/, ""));
|
|
28373
|
+
const comment = quoteLength === -1 ? "" : lines.slice(quoteLength).join("\n").trim();
|
|
28374
|
+
return { text: quote.join("\n"), ...comment ? { comment } : {} };
|
|
28375
|
+
});
|
|
28376
|
+
}
|
|
28352
28377
|
function parseAppshot(match) {
|
|
28353
28378
|
return {
|
|
28354
28379
|
appName: unescapeXml(match[1] ?? ""),
|
|
@@ -28376,19 +28401,26 @@ function stripAttachmentNote(text3) {
|
|
|
28376
28401
|
};
|
|
28377
28402
|
const walkthroughs = takeTrailingNotes(WALKTHROUGH_NOTE_REGEX, TRUNCATED_WALKTHROUGH_NOTE_REGEX, (walkthrough) => ({ path: walkthrough[1], durationSeconds: Number(walkthrough[2] ?? 0), audio: walkthrough[3] === "true" }));
|
|
28378
28403
|
const appshots = takeTrailingNotes(APPSHOT_NOTE_REGEX, TRUNCATED_APPSHOT_NOTE_REGEX, parseAppshot);
|
|
28404
|
+
const annotationsNote = findAnnotationsNote(content);
|
|
28405
|
+
if (annotationsNote) content = content.slice(0, annotationsNote.index).trim();
|
|
28379
28406
|
return {
|
|
28380
28407
|
content,
|
|
28381
28408
|
files: match ? [...match[1].matchAll(/^- (.+)$/gm)].map(([, path10]) => path10) : [],
|
|
28382
28409
|
walkthroughs,
|
|
28383
|
-
appshots
|
|
28410
|
+
appshots,
|
|
28411
|
+
annotations: annotationsNote ? parseAnnotationsNote(annotationsNote.body) : []
|
|
28384
28412
|
};
|
|
28385
28413
|
}
|
|
28386
|
-
var ATTACHMENT_PLACEHOLDER_REGEX, APPSHOT_NOTE_REGEX, TRUNCATED_APPSHOT_NOTE_REGEX, XML_UNESCAPES, unescapeXml, WALKTHROUGH_NOTE_REGEX, TRUNCATED_WALKTHROUGH_NOTE_REGEX;
|
|
28414
|
+
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
28415
|
var init_user_message_attachments = __esm({
|
|
28388
28416
|
"../shared/src/user-message-attachments.ts"() {
|
|
28389
28417
|
"use strict";
|
|
28390
28418
|
init_html();
|
|
28419
|
+
init_plan_quote();
|
|
28391
28420
|
ATTACHMENT_PLACEHOLDER_REGEX = /^\[\d+ (?:(?:images?|files?)(?: and \d+ files?)? attached|(?:image )?attachments?)\]$/;
|
|
28421
|
+
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".';
|
|
28422
|
+
ANNOTATIONS_NOTE_REGEX = /(?:^|\n\n)<replicas_annotations>\n([\s\S]*?)\n<\/replicas_annotations>$/;
|
|
28423
|
+
ANNOTATION_HEADER_REGEX = /^Annotation \d+$/m;
|
|
28392
28424
|
APPSHOT_NOTE_REGEX = /(?:^|\n\n)<replicas_appshot app="([^"\n]*)" window="([^"\n]*)" image="(\d+)">\n([^\n<]*)(?:\n\n([^<]*))?\n<\/replicas_appshot>$/;
|
|
28393
28425
|
TRUNCATED_APPSHOT_NOTE_REGEX = /(?:^|\n\n)<replicas_appshot app="([^"\n]*)(?:" window="([^"\n]*)(?:" image="(\d*))?)?[^<]*(?:<\/?[a-z_]*)?$/;
|
|
28394
28426
|
XML_UNESCAPES = { "&": "&", "<": "<", ">": ">", """: '"', "'": "'" };
|
|
@@ -30469,18 +30501,19 @@ function filterDisplayMessages(messages, provider2) {
|
|
|
30469
30501
|
}
|
|
30470
30502
|
result = result.flatMap((msg) => {
|
|
30471
30503
|
if (msg.type !== "user") return [msg];
|
|
30472
|
-
const { content, files, walkthroughs, appshots } = stripAttachmentNote(stripReplicasInstructionBlock(msg.content).trim());
|
|
30504
|
+
const { content, files, walkthroughs, appshots, annotations } = stripAttachmentNote(stripReplicasInstructionBlock(msg.content).trim());
|
|
30473
30505
|
if (INTERRUPTED_MESSAGE_REGEX.test(content)) {
|
|
30474
30506
|
return [{ id: msg.id, type: "interruption", timestamp: msg.timestamp }];
|
|
30475
30507
|
}
|
|
30476
30508
|
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];
|
|
30509
|
+
if (cleaned.length === 0 && !msg.images?.length && files.length === 0 && walkthroughs.length === 0 && appshots.length === 0 && annotations.length === 0) return [];
|
|
30510
|
+
if (cleaned === msg.content && files.length === 0 && walkthroughs.length === 0 && appshots.length === 0 && annotations.length === 0) return [msg];
|
|
30479
30511
|
return [{
|
|
30480
30512
|
...msg,
|
|
30481
30513
|
content: cleaned,
|
|
30482
30514
|
...files.length > 0 ? { files } : {},
|
|
30483
30515
|
...walkthroughs.length > 0 ? { walkthroughs } : {},
|
|
30516
|
+
...annotations.length > 0 ? { annotations } : {},
|
|
30484
30517
|
...appshots.length > 0 ? { appshots } : {}
|
|
30485
30518
|
}];
|
|
30486
30519
|
});
|
|
@@ -30635,13 +30668,6 @@ var init_types7 = __esm({
|
|
|
30635
30668
|
}
|
|
30636
30669
|
});
|
|
30637
30670
|
|
|
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
30671
|
// ../shared/src/user-message-parser/inline-diff-comments.ts
|
|
30646
30672
|
var init_inline_diff_comments = __esm({
|
|
30647
30673
|
"../shared/src/user-message-parser/inline-diff-comments.ts"() {
|
|
@@ -31213,7 +31239,7 @@ var CLI_VERSION;
|
|
|
31213
31239
|
var init_cli_version = __esm({
|
|
31214
31240
|
"../shared/src/cli-version.ts"() {
|
|
31215
31241
|
"use strict";
|
|
31216
|
-
CLI_VERSION = "0.3.
|
|
31242
|
+
CLI_VERSION = "0.3.199";
|
|
31217
31243
|
}
|
|
31218
31244
|
});
|
|
31219
31245
|
|