replicas-cli 0.3.196 → 0.3.197

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