replicas-engine 0.1.473 → 0.1.475

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/src/index.js +3 -113
  2. package/package.json +1 -1
package/dist/src/index.js CHANGED
@@ -582,7 +582,7 @@ var WORKSPACE_SIZES = ["small", "large"];
582
582
  var INVALID_WORKSPACE_SIZE_ERROR = `Invalid size: must be one of ${WORKSPACE_SIZES.join(", ")}`;
583
583
 
584
584
  // ../shared/src/e2b.ts
585
- var E2B_TEMPLATE_NAME = "replicas-sandbox-2026-07-21-v3";
585
+ var E2B_TEMPLATE_NAME = "replicas-sandbox-2026-07-21-v5";
586
586
 
587
587
  // ../shared/src/runtime-env.ts
588
588
  function shellQuotePosix(value) {
@@ -4745,7 +4745,6 @@ function loadEngineEnv() {
4745
4745
  WORKSPACE_ROOT: join2(HOME_DIR, "workspaces"),
4746
4746
  // Runtime: may not be set during warming
4747
4747
  WORKSPACE_ID: readEnv("WORKSPACE_ID"),
4748
- WORKSPACE_BRANCH_NAME: readEnv("WORKSPACE_BRANCH_NAME"),
4749
4748
  LINEAR_SESSION_ID: readEnv("LINEAR_SESSION_ID"),
4750
4749
  LINEAR_ACCESS_TOKEN: readEnv("LINEAR_ACCESS_TOKEN"),
4751
4750
  SLACK_BOT_TOKEN: readEnv("SLACK_BOT_TOKEN"),
@@ -5695,84 +5694,6 @@ var GitService = class {
5695
5694
  }
5696
5695
  return branches;
5697
5696
  }
5698
- async setBranchNameAndCheckout(name) {
5699
- ENGINE_ENV.WORKSPACE_BRANCH_NAME = name;
5700
- return this.initializeGitRepository();
5701
- }
5702
- async initializeGitRepository() {
5703
- const workspaceName = ENGINE_ENV.WORKSPACE_BRANCH_NAME;
5704
- if (!workspaceName) {
5705
- console.info("No WORKSPACE_BRANCH_NAME set \u2014 skipping branch checkout");
5706
- return {
5707
- success: true,
5708
- repos: []
5709
- };
5710
- }
5711
- const repos = await this.listRepositories();
5712
- if (repos.length === 0) {
5713
- return {
5714
- success: true,
5715
- repos: []
5716
- };
5717
- }
5718
- const results = [];
5719
- for (const repo of repos) {
5720
- if (!this.pathExists(repo.path)) {
5721
- results.push({ name: repo.name, success: true, currentBranch: repo.defaultBranch });
5722
- continue;
5723
- }
5724
- try {
5725
- const baselineState = {
5726
- name: repo.name,
5727
- path: repo.path,
5728
- defaultBranch: repo.defaultBranch,
5729
- currentBranch: repo.defaultBranch,
5730
- prUrls: [],
5731
- gitDiff: null,
5732
- startHooksCompleted: false
5733
- };
5734
- const persistedState = await loadRepoState(repo.name);
5735
- const persistedBranch = persistedState?.currentBranch;
5736
- if (persistedBranch && await branchExists(persistedBranch, repo.path)) {
5737
- const currentBranch = await getCurrentBranch(repo.path);
5738
- if (currentBranch !== persistedBranch) {
5739
- await this.checkoutWithoutHooks([persistedBranch], repo.path);
5740
- }
5741
- results.push({
5742
- name: repo.name,
5743
- success: true,
5744
- currentBranch: persistedBranch,
5745
- resumed: true
5746
- });
5747
- continue;
5748
- }
5749
- await this.checkoutWithoutHooks([repo.defaultBranch], repo.path);
5750
- const branchName = await this.findAvailableBranchName(workspaceName, repo.path);
5751
- await this.checkoutWithoutHooks(["-b", branchName], repo.path);
5752
- await saveRepoState(repo.name, { currentBranch: branchName }, baselineState);
5753
- results.push({
5754
- name: repo.name,
5755
- success: true,
5756
- currentBranch: branchName,
5757
- resumed: false
5758
- });
5759
- } catch (error) {
5760
- const errorMessage = error instanceof Error ? error.message : String(error);
5761
- results.push({
5762
- name: repo.name,
5763
- success: false,
5764
- currentBranch: repo.defaultBranch,
5765
- error: errorMessage
5766
- });
5767
- }
5768
- }
5769
- const failed = results.filter((result) => !result.success);
5770
- return {
5771
- success: failed.length === 0,
5772
- repos: results,
5773
- error: failed.length > 0 ? `Git init failed for ${failed.length} repo(s)` : void 0
5774
- };
5775
- }
5776
5697
  getGitDiffStats(repoPath, defaultBranch) {
5777
5698
  return this.diffStatsInFlight.run(repoPath, async () => {
5778
5699
  try {
@@ -6110,20 +6031,6 @@ var GitService = class {
6110
6031
  return null;
6111
6032
  }
6112
6033
  }
6113
- async findAvailableBranchName(baseName, cwd) {
6114
- const sanitizedBaseName = this.sanitizeBranchName(baseName);
6115
- if (!await branchExists(sanitizedBaseName, cwd)) {
6116
- return sanitizedBaseName;
6117
- }
6118
- return `${sanitizedBaseName}-${Date.now()}`;
6119
- }
6120
- checkoutWithoutHooks(args, cwd) {
6121
- return runGitCommand(["-c", "core.hooksPath=/dev/null", "checkout", ...args], cwd);
6122
- }
6123
- sanitizeBranchName(name) {
6124
- const normalized = name.toLowerCase().replace(/[^a-z0-9._/-]+/g, "-").replace(/\/{2,}/g, "/").replace(/^-+|-+$/g, "");
6125
- return normalized || "replicas";
6126
- }
6127
6034
  async refreshRepoMetadata(repo, currentBranch, startHooksCompleted, persistedState, observedBranches, includeDiffs = false) {
6128
6035
  const prResult = await this.getPullRequestUrl(repo.name, repo.path, currentBranch, persistedState);
6129
6036
  let prUrls = persistedState?.prUrls ?? [];
@@ -9906,7 +9813,7 @@ var DEFAULT_CODEX_ARGS = ["app-server", "--listen", "stdio://"];
9906
9813
  var MIN_CODEX_CLI_VERSION = "0.144.6";
9907
9814
  var CODEX_UPGRADE_TIMEOUT_MS = 12e4;
9908
9815
  var codexCliVersionEnsured = null;
9909
- var ENGINE_PACKAGE_VERSION = "0.1.473";
9816
+ var ENGINE_PACKAGE_VERSION = "0.1.475";
9910
9817
  var INITIALIZE_METHOD = "initialize";
9911
9818
  var INITIALIZED_NOTIFICATION = "initialized";
9912
9819
  var ACCOUNT_LOGIN_START_METHOD = "account/login/start";
@@ -15927,9 +15834,6 @@ var TerminalService = class {
15927
15834
  var terminalService = new TerminalService();
15928
15835
 
15929
15836
  // src/v1-routes.ts
15930
- var setWorkspaceNameSchema = z6.object({
15931
- name: z6.string().min(1).max(48)
15932
- });
15933
15837
  var imageMediaTypeSchema = z6.enum(IMAGE_MEDIA_TYPES);
15934
15838
  var createPreviewSchema = z6.object({
15935
15839
  port: z6.number().int().min(1).max(65535),
@@ -16716,17 +16620,7 @@ data: ${JSON.stringify("Terminal session not found")}
16716
16620
  }
16717
16621
  });
16718
16622
  app2.post("/workspace-name", async (c) => {
16719
- try {
16720
- const body = setWorkspaceNameSchema.parse(await c.req.json());
16721
- const result = await gitService.setBranchNameAndCheckout(body.name);
16722
- return c.json({
16723
- success: result.success,
16724
- repos: result.repos.map((r) => ({ name: r.name, branch: r.currentBranch, resumed: r.resumed ?? false }))
16725
- });
16726
- } catch (error) {
16727
- const details = error instanceof Error ? error.message : "Unknown error";
16728
- return c.json(jsonError("Failed to set workspace name", details), 400);
16729
- }
16623
+ return c.json({ success: true, repos: [] });
16730
16624
  });
16731
16625
  app2.get("/previews", async (c) => {
16732
16626
  try {
@@ -17167,10 +17061,6 @@ serve(
17167
17061
  console.log(`Replicas Engine running on port ${info.port}`);
17168
17062
  }
17169
17063
  await timeStartupStep("wait_for_initialization_gate", waitForInitializationGate);
17170
- const gitResult = await timeStartupStep("git_initialize", () => gitService.initializeGitRepository());
17171
- if (!gitResult.success && gitResult.error) {
17172
- console.warn(`Git initialization warning: ${gitResult.error}`);
17173
- }
17174
17064
  if (!IS_WARMING_MODE) {
17175
17065
  await timeStartupStep("replicas_config_initialize", () => replicasConfigService.initialize());
17176
17066
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "replicas-engine",
3
- "version": "0.1.473",
3
+ "version": "0.1.475",
4
4
  "description": "Lightweight API server for Replicas workspaces",
5
5
  "type": "module",
6
6
  "main": "dist/src/index.js",