replicas-engine 0.1.875 → 0.1.877

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-35MKYOBV.js";
9
- import "./chunk-CZLOYOGI.js";
10
- import "./chunk-YZJKOKGE.js";
8
+ } from "./chunk-DFXUDZW3.js";
9
+ import "./chunk-MOJN6DR4.js";
10
+ import "./chunk-VJQGQEZV.js";
11
11
  import "./chunk-UZSNFLDQ.js";
12
- import "./chunk-OJTGCTIK.js";
12
+ import "./chunk-NTUXPZOE.js";
13
13
  import "./chunk-VEQXQN22.js";
14
14
  export {
15
15
  getCodexAspHost,
@@ -3,7 +3,7 @@ import { createRequire as __createRequire } from 'node:module';
3
3
  const require = __createRequire(import.meta.url);
4
4
  import {
5
5
  shouldRefreshPullRequests
6
- } from "./chunk-OJTGCTIK.js";
6
+ } from "./chunk-NTUXPZOE.js";
7
7
 
8
8
  // src/services/post-tool-pr-notifier.ts
9
9
  async function notifyPostToolUse(toolName, toolInput) {
@@ -5,13 +5,13 @@ import {
5
5
  ENGINE_ENV,
6
6
  monolithRequest,
7
7
  setAgentCredentialSnapshot
8
- } from "./chunk-CZLOYOGI.js";
8
+ } from "./chunk-MOJN6DR4.js";
9
9
  import {
10
10
  AppServerProcess,
11
11
  SUBPROCESS_MAX_BUFFER,
12
12
  buildCodexAgentEnv,
13
13
  execFileAsync
14
- } from "./chunk-YZJKOKGE.js";
14
+ } from "./chunk-VJQGQEZV.js";
15
15
  import {
16
16
  isRecord
17
17
  } from "./chunk-UZSNFLDQ.js";
@@ -21,9 +21,11 @@ import {
21
21
  codexAuthEnvFromResponse,
22
22
  createErrorResult,
23
23
  createSuccessResult,
24
+ listOllamaModels,
24
25
  listOpenAICompatibleModels,
26
+ readOllamaAuthEnv,
25
27
  resolveOpenAICompatibleModelsUrl
26
- } from "./chunk-OJTGCTIK.js";
28
+ } from "./chunk-NTUXPZOE.js";
27
29
 
28
30
  // src/managers/codex-token-manager.ts
29
31
  import { promises as fs } from "fs";
