replicas-engine 0.1.1017 → 0.1.1019

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-HUJTXZYJ.js";
9
- import "./chunk-P55NZKFG.js";
10
- import "./chunk-KZBWIWGY.js";
11
- import "./chunk-PEHCBBPE.js";
8
+ } from "./chunk-7VUQPXFS.js";
9
+ import "./chunk-WJGY4JE2.js";
10
+ import "./chunk-AVAUTFKY.js";
11
+ import "./chunk-HCVB7XLV.js";
12
12
  import "./chunk-UZSNFLDQ.js";
13
- import "./chunk-SLOE5Q64.js";
13
+ import "./chunk-B5WGCH5R.js";
14
14
  import "./chunk-VEQXQN22.js";
15
15
  export {
16
16
  getCodexAspHost,
@@ -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-P55NZKFG.js";
6
+ } from "./chunk-WJGY4JE2.js";
7
7
  import {
8
8
  SUBPROCESS_MAX_BUFFER,
9
9
  execFileAsync
10
- } from "./chunk-PEHCBBPE.js";
10
+ } from "./chunk-HCVB7XLV.js";
11
11
  import {
12
12
  extractCommandProtectionCommandText,
13
13
  findCommandProtectionGitLookups,
14
14
  findGitCommitSignals,
15
15
  findPrMergeSignals,
16
16
  parseCommandProtectionRequest
17
- } from "./chunk-SLOE5Q64.js";
17
+ } from "./chunk-B5WGCH5R.js";
18
18
 
19
19
  // src/services/command-protection-service.ts
20
20
  import { readFile, stat } from "fs/promises";
@@ -5,15 +5,15 @@ import {
5
5
  ENGINE_ENV,
6
6
  monolithRequest,
7
7
  setAgentCredentialSnapshot
8
- } from "./chunk-P55NZKFG.js";
8
+ } from "./chunk-WJGY4JE2.js";
9
9
  import {
10
10
  AppServerProcess,
11
11
  buildCodexAgentEnv
12
- } from "./chunk-KZBWIWGY.js";
12
+ } from "./chunk-AVAUTFKY.js";
13
13
  import {
14
14
  SUBPROCESS_MAX_BUFFER,
15
15
  execFileAsync
16
- } from "./chunk-PEHCBBPE.js";
16
+ } from "./chunk-HCVB7XLV.js";
17
17
  import {
18
18
  isRecord
19
19
  } from "./chunk-UZSNFLDQ.js";
@@ -28,7 +28,7 @@ import {
28
28
  listOpenAICompatibleModels,
29
29
  readOllamaAuthEnv,
30
30
  resolveOpenAICompatibleModelsUrl
31
- } from "./chunk-SLOE5Q64.js";
31
+ } from "./chunk-B5WGCH5R.js";
32
32
 
33
33
  // src/managers/codex-token-manager.ts
34
34
  import { promises as fs } from "fs";
@@ -264,7 +264,7 @@ var CodexTokenManager = class extends BaseRefreshManager {
264
264
  await this.applyCredentialUpdate(++this.credentialGeneration, async () => {
265
265
  await this.applyCredentialsResponse(data);
266
266
  setAgentCredentialSnapshot("codex", data);
267
- const { restartCodexAspHostIfRunning: restartCodexAspHostIfRunning2 } = await import("./asp-host-S7GXAJPC.js");
267
+ const { restartCodexAspHostIfRunning: restartCodexAspHostIfRunning2 } = await import("./asp-host-YJWSUD5E.js");
268
268
  await restartCodexAspHostIfRunning2();
269
269
  });
270
270
  await this.start(true);
@@ -285,7 +285,7 @@ var CodexTokenManager = class extends BaseRefreshManager {
285
285
  const accountChanged = ENGINE_ENV.REPLICAS_AGENT_CREDENTIALS.codex?.credentialId !== data.credentialId;
286
286
  await this.applyCredentialsResponse(data);
287
287
  if (restartOnChange && (accountChanged || CODEX_AUTH_ENV_KEYS.some((key, index) => process.env[key] !== previousEnv[index]))) {
288
- const { restartCodexAspHostIfRunning: restartCodexAspHostIfRunning2 } = await import("./asp-host-S7GXAJPC.js");
288
+ const { restartCodexAspHostIfRunning: restartCodexAspHostIfRunning2 } = await import("./asp-host-YJWSUD5E.js");
289
289
  await restartCodexAspHostIfRunning2();
290
290
  }
291
291
  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-PEHCBBPE.js";
6
+ } from "./chunk-HCVB7XLV.js";
7
7
  import {
8
8
  isVersionBelow
9
- } from "./chunk-SLOE5Q64.js";
9
+ } from "./chunk-B5WGCH5R.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.1017";
243
+ var ENGINE_PACKAGE_VERSION = "0.1.1019";
244
244
  var INITIALIZE_METHOD = "initialize";
