renor-engine 1.2.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 (215) hide show
  1. package/README.md +21 -1
  2. package/THIRD-PARTY-NOTICES +2661 -0
  3. package/dist/BUILD.json +6 -0
  4. package/dist/cli.js +1656 -516
  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 -549
  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/jevDecisionModel.js +0 -307
  75. package/dist/extraction/preferenceExtractor.js +0 -150
  76. package/dist/extraction/secretGuard.js +0 -180
  77. package/dist/extraction/secretScanner.js +0 -665
  78. package/dist/extraction/typedFacts.js +0 -224
  79. package/dist/extraction/writePathAdjudication.js +0 -110
  80. package/dist/importing/apply.js +0 -672
  81. package/dist/importing/bundle-write.js +0 -80
  82. package/dist/importing/cli.js +0 -408
  83. package/dist/importing/existing.js +0 -51
  84. package/dist/importing/facts.js +0 -121
  85. package/dist/importing/forgetImported.js +0 -79
  86. package/dist/importing/hosted.js +0 -467
  87. package/dist/importing/journalLog.js +0 -96
  88. package/dist/importing/markdown.js +0 -98
  89. package/dist/importing/plan.js +0 -201
  90. package/dist/importing/secretScreen.js +0 -113
  91. package/dist/importing/serialize.js +0 -188
  92. package/dist/importing/source.js +0 -463
  93. package/dist/importing/types.js +0 -6
  94. package/dist/indexer/chunker.js +0 -319
  95. package/dist/indexer/dailyEntries.js +0 -63
  96. package/dist/indexer/hasher.js +0 -10
  97. package/dist/indexer/laneRuns.js +0 -48
  98. package/dist/indexer/o200k.js +0 -481
  99. package/dist/indexer/outsideRoot.js +0 -77
  100. package/dist/indexer/parser.js +0 -170
  101. package/dist/indexer/pipeline.js +0 -988
  102. package/dist/indexer/staleness.js +0 -201
  103. package/dist/indexer/tokenizer.js +0 -77
  104. package/dist/indexer/walker.js +0 -170
  105. package/dist/learning/cli.js +0 -113
  106. package/dist/learning/schema.js +0 -144
  107. package/dist/learning/settings.js +0 -45
  108. package/dist/learning/store.js +0 -267
  109. package/dist/learning/tap.js +0 -401
  110. package/dist/mcp/hive.js +0 -88
  111. package/dist/mcp/requestErrors.js +0 -47
  112. package/dist/mcp/server.js +0 -426
  113. package/dist/memory/agentLease.js +0 -43
  114. package/dist/memory/confinedWrite.js +0 -315
  115. package/dist/memory/controls.js +0 -73
  116. package/dist/memory/dailyNote.js +0 -265
  117. package/dist/memory/dreamer/adjudicate.js +0 -215
  118. package/dist/memory/dreamer/apply.js +0 -120
  119. package/dist/memory/dreamer/budget.js +0 -64
  120. package/dist/memory/dreamer/candidates.js +0 -149
  121. package/dist/memory/dreamer/collection.js +0 -104
  122. package/dist/memory/dreamer/dreamer.js +0 -352
  123. package/dist/memory/dreamer/review.js +0 -111
  124. package/dist/memory/durableAppend.js +0 -57
  125. package/dist/memory/factConflicts.js +0 -205
  126. package/dist/memory/factTerms.js +0 -321
  127. package/dist/memory/handoff.js +0 -363
  128. package/dist/memory/hiveNameHeader.cjs +0 -10
  129. package/dist/memory/inventory.js +0 -55
  130. package/dist/memory/invisibleText.js +0 -20
  131. package/dist/memory/lifecycle.js +0 -2014
  132. package/dist/memory/limits.js +0 -13
  133. package/dist/memory/requests.js +0 -183
  134. package/dist/memory/sourceName.js +0 -276
  135. package/dist/memory/statusFacts.js +0 -61
  136. package/dist/memory/whatsNew.js +0 -158
  137. package/dist/memory/writer.js +0 -176
  138. package/dist/memory/writerConflicts.js +0 -85
  139. package/dist/memorymap/memoryMap.js +0 -1594
  140. package/dist/memorymap/replacedJournal.js +0 -58
  141. package/dist/memorymap/replacements.js +0 -410
  142. package/dist/mvp/activity.js +0 -86
  143. package/dist/mvp/agentMemory.js +0 -1803
  144. package/dist/mvp/answerCheck.js +0 -211
  145. package/dist/mvp/auth.js +0 -531
  146. package/dist/mvp/cli.js +0 -86
  147. package/dist/mvp/client-store.js +0 -462
  148. package/dist/mvp/compileCache.js +0 -242
  149. package/dist/mvp/compileSeed.js +0 -33
  150. package/dist/mvp/config.js +0 -292
  151. package/dist/mvp/connectionStatus.js +0 -80
  152. package/dist/mvp/contextDistinct.js +0 -53
  153. package/dist/mvp/contextProfile.js +0 -87
  154. package/dist/mvp/contextRelevance.js +0 -413
  155. package/dist/mvp/directorySurface.js +0 -68
  156. package/dist/mvp/engine.js +0 -1078
  157. package/dist/mvp/exportAll.js +0 -393
  158. package/dist/mvp/factLanePack.js +0 -77
  159. package/dist/mvp/factMarkers.js +0 -65
  160. package/dist/mvp/factsLane.js +0 -203
  161. package/dist/mvp/hiddenSpans.js +0 -585
  162. package/dist/mvp/history.js +0 -414
  163. package/dist/mvp/hitDates.js +0 -31
  164. package/dist/mvp/hitFloor.js +0 -36
  165. package/dist/mvp/identity.js +0 -18
  166. package/dist/mvp/idle.js +0 -113
  167. package/dist/mvp/log.js +0 -118
  168. package/dist/mvp/memoryDir.js +0 -98
  169. package/dist/mvp/posthogMcp.js +0 -210
  170. package/dist/mvp/readScope.js +0 -104
  171. package/dist/mvp/readUsefulness.js +0 -222
  172. package/dist/mvp/sanitize.js +0 -48
  173. package/dist/mvp/schemaRejections.js +0 -91
  174. package/dist/mvp/scope.js +0 -127
  175. package/dist/mvp/server.js +0 -2712
  176. package/dist/mvp/serverCard.js +0 -38
  177. package/dist/mvp/storedSize.js +0 -139
  178. package/dist/mvp/telemetry.js +0 -474
  179. package/dist/net/poolFetch.js +0 -174
  180. package/dist/recall/actionRecall.js +0 -282
  181. package/dist/recall/autoRecall.js +0 -447
  182. package/dist/recall/searchRecall.js +0 -189
  183. package/dist/retrieval/adviceLines.js +0 -195
  184. package/dist/retrieval/adviceQuestion.js +0 -44
  185. package/dist/retrieval/conversationShape.js +0 -44
  186. package/dist/retrieval/dailyEntryTime.js +0 -55
  187. package/dist/retrieval/entityLookup.js +0 -162
  188. package/dist/retrieval/factsFirst.js +0 -188
  189. package/dist/retrieval/keyword.js +0 -84
  190. package/dist/retrieval/ledgerEventTime.js +0 -51
  191. package/dist/retrieval/ledgerLiveness.js +0 -83
  192. package/dist/retrieval/ledgerPresentation.js +0 -161
  193. package/dist/retrieval/noteIdentity.js +0 -57
  194. package/dist/retrieval/orchestrator.js +0 -1224
  195. package/dist/retrieval/plainWording.js +0 -236
  196. package/dist/retrieval/queryHelpers.js +0 -142
  197. package/dist/retrieval/questionSpan.js +0 -475
  198. package/dist/retrieval/rankingTrace.js +0 -184
  199. package/dist/retrieval/readerEvents.js +0 -690
  200. package/dist/retrieval/readerLayout.js +0 -422
  201. package/dist/retrieval/relativeTimeHints.js +0 -113
  202. package/dist/retrieval/semantic.js +0 -67
  203. package/dist/router/routerCache.js +0 -106
  204. package/dist/router/sessionRouter.js +0 -726
  205. package/dist/sharing/cli.js +0 -181
  206. package/dist/sharing/examples.js +0 -136
  207. package/dist/sharing/fields.js +0 -225
  208. package/dist/sharing/loop.js +0 -80
  209. package/dist/sharing/project.js +0 -327
  210. package/dist/sharing/send.js +0 -466
  211. package/dist/sharing/state.js +0 -222
  212. package/dist/sharing/wording.js +0 -48
  213. package/dist/toolRefusal.js +0 -120
  214. package/dist/watcher/watcher.js +0 -77
  215. /package/dist/{indexer/o200k.json → o200k.json} +0 -0
