replicas-engine 0.1.1345 → 0.1.1347

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,12 +8,12 @@ import {
8
8
  listRunningCodexModels,
9
9
  restartCodexAspHost,
10
10
  restartCodexAspHostIfRunning
11
- } from "./chunk-S7YTEUA6.js";
12
- import "./chunk-4V6YPA4Z.js";
13
- import "./chunk-HWY6BIUJ.js";
14
- import "./chunk-K4RSYNHQ.js";
11
+ } from "./chunk-N5XRHGDO.js";
12
+ import "./chunk-P3QCO4DL.js";
13
+ import "./chunk-JC3ONOS4.js";
14
+ import "./chunk-PNSG42ML.js";
15
15
  import "./chunk-UZSNFLDQ.js";
16
- import "./chunk-MWEZKRAF.js";
16
+ import "./chunk-LF6GOCSD.js";
17
17
  import "./chunk-VEQXQN22.js";
18
18
  export {
19
19
  CODEX_ULTRAFAST_SERVICE_TIER,
@@ -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-HWY6BIUJ.js";
6
+ } from "./chunk-JC3ONOS4.js";
7
7
  import {
8
8
  ASTER_BASE_URL,
9
9
  ASTER_PROVIDER,
@@ -15,7 +15,7 @@ import {
15
15
  isRecord,
16
16
  readOllamaAuthEnv,
17
17
  readOpenAICompatibleAuthEnv
18
- } from "./chunk-MWEZKRAF.js";
18
+ } from "./chunk-LF6GOCSD.js";
19
19
 
20
20
  // src/managers/codex-asp/notification-dispatch.ts
21
21
  var TURN_STARTED_METHOD = "turn/started";
@@ -5,7 +5,7 @@ import {
5
5
  extractCommandProtectionCommandText,
6
6
  isRecord,
7
7
  parseCodeHostPrUrl
8
- } from "./chunk-MWEZKRAF.js";
8
+ } from "./chunk-LF6GOCSD.js";
9
9
 
10
10
  // src/services/published-pull-request-urls.ts
11
11
  function publishedPullRequestUrls(result) {
@@ -3,10 +3,10 @@ import { createRequire as __createRequire } from 'node:module';
3
3
  const require = __createRequire(import.meta.url);
4
4
  import {
5
5
  execFileAsync
6
- } from "./chunk-K4RSYNHQ.js";
6
+ } from "./chunk-PNSG42ML.js";
7
7
  import {
8
8
  isVersionBelow
9
- } from "./chunk-MWEZKRAF.js";
9
+ } from "./chunk-LF6GOCSD.js";
10
10
 
11
11
  // src/utils/codex-agent-env.ts
12
12
  function buildCodexAgentEnv(source = process.env) {
@@ -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.1345";
243
+ var ENGINE_PACKAGE_VERSION = "0.1.1347";
244
244
  var INITIALIZE_METHOD = "initialize";
245
245
  var INITIALIZED_NOTIFICATION = "initialized";
246
246
  var ACCOUNT_LOGIN_START_METHOD = "account/login/start";
@@ -19530,6 +19530,13 @@ var HOSTED_COMPOSIO_PLUGINS = HOSTED_COMPOSIO_PLUGIN_DEFINITIONS.map(
19530
19530
  })
19531
19531
  );
