replicas-engine 0.1.747 → 0.1.750

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.
@@ -1,11 +1,11 @@
1
1
  #!/usr/bin/env node
2
2
  import {
3
3
  notifyPostToolUse
4
- } from "./chunk-ZNKNSUIJ.js";
4
+ } from "./chunk-VZR2BGSF.js";
5
5
  import {
6
6
  isRecord
7
7
  } from "./chunk-2RB7SIP3.js";
8
- import "./chunk-HMIVYASC.js";
8
+ import "./chunk-MNVK5OPD.js";
9
9
  import "./chunk-5KSXSK7Y.js";
10
10
 
11
11
  // src/post-tool-pr-hook.ts
@@ -0,0 +1,92 @@
1
+ #!/usr/bin/env node
2
+ import {
3
+ messageRelaySubagentRequestSchema,
4
+ spawnRelaySubagentRequestSchema
5
+ } from "./chunk-MNVK5OPD.js";
6
+ import "./chunk-5KSXSK7Y.js";
7
+
8
+ // src/relay-mcp.ts
9
+ import { parseArgs } from "util";
10
+ import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
11
+ import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
12
+ import { z } from "zod";
13
+ var { values } = parseArgs({
14
+ options: { parent: { type: "string" } },
15
+ strict: true
16
+ });
17
+ var parentChatId = values.parent;
18
+ var port = process.env.REPLICAS_ENGINE_PORT;
19
+ var secret = process.env.REPLICAS_ENGINE_SECRET;
20
+ if (!parentChatId) throw new Error("--parent is required");
21
+ if (!port || !secret) throw new Error("Replicas engine environment is unavailable");
22
+ var enginePort = port;
23
+ var engineSecret = secret;
24
+ async function request(path, method, body) {
25
+ const response = await fetch(`http://localhost:${enginePort}${path}`, {
26
+ method,
27
+ headers: {
28
+ "Content-Type": "application/json",
29
+ "X-Replicas-Engine-Secret": engineSecret
30
+ },
31
+ body: body === void 0 ? void 0 : JSON.stringify(body)
32
+ });
33
+ const text = await response.text();
34
+ if (!response.ok) throw new Error(text || `Relay request failed (${response.status})`);
35
+ return text || JSON.stringify({ success: true });
36
+ }
37
+ var server = new McpServer({ name: "replicas-relay", version: "1.0.0" });
38
+ server.registerTool("get_providers", {
39
+ description: "List the agent providers Relay is allowed to use and the configured Relay base provider."
40
+ }, async () => ({
41
+ content: [{ type: "text", text: await request(`/chats/${parentChatId}/subagents`, "GET") }]
42
+ }));
43
+ server.registerTool("spawn_agent", {
44
+ description: "Spawn a child agent with a fresh context, wait for it to finish, and return its chat ID and final response.",
45
+ inputSchema: {
46
+ provider: spawnRelaySubagentRequestSchema.shape.provider.describe("Provider returned by get_providers."),
47
+ prompt: spawnRelaySubagentRequestSchema.shape.prompt.describe("Complete task instructions; the child has no parent conversation context."),
48
+ model: spawnRelaySubagentRequestSchema.shape.model,
49
+ thinking_level: spawnRelaySubagentRequestSchema.shape.thinkingLevel,
50
+ title: spawnRelaySubagentRequestSchema.shape.title,
51
+ timeout_minutes: spawnRelaySubagentRequestSchema.shape.timeoutMinutes
52
+ }
53
+ }, async ({ provider, prompt, model, thinking_level, title, timeout_minutes }) => ({
54
+ content: [{
55
+ type: "text",
56
+ text: await request(`/chats/${parentChatId}/subagents`, "POST", {
57
+ provider,
58
+ prompt,
59
+ ...model ? { model } : {},
60
+ ...thinking_level ? { thinkingLevel: thinking_level } : {},
61
+ ...title ? { title } : {},
62
+ ...timeout_minutes ? { timeoutMinutes: timeout_minutes } : {}
63
+ })
64
+ }]
65
+ }));
66
+ server.registerTool("message_agent", {
67
+ description: "Send a follow-up to one of this Relay chat\u2019s child agents, wait for it to finish, and return its final response.",
68
+ inputSchema: {
69
+ chat_id: z.string().uuid(),
70
+ message: messageRelaySubagentRequestSchema.shape.message,
71
+ model: messageRelaySubagentRequestSchema.shape.model,
72
+ thinking_level: messageRelaySubagentRequestSchema.shape.thinkingLevel,
73
+ timeout_minutes: messageRelaySubagentRequestSchema.shape.timeoutMinutes
74
+ }
75
+ }, async ({ chat_id, message, model, thinking_level, timeout_minutes }) => ({
76
+ content: [{
77
+ type: "text",
78
+ text: await request(`/chats/${parentChatId}/subagents/${chat_id}/messages`, "POST", {
79
+ message,
80
+ ...model ? { model } : {},
81
+ ...thinking_level ? { thinkingLevel: thinking_level } : {},
82
+ ...timeout_minutes ? { timeoutMinutes: timeout_minutes } : {}
83
+ })
84
+ }]
85
+ }));
86
+ server.registerTool("delete_agent", {
87
+ description: "Delete one of this Relay chat\u2019s child agents.",
88
+ inputSchema: { chat_id: z.string().uuid() }
89
+ }, async ({ chat_id }) => ({
90
+ content: [{ type: "text", text: await request(`/chats/${parentChatId}/subagents/${chat_id}`, "DELETE") }]
91
+ }));
92
+ await server.connect(new StdioServerTransport());
package/package.json CHANGED
@@ -1,11 +1,12 @@
1
1
  {
2
2
  "name": "replicas-engine",
3
- "version": "0.1.747",
3
+ "version": "0.1.750",
4
4
  "description": "Lightweight API server for Replicas workspaces",
5
5
  "type": "module",
6
6
  "main": "dist/src/index.js",
7
7
  "bin": {
8
8
  "replicas-engine": "./dist/src/index.js",
9
+ "replicas-relay-mcp": "./dist/src/relay-mcp.js",
9
10
  "replicas-headless-agent": "./dist/src/headless-agent.js",
10
11
  "replicas-command-protection-hook": "./dist/src/command-protection-hook.js",
11
12
  "replicas-post-tool-pr-hook": "./dist/src/post-tool-pr-hook.js",
@@ -48,6 +49,7 @@
48
49
  "@earendil-works/pi-coding-agent": "0.85.0",
49
50
  "@earendil-works/pi-server": "0.85.0",
50
51
  "@hono/node-server": "^1.19.5",
52
+ "@modelcontextprotocol/sdk": "^1.29.0",
51
53
  "@opencode-ai/sdk": "1.17.9",
52
54
  "bash-language-server": "^5.6.0",
53
55
  "dockerfile-language-server-nodejs": "^0.14.1",
@@ -1,12 +1,12 @@
1
1
  #!/usr/bin/env node
2
+ import {
3
+ createPanelKeys
4
+ } from "./chunk-SFWEF25L.js";
2
5
  import {
3
6
  isServerCacheValid,
4
7
  isUiToolVisibleToModel,
5
8
  resourceNameToToolName
6
9
  } from "./chunk-Y6VZZNT3.js";
7
- import {
8
- createPanelKeys
9
- } from "./chunk-SFWEF25L.js";
10
10
  import {
11
11
  getToolNameCandidates,
12
12
  isServerDisabled,