replicas-cli 0.2.778 → 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 +11 -162
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -7744,6 +7744,13 @@ var CREDENTIAL_TYPE = {
|
|
|
7744
7744
|
MUSE_OAUTH: "muse_oauth",
|
|
7745
7745
|
MUSE_API_KEY: "muse_api_key"
|
|
7746
7746
|
};
|
|
7747
|
+
var ENVIRONMENT_AUTH_REQUIRED_KEYS = {
|
|
7748
|
+
[AGENT.CLAUDE]: [
|
|
7749
|
+
[CREDENTIAL_METHOD.BEDROCK, ["CLAUDE_CODE_USE_BEDROCK", "AWS_ACCESS_KEY_ID", "AWS_SECRET_ACCESS_KEY"]],
|
|
7750
|
+
[CREDENTIAL_METHOD.API_KEY, ["ANTHROPIC_API_KEY"]]
|
|
7751
|
+
],
|
|
7752
|
+
[AGENT.CODEX]: [[CREDENTIAL_METHOD.API_KEY, ["OPENAI_API_KEY"]]]
|
|
7753
|
+
};
|
|
7747
7754
|
var INFERENCE_PROVIDER_LABELS = {
|
|
7748
7755
|
[CREDENTIAL_METHOD.OLLAMA]: "Ollama",
|
|
7749
7756
|
[CREDENTIAL_METHOD.OPENCODE_GO]: "OpenCode Go",
|
|
@@ -23558,7 +23565,6 @@ var automationTriggerSchema = external_exports.discriminatedUnion("type", [
|
|
|
23558
23565
|
]);
|
|
23559
23566
|
|
|
23560
23567
|
// ../shared/src/replicas-mcp.ts
|
|
23561
|
-
var REPLICAS_MCP_SERVER_NAME = "replicas-mcp";
|
|
23562
23568
|
var REPLICAS_MCP_TOOLS = {
|
|
23563
23569
|
listEnvironments: "list_environments",
|
|
23564
23570
|
createAutomation: "create_automation",
|
|
@@ -25759,13 +25765,6 @@ function removeTag(text2, tag) {
|
|
|
25759
25765
|
function removeReplicasInstructions(text2) {
|
|
25760
25766
|
return removeTag(text2, REPLICAS_INSTRUCTIONS_TAG);
|
|
25761
25767
|
}
|
|
25762
|
-
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.
|
|
25763
|
-
- **Spawn** a dedicated workspace for the thread and hand off: \`${REPLICAS_MCP_TOOLS.spawn}\`, with \`environment_id\` when you chose one.
|
|
25764
|
-
- **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.
|
|
25765
|
-
- **List environments**: \`${REPLICAS_MCP_TOOLS.listEnvironments}\`.
|
|
25766
|
-
- **Create an automation**: \`${REPLICAS_MCP_TOOLS.createAutomation}\`, filling its \`confirmation_*\` arguments from the accepting message's envelope.
|
|
25767
|
-
- **Register a Linear session intent**: \`${REPLICAS_MCP_TOOLS.linearSessionIntent}\` with \`comment_id\` and \`action\`.
|
|
25768
|
-
- **Start a Linear session**: \`${REPLICAS_MCP_TOOLS.linearStart}\` with \`issue_id\`, \`agent_session_id\`, and \`prompt\`.`;
|
|
25769
25768
|
|
|
25770
25769
|
// ../shared/src/user-message-attachments.ts
|
|
25771
25770
|
var ATTACHMENT_PLACEHOLDER_REGEX = /^\[\d+ (?:(?:images?|files?)(?: and \d+ files?)? attached|(?:image )?attachments?)\]$/;
|
|
@@ -27887,31 +27886,6 @@ var SLASH_COMMANDS = [
|
|
|
27887
27886
|
}))
|
|
27888
27887
|
];
|
|
27889
27888
|
|
|
27890
|
-
// ../shared/src/terminal.ts
|
|
27891
|
-
var CONTROL_CHARACTERS = /[\u0000-\u001F\u007F-\u009F]/g;
|
|
27892
|
-
function sanitizeTerminalLine(value) {
|
|
27893
|
-
return value.replace(CONTROL_CHARACTERS, " ").trim();
|
|
27894
|
-
}
|
|
27895
|
-
|
|
27896
|
-
// ../shared/src/mothership.ts
|
|
27897
|
-
function mothershipWorkspaceLine(workspaceId, workspaceName, webAppUrl) {
|
|
27898
|
-
return `Workspace: ${sanitizeTerminalLine(workspaceName ?? "") || "Workspace"} (${getWorkspaceDashboardUrl(workspaceId, { webAppUrl })})`;
|
|
27899
|
-
}
|
|
27900
|
-
async function waitForMothershipSpawn(getThreadWorkspace, options) {
|
|
27901
|
-
for (let attempt = 0; attempt < options.attempts; attempt++) {
|
|
27902
|
-
const { workspace_id, workspace_name } = await getThreadWorkspace();
|
|
27903
|
-
if (workspace_id) return `Spawned workspace.
|
|
27904
|
-
${mothershipWorkspaceLine(workspace_id, workspace_name, options.webAppUrl)}`;
|
|
27905
|
-
await new Promise((resolve2) => setTimeout(resolve2, 1e3));
|
|
27906
|
-
}
|
|
27907
|
-
return "Workspace spawn requested. The new workspace will take over this Slack thread.";
|
|
27908
|
-
}
|
|
27909
|
-
function formatMothershipRelayResult(result, webAppUrl) {
|
|
27910
|
-
const folded = result.folded_in ? ` Folded in ${result.folded_in} earlier relay${result.folded_in === 1 ? "" : "s"} that had not started yet.` : "";
|
|
27911
|
-
return `${result.interrupted ? `Interrupted the thread's dedicated workspace and relayed the message.${folded}` : "Relayed to the thread's dedicated workspace."}
|
|
27912
|
-
${mothershipWorkspaceLine(result.workspace_id, result.workspace_name, webAppUrl)}`;
|
|
27913
|
-
}
|
|
27914
|
-
|
|
27915
27889
|
// ../shared/src/replicas-config.ts
|
|
27916
27890
|
var import_yaml = __toESM(require_dist());
|
|
27917
27891
|
|
|
@@ -27950,7 +27924,7 @@ var headlessAgentRequestSchema = external_exports.object({
|
|
|
27950
27924
|
});
|
|
27951
27925
|
|
|
27952
27926
|
// ../shared/src/cli-version.ts
|
|
27953
|
-
var CLI_VERSION = "0.2.
|
|
27927
|
+
var CLI_VERSION = "0.2.781";
|
|
27954
27928
|
|
|
27955
27929
|
// ../shared/src/version.ts
|
|
27956
27930
|
function compareVersions(v1, v2) {
|
|
@@ -31704,16 +31678,6 @@ async function automationCreateCommand(name, options) {
|
|
|
31704
31678
|
console.log(import_chalk20.default.red("--trigger-gitlab-exclude-users requires --trigger-gitlab"));
|
|
31705
31679
|
process.exit(1);
|
|
31706
31680
|
}
|
|
31707
|
-
const hasConfirmation = options.confirmationChannel || options.confirmationThread || options.confirmationMessageTs || options.confirmationUser;
|
|
31708
|
-
const mothershipConfirmation = options.confirmationChannel && options.confirmationThread && options.confirmationMessageTs && options.confirmationUser ? {
|
|
31709
|
-
channel_id: options.confirmationChannel,
|
|
31710
|
-
thread_ts: options.confirmationThread,
|
|
31711
|
-
message_ts: options.confirmationMessageTs,
|
|
31712
|
-
user_id: options.confirmationUser
|
|
31713
|
-
} : void 0;
|
|
31714
|
-
if (hasConfirmation && !mothershipConfirmation) {
|
|
31715
|
-
throw new Error("Every --confirmation-* option is required when creating an automation from Mothership.");
|
|
31716
|
-
}
|
|
31717
31681
|
const agentSelection = applyAgentSelection(
|
|
31718
31682
|
{
|
|
31719
31683
|
agent_provider: parseAgentProviderOption(options.agentProvider),
|
|
@@ -31855,8 +31819,7 @@ async function automationCreateCommand(name, options) {
|
|
|
31855
31819
|
...options.planMode ? { plan_mode: true } : {},
|
|
31856
31820
|
...options.goalMode ? { goal_mode: true } : {},
|
|
31857
31821
|
...options.fastMode ? { fast_mode: true } : {},
|
|
31858
|
-
...agentSelection
|
|
31859
|
-
...mothershipConfirmation ? { mothership_confirmation: mothershipConfirmation } : {}
|
|
31822
|
+
...agentSelection
|
|
31860
31823
|
};
|
|
31861
31824
|
console.log(import_chalk20.default.gray("\nCreating automation..."));
|
|
31862
31825
|
const response = await orgAuthenticatedFetch("/v1/automations", {
|
|
@@ -32755,81 +32718,6 @@ async function serviceLogsCommand(name, options) {
|
|
|
32755
32718
|
console.log(logs || "(no log output yet)");
|
|
32756
32719
|
}
|
|
32757
32720
|
|
|
32758
|
-
// src/commands/mothership.ts
|
|
32759
|
-
async function mothershipMonitorChannelCommand(options) {
|
|
32760
|
-
const channel = options.channel?.trim();
|
|
32761
|
-
const approvalChannel = options.approvalChannel?.trim();
|
|
32762
|
-
const approvalThread = options.approvalThread?.trim();
|
|
32763
|
-
const approvalMessageTs = options.approvalMessageTs?.trim();
|
|
32764
|
-
const approvalUser = options.approvalUser?.trim();
|
|
32765
|
-
if (!channel || !approvalChannel || !approvalThread || !approvalMessageTs || !approvalUser) {
|
|
32766
|
-
throw new Error("--channel and every --approval-* option are required.");
|
|
32767
|
-
}
|
|
32768
|
-
const body = {
|
|
32769
|
-
channel_id: channel,
|
|
32770
|
-
approval_channel_id: approvalChannel,
|
|
32771
|
-
approval_thread_ts: approvalThread,
|
|
32772
|
-
approval_message_ts: approvalMessageTs,
|
|
32773
|
-
approval_user_id: approvalUser,
|
|
32774
|
-
...options.instructions?.trim() ? { instructions: options.instructions.trim() } : {}
|
|
32775
|
-
};
|
|
32776
|
-
await agentFetch("/v1/agent/mothership/monitor-channel", {
|
|
32777
|
-
method: "POST",
|
|
32778
|
-
body
|
|
32779
|
-
});
|
|
32780
|
-
console.log(`Channel ${channel} is now monitored by Mothership.`);
|
|
32781
|
-
}
|
|
32782
|
-
async function mothershipSpawnCommand(options) {
|
|
32783
|
-
const channel = options.channel?.trim();
|
|
32784
|
-
const thread = options.thread?.trim();
|
|
32785
|
-
const messageTs = options.messageTs?.trim();
|
|
32786
|
-
const prompt = options.prompt?.trim();
|
|
32787
|
-
const user = options.user?.trim();
|
|
32788
|
-
const environment2 = options.environment?.trim();
|
|
32789
|
-
if (!channel || !thread || !messageTs || !prompt || !user) {
|
|
32790
|
-
throw new Error("--channel, --thread, --message-ts, --prompt, and --user are all required.");
|
|
32791
|
-
}
|
|
32792
|
-
const body = {
|
|
32793
|
-
channel_id: channel,
|
|
32794
|
-
thread_ts: thread,
|
|
32795
|
-
message_ts: messageTs,
|
|
32796
|
-
prompt,
|
|
32797
|
-
user_id: user,
|
|
32798
|
-
...environment2 ? { environment_id: environment2 } : {}
|
|
32799
|
-
};
|
|
32800
|
-
await agentFetch("/v1/agent/mothership/spawn", {
|
|
32801
|
-
method: "POST",
|
|
32802
|
-
body
|
|
32803
|
-
});
|
|
32804
|
-
console.log(await waitForMothershipSpawn(
|
|
32805
|
-
() => agentFetch(
|
|
32806
|
-
`/v1/agent/mothership/thread-workspace?channel_id=${encodeURIComponent(channel)}&thread_ts=${encodeURIComponent(thread)}`
|
|
32807
|
-
),
|
|
32808
|
-
{ attempts: 60, webAppUrl: process.env.REPLICAS_WEB_URL }
|
|
32809
|
-
));
|
|
32810
|
-
}
|
|
32811
|
-
async function mothershipRelayCommand(options) {
|
|
32812
|
-
const channel = options.channel?.trim();
|
|
32813
|
-
const thread = options.thread?.trim();
|
|
32814
|
-
const message = options.message?.trim();
|
|
32815
|
-
const user = options.user?.trim();
|
|
32816
|
-
if (!channel || !thread || !message) {
|
|
32817
|
-
throw new Error("--channel, --thread, and --message are all required.");
|
|
32818
|
-
}
|
|
32819
|
-
const body = {
|
|
32820
|
-
channel_id: channel,
|
|
32821
|
-
thread_ts: thread,
|
|
32822
|
-
message,
|
|
32823
|
-
...user ? { user_id: user } : {},
|
|
32824
|
-
...options.queue ? { queue: true } : {}
|
|
32825
|
-
};
|
|
32826
|
-
const result = await agentFetch("/v1/agent/mothership/relay", {
|
|
32827
|
-
method: "POST",
|
|
32828
|
-
body
|
|
32829
|
-
});
|
|
32830
|
-
console.log(formatMothershipRelayResult(result, process.env.REPLICAS_WEB_URL));
|
|
32831
|
-
}
|
|
32832
|
-
|
|
32833
32721
|
// src/commands/environment.ts
|
|
32834
32722
|
var import_fs6 = __toESM(require("fs"));
|
|
32835
32723
|
var import_chalk24 = __toESM(require("chalk"));
|
|
@@ -33362,7 +33250,6 @@ var organizationOptionalCommands = /* @__PURE__ */ new Set([
|
|
|
33362
33250
|
"login",
|
|
33363
33251
|
"logout",
|
|
33364
33252
|
"media",
|
|
33365
|
-
"mothership",
|
|
33366
33253
|
"org",
|
|
33367
33254
|
"service",
|
|
33368
33255
|
"whoami"
|
|
@@ -33688,7 +33575,7 @@ automation.command("get <id>").description("Get automation details by ID").actio
|
|
|
33688
33575
|
process.exit(1);
|
|
33689
33576
|
}
|
|
33690
33577
|
});
|
|
33691
|
-
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) => {
|
|
33692
33579
|
try {
|
|
33693
33580
|
await automationCreateCommand(name, {
|
|
33694
33581
|
...options,
|
|
@@ -34184,43 +34071,6 @@ if (isAgentMode()) {
|
|
|
34184
34071
|
process.exit(1);
|
|
34185
34072
|
}
|
|
34186
34073
|
});
|
|
34187
|
-
const mothership = program.command("mothership").description("Mothership triage operations");
|
|
34188
|
-
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) => {
|
|
34189
|
-
try {
|
|
34190
|
-
await mothershipMonitorChannelCommand(options);
|
|
34191
|
-
} catch (error51) {
|
|
34192
|
-
if (error51 instanceof Error) {
|
|
34193
|
-
console.error(import_chalk25.default.red(`
|
|
34194
|
-
\u2717 ${error51.message}
|
|
34195
|
-
`));
|
|
34196
|
-
}
|
|
34197
|
-
process.exit(1);
|
|
34198
|
-
}
|
|
34199
|
-
});
|
|
34200
|
-
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) => {
|
|
34201
|
-
try {
|
|
34202
|
-
await mothershipSpawnCommand(options);
|
|
34203
|
-
} catch (error51) {
|
|
34204
|
-
if (error51 instanceof Error) {
|
|
34205
|
-
console.error(import_chalk25.default.red(`
|
|
34206
|
-
\u2717 ${error51.message}
|
|
34207
|
-
`));
|
|
34208
|
-
}
|
|
34209
|
-
process.exit(1);
|
|
34210
|
-
}
|
|
34211
|
-
});
|
|
34212
|
-
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) => {
|
|
34213
|
-
try {
|
|
34214
|
-
await mothershipRelayCommand(options);
|
|
34215
|
-
} catch (error51) {
|
|
34216
|
-
if (error51 instanceof Error) {
|
|
34217
|
-
console.error(import_chalk25.default.red(`
|
|
34218
|
-
\u2717 ${error51.message}
|
|
34219
|
-
`));
|
|
34220
|
-
}
|
|
34221
|
-
process.exit(1);
|
|
34222
|
-
}
|
|
34223
|
-
});
|
|
34224
34074
|
program.command("computer").description("Drive the workspace Linux desktop through replicas-computer");
|
|
34225
34075
|
const allowed = /* @__PURE__ */ new Set([
|
|
34226
34076
|
"identity",
|
|
@@ -34237,8 +34087,7 @@ if (isAgentMode()) {
|
|
|
34237
34087
|
"automation",
|
|
34238
34088
|
"repos",
|
|
34239
34089
|
"environment",
|
|
34240
|
-
"environment-setup"
|
|
34241
|
-
"mothership"
|
|
34090
|
+
"environment-setup"
|
|
34242
34091
|
]);
|
|
34243
34092
|
const kept = program.commands.filter((cmd) => allowed.has(cmd.name()));
|
|
34244
34093
|
const cmds = program.commands;
|