replicas-engine 0.1.221 → 0.1.223

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 +64 -58
  2. package/package.json +1 -1
package/dist/src/index.js CHANGED
@@ -555,22 +555,19 @@ Docker is pre-installed in Replicas workspaces, but the daemon does **not** auto
555
555
 
556
556
  \`\`\`bash
557
557
  sudo service docker start
558
+ until docker info >/dev/null 2>&1; do sleep 0.2; done
558
559
  \`\`\`
559
560
 
560
- After starting, verify the daemon is running:
561
-
562
- \`\`\`bash
563
- docker info
564
- \`\`\`
561
+ \`service docker start\` returns before the socket is accepting connections, so immediate commands may fail without the poll.
565
562
 
566
563
  ## Important Notes
567
564
 
568
565
  - **Start once per session.** The daemon stays running until the workspace shuts down. You do not need to restart it between commands.
569
566
  - **Check before starting.** If you are unsure whether the daemon is already running, check first to avoid an unnecessary restart:
570
567
  \`\`\`bash
571
- docker info > /dev/null 2>&1 || sudo service docker start
568
+ docker info >/dev/null 2>&1 || { sudo service docker start && until docker info >/dev/null 2>&1; do sleep 0.2; done; }
572
569
  \`\`\`
573
- - **Sudo is required** for starting the daemon, but regular \`docker\` commands run without sudo (the user is in the \`docker\` group).
570
+ - **Sudo is only required for starting the daemon.** The workspace user is in the \`docker\` group, so regular \`docker\` commands work without sudo.
574
571
  `;
