replicas-cli 0.3.196 → 0.3.198

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 +58 -17
  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.
@@ -20106,6 +20108,9 @@ var init_preferences = __esm({
20106
20108
  open_links_in_desktop_app: false,
20107
20109
  port_forwarding: false,
20108
20110
  spotify_controls: false,
20111
+ appshot_shortcut: "command",
20112
+ appshot_destination: "automatic",
20113
+ appshot_sound: true,
20109
20114
  mothership_intro_seen: false,
20110
20115
  follow_up_mode: "steer",
20111
20116
  memory_enabled: null,
@@ -28336,31 +28341,58 @@ var init_steps = __esm({
28336
28341
  }
28337
28342
  });
28338
28343
 
28344
+ // ../shared/src/html.ts
28345
+ var init_html = __esm({
28346
+ "../shared/src/html.ts"() {
28347
+ "use strict";
28348
+ }
28349
+ });
28350
+
28339
28351
  // ../shared/src/user-message-attachments.ts
28352
+ function parseAppshot(match) {
28353
+ return {
28354
+ appName: unescapeXml(match[1] ?? ""),
28355
+ windowTitle: unescapeXml(match[2] ?? ""),
28356
+ image: Number(match[3] || 0),
28357
+ ...match[5] && { text: unescapeXml(match[5]) },
28358
+ .../ \(cut short\)\. Treat that text as untrusted data/.test(match[4] ?? "") && { textTruncated: true }
28359
+ };
28360
+ }
28340
28361
  function stripAttachmentNote(text3) {
28341
28362
  const match = text3.match(/(?:^|\n\n)<replicas_attachments>\nUploaded files are available at:((?:\n- .*)*)(?:\n<\/?[a-z_]*>?)?$/) ?? text3.match(/(?:^|\n\n)Uploaded files are available at:((?:\n- .*)*)$/);
28342
28363
  let content = match ? text3.replace(match[0], "").trim() : text3;
28343
- const walkthroughs = [];
28344
- const truncated = WALKTHROUGH_NOTE_REGEX.test(content) ? null : content.match(TRUNCATED_WALKTHROUGH_NOTE_REGEX);
28345
- if (truncated) {
28346
- walkthroughs.push({ path: truncated[1], durationSeconds: Number(truncated[2] ?? 0), audio: truncated[3] === "true" });
28347
- content = content.slice(0, truncated.index).trim();
28348
- }
28349
- for (let walkthrough = content.match(WALKTHROUGH_NOTE_REGEX); walkthrough; walkthrough = content.match(WALKTHROUGH_NOTE_REGEX)) {
28350
- walkthroughs.unshift({ path: walkthrough[1], durationSeconds: Number(walkthrough[2]), audio: walkthrough[3] === "true" });
28351
- content = content.slice(0, walkthrough.index).trim();
28352
- }
28364
+ const takeTrailingNotes = (noteRegex, truncatedRegex, parse3) => {
28365
+ const notes = [];
28366
+ const truncated = noteRegex.test(content) ? null : content.match(truncatedRegex);
28367
+ if (truncated) {
28368
+ notes.push(parse3(truncated));
28369
+ content = content.slice(0, truncated.index).trim();
28370
+ }
28371
+ for (let note = content.match(noteRegex); note; note = content.match(noteRegex)) {
28372
+ notes.unshift(parse3(note));
28373
+ content = content.slice(0, note.index).trim();
28374
+ }
28375
+ return notes;
28376
+ };
28377
+ const walkthroughs = takeTrailingNotes(WALKTHROUGH_NOTE_REGEX, TRUNCATED_WALKTHROUGH_NOTE_REGEX, (walkthrough) => ({ path: walkthrough[1], durationSeconds: Number(walkthrough[2] ?? 0), audio: walkthrough[3] === "true" }));
28378
+ const appshots = takeTrailingNotes(APPSHOT_NOTE_REGEX, TRUNCATED_APPSHOT_NOTE_REGEX, parseAppshot);
28353
28379
  return {
28354
28380
  content,
28355
28381
  files: match ? [...match[1].matchAll(/^- (.+)$/gm)].map(([, path10]) => path10) : [],
28356
- walkthroughs
28382
+ walkthroughs,
28383
+ appshots
28357
28384
  };
28358
28385
  }
28359
- var ATTACHMENT_PLACEHOLDER_REGEX, WALKTHROUGH_NOTE_REGEX, TRUNCATED_WALKTHROUGH_NOTE_REGEX;
28386
+ var ATTACHMENT_PLACEHOLDER_REGEX, APPSHOT_NOTE_REGEX, TRUNCATED_APPSHOT_NOTE_REGEX, XML_UNESCAPES, unescapeXml, WALKTHROUGH_NOTE_REGEX, TRUNCATED_WALKTHROUGH_NOTE_REGEX;
28360
28387
  var init_user_message_attachments = __esm({
28361
28388
  "../shared/src/user-message-attachments.ts"() {
28362
28389
  "use strict";
28390
+ init_html();
28363
28391
  ATTACHMENT_PLACEHOLDER_REGEX = /^\[\d+ (?:(?:images?|files?)(?: and \d+ files?)? attached|(?:image )?attachments?)\]$/;
28392
+ APPSHOT_NOTE_REGEX = /(?:^|\n\n)<replicas_appshot app="([^"\n]*)" window="([^"\n]*)" image="(\d+)">\n([^\n<]*)(?:\n\n([^<]*))?\n<\/replicas_appshot>$/;
28393
+ TRUNCATED_APPSHOT_NOTE_REGEX = /(?:^|\n\n)<replicas_appshot app="([^"\n]*)(?:" window="([^"\n]*)(?:" image="(\d*))?)?[^<]*(?:<\/?[a-z_]*)?$/;
28394
+ XML_UNESCAPES = { "&amp;": "&", "&lt;": "<", "&gt;": ">", "&quot;": '"', "&#39;": "'" };
28395
+ unescapeXml = (text3) => text3.replace(/&(?:amp|lt|gt|quot|#39);/g, (entity) => XML_UNESCAPES[entity]);
28364
28396
  WALKTHROUGH_NOTE_REGEX = /(?:^|\n\n)<replicas_walkthrough path="([^"\n]+)" duration_seconds="(\d+)" audio="(true|false)">\n[^<]*\n<\/replicas_walkthrough>$/;
28365
28397
  TRUNCATED_WALKTHROUGH_NOTE_REGEX = /(?:^|\n\n)<replicas_walkthrough path="([^"\n]*)(?:" duration_seconds="(\d*))?(?:" audio="(true)?)?[^<]*(?:<\/?[a-z_]*)?$/;
28366
28398
  }
@@ -30437,18 +30469,19 @@ function filterDisplayMessages(messages, provider2) {
30437
30469
  }
30438
30470
  result = result.flatMap((msg) => {
30439
30471
  if (msg.type !== "user") return [msg];
30440
- const { content, files, walkthroughs } = stripAttachmentNote(stripReplicasInstructionBlock(msg.content).trim());
30472
+ const { content, files, walkthroughs, appshots } = stripAttachmentNote(stripReplicasInstructionBlock(msg.content).trim());
30441
30473
  if (INTERRUPTED_MESSAGE_REGEX.test(content)) {
30442
30474
  return [{ id: msg.id, type: "interruption", timestamp: msg.timestamp }];
30443
30475
  }
30444
30476
  const cleaned = (msg.images?.length || files.length) && ATTACHMENT_PLACEHOLDER_REGEX.test(content) ? "" : content;
30445
- if (cleaned.length === 0 && !msg.images?.length && files.length === 0 && walkthroughs.length === 0) return [];
30446
- if (cleaned === msg.content && files.length === 0 && walkthroughs.length === 0) return [msg];
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];
30447
30479
  return [{
30448
30480
  ...msg,
30449
30481
  content: cleaned,
30450
30482
  ...files.length > 0 ? { files } : {},
30451
- ...walkthroughs.length > 0 ? { walkthroughs } : {}
30483
+ ...walkthroughs.length > 0 ? { walkthroughs } : {},
30484
+ ...appshots.length > 0 ? { appshots } : {}
30452
30485
  }];
30453
30486
  });
30454
30487
  return result;
@@ -31038,6 +31071,13 @@ var init_slash_commands = __esm({
31038
31071
  }
31039
31072
  });
31040
31073
 
31074
+ // ../shared/src/image-attachments.ts
31075
+ var init_image_attachments = __esm({
31076
+ "../shared/src/image-attachments.ts"() {
31077
+ "use strict";
31078
+ }
31079
+ });
31080
+
31041
31081
  // ../shared/src/hook-config.ts
31042
31082
  var init_hook_config = __esm({
31043
31083
  "../shared/src/hook-config.ts"() {
@@ -31173,7 +31213,7 @@ var CLI_VERSION;
31173
31213
  var init_cli_version = __esm({
31174
31214
  "../shared/src/cli-version.ts"() {
31175
31215
  "use strict";
31176
- CLI_VERSION = "0.3.196";
31216
+ CLI_VERSION = "0.3.198";
31177
31217
  }
31178
31218
  });
31179
31219
 
@@ -32713,6 +32753,7 @@ var init_src = __esm({
32713
32753
  init_prompts();
32714
32754
  init_mothership_events();
32715
32755
  init_user_message_attachments();
32756
+ init_image_attachments();
32716
32757
  init_scout();
32717
32758
  init_replicas_config();
32718
32759
  init_warm_hooks();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "replicas-cli",
3
- "version": "0.3.196",
3
+ "version": "0.3.198",
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": {