replicas-cli 0.2.776 → 0.2.777

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.
Files changed (2) hide show
  1. package/dist/index.cjs +117 -38
  2. package/package.json +1 -1
package/dist/index.cjs CHANGED
@@ -23535,6 +23535,48 @@ function skillNamesFromCommand(command) {
23535
23535
  })));
23536
23536
  }
23537
23537
 
23538
+ // ../shared/src/uuid.ts
23539
+ var UUID_RE = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;
23540
+
23541
+ // ../shared/src/automations/trigger-schemas.ts
23542
+ var repositoryTriggerConfigSchema = external_exports.object({
23543
+ event: external_exports.string(),
23544
+ repository_ids: external_exports.array(external_exports.string().regex(UUID_RE, "must be a repository id")).optional(),
23545
+ group_pr_events: external_exports.boolean().optional(),
23546
+ excluded_actors: external_exports.array(external_exports.string()).optional()
23547
+ });
23548
+ var cronTriggerSchema = external_exports.object({ type: external_exports.literal("cron"), config: external_exports.object({ schedule: external_exports.string(), timezone: external_exports.string().optional() }) });
23549
+ var githubTriggerSchema = external_exports.object({ type: external_exports.literal("github"), config: repositoryTriggerConfigSchema });
23550
+ var gitlabTriggerSchema = external_exports.object({ type: external_exports.literal("gitlab"), config: repositoryTriggerConfigSchema });
23551
+ var automationTriggerSchema = external_exports.discriminatedUnion("type", [
23552
+ cronTriggerSchema,
23553
+ githubTriggerSchema,
23554
+ gitlabTriggerSchema,
23555
+ external_exports.object({ type: external_exports.literal("slack"), config: external_exports.object({ event: external_exports.string(), channel_ids: external_exports.array(external_exports.string()).optional(), group_thread_replies: external_exports.boolean().optional() }) }),
23556
+ external_exports.object({ type: external_exports.literal("sentry"), config: external_exports.object({ event: external_exports.string(), project_slugs: external_exports.array(external_exports.string()).optional(), min_level: external_exports.string().optional() }) }),
23557
+ external_exports.object({ type: external_exports.literal("custom"), config: external_exports.object({}) })
23558
+ ]);
23559
+
23560
+ // ../shared/src/replicas-mcp.ts
23561
+ var REPLICAS_MCP_SERVER_NAME = "replicas-mcp";
23562
+ var REPLICAS_MCP_TOOLS = {
23563
+ listEnvironments: "list_environments",
23564
+ createAutomation: "create_automation",
23565
+ spawn: "spawn_workspace",
23566
+ relay: "relay_to_workspace",
23567
+ linearStart: "start_linear_session",
23568
+ linearSessionIntent: "register_linear_session_intent"
23569
+ };
23570
+ var automationToolInputSchema = external_exports.object({
23571
+ name: external_exports.string().describe("Short automation name."),
23572
+ prompt: external_exports.string().describe("Prompt each automation run starts with."),
23573
+ environment_id: external_exports.string().describe(`Environment id from \`${REPLICAS_MCP_TOOLS.listEnvironments}\`.`),
23574
+ triggers: external_exports.array(automationTriggerSchema).min(1).describe(
23575
+ '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>"] } }`.'
23576
+ ),
23577
+ description: external_exports.string().optional().describe("One-line summary shown in the dashboard.")
23578
+ });
23579
+
23538
23580
  // ../shared/src/default-skills/replicas-agent/abilities/computer.ts
