replicas-engine 0.1.429 → 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 +31 -17
  2. package/package.json +1 -1
package/dist/src/index.js CHANGED
@@ -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-13-v1";
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) {
@@ -4141,13 +4141,17 @@ var GitService = class {
4141
4141
  return ENGINE_ENV.WORKSPACE_ROOT;
4142
4142
  }
4143
4143
  async listRepositories() {
4144
+ return (await this.listRepositoriesWithCompleteness()).repos;
4145
+ }
4146
+ async listRepositoriesWithCompleteness() {
4144
4147
  const root = this.getWorkspaceRoot();
4145
4148
  const rootStat = await this.safeStat(root);
4146
4149
  if (!rootStat?.isDirectory()) {
4147
- return [];
4150
+ return { repos: [], complete: false };
4148
4151
  }
4149
4152
  const entries = await readdir(root);
4150
4153
  const repos = [];
4154
+ let complete = true;
4151
4155
  for (const entry of entries) {
4152
4156
  const fullPath = join5(root, entry);
4153
4157
  try {
@@ -4165,19 +4169,24 @@ var GitService = class {
4165
4169
  defaultBranch: await this.resolveDefaultBranch(fullPath)
4166
4170
  });
4167
4171
  } catch {
4172
+ complete = false;
4168
4173
  }
4169
4174
  }
4170
- return repos.sort((a, b) => a.name.localeCompare(b.name));
4175
+ return { repos: repos.sort((a, b) => a.name.localeCompare(b.name)), complete };
4171
4176
  }
4172
4177
  async listRepos(options) {
4178
+ return (await this.listReposWithCompleteness(options)).repos;
4179
+ }
4180
+ async listReposWithCompleteness(options) {
4173
4181
  const includeDiffs = options?.includeDiffs === true;
4174
4182
  const key = includeDiffs ? "diffs" : "base";
4175
4183
  return this.listReposInFlight.run(key, () => this.computeListRepos(includeDiffs));
4176
4184
  }
