replicas-cli 0.3.567 → 0.3.568

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.cjs +60 -7
  2. package/package.json +1 -1
package/dist/index.cjs CHANGED
@@ -23539,6 +23539,9 @@ var init_environment_setups = __esm({
23539
23539
  });
23540
23540
 
23541
23541
  // ../shared/src/routes/environment.ts
23542
+ function isEnvironmentSetupSourceMode(value) {
23543
+ return ENVIRONMENT_SETUP_SOURCE_MODES.some((mode) => mode === value);
23544
+ }
23542
23545
  function validateEnvironmentMcpAuthentication(transport, config3) {
23543
23546
  if (!config3.auth) return createSuccessResult();
23544
23547
  const url2 = new URL(config3.url);
@@ -23557,7 +23560,7 @@ function validateEnvironmentMcpAuthentication(transport, config3) {
23557
23560
  function isReservedMcpName(name) {
23558
23561
  return RESERVED_MCP_NAME_PREFIXES.some((prefix) => name.startsWith(prefix));
23559
23562
  }
23560
- var ENVIRONMENT_MCP_TRANSPORTS, MCP_NAME_PATTERN, environmentMcpVariableReferenceSchema, getMcpProxyDroppedHeader, stringMap, environmentMcpStdioConfigSchema, environmentMcpHttpConfigSchema, createEnvironmentMcpRequestSchema, updateEnvironmentMcpRequestSchema, RESERVED_MCP_NAME_PREFIXES, screenPasswordSchema, hostSchema, createEnvironmentDeviceRequestSchema, updateEnvironmentDeviceRequestSchema, DEVICE_ONLINE_WINDOW_MS, isDeviceOnline, deviceConnectionResponseSchema, deviceHostKeysRequestSchema, DEVICE_CONNECT_COMMAND, provisionedDeviceSchema;
23563
+ var ENVIRONMENT_SETUP_SOURCE_MODES, ENVIRONMENT_MCP_TRANSPORTS, MCP_NAME_PATTERN, environmentMcpVariableReferenceSchema, getMcpProxyDroppedHeader, stringMap, environmentMcpStdioConfigSchema, environmentMcpHttpConfigSchema, createEnvironmentMcpRequestSchema, updateEnvironmentMcpRequestSchema, RESERVED_MCP_NAME_PREFIXES, screenPasswordSchema, hostSchema, createEnvironmentDeviceRequestSchema, updateEnvironmentDeviceRequestSchema, DEVICE_ONLINE_WINDOW_MS, isDeviceOnline, deviceConnectionResponseSchema, deviceHostKeysRequestSchema, DEVICE_CONNECT_COMMAND, provisionedDeviceSchema;
23561
23564
  var init_environment = __esm({
23562
23565
  "../shared/src/routes/environment.ts"() {
23563
23566
  "use strict";
@@ -23567,6 +23570,7 @@ var init_environment = __esm({
23567
23570
  init_environment_setups();
23568
23571
  init_result();
23569
23572
  init_urls();
23573
+ ENVIRONMENT_SETUP_SOURCE_MODES = ["app_and_repo", "repo_only", "app_only"];
23570
23574
  ENVIRONMENT_MCP_TRANSPORTS = ["stdio", "http", "sse"];
23571
23575
  MCP_NAME_PATTERN = /^[A-Za-z0-9][A-Za-z0-9_-]{0,63}$/;
23572
23576
  environmentMcpVariableReferenceSchema = external_exports.strictObject({
@@ -27511,6 +27515,7 @@ var init_environment_config = __esm({
27511
27515
  memory: external_exports.strictObject({ read: external_exports.boolean().optional(), write: external_exports.boolean().optional() }).nullable().optional(),
27512
27516
  gpu: external_exports.boolean().nullable().optional(),
27513
27517
  mobileTesting: external_exports.boolean().nullable().optional(),
27518
+ setupSourceMode: external_exports.enum(ENVIRONMENT_SETUP_SOURCE_MODES).nullable().optional(),
27514
27519
  defaultSkills: defaultSkillsOverridesSchema.superRefine((skills2, context) => {
27515
27520
  for (const ability of REPLICAS_AGENT_ABILITIES) if (skills2.replicas_agent?.abilities?.[ability] === false && REPLICAS_AGENT_ABILITY_REGISTRY[ability].locked) context.addIssue({ code: "custom", path: ["replicas_agent", "abilities", ability], message: "This built-in ability cannot be disabled" });
27516
27521
  }).nullable().optional(),
@@ -27556,7 +27561,7 @@ var init_environment_config_source = __esm({
27556
27561
  "use strict";
27557
27562
  init_zod();
27558
27563
  init_environment_config();
27559
- ENVIRONMENT_CONFIG_PREFERENCES = [["memory", "memory"], ["gpu", "gpu"], ["mobileTesting", "mobile_testing"], ["defaultSkills", "default_skills"]];
27564
+ ENVIRONMENT_CONFIG_PREFERENCES = [["memory", "memory"], ["gpu", "gpu"], ["mobileTesting", "mobile_testing"], ["defaultSkills", "default_skills"], ["setupSourceMode", "setup_source_mode"]];
27560
27565
  ENVIRONMENT_CONFIG_SETTING_FIELDS = ["repositories", "workspaceSize", "inheritRepositories", ...ENVIRONMENT_CONFIG_PREFERENCES.map(([field2]) => field2)];
27561
27566
  environmentConfigLocationSchema = external_exports.union([
27562
27567
  external_exports.object({
@@ -28282,6 +28287,32 @@ var init_constants = __esm({
28282
28287
  });
28283
28288
 
28284
28289
  // ../shared/src/user-message-parser/chat-fork.ts
28290
+ function readChatForkEnvelope(content) {
28291
+ if (!content.startsWith(OPEN_MARKER)) return null;
28292
+ const metaEnd = content.indexOf(OPEN_MARKER_END, OPEN_MARKER.length);
28293
+ if (metaEnd === -1) return null;
28294
+ let meta3;
28295
+ try {
28296
+ meta3 = JSON.parse(content.slice(OPEN_MARKER.length, metaEnd));
28297
+ } catch {
28298
+ return null;
28299
+ }
28300
+ if (!isRecord(meta3)) return null;
28301
+ const closeIndex = content.lastIndexOf(CLOSE_MARKER);
28302
+ const closed = closeIndex > metaEnd;
28303
+ return {
28304
+ meta: meta3,
28305
+ closed,
28306
+ inner: content.slice(metaEnd + OPEN_MARKER_END.length, closed ? closeIndex : void 0).trim(),
28307
+ replyText: closed ? content.slice(closeIndex + CLOSE_MARKER.length).trim() : ""
28308
+ };
28309
+ }
28310
+ function threadHandoffText(content) {
28311
+ const envelope = readChatForkEnvelope(content);
28312
+ if (!envelope?.closed) return null;
28313
+ return envelope.meta.trigger === "auto" ? "" : envelope.replyText;
28314
+ }
28315
+ var OPEN_MARKER, OPEN_MARKER_END, CLOSE_MARKER;
28285
28316
  var init_chat_fork2 = __esm({
28286
28317
  "../shared/src/user-message-parser/chat-fork.ts"() {
28287
28318
  "use strict";
@@ -28289,6 +28320,9 @@ var init_chat_fork2 = __esm({
28289
28320
  init_agent_quota();
28290
28321
  init_chat_fork();
28291
28322
  init_type_guards();
28323
+ OPEN_MARKER = "<!-- replicas:chat-fork ";
28324
+ OPEN_MARKER_END = " -->";
28325
+ CLOSE_MARKER = "<!-- /replicas:chat-fork -->";
28292
28326
  }
28293
28327
  });
28294
28328
 
@@ -39561,7 +39595,7 @@ function filterDisplayMessages(messages, provider2) {
39561
39595
  }
39562
39596
  const cleaned = withoutAttachmentPlaceholder(content, Boolean(msg.images?.length || files.length));
39563
39597
  if (cleaned.length === 0 && !msg.images?.length && files.length === 0 && walkthroughs.length === 0 && appshots.length === 0 && annotations.length === 0) return [];
39564
- const origin = msg.cancelled ? null : parseMessageOrigin(msg.content);
39598
+ const origin = msg.cancelled ? null : parseMessageOrigin(threadHandoffText(msg.content) || msg.content);
39565
39599
  if (cleaned === msg.content && !origin && files.length === 0 && walkthroughs.length === 0 && appshots.length === 0 && annotations.length === 0) return [msg];
39566
39600
  return [{
39567
39601
  ...msg,
@@ -39584,6 +39618,7 @@ var init_parsers = __esm({
39584
39618
  init_manager_events();
39585
39619
  init_prompts();
39586
39620
  init_message_origin();
39621
+ init_chat_fork2();
39587
39622
  init_user_message_attachments();
39588
39623
  init_agent_event_utils();
39589
39624
  init_constants();
@@ -40710,7 +40745,7 @@ var CLI_VERSION;
40710
40745
  var init_cli_version = __esm({
40711
40746
  "../shared/src/cli-version.ts"() {
40712
40747
  "use strict";
40713
- CLI_VERSION = "0.3.567";
40748
+ CLI_VERSION = "0.3.568";
40714
40749
  }
40715
40750
  });
40716
40751
 
@@ -51393,12 +51428,24 @@ var init_x_leaderboard = __esm({
51393
51428
  });
51394
51429
 
51395
51430
  // ../shared/src/routes/environment-hook-runs.ts
51396
- var ENVIRONMENT_HOOK_RUN_LOG_LIMIT, ENVIRONMENT_HOOK_RUN_TAIL_LIMIT;
51431
+ var ENVIRONMENT_HOOK_RUN_LOG_LIMIT, ENVIRONMENT_HOOK_RUN_TAIL_LIMIT, environmentHookRunStepsSchema;
51397
51432
  var init_environment_hook_runs = __esm({
51398
51433
  "../shared/src/routes/environment-hook-runs.ts"() {
51399
51434
  "use strict";
51435
+ init_zod();
51400
51436
  ENVIRONMENT_HOOK_RUN_LOG_LIMIT = 5 * 1024 * 1024;
51401
51437
  ENVIRONMENT_HOOK_RUN_TAIL_LIMIT = 8 * 1024;
51438
+ environmentHookRunStepsSchema = external_exports.array(external_exports.object({
51439
+ repository: external_exports.string().max(255).nullable(),
51440
+ status: external_exports.enum(["succeeded", "failed", "skipped"])
51441
+ })).max(1024);
51442
+ }
51443
+ });
51444
+
51445
+ // ../shared/src/routes/environment-setup-steps.ts
51446
+ var init_environment_setup_steps = __esm({
51447
+ "../shared/src/routes/environment-setup-steps.ts"() {
51448
+ "use strict";
51402
51449
  }
51403
51450
  });
51404
51451
 
@@ -51899,6 +51946,7 @@ var init_src = __esm({
51899
51946
  init_x_leaderboard();
51900
51947
  init_environment();
51901
51948
  init_environment_hook_runs();
51949
+ init_environment_setup_steps();
51902
51950
  init_messages();
51903
51951
  init_mobile_testing();
51904
51952
  init_compute();
@@ -54482,6 +54530,7 @@ function printEnvironment(env, repoSkillCount) {
54482
54530
  if (repositoryIds.length > 0) {
54483
54531
  console.log(import_chalk21.default.gray(` Repositories: ${repositoryIds.join(", ")}`));
54484
54532
  }
54533
+ console.log(import_chalk21.default.gray(` Setup source: ${env.setup_source_mode}`));
54485
54534
  if (env.variable_count !== void 0) {
54486
54535
  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}`));
54487
54536
  }
@@ -54576,6 +54625,10 @@ async function environmentEditCommand(idOrName, options) {
54576
54625
  ensureOrgApiAuthenticated();
54577
54626
  const id = await resolveEnvironmentId(idOrName);
54578
54627
  const body2 = {};
54628
+ if (options.setupSourceMode !== void 0) {
54629
+ if (!isEnvironmentSetupSourceMode(options.setupSourceMode)) throw new Error(`--setup-source-mode must be one of ${ENVIRONMENT_SETUP_SOURCE_MODES.join(", ")}.`);
54630
+ body2.setup_source_mode = options.setupSourceMode;
54631
+ }
54579
54632
  if (options.name !== void 0) body2.name = options.name;
54580
54633
  if (options.description !== void 0) body2.description = options.description;
54581
54634
  if (options.systemPrompt !== void 0) body2.system_prompt = options.systemPrompt;
@@ -54583,7 +54636,7 @@ async function environmentEditCommand(idOrName, options) {
54583
54636
  body2.repository_ids = options.repository === "" || options.repository === "null" ? [] : await resolveRepositoryIds(splitList(options.repository));
54584
54637
  }
54585
54638
  if (Object.keys(body2).length === 0) {
54586
- throw new Error("No changes specified. Pass --name, --description, --repository, or --system-prompt.");
54639
+ throw new Error("No changes specified. Pass --name, --description, --repository, --system-prompt, or --setup-source-mode.");
54587
54640
  }
54588
54641
  const response = await orgAuthenticatedFetch(`/v1/environments/${id}`, {
54589
54642
  method: "PATCH",
@@ -59094,7 +59147,7 @@ var init_src2 = __esm({
59094
59147
  environment.command("list").description("List all environments").action(run(environmentListCommand));
59095
59148
  environment.command("get <id-or-name>").description("Get an environment by ID or name").action(run(environmentGetCommand));
59096
59149
  environment.command("create [name]").description("Create a new environment").option("-d, --description <description>", "Environment description").option("-r, --repository <names>", "Repositories to clone (comma-separated names or IDs)").option("--system-prompt <prompt>", "System prompt for agents started in this environment").action(run(environmentCreateCommand));
59097
- environment.command("edit <id-or-name>").description("Edit an environment").option("-n, --name <name>", "New name").option("-d, --description <description>", "New description").option("-r, --repository <names>", "Replace the repositories (comma-separated names or IDs; empty string for none)").option("--system-prompt <prompt>", "System prompt").action(run(environmentEditCommand));
59150
+ environment.command("edit <id-or-name>").description("Edit an environment").option("-n, --name <name>", "New name").option("-d, --description <description>", "New description").option("-r, --repository <names>", "Replace the repositories (comma-separated names or IDs; empty string for none)").option("--system-prompt <prompt>", "System prompt").option("--setup-source-mode <mode>", "Which hooks run: app_and_repo, repo_only (app hooks locked), or app_only (replicas.json hooks ignored)").action(run(environmentEditCommand));
59098
59151
  environment.command("delete <id-or-name>").description("Delete an environment").option("-f, --force", "Skip confirmation prompt").action(run(environmentDeleteCommand));
59099
59152
  envConfig = environment.command("config").description("Link and sync environment configuration from Git");
59100
59153
  envConfig.command("get <env>").description("Show the linked configuration source and sync status").action(run(environmentConfigGetCommand));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "replicas-cli",
3
- "version": "0.3.567",
3
+ "version": "0.3.568",
4
4
  "description": "CLI for managing Replicas workspaces - SSH into cloud dev environments with automatic port forwarding",
5
5
  "main": "dist/index.cjs",
6
6
  "bin": {