replicas-engine 0.1.481 → 0.1.483

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 +213 -155
  2. package/package.json +1 -1
package/dist/src/index.js CHANGED
@@ -101,6 +101,7 @@ var CODEX_ASP_ITEM_ID_PAYLOAD_KEY = "codexAspItemId";
101
101
  var CODEX_ASP_TRANSCRIPT_UPDATED_EVENT_TYPE = "codex-asp-transcript-updated";
102
102
  var CODEX_QUOTA_STATUS_EVENT_TYPE = "codex-quota-status";
103
103
  var COMPACTION_STATUS_EVENT_TYPE = "compaction-status";
104
+ var CHAT_INTERRUPTED_EVENT_TYPE = "replicas-interrupted";
104
105
  var CHAT_GOAL_EVENT_TYPE = "chat-goal";
105
106
  var AUTH_RETRY_STATUS_EVENT_TYPE = "auth-retry-status";
106
107
  var CONTEXT_USAGE_EVENT_TYPE = "context-usage";
@@ -582,7 +583,7 @@ var WORKSPACE_SIZES = ["small", "large"];
582
583
  var INVALID_WORKSPACE_SIZE_ERROR = `Invalid size: must be one of ${WORKSPACE_SIZES.join(", ")}`;
583
584
 
584
585
  // ../shared/src/e2b.ts
585
- var E2B_TEMPLATE_NAME = "replicas-sandbox-2026-07-23-v1";
586
+ var E2B_TEMPLATE_NAME = "replicas-sandbox-2026-07-23-v3";
586
587
 
587
588
  // ../shared/src/runtime-env.ts
588
589
  function shellQuotePosix(value) {
@@ -3176,9 +3177,28 @@ var workspaceChangedEventSchema = z3.discriminatedUnion("type", [
3176
3177
  workspaceId: z3.string(),
3177
3178
  chatId: z3.string(),
3178
3179
  ts: z3.string()
3179
- })
3180
+ }),
3181
+ z3.object({ type: z3.literal("presence.changed"), ts: z3.string() })
3180
3182
  ]);
3181
3183
 
3184
+ // ../shared/src/routes/presence.ts
3185
+ import { z as z4 } from "zod";
3186
+ var presenceStatusSchema = z4.enum(["online", "typing"]);
3187
+ var presenceLocationSchema = z4.object({
3188
+ environmentId: z4.string().optional(),
3189
+ workspaceId: z4.string().optional()
3190
+ });
3191
+ var presenceEntrySchema = z4.object({
3192
+ userId: z4.string(),
3193
+ status: presenceStatusSchema,
3194
+ location: presenceLocationSchema,
3195
+ ts: z4.string()
3196
+ });
3197
+ var updatePresenceRequestSchema = z4.object({
3198
+ status: presenceStatusSchema,
3199
+ location: presenceLocationSchema.optional()
3200
+ });
3201
+
3182
3202
  // ../shared/src/audit-log.ts
