replicas-cli 0.3.124 → 0.3.126
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 +103 -11
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -24009,7 +24009,24 @@ var REPLICAS_MCP_TOOLS = {
|
|
|
24009
24009
|
listSubagents: "list_subagents",
|
|
24010
24010
|
readSubagent: "read_subagent",
|
|
24011
24011
|
archiveSubagent: "archive_subagent",
|
|
24012
|
-
waitForSubagents: "wait_for_subagents"
|
|
24012
|
+
waitForSubagents: "wait_for_subagents",
|
|
24013
|
+
createReplica: "create_replica",
|
|
24014
|
+
listReplicas: "list_replicas",
|
|
24015
|
+
getReplica: "get_replica",
|
|
24016
|
+
deleteReplica: "delete_replica",
|
|
24017
|
+
wakeReplica: "wake_replica",
|
|
24018
|
+
sleepReplica: "sleep_replica",
|
|
24019
|
+
archiveReplica: "archive_replica",
|
|
24020
|
+
waitForReplica: "wait_for_replica",
|
|
24021
|
+
runCommand: "run_command",
|
|
24022
|
+
getReplicaHooks: "get_replica_hooks",
|
|
24023
|
+
whoami: "whoami",
|
|
24024
|
+
sendReplicaMessage: "send_replica_message",
|
|
24025
|
+
readReplicaHistory: "read_replica_history",
|
|
24026
|
+
listChats: "list_chats",
|
|
24027
|
+
createChat: "create_chat",
|
|
24028
|
+
deleteChat: "delete_chat",
|
|
24029
|
+
listRepositories: "list_repositories"
|
|
24013
24030
|
};
|
|
24014
24031
|
var automationToolInputSchema = external_exports.object({
|
|
24015
24032
|
name: external_exports.string().describe("Short automation name."),
|
|
@@ -24988,6 +25005,12 @@ var computeExecRequestSchema = external_exports.object({
|
|
|
24988
25005
|
env: computeEnvSchema.optional(),
|
|
24989
25006
|
detach: external_exports.boolean().optional()
|
|
24990
25007
|
});
|
|
25008
|
+
var computeUploadRequestSchema = external_exports.object({
|
|
25009
|
+
size: external_exports.number().int().min(1).max(COMPUTE_SANDBOX_LIMITS.maxTransferBytes)
|
|
25010
|
+
});
|
|
25011
|
+
var computeTransferPathSchema = external_exports.object({
|
|
25012
|
+
path: external_exports.string().min(1).max(4096).optional()
|
|
25013
|
+
});
|
|
24991
25014
|
|
|
24992
25015
|
// ../shared/src/default-skills/replicas-agent/abilities/gpu.ts
|
|
24993
25016
|
var SECTION6 = `### GPU sandboxes
|
|
@@ -26534,6 +26557,27 @@ var MOTHERSHIP_TOOL_ACTIONS = {
|
|
|
26534
26557
|
[REPLICAS_MCP_TOOLS.archiveSubagent]: "archive",
|
|
26535
26558
|
[REPLICAS_MCP_TOOLS.waitForSubagents]: "wait"
|
|
26536
26559
|
};
|
|
26560
|
+
var REPLICAS_API_STEPS = {
|
|
26561
|
+
[REPLICAS_MCP_TOOLS.createReplica]: { icon: "network", live: "Creating workspace", done: "Created workspace" },
|
|
26562
|
+
[REPLICAS_MCP_TOOLS.listReplicas]: { icon: "list", live: "Listing workspaces", done: "Listed workspaces" },
|
|
26563
|
+
[REPLICAS_MCP_TOOLS.getReplica]: { icon: "search", live: "Checking workspace", done: "Checked workspace" },
|
|
26564
|
+
[REPLICAS_MCP_TOOLS.deleteReplica]: { icon: "trash", live: "Deleting workspace", done: "Deleted workspace" },
|
|
26565
|
+
[REPLICAS_MCP_TOOLS.wakeReplica]: { icon: "zap", live: "Waking workspace", done: "Woke workspace" },
|
|
26566
|
+
[REPLICAS_MCP_TOOLS.sleepReplica]: { icon: "clock", live: "Putting workspace to sleep", done: "Put workspace to sleep" },
|
|
26567
|
+
[REPLICAS_MCP_TOOLS.archiveReplica]: { icon: "archive", live: "Archiving workspace", done: "Archived workspace" },
|
|
26568
|
+
[REPLICAS_MCP_TOOLS.waitForReplica]: { icon: "clock", live: "Waiting for workspace", done: "Waited for workspace" },
|
|
26569
|
+
[REPLICAS_MCP_TOOLS.runCommand]: { icon: "terminal", live: "Running", done: "Ran" },
|
|
26570
|
+
[REPLICAS_MCP_TOOLS.getReplicaHooks]: { icon: "terminal", live: "Reading hook logs", done: "Read hook logs" },
|
|
26571
|
+
[REPLICAS_MCP_TOOLS.whoami]: { icon: "search", live: "Checking identity", done: "Checked identity" },
|
|
26572
|
+
[REPLICAS_MCP_TOOLS.sendReplicaMessage]: { icon: "message", live: "Messaging workspace", done: "Messaged workspace" },
|
|
26573
|
+
[REPLICAS_MCP_TOOLS.readReplicaHistory]: { icon: "book", live: "Reading workspace history", done: "Read workspace history" },
|
|
26574
|
+
[REPLICAS_MCP_TOOLS.listChats]: { icon: "list", live: "Listing chats", done: "Listed chats" },
|
|
26575
|
+
[REPLICAS_MCP_TOOLS.createChat]: { icon: "message", live: "Creating chat", done: "Created chat" },
|
|
26576
|
+
[REPLICAS_MCP_TOOLS.deleteChat]: { icon: "trash", live: "Deleting chat", done: "Deleted chat" },
|
|
26577
|
+
[REPLICAS_MCP_TOOLS.listRepositories]: { icon: "folder", live: "Listing repositories", done: "Listed repositories" },
|
|
26578
|
+
[REPLICAS_MCP_TOOLS.listEnvironments]: { icon: "list", live: "Listing environments", done: "Listed environments" },
|
|
26579
|
+
[REPLICAS_MCP_TOOLS.createAutomation]: { icon: "clock", live: "Creating automation", done: "Created automation" }
|
|
26580
|
+
};
|
|
26537
26581
|
|
|
26538
26582
|
// ../shared/src/user-message-attachments.ts
|
|
26539
26583
|
var ATTACHMENT_PLACEHOLDER_REGEX = /^\[\d+ (?:(?:images?|files?)(?: and \d+ files?)? attached|(?:image )?attachments?)\]$/;
|
|
@@ -28731,7 +28775,7 @@ var headlessAgentRequestSchema = external_exports.object({
|
|
|
28731
28775
|
});
|
|
28732
28776
|
|
|
28733
28777
|
// ../shared/src/cli-version.ts
|
|
28734
|
-
var CLI_VERSION = "0.3.
|
|
28778
|
+
var CLI_VERSION = "0.3.126";
|
|
28735
28779
|
|
|
28736
28780
|
// ../shared/src/version.ts
|
|
28737
28781
|
function compareVersions(v1, v2) {
|
|
@@ -33842,6 +33886,12 @@ var import_chalk27 = __toESM(require("chalk"));
|
|
|
33842
33886
|
|
|
33843
33887
|
// src/lib/agent-api.ts
|
|
33844
33888
|
var ENGINE_PORT = process.env.REPLICAS_ENGINE_PORT || "3737";
|
|
33889
|
+
var AgentRequestError = class extends Error {
|
|
33890
|
+
constructor(message2, status) {
|
|
33891
|
+
super(message2);
|
|
33892
|
+
this.status = status;
|
|
33893
|
+
}
|
|
33894
|
+
};
|
|
33845
33895
|
async function agentFetch(path8, options) {
|
|
33846
33896
|
return (await agentRequest(path8, options)).json();
|
|
33847
33897
|
}
|
|
@@ -33869,7 +33919,7 @@ async function agentRequest(path8, options) {
|
|
|
33869
33919
|
});
|
|
33870
33920
|
if (!response.ok) {
|
|
33871
33921
|
const error51 = await response.json().catch(() => ({ error: "Request failed" }));
|
|
33872
|
-
throw new
|
|
33922
|
+
throw new AgentRequestError(error51.error || `Request failed with status ${response.status}`, response.status);
|
|
33873
33923
|
}
|
|
33874
33924
|
return response;
|
|
33875
33925
|
}
|
|
@@ -34246,7 +34296,9 @@ async function mediaGifCommand(input, options) {
|
|
|
34246
34296
|
// src/commands/gpu.ts
|
|
34247
34297
|
var import_chalk28 = __toESM(require("chalk"));
|
|
34248
34298
|
var import_node_child_process2 = require("child_process");
|
|
34299
|
+
var import_node_crypto2 = require("crypto");
|
|
34249
34300
|
var import_node_fs2 = require("fs");
|
|
34301
|
+
var import_node_os2 = require("os");
|
|
34250
34302
|
var import_node_path2 = require("path");
|
|
34251
34303
|
var import_node_stream = require("stream");
|
|
34252
34304
|
var import_promises = require("stream/promises");
|
|
@@ -34406,6 +34458,9 @@ function archive(localPath) {
|
|
|
34406
34458
|
child.stdin.end(files.map((file2) => `${file2}\0`).join(""));
|
|
34407
34459
|
return child;
|
|
34408
34460
|
}
|
|
34461
|
+
function mustStream(error51) {
|
|
34462
|
+
return error51 instanceof AgentRequestError && (error51.status === 409 || error51.status === 404);
|
|
34463
|
+
}
|
|
34409
34464
|
async function push(sandboxId, localPath, remotePath) {
|
|
34410
34465
|
const tar = archive(localPath);
|
|
34411
34466
|
let stderr = "";
|
|
@@ -34413,11 +34468,40 @@ async function push(sandboxId, localPath, remotePath) {
|
|
|
34413
34468
|
stderr += chunk.toString();
|
|
34414
34469
|
});
|
|
34415
34470
|
const exited = new Promise((done) => tar.on("close", done));
|
|
34416
|
-
|
|
34417
|
-
|
|
34418
|
-
|
|
34419
|
-
|
|
34420
|
-
|
|
34471
|
+
const pathQuery = `?path=${encodeURIComponent(remotePath)}`;
|
|
34472
|
+
const archivePath = (0, import_node_path2.join)((0, import_node_os2.tmpdir)(), `replicas-push-${(0, import_node_crypto2.randomUUID)()}.tgz`);
|
|
34473
|
+
try {
|
|
34474
|
+
await (0, import_promises.pipeline)(tar.stdout, (0, import_node_fs2.createWriteStream)(archivePath, { mode: 384 }));
|
|
34475
|
+
if (await exited !== 0) throw new Error(`Archiving ${localPath} failed: ${stderr.trim()}`);
|
|
34476
|
+
try {
|
|
34477
|
+
const size = (0, import_node_fs2.statSync)(archivePath).size;
|
|
34478
|
+
const { uploadId, uploadUrl } = await agentFetch(`${BASE}/${sandboxId}/uploads`, {
|
|
34479
|
+
method: "POST",
|
|
34480
|
+
body: { size }
|
|
34481
|
+
});
|
|
34482
|
+
const chunks = (0, import_node_fs2.createReadStream)(archivePath)[Symbol.asyncIterator]();
|
|
34483
|
+
const upload = {
|
|
34484
|
+
method: "PUT",
|
|
34485
|
+
headers: { "content-type": "application/gzip", "content-length": String(size) },
|
|
34486
|
+
body: new ReadableStream({
|
|
34487
|
+
async pull(controller) {
|
|
34488
|
+
const { done, value } = await chunks.next();
|
|
34489
|
+
if (done) controller.close();
|
|
34490
|
+
else controller.enqueue(value);
|
|
34491
|
+
}
|
|
34492
|
+
}),
|
|
34493
|
+
duplex: "half"
|
|
34494
|
+
};
|
|
34495
|
+
const uploaded = await fetch(uploadUrl, upload);
|
|
34496
|
+
if (!uploaded.ok) throw new Error(`Uploading ${localPath} failed (${uploaded.status})`);
|
|
34497
|
+
await agentRequest(`${BASE}/${sandboxId}/uploads/${uploadId}/extract`, { method: "POST", body: { path: remotePath } });
|
|
34498
|
+
} catch (error51) {
|
|
34499
|
+
if (!mustStream(error51)) throw error51;
|
|
34500
|
+
await agentRequest(`${BASE}/${sandboxId}/files${pathQuery}`, { method: "PUT", body: import_node_stream.Readable.toWeb((0, import_node_fs2.createReadStream)(archivePath)) });
|
|
34501
|
+
}
|
|
34502
|
+
} finally {
|
|
34503
|
+
(0, import_node_fs2.rmSync)(archivePath, { force: true });
|
|
34504
|
+
}
|
|
34421
34505
|
}
|
|
34422
34506
|
async function gpuPushCommand(localPath = ".", remotePath = COMPUTE_SANDBOX_WORKDIR, options = {}) {
|
|
34423
34507
|
const sandboxId = await resolveSandboxId(options);
|
|
@@ -34425,7 +34509,15 @@ async function gpuPushCommand(localPath = ".", remotePath = COMPUTE_SANDBOX_WORK
|
|
|
34425
34509
|
outputSuccess(`Copied ${localPath} to ${remotePath} in ${sandboxId}`);
|
|
34426
34510
|
}
|
|
34427
34511
|
async function pull(sandboxId, remotePath, localPath) {
|
|
34428
|
-
|
|
34512
|
+
let response;
|
|
34513
|
+
try {
|
|
34514
|
+
const { downloadUrl } = await agentFetch(`${BASE}/${sandboxId}/downloads`, { method: "POST", body: { path: remotePath } });
|
|
34515
|
+
response = await fetch(downloadUrl);
|
|
34516
|
+
} catch (error51) {
|
|
34517
|
+
if (!mustStream(error51)) throw error51;
|
|
34518
|
+
response = await agentRequest(`${BASE}/${sandboxId}/files?path=${encodeURIComponent(remotePath)}`);
|
|
34519
|
+
}
|
|
34520
|
+
if (!response.ok || !response.body) throw new Error(`Downloading ${remotePath} failed (${response.status})`);
|
|
34429
34521
|
(0, import_node_fs2.mkdirSync)(localPath, { recursive: true });
|
|
34430
34522
|
const tar = (0, import_node_child_process2.spawn)("tar", ["-xzf", "-", "-C", localPath], { stdio: ["pipe", "ignore", "pipe"] });
|
|
34431
34523
|
let stderr = "";
|
|
@@ -34575,9 +34667,9 @@ async function slackThreadSwitchCommand(workspace, options) {
|
|
|
34575
34667
|
var import_chalk31 = __toESM(require("chalk"));
|
|
34576
34668
|
var import_node_child_process3 = require("child_process");
|
|
34577
34669
|
var import_node_fs5 = require("fs");
|
|
34578
|
-
var
|
|
34670
|
+
var import_node_os3 = require("os");
|
|
34579
34671
|
var import_node_path4 = require("path");
|
|
34580
|
-
var SERVICES_DIR = (0, import_node_path4.join)((0,
|
|
34672
|
+
var SERVICES_DIR = (0, import_node_path4.join)((0, import_node_os3.homedir)(), ".replicas", "services");
|
|
34581
34673
|
var NAME_PATTERN = /^[a-zA-Z0-9][a-zA-Z0-9._-]*$/;
|
|
34582
34674
|
function isValidServiceName(name) {
|
|
34583
34675
|
return NAME_PATTERN.test(name);
|