replicas-engine 0.1.959 → 0.1.960

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,12 +5,12 @@ import {
5
5
  getCodexAspHost,
6
6
  restartCodexAspHost,
7
7
  restartCodexAspHostIfRunning
8
- } from "./chunk-TFD6QK6J.js";
9
- import "./chunk-4HNUOSLS.js";
10
- import "./chunk-X76Z5POI.js";
11
- import "./chunk-CANEL3IU.js";
8
+ } from "./chunk-3TPGWE3O.js";
9
+ import "./chunk-QSVTOKZY.js";
10
+ import "./chunk-SYJMIBRY.js";
11
+ import "./chunk-E4WKHWCM.js";
12
12
  import "./chunk-UZSNFLDQ.js";
13
- import "./chunk-QXISBAH5.js";
13
+ import "./chunk-T2TXUSX7.js";
14
14
  import "./chunk-VEQXQN22.js";
15
15
  export {
16
16
  getCodexAspHost,
@@ -5,15 +5,15 @@ import {
5
5
  ENGINE_ENV,
6
6
  monolithRequest,
7
7
  setAgentCredentialSnapshot
8
- } from "./chunk-4HNUOSLS.js";
8
+ } from "./chunk-QSVTOKZY.js";
9
9
  import {
10
10
  AppServerProcess,
11
11
  buildCodexAgentEnv
12
- } from "./chunk-X76Z5POI.js";
12
+ } from "./chunk-SYJMIBRY.js";
13
13
  import {
14
14
  SUBPROCESS_MAX_BUFFER,
15
15
  execFileAsync
16
- } from "./chunk-CANEL3IU.js";
16
+ } from "./chunk-E4WKHWCM.js";
17
17
  import {
18
18
  isRecord
19
19
  } from "./chunk-UZSNFLDQ.js";
@@ -27,7 +27,7 @@ import {
27
27
  listOpenAICompatibleModels,
28
28
  readOllamaAuthEnv,
29
29
  resolveOpenAICompatibleModelsUrl
30
- } from "./chunk-QXISBAH5.js";
30
+ } from "./chunk-T2TXUSX7.js";
31
31
 
32
32
  // src/managers/codex-token-manager.ts
33
33
  import { promises as fs } from "fs";
@@ -260,7 +260,7 @@ var CodexTokenManager = class extends BaseRefreshManager {
260
260
  await this.applyCredentialUpdate(++this.credentialGeneration, async () => {
261
261
  await this.applyCredentialsResponse(data);
262
262
  setAgentCredentialSnapshot("codex", data);
263
- const { restartCodexAspHostIfRunning: restartCodexAspHostIfRunning2 } = await import("./asp-host-INCEKBYG.js");
263
+ const { restartCodexAspHostIfRunning: restartCodexAspHostIfRunning2 } = await import("./asp-host-F7IOQ6EZ.js");
264
264
  await restartCodexAspHostIfRunning2();
265
265
  });
266
266
  await this.start(true);
@@ -280,7 +280,7 @@ var CodexTokenManager = class extends BaseRefreshManager {
280
280
  await this.applyCredentialUpdate(generation, async () => {
281
281
  await this.applyCredentialsResponse(data);
282
282
  if (restartOnChange && CODEX_AUTH_ENV_KEYS.some((key, index) => process.env[key] !== previousEnv[index])) {
283
- const { restartCodexAspHostIfRunning: restartCodexAspHostIfRunning2 } = await import("./asp-host-INCEKBYG.js");
283
+ const { restartCodexAspHostIfRunning: restartCodexAspHostIfRunning2 } = await import("./asp-host-F7IOQ6EZ.js");
284
284
  await restartCodexAspHostIfRunning2();
285
285
  }
286
286
  setAgentCredentialSnapshot("codex", data);
@@ -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-QXISBAH5.js";
6
+ } from "./chunk-T2TXUSX7.js";
7
7
 
8
8
  // src/utils/exec.ts
9
9
  import { exec, execFile } from "child_process";
@@ -3,18 +3,18 @@ import { createRequire as __createRequire } from 'node:module';
3
3
  const require = __createRequire(import.meta.url);
4
4
  import {
5
5
  monolithRequest
6
- } from "./chunk-4HNUOSLS.js";
6
+ } from "./chunk-QSVTOKZY.js";
7
7
  import {
8
8
  SUBPROCESS_MAX_BUFFER,
9
9
  execFileAsync
10
- } from "./chunk-CANEL3IU.js";
10
+ } from "./chunk-E4WKHWCM.js";
11
11
  import {
12
12
  extractCommandProtectionCommandText,
13
13
  findCommandProtectionGitLookups,
14
14
  findGitCommitSignals,
15
15
  findPrMergeSignals,
16
16
  parseCommandProtectionRequest
17
- } from "./chunk-QXISBAH5.js";
17
+ } from "./chunk-T2TXUSX7.js";
18
18
 