19532
19532
  var READ_ONLY_SCOPES = {
19533
+ gmail: ["https://www.googleapis.com/auth/userinfo.email", "https://www.googleapis.com/auth/userinfo.profile", "https://www.googleapis.com/auth/contacts.readonly", "https://www.googleapis.com/auth/contacts.other.readonly", "https://www.googleapis.com/auth/gmail.readonly"],
19534
+ googledocs: ["https://www.googleapis.com/auth/userinfo.email", "https://www.googleapis.com/auth/drive.readonly", "https://www.googleapis.com/auth/documents.readonly"],
19535
+ googledrive: ["https://www.googleapis.com/auth/userinfo.email", "https://www.googleapis.com/auth/drive.readonly"],
19536
+ googlesheets: ["https://www.googleapis.com/auth/userinfo.email", "https://www.googleapis.com/auth/drive.readonly", "https://www.googleapis.com/auth/spreadsheets.readonly"],
19537
+ googleslides: ["https://www.googleapis.com/auth/userinfo.email", "https://www.googleapis.com/auth/drive.readonly", "https://www.googleapis.com/auth/presentations.readonly"],
19538
+ googlecalendar: ["https://www.googleapis.com/auth/calendar.readonly"],
19539
+ googletasks: ["https://www.googleapis.com/auth/tasks.readonly"],
19533
19540
  googlesearch: ["https://www.googleapis.com/auth/userinfo.email", "https://www.googleapis.com/auth/userinfo.profile", "https://www.googleapis.com/auth/webmasters.readonly"],
19534
19541
  googleanalytics: ["https://www.googleapis.com/auth/userinfo.profile", "https://www.googleapis.com/auth/analytics.readonly"],
19535
19542
  youtube: ["https://www.googleapis.com/auth/youtube.readonly"],
@@ -10,15 +10,15 @@ import {
10
10
  resolveDiffBase,
11
11
  runGitCommand,
12
12
  setAgentCredentialSnapshot
13
- } from "./chunk-4V6YPA4Z.js";
13
+ } from "./chunk-P3QCO4DL.js";
14
14
  import {
15
15
  AppServerProcess,
16
16
  buildCodexAgentEnv
17
- } from "./chunk-HWY6BIUJ.js";
17
+ } from "./chunk-JC3ONOS4.js";
18
18
  import {
19
19
  SUBPROCESS_MAX_BUFFER,
20
20
  execFileAsync
21
- } from "./chunk-K4RSYNHQ.js";
21
+ } from "./chunk-PNSG42ML.js";
22
22
  import {
23
23
  isRecord
24
24
  } from "./chunk-UZSNFLDQ.js";
@@ -56,7 +56,7 @@ import {
56
56
  resolveOpenAICompatibleModelsUrl,
57
57
  splitMothershipInstructions,
58
58
  withTimeout
59
- } from "./chunk-MWEZKRAF.js";
59
+ } from "./chunk-LF6GOCSD.js";
60
60
 
61
61
  // src/managers/codex-token-manager.ts
62
62
  import { promises as fs } from "fs";