3183
3203
  var AUDIT_LOG_ACTION = {
3184
3204
  CREATE: "create",
@@ -3263,16 +3283,80 @@ function isTerminalBackgroundTaskStatus(status) {
3263
3283
  // ../shared/src/display-message/constants.ts
3264
3284
  var USER_MESSAGE_MATCH_GRACE_PERIOD_MS = 3e4;
3265
3285
 
3266
- // ../shared/src/json.ts
3267
- function safeJsonParse(str, fallback) {
3268
- try {
3269
- return JSON.parse(str);
3270
- } catch {
3271
- return fallback;
3286
+ // ../shared/src/agent-event-utils.ts
3287
+ function getUserMessage(event) {
3288
+ return event.type === "event_msg" && event.payload.type === "user_message" && typeof event.payload.message === "string" ? event.payload.message : null;
3289
+ }
3290
+ function getUserMessageId(event) {
3291
+ const messageId = event.payload[USER_MESSAGE_ID_PAYLOAD_KEY];
3292
+ return typeof messageId === "string" ? messageId : null;
3293
+ }
3294
+ function getUserMessageItemId(event) {
3295
+ const itemId = event.payload[CODEX_ASP_ITEM_ID_PAYLOAD_KEY];
3296
+ return typeof itemId === "string" ? itemId : null;
3297
+ }
3298
+ function parseTimestampMs(timestamp) {
3299
+ const value = Date.parse(timestamp);
3300
+ return Number.isFinite(value) ? value : 0;
3301
+ }
3302
+ function getEventTimestampMs(event) {
3303
+ return parseTimestampMs(event.timestamp);
3304
+ }
3305
+ function areSameUserMessageEvents(a, b) {
3306
+ const aMessage = getUserMessage(a);
3307
+ const bMessage = getUserMessage(b);
3308
+ if (!aMessage || aMessage !== bMessage) return false;
3309
+ const aMessageId = getUserMessageId(a);
3310
+ const bMessageId = getUserMessageId(b);
3311
+ if (aMessageId || bMessageId) return aMessageId === bMessageId;
3312
+ const aItemId = getUserMessageItemId(a);
3313
+ const bItemId = getUserMessageItemId(b);
3314
+ if (aItemId || bItemId) return aItemId === bItemId;
3315
+ return Math.abs(getEventTimestampMs(a) - getEventTimestampMs(b)) <= USER_MESSAGE_MATCH_GRACE_PERIOD_MS;
3316
+ }
3317
+ function parseAgentEventJsonl(content, options = {}) {
3318
+ const events = [];
3319
+ for (const line of content.split("\n")) {
3320
+ const trimmed = line.trim();
3321
+ if (!trimmed) continue;
3322
+ try {
3323
+ const parsed = JSON.parse(trimmed);
3324
+ if (isAgentBackendEvent(parsed)) {
3325
+ events.push(parsed);
3326
+ } else {
3327
+ options.onInvalidLine?.({ line: trimmed });
3328
+ }
3329
+ } catch (error) {
3330
+ options.onInvalidLine?.({ line: trimmed, error });
3331
+ }
3272
3332
  }
3333
+ return events;
3334
+ }
3335
+ function parseAgentEventJsonlWithCodexAspTranscript(content, options = {}) {
3336
+ const events = [];
3337
+ let transcript = null;
3338
+ const transcriptsByThreadId = /* @__PURE__ */ new Map();
3339
+ for (const event of parseAgentEventJsonl(content, options)) {
3340
+ if (event.type !== CODEX_ASP_TRANSCRIPT_UPDATED_EVENT_TYPE) {
3341
+ events.push(event);
3342
+ continue;
3343
+ }
3344
+ const delta = event.payload.transcriptDelta;
3345
+ if (isCodexAspTranscriptDelta(delta)) {
3346
+ const previous = transcriptsByThreadId.get(delta.threadId) ?? null;
3347
+ transcript = applyCodexAspTranscriptDelta(previous, delta);
3348
+ } else if (isCodexAspTranscript(event.payload.transcript)) {
3349
+ transcript = event.payload.transcript;
3350
+ }
3351
+ if (transcript) {
3352
+ transcriptsByThreadId.set(transcript.threadId, transcript);
3353
+ }
3354
+ }
3355
+ return { events, transcript, transcriptsByThreadId };
3273
3356
  }
3274
3357
 
3275
3358
  // ../shared/src/display-message/parsers/utils.ts
3359
+ var INTERRUPTED_MESSAGE_REGEX = /^\[Request interrupted by user.*\]$/;
3276
3360
  function userMessageImages(value) {
3277
3361
  if (!Array.isArray(value)) return void 0;
3278
3362
  const images = value.filter((item) => isRecord(item) && item.type === "image" && typeof item.mediaType === "string" && typeof item.data === "string");
@@ -3288,6 +3372,15 @@ function stringifyDisplayValue(value) {
3288
3372
  }
3289
3373
  }
3290
3374
 
3375
+ // ../shared/src/json.ts
3376
+ function safeJsonParse(str, fallback) {
3377
+ try {
3378
+ return JSON.parse(str);
3379
+ } catch {
3380
+ return fallback;
3381
+ }
3382
+ }
3383
+
3291
3384
  // ../shared/src/display-message/parsers/codex-parser.ts
3292
3385
  function getStatusFromExitCode(exitCode) {
3293
3386
  return exitCode === 0 ? "completed" : "failed";
@@ -4084,6 +4177,7 @@ function parseClaudeEvents(events, parentToolUseId) {
4084
4177
  const assistantThinking = /* @__PURE__ */ new Map();
4085
4178
  const assistantTextCounts = /* @__PURE__ */ new Map();
4086
4179
  const acceptedUserMessageIndexes = /* @__PURE__ */ new Set();
4180
+ let turnWasInterrupted = false;
4087
4181
  const taskAccumulator = new TaskAccumulator();
4088
4182
  const taskSnapshot = () => taskAccumulator.getTasks().map((task) => ({
4089
4183
  text: task.subject,
@@ -4154,6 +4248,7 @@ function parseClaudeEvents(events, parentToolUseId) {
4154
4248
  if (LOCAL_COMMAND_ECHO_REGEX.test(textContent.trim())) {
4155
4249
  return;
4156
4250
  }
4251
+ turnWasInterrupted = INTERRUPTED_MESSAGE_REGEX.test(textContent.trim());
4157
4252
  const images = content.filter((c) => c.type === "image" && c.source).map((c) => {
4158
4253
  const source = c.source;
4159
4254
  return {
@@ -4401,8 +4496,21 @@ function parseClaudeEvents(events, parentToolUseId) {
4401
4496
  }
4402
4497
  if (event.type === "claude-result") {
4403
4498
  const payload = coerceClaudeResultPayload(event.payload);
4499
+ const errorList = payload.errors || [];
4500
+ if (turnWasInterrupted) {
4501
+ turnWasInterrupted = false;
4502
+ const genuineErrors = errorList.filter((e) => !e.includes("[ede_diagnostic]"));
4503
+ if (genuineErrors.length > 0) {
4504
+ messages.push({
4505
+ id: `error-${event.timestamp}`,
4506
+ type: "error",
4507
+ message: genuineErrors.join("\n"),
4508
+ timestamp: event.timestamp
4509
+ });
4510
+ }
4511
+ return;
4512
+ }
4404
4513
  if (isClaudeResultError(payload)) {
4405
- const errorList = payload.errors || [];
4406
4514
  const errorMessage = errorList.length > 0 ? errorList.join("\n") : "Claude session encountered an unexpected error.";
4407
4515
  messages.push({
4408
4516
  id: `error-${event.timestamp}`,
@@ -4541,78 +4649,6 @@ function parseClaudeEvents(events, parentToolUseId) {
4541
4649
  return messages.filter((_, index) => !staleIndexes.has(index));
4542
4650
  }
4543
4651
 
4544
- // ../shared/src/agent-event-utils.ts
4545
- function getUserMessage(event) {
4546
- return event.type === "event_msg" && event.payload.type === "user_message" && typeof event.payload.message === "string" ? event.payload.message : null;
4547
- }
4548
- function getUserMessageId(event) {
4549
- const messageId = event.payload[USER_MESSAGE_ID_PAYLOAD_KEY];
4550
- return typeof messageId === "string" ? messageId : null;
4551
- }
4552
- function getUserMessageItemId(event) {
4553
- const itemId = event.payload[CODEX_ASP_ITEM_ID_PAYLOAD_KEY];
4554
- return typeof itemId === "string" ? itemId : null;
4555
- }
4556
- function parseTimestampMs(timestamp) {
4557
- const value = Date.parse(timestamp);
4558
- return Number.isFinite(value) ? value : 0;
4559
- }
4560
- function getEventTimestampMs(event) {
4561
- return parseTimestampMs(event.timestamp);
4562
- }
4563
- function areSameUserMessageEvents(a, b) {
4564
- const aMessage = getUserMessage(a);
4565
- const bMessage = getUserMessage(b);
4566
- if (!aMessage || aMessage !== bMessage) return false;
4567
- const aMessageId = getUserMessageId(a);
4568
- const bMessageId = getUserMessageId(b);
4569
- if (aMessageId || bMessageId) return aMessageId === bMessageId;
4570
- const aItemId = getUserMessageItemId(a);
4571
- const bItemId = getUserMessageItemId(b);
4572
- if (aItemId || bItemId) return aItemId === bItemId;
4573
- return Math.abs(getEventTimestampMs(a) - getEventTimestampMs(b)) <= USER_MESSAGE_MATCH_GRACE_PERIOD_MS;
4574
- }
4575
- function parseAgentEventJsonl(content, options = {}) {
4576
- const events = [];
4577
- for (const line of content.split("\n")) {
4578
- const trimmed = line.trim();
4579
- if (!trimmed) continue;
4580
- try {
4581
- const parsed = JSON.parse(trimmed);
4582
- if (isAgentBackendEvent(parsed)) {
4583
- events.push(parsed);
4584
- } else {
4585
- options.onInvalidLine?.({ line: trimmed });
4586
- }
4587
- } catch (error) {
4588
- options.onInvalidLine?.({ line: trimmed, error });
4589
- }
4590
- }
4591
- return events;
4592
- }
4593
- function parseAgentEventJsonlWithCodexAspTranscript(content, options = {}) {
4594
- const events = [];
4595
- let transcript = null;
4596
- const transcriptsByThreadId = /* @__PURE__ */ new Map();
4597
- for (const event of parseAgentEventJsonl(content, options)) {
4598
- if (event.type !== CODEX_ASP_TRANSCRIPT_UPDATED_EVENT_TYPE) {
4599
- events.push(event);
4600
- continue;
4601
- }
4602
- const delta = event.payload.transcriptDelta;
4603
- if (isCodexAspTranscriptDelta(delta)) {
4604
- const previous = transcriptsByThreadId.get(delta.threadId) ?? null;
4605
- transcript = applyCodexAspTranscriptDelta(previous, delta);
4606
- } else if (isCodexAspTranscript(event.payload.transcript)) {
4607
- transcript = event.payload.transcript;
4608
- }
4609
- if (transcript) {
4610
- transcriptsByThreadId.set(transcript.threadId, transcript);
4611
- }
4612
- }
4613
- return { events, transcript, transcriptsByThreadId };
4614
- }
4615
-
4616
4652
  // ../shared/src/display-message/parsers/codex-asp-parser.ts
4617
4653
  var DUPLICATE_WINDOW_MS = 5 * 60 * 1e3;
4618
4654
 
@@ -7822,6 +7858,13 @@ var CodingAgentManager = class {
7822
7858
  const { queue, isProcessing } = this.drainQueueForInterrupt();
7823
7859
  if (isProcessing) {
7824
7860
  await this.interruptActiveTurn();
7861
+ const event = {
7862
+ timestamp: (/* @__PURE__ */ new Date()).toISOString(),
7863
+ type: CHAT_INTERRUPTED_EVENT_TYPE,
7864
+ payload: {}
7865
+ };
7866
+ this.onEvent(event);
7867
+ this.getHistorySink()?.append(event);
7825
7868
  }
7826
7869
  this.emitInterruptedQueueEvent(queue);
7827
7870
  return {
@@ -8681,6 +8724,9 @@ var ClaudeManager = class _ClaudeManager extends CodingAgentManager {
8681
8724
  this.disallowedToolsOverride = options.disallowedTools;
8682
8725
  this.initializeManager(this.processMessageInternal.bind(this));
8683
8726
  }
8727
+ getHistorySink() {
8728
+ return this.historyFile;
8729
+ }
8684
8730
  async interruptActiveTurn() {
8685
8731
  this.pendingInterrupt = true;
8686
8732
  if (this.activeQuery) {
@@ -9802,7 +9848,7 @@ var DEFAULT_CODEX_ARGS = ["app-server", "--listen", "stdio://"];
9802
9848
  var MIN_CODEX_CLI_VERSION = "0.144.6";
9803
9849
  var CODEX_UPGRADE_TIMEOUT_MS = 12e4;
9804
9850
  var codexCliVersionEnsured = null;
9805
- var ENGINE_PACKAGE_VERSION = "0.1.481";
9851
+ var ENGINE_PACKAGE_VERSION = "0.1.483";
9806
9852
  var INITIALIZE_METHOD = "initialize";
9807
9853
  var INITIALIZED_NOTIFICATION = "initialized";
9808
9854
  var ACCOUNT_LOGIN_START_METHOD = "account/login/start";
@@ -10821,6 +10867,9 @@ var CodexAspManager = class extends CodingAgentManager {
10821
10867
  }
10822
10868
  this.currentThreadId = this.initialSessionId ?? replayed?.transcript?.threadId ?? null;
10823
10869
  }
10870
+ getHistorySink() {
10871
+ return { append: (event) => this.trackHistoryEvent(event) };
10872
+ }
10824
10873
  async interruptActiveTurn() {
10825
10874
  if (!this.currentThreadId || !this.activeTurnId) {
10826
10875
  return;
@@ -12047,6 +12096,9 @@ var CursorManager = class extends CodingAgentManager {
12047
12096
  async initialize() {
12048
12097
  await mkdir11(dirname5(this.historyFilePath), { recursive: true });
12049
12098
  }
12099
+ getHistorySink() {
12100
+ return this.historyFile;
12101
+ }
12050
12102
  async interruptActiveTurn() {
12051
12103
  await this.cancelRun(this.activeRun);
12052
12104
  this.abortActiveTurn?.();
@@ -12341,7 +12393,7 @@ import { delimiter, dirname as dirname6, join as join18 } from "path";
12341
12393
  import { randomBytes as randomBytes2 } from "crypto";
12342
12394
  import { fileURLToPath } from "url";
12343
12395
  import { Agent } from "undici";
12344
- import { z as z4 } from "zod";
12396
+ import { z as z5 } from "zod";
12345
12397
  import {
12346
12398
  createOpencodeClient,
12347
12399
  createOpencodeServer
@@ -12378,9 +12430,9 @@ var OPENCODE_VARIANT_CANDIDATES_BY_THINKING_LEVEL = {
12378
12430
  ultra: ["max", "xhigh", "high"],
12379
12431
  ultracode: ["max", "xhigh", "high"]
12380
12432
  };
12381
- var opencodeAuthSchema = z4.record(z4.string(), z4.object({
12382
- type: z4.string().optional(),
12383
- key: z4.string().optional()
12433
+ var opencodeAuthSchema = z5.record(z5.string(), z5.object({
12434
+ type: z5.string().optional(),
12435
+ key: z5.string().optional()
12384
12436
  }));
12385
12437
  async function hasOpenCodeGoCredentials() {
12386
12438
  if (!existsSync6(OPENCODE_AUTH_PATH2)) return false;
@@ -12584,6 +12636,9 @@ var OpencodeManager = class extends CodingAgentManager {
12584
12636
  async initialize() {
12585
12637
  await mkdir12(dirname6(this.historyFilePath), { recursive: true });
12586
12638
  }
12639
+ getHistorySink() {
12640
+ return this.historyFile;
12641
+ }
12587
12642
  async interruptActiveTurn() {
12588
12643
  this.activeAbortController?.abort();
12589
12644
  if (this.client && this.sessionId) {
@@ -13112,6 +13167,9 @@ var PiManager = class extends CodingAgentManager {
13112
13167
  async initialize() {
13113
13168
  await mkdir13(dirname7(this.historyFilePath), { recursive: true });
13114
13169
  }
13170
+ getHistorySink() {
13171
+ return this.historyFile;
13172
+ }
13115
13173
  async interruptActiveTurn() {
13116
13174
  await this.session?.abort();
13117
13175
  }
@@ -13225,7 +13283,7 @@ var PiManager = class extends CodingAgentManager {
13225
13283
 
13226
13284
  // src/managers/relay-tools.ts
13227
13285
  import { createSdkMcpServer, tool } from "@anthropic-ai/claude-agent-sdk";
13228
- import { z as z5 } from "zod";
13286
+ import { z as z6 } from "zod";
13229
13287
 
13230
13288
  // src/managers/relay-providers.ts
13231
13289
  function isRelaySubagentProviderAllowed(provider, allowedProviders) {
@@ -13340,7 +13398,7 @@ function buildSpawnAgentTool(parentChatId, availability = {}, getAllowedProvider
13340
13398
  const cursorAvailable = availability.cursorAvailable ?? false;
13341
13399
  const opencodeAvailable = availability.opencodeAvailable ?? false;
13342
13400
  const availableProviders = getAvailableRelayProviders(availability);
13343
- const providerEnum = z5.enum(availableProviders);
13401
+ const providerEnum = z6.enum(availableProviders);
13344
13402
  const codeProviders = getAvailableCodeProviders(availability);
13345
13403
  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.";
13346
13404
  const useCases = codeProviders.length > 0 ? `- Complex code writing tasks (use provider '${codeProviders.join("' or '")}' with a capable model)
@@ -13359,18 +13417,18 @@ The tool blocks until the subagent completes and returns its final response.
13359
13417
  You will also receive the chatId so you can send follow-up messages or clean up the chat.`,
13360
13418
  {
13361
13419
  provider: providerEnum.describe(providerDesc),
13362
- prompt: z5.string().describe("The full prompt/instructions for the subagent. Be detailed - it has no context from your conversation."),
13363
- model: z5.string().optional().describe([
13420
+ prompt: z6.string().describe("The full prompt/instructions for the subagent. Be detailed - it has no context from your conversation."),
13421
+ model: z6.string().optional().describe([
13364
13422
  `Model override. Claude: ${AGENT_MODELS.claude.join(", ")} (opus is the default; sonnet is faster).`,
13365
13423
  codexAvailable ? `Codex: ${AGENT_MODELS.codex.join(", ")}.` : null,
13366
13424
  cursorAvailable ? `Cursor: ${AGENT_MODELS.cursor.join(", ")}.` : null,
13367
13425
  opencodeAvailable ? `Opencode: ${AGENT_MODELS.opencode.join(", ")}.` : null
13368
13426
  ].filter(Boolean).join(" ")),
13369
- thinking_level: z5.enum(VALID_THINKING_LEVELS).optional().describe(
13427
+ thinking_level: z6.enum(VALID_THINKING_LEVELS).optional().describe(
13370
13428
  "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."
13371
13429
  ),
13372
- title: z5.string().optional().describe("Optional title for the subagent chat (for identification)."),
13373
- 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.")
13430
+ title: z6.string().optional().describe("Optional title for the subagent chat (for identification)."),
13431
+ timeout_minutes: z6.number().positive().optional().describe("Timeout in minutes for the subagent to complete (default: 10). Set higher for large tasks to avoid losing work.")
13374
13432
  },
13375
13433
  async (args) => {
13376
13434
  try {
@@ -13445,13 +13503,13 @@ var messageAgentTool = tool(
13445
13503
 
13446
13504
  The tool blocks until the subagent completes and returns its response.`,
13447
13505
  {
13448
- chatId: z5.string().describe("The chat ID of the subagent (returned by spawn_agent)."),
13449
- message: z5.string().describe("The follow-up message to send."),
13450
- model: z5.string().optional().describe("Optional model override for this message."),
13451
- thinking_level: z5.enum(VALID_THINKING_LEVELS).optional().describe(
13506
+ chatId: z6.string().describe("The chat ID of the subagent (returned by spawn_agent)."),
13507
+ message: z6.string().describe("The follow-up message to send."),
13508
+ model: z6.string().optional().describe("Optional model override for this message."),
13509
+ thinking_level: z6.enum(VALID_THINKING_LEVELS).optional().describe(
13452
13510
  "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."
13453
13511
  ),
13454
- 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.")
13512
+ timeout_minutes: z6.number().positive().optional().describe("Timeout in minutes for the subagent to complete (default: 10). Set higher for large tasks to avoid losing work.")
13455
13513
  },
13456
13514
  async (args) => {
13457
13515
  try {
@@ -13489,7 +13547,7 @@ var deleteAgentTool = tool(
13489
13547
  "delete_agent",
13490
13548
  `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.`,
13491
13549
  {
13492
- chatId: z5.string().describe("The chat ID of the subagent to delete.")
13550
+ chatId: z6.string().describe("The chat ID of the subagent to delete.")
13493
13551
  },
13494
13552
  async (args) => {
13495
13553
  try {
@@ -15327,7 +15385,7 @@ var RepoFileService = class {
15327
15385
 
15328
15386
  // src/v1-routes.ts
15329
15387
  import { Hono } from "hono";
15330
- import { z as z6 } from "zod";
15388
+ import { z as z7 } from "zod";
15331
15389
  import { readdir as readdir9, stat as stat5, readFile as readFile18 } from "fs/promises";
15332
15390
  import { join as join26, resolve as resolve3 } from "path";
15333
15391
 
@@ -15835,72 +15893,72 @@ var TerminalService = class {
15835
15893
  var terminalService = new TerminalService();
15836
15894
 
15837
15895
  // src/v1-routes.ts
15838
- var imageMediaTypeSchema = z6.enum(IMAGE_MEDIA_TYPES);
15839
- var createPreviewSchema = z6.object({
15840
- port: z6.number().int().min(1).max(65535),
15841
- publicUrl: z6.string().min(1)
15896
+ var imageMediaTypeSchema = z7.enum(IMAGE_MEDIA_TYPES);
15897
+ var createPreviewSchema = z7.object({
15898
+ port: z7.number().int().min(1).max(65535),
15899
+ publicUrl: z7.string().min(1)
15842
15900
  });
15843
- var terminalSizeSchema = z6.object({
15844
- cols: z6.number().int().min(2).max(500),
15845
- rows: z6.number().int().min(1).max(200)
15901
+ var terminalSizeSchema = z7.object({
15902
+ cols: z7.number().int().min(2).max(500),
15903
+ rows: z7.number().int().min(1).max(200)
15846
15904
  });
15847
- var writeTerminalSessionSchema = z6.object({
15848
- data: z6.string().max(64 * 1024),
15849
- generation: z6.number().int().nonnegative(),
15850
- sequence: z6.number().int().nonnegative()
15905
+ var writeTerminalSessionSchema = z7.object({
15906
+ data: z7.string().max(64 * 1024),
15907
+ generation: z7.number().int().nonnegative(),
15908
+ sequence: z7.number().int().nonnegative()
15851
15909
  });
15852
- var sendMessageSchema = z6.object({
15853
- messageId: z6.string().min(1).optional(),
15854
- submittedAt: z6.string().datetime().optional(),
15855
- message: z6.string().min(1),
15856
- model: z6.string().optional(),
15857
- customInstructions: z6.string().optional(),
15858
- planMode: z6.boolean().optional(),
15859
- images: z6.array(z6.object({
15860
- type: z6.literal("image"),
15861
- source: z6.union([
15862
- z6.object({
15863
- type: z6.literal("base64"),
15910
+ var sendMessageSchema = z7.object({
15911
+ messageId: z7.string().min(1).optional(),
15912
+ submittedAt: z7.string().datetime().optional(),
15913
+ message: z7.string().min(1),
15914
+ model: z7.string().optional(),
15915
+ customInstructions: z7.string().optional(),
15916
+ planMode: z7.boolean().optional(),
15917
+ images: z7.array(z7.object({
15918
+ type: z7.literal("image"),
15919
+ source: z7.union([
15920
+ z7.object({
15921
+ type: z7.literal("base64"),
15864
15922
  media_type: imageMediaTypeSchema,
15865
- data: z6.string().min(1)
15923
+ data: z7.string().min(1)
15866
15924
  }),
15867
- z6.object({
15868
- type: z6.literal("url"),
15869
- url: z6.string().url()
15925
+ z7.object({
15926
+ type: z7.literal("url"),
15927
+ url: z7.string().url()
15870
15928
  })
15871
15929
  ])
15872
15930
  })).optional(),
15873
- thinkingLevel: z6.enum(VALID_THINKING_LEVELS).optional(),
15874
- goalMode: z6.boolean().optional(),
15875
- fastMode: z6.boolean().optional(),
15876
- enableInteractiveTools: z6.boolean().optional(),
15877
- type: z6.string().min(1).optional(),
15878
- merge: z6.boolean().optional(),
15879
- idempotencyKey: z6.string().min(1).max(128).optional(),
15880
- senderUserId: z6.string().optional(),
15881
- senderEmail: z6.string().optional(),
15882
- senderDisplayName: z6.string().optional(),
15883
- senderAvatarUrl: z6.string().optional(),
15884
- errorNotificationTarget: z6.discriminatedUnion("type", [
15885
- z6.object({ type: z6.literal("slack") }),
15886
- z6.object({ type: z6.literal("linear"), sessionId: z6.string().min(1) }),
15887
- z6.object({
15888
- type: z6.literal("code_host"),
15889
- provider: z6.enum(["github", "gitlab"]),
15890
- resource: z6.enum(["issue", "pull_request"]),
15891
- repositoryId: z6.string().min(1),
15892
- resourceNumber: z6.number().int().positive()
15931
+ thinkingLevel: z7.enum(VALID_THINKING_LEVELS).optional(),
15932
+ goalMode: z7.boolean().optional(),
15933
+ fastMode: z7.boolean().optional(),
15934
+ enableInteractiveTools: z7.boolean().optional(),
15935
+ type: z7.string().min(1).optional(),
15936
+ merge: z7.boolean().optional(),
15937
+ idempotencyKey: z7.string().min(1).max(128).optional(),
15938
+ senderUserId: z7.string().optional(),
15939
+ senderEmail: z7.string().optional(),
15940
+ senderDisplayName: z7.string().optional(),
15941
+ senderAvatarUrl: z7.string().optional(),
15942
+ errorNotificationTarget: z7.discriminatedUnion("type", [
15943
+ z7.object({ type: z7.literal("slack") }),
15944
+ z7.object({ type: z7.literal("linear"), sessionId: z7.string().min(1) }),
15945
+ z7.object({
15946
+ type: z7.literal("code_host"),
15947
+ provider: z7.enum(["github", "gitlab"]),
15948
+ resource: z7.enum(["issue", "pull_request"]),
15949
+ repositoryId: z7.string().min(1),
15950
+ resourceNumber: z7.number().int().positive()
15893
15951
  }),
15894
- z6.object({ type: z6.literal("automation"), executionId: z6.string().min(1) })
15952
+ z7.object({ type: z7.literal("automation"), executionId: z7.string().min(1) })
15895
15953
  ]).optional()
15896
15954
  });
15897
- var respondToolInputSchema = z6.object({
15898
- requestId: z6.string().min(1),
15899
- selectionId: z6.string().min(1)
15955
+ var respondToolInputSchema = z7.object({
15956
+ requestId: z7.string().min(1),
15957
+ selectionId: z7.string().min(1)
15900
15958
  });
15901
- var updateGoalSchema = z6.object({
15902
- objective: z6.string().trim().min(1).max(MAX_CODEX_GOAL_OBJECTIVE_CHARS).optional(),
15903
- status: z6.enum(["active", "paused"]).optional()
15959
+ var updateGoalSchema = z7.object({
15960
+ objective: z7.string().trim().min(1).max(MAX_CODEX_GOAL_OBJECTIVE_CHARS).optional(),
15961
+ status: z7.enum(["active", "paused"]).optional()
15904
15962
  }).refine((body) => body.objective !== void 0 || body.status !== void 0, {
15905
15963
  message: "Goal objective or status required"
15906
15964
  });
@@ -16091,7 +16149,7 @@ function createV1Routes(deps) {
16091
16149
  const result = await deps.chatService.updateGoal(c.req.param("chatId"), body);
16092
16150
  return c.json(result);
16093
16151
  } catch (error) {
16094
- if (error instanceof z6.ZodError) {
16152
+ if (error instanceof z7.ZodError) {
16095
16153
  return c.json(jsonError(error.issues[0]?.message || "Invalid goal update"), 400);
16096
16154
  }
16097
16155
  if (error instanceof ChatNotFoundError) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "replicas-engine",
3
- "version": "0.1.481",
3
+ "version": "0.1.483",
4
4
  "description": "Lightweight API server for Replicas workspaces",
5
5
  "type": "module",
6
6
  "main": "dist/src/index.js",