@opendatalabs/personal-server-ts-core 1.34.2 → 1.35.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 (414) hide show
  1. package/dist/additions/durable.d.ts +32 -2
  2. package/dist/additions/durable.d.ts.map +1 -1
  3. package/dist/additions/durable.js +237 -88
  4. package/dist/additions/durable.js.map +1 -1
  5. package/dist/additions/version-inventory.d.ts +4 -0
  6. package/dist/additions/version-inventory.d.ts.map +1 -1
  7. package/dist/additions/version-inventory.js +11 -1
  8. package/dist/additions/version-inventory.js.map +1 -1
  9. package/dist/api/index.d.ts +18 -1
  10. package/dist/api/index.d.ts.map +1 -1
  11. package/dist/api/index.js +172 -4
  12. package/dist/api/index.js.map +1 -1
  13. package/dist/api/oura-collection-requirements.d.ts +16 -0
  14. package/dist/api/oura-collection-requirements.d.ts.map +1 -0
  15. package/dist/api/oura-collection-requirements.js +70 -0
  16. package/dist/api/oura-collection-requirements.js.map +1 -0
  17. package/dist/api/scope-upload-batches.d.ts +18 -0
  18. package/dist/api/scope-upload-batches.d.ts.map +1 -0
  19. package/dist/api/scope-upload-batches.js +71 -0
  20. package/dist/api/scope-upload-batches.js.map +1 -0
  21. package/dist/api/scope-uploads.d.ts +112 -0
  22. package/dist/api/scope-uploads.d.ts.map +1 -0
  23. package/dist/api/scope-uploads.js +369 -0
  24. package/dist/api/scope-uploads.js.map +1 -0
  25. package/dist/client.d.ts +70 -0
  26. package/dist/client.d.ts.map +1 -1
  27. package/dist/client.js +1 -0
  28. package/dist/client.js.map +1 -1
  29. package/dist/contracts/data.d.ts +8 -0
  30. package/dist/contracts/data.d.ts.map +1 -1
  31. package/dist/contracts/data.js +31 -1
  32. package/dist/contracts/data.js.map +1 -1
  33. package/dist/contracts/grants.d.ts.map +1 -1
  34. package/dist/contracts/grants.js +3 -0
  35. package/dist/contracts/grants.js.map +1 -1
  36. package/dist/contracts/index.d.ts +3 -1
  37. package/dist/contracts/index.d.ts.map +1 -1
  38. package/dist/contracts/index.js +3 -1
  39. package/dist/contracts/index.js.map +1 -1
  40. package/dist/contracts/oura-collection-requirements.d.ts +17 -0
  41. package/dist/contracts/oura-collection-requirements.d.ts.map +1 -0
  42. package/dist/contracts/oura-collection-requirements.js +49 -0
  43. package/dist/contracts/oura-collection-requirements.js.map +1 -0
  44. package/dist/legacy-projection/bindings.d.ts +1 -7
  45. package/dist/legacy-projection/bindings.d.ts.map +1 -1
  46. package/dist/legacy-projection/bindings.js +162 -28
  47. package/dist/legacy-projection/bindings.js.map +1 -1
  48. package/dist/legacy-projection/index.d.ts +6 -5
  49. package/dist/legacy-projection/index.d.ts.map +1 -1
  50. package/dist/legacy-projection/index.js +9 -21
  51. package/dist/legacy-projection/index.js.map +1 -1
  52. package/dist/legacy-projection/oura-browser-bindings.d.ts +2 -0
  53. package/dist/legacy-projection/oura-browser-bindings.d.ts.map +1 -1
  54. package/dist/legacy-projection/oura-browser-bindings.js +2 -0
  55. package/dist/legacy-projection/oura-browser-bindings.js.map +1 -1
  56. package/dist/legacy-projection/strava-browser-bindings.d.ts +3 -0
  57. package/dist/legacy-projection/strava-browser-bindings.d.ts.map +1 -0
  58. package/dist/legacy-projection/strava-browser-bindings.js +32 -0
  59. package/dist/legacy-projection/strava-browser-bindings.js.map +1 -0
  60. package/dist/legacy-projection/types.d.ts +44 -12
  61. package/dist/legacy-projection/types.d.ts.map +1 -1
  62. package/dist/mcp/connection-api.d.ts +11 -1
  63. package/dist/mcp/connection-api.d.ts.map +1 -1
  64. package/dist/mcp/connection-api.js +94 -9
  65. package/dist/mcp/connection-api.js.map +1 -1
  66. package/dist/mcp/index.d.ts +1 -0
  67. package/dist/mcp/index.d.ts.map +1 -1
  68. package/dist/mcp/index.js +1 -0
  69. package/dist/mcp/index.js.map +1 -1
  70. package/dist/mcp/server.d.ts +9 -0
  71. package/dist/mcp/server.d.ts.map +1 -1
  72. package/dist/mcp/server.js +19 -6
  73. package/dist/mcp/server.js.map +1 -1
  74. package/dist/mcp/store.d.ts +10 -1
  75. package/dist/mcp/store.d.ts.map +1 -1
  76. package/dist/mcp/store.js +51 -0
  77. package/dist/mcp/store.js.map +1 -1
  78. package/dist/mcp/tools.d.ts +52 -2
  79. package/dist/mcp/tools.d.ts.map +1 -1
  80. package/dist/mcp/tools.js +395 -11
  81. package/dist/mcp/tools.js.map +1 -1
  82. package/dist/mcp/types.d.ts +36 -2
  83. package/dist/mcp/types.d.ts.map +1 -1
  84. package/dist/mcp/types.js +12 -0
  85. package/dist/mcp/types.js.map +1 -1
  86. package/dist/mcp/write-client.d.ts +81 -0
  87. package/dist/mcp/write-client.d.ts.map +1 -0
  88. package/dist/mcp/write-client.js +140 -0
  89. package/dist/mcp/write-client.js.map +1 -0
  90. package/dist/oura/history-policy.d.ts +12 -0
  91. package/dist/oura/history-policy.d.ts.map +1 -0
  92. package/dist/oura/history-policy.js +54 -0
  93. package/dist/oura/history-policy.js.map +1 -0
  94. package/dist/oura/index.d.ts +51 -0
  95. package/dist/oura/index.d.ts.map +1 -0
  96. package/dist/oura/index.js +315 -0
  97. package/dist/oura/index.js.map +1 -0
  98. package/dist/pdpp/approval.d.ts +1 -1
  99. package/dist/pdpp/approval.d.ts.map +1 -1
  100. package/dist/pdpp/approval.js +29 -10
  101. package/dist/pdpp/approval.js.map +1 -1
  102. package/dist/pdpp/declaration-limits.d.ts +7 -0
  103. package/dist/pdpp/declaration-limits.d.ts.map +1 -0
  104. package/dist/pdpp/declaration-limits.js +7 -0
  105. package/dist/pdpp/declaration-limits.js.map +1 -0
  106. package/dist/pdpp/declaration.d.ts +2 -1
  107. package/dist/pdpp/declaration.d.ts.map +1 -1
  108. package/dist/pdpp/declaration.js +2 -1
  109. package/dist/pdpp/declaration.js.map +1 -1
  110. package/dist/pdpp/index.d.ts +3 -2
  111. package/dist/pdpp/index.d.ts.map +1 -1
  112. package/dist/pdpp/index.js +3 -2
  113. package/dist/pdpp/index.js.map +1 -1
  114. package/dist/pdpp/issuance.d.ts.map +1 -1
  115. package/dist/pdpp/issuance.js +6 -2
  116. package/dist/pdpp/issuance.js.map +1 -1
  117. package/dist/pdpp/resolve.d.ts +12 -1
  118. package/dist/pdpp/resolve.d.ts.map +1 -1
  119. package/dist/pdpp/resolve.js +156 -58
  120. package/dist/pdpp/resolve.js.map +1 -1
  121. package/dist/pdpp/selection.d.ts +30 -1
  122. package/dist/pdpp/selection.d.ts.map +1 -1
  123. package/dist/pdpp/selection.js +77 -26
  124. package/dist/pdpp/selection.js.map +1 -1
  125. package/dist/pdpp/time.d.ts +39 -0
  126. package/dist/pdpp/time.d.ts.map +1 -0
  127. package/dist/pdpp/time.js +173 -0
  128. package/dist/pdpp/time.js.map +1 -0
  129. package/dist/pdpp/tokens.d.ts.map +1 -1
  130. package/dist/pdpp/tokens.js +4 -2
  131. package/dist/pdpp/tokens.js.map +1 -1
  132. package/dist/pdpp/types.d.ts +18 -2
  133. package/dist/pdpp/types.d.ts.map +1 -1
  134. package/dist/pdpp/types.js +7 -0
  135. package/dist/pdpp/types.js.map +1 -1
  136. package/dist/policy/reserved-scopes.d.ts +7 -0
  137. package/dist/policy/reserved-scopes.d.ts.map +1 -1
  138. package/dist/policy/reserved-scopes.js +12 -1
  139. package/dist/policy/reserved-scopes.js.map +1 -1
  140. package/dist/ports/index.d.ts +85 -1
  141. package/dist/ports/index.d.ts.map +1 -1
  142. package/dist/ports/index.js.map +1 -1
  143. package/dist/ports/pdpp-auth.d.ts +17 -27
  144. package/dist/ports/pdpp-auth.d.ts.map +1 -1
  145. package/dist/ports/pdpp-auth.js +14 -28
  146. package/dist/ports/pdpp-auth.js.map +1 -1
  147. package/dist/publication/publish.d.ts +96 -0
  148. package/dist/publication/publish.d.ts.map +1 -0
  149. package/dist/publication/publish.js +261 -0
  150. package/dist/publication/publish.js.map +1 -0
  151. package/dist/replication/completion.d.ts +20 -0
  152. package/dist/replication/completion.d.ts.map +1 -0
  153. package/dist/replication/completion.js +73 -0
  154. package/dist/replication/completion.js.map +1 -0
  155. package/dist/replication/coordinator-state.d.ts +29 -0
  156. package/dist/replication/coordinator-state.d.ts.map +1 -0
  157. package/dist/replication/coordinator-state.js +88 -0
  158. package/dist/replication/coordinator-state.js.map +1 -0
  159. package/dist/replication/coordinator-state.test-utils.d.ts +32 -0
  160. package/dist/replication/coordinator-state.test-utils.d.ts.map +1 -0
  161. package/dist/replication/coordinator-state.test-utils.js +113 -0
  162. package/dist/replication/coordinator-state.test-utils.js.map +1 -0
  163. package/dist/replication/coordinator.d.ts +264 -0
  164. package/dist/replication/coordinator.d.ts.map +1 -0
  165. package/dist/replication/coordinator.js +499 -0
  166. package/dist/replication/coordinator.js.map +1 -0
  167. package/dist/replication/copies.d.ts +126 -0
  168. package/dist/replication/copies.d.ts.map +1 -0
  169. package/dist/replication/copies.js +437 -0
  170. package/dist/replication/copies.js.map +1 -0
  171. package/dist/replication/copy-promotion.d.ts +132 -0
  172. package/dist/replication/copy-promotion.d.ts.map +1 -0
  173. package/dist/replication/copy-promotion.js +126 -0
  174. package/dist/replication/copy-promotion.js.map +1 -0
  175. package/dist/replication/door.d.ts +33 -0
  176. package/dist/replication/door.d.ts.map +1 -0
  177. package/dist/replication/door.js +10 -0
  178. package/dist/replication/door.js.map +1 -0
  179. package/dist/replication/dpv2.d.ts +141 -0
  180. package/dist/replication/dpv2.d.ts.map +1 -0
  181. package/dist/replication/dpv2.js +320 -0
  182. package/dist/replication/dpv2.js.map +1 -0
  183. package/dist/replication/effects.d.ts +68 -0
  184. package/dist/replication/effects.d.ts.map +1 -0
  185. package/dist/replication/effects.js +89 -0
  186. package/dist/replication/effects.js.map +1 -0
  187. package/dist/replication/engine.d.ts +378 -0
  188. package/dist/replication/engine.d.ts.map +1 -0
  189. package/dist/replication/engine.js +3197 -0
  190. package/dist/replication/engine.js.map +1 -0
  191. package/dist/replication/envelope.d.ts +481 -0
  192. package/dist/replication/envelope.d.ts.map +1 -0
  193. package/dist/replication/envelope.js +192 -0
  194. package/dist/replication/envelope.js.map +1 -0
  195. package/dist/replication/evidence.d.ts +118 -0
  196. package/dist/replication/evidence.d.ts.map +1 -0
  197. package/dist/replication/evidence.js +198 -0
  198. package/dist/replication/evidence.js.map +1 -0
  199. package/dist/replication/finality.d.ts +16 -0
  200. package/dist/replication/finality.d.ts.map +1 -0
  201. package/dist/replication/finality.js +11 -0
  202. package/dist/replication/finality.js.map +1 -0
  203. package/dist/replication/fixtures.d.ts +16 -0
  204. package/dist/replication/fixtures.d.ts.map +1 -0
  205. package/dist/replication/fixtures.js +47 -0
  206. package/dist/replication/fixtures.js.map +1 -0
  207. package/dist/replication/host-config.d.ts +52 -0
  208. package/dist/replication/host-config.d.ts.map +1 -0
  209. package/dist/replication/host-config.js +111 -0
  210. package/dist/replication/host-config.js.map +1 -0
  211. package/dist/replication/host-driver.d.ts +95 -0
  212. package/dist/replication/host-driver.d.ts.map +1 -0
  213. package/dist/replication/host-driver.js +202 -0
  214. package/dist/replication/host-driver.js.map +1 -0
  215. package/dist/replication/host-ports.d.ts +48 -0
  216. package/dist/replication/host-ports.d.ts.map +1 -0
  217. package/dist/replication/host-ports.js +69 -0
  218. package/dist/replication/host-ports.js.map +1 -0
  219. package/dist/replication/identity.d.ts +13 -0
  220. package/dist/replication/identity.d.ts.map +1 -0
  221. package/dist/replication/identity.js +22 -0
  222. package/dist/replication/identity.js.map +1 -0
  223. package/dist/replication/limits.d.ts +124 -0
  224. package/dist/replication/limits.d.ts.map +1 -0
  225. package/dist/replication/limits.js +182 -0
  226. package/dist/replication/limits.js.map +1 -0
  227. package/dist/replication/merge-plan.d.ts +92 -0
  228. package/dist/replication/merge-plan.d.ts.map +1 -0
  229. package/dist/replication/merge-plan.js +229 -0
  230. package/dist/replication/merge-plan.js.map +1 -0
  231. package/dist/replication/namespace.d.ts +4 -0
  232. package/dist/replication/namespace.d.ts.map +1 -0
  233. package/dist/replication/namespace.js +7 -0
  234. package/dist/replication/namespace.js.map +1 -0
  235. package/dist/replication/outcome.d.ts +178 -0
  236. package/dist/replication/outcome.d.ts.map +1 -0
  237. package/dist/replication/outcome.js +83 -0
  238. package/dist/replication/outcome.js.map +1 -0
  239. package/dist/replication/payload.d.ts +39 -0
  240. package/dist/replication/payload.d.ts.map +1 -0
  241. package/dist/replication/payload.js +137 -0
  242. package/dist/replication/payload.js.map +1 -0
  243. package/dist/replication/preparation.d.ts +42 -0
  244. package/dist/replication/preparation.d.ts.map +1 -0
  245. package/dist/replication/preparation.js +118 -0
  246. package/dist/replication/preparation.js.map +1 -0
  247. package/dist/replication/rebaseline.d.ts +33 -0
  248. package/dist/replication/rebaseline.d.ts.map +1 -0
  249. package/dist/replication/rebaseline.js +40 -0
  250. package/dist/replication/rebaseline.js.map +1 -0
  251. package/dist/replication/rebinding.d.ts +43 -0
  252. package/dist/replication/rebinding.d.ts.map +1 -0
  253. package/dist/replication/rebinding.js +52 -0
  254. package/dist/replication/rebinding.js.map +1 -0
  255. package/dist/replication/receive.d.ts +57 -0
  256. package/dist/replication/receive.d.ts.map +1 -0
  257. package/dist/replication/receive.js +114 -0
  258. package/dist/replication/receive.js.map +1 -0
  259. package/dist/replication/record-reducer.d.ts +16 -0
  260. package/dist/replication/record-reducer.d.ts.map +1 -0
  261. package/dist/replication/record-reducer.js +52 -0
  262. package/dist/replication/record-reducer.js.map +1 -0
  263. package/dist/replication/revision.d.ts +24 -0
  264. package/dist/replication/revision.d.ts.map +1 -0
  265. package/dist/replication/revision.js +35 -0
  266. package/dist/replication/revision.js.map +1 -0
  267. package/dist/replication/roster.d.ts +53 -0
  268. package/dist/replication/roster.d.ts.map +1 -0
  269. package/dist/replication/roster.js +115 -0
  270. package/dist/replication/roster.js.map +1 -0
  271. package/dist/replication/schedule.d.ts +73 -0
  272. package/dist/replication/schedule.d.ts.map +1 -0
  273. package/dist/replication/schedule.js +182 -0
  274. package/dist/replication/schedule.js.map +1 -0
  275. package/dist/replication/stream.d.ts +73 -0
  276. package/dist/replication/stream.d.ts.map +1 -0
  277. package/dist/replication/stream.js +542 -0
  278. package/dist/replication/stream.js.map +1 -0
  279. package/dist/replication/transport.d.ts +236 -0
  280. package/dist/replication/transport.d.ts.map +1 -0
  281. package/dist/replication/transport.js +440 -0
  282. package/dist/replication/transport.js.map +1 -0
  283. package/dist/replication/visibility-engine.d.ts +337 -0
  284. package/dist/replication/visibility-engine.d.ts.map +1 -0
  285. package/dist/replication/visibility-engine.js +602 -0
  286. package/dist/replication/visibility-engine.js.map +1 -0
  287. package/dist/replication/visibility-policy.d.ts +26 -0
  288. package/dist/replication/visibility-policy.d.ts.map +1 -0
  289. package/dist/replication/visibility-policy.js +33 -0
  290. package/dist/replication/visibility-policy.js.map +1 -0
  291. package/dist/replication/writer-identity-store.d.ts +100 -0
  292. package/dist/replication/writer-identity-store.d.ts.map +1 -0
  293. package/dist/replication/writer-identity-store.js +218 -0
  294. package/dist/replication/writer-identity-store.js.map +1 -0
  295. package/dist/replication/writer-identity.d.ts +252 -0
  296. package/dist/replication/writer-identity.d.ts.map +1 -0
  297. package/dist/replication/writer-identity.js +281 -0
  298. package/dist/replication/writer-identity.js.map +1 -0
  299. package/dist/replication/writer-identity.test-utils.d.ts +24 -0
  300. package/dist/replication/writer-identity.test-utils.d.ts.map +1 -0
  301. package/dist/replication/writer-identity.test-utils.js +86 -0
  302. package/dist/replication/writer-identity.test-utils.js.map +1 -0
  303. package/dist/schemas/server-config.d.ts +13 -0
  304. package/dist/schemas/server-config.d.ts.map +1 -1
  305. package/dist/schemas/server-config.js +24 -0
  306. package/dist/schemas/server-config.js.map +1 -1
  307. package/dist/storage/adapters/index.d.ts +3 -1
  308. package/dist/storage/adapters/index.d.ts.map +1 -1
  309. package/dist/storage/adapters/index.js +2 -0
  310. package/dist/storage/adapters/index.js.map +1 -1
  311. package/dist/storage/adapters/interface.d.ts +18 -1
  312. package/dist/storage/adapters/interface.d.ts.map +1 -1
  313. package/dist/storage/adapters/interface.js +13 -1
  314. package/dist/storage/adapters/interface.js.map +1 -1
  315. package/dist/storage/adapters/sdk.d.ts +2 -1
  316. package/dist/storage/adapters/sdk.d.ts.map +1 -1
  317. package/dist/storage/adapters/sdk.js +21 -3
  318. package/dist/storage/adapters/sdk.js.map +1 -1
  319. package/dist/storage/adapters/vana-audience.d.ts +17 -5
  320. package/dist/storage/adapters/vana-audience.d.ts.map +1 -1
  321. package/dist/storage/adapters/vana-audience.js +24 -9
  322. package/dist/storage/adapters/vana-audience.js.map +1 -1
  323. package/dist/storage/adapters/vana.d.ts +2 -2
  324. package/dist/storage/adapters/vana.d.ts.map +1 -1
  325. package/dist/storage/adapters/vana.js +30 -22
  326. package/dist/storage/adapters/vana.js.map +1 -1
  327. package/dist/storage/canonical-legacy-projection.d.ts +1 -1
  328. package/dist/storage/canonical-legacy-projection.d.ts.map +1 -1
  329. package/dist/storage/canonical-legacy-projection.js +13 -15
  330. package/dist/storage/canonical-legacy-projection.js.map +1 -1
  331. package/dist/storage/legacy-projection.d.ts.map +1 -1
  332. package/dist/storage/legacy-projection.js +16 -1
  333. package/dist/storage/legacy-projection.js.map +1 -1
  334. package/dist/storage/legacy-scope-coverage-exceptions.d.ts +5 -0
  335. package/dist/storage/legacy-scope-coverage-exceptions.d.ts.map +1 -1
  336. package/dist/storage/legacy-scope-coverage-exceptions.js +4 -0
  337. package/dist/storage/legacy-scope-coverage-exceptions.js.map +1 -1
  338. package/dist/storage/legacy-scope-coverage.d.ts.map +1 -1
  339. package/dist/storage/legacy-scope-coverage.js +14 -1
  340. package/dist/storage/legacy-scope-coverage.js.map +1 -1
  341. package/dist/storage/legacy-scope-entity-keys.d.ts +14 -1
  342. package/dist/storage/legacy-scope-entity-keys.d.ts.map +1 -1
  343. package/dist/storage/legacy-scope-entity-keys.js +18 -1
  344. package/dist/storage/legacy-scope-entity-keys.js.map +1 -1
  345. package/dist/storage/legacy-scope-view.d.ts +57 -5
  346. package/dist/storage/legacy-scope-view.d.ts.map +1 -1
  347. package/dist/storage/legacy-scope-view.js +644 -318
  348. package/dist/storage/legacy-scope-view.js.map +1 -1
  349. package/dist/storage/pdpp-records/cursor.d.ts +47 -2
  350. package/dist/storage/pdpp-records/cursor.d.ts.map +1 -1
  351. package/dist/storage/pdpp-records/cursor.js +7 -0
  352. package/dist/storage/pdpp-records/cursor.js.map +1 -1
  353. package/dist/storage/pdpp-records/enforcement.d.ts +3 -16
  354. package/dist/storage/pdpp-records/enforcement.d.ts.map +1 -1
  355. package/dist/storage/pdpp-records/enforcement.js +40 -13
  356. package/dist/storage/pdpp-records/enforcement.js.map +1 -1
  357. package/dist/storage/pdpp-records/index.d.ts +2 -0
  358. package/dist/storage/pdpp-records/index.d.ts.map +1 -1
  359. package/dist/storage/pdpp-records/index.js +1 -0
  360. package/dist/storage/pdpp-records/index.js.map +1 -1
  361. package/dist/storage/pdpp-records/interface.d.ts +8 -1
  362. package/dist/storage/pdpp-records/interface.d.ts.map +1 -1
  363. package/dist/storage/pdpp-records/list-page.d.ts +35 -0
  364. package/dist/storage/pdpp-records/list-page.d.ts.map +1 -0
  365. package/dist/storage/pdpp-records/list-page.js +106 -0
  366. package/dist/storage/pdpp-records/list-page.js.map +1 -0
  367. package/dist/storage/pdpp-records/memory-store.d.ts.map +1 -1
  368. package/dist/storage/pdpp-records/memory-store.js +95 -99
  369. package/dist/storage/pdpp-records/memory-store.js.map +1 -1
  370. package/dist/storage/pdpp-records/portable.d.ts +3 -0
  371. package/dist/storage/pdpp-records/portable.d.ts.map +1 -1
  372. package/dist/storage/pdpp-records/portable.js +3 -0
  373. package/dist/storage/pdpp-records/portable.js.map +1 -1
  374. package/dist/storage/pdpp-records/replication-journal.d.ts +20 -0
  375. package/dist/storage/pdpp-records/replication-journal.d.ts.map +1 -0
  376. package/dist/storage/pdpp-records/replication-journal.js +2 -0
  377. package/dist/storage/pdpp-records/replication-journal.js.map +1 -0
  378. package/dist/storage/pdpp-records/stream-declaration.d.ts +0 -2
  379. package/dist/storage/pdpp-records/stream-declaration.d.ts.map +1 -1
  380. package/dist/storage/pdpp-records/stream-declaration.js +0 -9
  381. package/dist/storage/pdpp-records/stream-declaration.js.map +1 -1
  382. package/dist/storage/pdpp-records/sync-selection.d.ts +4 -0
  383. package/dist/storage/pdpp-records/sync-selection.d.ts.map +1 -0
  384. package/dist/storage/pdpp-records/sync-selection.js +37 -0
  385. package/dist/storage/pdpp-records/sync-selection.js.map +1 -0
  386. package/dist/storage/pdpp-records/types.d.ts +64 -0
  387. package/dist/storage/pdpp-records/types.d.ts.map +1 -1
  388. package/dist/storage/pdpp-records/types.js.map +1 -1
  389. package/dist/sync/delete-data-port.d.ts +15 -0
  390. package/dist/sync/delete-data-port.d.ts.map +1 -1
  391. package/dist/sync/delete-data-port.js +19 -7
  392. package/dist/sync/delete-data-port.js.map +1 -1
  393. package/dist/sync/index.d.ts +2 -1
  394. package/dist/sync/index.d.ts.map +1 -1
  395. package/dist/sync/index.js +2 -1
  396. package/dist/sync/index.js.map +1 -1
  397. package/dist/sync/pending-blob-deletions.d.ts +18 -2
  398. package/dist/sync/pending-blob-deletions.d.ts.map +1 -1
  399. package/dist/sync/pending-blob-deletions.js +69 -23
  400. package/dist/sync/pending-blob-deletions.js.map +1 -1
  401. package/dist/sync/workers/delete.d.ts.map +1 -1
  402. package/dist/sync/workers/delete.js +316 -142
  403. package/dist/sync/workers/delete.js.map +1 -1
  404. package/dist/sync/workers/download.d.ts.map +1 -1
  405. package/dist/sync/workers/download.js +53 -5
  406. package/dist/sync/workers/download.js.map +1 -1
  407. package/dist/sync/workers/upload.d.ts +24 -5
  408. package/dist/sync/workers/upload.d.ts.map +1 -1
  409. package/dist/sync/workers/upload.js +160 -275
  410. package/dist/sync/workers/upload.js.map +1 -1
  411. package/dist/test-utils/memory-storage.d.ts.map +1 -1
  412. package/dist/test-utils/memory-storage.js +17 -2
  413. package/dist/test-utils/memory-storage.js.map +1 -1
  414. package/package.json +24 -2
