replicas-engine 0.1.1582 → 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 = {
@@ -12233,55 +12422,57 @@ var REPLICAS_MCP_TOOLS = {
12233
12422
  deleteChat: "delete_chat",
12234
12423
  listRepositories: "list_repositories"
12235
12424
  };
12236
- var automationToolInputSchema = z20.object({
12237
- name: z20.string().describe("Short automation name."),
12238
- prompt: z20.string().describe("Prompt each automation run starts with."),
12239
- environment_id: z20.string().describe(`Environment id from \`${REPLICAS_MCP_TOOLS.listEnvironments}\`.`),
12240
- 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(
12241
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"] } }\`.`
12242
12431
  ),
12243
- description: z20.string().optional().describe("One-line summary shown in the dashboard."),
12244
- plan_mode: z20.boolean().optional(),
12245
- goal_mode: z20.boolean().optional(),
12246
- fast_mode: z20.boolean().optional(),
12247
- 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(
12248
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."
12249
12438
  )
12250
12439
  });
12251
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.`;
12252
- var automationBackgroundSchema = z20.boolean().optional().describe(
12441
+ var automationBackgroundSchema = z22.boolean().optional().describe(
12253
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."
12254
12443
  );
12255
12444
  var automationCreateToolInputSchema = automationToolInputSchema.extend({
12256
- 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.`),
12257
12446
  background: automationBackgroundSchema,
12258
- 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.")
12259
12448
  });
12260
12449
  var automationUpdateToolInputSchema = automationToolInputSchema.partial().extend({
12261
- automation_id: z20.string().describe("Automation ID"),
12262
- enabled: z20.boolean().optional(),
12263
- agent_provider: z20.enum(AGENT).nullable().optional(),
12264
- model: z20.string().nullable().optional(),
12265
- thinking_level: z20.enum(VALID_THINKING_LEVELS).nullable().optional(),
12266
- workspace_size: z20.enum(WORKSPACE_SIZES).optional(),
12267
- 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.`),
12268
12457
  background: automationBackgroundSchema,
12269
- 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.")
12270
12459
  });
12271
- 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") };
12272
12461
  var { provider, model, thinkingLevel, title, message } = forkChatRequestSchema.shape;
12273
- var createChatToolInputSchema = z20.object({ id: chatPath.id, provider, title: createChatRequestSchema.shape.title });
12274
- var forkChatToolInputSchema = z20.object({ ...chatPath, provider, model, thinking_level: thinkingLevel, title, message });
12275
- var renameChatToolInputSchema = z20.object({ ...chatPath, display_name: updateChatDisplayNameRequestSchema.shape.displayName });
12276
- var runCommandToolInputSchema = z20.object({ id: chatPath.id, ...workspaceExecRequestSchema.shape });
12277
- var environmentMcpPath = { environment_id: z20.string().describe("Environment ID") };
12278
- var createEnvironmentMcpToolInputSchema = z20.object({ ...environmentMcpPath, ...createEnvironmentMcpRequestSchema.shape });
12279
- 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({
12280
12469
  ...environmentMcpPath,
12281
- mcp_id: z20.string().describe("MCP ID"),
12470
+ mcp_id: z22.string().describe("MCP ID"),
12282
12471
  ...updateEnvironmentMcpRequestSchema.shape
12283
12472
  });
12284
- 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 });
12285
12476
 
12286
12477
  // ../shared/src/scout.ts
12287
12478
  var SCOUT_SOURCE_TYPES = ["slack", "linear"];
@@ -12374,63 +12565,63 @@ When someone asks for a recurring task or accepts an offer to automate a repeate
12374
12565
  `;
12375
12566
 
12376
12567
  // ../shared/src/routes/preferences.ts
12377
- import { z as z24 } from "zod";
12568
+ import { z as z25 } from "zod";
12378
12569
 
12379
12570
  // ../shared/src/routes/push.ts
12380
- import { z as z21 } from "zod";
12571
+ import { z as z23 } from "zod";
12381
12572
 
12382
12573
  // ../shared/src/workspace-attention.ts
12383
12574
  var WORKSPACE_ATTENTION_REASONS = ["question", "plan", "variables", "blocked", "setup", "deploy_failed"];
12384
12575
  var CHAT_ATTENTION_REASONS = ["question", "blocked"];
12385
12576
 
12386
12577
  // ../shared/src/routes/push.ts
12387
- var registerPushDeviceRequestSchema = z21.discriminatedUnion("platform", [
12388
- z21.object({
12389
- platform: z21.literal("ios"),
12390
- token: z21.string().regex(/^[0-9a-f]{64,200}$/i),
12391
- appId: z21.string().min(1).max(255),
12392
- 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"])
12393
12584
  }),
12394
- z21.object({
12395
- platform: z21.literal("android"),
12396
- token: z21.string().min(1).max(4096),
12397
- 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)
12398
12589
  })
12399
12590
  ]);
12400
12591
  var PUSH_HOLD_MINUTES = 5;
12401
- var chatRefSchema = z21.object({ workspaceId: z21.string().uuid(), chatId: z21.string().min(1).max(100) });
12402
- var recordPushActivityRequestSchema = z21.object({
12403
- 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(),
12404
12595
  /** Seconds since the last keyboard or mouse input on this computer. A phone leaves it out: it only reports what it has open. */
12405
- idleSeconds: z21.number().min(0).optional(),
12406
- seenWorkspaceIds: z21.array(z21.string().uuid()).max(20),
12407
- 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()
12408
12599
  });
12409
12600
  var PUSH_NOTIFICATION_KINDS = [...WORKSPACE_ATTENTION_REASONS, "finished"];
12410
12601
  var PUSH_OPTION_LABEL_MAX = 60;
12411
12602
  var PUSH_OPTIONS_MAX = 4;
12412
- 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) });
12413
- var pushNotificationDataSchema = z21.object({
12414
- organizationId: z21.string(),
12415
- workspaceId: z21.string(),
12416
- chatId: z21.string().nullable(),
12417
- kind: z21.enum(PUSH_NOTIFICATION_KINDS),
12418
- completedAt: z21.string(),
12419
- 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(),
12420
12611
  question: pushQuestionSchema.optional()
12421
12612
  });
12422
- 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") });
12423
12614
  var registerLiveActivityRequestSchema = chatRefSchema.extend({
12424
- deviceId: z21.string().uuid(),
12615
+ deviceId: z23.string().uuid(),
12425
12616
  /** The iOS activity's push token. Android leaves it out and gets FCM data messages on the device token. */
12426
- pushToken: z21.string().regex(/^[0-9a-f]{64,400}$/i).optional(),
12617
+ pushToken: z23.string().regex(/^[0-9a-f]{64,400}$/i).optional(),
12427
12618
  /** iOS only: when the card's turn started, in seconds. Cards keep their order by it. */
12428
- startedAt: z21.number().positive().optional()
12619
+ startedAt: z23.number().positive().optional()
12429
12620
  });
