replicas-engine 0.1.471 → 0.1.472
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.
- package/dist/src/index.js +127 -77
- package/package.json +1 -1
package/dist/src/index.js
CHANGED
|
@@ -582,7 +582,7 @@ var WORKSPACE_SIZES = ["small", "large"];
|
|
|
582
582
|
var INVALID_WORKSPACE_SIZE_ERROR = `Invalid size: must be one of ${WORKSPACE_SIZES.join(", ")}`;
|
|
583
583
|
|
|
584
584
|
// ../shared/src/e2b.ts
|
|
585
|
-
var E2B_TEMPLATE_NAME = "replicas-sandbox-2026-07-21-
|
|
585
|
+
var E2B_TEMPLATE_NAME = "replicas-sandbox-2026-07-21-v2";
|
|
586
586
|
|
|
587
587
|
// ../shared/src/runtime-env.ts
|
|
588
588
|
function shellQuotePosix(value) {
|
|
@@ -2809,6 +2809,44 @@ var createChatRequestSchema = z2.object({
|
|
|
2809
2809
|
parentChatId: z2.string().uuid().optional(),
|
|
2810
2810
|
clientRequestId: z2.string().min(1).max(128).optional()
|
|
2811
2811
|
});
|
|
2812
|
+
var sendChatMessageRequestSchema = z2.object({
|
|
2813
|
+
messageId: z2.string().optional(),
|
|
2814
|
+
submittedAt: z2.string().optional(),
|
|
2815
|
+
message: z2.string(),
|
|
2816
|
+
model: z2.string().optional(),
|
|
2817
|
+
customInstructions: z2.string().optional(),
|
|
2818
|
+
planMode: z2.boolean().optional(),
|
|
2819
|
+
images: z2.array(z2.object({
|
|
2820
|
+
type: z2.literal("image"),
|
|
2821
|
+
source: z2.discriminatedUnion("type", [
|
|
2822
|
+
z2.object({ type: z2.literal("base64"), media_type: z2.enum(IMAGE_MEDIA_TYPES), data: z2.string() }),
|
|
2823
|
+
z2.object({ type: z2.literal("url"), url: z2.string() })
|
|
2824
|
+
])
|
|
2825
|
+
})).optional(),
|
|
2826
|
+
thinkingLevel: z2.enum(VALID_THINKING_LEVELS).optional(),
|
|
2827
|
+
goalMode: z2.boolean().optional(),
|
|
2828
|
+
fastMode: z2.boolean().optional(),
|
|
2829
|
+
enableInteractiveTools: z2.boolean().optional(),
|
|
2830
|
+
type: z2.string().optional(),
|
|
2831
|
+
merge: z2.boolean().optional(),
|
|
2832
|
+
idempotencyKey: z2.string().optional(),
|
|
2833
|
+
senderUserId: z2.string().optional(),
|
|
2834
|
+
senderEmail: z2.string().optional(),
|
|
2835
|
+
senderDisplayName: z2.string().optional(),
|
|
2836
|
+
senderAvatarUrl: z2.string().optional(),
|
|
2837
|
+
errorNotificationTarget: z2.discriminatedUnion("type", [
|
|
2838
|
+
z2.object({ type: z2.literal("slack") }),
|
|
2839
|
+
z2.object({ type: z2.literal("linear"), sessionId: z2.string() }),
|
|
2840
|
+
z2.object({
|
|
2841
|
+
type: z2.literal("code_host"),
|
|
2842
|
+
provider: z2.enum(["github", "gitlab"]),
|
|
2843
|
+
resource: z2.enum(["issue", "pull_request"]),
|
|
2844
|
+
repositoryId: z2.string(),
|
|
2845
|
+
resourceNumber: z2.number()
|
|
2846
|
+
}),
|
|
2847
|
+
z2.object({ type: z2.literal("automation"), executionId: z2.string() })
|
|
2848
|
+
]).optional()
|
|
2849
|
+
}).passthrough();
|
|
2812
2850
|
function normalizeCodexAspTranscriptStatus(status, failed = false) {
|
|
2813
2851
|
if (failed || status === "failed" || status === "declined") return "failed";
|
|
2814
2852
|
if (status === "completed") return "completed";
|
|
@@ -3137,6 +3175,18 @@ var DEFAULT_WORKSPACE_FILTERS = {
|
|
|
3137
3175
|
};
|
|
3138
3176
|
var ONE_DAY_MS = 24 * 60 * 60 * 1e3;
|
|
3139
3177
|
|
|
3178
|
+
// ../shared/src/routes/workspace-events.ts
|
|
3179
|
+
import { z as z3 } from "zod";
|
|
3180
|
+
var workspaceChangedEventSchema = z3.discriminatedUnion("type", [
|
|
3181
|
+
z3.object({ type: z3.literal("workspace.changed"), workspaceId: z3.string(), ts: z3.string() }),
|
|
3182
|
+
z3.object({
|
|
3183
|
+
type: z3.literal("workspace.chat.changed"),
|
|
3184
|
+
workspaceId: z3.string(),
|
|
3185
|
+
chatId: z3.string(),
|
|
3186
|
+
ts: z3.string()
|
|
3187
|
+
})
|
|
3188
|
+
]);
|
|
3189
|
+
|
|
3140
3190
|
// ../shared/src/audit-log.ts
|
|
3141
3191
|
var AUDIT_LOG_ACTION = {
|
|
3142
3192
|
CREATE: "create",
|
|
@@ -9832,7 +9882,7 @@ var DEFAULT_CODEX_ARGS = ["app-server", "--listen", "stdio://"];
|
|
|
9832
9882
|
var MIN_CODEX_CLI_VERSION = "0.144.6";
|
|
9833
9883
|
var CODEX_UPGRADE_TIMEOUT_MS = 12e4;
|
|
9834
9884
|
var codexCliVersionEnsured = null;
|
|
9835
|
-
var ENGINE_PACKAGE_VERSION = "0.1.
|
|
9885
|
+
var ENGINE_PACKAGE_VERSION = "0.1.472";
|
|
9836
9886
|
var INITIALIZE_METHOD = "initialize";
|
|
9837
9887
|
var INITIALIZED_NOTIFICATION = "initialized";
|
|
9838
9888
|
var ACCOUNT_LOGIN_START_METHOD = "account/login/start";
|
|
@@ -12371,7 +12421,7 @@ import { delimiter, dirname as dirname6, join as join18 } from "path";
|
|
|
12371
12421
|
import { randomBytes as randomBytes2 } from "crypto";
|
|
12372
12422
|
import { fileURLToPath } from "url";
|
|
12373
12423
|
import { Agent } from "undici";
|
|
12374
|
-
import { z as
|
|
12424
|
+
import { z as z4 } from "zod";
|
|
12375
12425
|
import {
|
|
12376
12426
|
createOpencodeClient,
|
|
12377
12427
|
createOpencodeServer
|
|
@@ -12408,9 +12458,9 @@ var OPENCODE_VARIANT_CANDIDATES_BY_THINKING_LEVEL = {
|
|
|
12408
12458
|
ultra: ["max", "xhigh", "high"],
|
|
12409
12459
|
ultracode: ["max", "xhigh", "high"]
|
|
12410
12460
|
};
|
|
12411
|
-
var opencodeAuthSchema =
|
|
12412
|
-
type:
|
|
12413
|
-
key:
|
|
12461
|
+
var opencodeAuthSchema = z4.record(z4.string(), z4.object({
|
|
12462
|
+
type: z4.string().optional(),
|
|
12463
|
+
key: z4.string().optional()
|
|
12414
12464
|
}));
|
|
12415
12465
|
async function hasOpenCodeGoCredentials() {
|
|
12416
12466
|
if (!existsSync7(OPENCODE_AUTH_PATH2)) return false;
|
|
@@ -13255,7 +13305,7 @@ var PiManager = class extends CodingAgentManager {
|
|
|
13255
13305
|
|
|
13256
13306
|
// src/managers/relay-tools.ts
|
|
13257
13307
|
import { createSdkMcpServer, tool } from "@anthropic-ai/claude-agent-sdk";
|
|
13258
|
-
import { z as
|
|
13308
|
+
import { z as z5 } from "zod";
|
|
13259
13309
|
|
|
13260
13310
|
// src/managers/relay-providers.ts
|
|
13261
13311
|
function isRelaySubagentProviderAllowed(provider, allowedProviders) {
|
|
@@ -13370,7 +13420,7 @@ function buildSpawnAgentTool(parentChatId, availability = {}, getAllowedProvider
|
|
|
13370
13420
|
const cursorAvailable = availability.cursorAvailable ?? false;
|
|
13371
13421
|
const opencodeAvailable = availability.opencodeAvailable ?? false;
|
|
13372
13422
|
const availableProviders = getAvailableRelayProviders(availability);
|
|
13373
|
-
const providerEnum =
|
|
13423
|
+
const providerEnum = z5.enum(availableProviders);
|
|
13374
13424
|
const codeProviders = getAvailableCodeProviders(availability);
|
|
13375
13425
|
const providerDesc = codeProviders.length > 0 ? `Which agent to use. Prefer ${codeProviders.join(" or ")} for code writing, claude for exploration/analysis, relay for complex multi-step orchestration.` : "Which agent to use. Use claude for code writing, exploration, and analysis. Use relay for complex multi-step orchestration.";
|
|
13376
13426
|
const useCases = codeProviders.length > 0 ? `- Complex code writing tasks (use provider '${codeProviders.join("' or '")}' with a capable model)
|
|
@@ -13389,18 +13439,18 @@ The tool blocks until the subagent completes and returns its final response.
|
|
|
13389
13439
|
You will also receive the chatId so you can send follow-up messages or clean up the chat.`,
|
|
13390
13440
|
{
|
|
13391
13441
|
provider: providerEnum.describe(providerDesc),
|
|
13392
|
-
prompt:
|
|
13393
|
-
model:
|
|
13442
|
+
prompt: z5.string().describe("The full prompt/instructions for the subagent. Be detailed - it has no context from your conversation."),
|
|
13443
|
+
model: z5.string().optional().describe([
|
|
13394
13444
|
`Model override. Claude: ${AGENT_MODELS.claude.join(", ")} (opus is the default; sonnet is faster).`,
|
|
13395
13445
|
codexAvailable ? `Codex: ${AGENT_MODELS.codex.join(", ")}.` : null,
|
|
13396
13446
|
cursorAvailable ? `Cursor: ${AGENT_MODELS.cursor.join(", ")}.` : null,
|
|
13397
13447
|
opencodeAvailable ? `Opencode: ${AGENT_MODELS.opencode.join(", ")}.` : null
|
|
13398
13448
|
].filter(Boolean).join(" ")),
|
|
13399
|
-
thinking_level:
|
|
13449
|
+
thinking_level: z5.enum(VALID_THINKING_LEVELS).optional().describe(
|
|
13400
13450
|
"Controls how much thinking/reasoning the subagent applies. low = light thinking, medium = moderate, high = deep reasoning, xhigh = extended effort, max = maximum effort, ultra = Codex ultra, ultracode = Claude Code dynamic workflows. Defaults: Claude = high, Codex = medium, Cursor = medium, Opencode = medium."
|
|
13401
13451
|
),
|
|
13402
|
-
title:
|
|
13403
|
-
timeout_minutes:
|
|
13452
|
+
title: z5.string().optional().describe("Optional title for the subagent chat (for identification)."),
|
|
13453
|
+
timeout_minutes: z5.number().positive().optional().describe("Timeout in minutes for the subagent to complete (default: 10). Set higher for large tasks to avoid losing work.")
|
|
13404
13454
|
},
|
|
13405
13455
|
async (args) => {
|
|
13406
13456
|
try {
|
|
@@ -13475,13 +13525,13 @@ var messageAgentTool = tool(
|
|
|
13475
13525
|
|
|
13476
13526
|
The tool blocks until the subagent completes and returns its response.`,
|
|
13477
13527
|
{
|
|
13478
|
-
chatId:
|
|
13479
|
-
message:
|
|
13480
|
-
model:
|
|
13481
|
-
thinking_level:
|
|
13528
|
+
chatId: z5.string().describe("The chat ID of the subagent (returned by spawn_agent)."),
|
|
13529
|
+
message: z5.string().describe("The follow-up message to send."),
|
|
13530
|
+
model: z5.string().optional().describe("Optional model override for this message."),
|
|
13531
|
+
thinking_level: z5.enum(VALID_THINKING_LEVELS).optional().describe(
|
|
13482
13532
|
"Controls how much thinking/reasoning the subagent applies. low = light thinking, medium = moderate, high = deep reasoning, xhigh = extended effort, max = maximum effort, ultra = Codex ultra, ultracode = Claude Code dynamic workflows. Defaults: Claude = high, Codex = medium, Cursor = medium, Opencode = medium."
|
|
13483
13533
|
),
|
|
13484
|
-
timeout_minutes:
|
|
13534
|
+
timeout_minutes: z5.number().positive().optional().describe("Timeout in minutes for the subagent to complete (default: 10). Set higher for large tasks to avoid losing work.")
|
|
13485
13535
|
},
|
|
13486
13536
|
async (args) => {
|
|
13487
13537
|
try {
|
|
@@ -13519,7 +13569,7 @@ var deleteAgentTool = tool(
|
|
|
13519
13569
|
"delete_agent",
|
|
13520
13570
|
`Delete a subagent chat to free resources. Use this after a subagent has completed its work and you no longer need to send it follow-up messages.`,
|
|
13521
13571
|
{
|
|
13522
|
-
chatId:
|
|
13572
|
+
chatId: z5.string().describe("The chat ID of the subagent to delete.")
|
|
13523
13573
|
},
|
|
13524
13574
|
async (args) => {
|
|
13525
13575
|
try {
|
|
@@ -15345,7 +15395,7 @@ var RepoFileService = class {
|
|
|
15345
15395
|
|
|
15346
15396
|
// src/v1-routes.ts
|
|
15347
15397
|
import { Hono } from "hono";
|
|
15348
|
-
import { z as
|
|
15398
|
+
import { z as z6 } from "zod";
|
|
15349
15399
|
import { readdir as readdir9, stat as stat5, readFile as readFile18 } from "fs/promises";
|
|
15350
15400
|
import { join as join26, resolve as resolve3 } from "path";
|
|
15351
15401
|
|
|
@@ -15853,75 +15903,75 @@ var TerminalService = class {
|
|
|
15853
15903
|
var terminalService = new TerminalService();
|
|
15854
15904
|
|
|
15855
15905
|
// src/v1-routes.ts
|
|
15856
|
-
var setWorkspaceNameSchema =
|
|
15857
|
-
name:
|
|
15906
|
+
var setWorkspaceNameSchema = z6.object({
|
|
15907
|
+
name: z6.string().min(1).max(48)
|
|
15858
15908
|
});
|
|
15859
|
-
var imageMediaTypeSchema =
|
|
15860
|
-
var createPreviewSchema =
|
|
15861
|
-
port:
|
|
15862
|
-
publicUrl:
|
|
15909
|
+
var imageMediaTypeSchema = z6.enum(IMAGE_MEDIA_TYPES);
|
|
15910
|
+
var createPreviewSchema = z6.object({
|
|
15911
|
+
port: z6.number().int().min(1).max(65535),
|
|
15912
|
+
publicUrl: z6.string().min(1)
|
|
15863
15913
|
});
|
|
15864
|
-
var terminalSizeSchema =
|
|
15865
|
-
cols:
|
|
15866
|
-
rows:
|
|
15914
|
+
var terminalSizeSchema = z6.object({
|
|
15915
|
+
cols: z6.number().int().min(2).max(500),
|
|
15916
|
+
rows: z6.number().int().min(1).max(200)
|
|
15867
15917
|
});
|
|
15868
|
-
var writeTerminalSessionSchema =
|
|
15869
|
-
data:
|
|
15870
|
-
generation:
|
|
15871
|
-
sequence:
|
|
15918
|
+
var writeTerminalSessionSchema = z6.object({
|
|
15919
|
+
data: z6.string().max(64 * 1024),
|
|
15920
|
+
generation: z6.number().int().nonnegative(),
|
|
15921
|
+
sequence: z6.number().int().nonnegative()
|
|
15872
15922
|
});
|
|
15873
|
-
var sendMessageSchema =
|
|
15874
|
-
messageId:
|
|
15875
|
-
submittedAt:
|
|
15876
|
-
message:
|
|
15877
|
-
model:
|
|
15878
|
-
customInstructions:
|
|
15879
|
-
planMode:
|
|
15880
|
-
images:
|
|
15881
|
-
type:
|
|
15882
|
-
source:
|
|
15883
|
-
|
|
15884
|
-
type:
|
|
15923
|
+
var sendMessageSchema = z6.object({
|
|
15924
|
+
messageId: z6.string().min(1).optional(),
|
|
15925
|
+
submittedAt: z6.string().datetime().optional(),
|
|
15926
|
+
message: z6.string().min(1),
|
|
15927
|
+
model: z6.string().optional(),
|
|
15928
|
+
customInstructions: z6.string().optional(),
|
|
15929
|
+
planMode: z6.boolean().optional(),
|
|
15930
|
+
images: z6.array(z6.object({
|
|
15931
|
+
type: z6.literal("image"),
|
|
15932
|
+
source: z6.union([
|
|
15933
|
+
z6.object({
|
|
15934
|
+
type: z6.literal("base64"),
|
|
15885
15935
|
media_type: imageMediaTypeSchema,
|
|
15886
|
-
data:
|
|
15936
|
+
data: z6.string().min(1)
|
|
15887
15937
|
}),
|
|
15888
|
-
|
|
15889
|
-
type:
|
|
15890
|
-
url:
|
|
15938
|
+
z6.object({
|
|
15939
|
+
type: z6.literal("url"),
|
|
15940
|
+
url: z6.string().url()
|
|
15891
15941
|
})
|
|
15892
15942
|
])
|
|
15893
15943
|
})).optional(),
|
|
15894
|
-
thinkingLevel:
|
|
15895
|
-
goalMode:
|
|
15896
|
-
fastMode:
|
|
15897
|
-
enableInteractiveTools:
|
|
15898
|
-
type:
|
|
15899
|
-
merge:
|
|
15900
|
-
idempotencyKey:
|
|
15901
|
-
senderUserId:
|
|
15902
|
-
senderEmail:
|
|
15903
|
-
senderDisplayName:
|
|
15904
|
-
senderAvatarUrl:
|
|
15905
|
-
errorNotificationTarget:
|
|
15906
|
-
|
|
15907
|
-
|
|
15908
|
-
|
|
15909
|
-
type:
|
|
15910
|
-
provider:
|
|
15911
|
-
resource:
|
|
15912
|
-
repositoryId:
|
|
15913
|
-
resourceNumber:
|
|
15944
|
+
thinkingLevel: z6.enum(VALID_THINKING_LEVELS).optional(),
|
|
15945
|
+
goalMode: z6.boolean().optional(),
|
|
15946
|
+
fastMode: z6.boolean().optional(),
|
|
15947
|
+
enableInteractiveTools: z6.boolean().optional(),
|
|
15948
|
+
type: z6.string().min(1).optional(),
|
|
15949
|
+
merge: z6.boolean().optional(),
|
|
15950
|
+
idempotencyKey: z6.string().min(1).max(128).optional(),
|
|
15951
|
+
senderUserId: z6.string().optional(),
|
|
15952
|
+
senderEmail: z6.string().optional(),
|
|
15953
|
+
senderDisplayName: z6.string().optional(),
|
|
15954
|
+
senderAvatarUrl: z6.string().optional(),
|
|
15955
|
+
errorNotificationTarget: z6.discriminatedUnion("type", [
|
|
15956
|
+
z6.object({ type: z6.literal("slack") }),
|
|
15957
|
+
z6.object({ type: z6.literal("linear"), sessionId: z6.string().min(1) }),
|
|
15958
|
+
z6.object({
|
|
15959
|
+
type: z6.literal("code_host"),
|
|
15960
|
+
provider: z6.enum(["github", "gitlab"]),
|
|
15961
|
+
resource: z6.enum(["issue", "pull_request"]),
|
|
15962
|
+
repositoryId: z6.string().min(1),
|
|
15963
|
+
resourceNumber: z6.number().int().positive()
|
|
15914
15964
|
}),
|
|
15915
|
-
|
|
15965
|
+
z6.object({ type: z6.literal("automation"), executionId: z6.string().min(1) })
|
|
15916
15966
|
]).optional()
|
|
15917
15967
|
});
|
|
15918
|
-
var respondToolInputSchema =
|
|
15919
|
-
requestId:
|
|
15920
|
-
selectionId:
|
|
15968
|
+
var respondToolInputSchema = z6.object({
|
|
15969
|
+
requestId: z6.string().min(1),
|
|
15970
|
+
selectionId: z6.string().min(1)
|
|
15921
15971
|
});
|
|
15922
|
-
var updateGoalSchema =
|
|
15923
|
-
objective:
|
|
15924
|
-
status:
|
|
15972
|
+
var updateGoalSchema = z6.object({
|
|
15973
|
+
objective: z6.string().trim().min(1).max(MAX_CODEX_GOAL_OBJECTIVE_CHARS).optional(),
|
|
15974
|
+
status: z6.enum(["active", "paused"]).optional()
|
|
15925
15975
|
}).refine((body) => body.objective !== void 0 || body.status !== void 0, {
|
|
15926
15976
|
message: "Goal objective or status required"
|
|
15927
15977
|
});
|
|
@@ -16112,7 +16162,7 @@ function createV1Routes(deps) {
|
|
|
16112
16162
|
const result = await deps.chatService.updateGoal(c.req.param("chatId"), body);
|
|
16113
16163
|
return c.json(result);
|
|
16114
16164
|
} catch (error) {
|
|
16115
|
-
if (error instanceof
|
|
16165
|
+
if (error instanceof z6.ZodError) {
|
|
16116
16166
|
return c.json(jsonError(error.issues[0]?.message || "Invalid goal update"), 400);
|
|
16117
16167
|
}
|
|
16118
16168
|
if (error instanceof ChatNotFoundError) {
|