@antseed/cli 0.1.179 → 0.1.181

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 (678) hide show
  1. package/README.md +5 -3
  2. package/dist/buyer-identities/store.d.ts +39 -2
  3. package/dist/buyer-identities/store.d.ts.map +1 -1
  4. package/dist/buyer-identities/store.js +99 -10
  5. package/dist/buyer-identities/store.js.map +1 -1
  6. package/dist/cli/commands/apps/index.js +8 -8
  7. package/dist/cli/commands/buyer/identity.d.ts +3 -1
  8. package/dist/cli/commands/buyer/identity.d.ts.map +1 -1
  9. package/dist/cli/commands/buyer/identity.js +55 -8
  10. package/dist/cli/commands/buyer/identity.js.map +1 -1
  11. package/dist/cli/commands/buyer/identity.test.d.ts +2 -0
  12. package/dist/cli/commands/buyer/identity.test.d.ts.map +1 -0
  13. package/dist/cli/commands/buyer/identity.test.js +168 -0
  14. package/dist/cli/commands/buyer/identity.test.js.map +1 -0
  15. package/dist/cli/commands/buyer/set-authorized-wallet.d.ts +10 -0
  16. package/dist/cli/commands/buyer/set-authorized-wallet.d.ts.map +1 -1
  17. package/dist/cli/commands/buyer/set-authorized-wallet.js +26 -4
  18. package/dist/cli/commands/buyer/set-authorized-wallet.js.map +1 -1
  19. package/dist/cli/commands/buyer/set-authorized-wallet.test.js +37 -2
  20. package/dist/cli/commands/buyer/set-authorized-wallet.test.js.map +1 -1
  21. package/dist/cli/commands/buyer/start.d.ts +15 -0
  22. package/dist/cli/commands/buyer/start.d.ts.map +1 -1
  23. package/dist/cli/commands/buyer/start.js +158 -49
  24. package/dist/cli/commands/buyer/start.js.map +1 -1
  25. package/dist/cli/commands/buyer/start.test.js +16 -1
  26. package/dist/cli/commands/buyer/start.test.js.map +1 -1
  27. package/dist/cli/commands/chat.d.ts +3 -0
  28. package/dist/cli/commands/chat.d.ts.map +1 -0
  29. package/dist/cli/commands/chat.js +189 -0
  30. package/dist/cli/commands/chat.js.map +1 -0
  31. package/dist/cli/commands/gateway/activity.d.ts +15 -0
  32. package/dist/cli/commands/gateway/activity.d.ts.map +1 -0
  33. package/dist/cli/commands/gateway/activity.js +233 -0
  34. package/dist/cli/commands/gateway/activity.js.map +1 -0
  35. package/dist/cli/commands/gateway/admin-token.d.ts +3 -0
  36. package/dist/cli/commands/gateway/admin-token.d.ts.map +1 -0
  37. package/dist/cli/commands/gateway/admin-token.js +90 -0
  38. package/dist/cli/commands/gateway/admin-token.js.map +1 -0
  39. package/dist/cli/commands/gateway/console-link.d.ts +20 -0
  40. package/dist/cli/commands/gateway/console-link.d.ts.map +1 -0
  41. package/dist/cli/commands/gateway/console-link.js +92 -0
  42. package/dist/cli/commands/gateway/console-link.js.map +1 -0
  43. package/dist/cli/commands/gateway/gateway-commands.test.d.ts +2 -0
  44. package/dist/cli/commands/gateway/gateway-commands.test.d.ts.map +1 -0
  45. package/dist/cli/commands/gateway/gateway-commands.test.js +230 -0
  46. package/dist/cli/commands/gateway/gateway-commands.test.js.map +1 -0
  47. package/dist/cli/commands/gateway/gateway-console-commands.test.d.ts +2 -0
  48. package/dist/cli/commands/gateway/gateway-console-commands.test.d.ts.map +1 -0
  49. package/dist/cli/commands/gateway/gateway-console-commands.test.js +373 -0
  50. package/dist/cli/commands/gateway/gateway-console-commands.test.js.map +1 -0
  51. package/dist/cli/commands/gateway/index.d.ts +8 -0
  52. package/dist/cli/commands/gateway/index.d.ts.map +1 -1
  53. package/dist/cli/commands/gateway/index.js +93 -14
  54. package/dist/cli/commands/gateway/index.js.map +1 -1
  55. package/dist/cli/commands/gateway/key.d.ts +4 -0
  56. package/dist/cli/commands/gateway/key.d.ts.map +1 -1
  57. package/dist/cli/commands/gateway/key.js +297 -182
  58. package/dist/cli/commands/gateway/key.js.map +1 -1
  59. package/dist/cli/commands/gateway/member.d.ts +3 -0
  60. package/dist/cli/commands/gateway/member.d.ts.map +1 -0
  61. package/dist/cli/commands/gateway/member.js +302 -0
  62. package/dist/cli/commands/gateway/member.js.map +1 -0
  63. package/dist/cli/commands/gateway/migrate.d.ts +18 -0
  64. package/dist/cli/commands/gateway/migrate.d.ts.map +1 -0
  65. package/dist/cli/commands/gateway/migrate.js +158 -0
  66. package/dist/cli/commands/gateway/migrate.js.map +1 -0
  67. package/dist/cli/commands/gateway/operator.d.ts +11 -0
  68. package/dist/cli/commands/gateway/operator.d.ts.map +1 -0
  69. package/dist/cli/commands/gateway/operator.js +199 -0
  70. package/dist/cli/commands/gateway/operator.js.map +1 -0
  71. package/dist/cli/commands/gateway/operator.test.d.ts +2 -0
  72. package/dist/cli/commands/gateway/operator.test.d.ts.map +1 -0
  73. package/dist/cli/commands/gateway/operator.test.js +151 -0
  74. package/dist/cli/commands/gateway/operator.test.js.map +1 -0
  75. package/dist/cli/commands/gateway/peer-list.d.ts +3 -0
  76. package/dist/cli/commands/gateway/peer-list.d.ts.map +1 -0
  77. package/dist/cli/commands/gateway/peer-list.js +107 -0
  78. package/dist/cli/commands/gateway/peer-list.js.map +1 -0
  79. package/dist/cli/commands/gateway/policy-options.d.ts +23 -0
  80. package/dist/cli/commands/gateway/policy-options.d.ts.map +1 -0
  81. package/dist/cli/commands/gateway/policy-options.js +156 -0
  82. package/dist/cli/commands/gateway/policy-options.js.map +1 -0
  83. package/dist/cli/commands/gateway/preset.d.ts +3 -0
  84. package/dist/cli/commands/gateway/preset.d.ts.map +1 -0
  85. package/dist/cli/commands/gateway/preset.js +181 -0
  86. package/dist/cli/commands/gateway/preset.js.map +1 -0
  87. package/dist/cli/commands/gateway/routing.d.ts +3 -0
  88. package/dist/cli/commands/gateway/routing.d.ts.map +1 -0
  89. package/dist/cli/commands/gateway/routing.js +110 -0
  90. package/dist/cli/commands/gateway/routing.js.map +1 -0
  91. package/dist/cli/commands/gateway/settings.d.ts +4 -0
  92. package/dist/cli/commands/gateway/settings.d.ts.map +1 -0
  93. package/dist/cli/commands/gateway/settings.js +314 -0
  94. package/dist/cli/commands/gateway/settings.js.map +1 -0
  95. package/dist/cli/commands/gateway/shared.d.ts +55 -6
  96. package/dist/cli/commands/gateway/shared.d.ts.map +1 -1
  97. package/dist/cli/commands/gateway/shared.js +206 -26
  98. package/dist/cli/commands/gateway/shared.js.map +1 -1
  99. package/dist/cli/commands/gateway/workspace.d.ts +3 -0
  100. package/dist/cli/commands/gateway/workspace.d.ts.map +1 -0
  101. package/dist/cli/commands/gateway/workspace.js +250 -0
  102. package/dist/cli/commands/gateway/workspace.js.map +1 -0
  103. package/dist/cli/commands/network/bootstrap.js +1 -1
  104. package/dist/cli/commands/seller/setup.js +1 -1
  105. package/dist/cli/commands/seller/start.d.ts.map +1 -1
  106. package/dist/cli/commands/seller/start.js +1 -2
  107. package/dist/cli/commands/seller/start.js.map +1 -1
  108. package/dist/cli/commands/system-proxy/index.js +1 -1
  109. package/dist/cli/commands/tunnel/start.d.ts.map +1 -1
  110. package/dist/cli/commands/tunnel/start.js +23 -5
  111. package/dist/cli/commands/tunnel/start.js.map +1 -1
  112. package/dist/cli/commands/wrapped-tools.js +8 -8
  113. package/dist/cli/commands/wrapped-tools.test.js +5 -5
  114. package/dist/cli/index.js +12 -44
  115. package/dist/cli/index.js.map +1 -1
  116. package/dist/cli/program.d.ts +4 -0
  117. package/dist/cli/program.d.ts.map +1 -0
  118. package/dist/cli/program.js +49 -0
  119. package/dist/cli/program.js.map +1 -0
  120. package/dist/cli/program.test.d.ts +2 -0
  121. package/dist/cli/program.test.d.ts.map +1 -0
  122. package/dist/cli/program.test.js +38 -0
  123. package/dist/cli/program.test.js.map +1 -0
  124. package/dist/cli/prompt-hidden.d.ts +3 -0
  125. package/dist/cli/prompt-hidden.d.ts.map +1 -0
  126. package/dist/cli/prompt-hidden.js +38 -0
  127. package/dist/cli/prompt-hidden.js.map +1 -0
  128. package/dist/cli/wallet-passphrase.d.ts +48 -0
  129. package/dist/cli/wallet-passphrase.d.ts.map +1 -0
  130. package/dist/cli/wallet-passphrase.js +119 -0
  131. package/dist/cli/wallet-passphrase.js.map +1 -0
  132. package/dist/cli/wallet-passphrase.test.d.ts +2 -0
  133. package/dist/cli/wallet-passphrase.test.d.ts.map +1 -0
  134. package/dist/cli/wallet-passphrase.test.js +79 -0
  135. package/dist/cli/wallet-passphrase.test.js.map +1 -0
  136. package/dist/config/defaults.d.ts.map +1 -1
  137. package/dist/config/defaults.js +0 -1
  138. package/dist/config/defaults.js.map +1 -1
  139. package/dist/config/effective.d.ts +12 -0
  140. package/dist/config/effective.d.ts.map +1 -1
  141. package/dist/config/effective.js +39 -6
  142. package/dist/config/effective.js.map +1 -1
  143. package/dist/config/effective.test.js +9 -1
  144. package/dist/config/effective.test.js.map +1 -1
  145. package/dist/config/loader.d.ts +6 -0
  146. package/dist/config/loader.d.ts.map +1 -1
  147. package/dist/config/loader.js +12 -0
  148. package/dist/config/loader.js.map +1 -1
  149. package/dist/config/loader.test.js +7 -1
  150. package/dist/config/loader.test.js.map +1 -1
  151. package/dist/config/types.d.ts +14 -2
  152. package/dist/config/types.d.ts.map +1 -1
  153. package/dist/config/validation.d.ts.map +1 -1
  154. package/dist/config/validation.js +19 -0
  155. package/dist/config/validation.js.map +1 -1
  156. package/dist/gateway/accounting.d.ts +33 -3
  157. package/dist/gateway/accounting.d.ts.map +1 -1
  158. package/dist/gateway/accounting.js +86 -7
  159. package/dist/gateway/accounting.js.map +1 -1
  160. package/dist/gateway/admission-benchmark.test.d.ts +2 -0
  161. package/dist/gateway/admission-benchmark.test.d.ts.map +1 -0
  162. package/dist/gateway/admission-benchmark.test.js +75 -0
  163. package/dist/gateway/admission-benchmark.test.js.map +1 -0
  164. package/dist/gateway/auth/auth.test.d.ts +4 -0
  165. package/dist/gateway/auth/auth.test.d.ts.map +1 -0
  166. package/dist/gateway/auth/auth.test.js +337 -0
  167. package/dist/gateway/auth/auth.test.js.map +1 -0
  168. package/dist/gateway/auth/credentials.test.d.ts +2 -0
  169. package/dist/gateway/auth/credentials.test.d.ts.map +1 -0
  170. package/dist/gateway/auth/credentials.test.js +132 -0
  171. package/dist/gateway/auth/credentials.test.js.map +1 -0
  172. package/dist/gateway/auth/db.d.ts +156 -0
  173. package/dist/gateway/auth/db.d.ts.map +1 -0
  174. package/dist/gateway/auth/db.js +390 -0
  175. package/dist/gateway/auth/db.js.map +1 -0
  176. package/dist/gateway/auth/hardening.test.d.ts +2 -0
  177. package/dist/gateway/auth/hardening.test.d.ts.map +1 -0
  178. package/dist/gateway/auth/hardening.test.js +155 -0
  179. package/dist/gateway/auth/hardening.test.js.map +1 -0
  180. package/dist/gateway/auth/http.d.ts +53 -0
  181. package/dist/gateway/auth/http.d.ts.map +1 -0
  182. package/dist/gateway/auth/http.js +165 -0
  183. package/dist/gateway/auth/http.js.map +1 -0
  184. package/dist/gateway/auth/index.d.ts +26 -0
  185. package/dist/gateway/auth/index.d.ts.map +1 -0
  186. package/dist/gateway/auth/index.js +1014 -0
  187. package/dist/gateway/auth/index.js.map +1 -0
  188. package/dist/gateway/auth/oidc.d.ts +57 -0
  189. package/dist/gateway/auth/oidc.d.ts.map +1 -0
  190. package/dist/gateway/auth/oidc.js +159 -0
  191. package/dist/gateway/auth/oidc.js.map +1 -0
  192. package/dist/gateway/auth/oidc.test.d.ts +2 -0
  193. package/dist/gateway/auth/oidc.test.d.ts.map +1 -0
  194. package/dist/gateway/auth/oidc.test.js +223 -0
  195. package/dist/gateway/auth/oidc.test.js.map +1 -0
  196. package/dist/gateway/auth/reauth.test.d.ts +2 -0
  197. package/dist/gateway/auth/reauth.test.d.ts.map +1 -0
  198. package/dist/gateway/auth/reauth.test.js +108 -0
  199. package/dist/gateway/auth/reauth.test.js.map +1 -0
  200. package/dist/gateway/auth/store-integration.test.d.ts +2 -0
  201. package/dist/gateway/auth/store-integration.test.d.ts.map +1 -0
  202. package/dist/gateway/auth/store-integration.test.js +100 -0
  203. package/dist/gateway/auth/store-integration.test.js.map +1 -0
  204. package/dist/gateway/auth/test-helpers.d.ts +167 -0
  205. package/dist/gateway/auth/test-helpers.d.ts.map +1 -0
  206. package/dist/gateway/auth/test-helpers.js +368 -0
  207. package/dist/gateway/auth/test-helpers.js.map +1 -0
  208. package/dist/gateway/auth/types.d.ts +145 -0
  209. package/dist/gateway/auth/types.d.ts.map +1 -0
  210. package/dist/gateway/auth/types.js +2 -0
  211. package/dist/gateway/auth/types.js.map +1 -0
  212. package/dist/gateway/auth/wallet.d.ts +15 -0
  213. package/dist/gateway/auth/wallet.d.ts.map +1 -0
  214. package/dist/gateway/auth/wallet.js +43 -0
  215. package/dist/gateway/auth/wallet.js.map +1 -0
  216. package/dist/gateway/bundle.d.ts +127 -0
  217. package/dist/gateway/bundle.d.ts.map +1 -0
  218. package/dist/gateway/bundle.js +604 -0
  219. package/dist/gateway/bundle.js.map +1 -0
  220. package/dist/gateway/bundle.test.d.ts +2 -0
  221. package/dist/gateway/bundle.test.d.ts.map +1 -0
  222. package/dist/gateway/bundle.test.js +277 -0
  223. package/dist/gateway/bundle.test.js.map +1 -0
  224. package/dist/gateway/buyer-control.d.ts +33 -0
  225. package/dist/gateway/buyer-control.d.ts.map +1 -0
  226. package/dist/gateway/buyer-control.js +93 -0
  227. package/dist/gateway/buyer-control.js.map +1 -0
  228. package/dist/gateway/buyer-policy-probe.d.ts +41 -0
  229. package/dist/gateway/buyer-policy-probe.d.ts.map +1 -0
  230. package/dist/gateway/buyer-policy-probe.js +99 -0
  231. package/dist/gateway/buyer-policy-probe.js.map +1 -0
  232. package/dist/gateway/buyer-policy-probe.test.d.ts +2 -0
  233. package/dist/gateway/buyer-policy-probe.test.d.ts.map +1 -0
  234. package/dist/gateway/buyer-policy-probe.test.js +128 -0
  235. package/dist/gateway/buyer-policy-probe.test.js.map +1 -0
  236. package/dist/gateway/buyer-process.d.ts +30 -0
  237. package/dist/gateway/buyer-process.d.ts.map +1 -0
  238. package/dist/gateway/buyer-process.js +101 -0
  239. package/dist/gateway/buyer-process.js.map +1 -0
  240. package/dist/gateway/buyer-process.test.d.ts +2 -0
  241. package/dist/gateway/buyer-process.test.d.ts.map +1 -0
  242. package/dist/gateway/buyer-process.test.js +112 -0
  243. package/dist/gateway/buyer-process.test.js.map +1 -0
  244. package/dist/gateway/chat/routes.d.ts +45 -0
  245. package/dist/gateway/chat/routes.d.ts.map +1 -0
  246. package/dist/gateway/chat/routes.js +439 -0
  247. package/dist/gateway/chat/routes.js.map +1 -0
  248. package/dist/gateway/chat/routes.test.d.ts +2 -0
  249. package/dist/gateway/chat/routes.test.d.ts.map +1 -0
  250. package/dist/gateway/chat/routes.test.js +304 -0
  251. package/dist/gateway/chat/routes.test.js.map +1 -0
  252. package/dist/gateway/chat/tools.d.ts +35 -0
  253. package/dist/gateway/chat/tools.d.ts.map +1 -0
  254. package/dist/gateway/chat/tools.js +347 -0
  255. package/dist/gateway/chat/tools.js.map +1 -0
  256. package/dist/gateway/chat/tools.test.d.ts +2 -0
  257. package/dist/gateway/chat/tools.test.d.ts.map +1 -0
  258. package/dist/gateway/chat/tools.test.js +136 -0
  259. package/dist/gateway/chat/tools.test.js.map +1 -0
  260. package/dist/gateway/console-api/access.d.ts +52 -0
  261. package/dist/gateway/console-api/access.d.ts.map +1 -0
  262. package/dist/gateway/console-api/access.js +171 -0
  263. package/dist/gateway/console-api/access.js.map +1 -0
  264. package/dist/gateway/console-api/deps.d.ts +52 -0
  265. package/dist/gateway/console-api/deps.d.ts.map +1 -0
  266. package/dist/gateway/console-api/deps.js +2 -0
  267. package/dist/gateway/console-api/deps.js.map +1 -0
  268. package/dist/gateway/console-api/handlers/admin-tokens.d.ts +8 -0
  269. package/dist/gateway/console-api/handlers/admin-tokens.d.ts.map +1 -0
  270. package/dist/gateway/console-api/handlers/admin-tokens.js +48 -0
  271. package/dist/gateway/console-api/handlers/admin-tokens.js.map +1 -0
  272. package/dist/gateway/console-api/handlers/audit.d.ts +8 -0
  273. package/dist/gateway/console-api/handlers/audit.d.ts.map +1 -0
  274. package/dist/gateway/console-api/handlers/audit.js +19 -0
  275. package/dist/gateway/console-api/handlers/audit.js.map +1 -0
  276. package/dist/gateway/console-api/handlers/audit.test.d.ts +2 -0
  277. package/dist/gateway/console-api/handlers/audit.test.d.ts.map +1 -0
  278. package/dist/gateway/console-api/handlers/audit.test.js +241 -0
  279. package/dist/gateway/console-api/handlers/audit.test.js.map +1 -0
  280. package/dist/gateway/console-api/handlers/data-settings.test.d.ts +2 -0
  281. package/dist/gateway/console-api/handlers/data-settings.test.d.ts.map +1 -0
  282. package/dist/gateway/console-api/handlers/data-settings.test.js +264 -0
  283. package/dist/gateway/console-api/handlers/data-settings.test.js.map +1 -0
  284. package/dist/gateway/console-api/handlers/index.d.ts +4 -0
  285. package/dist/gateway/console-api/handlers/index.d.ts.map +1 -0
  286. package/dist/gateway/console-api/handlers/index.js +24 -0
  287. package/dist/gateway/console-api/handlers/index.js.map +1 -0
  288. package/dist/gateway/console-api/handlers/keys.d.ts +13 -0
  289. package/dist/gateway/console-api/handlers/keys.d.ts.map +1 -0
  290. package/dist/gateway/console-api/handlers/keys.js +128 -0
  291. package/dist/gateway/console-api/handlers/keys.js.map +1 -0
  292. package/dist/gateway/console-api/handlers/keys.test.d.ts +2 -0
  293. package/dist/gateway/console-api/handlers/keys.test.d.ts.map +1 -0
  294. package/dist/gateway/console-api/handlers/keys.test.js +166 -0
  295. package/dist/gateway/console-api/handlers/keys.test.js.map +1 -0
  296. package/dist/gateway/console-api/handlers/network-buyer.d.ts +22 -0
  297. package/dist/gateway/console-api/handlers/network-buyer.d.ts.map +1 -0
  298. package/dist/gateway/console-api/handlers/network-buyer.js +39 -0
  299. package/dist/gateway/console-api/handlers/network-buyer.js.map +1 -0
  300. package/dist/gateway/console-api/handlers/network-mapping.d.ts +33 -0
  301. package/dist/gateway/console-api/handlers/network-mapping.d.ts.map +1 -0
  302. package/dist/gateway/console-api/handlers/network-mapping.js +219 -0
  303. package/dist/gateway/console-api/handlers/network-mapping.js.map +1 -0
  304. package/dist/gateway/console-api/handlers/network-test-helpers.d.ts +35 -0
  305. package/dist/gateway/console-api/handlers/network-test-helpers.d.ts.map +1 -0
  306. package/dist/gateway/console-api/handlers/network-test-helpers.js +121 -0
  307. package/dist/gateway/console-api/handlers/network-test-helpers.js.map +1 -0
  308. package/dist/gateway/console-api/handlers/network.d.ts +15 -0
  309. package/dist/gateway/console-api/handlers/network.d.ts.map +1 -0
  310. package/dist/gateway/console-api/handlers/network.js +57 -0
  311. package/dist/gateway/console-api/handlers/network.js.map +1 -0
  312. package/dist/gateway/console-api/handlers/network.test.d.ts +2 -0
  313. package/dist/gateway/console-api/handlers/network.test.d.ts.map +1 -0
  314. package/dist/gateway/console-api/handlers/network.test.js +383 -0
  315. package/dist/gateway/console-api/handlers/network.test.js.map +1 -0
  316. package/dist/gateway/console-api/handlers/org.d.ts +10 -0
  317. package/dist/gateway/console-api/handlers/org.d.ts.map +1 -0
  318. package/dist/gateway/console-api/handlers/org.js +150 -0
  319. package/dist/gateway/console-api/handlers/org.js.map +1 -0
  320. package/dist/gateway/console-api/handlers/peer-lists.d.ts +5 -0
  321. package/dist/gateway/console-api/handlers/peer-lists.d.ts.map +1 -0
  322. package/dist/gateway/console-api/handlers/peer-lists.js +43 -0
  323. package/dist/gateway/console-api/handlers/peer-lists.js.map +1 -0
  324. package/dist/gateway/console-api/handlers/presets.d.ts +9 -0
  325. package/dist/gateway/console-api/handlers/presets.d.ts.map +1 -0
  326. package/dist/gateway/console-api/handlers/presets.js +79 -0
  327. package/dist/gateway/console-api/handlers/presets.js.map +1 -0
  328. package/dist/gateway/console-api/handlers/routing.d.ts +5 -0
  329. package/dist/gateway/console-api/handlers/routing.d.ts.map +1 -0
  330. package/dist/gateway/console-api/handlers/routing.js +20 -0
  331. package/dist/gateway/console-api/handlers/routing.js.map +1 -0
  332. package/dist/gateway/console-api/handlers/settings.d.ts +10 -0
  333. package/dist/gateway/console-api/handlers/settings.d.ts.map +1 -0
  334. package/dist/gateway/console-api/handlers/settings.js +38 -0
  335. package/dist/gateway/console-api/handlers/settings.js.map +1 -0
  336. package/dist/gateway/console-api/handlers/status.d.ts +9 -0
  337. package/dist/gateway/console-api/handlers/status.d.ts.map +1 -0
  338. package/dist/gateway/console-api/handlers/status.js +47 -0
  339. package/dist/gateway/console-api/handlers/status.js.map +1 -0
  340. package/dist/gateway/console-api/handlers/status.test.d.ts +2 -0
  341. package/dist/gateway/console-api/handlers/status.test.d.ts.map +1 -0
  342. package/dist/gateway/console-api/handlers/status.test.js +82 -0
  343. package/dist/gateway/console-api/handlers/status.test.js.map +1 -0
  344. package/dist/gateway/console-api/handlers/usage.d.ts +10 -0
  345. package/dist/gateway/console-api/handlers/usage.d.ts.map +1 -0
  346. package/dist/gateway/console-api/handlers/usage.js +68 -0
  347. package/dist/gateway/console-api/handlers/usage.js.map +1 -0
  348. package/dist/gateway/console-api/handlers/wallet-card-link.d.ts +29 -0
  349. package/dist/gateway/console-api/handlers/wallet-card-link.d.ts.map +1 -0
  350. package/dist/gateway/console-api/handlers/wallet-card-link.js +46 -0
  351. package/dist/gateway/console-api/handlers/wallet-card-link.js.map +1 -0
  352. package/dist/gateway/console-api/handlers/wallet-chain.d.ts +26 -0
  353. package/dist/gateway/console-api/handlers/wallet-chain.d.ts.map +1 -0
  354. package/dist/gateway/console-api/handlers/wallet-chain.js +80 -0
  355. package/dist/gateway/console-api/handlers/wallet-chain.js.map +1 -0
  356. package/dist/gateway/console-api/handlers/wallet-mapping.d.ts +45 -0
  357. package/dist/gateway/console-api/handlers/wallet-mapping.d.ts.map +1 -0
  358. package/dist/gateway/console-api/handlers/wallet-mapping.js +202 -0
  359. package/dist/gateway/console-api/handlers/wallet-mapping.js.map +1 -0
  360. package/dist/gateway/console-api/handlers/wallet-operator.d.ts +41 -0
  361. package/dist/gateway/console-api/handlers/wallet-operator.d.ts.map +1 -0
  362. package/dist/gateway/console-api/handlers/wallet-operator.js +198 -0
  363. package/dist/gateway/console-api/handlers/wallet-operator.js.map +1 -0
  364. package/dist/gateway/console-api/handlers/wallet-operator.test.d.ts +2 -0
  365. package/dist/gateway/console-api/handlers/wallet-operator.test.d.ts.map +1 -0
  366. package/dist/gateway/console-api/handlers/wallet-operator.test.js +195 -0
  367. package/dist/gateway/console-api/handlers/wallet-operator.test.js.map +1 -0
  368. package/dist/gateway/console-api/handlers/wallet.d.ts +61 -0
  369. package/dist/gateway/console-api/handlers/wallet.d.ts.map +1 -0
  370. package/dist/gateway/console-api/handlers/wallet.js +221 -0
  371. package/dist/gateway/console-api/handlers/wallet.js.map +1 -0
  372. package/dist/gateway/console-api/handlers/wallet.test.d.ts +2 -0
  373. package/dist/gateway/console-api/handlers/wallet.test.d.ts.map +1 -0
  374. package/dist/gateway/console-api/handlers/wallet.test.js +581 -0
  375. package/dist/gateway/console-api/handlers/wallet.test.js.map +1 -0
  376. package/dist/gateway/console-api/handlers/workspaces.d.ts +12 -0
  377. package/dist/gateway/console-api/handlers/workspaces.d.ts.map +1 -0
  378. package/dist/gateway/console-api/handlers/workspaces.js +96 -0
  379. package/dist/gateway/console-api/handlers/workspaces.js.map +1 -0
  380. package/dist/gateway/console-api/operator-types.d.ts +68 -0
  381. package/dist/gateway/console-api/operator-types.d.ts.map +1 -0
  382. package/dist/gateway/console-api/operator-types.js +21 -0
  383. package/dist/gateway/console-api/operator-types.js.map +1 -0
  384. package/dist/gateway/console-api/router.d.ts +97 -0
  385. package/dist/gateway/console-api/router.d.ts.map +1 -0
  386. package/dist/gateway/console-api/router.js +69 -0
  387. package/dist/gateway/console-api/router.js.map +1 -0
  388. package/dist/gateway/console-api/routes.test.d.ts +2 -0
  389. package/dist/gateway/console-api/routes.test.d.ts.map +1 -0
  390. package/dist/gateway/console-api/routes.test.js +331 -0
  391. package/dist/gateway/console-api/routes.test.js.map +1 -0
  392. package/dist/gateway/console-api/serialize.d.ts +33 -0
  393. package/dist/gateway/console-api/serialize.d.ts.map +1 -0
  394. package/dist/gateway/console-api/serialize.js +179 -0
  395. package/dist/gateway/console-api/serialize.js.map +1 -0
  396. package/dist/gateway/console-api/server.d.ts +38 -0
  397. package/dist/gateway/console-api/server.d.ts.map +1 -0
  398. package/dist/gateway/console-api/server.js +308 -0
  399. package/dist/gateway/console-api/server.js.map +1 -0
  400. package/dist/gateway/console-api/server.test.d.ts +2 -0
  401. package/dist/gateway/console-api/server.test.d.ts.map +1 -0
  402. package/dist/gateway/console-api/server.test.js +149 -0
  403. package/dist/gateway/console-api/server.test.js.map +1 -0
  404. package/dist/gateway/console-api/test-support.d.ts +59 -0
  405. package/dist/gateway/console-api/test-support.d.ts.map +1 -0
  406. package/dist/gateway/console-api/test-support.js +120 -0
  407. package/dist/gateway/console-api/test-support.js.map +1 -0
  408. package/dist/gateway/console-api/types.d.ts +779 -0
  409. package/dist/gateway/console-api/types.d.ts.map +1 -0
  410. package/dist/gateway/console-api/types.js +6 -0
  411. package/dist/gateway/console-api/types.js.map +1 -0
  412. package/dist/gateway/console-location.d.ts +21 -0
  413. package/dist/gateway/console-location.d.ts.map +1 -0
  414. package/dist/gateway/console-location.js +41 -0
  415. package/dist/gateway/console-location.js.map +1 -0
  416. package/dist/gateway/console-recovery.d.ts +34 -0
  417. package/dist/gateway/console-recovery.d.ts.map +1 -0
  418. package/dist/gateway/console-recovery.js +94 -0
  419. package/dist/gateway/console-recovery.js.map +1 -0
  420. package/dist/gateway/console-recovery.test.d.ts +2 -0
  421. package/dist/gateway/console-recovery.test.d.ts.map +1 -0
  422. package/dist/gateway/console-recovery.test.js +106 -0
  423. package/dist/gateway/console-recovery.test.js.map +1 -0
  424. package/dist/gateway/console.d.ts +18 -0
  425. package/dist/gateway/console.d.ts.map +1 -0
  426. package/dist/gateway/console.js +101 -0
  427. package/dist/gateway/console.js.map +1 -0
  428. package/dist/gateway/console.test.d.ts +2 -0
  429. package/dist/gateway/console.test.d.ts.map +1 -0
  430. package/dist/gateway/console.test.js +165 -0
  431. package/dist/gateway/console.test.js.map +1 -0
  432. package/dist/gateway/errors.d.ts +3 -0
  433. package/dist/gateway/errors.d.ts.map +1 -0
  434. package/dist/gateway/errors.js +5 -0
  435. package/dist/gateway/errors.js.map +1 -0
  436. package/dist/gateway/exposure.d.ts +33 -0
  437. package/dist/gateway/exposure.d.ts.map +1 -0
  438. package/dist/gateway/exposure.js +146 -0
  439. package/dist/gateway/exposure.js.map +1 -0
  440. package/dist/gateway/exposure.test.d.ts +2 -0
  441. package/dist/gateway/exposure.test.d.ts.map +1 -0
  442. package/dist/gateway/exposure.test.js +93 -0
  443. package/dist/gateway/exposure.test.js.map +1 -0
  444. package/dist/gateway/gateway-policy.test.d.ts +2 -0
  445. package/dist/gateway/gateway-policy.test.d.ts.map +1 -0
  446. package/dist/gateway/gateway-policy.test.js +404 -0
  447. package/dist/gateway/gateway-policy.test.js.map +1 -0
  448. package/dist/gateway/gateway.test.js +47 -25
  449. package/dist/gateway/gateway.test.js.map +1 -1
  450. package/dist/gateway/keys.d.ts +2 -0
  451. package/dist/gateway/keys.d.ts.map +1 -1
  452. package/dist/gateway/keys.js +2 -0
  453. package/dist/gateway/keys.js.map +1 -1
  454. package/dist/gateway/limits.d.ts +32 -8
  455. package/dist/gateway/limits.d.ts.map +1 -1
  456. package/dist/gateway/limits.js +27 -11
  457. package/dist/gateway/limits.js.map +1 -1
  458. package/dist/gateway/observability.d.ts +51 -0
  459. package/dist/gateway/observability.d.ts.map +1 -0
  460. package/dist/gateway/observability.js +136 -0
  461. package/dist/gateway/observability.js.map +1 -0
  462. package/dist/gateway/policy-resolver.d.ts +73 -0
  463. package/dist/gateway/policy-resolver.d.ts.map +1 -0
  464. package/dist/gateway/policy-resolver.js +142 -0
  465. package/dist/gateway/policy-resolver.js.map +1 -0
  466. package/dist/gateway/policy-resolver.test.d.ts +2 -0
  467. package/dist/gateway/policy-resolver.test.d.ts.map +1 -0
  468. package/dist/gateway/policy-resolver.test.js +273 -0
  469. package/dist/gateway/policy-resolver.test.js.map +1 -0
  470. package/dist/gateway/request-errors.test.d.ts +2 -0
  471. package/dist/gateway/request-errors.test.d.ts.map +1 -0
  472. package/dist/gateway/request-errors.test.js +108 -0
  473. package/dist/gateway/request-errors.test.js.map +1 -0
  474. package/dist/gateway/request-shaping.d.ts +25 -0
  475. package/dist/gateway/request-shaping.d.ts.map +1 -0
  476. package/dist/gateway/request-shaping.js +66 -0
  477. package/dist/gateway/request-shaping.js.map +1 -0
  478. package/dist/gateway/response-usage.d.ts +35 -0
  479. package/dist/gateway/response-usage.d.ts.map +1 -0
  480. package/dist/gateway/response-usage.js +167 -0
  481. package/dist/gateway/response-usage.js.map +1 -0
  482. package/dist/gateway/response-usage.test.d.ts +2 -0
  483. package/dist/gateway/response-usage.test.d.ts.map +1 -0
  484. package/dist/gateway/response-usage.test.js +78 -0
  485. package/dist/gateway/response-usage.test.js.map +1 -0
  486. package/dist/gateway/runtime.d.ts +25 -0
  487. package/dist/gateway/runtime.d.ts.map +1 -1
  488. package/dist/gateway/runtime.js +39 -19
  489. package/dist/gateway/runtime.js.map +1 -1
  490. package/dist/gateway/server.d.ts +68 -2
  491. package/dist/gateway/server.d.ts.map +1 -1
  492. package/dist/gateway/server.js +532 -116
  493. package/dist/gateway/server.js.map +1 -1
  494. package/dist/gateway/services/audit.d.ts +16 -0
  495. package/dist/gateway/services/audit.d.ts.map +1 -0
  496. package/dist/gateway/services/audit.js +18 -0
  497. package/dist/gateway/services/audit.js.map +1 -0
  498. package/dist/gateway/services/context.d.ts +66 -0
  499. package/dist/gateway/services/context.d.ts.map +1 -0
  500. package/dist/gateway/services/context.js +52 -0
  501. package/dist/gateway/services/context.js.map +1 -0
  502. package/dist/gateway/services/keys.d.ts +78 -0
  503. package/dist/gateway/services/keys.d.ts.map +1 -0
  504. package/dist/gateway/services/keys.js +232 -0
  505. package/dist/gateway/services/keys.js.map +1 -0
  506. package/dist/gateway/services/members.d.ts +72 -0
  507. package/dist/gateway/services/members.d.ts.map +1 -0
  508. package/dist/gateway/services/members.js +161 -0
  509. package/dist/gateway/services/members.js.map +1 -0
  510. package/dist/gateway/services/network.d.ts +36 -0
  511. package/dist/gateway/services/network.d.ts.map +1 -0
  512. package/dist/gateway/services/network.js +147 -0
  513. package/dist/gateway/services/network.js.map +1 -0
  514. package/dist/gateway/services/operator.d.ts +98 -0
  515. package/dist/gateway/services/operator.d.ts.map +1 -0
  516. package/dist/gateway/services/operator.js +170 -0
  517. package/dist/gateway/services/operator.js.map +1 -0
  518. package/dist/gateway/services/operator.test.d.ts +2 -0
  519. package/dist/gateway/services/operator.test.d.ts.map +1 -0
  520. package/dist/gateway/services/operator.test.js +184 -0
  521. package/dist/gateway/services/operator.test.js.map +1 -0
  522. package/dist/gateway/services/peer-lists.d.ts +20 -0
  523. package/dist/gateway/services/peer-lists.d.ts.map +1 -0
  524. package/dist/gateway/services/peer-lists.js +134 -0
  525. package/dist/gateway/services/peer-lists.js.map +1 -0
  526. package/dist/gateway/services/presets.d.ts +34 -0
  527. package/dist/gateway/services/presets.d.ts.map +1 -0
  528. package/dist/gateway/services/presets.js +134 -0
  529. package/dist/gateway/services/presets.js.map +1 -0
  530. package/dist/gateway/services/routing.d.ts +13 -0
  531. package/dist/gateway/services/routing.d.ts.map +1 -0
  532. package/dist/gateway/services/routing.js +18 -0
  533. package/dist/gateway/services/routing.js.map +1 -0
  534. package/dist/gateway/services/services.test.d.ts +2 -0
  535. package/dist/gateway/services/services.test.d.ts.map +1 -0
  536. package/dist/gateway/services/services.test.js +476 -0
  537. package/dist/gateway/services/services.test.js.map +1 -0
  538. package/dist/gateway/services/settings.d.ts +68 -0
  539. package/dist/gateway/services/settings.d.ts.map +1 -0
  540. package/dist/gateway/services/settings.js +580 -0
  541. package/dist/gateway/services/settings.js.map +1 -0
  542. package/dist/gateway/services/tokens.d.ts +29 -0
  543. package/dist/gateway/services/tokens.d.ts.map +1 -0
  544. package/dist/gateway/services/tokens.js +48 -0
  545. package/dist/gateway/services/tokens.js.map +1 -0
  546. package/dist/gateway/services/usage.d.ts +55 -0
  547. package/dist/gateway/services/usage.d.ts.map +1 -0
  548. package/dist/gateway/services/usage.js +225 -0
  549. package/dist/gateway/services/usage.js.map +1 -0
  550. package/dist/gateway/services/wallet-address-env.test.d.ts +2 -0
  551. package/dist/gateway/services/wallet-address-env.test.d.ts.map +1 -0
  552. package/dist/gateway/services/wallet-address-env.test.js +119 -0
  553. package/dist/gateway/services/wallet-address-env.test.js.map +1 -0
  554. package/dist/gateway/services/wallet-address.d.ts +40 -0
  555. package/dist/gateway/services/wallet-address.d.ts.map +1 -0
  556. package/dist/gateway/services/wallet-address.js +116 -0
  557. package/dist/gateway/services/wallet-address.js.map +1 -0
  558. package/dist/gateway/services/wallet-address.test.d.ts +2 -0
  559. package/dist/gateway/services/wallet-address.test.d.ts.map +1 -0
  560. package/dist/gateway/services/wallet-address.test.js +84 -0
  561. package/dist/gateway/services/wallet-address.test.js.map +1 -0
  562. package/dist/gateway/services/workspaces.d.ts +75 -0
  563. package/dist/gateway/services/workspaces.d.ts.map +1 -0
  564. package/dist/gateway/services/workspaces.js +228 -0
  565. package/dist/gateway/services/workspaces.js.map +1 -0
  566. package/dist/gateway/spend-durability.test.d.ts +2 -0
  567. package/dist/gateway/spend-durability.test.d.ts.map +1 -0
  568. package/dist/gateway/spend-durability.test.js +330 -0
  569. package/dist/gateway/spend-durability.test.js.map +1 -0
  570. package/dist/gateway/spend-feed.d.ts +11 -1
  571. package/dist/gateway/spend-feed.d.ts.map +1 -1
  572. package/dist/gateway/spend-feed.js +17 -4
  573. package/dist/gateway/spend-feed.js.map +1 -1
  574. package/dist/gateway/spend-feed.test.d.ts +2 -0
  575. package/dist/gateway/spend-feed.test.d.ts.map +1 -0
  576. package/dist/gateway/spend-feed.test.js +34 -0
  577. package/dist/gateway/spend-feed.test.js.map +1 -0
  578. package/dist/gateway/store-data.test.d.ts +2 -0
  579. package/dist/gateway/store-data.test.d.ts.map +1 -0
  580. package/dist/gateway/store-data.test.js +346 -0
  581. package/dist/gateway/store-data.test.js.map +1 -0
  582. package/dist/gateway/store-migrations.d.ts +6 -0
  583. package/dist/gateway/store-migrations.d.ts.map +1 -0
  584. package/dist/gateway/store-migrations.js +301 -0
  585. package/dist/gateway/store-migrations.js.map +1 -0
  586. package/dist/gateway/store.d.ts +595 -10
  587. package/dist/gateway/store.d.ts.map +1 -1
  588. package/dist/gateway/store.js +1242 -120
  589. package/dist/gateway/store.js.map +1 -1
  590. package/dist/gateway/store.test.d.ts +2 -0
  591. package/dist/gateway/store.test.d.ts.map +1 -0
  592. package/dist/gateway/store.test.js +185 -0
  593. package/dist/gateway/store.test.js.map +1 -0
  594. package/dist/proxy/buyer-chain-reader.d.ts +68 -0
  595. package/dist/proxy/buyer-chain-reader.d.ts.map +1 -0
  596. package/dist/proxy/buyer-chain-reader.js +152 -0
  597. package/dist/proxy/buyer-chain-reader.js.map +1 -0
  598. package/dist/proxy/buyer-chain-reader.test.d.ts +2 -0
  599. package/dist/proxy/buyer-chain-reader.test.d.ts.map +1 -0
  600. package/dist/proxy/buyer-chain-reader.test.js +102 -0
  601. package/dist/proxy/buyer-chain-reader.test.js.map +1 -0
  602. package/dist/proxy/buyer-proxy.d.ts +169 -3
  603. package/dist/proxy/buyer-proxy.d.ts.map +1 -1
  604. package/dist/proxy/buyer-proxy.js +873 -117
  605. package/dist/proxy/buyer-proxy.js.map +1 -1
  606. package/dist/proxy/buyer-proxy.test.js +31 -0
  607. package/dist/proxy/buyer-proxy.test.js.map +1 -1
  608. package/dist/proxy/chain-read-cache.d.ts +47 -0
  609. package/dist/proxy/chain-read-cache.d.ts.map +1 -0
  610. package/dist/proxy/chain-read-cache.js +110 -0
  611. package/dist/proxy/chain-read-cache.js.map +1 -0
  612. package/dist/proxy/chain-read-cache.test.d.ts +2 -0
  613. package/dist/proxy/chain-read-cache.test.d.ts.map +1 -0
  614. package/dist/proxy/chain-read-cache.test.js +75 -0
  615. package/dist/proxy/chain-read-cache.test.js.map +1 -0
  616. package/dist/proxy/chain-rpc-test-support.d.ts +31 -0
  617. package/dist/proxy/chain-rpc-test-support.d.ts.map +1 -0
  618. package/dist/proxy/chain-rpc-test-support.js +136 -0
  619. package/dist/proxy/chain-rpc-test-support.js.map +1 -0
  620. package/dist/proxy/chain-rpc.d.ts +121 -0
  621. package/dist/proxy/chain-rpc.d.ts.map +1 -0
  622. package/dist/proxy/chain-rpc.js +420 -0
  623. package/dist/proxy/chain-rpc.js.map +1 -0
  624. package/dist/proxy/chain-rpc.test.d.ts +2 -0
  625. package/dist/proxy/chain-rpc.test.d.ts.map +1 -0
  626. package/dist/proxy/chain-rpc.test.js +180 -0
  627. package/dist/proxy/chain-rpc.test.js.map +1 -0
  628. package/dist/proxy/deposit-watch-hub.d.ts +47 -0
  629. package/dist/proxy/deposit-watch-hub.d.ts.map +1 -0
  630. package/dist/proxy/deposit-watch-hub.js +111 -0
  631. package/dist/proxy/deposit-watch-hub.js.map +1 -0
  632. package/dist/proxy/deposit-watch-hub.test.d.ts +2 -0
  633. package/dist/proxy/deposit-watch-hub.test.d.ts.map +1 -0
  634. package/dist/proxy/deposit-watch-hub.test.js +133 -0
  635. package/dist/proxy/deposit-watch-hub.test.js.map +1 -0
  636. package/dist/proxy/deposit-watcher.d.ts +44 -4
  637. package/dist/proxy/deposit-watcher.d.ts.map +1 -1
  638. package/dist/proxy/deposit-watcher.js +76 -11
  639. package/dist/proxy/deposit-watcher.js.map +1 -1
  640. package/dist/proxy/deposit-watcher.test.js +54 -1
  641. package/dist/proxy/deposit-watcher.test.js.map +1 -1
  642. package/dist/proxy/gateway-policy.test.d.ts +2 -0
  643. package/dist/proxy/gateway-policy.test.d.ts.map +1 -0
  644. package/dist/proxy/gateway-policy.test.js +576 -0
  645. package/dist/proxy/gateway-policy.test.js.map +1 -0
  646. package/dist/proxy/network-models.d.ts +2 -0
  647. package/dist/proxy/network-models.d.ts.map +1 -1
  648. package/dist/proxy/network-models.js +3 -1
  649. package/dist/proxy/network-models.js.map +1 -1
  650. package/dist/proxy/route-policy.d.ts +97 -0
  651. package/dist/proxy/route-policy.d.ts.map +1 -0
  652. package/dist/proxy/route-policy.js +230 -0
  653. package/dist/proxy/route-policy.js.map +1 -0
  654. package/dist/proxy/route-policy.test.d.ts +2 -0
  655. package/dist/proxy/route-policy.test.d.ts.map +1 -0
  656. package/dist/proxy/route-policy.test.js +120 -0
  657. package/dist/proxy/route-policy.test.js.map +1 -0
  658. package/dist/proxy/spend-attribution.d.ts +41 -10
  659. package/dist/proxy/spend-attribution.d.ts.map +1 -1
  660. package/dist/proxy/spend-attribution.js +133 -37
  661. package/dist/proxy/spend-attribution.js.map +1 -1
  662. package/dist/proxy/tee-control.d.ts +3 -1
  663. package/dist/proxy/tee-control.d.ts.map +1 -1
  664. package/dist/proxy/tee-control.js +5 -3
  665. package/dist/proxy/tee-control.js.map +1 -1
  666. package/dist/proxy/telemetry.d.ts +2 -1
  667. package/dist/proxy/telemetry.d.ts.map +1 -1
  668. package/dist/proxy/telemetry.js +10 -5
  669. package/dist/proxy/telemetry.js.map +1 -1
  670. package/dist/routing-policy/policy.d.ts +149 -0
  671. package/dist/routing-policy/policy.d.ts.map +1 -0
  672. package/dist/routing-policy/policy.js +450 -0
  673. package/dist/routing-policy/policy.js.map +1 -0
  674. package/dist/routing-policy/policy.test.d.ts +2 -0
  675. package/dist/routing-policy/policy.test.d.ts.map +1 -0
  676. package/dist/routing-policy/policy.test.js +134 -0
  677. package/dist/routing-policy/policy.test.js.map +1 -0
  678. package/package.json +15 -7
