replicas-cli 0.2.780 → 0.2.781
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 +4 -162
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -23565,7 +23565,6 @@ 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",
|
|
@@ -25766,13 +25765,6 @@ function removeTag(text2, tag) {
|
|
|
25766
25765
|
function removeReplicasInstructions(text2) {
|
|
25767
25766
|
return removeTag(text2, REPLICAS_INSTRUCTIONS_TAG);
|
|
25768
25767
|
}
|
|
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
25768
|
|
|
25777
25769
|
// ../shared/src/user-message-attachments.ts
|
|
25778
25770
|
var ATTACHMENT_PLACEHOLDER_REGEX = /^\[\d+ (?:(?:images?|files?)(?: and \d+ files?)? attached|(?:image )?attachments?)\]$/;
|
|
@@ -27894,31 +27886,6 @@ var SLASH_COMMANDS = [
|
|
|
27894
27886
|
}))
|
|
27895
27887
|
];
|
|
27896
27888
|
|
|
27897
|
-
// ../shared/src/terminal.ts
|
|
27898
|
-
var CONTROL_CHARACTERS = /[\u0000-\u001F\u007F-\u009F]/g;
|
|
27899
|
-
function sanitizeTerminalLine(value) {
|
|
27900
|
-
return value.replace(CONTROL_CHARACTERS, " ").trim();
|
|
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
|
-
}
|
|
27921
|
-
|
|
27922
27889
|
// ../shared/src/replicas-config.ts
|
|
27923
27890
|
var import_yaml = __toESM(require_dist());
|
|
27924
27891
|
|
|
@@ -27957,7 +27924,7 @@ var headlessAgentRequestSchema = external_exports.object({
|
|
|
27957
27924
|
});
|
|
27958
27925
|
|
|
27959
27926
|
// ../shared/src/cli-version.ts
|
|
27960
|
-
var CLI_VERSION = "0.2.
|
|
27927
|
+
var CLI_VERSION = "0.2.781";
|
|
27961
27928
|
|
|
27962
27929
|
// ../shared/src/version.ts
|
|
27963
27930
|
function compareVersions(v1, v2) {
|
|
@@ -31711,16 +31678,6 @@ async function automationCreateCommand(name, options) {
|
|
|
31711
31678
|
console.log(import_chalk20.default.red("--trigger-gitlab-exclude-users requires --trigger-gitlab"));
|
|
31712
31679
|
process.exit(1);
|
|
31713
31680
|
}
|
|
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
31681
|
const agentSelection = applyAgentSelection(
|
|
31725
31682
|
{
|
|
31726
31683
|
agent_provider: parseAgentProviderOption(options.agentProvider),
|
|
@@ -31862,8 +31819,7 @@ async function automationCreateCommand(name, options) {
|
|
|
31862
31819
|
...options.planMode ? { plan_mode: true } : {},
|
|
31863
31820
|
...options.goalMode ? { goal_mode: true } : {},
|
|
31864
31821
|
...options.fastMode ? { fast_mode: true } : {},
|
|
31865
|
-
...agentSelection
|
|
31866
|
-
...mothershipConfirmation ? { mothership_confirmation: mothershipConfirmation } : {}
|
|
31822
|
+
...agentSelection
|
|
31867
31823
|
};
|
|
31868
31824
|
console.log(import_chalk20.default.gray("\nCreating automation..."));
|
|
31869
31825
|
const response = await orgAuthenticatedFetch("/v1/automations", {
|
|
@@ -32762,81 +32718,6 @@ async function serviceLogsCommand(name, options) {
|
|
|
32762
32718
|
console.log(logs || "(no log output yet)");
|
|
32763
32719
|
}
|
|
32764
32720
|
|
|
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
32721
|
// src/commands/environment.ts
|
|
32841
32722
|
var import_fs6 = __toESM(require("fs"));
|
|
32842
32723
|
var import_chalk24 = __toESM(require("chalk"));
|
|
@@ -33369,7 +33250,6 @@ var organizationOptionalCommands = /* @__PURE__ */ new Set([
|
|
|
33369
33250
|
"login",
|
|
33370
33251
|
"logout",
|
|
33371
33252
|
"media",
|
|
33372
|
-
"mothership",
|
|
33373
33253
|
"org",
|
|
33374
33254
|
"service",
|
|
33375
33255
|
"whoami"
|
|
@@ -33695,7 +33575,7 @@ automation.command("get <id>").description("Get automation details by ID").actio
|
|
|
33695
33575
|
process.exit(1);
|
|
33696
33576
|
}
|
|
33697
33577
|
});
|
|
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("--
|
|
33578
|
+
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
33579
|
try {
|
|
33700
33580
|
await automationCreateCommand(name, {
|
|
33701
33581
|
...options,
|
|
@@ -34191,43 +34071,6 @@ if (isAgentMode()) {
|
|
|
34191
34071
|
process.exit(1);
|
|
34192
34072
|
}
|
|
34193
34073
|
});
|
|
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
34074
|
program.command("computer").description("Drive the workspace Linux desktop through replicas-computer");
|
|
34232
34075
|
const allowed = /* @__PURE__ */ new Set([
|
|
34233
34076
|
"identity",
|
|
@@ -34244,8 +34087,7 @@ if (isAgentMode()) {
|
|
|
34244
34087
|
"automation",
|
|
34245
34088
|
"repos",
|
|
34246
34089
|
"environment",
|
|
34247
|
-
"environment-setup"
|
|
34248
|
-
"mothership"
|
|
34090
|
+
"environment-setup"
|
|
34249
34091
|
]);
|
|
34250
34092
|
const kept = program.commands.filter((cmd) => allowed.has(cmd.name()));
|
|
34251
34093
|
const cmds = program.commands;
|