replicas-engine 0.1.1066 → 0.1.1067

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.
@@ -8,9 +8,9 @@ import {
8
8
  listRunningCodexModels,
9
9
  restartCodexAspHost,
10
10
  restartCodexAspHostIfRunning
11
- } from "./chunk-Q7BYKZR6.js";
11
+ } from "./chunk-CO7ITKY7.js";
12
12
  import "./chunk-W347RMUG.js";
13
- import "./chunk-RYGN5ENQ.js";
13
+ import "./chunk-OR4IW7GB.js";
14
14
  import "./chunk-DIKPGEYN.js";
15
15
  import "./chunk-UZSNFLDQ.js";
16
16
  import "./chunk-PBDIRFDJ.js";
@@ -14,7 +14,7 @@ import {
14
14
  import {
15
15
  AppServerProcess,
16
16
  buildCodexAgentEnv
17
- } from "./chunk-RYGN5ENQ.js";
17
+ } from "./chunk-OR4IW7GB.js";
18
18
  import {
19
19
  SUBPROCESS_MAX_BUFFER,
20
20
  execFileAsync
@@ -291,7 +291,7 @@ var CodexTokenManager = class extends BaseRefreshManager {
291
291
  await this.applyCredentialUpdate(++this.credentialGeneration, async () => {
292
292
  await this.applyCredentialsResponse(data);
293
293
  setAgentCredentialSnapshot("codex", data);
294
- const { restartCodexAspHostIfRunning: restartCodexAspHostIfRunning2 } = await import("./asp-host-MF2K6N3H.js");
294
+ const { restartCodexAspHostIfRunning: restartCodexAspHostIfRunning2 } = await import("./asp-host-GK5THSUA.js");
295
295
  await restartCodexAspHostIfRunning2();
296
296
  });
297
297
  await this.start(true);
@@ -312,7 +312,7 @@ var CodexTokenManager = class extends BaseRefreshManager {
312
312
  const accountChanged = ENGINE_ENV.REPLICAS_AGENT_CREDENTIALS.codex?.credentialId !== data.credentialId;
313
313
  await this.applyCredentialsResponse(data);
314
314
  if (restartOnChange && (accountChanged || CODEX_AUTH_ENV_KEYS.some((key, index) => process.env[key] !== previousEnv[index]))) {
315
- const { restartCodexAspHostIfRunning: restartCodexAspHostIfRunning2 } = await import("./asp-host-MF2K6N3H.js");
315
+ const { restartCodexAspHostIfRunning: restartCodexAspHostIfRunning2 } = await import("./asp-host-GK5THSUA.js");
316
316
  await restartCodexAspHostIfRunning2();
317
317
  }
318
318
  setAgentCredentialSnapshot("codex", data);
@@ -763,13 +763,9 @@ var GitService = class {
763
763
  }
764
764
  return { repos: [...states, ...discovered.deleted], complete };
765
765
  }
766
- async refreshRepos(observedBranchesByRepo, options) {
767
- return (await this.refreshReposWithCompleteness(observedBranchesByRepo, options)).repos;
768
- }
769
- async refreshReposWithCompleteness(observedBranchesByRepo, options) {
766
+ async refreshRepos(observedBranchesByRepo) {
770
767
  const discovered = await this.listTrackedRepositories();
771
768
  const states = [];
772
- let complete = discovered.complete;
773
769
  for (const repo of discovered.repos) {
774
770
  try {
775
771
  const persistedState = await loadRepoState(repo.name);
@@ -784,18 +780,14 @@ var GitService = class {
784
780
  currentBranch,
785
781
  startHooksCompleted,
786
782
  persistedState,
787
- observed,
788
- options?.includeDiffs === true
783
+ observed
789
784
  );
790
- if (state.gitDiff === null || options?.includeDiffs === true && state.gitDiff.fullDiff === void 0) {
791
- complete = false;
792
- }
793
785
  states.push(state);
794
786
  } catch {
795
- complete = false;
787
+ continue;
796
788
  }
797
789
  }
798
- return { repos: [...states, ...discovered.deleted], complete };
790
+ return [...states, ...discovered.deleted];
799
791
  }
800
792
  async snapshotCurrentBranches() {
801
793
  const { repos } = await this.listTrackedRepositories();
@@ -1158,7 +1150,7 @@ Binary files /dev/null and ${quote(`b/${path2}`)} differ
1158
1150
  }
1159
1151
  return "main";
1160
1152
  }
1161
- async refreshRepoMetadata(repo, currentBranch, startHooksCompleted, persistedState, observedBranches, includeDiffs = false) {
1153
+ async refreshRepoMetadata(repo, currentBranch, startHooksCompleted, persistedState, observedBranches) {
1162
1154
  const notFound = { status: "not_found" };
1163
1155
  const prResult = currentBranch === repo.defaultBranch ? notFound : await this.getPullRequestUrl(repo.name, repo.path, currentBranch, persistedState);
1164
1156
  let prUrls = persistedState?.prUrls ?? [];
@@ -1174,15 +1166,13 @@ Binary files /dev/null and ${quote(`b/${path2}`)} differ
1174
1166
  }
1175
1167
  }
1176
1168
  }
1177
- const gitDiff = await this.getGitDiffStats(repo.path, repo.defaultBranch);
1178
- const fullDiff = includeDiffs && gitDiff ? await this.getFullGitDiff(repo.path, repo.defaultBranch) : null;
1179
1169
  const state = {
1180
1170
  name: repo.name,
1181
1171
  path: repo.path,
1182
1172
  defaultBranch: repo.defaultBranch,
1183
1173
  currentBranch,
1184
1174
  prUrls,
1185
- gitDiff: includeDiffs && gitDiff ? { ...gitDiff, ...fullDiff === null ? {} : { fullDiff } } : gitDiff,
1175
+ gitDiff: await this.getGitDiffStats(repo.path, repo.defaultBranch),
1186
1176
  startHooksCompleted,
1187
1177
  ...await this.resolveCodeHost(repo.path)
1188
1178
  };
@@ -240,7 +240,7 @@ function getCodexModelProvider(method) {
240
240
  if (method === "foundry") return "azure";
241
241
  return method === "ollama" || method === "openai-compatible" ? "replicas_openai_compatible" : "openai";
242
242
  }
243
- var ENGINE_PACKAGE_VERSION = "0.1.1066";
243
+ var ENGINE_PACKAGE_VERSION = "0.1.1067";
244
244
  var INITIALIZE_METHOD = "initialize";
245
245
  var INITIALIZED_NOTIFICATION = "initialized";
246
246
  var ACCOUNT_LOGIN_START_METHOD = "account/login/start";
@@ -3,7 +3,7 @@ import { createRequire as __createRequire } from 'node:module';
3
3
  const require = __createRequire(import.meta.url);
4
4
  import {
5
5
  AspClient
6
- } from "./chunk-RYGN5ENQ.js";
6
+ } from "./chunk-OR4IW7GB.js";
7
7
  import {
8
8
  ASTER_BASE_URL,
9
9
  ASTER_PROVIDER,
@@ -13,11 +13,11 @@ import {
13
13
  recoverCompletedTurn,
14
14
  spawnMuseMsp,
15
15
  startMuseSession
16
- } from "./chunk-I46BKVTL.js";
16
+ } from "./chunk-YETX3YG2.js";
17
17
  import {
18
18
  AppServerProcess,
19
19
  buildCodexAgentEnv
20
- } from "./chunk-RYGN5ENQ.js";
20
+ } from "./chunk-OR4IW7GB.js";
21
21
  import "./chunk-DIKPGEYN.js";