@@ -1,15 +1,33 @@
1
- import { type PeriodSpend, type SpendLimits } from './limits.js';
1
+ import Database from 'better-sqlite3';
2
+ import { type RoutingPolicy } from '../routing-policy/policy.js';
3
+ import { type BudgetLimits, type BudgetPeriod, type BudgetSpend, type LimitPeriod, type SpendLimits } from './limits.js';
2
4
  export type ApiKeySource = 'created' | 'tunnel-env';
3
5
  export type ApiKeyStatus = 'active' | 'revoked';
6
+ export type OrgRole = 'owner' | 'admin' | 'member';
7
+ export type WorkspaceRole = 'admin' | 'member';
8
+ export type MemberStatus = 'active' | 'invited' | 'disabled';
9
+ export declare const DEFAULT_WORKSPACE_ID = "ws_default";
4
10
  export interface ApiKeyRecord {
5
11
  id: string;
6
12
  label: string;
7
13
  hint: string;
8
- /** Buyer identity (wallet) that pays for this key's requests. */
14
+ /** Buyer identity (wallet) that pays for this key's requests: its workspace's. */
9
15
  buyerIdentity: string;
16
+ workspaceId: string;
17
+ /** Member the key belongs to; null for keys created by the CLI or a management token. */
18
+ ownerMemberId: string | null;
10
19
  source: ApiKeySource;
11
20
  status: ApiKeyStatus;
12
- limits: SpendLimits;
21
+ /** Set by workspace admins (the admin layer). */
22
+ limits: BudgetLimits;
23
+ routingPolicy: RoutingPolicy | null;
24
+ /**
25
+ * Set by the key's owner on top of the admin layer (the owner layer): they
26
+ * may change these freely, but each only narrows the admin layer, so the
27
+ * owner can never get more than the admins allow.
28
+ */
29
+ ownerLimits: BudgetLimits;
30
+ ownerRoutingPolicy: RoutingPolicy | null;
13
31
  /** Whether the key holder may fund the key's wallet with x402 top-ups. */
14
32
  topupEnabled: boolean;
15
33
  expiresAt: number | null;
@@ -17,6 +35,135 @@ export interface ApiKeyRecord {
17
35
  revokedAt: number | null;
18
36
  lastUsedAt: number | null;
19
37
  }
38
+ export interface WorkspaceRecord {
39
+ id: string;
40
+ name: string;
41
+ buyerIdentity: string;
42
+ isDefault: boolean;
43
+ /** Cached address of the buyer identity's wallet; null until known. */
44
+ walletAddress: string | null;
45
+ limits: BudgetLimits;
46
+ /** Set by workspace admins. */
47
+ routingPolicy: RoutingPolicy | null;
48
+ /** Set by org admins; applied before `routingPolicy`. */
49
+ orgRoutingPolicy: RoutingPolicy | null;
50
+ createdAt: number;
51
+ }
52
+ /** Whose chat history: a console member's, or an API key holder's (the CLI and key sessions). */
53
+ export interface ChatThreadOwner {
54
+ kind: 'member' | 'key';
55
+ id: string;
56
+ workspaceId: string;
57
+ }
58
+ export interface ChatThreadSummary {
59
+ id: string;
60
+ workspaceId: string;
61
+ owner: {
62
+ kind: 'member' | 'key';
63
+ id: string;
64
+ };
65
+ title: string;
66
+ model: string | null;
67
+ peerId: string | null;
68
+ createdAt: number;
69
+ updatedAt: number;
70
+ }
71
+ export interface ChatThreadRecord extends ChatThreadSummary {
72
+ /** AI SDK UIMessages, as the web chat and `antseed chat` exchange them. */
73
+ messages: unknown[];
74
+ }
75
+ export interface MemberRecord {
76
+ id: string;
77
+ label: string;
78
+ email: string | null;
79
+ orgRole: OrgRole;
80
+ status: MemberStatus;
81
+ limits: BudgetLimits;
82
+ routingPolicy: RoutingPolicy | null;
83
+ maxKeys: number | null;
84
+ createdAt: number;
85
+ }
86
+ export interface InviteRecord {
87
+ id: string;
88
+ memberId: string;
89
+ label: string;
90
+ email: string | null;
91
+ orgRole: OrgRole;
92
+ workspaces: Array<{
93
+ workspaceId: string;
94
+ role: WorkspaceRole;
95
+ }>;
96
+ createdBy: string | null;
97
+ expiresAt: number;
98
+ usedAt: number | null;
99
+ createdAt: number;
100
+ }
101
+ export interface PeerListRecord {
102
+ id: string;
103
+ name: string;
104
+ description: string | null;
105
+ peerIds: string[];
106
+ createdAt: number;
107
+ }
108
+ export interface PresetRecord {
109
+ id: string;
110
+ slug: string;
111
+ name: string;
112
+ workspaceId: string | null;
113
+ model: string;
114
+ routingPolicy: RoutingPolicy | null;
115
+ systemPrompt: string | null;
116
+ params: Record<string, unknown>;
117
+ createdAt: number;
118
+ }
119
+ export interface AdminTokenRecord {
120
+ id: string;
121
+ label: string;
122
+ hint: string;
123
+ scope: 'admin' | 'read';
124
+ createdBy: string | null;
125
+ /** Null never expires (owners only). */
126
+ expiresAt: number | null;
127
+ createdAt: number;
128
+ lastUsedAt: number | null;
129
+ revokedAt: number | null;
130
+ }
131
+ export type AuditActorKind = 'member' | 'token' | 'key' | 'system' | 'cli';
132
+ /** One audit-log row; same shape as the console's `AuditEntry`. */
133
+ export interface AuditRecord {
134
+ id: string;
135
+ at: number;
136
+ actor: {
137
+ kind: AuditActorKind;
138
+ id: string | null;
139
+ label: string | null;
140
+ };
141
+ action: string;
142
+ target: {
143
+ kind: string;
144
+ id: string | null;
145
+ label: string | null;
146
+ } | null;
147
+ details: Record<string, unknown>;
148
+ ip: string | null;
149
+ }
150
+ /** Input of `GatewayStore.recordAudit`. Never put secrets in `details`. */
151
+ export interface AuditInput {
152
+ actor: {
153
+ kind: AuditActorKind;
154
+ id: string | null;
155
+ label?: string | null;
156
+ };
157
+ /** Dotted verb, e.g. "key.create", "workspace.policy.update". */
158
+ action: string;
159
+ target?: {
160
+ kind: string;
161
+ id: string | null;
162
+ label?: string | null;
163
+ } | null;
164
+ details?: Record<string, unknown>;
165
+ ip?: string | null;
166
+ }
20
167
  /**
21
168
  * Balance movements per key, as signed deltas in USDC base units: spend is
22
169
  * negative, credit (a top-up or payment received for the key) is positive.
@@ -36,6 +183,14 @@ export interface LedgerEntryInput {
36
183
  outputTokens?: number;
37
184
  note?: string | null;
38
185
  createdAt: number;
186
+ /**
187
+ * Who the spend counts against, fixed when it is recorded. Missing fields
188
+ * come from the request (`requestTag`), else from the key as it is now.
189
+ */
190
+ workspaceId?: string | null;
191
+ memberId?: string | null;
192
+ model?: string | null;
193
+ endUser?: string | null;
39
194
  }