@@ -319,7 +319,7 @@ var CodexTokenManager = class extends BaseRefreshManager {
319
319
  await this.applyCredentialUpdate(++this.credentialGeneration, async () => {
320
320
  await this.applyCredentialsResponse(data);
321
321
  setAgentCredentialSnapshot("codex", data);
322
- const { restartCodexAspHostIfRunning: restartCodexAspHostIfRunning2 } = await import("./asp-host-W7RZCJZ7.js");
322
+ const { restartCodexAspHostIfRunning: restartCodexAspHostIfRunning2 } = await import("./asp-host-ZKFBW7G3.js");
323
323
  await restartCodexAspHostIfRunning2();
324
324
  });
325
325
  await this.start(true);
@@ -341,7 +341,7 @@ var CodexTokenManager = class extends BaseRefreshManager {
341
341
  const accountChanged = ENGINE_ENV.REPLICAS_AGENT_CREDENTIALS.codex?.credentialId !== data.credentialId;
342
342
  await this.applyCredentialsResponse(data);
343
343
  if (restartOnChange && (accountChanged || CODEX_AUTH_ENV_KEYS.some((key, index) => process.env[key] !== previousEnv[index]))) {
344
- const { restartCodexAspHostIfRunning: restartCodexAspHostIfRunning2 } = await import("./asp-host-W7RZCJZ7.js");
344
+ const { restartCodexAspHostIfRunning: restartCodexAspHostIfRunning2 } = await import("./asp-host-ZKFBW7G3.js");
345
345
  await restartCodexAspHostIfRunning2();
346
346
  }
347
347
  setAgentCredentialSnapshot("codex", data);
@@ -813,8 +813,12 @@ var GitService = class {
813
813
  async refreshRepos(observedBranchesByRepo) {
814
814
  const discovered = await this.listTrackedRepositories();
815
815
  const states = [];
816
+ const prLookupsByGitDir = /* @__PURE__ */ new Map();
816
817
  for (const repo of discovered.repos) {
817
818
  try {
819
+ const gitDir = await runGitCommand(["rev-parse", "--path-format=absolute", "--git-common-dir"], repo.path).catch(() => repo.path);
820
+ const prLookups = prLookupsByGitDir.get(gitDir) ?? /* @__PURE__ */ new Map();
821
+ prLookupsByGitDir.set(gitDir, prLookups);
818
822
  const persistedState = await loadRepoState(repo.name);
819
823
  const currentBranch = await getCurrentBranch(repo.path) ?? repo.defaultBranch;
820
824
  const startHooksCompleted = persistedState?.startHooksCompleted ?? false;
@@ -827,7 +831,8 @@ var GitService = class {
827
831
  currentBranch,
828
832
  startHooksCompleted,
829
833
  persistedState,
830
- observed
834
+ observed,
835
+ prLookups
831
836
  );
832
837
  states.push(state);
833
838
  } catch {
@@ -1023,7 +1028,7 @@ Binary files /dev/null and ${quote(`b/${path2}`)} differ
1023
1028
  return "";
1024
1029
  }
1025
1030
  }
1026
- async getPullRequestUrl(repoName, repoPath, currentBranchArg, persistedRepoStateArg) {
1031
+ async getPullRequestUrl(repoName, repoPath, prLookups, currentBranchArg, persistedRepoStateArg) {
1027
1032
  try {
1028
1033
  const currentBranch = currentBranchArg ?? await getCurrentBranch(repoPath);
1029
1034
  if (!currentBranch) {
@@ -1035,7 +1040,7 @@ Binary files /dev/null and ${quote(`b/${path2}`)} differ
1035
1040
  }
1036
1041
  const persistedRepoState = persistedRepoStateArg ?? await loadRepoState(repoName);
1037
1042
  this.cachedPrByRepo.delete(repoName);
1038
- const result = await this.lookupPrOnRemote(repoName, repoPath, currentBranch);
1043
+ const result = await this.lookupPrOnce(prLookups, repoName, repoPath, currentBranch);
1039
1044
  if (result.status === "found") {
1040
1045
  this.cachedPrByRepo.set(repoName, { prUrl: result.url, currentBranch });
1041
1046
  if (persistedRepoState && !persistedRepoState.prUrls.includes(result.url)) {
@@ -1052,6 +1057,14 @@ Binary files /dev/null and ${quote(`b/${path2}`)} differ
1052
1057
  return { status: "error" };
1053
1058
  }
1054
1059
  }
1060
+ lookupPrOnce(prLookups, repoName, repoPath, branch) {
1061
+ let lookup = prLookups.get(branch);
1062
+ if (!lookup) {
1063
+ lookup = this.lookupPrOnRemote(repoName, repoPath, branch);
1064
+ prLookups.set(branch, lookup);
1065
+ }
1066
+ return lookup;
1067
+ }
1055
1068
  async lookupPrOnRemote(repoName, repoPath, branch) {
1056
1069
  const origin = await this.getOriginInfo(repoPath);
1057
1070
  if (origin.provider === "unknown") {
@@ -1197,20 +1210,18 @@ Binary files /dev/null and ${quote(`b/${path2}`)} differ
1197
1210
  }
1198
1211
  return "main";
1199
1212
  }
1200
- async refreshRepoMetadata(repo, currentBranch, startHooksCompleted, persistedState, observedBranches) {
1213
+ async refreshRepoMetadata(repo, currentBranch, startHooksCompleted, persistedState, observedBranches, prLookups) {
1201
1214
  const notFound = { status: "not_found" };
1202
- const prResult = currentBranch === repo.defaultBranch ? notFound : await this.getPullRequestUrl(repo.name, repo.path, currentBranch, persistedState);
1215
+ const prResult = currentBranch === repo.defaultBranch ? notFound : await this.getPullRequestUrl(repo.name, repo.path, prLookups, currentBranch, persistedState);
1203
1216
  let prUrls = persistedState?.prUrls ?? [];
1204
1217
  if (prResult.status === "found") {
1205
1218
  prUrls = appendUniqueUrl(prUrls, prResult.url);
1206
1219
  }
1207
- if (observedBranches) {
1208
- for (const branch of observedBranches) {
1209
- if (branch === currentBranch || branch === repo.defaultBranch) continue;
1210
- const branchResult = await this.lookupPrOnRemote(repo.name, repo.path, branch);
1211
- if (branchResult.status === "found") {
1212
- prUrls = appendUniqueUrl(prUrls, branchResult.url);
1213
- }
1220
+ for (const branch of observedBranches) {
1221
+ if (branch === currentBranch || branch === repo.defaultBranch) continue;
1222
+ const branchResult = await this.lookupPrOnce(prLookups, repo.name, repo.path, branch);
1223
+ if (branchResult.status === "found") {
1224
+ prUrls = appendUniqueUrl(prUrls, branchResult.url);
1214
1225
  }
1215
1226
  }
1216
1227
  const state = {
@@ -4,7 +4,7 @@ const require = __createRequire(import.meta.url);
4
4
  import {
5
5
  SUBPROCESS_MAX_BUFFER,
6
6
  execFileAsync
7
- } from "./chunk-K4RSYNHQ.js";
7
+ } from "./chunk-PNSG42ML.js";
8
8
  import {
9
9
  isRecord as isRecord2
10
10
  } from "./chunk-UZSNFLDQ.js";
@@ -21,7 +21,7 @@ import {
21
21
  provisionedDeviceSchema,
22
22
  readReplicasRuntimeEnv,
23
23
  serializePosixEnvFile
24
- } from "./chunk-MWEZKRAF.js";
24
+ } from "./chunk-LF6GOCSD.js";
25
25
 
26
26
  // src/runtime-env-loader.ts
27
27
  import { readFileSync } from "fs";
@@ -3,7 +3,7 @@ import { createRequire as __createRequire } from 'node:module';
3
3
  const require = __createRequire(import.meta.url);
4
4
  import {
5
5
  HOOK_EXEC_MAX_BUFFER_BYTES
6
- } from "./chunk-MWEZKRAF.js";
6
+ } from "./chunk-LF6GOCSD.js";
7
7
 
8
8
  // src/utils/exec.ts
9
9
  import { exec, execFile } from "child_process";
@@ -6,7 +6,7 @@ import {
6
6
  getOriginDefaultBranch,
7
7
  monolithRequest,
8
8
  runGitCommand
9
- } from "./chunk-4V6YPA4Z.js";
9
+ } from "./chunk-P3QCO4DL.js";
10
10
  import {
11
11
  extractCommandProtectionCommandText,
12
12
  findCommandProtectionGitLookups,
@@ -14,7 +14,7 @@ import {
14
14
  findPrMergeSignals,
15
15
  findScoutRepoWriteSignals,
16
16
  parseCommandProtectionRequest
17
- } from "./chunk-MWEZKRAF.js";
17
+ } from "./chunk-LF6GOCSD.js";
18
18
 
19
19
  // src/services/command-protection-service.ts
20
20
  import { readFile, stat } from "fs/promises";
@@ -3,13 +3,13 @@ import { createRequire as __createRequire } from 'node:module';
3
3
  const require = __createRequire(import.meta.url);
4
4
  import {
5
5
  evaluateCommandProtection
6
- } from "./chunk-YIE3GR5U.js";
7
- import "./chunk-4V6YPA4Z.js";
8
- import "./chunk-K4RSYNHQ.js";
6
+ } from "./chunk-YIECSGSX.js";
7
+ import "./chunk-P3QCO4DL.js";
8
+ import "./chunk-PNSG42ML.js";
9
9
  import {
10
10
  isRecord
11
11
  } from "./chunk-UZSNFLDQ.js";
12
- import "./chunk-MWEZKRAF.js";
12
+ import "./chunk-LF6GOCSD.js";
13
13
  import "./chunk-VEQXQN22.js";
14
14
 
15
15
  // src/command-protection-hook.ts
@@ -14,12 +14,12 @@ import {
14
14
  recoverCompletedTurn,
15
15
  spawnMuseMsp,
16
16
  startMuseSession
17
- } from "./chunk-NFCTHJYW.js";
17
+ } from "./chunk-7AQY7AC4.js";
18
18
  import {
19
19
  AppServerProcess,
20
20
  buildCodexAgentEnv
21
- } from "./chunk-HWY6BIUJ.js";
22
- import "./chunk-K4RSYNHQ.js";
21
+ } from "./chunk-JC3ONOS4.js";
22
+ import "./chunk-PNSG42ML.js";
23
23
  import {
24
24
  AGENT,
25
25
  OPENCODE_GO_PROVIDER,
@@ -29,7 +29,7 @@ import {
29
29
  headlessAgentUsagePath,
30
30
  isRecord,
31
31
  withTimeout
32
- } from "./chunk-MWEZKRAF.js";
32
+ } from "./chunk-LF6GOCSD.js";
33
33
  import "./chunk-VEQXQN22.js";
34
34
 
35
35
  // src/headless-agent.ts
package/dist/src/index.js CHANGED
@@ -27,7 +27,7 @@ import {
27
27
  evaluateCommandProtection,
28
28
  extractToolCommand,
29
29
  reportCommandProtectionBlock
30
- } from "./chunk-YIE3GR5U.js";
30
+ } from "./chunk-YIECSGSX.js";
31
31
  import {
32
32
  ACCOUNT_RATE_LIMITS_UPDATED_METHOD,
33
33
  AGENT_MESSAGE_DELTA_METHOD,
@@ -65,10 +65,10 @@ import {
65
65
  spawnMuseMsp,
66
66
  startMuseSession,
67
67
  uuidV7
68
- } from "./chunk-NFCTHJYW.js";
68
+ } from "./chunk-7AQY7AC4.js";
69
69
  import {
70
70
  publishedPullRequestUrls
71
- } from "./chunk-FUQSZYDZ.js";
71
+ } from "./chunk-CLDKZEWN.js";
72
72
  import {
73
73
  ACCOUNT_RATE_LIMITS_READ_METHOD,
74
74
  AsyncLock,
@@ -143,7 +143,7 @@ import {
143
143
  timestampFromSeconds,
144
144
  upsertCredentialFileLines,
145
145
  writeSecureCredentialFile
146
- } from "./chunk-S7YTEUA6.js";
146
+ } from "./chunk-N5XRHGDO.js";
147
147
  import {
148
148
  ENGINE_ENV,
149
149
  monolithRequest,
@@ -153,15 +153,15 @@ import {
153
153
  resolveDiffBase,
154
154
  setAgentCredentialSnapshot,
155
155
  setLinearSessionId
156
- } from "./chunk-4V6YPA4Z.js";
156
+ } from "./chunk-P3QCO4DL.js";
157
157
  import {
158
158
  getCodexModelProvider
159
- } from "./chunk-HWY6BIUJ.js";
159
+ } from "./chunk-JC3ONOS4.js";
160
160
  import {
161
161
  SUBPROCESS_MAX_BUFFER,
162
162
  execAsync,
163
163
  execFileAsync
164
- } from "./chunk-K4RSYNHQ.js";
164
+ } from "./chunk-PNSG42ML.js";
165
165
  import {
166
166
  isRecord as isRecord2
167
167
  } from "./chunk-UZSNFLDQ.js";
@@ -419,7 +419,7 @@ import {
419
419
  workspaceTokenRequestSchema,
420
420
  workspaceTokenResponseSchema,
421
421
  wrapInTag
422
- } from "./chunk-MWEZKRAF.js";
422
+ } from "./chunk-LF6GOCSD.js";
423
423
  import {
424
424
  cloneMcpConfig,
425
425
  ensureCompatibilityImports,
@@ -3,13 +3,13 @@ import { createRequire as __createRequire } from 'node:module';
3
3
  const require = __createRequire(import.meta.url);
4
4
  import {
5
5
  publishedPullRequestUrls
6
- } from "./chunk-FUQSZYDZ.js";
6
+ } from "./chunk-CLDKZEWN.js";
7
7
  import {
8
8
  isRecord
9
9
  } from "./chunk-UZSNFLDQ.js";
10
10
  import {
11
11
  shouldRefreshPullRequests
12
- } from "./chunk-MWEZKRAF.js";
12
+ } from "./chunk-LF6GOCSD.js";
13
13
  import "./chunk-VEQXQN22.js";
14
14
 
15
15
  // src/services/post-tool-pr-notifier.ts
@@ -11,7 +11,7 @@ import {
11
11
  spawnSubagentRequestSchema,
12
12
  subagentResponseSchema,
13
13
  waitSubagentRequestSchema
14
- } from "./chunk-MWEZKRAF.js";
14
+ } from "./chunk-LF6GOCSD.js";
15
15
  import "./chunk-VEQXQN22.js";
16
16
 
17
17
  // src/subagent-mcp.ts
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "replicas-engine",
3
- "version": "0.1.1345",
3
+ "version": "0.1.1347",
4
4
  "description": "Lightweight API server for Replicas workspaces",
5
5
  "type": "module",
6
6
  "main": "dist/src/index.js",