replicas-engine 0.1.807 → 0.1.808

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.
@@ -5,11 +5,11 @@ import {
5
5
  getCodexAspHost,
6
6
  restartCodexAspHost,
7
7
  restartCodexAspHostIfRunning
8
- } from "./chunk-MIUAPV6Z.js";
9
- import "./chunk-6TQWCSXK.js";
10
- import "./chunk-3WK3ANOY.js";
8
+ } from "./chunk-O5GDQVDK.js";
9
+ import "./chunk-UZBBWR4Y.js";
10
+ import "./chunk-SWDDK3W4.js";
11
11
  import "./chunk-UZSNFLDQ.js";
12
- import "./chunk-RBSDAHZ7.js";
12
+ import "./chunk-3UST72O7.js";
13
13
  import "./chunk-VEQXQN22.js";
14
14
  export {
15
15
  getCodexAspHost,
@@ -7333,6 +7333,56 @@ var AUTOMATION_DEBOUNCE_MAX_SECONDS = 24 * 60 * 60;
7333
7333
 
7334
7334
  // ../shared/src/routes/repo-files.ts
7335
7335
  var MAX_REPO_FILE_CONTENT_BYTES = 256 * 1024;
7336
+ function searchRepoFileIndex(repos, params, multiRepo) {
7337
+ const { q = "", prefix = "" } = params;
7338
+ const limit = Math.min(Math.max(Number.isNaN(params.limit) ? 50 : params.limit ?? 50, 1), 5e3);
7339
+ let offset = 0;
7340
+ try {
7341
+ offset = Math.max(0, parseInt(atob(params.cursor ?? ""), 10) || 0);
7342
+ } catch {
7343
+ offset = 0;
7344
+ }
7345
+ const files = [];
7346
+ for (const repo of repos) {
7347
+ for (const path of repo.paths) {
7348
+ if (prefix && !path.startsWith(prefix)) continue;
7349
+ const score = q ? scoreRepoFileMatch(q, path) : 0;
7350
+ if (q && !score) continue;
7351
+ files.push({
7352
+ repoName: repo.name,
7353
+ path,
7354
+ displayPath: multiRepo ? `${repo.name}/${path}` : path,
7355
+ status: repo.changedPaths.has(path) ? "changed" : "untouched",
7356
+ score,
7357
+ indexedAt: repo.indexedAt,
7358
+ stale: repo.stale
7359
+ });
7360
+ }
7361
+ }
7362
+ files.sort((a, b) => b.score - a.score || a.displayPath.localeCompare(b.displayPath));
7363
+ return {
7364
+ files: files.slice(offset, offset + limit),
7365
+ nextCursor: offset + limit < files.length ? btoa(String(offset + limit)) : null
7366
+ };
7367
+ }
7368
+ var EXCLUDED_DIRS = /* @__PURE__ */ new Set([".git", "node_modules", ".next", "dist", "build", "out", "vendor", ".turbo", "__pycache__"]);
7369
+ function isExcludedRepoFilePath(filePath) {
7370
+ const segments = filePath.split("/");
7371
+ return segments.some((seg) => EXCLUDED_DIRS.has(seg));
7372
+ }
7373
+ function scoreRepoFileMatch(query, filePath) {
7374
+ const lowerQuery = query.toLowerCase();
7375
+ const lowerPath = filePath.toLowerCase();
7376
+ const segments = lowerPath.split("/");
7377
+ const basename = segments[segments.length - 1] ?? "";
7378
+ if (basename === lowerQuery) return 100;
7379
+ if (basename.startsWith(lowerQuery)) return 90;
7380
+ if (segments.some((seg) => seg === lowerQuery)) return 80;
7381
+ if (basename.includes(lowerQuery)) return 70;
7382
+ if (segments.some((seg) => seg.includes(lowerQuery))) return 60;
7383
+ if (lowerPath.includes(lowerQuery)) return 50;
7384
+ return 0;
7385
+ }
7336
7386
 
7337
7387
  // ../shared/src/routes/admin.ts
7338
7388
  var WEBHOOK_PROVIDERS = ["linear", "github", "gitlab", "slack", "e2b", "stripe", "sentry"];
@@ -7833,6 +7883,8 @@ export {
7833
7883
  findGitCommitSignals,
7834
7884
  mayCreatePullRequest,
7835
7885
  MAX_REPO_FILE_CONTENT_BYTES,
7886
+ searchRepoFileIndex,
7887
+ isExcludedRepoFilePath,
7836
7888
  formatChatForkHandoffMessage,
7837
7889
  readJsonlPage,
7838
7890
  getChatTranscriptHistorySize,
@@ -3,12 +3,12 @@ import { createRequire as __createRequire } from 'node:module';
3
3
  const require = __createRequire(import.meta.url);
4
4
  import {
5
5
  monolithRequest
6
- } from "./chunk-6TQWCSXK.js";
6
+ } from "./chunk-UZBBWR4Y.js";
7
7
  import {
8
8
  extractCommandProtectionCommandText,
9
9
  findGitCommitSignals,
10
10
  findPrMergeSignals
11
- } from "./chunk-RBSDAHZ7.js";
11
+ } from "./chunk-3UST72O7.js";
12
12
 
