replicas-engine 0.1.428 → 0.1.430

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 +34 -22
  2. package/package.json +1 -1
package/dist/src/index.js CHANGED
@@ -496,7 +496,7 @@ var SANDBOX_PATHS = {
496
496
  HOME_DIR: "/home/user",
497
497
  WORKSPACES_DIR: "/home/user/workspaces",
498
498
  REPLICAS_DIR: "/home/user/.replicas",
499
- REPLICAS_FILES_DIR: "/home/user/.replicas/files",
499
+ REPLICAS_CANVAS_DIR: "/home/user/.replicas/canvas",
500
500
  REPOS_PREPARED_MARKER: "/home/user/.replicas/repos-prepared-for-engine-init",
501
501
  REPLICAS_RUNTIME_ENV_FILE: "/home/user/.replicas/runtime-env.sh"
502
502
  };
@@ -504,7 +504,7 @@ var WORKSPACE_SIZES = ["small", "large"];
504
504
  var INVALID_WORKSPACE_SIZE_ERROR = `Invalid size: must be one of ${WORKSPACE_SIZES.join(", ")}`;
505
505
 
506
506
  // ../shared/src/e2b.ts
507
- var E2B_TEMPLATE_NAME = "replicas-sandbox-2026-07-11-v3";
507
+ var E2B_TEMPLATE_NAME = "replicas-sandbox-2026-07-14-v1";
508
508
 
509
509
  // ../shared/src/runtime-env.ts
