replicas-engine 0.1.387 → 0.1.388

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/src/index.js +53 -24
  2. package/package.json +1 -1
package/dist/src/index.js CHANGED
@@ -484,7 +484,7 @@ var WORKSPACE_SIZES = ["small", "large"];
484
484
  var INVALID_WORKSPACE_SIZE_ERROR = `Invalid size: must be one of ${WORKSPACE_SIZES.join(", ")}`;
485
485
 
486
486
  // ../shared/src/e2b.ts
487
- var E2B_TEMPLATE_NAME = "replicas-sandbox-2026-07-02-v8";
487
+ var E2B_TEMPLATE_NAME = "replicas-sandbox-2026-07-03-v1";
488
488
 
489
489
  // ../shared/src/runtime-env.ts
490
490
  function parsePosixEnvFile(content) {
@@ -719,7 +719,7 @@ The CLI is the canonical surface. Chat transcripts that show \`DISPLAY=:99 xdoto
719
719
  \`\`\`bash
720
720
  # DO
721
721
  replicas computer key Return
722
- replicas computer screenshot /tmp/state.png
722
+ replicas computer observe /tmp/state.png
723
723
 
724
724
  # DON'T
725
725
  DISPLAY=:99 xdotool key Return
@@ -737,9 +737,9 @@ replicas computer info
737
737
  # 2) Launch a browser on the workspace display.
738
738
  replicas computer launch chrome https://news.ycombinator.com
739
739
 
740
- # 3) Take a screenshot so you can see what's there.
741
- replicas computer screenshot /tmp/state.png
742
- # (Read the PNG yourself before deciding where to click.)
740
+ # 3) Observe the settled screen and browser tab state before clicking.
741
+ replicas computer observe /tmp/state.png
742
+ replicas computer browser --snapshot
743
743
 
744
744
  # 4) Drive the UI.
745
745
  replicas computer click 521 700 # click coordinates from the screenshot
@@ -762,14 +762,37 @@ If invoked very early in the workspace lifecycle, \`info\` will poll briefly whi
762
762
  ### \`replicas computer status\`
763
763
  Prints which desktop services are running and the active preview URL (if any). Useful for debugging when a tool call seems to be doing nothing.
764
764
 
765
- ### \`replicas computer screenshot <path>\`
766
- Captures the current desktop to a PNG at the given path. Read the file (e.g. with your Read tool) to see what's on screen - coordinates from the screenshot drive subsequent \`click\` / \`move\` / \`drag\` calls.
765
+ ### \`replicas computer screenshot <path> [--raw] [--grid [px]]\`
766
+ Captures the current desktop to a PNG at the given path.
767
+
768
+ Use \`--raw\` for a 1:1 desktop capture with no branding, padding, or rounded corners. Use \`--grid\` for the same 1:1 capture plus a coordinate grid; the optional value sets grid spacing in pixels and defaults to 100. Use the default branded screenshot only when you plan to share the image with \`replicas media upload\`.
769
+
770
+ ### \`replicas computer observe <path> [--raw] [--grid [px]] [--timeout MS] [--stable-ms MS] [--poll-ms MS]\`
771
+ Waits briefly for the screen to stop changing, saves a 1:1 screenshot, and prints JSON with screen dimensions, whether the screen stabilized, frame/change counts, mouse location, active window title, and visible window titles.
772
+
773
+ Use this instead of hand-written \`sleep && screenshot\` loops after clicks, navigation, typing, or page loads. By default it saves a 100px coordinate-grid screenshot and waits up to 3s for 600ms of visual stability. Pass \`--raw\` if you need an unannotated 1:1 screenshot.
774
+
775
+ ### \`replicas computer browser\`
776
+ Prints JSON for Chrome tabs launched through Replicas, including page titles and URLs. Pass \`--snapshot\` to include visible page text and interactive controls with DOM viewport bounding boxes.
777
+
778
+ Use this alongside \`observe\` when testing web apps so you do not infer navigation, page state, or click targets from pixels alone. Snapshot coordinates are DOM viewport coordinates, not desktop click coordinates.
779
+
780
+ ### \`replicas computer browser-click <text> [--exact] [--index N]\`
781
+ Clicks the first visible Chrome control whose text, label, placeholder, or href matches \`<text>\`. Use this for web buttons and links found via \`browser --snapshot\`; it is faster and less error-prone than converting DOM coordinates to desktop pixels.
782
+
783
+ ### \`replicas computer browser-fill <field> <value> [--exact] [--index N]\`
784
+ Fills the first visible Chrome field whose label, placeholder, name, or text matches \`<field>\`, then dispatches input/change events. Use this for web forms instead of clicking a field and typing through the desktop.
785
+
786
+ ### \`replicas computer browser-wait <text> [--mode any|text|title|url|control] [--exact] [--timeout MS]\`
787
+ Waits until the active Chrome page matches text in the title, URL, body text, or visible controls. Use this after \`browser-click\` / \`browser-fill\` when you need web app state to settle without screenshot polling.
788
+
789
+ For \`browser-click\`, \`browser-fill\`, and \`browser-wait\`, pass \`--id <id>\`, \`--title <text>\`, \`--url <text>\`, or \`--page <n>\` when multiple Chrome tabs are open. Run \`replicas computer browser\` first to list tabs. Prefer \`--id\` when a click may change the page title or URL.
767
790
 
768
791
  ### \`replicas computer click <x> <y> [--button N] [--double] [--modifiers ctrl+shift]\`
769
- Move to (x, y) and click. Default is left-click (button 1); pass \`--button 3\` for right-click. \`--modifiers\` holds keys during the click (e.g. ctrl-click a link to open in a new tab).
792
+ Move to (x, y) and click. Coordinates can be absolute pixels or percentages such as \`50%\` \`50%\`. Default is left-click (button 1); pass \`--button 3\` for right-click. \`--modifiers\` holds keys during the click (e.g. ctrl-click a link to open in a new tab).
770
793
 
771
794
  ### \`replicas computer move <x> <y>\`
772
- Move the mouse without clicking. Useful for hovering tooltips.
795
+ Move the mouse without clicking. Coordinates can be absolute pixels or percentages. Useful for hovering tooltips.
773
796
 
774
797
  ### \`replicas computer type <text> [--delay MS]\`
775
798
  Type a literal string into the focused field. Default per-character delay is 12ms (~80 wpm) - feels human and avoids breaking apps that debounce input. Bump \`--delay 30\` for stricter apps.
@@ -780,10 +803,10 @@ For key combos (not literal text), use \`key\`. \`type "ctrl+l"\` will literally
780
803
  Press a single key or combo. Examples: \`Return\`, \`Escape\`, \`Tab\`, \`ctrl+l\`, \`ctrl+shift+t\`, \`alt+Left\`, \`Page_Down\`, \`Home\`. Syntax matches \`xdotool key\`.
781
804
 
782
805
  ### \`replicas computer scroll <up|down|left|right> [--amount N] [--x X --y Y]\`
783
- Scroll the wheel. Pass \`--x\` / \`--y\` to hover before scrolling (otherwise scrolls wherever the cursor currently is). Default amount is 3 wheel ticks.
806
+ Scroll the wheel. Pass \`--x\` / \`--y\` to hover before scrolling (otherwise scrolls wherever the cursor currently is). Hover coordinates can be absolute pixels or percentages. Default amount is 3 wheel ticks.
784
807
 
785
808
  ### \`replicas computer drag <fromX> <fromY> <toX> <toY>\`
786
- Press left mouse at (fromX, fromY), drag to (toX, toY), release. For things like dragging a file onto an upload zone.
809
+ Press left mouse at (fromX, fromY), drag to (toX, toY), release. Coordinates can be absolute pixels or percentages. For things like dragging a file onto an upload zone.
787
810
 
788
811
  ### \`replicas computer launch <app> [args...]\`
789
812
  Spawns an app on the workspace display. Built-in aliases:
@@ -806,31 +829,37 @@ SIGINTs ffmpeg, waits for it to finalize the MP4, prints the output path. Upload
806
829
 
807
830
  ## Patterns
808
831
 
809
- ### Action / screenshot loop
810
- You are blind between tool calls. After any action that changes the screen, take a screenshot before deciding the next coordinate:
832
+ ### Action / observe loop
833
+ You are blind between tool calls. After any action that changes the screen, observe before deciding the next coordinate:
811
834
 
812
835
  \`\`\`bash
813
836
  replicas computer click 521 700
814
- sleep 2 # let the page settle
815
- replicas computer screenshot /tmp/after-click.png
816
- # read /tmp/after-click.png, decide next click
837
+ replicas computer observe /tmp/after-click.png
838
+ # read /tmp/after-click.png and the JSON output, decide next click
817
839
  \`\`\`
818
840
 
819
- \`sleep\` is a regular shell sleep - there's no \`replicas computer wait\` command, but you can mix shell sleeps freely.
841
+ The JSON \`stable\`, \`frames\`, and \`changes\` fields tell you whether something changed while you were waiting. If \`stable\` is false, observe again or increase \`--timeout\` before acting on coordinates.
820
842
 
821
843
  ### Typing into an address bar
822
844
  \`\`\`bash
823
845
  replicas computer launch chrome
824
- sleep 2
825
- replicas computer key ctrl+l # focus address bar
846
+ replicas computer observe /tmp/browser-open.png
847
+ replicas computer key ctrl+l
826
848
  replicas computer type "https://example.com"
827
849
  replicas computer key Return
828
- sleep 3 # wait for page load
829
- replicas computer screenshot /tmp/loaded.png
850
+ replicas computer observe /tmp/loaded.png
851
+ replicas computer browser --snapshot
852
+ replicas computer browser-fill "Search" "replicas"
853
+ replicas computer browser-click "More information" --title "Example"
854
+ replicas computer browser-wait "Example Domain" --mode title --title "Example"
830
855
  \`\`\`
831
856
 
832
857
  ### Coordinates from screenshots
833
- The display is 1920\xD71080 by default. Screenshot pixels map 1:1 to click coordinates - if your Read tool shows a button at pixel (520, 700), click \`replicas computer click 520 700\`. **No translation needed.** Modern image-reading models often imagine the screenshot is at a different resolution; trust the \`xdpyinfo\` value (\`replicas computer status\` shows the real size).
858
+ The display is 1920\xD71080 by default. For click planning, use \`observe\`, \`screenshot --raw\`, or \`screenshot --grid\`; those pixels map 1:1 to click coordinates. If the grid/raw screenshot shows a button at pixel (520, 700), click \`replicas computer click 520 700\`. The default screenshot is branded for sharing and has padding around the desktop, so do not use it for coordinates.
859
+
860
+ Use percentages for broad, layout-relative targets when exact pixels are unnecessary: \`replicas computer click 50% 50%\` clicks the center of the screen, and \`replicas computer move 95% 5%\` moves near the top-right.
861
+
862
+ Modern image-reading models often imagine the screenshot is at a different resolution. Trust the dimensions printed by \`observe\`, \`replicas computer screenshot ... --raw\` / \`--grid\`, and the \`xdpyinfo\` value shown by \`replicas computer status\`.
834
863
 
835
864
  ### Letting the user watch
836
865
  The Desktop tab is already live in the dashboard - the user can open it any time. If you're communicating with the user somewhere else (Slack, PR comment, etc.), grab the URL with \`replicas computer info\` and share it inline so they can watch you work.
@@ -849,7 +878,7 @@ Then embed the printed \`![\u2026](\u2026)\` line in your chat reply. See \`MEDI
849
878
 
850
879
  - **"Desktop services script missing"**: workspace image is older than this skill. Tell the user - nothing you can do from the CLI side.
851
880
  - **\`xdotool ... failed: Can't open display\`**: Xvfb didn't come up. \`replicas computer status\` will show which service is dead. Re-running any CLI command auto-attempts to start it.
852
- - **Browser doesn't appear after \`launch chrome\`**: give it 1-2s, then screenshot. Chrome cold-start on the virtual display takes ~500ms but bigger pages take longer.
881
+ - **Browser doesn't appear after \`launch chrome\`**: run \`replicas computer observe /tmp/state.png\`. Chrome cold-start on the virtual display takes ~500ms but bigger pages take longer.
853
882
  - **Live preview shows static / black screen**: the browser may have crashed. \`replicas computer status\` should show no Chrome process - re-launch.
854
883
  - **\`replicas computer info\` errors with "not registered"**: engine couldn't register the preview at startup (transient monolith error, or warming mode). Re-running the engine usually fixes it. Until it's registered, the Desktop tab will show a placeholder.
855
884
 
@@ -7849,7 +7878,7 @@ var AspClient = class {
7849
7878
  // src/managers/codex-asp/app-server-process.ts
7850
7879
  var DEFAULT_CODEX_BINARY = "codex";
7851
7880
  var DEFAULT_CODEX_ARGS = ["app-server", "--listen", "stdio://"];
7852
- var ENGINE_PACKAGE_VERSION = "0.1.387";
7881
+ var ENGINE_PACKAGE_VERSION = "0.1.388";
7853
7882
  var INITIALIZE_METHOD = "initialize";
7854
7883
  var INITIALIZED_NOTIFICATION = "initialized";
7855
7884
  var ACCOUNT_LOGIN_START_METHOD = "account/login/start";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "replicas-engine",
3
- "version": "0.1.387",
3
+ "version": "0.1.388",
4
4
  "description": "Lightweight API server for Replicas workspaces",
5
5
  "type": "module",
6
6
  "main": "dist/src/index.js",