replicas-engine 0.1.429 → 0.1.431

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 +39 -22
  2. package/package.json +1 -1
package/dist/src/index.js CHANGED
@@ -32,10 +32,12 @@ var VALID_AGENT_PROVIDERS = ["claude", "codex", "cursor", "opencode", "relay"];
32
32
  var VALID_CODING_AGENT_PROVIDERS = VALID_AGENT_PROVIDERS.filter(
33
33
  (provider) => provider !== "relay"
34
34
  );
35
+ var VALID_THINKING_LEVELS = ["low", "medium", "high", "xhigh", "max"];
35
36
  var CODEX_REASONING_EFFORT_BY_THINKING_LEVEL = {
36
37
  low: "low",
37
38
  medium: "medium",
38
39
  high: "high",
40
+ xhigh: "xhigh",
39
41
  max: "xhigh"
40
42
  };
41
43
  function codexReasoningEffortForThinkingLevel(thinkingLevel) {
@@ -504,7 +506,7 @@ var WORKSPACE_SIZES = ["small", "large"];
504
506
  var INVALID_WORKSPACE_SIZE_ERROR = `Invalid size: must be one of ${WORKSPACE_SIZES.join(", ")}`;
505
507
 
506
508
  // ../shared/src/e2b.ts
507
- var E2B_TEMPLATE_NAME = "replicas-sandbox-2026-07-13-v1";
509
+ var E2B_TEMPLATE_NAME = "replicas-sandbox-2026-07-14-v2";
508
510
 
509
511
  // ../shared/src/runtime-env.ts
510
512
  function shellQuotePosix(value) {
@@ -4141,13 +4143,17 @@ var GitService = class {
4141
4143
  return ENGINE_ENV.WORKSPACE_ROOT;
4142
4144
  }
4143
4145
  async listRepositories() {
4146
+ return (await this.listRepositoriesWithCompleteness()).repos;
4147
+ }
4148
+ async listRepositoriesWithCompleteness() {
4144
4149
  const root = this.getWorkspaceRoot();
4145
4150
  const rootStat = await this.safeStat(root);
4146
4151
  if (!rootStat?.isDirectory()) {
4147
- return [];
4152
+ return { repos: [], complete: false };
4148
4153
  }
4149
4154
  const entries = await readdir(root);
4150
4155
  const repos = [];
4156
+ let complete = true;
4151
4157
  for (const entry of entries) {
4152
4158
  const fullPath = join5(root, entry);
4153
4159
  try {
@@ -4165,19 +4171,24 @@ var GitService = class {
4165
4171
  defaultBranch: await this.resolveDefaultBranch(fullPath)
4166
4172
  });
4167
4173
  } catch {
4174
+ complete = false;
4168
4175
  }
4169
4176
  }
4170
- return repos.sort((a, b) => a.name.localeCompare(b.name));
4177
+ return { repos: repos.sort((a, b) => a.name.localeCompare(b.name)), complete };
4171
4178
  }
4172
4179
  async listRepos(options) {
4180
+ return (await this.listReposWithCompleteness(options)).repos;
4181
+ }
4182
+ async listReposWithCompleteness(options) {
4173
4183
  const includeDiffs = options?.includeDiffs === true;
4174
4184
  const key = includeDiffs ? "diffs" : "base";
4175
4185
  return this.listReposInFlight.run(key, () => this.computeListRepos(includeDiffs));
4176
4186
  }
4177
4187
  async computeListRepos(includeDiffs) {
4178
- const repos = await this.listRepositories();
4188
+ const discovered = await this.listRepositoriesWithCompleteness();
4179
4189
  const states = [];
4180
- for (const repo of repos) {
4190
+ let complete = discovered.complete;
4191
+ for (const repo of discovered.repos) {
4181
4192
  try {
4182
4193
  const [persistedState, currentBranchRaw, gitDiff, provider] = await Promise.all([
4183
4194
  loadRepoState(repo.name),
@@ -4187,23 +4198,25 @@ var GitService = class {
4187
4198
  ]);
4188
4199
  const currentBranch = currentBranchRaw ?? repo.defaultBranch;
4189
4200
  const fullDiff = includeDiffs && gitDiff ? await this.getFullGitDiff(repo.path, repo.defaultBranch) : void 0;
4201
+ if (gitDiff === null) complete = false;
4202
+ if (fullDiff === null) complete = false;
4190
4203
  states.push({
4191
4204
  name: repo.name,
4192
4205
  path: repo.path,
4193
4206
  defaultBranch: repo.defaultBranch,
4194
4207
  currentBranch,
4195
4208
  prUrls: persistedState?.prUrls ?? [],
4196
- // fullDiff may be empty if the diff subprocess fails.
4197
- gitDiff: includeDiffs && gitDiff ? { ...gitDiff, fullDiff: fullDiff ?? "" } : gitDiff,
4209
+ gitDiff: includeDiffs && gitDiff ? { ...gitDiff, ...fullDiff === null ? {} : { fullDiff } } : gitDiff,
4198
4210
  startHooksCompleted: persistedState?.startHooksCompleted ?? false,
4199
4211
  provider
4200
4212
  });
4201
4213
  } catch {
4214
+ complete = false;
4202
4215
  }
4203
4216
  }
4204
- return states;
4217
+ return { repos: states, complete };
4205
4218
  }
4206
- async refreshRepos(observedBranchesByRepo) {
4219
+ async refreshRepos(observedBranchesByRepo, options) {
4207
4220
  const repos = await this.listRepositories();
4208
4221
  const states = [];
4209
4222
  for (const repo of repos) {
@@ -4213,7 +4226,7 @@ var GitService = class {
4213
4226
  const startHooksCompleted = persistedState?.startHooksCompleted ?? false;
4214
4227
  const observed = observedBranchesByRepo?.get(repo.name);
4215
4228
  states.push(
4216
- await this.refreshRepoMetadata(repo, currentBranch, startHooksCompleted, persistedState, observed)
4229
+ await this.refreshRepoMetadata(repo, currentBranch, startHooksCompleted, persistedState, observed, options?.includeDiffs === true)
4217
4230
  );
4218
4231
  } catch {
4219
4232
  }
@@ -4455,7 +4468,7 @@ var GitService = class {
4455
4468
  const untrackedDiff = await this.getUntrackedAsDiff(repoPath);
4456
4469
  return trackedDiff + untrackedDiff;
4457
4470
  } catch {
4458
- return "";
4471
+ return null;
4459
4472
  }
4460
4473
  });
4461
4474
  }
@@ -4685,7 +4698,7 @@ var GitService = class {
4685
4698
  const normalized = name.toLowerCase().replace(/[^a-z0-9._/-]+/g, "-").replace(/\/{2,}/g, "/").replace(/^-+|-+$/g, "");
4686
4699
  return normalized || "replicas";
4687
4700
  }
4688
- async refreshRepoMetadata(repo, currentBranch, startHooksCompleted, persistedState, observedBranches) {
4701
+ async refreshRepoMetadata(repo, currentBranch, startHooksCompleted, persistedState, observedBranches, includeDiffs = false) {
4689
4702
  const prResult = await this.getPullRequestUrl(repo.name, repo.path, currentBranch, persistedState);
4690
4703
  let prUrls = persistedState?.prUrls ?? [];
4691
4704
  if (prResult.status === "found") {
@@ -4700,13 +4713,15 @@ var GitService = class {
4700
4713
  }
4701
4714
  }
4702
4715
  }
4716
+ const gitDiff = await this.getGitDiffStats(repo.path, repo.defaultBranch);
4717
+ const fullDiff = includeDiffs && gitDiff ? await this.getFullGitDiff(repo.path, repo.defaultBranch) : null;
4703
4718
  const state = {
4704
4719
  name: repo.name,
4705
4720
  path: repo.path,
4706
4721
  defaultBranch: repo.defaultBranch,
4707
4722
  currentBranch,
4708
4723
  prUrls,
4709
- gitDiff: await this.getGitDiffStats(repo.path, repo.defaultBranch),
4724
+ gitDiff: includeDiffs && gitDiff ? { ...gitDiff, ...fullDiff === null ? {} : { fullDiff } } : gitDiff,
4710
4725
  startHooksCompleted,
4711
4726
  provider: await this.resolveCodeHostProvider(repo.path)
4712
4727
  };
@@ -8448,7 +8463,7 @@ var DEFAULT_CODEX_ARGS = ["app-server", "--listen", "stdio://"];
8448
8463
  var MIN_CODEX_CLI_VERSION = "0.144.0";
8449
8464
  var CODEX_UPGRADE_TIMEOUT_MS = 12e4;
8450
8465
  var codexCliVersionEnsured = null;
8451
- var ENGINE_PACKAGE_VERSION = "0.1.429";
8466
+ var ENGINE_PACKAGE_VERSION = "0.1.431";
8452
8467
  var INITIALIZE_METHOD = "initialize";
8453
8468
  var INITIALIZED_NOTIFICATION = "initialized";
8454
8469
  var ACCOUNT_LOGIN_START_METHOD = "account/login/start";
@@ -10974,6 +10989,7 @@ var OPENCODE_VARIANT_CANDIDATES_BY_THINKING_LEVEL = {
10974
10989
  low: ["low"],
10975
10990
  medium: ["medium"],
10976
10991
  high: ["high"],
10992
+ xhigh: ["xhigh", "high"],
10977
10993
  max: ["max", "xhigh", "high"]
10978
10994
  };
10979
10995
  async function opencodeConfig(model) {
@@ -11759,8 +11775,8 @@ You will also receive the chatId so you can send follow-up messages or clean up
11759
11775
  cursorAvailable ? `Cursor: ${AGENT_MODELS.cursor.join(", ")}.` : null,
11760
11776
  opencodeAvailable ? `Opencode: ${AGENT_MODELS.opencode.join(", ")}.` : null
11761
11777
  ].filter(Boolean).join(" ")),
11762
- thinking_level: z.enum(["low", "medium", "high", "max"]).optional().describe(
11763
- "Controls how much thinking/reasoning the subagent applies. low = light thinking, medium = moderate, high = deep reasoning, max = maximum effort. Defaults: Claude = high, Codex = medium, Cursor = medium, Opencode = medium."
11778
+ thinking_level: z.enum(VALID_THINKING_LEVELS).optional().describe(
11779
+ "Controls how much thinking/reasoning the subagent applies. low = light thinking, medium = moderate, high = deep reasoning, xhigh = extended effort, max = maximum effort. Defaults: Claude = high, Codex = medium, Cursor = medium, Opencode = medium."
11764
11780
  ),
11765
11781
  title: z.string().optional().describe("Optional title for the subagent chat (for identification)."),
11766
11782
  timeout_minutes: z.number().positive().optional().describe("Timeout in minutes for the subagent to complete (default: 10). Set higher for large tasks to avoid losing work.")
@@ -11827,8 +11843,8 @@ The tool blocks until the subagent completes and returns its response.`,
11827
11843
  chatId: z.string().describe("The chat ID of the subagent (returned by spawn_agent)."),
11828
11844
  message: z.string().describe("The follow-up message to send."),
11829
11845
  model: z.string().optional().describe("Optional model override for this message."),
11830
- thinking_level: z.enum(["low", "medium", "high", "max"]).optional().describe(
11831
- "Controls how much thinking/reasoning the subagent applies. low = light thinking, medium = moderate, high = deep reasoning, max = maximum effort. Defaults: Claude = high, Codex = medium, Cursor = medium, Opencode = medium."
11846
+ thinking_level: z.enum(VALID_THINKING_LEVELS).optional().describe(
11847
+ "Controls how much thinking/reasoning the subagent applies. low = light thinking, medium = moderate, high = deep reasoning, xhigh = extended effort, max = maximum effort. Defaults: Claude = high, Codex = medium, Cursor = medium, Opencode = medium."
11832
11848
  ),
11833
11849
  timeout_minutes: z.number().positive().optional().describe("Timeout in minutes for the subagent to complete (default: 10). Set higher for large tasks to avoid losing work.")
11834
11850
  },
@@ -13278,7 +13294,7 @@ var ChatService = class {
13278
13294
  chat.observedBranchesByRepo = /* @__PURE__ */ new Map();
13279
13295
  let repoStatuses;
13280
13296
  try {
13281
- repoStatuses = await gitService.refreshRepos(observedBranches);
13297
+ repoStatuses = await gitService.refreshRepos(observedBranches, { includeDiffs: true });
13282
13298
  console.log(`Repository Statuses Refreshed: `, repoStatuses);
13283
13299
  } catch (error) {
13284
13300
  console.error("[ChatService] Failed to refresh repo statuses:", error);
@@ -13983,7 +13999,7 @@ var sendMessageSchema = z2.object({
13983
13999
  })
13984
14000
  ])
13985
14001
  })).optional(),
13986
- thinkingLevel: z2.enum(["low", "medium", "high", "max"]).optional(),
14002
+ thinkingLevel: z2.enum(VALID_THINKING_LEVELS).optional(),
13987
14003
  goalMode: z2.boolean().optional(),
13988
14004
  fastMode: z2.boolean().optional(),
13989
14005
  enableInteractiveTools: z2.boolean().optional(),
@@ -14308,10 +14324,11 @@ function createV1Routes(deps) {
14308
14324
  });
14309
14325
  app2.get("/repos", async (c) => {
14310
14326
  const includeDiffs = c.req.query("includeDiffs") === "true";
14311
- const repos = await gitService.listRepos({ includeDiffs });
14327
+ const { repos, complete } = await gitService.listReposWithCompleteness({ includeDiffs });
14312
14328
  const response = {
14313
14329
  repos,
14314
- workspaceRoot: gitService.getWorkspaceRoot()
14330
+ workspaceRoot: gitService.getWorkspaceRoot(),
14331
+ complete
14315
14332
  };
14316
14333
  return c.json(response);
14317
14334
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "replicas-engine",
3
- "version": "0.1.429",
3
+ "version": "0.1.431",
4
4
  "description": "Lightweight API server for Replicas workspaces",
5
5
  "type": "module",
6
6
  "main": "dist/src/index.js",