replicas-cli 0.3.197 → 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.
Files changed (2) hide show
  1. package/dist/index.cjs +41 -13
  2. package/package.json +1 -1
package/dist/index.cjs CHANGED
@@ -19984,6 +19984,8 @@ Don't make one when:
19984
19984
  - It is screenshots, or a before and after of them: upload them as images, which readers can open full screen and zoom. See "Before and after" in \`references/MEDIA.md\`.
19985
19985
  - The user wants a page, site, or component in their project: build that in the repo.
19986
19986
 
19987
+ A long report or write-up goes in the Canvas, and its key charts and comparisons go in a visual in your reply. Never screenshot a report, chart, or diagram you made to show it: a long page shrunk to an image can't be read, and it ignores the reader's theme. Screenshots of app UI you changed are still right.
19988
+
19987
19989
  ## Make it
19988
19990
 
19989
19991
  1. Write the page, for example \`/tmp/visuals/<name>.html\`, following the page rules below.
@@ -28346,7 +28348,32 @@ var init_html = __esm({
28346
28348
  }
28347
28349
  });
28348
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
+
28349
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
+ }
28350
28377
  function parseAppshot(match) {
28351
28378
  return {
28352
28379
  appName: unescapeXml(match[1] ?? ""),
@@ -28374,19 +28401,26 @@ function stripAttachmentNote(text3) {
28374
28401
  };
28375
28402
  const walkthroughs = takeTrailingNotes(WALKTHROUGH_NOTE_REGEX, TRUNCATED_WALKTHROUGH_NOTE_REGEX, (walkthrough) => ({ path: walkthrough[1], durationSeconds: Number(walkthrough[2] ?? 0), audio: walkthrough[3] === "true" }));
28376
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();
28377
28406
  return {
28378
28407
  content,
28379
28408
  files: match ? [...match[1].matchAll(/^- (.+)$/gm)].map(([, path10]) => path10) : [],
28380
28409
  walkthroughs,
28381
- appshots
28410
+ appshots,
28411
+ annotations: annotationsNote ? parseAnnotationsNote(annotationsNote.body) : []
28382
28412
  };
28383
28413
  }
28384
- 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;
28385
28415
  var init_user_message_attachments = __esm({
28386
28416
  "../shared/src/user-message-attachments.ts"() {
28387
28417
  "use strict";
28388
28418
  init_html();
28419
+ init_plan_quote();
28389
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;
28390
28424
  APPSHOT_NOTE_REGEX = /(?:^|\n\n)<replicas_appshot app="([^"\n]*)" window="([^"\n]*)" image="(\d+)">\n([^\n<]*)(?:\n\n([^<]*))?\n<\/replicas_appshot>$/;
28391
28425
  TRUNCATED_APPSHOT_NOTE_REGEX = /(?:^|\n\n)<replicas_appshot app="([^"\n]*)(?:" window="([^"\n]*)(?:" image="(\d*))?)?[^<]*(?:<\/?[a-z_]*)?$/;
28392
28426
  XML_UNESCAPES = { "&amp;": "&", "&lt;": "<", "&gt;": ">", "&quot;": '"', "&#39;": "'" };
@@ -30467,18 +30501,19 @@ function filterDisplayMessages(messages, provider2) {
30467
30501
  }
30468
30502
  result = result.flatMap((msg) => {
30469
30503
  if (msg.type !== "user") return [msg];
30470
- const { content, files, walkthroughs, appshots } = stripAttachmentNote(stripReplicasInstructionBlock(msg.content).trim());
30504
+ const { content, files, walkthroughs, appshots, annotations } = stripAttachmentNote(stripReplicasInstructionBlock(msg.content).trim());
30471
30505
  if (INTERRUPTED_MESSAGE_REGEX.test(content)) {
30472
30506
  return [{ id: msg.id, type: "interruption", timestamp: msg.timestamp }];
30473
30507
  }
30474
30508
  const cleaned = (msg.images?.length || files.length) && ATTACHMENT_PLACEHOLDER_REGEX.test(content) ? "" : content;
30475
- if (cleaned.length === 0 && !msg.images?.length && files.length === 0 && walkthroughs.length === 0 && appshots.length === 0) return [];
30476
- 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];
30477
30511
  return [{
30478
30512
  ...msg,
30479
30513
  content: cleaned,
30480
30514
  ...files.length > 0 ? { files } : {},
30481
30515
  ...walkthroughs.length > 0 ? { walkthroughs } : {},
30516
+ ...annotations.length > 0 ? { annotations } : {},
30482
30517
  ...appshots.length > 0 ? { appshots } : {}
30483
30518
  }];
30484
30519
  });
@@ -30633,13 +30668,6 @@ var init_types7 = __esm({
30633
30668
  }
30634
30669
  });
30635
30670
 
30636
- // ../shared/src/user-message-parser/plan-quote.ts
30637
- var init_plan_quote = __esm({
30638
- "../shared/src/user-message-parser/plan-quote.ts"() {
30639
- "use strict";
30640
- }
30641
- });
30642
-
30643
30671
  // ../shared/src/user-message-parser/inline-diff-comments.ts
30644
30672
  var init_inline_diff_comments = __esm({
30645
30673
  "../shared/src/user-message-parser/inline-diff-comments.ts"() {
@@ -31211,7 +31239,7 @@ var CLI_VERSION;
31211
31239
  var init_cli_version = __esm({
31212
31240
  "../shared/src/cli-version.ts"() {
31213
31241
  "use strict";
31214
- CLI_VERSION = "0.3.197";
31242
+ CLI_VERSION = "0.3.199";
31215
31243
  }
31216
31244
  });
31217
31245
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "replicas-cli",
3
- "version": "0.3.197",
3
+ "version": "0.3.199",
4
4
  "description": "CLI for managing Replicas workspaces - SSH into cloud dev environments with automatic port forwarding",
5
5
  "main": "dist/index.cjs",
6
6
  "bin": {