40
195
  export interface GatewayRequestStart {
41
196
  tag: string;
@@ -45,6 +200,23 @@ export interface GatewayRequestStart {
45
200
  path: string;
46
201
  model: string | null;
47
202
  startedAt: number;
203
+ /** Default to the key's workspace and owner. */
204
+ workspaceId?: string | null;
205
+ memberId?: string | null;
206
+ endUser?: string | null;
207
+ }
208
+ export interface RequestOutcome {
209
+ sellerPeerId?: string | null;
210
+ latencyMs?: number | null;
211
+ endUser?: string | null;
212
+ /** Served by a free seller (all advertised prices zero): no spend will be reported. */
213
+ servedFree?: boolean;
214
+ }
215
+ /** What a key listing shows: lifetime requests and spend, and spend since a given time. */
216
+ export interface KeyUsageSummary {
217
+ requests: number;
218
+ spentUsdc: number;
219
+ spentSinceUsdc: number;
48
220
  }
49
221
  export interface KeyUsageStats {
50
222
  requests: number;
@@ -55,22 +227,251 @@ export interface KeyUsageStats {
55
227
  cachedInputTokens: number;
56
228
  outputTokens: number;
57
229
  }
230
+ /** Narrows request-log and usage queries. `keyIds` is the caller's visibility scope (null = everything). */
231
+ export interface UsageFilter {
232
+ keyIds?: readonly string[] | null;
233
+ workspaceId?: string | null;
234
+ keyId?: string | null;
235
+ memberId?: string | null;
236
+ model?: string | null;
237
+ from?: number | null;
238
+ to?: number | null;
239
+ }
240
+ /** Request-log filters on top of `UsageFilter`. */
241
+ export interface RequestLogFilter extends UsageFilter {
242
+ /** 'error' = finished with status >= 400; requests still in flight are neither. */
243
+ status?: 'ok' | 'error' | number | null;
244
+ /** Substring (case-insensitive) of the model, key label, end user, tag, seller, path, or error code/message. */
245
+ q?: string | null;
246
+ /** Rows strictly older than this position (newest first). */
247
+ before?: RequestCursor | null;
248
+ limit?: number;
249
+ }
250
+ /** Position in the request log, ordered by (startedAt, tag) descending. */
251
+ export interface RequestCursor {
252
+ startedAt: number;
253
+ tag: string;
254
+ }
255
+ /** Why a request failed, from the gateway's own error or the buyer's/seller's error body. */
256
+ export interface RequestError {
257
+ code: string | null;
258
+ message: string | null;
259
+ }
260
+ export type UsageGroupBy = 'hour' | 'day' | 'model' | 'key' | 'member' | 'peer' | 'workspace' | 'user';
261
+ /**
262
+ * A usage group, split further by a second grouping when one was asked for.
263
+ * `others` marks the row that folds the end users past the largest
264
+ * `MAX_USER_GROUPS` (its count of them); its group is `OTHER_USERS_GROUP`.
265
+ */
266
+ export type UsageGroupRow = {
267
+ group: string | null;
268
+ others?: number;
269
+ splits?: UsageSplitRow[];
270
+ } & UsageTotalsRow;
271
+ export type UsageSplitRow = {
272
+ group: string | null;
273
+ others?: number;
274
+ } & UsageTotalsRow;
275
+ /**
276
+ * End users are whatever a key holder sends, so a report by user keeps the
277
+ * largest ones and folds the rest into one row.
278
+ */
279
+ export declare const MAX_USER_GROUPS = 100;
280
+ export declare const OTHER_USERS_GROUP = "\0others";
281
+ /** Token counts a response reported about itself (`inputTokens` includes cached input). */
282
+ export interface ResponseTokenCounts {
283
+ inputTokens: number;
284
+ cachedInputTokens: number;
285
+ outputTokens: number;
286
+ }
287
+ export interface UsageTotalsRow {
288
+ requests: number;
289
+ failedRequests: number;
290
+ spentUsdc: number;
291
+ inputTokens: number;
292
+ cachedInputTokens: number;
293
+ outputTokens: number;
294
+ }
295
+ export interface RequestLogRow {
296
+ tag: string;
297
+ startedAt: number;
298
+ finishedAt: number | null;
299
+ keyId: string;
300
+ keyLabel: string;
301
+ workspaceId: string;
302
+ memberId: string | null;
303
+ endUser: string | null;
304
+ method: string;
305
+ path: string;
306
+ model: string | null;
307
+ status: number | null;
308
+ sellerPeerId: string | null;
309
+ latencyMs: number | null;
310
+ spentUsdc: number | null;
311
+ inputTokens: number;
312
+ cachedInputTokens: number;
313
+ outputTokens: number;
314
+ errorCode: string | null;
315
+ errorMessage: string | null;
316
+ /** Served by a free seller: its cost is $0 with no spend to wait for. */
317
+ servedFree: boolean;
318
+ /**
319
+ * A model request that did not fail and was not served free, but has no
320
+ * spend recorded yet (the buyer reports it a moment after the response).
321
+ */
322
+ costPending: boolean;
323
+ }
324
+ /** One request with its bodies (null unless content logging was on for it). */
325
+ export interface RequestDetailRow extends RequestLogRow {
326
+ requestBody: string | null;
327
+ responseBody: string | null;
328
+ }
329
+ export type BudgetScope = {
330
+ keyId: string;
331
+ } | {
332
+ memberId: string;
333
+ } | {
334
+ workspaceId: string;
335
+ };
58
336
  export declare function gatewayDir(dataDir: string): string;
59
337
  /**
60
- * Durable state for the API-key gateway: keys, request log and the per-key
61
- * ledger. SQLite in WAL mode so `antseed gateway key …`
62
- * commands can change keys while a gateway process is serving them.
338
+ * Durable state for the API-key gateway and its console: keys, request log,
339
+ * the per-key ledger, and the organization around them (workspaces, members,
340
+ * invites, presets, peer lists, management tokens, settings). SQLite in WAL
341
+ * mode so `antseed gateway key …` commands can change keys while a gateway
342
+ * process is serving them.
63
343
  */
64
344
  export declare class GatewayStore {
65
345
  private readonly _now;
66
346
  private readonly _db;
347
+ private readonly _statements;
348
+ private readonly _settings;
349
+ private readonly _touched;
67
350
  constructor(dataDir: string, _now?: () => number);
351
+ /**
352
+ * Switching a database to WAL needs it to itself, and SQLite answers
353
+ * SQLITE_BUSY at once (no busy handler) while other processes have it
354
+ * open, e.g. several opening an old database together: retry for a while.
355
+ */
356
+ private _enableWal;
357
+ /** The underlying database; the console's auth module keeps its own tables in it. */
358
+ get database(): Database.Database;
68
359
  close(): void;
360
+ private _count;
361
+ /** A prepared statement, cached by its SQL (hot paths run the same few statements on every request). */
362
+ private _stmt;
363
+ /**
364
+ * Several processes (the gateway, `antseed gateway key …`) may open an old
365
+ * database at once: the version is re-read inside an IMMEDIATE transaction,
366
+ * which holds the write lock, so only the first one applies a migration.
367
+ */
69
368
  private _migrate;
369
+ getWorkspace(id: string): WorkspaceRecord | null;
370
+ listWorkspaces(): WorkspaceRecord[];
371
+ defaultWorkspace(): WorkspaceRecord;
372
+ workspaceForKey(keyId: string): WorkspaceRecord | null;
373
+ createWorkspace(input: {
374
+ name: string;
375
+ buyerIdentity: string;
376
+ walletAddress?: string | null;
377
+ limits?: BudgetLimits;
378
+ routingPolicy?: RoutingPolicy | null;
379
+ orgRoutingPolicy?: RoutingPolicy | null;
380
+ }): WorkspaceRecord;
381
+ /** Caches the wallet address of every workspace paying with this identity. */
382
+ setWalletAddress(buyerIdentity: string, address: string | null): void;
383
+ updateWorkspace(id: string, patch: {
384
+ name?: string;
385
+ limits?: Partial<BudgetLimits>;
386
+ routingPolicy?: RoutingPolicy | null;
387
+ orgRoutingPolicy?: RoutingPolicy | null;
388
+ }): WorkspaceRecord;
389
+ /** Soft delete: history keeps pointing at it. The default workspace cannot be deleted. */
390
+ deleteWorkspace(id: string): void;
391
+ /**
392
+ * The workspace that pays with this identity, created (named after the
393
+ * identity) when there is none. Keeps `antseed gateway key create
394
+ * --identity/--new-identity` working.
395
+ */
396
+ ensureWorkspaceForIdentity(buyerIdentity: string): WorkspaceRecord;
397
+ countWorkspaceKeys(workspaceId: string, activeOnly?: boolean): number;
398
+ countWorkspaceMembers(workspaceId: string): number;
399
+ workspaceMembers(workspaceId: string): Array<{
400
+ member: MemberRecord;
401
+ role: WorkspaceRole;
402
+ }>;
403
+ setWorkspaceMember(workspaceId: string, memberId: string, role: WorkspaceRole): void;
404
+ removeWorkspaceMember(workspaceId: string, memberId: string): boolean;
405
+ getMember(id: string): MemberRecord | null;
406
+ findMemberByEmail(email: string): MemberRecord | null;
407
+ listMembers(): MemberRecord[];
408
+ /** Workspaces (not deleted) the member belongs to, with their role. */
409
+ memberWorkspaceRoles(memberId: string): Map<string, WorkspaceRole>;
410
+ /** True once an active owner exists. */
411
+ isSetupComplete(): boolean;
412
+ countActiveOwners(): number;
413
+ /** The first owner, created when the console is claimed; admin of the Default workspace. */
414
+ createOwner(input: {
415
+ label: string;
416
+ email: string | null;
417
+ }): MemberRecord;
418
+ private _insertMember;
419
+ updateMember(id: string, patch: {
420
+ label?: string;
421
+ email?: string | null;
422
+ orgRole?: OrgRole;
423
+ limits?: Partial<BudgetLimits>;
424
+ routingPolicy?: RoutingPolicy | null;
425
+ maxKeys?: number | null;
426
+ }): MemberRecord;
427
+ setMemberStatus(id: string, status: MemberStatus): MemberRecord;
428
+ /**
429
+ * Creates the invited member (status 'invited', already in its workspaces)
430
+ * and a single-use link token, of which only the SHA-256 is stored.
431
+ */
432
+ createInvite(input: {
433
+ label: string;
434
+ email: string | null;
435
+ orgRole: OrgRole;
436
+ workspaces: Array<{
437
+ workspaceId: string;
438
+ role: WorkspaceRole;
439
+ }>;
440
+ expiresAt: number;
441
+ createdBy: string | null;
442
+ }): {
443
+ invite: InviteRecord;
444
+ token: string;
445
+ };
446
+ getInvite(id: string): InviteRecord | null;
447
+ /** Invites not yet used (expired ones included, so they can be cleaned up). */
448
+ listInvites(): InviteRecord[];
449
+ /** Deletes an unused invite and the member it created, if that member never joined. */
450
+ deleteInvite(id: string): boolean;
451
+ /** The invite behind a token hash while it is usable, without consuming it. */
452
+ peekInvite(tokenHash: string, now: number): {
453
+ invite: InviteRecord;
454
+ member: MemberRecord;
455
+ } | null;
456
+ /** Token hash of a member's newest live (unused, unexpired) invite, for SSO activation by email. */
457
+ liveInviteHash(memberId: string, now: number): string | null;
458
+ /** Why an invite token is not usable: already used, expired, or unknown (also for a live one). */
459
+ inviteState(tokenHash: string, now: number): 'used' | 'expired' | 'unknown';
460
+ /** Marks the invite used and its member active; null when the token is unknown, used or expired. */
461
+ consumeInvite(tokenHash: string, now: number): MemberRecord | null;
462
+ /**
463
+ * Creates a key in `workspaceId`, or, for callers that only name an
464
+ * identity (the CLI), in the workspace paying with that identity.
465
+ */
70
466
  createKey(input: {
71
467
  label: string;
72
- buyerIdentity: string;
468
+ buyerIdentity?: string;
469
+ workspaceId?: string;
470
+ ownerMemberId?: string | null;
73
471
  limits: SpendLimits;
472
+ routingPolicy?: RoutingPolicy | null;
473
+ ownerLimits?: BudgetLimits;
474
+ ownerRoutingPolicy?: RoutingPolicy | null;
74
475
  expiresAt: number | null;
75
476
  topupEnabled?: boolean;
76
477
  }): {
@@ -91,24 +492,208 @@ export declare class GatewayStore {
91
492
  retireEnvironmentKey(): ApiKeyRecord | null;
92
493
  findKeyBySecret(secret: string): ApiKeyRecord | null;
93
494
  getKey(id: string): ApiKeyRecord | null;
94
- listKeys(): ApiKeyRecord[];
495
+ listKeys(filter?: {
496
+ workspaceId?: string;
497
+ ownerMemberId?: string;
498
+ }): ApiKeyRecord[];
95
499
  countActiveKeys(): number;
500
+ countActiveKeysForMember(memberId: string): number;
96
501
  setLimits(id: string, limits: Partial<SpendLimits>): ApiKeyRecord;
97
502
  setTopupEnabled(id: string, enabled: boolean): ApiKeyRecord;
503
+ updateKey(id: string, patch: {
504
+ label?: string;
505
+ limits?: Partial<BudgetLimits>;
506
+ routingPolicy?: RoutingPolicy | null;
507
+ ownerLimits?: Partial<BudgetLimits>;
508
+ ownerRoutingPolicy?: RoutingPolicy | null;
509
+ topupEnabled?: boolean;
510
+ expiresAt?: number | null;
511
+ ownerMemberId?: string | null;
512
+ }): ApiKeyRecord;
513
+ /** New secret for the same key id; usage history, limits and policy stay. */
514
+ rotateKey(id: string): {
515
+ key: ApiKeyRecord;
516
+ secret: string;
517
+ };
98
518
  revokeKey(id: string): ApiKeyRecord;
519
+ /** Revokes every active key a member owns; returns their ids. */
520
+ revokeMemberKeys(memberId: string): string[];
521
+ /** Records use at most once a minute per key (per process), so requests do not each write. */
99
522
  touchKey(id: string): void;
523
+ private _shouldTouch;
100
524
  startRequest(input: GatewayRequestStart): void;
525
+ /** `error` is kept for failed requests (code ≤ 100, message ≤ 500 characters). */
101
526
  finishRequest(tag: string, result: {
102
527
  status: number;
103
528
  buyerRequestId: string | null;
529
+ error?: RequestError | null;
104
530
  }): void;
531
+ /** Seller, latency and end user of a request; null fields leave what is stored. */
532
+ recordRequestOutcome(tag: string, outcome: RequestOutcome): void;
533
+ /**
534
+ * The token counts the response itself reported, read by the gateway as it
535
+ * streamed past. Usage falls back to them while (or if ever) the request
536
+ * has no spend with token counts in the ledger, so they never add up twice.
537
+ */
538
+ recordResponseUsage(tag: string, usage: ResponseTokenCounts): void;
539
+ /** Only called while content logging is on. */
540
+ recordRequestContent(tag: string, content: {
541
+ requestBody?: string | null;
542
+ responseBody?: string | null;
543
+ }): void;
544
+ /** Forgets every stored request and response body; for when content logging is turned off. */
545
+ clearRequestContent(): number;
546
+ /**
547
+ * Drops request-log rows started before `before`, `chunkSize` rows per
548
+ * transaction so a large backlog never holds the write lock for long. Their
549
+ * request counts move into `request_rollups` (per hour, key, workspace,
550
+ * member, model, seller and end user) so usage reports keep counting them;
551
+ * spend and tokens live in the ledger, which is never pruned. Pruned
552
+ * periods are therefore counted at hour granularity. Yields to the event
553
+ * loop between chunks, so requests keep flowing while a backlog drains.
554
+ */
555
+ pruneRequests(before: number, chunkSize?: number): Promise<number>;
556
+ /** Who a request was attributed to when it started. */
105
557
  findRequest(tag: string): {
106
558
  keyId: string;
107
559
  buyerIdentity: string;
560
+ workspaceId: string | null;
561
+ memberId: string | null;
562
+ model: string | null;
563
+ endUser: string | null;
108
564
  } | null;
109
- /** Returns false when the entry was already recorded (same externalRef). */
565
+ /** Requests per seller since a time, with the median latency this gateway measured. */
566
+ peerStats(sinceMs: number): Array<{
567
+ peerId: string;
568
+ requests: number;
569
+ latencyMsP50: number | null;
570
+ }>;
571
+ /** Newest first, ordered by (startedAt, tag); pass the last row as `before` for the next page. Bodies are not read. */
572
+ listRequests(filter: RequestLogFilter): RequestLogRow[];
573
+ /** One request with its bodies; `keyIds` limits it to what the caller may see. */
574
+ getRequest(tag: string, keyIds?: readonly string[] | null): RequestDetailRow | null;
575
+ /** The page of requests first, then one grouped ledger read for just those tags. */
576
+ private _requestRows;
577
+ /**
578
+ * Totals plus one row per group (each split by `splitBy` when given),
579
+ * attributed as at request time. Request counts come from the request log
580
+ * plus the rollups of pruned rows; spend and tokens from the ledger, and
581
+ * the tokens of requests whose spend carries none (not reported yet, or
582
+ * never) from the usage their responses reported.
583
+ */
584
+ usageReport(filter: UsageFilter, groupBy: UsageGroupBy | null, splitBy?: UsageGroupBy | null): {
585
+ totals: UsageTotalsRow;
586
+ groups: UsageGroupRow[];
587
+ };
588
+ /**
589
+ * Returns false when the entry was already recorded (same externalRef).
590
+ * The entry is attributed to the workspace, member, model and end user of
591
+ * its request (or, without one, of its key as it is now) unless given.
592
+ */
110
593
  recordLedgerEntry(entry: LedgerEntryInput): boolean;
111
- periodSpend(keyId: string, now?: number): PeriodSpend;
594
+ /** A key's spend for the periods `antseed gateway key` shows. */
595
+ periodSpend(keyId: string, now?: number): Record<LimitPeriod, number>;
596
+ /**
597
+ * Settled spend per budget period of a key, member or workspace, as
598
+ * attributed when it was spent. Only `periods` are summed (the rest are 0),
599
+ * in one indexed query.
600
+ */
601
+ spendByPeriod(scope: BudgetScope, now?: number, periods?: readonly BudgetPeriod[]): BudgetSpend;
112
602
  usageStats(keyId: string, since?: number): KeyUsageStats;
603
+ /**
604
+ * Lifetime requests and spend, plus spend since `since`, for many keys in
605
+ * one grouped query per table (rather than `usageStats` per key). Every
606
+ * id asked for gets an entry.
607
+ */
608
+ keyUsageSummaries(keyIds: readonly string[], since: number): Map<string, KeyUsageSummary>;
609
+ listPeerLists(): PeerListRecord[];
610
+ getPeerList(id: string): PeerListRecord | null;
611
+ createPeerList(input: {
612
+ name: string;
613
+ description: string | null;
614
+ peerIds: string[];
615
+ }): PeerListRecord;
616
+ updatePeerList(id: string, patch: {
617
+ name?: string;
618
+ description?: string | null;
619
+ peerIds?: string[];
620
+ }): PeerListRecord;
621
+ deletePeerList(id: string): boolean;
622
+ listPresets(): PresetRecord[];
623
+ getPreset(id: string): PresetRecord | null;
624
+ /**
625
+ * An org-wide preset wins over a workspace's own with the same slug, so a
626
+ * workspace admin cannot replace an org-mandated preset (and its system
627
+ * prompt) for their workspace.
628
+ */
629
+ findPresetBySlug(slug: string, workspaceId: string | null): PresetRecord | null;
630
+ createPreset(input: Omit<PresetRecord, 'id' | 'createdAt'>): PresetRecord;
631
+ updatePreset(id: string, patch: Partial<Omit<PresetRecord, 'id' | 'createdAt' | 'workspaceId'>>): PresetRecord;
632
+ deletePreset(id: string): boolean;
633
+ /**
634
+ * `createdBy` is the creating member's id (null from the CLI); the token
635
+ * stops working when that member is no longer an active admin or owner.
636
+ * `expiresAt` null never expires.
637
+ */
638
+ createAdminToken(input: {
639
+ label: string;
640
+ scope: 'admin' | 'read';
641
+ createdBy: string | null;
642
+ expiresAt?: number | null;
643
+ }): {
644
+ token: AdminTokenRecord;
645
+ secret: string;
646
+ };
647
+ getAdminToken(id: string): AdminTokenRecord | null;
648
+ listAdminTokens(): AdminTokenRecord[];
649
+ /** Active token for a presented secret (hash lookup). */
650
+ findAdminTokenBySecret(secret: string): AdminTokenRecord | null;
651
+ /** Like `touchKey`: at most once a minute per token. */
652
+ touchAdminToken(id: string): void;
653
+ revokeAdminToken(id: string): boolean;
654
+ /** Revokes every token a member created (when they are disabled or lose admin); returns their ids. */
655
+ revokeAdminTokensCreatedBy(memberId: string): string[];
656
+ /**
657
+ * Appends one audit entry. Every mutating console action calls this:
658
+ *
659
+ * deps.store.recordAudit({ actor, action, target, details, ip })
660
+ *
661
+ * `actor` comes from `auditActor(store, principal)` in console-api/access.ts
662
+ * (`{ kind: 'cli', id: null }` from CLI commands), `ip` from
663
+ * `clientIp(request)`. `details` must never contain secrets.
664
+ */
665
+ recordAudit(input: AuditInput): AuditRecord;
666
+ /** Newest first. `before` is the opaque cursor returned as `nextBefore`. */
667
+ listAudit(filter?: {
668
+ before?: string | null;
669
+ limit?: number;
670
+ actorId?: string | null;
671
+ action?: string | null;
672
+ }): {
673
+ entries: AuditRecord[];
674
+ nextBefore: string | null;
675
+ };
676
+ /** A member's or a key's conversations in a workspace, newest first (without their messages). */
677
+ listChatThreads(owner: ChatThreadOwner, limit?: number): ChatThreadSummary[];
678
+ getChatThread(id: string): ChatThreadRecord | null;
679
+ /** Creates or replaces a conversation; the owner and creation time of an existing one never change. */
680
+ saveChatThread(input: {
681
+ id: string;
682
+ owner: ChatThreadOwner;
683
+ title: string;
684
+ model: string | null;
685
+ peerId: string | null;
686
+ messages: unknown[];
687
+ }): void;
688
+ deleteChatThread(id: string): boolean;
689
+ /**
690
+ * Settings are read on every request, so values are cached for a few
691
+ * seconds. A write through this store clears its cache at once; a write by
692
+ * another process (a CLI command) is seen within `SETTINGS_TTL_MS`.
693
+ */
694
+ getSetting<T>(key: string): T | null;
695
+ setSetting(key: string, value: unknown): void;
113
696
  }
697
+ /** Groupings whose groups are UTC time buckets (listed oldest first). */
698
+ export declare function isTimeGrouping(groupBy: UsageGroupBy): boolean;
114
699
  //# sourceMappingURL=store.d.ts.map