510
510
  function shellQuotePosix(value) {
@@ -2910,8 +2910,6 @@ function findPrMergeSignals(request) {
2910
2910
 
2911
2911
  // ../shared/src/routes/workspaces.ts
2912
2912
  var WORKSPACE_STATUSES = ["active", "sleeping", "archived", "preparing", "error"];
2913
- var WORKSPACE_FILE_UPLOAD_MAX_SIZE_BYTES = 20 * 1024 * 1024;
2914
- var WORKSPACE_FILE_CONTENT_MAX_SIZE_BYTES = 1 * 1024 * 1024;
2915
2913
  var WORKSPACE_STATUS_FILTERS = WORKSPACE_STATUSES.map((status) => status === "error" ? "failed" : status);
2916
2914
  var WORKSPACE_SORT_CHOICES = [
2917
2915
  ["manual", "Custom"],
@@ -4143,13 +4141,17 @@ var GitService = class {
4143
4141
  return ENGINE_ENV.WORKSPACE_ROOT;
4144
4142
  }
4145
4143
  async listRepositories() {
4144
+ return (await this.listRepositoriesWithCompleteness()).repos;
4145
+ }
4146
+ async listRepositoriesWithCompleteness() {
4146
4147
  const root = this.getWorkspaceRoot();
4147
4148
  const rootStat = await this.safeStat(root);
4148
4149
  if (!rootStat?.isDirectory()) {
4149
- return [];
4150
+ return { repos: [], complete: false };
4150
4151
  }
4151
4152
  const entries = await readdir(root);
4152
4153
  const repos = [];
4154
+ let complete = true;
4153
4155
  for (const entry of entries) {
4154
4156
  const fullPath = join5(root, entry);
4155
4157
  try {
@@ -4167,19 +4169,24 @@ var GitService = class {
4167
4169
  defaultBranch: await this.resolveDefaultBranch(fullPath)
4168
4170
  });
4169
4171
  } catch {
4172
+ complete = false;
4170
4173
  }
4171
4174
  }
4172
- return repos.sort((a, b) => a.name.localeCompare(b.name));
4175
+ return { repos: repos.sort((a, b) => a.name.localeCompare(b.name)), complete };
4173
4176
  }
4174
4177
  async listRepos(options) {
4178
+ return (await this.listReposWithCompleteness(options)).repos;
4179
+ }
4180
+ async listReposWithCompleteness(options) {
4175
4181
  const includeDiffs = options?.includeDiffs === true;
4176
4182
  const key = includeDiffs ? "diffs" : "base";
4177
4183
  return this.listReposInFlight.run(key, () => this.computeListRepos(includeDiffs));
4178
4184
  }
4179
4185
  async computeListRepos(includeDiffs) {
4180
- const repos = await this.listRepositories();
4186
+ const discovered = await this.listRepositoriesWithCompleteness();
4181
4187
  const states = [];
4182
- for (const repo of repos) {
4188
+ let complete = discovered.complete;
4189
+ for (const repo of discovered.repos) {
4183
4190
  try {
4184
4191
  const [persistedState, currentBranchRaw, gitDiff, provider] = await Promise.all([
4185
4192
  loadRepoState(repo.name),
@@ -4189,23 +4196,25 @@ var GitService = class {
4189
4196
  ]);
4190
4197
  const currentBranch = currentBranchRaw ?? repo.defaultBranch;
4191
4198
  const fullDiff = includeDiffs && gitDiff ? await this.getFullGitDiff(repo.path, repo.defaultBranch) : void 0;
4199
+ if (gitDiff === null) complete = false;
4200
+ if (fullDiff === null) complete = false;
4192
4201
  states.push({
4193
4202
  name: repo.name,
4194
4203
  path: repo.path,
4195
4204
  defaultBranch: repo.defaultBranch,
4196
4205
  currentBranch,
4197
4206
  prUrls: persistedState?.prUrls ?? [],
4198
- // fullDiff may be empty if the diff subprocess fails.
4199
- gitDiff: includeDiffs && gitDiff ? { ...gitDiff, fullDiff: fullDiff ?? "" } : gitDiff,
4207
+ gitDiff: includeDiffs && gitDiff ? { ...gitDiff, ...fullDiff === null ? {} : { fullDiff } } : gitDiff,
4200
4208
  startHooksCompleted: persistedState?.startHooksCompleted ?? false,
4201
4209
  provider
4202
4210
  });
4203
4211
  } catch {
4212
+ complete = false;
4204
4213
  }
4205
4214
  }
4206
- return states;
4215
+ return { repos: states, complete };
4207
4216
  }
4208
- async refreshRepos(observedBranchesByRepo) {
4217
+ async refreshRepos(observedBranchesByRepo, options) {
4209
4218
  const repos = await this.listRepositories();
4210
4219
  const states = [];
4211
4220
  for (const repo of repos) {
@@ -4215,7 +4224,7 @@ var GitService = class {
4215
4224
  const startHooksCompleted = persistedState?.startHooksCompleted ?? false;
4216
4225
  const observed = observedBranchesByRepo?.get(repo.name);
4217
4226
  states.push(
4218
- await this.refreshRepoMetadata(repo, currentBranch, startHooksCompleted, persistedState, observed)
4227
+ await this.refreshRepoMetadata(repo, currentBranch, startHooksCompleted, persistedState, observed, options?.includeDiffs === true)
4219
4228
  );
4220
4229
  } catch {
4221
4230
  }
@@ -4457,7 +4466,7 @@ var GitService = class {
4457
4466
  const untrackedDiff = await this.getUntrackedAsDiff(repoPath);
4458
4467
  return trackedDiff + untrackedDiff;
4459
4468
  } catch {
4460
- return "";
4469
+ return null;
4461
4470
  }
4462
4471
  });
4463
4472
  }
@@ -4687,7 +4696,7 @@ var GitService = class {
4687
4696
  const normalized = name.toLowerCase().replace(/[^a-z0-9._/-]+/g, "-").replace(/\/{2,}/g, "/").replace(/^-+|-+$/g, "");
4688
4697
  return normalized || "replicas";
4689
4698
  }
4690
- async refreshRepoMetadata(repo, currentBranch, startHooksCompleted, persistedState, observedBranches) {
4699
+ async refreshRepoMetadata(repo, currentBranch, startHooksCompleted, persistedState, observedBranches, includeDiffs = false) {
4691
4700
  const prResult = await this.getPullRequestUrl(repo.name, repo.path, currentBranch, persistedState);
4692
4701
  let prUrls = persistedState?.prUrls ?? [];
4693
4702
  if (prResult.status === "found") {
@@ -4702,13 +4711,15 @@ var GitService = class {
4702
4711
  }
4703
4712
  }
4704
4713
  }
4714
+ const gitDiff = await this.getGitDiffStats(repo.path, repo.defaultBranch);
4715
+ const fullDiff = includeDiffs && gitDiff ? await this.getFullGitDiff(repo.path, repo.defaultBranch) : null;
4705
4716
  const state = {
4706
4717
  name: repo.name,
4707
4718
  path: repo.path,
4708
4719
  defaultBranch: repo.defaultBranch,
4709
4720
  currentBranch,
4710
4721
  prUrls,
4711
- gitDiff: await this.getGitDiffStats(repo.path, repo.defaultBranch),
4722
+ gitDiff: includeDiffs && gitDiff ? { ...gitDiff, ...fullDiff === null ? {} : { fullDiff } } : gitDiff,
4712
4723
  startHooksCompleted,
4713
4724
  provider: await this.resolveCodeHostProvider(repo.path)
4714
4725
  };
@@ -8450,7 +8461,7 @@ var DEFAULT_CODEX_ARGS = ["app-server", "--listen", "stdio://"];
8450
8461
  var MIN_CODEX_CLI_VERSION = "0.144.0";
8451
8462
  var CODEX_UPGRADE_TIMEOUT_MS = 12e4;
8452
8463
  var codexCliVersionEnsured = null;
8453
- var ENGINE_PACKAGE_VERSION = "0.1.428";
8464
+ var ENGINE_PACKAGE_VERSION = "0.1.430";
8454
8465
  var INITIALIZE_METHOD = "initialize";
8455
8466
  var INITIALIZED_NOTIFICATION = "initialized";
8456
8467
  var ACCOUNT_LOGIN_START_METHOD = "account/login/start";
@@ -12262,8 +12273,8 @@ import { readdir as readdir6, readFile as readFile12, stat as stat3 } from "fs/p
12262
12273
  import { homedir as homedir13 } from "os";
12263
12274
  import { join as join19 } from "path";
12264
12275
  var CANVAS_DIRECTORIES = [
12265
- join19(homedir13(), ".claude", "plans"),
12266
- join19(homedir13(), ".replicas", "canvas")
12276
+ join19(homedir13(), ".replicas", "canvas"),
12277
+ join19(homedir13(), ".claude", "plans")
12267
12278
  ];
12268
12279
  var CanvasService = class {
12269
12280
  async listItems() {
@@ -13280,7 +13291,7 @@ var ChatService = class {
13280
13291
  chat.observedBranchesByRepo = /* @__PURE__ */ new Map();
13281
13292
  let repoStatuses;
13282
13293
  try {
13283
- repoStatuses = await gitService.refreshRepos(observedBranches);
13294
+ repoStatuses = await gitService.refreshRepos(observedBranches, { includeDiffs: true });
13284
13295
  console.log(`Repository Statuses Refreshed: `, repoStatuses);
13285
13296
  } catch (error) {
13286
13297
  console.error("[ChatService] Failed to refresh repo statuses:", error);
@@ -14310,10 +14321,11 @@ function createV1Routes(deps) {
14310
14321
  });
14311
14322
  app2.get("/repos", async (c) => {
14312
14323
  const includeDiffs = c.req.query("includeDiffs") === "true";
14313
- const repos = await gitService.listRepos({ includeDiffs });
14324
+ const { repos, complete } = await gitService.listReposWithCompleteness({ includeDiffs });
14314
14325
  const response = {
14315
14326
  repos,
14316
- workspaceRoot: gitService.getWorkspaceRoot()
14327
+ workspaceRoot: gitService.getWorkspaceRoot(),
14328
+ complete
14317
14329
  };
14318
14330
  return c.json(response);
14319
14331
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "replicas-engine",
3
- "version": "0.1.428",
3
+ "version": "0.1.430",
4
4
  "description": "Lightweight API server for Replicas workspaces",
5
5
  "type": "module",
6
6
  "main": "dist/src/index.js",