replicas-engine 0.1.1601 → 0.1.1603

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1116,17 +1116,17 @@ var require_luxon = __commonJS({
1116
1116
  constructor(dt, intl, opts) {
1117
1117
  this.opts = opts;
1118
1118
  this.originalZone = void 0;
1119
- let z44 = void 0;
1119
+ let z45 = void 0;
1120
1120
  if (this.opts.timeZone) {
1121
1121
  this.dt = dt;
1122
1122
  } else if (dt.zone.type === "fixed") {
1123
1123
  const gmtOffset = -1 * (dt.offset / 60);
1124
1124
  const offsetZ = gmtOffset >= 0 ? `Etc/GMT+${gmtOffset}` : `Etc/GMT${gmtOffset}`;
1125
1125
  if (dt.offset !== 0 && IANAZone.create(offsetZ).valid) {
1126
- z44 = offsetZ;
1126
+ z45 = offsetZ;
1127
1127
  this.dt = dt;
1128
1128
  } else {
1129
- z44 = "UTC";
1129
+ z45 = "UTC";
1130
1130
  this.dt = dt.offset === 0 ? dt : dt.setZone("UTC").plus({
1131
1131
  minutes: dt.offset
1132
1132
  });
@@ -1136,9 +1136,9 @@ var require_luxon = __commonJS({
1136
1136
  this.dt = dt;
1137
1137
  } else if (dt.zone.type === "iana") {
1138
1138
  this.dt = dt;
1139
- z44 = dt.zone.name;
1139
+ z45 = dt.zone.name;
1140
1140
  } else {
1141
- z44 = "UTC";
1141
+ z45 = "UTC";
1142
1142
  this.dt = dt.setZone("UTC").plus({
1143
1143
  minutes: dt.offset
1144
1144
  });
@@ -1147,7 +1147,7 @@ var require_luxon = __commonJS({
1147
1147
  const intlOpts = {
1148
1148
  ...this.opts
1149
1149
  };
1150
- intlOpts.timeZone = intlOpts.timeZone || z44;
1150
+ intlOpts.timeZone = intlOpts.timeZone || z45;
1151
1151
  this.dtf = getCachedDTF(intl, intlOpts);
1152
1152
  }
1153
1153
  format() {
@@ -9381,6 +9381,7 @@ var WEB_APP_PATHS = {
9381
9381
  accountIntegrations: `${DASHBOARD_PATH}/account/integrations`,
9382
9382
  accountApiKeys: `${DASHBOARD_PATH}/account/api-keys`,
9383
9383
  accountPreferences: `${DASHBOARD_PATH}/account/preferences`,
9384
+ accountKeyboardShortcuts: `${DASHBOARD_PATH}/account/keyboard-shortcuts`,
9384
9385
  fullscreenWorkspaces: "/workspaces"
9385
9386
  };
9386
9387
  var UUID_PATTERN = "????????-????-????-????-????????????";
@@ -10947,7 +10948,7 @@ var ENGINE_SLEEP_PATH = "/lifecycle/sleep";
10947
10948
  var updateChatDisplayNameRequestSchema = z9.object({
10948
10949
  displayName: z9.string().trim().min(1).max(100)
10949
10950
  });
10950
- var createChatRequestSchema = z9.object({
10951
+ var createChatFields = z9.object({
10951
10952
  id: z9.string().uuid().optional(),
10952
10953
  createdAt: z9.string().datetime().optional(),
10953
10954
  provider: z9.enum(ENGINE_AGENT_PROVIDERS),
@@ -10958,9 +10959,11 @@ var createChatRequestSchema = z9.object({
10958
10959
  kind: z9.enum(CHAT_KINDS).optional(),
10959
10960
  sideChat: z9.boolean().optional(),
10960
10961
  clientRequestId: z9.string().min(1).max(128).optional()
10961
- }).refine((request) => !request.sideChat || request.forkSourceChatId !== void 0 && request.parentChatId === request.forkSourceChatId, {
10962
+ });
10963
+ var createChatRequestSchema = createChatFields.refine((request) => !request.sideChat || request.forkSourceChatId !== void 0 && request.parentChatId === request.forkSourceChatId, {
10962
10964
  message: "A side chat must fork its parent chat"
10963
10965
  });
10966
+ var createHarnessChatRequestSchema = createChatFields.pick({ id: true, title: true }).extend({ provider: z9.literal(AGENT.REPLICAS) });
10964
10967
  var spawnSubagentRequestSchema = z9.object({
10965
10968
  provider: z9.enum(ENGINE_AGENT_PROVIDERS),
10966
10969
  prompt: z9.string().min(1),
@@ -13147,7 +13150,7 @@ Every Replicas workspace is a remote Linux VM. Repositories are cloned under \`~
13147
13150
  | Piece | When it runs | Put here |
13148
13151
  | --- | --- | --- |
13149
13152
  | **Warm hook** | Once, while Replicas builds the warm-pool snapshot for the environment. Its *filesystem* state is baked into every new workspace; its *processes* are not. Default timeout 60 minutes. | Slow, deterministic setup: dependency installs from the lockfile, toolchain downloads, \`docker pull\`, one-time builds, code generation. |
13150
- | **Start hook** | On every workspace boot, before the agent starts working. Default timeout 5 minutes. | Fast per-boot reconciliation: start daemons and databases, run migrations against local services, launch dev servers with \`replicas service start\`, health checks. Must be idempotent. |
13153
+ | **Start hook** | On every workspace boot, alongside the agent, which is told to wait for it before using the setup. Default timeout 5 minutes. | Fast per-boot reconciliation: start daemons and databases, run migrations against local services, launch dev servers with \`replicas service start\`, health checks. Must be idempotent. |
13151
13154
  | **System prompt** | Injected into the agent's instructions for every workspace in the environment. | Only what an agent cannot learn from the repository itself: team conventions, review expectations, how to verify, gotchas you hit while setting up. |
13152
13155
  | **Variables** | Exported into every workspace (and available inside hooks). Values are encrypted. | API keys, tokens, feature flags, local service URLs. |
13153
13156
  | **Files** | Materialized on the workspace filesystem at boot. | \`.env\` files, dotfiles, config that must not be committed. |
@@ -15373,6 +15376,7 @@ var DEFAULT_USER_PREFERENCES = {
15373
15376
  appshot_shortcut: "command",
15374
15377
  appshot_destination: "automatic",
15375
15378
  appshot_sound: true,
15379
+ keyboard_shortcuts: {},
15376
15380
  mothership_tour_seen: false,
15377
15381
  slack_settings_moved_notice: false,
15378
15382
  mothership_board_opened: false,
@@ -15388,7 +15392,10 @@ var DEFAULT_USER_PREFERENCES = {
15388
15392
  workspace_alerts: {},
15389
15393
  automation_alerts: {},
15390
15394
  push_types: { needs_you: true, finished: true, automations: true, usage_limit: true },
15391
- push_when_active: "wait"
15395
+ push_when_active: "wait",
15396
+ chat_text_size: "default",
15397
+ app_font: "inter",
15398
+ code_font: "geist-mono"
15392
15399
  };
15393
15400
  function defaultReplicasAgentAbilities() {
15394
15401
  const abilities = {};
@@ -18911,6 +18918,101 @@ var TaskAccumulator = class {
18911
18918
  }
18912
18919
  };
18913
18920
 
18921
+ // ../shared/src/display-message/parsers/replicas-parser.ts
18922
+ var HARNESS_EVENT_TYPE_PREFIX = "harness-";
18923
+ function contentBlocks(value) {
18924
+ return Array.isArray(value) ? value.filter(isRecord) : [];
18925
+ }
18926
+ function blockImages(blocks) {
18927
+ return blocks.flatMap((block) => block.type === "image" && typeof block.data === "string" && typeof block.mimeType === "string" ? [{ type: "image", mediaType: block.mimeType, data: block.data }] : []);
18928
+ }
18929
+ function toolCallMessage(id, name, args, timestamp, result) {
18930
+ const status = !result ? "in_progress" : result.isError ? "failed" : "completed";
18931
+ if (name === "bash" && typeof args.command === "string") {
18932
+ return { id, type: "command", command: args.command, output: result?.output, ...result?.exitCode !== void 0 ? { exitCode: result.exitCode } : {}, status, timestamp };
18933
+ }
18934
+ if ((name === "write" || name === "edit") && typeof args.path === "string") {
18935
+ return { id, type: "file_change", changes: [{ path: args.path, kind: name === "write" ? "add" : "update" }], status, timestamp };
18936
+ }
18937
+ return createCallDisplayMessage({ id, server: "replicas", tool: name, input: args, output: result?.output, status, timestamp });
18938
+ }
18939
+ function parseReplicasEvents(events) {
18940
+ const messages = [];
18941
+ const toolCalls = /* @__PURE__ */ new Map();
18942
+ const lastSavedAssistantMs = Math.max(0, ...events.filter((event) => event.type === `${HARNESS_EVENT_TYPE_PREFIX}assistant_message`).map((event) => Date.parse(event.timestamp)));
18943
+ events.forEach((event) => {
18944
+ const { payload, timestamp } = event;
18945
+ const message2 = isRecord(payload.message) ? payload.message : {};
18946
+ switch (event.type) {
18947
+ // The client's copy of a sent prompt, shown until the worker saves it under the same message id.
18948
+ case "event_msg": {
18949
+ if (payload.type !== "user_message" || typeof payload.message !== "string") return;
18950
+ const images = userMessageImages(payload.images);
18951
+ messages.push({ id: getUserMessageId(event) ?? `replicas-pending-${timestamp}`, type: "user", content: payload.message, ...images ? { images } : {}, timestamp });
18952
+ return;
18953
+ }
18954
+ case `${HARNESS_EVENT_TYPE_PREFIX}user_message`: {
18955
+ const images = blockImages(contentBlocks(message2.content));
18956
+ const messageId = payload[USER_MESSAGE_ID_PAYLOAD_KEY];
18957
+ messages.push({
18958
+ id: typeof messageId === "string" ? messageId : `replicas-user-${String(payload.seq)}`,
18959
+ type: "user",
18960
+ content: extractToolResultText(message2.content),
18961
+ ...images.length ? { images } : {},
18962
+ timestamp
18963
+ });
18964
+ return;
18965
+ }
18966
+ case `${HARNESS_EVENT_TYPE_PREFIX}assistant_message`: {
18967
+ contentBlocks(message2.content).forEach((block, blockIndex) => {
18968
+ const id = `replicas-${String(payload.seq)}-${blockIndex}`;
18969
+ if (block.type === "text" && typeof block.text === "string" && block.text) messages.push({ id, type: "agent", content: block.text, timestamp });
18970
+ if (block.type === "thinking" && typeof block.thinking === "string" && block.thinking) messages.push({ id, type: "reasoning", content: block.thinking, status: "completed", timestamp });
18971
+ if (block.type === "toolCall" && typeof block.id === "string" && typeof block.name === "string") {
18972
+ const call = { name: block.name, args: isRecord(block.arguments) ? block.arguments : {}, timestamp };
18973
+ toolCalls.set(block.id, call);
18974
+ messages.push(toolCallMessage(`replicas-tool-${block.id}`, call.name, call.args, timestamp));
18975
+ }
18976
+ });
18977
+ if (message2.stopReason === "error") {
18978
+ messages.push({
18979
+ id: `replicas-error-${String(payload.seq)}`,
18980
+ type: "error",
18981
+ message: formatInferenceError(typeof message2.errorMessage === "string" && message2.errorMessage ? message2.errorMessage : "The model request failed", {
18982
+ ...typeof message2.provider === "string" ? { provider: message2.provider } : {},
18983
+ ...typeof message2.model === "string" ? { model: message2.model } : {}
18984
+ }),
18985
+ timestamp
18986
+ });
18987
+ }
18988
+ return;
18989
+ }
18990
+ case `${HARNESS_EVENT_TYPE_PREFIX}tool_result`: {
18991
+ if (typeof message2.toolCallId !== "string") return;
18992
+ const call = toolCalls.get(message2.toolCallId) ?? { name: typeof message2.toolName === "string" ? message2.toolName : "tool", args: {}, timestamp };
18993
+ const exitCode = isRecord(message2.details) && typeof message2.details.exitCode === "number" ? message2.details.exitCode : void 0;
18994
+ upsertDisplayMessage(messages, toolCallMessage(`replicas-tool-${message2.toolCallId}`, call.name, call.args, call.timestamp, {
18995
+ output: extractToolResultText(message2.content) || void 0,
18996
+ isError: message2.isError === true,
18997
+ exitCode
18998
+ }));
18999
+ return;
19000
+ }
19001
+ case `${HARNESS_EVENT_TYPE_PREFIX}error`:
19002
+ messages.push({ id: `replicas-error-${String(payload.seq)}`, type: "error", message: stringifyDisplayValue(payload.message) ?? "The agent stopped with an error", timestamp });
19003
+ return;
19004
+ case CLAUDE_PARTIAL_MESSAGE_EVENT_TYPE: {
19005
+ const partial = coerceClaudePartialMessagePayload(payload);
19006
+ if (!partial || Date.parse(event.timestamp) <= lastSavedAssistantMs) return;
19007
+ if (partial.thinking) upsertDisplayMessage(messages, { id: `replicas-partial-${partial.streamId}-thinking`, type: "reasoning", content: partial.thinking, status: "in_progress", timestamp });
19008
+ if (partial.text) upsertDisplayMessage(messages, { id: `replicas-partial-${partial.streamId}`, type: "agent", content: partial.text, timestamp });
19009
+ return;
19010
+ }
19011
+ }
19012
+ });
19013
+ return messages;
19014
+ }
19015
+
18914
19016
  // ../shared/src/display-message/parsers/claude-parser.ts
18915
19017
  var ABORTED_TERMINAL_REASONS = /* @__PURE__ */ new Set(["aborted_streaming", "aborted_tools"]);
18916
19018
  var COMMAND_TOOL_NAMES = /* @__PURE__ */ new Set(["Bash", "bash", "shell"]);
@@ -19228,7 +19330,7 @@ function parseClaudeEvents(events, parentToolUseId) {
19228
19330
  }
19229
19331
  if (event.type === "claude-assistant") {
19230
19332
  const messageId = event.payload.message?.id;
19231
- const contentBlocks = normalizeContentBlocks(event.payload.message?.content);
19333
+ const contentBlocks2 = normalizeContentBlocks(event.payload.message?.content);
19232
19334
  const messageKey = messageId || event.timestamp;
19233
19335
  const localCommand = event.payload.local_command_run;
19234
19336
  const goalArgs = isRecord(localCommand) && localCommand.command === GOAL_TOOL_NAME && typeof localCommand.args === "string" ? localCommand.args.trim() : "";
@@ -19250,12 +19352,12 @@ function parseClaudeEvents(events, parentToolUseId) {
19250
19352
  if (liveStreamId !== null && liveStreamId !== messageId) {
19251
19353
  supersededStreamIds.add(liveStreamId);
19252
19354
  }
19253
- if (contentBlocks.some((block) => block.type === "text" && block.text)) {
19355
+ if (contentBlocks2.some((block) => block.type === "text" && block.text)) {
19254
19356
  completedStreamIds.add(messageId);
19255
19357
  liveStreamId = null;
19256
19358
  }
19257
19359
  }
19258
- const thinkingBlocks = contentBlocks.flatMap(
19360
+ const thinkingBlocks = contentBlocks2.flatMap(
19259
19361
  (block) => block.type === "thinking" && typeof block.thinking === "string" ? [block.thinking] : []
19260
19362
  );
19261
19363
  if (thinkingBlocks.length > 0) {
@@ -19275,7 +19377,7 @@ function parseClaudeEvents(events, parentToolUseId) {
19275
19377
  upsertMessage(reasoningMessage);
19276
19378
  }
19277
19379
  }
19278
- contentBlocks.forEach((block) => {
19380
+ contentBlocks2.forEach((block) => {
19279
19381
  if (block.type === "text" && block.text) {
19280
19382
  const textIndex = assistantTextCounts.get(messageKey) ?? 0;
19281
19383
  assistantTextCounts.set(messageKey, textIndex + 1);
@@ -19571,6 +19673,9 @@ function parseProviderEvents(events, agentType, parentToolUseId) {
19571
19673
  if (agentType === "pi") {
19572
19674
  return parsePiEvents(events);
19573
19675
  }
19676
+ if (agentType === "replicas") {
19677
+ return parseReplicasEvents(events);
19678
+ }
19574
19679
  return parseClaudeEvents(events, parentToolUseId);
19575
19680
  }
19576
19681
  function parseDisplayMessages(events, agentType, options = {}) {
@@ -20476,7 +20581,7 @@ var VOICE_WAVEFORM = {
20476
20581
  };
20477
20582
 
20478
20583
  // ../shared/src/e2b.ts
20479
- var E2B_TEMPLATE_NAME = "replicas-sandbox-2026-11-16-v16";
20584
+ var E2B_TEMPLATE_NAME = "replicas-sandbox-2026-11-16-v19";
20480
20585
 
20481
20586
  // ../shared/src/e2b-retry.ts
20482
20587
  var DEFAULT_BACKOFFS_MS = [2e3, 5e3];
@@ -20759,9 +20864,9 @@ var KEYBOARD_SHORTCUTS = {
20759
20864
  keys: { key: "ArrowDown", mod: true, alt: true, shift: true },
20760
20865
  linuxKeys: { key: "ArrowDown", alt: true, shift: true }
20761
20866
  },
20762
- jumpToWorkspace: { label: "Workspace 1\u20139 in the sidebar", group: "Navigation", desktopKeys: { key: "1", mod: true } },
20763
- goBack: { label: "Back", group: "Navigation", desktopKeys: { key: "[", mod: true } },
20764
- goForward: { label: "Forward", group: "Navigation", desktopKeys: { key: "]", mod: true } },
20867
+ jumpToWorkspace: { label: "Workspace 1\u20139 in the sidebar", group: "Navigation", desktopKeys: { key: "1", mod: true }, fixed: true },
20868
+ goBack: { label: "Back", group: "Navigation", desktopKeys: { key: "[", mod: true }, fixed: true },
20869
+ goForward: { label: "Forward", group: "Navigation", desktopKeys: { key: "]", mod: true }, fixed: true },
20765
20870
  stopAgent: { label: "Stop the agent", group: "Chat", keys: { key: "Escape" } },
20766
20871
  newChat: { label: "New chat", group: "Chat", desktopKeys: { key: "t", mod: true } },
20767
20872
  previousChat: {
@@ -20798,15 +20903,15 @@ var KEYBOARD_SHORTCUTS = {
20798
20903
  keys: { key: "l", alt: true },
20799
20904
  macKeys: { key: "Tab", alt: true }
20800
20905
  },
20801
- send: { label: "Send", group: "Composer", keys: { key: "Enter" } },
20802
- sendAlternate: { label: "Queue or steer instead", group: "Composer", keys: { key: "Enter", alt: true } },
20803
- newLine: { label: "New line", group: "Composer", keys: { key: "Enter", shift: true } },
20906
+ send: { label: "Send", group: "Composer", keys: { key: "Enter" }, fixed: true },
20907
+ sendAlternate: { label: "Queue or steer instead", group: "Composer", keys: { key: "Enter", alt: true }, fixed: true },
20908
+ newLine: { label: "New line", group: "Composer", keys: { key: "Enter", shift: true }, fixed: true },
20804
20909
  toggleTaskMode: { label: "Switch Plan / Build", group: "Composer", keys: { key: "Tab", shift: true } },
20805
20910
  toggleVoiceInput: { label: "Voice input", group: "Composer", keys: { key: " ", mod: true, shift: true } },
20806
- previousPrompt: { label: "Previous prompt", group: "Composer", keys: { key: "ArrowUp" } },
20911
+ previousPrompt: { label: "Previous prompt", group: "Composer", keys: { key: "ArrowUp" }, fixed: true },
20807
20912
  searchPromptHistory: { label: "Search prompt history", group: "Composer", keys: { key: "r", ctrl: true } },
20808
- mentionFile: { label: "Mention a file", group: "Composer", keys: { key: "@" } },
20809
- slashCommand: { label: "Commands and skills", group: "Composer", keys: { key: "/" } },
20913
+ mentionFile: { label: "Mention a file", group: "Composer", keys: { key: "@" }, fixed: true },
20914
+ slashCommand: { label: "Commands and skills", group: "Composer", keys: { key: "/" }, fixed: true },
20810
20915
  previousCanvasItem: { label: "Previous item", group: "Canvas", keys: { key: "ArrowLeft" } },
20811
20916
  nextCanvasItem: { label: "Next item", group: "Canvas", keys: { key: "ArrowRight" } },
20812
20917
  exitCanvasFullScreen: { label: "Exit full screen", group: "Canvas", keys: { key: "Escape" } },
@@ -21103,6 +21208,32 @@ var harnessEventBodySchema = z32.discriminatedUnion("type", [
21103
21208
  z32.object({ type: z32.literal("status"), payload: z32.looseObject({ status: z32.enum(HARNESS_THREAD_STATUSES) }) }),
21104
21209
  z32.object({ type: z32.literal("error"), payload: z32.looseObject({ message: z32.string() }) })
21105
21210
  ]);
21211
+ var harnessLiveMessageSchema = z32.union([
21212
+ z32.object({ type: z32.literal("delta"), streamId: z32.string(), text: z32.string() }),
21213
+ z32.object({ type: z32.literal("delta"), streamId: z32.string(), thinking: z32.string() }),
21214
+ z32.object({ type: z32.literal("delta"), streamId: z32.string(), toolCall: z32.object({ id: z32.string(), name: z32.string(), argumentsDelta: z32.string() }) }),
21215
+ z32.object({ type: z32.literal("step_saved"), seq: z32.number() }),
21216
+ z32.object({ type: z32.literal("status"), status: z32.enum(HARNESS_THREAD_STATUSES) })
21217
+ ]);
21218
+
21219
+ // ../shared/src/harness/worker-routes.ts
21220
+ import { z as z33 } from "zod";
21221
+ var harnessWorkerEngineRequestSchema = z33.object({
21222
+ /** The engine we were given didn't answer, so the monolith checks the provider instead of trusting the workspace's status. */
21223
+ unreachable: z33.boolean().optional()
21224
+ });
21225
+ var harnessWorkerEngineResponseSchema = z33.discriminatedUnion("status", [
21226
+ z33.object({ status: z33.literal("ready"), engineUrl: z33.string(), headers: z33.record(z33.string(), z33.string()) }),
21227
+ z33.object({ status: z33.literal("waking") })
21228
+ ]);
21229
+ var harnessWorkerCredentialRequestSchema = z33.object({
21230
+ /** The credential the model rejected, so the monolith refreshes it or moves to the next one instead of handing it back. */
21231
+ failedCredential: agentCredentialSnapshotSchema.optional()
21232
+ });
21233
+ var harnessWorkerCredentialResponseSchema = z33.discriminatedUnion("method", [
21234
+ z33.object({ method: z33.literal("oauth"), accessToken: z33.string(), expiresAt: z33.string(), credential: agentCredentialSnapshotSchema }),
21235
+ z33.object({ method: z33.literal("api_key"), apiKey: z33.string(), credential: agentCredentialSnapshotSchema })
21236
+ ]);
21106
21237
 
21107
21238
  // ../shared/src/auth-errors.ts
21108
21239
  var AUTHENTICATION_ERROR_PATTERNS = [
@@ -21166,10 +21297,10 @@ var RECONNECT_GIVE_UP_MS = 2 * 6e4;
21166
21297
  var encoder3 = new TextEncoder();
21167
21298
 
21168
21299
  // ../shared/src/routes/billing.ts
21169
- import { z as z33 } from "zod";
21300
+ import { z as z34 } from "zod";
21170
21301
  var SOURCE_LIMIT_SOURCES = ["limrun", "modal"];
21171
- var usageLimitCentsSchema = z33.number().int().min(100).max(1e8);
21172
- var sourceLimitsCentsSchema = z33.partialRecord(z33.enum(SOURCE_LIMIT_SOURCES), usageLimitCentsSchema);
21302
+ var usageLimitCentsSchema = z34.number().int().min(100).max(1e8);
21303
+ var sourceLimitsCentsSchema = z34.partialRecord(z34.enum(SOURCE_LIMIT_SOURCES), usageLimitCentsSchema);
21173
21304
 
21174
21305
  // ../shared/src/routes/codex.ts
21175
21306
  var CODEX_AUTH_ENV_KEYS = [
@@ -21323,7 +21454,7 @@ var CLAUDE_AUTH_ENV_KEYS_BY_METHOD = {
21323
21454
  };
21324
21455
 
21325
21456
  // ../shared/src/routes/command-protection.ts
21326
- import { z as z34 } from "zod";
21457
+ import { z as z35 } from "zod";
21327
21458
 
21328
21459
  // ../shared/src/git-invocations.ts
21329
21460
  var COMMIT_VALUE_OPTIONS = /* @__PURE__ */ new Set(["message", "file", "trailer", "reuse-message", "reedit-message", "fixup", "squash", "template", "author", "date", "cleanup", "pathspec-from-file"]);
@@ -21414,29 +21545,35 @@ function findCheckoutTarget(args) {
21414
21545
  }
21415
21546
 
21416
21547
  // ../shared/src/routes/command-protection.ts
21417
- var commandProtectionRepoStateSchema = z34.object({
21418
- branch: z34.string().nullable(),
21419
- defaultBranch: z34.string().nullable(),
21420
- pushBranch: z34.string().nullable(),
21421
- pushConfig: z34.string().nullable(),
21422
- headMessage: z34.string().nullable(),
21423
- mergeInProgress: z34.boolean().optional()
21548
+ var commandProtectionRepoStateSchema = z35.object({
21549
+ branch: z35.string().nullable(),
21550
+ defaultBranch: z35.string().nullable(),
21551
+ pushBranch: z35.string().nullable(),
21552
+ pushConfig: z35.string().nullable(),
21553
+ headMessage: z35.string().nullable(),
21554
+ mergeInProgress: z35.boolean().optional()
21424
21555
  });
21425
- var commandProtectionEvaluateRequestSchema = z34.object({
21426
- provider: z34.enum(["claude", "codex", "cursor", "opencode", "pi"]),
21427
- source: z34.enum(["claude_pre_tool_use", "codex_approval_request", "cursor_pre_tool_use", "opencode_pre_tool_use", "pi_tool_call"]),
21428
- toolName: z34.string(),
21429
- toolInput: z34.unknown(),
21430
- command: z34.string().nullish(),
21431
- cwd: z34.string().nullish(),
21432
- toolUseId: z34.string().nullish(),
21556
+ var commandProtectionEvaluateRequestSchema = z35.object({
21557
+ provider: z35.enum(["claude", "codex", "cursor", "opencode", "pi", "harness"]),
21558
+ source: z35.enum(["claude_pre_tool_use", "codex_approval_request", "cursor_pre_tool_use", "opencode_pre_tool_use", "pi_tool_call", "harness_tool_call"]),
21559
+ toolName: z35.string(),
21560
+ toolInput: z35.unknown(),
21561
+ command: z35.string().nullish(),
21562
+ cwd: z35.string().nullish(),
21563
+ toolUseId: z35.string().nullish(),
21433
21564
  // Read by the engine before the command runs, keyed by absolute path, so the
21434
21565
  // policy can see branches and commit messages the command text only references.
21435
- gitContext: z34.object({
21436
- repos: z34.record(z34.string(), commandProtectionRepoStateSchema),
21437
- messageFiles: z34.record(z34.string(), z34.string())
21566
+ gitContext: z35.object({
21567
+ repos: z35.record(z35.string(), commandProtectionRepoStateSchema),
21568
+ messageFiles: z35.record(z35.string(), z35.string())
21438
21569
  }).optional()
21439
21570
  });
21571
+ var commandProtectionEvaluateResponseSchema = z35.object({
21572
+ allowed: z35.boolean(),
21573
+ enabled: z35.boolean(),
21574
+ reason: z35.string().optional(),
21575
+ matchedSignals: z35.array(z35.string()).optional()
21576
+ });
21440
21577
  var COMMAND_PROTECTION_COMMAND_KEYS = ["command", "cmd", "script", "query", "endpoint", "path", "url", "mutation"];
21441
21578
  function stringifyCommandProtectionInput(value) {
21442
21579
  if (typeof value === "string") return value;
@@ -21626,6 +21763,26 @@ function findScoutRepoWriteSignals(parsed) {
21626
21763
  })
21627
21764
  ])];
21628
21765
  }
21766
+ var COMMAND_PROTECTION_REPO_GIT_ARGS = [
21767
+ ["symbolic-ref", "--quiet", "--short", "HEAD"],
21768
+ ["symbolic-ref", "--short", "refs/remotes/origin/HEAD"],
21769
+ ["rev-parse", "--abbrev-ref", "--symbolic-full-name", "@{push}"],
21770
+ ["config", "--get-regexp", "^(push\\.default|push\\.pushoption|remote\\..+\\.push)$"],
21771
+ ["log", "-1", "--format=%B"],
21772
+ ["rev-parse", "--quiet", "--verify", "MERGE_HEAD"]
21773
+ ];
21774
+ var COMMAND_PROTECTION_MAX_MESSAGE_FILE_BYTES = 64 * 1024;
21775
+ function toCommandProtectionRepoState(outputs) {
21776
+ const [branch, originHead, pushBranch, pushConfig, headMessage, mergeHead] = outputs.map((output) => output || null);
21777
+ return {
21778
+ branch: branch ?? null,
21779
+ defaultBranch: originHead?.match(/^origin\/(.+)$/)?.[1] ?? null,
21780
+ pushBranch: pushBranch?.replace(/^[^/]+\//, "") ?? null,
21781
+ pushConfig: pushConfig ?? null,
21782
+ headMessage: headMessage ?? null,
21783
+ mergeInProgress: Boolean(mergeHead)
21784
+ };
21785
+ }
21629
21786
  function findCommandProtectionGitLookups({ invocations }) {
21630
21787
  const writes = invocations.filter(({ subcommand }) => subcommand === "commit" || subcommand === "push");
21631
21788
  const messageFiles = writes.flatMap(({ subcommand, args, dir, command }) => {
@@ -21655,125 +21812,125 @@ function shouldRefreshPullRequests(toolName, toolInput) {
21655
21812
  }
21656
21813
 
21657
21814
  // ../shared/src/routes/scout.ts
21658
- import { z as z35 } from "zod";
21815
+ import { z as z36 } from "zod";
21659
21816
  var SCOUT_LINEAR_ACTIONS = ["ask", "start"];
21660
- var scoutLinearSessionIntentRequestSchema = z35.object({
21661
- comment_id: z35.string().trim().min(1).describe("Id of the Linear comment the session will be created on."),
21662
- action: z35.enum(SCOUT_LINEAR_ACTIONS).describe("`ask` when the comment is a clarifying question, `start` when it hands off the task.")
21817
+ var scoutLinearSessionIntentRequestSchema = z36.object({
21818
+ comment_id: z36.string().trim().min(1).describe("Id of the Linear comment the session will be created on."),
21819
+ action: z36.enum(SCOUT_LINEAR_ACTIONS).describe("`ask` when the comment is a clarifying question, `start` when it hands off the task.")
21663
21820
  });
21664
- var scoutLinearStartRequestSchema = z35.object({
21665
- issue_id: z35.string().describe("Linear issue id from the envelope's `issue_id`."),
21666
- agent_session_id: z35.string().describe("Existing Linear agent session id from the envelope's `agent_session_id`."),
21667
- prompt: z35.string().trim().min(1).describe("The latest request, in its author's words. The workspace already receives the issue and its comments.")
21821
+ var scoutLinearStartRequestSchema = z36.object({
21822
+ issue_id: z36.string().describe("Linear issue id from the envelope's `issue_id`."),
21823
+ agent_session_id: z36.string().describe("Existing Linear agent session id from the envelope's `agent_session_id`."),
21824
+ prompt: z36.string().trim().min(1).describe("The latest request, in its author's words. The workspace already receives the issue and its comments.")
21668
21825
  });
21669
- var scoutRouteLinearTicketRequestSchema = z35.object({
21670
- agent_session_id: z35.string().trim().min(1).describe("The ticket's `agent_session_id` from the envelope."),
21671
- environment_id: z35.string().trim().min(1).optional().describe("Start the ticket in this environment."),
21672
- mothership_id: z35.string().trim().min(1).optional().describe("Hand the ticket to this Mothership instead.")
21826
+ var scoutRouteLinearTicketRequestSchema = z36.object({
21827
+ agent_session_id: z36.string().trim().min(1).describe("The ticket's `agent_session_id` from the envelope."),
21828
+ environment_id: z36.string().trim().min(1).optional().describe("Start the ticket in this environment."),
21829
+ mothership_id: z36.string().trim().min(1).optional().describe("Hand the ticket to this Mothership instead.")
21673
21830
  }).refine((args) => !(args.environment_id && args.mothership_id), "Pass environment_id or mothership_id, not both.");
21674
- var slackChannelIdSchema = z35.string().describe("Slack channel id from the envelope's `channel_id`.");
21675
- var slackThreadTsSchema = z35.string().describe("Slack thread timestamp from the envelope's `thread_ts`.");
21676
- var scoutSlackMessageReferenceSchema = z35.object({
21831
+ var slackChannelIdSchema = z36.string().describe("Slack channel id from the envelope's `channel_id`.");
21832
+ var slackThreadTsSchema = z36.string().describe("Slack thread timestamp from the envelope's `thread_ts`.");
21833
+ var scoutSlackMessageReferenceSchema = z36.object({
21677
21834
  channel_id: slackChannelIdSchema,
21678
21835
  thread_ts: slackThreadTsSchema,
21679
- message_ts: z35.string().describe("The envelope's `message_ts`. The server verifies this message and its author."),
21680
- user_id: z35.string().describe("Slack user id of that message's author (the envelope's `user_id`).")
21836
+ message_ts: z36.string().describe("The envelope's `message_ts`. The server verifies this message and its author."),
21837
+ user_id: z36.string().describe("Slack user id of that message's author (the envelope's `user_id`).")
21681
21838
  });
21682
- var scoutSlackSpawnRequestSchema = z35.object({
21839
+ var scoutSlackSpawnRequestSchema = z36.object({
21683
21840
  channel_id: slackChannelIdSchema,
21684
21841
  thread_ts: slackThreadTsSchema,
21685
- message_ts: z35.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."),
21686
- user_id: z35.string().describe("Slack user id of that message's author (the envelope's `user_id`). The workspace is attributed to them."),
21687
- prompt: z35.string().describe("The person's request in their own words, quoting earlier messages only when it points to them. The workspace already receives the Slack thread, so add no research, plan, or guesses."),
21688
- acknowledgement_ts: z35.string().optional().describe("`ts` of the one-line reply you posted in this thread before spawning. The server appends the workspace link to it and tells the workspace not to acknowledge again."),
21689
- environment_id: z35.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.`)
21842
+ message_ts: z36.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."),
21843
+ user_id: z36.string().describe("Slack user id of that message's author (the envelope's `user_id`). The workspace is attributed to them."),
21844
+ prompt: z36.string().describe("The person's request in their own words, quoting earlier messages only when it points to them. The workspace already receives the Slack thread, so add no research, plan, or guesses."),
21845
+ acknowledgement_ts: z36.string().optional().describe("`ts` of the one-line reply you posted in this thread before spawning. The server appends the workspace link to it and tells the workspace not to acknowledge again."),
21846
+ environment_id: z36.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.`)
21690
21847
  });
21691
21848
  var scoutSlackSpawnInNewThreadRequestSchema = scoutSlackSpawnRequestSchema.extend({
21692
- title: z35.string().trim().min(1).max(500).describe("One or two sentences stating the task, posted as the new top-level message."),
21693
- prompt: z35.string().describe("The person's request in their own words. The full source thread is attached as background, so add no summary, research, plan, or guesses."),
21694
- acknowledgement_ts: z35.string().optional().describe("`ts` of the one-line reply you posted in this thread before spawning. The server appends the new thread's link to it.")
21849
+ title: z36.string().trim().min(1).max(500).describe("One or two sentences stating the task, posted as the new top-level message."),
21850
+ prompt: z36.string().describe("The person's request in their own words. The full source thread is attached as background, so add no summary, research, plan, or guesses."),
21851
+ acknowledgement_ts: z36.string().optional().describe("`ts` of the one-line reply you posted in this thread before spawning. The server appends the new thread's link to it.")
21695
21852
  });
21696
- var scoutSlackRelayRequestSchema = z35.object({
21853
+ var scoutSlackRelayRequestSchema = z36.object({
21697
21854
  channel_id: slackChannelIdSchema,
21698
21855
  thread_ts: slackThreadTsSchema,
21699
- message: z35.string().describe("The follow-up to deliver: every fresh message that belongs to this update, in its author's words, with no research, plan, or guesses added. When forwarding to a `workspace_id` other than the thread's own workspace, also quote exactly the thread messages the request points to (\"forward this\"), since that workspace gets only this message."),
21700
- user_id: z35.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`."),
21701
- queue: z35.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."),
21702
- workspace_id: z35.string().optional().describe(`Existing workspace id, from \`${REPLICAS_MCP_TOOLS.listWorkspaces}\` or a workspace link in the thread, to bind a thread without a workspace to before relaying. The author must be able to see it. Binding a Mothership gives it the person's own Slack message and the thread instead of \`message\`. In a thread already bound to a different workspace, or in a Mothership's channel, nothing is bound: the workspace or Mothership gets only \`message\`, once, with a link back to Slack, and the thread stays where it is. Omit to relay into the thread's own workspace.`),
21703
- message_ts: z35.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.")
21856
+ message: z36.string().describe("The follow-up to deliver: every fresh message that belongs to this update, in its author's words, with no research, plan, or guesses added. When forwarding to a `workspace_id` other than the thread's own workspace, also quote exactly the thread messages the request points to (\"forward this\"), since that workspace gets only this message."),
21857
+ user_id: z36.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`."),
21858
+ queue: z36.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."),
21859
+ workspace_id: z36.string().optional().describe(`Existing workspace id, from \`${REPLICAS_MCP_TOOLS.listWorkspaces}\` or a workspace link in the thread, to bind a thread without a workspace to before relaying. The author must be able to see it. Binding a Mothership gives it the person's own Slack message and the thread instead of \`message\`. In a thread already bound to a different workspace, or in a Mothership's channel, nothing is bound: the workspace or Mothership gets only \`message\`, once, with a link back to Slack, and the thread stays where it is. Omit to relay into the thread's own workspace.`),
21860
+ message_ts: z36.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.")
21704
21861
  });
21705
- var scoutSlackSetThreadMutedRequestSchema = z35.object({
21862
+ var scoutSlackSetThreadMutedRequestSchema = z36.object({
21706
21863
  channel_id: slackChannelIdSchema,
21707
21864
  thread_ts: slackThreadTsSchema,
21708
- muted: z35.boolean().describe("true to mute Replicas in this thread, false to unmute it.")
21865
+ muted: z36.boolean().describe("true to mute Replicas in this thread, false to unmute it.")
21709
21866
  });
21710
21867
  var scoutSlackStopWorkspaceRequestSchema = scoutSlackMessageReferenceSchema.extend({
21711
- archive: z35.boolean().describe("true only when the person also asked to close or archive the workspace.")
21868
+ archive: z36.boolean().describe("true only when the person also asked to close or archive the workspace.")
21712
21869
  });
21713
- var scoutListWorkspacesRequestSchema = z35.object({
21870
+ var scoutListWorkspacesRequestSchema = z36.object({
21714
21871
  channel_id: slackChannelIdSchema,
21715
21872
  thread_ts: slackThreadTsSchema,
21716
- message_ts: z35.string().describe("The envelope's `message_ts`. The server verifies this message and its author."),
21717
- user_id: z35.string().describe("Slack user id of that message's author (the envelope's `user_id`). Only workspaces they can see are listed."),
21718
- query: z35.string().trim().min(1).optional().describe("Case-insensitive text to match against workspace and Mothership names and pull request URLs.")
21873
+ message_ts: z36.string().describe("The envelope's `message_ts`. The server verifies this message and its author."),
21874
+ user_id: z36.string().describe("Slack user id of that message's author (the envelope's `user_id`). Only workspaces they can see are listed."),
21875
+ query: z36.string().trim().min(1).optional().describe("Case-insensitive text to match against workspace and Mothership names and pull request URLs.")
21719
21876
  });
21720
- var scoutSlackConfirmationSchema = z35.object({
21721
- confirmation_channel_id: z35.string().describe("`channel_id` from the envelope of the Slack message that asked for or accepted this."),
21722
- confirmation_thread_ts: z35.string().describe("`thread_ts` from that message's envelope."),
21723
- confirmation_message_ts: z35.string().describe("`message_ts` from that message's envelope."),
21724
- confirmation_user_id: z35.string().describe("`user_id` from that message's envelope.")
21877
+ var scoutSlackConfirmationSchema = z36.object({
21878
+ confirmation_channel_id: z36.string().describe("`channel_id` from the envelope of the Slack message that asked for or accepted this."),
21879
+ confirmation_thread_ts: z36.string().describe("`thread_ts` from that message's envelope."),
21880
+ confirmation_message_ts: z36.string().describe("`message_ts` from that message's envelope."),
21881
+ confirmation_user_id: z36.string().describe("`user_id` from that message's envelope.")
21725
21882
  });
21726
21883
  var scoutAutomationToolInputSchema = automationToolInputSchema.extend(scoutSlackConfirmationSchema.shape);
21727
21884
  var scoutSaveChannelPresetToolInputSchema = scoutSlackConfirmationSchema.extend({
21728
- preset_id: z35.string().optional().describe(`Id of the preset to update, from \`${REPLICAS_MCP_TOOLS.listChannelSettings}\`. Omit to create a new preset.`),
21729
- name: z35.string().trim().min(1).max(SCOUT_PRESET_NAME_MAX_LENGTH).optional().describe("Preset name. Required when creating."),
21730
- description: z35.string().optional().describe("One-line summary of what the preset is for."),
21731
- icon: z35.enum(SCOUT_PRESET_ICONS).optional(),
21732
- instructions: z35.string().optional().describe("Complete preset instructions; replaces the existing text. Required when creating.")
21885
+ preset_id: z36.string().optional().describe(`Id of the preset to update, from \`${REPLICAS_MCP_TOOLS.listChannelSettings}\`. Omit to create a new preset.`),
21886
+ name: z36.string().trim().min(1).max(SCOUT_PRESET_NAME_MAX_LENGTH).optional().describe("Preset name. Required when creating."),
21887
+ description: z36.string().optional().describe("One-line summary of what the preset is for."),
21888
+ icon: z36.enum(SCOUT_PRESET_ICONS).optional(),
21889
+ instructions: z36.string().optional().describe("Complete preset instructions; replaces the existing text. Required when creating.")
21733
21890
  });
21734
21891
  var scoutUpdateChannelSettingsToolInputSchema = scoutSlackConfirmationSchema.extend({
21735
- source: z35.enum(SCOUT_SOURCE_TYPES).optional().describe("Defaults to `slack`."),
21736
- external_id: z35.string().describe("Slack channel id or Linear team id."),
21737
- monitored: z35.boolean().optional().describe("Linear: `true` starts monitoring the team (organization admins only), `false` stops. Slack: kept for older callers; prefer `proactivity`. `false` means `tagged`, and `true` lifts a `tagged` channel back to the organization's level. Omit to keep it."),
21738
- preset_id: z35.string().nullable().optional().describe("Preset to assign; `null` removes the preset. Omit to keep it."),
21739
- instructions: z35.string().nullable().optional().describe("Complete channel-specific instructions, applied after the preset; replaces the existing text. `null` clears them. Omit to keep them."),
21740
- proactivity: z35.enum([...SCOUT_PROACTIVITY_LEVELS, "organization"]).optional().describe("Slack only: this channel's or group DM's own level, overriding the organization's here alone. `organization` makes it follow the organization's level again. Omit to keep it. 1:1 DMs are always addressed to Replicas, so they take no level."),
21741
- silent: z35.enum(["on", "off", "default"]).optional().describe(`Slack only, organization admins only: \`on\` puts this channel in silent mode, where Replicas reads it and follows its instructions but never posts, reacts, or starts work there. \`off\` turns silent mode off here, \`default\` follows the Slack Connect default from \`${REPLICAS_MCP_TOOLS.setSlackConnectDefaults}\`. Omit to keep it.`),
21742
- muted: z35.enum(["on", "off", "default"]).optional().describe("Kept for older callers; prefer `silent`.")
21892
+ source: z36.enum(SCOUT_SOURCE_TYPES).optional().describe("Defaults to `slack`."),
21893
+ external_id: z36.string().describe("Slack channel id or Linear team id."),
21894
+ monitored: z36.boolean().optional().describe("Linear: `true` starts monitoring the team (organization admins only), `false` stops. Slack: kept for older callers; prefer `proactivity`. `false` means `tagged`, and `true` lifts a `tagged` channel back to the organization's level. Omit to keep it."),
21895
+ preset_id: z36.string().nullable().optional().describe("Preset to assign; `null` removes the preset. Omit to keep it."),
21896
+ instructions: z36.string().nullable().optional().describe("Complete channel-specific instructions, applied after the preset; replaces the existing text. `null` clears them. Omit to keep them."),
21897
+ proactivity: z36.enum([...SCOUT_PROACTIVITY_LEVELS, "organization"]).optional().describe("Slack only: this channel's or group DM's own level, overriding the organization's here alone. `organization` makes it follow the organization's level again. Omit to keep it. 1:1 DMs are always addressed to Replicas, so they take no level."),
21898
+ silent: z36.enum(["on", "off", "default"]).optional().describe(`Slack only, organization admins only: \`on\` puts this channel in silent mode, where Replicas reads it and follows its instructions but never posts, reacts, or starts work there. \`off\` turns silent mode off here, \`default\` follows the Slack Connect default from \`${REPLICAS_MCP_TOOLS.setSlackConnectDefaults}\`. Omit to keep it.`),
21899
+ muted: z36.enum(["on", "off", "default"]).optional().describe("Kept for older callers; prefer `silent`.")
21743
21900
  });
21744
21901
  var mothershipSlackChannelLevelToolInputSchema = scoutSlackConfirmationSchema.extend({
21745
21902
  proactivity: scoutUpdateChannelSettingsToolInputSchema.shape.proactivity.unwrap().describe("This channel's own level. `organization` makes it follow the organization's level again, which a Mothership's channel raises to at least `balanced`.")
21746
21903
  });
21747
21904
  var scoutSetSlackConnectMutedToolInputSchema = scoutSlackConfirmationSchema.extend({
21748
- muted: z35.boolean().describe("`true` puts every Slack Connect channel without its own setting in silent mode; `false` lets them follow their levels again.")
21905
+ muted: z36.boolean().describe("`true` puts every Slack Connect channel without its own setting in silent mode; `false` lets them follow their levels again.")
21749
21906
  });
21750
21907
  var scoutSetSlackConnectDefaultsToolInputSchema = scoutSlackConfirmationSchema.extend({
21751
- silent: z35.boolean().optional().describe("`true` puts every Slack Connect channel without its own setting in silent mode; `false` lets them follow their levels again. Omit to keep it."),
21752
- muted: z35.boolean().optional().describe("Kept for older callers; prefer `silent`."),
21753
- preset_id: z35.string().optional().describe("Preset for every Slack Connect channel without its own preset or instructions; an empty string removes it. Omit to keep it."),
21754
- instructions: z35.string().optional().describe("Complete default instructions, applied after that preset; replaces the existing text. An empty string clears them. Omit to keep them."),
21755
- proactivity: z35.enum([...SCOUT_PROACTIVITY_LEVELS, "default"]).optional().describe("Level for every Slack Connect channel without its own level. `default` returns them to `tagged`. Omit to keep it.")
21908
+ silent: z36.boolean().optional().describe("`true` puts every Slack Connect channel without its own setting in silent mode; `false` lets them follow their levels again. Omit to keep it."),
21909
+ muted: z36.boolean().optional().describe("Kept for older callers; prefer `silent`."),
21910
+ preset_id: z36.string().optional().describe("Preset for every Slack Connect channel without its own preset or instructions; an empty string removes it. Omit to keep it."),
21911
+ instructions: z36.string().optional().describe("Complete default instructions, applied after that preset; replaces the existing text. An empty string clears them. Omit to keep them."),
21912
+ proactivity: z36.enum([...SCOUT_PROACTIVITY_LEVELS, "default"]).optional().describe("Level for every Slack Connect channel without its own level. `default` returns them to `tagged`. Omit to keep it.")
21756
21913
  });
21757
21914
  var scoutSetOrganizationProactivityToolInputSchema = scoutSlackConfirmationSchema.extend({
21758
- proactivity: z35.enum(SCOUT_PROACTIVITY_LEVELS).describe(`The level every Slack channel and group DM follows unless it has its own. Slack Connect channels without their own level follow the shared-channel default from \`${REPLICAS_MCP_TOOLS.setSlackConnectDefaults}\` instead.`)
21915
+ proactivity: z36.enum(SCOUT_PROACTIVITY_LEVELS).describe(`The level every Slack channel and group DM follows unless it has its own. Slack Connect channels without their own level follow the shared-channel default from \`${REPLICAS_MCP_TOOLS.setSlackConnectDefaults}\` instead.`)
21759
21916
  });
21760
21917
  var scoutDeleteChannelPresetToolInputSchema = scoutSlackConfirmationSchema.extend({
21761
- preset_id: z35.string().describe(`Id of the preset to delete, from \`${REPLICAS_MCP_TOOLS.listChannelSettings}\`.`)
21918
+ preset_id: z36.string().describe(`Id of the preset to delete, from \`${REPLICAS_MCP_TOOLS.listChannelSettings}\`.`)
21762
21919
  });
21763
21920
  var RESET_TO_DEFAULT = "default";
21764
- var resettable = (schema, description) => z35.union([schema, z35.literal(RESET_TO_DEFAULT)]).optional().describe(`${description} \`${RESET_TO_DEFAULT}\` falls back to the organization default. Omit to keep it.`);
21921
+ var resettable = (schema, description) => z36.union([schema, z36.literal(RESET_TO_DEFAULT)]).optional().describe(`${description} \`${RESET_TO_DEFAULT}\` falls back to the organization default. Omit to keep it.`);
21765
21922
  var scoutSetSlackAgentDefaultsToolInputSchema = scoutSlackConfirmationSchema.extend({
21766
- agent_provider: resettable(z35.enum(ENGINE_AGENT_PROVIDERS), "Agent for Slack-triggered workspaces. Changing it without `model` resets the model to that agent's default."),
21767
- model: resettable(z35.string(), "Model id for that agent; the default is the agent's own."),
21768
- thinking_level: resettable(z35.enum(VALID_THINKING_LEVELS), "Thinking level."),
21769
- goal_mode: resettable(z35.boolean(), "Goal mode."),
21770
- fast_mode: resettable(z35.boolean(), "Fast mode.")
21923
+ agent_provider: resettable(z36.enum(ENGINE_AGENT_PROVIDERS), "Agent for Slack-triggered workspaces. Changing it without `model` resets the model to that agent's default."),
21924
+ model: resettable(z36.string(), "Model id for that agent; the default is the agent's own."),
21925
+ thinking_level: resettable(z36.enum(VALID_THINKING_LEVELS), "Thinking level."),
21926
+ goal_mode: resettable(z36.boolean(), "Goal mode."),
21927
+ fast_mode: resettable(z36.boolean(), "Fast mode.")
21771
21928
  });
21772
- var scoutClaimSettingsOfferToolInputSchema = z35.object({
21929
+ var scoutClaimSettingsOfferToolInputSchema = z36.object({
21773
21930
  channel_id: slackChannelIdSchema,
21774
- kind: z35.enum(SCOUT_SETTINGS_OFFERS).describe("`proactivity`: offering a lower level after frustration. `raise_proactivity`: offering a higher level after someone had to @mention you. `instructions`: offering channel instructions or a preset. `organization_proactivity` and `raise_organization_proactivity`: offering to lower or raise the workspace default; only decline them, the server claims them for you."),
21775
- user_id: z35.string().optional().describe("The envelope's `user_id`. Required for `proactivity` and `raise_proactivity`, so the server can say whether they are an organization admin."),
21776
- declined: z35.boolean().optional().describe("true when the person declined an offer you already made, so it is not made again.")
21931
+ kind: z36.enum(SCOUT_SETTINGS_OFFERS).describe("`proactivity`: offering a lower level after frustration. `raise_proactivity`: offering a higher level after someone had to @mention you. `instructions`: offering channel instructions or a preset. `organization_proactivity` and `raise_organization_proactivity`: offering to lower or raise the workspace default; only decline them, the server claims them for you."),
21932
+ user_id: z36.string().optional().describe("The envelope's `user_id`. Required for `proactivity` and `raise_proactivity`, so the server can say whether they are an organization admin."),
21933
+ declined: z36.boolean().optional().describe("true when the person declined an offer you already made, so it is not made again.")
21777
21934
  });
21778
21935
 
21779
21936
  // ../shared/src/routes/plugin-catalog.ts
@@ -22131,27 +22288,27 @@ var PLUGIN_CATALOG = [
22131
22288
  ].map((plugin) => ({ ...plugin, readOnlyScopes: READ_ONLY_SCOPES[plugin.id] }));
22132
22289
 
22133
22290
  // ../shared/src/routes/sentry.ts
22134
- import { z as z36 } from "zod";
22135
- var sentrySelfHostedConnectRequestSchema = z36.object({
22136
- baseUrl: z36.string().min(1),
22137
- token: z36.string().trim().min(1),
22138
- webhookSecret: z36.string().trim().optional()
22291
+ import { z as z37 } from "zod";
22292
+ var sentrySelfHostedConnectRequestSchema = z37.object({
22293
+ baseUrl: z37.string().min(1),
22294
+ token: z37.string().trim().min(1),
22295
+ webhookSecret: z37.string().trim().optional()
22139
22296
  });
22140
22297
 
22141
22298
  // ../shared/src/routes/user.ts
22142
22299
  var PROFILE_AVATAR_MAX_SIZE_BYTES = 5 * 1024 * 1024;
22143
22300
 
22144
22301
  // ../shared/src/routes/web-auth.ts
22145
- import { z as z37 } from "zod";
22146
- var webAuthRedeemResponseSchema = z37.object({
22147
- path: z37.string(),
22148
- organizationId: z37.string().nullable(),
22149
- session: z37.object({ access_token: z37.string(), refresh_token: z37.string(), user: z37.object({ id: z37.string(), email: z37.string() }) }).nullable()
22302
+ import { z as z38 } from "zod";
22303
+ var webAuthRedeemResponseSchema = z38.object({
22304
+ path: z38.string(),
22305
+ organizationId: z38.string().nullable(),
22306
+ session: z38.object({ access_token: z38.string(), refresh_token: z38.string(), user: z38.object({ id: z38.string(), email: z38.string() }) }).nullable()
22150
22307
  });
22151
22308
 
22152
22309
  // ../shared/src/routes/themes.ts
22153
- import { z as z38 } from "zod";
22154
- var updateThemeRequestSchema = z38.object({ theme: z38.string(), palette: z38.string(), accent: z38.string(), code: z38.string() }).partial();
22310
+ import { z as z39 } from "zod";
22311
+ var updateThemeRequestSchema = z39.object({ theme: z39.string(), palette: z39.string(), accent: z39.string(), code: z39.string() }).partial();
22155
22312
 
22156
22313
  // ../shared/src/routes/client-state.ts
22157
22314
  var MAX_CLIENT_STATE_REQUEST_BYTES = 5 * 1024 * 1024;
@@ -22175,105 +22332,105 @@ var promptHistoryClientStateKey = orgUserClientStateKey(PROMPT_HISTORY_CLIENT_ST
22175
22332
  var workspaceSearchOpensClientStateKey = orgUserClientStateKey(WORKSPACE_SEARCH_OPENS_CLIENT_STATE_KEY_PREFIX);
22176
22333
 
22177
22334
  // ../shared/src/routes/workspace-events.ts
22178
- import { z as z40 } from "zod";
22335
+ import { z as z41 } from "zod";
22179
22336
 
22180
22337
  // ../shared/src/routes/presence.ts
22181
- import { z as z39 } from "zod";
22182
- var presenceStatusSchema = z39.enum(["online", "typing"]);
22183
- var presenceLocationSchema = z39.object({
22184
- workspaceId: z39.string().optional()
22338
+ import { z as z40 } from "zod";
22339
+ var presenceStatusSchema = z40.enum(["online", "typing"]);
22340
+ var presenceLocationSchema = z40.object({
22341
+ workspaceId: z40.string().optional()
22185
22342
  });
22186
- var presenceEntrySchema = z39.object({
22187
- userId: z39.string(),
22343
+ var presenceEntrySchema = z40.object({
22344
+ userId: z40.string(),
22188
22345
  status: presenceStatusSchema,
22189
22346
  location: presenceLocationSchema,
22190
- ts: z39.string()
22347
+ ts: z40.string()
22191
22348
  });
22192
- var updatePresenceRequestSchema = z39.object({
22349
+ var updatePresenceRequestSchema = z40.object({
22193
22350
  status: presenceStatusSchema,
22194
22351
  location: presenceLocationSchema.optional()
22195
22352
  });
22196
22353
 
22197
22354
  // ../shared/src/routes/workspace-events.ts
22198
- var workspaceTurnCompletionSchema = z40.object({
22199
- workspaceName: z40.string(),
22200
- completedAt: z40.string(),
22201
- processing: z40.boolean().optional(),
22202
- pullRequestFeedback: z40.boolean().optional(),
22203
- attention: z40.object({ reason: z40.enum(CHAT_ATTENTION_REASONS), userId: z40.string() }).optional()
22355
+ var workspaceTurnCompletionSchema = z41.object({
22356
+ workspaceName: z41.string(),
22357
+ completedAt: z41.string(),
22358
+ processing: z41.boolean().optional(),
22359
+ pullRequestFeedback: z41.boolean().optional(),
22360
+ attention: z41.object({ reason: z41.enum(CHAT_ATTENTION_REASONS), userId: z41.string() }).optional()
22204
22361
  });
22205
- var workspaceEventSchemaByType = z40.discriminatedUnion("type", [
22206
- z40.object({
22207
- type: z40.literal("workspace.changed"),
22208
- workspaceId: z40.string(),
22209
- accessChangedFor: z40.string().optional(),
22210
- accessChangedForOrg: z40.literal(true).optional(),
22211
- workspace: z40.object({ status: z40.enum(WORKSPACE_STATUSES), last_activity_at: z40.string().nullable() }).optional(),
22212
- name: z40.string().optional(),
22362
+ var workspaceEventSchemaByType = z41.discriminatedUnion("type", [
22363
+ z41.object({
22364
+ type: z41.literal("workspace.changed"),
22365
+ workspaceId: z41.string(),
22366
+ accessChangedFor: z41.string().optional(),
22367
+ accessChangedForOrg: z41.literal(true).optional(),
22368
+ workspace: z41.object({ status: z41.enum(WORKSPACE_STATUSES), last_activity_at: z41.string().nullable() }).optional(),
22369
+ name: z41.string().optional(),
22213
22370
  completion: workspaceTurnCompletionSchema.optional(),
22214
- ts: z40.string()
22371
+ ts: z41.string()
22215
22372
  }),
22216
- z40.object({
22217
- type: z40.literal("workspace.chat.changed"),
22218
- workspaceId: z40.string(),
22219
- chatId: z40.string(),
22220
- ts: z40.string()
22373
+ z41.object({
22374
+ type: z41.literal("workspace.chat.changed"),
22375
+ workspaceId: z41.string(),
22376
+ chatId: z41.string(),
22377
+ ts: z41.string()
22221
22378
  }),
22222
- z40.object({
22223
- type: z40.literal("workspace.chat.advanced"),
22224
- workspaceId: z40.string(),
22225
- chatId: z40.string(),
22226
- afterCursor: z40.string().optional(),
22227
- processing: z40.boolean(),
22228
- ts: z40.string()
22379
+ z41.object({
22380
+ type: z41.literal("workspace.chat.advanced"),
22381
+ workspaceId: z41.string(),
22382
+ chatId: z41.string(),
22383
+ afterCursor: z41.string().optional(),
22384
+ processing: z41.boolean(),
22385
+ ts: z41.string()
22229
22386
  }),
22230
- z40.object({
22231
- type: z40.literal("mobile-testing.changed"),
22232
- workspaceId: z40.string(),
22233
- ts: z40.string()
22387
+ z41.object({
22388
+ type: z41.literal("mobile-testing.changed"),
22389
+ workspaceId: z41.string(),
22390
+ ts: z41.string()
22234
22391
  }),
22235
- z40.object({
22236
- type: z40.literal("variable-request.changed"),
22237
- workspaceId: z40.string(),
22238
- ts: z40.string()
22392
+ z41.object({
22393
+ type: z41.literal("variable-request.changed"),
22394
+ workspaceId: z41.string(),
22395
+ ts: z41.string()
22239
22396
  }),
22240
- z40.object({
22241
- type: z40.literal("local-control-request.changed"),
22242
- workspaceId: z40.string(),
22243
- ts: z40.string()
22397
+ z41.object({
22398
+ type: z41.literal("local-control-request.changed"),
22399
+ workspaceId: z41.string(),
22400
+ ts: z41.string()
22244
22401
  }),
22245
- z40.object({
22246
- type: z40.literal("pull-request.changed"),
22247
- prUrl: z40.string(),
22248
- ts: z40.string()
22402
+ z41.object({
22403
+ type: z41.literal("pull-request.changed"),
22404
+ prUrl: z41.string(),
22405
+ ts: z41.string()
22249
22406
  }),
22250
- z40.object({
22251
- type: z40.literal("mothership.subagent.changed"),
22252
- workspaceId: z40.string(),
22253
- subagent: z40.object({ id: z40.string(), name: z40.string(), prUrl: z40.string().nullable() }),
22254
- ts: z40.string()
22407
+ z41.object({
22408
+ type: z41.literal("mothership.subagent.changed"),
22409
+ workspaceId: z41.string(),
22410
+ subagent: z41.object({ id: z41.string(), name: z41.string(), prUrl: z41.string().nullable() }),
22411
+ ts: z41.string()
22255
22412
  }),
22256
- z40.object({ type: z40.literal("mothership.board.changed"), workspaceId: z40.string(), ts: z40.string() }),
22257
- z40.object({ type: z40.literal("needs-you.changed"), workspaceId: z40.string().nullable(), userId: z40.string().optional(), ts: z40.string() }),
22258
- z40.object({
22259
- type: z40.literal("workspace.shared"),
22260
- workspaceId: z40.string(),
22261
- workspaceName: z40.string(),
22262
- sharedWithUserId: z40.string(),
22263
- sharedByName: z40.string(),
22264
- ts: z40.string()
22413
+ z41.object({ type: z41.literal("mothership.board.changed"), workspaceId: z41.string(), ts: z41.string() }),
22414
+ z41.object({ type: z41.literal("needs-you.changed"), workspaceId: z41.string().nullable(), userId: z41.string().optional(), ts: z41.string() }),
22415
+ z41.object({
22416
+ type: z41.literal("workspace.shared"),
22417
+ workspaceId: z41.string(),
22418
+ workspaceName: z41.string(),
22419
+ sharedWithUserId: z41.string(),
22420
+ sharedByName: z41.string(),
22421
+ ts: z41.string()
22265
22422
  }),
22266
- z40.object({ type: z40.literal("client-state.changed"), userId: z40.string(), keys: z40.array(z40.string()), ts: z40.string() })
22423
+ z41.object({ type: z41.literal("client-state.changed"), userId: z41.string(), keys: z41.array(z41.string()), ts: z41.string() })
22267
22424
  ]);
22268
- var workspaceChangedEventSchema = z40.union([
22425
+ var workspaceChangedEventSchema = z41.union([
22269
22426
  workspaceEventSchemaByType,
22270
- z40.object({ type: z40.literal("presence.changed"), userId: z40.string(), entry: presenceEntrySchema.nullable(), ts: z40.string() }),
22271
- z40.object({ type: z40.literal("presence.changed"), ts: z40.string() })
22427
+ z41.object({ type: z41.literal("presence.changed"), userId: z41.string(), entry: presenceEntrySchema.nullable(), ts: z41.string() }),
22428
+ z41.object({ type: z41.literal("presence.changed"), ts: z41.string() })
22272
22429
  ]);
22273
22430
 
22274
22431
  // ../shared/src/routes/review-messages.ts
22275
- import { z as z41 } from "zod";
22276
- var sendPullRequestReviewMessageRequestSchema = z41.object({
22432
+ import { z as z42 } from "zod";
22433
+ var sendPullRequestReviewMessageRequestSchema = z42.object({
22277
22434
  ...sendChatMessageRequestSchema.pick({
22278
22435
  message: true,
22279
22436
  messageId: true,
@@ -22286,8 +22443,8 @@ var sendPullRequestReviewMessageRequestSchema = z41.object({
22286
22443
  ultrafastMode: true
22287
22444
  }).shape,
22288
22445
  /** Starts a new chat instead of continuing the PR's review chat. The provider only applies to a new chat. */
22289
- newChat: z41.boolean().optional(),
22290
- provider: z41.enum(ENGINE_AGENT_PROVIDERS).optional()
22446
+ newChat: z42.boolean().optional(),
22447
+ provider: z42.enum(ENGINE_AGENT_PROVIDERS).optional()
22291
22448
  });
22292
22449
 
22293
22450
  // ../shared/src/audit-log.ts
@@ -22950,40 +23107,40 @@ function isSkillRegistryManifest(value) {
22950
23107
  }
22951
23108
 
22952
23109
  // ../shared/src/routes/variable-requests.ts
22953
- import { z as z42 } from "zod";
23110
+ import { z as z43 } from "zod";
22954
23111
  var VARIABLE_REQUEST_WAIT = { defaultMs: 10 * 6e4, maxMs: 30 * 6e4, pollMs: 3e3, waiterStaleMs: 15e3 };
22955
23112
  var VARIABLE_REQUEST_DESTINATIONS = ["environment", "workspace"];
22956
- var requestedVariableSchema = z42.object({
22957
- key: z42.string().regex(VARIABLE_KEY_RE, "must be a valid environment variable name").max(ENVIRONMENT_SETUP_LIMITS.variableKeyChars),
22958
- required: z42.boolean(),
22959
- replace: z42.boolean().optional()
23113
+ var requestedVariableSchema = z43.object({
23114
+ key: z43.string().regex(VARIABLE_KEY_RE, "must be a valid environment variable name").max(ENVIRONMENT_SETUP_LIMITS.variableKeyChars),
23115
+ required: z43.boolean(),
23116
+ replace: z43.boolean().optional()
22960
23117
  });
22961
- var requestedVariablesSchema = z42.array(requestedVariableSchema).min(1, "must not be empty").max(ENVIRONMENT_SETUP_LIMITS.variables).refine((variables) => new Set(variables.map((variable) => variable.key)).size === variables.length, "must have unique keys");
22962
- var createVariableRequestSchema = z42.object({
23118
+ var requestedVariablesSchema = z43.array(requestedVariableSchema).min(1, "must not be empty").max(ENVIRONMENT_SETUP_LIMITS.variables).refine((variables) => new Set(variables.map((variable) => variable.key)).size === variables.length, "must have unique keys");
23119
+ var createVariableRequestSchema = z43.object({
22963
23120
  variables: requestedVariablesSchema,
22964
- reason: z42.string().trim().max(500).nullish().transform((value) => value || null),
22965
- wait: z42.boolean().default(true)
23121
+ reason: z43.string().trim().max(500).nullish().transform((value) => value || null),
23122
+ wait: z43.boolean().default(true)
22966
23123
  });
22967
- var respondVariableRequestSchema = z42.discriminatedUnion("action", [
22968
- z42.object({
22969
- action: z42.literal("provide"),
22970
- destination: z42.enum(VARIABLE_REQUEST_DESTINATIONS),
23124
+ var respondVariableRequestSchema = z43.discriminatedUnion("action", [
23125
+ z43.object({
23126
+ action: z43.literal("provide"),
23127
+ destination: z43.enum(VARIABLE_REQUEST_DESTINATIONS),
22971
23128
  /** Defaults to the workspace's environment, so older clients keep saving there. */
22972
- environment_ids: z42.array(z42.string().uuid()).optional(),
22973
- overwrite: z42.boolean().optional(),
22974
- values: z42.record(z42.string().regex(VARIABLE_KEY_RE), z42.string())
23129
+ environment_ids: z43.array(z43.string().uuid()).optional(),
23130
+ overwrite: z43.boolean().optional(),
23131
+ values: z43.record(z43.string().regex(VARIABLE_KEY_RE), z43.string())
22975
23132
  }),
22976
- z42.object({ action: z42.literal("skip") })
23133
+ z43.object({ action: z43.literal("skip") })
22977
23134
  ]);
22978
23135
 
22979
23136
  // ../shared/src/routes/local-control-requests.ts
22980
- import { z as z43 } from "zod";
22981
- var createLocalControlRequestSchema = z43.object({
22982
- reason: z43.string().trim().max(500).optional().transform((value) => value || null),
22983
- wait: z43.boolean().default(true)
23137
+ import { z as z44 } from "zod";
23138
+ var createLocalControlRequestSchema = z44.object({
23139
+ reason: z44.string().trim().max(500).optional().transform((value) => value || null),
23140
+ wait: z44.boolean().default(true)
22984
23141
  });
22985
- var respondLocalControlRequestSchema = z43.object({ action: z43.enum(["allow", "dismiss"]) });
22986
- var setLocalControlSchema = z43.object({ enabled: z43.boolean() });
23142
+ var respondLocalControlRequestSchema = z44.object({ action: z44.enum(["allow", "dismiss"]) });
23143
+ var setLocalControlSchema = z44.object({ enabled: z44.boolean() });
22987
23144
 
22988
23145
  export {
22989
23146
  ENGINE_SEND_MESSAGE_FAILED_ERROR,
@@ -23303,11 +23460,15 @@ export {
23303
23460
  CLAUDE_AUTH_ENV_KEYS,
23304
23461
  claudeAuthEnvFromResponse,
23305
23462
  CLAUDE_AUTH_ENV_KEYS_BY_METHOD,
23463
+ commandProtectionEvaluateResponseSchema,
23306
23464
  extractCommandProtectionCommandText,
23307
23465
  parseCommandProtectionRequest,
23308
23466
  findPrMergeSignals,
23309
23467
  findGitCommitSignals,
23310
23468
  findScoutRepoWriteSignals,
23469
+ COMMAND_PROTECTION_REPO_GIT_ARGS,
23470
+ COMMAND_PROTECTION_MAX_MESSAGE_FILE_BYTES,
23471
+ toCommandProtectionRepoState,
23311
23472
  findCommandProtectionGitLookups,
23312
23473
  shouldRefreshPullRequests,
23313
23474
  MAX_REPO_FILE_CONTENT_BYTES,