replicas-engine 0.1.1606 → 0.1.1610

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.
@@ -8,12 +8,12 @@ import {
8
8
  listCodexModelsForDetails,
9
9
  restartCodexAspHost,
10
10
  restartCodexAspHostIfRunning
11
- } from "./chunk-FWC6IREY.js";
12
- import "./chunk-C3PFZKXL.js";
13
- import "./chunk-2XVJPLAN.js";
14
- import "./chunk-5SJ65PER.js";
11
+ } from "./chunk-42YX6Z76.js";
12
+ import "./chunk-LIIIKWEF.js";
13
+ import "./chunk-ZU4LKGPE.js";
14
+ import "./chunk-6PUYLBEC.js";
15
15
  import "./chunk-UZSNFLDQ.js";
16
- import "./chunk-V5AMWNUX.js";
16
+ import "./chunk-FTWEDN3E.js";
17
17
  import "./chunk-VEQXQN22.js";
18
18
  export {
19
19
  CODEX_ULTRAFAST_SERVICE_TIER,
@@ -12,15 +12,15 @@ import {
12
12
  resolveDiffBase,
13
13
  runGitCommand,
14
14
  setAgentCredentialSnapshot
15
- } from "./chunk-C3PFZKXL.js";
15
+ } from "./chunk-LIIIKWEF.js";
16
16
  import {
17
17
  AppServerProcess,
18
18
  buildCodexAgentEnv
19
- } from "./chunk-2XVJPLAN.js";
19
+ } from "./chunk-ZU4LKGPE.js";
20
20
  import {
21
21
  SUBPROCESS_MAX_BUFFER,
22
22
  execFileAsync
23
- } from "./chunk-5SJ65PER.js";
23
+ } from "./chunk-6PUYLBEC.js";
24
24
  import {
25
25
  isRecord
26
26
  } from "./chunk-UZSNFLDQ.js";
@@ -61,7 +61,7 @@ import {
61
61
  shrunkImageSize,
62
62
  splitMothershipInstructions,
63
63
  withTimeout
64
- } from "./chunk-V5AMWNUX.js";
64
+ } from "./chunk-FTWEDN3E.js";
65
65
 
66
66
  // src/managers/codex-token-manager.ts
67
67
  import { promises as fs } from "fs";