19
19
  // src/services/command-protection-service.ts
20
20
  import { readFile, stat } from "fs/promises";
@@ -14,7 +14,7 @@ import {
14
14
  isValidAgentProvider,
15
15
  parsePosixEnvFile,
16
16
  readReplicasRuntimeEnv
17
- } from "./chunk-QXISBAH5.js";
17
+ } from "./chunk-T2TXUSX7.js";
18
18
 
19
19
  // src/runtime-env-loader.ts
20
20
  import { readFileSync } from "fs";
@@ -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-CANEL3IU.js";
6
+ } from "./chunk-E4WKHWCM.js";
7
7
  import {
8
8
  isVersionBelow
9
- } from "./chunk-QXISBAH5.js";
9
+ } from "./chunk-T2TXUSX7.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.959";
243
+ var ENGINE_PACKAGE_VERSION = "0.1.960";
244
244
  var INITIALIZE_METHOD = "initialize";
245
245
  var INITIALIZED_NOTIFICATION = "initialized";
246
246
  var ACCOUNT_LOGIN_START_METHOD = "account/login/start";
@@ -2024,7 +2024,7 @@ var WRAPPER_VALUE_OPTIONS = {
2024
2024
  };
2025
2025
  var ANSI_C_ESCAPES = { n: "\n", t: " ", r: "\r", a: "\x07", b: "\b", e: "\x1B", E: "\x1B", f: "\f", v: "\v" };
2026
2026
  function parseShellScript(script, cwd) {
2027
- const scope = { src: script, vars: /* @__PURE__ */ new Map(), dir: cwd, commands: [], depth: 0 };
2027
+ const scope = { src: script, vars: /* @__PURE__ */ new Map(), dir: cwd, commands: [], depth: 0, subshell: false };
2028
2028
  parseUntil(scope, 0, false);
2029
2029
  return scope.commands;
2030
2030
  }
@@ -2124,16 +2124,18 @@ function emit(scope, raw) {
2124
2124
  stdin,
2125
2125
  afterAnd: raw.afterAnd,
2126
2126
  stdinFile: stdinFile ? resolveShellPath(scope.dir, stdinFile.target) : null,
2127
- writes: raw.redirects.flatMap(({ op, target }) => /^(?:1?>|1?>\||1?>>|&>|&>>|>&)$/.test(op) && !/^(?:\d+|-)$/.test(target) ? [{ path: resolveShellPath(scope.dir, target), content: output, append: op.endsWith(">>") }] : []),
2127
+ writes: raw.redirects.flatMap(({ op, target }) => /^(?:1?>|1?>\||1?>>|&>|&>>|>&)$/.test(op) && !/^(?:\d+|-)$/.test(target) ? [{ path: resolveShellPath(scope.dir, target), target, content: output, append: op.endsWith(">>") }] : []),
2128
2128
  wrapper: script !== void 0,
2129
- truncated
2129
+ truncated,
2130
+ piped: raw.pipeFrom !== void 0,
2131
+ subshell: scope.subshell || raw.subshell
2130
2132
  });
2131
2133
  if (name === "cd" || name === "pushd" || name === "popd") {
2132
2134
  scope.dir = name !== "popd" && argv[1] && argv[1] !== "-" ? resolveShellPath(scope.dir, argv[1]) : null;
2133
2135
  } else if (["export", "declare", "local", "readonly"].includes(name)) {
2134
2136
  assign(scope, argv.slice(1).filter((arg) => /^[A-Za-z_]\w*=/.test(arg)));
2135
2137
  }
2136
- if (script && !truncated) parseUntil({ src: script, vars: name === "eval" ? scope.vars : /* @__PURE__ */ new Map(), dir: scope.dir, commands: scope.commands, depth: scope.depth + 1 }, 0, false);
2138
+ if (script && !truncated) parseUntil({ src: script, vars: name === "eval" ? scope.vars : /* @__PURE__ */ new Map(), dir: scope.dir, commands: scope.commands, depth: scope.depth + 1, subshell: scope.subshell || raw.subshell }, 0, false);
2137
2139
  }