22
22
  import {
23
23
  AGENT,
package/dist/src/index.js CHANGED
@@ -64,7 +64,7 @@ import {
64
64
  spawnMuseMsp,
65
65
  startMuseSession,
66
66
  uuidV7
67
- } from "./chunk-I46BKVTL.js";
67
+ } from "./chunk-YETX3YG2.js";
68
68
  import {
69
69
  publishedPullRequestUrls
70
70
  } from "./chunk-G647LINI.js";
@@ -129,7 +129,7 @@ import {
129
129
  timestampFromSeconds,
130
130
  upsertCredentialFileLines,
131
131
  writeSecureCredentialFile
132
- } from "./chunk-Q7BYKZR6.js";
132
+ } from "./chunk-CO7ITKY7.js";
133
133
  import {
134
134
  ENGINE_ENV,
135
135
  monolithRequest,
@@ -141,7 +141,7 @@ import {
141
141
  } from "./chunk-W347RMUG.js";
142
142
  import {
143
143
  getCodexModelProvider
144
- } from "./chunk-RYGN5ENQ.js";
144
+ } from "./chunk-OR4IW7GB.js";
145
145
  import {
146
146
  SUBPROCESS_MAX_BUFFER,
147
147
  execAsync,
@@ -11841,57 +11841,15 @@ var LinearEventForwarder = class {
11841
11841
  }
11842
11842
  };
11843
11843
 