12430
- var syncLiveActivitiesRequestSchema = z21.object({
12431
- activities: z21.array(chatRefSchema).max(100)
12621
+ var syncLiveActivitiesRequestSchema = z23.object({
12622
+ activities: z23.array(chatRefSchema).max(100)
12432
12623
  });
12433
- 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) });
12434
12625
 
12435
12626
  // ../shared/src/default-skills/replicas-agent/abilities/computer.ts
12436
12627
  var SECTION = `### Computer use (Linux desktop control)
@@ -12711,156 +12902,6 @@ var DOCKER_ABILITY = {
12711
12902
  referenceFile: { name: "DOCKER.md", content: REFERENCE2 }
12712
12903
  };
12713
12904
 
12714
- // ../shared/src/routes/environment-setups.ts
12715
- import { z as z22 } from "zod";
12716
- var ENVIRONMENT_SETUP_STEPS = [
12717
- { key: "understand", label: "Understand the codebase" },
12718
- { key: "install", label: "Install dependencies and run the app" },
12719
- { key: "verify", label: "Verify checks and record a walkthrough" },
12720
- { key: "configure", label: "Draft hooks, system prompt, and automations" },
12721
- { key: "propose", label: "Propose the configuration for review" }
12722
- ];
12723
- var ENVIRONMENT_SETUP_STEP_STATUSES = ["pending", "in_progress", "completed", "skipped"];
12724
- var ENVIRONMENT_SETUP_RUN_STATUSES = ["running", "proposed", "applied", "failed", "cancelled", "expired"];
12725
- var ENVIRONMENT_SETUP_AUTOMATION_ACTIONS = ["create", "update", "keep", "disable"];
12726
- var ENVIRONMENT_SETUP_VERIFICATION_STATUSES = ["passed", "failed", "skipped"];
12727
- var ENVIRONMENT_SETUP_LIMITS = {
12728
- summaryChars: 600,
12729
- stackItems: 30,
12730
- nameChars: 120,
12731
- descriptionChars: 1e3,
12732
- systemPromptChars: 2e4,
12733
- hookChars: 5e4,
12734
- variables: 50,
12735
- variableKeyChars: 128,
12736
- variableDescriptionChars: 500,
12737
- automations: 8,
12738
- automationKeyChars: 80,
12739
- automationPromptChars: 1e4,
12740
- automationTriggers: 5,
12741
- automationNoteChars: 300,
12742
- verificationItems: 8,
12743
- verificationDetailChars: 300,
12744
- mediaItems: 8,
12745
- repositories: 20
12746
- };
12747
- var VARIABLE_KEY_RE = /^[A-Za-z_][A-Za-z0-9_]*$/;
12748
- var text2 = (max) => max === void 0 ? z22.string().trim() : z22.string().trim().max(max);
12749
- var requiredText = (max) => text2(max).min(1, "must not be empty");
12750
- var optionalText2 = (max) => text2(max).nullish().transform((value) => value || null);
12751
- var clearableText = (max) => text2(max).nullish().transform((value) => value === void 0 ? void 0 : value || null);
12752
- var list = (item, max) => max === void 0 ? z22.array(item) : z22.array(item).max(max);
12753
- var ENVIRONMENT_SETUP_AUTHORED_TRIGGER_TYPES = ["cron", "github", "gitlab"];
12754
- function isEnvironmentSetupAuthoredTriggerType(type) {
12755
- return ENVIRONMENT_SETUP_AUTHORED_TRIGGER_TYPES.some((authored) => authored === type);
12756
- }
12757
- var proposalTriggerSchema = z22.discriminatedUnion("type", [cronTriggerSchema, githubTriggerSchema, gitlabTriggerSchema]);
12758
- var existingTriggerSchema = z22.custom(
12759
- (value) => isRecord(value) && typeof value.type === "string" && isRecord(value.config),
12760
- "must be an automation trigger"
12761
- );
12762
- var carriedTriggerSchema = existingTriggerSchema.refine(
12763
- (trigger) => !isEnvironmentSetupAuthoredTriggerType(trigger.type)
12764
- );
12765
- function automationSchema(limits) {
12766
- const authored = z22.object({
12767
- name: text2(limits.nameChars),
12768
- description: text2(limits.descriptionChars),
12769
- prompt: text2(limits.automationPromptChars),
12770
- triggers: list(proposalTriggerSchema, limits.automationTriggers)
12771
- });
12772
- const updated = authored.extend({ triggers: list(z22.union([proposalTriggerSchema, carriedTriggerSchema]), limits.automationTriggers) });
12773
- return z22.object({
12774
- key: requiredText(limits.automationKeyChars),
12775
- action: z22.enum(ENVIRONMENT_SETUP_AUTOMATION_ACTIONS).default("create"),
12776
- automation_id: z22.string().regex(UUID_RE, "must be an automation id").nullable().default(null),
12777
- name: text2().default(""),
12778
- description: optionalText2().transform((value) => value ?? ""),
12779
- prompt: text2().default(""),
12780
- triggers: list(existingTriggerSchema).default([]),
12781
- note: optionalText2(limits.automationNoteChars)
12782
- }).superRefine((automation, ctx) => {
12783
- if (automation.action === "create" && automation.automation_id) {
12784
- ctx.addIssue({ code: "custom", path: ["automation_id"], message: "belongs on an update, keep, or disable entry" });
12785
- }
12786
- if (automation.action !== "create" && !automation.automation_id) {
12787
- ctx.addIssue({ code: "custom", path: ["automation_id"], message: "must be the id of an automation attached to this environment" });
12788
- }
12789
- if (automation.action === "create" || automation.action === "update") {
12790
- if (!automation.name) ctx.addIssue({ code: "custom", path: ["name"], message: "must not be empty" });
12791
- if (!automation.prompt) ctx.addIssue({ code: "custom", path: ["prompt"], message: "must not be empty" });
12792
- if (automation.triggers.length === 0) ctx.addIssue({ code: "custom", path: ["triggers"], message: "must not be empty" });
12793
- }
12794
- }).transform((automation, ctx) => {
12795
- if (automation.action === "keep" || automation.action === "disable") return automation;
12796
- const content = (automation.action === "update" ? updated : authored).safeParse(automation);
12797
- if (content.success) return { ...automation, ...content.data };
12798
- for (const issue of content.error.issues) ctx.addIssue({ ...issue, code: "custom" });
12799
- return z22.NEVER;
12800
- });
12801
- }
12802
- function automationListSchema(limits) {
12803
- return list(automationSchema(limits)).default([]).superRefine((automations, ctx) => {
12804
- if (new Set(automations.map((automation) => automation.key)).size !== automations.length) {
12805
- ctx.addIssue({ code: "custom", message: "must have unique keys" });
12806
- }
12807
- const targets = automations.flatMap((automation) => automation.automation_id ?? []);
12808
- if (new Set(targets).size !== targets.length) {
12809
- ctx.addIssue({ code: "custom", message: "must mention each existing automation once" });
12810
- }
12811
- if (limits.automations !== void 0 && automations.filter((automation) => automation.action === "create").length > limits.automations) {
12812
- ctx.addIssue({ code: "custom", message: `must create at most ${limits.automations} new automations` });
12813
- }
12814
- });
12815
- }
12816
- function environmentSchema(limits) {
12817
- return z22.object({
12818
- name: optionalText2(limits.nameChars).transform((value) => value ?? void 0),
12819
- description: clearableText(limits.descriptionChars),
12820
- system_prompt: clearableText(limits.systemPromptChars),
12821
- start_hook: clearableText(limits.hookChars),
12822
- warm_hook: clearableText(limits.hookChars)
12823
- });
12824
- }
12825
- function proposalSchema(limits) {
12826
- return z22.object({
12827
- summary: requiredText(limits.summaryChars),
12828
- stack: list(text2(), limits.stackItems).default([]).transform((items) => items.filter(Boolean)),
12829
- environment: environmentSchema(limits),
12830
- variables: list(z22.object({
12831
- key: z22.string().regex(VARIABLE_KEY_RE, "must be a valid environment variable name").max(limits.variableKeyChars ?? Number.POSITIVE_INFINITY),
12832
- description: optionalText2(limits.variableDescriptionChars).transform((value) => value ?? ""),
12833
- required: z22.boolean().default(false)
12834
- }), limits.variables).default([]),
12835
- automations: automationListSchema(limits),
12836
- verification: list(z22.object({
12837
- label: requiredText(limits.nameChars),
12838
- status: z22.enum(ENVIRONMENT_SETUP_VERIFICATION_STATUSES),
12839
- detail: optionalText2(limits.verificationDetailChars).transform((value) => value ?? void 0)
12840
- }), limits.verificationItems).default([]),
12841
- media: list(z22.object({
12842
- media_id: z22.string().regex(UUID_RE, "must be a media id"),
12843
- title: requiredText(limits.nameChars)
12844
- }), limits.mediaItems).default([])
12845
- });
12846
- }
12847
- var environmentSetupProposalSchema = proposalSchema({});
12848
- var environmentSetupProposalSubmissionSchema = proposalSchema(ENVIRONMENT_SETUP_LIMITS);
12849
- var environmentSetupRunStateSchema = z22.object({
12850
- status: z22.enum(ENVIRONMENT_SETUP_RUN_STATUSES),
12851
- steps: z22.partialRecord(z22.enum(ENVIRONMENT_SETUP_STEPS.map((step) => step.key)), z22.enum(ENVIRONMENT_SETUP_STEP_STATUSES)).default({}),
12852
- proposal: environmentSetupProposalSchema.nullable().default(null),
12853
- applied: z22.object({
12854
- applied_at: z22.string(),
12855
- automation_ids: z22.array(z22.string())
12856
- }).nullable().default(null)
12857
- });
12858
- var applyEnvironmentSetupRequestSchema = z22.object({
12859
- environment: environmentSchema(ENVIRONMENT_SETUP_LIMITS).extend({ name: requiredText(ENVIRONMENT_SETUP_LIMITS.nameChars) }),
12860
- 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)),
12861
- automations: automationListSchema(ENVIRONMENT_SETUP_LIMITS)
12862
- });
12863
-
12864
12905
  // ../shared/src/default-skills/replicas-agent/abilities/environment-setup.ts
12865
12906
  var SECTION3 = `### Environment setup (agent-led)
