replicas-engine 0.1.1056 → 0.1.1058

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.
@@ -2572,7 +2572,7 @@ function planItemsFromMessage(message2) {
2572
2572
  function getDisplayMessageStatus(message2) {
2573
2573
  if (message2.type === "error" || message2.type === "quota_status") return "failed";
2574
2574
  if (message2.type === "auth_fallback") return message2.status === "switched" ? "completed" : "failed";
2575
- if (message2.type === "interruption") return "completed";
2575
+ if (message2.type === "interruption" || message2.type === "multitask_event") return "completed";
2576
2576
  if (message2.type === "background_task") return message2.status === "stopped" ? "completed" : message2.status;
2577
2577
  if (message2.type === "command" || message2.type === "patch") {
2578
2578
  return message2.status ?? (message2.exitCode === void 0 ? "in_progress" : message2.exitCode === 0 ? "completed" : "failed");
@@ -2609,6 +2609,7 @@ ${operation.diff}` : ""}`).join("\n\n");
2609
2609
  return { kind: "error", title: "Credential fallback", summary: headline, content: [`The workspace ${outcomeClause}.`, message2.detail].filter(Boolean).join("\n\n") };
2610
2610
  }
2611
2611
  if (message2.type === "interruption") return { kind: "error", title: "Agent stopped", summary: "", content: "" };
2612
+ if (message2.type === "multitask_event") return { kind: "task", title: "Subagent update", summary: message2.events.map((event) => `${event.agentName}: ${event.summary}`).join(" \xB7 "), content: "" };
2612
2613
  return { kind: "error", title: "Agent error", summary: "", content: message2.message };
2613
2614
  }
2614
2615
  function lineCountFromOutput(output) {
@@ -2868,58 +2869,9 @@ function subagentChatId(message2) {
2868
2869
  return chatIdFrom(message2.output);
2869
2870
  }
2870
2871
 
2871
- // ../shared/src/learned-skills.ts
2872
- import { z as z10 } from "zod";
2873
-
2874
- // ../shared/src/frontmatter.ts
2875
- import { parse as parseYaml } from "yaml";
2876
- function parseFrontmatter(content) {
2877
- const match = content.match(/^---\r?\n([\s\S]*?)\r?\n---(?:\r?\n|$)/);
2878
- if (!match) return {};
2879
- try {
2880
- const parsed = parseYaml(match[1]);
2881
- if (typeof parsed !== "object" || parsed === null) return {};
2882
- return {
2883
- ..."name" in parsed && typeof parsed.name === "string" ? { name: parsed.name.trim() } : {},
2884
- ..."description" in parsed && typeof parsed.description === "string" ? { description: parsed.description.trim() } : {}
2885
- };
2886
- } catch {
2887
- return {};
2888
- }
2889
- }
2890
-
2891
- // ../shared/src/learned-skills.ts
2892
- var LEARNED_SKILLS_ROOT = `${SANDBOX_PATHS.REPLICAS_DIR}/learned-skills`;
2893
- var LEARNED_SKILLS_MANIFEST_PATH = `${LEARNED_SKILLS_ROOT}/manifest.json`;
2894
- var LEARNED_SKILL_DIR_PREFIX = "replicas-learned__";
2895
- var learnedSkillsManifestSchema = z10.object({
2896
- skills: z10.array(z10.object({ name: z10.string(), sha256: z10.string() }))
2897
- });
2898
- var dreamVerdictChecksSchema = z10.object({
2899
- repeatable: z10.boolean(),
2900
- realInstruction: z10.boolean(),
2901
- noContradiction: z10.boolean(),
2902
- formatExact: z10.boolean(),
2903
- humanOnly: z10.boolean(),
2904
- actionable: z10.boolean(),
2905
- durable: z10.boolean()
2906
- });
2907
- var DREAM_VERDICT_CHECKS = dreamVerdictChecksSchema.keyof().options;
2908
- var dreamVerdictSchema = dreamVerdictChecksSchema.extend({ approve: z10.boolean(), reason: z10.string() });
2909
- 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."`;
2910
-
2911
- // ../shared/src/replicas-mcp.ts
2872
+ // ../shared/src/multitask-events.ts
2912
2873
  import { z as z15 } from "zod";
2913
2874
 
2914
- // ../shared/src/automations/trigger-schemas.ts
2915
- import { z as z11 } from "zod";
2916
-
2917
- // ../shared/src/uuid.ts
2918
- function createUuidFromHex(value) {
2919
- 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)}`;
2920
- }
2921
- var UUID_RE = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;
2922
-
2923
2875
  // ../shared/src/urls.ts
2924
2876
  var DASHBOARD_PATH = "/dashboard";
2925
2877
  var WEB_APP_PATHS = {
@@ -3017,6 +2969,18 @@ function buildCodeHostPrUrl(repoUrl, provider2, prNumber) {
3017
2969
  return `${normalizedRepoUrl}/pull/${prNumber}`;
3018
2970
  }
3019
2971
 
2972
+ // ../shared/src/replicas-mcp.ts
2973
+ import { z as z14 } from "zod";
2974
+
2975
+ // ../shared/src/automations/trigger-schemas.ts
2976
+ import { z as z10 } from "zod";
2977
+
2978
+ // ../shared/src/uuid.ts
2979
+ function createUuidFromHex(value) {
2980
+ 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)}`;
2981
+ }
2982
+ var UUID_RE = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;
2983
+
3020
2984
  // ../shared/src/automations/github/index.ts
3021
2985
  var REVIEW_REQUESTED_EVENT = "pull_request.review_requested";
3022
2986
 
@@ -3026,47 +2990,47 @@ function getReviewerLoginsError(event, logins) {
3026
2990
  if (isReviewRequested === !!logins?.some((login) => login.trim().replace(/^@+/, ""))) return null;
3027
2991
  return isReviewRequested ? "The PR review requested trigger needs at least one GitHub username" : "Requested reviewers only apply to the PR review requested trigger";
3028
2992
  }
