audrey 1.0.1 → 1.0.3

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.
Files changed (235) hide show
  1. package/CHANGELOG.md +57 -0
  2. package/README.md +13 -3
  3. package/benchmarks/adapter-self-test.mjs +6 -2
  4. package/benchmarks/adapters/example-allow.mjs +5 -2
  5. package/benchmarks/adapters/mem0-platform.mjs +19 -12
  6. package/benchmarks/adapters/zep-cloud.mjs +51 -27
  7. package/benchmarks/baselines.js +11 -6
  8. package/benchmarks/build-leaderboard.mjs +36 -23
  9. package/benchmarks/cases.js +24 -12
  10. package/benchmarks/create-conformance-card.mjs +12 -3
  11. package/benchmarks/create-submission-bundle.mjs +22 -8
  12. package/benchmarks/dry-run-external-adapters.mjs +24 -12
  13. package/benchmarks/guardbench.js +263 -123
  14. package/benchmarks/output/adapter-self-test/guardbench-adapter-self-test.json +4 -4
  15. package/benchmarks/output/external/guardbench-external-dry-run.json +1 -1
  16. package/benchmarks/output/external/guardbench-external-evidence.json +1 -1
  17. package/benchmarks/output/guardbench-conformance-card.json +12 -12
  18. package/benchmarks/output/guardbench-raw.json +106 -106
  19. package/benchmarks/output/guardbench-summary.json +168 -168
  20. package/benchmarks/output/leaderboard/guardbench-leaderboard.json +5 -5
  21. package/benchmarks/output/leaderboard/guardbench-leaderboard.md +2 -2
  22. package/benchmarks/output/submission-bundle/guardbench-conformance-card.json +12 -12
  23. package/benchmarks/output/submission-bundle/guardbench-raw.json +106 -106
  24. package/benchmarks/output/submission-bundle/guardbench-summary.json +168 -168
  25. package/benchmarks/output/submission-bundle/submission-manifest.json +11 -11
  26. package/benchmarks/output/submission-bundle/validation-report.json +1 -1
  27. package/benchmarks/output/summary.json +58 -58
  28. package/benchmarks/perf-snapshot.js +12 -9
  29. package/benchmarks/perf.bench.js +14 -6
  30. package/benchmarks/public-paths.mjs +11 -5
  31. package/benchmarks/reference-results.js +10 -5
  32. package/benchmarks/report.js +48 -27
  33. package/benchmarks/run-external-guardbench.mjs +47 -25
  34. package/benchmarks/run.js +112 -59
  35. package/benchmarks/validate-adapter-module.mjs +13 -10
  36. package/benchmarks/validate-adapter-registry.mjs +16 -5
  37. package/benchmarks/validate-guardbench-artifacts.mjs +76 -19
  38. package/benchmarks/verify-external-evidence.mjs +86 -31
  39. package/benchmarks/verify-publication-artifacts.mjs +34 -11
  40. package/benchmarks/verify-submission-bundle.mjs +9 -4
  41. package/dist/mcp-server/config.d.ts +1 -1
  42. package/dist/mcp-server/config.d.ts.map +1 -1
  43. package/dist/mcp-server/config.js +5 -3
  44. package/dist/mcp-server/config.js.map +1 -1
  45. package/dist/mcp-server/index.d.ts +7 -347
  46. package/dist/mcp-server/index.d.ts.map +1 -1
  47. package/dist/mcp-server/index.js +289 -256
  48. package/dist/mcp-server/index.js.map +1 -1
  49. package/dist/mcp-server/tool-schemas.d.ts +341 -0
  50. package/dist/mcp-server/tool-schemas.d.ts.map +1 -0
  51. package/dist/mcp-server/tool-schemas.js +248 -0
  52. package/dist/mcp-server/tool-schemas.js.map +1 -0
  53. package/dist/mcp-server/tool-validation.d.ts +17 -0
  54. package/dist/mcp-server/tool-validation.d.ts.map +1 -0
  55. package/dist/mcp-server/tool-validation.js +41 -0
  56. package/dist/mcp-server/tool-validation.js.map +1 -0
  57. package/dist/src/action-key.d.ts.map +1 -1
  58. package/dist/src/action-key.js +6 -2
  59. package/dist/src/action-key.js.map +1 -1
  60. package/dist/src/adaptive.d.ts.map +1 -1
  61. package/dist/src/adaptive.js +4 -2
  62. package/dist/src/adaptive.js.map +1 -1
  63. package/dist/src/affect.d.ts.map +1 -1
  64. package/dist/src/affect.js +8 -5
  65. package/dist/src/affect.js.map +1 -1
  66. package/dist/src/audrey.d.ts +1 -1
  67. package/dist/src/audrey.d.ts.map +1 -1
  68. package/dist/src/audrey.js +93 -49
  69. package/dist/src/audrey.js.map +1 -1
  70. package/dist/src/capsule.d.ts.map +1 -1
  71. package/dist/src/capsule.js +37 -15
  72. package/dist/src/capsule.js.map +1 -1
  73. package/dist/src/causal.d.ts +1 -1
  74. package/dist/src/causal.d.ts.map +1 -1
  75. package/dist/src/causal.js +4 -2
  76. package/dist/src/causal.js.map +1 -1
  77. package/dist/src/confidence.d.ts.map +1 -1
  78. package/dist/src/confidence.js +5 -5
  79. package/dist/src/confidence.js.map +1 -1
  80. package/dist/src/consolidate.d.ts.map +1 -1
  81. package/dist/src/consolidate.js +17 -9
  82. package/dist/src/consolidate.js.map +1 -1
  83. package/dist/src/context.js +1 -1
  84. package/dist/src/context.js.map +1 -1
  85. package/dist/src/controller.d.ts.map +1 -1
  86. package/dist/src/controller.js +24 -13
  87. package/dist/src/controller.js.map +1 -1
  88. package/dist/src/db.d.ts.map +1 -1
  89. package/dist/src/db.js +78 -27
  90. package/dist/src/db.js.map +1 -1
  91. package/dist/src/decay.d.ts +1 -1
  92. package/dist/src/decay.d.ts.map +1 -1
  93. package/dist/src/decay.js +1 -1
  94. package/dist/src/decay.js.map +1 -1
  95. package/dist/src/embedding.d.ts +12 -4
  96. package/dist/src/embedding.d.ts.map +1 -1
  97. package/dist/src/embedding.js +18 -16
  98. package/dist/src/embedding.js.map +1 -1
  99. package/dist/src/encode.d.ts.map +1 -1
  100. package/dist/src/encode.js +5 -4
  101. package/dist/src/encode.js.map +1 -1
  102. package/dist/src/events.d.ts +3 -2
  103. package/dist/src/events.d.ts.map +1 -1
  104. package/dist/src/events.js +7 -3
  105. package/dist/src/events.js.map +1 -1
  106. package/dist/src/export.d.ts.map +1 -1
  107. package/dist/src/export.js +21 -7
  108. package/dist/src/export.js.map +1 -1
  109. package/dist/src/feedback.d.ts.map +1 -1
  110. package/dist/src/feedback.js +1 -1
  111. package/dist/src/feedback.js.map +1 -1
  112. package/dist/src/forget.d.ts.map +1 -1
  113. package/dist/src/forget.js +12 -6
  114. package/dist/src/forget.js.map +1 -1
  115. package/dist/src/fts.d.ts.map +1 -1
  116. package/dist/src/fts.js +20 -8
  117. package/dist/src/fts.js.map +1 -1
  118. package/dist/src/hybrid-recall.d.ts.map +1 -1
  119. package/dist/src/hybrid-recall.js +12 -6
  120. package/dist/src/hybrid-recall.js.map +1 -1
  121. package/dist/src/impact.d.ts.map +1 -1
  122. package/dist/src/impact.js +26 -10
  123. package/dist/src/impact.js.map +1 -1
  124. package/dist/src/import.d.ts.map +1 -1
  125. package/dist/src/import.js +11 -6
  126. package/dist/src/import.js.map +1 -1
  127. package/dist/src/index.d.ts +3 -3
  128. package/dist/src/index.d.ts.map +1 -1
  129. package/dist/src/index.js +3 -3
  130. package/dist/src/index.js.map +1 -1
  131. package/dist/src/interference.d.ts.map +1 -1
  132. package/dist/src/interference.js +10 -5
  133. package/dist/src/interference.js.map +1 -1
  134. package/dist/src/introspect.d.ts.map +1 -1
  135. package/dist/src/introspect.js +12 -6
  136. package/dist/src/introspect.js.map +1 -1
  137. package/dist/src/llm.d.ts +2 -2
  138. package/dist/src/llm.d.ts.map +1 -1
  139. package/dist/src/llm.js +6 -6
  140. package/dist/src/llm.js.map +1 -1
  141. package/dist/src/migrate.d.ts.map +1 -1
  142. package/dist/src/migrate.js +10 -4
  143. package/dist/src/migrate.js.map +1 -1
  144. package/dist/src/preflight.d.ts.map +1 -1
  145. package/dist/src/preflight.js +6 -8
  146. package/dist/src/preflight.js.map +1 -1
  147. package/dist/src/profile.d.ts.map +1 -1
  148. package/dist/src/profile.js.map +1 -1
  149. package/dist/src/promote.d.ts.map +1 -1
  150. package/dist/src/promote.js +16 -7
  151. package/dist/src/promote.js.map +1 -1
  152. package/dist/src/prompts.d.ts.map +1 -1
  153. package/dist/src/prompts.js +1 -2
  154. package/dist/src/prompts.js.map +1 -1
  155. package/dist/src/recall.d.ts.map +1 -1
  156. package/dist/src/recall.js +85 -18
  157. package/dist/src/recall.js.map +1 -1
  158. package/dist/src/redact.d.ts.map +1 -1
  159. package/dist/src/redact.js +9 -4
  160. package/dist/src/redact.js.map +1 -1
  161. package/dist/src/reflexes.d.ts.map +1 -1
  162. package/dist/src/reflexes.js +1 -7
  163. package/dist/src/reflexes.js.map +1 -1
  164. package/dist/src/rollback.d.ts.map +1 -1
  165. package/dist/src/rollback.js +4 -2
  166. package/dist/src/rollback.js.map +1 -1
  167. package/dist/src/routes.d.ts.map +1 -1
  168. package/dist/src/routes.js +33 -13
  169. package/dist/src/routes.js.map +1 -1
  170. package/dist/src/rules-compiler.d.ts.map +1 -1
  171. package/dist/src/rules-compiler.js +24 -2
  172. package/dist/src/rules-compiler.js.map +1 -1
  173. package/dist/src/server.js +2 -2
  174. package/dist/src/server.js.map +1 -1
  175. package/dist/src/tool-trace.d.ts +2 -2
  176. package/dist/src/tool-trace.d.ts.map +1 -1
  177. package/dist/src/tool-trace.js +12 -4
  178. package/dist/src/tool-trace.js.map +1 -1
  179. package/dist/src/types.d.ts.map +1 -1
  180. package/dist/src/ulid.js +1 -1
  181. package/dist/src/ulid.js.map +1 -1
  182. package/dist/src/utils.d.ts.map +1 -1
  183. package/dist/src/utils.js.map +1 -1
  184. package/dist/src/validate.d.ts.map +1 -1
  185. package/dist/src/validate.js +20 -10
  186. package/dist/src/validate.js.map +1 -1
  187. package/docs/paper/07-evaluation.md +5 -5
  188. package/docs/paper/audrey-paper-v1.md +5 -5
  189. package/docs/paper/evidence-ledger.md +1 -1
  190. package/docs/paper/output/arxiv/arxiv-manifest.json +4 -4
  191. package/docs/paper/output/arxiv/main.tex +5 -5
  192. package/docs/paper/output/arxiv-compile-report.json +3 -3
  193. package/docs/paper/output/submission-bundle/README.md +13 -3
  194. package/docs/paper/output/submission-bundle/benchmarks/output/adapter-self-test/guardbench-adapter-self-test.json +4 -4
  195. package/docs/paper/output/submission-bundle/benchmarks/output/external/guardbench-external-dry-run.json +1 -1
  196. package/docs/paper/output/submission-bundle/benchmarks/output/external/guardbench-external-evidence.json +1 -1
  197. package/docs/paper/output/submission-bundle/benchmarks/output/guardbench-conformance-card.json +12 -12
  198. package/docs/paper/output/submission-bundle/benchmarks/output/guardbench-raw.json +106 -106
  199. package/docs/paper/output/submission-bundle/benchmarks/output/guardbench-summary.json +168 -168
  200. package/docs/paper/output/submission-bundle/benchmarks/output/leaderboard/guardbench-leaderboard.json +5 -5
  201. package/docs/paper/output/submission-bundle/benchmarks/output/leaderboard/guardbench-leaderboard.md +2 -2
  202. package/docs/paper/output/submission-bundle/benchmarks/output/submission-bundle/submission-manifest.json +11 -11
  203. package/docs/paper/output/submission-bundle/benchmarks/output/submission-bundle/validation-report.json +1 -1
  204. package/docs/paper/output/submission-bundle/benchmarks/output/summary.json +64 -64
  205. package/docs/paper/output/submission-bundle/docs/paper/07-evaluation.md +5 -5
  206. package/docs/paper/output/submission-bundle/docs/paper/audrey-paper-v1.md +5 -5
  207. package/docs/paper/output/submission-bundle/docs/paper/evidence-ledger.md +1 -1
  208. package/docs/paper/output/submission-bundle/docs/paper/output/arxiv/arxiv-manifest.json +4 -4
  209. package/docs/paper/output/submission-bundle/docs/paper/output/arxiv/main.tex +5 -5
  210. package/docs/paper/output/submission-bundle/docs/paper/output/arxiv-compile-report.json +3 -3
  211. package/docs/paper/output/submission-bundle/package.json +17 -4
  212. package/docs/paper/output/submission-bundle/paper-submission-manifest.json +34 -34
  213. package/examples/fintech-ops-demo.js +12 -5
  214. package/examples/healthcare-ops-demo.js +8 -4
  215. package/examples/ollama-memory-agent.js +41 -13
  216. package/examples/stripe-demo.js +12 -5
  217. package/package.json +17 -4
  218. package/scripts/audit-release-completion.mjs +179 -101
  219. package/scripts/create-arxiv-source.mjs +20 -14
  220. package/scripts/create-paper-submission-bundle.mjs +6 -2
  221. package/scripts/finalize-release.mjs +111 -36
  222. package/scripts/prepare-release-cut.mjs +14 -6
  223. package/scripts/publish-release-bundle.mjs +62 -23
  224. package/scripts/publish-release-github-api.mjs +89 -24
  225. package/scripts/smoke-cli.js +9 -9
  226. package/scripts/sync-paper-artifacts.mjs +5 -1
  227. package/scripts/verify-arxiv-compile.mjs +52 -16
  228. package/scripts/verify-arxiv-source.mjs +45 -15
  229. package/scripts/verify-browser-launch-plan.mjs +28 -11
  230. package/scripts/verify-browser-launch-results.mjs +32 -14
  231. package/scripts/verify-paper-artifacts.mjs +539 -79
  232. package/scripts/verify-paper-claims.mjs +48 -20
  233. package/scripts/verify-paper-submission-bundle.mjs +22 -11
  234. package/scripts/verify-publication-pack.mjs +23 -9
  235. package/scripts/verify-release-readiness.mjs +211 -76
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "audrey",
3
- "version": "1.0.1",
3
+ "version": "1.0.3",
4
4
  "description": "Local-first memory runtime for AI agents with recall, consolidation, memory reflexes, contradiction detection, and tool-trace learning",