@@ -244,7 +246,7 @@ var CodexTokenManager = class extends BaseRefreshManager {
244
246
  await this.applyCredentialUpdate(++this.credentialGeneration, async () => {
245
247
  await this.applyCredentialsResponse(data);
246
248
  if (data.scope) setAgentCredentialSnapshot("codex", { method: data.type, scope: data.scope, revision: data.revision });
247
- const { restartCodexAspHostIfRunning: restartCodexAspHostIfRunning2 } = await import("./asp-host-7N3BLMFU.js");
249
+ const { restartCodexAspHostIfRunning: restartCodexAspHostIfRunning2 } = await import("./asp-host-SQK3BF6S.js");
248
250
  await restartCodexAspHostIfRunning2();
249
251
  });
250
252
  await this.start(true);
@@ -264,7 +266,7 @@ var CodexTokenManager = class extends BaseRefreshManager {
264
266
  await this.applyCredentialUpdate(generation, async () => {
265
267
  await this.applyCredentialsResponse(data);
266
268
  if (restartOnChange && CODEX_AUTH_ENV_KEYS.some((key, index) => process.env[key] !== previousEnv[index])) {
267
- const { restartCodexAspHostIfRunning: restartCodexAspHostIfRunning2 } = await import("./asp-host-7N3BLMFU.js");
269
+ const { restartCodexAspHostIfRunning: restartCodexAspHostIfRunning2 } = await import("./asp-host-SQK3BF6S.js");
268
270
  await restartCodexAspHostIfRunning2();
269
271
  }
270
272
  if (data.scope) {
@@ -326,14 +328,14 @@ var CodexTokenManager = class extends BaseRefreshManager {
326
328
  }
327
329
  }
328
330
  async fetchFreshCredentials(failureReason, failureKind = "rejected", failedCredential = ENGINE_ENV.REPLICAS_AGENT_CREDENTIALS.codex, allowedMethods) {
329
- const failedMethod = failedCredential?.method === "oauth" || failedCredential?.method === "api_key" || failedCredential?.method === "openai-compatible" || failedCredential?.method === "foundry" ? failedCredential.method : ENGINE_ENV.REPLICAS_CODEX_AUTH_METHOD;
331
+ const failedMethod = failedCredential?.method === "ollama" || failedCredential?.method === "oauth" || failedCredential?.method === "api_key" || failedCredential?.method === "openai-compatible" || failedCredential?.method === "foundry" ? failedCredential.method : ENGINE_ENV.REPLICAS_CODEX_AUTH_METHOD;
330
332
  return this.swapCredentials({
331
333
  provider: "codex",
332
334
  failureKind,
333
335
  allowedMethods,
334
336
  refresh: async (exclusions) => {
335
337
  await this.refreshWithRequest(
336
- failedMethod === "oauth" || failedMethod === "api_key" || failedMethod === "openai-compatible" || failedMethod === "foundry" ? {
338
+ failedMethod === "ollama" || failedMethod === "oauth" || failedMethod === "api_key" || failedMethod === "openai-compatible" || failedMethod === "foundry" ? {
337
339
  failedMethod,
338
340
  ...failedCredential?.method === failedMethod ? { failedCredential } : {},
339
341
  failureReason,
@@ -393,8 +395,9 @@ var CATALOG_TTL_MS = 6e4;
393
395
  var CODEX_MODEL_CATALOG_PATH = join(tmpdir(), "replicas-openai-compatible-model-catalog.json");
394
396
  var cachedCatalog = null;
395
397
  async function writeCodexModelCatalog(modelsUrl) {
398
+ const ollama = ENGINE_ENV.REPLICAS_CODEX_AUTH_METHOD === "ollama" ? readOllamaAuthEnv("codex", process.env) : null;
396
399
  const [models, { stdout }] = await Promise.all([
397
- listOpenAICompatibleModels({
400
+ ollama ? listOllamaModels(ollama) : listOpenAICompatibleModels({
398
401
  apiKey: ENGINE_ENV.OPENAI_API_KEY,
399
402
  authorizationHeader: ENGINE_ENV.CODEX_OPENAI_AUTHORIZATION_HEADER,
400
403
  baseUrl: ENGINE_ENV.CODEX_OPENAI_BASE_URL ?? "",
@@ -408,6 +411,7 @@ async function writeCodexModelCatalog(modelsUrl) {
408
411
  await writeFile(CODEX_MODEL_CATALOG_PATH, JSON.stringify({
409
412
  models: models.flatMap((model) => model.contextWindow ? [{
410
413
  ...template,
414
+ ...ollama ? { apply_patch_tool_type: null, support_verbosity: false, supports_search_tool: false, input_modalities: ["text"] } : {},
411
415
  slug: model.id,
412
416
  display_name: model.displayName,
413
417
  description: model.description ?? model.displayName,
@@ -423,7 +427,7 @@ async function writeCodexModelCatalog(modelsUrl) {
423
427
  ];
424
428
  }
425
429
  async function getOpenAICompatibleCodexModelCatalogConfig() {
426
- if (ENGINE_ENV.REPLICAS_CODEX_AUTH_METHOD !== "openai-compatible" || !ENGINE_ENV.CODEX_OPENAI_BASE_URL) return [];
430
+ if (ENGINE_ENV.REPLICAS_CODEX_AUTH_METHOD !== "openai-compatible" && ENGINE_ENV.REPLICAS_CODEX_AUTH_METHOD !== "ollama" || !ENGINE_ENV.CODEX_OPENAI_BASE_URL) return [];
427
431
  const modelsUrl = resolveOpenAICompatibleModelsUrl({
428
432
  baseUrl: ENGINE_ENV.CODEX_OPENAI_BASE_URL,
429
433
  modelsUrl: ENGINE_ENV.CODEX_OPENAI_MODELS_URL ?? ""
@@ -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-CZLOYOGI.js";
6
+ } from "./chunk-MOJN6DR4.js";
7
7
  import {
8
8
  extractCommandProtectionCommandText,
9
9
  findGitCommitSignals,
10
10
  findPrMergeSignals
11
- } from "./chunk-OJTGCTIK.js";
11
+ } from "./chunk-NTUXPZOE.js";
12
12
 
13
13
  // src/services/command-protection-service.ts
14
14
  var DEFAULT_COMMAND_PROTECTION_BLOCK_MESSAGE = "Blocked by Replicas command protection.";
@@ -15,7 +15,7 @@ import {
15
15
  isValidRelayBaseProvider,
16
16
  parsePosixEnvFile,
17
17
  readReplicasRuntimeEnv
18
- } from "./chunk-OJTGCTIK.js";
18
+ } from "./chunk-NTUXPZOE.js";
19
19
 
20
20
  // src/engine-env.ts
21
21
  import { readFileSync as readFileSync2 } from "fs";
@@ -78,13 +78,13 @@ function requireValidURL(value, name) {
78
78
  }
79
79
  }
80
80
  function parseClaudeAuthMethod(value) {
81
- if (value === "oauth" || value === "api_key" || value === "bedrock" || value === "foundry") {
81
+ if (value === "ollama" || value === "oauth" || value === "api_key" || value === "bedrock" || value === "foundry") {
82
82
  return value;
83
83
  }
84
84
  return void 0;
85
85
  }
86
86
  function parseCodexAuthMethod(value) {
87
- if (value === "oauth" || value === "api_key" || value === "openai-compatible" || value === "foundry") {
87
+ if (value === "ollama" || value === "oauth" || value === "api_key" || value === "openai-compatible" || value === "foundry") {
88
88
  return value;
89
89
  }
90
90
  return void 0;