13
13
  // src/services/command-protection-service.ts
14
14
  var DEFAULT_COMMAND_PROTECTION_BLOCK_MESSAGE = "Blocked by Replicas command protection.";
@@ -5,18 +5,18 @@ import {
5
5
  ENGINE_ENV,
6
6
  monolithRequest,
7
7
  setAgentCredentialSnapshot
8
- } from "./chunk-6TQWCSXK.js";
8
+ } from "./chunk-UZBBWR4Y.js";
9
9
  import {
10
10
  AppServerProcess,
11
11
  buildCodexAgentEnv
12
- } from "./chunk-3WK3ANOY.js";
12
+ } from "./chunk-SWDDK3W4.js";
13
13
  import {
14
14
  CODEX_AUTH_ENV_KEYS,
15
15
  CODEX_AUTH_ENV_KEYS_BY_METHOD,
16
16
  codexAuthEnvFromResponse,
17
17
  createErrorResult,
18
18
  createSuccessResult
19
- } from "./chunk-RBSDAHZ7.js";
19
+ } from "./chunk-3UST72O7.js";
20
20
 
21
21
  // src/managers/codex-token-manager.ts
22
22
  import { promises as fs } from "fs";
@@ -232,7 +232,7 @@ var CodexTokenManager = class extends BaseRefreshManager {
232
232
  const data = await response.json();
233
233
  await this.applyCredentialsResponse(data);
234
234
  if (restartOnChange && CODEX_AUTH_ENV_KEYS.some((key, index) => process.env[key] !== previousEnv[index])) {
235
- const { restartCodexAspHostIfRunning: restartCodexAspHostIfRunning2 } = await import("./asp-host-H6VJKOAE.js");
235
+ const { restartCodexAspHostIfRunning: restartCodexAspHostIfRunning2 } = await import("./asp-host-R7AQCACD.js");
236
236
  await restartCodexAspHostIfRunning2();
237
237
  }
238
238
  if (data.scope) {
@@ -4,7 +4,7 @@ const require = __createRequire(import.meta.url);
4
4
  import {
5
5
  findCodeHostPullRequestUrls,
6
6
  mayCreatePullRequest
7
- } from "./chunk-RBSDAHZ7.js";
7
+ } from "./chunk-3UST72O7.js";
8
8
 
9
9
  // src/services/post-tool-pr-notifier.ts
10
10
  async function notifyPostToolUse(toolName, toolInput, toolResult) {
@@ -4,7 +4,7 @@ const require = __createRequire(import.meta.url);
4
4
  import {
5
5
  HOOK_EXEC_MAX_BUFFER_BYTES,
6
6
  isVersionBelow
7
- } from "./chunk-RBSDAHZ7.js";
7
+ } from "./chunk-3UST72O7.js";
8
8
 
9
9
  // src/utils/codex-agent-env.ts
10
10
  function buildCodexAgentEnv(source = process.env) {
@@ -241,7 +241,7 @@ var DEFAULT_CODEX_ARGS = [
241
241
  var MIN_CODEX_CLI_VERSION = "0.153.3";
242
242
  var CODEX_UPGRADE_TIMEOUT_MS = 12e4;
243
243
  var codexCliVersionEnsured = null;
244
- var ENGINE_PACKAGE_VERSION = "0.1.807";
244
+ var ENGINE_PACKAGE_VERSION = "0.1.808";
245
245
  var INITIALIZE_METHOD = "initialize";
246
246
  var INITIALIZED_NOTIFICATION = "initialized";
247
247
  var ACCOUNT_LOGIN_START_METHOD = "account/login/start";
@@ -15,7 +15,7 @@ import {
15
15
  isValidRelayBaseProvider,
16
16
  parsePosixEnvFile,
17
17
  readReplicasRuntimeEnv
18
- } from "./chunk-RBSDAHZ7.js";
18
+ } from "./chunk-3UST72O7.js";
19
19
 
20
20
  // src/engine-env.ts
21
21
  import { readFileSync as readFileSync2 } from "fs";
@@ -3,12 +3,12 @@ import { createRequire as __createRequire } from 'node:module';
3
3
  const require = __createRequire(import.meta.url);
4
4
  import {
5
5
  evaluateCommandProtection
6
- } from "./chunk-RKEFQSWQ.js";
7
- import "./chunk-6TQWCSXK.js";
6
+ } from "./chunk-5HT3IG4K.js";
7
+ import "./chunk-UZBBWR4Y.js";
8
8
  import {
9
9
  isRecord
10
10
  } from "./chunk-UZSNFLDQ.js";
11
- import "./chunk-RBSDAHZ7.js";
11
+ import "./chunk-3UST72O7.js";
12
12
  import "./chunk-VEQXQN22.js";
13
13
 
14
14
  // src/command-protection-hook.ts
@@ -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-RKEFQSWQ.js";
6
+ } from "./chunk-5HT3IG4K.js";
7
7
  import {
8
8
  notifyPostToolUse
9
- } from "./chunk-O57ARVYZ.js";
10
- import "./chunk-6TQWCSXK.js";
9
+ } from "./chunk-SLISH4VD.js";
10
+ import "./chunk-UZBBWR4Y.js";
11
11
  import "./chunk-UZSNFLDQ.js";
