@opendatalabs/personal-server-ts-core 0.0.1-canary.01ca694 → 0.0.1-canary.052d47e

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 (322) hide show
  1. package/dist/api/index.d.ts +282 -9
  2. package/dist/api/index.d.ts.map +1 -1
  3. package/dist/api/index.js +867 -163
  4. package/dist/api/index.js.map +1 -1
  5. package/dist/auth/request.d.ts.map +1 -1
  6. package/dist/auth/request.js.map +1 -1
  7. package/dist/client.d.ts +8 -1
  8. package/dist/client.d.ts.map +1 -1
  9. package/dist/client.js +21 -3
  10. package/dist/client.js.map +1 -1
  11. package/dist/contracts/binary.d.ts +12 -0
  12. package/dist/contracts/binary.d.ts.map +1 -1
  13. package/dist/contracts/binary.js +31 -0
  14. package/dist/contracts/binary.js.map +1 -1
  15. package/dist/contracts/data.d.ts +51 -5
  16. package/dist/contracts/data.d.ts.map +1 -1
  17. package/dist/contracts/data.js +166 -30
  18. package/dist/contracts/data.js.map +1 -1
  19. package/dist/contracts/grants.d.ts +7 -5
  20. package/dist/contracts/grants.d.ts.map +1 -1
  21. package/dist/contracts/grants.js +60 -37
  22. package/dist/contracts/grants.js.map +1 -1
  23. package/dist/contracts/index.d.ts +1 -1
  24. package/dist/contracts/index.d.ts.map +1 -1
  25. package/dist/contracts/index.js +1 -1
  26. package/dist/contracts/index.js.map +1 -1
  27. package/dist/derivatives/api.d.ts +48 -0
  28. package/dist/derivatives/api.d.ts.map +1 -0
  29. package/dist/derivatives/api.js +366 -0
  30. package/dist/derivatives/api.js.map +1 -0
  31. package/dist/derivatives/compute.d.ts +106 -0
  32. package/dist/derivatives/compute.d.ts.map +1 -0
  33. package/dist/derivatives/compute.js +414 -0
  34. package/dist/derivatives/compute.js.map +1 -0
  35. package/dist/derivatives/e2ee/aad.d.ts +22 -0
  36. package/dist/derivatives/e2ee/aad.d.ts.map +1 -0
  37. package/dist/derivatives/e2ee/aad.js +32 -0
  38. package/dist/derivatives/e2ee/aad.js.map +1 -0
  39. package/dist/derivatives/e2ee/attestation.d.ts +134 -0
  40. package/dist/derivatives/e2ee/attestation.d.ts.map +1 -0
  41. package/dist/derivatives/e2ee/attestation.js +248 -0
  42. package/dist/derivatives/e2ee/attestation.js.map +1 -0
  43. package/dist/derivatives/e2ee/index.d.ts +6 -0
  44. package/dist/derivatives/e2ee/index.d.ts.map +1 -0
  45. package/dist/derivatives/e2ee/index.js +6 -0
  46. package/dist/derivatives/e2ee/index.js.map +1 -0
  47. package/dist/derivatives/e2ee/jcs.d.ts +17 -0
  48. package/dist/derivatives/e2ee/jcs.d.ts.map +1 -0
  49. package/dist/derivatives/e2ee/jcs.js +55 -0
  50. package/dist/derivatives/e2ee/jcs.js.map +1 -0
  51. package/dist/derivatives/e2ee/phala.d.ts +62 -0
  52. package/dist/derivatives/e2ee/phala.d.ts.map +1 -0
  53. package/dist/derivatives/e2ee/phala.js +168 -0
  54. package/dist/derivatives/e2ee/phala.js.map +1 -0
  55. package/dist/derivatives/e2ee/suite.d.ts +56 -0
  56. package/dist/derivatives/e2ee/suite.d.ts.map +1 -0
  57. package/dist/derivatives/e2ee/suite.js +164 -0
  58. package/dist/derivatives/e2ee/suite.js.map +1 -0
  59. package/dist/derivatives/index.d.ts +10 -0
  60. package/dist/derivatives/index.d.ts.map +1 -0
  61. package/dist/derivatives/index.js +10 -0
  62. package/dist/derivatives/index.js.map +1 -0
  63. package/dist/derivatives/inference.d.ts +151 -0
  64. package/dist/derivatives/inference.d.ts.map +1 -0
  65. package/dist/derivatives/inference.js +262 -0
  66. package/dist/derivatives/inference.js.map +1 -0
  67. package/dist/derivatives/prompt.d.ts +64 -0
  68. package/dist/derivatives/prompt.d.ts.map +1 -0
  69. package/dist/derivatives/prompt.js +193 -0
  70. package/dist/derivatives/prompt.js.map +1 -0
  71. package/dist/derivatives/registration.d.ts +54 -0
  72. package/dist/derivatives/registration.d.ts.map +1 -0
  73. package/dist/derivatives/registration.js +180 -0
  74. package/dist/derivatives/registration.js.map +1 -0
  75. package/dist/derivatives/scheduler.d.ts +84 -0
  76. package/dist/derivatives/scheduler.d.ts.map +1 -0
  77. package/dist/derivatives/scheduler.js +257 -0
  78. package/dist/derivatives/scheduler.js.map +1 -0
  79. package/dist/derivatives/store.d.ts +14 -0
  80. package/dist/derivatives/store.d.ts.map +1 -0
  81. package/dist/derivatives/store.js +77 -0
  82. package/dist/derivatives/store.js.map +1 -0
  83. package/dist/derivatives/types.d.ts +92 -0
  84. package/dist/derivatives/types.d.ts.map +1 -0
  85. package/dist/derivatives/types.js +27 -0
  86. package/dist/derivatives/types.js.map +1 -0
  87. package/dist/errors/catalog.d.ts +75 -0
  88. package/dist/errors/catalog.d.ts.map +1 -1
  89. package/dist/errors/catalog.js +104 -0
  90. package/dist/errors/catalog.js.map +1 -1
  91. package/dist/grants/index.d.ts +2 -1
  92. package/dist/grants/index.d.ts.map +1 -1
  93. package/dist/grants/index.js +1 -1
  94. package/dist/grants/index.js.map +1 -1
  95. package/dist/keys/index.d.ts +1 -0
  96. package/dist/keys/index.d.ts.map +1 -1
  97. package/dist/keys/index.js +1 -1
  98. package/dist/keys/index.js.map +1 -1
  99. package/dist/keys/public-only-account.d.ts +8 -0
  100. package/dist/keys/public-only-account.d.ts.map +1 -0
  101. package/dist/keys/public-only-account.js +21 -0
  102. package/dist/keys/public-only-account.js.map +1 -0
  103. package/dist/keys/server-account.d.ts +2 -2
  104. package/dist/keys/server-account.d.ts.map +1 -1
  105. package/dist/lineage/attestation.d.ts +42 -0
  106. package/dist/lineage/attestation.d.ts.map +1 -0
  107. package/dist/lineage/attestation.js +25 -0
  108. package/dist/lineage/attestation.js.map +1 -0
  109. package/dist/lineage/gateway.d.ts +105 -0
  110. package/dist/lineage/gateway.d.ts.map +1 -0
  111. package/dist/lineage/gateway.js +242 -0
  112. package/dist/lineage/gateway.js.map +1 -0
  113. package/dist/lineage/index.d.ts +5 -0
  114. package/dist/lineage/index.d.ts.map +1 -0
  115. package/dist/lineage/index.js +5 -0
  116. package/dist/lineage/index.js.map +1 -0
  117. package/dist/lineage/lineage.d.ts +141 -0
  118. package/dist/lineage/lineage.d.ts.map +1 -0
  119. package/dist/lineage/lineage.js +255 -0
  120. package/dist/lineage/lineage.js.map +1 -0
  121. package/dist/logging/access-log.d.ts +10 -1
  122. package/dist/logging/access-log.d.ts.map +1 -1
  123. package/dist/mcp/activity.d.ts.map +1 -1
  124. package/dist/mcp/activity.js.map +1 -1
  125. package/dist/mcp/connection-api.d.ts.map +1 -1
  126. package/dist/mcp/connection-api.js +0 -1
  127. package/dist/mcp/connection-api.js.map +1 -1
  128. package/dist/mcp/index.d.ts +1 -0
  129. package/dist/mcp/index.d.ts.map +1 -1
  130. package/dist/mcp/index.js +1 -0
  131. package/dist/mcp/index.js.map +1 -1
  132. package/dist/mcp/read-client.d.ts +61 -1
  133. package/dist/mcp/read-client.d.ts.map +1 -1
  134. package/dist/mcp/read-client.js +397 -42
  135. package/dist/mcp/read-client.js.map +1 -1
  136. package/dist/mcp/resources.d.ts +37 -0
  137. package/dist/mcp/resources.d.ts.map +1 -0
  138. package/dist/mcp/resources.js +114 -0
  139. package/dist/mcp/resources.js.map +1 -0
  140. package/dist/mcp/search/index.d.ts.map +1 -1
  141. package/dist/mcp/search/index.js +108 -21
  142. package/dist/mcp/search/index.js.map +1 -1
  143. package/dist/mcp/server.d.ts.map +1 -1
  144. package/dist/mcp/server.js +27 -9
  145. package/dist/mcp/server.js.map +1 -1
  146. package/dist/mcp/session.d.ts +160 -0
  147. package/dist/mcp/session.d.ts.map +1 -0
  148. package/dist/mcp/session.js +243 -0
  149. package/dist/mcp/session.js.map +1 -0
  150. package/dist/mcp/tools.d.ts +29 -3
  151. package/dist/mcp/tools.d.ts.map +1 -1
  152. package/dist/mcp/tools.js +515 -48
  153. package/dist/mcp/tools.js.map +1 -1
  154. package/dist/mcp/types.d.ts.map +1 -1
  155. package/dist/payment/index.d.ts +2 -0
  156. package/dist/payment/index.d.ts.map +1 -0
  157. package/dist/payment/index.js +2 -0
  158. package/dist/payment/index.js.map +1 -0
  159. package/dist/payment/x402.d.ts +155 -0
  160. package/dist/payment/x402.d.ts.map +1 -0
  161. package/dist/payment/x402.js +402 -0
  162. package/dist/payment/x402.js.map +1 -0
  163. package/dist/policy/data-read.d.ts +18 -2
  164. package/dist/policy/data-read.d.ts.map +1 -1
  165. package/dist/policy/data-read.js +80 -49
  166. package/dist/policy/data-read.js.map +1 -1
  167. package/dist/policy/data-write.d.ts +69 -0
  168. package/dist/policy/data-write.d.ts.map +1 -0
  169. package/dist/policy/data-write.js +131 -0
  170. package/dist/policy/data-write.js.map +1 -0
  171. package/dist/policy/index.d.ts +3 -1
  172. package/dist/policy/index.d.ts.map +1 -1
  173. package/dist/policy/index.js +3 -1
  174. package/dist/policy/index.js.map +1 -1
  175. package/dist/policy/signed-artifacts.d.ts +17 -0
  176. package/dist/policy/signed-artifacts.d.ts.map +1 -0
  177. package/dist/policy/signed-artifacts.js +110 -0
  178. package/dist/policy/signed-artifacts.js.map +1 -0
  179. package/dist/ports/index.d.ts +159 -32
  180. package/dist/ports/index.d.ts.map +1 -1
  181. package/dist/ports/index.js +6 -5
  182. package/dist/ports/index.js.map +1 -1
  183. package/dist/schemas/server-config.d.ts +49 -4
  184. package/dist/schemas/server-config.d.ts.map +1 -1
  185. package/dist/schemas/server-config.js +95 -13
  186. package/dist/schemas/server-config.js.map +1 -1
  187. package/dist/signing/index.d.ts +2 -2
  188. package/dist/signing/index.d.ts.map +1 -1
  189. package/dist/signing/index.js +1 -1
  190. package/dist/signing/index.js.map +1 -1
  191. package/dist/signing/request-signer.d.ts +2 -0
  192. package/dist/signing/request-signer.d.ts.map +1 -1
  193. package/dist/signing/request-signer.js +1 -0
  194. package/dist/signing/request-signer.js.map +1 -1
  195. package/dist/signing/signer.d.ts +27 -25
  196. package/dist/signing/signer.d.ts.map +1 -1
  197. package/dist/signing/signer.js +27 -51
  198. package/dist/signing/signer.js.map +1 -1
  199. package/dist/storage/adapters/index.d.ts +1 -1
  200. package/dist/storage/adapters/index.d.ts.map +1 -1
  201. package/dist/storage/adapters/index.js +1 -1
  202. package/dist/storage/adapters/index.js.map +1 -1
  203. package/dist/storage/adapters/interface.d.ts +10 -0
  204. package/dist/storage/adapters/interface.d.ts.map +1 -1
  205. package/dist/storage/adapters/sdk.d.ts +11 -1
  206. package/dist/storage/adapters/sdk.d.ts.map +1 -1
  207. package/dist/storage/adapters/sdk.js +38 -3
  208. package/dist/storage/adapters/sdk.js.map +1 -1
  209. package/dist/storage/adapters/vana.d.ts +3 -0
  210. package/dist/storage/adapters/vana.d.ts.map +1 -1
  211. package/dist/storage/adapters/vana.js +95 -2
  212. package/dist/storage/adapters/vana.js.map +1 -1
  213. package/dist/storage/blocks/errors.d.ts.map +1 -1
  214. package/dist/storage/blocks/errors.js.map +1 -1
  215. package/dist/storage/blocks/index.d.ts +2 -0
  216. package/dist/storage/blocks/index.d.ts.map +1 -1
  217. package/dist/storage/blocks/index.js +2 -0
  218. package/dist/storage/blocks/index.js.map +1 -1
  219. package/dist/storage/blocks/select.d.ts +29 -0
  220. package/dist/storage/blocks/select.d.ts.map +1 -0
  221. package/dist/storage/blocks/select.js +120 -0
  222. package/dist/storage/blocks/select.js.map +1 -0
  223. package/dist/storage/blocks/types.d.ts +7 -0
  224. package/dist/storage/blocks/types.d.ts.map +1 -1
  225. package/dist/storage/index/manager.d.ts +30 -2
  226. package/dist/storage/index/manager.d.ts.map +1 -1
  227. package/dist/storage/index/schema.d.ts +1 -1
  228. package/dist/storage/index/schema.js +1 -1
  229. package/dist/storage/index/types.d.ts +6 -1
  230. package/dist/storage/index/types.d.ts.map +1 -1
  231. package/dist/sync/data-point-feed.d.ts +35 -0
  232. package/dist/sync/data-point-feed.d.ts.map +1 -0
  233. package/dist/sync/data-point-feed.js +122 -0
  234. package/dist/sync/data-point-feed.js.map +1 -0
  235. package/dist/sync/data-point-id.d.ts +7 -0
  236. package/dist/sync/data-point-id.d.ts.map +1 -0
  237. package/dist/sync/data-point-id.js +16 -0
  238. package/dist/sync/data-point-id.js.map +1 -0
  239. package/dist/sync/delete-data-port.d.ts +50 -0
  240. package/dist/sync/delete-data-port.d.ts.map +1 -0
  241. package/dist/sync/delete-data-port.js +244 -0
  242. package/dist/sync/delete-data-port.js.map +1 -0
  243. package/dist/sync/engine/sync-manager.d.ts +16 -4
  244. package/dist/sync/engine/sync-manager.d.ts.map +1 -1
  245. package/dist/sync/engine/sync-manager.js +93 -32
  246. package/dist/sync/engine/sync-manager.js.map +1 -1
  247. package/dist/sync/index.d.ts +7 -0
  248. package/dist/sync/index.d.ts.map +1 -1
  249. package/dist/sync/index.js +7 -0
  250. package/dist/sync/index.js.map +1 -1
  251. package/dist/sync/issues.d.ts.map +1 -1
  252. package/dist/sync/issues.js +21 -3
  253. package/dist/sync/issues.js.map +1 -1
  254. package/dist/sync/pending-blob-deletions.d.ts +29 -0
  255. package/dist/sync/pending-blob-deletions.d.ts.map +1 -0
  256. package/dist/sync/pending-blob-deletions.js +116 -0
  257. package/dist/sync/pending-blob-deletions.js.map +1 -0
  258. package/dist/sync/retry-memory.d.ts +33 -0
  259. package/dist/sync/retry-memory.d.ts.map +1 -0
  260. package/dist/sync/retry-memory.js +68 -0
  261. package/dist/sync/retry-memory.js.map +1 -0
  262. package/dist/sync/scope-deletions.d.ts +155 -0
  263. package/dist/sync/scope-deletions.d.ts.map +1 -0
  264. package/dist/sync/scope-deletions.js +225 -0
  265. package/dist/sync/scope-deletions.js.map +1 -0
  266. package/dist/sync/tombstone.d.ts +27 -0
  267. package/dist/sync/tombstone.d.ts.map +1 -0
  268. package/dist/sync/tombstone.js +28 -0
  269. package/dist/sync/tombstone.js.map +1 -0
  270. package/dist/sync/workers/delete.d.ts +152 -31
  271. package/dist/sync/workers/delete.d.ts.map +1 -1
  272. package/dist/sync/workers/delete.js +457 -55
  273. package/dist/sync/workers/delete.js.map +1 -1
  274. package/dist/sync/workers/download.d.ts +108 -27
  275. package/dist/sync/workers/download.d.ts.map +1 -1
  276. package/dist/sync/workers/download.js +321 -126
  277. package/dist/sync/workers/download.js.map +1 -1
  278. package/dist/sync/workers/upload.d.ts +65 -10
  279. package/dist/sync/workers/upload.d.ts.map +1 -1
  280. package/dist/sync/workers/upload.js +371 -42
  281. package/dist/sync/workers/upload.js.map +1 -1
  282. package/dist/test-utils/e2ee-fixtures.d.ts +94 -0
  283. package/dist/test-utils/e2ee-fixtures.d.ts.map +1 -0
  284. package/dist/test-utils/e2ee-fixtures.js +116 -0
  285. package/dist/test-utils/e2ee-fixtures.js.map +1 -0
  286. package/dist/test-utils/e2ee-gateway.d.ts +61 -0
  287. package/dist/test-utils/e2ee-gateway.d.ts.map +1 -0
  288. package/dist/test-utils/e2ee-gateway.js +248 -0
  289. package/dist/test-utils/e2ee-gateway.js.map +1 -0
  290. package/dist/test-utils/index.d.ts +3 -0
  291. package/dist/test-utils/index.d.ts.map +1 -1
  292. package/dist/test-utils/index.js +3 -0
  293. package/dist/test-utils/index.js.map +1 -1
  294. package/dist/test-utils/memory-storage.d.ts +12 -0
  295. package/dist/test-utils/memory-storage.d.ts.map +1 -0
  296. package/dist/test-utils/memory-storage.js +146 -0
  297. package/dist/test-utils/memory-storage.js.map +1 -0
  298. package/dist/test-utils/wallet.d.ts +6 -0
  299. package/dist/test-utils/wallet.d.ts.map +1 -1
  300. package/dist/test-utils/wallet.js +46 -0
  301. package/dist/test-utils/wallet.js.map +1 -1
  302. package/dist/write/attribution.d.ts +185 -0
  303. package/dist/write/attribution.d.ts.map +1 -0
  304. package/dist/write/attribution.js +450 -0
  305. package/dist/write/attribution.js.map +1 -0
  306. package/dist/write/authorize.d.ts +77 -0
  307. package/dist/write/authorize.d.ts.map +1 -0
  308. package/dist/write/authorize.js +109 -0
  309. package/dist/write/authorize.js.map +1 -0
  310. package/dist/write/index.d.ts +5 -0
  311. package/dist/write/index.d.ts.map +1 -0
  312. package/dist/write/index.js +5 -0
  313. package/dist/write/index.js.map +1 -0
  314. package/dist/write/route.d.ts +61 -0
  315. package/dist/write/route.d.ts.map +1 -0
  316. package/dist/write/route.js +132 -0
  317. package/dist/write/route.js.map +1 -0
  318. package/dist/write/session.d.ts +96 -0
  319. package/dist/write/session.d.ts.map +1 -0
  320. package/dist/write/session.js +136 -0
  321. package/dist/write/session.js.map +1 -0
  322. package/package.json +19 -3
