replicas-engine 0.1.1645 → 0.1.1646

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
  listCodexModelsForDetails,
9
9
  restartCodexAspHost,
10
10
  restartCodexAspHostIfRunning
11
- } from "./chunk-5SQY2W75.js";
12
- import "./chunk-BZO57U73.js";
13
- import "./chunk-23J75YO5.js";
14
- import "./chunk-KP5VR7NH.js";
11
+ } from "./chunk-7ZY4GONQ.js";
12
+ import "./chunk-GJDYFS3H.js";
13
+ import "./chunk-AOOKWL5N.js";
14
+ import "./chunk-NEASNV2D.js";
15
15
  import "./chunk-UZSNFLDQ.js";
16
- import "./chunk-67UT3LYN.js";
16
+ import "./chunk-UKQUAWIH.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-23J75YO5.js";
6
+ } from "./chunk-AOOKWL5N.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-67UT3LYN.js";
18
+ } from "./chunk-UKQUAWIH.js";
19
19
 
20
20
  // src/managers/codex-asp/notification-dispatch.ts
21
21
  var TURN_STARTED_METHOD = "turn/started";
@@ -12,15 +12,15 @@ import {
12
12
  resolveDiffBase,
13
13
  runGitCommand,
14
14
  setAgentCredentialSnapshot
15
- } from "./chunk-BZO57U73.js";
15
+ } from "./chunk-GJDYFS3H.js";
16
16
  import {
17
17
  AppServerProcess,
18
18
  buildCodexAgentEnv
19
- } from "./chunk-23J75YO5.js";
19
+ } from "./chunk-AOOKWL5N.js";
20
20
  import {
21
21
  SUBPROCESS_MAX_BUFFER,
22
22
  execFileAsync
23
- } from "./chunk-KP5VR7NH.js";
23
+ } from "./chunk-NEASNV2D.js";
24
24
  import {
25
25
  isRecord
26
26
  } from "./chunk-UZSNFLDQ.js";
@@ -61,7 +61,7 @@ import {
61
61
  shrunkImageSize,
62
62
  splitMothershipInstructions,
63
63
  withTimeout
64
- } from "./chunk-67UT3LYN.js";
64
+ } from "./chunk-UKQUAWIH.js";
65
65
 
66
66
  // src/managers/codex-token-manager.ts
67
67
  import { promises as fs } from "fs";
@@ -461,7 +461,7 @@ var CodexTokenManager = class extends BaseRefreshManager {
461
461
  await this.applyCredentialUpdate(++this.credentialGeneration, async () => {
462
462
  await this.applyCredentialsResponse(data);
463
463
  setAgentCredentialSnapshot("codex", data);
464
- const { restartCodexAspHostIfRunning: restartCodexAspHostIfRunning2 } = await import("./asp-host-R64YHPJW.js");
464
+ const { restartCodexAspHostIfRunning: restartCodexAspHostIfRunning2 } = await import("./asp-host-B262LLVX.js");
465
465
  await restartCodexAspHostIfRunning2();
466
466
  });
467
467
  await this.start(true);
@@ -483,7 +483,7 @@ var CodexTokenManager = class extends BaseRefreshManager {
483
483
  const accountChanged = ENGINE_ENV.REPLICAS_AGENT_CREDENTIALS.codex?.credentialId !== data.credentialId;
484
484
  await this.applyCredentialsResponse(data);
485
485
  if (restartOnChange && (accountChanged || CODEX_AUTH_ENV_KEYS.some((key, index) => process.env[key] !== previousEnv[index]))) {
486
- const { restartCodexAspHostIfRunning: restartCodexAspHostIfRunning2 } = await import("./asp-host-R64YHPJW.js");
486
+ const { restartCodexAspHostIfRunning: restartCodexAspHostIfRunning2 } = await import("./asp-host-B262LLVX.js");
487
487
  await restartCodexAspHostIfRunning2();
488
488
  }
489
489
  setAgentCredentialSnapshot("codex", data);
@@ -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-KP5VR7NH.js";
6
+ } from "./chunk-NEASNV2D.js";
7
7
  import {
8
8
  isVersionBelow
9
- } from "./chunk-67UT3LYN.js";
9
+ } from "./chunk-UKQUAWIH.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.1645";
243
+ var ENGINE_PACKAGE_VERSION = "0.1.1646";
244
244
  var INITIALIZE_METHOD = "initialize";
