replicas-engine 0.1.439 → 0.1.441

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 +29 -15
  2. package/package.json +1 -1
package/dist/src/index.js CHANGED
@@ -506,7 +506,7 @@ var WORKSPACE_SIZES = ["small", "large"];
506
506
  var INVALID_WORKSPACE_SIZE_ERROR = `Invalid size: must be one of ${WORKSPACE_SIZES.join(", ")}`;
507
507
 
508
508
  // ../shared/src/e2b.ts
509
- var E2B_TEMPLATE_NAME = "replicas-sandbox-2026-07-15-v4";
509
+ var E2B_TEMPLATE_NAME = "replicas-sandbox-2026-07-16-v1";
510
510
 
511
511
  // ../shared/src/runtime-env.ts
512
512
  function shellQuotePosix(value) {
@@ -1968,24 +1968,18 @@ When you run services on ports \u2014 such as a web app, API server, or database
1968
1968
 
1969
1969
  ## Running Services for Preview
1970
1970
 
1971
- Services must run as detached background processes so they survive after your command session ends. Do not leave them attached to a foreground terminal.
1971
+ Always start services with \`replicas service start\` (see \`REPLICAS.md\`, "Long-running services"). It daemonizes the process so it survives your turn ending and workspace sleep/wake \u2014 a service left attached to your shell or backgrounded with \`&\`/\`nohup\` dies when the workspace sleeps, leaving the preview broken for the user.
1972
1972
 
1973
- Some potential methods:
1974
1973
  \`\`\`bash
1975
- # Start a detached service with logging
1976
- setsid -f bash -lc 'cd /path/to/app && exec yarn dev >> /tmp/app.log 2>&1'
1977
-
1978
- # For daemons like Docker
1979
- nohup dockerd > /tmp/dockerd.log 2>&1 &
1974
+ replicas service start web "yarn dev" --cwd /path/to/app
1980
1975
  \`\`\`
1981
1976
 
1982
1977
  After starting a service:
1983
- 1. Verify the process is running: \`pgrep -af 'yarn dev'\`
1984
- 2. Check logs for readiness: \`tail -f /tmp/app.log\`
1985
- 3. Confirm it's actually serving: \`curl -s http://localhost:3000\` (or appropriate health check)
1986
- 4. Only create the preview after the service is healthy
1978
+ 1. Check logs for readiness: \`replicas service logs web\`
1979
+ 2. Confirm it's actually serving: \`curl -s http://localhost:3000\` (or appropriate health check)
1980
+ 3. Only create the preview after the service is healthy
1987
1981
 
1988
- If a prior detached process exists on the same port, stop it before restarting.
1982
+ \`replicas service start\` on the same name restarts the service, so you never need to hunt down stale processes on the port.
1989
1983
 
1990
1984
  ## Creating Previews
1991
1985
 
@@ -2058,7 +2052,8 @@ Use this when:
2058
2052
  - The user asks you to create, edit, run, or delete an automation
2059
2053
  - The user asks you to manage environments, environment variables, or environment files
2060
2054
  - The user asks "what envs / repos / automations do I have?"
2061
- - The user asks you to scaffold a \`replicas.json\` / \`replicas.yaml\` in a repo`;
2055
+ - The user asks you to scaffold a \`replicas.json\` / \`replicas.yaml\` in a repo
2056
+ - You need to run a long-lived service (dev server, daemon) \u2014 always use \`replicas service start\` so it survives workspace sleep/wake`;
2062
2057
  var REFERENCE10 = `# Replicas (in-workspace CLI)
2063
2058
 
2064
2059
  This guide covers how to take action *with* Replicas itself from inside a Replicas workspace \u2014 managing automations, environments (and their variables/files), repos, previews, and the user's \`replicas.json\` config \u2014 using the pre-installed \`replicas\` CLI.
@@ -2094,6 +2089,7 @@ In agent mode the CLI hides commands that don't make sense for in-workspace agen
2094
2089
  | \`replicas environment ...\` | Manage environments, env vars, env files |
2095
2090
  | \`replicas automation ...\` | Manage automations (cron + GitHub/GitLab event triggers) |
2096
2091
  | \`replicas preview ...\` | Register / list preview URLs (covered in \`PREVIEWS.md\`) |
2092
+ | \`replicas service ...\` | Run long-lived services detached so they survive workspace sleep/wake (see below) |
2097
2093
  | \`replicas media ...\` | Upload screenshots, videos, audio (covered in \`MEDIA.md\`) |
2098
2094
  | \`replicas slack thread ...\` | Attach or switch Slack thread routing (covered in \`SLACK.md\`) |
2099
2095
 
@@ -2235,6 +2231,24 @@ replicas automation edit <id> \\
2235
2231
 
2236
2232
  \`replicas automation edit <id>\` with no flags drops into interactive mode.
2237
2233
 
2234
+ ## Long-running services
2235
+
2236
+ **Always use \`replicas service start\` to run anything that should keep running after your current command or turn ends** \u2014 dev servers, backend APIs, databases, daemons, watchers. Never leave them attached to your shell, and never rely on plain \`&\`, \`nohup\`, or your own backgrounding: processes started inside your session are torn down when your turn ends and the workspace goes to sleep, so the user finds them dead after waking the workspace. \`replicas service start\` daemonizes the process into its own session, which survives workspace sleep/wake.
2237
+
2238
+ \`\`\`bash
2239
+ replicas service start <name> "<command>" # start (or restart) a named service
2240
+ replicas service start web "bun run dev" --cwd ~/workspaces/app
2241
+ replicas service list # names, pids, running/stopped
2242
+ replicas service logs <name> [-n 100] # tail the service log
2243
+ replicas service stop <name> # stop the whole process group
2244
+ \`\`\`
2245
+
2246
+ Notes:
2247
+ - Quote the command if it contains shell operators: \`replicas service start web "cd app && bun dev"\`.
2248
+ - \`start\` on an existing name restarts it (the old process group is stopped first). It fails fast and prints the log tail if the service dies within the first second.
2249
+ - Logs stream to \`~/.replicas/services/<name>.log\`.
2250
+ - After starting, verify the service is actually healthy (check \`logs\`, then \`curl\` its port) before telling the user it's up or creating a preview for it.
2251
+
2238
2252
  ## Repositories
2239
2253
 
2240
2254
  Read-only listing of repos connected to the org. Use when the user asks "what repos can I use?", or to validate a \`--repository\` value before passing it to \`environment create\` / \`automation create\`:
@@ -8563,7 +8577,7 @@ var DEFAULT_CODEX_ARGS = ["app-server", "--listen", "stdio://"];
8563
8577
  var MIN_CODEX_CLI_VERSION = "0.144.0";
8564
8578
  var CODEX_UPGRADE_TIMEOUT_MS = 12e4;
8565
8579
  var codexCliVersionEnsured = null;
8566
- var ENGINE_PACKAGE_VERSION = "0.1.439";
8580
+ var ENGINE_PACKAGE_VERSION = "0.1.441";
8567
8581
  var INITIALIZE_METHOD = "initialize";
8568
8582
  var INITIALIZED_NOTIFICATION = "initialized";
8569
8583
  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.439",
3
+ "version": "0.1.441",
4
4
  "description": "Lightweight API server for Replicas workspaces",
5
5
  "type": "module",
6
6
  "main": "dist/src/index.js",