package/dist/mcp/tools.js CHANGED
@@ -1,18 +1,25 @@
1
- import { isSystemScope } from "../policy/reserved-scopes.js";
1
+ import { isMemoryScope, isSystemScope } from "../policy/reserved-scopes.js";
2
2
  /**
3
3
  * MCP tool surface. Phase 1 / §4 of 260604-PLAN-vana-mcp-personal-server.md.
4
4
  *
5
- * Read-only, small, and only over scopes that the connection's grants cover.
6
- * No write tools. No grant-approval tools. No raw owner/admin status tools.
5
+ * Small, and only over scopes that the connection's grants cover. No
6
+ * grant-approval tools. No raw owner/admin status tools.
7
7
  *
8
8
  * Every tool that returns data first picks a covering grant from the
9
9
  * connection's grant list, signs a Web3Signed request as the per-connection
10
10
  * grantee, and uses the bounded sidecar read path — so reads are grant-gated,
11
11
  * access-logged, and safe for large scopes.
12
+ *
13
+ * The one write tool, `remember`, saves only into a scope a `write:` grant
14
+ * entry covers, and goes through the delegated-write path a builder uses
15
+ * (see write-client.ts). A read grant never confers write access, and a
16
+ * `write:` entry never confers read access.
12
17
  */
13
18
  import { z } from "zod";
