replicas-engine 0.1.1089 → 0.1.1091

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.
@@ -217,6 +217,228 @@ var ASTER_MODEL_LABELS = {
217
217
  "gpt-oss-120b": "GPT-OSS 120B"
218
218
  };
219
219
 
220
+ // ../shared/src/routes/reviews.ts
221
+ import { z as z2 } from "zod";
222
+
223
+ // ../shared/src/github/url.ts
224
+ var GITHUB_HOST_RE = /(^|@|\/\/)github\.com[:/]/;
225
+ var GITHUB_REPO_SLUG_RE = /github\.com[/:]([^/]+)\/([^/]+?)(?:\.git)?(?:[/?#]|$)/i;
226
+ function isGitHubUrl(url) {
227
+ if (!url) return false;
228
+ return GITHUB_HOST_RE.test(url);
229
+ }
230
+ function parseRepoUrlSlug(url) {
231
+ if (!url) return null;
232
+ const match = url.match(GITHUB_REPO_SLUG_RE);
233
+ if (!match) return null;
234
+ return { owner: match[1].toLowerCase(), repo: match[2].toLowerCase() };
235
+ }
236
+
237
+ // ../shared/src/urls.ts
238
+ var DASHBOARD_PATH = "/dashboard";
239
+ var WEB_APP_PATHS = {
240
+ home: "/",
241
+ onboarding: "/onboarding",
242
+ workspaces: "/workspace",
243
+ environmentSetup: "/workspace/setup",
244
+ automations: "/automations",
245
+ environment: "/environment",
246
+ analytics: "/analytics",
247
+ review: "/review",
248
+ dashboard: DASHBOARD_PATH,
249
+ agents: `${DASHBOARD_PATH}/agents`,
250
+ integrations: `${DASHBOARD_PATH}/integrations`,
251
+ integrationsGithub: `${DASHBOARD_PATH}/integrations/github`,
252
+ integrationsGitlab: `${DASHBOARD_PATH}/integrations/gitlab`,
253
+ settings: `${DASHBOARD_PATH}/settings`,
254
+ billing: `${DASHBOARD_PATH}/billing`,
255
+ members: `${DASHBOARD_PATH}/members`,
256
+ learnings: `${DASHBOARD_PATH}/learnings`,
257
+ "audit-logs": `${DASHBOARD_PATH}/audit-logs`,
258
+ accountAgents: `${DASHBOARD_PATH}/account/agents`,
259
+ accountProfile: `${DASHBOARD_PATH}/account/profile`,
260
+ accountConnections: `${DASHBOARD_PATH}/account/connections`,
261
+ accountIntegrations: `${DASHBOARD_PATH}/account/integrations`,
262
+ accountApiKeys: `${DASHBOARD_PATH}/account/api-keys`,
263
+ accountPreferences: `${DASHBOARD_PATH}/account/preferences`,
264
+ fullscreenWorkspaces: "/workspaces"
265
+ };
266
+ var LEGACY_WEB_APP_PATHS = {
267
+ app: "/app",
268
+ home: "/home",
269
+ dashboardWorkspaces: `${DASHBOARD_PATH}/workspaces`
270
+ };
271
+ var PR_URL_REGEX = /github\.com\/([^/]+)\/([^/]+)\/pull\/(\d+)/;
272
+ function parsePrUrl(url) {
273
+ const match = url.match(PR_URL_REGEX);
274
+ if (!match) return null;
275
+ const [, owner, repo, numberStr] = match;
276
+ const number = Number.parseInt(numberStr, 10);
277
+ if (!Number.isFinite(number)) return null;
278
+ return { owner, repo, number };
279
+ }
280
+ function parseCodeHostPrUrl(url) {
281
+ const github = parsePrUrl(url);
282
+ if (github) {
283
+ return {
284
+ ...github,
285
+ provider: "github",
286
+ host: "github.com",
287
+ repositoryPath: `${github.owner}/${github.repo}`,
288
+ repoUrl: `https://github.com/${github.owner}/${github.repo}`
289
+ };
290
+ }
291
+ let parsed;
292
+ try {
293
+ parsed = new URL(url);
294
+ } catch {
295
+ return null;
296
+ }
297
+ if (parsed.protocol !== "https:" && parsed.protocol !== "http:") return null;
298
+ const segments = parsed.pathname.split("/").filter(Boolean);
299
+ const separatorIndex = segments.indexOf("-");
300
+ if (separatorIndex <= 0 || segments[separatorIndex + 1] !== "merge_requests") return null;
301
+ const number = Number.parseInt(segments[separatorIndex + 2] ?? "", 10);
302
+ if (!Number.isFinite(number)) return null;
303
+ const repositorySegments = decodePathSegments(segments.slice(0, separatorIndex));
304
+ const repo = repositorySegments[repositorySegments.length - 1];
305
+ const owner = repositorySegments[0];
306
+ if (!owner || !repo) return null;
307
+ const repositoryPath = repositorySegments.join("/");
308
+ return {
309
+ provider: "gitlab",
310
+ host: parsed.host.toLowerCase(),
311
+ owner,
312
+ repo,
313
+ number,
314
+ repositoryPath,
315
+ repoUrl: `${parsed.origin}/${repositoryPath}`
316
+ };
317
+ }
318
+ function decodePathSegments(segments) {
319
+ return segments.map((segment) => {
320
+ try {
321
+ return decodeURIComponent(segment);
322
+ } catch {
323
+ return segment;
324
+ }
325
+ });
326
+ }
327
+ function buildCodeHostPrUrl(repoUrl, provider2, prNumber) {
328
+ const normalizedRepoUrl = repoUrl.replace(/\.git$/, "");
329
+ if (provider2 === "gitlab") {
330
+ return `${normalizedRepoUrl}/-/merge_requests/${prNumber}`;
331
+ }
332
+ return `${normalizedRepoUrl}/pull/${prNumber}`;
333
+ }
334
+
335
+ // ../shared/src/routes/reviews.ts
336
+ var text = z2.string().trim().catch("");
337
+ var optionalText = z2.string().trim().min(1).optional().catch(void 0);
338
+ var pullRequestTourSchema = z2.object({
339
+ /** The tour chat that wrote this file, so a rerun doesn't show the previous run's tour as in progress. */
340
+ runId: optionalText,
341
+ headSha: optionalText,
342
+ status: z2.enum(["writing", "done"]).catch("writing"),
343
+ summary: text,
344
+ diagram: optionalText,
345
+ files: z2.array(z2.object({ path: text, explanation: text })).catch([]),
346
+ skip: z2.array(z2.object({ path: text, note: text })).catch([])
347
+ });
348
+
349
+ // ../shared/src/languages.ts
350
+ var EXT_TO_LANGUAGE = {
351
+ ".ts": "typescript",
352
+ ".tsx": "tsx",
353
+ ".mts": "typescript",
354
+ ".cts": "typescript",
355
+ ".js": "javascript",
356
+ ".jsx": "jsx",
357
+ ".mjs": "javascript",
358
+ ".cjs": "javascript",
359
+ ".py": "python",
360
+ ".pyw": "python",
361
+ ".pyi": "python",
362
+ ".rs": "rust",
363
+ ".go": "go",
364
+ ".rb": "ruby",
365
+ ".rake": "ruby",
366
+ ".java": "java",
367
+ ".kt": "kotlin",
368
+ ".kts": "kotlin",
369
+ ".scala": "scala",
370
+ ".swift": "swift",
371
+ ".m": "objectivec",
372
+ ".mm": "objectivec",
373
+ ".c": "c",
374
+ ".cpp": "cpp",
375
+ ".cc": "cpp",
376
+ ".cxx": "cpp",
377
+ ".h": "c",
378
+ ".hpp": "cpp",
379
+ ".hh": "cpp",
380
+ ".hxx": "cpp",
381
+ ".cs": "csharp",
382
+ ".vb": "vbnet",
383
+ ".fs": "fsharp",
384
+ ".php": "php",
385
+ ".phtml": "php",
386
+ ".css": "css",
387
+ ".scss": "scss",
388
+ ".sass": "sass",
389
+ ".less": "less",
390
+ ".html": "html",
391
+ ".htm": "html",
392
+ ".vue": "vue",
393
+ ".svelte": "svelte",
394
+ ".xml": "xml",
395
+ ".svg": "xml",
396
+ ".json": "json",
397
+ ".json5": "json5",
398
+ ".yaml": "yaml",
399
+ ".yml": "yaml",
400
+ ".toml": "toml",
401
+ ".ini": "ini",
402
+ ".md": "markdown",
403
+ ".markdown": "markdown",
404
+ ".mmd": "mermaid",
405
+ ".mermaid": "mermaid",
406
+ ".sql": "sql",
407
+ ".sh": "bash",
408
+ ".bash": "bash",
409
+ ".zsh": "bash",
410
+ ".fish": "bash",
411
+ ".dockerfile": "dockerfile",
412
+ ".graphql": "graphql",
413
+ ".proto": "protobuf",
414
+ ".r": "r",
415
+ ".lua": "lua",
416
+ ".dart": "dart",
417
+ ".zig": "zig",
418
+ ".ex": "elixir",
419
+ ".exs": "elixir",
420
+ ".erl": "erlang",
421
+ ".hs": "haskell",
422
+ ".ml": "ocaml",
423
+ ".clj": "clojure",
424
+ ".cljs": "clojure",
425
+ ".pl": "perl",
426
+ ".perl": "perl",
427
+ ".elm": "elm",
428
+ ".lisp": "lisp"
429
+ };
430
+ function detectLanguageByPath(filePath) {
431
+ const dot = filePath.lastIndexOf(".");
432
+ if (dot === -1) {
433
+ const basename = filePath.split("/").pop() ?? "";
434
+ if (basename === "Dockerfile") return "dockerfile";
435
+ if (basename === "Makefile") return "makefile";
436
+ return null;
437
+ }
438
+ const ext = filePath.slice(dot).toLowerCase();
439
+ return EXT_TO_LANGUAGE[ext] ?? null;
440
+ }
441
+
220
442
  // ../shared/src/engine/types.ts
221
443
  var DEFAULT_CHAT_TITLES = {
222
444
  claude: "Claude Code",
@@ -620,7 +842,7 @@ var CANVAS_KIND_BY_EXTENSION = {
620
842
  function classifyCanvasFilename(filename) {
621
843
  const idx = filename.lastIndexOf(".");
622
844
  const ext = idx === -1 ? "" : filename.slice(idx).toLowerCase();
623
- return CANVAS_KIND_BY_EXTENSION[ext] ?? { kind: "other", mimeType: "application/octet-stream" };
845
+ return CANVAS_KIND_BY_EXTENSION[ext] ?? (detectLanguageByPath(filename) ? { kind: "text", mimeType: "text/plain; charset=utf-8" } : { kind: "other", mimeType: "application/octet-stream" });
624
846
  }
625
847
  function isValidEngineLogSessionId(sessionId) {
626
848
  return Boolean(sessionId) && !/[/\\]/.test(sessionId) && !sessionId.includes("..");
@@ -643,7 +865,7 @@ function paginateEngineLogContent(input) {
643
865
  }
644
866
 
645
867
  // ../shared/src/analytics/types.ts
646
- import { z as z2 } from "zod";
868
+ import { z as z3 } from "zod";
647
869
 
648
870
  // ../shared/src/external-api-host.ts
649
871
  function validateExternalApiHost(url, providerLabel) {
@@ -1076,19 +1298,19 @@ function hasAgentChatActivityFields(value) {
1076
1298
  function isAgentChatActivityRecord(value) {
1077
1299
  return hasAgentChatActivityFields(value) && typeof value.provider === "string" && isValidAgentProvider(value.provider);
1078
1300
  }
1079
- var credentialAccountSchema = z2.object({
1080
- ownerName: z2.string().optional(),
1081
- email: z2.string().optional(),
1301
+ var credentialAccountSchema = z3.object({
1302
+ ownerName: z3.string().optional(),
1303
+ email: z3.string().optional(),
1082
1304
  /** 1-based place in the owner's account pool, set only when the pool holds several accounts. */
1083
- ordinal: z2.number().int().positive().optional()
1305
+ ordinal: z3.number().int().positive().optional()
1084
1306
  });
1085
- var agentCredentialSnapshotSchema = z2.object({
1086
- method: z2.enum(CREDENTIAL_METHOD),
1087
- scope: z2.enum(CREDENTIAL_SCOPE),
1088
- revision: z2.string().optional(),
1307
+ var agentCredentialSnapshotSchema = z3.object({
1308
+ method: z3.enum(CREDENTIAL_METHOD),
1309
+ scope: z3.enum(CREDENTIAL_SCOPE),
1310
+ revision: z3.string().optional(),
1089
1311
  account: credentialAccountSchema.optional(),
1090
1312
  /** The `credentials` row, which tells apart accounts pooled under one method and scope. */
1091
- credentialId: z2.string().optional()
1313
+ credentialId: z3.string().optional()
1092
1314
  });
1093
1315
  function isSameCredential(a, b) {
1094
1316
  return a.method === b.method && a.scope === b.scope && a.credentialId === b.credentialId;
@@ -1134,14 +1356,14 @@ function coerceClaudePartialMessagePayload(payload) {
1134
1356
  const streamId = payload.streamId;
1135
1357
  if (typeof streamId !== "string" || !streamId) return null;
1136
1358
  const parentToolUseId = payload.parent_tool_use_id;
1137
- const text2 = typeof payload.text === "string" && payload.text ? payload.text : void 0;
1359
+ const text3 = typeof payload.text === "string" && payload.text ? payload.text : void 0;
1138
1360
  const thinking = typeof payload.thinking === "string" && payload.thinking ? payload.thinking : void 0;
1139
1361
  const tool = isRecord(payload.tool) && typeof payload.tool.id === "string" && typeof payload.tool.name === "string" ? typeof payload.tool.filePath === "string" ? { id: payload.tool.id, name: payload.tool.name, filePath: payload.tool.filePath } : typeof payload.tool.command === "string" ? { id: payload.tool.id, name: payload.tool.name, command: payload.tool.command } : void 0 : void 0;
1140
- if (!text2 && !thinking && !tool) return null;
1362
+ if (!text3 && !thinking && !tool) return null;
1141
1363
  return {
1142
1364
  streamId,
1143
1365
  parent_tool_use_id: typeof parentToolUseId === "string" ? parentToolUseId : null,
1144
- ...text2 ? { text: text2 } : {},
1366
+ ...text3 ? { text: text3 } : {},
1145
1367
  ...thinking ? { thinking } : {},
1146
1368
  ...tool ? { tool } : {},
1147
1369
  status: payload.status === "completed" ? "completed" : "in_progress"
@@ -1236,105 +1458,105 @@ function coerceChatGoalPayload(payload) {
1236
1458
  var CONTEXT_USAGE_EVENT_TYPE = "context-usage";
1237
1459
 
1238
1460
  // ../shared/src/engine/v1.ts
1239
- import { z as z3 } from "zod";
1461
+ import { z as z4 } from "zod";
1240
1462
  var MERGED_MESSAGE_SEPARATOR = "\n\n<!-- replicas:merged -->\n\n";
1241
1463
  var ENGINE_HEALTH_WAIT_HEADER = "X-Replicas-Health-Wait";
1242
1464
  var ENGINE_HEALTH_WAIT_QUERY_PARAM = "wait_ms";
1243
1465
  var ENGINE_HEALTH_MAX_WAIT_MS = 2e3;
1244
1466
  var ENGINE_ACTIVATE_PATH = "/lifecycle/activate";
1245
1467
  var ENGINE_SLEEP_PATH = "/lifecycle/sleep";
1246
- var updateChatDisplayNameRequestSchema = z3.object({
1247
- displayName: z3.string().trim().min(1).max(100)
1468
+ var updateChatDisplayNameRequestSchema = z4.object({
1469
+ displayName: z4.string().trim().min(1).max(100)
1248
1470
  });
1249
- var createChatRequestSchema = z3.object({
1250
- id: z3.string().uuid().optional(),
1251
- createdAt: z3.string().datetime().optional(),
1252
- provider: z3.enum(VALID_AGENT_PROVIDERS),
1253
- title: z3.string().min(1).optional(),
1254
- parentChatId: z3.string().uuid().optional(),
1255
- forkSourceChatId: z3.string().uuid().optional(),
1256
- sideChat: z3.boolean().optional(),
1257
- clientRequestId: z3.string().min(1).max(128).optional()
1471
+ var createChatRequestSchema = z4.object({
1472
+ id: z4.string().uuid().optional(),
1473
+ createdAt: z4.string().datetime().optional(),
1474
+ provider: z4.enum(VALID_AGENT_PROVIDERS),
1475
+ title: z4.string().min(1).optional(),
1476
+ parentChatId: z4.string().uuid().optional(),
1477
+ forkSourceChatId: z4.string().uuid().optional(),
1478
+ sideChat: z4.boolean().optional(),
1479
+ clientRequestId: z4.string().min(1).max(128).optional()
1258
1480
  }).refine((request) => !request.sideChat || request.forkSourceChatId !== void 0 && request.parentChatId === request.forkSourceChatId, {
1259
1481
  message: "A side chat must fork its parent chat"
1260
1482
  });
1261
- var spawnSubagentRequestSchema = z3.object({
1262
- provider: z3.enum(VALID_AGENT_PROVIDERS),
1263
- prompt: z3.string().min(1),
1264
- forkTurns: z3.string().regex(/^(all|none|[1-9]\d*)$/).refine(
1483
+ var spawnSubagentRequestSchema = z4.object({
1484
+ provider: z4.enum(VALID_AGENT_PROVIDERS),
1485
+ prompt: z4.string().min(1),
1486
+ forkTurns: z4.string().regex(/^(all|none|[1-9]\d*)$/).refine(
1265
1487
  (value) => value === "all" || value === "none" || Number.isSafeInteger(Number(value)),
1266
1488
  "Expected all, none, or a positive safe integer string"
1267
1489
  ).default("all"),
1268
- model: z3.string().min(1).optional(),
1269
- thinkingLevel: z3.enum(VALID_THINKING_LEVELS).optional(),
1270
- title: z3.string().min(1).optional()
1490
+ model: z4.string().min(1).optional(),
1491
+ thinkingLevel: z4.enum(VALID_THINKING_LEVELS).optional(),
1492
+ title: z4.string().min(1).optional()
1271
1493
  });
1272
- var messageSubagentRequestSchema = z3.object({
1273
- message: z3.string().min(1),
1274
- model: z3.string().min(1).optional(),
1275
- thinkingLevel: z3.enum(VALID_THINKING_LEVELS).optional()
1494
+ var messageSubagentRequestSchema = z4.object({
1495
+ message: z4.string().min(1),
1496
+ model: z4.string().min(1).optional(),
1497
+ thinkingLevel: z4.enum(VALID_THINKING_LEVELS).optional()
1276
1498
  });
1277
- var waitSubagentRequestSchema = z3.object({
1278
- timeoutMinutes: z3.coerce.number().positive().max(1440).optional()
1499
+ var waitSubagentRequestSchema = z4.object({
1500
+ timeoutMinutes: z4.coerce.number().positive().max(1440).optional()
1279
1501
  });
1280
- var subagentResponseSchema = z3.object({
1281
- chatId: z3.string().uuid(),
1282
- status: z3.enum(["working", "completed"]),
1283
- response: z3.string().optional(),
1284
- timedOut: z3.literal(true).optional(),
1285
- interruptedByUserMessage: z3.literal(true).optional()
1502
+ var subagentResponseSchema = z4.object({
1503
+ chatId: z4.string().uuid(),
1504
+ status: z4.enum(["working", "completed"]),
1505
+ response: z4.string().optional(),
1506
+ timedOut: z4.literal(true).optional(),
1507
+ interruptedByUserMessage: z4.literal(true).optional()
1286
1508
  });
1287
- var integrationErrorNotificationTargetSchema = z3.discriminatedUnion("type", [
1288
- z3.object({
1289
- type: z3.literal("slack"),
1290
- conversation: z3.object({
1291
- channelId: z3.string().min(1),
1292
- threadTs: z3.string().min(1)
1509
+ var integrationErrorNotificationTargetSchema = z4.discriminatedUnion("type", [
1510
+ z4.object({
1511
+ type: z4.literal("slack"),
1512
+ conversation: z4.object({
1513
+ channelId: z4.string().min(1),
1514
+ threadTs: z4.string().min(1)
1293
1515
  }).optional()
1294
1516
  }),
1295
- z3.object({ type: z3.literal("linear"), sessionId: z3.string().min(1) }),
1296
- z3.object({
1297
- type: z3.literal("code_host"),
1298
- provider: z3.enum(["github", "gitlab"]),
1299
- resource: z3.enum(["issue", "pull_request"]),
1300
- repositoryId: z3.string().min(1),
1301
- resourceNumber: z3.number().int().positive()
1517
+ z4.object({ type: z4.literal("linear"), sessionId: z4.string().min(1) }),
1518
+ z4.object({
1519
+ type: z4.literal("code_host"),
1520
+ provider: z4.enum(["github", "gitlab"]),
1521
+ resource: z4.enum(["issue", "pull_request"]),
1522
+ repositoryId: z4.string().min(1),
1523
+ resourceNumber: z4.number().int().positive()
1302
1524
  }),
1303
- z3.object({ type: z3.literal("automation"), executionId: z3.string().min(1) })
1525
+ z4.object({ type: z4.literal("automation"), executionId: z4.string().min(1) })
1304
1526
  ]);
1305
- var sendChatMessageRequestSchema = z3.object({
1306
- messageId: z3.string().min(1).optional(),
1307
- submittedAt: z3.string().datetime().optional(),
1308
- message: z3.string().min(1),
1309
- model: z3.string().optional(),
1310
- customInstructions: z3.string().optional(),
1311
- planMode: z3.boolean().optional(),
1312
- images: z3.array(z3.object({
1313
- type: z3.literal("image"),
1314
- source: z3.discriminatedUnion("type", [
1315
- z3.object({ type: z3.literal("base64"), media_type: z3.enum(IMAGE_MEDIA_TYPES), data: z3.string().min(1) }),
1316
- z3.object({ type: z3.literal("url"), url: z3.string().url() })
1527
+ var sendChatMessageRequestSchema = z4.object({
1528
+ messageId: z4.string().min(1).optional(),
1529
+ submittedAt: z4.string().datetime().optional(),
1530
+ message: z4.string().min(1),
1531
+ model: z4.string().optional(),
1532
+ customInstructions: z4.string().optional(),
1533
+ planMode: z4.boolean().optional(),
1534
+ images: z4.array(z4.object({
1535
+ type: z4.literal("image"),
1536
+ source: z4.discriminatedUnion("type", [
1537
+ z4.object({ type: z4.literal("base64"), media_type: z4.enum(IMAGE_MEDIA_TYPES), data: z4.string().min(1) }),
1538
+ z4.object({ type: z4.literal("url"), url: z4.string().url() })
1317
1539
  ])
1318
1540
  })).optional(),
1319
- canvasUploadIds: z3.array(z3.string().min(1)).optional(),
1320
- thinkingLevel: z3.enum(VALID_THINKING_LEVELS).optional(),
1321
- goalMode: z3.boolean().optional(),
1322
- fastMode: z3.boolean().optional(),
1323
- ultrafastMode: z3.boolean().optional(),
1324
- source: z3.enum(MESSAGE_SOURCES).optional(),
1325
- enableInteractiveTools: z3.boolean().optional(),
1326
- type: z3.string().min(1).optional(),
1327
- merge: z3.boolean().optional(),
1328
- idempotencyKey: z3.string().min(1).max(128).optional(),
1329
- automationId: z3.string().optional(),
1330
- environmentId: z3.string().min(1).optional(),
1331
- senderUserId: z3.string().optional(),
1332
- senderEmail: z3.string().optional(),
1333
- senderDisplayName: z3.string().optional(),
1334
- senderAvatarUrl: z3.string().optional(),
1541
+ canvasUploadIds: z4.array(z4.string().min(1)).optional(),
1542
+ thinkingLevel: z4.enum(VALID_THINKING_LEVELS).optional(),
1543
+ goalMode: z4.boolean().optional(),
1544
+ fastMode: z4.boolean().optional(),
1545
+ ultrafastMode: z4.boolean().optional(),
1546
+ source: z4.enum(MESSAGE_SOURCES).optional(),
1547
+ enableInteractiveTools: z4.boolean().optional(),
1548
+ type: z4.string().min(1).optional(),
1549
+ merge: z4.boolean().optional(),
1550
+ idempotencyKey: z4.string().min(1).max(128).optional(),
1551
+ automationId: z4.string().optional(),
1552
+ environmentId: z4.string().min(1).optional(),
1553
+ senderUserId: z4.string().optional(),
1554
+ senderEmail: z4.string().optional(),
1555
+ senderDisplayName: z4.string().optional(),
1556
+ senderAvatarUrl: z4.string().optional(),
1335
1557
  errorNotificationTarget: integrationErrorNotificationTargetSchema.optional(),
1336
- errorNotificationTargets: z3.array(integrationErrorNotificationTargetSchema).optional(),
1337
- streamSlackActivity: z3.boolean().optional()
1558
+ errorNotificationTargets: z4.array(integrationErrorNotificationTargetSchema).optional(),
1559
+ streamSlackActivity: z4.boolean().optional()
1338
1560
  }).passthrough();
1339
1561
  function isChatMessageSender(value) {
1340
1562
  return isRecord(value) && (value.messageId === void 0 || typeof value.messageId === "string") && typeof value.senderUserId === "string" && typeof value.senderEmail === "string" && typeof value.recordedAt === "string";
@@ -1590,60 +1812,60 @@ function isSubagentMcpServerName(server) {
1590
1812
  }
1591
1813
 
1592
1814
  // ../shared/src/workspace-identity.ts
1593
- import { z as z4 } from "zod";
1815
+ import { z as z5 } from "zod";
1594
1816
  var WORKSPACE_IDENTITY_AUDIENCE = "replicas:workspace";
1595
1817
  var AWS_SOURCE_IDENTITY_CLAIM = "https://aws.amazon.com/source_identity";
1596
1818
  var WORKSPACE_TOKEN_TTL_SECONDS = 15 * 60;
1597
1819
  var IDENTITY_PROXY_PORT = 17323;
1598
1820
  var IDENTITY_TOKEN_PATH = "/token";
1599
- var workspaceAudienceSchema = z4.string().min(1).max(255).regex(/^[\x21-\x7e]+$/, "Audience must be a single printable token without spaces");
1600
- var workspaceTokenRequestSchema = z4.object({
1821
+ var workspaceAudienceSchema = z5.string().min(1).max(255).regex(/^[\x21-\x7e]+$/, "Audience must be a single printable token without spaces");
1822
+ var workspaceTokenRequestSchema = z5.object({
1601
1823
  audience: workspaceAudienceSchema.optional(),
1602
- aws_source_identity: z4.boolean().optional()
1824
+ aws_source_identity: z5.boolean().optional()
1603
1825
  });
1604
- var workspaceTokenClaimsSchema = z4.object({
1605
- iss: z4.string(),
1606
- sub: z4.string(),
1607
- aud: z4.string(),
1608
- iat: z4.number().int(),
1609
- nbf: z4.number().int(),
1610
- exp: z4.number().int(),
1611
- jti: z4.string(),
1612
- organization_id: z4.string().uuid(),
1613
- workspace_id: z4.string().uuid(),
1614
- environment_id: z4.string().uuid(),
1615
- creator_id: z4.string().uuid().nullable(),
1616
- creator_email: z4.string().nullable().default(null),
1617
- [AWS_SOURCE_IDENTITY_CLAIM]: z4.string().uuid().optional()
1826
+ var workspaceTokenClaimsSchema = z5.object({
1827
+ iss: z5.string(),
1828
+ sub: z5.string(),
1829
+ aud: z5.string(),
1830
+ iat: z5.number().int(),
1831
+ nbf: z5.number().int(),
1832
+ exp: z5.number().int(),
1833
+ jti: z5.string(),
1834
+ organization_id: z5.string().uuid(),
1835
+ workspace_id: z5.string().uuid(),
1836
+ environment_id: z5.string().uuid(),
1837
+ creator_id: z5.string().uuid().nullable(),
1838
+ creator_email: z5.string().nullable().default(null),
1839
+ [AWS_SOURCE_IDENTITY_CLAIM]: z5.string().uuid().optional()
1618
1840
  }).passthrough();
1619
- var workspaceTokenResponseSchema = z4.object({
1620
- issuer: z4.string(),
1621
- audience: z4.string(),
1622
- token: z4.string(),
1623
- expires_at: z4.string()
1841
+ var workspaceTokenResponseSchema = z5.object({
1842
+ issuer: z5.string(),
1843
+ audience: z5.string(),
1844
+ token: z5.string(),
1845
+ expires_at: z5.string()
1624
1846
  });
1625
- var legacyWorkspaceTokenBundleSchema = z4.object({
1626
- version: z4.literal(1),
1627
- issuer: z4.string(),
1628
- default_audience: z4.string(),
1629
- tokens: z4.record(z4.string(), z4.object({ token: z4.string(), expires_at: z4.string() }))
1847
+ var legacyWorkspaceTokenBundleSchema = z5.object({
1848
+ version: z5.literal(1),
1849
+ issuer: z5.string(),
1850
+ default_audience: z5.string(),
1851
+ tokens: z5.record(z5.string(), z5.object({ token: z5.string(), expires_at: z5.string() }))
1630
1852
  });
1631
- var mcpWorkloadAuthSchema = z4.strictObject({
1632
- type: z4.literal("workspace_identity"),
1853
+ var mcpWorkloadAuthSchema = z5.strictObject({
1854
+ type: z5.literal("workspace_identity"),
1633
1855
  audience: workspaceAudienceSchema
1634
1856
  });
1635
- var mcpAuthSchema = z4.discriminatedUnion("type", [
1857
+ var mcpAuthSchema = z5.discriminatedUnion("type", [
1636
1858
  mcpWorkloadAuthSchema,
1637
- z4.strictObject({ type: z4.literal("oauth") })
1859
+ z5.strictObject({ type: z5.literal("oauth") })
1638
1860
  ]);
1639
- var engineMcpOAuthTokenRequestSchema = z4.object({
1640
- environment_mcp_id: z4.string().uuid(),
1641
- force_refresh: z4.boolean().optional()
1861
+ var engineMcpOAuthTokenRequestSchema = z5.object({
1862
+ environment_mcp_id: z5.string().uuid(),
1863
+ force_refresh: z5.boolean().optional()
1642
1864
  });
1643
- var engineMcpOAuthTokenResponseSchema = z4.object({
1644
- url: z4.string(),
1645
- access_token: z4.string(),
1646
- expires_at: z4.string().nullable()
1865
+ var engineMcpOAuthTokenResponseSchema = z5.object({
1866
+ url: z5.string(),
1867
+ access_token: z5.string(),
1868
+ expires_at: z5.string().nullable()
1647
1869
  });
1648
1870
 
1649
1871
  // ../shared/src/runtime-env.ts
@@ -1717,20 +1939,6 @@ function parsePosixEnvFile(content) {
1717
1939
  return result;
1718
1940
  }
1719
1941
 
1720
- // ../shared/src/github/url.ts
1721
- var GITHUB_HOST_RE = /(^|@|\/\/)github\.com[:/]/;
1722
- var GITHUB_REPO_SLUG_RE = /github\.com[/:]([^/]+)\/([^/]+?)(?:\.git)?(?:[/?#]|$)/i;
1723
- function isGitHubUrl(url) {
1724
- if (!url) return false;
1725
- return GITHUB_HOST_RE.test(url);
1726
- }
1727
- function parseRepoUrlSlug(url) {
1728
- if (!url) return null;
1729
- const match = url.match(GITHUB_REPO_SLUG_RE);
1730
- if (!match) return null;
1731
- return { owner: match[1].toLowerCase(), repo: match[2].toLowerCase() };
1732
- }
1733
-
1734
1942
  // ../shared/src/git.ts
1735
1943
  var GIT_CREDENTIAL_HELPER_FILENAME = ".git-credential-replicas";
1736
1944
  var GITHUB_CREDENTIAL_REFRESH_PATH = "/git-credentials/github/refresh";
@@ -1849,19 +2057,19 @@ function gitIdentityConfigCommands(identity, scope = "global") {
1849
2057
  }
1850
2058
 
1851
2059
  // ../shared/src/headless-agent.ts
1852
- import { z as z5 } from "zod";
1853
- var headlessAgentRequestSchema = z5.object({
1854
- mode: z5.literal("structured"),
1855
- agent: z5.custom(
2060
+ import { z as z6 } from "zod";
2061
+ var headlessAgentRequestSchema = z6.object({
2062
+ mode: z6.literal("structured"),
2063
+ agent: z6.custom(
1856
2064
  (value) => typeof value === "string" && isValidAgentProvider(value)
1857
2065
  ),
1858
- model: z5.string().min(1),
1859
- prompt: z5.string(),
1860
- workingDirectory: z5.string().min(1),
1861
- timeoutSeconds: z5.number().int().min(1).max(1800).default(300),
1862
- thinkingLevel: z5.enum(STANDARD_THINKING_LEVELS).optional(),
1863
- codexOauthTokens: z5.object({ accessToken: z5.string(), accountId: z5.string() }).optional(),
1864
- outputSchema: z5.record(z5.string(), z5.json())
2066
+ model: z6.string().min(1),
2067
+ prompt: z6.string(),
2068
+ workingDirectory: z6.string().min(1),
2069
+ timeoutSeconds: z6.number().int().min(1).max(1800).default(300),
2070
+ thinkingLevel: z6.enum(STANDARD_THINKING_LEVELS).optional(),
2071
+ codexOauthTokens: z6.object({ accessToken: z6.string(), accountId: z6.string() }).optional(),
2072
+ outputSchema: z6.record(z6.string(), z6.json())
1865
2073
  });
1866
2074
  var headlessAgentUsagePath = (outputPath) => `${outputPath}.usage`;
1867
2075
 
@@ -1923,8 +2131,8 @@ var RATE_LIMIT_PATTERNS = [
1923
2131
  ];
1924
2132
  var HTTP_429_PATTERN = /(?:^|[^0-9])429(?:$|[^0-9])/;
1925
2133
  var HTTP_CONTEXT_PATTERN = /(api error|request|response|status|http)/;
1926
- function detectAgentQuotaLimit(text2) {
1927
- const normalized = text2.toLowerCase();
2134
+ function detectAgentQuotaLimit(text3) {
2135
+ const normalized = text3.toLowerCase();
1928
2136
  if (!normalized) return null;
1929
2137
  if (OUT_OF_CREDITS_PATTERNS.some((pattern) => pattern.test(normalized))) return "out_of_credits";
1930
2138
  if (RATE_LIMIT_PATTERNS.some((pattern) => pattern.test(normalized))) return "rate_limit";
@@ -1957,12 +2165,12 @@ function describeAuthFallback(payload) {
1957
2165
  }
1958
2166
 
1959
2167
  // ../shared/src/workspace-credentials.ts
1960
- import { z as z6 } from "zod";
2168
+ import { z as z7 } from "zod";
1961
2169
  var WORKSPACE_CREDENTIAL_PROVIDERS = ["claude", "codex"];
1962
- var workspaceCredentialProviderSchema = z6.enum(WORKSPACE_CREDENTIAL_PROVIDERS);
2170
+ var workspaceCredentialProviderSchema = z7.enum(WORKSPACE_CREDENTIAL_PROVIDERS);
1963
2171
  var workspaceCredentialSelectionSchema = agentCredentialSnapshotSchema.omit({ revision: true, account: true, credentialId: true });
1964
2172
  var createWorkspaceCredentialSchema = workspaceCredentialSelectionSchema.extend({
1965
- provider: z6.enum(VALID_AGENT_PROVIDERS)
2173
+ provider: z7.enum(VALID_AGENT_PROVIDERS)
1966
2174
  }).refine(({ provider: provider2, method }) => agentCredentialMethods(provider2).includes(method), {
1967
2175
  message: "This inference provider is not supported by this agent"
1968
2176
  });
@@ -1973,59 +2181,59 @@ var switchWorkspaceCredentialSchema = workspaceCredentialSelectionSchema.extend(
1973
2181
  });
1974
2182
 
1975
2183
  // ../shared/src/chat-fork.ts
1976
- import { z as z8 } from "zod";
2184
+ import { z as z9 } from "zod";
1977
2185
 
1978
2186
  // ../shared/src/fallback-chains.ts
1979
- import { z as z7 } from "zod";
1980
- var fallbackHarnessStepSchema = z7.object({
1981
- kind: z7.literal("harness"),
1982
- provider: z7.enum(VALID_AGENT_PROVIDERS),
1983
- model: z7.string().min(1),
1984
- thinkingLevel: z7.enum(VALID_THINKING_LEVELS).optional()
2187
+ import { z as z8 } from "zod";
2188
+ var fallbackHarnessStepSchema = z8.object({
2189
+ kind: z8.literal("harness"),
2190
+ provider: z8.enum(VALID_AGENT_PROVIDERS),
2191
+ model: z8.string().min(1),
2192
+ thinkingLevel: z8.enum(VALID_THINKING_LEVELS).optional()
1985
2193
  });
1986
- var fallbackPlanStepSchema = z7.discriminatedUnion("kind", [
1987
- z7.object({
1988
- kind: z7.literal("credentials"),
1989
- methods: z7.array(z7.custom(isAuthMethod)).min(1),
1990
- models: z7.record(z7.string(), z7.string().min(1)).optional()
2194
+ var fallbackPlanStepSchema = z8.discriminatedUnion("kind", [
2195
+ z8.object({
2196
+ kind: z8.literal("credentials"),
2197
+ methods: z8.array(z8.custom(isAuthMethod)).min(1),
2198
+ models: z8.record(z8.string(), z8.string().min(1)).optional()
1991
2199
  }),
1992
2200
  fallbackHarnessStepSchema
1993
2201
  ]);
1994
- var fallbackPlanResponseSchema = z7.object({ steps: z7.array(fallbackPlanStepSchema) });
2202
+ var fallbackPlanResponseSchema = z8.object({ steps: z8.array(fallbackPlanStepSchema) });
1995
2203
 
1996
2204
  // ../shared/src/chat-fork.ts
1997
- var quotaLimitKindSchema = z8.enum(["rate_limit", "out_of_credits"]);
1998
- var chatForkInfoSchema = z8.object({
1999
- source: z8.object({
2000
- chatId: z8.string().min(1),
2001
- provider: z8.enum(VALID_AGENT_PROVIDERS),
2002
- title: z8.string()
2205
+ var quotaLimitKindSchema = z9.enum(["rate_limit", "out_of_credits"]);
2206
+ var chatForkInfoSchema = z9.object({
2207
+ source: z9.object({
2208
+ chatId: z9.string().min(1),
2209
+ provider: z9.enum(VALID_AGENT_PROVIDERS),
2210
+ title: z9.string()
2003
2211
  }),
2004
- trigger: z8.enum(["manual", "auto", "side"]),
2212
+ trigger: z9.enum(["manual", "auto", "side"]),
2005
2213
  reason: quotaLimitKindSchema.optional(),
2006
- state: z8.enum(["preparing", "ready", "failed"]),
2007
- error: z8.string().optional(),
2008
- startedAt: z8.string(),
2009
- completedAt: z8.string().optional()
2214
+ state: z9.enum(["preparing", "ready", "failed"]),
2215
+ error: z9.string().optional(),
2216
+ startedAt: z9.string(),
2217
+ completedAt: z9.string().optional()
2010
2218
  });
2011
2219
  function coerceChatForkInfo(value) {
2012
2220
  const parsed = chatForkInfoSchema.safeParse(value);
2013
2221
  return parsed.success ? parsed.data : null;
2014
2222
  }
2015
- var forkChatRequestSchema = z8.object({
2016
- provider: z8.enum(VALID_AGENT_PROVIDERS),
2017
- model: z8.string().min(1).optional(),
2018
- thinkingLevel: z8.enum(VALID_THINKING_LEVELS).optional(),
2019
- title: z8.string().min(1).max(200).optional(),
2020
- message: z8.string().trim().optional(),
2021
- id: z8.string().uuid().optional(),
2022
- clientRequestId: z8.string().min(1).max(128).optional(),
2023
- enableInteractiveTools: z8.boolean().optional(),
2223
+ var forkChatRequestSchema = z9.object({
2224
+ provider: z9.enum(VALID_AGENT_PROVIDERS),
2225
+ model: z9.string().min(1).optional(),
2226
+ thinkingLevel: z9.enum(VALID_THINKING_LEVELS).optional(),
2227
+ title: z9.string().min(1).max(200).optional(),
2228
+ message: z9.string().trim().optional(),
2229
+ id: z9.string().uuid().optional(),
2230
+ clientRequestId: z9.string().min(1).max(128).optional(),
2231
+ enableInteractiveTools: z9.boolean().optional(),
2024
2232
  // Server-injected by the monolith from the authenticated request; never trusted from clients.
2025
- senderUserId: z8.string().optional(),
2026
- senderEmail: z8.string().optional(),
2027
- senderDisplayName: z8.string().optional(),
2028
- senderAvatarUrl: z8.string().optional()
2233
+ senderUserId: z9.string().optional(),
2234
+ senderEmail: z9.string().optional(),
2235
+ senderDisplayName: z9.string().optional(),
2236
+ senderAvatarUrl: z9.string().optional()
2029
2237
  });
2030
2238
  function describeQuotaLimit(reason) {
2031
2239
  return reason === "out_of_credits" ? "ran out of credits" : "hit its usage limit";
@@ -2034,10 +2242,10 @@ function describeChatForkReason(reason, provider2) {
2034
2242
  return reason ? `${getProviderDisplayName(provider2)} ${describeQuotaLimit(reason)}` : null;
2035
2243
  }
2036
2244
  var AGENT_QUOTA_EXHAUSTED_EVENT_TYPE = "agent-quota-exhausted";
2037
- var agentQuotaExhaustedPayloadSchema = z8.object({
2038
- provider: z8.enum(VALID_AGENT_PROVIDERS),
2245
+ var agentQuotaExhaustedPayloadSchema = z9.object({
2246
+ provider: z9.enum(VALID_AGENT_PROVIDERS),
2039
2247
  reason: quotaLimitKindSchema,
2040
- detail: z8.string().optional(),
2248
+ detail: z9.string().optional(),
2041
2249
  forkTo: fallbackHarnessStepSchema.optional()
2042
2250
  });
2043
2251
  function defaultForkChatTitle(source, provider2) {
@@ -2045,10 +2253,10 @@ function defaultForkChatTitle(source, provider2) {
2045
2253
  }
2046
2254
 
2047
2255
  // ../shared/src/credential-pool.ts
2048
- import { z as z9 } from "zod";
2256
+ import { z as z10 } from "zod";
2049
2257
  var MAX_CREDENTIAL_POOL_ACCOUNTS = 10;
2050
- var reorderCredentialPoolSchema = z9.object({
2051
- credential_ids: z9.array(z9.string().uuid()).min(1).max(MAX_CREDENTIAL_POOL_ACCOUNTS)
2258
+ var reorderCredentialPoolSchema = z10.object({
2259
+ credential_ids: z10.array(z10.string().uuid()).min(1).max(MAX_CREDENTIAL_POOL_ACCOUNTS)
2052
2260
  });
2053
2261
 
2054
2262
  // ../shared/src/display-message/types.ts
@@ -2184,8 +2392,8 @@ function indexOrEnd(src, search, from) {
2184
2392
  const index = src.indexOf(search, from);
2185
2393
  return index < 0 ? src.length : index;
2186
2394
  }
2187
- function decodeAnsiC(text2) {
2188
- return text2.replace(/\\(x[0-9a-fA-F]{1,2}|u[0-9a-fA-F]{1,4}|[0-7]{1,3}|[\s\S])/g, (_match, escape) => {
2395
+ function decodeAnsiC(text3) {
2396
+ return text3.replace(/\\(x[0-9a-fA-F]{1,2}|u[0-9a-fA-F]{1,4}|[0-7]{1,3}|[\s\S])/g, (_match, escape) => {
2189
2397
  if (escape[0] === "x" || escape[0] === "u") return String.fromCharCode(parseInt(escape.slice(1), 16));
2190
2398
  if (/^[0-7]/.test(escape)) return String.fromCharCode(parseInt(escape, 8));
2191
2399
  return ANSI_C_ESCAPES[escape] ?? escape;
@@ -2202,8 +2410,8 @@ function staticOutput(argv, stdin) {
2202
2410
  if (flags.includes("n")) newline = false;
2203
2411
  if (flags.includes("e")) escapes = true;
2204
2412
  }
2205
- const text2 = args.join(" ");
2206
- return (escapes ? decodeAnsiC(text2) : text2) + (newline ? "\n" : "");
2413
+ const text3 = args.join(" ");
2414
+ return (escapes ? decodeAnsiC(text3) : text3) + (newline ? "\n" : "");
2207
2415
  }
2208
2416
  if (name === "printf" && args.length > 0) {
2209
2417
  const format = decodeAnsiC(args[0]);
@@ -2363,8 +2571,8 @@ function parseUntil(scope, start, closeParen) {
2363
2571
  let quoted = false;
2364
2572
  let redirect = null;
2365
2573
  let parens = 0;
2366
- const append = (text2, isQuoted = false) => {
2367
- word = (word ?? "") + text2;
2574
+ const append = (text3, isQuoted = false) => {
2575
+ word = (word ?? "") + text3;
2368
2576
  quoted ||= isQuoted;
2369
2577
  };
2370
2578
  const endWord = () => {
@@ -2560,10 +2768,10 @@ function planItemsFromMessage(message2) {
2560
2768
  if (!todos) return null;
2561
2769
  return todos.flatMap((todo) => {
2562
2770
  if (!todo || typeof todo !== "object") return [];
2563
- const text2 = "content" in todo && typeof todo.content === "string" ? todo.content : "text" in todo && typeof todo.text === "string" ? todo.text : null;
2771
+ const text3 = "content" in todo && typeof todo.content === "string" ? todo.content : "text" in todo && typeof todo.text === "string" ? todo.text : null;
2564
2772
  const status = "status" in todo ? todo.status : null;
2565
- if (!text2) return [];
2566
- return [{ text: text2, status: status === "completed" || status === "in_progress" ? status : "pending" }];
2773
+ if (!text3) return [];
2774
+ return [{ text: text3, status: status === "completed" || status === "in_progress" ? status : "pending" }];
2567
2775
  });
2568
2776
  }
2569
2777
  function getDisplayMessageStatus(message2) {
@@ -2867,110 +3075,13 @@ function subagentChatId(message2) {
2867
3075
  }
2868
3076
 
2869
3077
  // ../shared/src/multitask-events.ts
2870
- import { z as z15 } from "zod";
2871
-
2872
- // ../shared/src/urls.ts
2873
- var DASHBOARD_PATH = "/dashboard";
2874
- var WEB_APP_PATHS = {
2875
- home: "/",
2876
- onboarding: "/onboarding",
2877
- workspaces: "/workspace",
2878
- environmentSetup: "/workspace/setup",
2879
- automations: "/automations",
2880
- environment: "/environment",
2881
- analytics: "/analytics",
2882
- dashboard: DASHBOARD_PATH,
2883
- agents: `${DASHBOARD_PATH}/agents`,
2884
- integrations: `${DASHBOARD_PATH}/integrations`,
2885
- integrationsGithub: `${DASHBOARD_PATH}/integrations/github`,
2886
- integrationsGitlab: `${DASHBOARD_PATH}/integrations/gitlab`,
2887
- settings: `${DASHBOARD_PATH}/settings`,
2888
- billing: `${DASHBOARD_PATH}/billing`,
2889
- members: `${DASHBOARD_PATH}/members`,
2890
- learnings: `${DASHBOARD_PATH}/learnings`,
2891
- "audit-logs": `${DASHBOARD_PATH}/audit-logs`,
2892
- accountAgents: `${DASHBOARD_PATH}/account/agents`,
2893
- accountProfile: `${DASHBOARD_PATH}/account/profile`,
2894
- accountConnections: `${DASHBOARD_PATH}/account/connections`,
2895
- accountIntegrations: `${DASHBOARD_PATH}/account/integrations`,
2896
- accountApiKeys: `${DASHBOARD_PATH}/account/api-keys`,
2897
- accountPreferences: `${DASHBOARD_PATH}/account/preferences`,
2898
- fullscreenWorkspaces: "/workspaces"
2899
- };
2900
- var LEGACY_WEB_APP_PATHS = {
2901
- app: "/app",
2902
- home: "/home",
2903
- dashboardWorkspaces: `${DASHBOARD_PATH}/workspaces`
2904
- };
2905
- var PR_URL_REGEX = /github\.com\/([^/]+)\/([^/]+)\/pull\/(\d+)/;
2906
- function parsePrUrl(url) {
2907
- const match = url.match(PR_URL_REGEX);
2908
- if (!match) return null;
2909
- const [, owner, repo, numberStr] = match;
2910
- const number = Number.parseInt(numberStr, 10);
2911
- if (!Number.isFinite(number)) return null;
2912
- return { owner, repo, number };
2913
- }
2914
- function parseCodeHostPrUrl(url) {
2915
- const github = parsePrUrl(url);
2916
- if (github) {
2917
- return {
2918
- ...github,
2919
- provider: "github",
2920
- host: "github.com",
2921
- repositoryPath: `${github.owner}/${github.repo}`,
2922
- repoUrl: `https://github.com/${github.owner}/${github.repo}`
2923
- };
2924
- }
2925
- let parsed;
2926
- try {
2927
- parsed = new URL(url);
2928
- } catch {
2929
- return null;
2930
- }
2931
- if (parsed.protocol !== "https:" && parsed.protocol !== "http:") return null;
2932
- const segments = parsed.pathname.split("/").filter(Boolean);
2933
- const separatorIndex = segments.indexOf("-");
2934
- if (separatorIndex <= 0 || segments[separatorIndex + 1] !== "merge_requests") return null;
2935
- const number = Number.parseInt(segments[separatorIndex + 2] ?? "", 10);
2936
- if (!Number.isFinite(number)) return null;
2937
- const repositorySegments = decodePathSegments(segments.slice(0, separatorIndex));
2938
- const repo = repositorySegments[repositorySegments.length - 1];
2939
- const owner = repositorySegments[0];
2940
- if (!owner || !repo) return null;
2941
- const repositoryPath = repositorySegments.join("/");
2942
- return {
2943
- provider: "gitlab",
2944
- host: parsed.host.toLowerCase(),
2945
- owner,
2946
- repo,
2947
- number,
2948
- repositoryPath,
2949
- repoUrl: `${parsed.origin}/${repositoryPath}`
2950
- };
2951
- }
2952
- function decodePathSegments(segments) {
2953
- return segments.map((segment) => {
2954
- try {
2955
- return decodeURIComponent(segment);
2956
- } catch {
2957
- return segment;
2958
- }
2959
- });
2960
- }
2961
- function buildCodeHostPrUrl(repoUrl, provider2, prNumber) {
2962
- const normalizedRepoUrl = repoUrl.replace(/\.git$/, "");
2963
- if (provider2 === "gitlab") {
2964
- return `${normalizedRepoUrl}/-/merge_requests/${prNumber}`;
2965
- }
2966
- return `${normalizedRepoUrl}/pull/${prNumber}`;
2967
- }
3078
+ import { z as z16 } from "zod";
2968
3079
 
2969
3080
  // ../shared/src/replicas-mcp.ts
2970
- import { z as z14 } from "zod";
3081
+ import { z as z15 } from "zod";
2971
3082
 
2972
3083
  // ../shared/src/automations/trigger-schemas.ts
2973
- import { z as z10 } from "zod";
3084
+ import { z as z11 } from "zod";
2974
3085
 
2975
3086
  // ../shared/src/uuid.ts
2976
3087
  function createUuidFromHex(value) {
@@ -2987,47 +3098,47 @@ function getReviewerLoginsError(event, logins) {
2987
3098
  if (isReviewRequested === !!logins?.some((login) => login.trim().replace(/^@+/, ""))) return null;
2988
3099
  return isReviewRequested ? "The PR review requested trigger needs at least one GitHub username" : "Requested reviewers only apply to the PR review requested trigger";
2989
3100
  }
2990
- var repositoryTriggerConfigSchema = z10.object({
2991
- event: z10.string(),
2992
- repository_ids: z10.array(z10.string().regex(UUID_RE, "must be a repository id")).optional(),
2993
- group_pr_events: z10.boolean().optional(),
2994
- excluded_actors: z10.array(z10.string()).optional(),
2995
- reviewer_logins: z10.array(z10.string()).optional()
3101
+ var repositoryTriggerConfigSchema = z11.object({
3102
+ event: z11.string(),
3103
+ repository_ids: z11.array(z11.string().regex(UUID_RE, "must be a repository id")).optional(),
3104
+ group_pr_events: z11.boolean().optional(),
3105
+ excluded_actors: z11.array(z11.string()).optional(),
3106
+ reviewer_logins: z11.array(z11.string()).optional()
2996
3107
  });
2997
- var cronTriggerSchema = z10.object({ type: z10.literal("cron"), config: z10.object({ schedule: z10.string(), timezone: z10.string().optional() }) });
2998
- var githubTriggerSchema = z10.object({
2999
- type: z10.literal("github"),
3108
+ var cronTriggerSchema = z11.object({ type: z11.literal("cron"), config: z11.object({ schedule: z11.string(), timezone: z11.string().optional() }) });
3109
+ var githubTriggerSchema = z11.object({
3110
+ type: z11.literal("github"),
3000
3111
  config: repositoryTriggerConfigSchema.superRefine((config, ctx) => {
3001
3112
  const message2 = getReviewerLoginsError(config.event, config.reviewer_logins);
3002
3113
  if (message2) ctx.addIssue({ code: "custom", message: message2, path: ["reviewer_logins"] });
3003
3114
  })
3004
3115
  });
3005
- var gitlabTriggerSchema = z10.object({ type: z10.literal("gitlab"), config: repositoryTriggerConfigSchema });
3006
- var automationTriggerSchema = z10.discriminatedUnion("type", [
3116
+ var gitlabTriggerSchema = z11.object({ type: z11.literal("gitlab"), config: repositoryTriggerConfigSchema });
3117
+ var automationTriggerSchema = z11.discriminatedUnion("type", [
3007
3118
  cronTriggerSchema,
3008
3119
  githubTriggerSchema,
3009
3120
  gitlabTriggerSchema,
3010
- z10.object({ type: z10.literal("slack"), config: z10.object({ event: z10.string(), channel_ids: z10.array(z10.string()).optional(), group_thread_replies: z10.boolean().optional() }) }),
3011
- z10.object({ type: z10.literal("sentry"), config: z10.object({ event: z10.string(), project_slugs: z10.array(z10.string()).optional(), min_level: z10.string().optional() }) }),
3012
- z10.object({ type: z10.literal("custom"), config: z10.object({}) })
3121
+ z11.object({ type: z11.literal("slack"), config: z11.object({ event: z11.string(), channel_ids: z11.array(z11.string()).optional(), group_thread_replies: z11.boolean().optional() }) }),
3122
+ z11.object({ type: z11.literal("sentry"), config: z11.object({ event: z11.string(), project_slugs: z11.array(z11.string()).optional(), min_level: z11.string().optional() }) }),
3123
+ z11.object({ type: z11.literal("custom"), config: z11.object({}) })
3013
3124
  ]);
3014
3125
 
3015
3126
  // ../shared/src/routes/environment.ts
3016
- import { z as z11 } from "zod";
3127
+ import { z as z12 } from "zod";
3017
3128
  var ENVIRONMENT_MCP_TRANSPORTS = ["stdio", "http", "sse"];
3018
- var stringMap = z11.record(z11.string(), z11.string());
3019
- var createEnvironmentMcpRequestSchema = z11.object({
3020
- name: z11.string(),
3021
- transport: z11.enum(ENVIRONMENT_MCP_TRANSPORTS),
3022
- config: z11.union([
3023
- z11.object({ command: z11.string().min(1), args: z11.array(z11.string()).optional(), env: stringMap.optional() }),
3024
- z11.object({ url: z11.url(), headers: stringMap.optional(), auth: mcpAuthSchema.optional() })
3129
+ var stringMap = z12.record(z12.string(), z12.string());
3130
+ var createEnvironmentMcpRequestSchema = z12.object({
3131
+ name: z12.string(),
3132
+ transport: z12.enum(ENVIRONMENT_MCP_TRANSPORTS),
3133
+ config: z12.union([
3134
+ z12.object({ command: z12.string().min(1), args: z12.array(z12.string()).optional(), env: stringMap.optional() }),
3135
+ z12.object({ url: z12.url(), headers: stringMap.optional(), auth: mcpAuthSchema.optional() })
3025
3136
  ]).describe("stdio: `{ command, args, env }`. http/sse: `{ url, headers }`.")
3026
3137
  });
3027
3138
  var updateEnvironmentMcpRequestSchema = createEnvironmentMcpRequestSchema.partial();
3028
3139
 
3029
3140
  // ../shared/src/routes/workspaces.ts
3030
- import { z as z13 } from "zod";
3141
+ import { z as z14 } from "zod";
3031
3142
 
3032
3143
  // ../shared/src/default-skills/replicas-agent/abilities/computer.ts
3033
3144
  var SECTION = `### Computer use (Linux desktop control)
@@ -3299,7 +3410,7 @@ var DOCKER_ABILITY = {
3299
3410
  };
3300
3411
 
3301
3412
  // ../shared/src/routes/environment-setups.ts
3302
- import { z as z12 } from "zod";
3413
+ import { z as z13 } from "zod";
3303
3414
  var ENVIRONMENT_SETUP_STEPS = [
3304
3415
  { key: "understand", label: "Understand the codebase" },
3305
3416
  { key: "install", label: "Install dependencies and run the app" },
@@ -3333,17 +3444,17 @@ var ENVIRONMENT_SETUP_LIMITS = {
3333
3444
  };
3334
3445
  var ENVIRONMENT_SETUP_VARIABLE_WAIT = { defaultMs: 5 * 6e4, maxMs: 15 * 6e4, pollMs: 5e3 };
3335
3446
  var VARIABLE_KEY_RE = /^[A-Za-z_][A-Za-z0-9_]*$/;
3336
- var text = (max) => max === void 0 ? z12.string().trim() : z12.string().trim().max(max);
3337
- var requiredText = (max) => text(max).min(1, "must not be empty");
3338
- var optionalText = (max) => text(max).nullish().transform((value) => value || null);
3339
- var clearableText = (max) => text(max).nullish().transform((value) => value === void 0 ? void 0 : value || null);
3340
- var list = (item, max) => max === void 0 ? z12.array(item) : z12.array(item).max(max);
3447
+ var text2 = (max) => max === void 0 ? z13.string().trim() : z13.string().trim().max(max);
3448
+ var requiredText = (max) => text2(max).min(1, "must not be empty");
3449
+ var optionalText2 = (max) => text2(max).nullish().transform((value) => value || null);
3450
+ var clearableText = (max) => text2(max).nullish().transform((value) => value === void 0 ? void 0 : value || null);
3451
+ var list = (item, max) => max === void 0 ? z13.array(item) : z13.array(item).max(max);
3341
3452
  var ENVIRONMENT_SETUP_AUTHORED_TRIGGER_TYPES = ["cron", "github", "gitlab"];
3342
3453
  function isEnvironmentSetupAuthoredTriggerType(type) {
3343
3454
  return ENVIRONMENT_SETUP_AUTHORED_TRIGGER_TYPES.some((authored) => authored === type);
3344
3455
  }
3345
- var proposalTriggerSchema = z12.discriminatedUnion("type", [cronTriggerSchema, githubTriggerSchema, gitlabTriggerSchema]);
3346
- var existingTriggerSchema = z12.custom(
3456
+ var proposalTriggerSchema = z13.discriminatedUnion("type", [cronTriggerSchema, githubTriggerSchema, gitlabTriggerSchema]);
3457
+ var existingTriggerSchema = z13.custom(
3347
3458
  (value) => isRecord(value) && typeof value.type === "string" && isRecord(value.config),
3348
3459
  "must be an automation trigger"
3349
3460
  );
@@ -3351,22 +3462,22 @@ var carriedTriggerSchema = existingTriggerSchema.refine(
3351
3462
  (trigger) => !isEnvironmentSetupAuthoredTriggerType(trigger.type)
3352
3463
  );
3353
3464
  function automationSchema(limits) {
3354
- const authored = z12.object({
3355
- name: text(limits.nameChars),
3356
- description: text(limits.descriptionChars),
3357
- prompt: text(limits.automationPromptChars),
3465
+ const authored = z13.object({
3466
+ name: text2(limits.nameChars),
3467
+ description: text2(limits.descriptionChars),
3468
+ prompt: text2(limits.automationPromptChars),
3358
3469
  triggers: list(proposalTriggerSchema, limits.automationTriggers)
3359
3470
  });
3360
- const updated = authored.extend({ triggers: list(z12.union([proposalTriggerSchema, carriedTriggerSchema]), limits.automationTriggers) });
3361
- return z12.object({
3471
+ const updated = authored.extend({ triggers: list(z13.union([proposalTriggerSchema, carriedTriggerSchema]), limits.automationTriggers) });
3472
+ return z13.object({
3362
3473
  key: requiredText(limits.automationKeyChars),
3363
- action: z12.enum(ENVIRONMENT_SETUP_AUTOMATION_ACTIONS).default("create"),
3364
- automation_id: z12.string().regex(UUID_RE, "must be an automation id").nullable().default(null),
3365
- name: text().default(""),
3366
- description: optionalText().transform((value) => value ?? ""),
3367
- prompt: text().default(""),
3474
+ action: z13.enum(ENVIRONMENT_SETUP_AUTOMATION_ACTIONS).default("create"),
3475
+ automation_id: z13.string().regex(UUID_RE, "must be an automation id").nullable().default(null),
3476
+ name: text2().default(""),
3477
+ description: optionalText2().transform((value) => value ?? ""),
3478
+ prompt: text2().default(""),
3368
3479
  triggers: list(existingTriggerSchema).default([]),
3369
- note: optionalText(limits.automationNoteChars)
3480
+ note: optionalText2(limits.automationNoteChars)
3370
3481
  }).superRefine((automation, ctx) => {
3371
3482
  if (automation.action === "create" && automation.automation_id) {
3372
3483
  ctx.addIssue({ code: "custom", path: ["automation_id"], message: "belongs on an update, keep, or disable entry" });
@@ -3384,7 +3495,7 @@ function automationSchema(limits) {
3384
3495
  const content = (automation.action === "update" ? updated : authored).safeParse(automation);
3385
3496
  if (content.success) return { ...automation, ...content.data };
3386
3497
  for (const issue of content.error.issues) ctx.addIssue({ ...issue, code: "custom" });
3387
- return z12.NEVER;
3498
+ return z13.NEVER;
3388
3499
  });
3389
3500
  }
3390
3501
  function automationListSchema(limits) {
@@ -3402,8 +3513,8 @@ function automationListSchema(limits) {
3402
3513
  });
3403
3514
  }
3404
3515
  function environmentSchema(limits) {
3405
- return z12.object({
3406
- name: optionalText(limits.nameChars).transform((value) => value ?? void 0),
3516
+ return z13.object({
3517
+ name: optionalText2(limits.nameChars).transform((value) => value ?? void 0),
3407
3518
  description: clearableText(limits.descriptionChars),
3408
3519
  system_prompt: clearableText(limits.systemPromptChars),
3409
3520
  start_hook: clearableText(limits.hookChars),
@@ -3411,26 +3522,26 @@ function environmentSchema(limits) {
3411
3522
  });
3412
3523
  }
3413
3524
  function variableSchema(limits, requiredDefault) {
3414
- return z12.object({
3415
- key: z12.string().regex(VARIABLE_KEY_RE, "must be a valid environment variable name").max(limits.variableKeyChars ?? Number.POSITIVE_INFINITY),
3416
- description: optionalText(limits.variableDescriptionChars).transform((value) => value ?? ""),
3417
- required: z12.boolean().default(requiredDefault)
3525
+ return z13.object({
3526
+ key: z13.string().regex(VARIABLE_KEY_RE, "must be a valid environment variable name").max(limits.variableKeyChars ?? Number.POSITIVE_INFINITY),
3527
+ description: optionalText2(limits.variableDescriptionChars).transform((value) => value ?? ""),
3528
+ required: z13.boolean().default(requiredDefault)
3418
3529
  });
3419
3530
  }
3420
3531
  function proposalSchema(limits) {
3421
- return z12.object({
3532
+ return z13.object({
3422
3533
  summary: requiredText(limits.summaryChars),
3423
- stack: list(text(), limits.stackItems).default([]).transform((items) => items.filter(Boolean)),
3534
+ stack: list(text2(), limits.stackItems).default([]).transform((items) => items.filter(Boolean)),
3424
3535
  environment: environmentSchema(limits),
3425
3536
  variables: list(variableSchema(limits, false), limits.variables).default([]),
3426
3537
  automations: automationListSchema(limits),
3427
- verification: list(z12.object({
3538
+ verification: list(z13.object({
3428
3539
  label: requiredText(limits.nameChars),
3429
- status: z12.enum(ENVIRONMENT_SETUP_VERIFICATION_STATUSES),
3430
- detail: optionalText(limits.verificationDetailChars).transform((value) => value ?? void 0)
3540
+ status: z13.enum(ENVIRONMENT_SETUP_VERIFICATION_STATUSES),
3541
+ detail: optionalText2(limits.verificationDetailChars).transform((value) => value ?? void 0)
3431
3542
  }), limits.verificationItems).default([]),
3432
- media: list(z12.object({
3433
- media_id: z12.string().regex(UUID_RE, "must be a media id"),
3543
+ media: list(z13.object({
3544
+ media_id: z13.string().regex(UUID_RE, "must be a media id"),
3434
3545
  title: requiredText(limits.nameChars)
3435
3546
  }), limits.mediaItems).default([])
3436
3547
  });
@@ -3438,35 +3549,35 @@ function proposalSchema(limits) {
3438
3549
  var environmentSetupProposalSchema = proposalSchema({});
3439
3550
  var environmentSetupProposalSubmissionSchema = proposalSchema(ENVIRONMENT_SETUP_LIMITS);
3440
3551
  var environmentSetupVariableRequestSchema = variableSchema({}, false).extend({
3441
- status: z12.enum(["pending", "provided", "skipped"]),
3442
- requested_at: z12.string(),
3443
- resolved_at: z12.string().nullable().default(null)
3552
+ status: z13.enum(["pending", "provided", "skipped"]),
3553
+ requested_at: z13.string(),
3554
+ resolved_at: z13.string().nullable().default(null)
3444
3555
  });
3445
- var environmentSetupRunStateSchema = z12.object({
3446
- status: z12.enum(ENVIRONMENT_SETUP_RUN_STATUSES),
3447
- steps: z12.partialRecord(z12.enum(ENVIRONMENT_SETUP_STEPS.map((step) => step.key)), z12.enum(ENVIRONMENT_SETUP_STEP_STATUSES)).default({}),
3556
+ var environmentSetupRunStateSchema = z13.object({
3557
+ status: z13.enum(ENVIRONMENT_SETUP_RUN_STATUSES),
3558
+ steps: z13.partialRecord(z13.enum(ENVIRONMENT_SETUP_STEPS.map((step) => step.key)), z13.enum(ENVIRONMENT_SETUP_STEP_STATUSES)).default({}),
3448
3559
  proposal: environmentSetupProposalSchema.nullable().default(null),
3449
- applied: z12.object({
3450
- applied_at: z12.string(),
3451
- automation_ids: z12.array(z12.string())
3560
+ applied: z13.object({
3561
+ applied_at: z13.string(),
3562
+ automation_ids: z13.array(z13.string())
3452
3563
  }).nullable().default(null),
3453
- variable_requests: z12.array(environmentSetupVariableRequestSchema).default([])
3564
+ variable_requests: z13.array(environmentSetupVariableRequestSchema).default([])
3454
3565
  });
3455
- var applyEnvironmentSetupRequestSchema = z12.object({
3566
+ var applyEnvironmentSetupRequestSchema = z13.object({
3456
3567
  environment: environmentSchema(ENVIRONMENT_SETUP_LIMITS).extend({ name: requiredText(ENVIRONMENT_SETUP_LIMITS.nameChars) }),
3457
- variables: list(z12.object({ key: z12.string().regex(VARIABLE_KEY_RE), value: z12.string() }), ENVIRONMENT_SETUP_LIMITS.variables).default([]).refine((variables) => new Set(variables.map((variable) => variable.key)).size === variables.length, "must have unique keys").transform((variables) => variables.filter((variable) => variable.value.length > 0)),
3568
+ variables: list(z13.object({ key: z13.string().regex(VARIABLE_KEY_RE), value: z13.string() }), ENVIRONMENT_SETUP_LIMITS.variables).default([]).refine((variables) => new Set(variables.map((variable) => variable.key)).size === variables.length, "must have unique keys").transform((variables) => variables.filter((variable) => variable.value.length > 0)),
3458
3569
  automations: automationListSchema(ENVIRONMENT_SETUP_LIMITS)
3459
3570
  });
3460
- var requestEnvironmentSetupVariablesSchema = z12.object({
3571
+ var requestEnvironmentSetupVariablesSchema = z13.object({
3461
3572
  variables: list(variableSchema(ENVIRONMENT_SETUP_LIMITS, true), ENVIRONMENT_SETUP_LIMITS.variables).min(1, "must not be empty")
3462
3573
  }).superRefine(({ variables }, ctx) => {
3463
3574
  if (new Set(variables.map((variable) => variable.key)).size !== variables.length) {
3464
3575
  ctx.addIssue({ code: "custom", path: ["variables"], message: "must have unique keys" });
3465
3576
  }
3466
3577
  });
3467
- var respondEnvironmentSetupVariablesSchema = z12.object({
3468
- values: z12.record(z12.string().regex(VARIABLE_KEY_RE), z12.string()).default({}),
3469
- skipped: z12.array(z12.string().regex(VARIABLE_KEY_RE)).default([])
3578
+ var respondEnvironmentSetupVariablesSchema = z13.object({
3579
+ values: z13.record(z13.string().regex(VARIABLE_KEY_RE), z13.string()).default({}),
3580
+ skipped: z13.array(z13.string().regex(VARIABLE_KEY_RE)).default([])
3470
3581
  });
3471
3582
 
3472
3583
  // ../shared/src/default-skills/replicas-agent/abilities/environment-setup.ts
@@ -5204,16 +5315,16 @@ var DEFAULT_WORKSPACE_FILTERS = {
5204
5315
  activity: "any"
5205
5316
  };
5206
5317
  var ONE_DAY_MS = 24 * 60 * 60 * 1e3;
5207
- var workspaceExecRequestSchema = z13.object({
5208
- command: z13.string().regex(/\S/, "command is required"),
5209
- timeout_seconds: z13.number().int().min(1).max(50).optional().describe("Default: 30")
5318
+ var workspaceExecRequestSchema = z14.object({
5319
+ command: z14.string().regex(/\S/, "command is required"),
5320
+ timeout_seconds: z14.number().int().min(1).max(50).optional().describe("Default: 30")
5210
5321
  });
5211
- var terminalRtcCandidateSchema = z13.object({ type: z13.literal("rtc-candidate"), candidate: z13.string(), mid: z13.string() });
5212
- var terminalSocketServerMessageSchema = z13.discriminatedUnion("type", [
5213
- z13.object({ type: z13.literal("output"), data: z13.string() }),
5214
- z13.object({ type: z13.literal("rtc-answer"), sdp: z13.string() }),
5322
+ var terminalRtcCandidateSchema = z14.object({ type: z14.literal("rtc-candidate"), candidate: z14.string(), mid: z14.string() });
5323
+ var terminalSocketServerMessageSchema = z14.discriminatedUnion("type", [
5324
+ z14.object({ type: z14.literal("output"), data: z14.string() }),
5325
+ z14.object({ type: z14.literal("rtc-answer"), sdp: z14.string() }),
5215
5326
  terminalRtcCandidateSchema,
5216
- z13.object({ type: z13.literal("rtc-switch") })
5327
+ z14.object({ type: z14.literal("rtc-switch") })
5217
5328
  ]);
5218
5329
  var TERMINAL_RTC_ICE_SERVER = "stun:stun.l.google.com:19302";
5219
5330
 
@@ -5238,41 +5349,41 @@ var REPLICAS_MCP_TOOLS = {
5238
5349
  archiveSubagent: "archive_subagent",
5239
5350
  waitForSubagents: "wait_for_subagents"
5240
5351
  };
5241
- var automationToolInputSchema = z14.object({
5242
- name: z14.string().describe("Short automation name."),
5243
- prompt: z14.string().describe("Prompt each automation run starts with."),
5244
- environment_id: z14.string().describe(`Environment id from \`${REPLICAS_MCP_TOOLS.listEnvironments}\`.`),
5245
- triggers: z14.array(automationTriggerSchema).min(1).describe(
5352
+ var automationToolInputSchema = z15.object({
5353
+ name: z15.string().describe("Short automation name."),
5354
+ prompt: z15.string().describe("Prompt each automation run starts with."),
5355
+ environment_id: z15.string().describe(`Environment id from \`${REPLICAS_MCP_TOOLS.listEnvironments}\`.`),
5356
+ triggers: z15.array(automationTriggerSchema).min(1).describe(
5246
5357
  'One or more triggers. Cron: `{ "type": "cron", "config": { "schedule": "0 9 * * 1", "timezone": "America/New_York" } }`. GitHub: `{ "type": "github", "config": { "event": "pull_request.opened", "repository_ids": ["<repository uuid>"] } }`.'
5247
5358
  ),
5248
- description: z14.string().optional().describe("One-line summary shown in the dashboard."),
5249
- plan_mode: z14.boolean().optional(),
5250
- goal_mode: z14.boolean().optional(),
5251
- fast_mode: z14.boolean().optional()
5359
+ description: z15.string().optional().describe("One-line summary shown in the dashboard."),
5360
+ plan_mode: z15.boolean().optional(),
5361
+ goal_mode: z15.boolean().optional(),
5362
+ fast_mode: z15.boolean().optional()
5252
5363
  });
5253
5364
  var automationCreateToolInputSchema = automationToolInputSchema.extend({
5254
- scope: z14.enum(["org", "user"]).optional().describe("`org` (default) or `user` for a personal automation, which needs a personal API key.")
5365
+ scope: z15.enum(["org", "user"]).optional().describe("`org` (default) or `user` for a personal automation, which needs a personal API key.")
5255
5366
  });
5256
5367
  var automationUpdateToolInputSchema = automationToolInputSchema.partial().extend({
5257
- automation_id: z14.string().describe("Automation ID"),
5258
- enabled: z14.boolean().optional(),
5259
- agent_provider: z14.enum(AGENT).nullable().optional(),
5260
- model: z14.string().nullable().optional(),
5261
- thinking_level: z14.enum(VALID_THINKING_LEVELS).nullable().optional(),
5262
- workspace_lifecycle_policy: z14.enum(VALID_LIFECYCLE_POLICIES).optional(),
5263
- workspace_size: z14.enum(WORKSPACE_SIZES).optional()
5368
+ automation_id: z15.string().describe("Automation ID"),
5369
+ enabled: z15.boolean().optional(),
5370
+ agent_provider: z15.enum(AGENT).nullable().optional(),
5371
+ model: z15.string().nullable().optional(),
5372
+ thinking_level: z15.enum(VALID_THINKING_LEVELS).nullable().optional(),
5373
+ workspace_lifecycle_policy: z15.enum(VALID_LIFECYCLE_POLICIES).optional(),
5374
+ workspace_size: z15.enum(WORKSPACE_SIZES).optional()
5264
5375
  });
5265
- var chatPath = { id: z14.string().describe("Workspace ID"), chat_id: z14.string().describe("Chat ID") };
5376
+ var chatPath = { id: z15.string().describe("Workspace ID"), chat_id: z15.string().describe("Chat ID") };
5266
5377
  var { provider, model, thinkingLevel, title, message } = forkChatRequestSchema.shape;
5267
- var createChatToolInputSchema = z14.object({ id: chatPath.id, provider, title: createChatRequestSchema.shape.title });
5268
- var forkChatToolInputSchema = z14.object({ ...chatPath, provider, model, thinking_level: thinkingLevel, title, message });
5269
- var renameChatToolInputSchema = z14.object({ ...chatPath, display_name: updateChatDisplayNameRequestSchema.shape.displayName });
5270
- var runCommandToolInputSchema = z14.object({ id: chatPath.id, ...workspaceExecRequestSchema.shape });
5271
- var environmentMcpPath = { environment_id: z14.string().describe("Environment ID") };
5272
- var createEnvironmentMcpToolInputSchema = z14.object({ ...environmentMcpPath, ...createEnvironmentMcpRequestSchema.shape });
5273
- var updateEnvironmentMcpToolInputSchema = z14.object({
5378
+ var createChatToolInputSchema = z15.object({ id: chatPath.id, provider, title: createChatRequestSchema.shape.title });
5379
+ var forkChatToolInputSchema = z15.object({ ...chatPath, provider, model, thinking_level: thinkingLevel, title, message });
5380
+ var renameChatToolInputSchema = z15.object({ ...chatPath, display_name: updateChatDisplayNameRequestSchema.shape.displayName });
5381
+ var runCommandToolInputSchema = z15.object({ id: chatPath.id, ...workspaceExecRequestSchema.shape });
5382
+ var environmentMcpPath = { environment_id: z15.string().describe("Environment ID") };
5383
+ var createEnvironmentMcpToolInputSchema = z15.object({ ...environmentMcpPath, ...createEnvironmentMcpRequestSchema.shape });
5384
+ var updateEnvironmentMcpToolInputSchema = z15.object({
5274
5385
  ...environmentMcpPath,
5275
- mcp_id: z14.string().describe("MCP ID"),
5386
+ mcp_id: z15.string().describe("MCP ID"),
5276
5387
  ...updateEnvironmentMcpRequestSchema.shape
5277
5388
  });
5278
5389
 
@@ -5338,12 +5449,12 @@ function wrapInTag(content, tag) {
5338
5449
  ${content}
5339
5450
  </${tag}>`;
5340
5451
  }
5341
- function removeTag(text2, tag) {
5452
+ function removeTag(text3, tag) {
5342
5453
  const regex = new RegExp(`<${tag}>[\\s\\S]*?</${tag}>`, "g");
5343
- return text2.replace(regex, "").trim();
5454
+ return text3.replace(regex, "").trim();
5344
5455
  }
5345
- function removeReplicasInstructions(text2) {
5346
- return removeTag(text2, REPLICAS_INSTRUCTIONS_TAG);
5456
+ function removeReplicasInstructions(text3) {
5457
+ return removeTag(text3, REPLICAS_INSTRUCTIONS_TAG);
5347
5458
  }
5348
5459
  var MULTITASK_INSTRUCTIONS_BLOCK = new RegExp(`\\s*<${MULTITASK_INSTRUCTIONS_TAG}>\\n([\\s\\S]*?)\\n</${MULTITASK_INSTRUCTIONS_TAG}>`);
5349
5460
  function splitMultitaskInstructions(customInstructions) {
@@ -5357,23 +5468,23 @@ function splitMultitaskInstructions(customInstructions) {
5357
5468
  // ../shared/src/multitask-events.ts
5358
5469
  var MULTITASK_EVENT_KINDS = ["finished", "ready", "needs_attention", "merged", "closed", "archived"];
5359
5470
  var MULTITASK_EVENT_TYPE = "multitask-event";
5360
- var multitaskEventSchema = z15.object({
5361
- id: z15.string(),
5362
- at: z15.string(),
5363
- kind: z15.enum(MULTITASK_EVENT_KINDS),
5364
- agentId: z15.string(),
5365
- agentName: z15.string(),
5366
- summary: z15.string(),
5367
- detail: z15.string().optional(),
5471
+ var multitaskEventSchema = z16.object({
5472
+ id: z16.string(),
5473
+ at: z16.string(),
5474
+ kind: z16.enum(MULTITASK_EVENT_KINDS),
5475
+ agentId: z16.string(),
5476
+ agentName: z16.string(),
5477
+ summary: z16.string(),
5478
+ detail: z16.string().optional(),
5368
5479
  // Already shown as a row when it happened, so the delivered message does not show it again.
5369
- noticed: z15.boolean().optional()
5480
+ noticed: z16.boolean().optional()
5370
5481
  });
5371
5482
  var TAG = "multitask_event";
5372
5483
  var BLOCK = new RegExp(`<${TAG}((?:\\s+\\w+="[^"]*")*)>\\n?([\\s\\S]*?)\\n?</${TAG}>`, "g");
5373
5484
  var ATTRIBUTE = /(\w+)="([^"]*)"/g;
5374
5485
  var unescapeAttribute = (value) => value.replace(/&lt;/g, "<").replace(/&quot;/g, '"').replace(/&amp;/g, "&");
5375
- function extractMultitaskEvents(text2) {
5376
- return [...text2.matchAll(BLOCK)].flatMap((match) => {
5486
+ function extractMultitaskEvents(text3) {
5487
+ return [...text3.matchAll(BLOCK)].flatMap((match) => {
5377
5488
  const attributes = Object.fromEntries([...match[1].matchAll(ATTRIBUTE)].map(([, key, value]) => [key, unescapeAttribute(value)]));
5378
5489
  const kind = MULTITASK_EVENT_KINDS.find((candidate) => candidate === attributes.kind);
5379
5490
  if (!kind || !attributes.id || !attributes.agent_id) return [];
@@ -5391,13 +5502,13 @@ function extractMultitaskEvents(text2) {
5391
5502
  }];
5392
5503
  });
5393
5504
  }
5394
- function parseMultitaskEvents(text2) {
5395
- const events = extractMultitaskEvents(text2);
5396
- return events.length > 0 && text2.replace(BLOCK, "").replaceAll(MERGED_MESSAGE_SEPARATOR.trim(), "").trim() === "" ? events : null;
5505
+ function parseMultitaskEvents(text3) {
5506
+ const events = extractMultitaskEvents(text3);
5507
+ return events.length > 0 && text3.replace(BLOCK, "").replaceAll(MERGED_MESSAGE_SEPARATOR.trim(), "").trim() === "" ? events : null;
5397
5508
  }
5398
5509
 
5399
5510
  // ../shared/src/learned-skills.ts
5400
- import { z as z16 } from "zod";
5511
+ import { z as z17 } from "zod";
5401
5512
 
5402
5513
  // ../shared/src/frontmatter.ts
5403
5514
  import { parse as parseYaml } from "yaml";
@@ -5420,20 +5531,20 @@ function parseFrontmatter(content) {
5420
5531
  var LEARNED_SKILLS_ROOT = `${SANDBOX_PATHS.REPLICAS_DIR}/learned-skills`;
5421
5532
  var LEARNED_SKILLS_MANIFEST_PATH = `${LEARNED_SKILLS_ROOT}/manifest.json`;
5422
5533
  var LEARNED_SKILL_DIR_PREFIX = "replicas-learned__";
5423
- var learnedSkillsManifestSchema = z16.object({
5424
- skills: z16.array(z16.object({ name: z16.string(), sha256: z16.string() }))
5534
+ var learnedSkillsManifestSchema = z17.object({
5535
+ skills: z17.array(z17.object({ name: z17.string(), sha256: z17.string() }))
5425
5536
  });
5426
- var dreamVerdictChecksSchema = z16.object({
5427
- repeatable: z16.boolean(),
5428
- realInstruction: z16.boolean(),
5429
- noContradiction: z16.boolean(),
5430
- formatExact: z16.boolean(),
5431
- humanOnly: z16.boolean(),
5432
- actionable: z16.boolean(),
5433
- durable: z16.boolean()
5537
+ var dreamVerdictChecksSchema = z17.object({
5538
+ repeatable: z17.boolean(),
5539
+ realInstruction: z17.boolean(),
5540
+ noContradiction: z17.boolean(),
5541
+ formatExact: z17.boolean(),
5542
+ humanOnly: z17.boolean(),
5543
+ actionable: z17.boolean(),
5544
+ durable: z17.boolean()
5434
5545
  });
5435
5546
  var DREAM_VERDICT_CHECKS = dreamVerdictChecksSchema.keyof().options;
5436
- var dreamVerdictSchema = dreamVerdictChecksSchema.extend({ approve: z16.boolean(), reason: z16.string() });
5547
+ var dreamVerdictSchema = dreamVerdictChecksSchema.extend({ approve: z17.boolean(), reason: z17.string() });
5437
5548
  var learnedSkillFormatInstruction = (speaker) => `Write a SKILL.md whose frontmatter has a kebab-case \`name\` and a short \`description\` that starts with "Use when" and names the situations it applies to; the body records only what ${speaker} actually said, restated as a direct instruction, usually one to three lines. Every line of a learning is loaded into future sessions, so leave out anything an agent could infer on its own: no headings, explanations, rules, or examples unless ${speaker} stated those specifics themselves. For "from now on, use Conventional Commits", the body is just "Use Conventional Commits for every commit message and PR title."`;
5438
5549
 
5439
5550
  // ../shared/src/user-message-matching.ts
@@ -5681,9 +5792,9 @@ function describeToolCall(message2, base) {
5681
5792
  var ATTACHMENT_PLACEHOLDER_REGEX = /^\[\d+ (?:(?:images?|files?)(?: and \d+ files?)? attached|(?:image )?attachments?)\]$/;
5682
5793
  var WALKTHROUGH_NOTE_REGEX = /(?:^|\n\n)<replicas_walkthrough path="([^"\n]+)" duration_seconds="(\d+)" audio="(true|false)">\n[^<]*\n<\/replicas_walkthrough>$/;
5683
5794
  var TRUNCATED_WALKTHROUGH_NOTE_REGEX = /(?:^|\n\n)<replicas_walkthrough path="([^"\n]*)(?:" duration_seconds="(\d*))?(?:" audio="(true)?)?[^<]*(?:<\/?[a-z_]*)?$/;
5684
- function stripAttachmentNote(text2) {
5685
- const match = text2.match(/(?:^|\n\n)<replicas_attachments>\nUploaded files are available at:((?:\n- .*)*)(?:\n<\/?[a-z_]*>?)?$/) ?? text2.match(/(?:^|\n\n)Uploaded files are available at:((?:\n- .*)*)$/);
5686
- let content = match ? text2.replace(match[0], "").trim() : text2;
5795
+ function stripAttachmentNote(text3) {
5796
+ const match = text3.match(/(?:^|\n\n)<replicas_attachments>\nUploaded files are available at:((?:\n- .*)*)(?:\n<\/?[a-z_]*>?)?$/) ?? text3.match(/(?:^|\n\n)Uploaded files are available at:((?:\n- .*)*)$/);
5797
+ let content = match ? text3.replace(match[0], "").trim() : text3;
5687
5798
  const walkthroughs = [];
5688
5799
  const truncated = WALKTHROUGH_NOTE_REGEX.test(content) ? null : content.match(TRUNCATED_WALKTHROUGH_NOTE_REGEX);
5689
5800
  if (truncated) {
@@ -5742,7 +5853,7 @@ function messagesForCodexTurn(turn) {
5742
5853
  return [{
5743
5854
  type: "reasoning",
5744
5855
  id: turn.id,
5745
- text: reasoning.map(({ text: text2 }) => text2.trim()).join("\n\n"),
5856
+ text: reasoning.map(({ text: text3 }) => text3.trim()).join("\n\n"),
5746
5857
  timestamp: reasoning[0].timestamp,
5747
5858
  status: reasoning.at(-1)?.status ?? "completed"
5748
5859
  }];
@@ -6219,8 +6330,8 @@ function getCursorAssistantText(event) {
6219
6330
  return getTextContent(message2?.content);
6220
6331
  }
6221
6332
  function getCursorThinkingText(event) {
6222
- const text2 = event.payload.text;
6223
- if (typeof text2 === "string") return text2;
6333
+ const text3 = event.payload.text;
6334
+ if (typeof text3 === "string") return text3;
6224
6335
  const message2 = isRecord(event.payload.message) ? event.payload.message : null;
6225
6336
  return typeof message2?.text === "string" ? message2.text : "";
6226
6337
  }
@@ -6271,8 +6382,8 @@ function parseCursorEvents(events) {
6271
6382
  continue;
6272
6383
  }
6273
6384
  if (event.type === "cursor-assistant") {
6274
- const text2 = getCursorAssistantText(event);
6275
- if (text2) {
6385
+ const text3 = getCursorAssistantText(event);
6386
+ if (text3) {
6276
6387
  const runId = cursorRunId(event);
6277
6388
  if (!activeAssistant || activeAssistant.runId !== runId) {
6278
6389
  const segment = runAssistantSegments.get(runId) ?? 0;
@@ -6291,15 +6402,15 @@ function parseCursorEvents(events) {
6291
6402
  if (message2?.type === "agent") {
6292
6403
  messages[activeAssistant.index] = {
6293
6404
  ...message2,
6294
- content: `${message2.content}${text2}`
6405
+ content: `${message2.content}${text3}`
6295
6406
  };
6296
6407
  }
6297
6408
  }
6298
6409
  continue;
6299
6410
  }
6300
6411
  if (event.type === "cursor-thinking") {
6301
- const text2 = getCursorThinkingText(event);
6302
- if (text2.trim()) {
6412
+ const text3 = getCursorThinkingText(event);
6413
+ if (text3.trim()) {
6303
6414
  const runId = cursorRunId(event);
6304
6415
  if (!activeThinking || activeThinking.runId !== runId) {
6305
6416
  const segment = runThinkingSegments.get(runId) ?? 0;
@@ -6319,7 +6430,7 @@ function parseCursorEvents(events) {
6319
6430
  if (message2?.type === "reasoning") {
6320
6431
  messages[activeThinking.index] = {
6321
6432
  ...message2,
6322
- content: `${message2.content}${text2}`,
6433
+ content: `${message2.content}${text3}`,
6323
6434
  status: "in_progress"
6324
6435
  };
6325
6436
  }
@@ -6351,12 +6462,12 @@ function parseCursorEvents(events) {
6351
6462
  }
6352
6463
  if (event.type === "cursor-task") {
6353
6464
  activeAssistant = null;
6354
- const text2 = event.payload.text;
6355
- if (typeof text2 === "string" && text2.trim()) {
6465
+ const text3 = event.payload.text;
6466
+ if (typeof text3 === "string" && text3.trim()) {
6356
6467
  messages.push({
6357
6468
  id: `cursor-task-${event.timestamp}-${messages.length}`,
6358
6469
  type: "agent",
6359
- content: text2,
6470
+ content: text3,
6360
6471
  timestamp: event.timestamp
6361
6472
  });
6362
6473
  }
@@ -6442,8 +6553,8 @@ function extractErrorText(error) {
6442
6553
  collect(error);
6443
6554
  return parts.filter(Boolean).join("\n");
6444
6555
  }
6445
- function isTransientErrorText(text2, options = {}) {
6446
- const normalized = text2.toLowerCase();
6556
+ function isTransientErrorText(text3, options = {}) {
6557
+ const normalized = text3.toLowerCase();
6447
6558
  if (!normalized) return false;
6448
6559
  if (TRANSIENT_NETWORK_ERROR_PATTERNS.some((pattern) => pattern.test(normalized))) return true;
6449
6560
  if (options.includeRateLimit && /rate limit/.test(normalized)) return true;
@@ -6566,24 +6677,24 @@ function parseOpencodeEvents(events) {
6566
6677
  const time = isRecord(part.time) ? part.time : null;
6567
6678
  const timestamp = timestampFromMs(time?.start, event.timestamp);
6568
6679
  if (part.type === "text") {
6569
- const text2 = typeof part.text === "string" ? part.text : "";
6570
- if (text2.trim()) {
6680
+ const text3 = typeof part.text === "string" ? part.text : "";
6681
+ if (text3.trim()) {
6571
6682
  upsertDisplayMessage(messages, {
6572
6683
  id,
6573
6684
  type: "agent",
6574
- content: text2,
6685
+ content: text3,
6575
6686
  timestamp
6576
6687
  });
6577
6688
  }
6578
6689
  continue;
6579
6690
  }
6580
6691
  if (part.type === "reasoning") {
6581
- const text2 = typeof part.text === "string" ? part.text : "";
6582
- if (text2.trim()) {
6692
+ const text3 = typeof part.text === "string" ? part.text : "";
6693
+ if (text3.trim()) {
6583
6694
  upsertDisplayMessage(messages, {
6584
6695
  id,
6585
6696
  type: "reasoning",
6586
- content: text2,
6697
+ content: text3,
6587
6698
  status: time?.end ? "completed" : "in_progress",
6588
6699
  timestamp
6589
6700
  });
@@ -6751,7 +6862,7 @@ function assistantErrorMessage(value) {
6751
6862
  }
6752
6863
  function parsePiEvents(events) {
6753
6864
  const messages = [];
6754
- const text2 = /* @__PURE__ */ new Map();
6865
+ const text3 = /* @__PURE__ */ new Map();
6755
6866
  const thinking = /* @__PURE__ */ new Map();
6756
6867
  let activeMessageId = "assistant";
6757
6868
  for (const event of events) {
@@ -6782,9 +6893,9 @@ function parsePiEvents(events) {
6782
6893
  if (event.type === "pi-message_update") {
6783
6894
  const payload = nestedPayload(event);
6784
6895
  const id = typeof payload.id === "string" ? payload.id : activeMessageId;
6785
- if (payload.type === "text_delta" && typeof payload.delta === "string") text2.set(id, `${text2.get(id) ?? ""}${payload.delta}`);
6896
+ if (payload.type === "text_delta" && typeof payload.delta === "string") text3.set(id, `${text3.get(id) ?? ""}${payload.delta}`);
6786
6897
  if (payload.type === "thinking_delta" && typeof payload.delta === "string") thinking.set(id, `${thinking.get(id) ?? ""}${payload.delta}`);
6787
- const textContent = text2.get(id);
6898
+ const textContent = text3.get(id);
6788
6899
  const thinkingContent = thinking.get(id);
6789
6900
  if (textContent !== void 0) upsertDisplayMessage(messages, { id: `pi-${id}`, type: "agent", content: textContent, timestamp: event.timestamp });
6790
6901
  if (thinkingContent !== void 0) upsertDisplayMessage(messages, { id: `pi-thinking-${id}`, type: "reasoning", content: thinkingContent, status: "in_progress", timestamp: event.timestamp });
@@ -7803,7 +7914,7 @@ var SECRET_PATTERNS = [
7803
7914
  /\b[A-Z][A-Z0-9_]*(?:KEY|TOKEN|SECRET|PASSWORD)\s*=\s*[^\s]{12,}/g
7804
7915
  ];
7805
7916
  function redactSecrets(value) {
7806
- return SECRET_PATTERNS.reduce((text2, pattern) => text2.replace(pattern, "[REDACTED]"), value);
7917
+ return SECRET_PATTERNS.reduce((text3, pattern) => text3.replace(pattern, "[REDACTED]"), value);
7807
7918
  }
7808
7919
 
7809
7920
  // ../shared/src/transcript-canonicalize.ts
@@ -7920,99 +8031,6 @@ var GENERIC_CHAT_TITLE = new RegExp(
7920
8031
  "iu"
7921
8032
  );
7922
8033
 
7923
- // ../shared/src/languages.ts
7924
- var EXT_TO_LANGUAGE = {
7925
- ".ts": "typescript",
7926
- ".tsx": "tsx",
7927
- ".mts": "typescript",
7928
- ".cts": "typescript",
7929
- ".js": "javascript",
7930
- ".jsx": "jsx",
7931
- ".mjs": "javascript",
7932
- ".cjs": "javascript",
7933
- ".py": "python",
7934
- ".pyw": "python",
7935
- ".pyi": "python",
7936
- ".rs": "rust",
7937
- ".go": "go",
7938
- ".rb": "ruby",
7939
- ".rake": "ruby",
7940
- ".java": "java",
7941
- ".kt": "kotlin",
7942
- ".kts": "kotlin",
7943
- ".scala": "scala",
7944
- ".swift": "swift",
7945
- ".m": "objectivec",
7946
- ".mm": "objectivec",
7947
- ".c": "c",
7948
- ".cpp": "cpp",
7949
- ".cc": "cpp",
7950
- ".cxx": "cpp",
7951
- ".h": "c",
7952
- ".hpp": "cpp",
7953
- ".hh": "cpp",
7954
- ".hxx": "cpp",
7955
- ".cs": "csharp",
7956
- ".vb": "vbnet",
7957
- ".fs": "fsharp",
7958
- ".php": "php",
7959
- ".phtml": "php",
7960
- ".css": "css",
7961
- ".scss": "scss",
7962
- ".sass": "sass",
7963
- ".less": "less",
7964
- ".html": "html",
7965
- ".htm": "html",
7966
- ".vue": "vue",
7967
- ".svelte": "svelte",
7968
- ".xml": "xml",
7969
- ".svg": "xml",
7970
- ".json": "json",
7971
- ".json5": "json5",
7972
- ".yaml": "yaml",
7973
- ".yml": "yaml",
7974
- ".toml": "toml",
7975
- ".ini": "ini",
7976
- ".md": "markdown",
7977
- ".markdown": "markdown",
7978
- ".mmd": "mermaid",
7979
- ".mermaid": "mermaid",
7980
- ".sql": "sql",
7981
- ".sh": "bash",
7982
- ".bash": "bash",
7983
- ".zsh": "bash",
7984
- ".fish": "bash",
7985
- ".dockerfile": "dockerfile",
7986
- ".graphql": "graphql",
7987
- ".proto": "protobuf",
7988
- ".r": "r",
7989
- ".lua": "lua",
7990
- ".dart": "dart",
7991
- ".zig": "zig",
7992
- ".ex": "elixir",
7993
- ".exs": "elixir",
7994
- ".erl": "erlang",
7995
- ".hs": "haskell",
7996
- ".ml": "ocaml",
7997
- ".clj": "clojure",
7998
- ".cljs": "clojure",
7999
- ".pl": "perl",
8000
- ".perl": "perl",
8001
- ".elm": "elm",
8002
- ".lisp": "lisp"
8003
- };
8004
- function detectLanguageByPath(filePath) {
8005
- const dot = filePath.lastIndexOf(".");
8006
- if (dot === -1) {
8007
- const basename = filePath.split("/").pop() ?? "";
8008
- if (basename === "Dockerfile") return "dockerfile";
8009
- if (basename === "Makefile") return "makefile";
8010
- return null;
8011
- }
8012
- const ext = filePath.slice(dot).toLowerCase();
8013
- return EXT_TO_LANGUAGE[ext] ?? null;
8014
- }
8015
-
8016
8034
  // ../shared/src/context-usage.ts
8017
8035
  function isRecord2(value) {
8018
8036
  return typeof value === "object" && value !== null;
@@ -8441,24 +8459,24 @@ function clampWarmHookTimeoutMs(timeoutMs) {
8441
8459
  }
8442
8460
  return Math.min(timeoutMs, MAX_WARM_HOOK_TIMEOUT_MS);
8443
8461
  }
8444
- function buildOutputPreview(text2, {
8462
+ function buildOutputPreview(text3, {
8445
8463
  maxChars = DEFAULT_HOOK_OUTPUT_PREVIEW_CHARS,
8446
8464
  truncateFrom = "head",
8447
8465
  marker = "\n...[truncated \u2014 download the full log to see the rest]"
8448
8466
  } = {}) {
8449
- if (text2.length <= maxChars) {
8450
- return { output: text2, outputTruncated: false, outputTotalChars: text2.length };
8467
+ if (text3.length <= maxChars) {
8468
+ return { output: text3, outputTruncated: false, outputTotalChars: text3.length };
8451
8469
  }
8452
8470
  const previewChars = Math.max(0, maxChars - marker.length);
8453
- const output = previewChars === 0 ? marker.slice(0, maxChars) : truncateFrom === "tail" ? `${marker}${text2.slice(-previewChars)}` : `${text2.slice(0, previewChars)}${marker}`;
8471
+ const output = previewChars === 0 ? marker.slice(0, maxChars) : truncateFrom === "tail" ? `${marker}${text3.slice(-previewChars)}` : `${text3.slice(0, previewChars)}${marker}`;
8454
8472
  return {
8455
8473
  output,
8456
8474
  outputTruncated: true,
8457
- outputTotalChars: text2.length
8475
+ outputTotalChars: text3.length
8458
8476
  };
8459
8477
  }
8460
- function buildHookOutputPreview(text2, maxChars = DEFAULT_HOOK_OUTPUT_PREVIEW_CHARS) {
8461
- return buildOutputPreview(text2, { maxChars });
8478
+ function buildHookOutputPreview(text3, maxChars = DEFAULT_HOOK_OUTPUT_PREVIEW_CHARS) {
8479
+ return buildOutputPreview(text3, { maxChars });
8462
8480
  }
8463
8481
  function parseWarmHookConfig(value, filename = "replicas.json") {
8464
8482
  if (typeof value === "string") {
@@ -8549,14 +8567,14 @@ var AUTHENTICATION_ERROR_PATTERNS = [
8549
8567
  /authentication error/,
8550
8568
  /invalid api key/
8551
8569
  ];
8552
- function isAuthenticationErrorText(text2, extraPatterns = []) {
8553
- const normalized = text2.toLowerCase();
8570
+ function isAuthenticationErrorText(text3, extraPatterns = []) {
8571
+ const normalized = text3.toLowerCase();
8554
8572
  return AUTHENTICATION_ERROR_PATTERNS.some((pattern) => pattern.test(normalized)) || extraPatterns.some((pattern) => pattern.test(normalized));
8555
8573
  }
8556
8574
 
8557
8575
  // ../shared/src/claude-auth.ts
8558
- function isClaudeAuthErrorText(text2) {
8559
- const lower = text2.toLowerCase();
8576
+ function isClaudeAuthErrorText(text3) {
8577
+ const lower = text3.toLowerCase();
8560
8578
  return lower.includes("failed to authenticate") || lower.includes("authentication_error") || lower.includes("authentication_failed") || lower.includes("authentication failed") || lower.includes("invalid authentication credentials") || lower.includes("not logged in") || lower.includes("please run /login") || lower.includes("401") && lower.includes("authentic");
8561
8579
  }
8562
8580
 
@@ -8749,7 +8767,7 @@ var CLAUDE_AUTH_ENV_KEYS_BY_METHOD = {
8749
8767
  };
8750
8768
 
8751
8769
  // ../shared/src/routes/command-protection.ts
8752
- import { z as z17 } from "zod";
8770
+ import { z as z18 } from "zod";
8753
8771
 
8754
8772
  // ../shared/src/git-invocations.ts
8755
8773
  var COMMIT_VALUE_OPTIONS = /* @__PURE__ */ new Set(["message", "file", "trailer", "reuse-message", "reedit-message", "fixup", "squash", "template", "author", "date", "cleanup", "pathspec-from-file"]);
@@ -8840,27 +8858,27 @@ function findCheckoutTarget(args) {
8840
8858
  }
8841
8859
 
8842
8860
  // ../shared/src/routes/command-protection.ts
8843
- var commandProtectionRepoStateSchema = z17.object({
8844
- branch: z17.string().nullable(),
8845
- defaultBranch: z17.string().nullable(),
8846
- pushBranch: z17.string().nullable(),
8847
- pushConfig: z17.string().nullable(),
8848
- headMessage: z17.string().nullable(),
8849
- mergeInProgress: z17.boolean().optional()
8861
+ var commandProtectionRepoStateSchema = z18.object({
8862
+ branch: z18.string().nullable(),
8863
+ defaultBranch: z18.string().nullable(),
8864
+ pushBranch: z18.string().nullable(),
8865
+ pushConfig: z18.string().nullable(),
8866
+ headMessage: z18.string().nullable(),
8867
+ mergeInProgress: z18.boolean().optional()
8850
8868
  });
8851
- var commandProtectionEvaluateRequestSchema = z17.object({
8852
- provider: z17.enum(["claude", "codex", "cursor", "opencode", "pi"]),
8853
- source: z17.enum(["claude_pre_tool_use", "codex_approval_request", "cursor_pre_tool_use", "opencode_pre_tool_use", "pi_tool_call"]),
8854
- toolName: z17.string(),
8855
- toolInput: z17.unknown(),
8856
- command: z17.string().nullish(),
8857
- cwd: z17.string().nullish(),
8858
- toolUseId: z17.string().nullish(),
8869
+ var commandProtectionEvaluateRequestSchema = z18.object({
8870
+ provider: z18.enum(["claude", "codex", "cursor", "opencode", "pi"]),
8871
+ source: z18.enum(["claude_pre_tool_use", "codex_approval_request", "cursor_pre_tool_use", "opencode_pre_tool_use", "pi_tool_call"]),
8872
+ toolName: z18.string(),
8873
+ toolInput: z18.unknown(),
8874
+ command: z18.string().nullish(),
8875
+ cwd: z18.string().nullish(),
8876
+ toolUseId: z18.string().nullish(),
8859
8877
  // Read by the engine before the command runs, keyed by absolute path, so the
8860
8878
  // policy can see branches and commit messages the command text only references.
8861
- gitContext: z17.object({
8862
- repos: z17.record(z17.string(), commandProtectionRepoStateSchema),
8863
- messageFiles: z17.record(z17.string(), z17.string())
8879
+ gitContext: z18.object({
8880
+ repos: z18.record(z18.string(), commandProtectionRepoStateSchema),
8881
+ messageFiles: z18.record(z18.string(), z18.string())
8864
8882
  }).optional()
8865
8883
  });
8866
8884
  var COMMAND_PROTECTION_COMMAND_KEYS = ["command", "cmd", "script", "query", "endpoint", "path", "url", "mutation"];
@@ -8873,8 +8891,8 @@ function stringifyCommandProtectionInput(value) {
8873
8891
  return String(value);
8874
8892
  }
8875
8893
  }
8876
- function normalizeCommandProtectionText(text2) {
8877
- return text2.replace(/\\\n/g, " ").replace(/\s+/g, " ").trim().toLowerCase();
8894
+ function normalizeCommandProtectionText(text3) {
8895
+ return text3.replace(/\\\n/g, " ").replace(/\s+/g, " ").trim().toLowerCase();
8878
8896
  }
8879
8897
  function extractCommandProtectionCommandText(request, options = {}) {
8880
8898
  if (request.command && request.command.trim()) return request.command;
@@ -8998,7 +9016,7 @@ function isPrMergeCommand(argv) {
8998
9016
  const method = /(?:^|\s)(?:-X\s*|--method[\s=])(\w+)/i.exec(args.join(" "))?.[1];
8999
9017
  return words[0] === "api" && method?.toUpperCase() === "PUT" && words.some((word) => /\/(?:pulls|merge_requests)\/[^/]+\/merge$/.test(word));
9000
9018
  }
9001
- var matchingChecks = (checks, text2) => checks.flatMap(([name, pattern]) => pattern.test(text2) ? [name] : []);
9019
+ var matchingChecks = (checks, text3) => checks.flatMap(([name, pattern]) => pattern.test(text3) ? [name] : []);
9002
9020
  function executedText(commands, keepWord = () => true) {
9003
9021
  return commands.filter(({ argv, wrapper, truncated }) => (!wrapper || truncated) && argv[0].split("/").pop() !== "git").map(({ argv, stdin }) => normalizeCommandProtectionText([...argv.filter(keepWord), stdin ?? ""].join(" ").replaceAll(SHELL_OPAQUE, " "))).join("\n");
9004
9022
  }
@@ -9057,102 +9075,102 @@ function shouldRefreshPullRequests(toolName, toolInput) {
9057
9075
  }
9058
9076
 
9059
9077
  // ../shared/src/routes/linear.ts
9060
- import { z as z18 } from "zod";
9061
- var linearSessionMetadataSchema = z18.object({
9062
- via_mothership: z18.boolean().optional(),
9063
- issue_id: z18.string(),
9064
- issue_identifier: z18.string(),
9065
- issue_title: z18.string(),
9066
- issue_description: z18.string(),
9067
- issue_url: z18.string(),
9068
- comment_id: z18.string(),
9069
- comment_body: z18.string(),
9070
- triggered_by_id: z18.string().optional(),
9071
- triggered_by_name: z18.string().optional(),
9072
- triggered_by_email: z18.string().optional(),
9073
- linear_workspace_id: z18.string().optional(),
9074
- creator_id: z18.string().optional(),
9075
- creator_name: z18.string().optional(),
9076
- creator_email: z18.string().optional(),
9077
- assignee_id: z18.string().optional(),
9078
- assignee_name: z18.string().optional(),
9079
- assignee_email: z18.string().optional(),
9080
- issue_state: z18.string().optional(),
9081
- parent_issue: z18.object({
9082
- id: z18.string(),
9083
- identifier: z18.string(),
9084
- title: z18.string(),
9085
- description: z18.string().nullable()
9078
+ import { z as z19 } from "zod";
9079
+ var linearSessionMetadataSchema = z19.object({
9080
+ via_mothership: z19.boolean().optional(),
9081
+ issue_id: z19.string(),
9082
+ issue_identifier: z19.string(),
9083
+ issue_title: z19.string(),
9084
+ issue_description: z19.string(),
9085
+ issue_url: z19.string(),
9086
+ comment_id: z19.string(),
9087
+ comment_body: z19.string(),
9088
+ triggered_by_id: z19.string().optional(),
9089
+ triggered_by_name: z19.string().optional(),
9090
+ triggered_by_email: z19.string().optional(),
9091
+ linear_workspace_id: z19.string().optional(),
9092
+ creator_id: z19.string().optional(),
9093
+ creator_name: z19.string().optional(),
9094
+ creator_email: z19.string().optional(),
9095
+ assignee_id: z19.string().optional(),
9096
+ assignee_name: z19.string().optional(),
9097
+ assignee_email: z19.string().optional(),
9098
+ issue_state: z19.string().optional(),
9099
+ parent_issue: z19.object({
9100
+ id: z19.string(),
9101
+ identifier: z19.string(),
9102
+ title: z19.string(),
9103
+ description: z19.string().nullable()
9086
9104
  }).optional(),
9087
- workspace: z18.object({
9088
- id: z18.string(),
9089
- coding_agent: z18.custom((value) => typeof value === "string" && isValidAgentProvider(value)),
9090
- task_description: z18.string(),
9091
- created_at: z18.string()
9105
+ workspace: z19.object({
9106
+ id: z19.string(),
9107
+ coding_agent: z19.custom((value) => typeof value === "string" && isValidAgentProvider(value)),
9108
+ task_description: z19.string(),
9109
+ created_at: z19.string()
9092
9110
  }).optional()
9093
9111
  });
9094
9112
 
9095
9113
  // ../shared/src/routes/mothership.ts
9096
- import { z as z19 } from "zod";
9114
+ import { z as z20 } from "zod";
9097
9115
  var MOTHERSHIP_LINEAR_ACTIONS = ["ask", "start"];
9098
- var mothershipLinearSessionIntentRequestSchema = z19.object({
9099
- comment_id: z19.string().trim().min(1).describe("Id of the Linear comment the session will be created on."),
9100
- action: z19.enum(MOTHERSHIP_LINEAR_ACTIONS).describe("`ask` when the comment is a clarifying question, `start` when it is the complete task prompt.")
9116
+ var mothershipLinearSessionIntentRequestSchema = z20.object({
9117
+ comment_id: z20.string().trim().min(1).describe("Id of the Linear comment the session will be created on."),
9118
+ action: z20.enum(MOTHERSHIP_LINEAR_ACTIONS).describe("`ask` when the comment is a clarifying question, `start` when it is the complete task prompt.")
9101
9119
  });
9102
- var mothershipLinearStartRequestSchema = z19.object({
9103
- issue_id: z19.string().describe("Linear issue id from the envelope's `issue_id`."),
9104
- agent_session_id: z19.string().describe("Existing Linear agent session id from the envelope's `agent_session_id`."),
9105
- prompt: z19.string().trim().min(1).describe("Complete task prompt for the coding workspace.")
9120
+ var mothershipLinearStartRequestSchema = z20.object({
9121
+ issue_id: z20.string().describe("Linear issue id from the envelope's `issue_id`."),
9122
+ agent_session_id: z20.string().describe("Existing Linear agent session id from the envelope's `agent_session_id`."),
9123
+ prompt: z20.string().trim().min(1).describe("Complete task prompt for the coding workspace.")
9106
9124
  });
9107
- var slackChannelIdSchema = z19.string().describe("Slack channel id from the envelope's `channel_id`.");
9108
- var slackThreadTsSchema = z19.string().describe("Slack thread timestamp from the envelope's `thread_ts`.");
9109
- var mothershipSlackSpawnRequestSchema = z19.object({
9125
+ var slackChannelIdSchema = z20.string().describe("Slack channel id from the envelope's `channel_id`.");
9126
+ var slackThreadTsSchema = z20.string().describe("Slack thread timestamp from the envelope's `thread_ts`.");
9127
+ var mothershipSlackSpawnRequestSchema = z20.object({
9110
9128
  channel_id: slackChannelIdSchema,
9111
9129
  thread_ts: slackThreadTsSchema,
9112
- message_ts: z19.string().describe("Timestamp of the Slack message that asked for the work (the envelope's `message_ts`). The server verifies this message and its author."),
9113
- user_id: z19.string().describe("Slack user id of that message's author (the envelope's `user_id`). The workspace is attributed to them."),
9114
- prompt: z19.string().describe("Complete task for the new workspace, written so it stands on its own."),
9115
- environment_id: z19.string().optional().describe(`Environment id from \`${REPLICAS_MCP_TOOLS.listEnvironments}\`. Pass it only when clearly confident it fits; omit it to let routing choose. If routing cannot choose, the call fails and nothing is posted, so pick one or ask the person.`)
9130
+ message_ts: z20.string().describe("Timestamp of the Slack message that asked for the work (the envelope's `message_ts`). The server verifies this message and its author."),
9131
+ user_id: z20.string().describe("Slack user id of that message's author (the envelope's `user_id`). The workspace is attributed to them."),
9132
+ prompt: z20.string().describe("Complete task for the new workspace, written so it stands on its own."),
9133
+ environment_id: z20.string().optional().describe(`Environment id from \`${REPLICAS_MCP_TOOLS.listEnvironments}\`. Pass it only when clearly confident it fits; omit it to let routing choose. If routing cannot choose, the call fails and nothing is posted, so pick one or ask the person.`)
9116
9134
  });
9117
- var mothershipSlackRelayRequestSchema = z19.object({
9135
+ var mothershipSlackRelayRequestSchema = z20.object({
9118
9136
  channel_id: slackChannelIdSchema,
9119
9137
  thread_ts: slackThreadTsSchema,
9120
- message: z19.string().describe("The follow-up to deliver, combining every fresh message that belongs to this update."),
9121
- user_id: z19.string().optional().describe("Slack user id of the follow-up's author (the envelope's `user_id`), so it is attributed to them. Defaults to the thread's original requester. Required with `workspace_id`."),
9122
- queue: z19.boolean().optional().describe("Set true only when the person explicitly asked for this to happen after the current task finishes. Delivers behind the active turn instead of interrupting it."),
9123
- workspace_id: z19.string().optional().describe(`Existing workspace id, from \`${REPLICAS_MCP_TOOLS.listWorkspaces}\` or a workspace link in the thread, to bind a thread without a workspace to before relaying. The author must be able to see it. Omit to relay into the thread's own workspace.`),
9124
- message_ts: z19.string().optional().describe("Timestamp of the Slack message that led to this relay (the envelope's `message_ts`). Required with `workspace_id`; the server verifies this message and its author.")
9138
+ message: z20.string().describe("The follow-up to deliver, combining every fresh message that belongs to this update."),
9139
+ user_id: z20.string().optional().describe("Slack user id of the follow-up's author (the envelope's `user_id`), so it is attributed to them. Defaults to the thread's original requester. Required with `workspace_id`."),
9140
+ queue: z20.boolean().optional().describe("Set true only when the person explicitly asked for this to happen after the current task finishes. Delivers behind the active turn instead of interrupting it."),
9141
+ workspace_id: z20.string().optional().describe(`Existing workspace id, from \`${REPLICAS_MCP_TOOLS.listWorkspaces}\` or a workspace link in the thread, to bind a thread without a workspace to before relaying. The author must be able to see it. Omit to relay into the thread's own workspace.`),
9142
+ message_ts: z20.string().optional().describe("Timestamp of the Slack message that led to this relay (the envelope's `message_ts`). Required with `workspace_id`; the server verifies this message and its author.")
9125
9143
  });
9126
- var mothershipListWorkspacesRequestSchema = z19.object({
9144
+ var mothershipListWorkspacesRequestSchema = z20.object({
9127
9145
  channel_id: slackChannelIdSchema,
9128
9146
  thread_ts: slackThreadTsSchema,
9129
- message_ts: z19.string().describe("The envelope's `message_ts`. The server verifies this message and its author."),
9130
- user_id: z19.string().describe("Slack user id of that message's author (the envelope's `user_id`). Only workspaces they can see are listed."),
9131
- query: z19.string().trim().min(1).optional().describe("Case-insensitive text to match against workspace names and pull request URLs.")
9147
+ message_ts: z20.string().describe("The envelope's `message_ts`. The server verifies this message and its author."),
9148
+ user_id: z20.string().describe("Slack user id of that message's author (the envelope's `user_id`). Only workspaces they can see are listed."),
9149
+ query: z20.string().trim().min(1).optional().describe("Case-insensitive text to match against workspace names and pull request URLs.")
9132
9150
  });
9133
- var mothershipSlackConfirmationSchema = z19.object({
9134
- confirmation_channel_id: z19.string().describe("`channel_id` from the envelope of the Slack message that asked for or accepted this."),
9135
- confirmation_thread_ts: z19.string().describe("`thread_ts` from that message's envelope."),
9136
- confirmation_message_ts: z19.string().describe("`message_ts` from that message's envelope."),
9137
- confirmation_user_id: z19.string().describe("`user_id` from that message's envelope.")
9151
+ var mothershipSlackConfirmationSchema = z20.object({
9152
+ confirmation_channel_id: z20.string().describe("`channel_id` from the envelope of the Slack message that asked for or accepted this."),
9153
+ confirmation_thread_ts: z20.string().describe("`thread_ts` from that message's envelope."),
9154
+ confirmation_message_ts: z20.string().describe("`message_ts` from that message's envelope."),
9155
+ confirmation_user_id: z20.string().describe("`user_id` from that message's envelope.")
9138
9156
  });
9139
9157
  var mothershipAutomationToolInputSchema = automationToolInputSchema.extend(mothershipSlackConfirmationSchema.shape);
9140
9158
  var mothershipSaveChannelPresetToolInputSchema = mothershipSlackConfirmationSchema.extend({
9141
- preset_id: z19.string().optional().describe(`Id of the preset to update, from \`${REPLICAS_MCP_TOOLS.listChannelSettings}\`. Omit to create a new preset.`),
9142
- name: z19.string().trim().min(1).max(MOTHERSHIP_PRESET_NAME_MAX_LENGTH).optional().describe("Preset name. Required when creating."),
9143
- description: z19.string().optional().describe("One-line summary shown in settings."),
9144
- icon: z19.enum(MOTHERSHIP_PRESET_ICONS).optional(),
9145
- instructions: z19.string().optional().describe("Complete preset instructions; replaces the existing text. Required when creating.")
9159
+ preset_id: z20.string().optional().describe(`Id of the preset to update, from \`${REPLICAS_MCP_TOOLS.listChannelSettings}\`. Omit to create a new preset.`),
9160
+ name: z20.string().trim().min(1).max(MOTHERSHIP_PRESET_NAME_MAX_LENGTH).optional().describe("Preset name. Required when creating."),
9161
+ description: z20.string().optional().describe("One-line summary shown in settings."),
9162
+ icon: z20.enum(MOTHERSHIP_PRESET_ICONS).optional(),
9163
+ instructions: z20.string().optional().describe("Complete preset instructions; replaces the existing text. Required when creating.")
9146
9164
  });
9147
9165
  var mothershipUpdateChannelSettingsToolInputSchema = mothershipSlackConfirmationSchema.extend({
9148
- source: z19.enum(MOTHERSHIP_SOURCE_TYPES).optional().describe("Defaults to `slack`."),
9149
- external_id: z19.string().describe("Slack channel id or Linear team id."),
9150
- monitored: z19.boolean().optional().describe("`false` stops Mothership from handling the source: it excludes a Slack channel or stops monitoring a Linear team. `true` resumes a Slack channel or starts monitoring a Linear team, and only an organization admin can ask for that. Omit to keep it."),
9151
- preset_id: z19.string().nullable().optional().describe("Preset to assign; `null` removes the preset. Omit to keep it."),
9152
- instructions: z19.string().nullable().optional().describe("Complete channel-specific instructions, applied after the preset; replaces the existing text. `null` clears them. Omit to keep them.")
9166
+ source: z20.enum(MOTHERSHIP_SOURCE_TYPES).optional().describe("Defaults to `slack`."),
9167
+ external_id: z20.string().describe("Slack channel id or Linear team id."),
9168
+ monitored: z20.boolean().optional().describe("`false` stops Mothership from handling the source: it excludes a Slack channel or stops monitoring a Linear team. `true` resumes a Slack channel or starts monitoring a Linear team, and only an organization admin can ask for that. Omit to keep it."),
9169
+ preset_id: z20.string().nullable().optional().describe("Preset to assign; `null` removes the preset. Omit to keep it."),
9170
+ instructions: z20.string().nullable().optional().describe("Complete channel-specific instructions, applied after the preset; replaces the existing text. `null` clears them. Omit to keep them.")
9153
9171
  });
9154
9172
  var mothershipDeleteChannelPresetToolInputSchema = mothershipSlackConfirmationSchema.extend({
9155
- preset_id: z19.string().describe(`Id of the preset to delete, from \`${REPLICAS_MCP_TOOLS.listChannelSettings}\`.`)
9173
+ preset_id: z20.string().describe(`Id of the preset to delete, from \`${REPLICAS_MCP_TOOLS.listChannelSettings}\`.`)
9156
9174
  });
9157
9175
 
9158
9176
  // ../shared/src/routes/plugin-catalog.ts
@@ -9501,50 +9519,69 @@ var workspaceMarkedUnreadClientStateKey = orgUserClientStateKey(WORKSPACE_MARKED
9501
9519
  var promptHistoryClientStateKey = orgUserClientStateKey(PROMPT_HISTORY_CLIENT_STATE_KEY_PREFIX);
9502
9520
 
9503
9521
  // ../shared/src/routes/workspace-events.ts
9504
- import { z as z20 } from "zod";
9505
- var workspaceChangedEventSchema = z20.discriminatedUnion("type", [
9506
- z20.object({
9507
- type: z20.literal("workspace.changed"),
9508
- workspaceId: z20.string(),
9509
- workspace: z20.object({ status: z20.enum(WORKSPACE_STATUSES), last_activity_at: z20.string().nullable() }).optional(),
9510
- completion: z20.object({
9511
- workspaceName: z20.string(),
9512
- completedAt: z20.string(),
9513
- processing: z20.boolean().optional()
9522
+ import { z as z21 } from "zod";
9523
+ var workspaceChangedEventSchema = z21.discriminatedUnion("type", [
9524
+ z21.object({
9525
+ type: z21.literal("workspace.changed"),
9526
+ workspaceId: z21.string(),
9527
+ workspace: z21.object({ status: z21.enum(WORKSPACE_STATUSES), last_activity_at: z21.string().nullable() }).optional(),
9528
+ completion: z21.object({
9529
+ workspaceName: z21.string(),
9530
+ completedAt: z21.string(),
9531
+ processing: z21.boolean().optional()
9514
9532
  }).optional(),
9515
- ts: z20.string()
9533
+ ts: z21.string()
9516
9534
  }),
9517
- z20.object({
9518
- type: z20.literal("workspace.chat.changed"),
9519
- workspaceId: z20.string(),
9520
- chatId: z20.string(),
9521
- ts: z20.string()
9535
+ z21.object({
9536
+ type: z21.literal("workspace.chat.changed"),
9537
+ workspaceId: z21.string(),
9538
+ chatId: z21.string(),
9539
+ ts: z21.string()
9522
9540
  }),
9523
- z20.object({ type: z20.literal("presence.changed"), ts: z20.string() }),
9524
- z20.object({
9525
- type: z20.literal("mobile-testing.changed"),
9526
- workspaceId: z20.string(),
9527
- ts: z20.string()
9541
+ z21.object({ type: z21.literal("presence.changed"), ts: z21.string() }),
9542
+ z21.object({
9543
+ type: z21.literal("mobile-testing.changed"),
9544
+ workspaceId: z21.string(),
9545
+ ts: z21.string()
9528
9546
  })
9529
9547
  ]);
9530
9548
 
9531
9549
  // ../shared/src/routes/presence.ts
9532
- import { z as z21 } from "zod";
9533
- var presenceStatusSchema = z21.enum(["online", "typing"]);
9534
- var presenceLocationSchema = z21.object({
9535
- workspaceId: z21.string().optional()
9550
+ import { z as z22 } from "zod";
9551
+ var presenceStatusSchema = z22.enum(["online", "typing"]);
9552
+ var presenceLocationSchema = z22.object({
9553
+ workspaceId: z22.string().optional()
9536
9554
  });
9537
- var presenceEntrySchema = z21.object({
9538
- userId: z21.string(),
9555
+ var presenceEntrySchema = z22.object({
9556
+ userId: z22.string(),
9539
9557
  status: presenceStatusSchema,
9540
9558
  location: presenceLocationSchema,
9541
- ts: z21.string()
9559
+ ts: z22.string()
9542
9560
  });
9543
- var updatePresenceRequestSchema = z21.object({
9561
+ var updatePresenceRequestSchema = z22.object({
9544
9562
  status: presenceStatusSchema,
9545
9563
  location: presenceLocationSchema.optional()
9546
9564
  });
9547
9565
 
9566
+ // ../shared/src/routes/review-messages.ts
9567
+ import { z as z23 } from "zod";
9568
+ var sendPullRequestReviewMessageRequestSchema = z23.object({
9569
+ ...sendChatMessageRequestSchema.pick({
9570
+ message: true,
9571
+ messageId: true,
9572
+ submittedAt: true,
9573
+ model: true,
9574
+ images: true,
9575
+ canvasUploadIds: true,
9576
+ thinkingLevel: true,
9577
+ fastMode: true,
9578
+ ultrafastMode: true
9579
+ }).shape,
9580
+ /** Starts a new chat instead of continuing the PR's review chat. The provider only applies to a new chat. */
9581
+ newChat: z23.boolean().optional(),
9582
+ provider: z23.enum(VALID_AGENT_PROVIDERS).optional()
9583
+ });
9584
+
9548
9585
  // ../shared/src/audit-log.ts
9549
9586
  var AUDIT_LOG_ACTION = {
9550
9587
  CREATE: "create",
@@ -9912,6 +9949,11 @@ export {
9912
9949
  OPENCODE_GO_BASE_URL,
9913
9950
  DEFAULT_OPENCODE_GO_MODEL,
9914
9951
  fetchOpenCodeGoCatalog,
9952
+ isGitHubUrl,
9953
+ parseCodeHostPrUrl,
9954
+ decodePathSegments,
9955
+ buildCodeHostPrUrl,
9956
+ detectLanguageByPath,
9915
9957
  isDefaultChat,
9916
9958
  CLAUDE_OPUS_4_8_BEDROCK_MODEL,
9917
9959
  CLAUDE_SONNET_5_BEDROCK_MODEL,
@@ -9998,10 +10040,6 @@ export {
9998
10040
  SUBAGENT_MCP_TOOLS,
9999
10041
  SUBAGENT_MCP_TOOL_NAMES,
10000
10042
  parseMcpToolName,
10001
- isGitHubUrl,
10002
- parseCodeHostPrUrl,
10003
- decodePathSegments,
10004
- buildCodeHostPrUrl,
10005
10043
  createUuidFromHex,
10006
10044
  WORKSPACE_IDENTITY_AUDIENCE,
10007
10045
  AWS_SOURCE_IDENTITY_CLAIM,
@@ -10054,7 +10092,6 @@ export {
10054
10092
  CHAT_FORK_EXCERPT_OMITTED_NOTICE,
10055
10093
  formatChatForkHandoffMessage,
10056
10094
  formatSideChatUpdateMessage,
10057
- detectLanguageByPath,
10058
10095
  percentage,
10059
10096
  autoCompactThresholdField,
10060
10097
  normalizeAutoCompactThreshold,