4177
4185
  async computeListRepos(includeDiffs) {
4178
- const repos = await this.listRepositories();
4186
+ const discovered = await this.listRepositoriesWithCompleteness();
4179
4187
  const states = [];
4180
- for (const repo of repos) {
4188
+ let complete = discovered.complete;
4189
+ for (const repo of discovered.repos) {
4181
4190
  try {
4182
4191
  const [persistedState, currentBranchRaw, gitDiff, provider] = await Promise.all([
4183
4192
  loadRepoState(repo.name),
@@ -4187,23 +4196,25 @@ var GitService = class {
4187
4196
  ]);
4188
4197
  const currentBranch = currentBranchRaw ?? repo.defaultBranch;
4189
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;
4190
4201
  states.push({
4191
4202
  name: repo.name,
4192
4203
  path: repo.path,
4193
4204
  defaultBranch: repo.defaultBranch,
4194
4205
  currentBranch,
4195
4206
  prUrls: persistedState?.prUrls ?? [],
4196
- // fullDiff may be empty if the diff subprocess fails.
4197
- gitDiff: includeDiffs && gitDiff ? { ...gitDiff, fullDiff: fullDiff ?? "" } : gitDiff,
4207
+ gitDiff: includeDiffs && gitDiff ? { ...gitDiff, ...fullDiff === null ? {} : { fullDiff } } : gitDiff,
4198
4208
  startHooksCompleted: persistedState?.startHooksCompleted ?? false,
4199
4209
  provider
4200
4210
  });
4201
4211
  } catch {
4212
+ complete = false;
4202
4213
  }
4203
4214
  }
4204
- return states;
4215
+ return { repos: states, complete };
4205
4216
  }
4206
- async refreshRepos(observedBranchesByRepo) {
4217
+ async refreshRepos(observedBranchesByRepo, options) {
4207
4218
  const repos = await this.listRepositories();
4208
4219
  const states = [];
4209
4220
  for (const repo of repos) {
@@ -4213,7 +4224,7 @@ var GitService = class {
4213
4224
  const startHooksCompleted = persistedState?.startHooksCompleted ?? false;
4214
4225
  const observed = observedBranchesByRepo?.get(repo.name);
4215
4226
  states.push(
4216
- await this.refreshRepoMetadata(repo, currentBranch, startHooksCompleted, persistedState, observed)
4227
+ await this.refreshRepoMetadata(repo, currentBranch, startHooksCompleted, persistedState, observed, options?.includeDiffs === true)
4217
4228
  );
4218
4229
  } catch {
4219
4230
  }
@@ -4455,7 +4466,7 @@ var GitService = class {
4455
4466
  const untrackedDiff = await this.getUntrackedAsDiff(repoPath);
4456
4467
  return trackedDiff + untrackedDiff;
4457
4468
  } catch {
4458
- return "";
4469
+ return null;
4459
4470
  }
4460
4471
  });
4461
4472
  }
@@ -4685,7 +4696,7 @@ var GitService = class {
4685
4696
  const normalized = name.toLowerCase().replace(/[^a-z0-9._/-]+/g, "-").replace(/\/{2,}/g, "/").replace(/^-+|-+$/g, "");
4686
4697
  return normalized || "replicas";
4687
4698
  }
4688
- async refreshRepoMetadata(repo, currentBranch, startHooksCompleted, persistedState, observedBranches) {
4699
+ async refreshRepoMetadata(repo, currentBranch, startHooksCompleted, persistedState, observedBranches, includeDiffs = false) {
4689
4700
  const prResult = await this.getPullRequestUrl(repo.name, repo.path, currentBranch, persistedState);
4690
4701
  let prUrls = persistedState?.prUrls ?? [];
4691
4702
  if (prResult.status === "found") {
@@ -4700,13 +4711,15 @@ var GitService = class {
4700
4711
  }
4701
4712
  }
4702
4713
  }
4714
+ const gitDiff = await this.getGitDiffStats(repo.path, repo.defaultBranch);
4715
+ const fullDiff = includeDiffs && gitDiff ? await this.getFullGitDiff(repo.path, repo.defaultBranch) : null;
4703
4716
  const state = {
4704
4717
  name: repo.name,
4705
4718
  path: repo.path,
4706
4719
  defaultBranch: repo.defaultBranch,
4707
4720
  currentBranch,
4708
4721
  prUrls,
4709
- gitDiff: await this.getGitDiffStats(repo.path, repo.defaultBranch),
4722
+ gitDiff: includeDiffs && gitDiff ? { ...gitDiff, ...fullDiff === null ? {} : { fullDiff } } : gitDiff,
4710
4723
  startHooksCompleted,
4711
4724
  provider: await this.resolveCodeHostProvider(repo.path)
4712
4725
  };
@@ -8448,7 +8461,7 @@ var DEFAULT_CODEX_ARGS = ["app-server", "--listen", "stdio://"];
8448
8461
  var MIN_CODEX_CLI_VERSION = "0.144.0";
8449
8462
  var CODEX_UPGRADE_TIMEOUT_MS = 12e4;
8450
8463
  var codexCliVersionEnsured = null;
8451
- var ENGINE_PACKAGE_VERSION = "0.1.429";
8464
+ var ENGINE_PACKAGE_VERSION = "0.1.430";
8452
8465
  var INITIALIZE_METHOD = "initialize";
8453
8466
  var INITIALIZED_NOTIFICATION = "initialized";
8454
8467
  var ACCOUNT_LOGIN_START_METHOD = "account/login/start";
@@ -13278,7 +13291,7 @@ var ChatService = class {
13278
13291
  chat.observedBranchesByRepo = /* @__PURE__ */ new Map();
13279
13292
  let repoStatuses;
13280
13293
  try {
13281
- repoStatuses = await gitService.refreshRepos(observedBranches);
13294
+ repoStatuses = await gitService.refreshRepos(observedBranches, { includeDiffs: true });
13282
13295
  console.log(`Repository Statuses Refreshed: `, repoStatuses);
13283
13296
  } catch (error) {
13284
13297
  console.error("[ChatService] Failed to refresh repo statuses:", error);
@@ -14308,10 +14321,11 @@ function createV1Routes(deps) {
14308
14321
  });
14309
14322
  app2.get("/repos", async (c) => {
14310
14323
  const includeDiffs = c.req.query("includeDiffs") === "true";
14311
- const repos = await gitService.listRepos({ includeDiffs });
14324
+ const { repos, complete } = await gitService.listReposWithCompleteness({ includeDiffs });
14312
14325
  const response = {
14313
14326
  repos,
14314
- workspaceRoot: gitService.getWorkspaceRoot()
14327
+ workspaceRoot: gitService.getWorkspaceRoot(),
14328
+ complete
14315
14329
  };
14316
14330
  return c.json(response);
14317
14331
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "replicas-engine",
3
- "version": "0.1.429",
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",