replicas-engine 0.1.1204 → 0.1.1206

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-LOWMX3LK.js";
12
- import "./chunk-UZTCADJX.js";
13
- import "./chunk-DGLFEMG7.js";
14
- import "./chunk-GJWKAJ3W.js";
11
+ } from "./chunk-6SGFHVNY.js";
12
+ import "./chunk-7JJZWIT5.js";
13
+ import "./chunk-PWUGAZDK.js";
14
+ import "./chunk-SCA3IQKD.js";
15
15
  import "./chunk-UZSNFLDQ.js";
16
- import "./chunk-AOE7OYWW.js";
16
+ import "./chunk-C3HTI2BQ.js";
17
17
  import "./chunk-VEQXQN22.js";
18
18
  export {
19
19
  CODEX_ULTRAFAST_SERVICE_TIER,
@@ -10,15 +10,15 @@ import {
10
10
  resolveDiffBase,
11
11
  runGitCommand,
12
12
  setAgentCredentialSnapshot
13
- } from "./chunk-UZTCADJX.js";
13
+ } from "./chunk-7JJZWIT5.js";
14
14
  import {
15
15
  AppServerProcess,
16
16
  buildCodexAgentEnv
17
- } from "./chunk-DGLFEMG7.js";
17
+ } from "./chunk-PWUGAZDK.js";
18
18
  import {
19
19
  SUBPROCESS_MAX_BUFFER,
20
20
  execFileAsync
21
- } from "./chunk-GJWKAJ3W.js";
21
+ } from "./chunk-SCA3IQKD.js";
22
22
  import {
23
23
  isRecord
24
24
  } from "./chunk-UZSNFLDQ.js";
@@ -55,7 +55,7 @@ import {
55
55
  resolveOpenAICompatibleModelsUrl,
56
56
  splitMothershipInstructions,
57
57
  withTimeout
58
- } from "./chunk-AOE7OYWW.js";
58
+ } from "./chunk-C3HTI2BQ.js";
59
59
 
60
60
  // src/managers/codex-token-manager.ts
61
61
  import { promises as fs } from "fs";
@@ -291,7 +291,7 @@ var CodexTokenManager = class extends BaseRefreshManager {
291
291
  await this.applyCredentialUpdate(++this.credentialGeneration, async () => {
292
292
  await this.applyCredentialsResponse(data);
293
293
  setAgentCredentialSnapshot("codex", data);
294
- const { restartCodexAspHostIfRunning: restartCodexAspHostIfRunning2 } = await import("./asp-host-7F4NB6YQ.js");
294
+ const { restartCodexAspHostIfRunning: restartCodexAspHostIfRunning2 } = await import("./asp-host-2BJURCM7.js");
295
295
  await restartCodexAspHostIfRunning2();
296
296
  });
297
297
  await this.start(true);
@@ -313,7 +313,7 @@ var CodexTokenManager = class extends BaseRefreshManager {
313
313
  const accountChanged = ENGINE_ENV.REPLICAS_AGENT_CREDENTIALS.codex?.credentialId !== data.credentialId;
314
314
  await this.applyCredentialsResponse(data);
315
315
  if (restartOnChange && (accountChanged || CODEX_AUTH_ENV_KEYS.some((key, index) => process.env[key] !== previousEnv[index]))) {
316
- const { restartCodexAspHostIfRunning: restartCodexAspHostIfRunning2 } = await import("./asp-host-7F4NB6YQ.js");
316
+ const { restartCodexAspHostIfRunning: restartCodexAspHostIfRunning2 } = await import("./asp-host-2BJURCM7.js");
317
317
  await restartCodexAspHostIfRunning2();
318
318
  }
319
319
  setAgentCredentialSnapshot("codex", data);
@@ -4,7 +4,7 @@ const require = __createRequire(import.meta.url);
4
4
  import {
5
5
  SUBPROCESS_MAX_BUFFER,
6
6
  execFileAsync
7
- } from "./chunk-GJWKAJ3W.js";
7
+ } from "./chunk-SCA3IQKD.js";
8
8
  import {
9
9
  isRecord as isRecord2
10
10
  } from "./chunk-UZSNFLDQ.js";
@@ -18,7 +18,7 @@ import {
18
18
  isValidAgentProvider,
19
19
  parsePosixEnvFile,
20
20
  readReplicasRuntimeEnv
21
- } from "./chunk-AOE7OYWW.js";
21
+ } from "./chunk-C3HTI2BQ.js";
22
22
 