5
5
  "type": "module",
6
6
  "main": "dist/src/index.js",
@@ -72,9 +72,9 @@
72
72
  "test": "node scripts/run-vitest.mjs",
73
73
  "test:watch": "node scripts/run-vitest.mjs watch",
74
74
  "test:artifacts": "npm run bench:perf && npm run bench:memory:check && npm run bench:guard:check && npm run bench:guard:card && npm run bench:guard:bundle && npm run bench:guard:bundle:verify && npm run bench:guard:leaderboard && npm run bench:guard:adapter-self-test && npm run bench:guard:adapter-self-test:validate && npm run bench:guard:external:dry-run && npm run bench:guard:external:evidence && npm run paper:sync && npm run paper:arxiv && npm run paper:arxiv:verify && npm run paper:arxiv:compile && npm run paper:bundle && npm run paper:bundle:verify && npm run paper:verify",
75
- "release:gate": "npm run typecheck && npm test && npm run bench:memory:check && npm run bench:guard:check && npm run bench:guard:card && npm run bench:guard:bundle && npm run bench:guard:bundle:verify && npm run bench:guard:leaderboard && npm run bench:guard:adapter-registry:validate && npm run bench:guard:external:dry-run && npm run bench:guard:external:evidence && npm run bench:guard:adapter-module:validate && npm run bench:guard:adapter-self-test && npm run bench:guard:adapter-self-test:validate && npm run bench:guard:validate && npm run bench:guard:publication:verify && npm run python:release:check && npm run smoke:cli && npm run security:audit && npm run pack:check",
76
- "release:gate:sandbox": "npm run build && npm run typecheck && npm run bench:perf && npm run bench:memory:check && npm run bench:guard:check && npm run bench:guard:card && npm run bench:guard:bundle && npm run bench:guard:bundle:verify && npm run bench:guard:leaderboard && npm run bench:guard:adapter-registry:validate && npm run bench:guard:external:dry-run && npm run bench:guard:external:evidence && npm run bench:guard:adapter-module:validate && npm run bench:guard:adapter-self-test && npm run bench:guard:adapter-self-test:validate && npm run bench:guard:validate && npm run bench:guard:publication:verify && npm run python:release:check && npm run smoke:cli && npm run security:audit && npm run pack:check",
77
- "release:gate:paper": "npm run build && npm run typecheck && npm run bench:perf && npm run bench:memory:check && npm run bench:guard:check && npm run bench:guard:card && npm run bench:guard:bundle && npm run bench:guard:bundle:verify && npm run bench:guard:leaderboard && npm run bench:guard:adapter-registry:validate && npm run bench:guard:external:dry-run && npm run bench:guard:external:evidence && npm run bench:guard:adapter-module:validate && npm run bench:guard:adapter-self-test && npm run bench:guard:adapter-self-test:validate && npm run bench:guard:validate && npm run bench:guard:publication:verify && npm run python:release:check && npm run paper:sync && npm run paper:arxiv && npm run paper:arxiv:verify && npm run paper:arxiv:compile && npm run paper:launch-plan && npm run paper:launch-results && npm run paper:bundle && npm run paper:bundle:verify && npm run paper:verify && npm run release:readiness && npm run smoke:cli && npm run security:audit && npm run pack:check",
75
+ "release:gate": "npm run typecheck && npm run lint && npm run format:check && npm test && npm run bench:memory:check && npm run bench:guard:check && npm run bench:guard:card && npm run bench:guard:bundle && npm run bench:guard:bundle:verify && npm run bench:guard:leaderboard && npm run bench:guard:adapter-registry:validate && npm run bench:guard:external:dry-run && npm run bench:guard:external:evidence && npm run bench:guard:adapter-module:validate && npm run bench:guard:adapter-self-test && npm run bench:guard:adapter-self-test:validate && npm run bench:guard:validate && npm run bench:guard:publication:verify && npm run python:release:check && npm run smoke:cli && npm run security:audit && npm run pack:check",
76
+ "release:gate:sandbox": "npm run build && npm run typecheck && npm run lint && npm run format:check && npm run bench:perf && npm run bench:memory:check && npm run bench:guard:check && npm run bench:guard:card && npm run bench:guard:bundle && npm run bench:guard:bundle:verify && npm run bench:guard:leaderboard && npm run bench:guard:adapter-registry:validate && npm run bench:guard:external:dry-run && npm run bench:guard:external:evidence && npm run bench:guard:adapter-module:validate && npm run bench:guard:adapter-self-test && npm run bench:guard:adapter-self-test:validate && npm run bench:guard:validate && npm run bench:guard:publication:verify && npm run python:release:check && npm run smoke:cli && npm run security:audit && npm run pack:check",
77
+ "release:gate:paper": "npm run build && npm run typecheck && npm run lint && npm run format:check && npm run bench:perf && npm run bench:memory:check && npm run bench:guard:check && npm run bench:guard:card && npm run bench:guard:bundle && npm run bench:guard:bundle:verify && npm run bench:guard:leaderboard && npm run bench:guard:adapter-registry:validate && npm run bench:guard:external:dry-run && npm run bench:guard:external:evidence && npm run bench:guard:adapter-module:validate && npm run bench:guard:adapter-self-test && npm run bench:guard:adapter-self-test:validate && npm run bench:guard:validate && npm run bench:guard:publication:verify && npm run python:release:check && npm run paper:sync && npm run paper:arxiv && npm run paper:arxiv:verify && npm run paper:arxiv:compile && npm run paper:launch-plan && npm run paper:launch-results && npm run paper:bundle && npm run paper:bundle:verify && npm run paper:verify && npm run release:readiness && npm run smoke:cli && npm run security:audit && npm run pack:check",
78
78
  "release:cut:plan": "node scripts/prepare-release-cut.mjs --json",