245
245
  var INITIALIZED_NOTIFICATION = "initialized";
246
246
  var ACCOUNT_LOGIN_START_METHOD = "account/login/start";
@@ -4,7 +4,7 @@ const require = __createRequire(import.meta.url);
4
4
  import {
5
5
  SUBPROCESS_MAX_BUFFER,
6
6
  execFileAsync
7
- } from "./chunk-KP5VR7NH.js";
7
+ } from "./chunk-NEASNV2D.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-67UT3LYN.js";
24
+ } from "./chunk-UKQUAWIH.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-67UT3LYN.js";
6
+ } from "./chunk-UKQUAWIH.js";
7
7
 
8
8
  // src/utils/exec.ts
9
9
  import { exec, execFile } from "child_process";
@@ -5,7 +5,7 @@ import {
5
5
  extractCommandProtectionCommandText,
6
6
  isRecord,
7
7
  parseCodeHostPrUrl
8
- } from "./chunk-67UT3LYN.js";
8
+ } from "./chunk-UKQUAWIH.js";
9
9
 
10
10
  // src/services/published-pull-request-urls.ts
11
11
  function publishedPullRequestUrls(result) {
@@ -19,7 +19,7 @@ function publishedPullRequestUrls(result) {
19
19
  if (/^(?:[\w]+=[^\s;&|]+\s+)*(?:\S*\/)?(?:gh(?:\s+(?:-R|--repo)\s+\S+)?\s+pr\s+create|glab(?:\s+(?:-R|--repo)\s+\S+)?\s+mr\s+create|git(?:\s+-C\s+\S+)?\s+push)\b/.test(part)) return true;
20
20
  return /^(?:gh\s+api|glab\s+api|curl)\s/.test(part) && /(?:^|\s)(?:-X\s*|--(?:method|request)[=\s]+)POST\b/i.test(part) && /\/(?:pulls|merge_requests)(?:\s|$)/.test(part);
21
21
  };
22
- const publicationCommand = !shell.includes("<<") && !/[|&(){}\\]/.test(commands.join(" ")) && commands.some(isPublicationCommand) && commands.every((part) => isPublicationCommand(part) || /^(?:cd|rm)\s/.test(part) || /^git(?:\s+-C\s+\S+)?\s+worktree\s+(?:add|remove)\b/.test(part));
22
+ const publicationCommand = !shell.includes("<<") && !/[|&(){}\\]/.test(commands.join(" ")) && commands.some(isPublicationCommand) && commands.every((part) => isPublicationCommand(part) || /^(?:cd|rm)\s/.test(part) || /^git(?:\s+-C\s+\S+)?\s+worktree\s+(?:add|remove)\b/.test(part) || /^git(?:\s+-C\s+\S+)?\s+(?:switch|checkout)\s+(?:(?:-[bcBC]|--detach)\s+)?[^\s-]\S*$/.test(part));
23
23
  if (!publicationTool && !publicationCommand) return [];
24
24
  const urls = /* @__PURE__ */ new Set();
25
25
  const visit = (value, depth = 0) => {
@@ -15153,6 +15153,7 @@ var ALERT_SOUND_FAMILIES = {
15153
15153
  wood: ["ready", "pluck", "knock", "bloom", "steps"]
15154
15154
  };
15155
15155
  var ALERT_SOUNDS = [...ALERT_SOUND_FAMILIES.glass, ...ALERT_SOUND_FAMILIES.wood];
15156
+ var WALLPAPER_VIDEO_MAX_BYTES = 16 * 1024 * 1024;
15156
15157
  var PUSH_WHEN_ACTIVE_COPY = {
15157
15158
  wait: `Wait ${PUSH_HOLD_MINUTES} minutes`,
15158
15159
  skip: "Don\u2019t send",
@@ -21146,7 +21147,7 @@ async function withRetry(label, fn, options) {
21146
21147
  }
21147
21148
 
21148
21149
  // ../shared/src/tensorlake.ts
21149
- var TENSORLAKE_IMAGE_NAME = "replicas-sandbox-2026-11-19-v3";
21150
+ var TENSORLAKE_IMAGE_NAME = "replicas-sandbox-2026-11-19-v5";
21150
21151
  var TENSORLAKE_DISK_MB = 100 * 1024;
21151
21152
 
21152
21153
  // ../shared/src/egress.ts
@@ -22378,8 +22379,8 @@ function shouldRefreshPullRequests(toolName, toolInput) {
22378
22379
  /\bgit\s+push\b/,
22379
22380
  /\bgit\s+(?:branch|checkout|switch|pull|merge|rebase|reset)\b/,
22380
22381
  /\bgit\s+worktree\s+add\b/,
22381
- /\bgh\s+pr\s+(?:checkout|create|new|ready|reopen)\b/,
22382
- /\b(?:glab|gitlab)\s+mr\s+(?:checkout|create)\b/,
22382
+ /\bgh(?:\s+(?:-r|--repo)\s+\S+)?\s+pr\s+(?:checkout|create|new|ready|reopen)\b/,
22383
+ /\b(?:glab|gitlab)(?:\s+(?:-r|--repo)\s+\S+)?\s+mr\s+(?:checkout|create)\b/,
22383
22384
  /\bhub\s+pull-request\b/,
22384
22385
  /\b(?:tea\s+pulls|bb\s+pr|az\s+repos\s+pr)\s+create\b/,
22385
22386
  /\bmutation\b[\s\S]*\b(?:createpullrequest|mergerequestcreate)\b/
@@ -5,7 +5,7 @@ import {
5
5
  ENGINE_ENV,
6
6
  monolithRequest,
7
7
  runGitCommand
8
- } from "./chunk-BZO57U73.js";
8
+ } from "./chunk-GJDYFS3H.js";
9
9
  import {
10
10
  COMMAND_PROTECTION_MAX_MESSAGE_FILE_BYTES,
11
11
  COMMAND_PROTECTION_REPO_GIT_ARGS,
@@ -18,7 +18,7 @@ import {
18
18
  parseCommandProtectionRequest,
19
19
  toCommandProtectionRepoState,
20
20
  withRetry
21
- } from "./chunk-67UT3LYN.js";
21
+ } from "./chunk-UKQUAWIH.js";
22
22
 
23
23
  // src/services/command-protection-service.ts
24
24
  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-KUYP75MD.js";
7
- import "./chunk-BZO57U73.js";
8
- import "./chunk-KP5VR7NH.js";
6
+ } from "./chunk-YKKZBI75.js";
7
+ import "./chunk-GJDYFS3H.js";
8
+ import "./chunk-NEASNV2D.js";
9
9
  import {
10
10
  isRecord
11
11
  } from "./chunk-UZSNFLDQ.js";
12
- import "./chunk-67UT3LYN.js";
12
+ import "./chunk-UKQUAWIH.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-5UFO5TGT.js";
17
+ } from "./chunk-4SZR6TCT.js";
18
18
  import {
19
19
  AppServerProcess,
20
20
  buildCodexAgentEnv
21
- } from "./chunk-23J75YO5.js";
22
- import "./chunk-KP5VR7NH.js";
21
+ } from "./chunk-AOOKWL5N.js";
22
+ import "./chunk-NEASNV2D.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-67UT3LYN.js";
32
+ } from "./chunk-UKQUAWIH.js";
33
33
  import "./chunk-VEQXQN22.js";
