replicas-cli 0.2.441 → 0.2.443

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.mjs +67 -13
  2. package/package.json +1 -1
package/dist/index.mjs CHANGED
@@ -10049,7 +10049,7 @@ var AGENT_CREDENTIAL_METHODS_IN_ORDER = {
10049
10049
  };
10050
10050
 
10051
10051
  // ../shared/src/cli-version.ts
10052
- var CLI_VERSION = "0.2.441";
10052
+ var CLI_VERSION = "0.2.443";
10053
10053
 
10054
10054
  // ../shared/src/version.ts
10055
10055
  function compareVersions(v1, v2) {
@@ -27103,8 +27103,10 @@ async function readSseStream(body, onEvent, shouldContinue = () => true) {
27103
27103
  }
27104
27104
  }
27105
27105
 
27106
+ // src/lib/monolith-url.ts
27107
+ var MONOLITH_URL = process.env.MONOLITH_URL || process.env.REPLICAS_MONOLITH_URL || "https://api.tryreplicas.com";
27108
+
27106
27109
  // src/lib/api.ts
27107
- var MONOLITH_URL = process.env.REPLICAS_MONOLITH_URL || "https://api.tryreplicas.com";
27108
27110
  async function buildOrgAuthHeaders() {
27109
27111
  const extraHeaders = {};
27110
27112
  if (isAgentMode()) {
@@ -28561,7 +28563,6 @@ function initCommand(options) {
28561
28563
 
28562
28564
  // src/lib/version-check.ts
28563
28565
  import chalk13 from "chalk";
28564
- var MONOLITH_URL2 = process.env.REPLICAS_MONOLITH_URL || "https://api.tryreplicas.com";
28565
28566
  var VERSION_CHECK_TIMEOUT = 2e3;
28566
28567
  function startUpdateCheck(currentVersion) {
28567
28568
  let notice = null;
@@ -28572,7 +28573,7 @@ function startUpdateCheck(currentVersion) {
28572
28573
  });
28573
28574
  void (async () => {
28574
28575
  try {
28575
- const response = await fetch(`${MONOLITH_URL2}/v1/cli/version`, {
28576
+ const response = await fetch(`${MONOLITH_URL}/v1/cli/version`, {
28576
28577
  signal: AbortSignal.timeout(VERSION_CHECK_TIMEOUT)
28577
28578
  });
28578
28579
  if (!response.ok) return;
@@ -29965,7 +29966,6 @@ Skipped "${response.name}" \u2014 a newer run of this automation owns it and wil
29965
29966
  import chalk18 from "chalk";
29966
29967
 
29967
29968
  // src/lib/agent-api.ts
29968
- var MONOLITH_URL3 = process.env.MONOLITH_URL || process.env.REPLICAS_MONOLITH_URL || "https://api.tryreplicas.com";
29969
29969
  var ENGINE_PORT = process.env.REPLICAS_ENGINE_PORT || "3737";
29970
29970
  async function agentFetch(path6, options) {
29971
29971
  const config3 = readAgentConfig();
@@ -29981,7 +29981,7 @@ async function agentFetch(path6, options) {
29981
29981
  ...options?.headers || {}
29982
29982
  };
29983
29983
  const body = options?.body === void 0 ? void 0 : isFormData ? options.body : JSON.stringify(options.body);
29984
- const response = await fetch(`${MONOLITH_URL3}${path6}`, {
29984
+ const response = await fetch(`${MONOLITH_URL}${path6}`, {
29985
29985
  ...options,
29986
29986
  headers,
29987
29987
  body
@@ -30100,7 +30100,7 @@ async function previewRemoveCommand(workspaceId, options) {
30100
30100
  import fs4 from "fs";
30101
30101
  import path5 from "path";
30102
30102
  function publicMediaUrl(mediaId, token) {
30103
- return `${MONOLITH_URL4}/v1/media/public/${mediaId}/${token}`;
30103
+ return `${MONOLITH_URL}/v1/media/public/${mediaId}/${token}`;
30104
30104
  }
30105
30105
  async function shareMedia(mediaId) {
30106
30106
  const { token } = await agentFetch(`/v1/engine/media/${mediaId}/share`, {
@@ -30108,7 +30108,6 @@ async function shareMedia(mediaId) {
30108
30108
  });
30109
30109
  return publicMediaUrl(mediaId, token);
30110
30110
  }
30111
- var MONOLITH_URL4 = process.env.MONOLITH_URL || process.env.REPLICAS_MONOLITH_URL || "https://api.tryreplicas.com";
30112
30111
  function mediaInfo(ext) {
30113
30112
  const { kind, mimeType } = classifyCanvasFilename(`.${ext}`);
30114
30113
  if (kind !== "image" && kind !== "video" && kind !== "audio") return void 0;
@@ -30180,7 +30179,7 @@ async function mediaUploadCommand(filePaths, options) {
30180
30179
  const result = results[i];
30181
30180
  if (result.status === "fulfilled") {
30182
30181
  const { fileName, media } = result.value;
30183
- console.log(`![${fileName}](${MONOLITH_URL4}/v1/media/${media.id})`);
30182
+ console.log(`![${fileName}](${MONOLITH_URL}/v1/media/${media.id})`);
30184
30183
  if (options.share) {
30185
30184
  try {
30186
30185
  console.log(`Forge embed: ![${fileName}](${await shareMedia(media.id)})`);
@@ -30224,7 +30223,7 @@ async function mediaListCommand(options) {
30224
30223
  const query = qs.toString() ? `?${qs.toString()}` : "";
30225
30224
  const { media } = await agentFetch(`/v1/engine/media${query}`);
30226
30225
  for (const m of media) {
30227
- console.log(`${MONOLITH_URL4}/v1/media/${m.id} ${m.kind} ${m.size} ${m.created_at}`);
30226
+ console.log(`${MONOLITH_URL}/v1/media/${m.id} ${m.kind} ${m.size} ${m.created_at}`);
30228
30227
  }
30229
30228
  }
30230
30229
 
@@ -30568,6 +30567,36 @@ async function learningsWithdrawCommand(id) {
30568
30567
  console.log(`Proposal withdrawn (id: ${proposal.id}).`);
30569
30568
  }
30570
30569
 
30570
+ // src/commands/mothership.ts
30571
+ async function mothershipSpawnCommand(options) {
30572
+ const channel = options.channel?.trim();
30573
+ const thread = options.thread?.trim();
30574
+ const prompt = options.prompt?.trim();
30575
+ const environment2 = options.environment?.trim();
30576
+ if (!channel || !thread || !prompt) {
30577
+ throw new Error("--channel, --thread, and --prompt are all required.");
30578
+ }
30579
+ await agentFetch("/v1/agent/mothership/spawn", {
30580
+ method: "POST",
30581
+ body: { channel_id: channel, thread_ts: thread, prompt, ...environment2 ? { environment_id: environment2 } : {} }
30582
+ });
30583
+ console.log("Workspace spawn requested. The new workspace will take over this Slack thread.");
30584
+ }
30585
+ async function mothershipRelayCommand(options) {
30586
+ const channel = options.channel?.trim();
30587
+ const thread = options.thread?.trim();
30588
+ const message = options.message?.trim();
30589
+ const user = options.user?.trim();
30590
+ if (!channel || !thread || !message) {
30591
+ throw new Error("--channel, --thread, and --message are all required.");
30592
+ }
30593
+ await agentFetch("/v1/agent/mothership/relay", {
30594
+ method: "POST",
30595
+ body: { channel_id: channel, thread_ts: thread, message, ...user ? { user_id: user } : {} }
30596
+ });
30597
+ console.log("Relayed to the thread's dedicated workspace.");
30598
+ }
30599
+
30571
30600
  // src/commands/computer/index.ts
30572
30601
  import { spawn as spawn5, spawnSync as spawnSync3 } from "child_process";
30573
30602
  import { createHash as createHash3 } from "crypto";
@@ -36119,7 +36148,6 @@ var MOCK_CHATS = [
36119
36148
  { id: "mock-claude", provider: "claude", title: "Claude Code", createdAt: "", updatedAt: "", processing: false, parentChatId: null },
36120
36149
  { id: "mock-codex", provider: "codex", title: "Codex", createdAt: "", updatedAt: "", processing: false, parentChatId: null }
36121
36150
  ];
36122
- var MONOLITH_URL5 = process.env.REPLICAS_MONOLITH_URL || "https://api.tryreplicas.com";
36123
36151
  var workspacePollingStarted = false;
36124
36152
  var queryClient = new QueryClient({
36125
36153
  defaultOptions: {
@@ -36132,7 +36160,7 @@ var queryClient = new QueryClient({
36132
36160
  var authValue = {
36133
36161
  getAccessToken: () => getValidToken(),
36134
36162
  getOrganizationId: () => getOrganizationId(),
36135
- monolithUrl: MONOLITH_URL5,
36163
+ monolithUrl: MONOLITH_URL,
36136
36164
  queryClient
36137
36165
  };
36138
36166
  function getAgentConnectHelp(provider) {
@@ -37879,6 +37907,31 @@ if (isAgentMode()) {
37879
37907
  if (error51 instanceof Error) {
37880
37908
  console.error(chalk24.red(`
37881
37909
  \u2717 ${error51.message}
37910
+ `));
37911
+ }
37912
+ process.exit(1);
37913
+ }
37914
+ });
37915
+ const mothership = program.command("mothership").description("Mothership triage operations");
37916
+ mothership.command("spawn").description("Spawn a dedicated workspace for a Slack thread and hand off to it").requiredOption("--channel <id>", "Slack channel id of the thread").requiredOption("--thread <ts>", "Slack thread timestamp").requiredOption("--prompt <text>", "Task prompt for the new workspace").option("--environment <id>", "Environment to spawn into (from `replicas environment list`); omit if unsure to let the user pick").action(async (options) => {
37917
+ try {
37918
+ await mothershipSpawnCommand(options);
37919
+ } catch (error51) {
37920
+ if (error51 instanceof Error) {
37921
+ console.error(chalk24.red(`
37922
+ \u2717 ${error51.message}
37923
+ `));
37924
+ }
37925
+ process.exit(1);
37926
+ }
37927
+ });
37928
+ mothership.command("relay").description("Relay a follow-up message into the workspace already bound to a Slack thread").requiredOption("--channel <id>", "Slack channel id of the thread").requiredOption("--thread <ts>", "Slack thread timestamp").requiredOption("--message <text>", "The follow-up message to deliver to the workspace").option("--user <id>", "Slack id of the follow-up's author (from the incoming message), for correct attribution").action(async (options) => {
37929
+ try {
37930
+ await mothershipRelayCommand(options);
37931
+ } catch (error51) {
37932
+ if (error51 instanceof Error) {
37933
+ console.error(chalk24.red(`
37934
+ \u2717 ${error51.message}
37882
37935
  `));
37883
37936
  }
37884
37937
  process.exit(1);
@@ -37938,7 +37991,8 @@ if (isAgentMode()) {
37938
37991
  "automation",
37939
37992
  "repos",
37940
37993
  "environment",
37941
- "learnings"
37994
+ "learnings",
37995
+ "mothership"
37942
37996
  ]);
37943
37997
  const kept = program.commands.filter((cmd) => allowed.has(cmd.name()));
37944
37998
  const cmds = program.commands;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "replicas-cli",
3
- "version": "0.2.441",
3
+ "version": "0.2.443",
4
4
  "description": "CLI for managing Replicas workspaces - SSH into cloud dev environments with automatic port forwarding",
5
5
  "main": "dist/index.mjs",
6
6
  "bin": {