12866
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.
@@ -13332,7 +13373,7 @@ var GITLAB_ABILITY = {
13332
13373
  };
13333
13374
 
13334
13375
  // ../shared/src/routes/compute.ts
13335
- import { z as z23 } from "zod";
13376
+ import { z as z24 } from "zod";
13336
13377
  var COMPUTE_SANDBOX_KINDS = ["gpu"];
13337
13378
  var GPU_TYPES = ["T4", "L4", "A10G", "L40S", "A100", "A100-80GB", "H100", "H200", "B200"];
13338
13379
  var DEFAULT_GPU_TYPE = "L4";
@@ -13349,27 +13390,27 @@ var COMPUTE_SANDBOX_LIMITS = {
13349
13390
  maxIdleTimeoutMinutes: 60,
13350
13391
  maxTransferBytes: 1024 ** 3
13351
13392
  };
13352
- 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");
13353
- var createComputeSandboxRequestSchema = z23.object({
13354
- kind: z23.enum(COMPUTE_SANDBOX_KINDS),
13355
- gpu: z23.string().trim().optional(),
13356
- image: z23.string().trim().min(1).max(256).regex(/^\S+$/, "Image must not contain whitespace").optional(),
13357
- timeoutMinutes: z23.number().int().min(1).max(COMPUTE_SANDBOX_LIMITS.maxTimeoutMinutes).optional(),
13358
- idleTimeoutMinutes: z23.number().int().min(1).max(COMPUTE_SANDBOX_LIMITS.maxIdleTimeoutMinutes).optional(),
13359
- 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(),
13360
13401
  env: computeEnvSchema.optional()
13361
13402
  });
13362
- var computeExecRequestSchema = z23.object({
13363
- command: z23.string().min(1).max(1e5),
13364
- 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(),
13365
13406
  env: computeEnvSchema.optional(),
13366
- detach: z23.boolean().optional()
13407
+ detach: z24.boolean().optional()
13367
13408
  });
13368
- var computeUploadRequestSchema = z23.object({
13369
- 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)
13370
13411
  });
13371
- var computeTransferPathSchema = z23.object({
13372
- path: z23.string().min(1).max(4096).optional()
13412
+ var computeTransferPathSchema = z24.object({
13413
+ path: z24.string().min(1).max(4096).optional()
13373
13414
  });
13374
13415
 
13375
13416
  // ../shared/src/default-skills/replicas-agent/abilities/gpu.ts
@@ -15121,9 +15162,9 @@ var DEFAULT_DEFAULT_SKILLS = {
15121
15162
  }
15122
15163
  };
15123
15164
  var LINEAR_ROUTING_SKILL_MAX_LENGTH = 5e4;
15124
- var linearRoutingSkillSchema = z24.union([
15125
- z24.object({ name: z24.string().min(1), content: z24.string().trim().min(1).max(LINEAR_ROUTING_SKILL_MAX_LENGTH) }),
15126
- 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) })
15127
15168
  ]);
