replicas-cli 0.3.441 → 0.3.443
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 +513 -459
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -38669,7 +38669,7 @@ var CLI_VERSION;
|
|
|
38669
38669
|
var init_cli_version = __esm({
|
|
38670
38670
|
"../shared/src/cli-version.ts"() {
|
|
38671
38671
|
"use strict";
|
|
38672
|
-
CLI_VERSION = "0.3.
|
|
38672
|
+
CLI_VERSION = "0.3.443";
|
|
38673
38673
|
}
|
|
38674
38674
|
});
|
|
38675
38675
|
|
|
@@ -50452,6 +50452,7 @@ async function buildOrgAuthHeaders() {
|
|
|
50452
50452
|
throw new Error("Agent mode config is incomplete");
|
|
50453
50453
|
}
|
|
50454
50454
|
extraHeaders["X-Workspace-Id"] = agent.workspace_id;
|
|
50455
|
+
if (process.env.REPLICAS_CHAT_ID) extraHeaders["X-Replicas-Chat-Id"] = process.env.REPLICAS_CHAT_ID;
|
|
50455
50456
|
return { bearer: agent.engine_secret, extraHeaders };
|
|
50456
50457
|
}
|
|
50457
50458
|
const apiKey = getApiKey();
|
|
@@ -50971,6 +50972,113 @@ var init_logout = __esm({
|
|
|
50971
50972
|
}
|
|
50972
50973
|
});
|
|
50973
50974
|
|
|
50975
|
+
// ../shared/src/currency.ts
|
|
50976
|
+
function formatCents(cents) {
|
|
50977
|
+
return `$${(cents / 100).toLocaleString("en-US", { minimumFractionDigits: 2, maximumFractionDigits: 2 })}`;
|
|
50978
|
+
}
|
|
50979
|
+
var init_currency = __esm({
|
|
50980
|
+
"../shared/src/currency.ts"() {
|
|
50981
|
+
"use strict";
|
|
50982
|
+
}
|
|
50983
|
+
});
|
|
50984
|
+
|
|
50985
|
+
// src/lib/command-utils.ts
|
|
50986
|
+
function formatDate(dateString) {
|
|
50987
|
+
return new Date(dateString).toLocaleString();
|
|
50988
|
+
}
|
|
50989
|
+
function printReplicaActivity(activity) {
|
|
50990
|
+
console.log(import_chalk6.default.gray(` Agent: ${activity.state.replaceAll("_", " ")}${activity.current_step ? ` \xB7 ${activity.current_step}` : ""}`));
|
|
50991
|
+
if (activity.last_agent_message) console.log(import_chalk6.default.gray(` Last message: ${activity.last_agent_message}`));
|
|
50992
|
+
}
|
|
50993
|
+
function ensureOrgApiAuthenticated() {
|
|
50994
|
+
if (!canCallOrgApi()) {
|
|
50995
|
+
throw new Error('Not logged in. Run "replicas login" or "replicas login --api-key".');
|
|
50996
|
+
}
|
|
50997
|
+
}
|
|
50998
|
+
function resolveByNameOrId(input2, items) {
|
|
50999
|
+
return items.find((item) => item.id === input2 || item.name === input2);
|
|
51000
|
+
}
|
|
51001
|
+
function parseKeyValuePairs(pairs) {
|
|
51002
|
+
return Object.fromEntries(pairs.map((pair) => {
|
|
51003
|
+
const separator = pair.indexOf("=");
|
|
51004
|
+
if (separator < 1) throw new Error(`Expected key=value, got: ${pair}`);
|
|
51005
|
+
return [pair.slice(0, separator), pair.slice(separator + 1)];
|
|
51006
|
+
}));
|
|
51007
|
+
}
|
|
51008
|
+
async function confirmAction(message2) {
|
|
51009
|
+
if (!isInteractive()) throw new Error(`${message2} Pass -f to confirm without a terminal.`);
|
|
51010
|
+
const { confirm } = await (0, import_prompts8.default)({ type: "confirm", name: "confirm", message: message2, initial: false });
|
|
51011
|
+
if (!confirm) console.log(import_chalk6.default.yellow("\nCancelled."));
|
|
51012
|
+
return Boolean(confirm);
|
|
51013
|
+
}
|
|
51014
|
+
function parseRequestTimeout(value) {
|
|
51015
|
+
if (!value) return VARIABLE_REQUEST_WAIT.defaultMs;
|
|
51016
|
+
const timeout = /^(\d+)(s|m)?$/.exec(value.trim());
|
|
51017
|
+
if (!timeout) throw new Error(`Invalid timeout "${value}". Use seconds or minutes, for example 90s or 10m`);
|
|
51018
|
+
return Math.min(Math.max(Number(timeout[1]) * (timeout[2] === "m" ? 6e4 : 1e3), VARIABLE_REQUEST_WAIT.pollMs), VARIABLE_REQUEST_WAIT.maxMs);
|
|
51019
|
+
}
|
|
51020
|
+
async function waitForUser(params) {
|
|
51021
|
+
const { timeoutMs } = params;
|
|
51022
|
+
if (!isJsonMode()) console.log(import_chalk6.default.gray(`
|
|
51023
|
+
${params.asked} Waiting up to ${timeoutMs >= 6e4 ? `${Math.round(timeoutMs / 6e4)} minute(s)` : `${timeoutMs / 1e3} seconds`}\u2026`));
|
|
51024
|
+
let value = params.initial;
|
|
51025
|
+
const deadline = Date.now() + timeoutMs;
|
|
51026
|
+
while (!params.settled(value) && Date.now() < deadline) {
|
|
51027
|
+
await new Promise((resolve4) => setTimeout(resolve4, VARIABLE_REQUEST_WAIT.pollMs));
|
|
51028
|
+
value = await params.poll(true);
|
|
51029
|
+
}
|
|
51030
|
+
return params.settled(value) ? value : params.poll(false);
|
|
51031
|
+
}
|
|
51032
|
+
var import_chalk6, import_prompts8;
|
|
51033
|
+
var init_command_utils = __esm({
|
|
51034
|
+
"src/lib/command-utils.ts"() {
|
|
51035
|
+
"use strict";
|
|
51036
|
+
import_chalk6 = __toESM(require("chalk"));
|
|
51037
|
+
init_src();
|
|
51038
|
+
import_prompts8 = __toESM(require("prompts"));
|
|
51039
|
+
init_config();
|
|
51040
|
+
init_output();
|
|
51041
|
+
}
|
|
51042
|
+
});
|
|
51043
|
+
|
|
51044
|
+
// src/commands/billing.ts
|
|
51045
|
+
async function billingCommand() {
|
|
51046
|
+
output2(await orgAuthenticatedFetch("/v1/organization/billing/balance"), ({ plan, period_start, period_end, credit, limit, blocked }) => {
|
|
51047
|
+
console.log(brand.bold("\n Billing\n"));
|
|
51048
|
+
field("Plan", plan);
|
|
51049
|
+
field("Period", `${formatDate(period_start)} \u2013 ${formatDate(period_end)}`);
|
|
51050
|
+
if (credit) {
|
|
51051
|
+
field("Balance", `${import_chalk7.default.bold(formatCents(credit.remaining_cents))} left, ${formatCents(credit.used_cents)} used of ${formatCents(credit.total_cents)}`);
|
|
51052
|
+
if (credit.one_time_cents) field("Credit", `${formatCents(credit.plan_cents)} plan + ${formatCents(credit.one_time_cents)} one-time`);
|
|
51053
|
+
if (credit.overage_cents) field("Overage", formatCents(credit.overage_cents));
|
|
51054
|
+
}
|
|
51055
|
+
field("Limit", limit ? `${formatCents(limit.remaining_cents)} left before workspaces stop (${limit.kind === "credit" ? "credit" : "usage limit"} ${formatCents(limit.limit_cents)})` : "none");
|
|
51056
|
+
if (blocked) field("Blocked", import_chalk7.default.red(blocked.message));
|
|
51057
|
+
console.log();
|
|
51058
|
+
});
|
|
51059
|
+
}
|
|
51060
|
+
async function billingUsageCommand(options) {
|
|
51061
|
+
const query = new URLSearchParams(Object.entries(options).filter((entry) => !!entry[1]));
|
|
51062
|
+
const usage = await orgAuthenticatedFetch(`/v1/organization/billing/usage${query.size ? `?${query}` : ""}`);
|
|
51063
|
+
output2(usage, ({ points, sources }) => {
|
|
51064
|
+
for (const point of points) console.log(`${point.bucket} ${formatCents(point.cents)}`);
|
|
51065
|
+
console.log(import_chalk7.default.gray(`
|
|
51066
|
+
${sources.map((source) => `${source.source} ${formatCents(source.cents)}`).join(", ") || "No usage"}`));
|
|
51067
|
+
});
|
|
51068
|
+
}
|
|
51069
|
+
var import_chalk7;
|
|
51070
|
+
var init_billing2 = __esm({
|
|
51071
|
+
"src/commands/billing.ts"() {
|
|
51072
|
+
"use strict";
|
|
51073
|
+
import_chalk7 = __toESM(require("chalk"));
|
|
51074
|
+
init_currency();
|
|
51075
|
+
init_api2();
|
|
51076
|
+
init_command_utils();
|
|
51077
|
+
init_oauth_flow_ui();
|
|
51078
|
+
init_output();
|
|
51079
|
+
}
|
|
51080
|
+
});
|
|
51081
|
+
|
|
50974
51082
|
// src/commands/identity.ts
|
|
50975
51083
|
async function fetchToken(audience, awsSourceIdentity) {
|
|
50976
51084
|
let response;
|
|
@@ -51019,12 +51127,12 @@ async function identityTokenCommand(options) {
|
|
|
51019
51127
|
}
|
|
51020
51128
|
async function identityExecCommand(command, options) {
|
|
51021
51129
|
if (command.length === 0) {
|
|
51022
|
-
console.error(
|
|
51130
|
+
console.error(import_chalk8.default.red("Provide a command to run: replicas identity exec -- <command>"));
|
|
51023
51131
|
process.exit(1);
|
|
51024
51132
|
}
|
|
51025
51133
|
const tokenResult = await fetchToken(options.audience);
|
|
51026
51134
|
if (!tokenResult.ok) {
|
|
51027
|
-
console.error(
|
|
51135
|
+
console.error(import_chalk8.default.red(tokenResult.error.message));
|
|
51028
51136
|
process.exitCode = 1;
|
|
51029
51137
|
return;
|
|
51030
51138
|
}
|
|
@@ -51048,7 +51156,7 @@ async function identityAwsCredentialsCommand(options) {
|
|
|
51048
51156
|
}
|
|
51049
51157
|
const result = await fetchToken(options.audience, options.sourceIdentity);
|
|
51050
51158
|
if (!result.ok) {
|
|
51051
|
-
console.error(
|
|
51159
|
+
console.error(import_chalk8.default.red(result.error.message));
|
|
51052
51160
|
process.exitCode = 1;
|
|
51053
51161
|
return;
|
|
51054
51162
|
}
|
|
@@ -51095,7 +51203,7 @@ async function identityAwsCredentialsCommand(options) {
|
|
|
51095
51203
|
(0, import_node_fs.rmSync)(directory, { recursive: true, force: true });
|
|
51096
51204
|
}
|
|
51097
51205
|
}
|
|
51098
|
-
var import_node_crypto, import_node_fs, import_node_child_process, import_node_os, import_node_path,
|
|
51206
|
+
var import_node_crypto, import_node_fs, import_node_child_process, import_node_os, import_node_path, import_chalk8;
|
|
51099
51207
|
var init_identity = __esm({
|
|
51100
51208
|
"src/commands/identity.ts"() {
|
|
51101
51209
|
"use strict";
|
|
@@ -51104,71 +51212,12 @@ var init_identity = __esm({
|
|
|
51104
51212
|
import_node_child_process = require("child_process");
|
|
51105
51213
|
import_node_os = require("os");
|
|
51106
51214
|
import_node_path = require("path");
|
|
51107
|
-
|
|
51215
|
+
import_chalk8 = __toESM(require("chalk"));
|
|
51108
51216
|
init_output();
|
|
51109
51217
|
init_src();
|
|
51110
51218
|
}
|
|
51111
51219
|
});
|
|
51112
51220
|
|
|
51113
|
-
// src/lib/command-utils.ts
|
|
51114
|
-
function formatDate(dateString) {
|
|
51115
|
-
return new Date(dateString).toLocaleString();
|
|
51116
|
-
}
|
|
51117
|
-
function printReplicaActivity(activity) {
|
|
51118
|
-
console.log(import_chalk7.default.gray(` Agent: ${activity.state.replaceAll("_", " ")}${activity.current_step ? ` \xB7 ${activity.current_step}` : ""}`));
|
|
51119
|
-
if (activity.last_agent_message) console.log(import_chalk7.default.gray(` Last message: ${activity.last_agent_message}`));
|
|
51120
|
-
}
|
|
51121
|
-
function ensureOrgApiAuthenticated() {
|
|
51122
|
-
if (!canCallOrgApi()) {
|
|
51123
|
-
throw new Error('Not logged in. Run "replicas login" or "replicas login --api-key".');
|
|
51124
|
-
}
|
|
51125
|
-
}
|
|
51126
|
-
function resolveByNameOrId(input2, items) {
|
|
51127
|
-
return items.find((item) => item.id === input2 || item.name === input2);
|
|
51128
|
-
}
|
|
51129
|
-
function parseKeyValuePairs(pairs) {
|
|
51130
|
-
return Object.fromEntries(pairs.map((pair) => {
|
|
51131
|
-
const separator = pair.indexOf("=");
|
|
51132
|
-
if (separator < 1) throw new Error(`Expected key=value, got: ${pair}`);
|
|
51133
|
-
return [pair.slice(0, separator), pair.slice(separator + 1)];
|
|
51134
|
-
}));
|
|
51135
|
-
}
|
|
51136
|
-
async function confirmAction(message2) {
|
|
51137
|
-
if (!isInteractive()) throw new Error(`${message2} Pass -f to confirm without a terminal.`);
|
|
51138
|
-
const { confirm } = await (0, import_prompts8.default)({ type: "confirm", name: "confirm", message: message2, initial: false });
|
|
51139
|
-
if (!confirm) console.log(import_chalk7.default.yellow("\nCancelled."));
|
|
51140
|
-
return Boolean(confirm);
|
|
51141
|
-
}
|
|
51142
|
-
function parseRequestTimeout(value) {
|
|
51143
|
-
if (!value) return VARIABLE_REQUEST_WAIT.defaultMs;
|
|
51144
|
-
const timeout = /^(\d+)(s|m)?$/.exec(value.trim());
|
|
51145
|
-
if (!timeout) throw new Error(`Invalid timeout "${value}". Use seconds or minutes, for example 90s or 10m`);
|
|
51146
|
-
return Math.min(Math.max(Number(timeout[1]) * (timeout[2] === "m" ? 6e4 : 1e3), VARIABLE_REQUEST_WAIT.pollMs), VARIABLE_REQUEST_WAIT.maxMs);
|
|
51147
|
-
}
|
|
51148
|
-
async function waitForUser(params) {
|
|
51149
|
-
const { timeoutMs } = params;
|
|
51150
|
-
if (!isJsonMode()) console.log(import_chalk7.default.gray(`
|
|
51151
|
-
${params.asked} Waiting up to ${timeoutMs >= 6e4 ? `${Math.round(timeoutMs / 6e4)} minute(s)` : `${timeoutMs / 1e3} seconds`}\u2026`));
|
|
51152
|
-
let value = params.initial;
|
|
51153
|
-
const deadline = Date.now() + timeoutMs;
|
|
51154
|
-
while (!params.settled(value) && Date.now() < deadline) {
|
|
51155
|
-
await new Promise((resolve4) => setTimeout(resolve4, VARIABLE_REQUEST_WAIT.pollMs));
|
|
51156
|
-
value = await params.poll(true);
|
|
51157
|
-
}
|
|
51158
|
-
return params.settled(value) ? value : params.poll(false);
|
|
51159
|
-
}
|
|
51160
|
-
var import_chalk7, import_prompts8;
|
|
51161
|
-
var init_command_utils = __esm({
|
|
51162
|
-
"src/lib/command-utils.ts"() {
|
|
51163
|
-
"use strict";
|
|
51164
|
-
import_chalk7 = __toESM(require("chalk"));
|
|
51165
|
-
init_src();
|
|
51166
|
-
import_prompts8 = __toESM(require("prompts"));
|
|
51167
|
-
init_config();
|
|
51168
|
-
init_output();
|
|
51169
|
-
}
|
|
51170
|
-
});
|
|
51171
|
-
|
|
51172
51221
|
// src/lib/ssh.ts
|
|
51173
51222
|
function buildSSHArgs(token, host, proxyCommand, localForward) {
|
|
51174
51223
|
return [
|
|
@@ -51267,7 +51316,7 @@ async function resolveWorkspaceRecord(workspaceName) {
|
|
|
51267
51316
|
const exactWorkspace = await fetchWorkspaceById(workspaceName);
|
|
51268
51317
|
if (exactWorkspace) return exactWorkspace;
|
|
51269
51318
|
}
|
|
51270
|
-
console.log(
|
|
51319
|
+
console.log(import_chalk9.default.blue(workspaceName ? `
|
|
51271
51320
|
Searching for workspace: ${workspaceName}...` : "\nLoading workspaces..."));
|
|
51272
51321
|
const params = new URLSearchParams({ limit: "100" });
|
|
51273
51322
|
if (workspaceName) params.set("name", workspaceName);
|
|
@@ -51286,7 +51335,7 @@ Searching for workspace: ${workspaceName}...` : "\nLoading workspaces..."));
|
|
|
51286
51335
|
selectedWorkspace = workspaces[0];
|
|
51287
51336
|
} else {
|
|
51288
51337
|
if (workspaceName) {
|
|
51289
|
-
console.log(
|
|
51338
|
+
console.log(import_chalk9.default.yellow(`
|
|
51290
51339
|
Found ${workspaces.length} workspaces matching "${workspaceName}":`));
|
|
51291
51340
|
}
|
|
51292
51341
|
const selectResponse = await ask({
|
|
@@ -51308,9 +51357,9 @@ Found ${workspaces.length} workspaces matching "${workspaceName}":`));
|
|
|
51308
51357
|
}
|
|
51309
51358
|
selectedWorkspace = selected;
|
|
51310
51359
|
}
|
|
51311
|
-
console.log(
|
|
51360
|
+
console.log(import_chalk9.default.green(`
|
|
51312
51361
|
\u2713 Selected workspace: ${selectedWorkspace.name}`));
|
|
51313
|
-
console.log(
|
|
51362
|
+
console.log(import_chalk9.default.gray(` Status: ${selectedWorkspace.status || "unknown"}`));
|
|
51314
51363
|
return selectedWorkspace;
|
|
51315
51364
|
}
|
|
51316
51365
|
async function prepareWorkspaceConnection(workspaceName) {
|
|
@@ -51320,12 +51369,12 @@ async function prepareWorkspaceConnection(workspaceName) {
|
|
|
51320
51369
|
`Workspace is currently ${selectedWorkspace.status}. Wake it at ${DEFAULT_WEB_APP_URL}`
|
|
51321
51370
|
);
|
|
51322
51371
|
}
|
|
51323
|
-
console.log(
|
|
51372
|
+
console.log(import_chalk9.default.blue("\nRequesting SSH access token..."));
|
|
51324
51373
|
const tokenResponse = await orgAuthenticatedFetch(
|
|
51325
51374
|
`/v1/workspaces/${selectedWorkspace.id}/ssh-token`,
|
|
51326
51375
|
{ method: "POST" }
|
|
51327
51376
|
);
|
|
51328
|
-
console.log(
|
|
51377
|
+
console.log(import_chalk9.default.green("\u2713 SSH token received"));
|
|
51329
51378
|
let repoName = null;
|
|
51330
51379
|
if (isInsideGitRepo()) {
|
|
51331
51380
|
try {
|
|
@@ -51341,11 +51390,11 @@ async function prepareWorkspaceConnection(workspaceName) {
|
|
|
51341
51390
|
repoName
|
|
51342
51391
|
};
|
|
51343
51392
|
}
|
|
51344
|
-
var
|
|
51393
|
+
var import_chalk9;
|
|
51345
51394
|
var init_workspace_connection = __esm({
|
|
51346
51395
|
"src/lib/workspace-connection.ts"() {
|
|
51347
51396
|
"use strict";
|
|
51348
|
-
|
|
51397
|
+
import_chalk9 = __toESM(require("chalk"));
|
|
51349
51398
|
init_src();
|
|
51350
51399
|
init_config();
|
|
51351
51400
|
init_api2();
|
|
@@ -51358,19 +51407,19 @@ var init_workspace_connection = __esm({
|
|
|
51358
51407
|
async function connectCommand(workspaceName) {
|
|
51359
51408
|
ensureOrgApiAuthenticated();
|
|
51360
51409
|
const { workspace, sshToken, sshHost, sshProxyCommand } = await prepareWorkspaceConnection(workspaceName);
|
|
51361
|
-
console.log(
|
|
51410
|
+
console.log(import_chalk10.default.blue(`
|
|
51362
51411
|
Connecting to ${workspace.name}...`));
|
|
51363
51412
|
const sshCommand = `ssh ${sshToken}@${sshHost}`;
|
|
51364
|
-
console.log(
|
|
51365
|
-
console.log(
|
|
51413
|
+
console.log(import_chalk10.default.gray(`SSH command: ${sshCommand}`));
|
|
51414
|
+
console.log(import_chalk10.default.gray("\nPress Ctrl+D to disconnect.\n"));
|
|
51366
51415
|
await connectSSH(sshToken, sshHost, sshProxyCommand);
|
|
51367
|
-
console.log(
|
|
51416
|
+
console.log(import_chalk10.default.green("\n\u2713 Disconnected from workspace.\n"));
|
|
51368
51417
|
}
|
|
51369
|
-
var
|
|
51418
|
+
var import_chalk10;
|
|
51370
51419
|
var init_connect = __esm({
|
|
51371
51420
|
"src/commands/connect.ts"() {
|
|
51372
51421
|
"use strict";
|
|
51373
|
-
|
|
51422
|
+
import_chalk10 = __toESM(require("chalk"));
|
|
51374
51423
|
init_command_utils();
|
|
51375
51424
|
init_ssh();
|
|
51376
51425
|
init_workspace_connection();
|
|
@@ -51479,22 +51528,22 @@ async function codeCommand(workspaceName) {
|
|
|
51479
51528
|
}
|
|
51480
51529
|
const { workspace, sshToken, sshHost, sshProxyCommand, repoName } = await prepareWorkspaceConnection(workspaceName);
|
|
51481
51530
|
const hostAlias = getWorkspaceHostAlias(workspace.name);
|
|
51482
|
-
console.log(
|
|
51531
|
+
console.log(import_chalk11.default.blue("\nConfiguring SSH connection..."));
|
|
51483
51532
|
addOrUpdateSSHConfigEntry({
|
|
51484
51533
|
host: hostAlias,
|
|
51485
51534
|
hostname: sshHost,
|
|
51486
51535
|
user: sshToken,
|
|
51487
51536
|
proxyCommand: sshProxyCommand
|
|
51488
51537
|
});
|
|
51489
|
-
console.log(
|
|
51538
|
+
console.log(import_chalk11.default.green(`\u2713 SSH config entry created: ${hostAlias}`));
|
|
51490
51539
|
const paths = SANDBOX_PATHS;
|
|
51491
51540
|
const remotePath = repoName ? `${paths.WORKSPACES_DIR}/${repoName}` : paths.HOME_DIR;
|
|
51492
51541
|
const ideCommand = getIdeCommand();
|
|
51493
51542
|
const fullCommand = `${ideCommand} --remote ssh-remote+${hostAlias} ${remotePath}`;
|
|
51494
|
-
console.log(
|
|
51543
|
+
console.log(import_chalk11.default.blue(`
|
|
51495
51544
|
Opening ${ideCommand} for workspace ${workspace.name}...`));
|
|
51496
|
-
console.log(
|
|
51497
|
-
console.log(
|
|
51545
|
+
console.log(import_chalk11.default.gray(`Command: ${fullCommand}`));
|
|
51546
|
+
console.log(import_chalk11.default.yellow(`
|
|
51498
51547
|
Note: SSH tokens expire after 3 hours. Run this command again to refresh.`));
|
|
51499
51548
|
const ide = (0, import_child_process3.spawn)(ideCommand, [
|
|
51500
51549
|
"--remote",
|
|
@@ -51505,26 +51554,26 @@ Note: SSH tokens expire after 3 hours. Run this command again to refresh.`));
|
|
|
51505
51554
|
detached: false
|
|
51506
51555
|
});
|
|
51507
51556
|
ide.on("error", (error62) => {
|
|
51508
|
-
console.error(
|
|
51557
|
+
console.error(import_chalk11.default.red(`
|
|
51509
51558
|
Failed to launch ${ideCommand}: ${error62.message}`));
|
|
51510
|
-
console.log(
|
|
51559
|
+
console.log(import_chalk11.default.yellow(`
|
|
51511
51560
|
Make sure ${ideCommand} is installed and available in your PATH.`));
|
|
51512
|
-
console.log(
|
|
51561
|
+
console.log(import_chalk11.default.gray(`You can configure a different IDE with: replicas config set ide <command>`));
|
|
51513
51562
|
process.exit(1);
|
|
51514
51563
|
});
|
|
51515
51564
|
ide.on("close", (code) => {
|
|
51516
51565
|
if (code === 0) {
|
|
51517
|
-
console.log(
|
|
51566
|
+
console.log(import_chalk11.default.green(`
|
|
51518
51567
|
\u2713 ${ideCommand} closed successfully.
|
|
51519
51568
|
`));
|
|
51520
51569
|
}
|
|
51521
51570
|
});
|
|
51522
51571
|
}
|
|
51523
|
-
var
|
|
51572
|
+
var import_chalk11, import_child_process3;
|
|
51524
51573
|
var init_code = __esm({
|
|
51525
51574
|
"src/commands/code.ts"() {
|
|
51526
51575
|
"use strict";
|
|
51527
|
-
|
|
51576
|
+
import_chalk11 = __toESM(require("chalk"));
|
|
51528
51577
|
import_child_process3 = require("child_process");
|
|
51529
51578
|
init_src();
|
|
51530
51579
|
init_config();
|
|
@@ -51541,16 +51590,16 @@ async function tunnelCommand(workspaceName, options) {
|
|
|
51541
51590
|
const remotePort = parsePort(options.port);
|
|
51542
51591
|
const localPort = options.localPort ? parsePort(options.localPort) : remotePort;
|
|
51543
51592
|
const { workspace, sshToken, sshHost, sshProxyCommand } = await prepareWorkspaceConnection(workspaceName);
|
|
51544
|
-
console.log(
|
|
51593
|
+
console.log(import_chalk12.default.green(`
|
|
51545
51594
|
\u2713 Forwarding localhost:${localPort} to ${workspace.name}:${remotePort}`));
|
|
51546
|
-
console.log(
|
|
51595
|
+
console.log(import_chalk12.default.gray(" Press Ctrl+C to stop.\n"));
|
|
51547
51596
|
await connectSSH(sshToken, sshHost, sshProxyCommand, { localPort, remotePort });
|
|
51548
51597
|
}
|
|
51549
|
-
var
|
|
51598
|
+
var import_chalk12;
|
|
51550
51599
|
var init_tunnel = __esm({
|
|
51551
51600
|
"src/commands/tunnel.ts"() {
|
|
51552
51601
|
"use strict";
|
|
51553
|
-
|
|
51602
|
+
import_chalk12 = __toESM(require("chalk"));
|
|
51554
51603
|
init_command_utils();
|
|
51555
51604
|
init_port();
|
|
51556
51605
|
init_ssh();
|
|
@@ -51564,8 +51613,8 @@ async function orgCommand() {
|
|
|
51564
51613
|
const { organization } = await orgAuthenticatedFetch("/v1/whoami");
|
|
51565
51614
|
output2({ organization }, () => {
|
|
51566
51615
|
console.log(brand.bold("\n Active organization\n"));
|
|
51567
|
-
field("Organization",
|
|
51568
|
-
console.log(
|
|
51616
|
+
field("Organization", import_chalk13.default.bold(organization.name));
|
|
51617
|
+
console.log(import_chalk13.default.gray("\n Fixed by your API key. Use a key from another organization to switch.\n"));
|
|
51569
51618
|
});
|
|
51570
51619
|
return;
|
|
51571
51620
|
}
|
|
@@ -51574,8 +51623,8 @@ async function orgCommand() {
|
|
|
51574
51623
|
const organizations = await fetchOrganizations();
|
|
51575
51624
|
if (!currentOrgId) {
|
|
51576
51625
|
output2({ organization: null }, () => {
|
|
51577
|
-
console.log(
|
|
51578
|
-
console.log(
|
|
51626
|
+
console.log(import_chalk13.default.yellow("\n No organization selected."));
|
|
51627
|
+
console.log(import_chalk13.default.gray(' Run "replicas org switch" to select one.\n'));
|
|
51579
51628
|
});
|
|
51580
51629
|
return;
|
|
51581
51630
|
}
|
|
@@ -51583,8 +51632,8 @@ async function orgCommand() {
|
|
|
51583
51632
|
if (!currentOrg) {
|
|
51584
51633
|
clearOrganizationId();
|
|
51585
51634
|
output2({ organization: null }, () => {
|
|
51586
|
-
console.log(
|
|
51587
|
-
console.log(
|
|
51635
|
+
console.log(import_chalk13.default.yellow("\n The selected organization is no longer available to you."));
|
|
51636
|
+
console.log(import_chalk13.default.gray(' Run "replicas org switch" to select another.\n'));
|
|
51588
51637
|
});
|
|
51589
51638
|
return;
|
|
51590
51639
|
}
|
|
@@ -51597,7 +51646,7 @@ async function orgCommand() {
|
|
|
51597
51646
|
renderIdentity({ account, role, organizationName: currentOrg.name });
|
|
51598
51647
|
if (organizations.length > 1) {
|
|
51599
51648
|
console.log(
|
|
51600
|
-
|
|
51649
|
+
import_chalk13.default.gray(`
|
|
51601
51650
|
${organizations.length} organizations available. "replicas org switch" to change.`)
|
|
51602
51651
|
);
|
|
51603
51652
|
}
|
|
@@ -51620,7 +51669,7 @@ async function orgSwitchCommand() {
|
|
|
51620
51669
|
if (organizations.length > 1) {
|
|
51621
51670
|
const chosen = await promptForOrganization(organizations, currentOrgId);
|
|
51622
51671
|
if (!chosen) {
|
|
51623
|
-
console.log(
|
|
51672
|
+
console.log(import_chalk13.default.yellow("\n Cancelled. The active organization is unchanged.\n"));
|
|
51624
51673
|
return;
|
|
51625
51674
|
}
|
|
51626
51675
|
selectedId = chosen.id;
|
|
@@ -51645,11 +51694,11 @@ async function orgMembersCommand() {
|
|
|
51645
51694
|
}
|
|
51646
51695
|
});
|
|
51647
51696
|
}
|
|
51648
|
-
var
|
|
51697
|
+
var import_chalk13, NOT_LOGGED_IN;
|
|
51649
51698
|
var init_org = __esm({
|
|
51650
51699
|
"src/commands/org.ts"() {
|
|
51651
51700
|
"use strict";
|
|
51652
|
-
|
|
51701
|
+
import_chalk13 = __toESM(require("chalk"));
|
|
51653
51702
|
init_api2();
|
|
51654
51703
|
init_command_utils();
|
|
51655
51704
|
init_oauth_flow_ui();
|
|
@@ -51668,7 +51717,7 @@ function assertKnownKey(key) {
|
|
|
51668
51717
|
async function configGetCommand(key) {
|
|
51669
51718
|
ensureOrgApiAuthenticated();
|
|
51670
51719
|
assertKnownKey(key);
|
|
51671
|
-
output2({ ide: getIdeCommand() }, ({ ide }) => console.log(
|
|
51720
|
+
output2({ ide: getIdeCommand() }, ({ ide }) => console.log(import_chalk14.default.green(`
|
|
51672
51721
|
IDE command: ${ide}
|
|
51673
51722
|
`)));
|
|
51674
51723
|
}
|
|
@@ -51676,7 +51725,7 @@ async function configSetCommand(key, value) {
|
|
|
51676
51725
|
ensureOrgApiAuthenticated();
|
|
51677
51726
|
assertKnownKey(key);
|
|
51678
51727
|
setIdeCommand(value);
|
|
51679
|
-
output2({ ide: value }, () => console.log(
|
|
51728
|
+
output2({ ide: value }, () => console.log(import_chalk14.default.green(`
|
|
51680
51729
|
\u2713 IDE command set to: ${value}
|
|
51681
51730
|
`)));
|
|
51682
51731
|
}
|
|
@@ -51685,17 +51734,17 @@ async function configListCommand() {
|
|
|
51685
51734
|
const config3 = readConfig();
|
|
51686
51735
|
if (!config3) throw new Error("No config found. Please login first.");
|
|
51687
51736
|
output2({ organization_id: config3.organization_id ?? null, ide: config3.ide_command ?? null }, () => {
|
|
51688
|
-
console.log(
|
|
51689
|
-
console.log(
|
|
51690
|
-
console.log(
|
|
51737
|
+
console.log(import_chalk14.default.green("\nCurrent configuration:"));
|
|
51738
|
+
console.log(import_chalk14.default.gray(` Organization ID: ${config3.organization_id || (config3.api_key ? "(set by API key)" : "(not set)")}`));
|
|
51739
|
+
console.log(import_chalk14.default.gray(` IDE command: ${config3.ide_command || "code (default)"}`));
|
|
51691
51740
|
console.log();
|
|
51692
51741
|
});
|
|
51693
51742
|
}
|
|
51694
|
-
var
|
|
51743
|
+
var import_chalk14;
|
|
51695
51744
|
var init_config2 = __esm({
|
|
51696
51745
|
"src/commands/config.ts"() {
|
|
51697
51746
|
"use strict";
|
|
51698
|
-
|
|
51747
|
+
import_chalk14 = __toESM(require("chalk"));
|
|
51699
51748
|
init_config();
|
|
51700
51749
|
init_command_utils();
|
|
51701
51750
|
init_output();
|
|
@@ -51881,11 +51930,11 @@ async function withAuthRecovery(operation, afterReauthentication) {
|
|
|
51881
51930
|
throw error62;
|
|
51882
51931
|
}
|
|
51883
51932
|
const message2 = error62 instanceof NotAuthenticatedError ? "You're not signed in to Replicas. Signing in..." : "Your Replicas session expired. Re-authenticating...";
|
|
51884
|
-
console.log(
|
|
51933
|
+
console.log(import_chalk15.default.yellow(`
|
|
51885
51934
|
${message2}`));
|
|
51886
51935
|
await loginCommand();
|
|
51887
51936
|
await afterReauthentication?.();
|
|
51888
|
-
console.log(
|
|
51937
|
+
console.log(import_chalk15.default.gray(" Retrying..."));
|
|
51889
51938
|
return { result: await operation(), reauthenticated: true };
|
|
51890
51939
|
}
|
|
51891
51940
|
}
|
|
@@ -51961,12 +52010,12 @@ async function runCredentialAuthFlow(options, flow) {
|
|
|
51961
52010
|
return completionUrl.toString();
|
|
51962
52011
|
});
|
|
51963
52012
|
}
|
|
51964
|
-
var
|
|
52013
|
+
var import_chalk15, UPLOAD_STEPS;
|
|
51965
52014
|
var init_credential_upload = __esm({
|
|
51966
52015
|
"src/lib/credential-upload.ts"() {
|
|
51967
52016
|
"use strict";
|
|
51968
52017
|
init_urls();
|
|
51969
|
-
|
|
52018
|
+
import_chalk15 = __toESM(require("chalk"));
|
|
51970
52019
|
init_api2();
|
|
51971
52020
|
init_auth();
|
|
51972
52021
|
init_oauth_flow_ui();
|
|
@@ -52034,7 +52083,7 @@ async function promptForAuthorizationCode() {
|
|
|
52034
52083
|
const rl = import_readline.default.createInterface({ input: process.stdin, output: process.stdout });
|
|
52035
52084
|
return new Promise((resolve4) => {
|
|
52036
52085
|
rl.on("close", () => resolve4(""));
|
|
52037
|
-
rl.question(
|
|
52086
|
+
rl.question(import_chalk16.default.gray(" Paste code here: "), (answer) => {
|
|
52038
52087
|
resolve4(answer.trim());
|
|
52039
52088
|
rl.close();
|
|
52040
52089
|
});
|
|
@@ -52110,12 +52159,12 @@ async function runClaudeOAuthFlow(totalSteps) {
|
|
|
52110
52159
|
}
|
|
52111
52160
|
return exchangeCodeForTokens2(code, returnedState, state, pkce.codeVerifier);
|
|
52112
52161
|
}
|
|
52113
|
-
var import_readline,
|
|
52162
|
+
var import_readline, import_chalk16, DEFAULT_CLIENT_ID, CLAUDE_CLIENT_ID, AUTHORIZATION_ENDPOINT2, TOKEN_ENDPOINT2, REDIRECT_URI, SCOPES;
|
|
52114
52163
|
var init_claude_oauth = __esm({
|
|
52115
52164
|
"src/lib/claude-oauth.ts"() {
|
|
52116
52165
|
"use strict";
|
|
52117
52166
|
import_readline = __toESM(require("readline"));
|
|
52118
|
-
|
|
52167
|
+
import_chalk16 = __toESM(require("chalk"));
|
|
52119
52168
|
init_oauth_flow_ui();
|
|
52120
52169
|
init_output();
|
|
52121
52170
|
init_pkce();
|
|
@@ -52306,27 +52355,27 @@ function initCommand(options) {
|
|
|
52306
52355
|
}
|
|
52307
52356
|
const higherPriority = REPLICAS_CONFIG_FILENAMES.slice(0, REPLICAS_CONFIG_FILENAMES.indexOf(targetFilename)).filter((filename) => import_fs3.default.existsSync(import_path4.default.join(process.cwd(), filename)));
|
|
52308
52357
|
output2({ path: configPath, shadowed_by: higherPriority }, () => {
|
|
52309
|
-
console.log(
|
|
52358
|
+
console.log(import_chalk17.default.green(`\u2713 Created ${targetFilename}`));
|
|
52310
52359
|
for (const filename of higherPriority) {
|
|
52311
52360
|
console.log("");
|
|
52312
|
-
console.log(
|
|
52313
|
-
console.log(
|
|
52361
|
+
console.log(import_chalk17.default.yellow(`Warning: ${filename} already exists and takes priority over ${targetFilename}.`));
|
|
52362
|
+
console.log(import_chalk17.default.gray(`Remove or rename ${filename} for ${targetFilename} to take effect.`));
|
|
52314
52363
|
}
|
|
52315
52364
|
console.log("");
|
|
52316
|
-
console.log(
|
|
52317
|
-
console.log(
|
|
52318
|
-
console.log(
|
|
52365
|
+
console.log(import_chalk17.default.gray("Configuration options:"));
|
|
52366
|
+
console.log(import_chalk17.default.gray(" systemPrompt - Custom instructions for AI coding assistants"));
|
|
52367
|
+
console.log(import_chalk17.default.gray(" startHook - Commands to run on workspace startup"));
|
|
52319
52368
|
if (!isYaml) {
|
|
52320
52369
|
console.log("");
|
|
52321
|
-
console.log(
|
|
52370
|
+
console.log(import_chalk17.default.gray("Tip: Use --yaml for YAML format with multiline system prompt support."));
|
|
52322
52371
|
}
|
|
52323
52372
|
});
|
|
52324
52373
|
}
|
|
52325
|
-
var
|
|
52374
|
+
var import_chalk17, import_fs3, import_path4;
|
|
52326
52375
|
var init_init = __esm({
|
|
52327
52376
|
"src/commands/init.ts"() {
|
|
52328
52377
|
"use strict";
|
|
52329
|
-
|
|
52378
|
+
import_chalk17 = __toESM(require("chalk"));
|
|
52330
52379
|
import_fs3 = __toESM(require("fs"));
|
|
52331
52380
|
import_path4 = __toESM(require("path"));
|
|
52332
52381
|
init_src();
|
|
@@ -52370,10 +52419,10 @@ async function readSecret(service, name) {
|
|
|
52370
52419
|
async function credentialsListCommand(agent) {
|
|
52371
52420
|
const response = await orgAuthenticatedFetch(`/v1/agents/${agent}/credentials`);
|
|
52372
52421
|
output2(response, ({ credentials: credentials2, selected }) => {
|
|
52373
|
-
if (credentials2.length === 0) console.log(
|
|
52422
|
+
if (credentials2.length === 0) console.log(import_chalk18.default.yellow(`No credentials connected for ${agent}.`));
|
|
52374
52423
|
for (const { method, scope } of credentials2) {
|
|
52375
52424
|
const isSelected = selected?.method === method && selected.scope === scope;
|
|
52376
|
-
console.log(`${method} ${scope}${isSelected ?
|
|
52425
|
+
console.log(`${method} ${scope}${isSelected ? import_chalk18.default.green(" (used by new workspaces)") : ""}`);
|
|
52377
52426
|
}
|
|
52378
52427
|
});
|
|
52379
52428
|
}
|
|
@@ -52381,12 +52430,12 @@ async function credentialsGetCommand(service, options) {
|
|
|
52381
52430
|
const status = await orgAuthenticatedFetch(credentialsPath(service, options));
|
|
52382
52431
|
output2(status, ({ hasCredentials, ...fields }) => {
|
|
52383
52432
|
if (!hasCredentials) {
|
|
52384
|
-
console.log(
|
|
52433
|
+
console.log(import_chalk18.default.yellow(`No ${scopeLabel(options)} ${service} credentials.`));
|
|
52385
52434
|
return;
|
|
52386
52435
|
}
|
|
52387
52436
|
const width = Math.max(...Object.keys(fields).map((key) => key.length)) + 2;
|
|
52388
52437
|
for (const [key, value] of Object.entries(fields)) {
|
|
52389
|
-
console.log(`${
|
|
52438
|
+
console.log(`${import_chalk18.default.gray(key.padEnd(width))}${typeof value === "string" ? value : JSON.stringify(value)}`);
|
|
52390
52439
|
}
|
|
52391
52440
|
});
|
|
52392
52441
|
}
|
|
@@ -52400,35 +52449,35 @@ async function credentialsSetCommand(service, options) {
|
|
|
52400
52449
|
[secretField]: await readSecret(service, secretField === "api_key" ? "API key" : "AWS secret access key")
|
|
52401
52450
|
};
|
|
52402
52451
|
const response = await orgAuthenticatedFetch(path11, { method: "POST", body });
|
|
52403
|
-
output2(response, () => console.log(
|
|
52452
|
+
output2(response, () => console.log(import_chalk18.default.green(`Saved ${scopeLabel(options)} ${service} credentials.`)));
|
|
52404
52453
|
}
|
|
52405
52454
|
async function credentialsRemoveCommand(service, options) {
|
|
52406
52455
|
const response = await orgAuthenticatedFetch(credentialsPath(service, options), { method: "DELETE" });
|
|
52407
|
-
output2(response, ({ success: success2 }) => console.log(success2 ?
|
|
52456
|
+
output2(response, ({ success: success2 }) => console.log(success2 ? import_chalk18.default.green(`Removed ${scopeLabel(options)} ${service} credentials.`) : `No ${scopeLabel(options)} ${service} credentials to remove.`));
|
|
52408
52457
|
}
|
|
52409
52458
|
async function credentialsUsageCommand({ org: org2, user }) {
|
|
52410
52459
|
const scope = org2 ? "org" : user ? "user" : null;
|
|
52411
52460
|
const response = await orgAuthenticatedFetch(`/v1/agents/subscription-usage${scope ? `?scope=${scope}` : ""}`);
|
|
52412
52461
|
output2(response, ({ accounts }) => {
|
|
52413
|
-
if (accounts.length === 0) console.log(
|
|
52462
|
+
if (accounts.length === 0) console.log(import_chalk18.default.yellow("No Claude or Codex subscriptions connected."));
|
|
52414
52463
|
for (const account of accounts) {
|
|
52415
|
-
const limits = account.reconnectRequired ?
|
|
52464
|
+
const limits = account.reconnectRequired ? import_chalk18.default.yellow(`Reconnect required: run ${getSubscriptionAuthCommand(account.provider, account.scope)} with the same account`) : !account.windows ? import_chalk18.default.gray("Usage unavailable, try again in a few minutes") : account.windows.length === 0 ? "No usage limits" : account.windows.map((window) => [
|
|
52416
52465
|
window.kind === "session" ? "5-hour" : "weekly",
|
|
52417
52466
|
window.model,
|
|
52418
52467
|
`${Math.round(window.usedPercent)}%`,
|
|
52419
|
-
window.resetsAt &&
|
|
52468
|
+
window.resetsAt && import_chalk18.default.gray(`(resets ${formatDate(window.resetsAt)})`)
|
|
52420
52469
|
].filter(Boolean).join(" ")).join(", ");
|
|
52421
52470
|
const label = [account.email ?? account.credentialId, account.planType].filter(Boolean).join(" ");
|
|
52422
52471
|
console.log(`${account.provider} ${scopeLabel({ org: account.scope === "org" })} ${label} ${limits}`);
|
|
52423
|
-
if (account.exhaustedUntil) console.log(
|
|
52472
|
+
if (account.exhaustedUntil) console.log(import_chalk18.default.gray(` Workspaces skip this account until ${formatDate(account.exhaustedUntil)}`));
|
|
52424
52473
|
}
|
|
52425
52474
|
});
|
|
52426
52475
|
}
|
|
52427
|
-
var
|
|
52476
|
+
var import_chalk18, OPTIONAL_SECRET_SERVICES, scopeLabel;
|
|
52428
52477
|
var init_credentials2 = __esm({
|
|
52429
52478
|
"src/commands/credentials.ts"() {
|
|
52430
52479
|
"use strict";
|
|
52431
|
-
|
|
52480
|
+
import_chalk18 = __toESM(require("chalk"));
|
|
52432
52481
|
init_src();
|
|
52433
52482
|
init_subscription_usage();
|
|
52434
52483
|
init_api2();
|
|
@@ -52459,7 +52508,7 @@ function startUpdateCheck(currentVersion) {
|
|
|
52459
52508
|
}
|
|
52460
52509
|
const latestVersion = payload.version;
|
|
52461
52510
|
if (compareVersions(latestVersion, currentVersion) > 0) {
|
|
52462
|
-
notice =
|
|
52511
|
+
notice = import_chalk19.default.dim(
|
|
52463
52512
|
`
|
|
52464
52513
|
Replicas CLI ${currentVersion} \u2192 ${latestVersion} available. Update: npm install -g replicas-cli@latest
|
|
52465
52514
|
`
|
|
@@ -52469,11 +52518,11 @@ Replicas CLI ${currentVersion} \u2192 ${latestVersion} available. Update: npm in
|
|
|
52469
52518
|
}
|
|
52470
52519
|
})();
|
|
52471
52520
|
}
|
|
52472
|
-
var
|
|
52521
|
+
var import_chalk19, VERSION_CHECK_TIMEOUT;
|
|
52473
52522
|
var init_version_check = __esm({
|
|
52474
52523
|
"src/lib/version-check.ts"() {
|
|
52475
52524
|
"use strict";
|
|
52476
|
-
|
|
52525
|
+
import_chalk19 = __toESM(require("chalk"));
|
|
52477
52526
|
init_src();
|
|
52478
52527
|
init_monolith_url();
|
|
52479
52528
|
init_output();
|
|
@@ -52486,20 +52535,20 @@ async function repositoriesListCommand() {
|
|
|
52486
52535
|
ensureOrgApiAuthenticated();
|
|
52487
52536
|
output2(await orgAuthenticatedFetch("/v1/repositories"), ({ repositories }) => {
|
|
52488
52537
|
if (repositories.length === 0) {
|
|
52489
|
-
console.log(
|
|
52538
|
+
console.log(import_chalk20.default.yellow("\nNo repositories found.\n"));
|
|
52490
52539
|
return;
|
|
52491
52540
|
}
|
|
52492
|
-
console.log(
|
|
52541
|
+
console.log(import_chalk20.default.green(`
|
|
52493
52542
|
Repositories (${repositories.length}):
|
|
52494
52543
|
`));
|
|
52495
52544
|
for (const repo of repositories) {
|
|
52496
|
-
console.log(
|
|
52497
|
-
console.log(
|
|
52498
|
-
console.log(
|
|
52499
|
-
console.log(
|
|
52500
|
-
console.log(
|
|
52545
|
+
console.log(import_chalk20.default.white(` ${repo.name}`));
|
|
52546
|
+
console.log(import_chalk20.default.gray(` ID: ${repo.id}`));
|
|
52547
|
+
console.log(import_chalk20.default.gray(` URL: ${repo.url}`));
|
|
52548
|
+
console.log(import_chalk20.default.gray(` Default Branch: ${repo.default_branch}`));
|
|
52549
|
+
console.log(import_chalk20.default.gray(` Created: ${formatDate(repo.created_at)}`));
|
|
52501
52550
|
if (repo.github_repository_id) {
|
|
52502
|
-
console.log(
|
|
52551
|
+
console.log(import_chalk20.default.gray(` GitHub ID: ${repo.github_repository_id}`));
|
|
52503
52552
|
}
|
|
52504
52553
|
console.log();
|
|
52505
52554
|
}
|
|
@@ -52554,11 +52603,11 @@ async function repositoriesBranchesCommand(repository) {
|
|
|
52554
52603
|
for (const branch of branches) console.log(branch);
|
|
52555
52604
|
});
|
|
52556
52605
|
}
|
|
52557
|
-
var
|
|
52606
|
+
var import_chalk20, splitList;
|
|
52558
52607
|
var init_repositories2 = __esm({
|
|
52559
52608
|
"src/commands/repositories.ts"() {
|
|
52560
52609
|
"use strict";
|
|
52561
|
-
|
|
52610
|
+
import_chalk20 = __toESM(require("chalk"));
|
|
52562
52611
|
init_api2();
|
|
52563
52612
|
init_command_utils();
|
|
52564
52613
|
init_output();
|
|
@@ -52586,22 +52635,22 @@ async function resolveEnvironmentId(input2) {
|
|
|
52586
52635
|
return resolved.id;
|
|
52587
52636
|
}
|
|
52588
52637
|
function printEnvironment(env, repoSkillCount) {
|
|
52589
|
-
console.log(
|
|
52590
|
-
console.log(
|
|
52638
|
+
console.log(import_chalk21.default.white(` ${env.name}${env.user_id ? import_chalk21.default.gray(" (personal)") : ""}`));
|
|
52639
|
+
console.log(import_chalk21.default.gray(` ID: ${env.id}`));
|
|
52591
52640
|
if (env.description) {
|
|
52592
|
-
console.log(
|
|
52641
|
+
console.log(import_chalk21.default.gray(` Description: ${env.description}`));
|
|
52593
52642
|
}
|
|
52594
52643
|
const repositoryIds = env.repository_ids ?? [];
|
|
52595
52644
|
if (repositoryIds.length > 0) {
|
|
52596
|
-
console.log(
|
|
52645
|
+
console.log(import_chalk21.default.gray(` Repositories: ${repositoryIds.join(", ")}`));
|
|
52597
52646
|
}
|
|
52598
52647
|
if (env.variable_count !== void 0) {
|
|
52599
|
-
console.log(
|
|
52648
|
+
console.log(import_chalk21.default.gray(` Variables: ${env.variable_count}, Files: ${env.file_count ?? 0}, Added skills: ${env.skill_count ?? 0}, MCPs: ${env.mcp_count ?? 0}`));
|
|
52600
52649
|
}
|
|
52601
52650
|
if (repoSkillCount !== void 0) {
|
|
52602
|
-
console.log(
|
|
52651
|
+
console.log(import_chalk21.default.gray(` Repository skills: ${repoSkillCount}`));
|
|
52603
52652
|
}
|
|
52604
|
-
console.log(
|
|
52653
|
+
console.log(import_chalk21.default.gray(` Updated: ${formatDate(env.updated_at)}`));
|
|
52605
52654
|
console.log();
|
|
52606
52655
|
}
|
|
52607
52656
|
async function environmentListCommand() {
|
|
@@ -52609,10 +52658,10 @@ async function environmentListCommand() {
|
|
|
52609
52658
|
const response = await orgAuthenticatedFetch("/v1/environments?scope=all");
|
|
52610
52659
|
output2(response, ({ environments }) => {
|
|
52611
52660
|
if (environments.length === 0) {
|
|
52612
|
-
console.log(
|
|
52661
|
+
console.log(import_chalk21.default.yellow("\nNo environments found.\n"));
|
|
52613
52662
|
return;
|
|
52614
52663
|
}
|
|
52615
|
-
console.log(
|
|
52664
|
+
console.log(import_chalk21.default.green(`
|
|
52616
52665
|
Environments (${environments.length}):
|
|
52617
52666
|
`));
|
|
52618
52667
|
for (const env of environments) printEnvironment(env);
|
|
@@ -52624,13 +52673,13 @@ async function environmentGetCommand(idOrName) {
|
|
|
52624
52673
|
const response = await orgAuthenticatedFetch(`/v1/environments/${id}`);
|
|
52625
52674
|
const repoSkills = await orgAuthenticatedFetch(`/v1/environments/${response.environment.id}/repo-skills`);
|
|
52626
52675
|
output2({ ...response, ...repoSkills }, ({ environment: environment2 }) => {
|
|
52627
|
-
console.log(
|
|
52676
|
+
console.log(import_chalk21.default.green(`
|
|
52628
52677
|
Environment: ${environment2.name}
|
|
52629
52678
|
`));
|
|
52630
52679
|
const linkedSkills = repoSkills.repo_skills.filter((skill) => skill.path.startsWith(`.${skill.framework}/skills/`));
|
|
52631
52680
|
printEnvironment(environment2, new Set(linkedSkills.map((skill) => `${skill.repository_id}:${skill.path.split("/")[2]}`)).size);
|
|
52632
52681
|
for (const message2 of [repoSkills.error, ...repoSkills.repo_errors.map((repo) => `${repo.repository_full_name}: ${repo.error}`)]) {
|
|
52633
|
-
if (message2) console.log(
|
|
52682
|
+
if (message2) console.log(import_chalk21.default.yellow(` Could not read repository skills: ${message2}`));
|
|
52634
52683
|
}
|
|
52635
52684
|
});
|
|
52636
52685
|
}
|
|
@@ -52645,7 +52694,7 @@ async function environmentCreateCommand(name, options) {
|
|
|
52645
52694
|
validate: (v) => v.trim() ? true : "Name is required"
|
|
52646
52695
|
});
|
|
52647
52696
|
if (!r.name) {
|
|
52648
|
-
console.log(
|
|
52697
|
+
console.log(import_chalk21.default.yellow("\nCancelled."));
|
|
52649
52698
|
return;
|
|
52650
52699
|
}
|
|
52651
52700
|
envName = r.name;
|
|
@@ -52679,9 +52728,9 @@ async function environmentCreateCommand(name, options) {
|
|
|
52679
52728
|
body
|
|
52680
52729
|
});
|
|
52681
52730
|
output2(response, ({ environment: environment2 }) => {
|
|
52682
|
-
console.log(
|
|
52731
|
+
console.log(import_chalk21.default.green(`
|
|
52683
52732
|
Created environment: ${environment2.name}`));
|
|
52684
|
-
console.log(
|
|
52733
|
+
console.log(import_chalk21.default.gray(` ID: ${environment2.id}
|
|
52685
52734
|
`));
|
|
52686
52735
|
});
|
|
52687
52736
|
}
|
|
@@ -52702,7 +52751,7 @@ async function environmentEditCommand(idOrName, options) {
|
|
|
52702
52751
|
method: "PATCH",
|
|
52703
52752
|
body
|
|
52704
52753
|
});
|
|
52705
|
-
output2(response, ({ environment: environment2 }) => console.log(
|
|
52754
|
+
output2(response, ({ environment: environment2 }) => console.log(import_chalk21.default.green(`
|
|
52706
52755
|
Updated environment: ${environment2.name}
|
|
52707
52756
|
`)));
|
|
52708
52757
|
}
|
|
@@ -52716,10 +52765,10 @@ Deleted environment ${idOrName}.
|
|
|
52716
52765
|
`);
|
|
52717
52766
|
}
|
|
52718
52767
|
function printVariable(v) {
|
|
52719
|
-
console.log(
|
|
52720
|
-
console.log(
|
|
52721
|
-
console.log(
|
|
52722
|
-
console.log(
|
|
52768
|
+
console.log(import_chalk21.default.white(` ${v.key}`));
|
|
52769
|
+
console.log(import_chalk21.default.gray(` ID: ${v.id}`));
|
|
52770
|
+
console.log(import_chalk21.default.gray(` Value: ${v.value}`));
|
|
52771
|
+
console.log(import_chalk21.default.gray(` Updated: ${formatDate(v.updated_at)}`));
|
|
52723
52772
|
console.log();
|
|
52724
52773
|
}
|
|
52725
52774
|
async function envVarsListCommand(envIdOrName, options) {
|
|
@@ -52731,14 +52780,14 @@ async function envVarsListCommand(envIdOrName, options) {
|
|
|
52731
52780
|
const variables = options.reveal ? response.environment_variables : response.environment_variables.map((v) => ({ ...v, value: maskValue(v.value) }));
|
|
52732
52781
|
output2({ environment_variables: variables }, ({ environment_variables }) => {
|
|
52733
52782
|
if (environment_variables.length === 0) {
|
|
52734
|
-
console.log(
|
|
52783
|
+
console.log(import_chalk21.default.yellow("\nNo variables.\n"));
|
|
52735
52784
|
return;
|
|
52736
52785
|
}
|
|
52737
|
-
console.log(
|
|
52786
|
+
console.log(import_chalk21.default.green(`
|
|
52738
52787
|
Variables (${environment_variables.length}):
|
|
52739
52788
|
`));
|
|
52740
52789
|
if (!options.reveal) {
|
|
52741
|
-
console.log(
|
|
52790
|
+
console.log(import_chalk21.default.gray(" Values are masked. Pass --reveal to show full values.\n"));
|
|
52742
52791
|
}
|
|
52743
52792
|
for (const v of environment_variables) printVariable(v);
|
|
52744
52793
|
});
|
|
@@ -52756,7 +52805,7 @@ async function envVarsSetCommand(envIdOrName, key, value) {
|
|
|
52756
52805
|
`/v1/environments/${id}/variables/${match.id}`,
|
|
52757
52806
|
{ method: "PATCH", body: body2 }
|
|
52758
52807
|
);
|
|
52759
|
-
output2({ ...response2, environment_variable: { ...response2.environment_variable, value: maskValue(response2.environment_variable.value) } }, ({ environment_variable }) => console.log(
|
|
52808
|
+
output2({ ...response2, environment_variable: { ...response2.environment_variable, value: maskValue(response2.environment_variable.value) } }, ({ environment_variable }) => console.log(import_chalk21.default.green(`
|
|
52760
52809
|
Updated variable ${environment_variable.key}.
|
|
52761
52810
|
`)));
|
|
52762
52811
|
return;
|
|
@@ -52770,7 +52819,7 @@ Updated variable ${environment_variable.key}.
|
|
|
52770
52819
|
`/v1/environments/${id}/variables`,
|
|
52771
52820
|
{ method: "POST", body }
|
|
52772
52821
|
);
|
|
52773
|
-
output2({ ...response, environment_variable: { ...response.environment_variable, value: maskValue(response.environment_variable.value) } }, ({ environment_variable }) => console.log(
|
|
52822
|
+
output2({ ...response, environment_variable: { ...response.environment_variable, value: maskValue(response.environment_variable.value) } }, ({ environment_variable }) => console.log(import_chalk21.default.green(`
|
|
52774
52823
|
Created variable ${environment_variable.key}.
|
|
52775
52824
|
`)));
|
|
52776
52825
|
}
|
|
@@ -52806,15 +52855,15 @@ async function envVarsRequestCommand(requiredKeys, options) {
|
|
|
52806
52855
|
const local = parsePosixEnvFile(readRuntimeEnv());
|
|
52807
52856
|
const available = options.replace ? [] : keys.filter((key) => Object.hasOwn(local, key) && local[key].length > 0);
|
|
52808
52857
|
const wanted = keys.filter((key) => !available.includes(key));
|
|
52809
|
-
const loadHint =
|
|
52858
|
+
const loadHint = import_chalk21.default.gray(`
|
|
52810
52859
|
Values are never printed. Load them into a command with: . ~/.replicas/runtime-env.sh && <command>
|
|
52811
52860
|
`);
|
|
52812
52861
|
if (wanted.length === 0) {
|
|
52813
52862
|
output2({ status: "provided", exported: available, missing: [] }, () => {
|
|
52814
52863
|
console.log(`
|
|
52815
|
-
${
|
|
52864
|
+
${import_chalk21.default.green("Already available:")} ${available.join(", ")}`);
|
|
52816
52865
|
console.log(loadHint);
|
|
52817
|
-
console.log(
|
|
52866
|
+
console.log(import_chalk21.default.gray(" If a value is wrong, run this again with --replace to ask the user for a new one.\n"));
|
|
52818
52867
|
});
|
|
52819
52868
|
return;
|
|
52820
52869
|
}
|
|
@@ -52850,11 +52899,11 @@ async function envVarsRequestCommand(requiredKeys, options) {
|
|
|
52850
52899
|
console.log("");
|
|
52851
52900
|
if (exported.length > 0 || available.length > 0) {
|
|
52852
52901
|
const where = request.destination === "workspace" ? "this workspace only" : "saved to the environment";
|
|
52853
|
-
console.log(` ${
|
|
52902
|
+
console.log(` ${import_chalk21.default.green("Provided:")} ${[...available, ...exported].join(", ")} ${import_chalk21.default.gray(`(${where})`)}`);
|
|
52854
52903
|
}
|
|
52855
52904
|
if (request.status === "pending") {
|
|
52856
|
-
console.log(` ${
|
|
52857
|
-
console.log(
|
|
52905
|
+
console.log(` ${import_chalk21.default.yellow("Still waiting for:")} ${missing.join(", ")}`);
|
|
52906
|
+
console.log(import_chalk21.default.gray(options.wait === false ? `
|
|
52858
52907
|
Asked above the chat composer (${created.url}). Keep working, and run this command again when you need the values.
|
|
52859
52908
|
` : created.wait ? `
|
|
52860
52909
|
The form stays open above the chat composer (${created.url}). End your turn and say what the values are for. When the user saves, you get a message; run this command again then.
|
|
@@ -52864,21 +52913,21 @@ async function envVarsRequestCommand(requiredKeys, options) {
|
|
|
52864
52913
|
`));
|
|
52865
52914
|
return;
|
|
52866
52915
|
}
|
|
52867
|
-
if (missing.length > 0) console.log(` ${
|
|
52916
|
+
if (missing.length > 0) console.log(` ${import_chalk21.default.gray(request.status === "skipped" ? "Skipped by the user:" : "Not provided:")} ${missing.join(", ")}`);
|
|
52868
52917
|
if (exported.length === 0) {
|
|
52869
|
-
console.log(
|
|
52918
|
+
console.log(import_chalk21.default.gray("\n Continue without them, or ask the user how they want to proceed.\n"));
|
|
52870
52919
|
return;
|
|
52871
52920
|
}
|
|
52872
52921
|
console.log(loadHint);
|
|
52873
|
-
if (options.replace) console.log(
|
|
52922
|
+
if (options.replace) console.log(import_chalk21.default.gray(" Leave out --replace from now on; running it again asks the user again.\n"));
|
|
52874
52923
|
});
|
|
52875
52924
|
}
|
|
52876
52925
|
function printFile(f) {
|
|
52877
|
-
console.log(
|
|
52878
|
-
console.log(
|
|
52879
|
-
console.log(
|
|
52880
|
-
console.log(
|
|
52881
|
-
console.log(
|
|
52926
|
+
console.log(import_chalk21.default.white(` ${f.path}`));
|
|
52927
|
+
console.log(import_chalk21.default.gray(` ID: ${f.id}`));
|
|
52928
|
+
console.log(import_chalk21.default.gray(` Name: ${f.name}`));
|
|
52929
|
+
console.log(import_chalk21.default.gray(` Size: ${f.content.length} bytes`));
|
|
52930
|
+
console.log(import_chalk21.default.gray(` Updated: ${formatDate(f.updated_at)}`));
|
|
52882
52931
|
console.log();
|
|
52883
52932
|
}
|
|
52884
52933
|
async function envFilesListCommand(envIdOrName) {
|
|
@@ -52889,10 +52938,10 @@ async function envFilesListCommand(envIdOrName) {
|
|
|
52889
52938
|
);
|
|
52890
52939
|
output2(response, ({ environment_files }) => {
|
|
52891
52940
|
if (environment_files.length === 0) {
|
|
52892
|
-
console.log(
|
|
52941
|
+
console.log(import_chalk21.default.yellow("\nNo files.\n"));
|
|
52893
52942
|
return;
|
|
52894
52943
|
}
|
|
52895
|
-
console.log(
|
|
52944
|
+
console.log(import_chalk21.default.green(`
|
|
52896
52945
|
Files (${environment_files.length}):
|
|
52897
52946
|
`));
|
|
52898
52947
|
for (const f of environment_files) printFile(f);
|
|
@@ -52924,7 +52973,7 @@ async function envFilesSetCommand(envIdOrName, destinationPath, options) {
|
|
|
52924
52973
|
`/v1/environments/${id}/files/${match.id}`,
|
|
52925
52974
|
{ method: "PATCH", body: body2 }
|
|
52926
52975
|
);
|
|
52927
|
-
output2(response2, ({ environment_file }) => console.log(
|
|
52976
|
+
output2(response2, ({ environment_file }) => console.log(import_chalk21.default.green(`
|
|
52928
52977
|
Updated file ${environment_file.path}.
|
|
52929
52978
|
`)));
|
|
52930
52979
|
return;
|
|
@@ -52939,7 +52988,7 @@ Updated file ${environment_file.path}.
|
|
|
52939
52988
|
`/v1/environments/${id}/files`,
|
|
52940
52989
|
{ method: "POST", body }
|
|
52941
52990
|
);
|
|
52942
|
-
output2(response, ({ environment_file }) => console.log(
|
|
52991
|
+
output2(response, ({ environment_file }) => console.log(import_chalk21.default.green(`
|
|
52943
52992
|
Created file ${environment_file.path}.
|
|
52944
52993
|
`)));
|
|
52945
52994
|
}
|
|
@@ -52969,16 +53018,16 @@ async function envHookGetCommand(envIdOrName, kind) {
|
|
|
52969
53018
|
const hook = kind === "warm" ? (await orgAuthenticatedFetch(`/v1/environments/${id}/warm-hooks`)).warm_hook : (await orgAuthenticatedFetch(`/v1/environments/${id}/start-hooks`)).start_hook;
|
|
52970
53019
|
output2({ hook }, () => {
|
|
52971
53020
|
if (!hook) {
|
|
52972
|
-
console.log(
|
|
53021
|
+
console.log(import_chalk21.default.yellow(`
|
|
52973
53022
|
No ${kind} hook configured.
|
|
52974
53023
|
`));
|
|
52975
53024
|
return;
|
|
52976
53025
|
}
|
|
52977
|
-
console.log(
|
|
53026
|
+
console.log(import_chalk21.default.green(`
|
|
52978
53027
|
${kind === "warm" ? "Warm" : "Start"} hook (v${hook.version}, ${hook.is_active ? "active" : "inactive"}):
|
|
52979
53028
|
`));
|
|
52980
|
-
console.log(
|
|
52981
|
-
console.log(
|
|
53029
|
+
console.log(import_chalk21.default.gray(` ID: ${hook.id}`));
|
|
53030
|
+
console.log(import_chalk21.default.gray(` Created: ${formatDate(hook.created_at)}
|
|
52982
53031
|
`));
|
|
52983
53032
|
console.log(hook.content);
|
|
52984
53033
|
console.log();
|
|
@@ -52994,7 +53043,7 @@ async function envHookSaveCommand(envIdOrName, options, kind) {
|
|
|
52994
53043
|
`/v1/environments/${id}/warm-hooks/save`,
|
|
52995
53044
|
{ method: "POST", body: body2 }
|
|
52996
53045
|
);
|
|
52997
|
-
output2(response2, ({ warm_hook }) => console.log(
|
|
53046
|
+
output2(response2, ({ warm_hook }) => console.log(import_chalk21.default.green(warm_hook ? `
|
|
52998
53047
|
Saved warm hook v${warm_hook.version}.
|
|
52999
53048
|
` : "\nCleared warm hook.\n")));
|
|
53000
53049
|
return;
|
|
@@ -53004,7 +53053,7 @@ Saved warm hook v${warm_hook.version}.
|
|
|
53004
53053
|
`/v1/environments/${id}/start-hooks/save`,
|
|
53005
53054
|
{ method: "POST", body }
|
|
53006
53055
|
);
|
|
53007
|
-
output2(response, ({ start_hook }) => console.log(
|
|
53056
|
+
output2(response, ({ start_hook }) => console.log(import_chalk21.default.green(start_hook ? `
|
|
53008
53057
|
Saved start hook v${start_hook.version}.
|
|
53009
53058
|
` : "\nCleared start hook.\n")));
|
|
53010
53059
|
}
|
|
@@ -53022,7 +53071,7 @@ async function envHookTestCommand(envIdOrName, options, kind) {
|
|
|
53022
53071
|
body: kind === "warm" ? { content, mode: options.save ? "save_test" : "test_only" } : { content },
|
|
53023
53072
|
onEvent: (event) => {
|
|
53024
53073
|
if (event.type === "progress" && event.message) {
|
|
53025
|
-
console.log(
|
|
53074
|
+
console.log(import_chalk21.default.gray(event.message));
|
|
53026
53075
|
} else if (event.type === "output" && event.output) {
|
|
53027
53076
|
logs += event.output;
|
|
53028
53077
|
if (!isJsonMode()) process.stdout.write(event.output);
|
|
@@ -53039,7 +53088,7 @@ async function envHookTestCommand(envIdOrName, options, kind) {
|
|
|
53039
53088
|
const label = kind === "warm" ? "Warm" : "Start";
|
|
53040
53089
|
const passed = !timedOut && exitCode === 0;
|
|
53041
53090
|
output2({ passed, exit_code: exitCode, timed_out: timedOut, saved: passed && !!options.save, output: logs }, () => {
|
|
53042
|
-
if (passed) console.log(
|
|
53091
|
+
if (passed) console.log(import_chalk21.default.green(`
|
|
53043
53092
|
${label} hook passed${options.save ? " and was saved" : ""} (exit code ${exitCode}).
|
|
53044
53093
|
`));
|
|
53045
53094
|
});
|
|
@@ -53056,24 +53105,24 @@ async function envHookRepositoryHooksCommand(envIdOrName, kind) {
|
|
|
53056
53105
|
)).repositories.map((repository) => ({ ...repository, hook: repository.start_hook }));
|
|
53057
53106
|
output2({ repositories }, () => {
|
|
53058
53107
|
if (repositories.length === 0) {
|
|
53059
|
-
console.log(
|
|
53108
|
+
console.log(import_chalk21.default.yellow("\nNo repositories bound to this environment.\n"));
|
|
53060
53109
|
return;
|
|
53061
53110
|
}
|
|
53062
|
-
console.log(
|
|
53111
|
+
console.log(import_chalk21.default.green(`
|
|
53063
53112
|
Repository ${kind} hooks (${repositories.length}):
|
|
53064
53113
|
`));
|
|
53065
53114
|
for (const repo of repositories) {
|
|
53066
|
-
console.log(
|
|
53115
|
+
console.log(import_chalk21.default.white(` ${repo.repository_name} @${repo.default_branch}`));
|
|
53067
53116
|
if (repo.error) {
|
|
53068
|
-
console.log(
|
|
53117
|
+
console.log(import_chalk21.default.red(` Error: ${repo.error}`));
|
|
53069
53118
|
} else if (repo.hook) {
|
|
53070
|
-
console.log(
|
|
53071
|
-
console.log(
|
|
53119
|
+
console.log(import_chalk21.default.gray(` Source: ${repo.filename ?? "(unknown)"}`));
|
|
53120
|
+
console.log(import_chalk21.default.gray(` Commands (${repo.hook.commands.length}):`));
|
|
53072
53121
|
for (const cmd of repo.hook.commands) {
|
|
53073
|
-
console.log(
|
|
53122
|
+
console.log(import_chalk21.default.gray(` ${cmd}`));
|
|
53074
53123
|
}
|
|
53075
53124
|
} else {
|
|
53076
|
-
console.log(
|
|
53125
|
+
console.log(import_chalk21.default.gray(` No ${kind}Hook defined.`));
|
|
53077
53126
|
}
|
|
53078
53127
|
console.log();
|
|
53079
53128
|
}
|
|
@@ -53115,7 +53164,7 @@ async function envSkillsAddCommand(env, source, slug, options) {
|
|
|
53115
53164
|
const id = await resolveEnvironmentId(env);
|
|
53116
53165
|
const body = { environment_id: id, source, slug, name: options.name ?? slug };
|
|
53117
53166
|
const response = await orgAuthenticatedFetch(`/v1/environments/${id}/skills`, { method: "POST", body });
|
|
53118
|
-
output2(response, () => console.log(
|
|
53167
|
+
output2(response, () => console.log(import_chalk21.default.green(`Added skill ${slug} from ${source}`)));
|
|
53119
53168
|
}
|
|
53120
53169
|
async function envSkillsRemoveCommand(env, slugOrId) {
|
|
53121
53170
|
const id = await resolveEnvironmentId(env);
|
|
@@ -53143,7 +53192,7 @@ async function envMcpsAddCommand(env, name, options) {
|
|
|
53143
53192
|
const id = await resolveEnvironmentId(env);
|
|
53144
53193
|
const body = { environment_id: id, name, ...server };
|
|
53145
53194
|
const response = await orgAuthenticatedFetch(`/v1/environments/${id}/mcps`, { method: "POST", body });
|
|
53146
|
-
output2(response, () => console.log(
|
|
53195
|
+
output2(response, () => console.log(import_chalk21.default.green(`Added MCP server ${name}`)));
|
|
53147
53196
|
}
|
|
53148
53197
|
async function envMcpsRemoveCommand(env, nameOrId) {
|
|
53149
53198
|
const id = await resolveEnvironmentId(env);
|
|
@@ -53159,13 +53208,13 @@ async function envDevicesListCommand(env) {
|
|
|
53159
53208
|
);
|
|
53160
53209
|
output2(response, ({ environment_devices }) => {
|
|
53161
53210
|
if (environment_devices.length === 0) {
|
|
53162
|
-
console.log(
|
|
53211
|
+
console.log(import_chalk21.default.yellow(`
|
|
53163
53212
|
No devices. Add one with: replicas env devices add ${env} <name> --user <user>
|
|
53164
53213
|
`));
|
|
53165
53214
|
return;
|
|
53166
53215
|
}
|
|
53167
53216
|
for (const device of environment_devices) {
|
|
53168
|
-
const status = isDeviceOnline(device.last_seen_at) ?
|
|
53217
|
+
const status = isDeviceOnline(device.last_seen_at) ? import_chalk21.default.green("online") : import_chalk21.default.yellow(device.last_seen_at ? `offline, last seen ${formatCompactRelativeTime(device.last_seen_at)}` : "offline");
|
|
53169
53218
|
console.log(`${device.id} ${device.name} ${device.host === null ? `${device.username}, connects from the device ${status}` : `${device.username}@${device.host}:${device.port}`}`);
|
|
53170
53219
|
}
|
|
53171
53220
|
});
|
|
@@ -53176,10 +53225,10 @@ async function envDevicesAddCommand(env, name, options) {
|
|
|
53176
53225
|
const response = await orgAuthenticatedFetch(`/v1/environments/${id}/devices`, { method: "POST", body });
|
|
53177
53226
|
const connect2 = options.host === void 0 ? await orgAuthenticatedFetch(`/v1/environments/${id}/devices/${response.environment_device.id}/connect-token`) : void 0;
|
|
53178
53227
|
output2({ ...response, connect_token: connect2?.token }, ({ environment_device, connect_token }) => {
|
|
53179
|
-
console.log(
|
|
53228
|
+
console.log(import_chalk21.default.green(`Added device ${name}. Allow its key by running this on the device as ${options.user}:`));
|
|
53180
53229
|
console.log(`mkdir -p ~/.ssh && echo '${environment_device.public_key}' >> ~/.ssh/authorized_keys`);
|
|
53181
53230
|
if (connect_token) {
|
|
53182
|
-
console.log(
|
|
53231
|
+
console.log(import_chalk21.default.green("Then keep this running on it, so workspaces can reach it, and paste this token when it asks:"));
|
|
53183
53232
|
console.log(DEVICE_CONNECT_COMMAND);
|
|
53184
53233
|
console.log(connect_token);
|
|
53185
53234
|
}
|
|
@@ -53197,9 +53246,9 @@ async function envDevicesEditCommand(env, nameOrId, options) {
|
|
|
53197
53246
|
const response = await orgAuthenticatedFetch(`/v1/environments/${id}/devices/${device.id}`, { method: "PATCH", body });
|
|
53198
53247
|
const connect2 = device.host !== null && response.environment_device.host === null ? await orgAuthenticatedFetch(`/v1/environments/${id}/devices/${device.id}/connect-token`) : void 0;
|
|
53199
53248
|
output2({ ...response, connect_token: connect2?.token }, ({ environment_device, connect_token }) => {
|
|
53200
|
-
console.log(
|
|
53249
|
+
console.log(import_chalk21.default.green(`Updated device ${environment_device.name}. Workspaces started from now on get the change.`));
|
|
53201
53250
|
if (connect_token) {
|
|
53202
|
-
console.log(
|
|
53251
|
+
console.log(import_chalk21.default.green("It now connects from the device. Keep this running on it, and paste this token when it asks:"));
|
|
53203
53252
|
console.log(DEVICE_CONNECT_COMMAND);
|
|
53204
53253
|
console.log(connect_token);
|
|
53205
53254
|
}
|
|
@@ -53220,7 +53269,7 @@ async function envDevicesResetCommand(env, nameOrId) {
|
|
|
53220
53269
|
if (!device) throw new Error(`Device not found: ${nameOrId}`);
|
|
53221
53270
|
const response = await orgAuthenticatedFetch(`/v1/environments/${id}/devices/${device.id}/connect-token`, { method: "POST" });
|
|
53222
53271
|
output2(response, ({ token }) => {
|
|
53223
|
-
console.log(
|
|
53272
|
+
console.log(import_chalk21.default.green(`Reset ${device.name}'s connection. Its old token no longer works; run this on it again and paste the new token when it asks:`));
|
|
53224
53273
|
console.log(DEVICE_CONNECT_COMMAND);
|
|
53225
53274
|
console.log(token);
|
|
53226
53275
|
});
|
|
@@ -53230,17 +53279,17 @@ function envWarmPoolCommand(enabled) {
|
|
|
53230
53279
|
const id = await resolveEnvironmentId(env);
|
|
53231
53280
|
const body = { environment_id: id, enabled };
|
|
53232
53281
|
const response = await orgAuthenticatedFetch(`/v1/environments/${id}/warm-pools`, { method: "PUT", body });
|
|
53233
|
-
output2(response, () => console.log(
|
|
53282
|
+
output2(response, () => console.log(import_chalk21.default.green(`Warm pool ${enabled ? "enabled" : "disabled"}`)));
|
|
53234
53283
|
};
|
|
53235
53284
|
}
|
|
53236
|
-
var import_fs4, import_os3, import_path5,
|
|
53285
|
+
var import_fs4, import_os3, import_path5, import_chalk21, RUNTIME_ENV_FILE;
|
|
53237
53286
|
var init_environment3 = __esm({
|
|
53238
53287
|
"src/commands/environment.ts"() {
|
|
53239
53288
|
"use strict";
|
|
53240
53289
|
import_fs4 = __toESM(require("fs"));
|
|
53241
53290
|
import_os3 = __toESM(require("os"));
|
|
53242
53291
|
import_path5 = __toESM(require("path"));
|
|
53243
|
-
|
|
53292
|
+
import_chalk21 = __toESM(require("chalk"));
|
|
53244
53293
|
init_api2();
|
|
53245
53294
|
init_command_utils();
|
|
53246
53295
|
init_output();
|
|
@@ -53260,8 +53309,8 @@ function parseReplicaAgent(value) {
|
|
|
53260
53309
|
throw new Error(`Invalid coding agent: ${value}. Must be one of: ${CLI_CODING_AGENT_LABEL}`);
|
|
53261
53310
|
}
|
|
53262
53311
|
function formatStatus(status) {
|
|
53263
|
-
if (status === "active") return
|
|
53264
|
-
if (isWorkspaceSuspendedStatus(status)) return
|
|
53312
|
+
if (status === "active") return import_chalk22.default.green(status);
|
|
53313
|
+
if (isWorkspaceSuspendedStatus(status)) return import_chalk22.default.gray(status);
|
|
53265
53314
|
return status;
|
|
53266
53315
|
}
|
|
53267
53316
|
function truncate(text4, maxLength) {
|
|
@@ -53272,93 +53321,93 @@ function formatDisplayMessage(message2) {
|
|
|
53272
53321
|
const time3 = new Date(message2.timestamp).toLocaleTimeString();
|
|
53273
53322
|
switch (message2.type) {
|
|
53274
53323
|
case "user":
|
|
53275
|
-
console.log(
|
|
53324
|
+
console.log(import_chalk22.default.blue(`
|
|
53276
53325
|
[${time3}] USER:`));
|
|
53277
|
-
console.log(
|
|
53326
|
+
console.log(import_chalk22.default.white(` ${truncate(message2.content, 500)}`));
|
|
53278
53327
|
break;
|
|
53279
53328
|
case "agent":
|
|
53280
|
-
console.log(
|
|
53329
|
+
console.log(import_chalk22.default.green(`
|
|
53281
53330
|
[${time3}] ASSISTANT:`));
|
|
53282
|
-
console.log(
|
|
53331
|
+
console.log(import_chalk22.default.white(` ${truncate(message2.content, 500)}`));
|
|
53283
53332
|
break;
|
|
53284
53333
|
case "reasoning":
|
|
53285
|
-
console.log(
|
|
53334
|
+
console.log(import_chalk22.default.gray(`
|
|
53286
53335
|
[${time3}] THINKING:`));
|
|
53287
|
-
console.log(
|
|
53336
|
+
console.log(import_chalk22.default.gray(` ${truncate(message2.content, 300)}`));
|
|
53288
53337
|
break;
|
|
53289
53338
|
case "command":
|
|
53290
|
-
console.log(
|
|
53339
|
+
console.log(import_chalk22.default.magenta(`
|
|
53291
53340
|
[${time3}] COMMAND:`));
|
|
53292
|
-
console.log(
|
|
53341
|
+
console.log(import_chalk22.default.white(` $ ${message2.command}`));
|
|
53293
53342
|
if (message2.output) {
|
|
53294
|
-
console.log(
|
|
53343
|
+
console.log(import_chalk22.default.gray(` ${truncate(message2.output, 200)}`));
|
|
53295
53344
|
}
|
|
53296
53345
|
if (message2.exitCode !== void 0) {
|
|
53297
|
-
const exitColor = message2.exitCode === 0 ?
|
|
53346
|
+
const exitColor = message2.exitCode === 0 ? import_chalk22.default.green : import_chalk22.default.red;
|
|
53298
53347
|
console.log(exitColor(` Exit code: ${message2.exitCode}`));
|
|
53299
53348
|
}
|
|
53300
53349
|
break;
|
|
53301
53350
|
case "file_change":
|
|
53302
|
-
console.log(
|
|
53351
|
+
console.log(import_chalk22.default.yellow(`
|
|
53303
53352
|
[${time3}] FILE CHANGES:`));
|
|
53304
53353
|
for (const change of message2.changes) {
|
|
53305
53354
|
const icon = change.kind === "add" ? "+" : change.kind === "delete" ? "-" : "~";
|
|
53306
|
-
const color = change.kind === "add" ?
|
|
53355
|
+
const color = change.kind === "add" ? import_chalk22.default.green : change.kind === "delete" ? import_chalk22.default.red : import_chalk22.default.yellow;
|
|
53307
53356
|
console.log(color(` ${icon} ${change.path}`));
|
|
53308
53357
|
}
|
|
53309
53358
|
break;
|
|
53310
53359
|
case "patch":
|
|
53311
|
-
console.log(
|
|
53360
|
+
console.log(import_chalk22.default.yellow(`
|
|
53312
53361
|
[${time3}] PATCH:`));
|
|
53313
53362
|
for (const op of message2.operations) {
|
|
53314
53363
|
const icon = op.action === "add" ? "+" : op.action === "delete" ? "-" : "~";
|
|
53315
|
-
const color = op.action === "add" ?
|
|
53364
|
+
const color = op.action === "add" ? import_chalk22.default.green : op.action === "delete" ? import_chalk22.default.red : import_chalk22.default.yellow;
|
|
53316
53365
|
console.log(color(` ${icon} ${op.path}`));
|
|
53317
53366
|
}
|
|
53318
53367
|
break;
|
|
53319
53368
|
case "tool_call":
|
|
53320
|
-
console.log(
|
|
53369
|
+
console.log(import_chalk22.default.cyan(`
|
|
53321
53370
|
[${time3}] TOOL: ${message2.tool}`));
|
|
53322
53371
|
if (message2.output) {
|
|
53323
|
-
console.log(
|
|
53372
|
+
console.log(import_chalk22.default.gray(` ${truncate(message2.output, 200)}`));
|
|
53324
53373
|
}
|
|
53325
53374
|
if (message2.inputRequest?.status === "pending") {
|
|
53326
53375
|
const { requestId, options, questions } = message2.inputRequest;
|
|
53327
|
-
console.log(
|
|
53328
|
-
for (const option of options ?? []) console.log(
|
|
53376
|
+
console.log(import_chalk22.default.yellow(` Awaiting answer, request ID: ${requestId}`));
|
|
53377
|
+
for (const option of options ?? []) console.log(import_chalk22.default.white(` ${option.id}: ${option.label}`));
|
|
53329
53378
|
for (const question of questions ?? []) {
|
|
53330
|
-
console.log(
|
|
53331
|
-
for (const option of question.options) console.log(
|
|
53379
|
+
console.log(import_chalk22.default.white(` Question ${question.id}: ${question.prompt}${question.multiSelect ? " (multi-select)" : ""}`));
|
|
53380
|
+
for (const option of question.options) console.log(import_chalk22.default.gray(` ${option.id}: ${option.label}`));
|
|
53332
53381
|
}
|
|
53333
53382
|
if (questions?.length) {
|
|
53334
|
-
console.log(
|
|
53383
|
+
console.log(import_chalk22.default.gray(` Selection ID: '{"<question>":{"options":["<option>"]}}', '{"<question>":{"custom":"<text>"}}', or declined`));
|
|
53335
53384
|
}
|
|
53336
53385
|
}
|
|
53337
53386
|
break;
|
|
53338
53387
|
case "web_search":
|
|
53339
|
-
console.log(
|
|
53388
|
+
console.log(import_chalk22.default.cyan(`
|
|
53340
53389
|
[${time3}] WEB SEARCH:`));
|
|
53341
|
-
console.log(
|
|
53390
|
+
console.log(import_chalk22.default.white(` "${message2.query}"`));
|
|
53342
53391
|
break;
|
|
53343
53392
|
case "todo_list":
|
|
53344
|
-
console.log(
|
|
53393
|
+
console.log(import_chalk22.default.blue(`
|
|
53345
53394
|
[${time3}] PLAN:`));
|
|
53346
53395
|
for (const item of message2.items) {
|
|
53347
|
-
const icon = item.completed ?
|
|
53396
|
+
const icon = item.completed ? import_chalk22.default.green("[x]") : import_chalk22.default.gray("[ ]");
|
|
53348
53397
|
console.log(` ${icon} ${item.text}`);
|
|
53349
53398
|
}
|
|
53350
53399
|
break;
|
|
53351
53400
|
case "subagent":
|
|
53352
|
-
console.log(
|
|
53401
|
+
console.log(import_chalk22.default.magenta(`
|
|
53353
53402
|
[${time3}] SUBAGENT: ${message2.description}`));
|
|
53354
53403
|
if (message2.output) {
|
|
53355
|
-
console.log(
|
|
53404
|
+
console.log(import_chalk22.default.gray(` ${truncate(message2.output, 200)}`));
|
|
53356
53405
|
}
|
|
53357
53406
|
break;
|
|
53358
53407
|
case "error":
|
|
53359
|
-
console.log(
|
|
53408
|
+
console.log(import_chalk22.default.red(`
|
|
53360
53409
|
[${time3}] ERROR:`));
|
|
53361
|
-
console.log(
|
|
53410
|
+
console.log(import_chalk22.default.red(` ${message2.message}`));
|
|
53362
53411
|
break;
|
|
53363
53412
|
}
|
|
53364
53413
|
}
|
|
@@ -53373,24 +53422,24 @@ async function replicaListCommand(options) {
|
|
|
53373
53422
|
);
|
|
53374
53423
|
output2(response, (response2) => {
|
|
53375
53424
|
if (response2.replicas.length === 0) {
|
|
53376
|
-
console.log(
|
|
53425
|
+
console.log(import_chalk22.default.yellow("\nNo replicas found.\n"));
|
|
53377
53426
|
return;
|
|
53378
53427
|
}
|
|
53379
|
-
console.log(
|
|
53428
|
+
console.log(import_chalk22.default.green(`
|
|
53380
53429
|
Replicas (Page ${response2.page} of ${response2.total_pages}, Total: ${response2.total}):
|
|
53381
53430
|
`));
|
|
53382
53431
|
for (const replica of response2.replicas) {
|
|
53383
|
-
console.log(
|
|
53384
|
-
console.log(
|
|
53432
|
+
console.log(import_chalk22.default.white(` ${replica.name}`));
|
|
53433
|
+
console.log(import_chalk22.default.gray(` ID: ${replica.id}`));
|
|
53385
53434
|
if (replica.repositories.length > 0) {
|
|
53386
|
-
console.log(
|
|
53435
|
+
console.log(import_chalk22.default.gray(` Repositories: ${replica.repositories.map((repository) => repository.name).join(", ")}`));
|
|
53387
53436
|
}
|
|
53388
|
-
console.log(
|
|
53389
|
-
console.log(
|
|
53437
|
+
console.log(import_chalk22.default.gray(` Status: ${formatStatus(replica.status)}`));
|
|
53438
|
+
console.log(import_chalk22.default.gray(` Created: ${formatDate(replica.created_at)}`));
|
|
53390
53439
|
if (replica.pull_requests && replica.pull_requests.length > 0) {
|
|
53391
|
-
console.log(
|
|
53440
|
+
console.log(import_chalk22.default.gray(` Pull Requests:`));
|
|
53392
53441
|
for (const pr2 of replica.pull_requests) {
|
|
53393
|
-
console.log(
|
|
53442
|
+
console.log(import_chalk22.default.cyan(` - ${pr2.repository} #${pr2.number}: ${pr2.url}`));
|
|
53394
53443
|
}
|
|
53395
53444
|
}
|
|
53396
53445
|
console.log();
|
|
@@ -53401,30 +53450,30 @@ async function replicaGetCommand(id) {
|
|
|
53401
53450
|
ensureOrgApiAuthenticated();
|
|
53402
53451
|
const response = await orgAuthenticatedFetch(`/v1/replica/${id}`);
|
|
53403
53452
|
output2(response, ({ replica }) => {
|
|
53404
|
-
console.log(
|
|
53453
|
+
console.log(import_chalk22.default.green(`
|
|
53405
53454
|
Replica: ${replica.name}
|
|
53406
53455
|
`));
|
|
53407
|
-
console.log(
|
|
53456
|
+
console.log(import_chalk22.default.gray(` ID: ${replica.id}`));
|
|
53408
53457
|
if (replica.repositories.length > 0) {
|
|
53409
|
-
console.log(
|
|
53458
|
+
console.log(import_chalk22.default.gray(` Repositories: ${replica.repositories.map((repository) => repository.name).join(", ")}`));
|
|
53410
53459
|
}
|
|
53411
|
-
console.log(
|
|
53412
|
-
console.log(
|
|
53460
|
+
console.log(import_chalk22.default.gray(` Status: ${formatStatus(replica.status)}`));
|
|
53461
|
+
console.log(import_chalk22.default.gray(` Created: ${formatDate(replica.created_at)}`));
|
|
53413
53462
|
if (replica.coding_agent) {
|
|
53414
|
-
console.log(
|
|
53463
|
+
console.log(import_chalk22.default.gray(` Coding Agent: ${replica.coding_agent}`));
|
|
53415
53464
|
}
|
|
53416
53465
|
if (replica.activity) printReplicaActivity(replica.activity);
|
|
53417
53466
|
if (replica.repository_statuses && replica.repository_statuses.length > 0) {
|
|
53418
|
-
console.log(
|
|
53467
|
+
console.log(import_chalk22.default.gray(" Repository Statuses:"));
|
|
53419
53468
|
for (const repositoryStatus of replica.repository_statuses) {
|
|
53420
|
-
const changeText = repositoryStatus.git_diff ? ` (${
|
|
53421
|
-
console.log(
|
|
53469
|
+
const changeText = repositoryStatus.git_diff ? ` (${import_chalk22.default.green(`+${repositoryStatus.git_diff.added}`)} / ${import_chalk22.default.red(`-${repositoryStatus.git_diff.removed}`)})` : "";
|
|
53470
|
+
console.log(import_chalk22.default.gray(` - ${repositoryStatus.repository}: ${repositoryStatus.branch || "unknown"}${changeText}`));
|
|
53422
53471
|
}
|
|
53423
53472
|
}
|
|
53424
53473
|
if (replica.pull_requests && replica.pull_requests.length > 0) {
|
|
53425
|
-
console.log(
|
|
53474
|
+
console.log(import_chalk22.default.gray(` Pull Requests:`));
|
|
53426
53475
|
for (const pr2 of replica.pull_requests) {
|
|
53427
|
-
console.log(
|
|
53476
|
+
console.log(import_chalk22.default.cyan(` - ${pr2.repository} #${pr2.number}: ${pr2.url}`));
|
|
53428
53477
|
}
|
|
53429
53478
|
}
|
|
53430
53479
|
console.log();
|
|
@@ -53451,7 +53500,7 @@ async function replicaCreateCommand(name, options) {
|
|
|
53451
53500
|
});
|
|
53452
53501
|
const answer = response2.name;
|
|
53453
53502
|
if (!answer) {
|
|
53454
|
-
console.log(
|
|
53503
|
+
console.log(import_chalk22.default.yellow("\nCancelled."));
|
|
53455
53504
|
return;
|
|
53456
53505
|
}
|
|
53457
53506
|
replicaName = answer;
|
|
@@ -53469,7 +53518,7 @@ async function replicaCreateCommand(name, options) {
|
|
|
53469
53518
|
});
|
|
53470
53519
|
const answer = response2.environment;
|
|
53471
53520
|
if (!answer) {
|
|
53472
|
-
console.log(
|
|
53521
|
+
console.log(import_chalk22.default.yellow("\nCancelled."));
|
|
53473
53522
|
return;
|
|
53474
53523
|
}
|
|
53475
53524
|
selectedEnvironmentId = answer;
|
|
@@ -53483,7 +53532,7 @@ async function replicaCreateCommand(name, options) {
|
|
|
53483
53532
|
});
|
|
53484
53533
|
const answer = response2.message;
|
|
53485
53534
|
if (!answer) {
|
|
53486
|
-
console.log(
|
|
53535
|
+
console.log(import_chalk22.default.yellow("\nCancelled."));
|
|
53487
53536
|
return;
|
|
53488
53537
|
}
|
|
53489
53538
|
message2 = answer;
|
|
@@ -53497,7 +53546,7 @@ async function replicaCreateCommand(name, options) {
|
|
|
53497
53546
|
initial: 0
|
|
53498
53547
|
});
|
|
53499
53548
|
if (!response2.agent) {
|
|
53500
|
-
console.log(
|
|
53549
|
+
console.log(import_chalk22.default.yellow("\nCancelled."));
|
|
53501
53550
|
return;
|
|
53502
53551
|
}
|
|
53503
53552
|
codingAgent = parseReplicaAgent(response2.agent);
|
|
@@ -53509,20 +53558,20 @@ async function replicaCreateCommand(name, options) {
|
|
|
53509
53558
|
coding_agent: codingAgent,
|
|
53510
53559
|
lifecycle_policy: "default"
|
|
53511
53560
|
};
|
|
53512
|
-
console.log(
|
|
53561
|
+
console.log(import_chalk22.default.gray("\nCreating replica..."));
|
|
53513
53562
|
const response = await orgAuthenticatedFetch("/v1/replica", {
|
|
53514
53563
|
method: "POST",
|
|
53515
53564
|
body
|
|
53516
53565
|
});
|
|
53517
53566
|
output2(response, ({ replica }) => {
|
|
53518
|
-
console.log(
|
|
53567
|
+
console.log(import_chalk22.default.green(`
|
|
53519
53568
|
Created replica: ${replica.name}`));
|
|
53520
|
-
console.log(
|
|
53521
|
-
console.log(
|
|
53569
|
+
console.log(import_chalk22.default.gray(` ID: ${replica.id}`));
|
|
53570
|
+
console.log(import_chalk22.default.gray(` Status: ${formatStatus(replica.status)}`));
|
|
53522
53571
|
if (replica.repositories.length > 0) {
|
|
53523
|
-
console.log(
|
|
53572
|
+
console.log(import_chalk22.default.gray(` Repositories: ${replica.repositories.map((repository) => repository.name).join(", ")}`));
|
|
53524
53573
|
}
|
|
53525
|
-
console.log(
|
|
53574
|
+
console.log(import_chalk22.default.cyan(` Link: ${getWorkspaceDashboardUrl(replica.id, { webAppUrl: process.env.REPLICAS_WEB_URL || DEFAULT_WEB_APP_URL })}`));
|
|
53526
53575
|
console.log();
|
|
53527
53576
|
});
|
|
53528
53577
|
}
|
|
@@ -53538,7 +53587,7 @@ async function replicaSendCommand(id, options) {
|
|
|
53538
53587
|
});
|
|
53539
53588
|
const answer = response2.message;
|
|
53540
53589
|
if (!answer) {
|
|
53541
|
-
console.log(
|
|
53590
|
+
console.log(import_chalk22.default.yellow("\nCancelled."));
|
|
53542
53591
|
return;
|
|
53543
53592
|
}
|
|
53544
53593
|
message2 = answer;
|
|
@@ -53563,14 +53612,14 @@ async function replicaSendCommand(id, options) {
|
|
|
53563
53612
|
}
|
|
53564
53613
|
);
|
|
53565
53614
|
output2(response, (response2) => {
|
|
53566
|
-
const statusColor = response2.status === "sent" ?
|
|
53615
|
+
const statusColor = response2.status === "sent" ? import_chalk22.default.green : import_chalk22.default.yellow;
|
|
53567
53616
|
console.log(statusColor(`
|
|
53568
53617
|
Message ${response2.status}`));
|
|
53569
53618
|
if (response2.chat_id) {
|
|
53570
|
-
console.log(
|
|
53619
|
+
console.log(import_chalk22.default.gray(` Chat: ${response2.chat_id}`));
|
|
53571
53620
|
}
|
|
53572
53621
|
if (response2.position !== void 0 && response2.position > 0) {
|
|
53573
|
-
console.log(
|
|
53622
|
+
console.log(import_chalk22.default.gray(` Queue position: ${response2.position}`));
|
|
53574
53623
|
}
|
|
53575
53624
|
console.log();
|
|
53576
53625
|
});
|
|
@@ -53597,40 +53646,40 @@ async function replicaReadCommand(id, options) {
|
|
|
53597
53646
|
`/v1/replica/${id}/history${query ? "?" + query : ""}`
|
|
53598
53647
|
);
|
|
53599
53648
|
output2(response, (response2) => {
|
|
53600
|
-
console.log(
|
|
53649
|
+
console.log(import_chalk22.default.green(`
|
|
53601
53650
|
Conversation History
|
|
53602
53651
|
`));
|
|
53603
53652
|
if (response2.coding_agent) {
|
|
53604
|
-
console.log(
|
|
53653
|
+
console.log(import_chalk22.default.gray(` Agent: ${response2.coding_agent}`));
|
|
53605
53654
|
}
|
|
53606
53655
|
if (response2.thread_id) {
|
|
53607
|
-
console.log(
|
|
53656
|
+
console.log(import_chalk22.default.gray(` Thread ID: ${response2.thread_id}`));
|
|
53608
53657
|
}
|
|
53609
|
-
console.log(
|
|
53658
|
+
console.log(import_chalk22.default.gray(` Total Events: ${response2.total}`));
|
|
53610
53659
|
if (response2.has_more) {
|
|
53611
53660
|
const previousPage = response2.beforeCursor ? `--before '${response2.beforeCursor}'` : `--before-event ${response2.eventsStartIndex}`;
|
|
53612
|
-
console.log(
|
|
53661
|
+
console.log(import_chalk22.default.gray(` Has More: yes (${previousPage} for the previous page)`));
|
|
53613
53662
|
}
|
|
53614
53663
|
console.log();
|
|
53615
53664
|
if (response2.events.length === 0) {
|
|
53616
|
-
console.log(
|
|
53665
|
+
console.log(import_chalk22.default.yellow(" No events found.\n"));
|
|
53617
53666
|
return;
|
|
53618
53667
|
}
|
|
53619
|
-
console.log(
|
|
53668
|
+
console.log(import_chalk22.default.gray("-".repeat(60)));
|
|
53620
53669
|
const agentType = response2.coding_agent || "claude";
|
|
53621
53670
|
const displayMessages = parseDisplayMessages(response2.events, agentType);
|
|
53622
53671
|
for (const message2 of displayMessages) {
|
|
53623
53672
|
formatDisplayMessage(message2);
|
|
53624
53673
|
}
|
|
53625
|
-
console.log(
|
|
53674
|
+
console.log(import_chalk22.default.gray("\n" + "-".repeat(60)));
|
|
53626
53675
|
console.log();
|
|
53627
53676
|
});
|
|
53628
53677
|
}
|
|
53629
|
-
var
|
|
53678
|
+
var import_chalk22, CLI_CODING_AGENT_LABEL;
|
|
53630
53679
|
var init_replica2 = __esm({
|
|
53631
53680
|
"src/commands/replica.ts"() {
|
|
53632
53681
|
"use strict";
|
|
53633
|
-
|
|
53682
|
+
import_chalk22 = __toESM(require("chalk"));
|
|
53634
53683
|
init_api2();
|
|
53635
53684
|
init_environment3();
|
|
53636
53685
|
init_command_utils();
|
|
@@ -53646,7 +53695,7 @@ async function workspaceRenameCommand(id, name) {
|
|
|
53646
53695
|
method: "PATCH",
|
|
53647
53696
|
body: { name }
|
|
53648
53697
|
});
|
|
53649
|
-
output2(response, ({ workspace }) => console.log(
|
|
53698
|
+
output2(response, ({ workspace }) => console.log(import_chalk23.default.green(`Renamed workspace to ${workspace.name}`)));
|
|
53650
53699
|
}
|
|
53651
53700
|
async function workspaceWakeCommand(id, options) {
|
|
53652
53701
|
await orgAuthenticatedFetch(`/v1/replica/${id}/wake${options.restore ? "?restore=true" : ""}`, { method: "POST" });
|
|
@@ -53666,7 +53715,7 @@ async function workspaceWaitCommand(id, options) {
|
|
|
53666
53715
|
if (options.chat) query.set("chat_id", options.chat);
|
|
53667
53716
|
const step = result?.activity.current_step;
|
|
53668
53717
|
result = await orgAuthenticatedFetch(`/v1/replica/${id}/wait?${query}`);
|
|
53669
|
-
if (!result.done && result.activity.current_step && result.activity.current_step !== step) console.error(
|
|
53718
|
+
if (!result.done && result.activity.current_step && result.activity.current_step !== step) console.error(import_chalk23.default.gray(`\u2026 ${result.activity.current_step}`));
|
|
53670
53719
|
} while (!result.done && result.activity.state !== "waiting_for_input" && Date.now() < deadline);
|
|
53671
53720
|
output2(result, ({ done, status, deleted, activity }) => {
|
|
53672
53721
|
console.log(done ? `Done (status: ${deleted ? "deleted" : status})` : activity.state === "waiting_for_input" ? "The agent is waiting for input" : `Still working after timeout (status: ${status})`);
|
|
@@ -53678,7 +53727,7 @@ async function workspaceStatusCommand(id) {
|
|
|
53678
53727
|
output2(await orgAuthenticatedFetch(`/v1/replica/${id}/status`), (status) => {
|
|
53679
53728
|
const agentsWith = (suffix) => Object.entries(status).filter(([key, value]) => value === true && key.startsWith("is") && key.endsWith(suffix)).map(([key]) => key.slice(2, -suffix.length).toLowerCase());
|
|
53680
53729
|
console.log(`Status: ${status.status}`);
|
|
53681
|
-
if (status.message || status.error) console.log(
|
|
53730
|
+
if (status.message || status.error) console.log(import_chalk23.default.yellow(status.message || status.error));
|
|
53682
53731
|
const working = agentsWith("Processing");
|
|
53683
53732
|
const awaiting = agentsWith("AwaitingInput");
|
|
53684
53733
|
if (working.length > 0) console.log(`Working: ${working.join(", ")}`);
|
|
@@ -53706,8 +53755,8 @@ async function workspaceExecCommand(id, command, options) {
|
|
|
53706
53755
|
output2(result, () => {
|
|
53707
53756
|
process.stdout.write(result.output.endsWith("\n") || !result.output ? result.output : `${result.output}
|
|
53708
53757
|
`);
|
|
53709
|
-
if (result.truncated) console.error(
|
|
53710
|
-
if (result.timed_out) console.error(
|
|
53758
|
+
if (result.truncated) console.error(import_chalk23.default.yellow("Output truncated."));
|
|
53759
|
+
if (result.timed_out) console.error(import_chalk23.default.yellow("Command timed out."));
|
|
53711
53760
|
});
|
|
53712
53761
|
process.exitCode = result.exit_code ?? 1;
|
|
53713
53762
|
}
|
|
@@ -53722,11 +53771,11 @@ async function workspaceHooksCommand(id) {
|
|
|
53722
53771
|
return;
|
|
53723
53772
|
}
|
|
53724
53773
|
for (const entry of entries) {
|
|
53725
|
-
const result = entry.timedOut ?
|
|
53726
|
-
console.log(
|
|
53774
|
+
const result = entry.timedOut ? import_chalk23.default.red("timed out") : entry.exitCode === 0 ? import_chalk23.default.green("exit 0") : import_chalk23.default.red(`exit ${entry.exitCode}`);
|
|
53775
|
+
console.log(import_chalk23.default.bold(`
|
|
53727
53776
|
[${entry.kind}] ${entry.hookName} (${entry.hookType}) ${result} at ${formatDate(entry.executedAt)}`));
|
|
53728
53777
|
console.log(entry.output.trimEnd());
|
|
53729
|
-
if (entry.outputTruncated) console.log(
|
|
53778
|
+
if (entry.outputTruncated) console.log(import_chalk23.default.gray(`\u2026 truncated (${entry.outputTotalChars} chars total)`));
|
|
53730
53779
|
}
|
|
53731
53780
|
});
|
|
53732
53781
|
}
|
|
@@ -53734,7 +53783,7 @@ async function workspaceLogsCommand(id, sessionId, options) {
|
|
|
53734
53783
|
if (!sessionId) {
|
|
53735
53784
|
output2(await orgAuthenticatedFetch(`/v1/replica/${id}/logs`), ({ currentSessionId, sessions }) => {
|
|
53736
53785
|
for (const session of sessions) {
|
|
53737
|
-
const current = session.sessionId === currentSessionId ?
|
|
53786
|
+
const current = session.sessionId === currentSessionId ? import_chalk23.default.green(" (current)") : "";
|
|
53738
53787
|
console.log(`${session.sessionId} ${session.sizeBytes} bytes ${formatDate(session.updatedAt)}${current}`);
|
|
53739
53788
|
}
|
|
53740
53789
|
});
|
|
@@ -53747,7 +53796,7 @@ async function workspaceLogsCommand(id, sessionId, options) {
|
|
|
53747
53796
|
output2(await orgAuthenticatedFetch(`/v1/replica/${id}/logs/${sessionId}${query ? `?${query}` : ""}`), (log) => {
|
|
53748
53797
|
console.log(log.lines.join("\n"));
|
|
53749
53798
|
if (log.hasMore) {
|
|
53750
|
-
console.error(
|
|
53799
|
+
console.error(import_chalk23.default.gray(`Lines ${log.offset}-${log.offset + log.lines.length} of ${log.totalLines}. Next: --offset ${log.offset + log.lines.length}`));
|
|
53751
53800
|
}
|
|
53752
53801
|
});
|
|
53753
53802
|
}
|
|
@@ -53787,16 +53836,16 @@ async function prViewCommand(id, prUrls) {
|
|
|
53787
53836
|
);
|
|
53788
53837
|
output2(response, ({ pullRequests }) => {
|
|
53789
53838
|
for (const { url: url2, details, error: error62 } of pullRequests) {
|
|
53790
|
-
console.log(
|
|
53839
|
+
console.log(import_chalk23.default.bold(`
|
|
53791
53840
|
${url2}`));
|
|
53792
53841
|
if (!details) {
|
|
53793
|
-
console.log(
|
|
53842
|
+
console.log(import_chalk23.default.red(` ${error62 ?? "Details unavailable"}`));
|
|
53794
53843
|
continue;
|
|
53795
53844
|
}
|
|
53796
53845
|
console.log(` ${details.title}`);
|
|
53797
53846
|
console.log(` State: ${details.state} Mergeability: ${details.mergeability} CI: ${details.ciStatus}`);
|
|
53798
53847
|
console.log(` ${details.headBranch} \u2192 ${details.baseBranch} +${details.additions ?? 0} -${details.deletions ?? 0} in ${details.changedFiles} files`);
|
|
53799
|
-
if (details.mergeBlockers?.length) console.log(
|
|
53848
|
+
if (details.mergeBlockers?.length) console.log(import_chalk23.default.yellow(` Blocked by: ${details.mergeBlockers.join(", ").replaceAll("_", " ")}`));
|
|
53800
53849
|
}
|
|
53801
53850
|
});
|
|
53802
53851
|
}
|
|
@@ -53836,14 +53885,14 @@ async function canvasPutCommand(id, filename, options) {
|
|
|
53836
53885
|
{ method: "PUT", body }
|
|
53837
53886
|
);
|
|
53838
53887
|
if (!result.saved) throw new Error(`${filename} changed while saving; retry`);
|
|
53839
|
-
output2(result, () => console.log(
|
|
53888
|
+
output2(result, () => console.log(import_chalk23.default.green(`Saved ${filename}`)));
|
|
53840
53889
|
}
|
|
53841
|
-
var import_fs5,
|
|
53890
|
+
var import_fs5, import_chalk23, getCanvasFile;
|
|
53842
53891
|
var init_workspace = __esm({
|
|
53843
53892
|
"src/commands/workspace.ts"() {
|
|
53844
53893
|
"use strict";
|
|
53845
53894
|
import_fs5 = __toESM(require("fs"));
|
|
53846
|
-
|
|
53895
|
+
import_chalk23 = __toESM(require("chalk"));
|
|
53847
53896
|
init_src();
|
|
53848
53897
|
init_api2();
|
|
53849
53898
|
init_command_utils();
|
|
@@ -53859,7 +53908,7 @@ function printQueue(queue) {
|
|
|
53859
53908
|
return;
|
|
53860
53909
|
}
|
|
53861
53910
|
queue.forEach((message2, index) => {
|
|
53862
|
-
const steered = message2.steeredAt ?
|
|
53911
|
+
const steered = message2.steeredAt ? import_chalk24.default.cyan(" (steered)") : "";
|
|
53863
53912
|
console.log(`${index} ${message2.id}${steered} ${message2.message.replace(/\s+/g, " ").slice(0, 120)}`);
|
|
53864
53913
|
});
|
|
53865
53914
|
}
|
|
@@ -53869,7 +53918,7 @@ function printGoal({ goal }) {
|
|
|
53869
53918
|
async function chatListCommand(id) {
|
|
53870
53919
|
output2(await orgAuthenticatedFetch(`/v1/replica/${id}/chats`), ({ chats }) => {
|
|
53871
53920
|
for (const chat2 of chats) {
|
|
53872
|
-
console.log(`${chat2.id} ${chat2.provider} ${chat2.processing ?
|
|
53921
|
+
console.log(`${chat2.id} ${chat2.provider} ${chat2.processing ? import_chalk24.default.green("working") : "idle"} ${chat2.title}`);
|
|
53873
53922
|
}
|
|
53874
53923
|
});
|
|
53875
53924
|
}
|
|
@@ -53892,7 +53941,7 @@ async function chatRestoreCommand(id, chatId) {
|
|
|
53892
53941
|
outputSuccess(`Restored chat ${chatId}`);
|
|
53893
53942
|
}
|
|
53894
53943
|
async function chatInterruptCommand(id, chatId) {
|
|
53895
|
-
output2(await orgAuthenticatedFetch(chatPath2(id, chatId, "/interrupt"), { method: "POST" }), ({ interrupted }) => console.log(interrupted ?
|
|
53944
|
+
output2(await orgAuthenticatedFetch(chatPath2(id, chatId, "/interrupt"), { method: "POST" }), ({ interrupted }) => console.log(interrupted ? import_chalk24.default.green("Interrupted.") : "Nothing to interrupt."));
|
|
53896
53945
|
}
|
|
53897
53946
|
async function chatForkCommand(id, chatId, options) {
|
|
53898
53947
|
const provider2 = parseReplicaAgent(options.agent);
|
|
@@ -53922,7 +53971,7 @@ async function chatAnswerCommand(id, chatId, requestId, selectionId) {
|
|
|
53922
53971
|
method: "POST",
|
|
53923
53972
|
body: { requestId, selectionId }
|
|
53924
53973
|
});
|
|
53925
|
-
output2(response, ({ resolved }) => console.log(resolved ?
|
|
53974
|
+
output2(response, ({ resolved }) => console.log(resolved ? import_chalk24.default.green("Answer sent.") : import_chalk24.default.yellow("That question is no longer pending.")));
|
|
53926
53975
|
}
|
|
53927
53976
|
async function chatCommandsCommand(id, chatId) {
|
|
53928
53977
|
output2(await orgAuthenticatedFetch(chatPath2(id, chatId, "/slash-commands")), ({ commands }) => {
|
|
@@ -53933,7 +53982,7 @@ async function chatCommandsCommand(id, chatId) {
|
|
|
53933
53982
|
}
|
|
53934
53983
|
async function chatQueueListCommand(id, chatId) {
|
|
53935
53984
|
output2(await orgAuthenticatedFetch(chatPath2(id, chatId, "/queue")), ({ processing, queue }) => {
|
|
53936
|
-
console.log(
|
|
53985
|
+
console.log(import_chalk24.default.gray(processing ? "Agent is working." : "Agent is idle."));
|
|
53937
53986
|
printQueue(queue);
|
|
53938
53987
|
});
|
|
53939
53988
|
}
|
|
@@ -53943,11 +53992,11 @@ async function mutateQueue(path11, method, body) {
|
|
|
53943
53992
|
else console.log("Done.");
|
|
53944
53993
|
});
|
|
53945
53994
|
}
|
|
53946
|
-
var
|
|
53995
|
+
var import_chalk24, chatPath2, chatQueueClearCommand, chatQueueRemoveCommand, chatQueueEditCommand, chatQueueMoveCommand, chatQueueActionCommand;
|
|
53947
53996
|
var init_chat = __esm({
|
|
53948
53997
|
"src/commands/chat.ts"() {
|
|
53949
53998
|
"use strict";
|
|
53950
|
-
|
|
53999
|
+
import_chalk24 = __toESM(require("chalk"));
|
|
53951
54000
|
init_api2();
|
|
53952
54001
|
init_output();
|
|
53953
54002
|
init_replica2();
|
|
@@ -53991,13 +54040,13 @@ async function pluginsDisconnectCommand(pluginId, options) {
|
|
|
53991
54040
|
await pluginsPath(options, `/${pluginId}${options.connection ? `/connections/${options.connection}` : ""}`),
|
|
53992
54041
|
{ method: "DELETE" }
|
|
53993
54042
|
);
|
|
53994
|
-
output2(response, ({ success: success2 }) => console.log(success2 ?
|
|
54043
|
+
output2(response, ({ success: success2 }) => console.log(success2 ? import_chalk25.default.green(`Disconnected ${pluginId}`) : `${pluginId} was not connected`));
|
|
53995
54044
|
}
|
|
53996
|
-
var
|
|
54045
|
+
var import_chalk25, pluginsPath;
|
|
53997
54046
|
var init_plugins3 = __esm({
|
|
53998
54047
|
"src/commands/plugins.ts"() {
|
|
53999
54048
|
"use strict";
|
|
54000
|
-
|
|
54049
|
+
import_chalk25 = __toESM(require("chalk"));
|
|
54001
54050
|
init_api2();
|
|
54002
54051
|
init_command_utils();
|
|
54003
54052
|
init_output();
|
|
@@ -54016,20 +54065,20 @@ async function fetchCurrentRun() {
|
|
|
54016
54065
|
}
|
|
54017
54066
|
async function environmentSetupStatusCommand() {
|
|
54018
54067
|
output2(await fetchCurrentRun(), ({ run: run2, environment: environment2, repositories }) => {
|
|
54019
|
-
console.log(
|
|
54068
|
+
console.log(import_chalk26.default.bold(`
|
|
54020
54069
|
Environment setup: ${environment2.name}
|
|
54021
54070
|
`));
|
|
54022
54071
|
console.log(` Run: ${run2.id}`);
|
|
54023
|
-
console.log(` Status: ${run2.status}${run2.error ?
|
|
54072
|
+
console.log(` Status: ${run2.status}${run2.error ? import_chalk26.default.red(` (${run2.error})`) : ""}`);
|
|
54024
54073
|
console.log(` Environment: ${environment2.id}`);
|
|
54025
54074
|
console.log(` Repositories: ${repositories.map((repo) => `${repo.name} (${repo.default_branch})`).join(", ") || "none"}`);
|
|
54026
54075
|
console.log("\n Steps:");
|
|
54027
54076
|
for (const step of ENVIRONMENT_SETUP_STEPS) {
|
|
54028
54077
|
const status = run2.steps[step.key] ?? "pending";
|
|
54029
|
-
const marker = status === "completed" ?
|
|
54030
|
-
console.log(` ${marker} ${step.key.padEnd(11)} ${
|
|
54078
|
+
const marker = status === "completed" ? import_chalk26.default.green("\u2713") : status === "in_progress" ? import_chalk26.default.cyan("\u25B8") : status === "skipped" ? import_chalk26.default.gray("\u2013") : import_chalk26.default.gray("\u25CB");
|
|
54079
|
+
console.log(` ${marker} ${step.key.padEnd(11)} ${import_chalk26.default.gray(step.label)} ${import_chalk26.default.gray(`[${status}]`)}`);
|
|
54031
54080
|
}
|
|
54032
|
-
console.log(run2.proposal ?
|
|
54081
|
+
console.log(run2.proposal ? import_chalk26.default.gray("\n A proposal has been submitted. Run `propose` again to replace it.\n") : import_chalk26.default.gray("\n No proposal yet. Submit one with `replicas environment-setup propose --file <path>`.\n"));
|
|
54033
54082
|
});
|
|
54034
54083
|
}
|
|
54035
54084
|
async function environmentSetupStepCommand(key, status) {
|
|
@@ -54045,7 +54094,7 @@ async function environmentSetupStepCommand(key, status) {
|
|
|
54045
54094
|
method: "POST",
|
|
54046
54095
|
body
|
|
54047
54096
|
});
|
|
54048
|
-
output2(result, () => console.log(
|
|
54097
|
+
output2(result, () => console.log(import_chalk26.default.green(`
|
|
54049
54098
|
\u2713 ${key} \u2192 ${status}
|
|
54050
54099
|
`)));
|
|
54051
54100
|
}
|
|
@@ -54064,22 +54113,22 @@ async function environmentSetupProposeCommand(options) {
|
|
|
54064
54113
|
body: { proposal }
|
|
54065
54114
|
});
|
|
54066
54115
|
output2(result, ({ run: { proposal: submitted } }) => {
|
|
54067
|
-
console.log(
|
|
54116
|
+
console.log(import_chalk26.default.green("\n\u2713 Proposal submitted.\n"));
|
|
54068
54117
|
if (submitted) {
|
|
54069
54118
|
console.log(` Automations: ${submitted.automations.length}`);
|
|
54070
54119
|
console.log(` Variables: ${submitted.variables.length}`);
|
|
54071
54120
|
console.log(` Checks: ${submitted.verification.length}`);
|
|
54072
54121
|
console.log(` Media: ${submitted.media.length}`);
|
|
54073
54122
|
}
|
|
54074
|
-
console.log(
|
|
54123
|
+
console.log(import_chalk26.default.gray("\n The user reviews and saves it from the Environment panel; nothing has been applied yet.\n"));
|
|
54075
54124
|
});
|
|
54076
54125
|
}
|
|
54077
|
-
var import_fs6,
|
|
54126
|
+
var import_fs6, import_chalk26, STEP_KEYS;
|
|
54078
54127
|
var init_environment_setup2 = __esm({
|
|
54079
54128
|
"src/commands/environment-setup.ts"() {
|
|
54080
54129
|
"use strict";
|
|
54081
54130
|
import_fs6 = __toESM(require("fs"));
|
|
54082
|
-
|
|
54131
|
+
import_chalk26 = __toESM(require("chalk"));
|
|
54083
54132
|
init_api2();
|
|
54084
54133
|
init_command_utils();
|
|
54085
54134
|
init_config();
|
|
@@ -54322,41 +54371,41 @@ function resolveSelectableEnvironmentId(envInput, selectableEnvs) {
|
|
|
54322
54371
|
return resolved.id;
|
|
54323
54372
|
}
|
|
54324
54373
|
function printAutomation(automation2) {
|
|
54325
|
-
console.log(
|
|
54326
|
-
console.log(
|
|
54327
|
-
console.log(
|
|
54374
|
+
console.log(import_chalk27.default.white(` ${automation2.name}`));
|
|
54375
|
+
console.log(import_chalk27.default.gray(` ID: ${automation2.id}`));
|
|
54376
|
+
console.log(import_chalk27.default.gray(` Owner: ${automation2.user_id ? "personal" : "organization"}`));
|
|
54328
54377
|
if (automation2.description) {
|
|
54329
|
-
console.log(
|
|
54378
|
+
console.log(import_chalk27.default.gray(` Description: ${automation2.description}`));
|
|
54330
54379
|
}
|
|
54331
|
-
console.log(
|
|
54380
|
+
console.log(import_chalk27.default.gray(` Enabled: ${automation2.enabled ? import_chalk27.default.green("yes") : import_chalk27.default.red("no")}`));
|
|
54332
54381
|
if (automation2.auto_paused_at) {
|
|
54333
|
-
console.log(
|
|
54382
|
+
console.log(import_chalk27.default.yellow(` ${truncate2(formatAutoPause(automation2), 120)}`));
|
|
54334
54383
|
}
|
|
54335
54384
|
if (automation2.triggers.length > 0) {
|
|
54336
|
-
console.log(
|
|
54385
|
+
console.log(import_chalk27.default.gray(` Triggers: ${automation2.triggers.map(formatTrigger).join(", ")}`));
|
|
54337
54386
|
}
|
|
54338
54387
|
if (automation2.github_check_names.length > 0) {
|
|
54339
|
-
console.log(
|
|
54388
|
+
console.log(import_chalk27.default.gray(` GitHub checks: ${automation2.github_check_names.join(", ")}`));
|
|
54340
54389
|
}
|
|
54341
|
-
console.log(
|
|
54390
|
+
console.log(import_chalk27.default.gray(` Prompt: ${truncate2(automation2.prompt, 80)}`));
|
|
54342
54391
|
if (automation2.cron_next_fire_at) {
|
|
54343
|
-
console.log(
|
|
54392
|
+
console.log(import_chalk27.default.gray(` Next Run: ${formatDate(automation2.cron_next_fire_at)}`));
|
|
54344
54393
|
}
|
|
54345
|
-
console.log(
|
|
54346
|
-
console.log(
|
|
54347
|
-
if (automation2.background) console.log(
|
|
54394
|
+
console.log(import_chalk27.default.gray(` Runs: ${formatRuns(automation2)}`));
|
|
54395
|
+
console.log(import_chalk27.default.gray(` Workspace: ${formatDestination(automation2)}`));
|
|
54396
|
+
if (automation2.background) console.log(import_chalk27.default.gray(" List: background"));
|
|
54348
54397
|
if (automation2.workspace_lifecycle_policy && automation2.workspace_lifecycle_policy !== "default") {
|
|
54349
|
-
console.log(
|
|
54398
|
+
console.log(import_chalk27.default.gray(` Lifecycle: ${automation2.workspace_lifecycle_policy}`));
|
|
54350
54399
|
}
|
|
54351
54400
|
if (automation2.agent_provider || automation2.model || automation2.thinking_level) {
|
|
54352
|
-
console.log(
|
|
54401
|
+
console.log(import_chalk27.default.gray(` Agent: ${formatAgentSummary(automation2)}`));
|
|
54353
54402
|
}
|
|
54354
54403
|
if (automation2.plan_mode || automation2.goal_mode || automation2.fast_mode) {
|
|
54355
|
-
console.log(
|
|
54404
|
+
console.log(import_chalk27.default.gray(` Modes: ${formatModeSummary(automation2)}`));
|
|
54356
54405
|
}
|
|
54357
|
-
console.log(
|
|
54358
|
-
console.log(
|
|
54359
|
-
console.log(
|
|
54406
|
+
console.log(import_chalk27.default.gray(` PR Follow-ups: ${automation2.config.capabilities?.pr_followups === true ? import_chalk27.default.green("managed") : "read-only"}`));
|
|
54407
|
+
console.log(import_chalk27.default.gray(` Created: ${formatDate(automation2.created_at)}`));
|
|
54408
|
+
console.log(import_chalk27.default.gray(` Updated: ${formatDate(automation2.updated_at)}`));
|
|
54360
54409
|
console.log();
|
|
54361
54410
|
}
|
|
54362
54411
|
async function resolveCredentialsMember(value) {
|
|
@@ -54387,10 +54436,10 @@ async function automationListCommand(options) {
|
|
|
54387
54436
|
);
|
|
54388
54437
|
output2(response, (response2) => {
|
|
54389
54438
|
if (response2.automations.length === 0) {
|
|
54390
|
-
console.log(
|
|
54439
|
+
console.log(import_chalk27.default.yellow("\nNo automations found.\n"));
|
|
54391
54440
|
return;
|
|
54392
54441
|
}
|
|
54393
|
-
console.log(
|
|
54442
|
+
console.log(import_chalk27.default.green(`
|
|
54394
54443
|
Automations (Page ${response2.page} of ${response2.totalPages}, Total: ${response2.total}):
|
|
54395
54444
|
`));
|
|
54396
54445
|
for (const automation2 of response2.automations) {
|
|
@@ -54402,49 +54451,49 @@ async function automationGetCommand(id) {
|
|
|
54402
54451
|
ensureOrgApiAuthenticated();
|
|
54403
54452
|
const response = await orgAuthenticatedFetch(`/v1/automations/${id}`);
|
|
54404
54453
|
output2(response.automation, (automation2) => {
|
|
54405
|
-
console.log(
|
|
54454
|
+
console.log(import_chalk27.default.green(`
|
|
54406
54455
|
Automation: ${automation2.name}
|
|
54407
54456
|
`));
|
|
54408
|
-
console.log(
|
|
54457
|
+
console.log(import_chalk27.default.gray(` ID: ${automation2.id}`));
|
|
54409
54458
|
if (automation2.description) {
|
|
54410
|
-
console.log(
|
|
54459
|
+
console.log(import_chalk27.default.gray(` Description: ${automation2.description}`));
|
|
54411
54460
|
}
|
|
54412
|
-
console.log(
|
|
54461
|
+
console.log(import_chalk27.default.gray(` Enabled: ${automation2.enabled ? import_chalk27.default.green("yes") : import_chalk27.default.red("no")}`));
|
|
54413
54462
|
if (automation2.auto_paused_at) {
|
|
54414
|
-
console.log(
|
|
54463
|
+
console.log(import_chalk27.default.yellow(` ${formatAutoPause(automation2)}`));
|
|
54415
54464
|
}
|
|
54416
54465
|
if (automation2.triggers.length > 0) {
|
|
54417
|
-
console.log(
|
|
54466
|
+
console.log(import_chalk27.default.gray(` Triggers:`));
|
|
54418
54467
|
for (const trigger of automation2.triggers) {
|
|
54419
|
-
console.log(
|
|
54468
|
+
console.log(import_chalk27.default.gray(` - ${formatTrigger(trigger)}`));
|
|
54420
54469
|
}
|
|
54421
54470
|
}
|
|
54422
54471
|
if (automation2.github_check_names.length > 0) {
|
|
54423
|
-
console.log(
|
|
54472
|
+
console.log(import_chalk27.default.gray(` GitHub checks: ${automation2.github_check_names.join(", ")}`));
|
|
54424
54473
|
}
|
|
54425
|
-
console.log(
|
|
54426
|
-
console.log(
|
|
54474
|
+
console.log(import_chalk27.default.gray(` Prompt: ${automation2.prompt}`));
|
|
54475
|
+
console.log(import_chalk27.default.gray(` Environment: ${automation2.environment_id}`));
|
|
54427
54476
|
if (automation2.cron_next_fire_at) {
|
|
54428
|
-
console.log(
|
|
54477
|
+
console.log(import_chalk27.default.gray(` Next Run: ${formatDate(automation2.cron_next_fire_at)}`));
|
|
54429
54478
|
}
|
|
54430
|
-
console.log(
|
|
54431
|
-
console.log(
|
|
54432
|
-
console.log(
|
|
54433
|
-
if (automation2.credential_user_id) console.log(
|
|
54434
|
-
console.log(
|
|
54479
|
+
console.log(import_chalk27.default.gray(` Runs: ${formatRuns(automation2)}`));
|
|
54480
|
+
console.log(import_chalk27.default.gray(` Workspace: ${formatDestination(automation2)}`));
|
|
54481
|
+
console.log(import_chalk27.default.gray(` List: ${automation2.background ? "background" : "main"}`));
|
|
54482
|
+
if (automation2.credential_user_id) console.log(import_chalk27.default.gray(` Credentials: member ${automation2.credential_user_id}, then the organization's`));
|
|
54483
|
+
console.log(import_chalk27.default.gray(` Size: ${automation2.workspace_size ?? DEFAULT_WORKSPACE_SIZE}${automation2.target_workspace_id ? " (new workspaces only; runs reuse the pinned workspace)" : ""}`));
|
|
54435
54484
|
if (automation2.workspace_lifecycle_policy) {
|
|
54436
|
-
console.log(
|
|
54485
|
+
console.log(import_chalk27.default.gray(` Lifecycle Policy: ${automation2.workspace_lifecycle_policy}`));
|
|
54437
54486
|
}
|
|
54438
54487
|
if (automation2.workspace_auto_stop_minutes) {
|
|
54439
|
-
console.log(
|
|
54440
|
-
}
|
|
54441
|
-
console.log(
|
|
54442
|
-
console.log(
|
|
54443
|
-
console.log(
|
|
54444
|
-
console.log(
|
|
54445
|
-
console.log(
|
|
54446
|
-
console.log(
|
|
54447
|
-
console.log(
|
|
54488
|
+
console.log(import_chalk27.default.gray(` Auto-stop: ${automation2.workspace_auto_stop_minutes} minutes`));
|
|
54489
|
+
}
|
|
54490
|
+
console.log(import_chalk27.default.gray(` Agent: ${automation2.agent_provider ? getProviderDisplayName(automation2.agent_provider) : "organization default"}`));
|
|
54491
|
+
console.log(import_chalk27.default.gray(` Model: ${automation2.model ? MODEL_LABELS[automation2.model] ?? automation2.model : "agent default"}`));
|
|
54492
|
+
console.log(import_chalk27.default.gray(` Thinking Level: ${automation2.thinking_level ?? "agent default"}`));
|
|
54493
|
+
console.log(import_chalk27.default.gray(` Modes: ${formatModeSummary(automation2)}`));
|
|
54494
|
+
console.log(import_chalk27.default.gray(` PR Follow-ups: ${automation2.config.capabilities?.pr_followups === true ? "managed" : "read-only"}`));
|
|
54495
|
+
console.log(import_chalk27.default.gray(` Created: ${formatDate(automation2.created_at)}`));
|
|
54496
|
+
console.log(import_chalk27.default.gray(` Updated: ${formatDate(automation2.updated_at)}`));
|
|
54448
54497
|
console.log();
|
|
54449
54498
|
});
|
|
54450
54499
|
}
|
|
@@ -54616,7 +54665,7 @@ async function automationCreateCommand(name, options) {
|
|
|
54616
54665
|
});
|
|
54617
54666
|
const answer = response2.name;
|
|
54618
54667
|
if (!answer) {
|
|
54619
|
-
console.log(
|
|
54668
|
+
console.log(import_chalk27.default.yellow("\nCancelled."));
|
|
54620
54669
|
return;
|
|
54621
54670
|
}
|
|
54622
54671
|
automationName = answer;
|
|
@@ -54631,7 +54680,7 @@ async function automationCreateCommand(name, options) {
|
|
|
54631
54680
|
});
|
|
54632
54681
|
const answer = response2.prompt;
|
|
54633
54682
|
if (!answer) {
|
|
54634
|
-
console.log(
|
|
54683
|
+
console.log(import_chalk27.default.yellow("\nCancelled."));
|
|
54635
54684
|
return;
|
|
54636
54685
|
}
|
|
54637
54686
|
automationPrompt = answer;
|
|
@@ -54653,7 +54702,7 @@ async function automationCreateCommand(name, options) {
|
|
|
54653
54702
|
}))
|
|
54654
54703
|
});
|
|
54655
54704
|
if (!envResponse2.env) {
|
|
54656
|
-
console.log(
|
|
54705
|
+
console.log(import_chalk27.default.yellow("\nCancelled."));
|
|
54657
54706
|
return;
|
|
54658
54707
|
}
|
|
54659
54708
|
selectedEnvironmentId = envResponse2.env;
|
|
@@ -54695,25 +54744,25 @@ async function automationCreateCommand(name, options) {
|
|
|
54695
54744
|
...options.fastMode ? { fast_mode: true } : {},
|
|
54696
54745
|
...agentSelection
|
|
54697
54746
|
};
|
|
54698
|
-
console.log(
|
|
54747
|
+
console.log(import_chalk27.default.gray("\nCreating automation..."));
|
|
54699
54748
|
const response = await orgAuthenticatedFetch("/v1/automations", {
|
|
54700
54749
|
method: "POST",
|
|
54701
54750
|
body
|
|
54702
54751
|
});
|
|
54703
54752
|
output2(response.automation, (automation2) => {
|
|
54704
|
-
console.log(
|
|
54753
|
+
console.log(import_chalk27.default.green(`
|
|
54705
54754
|
Created automation: ${automation2.name}`));
|
|
54706
|
-
console.log(
|
|
54707
|
-
console.log(
|
|
54755
|
+
console.log(import_chalk27.default.gray(` ID: ${automation2.id}`));
|
|
54756
|
+
console.log(import_chalk27.default.gray(` Enabled: ${automation2.enabled ? "yes" : "no"}`));
|
|
54708
54757
|
if (automation2.triggers.length > 0) {
|
|
54709
|
-
console.log(
|
|
54758
|
+
console.log(import_chalk27.default.gray(` Triggers: ${automation2.triggers.map(formatTrigger).join(", ")}`));
|
|
54710
54759
|
}
|
|
54711
54760
|
if (automation2.cron_next_fire_at) {
|
|
54712
|
-
console.log(
|
|
54761
|
+
console.log(import_chalk27.default.gray(` Next Run: ${formatDate(automation2.cron_next_fire_at)} (${automation2.cron_next_fire_at})`));
|
|
54713
54762
|
}
|
|
54714
|
-
console.log(
|
|
54715
|
-
console.log(
|
|
54716
|
-
console.log(
|
|
54763
|
+
console.log(import_chalk27.default.gray(` Runs: ${formatRuns(automation2)}`));
|
|
54764
|
+
console.log(import_chalk27.default.gray(` Workspace: ${formatDestination(automation2)}`));
|
|
54765
|
+
console.log(import_chalk27.default.gray(` List: ${automation2.background ? "background" : "main"}`));
|
|
54717
54766
|
console.log();
|
|
54718
54767
|
});
|
|
54719
54768
|
}
|
|
@@ -54870,21 +54919,21 @@ async function automationEditCommand(id, options) {
|
|
|
54870
54919
|
Object.assign(body, agentSelection);
|
|
54871
54920
|
}
|
|
54872
54921
|
if (Object.keys(body).length === 0) {
|
|
54873
|
-
output2(existing.automation, () => console.log(
|
|
54922
|
+
output2(existing.automation, () => console.log(import_chalk27.default.yellow("\nNo changes made.\n")));
|
|
54874
54923
|
return;
|
|
54875
54924
|
}
|
|
54876
|
-
console.log(
|
|
54925
|
+
console.log(import_chalk27.default.gray("\nUpdating automation..."));
|
|
54877
54926
|
const response = await orgAuthenticatedFetch(`/v1/automations/${id}`, {
|
|
54878
54927
|
method: "PATCH",
|
|
54879
54928
|
body
|
|
54880
54929
|
});
|
|
54881
54930
|
output2(response.automation, (automation2) => {
|
|
54882
|
-
console.log(
|
|
54931
|
+
console.log(import_chalk27.default.green(`
|
|
54883
54932
|
Updated automation: ${automation2.name}`));
|
|
54884
|
-
console.log(
|
|
54885
|
-
console.log(
|
|
54933
|
+
console.log(import_chalk27.default.gray(` ID: ${automation2.id}`));
|
|
54934
|
+
console.log(import_chalk27.default.gray(` Enabled: ${automation2.enabled ? "yes" : "no"}`));
|
|
54886
54935
|
if (automation2.triggers.length > 0) {
|
|
54887
|
-
console.log(
|
|
54936
|
+
console.log(import_chalk27.default.gray(` Triggers: ${automation2.triggers.map(formatTrigger).join(", ")}`));
|
|
54888
54937
|
}
|
|
54889
54938
|
console.log();
|
|
54890
54939
|
});
|
|
@@ -54896,7 +54945,7 @@ async function automationRunCommand(id) {
|
|
|
54896
54945
|
if (!hasCronTrigger(automation2.triggers)) {
|
|
54897
54946
|
throw new Error(`Manual run is only allowed for automations with a cron trigger. This automation has triggers: ${automation2.triggers.map(formatTrigger).join(", ")}`);
|
|
54898
54947
|
}
|
|
54899
|
-
console.log(
|
|
54948
|
+
console.log(import_chalk27.default.gray(`
|
|
54900
54949
|
Triggering automation "${automation2.name}"...`));
|
|
54901
54950
|
const response = await orgAuthenticatedFetch(
|
|
54902
54951
|
`/v1/automations/${id}/trigger`,
|
|
@@ -54907,11 +54956,11 @@ Triggering automation "${automation2.name}"...`));
|
|
|
54907
54956
|
);
|
|
54908
54957
|
if (!response.execution_id) throw new Error("Automation trigger returned no execution ID. The automation may not have started.");
|
|
54909
54958
|
output2(response, (response2) => {
|
|
54910
|
-
console.log(
|
|
54959
|
+
console.log(import_chalk27.default.green(`
|
|
54911
54960
|
Automation triggered successfully.`));
|
|
54912
|
-
console.log(
|
|
54961
|
+
console.log(import_chalk27.default.gray(` Execution ID: ${response2.execution_id}`));
|
|
54913
54962
|
if (response2.workspace_id) {
|
|
54914
|
-
console.log(
|
|
54963
|
+
console.log(import_chalk27.default.gray(` Workspace ID: ${response2.workspace_id}`));
|
|
54915
54964
|
}
|
|
54916
54965
|
console.log();
|
|
54917
54966
|
});
|
|
@@ -54945,9 +54994,9 @@ async function automationCheckCommand(checkRunId, options) {
|
|
|
54945
54994
|
`/v1/automations/checks/${id}`,
|
|
54946
54995
|
{ method: "POST", body }
|
|
54947
54996
|
);
|
|
54948
|
-
output2(response, (response2) => console.log(response2.reported ?
|
|
54997
|
+
output2(response, (response2) => console.log(response2.reported ? import_chalk27.default.green(`
|
|
54949
54998
|
Reported ${conclusion} for "${response2.name}".
|
|
54950
|
-
`) :
|
|
54999
|
+
`) : import_chalk27.default.yellow(`
|
|
54951
55000
|
Skipped "${response2.name}" \u2014 a newer run of this automation owns it and will report the verdict.
|
|
54952
55001
|
`)));
|
|
54953
55002
|
}
|
|
@@ -54963,7 +55012,7 @@ async function automationExecutionsCommand(id, options) {
|
|
|
54963
55012
|
for (const execution of response2.executions) {
|
|
54964
55013
|
console.log(`${execution.id} ${execution.status} ${formatDate(execution.triggered_at)} ${execution.workspace_id ?? "-"}${execution.error ? ` ${execution.error}` : ""}`);
|
|
54965
55014
|
}
|
|
54966
|
-
console.log(
|
|
55015
|
+
console.log(import_chalk27.default.gray(`Page ${response2.page} of ${response2.totalPages} (${response2.total} runs)`));
|
|
54967
55016
|
});
|
|
54968
55017
|
}
|
|
54969
55018
|
async function automationRetryCommand(id, executionId) {
|
|
@@ -54971,13 +55020,13 @@ async function automationRetryCommand(id, executionId) {
|
|
|
54971
55020
|
`/v1/automations/${id}/executions/${executionId}/retry`,
|
|
54972
55021
|
{ method: "POST" }
|
|
54973
55022
|
);
|
|
54974
|
-
output2(response, (response2) => console.log(
|
|
55023
|
+
output2(response, (response2) => console.log(import_chalk27.default.green(`Retried as execution ${response2.execution_id}${response2.workspace_id ? ` in workspace ${response2.workspace_id}` : ""}`)));
|
|
54975
55024
|
}
|
|
54976
|
-
var
|
|
55025
|
+
var import_chalk27, DURATION_UNIT_MS;
|
|
54977
55026
|
var init_automation = __esm({
|
|
54978
55027
|
"src/commands/automation.ts"() {
|
|
54979
55028
|
"use strict";
|
|
54980
|
-
|
|
55029
|
+
import_chalk27 = __toESM(require("chalk"));
|
|
54981
55030
|
init_output();
|
|
54982
55031
|
init_api2();
|
|
54983
55032
|
init_config();
|
|
@@ -55096,9 +55145,9 @@ async function previewListCommand(workspaceId) {
|
|
|
55096
55145
|
`/v1/replica/${workspaceId}/previews`
|
|
55097
55146
|
);
|
|
55098
55147
|
output2(result, ({ previews }) => {
|
|
55099
|
-
if (previews.length === 0) console.log(
|
|
55148
|
+
if (previews.length === 0) console.log(import_chalk28.default.dim("No active previews"));
|
|
55100
55149
|
for (const preview2 of previews) {
|
|
55101
|
-
console.log(` ${
|
|
55150
|
+
console.log(` ${import_chalk28.default.cyan(String(preview2.port))} \u2192 ${import_chalk28.default.underline(preview2.publicUrl)}`);
|
|
55102
55151
|
}
|
|
55103
55152
|
});
|
|
55104
55153
|
}
|
|
@@ -55112,7 +55161,7 @@ async function previewAddCommand(workspaceId, options) {
|
|
|
55112
55161
|
body: { port: portNum, authenticated: options.authenticated ?? false }
|
|
55113
55162
|
}
|
|
55114
55163
|
);
|
|
55115
|
-
output2(result, ({ preview: preview2 }) => console.log(
|
|
55164
|
+
output2(result, ({ preview: preview2 }) => console.log(import_chalk28.default.green(`Preview created: ${preview2.publicUrl}`)));
|
|
55116
55165
|
}
|
|
55117
55166
|
async function previewDeleteCommand(port) {
|
|
55118
55167
|
const portNum = parsePreviewPort(port);
|
|
@@ -55127,11 +55176,11 @@ async function previewRemoveCommand(workspaceId, options) {
|
|
|
55127
55176
|
);
|
|
55128
55177
|
outputSuccess(`Preview deleted on port ${portNum}`);
|
|
55129
55178
|
}
|
|
55130
|
-
var
|
|
55179
|
+
var import_chalk28, parsePreviewPort;
|
|
55131
55180
|
var init_preview = __esm({
|
|
55132
55181
|
"src/commands/preview.ts"() {
|
|
55133
55182
|
"use strict";
|
|
55134
|
-
|
|
55183
|
+
import_chalk28 = __toESM(require("chalk"));
|
|
55135
55184
|
init_config();
|
|
55136
55185
|
init_agent_api();
|
|
55137
55186
|
init_api2();
|
|
@@ -55791,10 +55840,10 @@ function parseEnv(values) {
|
|
|
55791
55840
|
return values?.length ? parseKeyValuePairs(values) : void 0;
|
|
55792
55841
|
}
|
|
55793
55842
|
function describe3(sandbox) {
|
|
55794
|
-
console.log(`${
|
|
55795
|
-
console.log(
|
|
55843
|
+
console.log(`${import_chalk29.default.bold(sandbox.id)} ${sandbox.status} ${sandbox.gpu ?? "no GPU"} ${sandbox.image}`);
|
|
55844
|
+
console.log(import_chalk29.default.gray(` expires ${new Date(sandbox.expiresAt).toLocaleString()}`));
|
|
55796
55845
|
for (const tunnel of sandbox.tunnels) console.log(` port ${tunnel.port}: ${tunnel.url}`);
|
|
55797
|
-
if (sandbox.error) console.log(
|
|
55846
|
+
if (sandbox.error) console.log(import_chalk29.default.red(` ${sandbox.error}`));
|
|
55798
55847
|
}
|
|
55799
55848
|
async function resolveSandboxId(options) {
|
|
55800
55849
|
if (options.sandbox) return options.sandbox;
|
|
@@ -55815,7 +55864,7 @@ async function createSandbox(options) {
|
|
|
55815
55864
|
};
|
|
55816
55865
|
let { sandbox } = await agentFetch(BASE, { method: "POST", body: request });
|
|
55817
55866
|
if (options.wait === false) return sandbox;
|
|
55818
|
-
process.stderr.write(
|
|
55867
|
+
process.stderr.write(import_chalk29.default.gray(`Starting ${sandbox.gpu} sandbox ${sandbox.id} (a new image can take a few minutes to pull)...
|
|
55819
55868
|
`));
|
|
55820
55869
|
const deadline = Date.now() + CREATE_WAIT_TIMEOUT_MS;
|
|
55821
55870
|
while (sandbox.status === "creating") {
|
|
@@ -55879,8 +55928,8 @@ async function gpuExecCommand(command, options) {
|
|
|
55879
55928
|
if (options.detach) {
|
|
55880
55929
|
const { jobId } = await response.json();
|
|
55881
55930
|
output2({ jobId, sandboxId }, () => {
|
|
55882
|
-
console.log(`Started job ${
|
|
55883
|
-
console.log(
|
|
55931
|
+
console.log(`Started job ${import_chalk29.default.bold(jobId)} in ${sandboxId}`);
|
|
55932
|
+
console.log(import_chalk29.default.gray(`Follow it with: replicas gpu logs ${jobId} -f`));
|
|
55884
55933
|
});
|
|
55885
55934
|
return;
|
|
55886
55935
|
}
|
|
@@ -55900,13 +55949,13 @@ async function gpuLogsCommand(jobId, options) {
|
|
|
55900
55949
|
return;
|
|
55901
55950
|
}
|
|
55902
55951
|
if (exitCode === null) {
|
|
55903
|
-
process.stderr.write(
|
|
55952
|
+
process.stderr.write(import_chalk29.default.gray(`
|
|
55904
55953
|
Job ${jobId} is still running.
|
|
55905
55954
|
`));
|
|
55906
55955
|
return;
|
|
55907
55956
|
}
|
|
55908
55957
|
if (options.follow) process.exitCode = exitCode;
|
|
55909
|
-
process.stderr.write(
|
|
55958
|
+
process.stderr.write(import_chalk29.default.gray(`
|
|
55910
55959
|
Job ${jobId} exited with code ${exitCode}.
|
|
55911
55960
|
`));
|
|
55912
55961
|
}
|
|
@@ -56014,7 +56063,7 @@ async function gpuRunCommand(command, options) {
|
|
|
56014
56063
|
const { env, ...createOptions } = options;
|
|
56015
56064
|
const sandbox = await createSandbox({ ...createOptions, wait: true });
|
|
56016
56065
|
try {
|
|
56017
|
-
process.stderr.write(
|
|
56066
|
+
process.stderr.write(import_chalk29.default.gray(`Copying ${process.cwd()} to ${COMPUTE_SANDBOX_WORKDIR}...
|
|
56018
56067
|
`));
|
|
56019
56068
|
await push(sandbox.id, ".", COMPUTE_SANDBOX_WORKDIR);
|
|
56020
56069
|
const exitCode = await streamOutput(await exec(sandbox.id, command.join(" "), { env }));
|
|
@@ -56025,16 +56074,16 @@ async function gpuRunCommand(command, options) {
|
|
|
56025
56074
|
if (isJsonMode()) output2({ sandboxId: sandbox.id, exitCode }, () => {
|
|
56026
56075
|
});
|
|
56027
56076
|
} finally {
|
|
56028
|
-
if (options.keep) process.stderr.write(
|
|
56077
|
+
if (options.keep) process.stderr.write(import_chalk29.default.gray(`Kept GPU sandbox ${sandbox.id} running.
|
|
56029
56078
|
`));
|
|
56030
56079
|
else await agentRequest(`${BASE}/${sandbox.id}`, { method: "DELETE" });
|
|
56031
56080
|
}
|
|
56032
56081
|
}
|
|
56033
|
-
var
|
|
56082
|
+
var import_chalk29, import_node_child_process2, import_node_crypto2, import_node_fs2, import_node_os2, import_node_path2, import_node_stream, import_promises, BASE, CREATE_POLL_INTERVAL_MS, CREATE_WAIT_TIMEOUT_MS;
|
|
56034
56083
|
var init_gpu2 = __esm({
|
|
56035
56084
|
"src/commands/gpu.ts"() {
|
|
56036
56085
|
"use strict";
|
|
56037
|
-
|
|
56086
|
+
import_chalk29 = __toESM(require("chalk"));
|
|
56038
56087
|
import_node_child_process2 = require("child_process");
|
|
56039
56088
|
import_node_crypto2 = require("crypto");
|
|
56040
56089
|
import_node_fs2 = require("fs");
|
|
@@ -56066,16 +56115,16 @@ function printSource({ source }) {
|
|
|
56066
56115
|
console.log(`Managed variables: ${source.managed.variables.join(", ") || "(none)"}`);
|
|
56067
56116
|
console.log(`Managed MCPs: ${source.managed.mcps.join(", ") || "(none)"}`);
|
|
56068
56117
|
if (source.required_secrets.length) console.log(`Required secrets: ${source.required_secrets.join(", ")}`);
|
|
56069
|
-
if (source.pending_rebuild) console.log(
|
|
56070
|
-
if (source.last_error) console.log(
|
|
56118
|
+
if (source.pending_rebuild) console.log(import_chalk30.default.yellow("Configuration saved; environment rebuild pending."));
|
|
56119
|
+
if (source.last_error) console.log(import_chalk30.default.red(source.last_error));
|
|
56071
56120
|
}
|
|
56072
56121
|
function printPreview({ preview: preview2 }) {
|
|
56073
56122
|
console.log(preview2.kind === "file" ? `${preview2.filename} @ ${preview2.file_sha}` : `${preview2.repository_name}/${preview2.filename} @ ${preview2.commit_sha}`);
|
|
56074
56123
|
if (preview2.source_url) console.log(preview2.source_url);
|
|
56075
56124
|
if (!preview2.changes.length) console.log("No setting changes. Applying records this configuration.");
|
|
56076
56125
|
for (const change of preview2.changes) console.log(` ${change.operation}: ${change.kind} ${change.key}`);
|
|
56077
|
-
if (preview2.missing_secrets.length) console.log(
|
|
56078
|
-
for (const blocker of preview2.blockers) console.log(
|
|
56126
|
+
if (preview2.missing_secrets.length) console.log(import_chalk30.default.yellow(`Missing required secrets: ${preview2.missing_secrets.join(", ")}`));
|
|
56127
|
+
for (const blocker of preview2.blockers) console.log(import_chalk30.default.red(` Cannot apply: ${blocker}`));
|
|
56079
56128
|
}
|
|
56080
56129
|
async function sourceInput2(options) {
|
|
56081
56130
|
if (options.file && options.repository) throw new Error("Choose either --file or --repository");
|
|
@@ -56146,11 +56195,11 @@ async function environmentConfigDisconnectCommand(environment2, options) {
|
|
|
56146
56195
|
console.log("Configuration source disconnected. Current settings preserved.");
|
|
56147
56196
|
});
|
|
56148
56197
|
}
|
|
56149
|
-
var
|
|
56198
|
+
var import_chalk30, import_promises2, import_node_path3;
|
|
56150
56199
|
var init_environment_config2 = __esm({
|
|
56151
56200
|
"src/commands/environment-config.ts"() {
|
|
56152
56201
|
"use strict";
|
|
56153
|
-
|
|
56202
|
+
import_chalk30 = __toESM(require("chalk"));
|
|
56154
56203
|
import_promises2 = require("fs/promises");
|
|
56155
56204
|
import_node_path3 = require("path");
|
|
56156
56205
|
init_src();
|
|
@@ -56205,12 +56254,12 @@ async function skillsSuggestCommand(file2, options) {
|
|
|
56205
56254
|
async function skillsListCommand() {
|
|
56206
56255
|
output2(await orgAuthenticatedFetch("/v1/learned-skills"), ({ skills: skills2, suggestions }) => {
|
|
56207
56256
|
for (const skill of skills2) console.log(`${skill.id} ${skill.name} ${skill.title}`);
|
|
56208
|
-
if (suggestions.length > 0) console.log(
|
|
56257
|
+
if (suggestions.length > 0) console.log(import_chalk31.default.gray(`${suggestions.length} pending suggestion(s) to review in the dashboard.`));
|
|
56209
56258
|
});
|
|
56210
56259
|
}
|
|
56211
56260
|
async function skillsCreateCommand(file2, options) {
|
|
56212
56261
|
const body = { content: (0, import_node_fs4.readFileSync)(file2, "utf-8"), title: options.title };
|
|
56213
|
-
output2(await orgAuthenticatedFetch("/v1/learned-skills", { method: "POST", body }), ({ id, name }) => console.log(
|
|
56262
|
+
output2(await orgAuthenticatedFetch("/v1/learned-skills", { method: "POST", body }), ({ id, name }) => console.log(import_chalk31.default.green(`Saved learning '${name}' (${id})`)));
|
|
56214
56263
|
}
|
|
56215
56264
|
async function skillsUpdateCommand(id, options) {
|
|
56216
56265
|
const { skills: skills2 } = await orgAuthenticatedFetch("/v1/learned-skills");
|
|
@@ -56220,18 +56269,18 @@ async function skillsUpdateCommand(id, options) {
|
|
|
56220
56269
|
title: options.title ?? existing.title,
|
|
56221
56270
|
content: options.file ? (0, import_node_fs4.readFileSync)(options.file, "utf-8") : existing.content
|
|
56222
56271
|
};
|
|
56223
|
-
output2(await orgAuthenticatedFetch(`/v1/learned-skills/${existing.id}`, { method: "PUT", body }), ({ name }) => console.log(
|
|
56272
|
+
output2(await orgAuthenticatedFetch(`/v1/learned-skills/${existing.id}`, { method: "PUT", body }), ({ name }) => console.log(import_chalk31.default.green(`Updated learning '${name}'`)));
|
|
56224
56273
|
}
|
|
56225
56274
|
async function skillsDeleteCommand(id) {
|
|
56226
56275
|
await orgAuthenticatedFetch(`/v1/learned-skills/${id}`, { method: "DELETE" });
|
|
56227
56276
|
outputSuccess(`Deleted learning ${id}`);
|
|
56228
56277
|
}
|
|
56229
|
-
var import_node_fs4,
|
|
56278
|
+
var import_node_fs4, import_chalk31;
|
|
56230
56279
|
var init_skills = __esm({
|
|
56231
56280
|
"src/commands/skills.ts"() {
|
|
56232
56281
|
"use strict";
|
|
56233
56282
|
import_node_fs4 = require("fs");
|
|
56234
|
-
|
|
56283
|
+
import_chalk31 = __toESM(require("chalk"));
|
|
56235
56284
|
init_agent_api();
|
|
56236
56285
|
init_api2();
|
|
56237
56286
|
init_monolith_url();
|
|
@@ -56257,10 +56306,10 @@ async function attachThread(request) {
|
|
|
56257
56306
|
body: request
|
|
56258
56307
|
});
|
|
56259
56308
|
output2(response, ({ thread, workspace }) => {
|
|
56260
|
-
console.log(
|
|
56261
|
-
console.log(
|
|
56262
|
-
console.log(
|
|
56263
|
-
console.log(
|
|
56309
|
+
console.log(import_chalk32.default.green("Slack thread attached."));
|
|
56310
|
+
console.log(import_chalk32.default.gray(` Channel: ${thread.channel_id}`));
|
|
56311
|
+
console.log(import_chalk32.default.gray(` Thread: ${thread.thread_ts}`));
|
|
56312
|
+
console.log(import_chalk32.default.gray(` Workspace: ${workspace.name} (${workspace.id})`));
|
|
56264
56313
|
});
|
|
56265
56314
|
}
|
|
56266
56315
|
async function slackThreadAttachCommand(options) {
|
|
@@ -56288,11 +56337,11 @@ async function slackThreadSwitchCommand(workspace, options) {
|
|
|
56288
56337
|
workspace_id: workspaceId
|
|
56289
56338
|
});
|
|
56290
56339
|
}
|
|
56291
|
-
var
|
|
56340
|
+
var import_chalk32;
|
|
56292
56341
|
var init_slack4 = __esm({
|
|
56293
56342
|
"src/commands/slack.ts"() {
|
|
56294
56343
|
"use strict";
|
|
56295
|
-
|
|
56344
|
+
import_chalk32 = __toESM(require("chalk"));
|
|
56296
56345
|
init_api2();
|
|
56297
56346
|
init_config();
|
|
56298
56347
|
init_output();
|
|
@@ -56447,7 +56496,7 @@ async function serviceListCommand() {
|
|
|
56447
56496
|
return;
|
|
56448
56497
|
}
|
|
56449
56498
|
for (const service of services) {
|
|
56450
|
-
const status = service.running ?
|
|
56499
|
+
const status = service.running ? import_chalk33.default.green("running") : import_chalk33.default.red("stopped");
|
|
56451
56500
|
console.log(`${service.name} ${status} pid ${service.pid} started ${service.startedAt}`);
|
|
56452
56501
|
console.log(` command: ${service.command} (cwd: ${service.cwd})`);
|
|
56453
56502
|
console.log(` logs: ${service.logFile}`);
|
|
@@ -56467,11 +56516,11 @@ async function serviceLogsCommand(name, options) {
|
|
|
56467
56516
|
console.log(logs || "(no log output yet)");
|
|
56468
56517
|
});
|
|
56469
56518
|
}
|
|
56470
|
-
var
|
|
56519
|
+
var import_chalk33, import_node_child_process3, import_node_fs5, import_node_os3, import_node_path5, SERVICES_DIR, NAME_PATTERN, LOG_KEEP_BYTES, LOG_TRIM_LOOP;
|
|
56471
56520
|
var init_service = __esm({
|
|
56472
56521
|
"src/commands/service.ts"() {
|
|
56473
56522
|
"use strict";
|
|
56474
|
-
|
|
56523
|
+
import_chalk33 = __toESM(require("chalk"));
|
|
56475
56524
|
import_node_child_process3 = require("child_process");
|
|
56476
56525
|
import_node_fs5 = require("fs");
|
|
56477
56526
|
import_node_os3 = require("os");
|
|
@@ -56528,7 +56577,7 @@ async function deviceConnectCommand() {
|
|
|
56528
56577
|
stream.destroy();
|
|
56529
56578
|
};
|
|
56530
56579
|
sshd.once("error", (error62) => {
|
|
56531
|
-
console.log(
|
|
56580
|
+
console.log(import_chalk34.default.yellow(`A workspace couldn't reach SSH on port ${port} here (${error62.message}). ${REMOTE_LOGIN_HINT}`));
|
|
56532
56581
|
});
|
|
56533
56582
|
sshd.on("error", close).on("close", close);
|
|
56534
56583
|
stream.on("error", close).on("close", close);
|
|
@@ -56572,16 +56621,16 @@ async function deviceConnectCommand() {
|
|
|
56572
56621
|
}
|
|
56573
56622
|
}
|
|
56574
56623
|
const next = problem ?? `\u2713 ${device?.name}: ready for ${waiting.size} ${waiting.size === 1 ? "workspace" : "workspaces"}, forwarding to SSH on port ${port}`;
|
|
56575
|
-
if (next !== summary) console.log(problem ?
|
|
56624
|
+
if (next !== summary) console.log(problem ? import_chalk34.default.yellow(next) : import_chalk34.default.green(next));
|
|
56576
56625
|
summary = next;
|
|
56577
56626
|
await (0, import_promises3.setTimeout)(POLL_INTERVAL_MS);
|
|
56578
56627
|
}
|
|
56579
56628
|
}
|
|
56580
|
-
var
|
|
56629
|
+
var import_chalk34, import_node_child_process4, import_node_net, import_promises3, import_node_util, import_ws, POLL_INTERVAL_MS, HEARTBEAT_MS, MAX_RETRY_DELAY_MS, REMOTE_LOGIN_HINT;
|
|
56581
56630
|
var init_device = __esm({
|
|
56582
56631
|
"src/commands/device.ts"() {
|
|
56583
56632
|
"use strict";
|
|
56584
|
-
|
|
56633
|
+
import_chalk34 = __toESM(require("chalk"));
|
|
56585
56634
|
import_node_child_process4 = require("child_process");
|
|
56586
56635
|
import_node_net = require("net");
|
|
56587
56636
|
import_promises3 = require("timers/promises");
|
|
@@ -56639,8 +56688,8 @@ async function localControlRequestCommand(options) {
|
|
|
56639
56688
|
await orgAuthenticatedFetch("/v1/local-control-request", { method: "DELETE" });
|
|
56640
56689
|
output2({ status: "connected", computers: computers2 }, () => {
|
|
56641
56690
|
console.log(`
|
|
56642
|
-
${
|
|
56643
|
-
console.log(
|
|
56691
|
+
${import_chalk35.default.green("Connected:")} ${computers2.join(", ")}`);
|
|
56692
|
+
console.log(import_chalk35.default.gray(` Run commands there with: ssh ${computers2[0]} '<command>'
|
|
56644
56693
|
`));
|
|
56645
56694
|
});
|
|
56646
56695
|
};
|
|
@@ -56668,10 +56717,10 @@ async function localControlRequestCommand(options) {
|
|
|
56668
56717
|
}
|
|
56669
56718
|
output2({ status: pending ? "pending" : "declined", computers: [], url: created.url }, () => {
|
|
56670
56719
|
if (!pending) {
|
|
56671
|
-
console.log(
|
|
56720
|
+
console.log(import_chalk35.default.yellow("\n The user declined. Continue without their computer, or ask how they want to proceed.\n"));
|
|
56672
56721
|
return;
|
|
56673
56722
|
}
|
|
56674
|
-
console.log(
|
|
56723
|
+
console.log(import_chalk35.default.gray(options.wait === false ? `
|
|
56675
56724
|
Asked above the chat composer (${created.url}). Keep working, and run this command again when you need the computer.
|
|
56676
56725
|
` : created.wait ? `
|
|
56677
56726
|
The request stays open above the chat composer (${created.url}). End your turn and say what you need the computer for. When the user answers, you get a message; run this command again then.
|
|
@@ -56681,7 +56730,7 @@ async function localControlRequestCommand(options) {
|
|
|
56681
56730
|
`));
|
|
56682
56731
|
});
|
|
56683
56732
|
}
|
|
56684
|
-
var import_child_process6, import_fs11, import_os5, import_path10, import_util10,
|
|
56733
|
+
var import_child_process6, import_fs11, import_os5, import_path10, import_util10, import_chalk35, execFileAsync2;
|
|
56685
56734
|
var init_local_control = __esm({
|
|
56686
56735
|
"src/commands/local-control.ts"() {
|
|
56687
56736
|
"use strict";
|
|
@@ -56690,7 +56739,7 @@ var init_local_control = __esm({
|
|
|
56690
56739
|
import_os5 = __toESM(require("os"));
|
|
56691
56740
|
import_path10 = __toESM(require("path"));
|
|
56692
56741
|
import_util10 = require("util");
|
|
56693
|
-
|
|
56742
|
+
import_chalk35 = __toESM(require("chalk"));
|
|
56694
56743
|
init_src();
|
|
56695
56744
|
init_api2();
|
|
56696
56745
|
init_command_utils();
|
|
@@ -56732,7 +56781,7 @@ function registerEnvironmentHookCommands(parent, config3) {
|
|
|
56732
56781
|
}
|
|
56733
56782
|
hooks.command("repository-hooks <env>").description(`List per-repo ${config3.kind} hooks defined in replicas.json / replicas.yaml`).action(run(config3.repositoryHooks));
|
|
56734
56783
|
}
|
|
56735
|
-
var import_config20, import_commander, collect, program, organizationOptionalCommands, interactiveCommands, org, config2, chat, chatQueue, share, pr, canvas, credentials, automation, repos, plugins, skills, media, environment, envConfig, envVars, envFiles, envSkills, envMcps, parsePortOption, envDevices, envWarmPool, preview, authenticatedPreviewHelp;
|
|
56784
|
+
var import_config20, import_commander, collect, program, organizationOptionalCommands, interactiveCommands, billing, org, config2, chat, chatQueue, share, pr, canvas, credentials, automation, repos, plugins, skills, media, environment, envConfig, envVars, envFiles, envSkills, envMcps, parsePortOption, envDevices, envWarmPool, preview, authenticatedPreviewHelp;
|
|
56736
56785
|
var init_src2 = __esm({
|
|
56737
56786
|
"src/index.ts"() {
|
|
56738
56787
|
"use strict";
|
|
@@ -56741,6 +56790,7 @@ var init_src2 = __esm({
|
|
|
56741
56790
|
init_login3();
|
|
56742
56791
|
init_logout();
|
|
56743
56792
|
init_whoami();
|
|
56793
|
+
init_billing2();
|
|
56744
56794
|
init_identity();
|
|
56745
56795
|
init_connect();
|
|
56746
56796
|
init_code();
|
|
@@ -56830,6 +56880,9 @@ var init_src2 = __esm({
|
|
|
56830
56880
|
program.command("whoami").description("Display current authenticated user").action(run(whoamiCommand));
|
|
56831
56881
|
program.command("codex-auth").description("Connect your Codex credentials to Replicas (personal by default)").option("-u, --user", "Store credentials for your personal account (default)").option("-o, --org", "Share credentials with the whole organization (admins only)").option("-y, --yes", "Skip the destination confirmation prompt").action(run(codexAuthCommand));
|
|
56832
56882
|
program.command("claude-auth").description("Connect your Claude Code credentials to Replicas (personal by default)").option("-u, --user", "Store credentials for your personal account (default)").option("-o, --org", "Share credentials with the whole organization (admins only)").option("-y, --yes", "Skip the destination confirmation prompt").action(run(claudeAuthCommand));
|
|
56883
|
+
billing = program.command("billing").description("Show the organization's balance and the limit new workspaces are checked against");
|
|
56884
|
+
billing.command("usage").description("Show usage cost by day and source for the current period (admins only)").option("-b, --bucket <bucket>", "day, week, or month").option("--start <date>", "Start date (ISO 8601)").option("--end <date>", "End date (ISO 8601)").action(run(billingUsageCommand));
|
|
56885
|
+
billing.action(run(billingCommand));
|
|
56833
56886
|
org = program.command("org").description("Manage organizations");
|
|
56834
56887
|
org.command("switch").description("Switch to a different organization").action(run(orgSwitchCommand));
|
|
56835
56888
|
org.command("members").description("List organization members and their user IDs").action(run(orgMembersCommand));
|
|
@@ -57097,7 +57150,8 @@ ${VISUAL_PAGE_RULES}`).action(run(visualizeCommand));
|
|
|
57097
57150
|
"share",
|
|
57098
57151
|
"pr",
|
|
57099
57152
|
"canvas",
|
|
57100
|
-
"plugins"
|
|
57153
|
+
"plugins",
|
|
57154
|
+
"billing"
|
|
57101
57155
|
]);
|
|
57102
57156
|
const kept = program.commands.filter((cmd) => allowed.has(cmd.name()));
|
|
57103
57157
|
const cmds = program.commands;
|
|
@@ -57111,11 +57165,11 @@ ${VISUAL_PAGE_RULES}`).action(run(visualizeCommand));
|
|
|
57111
57165
|
|
|
57112
57166
|
// src/bin.ts
|
|
57113
57167
|
var import_node_child_process5 = require("child_process");
|
|
57114
|
-
var
|
|
57168
|
+
var import_chalk36 = __toESM(require("chalk"));
|
|
57115
57169
|
init_config();
|
|
57116
57170
|
if (process.argv[2] === "computer" && isAgentMode()) {
|
|
57117
57171
|
const result = (0, import_node_child_process5.spawnSync)("replicas-computer", process.argv.slice(3), { stdio: "inherit" });
|
|
57118
|
-
if (result.error) console.error(
|
|
57172
|
+
if (result.error) console.error(import_chalk36.default.red(`
|
|
57119
57173
|
\u2717 replicas-computer is unavailable in this workspace image
|
|
57120
57174
|
`));
|
|
57121
57175
|
process.exitCode = result.error ? 1 : result.status ?? 1;
|