renor-engine 1.1.0 → 1.3.0

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 (193) hide show
  1. package/README.md +27 -2
  2. package/THIRD-PARTY-NOTICES +2661 -0
  3. package/dist/BUILD.json +3 -3
  4. package/dist/cli.js +1656 -490
  5. package/package.json +16 -80
  6. package/dist/.tsbuildinfo +0 -1
  7. package/dist/api/apiAuth.js +0 -43
  8. package/dist/api/server.js +0 -174
  9. package/dist/buildIdentity.js +0 -149
  10. package/dist/callPhases.js +0 -82
  11. package/dist/cli-extractors.js +0 -46
  12. package/dist/config.js +0 -65
  13. package/dist/context/composer.js +0 -320
  14. package/dist/context/readHonesty.js +0 -478
  15. package/dist/context/rowStore.js +0 -238
  16. package/dist/conversation/formatter.js +0 -81
  17. package/dist/conversation/parser.js +0 -193
  18. package/dist/conversation/types.js +0 -2
  19. package/dist/conversation/writer.js +0 -42
  20. package/dist/db/client.js +0 -149
  21. package/dist/db/handoffTable.js +0 -31
  22. package/dist/db/indexSalvage.js +0 -101
  23. package/dist/db/migrations.js +0 -670
  24. package/dist/db/readCache.js +0 -109
  25. package/dist/db/schema.js +0 -5
  26. package/dist/db/sqlite.js +0 -396
  27. package/dist/db/statements.js +0 -89
  28. package/dist/digests/digestCache.js +0 -146
  29. package/dist/digests/digests.js +0 -597
  30. package/dist/digests/worker.js +0 -350
  31. package/dist/embeddings/caching.js +0 -337
  32. package/dist/embeddings/coalescing.js +0 -177
  33. package/dist/embeddings/interactive.js +0 -103
  34. package/dist/embeddings/local.js +0 -70
  35. package/dist/embeddings/openai.js +0 -106
  36. package/dist/embeddings/rebuild.js +0 -166
  37. package/dist/embeddings/simdScan.js +0 -260
  38. package/dist/embeddings/space.js +0 -21
  39. package/dist/embeddings/types.js +0 -14
  40. package/dist/embeddings/vectorIndex.js +0 -674
  41. package/dist/embeddings/vertex.js +0 -334
  42. package/dist/eval/artifacts.js +0 -42
  43. package/dist/eval/cacheReport.js +0 -146
  44. package/dist/eval/comparison.js +0 -182
  45. package/dist/eval/context700-candidate.js +0 -145
  46. package/dist/eval/evalCache.js +0 -568
  47. package/dist/eval/hashEmbedding.js +0 -35
  48. package/dist/eval/indexSnapshots.js +0 -548
  49. package/dist/eval/longmemeval.js +0 -56
  50. package/dist/eval/metrics.js +0 -181
  51. package/dist/eval/pageDump.js +0 -67
  52. package/dist/eval/renorbenchBaseline.js +0 -486
  53. package/dist/eval/renorbenchDocuments.js +0 -134
  54. package/dist/eval/renorbenchProduct.js +0 -182
  55. package/dist/eval/runLedger.js +0 -279
  56. package/dist/eval/runManifest.js +0 -485
  57. package/dist/eval/scoring.js +0 -197
  58. package/dist/eval/textTokens.js +0 -17
  59. package/dist/evidence/attach.js +0 -264
  60. package/dist/evidence/background.js +0 -147
  61. package/dist/evidence/evidenceCache.js +0 -182
  62. package/dist/evidence/gate.js +0 -37
  63. package/dist/evidence/keyPool.js +0 -85
  64. package/dist/evidence/ollamaChat.js +0 -84
  65. package/dist/evidence/optin.js +0 -165
  66. package/dist/evidence/options.js +0 -151
  67. package/dist/evidence/secondPass.js +0 -294
  68. package/dist/extraction/classifyCapture.js +0 -34
  69. package/dist/extraction/decision-model.js +0 -174
  70. package/dist/extraction/eventExtractor.js +0 -113
  71. package/dist/extraction/extractionClient.js +0 -122
  72. package/dist/extraction/factExtractor.js +0 -46
  73. package/dist/extraction/factsWritePath.js +0 -179
  74. package/dist/extraction/preferenceExtractor.js +0 -150
  75. package/dist/extraction/secretGuard.js +0 -176
  76. package/dist/extraction/secretScanner.js +0 -665
  77. package/dist/extraction/typedFacts.js +0 -224
  78. package/dist/extraction/writePathAdjudication.js +0 -110
  79. package/dist/importing/apply.js +0 -672
  80. package/dist/importing/bundle-write.js +0 -80
  81. package/dist/importing/cli.js +0 -408
  82. package/dist/importing/existing.js +0 -51
  83. package/dist/importing/facts.js +0 -121
  84. package/dist/importing/forgetImported.js +0 -79
  85. package/dist/importing/hosted.js +0 -467
  86. package/dist/importing/journalLog.js +0 -96
  87. package/dist/importing/markdown.js +0 -98
  88. package/dist/importing/plan.js +0 -201
  89. package/dist/importing/secretScreen.js +0 -113
  90. package/dist/importing/serialize.js +0 -188
  91. package/dist/importing/source.js +0 -463
  92. package/dist/importing/types.js +0 -6
  93. package/dist/indexer/chunker.js +0 -319
  94. package/dist/indexer/dailyEntries.js +0 -63
  95. package/dist/indexer/hasher.js +0 -10
  96. package/dist/indexer/laneRuns.js +0 -48
  97. package/dist/indexer/o200k.js +0 -481
  98. package/dist/indexer/outsideRoot.js +0 -77
  99. package/dist/indexer/parser.js +0 -170
  100. package/dist/indexer/pipeline.js +0 -988
  101. package/dist/indexer/staleness.js +0 -201
  102. package/dist/indexer/tokenizer.js +0 -77
  103. package/dist/indexer/walker.js +0 -170
  104. package/dist/mcp/hive.js +0 -88
  105. package/dist/mcp/requestErrors.js +0 -47
  106. package/dist/mcp/server.js +0 -426
  107. package/dist/memory/agentLease.js +0 -43
  108. package/dist/memory/confinedWrite.js +0 -315
  109. package/dist/memory/controls.js +0 -73
  110. package/dist/memory/dailyNote.js +0 -265
  111. package/dist/memory/durableAppend.js +0 -57
  112. package/dist/memory/factConflicts.js +0 -203
  113. package/dist/memory/factTerms.js +0 -321
  114. package/dist/memory/handoff.js +0 -363
  115. package/dist/memory/hiveNameHeader.cjs +0 -10
  116. package/dist/memory/inventory.js +0 -55
  117. package/dist/memory/invisibleText.js +0 -20
  118. package/dist/memory/lifecycle.js +0 -1991
  119. package/dist/memory/limits.js +0 -13
  120. package/dist/memory/requests.js +0 -183
  121. package/dist/memory/sourceName.js +0 -276
  122. package/dist/memory/statusFacts.js +0 -61
  123. package/dist/memory/whatsNew.js +0 -158
  124. package/dist/memory/writer.js +0 -175
  125. package/dist/memory/writerConflicts.js +0 -85
  126. package/dist/memorymap/memoryMap.js +0 -1594
  127. package/dist/memorymap/replacedJournal.js +0 -58
  128. package/dist/memorymap/replacements.js +0 -410
  129. package/dist/mvp/activity.js +0 -86
  130. package/dist/mvp/agentMemory.js +0 -1800
  131. package/dist/mvp/answerCheck.js +0 -211
  132. package/dist/mvp/auth.js +0 -531
  133. package/dist/mvp/cli.js +0 -75
  134. package/dist/mvp/client-store.js +0 -462
  135. package/dist/mvp/compileCache.js +0 -242
  136. package/dist/mvp/compileSeed.js +0 -33
  137. package/dist/mvp/config.js +0 -288
  138. package/dist/mvp/connectionStatus.js +0 -80
  139. package/dist/mvp/contextDistinct.js +0 -53
  140. package/dist/mvp/contextProfile.js +0 -87
  141. package/dist/mvp/contextRelevance.js +0 -413
  142. package/dist/mvp/directorySurface.js +0 -68
  143. package/dist/mvp/engine.js +0 -1078
  144. package/dist/mvp/exportAll.js +0 -374
  145. package/dist/mvp/factLanePack.js +0 -77
  146. package/dist/mvp/factMarkers.js +0 -65
  147. package/dist/mvp/factsLane.js +0 -203
  148. package/dist/mvp/hiddenSpans.js +0 -585
  149. package/dist/mvp/history.js +0 -414
  150. package/dist/mvp/hitDates.js +0 -31
  151. package/dist/mvp/hitFloor.js +0 -36
  152. package/dist/mvp/identity.js +0 -18
  153. package/dist/mvp/idle.js +0 -113
  154. package/dist/mvp/log.js +0 -118
  155. package/dist/mvp/memoryDir.js +0 -98
  156. package/dist/mvp/posthogMcp.js +0 -210
  157. package/dist/mvp/readScope.js +0 -104
  158. package/dist/mvp/readUsefulness.js +0 -222
  159. package/dist/mvp/sanitize.js +0 -48
  160. package/dist/mvp/schemaRejections.js +0 -91
  161. package/dist/mvp/scope.js +0 -127
  162. package/dist/mvp/server.js +0 -2604
  163. package/dist/mvp/serverCard.js +0 -38
  164. package/dist/mvp/storedSize.js +0 -139
  165. package/dist/mvp/telemetry.js +0 -474
  166. package/dist/net/poolFetch.js +0 -174
  167. package/dist/recall/actionRecall.js +0 -282
  168. package/dist/recall/autoRecall.js +0 -447
  169. package/dist/recall/searchRecall.js +0 -189
  170. package/dist/retrieval/adviceLines.js +0 -195
  171. package/dist/retrieval/adviceQuestion.js +0 -44
  172. package/dist/retrieval/conversationShape.js +0 -44
  173. package/dist/retrieval/dailyEntryTime.js +0 -55
  174. package/dist/retrieval/entityLookup.js +0 -162
  175. package/dist/retrieval/factsFirst.js +0 -188
  176. package/dist/retrieval/keyword.js +0 -84
  177. package/dist/retrieval/ledgerEventTime.js +0 -51
  178. package/dist/retrieval/ledgerLiveness.js +0 -83
  179. package/dist/retrieval/ledgerPresentation.js +0 -161
  180. package/dist/retrieval/noteIdentity.js +0 -57
  181. package/dist/retrieval/orchestrator.js +0 -1171
  182. package/dist/retrieval/plainWording.js +0 -236
  183. package/dist/retrieval/queryHelpers.js +0 -142
  184. package/dist/retrieval/questionSpan.js +0 -475
  185. package/dist/retrieval/readerEvents.js +0 -690
  186. package/dist/retrieval/readerLayout.js +0 -422
  187. package/dist/retrieval/relativeTimeHints.js +0 -113
  188. package/dist/retrieval/semantic.js +0 -67
  189. package/dist/router/routerCache.js +0 -106
  190. package/dist/router/sessionRouter.js +0 -726
  191. package/dist/toolRefusal.js +0 -120
  192. package/dist/watcher/watcher.js +0 -77
  193. /package/dist/{indexer/o200k.json → o200k.json} +0 -0