575
572
  var DOCKER_ABILITY = {
576
573
  label: "Docker",
@@ -710,8 +707,8 @@ gh pr review 123 --request-changes --body "Changes needed"
710
707
  GitHub does NOT have a public API for uploading images to PRs/issues. When you need to include images:
711
708
  - Do NOT use placeholder image URLs
712
709
  - Do NOT commit screenshots as files to the repository
713
- - Upload images to Imgur (or another external host) and use the returned URLs in your PR markdown
714
- - If you were triggered from Slack, also upload the images to the Slack thread so the user can see them directly
710
+ - Use the \`replicas-agent\` skill to share the image
711
+ - If you were triggered from Slack, also upload the image to the Slack thread so the user can see it directly
715
712
  `;
716
713
  var GITHUB_ABILITY = {
717
714
  label: "GitHub",
@@ -1159,10 +1156,9 @@ After (or alongside) the embeds, include a \`[View in Replicas](<deep-link>)\` h
1159
1156
 
1160
1157
  ### On external platforms (Slack, Linear, GitHub, etc.)
1161
1158
 
1162
- Do **both** of these \u2014 neither alone is sufficient:
1159
+ Always include a \`[View in Replicas](<deep-link>)\` hyperlink \u2014 use the per-file deep link the CLI printed for that file (\`...?mode=media&media=<media-id>\`), so the recipient lands directly on that specific item.
1163
1160
 
1164
- 1. Upload the raw bytes via that platform's own upload API (Slack \`files.upload\`, Linear attachments, Imgur for GitHub PR/issue images, etc.) so the recipient actually sees the media.
1165
- 2. Include a \`[View in Replicas](<deep-link>)\` hyperlink \u2014 use the per-file deep link the CLI printed for that file (\`...?mode=media&media=<media-id>\`), so the recipient lands directly on that specific item.
1161
+ For platforms that support native uploads (Slack \`files.upload\`, Linear attachments, etc.), upload the raw bytes there too so the recipient sees the media inline in addition to the Replicas link. GitHub PRs/issues do not have a public upload API, so the \`View in Replicas\` link is the canonical way to share media there \u2014 do not commit screenshots to the repo and do not use placeholder URLs.
1166
1162
 
1167
1163
  Do **not** include the \`![filename](https://api.tryreplicas.com/...)\` markdown embed in external messages. It will render as a broken image / 401 for the recipient.
1168
1164
 
@@ -1208,7 +1204,7 @@ replicas media upload chart-a.svg chart-b.svg --kind image
1208
1204
  var MEDIA_ABILITY = {
1209
1205
  label: "Media",
1210
1206
  description: "Share screenshots, recordings, generated images, and audio clips.",
1211
- bullet: "- Sharing media (screenshots, screen recordings, generated diagrams, audio clips) \u2014 including in your Replicas chat reply and to external platforms",
1207
+ bullet: "- Producing or showing the user any media \u2014 screenshots, screen recordings, generated images or diagrams, audio clips \u2014 including in your Replicas chat reply, PR descriptions/comments, and other external platforms",
1212
1208
  section: SECTION6,
1213
1209
  referenceFile: { name: "MEDIA.md", content: REFERENCE6 }
1214
1210
  };
@@ -1764,7 +1760,7 @@ function parseReplicasConfigString(content, filename) {
1764
1760
  }
1765
1761
 
1766
1762
  // ../shared/src/engine/environment.ts
1767
- var DAYTONA_SNAPSHOT_ID = "27-05-2026-royal-york-v3";
1763
+ var DAYTONA_SNAPSHOT_ID = "27-05-2026-royal-york-v7";
1768
1764
 
1769
1765
  // ../shared/src/engine/types.ts
1770
1766
  var DEFAULT_CHAT_TITLES = {
@@ -1817,6 +1813,12 @@ function codexAuthEnvFromResponse(response) {
1817
1813
  return { OPENAI_API_KEY: response.apiKey, REPLICAS_CODEX_AUTH_METHOD: "api_key" };
1818
1814
  }
1819
1815
  }
1816
+ var CODEX_AUTH_ENV_KEYS_BY_METHOD = {
1817
+ none: [],
1818
+ oauth: ["REPLICAS_CODEX_AUTH_METHOD"],
1819
+ api_key: ["OPENAI_API_KEY", "REPLICAS_CODEX_AUTH_METHOD"],
1820
+ bedrock: []
1821
+ };
1820
1822
 
1821
1823
  // ../shared/src/routes/claude.ts
1822
1824
  var CLAUDE_AUTH_ENV_KEYS = [
@@ -1843,6 +1845,18 @@ function claudeAuthEnvFromResponse(response) {
1843
1845
  };
1844
1846
  }
1845
1847
  }
1848
+ var CLAUDE_AUTH_ENV_KEYS_BY_METHOD = {
1849
+ none: [],
1850
+ oauth: ["REPLICAS_CLAUDE_AUTH_METHOD"],
1851
+ api_key: ["ANTHROPIC_API_KEY", "REPLICAS_CLAUDE_AUTH_METHOD"],
1852
+ bedrock: [
1853
+ "CLAUDE_CODE_USE_BEDROCK",
1854
+ "AWS_ACCESS_KEY_ID",
1855
+ "AWS_SECRET_ACCESS_KEY",
1856
+ "AWS_REGION",
1857
+ "REPLICAS_CLAUDE_AUTH_METHOD"
1858
+ ]
1859
+ };
1846
1860
 
1847
1861
  // ../shared/src/routes/workspaces.ts
1848
1862
  var WORKSPACE_FILE_UPLOAD_MAX_SIZE_BYTES = 20 * 1024 * 1024;
@@ -2155,6 +2169,26 @@ var githubTokenManager = new GitHubTokenManager();
2155
2169
  // src/managers/claude-token-manager.ts
2156
2170
  import { promises as fs2 } from "fs";
2157
2171
  import path2 from "path";
2172
+
2173
+ // src/managers/auth-env-transition.ts
2174
+ function applyAuthEnvTransition(params) {
2175
+ const newOwned = new Set(params.authKeysByMethod[params.newMethod]);
2176
+ const prevOwned = new Set(params.authKeysByMethod[params.prevMethod]);
2177
+ for (const key of params.authKeys) {
2178
+ const value = params.newEnvVars[key];
2179
+ if (value !== void 0) {
2180
+ for (const env of params.envs) {
2181
+ env[key] = value;
2182
+ }
2183
+ } else if (prevOwned.has(key) && !newOwned.has(key)) {
2184
+ for (const env of params.envs) {
2185
+ delete env[key];
2186
+ }
2187
+ }
2188
+ }
2189
+ }
2190
+
2191
+ // src/managers/claude-token-manager.ts
2158
2192
  var ClaudeTokenManager = class extends BaseRefreshManager {
2159
2193
  constructor() {
2160
2194
  super("ClaudeTokenManager");
@@ -2222,34 +2256,14 @@ var ClaudeTokenManager = class extends BaseRefreshManager {
2222
2256
  await this.removeOauthCredentialsFile();
2223
2257
  }
2224
2258
  const envVars = claudeAuthEnvFromResponse(response);
2225
- for (const key of CLAUDE_AUTH_ENV_KEYS) {
2226
- switch (key) {
2227
- case "REPLICAS_CLAUDE_AUTH_METHOD":
2228
- ENGINE_ENV.REPLICAS_CLAUDE_AUTH_METHOD = envVars.REPLICAS_CLAUDE_AUTH_METHOD;
2229
- break;
2230
- case "ANTHROPIC_API_KEY":
2231
- ENGINE_ENV.ANTHROPIC_API_KEY = envVars.ANTHROPIC_API_KEY;
2232
- break;
2233
- case "CLAUDE_CODE_USE_BEDROCK":
2234
- ENGINE_ENV.CLAUDE_CODE_USE_BEDROCK = envVars.CLAUDE_CODE_USE_BEDROCK;
2235
- break;
2236
- case "AWS_ACCESS_KEY_ID":
2237
- ENGINE_ENV.AWS_ACCESS_KEY_ID = envVars.AWS_ACCESS_KEY_ID;
2238
- break;
2239
- case "AWS_SECRET_ACCESS_KEY":
2240
- ENGINE_ENV.AWS_SECRET_ACCESS_KEY = envVars.AWS_SECRET_ACCESS_KEY;
2241
- break;
2242
- case "AWS_REGION":
2243
- ENGINE_ENV.AWS_REGION = envVars.AWS_REGION;
2244
- break;
2245
- }
2246
- const value = envVars[key];
2247
- if (value !== void 0) {
2248
- process.env[key] = value;
2249
- } else {
2250
- delete process.env[key];
2251
- }
2252
- }
2259
+ applyAuthEnvTransition({
2260
+ prevMethod: ENGINE_ENV.REPLICAS_CLAUDE_AUTH_METHOD ?? "none",
2261
+ newMethod: envVars.REPLICAS_CLAUDE_AUTH_METHOD ?? "none",
2262
+ authKeys: CLAUDE_AUTH_ENV_KEYS,
2263
+ authKeysByMethod: CLAUDE_AUTH_ENV_KEYS_BY_METHOD,
2264
+ newEnvVars: envVars,
2265
+ envs: [ENGINE_ENV, process.env]
2266
+ });
2253
2267
  }
2254
2268
  async writeOauthCredentialsFile(credentials) {
2255
2269
  const workspaceHome = ENGINE_ENV.HOME_DIR;
@@ -2348,22 +2362,14 @@ var CodexTokenManager = class extends BaseRefreshManager {
2348
2362
  await this.removeOauthCredentialsFile();
2349
2363
  }
2350
2364
  const envVars = codexAuthEnvFromResponse(response);
2351
- for (const key of CODEX_AUTH_ENV_KEYS) {
2352
- switch (key) {
2353
- case "REPLICAS_CODEX_AUTH_METHOD":
2354
- ENGINE_ENV.REPLICAS_CODEX_AUTH_METHOD = envVars.REPLICAS_CODEX_AUTH_METHOD;
2355
- break;
2356
- case "OPENAI_API_KEY":
2357
- ENGINE_ENV.OPENAI_API_KEY = envVars.OPENAI_API_KEY;
2358
- break;
2359
- }
2360
- const value = envVars[key];
2361
- if (value !== void 0) {
2362
- process.env[key] = value;
2363
- } else {
2364
- delete process.env[key];
2365
- }
2366
- }
2365
+ applyAuthEnvTransition({
2366
+ prevMethod: ENGINE_ENV.REPLICAS_CODEX_AUTH_METHOD ?? "none",
2367
+ newMethod: envVars.REPLICAS_CODEX_AUTH_METHOD ?? "none",
2368
+ authKeys: CODEX_AUTH_ENV_KEYS,
2369
+ authKeysByMethod: CODEX_AUTH_ENV_KEYS_BY_METHOD,
2370
+ newEnvVars: envVars,
2371
+ envs: [ENGINE_ENV, process.env]
2372
+ });
2367
2373
  }
2368
2374
  async writeOauthCredentialsFile(credentials) {
2369
2375
  const workspaceHome = ENGINE_ENV.HOME_DIR;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "replicas-engine",
3
- "version": "0.1.221",
3
+ "version": "0.1.223",
4
4
  "description": "Lightweight API server for Replicas workspaces",
5
5
  "type": "module",
6
6
  "main": "dist/src/index.js",