@steno-ai/engine 0.1.17 → 0.1.19

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 (342) hide show
  1. package/README.md +0 -0
  2. package/dist/adapters/cache.d.ts +0 -0
  3. package/dist/adapters/cache.d.ts.map +0 -0
  4. package/dist/adapters/cache.js +0 -0
  5. package/dist/adapters/cache.js.map +0 -0
  6. package/dist/adapters/embedding.d.ts +0 -0
  7. package/dist/adapters/embedding.d.ts.map +0 -0
  8. package/dist/adapters/embedding.js +0 -0
  9. package/dist/adapters/embedding.js.map +0 -0
  10. package/dist/adapters/gemini-embedding.d.ts +0 -0
  11. package/dist/adapters/gemini-embedding.d.ts.map +0 -0
  12. package/dist/adapters/gemini-embedding.js +0 -0
  13. package/dist/adapters/gemini-embedding.js.map +0 -0
  14. package/dist/adapters/index.d.ts +0 -0
  15. package/dist/adapters/index.d.ts.map +0 -0
  16. package/dist/adapters/index.js +0 -0
  17. package/dist/adapters/index.js.map +0 -0
  18. package/dist/adapters/llm.d.ts +0 -0
  19. package/dist/adapters/llm.d.ts.map +0 -0
  20. package/dist/adapters/llm.js +0 -0
  21. package/dist/adapters/llm.js.map +0 -0
  22. package/dist/adapters/perplexity-embedding.d.ts +0 -0
  23. package/dist/adapters/perplexity-embedding.d.ts.map +0 -0
  24. package/dist/adapters/perplexity-embedding.js +0 -0
  25. package/dist/adapters/perplexity-embedding.js.map +0 -0
  26. package/dist/adapters/storage.d.ts +0 -0
  27. package/dist/adapters/storage.d.ts.map +0 -0
  28. package/dist/adapters/storage.js +0 -0
  29. package/dist/adapters/storage.js.map +0 -0
  30. package/dist/auth/api-key.d.ts +0 -0
  31. package/dist/auth/api-key.d.ts.map +0 -0
  32. package/dist/auth/api-key.js +0 -0
  33. package/dist/auth/api-key.js.map +0 -0
  34. package/dist/auth/index.d.ts +0 -0
  35. package/dist/auth/index.d.ts.map +0 -0
  36. package/dist/auth/index.js +0 -0
  37. package/dist/auth/index.js.map +0 -0
  38. package/dist/config.d.ts +0 -0
  39. package/dist/config.d.ts.map +0 -0
  40. package/dist/config.js +0 -0
  41. package/dist/config.js.map +0 -0
  42. package/dist/extraction/codebase-extractor.d.ts +0 -0
  43. package/dist/extraction/codebase-extractor.d.ts.map +0 -0
  44. package/dist/extraction/codebase-extractor.js +0 -0
  45. package/dist/extraction/codebase-extractor.js.map +0 -0
  46. package/dist/extraction/codebase-prompts.d.ts +0 -0
  47. package/dist/extraction/codebase-prompts.d.ts.map +0 -0
  48. package/dist/extraction/codebase-prompts.js +0 -0
  49. package/dist/extraction/codebase-prompts.js.map +0 -0
  50. package/dist/extraction/contradiction.d.ts +0 -0
  51. package/dist/extraction/contradiction.d.ts.map +0 -0
  52. package/dist/extraction/contradiction.js +0 -0
  53. package/dist/extraction/contradiction.js.map +0 -0
  54. package/dist/extraction/cross-linker.d.ts +0 -0
  55. package/dist/extraction/cross-linker.d.ts.map +0 -0
  56. package/dist/extraction/cross-linker.js +0 -0
  57. package/dist/extraction/cross-linker.js.map +0 -0
  58. package/dist/extraction/dedup.d.ts +0 -0
  59. package/dist/extraction/dedup.d.ts.map +0 -0
  60. package/dist/extraction/dedup.js +0 -0
  61. package/dist/extraction/dedup.js.map +0 -0
  62. package/dist/extraction/entity-extractor.d.ts +0 -0
  63. package/dist/extraction/entity-extractor.d.ts.map +0 -0
  64. package/dist/extraction/entity-extractor.js +0 -0
  65. package/dist/extraction/entity-extractor.js.map +0 -0
  66. package/dist/extraction/hasher.d.ts +0 -0
  67. package/dist/extraction/hasher.d.ts.map +0 -0
  68. package/dist/extraction/hasher.js +0 -0
  69. package/dist/extraction/hasher.js.map +0 -0
  70. package/dist/extraction/heuristic.d.ts +0 -0
  71. package/dist/extraction/heuristic.d.ts.map +0 -0
  72. package/dist/extraction/heuristic.js +0 -0
  73. package/dist/extraction/heuristic.js.map +0 -0
  74. package/dist/extraction/index.d.ts +0 -0
  75. package/dist/extraction/index.d.ts.map +0 -0
  76. package/dist/extraction/index.js +0 -0
  77. package/dist/extraction/index.js.map +0 -0
  78. package/dist/extraction/llm-extractor.d.ts +0 -0
  79. package/dist/extraction/llm-extractor.d.ts.map +0 -0
  80. package/dist/extraction/llm-extractor.js +0 -0
  81. package/dist/extraction/llm-extractor.js.map +0 -0
  82. package/dist/extraction/pipeline.d.ts +0 -0
  83. package/dist/extraction/pipeline.d.ts.map +0 -0
  84. package/dist/extraction/pipeline.js +0 -0
  85. package/dist/extraction/pipeline.js.map +0 -0
  86. package/dist/extraction/prompts.d.ts +0 -0
  87. package/dist/extraction/prompts.d.ts.map +0 -0
  88. package/dist/extraction/prompts.js +0 -0
  89. package/dist/extraction/prompts.js.map +0 -0
  90. package/dist/extraction/sliding-window.d.ts +0 -0
  91. package/dist/extraction/sliding-window.d.ts.map +0 -0
  92. package/dist/extraction/sliding-window.js +0 -0
  93. package/dist/extraction/sliding-window.js.map +0 -0
  94. package/dist/extraction/structured-cross-linker.d.ts +6 -1
  95. package/dist/extraction/structured-cross-linker.d.ts.map +1 -1
  96. package/dist/extraction/structured-cross-linker.js +18 -7
  97. package/dist/extraction/structured-cross-linker.js.map +1 -1
  98. package/dist/extraction/structured-extractor.d.ts +0 -0
  99. package/dist/extraction/structured-extractor.d.ts.map +1 -1
  100. package/dist/extraction/structured-extractor.js +8 -0
  101. package/dist/extraction/structured-extractor.js.map +1 -1
  102. package/dist/extraction/types.d.ts +0 -0
  103. package/dist/extraction/types.d.ts.map +0 -0
  104. package/dist/extraction/types.js +0 -0
  105. package/dist/extraction/types.js.map +0 -0
  106. package/dist/feedback/index.d.ts +0 -0
  107. package/dist/feedback/index.d.ts.map +0 -0
  108. package/dist/feedback/index.js +0 -0
  109. package/dist/feedback/index.js.map +0 -0
  110. package/dist/feedback/tracker.d.ts +0 -0
  111. package/dist/feedback/tracker.d.ts.map +0 -0
  112. package/dist/feedback/tracker.js +0 -0
  113. package/dist/feedback/tracker.js.map +0 -0
  114. package/dist/identity/index.d.ts +0 -0
  115. package/dist/identity/index.d.ts.map +0 -0
  116. package/dist/identity/index.js +0 -0
  117. package/dist/identity/index.js.map +0 -0
  118. package/dist/identity/resolver.d.ts +0 -0
  119. package/dist/identity/resolver.d.ts.map +0 -0
  120. package/dist/identity/resolver.js +0 -0
  121. package/dist/identity/resolver.js.map +0 -0
  122. package/dist/index.d.ts +0 -0
  123. package/dist/index.d.ts.map +0 -0
  124. package/dist/index.js +0 -0
  125. package/dist/index.js.map +0 -0
  126. package/dist/models/api-key.d.ts +0 -0
  127. package/dist/models/api-key.d.ts.map +0 -0
  128. package/dist/models/api-key.js +0 -0
  129. package/dist/models/api-key.js.map +0 -0
  130. package/dist/models/edge.d.ts +0 -0
  131. package/dist/models/edge.d.ts.map +0 -0
  132. package/dist/models/edge.js +0 -0
  133. package/dist/models/edge.js.map +0 -0
  134. package/dist/models/entity.d.ts +0 -0
  135. package/dist/models/entity.d.ts.map +0 -0
  136. package/dist/models/entity.js +0 -0
  137. package/dist/models/entity.js.map +0 -0
  138. package/dist/models/extraction.d.ts +0 -0
  139. package/dist/models/extraction.d.ts.map +0 -0
  140. package/dist/models/extraction.js +0 -0
  141. package/dist/models/extraction.js.map +0 -0
  142. package/dist/models/fact-entity.d.ts +0 -0
  143. package/dist/models/fact-entity.d.ts.map +0 -0
  144. package/dist/models/fact-entity.js +0 -0
  145. package/dist/models/fact-entity.js.map +0 -0
  146. package/dist/models/fact.d.ts +0 -0
  147. package/dist/models/fact.d.ts.map +0 -0
  148. package/dist/models/fact.js +0 -0
  149. package/dist/models/fact.js.map +0 -0
  150. package/dist/models/index.d.ts +0 -0
  151. package/dist/models/index.d.ts.map +0 -0
  152. package/dist/models/index.js +0 -0
  153. package/dist/models/index.js.map +0 -0
  154. package/dist/models/memory-access.d.ts +0 -0
  155. package/dist/models/memory-access.d.ts.map +0 -0
  156. package/dist/models/memory-access.js +0 -0
  157. package/dist/models/memory-access.js.map +0 -0
  158. package/dist/models/session-message.d.ts +0 -0
  159. package/dist/models/session-message.d.ts.map +0 -0
  160. package/dist/models/session-message.js +0 -0
  161. package/dist/models/session-message.js.map +0 -0
  162. package/dist/models/session.d.ts +0 -0
  163. package/dist/models/session.d.ts.map +0 -0
  164. package/dist/models/session.js +0 -0
  165. package/dist/models/session.js.map +0 -0
  166. package/dist/models/tenant.d.ts +0 -0
  167. package/dist/models/tenant.d.ts.map +0 -0
  168. package/dist/models/tenant.js +0 -0
  169. package/dist/models/tenant.js.map +0 -0
  170. package/dist/models/trigger.d.ts +0 -0
  171. package/dist/models/trigger.d.ts.map +0 -0
  172. package/dist/models/trigger.js +0 -0
  173. package/dist/models/trigger.js.map +0 -0
  174. package/dist/models/usage-record.d.ts +0 -0
  175. package/dist/models/usage-record.d.ts.map +0 -0
  176. package/dist/models/usage-record.js +0 -0
  177. package/dist/models/usage-record.js.map +0 -0
  178. package/dist/models/webhook.d.ts +0 -0
  179. package/dist/models/webhook.d.ts.map +0 -0
  180. package/dist/models/webhook.js +0 -0
  181. package/dist/models/webhook.js.map +0 -0
  182. package/dist/profiles/index.d.ts +0 -0
  183. package/dist/profiles/index.d.ts.map +0 -0
  184. package/dist/profiles/index.js +0 -0
  185. package/dist/profiles/index.js.map +0 -0
  186. package/dist/profiles/profile.d.ts +0 -0
  187. package/dist/profiles/profile.d.ts.map +0 -0
  188. package/dist/profiles/profile.js +0 -0
  189. package/dist/profiles/profile.js.map +0 -0
  190. package/dist/retrieval/compound-search.d.ts +0 -0
  191. package/dist/retrieval/compound-search.d.ts.map +0 -0
  192. package/dist/retrieval/compound-search.js +0 -0
  193. package/dist/retrieval/compound-search.js.map +0 -0
  194. package/dist/retrieval/contradiction-surfacer.d.ts +0 -0
  195. package/dist/retrieval/contradiction-surfacer.d.ts.map +0 -0
  196. package/dist/retrieval/contradiction-surfacer.js +0 -0
  197. package/dist/retrieval/contradiction-surfacer.js.map +0 -0
  198. package/dist/retrieval/embedding-cache.d.ts +0 -0
  199. package/dist/retrieval/embedding-cache.d.ts.map +0 -0
  200. package/dist/retrieval/embedding-cache.js +0 -0
  201. package/dist/retrieval/embedding-cache.js.map +0 -0
  202. package/dist/retrieval/fusion.d.ts +0 -0
  203. package/dist/retrieval/fusion.d.ts.map +0 -0
  204. package/dist/retrieval/fusion.js +0 -0
  205. package/dist/retrieval/fusion.js.map +0 -0
  206. package/dist/retrieval/graph-traversal.d.ts +0 -0
  207. package/dist/retrieval/graph-traversal.d.ts.map +0 -0
  208. package/dist/retrieval/graph-traversal.js +0 -0
  209. package/dist/retrieval/graph-traversal.js.map +0 -0
  210. package/dist/retrieval/index.d.ts +0 -0
  211. package/dist/retrieval/index.d.ts.map +0 -0
  212. package/dist/retrieval/index.js +0 -0
  213. package/dist/retrieval/index.js.map +0 -0
  214. package/dist/retrieval/keyword-search.d.ts +0 -0
  215. package/dist/retrieval/keyword-search.d.ts.map +0 -0
  216. package/dist/retrieval/keyword-search.js +0 -0
  217. package/dist/retrieval/keyword-search.js.map +0 -0
  218. package/dist/retrieval/query-expansion.d.ts +0 -0
  219. package/dist/retrieval/query-expansion.d.ts.map +0 -0
  220. package/dist/retrieval/query-expansion.js +0 -0
  221. package/dist/retrieval/query-expansion.js.map +0 -0
  222. package/dist/retrieval/reranker.d.ts +0 -0
  223. package/dist/retrieval/reranker.d.ts.map +0 -0
  224. package/dist/retrieval/reranker.js +0 -0
  225. package/dist/retrieval/reranker.js.map +0 -0
  226. package/dist/retrieval/salience-scorer.d.ts +0 -0
  227. package/dist/retrieval/salience-scorer.d.ts.map +0 -0
  228. package/dist/retrieval/salience-scorer.js +0 -0
  229. package/dist/retrieval/salience-scorer.js.map +0 -0
  230. package/dist/retrieval/search.d.ts +0 -0
  231. package/dist/retrieval/search.d.ts.map +0 -0
  232. package/dist/retrieval/search.js +0 -0
  233. package/dist/retrieval/search.js.map +0 -0
  234. package/dist/retrieval/temporal-scorer.d.ts +0 -0
  235. package/dist/retrieval/temporal-scorer.d.ts.map +0 -0
  236. package/dist/retrieval/temporal-scorer.js +0 -0
  237. package/dist/retrieval/temporal-scorer.js.map +0 -0
  238. package/dist/retrieval/trigger-matcher.d.ts +0 -0
  239. package/dist/retrieval/trigger-matcher.d.ts.map +0 -0
  240. package/dist/retrieval/trigger-matcher.js +0 -0
  241. package/dist/retrieval/trigger-matcher.js.map +0 -0
  242. package/dist/retrieval/types.d.ts +0 -0
  243. package/dist/retrieval/types.d.ts.map +0 -0
  244. package/dist/retrieval/types.js +0 -0
  245. package/dist/retrieval/types.js.map +0 -0
  246. package/dist/retrieval/vector-search.d.ts +0 -0
  247. package/dist/retrieval/vector-search.d.ts.map +0 -0
  248. package/dist/retrieval/vector-search.js +0 -0
  249. package/dist/retrieval/vector-search.js.map +0 -0
  250. package/dist/salience/decay.d.ts +0 -0
  251. package/dist/salience/decay.d.ts.map +0 -0
  252. package/dist/salience/decay.js +0 -0
  253. package/dist/salience/decay.js.map +0 -0
  254. package/dist/salience/index.d.ts +0 -0
  255. package/dist/salience/index.d.ts.map +0 -0
  256. package/dist/salience/index.js +0 -0
  257. package/dist/salience/index.js.map +0 -0
  258. package/dist/scratchpad/index.d.ts +0 -0
  259. package/dist/scratchpad/index.d.ts.map +0 -0
  260. package/dist/scratchpad/index.js +0 -0
  261. package/dist/scratchpad/index.js.map +0 -0
  262. package/dist/scratchpad/scratchpad.d.ts +0 -0
  263. package/dist/scratchpad/scratchpad.d.ts.map +0 -0
  264. package/dist/scratchpad/scratchpad.js +0 -0
  265. package/dist/scratchpad/scratchpad.js.map +0 -0
  266. package/dist/sessions/index.d.ts +0 -0
  267. package/dist/sessions/index.d.ts.map +0 -0
  268. package/dist/sessions/index.js +0 -0
  269. package/dist/sessions/index.js.map +0 -0
  270. package/dist/sessions/manager.d.ts +0 -0
  271. package/dist/sessions/manager.d.ts.map +0 -0
  272. package/dist/sessions/manager.js +0 -0
  273. package/dist/sessions/manager.js.map +0 -0
  274. package/package.json +9 -9
  275. package/src/adapters/cache.ts +0 -0
  276. package/src/adapters/embedding.ts +0 -0
  277. package/src/adapters/gemini-embedding.ts +0 -0
  278. package/src/adapters/index.ts +0 -0
  279. package/src/adapters/llm.ts +0 -0
  280. package/src/adapters/perplexity-embedding.ts +0 -0
  281. package/src/adapters/storage.ts +0 -0
  282. package/src/auth/api-key.ts +0 -0
  283. package/src/auth/index.ts +0 -0
  284. package/src/config.ts +0 -0
  285. package/src/extraction/codebase-extractor.ts +0 -0
  286. package/src/extraction/codebase-prompts.ts +0 -0
  287. package/src/extraction/contradiction.ts +0 -0
  288. package/src/extraction/cross-linker.ts +0 -0
  289. package/src/extraction/dedup.ts +0 -0
  290. package/src/extraction/entity-extractor.ts +0 -0
  291. package/src/extraction/hasher.ts +0 -0
  292. package/src/extraction/heuristic.ts +0 -0
  293. package/src/extraction/index.ts +0 -0
  294. package/src/extraction/llm-extractor.ts +0 -0
  295. package/src/extraction/pipeline.ts +0 -0
  296. package/src/extraction/prompts.ts +0 -0
  297. package/src/extraction/sliding-window.ts +0 -0
  298. package/src/extraction/structured-cross-linker.ts +20 -7
  299. package/src/extraction/structured-extractor.ts +8 -0
  300. package/src/extraction/types.ts +0 -0
  301. package/src/feedback/index.ts +0 -0
  302. package/src/feedback/tracker.ts +0 -0
  303. package/src/identity/index.ts +0 -0
  304. package/src/identity/resolver.ts +0 -0
  305. package/src/index.ts +0 -0
  306. package/src/models/api-key.ts +0 -0
  307. package/src/models/edge.ts +0 -0
  308. package/src/models/entity.ts +0 -0
  309. package/src/models/extraction.ts +0 -0
  310. package/src/models/fact-entity.ts +0 -0
  311. package/src/models/fact.ts +0 -0
  312. package/src/models/index.ts +0 -0
  313. package/src/models/memory-access.ts +0 -0
  314. package/src/models/session-message.ts +0 -0
  315. package/src/models/session.ts +0 -0
  316. package/src/models/tenant.ts +0 -0
  317. package/src/models/trigger.ts +0 -0
  318. package/src/models/usage-record.ts +0 -0
  319. package/src/models/webhook.ts +0 -0
  320. package/src/profiles/index.ts +0 -0
  321. package/src/profiles/profile.ts +0 -0
  322. package/src/retrieval/compound-search.ts +0 -0
  323. package/src/retrieval/contradiction-surfacer.ts +0 -0
  324. package/src/retrieval/embedding-cache.ts +0 -0
  325. package/src/retrieval/fusion.ts +0 -0
  326. package/src/retrieval/graph-traversal.ts +0 -0
  327. package/src/retrieval/index.ts +0 -0
  328. package/src/retrieval/keyword-search.ts +0 -0
  329. package/src/retrieval/query-expansion.ts +0 -0
  330. package/src/retrieval/reranker.ts +0 -0
  331. package/src/retrieval/salience-scorer.ts +0 -0
  332. package/src/retrieval/search.ts +0 -0
  333. package/src/retrieval/temporal-scorer.ts +0 -0
  334. package/src/retrieval/trigger-matcher.ts +0 -0
  335. package/src/retrieval/types.ts +0 -0
  336. package/src/retrieval/vector-search.ts +0 -0
  337. package/src/salience/decay.ts +0 -0
  338. package/src/salience/index.ts +0 -0
  339. package/src/scratchpad/index.ts +0 -0
  340. package/src/scratchpad/scratchpad.ts +0 -0
  341. package/src/sessions/index.ts +0 -0
  342. package/src/sessions/manager.ts +0 -0
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@steno-ai/engine",
3
- "version": "0.1.17",
3
+ "version": "0.1.19",
4
4
  "description": "Core memory engine — extraction, retrieval, knowledge graph",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -22,6 +22,13 @@