@@ -1,176 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.SecretRefusedError = exports.SecretGuardDecisionModel = void 0;
4
- exports.secretGuardEnabled = secretGuardEnabled;
5
- exports.refuseUnchecked = refuseUnchecked;
6
- exports.assertStorable = assertStorable;
7
- exports.findSensitive = findSensitive;
8
- exports.logSkip = logSkip;
9
- /**
10
- * The write-path secret guard: tier 0 of the sensitivity guardrail
11
- * (docs/evals/results/SECRET-GUARD-TIER0-20261003.md).
12
- *
13
- * Behind RENOR_SECRET_GUARD, default ON (secretGuardEnabled). Every path that writes text into memory screens
14
- * it with the deterministic scanner first, before anything is written:
15
- *
16
- * save `remember` (both modes), `save_memory`, the daily-note writer, the conversation logger:
17
- * the whole save is refused. Nothing is stored, redacted or altered, so a save that
18
- * succeeds is still a save that stored every character it was given.
19
- * import a note or fact in an import plan is left out with its reason, and a plan that still holds
20
- * one is refused whole (src/importing/secretScreen.ts).
21
- * retire a memory whose text is flagged is not retired, because retiring copies its text into the
22
- * retired-memory journal; restore is refused the same way, because it puts the text back
23
- * into live memory (src/memorymap/memoryMap.ts).
24
- *
25
- * With it off (RENOR_SECRET_GUARD=0, false, no or off), nothing here runs on any of those paths.
26
- *
27
- * The guard is a DecisionModel, so the write path asks the same `capture_gate` question the indexer
28
- * asks and refuses on `sensitive`. A model's second opinion, if one is ever approved, composes behind
29
- * the scanner here, and a scanner `sensitive` stays final.
30
- *
31
- * It decides whether text may be STORED. It cannot stop text from reaching the server, and it does not
32
- * look at what is already stored.
33
- */
34
- const decision_model_1 = require("./decision-model");
35
- const secretScanner_1 = require("./secretScanner");
36
- /**
37
- * RENOR_SECRET_GUARD (default ON, decided 2026-10-12). Off only when set to 0, false, no or off (any case). Unset, empty
38
- * and any other value keep it on: a value the guard does not recognise must not switch the screen off.
39
- */
40
- function secretGuardEnabled(env = process.env) {
41
- const raw = (env.RENOR_SECRET_GUARD ?? '').trim().toLowerCase();
42
- return !(raw === '0' || raw === 'false' || raw === 'no' || raw === 'off');
43
- }
44
- /**
45
- * Answers the capture gate from the scanner alone: text it flags is `sensitive`, and everything else
46
- * (all other text, and every dedupe question) is the inner model's, so the guard changes no other decision.
47
- */
48
- class SecretGuardDecisionModel {
49
- inner;
50
- constructor(inner = (0, decision_model_1.defaultDecisionModel)()) {
51
- this.inner = inner;
52
- }
53
- async decide(request) {
54
- if (request.task !== 'capture_gate')
55
- return this.inner.decide(request);
56
- const started = Date.now();
57
- const finding = (0, secretScanner_1.scanSecrets)(request.text);
58
- if (finding === null)
59
- return this.inner.decide(request);
60
- const verdict = {
61
- task: 'capture_gate',
62
- decision: 'sensitive',
63
- confidence: 1,
64
- latencyMs: Date.now() - started,
65
- costUSDCents: 0,
66
- finding,
67
- };
68
- return verdict;
69
- }
70
- }
71
- exports.SecretGuardDecisionModel = SecretGuardDecisionModel;
72
- const APPEARS_TO_CONTAIN = {
73
- credential: 'a credential (an API key, token, password, PIN or private key)',
74
- identifier: 'a personal identifier (a payment card, government ID or phone number)',
75
- sensitive: 'a credential or personal identifier',
76
- };
77
- /**
78
- * What the caller is told. It names the field and the kind of thing found from fixed text, never the
79
- * text itself, and says what to do next. Kept under the 400 characters the MCP error reply keeps.
80
- */
81
- function refusalMessage(field, reason, action) {
82
- const lead = action === 'save' ? 'Nothing was saved' : 'Nothing was changed';
83
- if (reason === 'unavailable') {
84
- return `${lead}: the secret guard (RENOR_SECRET_GUARD) is on but could not check the ${field}, so it refuses by default. `
85
- + 'Try again, and tell the user if it keeps happening.';
86
- }
87
- if (action === 'retire') {
88
- return `${lead}: the ${field} appears to contain ${APPEARS_TO_CONTAIN[reason]}, and the secret guard (RENOR_SECRET_GUARD) is on, `
89
- + 'so this memory was not retired: retiring copies its text into the retired-memory journal. It stays as it is. '
90
- + 'Remove it with the data-deletion procedure, or ask the owner to switch the guard off first.';
91
- }
92
- if (action === 'restore') {
93
- return `${lead}: the ${field} appears to contain ${APPEARS_TO_CONTAIN[reason]}, and the secret guard (RENOR_SECRET_GUARD) is on, `
94
- + 'so this memory was not restored: restoring would put its text back into live memory. It stays retired.';
95
- }
96
- return `${lead}: the ${field} appears to contain ${APPEARS_TO_CONTAIN[reason]}, and the secret guard (RENOR_SECRET_GUARD) is on, `
97
- + 'so Renor does not store it. Save what it is for instead (for example "the staging API key is in 1Password"), '
98
- + 'or reword the text without the value, then save again.';
99
- }
100
- /** The operation was refused: nothing was written or moved. `reason` is what was found, or `unavailable` when the guard could not decide. */
101
- class SecretRefusedError extends Error {
102
- field;
103
- reason;
104
- action;
105
- constructor(field, reason, action = 'save') {
106
- super(refusalMessage(field, reason, action));
107
- this.name = 'SecretRefusedError';
108
- this.field = field;
109
- this.reason = reason;
110
- this.action = action;
111
- }
112
- }
113
- exports.SecretRefusedError = SecretRefusedError;
114
- /**
115
- * One line for whoever runs the service, in the same JSON shape as its access log: what was refused and why,
116
- * never what it said. It is how an operator sees what the guard is refusing.
117
- */
118
- function logRefusal(field, reason, action, cause) {
119
- console.warn(JSON.stringify({
120
- ts: new Date().toISOString(), event: 'secret_guard_refusal', action, field, reason,
121
- ...(cause instanceof Error ? { error: cause.name } : {}),
122
- }));
123
- }
124
- function refuse(field, reason, action, cause) {
125
- logRefusal(field, reason, action, cause);
126
- throw new SecretRefusedError(field, reason, action);
127
- }
128
- /** For a text the guard cannot read in full (too large to hold): refuse, as it does when its own check fails. */
129
- function refuseUnchecked(field, action) {
130
- return refuse(field, 'unavailable', action);
131
- }
132
- /**
133
- * Throws SecretRefusedError when the guard is on and any of `texts` is sensitive; resolves otherwise.
134
- * It fails closed: if the check itself throws, the save is refused. Call it before the first write.
135
- * With the guard off it returns at once, so callers that must not add a step to the unguarded path
136
- * check `secretGuardEnabled()` first and skip the call.
137
- */
138
- async function assertStorable(texts, action = 'save') {
139
- if (!secretGuardEnabled())
140
- return;
141
- const model = new SecretGuardDecisionModel();
142
- for (const { field, text } of texts) {
143
- if (text === undefined || text === '')
144
- continue;
145
- let verdict;
146
- try {
147
- verdict = await model.decide({ task: 'capture_gate', text });
148
- }
149
- catch (cause) {
150
- refuse(field, 'unavailable', action, cause);
151
- }
152
- if (verdict.decision === 'sensitive') {
153
- refuse(field, verdict.finding?.class ?? 'sensitive', action);
154
- }
155
- }
156
- }
157
- /**
158
- * The first of `texts` that looks like a secret, or null: the same scanner as `assertStorable`, answered at
159
- * once and without the DecisionModel, for the bulk paths that screen thousands of texts in synchronous code
160
- * (an import plan) and decide per item. Independent of the switch: callers check `secretGuardEnabled()`.
161
- * If the scan throws, the exception propagates, so a plan that cannot be screened is not built or applied.
162
- */
163
- function findSensitive(texts) {
164
- for (const { field, text } of texts) {
165
- if (text === undefined || text === '')
166
- continue;
167
- const finding = (0, secretScanner_1.scanSecrets)(text);
168
- if (finding !== null)
169
- return { field, reason: finding.class };
170
- }
171
- return null;
172
- }
173
- /** One log line for a text a bulk path left out (same shape as a refusal), so an operator sees what the guard skipped. */
174
- function logSkip(field, reason) {
175
- logRefusal(field, reason, 'import');
176
- }