replicas-engine 0.1.1581 → 0.1.1583

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.
@@ -1116,17 +1116,17 @@ var require_luxon = __commonJS({
1116
1116
  constructor(dt, intl, opts) {
1117
1117
  this.opts = opts;
1118
1118
  this.originalZone = void 0;
1119
- let z39 = void 0;
1119
+ let z41 = void 0;
1120
1120
  if (this.opts.timeZone) {
1121
1121
  this.dt = dt;
1122
1122
  } else if (dt.zone.type === "fixed") {
1123
1123
  const gmtOffset = -1 * (dt.offset / 60);
1124
1124
  const offsetZ = gmtOffset >= 0 ? `Etc/GMT+${gmtOffset}` : `Etc/GMT${gmtOffset}`;
1125
1125
  if (dt.offset !== 0 && IANAZone.create(offsetZ).valid) {
1126
- z39 = offsetZ;
1126
+ z41 = offsetZ;
1127
1127
  this.dt = dt;
1128
1128
  } else {
1129
- z39 = "UTC";
1129
+ z41 = "UTC";
1130
1130
  this.dt = dt.offset === 0 ? dt : dt.setZone("UTC").plus({
1131
1131
  minutes: dt.offset
1132
1132
  });
@@ -1136,9 +1136,9 @@ var require_luxon = __commonJS({
1136
1136
  this.dt = dt;
1137
1137
  } else if (dt.zone.type === "iana") {
1138
1138
  this.dt = dt;
1139
- z39 = dt.zone.name;
1139
+ z41 = dt.zone.name;
1140
1140
  } else {
1141
- z39 = "UTC";
1141
+ z41 = "UTC";
1142
1142
  this.dt = dt.setZone("UTC").plus({
1143
1143
  minutes: dt.offset
1144
1144
  });
@@ -1147,7 +1147,7 @@ var require_luxon = __commonJS({
1147
1147
  const intlOpts = {
1148
1148
  ...this.opts
1149
1149
  };
1150
- intlOpts.timeZone = intlOpts.timeZone || z39;
1150
+ intlOpts.timeZone = intlOpts.timeZone || z41;
1151
1151
  this.dtf = getCachedDTF(intl, intlOpts);
1152
1152
  }
1153
1153
  format() {
@@ -11354,47 +11354,279 @@ var engineMcpOAuthTokenResponseSchema = z10.object({
11354
11354
  });
11355
11355
 
11356
11356
  // ../shared/src/routes/environment.ts
11357
+ import { z as z13 } from "zod";
11358
+
11359
+ // ../shared/src/routes/environment-setups.ts
11360
+ import { z as z12 } from "zod";
11361
+
11362
+ // ../shared/src/automations/trigger-schemas.ts
11357
11363
  import { z as z11 } from "zod";
11364
+
11365
+ // ../shared/src/uuid.ts
11366
+ function createUuidFromHex(value) {
11367
+ return `${value.slice(0, 8)}-${value.slice(8, 12)}-5${value.slice(13, 16)}-${(Number.parseInt(value.slice(16, 17), 16) & 3 | 8).toString(16)}${value.slice(17, 20)}-${value.slice(20, 32)}`;
11368
+ }
11369
+ var UUID_RE = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;
11370
+
11371
+ // ../shared/src/automations/github/index.ts
11372
+ var REVIEW_REQUESTED_EVENT = "pull_request.review_requested";
11373
+
11374
+ // ../shared/src/automations/trigger-schemas.ts
11375
+ function getReviewerLoginsError(event, logins) {
11376
+ const isReviewRequested = event === REVIEW_REQUESTED_EVENT;
11377
+ if (isReviewRequested === !!logins?.some((login) => login.trim().replace(/^@+/, ""))) return null;
11378
+ return isReviewRequested ? "The PR review requested trigger needs at least one GitHub username" : "Requested reviewers only apply to the PR review requested trigger";
11379
+ }
11380
+ var repositoryTriggerConfigSchema = z11.object({
11381
+ event: z11.string(),
11382
+ repository_ids: z11.array(z11.string().regex(UUID_RE, "must be a repository id")).optional(),
11383
+ group_pr_events: z11.boolean().optional(),
11384
+ excluded_actors: z11.array(z11.string()).optional(),
11385
+ reviewer_logins: z11.array(z11.string()).optional()
11386
+ });
11387
+ var cronTriggerSchema = z11.object({ type: z11.literal("cron"), config: z11.object({ schedule: z11.string(), timezone: z11.string().optional() }) });
11388
+ var githubTriggerSchema = z11.object({
11389
+ type: z11.literal("github"),
11390
+ config: repositoryTriggerConfigSchema.superRefine((config, ctx) => {
11391
+ const message2 = getReviewerLoginsError(config.event, config.reviewer_logins);
11392
+ if (message2) ctx.addIssue({ code: "custom", message: message2, path: ["reviewer_logins"] });
11393
+ })
11394
+ });
11395
+ var gitlabTriggerSchema = z11.object({ type: z11.literal("gitlab"), config: repositoryTriggerConfigSchema });
11396
+ var linearTriggerConfigSchema = linearIssueFiltersSchema.extend({
11397
+ event: z11.string(),
11398
+ team_ids: z11.array(z11.string()).optional(),
11399
+ state_types: z11.array(z11.enum(LINEAR_STATE_TYPES)).optional()
11400
+ }).superRefine((config, ctx) => {
11401
+ if (config.event === LINEAR_ISSUE_MATCHED_EVENT && config.team_ids?.length !== 1) ctx.addIssue({ code: "custom", message: "The Linear issue matches trigger needs exactly one team", path: ["team_ids"] });
11402
+ });
11403
+ var automationTriggerSchema = z11.discriminatedUnion("type", [
11404
+ cronTriggerSchema,
11405
+ githubTriggerSchema,
11406
+ gitlabTriggerSchema,
11407
+ 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() }) }),
11408
+ z11.object({ type: z11.literal("sentry"), config: z11.object({ event: z11.string(), project_slugs: z11.array(z11.string()).optional(), min_level: z11.string().optional() }) }),
11409
+ z11.object({ type: z11.literal("linear"), config: linearTriggerConfigSchema }),
11410
+ z11.object({ type: z11.literal("custom"), config: z11.object({}) })
11411
+ ]);
11412
+
11413
+ // ../shared/src/routes/environment-setups.ts
11414
+ var ENVIRONMENT_SETUP_STEPS = [
11415
+ { key: "understand", label: "Understand the codebase" },
11416
+ { key: "install", label: "Install dependencies and run the app" },
11417
+ { key: "verify", label: "Verify checks and record a walkthrough" },
11418
+ { key: "configure", label: "Draft hooks, system prompt, and automations" },
11419
+ { key: "propose", label: "Propose the configuration for review" }
11420
+ ];
11421
+ var ENVIRONMENT_SETUP_STEP_STATUSES = ["pending", "in_progress", "completed", "skipped"];
11422
+ var ENVIRONMENT_SETUP_RUN_STATUSES = ["running", "proposed", "applied", "failed", "cancelled", "expired"];
11423
+ var ENVIRONMENT_SETUP_AUTOMATION_ACTIONS = ["create", "update", "keep", "disable"];
11424
+ var ENVIRONMENT_SETUP_VERIFICATION_STATUSES = ["passed", "failed", "skipped"];
11425
+ var ENVIRONMENT_SETUP_LIMITS = {
11426
+ summaryChars: 600,
11427
+ stackItems: 30,
11428
+ nameChars: 120,
11429
+ descriptionChars: 1e3,
11430
+ systemPromptChars: 2e4,
11431
+ hookChars: 5e4,
11432
+ variables: 50,
11433
+ variableKeyChars: 128,
11434
+ variableDescriptionChars: 500,
11435
+ automations: 8,
11436
+ automationKeyChars: 80,
11437
+ automationPromptChars: 1e4,
11438
+ automationTriggers: 5,
11439
+ automationNoteChars: 300,
11440
+ verificationItems: 8,
11441
+ verificationDetailChars: 300,
11442
+ mediaItems: 8,
11443
+ repositories: 20
11444
+ };
11445
+ var VARIABLE_KEY_RE = /^[A-Za-z_][A-Za-z0-9_]*$/;
11446
+ var text2 = (max) => max === void 0 ? z12.string().trim() : z12.string().trim().max(max);
11447
+ var requiredText = (max) => text2(max).min(1, "must not be empty");
11448
+ var optionalText2 = (max) => text2(max).nullish().transform((value) => value || null);
11449
+ var clearableText = (max) => text2(max).nullish().transform((value) => value === void 0 ? void 0 : value || null);
11450
+ var list = (item, max) => max === void 0 ? z12.array(item) : z12.array(item).max(max);
11451
+ var ENVIRONMENT_SETUP_AUTHORED_TRIGGER_TYPES = ["cron", "github", "gitlab"];
11452
+ function isEnvironmentSetupAuthoredTriggerType(type) {
11453
+ return ENVIRONMENT_SETUP_AUTHORED_TRIGGER_TYPES.some((authored) => authored === type);
11454
+ }
11455
+ var proposalTriggerSchema = z12.discriminatedUnion("type", [cronTriggerSchema, githubTriggerSchema, gitlabTriggerSchema]);
11456
+ var existingTriggerSchema = z12.custom(
11457
+ (value) => isRecord(value) && typeof value.type === "string" && isRecord(value.config),
11458
+ "must be an automation trigger"
11459
+ );
11460
+ var carriedTriggerSchema = existingTriggerSchema.refine(
11461
+ (trigger) => !isEnvironmentSetupAuthoredTriggerType(trigger.type)
11462
+ );
11463
+ function automationSchema(limits) {
11464
+ const authored = z12.object({
11465
+ name: text2(limits.nameChars),
11466
+ description: text2(limits.descriptionChars),
11467
+ prompt: text2(limits.automationPromptChars),
11468
+ triggers: list(proposalTriggerSchema, limits.automationTriggers)
11469
+ });
11470
+ const updated = authored.extend({ triggers: list(z12.union([proposalTriggerSchema, carriedTriggerSchema]), limits.automationTriggers) });
11471
+ return z12.object({
11472
+ key: requiredText(limits.automationKeyChars),
11473
+ action: z12.enum(ENVIRONMENT_SETUP_AUTOMATION_ACTIONS).default("create"),
11474
+ automation_id: z12.string().regex(UUID_RE, "must be an automation id").nullable().default(null),
11475
+ name: text2().default(""),
11476
+ description: optionalText2().transform((value) => value ?? ""),
11477
+ prompt: text2().default(""),
11478
+ triggers: list(existingTriggerSchema).default([]),
11479
+ note: optionalText2(limits.automationNoteChars)
11480
+ }).superRefine((automation, ctx) => {
11481
+ if (automation.action === "create" && automation.automation_id) {
11482
+ ctx.addIssue({ code: "custom", path: ["automation_id"], message: "belongs on an update, keep, or disable entry" });
11483
+ }
11484
+ if (automation.action !== "create" && !automation.automation_id) {
11485
+ ctx.addIssue({ code: "custom", path: ["automation_id"], message: "must be the id of an automation attached to this environment" });
11486
+ }
11487
+ if (automation.action === "create" || automation.action === "update") {
11488
+ if (!automation.name) ctx.addIssue({ code: "custom", path: ["name"], message: "must not be empty" });
11489
+ if (!automation.prompt) ctx.addIssue({ code: "custom", path: ["prompt"], message: "must not be empty" });
11490
+ if (automation.triggers.length === 0) ctx.addIssue({ code: "custom", path: ["triggers"], message: "must not be empty" });
11491
+ }
11492
+ }).transform((automation, ctx) => {
11493
+ if (automation.action === "keep" || automation.action === "disable") return automation;
11494
+ const content = (automation.action === "update" ? updated : authored).safeParse(automation);
11495
+ if (content.success) return { ...automation, ...content.data };
11496
+ for (const issue of content.error.issues) ctx.addIssue({ ...issue, code: "custom" });
11497
+ return z12.NEVER;
11498
+ });
11499
+ }
11500
+ function automationListSchema(limits) {
11501
+ return list(automationSchema(limits)).default([]).superRefine((automations, ctx) => {
11502
+ if (new Set(automations.map((automation) => automation.key)).size !== automations.length) {
11503
+ ctx.addIssue({ code: "custom", message: "must have unique keys" });
11504
+ }
11505
+ const targets = automations.flatMap((automation) => automation.automation_id ?? []);
11506
+ if (new Set(targets).size !== targets.length) {
11507
+ ctx.addIssue({ code: "custom", message: "must mention each existing automation once" });
11508
+ }
11509
+ if (limits.automations !== void 0 && automations.filter((automation) => automation.action === "create").length > limits.automations) {
11510
+ ctx.addIssue({ code: "custom", message: `must create at most ${limits.automations} new automations` });
11511
+ }
11512
+ });
11513
+ }
11514
+ function environmentSchema(limits) {
11515
+ return z12.object({
11516
+ name: optionalText2(limits.nameChars).transform((value) => value ?? void 0),
11517
+ description: clearableText(limits.descriptionChars),
11518
+ system_prompt: clearableText(limits.systemPromptChars),
11519
+ start_hook: clearableText(limits.hookChars),
11520
+ warm_hook: clearableText(limits.hookChars)
11521
+ });
11522
+ }
11523
+ function proposalSchema(limits) {
11524
+ return z12.object({
11525
+ summary: requiredText(limits.summaryChars),
11526
+ stack: list(text2(), limits.stackItems).default([]).transform((items) => items.filter(Boolean)),
11527
+ environment: environmentSchema(limits),
11528
+ variables: list(z12.object({
11529
+ key: z12.string().regex(VARIABLE_KEY_RE, "must be a valid environment variable name").max(limits.variableKeyChars ?? Number.POSITIVE_INFINITY),
11530
+ description: optionalText2(limits.variableDescriptionChars).transform((value) => value ?? ""),
11531
+ required: z12.boolean().default(false)
11532
+ }), limits.variables).default([]),
11533
+ automations: automationListSchema(limits),
11534
+ verification: list(z12.object({
11535
+ label: requiredText(limits.nameChars),
11536
+ status: z12.enum(ENVIRONMENT_SETUP_VERIFICATION_STATUSES),
11537
+ detail: optionalText2(limits.verificationDetailChars).transform((value) => value ?? void 0)
11538
+ }), limits.verificationItems).default([]),
11539
+ media: list(z12.object({
11540
+ media_id: z12.string().regex(UUID_RE, "must be a media id"),
11541
+ title: requiredText(limits.nameChars)
11542
+ }), limits.mediaItems).default([])
11543
+ });
11544
+ }
11545
+ var environmentSetupProposalSchema = proposalSchema({});
11546
+ var environmentSetupProposalSubmissionSchema = proposalSchema(ENVIRONMENT_SETUP_LIMITS);
11547
+ var environmentSetupRunStateSchema = z12.object({
11548
+ status: z12.enum(ENVIRONMENT_SETUP_RUN_STATUSES),
11549
+ steps: z12.partialRecord(z12.enum(ENVIRONMENT_SETUP_STEPS.map((step) => step.key)), z12.enum(ENVIRONMENT_SETUP_STEP_STATUSES)).default({}),
11550
+ proposal: environmentSetupProposalSchema.nullable().default(null),
11551
+ applied: z12.object({
11552
+ applied_at: z12.string(),
11553
+ automation_ids: z12.array(z12.string())
11554
+ }).nullable().default(null)
11555
+ });
11556
+ var applyEnvironmentSetupRequestSchema = z12.object({
11557
+ environment: environmentSchema(ENVIRONMENT_SETUP_LIMITS).extend({ name: requiredText(ENVIRONMENT_SETUP_LIMITS.nameChars) }),
11558
+ 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)),
11559
+ automations: automationListSchema(ENVIRONMENT_SETUP_LIMITS)
11560
+ });
11561
+
11562
+ // ../shared/src/routes/environment.ts
11358
11563
  var ENVIRONMENT_MCP_TRANSPORTS = ["stdio", "http", "sse"];
11359
- var stringMap = z11.record(z11.string(), z11.string());
11360
- var createEnvironmentMcpRequestSchema = z11.object({
11361
- name: z11.string(),
11362
- transport: z11.enum(ENVIRONMENT_MCP_TRANSPORTS),
11363
- config: z11.union([
11364
- z11.object({ command: z11.string().min(1), args: z11.array(z11.string()).optional(), env: stringMap.optional() }),
11365
- z11.object({ url: z11.url(), headers: stringMap.optional(), auth: mcpAuthSchema.optional() })
11564
+ var MCP_NAME_PATTERN = /^[A-Za-z0-9][A-Za-z0-9_-]{0,63}$/;
11565
+ var environmentMcpVariableReferenceSchema = z13.strictObject({
11566
+ env: z13.string().regex(VARIABLE_KEY_RE, "must be a valid environment variable name"),
11567
+ prefix: z13.string().optional()
11568
+ });
11569
+ var getMcpProxyDroppedHeader = (headers) => Object.keys(headers).find((name) => ["authorization", "proxy-authorization", "cookie"].includes(name.toLowerCase()));
11570
+ function validateEnvironmentMcpAuthentication(transport, config) {
11571
+ if (!config.auth) return createSuccessResult();
11572
+ const url = new URL(config.url);
11573
+ if (url.search || url.protocol !== "https:") {
11574
+ return createErrorResult({ code: "url", message: "OAuth and workspace identity authentication require an HTTPS MCP URL without query parameters" });
11575
+ }
11576
+ const dropped = getMcpProxyDroppedHeader({ ...config.headers, ...config.headersFrom });
11577
+ if (dropped) {
11578
+ return createErrorResult({ code: "headers", message: `Remove the ${dropped} header: OAuth and workspace identity MCPs don't send it` });
11579
+ }
11580
+ if (config.auth.type === "oauth" && transport === "sse") {
11581
+ return createErrorResult({ code: "transport", message: "OAuth requires the HTTP transport" });
11582
+ }
11583
+ return createSuccessResult();
11584
+ }
11585
+ var stringMap = z13.record(z13.string(), z13.string());
11586
+ var environmentMcpStdioConfigSchema = z13.object({ command: z13.string().min(1), args: z13.array(z13.string()).optional(), env: stringMap.optional(), envFrom: z13.record(z13.string().regex(VARIABLE_KEY_RE), environmentMcpVariableReferenceSchema).optional() });
11587
+ var environmentMcpHttpConfigSchema = z13.object({ url: z13.url(), headers: stringMap.optional(), headersFrom: z13.record(z13.string(), environmentMcpVariableReferenceSchema).optional(), auth: mcpAuthSchema.optional() });
11588
+ var createEnvironmentMcpRequestSchema = z13.object({
11589
+ name: z13.string(),
11590
+ transport: z13.enum(ENVIRONMENT_MCP_TRANSPORTS),
11591
+ config: z13.union([
11592
+ environmentMcpStdioConfigSchema,
11593
+ environmentMcpHttpConfigSchema
11366
11594
  ]).describe("stdio: `{ command, args, env }`. http/sse: `{ url, headers }`.")
11367
11595
  });
11368
11596
  var updateEnvironmentMcpRequestSchema = createEnvironmentMcpRequestSchema.partial();
11369
- var screenPasswordSchema = z11.string().min(1, "Enter the screen password").max(256).describe('Screen Sharing password, for `replicas computer screen`. On a Mac, the "VNC viewers may control screen with password" password. Never returned.');
11370
- var hostSchema = z11.string().max(253).regex(/^(?:[A-Za-z0-9](?:[A-Za-z0-9.-]*[A-Za-z0-9])?|[0-9A-Fa-f:]+)$/, "Enter a hostname or IP address");
11371
- var createEnvironmentDeviceRequestSchema = z11.object({
11372
- name: z11.string().regex(/^[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?$/, "Use lowercase letters, numbers and dashes").describe("SSH alias in workspaces, e.g. `mac-mini` for `ssh mac-mini`."),
11597
+ var RESERVED_MCP_NAME_PREFIXES = ["replicas-", SUBAGENT_MCP_SERVER_NAME];
11598
+ function isReservedMcpName(name) {
11599
+ return RESERVED_MCP_NAME_PREFIXES.some((prefix) => name.startsWith(prefix));
11600
+ }
11601
+ var screenPasswordSchema = z13.string().min(1, "Enter the screen password").max(256).describe('Screen Sharing password, for `replicas computer screen`. On a Mac, the "VNC viewers may control screen with password" password. Never returned.');
11602
+ var hostSchema = z13.string().max(253).regex(/^(?:[A-Za-z0-9](?:[A-Za-z0-9.-]*[A-Za-z0-9])?|[0-9A-Fa-f:]+)$/, "Enter a hostname or IP address");
11603
+ var createEnvironmentDeviceRequestSchema = z13.object({
11604
+ name: z13.string().regex(/^[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?$/, "Use lowercase letters, numbers and dashes").describe("SSH alias in workspaces, e.g. `mac-mini` for `ssh mac-mini`."),
11373
11605
  host: hostSchema.optional().describe("Hostname or IP, such as a Tailscale MagicDNS name (`mac-mini`) or a public address. Leave it out when the device connects to Replicas itself with `replicas device connect`."),
11374
- port: z11.number().int().min(1).max(65535).optional().describe("SSH port on the device. Defaults to 22."),
11375
- username: z11.string().regex(/^[A-Za-z0-9_][A-Za-z0-9._-]{0,63}$/, "Enter the account name on the device").describe("Account the agent signs in as."),
11606
+ port: z13.number().int().min(1).max(65535).optional().describe("SSH port on the device. Defaults to 22."),
11607
+ username: z13.string().regex(/^[A-Za-z0-9_][A-Za-z0-9._-]{0,63}$/, "Enter the account name on the device").describe("Account the agent signs in as."),
11376
11608
  screen_password: screenPasswordSchema.optional()
11377
11609
  });
11378
11610
  var updateEnvironmentDeviceRequestSchema = createEnvironmentDeviceRequestSchema.partial().extend({
11379
- host: z11.union([hostSchema, z11.literal("")]).optional().describe("New hostname or IP, or an empty string for a device that connects to Replicas itself."),
11380
- screen_password: z11.union([screenPasswordSchema, z11.literal("")]).optional().describe("New Screen Sharing password, or an empty string to remove it.")
11611
+ host: z13.union([hostSchema, z13.literal("")]).optional().describe("New hostname or IP, or an empty string for a device that connects to Replicas itself."),
11612
+ screen_password: z13.union([screenPasswordSchema, z13.literal("")]).optional().describe("New Screen Sharing password, or an empty string to remove it.")
11381
11613
  });
11382
- var deviceConnectionResponseSchema = z11.object({
11383
- name: z11.string(),
11384
- port: z11.number(),
11385
- workspace_ids: z11.array(z11.string())
11614
+ var deviceConnectionResponseSchema = z13.object({
11615
+ name: z13.string(),
11616
+ port: z13.number(),
11617
+ workspace_ids: z13.array(z13.string())
11386
11618
  });
11387
- var deviceHostKeysRequestSchema = z11.object({
11388
- host_keys: z11.array(z11.string().max(2048).regex(/^[a-z0-9@.-]+ [A-Za-z0-9+/]+={0,3}$/, "Each host key must be `<type> <base64>`")).min(1).max(8).transform((keys) => [...new Set(keys)].sort())
11619
+ var deviceHostKeysRequestSchema = z13.object({
11620
+ host_keys: z13.array(z13.string().max(2048).regex(/^[a-z0-9@.-]+ [A-Za-z0-9+/]+={0,3}$/, "Each host key must be `<type> <base64>`")).min(1).max(8).transform((keys) => [...new Set(keys)].sort())
11389
11621
  });
11390
11622
  var DEVICE_HOST_KEYS_HEADER = "x-replicas-device-host-keys";
11391
- var provisionedDeviceSchema = z11.object({
11392
- name: z11.string(),
11393
- host: z11.string().nullable(),
11394
- port: z11.number(),
11395
- username: z11.string(),
11396
- private_key: z11.string(),
11397
- screen_password: z11.string().optional()
11623
+ var provisionedDeviceSchema = z13.object({
11624
+ name: z13.string(),
11625
+ host: z13.string().nullable(),
11626
+ port: z13.number(),
11627
+ username: z13.string(),
11628
+ private_key: z13.string(),
11629
+ screen_password: z13.string().optional()
11398
11630
  });
11399
11631
 
11400
11632
  // ../shared/src/runtime-env.ts
@@ -11617,19 +11849,19 @@ function gitIdentityConfigCommands(identity, scope = "global") {
11617
11849
  }
11618
11850
 
11619
11851
  // ../shared/src/headless-agent.ts
11620
- import { z as z12 } from "zod";
11621
- var headlessAgentRequestSchema = z12.object({
11622
- mode: z12.literal("structured"),
11623
- agent: z12.custom(
11852
+ import { z as z14 } from "zod";
11853
+ var headlessAgentRequestSchema = z14.object({
11854
+ mode: z14.literal("structured"),
11855
+ agent: z14.custom(
11624
11856
  (value) => typeof value === "string" && isValidAgentProvider(value)
11625
11857
  ),
11626
- model: z12.string().min(1),
11627
- prompt: z12.string(),
11628
- workingDirectory: z12.string().min(1),
11629
- timeoutSeconds: z12.number().int().min(1).max(1800).default(300),
11630
- thinkingLevel: z12.enum(STANDARD_THINKING_LEVELS).optional(),
11631
- codexOauthTokens: z12.object({ accessToken: z12.string(), accountId: z12.string() }).optional(),
11632
- outputSchema: z12.record(z12.string(), z12.json())
11858
+ model: z14.string().min(1),
11859
+ prompt: z14.string(),
11860
+ workingDirectory: z14.string().min(1),
11861
+ timeoutSeconds: z14.number().int().min(1).max(1800).default(300),
11862
+ thinkingLevel: z14.enum(STANDARD_THINKING_LEVELS).optional(),
11863
+ codexOauthTokens: z14.object({ accessToken: z14.string(), accountId: z14.string() }).optional(),
11864
+ outputSchema: z14.record(z14.string(), z14.json())
11633
11865
  });
11634
11866
  var headlessAgentUsagePath = (outputPath) => `${outputPath}.usage`;
11635
11867
 
@@ -11717,15 +11949,15 @@ var SEARCH_OPEN_DEDUPE_MS = 10 * 60 * 1e3;
11717
11949
  var PICK_WINDOW_MS = 21 * DAY_MS;
11718
11950
 
11719
11951
  // ../shared/src/routes/workspaces.ts
11720
- import { z as z14 } from "zod";
11952
+ import { z as z16 } from "zod";
11721
11953
 
11722
11954
  // ../shared/src/workspace-credentials.ts
11723
- import { z as z13 } from "zod";
11955
+ import { z as z15 } from "zod";
11724
11956
  var WORKSPACE_CREDENTIAL_PROVIDERS = ["claude", "codex"];
11725
- var workspaceCredentialProviderSchema = z13.enum(WORKSPACE_CREDENTIAL_PROVIDERS);
11957
+ var workspaceCredentialProviderSchema = z15.enum(WORKSPACE_CREDENTIAL_PROVIDERS);
11726
11958
  var workspaceCredentialSelectionSchema = agentCredentialSnapshotSchema.omit({ revision: true, account: true, credentialId: true });
11727
11959
  var createWorkspaceCredentialSchema = workspaceCredentialSelectionSchema.extend({
11728
- provider: z13.enum(VALID_AGENT_PROVIDERS)
11960
+ provider: z15.enum(VALID_AGENT_PROVIDERS)
11729
11961
  }).refine(({ provider: provider2, method }) => agentCredentialMethods(provider2).includes(method), {
11730
11962
  message: "This inference provider is not supported by this agent"
11731
11963
  });
@@ -11759,16 +11991,16 @@ var DEFAULT_WORKSPACE_FILTERS = {
11759
11991
  activity: "any"
11760
11992
  };
11761
11993
  var ONE_DAY_MS = 24 * 60 * 60 * 1e3;
11762
- var workspaceExecRequestSchema = z14.object({
11763
- command: z14.string().regex(/\S/, "command is required"),
11764
- timeout_seconds: z14.number().int().min(1).max(50).optional().describe("Default: 30")
11994
+ var workspaceExecRequestSchema = z16.object({
11995
+ command: z16.string().regex(/\S/, "command is required"),
11996
+ timeout_seconds: z16.number().int().min(1).max(50).optional().describe("Default: 30")
11765
11997
  });
11766
- var terminalRtcCandidateSchema = z14.object({ type: z14.literal("rtc-candidate"), candidate: z14.string(), mid: z14.string() });
11767
- var terminalSocketServerMessageSchema = z14.discriminatedUnion("type", [
11768
- z14.object({ type: z14.literal("output"), data: z14.string() }),
11769
- z14.object({ type: z14.literal("rtc-answer"), sdp: z14.string() }),
11998
+ var terminalRtcCandidateSchema = z16.object({ type: z16.literal("rtc-candidate"), candidate: z16.string(), mid: z16.string() });
11999
+ var terminalSocketServerMessageSchema = z16.discriminatedUnion("type", [
12000
+ z16.object({ type: z16.literal("output"), data: z16.string() }),
12001
+ z16.object({ type: z16.literal("rtc-answer"), sdp: z16.string() }),
11770
12002
  terminalRtcCandidateSchema,
11771
- z14.object({ type: z14.literal("rtc-switch") })
12003
+ z16.object({ type: z16.literal("rtc-switch") })
11772
12004
  ]);
11773
12005
  var TERMINAL_RTC_ICE_SERVER = "stun:stun.l.google.com:19302";
11774
12006
 
@@ -11815,62 +12047,62 @@ function describeAuthFallback(payload) {
11815
12047
  }
11816
12048
 
11817
12049
  // ../shared/src/chat-fork.ts
11818
- import { z as z16 } from "zod";
12050
+ import { z as z18 } from "zod";
11819
12051
 
11820
12052
  // ../shared/src/fallback-chains.ts
11821
- import { z as z15 } from "zod";
11822
- var fallbackHarnessStepSchema = z15.object({
11823
- kind: z15.literal("harness"),
11824
- provider: z15.enum(VALID_AGENT_PROVIDERS),
11825
- model: z15.string().min(1),
11826
- thinkingLevel: z15.enum(VALID_THINKING_LEVELS).optional().catch(void 0)
12053
+ import { z as z17 } from "zod";
12054
+ var fallbackHarnessStepSchema = z17.object({
12055
+ kind: z17.literal("harness"),
12056
+ provider: z17.enum(VALID_AGENT_PROVIDERS),
12057
+ model: z17.string().min(1),
12058
+ thinkingLevel: z17.enum(VALID_THINKING_LEVELS).optional().catch(void 0)
11827
12059
  });
11828
- var fallbackPlanStepSchema = z15.discriminatedUnion("kind", [
11829
- z15.object({
11830
- kind: z15.literal("credentials"),
12060
+ var fallbackPlanStepSchema = z17.discriminatedUnion("kind", [
12061
+ z17.object({
12062
+ kind: z17.literal("credentials"),
11831
12063
  // An empty list would allow every method.
11832
- methods: z15.array(z15.unknown()).transform((methods) => methods.filter(isAuthMethod)).refine((methods) => methods.length > 0),
11833
- models: z15.record(z15.string(), z15.string().min(1)).optional()
12064
+ methods: z17.array(z17.unknown()).transform((methods) => methods.filter(isAuthMethod)).refine((methods) => methods.length > 0),
12065
+ models: z17.record(z17.string(), z17.string().min(1)).optional()
11834
12066
  }),
11835
12067
  fallbackHarnessStepSchema
11836
12068
  ]);
11837
- var fallbackPlanResponseSchema = z15.object({
11838
- steps: z15.array(z15.unknown()).transform((steps) => steps.flatMap((step) => fallbackPlanStepSchema.safeParse(step).data ?? []))
12069
+ var fallbackPlanResponseSchema = z17.object({
12070
+ steps: z17.array(z17.unknown()).transform((steps) => steps.flatMap((step) => fallbackPlanStepSchema.safeParse(step).data ?? []))
11839
12071
  });
11840
12072
 
11841
12073
  // ../shared/src/chat-fork.ts
11842
- var fallbackReasonSchema = z16.enum(AGENT_FALLBACK_REASONS);
11843
- var chatForkInfoSchema = z16.object({
11844
- source: z16.object({
11845
- chatId: z16.string().min(1),
11846
- provider: z16.enum(VALID_AGENT_PROVIDERS),
11847
- title: z16.string()
12074
+ var fallbackReasonSchema = z18.enum(AGENT_FALLBACK_REASONS);
12075
+ var chatForkInfoSchema = z18.object({
12076
+ source: z18.object({
12077
+ chatId: z18.string().min(1),
12078
+ provider: z18.enum(VALID_AGENT_PROVIDERS),
12079
+ title: z18.string()
11848
12080
  }),
11849
- trigger: z16.enum(["manual", "auto", "side", "switch"]),
12081
+ trigger: z18.enum(["manual", "auto", "side", "switch"]),
11850
12082
  reason: fallbackReasonSchema.optional(),
11851
- state: z16.enum(["preparing", "ready", "failed"]),
11852
- error: z16.string().optional(),
11853
- startedAt: z16.string(),
11854
- completedAt: z16.string().optional()
12083
+ state: z18.enum(["preparing", "ready", "failed"]),
12084
+ error: z18.string().optional(),
12085
+ startedAt: z18.string(),
12086
+ completedAt: z18.string().optional()
11855
12087
  });
11856
12088
  function coerceChatForkInfo(value) {
11857
12089
  const parsed = chatForkInfoSchema.safeParse(value);
11858
12090
  return parsed.success ? parsed.data : null;
11859
12091
  }
11860
- var forkChatRequestSchema = z16.object({
11861
- provider: z16.enum(VALID_AGENT_PROVIDERS),
11862
- model: z16.string().min(1).optional(),
11863
- thinkingLevel: z16.enum(VALID_THINKING_LEVELS).optional(),
11864
- title: z16.string().min(1).max(200).optional(),
11865
- message: z16.string().trim().optional(),
11866
- id: z16.string().uuid().optional(),
11867
- clientRequestId: z16.string().min(1).max(128).optional(),
11868
- enableInteractiveTools: z16.boolean().optional(),
12092
+ var forkChatRequestSchema = z18.object({
12093
+ provider: z18.enum(VALID_AGENT_PROVIDERS),
12094
+ model: z18.string().min(1).optional(),
12095
+ thinkingLevel: z18.enum(VALID_THINKING_LEVELS).optional(),
12096
+ title: z18.string().min(1).max(200).optional(),
12097
+ message: z18.string().trim().optional(),
12098
+ id: z18.string().uuid().optional(),
12099
+ clientRequestId: z18.string().min(1).max(128).optional(),
12100
+ enableInteractiveTools: z18.boolean().optional(),
11869
12101
  // Server-injected by the monolith from the authenticated request; never trusted from clients.
11870
- senderUserId: z16.string().optional(),
11871
- senderEmail: z16.string().optional(),
11872
- senderDisplayName: z16.string().optional(),
11873
- senderAvatarUrl: z16.string().optional()
12102
+ senderUserId: z18.string().optional(),
12103
+ senderEmail: z18.string().optional(),
12104
+ senderDisplayName: z18.string().optional(),
12105
+ senderAvatarUrl: z18.string().optional()
11874
12106
  });
11875
12107
  function describeQuotaLimit(reason) {
11876
12108
  if (reason === "auth_failed") return "could not authenticate";
@@ -11882,10 +12114,10 @@ function describeChatForkReason(reason, provider2) {
11882
12114
  return reason ? `${getProviderDisplayName(provider2)} ${describeQuotaLimit(reason)}` : null;
11883
12115
  }
11884
12116
  var AGENT_QUOTA_EXHAUSTED_EVENT_TYPE = "agent-quota-exhausted";
11885
- var agentQuotaExhaustedPayloadSchema = z16.object({
11886
- provider: z16.enum(VALID_AGENT_PROVIDERS),
12117
+ var agentQuotaExhaustedPayloadSchema = z18.object({
12118
+ provider: z18.enum(VALID_AGENT_PROVIDERS),
11887
12119
  reason: fallbackReasonSchema,
11888
- detail: z16.string().optional(),
12120
+ detail: z18.string().optional(),
11889
12121
  forkTo: fallbackHarnessStepSchema.optional()
11890
12122
  });
11891
12123
  function defaultForkChatTitle(source, provider2) {
@@ -11920,21 +12152,21 @@ function getChatThreadSources(chats, chat) {
11920
12152
  }
11921
12153
 
11922
12154
  // ../shared/src/credential-refresh.ts
11923
- import { z as z17 } from "zod";
11924
- var engineCredentialRefreshFailureSchema = z17.object({
11925
- code: z17.string(),
12155
+ import { z as z19 } from "zod";
12156
+ var engineCredentialRefreshFailureSchema = z19.object({
12157
+ code: z19.string(),
11926
12158
  credential: workspaceCredentialSelectionSchema.optional()
11927
12159
  });
11928
12160
 
11929
12161
  // ../shared/src/credential-pool.ts
11930
- import { z as z18 } from "zod";
12162
+ import { z as z20 } from "zod";
11931
12163
  var MAX_CREDENTIAL_POOL_ACCOUNTS = 10;
11932
- var reorderCredentialPoolSchema = z18.object({
11933
- credential_ids: z18.array(z18.string().uuid()).min(1).max(MAX_CREDENTIAL_POOL_ACCOUNTS)
12164
+ var reorderCredentialPoolSchema = z20.object({
12165
+ credential_ids: z20.array(z20.string().uuid()).min(1).max(MAX_CREDENTIAL_POOL_ACCOUNTS)
11934
12166
  });
11935
12167
 
11936
12168
  // ../shared/src/mothership-events.ts
11937
- import { z as z25 } from "zod";
12169
+ import { z as z26 } from "zod";
11938
12170
 
11939
12171
  // ../shared/src/design-tokens.ts
11940
12172
  var plain = {
@@ -12101,58 +12333,7 @@ var LINEAR_ICON_DEFINITION = {
12101
12333
  };
12102
12334
 
12103
12335
  // ../shared/src/replicas-mcp.ts
12104
- import { z as z20 } from "zod";
12105
-
12106
- // ../shared/src/automations/trigger-schemas.ts
12107
- import { z as z19 } from "zod";
12108
-
12109
- // ../shared/src/uuid.ts
12110
- function createUuidFromHex(value) {
12111
- return `${value.slice(0, 8)}-${value.slice(8, 12)}-5${value.slice(13, 16)}-${(Number.parseInt(value.slice(16, 17), 16) & 3 | 8).toString(16)}${value.slice(17, 20)}-${value.slice(20, 32)}`;
12112
- }
12113
- var UUID_RE = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;
12114
-
12115
- // ../shared/src/automations/github/index.ts
12116
- var REVIEW_REQUESTED_EVENT = "pull_request.review_requested";
12117
-
12118
- // ../shared/src/automations/trigger-schemas.ts
12119
- function getReviewerLoginsError(event, logins) {
12120
- const isReviewRequested = event === REVIEW_REQUESTED_EVENT;
12121
- if (isReviewRequested === !!logins?.some((login) => login.trim().replace(/^@+/, ""))) return null;
12122
- return isReviewRequested ? "The PR review requested trigger needs at least one GitHub username" : "Requested reviewers only apply to the PR review requested trigger";
12123
- }
12124
- var repositoryTriggerConfigSchema = z19.object({
12125
- event: z19.string(),
12126
- repository_ids: z19.array(z19.string().regex(UUID_RE, "must be a repository id")).optional(),
12127
- group_pr_events: z19.boolean().optional(),
12128
- excluded_actors: z19.array(z19.string()).optional(),
12129
- reviewer_logins: z19.array(z19.string()).optional()
12130
- });
12131
- var cronTriggerSchema = z19.object({ type: z19.literal("cron"), config: z19.object({ schedule: z19.string(), timezone: z19.string().optional() }) });
12132
- var githubTriggerSchema = z19.object({
12133
- type: z19.literal("github"),
12134
- config: repositoryTriggerConfigSchema.superRefine((config, ctx) => {
12135
- const message2 = getReviewerLoginsError(config.event, config.reviewer_logins);
12136
- if (message2) ctx.addIssue({ code: "custom", message: message2, path: ["reviewer_logins"] });
12137
- })
12138
- });
12139
- var gitlabTriggerSchema = z19.object({ type: z19.literal("gitlab"), config: repositoryTriggerConfigSchema });
12140
- var linearTriggerConfigSchema = linearIssueFiltersSchema.extend({
12141
- event: z19.string(),
12142
- team_ids: z19.array(z19.string()).optional(),
12143
- state_types: z19.array(z19.enum(LINEAR_STATE_TYPES)).optional()
12144
- }).superRefine((config, ctx) => {
12145
- if (config.event === LINEAR_ISSUE_MATCHED_EVENT && config.team_ids?.length !== 1) ctx.addIssue({ code: "custom", message: "The Linear issue matches trigger needs exactly one team", path: ["team_ids"] });
12146
- });
12147
- var automationTriggerSchema = z19.discriminatedUnion("type", [
12148
- cronTriggerSchema,
12149
- githubTriggerSchema,
12150
- gitlabTriggerSchema,
12151
- z19.object({ type: z19.literal("slack"), config: z19.object({ event: z19.string(), channel_ids: z19.array(z19.string()).optional(), group_thread_replies: z19.boolean().optional() }) }),
12152
- z19.object({ type: z19.literal("sentry"), config: z19.object({ event: z19.string(), project_slugs: z19.array(z19.string()).optional(), min_level: z19.string().optional() }) }),
12153
- z19.object({ type: z19.literal("linear"), config: linearTriggerConfigSchema }),
12154
- z19.object({ type: z19.literal("custom"), config: z19.object({}) })
12155
- ]);
12336
+ import { z as z22 } from "zod";
12156
12337
 
12157
12338
  // ../shared/src/automations/types.ts
12158
12339
  var AUTOMATION_DEBOUNCE_MAX_SECONDS = 24 * 60 * 60;
@@ -12172,6 +12353,14 @@ var AUTOMATION_EXECUTION_MACHINE = defineStateMachine(AUTOMATION_EXECUTION_STATU
12172
12353
  var AUTOMATION_AUTO_PAUSE_DAYS = 7;
12173
12354
  var AUTOMATION_AUTO_PAUSE_LABEL = `Paused after failing every run for ${AUTOMATION_AUTO_PAUSE_DAYS} days`;
12174
12355
 
12356
+ // ../shared/src/routes/environment-config-source.ts
12357
+ import { z as z21 } from "zod";
12358
+ var previewEnvironmentConfigSourceRequestSchema = z21.strictObject({ repository_id: z21.string().min(1).optional() });
12359
+ var applyEnvironmentConfigSourceRequestSchema = previewEnvironmentConfigSourceRequestSchema.extend({
12360
+ commit_sha: z21.string().min(1),
12361
+ fingerprint: z21.string().min(1)
12362
+ });
12363
+
12175
12364
  // ../shared/src/replicas-mcp.ts
12176
12365
  var REPLICAS_MCP_SERVER_NAME = "replicas-mcp";
12177
12366
  var REPLICAS_MCP_TOOLS = {
@@ -12205,6 +12394,7 @@ var REPLICAS_MCP_TOOLS = {
12205
12394
  getBoard: "get_board",
12206
12395
  updateBoard: "update_board",
12207
12396
  updateTicket: "update_ticket",
12397
+ replyOnTicket: "reply_on_ticket",
12208
12398
  sendToChat: "send_to_chat",
12209
12399
  getLinearRouting: "get_linear_routing",
12210
12400
  setLinearRouting: "set_linear_routing",
@@ -12232,55 +12422,57 @@ var REPLICAS_MCP_TOOLS = {
12232
12422
  deleteChat: "delete_chat",
12233
12423
  listRepositories: "list_repositories"
12234
12424
  };
12235
- var automationToolInputSchema = z20.object({
12236
- name: z20.string().describe("Short automation name."),
12237
- prompt: z20.string().describe("Prompt each automation run starts with."),
12238
- environment_id: z20.string().describe(`Environment id from \`${REPLICAS_MCP_TOOLS.listEnvironments}\`.`),
12239
- triggers: z20.array(automationTriggerSchema).min(1).describe(
12425
+ var automationToolInputSchema = z22.object({
12426
+ name: z22.string().describe("Short automation name."),
12427
+ prompt: z22.string().describe("Prompt each automation run starts with."),
12428
+ environment_id: z22.string().describe(`Environment id from \`${REPLICAS_MCP_TOOLS.listEnvironments}\`.`),
12429
+ triggers: z22.array(automationTriggerSchema).min(1).describe(
12240
12430
  `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>"] } }\`. Linear: \`{ "type": "linear", "config": { "event": "${LINEAR_ISSUE_STATE_CHANGED_EVENT}", "state_types": ["completed"] } }\`.`
12241
12431
  ),
12242
- description: z20.string().optional().describe("One-line summary shown in the dashboard."),
12243
- plan_mode: z20.boolean().optional(),
12244
- goal_mode: z20.boolean().optional(),
12245
- fast_mode: z20.boolean().optional(),
12246
- workspace_lifecycle_policy: z20.enum(AUTOMATION_LIFECYCLE_POLICIES).optional().describe(
12432
+ description: z22.string().optional().describe("One-line summary shown in the dashboard."),
12433
+ plan_mode: z22.boolean().optional(),
12434
+ goal_mode: z22.boolean().optional(),
12435
+ fast_mode: z22.boolean().optional(),
12436
+ workspace_lifecycle_policy: z22.enum(AUTOMATION_LIFECYCLE_POLICIES).optional().describe(
12247
12437
  "What happens to a run's workspace when the agent finishes. `delete_when_done` (default, except one-time runs, which default to `default`) when the output lives elsewhere (PR comments, checks, Slack posts); `sleep_when_done` when later runs reuse the workspace, like one per PR across pushes; `default` (keep alive) when people follow up in the workspace."
12248
12438
  )
12249
12439
  });
12250
12440
  var credentialUserIdDescription = `Organization automations only: the user ID (see \`${REPLICAS_MCP_TOOLS.whoami}\`) of the member whose coding agent credentials, such as their Claude subscription, runs use before the organization's. Only your workspace's owner, or whoever's credentials this workspace runs on.`;
12251
- var automationBackgroundSchema = z20.boolean().optional().describe(
12441
+ var automationBackgroundSchema = z22.boolean().optional().describe(
12252
12442
  "Marks this as an AI agent's own automation (a reminder, follow-up or recurring check-in for its task). Kept out of the main automations list."
12253
12443
  );
12254
12444
  var automationCreateToolInputSchema = automationToolInputSchema.extend({
12255
- credential_user_id: z20.string().optional().describe(`${credentialUserIdDescription} Omit to use the organization's.`),
12445
+ credential_user_id: z22.string().optional().describe(`${credentialUserIdDescription} Omit to use the organization's.`),
12256
12446
  background: automationBackgroundSchema,
12257
- scope: z20.enum(["org", "user"]).optional().describe("`org` (default) or `user` for a personal automation, which needs a personal API key.")
12447
+ scope: z22.enum(["org", "user"]).optional().describe("`org` (default) or `user` for a personal automation, which needs a personal API key.")
12258
12448
  });
12259
12449
  var automationUpdateToolInputSchema = automationToolInputSchema.partial().extend({
12260
- automation_id: z20.string().describe("Automation ID"),
12261
- enabled: z20.boolean().optional(),
12262
- agent_provider: z20.enum(AGENT).nullable().optional(),
12263
- model: z20.string().nullable().optional(),
12264
- thinking_level: z20.enum(VALID_THINKING_LEVELS).nullable().optional(),
12265
- workspace_size: z20.enum(WORKSPACE_SIZES).optional(),
12266
- credential_user_id: z20.string().nullable().optional().describe(`${credentialUserIdDescription} Null switches back to the organization's.`),
12450
+ automation_id: z22.string().describe("Automation ID"),
12451
+ enabled: z22.boolean().optional(),
12452
+ agent_provider: z22.enum(AGENT).nullable().optional(),
12453
+ model: z22.string().nullable().optional(),
12454
+ thinking_level: z22.enum(VALID_THINKING_LEVELS).nullable().optional(),
12455
+ workspace_size: z22.enum(WORKSPACE_SIZES).optional(),
12456
+ credential_user_id: z22.string().nullable().optional().describe(`${credentialUserIdDescription} Null switches back to the organization's.`),
12267
12457
  background: automationBackgroundSchema,
12268
- scope: z20.literal("org").optional().describe("`org` moves a personal automation to the organization so teammates can see and edit it. It cannot be moved back.")
12458
+ scope: z22.literal("org").optional().describe("`org` moves a personal automation to the organization so teammates can see and edit it. It cannot be moved back.")
12269
12459
  });
12270
- var chatPath = { id: z20.string().describe("Workspace ID"), chat_id: z20.string().describe("Chat ID") };
12460
+ var chatPath = { id: z22.string().describe("Workspace ID"), chat_id: z22.string().describe("Chat ID") };
12271
12461
  var { provider, model, thinkingLevel, title, message } = forkChatRequestSchema.shape;
12272
- var createChatToolInputSchema = z20.object({ id: chatPath.id, provider, title: createChatRequestSchema.shape.title });
12273
- var forkChatToolInputSchema = z20.object({ ...chatPath, provider, model, thinking_level: thinkingLevel, title, message });
12274
- var renameChatToolInputSchema = z20.object({ ...chatPath, display_name: updateChatDisplayNameRequestSchema.shape.displayName });
12275
- var runCommandToolInputSchema = z20.object({ id: chatPath.id, ...workspaceExecRequestSchema.shape });
12276
- var environmentMcpPath = { environment_id: z20.string().describe("Environment ID") };
12277
- var createEnvironmentMcpToolInputSchema = z20.object({ ...environmentMcpPath, ...createEnvironmentMcpRequestSchema.shape });
12278
- var updateEnvironmentMcpToolInputSchema = z20.object({
12462
+ var createChatToolInputSchema = z22.object({ id: chatPath.id, provider, title: createChatRequestSchema.shape.title });
12463
+ var forkChatToolInputSchema = z22.object({ ...chatPath, provider, model, thinking_level: thinkingLevel, title, message });
12464
+ var renameChatToolInputSchema = z22.object({ ...chatPath, display_name: updateChatDisplayNameRequestSchema.shape.displayName });
12465
+ var runCommandToolInputSchema = z22.object({ id: chatPath.id, ...workspaceExecRequestSchema.shape });
12466
+ var environmentMcpPath = { environment_id: z22.string().describe("Environment ID") };
12467
+ var createEnvironmentMcpToolInputSchema = z22.object({ ...environmentMcpPath, ...createEnvironmentMcpRequestSchema.shape });
12468
+ var updateEnvironmentMcpToolInputSchema = z22.object({
12279
12469
  ...environmentMcpPath,
12280
- mcp_id: z20.string().describe("MCP ID"),
12470
+ mcp_id: z22.string().describe("MCP ID"),
12281
12471
  ...updateEnvironmentMcpRequestSchema.shape
12282
12472
  });
12283
- var createEnvironmentDeviceToolInputSchema = z20.object({ ...environmentMcpPath, ...createEnvironmentDeviceRequestSchema.shape });
12473
+ var createEnvironmentDeviceToolInputSchema = z22.object({ ...environmentMcpPath, ...createEnvironmentDeviceRequestSchema.shape });
12474
+ var previewEnvironmentConfigSourceToolInputSchema = z22.object({ ...environmentMcpPath, ...previewEnvironmentConfigSourceRequestSchema.shape });
12475
+ var applyEnvironmentConfigSourceToolInputSchema = z22.object({ ...environmentMcpPath, ...applyEnvironmentConfigSourceRequestSchema.shape });
12284
12476
 
12285
12477
  // ../shared/src/scout.ts
12286
12478
  var SCOUT_SOURCE_TYPES = ["slack", "linear"];
@@ -12373,63 +12565,63 @@ When someone asks for a recurring task or accepts an offer to automate a repeate
12373
12565
  `;
12374
12566
 
12375
12567
  // ../shared/src/routes/preferences.ts
12376
- import { z as z24 } from "zod";
12568
+ import { z as z25 } from "zod";
12377
12569
 
12378
12570
  // ../shared/src/routes/push.ts
12379
- import { z as z21 } from "zod";
12571
+ import { z as z23 } from "zod";
12380
12572
 
12381
12573
  // ../shared/src/workspace-attention.ts
12382
12574
  var WORKSPACE_ATTENTION_REASONS = ["question", "plan", "variables", "blocked", "setup", "deploy_failed"];
12383
12575
  var CHAT_ATTENTION_REASONS = ["question", "blocked"];
12384
12576
 
12385
12577
  // ../shared/src/routes/push.ts
12386
- var registerPushDeviceRequestSchema = z21.discriminatedUnion("platform", [
12387
- z21.object({
12388
- platform: z21.literal("ios"),
12389
- token: z21.string().regex(/^[0-9a-f]{64,200}$/i),
12390
- appId: z21.string().min(1).max(255),
12391
- apnsEnvironment: z21.enum(["sandbox", "production"])
12578
+ var registerPushDeviceRequestSchema = z23.discriminatedUnion("platform", [
12579
+ z23.object({
12580
+ platform: z23.literal("ios"),
12581
+ token: z23.string().regex(/^[0-9a-f]{64,200}$/i),
12582
+ appId: z23.string().min(1).max(255),
12583
+ apnsEnvironment: z23.enum(["sandbox", "production"])
12392
12584
  }),
12393
- z21.object({
12394
- platform: z21.literal("android"),
12395
- token: z21.string().min(1).max(4096),
12396
- appId: z21.string().min(1).max(255)
12585
+ z23.object({
12586
+ platform: z23.literal("android"),
12587
+ token: z23.string().min(1).max(4096),
12588
+ appId: z23.string().min(1).max(255)
12397
12589
  })
12398
12590
  ]);
12399
12591
  var PUSH_HOLD_MINUTES = 5;
12400
- var chatRefSchema = z21.object({ workspaceId: z21.string().uuid(), chatId: z21.string().min(1).max(100) });
12401
- var recordPushActivityRequestSchema = z21.object({
12402
- organizationId: z21.string().uuid(),
12592
+ var chatRefSchema = z23.object({ workspaceId: z23.string().uuid(), chatId: z23.string().min(1).max(100) });
12593
+ var recordPushActivityRequestSchema = z23.object({
12594
+ organizationId: z23.string().uuid(),
12403
12595
  /** Seconds since the last keyboard or mouse input on this computer. A phone leaves it out: it only reports what it has open. */
12404
- idleSeconds: z21.number().min(0).optional(),
12405
- seenWorkspaceIds: z21.array(z21.string().uuid()).max(20),
12406
- seenChats: z21.array(chatRefSchema).max(20).optional()
12596
+ idleSeconds: z23.number().min(0).optional(),
12597
+ seenWorkspaceIds: z23.array(z23.string().uuid()).max(20),
12598
+ seenChats: z23.array(chatRefSchema).max(20).optional()
12407
12599
  });
12408
12600
  var PUSH_NOTIFICATION_KINDS = [...WORKSPACE_ATTENTION_REASONS, "finished"];
12409
12601
  var PUSH_OPTION_LABEL_MAX = 60;
12410
12602
  var PUSH_OPTIONS_MAX = 4;
12411
- var pushQuestionSchema = z21.object({ id: z21.string().max(64), allowCustom: z21.boolean().optional(), options: z21.array(z21.object({ id: z21.string().max(64), label: z21.string().min(1).max(PUSH_OPTION_LABEL_MAX) })).min(1).max(PUSH_OPTIONS_MAX) });
12412
- var pushNotificationDataSchema = z21.object({
12413
- organizationId: z21.string(),
12414
- workspaceId: z21.string(),
12415
- chatId: z21.string().nullable(),
12416
- kind: z21.enum(PUSH_NOTIFICATION_KINDS),
12417
- completedAt: z21.string(),
12418
- toolRequestId: z21.string().optional(),
12603
+ var pushQuestionSchema = z23.object({ id: z23.string().max(64), allowCustom: z23.boolean().optional(), options: z23.array(z23.object({ id: z23.string().max(64), label: z23.string().min(1).max(PUSH_OPTION_LABEL_MAX) })).min(1).max(PUSH_OPTIONS_MAX) });
12604
+ var pushNotificationDataSchema = z23.object({
12605
+ organizationId: z23.string(),
12606
+ workspaceId: z23.string(),
12607
+ chatId: z23.string().nullable(),
12608
+ kind: z23.enum(PUSH_NOTIFICATION_KINDS),
12609
+ completedAt: z23.string(),
12610
+ toolRequestId: z23.string().optional(),
12419
12611
  question: pushQuestionSchema.optional()
12420
12612
  });
12421
- var workspaceSharedPushDataSchema = pushNotificationDataSchema.pick({ organizationId: true, workspaceId: true, chatId: true, completedAt: true }).extend({ kind: z21.literal("shared") });
12613
+ var workspaceSharedPushDataSchema = pushNotificationDataSchema.pick({ organizationId: true, workspaceId: true, chatId: true, completedAt: true }).extend({ kind: z23.literal("shared") });
12422
12614
  var registerLiveActivityRequestSchema = chatRefSchema.extend({
12423
- deviceId: z21.string().uuid(),
12615
+ deviceId: z23.string().uuid(),
12424
12616
  /** The iOS activity's push token. Android leaves it out and gets FCM data messages on the device token. */
12425
- pushToken: z21.string().regex(/^[0-9a-f]{64,400}$/i).optional(),
12617
+ pushToken: z23.string().regex(/^[0-9a-f]{64,400}$/i).optional(),
12426
12618
  /** iOS only: when the card's turn started, in seconds. Cards keep their order by it. */
12427
- startedAt: z21.number().positive().optional()
12619
+ startedAt: z23.number().positive().optional()
12428
12620
  });
12429
- var syncLiveActivitiesRequestSchema = z21.object({
12430
- activities: z21.array(chatRefSchema).max(100)
12621
+ var syncLiveActivitiesRequestSchema = z23.object({
12622
+ activities: z23.array(chatRefSchema).max(100)
12431
12623
  });
12432
- var setLiveActivityStartTokenRequestSchema = z21.object({ token: z21.string().regex(/^[0-9a-f]{64,400}$/i) });
12624
+ var setLiveActivityStartTokenRequestSchema = z23.object({ token: z23.string().regex(/^[0-9a-f]{64,400}$/i) });
12433
12625
 
12434
12626
  // ../shared/src/default-skills/replicas-agent/abilities/computer.ts
12435
12627
  var SECTION = `### Computer use (Linux desktop control)
@@ -12710,156 +12902,6 @@ var DOCKER_ABILITY = {
12710
12902
  referenceFile: { name: "DOCKER.md", content: REFERENCE2 }
12711
12903
  };
12712
12904
 
12713
- // ../shared/src/routes/environment-setups.ts
12714
- import { z as z22 } from "zod";
12715
- var ENVIRONMENT_SETUP_STEPS = [
12716
- { key: "understand", label: "Understand the codebase" },
12717
- { key: "install", label: "Install dependencies and run the app" },
12718
- { key: "verify", label: "Verify checks and record a walkthrough" },
12719
- { key: "configure", label: "Draft hooks, system prompt, and automations" },
12720
- { key: "propose", label: "Propose the configuration for review" }
12721
- ];
12722
- var ENVIRONMENT_SETUP_STEP_STATUSES = ["pending", "in_progress", "completed", "skipped"];
12723
- var ENVIRONMENT_SETUP_RUN_STATUSES = ["running", "proposed", "applied", "failed", "cancelled", "expired"];
12724
- var ENVIRONMENT_SETUP_AUTOMATION_ACTIONS = ["create", "update", "keep", "disable"];
12725
- var ENVIRONMENT_SETUP_VERIFICATION_STATUSES = ["passed", "failed", "skipped"];
12726
- var ENVIRONMENT_SETUP_LIMITS = {
12727
- summaryChars: 600,
12728
- stackItems: 30,
12729
- nameChars: 120,
12730
- descriptionChars: 1e3,
12731
- systemPromptChars: 2e4,
12732
- hookChars: 5e4,
12733
- variables: 50,
12734
- variableKeyChars: 128,
12735
- variableDescriptionChars: 500,
12736
- automations: 8,
12737
- automationKeyChars: 80,
12738
- automationPromptChars: 1e4,
12739
- automationTriggers: 5,
12740
- automationNoteChars: 300,
12741
- verificationItems: 8,
12742
- verificationDetailChars: 300,
12743
- mediaItems: 8,
12744
- repositories: 20
12745
- };
12746
- var VARIABLE_KEY_RE = /^[A-Za-z_][A-Za-z0-9_]*$/;
12747
- var text2 = (max) => max === void 0 ? z22.string().trim() : z22.string().trim().max(max);
12748
- var requiredText = (max) => text2(max).min(1, "must not be empty");
12749
- var optionalText2 = (max) => text2(max).nullish().transform((value) => value || null);
12750
- var clearableText = (max) => text2(max).nullish().transform((value) => value === void 0 ? void 0 : value || null);
12751
- var list = (item, max) => max === void 0 ? z22.array(item) : z22.array(item).max(max);
12752
- var ENVIRONMENT_SETUP_AUTHORED_TRIGGER_TYPES = ["cron", "github", "gitlab"];
12753
- function isEnvironmentSetupAuthoredTriggerType(type) {
12754
- return ENVIRONMENT_SETUP_AUTHORED_TRIGGER_TYPES.some((authored) => authored === type);
12755
- }
12756
- var proposalTriggerSchema = z22.discriminatedUnion("type", [cronTriggerSchema, githubTriggerSchema, gitlabTriggerSchema]);
12757
- var existingTriggerSchema = z22.custom(
12758
- (value) => isRecord(value) && typeof value.type === "string" && isRecord(value.config),
12759
- "must be an automation trigger"
12760
- );
12761
- var carriedTriggerSchema = existingTriggerSchema.refine(
12762
- (trigger) => !isEnvironmentSetupAuthoredTriggerType(trigger.type)
12763
- );
12764
- function automationSchema(limits) {
12765
- const authored = z22.object({
12766
- name: text2(limits.nameChars),
12767
- description: text2(limits.descriptionChars),
12768
- prompt: text2(limits.automationPromptChars),
12769
- triggers: list(proposalTriggerSchema, limits.automationTriggers)
12770
- });
12771
- const updated = authored.extend({ triggers: list(z22.union([proposalTriggerSchema, carriedTriggerSchema]), limits.automationTriggers) });
12772
- return z22.object({
12773
- key: requiredText(limits.automationKeyChars),
12774
- action: z22.enum(ENVIRONMENT_SETUP_AUTOMATION_ACTIONS).default("create"),
12775
- automation_id: z22.string().regex(UUID_RE, "must be an automation id").nullable().default(null),
12776
- name: text2().default(""),
12777
- description: optionalText2().transform((value) => value ?? ""),
12778
- prompt: text2().default(""),
12779
- triggers: list(existingTriggerSchema).default([]),
12780
- note: optionalText2(limits.automationNoteChars)
12781
- }).superRefine((automation, ctx) => {
12782
- if (automation.action === "create" && automation.automation_id) {
12783
- ctx.addIssue({ code: "custom", path: ["automation_id"], message: "belongs on an update, keep, or disable entry" });
12784
- }
12785
- if (automation.action !== "create" && !automation.automation_id) {
12786
- ctx.addIssue({ code: "custom", path: ["automation_id"], message: "must be the id of an automation attached to this environment" });
12787
- }
12788
- if (automation.action === "create" || automation.action === "update") {
12789
- if (!automation.name) ctx.addIssue({ code: "custom", path: ["name"], message: "must not be empty" });
12790
- if (!automation.prompt) ctx.addIssue({ code: "custom", path: ["prompt"], message: "must not be empty" });
12791
- if (automation.triggers.length === 0) ctx.addIssue({ code: "custom", path: ["triggers"], message: "must not be empty" });
12792
- }
12793
- }).transform((automation, ctx) => {
12794
- if (automation.action === "keep" || automation.action === "disable") return automation;
12795
- const content = (automation.action === "update" ? updated : authored).safeParse(automation);
12796
- if (content.success) return { ...automation, ...content.data };
12797
- for (const issue of content.error.issues) ctx.addIssue({ ...issue, code: "custom" });
12798
- return z22.NEVER;
12799
- });
12800
- }
12801
- function automationListSchema(limits) {
12802
- return list(automationSchema(limits)).default([]).superRefine((automations, ctx) => {
12803
- if (new Set(automations.map((automation) => automation.key)).size !== automations.length) {
12804
- ctx.addIssue({ code: "custom", message: "must have unique keys" });
12805
- }
12806
- const targets = automations.flatMap((automation) => automation.automation_id ?? []);
12807
- if (new Set(targets).size !== targets.length) {
12808
- ctx.addIssue({ code: "custom", message: "must mention each existing automation once" });
12809
- }
12810
- if (limits.automations !== void 0 && automations.filter((automation) => automation.action === "create").length > limits.automations) {
12811
- ctx.addIssue({ code: "custom", message: `must create at most ${limits.automations} new automations` });
12812
- }
12813
- });
12814
- }
12815
- function environmentSchema(limits) {
12816
- return z22.object({
12817
- name: optionalText2(limits.nameChars).transform((value) => value ?? void 0),
12818
- description: clearableText(limits.descriptionChars),
12819
- system_prompt: clearableText(limits.systemPromptChars),
12820
- start_hook: clearableText(limits.hookChars),
12821
- warm_hook: clearableText(limits.hookChars)
12822
- });
12823
- }
12824
- function proposalSchema(limits) {
12825
- return z22.object({
12826
- summary: requiredText(limits.summaryChars),
12827
- stack: list(text2(), limits.stackItems).default([]).transform((items) => items.filter(Boolean)),
12828
- environment: environmentSchema(limits),
12829
- variables: list(z22.object({
12830
- key: z22.string().regex(VARIABLE_KEY_RE, "must be a valid environment variable name").max(limits.variableKeyChars ?? Number.POSITIVE_INFINITY),
12831
- description: optionalText2(limits.variableDescriptionChars).transform((value) => value ?? ""),
12832
- required: z22.boolean().default(false)
12833
- }), limits.variables).default([]),
12834
- automations: automationListSchema(limits),
12835
- verification: list(z22.object({
12836
- label: requiredText(limits.nameChars),
12837
- status: z22.enum(ENVIRONMENT_SETUP_VERIFICATION_STATUSES),
12838
- detail: optionalText2(limits.verificationDetailChars).transform((value) => value ?? void 0)
12839
- }), limits.verificationItems).default([]),
12840
- media: list(z22.object({
12841
- media_id: z22.string().regex(UUID_RE, "must be a media id"),
12842
- title: requiredText(limits.nameChars)
12843
- }), limits.mediaItems).default([])
12844
- });
12845
- }
12846
- var environmentSetupProposalSchema = proposalSchema({});
12847
- var environmentSetupProposalSubmissionSchema = proposalSchema(ENVIRONMENT_SETUP_LIMITS);
12848
- var environmentSetupRunStateSchema = z22.object({
12849
- status: z22.enum(ENVIRONMENT_SETUP_RUN_STATUSES),
12850
- steps: z22.partialRecord(z22.enum(ENVIRONMENT_SETUP_STEPS.map((step) => step.key)), z22.enum(ENVIRONMENT_SETUP_STEP_STATUSES)).default({}),
12851
- proposal: environmentSetupProposalSchema.nullable().default(null),
12852
- applied: z22.object({
12853
- applied_at: z22.string(),
12854
- automation_ids: z22.array(z22.string())
12855
- }).nullable().default(null)
12856
- });
12857
- var applyEnvironmentSetupRequestSchema = z22.object({
12858
- environment: environmentSchema(ENVIRONMENT_SETUP_LIMITS).extend({ name: requiredText(ENVIRONMENT_SETUP_LIMITS.nameChars) }),
12859
- variables: list(z22.object({ key: z22.string().regex(VARIABLE_KEY_RE), value: z22.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)),
12860
- automations: automationListSchema(ENVIRONMENT_SETUP_LIMITS)
12861
- });
12862
-
12863
12905
  // ../shared/src/default-skills/replicas-agent/abilities/environment-setup.ts
12864
12906
  var SECTION3 = `### Environment setup (agent-led)
12865
12907
  Explore a codebase, get it running in this workspace, verify it end to end, and propose the Replicas environment configuration (start hook, warm hook, system prompt, variables) plus a few automations for the user to review and save.
@@ -13331,7 +13373,7 @@ var GITLAB_ABILITY = {
13331
13373
  };
13332
13374
 
13333
13375
  // ../shared/src/routes/compute.ts
13334
- import { z as z23 } from "zod";
13376
+ import { z as z24 } from "zod";
13335
13377
  var COMPUTE_SANDBOX_KINDS = ["gpu"];
13336
13378
  var GPU_TYPES = ["T4", "L4", "A10G", "L40S", "A100", "A100-80GB", "H100", "H200", "B200"];
13337
13379
  var DEFAULT_GPU_TYPE = "L4";
@@ -13348,27 +13390,27 @@ var COMPUTE_SANDBOX_LIMITS = {
13348
13390
  maxIdleTimeoutMinutes: 60,
13349
13391
  maxTransferBytes: 1024 ** 3
13350
13392
  };
13351
- var computeEnvSchema = z23.record(z23.string().regex(/^[A-Za-z_][A-Za-z0-9_]*$/).max(128), z23.string().max(32768)).refine((env) => Object.keys(env).length <= 64, "At most 64 environment variables are allowed");
13352
- var createComputeSandboxRequestSchema = z23.object({
13353
- kind: z23.enum(COMPUTE_SANDBOX_KINDS),
13354
- gpu: z23.string().trim().optional(),
13355
- image: z23.string().trim().min(1).max(256).regex(/^\S+$/, "Image must not contain whitespace").optional(),
13356
- timeoutMinutes: z23.number().int().min(1).max(COMPUTE_SANDBOX_LIMITS.maxTimeoutMinutes).optional(),
13357
- idleTimeoutMinutes: z23.number().int().min(1).max(COMPUTE_SANDBOX_LIMITS.maxIdleTimeoutMinutes).optional(),
13358
- ports: z23.array(z23.number().int().min(1).max(65535)).max(COMPUTE_SANDBOX_LIMITS.maxPorts).optional(),
13393
+ var computeEnvSchema = z24.record(z24.string().regex(/^[A-Za-z_][A-Za-z0-9_]*$/).max(128), z24.string().max(32768)).refine((env) => Object.keys(env).length <= 64, "At most 64 environment variables are allowed");
13394
+ var createComputeSandboxRequestSchema = z24.object({
13395
+ kind: z24.enum(COMPUTE_SANDBOX_KINDS),
13396
+ gpu: z24.string().trim().optional(),
13397
+ image: z24.string().trim().min(1).max(256).regex(/^\S+$/, "Image must not contain whitespace").optional(),
13398
+ timeoutMinutes: z24.number().int().min(1).max(COMPUTE_SANDBOX_LIMITS.maxTimeoutMinutes).optional(),
13399
+ idleTimeoutMinutes: z24.number().int().min(1).max(COMPUTE_SANDBOX_LIMITS.maxIdleTimeoutMinutes).optional(),
13400
+ ports: z24.array(z24.number().int().min(1).max(65535)).max(COMPUTE_SANDBOX_LIMITS.maxPorts).optional(),
13359
13401
  env: computeEnvSchema.optional()
13360
13402
  });
13361
- var computeExecRequestSchema = z23.object({
13362
- command: z23.string().min(1).max(1e5),
13363
- workdir: z23.string().min(1).max(4096).optional(),
13403
+ var computeExecRequestSchema = z24.object({
13404
+ command: z24.string().min(1).max(1e5),
13405
+ workdir: z24.string().min(1).max(4096).optional(),
13364
13406
  env: computeEnvSchema.optional(),
13365
- detach: z23.boolean().optional()
13407
+ detach: z24.boolean().optional()
13366
13408
  });
13367
- var computeUploadRequestSchema = z23.object({
13368
- size: z23.number().int().min(1).max(COMPUTE_SANDBOX_LIMITS.maxTransferBytes)
13409
+ var computeUploadRequestSchema = z24.object({
13410
+ size: z24.number().int().min(1).max(COMPUTE_SANDBOX_LIMITS.maxTransferBytes)
13369
13411
  });
13370
- var computeTransferPathSchema = z23.object({
13371
- path: z23.string().min(1).max(4096).optional()
13412
+ var computeTransferPathSchema = z24.object({
13413
+ path: z24.string().min(1).max(4096).optional()
13372
13414
  });
13373
13415
 
13374
13416
  // ../shared/src/default-skills/replicas-agent/abilities/gpu.ts
@@ -15120,9 +15162,9 @@ var DEFAULT_DEFAULT_SKILLS = {
15120
15162
  }
15121
15163
  };
15122
15164
  var LINEAR_ROUTING_SKILL_MAX_LENGTH = 5e4;
15123
- var linearRoutingSkillSchema = z24.union([
15124
- z24.object({ name: z24.string().min(1), content: z24.string().trim().min(1).max(LINEAR_ROUTING_SKILL_MAX_LENGTH) }),
15125
- z24.object({ name: z24.string().min(1), repository_id: z24.string().regex(UUID_RE), path: z24.string().min(1) })
15165
+ var linearRoutingSkillSchema = z25.union([
15166
+ z25.object({ name: z25.string().min(1), content: z25.string().trim().min(1).max(LINEAR_ROUTING_SKILL_MAX_LENGTH) }),
15167
+ z25.object({ name: z25.string().min(1), repository_id: z25.string().regex(UUID_RE), path: z25.string().min(1) })
15126
15168
  ]);
15127
15169
 
15128
15170
  // ../shared/src/prompts.ts
@@ -15243,6 +15285,8 @@ function splitMothershipInstructions(customInstructions) {
15243
15285
  mothershipInstructions: match?.[1]
15244
15286
  };
15245
15287
  }
15288
+ var MOTHERSHIP_TICKET_MESSAGE_NOTE = `The user sent this from your ticket on the Mothership's board and reads your answer there, not in this chat. Answer them with \`${REPLICAS_MCP_TOOLS.replyOnTicket}\`: briefly, with a link or screenshot if it helps, and a follow-up question only if you need one. Keep longer work and detail in this chat.`;
15289
+ var MOTHERSHIP_TICKET_REPLY_NUDGE = `The user is still waiting for your answer on your ticket, and they only read the ticket. Answer them now with \`${REPLICAS_MCP_TOOLS.replyOnTicket}\`, briefly.`;
15246
15290
  var T = REPLICAS_MCP_TOOLS;
15247
15291
  var SCOUT_LINEAR_RULES = `Linear issue triage: team instructions define what is actionable. Use \`replicas.linear.graphql\` from \`@replicas/sdk\` for every Linear read and mutation, never a Replicas CLI command. Choose exactly one:
15248
15292
  1. **Ignore** issues the team instructions leave to humans or that should not start work: do nothing and write nothing to Linear. If \`agent_session_id\` is set because you asked a question earlier, create a \`response\` Agent Activity on it with one short closing response.
@@ -15296,23 +15340,24 @@ function parseMessageOrigin(raw) {
15296
15340
  }
15297
15341
 
15298
15342
  // ../shared/src/mothership-events.ts
15299
- var MOTHERSHIP_EVENT_KINDS = ["finished", "ready", "needs_attention", "approved", "merged", "closed", "archived"];
15343
+ var MOTHERSHIP_EVENT_KINDS = ["finished", "ready", "needs_attention", "approved", "merged", "closed", "archived", "replied"];
15300
15344
  var UNKNOWN_EVENT_KIND = "update";
15301
15345
  var MOTHERSHIP_TURN_ERROR_SUMMARY = "Turn ended with an error.";
15302
15346
  var MOTHERSHIP_EVENT_TYPE = "multitask-event";
15303
15347
  var MOTHERSHIP_EVENT_MESSAGE_TYPE = "multitask_event";
15304
- var mothershipEventSchema = z25.object({
15305
- id: z25.string(),
15306
- at: z25.string(),
15307
- kind: z25.enum([...MOTHERSHIP_EVENT_KINDS, UNKNOWN_EVENT_KIND]),
15308
- agentId: z25.string(),
15309
- agentName: z25.string(),
15310
- summary: z25.string(),
15311
- detail: z25.string().optional(),
15348
+ var mothershipEventSchema = z26.object({
15349
+ id: z26.string(),
15350
+ at: z26.string(),
15351
+ kind: z26.enum([...MOTHERSHIP_EVENT_KINDS, UNKNOWN_EVENT_KIND]),
15352
+ agentId: z26.string(),
15353
+ agentName: z26.string(),
15354
+ summary: z26.string(),
15355
+ detail: z26.string().optional(),
15312
15356
  // Set when the subagent is a chat in this workspace rather than a ship; agentId is then that chat's id.
15313
- chatId: z25.string().optional(),
15357
+ chatId: z26.string().optional(),
15358
+ ticket: z26.object({ id: z26.string(), title: z26.string() }).optional(),
15314
15359
  // Set on events recorded before every kind woke the orchestrator, which were shown as a row when they happened.
15315
- noticed: z25.boolean().optional()
15360
+ noticed: z26.boolean().optional()
15316
15361
  });
15317
15362
  var TAG = "multitask_event";
15318
15363
  var BLOCK = new RegExp(`<${TAG}((?:\\s+\\w+="[^"]*")*)>\\n?([\\s\\S]*?)\\n?</${TAG}>`, "g");
@@ -15327,7 +15372,7 @@ function truncateMothershipEventResponse(response, readTool) {
15327
15372
  }
15328
15373
  function formatMothershipEvents(events) {
15329
15374
  return events.map((event) => {
15330
- const attributes = { id: event.id, at: event.at, kind: event.kind, agent: event.agentName, agent_id: event.agentId, ...event.chatId ? { chat_id: event.chatId } : {}, ...event.noticed ? { noticed: "true" } : {} };
15375
+ const attributes = { id: event.id, at: event.at, kind: event.kind, agent: event.agentName, agent_id: event.agentId, ...event.chatId ? { chat_id: event.chatId } : {}, ...event.ticket ? { ticket_id: event.ticket.id, ticket: event.ticket.title } : {}, ...event.noticed ? { noticed: "true" } : {} };
15331
15376
  const body = [event.summary, event.detail].filter(Boolean).join("\n\n").replaceAll(`</${TAG}`, `<\\/${TAG}`);
15332
15377
  return `<${TAG}${Object.entries(attributes).map(([key, value]) => ` ${key}="${escapeAttribute(value)}"`).join("")}>
15333
15378
  ${body}
@@ -15350,6 +15395,7 @@ function extractMothershipEvents(text4) {
15350
15395
  summary: summary.trim(),
15351
15396
  ...detail ? { detail } : {},
15352
15397
  ...attributes.chat_id ? { chatId: attributes.chat_id } : {},
15398
+ ...attributes.ticket_id ? { ticket: { id: attributes.ticket_id, title: attributes.ticket ?? "" } } : {},
15353
15399
  ...attributes.noticed === "true" ? { noticed: true } : {}
15354
15400
  }];
15355
15401
  });
@@ -16356,7 +16402,7 @@ function subagentReport(output) {
16356
16402
  }
16357
16403
 
16358
16404
  // ../shared/src/learned-skills.ts
16359
- import { z as z26 } from "zod";
16405
+ import { z as z27 } from "zod";
16360
16406
 
16361
16407
  // ../shared/src/frontmatter.ts
16362
16408
  import { parse as parseYaml } from "yaml";
@@ -16379,20 +16425,20 @@ function parseFrontmatter(content) {
16379
16425
  var LEARNED_SKILLS_ROOT = `${SANDBOX_PATHS.REPLICAS_DIR}/learned-skills`;
16380
16426
  var LEARNED_SKILLS_MANIFEST_PATH = `${LEARNED_SKILLS_ROOT}/manifest.json`;
16381
16427
  var LEARNED_SKILL_DIR_PREFIX = "replicas-learned__";
16382
- var learnedSkillsManifestSchema = z26.object({
16383
- skills: z26.array(z26.object({ name: z26.string(), sha256: z26.string() }))
16428
+ var learnedSkillsManifestSchema = z27.object({
16429
+ skills: z27.array(z27.object({ name: z27.string(), sha256: z27.string() }))
16384
16430
  });
16385
- var dreamVerdictChecksSchema = z26.object({
16386
- repeatable: z26.boolean(),
16387
- realInstruction: z26.boolean(),
16388
- noContradiction: z26.boolean(),
16389
- formatExact: z26.boolean(),
16390
- humanOnly: z26.boolean(),
16391
- actionable: z26.boolean(),
16392
- durable: z26.boolean()
16431
+ var dreamVerdictChecksSchema = z27.object({
16432
+ repeatable: z27.boolean(),
16433
+ realInstruction: z27.boolean(),
16434
+ noContradiction: z27.boolean(),
16435
+ formatExact: z27.boolean(),
16436
+ humanOnly: z27.boolean(),
16437
+ actionable: z27.boolean(),
16438
+ durable: z27.boolean()
16393
16439
  });
16394
16440
  var DREAM_VERDICT_CHECKS = dreamVerdictChecksSchema.keyof().options;
16395
- var dreamVerdictSchema = dreamVerdictChecksSchema.extend({ approve: z26.boolean(), reason: z26.string() });
16441
+ var dreamVerdictSchema = dreamVerdictChecksSchema.extend({ approve: z27.boolean(), reason: z27.string() });
16396
16442
  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."`;
16397
16443
 
16398
16444
  // ../shared/src/terminal.ts
@@ -16423,7 +16469,7 @@ function workspaceTargetFromToolOutput(output) {
16423
16469
  }
16424
16470
 
16425
16471
  // ../shared/src/mothership-board.ts
16426
- import { z as z27 } from "zod";
16472
+ import { z as z28 } from "zod";
16427
16473
  var MOTHERSHIP_TICKET_LIMITS = {
16428
16474
  title: 80,
16429
16475
  task: 1e3,
@@ -16438,67 +16484,83 @@ var MOTHERSHIP_TICKET_LIMITS = {
16438
16484
  blocked: 200,
16439
16485
  media: 6,
16440
16486
  caption: 80,
16441
- answer: 2e3
16487
+ answer: 2e3,
16488
+ reply: 600
16442
16489
  };
16443
16490
  var L = MOTHERSHIP_TICKET_LIMITS;
16444
16491
  var tooLong = (max) => `At most ${max} characters. Keep it short; the user should take it in at a glance`;
16445
- var text3 = (max) => z27.string().trim().min(1).max(max, tooLong(max));
16446
- var clearable = (schema) => z27.union([schema, z27.literal("")]).optional();
16447
- var httpsUrl = z27.url({ protocol: /^https$/, error: "Must be an https URL" });
16492
+ var text3 = (max) => z28.string().trim().min(1).max(max, tooLong(max));
16493
+ var clearable = (schema) => z28.union([schema, z28.literal("")]).optional();
16494
+ var httpsUrl = z28.url({ protocol: /^https$/, error: "Must be an https URL" });
16448
16495
  var inlineMarkdown = "Markdown: **bold**, *italics*, `code`, [links](https://... or an absolute file path)";
16449
16496
  var markdown = `${inlineMarkdown} and line breaks.`;
16450
- var linearIdentifier = z27.string().regex(/^[A-Za-z][A-Za-z0-9]{0,9}-\d{1,7}$/, "Use a Linear identifier such as REP-123");
16451
- var mediaSchema = z27.object({
16497
+ var linearIdentifier = z28.string().regex(/^[A-Za-z][A-Za-z0-9]{0,9}-\d{1,7}$/, "Use a Linear identifier such as REP-123");
16498
+ var mediaSchema = z28.object({
16452
16499
  url: httpsUrl.describe("The URL `replicas media upload` printed."),
16453
16500
  caption: text3(L.caption).describe('What it shows, such as "After: the list stays pinned".'),
16454
- kind: z27.enum(["image", "video"]).describe("video for recordings, image for screenshots and GIFs.")
16501
+ kind: z28.enum(["image", "video"]).describe("video for recordings, image for screenshots and GIFs.")
16455
16502
  });
16456
- var questionSchema = z27.object({
16503
+ var questionSchema = z28.object({
16457
16504
  question: text3(L.question).describe("One question, with the context needed to answer it."),
16458
- options: z27.array(text3(L.option)).max(L.options).optional().describe("Up to three answers to pick from, recommended first. The user can always write their own.")
16505
+ options: z28.array(text3(L.option)).max(L.options).optional().describe("Up to three answers to pick from, recommended first. The user can always write their own.")
16459
16506
  });
16460
16507
  var mothershipTicketTitleSchema = text3(L.title).describe(`What the task is about, in a few plain words, such as "Slack replies in Mothership channels get dropped" or "Add CSV export to Analytics". Never a ship, branch or pull request name. At most ${L.title} characters.`);
16461
16508
  var mothershipTicketTaskSchema = text3(L.task);
16462
- var mothershipTicketMediaSchema = z27.array(mediaSchema);
16463
- var mothershipTicketQuestionsSchema = z27.array(questionSchema.extend({ id: z27.string() }));
16509
+ var mothershipTicketMediaSchema = z28.array(mediaSchema);
16510
+ var mothershipTicketQuestionsSchema = z28.array(questionSchema.extend({ id: z28.string() }));
16464
16511
  var issueSchema = clearable(text3(L.issue)).describe(`What was wrong or what was asked, in a few plain sentences a busy reader understands: the problem, not the fix. Carry the evidence: Slack and Linear threads as links, customer quotes in quotation marks, and screenshots in \`media\`. ${markdown} At most ${L.issue} characters.`);
16465
16512
  var fixSchema = clearable(text3(L.fix)).describe(`What was done or is being done about it, with pull requests as #number. Keep it current as the work goes on, and say how it ended once the pull requests land. ${markdown} At most ${L.fix} characters.`);
16466
- var updateMothershipTicketRequestSchema = z27.object({
16513
+ var updateMothershipTicketRequestSchema = z28.object({
16467
16514
  title: mothershipTicketTitleSchema.optional(),
16468
16515
  issue: issueSchema,
16469
16516
  fix: fixSchema,
16470
- media: z27.array(mediaSchema).max(L.media).optional().describe(`Screenshots and recordings that show the result, uploaded with \`replicas media upload\`, at most ${L.media}. Replaces the ticket's media.`),
16471
- questions: z27.array(questionSchema).max(L.questions).optional().describe(`Questions only the user can answer, at most ${L.questions}. Replaces the open ones; pass [] once they are answered. Their answer comes back to you in this chat.`),
16517
+ media: z28.array(mediaSchema).max(L.media).optional().describe(`Screenshots and recordings that show the result, uploaded with \`replicas media upload\`, at most ${L.media}. Replaces the ticket's media.`),
16518
+ questions: z28.array(questionSchema).max(L.questions).optional().describe(`Questions only the user can answer, at most ${L.questions}. Replaces the open ones; pass [] once they are answered. Their answer comes back to you in this chat.`),
16472
16519
  blocked: clearable(text3(L.blocked)).describe('Why you cannot go on without the user, such as missing access. "" once unblocked.')
16473
16520
  });
16474
- var updateMothershipBoardRequestSchema = z27.object({
16521
+ var updateMothershipBoardRequestSchema = z28.object({
16475
16522
  overview: clearable(text3(L.overview)).describe(`One line at the top of the board on where the work as a whole stands. "" removes it. At most ${L.overview} characters.`),
16476
- tickets: z27.array(z27.object({
16477
- id: z27.uuid(),
16523
+ tickets: z28.array(z28.object({
16524
+ id: z28.uuid(),
16478
16525
  title: mothershipTicketTitleSchema.optional(),
16479
16526
  issue: issueSchema,
16480
16527
  fix: fixSchema,
16481
- pull_requests: z27.array(httpsUrl).max(20).optional().describe("Pull request URLs that came out of this ticket's task. They move here from any other ticket. Each pull request is filed under the ticket its ship was working on when it opened it, so pass this only to correct that."),
16528
+ pull_requests: z28.array(httpsUrl).max(20).optional().describe("Pull request URLs that came out of this ticket's task. They move here from any other ticket. Each pull request is filed under the ticket its ship was working on when it opened it, so pass this only to correct that."),
16482
16529
  note: clearable(text3(L.note)).describe(`Your one short comment on the ticket, shown under its row, replacing the last. ${inlineMarkdown}. "" removes it. At most ${L.note} characters.`),
16483
16530
  linear: clearable(linearIdentifier).describe('The Linear issue this ticket is for, such as REP-123. "" removes it.'),
16484
- archived: z27.boolean().optional().describe("true takes it off the board for good: closes its open pull requests without merging, stops their automatic fixes, and archives its ships unless they still have other tickets. false puts it back on the board.")
16531
+ archived: z28.boolean().optional().describe("true takes it off the board for good: closes its open pull requests without merging, stops their automatic fixes, and archives its ships unless they still have other tickets. false puts it back on the board.")
16485
16532
  })).max(50).optional().describe("Changes to existing tickets."),
16486
- order: z27.array(z27.uuid()).optional().describe("Ticket ids, most important first. Tickets left out keep their order after these."),
16487
- create: z27.array(z27.object({
16533
+ order: z28.array(z28.uuid()).optional().describe("Ticket ids, most important first. Tickets left out keep their order after these."),
16534
+ create: z28.array(z28.object({
16488
16535
  title: mothershipTicketTitleSchema,
16489
16536
  task: mothershipTicketTaskSchema.optional(),
16490
16537
  issue: text3(L.issue).optional(),
16491
- questions: z27.array(questionSchema).max(L.questions).optional(),
16538
+ questions: z28.array(questionSchema).max(L.questions).optional(),
16492
16539
  note: text3(L.note).optional()
16493
16540
  })).max(5).optional().describe("Tickets with no ship, for your own questions to the user or work no ship does. Their answers come to you.")
16494
16541
  });
16495
- var answerMothershipTicketRequestSchema = z27.object({
16496
- questionId: z27.string().min(1),
16542
+ var answerMothershipTicketRequestSchema = z28.object({
16543
+ questionId: z28.string().min(1),
16497
16544
  answer: text3(L.answer)
16498
16545
  });
16499
- var mothershipTicketAnswerRefSchema = z27.object({ mothershipId: z27.uuid(), ticketId: z27.uuid(), questionId: z27.string().min(1) });
16546
+ var mothershipTicketAnswerRefSchema = z28.object({ mothershipId: z28.uuid(), ticketId: z28.uuid(), questionId: z28.string().min(1) });
16547
+ var replyOnMothershipTicketRequestSchema = z28.object({
16548
+ reply: text3(L.reply).describe(`Your answer to the user's latest message on the ticket, in a few sentences. ${markdown} Link a screenshot or recording uploaded with \`replicas media upload\` if it helps. At most ${L.reply} characters; keep longer detail in your chat.`),
16549
+ question: questionSchema.optional().describe("A follow-up question only if you need the user to decide something. It shows on the ticket with its options, and their answer comes back to you.")
16550
+ });
16551
+ var mothershipTicketReplyRefSchema = z28.object({ ticketId: z28.uuid(), text: text3(L.answer) });
16552
+ var mothershipTicketThreadSchema = z28.array(z28.object({
16553
+ id: z28.string(),
16554
+ from: z28.enum(["user", "ship"]),
16555
+ name: z28.string(),
16556
+ ship_id: z28.string(),
16557
+ chat_id: z28.string(),
16558
+ text: z28.string(),
16559
+ at: z28.string(),
16560
+ nudge: z28.enum(["sent", "missed"]).optional()
16561
+ }));
16500
16562
  var LINEAR_ISSUE_SUMMARIES_MAX = 50;
16501
- var linearIssueSummariesRequestSchema = z27.object({ identifiers: z27.array(linearIdentifier).min(1).max(LINEAR_ISSUE_SUMMARIES_MAX) });
16563
+ var linearIssueSummariesRequestSchema = z28.object({ identifiers: z28.array(linearIdentifier).min(1).max(LINEAR_ISSUE_SUMMARIES_MAX) });
16502
16564
 
16503
16565
  // ../shared/src/user-message-matching.ts
16504
16566
  var parsedTimestamps = /* @__PURE__ */ new Map();
@@ -16718,6 +16780,7 @@ var REPLICAS_API_STEPS = {
16718
16780
  [REPLICAS_MCP_TOOLS.getBoard]: { icon: "book", live: "Reading board", done: "Read board" },
16719
16781
  [REPLICAS_MCP_TOOLS.updateBoard]: { icon: "file-pen", live: "Updating board", done: "Updated board" },
16720
16782
  [REPLICAS_MCP_TOOLS.updateTicket]: { icon: "file-pen", live: "Updating ticket", done: "Updated ticket" },
16783
+ [REPLICAS_MCP_TOOLS.replyOnTicket]: { icon: "file-pen", live: "Replying on ticket", done: "Replied on ticket" },
16721
16784
  [REPLICAS_MCP_TOOLS.sendToChat]: { icon: "message", live: "Sending to chat", done: "Sent to chat" },
16722
16785
  [REPLICAS_MCP_TOOLS.mergeWhenReady]: { icon: "target", live: "Setting merge when ready", done: "Set merge when ready" }
16723
16786
  };
@@ -16867,10 +16930,10 @@ function currentStepLabel(messages, earlierPlainStep) {
16867
16930
  }
16868
16931
 
16869
16932
  // ../shared/src/user-message-attachments.ts
16870
- import { z as z28 } from "zod";
16933
+ import { z as z29 } from "zod";
16871
16934
  var ATTACHMENT_PLACEHOLDER_REGEX = /^\[\d+ (?:(?:images?|files?)(?: and \d+ files?)? attached|(?:image )?attachments?)\]$/;
16872
16935
  var withoutAttachmentPlaceholder = (content, attached) => attached && ATTACHMENT_PLACEHOLDER_REGEX.test(content) ? "" : content;
16873
- var annotationLinesSchema = z28.object({ path: z28.string(), start: z28.number(), end: z28.number() });
16936
+ var annotationLinesSchema = z29.object({ path: z29.string(), start: z29.number(), end: z29.number() });
16874
16937
  var ANNOTATIONS_NOTE_OPENING = '<replicas_annotations>\nThe user quoted these passages, some with a comment. Address each annotation, and when you do, refer to it as "Annotation N".';
16875
16938
  var ANNOTATIONS_NOTE_REGEX = /(?:^|\n\n)<replicas_annotations>\n([\s\S]*?)\n<\/replicas_annotations>$/;
16876
16939
  var ANNOTATION_HEADER_REGEX = /^Annotation \d+$/m;
@@ -20167,7 +20230,7 @@ var VOICE_WAVEFORM = {
20167
20230
  };
20168
20231
 
20169
20232
  // ../shared/src/e2b.ts
20170
- var E2B_TEMPLATE_NAME = "replicas-sandbox-2026-11-15-v6";
20233
+ var E2B_TEMPLATE_NAME = "replicas-sandbox-2026-11-15-v8";
20171
20234
 
20172
20235
  // ../shared/src/e2b-retry.ts
20173
20236
  var DEFAULT_BACKOFFS_MS = [2e3, 5e3];
@@ -20522,6 +20585,55 @@ function resolveWarmHookConfig(value) {
20522
20585
  return resolveHookConfig(parseWarmHookConfig(value));
20523
20586
  }
20524
20587
 
20588
+ // ../shared/src/environment-config.ts
20589
+ import { z as z30 } from "zod";
20590
+ var variableNameSchema = z30.string().regex(VARIABLE_KEY_RE, "must be a valid environment variable name");
20591
+ var mcpValueSchema = z30.union([
20592
+ z30.string(),
20593
+ environmentMcpVariableReferenceSchema
20594
+ ]);
20595
+ var mcpValuesSchema = z30.record(z30.string(), mcpValueSchema);
20596
+ var httpConfigSchema = environmentMcpHttpConfigSchema.pick({ url: true, auth: true }).extend({
20597
+ headers: mcpValuesSchema.default({})
20598
+ }).strict();
20599
+ var replicasMcpDefinitionSchema = z30.discriminatedUnion("transport", [
20600
+ z30.strictObject({
20601
+ transport: z30.literal("stdio"),
20602
+ config: environmentMcpStdioConfigSchema.pick({ command: true }).extend({
20603
+ args: environmentMcpStdioConfigSchema.shape.args.unwrap().default([]),
20604
+ env: z30.record(variableNameSchema, mcpValueSchema).default({})
20605
+ }).strict()
20606
+ }),
20607
+ z30.strictObject({ transport: z30.literal("http"), config: httpConfigSchema }),
20608
+ z30.strictObject({ transport: z30.literal("sse"), config: httpConfigSchema })
20609
+ ]).superRefine((definition, context) => {
20610
+ if (definition.transport === "stdio") return;
20611
+ const result = validateEnvironmentMcpAuthentication(definition.transport, definition.config);
20612
+ if (!result.ok) context.addIssue({ code: "custom", path: result.error.code === "transport" ? ["transport"] : ["config", result.error.code ?? "auth"], message: result.error.message });
20613
+ });
20614
+ var replicasEnvironmentConfigSchema = z30.strictObject({
20615
+ systemPrompt: z30.string().optional(),
20616
+ warmHook: z30.string().optional(),
20617
+ startHook: z30.string().optional(),
20618
+ variables: z30.record(variableNameSchema, z30.string()).optional(),
20619
+ requiredSecrets: z30.array(variableNameSchema).optional(),
20620
+ mcps: z30.record(z30.string().regex(MCP_NAME_PATTERN, "must be 1\u201364 letters, digits, underscores or hyphens, starting with a letter or digit").refine((name) => !isReservedMcpName(name), "is reserved for Replicas"), replicasMcpDefinitionSchema).optional()
20621
+ }).superRefine((config, context) => {
20622
+ const names = /* @__PURE__ */ new Set();
20623
+ for (const name of Object.keys(config.mcps ?? {})) {
20624
+ const normalized = name.toLowerCase();
20625
+ if (names.has(normalized)) {
20626
+ context.addIssue({ code: "custom", path: ["mcps", name], message: "MCP names must be unique regardless of case" });
20627
+ }
20628
+ names.add(normalized);
20629
+ }
20630
+ for (const key of config.requiredSecrets ?? []) {
20631
+ if (config.variables && Object.hasOwn(config.variables, key)) {
20632
+ context.addIssue({ code: "custom", path: ["requiredSecrets"], message: `"${key}" cannot also be declared as a non-secret variable` });
20633
+ }
20634
+ }
20635
+ });
20636
+
20525
20637
  // ../shared/src/replicas-config.ts
20526
20638
  var REPLICAS_CONFIG_FILENAMES = ["replicas.json", "replicas.yaml", "replicas.yml"];
20527
20639
  function isRecord4(value) {
@@ -20563,6 +20675,14 @@ function parseReplicasConfig(value, filename = "replicas.json") {
20563
20675
  if ("warmHook" in value) {
20564
20676
  config.warmHook = parseWarmHookConfig(value.warmHook, filename);
20565
20677
  }
20678
+ if ("environment" in value) {
20679
+ const parsed = replicasEnvironmentConfigSchema.safeParse(value.environment);
20680
+ if (!parsed.success) {
20681
+ const issue = parsed.error.issues[0];
20682
+ throw new Error(`Invalid ${filename}: "environment${issue.path.length ? `.${issue.path.join(".")}` : ""}" ${issue.message}`);
20683
+ }
20684
+ config.environment = parsed.data;
20685
+ }
20566
20686
  return config;
20567
20687
  }
20568
20688
  function parseReplicasConfigString(content, filename) {
@@ -20650,10 +20770,10 @@ function hasChatStarted(chat) {
20650
20770
  }
20651
20771
 
20652
20772
  // ../shared/src/routes/billing.ts
20653
- import { z as z29 } from "zod";
20773
+ import { z as z31 } from "zod";
20654
20774
  var SOURCE_LIMIT_SOURCES = ["limrun", "modal"];
20655
- var usageLimitCentsSchema = z29.number().int().min(100).max(1e8);
20656
- var sourceLimitsCentsSchema = z29.partialRecord(z29.enum(SOURCE_LIMIT_SOURCES), usageLimitCentsSchema);
20775
+ var usageLimitCentsSchema = z31.number().int().min(100).max(1e8);
20776
+ var sourceLimitsCentsSchema = z31.partialRecord(z31.enum(SOURCE_LIMIT_SOURCES), usageLimitCentsSchema);
20657
20777
 
20658
20778
  // ../shared/src/routes/codex.ts
20659
20779
  var CODEX_AUTH_ENV_KEYS = [
@@ -20807,7 +20927,7 @@ var CLAUDE_AUTH_ENV_KEYS_BY_METHOD = {
20807
20927
  };
20808
20928
 
20809
20929
  // ../shared/src/routes/command-protection.ts
20810
- import { z as z30 } from "zod";
20930
+ import { z as z32 } from "zod";
20811
20931
 
20812
20932
  // ../shared/src/git-invocations.ts
20813
20933
  var COMMIT_VALUE_OPTIONS = /* @__PURE__ */ new Set(["message", "file", "trailer", "reuse-message", "reedit-message", "fixup", "squash", "template", "author", "date", "cleanup", "pathspec-from-file"]);
@@ -20898,27 +21018,27 @@ function findCheckoutTarget(args) {
20898
21018
  }
20899
21019
 
20900
21020
  // ../shared/src/routes/command-protection.ts
20901
- var commandProtectionRepoStateSchema = z30.object({
20902
- branch: z30.string().nullable(),
20903
- defaultBranch: z30.string().nullable(),
20904
- pushBranch: z30.string().nullable(),
20905
- pushConfig: z30.string().nullable(),
20906
- headMessage: z30.string().nullable(),
20907
- mergeInProgress: z30.boolean().optional()
21021
+ var commandProtectionRepoStateSchema = z32.object({
21022
+ branch: z32.string().nullable(),
21023
+ defaultBranch: z32.string().nullable(),
21024
+ pushBranch: z32.string().nullable(),
21025
+ pushConfig: z32.string().nullable(),
21026
+ headMessage: z32.string().nullable(),
21027
+ mergeInProgress: z32.boolean().optional()
20908
21028
  });
20909
- var commandProtectionEvaluateRequestSchema = z30.object({
20910
- provider: z30.enum(["claude", "codex", "cursor", "opencode", "pi"]),
20911
- source: z30.enum(["claude_pre_tool_use", "codex_approval_request", "cursor_pre_tool_use", "opencode_pre_tool_use", "pi_tool_call"]),
20912
- toolName: z30.string(),
20913
- toolInput: z30.unknown(),
20914
- command: z30.string().nullish(),
20915
- cwd: z30.string().nullish(),
20916
- toolUseId: z30.string().nullish(),
21029
+ var commandProtectionEvaluateRequestSchema = z32.object({
21030
+ provider: z32.enum(["claude", "codex", "cursor", "opencode", "pi"]),
21031
+ source: z32.enum(["claude_pre_tool_use", "codex_approval_request", "cursor_pre_tool_use", "opencode_pre_tool_use", "pi_tool_call"]),
21032
+ toolName: z32.string(),
21033
+ toolInput: z32.unknown(),
21034
+ command: z32.string().nullish(),
21035
+ cwd: z32.string().nullish(),
21036
+ toolUseId: z32.string().nullish(),
20917
21037
  // Read by the engine before the command runs, keyed by absolute path, so the
20918
21038
  // policy can see branches and commit messages the command text only references.
20919
- gitContext: z30.object({
20920
- repos: z30.record(z30.string(), commandProtectionRepoStateSchema),
20921
- messageFiles: z30.record(z30.string(), z30.string())
21039
+ gitContext: z32.object({
21040
+ repos: z32.record(z32.string(), commandProtectionRepoStateSchema),
21041
+ messageFiles: z32.record(z32.string(), z32.string())
20922
21042
  }).optional()
20923
21043
  });
20924
21044
  var COMMAND_PROTECTION_COMMAND_KEYS = ["command", "cmd", "script", "query", "endpoint", "path", "url", "mutation"];
@@ -21139,122 +21259,122 @@ function shouldRefreshPullRequests(toolName, toolInput) {
21139
21259
  }
21140
21260
 
21141
21261
  // ../shared/src/routes/scout.ts
21142
- import { z as z31 } from "zod";
21262
+ import { z as z33 } from "zod";
21143
21263
  var SCOUT_LINEAR_ACTIONS = ["ask", "start"];
21144
- var scoutLinearSessionIntentRequestSchema = z31.object({
21145
- comment_id: z31.string().trim().min(1).describe("Id of the Linear comment the session will be created on."),
21146
- action: z31.enum(SCOUT_LINEAR_ACTIONS).describe("`ask` when the comment is a clarifying question, `start` when it hands off the task.")
21264
+ var scoutLinearSessionIntentRequestSchema = z33.object({
21265
+ comment_id: z33.string().trim().min(1).describe("Id of the Linear comment the session will be created on."),
21266
+ action: z33.enum(SCOUT_LINEAR_ACTIONS).describe("`ask` when the comment is a clarifying question, `start` when it hands off the task.")
21147
21267
  });
21148
- var scoutLinearStartRequestSchema = z31.object({
21149
- issue_id: z31.string().describe("Linear issue id from the envelope's `issue_id`."),
21150
- agent_session_id: z31.string().describe("Existing Linear agent session id from the envelope's `agent_session_id`."),
21151
- prompt: z31.string().trim().min(1).describe("The latest request, in its author's words. The workspace already receives the issue and its comments.")
21268
+ var scoutLinearStartRequestSchema = z33.object({
21269
+ issue_id: z33.string().describe("Linear issue id from the envelope's `issue_id`."),
21270
+ agent_session_id: z33.string().describe("Existing Linear agent session id from the envelope's `agent_session_id`."),
21271
+ prompt: z33.string().trim().min(1).describe("The latest request, in its author's words. The workspace already receives the issue and its comments.")
21152
21272
  });
21153
- var scoutRouteLinearTicketRequestSchema = z31.object({
21154
- agent_session_id: z31.string().trim().min(1).describe("The ticket's `agent_session_id` from the envelope."),
21155
- environment_id: z31.string().trim().min(1).optional().describe("Start the ticket in this environment."),
21156
- mothership_id: z31.string().trim().min(1).optional().describe("Hand the ticket to this Mothership instead.")
21273
+ var scoutRouteLinearTicketRequestSchema = z33.object({
21274
+ agent_session_id: z33.string().trim().min(1).describe("The ticket's `agent_session_id` from the envelope."),
21275
+ environment_id: z33.string().trim().min(1).optional().describe("Start the ticket in this environment."),
21276
+ mothership_id: z33.string().trim().min(1).optional().describe("Hand the ticket to this Mothership instead.")
21157
21277
  }).refine((args) => !(args.environment_id && args.mothership_id), "Pass environment_id or mothership_id, not both.");
21158
- var slackChannelIdSchema = z31.string().describe("Slack channel id from the envelope's `channel_id`.");
21159
- var slackThreadTsSchema = z31.string().describe("Slack thread timestamp from the envelope's `thread_ts`.");
21160
- var scoutSlackMessageReferenceSchema = z31.object({
21278
+ var slackChannelIdSchema = z33.string().describe("Slack channel id from the envelope's `channel_id`.");
21279
+ var slackThreadTsSchema = z33.string().describe("Slack thread timestamp from the envelope's `thread_ts`.");
21280
+ var scoutSlackMessageReferenceSchema = z33.object({
21161
21281
  channel_id: slackChannelIdSchema,
21162
21282
  thread_ts: slackThreadTsSchema,
21163
- message_ts: z31.string().describe("The envelope's `message_ts`. The server verifies this message and its author."),
21164
- user_id: z31.string().describe("Slack user id of that message's author (the envelope's `user_id`).")
21283
+ message_ts: z33.string().describe("The envelope's `message_ts`. The server verifies this message and its author."),
21284
+ user_id: z33.string().describe("Slack user id of that message's author (the envelope's `user_id`).")
21165
21285
  });
21166
- var scoutSlackSpawnRequestSchema = z31.object({
21286
+ var scoutSlackSpawnRequestSchema = z33.object({
21167
21287
  channel_id: slackChannelIdSchema,
21168
21288
  thread_ts: slackThreadTsSchema,
21169
- message_ts: z31.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."),
21170
- user_id: z31.string().describe("Slack user id of that message's author (the envelope's `user_id`). The workspace is attributed to them."),
21171
- prompt: z31.string().describe("The person's request in their own words, quoting earlier messages only when it points to them. The workspace already receives the Slack thread, so add no research, plan, or guesses."),
21172
- acknowledgement_ts: z31.string().optional().describe("`ts` of the one-line reply you posted in this thread before spawning. The server appends the workspace link to it and tells the workspace not to acknowledge again."),
21173
- environment_id: z31.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.`)
21289
+ message_ts: z33.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."),
21290
+ user_id: z33.string().describe("Slack user id of that message's author (the envelope's `user_id`). The workspace is attributed to them."),
21291
+ prompt: z33.string().describe("The person's request in their own words, quoting earlier messages only when it points to them. The workspace already receives the Slack thread, so add no research, plan, or guesses."),
21292
+ acknowledgement_ts: z33.string().optional().describe("`ts` of the one-line reply you posted in this thread before spawning. The server appends the workspace link to it and tells the workspace not to acknowledge again."),
21293
+ environment_id: z33.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.`)
21174
21294
  });
21175
21295
  var scoutSlackSpawnInNewThreadRequestSchema = scoutSlackSpawnRequestSchema.extend({
21176
- title: z31.string().trim().min(1).max(500).describe("One or two sentences stating the task, posted as the new top-level message."),
21177
- prompt: z31.string().describe("The person's request in their own words. The full source thread is attached as background, so add no summary, research, plan, or guesses."),
21178
- acknowledgement_ts: z31.string().optional().describe("`ts` of the one-line reply you posted in this thread before spawning. The server appends the new thread's link to it.")
21296
+ title: z33.string().trim().min(1).max(500).describe("One or two sentences stating the task, posted as the new top-level message."),
21297
+ prompt: z33.string().describe("The person's request in their own words. The full source thread is attached as background, so add no summary, research, plan, or guesses."),
21298
+ acknowledgement_ts: z33.string().optional().describe("`ts` of the one-line reply you posted in this thread before spawning. The server appends the new thread's link to it.")
21179
21299
  });
21180
- var scoutSlackRelayRequestSchema = z31.object({
21300
+ var scoutSlackRelayRequestSchema = z33.object({
21181
21301
  channel_id: slackChannelIdSchema,
21182
21302
  thread_ts: slackThreadTsSchema,
21183
- message: z31.string().describe("The follow-up to deliver: every fresh message that belongs to this update, in its author's words, with no research, plan, or guesses added. When forwarding to a `workspace_id` other than the thread's own workspace, also quote exactly the thread messages the request points to (\"forward this\"), since that workspace gets only this message."),
21184
- user_id: z31.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`."),
21185
- queue: z31.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."),
21186
- workspace_id: z31.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. Binding a Mothership gives it the person's own Slack message and the thread instead of \`message\`. In a thread already bound to a different workspace, or in a Mothership's channel, nothing is bound: the workspace or Mothership gets only \`message\`, once, with a link back to Slack, and the thread stays where it is. Omit to relay into the thread's own workspace.`),
21187
- message_ts: z31.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.")
21303
+ message: z33.string().describe("The follow-up to deliver: every fresh message that belongs to this update, in its author's words, with no research, plan, or guesses added. When forwarding to a `workspace_id` other than the thread's own workspace, also quote exactly the thread messages the request points to (\"forward this\"), since that workspace gets only this message."),
21304
+ user_id: z33.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`."),
21305
+ queue: z33.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."),
21306
+ workspace_id: z33.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. Binding a Mothership gives it the person's own Slack message and the thread instead of \`message\`. In a thread already bound to a different workspace, or in a Mothership's channel, nothing is bound: the workspace or Mothership gets only \`message\`, once, with a link back to Slack, and the thread stays where it is. Omit to relay into the thread's own workspace.`),
21307
+ message_ts: z33.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.")
21188
21308
  });
21189
- var scoutSlackSetThreadMutedRequestSchema = z31.object({
21309
+ var scoutSlackSetThreadMutedRequestSchema = z33.object({
21190
21310
  channel_id: slackChannelIdSchema,
21191
21311
  thread_ts: slackThreadTsSchema,
21192
- muted: z31.boolean().describe("true to mute Replicas in this thread, false to unmute it.")
21312
+ muted: z33.boolean().describe("true to mute Replicas in this thread, false to unmute it.")
21193
21313
  });
21194
21314
  var scoutSlackStopWorkspaceRequestSchema = scoutSlackMessageReferenceSchema.extend({
21195
- archive: z31.boolean().describe("true only when the person also asked to close or archive the workspace.")
21315
+ archive: z33.boolean().describe("true only when the person also asked to close or archive the workspace.")
21196
21316
  });
21197
- var scoutListWorkspacesRequestSchema = z31.object({
21317
+ var scoutListWorkspacesRequestSchema = z33.object({
21198
21318
  channel_id: slackChannelIdSchema,
21199
21319
  thread_ts: slackThreadTsSchema,
21200
- message_ts: z31.string().describe("The envelope's `message_ts`. The server verifies this message and its author."),
21201
- user_id: z31.string().describe("Slack user id of that message's author (the envelope's `user_id`). Only workspaces they can see are listed."),
21202
- query: z31.string().trim().min(1).optional().describe("Case-insensitive text to match against workspace and Mothership names and pull request URLs.")
21320
+ message_ts: z33.string().describe("The envelope's `message_ts`. The server verifies this message and its author."),
21321
+ user_id: z33.string().describe("Slack user id of that message's author (the envelope's `user_id`). Only workspaces they can see are listed."),
21322
+ query: z33.string().trim().min(1).optional().describe("Case-insensitive text to match against workspace and Mothership names and pull request URLs.")
21203
21323
  });
21204
- var scoutSlackConfirmationSchema = z31.object({
21205
- confirmation_channel_id: z31.string().describe("`channel_id` from the envelope of the Slack message that asked for or accepted this."),
21206
- confirmation_thread_ts: z31.string().describe("`thread_ts` from that message's envelope."),
21207
- confirmation_message_ts: z31.string().describe("`message_ts` from that message's envelope."),
21208
- confirmation_user_id: z31.string().describe("`user_id` from that message's envelope.")
21324
+ var scoutSlackConfirmationSchema = z33.object({
21325
+ confirmation_channel_id: z33.string().describe("`channel_id` from the envelope of the Slack message that asked for or accepted this."),
21326
+ confirmation_thread_ts: z33.string().describe("`thread_ts` from that message's envelope."),
21327
+ confirmation_message_ts: z33.string().describe("`message_ts` from that message's envelope."),
21328
+ confirmation_user_id: z33.string().describe("`user_id` from that message's envelope.")
21209
21329
  });
21210
21330
  var scoutAutomationToolInputSchema = automationToolInputSchema.extend(scoutSlackConfirmationSchema.shape);
21211
21331
  var scoutSaveChannelPresetToolInputSchema = scoutSlackConfirmationSchema.extend({
21212
- preset_id: z31.string().optional().describe(`Id of the preset to update, from \`${REPLICAS_MCP_TOOLS.listChannelSettings}\`. Omit to create a new preset.`),
21213
- name: z31.string().trim().min(1).max(SCOUT_PRESET_NAME_MAX_LENGTH).optional().describe("Preset name. Required when creating."),
21214
- description: z31.string().optional().describe("One-line summary of what the preset is for."),
21215
- icon: z31.enum(SCOUT_PRESET_ICONS).optional(),
21216
- instructions: z31.string().optional().describe("Complete preset instructions; replaces the existing text. Required when creating.")
21332
+ preset_id: z33.string().optional().describe(`Id of the preset to update, from \`${REPLICAS_MCP_TOOLS.listChannelSettings}\`. Omit to create a new preset.`),
21333
+ name: z33.string().trim().min(1).max(SCOUT_PRESET_NAME_MAX_LENGTH).optional().describe("Preset name. Required when creating."),
21334
+ description: z33.string().optional().describe("One-line summary of what the preset is for."),
21335
+ icon: z33.enum(SCOUT_PRESET_ICONS).optional(),
21336
+ instructions: z33.string().optional().describe("Complete preset instructions; replaces the existing text. Required when creating.")
21217
21337
  });
21218
21338
  var scoutUpdateChannelSettingsToolInputSchema = scoutSlackConfirmationSchema.extend({
21219
- source: z31.enum(SCOUT_SOURCE_TYPES).optional().describe("Defaults to `slack`."),
21220
- external_id: z31.string().describe("Slack channel id or Linear team id."),
21221
- monitored: z31.boolean().optional().describe("Linear: `true` starts monitoring the team (organization admins only), `false` stops. Slack: kept for older callers; prefer `proactivity`. `false` means `tagged`, and `true` lifts a `tagged` channel back to the organization's level. Omit to keep it."),
21222
- preset_id: z31.string().nullable().optional().describe("Preset to assign; `null` removes the preset. Omit to keep it."),
21223
- instructions: z31.string().nullable().optional().describe("Complete channel-specific instructions, applied after the preset; replaces the existing text. `null` clears them. Omit to keep them."),
21224
- proactivity: z31.enum([...SCOUT_PROACTIVITY_LEVELS, "organization"]).optional().describe("Slack only: this channel's or group DM's own level, overriding the organization's here alone. `organization` makes it follow the organization's level again. Omit to keep it. 1:1 DMs are always addressed to Replicas, so they take no level."),
21225
- muted: z31.enum(["on", "off", "default"]).optional().describe(`Slack only, organization admins only: \`on\` mutes Replicas in this channel, \`off\` unmutes it here, \`default\` follows the Slack Connect default from \`${REPLICAS_MCP_TOOLS.setSlackConnectDefaults}\`. Omit to keep it.`)
21339
+ source: z33.enum(SCOUT_SOURCE_TYPES).optional().describe("Defaults to `slack`."),
21340
+ external_id: z33.string().describe("Slack channel id or Linear team id."),
21341
+ monitored: z33.boolean().optional().describe("Linear: `true` starts monitoring the team (organization admins only), `false` stops. Slack: kept for older callers; prefer `proactivity`. `false` means `tagged`, and `true` lifts a `tagged` channel back to the organization's level. Omit to keep it."),
21342
+ preset_id: z33.string().nullable().optional().describe("Preset to assign; `null` removes the preset. Omit to keep it."),
21343
+ instructions: z33.string().nullable().optional().describe("Complete channel-specific instructions, applied after the preset; replaces the existing text. `null` clears them. Omit to keep them."),
21344
+ proactivity: z33.enum([...SCOUT_PROACTIVITY_LEVELS, "organization"]).optional().describe("Slack only: this channel's or group DM's own level, overriding the organization's here alone. `organization` makes it follow the organization's level again. Omit to keep it. 1:1 DMs are always addressed to Replicas, so they take no level."),
21345
+ muted: z33.enum(["on", "off", "default"]).optional().describe(`Slack only, organization admins only: \`on\` mutes Replicas in this channel, \`off\` unmutes it here, \`default\` follows the Slack Connect default from \`${REPLICAS_MCP_TOOLS.setSlackConnectDefaults}\`. Omit to keep it.`)
21226
21346
  });
21227
21347
  var mothershipSlackChannelLevelToolInputSchema = scoutSlackConfirmationSchema.extend({
21228
21348
  proactivity: scoutUpdateChannelSettingsToolInputSchema.shape.proactivity.unwrap().describe("This channel's own level. `organization` makes it follow the organization's level again, which a Mothership's channel raises to at least `balanced`.")
21229
21349
  });
21230
21350
  var scoutSetSlackConnectMutedToolInputSchema = scoutSlackConfirmationSchema.extend({
21231
- muted: z31.boolean().describe("`true` mutes Replicas in every Slack Connect channel without its own setting; `false` lets them follow their levels again.")
21351
+ muted: z33.boolean().describe("`true` mutes Replicas in every Slack Connect channel without its own setting; `false` lets them follow their levels again.")
21232
21352
  });
21233
21353
  var scoutSetSlackConnectDefaultsToolInputSchema = scoutSetSlackConnectMutedToolInputSchema.partial({ muted: true }).extend({
21234
- preset_id: z31.string().optional().describe("Preset for every Slack Connect channel without its own preset or instructions; an empty string removes it. Omit to keep it."),
21235
- instructions: z31.string().optional().describe("Complete default instructions, applied after that preset; replaces the existing text. An empty string clears them. Omit to keep them."),
21236
- proactivity: z31.enum([...SCOUT_PROACTIVITY_LEVELS, "default"]).optional().describe("Level for every Slack Connect channel without its own level. `default` returns them to `tagged`. Omit to keep it.")
21354
+ preset_id: z33.string().optional().describe("Preset for every Slack Connect channel without its own preset or instructions; an empty string removes it. Omit to keep it."),
21355
+ instructions: z33.string().optional().describe("Complete default instructions, applied after that preset; replaces the existing text. An empty string clears them. Omit to keep them."),
21356
+ proactivity: z33.enum([...SCOUT_PROACTIVITY_LEVELS, "default"]).optional().describe("Level for every Slack Connect channel without its own level. `default` returns them to `tagged`. Omit to keep it.")
21237
21357
  });
21238
21358
  var scoutSetOrganizationProactivityToolInputSchema = scoutSlackConfirmationSchema.extend({
21239
- proactivity: z31.enum(SCOUT_PROACTIVITY_LEVELS).describe(`The level every Slack channel and group DM follows unless it has its own. Slack Connect channels without their own level follow the shared-channel default from \`${REPLICAS_MCP_TOOLS.setSlackConnectDefaults}\` instead.`)
21359
+ proactivity: z33.enum(SCOUT_PROACTIVITY_LEVELS).describe(`The level every Slack channel and group DM follows unless it has its own. Slack Connect channels without their own level follow the shared-channel default from \`${REPLICAS_MCP_TOOLS.setSlackConnectDefaults}\` instead.`)
21240
21360
  });
21241
21361
  var scoutDeleteChannelPresetToolInputSchema = scoutSlackConfirmationSchema.extend({
21242
- preset_id: z31.string().describe(`Id of the preset to delete, from \`${REPLICAS_MCP_TOOLS.listChannelSettings}\`.`)
21362
+ preset_id: z33.string().describe(`Id of the preset to delete, from \`${REPLICAS_MCP_TOOLS.listChannelSettings}\`.`)
21243
21363
  });
21244
21364
  var RESET_TO_DEFAULT = "default";
21245
- var resettable = (schema, description) => z31.union([schema, z31.literal(RESET_TO_DEFAULT)]).optional().describe(`${description} \`${RESET_TO_DEFAULT}\` falls back to the organization default. Omit to keep it.`);
21365
+ var resettable = (schema, description) => z33.union([schema, z33.literal(RESET_TO_DEFAULT)]).optional().describe(`${description} \`${RESET_TO_DEFAULT}\` falls back to the organization default. Omit to keep it.`);
21246
21366
  var scoutSetSlackAgentDefaultsToolInputSchema = scoutSlackConfirmationSchema.extend({
21247
- agent_provider: resettable(z31.enum(AGENT), "Agent for Slack-triggered workspaces. Changing it without `model` resets the model to that agent's default."),
21248
- model: resettable(z31.string(), "Model id for that agent; the default is the agent's own."),
21249
- thinking_level: resettable(z31.enum(VALID_THINKING_LEVELS), "Thinking level."),
21250
- goal_mode: resettable(z31.boolean(), "Goal mode."),
21251
- fast_mode: resettable(z31.boolean(), "Fast mode.")
21367
+ agent_provider: resettable(z33.enum(AGENT), "Agent for Slack-triggered workspaces. Changing it without `model` resets the model to that agent's default."),
21368
+ model: resettable(z33.string(), "Model id for that agent; the default is the agent's own."),
21369
+ thinking_level: resettable(z33.enum(VALID_THINKING_LEVELS), "Thinking level."),
21370
+ goal_mode: resettable(z33.boolean(), "Goal mode."),
21371
+ fast_mode: resettable(z33.boolean(), "Fast mode.")
21252
21372
  });
21253
- var scoutClaimSettingsOfferToolInputSchema = z31.object({
21373
+ var scoutClaimSettingsOfferToolInputSchema = z33.object({
21254
21374
  channel_id: slackChannelIdSchema,
21255
- kind: z31.enum(SCOUT_SETTINGS_OFFERS).describe("`proactivity`: offering a lower level after frustration. `raise_proactivity`: offering a higher level after someone had to @mention you. `instructions`: offering channel instructions or a preset. `organization_proactivity` and `raise_organization_proactivity`: offering to lower or raise the workspace default; only decline them, the server claims them for you."),
21256
- user_id: z31.string().optional().describe("The envelope's `user_id`. Required for `proactivity` and `raise_proactivity`, so the server can say whether they are an organization admin."),
21257
- declined: z31.boolean().optional().describe("true when the person declined an offer you already made, so it is not made again.")
21375
+ kind: z33.enum(SCOUT_SETTINGS_OFFERS).describe("`proactivity`: offering a lower level after frustration. `raise_proactivity`: offering a higher level after someone had to @mention you. `instructions`: offering channel instructions or a preset. `organization_proactivity` and `raise_organization_proactivity`: offering to lower or raise the workspace default; only decline them, the server claims them for you."),
21376
+ user_id: z33.string().optional().describe("The envelope's `user_id`. Required for `proactivity` and `raise_proactivity`, so the server can say whether they are an organization admin."),
21377
+ declined: z33.boolean().optional().describe("true when the person declined an offer you already made, so it is not made again.")
21258
21378
  });
21259
21379
 
21260
21380
  // ../shared/src/routes/plugin-catalog.ts
@@ -21612,22 +21732,22 @@ var PLUGIN_CATALOG = [
21612
21732
  ].map((plugin) => ({ ...plugin, readOnlyScopes: READ_ONLY_SCOPES[plugin.id] }));
21613
21733
 
21614
21734
  // ../shared/src/routes/sentry.ts
21615
- import { z as z32 } from "zod";
21616
- var sentrySelfHostedConnectRequestSchema = z32.object({
21617
- baseUrl: z32.string().min(1),
21618
- token: z32.string().trim().min(1),
21619
- webhookSecret: z32.string().trim().optional()
21735
+ import { z as z34 } from "zod";
21736
+ var sentrySelfHostedConnectRequestSchema = z34.object({
21737
+ baseUrl: z34.string().min(1),
21738
+ token: z34.string().trim().min(1),
21739
+ webhookSecret: z34.string().trim().optional()
21620
21740
  });
21621
21741
 
21622
21742
  // ../shared/src/routes/user.ts
21623
21743
  var PROFILE_AVATAR_MAX_SIZE_BYTES = 5 * 1024 * 1024;
21624
21744
 
21625
21745
  // ../shared/src/routes/web-auth.ts
21626
- import { z as z33 } from "zod";
21627
- var webAuthRedeemResponseSchema = z33.object({
21628
- path: z33.string(),
21629
- organizationId: z33.string().nullable(),
21630
- session: z33.object({ access_token: z33.string(), refresh_token: z33.string(), user: z33.object({ id: z33.string(), email: z33.string() }) }).nullable()
21746
+ import { z as z35 } from "zod";
21747
+ var webAuthRedeemResponseSchema = z35.object({
21748
+ path: z35.string(),
21749
+ organizationId: z35.string().nullable(),
21750
+ session: z35.object({ access_token: z35.string(), refresh_token: z35.string(), user: z35.object({ id: z35.string(), email: z35.string() }) }).nullable()
21631
21751
  });
21632
21752
 
21633
21753
  // ../shared/src/routes/client-state.ts
@@ -21652,104 +21772,104 @@ var promptHistoryClientStateKey = orgUserClientStateKey(PROMPT_HISTORY_CLIENT_ST
21652
21772
  var workspaceSearchOpensClientStateKey = orgUserClientStateKey(WORKSPACE_SEARCH_OPENS_CLIENT_STATE_KEY_PREFIX);
21653
21773
 
21654
21774
  // ../shared/src/routes/workspace-events.ts
21655
- import { z as z35 } from "zod";
21775
+ import { z as z37 } from "zod";
21656
21776
 
21657
21777
  // ../shared/src/routes/presence.ts
21658
- import { z as z34 } from "zod";
21659
- var presenceStatusSchema = z34.enum(["online", "typing"]);
21660
- var presenceLocationSchema = z34.object({
21661
- workspaceId: z34.string().optional()
21778
+ import { z as z36 } from "zod";
21779
+ var presenceStatusSchema = z36.enum(["online", "typing"]);
21780
+ var presenceLocationSchema = z36.object({
21781
+ workspaceId: z36.string().optional()
21662
21782
  });
21663
- var presenceEntrySchema = z34.object({
21664
- userId: z34.string(),
21783
+ var presenceEntrySchema = z36.object({
21784
+ userId: z36.string(),
21665
21785
  status: presenceStatusSchema,
21666
21786
  location: presenceLocationSchema,
21667
- ts: z34.string()
21787
+ ts: z36.string()
21668
21788
  });
21669
- var updatePresenceRequestSchema = z34.object({
21789
+ var updatePresenceRequestSchema = z36.object({
21670
21790
  status: presenceStatusSchema,
21671
21791
  location: presenceLocationSchema.optional()
21672
21792
  });
21673
21793
 
21674
21794
  // ../shared/src/routes/workspace-events.ts
21675
- var workspaceTurnCompletionSchema = z35.object({
21676
- workspaceName: z35.string(),
21677
- completedAt: z35.string(),
21678
- processing: z35.boolean().optional(),
21679
- pullRequestFeedback: z35.boolean().optional(),
21680
- attention: z35.object({ reason: z35.enum(CHAT_ATTENTION_REASONS), userId: z35.string() }).optional()
21795
+ var workspaceTurnCompletionSchema = z37.object({
21796
+ workspaceName: z37.string(),
21797
+ completedAt: z37.string(),
21798
+ processing: z37.boolean().optional(),
21799
+ pullRequestFeedback: z37.boolean().optional(),
21800
+ attention: z37.object({ reason: z37.enum(CHAT_ATTENTION_REASONS), userId: z37.string() }).optional()
21681
21801
  });
21682
- var workspaceEventSchemaByType = z35.discriminatedUnion("type", [
21683
- z35.object({
21684
- type: z35.literal("workspace.changed"),
21685
- workspaceId: z35.string(),
21686
- accessChangedFor: z35.string().optional(),
21687
- accessChangedForOrg: z35.literal(true).optional(),
21688
- workspace: z35.object({ status: z35.enum(WORKSPACE_STATUSES), last_activity_at: z35.string().nullable() }).optional(),
21689
- name: z35.string().optional(),
21802
+ var workspaceEventSchemaByType = z37.discriminatedUnion("type", [
21803
+ z37.object({
21804
+ type: z37.literal("workspace.changed"),
21805
+ workspaceId: z37.string(),
21806
+ accessChangedFor: z37.string().optional(),
21807
+ accessChangedForOrg: z37.literal(true).optional(),
21808
+ workspace: z37.object({ status: z37.enum(WORKSPACE_STATUSES), last_activity_at: z37.string().nullable() }).optional(),
21809
+ name: z37.string().optional(),
21690
21810
  completion: workspaceTurnCompletionSchema.optional(),
21691
- ts: z35.string()
21811
+ ts: z37.string()
21692
21812
  }),
21693
- z35.object({
21694
- type: z35.literal("workspace.chat.changed"),
21695
- workspaceId: z35.string(),
21696
- chatId: z35.string(),
21697
- ts: z35.string()
21813
+ z37.object({
21814
+ type: z37.literal("workspace.chat.changed"),
21815
+ workspaceId: z37.string(),
21816
+ chatId: z37.string(),
21817
+ ts: z37.string()
21698
21818
  }),
21699
- z35.object({
21700
- type: z35.literal("workspace.chat.advanced"),
21701
- workspaceId: z35.string(),
21702
- chatId: z35.string(),
21703
- afterCursor: z35.string().optional(),
21704
- processing: z35.boolean(),
21705
- ts: z35.string()
21819
+ z37.object({
21820
+ type: z37.literal("workspace.chat.advanced"),
21821
+ workspaceId: z37.string(),
21822
+ chatId: z37.string(),
21823
+ afterCursor: z37.string().optional(),
21824
+ processing: z37.boolean(),
21825
+ ts: z37.string()
21706
21826
  }),
21707
- z35.object({
21708
- type: z35.literal("mobile-testing.changed"),
21709
- workspaceId: z35.string(),
21710
- ts: z35.string()
21827
+ z37.object({
21828
+ type: z37.literal("mobile-testing.changed"),
21829
+ workspaceId: z37.string(),
21830
+ ts: z37.string()
21711
21831
  }),
21712
- z35.object({
21713
- type: z35.literal("variable-request.changed"),
21714
- workspaceId: z35.string(),
21715
- ts: z35.string()
21832
+ z37.object({
21833
+ type: z37.literal("variable-request.changed"),
21834
+ workspaceId: z37.string(),
21835
+ ts: z37.string()
21716
21836
  }),
21717
- z35.object({
21718
- type: z35.literal("local-control-request.changed"),
21719
- workspaceId: z35.string(),
21720
- ts: z35.string()
21837
+ z37.object({
21838
+ type: z37.literal("local-control-request.changed"),
21839
+ workspaceId: z37.string(),
21840
+ ts: z37.string()
21721
21841
  }),
21722
- z35.object({
21723
- type: z35.literal("pull-request.changed"),
21724
- prUrl: z35.string(),
21725
- ts: z35.string()
21842
+ z37.object({
21843
+ type: z37.literal("pull-request.changed"),
21844
+ prUrl: z37.string(),
21845
+ ts: z37.string()
21726
21846
  }),
21727
- z35.object({
21728
- type: z35.literal("mothership.subagent.changed"),
21729
- workspaceId: z35.string(),
21730
- subagent: z35.object({ id: z35.string(), name: z35.string(), prUrl: z35.string().nullable() }),
21731
- ts: z35.string()
21847
+ z37.object({
21848
+ type: z37.literal("mothership.subagent.changed"),
21849
+ workspaceId: z37.string(),
21850
+ subagent: z37.object({ id: z37.string(), name: z37.string(), prUrl: z37.string().nullable() }),
21851
+ ts: z37.string()
21732
21852
  }),
21733
- z35.object({ type: z35.literal("mothership.board.changed"), workspaceId: z35.string(), ts: z35.string() }),
21734
- z35.object({ type: z35.literal("needs-you.changed"), workspaceId: z35.string().nullable(), userId: z35.string().optional(), ts: z35.string() }),
21735
- z35.object({
21736
- type: z35.literal("workspace.shared"),
21737
- workspaceId: z35.string(),
21738
- workspaceName: z35.string(),
21739
- sharedWithUserId: z35.string(),
21740
- sharedByName: z35.string(),
21741
- ts: z35.string()
21853
+ z37.object({ type: z37.literal("mothership.board.changed"), workspaceId: z37.string(), ts: z37.string() }),
21854
+ z37.object({ type: z37.literal("needs-you.changed"), workspaceId: z37.string().nullable(), userId: z37.string().optional(), ts: z37.string() }),
21855
+ z37.object({
21856
+ type: z37.literal("workspace.shared"),
21857
+ workspaceId: z37.string(),
21858
+ workspaceName: z37.string(),
21859
+ sharedWithUserId: z37.string(),
21860
+ sharedByName: z37.string(),
21861
+ ts: z37.string()
21742
21862
  })
21743
21863
  ]);
21744
- var workspaceChangedEventSchema = z35.union([
21864
+ var workspaceChangedEventSchema = z37.union([
21745
21865
  workspaceEventSchemaByType,
21746
- z35.object({ type: z35.literal("presence.changed"), userId: z35.string(), entry: presenceEntrySchema.nullable(), ts: z35.string() }),
21747
- z35.object({ type: z35.literal("presence.changed"), ts: z35.string() })
21866
+ z37.object({ type: z37.literal("presence.changed"), userId: z37.string(), entry: presenceEntrySchema.nullable(), ts: z37.string() }),
21867
+ z37.object({ type: z37.literal("presence.changed"), ts: z37.string() })
21748
21868
  ]);
21749
21869
 
21750
21870
  // ../shared/src/routes/review-messages.ts
21751
- import { z as z36 } from "zod";
21752
- var sendPullRequestReviewMessageRequestSchema = z36.object({
21871
+ import { z as z38 } from "zod";
21872
+ var sendPullRequestReviewMessageRequestSchema = z38.object({
21753
21873
  ...sendChatMessageRequestSchema.pick({
21754
21874
  message: true,
21755
21875
  messageId: true,
@@ -21762,8 +21882,8 @@ var sendPullRequestReviewMessageRequestSchema = z36.object({
21762
21882
  ultrafastMode: true
21763
21883
  }).shape,
21764
21884
  /** Starts a new chat instead of continuing the PR's review chat. The provider only applies to a new chat. */
21765
- newChat: z36.boolean().optional(),
21766
- provider: z36.enum(VALID_AGENT_PROVIDERS).optional()
21885
+ newChat: z38.boolean().optional(),
21886
+ provider: z38.enum(VALID_AGENT_PROVIDERS).optional()
21767
21887
  });
21768
21888
 
21769
21889
  // ../shared/src/audit-log.ts
@@ -22426,40 +22546,40 @@ function isSkillRegistryManifest(value) {
22426
22546
  }
22427
22547
 
22428
22548
  // ../shared/src/routes/variable-requests.ts
22429
- import { z as z37 } from "zod";
22549
+ import { z as z39 } from "zod";
22430
22550
  var VARIABLE_REQUEST_WAIT = { defaultMs: 10 * 6e4, maxMs: 30 * 6e4, pollMs: 3e3, waiterStaleMs: 15e3 };
22431
22551
  var VARIABLE_REQUEST_DESTINATIONS = ["environment", "workspace"];
22432
- var requestedVariableSchema = z37.object({
22433
- key: z37.string().regex(VARIABLE_KEY_RE, "must be a valid environment variable name").max(ENVIRONMENT_SETUP_LIMITS.variableKeyChars),
22434
- required: z37.boolean(),
22435
- replace: z37.boolean().optional()
22552
+ var requestedVariableSchema = z39.object({
22553
+ key: z39.string().regex(VARIABLE_KEY_RE, "must be a valid environment variable name").max(ENVIRONMENT_SETUP_LIMITS.variableKeyChars),
22554
+ required: z39.boolean(),
22555
+ replace: z39.boolean().optional()
22436
22556
  });
22437
- var requestedVariablesSchema = z37.array(requestedVariableSchema).min(1, "must not be empty").max(ENVIRONMENT_SETUP_LIMITS.variables).refine((variables) => new Set(variables.map((variable) => variable.key)).size === variables.length, "must have unique keys");
22438
- var createVariableRequestSchema = z37.object({
22557
+ var requestedVariablesSchema = z39.array(requestedVariableSchema).min(1, "must not be empty").max(ENVIRONMENT_SETUP_LIMITS.variables).refine((variables) => new Set(variables.map((variable) => variable.key)).size === variables.length, "must have unique keys");
22558
+ var createVariableRequestSchema = z39.object({
22439
22559
  variables: requestedVariablesSchema,
22440
- reason: z37.string().trim().max(500).nullish().transform((value) => value || null),
22441
- wait: z37.boolean().default(true)
22560
+ reason: z39.string().trim().max(500).nullish().transform((value) => value || null),
22561
+ wait: z39.boolean().default(true)
22442
22562
  });
22443
- var respondVariableRequestSchema = z37.discriminatedUnion("action", [
22444
- z37.object({
22445
- action: z37.literal("provide"),
22446
- destination: z37.enum(VARIABLE_REQUEST_DESTINATIONS),
22563
+ var respondVariableRequestSchema = z39.discriminatedUnion("action", [
22564
+ z39.object({
22565
+ action: z39.literal("provide"),
22566
+ destination: z39.enum(VARIABLE_REQUEST_DESTINATIONS),
22447
22567
  /** Defaults to the workspace's environment, so older clients keep saving there. */
22448
- environment_ids: z37.array(z37.string().uuid()).optional(),
22449
- overwrite: z37.boolean().optional(),
22450
- values: z37.record(z37.string().regex(VARIABLE_KEY_RE), z37.string())
22568
+ environment_ids: z39.array(z39.string().uuid()).optional(),
22569
+ overwrite: z39.boolean().optional(),
22570
+ values: z39.record(z39.string().regex(VARIABLE_KEY_RE), z39.string())
22451
22571
  }),
22452
- z37.object({ action: z37.literal("skip") })
22572
+ z39.object({ action: z39.literal("skip") })
22453
22573
  ]);
22454
22574
 
22455
22575
  // ../shared/src/routes/local-control-requests.ts
22456
- import { z as z38 } from "zod";
22457
- var createLocalControlRequestSchema = z38.object({
22458
- reason: z38.string().trim().max(500).optional().transform((value) => value || null),
22459
- wait: z38.boolean().default(true)
22576
+ import { z as z40 } from "zod";
22577
+ var createLocalControlRequestSchema = z40.object({
22578
+ reason: z40.string().trim().max(500).optional().transform((value) => value || null),
22579
+ wait: z40.boolean().default(true)
22460
22580
  });
22461
- var respondLocalControlRequestSchema = z38.object({ action: z38.enum(["allow", "dismiss"]) });
22462
- var setLocalControlSchema = z38.object({ enabled: z38.boolean() });
22581
+ var respondLocalControlRequestSchema = z40.object({ action: z40.enum(["allow", "dismiss"]) });
22582
+ var setLocalControlSchema = z40.object({ enabled: z40.boolean() });
22463
22583
 
22464
22584
  export {
22465
22585
  ENGINE_SEND_MESSAGE_FAILED_ERROR,