replicas-engine 0.1.815 → 0.1.817

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.
@@ -5,11 +5,11 @@ import {
5
5
  getCodexAspHost,
6
6
  restartCodexAspHost,
7
7
  restartCodexAspHostIfRunning
8
- } from "./chunk-WRUZSBSF.js";
9
- import "./chunk-3XXPWKPE.js";
10
- import "./chunk-UUQYVSQY.js";
8
+ } from "./chunk-FN67CYNX.js";
9
+ import "./chunk-JAITEGC4.js";
10
+ import "./chunk-EOYBI3PV.js";
11
11
  import "./chunk-UZSNFLDQ.js";
12
- import "./chunk-JTAIM2QE.js";
12
+ import "./chunk-OCQQ6AO3.js";
13
13
  import "./chunk-VEQXQN22.js";
14
14
  export {
15
15
  getCodexAspHost,
@@ -3,12 +3,12 @@ import { createRequire as __createRequire } from 'node:module';
3
3
  const require = __createRequire(import.meta.url);
4
4
  import {
5
5
  monolithRequest
6
- } from "./chunk-3XXPWKPE.js";
6
+ } from "./chunk-JAITEGC4.js";
7
7
  import {
8
8
  extractCommandProtectionCommandText,
9
9
  findGitCommitSignals,
10
10
  findPrMergeSignals
11
- } from "./chunk-JTAIM2QE.js";
11
+ } from "./chunk-OCQQ6AO3.js";
12
12
 
13
13
  // src/services/command-protection-service.ts
14
14
  var DEFAULT_COMMAND_PROTECTION_BLOCK_MESSAGE = "Blocked by Replicas command protection.";
@@ -4,7 +4,7 @@ const require = __createRequire(import.meta.url);
4
4
  import {
5
5
  findCodeHostPullRequestUrls,
6
6
  mayCreatePullRequest
7
- } from "./chunk-JTAIM2QE.js";
7
+ } from "./chunk-OCQQ6AO3.js";
8
8
 
9
9
  // src/services/post-tool-pr-notifier.ts
10
10
  async function notifyPostToolUse(toolName, toolInput, toolResult) {
@@ -4,7 +4,7 @@ const require = __createRequire(import.meta.url);
4
4
  import {
5
5
  HOOK_EXEC_MAX_BUFFER_BYTES,
6
6
  isVersionBelow
7
- } from "./chunk-JTAIM2QE.js";
7
+ } from "./chunk-OCQQ6AO3.js";
8
8
 
9
9
  // src/utils/codex-agent-env.ts
10
10
  function buildCodexAgentEnv(source = process.env) {
@@ -241,7 +241,7 @@ var DEFAULT_CODEX_ARGS = [
241
241
  var MIN_CODEX_CLI_VERSION = "0.153.3";
242
242
  var CODEX_UPGRADE_TIMEOUT_MS = 12e4;
243
243
  var codexCliVersionEnsured = null;
244
- var ENGINE_PACKAGE_VERSION = "0.1.815";
244
+ var ENGINE_PACKAGE_VERSION = "0.1.817";
245
245
  var INITIALIZE_METHOD = "initialize";
246
246
  var INITIALIZED_NOTIFICATION = "initialized";
247
247
  var ACCOUNT_LOGIN_START_METHOD = "account/login/start";
@@ -5,18 +5,18 @@ import {
5
5
  ENGINE_ENV,
6
6
  monolithRequest,
7
7
  setAgentCredentialSnapshot
8
- } from "./chunk-3XXPWKPE.js";
8
+ } from "./chunk-JAITEGC4.js";
9
9
  import {
10
10
  AppServerProcess,
11
11
  buildCodexAgentEnv
12
- } from "./chunk-UUQYVSQY.js";
12
+ } from "./chunk-EOYBI3PV.js";
13
13
  import {
14
14
  CODEX_AUTH_ENV_KEYS,
15
15
  CODEX_AUTH_ENV_KEYS_BY_METHOD,
16
16
  codexAuthEnvFromResponse,
17
17
  createErrorResult,
18
18
  createSuccessResult
19
- } from "./chunk-JTAIM2QE.js";
19
+ } from "./chunk-OCQQ6AO3.js";
20
20
 
21
21
  // src/managers/codex-token-manager.ts
22
22
  import { promises as fs } from "fs";