15128
15169
 
15129
15170
  // ../shared/src/prompts.ts
@@ -15304,19 +15345,19 @@ var UNKNOWN_EVENT_KIND = "update";
15304
15345
  var MOTHERSHIP_TURN_ERROR_SUMMARY = "Turn ended with an error.";
15305
15346
  var MOTHERSHIP_EVENT_TYPE = "multitask-event";
15306
15347
  var MOTHERSHIP_EVENT_MESSAGE_TYPE = "multitask_event";
15307
- var mothershipEventSchema = z25.object({
15308
- id: z25.string(),
15309
- at: z25.string(),
15310
- kind: z25.enum([...MOTHERSHIP_EVENT_KINDS, UNKNOWN_EVENT_KIND]),
15311
- agentId: z25.string(),
15312
- agentName: z25.string(),
15313
- summary: z25.string(),
15314
- 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(),
15315
15356
  // Set when the subagent is a chat in this workspace rather than a ship; agentId is then that chat's id.
15316
- chatId: z25.string().optional(),
15317
- ticket: z25.object({ id: z25.string(), title: z25.string() }).optional(),
15357
+ chatId: z26.string().optional(),
15358
+ ticket: z26.object({ id: z26.string(), title: z26.string() }).optional(),
15318
15359
  // Set on events recorded before every kind woke the orchestrator, which were shown as a row when they happened.
15319
- noticed: z25.boolean().optional()
15360
+ noticed: z26.boolean().optional()
15320
15361
  });
15321
15362
  var TAG = "multitask_event";
15322
15363
  var BLOCK = new RegExp(`<${TAG}((?:\\s+\\w+="[^"]*")*)>\\n?([\\s\\S]*?)\\n?</${TAG}>`, "g");
@@ -16361,7 +16402,7 @@ function subagentReport(output) {
16361
16402
  }
16362
16403
 
16363
16404
  // ../shared/src/learned-skills.ts
16364
- import { z as z26 } from "zod";
16405
+ import { z as z27 } from "zod";
16365
16406
 
16366
16407
  // ../shared/src/frontmatter.ts
16367
16408
  import { parse as parseYaml } from "yaml";
@@ -16384,20 +16425,20 @@ function parseFrontmatter(content) {
16384
16425
  var LEARNED_SKILLS_ROOT = `${SANDBOX_PATHS.REPLICAS_DIR}/learned-skills`;
16385
16426
  var LEARNED_SKILLS_MANIFEST_PATH = `${LEARNED_SKILLS_ROOT}/manifest.json`;
16386
16427
  var LEARNED_SKILL_DIR_PREFIX = "replicas-learned__";
16387
- var learnedSkillsManifestSchema = z26.object({
16388
- 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() }))
16389
16430
  });
16390
- var dreamVerdictChecksSchema = z26.object({
16391
- repeatable: z26.boolean(),
16392
- realInstruction: z26.boolean(),
16393
- noContradiction: z26.boolean(),
16394
- formatExact: z26.boolean(),
16395
- humanOnly: z26.boolean(),
16396
- actionable: z26.boolean(),
16397
- 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()
16398
16439
  });
16399
16440
  var DREAM_VERDICT_CHECKS = dreamVerdictChecksSchema.keyof().options;
16400
- var dreamVerdictSchema = dreamVerdictChecksSchema.extend({ approve: z26.boolean(), reason: z26.string() });
16441
+ var dreamVerdictSchema = dreamVerdictChecksSchema.extend({ approve: z27.boolean(), reason: z27.string() });
16401
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."`;
16402
16443
 
16403
16444
  // ../shared/src/terminal.ts
@@ -16428,7 +16469,7 @@ function workspaceTargetFromToolOutput(output) {
16428
16469
  }
16429
16470
 
16430
16471
  // ../shared/src/mothership-board.ts