245
245
  var INITIALIZED_NOTIFICATION = "initialized";
246
246
  var ACCOUNT_LOGIN_START_METHOD = "account/login/start";
@@ -1719,40 +1719,6 @@ var headlessAgentRequestSchema = z4.object({
1719
1719
  // ../shared/src/engine/environment.ts
1720
1720
  var DESKTOP_STREAM_PORT = 6080;
1721
1721
 
1722
- // ../shared/src/sse.ts
1723
- function parseSseChunk(chunk) {
1724
- let data = "";
1725
- for (const line of chunk.split("\n")) {
1726
- if (line.startsWith("data: ")) {
1727
- data += line.slice(6);
1728
- }
1729
- }
1730
- if (!data) return null;
1731
- try {
1732
- return JSON.parse(data);
1733
- } catch {
1734
- return null;
1735
- }
1736
- }
1737
- async function readSseStream(body, onEvent, shouldContinue = () => true) {
1738
- const reader = body.getReader();
1739
- const decoder2 = new TextDecoder();
1740
- let buffer = "";
1741
- while (shouldContinue()) {
1742
- const { done, value } = await reader.read();
1743
- if (done) break;
1744
- buffer += decoder2.decode(value, { stream: true });
1745
- const chunks = buffer.split("\n\n");
1746
- buffer = chunks.pop() ?? "";
1747
- for (const chunk of chunks) {
1748
- if (!shouldContinue()) break;
1749
- const event = parseSseChunk(chunk);
1750
- if (!event) continue;
1751
- await onEvent(event);
1752
- }
1753
- }
1754
- }
1755
-
1756
1722
  // ../shared/src/workspace-identity.ts
1757
1723
  import { z as z5 } from "zod";
1758
1724
  var WORKSPACE_IDENTITY_AUDIENCE = "replicas:workspace";
@@ -1797,6 +1763,40 @@ var mcpWorkloadAuthSchema = z5.strictObject({
1797
1763
  audience: workspaceAudienceSchema
1798
1764
  });
1799
1765
 
1766
+ // ../shared/src/sse.ts
1767
+ function parseSseChunk(chunk) {
1768
+ let data = "";
1769
+ for (const line of chunk.split("\n")) {
1770
+ if (line.startsWith("data: ")) {
1771
+ data += line.slice(6);
1772
+ }
1773
+ }
1774
+ if (!data) return null;
1775
+ try {
1776
+ return JSON.parse(data);
1777
+ } catch {
1778
+ return null;
1779
+ }
1780
+ }
1781
+ async function readSseStream(body, onEvent, shouldContinue = () => true) {
1782
+ const reader = body.getReader();
1783
+ const decoder2 = new TextDecoder();
1784
+ let buffer = "";
1785
+ while (shouldContinue()) {
1786
+ const { done, value } = await reader.read();
1787
+ if (done) break;
1788
+ buffer += decoder2.decode(value, { stream: true });
1789
+ const chunks = buffer.split("\n\n");
1790
+ buffer = chunks.pop() ?? "";
1791
+ for (const chunk of chunks) {
1792
+ if (!shouldContinue()) break;
1793
+ const event = parseSseChunk(chunk);
1794
+ if (!event) continue;
1795
+ await onEvent(event);
1796
+ }
1797
+ }
1798
+ }
1799
+
1800
1800
  // ../shared/src/json.ts
1801
1801
  function safeJsonParse(str, fallback) {
1802
1802
  try {
@@ -8785,6 +8785,10 @@ var DEFAULT_WORKSPACE_FILTERS = {
8785
8785
  activity: "any"
8786
8786
  };
8787
8787
  var ONE_DAY_MS = 24 * 60 * 60 * 1e3;
8788
+ var workspaceExecRequestSchema = z16.object({
8789
+ command: z16.string().regex(/\S/, "command is required"),
8790
+ timeout_seconds: z16.number().int().min(1).max(50).optional().describe("Default: 30")
8791
+ });
8788
8792
  var terminalRtcCandidateSchema = z16.object({ type: z16.literal("rtc-candidate"), candidate: z16.string(), mid: z16.string() });
8789
8793
  var terminalSocketServerMessageSchema = z16.discriminatedUnion("type", [
8790
8794
  z16.object({ type: z16.literal("output"), data: z16.string() }),
@@ -8908,6 +8912,20 @@ function scoreRepoFileMatch(query, filePath) {
8908
8912
  var WEBHOOK_PROVIDERS = ["linear", "github", "gitlab", "slack", "e2b", "stripe", "sentry"];
8909
8913
  var WEBHOOK_PROVIDER_SET = new Set(WEBHOOK_PROVIDERS);
8910
8914
 
8915
+ // ../shared/src/routes/environment.ts
8916
+ import { z as z19 } from "zod";
8917
+ var ENVIRONMENT_MCP_TRANSPORTS = ["stdio", "http", "sse"];
8918
+ var stringMap = z19.record(z19.string(), z19.string());
8919
+ var createEnvironmentMcpRequestSchema = z19.object({
8920
+ name: z19.string(),
8921
+ transport: z19.enum(ENVIRONMENT_MCP_TRANSPORTS),
8922
+ config: z19.union([
8923
+ z19.object({ command: z19.string().min(1), args: z19.array(z19.string()).optional(), env: stringMap.optional() }),
8924
+ z19.object({ url: z19.url(), headers: stringMap.optional(), auth: mcpWorkloadAuthSchema.optional() })
8925
+ ]).describe("stdio: `{ command, args, env }`. http/sse: `{ url, headers }`.")
8926
+ });
8927
+ var updateEnvironmentMcpRequestSchema = createEnvironmentMcpRequestSchema.partial();
8928
+
8911
8929
  // ../shared/src/workspace-sidebar-state.ts
8912
8930
  var FIRST_BOOT_GRACE_MS = 15 * 6e4;
8913
8931
  var SLOW_ENGINE_GRACE_MS = 10 * 6e4;
@@ -9118,7 +9136,7 @@ function parseChatTranscriptArtifact(value) {
9118
9136
  }
9119
9137
 
9120
9138
  // ../shared/src/learned-skills.ts
9121
- import { z as z19 } from "zod";
9139
+ import { z as z20 } from "zod";
9122
9140
 
9123
9141
  // ../shared/src/frontmatter.ts
9124
9142
  import { parse as parseYaml2 } from "yaml";
@@ -9141,8 +9159,8 @@ function parseFrontmatter(content) {
9141
9159
  var LEARNED_SKILLS_ROOT = `${SANDBOX_PATHS.REPLICAS_DIR}/learned-skills`;
9142
9160
  var LEARNED_SKILLS_MANIFEST_PATH = `${LEARNED_SKILLS_ROOT}/manifest.json`;
9143
9161
  var LEARNED_SKILL_DIR_PREFIX = "replicas-learned__";
9144
- var learnedSkillsManifestSchema = z19.object({
9145
- skills: z19.array(z19.object({ name: z19.string(), sha256: z19.string() }))
9162
+ var learnedSkillsManifestSchema = z20.object({
9163
+ skills: z20.array(z20.object({ name: z20.string(), sha256: z20.string() }))
9146
9164
  });
9147
9165
 
9148
9166
  // ../shared/src/skill-registry.ts
@@ -9379,6 +9397,14 @@ export {
9379
9397
  MAX_REPO_FILE_CONTENT_BYTES,
9380
9398
  searchRepoFileIndex,
9381
9399
  isExcludedRepoFilePath,
9400
+ WORKSPACE_IDENTITY_AUDIENCE,
9401
+ AWS_SOURCE_IDENTITY_CLAIM,
9402
+ IDENTITY_PROXY_PORT,
9403
+ IDENTITY_TOKEN_PATH,
9404
+ workspaceAudienceSchema,
9405
+ workspaceTokenRequestSchema,
9406
+ workspaceTokenResponseSchema,
9407
+ legacyWorkspaceTokenBundleSchema,
9382
9408
  readJsonlPage,
9383
9409
  normalizeChatTranscriptMetadata,
9384
9410
  parseChatTranscriptArtifact,
@@ -9387,13 +9413,5 @@ export {
9387
9413
  LEARNED_SKILL_DIR_PREFIX,
9388
9414
  learnedSkillsManifestSchema,
9389
9415
  readSseStream,
9390
- isSkillRegistryManifest,
9391
- WORKSPACE_IDENTITY_AUDIENCE,
9392
- AWS_SOURCE_IDENTITY_CLAIM,
9393
- IDENTITY_PROXY_PORT,
9394
- IDENTITY_TOKEN_PATH,
9395
- workspaceAudienceSchema,
9396
- workspaceTokenRequestSchema,
9397
- workspaceTokenResponseSchema,
9398
- legacyWorkspaceTokenBundleSchema
9416
+ isSkillRegistryManifest
9399
9417
  };
@@ -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-SLOE5Q64.js";
6
+ } from "./chunk-B5WGCH5R.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-SLOE5Q64.js";
8
+ } from "./chunk-B5WGCH5R.js";
9
9
 
10
10
  // src/services/published-pull-request-urls.ts
11
11
  function publishedPullRequestUrls(result) {
@@ -14,7 +14,7 @@ import {
14
14
  isValidAgentProvider,
15
15
  parsePosixEnvFile,
16
16
  readReplicasRuntimeEnv
17
- } from "./chunk-SLOE5Q64.js";
17
+ } from "./chunk-B5WGCH5R.js";
18
18
 
19
19
  // src/runtime-env-loader.ts
20
20
  import { readFileSync } from "fs";
@@ -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-H4FZ7JKV.js";
7
- import "./chunk-P55NZKFG.js";
8
- import "./chunk-PEHCBBPE.js";
6
+ } from "./chunk-77TEQCW5.js";
7
+ import "./chunk-WJGY4JE2.js";
8
+ import "./chunk-HCVB7XLV.js";
9
9
  import {
10
10
  isRecord
11
11
  } from "./chunk-UZSNFLDQ.js";
12
- import "./chunk-SLOE5Q64.js";
12
+ import "./chunk-B5WGCH5R.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-KZBWIWGY.js";
11
- import "./chunk-PEHCBBPE.js";
10
+ } from "./chunk-AVAUTFKY.js";
11
+ import "./chunk-HCVB7XLV.js";
12
12
  import {
13
13
  AGENT,
14
14
  headlessAgentRequestSchema
15
- } from "./chunk-SLOE5Q64.js";
15
+ } from "./chunk-B5WGCH5R.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-H4FZ7JKV.js";
35
+ } from "./chunk-77TEQCW5.js";
36
36
  import {
37
37
  ACCOUNT_RATE_LIMITS_UPDATED_METHOD,
38
38
  AGENT_MESSAGE_DELTA_METHOD,
@@ -57,7 +57,7 @@ import {
57
57
  } from "./chunk-P73LGPQO.js";
58
58
  import {
59
59
  publishedPullRequestUrls
60
- } from "./chunk-OHVXJGZT.js";
60
+ } from "./chunk-QHQGQJCB.js";
61
61
  import {
62
62
  BaseRefreshManager,
63
63
  CodexAspAuthMethodChangedError,
@@ -71,7 +71,7 @@ import {
71
71
  refreshDelayMs,
72
72
  restartCodexAspHost,
73
73
  routineRefreshRequest
74
- } from "./chunk-HUJTXZYJ.js";
74
+ } from "./chunk-7VUQPXFS.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-P55NZKFG.js";
82
+ } from "./chunk-WJGY4JE2.js";
83
83
  import {
84
84
  AspClient,
85
85
  getCodexModelProvider
86
- } from "./chunk-KZBWIWGY.js";
86
+ } from "./chunk-AVAUTFKY.js";
87
87
  import {
88
88
  SUBPROCESS_MAX_BUFFER,
89
89
  execAsync,
90
90
  execFileAsync
91
- } from "./chunk-PEHCBBPE.js";
91
+ } from "./chunk-HCVB7XLV.js";
92
92
  import {
93
93
  isRecord as isRecord2
94
94
  } from "./chunk-UZSNFLDQ.js";
@@ -316,7 +316,7 @@ import {
316
316
  workspaceCredentialProviderSchema,
317
317
  workspaceTokenRequestSchema,
318
318
  workspaceTokenResponseSchema
319
- } from "./chunk-SLOE5Q64.js";
319
+ } from "./chunk-B5WGCH5R.js";
320
320
  import {
321
321
  cloneMcpConfig,
322
322
  ensureCompatibilityImports,
@@ -60238,7 +60238,7 @@ async function uploadChatTranscriptNow(chatId, filePath, chat, capture) {
60238
60238
  } : {};
60239
60239
  if (capture) {
60240
60240
  const hash = createHash7("sha256");
60241
- for await (const chunk of createReadStream3(filePath)) hash.update(chunk);
60241
+ for await (const chunk of createReadStream3(filePath, { start: 0, end: size - 1 })) hash.update(chunk);
60242
60242
  metadata.captureId = capture.captureId;
60243
60243
  metadata.captureReason = capture.reason;
60244
60244
  metadata.sha256 = hash.digest("hex");
@@ -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-OHVXJGZT.js";
6
+ } from "./chunk-QHQGQJCB.js";
7
7
  import {
8
8
  isRecord
9
9
  } from "./chunk-UZSNFLDQ.js";
10
10
  import {
11
11
  shouldRefreshPullRequests
12
- } from "./chunk-SLOE5Q64.js";
12
+ } from "./chunk-B5WGCH5R.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-SLOE5Q64.js";
12
+ } from "./chunk-B5WGCH5R.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.1017",
3
+ "version": "0.1.1019",
4
4
  "description": "Lightweight API server for Replicas workspaces",
5
5
  "type": "module",
6
6
  "main": "dist/src/index.js",