79
79
  "release:cut:apply": "node scripts/prepare-release-cut.mjs --apply",
80
80
  "release:readiness": "node scripts/verify-release-readiness.mjs --allow-pending",
@@ -135,6 +135,10 @@
135
135
  "paper:sync": "node scripts/sync-paper-artifacts.mjs",
136
136
  "paper:verify": "node scripts/verify-paper-artifacts.mjs",
137
137
  "typecheck": "tsc --noEmit",
138
+ "lint": "eslint .",
139
+ "lint:fix": "eslint . --fix",
140
+ "format": "prettier --write \"src/**/*.ts\" \"mcp-server/**/*.ts\" \"tests/**/*.js\" \"benchmarks/**/*.{js,mjs}\" \"scripts/**/*.{js,mjs}\" \"examples/**/*.js\" \"*.{js,mjs}\" \".prettierrc.json\"",
141
+ "format:check": "prettier --check \"src/**/*.ts\" \"mcp-server/**/*.ts\" \"tests/**/*.js\" \"benchmarks/**/*.{js,mjs}\" \"scripts/**/*.{js,mjs}\" \"examples/**/*.js\" \"*.{js,mjs}\" \".prettierrc.json\"",
138
142
  "serve": "node dist/mcp-server/index.js serve",
139
143
  "docker:build": "docker build -t audrey:local .",