14
19
  import { MCP_SCOPE_ACCESS_REQUEST_LIMIT, } from "./types.js";
15
20
  import { McpDataReadError } from "./read-client.js";
21
+ import { McpDataWriteError } from "./write-client.js";
22
+ import { isWriteScopeEntry, writeScopePatterns, WRITE_SCOPE_PREFIX, } from "../policy/data-write.js";
16
23
  import { toMcpScopeAccessRequestView } from "./connection-api.js";
17
24
  import { MiniSearchIndex } from "./search/index.js";
18
25
  import { MAX_SELECTED_BLOCK_IDS } from "../storage/blocks/index.js";
@@ -47,20 +54,83 @@ function textResult(value, isError = false) {
47
54
  ...(isError ? { isError: true } : {}),
48
55
  };
49
56
  }
57
+ /** A grant entry that names readable data: not a system scope, not `write:`. */
58
+ function isReadableScopeEntry(scope) {
59
+ return !isSystemScope(scope) && !isWriteScopeEntry(scope);
60
+ }
50
61
  function uniqueScopes(connection) {
51
62
  const set = new Set();
52
63
  for (const grant of connection.grants) {
53
64
  for (const scope of grant.scopes) {
54
- if (!isSystemScope(scope))
65
+ if (isReadableScopeEntry(scope))
55
66
  set.add(scope);
56
67
  }
57
68
  }
58
69
  return Array.from(set).sort();
59
70
  }