11844
- // src/services/upload-repo-state.ts
11845
- var uploadQueue = Promise.resolve();
11846
- async function sendRepoState(repos) {
11847
- const form = new FormData();
11848
- form.append(
11849
- "file",
11850
- new Blob([JSON.stringify({ repos })], { type: "application/json" }),
11851
- "repo-state.json"
11852
- );
11853
- const response = await monolithRequest("/v1/engine/repo-state", { body: form });
11854
- if (!response.ok) {
11855
- const errorText = await response.text();
11856
- throw new Error(`upload failed: ${response.status} ${errorText}`);
11857
- }
11858
- }
11859
- function uploadRepoState(repos) {
11860
- const upload = uploadQueue.then(() => sendRepoState(repos));
11861
- uploadQueue = upload.catch(() => {
11862
- });
11863
- return upload;
11864
- }
11865
- async function flushRepoState() {
11866
- try {
11867
- const { repos, complete: complete2 } = await gitService.listReposWithCompleteness({ includeDiffs: true });
11868
- if (!complete2) return { flushed: 0, skipped: 1, failed: 0 };
11869
- await uploadRepoState(repos);
11870
- return { flushed: 1, skipped: 0, failed: 0 };
11871
- } catch (err) {
11872
- console.error("[RepoStateUploader] upload failed:", err);
11873
- return { flushed: 0, skipped: 0, failed: 1 };
11874
- }
11875
- }
11876
-
11877
11844
  // src/services/refresh-repo-state.ts
11878
- async function refreshRepoStatuses(observedBranchesByRepo, includeDiffs = false) {
11845
+ async function refreshRepoStatuses(observedBranchesByRepo) {
11879
11846
  await Promise.all([
11880
11847
  githubTokenManager.refreshOnce().catch(() => {
11881
11848
  }),
11882
11849
  gitlabTokenManager.refreshOnce().catch(() => {
11883
11850
  })
11884
11851
  ]);
11885
- const { repos, complete: complete2 } = await gitService.refreshReposWithCompleteness(
11886
- observedBranchesByRepo,
11887
- { includeDiffs }
11888
- );
11889
- if (complete2) {
11890
- uploadRepoState(repos).catch((error) => {
11891
- console.error("[RefreshRepoState] Failed to upload repository state:", error);
11892
- });
11893
- }
11894
- return repos;
11852
+ return gitService.refreshRepos(observedBranchesByRepo);
11895
11853
  }
11896
11854
 
11897
11855
  // src/services/pull-request-check-service.ts
@@ -59021,6 +58979,39 @@ async function uploadChatTranscriptNow(chatId, filePath, chat, capture) {
59021
58979
  return artifact;
59022
58980
  }
59023
58981
 
58982
+ // src/services/upload-repo-state.ts
58983
+ var uploadQueue = Promise.resolve();
58984
+ async function sendRepoState(repos) {
58985
+ const form = new FormData();
58986
+ form.append(
58987
+ "file",
58988
+ new Blob([JSON.stringify({ repos })], { type: "application/json" }),
58989
+ "repo-state.json"
58990
+ );
58991
+ const response = await monolithRequest("/v1/engine/repo-state", { body: form });
58992
+ if (!response.ok) {
58993
+ const errorText = await response.text();
58994
+ throw new Error(`upload failed: ${response.status} ${errorText}`);
58995
+ }
58996
+ }
58997
+ function uploadRepoState(repos) {
58998
+ const upload = uploadQueue.then(() => sendRepoState(repos));
58999
+ uploadQueue = upload.catch(() => {
59000
+ });
59001
+ return upload;
59002
+ }
59003
+ async function flushRepoState() {
59004
+ try {
59005
+ const { repos, complete: complete2 } = await gitService.listReposWithCompleteness({ includeDiffs: true });
59006
+ if (!complete2) return { flushed: 0, skipped: 1, failed: 0 };
59007
+ await uploadRepoState(repos);
59008
+ return { flushed: 1, skipped: 0, failed: 0 };
59009
+ } catch (err) {
59010
+ console.error("[RepoStateUploader] upload failed:", err);
59011
+ return { flushed: 0, skipped: 0, failed: 1 };
59012
+ }
59013
+ }
59014
+
59024
59015
  // src/services/upload-engine-logs.ts
59025
59016
  import { createReadStream as createReadStream4 } from "fs";
59026
59017
  import { readdir as readdir8, stat as stat5 } from "fs/promises";
@@ -60881,7 +60872,7 @@ var ChatService = class {
60881
60872
  const observedBranches = chat.observedBranchesByRepo;
60882
60873
  chat.observedBranchesByRepo = /* @__PURE__ */ new Map();
60883
60874
  try {
60884
- const repoStatuses = await refreshRepoStatuses(observedBranches, true);
60875
+ const repoStatuses = await refreshRepoStatuses(observedBranches);
60885
60876
  console.log(`Repository Statuses Refreshed: `, repoStatuses);
60886
60877
  return repoStatuses;
60887
60878
  } catch (error) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "replicas-engine",
3
- "version": "0.1.1066",
3
+ "version": "0.1.1067",
4
4
  "description": "Lightweight API server for Replicas workspaces",
5
5
  "type": "module",
6
6
  "main": "dist/src/index.js",