23539
23581
  var SECTION = `### Computer use (Linux desktop control)
23540
23582
  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).
@@ -23804,9 +23846,6 @@ var DOCKER_ABILITY = {
23804
23846
  referenceFile: { name: "DOCKER.md", content: REFERENCE2 }
23805
23847
  };
23806
23848
 
23807
- // ../shared/src/uuid.ts
23808
- var UUID_RE = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;
23809
-
23810
23849
  // ../shared/src/routes/environment-setups.ts
23811
23850
  var ENVIRONMENT_SETUP_STEPS = [
23812
23851
  { key: "understand", label: "Understand the codebase" },
@@ -23856,17 +23895,7 @@ var ENVIRONMENT_SETUP_AUTHORED_TRIGGER_TYPES = ["cron", "github", "gitlab"];
23856
23895
  function isEnvironmentSetupAuthoredTriggerType(type) {
23857
23896
  return ENVIRONMENT_SETUP_AUTHORED_TRIGGER_TYPES.some((authored) => authored === type);
23858
23897
  }
23859
- var repositoryTriggerConfigSchema = external_exports.object({
23860
- event: external_exports.string(),
23861
- repository_ids: external_exports.array(external_exports.string().regex(UUID_RE, "must be a repository id")).optional(),
23862
- group_pr_events: external_exports.boolean().optional(),
23863
- excluded_actors: external_exports.array(external_exports.string()).optional()
23864
- });
23865
- var proposalTriggerSchema = external_exports.discriminatedUnion("type", [
23866
- external_exports.object({ type: external_exports.literal("cron"), config: external_exports.object({ schedule: external_exports.string(), timezone: external_exports.string().optional() }) }),
23867
- external_exports.object({ type: external_exports.literal("github"), config: repositoryTriggerConfigSchema }),
23868
- external_exports.object({ type: external_exports.literal("gitlab"), config: repositoryTriggerConfigSchema })
23869
- ]);
23898
+ var proposalTriggerSchema = external_exports.discriminatedUnion("type", [cronTriggerSchema, githubTriggerSchema, gitlabTriggerSchema]);
23870
23899
  var existingTriggerSchema = external_exports.custom(
23871
23900
  (value) => isRecord(value) && typeof value.type === "string" && isRecord(value.config),
23872
23901
  "must be an automation trigger"
@@ -25708,6 +25737,13 @@ function removeTag(text2, tag) {
25708
25737
  function removeReplicasInstructions(text2) {
25709
25738
  return removeTag(text2, REPLICAS_INSTRUCTIONS_TAG);
25710
25739
  }
25740
+ 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.
25741
+ - **Spawn** a dedicated workspace for the thread and hand off: \`${REPLICAS_MCP_TOOLS.spawn}\`, with \`environment_id\` when you chose one.
25742
+ - **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.
25743
+ - **List environments**: \`${REPLICAS_MCP_TOOLS.listEnvironments}\`.
25744
+ - **Create an automation**: \`${REPLICAS_MCP_TOOLS.createAutomation}\`, filling its \`confirmation_*\` arguments from the accepting message's envelope.
25745
+ - **Register a Linear session intent**: \`${REPLICAS_MCP_TOOLS.linearSessionIntent}\` with \`comment_id\` and \`action\`.
25746
+ - **Start a Linear session**: \`${REPLICAS_MCP_TOOLS.linearStart}\` with \`issue_id\`, \`agent_session_id\`, and \`prompt\`.`;
25711
25747
 
25712
25748
  // ../shared/src/user-message-attachments.ts
25713
25749
  var ATTACHMENT_PLACEHOLDER_REGEX = /^\[\d+ (?:(?:images?|files?)(?: and \d+ files?)? attached|(?:image )?attachments?)\]$/;
@@ -27829,6 +27865,31 @@ var SLASH_COMMANDS = [
27829
27865
  }))
27830
27866
  ];
27831
27867
 