2138
2140
  function readHeredocBodies(scope, heredocs, start) {
2139
2141
  const { src } = scope;
@@ -2181,7 +2183,7 @@ function readDoubleQuoted(scope, start, terminator) {
2181
2183
  return { value, end: i };
2182
2184
  }
2183
2185
  function substitute(scope, src, start, closeParen) {
2184
- const child = { src, vars: new Map(scope.vars), dir: scope.dir, commands: [], depth: scope.depth + 1 };
2186
+ const child = { src, vars: new Map(scope.vars), dir: scope.dir, commands: [], depth: scope.depth + 1, subshell: true };
2185
2187
  const end = parseUntil(child, start, closeParen);
2186
2188
  scope.commands.push(...child.commands);
2187
2189
  const [only] = child.commands;
@@ -2226,7 +2228,7 @@ function parseUntil(scope, start, closeParen) {
2226
2228
  const { src } = scope;
2227
2229
  let i = start;
2228
2230
  let line = [];
2229
- let current = { words: [], redirects: [], heredocs: [], afterAnd: false };
2231
+ let current = { words: [], redirects: [], heredocs: [], afterAnd: false, subshell: false };
2230
2232
  let pendingHeredocs = [];
2231
2233
  let word = null;
2232
2234
  let quoted = false;
@@ -2254,7 +2256,8 @@ function parseUntil(scope, start, closeParen) {
2254
2256
  const endCommand = (op) => {
2255
2257
  endWord();
2256
2258
  const done = current;
2257
- current = { words: [], redirects: [], heredocs: [], pipeFrom: op === "|" || op === "|&" ? done : void 0, afterAnd: op === "&&" };
2259
+ if (op === "&") done.subshell = true;
2260
+ current = { words: [], redirects: [], heredocs: [], pipeFrom: op === "|" || op === "|&" ? done : void 0, afterAnd: op === "&&", subshell: parens > 0 };
2258
2261
  if (done.words.length > 0 || done.redirects.length > 0 || done.heredocs.length > 0) line.push(done);
2259
2262
  };
2260
2263
  const flush = () => {
@@ -2461,16 +2464,25 @@ ${operation.diff}` : ""}`).join("\n\n");
2461
2464
  if (message.type === "interruption") return { kind: "error", title: "Agent stopped", summary: "", content: "" };
2462
2465
  return { kind: "error", title: "Agent error", summary: "", content: message.message };
2463
2466
  }
2464
- function commandWords(command) {
2465
- const commands = parseShellScript(command, null).filter(({ wrapper }) => !wrapper);
2466
- if (commands.length !== 1) return null;
2467
- const [{ argv, stdin, stdinFile, writes }] = commands;
2468
- return stdin === void 0 && !stdinFile && writes.length === 0 ? argv.map((word) => word.replaceAll(SHELL_OPAQUE, "\u2026")) : null;
2467
+ var SCRIPT_ROOT = "/";
2468
+ var commandName = (argv) => argv[0].split("/").pop() ?? argv[0];
2469
+ var fileWrites = ({ writes }) => writes.filter(({ path }) => path !== "/dev/null");
2470
+ function shellCommands(command) {
2471
+ return parseShellScript(command, SCRIPT_ROOT).filter(({ wrapper }) => !wrapper);
2472
+ }
2473
+ function simpleCommands(command) {
2474
+ const commands = shellCommands(command);
2475
+ const hasRedirectOrSubshell = commands.some((shellCommand) => shellCommand.subshell || shellCommand.stdinFile !== null || !shellCommand.piped && shellCommand.stdin !== void 0 || fileWrites(shellCommand).length > 0);
2476
+ if (commands.length === 0 || hasRedirectOrSubshell) return null;
2477
+ return commands.map((shellCommand) => {
2478
+ const argv = shellCommand.argv.map((word) => word.replaceAll(SHELL_OPAQUE, "\u2026"));
2479
+ return { ...shellCommand, argv, name: commandName(argv) };
2480
+ });
2469
2481
  }
2470
2482
  function skillNamesFromCommand(command) {
2471
- const words = commandWords(command);
2472
- if (!words) return [];
2473
- return Array.from(new Set(words.flatMap((word) => {
2483
+ const commands = simpleCommands(command);
2484
+ if (!commands) return [];
2485
+ return Array.from(new Set(commands.flatMap(({ argv }) => argv).flatMap((word) => {
2474
2486
  const skillName = skillNameFromSkillRootPath(word);
2475
2487
  return skillName ? [skillName] : [];
2476
2488
  })));
@@ -5,7 +5,7 @@ import {
5
5
  extractCommandProtectionCommandText,
6
6
  isRecord,
7
7
  parseCodeHostPrUrl
8
- } from "./chunk-QXISBAH5.js";
8
+ } from "./chunk-T2TXUSX7.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-SZTW4OGR.js";
7
- import "./chunk-4HNUOSLS.js";
8
- import "./chunk-CANEL3IU.js";
6
+ } from "./chunk-F47TKGB5.js";
7
+ import "./chunk-QSVTOKZY.js";
8
+ import "./chunk-E4WKHWCM.js";
9
9
  import {
10
10
  isRecord
11
11
  } from "./chunk-UZSNFLDQ.js";
12
- import "./chunk-QXISBAH5.js";
12
+ import "./chunk-T2TXUSX7.js";
13
13
  import "./chunk-VEQXQN22.js";
14
14
 
15
15
  // src/command-protection-hook.ts
@@ -7,12 +7,12 @@ import {
7
7
  import {
8
8
  AppServerProcess,
9
9
  buildCodexAgentEnv
10
- } from "./chunk-X76Z5POI.js";
11
- import "./chunk-CANEL3IU.js";
10
+ } from "./chunk-SYJMIBRY.js";
11
+ import "./chunk-E4WKHWCM.js";
12
12
  import {
13
13
  AGENT,
14
14
  headlessAgentRequestSchema
15
- } from "./chunk-QXISBAH5.js";
15
+ } from "./chunk-T2TXUSX7.js";
16
16
  import "./chunk-VEQXQN22.js";
17
17
 
18
18
  // src/headless-agent.ts
package/dist/src/index.js CHANGED
@@ -32,7 +32,7 @@ import {
32
32
  reportCommandProtectionBlock,
33
33
  resolveDiffBase,
34
34
  runGitCommand
35
- } from "./chunk-SZTW4OGR.js";
35
+ } from "./chunk-F47TKGB5.js";
36
36
  import {
37
37
  ACCOUNT_RATE_LIMITS_UPDATED_METHOD,
38
38
  AGENT_MESSAGE_DELTA_METHOD,
@@ -56,7 +56,7 @@ import {
56
56
  } from "./chunk-UPCC4BX5.js";
57
57
  import {
58
58
  publishedPullRequestUrls
59
- } from "./chunk-XFGXRH7Q.js";
59
+ } from "./chunk-VY7WH777.js";
60
60
  import {
61
61
  BaseRefreshManager,
62
62
  CodexAspAuthMethodChangedError,
@@ -71,7 +71,7 @@ import {
71
71
  refreshDelayMs,
72
72
  restartCodexAspHost,
73
73
  routineRefreshExclusions
74
- } from "./chunk-TFD6QK6J.js";
74
+ } from "./chunk-3TPGWE3O.js";
75
75
  import {
76
76
  ENGINE_ENV,
77
77
  monolithRequest,
@@ -79,16 +79,16 @@ import {
79
79
  readRuntimeEnvFile,
80
80
  reloadEngineEnv,
81
81
  setAgentCredentialSnapshot
82
- } from "./chunk-4HNUOSLS.js";
82
+ } from "./chunk-QSVTOKZY.js";
83
83
  import {
84
84
  AspClient,
85
85
  getCodexModelProvider
86
- } from "./chunk-X76Z5POI.js";
86
+ } from "./chunk-SYJMIBRY.js";
87
87
  import {
88
88
  SUBPROCESS_MAX_BUFFER,
89
89
  execAsync,
90
90
  execFileAsync
91
- } from "./chunk-CANEL3IU.js";
91
+ } from "./chunk-E4WKHWCM.js";
92
92
  import {
93
93
  isRecord as isRecord2
94
94
  } from "./chunk-UZSNFLDQ.js";
@@ -317,7 +317,7 @@ import {
317
317
  workspaceCredentialProviderSchema,
318
318
  workspaceTokenRequestSchema,
319
319
  workspaceTokenResponseSchema
320
- } from "./chunk-QXISBAH5.js";
320
+ } from "./chunk-T2TXUSX7.js";
321
321
  import {
322
322
  cloneMcpConfig,
323
323
  ensureCompatibilityImports,
@@ -10977,7 +10977,7 @@ import { join as join35 } from "path";
10977
10977
  import { randomUUID as randomUUID11 } from "crypto";
10978
10978
 
10979
10979
  // ../shared/src/workspace-chat.ts
10980
- var WORKSPACE_CHATS_QUERY_SCHEMA_VERSION = 10;
10980
+ var WORKSPACE_CHATS_QUERY_SCHEMA_VERSION = 11;
10981
10981
  var WORKSPACE_CHATS_QUERY_ROOT = `workspace-chats:v${WORKSPACE_CHATS_QUERY_SCHEMA_VERSION}`;
10982
10982
  function isAcceptedUserMessage(event) {
10983
10983
  return getUserMessage(event) !== null && event.payload.source === ACCEPTED_USER_MESSAGE_SOURCE;
@@ -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-XFGXRH7Q.js";
6
+ } from "./chunk-VY7WH777.js";
7
7
  import {
8
8
  isRecord
9
9
  } from "./chunk-UZSNFLDQ.js";
10
10
  import {
11
11
  shouldRefreshPullRequests
12
- } from "./chunk-QXISBAH5.js";
12
+ } from "./chunk-T2TXUSX7.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-QXISBAH5.js";
12
+ } from "./chunk-T2TXUSX7.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.959",
3
+ "version": "0.1.960",
4
4
  "description": "Lightweight API server for Replicas workspaces",
5
5
  "type": "module",
6
6
  "main": "dist/src/index.js",