replicas-cli 0.2.126 → 0.2.127
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.mjs +29 -6
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -2440,7 +2440,7 @@ function resolveKind(ext, override) {
|
|
|
2440
2440
|
}
|
|
2441
2441
|
return inferred;
|
|
2442
2442
|
}
|
|
2443
|
-
async function
|
|
2443
|
+
async function uploadOne(filePath, options) {
|
|
2444
2444
|
const absPath = path4.resolve(filePath);
|
|
2445
2445
|
if (!fs3.existsSync(absPath)) {
|
|
2446
2446
|
throw new Error(`File not found: ${absPath}`);
|
|
@@ -2464,11 +2464,34 @@ async function mediaUploadCommand(filePath, options) {
|
|
|
2464
2464
|
method: "POST",
|
|
2465
2465
|
body: form
|
|
2466
2466
|
});
|
|
2467
|
-
|
|
2467
|
+
return { fileName, media };
|
|
2468
|
+
}
|
|
2469
|
+
async function mediaUploadCommand(filePaths, options) {
|
|
2470
|
+
if (filePaths.length === 0) {
|
|
2471
|
+
throw new Error("No files specified");
|
|
2472
|
+
}
|
|
2473
|
+
if (options.kind && !MEDIA_KINDS.includes(options.kind)) {
|
|
2474
|
+
throw new Error(`Invalid kind '${options.kind}'. Must be one of: ${MEDIA_KINDS.join(", ")}`);
|
|
2475
|
+
}
|
|
2476
|
+
const results = await Promise.allSettled(filePaths.map((p) => uploadOne(p, options)));
|
|
2477
|
+
const failures = [];
|
|
2478
|
+
for (let i = 0; i < results.length; i++) {
|
|
2479
|
+
const result = results[i];
|
|
2480
|
+
if (result.status === "fulfilled") {
|
|
2481
|
+
console.log(``);
|
|
2482
|
+
} else {
|
|
2483
|
+
const error = result.reason instanceof Error ? result.reason : new Error(String(result.reason));
|
|
2484
|
+
failures.push({ filePath: filePaths[i], error });
|
|
2485
|
+
}
|
|
2486
|
+
}
|
|
2468
2487
|
const config2 = readAgentConfig();
|
|
2469
|
-
if (config2?.workspace_id) {
|
|
2488
|
+
if (config2?.workspace_id && failures.length < filePaths.length) {
|
|
2470
2489
|
console.log(`View in Replicas: ${getWorkspaceDashboardUrl(config2.workspace_id, { mode: "media" })}`);
|
|
2471
2490
|
}
|
|
2491
|
+
if (failures.length > 0) {
|
|
2492
|
+
const detail = failures.map((f) => `${f.filePath}: ${f.error.message}`).join("; ");
|
|
2493
|
+
throw new Error(`${failures.length} of ${filePaths.length} upload(s) failed \u2014 ${detail}`);
|
|
2494
|
+
}
|
|
2472
2495
|
}
|
|
2473
2496
|
async function mediaListCommand(options) {
|
|
2474
2497
|
const qs = new URLSearchParams();
|
|
@@ -2502,7 +2525,7 @@ async function interactiveCommand() {
|
|
|
2502
2525
|
}
|
|
2503
2526
|
|
|
2504
2527
|
// src/index.ts
|
|
2505
|
-
var CLI_VERSION = "0.2.
|
|
2528
|
+
var CLI_VERSION = "0.2.127";
|
|
2506
2529
|
var program = new Command();
|
|
2507
2530
|
program.name("replicas").description("CLI for managing Replicas workspaces").version(CLI_VERSION);
|
|
2508
2531
|
program.command("login").description("Authenticate with your Replicas account").action(async () => {
|
|
@@ -2916,9 +2939,9 @@ if (isAgentMode()) {
|
|
|
2916
2939
|
}
|
|
2917
2940
|
if (isAgentMode()) {
|
|
2918
2941
|
const media = program.command("media").description("Share workspace media (screenshots, videos, audio) inline in chat");
|
|
2919
|
-
media.command("upload <
|
|
2942
|
+
media.command("upload <files...>").description("Upload one or more screenshot, video, or audio files. Multiple files are uploaded concurrently. Prints a markdown embed per file for the assistant reply.").option("-k, --kind <kind>", "Media kind: image, video, or audio (inferred from extension if omitted)").option("-s, --session-id <id>", "Session ID to associate the asset with").action(async (files, options) => {
|
|
2920
2943
|
try {
|
|
2921
|
-
await mediaUploadCommand(
|
|
2944
|
+
await mediaUploadCommand(files, options);
|
|
2922
2945
|
} catch (error) {
|
|
2923
2946
|
if (error instanceof Error) {
|
|
2924
2947
|
console.error(chalk19.red(`
|