@@ -0,0 +1,146 @@
1
+ /**
2
+ * In-memory DataStoragePort for unit tests: envelopes in a Map, index rows
3
+ * in an array, versions assigned max+1 per scope like the real index.
4
+ */
5
+ export function createMemoryDataStorage() {
6
+ const entries = [];
7
+ const envelopes = new Map();
8
+ let nextId = 1;
9
+ const key = (scope, collectedAt) => `${scope}\n${collectedAt}`;
10
+ const byPath = (path) => entries.find((entry) => entry.path === path);
11
+ const forScope = (scope) => entries
12
+ .filter((entry) => entry.scope === scope)
13
+ .sort((a, b) => b.collectedAt.localeCompare(a.collectedAt) || b.version - a.version);
14
+ const remove = (predicate) => {
15
+ let removed = 0;
16
+ for (let index = entries.length - 1; index >= 0; index -= 1) {
17
+ const entry = entries[index];
18
+ if (!predicate(entry))
19
+ continue;
20
+ entries.splice(index, 1);
21
+ envelopes.delete(key(entry.scope, entry.collectedAt));
22
+ removed += 1;
23
+ }
24
+ return removed;
25
+ };
26
+ return {
27
+ kind: "custom",
28
+ entries,
29
+ listScopes({ scopePrefix, limit = 20, offset = 0 }) {
30
+ const summaries = new Map();
31
+ for (const entry of entries) {
32
+ if (scopePrefix && !entry.scope.startsWith(scopePrefix))
33
+ continue;
34
+ const existing = summaries.get(entry.scope);
35
+ summaries.set(entry.scope, {
36
+ scope: entry.scope,
37
+ latestCollectedAt: existing &&
38
+ existing.latestCollectedAt.localeCompare(entry.collectedAt) > 0
39
+ ? existing.latestCollectedAt
40
+ : entry.collectedAt,
41
+ versionCount: (existing?.versionCount ?? 0) + 1,
42
+ });
43
+ }
44
+ const scopes = [...summaries.values()].sort((a, b) => a.scope.localeCompare(b.scope));
45
+ return {
46
+ scopes: scopes.slice(offset, offset + limit),
47
+ total: scopes.length,
48
+ };
49
+ },
50
+ listVersions(scope, { limit = 20, offset = 0 }) {
51
+ return forScope(scope).slice(offset, offset + limit);
52
+ },
53
+ countVersions(scope) {
54
+ return forScope(scope).length;
55
+ },
56
+ findEntry({ scope, fileId, at }) {
57
+ if (fileId)
58
+ return entries.find((entry) => entry.fileId === fileId);
59
+ const scoped = forScope(scope);
60
+ if (at)
61
+ return scoped.find((entry) => entry.collectedAt === at);
62
+ return scoped[0];
63
+ },
64
+ findByFileId(fileId) {
65
+ return entries.find((entry) => entry.fileId === fileId);
66
+ },
67
+ findByDataPointId(dataPointId) {
68
+ return entries.find((entry) => entry.dataPointId === dataPointId);
69
+ },
70
+ findUnsynced(options) {
71
+ const unsynced = entries.filter((entry) => entry.dataPointId === null);
72
+ return options?.limit ? unsynced.slice(0, options.limit) : unsynced;
73
+ },
74
+ async readEnvelope(scope, collectedAt) {
75
+ const envelope = envelopes.get(key(scope, collectedAt));
76
+ if (!envelope)
77
+ throw new Error(`missing envelope ${scope}@${collectedAt}`);
78
+ return envelope;
79
+ },
80
+ async writeEnvelope(envelope) {
81
+ envelopes.set(key(envelope.scope, envelope.collectedAt), envelope);
82
+ const path = `${envelope.scope}/${envelope.collectedAt}.json`;
83
+ return {
84
+ path,
85
+ relativePath: path,
86
+ sizeBytes: JSON.stringify(envelope).length,
87
+ };
88
+ },
89
+ insertEntry(entry) {
90
+ const version = entry.version ??
91
+ forScope(entry.scope).reduce((max, row) => Math.max(max, row.version), 0) + 1;
92
+ const indexed = {
93
+ ...entry,
94
+ id: nextId,
95
+ schemaId: entry.schemaId ?? null,
96
+ createdAt: new Date(0).toISOString(),
97
+ version,
98
+ dataPointId: entry.dataPointId ?? null,
99
+ };
100
+ nextId += 1;
101
+ entries.push(indexed);
102
+ return indexed;
103
+ },
104
+ updateFileId(path, fileId) {
105
+ const entry = byPath(path);
106
+ if (!entry)
107
+ return false;
108
+ entry.fileId = fileId;
109
+ return true;
110
+ },
111
+ findLatestVersionByScope(scope) {
112
+ return forScope(scope).reduce((max, row) => Math.max(max, row.version), 0);
113
+ },
114
+ updateDataPointId(path, dataPointId) {
115
+ const entry = byPath(path);
116
+ if (!entry)
117
+ return false;
118
+ entry.dataPointId = dataPointId;
119
+ return true;
120
+ },
121
+ updateEntryVersion(path, version) {
122
+ const entry = byPath(path);
123
+ if (!entry)
124
+ return false;
125
+ entry.version = version;
126
+ return true;
127
+ },
128
+ async deleteScope(scope) {
129
+ return remove((entry) => entry.scope === scope);
130
+ },
131
+ async deleteByFileId(fileId) {
132
+ return remove((entry) => entry.fileId === fileId) > 0;
133
+ },
134
+ async deleteVersion(scope, collectedAt) {
135
+ return (remove((entry) => entry.scope === scope && entry.collectedAt === collectedAt) > 0);
136
+ },
137
+ dropUnsyncedEntry(path) {
138
+ const index = entries.findIndex((entry) => entry.path === path && entry.dataPointId === null);
139
+ if (index === -1)
140
+ return false;
141
+ entries.splice(index, 1);
142
+ return true;
143
+ },
144
+ };
145
+ }
146
+ //# sourceMappingURL=memory-storage.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"memory-storage.js","sourceRoot":"","sources":["../../src/test-utils/memory-storage.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAWH,MAAM,UAAU,uBAAuB;IACrC,MAAM,OAAO,GAAiB,EAAE,CAAC;IACjC,MAAM,SAAS,GAAG,IAAI,GAAG,EAA4B,CAAC;IACtD,IAAI,MAAM,GAAG,CAAC,CAAC;IAEf,MAAM,GAAG,GAAG,CAAC,KAAa,EAAE,WAAmB,EAAE,EAAE,CACjD,GAAG,KAAK,KAAK,WAAW,EAAE,CAAC;IAC7B,MAAM,MAAM,GAAG,CAAC,IAAY,EAAE,EAAE,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,IAAI,KAAK,IAAI,CAAC,CAAC;IAC9E,MAAM,QAAQ,GAAG,CAAC,KAAa,EAAE,EAAE,CACjC,OAAO;SAC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AC,CAAC;gBAAE,OAAO,KAAK,CAAC;YAC/B,OAAO,CAAC,MAAM,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC;YACzB,OAAO,IAAI,CAAC;QACd,CAAC;KACF,CAAC;AACJ,CAAC"}
@@ -37,5 +37,11 @@ export declare function buildWeb3SignedHeader(params: {
37
37
  iat?: number;
38
38
  exp?: number;
39
39
  grantId?: string;
40
+ /**
41
+ * Optional `nonce` claim. The SDK's builder has no parameter for it yet,
42
+ * so a proof that carries one is assembled here (same wire rules: JSON
43
+ * with sorted keys, base64url, EIP-191 over the encoded payload).
44
+ */
45
+ nonce?: unknown;
40
46
  }): Promise<string>;
