replicas-engine 0.1.973 → 0.1.974

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.
@@ -5,12 +5,12 @@ import {
5
5
  getCodexAspHost,
6
6
  restartCodexAspHost,
7
7
  restartCodexAspHostIfRunning
8
- } from "./chunk-NHD7MMAW.js";
9
- import "./chunk-3VGFM7ME.js";
10
- import "./chunk-4P4NVCXW.js";
11
- import "./chunk-F4ZGMCND.js";
8
+ } from "./chunk-BXCLRUIK.js";
9
+ import "./chunk-HLLDPEDK.js";
10
+ import "./chunk-FEOJV72E.js";
11
+ import "./chunk-D4BDGH53.js";
12
12
  import "./chunk-UZSNFLDQ.js";
13
- import "./chunk-RMH6PDA7.js";
13
+ import "./chunk-32UPBL5I.js";
14
14
  import "./chunk-VEQXQN22.js";
15
15
  export {
16
16
  getCodexAspHost,
@@ -2637,6 +2637,57 @@ function buildCodeHostPrUrl(repoUrl, provider, prNumber) {
2637
2637
  return `${normalizedRepoUrl}/pull/${prNumber}`;
2638
2638
  }
2639
2639
 
2640
+ // ../shared/src/replicas-mcp.ts
2641
+ import { z as z10 } from "zod";
2642
+
2643
+ // ../shared/src/automations/trigger-schemas.ts
2644
+ import { z as z9 } from "zod";
2645
+
2646
+ // ../shared/src/uuid.ts
2647
+ function createUuidFromHex(value) {
2648
+ 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)}`;
2649
+ }
2650
+ var UUID_RE = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;
2651
+
2652
+ // ../shared/src/automations/trigger-schemas.ts
2653
+ var repositoryTriggerConfigSchema = z9.object({
2654
+ event: z9.string(),
2655
+ repository_ids: z9.array(z9.string().regex(UUID_RE, "must be a repository id")).optional(),
2656
+ group_pr_events: z9.boolean().optional(),
2657
+ excluded_actors: z9.array(z9.string()).optional()
2658
+ });
2659
+ var cronTriggerSchema = z9.object({ type: z9.literal("cron"), config: z9.object({ schedule: z9.string(), timezone: z9.string().optional() }) });
2660
+ var githubTriggerSchema = z9.object({ type: z9.literal("github"), config: repositoryTriggerConfigSchema });
2661
+ var gitlabTriggerSchema = z9.object({ type: z9.literal("gitlab"), config: repositoryTriggerConfigSchema });
2662
+ var automationTriggerSchema = z9.discriminatedUnion("type", [
2663
+ cronTriggerSchema,
2664
+ githubTriggerSchema,
2665
+ gitlabTriggerSchema,
2666
+ z9.object({ type: z9.literal("slack"), config: z9.object({ event: z9.string(), channel_ids: z9.array(z9.string()).optional(), group_thread_replies: z9.boolean().optional() }) }),
2667
+ z9.object({ type: z9.literal("sentry"), config: z9.object({ event: z9.string(), project_slugs: z9.array(z9.string()).optional(), min_level: z9.string().optional() }) }),
2668
+ z9.object({ type: z9.literal("custom"), config: z9.object({}) })
2669
+ ]);
2670
+
2671
+ // ../shared/src/replicas-mcp.ts
2672
+ var REPLICAS_MCP_SERVER_NAME = "replicas-mcp";
2673
+ var REPLICAS_MCP_TOOLS = {
2674
+ listEnvironments: "list_environments",
2675
+ createAutomation: "create_automation",
2676
+ spawn: "spawn_workspace",
2677
+ relay: "relay_to_workspace",
2678
+ linearStart: "start_linear_session",
2679
+ linearSessionIntent: "register_linear_session_intent"
2680
+ };
2681
+ var automationToolInputSchema = z10.object({
2682
+ name: z10.string().describe("Short automation name."),
2683
+ prompt: z10.string().describe("Prompt each automation run starts with."),
2684
+ environment_id: z10.string().describe(`Environment id from \`${REPLICAS_MCP_TOOLS.listEnvironments}\`.`),
2685
+ triggers: z10.array(automationTriggerSchema).min(1).describe(
2686
+ '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>"] } }`.'
2687
+ ),
2688
+ description: z10.string().optional().describe("One-line summary shown in the dashboard.")
2689
+ });
2690
+
2640
2691
  // ../shared/src/default-skills/replicas-agent/abilities/computer.ts