@@ -232,7 +232,7 @@ var CodexTokenManager = class extends BaseRefreshManager {
232
232
  const data = await response.json();
233
233
  await this.applyCredentialsResponse(data);
234
234
  if (restartOnChange && CODEX_AUTH_ENV_KEYS.some((key, index) => process.env[key] !== previousEnv[index])) {
235
- const { restartCodexAspHostIfRunning: restartCodexAspHostIfRunning2 } = await import("./asp-host-LHDELXWM.js");
235
+ const { restartCodexAspHostIfRunning: restartCodexAspHostIfRunning2 } = await import("./asp-host-JUVXZCRV.js");
236
236
  await restartCodexAspHostIfRunning2();
237
237
  }
238
238
  if (data.scope) {
@@ -0,0 +1,46 @@
1
+ #!/usr/bin/env node
2
+ import { createRequire as __createRequire } from 'node:module';
3
+ const require = __createRequire(import.meta.url);
4
+
5
+ // src/managers/relay-mcp-config.ts
6
+ import { existsSync } from "fs";
7
+ import { dirname, join } from "path";
8
+ import { fileURLToPath } from "url";
9
+ import { createRequire } from "module";
10
+ var RELAY_MCP_SERVER_NAME = "subagent_relay";
11
+ var RELAY_MCP_TOOL_NAMES = ["get_providers", "spawn_agent", "message_agent", "delete_agent"];
12
+ var RELAY_MCP_TOOL_TIMEOUT_MS = 24 * 60 * 60 * 1e3 + 6e4;
13
+ function relayMcpProcessConfig(parentChatId) {
14
+ const directory = dirname(fileURLToPath(import.meta.url));
15
+ const builtEntry = join(directory, "relay-mcp.js");
16
+ const sourceEntry = join(directory, "..", "relay-mcp.ts");
17
+ const entry = existsSync(builtEntry) ? builtEntry : sourceEntry;
18
+ return {
19
+ command: process.execPath,
20
+ args: [
21
+ ...entry.endsWith(".ts") ? ["--import", createRequire(import.meta.url).resolve("tsx/esm")] : [],
22
+ entry,
23
+ "--parent",
24
+ parentChatId
25
+ ]
26
+ };
27
+ }
28
+ function relayCodexMcpConfig(parentChatId) {
29
+ return {
30
+ ...relayMcpProcessConfig(parentChatId),
31
+ env_vars: ["REPLICAS_ENGINE_PORT", "REPLICAS_ENGINE_SECRET"],
32
+ enabled_tools: [...RELAY_MCP_TOOL_NAMES],
33
+ required: true,
34
+ default_tools_approval_mode: "approve",
35
+ startup_timeout_sec: 10,
36
+ tool_timeout_sec: Math.ceil(RELAY_MCP_TOOL_TIMEOUT_MS / 1e3)
37
+ };
38
+ }
39
+
40
+ export {
41
+ RELAY_MCP_SERVER_NAME,
42
+ RELAY_MCP_TOOL_NAMES,
43
+ RELAY_MCP_TOOL_TIMEOUT_MS,
44
+ relayMcpProcessConfig,
45
+ relayCodexMcpConfig
46
+ };
@@ -15,7 +15,7 @@ import {
15
15
  isValidRelayBaseProvider,
16
16
  parsePosixEnvFile,
17
17
  readReplicasRuntimeEnv
18
- } from "./chunk-JTAIM2QE.js";
18
+ } from "./chunk-OCQQ6AO3.js";
19
19
 
20
20
  // src/engine-env.ts
21
21
  import { readFileSync as readFileSync2 } from "fs";
@@ -817,6 +817,10 @@ var createChatRequestSchema = z3.object({
817
817
  var spawnRelaySubagentRequestSchema = z3.object({
818
818
  provider: z3.enum(VALID_AGENT_PROVIDERS),
819
819
  prompt: z3.string().min(1),
820
+ forkTurns: z3.string().regex(/^(all|none|[1-9]\d*)$/).refine(
821
+ (value) => value === "all" || value === "none" || Number.isSafeInteger(Number(value)),
822
+ "Expected all, none, or a positive safe integer string"
823
+ ).default("all"),
820
824
  model: z3.string().min(1).optional(),
821
825
  thinkingLevel: z3.enum(VALID_THINKING_LEVELS).optional(),
822
826
  title: z3.string().min(1).optional(),
@@ -7413,15 +7417,15 @@ function formatChatForkHandoffMessage(handoff) {
7413
7417
  const reason = describeChatForkReason(handoff.reason, handoff.source.provider);
7414
7418
  const why = handoff.trigger === "auto" ? `until ${reason ?? "it stopped"}, so Replicas moved the conversation to you automatically` : "until the user forked it to you";
7415
7419
  const body = [
7416
- `# Continuing a ${sourceName} chat`,
7420
+ handoff.subagent ? "# Delegated task context" : `# Continuing a ${sourceName} chat`,
7417
7421
  "",
7418
- `You are picking up the chat "${handoff.source.title}" in this same workspace. It was running on ${sourceName} ${why}. Everything the previous agent changed is already on disk: the workspace files and git state are authoritative.`,
7422
+ handoff.subagent ? `You are a subagent of the chat "${handoff.source.title}" in this same workspace. The inherited transcript is background for your assigned task below. Follow that task and report your result to the parent; do not take over the parent's entire request. Workspace files and git state are shared and authoritative.` : `You are picking up the chat "${handoff.source.title}" in this same workspace. It was running on ${sourceName} ${why}. Everything the previous agent changed is already on disk: the workspace files and git state are authoritative.`,
7419
7423
  "",
7420
7424
  "## Transcript",
7421
7425
  "",
7422
7426
  `- Sanitized transcript: \`${handoff.transcriptPath}\` (read or grep it for anything not in the excerpt below)`,
7423
- `- Raw event log: \`${handoff.rawHistoryPath}\``,
7424
- ...handoff.sourceTruncated ? ["- The chat was too large to sanitize in full; the sanitized file holds only its most recent part. Grep the raw event log for anything older."] : [],
7427
+ ...handoff.rawHistoryPath ? [`- Raw event log: \`${handoff.rawHistoryPath}\``] : [],
7428
+ ...handoff.sourceTruncated ? [`- The chat was too large to sanitize in full; the sanitized file holds only its most recent part.${handoff.rawHistoryPath ? " Grep the raw event log for anything older." : ""}`] : [],
7425
7429
  "",
7426
7430
  "## Recent turns",
7427
7431
  "",
@@ -3,12 +3,12 @@ import { createRequire as __createRequire } from 'node:module';
3
3
  const require = __createRequire(import.meta.url);
4
4
  import {
5
5
  evaluateCommandProtection
6
- } from "./chunk-I3CLB5FS.js";
7
- import "./chunk-3XXPWKPE.js";
6
+ } from "./chunk-6FLPUBVF.js";
7
+ import "./chunk-JAITEGC4.js";
8
8
  import {
9
9
  isRecord
10
10
  } from "./chunk-UZSNFLDQ.js";
11
- import "./chunk-JTAIM2QE.js";
11
+ import "./chunk-OCQQ6AO3.js";
12
12
  import "./chunk-VEQXQN22.js";
13
13
 
14
14
  // src/command-protection-hook.ts
@@ -3,13 +3,13 @@ import { createRequire as __createRequire } from 'node:module';
3
3
  const require = __createRequire(import.meta.url);
4
4
  import {
5
5
  evaluateCommandProtection
6
- } from "./chunk-I3CLB5FS.js";
6
+ } from "./chunk-6FLPUBVF.js";
7
7
  import {
8
8
  notifyPostToolUse
9
- } from "./chunk-MEPQJE5J.js";
10
- import "./chunk-3XXPWKPE.js";
9
+ } from "./chunk-C52ENUG3.js";
10
+ import "./chunk-JAITEGC4.js";
11
11
  import "./chunk-UZSNFLDQ.js";
12
- import "./chunk-JTAIM2QE.js";
12
+ import "./chunk-OCQQ6AO3.js";
13
13
  import "./chunk-VEQXQN22.js";
14
14
 
15
15
  // src/deepseek-command-protection-plugin.ts
@@ -8,12 +8,12 @@ import {
8
8
  import {
9
9
  AppServerProcess,
10
10
  buildCodexAgentEnv
11
- } from "./chunk-UUQYVSQY.js";
11
+ } from "./chunk-EOYBI3PV.js";
12
12
  import {
13
13
  AGENT,
14
14
  getMemoryOutputSafetyViolation,
15
15
  headlessAgentRequestSchema
16
- } from "./chunk-JTAIM2QE.js";
16
+ } from "./chunk-OCQQ6AO3.js";
17
17
  import "./chunk-VEQXQN22.js";
18
18
 
19
19
  // src/headless-agent.ts