34
34
 
35
35
  // 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-KUYP75MD.js";
94
+ } from "./chunk-YKKZBI75.js";
95
95
  import {
96
96
  ACCOUNT_RATE_LIMITS_UPDATED_METHOD,
97
97
  AGENT_MESSAGE_DELTA_METHOD,
@@ -129,10 +129,10 @@ import {
129
129
  spawnMuseMsp,
130
130
  startMuseSession,
131
131
  uuidV7
132
- } from "./chunk-5UFO5TGT.js";
132
+ } from "./chunk-4SZR6TCT.js";
133
133
  import {
134
134
  publishedPullRequestUrls
135
- } from "./chunk-H526XZL5.js";
135
+ } from "./chunk-P5R6HITZ.js";
136
136
  import {
137
137
  ACCOUNT_RATE_LIMITS_READ_METHOD,
138
138
  AsyncLock,
@@ -212,7 +212,7 @@ import {
212
212
  transcriptSecrets,
213
213
  upsertCredentialFileLines,
214
214
  writeSecureCredentialFile
215
- } from "./chunk-5SQY2W75.js";
215
+ } from "./chunk-7ZY4GONQ.js";
216
216
  import {
217
217
  ENGINE_ENV,
218
218
  UNQUOTED_PATHS_CONFIG,
@@ -223,16 +223,16 @@ import {
223
223
  resolveDiffBase,
224
224
  setAgentCredentialSnapshot,
225
225
  setLinearSessionId
226
- } from "./chunk-BZO57U73.js";
226
+ } from "./chunk-GJDYFS3H.js";
227
227
  import {
228
228
  buildCodexAgentEnv,
229
229
  getCodexModelProvider
230
- } from "./chunk-23J75YO5.js";
230
+ } from "./chunk-AOOKWL5N.js";
231
231
  import {
232
232
  SUBPROCESS_MAX_BUFFER,
233
233
  execAsync,
234
234
  execFileAsync
235
- } from "./chunk-KP5VR7NH.js";
235
+ } from "./chunk-NEASNV2D.js";
236
236
  import {
237
237
  isRecord as isRecord2
238
238
  } from "./chunk-UZSNFLDQ.js";
