replicas-engine 0.1.652 → 0.1.653

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.
@@ -955,8 +955,11 @@ function containsKnownSecret(value, secrets) {
955
955
  return flattened.length >= MIN_SECRET_MATCH_CHARS && haystack.includes(flattened);
956
956
  }));
957
957
  }
958
- function isUnsafeMemoryOutput(value, secrets, maxChars) {
959
- return maxChars !== void 0 && value.length > maxChars || containsSecret(value) || containsKnownSecret(value, secrets);
958
+ function getMemoryOutputSafetyViolation(value, secrets, maxChars) {
959
+ if (maxChars !== void 0 && value.length > maxChars) return "max_chars";
960
+ if (containsSecret(value)) return "secret_pattern";
961
+ if (containsKnownSecret(value, secrets)) return "known_secret";
962
+ return null;
960
963
  }
961
964
 
962
965
  // ../shared/src/async.ts
@@ -5929,7 +5932,7 @@ var DEFAULT_CODEX_ARGS = [
5929
5932
  var MIN_CODEX_CLI_VERSION = "0.144.6";
5930
5933
  var CODEX_UPGRADE_TIMEOUT_MS = 12e4;
5931
5934
  var codexCliVersionEnsured = null;
5932
- var ENGINE_PACKAGE_VERSION = "0.1.652";
5935
+ var ENGINE_PACKAGE_VERSION = "0.1.653";
5933
5936
  var INITIALIZE_METHOD = "initialize";
5934
5937
  var INITIALIZED_NOTIFICATION = "initialized";
5935
5938
  var ACCOUNT_LOGIN_START_METHOD = "account/login/start";
@@ -6294,7 +6297,7 @@ export {
6294
6297
  MEMORY_ROOT,
6295
6298
  MEMORY_SUMMARY_FILENAME,
6296
6299
  MEMORY_INDEX_FILENAME,
6297
- isUnsafeMemoryOutput,
6300
+ getMemoryOutputSafetyViolation,
6298
6301
  isSkillRegistryManifest,
6299
6302
  putPresignedFile,
6300
6303
  buildCodexAgentEnv,
@@ -3,11 +3,11 @@ import {
3
3
  AGENT,
4
4
  AppServerProcess,
5
5
  buildCodexAgentEnv,
6
+ getMemoryOutputSafetyViolation,
6
7
  headlessAgentRequestSchema,
7
- isUnsafeMemoryOutput,
8
8
  putPresignedFile,
9
9
  recoverCompletedTurn
10
- } from "./chunk-XUQTF7P5.js";
10
+ } from "./chunk-KWNVQJRM.js";
11
11
 
12
12
  // src/headless-agent.ts
13
13
  import { createHash } from "crypto";
@@ -59,8 +59,13 @@ async function publishFilesystemOutputs(request) {
59
59
  for (const output of request.outputFiles) {
60
60
  const filePath = resolveFile(request.workingDirectory, output.path);
61
61
  const content = (await readFile(filePath, "utf8")).trim();
62
- if (output.minChars !== void 0 && content.length < output.minChars || isUnsafeMemoryOutput(content, request.sensitiveValues, output.maxChars)) {
63
- throw new Error(`Headless agent output failed validation: ${output.path}`);
62
+ if (output.minChars !== void 0 && content.length < output.minChars) {
63
+ throw new Error(`Headless agent output failed validation: ${output.path} has ${content.length} characters; minimum is ${output.minChars}`);
64
+ }
65
+ const safetyViolation = getMemoryOutputSafetyViolation(content, request.sensitiveValues, output.maxChars);
66
+ if (safetyViolation) {
67
+ const reason = safetyViolation === "max_chars" ? `has ${content.length} characters; maximum is ${output.maxChars}` : safetyViolation === "secret_pattern" ? "contains secret-like content" : "contains an installed credential";
68
+ throw new Error(`Headless agent output failed validation: ${output.path} ${reason}`);
64
69
  }
65
70
  await writeFile(filePath, content, { mode: 384 });
66
71
  const { size } = await stat(filePath);
package/dist/src/index.js CHANGED
@@ -173,7 +173,7 @@ import {
173
173
  serializeCanvasContentResponse,
174
174
  shellQuotePosix,
175
175
  stripAgentDiagnosticErrors
176
- } from "./chunk-XUQTF7P5.js";
176
+ } from "./chunk-KWNVQJRM.js";
177
177
 
178
178
  // src/index.ts
179
179
  import { serve } from "@hono/node-server";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "replicas-engine",
3
- "version": "0.1.652",
3
+ "version": "0.1.653",
4
4
  "description": "Lightweight API server for Replicas workspaces",
5
5
  "type": "module",
6
6
  "main": "dist/src/index.js",