@@ -461,7 +461,7 @@ var CodexTokenManager = class extends BaseRefreshManager {
461
461
  await this.applyCredentialUpdate(++this.credentialGeneration, async () => {
462
462
  await this.applyCredentialsResponse(data);
463
463
  setAgentCredentialSnapshot("codex", data);
464
- const { restartCodexAspHostIfRunning: restartCodexAspHostIfRunning2 } = await import("./asp-host-RJMMUWAB.js");
464
+ const { restartCodexAspHostIfRunning: restartCodexAspHostIfRunning2 } = await import("./asp-host-ACWCJ3IS.js");
465
465
  await restartCodexAspHostIfRunning2();
466
466
  });
467
467
  await this.start(true);
@@ -483,7 +483,7 @@ var CodexTokenManager = class extends BaseRefreshManager {
483
483
  const accountChanged = ENGINE_ENV.REPLICAS_AGENT_CREDENTIALS.codex?.credentialId !== data.credentialId;
484
484
  await this.applyCredentialsResponse(data);
485
485
  if (restartOnChange && (accountChanged || CODEX_AUTH_ENV_KEYS.some((key, index) => process.env[key] !== previousEnv[index]))) {
486
- const { restartCodexAspHostIfRunning: restartCodexAspHostIfRunning2 } = await import("./asp-host-RJMMUWAB.js");
486
+ const { restartCodexAspHostIfRunning: restartCodexAspHostIfRunning2 } = await import("./asp-host-ACWCJ3IS.js");
487
487
  await restartCodexAspHostIfRunning2();
488
488
  }
489
489
  setAgentCredentialSnapshot("codex", data);
@@ -1595,21 +1595,23 @@ import { dirname as dirname2, join as join6 } from "path";
1595
1595
  import { fileURLToPath } from "url";
1596
1596
  import { createRequire as createRequire2 } from "module";
1597
1597
  var SUBAGENT_MCP_TOOL_TIMEOUT_MS = 24 * 60 * 60 * 1e3 + 6e4;
1598
- function subagentMcpProcessConfig(parentChatId) {
1598
+ function engineScriptProcess(script, args) {
1599
1599
  const directory = dirname2(fileURLToPath(import.meta.url));
1600
- const builtEntry = join6(directory, "subagent-mcp.js");
1601
- const sourceEntry = join6(directory, "..", "subagent-mcp.ts");
1600
+ const builtEntry = join6(directory, `${script}.js`);
1601
+ const sourceEntry = join6(directory, "..", `${script}.ts`);
1602
1602
  const entry = existsSync2(builtEntry) ? builtEntry : sourceEntry;
1603
1603
  return {
1604
1604
  command: process.execPath,
1605
1605
  args: [
1606
1606
  ...entry.endsWith(".ts") ? ["--import", createRequire2(import.meta.url).resolve("tsx/esm")] : [],
1607
1607
  entry,
1608
- "--parent",
1609
- parentChatId
1608
+ ...args
1610
1609
  ]
1611
1610
  };
1612
1611
  }
1612
+ function subagentMcpProcessConfig(parentChatId) {
1613
+ return engineScriptProcess("subagent-mcp", ["--parent", parentChatId]);
1614
+ }
1613
1615
  function subagentCodexMcpConfig(parentChatId) {
1614
1616
  return {
1615
1617
  ...subagentMcpProcessConfig(parentChatId),
@@ -2313,6 +2315,7 @@ export {
2313
2315
  removeTempImageFiles,
2314
2316
  CodexQuotaStatusTracker,
2315
2317
  SUBAGENT_MCP_TOOL_TIMEOUT_MS,
2318
+ engineScriptProcess,
2316
2319
  subagentMcpProcessConfig,
2317
2320
  DEFAULT_MODEL,
2318
2321
  THREAD_START_METHOD,
@@ -3,7 +3,7 @@ import { createRequire as __createRequire } from 'node:module';
3
3
  const require = __createRequire(import.meta.url);
4
4
  import {
5
5
  HOOK_EXEC_MAX_BUFFER_BYTES
6
- } from "./chunk-V5AMWNUX.js";
6
+ } from "./chunk-FTWEDN3E.js";
7
7
 
8
8
  // src/utils/exec.ts
9
9
  import { exec, execFile } from "child_process";
@@ -5,7 +5,7 @@ import {
5
5
  extractCommandProtectionCommandText,
6
6
  isRecord,
7
7
  parseCodeHostPrUrl
8
- } from "./chunk-V5AMWNUX.js";
8
+ } from "./chunk-FTWEDN3E.js";
9
9
 
10
10
  // src/services/published-pull-request-urls.ts
11
11
  function publishedPullRequestUrls(result) {
@@ -9543,7 +9543,170 @@ var linearIssueFiltersSchema = z3.object({
9543
9543
  });
9544
9544
  var LINEAR_STATE_TYPES = LINEAR_WORKFLOW_STATE_TYPES.filter((type) => type !== "duplicate");
9545
9545
 
9546
+ // ../shared/src/design-tokens.ts
9547
+ var plain = {
9548
+ black: "#000000",
9549
+ white: "#ffffff",
9550
+ purple: "#a855f7",
9551
+ blue: "#0ea5e9",
9552
+ pink: "#ec4899",
9553
+ orange: "#f97316",
9554
+ teal: "#14b8a6",
9555
+ lime: "#84cc16"
9556
+ };
9557
+ var PALETTE_PRESETS = {
9558
+ dark: ["default", "slate", "stone", "black", "high-contrast"],
9559
+ light: ["default", "slate", "stone", "neutral", "high-contrast"]
9560
+ };
9561
+ var PALETTES = [.../* @__PURE__ */ new Set([...PALETTE_PRESETS.dark, ...PALETTE_PRESETS.light]), "custom"];
9562
+ var PALETTE_COLORS = {
9563
+ dark: {
9564
+ default: { background: "#111111", subtle: "#181818", muted: "#1f1f1f", selected: "#2a2a2a", elevated: "#2a2a2a", foreground: "#ededed", mutedForeground: "#a3a3a3", faintForeground: "#737373", border: "#2a2a2a", borderStrong: "#5c5c5c" },
9565
+ slate: { background: "#0d1117", subtle: "#131821", muted: "#19202a", selected: "#232b37", elevated: "#232b37", foreground: "#e6ecf4", mutedForeground: "#97a5ba", faintForeground: "#687487", border: "#242c38", borderStrong: "#515c6d" },
9566
+ stone: { background: "#1a1713", subtle: "#201c18", muted: "#27231f", selected: "#312d28", elevated: "#312d28", foreground: "#f2eae2", mutedForeground: "#b0a497", faintForeground: "#80756b", border: "#342f29", borderStrong: "#675e54" },
9567
+ black: { background: "#000000", subtle: "#0a0a0a", muted: "#141414", selected: "#222222", elevated: "#222222", foreground: "#ededed", mutedForeground: "#a1a1a1", faintForeground: "#6c6c6c", border: "#262626", borderStrong: "#525252" },
9568
+ "high-contrast": { background: "#0b0b0b", subtle: "#141414", muted: "#1c1c1c", selected: "#2e2e2e", elevated: "#2e2e2e", foreground: "#fafafa", mutedForeground: "#bababa", faintForeground: "#858585", border: "#353535", borderStrong: "#5e5e5e" }
9569
+ },
9570
+ light: {
9571
+ default: { background: "#ffffff", subtle: "#f7f8f6", muted: "#f2f3f1", selected: "#e8ece7", elevated: "#ffffff", foreground: "#162118", mutedForeground: "#67706a", faintForeground: "#a1a7a3", border: "#e2e6e0", borderStrong: "#b9c1b8" },
9572
+ slate: { background: "#ffffff", subtle: "#f5f8fc", muted: "#eff3f9", selected: "#e4eaf3", elevated: "#ffffff", foreground: "#171f2b", mutedForeground: "#56667c", faintForeground: "#8592a6", border: "#d9e1ec", borderStrong: "#acb7c7" },
9573
+ stone: { background: "#fdf9f5", subtle: "#f8f3ed", muted: "#f4eee7", selected: "#ede5dc", elevated: "#ffffff", foreground: "#241c15", mutedForeground: "#6c6053", faintForeground: "#978c80", border: "#e3dbd2", borderStrong: "#bcb0a3" },
9574
+ neutral: { background: "#ffffff", subtle: "#f9f9f9", muted: "#f3f3f3", selected: "#eaeaea", elevated: "#ffffff", foreground: "#111111", mutedForeground: "#606060", faintForeground: "#898989", border: "#dedede", borderStrong: "#b4b4b4" },
9575
+ "high-contrast": { background: "#ffffff", subtle: "#f5f5f5", muted: "#ededed", selected: "#e0e0e0", elevated: "#ffffff", foreground: "#0a0a0a", mutedForeground: "#4f4f4f", faintForeground: "#6b6b6b", border: "#cccccc", borderStrong: "#949494" }
9576
+ }
9577
+ };
9578
+ var ACCENT_PRESETS = ["green", "blue", "purple", "pink"];
9579
+ var ACCENTS = [...ACCENT_PRESETS, "custom"];
9580
+ var ACCENT_COLORS = {
9581
+ green: {
9582
+ dark: { primary: "#3eeba3", primaryText: "#3eeba3", primarySoft: "#3eeba31a" },
9583
+ light: { primary: "#2f9d57", primaryText: "#007136", primarySoft: "#2f9d571a" }
9584
+ },
9585
+ blue: {
9586
+ dark: { primary: "#60a5fa", primaryText: "#60a5fa", primarySoft: "#60a5fa1a" },
9587
+ light: { primary: "#2563eb", primaryText: "#1d4ed8", primarySoft: "#2563eb1a" }
9588
+ },
9589
+ purple: {
9590
+ dark: { primary: "#c084fc", primaryText: "#c084fc", primarySoft: "#c084fc1a" },
9591
+ light: { primary: "#9333ea", primaryText: "#7e22ce", primarySoft: "#9333ea1a" }
9592
+ },
9593
+ pink: {
9594
+ dark: { primary: "#f472b6", primaryText: "#f472b6", primarySoft: "#f472b61a" },
9595
+ light: { primary: "#db2777", primaryText: "#be185d", primarySoft: "#db27771a" }
9596
+ }
9597
+ };
9598
+ var dark = {
9599
+ ...PALETTE_COLORS.dark.default,
9600
+ ...ACCENT_COLORS.green.dark,
9601
+ primaryForeground: "#111111",
9602
+ success: "#3eeba3",
9603
+ successText: "#3eeba3",
9604
+ successForeground: "#111111",
9605
+ successSoft: "#3eeba31a",
9606
+ destructive: "#ef4444",
9607
+ destructiveText: "#ff6f63",
9608
+ destructiveForeground: "#ffffff",
9609
+ destructiveSoft: "#dc262636",
9610
+ warning: "#f59e0b",
9611
+ warningText: "#f59e0b",
9612
+ warningSoft: "#f59e0b1a",
9613
+ warningForeground: "#111111",
9614
+ highlight: "#f59e0b4d",
9615
+ ...plain
9616
+ };
9617
+ var DESIGN_COLORS = {
9618
+ dark,
9619
+ light: {
9620
+ ...PALETTE_COLORS.light.default,
9621
+ ...ACCENT_COLORS.green.light,
9622
+ primaryForeground: "#ffffff",
9623
+ success: "#2f9d57",
9624
+ successText: "#007136",
9625
+ successForeground: "#ffffff",
9626
+ successSoft: "#2f9d571a",
9627
+ destructive: "#dc2626",
9628
+ destructiveText: "#b2000f",
9629
+ destructiveForeground: "#ffffff",
9630
+ destructiveSoft: "#dc262614",
9631
+ warning: "#92400e",
9632
+ warningText: "#92400e",
9633
+ warningSoft: "#92400e1f",
9634
+ warningForeground: "#ffffff",
9635
+ highlight: "#facc1580",
9636
+ ...plain
9637
+ }
9638
+ };
9639
+ var BRAND_COLORS = {
9640
+ replicas: { light: "#2f9d57", dark: "#3eeba3" },
9641
+ claude: "#d97757",
9642
+ codex: ["#b1a7ff", "#7a9dff", "#3941ff"],
9643
+ muse: "#0668e1",
9644
+ opencode: ["#4b4646", "#f1ecec"],
9645
+ slack: ["#e01e5a", "#36c5f0", "#2eb67d", "#ecb22e"],
9646
+ linear: "#8d8ff8",
9647
+ gitlab: "#fc6d26",
9648
+ badge: { label: "#121212", linear: "#5e6ad2", slack: "#4a154b" },
9649
+ // Emails assume a white page.
9650
+ email: { text: "#222", muted: "#888", link: "#0066cc" }
9651
+ };
9652
+ var channels = (hex) => [1, 3, 5].map((index) => parseInt(hex.slice(index, index + 2), 16));
9653
+ var mix = (from, to, amount) => {
9654
+ const target = channels(to);
9655
+ return `#${channels(from).map((channel, index) => Math.round(channel + (target[index] - channel) * amount).toString(16).padStart(2, "0")).join("")}`;
9656
+ };
9657
+ var DEFAULT_THEME = {
9658
+ palette: "default",
9659
+ accent: "green",
9660
+ custom: { background: PALETTE_COLORS.dark.default.background, foreground: PALETTE_COLORS.dark.default.foreground, accent: "#888888" }
9661
+ };
9662
+
9663
+ // ../shared/src/pixel-crew.ts
9664
+ var PIXEL_CREW_ROLE_NAMES = ["detective", "builder", "scientist", "accountant", "pilot", "artist", "medic", "guard", "courier", "captain", "chef", "astronaut", "wizard", "hacker", "operator", "explorer"];
9665
+ var THEME_PRIMARIES = Object.values(ACCENT_COLORS).map((accent) => accent.dark.primary);
9666
+ var THEME_INKS = [...Object.values(PALETTE_COLORS.dark).map((palette) => palette.background), ...Object.values(PALETTE_COLORS.light).map((palette) => palette.foreground)];
9667
+ var themeAvatarTile = (ink, primary) => mix(ink, primary, 0.15);
9668
+ var THEME_TILES = THEME_INKS.flatMap((ink) => THEME_PRIMARIES.map((primary) => themeAvatarTile(ink, primary)));
9669
+
9546
9670
  // ../shared/src/routes/mothership.ts
9671
+ var avatarColorSchema = z4.union([z4.literal("theme"), z4.string().regex(/^#[0-9a-f]{6}$/i)]);
9672
+ var MOTHERSHIP_AVATAR_BACKGROUNDS = [
9673
+ ["Forest", PALETTE_COLORS.light.default.foreground],
9674
+ ["Black", PALETTE_COLORS.dark.default.background],
9675
+ ["Graphite", PALETTE_COLORS.dark.default.selected],
9676
+ ["Deep green", ACCENT_COLORS.green.light.primaryText],
9677
+ ["Deep blue", ACCENT_COLORS.blue.light.primaryText],
9678
+ ["Deep purple", ACCENT_COLORS.purple.light.primaryText],
9679
+ ["Deep pink", ACCENT_COLORS.pink.light.primaryText],
9680
+ ["Brown", DESIGN_COLORS.light.warningText],
9681
+ ["Sage", PALETTE_COLORS.light.default.muted],
9682
+ ["White", DESIGN_COLORS.light.white]
9683
+ ];
9684
+ var MOTHERSHIP_AVATAR_PRIMARIES = [
9685
+ ["Green", ACCENT_COLORS.green.dark.primary],
9686
+ ["Blue", ACCENT_COLORS.blue.dark.primary],
9687
+ ["Purple", ACCENT_COLORS.purple.dark.primary],
9688
+ ["Pink", ACCENT_COLORS.pink.dark.primary],
9689
+ ["Coral", DESIGN_COLORS.dark.destructiveText],
9690
+ ["Amber", DESIGN_COLORS.dark.warning],
9691
+ ["White", PALETTE_COLORS.dark.default.foreground],
9692
+ ["Deep green", ACCENT_COLORS.green.light.primaryText],
9693
+ ["Deep blue", ACCENT_COLORS.blue.light.primaryText],
9694
+ ["Deep purple", ACCENT_COLORS.purple.light.primaryText],
9695
+ ["Deep pink", ACCENT_COLORS.pink.light.primaryText],
9696
+ ["Ink", PALETTE_COLORS.light.default.foreground]
9697
+ ];
9698
+ var mothershipPresetAvatarSchema = z4.object({
9699
+ kind: z4.literal("preset"),
9700
+ role: z4.enum(PIXEL_CREW_ROLE_NAMES),
9701
+ primary: avatarColorSchema,
9702
+ background: avatarColorSchema
9703
+ });
9704
+ var mothershipEmojiAvatarSchema = z4.object({
9705
+ kind: z4.literal("emoji"),
9706
+ emoji: z4.string().trim().min(1).max(32),
9707
+ background: avatarColorSchema
9708
+ });
9709
+ var mothershipChosenAvatarSchema = z4.discriminatedUnion("kind", [mothershipPresetAvatarSchema, mothershipEmojiAvatarSchema]);
9547
9710
  var setUpMothershipTextingRequestSchema = z4.object({ line: z4.string().optional() });
9548
9711
  var linearRuleFields = linearIssueFiltersSchema.extend({ team_id: z4.string().min(1) }).strict();
9549
9712
  var withLabelIds = (value) => {
@@ -11959,14 +12122,17 @@ var execRequestSchema = z15.object({
11959
12122
  /** Run through bash; `login` (default true) sources the login profile like Codex's `bash -lc`. */
11960
12123
  command: z15.string().min(1).optional(),
11961
12124
  argv: z15.array(z15.string()).min(1).optional(),
12125
+ /** A workspace MCP server by name. The daemon resolves its command or URL and credentials, so callers never see them. */
12126
+ mcpServer: z15.string().min(1).optional(),
11962
12127
  login: z15.boolean().optional(),
11963
12128
  cwd: z15.string().min(1).optional(),
11964
12129
  env: z15.record(z15.string(), z15.string()).optional(),
11965
12130
  /** Kill after this long, whoever is attached. */
11966
12131
  timeoutMs: z15.number().int().positive().optional(),
11967
12132
  /** Kill after this long with nobody attached. */
11968
- idleTtlMs: z15.number().int().positive().max(EXEC_MAX_IDLE_TTL_MS).optional()
11969
- }).refine((body) => body.command === void 0 !== (body.argv === void 0), { message: "Pass exactly one of command or argv" });
12133
+ idleTtlMs: z15.number().int().positive().max(EXEC_MAX_IDLE_TTL_MS).optional(),
12134
+ stdin: z15.boolean().optional()
12135
+ }).refine((body) => [body.command, body.argv, body.mcpServer].filter((value) => value !== void 0).length === 1, { message: "Pass exactly one of command, argv or mcpServer" });
11970
12136
  var execStartedSchema = z15.object({ processId: z15.string(), pid: z15.number() });
11971
12137
  var execExitSchema = z15.object({ exitCode: z15.number(), signal: z15.string().nullable(), reason: z15.enum(["exit", "timeout", "killed", "idle"]) });
11972
12138
  var execReplySchemas = {
@@ -11986,6 +12152,8 @@ var execReplySchemas = {
11986
12152
  exit: execExitSchema,
11987
12153
  kill: z15.object({}).strip(),
11988
12154
  killThread: z15.object({ killed: z15.number() }),
12155
+ input: z15.object({}).strip(),
12156
+ mcpServers: z15.object({ servers: z15.array(z15.object({ name: z15.string(), timeoutMs: z15.number().optional() })) }),
11989
12157
  list: z15.object({
11990
12158
  processes: z15.array(execStartedSchema.extend({
11991
12159
  threadId: z15.string(),
@@ -12308,118 +12476,6 @@ var reorderCredentialPoolSchema = z21.object({
12308
12476
  // ../shared/src/mothership-events.ts
12309
12477
  import { z as z28 } from "zod";
12310
12478
 
12311
- // ../shared/src/design-tokens.ts
12312
- var plain = {
12313
- black: "#000000",
12314
- white: "#ffffff",
12315
- purple: "#a855f7",
12316
- blue: "#0ea5e9",
12317
- pink: "#ec4899",
12318
- orange: "#f97316",
12319
- teal: "#14b8a6",
12320
- lime: "#84cc16"
12321
- };
12322
- var PALETTE_PRESETS = {
12323
- dark: ["default", "slate", "stone", "black", "high-contrast"],
12324
- light: ["default", "slate", "stone", "neutral", "high-contrast"]
12325
- };
12326
- var PALETTES = [.../* @__PURE__ */ new Set([...PALETTE_PRESETS.dark, ...PALETTE_PRESETS.light]), "custom"];
12327
- var PALETTE_COLORS = {
12328
- dark: {
12329
- default: { background: "#111111", subtle: "#181818", muted: "#1f1f1f", selected: "#2a2a2a", elevated: "#2a2a2a", foreground: "#ededed", mutedForeground: "#a3a3a3", faintForeground: "#737373", border: "#2a2a2a", borderStrong: "#5c5c5c" },
12330
- slate: { background: "#0d1117", subtle: "#131821", muted: "#19202a", selected: "#232b37", elevated: "#232b37", foreground: "#e6ecf4", mutedForeground: "#97a5ba", faintForeground: "#687487", border: "#242c38", borderStrong: "#515c6d" },
12331
- stone: { background: "#1a1713", subtle: "#201c18", muted: "#27231f", selected: "#312d28", elevated: "#312d28", foreground: "#f2eae2", mutedForeground: "#b0a497", faintForeground: "#80756b", border: "#342f29", borderStrong: "#675e54" },
12332
- black: { background: "#000000", subtle: "#0a0a0a", muted: "#141414", selected: "#222222", elevated: "#222222", foreground: "#ededed", mutedForeground: "#a1a1a1", faintForeground: "#6c6c6c", border: "#262626", borderStrong: "#525252" },
12333
- "high-contrast": { background: "#0b0b0b", subtle: "#141414", muted: "#1c1c1c", selected: "#2e2e2e", elevated: "#2e2e2e", foreground: "#fafafa", mutedForeground: "#bababa", faintForeground: "#858585", border: "#353535", borderStrong: "#5e5e5e" }
12334
- },
12335
- light: {
12336
- default: { background: "#ffffff", subtle: "#f7f8f6", muted: "#f2f3f1", selected: "#e8ece7", elevated: "#ffffff", foreground: "#162118", mutedForeground: "#67706a", faintForeground: "#a1a7a3", border: "#e2e6e0", borderStrong: "#b9c1b8" },
12337
- slate: { background: "#ffffff", subtle: "#f5f8fc", muted: "#eff3f9", selected: "#e4eaf3", elevated: "#ffffff", foreground: "#171f2b", mutedForeground: "#56667c", faintForeground: "#8592a6", border: "#d9e1ec", borderStrong: "#acb7c7" },
12338
- stone: { background: "#fdf9f5", subtle: "#f8f3ed", muted: "#f4eee7", selected: "#ede5dc", elevated: "#ffffff", foreground: "#241c15", mutedForeground: "#6c6053", faintForeground: "#978c80", border: "#e3dbd2", borderStrong: "#bcb0a3" },
12339
- neutral: { background: "#ffffff", subtle: "#f9f9f9", muted: "#f3f3f3", selected: "#eaeaea", elevated: "#ffffff", foreground: "#111111", mutedForeground: "#606060", faintForeground: "#898989", border: "#dedede", borderStrong: "#b4b4b4" },
12340
- "high-contrast": { background: "#ffffff", subtle: "#f5f5f5", muted: "#ededed", selected: "#e0e0e0", elevated: "#ffffff", foreground: "#0a0a0a", mutedForeground: "#4f4f4f", faintForeground: "#6b6b6b", border: "#cccccc", borderStrong: "#949494" }
12341
- }
12342
- };
12343
- var ACCENT_PRESETS = ["green", "blue", "purple", "pink"];
12344
- var ACCENTS = [...ACCENT_PRESETS, "custom"];
12345
- var ACCENT_COLORS = {
12346
- green: {
12347
- dark: { primary: "#3eeba3", primaryText: "#3eeba3", primarySoft: "#3eeba31a" },
12348
- light: { primary: "#2f9d57", primaryText: "#007136", primarySoft: "#2f9d571a" }
12349
- },
12350
- blue: {
12351
- dark: { primary: "#60a5fa", primaryText: "#60a5fa", primarySoft: "#60a5fa1a" },
12352
- light: { primary: "#2563eb", primaryText: "#1d4ed8", primarySoft: "#2563eb1a" }
12353
- },
12354
- purple: {
12355
- dark: { primary: "#c084fc", primaryText: "#c084fc", primarySoft: "#c084fc1a" },
12356
- light: { primary: "#9333ea", primaryText: "#7e22ce", primarySoft: "#9333ea1a" }
12357
- },
12358
- pink: {
12359
- dark: { primary: "#f472b6", primaryText: "#f472b6", primarySoft: "#f472b61a" },
12360
- light: { primary: "#db2777", primaryText: "#be185d", primarySoft: "#db27771a" }
12361
- }
12362
- };
12363
- var dark = {
12364
- ...PALETTE_COLORS.dark.default,
12365
- ...ACCENT_COLORS.green.dark,
12366
- primaryForeground: "#111111",
12367
- success: "#3eeba3",
12368
- successText: "#3eeba3",
12369
- successForeground: "#111111",
12370
- successSoft: "#3eeba31a",
12371
- destructive: "#ef4444",
12372
- destructiveText: "#ff6f63",
12373
- destructiveForeground: "#ffffff",
12374
- destructiveSoft: "#dc262636",
12375
- warning: "#f59e0b",
12376
- warningText: "#f59e0b",
12377
- warningSoft: "#f59e0b1a",
12378
- warningForeground: "#111111",
12379
- highlight: "#f59e0b4d",
12380
- ...plain
12381
- };
12382
- var DESIGN_COLORS = {
12383
- dark,
12384
- light: {
12385
- ...PALETTE_COLORS.light.default,
12386
- ...ACCENT_COLORS.green.light,
12387
- primaryForeground: "#ffffff",
12388
- success: "#2f9d57",
12389
- successText: "#007136",
12390
- successForeground: "#ffffff",
12391
- successSoft: "#2f9d571a",
12392
- destructive: "#dc2626",
12393
- destructiveText: "#b2000f",
12394
- destructiveForeground: "#ffffff",
12395
- destructiveSoft: "#dc262614",
12396
- warning: "#92400e",
12397
- warningText: "#92400e",
12398
- warningSoft: "#92400e1f",
12399
- warningForeground: "#ffffff",
12400
- highlight: "#facc1580",
12401
- ...plain
12402
- }
12403
- };
12404
- var BRAND_COLORS = {
12405
- replicas: { light: "#2f9d57", dark: "#3eeba3" },
12406
- claude: "#d97757",
12407
- codex: ["#b1a7ff", "#7a9dff", "#3941ff"],
12408
- muse: "#0668e1",
12409
- opencode: ["#4b4646", "#f1ecec"],
12410
- slack: ["#e01e5a", "#36c5f0", "#2eb67d", "#ecb22e"],
12411
- linear: "#8d8ff8",
12412
- gitlab: "#fc6d26",
12413
- badge: { label: "#121212", linear: "#5e6ad2", slack: "#4a154b" },
12414
- // Emails assume a white page.
12415
- email: { text: "#222", muted: "#888", link: "#0066cc" }
12416
- };
12417
- var DEFAULT_THEME = {
12418
- palette: "default",
12419
- accent: "green",
12420
- custom: { background: PALETTE_COLORS.dark.default.background, foreground: PALETTE_COLORS.dark.default.foreground, accent: "#888888" }
12421
- };
12422
-
12423
12479
  // ../shared/src/provider-icons.ts
12424
12480
  var PROVIDER_ICON_DEFINITIONS = {
12425
12481
  claude: {
@@ -12765,7 +12821,7 @@ A person's own defaults (agent, model, environment) and the organization's gener
12765
12821
  You can't add yourself to or remove yourself from a channel: people type \`/invite @Replicas\` or \`/remove @Replicas\` there, and an admin can pick channels under Integrations, Slack, Configure. To keep you in a channel but out of the way, lower it to Mentions only or put it in silent mode. A channel becomes a Mothership's own channel from that Mothership, not here; any channel's instructions can still send its messages to a Mothership.
12766
12822
 
12767
12823
  ## Tools
12768
- Read presets, channel instructions, and levels with \`${REPLICAS_MCP_TOOLS.listChannelSettings}\`. Change them with \`${REPLICAS_MCP_TOOLS.updateChannelSettings}\`, \`${REPLICAS_MCP_TOOLS.saveChannelPreset}\`, \`${REPLICAS_MCP_TOOLS.deleteChannelPreset}\`, \`${REPLICAS_MCP_TOOLS.setOrganizationProactivity}\`, \`${REPLICAS_MCP_TOOLS.setSlackConnectDefaults}\`, or \`${REPLICAS_MCP_TOOLS.setSlackAgentDefaults}\`. Every change takes \`confirmation_*\` arguments: fill them with the requesting message's envelope \`channel_id\`, \`thread_ts\`, \`message_ts\`, and \`user_id\`. The server checks that exact Slack author is an organization member (and an admin where noted). If it refuses, say why briefly and change nothing.
12824
+ Read presets, channel instructions, and levels with \`${REPLICAS_MCP_TOOLS.listChannelSettings}\`. Change them with \`${REPLICAS_MCP_TOOLS.updateChannelSettings}\`, \`${REPLICAS_MCP_TOOLS.saveChannelPreset}\`, \`${REPLICAS_MCP_TOOLS.deleteChannelPreset}\`, \`${REPLICAS_MCP_TOOLS.setOrganizationProactivity}\`, \`${REPLICAS_MCP_TOOLS.setSlackConnectDefaults}\`, or \`${REPLICAS_MCP_TOOLS.setSlackAgentDefaults}\`. Every change takes \`confirmation_*\` arguments naming who asked. For a Slack message, fill them with its envelope \`channel_id\`, \`thread_ts\`, \`message_ts\`, and \`user_id\`. A message from a person in the Replicas dashboard has no \`[Slack]\` envelope and carries a \`confirmation_dashboard_token\`: pass only that, never one from another message, and answer in the chat. The server checks that the person who asked is an organization member (and an admin where noted). If it refuses, say why briefly and change nothing.
12769
12825
 
12770
12826
  ## Changing settings
12771
12827
  - Settings also change outside your chat, often on purpose: read the current settings first, never trust earlier messages, and never re-apply an earlier request the current message doesn't ask for. Save only what the current message asks.
@@ -15396,7 +15452,8 @@ var DEFAULT_USER_PREFERENCES = {
15396
15452
  push_when_active: "wait",
15397
15453
  chat_text_size: "default",
15398
15454
  app_font: "inter",
15399
- code_font: "geist-mono"
15455
+ code_font: "geist-mono",
15456
+ wallpaper: null
15400
15457
  };
15401
15458
  function defaultReplicasAgentAbilities() {
15402
15459
  const abilities = {};
@@ -18999,6 +19056,9 @@ function parseReplicasEvents(events) {
18999
19056
  }));
19000
19057
  return;
19001
19058
  }
19059
+ case `${HARNESS_EVENT_TYPE_PREFIX}compaction`:
19060
+ messages.push({ id: `replicas-compaction-${String(payload.seq)}`, type: "reasoning", content: COMPACTION_CONTENT, status: "completed", timestamp, completedAt: timestamp });
19061
+ return;
19002
19062
  case `${HARNESS_EVENT_TYPE_PREFIX}error`:
19003
19063
  messages.push({ id: `replicas-error-${String(payload.seq)}`, type: "error", message: stringifyDisplayValue(payload.message) ?? "The agent stopped with an error", timestamp });
19004
19064
  return;
@@ -20582,7 +20642,7 @@ var VOICE_WAVEFORM = {
20582
20642
  };
20583
20643
 
20584
20644
  // ../shared/src/e2b.ts
20585
- var E2B_TEMPLATE_NAME = "replicas-sandbox-2026-11-17-v2";
20645
+ var E2B_TEMPLATE_NAME = "replicas-sandbox-2026-11-17-v6";
20586
20646
 
20587
20647
  // ../shared/src/e2b-retry.ts
20588
20648
  var DEFAULT_BACKOFFS_MS = [2e3, 5e3];
@@ -21207,7 +21267,18 @@ var harnessEventBodySchema = z32.discriminatedUnion("type", [
21207
21267
  z32.object({ type: z32.literal("assistant_message"), payload: z32.looseObject({ message: assistantMessageSchema }) }),
21208
21268
  z32.object({ type: z32.literal("tool_result"), payload: z32.looseObject({ message: toolResultMessageSchema }) }),
21209
21269
  z32.object({ type: z32.literal("status"), payload: z32.looseObject({ status: z32.enum(HARNESS_THREAD_STATUSES) }) }),
21210
- z32.object({ type: z32.literal("error"), payload: z32.looseObject({ message: z32.string() }) })
21270
+ z32.object({ type: z32.literal("error"), payload: z32.looseObject({ message: z32.string() }) }),
21271
+ /** The model's context is this summary followed by the events from `firstKeptSeq` on; nothing before it is deleted. */
21272
+ z32.object({
21273
+ type: z32.literal("compaction"),
21274
+ payload: z32.looseObject({
21275
+ summary: z32.string(),
21276
+ firstKeptSeq: z32.number(),
21277
+ tokensBefore: z32.number(),
21278
+ readFiles: z32.array(z32.string()),
21279
+ modifiedFiles: z32.array(z32.string())
21280
+ })
21281
+ })
21211
21282
  ]);
21212
21283
  var harnessLiveMessageSchema = z32.union([
21213
21284
  z32.object({ type: z32.literal("delta"), streamId: z32.string(), text: z32.string() }),
@@ -21882,14 +21953,17 @@ var scoutSlackConfirmationSchema = z36.object({
21882
21953
  confirmation_user_id: z36.string().describe("`user_id` from that message's envelope.")
21883
21954
  });
21884
21955
  var scoutAutomationToolInputSchema = automationToolInputSchema.extend(scoutSlackConfirmationSchema.shape);
21885
- var scoutSaveChannelPresetToolInputSchema = scoutSlackConfirmationSchema.extend({
21956
+ var scoutSettingsConfirmationSchema = scoutSlackConfirmationSchema.partial().extend({
21957
+ confirmation_dashboard_token: z36.string().optional().describe("For a request from a person in the Replicas dashboard: the `confirmation_dashboard_token` given in that message. Pass it instead of the Slack `confirmation_*` fields; the server authorizes the person who sent it, while it is still the latest message in its chat.")
21958
+ });
21959
+ var scoutSaveChannelPresetToolInputSchema = scoutSettingsConfirmationSchema.extend({
21886
21960
  preset_id: z36.string().optional().describe(`Id of the preset to update, from \`${REPLICAS_MCP_TOOLS.listChannelSettings}\`. Omit to create a new preset.`),
21887
21961
  name: z36.string().trim().min(1).max(SCOUT_PRESET_NAME_MAX_LENGTH).optional().describe("Preset name. Required when creating."),
21888
21962
  description: z36.string().optional().describe("One-line summary of what the preset is for."),
21889
21963
  icon: z36.enum(SCOUT_PRESET_ICONS).optional(),
21890
21964
  instructions: z36.string().optional().describe("Complete preset instructions; replaces the existing text. Required when creating.")
21891
21965
  });
21892
- var scoutUpdateChannelSettingsToolInputSchema = scoutSlackConfirmationSchema.extend({
21966
+ var scoutUpdateChannelSettingsToolInputSchema = scoutSettingsConfirmationSchema.extend({
21893
21967
  source: z36.enum(SCOUT_SOURCE_TYPES).optional().describe("Defaults to `slack`."),
21894
21968
  external_id: z36.string().describe("Slack channel id or Linear team id."),
21895
21969
  monitored: z36.boolean().optional().describe("Linear: `true` starts monitoring the team (organization admins only), `false` stops. Slack: kept for older callers; prefer `proactivity`. `false` means `tagged`, and `true` lifts a `tagged` channel back to the organization's level. Omit to keep it."),
@@ -21902,25 +21976,25 @@ var scoutUpdateChannelSettingsToolInputSchema = scoutSlackConfirmationSchema.ext
21902
21976
  var mothershipSlackChannelLevelToolInputSchema = scoutSlackConfirmationSchema.extend({
21903
21977
  proactivity: scoutUpdateChannelSettingsToolInputSchema.shape.proactivity.unwrap().describe("This channel's own level. `organization` makes it follow the organization's level again, which a Mothership's channel raises to at least `balanced`.")
21904
21978
  });
21905
- var scoutSetSlackConnectMutedToolInputSchema = scoutSlackConfirmationSchema.extend({
21979
+ var scoutSetSlackConnectMutedToolInputSchema = scoutSettingsConfirmationSchema.extend({
21906
21980
  muted: z36.boolean().describe("`true` puts every Slack Connect channel without its own setting in silent mode; `false` lets them follow their levels again.")
21907
21981
  });
21908
- var scoutSetSlackConnectDefaultsToolInputSchema = scoutSlackConfirmationSchema.extend({
21982
+ var scoutSetSlackConnectDefaultsToolInputSchema = scoutSettingsConfirmationSchema.extend({
21909
21983
  silent: z36.boolean().optional().describe("`true` puts every Slack Connect channel without its own setting in silent mode; `false` lets them follow their levels again. Omit to keep it."),
21910
21984
  muted: z36.boolean().optional().describe("Kept for older callers; prefer `silent`."),
21911
21985
  preset_id: z36.string().optional().describe("Preset for every Slack Connect channel without its own preset or instructions; an empty string removes it. Omit to keep it."),
21912
21986
  instructions: z36.string().optional().describe("Complete default instructions, applied after that preset; replaces the existing text. An empty string clears them. Omit to keep them."),
21913
21987
  proactivity: z36.enum([...SCOUT_PROACTIVITY_LEVELS, "default"]).optional().describe("Level for every Slack Connect channel without its own level. `default` returns them to `tagged`. Omit to keep it.")
21914
21988
  });
21915
- var scoutSetOrganizationProactivityToolInputSchema = scoutSlackConfirmationSchema.extend({
21989
+ var scoutSetOrganizationProactivityToolInputSchema = scoutSettingsConfirmationSchema.extend({
21916
21990
  proactivity: z36.enum(SCOUT_PROACTIVITY_LEVELS).describe(`The level every Slack channel and group DM follows unless it has its own. Slack Connect channels without their own level follow the shared-channel default from \`${REPLICAS_MCP_TOOLS.setSlackConnectDefaults}\` instead.`)
21917
21991
  });
21918
- var scoutDeleteChannelPresetToolInputSchema = scoutSlackConfirmationSchema.extend({
21992
+ var scoutDeleteChannelPresetToolInputSchema = scoutSettingsConfirmationSchema.extend({
21919
21993
  preset_id: z36.string().describe(`Id of the preset to delete, from \`${REPLICAS_MCP_TOOLS.listChannelSettings}\`.`)
21920
21994
  });
21921
21995
  var RESET_TO_DEFAULT = "default";
21922
21996
  var resettable = (schema, description) => z36.union([schema, z36.literal(RESET_TO_DEFAULT)]).optional().describe(`${description} \`${RESET_TO_DEFAULT}\` falls back to the organization default. Omit to keep it.`);
21923
- var scoutSetSlackAgentDefaultsToolInputSchema = scoutSlackConfirmationSchema.extend({
21997
+ var scoutSetSlackAgentDefaultsToolInputSchema = scoutSettingsConfirmationSchema.extend({
21924
21998
  agent_provider: resettable(z36.enum(ENGINE_AGENT_PROVIDERS), "Agent for Slack-triggered workspaces. Changing it without `model` resets the model to that agent's default."),
21925
21999
  model: resettable(z36.string(), "Model id for that agent; the default is the agent's own."),
21926
22000
  thinking_level: resettable(z36.enum(VALID_THINKING_LEVELS), "Thinking level."),
@@ -5,7 +5,7 @@ import {
5
5
  ENGINE_ENV,
6
6
  monolithRequest,
7
7
  runGitCommand
8
- } from "./chunk-C3PFZKXL.js";
8
+ } from "./chunk-LIIIKWEF.js";
9
9
  import {
10
10
  COMMAND_PROTECTION_MAX_MESSAGE_FILE_BYTES,
11
11
  COMMAND_PROTECTION_REPO_GIT_ARGS,
@@ -18,7 +18,7 @@ import {
18
18
  parseCommandProtectionRequest,
19
19
  toCommandProtectionRepoState,
20
20
  withE2BRetry
21
- } from "./chunk-V5AMWNUX.js";
21
+ } from "./chunk-FTWEDN3E.js";
22
22
 
23
23
  // src/services/command-protection-service.ts
24
24
  import { readFile, stat } from "fs/promises";
@@ -4,7 +4,7 @@ const require = __createRequire(import.meta.url);
4
4
  import {
5
5
  SUBPROCESS_MAX_BUFFER,
6
6
  execFileAsync
7
- } from "./chunk-5SJ65PER.js";
7
+ } from "./chunk-6PUYLBEC.js";
8
8
  import {
9
9
  isRecord as isRecord2
10
10
  } from "./chunk-UZSNFLDQ.js";
@@ -21,7 +21,7 @@ import {
21
21
  provisionedDeviceSchema,
22
22
  readReplicasRuntimeEnv,
23
23
  serializePosixEnvFile
24
- } from "./chunk-V5AMWNUX.js";
24
+ } from "./chunk-FTWEDN3E.js";
25
25
 
26
26
  // src/runtime-env-loader.ts
27
27
  import { readFileSync } from "fs";
@@ -3,7 +3,7 @@ import { createRequire as __createRequire } from 'node:module';
3
3
  const require = __createRequire(import.meta.url);
4
4
  import {
5
5
  AspClient
6
- } from "./chunk-2XVJPLAN.js";
6
+ } from "./chunk-ZU4LKGPE.js";
7
7
  import {
8
8
  ASTER_BASE_URL,
9
9
  ASTER_PROVIDER,
@@ -15,7 +15,7 @@ import {
15
15
  isRecord,
16
16
  readOllamaAuthEnv,
17
17
  readOpenAICompatibleAuthEnv
18
- } from "./chunk-V5AMWNUX.js";
18
+ } from "./chunk-FTWEDN3E.js";
19
19
 
20
20
  // src/managers/codex-asp/notification-dispatch.ts
21
21
  var TURN_STARTED_METHOD = "turn/started";
@@ -3,10 +3,10 @@ import { createRequire as __createRequire } from 'node:module';
3
3
  const require = __createRequire(import.meta.url);
4
4
  import {
5
5
  execFileAsync
6
- } from "./chunk-5SJ65PER.js";
6
+ } from "./chunk-6PUYLBEC.js";
7
7
  import {
8
8
  isVersionBelow
9
- } from "./chunk-V5AMWNUX.js";
9
+ } from "./chunk-FTWEDN3E.js";
10
10
 
11
11
  // src/utils/codex-agent-env.ts
12
12
  function buildCodexAgentEnv(source = process.env) {
@@ -240,7 +240,7 @@ function getCodexModelProvider(method) {
240
240
  if (method === "foundry") return "azure";
241
241
  return method === "ollama" || method === "openai-compatible" ? "replicas_openai_compatible" : "openai";
242
242
  }
243
- var ENGINE_PACKAGE_VERSION = "0.1.1606";
243
+ var ENGINE_PACKAGE_VERSION = "0.1.1610";
244
244
  var INITIALIZE_METHOD = "initialize";
245
245
  var INITIALIZED_NOTIFICATION = "initialized";
246
246
  var ACCOUNT_LOGIN_START_METHOD = "account/login/start";
@@ -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-HKOSS37G.js";
7
- import "./chunk-C3PFZKXL.js";
8
- import "./chunk-5SJ65PER.js";
6
+ } from "./chunk-L6MNALHN.js";
7
+ import "./chunk-LIIIKWEF.js";
8
+ import "./chunk-6PUYLBEC.js";
9
9
  import {
10
10
  isRecord
11
11
  } from "./chunk-UZSNFLDQ.js";
12
- import "./chunk-V5AMWNUX.js";
12
+ import "./chunk-FTWEDN3E.js";
13
13
  import "./chunk-VEQXQN22.js";
14
14
 
15
15
  // src/command-protection-hook.ts
@@ -14,12 +14,12 @@ import {
14
14
  recoverCompletedTurn,
15
15
  spawnMuseMsp,
16
16
  startMuseSession
17
- } from "./chunk-PWHJWO2J.js";
17
+ } from "./chunk-ZO743PM4.js";
18
18
  import {
19
19
  AppServerProcess,
20
20
  buildCodexAgentEnv
21
- } from "./chunk-2XVJPLAN.js";
22
- import "./chunk-5SJ65PER.js";
21
+ } from "./chunk-ZU4LKGPE.js";
22
+ import "./chunk-6PUYLBEC.js";
23
23
  import {
24
24
  AGENT,
25
25
  OPENCODE_GO_PROVIDER,
@@ -29,7 +29,7 @@ import {
29
29
  headlessAgentUsagePath,
30
30
  isRecord,
31
31
  withTimeout
32
- } from "./chunk-V5AMWNUX.js";
32
+ } from "./chunk-FTWEDN3E.js";
33
33
  import "./chunk-VEQXQN22.js";
34
34
 
35
35
  // src/headless-agent.ts
package/dist/src/index.js CHANGED
@@ -1,6 +1,23 @@
1
1
  #!/usr/bin/env node
2
2
  import { createRequire as __createRequire } from 'node:module';
3
3
  const require = __createRequire(import.meta.url);
4
+ import {
5
+ cloneMcpConfig,
6
+ ensureCompatibilityImports,
7
+ getMcpDiscoverySummary,
8
+ getMcpStandardConfigSummary,
9
+ getServerProvenance,
10
+ getSharedConfigPath,
11
+ loadMcpConfig,
12
+ previewCompatibilityImports,
13
+ previewSharedServerEntry,
14
+ previewStarterSharedConfig,
15
+ resolveConfiguredOAuthDir,
16
+ writeDirectToolsConfig,
17
+ writeProjectServerDisabledOverride,
18
+ writeSharedServerEntry,
19
+ writeStarterSharedConfig
20
+ } from "./chunk-UU7DWQFZ.js";
4
21
  import {
5
22
  RESOURCE_MIME_TYPE,
6
23
  buildAllowAttribute,
@@ -23,11 +40,58 @@ import {
23
40
  serializeResources,
24
41
  serializeTools
25
42
  } from "./chunk-DYAYKYJO.js";
43
+ import {
44
+ MCP_STATUS_EVENT,
45
+ MCP_STATUS_SNAPSHOT_VERSION,
46
+ MCP_TOOL_APPROVAL_REQUEST_EVENT,
47
+ SERVER_STREAM_RESULT_PATCH_METHOD,
48
+ Text,
49
+ UI_STREAM_HOST_CONTEXT_KEY,
50
+ UI_STREAM_REQUEST_META_KEY,
51
+ UI_STREAM_STRUCTURED_CONTENT_KEY,
52
+ createToolSelectorCandidateIndex,
53
+ createUiModelContextUpdate,
54
+ extractToolUiStreamMode,
55
+ extractUiPromptText,
56
+ formatAuthRequiredMessage,
57
+ formatMcpStatus,
58
+ formatTerminalError,
59
+ formatToolName,
60
+ getAgentPath,
61
+ getAppClientUri,
62
+ getAppName,
63
+ getConfigPathFromArgv,
64
+ getServerPrefix,
65
+ getToolNameCandidates,
66
+ getVisualizationStreamEnvelope,
67
+ interpolateEnvRecord,
68
+ interpolateEnvVars,
69
+ isServerDisabled,
70
+ isToolAllowed,
71
+ matchesToolPattern,
72
+ normalizeDirectToolInputSchema,
73
+ normalizeToolArguments,
74
+ openPath,
75
+ openUrl,
76
+ parallelLimit,
77
+ parseUiPromptHandoff,
78
+ resolveBearerToken,
79
+ resolveCommandSecret,
80
+ resolveCommandSecretsRecord,
81
+ resolveConfigPath,
82
+ resolveServerUrl,
83
+ resolveToolPrefix,
84
+ sanitizeTerminalText,
85
+ serverStreamResultPatchNotificationSchema,
86
+ truncateAtWord,
87
+ truncateToWidth,
88
+ visibleWidth
89
+ } from "./chunk-244SUBHF.js";
26
90
  import {
27
91
  evaluateCommandProtection,
28
92
  extractToolCommand,
29
93
  reportCommandProtectionBlock
30
- } from "./chunk-HKOSS37G.js";
94
+ } from "./chunk-L6MNALHN.js";
31
95
  import {
32
96
  ACCOUNT_RATE_LIMITS_UPDATED_METHOD,
33
97
  AGENT_MESSAGE_DELTA_METHOD,
@@ -65,10 +129,10 @@ import {
65
129
  spawnMuseMsp,
66
130
  startMuseSession,
67
131
  uuidV7
68
- } from "./chunk-PWHJWO2J.js";
132
+ } from "./chunk-ZO743PM4.js";
69
133
  import {
70
134
  publishedPullRequestUrls
71
- } from "./chunk-BS7JLXOU.js";
135
+ } from "./chunk-BPPW25C3.js";
72
136
  import {
73
137
  ACCOUNT_RATE_LIMITS_READ_METHOD,
74
138
  AsyncLock,
@@ -113,6 +177,7 @@ import {
113
177
  clearCredentialFallbacks,
114
178
  codexTokenManager,
115
179
  configureManagedGitCredentialHelper,
180
+ engineScriptProcess,
116
181
  extractRateLimitsSnapshot,
117
182
  forgetExhaustedCredentials,
118
183
  formatTurnFailure,
@@ -147,7 +212,7 @@ import {
147
212
  transcriptSecrets,
148
213
  upsertCredentialFileLines,
149
214
  writeSecureCredentialFile
150
- } from "./chunk-FWC6IREY.js";
215
+ } from "./chunk-42YX6Z76.js";
151
216
  import {
152
217
  ENGINE_ENV,
153
218
  UNQUOTED_PATHS_CONFIG,
@@ -158,16 +223,16 @@ import {
158
223
  resolveDiffBase,
159
224
  setAgentCredentialSnapshot,
160
225
  setLinearSessionId
161
- } from "./chunk-C3PFZKXL.js";
226
+ } from "./chunk-LIIIKWEF.js";
162
227
  import {
163
228
  buildCodexAgentEnv,
164
229
  getCodexModelProvider
165
- } from "./chunk-2XVJPLAN.js";
230
+ } from "./chunk-ZU4LKGPE.js";
166
231
  import {
167
232
  SUBPROCESS_MAX_BUFFER,
168
233
  execAsync,
169
234
  execFileAsync
170
- } from "./chunk-5SJ65PER.js";
235
+ } from "./chunk-6PUYLBEC.js";
171
236
  import {
172
237
  isRecord as isRecord2
173
238
  } from "./chunk-UZSNFLDQ.js";
@@ -463,71 +528,7 @@ import {
463
528
  workspaceTokenRequestSchema,
464
529
  workspaceTokenResponseSchema,
465
530
  wrapInTag
466
- } from "./chunk-V5AMWNUX.js";
467
- import {
468
- cloneMcpConfig,
469
- ensureCompatibilityImports,
470
- getMcpDiscoverySummary,
471
- getMcpStandardConfigSummary,
472
- getServerProvenance,
473
- getSharedConfigPath,
474
- loadMcpConfig,
475
- previewCompatibilityImports,
476
- previewSharedServerEntry,
477
- previewStarterSharedConfig,
478
- resolveConfiguredOAuthDir,
479
- writeDirectToolsConfig,
480
- writeProjectServerDisabledOverride,
481
- writeSharedServerEntry,
482
- writeStarterSharedConfig
483
- } from "./chunk-UU7DWQFZ.js";
484
- import {
485
- MCP_STATUS_EVENT,
486
- MCP_STATUS_SNAPSHOT_VERSION,
487
- MCP_TOOL_APPROVAL_REQUEST_EVENT,
488
- SERVER_STREAM_RESULT_PATCH_METHOD,
489
- Text,
490
- UI_STREAM_HOST_CONTEXT_KEY,
491
- UI_STREAM_REQUEST_META_KEY,
492
- UI_STREAM_STRUCTURED_CONTENT_KEY,
493
- createToolSelectorCandidateIndex,
494
- createUiModelContextUpdate,
495
- extractToolUiStreamMode,
496
- extractUiPromptText,
497
- formatAuthRequiredMessage,
498
- formatMcpStatus,
499
- formatTerminalError,
500
- formatToolName,
501
- getAgentPath,
502
- getAppClientUri,
503
- getAppName,
504
- getConfigPathFromArgv,
505
- getServerPrefix,
506
- getToolNameCandidates,
507
- getVisualizationStreamEnvelope,
508
- interpolateEnvRecord,
509
- interpolateEnvVars,
510
- isServerDisabled,
511
- isToolAllowed,
512
- matchesToolPattern,
513
- normalizeDirectToolInputSchema,
514
- normalizeToolArguments,
515
- openPath,
516
- openUrl,
517
- parallelLimit,
518
- parseUiPromptHandoff,
519
- resolveBearerToken,
520
- resolveCommandSecret,
521
- resolveCommandSecretsRecord,
522
- resolveConfigPath,
523
- resolveServerUrl,
524
- resolveToolPrefix,
525
- sanitizeTerminalText,
526
- serverStreamResultPatchNotificationSchema,
527
- truncateAtWord,
528
- truncateToWidth,
529
- visibleWidth
530
- } from "./chunk-244SUBHF.js";
531
+ } from "./chunk-FTWEDN3E.js";
531
532
  import {
532
533
  __commonJS,
533
534
  __export,
@@ -18562,7 +18563,6 @@ var OpencodeManager = class extends CodingAgentManager {
18562
18563
  };
18563
18564
 
18564
18565
  // src/managers/pi-manager.ts
18565
- import { readFile as readFile11 } from "fs/promises";
18566
18566
  import { join as join22 } from "path";
18567
18567
  import {
18568
18568
  createAgentSession,
@@ -18572,6 +18572,20 @@ import {
18572
18572
  DefaultResourceLoader
18573
18573
  } from "@earendil-works/pi-coding-agent";
18574
18574
 
18575
+ // src/managers/managed-mcp-servers.ts
18576
+ import { readFile as readFile11 } from "fs/promises";
18577
+ async function getManagedPiMcpServers() {
18578
+ try {
18579
+ const parsed = JSON.parse(await readFile11(PI_MCP_CONFIG_PATH, "utf8"));
18580
+ if (!isRecord2(parsed) || !isRecord2(parsed.mcpServers)) return {};
18581
+ return Object.fromEntries(Object.entries(parsed.mcpServers).filter(
18582
+ (entry) => isRecord2(entry[1]) && (typeof entry[1].command === "string" || typeof entry[1].url === "string")
18583
+ ));
18584
+ } catch {
18585
+ return {};
18586
+ }
18587
+ }
18588
+
18575
18589
  // ../node_modules/.bun/typebox@1.3.7/node_modules/typebox/build/system/memory/memory.mjs
18576
18590
  var memory_exports = {};
18577
18591
  __export(memory_exports, {
@@ -49245,7 +49259,7 @@ async function openMcpPanel(state, pi, ctx, configOverridePath, onDirectToolsCon
49245
49259
  const { lines: noticeLines, fingerprint } = buildSharedConfigNoticeLines(configPath, ctx.cwd);
49246
49260
  let overlayHandle;
49247
49261
  const callbacks = buildMcpPanelCallbacks(state, config, ctx, () => overlayHandle);
49248
- const { createMcpPanel } = await import("./mcp-panel-H3TDJYHQ.js");
49262
+ const { createMcpPanel } = await import("./mcp-panel-KQREMMFT.js");
49249
49263
  let configChanged = false;
49250
49264
  await new Promise((resolve8) => {
49251
49265
  ctx.ui.custom(
@@ -49317,7 +49331,7 @@ async function openMcpAuthPanel(state, pi, ctx, configOverridePath) {
49317
49331
  const provenanceMap = getServerProvenance(configPath, ctx.cwd);
49318
49332
  let overlayHandle;
49319
49333
  const callbacks = buildMcpPanelCallbacks(state, config, ctx, () => overlayHandle);
49320
- const { createMcpPanel } = await import("./mcp-panel-H3TDJYHQ.js");
49334
+ const { createMcpPanel } = await import("./mcp-panel-KQREMMFT.js");
49321
49335
  await new Promise((resolve8) => {
49322
49336
  ctx.ui.custom(
49323
49337
  (tui, _theme, keybindings, done) => {
@@ -59328,17 +59342,6 @@ function createMcpAdapter(options = {}) {
59328
59342
  var pi_mcp_adapter_default = createMcpAdapter();
59329
59343
 
59330
59344
  // src/managers/pi-manager.ts
59331
- async function getManagedPiMcpServers() {
59332
- try {
59333
- const parsed = JSON.parse(await readFile11(PI_MCP_CONFIG_PATH, "utf8"));
59334
- if (!isRecord2(parsed) || !isRecord2(parsed.mcpServers)) return {};
59335
- return Object.fromEntries(Object.entries(parsed.mcpServers).filter(
59336
- (entry) => isRecord2(entry[1]) && (typeof entry[1].command === "string" || typeof entry[1].url === "string")
59337
- ));
59338
- } catch {
59339
- return {};
59340
- }
59341
- }
59342
59345
  function registerOpenRouterModels(modelRegistry, apiKey, modelIds) {
59343
59346
  const openRouterModels = modelRegistry.getAll().filter((model) => model.provider === "openrouter");
59344
59347
  const modelTemplate = openRouterModels[0];
@@ -65795,6 +65798,13 @@ var ManagedProcess = class {
65795
65798
  if (this.listeners.delete(listener) && this.listeners.size === 0) this.armIdleTimer();
65796
65799
  };
65797
65800
  }
65801
+ input(data, end) {
65802
+ const stdin = this.child.stdin;
65803
+ if (this.exit || stdin.writableEnded) return false;
65804
+ if (data.length > 0) stdin.write(data);
65805
+ if (end) stdin.end();
65806
+ return true;
65807
+ }
65798
65808
  kill(reason) {
65799
65809
  if (this.exit) return;
65800
65810
  this.killReason ??= reason;
@@ -65821,8 +65831,11 @@ var ProcessRegistry = class {
65821
65831
  cwd: options.cwd,
65822
65832
  env: { ...buildCodexAgentEnv(), ...options.env },
65823
65833
  detached: true,
65824
- stdio: ["ignore", "pipe", "pipe"]
65834
+ stdio: ["pipe", "pipe", "pipe"]
65825
65835
  });
65836
+ child.stdin.on("error", () => {
65837
+ });
65838
+ if (!options.stdin) child.stdin.end();
65826
65839
  return new Promise((resolve8) => {
65827
65840
  child.once("error", (error) => resolve8(createErrorResult({ code: "spawn_error", message: error.message })));
65828
65841
  child.once("spawn", () => {
@@ -65873,7 +65886,9 @@ var schemas = {
65873
65886
  attach: z7.object({ processId: z7.string(), offset: z7.number().int().nonnegative().optional() }),
65874
65887
  kill: z7.object({ processId: z7.string() }),
65875
65888
  killThread: z7.object({ threadId: z7.string().min(1) }),
65876
- list: z7.object({ threadId: z7.string().optional() })
65889
+ list: z7.object({ threadId: z7.string().optional() }),
65890
+ input: z7.object({ processId: z7.string(), end: z7.boolean().optional() }),
65891
+ mcpServers: z7.object({})
65877
65892
  };
65878
65893
  var ExecError = class extends Error {
65879
65894
  constructor(code, message, path8) {
@@ -65893,6 +65908,13 @@ function resolvePath(target) {
65893
65908
  if (target === "~" || target.startsWith("~/")) return join36(ENGINE_ENV.HOME_DIR, target.slice(1));
65894
65909
  return resolve6(ENGINE_ENV.WORKSPACE_ROOT, target);
65895
65910
  }
65911
+ async function mcpServerProcess(name) {
65912
+ const entry = (await getManagedPiMcpServers())[name];
65913
+ if (!entry) throw new ExecError("ENOENT", `No MCP server named ${name}`);
65914
+ if (entry.command) return { file: entry.command, args: entry.args ?? [], env: entry.env };
65915
+ const bridge = engineScriptProcess("mcp-http-bridge", []);
65916
+ return { file: bridge.command, args: bridge.args, env: { REPLICAS_MCP_URL: entry.url ?? "", REPLICAS_MCP_HEADERS: JSON.stringify(entry.headers ?? {}) } };
65917
+ }
65896
65918
  function toErrorBody(error) {
65897
65919
  if (error instanceof ExecError) return { code: error.code, message: error.message, path: error.path };
65898
65920
  if (!(error instanceof Error)) return { code: "unknown", message: String(error) };
@@ -66001,7 +66023,8 @@ function attachExecSocket(socket) {
66001
66023
  const cwd = resolvePath(request.cwd ?? ".");
66002
66024
  if (!(await stat6(cwd).catch(() => null))?.isDirectory()) throw new ExecError("ENOENT", `Working directory not found: ${cwd}`, cwd);
66003
66025
  const [file, ...args] = request.argv ?? ["/bin/bash", request.login === false ? "-c" : "-lc", request.command ?? ""];
66004
- const spawned = await processRegistry.spawn({ ...request, file, args, command: request.command ?? args.join(" "), cwd });
66026
+ const target = request.mcpServer ? { ...await mcpServerProcess(request.mcpServer), command: `mcp ${request.mcpServer}` } : { file, args, command: request.command ?? args.join(" ") };
66027
+ const spawned = await processRegistry.spawn({ ...request, ...target, cwd });
66005
66028
  if (!spawned.ok) throw new ExecError("spawn_error", spawned.error.message);
66006
66029
  sendEvent(id, { kind: "started", processId: spawned.data.id, pid: spawned.data.pid });
66007
66030
  follow(id, spawned.data.id, 0, () => spawned.data.kill("killed"));
@@ -66023,7 +66046,18 @@ function attachExecSocket(socket) {
66023
66046
  return {};
66024
66047
  },
66025
66048
  killThread: async (_id, json) => ({ killed: processRegistry.killThread(parse(schemas.killThread, json).threadId) }),
66026
- list: async (_id, json) => ({ processes: processRegistry.list(parse(schemas.list, json).threadId) })
66049
+ list: async (_id, json) => ({ processes: processRegistry.list(parse(schemas.list, json).threadId) }),
66050
+ // Synchronous up to the write, so inputs reach stdin in the order they arrive.
66051
+ input: async (_id, json, payload) => {
66052
+ const { processId, end = false } = parse(schemas.input, json);
66053
+ if (!processRegistry.get(processId)?.input(payload, end)) throw new ExecError("ESRCH", `No running process ${processId} with open stdin`);
66054
+ return {};
66055
+ },
66056
+ mcpServers: async (_id, json) => {
66057
+ parse(schemas.mcpServers, json);
66058
+ const servers = Object.entries(await getManagedPiMcpServers());
66059
+ return { servers: servers.map(([name, entry]) => ({ name, ...entry.requestTimeoutMs ? { timeoutMs: entry.requestTimeoutMs } : {} })) };
66060
+ }
66027
66061
  };
66028
66062
  socket.on("message", (raw, isBinary) => {
66029
66063
  lastHeard = Date.now();
@@ -66557,7 +66591,8 @@ app.get("/health", async (c) => {
66557
66591
  startup: {
66558
66592
  elapsedMs: performance.now() - startupStartedAt,
66559
66593
  steps: startupTimings
66560
- }
66594
+ },
66595
+ execProtocol: EXEC_PROTOCOL_VERSION
66561
66596
  };
66562
66597
  return c.json(response, lifecycle.active ? 200 : 503);
66563
66598
  });
@@ -0,0 +1,53 @@
1
+ #!/usr/bin/env node
2
+ import { createRequire as __createRequire } from 'node:module';
3
+ const require = __createRequire(import.meta.url);
4
+
5
+ // src/mcp-http-bridge.ts
6
+ import { SSEClientTransport } from "@modelcontextprotocol/sdk/client/sse.js";
7
+ import { StreamableHTTPClientTransport } from "@modelcontextprotocol/sdk/client/streamableHttp.js";
8
+ import { ReadBuffer, serializeMessage } from "@modelcontextprotocol/sdk/shared/stdio.js";
9
+ import { isJSONRPCRequest } from "@modelcontextprotocol/sdk/types.js";
10
+ import { z } from "zod";
11
+ if (!process.env.REPLICAS_MCP_URL) throw new Error("REPLICAS_MCP_URL is required");
12
+ var url = new URL(process.env.REPLICAS_MCP_URL);
13
+ var headers = z.record(z.string(), z.string()).parse(JSON.parse(process.env.REPLICAS_MCP_HEADERS ?? "{}"));
14
+ var write = (message) => process.stdout.write(serializeMessage(message));
15
+ async function open(kind) {
16
+ const opened = kind === "streamable" ? new StreamableHTTPClientTransport(url, { requestInit: { headers } }) : new SSEClientTransport(url, { requestInit: { headers }, eventSourceInit: { fetch: (input, init) => fetch(input, { ...init, headers: { ...headers, ...init?.headers } }) } });
17
+ opened.onmessage = (message) => {
18
+ if ("result" in message && typeof message.result.protocolVersion === "string") opened.setProtocolVersion?.(message.result.protocolVersion);
19
+ write(message);
20
+ };
21
+ opened.onerror = (error) => process.stderr.write(`${error.message}
22
+ `);
23
+ opened.onclose = () => process.exit(0);
24
+ await opened.start();
25
+ return opened;
26
+ }
27
+ var transport = await open("streamable");
28
+ var first = null;
29
+ function send(message) {
30
+ if (first) return first.catch(() => {
31
+ }).then(() => transport.send(message));
32
+ first = transport.send(message).catch(async () => {
33
+ transport.onclose = void 0;
34
+ await transport.close();
35
+ transport = await open("sse");
36
+ await transport.send(message);
37
+ });
38
+ return first;
39
+ }
40
+ var buffer = new ReadBuffer();
41
+ process.stdin.on("data", (chunk) => {
42
+ buffer.append(chunk);
43
+ for (let message = buffer.readMessage(); message; message = buffer.readMessage()) {
44
+ const sent = message;
45
+ send(sent).catch((error) => {
46
+ const text = error instanceof Error ? error.message : String(error);
47
+ if (isJSONRPCRequest(sent)) write({ jsonrpc: "2.0", id: sent.id, error: { code: -32e3, message: text } });
48
+ else process.stderr.write(`${text}
49
+ `);
50
+ });
51
+ }
52
+ });
53
+ process.stdin.on("end", () => void transport.close());
@@ -3,13 +3,13 @@ import { createRequire as __createRequire } from 'node:module';
3
3
  const require = __createRequire(import.meta.url);
4
4
  import {
5
5
  publishedPullRequestUrls
6
- } from "./chunk-BS7JLXOU.js";
6
+ } from "./chunk-BPPW25C3.js";
7
7
  import {
8
8
  isRecord
9
9
  } from "./chunk-UZSNFLDQ.js";
10
10
  import {
11
11
  shouldRefreshPullRequests
12
- } from "./chunk-V5AMWNUX.js";
12
+ } from "./chunk-FTWEDN3E.js";
13
13
  import "./chunk-VEQXQN22.js";
14
14
 
15
15
  // src/services/post-tool-pr-notifier.ts
@@ -11,7 +11,7 @@ import {
11
11
  spawnSubagentRequestSchema,
12
12
  subagentResponseSchema,
13
13
  waitSubagentRequestSchema
14
- } from "./chunk-V5AMWNUX.js";
14
+ } from "./chunk-FTWEDN3E.js";
15
15
  import "./chunk-VEQXQN22.js";
16
16
 
17
17
  // src/subagent-mcp.ts
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "replicas-engine",
3
- "version": "0.1.1606",
3
+ "version": "0.1.1610",
4
4
  "description": "Lightweight API server for Replicas workspaces",
5
5
  "type": "module",
6
6
  "main": "dist/src/index.js",
@@ -1,14 +1,14 @@
1
1
  #!/usr/bin/env node
2
2
  import { createRequire as __createRequire } from 'node:module';
3
3
  const require = __createRequire(import.meta.url);
4
+ import {
5
+ createPanelKeys
6
+ } from "./chunk-Z5DK3VRN.js";
4
7
  import {
5
8
  isServerCacheValid,
6
9
  isUiToolVisibleToModel,
7
10
  resourceNameToToolName
8
11
  } from "./chunk-DYAYKYJO.js";
9
- import {
10
- createPanelKeys
11
- } from "./chunk-Z5DK3VRN.js";
12
12
  import {
13
13
  getToolNameCandidates,
14
14
  isServerDisabled,