41
47
  //# sourceMappingURL=wallet.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"wallet.d.ts","sourceRoot":"","sources":["../../src/test-utils/wallet.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAMH,MAAM,WAAW,UAAU;IACzB,OAAO,EAAE,KAAK,MAAM,EAAE,CAAC;IACvB,UAAU,EAAE,KAAK,MAAM,EAAE,CAAC;IAC1B,WAAW,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,KAAK,MAAM,EAAE,CAAC,CAAC;IACrD,aAAa,CAAC,MAAM,EAAE;QACpB,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;QAChC,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,KAAK,CAAC;YAAE,IAAI,EAAE,MAAM,CAAC;YAAC,IAAI,EAAE,MAAM,CAAA;SAAE,CAAC,CAAC,CAAC;QAC7D,WAAW,EAAE,MAAM,CAAC;QACpB,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;KAClC,GAAG,OAAO,CAAC,KAAK,MAAM,EAAE,CAAC,CAAC;CAC5B;AAED;;;GAGG;AACH,wBAAgB,gBAAgB,CAAC,IAAI,GAAE,MAAU,GAAG,UAAU,CA0B7D;AAED;;;;;GAKG;AACH,wBAAsB,qB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Z,MAAM,EAAE,MAAM,CAAC;IACf,GAAG,EAAE,MAAM,CAAC;IACZ,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,IAAI,CAAC,EAAE,UAAU,CAAC;IAClB,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB;;;;OAIG;IACH,KAAK,CAAC,EAAE,OAAO,CAAC;CACjB,GAAG,OAAO,CAAC,MAAM,CAAC,CAelB"}
