replicas-cli 0.2.780 → 0.2.782
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.
- package/dist/index.cjs +15 -163
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -23565,14 +23565,17 @@ var automationTriggerSchema = external_exports.discriminatedUnion("type", [
|
|
|
23565
23565
|
]);
|
|
23566
23566
|
|
|
23567
23567
|
// ../shared/src/replicas-mcp.ts
|
|
23568
|
-
var REPLICAS_MCP_SERVER_NAME = "replicas-mcp";
|
|
23569
23568
|
var REPLICAS_MCP_TOOLS = {
|
|
23570
23569
|
listEnvironments: "list_environments",
|
|
23571
23570
|
createAutomation: "create_automation",
|
|
23572
23571
|
spawn: "spawn_workspace",
|
|
23573
23572
|
relay: "relay_to_workspace",
|
|
23574
23573
|
linearStart: "start_linear_session",
|
|
23575
|
-
linearSessionIntent: "register_linear_session_intent"
|
|
23574
|
+
linearSessionIntent: "register_linear_session_intent",
|
|
23575
|
+
spawnSubagent: "spawn_subagent",
|
|
23576
|
+
messageSubagent: "message_subagent",
|
|
23577
|
+
listSubagents: "list_subagents",
|
|
23578
|
+
readSubagent: "read_subagent"
|
|
23576
23579
|
};
|
|
23577
23580
|
var automationToolInputSchema = external_exports.object({
|
|
23578
23581
|
name: external_exports.string().describe("Short automation name."),
|
|
@@ -25766,13 +25769,6 @@ function removeTag(text2, tag) {
|
|
|
25766
25769
|
function removeReplicasInstructions(text2) {
|
|
25767
25770
|
return removeTag(text2, REPLICAS_INSTRUCTIONS_TAG);
|
|
25768
25771
|
}
|
|
25769
|
-
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.
|
|
25770
|
-
- **Spawn** a dedicated workspace for the thread and hand off: \`${REPLICAS_MCP_TOOLS.spawn}\`, with \`environment_id\` when you chose one.
|
|
25771
|
-
- **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.
|
|
25772
|
-
- **List environments**: \`${REPLICAS_MCP_TOOLS.listEnvironments}\`.
|
|
25773
|
-
- **Create an automation**: \`${REPLICAS_MCP_TOOLS.createAutomation}\`, filling its \`confirmation_*\` arguments from the accepting message's envelope.
|
|
25774
|
-
- **Register a Linear session intent**: \`${REPLICAS_MCP_TOOLS.linearSessionIntent}\` with \`comment_id\` and \`action\`.
|
|
25775
|
-
- **Start a Linear session**: \`${REPLICAS_MCP_TOOLS.linearStart}\` with \`issue_id\`, \`agent_session_id\`, and \`prompt\`.`;
|
|
25776
25772
|
|
|
25777
25773
|
// ../shared/src/user-message-attachments.ts
|
|
25778
25774
|
var ATTACHMENT_PLACEHOLDER_REGEX = /^\[\d+ (?:(?:images?|files?)(?: and \d+ files?)? attached|(?:image )?attachments?)\]$/;
|
|
@@ -27893,31 +27889,12 @@ var SLASH_COMMANDS = [
|
|
|
27893
27889
|
providers: [...VALID_AGENT_PROVIDERS]
|
|
27894
27890
|
}))
|
|
27895
27891
|
];
|
|
27896
|
-
|
|
27897
|
-
|
|
27898
|
-
|
|
27899
|
-
|
|
27900
|
-
|
|
27901
|
-
}
|
|
27902
|
-
|
|
27903
|
-
// ../shared/src/mothership.ts
|
|
27904
|
-
function mothershipWorkspaceLine(workspaceId, workspaceName, webAppUrl) {
|
|
27905
|
-
return `Workspace: ${sanitizeTerminalLine(workspaceName ?? "") || "Workspace"} (${getWorkspaceDashboardUrl(workspaceId, { webAppUrl })})`;
|
|
27906
|
-
}
|
|
27907
|
-
async function waitForMothershipSpawn(getThreadWorkspace, options) {
|
|
27908
|
-
for (let attempt = 0; attempt < options.attempts; attempt++) {
|
|
27909
|
-
const { workspace_id, workspace_name } = await getThreadWorkspace();
|
|
27910
|
-
if (workspace_id) return `Spawned workspace.
|
|
27911
|
-
${mothershipWorkspaceLine(workspace_id, workspace_name, options.webAppUrl)}`;
|
|
27912
|
-
await new Promise((resolve2) => setTimeout(resolve2, 1e3));
|
|
27913
|
-
}
|
|
27914
|
-
return "Workspace spawn requested. The new workspace will take over this Slack thread.";
|
|
27915
|
-
}
|
|
27916
|
-
function formatMothershipRelayResult(result, webAppUrl) {
|
|
27917
|
-
const folded = result.folded_in ? ` Folded in ${result.folded_in} earlier relay${result.folded_in === 1 ? "" : "s"} that had not started yet.` : "";
|
|
27918
|
-
return `${result.interrupted ? `Interrupted the thread's dedicated workspace and relayed the message.${folded}` : "Relayed to the thread's dedicated workspace."}
|
|
27919
|
-
${mothershipWorkspaceLine(result.workspace_id, result.workspace_name, webAppUrl)}`;
|
|
27920
|
-
}
|
|
27892
|
+
var MULTITASK_SLASH_COMMAND = {
|
|
27893
|
+
command: "/multitask",
|
|
27894
|
+
description: "Hand work to parallel subagent workspaces that report back here.",
|
|
27895
|
+
argumentHint: "[prompt]",
|
|
27896
|
+
providers: [...VALID_AGENT_PROVIDERS]
|
|
27897
|
+
};
|
|
27921
27898
|
|
|
27922
27899
|
// ../shared/src/replicas-config.ts
|
|
27923
27900
|
var import_yaml = __toESM(require_dist());
|
|
@@ -27957,7 +27934,7 @@ var headlessAgentRequestSchema = external_exports.object({
|
|
|
27957
27934
|
});
|
|
27958
27935
|
|
|
27959
27936
|
// ../shared/src/cli-version.ts
|
|
27960
|
-
var CLI_VERSION = "0.2.
|
|
27937
|
+
var CLI_VERSION = "0.2.782";
|
|
27961
27938
|
|
|
27962
27939
|
// ../shared/src/version.ts
|
|
27963
27940
|
function compareVersions(v1, v2) {
|
|
@@ -31711,16 +31688,6 @@ async function automationCreateCommand(name, options) {
|
|
|
31711
31688
|
console.log(import_chalk20.default.red("--trigger-gitlab-exclude-users requires --trigger-gitlab"));
|
|
31712
31689
|
process.exit(1);
|
|
31713
31690
|
}
|
|
31714
|
-
const hasConfirmation = options.confirmationChannel || options.confirmationThread || options.confirmationMessageTs || options.confirmationUser;
|
|
31715
|
-
const mothershipConfirmation = options.confirmationChannel && options.confirmationThread && options.confirmationMessageTs && options.confirmationUser ? {
|
|
31716
|
-
channel_id: options.confirmationChannel,
|
|
31717
|
-
thread_ts: options.confirmationThread,
|
|
31718
|
-
message_ts: options.confirmationMessageTs,
|
|
31719
|
-
user_id: options.confirmationUser
|
|
31720
|
-
} : void 0;
|
|
31721
|
-
if (hasConfirmation && !mothershipConfirmation) {
|
|
31722
|
-
throw new Error("Every --confirmation-* option is required when creating an automation from Mothership.");
|
|
31723
|
-
}
|
|
31724
31691
|
const agentSelection = applyAgentSelection(
|
|
31725
31692
|
{
|
|
31726
31693
|
agent_provider: parseAgentProviderOption(options.agentProvider),
|
|
@@ -31862,8 +31829,7 @@ async function automationCreateCommand(name, options) {
|
|
|
31862
31829
|
...options.planMode ? { plan_mode: true } : {},
|
|
31863
31830
|
...options.goalMode ? { goal_mode: true } : {},
|
|
31864
31831
|
...options.fastMode ? { fast_mode: true } : {},
|
|
31865
|
-
...agentSelection
|
|
31866
|
-
...mothershipConfirmation ? { mothership_confirmation: mothershipConfirmation } : {}
|
|
31832
|
+
...agentSelection
|
|
31867
31833
|
};
|
|
31868
31834
|
console.log(import_chalk20.default.gray("\nCreating automation..."));
|
|
31869
31835
|
const response = await orgAuthenticatedFetch("/v1/automations", {
|
|
@@ -32762,81 +32728,6 @@ async function serviceLogsCommand(name, options) {
|
|
|
32762
32728
|
console.log(logs || "(no log output yet)");
|
|
32763
32729
|
}
|
|
32764
32730
|
|
|
32765
|
-
// src/commands/mothership.ts
|
|
32766
|
-
async function mothershipMonitorChannelCommand(options) {
|
|
32767
|
-
const channel = options.channel?.trim();
|
|
32768
|
-
const approvalChannel = options.approvalChannel?.trim();
|
|
32769
|
-
const approvalThread = options.approvalThread?.trim();
|
|
32770
|
-
const approvalMessageTs = options.approvalMessageTs?.trim();
|
|
32771
|
-
const approvalUser = options.approvalUser?.trim();
|
|
32772
|
-
if (!channel || !approvalChannel || !approvalThread || !approvalMessageTs || !approvalUser) {
|
|
32773
|
-
throw new Error("--channel and every --approval-* option are required.");
|
|
32774
|
-
}
|
|
32775
|
-
const body = {
|
|
32776
|
-
channel_id: channel,
|
|
32777
|
-
approval_channel_id: approvalChannel,
|
|
32778
|
-
approval_thread_ts: approvalThread,
|
|
32779
|
-
approval_message_ts: approvalMessageTs,
|
|
32780
|
-
approval_user_id: approvalUser,
|
|
32781
|
-
...options.instructions?.trim() ? { instructions: options.instructions.trim() } : {}
|
|
32782
|
-
};
|
|
32783
|
-
await agentFetch("/v1/agent/mothership/monitor-channel", {
|
|
32784
|
-
method: "POST",
|
|
32785
|
-
body
|
|
32786
|
-
});
|
|
32787
|
-
console.log(`Channel ${channel} is now monitored by Mothership.`);
|
|
32788
|
-
}
|
|
32789
|
-
async function mothershipSpawnCommand(options) {
|
|
32790
|
-
const channel = options.channel?.trim();
|
|
32791
|
-
const thread = options.thread?.trim();
|
|
32792
|
-
const messageTs = options.messageTs?.trim();
|
|
32793
|
-
const prompt = options.prompt?.trim();
|
|
32794
|
-
const user = options.user?.trim();
|
|
32795
|
-
const environment2 = options.environment?.trim();
|
|
32796
|
-
if (!channel || !thread || !messageTs || !prompt || !user) {
|
|
32797
|
-
throw new Error("--channel, --thread, --message-ts, --prompt, and --user are all required.");
|
|
32798
|
-
}
|
|
32799
|
-
const body = {
|
|
32800
|
-
channel_id: channel,
|
|
32801
|
-
thread_ts: thread,
|
|
32802
|
-
message_ts: messageTs,
|
|
32803
|
-
prompt,
|
|
32804
|
-
user_id: user,
|
|
32805
|
-
...environment2 ? { environment_id: environment2 } : {}
|
|
32806
|
-
};
|
|
32807
|
-
await agentFetch("/v1/agent/mothership/spawn", {
|
|
32808
|
-
method: "POST",
|
|
32809
|
-
body
|
|
32810
|
-
});
|
|
32811
|
-
console.log(await waitForMothershipSpawn(
|
|
32812
|
-
() => agentFetch(
|
|
32813
|
-
`/v1/agent/mothership/thread-workspace?channel_id=${encodeURIComponent(channel)}&thread_ts=${encodeURIComponent(thread)}`
|
|
32814
|
-
),
|
|
32815
|
-
{ attempts: 60, webAppUrl: process.env.REPLICAS_WEB_URL }
|
|
32816
|
-
));
|
|
32817
|
-
}
|
|
32818
|
-
async function mothershipRelayCommand(options) {
|
|
32819
|
-
const channel = options.channel?.trim();
|
|
32820
|
-
const thread = options.thread?.trim();
|
|
32821
|
-
const message = options.message?.trim();
|
|
32822
|
-
const user = options.user?.trim();
|
|
32823
|
-
if (!channel || !thread || !message) {
|
|
32824
|
-
throw new Error("--channel, --thread, and --message are all required.");
|
|
32825
|
-
}
|
|
32826
|
-
const body = {
|
|
32827
|
-
channel_id: channel,
|
|
32828
|
-
thread_ts: thread,
|
|
32829
|
-
message,
|
|
32830
|
-
...user ? { user_id: user } : {},
|
|
32831
|
-
...options.queue ? { queue: true } : {}
|
|
32832
|
-
};
|
|
32833
|
-
const result = await agentFetch("/v1/agent/mothership/relay", {
|
|
32834
|
-
method: "POST",
|
|
32835
|
-
body
|
|
32836
|
-
});
|
|
32837
|
-
console.log(formatMothershipRelayResult(result, process.env.REPLICAS_WEB_URL));
|
|
32838
|
-
}
|
|
32839
|
-
|
|
32840
32731
|
// src/commands/environment.ts
|
|
32841
32732
|
var import_fs6 = __toESM(require("fs"));
|
|
32842
32733
|
var import_chalk24 = __toESM(require("chalk"));
|
|
@@ -33369,7 +33260,6 @@ var organizationOptionalCommands = /* @__PURE__ */ new Set([
|
|
|
33369
33260
|
"login",
|
|
33370
33261
|
"logout",
|
|
33371
33262
|
"media",
|
|
33372
|
-
"mothership",
|
|
33373
33263
|
"org",
|
|
33374
33264
|
"service",
|
|
33375
33265
|
"whoami"
|
|
@@ -33695,7 +33585,7 @@ automation.command("get <id>").description("Get automation details by ID").actio
|
|
|
33695
33585
|
process.exit(1);
|
|
33696
33586
|
}
|
|
33697
33587
|
});
|
|
33698
|
-
automation.command("create [name]").description("Create a new automation").option("-p, --prompt <prompt>", "Prompt for the automation").option("-e, --environment <environment>", "Environment name or ID").option("--trigger-cron <schedule>", 'Cron schedule expression (e.g. "0 9 * * 1-5")').option("--trigger-cron-timezone <timezone>", "Timezone for cron trigger (default: UTC)").option("--trigger-github <event>", 'GitHub event (e.g. "pull_request.opened")').option("--trigger-github-repos <repos>", "Comma-separated repo names to filter GitHub trigger").option("--trigger-github-exclude-users <users>", "Comma-separated GitHub usernames to exclude from triggering (pass empty string to clear the list)").option("--trigger-gitlab <event>", 'GitLab event (e.g. "merge_request.opened")').option("--trigger-gitlab-repos <repos>", "Comma-separated repo names to filter GitLab trigger").option("--trigger-gitlab-exclude-users <users>", "Comma-separated GitLab usernames to exclude from triggering (pass empty string to clear the list)").option("--github-checks <names>", "Comma-separated GitHub check names to create on matching PRs (requires a PR opened/updated trigger)").option("--lifecycle <policy>", "Workspace lifecycle: archive_when_done, sleep_when_done, default").option("--sleep-when-done", "Sleep automation workspaces as soon as the agent finishes").option("--auto-stop-minutes <minutes>", "Inactivity timeout in minutes (3-1440, requires --lifecycle default)").option("--pr-followups", "Allow follow-up actions on matching PRs").option("--agent-provider <provider>", 'Coding agent to use: claude, codex, cursor (or "none" to inherit org default)').option("--model <model>", 'Model identifier (must be valid for --agent-provider; pass "none" to clear)').option("--thinking-level <level>", 'Thinking/reasoning level: low, medium, high, xhigh, max (or "none" to clear)').option("--plan-mode", "Run automation messages in plan mode").option("--goal-mode", "Set automation messages as goals").option("--fast-mode", "Run automation messages in fast mode").option("--personal", "Create a personal automation owned by the authenticated user").option("--
|
|
33588
|
+
automation.command("create [name]").description("Create a new automation").option("-p, --prompt <prompt>", "Prompt for the automation").option("-e, --environment <environment>", "Environment name or ID").option("--trigger-cron <schedule>", 'Cron schedule expression (e.g. "0 9 * * 1-5")').option("--trigger-cron-timezone <timezone>", "Timezone for cron trigger (default: UTC)").option("--trigger-github <event>", 'GitHub event (e.g. "pull_request.opened")').option("--trigger-github-repos <repos>", "Comma-separated repo names to filter GitHub trigger").option("--trigger-github-exclude-users <users>", "Comma-separated GitHub usernames to exclude from triggering (pass empty string to clear the list)").option("--trigger-gitlab <event>", 'GitLab event (e.g. "merge_request.opened")').option("--trigger-gitlab-repos <repos>", "Comma-separated repo names to filter GitLab trigger").option("--trigger-gitlab-exclude-users <users>", "Comma-separated GitLab usernames to exclude from triggering (pass empty string to clear the list)").option("--github-checks <names>", "Comma-separated GitHub check names to create on matching PRs (requires a PR opened/updated trigger)").option("--lifecycle <policy>", "Workspace lifecycle: archive_when_done, sleep_when_done, default").option("--sleep-when-done", "Sleep automation workspaces as soon as the agent finishes").option("--auto-stop-minutes <minutes>", "Inactivity timeout in minutes (3-1440, requires --lifecycle default)").option("--pr-followups", "Allow follow-up actions on matching PRs").option("--agent-provider <provider>", 'Coding agent to use: claude, codex, cursor (or "none" to inherit org default)').option("--model <model>", 'Model identifier (must be valid for --agent-provider; pass "none" to clear)').option("--thinking-level <level>", 'Thinking/reasoning level: low, medium, high, xhigh, max (or "none" to clear)').option("--plan-mode", "Run automation messages in plan mode").option("--goal-mode", "Set automation messages as goals").option("--fast-mode", "Run automation messages in fast mode").option("--personal", "Create a personal automation owned by the authenticated user").option("--in <duration>", "Run once after this long, e.g. 30m, 2h, 3d, 1w (inside a workspace, defaults --workspace to current)").option("--at <datetime>", "Run once at this ISO-8601 time with timezone, e.g. 2026-10-08T09:00:00-07:00").option("--max-runs <n>", 'Delete the automation after this many runs ("none" for unlimited)').option("--workspace <target>", "Where runs go: new (default, new workspace each run), reuse (one workspace created on the first run), current (this workspace), or a workspace ID").option("--background", "Keep it out of the main automations list (for offhand follow-ups)").option("--disabled", "Create in disabled state").action(async (name, options) => {
|
|
33699
33589
|
try {
|
|
33700
33590
|
await automationCreateCommand(name, {
|
|
33701
33591
|
...options,
|
|
@@ -34191,43 +34081,6 @@ if (isAgentMode()) {
|
|
|
34191
34081
|
process.exit(1);
|
|
34192
34082
|
}
|
|
34193
34083
|
});
|
|
34194
|
-
const mothership = program.command("mothership").description("Mothership triage operations");
|
|
34195
|
-
mothership.command("monitor-channel").description("Add a Slack channel to Mothership monitoring after an admin confirms").requiredOption("--channel <id>", "Slack channel id to monitor").option("--instructions <text>", "Editable channel-specific instructions").requiredOption("--approval-channel <id>", "Slack channel containing the admin confirmation").requiredOption("--approval-thread <ts>", "Slack thread containing the admin confirmation").requiredOption("--approval-message-ts <ts>", "Slack timestamp of the admin confirmation").requiredOption("--approval-user <id>", "Slack id of the confirming admin").action(async (options) => {
|
|
34196
|
-
try {
|
|
34197
|
-
await mothershipMonitorChannelCommand(options);
|
|
34198
|
-
} catch (error51) {
|
|
34199
|
-
if (error51 instanceof Error) {
|
|
34200
|
-
console.error(import_chalk25.default.red(`
|
|
34201
|
-
\u2717 ${error51.message}
|
|
34202
|
-
`));
|
|
34203
|
-
}
|
|
34204
|
-
process.exit(1);
|
|
34205
|
-
}
|
|
34206
|
-
});
|
|
34207
|
-
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("--message-ts <ts>", "Slack timestamp of the triggering message").requiredOption("--prompt <text>", "Task prompt for the new workspace").requiredOption("--user <id>", "Slack id of the triggering message's author").option("--environment <id>", "Environment to spawn into (from `replicas environment list`); omit if unsure to let the user pick").action(async (options) => {
|
|
34208
|
-
try {
|
|
34209
|
-
await mothershipSpawnCommand(options);
|
|
34210
|
-
} catch (error51) {
|
|
34211
|
-
if (error51 instanceof Error) {
|
|
34212
|
-
console.error(import_chalk25.default.red(`
|
|
34213
|
-
\u2717 ${error51.message}
|
|
34214
|
-
`));
|
|
34215
|
-
}
|
|
34216
|
-
process.exit(1);
|
|
34217
|
-
}
|
|
34218
|
-
});
|
|
34219
|
-
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").option("--queue", "Let active work finish before delivering this message").action(async (options) => {
|
|
34220
|
-
try {
|
|
34221
|
-
await mothershipRelayCommand(options);
|
|
34222
|
-
} catch (error51) {
|
|
34223
|
-
if (error51 instanceof Error) {
|
|
34224
|
-
console.error(import_chalk25.default.red(`
|
|
34225
|
-
\u2717 ${error51.message}
|
|
34226
|
-
`));
|
|
34227
|
-
}
|
|
34228
|
-
process.exit(1);
|
|
34229
|
-
}
|
|
34230
|
-
});
|
|
34231
34084
|
program.command("computer").description("Drive the workspace Linux desktop through replicas-computer");
|
|
34232
34085
|
const allowed = /* @__PURE__ */ new Set([
|
|
34233
34086
|
"identity",
|
|
@@ -34244,8 +34097,7 @@ if (isAgentMode()) {
|
|
|
34244
34097
|
"automation",
|
|
34245
34098
|
"repos",
|
|
34246
34099
|
"environment",
|
|
34247
|
-
"environment-setup"
|
|
34248
|
-
"mothership"
|
|
34100
|
+
"environment-setup"
|
|
34249
34101
|
]);
|
|
34250
34102
|
const kept = program.commands.filter((cmd) => allowed.has(cmd.name()));
|
|
34251
34103
|
const cmds = program.commands;
|