22
22
  "src",
23
23
  "README.md"
24
24
  ],
25
+ "scripts": {
26
+ "test": "vitest run",
27
+ "test:watch": "vitest watch",
28
+ "typecheck": "tsc --noEmit",
29
+ "build": "tsc",
30
+ "clean": "rm -rf dist"
31
+ },
25
32
  "dependencies": {
26
33
  "bcryptjs": "^3.0.3",
27
34
  "compromise": "^14.15.0",
@@ -31,12 +38,5 @@
31
38
  "@types/bcryptjs": "^3.0.0",
32
39
  "typescript": "^5.7",
33
40
  "vitest": "^3"
34
- },
35
- "scripts": {
36
- "test": "vitest run",
37
- "test:watch": "vitest watch",
38
- "typecheck": "tsc --noEmit",
39
- "build": "tsc",
40
- "clean": "rm -rf dist"
41
41
  }
42
- }
42
+ }
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
package/src/auth/index.ts CHANGED
File without changes
package/src/config.ts CHANGED
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
@@ -105,10 +105,13 @@ export async function findPendingCrossLinks(
105
105
  tenantId: string,
106
106
  scope: string,
107
107
  scopeId: string,
108
- options?: { minSimilarity?: number; maxCandidates?: number },
108
+ options?: { minSimilarity?: number; maxCandidates?: number; maxFacts?: number; maxDurationMs?: number },
109
109
  ): Promise<PendingCrossLink[]> {
110
110
  const minSim = options?.minSimilarity ?? 0.6;
111
- const maxCandidates = options?.maxCandidates ?? 50;
111
+ const maxCandidates = options?.maxCandidates ?? 20;
112
+ const maxFacts = options?.maxFacts ?? 10;
113
+ const maxDurationMs = options?.maxDurationMs ?? 20000;
114
+ const startTime = Date.now();
112
115
 
113
116
  // Find structured facts by searching for the "structured" tag content
114
117
  // We use keyword search since there's no listFacts method
@@ -117,7 +120,7 @@ export async function findPendingCrossLinks(
117
120
  tenantId,
118
121
  scope,
119
122
  scopeId,
120
- limit: 100,
123
+ limit: maxFacts,
121
124
  });
