replicas-engine 0.1.1549 → 0.1.1553

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-XWQ7Q2IS.js";
12
- import "./chunk-FMTVDDDJ.js";
13
- import "./chunk-IX75NX3O.js";
14
- import "./chunk-NDDR6YII.js";
11
+ } from "./chunk-UZV2WIJD.js";
12
+ import "./chunk-3N6VXGWZ.js";
13
+ import "./chunk-HBGC6KZK.js";
14
+ import "./chunk-CYXYSFKG.js";
15
15
  import "./chunk-UZSNFLDQ.js";
16
- import "./chunk-ISSSSRPK.js";
16
+ import "./chunk-IDA22DYC.js";
17
17
  import "./chunk-VEQXQN22.js";
18
18
  export {
19
19
  CODEX_ULTRAFAST_SERVICE_TIER,
@@ -4,7 +4,7 @@ const require = __createRequire(import.meta.url);
4
4
  import {
5
5
  SUBPROCESS_MAX_BUFFER,
6
6
  execFileAsync
7
- } from "./chunk-NDDR6YII.js";
7
+ } from "./chunk-CYXYSFKG.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-ISSSSRPK.js";
24
+ } from "./chunk-IDA22DYC.js";
25
25
 
26
26
  // src/runtime-env-loader.ts
27
27
  import { readFileSync } from "fs";
@@ -5,7 +5,7 @@ import {
5
5
  extractCommandProtectionCommandText,
6
6
  isRecord,
7
7
  parseCodeHostPrUrl
8
- } from "./chunk-ISSSSRPK.js";
8
+ } from "./chunk-IDA22DYC.js";
9
9
 
10
10
  // src/services/published-pull-request-urls.ts
11
11
  function publishedPullRequestUrls(result) {
@@ -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-ISSSSRPK.js";
6
+ } from "./chunk-IDA22DYC.js";
7
7
 
8
8
  // src/utils/exec.ts
9
9
  import { exec, execFile } from "child_process";
@@ -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-IX75NX3O.js";
6
+ } from "./chunk-HBGC6KZK.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-ISSSSRPK.js";
18
+ } from "./chunk-IDA22DYC.js";
19
19
 
20
20
  // src/managers/codex-asp/notification-dispatch.ts
21
21
  var TURN_STARTED_METHOD = "turn/started";
@@ -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-NDDR6YII.js";
6
+ } from "./chunk-CYXYSFKG.js";
7
7
  import {
8
8
  isVersionBelow
9
- } from "./chunk-ISSSSRPK.js";
9
+ } from "./chunk-IDA22DYC.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.1549";
243
+ var ENGINE_PACKAGE_VERSION = "0.1.1553";
244
244
  var INITIALIZE_METHOD = "initialize";
245
245
  var INITIALIZED_NOTIFICATION = "initialized";
246
246
  var ACCOUNT_LOGIN_START_METHOD = "account/login/start";