140
144
  "docker:up": "docker compose up -d --build",
@@ -200,11 +204,20 @@
200
204
  "zod": "^4.4.3"
201
205
  },
202
206
  "devDependencies": {
207
+ "@eslint/js": "^10.0.1",
203
208
  "@types/better-sqlite3": "^7.6.13",
204
209
  "@types/node": "^25.6.2",
210
+ "eslint": "^10.4.0",
211
+ "eslint-config-prettier": "^10.1.8",
212
+ "globals": "^17.6.0",
213
+ "prettier": "^3.8.3",
205
214
  "typescript": "^6.0.3",
215
+ "typescript-eslint": "^8.60.0",
206
216
  "vitest": "^4.1.5"
207
217
  },
218
+ "overrides": {
219
+ "qs": "^6.15.2"
220
+ },
208
221
  "directories": {
209
222
  "example": "examples",
210
223
  "test": "tests"
@@ -3,7 +3,7 @@
3
3
  import { spawnSync } from 'node:child_process';
4
4
  import { createHash } from 'node:crypto';
5
5
  import { existsSync, mkdirSync, readFileSync, writeFileSync } from 'node:fs';
6
- import { dirname, join, resolve } from 'node:path';
6
+ import { dirname, resolve } from 'node:path';
7
7
  import { fileURLToPath } from 'node:url';
8
8
  import { verifyExternalGuardBenchEvidence } from '../benchmarks/verify-external-evidence.mjs';
9
9
  import { verifyBrowserLaunchResults } from './verify-browser-launch-results.mjs';
@@ -35,7 +35,8 @@ function parseArgs(argv = process.argv.slice(2)) {
35
35
 
36
36
  for (let i = 0; i < argv.length; i++) {
37
37
  const token = argv[i];
38
- if ((token === '--version' || token === '--target-version') && argv[i + 1]) args.version = argv[++i];
38
+ if ((token === '--version' || token === '--target-version') && argv[i + 1])
39
+ args.version = argv[++i];
39
40
  else if (token === '--out' && argv[i + 1]) args.out = argv[++i];
40
41
  else if (token === '--json') args.json = true;
41
42
  else if (token === '--help' || token === '-h') args.help = true;
@@ -81,7 +82,9 @@ function run(command, args, options = {}) {
81
82
  }
82
83
 
83
84
  function sha256(path) {
84
- return createHash('sha256').update(readFileSync(fromRoot(path))).digest('hex');
85
+ return createHash('sha256')
86
+ .update(readFileSync(fromRoot(path)))
87
+ .digest('hex');
85
88
  }
86
89
 
87
90
  function artifactEvidence(path) {
@@ -104,7 +107,10 @@ function statusFromGaps(gaps, passed = true) {
104
107
  }
105
108
 
106
109
  function commandEvidence(result) {
107
- const firstLine = `${result.stderr}\n${result.stdout}`.split(/\r?\n/).map(line => line.trim()).find(Boolean);
110
+ const firstLine = `${result.stderr}\n${result.stdout}`
111
+ .split(/\r?\n/)
112
+ .map(line => line.trim())
113
+ .find(Boolean);
108
114
  return `${result.command}: ${result.ok ? 'ok' : `exit ${result.status ?? 'unknown'}`}${firstLine ? ` (${firstLine})` : ''}`;
109
115
  }
110
116
 
@@ -137,10 +143,16 @@ function localPathSweep(paths) {
137
143
  for (const path of paths) {
138
144
  const absolute = fromRoot(path);
139
145
  if (!existsSync(absolute)) continue;
140
- const scan = run('rg', ['-n', '-F', '-e', 'B:\\Projects', '-e', 'C:\\Users', '-e', '\\\\?\\', '-e', 'file://', path], { timeout: 30_000 });
146
+ const scan = run(
147
+ 'rg',
148
+ ['-n', '-F', '-e', 'B:\\Projects', '-e', 'C:\\Users', '-e', '\\\\?\\', '-e', 'file://', path],
149
+ { timeout: 30_000 },
150
+ );
141
151
  if (scan.status === 0) failures.push(`${path}: local path match found`);
142
- if (scan.status !== 0 && scan.status !== 1) failures.push(`${path}: local path sweep failed (${scan.stderr || scan.stdout})`);
143
- if (scan.stdout && localPathPattern.test(scan.stdout)) failures.push(`${path}: local path sweep output contains local path`);
152
+ if (scan.status !== 0 && scan.status !== 1)
153
+ failures.push(`${path}: local path sweep failed (${scan.stderr || scan.stdout})`);
154
+ if (scan.stdout && localPathPattern.test(scan.stdout))
155
+ failures.push(`${path}: local path sweep output contains local path`);
144
156
  }
145
157
  return failures;
146
158
  }
@@ -150,16 +162,41 @@ export async function auditReleaseCompletion(options = {}) {
150
162
  const out = options.out ?? DEFAULT_OUT;
151
163
  const pkg = readJson('package.json');
152
164
  const readiness = await verifyReleaseReadiness({ targetVersion: version, allowPending: true });
153
- const strictReadiness = await verifyReleaseReadiness({ targetVersion: version, allowPending: false });
165
+ const strictReadiness = await verifyReleaseReadiness({
166
+ targetVersion: version,
167
+ allowPending: false,
168
+ });
154
169
  const browserResults = await verifyBrowserLaunchResults();
155
- const externalEvidence = await verifyExternalGuardBenchEvidence({ allowPending: true, write: false });
170
+ const externalEvidence = await verifyExternalGuardBenchEvidence({
171
+ allowPending: true,
172
+ write: false,
173
+ });
156
174
  const paperVerify = run('node', ['scripts/verify-paper-artifacts.mjs'], { timeout: 180_000 });
157
- const paperBundleVerify = run('node', ['scripts/verify-paper-submission-bundle.mjs'], { timeout: 120_000 });
175
+ const paperBundleVerify = run('node', ['scripts/verify-paper-submission-bundle.mjs'], {
176
+ timeout: 120_000,
177
+ });
158
178
  const audit = run('npm', ['audit', '--omit=dev', '--audit-level=moderate'], { timeout: 120_000 });
159
179
  const diffCheck = run('git', ['diff', '--check'], { timeout: 60_000 });
160
- const bundleVerify = run('git', ['bundle', 'verify', `.tmp/release-artifacts/audrey-${version}.git.bundle`], { timeout: 60_000 });
161
- const remoteRefsResult = run('git', ['-c', 'http.sslBackend=openssl', 'ls-remote', 'origin', 'refs/heads/master', `refs/tags/v${version}`], { timeout: 60_000 });
162
- const npmView = run('npm', ['view', `audrey@${version}`, 'version', '--registry', NPM_REGISTRY], { timeout: 60_000 });
180
+ const bundleVerify = run(
181
+ 'git',
182
+ ['bundle', 'verify', `.tmp/release-artifacts/audrey-${version}.git.bundle`],
183
+ { timeout: 60_000 },
184
+ );
185
+ const remoteRefsResult = run(
186
+ 'git',
187
+ [
188
+ '-c',
189
+ 'http.sslBackend=openssl',
190
+ 'ls-remote',
191
+ 'origin',
192
+ 'refs/heads/master',
193
+ `refs/tags/v${version}`,
194
+ ],
195
+ { timeout: 60_000 },
196
+ );
197
+ const npmView = run('npm', ['view', `audrey@${version}`, 'version', '--registry', NPM_REGISTRY], {
198
+ timeout: 60_000,
199
+ });
163
200
  const pypi = await checkPypi(version);
164
201
  const gitObjects = latestGitObjectReport();
165
202
  const remoteRefs = extractRemoteRefs(remoteRefsResult.stdout);
@@ -170,130 +207,166 @@ export async function auditReleaseCompletion(options = {}) {
170
207
 
171
208
  const checklist = [];
172
209
  const versionGaps = [];
173
- if (pkg.version !== version) versionGaps.push(`package.json is ${pkg.version}, expected ${version}`);
174
- if (!readiness.ok) versionGaps.push(...readiness.failures.map(failure => `readiness failure: ${failure}`));
175
- checklist.push(checklistItem(
176
- 'code-release-local-readiness',
177
- 'Audrey codebase is cut to 1.0.0 and local release gates are coherent.',
178
- statusFromGaps(versionGaps, readiness.ok),
179
- [
180
- `package.json version=${pkg.version}`,
181
- `readiness ok=${readiness.ok}`,
182
- `strict readiness ok=${strictReadiness.ok}`,
183
- `pending blockers=${readiness.blockers.length}`,
184
- ],
185
- versionGaps,
186
- ));
210
+ if (pkg.version !== version)
211
+ versionGaps.push(`package.json is ${pkg.version}, expected ${version}`);
212
+ if (!readiness.ok)
213
+ versionGaps.push(...readiness.failures.map(failure => `readiness failure: ${failure}`));
214
+ checklist.push(
215
+ checklistItem(
216
+ 'code-release-local-readiness',
217
+ 'Audrey codebase is cut to 1.0.0 and local release gates are coherent.',
218
+ statusFromGaps(versionGaps, readiness.ok),
219
+ [
220
+ `package.json version=${pkg.version}`,
221
+ `readiness ok=${readiness.ok}`,
222
+ `strict readiness ok=${strictReadiness.ok}`,
223
+ `pending blockers=${readiness.blockers.length}`,
224
+ ],
225
+ versionGaps,
226
+ ),
227
+ );
187
228
 
188
229
  const sourceGaps = [];
189
230
  const remoteMaster = remoteRefs.get('refs/heads/master');
190
- const remoteTag = remoteRefs.get(`refs/tags/v${version}`) ?? remoteRefs.get(`refs/tags/v${version}^{}`);
231
+ const remoteTag =
232
+ remoteRefs.get(`refs/tags/v${version}`) ?? remoteRefs.get(`refs/tags/v${version}^{}`);
191
233
  if (!bundleVerify.ok) sourceGaps.push('release Git bundle does not verify');
192
234
  if (!gitObjects?.commit) sourceGaps.push('missing external release commit object report');
193
235
  if (gitObjects?.commit && remoteMaster !== gitObjects.commit) {
194
- sourceGaps.push(`remote master is ${remoteMaster ?? 'missing'}, not release commit ${gitObjects.commit}`);
236
+ sourceGaps.push(
237
+ `remote master is ${remoteMaster ?? 'missing'}, not release commit ${gitObjects.commit}`,
238
+ );
195
239
  }
196
240
  if (!remoteTag) sourceGaps.push(`remote tag v${version} is missing`);
197
- checklist.push(checklistItem(
198
- 'source-control-release-state',
199
- 'Final release commit and v1.0.0 tag are present on the public repository.',
200
- statusFromGaps(sourceGaps, bundleVerify.ok && remoteRefsResult.ok),
201
- [
202
- commandEvidence(bundleVerify),
203
- `external commit=${gitObjects?.commit ?? 'missing'}`,
204
- `external tag object=${gitObjects?.tag ?? 'missing'}`,
205
- `remote master=${remoteMaster ?? 'missing'}`,
206
- `remote tag=${remoteTag ?? 'missing'}`,
207
- ],
208
- sourceGaps,
209
- ));
241
+ checklist.push(
242
+ checklistItem(
243
+ 'source-control-release-state',
244
+ 'Final release commit and v1.0.0 tag are present on the public repository.',
245
+ statusFromGaps(sourceGaps, bundleVerify.ok && remoteRefsResult.ok),
246
+ [
247
+ commandEvidence(bundleVerify),
248
+ `external commit=${gitObjects?.commit ?? 'missing'}`,
249
+ `external tag object=${gitObjects?.tag ?? 'missing'}`,
250
+ `remote master=${remoteMaster ?? 'missing'}`,
251
+ `remote tag=${remoteTag ?? 'missing'}`,
252
+ ],
253
+ sourceGaps,
254
+ ),
255
+ );
210
256
 
211
257
  const npmArtifact = artifactEvidence(`.tmp/release-artifacts/audrey-${version}.tgz`);
212
258
  const npmGaps = [];
213
259
  if (!npmArtifact.exists) npmGaps.push('npm tarball missing');
214
- if (!npmView.ok) npmGaps.push(`audrey@${version} is not published on npm or npm registry check failed`);
215
- checklist.push(checklistItem(
216
- 'npm-package-publication',
217
- 'audrey@1.0.0 npm package is packaged and published.',
218
- statusFromGaps(npmGaps),
219
- [JSON.stringify(npmArtifact), commandEvidence(npmView)],
220
- npmGaps,
221
- ));
260
+ if (!npmView.ok)
261
+ npmGaps.push(`audrey@${version} is not published on npm or npm registry check failed`);
262
+ checklist.push(
263
+ checklistItem(
264
+ 'npm-package-publication',
265
+ 'audrey@1.0.0 npm package is packaged and published.',
266
+ statusFromGaps(npmGaps),
267
+ [JSON.stringify(npmArtifact), commandEvidence(npmView)],
268
+ npmGaps,
269
+ ),
270
+ );
222
271
 
223
272
  const wheel = artifactEvidence(`python/dist/audrey_memory-${version}-py3-none-any.whl`);
224
273
  const sdist = artifactEvidence(`python/dist/audrey_memory-${version}.tar.gz`);
225
274
  const pypiGaps = [];
226
275
  if (!wheel.exists) pypiGaps.push('Python wheel missing');
227
276
  if (!sdist.exists) pypiGaps.push('Python sdist missing');
228
- if (!pypi.ok) pypiGaps.push(`audrey-memory ${version} is not published on PyPI (status=${pypi.status})`);
229
- checklist.push(checklistItem(
230
- 'python-package-publication',
231
- 'audrey-memory 1.0.0 Python package is built and published.',
232
- statusFromGaps(pypiGaps),
233
- [JSON.stringify(wheel), JSON.stringify(sdist), `PyPI status=${pypi.status}`],
234
- pypiGaps,
235
- ));
277
+ if (!pypi.ok)
278
+ pypiGaps.push(`audrey-memory ${version} is not published on PyPI (status=${pypi.status})`);
279
+ checklist.push(
280
+ checklistItem(
281
+ 'python-package-publication',
282
+ 'audrey-memory 1.0.0 Python package is built and published.',
283
+ statusFromGaps(pypiGaps),
284
+ [JSON.stringify(wheel), JSON.stringify(sdist), `PyPI status=${pypi.status}`],
285
+ pypiGaps,
286
+ ),
287
+ );
236
288
 
237
289
  const paperGaps = [];
238
290
  if (!paperVerify.ok) paperGaps.push('paper artifact verifier failed');
239
291
  if (!paperBundleVerify.ok) paperGaps.push('paper submission bundle verifier failed');
240
- checklist.push(checklistItem(
241
- 'paper-local-quality',
242
- 'Research paper, claim register, bibliography, evidence ledger, arXiv source, and submission bundle verify locally.',
243
- statusFromGaps(paperGaps, paperVerify.ok && paperBundleVerify.ok),
244
- [commandEvidence(paperVerify), commandEvidence(paperBundleVerify)],
245
- paperGaps,
246
- ));
292
+ checklist.push(
293
+ checklistItem(
294
+ 'paper-local-quality',
295
+ 'Research paper, claim register, bibliography, evidence ledger, arXiv source, and submission bundle verify locally.',
296
+ statusFromGaps(paperGaps, paperVerify.ok && paperBundleVerify.ok),
297
+ [commandEvidence(paperVerify), commandEvidence(paperBundleVerify)],
298
+ paperGaps,
299
+ ),
300
+ );
247
301
 
248
302
  const publicationGaps = [];
249
303
  if (!browserResults.ok) publicationGaps.push(...browserResults.failures);
250
304
  if (!browserResults.ready) publicationGaps.push(...browserResults.blockers);
251
- checklist.push(checklistItem(
252
- 'paper-publication',
253
- 'Paper is publicly submitted/published across the launch targets recorded by the browser launch ledger.',
254
- statusFromGaps(publicationGaps, browserResults.ok),
255
- [
256
- `browser results ok=${browserResults.ok}`,
257
- `browser results ready=${browserResults.ready}`,
258
- `submitted=${browserResults.targets.filter(target => target.status === 'submitted').length}/${browserResults.targets.length}`,
259
- ],
260
- publicationGaps,
261
- ));
305
+ checklist.push(
306
+ checklistItem(
307
+ 'paper-publication',
308
+ 'Paper is publicly submitted/published across the launch targets recorded by the browser launch ledger.',
309
+ statusFromGaps(publicationGaps, browserResults.ok),
310
+ [
311
+ `browser results ok=${browserResults.ok}`,
312
+ `browser results ready=${browserResults.ready}`,
313
+ `submitted=${browserResults.targets.filter(target => target.status === 'submitted').length}/${browserResults.targets.length}`,
314
+ ],
315
+ publicationGaps,
316
+ ),
317
+ );
262
318
 
263
319
  const guardGaps = [];
264
320
  if (!externalEvidence.ok) guardGaps.push(...externalEvidence.failures);
265
- for (const adapter of externalEvidence.adapters.filter(adapter => adapter.status !== 'verified')) {
266
- guardGaps.push(`${adapter.id}: ${adapter.missingEnv?.length ? `missing ${adapter.missingEnv.join(', ')}` : adapter.evidenceKind}`);
321
+ for (const adapter of externalEvidence.adapters.filter(
322
+ adapter => adapter.status !== 'verified',
323
+ )) {
324
+ guardGaps.push(
325
+ `${adapter.id}: ${adapter.missingEnv?.length ? `missing ${adapter.missingEnv.join(', ')}` : adapter.evidenceKind}`,
326
+ );
267
327
  }
268
- checklist.push(checklistItem(
269
- 'external-guardbench-evidence',
270
- 'External GuardBench adapters are live-verified, not only dry-run verified.',
271
- statusFromGaps(guardGaps, externalEvidence.ok),
272
- externalEvidence.adapters.map(adapter => `${adapter.id}: ${adapter.status}/${adapter.evidenceKind}`),
273
- guardGaps,
274
- ));
328
+ checklist.push(
329
+ checklistItem(
330
+ 'external-guardbench-evidence',
331
+ 'External GuardBench adapters are live-verified, not only dry-run verified.',
332
+ statusFromGaps(guardGaps, externalEvidence.ok),
333
+ externalEvidence.adapters.map(
334
+ adapter => `${adapter.id}: ${adapter.status}/${adapter.evidenceKind}`,
335
+ ),
336
+ guardGaps,
337
+ ),
338
+ );
275
339
 
276
340
  const safetyGaps = [];
277
341
  if (!audit.ok) safetyGaps.push('production dependency audit failed');
278
342
  if (!diffCheck.ok) safetyGaps.push('git diff --check failed');
279
343
  safetyGaps.push(...localPathFailures);
280
- checklist.push(checklistItem(
281
- 'release-safety-hygiene',
282
- 'Release artifacts pass dependency audit, whitespace checks, and local-path leak sweeps.',
283
- statusFromGaps(safetyGaps, audit.ok && diffCheck.ok),
284
- [commandEvidence(audit), commandEvidence(diffCheck), `local path sweep failures=${localPathFailures.length}`],
285
- safetyGaps,
286
- ));
344
+ checklist.push(
345
+ checklistItem(
346
+ 'release-safety-hygiene',
347
+ 'Release artifacts pass dependency audit, whitespace checks, and local-path leak sweeps.',
348
+ statusFromGaps(safetyGaps, audit.ok && diffCheck.ok),
349
+ [
350
+ commandEvidence(audit),
351
+ commandEvidence(diffCheck),
352
+ `local path sweep failures=${localPathFailures.length}`,
353
+ ],
354
+ safetyGaps,
355
+ ),
356
+ );
287
357
 
288
358
  const finalizerGaps = [];
289
359
  if (!artifactReport) finalizerGaps.push('missing release-finalize-report.json');
290
- checklist.push(checklistItem(
291
- 'release-finalizer-artifacts',
292
- 'Finalization report records packaged npm/Python artifacts and source-control handoff artifacts.',
293
- statusFromGaps(finalizerGaps),
294
- artifactReport?.artifacts?.map(artifact => `${artifact.path} sha256=${artifact.sha256}`) ?? [],
295
- finalizerGaps,
296
- ));
360
+ checklist.push(
361
+ checklistItem(
362
+ 'release-finalizer-artifacts',
363
+ 'Finalization report records packaged npm/Python artifacts and source-control handoff artifacts.',
364
+ statusFromGaps(finalizerGaps),
365
+ artifactReport?.artifacts?.map(artifact => `${artifact.path} sha256=${artifact.sha256}`) ??
366
+ [],
367
+ finalizerGaps,
368
+ ),
369
+ );
297
370
 
298
371
  const complete = checklist.every(item => item.status === 'passed');
299
372
  const report = {
@@ -343,7 +416,9 @@ async function main() {
343
416
  } else {
344
417
  console.log(`Audrey release completion audit: complete=${report.complete}`);
345
418
  for (const item of report.checklist) {
346
- console.log(`- ${item.id}: ${item.status}${item.gaps.length ? ` (${item.gaps.length} gap(s))` : ''}`);
419
+ console.log(
420
+ `- ${item.id}: ${item.status}${item.gaps.length ? ` (${item.gaps.length} gap(s))` : ''}`,
421
+ );
347
422
  }
348
423
  }
349
424
 
@@ -351,7 +426,10 @@ async function main() {
351
426
  }
352
427
 
353
428
  function isDirectRun() {
354
- return Boolean(process.argv[1]) && resolve(process.argv[1]).toLowerCase() === fileURLToPath(import.meta.url).toLowerCase();
429
+ return (
430
+ Boolean(process.argv[1]) &&
431
+ resolve(process.argv[1]).toLowerCase() === fileURLToPath(import.meta.url).toLowerCase()
432
+ );
355
433
  }
356
434
 
357
435
  if (isDirectRun()) {
@@ -1,6 +1,6 @@
1
1
  import { createHash } from 'node:crypto';
2
2
  import { cpSync, mkdirSync, readFileSync, rmSync, writeFileSync } from 'node:fs';
3
- import { dirname, join, relative, resolve } from 'node:path';
3
+ import { dirname, join, resolve } from 'node:path';
4
4
  import { fileURLToPath } from 'node:url';
5
5
 
6
6
  const ROOT = resolve(dirname(fileURLToPath(import.meta.url)), '..');
@@ -60,9 +60,11 @@ function protectInline(text) {
60
60
  };
61
61
 
62
62
  let next = text.replace(/\[([^\]]+)\]\((https?:\/\/[^)]+)\)/g, (_, label, url) =>
63
- protect(`\\href{${latexEscape(url)}}{${latexEscape(label)}}`));
63
+ protect(`\\href{${latexEscape(url)}}{${latexEscape(label)}}`),
64
+ );
64
65
  next = next.replace(/\[([^\]]+)\]\(([^)]+)\)/g, (_, label, url) =>
65
- protect(`\\texttt{${latexEscape(label)}} (${latexEscape(url)})`));
66
+ protect(`\\texttt{${latexEscape(label)}} (${latexEscape(url)})`),
67
+ );
66
68
  next = next.replace(/\[@([^\]]+)\]/g, (_, rawIds) => {
67
69
  const ids = rawIds
68
70
  .split(/;\s*@?|\s*,\s*@?/)
@@ -288,17 +290,21 @@ export function writeArxivSourcePackage(options = {}) {
288
290
 
289
291
  writeFileSync(join(outDir, 'main.tex'), built.tex, 'utf-8');
290
292
  cpSync(fromRoot(SOURCE_BIB), join(outDir, 'references.bib'));
291
- writeFileSync(join(outDir, 'README-arxiv.txt'), [
292
- 'Audrey arXiv source package',
293
- '',
294
- 'Main file: main.tex',
295
- 'Bibliography: references.bib',
296
- '',
297
- 'Generated from docs/paper/audrey-paper-v1.md and docs/paper/publication-pack.json.',
298
- 'This host did not require a local TeX compiler to generate the source package.',
299
- 'Before final arXiv upload, compile with a TeX toolchain and preview the PDF in arXiv.',
300
- '',
301
- ].join('\n'), 'utf-8');
293
+ writeFileSync(
294
+ join(outDir, 'README-arxiv.txt'),
295
+ [
296
+ 'Audrey arXiv source package',
297
+ '',
298
+ 'Main file: main.tex',
299
+ 'Bibliography: references.bib',
300
+ '',
301
+ 'Generated from docs/paper/audrey-paper-v1.md and docs/paper/publication-pack.json.',
302
+ 'This host did not require a local TeX compiler to generate the source package.',
303
+ 'Before final arXiv upload, compile with a TeX toolchain and preview the PDF in arXiv.',
304
+ '',
305
+ ].join('\n'),
306
+ 'utf-8',
307
+ );
302
308
 
303
309
  const files = [
304
310
  fileRecord(outDir, 'main.tex', SOURCE_MARKDOWN),
@@ -138,10 +138,14 @@ export async function writePaperSubmissionBundle(options = {}) {
138
138
  const claimVerification = await verifyPaperClaims();
139
139
  const publicationPackVerification = await verifyPublicationPack();
140
140
  if (!claimVerification.ok) {
141
- throw new Error(`Cannot create paper submission bundle with invalid claims: ${claimVerification.failures.join('; ')}`);
141
+ throw new Error(
142
+ `Cannot create paper submission bundle with invalid claims: ${claimVerification.failures.join('; ')}`,
143
+ );
142
144
  }
143
145
  if (!publicationPackVerification.ok) {
144
- throw new Error(`Cannot create paper submission bundle with invalid publication pack: ${publicationPackVerification.failures.join('; ')}`);
146
+ throw new Error(
147
+ `Cannot create paper submission bundle with invalid publication pack: ${publicationPackVerification.failures.join('; ')}`,
148
+ );
145
149
  }
146
150
 
147
151
  rmSync(outDir, { recursive: true, force: true });