71
+ /**
72
+ * A scope `remember` may save into under these grant entries: an exact
73
+ * `write:<scope>` entry. MCP writes never honor a `write:` wildcard, even one
74
+ * an older grant still carries, although builder writes do: a memory grant
75
+ * names the one scope the agent saves into.
76
+ */
77
+ function exactWriteScopes(grantScopes) {
78
+ return writeScopePatterns(grantScopes).filter((scope) => !scope.includes("*") && !isSystemScope(scope));
79
+ }
80
+ /** Scopes the connection may save into, `write:` prefix stripped. */
81
+ function uniqueWritableScopes(connection) {
82
+ const set = new Set();
83
+ for (const grant of connection.grants) {
84
+ for (const scope of exactWriteScopes(grant.scopes))
85
+ set.add(scope);
86
+ }
87
+ return Array.from(set).sort();
88
+ }
89
+ /**
90
+ * Every data scope (or pattern) the connection may read or write, `write:`
91
+ * prefix stripped. A host that copies data in before serving a connection
92
+ * (the enclave) must copy write targets too: `remember` rewrites the whole
93
+ * memory list from the local copy, so a missing copy would drop memories.
94
+ */
95
+ export function connectionDataScopes(connection) {
96
+ const set = new Set();
97
+ for (const grant of connection.grants) {
98
+ for (const scope of grant.scopes) {
99
+ const target = isWriteScopeEntry(scope)
100
+ ? scope.slice(WRITE_SCOPE_PREFIX.length)
101
+ : scope;
102
+ if (target)
103
+ set.add(target);
104
+ }
105
+ }
106
+ return Array.from(set).sort();
107
+ }
108
+ /**
109
+ * Resolve a scope to a grant with an exact `write:` entry for it (see
110
+ * exactWriteScopes). The server-side write policy still runs on every save;
111
+ * this only narrows what the tool will attempt.
112
+ */
113
+ export function resolveWriteGrantForScope(connection, scope) {
114
+ for (const grant of connection.grants) {
115
+ if (exactWriteScopes(grant.scopes).includes(scope)) {
116
+ return { grantId: grant.grantId, scopes: grant.scopes };
117
+ }
118
+ }
119
+ return null;
120
+ }
121
+ /**
122
+ * Whether the connection already holds `scope` as a scope request names it:
123
+ * a `write:` entry is covered only by write grants, anything else by reads.
124
+ */
125
+ function connectionCoversRequestedScope(connection, scope) {
126
+ return isWriteScopeEntry(scope)
127
+ ? Boolean(resolveWriteGrantForScope(connection, scope.slice(WRITE_SCOPE_PREFIX.length)))
128
+ : Boolean(resolveGrantForScope(connection, scope));
129
+ }
60
130
  function uniqueSources(connection) {
61
131
  const set = new Set();
62
132
  for (const grant of connection.grants) {
63
- if (!grant.scopes.some((scope) => !isSystemScope(scope)))
133
+ if (!grant.scopes.some(isReadableScopeEntry))
64
134
  continue;
65
135
  const sourceId = typeof grant.sourceId === "string" ? grant.sourceId.trim() : "";
66
136
  if (sourceId) {
@@ -68,7 +138,7 @@ function uniqueSources(connection) {
68
138
  continue;
69
139
  }
70
140
  for (const scope of grant.scopes) {
71
- if (isSystemScope(scope))
141
+ if (!isReadableScopeEntry(scope))
72
142
  continue;
73
143
  const [scopeSourceId] = scope.split(".");
74
144
  if (scopeSourceId && scopeSourceId !== "*") {
@@ -170,7 +240,7 @@ const scopeAccessRequestInputShape = {
170
240
  .array(z.string().min(1).max(SEARCH_SCOPE_MAX_CHARS))
171
241
  .min(1)
172
242
  .max(MCP_SCOPE_ACCESS_REQUEST_LIMIT)
173
- .describe("Exact scope ids the MCP client wants to read."),
243
+ .describe("Exact scope ids to read, or write:<scope> to save into."),
174
244
  reason: z
175
245
  .string()
176
246
  .max(500)
@@ -558,8 +628,10 @@ const listGrantedScopes = {
558
628
  }));
559
629
  // Lets an agent that asked for more scopes see whether the owner has
560
630
  // answered yet without re-recording the request.
631
+ const writableScopes = uniqueWritableScopes(connection);
561
632
  return textResult({
562
633
  scopes: scopeEntries,
634
+ ...(writableScopes.length > 0 ? { writableScopes } : {}),
563
635
  ...(connection.scopeAccessRequest
564
636
  ? {
565
637
  pendingScopeRequest: toMcpScopeAccessRequestView(connection.scopeAccessRequest),
@@ -582,8 +654,8 @@ const requestScopeAccess = {
582
654
  // answer from the agent that is checking back.
583
655
  const previousDecision = connection.scopeAccessDecision;
584
656
  let effectiveConnection = connection;
585
- let grantedRequestedScopes = requestedScopes.filter((scope) => Boolean(resolveGrantForScope(effectiveConnection, scope)));
586
- let missingScopes = requestedScopes.filter((scope) => !resolveGrantForScope(connection, scope));
657
+ let grantedRequestedScopes = requestedScopes.filter((scope) => connectionCoversRequestedScope(effectiveConnection, scope));
658
+ let missingScopes = requestedScopes.filter((scope) => !connectionCoversRequestedScope(connection, scope));
587
659
  const reason = typeof args.reason === "string" ? args.reason.trim() : "";
588
660
  const approvalRequired = missingScopes.length > 0;
589
661
  const alreadyRecorded = approvalRequired &&
@@ -598,8 +670,8 @@ const requestScopeAccess = {
598
670
  effectiveConnection = outcome.connection;
599
671
  requestRecorded = outcome.requestRecorded;
600
672
  readToken = outcome.readToken;
601
- grantedRequestedScopes = requestedScopes.filter((scope) => Boolean(resolveGrantForScope(effectiveConnection, scope)));
602
- missingScopes = requestedScopes.filter((scope) => !resolveGrantForScope(effectiveConnection, scope));
673
+ grantedRequestedScopes = requestedScopes.filter((scope) => connectionCoversRequestedScope(effectiveConnection, scope));
674
+ missingScopes = requestedScopes.filter((scope) => !connectionCoversRequestedScope(effectiveConnection, scope));
603
675
  }
604
676
  const finalApprovalRequired = missingScopes.length > 0;
605
677
  const recorded = finalApprovalRequired && requestRecorded;
@@ -1435,6 +1507,316 @@ const getScopeFile = {
1435
1507
  }
1436
1508
  },
1437
1509
  };
1510
+ const REMEMBER_TOOL = "remember";
1511
+ const FORGET_TOOL = "forget";
1512
+ const REMEMBER_TEXT_MAX_CHARS = 4_000;
1513
+ const REMEMBER_KEY_MAX_CHARS = 128;
1514
+ const MEMORY_ID_MAX_CHARS = 64;
1515
+ /**
1516
+ * Every save stores a new snapshot of the scope's record list, so the list is
1517
+ * bounded by size rather than count. Sync publishes only the newest snapshot of
1518
+ * a memory scope (see `isCoalescedScope` in sync/workers/upload.ts).
1519
+ */
1520
+ export const MEMORY_SCOPE_MAX_BYTES = 20 * 1024 * 1024;
1521
+ class RememberRefusal extends Error {
1522
+ body;
1523
+ constructor(body) {
1524
+ super(String(body.message));
1525
+ this.body = body;
1526
+ this.name = "RememberRefusal";
1527
+ }
1528
+ }
1529
+ /** A save that would only repeat a memory the scope already holds. */
1530
+ class DuplicateMemory extends Error {
1531
+ record;
1532
+ constructor(record) {
1533
+ super("duplicate memory");
1534
+ this.record = record;
1535
+ this.name = "DuplicateMemory";
1536
+ }
1537
+ }
1538
+ function isPlainRecord(value) {
1539
+ return typeof value === "object" && value !== null && !Array.isArray(value);
1540
+ }
1541
+ /**
1542
+ * The memory records of a stored body. A memory scope holds exactly
1543
+ * `{ records: [...] }` of memory rows, or the earlier `{ memories: [...] }`
1544
+ * list, which is converted here (ids kept). Anything else was written by
1545
+ * someone else and is never overwritten.
1546
+ */
1547
+ function storedMemoryRecords(scope, data) {
1548
+ const keys = Object.keys(data);
1549
+ if (keys.length === 1 &&
1550
+ Array.isArray(data.records) &&
1551
+ data.records.every((row) => isPlainRecord(row) &&
1552
+ typeof row.id === "string" &&
1553
+ typeof row.content === "string")) {
1554
+ return data.records;
1555
+ }
1556
+ if (keys.length === 1 &&
1557
+ Array.isArray(data.memories) &&
1558
+ data.memories.every((item) => isPlainRecord(item) &&
1559
+ typeof item.id === "string" &&
1560
+ typeof item.text === "string")) {
1561
+ return data.memories.map((item) => {
1562
+ const at = typeof item.savedAt === "string" ? item.savedAt : "";
1563
+ return {
1564
+ id: item.id,
1565
+ content: item.text,
1566
+ created_at: at,
1567
+ updated_at: at,
1568
+ ...(typeof item.key === "string" ? { key: item.key } : {}),
1569
+ written_by: null,
1570
+ };
1571
+ });
1572
+ }
1573
+ throw new RememberRefusal({
1574
+ error: "scope_not_memory",
1575
+ scope,
1576
+ message: `Scope ${scope} holds data that is not a memory list; it will not be changed. Use another write scope.`,
1577
+ });
1578
+ }
1579
+ /**
1580
+ * The scope a memory tool acts on and the grant that covers it, or the error
1581
+ * result to return. A call may omit `scope` when the connection can write to
1582
+ * exactly one scope.
1583
+ */
1584
+ function resolveMemoryTarget(args, connection) {
1585
+ const writableScopes = uniqueWritableScopes(connection);
1586
+ const namedScope = typeof args.scope === "string" ? args.scope.trim() : "";
1587
+ const onlyScope = writableScopes.length === 1 && !writableScopes[0].includes("*")
1588
+ ? writableScopes[0]
1589
+ : "";
1590
+ const scope = namedScope || onlyScope;
1591
+ if (!scope) {
1592
+ return {
1593
+ error: textResult({
1594
+ error: "scope_required",
1595
+ writableScopes,
1596
+ message: writableScopes.length === 0
1597
+ ? 'This connection cannot save memories. Call request_scope_access with scopes ["write:memory.<app>"] and ask the user to approve it.'
1598
+ : "Name the scope; this connection can write to more than one.",
1599
+ }, true),
1600
+ };
1601
+ }
1602
+ if (!isMemoryScope(scope)) {
1603
+ return {
1604
+ error: textResult({
1605
+ error: "scope_not_memory",
1606
+ scope,
1607
+ message: `Memories live in memory.<app> scopes; ${scope} is not one.`,
1608
+ }, true),
1609
+ };
1610
+ }
1611
+ const grant = resolveWriteGrantForScope(connection, scope);
1612
+ if (!grant) {
1613
+ const requestScope = `${WRITE_SCOPE_PREFIX}${scope}`;
1614
+ return {
1615
+ error: textResult({
1616
+ error: "scope_not_granted",
1617
+ scope,
1618
+ requestScope,
1619
+ writableScopes,
1620
+ message: `This connection may not write to ${scope}. Call request_scope_access with scopes ["${requestScope}"] and ask the user to approve it.`,
1621
+ }, true),
1622
+ };
1623
+ }
1624
+ return { scope, grantId: grant.grantId };
1625
+ }
1626
+ const WRITE_UNAVAILABLE = textResult({
1627
+ error: "write_unavailable",
1628
+ message: "This Personal Server does not accept MCP writes.",
1629
+ }, true);
1630
+ /** Map a refused or failed memory write to the tool's error result. */
1631
+ function memoryWriteError(err, scope) {
1632
+ if (err instanceof RememberRefusal)
1633
+ return textResult(err.body, true);
1634
+ if (err instanceof McpDataWriteError) {
1635
+ const body = err.body;
1636
+ const detail = typeof body?.error === "object" && body.error !== null
1637
+ ? body.error
1638
+ : { errorCode: body?.error, message: body?.message };
1639
+ return textResult({
1640
+ error: err.status === 401 || err.status === 403
1641
+ ? "unauthorized"
1642
+ : err.status === 412
1643
+ ? "write_conflict"
1644
+ : "write_failed",
1645
+ status: err.status,
1646
+ scope,
1647
+ ...(detail.errorCode ? { errorCode: detail.errorCode } : {}),
1648
+ ...(detail.message ? { message: detail.message } : {}),
1649
+ }, true);
1650
+ }
1651
+ throw err;
1652
+ }
1653
+ function memoryBody(records, scope) {
1654
+ const body = { records };
1655
+ if (new TextEncoder().encode(JSON.stringify(body)).byteLength >
1656
+ MEMORY_SCOPE_MAX_BYTES) {
1657
+ throw new RememberRefusal({
1658
+ error: "memory_full",
1659
+ scope,
1660
+ limitBytes: MEMORY_SCOPE_MAX_BYTES,
1661
+ message: `Scope ${scope} is full. Forget or replace memories to make room.`,
1662
+ });
1663
+ }
1664
+ return body;
1665
+ }
1666
+ const remember = {
1667
+ name: REMEMBER_TOOL,
1668
+ title: "Remember",
1669
+ description: "Save a fact, preference, goal or decision the user shares, without being asked, so any allowed agent can recall it. Tell the user briefly. Never save secrets, passwords, IDs or account numbers. Needs a write:<scope> grant (writableScopes).",
1670
+ inputSchema: {
1671
+ text: z
1672
+ .string()
1673
+ .min(1)
1674
+ .max(REMEMBER_TEXT_MAX_CHARS)
1675
+ .describe("Self-contained; readable without this chat."),
1676
+ scope: z
1677
+ .string()
1678
+ .min(1)
1679
+ .max(SEARCH_SCOPE_MAX_CHARS)
1680
+ .optional()
1681
+ .describe("e.g. memory.claude; optional with one writable scope."),
1682
+ key: z
1683
+ .string()
1684
+ .min(1)
1685
+ .max(REMEMBER_KEY_MAX_CHARS)
1686
+ .optional()
1687
+ .describe("Saving again with the same key replaces the memory."),
1688
+ },
1689
+ async handler(args, { connection, writeClient }) {
1690
+ const content = typeof args.text === "string" ? args.text.trim() : "";
1691
+ if (!content) {
1692
+ return textResult({ error: "invalid_arguments", message: "text must not be empty." }, true);
1693
+ }
1694
+ const key = typeof args.key === "string" && args.key.trim()
1695
+ ? args.key.trim()
1696
+ : undefined;
1697
+ const target = resolveMemoryTarget(args, connection);
1698
+ if ("error" in target)
1699
+ return target.error;
1700
+ const { scope, grantId } = target;
1701
+ if (!writeClient)
1702
+ return WRITE_UNAVAILABLE;
1703
+ const now = new Date().toISOString();
1704
+ let saved;
1705
+ let replaced = false;
1706
+ let memoryCount = 0;
1707
+ try {
1708
+ await writeClient.updateScope({
1709
+ scope,
1710
+ grantId,
1711
+ update(current) {
1712
+ const records = current.data === null
1713
+ ? []
1714
+ : storedMemoryRecords(scope, current.data);
1715
+ const previous = key
1716
+ ? records.find((record) => record.key === key)
1717
+ : undefined;
1718
+ if (!key) {
1719
+ const same = records.find((record) => record.content === content);
1720
+ if (same)
1721
+ throw new DuplicateMemory(same);
1722
+ }
1723
+ replaced = previous !== undefined;
1724
+ saved = {
1725
+ id: previous?.id ?? crypto.randomUUID(),
1726
+ content,
1727
+ created_at: previous?.created_at ?? now,
1728
+ updated_at: now,
1729
+ ...(key ? { key } : {}),
1730
+ written_by: connection.granteeAddress,
1731
+ };
1732
+ // Newest last: a replaced memory moves to the end, so list order is
1733
+ // the order the memories were last saved in.
1734
+ const next = [
1735
+ ...records.filter((record) => record !== previous),
1736
+ saved,
1737
+ ];
1738
+ memoryCount = next.length;
1739
+ return memoryBody(next, scope);
1740
+ },
1741
+ });
1742
+ }
1743
+ catch (err) {
1744
+ if (err instanceof DuplicateMemory) {
1745
+ return textResult({
1746
+ saved: false,
1747
+ duplicate: true,
1748
+ scope,
1749
+ id: err.record.id,
1750
+ message: "This memory is already saved.",
1751
+ });
1752
+ }
1753
+ return memoryWriteError(err, scope);
1754
+ }
1755
+ return textResult({
1756
+ saved: true,
1757
+ scope,
1758
+ id: saved.id,
1759
+ savedAt: saved.updated_at,
1760
+ ...(key ? { key } : {}),
1761
+ replaced,
1762
+ memoryCount,
1763
+ });
1764
+ },
1765
+ };
1766
+ const forget = {
1767
+ name: FORGET_TOOL,
1768
+ title: "Forget",
1769
+ description: "Delete a saved memory by id or key. Needs a write:<scope> grant.",
1770
+ inputSchema: {
1771
+ id: z.string().min(1).max(MEMORY_ID_MAX_CHARS).optional(),
1772
+ key: z.string().min(1).max(REMEMBER_KEY_MAX_CHARS).optional(),
1773
+ scope: z.string().min(1).max(SEARCH_SCOPE_MAX_CHARS).optional(),
1774
+ },
1775
+ async handler(args, { connection, writeClient }) {
1776
+ const id = typeof args.id === "string" ? args.id.trim() : "";
1777
+ const key = typeof args.key === "string" ? args.key.trim() : "";
1778
+ if (!id && !key) {
1779
+ return textResult({ error: "invalid_arguments", message: "Pass id or key." }, true);
1780
+ }
1781
+ const target = resolveMemoryTarget(args, connection);
1782
+ if ("error" in target)
1783
+ return target.error;
1784
+ const { scope, grantId } = target;
1785
+ if (!writeClient)
1786
+ return WRITE_UNAVAILABLE;
1787
+ let forgotten = [];
1788
+ let memoryCount = 0;
1789
+ try {
1790
+ await writeClient.updateScope({
1791
+ scope,
1792
+ grantId,
1793
+ update(current) {
1794
+ const records = current.data === null
1795
+ ? []
1796
+ : storedMemoryRecords(scope, current.data);
1797
+ // With both id and key, a record must match both.
1798
+ const matches = (record) => (!id || record.id === id) && (!key || record.key === key);
1799
+ const keep = records.filter((record) => !matches(record));
1800
+ if (keep.length === records.length) {
1801
+ throw new RememberRefusal({
1802
+ error: "not_found",
1803
+ scope,
1804
+ message: "No saved memory matches that id or key.",
1805
+ });
1806
+ }
1807
+ // Reset on every attempt: a 412 retry re-runs this callback.
1808
+ forgotten = records.filter(matches).map((record) => record.id);
1809
+ memoryCount = keep.length;
1810
+ return memoryBody(keep, scope);
1811
+ },
1812
+ });
1813
+ }
1814
+ catch (err) {
1815
+ return memoryWriteError(err, scope);
1816
+ }
1817
+ return textResult({ forgotten: true, scope, ids: forgotten, memoryCount });
1818
+ },
1819
+ };
1438
1820
  export const MCP_TOOLS = [
1439
1821
  listGrantedSources,
1440
1822
  listGrantedScopes,
@@ -1443,5 +1825,7 @@ export const MCP_TOOLS = [
1443
1825
  listScopeBlocks,
1444
1826
  getScopeFile,
1445
1827
  searchPersonalContext,
1828
+ remember,
1829
+ forget,
1446
1830
  ];
1447
1831
  //# sourceMappingURL=tools.js.map