@@ -1,170 +0,0 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.assertFrontmatterBounded = assertFrontmatterBounded;
7
- exports.parseNote = parseNote;
8
- exports.parseNoteDetailed = parseNoteDetailed;
9
- exports.wikilinkTargets = wikilinkTargets;
10
- exports.wikilinksSettled = wikilinksSettled;
11
- const gray_matter_1 = __importDefault(require("gray-matter"));
12
- const path_1 = __importDefault(require("path"));
13
- const dailyNote_1 = require("../memory/dailyNote");
14
- const dailyEntries_1 = require("./dailyEntries");
15
- /**
16
- * The first index at or after `p` where `pattern` matches (the text's length when none does), memoised: every p
17
- * up to that index has the same answer, so a run of failing `[[` starts shares one scan. Without it each start
18
- * scans to the end of the text and a pathological note (`[[[[...`) costs O(n^2).
19
- */
20
- function nextMatch(text, pattern) {
21
- let from = -1;
22
- let at = -1;
23
- return p => {
24
- if (from <= p && p <= at)
25
- return at;
26
- pattern.lastIndex = p;
27
- const m = pattern.exec(text);
28
- from = p;
29
- at = m === null ? text.length : m.index;
30
- return at;
31
- };
32
- }
33
- /**
34
- * The wikilinks in `text` from `from`, matched as `[[target]]`, `[[target|alias]]` or `[[target#heading]]`: the
35
- * target is the run up to the first `]`, `|` or `#` (it may span lines), closed by `]]`, or by a `|` or `#` and an
36
- * alias that ends at the first `]` followed by another `]`. Matches do not overlap, and a `[[` that does not close
37
- * is retried one character on. The same matches as the regex /\[\[([^\]|#]+)(?:[|#][^\]]*)?]]/g, in linear time.
38
- */
39
- function wikilinkSpans(text, from) {
40
- const spans = [];
41
- const nextDelimiter = nextMatch(text, /[\]|#]/g);
42
- const nextBracket = nextMatch(text, /\]/g);
43
- let open = text.indexOf('[[', from);
44
- while (open !== -1) {
45
- const start = open + 2;
46
- const delimiter = nextDelimiter(start);
47
- let end = -1;
48
- if (delimiter > start && delimiter < text.length) {
49
- if (text[delimiter] === ']') {
50
- if (text[delimiter + 1] === ']')
51
- end = delimiter + 2;
52
- }
53
- else {
54
- const close = nextBracket(delimiter + 1);
55
- if (text[close + 1] === ']')
56
- end = close + 2;
57
- }
58
- }
59
- if (end === -1) {
60
- open = text.indexOf('[[', open + 1);
61
- }
62
- else {
63
- spans.push({ end, target: text.slice(start, delimiter) });
64
- open = text.indexOf('[[', end);
65
- }
66
- }
67
- return spans;
68
- }
69
- /**
70
- * Frontmatter is stored as JSON. A YAML alias shares one parsed value, so a small note can serialize to
71
- * far more bytes than it holds: a 2,500-character scalar aliased 2,000 times is a 15 KB note and 5 MB of
72
- * JSON. Total the serialized size while walking the expanded tree and refuse past a bound proportional to
73
- * the note, before anything is written.
74
- */
75
- const FRONTMATTER_FLOOR_BYTES = 64 * 1024;
76
- const FRONTMATTER_EXPANSION = 4;
77
- const FRONTMATTER_DEPTH_LIMIT = 64;
78
- function assertFrontmatterBounded(value, sourceLength) {
79
- const limit = FRONTMATTER_FLOOR_BYTES + FRONTMATTER_EXPANSION * sourceLength;
80
- let size = 0;
81
- const walk = (v, depth) => {
82
- if (depth > FRONTMATTER_DEPTH_LIMIT)
83
- throw new Error('Markdown frontmatter is too large or deeply aliased');
84
- // Size each value the way JSON.stringify will write it, including toJSON (dates, binary).
85
- if (v && typeof v.toJSON === 'function')
86
- v = v.toJSON();
87
- if (Array.isArray(v)) {
88
- size += 2 + Math.max(v.length - 1, 0); // brackets and commas
89
- for (const child of v)
90
- walk(child, depth + 1);
91
- }
92
- else if (v && typeof v === 'object') {
93
- const entries = Object.entries(v);
94
- size += 2 + Math.max(entries.length - 1, 0);
95
- for (const [key, child] of entries) {
96
- size += JSON.stringify(key).length + 1;
97
- walk(child, depth + 1);
98
- }
99
- }
100
- else {
101
- size += JSON.stringify(v)?.length ?? 0;
102
- }
103
- if (size > limit)
104
- throw new Error('Markdown frontmatter is too large or deeply aliased');
105
- };
106
- walk(value, 0);
107
- }
108
- /**
109
- * gray-matter caches every string it parses, and caches before it parses: a parse that throws leaves empty
110
- * `data` in the cache and the next call for the same text returns it as if it had parsed. Any options object
111
- * bypasses that cache. It also ships a JavaScript engine that evaluates `---js` frontmatter as code; a note
112
- * is data, so only the YAML and JSON engines are usable.
113
- */
114
- const MATTER_OPTIONS = {
115
- engines: {
116
- javascript: () => { throw new Error('Unsupported frontmatter language: javascript'); },
117
- },
118
- };
119
- function parseNote(filePath, content) {
120
- return parseNoteDetailed(filePath, content).note;
121
- }
122
- /**
123
- * parseNote, with what the indexer needs to index an append to the note by its appended part (pipeline.ts): the
124
- * text after the frontmatter the body was trimmed from (a suffix of `content`), and whether the title came from a
125
- * heading in it rather than from the file name.
126
- */
127
- function parseNoteDetailed(filePath, content) {
128
- // The one door every reader of a note's text goes through (the index behind search, recall and get_context,
129
- // the memory map's note view, the evidence pass). A daily note keeps a line of the user's words that would
130
- // start like an entry behind a backslash; the words are restored here, so none of them sees the escape.
131
- const text = (0, dailyNote_1.isDailyNotePath)(filePath) ? (0, dailyNote_1.decodeDailyNoteText)(content) : content;
132
- const { data, content: rawBody } = (0, gray_matter_1.default)(text, MATTER_OPTIONS);
133
- // Only a mapping is front matter. YAML also parses a list, a string, a number or a date as a document, and passing
134
- // one on made the export write a list's items as keys `0`, `1`, ...
135
- const frontmatter = Object.prototype.toString.call(data) === '[object Object]' ? data : {};
136
- assertFrontmatterBounded(frontmatter, content.length);
137
- const heading = rawBody.match(/^#\s+(.+)$/m);
138
- const title = heading?.[1].trim() ?? path_1.default.basename(filePath, '.md');
139
- const wikilinks = wikilinkTargets(rawBody);
140
- const body = rawBody.trim();
141
- const entryStarts = (0, dailyNote_1.isDailyNotePath)(filePath) ? (0, dailyEntries_1.dailyEntryStarts)(content, text, rawBody, body) : undefined;
142
- return {
143
- note: {
144
- path: filePath,
145
- title,
146
- frontmatter,
147
- body,
148
- wikilinks,
149
- ...(entryStarts ? { entryStarts } : {}),
150
- },
151
- rawBody,
152
- titleFromHeading: heading !== null,
153
- };
154
- }
155
- /** The wikilink targets in `text`, each once, in the order they first appear. */
156
- function wikilinkTargets(text, from = 0) {
157
- return [...new Set(wikilinkSpans(text, from).map(s => s.target.trim()))].filter(Boolean);
158
- }
159
- /**
160
- * Whether text appended to `text` can only add wikilinks after the ones it holds, scanning as `wikilinkTargets`
161
- * does from `from`. A link's target may span lines, so an opening `[[` with no `]` after it could still be closed
162
- * by what is appended, and become a link that starts in `text`; any other opening is settled by a `]` in `text`.
163
- */
164
- function wikilinksSettled(text, from = 0) {
165
- let settledTo = from;
166
- for (const span of wikilinkSpans(text, from))
167
- settledTo = span.end;
168
- const open = text.lastIndexOf('[[');
169
- return open < settledTo || text.indexOf(']', open + 2) !== -1;
170
- }