16431
- import { z as z27 } from "zod";
16472
+ import { z as z28 } from "zod";
16432
16473
  var MOTHERSHIP_TICKET_LIMITS = {
16433
16474
  title: 80,
16434
16475
  task: 1e3,
@@ -16448,78 +16489,78 @@ var MOTHERSHIP_TICKET_LIMITS = {
16448
16489
  };
16449
16490
  var L = MOTHERSHIP_TICKET_LIMITS;
16450
16491
  var tooLong = (max) => `At most ${max} characters. Keep it short; the user should take it in at a glance`;
16451
- var text3 = (max) => z27.string().trim().min(1).max(max, tooLong(max));
16452
- var clearable = (schema) => z27.union([schema, z27.literal("")]).optional();
16453
- 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" });
16454
16495
  var inlineMarkdown = "Markdown: **bold**, *italics*, `code`, [links](https://... or an absolute file path)";
16455
16496
  var markdown = `${inlineMarkdown} and line breaks.`;
16456
- 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");
16457
- 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({
16458
16499
  url: httpsUrl.describe("The URL `replicas media upload` printed."),
16459
16500
  caption: text3(L.caption).describe('What it shows, such as "After: the list stays pinned".'),
16460
- 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.")
16461
16502
  });
16462
- var questionSchema = z27.object({
16503
+ var questionSchema = z28.object({
16463
16504
  question: text3(L.question).describe("One question, with the context needed to answer it."),
16464
- 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.")
16465
16506
  });
16466
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.`);
16467
16508
  var mothershipTicketTaskSchema = text3(L.task);
16468
- var mothershipTicketMediaSchema = z27.array(mediaSchema);
16469
- 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() }));
16470
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.`);
16471
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.`);
16472
- var updateMothershipTicketRequestSchema = z27.object({
16513
+ var updateMothershipTicketRequestSchema = z28.object({
16473
16514
  title: mothershipTicketTitleSchema.optional(),
16474
16515
  issue: issueSchema,
16475
16516
  fix: fixSchema,
16476
- 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.`),
16477
- 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.`),
16478
16519
  blocked: clearable(text3(L.blocked)).describe('Why you cannot go on without the user, such as missing access. "" once unblocked.')
16479
16520
  });
16480
- var updateMothershipBoardRequestSchema = z27.object({
16521
+ var updateMothershipBoardRequestSchema = z28.object({
16481
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.`),
16482
- tickets: z27.array(z27.object({
16483
- id: z27.uuid(),
16523
+ tickets: z28.array(z28.object({
16524
+ id: z28.uuid(),
16484
16525
  title: mothershipTicketTitleSchema.optional(),
16485
16526
  issue: issueSchema,
16486
16527
  fix: fixSchema,
16487
- 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."),
16488
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.`),
16489
16530
  linear: clearable(linearIdentifier).describe('The Linear issue this ticket is for, such as REP-123. "" removes it.'),
16490
- 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.")
16491
16532
  })).max(50).optional().describe("Changes to existing tickets."),
16492
- order: z27.array(z27.uuid()).optional().describe("Ticket ids, most important first. Tickets left out keep their order after these."),
16493
- 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({
16494
16535
  title: mothershipTicketTitleSchema,
16495
16536
  task: mothershipTicketTaskSchema.optional(),
16496
16537
  issue: text3(L.issue).optional(),
16497
- questions: z27.array(questionSchema).max(L.questions).optional(),
16538
+ questions: z28.array(questionSchema).max(L.questions).optional(),
16498
16539
  note: text3(L.note).optional()
16499
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.")
16500
16541
  });
16501
- var answerMothershipTicketRequestSchema = z27.object({
16502
- questionId: z27.string().min(1),
16542
+ var answerMothershipTicketRequestSchema = z28.object({
16543
+ questionId: z28.string().min(1),
16503
16544
  answer: text3(L.answer)
16504
16545
  });
16505
- var mothershipTicketAnswerRefSchema = z27.object({ mothershipId: z27.uuid(), ticketId: z27.uuid(), questionId: z27.string().min(1) });
16506
- var replyOnMothershipTicketRequestSchema = z27.object({
16546
+ var mothershipTicketAnswerRefSchema = z28.object({ mothershipId: z28.uuid(), ticketId: z28.uuid(), questionId: z28.string().min(1) });
16547
+ var replyOnMothershipTicketRequestSchema = z28.object({
16507
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.`),
16508
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.")
16509
16550
  });
16510
- var mothershipTicketReplyRefSchema = z27.object({ ticketId: z27.uuid(), text: text3(L.answer) });
16511
- var mothershipTicketThreadSchema = z27.array(z27.object({
16512
- id: z27.string(),
16513
- from: z27.enum(["user", "ship"]),
16514
- name: z27.string(),
16515
- ship_id: z27.string(),
16516
- chat_id: z27.string(),
16517
- text: z27.string(),
16518
- at: z27.string(),
16519
- nudge: z27.enum(["sent", "missed"]).optional()
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()
16520
16561
  }));
16521
16562
  var LINEAR_ISSUE_SUMMARIES_MAX = 50;
16522
- 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) });
16523
16564
 
16524
16565
  // ../shared/src/user-message-matching.ts
16525
16566
  var parsedTimestamps = /* @__PURE__ */ new Map();
@@ -16889,10 +16930,10 @@ function currentStepLabel(messages, earlierPlainStep) {
16889
16930
  }
16890
16931
 
16891
16932
  // ../shared/src/user-message-attachments.ts
16892
- import { z as z28 } from "zod";
16933
+ import { z as z29 } from "zod";
16893
16934
  var ATTACHMENT_PLACEHOLDER_REGEX = /^\[\d+ (?:(?:images?|files?)(?: and \d+ files?)? attached|(?:image )?attachments?)\]$/;
16894
16935
  var withoutAttachmentPlaceholder = (content, attached) => attached && ATTACHMENT_PLACEHOLDER_REGEX.test(content) ? "" : content;
16895
- 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() });
16896
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".';
16897
16938
  var ANNOTATIONS_NOTE_REGEX = /(?:^|\n\n)<replicas_annotations>\n([\s\S]*?)\n<\/replicas_annotations>$/;
16898
16939
  var ANNOTATION_HEADER_REGEX = /^Annotation \d+$/m;
@@ -20189,7 +20230,7 @@ var VOICE_WAVEFORM = {
20189
20230
  };
20190
20231
 
20191
20232
  // ../shared/src/e2b.ts
20192
- var E2B_TEMPLATE_NAME = "replicas-sandbox-2026-11-15-v7";
20233
+ var E2B_TEMPLATE_NAME = "replicas-sandbox-2026-11-15-v8";
20193
20234
 
20194
20235
  // ../shared/src/e2b-retry.ts
20195
20236
  var DEFAULT_BACKOFFS_MS = [2e3, 5e3];
@@ -20544,6 +20585,55 @@ function resolveWarmHookConfig(value) {
20544
20585
  return resolveHookConfig(parseWarmHookConfig(value));
20545
20586
  }
20546
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
+
20547
20637
  // ../shared/src/replicas-config.ts
20548
20638
  var REPLICAS_CONFIG_FILENAMES = ["replicas.json", "replicas.yaml", "replicas.yml"];
