replicas-engine 0.1.1090 → 0.1.1092

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,135 @@ 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
+
220
349
  // ../shared/src/languages.ts
221
350
  var EXT_TO_LANGUAGE = {
222
351
  ".ts": "typescript",
@@ -736,7 +865,7 @@ function paginateEngineLogContent(input) {
736
865
  }
737
866
 
738
867
  // ../shared/src/analytics/types.ts
739
- import { z as z2 } from "zod";
868
+ import { z as z3 } from "zod";
740
869
 
741
870
  // ../shared/src/external-api-host.ts
742
871
  function validateExternalApiHost(url, providerLabel) {
@@ -1082,7 +1211,6 @@ var WORKSPACE_SIZES = ["small", "large", "ultra"];
1082
1211
  var INVALID_WORKSPACE_SIZE_ERROR = `Invalid size: must be one of ${WORKSPACE_SIZES.join(", ")}`;
1083
1212
 
1084
1213
  // ../shared/src/pricing.ts
1085
- var TRIAL_DURATION_DAYS = 14;
1086
1214
  var TRIAL_CREDIT_CENTS = 1e4;
1087
1215
  var WORKSPACE_SOURCES = ["api", "dashboard", "slack", "linear", "github", "gitlab", "automation", "mothership"];
1088
1216
  var CLIENT_MESSAGE_SOURCES = ["web", "desktop", "mobile", "tui"];
@@ -1101,8 +1229,7 @@ var PLANS = {
1101
1229
  name: "Free Trial",
1102
1230
  monthlyPrice: 0,
1103
1231
  features: [
1104
- `${TRIAL_DURATION_DAYS} days free, no credit card required`,
1105
- `$${TRIAL_CREDIT_CENTS / 100} of usage across every workspace`,
1232
+ `$${TRIAL_CREDIT_CENTS / 100} of free usage, no credit card required`,
1106
1233
  "Unlimited repositories and environments",
1107
1234
  "Unlimited automations",
1108
1235
  "Warm pools and warm hooks",
@@ -1169,19 +1296,19 @@ function hasAgentChatActivityFields(value) {
1169
1296
  function isAgentChatActivityRecord(value) {
1170
1297
  return hasAgentChatActivityFields(value) && typeof value.provider === "string" && isValidAgentProvider(value.provider);
1171
1298
  }
1172
- var credentialAccountSchema = z2.object({
1173
- ownerName: z2.string().optional(),
1174
- email: z2.string().optional(),
1299
+ var credentialAccountSchema = z3.object({
1300
+ ownerName: z3.string().optional(),
1301
+ email: z3.string().optional(),
1175
1302
  /** 1-based place in the owner's account pool, set only when the pool holds several accounts. */
1176
- ordinal: z2.number().int().positive().optional()
1303
+ ordinal: z3.number().int().positive().optional()
1177
1304
  });
1178
- var agentCredentialSnapshotSchema = z2.object({
1179
- method: z2.enum(CREDENTIAL_METHOD),
1180
- scope: z2.enum(CREDENTIAL_SCOPE),
1181
- revision: z2.string().optional(),
1305
+ var agentCredentialSnapshotSchema = z3.object({
1306
+ method: z3.enum(CREDENTIAL_METHOD),
1307
+ scope: z3.enum(CREDENTIAL_SCOPE),
1308
+ revision: z3.string().optional(),
1182
1309
  account: credentialAccountSchema.optional(),
1183
1310
  /** The `credentials` row, which tells apart accounts pooled under one method and scope. */
1184
- credentialId: z2.string().optional()
1311
+ credentialId: z3.string().optional()
1185
1312
  });
1186
1313
  function isSameCredential(a, b) {
1187
1314
  return a.method === b.method && a.scope === b.scope && a.credentialId === b.credentialId;
@@ -1227,14 +1354,14 @@ function coerceClaudePartialMessagePayload(payload) {
1227
1354
  const streamId = payload.streamId;
1228
1355
  if (typeof streamId !== "string" || !streamId) return null;
1229
1356
  const parentToolUseId = payload.parent_tool_use_id;
1230
- const text2 = typeof payload.text === "string" && payload.text ? payload.text : void 0;
1357
+ const text3 = typeof payload.text === "string" && payload.text ? payload.text : void 0;
1231
1358
  const thinking = typeof payload.thinking === "string" && payload.thinking ? payload.thinking : void 0;
1232
1359
  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;
1233
- if (!text2 && !thinking && !tool) return null;
1360
+ if (!text3 && !thinking && !tool) return null;
1234
1361
  return {
1235
1362
  streamId,
1236
1363
  parent_tool_use_id: typeof parentToolUseId === "string" ? parentToolUseId : null,
1237
- ...text2 ? { text: text2 } : {},
1364
+ ...text3 ? { text: text3 } : {},
1238
1365
  ...thinking ? { thinking } : {},
1239
1366
  ...tool ? { tool } : {},
1240
1367
  status: payload.status === "completed" ? "completed" : "in_progress"
@@ -1329,105 +1456,105 @@ function coerceChatGoalPayload(payload) {
1329
1456
  var CONTEXT_USAGE_EVENT_TYPE = "context-usage";
1330
1457
 
1331
1458
  // ../shared/src/engine/v1.ts
1332
- import { z as z3 } from "zod";
1459
+ import { z as z4 } from "zod";
1333
1460
  var MERGED_MESSAGE_SEPARATOR = "\n\n<!-- replicas:merged -->\n\n";
1334
1461
  var ENGINE_HEALTH_WAIT_HEADER = "X-Replicas-Health-Wait";
1335
1462
  var ENGINE_HEALTH_WAIT_QUERY_PARAM = "wait_ms";
1336
1463
  var ENGINE_HEALTH_MAX_WAIT_MS = 2e3;
1337
1464
  var ENGINE_ACTIVATE_PATH = "/lifecycle/activate";
1338
1465
  var ENGINE_SLEEP_PATH = "/lifecycle/sleep";
1339
- var updateChatDisplayNameRequestSchema = z3.object({
1340
- displayName: z3.string().trim().min(1).max(100)
1466
+ var updateChatDisplayNameRequestSchema = z4.object({
1467
+ displayName: z4.string().trim().min(1).max(100)
1341
1468
  });
1342
- var createChatRequestSchema = z3.object({
1343
- id: z3.string().uuid().optional(),
1344
- createdAt: z3.string().datetime().optional(),
1345
- provider: z3.enum(VALID_AGENT_PROVIDERS),
1346
- title: z3.string().min(1).optional(),
1347
- parentChatId: z3.string().uuid().optional(),
1348
- forkSourceChatId: z3.string().uuid().optional(),
1349
- sideChat: z3.boolean().optional(),
1350
- clientRequestId: z3.string().min(1).max(128).optional()
1469
+ var createChatRequestSchema = z4.object({
1470
+ id: z4.string().uuid().optional(),
1471
+ createdAt: z4.string().datetime().optional(),
1472
+ provider: z4.enum(VALID_AGENT_PROVIDERS),
1473
+ title: z4.string().min(1).optional(),
1474
+ parentChatId: z4.string().uuid().optional(),
1475
+ forkSourceChatId: z4.string().uuid().optional(),
1476
+ sideChat: z4.boolean().optional(),
1477
+ clientRequestId: z4.string().min(1).max(128).optional()
1351
1478
  }).refine((request) => !request.sideChat || request.forkSourceChatId !== void 0 && request.parentChatId === request.forkSourceChatId, {
1352
1479
  message: "A side chat must fork its parent chat"
1353
1480
  });
1354
- var spawnSubagentRequestSchema = z3.object({
1355
- provider: z3.enum(VALID_AGENT_PROVIDERS),
1356
- prompt: z3.string().min(1),
1357
- forkTurns: z3.string().regex(/^(all|none|[1-9]\d*)$/).refine(
1481
+ var spawnSubagentRequestSchema = z4.object({
1482
+ provider: z4.enum(VALID_AGENT_PROVIDERS),
1483
+ prompt: z4.string().min(1),
1484
+ forkTurns: z4.string().regex(/^(all|none|[1-9]\d*)$/).refine(
1358
1485
  (value) => value === "all" || value === "none" || Number.isSafeInteger(Number(value)),
1359
1486
  "Expected all, none, or a positive safe integer string"
1360
1487
  ).default("all"),
1361
- model: z3.string().min(1).optional(),
1362
- thinkingLevel: z3.enum(VALID_THINKING_LEVELS).optional(),
1363
- title: z3.string().min(1).optional()
1488
+ model: z4.string().min(1).optional(),
1489
+ thinkingLevel: z4.enum(VALID_THINKING_LEVELS).optional(),
1490
+ title: z4.string().min(1).optional()
1364
1491
  });
1365
- var messageSubagentRequestSchema = z3.object({
1366
- message: z3.string().min(1),
1367
- model: z3.string().min(1).optional(),
1368
- thinkingLevel: z3.enum(VALID_THINKING_LEVELS).optional()
1492
+ var messageSubagentRequestSchema = z4.object({
1493
+ message: z4.string().min(1),
1494
+ model: z4.string().min(1).optional(),
1495
+ thinkingLevel: z4.enum(VALID_THINKING_LEVELS).optional()
1369
1496
  });
1370
- var waitSubagentRequestSchema = z3.object({
1371
- timeoutMinutes: z3.coerce.number().positive().max(1440).optional()
1497
+ var waitSubagentRequestSchema = z4.object({
1498
+ timeoutMinutes: z4.coerce.number().positive().max(1440).optional()
1372
1499
  });
1373
- var subagentResponseSchema = z3.object({
1374
- chatId: z3.string().uuid(),
1375
- status: z3.enum(["working", "completed"]),
1376
- response: z3.string().optional(),
1377
- timedOut: z3.literal(true).optional(),
1378
- interruptedByUserMessage: z3.literal(true).optional()
1500
+ var subagentResponseSchema = z4.object({
1501
+ chatId: z4.string().uuid(),
1502
+ status: z4.enum(["working", "completed"]),
1503
+ response: z4.string().optional(),
1504
+ timedOut: z4.literal(true).optional(),
1505
+ interruptedByUserMessage: z4.literal(true).optional()
1379
1506
  });
1380
- var integrationErrorNotificationTargetSchema = z3.discriminatedUnion("type", [
1381
- z3.object({
1382
- type: z3.literal("slack"),
1383
- conversation: z3.object({
1384
- channelId: z3.string().min(1),
1385
- threadTs: z3.string().min(1)
1507
+ var integrationErrorNotificationTargetSchema = z4.discriminatedUnion("type", [
1508
+ z4.object({
1509
+ type: z4.literal("slack"),
1510
+ conversation: z4.object({
1511
+ channelId: z4.string().min(1),
1512
+ threadTs: z4.string().min(1)
1386
1513
  }).optional()
1387
1514
  }),
1388
- z3.object({ type: z3.literal("linear"), sessionId: z3.string().min(1) }),
1389
- z3.object({
1390
- type: z3.literal("code_host"),
1391
- provider: z3.enum(["github", "gitlab"]),
1392
- resource: z3.enum(["issue", "pull_request"]),
1393
- repositoryId: z3.string().min(1),
1394
- resourceNumber: z3.number().int().positive()
1515
+ z4.object({ type: z4.literal("linear"), sessionId: z4.string().min(1) }),
1516
+ z4.object({
1517
+ type: z4.literal("code_host"),
1518
+ provider: z4.enum(["github", "gitlab"]),
1519
+ resource: z4.enum(["issue", "pull_request"]),
1520
+ repositoryId: z4.string().min(1),
1521
+ resourceNumber: z4.number().int().positive()
1395
1522
  }),
1396
- z3.object({ type: z3.literal("automation"), executionId: z3.string().min(1) })
1523
+ z4.object({ type: z4.literal("automation"), executionId: z4.string().min(1) })
1397
1524
  ]);
1398
- var sendChatMessageRequestSchema = z3.object({
1399
- messageId: z3.string().min(1).optional(),
1400
- submittedAt: z3.string().datetime().optional(),
1401
- message: z3.string().min(1),
1402
- model: z3.string().optional(),
1403
- customInstructions: z3.string().optional(),
1404
- planMode: z3.boolean().optional(),
1405
- images: z3.array(z3.object({
1406
- type: z3.literal("image"),
1407
- source: z3.discriminatedUnion("type", [
1408
- z3.object({ type: z3.literal("base64"), media_type: z3.enum(IMAGE_MEDIA_TYPES), data: z3.string().min(1) }),
1409
- z3.object({ type: z3.literal("url"), url: z3.string().url() })
1525
+ var sendChatMessageRequestSchema = z4.object({
1526
+ messageId: z4.string().min(1).optional(),
1527
+ submittedAt: z4.string().datetime().optional(),
1528
+ message: z4.string().min(1),
1529
+ model: z4.string().optional(),
1530
+ customInstructions: z4.string().optional(),
1531
+ planMode: z4.boolean().optional(),
1532
+ images: z4.array(z4.object({
1533
+ type: z4.literal("image"),
1534
+ source: z4.discriminatedUnion("type", [
1535
+ z4.object({ type: z4.literal("base64"), media_type: z4.enum(IMAGE_MEDIA_TYPES), data: z4.string().min(1) }),
1536
+ z4.object({ type: z4.literal("url"), url: z4.string().url() })
1410
1537
  ])
1411
1538
  })).optional(),
1412
- canvasUploadIds: z3.array(z3.string().min(1)).optional(),
1413
- thinkingLevel: z3.enum(VALID_THINKING_LEVELS).optional(),
1414
- goalMode: z3.boolean().optional(),
1415
- fastMode: z3.boolean().optional(),
1416
- ultrafastMode: z3.boolean().optional(),
1417
- source: z3.enum(MESSAGE_SOURCES).optional(),
1418
- enableInteractiveTools: z3.boolean().optional(),
1419
- type: z3.string().min(1).optional(),
1420
- merge: z3.boolean().optional(),
1421
- idempotencyKey: z3.string().min(1).max(128).optional(),
1422
- automationId: z3.string().optional(),
1423
- environmentId: z3.string().min(1).optional(),
1424
- senderUserId: z3.string().optional(),
1425
- senderEmail: z3.string().optional(),
1426
- senderDisplayName: z3.string().optional(),
1427
- senderAvatarUrl: z3.string().optional(),
1539
+ canvasUploadIds: z4.array(z4.string().min(1)).optional(),
1540
+ thinkingLevel: z4.enum(VALID_THINKING_LEVELS).optional(),
1541
+ goalMode: z4.boolean().optional(),
1542
+ fastMode: z4.boolean().optional(),
1543
+ ultrafastMode: z4.boolean().optional(),
1544
+ source: z4.enum(MESSAGE_SOURCES).optional(),
1545
+ enableInteractiveTools: z4.boolean().optional(),
1546
+ type: z4.string().min(1).optional(),
1547
+ merge: z4.boolean().optional(),
1548
+ idempotencyKey: z4.string().min(1).max(128).optional(),
1549
+ automationId: z4.string().optional(),
1550
+ environmentId: z4.string().min(1).optional(),
1551
+ senderUserId: z4.string().optional(),
1552
+ senderEmail: z4.string().optional(),
1553
+ senderDisplayName: z4.string().optional(),
1554
+ senderAvatarUrl: z4.string().optional(),
1428
1555
  errorNotificationTarget: integrationErrorNotificationTargetSchema.optional(),
1429
- errorNotificationTargets: z3.array(integrationErrorNotificationTargetSchema).optional(),
1430
- streamSlackActivity: z3.boolean().optional()
1556
+ errorNotificationTargets: z4.array(integrationErrorNotificationTargetSchema).optional(),
1557
+ streamSlackActivity: z4.boolean().optional()
1431
1558
  }).passthrough();
1432
1559
  function isChatMessageSender(value) {
1433
1560
  return isRecord(value) && (value.messageId === void 0 || typeof value.messageId === "string") && typeof value.senderUserId === "string" && typeof value.senderEmail === "string" && typeof value.recordedAt === "string";
@@ -1683,60 +1810,60 @@ function isSubagentMcpServerName(server) {
1683
1810
  }
1684
1811
 
1685
1812
  // ../shared/src/workspace-identity.ts
1686
- import { z as z4 } from "zod";
1813
+ import { z as z5 } from "zod";
1687
1814
  var WORKSPACE_IDENTITY_AUDIENCE = "replicas:workspace";
1688
1815
  var AWS_SOURCE_IDENTITY_CLAIM = "https://aws.amazon.com/source_identity";
1689
1816
  var WORKSPACE_TOKEN_TTL_SECONDS = 15 * 60;
1690
1817
  var IDENTITY_PROXY_PORT = 17323;
1691
1818
  var IDENTITY_TOKEN_PATH = "/token";
1692
- var workspaceAudienceSchema = z4.string().min(1).max(255).regex(/^[\x21-\x7e]+$/, "Audience must be a single printable token without spaces");
1693
- var workspaceTokenRequestSchema = z4.object({
1819
+ var workspaceAudienceSchema = z5.string().min(1).max(255).regex(/^[\x21-\x7e]+$/, "Audience must be a single printable token without spaces");
1820
+ var workspaceTokenRequestSchema = z5.object({
1694
1821
  audience: workspaceAudienceSchema.optional(),
1695
- aws_source_identity: z4.boolean().optional()
1822
+ aws_source_identity: z5.boolean().optional()
1696
1823
  });
1697
- var workspaceTokenClaimsSchema = z4.object({
1698
- iss: z4.string(),
1699
- sub: z4.string(),
1700
- aud: z4.string(),
1701
- iat: z4.number().int(),
1702
- nbf: z4.number().int(),
1703
- exp: z4.number().int(),
1704
- jti: z4.string(),
1705
- organization_id: z4.string().uuid(),
1706
- workspace_id: z4.string().uuid(),
1707
- environment_id: z4.string().uuid(),
1708
- creator_id: z4.string().uuid().nullable(),
1709
- creator_email: z4.string().nullable().default(null),
1710
- [AWS_SOURCE_IDENTITY_CLAIM]: z4.string().uuid().optional()
1824
+ var workspaceTokenClaimsSchema = z5.object({
1825
+ iss: z5.string(),
1826
+ sub: z5.string(),
1827
+ aud: z5.string(),
1828
+ iat: z5.number().int(),
1829
+ nbf: z5.number().int(),
1830
+ exp: z5.number().int(),
1831
+ jti: z5.string(),
1832
+ organization_id: z5.string().uuid(),
1833
+ workspace_id: z5.string().uuid(),
1834
+ environment_id: z5.string().uuid(),
1835
+ creator_id: z5.string().uuid().nullable(),
1836
+ creator_email: z5.string().nullable().default(null),
1837
+ [AWS_SOURCE_IDENTITY_CLAIM]: z5.string().uuid().optional()
1711
1838
  }).passthrough();
1712
- var workspaceTokenResponseSchema = z4.object({
1713
- issuer: z4.string(),
1714
- audience: z4.string(),
1715
- token: z4.string(),
1716
- expires_at: z4.string()
1839
+ var workspaceTokenResponseSchema = z5.object({
1840
+ issuer: z5.string(),
1841
+ audience: z5.string(),
1842
+ token: z5.string(),
1843
+ expires_at: z5.string()
1717
1844
  });
1718
- var legacyWorkspaceTokenBundleSchema = z4.object({
1719
- version: z4.literal(1),
1720
- issuer: z4.string(),
1721
- default_audience: z4.string(),
1722
- tokens: z4.record(z4.string(), z4.object({ token: z4.string(), expires_at: z4.string() }))
1845
+ var legacyWorkspaceTokenBundleSchema = z5.object({
1846
+ version: z5.literal(1),
1847
+ issuer: z5.string(),
1848
+ default_audience: z5.string(),
1849
+ tokens: z5.record(z5.string(), z5.object({ token: z5.string(), expires_at: z5.string() }))
1723
1850
  });
1724
- var mcpWorkloadAuthSchema = z4.strictObject({
1725
- type: z4.literal("workspace_identity"),
1851
+ var mcpWorkloadAuthSchema = z5.strictObject({
1852
+ type: z5.literal("workspace_identity"),
1726
1853
  audience: workspaceAudienceSchema
1727
1854
  });
1728
- var mcpAuthSchema = z4.discriminatedUnion("type", [
1855
+ var mcpAuthSchema = z5.discriminatedUnion("type", [
1729
1856
  mcpWorkloadAuthSchema,
1730
- z4.strictObject({ type: z4.literal("oauth") })
1857
+ z5.strictObject({ type: z5.literal("oauth") })
1731
1858
  ]);
1732
- var engineMcpOAuthTokenRequestSchema = z4.object({
1733
- environment_mcp_id: z4.string().uuid(),
1734
- force_refresh: z4.boolean().optional()
1859
+ var engineMcpOAuthTokenRequestSchema = z5.object({
1860
+ environment_mcp_id: z5.string().uuid(),
1861
+ force_refresh: z5.boolean().optional()
1735
1862
  });
1736
- var engineMcpOAuthTokenResponseSchema = z4.object({
1737
- url: z4.string(),
1738
- access_token: z4.string(),
1739
- expires_at: z4.string().nullable()
1863
+ var engineMcpOAuthTokenResponseSchema = z5.object({
1864
+ url: z5.string(),
1865
+ access_token: z5.string(),
1866
+ expires_at: z5.string().nullable()
1740
1867
  });
1741
1868
 
1742
1869
  // ../shared/src/runtime-env.ts
@@ -1810,20 +1937,6 @@ function parsePosixEnvFile(content) {
1810
1937
  return result;
1811
1938
  }
1812
1939
 
1813
- // ../shared/src/github/url.ts
1814
- var GITHUB_HOST_RE = /(^|@|\/\/)github\.com[:/]/;
1815
- var GITHUB_REPO_SLUG_RE = /github\.com[/:]([^/]+)\/([^/]+?)(?:\.git)?(?:[/?#]|$)/i;
1816
- function isGitHubUrl(url) {
1817
- if (!url) return false;
1818
- return GITHUB_HOST_RE.test(url);
1819
- }
1820
- function parseRepoUrlSlug(url) {
1821
- if (!url) return null;
1822
- const match = url.match(GITHUB_REPO_SLUG_RE);
1823
- if (!match) return null;
1824
- return { owner: match[1].toLowerCase(), repo: match[2].toLowerCase() };
1825
- }
1826
-
1827
1940
  // ../shared/src/git.ts
1828
1941
  var GIT_CREDENTIAL_HELPER_FILENAME = ".git-credential-replicas";
1829
1942
  var GITHUB_CREDENTIAL_REFRESH_PATH = "/git-credentials/github/refresh";
@@ -1942,19 +2055,19 @@ function gitIdentityConfigCommands(identity, scope = "global") {
1942
2055
  }
1943
2056
 
1944
2057
  // ../shared/src/headless-agent.ts
1945
- import { z as z5 } from "zod";
1946
- var headlessAgentRequestSchema = z5.object({
1947
- mode: z5.literal("structured"),
1948
- agent: z5.custom(
2058
+ import { z as z6 } from "zod";
2059
+ var headlessAgentRequestSchema = z6.object({
2060
+ mode: z6.literal("structured"),
2061
+ agent: z6.custom(
1949
2062
  (value) => typeof value === "string" && isValidAgentProvider(value)
1950
2063
  ),
1951
- model: z5.string().min(1),
1952
- prompt: z5.string(),
1953
- workingDirectory: z5.string().min(1),
1954
- timeoutSeconds: z5.number().int().min(1).max(1800).default(300),
1955
- thinkingLevel: z5.enum(STANDARD_THINKING_LEVELS).optional(),
1956
- codexOauthTokens: z5.object({ accessToken: z5.string(), accountId: z5.string() }).optional(),
1957
- outputSchema: z5.record(z5.string(), z5.json())
2064
+ model: z6.string().min(1),
2065
+ prompt: z6.string(),
2066
+ workingDirectory: z6.string().min(1),
2067
+ timeoutSeconds: z6.number().int().min(1).max(1800).default(300),
2068
+ thinkingLevel: z6.enum(STANDARD_THINKING_LEVELS).optional(),
2069
+ codexOauthTokens: z6.object({ accessToken: z6.string(), accountId: z6.string() }).optional(),
2070
+ outputSchema: z6.record(z6.string(), z6.json())
1958
2071
  });
1959
2072
  var headlessAgentUsagePath = (outputPath) => `${outputPath}.usage`;
1960
2073
 
@@ -2016,8 +2129,8 @@ var RATE_LIMIT_PATTERNS = [
2016
2129
  ];
2017
2130
  var HTTP_429_PATTERN = /(?:^|[^0-9])429(?:$|[^0-9])/;
2018
2131
  var HTTP_CONTEXT_PATTERN = /(api error|request|response|status|http)/;
2019
- function detectAgentQuotaLimit(text2) {
2020
- const normalized = text2.toLowerCase();
2132
+ function detectAgentQuotaLimit(text3) {
2133
+ const normalized = text3.toLowerCase();
2021
2134
  if (!normalized) return null;
2022
2135
  if (OUT_OF_CREDITS_PATTERNS.some((pattern) => pattern.test(normalized))) return "out_of_credits";
2023
2136
  if (RATE_LIMIT_PATTERNS.some((pattern) => pattern.test(normalized))) return "rate_limit";
@@ -2050,12 +2163,12 @@ function describeAuthFallback(payload) {
2050
2163
  }
2051
2164
 
2052
2165
  // ../shared/src/workspace-credentials.ts
2053
- import { z as z6 } from "zod";
2166
+ import { z as z7 } from "zod";
2054
2167
  var WORKSPACE_CREDENTIAL_PROVIDERS = ["claude", "codex"];
2055
- var workspaceCredentialProviderSchema = z6.enum(WORKSPACE_CREDENTIAL_PROVIDERS);
2168
+ var workspaceCredentialProviderSchema = z7.enum(WORKSPACE_CREDENTIAL_PROVIDERS);
2056
2169
  var workspaceCredentialSelectionSchema = agentCredentialSnapshotSchema.omit({ revision: true, account: true, credentialId: true });
2057
2170
  var createWorkspaceCredentialSchema = workspaceCredentialSelectionSchema.extend({
2058
- provider: z6.enum(VALID_AGENT_PROVIDERS)
2171
+ provider: z7.enum(VALID_AGENT_PROVIDERS)
2059
2172
  }).refine(({ provider: provider2, method }) => agentCredentialMethods(provider2).includes(method), {
2060
2173
  message: "This inference provider is not supported by this agent"
2061
2174
  });
@@ -2066,59 +2179,59 @@ var switchWorkspaceCredentialSchema = workspaceCredentialSelectionSchema.extend(
2066
2179
  });
2067
2180
 
2068
2181
  // ../shared/src/chat-fork.ts
2069
- import { z as z8 } from "zod";
2182
+ import { z as z9 } from "zod";
2070
2183
 
2071
2184
  // ../shared/src/fallback-chains.ts
2072
- import { z as z7 } from "zod";
2073
- var fallbackHarnessStepSchema = z7.object({
2074
- kind: z7.literal("harness"),
2075
- provider: z7.enum(VALID_AGENT_PROVIDERS),
2076
- model: z7.string().min(1),
2077
- thinkingLevel: z7.enum(VALID_THINKING_LEVELS).optional()
2185
+ import { z as z8 } from "zod";
2186
+ var fallbackHarnessStepSchema = z8.object({
2187
+ kind: z8.literal("harness"),
2188
+ provider: z8.enum(VALID_AGENT_PROVIDERS),
2189
+ model: z8.string().min(1),
2190
+ thinkingLevel: z8.enum(VALID_THINKING_LEVELS).optional()
2078
2191
  });
2079
- var fallbackPlanStepSchema = z7.discriminatedUnion("kind", [
2080
- z7.object({
2081
- kind: z7.literal("credentials"),
2082
- methods: z7.array(z7.custom(isAuthMethod)).min(1),
2083
- models: z7.record(z7.string(), z7.string().min(1)).optional()
2192
+ var fallbackPlanStepSchema = z8.discriminatedUnion("kind", [
2193
+ z8.object({
2194
+ kind: z8.literal("credentials"),
2195
+ methods: z8.array(z8.custom(isAuthMethod)).min(1),
2196
+ models: z8.record(z8.string(), z8.string().min(1)).optional()
2084
2197
  }),
2085
2198
  fallbackHarnessStepSchema
2086
2199
  ]);
2087
- var fallbackPlanResponseSchema = z7.object({ steps: z7.array(fallbackPlanStepSchema) });
2200
+ var fallbackPlanResponseSchema = z8.object({ steps: z8.array(fallbackPlanStepSchema) });
2088
2201
 
2089
2202
  // ../shared/src/chat-fork.ts
2090
- var quotaLimitKindSchema = z8.enum(["rate_limit", "out_of_credits"]);
2091
- var chatForkInfoSchema = z8.object({
2092
- source: z8.object({
2093
- chatId: z8.string().min(1),
2094
- provider: z8.enum(VALID_AGENT_PROVIDERS),
2095
- title: z8.string()
2203
+ var quotaLimitKindSchema = z9.enum(["rate_limit", "out_of_credits"]);
2204
+ var chatForkInfoSchema = z9.object({
2205
+ source: z9.object({
2206
+ chatId: z9.string().min(1),
2207
+ provider: z9.enum(VALID_AGENT_PROVIDERS),
2208
+ title: z9.string()
2096
2209
  }),
2097
- trigger: z8.enum(["manual", "auto", "side"]),
2210
+ trigger: z9.enum(["manual", "auto", "side"]),
2098
2211
  reason: quotaLimitKindSchema.optional(),
2099
- state: z8.enum(["preparing", "ready", "failed"]),
2100
- error: z8.string().optional(),
2101
- startedAt: z8.string(),
2102
- completedAt: z8.string().optional()
2212
+ state: z9.enum(["preparing", "ready", "failed"]),
2213
+ error: z9.string().optional(),
2214
+ startedAt: z9.string(),
2215
+ completedAt: z9.string().optional()
2103
2216
  });
2104
2217
  function coerceChatForkInfo(value) {
2105
2218
  const parsed = chatForkInfoSchema.safeParse(value);
2106
2219
  return parsed.success ? parsed.data : null;
2107
2220
  }
2108
- var forkChatRequestSchema = z8.object({
2109
- provider: z8.enum(VALID_AGENT_PROVIDERS),
2110
- model: z8.string().min(1).optional(),
2111
- thinkingLevel: z8.enum(VALID_THINKING_LEVELS).optional(),
2112
- title: z8.string().min(1).max(200).optional(),
2113
- message: z8.string().trim().optional(),
2114
- id: z8.string().uuid().optional(),
2115
- clientRequestId: z8.string().min(1).max(128).optional(),
2116
- enableInteractiveTools: z8.boolean().optional(),
2221
+ var forkChatRequestSchema = z9.object({
2222
+ provider: z9.enum(VALID_AGENT_PROVIDERS),
2223
+ model: z9.string().min(1).optional(),
2224
+ thinkingLevel: z9.enum(VALID_THINKING_LEVELS).optional(),
2225
+ title: z9.string().min(1).max(200).optional(),
2226
+ message: z9.string().trim().optional(),
2227
+ id: z9.string().uuid().optional(),
2228
+ clientRequestId: z9.string().min(1).max(128).optional(),
2229
+ enableInteractiveTools: z9.boolean().optional(),
2117
2230
  // Server-injected by the monolith from the authenticated request; never trusted from clients.
2118
- senderUserId: z8.string().optional(),
2119
- senderEmail: z8.string().optional(),
2120
- senderDisplayName: z8.string().optional(),
2121
- senderAvatarUrl: z8.string().optional()
2231
+ senderUserId: z9.string().optional(),
2232
+ senderEmail: z9.string().optional(),
2233
+ senderDisplayName: z9.string().optional(),
2234
+ senderAvatarUrl: z9.string().optional()
2122
2235
  });
2123
2236
  function describeQuotaLimit(reason) {
2124
2237
  return reason === "out_of_credits" ? "ran out of credits" : "hit its usage limit";
@@ -2127,10 +2240,10 @@ function describeChatForkReason(reason, provider2) {
2127
2240
  return reason ? `${getProviderDisplayName(provider2)} ${describeQuotaLimit(reason)}` : null;
2128
2241
  }
2129
2242
  var AGENT_QUOTA_EXHAUSTED_EVENT_TYPE = "agent-quota-exhausted";
2130
- var agentQuotaExhaustedPayloadSchema = z8.object({
2131
- provider: z8.enum(VALID_AGENT_PROVIDERS),
2243
+ var agentQuotaExhaustedPayloadSchema = z9.object({
2244
+ provider: z9.enum(VALID_AGENT_PROVIDERS),
2132
2245
  reason: quotaLimitKindSchema,
2133
- detail: z8.string().optional(),
2246
+ detail: z9.string().optional(),
2134
2247
  forkTo: fallbackHarnessStepSchema.optional()
2135
2248
  });
2136
2249
  function defaultForkChatTitle(source, provider2) {
@@ -2138,10 +2251,10 @@ function defaultForkChatTitle(source, provider2) {
2138
2251
  }
2139
2252
 
2140
2253
  // ../shared/src/credential-pool.ts
2141
- import { z as z9 } from "zod";
2254
+ import { z as z10 } from "zod";
2142
2255
  var MAX_CREDENTIAL_POOL_ACCOUNTS = 10;
2143
- var reorderCredentialPoolSchema = z9.object({
2144
- credential_ids: z9.array(z9.string().uuid()).min(1).max(MAX_CREDENTIAL_POOL_ACCOUNTS)
2256
+ var reorderCredentialPoolSchema = z10.object({
2257
+ credential_ids: z10.array(z10.string().uuid()).min(1).max(MAX_CREDENTIAL_POOL_ACCOUNTS)
2145
2258
  });
2146
2259
 
2147
2260
  // ../shared/src/display-message/types.ts
@@ -2277,8 +2390,8 @@ function indexOrEnd(src, search, from) {
2277
2390
  const index = src.indexOf(search, from);
2278
2391
  return index < 0 ? src.length : index;
2279
2392
  }
2280
- function decodeAnsiC(text2) {
2281
- 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) => {
2393
+ function decodeAnsiC(text3) {
2394
+ 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) => {
2282
2395
  if (escape[0] === "x" || escape[0] === "u") return String.fromCharCode(parseInt(escape.slice(1), 16));
2283
2396
  if (/^[0-7]/.test(escape)) return String.fromCharCode(parseInt(escape, 8));
2284
2397
  return ANSI_C_ESCAPES[escape] ?? escape;
@@ -2295,8 +2408,8 @@ function staticOutput(argv, stdin) {
2295
2408
  if (flags.includes("n")) newline = false;
2296
2409
  if (flags.includes("e")) escapes = true;
2297
2410
  }
2298
- const text2 = args.join(" ");
2299
- return (escapes ? decodeAnsiC(text2) : text2) + (newline ? "\n" : "");
2411
+ const text3 = args.join(" ");
2412
+ return (escapes ? decodeAnsiC(text3) : text3) + (newline ? "\n" : "");
2300
2413
  }
2301
2414
  if (name === "printf" && args.length > 0) {
2302
2415
  const format = decodeAnsiC(args[0]);
@@ -2456,8 +2569,8 @@ function parseUntil(scope, start, closeParen) {
2456
2569
  let quoted = false;
2457
2570
  let redirect = null;
2458
2571
  let parens = 0;
2459
- const append = (text2, isQuoted = false) => {
2460
- word = (word ?? "") + text2;
2572
+ const append = (text3, isQuoted = false) => {
2573
+ word = (word ?? "") + text3;
2461
2574
  quoted ||= isQuoted;
2462
2575
  };
2463
2576
  const endWord = () => {
@@ -2653,10 +2766,10 @@ function planItemsFromMessage(message2) {
2653
2766
  if (!todos) return null;
2654
2767
  return todos.flatMap((todo) => {
2655
2768
  if (!todo || typeof todo !== "object") return [];
2656
- const text2 = "content" in todo && typeof todo.content === "string" ? todo.content : "text" in todo && typeof todo.text === "string" ? todo.text : null;
2769
+ const text3 = "content" in todo && typeof todo.content === "string" ? todo.content : "text" in todo && typeof todo.text === "string" ? todo.text : null;
2657
2770
  const status = "status" in todo ? todo.status : null;
2658
- if (!text2) return [];
2659
- return [{ text: text2, status: status === "completed" || status === "in_progress" ? status : "pending" }];
2771
+ if (!text3) return [];
2772
+ return [{ text: text3, status: status === "completed" || status === "in_progress" ? status : "pending" }];
2660
2773
  });
2661
2774
  }
2662
2775
  function getDisplayMessageStatus(message2) {
@@ -2960,110 +3073,13 @@ function subagentChatId(message2) {
2960
3073
  }
2961
3074
 
2962
3075
  // ../shared/src/multitask-events.ts
2963
- import { z as z15 } from "zod";
2964
-
2965
- // ../shared/src/urls.ts
2966
- var DASHBOARD_PATH = "/dashboard";
2967
- var WEB_APP_PATHS = {
2968
- home: "/",
2969
- onboarding: "/onboarding",
2970
- workspaces: "/workspace",
2971
- environmentSetup: "/workspace/setup",
2972
- automations: "/automations",
2973
- environment: "/environment",
2974
- analytics: "/analytics",
2975
- dashboard: DASHBOARD_PATH,
2976
- agents: `${DASHBOARD_PATH}/agents`,
2977
- integrations: `${DASHBOARD_PATH}/integrations`,
2978
- integrationsGithub: `${DASHBOARD_PATH}/integrations/github`,
2979
- integrationsGitlab: `${DASHBOARD_PATH}/integrations/gitlab`,
2980
- settings: `${DASHBOARD_PATH}/settings`,
2981
- billing: `${DASHBOARD_PATH}/billing`,
2982
- members: `${DASHBOARD_PATH}/members`,
2983
- learnings: `${DASHBOARD_PATH}/learnings`,
2984
- "audit-logs": `${DASHBOARD_PATH}/audit-logs`,
2985
- accountAgents: `${DASHBOARD_PATH}/account/agents`,
2986
- accountProfile: `${DASHBOARD_PATH}/account/profile`,
2987
- accountConnections: `${DASHBOARD_PATH}/account/connections`,
2988
- accountIntegrations: `${DASHBOARD_PATH}/account/integrations`,
2989
- accountApiKeys: `${DASHBOARD_PATH}/account/api-keys`,
2990
- accountPreferences: `${DASHBOARD_PATH}/account/preferences`,
2991
- fullscreenWorkspaces: "/workspaces"
2992
- };
2993
- var LEGACY_WEB_APP_PATHS = {
2994
- app: "/app",
2995
- home: "/home",
2996
- dashboardWorkspaces: `${DASHBOARD_PATH}/workspaces`
2997
- };
2998
- var PR_URL_REGEX = /github\.com\/([^/]+)\/([^/]+)\/pull\/(\d+)/;
2999
- function parsePrUrl(url) {
3000
- const match = url.match(PR_URL_REGEX);
3001
- if (!match) return null;
3002
- const [, owner, repo, numberStr] = match;
3003
- const number = Number.parseInt(numberStr, 10);
3004
- if (!Number.isFinite(number)) return null;
3005
- return { owner, repo, number };
3006
- }
3007
- function parseCodeHostPrUrl(url) {
3008
- const github = parsePrUrl(url);
3009
- if (github) {
3010
- return {
3011
- ...github,
3012
- provider: "github",
3013
- host: "github.com",
3014
- repositoryPath: `${github.owner}/${github.repo}`,
3015
- repoUrl: `https://github.com/${github.owner}/${github.repo}`
3016
- };
3017
- }
3018
- let parsed;
3019
- try {
3020
- parsed = new URL(url);
3021
- } catch {
3022
- return null;
3023
- }
3024
- if (parsed.protocol !== "https:" && parsed.protocol !== "http:") return null;
3025
- const segments = parsed.pathname.split("/").filter(Boolean);
3026
- const separatorIndex = segments.indexOf("-");
3027
- if (separatorIndex <= 0 || segments[separatorIndex + 1] !== "merge_requests") return null;
3028
- const number = Number.parseInt(segments[separatorIndex + 2] ?? "", 10);
3029
- if (!Number.isFinite(number)) return null;
3030
- const repositorySegments = decodePathSegments(segments.slice(0, separatorIndex));
3031
- const repo = repositorySegments[repositorySegments.length - 1];
3032
- const owner = repositorySegments[0];
3033
- if (!owner || !repo) return null;
3034
- const repositoryPath = repositorySegments.join("/");
3035
- return {
3036
- provider: "gitlab",
3037
- host: parsed.host.toLowerCase(),
3038
- owner,
3039
- repo,
3040
- number,
3041
- repositoryPath,
3042
- repoUrl: `${parsed.origin}/${repositoryPath}`
3043
- };
3044
- }
3045
- function decodePathSegments(segments) {
3046
- return segments.map((segment) => {
3047
- try {
3048
- return decodeURIComponent(segment);
3049
- } catch {
3050
- return segment;
3051
- }
3052
- });
3053
- }
3054
- function buildCodeHostPrUrl(repoUrl, provider2, prNumber) {
3055
- const normalizedRepoUrl = repoUrl.replace(/\.git$/, "");
3056
- if (provider2 === "gitlab") {
3057
- return `${normalizedRepoUrl}/-/merge_requests/${prNumber}`;
3058
- }
3059
- return `${normalizedRepoUrl}/pull/${prNumber}`;
3060
- }
3076
+ import { z as z16 } from "zod";
3061
3077
 
3062
3078
  // ../shared/src/replicas-mcp.ts
3063
- import { z as z14 } from "zod";
3079
+ import { z as z15 } from "zod";
3064
3080
 
3065
3081
  // ../shared/src/automations/trigger-schemas.ts
3066
- import { z as z10 } from "zod";
3082
+ import { z as z11 } from "zod";
3067
3083
 
3068
3084
  // ../shared/src/uuid.ts
3069
3085
  function createUuidFromHex(value) {
@@ -3080,47 +3096,47 @@ function getReviewerLoginsError(event, logins) {
3080
3096
  if (isReviewRequested === !!logins?.some((login) => login.trim().replace(/^@+/, ""))) return null;
3081
3097
  return isReviewRequested ? "The PR review requested trigger needs at least one GitHub username" : "Requested reviewers only apply to the PR review requested trigger";
3082
3098
  }
3083
- var repositoryTriggerConfigSchema = z10.object({
3084
- event: z10.string(),
3085
- repository_ids: z10.array(z10.string().regex(UUID_RE, "must be a repository id")).optional(),
3086
- group_pr_events: z10.boolean().optional(),
3087
- excluded_actors: z10.array(z10.string()).optional(),
3088
- reviewer_logins: z10.array(z10.string()).optional()
3099
+ var repositoryTriggerConfigSchema = z11.object({
3100
+ event: z11.string(),
3101
+ repository_ids: z11.array(z11.string().regex(UUID_RE, "must be a repository id")).optional(),
3102
+ group_pr_events: z11.boolean().optional(),
3103
+ excluded_actors: z11.array(z11.string()).optional(),
3104
+ reviewer_logins: z11.array(z11.string()).optional()
3089
3105
  });
3090
- var cronTriggerSchema = z10.object({ type: z10.literal("cron"), config: z10.object({ schedule: z10.string(), timezone: z10.string().optional() }) });
3091
- var githubTriggerSchema = z10.object({
3092
- type: z10.literal("github"),
3106
+ var cronTriggerSchema = z11.object({ type: z11.literal("cron"), config: z11.object({ schedule: z11.string(), timezone: z11.string().optional() }) });
3107
+ var githubTriggerSchema = z11.object({
3108
+ type: z11.literal("github"),
3093
3109
  config: repositoryTriggerConfigSchema.superRefine((config, ctx) => {
3094
3110
  const message2 = getReviewerLoginsError(config.event, config.reviewer_logins);
3095
3111
  if (message2) ctx.addIssue({ code: "custom", message: message2, path: ["reviewer_logins"] });
3096
3112
  })
3097
3113
  });
3098
- var gitlabTriggerSchema = z10.object({ type: z10.literal("gitlab"), config: repositoryTriggerConfigSchema });
3099
- var automationTriggerSchema = z10.discriminatedUnion("type", [
3114
+ var gitlabTriggerSchema = z11.object({ type: z11.literal("gitlab"), config: repositoryTriggerConfigSchema });
3115
+ var automationTriggerSchema = z11.discriminatedUnion("type", [
3100
3116
  cronTriggerSchema,
3101
3117
  githubTriggerSchema,
3102
3118
  gitlabTriggerSchema,
3103
- 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() }) }),
3104
- z10.object({ type: z10.literal("sentry"), config: z10.object({ event: z10.string(), project_slugs: z10.array(z10.string()).optional(), min_level: z10.string().optional() }) }),
3105
- z10.object({ type: z10.literal("custom"), config: z10.object({}) })
3119
+ 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() }) }),
3120
+ z11.object({ type: z11.literal("sentry"), config: z11.object({ event: z11.string(), project_slugs: z11.array(z11.string()).optional(), min_level: z11.string().optional() }) }),
3121
+ z11.object({ type: z11.literal("custom"), config: z11.object({}) })
3106
3122
  ]);
3107
3123
 
3108
3124
  // ../shared/src/routes/environment.ts
3109
- import { z as z11 } from "zod";
3125
+ import { z as z12 } from "zod";
3110
3126
  var ENVIRONMENT_MCP_TRANSPORTS = ["stdio", "http", "sse"];
3111
- var stringMap = z11.record(z11.string(), z11.string());
3112
- var createEnvironmentMcpRequestSchema = z11.object({
3113
- name: z11.string(),
3114
- transport: z11.enum(ENVIRONMENT_MCP_TRANSPORTS),
3115
- config: z11.union([
3116
- z11.object({ command: z11.string().min(1), args: z11.array(z11.string()).optional(), env: stringMap.optional() }),
3117
- z11.object({ url: z11.url(), headers: stringMap.optional(), auth: mcpAuthSchema.optional() })
3127
+ var stringMap = z12.record(z12.string(), z12.string());
3128
+ var createEnvironmentMcpRequestSchema = z12.object({
3129
+ name: z12.string(),
3130
+ transport: z12.enum(ENVIRONMENT_MCP_TRANSPORTS),
3131
+ config: z12.union([
3132
+ z12.object({ command: z12.string().min(1), args: z12.array(z12.string()).optional(), env: stringMap.optional() }),
3133
+ z12.object({ url: z12.url(), headers: stringMap.optional(), auth: mcpAuthSchema.optional() })
3118
3134
  ]).describe("stdio: `{ command, args, env }`. http/sse: `{ url, headers }`.")
3119
3135
  });
3120
3136
  var updateEnvironmentMcpRequestSchema = createEnvironmentMcpRequestSchema.partial();
3121
3137
 
3122
3138
  // ../shared/src/routes/workspaces.ts
3123
- import { z as z13 } from "zod";
3139
+ import { z as z14 } from "zod";
3124
3140
 
3125
3141
  // ../shared/src/default-skills/replicas-agent/abilities/computer.ts
3126
3142
  var SECTION = `### Computer use (Linux desktop control)
@@ -3392,7 +3408,7 @@ var DOCKER_ABILITY = {
3392
3408
  };
3393
3409
 
3394
3410
  // ../shared/src/routes/environment-setups.ts
3395
- import { z as z12 } from "zod";
3411
+ import { z as z13 } from "zod";
3396
3412
  var ENVIRONMENT_SETUP_STEPS = [
3397
3413
  { key: "understand", label: "Understand the codebase" },
3398
3414
  { key: "install", label: "Install dependencies and run the app" },
@@ -3426,17 +3442,17 @@ var ENVIRONMENT_SETUP_LIMITS = {
3426
3442
  };
3427
3443
  var ENVIRONMENT_SETUP_VARIABLE_WAIT = { defaultMs: 5 * 6e4, maxMs: 15 * 6e4, pollMs: 5e3 };
3428
3444
  var VARIABLE_KEY_RE = /^[A-Za-z_][A-Za-z0-9_]*$/;
3429
- var text = (max) => max === void 0 ? z12.string().trim() : z12.string().trim().max(max);
3430
- var requiredText = (max) => text(max).min(1, "must not be empty");
3431
- var optionalText = (max) => text(max).nullish().transform((value) => value || null);
3432
- var clearableText = (max) => text(max).nullish().transform((value) => value === void 0 ? void 0 : value || null);
3433
- var list = (item, max) => max === void 0 ? z12.array(item) : z12.array(item).max(max);
3445
+ var text2 = (max) => max === void 0 ? z13.string().trim() : z13.string().trim().max(max);
3446
+ var requiredText = (max) => text2(max).min(1, "must not be empty");
3447
+ var optionalText2 = (max) => text2(max).nullish().transform((value) => value || null);
3448
+ var clearableText = (max) => text2(max).nullish().transform((value) => value === void 0 ? void 0 : value || null);
3449
+ var list = (item, max) => max === void 0 ? z13.array(item) : z13.array(item).max(max);
3434
3450
  var ENVIRONMENT_SETUP_AUTHORED_TRIGGER_TYPES = ["cron", "github", "gitlab"];
3435
3451
  function isEnvironmentSetupAuthoredTriggerType(type) {
3436
3452
  return ENVIRONMENT_SETUP_AUTHORED_TRIGGER_TYPES.some((authored) => authored === type);
3437
3453
  }
3438
- var proposalTriggerSchema = z12.discriminatedUnion("type", [cronTriggerSchema, githubTriggerSchema, gitlabTriggerSchema]);
3439
- var existingTriggerSchema = z12.custom(
3454
+ var proposalTriggerSchema = z13.discriminatedUnion("type", [cronTriggerSchema, githubTriggerSchema, gitlabTriggerSchema]);
3455
+ var existingTriggerSchema = z13.custom(
3440
3456
  (value) => isRecord(value) && typeof value.type === "string" && isRecord(value.config),
3441
3457
  "must be an automation trigger"
3442
3458
  );
@@ -3444,22 +3460,22 @@ var carriedTriggerSchema = existingTriggerSchema.refine(
3444
3460
  (trigger) => !isEnvironmentSetupAuthoredTriggerType(trigger.type)
3445
3461
  );
3446
3462
  function automationSchema(limits) {
3447
- const authored = z12.object({
3448
- name: text(limits.nameChars),
3449
- description: text(limits.descriptionChars),
3450
- prompt: text(limits.automationPromptChars),
3463
+ const authored = z13.object({
3464
+ name: text2(limits.nameChars),
3465
+ description: text2(limits.descriptionChars),
3466
+ prompt: text2(limits.automationPromptChars),
3451
3467
  triggers: list(proposalTriggerSchema, limits.automationTriggers)
3452
3468
  });
3453
- const updated = authored.extend({ triggers: list(z12.union([proposalTriggerSchema, carriedTriggerSchema]), limits.automationTriggers) });
3454
- return z12.object({
3469
+ const updated = authored.extend({ triggers: list(z13.union([proposalTriggerSchema, carriedTriggerSchema]), limits.automationTriggers) });
3470
+ return z13.object({
3455
3471
  key: requiredText(limits.automationKeyChars),
3456
- action: z12.enum(ENVIRONMENT_SETUP_AUTOMATION_ACTIONS).default("create"),
3457
- automation_id: z12.string().regex(UUID_RE, "must be an automation id").nullable().default(null),
3458
- name: text().default(""),
3459
- description: optionalText().transform((value) => value ?? ""),
3460
- prompt: text().default(""),
3472
+ action: z13.enum(ENVIRONMENT_SETUP_AUTOMATION_ACTIONS).default("create"),
3473
+ automation_id: z13.string().regex(UUID_RE, "must be an automation id").nullable().default(null),
3474
+ name: text2().default(""),
3475
+ description: optionalText2().transform((value) => value ?? ""),
3476
+ prompt: text2().default(""),
3461
3477
  triggers: list(existingTriggerSchema).default([]),
3462
- note: optionalText(limits.automationNoteChars)
3478
+ note: optionalText2(limits.automationNoteChars)
3463
3479
  }).superRefine((automation, ctx) => {
3464
3480
  if (automation.action === "create" && automation.automation_id) {
3465
3481
  ctx.addIssue({ code: "custom", path: ["automation_id"], message: "belongs on an update, keep, or disable entry" });
@@ -3477,7 +3493,7 @@ function automationSchema(limits) {
3477
3493
  const content = (automation.action === "update" ? updated : authored).safeParse(automation);
3478
3494
  if (content.success) return { ...automation, ...content.data };
3479
3495
  for (const issue of content.error.issues) ctx.addIssue({ ...issue, code: "custom" });
3480
- return z12.NEVER;
3496
+ return z13.NEVER;
3481
3497
  });
3482
3498
  }
3483
3499
  function automationListSchema(limits) {
@@ -3495,8 +3511,8 @@ function automationListSchema(limits) {
3495
3511
  });
3496
3512
  }
3497
3513
  function environmentSchema(limits) {
3498
- return z12.object({
3499
- name: optionalText(limits.nameChars).transform((value) => value ?? void 0),
3514
+ return z13.object({
3515
+ name: optionalText2(limits.nameChars).transform((value) => value ?? void 0),
3500
3516
  description: clearableText(limits.descriptionChars),
3501
3517
  system_prompt: clearableText(limits.systemPromptChars),
3502
3518
  start_hook: clearableText(limits.hookChars),
@@ -3504,26 +3520,26 @@ function environmentSchema(limits) {
3504
3520
  });
3505
3521
  }
3506
3522
  function variableSchema(limits, requiredDefault) {
3507
- return z12.object({
3508
- key: z12.string().regex(VARIABLE_KEY_RE, "must be a valid environment variable name").max(limits.variableKeyChars ?? Number.POSITIVE_INFINITY),
3509
- description: optionalText(limits.variableDescriptionChars).transform((value) => value ?? ""),
3510
- required: z12.boolean().default(requiredDefault)
3523
+ return z13.object({
3524
+ key: z13.string().regex(VARIABLE_KEY_RE, "must be a valid environment variable name").max(limits.variableKeyChars ?? Number.POSITIVE_INFINITY),
3525
+ description: optionalText2(limits.variableDescriptionChars).transform((value) => value ?? ""),
3526
+ required: z13.boolean().default(requiredDefault)
3511
3527
  });
3512
3528
  }
3513
3529
  function proposalSchema(limits) {
3514
- return z12.object({
3530
+ return z13.object({
3515
3531
  summary: requiredText(limits.summaryChars),
3516
- stack: list(text(), limits.stackItems).default([]).transform((items) => items.filter(Boolean)),
3532
+ stack: list(text2(), limits.stackItems).default([]).transform((items) => items.filter(Boolean)),
3517
3533
  environment: environmentSchema(limits),
3518
3534
  variables: list(variableSchema(limits, false), limits.variables).default([]),
3519
3535
  automations: automationListSchema(limits),
3520
- verification: list(z12.object({
3536
+ verification: list(z13.object({
3521
3537
  label: requiredText(limits.nameChars),
3522
- status: z12.enum(ENVIRONMENT_SETUP_VERIFICATION_STATUSES),
3523
- detail: optionalText(limits.verificationDetailChars).transform((value) => value ?? void 0)
3538
+ status: z13.enum(ENVIRONMENT_SETUP_VERIFICATION_STATUSES),
3539
+ detail: optionalText2(limits.verificationDetailChars).transform((value) => value ?? void 0)
3524
3540
  }), limits.verificationItems).default([]),
3525
- media: list(z12.object({
3526
- media_id: z12.string().regex(UUID_RE, "must be a media id"),
3541
+ media: list(z13.object({
3542
+ media_id: z13.string().regex(UUID_RE, "must be a media id"),
3527
3543
  title: requiredText(limits.nameChars)
3528
3544
  }), limits.mediaItems).default([])
3529
3545
  });
@@ -3531,35 +3547,35 @@ function proposalSchema(limits) {
3531
3547
  var environmentSetupProposalSchema = proposalSchema({});
3532
3548
  var environmentSetupProposalSubmissionSchema = proposalSchema(ENVIRONMENT_SETUP_LIMITS);
3533
3549
  var environmentSetupVariableRequestSchema = variableSchema({}, false).extend({
3534
- status: z12.enum(["pending", "provided", "skipped"]),
3535
- requested_at: z12.string(),
3536
- resolved_at: z12.string().nullable().default(null)
3550
+ status: z13.enum(["pending", "provided", "skipped"]),
3551
+ requested_at: z13.string(),
3552
+ resolved_at: z13.string().nullable().default(null)
3537
3553
  });
3538
- var environmentSetupRunStateSchema = z12.object({
3539
- status: z12.enum(ENVIRONMENT_SETUP_RUN_STATUSES),
3540
- steps: z12.partialRecord(z12.enum(ENVIRONMENT_SETUP_STEPS.map((step) => step.key)), z12.enum(ENVIRONMENT_SETUP_STEP_STATUSES)).default({}),
3554
+ var environmentSetupRunStateSchema = z13.object({
3555
+ status: z13.enum(ENVIRONMENT_SETUP_RUN_STATUSES),
3556
+ steps: z13.partialRecord(z13.enum(ENVIRONMENT_SETUP_STEPS.map((step) => step.key)), z13.enum(ENVIRONMENT_SETUP_STEP_STATUSES)).default({}),
3541
3557
  proposal: environmentSetupProposalSchema.nullable().default(null),
3542
- applied: z12.object({
3543
- applied_at: z12.string(),
3544
- automation_ids: z12.array(z12.string())
3558
+ applied: z13.object({
3559
+ applied_at: z13.string(),
3560
+ automation_ids: z13.array(z13.string())
3545
3561
  }).nullable().default(null),
3546
- variable_requests: z12.array(environmentSetupVariableRequestSchema).default([])
3562
+ variable_requests: z13.array(environmentSetupVariableRequestSchema).default([])
3547
3563
  });
3548
- var applyEnvironmentSetupRequestSchema = z12.object({
3564
+ var applyEnvironmentSetupRequestSchema = z13.object({
3549
3565
  environment: environmentSchema(ENVIRONMENT_SETUP_LIMITS).extend({ name: requiredText(ENVIRONMENT_SETUP_LIMITS.nameChars) }),
3550
- 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)),
3566
+ 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)),
3551
3567
  automations: automationListSchema(ENVIRONMENT_SETUP_LIMITS)
3552
3568
  });
3553
- var requestEnvironmentSetupVariablesSchema = z12.object({
3569
+ var requestEnvironmentSetupVariablesSchema = z13.object({
3554
3570
  variables: list(variableSchema(ENVIRONMENT_SETUP_LIMITS, true), ENVIRONMENT_SETUP_LIMITS.variables).min(1, "must not be empty")
3555
3571
  }).superRefine(({ variables }, ctx) => {
3556
3572
  if (new Set(variables.map((variable) => variable.key)).size !== variables.length) {
3557
3573
  ctx.addIssue({ code: "custom", path: ["variables"], message: "must have unique keys" });
3558
3574
  }
3559
3575
  });
3560
- var respondEnvironmentSetupVariablesSchema = z12.object({
3561
- values: z12.record(z12.string().regex(VARIABLE_KEY_RE), z12.string()).default({}),
3562
- skipped: z12.array(z12.string().regex(VARIABLE_KEY_RE)).default([])
3576
+ var respondEnvironmentSetupVariablesSchema = z13.object({
3577
+ values: z13.record(z13.string().regex(VARIABLE_KEY_RE), z13.string()).default({}),
3578
+ skipped: z13.array(z13.string().regex(VARIABLE_KEY_RE)).default([])
3563
3579
  });
3564
3580
 
3565
3581
  // ../shared/src/default-skills/replicas-agent/abilities/environment-setup.ts
@@ -5297,16 +5313,16 @@ var DEFAULT_WORKSPACE_FILTERS = {
5297
5313
  activity: "any"
5298
5314
  };
5299
5315
  var ONE_DAY_MS = 24 * 60 * 60 * 1e3;
5300
- var workspaceExecRequestSchema = z13.object({
5301
- command: z13.string().regex(/\S/, "command is required"),
5302
- timeout_seconds: z13.number().int().min(1).max(50).optional().describe("Default: 30")
5316
+ var workspaceExecRequestSchema = z14.object({
5317
+ command: z14.string().regex(/\S/, "command is required"),
5318
+ timeout_seconds: z14.number().int().min(1).max(50).optional().describe("Default: 30")
5303
5319
  });
5304
- var terminalRtcCandidateSchema = z13.object({ type: z13.literal("rtc-candidate"), candidate: z13.string(), mid: z13.string() });
5305
- var terminalSocketServerMessageSchema = z13.discriminatedUnion("type", [
5306
- z13.object({ type: z13.literal("output"), data: z13.string() }),
5307
- z13.object({ type: z13.literal("rtc-answer"), sdp: z13.string() }),
5320
+ var terminalRtcCandidateSchema = z14.object({ type: z14.literal("rtc-candidate"), candidate: z14.string(), mid: z14.string() });
5321
+ var terminalSocketServerMessageSchema = z14.discriminatedUnion("type", [
5322
+ z14.object({ type: z14.literal("output"), data: z14.string() }),
5323
+ z14.object({ type: z14.literal("rtc-answer"), sdp: z14.string() }),
5308
5324
  terminalRtcCandidateSchema,
5309
- z13.object({ type: z13.literal("rtc-switch") })
5325
+ z14.object({ type: z14.literal("rtc-switch") })
5310
5326
  ]);
5311
5327
  var TERMINAL_RTC_ICE_SERVER = "stun:stun.l.google.com:19302";
5312
5328
 
@@ -5331,41 +5347,41 @@ var REPLICAS_MCP_TOOLS = {
5331
5347
  archiveSubagent: "archive_subagent",
5332
5348
  waitForSubagents: "wait_for_subagents"
5333
5349
  };
5334
- var automationToolInputSchema = z14.object({
5335
- name: z14.string().describe("Short automation name."),
5336
- prompt: z14.string().describe("Prompt each automation run starts with."),
5337
- environment_id: z14.string().describe(`Environment id from \`${REPLICAS_MCP_TOOLS.listEnvironments}\`.`),
5338
- triggers: z14.array(automationTriggerSchema).min(1).describe(
5350
+ var automationToolInputSchema = z15.object({
5351
+ name: z15.string().describe("Short automation name."),
5352
+ prompt: z15.string().describe("Prompt each automation run starts with."),
5353
+ environment_id: z15.string().describe(`Environment id from \`${REPLICAS_MCP_TOOLS.listEnvironments}\`.`),
5354
+ triggers: z15.array(automationTriggerSchema).min(1).describe(
5339
5355
  '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>"] } }`.'
5340
5356
  ),
5341
- description: z14.string().optional().describe("One-line summary shown in the dashboard."),
5342
- plan_mode: z14.boolean().optional(),
5343
- goal_mode: z14.boolean().optional(),
5344
- fast_mode: z14.boolean().optional()
5357
+ description: z15.string().optional().describe("One-line summary shown in the dashboard."),
5358
+ plan_mode: z15.boolean().optional(),
5359
+ goal_mode: z15.boolean().optional(),
5360
+ fast_mode: z15.boolean().optional()
5345
5361
  });
5346
5362
  var automationCreateToolInputSchema = automationToolInputSchema.extend({
5347
- scope: z14.enum(["org", "user"]).optional().describe("`org` (default) or `user` for a personal automation, which needs a personal API key.")
5363
+ scope: z15.enum(["org", "user"]).optional().describe("`org` (default) or `user` for a personal automation, which needs a personal API key.")
5348
5364
  });
5349
5365
  var automationUpdateToolInputSchema = automationToolInputSchema.partial().extend({
5350
- automation_id: z14.string().describe("Automation ID"),
5351
- enabled: z14.boolean().optional(),
5352
- agent_provider: z14.enum(AGENT).nullable().optional(),
5353
- model: z14.string().nullable().optional(),
5354
- thinking_level: z14.enum(VALID_THINKING_LEVELS).nullable().optional(),
5355
- workspace_lifecycle_policy: z14.enum(VALID_LIFECYCLE_POLICIES).optional(),
5356
- workspace_size: z14.enum(WORKSPACE_SIZES).optional()
5366
+ automation_id: z15.string().describe("Automation ID"),
5367
+ enabled: z15.boolean().optional(),
5368
+ agent_provider: z15.enum(AGENT).nullable().optional(),
5369
+ model: z15.string().nullable().optional(),
5370
+ thinking_level: z15.enum(VALID_THINKING_LEVELS).nullable().optional(),
5371
+ workspace_lifecycle_policy: z15.enum(VALID_LIFECYCLE_POLICIES).optional(),
5372
+ workspace_size: z15.enum(WORKSPACE_SIZES).optional()
5357
5373
  });
5358
- var chatPath = { id: z14.string().describe("Workspace ID"), chat_id: z14.string().describe("Chat ID") };
5374
+ var chatPath = { id: z15.string().describe("Workspace ID"), chat_id: z15.string().describe("Chat ID") };
5359
5375
  var { provider, model, thinkingLevel, title, message } = forkChatRequestSchema.shape;
5360
- var createChatToolInputSchema = z14.object({ id: chatPath.id, provider, title: createChatRequestSchema.shape.title });
5361
- var forkChatToolInputSchema = z14.object({ ...chatPath, provider, model, thinking_level: thinkingLevel, title, message });
5362
- var renameChatToolInputSchema = z14.object({ ...chatPath, display_name: updateChatDisplayNameRequestSchema.shape.displayName });
5363
- var runCommandToolInputSchema = z14.object({ id: chatPath.id, ...workspaceExecRequestSchema.shape });
5364
- var environmentMcpPath = { environment_id: z14.string().describe("Environment ID") };
5365
- var createEnvironmentMcpToolInputSchema = z14.object({ ...environmentMcpPath, ...createEnvironmentMcpRequestSchema.shape });
5366
- var updateEnvironmentMcpToolInputSchema = z14.object({
5376
+ var createChatToolInputSchema = z15.object({ id: chatPath.id, provider, title: createChatRequestSchema.shape.title });
5377
+ var forkChatToolInputSchema = z15.object({ ...chatPath, provider, model, thinking_level: thinkingLevel, title, message });
5378
+ var renameChatToolInputSchema = z15.object({ ...chatPath, display_name: updateChatDisplayNameRequestSchema.shape.displayName });
5379
+ var runCommandToolInputSchema = z15.object({ id: chatPath.id, ...workspaceExecRequestSchema.shape });
5380
+ var environmentMcpPath = { environment_id: z15.string().describe("Environment ID") };
5381
+ var createEnvironmentMcpToolInputSchema = z15.object({ ...environmentMcpPath, ...createEnvironmentMcpRequestSchema.shape });
5382
+ var updateEnvironmentMcpToolInputSchema = z15.object({
5367
5383
  ...environmentMcpPath,
5368
- mcp_id: z14.string().describe("MCP ID"),
5384
+ mcp_id: z15.string().describe("MCP ID"),
5369
5385
  ...updateEnvironmentMcpRequestSchema.shape
5370
5386
  });
5371
5387
 
@@ -5431,12 +5447,12 @@ function wrapInTag(content, tag) {
5431
5447
  ${content}
5432
5448
  </${tag}>`;
5433
5449
  }
5434
- function removeTag(text2, tag) {
5450
+ function removeTag(text3, tag) {
5435
5451
  const regex = new RegExp(`<${tag}>[\\s\\S]*?</${tag}>`, "g");
5436
- return text2.replace(regex, "").trim();
5452
+ return text3.replace(regex, "").trim();
5437
5453
  }
5438
- function removeReplicasInstructions(text2) {
5439
- return removeTag(text2, REPLICAS_INSTRUCTIONS_TAG);
5454
+ function removeReplicasInstructions(text3) {
5455
+ return removeTag(text3, REPLICAS_INSTRUCTIONS_TAG);
5440
5456
  }
5441
5457
  var MULTITASK_INSTRUCTIONS_BLOCK = new RegExp(`\\s*<${MULTITASK_INSTRUCTIONS_TAG}>\\n([\\s\\S]*?)\\n</${MULTITASK_INSTRUCTIONS_TAG}>`);
5442
5458
  function splitMultitaskInstructions(customInstructions) {
@@ -5450,23 +5466,23 @@ function splitMultitaskInstructions(customInstructions) {
5450
5466
  // ../shared/src/multitask-events.ts
5451
5467
  var MULTITASK_EVENT_KINDS = ["finished", "ready", "needs_attention", "merged", "closed", "archived"];
5452
5468
  var MULTITASK_EVENT_TYPE = "multitask-event";
5453
- var multitaskEventSchema = z15.object({
5454
- id: z15.string(),
5455
- at: z15.string(),
5456
- kind: z15.enum(MULTITASK_EVENT_KINDS),
5457
- agentId: z15.string(),
5458
- agentName: z15.string(),
5459
- summary: z15.string(),
5460
- detail: z15.string().optional(),
5469
+ var multitaskEventSchema = z16.object({
5470
+ id: z16.string(),
5471
+ at: z16.string(),
5472
+ kind: z16.enum(MULTITASK_EVENT_KINDS),
5473
+ agentId: z16.string(),
5474
+ agentName: z16.string(),
5475
+ summary: z16.string(),
5476
+ detail: z16.string().optional(),
5461
5477
  // Already shown as a row when it happened, so the delivered message does not show it again.
5462
- noticed: z15.boolean().optional()
5478
+ noticed: z16.boolean().optional()
5463
5479
  });
5464
5480
  var TAG = "multitask_event";
5465
5481
  var BLOCK = new RegExp(`<${TAG}((?:\\s+\\w+="[^"]*")*)>\\n?([\\s\\S]*?)\\n?</${TAG}>`, "g");
5466
5482
  var ATTRIBUTE = /(\w+)="([^"]*)"/g;
5467
5483
  var unescapeAttribute = (value) => value.replace(/&lt;/g, "<").replace(/&quot;/g, '"').replace(/&amp;/g, "&");
5468
- function extractMultitaskEvents(text2) {
5469
- return [...text2.matchAll(BLOCK)].flatMap((match) => {
5484
+ function extractMultitaskEvents(text3) {
5485
+ return [...text3.matchAll(BLOCK)].flatMap((match) => {
5470
5486
  const attributes = Object.fromEntries([...match[1].matchAll(ATTRIBUTE)].map(([, key, value]) => [key, unescapeAttribute(value)]));
5471
5487
  const kind = MULTITASK_EVENT_KINDS.find((candidate) => candidate === attributes.kind);
5472
5488
  if (!kind || !attributes.id || !attributes.agent_id) return [];
@@ -5484,13 +5500,13 @@ function extractMultitaskEvents(text2) {
5484
5500
  }];
5485
5501
  });
5486
5502
  }
5487
- function parseMultitaskEvents(text2) {
5488
- const events = extractMultitaskEvents(text2);
5489
- return events.length > 0 && text2.replace(BLOCK, "").replaceAll(MERGED_MESSAGE_SEPARATOR.trim(), "").trim() === "" ? events : null;
5503
+ function parseMultitaskEvents(text3) {
5504
+ const events = extractMultitaskEvents(text3);
5505
+ return events.length > 0 && text3.replace(BLOCK, "").replaceAll(MERGED_MESSAGE_SEPARATOR.trim(), "").trim() === "" ? events : null;
5490
5506
  }
5491
5507
 
5492
5508
  // ../shared/src/learned-skills.ts
5493
- import { z as z16 } from "zod";
5509
+ import { z as z17 } from "zod";
5494
5510
 
5495
5511
  // ../shared/src/frontmatter.ts
5496
5512
  import { parse as parseYaml } from "yaml";
@@ -5513,20 +5529,20 @@ function parseFrontmatter(content) {
5513
5529
  var LEARNED_SKILLS_ROOT = `${SANDBOX_PATHS.REPLICAS_DIR}/learned-skills`;
5514
5530
  var LEARNED_SKILLS_MANIFEST_PATH = `${LEARNED_SKILLS_ROOT}/manifest.json`;
5515
5531
  var LEARNED_SKILL_DIR_PREFIX = "replicas-learned__";
5516
- var learnedSkillsManifestSchema = z16.object({
5517
- skills: z16.array(z16.object({ name: z16.string(), sha256: z16.string() }))
5532
+ var learnedSkillsManifestSchema = z17.object({
5533
+ skills: z17.array(z17.object({ name: z17.string(), sha256: z17.string() }))
5518
5534
  });
5519
- var dreamVerdictChecksSchema = z16.object({
5520
- repeatable: z16.boolean(),
5521
- realInstruction: z16.boolean(),
5522
- noContradiction: z16.boolean(),
5523
- formatExact: z16.boolean(),
5524
- humanOnly: z16.boolean(),
5525
- actionable: z16.boolean(),
5526
- durable: z16.boolean()
5535
+ var dreamVerdictChecksSchema = z17.object({
5536
+ repeatable: z17.boolean(),
5537
+ realInstruction: z17.boolean(),
5538
+ noContradiction: z17.boolean(),
5539
+ formatExact: z17.boolean(),
5540
+ humanOnly: z17.boolean(),
5541
+ actionable: z17.boolean(),
5542
+ durable: z17.boolean()
5527
5543
  });
5528
5544
  var DREAM_VERDICT_CHECKS = dreamVerdictChecksSchema.keyof().options;
5529
- var dreamVerdictSchema = dreamVerdictChecksSchema.extend({ approve: z16.boolean(), reason: z16.string() });
5545
+ var dreamVerdictSchema = dreamVerdictChecksSchema.extend({ approve: z17.boolean(), reason: z17.string() });
5530
5546
  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."`;
5531
5547
 
5532
5548
  // ../shared/src/user-message-matching.ts
@@ -5774,9 +5790,9 @@ function describeToolCall(message2, base) {
5774
5790
  var ATTACHMENT_PLACEHOLDER_REGEX = /^\[\d+ (?:(?:images?|files?)(?: and \d+ files?)? attached|(?:image )?attachments?)\]$/;
5775
5791
  var WALKTHROUGH_NOTE_REGEX = /(?:^|\n\n)<replicas_walkthrough path="([^"\n]+)" duration_seconds="(\d+)" audio="(true|false)">\n[^<]*\n<\/replicas_walkthrough>$/;
5776
5792
  var TRUNCATED_WALKTHROUGH_NOTE_REGEX = /(?:^|\n\n)<replicas_walkthrough path="([^"\n]*)(?:" duration_seconds="(\d*))?(?:" audio="(true)?)?[^<]*(?:<\/?[a-z_]*)?$/;
5777
- function stripAttachmentNote(text2) {
5778
- 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- .*)*)$/);
5779
- let content = match ? text2.replace(match[0], "").trim() : text2;
5793
+ function stripAttachmentNote(text3) {
5794
+ 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- .*)*)$/);
5795
+ let content = match ? text3.replace(match[0], "").trim() : text3;
5780
5796
  const walkthroughs = [];
5781
5797
  const truncated = WALKTHROUGH_NOTE_REGEX.test(content) ? null : content.match(TRUNCATED_WALKTHROUGH_NOTE_REGEX);
5782
5798
  if (truncated) {
@@ -5835,7 +5851,7 @@ function messagesForCodexTurn(turn) {
5835
5851
  return [{
5836
5852
  type: "reasoning",
5837
5853
  id: turn.id,
5838
- text: reasoning.map(({ text: text2 }) => text2.trim()).join("\n\n"),
5854
+ text: reasoning.map(({ text: text3 }) => text3.trim()).join("\n\n"),
5839
5855
  timestamp: reasoning[0].timestamp,
5840
5856
  status: reasoning.at(-1)?.status ?? "completed"
5841
5857
  }];
@@ -6312,8 +6328,8 @@ function getCursorAssistantText(event) {
6312
6328
  return getTextContent(message2?.content);
6313
6329
  }
6314
6330
  function getCursorThinkingText(event) {
6315
- const text2 = event.payload.text;
6316
- if (typeof text2 === "string") return text2;
6331
+ const text3 = event.payload.text;
6332
+ if (typeof text3 === "string") return text3;
6317
6333
  const message2 = isRecord(event.payload.message) ? event.payload.message : null;
6318
6334
  return typeof message2?.text === "string" ? message2.text : "";
6319
6335
  }
@@ -6364,8 +6380,8 @@ function parseCursorEvents(events) {
6364
6380
  continue;
6365
6381
  }
6366
6382
  if (event.type === "cursor-assistant") {
6367
- const text2 = getCursorAssistantText(event);
6368
- if (text2) {
6383
+ const text3 = getCursorAssistantText(event);
6384
+ if (text3) {
6369
6385
  const runId = cursorRunId(event);
6370
6386
  if (!activeAssistant || activeAssistant.runId !== runId) {
6371
6387
  const segment = runAssistantSegments.get(runId) ?? 0;
@@ -6384,15 +6400,15 @@ function parseCursorEvents(events) {
6384
6400
  if (message2?.type === "agent") {
6385
6401
  messages[activeAssistant.index] = {
6386
6402
  ...message2,
6387
- content: `${message2.content}${text2}`
6403
+ content: `${message2.content}${text3}`
6388
6404
  };
6389
6405
  }
6390
6406
  }
6391
6407
  continue;
6392
6408
  }
6393
6409
  if (event.type === "cursor-thinking") {
6394
- const text2 = getCursorThinkingText(event);
6395
- if (text2.trim()) {
6410
+ const text3 = getCursorThinkingText(event);
6411
+ if (text3.trim()) {
6396
6412
  const runId = cursorRunId(event);
6397
6413
  if (!activeThinking || activeThinking.runId !== runId) {
6398
6414
  const segment = runThinkingSegments.get(runId) ?? 0;
@@ -6412,7 +6428,7 @@ function parseCursorEvents(events) {
6412
6428
  if (message2?.type === "reasoning") {
6413
6429
  messages[activeThinking.index] = {
6414
6430
  ...message2,
6415
- content: `${message2.content}${text2}`,
6431
+ content: `${message2.content}${text3}`,
6416
6432
  status: "in_progress"
6417
6433
  };
6418
6434
  }
@@ -6444,12 +6460,12 @@ function parseCursorEvents(events) {
6444
6460
  }
6445
6461
  if (event.type === "cursor-task") {
6446
6462
  activeAssistant = null;
6447
- const text2 = event.payload.text;
6448
- if (typeof text2 === "string" && text2.trim()) {
6463
+ const text3 = event.payload.text;
6464
+ if (typeof text3 === "string" && text3.trim()) {
6449
6465
  messages.push({
6450
6466
  id: `cursor-task-${event.timestamp}-${messages.length}`,
6451
6467
  type: "agent",
6452
- content: text2,
6468
+ content: text3,
6453
6469
  timestamp: event.timestamp
6454
6470
  });
6455
6471
  }
@@ -6535,8 +6551,8 @@ function extractErrorText(error) {
6535
6551
  collect(error);
6536
6552
  return parts.filter(Boolean).join("\n");
6537
6553
  }
6538
- function isTransientErrorText(text2, options = {}) {
6539
- const normalized = text2.toLowerCase();
6554
+ function isTransientErrorText(text3, options = {}) {
6555
+ const normalized = text3.toLowerCase();
6540
6556
  if (!normalized) return false;
6541
6557
  if (TRANSIENT_NETWORK_ERROR_PATTERNS.some((pattern) => pattern.test(normalized))) return true;
6542
6558
  if (options.includeRateLimit && /rate limit/.test(normalized)) return true;
@@ -6659,24 +6675,24 @@ function parseOpencodeEvents(events) {
6659
6675
  const time = isRecord(part.time) ? part.time : null;
6660
6676
  const timestamp = timestampFromMs(time?.start, event.timestamp);
6661
6677
  if (part.type === "text") {
6662
- const text2 = typeof part.text === "string" ? part.text : "";
6663
- if (text2.trim()) {
6678
+ const text3 = typeof part.text === "string" ? part.text : "";
6679
+ if (text3.trim()) {
6664
6680
  upsertDisplayMessage(messages, {
6665
6681
  id,
6666
6682
  type: "agent",
6667
- content: text2,
6683
+ content: text3,
6668
6684
  timestamp
6669
6685
  });
6670
6686
  }
6671
6687
  continue;
6672
6688
  }
6673
6689
  if (part.type === "reasoning") {
6674
- const text2 = typeof part.text === "string" ? part.text : "";
6675
- if (text2.trim()) {
6690
+ const text3 = typeof part.text === "string" ? part.text : "";
6691
+ if (text3.trim()) {
6676
6692
  upsertDisplayMessage(messages, {
6677
6693
  id,
6678
6694
  type: "reasoning",
6679
- content: text2,
6695
+ content: text3,
6680
6696
  status: time?.end ? "completed" : "in_progress",
6681
6697
  timestamp
6682
6698
  });
@@ -6844,7 +6860,7 @@ function assistantErrorMessage(value) {
6844
6860
  }
6845
6861
  function parsePiEvents(events) {
6846
6862
  const messages = [];
6847
- const text2 = /* @__PURE__ */ new Map();
6863
+ const text3 = /* @__PURE__ */ new Map();
6848
6864
  const thinking = /* @__PURE__ */ new Map();
6849
6865
  let activeMessageId = "assistant";
6850
6866
  for (const event of events) {
@@ -6875,9 +6891,9 @@ function parsePiEvents(events) {
6875
6891
  if (event.type === "pi-message_update") {
6876
6892
  const payload = nestedPayload(event);
6877
6893
  const id = typeof payload.id === "string" ? payload.id : activeMessageId;
6878
- if (payload.type === "text_delta" && typeof payload.delta === "string") text2.set(id, `${text2.get(id) ?? ""}${payload.delta}`);
6894
+ if (payload.type === "text_delta" && typeof payload.delta === "string") text3.set(id, `${text3.get(id) ?? ""}${payload.delta}`);
6879
6895
  if (payload.type === "thinking_delta" && typeof payload.delta === "string") thinking.set(id, `${thinking.get(id) ?? ""}${payload.delta}`);
6880
- const textContent = text2.get(id);
6896
+ const textContent = text3.get(id);
6881
6897
  const thinkingContent = thinking.get(id);
6882
6898
  if (textContent !== void 0) upsertDisplayMessage(messages, { id: `pi-${id}`, type: "agent", content: textContent, timestamp: event.timestamp });
6883
6899
  if (thinkingContent !== void 0) upsertDisplayMessage(messages, { id: `pi-thinking-${id}`, type: "reasoning", content: thinkingContent, status: "in_progress", timestamp: event.timestamp });
@@ -7896,7 +7912,7 @@ var SECRET_PATTERNS = [
7896
7912
  /\b[A-Z][A-Z0-9_]*(?:KEY|TOKEN|SECRET|PASSWORD)\s*=\s*[^\s]{12,}/g
7897
7913
  ];
7898
7914
  function redactSecrets(value) {
7899
- return SECRET_PATTERNS.reduce((text2, pattern) => text2.replace(pattern, "[REDACTED]"), value);
7915
+ return SECRET_PATTERNS.reduce((text3, pattern) => text3.replace(pattern, "[REDACTED]"), value);
7900
7916
  }
7901
7917
 
7902
7918
  // ../shared/src/transcript-canonicalize.ts
@@ -8441,24 +8457,24 @@ function clampWarmHookTimeoutMs(timeoutMs) {
8441
8457
  }
8442
8458
  return Math.min(timeoutMs, MAX_WARM_HOOK_TIMEOUT_MS);
8443
8459
  }
8444
- function buildOutputPreview(text2, {
8460
+ function buildOutputPreview(text3, {
8445
8461
  maxChars = DEFAULT_HOOK_OUTPUT_PREVIEW_CHARS,
8446
8462
  truncateFrom = "head",
8447
8463
  marker = "\n...[truncated \u2014 download the full log to see the rest]"
8448
8464
  } = {}) {
8449
- if (text2.length <= maxChars) {
8450
- return { output: text2, outputTruncated: false, outputTotalChars: text2.length };
8465
+ if (text3.length <= maxChars) {
8466
+ return { output: text3, outputTruncated: false, outputTotalChars: text3.length };
8451
8467
  }
8452
8468
  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}`;
8469
+ const output = previewChars === 0 ? marker.slice(0, maxChars) : truncateFrom === "tail" ? `${marker}${text3.slice(-previewChars)}` : `${text3.slice(0, previewChars)}${marker}`;
8454
8470
  return {
8455
8471
  output,
8456
8472
  outputTruncated: true,
8457
- outputTotalChars: text2.length
8473
+ outputTotalChars: text3.length
8458
8474
  };
8459
8475
  }
8460
- function buildHookOutputPreview(text2, maxChars = DEFAULT_HOOK_OUTPUT_PREVIEW_CHARS) {
8461
- return buildOutputPreview(text2, { maxChars });
8476
+ function buildHookOutputPreview(text3, maxChars = DEFAULT_HOOK_OUTPUT_PREVIEW_CHARS) {
8477
+ return buildOutputPreview(text3, { maxChars });
8462
8478
  }
8463
8479
  function parseWarmHookConfig(value, filename = "replicas.json") {
8464
8480
  if (typeof value === "string") {
@@ -8549,14 +8565,14 @@ var AUTHENTICATION_ERROR_PATTERNS = [
8549
8565
  /authentication error/,
8550
8566
  /invalid api key/
8551
8567
  ];
8552
- function isAuthenticationErrorText(text2, extraPatterns = []) {
8553
- const normalized = text2.toLowerCase();
8568
+ function isAuthenticationErrorText(text3, extraPatterns = []) {
8569
+ const normalized = text3.toLowerCase();
8554
8570
  return AUTHENTICATION_ERROR_PATTERNS.some((pattern) => pattern.test(normalized)) || extraPatterns.some((pattern) => pattern.test(normalized));
8555
8571
  }
8556
8572
 
8557
8573
  // ../shared/src/claude-auth.ts
8558
- function isClaudeAuthErrorText(text2) {
8559
- const lower = text2.toLowerCase();
8574
+ function isClaudeAuthErrorText(text3) {
8575
+ const lower = text3.toLowerCase();
8560
8576
  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
8577
  }
8562
8578
 
@@ -8749,7 +8765,7 @@ var CLAUDE_AUTH_ENV_KEYS_BY_METHOD = {
8749
8765
  };
8750
8766
 
8751
8767
  // ../shared/src/routes/command-protection.ts
8752
- import { z as z17 } from "zod";
8768
+ import { z as z18 } from "zod";
8753
8769
 
8754
8770
  // ../shared/src/git-invocations.ts
8755
8771
  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 +8856,27 @@ function findCheckoutTarget(args) {
8840
8856
  }
8841
8857
 
8842
8858
  // ../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()
8859
+ var commandProtectionRepoStateSchema = z18.object({
8860
+ branch: z18.string().nullable(),
8861
+ defaultBranch: z18.string().nullable(),
8862
+ pushBranch: z18.string().nullable(),
8863
+ pushConfig: z18.string().nullable(),
8864
+ headMessage: z18.string().nullable(),
8865
+ mergeInProgress: z18.boolean().optional()
8850
8866
  });
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(),
8867
+ var commandProtectionEvaluateRequestSchema = z18.object({
8868
+ provider: z18.enum(["claude", "codex", "cursor", "opencode", "pi"]),
8869
+ source: z18.enum(["claude_pre_tool_use", "codex_approval_request", "cursor_pre_tool_use", "opencode_pre_tool_use", "pi_tool_call"]),
8870
+ toolName: z18.string(),
8871
+ toolInput: z18.unknown(),
8872
+ command: z18.string().nullish(),
8873
+ cwd: z18.string().nullish(),
8874
+ toolUseId: z18.string().nullish(),
8859
8875
  // Read by the engine before the command runs, keyed by absolute path, so the
8860
8876
  // 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())
8877
+ gitContext: z18.object({
8878
+ repos: z18.record(z18.string(), commandProtectionRepoStateSchema),
8879
+ messageFiles: z18.record(z18.string(), z18.string())
8864
8880
  }).optional()
8865
8881
  });
8866
8882
  var COMMAND_PROTECTION_COMMAND_KEYS = ["command", "cmd", "script", "query", "endpoint", "path", "url", "mutation"];
@@ -8873,8 +8889,8 @@ function stringifyCommandProtectionInput(value) {
8873
8889
  return String(value);
8874
8890
  }
8875
8891
  }
8876
- function normalizeCommandProtectionText(text2) {
8877
- return text2.replace(/\\\n/g, " ").replace(/\s+/g, " ").trim().toLowerCase();
8892
+ function normalizeCommandProtectionText(text3) {
8893
+ return text3.replace(/\\\n/g, " ").replace(/\s+/g, " ").trim().toLowerCase();
8878
8894
  }
8879
8895
  function extractCommandProtectionCommandText(request, options = {}) {
8880
8896
  if (request.command && request.command.trim()) return request.command;
@@ -8998,7 +9014,7 @@ function isPrMergeCommand(argv) {
8998
9014
  const method = /(?:^|\s)(?:-X\s*|--method[\s=])(\w+)/i.exec(args.join(" "))?.[1];
8999
9015
  return words[0] === "api" && method?.toUpperCase() === "PUT" && words.some((word) => /\/(?:pulls|merge_requests)\/[^/]+\/merge$/.test(word));
9000
9016
  }
9001
- var matchingChecks = (checks, text2) => checks.flatMap(([name, pattern]) => pattern.test(text2) ? [name] : []);
9017
+ var matchingChecks = (checks, text3) => checks.flatMap(([name, pattern]) => pattern.test(text3) ? [name] : []);
9002
9018
  function executedText(commands, keepWord = () => true) {
9003
9019
  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
9020
  }
@@ -9057,102 +9073,102 @@ function shouldRefreshPullRequests(toolName, toolInput) {
9057
9073
  }
9058
9074
 
9059
9075
  // ../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()
9076
+ import { z as z19 } from "zod";
9077
+ var linearSessionMetadataSchema = z19.object({
9078
+ via_mothership: z19.boolean().optional(),
9079
+ issue_id: z19.string(),
9080
+ issue_identifier: z19.string(),
9081
+ issue_title: z19.string(),
9082
+ issue_description: z19.string(),
9083
+ issue_url: z19.string(),
9084
+ comment_id: z19.string(),
9085
+ comment_body: z19.string(),
9086
+ triggered_by_id: z19.string().optional(),
9087
+ triggered_by_name: z19.string().optional(),
9088
+ triggered_by_email: z19.string().optional(),
9089
+ linear_workspace_id: z19.string().optional(),
9090
+ creator_id: z19.string().optional(),
9091
+ creator_name: z19.string().optional(),
9092
+ creator_email: z19.string().optional(),
9093
+ assignee_id: z19.string().optional(),
9094
+ assignee_name: z19.string().optional(),
9095
+ assignee_email: z19.string().optional(),
9096
+ issue_state: z19.string().optional(),
9097
+ parent_issue: z19.object({
9098
+ id: z19.string(),
9099
+ identifier: z19.string(),
9100
+ title: z19.string(),
9101
+ description: z19.string().nullable()
9086
9102
  }).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()
9103
+ workspace: z19.object({
9104
+ id: z19.string(),
9105
+ coding_agent: z19.custom((value) => typeof value === "string" && isValidAgentProvider(value)),
9106
+ task_description: z19.string(),
9107
+ created_at: z19.string()
9092
9108
  }).optional()
9093
9109
  });
9094
9110
 
9095
9111
  // ../shared/src/routes/mothership.ts
9096
- import { z as z19 } from "zod";
9112
+ import { z as z20 } from "zod";
9097
9113
  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.")
9114
+ var mothershipLinearSessionIntentRequestSchema = z20.object({
9115
+ comment_id: z20.string().trim().min(1).describe("Id of the Linear comment the session will be created on."),
9116
+ action: z20.enum(MOTHERSHIP_LINEAR_ACTIONS).describe("`ask` when the comment is a clarifying question, `start` when it is the complete task prompt.")
9101
9117
  });
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.")
9118
+ var mothershipLinearStartRequestSchema = z20.object({
9119
+ issue_id: z20.string().describe("Linear issue id from the envelope's `issue_id`."),
9120
+ agent_session_id: z20.string().describe("Existing Linear agent session id from the envelope's `agent_session_id`."),
9121
+ prompt: z20.string().trim().min(1).describe("Complete task prompt for the coding workspace.")
9106
9122
  });
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({
9123
+ var slackChannelIdSchema = z20.string().describe("Slack channel id from the envelope's `channel_id`.");
9124
+ var slackThreadTsSchema = z20.string().describe("Slack thread timestamp from the envelope's `thread_ts`.");
9125
+ var mothershipSlackSpawnRequestSchema = z20.object({
9110
9126
  channel_id: slackChannelIdSchema,
9111
9127
  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.`)
9128
+ 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."),
9129
+ user_id: z20.string().describe("Slack user id of that message's author (the envelope's `user_id`). The workspace is attributed to them."),
9130
+ prompt: z20.string().describe("Complete task for the new workspace, written so it stands on its own."),
9131
+ 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
9132
  });
9117
- var mothershipSlackRelayRequestSchema = z19.object({
9133
+ var mothershipSlackRelayRequestSchema = z20.object({
9118
9134
  channel_id: slackChannelIdSchema,
9119
9135
  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.")
9136
+ message: z20.string().describe("The follow-up to deliver, combining every fresh message that belongs to this update."),
9137
+ 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`."),
9138
+ 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."),
9139
+ 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.`),
9140
+ 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
9141
  });
9126
- var mothershipListWorkspacesRequestSchema = z19.object({
9142
+ var mothershipListWorkspacesRequestSchema = z20.object({
9127
9143
  channel_id: slackChannelIdSchema,
9128
9144
  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.")
9145
+ message_ts: z20.string().describe("The envelope's `message_ts`. The server verifies this message and its author."),
9146
+ 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."),
9147
+ query: z20.string().trim().min(1).optional().describe("Case-insensitive text to match against workspace names and pull request URLs.")
9132
9148
  });
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.")
9149
+ var mothershipSlackConfirmationSchema = z20.object({
9150
+ confirmation_channel_id: z20.string().describe("`channel_id` from the envelope of the Slack message that asked for or accepted this."),
9151
+ confirmation_thread_ts: z20.string().describe("`thread_ts` from that message's envelope."),
9152
+ confirmation_message_ts: z20.string().describe("`message_ts` from that message's envelope."),
9153
+ confirmation_user_id: z20.string().describe("`user_id` from that message's envelope.")
9138
9154
  });
9139
9155
  var mothershipAutomationToolInputSchema = automationToolInputSchema.extend(mothershipSlackConfirmationSchema.shape);
9140
9156
  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.")
9157
+ preset_id: z20.string().optional().describe(`Id of the preset to update, from \`${REPLICAS_MCP_TOOLS.listChannelSettings}\`. Omit to create a new preset.`),
9158
+ name: z20.string().trim().min(1).max(MOTHERSHIP_PRESET_NAME_MAX_LENGTH).optional().describe("Preset name. Required when creating."),
9159
+ description: z20.string().optional().describe("One-line summary shown in settings."),
9160
+ icon: z20.enum(MOTHERSHIP_PRESET_ICONS).optional(),
9161
+ instructions: z20.string().optional().describe("Complete preset instructions; replaces the existing text. Required when creating.")
9146
9162
  });
9147
9163
  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.")
9164
+ source: z20.enum(MOTHERSHIP_SOURCE_TYPES).optional().describe("Defaults to `slack`."),
9165
+ external_id: z20.string().describe("Slack channel id or Linear team id."),
9166
+ 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."),
9167
+ preset_id: z20.string().nullable().optional().describe("Preset to assign; `null` removes the preset. Omit to keep it."),
9168
+ 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
9169
  });
9154
9170
  var mothershipDeleteChannelPresetToolInputSchema = mothershipSlackConfirmationSchema.extend({
9155
- preset_id: z19.string().describe(`Id of the preset to delete, from \`${REPLICAS_MCP_TOOLS.listChannelSettings}\`.`)
9171
+ preset_id: z20.string().describe(`Id of the preset to delete, from \`${REPLICAS_MCP_TOOLS.listChannelSettings}\`.`)
9156
9172
  });
9157
9173
 
9158
9174
  // ../shared/src/routes/plugin-catalog.ts
@@ -9501,50 +9517,69 @@ var workspaceMarkedUnreadClientStateKey = orgUserClientStateKey(WORKSPACE_MARKED
9501
9517
  var promptHistoryClientStateKey = orgUserClientStateKey(PROMPT_HISTORY_CLIENT_STATE_KEY_PREFIX);
9502
9518
 
9503
9519
  // ../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()
9520
+ import { z as z21 } from "zod";
9521
+ var workspaceChangedEventSchema = z21.discriminatedUnion("type", [
9522
+ z21.object({
9523
+ type: z21.literal("workspace.changed"),
9524
+ workspaceId: z21.string(),
9525
+ workspace: z21.object({ status: z21.enum(WORKSPACE_STATUSES), last_activity_at: z21.string().nullable() }).optional(),
9526
+ completion: z21.object({
9527
+ workspaceName: z21.string(),
9528
+ completedAt: z21.string(),
9529
+ processing: z21.boolean().optional()
9514
9530
  }).optional(),
9515
- ts: z20.string()
9531
+ ts: z21.string()
9516
9532
  }),
9517
- z20.object({
9518
- type: z20.literal("workspace.chat.changed"),
9519
- workspaceId: z20.string(),
9520
- chatId: z20.string(),
9521
- ts: z20.string()
9533
+ z21.object({
9534
+ type: z21.literal("workspace.chat.changed"),
9535
+ workspaceId: z21.string(),
9536
+ chatId: z21.string(),
9537
+ ts: z21.string()
9522
9538
  }),
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()
9539
+ z21.object({ type: z21.literal("presence.changed"), ts: z21.string() }),
9540
+ z21.object({
9541
+ type: z21.literal("mobile-testing.changed"),
9542
+ workspaceId: z21.string(),
9543
+ ts: z21.string()
9528
9544
  })
9529
9545
  ]);
9530
9546
 
9531
9547
  // ../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()
9548
+ import { z as z22 } from "zod";
9549
+ var presenceStatusSchema = z22.enum(["online", "typing"]);
9550
+ var presenceLocationSchema = z22.object({
9551
+ workspaceId: z22.string().optional()
9536
9552
  });
9537
- var presenceEntrySchema = z21.object({
9538
- userId: z21.string(),
9553
+ var presenceEntrySchema = z22.object({
9554
+ userId: z22.string(),
9539
9555
  status: presenceStatusSchema,
9540
9556
  location: presenceLocationSchema,
9541
- ts: z21.string()
9557
+ ts: z22.string()
9542
9558
  });
9543
- var updatePresenceRequestSchema = z21.object({
9559
+ var updatePresenceRequestSchema = z22.object({
9544
9560
  status: presenceStatusSchema,
9545
9561
  location: presenceLocationSchema.optional()
9546
9562
  });
9547
9563
 
9564
+ // ../shared/src/routes/review-messages.ts
9565
+ import { z as z23 } from "zod";
9566
+ var sendPullRequestReviewMessageRequestSchema = z23.object({
9567
+ ...sendChatMessageRequestSchema.pick({
9568
+ message: true,
9569
+ messageId: true,
9570
+ submittedAt: true,
9571
+ model: true,
9572
+ images: true,
9573
+ canvasUploadIds: true,
9574
+ thinkingLevel: true,
9575
+ fastMode: true,
9576
+ ultrafastMode: true
9577
+ }).shape,
9578
+ /** Starts a new chat instead of continuing the PR's review chat. The provider only applies to a new chat. */
9579
+ newChat: z23.boolean().optional(),
9580
+ provider: z23.enum(VALID_AGENT_PROVIDERS).optional()
9581
+ });
9582
+
9548
9583
  // ../shared/src/audit-log.ts
9549
9584
  var AUDIT_LOG_ACTION = {
9550
9585
  CREATE: "create",
@@ -9640,10 +9675,7 @@ var EMAIL_KEYS = [
9640
9675
  "first_pr_merged",
9641
9676
  "day_5_shipped",
9642
9677
  "day_7_solo",
9643
- "day_14_no_pr",
9644
- "trial_day_7",
9645
- "trial_day_12",
9646
- "trial_expired"
9678
+ "day_14_no_pr"
9647
9679
  ];
9648
9680
  var MANUAL_EMAIL_TEMPLATE_KEYS = ["product_update"];
9649
9681
  var EMAIL_TEMPLATE_KEYS = [...EMAIL_KEYS, ...MANUAL_EMAIL_TEMPLATE_KEYS];
@@ -9912,6 +9944,10 @@ export {
9912
9944
  OPENCODE_GO_BASE_URL,
9913
9945
  DEFAULT_OPENCODE_GO_MODEL,
9914
9946
  fetchOpenCodeGoCatalog,
9947
+ isGitHubUrl,
9948
+ parseCodeHostPrUrl,
9949
+ decodePathSegments,
9950
+ buildCodeHostPrUrl,
9915
9951
  detectLanguageByPath,
9916
9952
  isDefaultChat,
9917
9953
  CLAUDE_OPUS_4_8_BEDROCK_MODEL,
@@ -9999,10 +10035,6 @@ export {
9999
10035
  SUBAGENT_MCP_TOOLS,
10000
10036
  SUBAGENT_MCP_TOOL_NAMES,
10001
10037
  parseMcpToolName,
10002
- isGitHubUrl,
10003
- parseCodeHostPrUrl,
10004
- decodePathSegments,
10005
- buildCodeHostPrUrl,
10006
10038
  createUuidFromHex,
10007
10039
  WORKSPACE_IDENTITY_AUDIENCE,
10008
10040
  AWS_SOURCE_IDENTITY_CLAIM,