@@ -15133,8 +15133,90 @@ function removeTag(text4, tag) {
15133
15133
  function stripReplicasInstructionBlock(text4) {
15134
15134
  return removeTag(text4, REPLICAS_INSTRUCTIONS_TAG);
15135
15135
  }
15136
+ var fenceMarker = (line, open) => {
15137
+ const marker = (open ? /^ {0,3}(`{3,}|~{3,})[ \t]*$/ : /^ {0,3}(`{3,}|~{3,})/).exec(line)?.[1];
15138
+ return !open || marker?.[0] === open[0] && marker.length >= open.length ? marker : void 0;
15139
+ };
15136
15140
  var INSTRUCTIONS_OPEN = `<${REPLICAS_INSTRUCTIONS_TAG}>`;
15137
15141
  var INSTRUCTIONS_CLOSE = `</${REPLICAS_INSTRUCTIONS_TAG}>`;
15142
+ function stripInstructionBlocksOutside(text4, ranges) {
15143
+ const outside = (index) => !ranges.some(([start, end]) => index >= start && index < end);
15144
+ let kept = "";
15145
+ let from = 0;
15146
+ for (let open = text4.indexOf(INSTRUCTIONS_OPEN); open !== -1; open = text4.indexOf(INSTRUCTIONS_OPEN, Math.max(from, open + 1))) {
15147
+ if (!outside(open)) continue;
15148
+ let close = text4.indexOf(INSTRUCTIONS_CLOSE, open);
15149
+ while (close !== -1 && !outside(close)) close = text4.indexOf(INSTRUCTIONS_CLOSE, close + 1);
15150
+ if (close === -1) break;
15151
+ kept += text4.slice(from, open);
15152
+ from = close + INSTRUCTIONS_CLOSE.length;
15153
+ }
15154
+ return (kept + text4.slice(from)).trim();
15155
+ }
15156
+ function stripAgentInstructionBlocks(text4) {
15157
+ if (!text4.includes(INSTRUCTIONS_OPEN)) return text4.trim();
15158
+ const quoted = [];
15159
+ const pair = (start, end) => {
15160
+ const at2 = [];
15161
+ const length = [];
15162
+ const run = /`+/g;
15163
+ run.lastIndex = start;
15164
+ for (let found = run.exec(text4); found && found.index < end; found = run.exec(text4)) {
15165
+ at2.push(found.index);
15166
+ length.push(found[0].length);
15167
+ }
15168
+ const next = new Array(at2.length).fill(-1);
15169
+ const seen = /* @__PURE__ */ new Map();
15170
+ for (let i = at2.length - 1; i >= 0; i--) {
15171
+ next[i] = seen.get(length[i]) ?? -1;
15172
+ seen.set(length[i], i);
15173
+ }
15174
+ for (let i = 0; i < at2.length; i = next[i] === -1 ? i + 1 : next[i] + 1) {
15175
+ if (next[i] !== -1) quoted.push([at2[i], at2[next[i]] + length[next[i]]]);
15176
+ }
15177
+ };
15178
+ const tags = [...text4.matchAll(new RegExp(`</?${REPLICAS_INSTRUCTIONS_TAG}>`, "g"))].map((tag) => tag.index ?? 0);
15179
+ const paragraphs = /* @__PURE__ */ new Set();
15180
+ const spans = (from, to) => {
15181
+ for (const tag of tags) {
15182
+ if (tag < from || tag >= to) continue;
15183
+ let start = text4.lastIndexOf("\n", tag - 1) + 1;
15184
+ for (let previous = text4.lastIndexOf("\n", start - 2) + 1; start > from && text4.slice(previous, start - 1).trim(); previous = text4.lastIndexOf("\n", start - 2) + 1) start = previous;
15185
+ start = Math.max(start, from);
15186
+ if (paragraphs.has(start)) continue;
15187
+ paragraphs.add(start);
15188
+ const blank = /\n[ \t]*\n/g;
15189
+ blank.lastIndex = tag;
15190
+ const end = Math.min(to, blank.exec(text4)?.index ?? to);
15191
+ pair(start, end);
15192
+ }
15193
+ };
15194
+ let fence = null;
15195
+ let prose = 0;
15196
+ let at = 0;
15197
+ for (let end = 0; at < text4.length; at = end) {
15198
+ end = text4.indexOf("\n", at) + 1 || text4.length;
15199
+ const line = text4.slice(at, end);
15200
+ const prefix = new RegExp(`^(?: {0,3}>[ \\t]?)${fence ? `{0,${fence.depth}}` : "*"}`).exec(line)?.[0] ?? "";
15201
+ const quote = line.slice(prefix.length);
15202
+ const opener = fence ? quote : quote.replace(/^\s*(?:[-*+]|\d+[.)])\s+/, "");
15203
+ const found = fenceMarker(opener);
15204
+ const marker = found && !(found[0] === "`" && opener.slice(opener.indexOf(found) + found.length).includes("`")) ? found : void 0;
15205
+ if (fence) {
15206
+ if (fenceMarker(quote.trimEnd(), fence.marker)) {
15207
+ quoted.push([fence.start, end]);
15208
+ fence = null;
15209
+ prose = end;
15210
+ }
15211
+ } else if (marker) {
15212
+ spans(prose, at);
15213
+ fence = { marker, start: at, depth: (prefix.match(/>/g) ?? []).length };
15214
+ } else if (line[0] === " " || line.startsWith(" ")) quoted.push([at, end]);
15215
+ }
15216
+ if (fence) quoted.push([fence.start, text4.length]);
15217
+ else spans(prose, text4.length);
15218
+ return stripInstructionBlocksOutside(text4, quoted);
15219
+ }
15138
15220
  var MOTHERSHIP_EVENT_CHAT_NOTE = `If a message the user typed in this turn is still unanswered, your final reply answers it and they see it. Otherwise they don't see text you write in this turn: if it brings something they asked for, or a blocker that needs them, send it with ${REPLICAS_MCP_TOOLS.sendToChat}; then update the board if its order, notes or overview changed, and end with a one-line note.`;
15139
15221
  var BOARD_ANSWER_NOTE = "The user answered on the board.";
15140
15222
  var BOARD_RULES = `- The board in the Ships pane beside this chat is the user's one view of the work. Each task the user asks for is one ticket, with only that task's pull requests. Spawning a ship creates its ticket from the \`title\` and \`task\` you pass. A ship works on one ticket at a time: when you give an existing ship a new, separate task with \`${REPLICAS_MCP_TOOLS.messageSubagent}\`, pass \`title\` so the task gets its own ticket. Pull requests are filed under the ticket their ship was on when it opened them; move one with \`pull_requests\` in \`${REPLICAS_MCP_TOOLS.updateBoard}\` only when that's wrong. Replicas files tickets under Needs you, Ready to review, Working or Done from the ship and the ticket's pull requests. Never restate what a ticket or pull request already shows.
@@ -15233,7 +15315,7 @@ function extractMothershipEvents(text4) {
15233
15315
  if (!attributes.kind || !attributes.id || !attributes.agent_id) return [];
15234
15316
  const kind = MOTHERSHIP_EVENT_KINDS.find((candidate) => candidate === attributes.kind) ?? UNKNOWN_EVENT_KIND;
15235
15317
  const [summary, ...rest] = match[2].replaceAll(`<\\/${TAG}`, `</${TAG}`).split("\n\n");
15236
- const detail = rest.join("\n\n").trim();
15318
+ const detail = stripAgentInstructionBlocks(rest.join("\n\n"));
15237
15319
  return [{
15238
15320
  id: attributes.id,
15239
15321
  at: attributes.at ?? "",
@@ -15254,6 +15336,9 @@ function parseMothershipEvents(text4) {
15254
15336
  function isMothershipEventMessage(text4) {
15255
15337
  return text4.trimStart().startsWith(`<${TAG} `);
15256
15338
  }
15339
+ function stripMothershipEventNotes(content) {
15340
+ return stripInstructionBlocksOutside(content, [...content.matchAll(BLOCK)].map((block) => [block.index, block.index + block[0].length]));
15341
+ }
15257
15342
 
15258
15343
  // ../shared/src/display-message/types.ts
15259
15344
  var RUN_STEP_TYPES = ["agent", "reasoning", "command", "file_change", "patch", "tool_call", "web_search", "todo_list", "skill", "subagent"];
@@ -18928,7 +19013,7 @@ function filterDisplayMessages(messages, provider2) {
18928
19013
  if (msg.type !== "user") return [msg];
18929
19014
  let stripped = strippedUserContents.get(msg.content);
18930
19015
  if (!stripped) {
18931
- stripped = stripAttachmentNote(stripReplicasInstructionBlock(msg.content).trim());
19016
+ stripped = stripAttachmentNote(stripMothershipEventNotes(msg.content));
18932
19017
  if (strippedUserContents.size >= 5e3) strippedUserContents.clear();
18933
19018
  strippedUserContents.set(msg.content, stripped);
18934
19019
  }
@@ -19695,7 +19780,7 @@ var VOICE_WAVEFORM = {
19695
19780
  };
19696
19781
 
19697
19782
  // ../shared/src/e2b.ts
19698
- var E2B_TEMPLATE_NAME = "replicas-sandbox-2026-11-14-v4";
19783
+ var E2B_TEMPLATE_NAME = "replicas-sandbox-2026-11-14-v8";
19699
19784
 
19700
19785
  // ../shared/src/e2b-retry.ts
19701
19786
  var DEFAULT_BACKOFFS_MS = [2e3, 5e3];
@@ -6,7 +6,7 @@ import {
6
6
  getOriginDefaultBranch,
7
7
  monolithRequest,
8
8
  runGitCommand
9
- } from "./chunk-FMTVDDDJ.js";
9
+ } from "./chunk-3N6VXGWZ.js";
10
10
  import {
11
11
  extractCommandProtectionCommandText,
12
12
  findCommandProtectionGitLookups,
@@ -15,7 +15,7 @@ import {
15
15
  findScoutRepoWriteSignals,
16
16
  parseCommandProtectionRequest,
17
17
  withE2BRetry
18
- } from "./chunk-ISSSSRPK.js";
18
+ } from "./chunk-IDA22DYC.js";
19
19
 
20
20
  // src/services/command-protection-service.ts
21
21
  import { readFile, stat } from "fs/promises";
@@ -11,15 +11,15 @@ import {
11
11
  resolveDiffBase,
12
12
  runGitCommand,
13
13
  setAgentCredentialSnapshot
14
- } from "./chunk-FMTVDDDJ.js";
14
+ } from "./chunk-3N6VXGWZ.js";
15
15
  import {
16
16
  AppServerProcess,
17
17
  buildCodexAgentEnv
18
- } from "./chunk-IX75NX3O.js";
18
+ } from "./chunk-HBGC6KZK.js";
19
19
  import {
20
20
  SUBPROCESS_MAX_BUFFER,
21
21
  execFileAsync
22
- } from "./chunk-NDDR6YII.js";
22
+ } from "./chunk-CYXYSFKG.js";
23
23
  import {
24
24
  isRecord
25
25
  } from "./chunk-UZSNFLDQ.js";
@@ -57,7 +57,7 @@ import {
57
57
  resolveOpenAICompatibleModelsUrl,
58
58
  splitMothershipInstructions,
59
59
  withTimeout
60
- } from "./chunk-ISSSSRPK.js";
60
+ } from "./chunk-IDA22DYC.js";
61
61
 
62
62
  // src/managers/codex-token-manager.ts
63
63
  import { promises as fs } from "fs";
@@ -320,7 +320,7 @@ var CodexTokenManager = class extends BaseRefreshManager {
320
320
  await this.applyCredentialUpdate(++this.credentialGeneration, async () => {
321
321
  await this.applyCredentialsResponse(data);
322
322
  setAgentCredentialSnapshot("codex", data);
323
- const { restartCodexAspHostIfRunning: restartCodexAspHostIfRunning2 } = await import("./asp-host-X6MQF6WW.js");
323
+ const { restartCodexAspHostIfRunning: restartCodexAspHostIfRunning2 } = await import("./asp-host-AUW3SGLV.js");
324
324
  await restartCodexAspHostIfRunning2();
325
325
  });
326
326
  await this.start(true);
@@ -342,7 +342,7 @@ var CodexTokenManager = class extends BaseRefreshManager {
342
342
  const accountChanged = ENGINE_ENV.REPLICAS_AGENT_CREDENTIALS.codex?.credentialId !== data.credentialId;
343
343
  await this.applyCredentialsResponse(data);
344
344
  if (restartOnChange && (accountChanged || CODEX_AUTH_ENV_KEYS.some((key, index) => process.env[key] !== previousEnv[index]))) {
345
- const { restartCodexAspHostIfRunning: restartCodexAspHostIfRunning2 } = await import("./asp-host-X6MQF6WW.js");
345
+ const { restartCodexAspHostIfRunning: restartCodexAspHostIfRunning2 } = await import("./asp-host-AUW3SGLV.js");
346
346
  await restartCodexAspHostIfRunning2();
347
347
  }
348
348
  setAgentCredentialSnapshot("codex", data);
@@ -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-YF3FH3UL.js";
7
- import "./chunk-FMTVDDDJ.js";
8
- import "./chunk-NDDR6YII.js";
6
+ } from "./chunk-QEF5YBHR.js";
7
+ import "./chunk-3N6VXGWZ.js";
8
+ import "./chunk-CYXYSFKG.js";
9
9
  import {
10
10
  isRecord
11
11
  } from "./chunk-UZSNFLDQ.js";
12
- import "./chunk-ISSSSRPK.js";
12
+ import "./chunk-IDA22DYC.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-2RUMQVTN.js";
17
+ } from "./chunk-FYJBMJ2J.js";
18
18
  import {
19
19
  AppServerProcess,
20
20
  buildCodexAgentEnv
21
- } from "./chunk-IX75NX3O.js";
22
- import "./chunk-NDDR6YII.js";
21
+ } from "./chunk-HBGC6KZK.js";
22
+ import "./chunk-CYXYSFKG.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-ISSSSRPK.js";
32
+ } from "./chunk-IDA22DYC.js";
33
33
  import "./chunk-VEQXQN22.js";
34
34
 
35
35
  // 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-YF3FH3UL.js";
30
+ } from "./chunk-QEF5YBHR.js";
31
31
  import {
32
32
  ACCOUNT_RATE_LIMITS_UPDATED_METHOD,
33
33
  AGENT_MESSAGE_DELTA_METHOD,
@@ -65,10 +65,10 @@ import {
65
65
  spawnMuseMsp,
66
66
  startMuseSession,
67
67
  uuidV7
68
- } from "./chunk-2RUMQVTN.js";
68
+ } from "./chunk-FYJBMJ2J.js";
69
69
  import {
70
70
  publishedPullRequestUrls
71
- } from "./chunk-NBBRM6RM.js";
71
+ } from "./chunk-6E4YV4DR.js";
72
72
  import {
73
73
  ACCOUNT_RATE_LIMITS_READ_METHOD,
74
74
  AsyncLock,
@@ -143,7 +143,7 @@ import {
143
143
  timestampFromSeconds,
144
144
  upsertCredentialFileLines,
145
145
  writeSecureCredentialFile
146
- } from "./chunk-XWQ7Q2IS.js";
146
+ } from "./chunk-UZV2WIJD.js";
147
147
  import {
148
148
  ENGINE_ENV,
149
149
  UNQUOTED_PATHS_CONFIG,
@@ -154,15 +154,15 @@ import {
154
154
  resolveDiffBase,
155
155
  setAgentCredentialSnapshot,
156
156
  setLinearSessionId
157
- } from "./chunk-FMTVDDDJ.js";
157
+ } from "./chunk-3N6VXGWZ.js";
158
158
  import {
159
159
  getCodexModelProvider
160
- } from "./chunk-IX75NX3O.js";
160
+ } from "./chunk-HBGC6KZK.js";
161
161
  import {
162
162
  SUBPROCESS_MAX_BUFFER,
163
163
  execAsync,
164
164
  execFileAsync
165
- } from "./chunk-NDDR6YII.js";
165
+ } from "./chunk-CYXYSFKG.js";
166
166
  import {
167
167
  isRecord as isRecord2
168
168
  } from "./chunk-UZSNFLDQ.js";
@@ -443,7 +443,7 @@ import {
443
443
  workspaceTokenRequestSchema,
444
444
  workspaceTokenResponseSchema,
445
445
  wrapInTag
446
- } from "./chunk-ISSSSRPK.js";
446
+ } from "./chunk-IDA22DYC.js";
447
447
  import {
448
448
  cloneMcpConfig,
449
449
  ensureCompatibilityImports,
@@ -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-NBBRM6RM.js";
6
+ } from "./chunk-6E4YV4DR.js";
7
7
  import {
8
8
  isRecord
9
9
  } from "./chunk-UZSNFLDQ.js";
10
10
  import {
11
11
  shouldRefreshPullRequests
12
- } from "./chunk-ISSSSRPK.js";
12
+ } from "./chunk-IDA22DYC.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-ISSSSRPK.js";
14
+ } from "./chunk-IDA22DYC.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.1549",
3
+ "version": "0.1.1553",
4
4
  "description": "Lightweight API server for Replicas workspaces",
5
5
  "type": "module",
6
6
  "main": "dist/src/index.js",