12
- import "./chunk-RBSDAHZ7.js";
12
+ import "./chunk-3UST72O7.js";
13
13
  import "./chunk-VEQXQN22.js";
14
14
 
15
15
  // src/deepseek-command-protection-plugin.ts
@@ -8,12 +8,12 @@ import {
8
8
  import {
9
9
  AppServerProcess,
10
10
  buildCodexAgentEnv
11
- } from "./chunk-3WK3ANOY.js";
11
+ } from "./chunk-SWDDK3W4.js";
12
12
  import {
13
13
  AGENT,
14
14
  getMemoryOutputSafetyViolation,
15
15
  headlessAgentRequestSchema
16
- } from "./chunk-RBSDAHZ7.js";
16
+ } from "./chunk-3UST72O7.js";
17
17
  import "./chunk-VEQXQN22.js";
18
18
 
19
19
  // src/headless-agent.ts
package/dist/src/index.js CHANGED
@@ -91,7 +91,7 @@ import {
91
91
  evaluateCommandProtection,
92
92
  extractToolCommand,
93
93
  reportCommandProtectionBlock
94
- } from "./chunk-RKEFQSWQ.js";
94
+ } from "./chunk-5HT3IG4K.js";
95
95
  import {
96
96
  ACCOUNT_RATE_LIMITS_UPDATED_METHOD,
97
97
  AGENT_MESSAGE_DELTA_METHOD,
@@ -124,20 +124,20 @@ import {
124
124
  recordCredentialFallback,
125
125
  recordExhaustedCredential,
126
126
  restartCodexAspHost
127
- } from "./chunk-MIUAPV6Z.js";
127
+ } from "./chunk-O5GDQVDK.js";
128
128
  import {
129
129
  ENGINE_ENV,
130
130
  IS_WARMING_MODE,
131
131
  monolithRequest,
132
132
  monolithService,
133
133
  setAgentCredentialSnapshot
134
- } from "./chunk-6TQWCSXK.js";
134
+ } from "./chunk-UZBBWR4Y.js";
135
135
  import {
136
136
  AspClient,
137
137
  SUBPROCESS_MAX_BUFFER,
138
138
  execAsync,
139
139
  execFileAsync
140
- } from "./chunk-3WK3ANOY.js";
140
+ } from "./chunk-SWDDK3W4.js";
141
141
  import {
142
142
  isRecord as isRecord2
143
143
  } from "./chunk-UZSNFLDQ.js";