27868
+ // ../shared/src/terminal.ts
27869
+ var CONTROL_CHARACTERS = /[\u0000-\u001F\u007F-\u009F]/g;
27870
+ function sanitizeTerminalLine(value) {
27871
+ return value.replace(CONTROL_CHARACTERS, " ").trim();
27872
+ }
27873
+
27874
+ // ../shared/src/mothership.ts
27875
+ function mothershipWorkspaceLine(workspaceId, workspaceName, webAppUrl) {
27876
+ return `Workspace: ${sanitizeTerminalLine(workspaceName ?? "") || "Workspace"} (${getWorkspaceDashboardUrl(workspaceId, { webAppUrl })})`;
27877
+ }
27878
+ async function waitForMothershipSpawn(getThreadWorkspace, options) {
27879
+ for (let attempt = 0; attempt < options.attempts; attempt++) {
27880
+ const { workspace_id, workspace_name } = await getThreadWorkspace();
27881
+ if (workspace_id) return `Spawned workspace.
27882
+ ${mothershipWorkspaceLine(workspace_id, workspace_name, options.webAppUrl)}`;
27883
+ await new Promise((resolve2) => setTimeout(resolve2, 1e3));
27884
+ }
27885
+ return "Workspace spawn requested. The new workspace will take over this Slack thread.";
27886
+ }
27887
+ function formatMothershipRelayResult(result, webAppUrl) {
27888
+ const folded = result.folded_in ? ` Folded in ${result.folded_in} earlier relay${result.folded_in === 1 ? "" : "s"} that had not started yet.` : "";
27889
+ return `${result.interrupted ? `Interrupted the thread's dedicated workspace and relayed the message.${folded}` : "Relayed to the thread's dedicated workspace."}
27890
+ ${mothershipWorkspaceLine(result.workspace_id, result.workspace_name, webAppUrl)}`;
27891
+ }
27892
+
27832
27893
  // ../shared/src/replicas-config.ts
27833
27894
  var import_yaml = __toESM(require_dist());
27834
27895
 
@@ -27841,12 +27902,6 @@ var HOOK_EXEC_MAX_BUFFER_BYTES = 10 * 1024 * 1024;
27841
27902
  // ../shared/src/replicas-config.ts
27842
27903
  var REPLICAS_CONFIG_FILENAMES = ["replicas.json", "replicas.yaml", "replicas.yml"];
27843
27904
 
27844
- // ../shared/src/terminal.ts
27845
- var CONTROL_CHARACTERS = /[\u0000-\u001F\u007F-\u009F]/g;
27846
- function sanitizeTerminalLine(value) {
27847
- return value.replace(CONTROL_CHARACTERS, " ").trim();
27848
- }
27849
-
27850
27905
  // ../shared/src/subagent-mcp.ts
27851
27906
  var SUBAGENT_MCP_TOOLS = {
27852
27907
  getProviders: "get_providers",
@@ -27873,7 +27928,7 @@ var headlessAgentRequestSchema = external_exports.object({
27873
27928
  });
27874
27929
 
27875
27930
  // ../shared/src/cli-version.ts
27876
- var CLI_VERSION = "0.2.776";
27931
+ var CLI_VERSION = "0.2.777";
27877
27932
 
27878
27933
  // ../shared/src/version.ts
27879
27934
  function compareVersions(v1, v2) {
@@ -27948,6 +28003,41 @@ var linearSessionMetadataSchema = external_exports.object({
27948
28003
  }).optional()
27949
28004
  });
27950
28005
 
28006
+ // ../shared/src/routes/mothership.ts
28007
+ var MOTHERSHIP_LINEAR_ACTIONS = ["ask", "start"];
28008
+ var mothershipLinearSessionIntentRequestSchema = external_exports.object({
28009
+ comment_id: external_exports.string().trim().min(1).describe("Id of the Linear comment the session will be created on."),
28010
+ action: external_exports.enum(MOTHERSHIP_LINEAR_ACTIONS).describe("`ask` when the comment is a clarifying question, `start` when it is the complete task prompt.")
28011
+ });
28012
+ var mothershipLinearStartRequestSchema = external_exports.object({
28013
+ issue_id: external_exports.string().describe("Linear issue id from the envelope's `issue_id`."),
28014
+ agent_session_id: external_exports.string().describe("Existing Linear agent session id from the envelope's `agent_session_id`."),
28015
+ prompt: external_exports.string().trim().min(1).describe("Complete task prompt for the coding workspace.")
28016
+ });
28017
+ var slackChannelIdSchema = external_exports.string().describe("Slack channel id from the envelope's `channel_id`.");
28018
+ var slackThreadTsSchema = external_exports.string().describe("Slack thread timestamp from the envelope's `thread_ts`.");
28019
+ var mothershipSlackSpawnRequestSchema = external_exports.object({
28020
+ channel_id: slackChannelIdSchema,
28021
+ thread_ts: slackThreadTsSchema,
28022
+ message_ts: external_exports.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."),
28023
+ user_id: external_exports.string().describe("Slack user id of that message's author (the envelope's `user_id`). The workspace is attributed to them."),
28024
+ prompt: external_exports.string().describe("Complete task for the new workspace, written so it stands on its own."),
28025
+ environment_id: external_exports.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.`)
28026
+ });
28027
+ var mothershipSlackRelayRequestSchema = external_exports.object({
28028
+ channel_id: slackChannelIdSchema,
28029
+ thread_ts: slackThreadTsSchema,
28030
+ message: external_exports.string().describe("The follow-up to deliver, combining every fresh message that belongs to this update."),
28031
+ user_id: external_exports.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."),
28032
+ queue: external_exports.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.")
28033
+ });
28034
+ var mothershipAutomationToolInputSchema = automationToolInputSchema.extend({
28035
+ confirmation_channel_id: external_exports.string().describe("`channel_id` from the envelope of the Slack message that accepted the offer."),
28036
+ confirmation_thread_ts: external_exports.string().describe("`thread_ts` from that message's envelope."),
28037
+ confirmation_message_ts: external_exports.string().describe("`message_ts` from that message's envelope."),
28038
+ confirmation_user_id: external_exports.string().describe("`user_id` from that message's envelope.")
28039
+ });
28040
+
27951
28041
  // ../shared/src/routes/plugin-catalog.ts
