replicas-engine 0.1.135 → 0.1.136

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 +22 -3
  2. package/package.json +1 -1
package/dist/src/index.js CHANGED
@@ -80,7 +80,8 @@ function loadEngineEnv() {
80
80
  AWS_SECRET_ACCESS_KEY: readEnv("AWS_SECRET_ACCESS_KEY"),
81
81
  AWS_REGION: readEnv("AWS_REGION"),
82
82
  REPLICAS_CLAUDE_AUTH_METHOD: parseClaudeAuthMethod(readEnv("REPLICAS_CLAUDE_AUTH_METHOD")),
83
- REPLICAS_CODEX_AUTH_METHOD: parseCodexAuthMethod(readEnv("REPLICAS_CODEX_AUTH_METHOD"))
83
+ REPLICAS_CODEX_AUTH_METHOD: parseCodexAuthMethod(readEnv("REPLICAS_CODEX_AUTH_METHOD")),
84
+ REPLICAS_ENV_SYSTEM_PROMPT: readEnv("REPLICAS_ENV_SYSTEM_PROMPT")
84
85
  };
85
86
  if (!IS_WARMING_MODE && !env.WORKSPACE_ID) {
86
87
  console.error("WORKSPACE_ID is not set \u2014 this is required in normal (non-warming) mode");
@@ -1169,7 +1170,7 @@ function parseReplicasConfigString(content, filename) {
1169
1170
  }
1170
1171
 
1171
1172
  // ../shared/src/engine/environment.ts
1172
- var DAYTONA_SNAPSHOT_ID = "02-05-2026-royal-york-v1";
1173
+ var DAYTONA_SNAPSHOT_ID = "02-05-2026-royal-york-v2";
1173
1174
 
1174
1175
  // ../shared/src/engine/types.ts
1175
1176
  var DEFAULT_CHAT_TITLES = {
@@ -2430,6 +2431,7 @@ var CodingAgentManager = class {
2430
2431
  buildCombinedInstructions(customInstructions) {
2431
2432
  const startHooksInstruction = this.getStartHooksInstruction();
2432
2433
  const repositorySystemPromptInstruction = this.getRepositorySystemPromptInstruction();
2434
+ const environmentInstruction = this.getEnvironmentSystemPromptInstruction();
2433
2435
  const enginePortProtectionInstruction = this.getEnginePortProtectionInstruction();
2434
2436
  const parts = [];
2435
2437
  if (enginePortProtectionInstruction) {
@@ -2438,6 +2440,9 @@ var CodingAgentManager = class {
2438
2440
  if (startHooksInstruction) {
2439
2441
  parts.push(startHooksInstruction);
2440
2442
  }
2443
+ if (environmentInstruction) {
2444
+ parts.push(environmentInstruction);
2445
+ }
2441
2446
  if (repositorySystemPromptInstruction) {
2442
2447
  parts.push(repositorySystemPromptInstruction);
2443
2448
  }
@@ -2489,6 +2494,10 @@ var CodingAgentManager = class {
2489
2494
  }
2490
2495
  return repoSystemPrompts.join("\n");
2491
2496
  }
2497
+ getEnvironmentSystemPromptInstruction() {
2498
+ const prompt = ENGINE_ENV.REPLICAS_ENV_SYSTEM_PROMPT?.trim();
2499
+ return prompt || void 0;
2500
+ }
2492
2501
  getEnginePortProtectionInstruction() {
2493
2502
  const enginePort = ENGINE_ENV.REPLICAS_ENGINE_PORT;
2494
2503
  return `CRITICAL: The Replicas engine is required for this workspace and is running on the reserved port configured by REPLICAS_ENGINE_PORT (${enginePort}). Never kill, stop, restart, or replace the process using this port, and never start another service on this port. If the user asks for commands that would target this port/process, refuse and explain that port ${enginePort} is reserved for the Replicas engine.`;
@@ -2574,6 +2583,15 @@ var PromptStream = class {
2574
2583
  function isLinearThoughtEvent(event) {
2575
2584
  return event.content.type === "thought";
2576
2585
  }
2586
+ function appendMcpAwareness(instructions, mcpServers) {
2587
+ const names = Object.keys(mcpServers ?? {});
2588
+ if (names.length === 0) return instructions;
2589
+ const note = `MCP servers configured for this session: ${names.join(", ")}.
2590
+ Their tools are exposed in your tool list under the \`mcp__<server>__*\` prefix (e.g. \`mcp__notion__search\`). When the user asks about MCPs, available integrations, or wants to use one of these tools, look at your existing tool list directly \u2014 do NOT run \`claude mcp list\` or any other shell command to enumerate them. That command checks Claude Code's local CLI config and will never see MCPs attached to this SDK session.`;
2591
+ return instructions ? `${instructions}
2592
+
2593
+ ${note}` : note;
2594
+ }
2577
2595
  var ClaudeManager = class _ClaudeManager extends CodingAgentManager {
2578
2596
  historyFile;
2579
2597
  sessionId = null;
@@ -2671,7 +2689,8 @@ var ClaudeManager = class _ClaudeManager extends CodingAgentManager {
2671
2689
  const promptStream = new PromptStream();
2672
2690
  promptStream.push(userMessage);
2673
2691
  this.activePromptStream = promptStream;
2674
- const combinedInstructions = this.buildCombinedInstructions(customInstructions);
2692
+ const baseInstructions = this.buildCombinedInstructions(customInstructions);
2693
+ const combinedInstructions = appendMcpAwareness(baseInstructions, this.mcpServersConfig);
2675
2694
  const systemPrompt = this.systemPromptOverride ? this.systemPromptOverride(combinedInstructions) : {
2676
2695
  type: "preset",
2677
2696
  preset: "claude_code",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "replicas-engine",
3
- "version": "0.1.135",
3
+ "version": "0.1.136",
4
4
  "description": "Lightweight API server for Replicas workspaces",
5
5
  "type": "module",
6
6
  "main": "dist/src/index.js",