replicas-cli 0.2.325 → 0.2.327

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.
Files changed (2) hide show
  1. package/dist/index.mjs +36 -12
  2. package/package.json +1 -1
package/dist/index.mjs CHANGED
@@ -9308,6 +9308,7 @@ replicas automation create ... --disabled
9308
9308
 
9309
9309
  # Workspace lifecycle
9310
9310
  replicas automation create ... --lifecycle delete_when_done
9311
+ replicas automation create ... --lifecycle sleep_when_done
9311
9312
  replicas automation create ... --lifecycle delete_after_inactivity --auto-stop-minutes 30
9312
9313
  \`\`\`
9313
9314
 
@@ -9536,7 +9537,7 @@ var HOOK_EXEC_MAX_BUFFER_BYTES = 10 * 1024 * 1024;
9536
9537
  var REPLICAS_CONFIG_FILENAMES = ["replicas.json", "replicas.yaml", "replicas.yml"];
9537
9538
 
9538
9539
  // ../shared/src/cli-version.ts
9539
- var CLI_VERSION = "0.2.325";
9540
+ var CLI_VERSION = "0.2.327";
9540
9541
 
9541
9542
  // ../shared/src/engine/environment.ts
9542
9543
  var DESKTOP_NOVNC_PORT = 6080;
@@ -9561,7 +9562,7 @@ var WORKSPACE_STATUSES = ["active", "sleeping", "archived", "preparing", "error"
9561
9562
  function isWorkspaceSuspendedStatus(status) {
9562
9563
  return status === "sleeping" || status === "archived";
9563
9564
  }
9564
- var VALID_LIFECYCLE_POLICIES = ["default", "delete_when_done", "delete_after_inactivity"];
9565
+ var VALID_LIFECYCLE_POLICIES = ["default", "delete_when_done", "sleep_when_done", "delete_after_inactivity"];
9565
9566
  function workspaceConfigWithCapabilities(config2, capabilities = {}) {
9566
9567
  const mergedCapabilities = {
9567
9568
  ...config2?.capabilities,
@@ -9582,6 +9583,20 @@ var WORKSPACE_FILE_UPLOAD_MAX_SIZE_BYTES = 20 * 1024 * 1024;
9582
9583
  var WORKSPACE_FILE_CONTENT_MAX_SIZE_BYTES = 1 * 1024 * 1024;
9583
9584
  var WORKSPACE_SIDEBAR_VIEWS = ["owned", "shared", "team", "automated"];
9584
9585
  var WORKSPACE_STATUS_FILTERS = WORKSPACE_STATUSES.map((status) => status === "error" ? "failed" : status);
9586
+ var WORKSPACE_SORT_CHOICES = [
9587
+ ["activity", "Last activity"],
9588
+ ["created", "Created date"],
9589
+ ["status", "Status"]
9590
+ ];
9591
+ var WORKSPACE_SORT_OPTIONS = WORKSPACE_SORT_CHOICES.map(([option]) => option);
9592
+ var WORKSPACE_SORT_LABELS = Object.fromEntries(WORKSPACE_SORT_CHOICES);
9593
+ var WORKSPACE_SIDEBAR_ORGANIZATION_CHOICES = [
9594
+ ["chronological", "Chronological"],
9595
+ ["environments", "Environments"],
9596
+ ["recent", "Recent environments"]
9597
+ ];
9598
+ var WORKSPACE_SIDEBAR_ORGANIZATIONS = WORKSPACE_SIDEBAR_ORGANIZATION_CHOICES.map(([organization]) => organization);
9599
+ var WORKSPACE_SIDEBAR_ORGANIZATION_LABELS = Object.fromEntries(WORKSPACE_SIDEBAR_ORGANIZATION_CHOICES);
9585
9600
  var DEFAULT_STATUS_FILTERS = [...WORKSPACE_STATUS_FILTERS];
9586
9601
  var DEFAULT_WORKSPACE_FILTERS = {
9587
9602
  statuses: [...DEFAULT_STATUS_FILTERS],
@@ -9602,6 +9617,9 @@ var AUDIT_LOG_ACTIONS = Object.values(AUDIT_LOG_ACTION);
9602
9617
 
9603
9618
  // ../shared/src/automations/types.ts
9604
9619
  var AUTOMATION_DEBOUNCE_MAX_SECONDS = 24 * 60 * 60;
9620
+ function lifecyclePolicySupportsAutoStop(policy) {
9621
+ return policy === "default" || policy === "delete_after_inactivity";
9622
+ }
9605
9623
 
9606
9624
  // ../shared/src/automations/agent-validation.ts
9607
9625
  function validateAgentSelection(body, existing) {
@@ -11112,13 +11130,14 @@ function parseDisplayMessages(events, agentType, codexAspTranscript, options = {
11112
11130
  function isCodexInitializationPrompt(message) {
11113
11131
  return message.type === "user" && removeReplicasInstructions(message.content).trim() === "Hello";
11114
11132
  }
11115
- function createUserMessage(content) {
11133
+ function createUserMessage(content, images) {
11116
11134
  const timestamp = (/* @__PURE__ */ new Date()).toISOString();
11117
11135
  return {
11118
11136
  message: {
11119
11137
  id: `user-${Date.now()}`,
11120
11138
  type: "user",
11121
11139
  content,
11140
+ images,
11122
11141
  timestamp
11123
11142
  },
11124
11143
  timestamp
@@ -13835,8 +13854,8 @@ async function promptForTriggers(repositories) {
13835
13854
  async function automationCreateCommand(name, options) {
13836
13855
  ensureOrgApiAuthenticated();
13837
13856
  const lifecyclePolicy = parseWorkspaceLifecyclePolicyOption(options.lifecycle);
13838
- if (options.autoStopMinutes && lifecyclePolicy !== "delete_after_inactivity") {
13839
- console.log(chalk18.red("--auto-stop-minutes requires --lifecycle delete_after_inactivity"));
13857
+ if (options.autoStopMinutes && !lifecyclePolicySupportsAutoStop(lifecyclePolicy ?? "default")) {
13858
+ console.log(chalk18.red("--auto-stop-minutes requires --lifecycle default or delete_after_inactivity"));
13840
13859
  process.exit(1);
13841
13860
  }
13842
13861
  if (options.autoStopMinutes) {
@@ -13999,10 +14018,6 @@ Created automation: ${automation2.name}`));
13999
14018
  async function automationEditCommand(id, options) {
14000
14019
  ensureOrgApiAuthenticated();
14001
14020
  const lifecyclePolicy = parseWorkspaceLifecyclePolicyOption(options.lifecycle);
14002
- if (options.autoStopMinutes && lifecyclePolicy !== "delete_after_inactivity") {
14003
- console.log(chalk18.red("--auto-stop-minutes requires --lifecycle delete_after_inactivity"));
14004
- process.exit(1);
14005
- }
14006
14021
  if (options.autoStopMinutes) {
14007
14022
  const minutes = parseInt(options.autoStopMinutes, 10);
14008
14023
  if (isNaN(minutes) || minutes < 3 || minutes > 1440) {
@@ -14017,6 +14032,11 @@ async function automationEditCommand(id, options) {
14017
14032
  };
14018
14033
  try {
14019
14034
  const existing = await orgAuthenticatedFetch(`/v1/automations/${id}`);
14035
+ const autoStopLifecyclePolicy = lifecyclePolicy ?? existing.automation.workspace_lifecycle_policy ?? "default";
14036
+ if (options.autoStopMinutes && !lifecyclePolicySupportsAutoStop(autoStopLifecyclePolicy)) {
14037
+ console.log(chalk18.red("--auto-stop-minutes requires --lifecycle default or delete_after_inactivity"));
14038
+ process.exit(1);
14039
+ }
14020
14040
  const agentSelection = applyAgentSelection(parsedAgent, {
14021
14041
  agentProvider: existing.automation.agent_provider,
14022
14042
  model: existing.automation.model
@@ -14132,7 +14152,7 @@ async function automationEditCommand(id, options) {
14132
14152
  }
14133
14153
  if (lifecyclePolicy) {
14134
14154
  body.workspace_lifecycle_policy = lifecyclePolicy;
14135
- if (lifecyclePolicy !== "delete_after_inactivity") {
14155
+ if (!lifecyclePolicySupportsAutoStop(lifecyclePolicy)) {
14136
14156
  body.workspace_auto_stop_minutes = null;
14137
14157
  }
14138
14158
  }
@@ -19037,6 +19057,10 @@ async function envStartHookSaveCommand(envIdOrName, options) {
19037
19057
  `/v1/environments/${id}/start-hooks/save`,
19038
19058
  { method: "POST", body }
19039
19059
  );
19060
+ if (!response.start_hook) {
19061
+ console.log(chalk22.green("\nCleared start hook.\n"));
19062
+ return;
19063
+ }
19040
19064
  console.log(chalk22.green(`
19041
19065
  Saved start hook v${response.start_hook.version}.
19042
19066
  `));
@@ -19380,7 +19404,7 @@ automation.command("get <id>").description("Get automation details by ID").actio
19380
19404
  process.exit(1);
19381
19405
  }
19382
19406
  });
19383
- automation.command("create [name]").description("Create a new automation").option("-p, --prompt <prompt>", "Prompt for the automation").option("-e, --environment <environment>", "Environment name or ID").option("--trigger-cron <schedule>", 'Cron schedule expression (e.g. "0 9 * * 1-5")').option("--trigger-cron-timezone <timezone>", "Timezone for cron trigger (default: UTC)").option("--trigger-github <event>", 'GitHub event (e.g. "pull_request.opened")').option("--trigger-github-repos <repos>", "Comma-separated repo names to filter GitHub trigger").option("--trigger-gitlab <event>", 'GitLab event (e.g. "merge_request.opened")').option("--trigger-gitlab-repos <repos>", "Comma-separated repo names to filter GitLab trigger").option("--lifecycle <policy>", "Workspace lifecycle: delete_when_done, delete_after_inactivity, default").option("--auto-stop-minutes <minutes>", "Inactivity timeout in minutes (3-1440, requires --lifecycle delete_after_inactivity)").option("--pr-followups", "Allow follow-up actions on matching PRs").option("--agent-provider <provider>", 'Coding agent to use: claude, codex, cursor, relay (or "none" to inherit org default)').option("--model <model>", 'Model identifier (must be valid for --agent-provider; pass "none" to clear)').option("--thinking-level <level>", 'Thinking/reasoning level: low, medium, high, max (or "none" to clear)').option("--plan-mode", "Run automation messages in plan mode").option("--goal-mode", "Set automation messages as Codex goals").option("--fast-mode", "Run automation messages in fast mode").option("--personal", "Create a personal automation owned by the authenticated user").option("--disabled", "Create in disabled state").action(async (name, options) => {
19407
+ automation.command("create [name]").description("Create a new automation").option("-p, --prompt <prompt>", "Prompt for the automation").option("-e, --environment <environment>", "Environment name or ID").option("--trigger-cron <schedule>", 'Cron schedule expression (e.g. "0 9 * * 1-5")').option("--trigger-cron-timezone <timezone>", "Timezone for cron trigger (default: UTC)").option("--trigger-github <event>", 'GitHub event (e.g. "pull_request.opened")').option("--trigger-github-repos <repos>", "Comma-separated repo names to filter GitHub trigger").option("--trigger-gitlab <event>", 'GitLab event (e.g. "merge_request.opened")').option("--trigger-gitlab-repos <repos>", "Comma-separated repo names to filter GitLab trigger").option("--lifecycle <policy>", "Workspace lifecycle: delete_when_done, sleep_when_done, delete_after_inactivity, default").option("--auto-stop-minutes <minutes>", "Inactivity timeout in minutes (3-1440, requires --lifecycle default or delete_after_inactivity)").option("--pr-followups", "Allow follow-up actions on matching PRs").option("--agent-provider <provider>", 'Coding agent to use: claude, codex, cursor, relay (or "none" to inherit org default)').option("--model <model>", 'Model identifier (must be valid for --agent-provider; pass "none" to clear)').option("--thinking-level <level>", 'Thinking/reasoning level: low, medium, high, max (or "none" to clear)').option("--plan-mode", "Run automation messages in plan mode").option("--goal-mode", "Set automation messages as Codex goals").option("--fast-mode", "Run automation messages in fast mode").option("--personal", "Create a personal automation owned by the authenticated user").option("--disabled", "Create in disabled state").action(async (name, options) => {
19384
19408
  try {
19385
19409
  await automationCreateCommand(name, {
19386
19410
  ...options,
@@ -19395,7 +19419,7 @@ automation.command("create [name]").description("Create a new automation").optio
19395
19419
  process.exit(1);
19396
19420
  }
19397
19421
  });
19398
- automation.command("edit <id>").description("Edit an existing automation").option("-n, --name <name>", "New name").option("-p, --prompt <prompt>", "New prompt").option("-e, --enabled <enabled>", "Enable or disable (true/false)").option("--trigger-cron <schedule>", "Set cron schedule (replaces existing triggers)").option("--trigger-cron-timezone <timezone>", "Timezone for cron trigger").option("--trigger-github <event>", "Set GitHub event (replaces existing triggers)").option("--trigger-github-repos <repos>", "Comma-separated repo names to filter GitHub trigger").option("--trigger-gitlab <event>", "Set GitLab event (replaces existing triggers)").option("--trigger-gitlab-repos <repos>", "Comma-separated repo names to filter GitLab trigger").option("--environment <environment>", "Environment name or ID").option("--lifecycle <policy>", "Workspace lifecycle: delete_when_done, delete_after_inactivity, default").option("--auto-stop-minutes <minutes>", "Inactivity timeout in minutes (3-1440, requires --lifecycle delete_after_inactivity)").option("--pr-followups <enabled>", "Allow follow-up actions on matching PRs (true/false)", parseBooleanOption).option("--agent-provider <provider>", 'Coding agent to use: claude, codex, cursor, relay (or "none" to inherit org default)').option("--model <model>", 'Model identifier (must be valid for --agent-provider; pass "none" to clear)').option("--thinking-level <level>", 'Thinking/reasoning level: low, medium, high, max (or "none" to clear)').option("--plan-mode <enabled>", "Run automation messages in plan mode (true/false)", parseBooleanOption).option("--goal-mode <enabled>", "Set automation messages as Codex goals (true/false)", parseBooleanOption).option("--fast-mode <enabled>", "Run automation messages in fast mode (true/false)", parseBooleanOption).action(async (id, options) => {
19422
+ automation.command("edit <id>").description("Edit an existing automation").option("-n, --name <name>", "New name").option("-p, --prompt <prompt>", "New prompt").option("-e, --enabled <enabled>", "Enable or disable (true/false)").option("--trigger-cron <schedule>", "Set cron schedule (replaces existing triggers)").option("--trigger-cron-timezone <timezone>", "Timezone for cron trigger").option("--trigger-github <event>", "Set GitHub event (replaces existing triggers)").option("--trigger-github-repos <repos>", "Comma-separated repo names to filter GitHub trigger").option("--trigger-gitlab <event>", "Set GitLab event (replaces existing triggers)").option("--trigger-gitlab-repos <repos>", "Comma-separated repo names to filter GitLab trigger").option("--environment <environment>", "Environment name or ID").option("--lifecycle <policy>", "Workspace lifecycle: delete_when_done, sleep_when_done, delete_after_inactivity, default").option("--auto-stop-minutes <minutes>", "Inactivity timeout in minutes (3-1440, requires --lifecycle default or delete_after_inactivity)").option("--pr-followups <enabled>", "Allow follow-up actions on matching PRs (true/false)", parseBooleanOption).option("--agent-provider <provider>", 'Coding agent to use: claude, codex, cursor, relay (or "none" to inherit org default)').option("--model <model>", 'Model identifier (must be valid for --agent-provider; pass "none" to clear)').option("--thinking-level <level>", 'Thinking/reasoning level: low, medium, high, max (or "none" to clear)').option("--plan-mode <enabled>", "Run automation messages in plan mode (true/false)", parseBooleanOption).option("--goal-mode <enabled>", "Set automation messages as Codex goals (true/false)", parseBooleanOption).option("--fast-mode <enabled>", "Run automation messages in fast mode (true/false)", parseBooleanOption).action(async (id, options) => {
19399
19423
  try {
19400
19424
  await automationEditCommand(id, options);
19401
19425
  } catch (error) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "replicas-cli",
3
- "version": "0.2.325",
3
+ "version": "0.2.327",
4
4
  "description": "CLI for managing Replicas workspaces - SSH into cloud dev environments with automatic port forwarding",
5
5
  "main": "dist/index.mjs",
6
6
  "bin": {