23
23
  // src/runtime-env-loader.ts
24
24
  import { readFileSync } from "fs";
@@ -5490,12 +5490,14 @@ var VISUAL_PAGE_RULES = `- Write one self-contained HTML file with inline <style
5490
5490
  - Let content set the height. Never use 100vh, height:100%, or min-height:100vh on html, body, or the outer element; publishing refuses a page whose height follows the frame. Give charts fixed pixel heights.
5491
5491
  - Color everything with the theme variables so the page follows light and dark mode live: --foreground, --muted-foreground (secondary text), --background, --muted (subtle fills), --accent, --border, --primary and --primary-foreground (Replicas green), --destructive, --warning, --code-background, --code-foreground, and --chart-1 to --chart-6 for series (use them in order and label series directly). Never hardcode a light or dark palette. A canvas or chart library that needs literal colors can read them with getComputedStyle(document.documentElement) and redraw on matchMedia("(prefers-color-scheme: dark)") changes.
5492
5492
  - Text is 13px General Sans, like the chat; --font-sans and --font-mono are set. Keep Replicas' flat look: separate sections with 1px var(--border) lines or var(--muted) fills, without shadows or rounded cards. Use var(--radius) only on small controls.
5493
+ - A mockup of a specific product's UI, such as a client's app or a competitor's screen, is the exception: give it its own panel with at least 16px of padding and use that product's real colors, fonts, corners, and shadows inside it, so it looks like the product. Everything around the panel follows the rules above.
5493
5494
  - Interaction is welcome: hover details, tabs, toggles, sliders. Links open in a new browser tab.
5494
5495
  - Keep the top-right corner (about 110\xD740px) free of anything essential: the chat shows the visual's actions there on hover.`;
5495
5496
  var THEME_FRAGMENT_KEY = "replicas-theme";
5496
5497
  var HOST_CONTEXT_CHANGED_METHOD = "ui/notifications/host-context-changed";
5497
5498
  var SIZE_CHANGED_METHOD = "ui/notifications/size-changed";
5498
5499
  var OPEN_LINK_METHOD = "ui/open-link";
5500
+ var OPEN_IMAGE_METHOD = "replicas/open-image";
5499
5501
  var VISUAL_CONTENT_HEIGHT_EXPRESSION = "(function(){var r=document.documentElement;return Math.ceil(r.scrollHeight>r.clientHeight?r.scrollHeight:r.getBoundingClientRect().height)})()";
5500
5502
  var BASE_CSS = "html{color:var(--foreground);font-family:var(--font-sans);font-size:13px;line-height:1.5;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;-webkit-text-size-adjust:100%;scrollbar-width:none}html::-webkit-scrollbar{display:none}body{margin:0}:where(*,*::before,*::after){box-sizing:border-box}code,kbd,pre,samp{font-family:var(--font-mono)}:where(:focus-visible){outline:2px solid var(--ring);outline-offset:-2px}";
5501
5503
  var THEME_STYLE_ID = "replicas-visual-theme";