20549
20639
  function isRecord4(value) {
@@ -20585,6 +20675,14 @@ function parseReplicasConfig(value, filename = "replicas.json") {
20585
20675
  if ("warmHook" in value) {
20586
20676
  config.warmHook = parseWarmHookConfig(value.warmHook, filename);
20587
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
+ }
20588
20686
  return config;
20589
20687
  }
20590
20688
  function parseReplicasConfigString(content, filename) {
@@ -20672,10 +20770,10 @@ function hasChatStarted(chat) {
20672
20770
  }
20673
20771
 
20674
20772
  // ../shared/src/routes/billing.ts
20675
- import { z as z29 } from "zod";
20773
+ import { z as z31 } from "zod";
20676
20774
  var SOURCE_LIMIT_SOURCES = ["limrun", "modal"];
20677
- var usageLimitCentsSchema = z29.number().int().min(100).max(1e8);
20678
- 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);
20679
20777
 
20680
20778
  // ../shared/src/routes/codex.ts
20681
20779
  var CODEX_AUTH_ENV_KEYS = [
@@ -20829,7 +20927,7 @@ var CLAUDE_AUTH_ENV_KEYS_BY_METHOD = {
20829
20927
  };
20830
20928
 
20831
20929
  // ../shared/src/routes/command-protection.ts
20832
- import { z as z30 } from "zod";
20930
+ import { z as z32 } from "zod";
20833
20931
 
20834
20932
  // ../shared/src/git-invocations.ts
20835
20933
  var COMMIT_VALUE_OPTIONS = /* @__PURE__ */ new Set(["message", "file", "trailer", "reuse-message", "reedit-message", "fixup", "squash", "template", "author", "date", "cleanup", "pathspec-from-file"]);
@@ -20920,27 +21018,27 @@ function findCheckoutTarget(args) {
20920
21018
  }
20921
21019
 
20922
21020
  // ../shared/src/routes/command-protection.ts
20923
- var commandProtectionRepoStateSchema = z30.object({
20924
- branch: z30.string().nullable(),
20925
- defaultBranch: z30.string().nullable(),
20926
- pushBranch: z30.string().nullable(),
20927
- pushConfig: z30.string().nullable(),
20928
- headMessage: z30.string().nullable(),
20929
- 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()
20930
21028
  });
20931
- var commandProtectionEvaluateRequestSchema = z30.object({
20932
- provider: z30.enum(["claude", "codex", "cursor", "opencode", "pi"]),
20933
- source: z30.enum(["claude_pre_tool_use", "codex_approval_request", "cursor_pre_tool_use", "opencode_pre_tool_use", "pi_tool_call"]),
20934
- toolName: z30.string(),
20935
- toolInput: z30.unknown(),
20936
- command: z30.string().nullish(),
20937
- cwd: z30.string().nullish(),
20938
- 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(),
20939
21037
  // Read by the engine before the command runs, keyed by absolute path, so the
20940
21038
  // policy can see branches and commit messages the command text only references.
20941
- gitContext: z30.object({
20942
- repos: z30.record(z30.string(), commandProtectionRepoStateSchema),
20943
- 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())
20944
21042
  }).optional()
20945
21043
  });
20946
21044
  var COMMAND_PROTECTION_COMMAND_KEYS = ["command", "cmd", "script", "query", "endpoint", "path", "url", "mutation"];
@@ -21161,122 +21259,122 @@ function shouldRefreshPullRequests(toolName, toolInput) {
21161
21259
  }
21162
21260
 
21163
21261
  // ../shared/src/routes/scout.ts
21164
- import { z as z31 } from "zod";
21262
+ import { z as z33 } from "zod";
21165
21263
  var SCOUT_LINEAR_ACTIONS = ["ask", "start"];
21166
- var scoutLinearSessionIntentRequestSchema = z31.object({
21167
- comment_id: z31.string().trim().min(1).describe("Id of the Linear comment the session will be created on."),
21168
- 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.")
21169
21267
  });
21170
- var scoutLinearStartRequestSchema = z31.object({
21171
- issue_id: z31.string().describe("Linear issue id from the envelope's `issue_id`."),
21172
- agent_session_id: z31.string().describe("Existing Linear agent session id from the envelope's `agent_session_id`."),
21173
- 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.")
21174
21272
  });
21175
- var scoutRouteLinearTicketRequestSchema = z31.object({
21176
- agent_session_id: z31.string().trim().min(1).describe("The ticket's `agent_session_id` from the envelope."),
21177
- environment_id: z31.string().trim().min(1).optional().describe("Start the ticket in this environment."),
21178
- 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.")
21179
21277
  }).refine((args) => !(args.environment_id && args.mothership_id), "Pass environment_id or mothership_id, not both.");
21180
- var slackChannelIdSchema = z31.string().describe("Slack channel id from the envelope's `channel_id`.");
21181
- var slackThreadTsSchema = z31.string().describe("Slack thread timestamp from the envelope's `thread_ts`.");
21182
- 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({
21183
21281
  channel_id: slackChannelIdSchema,
21184
21282
  thread_ts: slackThreadTsSchema,
21185
- message_ts: z31.string().describe("The envelope's `message_ts`. The server verifies this message and its author."),
21186
- 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`).")
21187
21285
  });
21188
- var scoutSlackSpawnRequestSchema = z31.object({
21286
+ var scoutSlackSpawnRequestSchema = z33.object({
21189
21287
  channel_id: slackChannelIdSchema,
21190
21288
  thread_ts: slackThreadTsSchema,
21191
- 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."),
21192
- user_id: z31.string().describe("Slack user id of that message's author (the envelope's `user_id`). The workspace is attributed to them."),
21193
- 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."),
21194
- 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."),
21195
- 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.`)
21196
21294
  });
21197
21295
  var scoutSlackSpawnInNewThreadRequestSchema = scoutSlackSpawnRequestSchema.extend({
21198
- title: z31.string().trim().min(1).max(500).describe("One or two sentences stating the task, posted as the new top-level message."),
21199
- 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."),
21200
- 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.")
21201
21299
  });