2641
2692
  var SECTION = `### Computer use (Linux desktop control)
2642
2693
  Drive the workspace's Linux desktop - open a browser, click, type, scroll, screenshot, record - via the \`replicas computer\` CLI. Every Replicas workspace boots with a live H.264 and Opus stream published as an authenticated preview, so a \`Desktop\` tab is always available in the dashboard. Use \`replicas computer info\` to get the viewer URL when you want to share it (e.g. point a user on Slack at the live stream).
@@ -2907,15 +2958,7 @@ var DOCKER_ABILITY = {
2907
2958
  };
2908
2959
 
2909
2960
  // ../shared/src/routes/environment-setups.ts
2910
- import { z as z9 } from "zod";
2911
-
2912
- // ../shared/src/uuid.ts
2913
- function createUuidFromHex(value) {
2914
- 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)}`;
2915
- }
2916
- var UUID_RE = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;
2917
-
2918
- // ../shared/src/routes/environment-setups.ts
2961
+ import { z as z11 } from "zod";
2919
2962
  var ENVIRONMENT_SETUP_STEPS = [
2920
2963
  { key: "understand", label: "Understand the codebase" },
2921
2964
  { key: "install", label: "Install dependencies and run the app" },
@@ -2949,27 +2992,17 @@ var ENVIRONMENT_SETUP_LIMITS = {
2949
2992
  };
2950
2993
  var ENVIRONMENT_SETUP_VARIABLE_WAIT = { defaultMs: 5 * 6e4, maxMs: 15 * 6e4, pollMs: 5e3 };
2951
2994
  var VARIABLE_KEY_RE = /^[A-Za-z_][A-Za-z0-9_]*$/;
2952
- var text = (max) => max === void 0 ? z9.string().trim() : z9.string().trim().max(max);
2995
+ var text = (max) => max === void 0 ? z11.string().trim() : z11.string().trim().max(max);
2953
2996
  var requiredText = (max) => text(max).min(1, "must not be empty");
2954
2997
  var optionalText = (max) => text(max).nullish().transform((value) => value || null);
2955
2998
  var clearableText = (max) => text(max).nullish().transform((value) => value === void 0 ? void 0 : value || null);
2956
- var list = (item, max) => max === void 0 ? z9.array(item) : z9.array(item).max(max);
2999
+ var list = (item, max) => max === void 0 ? z11.array(item) : z11.array(item).max(max);
2957
3000
  var ENVIRONMENT_SETUP_AUTHORED_TRIGGER_TYPES = ["cron", "github", "gitlab"];
2958
3001
  function isEnvironmentSetupAuthoredTriggerType(type) {
2959
3002
  return ENVIRONMENT_SETUP_AUTHORED_TRIGGER_TYPES.some((authored) => authored === type);
2960
3003
  }
2961
- var repositoryTriggerConfigSchema = z9.object({
2962
- event: z9.string(),
2963
- repository_ids: z9.array(z9.string().regex(UUID_RE, "must be a repository id")).optional(),
2964
- group_pr_events: z9.boolean().optional(),
2965
- excluded_actors: z9.array(z9.string()).optional()
2966
- });
2967
- var proposalTriggerSchema = z9.discriminatedUnion("type", [
2968
- z9.object({ type: z9.literal("cron"), config: z9.object({ schedule: z9.string(), timezone: z9.string().optional() }) }),
2969
- z9.object({ type: z9.literal("github"), config: repositoryTriggerConfigSchema }),
2970
- z9.object({ type: z9.literal("gitlab"), config: repositoryTriggerConfigSchema })
2971
- ]);
2972
- var existingTriggerSchema = z9.custom(
3004
+ var proposalTriggerSchema = z11.discriminatedUnion("type", [cronTriggerSchema, githubTriggerSchema, gitlabTriggerSchema]);
3005
+ var existingTriggerSchema = z11.custom(
2973
3006
  (value) => isRecord(value) && typeof value.type === "string" && isRecord(value.config),
2974
3007
  "must be an automation trigger"
2975
3008
  );
@@ -2977,17 +3010,17 @@ var carriedTriggerSchema = existingTriggerSchema.refine(
2977
3010
  (trigger) => !isEnvironmentSetupAuthoredTriggerType(trigger.type)
2978
3011
  );
2979
3012
  function automationSchema(limits) {
2980
- const authored = z9.object({
3013
+ const authored = z11.object({
2981
3014
  name: text(limits.nameChars),
2982
3015
  description: text(limits.descriptionChars),
2983
3016
  prompt: text(limits.automationPromptChars),
2984
3017
  triggers: list(proposalTriggerSchema, limits.automationTriggers)
2985
3018
  });
2986
- const updated = authored.extend({ triggers: list(z9.union([proposalTriggerSchema, carriedTriggerSchema]), limits.automationTriggers) });
2987
- return z9.object({
3019
+ const updated = authored.extend({ triggers: list(z11.union([proposalTriggerSchema, carriedTriggerSchema]), limits.automationTriggers) });
3020
+ return z11.object({
2988
3021
  key: requiredText(limits.automationKeyChars),
2989
- action: z9.enum(ENVIRONMENT_SETUP_AUTOMATION_ACTIONS).default("create"),
2990
- automation_id: z9.string().regex(UUID_RE, "must be an automation id").nullable().default(null),
3022
+ action: z11.enum(ENVIRONMENT_SETUP_AUTOMATION_ACTIONS).default("create"),
3023
+ automation_id: z11.string().regex(UUID_RE, "must be an automation id").nullable().default(null),
2991
3024
  name: text().default(""),
2992
3025
  description: optionalText().transform((value) => value ?? ""),
2993
3026
  prompt: text().default(""),
@@ -3010,7 +3043,7 @@ function automationSchema(limits) {
3010
3043
  const content = (automation.action === "update" ? updated : authored).safeParse(automation);
3011
3044
  if (content.success) return { ...automation, ...content.data };
3012
3045
  for (const issue of content.error.issues) ctx.addIssue({ ...issue, code: "custom" });
3013
- return z9.NEVER;
3046
+ return z11.NEVER;
3014
3047
  });
3015
3048
  }
3016
3049
  function automationListSchema(limits) {
@@ -3028,7 +3061,7 @@ function automationListSchema(limits) {
3028
3061
  });
3029
3062
  }
3030
3063
  function environmentSchema(limits) {
3031
- return z9.object({
3064
+ return z11.object({
3032
3065
  name: optionalText(limits.nameChars).transform((value) => value ?? void 0),
3033
3066
  description: clearableText(limits.descriptionChars),
3034
3067
  system_prompt: clearableText(limits.systemPromptChars),
@@ -3037,26 +3070,26 @@ function environmentSchema(limits) {
3037
3070
  });
3038
3071
  }
3039
3072
  function variableSchema(limits, requiredDefault) {
3040
- return z9.object({
3041
- key: z9.string().regex(VARIABLE_KEY_RE, "must be a valid environment variable name").max(limits.variableKeyChars ?? Number.POSITIVE_INFINITY),
3073
+ return z11.object({
3074
+ key: z11.string().regex(VARIABLE_KEY_RE, "must be a valid environment variable name").max(limits.variableKeyChars ?? Number.POSITIVE_INFINITY),
3042
3075
  description: optionalText(limits.variableDescriptionChars).transform((value) => value ?? ""),
3043
- required: z9.boolean().default(requiredDefault)
3076
+ required: z11.boolean().default(requiredDefault)
3044
3077
  });
3045
3078
  }
3046
3079
  function proposalSchema(limits) {
3047
- return z9.object({
3080
+ return z11.object({
3048
3081
  summary: requiredText(limits.summaryChars),
3049
3082
  stack: list(text(), limits.stackItems).default([]).transform((items) => items.filter(Boolean)),
3050
3083
  environment: environmentSchema(limits),
3051
3084
  variables: list(variableSchema(limits, false), limits.variables).default([]),
3052
3085
  automations: automationListSchema(limits),
3053
- verification: list(z9.object({
3086
+ verification: list(z11.object({
3054
3087
  label: requiredText(limits.nameChars),
3055
- status: z9.enum(ENVIRONMENT_SETUP_VERIFICATION_STATUSES),
3088
+ status: z11.enum(ENVIRONMENT_SETUP_VERIFICATION_STATUSES),
3056
3089
  detail: optionalText(limits.verificationDetailChars).transform((value) => value ?? void 0)
3057
3090
  }), limits.verificationItems).default([]),
3058
- media: list(z9.object({
3059
- media_id: z9.string().regex(UUID_RE, "must be a media id"),
3091
+ media: list(z11.object({
3092
+ media_id: z11.string().regex(UUID_RE, "must be a media id"),
3060
3093
  title: requiredText(limits.nameChars)
3061
3094
  }), limits.mediaItems).default([])
3062
3095
  });
@@ -3064,35 +3097,35 @@ function proposalSchema(limits) {
3064
3097
  var environmentSetupProposalSchema = proposalSchema({});
3065
3098
  var environmentSetupProposalSubmissionSchema = proposalSchema(ENVIRONMENT_SETUP_LIMITS);
3066
3099
  var environmentSetupVariableRequestSchema = variableSchema({}, false).extend({
3067
- status: z9.enum(["pending", "provided", "skipped"]),
3068
- requested_at: z9.string(),
3069
- resolved_at: z9.string().nullable().default(null)
3100
+ status: z11.enum(["pending", "provided", "skipped"]),
3101
+ requested_at: z11.string(),
3102
+ resolved_at: z11.string().nullable().default(null)
3070
3103
  });
3071
- var environmentSetupRunStateSchema = z9.object({
3072
- status: z9.enum(ENVIRONMENT_SETUP_RUN_STATUSES),
3073
- steps: z9.partialRecord(z9.enum(ENVIRONMENT_SETUP_STEPS.map((step) => step.key)), z9.enum(ENVIRONMENT_SETUP_STEP_STATUSES)).default({}),
3104
+ var environmentSetupRunStateSchema = z11.object({
3105
+ status: z11.enum(ENVIRONMENT_SETUP_RUN_STATUSES),
3106
+ steps: z11.partialRecord(z11.enum(ENVIRONMENT_SETUP_STEPS.map((step) => step.key)), z11.enum(ENVIRONMENT_SETUP_STEP_STATUSES)).default({}),
3074
3107
  proposal: environmentSetupProposalSchema.nullable().default(null),
3075
- applied: z9.object({
3076
- applied_at: z9.string(),
3077
- automation_ids: z9.array(z9.string())
3108
+ applied: z11.object({
3109
+ applied_at: z11.string(),
3110
+ automation_ids: z11.array(z11.string())
3078
3111
  }).nullable().default(null),
3079
- variable_requests: z9.array(environmentSetupVariableRequestSchema).default([])
3112
+ variable_requests: z11.array(environmentSetupVariableRequestSchema).default([])
3080
3113
  });
3081
- var applyEnvironmentSetupRequestSchema = z9.object({
3114
+ var applyEnvironmentSetupRequestSchema = z11.object({
3082
3115
  environment: environmentSchema(ENVIRONMENT_SETUP_LIMITS).extend({ name: requiredText(ENVIRONMENT_SETUP_LIMITS.nameChars) }),
3083
- variables: list(z9.object({ key: z9.string().regex(VARIABLE_KEY_RE), value: z9.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)),
3116
+ variables: list(z11.object({ key: z11.string().regex(VARIABLE_KEY_RE), value: z11.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)),
3084
3117
  automations: automationListSchema(ENVIRONMENT_SETUP_LIMITS)
3085
3118
  });
3086
- var requestEnvironmentSetupVariablesSchema = z9.object({
3119
+ var requestEnvironmentSetupVariablesSchema = z11.object({
3087
3120
  variables: list(variableSchema(ENVIRONMENT_SETUP_LIMITS, true), ENVIRONMENT_SETUP_LIMITS.variables).min(1, "must not be empty")
3088
3121
  }).superRefine(({ variables }, ctx) => {
3089
3122
  if (new Set(variables.map((variable) => variable.key)).size !== variables.length) {
3090
3123
  ctx.addIssue({ code: "custom", path: ["variables"], message: "must have unique keys" });
3091
3124
  }
3092
3125
  });
3093
- var respondEnvironmentSetupVariablesSchema = z9.object({
3094
- values: z9.record(z9.string().regex(VARIABLE_KEY_RE), z9.string()).default({}),
3095
- skipped: z9.array(z9.string().regex(VARIABLE_KEY_RE)).default([])
3126
+ var respondEnvironmentSetupVariablesSchema = z11.object({
3127
+ values: z11.record(z11.string().regex(VARIABLE_KEY_RE), z11.string()).default({}),
3128
+ skipped: z11.array(z11.string().regex(VARIABLE_KEY_RE)).default([])
3096
3129
  });
3097
3130
 
3098
3131
  // ../shared/src/default-skills/replicas-agent/abilities/environment-setup.ts
@@ -4563,7 +4596,7 @@ var SENTRY_ABILITY = {
4563
4596
  };
4564
4597
 
4565
4598
  // ../shared/src/memory.ts
4566
- import { z as z10 } from "zod";
4599
+ import { z as z12 } from "zod";
4567
4600
 
4568
4601
  // ../shared/src/sandbox.ts
4569
4602
  var SANDBOX_LIFECYCLE = {
@@ -4585,11 +4618,11 @@ var INVALID_WORKSPACE_SIZE_ERROR = `Invalid size: must be one of ${WORKSPACE_SIZ
4585
4618
  // ../shared/src/memory.ts
4586
4619
  var HISTORY_ROOT = `${SANDBOX_PATHS.REPLICAS_DIR}/history`;
4587
4620
  var HISTORY_INDEX_FILENAME = "INDEX.md";
4588
- var memoryExtractionResultSchema = z10.object({
4589
- summary: z10.string().nullable(),
4590
- indexEntry: z10.string().nullable()
4621
+ var memoryExtractionResultSchema = z12.object({
4622
+ summary: z12.string().nullable(),
4623
+ indexEntry: z12.string().nullable()
4591
4624
  });
4592
- var { $schema: _, ...MEMORY_EXTRACTION_SCHEMA } = z10.toJSONSchema(memoryExtractionResultSchema);
4625
+ var { $schema: _, ...MEMORY_EXTRACTION_SCHEMA } = z12.toJSONSchema(memoryExtractionResultSchema);
4593
4626
 
4594
4627
  // ../shared/src/default-skills/replicas-agent/abilities/session-history.ts
4595
4628
  var SECTION12 = `### Session history
@@ -4813,6 +4846,13 @@ function removeTag(text2, tag) {
4813
4846
  function removeReplicasInstructions(text2) {
4814
4847
  return removeTag(text2, REPLICAS_INSTRUCTIONS_TAG);
4815
4848
  }
4849
+ var mothershipMcpActions = `These are tools of the \`${REPLICAS_MCP_SERVER_NAME}\` MCP server; their argument names match the envelope fields. Call them directly as tools, never through a shell or the Replicas CLI.
4850
+ - **Spawn** a dedicated workspace for the thread and hand off: \`${REPLICAS_MCP_TOOLS.spawn}\`, with \`environment_id\` when you chose one.
4851
+ - **Relay** a follow-up that is clearly meant for you into the workspace already bound to the thread (pass the envelope's \`user_id\` so it's attributed to its author): \`${REPLICAS_MCP_TOOLS.relay}\`, with \`queue: true\` to queue it.
4852
+ - **List environments**: \`${REPLICAS_MCP_TOOLS.listEnvironments}\`.
4853
+ - **Create an automation**: \`${REPLICAS_MCP_TOOLS.createAutomation}\`, filling its \`confirmation_*\` arguments from the accepting message's envelope.
4854
+ - **Register a Linear session intent**: \`${REPLICAS_MCP_TOOLS.linearSessionIntent}\` with \`comment_id\` and \`action\`.
4855
+ - **Start a Linear session**: \`${REPLICAS_MCP_TOOLS.linearStart}\` with \`issue_id\`, \`agent_session_id\`, and \`prompt\`.`;
4816
4856
 
4817
4857
  // ../shared/src/user-message-attachments.ts
4818
4858
  var ATTACHMENT_PLACEHOLDER_REGEX = /^\[\d+ (?:(?:images?|files?)(?: and \d+ files?)? attached|(?:image )?attachments?)\]$/;
@@ -7786,7 +7826,7 @@ var CLAUDE_AUTH_ENV_KEYS_BY_METHOD = {
7786
7826
  };
7787
7827
 
7788
7828
  // ../shared/src/routes/command-protection.ts
7789
- import { z as z11 } from "zod";
7829
+ import { z as z13 } from "zod";
7790
7830
 
7791
7831
  // ../shared/src/git-invocations.ts
7792
7832
  var COMMIT_VALUE_OPTIONS = /* @__PURE__ */ new Set(["message", "file", "trailer", "reuse-message", "reedit-message", "fixup", "squash", "template", "author", "date", "cleanup", "pathspec-from-file"]);
@@ -7877,27 +7917,27 @@ function findCheckoutTarget(args) {
7877
7917
  }
7878
7918
 
7879
7919
  // ../shared/src/routes/command-protection.ts
7880
- var commandProtectionRepoStateSchema = z11.object({
7881
- branch: z11.string().nullable(),
7882
- defaultBranch: z11.string().nullable(),
7883
- pushBranch: z11.string().nullable(),
7884
- pushConfig: z11.string().nullable(),
7885
- headMessage: z11.string().nullable(),
7886
- mergeInProgress: z11.boolean().optional()
7920
+ var commandProtectionRepoStateSchema = z13.object({
7921
+ branch: z13.string().nullable(),
7922
+ defaultBranch: z13.string().nullable(),
7923
+ pushBranch: z13.string().nullable(),
7924
+ pushConfig: z13.string().nullable(),
7925
+ headMessage: z13.string().nullable(),
7926
+ mergeInProgress: z13.boolean().optional()
7887
7927
  });
7888
- var commandProtectionEvaluateRequestSchema = z11.object({
7889
- provider: z11.enum(["claude", "codex", "cursor", "opencode", "pi"]),
7890
- source: z11.enum(["claude_pre_tool_use", "codex_approval_request", "cursor_pre_tool_use", "opencode_pre_tool_use", "pi_tool_call"]),
7891
- toolName: z11.string(),
7892
- toolInput: z11.unknown(),
7893
- command: z11.string().nullish(),
7894
- cwd: z11.string().nullish(),
7895
- toolUseId: z11.string().nullish(),
7928
+ var commandProtectionEvaluateRequestSchema = z13.object({
7929
+ provider: z13.enum(["claude", "codex", "cursor", "opencode", "pi"]),
7930
+ source: z13.enum(["claude_pre_tool_use", "codex_approval_request", "cursor_pre_tool_use", "opencode_pre_tool_use", "pi_tool_call"]),
7931
+ toolName: z13.string(),
7932
+ toolInput: z13.unknown(),
7933
+ command: z13.string().nullish(),
7934
+ cwd: z13.string().nullish(),
7935
+ toolUseId: z13.string().nullish(),
7896
7936
  // Read by the engine before the command runs, keyed by absolute path, so the
7897
7937
  // policy can see branches and commit messages the command text only references.
7898
- gitContext: z11.object({
7899
- repos: z11.record(z11.string(), commandProtectionRepoStateSchema),
7900
- messageFiles: z11.record(z11.string(), z11.string())
7938
+ gitContext: z13.object({
7939
+ repos: z13.record(z13.string(), commandProtectionRepoStateSchema),
7940
+ messageFiles: z13.record(z13.string(), z13.string())
7901
7941
  }).optional()
7902
7942
  });
7903
7943
  var COMMAND_PROTECTION_COMMAND_KEYS = ["command", "cmd", "script", "query", "endpoint", "path", "url", "mutation"];
@@ -8094,41 +8134,77 @@ function shouldRefreshPullRequests(toolName, toolInput) {
8094
8134
  }
8095
8135
 
8096
8136
  // ../shared/src/routes/linear.ts
8097
- import { z as z12 } from "zod";
8098
- var linearSessionMetadataSchema = z12.object({
8099
- via_mothership: z12.boolean().optional(),
8100
- issue_id: z12.string(),
8101
- issue_identifier: z12.string(),
8102
- issue_title: z12.string(),
8103
- issue_description: z12.string(),
8104
- issue_url: z12.string(),
8105
- comment_id: z12.string(),
8106
- comment_body: z12.string(),
8107
- triggered_by_id: z12.string().optional(),
8108
- triggered_by_name: z12.string().optional(),
8109
- triggered_by_email: z12.string().optional(),
8110
- linear_workspace_id: z12.string().optional(),
8111
- creator_id: z12.string().optional(),
8112
- creator_name: z12.string().optional(),
8113
- creator_email: z12.string().optional(),
8114
- assignee_id: z12.string().optional(),
8115
- assignee_name: z12.string().optional(),
8116
- assignee_email: z12.string().optional(),
8117
- issue_state: z12.string().optional(),
8118
- parent_issue: z12.object({
8119
- id: z12.string(),
8120
- identifier: z12.string(),
8121
- title: z12.string(),
8122
- description: z12.string().nullable()
8137
+ import { z as z14 } from "zod";
8138
+ var linearSessionMetadataSchema = z14.object({
8139
+ via_mothership: z14.boolean().optional(),
8140
+ issue_id: z14.string(),
8141
+ issue_identifier: z14.string(),
8142
+ issue_title: z14.string(),
8143
+ issue_description: z14.string(),
8144
+ issue_url: z14.string(),
8145
+ comment_id: z14.string(),
8146
+ comment_body: z14.string(),
8147
+ triggered_by_id: z14.string().optional(),
8148
+ triggered_by_name: z14.string().optional(),
8149
+ triggered_by_email: z14.string().optional(),
8150
+ linear_workspace_id: z14.string().optional(),
8151
+ creator_id: z14.string().optional(),
8152
+ creator_name: z14.string().optional(),
8153
+ creator_email: z14.string().optional(),
8154
+ assignee_id: z14.string().optional(),
8155
+ assignee_name: z14.string().optional(),
8156
+ assignee_email: z14.string().optional(),
8157
+ issue_state: z14.string().optional(),
8158
+ parent_issue: z14.object({
8159
+ id: z14.string(),
8160
+ identifier: z14.string(),
8161
+ title: z14.string(),
8162
+ description: z14.string().nullable()
8123
8163
  }).optional(),
8124
- workspace: z12.object({
8125
- id: z12.string(),
8126
- coding_agent: z12.custom((value) => typeof value === "string" && isValidAgentProvider(value)),
8127
- task_description: z12.string(),
8128
- created_at: z12.string()
8164
+ workspace: z14.object({
8165
+ id: z14.string(),
8166
+ coding_agent: z14.custom((value) => typeof value === "string" && isValidAgentProvider(value)),
8167
+ task_description: z14.string(),
8168
+ created_at: z14.string()
8129
8169
  }).optional()
8130
8170
  });
8131
8171
 
8172
+ // ../shared/src/routes/mothership.ts
8173
+ import { z as z15 } from "zod";
8174
+ var MOTHERSHIP_LINEAR_ACTIONS = ["ask", "start"];
8175
+ var mothershipLinearSessionIntentRequestSchema = z15.object({
8176
+ comment_id: z15.string().trim().min(1).describe("Id of the Linear comment the session will be created on."),
8177
+ action: z15.enum(MOTHERSHIP_LINEAR_ACTIONS).describe("`ask` when the comment is a clarifying question, `start` when it is the complete task prompt.")
8178
+ });
8179
+ var mothershipLinearStartRequestSchema = z15.object({
8180
+ issue_id: z15.string().describe("Linear issue id from the envelope's `issue_id`."),
8181
+ agent_session_id: z15.string().describe("Existing Linear agent session id from the envelope's `agent_session_id`."),
8182
+ prompt: z15.string().trim().min(1).describe("Complete task prompt for the coding workspace.")
8183
+ });
8184
+ var slackChannelIdSchema = z15.string().describe("Slack channel id from the envelope's `channel_id`.");
8185
+ var slackThreadTsSchema = z15.string().describe("Slack thread timestamp from the envelope's `thread_ts`.");
8186
+ var mothershipSlackSpawnRequestSchema = z15.object({
8187
+ channel_id: slackChannelIdSchema,
8188
+ thread_ts: slackThreadTsSchema,
8189
+ message_ts: z15.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."),
8190
+ user_id: z15.string().describe("Slack user id of that message's author (the envelope's `user_id`). The workspace is attributed to them."),
8191
+ prompt: z15.string().describe("Complete task for the new workspace, written so it stands on its own."),
8192
+ environment_id: z15.string().optional().describe(`Environment id from \`${REPLICAS_MCP_TOOLS.listEnvironments}\`. Pass it only when clearly confident it fits; omit it to let routing choose or ask the person.`)
8193
+ });
8194
+ var mothershipSlackRelayRequestSchema = z15.object({
8195
+ channel_id: slackChannelIdSchema,
8196
+ thread_ts: slackThreadTsSchema,
8197
+ message: z15.string().describe("The follow-up to deliver, combining every fresh message that belongs to this update."),
8198
+ user_id: z15.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."),
8199
+ queue: z15.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.")
8200
+ });
8201
+ var mothershipAutomationToolInputSchema = automationToolInputSchema.extend({
8202
+ confirmation_channel_id: z15.string().describe("`channel_id` from the envelope of the Slack message that accepted the offer."),
8203
+ confirmation_thread_ts: z15.string().describe("`thread_ts` from that message's envelope."),
8204
+ confirmation_message_ts: z15.string().describe("`message_ts` from that message's envelope."),
8205
+ confirmation_user_id: z15.string().describe("`user_id` from that message's envelope.")
8206
+ });
8207
+
8132
8208
  // ../shared/src/routes/plugin-catalog.ts
8133
8209
  var EXPLICIT_PLUGIN_CATALOG = [
8134
8210
  {
@@ -8435,7 +8511,7 @@ var MAX_CLIENT_STATE_REQUEST_BYTES = 5 * 1024 * 1024;
8435
8511
  var MAX_CLIENT_STATE_BYTES_PER_USER = 10 * 1024 * 1024;
8436
8512
 
8437
8513
  // ../shared/src/routes/workspaces.ts
8438
- import { z as z13 } from "zod";
8514
+ import { z as z16 } from "zod";
8439
8515
  var WORKSPACE_STATUSES = ["active", "sleeping", "archived", "preparing", "error"];
8440
8516
  var WORKSPACE_STATUS_FILTERS = WORKSPACE_STATUSES.map((status) => status === "error" ? "failed" : status);
8441
8517
  var WORKSPACE_SORT_CHOICES = [
@@ -8459,56 +8535,56 @@ var DEFAULT_WORKSPACE_FILTERS = {
8459
8535
  activity: "any"
8460
8536
  };
8461
8537
  var ONE_DAY_MS = 24 * 60 * 60 * 1e3;
8462
- var terminalRtcCandidateSchema = z13.object({ type: z13.literal("rtc-candidate"), candidate: z13.string(), mid: z13.string() });
8463
- var terminalSocketServerMessageSchema = z13.discriminatedUnion("type", [
8464
- z13.object({ type: z13.literal("output"), data: z13.string() }),
8465
- z13.object({ type: z13.literal("rtc-answer"), sdp: z13.string() }),
8538
+ var terminalRtcCandidateSchema = z16.object({ type: z16.literal("rtc-candidate"), candidate: z16.string(), mid: z16.string() });
8539
+ var terminalSocketServerMessageSchema = z16.discriminatedUnion("type", [
8540
+ z16.object({ type: z16.literal("output"), data: z16.string() }),
8541
+ z16.object({ type: z16.literal("rtc-answer"), sdp: z16.string() }),
8466
8542
  terminalRtcCandidateSchema,
8467
- z13.object({ type: z13.literal("rtc-switch") })
8543
+ z16.object({ type: z16.literal("rtc-switch") })
8468
8544
  ]);
8469
8545
  var TERMINAL_RTC_ICE_SERVER = "stun:stun.l.google.com:19302";
8470
8546
 
8471
8547
  // ../shared/src/routes/workspace-events.ts
8472
- import { z as z14 } from "zod";
8473
- var workspaceChangedEventSchema = z14.discriminatedUnion("type", [
8474
- z14.object({
8475
- type: z14.literal("workspace.changed"),
8476
- workspaceId: z14.string(),
8477
- completion: z14.object({
8478
- workspaceName: z14.string(),
8479
- completedAt: z14.string(),
8480
- processing: z14.boolean().optional()
8548
+ import { z as z17 } from "zod";
8549
+ var workspaceChangedEventSchema = z17.discriminatedUnion("type", [
8550
+ z17.object({
8551
+ type: z17.literal("workspace.changed"),
8552
+ workspaceId: z17.string(),
8553
+ completion: z17.object({
8554
+ workspaceName: z17.string(),
8555
+ completedAt: z17.string(),
8556
+ processing: z17.boolean().optional()
8481
8557
  }).optional(),
8482
- ts: z14.string()
8558
+ ts: z17.string()
8483
8559
  }),
8484
- z14.object({
8485
- type: z14.literal("workspace.chat.changed"),
8486
- workspaceId: z14.string(),
8487
- chatId: z14.string(),
8488
- ts: z14.string()
8560
+ z17.object({
8561
+ type: z17.literal("workspace.chat.changed"),
8562
+ workspaceId: z17.string(),
8563
+ chatId: z17.string(),
8564
+ ts: z17.string()
8489
8565
  }),
8490
- z14.object({ type: z14.literal("presence.changed"), ts: z14.string() }),
8491
- z14.object({
8492
- type: z14.literal("mobile-testing.changed"),
8493
- workspaceId: z14.string(),
8494
- ts: z14.string()
8566
+ z17.object({ type: z17.literal("presence.changed"), ts: z17.string() }),
8567
+ z17.object({
8568
+ type: z17.literal("mobile-testing.changed"),
8569
+ workspaceId: z17.string(),
8570
+ ts: z17.string()
8495
8571
  })
8496
8572
  ]);
8497
8573
 
8498
8574
  // ../shared/src/routes/presence.ts
8499
- import { z as z15 } from "zod";
8500
- var presenceStatusSchema = z15.enum(["online", "typing"]);
8501
- var presenceLocationSchema = z15.object({
8502
- environmentId: z15.string().optional(),
8503
- workspaceId: z15.string().optional()
8575
+ import { z as z18 } from "zod";
8576
+ var presenceStatusSchema = z18.enum(["online", "typing"]);
8577
+ var presenceLocationSchema = z18.object({
8578
+ environmentId: z18.string().optional(),
8579
+ workspaceId: z18.string().optional()
8504
8580
  });
8505
- var presenceEntrySchema = z15.object({
8506
- userId: z15.string(),
8581
+ var presenceEntrySchema = z18.object({
8582
+ userId: z18.string(),
8507
8583
  status: presenceStatusSchema,
8508
8584
  location: presenceLocationSchema,
8509
- ts: z15.string()
8585
+ ts: z18.string()
8510
8586
  });
8511
- var updatePresenceRequestSchema = z15.object({
8587
+ var updatePresenceRequestSchema = z18.object({
8512
8588
  status: presenceStatusSchema,
8513
8589
  location: presenceLocationSchema.optional()
8514
8590
  });
@@ -5,7 +5,7 @@ import {
5
5
  extractCommandProtectionCommandText,
6
6
  isRecord,
7
7
  parseCodeHostPrUrl
8
- } from "./chunk-RMH6PDA7.js";
8
+ } from "./chunk-32UPBL5I.js";
9
9
 
10
10
  // src/services/published-pull-request-urls.ts
11
11
  function publishedPullRequestUrls(result) {
@@ -5,15 +5,15 @@ import {
5
5
  ENGINE_ENV,
6
6
  monolithRequest,
7
7
  setAgentCredentialSnapshot
8
- } from "./chunk-3VGFM7ME.js";
8
+ } from "./chunk-HLLDPEDK.js";
9
9
  import {
10
10
  AppServerProcess,
11
11
  buildCodexAgentEnv
12
- } from "./chunk-4P4NVCXW.js";
12
+ } from "./chunk-FEOJV72E.js";
13
13
  import {
14
14
  SUBPROCESS_MAX_BUFFER,
15
15
  execFileAsync
16
- } from "./chunk-F4ZGMCND.js";
16
+ } from "./chunk-D4BDGH53.js";
17
17
  import {
18
18
  isRecord
19
19
  } from "./chunk-UZSNFLDQ.js";
@@ -27,7 +27,7 @@ import {
27
27
  listOpenAICompatibleModels,
28
28
  readOllamaAuthEnv,
29
29
  resolveOpenAICompatibleModelsUrl
30
- } from "./chunk-RMH6PDA7.js";
30
+ } from "./chunk-32UPBL5I.js";
31
31
 
32
32
  // src/managers/codex-token-manager.ts
33
33
  import { promises as fs } from "fs";
@@ -260,7 +260,7 @@ var CodexTokenManager = class extends BaseRefreshManager {
260
260
  await this.applyCredentialUpdate(++this.credentialGeneration, async () => {
261
261
  await this.applyCredentialsResponse(data);
262
262
  setAgentCredentialSnapshot("codex", data);
263
- const { restartCodexAspHostIfRunning: restartCodexAspHostIfRunning2 } = await import("./asp-host-DSLWM2EA.js");
263
+ const { restartCodexAspHostIfRunning: restartCodexAspHostIfRunning2 } = await import("./asp-host-QVTM4VFE.js");
264
264
  await restartCodexAspHostIfRunning2();
265
265
  });
266
266
  await this.start(true);
@@ -280,7 +280,7 @@ var CodexTokenManager = class extends BaseRefreshManager {
280
280
  await this.applyCredentialUpdate(generation, async () => {
281
281
  await this.applyCredentialsResponse(data);
282
282
  if (restartOnChange && CODEX_AUTH_ENV_KEYS.some((key, index) => process.env[key] !== previousEnv[index])) {
283
- const { restartCodexAspHostIfRunning: restartCodexAspHostIfRunning2 } = await import("./asp-host-DSLWM2EA.js");
283
+ const { restartCodexAspHostIfRunning: restartCodexAspHostIfRunning2 } = await import("./asp-host-QVTM4VFE.js");
284
284
  await restartCodexAspHostIfRunning2();
285
285
  }
286
286
  setAgentCredentialSnapshot("codex", data);
@@ -3,7 +3,7 @@ import { createRequire as __createRequire } from 'node:module';
3
3
  const require = __createRequire(import.meta.url);
4
4
  import {
5
5
  HOOK_EXEC_MAX_BUFFER_BYTES
6
- } from "./chunk-RMH6PDA7.js";
6
+ } from "./chunk-32UPBL5I.js";
7
7
 
8
8
  // src/utils/exec.ts
9
9
  import { exec, execFile } from "child_process";
@@ -3,18 +3,18 @@ import { createRequire as __createRequire } from 'node:module';
3
3
  const require = __createRequire(import.meta.url);
4
4
  import {
5
5
  monolithRequest
6
- } from "./chunk-3VGFM7ME.js";
6
+ } from "./chunk-HLLDPEDK.js";
7
7
  import {
8
8
  SUBPROCESS_MAX_BUFFER,
9
9
  execFileAsync
10
- } from "./chunk-F4ZGMCND.js";
10
+ } from "./chunk-D4BDGH53.js";
11
11
  import {
12
12
  extractCommandProtectionCommandText,
13
13
  findCommandProtectionGitLookups,
14
14
  findGitCommitSignals,
15
15
  findPrMergeSignals,
16
16
  parseCommandProtectionRequest
17
- } from "./chunk-RMH6PDA7.js";
17
+ } from "./chunk-32UPBL5I.js";
18
18
 
19
19
  // src/services/command-protection-service.ts
20
20
  import { readFile, stat } from "fs/promises";
@@ -3,10 +3,10 @@ import { createRequire as __createRequire } from 'node:module';
3
3
  const require = __createRequire(import.meta.url);
4
4
  import {
5
5
  execFileAsync
6
- } from "./chunk-F4ZGMCND.js";
6
+ } from "./chunk-D4BDGH53.js";
7
7
  import {
8
8
  isVersionBelow
9
- } from "./chunk-RMH6PDA7.js";
9
+ } from "./chunk-32UPBL5I.js";
10
10
 
11
11
  // src/utils/codex-agent-env.ts
12
12
  function buildCodexAgentEnv(source = process.env) {
@@ -240,7 +240,7 @@ function getCodexModelProvider(method) {
240
240
  if (method === "foundry") return "azure";
241
241
  return method === "ollama" || method === "openai-compatible" ? "replicas_openai_compatible" : "openai";
242
242
  }
243
- var ENGINE_PACKAGE_VERSION = "0.1.973";
243
+ var ENGINE_PACKAGE_VERSION = "0.1.974";
244
244
  var INITIALIZE_METHOD = "initialize";
245
245
  var INITIALIZED_NOTIFICATION = "initialized";
246
246
  var ACCOUNT_LOGIN_START_METHOD = "account/login/start";
@@ -14,7 +14,7 @@ import {
14
14
  isValidAgentProvider,
15
15
  parsePosixEnvFile,
16
16
  readReplicasRuntimeEnv
17
- } from "./chunk-RMH6PDA7.js";
17
+ } from "./chunk-32UPBL5I.js";
18
18
 
19
19
  // src/runtime-env-loader.ts
20
20
  import { readFileSync } from "fs";
@@ -3,13 +3,13 @@ import { createRequire as __createRequire } from 'node:module';
3
3
  const require = __createRequire(import.meta.url);
4
4
  import {
5
5
  evaluateCommandProtection
6
- } from "./chunk-T65P3LSH.js";
7
- import "./chunk-3VGFM7ME.js";
8
- import "./chunk-F4ZGMCND.js";
6
+ } from "./chunk-ETEMP3CF.js";
7
+ import "./chunk-HLLDPEDK.js";
8
+ import "./chunk-D4BDGH53.js";
9
9
  import {
10
10
  isRecord
11
11
  } from "./chunk-UZSNFLDQ.js";
12
- import "./chunk-RMH6PDA7.js";
12
+ import "./chunk-32UPBL5I.js";
13
13
  import "./chunk-VEQXQN22.js";
14
14
 
15
15
  // src/command-protection-hook.ts
@@ -7,12 +7,12 @@ import {
7
7
  import {
8
8
  AppServerProcess,
9
9
  buildCodexAgentEnv
10
- } from "./chunk-4P4NVCXW.js";
11
- import "./chunk-F4ZGMCND.js";
10
+ } from "./chunk-FEOJV72E.js";
11
+ import "./chunk-D4BDGH53.js";
12
12
  import {
13
13
  AGENT,
14
14
  headlessAgentRequestSchema
15
- } from "./chunk-RMH6PDA7.js";
15
+ } from "./chunk-32UPBL5I.js";
16
16
  import "./chunk-VEQXQN22.js";
17
17
 
18
18
  // src/headless-agent.ts
package/dist/src/index.js CHANGED
@@ -32,7 +32,7 @@ import {
32
32
  reportCommandProtectionBlock,
33
33
  resolveDiffBase,
34
34
  runGitCommand
35
- } from "./chunk-T65P3LSH.js";
35
+ } from "./chunk-ETEMP3CF.js";
36
36
  import {
37
37
  ACCOUNT_RATE_LIMITS_UPDATED_METHOD,
38
38
  AGENT_MESSAGE_DELTA_METHOD,
@@ -57,7 +57,7 @@ import {
57
57
  } from "./chunk-P73LGPQO.js";
58
58
  import {
59
59
  publishedPullRequestUrls
60
- } from "./chunk-OKFWM3XR.js";
60
+ } from "./chunk-AWKW6SD6.js";
61
61
  import {
62
62
  BaseRefreshManager,
63
63
  CodexAspAuthMethodChangedError,
@@ -72,7 +72,7 @@ import {
72
72
  refreshDelayMs,
73
73
  restartCodexAspHost,
74
74
  routineRefreshExclusions
75
- } from "./chunk-NHD7MMAW.js";
75
+ } from "./chunk-BXCLRUIK.js";
76
76
  import {
77
77
  ENGINE_ENV,
78
78
  monolithRequest,
@@ -80,16 +80,16 @@ import {
80
80
  readRuntimeEnvFile,
81
81
  reloadEngineEnv,
82
82
  setAgentCredentialSnapshot
83
- } from "./chunk-3VGFM7ME.js";
83
+ } from "./chunk-HLLDPEDK.js";
84
84
  import {
85
85
  AspClient,
86
86
  getCodexModelProvider
87
- } from "./chunk-4P4NVCXW.js";
87
+ } from "./chunk-FEOJV72E.js";
88
88
  import {
89
89
  SUBPROCESS_MAX_BUFFER,
90
90
  execAsync,
91
91
  execFileAsync
92
- } from "./chunk-F4ZGMCND.js";
92
+ } from "./chunk-D4BDGH53.js";
93
93
  import {
94
94
  isRecord as isRecord2
95
95
  } from "./chunk-UZSNFLDQ.js";
@@ -310,7 +310,7 @@ import {
310
310
  workspaceCredentialProviderSchema,
311
311
  workspaceTokenRequestSchema,
312
312
  workspaceTokenResponseSchema
313
- } from "./chunk-RMH6PDA7.js";
313
+ } from "./chunk-32UPBL5I.js";
314
314
  import {
315
315
  cloneMcpConfig,
316
316
  ensureCompatibilityImports,
@@ -3,13 +3,13 @@ import { createRequire as __createRequire } from 'node:module';
3
3
  const require = __createRequire(import.meta.url);
4
4
  import {
5
5
  publishedPullRequestUrls
6
- } from "./chunk-OKFWM3XR.js";
6
+ } from "./chunk-AWKW6SD6.js";
7
7
  import {
8
8
  isRecord
9
9
  } from "./chunk-UZSNFLDQ.js";
10
10
  import {
11
11
  shouldRefreshPullRequests
12
- } from "./chunk-RMH6PDA7.js";
12
+ } from "./chunk-32UPBL5I.js";
13
13
  import "./chunk-VEQXQN22.js";
14
14
 
15
15
  // src/services/post-tool-pr-notifier.ts
@@ -9,7 +9,7 @@ import {
9
9
  spawnSubagentRequestSchema,
10
10
  subagentResponseSchema,
11
11
  waitSubagentRequestSchema
12
- } from "./chunk-RMH6PDA7.js";
12
+ } from "./chunk-32UPBL5I.js";
13
13
  import "./chunk-VEQXQN22.js";
14
14
 
15
15
  // src/subagent-mcp.ts
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "replicas-engine",
3
- "version": "0.1.973",
3
+ "version": "0.1.974",
4
4
  "description": "Lightweight API server for Replicas workspaces",
5
5
  "type": "module",
6
6
  "main": "dist/src/index.js",