27952
28042
  var EXPLICIT_PLUGIN_CATALOG = [
27953
28043
  {
@@ -32560,9 +32650,6 @@ async function serviceLogsCommand(name, options) {
32560
32650
  }
32561
32651
 
32562
32652
  // src/commands/mothership.ts
32563
- function workspaceNameForOutput(name) {
32564
- return sanitizeTerminalLine(name ?? "") || "Workspace";
32565
- }
32566
32653
  async function mothershipMonitorChannelCommand(options) {
32567
32654
  const channel = options.channel?.trim();
32568
32655
  const approvalChannel = options.approvalChannel?.trim();
@@ -32608,18 +32695,12 @@ async function mothershipSpawnCommand(options) {
32608
32695
  method: "POST",
32609
32696
  body
32610
32697
  });
32611
- for (let attempt = 0; attempt < 60; attempt++) {
32612
- const result = await agentFetch(
32698
+ console.log(await waitForMothershipSpawn(
32699
+ () => agentFetch(
32613
32700
  `/v1/agent/mothership/thread-workspace?channel_id=${encodeURIComponent(channel)}&thread_ts=${encodeURIComponent(thread)}`
32614
- );
32615
- if (result.workspace_id) {
32616
- console.log(`Spawned workspace.
32617
- Workspace: ${workspaceNameForOutput(result.workspace_name)} (${getWorkspaceDashboardUrl(result.workspace_id, { webAppUrl: process.env.REPLICAS_WEB_URL })})`);
32618
- return;
32619
- }
32620
- await new Promise((resolve2) => setTimeout(resolve2, 1e3));
32621
- }
32622
- console.log("Workspace spawn requested. The new workspace will take over this Slack thread.");
32701
+ ),
32702
+ { attempts: 60, webAppUrl: process.env.REPLICAS_WEB_URL }
32703
+ ));
32623
32704
  }
32624
32705
  async function mothershipRelayCommand(options) {
32625
32706
  const channel = options.channel?.trim();
@@ -32640,9 +32721,7 @@ async function mothershipRelayCommand(options) {
32640
32721
  method: "POST",
32641
32722
  body
32642
32723
  });
32643
- const folded = result.folded_in ? ` Folded in ${result.folded_in} earlier relay${result.folded_in === 1 ? "" : "s"} that had not started yet.` : "";
32644
- console.log(`${result.interrupted ? `Interrupted the thread's dedicated workspace and relayed the message.${folded}` : "Relayed to the thread's dedicated workspace."}
32645
- Workspace: ${workspaceNameForOutput(result.workspace_name)} (${getWorkspaceDashboardUrl(result.workspace_id, { webAppUrl: process.env.REPLICAS_WEB_URL })})`);
32724
+ console.log(formatMothershipRelayResult(result, process.env.REPLICAS_WEB_URL));
32646
32725
  }
32647
32726
 
32648
32727
  // src/commands/environment.ts
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "replicas-cli",
3
- "version": "0.2.776",
3
+ "version": "0.2.777",
4
4
  "description": "CLI for managing Replicas workspaces - SSH into cloud dev environments with automatic port forwarding",
5
5
  "main": "dist/index.cjs",
6
6
  "bin": {