21202
- var scoutSlackRelayRequestSchema = z31.object({
21300
+ var scoutSlackRelayRequestSchema = z33.object({
21203
21301
  channel_id: slackChannelIdSchema,
21204
21302
  thread_ts: slackThreadTsSchema,
21205
- 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."),
21206
- 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`."),
21207
- 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."),
21208
- 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.`),
21209
- 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.")
21210
21308
  });
21211
- var scoutSlackSetThreadMutedRequestSchema = z31.object({
21309
+ var scoutSlackSetThreadMutedRequestSchema = z33.object({
21212
21310
  channel_id: slackChannelIdSchema,
21213
21311
  thread_ts: slackThreadTsSchema,
21214
- 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.")
21215
21313
  });
21216
21314
  var scoutSlackStopWorkspaceRequestSchema = scoutSlackMessageReferenceSchema.extend({
21217
- 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.")
21218
21316
  });
21219
- var scoutListWorkspacesRequestSchema = z31.object({
21317
+ var scoutListWorkspacesRequestSchema = z33.object({
21220
21318
  channel_id: slackChannelIdSchema,
21221
21319
  thread_ts: slackThreadTsSchema,
21222
- message_ts: z31.string().describe("The envelope's `message_ts`. The server verifies this message and its author."),
21223
- 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."),
21224
- 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.")
21225
21323
  });
21226
- var scoutSlackConfirmationSchema = z31.object({
21227
- confirmation_channel_id: z31.string().describe("`channel_id` from the envelope of the Slack message that asked for or accepted this."),
21228
- confirmation_thread_ts: z31.string().describe("`thread_ts` from that message's envelope."),
21229
- confirmation_message_ts: z31.string().describe("`message_ts` from that message's envelope."),
21230
- 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.")
21231
21329
  });
21232
21330
  var scoutAutomationToolInputSchema = automationToolInputSchema.extend(scoutSlackConfirmationSchema.shape);
21233
21331
  var scoutSaveChannelPresetToolInputSchema = scoutSlackConfirmationSchema.extend({
21234
- preset_id: z31.string().optional().describe(`Id of the preset to update, from \`${REPLICAS_MCP_TOOLS.listChannelSettings}\`. Omit to create a new preset.`),
21235
- name: z31.string().trim().min(1).max(SCOUT_PRESET_NAME_MAX_LENGTH).optional().describe("Preset name. Required when creating."),
21236
- description: z31.string().optional().describe("One-line summary of what the preset is for."),
21237
- icon: z31.enum(SCOUT_PRESET_ICONS).optional(),
21238
- 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.")
21239
21337
  });
21240
21338
  var scoutUpdateChannelSettingsToolInputSchema = scoutSlackConfirmationSchema.extend({
21241
- source: z31.enum(SCOUT_SOURCE_TYPES).optional().describe("Defaults to `slack`."),
21242
- external_id: z31.string().describe("Slack channel id or Linear team id."),
21243
- 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."),
21244
- preset_id: z31.string().nullable().optional().describe("Preset to assign; `null` removes the preset. Omit to keep it."),
21245
- 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."),
21246
- 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."),
21247
- 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.`)
21248
21346
  });
21249
21347
  var mothershipSlackChannelLevelToolInputSchema = scoutSlackConfirmationSchema.extend({
21250
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`.")
21251
21349
  });
21252
21350
  var scoutSetSlackConnectMutedToolInputSchema = scoutSlackConfirmationSchema.extend({
21253
- 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.")
21254
21352
  });
21255
21353
  var scoutSetSlackConnectDefaultsToolInputSchema = scoutSetSlackConnectMutedToolInputSchema.partial({ muted: true }).extend({
21256
- 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."),
21257
- 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."),
21258
- 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.")
21259
21357
  });
21260
21358
  var scoutSetOrganizationProactivityToolInputSchema = scoutSlackConfirmationSchema.extend({
21261
- 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.`)
21262
21360
  });
21263
21361
  var scoutDeleteChannelPresetToolInputSchema = scoutSlackConfirmationSchema.extend({
21264
- 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}\`.`)
21265
21363
  });
21266
21364
  var RESET_TO_DEFAULT = "default";
21267
- 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.`);
21268
21366
  var scoutSetSlackAgentDefaultsToolInputSchema = scoutSlackConfirmationSchema.extend({
21269
- agent_provider: resettable(z31.enum(AGENT), "Agent for Slack-triggered workspaces. Changing it without `model` resets the model to that agent's default."),
21270
- model: resettable(z31.string(), "Model id for that agent; the default is the agent's own."),
21271
- thinking_level: resettable(z31.enum(VALID_THINKING_LEVELS), "Thinking level."),
21272
- goal_mode: resettable(z31.boolean(), "Goal mode."),
21273
- 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.")
21274
21372
  });
21275
- var scoutClaimSettingsOfferToolInputSchema = z31.object({
21373
+ var scoutClaimSettingsOfferToolInputSchema = z33.object({
21276
21374
  channel_id: slackChannelIdSchema,
21277
- 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."),
21278
- 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."),
21279
- 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.")
21280
21378
  });
21281
21379
 
21282
21380
  // ../shared/src/routes/plugin-catalog.ts
@@ -21634,22 +21732,22 @@ var PLUGIN_CATALOG = [
21634
21732
  ].map((plugin) => ({ ...plugin, readOnlyScopes: READ_ONLY_SCOPES[plugin.id] }));
21635
21733
 
21636
21734
  // ../shared/src/routes/sentry.ts
21637
- import { z as z32 } from "zod";
21638
- var sentrySelfHostedConnectRequestSchema = z32.object({
21639
- baseUrl: z32.string().min(1),
21640
- token: z32.string().trim().min(1),
21641
- 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()
21642
21740
  });
21643
21741
 
21644
21742
  // ../shared/src/routes/user.ts
21645
21743
  var PROFILE_AVATAR_MAX_SIZE_BYTES = 5 * 1024 * 1024;
21646
21744
 
21647
21745
  // ../shared/src/routes/web-auth.ts
21648
- import { z as z33 } from "zod";
21649
- var webAuthRedeemResponseSchema = z33.object({
21650
- path: z33.string(),
21651
- organizationId: z33.string().nullable(),
21652
- 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()
21653
21751
  });
21654
21752
 
21655
21753
  // ../shared/src/routes/client-state.ts
@@ -21674,104 +21772,104 @@ var promptHistoryClientStateKey = orgUserClientStateKey(PROMPT_HISTORY_CLIENT_ST
21674
21772
  var workspaceSearchOpensClientStateKey = orgUserClientStateKey(WORKSPACE_SEARCH_OPENS_CLIENT_STATE_KEY_PREFIX);
21675
21773
 
21676
21774
  // ../shared/src/routes/workspace-events.ts
21677
- import { z as z35 } from "zod";
21775
+ import { z as z37 } from "zod";
21678
21776
 
21679
21777
  // ../shared/src/routes/presence.ts
21680
- import { z as z34 } from "zod";
21681
- var presenceStatusSchema = z34.enum(["online", "typing"]);
21682
- var presenceLocationSchema = z34.object({
21683
- 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()
21684
21782
  });
21685
- var presenceEntrySchema = z34.object({
21686
- userId: z34.string(),
21783
+ var presenceEntrySchema = z36.object({
21784
+ userId: z36.string(),
21687
21785
  status: presenceStatusSchema,
21688
21786
  location: presenceLocationSchema,
21689
- ts: z34.string()
21787
+ ts: z36.string()
21690
21788
  });
21691
- var updatePresenceRequestSchema = z34.object({
21789
+ var updatePresenceRequestSchema = z36.object({
21692
21790
  status: presenceStatusSchema,
21693
21791
  location: presenceLocationSchema.optional()
21694
21792
  });
21695
21793
 
21696
21794
  // ../shared/src/routes/workspace-events.ts
21697
- var workspaceTurnCompletionSchema = z35.object({
21698
- workspaceName: z35.string(),
21699
- completedAt: z35.string(),
21700
- processing: z35.boolean().optional(),
21701
- pullRequestFeedback: z35.boolean().optional(),
21702
- 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()
21703
21801
  });
21704
- var workspaceEventSchemaByType = z35.discriminatedUnion("type", [
21705
- z35.object({
21706
- type: z35.literal("workspace.changed"),
21707
- workspaceId: z35.string(),
21708
- accessChangedFor: z35.string().optional(),
21709
- accessChangedForOrg: z35.literal(true).optional(),
21710
- workspace: z35.object({ status: z35.enum(WORKSPACE_STATUSES), last_activity_at: z35.string().nullable() }).optional(),
21711
- 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(),
21712
21810
  completion: workspaceTurnCompletionSchema.optional(),
21713
- ts: z35.string()
21811
+ ts: z37.string()
21714
21812
  }),
21715
- z35.object({
21716
- type: z35.literal("workspace.chat.changed"),
21717
- workspaceId: z35.string(),
21718
- chatId: z35.string(),
21719
- 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()
21720
21818
  }),
21721
- z35.object({
21722
- type: z35.literal("workspace.chat.advanced"),
21723
- workspaceId: z35.string(),
21724
- chatId: z35.string(),
21725
- afterCursor: z35.string().optional(),
21726
- processing: z35.boolean(),
21727
- 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()
21728
21826
  }),
21729
- z35.object({
21730
- type: z35.literal("mobile-testing.changed"),
21731
- workspaceId: z35.string(),
21732
- ts: z35.string()
21827
+ z37.object({
21828
+ type: z37.literal("mobile-testing.changed"),
21829
+ workspaceId: z37.string(),
21830
+ ts: z37.string()
21733
21831
  }),
21734
- z35.object({
21735
- type: z35.literal("variable-request.changed"),
21736
- workspaceId: z35.string(),
21737
- ts: z35.string()
21832
+ z37.object({
21833
+ type: z37.literal("variable-request.changed"),
21834
+ workspaceId: z37.string(),
21835
+ ts: z37.string()
21738
21836
  }),
21739
- z35.object({
21740
- type: z35.literal("local-control-request.changed"),
21741
- workspaceId: z35.string(),
21742
- ts: z35.string()
21837
+ z37.object({
21838
+ type: z37.literal("local-control-request.changed"),
21839
+ workspaceId: z37.string(),
21840
+ ts: z37.string()
21743
21841
  }),
21744
- z35.object({
21745
- type: z35.literal("pull-request.changed"),
21746
- prUrl: z35.string(),
21747
- ts: z35.string()
21842
+ z37.object({
21843
+ type: z37.literal("pull-request.changed"),
21844
+ prUrl: z37.string(),
21845
+ ts: z37.string()
21748
21846
  }),
21749
- z35.object({
21750
- type: z35.literal("mothership.subagent.changed"),
21751
- workspaceId: z35.string(),
21752
- subagent: z35.object({ id: z35.string(), name: z35.string(), prUrl: z35.string().nullable() }),
21753
- 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()
21754
21852
  }),
21755
- z35.object({ type: z35.literal("mothership.board.changed"), workspaceId: z35.string(), ts: z35.string() }),
21756
- z35.object({ type: z35.literal("needs-you.changed"), workspaceId: z35.string().nullable(), userId: z35.string().optional(), ts: z35.string() }),
21757
- z35.object({
21758
- type: z35.literal("workspace.shared"),
21759
- workspaceId: z35.string(),
21760
- workspaceName: z35.string(),
21761
- sharedWithUserId: z35.string(),
21762
- sharedByName: z35.string(),
21763
- 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()
21764
21862
  })
21765
21863
  ]);
21766
- var workspaceChangedEventSchema = z35.union([
21864
+ var workspaceChangedEventSchema = z37.union([
21767
21865
  workspaceEventSchemaByType,
21768
- z35.object({ type: z35.literal("presence.changed"), userId: z35.string(), entry: presenceEntrySchema.nullable(), ts: z35.string() }),
21769
- 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() })
21770
21868
  ]);
21771
21869
 
21772
21870
  // ../shared/src/routes/review-messages.ts
21773
- import { z as z36 } from "zod";
21774
- var sendPullRequestReviewMessageRequestSchema = z36.object({
21871
+ import { z as z38 } from "zod";
21872
+ var sendPullRequestReviewMessageRequestSchema = z38.object({
21775
21873
  ...sendChatMessageRequestSchema.pick({
21776
21874
  message: true,
21777
21875
  messageId: true,
@@ -21784,8 +21882,8 @@ var sendPullRequestReviewMessageRequestSchema = z36.object({
21784
21882
  ultrafastMode: true
21785
21883
  }).shape,
21786
21884
  /** Starts a new chat instead of continuing the PR's review chat. The provider only applies to a new chat. */
21787
- newChat: z36.boolean().optional(),
21788
- provider: z36.enum(VALID_AGENT_PROVIDERS).optional()
21885
+ newChat: z38.boolean().optional(),
21886
+ provider: z38.enum(VALID_AGENT_PROVIDERS).optional()
21789
21887
  });
21790
21888
 
21791
21889
  // ../shared/src/audit-log.ts
@@ -22448,40 +22546,40 @@ function isSkillRegistryManifest(value) {
22448
22546
  }
22449
22547
 
22450
22548
  // ../shared/src/routes/variable-requests.ts
22451
- import { z as z37 } from "zod";
22549
+ import { z as z39 } from "zod";
22452
22550
  var VARIABLE_REQUEST_WAIT = { defaultMs: 10 * 6e4, maxMs: 30 * 6e4, pollMs: 3e3, waiterStaleMs: 15e3 };
22453
22551
  var VARIABLE_REQUEST_DESTINATIONS = ["environment", "workspace"];
22454
- var requestedVariableSchema = z37.object({
22455
- key: z37.string().regex(VARIABLE_KEY_RE, "must be a valid environment variable name").max(ENVIRONMENT_SETUP_LIMITS.variableKeyChars),
22456
- required: z37.boolean(),
22457
- 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()
22458
22556
  });
22459
- 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");
22460
- 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({
22461
22559
  variables: requestedVariablesSchema,
22462
- reason: z37.string().trim().max(500).nullish().transform((value) => value || null),
22463
- wait: z37.boolean().default(true)
22560
+ reason: z39.string().trim().max(500).nullish().transform((value) => value || null),
22561
+ wait: z39.boolean().default(true)
22464
22562
  });
22465
- var respondVariableRequestSchema = z37.discriminatedUnion("action", [
22466
- z37.object({
22467
- action: z37.literal("provide"),
22468
- 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),
22469
22567
  /** Defaults to the workspace's environment, so older clients keep saving there. */
22470
- environment_ids: z37.array(z37.string().uuid()).optional(),
22471
- overwrite: z37.boolean().optional(),
22472
- 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())
22473
22571
  }),
22474
- z37.object({ action: z37.literal("skip") })
22572
+ z39.object({ action: z39.literal("skip") })
22475
22573
  ]);
22476
22574
 
22477
22575
  // ../shared/src/routes/local-control-requests.ts
22478
- import { z as z38 } from "zod";
22479
- var createLocalControlRequestSchema = z38.object({
22480
- reason: z38.string().trim().max(500).optional().transform((value) => value || null),
22481
- 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)
22482
22580
  });
22483
- var respondLocalControlRequestSchema = z38.object({ action: z38.enum(["allow", "dismiss"]) });
22484
- 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() });
22485
22583
 
22486
22584
  export {
22487
22585
  ENGINE_SEND_MESSAGE_FAILED_ERROR,