@@ -528,7 +528,7 @@ import {
528
528
  workspaceTokenRequestSchema,
529
529
  workspaceTokenResponseSchema,
530
530
  wrapInTag
531
- } from "./chunk-67UT3LYN.js";
531
+ } from "./chunk-UKQUAWIH.js";
532
532
  import {
533
533
  __commonJS,
534
534
  __export,
@@ -12818,11 +12818,16 @@ function canonicalPrUrl(url3) {
12818
12818
  const parsed = parseCodeHostPrUrl(url3);
12819
12819
  return parsed ? buildCodeHostPrUrl(parsed.repoUrl, parsed.provider, parsed.number) : url3;
12820
12820
  }
12821
+ function addBranches(target, source) {
12822
+ for (const [repoName, branches] of source) target.set(repoName, /* @__PURE__ */ new Set([...target.get(repoName) ?? [], ...branches]));
12823
+ }
12821
12824
  var PullRequestCheckService = class {
12822
12825
  running = null;
12823
12826
  trailing = null;
12824
12827
  // Hook-reported publications carry no chat, so any turn may claim them.
12825
12828
  unclaimedPublishedUrls = /* @__PURE__ */ new Map();
12829
+ pendingBranches = /* @__PURE__ */ new Map();
12830
+ turnBranches = /* @__PURE__ */ new Map();
12826
12831
  async recordPublishedPullRequest(url3, created = true, chatId) {
12827
12832
  if (await this.recordPublication(url3, created, chatId)) {
12828
12833
  this.check().catch((error) => console.error("[PullRequestCheck] Failed to report published PR:", error));
@@ -12848,14 +12853,24 @@ var PullRequestCheckService = class {
12848
12853
  async onToolResult(result, chatId) {
12849
12854
  if (!result.success) return;
12850
12855
  const urls = publishedPullRequestUrls(result);
12856
+ if (urls.length === 0 && !shouldRefreshPullRequests(result.toolName, result.toolInput)) return;
12857
+ const snapshot = await gitService.snapshotCurrentBranches();
12858
+ addBranches(this.pendingBranches, snapshot);
12859
+ addBranches(this.turnBranches, snapshot);
12851
12860
  try {
12852
12861
  for (const url3 of urls) await this.recordPublication(url3, true, chatId);
12853
12862
  } finally {
12854
- if (urls.length > 0 || shouldRefreshPullRequests(result.toolName, result.toolInput)) {
12855
- this.check().catch((error) => console.error("[PullRequestCheck] Failed to report tool result:", error));
12856
- }
12863
+ this.check().catch((error) => console.error("[PullRequestCheck] Failed to report tool result:", error));
12857
12864
  }
12858
12865
  }
12866
+ async observeBranches() {
12867
+ addBranches(this.turnBranches, await gitService.snapshotCurrentBranches());
12868
+ }
12869
+ checkTurn() {
12870
+ addBranches(this.pendingBranches, this.turnBranches);
12871
+ this.turnBranches = /* @__PURE__ */ new Map();
12872
+ return this.check();
12873
+ }
12859
12874
  // Plain single-flight would hand a caller a result gathered before its PR
12860
12875
  // existed, so callers arriving mid-run instead share one trailing run that
12861
12876
  // starts after the current one settles.
@@ -12876,7 +12891,9 @@ var PullRequestCheckService = class {
12876
12891
  return run;
12877
12892
  }
12878
12893
  async refresh() {
12879
- const repoStatuses = await refreshRepoStatuses();
12894
+ const observedBranches = this.pendingBranches;
12895
+ this.pendingBranches = /* @__PURE__ */ new Map();
12896
+ const repoStatuses = await refreshRepoStatuses(observedBranches);
12880
12897
  await monolithService.sendEvent({ type: "pull_request_check", payload: { repoStatuses } });
12881
12898
  return repoStatuses;
12882
12899
  }
@@ -64619,7 +64636,7 @@ function createV1Routes(deps) {
64619
64636
  if (!result.success) return c.json({ error: "Invalid PR tool result" }, 400);
64620
64637
  await pullRequestCheckService.onToolResult(result.data);
64621
64638
  } else {
64622
- pullRequestCheckService.check().catch(() => {
64639
+ pullRequestCheckService.checkTurn().catch(() => {
64623
64640
  });
64624
64641
  }
64625
64642
  return c.json({ accepted: true }, 202);
@@ -65929,6 +65946,8 @@ function attachExecSocket(socket) {
65929
65946
  if (!(await stat7(cwd).catch(() => null))?.isDirectory()) throw new ExecError("ENOENT", `Working directory not found: ${cwd}`, cwd);
65930
65947
  const [file, ...args] = request.argv ?? ["/bin/bash", request.login === false ? "-c" : "-lc", request.command ?? ""];
65931
65948
  const target = request.mcpServer ? { ...await mcpServerProcess(request.mcpServer), command: `mcp ${request.mcpServer}` } : { file, args, command: request.command ?? args.join(" ") };
65949
+ if (!request.mcpServer) await pullRequestCheckService.observeBranches().catch(() => {
65950
+ });
65932
65951
  const spawned = await processRegistry.spawn({ ...request, ...target, cwd });
65933
65952
  if (!spawned.ok) throw new ExecError("spawn_error", spawned.error.message);
65934
65953
  sendEvent(id, { kind: "started", processId: spawned.data.id, pid: spawned.data.pid });
@@ -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-H526XZL5.js";
6
+ } from "./chunk-P5R6HITZ.js";
7
7
  import {
8
8
  isRecord
9
9
  } from "./chunk-UZSNFLDQ.js";
10
10
  import {
11
11
  shouldRefreshPullRequests
12
- } from "./chunk-67UT3LYN.js";
12
+ } from "./chunk-UKQUAWIH.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-67UT3LYN.js";
14
+ } from "./chunk-UKQUAWIH.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.1645",
3
+ "version": "0.1.1646",
4
4
  "description": "Lightweight API server for Replicas workspaces",
5
5
  "type": "module",
6
6
  "main": "dist/src/index.js",