@@ -37,6 +37,9 @@ export function createTestWallet(seed = 0) {
37
37
  * The payload is JSON with sorted keys, signed via EIP-191.
38
38
  */
39
39
  export async function buildWeb3SignedHeader(params) {
40
+ if (params.nonce !== undefined) {
41
+ return buildWeb3SignedHeaderWithClaims(params, { nonce: params.nonce });
42
+ }
40
43
  return sdkBuildWeb3SignedHeader({
41
44
  signMessage: (message) => params.wallet.signMessage(message),
42
45
  aud: params.aud,
@@ -49,4 +52,47 @@ export async function buildWeb3SignedHeader(params) {
49
52
  grantId: params.grantId,
50
53
  });
51
54
  }
55
+ /** Base64url without padding, matching the SDK's encoder. */
56
+ function base64UrlEncode(bytes) {
57
+ let binary = "";
58
+ for (const byte of bytes)
59
+ binary += String.fromCodePoint(byte);
60
+ return btoa(binary)
61
+ .replace(/\+/g, "-")
62
+ .replace(/\//g, "_")
63
+ .replace(/=+$/, "");
64
+ }
65
+ /**
66
+ * Sign a Web3Signed payload with extra claims the SDK builder cannot emit.
67
+ * Same serialization as the SDK: sorted keys, compact JSON, base64url,
68
+ * EIP-191 over the encoded string.
69
+ */
70
+ async function buildWeb3SignedHeaderWithClaims(params, extra) {
71
+ const base = await sdkBuildWeb3SignedHeader({
72
+ signMessage: (message) => params.wallet.signMessage(message),
73
+ aud: params.aud,
74
+ method: params.method,
75
+ uri: params.uri,
76
+ bodyHash: params.bodyHash,
77
+ body: params.body,
78
+ iat: params.iat,
79
+ exp: params.exp,
80
+ grantId: params.grantId,
81
+ });
82
+ const payloadBase64 = base.slice("Web3Signed ".length).split(".")[0] ?? "";
83
+ const padded = payloadBase64
84
+ .replace(/-/g, "+")
85
+ .replace(/_/g, "/")
86
+ .padEnd(payloadBase64.length + ((4 - (payloadBase64.length % 4)) % 4), "=");
87
+ const decoded = new TextDecoder().decode(Uint8Array.from(atob(padded), (char) => char.charCodeAt(0)));
88
+ const claims = { ...JSON.parse(decoded), ...extra };
89
+ const sorted = Object.keys(claims)
90
+ .sort()
91
+ .reduce((acc, key) => {
92
+ acc[key] = claims[key];
93
+ return acc;
94
+ }, {});
95
+ const encoded = base64UrlEncode(new TextEncoder().encode(JSON.stringify(sorted)));
96
+ return `Web3Signed ${encoded}.${await params.wallet.signMessage(encoded)}`;
97
+ }
52
98
  //# sourceMappingURL=wallet.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"wallet.js","sourceRoot":"","sources":["../../src/test-utils/wallet.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,mBAAmB,EAAE,MAAM,eAAe,CAAC;AAEpD,OAAO,EAAE,qBAAqB,IAAI,wBAAwB,EAAE,MAAM,gCAAgC,CAAC;AAcnG;;;GAGG;AACH,MAAM,UAAU,gBAAgB,CAAC,OAAe,CAAC;IAC/C,oDAAoD;IACpD,4CAA4C;IAC5C,MAAM,QAAQ,GAAG,CAAC,IAAI,GAAG,CAAC,CAAC,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC,QAAQ,CAAC,EAAE,EAAE,GAAG,CAAC,CAAC;IAC3D,MAAM,UAAU,GAAG,KAAK,QAAQ,EAAmB,CAAC;IACpD,MAAM,OAAO,GAAsB,mBAAmB,CAAC,UAAU,CAAC,CAAC;IAEnE,OAAO;QACL,OAAO,EAAE,OAAO,CAAC,OAAO;QACxB,UAAU;QACV,KAAK,CAAC,WAAW,CAAC,OAAe;YAC/B,OAAO,OAAO,CAAC,WAAW,CAAC,EAAE,OAAO,EAAE,CAAC,CAAC;QAC1C,CAAC;QACD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AAC,CAAC;IAC9E,MAAM,OAAO,GAAG,IAAI,WAAW,EAAE,CAAC,MAAM,CACtC,UAAU,CAAC,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,EAAE,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,CAC5D,CAAC;IACF,MAAM,MAAM,GAAG,EAAE,GAAG,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,EAAE,GAAG,KAAK,EAGhD,CAAC;IACF,MAAM,MAAM,GAAG,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC;SAC/B,IAAI,EAAE;SACN,MAAM,CAA0B,CAAC,GAAG,EAAE,GAAG,EAAE,EAAE;QAC5C,GAAG,CAAC,GAAG,CAAC,GAAG,MAAM,CAAC,GAAG,CAAC,CAAC;QACvB,OAAO,GAAG,CAAC;IACb,CAAC,EAAE,EAAE,CAAC,CAAC;IACT,MAAM,OAAO,GAAG,eAAe,CAC7B,IAAI,WAAW,EAAE,CAAC,MAAM,CAAC,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC,CACjD,CAAC;IACF,OAAO,cAAc,OAAO,IAAI,MAAM,MAAM,CAAC,MAAM,CAAC,WAAW,CAAC,OAAO,CAAC,EAAE,CAAC;AAC7E,CAAC"}
@@ -0,0 +1,185 @@
1
+ /**
2
+ * Builder attribution for delegated writes.
3
+ *
4
+ * The write-session token authorizes a write; it does not PROVE who authored
5
+ * the payload (a bearer token is not a signature). For cryptographic
6
+ * attribution the builder also signs the payload: a Web3Signed proof over the
7
+ * exact write request (aud / method / uri / bodyHash / iat / exp), carried in
8
+ * the `X-Vana-Write-Signature` header and signed by the builder key proven at
9
+ * handshake. The PS verifies the proof recovers to the session's builder and
10
+ * that its bodyHash commits to the received bytes, then stores the proof and
11
+ * the builder identity WITH the record — inside the envelope's `data` under
12
+ * the reserved `$writtenBy` key (same in-`data` marker idiom as `$binary`),
13
+ * so attribution travels through the unchanged encrypt / upload / register
14
+ * path and back out on read. The on-chain shape is untouched.
15
+ *
16
+ * The proof binds the write to its context, not just its bytes: the signed
17
+ * claims carry the request uri (path AND query, see canonicalSignedUri; the
18
+ * path's last segment is the scope on the ingest route), the method, the
19
+ * audience (this server's origin) and the session's grantId, which the PS
20
+ * requires to match the session at ingest. A stored `$writtenBy` therefore
21
+ * cannot be lifted onto another scope's record or relabelled with a
22
+ * different grant and still verify. A proof may also carry an optional
23
+ * `nonce` claim, which is what makes it unique: without one, two identical
24
+ * requests signed in the same second are byte-identical and the replay guard
25
+ * refuses the second.
26
+ *
27
+ * What the builder signs is the STORED representation, not the wire body:
28
+ * the compact JSON of the envelope `data` record the PS will write (minus
29
+ * `$writtenBy`). A third party holding the envelope can therefore verify
30
+ * authorship from the envelope ALONE (verifyStoredWriterAttribution): recover
31
+ * the signer over the stored proof's base64url payload (EIP-191), check the
32
+ * signed claims against the envelope's scope and stored grantId, and hash
33
+ * JSON.stringify(data minus the server-stamped keys `$writtenBy` and
34
+ * `$lineage`) against the signed bodyHash.
35
+ * - JSON writes: the body IS the stored record, so the builder signs the
36
+ * body bytes, which must be compact JSON (what JSON.stringify emits: no
37
+ * insignificant whitespace, keys in the order given). JSON.parse /
38
+ * JSON.stringify round-trips that byte-for-byte; a body that does not
39
+ * round-trip is rejected at write time (WRITE_BODY_NOT_CANONICAL) instead
40
+ * of being stored with an attribution nobody can check.
41
+ * - Binary writes: the stored record is the `$binary` envelope data (media
42
+ * type, filename, caller metadata, size, content hash, base64 content),
43
+ * so the builder signs its compact JSON (binaryWriteSignedBytes). That
44
+ * binds the caller-controlled representation headers (Content-Type,
45
+ * X-Filename / Content-Disposition, X-Vana-Metadata) to the signature and
46
+ * makes a JSON-vs-binary switch of the same bytes fail verification.
47
+ */
48
+ import { type Web3SignedPayload } from "@opendatalabs/vana-sdk/browser";
49
+ import type { WriteProofReplayStore } from "./session.js";
50
+ /** Header carrying the builder's signed-payload proof on a session write. */
51
+ export declare const WRITE_SIGNATURE_HEADER = "x-vana-write-signature";
52
+ /**
53
+ * Upper bound on the optional `nonce` claim (a uuid or a short random
54
+ * string is the intended shape). Bounded so a proof cannot smuggle bulk
55
+ * data into the replay store's keys.
56
+ */
57
+ export declare const MAX_PROOF_NONCE_LENGTH = 128;
58
+ /**
59
+ * The uri a proof must commit to for a request: the path, plus the canonical
60
+ * query when the request carries one. A request with no query string signs
61
+ * the bare path exactly as before.
62
+ */
63
+ export declare function canonicalSignedUri(pathname: string, search: string): string;
64
+ /** The same canonical form applied to a signed `uri` claim. */
65
+ export declare function canonicalizeSignedUri(uri: string): string;
66
+ /**
67
+ * Reserved key inside the envelope's `data` record for builder attribution.
68
+ * Mirrors the `$binary` marker convention (contracts/binary.ts).
69
+ */
70
+ export declare const WRITER_ATTRIBUTION_KEY: "$writtenBy";
71
+ export interface WriterAttribution {
72
+ /** The builder address the proof recovered to. */
73
+ builder: `0x${string}`;
74
+ /** The write-grant the record was written under. */
75
+ grantId: string;
76
+ /**
77
+ * The builder's compact Web3Signed proof (`{base64url(payload)}.{sig}`,
78
+ * scheme prefix stripped). Verifiable offline: recover the EIP-191 signer
79
+ * over the base64url payload string; the decoded payload's `bodyHash`
80
+ * commits to the written bytes.
81
+ */
82
+ signature: string;
83
+ /** `bodyHash` claim from the proof (sha-256 of the request body bytes). */
84
+ bodyHash: string;
85
+ /** ISO timestamp the PS accepted the write. */
86
+ writtenAt: string;
87
+ }
88
+ export interface VerifyWriterAttributionInput {
89
+ request: Request;
90
+ /** The builder address bound to the write session at handshake. */
91
+ builderAddress: `0x${string}`;
92
+ /** The grant the session (and therefore this write) is bound to. */
93
+ grantId: string;
94
+ serverOrigin: string | (() => string);
95
+ now?: () => Date;
96
+ /**
97
+ * Replay guard for the per-write proof. When supplied, a proof is consumed
98
+ * on successful verification (keyed by a digest of the exact header,
99
+ * remembered until the proof's own expiry) and a second write carrying the
100
+ * same proof is rejected: holding the session bearer plus one captured
101
+ * signed request must not allow re-storing it until the proof expires.
102
+ */
103
+ replayStore?: WriteProofReplayStore;
104
+ }
105
+ /** verifyWriterAttribution's result: the record to store plus a rollback. */
106
+ export interface VerifiedWriterAttribution extends WriterAttribution {
107
+ /**
108
+ * Present when a replay store consumed the proof. Callers whose write then
109
+ * FAILS before the record is committed should call it so the builder can
110
+ * retry with the same still-valid proof (a retry after success is a replay).
111
+ */
112
+ releaseProof?: () => Promise<void>;
113
+ }
114
+ export interface BinaryWriteSignedBytesInput {
115
+ /** The raw body bytes the write will send. */
116
+ bytes: Uint8Array;
117
+ /** The Content-Type header the write will send (parameters are ignored). */
118
+ contentType: string;
119
+ /** The X-Filename header value the write will send, if any. */
120
+ filename?: string;
121
+ /** The exact X-Vana-Metadata header value the write will send, if any. */
122
+ metadataHeader?: string;
123
+ }
124
+ /**
125
+ * The bytes a builder signs (as the Web3Signed body) for a BINARY session
126
+ * write: the compact JSON of the `$binary` record the PS stores for these
127
+ * headers and bytes. Mirrors ingest exactly (same media-type normalization,
128
+ * metadata parsing and envelope builder), so the signature covers the stored
129
+ * representation and verifyStoredWriterAttribution can re-derive it.
130
+ */
131
+ export declare function binaryWriteSignedBytes(input: BinaryWriteSignedBytesInput): Promise<Uint8Array>;
132
+ /**
133
+ * Verify the `X-Vana-Write-Signature` proof on a session write and produce
134
+ * the attribution record to store with the data. Throws ProtocolError(401)
135
+ * when the proof is missing, malformed, expired, fails EIP-191 recovery /
136
+ * bodyHash binding (the hash covers the stored representation, see
137
+ * signedBytesFor), recovers to a different key than the session builder, or
138
+ * does not carry the session's grantId as a signed claim.
139
+ */
140
+ export declare function verifyWriterAttribution(input: VerifyWriterAttributionInput): Promise<VerifiedWriterAttribution>;
141
+ /**
142
+ * Stamp attribution into an envelope `data` record. The reserved key must not
143
+ * appear in the caller's payload — a builder must not be able to forge (or
144
+ * shadow) its own attribution.
145
+ */
146
+ export declare function stampWriterAttribution(data: Record<string, unknown>, attribution: WriterAttribution): Record<string, unknown>;
147
+ export declare function hasReservedWriterKey(data: Record<string, unknown>): boolean;
148
+ export declare class WriterAttributionVerificationError extends Error {
149
+ readonly reason: "ATTRIBUTION_MISSING" | "BODY_HASH_MISMATCH" | "PROOF_INVALID" | "SIGNER_MISMATCH" | "SCOPE_MISMATCH" | "GRANT_MISMATCH" | "AUDIENCE_MISMATCH" | "LINEAGE_MISMATCH";
150
+ constructor(reason: "ATTRIBUTION_MISSING" | "BODY_HASH_MISMATCH" | "PROOF_INVALID" | "SIGNER_MISMATCH" | "SCOPE_MISMATCH" | "GRANT_MISMATCH" | "AUDIENCE_MISMATCH" | "LINEAGE_MISMATCH", message: string);
151
+ }
152
+ export interface StoredWriterAttributionVerification {
153
+ /** Signer recovered from the stored proof (equals the stored builder). */
154
+ builder: `0x${string}`;
155
+ grantId: string;
156
+ /** Hash re-derived from the stored data; equals the proof's bodyHash. */
157
+ bodyHash: string;
158
+ /** The signed claims (aud / method / uri / bodyHash / iat / exp). */
159
+ payload: Web3SignedPayload;
160
+ }
161
+ export interface VerifyStoredWriterAttributionOptions {
162
+ /**
163
+ * When known, the origin of the Personal Server the record was written to;
164
+ * the proof's signed audience must match it. Omit for records whose server
165
+ * is not known to the verifier.
166
+ */
167
+ expectedOrigin?: string;
168
+ }
169
+ /**
170
+ * Verify builder attribution from a stored envelope alone (no request, no
171
+ * server state, no expiry check: the proof is evidence of who wrote the
172
+ * record at the time, not a live credential). Checks, in order: the envelope
173
+ * carries an attribution; the stored representation (compact JSON of the
174
+ * data minus the server-stamped `$writtenBy` and `$lineage` keys, for JSON
175
+ * and `$binary` records alike) re-hashes
176
+ * to the signed bodyHash; the proof parses and recovers to the attributed
177
+ * builder; and the signed claims bind the proof to THIS record: a POST whose
178
+ * path names the envelope's scope, the stored grantId, and (when given) the
179
+ * server origin. Throws WriterAttributionVerificationError with the reason.
180
+ */
181
+ export declare function verifyStoredWriterAttribution(envelope: {
182
+ scope: string;
183
+ data: Record<string, unknown>;
184
+ }, options?: VerifyStoredWriterAttributionOptions): Promise<StoredWriterAttributionVerification>;
185
+ //# sourceMappingURL=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