replicas-engine 0.1.591 → 0.1.592

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 +17 -6
  2. package/package.json +1 -1
package/dist/src/index.js CHANGED
@@ -5621,6 +5621,7 @@ var SUBPROCESS_MAX_BUFFER = HOOK_EXEC_MAX_BUFFER_BYTES;
5621
5621
  import path from "path";
5622
5622
 
5623
5623
  // src/engine-env.ts
5624
+ import { readFileSync as readFileSync2 } from "fs";
5624
5625
  import { homedir as homedir2 } from "os";
5625
5626
  import { join as join2 } from "path";
5626
5627
 
@@ -5646,10 +5647,20 @@ function isRecord4(value) {
5646
5647
  }
5647
5648
 
5648
5649
  // src/engine-env.ts
5650
+ var SANDBOX_IMAGE_VERSION_FILE = "/usr/local/lib/replicas-sandbox-image-version";
5649
5651
  function readEnv(name) {
5650
5652
  const value = process.env[name]?.trim();
5651
5653
  return value ? value : void 0;
5652
5654
  }
5655
+ function readSandboxImageVersion() {
5656
+ const environmentVersion = readEnv("REPLICAS_SANDBOX_IMAGE_VERSION");
5657
+ if (environmentVersion) return environmentVersion;
5658
+ try {
5659
+ return readFileSync2(SANDBOX_IMAGE_VERSION_FILE, "utf8").trim() || "development";
5660
+ } catch {
5661
+ return "development";
5662
+ }
5663
+ }
5653
5664
  function parsePort(value) {
5654
5665
  if (!value) {
5655
5666
  return 3737;
@@ -5717,7 +5728,7 @@ function loadEngineEnv() {
5717
5728
  ),
5718
5729
  HOME_DIR,
5719
5730
  WORKSPACE_ROOT: join2(HOME_DIR, "workspaces"),
5720
- REPLICAS_SANDBOX_IMAGE_VERSION: readEnv("REPLICAS_SANDBOX_IMAGE_VERSION") ?? "development",
5731
+ REPLICAS_SANDBOX_IMAGE_VERSION: readSandboxImageVersion(),
5721
5732
  // Runtime: may not be set during warming
5722
5733
  REPLICAS_WORKSPACE_ID: readReplicasRuntimeEnv(readEnv, REPLICAS_RUNTIME_ENV_ALIASES.workspaceId),
5723
5734
  REPLICAS_LINEAR_SESSION_ID: readReplicasRuntimeEnv(readEnv, REPLICAS_RUNTIME_ENV_ALIASES.linearSessionId),
@@ -6105,7 +6116,7 @@ async function saveRepoState(repoName, state, fallbackState) {
6105
6116
  }
6106
6117
 
6107
6118
  // src/git/commands.ts
6108
- import { readFileSync as readFileSync2 } from "fs";
6119
+ import { readFileSync as readFileSync3 } from "fs";
6109
6120
  import { join as join5 } from "path";
6110
6121
  async function runGitCommand(args, cwd, options = {}) {
6111
6122
  const { stdout } = await execFileAsync("git", args, {
@@ -6117,7 +6128,7 @@ async function runGitCommand(args, cwd, options = {}) {
6117
6128
  }
6118
6129
  function readRepoHeadBranch(repoPath) {
6119
6130
  try {
6120
- const contents = readFileSync2(join5(repoPath, ".git", "HEAD"), "utf-8").trim();
6131
+ const contents = readFileSync3(join5(repoPath, ".git", "HEAD"), "utf-8").trim();
6121
6132
  const match = contents.match(/^ref:\s+refs\/heads\/(.+)$/);
6122
6133
  return match ? match[1] : null;
6123
6134
  } catch {
@@ -11036,7 +11047,7 @@ var DEFAULT_CODEX_ARGS = ["app-server", "--listen", "stdio://"];
11036
11047
  var MIN_CODEX_CLI_VERSION = "0.144.6";
11037
11048
  var CODEX_UPGRADE_TIMEOUT_MS = 12e4;
11038
11049
  var codexCliVersionEnsured = null;
11039
- var ENGINE_PACKAGE_VERSION = "0.1.591";
11050
+ var ENGINE_PACKAGE_VERSION = "0.1.592";
11040
11051
  var INITIALIZE_METHOD = "initialize";
11041
11052
  var INITIALIZED_NOTIFICATION = "initialized";
11042
11053
  var ACCOUNT_LOGIN_START_METHOD = "account/login/start";
@@ -11321,7 +11332,7 @@ var CodexQuotaStatusTracker = class {
11321
11332
  };
11322
11333
 
11323
11334
  // src/managers/codex-asp/mappers.ts
11324
- import { existsSync as existsSync5, readFileSync as readFileSync3 } from "fs";
11335
+ import { existsSync as existsSync5, readFileSync as readFileSync4 } from "fs";
11325
11336
  var localImageCache = /* @__PURE__ */ new Map();
11326
11337
  var DEFAULT_MODEL = DEFAULT_CODEX_MODEL;
11327
11338
  var THREAD_START_METHOD = "thread/start";
@@ -11444,7 +11455,7 @@ function userImageForLocalPath(path6) {
11444
11455
  const image = {
11445
11456
  type: "image",
11446
11457
  mediaType: inferMediaType(path6),
11447
- data: readFileSync3(path6).toString("base64")
11458
+ data: readFileSync4(path6).toString("base64")
11448
11459
  };
11449
11460
  if (image.data.length > 0) localImageCache.set(path6, image);
11450
11461
  return image;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "replicas-engine",
3
- "version": "0.1.591",
3
+ "version": "0.1.592",
4
4
  "description": "Lightweight API server for Replicas workspaces",
5
5
  "type": "module",
6
6
  "main": "dist/src/index.js",