3029
- var repositoryTriggerConfigSchema = z11.object({
3030
- event: z11.string(),
3031
- repository_ids: z11.array(z11.string().regex(UUID_RE, "must be a repository id")).optional(),
3032
- group_pr_events: z11.boolean().optional(),
3033
- excluded_actors: z11.array(z11.string()).optional(),
3034
- reviewer_logins: z11.array(z11.string()).optional()
2993
+ var repositoryTriggerConfigSchema = z10.object({
2994
+ event: z10.string(),
2995
+ repository_ids: z10.array(z10.string().regex(UUID_RE, "must be a repository id")).optional(),
2996
+ group_pr_events: z10.boolean().optional(),
2997
+ excluded_actors: z10.array(z10.string()).optional(),
2998
+ reviewer_logins: z10.array(z10.string()).optional()
3035
2999
  });
3036
- var cronTriggerSchema = z11.object({ type: z11.literal("cron"), config: z11.object({ schedule: z11.string(), timezone: z11.string().optional() }) });
3037
- var githubTriggerSchema = z11.object({
3038
- type: z11.literal("github"),
3000
+ var cronTriggerSchema = z10.object({ type: z10.literal("cron"), config: z10.object({ schedule: z10.string(), timezone: z10.string().optional() }) });
3001
+ var githubTriggerSchema = z10.object({
3002
+ type: z10.literal("github"),
3039
3003
  config: repositoryTriggerConfigSchema.superRefine((config, ctx) => {
3040
3004
  const message2 = getReviewerLoginsError(config.event, config.reviewer_logins);
3041
3005
  if (message2) ctx.addIssue({ code: "custom", message: message2, path: ["reviewer_logins"] });
3042
3006
  })
3043
3007
  });
3044
- var gitlabTriggerSchema = z11.object({ type: z11.literal("gitlab"), config: repositoryTriggerConfigSchema });
3045
- var automationTriggerSchema = z11.discriminatedUnion("type", [
3008
+ var gitlabTriggerSchema = z10.object({ type: z10.literal("gitlab"), config: repositoryTriggerConfigSchema });
3009
+ var automationTriggerSchema = z10.discriminatedUnion("type", [
3046
3010
  cronTriggerSchema,
3047
3011
  githubTriggerSchema,
3048
3012
  gitlabTriggerSchema,
3049
- 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() }) }),
3050
- z11.object({ type: z11.literal("sentry"), config: z11.object({ event: z11.string(), project_slugs: z11.array(z11.string()).optional(), min_level: z11.string().optional() }) }),
3051
- z11.object({ type: z11.literal("custom"), config: z11.object({}) })
3013
+ z10.object({ type: z10.literal("slack"), config: z10.object({ event: z10.string(), channel_ids: z10.array(z10.string()).optional(), group_thread_replies: z10.boolean().optional() }) }),
3014
+ z10.object({ type: z10.literal("sentry"), config: z10.object({ event: z10.string(), project_slugs: z10.array(z10.string()).optional(), min_level: z10.string().optional() }) }),
3015
+ z10.object({ type: z10.literal("custom"), config: z10.object({}) })
3052
3016
  ]);
3053
3017
 
3054
3018
  // ../shared/src/routes/environment.ts
3055
- import { z as z12 } from "zod";
3019
+ import { z as z11 } from "zod";
3056
3020
  var ENVIRONMENT_MCP_TRANSPORTS = ["stdio", "http", "sse"];
3057
- var stringMap = z12.record(z12.string(), z12.string());
3058
- var createEnvironmentMcpRequestSchema = z12.object({
3059
- name: z12.string(),
3060
- transport: z12.enum(ENVIRONMENT_MCP_TRANSPORTS),
3061
- config: z12.union([
3062
- z12.object({ command: z12.string().min(1), args: z12.array(z12.string()).optional(), env: stringMap.optional() }),
3063
- z12.object({ url: z12.url(), headers: stringMap.optional(), auth: mcpAuthSchema.optional() })
3021
+ var stringMap = z11.record(z11.string(), z11.string());
3022
+ var createEnvironmentMcpRequestSchema = z11.object({
3023
+ name: z11.string(),
3024
+ transport: z11.enum(ENVIRONMENT_MCP_TRANSPORTS),
3025
+ config: z11.union([
3026
+ z11.object({ command: z11.string().min(1), args: z11.array(z11.string()).optional(), env: stringMap.optional() }),
3027
+ z11.object({ url: z11.url(), headers: stringMap.optional(), auth: mcpAuthSchema.optional() })
3064
3028
  ]).describe("stdio: `{ command, args, env }`. http/sse: `{ url, headers }`.")
3065
3029
  });
3066
3030
  var updateEnvironmentMcpRequestSchema = createEnvironmentMcpRequestSchema.partial();
3067
3031
 
3068
3032
  // ../shared/src/routes/workspaces.ts
3069
- import { z as z14 } from "zod";
3033
+ import { z as z13 } from "zod";
3070
3034
 
3071
3035
  // ../shared/src/default-skills/replicas-agent/abilities/computer.ts
3072
3036
  var SECTION = `### Computer use (Linux desktop control)
@@ -3338,7 +3302,7 @@ var DOCKER_ABILITY = {
3338
3302
  };
3339
3303
 
3340
3304
  // ../shared/src/routes/environment-setups.ts
3341
- import { z as z13 } from "zod";
3305
+ import { z as z12 } from "zod";
3342
3306
  var ENVIRONMENT_SETUP_STEPS = [
3343
3307
  { key: "understand", label: "Understand the codebase" },
3344
3308
  { key: "install", label: "Install dependencies and run the app" },
@@ -3372,17 +3336,17 @@ var ENVIRONMENT_SETUP_LIMITS = {
3372
3336
  };
3373
3337
  var ENVIRONMENT_SETUP_VARIABLE_WAIT = { defaultMs: 5 * 6e4, maxMs: 15 * 6e4, pollMs: 5e3 };
3374
3338
  var VARIABLE_KEY_RE = /^[A-Za-z_][A-Za-z0-9_]*$/;
3375
- var text = (max) => max === void 0 ? z13.string().trim() : z13.string().trim().max(max);
3339
+ var text = (max) => max === void 0 ? z12.string().trim() : z12.string().trim().max(max);
3376
3340
  var requiredText = (max) => text(max).min(1, "must not be empty");
3377
3341
  var optionalText = (max) => text(max).nullish().transform((value) => value || null);
3378
3342
  var clearableText = (max) => text(max).nullish().transform((value) => value === void 0 ? void 0 : value || null);
3379
- var list = (item, max) => max === void 0 ? z13.array(item) : z13.array(item).max(max);
3343
+ var list = (item, max) => max === void 0 ? z12.array(item) : z12.array(item).max(max);
3380
3344
  var ENVIRONMENT_SETUP_AUTHORED_TRIGGER_TYPES = ["cron", "github", "gitlab"];
3381
3345
  function isEnvironmentSetupAuthoredTriggerType(type) {
3382
3346
  return ENVIRONMENT_SETUP_AUTHORED_TRIGGER_TYPES.some((authored) => authored === type);
3383
3347
  }
3384
- var proposalTriggerSchema = z13.discriminatedUnion("type", [cronTriggerSchema, githubTriggerSchema, gitlabTriggerSchema]);
3385
- var existingTriggerSchema = z13.custom(
3348
+ var proposalTriggerSchema = z12.discriminatedUnion("type", [cronTriggerSchema, githubTriggerSchema, gitlabTriggerSchema]);
3349
+ var existingTriggerSchema = z12.custom(
3386
3350
  (value) => isRecord(value) && typeof value.type === "string" && isRecord(value.config),
3387
3351
  "must be an automation trigger"
3388
3352
  );
@@ -3390,17 +3354,17 @@ var carriedTriggerSchema = existingTriggerSchema.refine(
3390
3354
  (trigger) => !isEnvironmentSetupAuthoredTriggerType(trigger.type)
3391
3355
  );
3392
3356
  function automationSchema(limits) {
3393
- const authored = z13.object({
3357
+ const authored = z12.object({
3394
3358
  name: text(limits.nameChars),
3395
3359
  description: text(limits.descriptionChars),
3396
3360
  prompt: text(limits.automationPromptChars),
3397
3361
  triggers: list(proposalTriggerSchema, limits.automationTriggers)
3398
3362
  });
3399
- const updated = authored.extend({ triggers: list(z13.union([proposalTriggerSchema, carriedTriggerSchema]), limits.automationTriggers) });
3400
- return z13.object({
3363
+ const updated = authored.extend({ triggers: list(z12.union([proposalTriggerSchema, carriedTriggerSchema]), limits.automationTriggers) });
3364
+ return z12.object({
3401
3365
  key: requiredText(limits.automationKeyChars),
3402
- action: z13.enum(ENVIRONMENT_SETUP_AUTOMATION_ACTIONS).default("create"),
3403
- automation_id: z13.string().regex(UUID_RE, "must be an automation id").nullable().default(null),
3366
+ action: z12.enum(ENVIRONMENT_SETUP_AUTOMATION_ACTIONS).default("create"),
3367
+ automation_id: z12.string().regex(UUID_RE, "must be an automation id").nullable().default(null),
3404
3368
  name: text().default(""),
3405
3369
  description: optionalText().transform((value) => value ?? ""),
3406
3370
  prompt: text().default(""),
@@ -3423,7 +3387,7 @@ function automationSchema(limits) {
3423
3387
  const content = (automation.action === "update" ? updated : authored).safeParse(automation);
3424
3388
  if (content.success) return { ...automation, ...content.data };
3425
3389
  for (const issue of content.error.issues) ctx.addIssue({ ...issue, code: "custom" });
3426
- return z13.NEVER;
3390
+ return z12.NEVER;
3427
3391
  });
3428
3392
  }
3429
3393
  function automationListSchema(limits) {
@@ -3441,7 +3405,7 @@ function automationListSchema(limits) {
3441
3405
  });
3442
3406
  }
3443
3407
  function environmentSchema(limits) {
3444
- return z13.object({
3408
+ return z12.object({
3445
3409
  name: optionalText(limits.nameChars).transform((value) => value ?? void 0),
3446
3410
  description: clearableText(limits.descriptionChars),
3447
3411
  system_prompt: clearableText(limits.systemPromptChars),
@@ -3450,26 +3414,26 @@ function environmentSchema(limits) {
3450
3414
  });
3451
3415
  }
3452
3416
  function variableSchema(limits, requiredDefault) {
3453
- return z13.object({
3454
- key: z13.string().regex(VARIABLE_KEY_RE, "must be a valid environment variable name").max(limits.variableKeyChars ?? Number.POSITIVE_INFINITY),
3417
+ return z12.object({
3418
+ key: z12.string().regex(VARIABLE_KEY_RE, "must be a valid environment variable name").max(limits.variableKeyChars ?? Number.POSITIVE_INFINITY),
3455
3419
  description: optionalText(limits.variableDescriptionChars).transform((value) => value ?? ""),
3456
- required: z13.boolean().default(requiredDefault)
3420
+ required: z12.boolean().default(requiredDefault)
3457
3421
  });
3458
3422
  }
3459
3423
  function proposalSchema(limits) {
3460
- return z13.object({
3424
+ return z12.object({
3461
3425
  summary: requiredText(limits.summaryChars),
3462
3426
  stack: list(text(), limits.stackItems).default([]).transform((items) => items.filter(Boolean)),
3463
3427
  environment: environmentSchema(limits),
3464
3428
  variables: list(variableSchema(limits, false), limits.variables).default([]),
3465
3429
  automations: automationListSchema(limits),
3466
- verification: list(z13.object({
3430
+ verification: list(z12.object({
3467
3431
  label: requiredText(limits.nameChars),
3468
- status: z13.enum(ENVIRONMENT_SETUP_VERIFICATION_STATUSES),
3432
+ status: z12.enum(ENVIRONMENT_SETUP_VERIFICATION_STATUSES),
3469
3433
  detail: optionalText(limits.verificationDetailChars).transform((value) => value ?? void 0)
3470
3434
  }), limits.verificationItems).default([]),
3471
- media: list(z13.object({
3472
- media_id: z13.string().regex(UUID_RE, "must be a media id"),
3435
+ media: list(z12.object({
3436
+ media_id: z12.string().regex(UUID_RE, "must be a media id"),
3473
3437
  title: requiredText(limits.nameChars)
3474
3438
  }), limits.mediaItems).default([])
3475
3439
  });
@@ -3477,35 +3441,35 @@ function proposalSchema(limits) {
3477
3441
  var environmentSetupProposalSchema = proposalSchema({});
3478
3442
  var environmentSetupProposalSubmissionSchema = proposalSchema(ENVIRONMENT_SETUP_LIMITS);
3479
3443
  var environmentSetupVariableRequestSchema = variableSchema({}, false).extend({
3480
- status: z13.enum(["pending", "provided", "skipped"]),
3481
- requested_at: z13.string(),
3482
- resolved_at: z13.string().nullable().default(null)
3444
+ status: z12.enum(["pending", "provided", "skipped"]),
3445
+ requested_at: z12.string(),
3446
+ resolved_at: z12.string().nullable().default(null)
3483
3447
  });
3484
- var environmentSetupRunStateSchema = z13.object({
3485
- status: z13.enum(ENVIRONMENT_SETUP_RUN_STATUSES),
3486
- steps: z13.partialRecord(z13.enum(ENVIRONMENT_SETUP_STEPS.map((step) => step.key)), z13.enum(ENVIRONMENT_SETUP_STEP_STATUSES)).default({}),
3448
+ var environmentSetupRunStateSchema = z12.object({
3449
+ status: z12.enum(ENVIRONMENT_SETUP_RUN_STATUSES),
3450
+ steps: z12.partialRecord(z12.enum(ENVIRONMENT_SETUP_STEPS.map((step) => step.key)), z12.enum(ENVIRONMENT_SETUP_STEP_STATUSES)).default({}),
3487
3451
  proposal: environmentSetupProposalSchema.nullable().default(null),
3488
- applied: z13.object({
3489
- applied_at: z13.string(),
3490
- automation_ids: z13.array(z13.string())
3452
+ applied: z12.object({
3453
+ applied_at: z12.string(),
3454
+ automation_ids: z12.array(z12.string())
3491
3455
  }).nullable().default(null),
3492
- variable_requests: z13.array(environmentSetupVariableRequestSchema).default([])
3456
+ variable_requests: z12.array(environmentSetupVariableRequestSchema).default([])
3493
3457
  });
3494
- var applyEnvironmentSetupRequestSchema = z13.object({
3458
+ var applyEnvironmentSetupRequestSchema = z12.object({
3495
3459
  environment: environmentSchema(ENVIRONMENT_SETUP_LIMITS).extend({ name: requiredText(ENVIRONMENT_SETUP_LIMITS.nameChars) }),
3496
- variables: list(z13.object({ key: z13.string().regex(VARIABLE_KEY_RE), value: z13.string() }), ENVIRONMENT_SETUP_LIMITS.variables).default([]).refine((variables) => new Set(variables.map((variable) => variable.key)).size === variables.length, "must have unique keys").transform((variables) => variables.filter((variable) => variable.value.length > 0)),
3460
+ 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)),
3497
3461
  automations: automationListSchema(ENVIRONMENT_SETUP_LIMITS)
3498
3462
  });
3499
- var requestEnvironmentSetupVariablesSchema = z13.object({
3463
+ var requestEnvironmentSetupVariablesSchema = z12.object({
3500
3464
  variables: list(variableSchema(ENVIRONMENT_SETUP_LIMITS, true), ENVIRONMENT_SETUP_LIMITS.variables).min(1, "must not be empty")
3501
3465
  }).superRefine(({ variables }, ctx) => {
3502
3466
  if (new Set(variables.map((variable) => variable.key)).size !== variables.length) {
3503
3467
  ctx.addIssue({ code: "custom", path: ["variables"], message: "must have unique keys" });
3504
3468
  }
3505
3469
  });
3506
- var respondEnvironmentSetupVariablesSchema = z13.object({
3507
- values: z13.record(z13.string().regex(VARIABLE_KEY_RE), z13.string()).default({}),
3508
- skipped: z13.array(z13.string().regex(VARIABLE_KEY_RE)).default([])
3470
+ var respondEnvironmentSetupVariablesSchema = z12.object({
3471
+ values: z12.record(z12.string().regex(VARIABLE_KEY_RE), z12.string()).default({}),
3472
+ skipped: z12.array(z12.string().regex(VARIABLE_KEY_RE)).default([])
3509
3473
  });
3510
3474
 
3511
3475
  // ../shared/src/default-skills/replicas-agent/abilities/environment-setup.ts
@@ -5213,16 +5177,16 @@ var DEFAULT_WORKSPACE_FILTERS = {
5213
5177
  activity: "any"
5214
5178
  };
5215
5179
  var ONE_DAY_MS = 24 * 60 * 60 * 1e3;
5216
- var workspaceExecRequestSchema = z14.object({
5217
- command: z14.string().regex(/\S/, "command is required"),
5218
- timeout_seconds: z14.number().int().min(1).max(50).optional().describe("Default: 30")
5180
+ var workspaceExecRequestSchema = z13.object({
5181
+ command: z13.string().regex(/\S/, "command is required"),
5182
+ timeout_seconds: z13.number().int().min(1).max(50).optional().describe("Default: 30")
5219
5183
  });
5220
- var terminalRtcCandidateSchema = z14.object({ type: z14.literal("rtc-candidate"), candidate: z14.string(), mid: z14.string() });
5221
- var terminalSocketServerMessageSchema = z14.discriminatedUnion("type", [
5222
- z14.object({ type: z14.literal("output"), data: z14.string() }),
5223
- z14.object({ type: z14.literal("rtc-answer"), sdp: z14.string() }),
5184
+ var terminalRtcCandidateSchema = z13.object({ type: z13.literal("rtc-candidate"), candidate: z13.string(), mid: z13.string() });
5185
+ var terminalSocketServerMessageSchema = z13.discriminatedUnion("type", [
5186
+ z13.object({ type: z13.literal("output"), data: z13.string() }),
5187
+ z13.object({ type: z13.literal("rtc-answer"), sdp: z13.string() }),
5224
5188
  terminalRtcCandidateSchema,
5225
- z14.object({ type: z14.literal("rtc-switch") })
5189
+ z13.object({ type: z13.literal("rtc-switch") })
5226
5190
  ]);
5227
5191
  var TERMINAL_RTC_ICE_SERVER = "stun:stun.l.google.com:19302";
5228
5192
 
@@ -5244,46 +5208,207 @@ var REPLICAS_MCP_TOOLS = {
5244
5208
  messageSubagent: "message_subagent",
5245
5209
  listSubagents: "list_subagents",
5246
5210
  readSubagent: "read_subagent",
5247
- archiveSubagent: "archive_subagent"
5211
+ archiveSubagent: "archive_subagent",
5212
+ waitForSubagents: "wait_for_subagents"
5248
5213
  };
5249
- var automationToolInputSchema = z15.object({
5250
- name: z15.string().describe("Short automation name."),
5251
- prompt: z15.string().describe("Prompt each automation run starts with."),
5252
- environment_id: z15.string().describe(`Environment id from \`${REPLICAS_MCP_TOOLS.listEnvironments}\`.`),
5253
- triggers: z15.array(automationTriggerSchema).min(1).describe(
5214
+ var automationToolInputSchema = z14.object({
5215
+ name: z14.string().describe("Short automation name."),
5216
+ prompt: z14.string().describe("Prompt each automation run starts with."),
5217
+ environment_id: z14.string().describe(`Environment id from \`${REPLICAS_MCP_TOOLS.listEnvironments}\`.`),
5218
+ triggers: z14.array(automationTriggerSchema).min(1).describe(
5254
5219
  '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>"] } }`.'
5255
5220
  ),
5256
- description: z15.string().optional().describe("One-line summary shown in the dashboard."),
5257
- plan_mode: z15.boolean().optional(),
5258
- goal_mode: z15.boolean().optional(),
5259
- fast_mode: z15.boolean().optional()
5221
+ description: z14.string().optional().describe("One-line summary shown in the dashboard."),
5222
+ plan_mode: z14.boolean().optional(),
5223
+ goal_mode: z14.boolean().optional(),
5224
+ fast_mode: z14.boolean().optional()
5260
5225
  });
5261
5226
  var automationCreateToolInputSchema = automationToolInputSchema.extend({
5262
- scope: z15.enum(["org", "user"]).optional().describe("`org` (default) or `user` for a personal automation, which needs a personal API key.")
5227
+ scope: z14.enum(["org", "user"]).optional().describe("`org` (default) or `user` for a personal automation, which needs a personal API key.")
5263
5228
  });
5264
5229
  var automationUpdateToolInputSchema = automationToolInputSchema.partial().extend({
5265
- automation_id: z15.string().describe("Automation ID"),
5266
- enabled: z15.boolean().optional(),
5267
- agent_provider: z15.enum(AGENT).nullable().optional(),
5268
- model: z15.string().nullable().optional(),
5269
- thinking_level: z15.enum(VALID_THINKING_LEVELS).nullable().optional(),
5270
- workspace_lifecycle_policy: z15.enum(VALID_LIFECYCLE_POLICIES).optional(),
5271
- workspace_size: z15.enum(WORKSPACE_SIZES).optional()
5230
+ automation_id: z14.string().describe("Automation ID"),
5231
+ enabled: z14.boolean().optional(),
5232
+ agent_provider: z14.enum(AGENT).nullable().optional(),
5233
+ model: z14.string().nullable().optional(),
5234
+ thinking_level: z14.enum(VALID_THINKING_LEVELS).nullable().optional(),
5235
+ workspace_lifecycle_policy: z14.enum(VALID_LIFECYCLE_POLICIES).optional(),
5236
+ workspace_size: z14.enum(WORKSPACE_SIZES).optional()
5272
5237
  });
5273
- var chatPath = { id: z15.string().describe("Workspace ID"), chat_id: z15.string().describe("Chat ID") };
5238
+ var chatPath = { id: z14.string().describe("Workspace ID"), chat_id: z14.string().describe("Chat ID") };
5274
5239
  var { provider, model, thinkingLevel, title, message } = forkChatRequestSchema.shape;
5275
- var createChatToolInputSchema = z15.object({ id: chatPath.id, provider, title: createChatRequestSchema.shape.title });
5276
- var forkChatToolInputSchema = z15.object({ ...chatPath, provider, model, thinking_level: thinkingLevel, title, message });
5277
- var renameChatToolInputSchema = z15.object({ ...chatPath, display_name: updateChatDisplayNameRequestSchema.shape.displayName });
5278
- var runCommandToolInputSchema = z15.object({ id: chatPath.id, ...workspaceExecRequestSchema.shape });
5279
- var environmentMcpPath = { environment_id: z15.string().describe("Environment ID") };
5280
- var createEnvironmentMcpToolInputSchema = z15.object({ ...environmentMcpPath, ...createEnvironmentMcpRequestSchema.shape });
5281
- var updateEnvironmentMcpToolInputSchema = z15.object({
5240
+ var createChatToolInputSchema = z14.object({ id: chatPath.id, provider, title: createChatRequestSchema.shape.title });
5241
+ var forkChatToolInputSchema = z14.object({ ...chatPath, provider, model, thinking_level: thinkingLevel, title, message });
5242
+ var renameChatToolInputSchema = z14.object({ ...chatPath, display_name: updateChatDisplayNameRequestSchema.shape.displayName });
5243
+ var runCommandToolInputSchema = z14.object({ id: chatPath.id, ...workspaceExecRequestSchema.shape });
5244
+ var environmentMcpPath = { environment_id: z14.string().describe("Environment ID") };
5245
+ var createEnvironmentMcpToolInputSchema = z14.object({ ...environmentMcpPath, ...createEnvironmentMcpRequestSchema.shape });
5246
+ var updateEnvironmentMcpToolInputSchema = z14.object({
5282
5247
  ...environmentMcpPath,
5283
- mcp_id: z15.string().describe("MCP ID"),
5248
+ mcp_id: z14.string().describe("MCP ID"),
5284
5249
  ...updateEnvironmentMcpRequestSchema.shape
5285
5250
  });
5286
5251
 
5252
+ // ../shared/src/routes/preferences.ts
5253
+ var EMPTY_AGENT_DEFAULT_SETTINGS = {
5254
+ agent_provider: null,
5255
+ model: null,
5256
+ thinking_level: null,
5257
+ goal_mode: null,
5258
+ fast_mode: null
5259
+ };
5260
+ var DEFAULT_SUBAGENT_MCP_PROVIDERS = [...VALID_AGENT_PROVIDERS];
5261
+ var DEFAULT_USER_PREFERENCES = {
5262
+ default_agent: "codex",
5263
+ default_model: null,
5264
+ claude_models: null,
5265
+ codex_models: null,
5266
+ cursor_models: null,
5267
+ claude_hidden_models: null,
5268
+ codex_hidden_models: null,
5269
+ cursor_hidden_models: null,
5270
+ openrouter_models: null,
5271
+ opencode_go_models: null,
5272
+ close_workspace_on_pr_close: false,
5273
+ close_workspace_on_pr_merge: false,
5274
+ default_environment_id: null,
5275
+ respond_to_ci_workflows: true,
5276
+ respond_to_ci_checks: true,
5277
+ respond_to_human_pr_reviews: false,
5278
+ pr_user_attribution: false,
5279
+ auto_draft_prs: false,
5280
+ open_prs_in_graphite: false,
5281
+ open_links_in_desktop_app: false,
5282
+ memory_enabled: null,
5283
+ subagent_mcp_enabled: null,
5284
+ default_fast_mode: false,
5285
+ agent_defaults: { ...EMPTY_AGENT_DEFAULT_SETTINGS },
5286
+ fallback_chains: null
5287
+ };
5288
+ function defaultReplicasAgentAbilities() {
5289
+ const abilities = {};
5290
+ for (const key of REPLICAS_AGENT_ABILITIES) {
5291
+ abilities[key] = true;
5292
+ }
5293
+ if (hasAllReplicasAgentAbilities(abilities)) return abilities;
5294
+ throw new Error("Default Replicas agent ability flags are incomplete");
5295
+ }
5296
+ function hasAllReplicasAgentAbilities(abilities) {
5297
+ return REPLICAS_AGENT_ABILITIES.every((key) => typeof abilities[key] === "boolean");
5298
+ }
5299
+ var DEFAULT_DEFAULT_SKILLS = {
5300
+ replicas_agent: {
5301
+ enabled: true,
5302
+ abilities: defaultReplicasAgentAbilities()
5303
+ }
5304
+ };
5305
+
5306
+ // ../shared/src/prompts.ts
5307
+ var REPLICAS_INSTRUCTIONS_TAG = "replicas_instructions";
5308
+ var MULTITASK_INSTRUCTIONS_TAG = "multitask_instructions";
5309
+ function wrapInTag(content, tag) {
5310
+ return `<${tag}>
5311
+ ${content}
5312
+ </${tag}>`;
5313
+ }
5314
+ function removeTag(text2, tag) {
5315
+ const regex = new RegExp(`<${tag}>[\\s\\S]*?</${tag}>`, "g");
5316
+ return text2.replace(regex, "").trim();
5317
+ }
5318
+ function removeReplicasInstructions(text2) {
5319
+ return removeTag(text2, REPLICAS_INSTRUCTIONS_TAG);
5320
+ }
5321
+ var MULTITASK_INSTRUCTIONS_BLOCK = new RegExp(`\\s*<${MULTITASK_INSTRUCTIONS_TAG}>\\n([\\s\\S]*?)\\n</${MULTITASK_INSTRUCTIONS_TAG}>`);
5322
+ function splitMultitaskInstructions(customInstructions) {
5323
+ const match = customInstructions?.match(MULTITASK_INSTRUCTIONS_BLOCK);
5324
+ return {
5325
+ customInstructions: match ? customInstructions?.replace(match[0], "").trim() || void 0 : customInstructions,
5326
+ multitaskInstructions: match?.[1]
5327
+ };
5328
+ }
5329
+
5330
+ // ../shared/src/multitask-events.ts
5331
+ var MULTITASK_EVENT_KINDS = ["finished", "ready", "needs_attention", "merged", "closed", "archived"];
5332
+ var MULTITASK_EVENT_TYPE = "multitask-event";
5333
+ var multitaskEventSchema = z15.object({
5334
+ id: z15.string(),
5335
+ at: z15.string(),
5336
+ kind: z15.enum(MULTITASK_EVENT_KINDS),
5337
+ agentId: z15.string(),
5338
+ agentName: z15.string(),
5339
+ summary: z15.string(),
5340
+ detail: z15.string().optional(),
5341
+ // Already shown as a row when it happened, so the delivered message does not show it again.
5342
+ noticed: z15.boolean().optional()
5343
+ });
5344
+ var TAG = "multitask_event";
5345
+ var BLOCK = new RegExp(`<${TAG}((?:\\s+\\w+="[^"]*")*)>\\n?([\\s\\S]*?)\\n?</${TAG}>`, "g");
5346
+ var ATTRIBUTE = /(\w+)="([^"]*)"/g;
5347
+ var unescapeAttribute = (value) => value.replace(/&lt;/g, "<").replace(/&quot;/g, '"').replace(/&amp;/g, "&");
5348
+ function extractMultitaskEvents(text2) {
5349
+ return [...text2.matchAll(BLOCK)].flatMap((match) => {
5350
+ const attributes = Object.fromEntries([...match[1].matchAll(ATTRIBUTE)].map(([, key, value]) => [key, unescapeAttribute(value)]));
5351
+ const kind = MULTITASK_EVENT_KINDS.find((candidate) => candidate === attributes.kind);
5352
+ if (!kind || !attributes.id || !attributes.agent_id) return [];
5353
+ const [summary, ...rest] = match[2].replaceAll(`<\\/${TAG}`, `</${TAG}`).split("\n\n");
5354
+ const detail = rest.join("\n\n").trim();
5355
+ return [{
5356
+ id: attributes.id,
5357
+ at: attributes.at ?? "",
5358
+ kind,
5359
+ agentId: attributes.agent_id,
5360
+ agentName: attributes.agent ?? "subagent",
5361
+ summary: summary.trim(),
5362
+ ...detail ? { detail } : {},
5363
+ ...attributes.noticed === "true" ? { noticed: true } : {}
5364
+ }];
5365
+ });
5366
+ }
5367
+ function parseMultitaskEvents(text2) {
5368
+ const events = extractMultitaskEvents(text2);
5369
+ return events.length > 0 && text2.replace(BLOCK, "").replaceAll(MERGED_MESSAGE_SEPARATOR.trim(), "").trim() === "" ? events : null;
5370
+ }
5371
+
5372
+ // ../shared/src/learned-skills.ts
5373
+ import { z as z16 } from "zod";
5374
+
5375
+ // ../shared/src/frontmatter.ts
5376
+ import { parse as parseYaml } from "yaml";
5377
+ function parseFrontmatter(content) {
5378
+ const match = content.match(/^---\r?\n([\s\S]*?)\r?\n---(?:\r?\n|$)/);
5379
+ if (!match) return {};
5380
+ try {
5381
+ const parsed = parseYaml(match[1]);
5382
+ if (typeof parsed !== "object" || parsed === null) return {};
5383
+ return {
5384
+ ..."name" in parsed && typeof parsed.name === "string" ? { name: parsed.name.trim() } : {},
5385
+ ..."description" in parsed && typeof parsed.description === "string" ? { description: parsed.description.trim() } : {}
5386
+ };
5387
+ } catch {
5388
+ return {};
5389
+ }
5390
+ }
5391
+
5392
+ // ../shared/src/learned-skills.ts
5393
+ var LEARNED_SKILLS_ROOT = `${SANDBOX_PATHS.REPLICAS_DIR}/learned-skills`;
5394
+ var LEARNED_SKILLS_MANIFEST_PATH = `${LEARNED_SKILLS_ROOT}/manifest.json`;
5395
+ var LEARNED_SKILL_DIR_PREFIX = "replicas-learned__";
5396
+ var learnedSkillsManifestSchema = z16.object({
5397
+ skills: z16.array(z16.object({ name: z16.string(), sha256: z16.string() }))
5398
+ });
5399
+ var dreamVerdictChecksSchema = z16.object({
5400
+ repeatable: z16.boolean(),
5401
+ realInstruction: z16.boolean(),
5402
+ noContradiction: z16.boolean(),
5403
+ formatExact: z16.boolean(),
5404
+ humanOnly: z16.boolean(),
5405
+ actionable: z16.boolean(),
5406
+ durable: z16.boolean()
5407
+ });
5408
+ var DREAM_VERDICT_CHECKS = dreamVerdictChecksSchema.keyof().options;
5409
+ var dreamVerdictSchema = dreamVerdictChecksSchema.extend({ approve: z16.boolean(), reason: z16.string() });
5410
+ 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."`;
5411
+
5287
5412
  // ../shared/src/user-message-matching.ts
5288
5413
  function parseTimestampMs(timestamp) {
5289
5414
  const value = typeof timestamp === "number" ? timestamp : Date.parse(timestamp);
@@ -5437,7 +5562,8 @@ var MULTITASK_TOOL_ACTIONS = {
5437
5562
  [REPLICAS_MCP_TOOLS.messageSubagent]: "send",
5438
5563
  [REPLICAS_MCP_TOOLS.listSubagents]: "list",
5439
5564
  [REPLICAS_MCP_TOOLS.readSubagent]: "read",
5440
- [REPLICAS_MCP_TOOLS.archiveSubagent]: "archive"
5565
+ [REPLICAS_MCP_TOOLS.archiveSubagent]: "archive",
5566
+ [REPLICAS_MCP_TOOLS.waitForSubagents]: "wait"
5441
5567
  };
5442
5568
  var INTERNAL_TOOLS = /* @__PURE__ */ new Set(["ToolSearch", "ListMcpResourcesTool", "ReadMcpResourceTool", "TaskOutput", "BashOutput"]);
5443
5569
  function describeToolCall(message2, base) {
@@ -5467,10 +5593,13 @@ function describeToolCall(message2, base) {
5467
5593
  ...base,
5468
5594
  key,
5469
5595
  failed: base.failed || Boolean(message2.output?.startsWith("Error:")),
5470
- multitask: { action: multitaskAction, name: inputString(input, "name"), agentId: inputString(input, "agent_id"), text: inputString(input, "prompt", "message") }
5596
+ multitask: { action: multitaskAction, name: inputString(input, "name"), agentId: inputString(input, "agent_id"), chatId: inputString(input, "chat_id"), text: inputString(input, "prompt", "message") }
5471
5597
  };
5472
5598
  if (multitaskAction === "spawn") return { ...step, category: "agent", icon: "network", live: "Spawning", done: "Spawned", detail: "multitask" };
5473
5599
  if (multitaskAction === "send") return { ...step, category: "agent", icon: "message", live: "Messaging", done: "Messaged", detail: "multitask" };
5600
+ if (multitaskAction === "wait") {
5601
+ return { ...step, category: "agent", icon: "clock", live: "Waiting for subagents", done: "Waited for subagents", detail: "multitask", multitask: { ...step.multitask, events: extractMultitaskEvents(message2.output ?? "") } };
5602
+ }
5474
5603
  if (multitaskAction === "archive") return { ...step, category: "tool", icon: "archive", live: "Archiving subagent", done: "Archived subagent", detail: "io" };
5475
5604
  return multitaskAction === "list" ? { ...step, category: "tool", icon: "network", live: "Listing subagents", done: "Listed subagents", detail: "io" } : { ...step, category: "tool", icon: "network", live: "Reading subagent response", done: "Read subagent response", detail: "io" };
5476
5605
  }
@@ -5521,84 +5650,6 @@ function describeToolCall(message2, base) {
5521
5650
  };
5522
5651
  }
5523
5652
 
5524
- // ../shared/src/routes/preferences.ts
5525
- var EMPTY_AGENT_DEFAULT_SETTINGS = {
5526
- agent_provider: null,
5527
- model: null,
5528
- thinking_level: null,
5529
- goal_mode: null,
5530
- fast_mode: null
5531
- };
5532
- var DEFAULT_SUBAGENT_MCP_PROVIDERS = [...VALID_AGENT_PROVIDERS];
5533
- var DEFAULT_USER_PREFERENCES = {
5534
- default_agent: "codex",
5535
- default_model: null,
5536
- claude_models: null,
5537
- codex_models: null,
5538
- cursor_models: null,
5539
- claude_hidden_models: null,
5540
- codex_hidden_models: null,
5541
- cursor_hidden_models: null,
5542
- openrouter_models: null,
5543
- opencode_go_models: null,
5544
- close_workspace_on_pr_close: false,
5545
- close_workspace_on_pr_merge: false,
5546
- default_environment_id: null,
5547
- respond_to_ci_workflows: true,
5548
- respond_to_ci_checks: true,
5549
- respond_to_human_pr_reviews: false,
5550
- pr_user_attribution: false,
5551
- auto_draft_prs: false,
5552
- open_prs_in_graphite: false,
5553
- open_links_in_desktop_app: false,
5554
- memory_enabled: null,
5555
- subagent_mcp_enabled: null,
5556
- default_fast_mode: false,
5557
- agent_defaults: { ...EMPTY_AGENT_DEFAULT_SETTINGS },
5558
- fallback_chains: null
5559
- };
5560
- function defaultReplicasAgentAbilities() {
5561
- const abilities = {};
5562
- for (const key of REPLICAS_AGENT_ABILITIES) {
5563
- abilities[key] = true;
5564
- }
5565
- if (hasAllReplicasAgentAbilities(abilities)) return abilities;
5566
- throw new Error("Default Replicas agent ability flags are incomplete");
5567
- }
5568
- function hasAllReplicasAgentAbilities(abilities) {
5569
- return REPLICAS_AGENT_ABILITIES.every((key) => typeof abilities[key] === "boolean");
5570
- }
5571
- var DEFAULT_DEFAULT_SKILLS = {
5572
- replicas_agent: {
5573
- enabled: true,
5574
- abilities: defaultReplicasAgentAbilities()
5575
- }
5576
- };
5577
-
5578
- // ../shared/src/prompts.ts
5579
- var REPLICAS_INSTRUCTIONS_TAG = "replicas_instructions";
5580
- var MULTITASK_INSTRUCTIONS_TAG = "multitask_instructions";
5581
- function wrapInTag(content, tag) {
5582
- return `<${tag}>
5583
- ${content}
5584
- </${tag}>`;
5585
- }
5586
- function removeTag(text2, tag) {
5587
- const regex = new RegExp(`<${tag}>[\\s\\S]*?</${tag}>`, "g");
5588
- return text2.replace(regex, "").trim();
5589
- }
5590
- function removeReplicasInstructions(text2) {
5591
- return removeTag(text2, REPLICAS_INSTRUCTIONS_TAG);
5592
- }
5593
- var MULTITASK_INSTRUCTIONS_BLOCK = new RegExp(`\\s*<${MULTITASK_INSTRUCTIONS_TAG}>\\n([\\s\\S]*?)\\n</${MULTITASK_INSTRUCTIONS_TAG}>`);
5594
- function splitMultitaskInstructions(customInstructions) {
5595
- const match = customInstructions?.match(MULTITASK_INSTRUCTIONS_BLOCK);
5596
- return {
5597
- customInstructions: match ? customInstructions?.replace(match[0], "").trim() || void 0 : customInstructions,
5598
- multitaskInstructions: match?.[1]
5599
- };
5600
- }
5601
-
5602
5653
  // ../shared/src/user-message-attachments.ts
5603
5654
  var ATTACHMENT_PLACEHOLDER_REGEX = /^\[\d+ (?:(?:images?|files?)(?: and \d+ files?)? attached|(?:image )?attachments?)\]$/;
5604
5655
  var WALKTHROUGH_NOTE_REGEX = /(?:^|\n\n)<replicas_walkthrough path="([^"\n]+)" duration_seconds="(\d+)" audio="(true|false)">\n[^<]*\n<\/replicas_walkthrough>$/;
@@ -7481,6 +7532,11 @@ function applyInterruptions(messages, events) {
7481
7532
  function applyEngineNotices(messages, events) {
7482
7533
  const notices = [];
7483
7534
  events.forEach((event, index) => {
7535
+ if (event.type === MULTITASK_EVENT_TYPE) {
7536
+ const parsed = typeof event.payload.text === "string" ? parseMultitaskEvents(event.payload.text) : null;
7537
+ if (parsed) notices.push({ id: `multitask-event-${event.timestamp}-${index}`, type: "multitask_event", events: parsed, timestamp: event.timestamp });
7538
+ return;
7539
+ }
7484
7540
  if (event.type === CHAT_MESSAGE_REJECTED_EVENT_TYPE) {
7485
7541
  notices.push({
7486
7542
  id: `message-rejected-${event.timestamp}-${index}`,
@@ -8652,7 +8708,7 @@ var CLAUDE_AUTH_ENV_KEYS_BY_METHOD = {
8652
8708
  };
8653
8709
 
8654
8710
  // ../shared/src/routes/command-protection.ts
8655
- import { z as z16 } from "zod";
8711
+ import { z as z17 } from "zod";
8656
8712
 
8657
8713
  // ../shared/src/git-invocations.ts
8658
8714
  var COMMIT_VALUE_OPTIONS = /* @__PURE__ */ new Set(["message", "file", "trailer", "reuse-message", "reedit-message", "fixup", "squash", "template", "author", "date", "cleanup", "pathspec-from-file"]);
@@ -8743,27 +8799,27 @@ function findCheckoutTarget(args) {
8743
8799
  }
8744
8800
 
8745
8801
  // ../shared/src/routes/command-protection.ts
8746
- var commandProtectionRepoStateSchema = z16.object({
8747
- branch: z16.string().nullable(),
8748
- defaultBranch: z16.string().nullable(),
8749
- pushBranch: z16.string().nullable(),
8750
- pushConfig: z16.string().nullable(),
8751
- headMessage: z16.string().nullable(),
8752
- mergeInProgress: z16.boolean().optional()
8802
+ var commandProtectionRepoStateSchema = z17.object({
8803
+ branch: z17.string().nullable(),
8804
+ defaultBranch: z17.string().nullable(),
8805
+ pushBranch: z17.string().nullable(),
8806
+ pushConfig: z17.string().nullable(),
8807
+ headMessage: z17.string().nullable(),
8808
+ mergeInProgress: z17.boolean().optional()
8753
8809
  });
8754
- var commandProtectionEvaluateRequestSchema = z16.object({
8755
- provider: z16.enum(["claude", "codex", "cursor", "opencode", "pi"]),
8756
- source: z16.enum(["claude_pre_tool_use", "codex_approval_request", "cursor_pre_tool_use", "opencode_pre_tool_use", "pi_tool_call"]),
8757
- toolName: z16.string(),
8758
- toolInput: z16.unknown(),
8759
- command: z16.string().nullish(),
8760
- cwd: z16.string().nullish(),
8761
- toolUseId: z16.string().nullish(),
8810
+ var commandProtectionEvaluateRequestSchema = z17.object({
8811
+ provider: z17.enum(["claude", "codex", "cursor", "opencode", "pi"]),
8812
+ source: z17.enum(["claude_pre_tool_use", "codex_approval_request", "cursor_pre_tool_use", "opencode_pre_tool_use", "pi_tool_call"]),
8813
+ toolName: z17.string(),
8814
+ toolInput: z17.unknown(),
8815
+ command: z17.string().nullish(),
8816
+ cwd: z17.string().nullish(),
8817
+ toolUseId: z17.string().nullish(),
8762
8818
  // Read by the engine before the command runs, keyed by absolute path, so the
8763
8819
  // policy can see branches and commit messages the command text only references.
8764
- gitContext: z16.object({
8765
- repos: z16.record(z16.string(), commandProtectionRepoStateSchema),
8766
- messageFiles: z16.record(z16.string(), z16.string())
8820
+ gitContext: z17.object({
8821
+ repos: z17.record(z17.string(), commandProtectionRepoStateSchema),
8822
+ messageFiles: z17.record(z17.string(), z17.string())
8767
8823
  }).optional()
8768
8824
  });
8769
8825
  var COMMAND_PROTECTION_COMMAND_KEYS = ["command", "cmd", "script", "query", "endpoint", "path", "url", "mutation"];
@@ -8960,102 +9016,102 @@ function shouldRefreshPullRequests(toolName, toolInput) {
8960
9016
  }
8961
9017
 
8962
9018
  // ../shared/src/routes/linear.ts
8963
- import { z as z17 } from "zod";
8964
- var linearSessionMetadataSchema = z17.object({
8965
- via_mothership: z17.boolean().optional(),
8966
- issue_id: z17.string(),
8967
- issue_identifier: z17.string(),
8968
- issue_title: z17.string(),
8969
- issue_description: z17.string(),
8970
- issue_url: z17.string(),
8971
- comment_id: z17.string(),
8972
- comment_body: z17.string(),
8973
- triggered_by_id: z17.string().optional(),
8974
- triggered_by_name: z17.string().optional(),
8975
- triggered_by_email: z17.string().optional(),
8976
- linear_workspace_id: z17.string().optional(),
8977
- creator_id: z17.string().optional(),
8978
- creator_name: z17.string().optional(),
8979
- creator_email: z17.string().optional(),
8980
- assignee_id: z17.string().optional(),
8981
- assignee_name: z17.string().optional(),
8982
- assignee_email: z17.string().optional(),
8983
- issue_state: z17.string().optional(),
8984
- parent_issue: z17.object({
8985
- id: z17.string(),
8986
- identifier: z17.string(),
8987
- title: z17.string(),
8988
- description: z17.string().nullable()
9019
+ import { z as z18 } from "zod";
9020
+ var linearSessionMetadataSchema = z18.object({
9021
+ via_mothership: z18.boolean().optional(),
9022
+ issue_id: z18.string(),
9023
+ issue_identifier: z18.string(),
9024
+ issue_title: z18.string(),
9025
+ issue_description: z18.string(),
9026
+ issue_url: z18.string(),
9027
+ comment_id: z18.string(),
9028
+ comment_body: z18.string(),
9029
+ triggered_by_id: z18.string().optional(),
9030
+ triggered_by_name: z18.string().optional(),
9031
+ triggered_by_email: z18.string().optional(),
9032
+ linear_workspace_id: z18.string().optional(),
9033
+ creator_id: z18.string().optional(),
9034
+ creator_name: z18.string().optional(),
9035
+ creator_email: z18.string().optional(),
9036
+ assignee_id: z18.string().optional(),
9037
+ assignee_name: z18.string().optional(),
9038
+ assignee_email: z18.string().optional(),
9039
+ issue_state: z18.string().optional(),
9040
+ parent_issue: z18.object({
9041
+ id: z18.string(),
9042
+ identifier: z18.string(),
9043
+ title: z18.string(),
9044
+ description: z18.string().nullable()
8989
9045
  }).optional(),
8990
- workspace: z17.object({
8991
- id: z17.string(),
8992
- coding_agent: z17.custom((value) => typeof value === "string" && isValidAgentProvider(value)),
8993
- task_description: z17.string(),
8994
- created_at: z17.string()
9046
+ workspace: z18.object({
9047
+ id: z18.string(),
9048
+ coding_agent: z18.custom((value) => typeof value === "string" && isValidAgentProvider(value)),
9049
+ task_description: z18.string(),
9050
+ created_at: z18.string()
8995
9051
  }).optional()
8996
9052
  });
8997
9053
 
8998
9054
  // ../shared/src/routes/mothership.ts
8999
- import { z as z18 } from "zod";
9055
+ import { z as z19 } from "zod";
9000
9056
  var MOTHERSHIP_LINEAR_ACTIONS = ["ask", "start"];
9001
- var mothershipLinearSessionIntentRequestSchema = z18.object({
9002
- comment_id: z18.string().trim().min(1).describe("Id of the Linear comment the session will be created on."),
9003
- action: z18.enum(MOTHERSHIP_LINEAR_ACTIONS).describe("`ask` when the comment is a clarifying question, `start` when it is the complete task prompt.")
9057
+ var mothershipLinearSessionIntentRequestSchema = z19.object({
9058
+ comment_id: z19.string().trim().min(1).describe("Id of the Linear comment the session will be created on."),
9059
+ action: z19.enum(MOTHERSHIP_LINEAR_ACTIONS).describe("`ask` when the comment is a clarifying question, `start` when it is the complete task prompt.")
9004
9060
  });
9005
- var mothershipLinearStartRequestSchema = z18.object({
9006
- issue_id: z18.string().describe("Linear issue id from the envelope's `issue_id`."),
9007
- agent_session_id: z18.string().describe("Existing Linear agent session id from the envelope's `agent_session_id`."),
9008
- prompt: z18.string().trim().min(1).describe("Complete task prompt for the coding workspace.")
9061
+ var mothershipLinearStartRequestSchema = z19.object({
9062
+ issue_id: z19.string().describe("Linear issue id from the envelope's `issue_id`."),
9063
+ agent_session_id: z19.string().describe("Existing Linear agent session id from the envelope's `agent_session_id`."),
9064
+ prompt: z19.string().trim().min(1).describe("Complete task prompt for the coding workspace.")
9009
9065
  });
9010
- var slackChannelIdSchema = z18.string().describe("Slack channel id from the envelope's `channel_id`.");
9011
- var slackThreadTsSchema = z18.string().describe("Slack thread timestamp from the envelope's `thread_ts`.");
9012
- var mothershipSlackSpawnRequestSchema = z18.object({
9066
+ var slackChannelIdSchema = z19.string().describe("Slack channel id from the envelope's `channel_id`.");
9067
+ var slackThreadTsSchema = z19.string().describe("Slack thread timestamp from the envelope's `thread_ts`.");
9068
+ var mothershipSlackSpawnRequestSchema = z19.object({
9013
9069
  channel_id: slackChannelIdSchema,
9014
9070
  thread_ts: slackThreadTsSchema,
9015
- message_ts: z18.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."),
9016
- user_id: z18.string().describe("Slack user id of that message's author (the envelope's `user_id`). The workspace is attributed to them."),
9017
- prompt: z18.string().describe("Complete task for the new workspace, written so it stands on its own."),
9018
- environment_id: z18.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.`)
9071
+ message_ts: z19.string().describe("Timestamp of the Slack message that asked for the work (the envelope's `message_ts`). The server verifies this message and its author."),
9072
+ user_id: z19.string().describe("Slack user id of that message's author (the envelope's `user_id`). The workspace is attributed to them."),
9073
+ prompt: z19.string().describe("Complete task for the new workspace, written so it stands on its own."),
9074
+ environment_id: z19.string().optional().describe(`Environment id from \`${REPLICAS_MCP_TOOLS.listEnvironments}\`. Pass it only when clearly confident it fits; omit it to let routing choose. If routing cannot choose, the call fails and nothing is posted, so pick one or ask the person.`)
9019
9075
  });
9020
- var mothershipSlackRelayRequestSchema = z18.object({
9076
+ var mothershipSlackRelayRequestSchema = z19.object({
9021
9077
  channel_id: slackChannelIdSchema,
9022
9078
  thread_ts: slackThreadTsSchema,
9023
- message: z18.string().describe("The follow-up to deliver, combining every fresh message that belongs to this update."),
9024
- user_id: z18.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`."),
9025
- queue: z18.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."),
9026
- workspace_id: z18.string().optional().describe(`Existing workspace id, from \`${REPLICAS_MCP_TOOLS.listWorkspaces}\` or a workspace link in the thread, to bind a thread without a workspace to before relaying. The author must be able to see it. Omit to relay into the thread's own workspace.`),
9027
- message_ts: z18.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.")
9079
+ message: z19.string().describe("The follow-up to deliver, combining every fresh message that belongs to this update."),
9080
+ user_id: z19.string().optional().describe("Slack user id of the follow-up's author (the envelope's `user_id`), so it is attributed to them. Defaults to the thread's original requester. Required with `workspace_id`."),
9081
+ queue: z19.boolean().optional().describe("Set true only when the person explicitly asked for this to happen after the current task finishes. Delivers behind the active turn instead of interrupting it."),
9082
+ workspace_id: z19.string().optional().describe(`Existing workspace id, from \`${REPLICAS_MCP_TOOLS.listWorkspaces}\` or a workspace link in the thread, to bind a thread without a workspace to before relaying. The author must be able to see it. Omit to relay into the thread's own workspace.`),
9083
+ message_ts: z19.string().optional().describe("Timestamp of the Slack message that led to this relay (the envelope's `message_ts`). Required with `workspace_id`; the server verifies this message and its author.")
9028
9084
  });
9029
- var mothershipListWorkspacesRequestSchema = z18.object({
9085
+ var mothershipListWorkspacesRequestSchema = z19.object({
9030
9086
  channel_id: slackChannelIdSchema,
9031
9087
  thread_ts: slackThreadTsSchema,
9032
- message_ts: z18.string().describe("The envelope's `message_ts`. The server verifies this message and its author."),
9033
- user_id: z18.string().describe("Slack user id of that message's author (the envelope's `user_id`). Only workspaces they can see are listed."),
9034
- query: z18.string().trim().min(1).optional().describe("Case-insensitive text to match against workspace names and pull request URLs.")
9088
+ message_ts: z19.string().describe("The envelope's `message_ts`. The server verifies this message and its author."),
9089
+ user_id: z19.string().describe("Slack user id of that message's author (the envelope's `user_id`). Only workspaces they can see are listed."),
9090
+ query: z19.string().trim().min(1).optional().describe("Case-insensitive text to match against workspace names and pull request URLs.")
9035
9091
  });
9036
- var mothershipSlackConfirmationSchema = z18.object({
9037
- confirmation_channel_id: z18.string().describe("`channel_id` from the envelope of the Slack message that asked for or accepted this."),
9038
- confirmation_thread_ts: z18.string().describe("`thread_ts` from that message's envelope."),
9039
- confirmation_message_ts: z18.string().describe("`message_ts` from that message's envelope."),
9040
- confirmation_user_id: z18.string().describe("`user_id` from that message's envelope.")
9092
+ var mothershipSlackConfirmationSchema = z19.object({
9093
+ confirmation_channel_id: z19.string().describe("`channel_id` from the envelope of the Slack message that asked for or accepted this."),
9094
+ confirmation_thread_ts: z19.string().describe("`thread_ts` from that message's envelope."),
9095
+ confirmation_message_ts: z19.string().describe("`message_ts` from that message's envelope."),
9096
+ confirmation_user_id: z19.string().describe("`user_id` from that message's envelope.")
9041
9097
  });
9042
9098
  var mothershipAutomationToolInputSchema = automationToolInputSchema.extend(mothershipSlackConfirmationSchema.shape);
9043
9099
  var mothershipSaveChannelPresetToolInputSchema = mothershipSlackConfirmationSchema.extend({
9044
- preset_id: z18.string().optional().describe(`Id of the preset to update, from \`${REPLICAS_MCP_TOOLS.listChannelSettings}\`. Omit to create a new preset.`),
9045
- name: z18.string().trim().min(1).max(MOTHERSHIP_PRESET_NAME_MAX_LENGTH).optional().describe("Preset name. Required when creating."),
9046
- description: z18.string().optional().describe("One-line summary shown in settings."),
9047
- icon: z18.enum(MOTHERSHIP_PRESET_ICONS).optional(),
9048
- instructions: z18.string().optional().describe("Complete preset instructions; replaces the existing text. Required when creating.")
9100
+ preset_id: z19.string().optional().describe(`Id of the preset to update, from \`${REPLICAS_MCP_TOOLS.listChannelSettings}\`. Omit to create a new preset.`),
9101
+ name: z19.string().trim().min(1).max(MOTHERSHIP_PRESET_NAME_MAX_LENGTH).optional().describe("Preset name. Required when creating."),
9102
+ description: z19.string().optional().describe("One-line summary shown in settings."),
9103
+ icon: z19.enum(MOTHERSHIP_PRESET_ICONS).optional(),
9104
+ instructions: z19.string().optional().describe("Complete preset instructions; replaces the existing text. Required when creating.")
9049
9105
  });
9050
9106
  var mothershipUpdateChannelSettingsToolInputSchema = mothershipSlackConfirmationSchema.extend({
9051
- source: z18.enum(MOTHERSHIP_SOURCE_TYPES).optional().describe("Defaults to `slack`."),
9052
- external_id: z18.string().describe("Slack channel id or Linear team id."),
9053
- monitored: z18.boolean().optional().describe("`false` stops Mothership from handling the source: it excludes a Slack channel or stops monitoring a Linear team. `true` resumes a Slack channel or starts monitoring a Linear team, and only an organization admin can ask for that. Omit to keep it."),
9054
- preset_id: z18.string().nullable().optional().describe("Preset to assign; `null` removes the preset. Omit to keep it."),
9055
- instructions: z18.string().nullable().optional().describe("Complete channel-specific instructions, applied after the preset; replaces the existing text. `null` clears them. Omit to keep them.")
9107
+ source: z19.enum(MOTHERSHIP_SOURCE_TYPES).optional().describe("Defaults to `slack`."),
9108
+ external_id: z19.string().describe("Slack channel id or Linear team id."),
9109
+ monitored: z19.boolean().optional().describe("`false` stops Mothership from handling the source: it excludes a Slack channel or stops monitoring a Linear team. `true` resumes a Slack channel or starts monitoring a Linear team, and only an organization admin can ask for that. Omit to keep it."),
9110
+ preset_id: z19.string().nullable().optional().describe("Preset to assign; `null` removes the preset. Omit to keep it."),
9111
+ instructions: z19.string().nullable().optional().describe("Complete channel-specific instructions, applied after the preset; replaces the existing text. `null` clears them. Omit to keep them.")
9056
9112
  });
9057
9113
  var mothershipDeleteChannelPresetToolInputSchema = mothershipSlackConfirmationSchema.extend({
9058
- preset_id: z18.string().describe(`Id of the preset to delete, from \`${REPLICAS_MCP_TOOLS.listChannelSettings}\`.`)
9114
+ preset_id: z19.string().describe(`Id of the preset to delete, from \`${REPLICAS_MCP_TOOLS.listChannelSettings}\`.`)
9059
9115
  });
9060
9116
 
9061
9117
  // ../shared/src/routes/plugin-catalog.ts
@@ -9383,45 +9439,45 @@ var workspaceStagesClientStateKey = orgUserClientStateKey(WORKSPACE_STAGES_CLIEN
9383
9439
  var workspaceMarkedUnreadClientStateKey = orgUserClientStateKey(WORKSPACE_MARKED_UNREAD_CLIENT_STATE_KEY_PREFIX);
9384
9440
 
9385
9441
  // ../shared/src/routes/workspace-events.ts
9386
- import { z as z19 } from "zod";
9387
- var workspaceChangedEventSchema = z19.discriminatedUnion("type", [
9388
- z19.object({
9389
- type: z19.literal("workspace.changed"),
9390
- workspaceId: z19.string(),
9391
- completion: z19.object({
9392
- workspaceName: z19.string(),
9393
- completedAt: z19.string(),
9394
- processing: z19.boolean().optional()
9442
+ import { z as z20 } from "zod";
9443
+ var workspaceChangedEventSchema = z20.discriminatedUnion("type", [
9444
+ z20.object({
9445
+ type: z20.literal("workspace.changed"),
9446
+ workspaceId: z20.string(),
9447
+ completion: z20.object({
9448
+ workspaceName: z20.string(),
9449
+ completedAt: z20.string(),
9450
+ processing: z20.boolean().optional()
9395
9451
  }).optional(),
9396
- ts: z19.string()
9452
+ ts: z20.string()
9397
9453
  }),
9398
- z19.object({
9399
- type: z19.literal("workspace.chat.changed"),
9400
- workspaceId: z19.string(),
9401
- chatId: z19.string(),
9402
- ts: z19.string()
9454
+ z20.object({
9455
+ type: z20.literal("workspace.chat.changed"),
9456
+ workspaceId: z20.string(),
9457
+ chatId: z20.string(),
9458
+ ts: z20.string()
9403
9459
  }),
9404
- z19.object({ type: z19.literal("presence.changed"), ts: z19.string() }),
9405
- z19.object({
9406
- type: z19.literal("mobile-testing.changed"),
9407
- workspaceId: z19.string(),
9408
- ts: z19.string()
9460
+ z20.object({ type: z20.literal("presence.changed"), ts: z20.string() }),
9461
+ z20.object({
9462
+ type: z20.literal("mobile-testing.changed"),
9463
+ workspaceId: z20.string(),
9464
+ ts: z20.string()
9409
9465
  })
9410
9466
  ]);
9411
9467
 
9412
9468
  // ../shared/src/routes/presence.ts
9413
- import { z as z20 } from "zod";
9414
- var presenceStatusSchema = z20.enum(["online", "typing"]);
9415
- var presenceLocationSchema = z20.object({
9416
- workspaceId: z20.string().optional()
9469
+ import { z as z21 } from "zod";
9470
+ var presenceStatusSchema = z21.enum(["online", "typing"]);
9471
+ var presenceLocationSchema = z21.object({
9472
+ workspaceId: z21.string().optional()
9417
9473
  });
9418
- var presenceEntrySchema = z20.object({
9419
- userId: z20.string(),
9474
+ var presenceEntrySchema = z21.object({
9475
+ userId: z21.string(),
9420
9476
  status: presenceStatusSchema,
9421
9477
  location: presenceLocationSchema,
9422
- ts: z20.string()
9478
+ ts: z21.string()
9423
9479
  });
9424
- var updatePresenceRequestSchema = z20.object({
9480
+ var updatePresenceRequestSchema = z21.object({
9425
9481
  status: presenceStatusSchema,
9426
9482
  location: presenceLocationSchema.optional()
9427
9483
  });
@@ -9878,16 +9934,11 @@ export {
9878
9934
  SUBAGENT_MCP_TOOLS,
9879
9935
  SUBAGENT_MCP_TOOL_NAMES,
9880
9936
  parseMcpToolName,
9881
- parseFrontmatter,
9882
- LEARNED_SKILLS_MANIFEST_PATH,
9883
- LEARNED_SKILL_DIR_PREFIX,
9884
- learnedSkillsManifestSchema,
9885
- learnedSkillFormatInstruction,
9886
- createUuidFromHex,
9887
9937
  isGitHubUrl,
9888
9938
  parseCodeHostPrUrl,
9889
9939
  decodePathSegments,
9890
9940
  buildCodeHostPrUrl,
9941
+ createUuidFromHex,
9891
9942
  WORKSPACE_IDENTITY_AUDIENCE,
9892
9943
  AWS_SOURCE_IDENTITY_CLAIM,
9893
9944
  IDENTITY_PROXY_PORT,
@@ -9900,13 +9951,19 @@ export {
9900
9951
  HISTORY_ROOT,
9901
9952
  HISTORY_INDEX_FILENAME,
9902
9953
  TERMINAL_RTC_ICE_SERVER,
9903
- areUserMessagesWithinMatchWindow,
9904
- isCompaction,
9905
- describeMessageSteps,
9906
9954
  REPLICAS_INSTRUCTIONS_TAG,
9907
9955
  MULTITASK_INSTRUCTIONS_TAG,
9908
9956
  wrapInTag,
9909
9957
  splitMultitaskInstructions,
9958
+ MULTITASK_EVENT_TYPE,
9959
+ parseFrontmatter,
9960
+ LEARNED_SKILLS_MANIFEST_PATH,
9961
+ LEARNED_SKILL_DIR_PREFIX,
9962
+ learnedSkillsManifestSchema,
9963
+ learnedSkillFormatInstruction,
9964
+ areUserMessagesWithinMatchWindow,
9965
+ isCompaction,
9966
+ describeMessageSteps,
9910
9967
  extractErrorText,
9911
9968
  isTransientErrorText,
9912
9969
  extractToolResultText,