@@ -297,6 +297,7 @@ import {
297
297
  isCodexAspTranscriptDelta,
298
298
  isCodexAuthError,
299
299
  isDefaultChat,
300
+ isExcludedRepoFilePath,
300
301
  isGitHubUrl,
301
302
  isLatestChatHistoryPage,
302
303
  isNonEmptyString,
@@ -334,6 +335,7 @@ import {
334
335
  renumberCodexAspTranscriptItems,
335
336
  resolveWarmHookConfig,
336
337
  sanitizeCanvasFilename,
338
+ searchRepoFileIndex,
337
339
  sendChatMessageRequestSchema,
338
340
  serializeCanvasContentResponse,
339
341
  serializeMuseAuthFile,
@@ -341,7 +343,7 @@ import {
341
343
  spawnRelaySubagentRequestSchema,
342
344
  stripAgentDiagnosticErrors,
343
345
  withTimeout
344
- } from "./chunk-RBSDAHZ7.js";
346
+ } from "./chunk-3UST72O7.js";
345
347
  import {
346
348
  __commonJS,
347
349
  __export,
@@ -62921,9 +62923,6 @@ var LanguageServerService = class {
62921
62923
  // src/services/repo-file-service.ts
62922
62924
  var CACHE_TTL_MS2 = 3e4;
62923
62925
  var SEARCH_TIMEOUT_MS = 15e3;
62924
- var DEFAULT_LIMIT = 50;
62925
- var MAX_LIMIT = 5e3;
62926
- var EXCLUDED_DIRS = /* @__PURE__ */ new Set([".git", "node_modules", ".next", "dist", "build", "out", "vendor", ".turbo", "__pycache__"]);
62927
62926
  function isBinaryExtension(filePath) {
62928
62927
  const ext = extname3(filePath).toLowerCase();
62929
62928
  const binaryExts = /* @__PURE__ */ new Set([
@@ -62961,23 +62960,6 @@ function isBinaryExtension(filePath) {
62961
62960
  ]);
62962
62961
  return classifyCanvasFilename(filePath).kind === "image" || binaryExts.has(ext);
62963
62962
  }
62964
- function isExcludedPath(filePath) {
62965
- const segments = filePath.split("/");
62966
- return segments.some((seg) => EXCLUDED_DIRS.has(seg));
62967
- }
62968
- function scoreMatch(query2, filePath) {
62969
- const lowerQuery = query2.toLowerCase();
62970
- const lowerPath = filePath.toLowerCase();
62971
- const segments = lowerPath.split("/");
62972
- const basename5 = segments[segments.length - 1] ?? "";
62973
- if (basename5 === lowerQuery) return 100;
62974
- if (basename5.startsWith(lowerQuery)) return 90;
62975
- if (segments.some((seg) => seg === lowerQuery)) return 80;
62976
- if (basename5.includes(lowerQuery)) return 70;
62977
- if (segments.some((seg) => seg.includes(lowerQuery))) return 60;
62978
- if (lowerPath.includes(lowerQuery)) return 50;
62979
- return 0;
62980
- }
62981
62963
  function execGitAsync(args, cwd, timeoutMs) {
62982
62964
  return new Promise((resolve7, reject) => {
62983
62965
  const child = execFile7("git", args, {
@@ -63005,10 +62987,7 @@ var RepoFileService = class {
63005
62987
  this.gitService = gitService2;
63006
62988
  }
63007
62989
  async search(params) {
63008
- const { q = "", prefix = "", refresh = false } = params;
63009
- const limit = Math.min(Math.max(params.limit ?? DEFAULT_LIMIT, 1), MAX_LIMIT);
63010
- const parsedOffset = params.cursor ? parseInt(Buffer.from(params.cursor, "base64").toString(), 10) : 0;
63011
- const offset = Number.isNaN(parsedOffset) ? 0 : parsedOffset;
62990
+ const { refresh = false } = params;
63012
62991
  let stale = false;
63013
62992
  let indexedAt = "";
63014
62993
  try {
@@ -63025,7 +63004,7 @@ var RepoFileService = class {
63025
63004
  }
63026
63005
  const repos = await this.gitService.listRepositories();
63027
63006
  const multiRepo = repos.length > 1;
63028
- const allResults = [];
63007
+ const indexes = [];
63029
63008
  for (const repo of repos) {
63030
63009
  const cached = this.cache.get(repo.name);
63031
63010
  if (!cached) continue;
@@ -63034,31 +63013,16 @@ var RepoFileService = class {
63034
63013
  }
63035
63014
  const isStale = Date.now() - cached.timestamp > CACHE_TTL_MS2;
63036
63015
  if (isStale) stale = true;
63037
- for (const filePath of cached.files) {
63038
- if (prefix && !filePath.startsWith(prefix)) continue;
63039
- let score = 0;
63040
- if (q) {
63041
- score = scoreMatch(q, filePath);
63042
- if (score === 0) continue;
63043
- }
63044
- allResults.push({
63045
- repoName: repo.name,
63046
- path: filePath,
63047
- displayPath: multiRepo ? `${repo.name}/${filePath}` : filePath,
63048
- status: cached.changedFiles.has(filePath) ? "changed" : "untouched",
63049
- score,
63050
- indexedAt: new Date(cached.timestamp).toISOString(),
63051
- stale: isStale
63052
- });
63053
- }
63016
+ indexes.push({
63017
+ name: repo.name,
63018
+ paths: cached.files,
63019
+ changedPaths: cached.changedFiles,
63020
+ indexedAt: new Date(cached.timestamp).toISOString(),
63021
+ stale: isStale
63022
+ });
63054
63023
  }
63055
- allResults.sort((a, b) => q ? b.score - a.score || a.displayPath.localeCompare(b.displayPath) : a.displayPath.localeCompare(b.displayPath));
63056
- const paged = allResults.slice(offset, offset + limit);
63057
- const nextOffset = offset + limit;
63058
- const nextCursor = nextOffset < allResults.length ? Buffer.from(String(nextOffset)).toString("base64") : null;
63059
63024
  return {
63060
- files: paged,
63061
- nextCursor,
63025
+ ...searchRepoFileIndex(indexes, params, multiRepo),
63062
63026
  indexedAt: indexedAt || (/* @__PURE__ */ new Date()).toISOString(),
63063
63027
  stale
63064
63028
  };
@@ -63224,7 +63188,7 @@ var RepoFileService = class {
63224
63188
  repoPath,
63225
63189
  SEARCH_TIMEOUT_MS
63226
63190
  );
63227
- return output.split("\0").filter((f) => f.length > 0 && !isExcludedPath(f));
63191
+ return output.split("\0").filter((f) => f.length > 0 && !isExcludedRepoFilePath(f));
63228
63192
  }
63229
63193
  async listChangedFiles(repoPath, defaultBranch) {
63230
63194
  const changedFiles = /* @__PURE__ */ new Set();
@@ -3,11 +3,11 @@ import { createRequire as __createRequire } from 'node:module';
3
3
  const require = __createRequire(import.meta.url);
4
4
  import {
5
5
  notifyPostToolUse
6
- } from "./chunk-O57ARVYZ.js";
6
+ } from "./chunk-SLISH4VD.js";
7
7
  import {
8
8
  isRecord
9
9
  } from "./chunk-UZSNFLDQ.js";
10
- import "./chunk-RBSDAHZ7.js";
10
+ import "./chunk-3UST72O7.js";
11
11
  import "./chunk-VEQXQN22.js";
12
12
 
13
13
  // src/post-tool-pr-hook.ts
@@ -4,7 +4,7 @@ const require = __createRequire(import.meta.url);
4
4
  import {
5
5
  messageRelaySubagentRequestSchema,
6
6
  spawnRelaySubagentRequestSchema
7
- } from "./chunk-RBSDAHZ7.js";
7
+ } from "./chunk-3UST72O7.js";
8
8
  import "./chunk-VEQXQN22.js";
9
9
 
10
10
  // src/relay-mcp.ts
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "replicas-engine",
3
- "version": "0.1.807",
3
+ "version": "0.1.808",
4
4
  "description": "Lightweight API server for Replicas workspaces",
5
5
  "type": "module",
6
6
  "main": "dist/src/index.js",