@@ -5533,6 +5535,23 @@ var BOOTSTRAP_SCRIPT = `
5533
5535
  }, true);
5534
5536
  }
5535
5537
  if (!framed && !nativeView) return;
5538
+ window.addEventListener('click', (event) => {
5539
+ const image = event.composedPath()[0];
5540
+ if (!event.isTrusted || event.defaultPrevented || !(image instanceof HTMLImageElement) || image.closest('a[href], button')) return;
5541
+ let src = image.currentSrc || image.src;
5542
+ if (/^blob:/i.test(src) || (nativeView && /^data:image\\/svg|\\.svg(?:[?#]|$)/i.test(src))) {
5543
+ try {
5544
+ const canvas = document.createElement('canvas');
5545
+ canvas.width = (image.naturalWidth || image.width) * 2;
5546
+ canvas.height = (image.naturalHeight || image.height) * 2;
5547
+ canvas.getContext('2d').drawImage(image, 0, 0, canvas.width, canvas.height);
5548
+ src = canvas.toDataURL('image/png');
5549
+ } catch {
5550
+ return;
5551
+ }
5552
+ }
5553
+ if (src) post({ jsonrpc: '2.0', method: '${OPEN_IMAGE_METHOD}', params: { src, name: image.alt } });
5554
+ });
5536
5555
  let reportedHeight;
5537
5556
  const reportHeight = () => {
5538
5557
  const height = ${VISUAL_CONTENT_HEIGHT_EXPRESSION};
@@ -5,14 +5,14 @@ import {
5
5
  getOriginDefaultBranch,
6
6
  monolithRequest,
7
7
  runGitCommand
8
- } from "./chunk-UZTCADJX.js";
8
+ } from "./chunk-7JJZWIT5.js";
9
9
  import {
10
10
  extractCommandProtectionCommandText,
11
11
  findCommandProtectionGitLookups,
12
12
  findGitCommitSignals,
13
13
  findPrMergeSignals,
14
14
  parseCommandProtectionRequest
15
- } from "./chunk-AOE7OYWW.js";
15
+ } from "./chunk-C3HTI2BQ.js";
16
16
 
17
17
  // src/services/command-protection-service.ts
18
18
  import { readFile, stat } from "fs/promises";
@@ -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-GJWKAJ3W.js";
6
+ } from "./chunk-SCA3IQKD.js";
7
7
  import {
8
8
  isVersionBelow
9
- } from "./chunk-AOE7OYWW.js";
9
+ } from "./chunk-C3HTI2BQ.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.1204";
243
+ var ENGINE_PACKAGE_VERSION = "0.1.1206";
244
244
  var INITIALIZE_METHOD = "initialize";
245
245
  var INITIALIZED_NOTIFICATION = "initialized";
246
246
  var ACCOUNT_LOGIN_START_METHOD = "account/login/start";
@@ -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-DGLFEMG7.js";
6
+ } from "./chunk-PWUGAZDK.js";
7
7
  import {
8
8
  ASTER_BASE_URL,
9
9
  ASTER_PROVIDER,
@@ -13,7 +13,7 @@ import {
13
13
  isRecord,
14
14
  readOllamaAuthEnv,
15
15
  readOpenAICompatibleAuthEnv
16
- } from "./chunk-AOE7OYWW.js";
16
+ } from "./chunk-C3HTI2BQ.js";
17
17
 
18
18
  // src/managers/codex-asp/notification-dispatch.ts
19
19
  var TURN_STARTED_METHOD = "turn/started";
@@ -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-AOE7OYWW.js";
6
+ } from "./chunk-C3HTI2BQ.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-AOE7OYWW.js";
8
+ } from "./chunk-C3HTI2BQ.js";
9
9
 
10
10
  // src/services/published-pull-request-urls.ts
11
11
  function publishedPullRequestUrls(result) {
@@ -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-LRWX3RVK.js";
7
- import "./chunk-UZTCADJX.js";
8
- import "./chunk-GJWKAJ3W.js";
6
+ } from "./chunk-KN22LR36.js";
7
+ import "./chunk-7JJZWIT5.js";
8
+ import "./chunk-SCA3IQKD.js";
9
9
  import {
10
10
  isRecord
11
11
  } from "./chunk-UZSNFLDQ.js";
12
- import "./chunk-AOE7OYWW.js";
12
+ import "./chunk-C3HTI2BQ.js";
13
13
  import "./chunk-VEQXQN22.js";
14
14
 
15
15
  // src/command-protection-hook.ts
@@ -13,12 +13,12 @@ import {
13
13
  recoverCompletedTurn,
14
14
  spawnMuseMsp,
15
15
  startMuseSession
16
- } from "./chunk-5OFIX6TL.js";
16
+ } from "./chunk-QN2KQMX3.js";
17
17
  import {
18
18
  AppServerProcess,
19
19
  buildCodexAgentEnv
20
- } from "./chunk-DGLFEMG7.js";
21
- import "./chunk-GJWKAJ3W.js";
20
+ } from "./chunk-PWUGAZDK.js";
21
+ import "./chunk-SCA3IQKD.js";
22
22
  import {
23
23
  AGENT,
24
24
  OPENCODE_GO_PROVIDER,
@@ -28,7 +28,7 @@ import {
28
28
  headlessAgentUsagePath,
29
29
  isRecord,
30
30
  withTimeout
31
- } from "./chunk-AOE7OYWW.js";
31
+ } from "./chunk-C3HTI2BQ.js";
32
32
  import "./chunk-VEQXQN22.js";
33
33
 
34
34
  // 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-LRWX3RVK.js";
30
+ } from "./chunk-KN22LR36.js";
31
31
  import {
32
32
  ACCOUNT_RATE_LIMITS_UPDATED_METHOD,
33
33
  AGENT_MESSAGE_DELTA_METHOD,
@@ -64,10 +64,10 @@ import {
64
64
  spawnMuseMsp,
65
65
  startMuseSession,
66
66
  uuidV7
67
- } from "./chunk-5OFIX6TL.js";
67
+ } from "./chunk-QN2KQMX3.js";
68
68
  import {
69
69
  publishedPullRequestUrls
70
- } from "./chunk-GV2AISTI.js";
70
+ } from "./chunk-YT7BF2FG.js";
71
71
  import {
72
72
  ACCOUNT_RATE_LIMITS_READ_METHOD,
73
73
  AsyncLock,
@@ -139,7 +139,7 @@ import {
139
139
  timestampFromSeconds,
140
140
  upsertCredentialFileLines,
141
141
  writeSecureCredentialFile
142
- } from "./chunk-LOWMX3LK.js";
142
+ } from "./chunk-6SGFHVNY.js";
143
143
  import {
144
144
  ENGINE_ENV,
145
145
  monolithRequest,
@@ -148,15 +148,15 @@ import {
148
148
  reloadEngineEnv,
149
149
  resolveDiffBase,
150
150
  setAgentCredentialSnapshot
151
- } from "./chunk-UZTCADJX.js";
151
+ } from "./chunk-7JJZWIT5.js";
152
152
  import {
153
153
  getCodexModelProvider
154
- } from "./chunk-DGLFEMG7.js";
154
+ } from "./chunk-PWUGAZDK.js";
155
155
  import {
156
156
  SUBPROCESS_MAX_BUFFER,
157
157
  execAsync,
158
158
  execFileAsync
159
- } from "./chunk-GJWKAJ3W.js";
159
+ } from "./chunk-SCA3IQKD.js";
160
160
  import {
161
161
  isRecord as isRecord2
162
162
  } from "./chunk-UZSNFLDQ.js";
@@ -391,7 +391,7 @@ import {
391
391
  workspaceTokenRequestSchema,
392
392
  workspaceTokenResponseSchema,
393
393
  wrapInTag
394
- } from "./chunk-AOE7OYWW.js";
394
+ } from "./chunk-C3HTI2BQ.js";
395
395
  import {
396
396
  cloneMcpConfig,
397
397
  ensureCompatibilityImports,
@@ -12679,6 +12679,12 @@ var TRANSIENT_RETRY_DELAYS_MS = [1e3, 2500];
12679
12679
  var CLAUDE_TRANSIENT_HTTP_STATUSES = [408, 500, 502, 503, 504, 529];
12680
12680
  var CLAUDE_MIDTURN_CONTINUE_PROMPT = "Your previous turn was interrupted by a transient network error before it could finish. Continue from exactly where you left off. Do not repeat any tool calls, commits, messages, or other actions you have already completed \u2014 first check what is already done, then do only the remaining work.";
12681
12681
  var CLAUDE_RETRY_PROMPT = "Your previous attempt to respond to the message above failed before producing a response. Respond to it now.";
12682
+ function appendUserContent(earlier, later) {
12683
+ const last = earlier.at(-1);
12684
+ return last?.type === "text" ? [...earlier.slice(0, -1), { ...last, text: `${last.text}
12685
+
12686
+ ` }, ...later] : [...earlier, ...later];
12687
+ }
12682
12688
  var TOOL_TARGET = /^\s*\{\s*"(\w+)"\s*:\s*(?:"((?:[^"\\]|\\.)*)(")?)?/;
12683
12689
  var JSON_FIRST_LINE = /^(?:[^\\]|\\[^n])*?(?=\\n)/;
12684
12690
  function toSlashCommands(command) {
@@ -12765,7 +12771,7 @@ var ClaudeManager = class _ClaudeManager extends CodingAgentManager {
12765
12771
  async keepStoppedRequest(request) {
12766
12772
  await this.dropRecordedUnreadPrompt();
12767
12773
  const { uuid, message } = await this.buildUserMessage(request);
12768
- this.unreadPrompt = { uuid, content: [...this.unreadPrompt?.content ?? [], ...message.content] };
12774
+ this.unreadPrompt = { uuid, content: appendUserContent(this.unreadPrompt?.content ?? [], message.content) };
12769
12775
  return true;
12770
12776
  }
12771
12777
  canDeliverSteersNow() {
@@ -13094,7 +13100,8 @@ var ClaudeManager = class _ClaudeManager extends CodingAgentManager {
13094
13100
  attempt++;
13095
13101
  continue;
13096
13102
  }
13097
- loginRevoked = attemptedCredential?.method === "oauth" && refreshed.error.message.includes('"code":"oauth_disconnected"');
13103
+ const method = attemptedCredential?.method ?? resolveClaudeAuthMethodForMessage();
13104
+ loginRevoked = (method === "oauth" || method === "unknown") && refreshed.error.message.includes('"code":"oauth_disconnected"');
13098
13105
  }
13099
13106
  if (quotaKind || isAuthError) {
13100
13107
  const reason = quotaKind ?? "auth_failed";
@@ -13290,7 +13297,7 @@ var ClaudeManager = class _ClaudeManager extends CodingAgentManager {
13290
13297
  }
13291
13298
  await this.dropRecordedUnreadPrompt();
13292
13299
  const prompt = goalCommand ? [{ type: "text", text: `/goal ${goalObjective ?? "clear"}` }] : userMessage.message.content;
13293
- const content = [...this.unreadPrompt?.content ?? [], ...prompt];
13300
+ const content = appendUserContent(this.unreadPrompt?.content ?? [], prompt);
13294
13301
  if (this.pendingInterrupt || options.signal?.aborted) {
13295
13302
  this.pendingInterrupt = false;
13296
13303
  this.unreadPrompt = { uuid: userMessage.uuid, content };
@@ -14219,7 +14226,9 @@ var CodexAspManager = class extends CodingAgentManager {
14219
14226
  }
14220
14227
  async keepStoppedRequest(request) {
14221
14228
  if (isCompactCommand(request.message) || getGoalCommand(request.message, request.goalMode)) return false;
14222
- this.unreadRequests.push(request);
14229
+ this.unreadRequests.push({ ...request, message: `${request.message}
14230
+
14231
+ ` });
14223
14232
  return true;
14224
14233
  }
14225
14234
  async interruptActiveTurn() {
@@ -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-GV2AISTI.js";
6
+ } from "./chunk-YT7BF2FG.js";
7
7
  import {
8
8
  isRecord
9
9
  } from "./chunk-UZSNFLDQ.js";
10
10
  import {
11
11
  shouldRefreshPullRequests
12
- } from "./chunk-AOE7OYWW.js";
12
+ } from "./chunk-C3HTI2BQ.js";
13
13
  import "./chunk-VEQXQN22.js";
14
14
 
15
15
  // src/services/post-tool-pr-notifier.ts
@@ -9,7 +9,7 @@ import {
9
9
  spawnSubagentRequestSchema,
10
10
  subagentResponseSchema,
11
11
  waitSubagentRequestSchema
12
- } from "./chunk-AOE7OYWW.js";
12
+ } from "./chunk-C3HTI2BQ.js";
13
13
  import "./chunk-VEQXQN22.js";
14
14
 
15
15
  // src/subagent-mcp.ts
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "replicas-engine",
3
- "version": "0.1.1204",
3
+ "version": "0.1.1206",
4
4
  "description": "Lightweight API server for Replicas workspaces",
5
5
  "type": "module",
6
6
  "main": "dist/src/index.js",