122
125
 
123
126
  if (recentStructuredFacts.length === 0) return [];
@@ -126,6 +129,12 @@ export async function findPendingCrossLinks(
126
129
 
127
130
  // For each structured fact, find semantically similar facts from different source types
128
131
  for (const match of recentStructuredFacts) {
132
+ // Time guard — stop before we exceed the budget
133
+ if (Date.now() - startTime > maxDurationMs) {
134
+ console.error(`[steno-structured-xlink] Time budget exhausted after ${candidates.length} candidates`);
135
+ break;
136
+ }
137
+
129
138
  const fact = match.fact;
130
139
  if (!fact.tags?.includes('structured')) continue;
131
140
 
@@ -146,10 +155,8 @@ export async function findPendingCrossLinks(
146
155
  if (match.fact.id === fact.id) continue;
147
156
  if (match.fact.sourceType === fact.sourceType) continue;
148
157
 
149
- // Skip if already linked (check if edge exists between their entities)
150
- // This is a lightweight check — the full edge check happens in processPendingCrossLinks
151
158
  candidates.push({
152
- entityId: '', // filled by caller
159
+ entityId: '',
153
160
  entityName: '',
154
161
  factId: fact.id,
155
162
  factContent: fact.content,
@@ -183,8 +190,14 @@ export async function processPendingCrossLinks(
183
190
  tenantId: string,
184
191
  scope: string,
185
192
  scopeId: string,
193
+ options?: { maxDurationMs?: number; maxFacts?: number },
186
194
  ): Promise<{ processed: number; edgesCreated: number }> {
187
- const candidates = await findPendingCrossLinks(storage, embedding, tenantId, scope, scopeId);
195
+ const maxDurationMs = options?.maxDurationMs ?? 20000;
196
+ const candidates = await findPendingCrossLinks(storage, embedding, tenantId, scope, scopeId, {
197
+ maxFacts: options?.maxFacts ?? 10,
198
+ maxDurationMs,
199
+ maxCandidates: 10,
200
+ });
188
201
 
189
202
  if (candidates.length === 0) return { processed: 0, edgesCreated: 0 };
190
203
 
@@ -94,6 +94,8 @@ function formatTime(iso: string): string {
94
94
  // ---------------------------------------------------------------------------
95
95
 
96
96
  export function extractStructuredEvent(data: StructuredEvent): ExtractionResult {
97
+ if (!data?.title) return { facts: [], entities: [], edges: [], tier: 'heuristic', confidence: 1.0, tokensInput: 0, tokensOutput: 0, model: null };
98
+
97
99
  const entities: ExtractedEntity[] = [];
98
100
  const edges: ExtractedEdge[] = [];
99
101
 
@@ -202,6 +204,8 @@ export function extractStructuredEvent(data: StructuredEvent): ExtractionResult
202
204
  }
203
205
 
204
206
  export function extractStructuredTask(data: StructuredTask): ExtractionResult {
207
+ if (!data?.title) return { facts: [], entities: [], edges: [], tier: 'heuristic', confidence: 1.0, tokensInput: 0, tokensOutput: 0, model: null };
208
+
205
209
  const entities: ExtractedEntity[] = [];
206
210
  const edges: ExtractedEdge[] = [];
207
211
 
@@ -269,6 +273,8 @@ export function extractStructuredTask(data: StructuredTask): ExtractionResult {
269
273
  }
270
274
 
271
275
  export function extractStructuredEmail(data: StructuredEmail): ExtractionResult {
276
+ if (!data?.subject && !data?.from) return { facts: [], entities: [], edges: [], tier: 'heuristic', confidence: 1.0, tokensInput: 0, tokensOutput: 0, model: null };
277
+
272
278
  const entities: ExtractedEntity[] = [];
273
279
  const edges: ExtractedEdge[] = [];
274
280
 
@@ -340,6 +346,8 @@ export function extractStructuredEmail(data: StructuredEmail): ExtractionResult
340
346
  }
341
347
 
342
348
  export function extractStructuredVault(data: StructuredVault): ExtractionResult {
349
+ if (!data?.title) return { facts: [], entities: [], edges: [], tier: 'heuristic', confidence: 1.0, tokensInput: 0, tokensOutput: 0, model: null };
350
+
343
351
  const entities: ExtractedEntity[] = [];
344
352
  const edges: ExtractedEdge[] = [];
345
353
 
File without changes
File without changes
File without changes
File without changes
File without changes
package/src/index.ts CHANGED
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes