@antseed/cli 0.1.178 → 0.1.180
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.
- package/README.md +5 -0
- package/dist/buyer-identities/store.d.ts +39 -2
- package/dist/buyer-identities/store.d.ts.map +1 -1
- package/dist/buyer-identities/store.js +99 -10
- package/dist/buyer-identities/store.js.map +1 -1
- package/dist/cli/commands/apps/index.d.ts +42 -0
- package/dist/cli/commands/apps/index.d.ts.map +1 -0
- package/dist/cli/commands/apps/index.js +224 -0
- package/dist/cli/commands/apps/index.js.map +1 -0
- package/dist/cli/commands/apps/index.test.d.ts +2 -0
- package/dist/cli/commands/apps/index.test.d.ts.map +1 -0
- package/dist/cli/commands/apps/index.test.js +206 -0
- package/dist/cli/commands/apps/index.test.js.map +1 -0
- package/dist/cli/commands/buyer/deposit.d.ts.map +1 -1
- package/dist/cli/commands/buyer/deposit.js +9 -1
- package/dist/cli/commands/buyer/deposit.js.map +1 -1
- package/dist/cli/commands/buyer/identity.d.ts +3 -1
- package/dist/cli/commands/buyer/identity.d.ts.map +1 -1
- package/dist/cli/commands/buyer/identity.js +55 -8
- package/dist/cli/commands/buyer/identity.js.map +1 -1
- package/dist/cli/commands/buyer/identity.test.d.ts +2 -0
- package/dist/cli/commands/buyer/identity.test.d.ts.map +1 -0
- package/dist/cli/commands/buyer/identity.test.js +168 -0
- package/dist/cli/commands/buyer/identity.test.js.map +1 -0
- package/dist/cli/commands/buyer/set-authorized-wallet.d.ts +10 -0
- package/dist/cli/commands/buyer/set-authorized-wallet.d.ts.map +1 -1
- package/dist/cli/commands/buyer/set-authorized-wallet.js +26 -4
- package/dist/cli/commands/buyer/set-authorized-wallet.js.map +1 -1
- package/dist/cli/commands/buyer/set-authorized-wallet.test.js +37 -2
- package/dist/cli/commands/buyer/set-authorized-wallet.test.js.map +1 -1
- package/dist/cli/commands/buyer/start.d.ts +15 -0
- package/dist/cli/commands/buyer/start.d.ts.map +1 -1
- package/dist/cli/commands/buyer/start.js +158 -48
- package/dist/cli/commands/buyer/start.js.map +1 -1
- package/dist/cli/commands/buyer/start.test.js +16 -1
- package/dist/cli/commands/buyer/start.test.js.map +1 -1
- package/dist/cli/commands/chat.d.ts +3 -0
- package/dist/cli/commands/chat.d.ts.map +1 -0
- package/dist/cli/commands/chat.js +189 -0
- package/dist/cli/commands/chat.js.map +1 -0
- package/dist/cli/commands/gateway/activity.d.ts +15 -0
- package/dist/cli/commands/gateway/activity.d.ts.map +1 -0
- package/dist/cli/commands/gateway/activity.js +233 -0
- package/dist/cli/commands/gateway/activity.js.map +1 -0
- package/dist/cli/commands/gateway/admin-token.d.ts +3 -0
- package/dist/cli/commands/gateway/admin-token.d.ts.map +1 -0
- package/dist/cli/commands/gateway/admin-token.js +90 -0
- package/dist/cli/commands/gateway/admin-token.js.map +1 -0
- package/dist/cli/commands/gateway/console-link.d.ts +20 -0
- package/dist/cli/commands/gateway/console-link.d.ts.map +1 -0
- package/dist/cli/commands/gateway/console-link.js +92 -0
- package/dist/cli/commands/gateway/console-link.js.map +1 -0
- package/dist/cli/commands/gateway/gateway-commands.test.d.ts +2 -0
- package/dist/cli/commands/gateway/gateway-commands.test.d.ts.map +1 -0
- package/dist/cli/commands/gateway/gateway-commands.test.js +230 -0
- package/dist/cli/commands/gateway/gateway-commands.test.js.map +1 -0
- package/dist/cli/commands/gateway/gateway-console-commands.test.d.ts +2 -0
- package/dist/cli/commands/gateway/gateway-console-commands.test.d.ts.map +1 -0
- package/dist/cli/commands/gateway/gateway-console-commands.test.js +373 -0
- package/dist/cli/commands/gateway/gateway-console-commands.test.js.map +1 -0
- package/dist/cli/commands/gateway/index.d.ts +8 -0
- package/dist/cli/commands/gateway/index.d.ts.map +1 -1
- package/dist/cli/commands/gateway/index.js +93 -14
- package/dist/cli/commands/gateway/index.js.map +1 -1
- package/dist/cli/commands/gateway/key.d.ts +4 -0
- package/dist/cli/commands/gateway/key.d.ts.map +1 -1
- package/dist/cli/commands/gateway/key.js +297 -182
- package/dist/cli/commands/gateway/key.js.map +1 -1
- package/dist/cli/commands/gateway/member.d.ts +3 -0
- package/dist/cli/commands/gateway/member.d.ts.map +1 -0
- package/dist/cli/commands/gateway/member.js +302 -0
- package/dist/cli/commands/gateway/member.js.map +1 -0
- package/dist/cli/commands/gateway/migrate.d.ts +18 -0
- package/dist/cli/commands/gateway/migrate.d.ts.map +1 -0
- package/dist/cli/commands/gateway/migrate.js +158 -0
- package/dist/cli/commands/gateway/migrate.js.map +1 -0
- package/dist/cli/commands/gateway/operator.d.ts +11 -0
- package/dist/cli/commands/gateway/operator.d.ts.map +1 -0
- package/dist/cli/commands/gateway/operator.js +199 -0
- package/dist/cli/commands/gateway/operator.js.map +1 -0
- package/dist/cli/commands/gateway/operator.test.d.ts +2 -0
- package/dist/cli/commands/gateway/operator.test.d.ts.map +1 -0
- package/dist/cli/commands/gateway/operator.test.js +151 -0
- package/dist/cli/commands/gateway/operator.test.js.map +1 -0
- package/dist/cli/commands/gateway/peer-list.d.ts +3 -0
- package/dist/cli/commands/gateway/peer-list.d.ts.map +1 -0
- package/dist/cli/commands/gateway/peer-list.js +107 -0
- package/dist/cli/commands/gateway/peer-list.js.map +1 -0
- package/dist/cli/commands/gateway/policy-options.d.ts +23 -0
- package/dist/cli/commands/gateway/policy-options.d.ts.map +1 -0
- package/dist/cli/commands/gateway/policy-options.js +156 -0
- package/dist/cli/commands/gateway/policy-options.js.map +1 -0
- package/dist/cli/commands/gateway/preset.d.ts +3 -0
- package/dist/cli/commands/gateway/preset.d.ts.map +1 -0
- package/dist/cli/commands/gateway/preset.js +181 -0
- package/dist/cli/commands/gateway/preset.js.map +1 -0
- package/dist/cli/commands/gateway/routing.d.ts +3 -0
- package/dist/cli/commands/gateway/routing.d.ts.map +1 -0
- package/dist/cli/commands/gateway/routing.js +110 -0
- package/dist/cli/commands/gateway/routing.js.map +1 -0
- package/dist/cli/commands/gateway/settings.d.ts +4 -0
- package/dist/cli/commands/gateway/settings.d.ts.map +1 -0
- package/dist/cli/commands/gateway/settings.js +314 -0
- package/dist/cli/commands/gateway/settings.js.map +1 -0
- package/dist/cli/commands/gateway/shared.d.ts +55 -6
- package/dist/cli/commands/gateway/shared.d.ts.map +1 -1
- package/dist/cli/commands/gateway/shared.js +206 -26
- package/dist/cli/commands/gateway/shared.js.map +1 -1
- package/dist/cli/commands/gateway/workspace.d.ts +3 -0
- package/dist/cli/commands/gateway/workspace.d.ts.map +1 -0
- package/dist/cli/commands/gateway/workspace.js +250 -0
- package/dist/cli/commands/gateway/workspace.js.map +1 -0
- package/dist/cli/commands/tunnel/start.d.ts.map +1 -1
- package/dist/cli/commands/tunnel/start.js +23 -5
- package/dist/cli/commands/tunnel/start.js.map +1 -1
- package/dist/cli/index.js +12 -42
- package/dist/cli/index.js.map +1 -1
- package/dist/cli/program.d.ts +4 -0
- package/dist/cli/program.d.ts.map +1 -0
- package/dist/cli/program.js +49 -0
- package/dist/cli/program.js.map +1 -0
- package/dist/cli/program.test.d.ts +2 -0
- package/dist/cli/program.test.d.ts.map +1 -0
- package/dist/cli/program.test.js +38 -0
- package/dist/cli/program.test.js.map +1 -0
- package/dist/cli/prompt-hidden.d.ts +3 -0
- package/dist/cli/prompt-hidden.d.ts.map +1 -0
- package/dist/cli/prompt-hidden.js +38 -0
- package/dist/cli/prompt-hidden.js.map +1 -0
- package/dist/cli/wallet-passphrase.d.ts +48 -0
- package/dist/cli/wallet-passphrase.d.ts.map +1 -0
- package/dist/cli/wallet-passphrase.js +119 -0
- package/dist/cli/wallet-passphrase.js.map +1 -0
- package/dist/cli/wallet-passphrase.test.d.ts +2 -0
- package/dist/cli/wallet-passphrase.test.d.ts.map +1 -0
- package/dist/cli/wallet-passphrase.test.js +79 -0
- package/dist/cli/wallet-passphrase.test.js.map +1 -0
- package/dist/config/effective.d.ts +12 -0
- package/dist/config/effective.d.ts.map +1 -1
- package/dist/config/effective.js +39 -6
- package/dist/config/effective.js.map +1 -1
- package/dist/config/effective.test.js +9 -1
- package/dist/config/effective.test.js.map +1 -1
- package/dist/config/loader.d.ts +6 -0
- package/dist/config/loader.d.ts.map +1 -1
- package/dist/config/loader.js +12 -0
- package/dist/config/loader.js.map +1 -1
- package/dist/config/loader.test.js +7 -1
- package/dist/config/loader.test.js.map +1 -1
- package/dist/config/types.d.ts +14 -0
- package/dist/config/types.d.ts.map +1 -1
- package/dist/config/validation.d.ts.map +1 -1
- package/dist/config/validation.js +19 -0
- package/dist/config/validation.js.map +1 -1
- package/dist/gateway/accounting.d.ts +33 -3
- package/dist/gateway/accounting.d.ts.map +1 -1
- package/dist/gateway/accounting.js +86 -7
- package/dist/gateway/accounting.js.map +1 -1
- package/dist/gateway/admission-benchmark.test.d.ts +2 -0
- package/dist/gateway/admission-benchmark.test.d.ts.map +1 -0
- package/dist/gateway/admission-benchmark.test.js +75 -0
- package/dist/gateway/admission-benchmark.test.js.map +1 -0
- package/dist/gateway/auth/auth.test.d.ts +4 -0
- package/dist/gateway/auth/auth.test.d.ts.map +1 -0
- package/dist/gateway/auth/auth.test.js +337 -0
- package/dist/gateway/auth/auth.test.js.map +1 -0
- package/dist/gateway/auth/credentials.test.d.ts +2 -0
- package/dist/gateway/auth/credentials.test.d.ts.map +1 -0
- package/dist/gateway/auth/credentials.test.js +132 -0
- package/dist/gateway/auth/credentials.test.js.map +1 -0
- package/dist/gateway/auth/db.d.ts +156 -0
- package/dist/gateway/auth/db.d.ts.map +1 -0
- package/dist/gateway/auth/db.js +390 -0
- package/dist/gateway/auth/db.js.map +1 -0
- package/dist/gateway/auth/hardening.test.d.ts +2 -0
- package/dist/gateway/auth/hardening.test.d.ts.map +1 -0
- package/dist/gateway/auth/hardening.test.js +155 -0
- package/dist/gateway/auth/hardening.test.js.map +1 -0
- package/dist/gateway/auth/http.d.ts +53 -0
- package/dist/gateway/auth/http.d.ts.map +1 -0
- package/dist/gateway/auth/http.js +165 -0
- package/dist/gateway/auth/http.js.map +1 -0
- package/dist/gateway/auth/index.d.ts +26 -0
- package/dist/gateway/auth/index.d.ts.map +1 -0
- package/dist/gateway/auth/index.js +1014 -0
- package/dist/gateway/auth/index.js.map +1 -0
- package/dist/gateway/auth/oidc.d.ts +57 -0
- package/dist/gateway/auth/oidc.d.ts.map +1 -0
- package/dist/gateway/auth/oidc.js +159 -0
- package/dist/gateway/auth/oidc.js.map +1 -0
- package/dist/gateway/auth/oidc.test.d.ts +2 -0
- package/dist/gateway/auth/oidc.test.d.ts.map +1 -0
- package/dist/gateway/auth/oidc.test.js +223 -0
- package/dist/gateway/auth/oidc.test.js.map +1 -0
- package/dist/gateway/auth/reauth.test.d.ts +2 -0
- package/dist/gateway/auth/reauth.test.d.ts.map +1 -0
- package/dist/gateway/auth/reauth.test.js +108 -0
- package/dist/gateway/auth/reauth.test.js.map +1 -0
- package/dist/gateway/auth/store-integration.test.d.ts +2 -0
- package/dist/gateway/auth/store-integration.test.d.ts.map +1 -0
- package/dist/gateway/auth/store-integration.test.js +100 -0
- package/dist/gateway/auth/store-integration.test.js.map +1 -0
- package/dist/gateway/auth/test-helpers.d.ts +167 -0
- package/dist/gateway/auth/test-helpers.d.ts.map +1 -0
- package/dist/gateway/auth/test-helpers.js +368 -0
- package/dist/gateway/auth/test-helpers.js.map +1 -0
- package/dist/gateway/auth/types.d.ts +145 -0
- package/dist/gateway/auth/types.d.ts.map +1 -0
- package/dist/gateway/auth/types.js +2 -0
- package/dist/gateway/auth/types.js.map +1 -0
- package/dist/gateway/auth/wallet.d.ts +15 -0
- package/dist/gateway/auth/wallet.d.ts.map +1 -0
- package/dist/gateway/auth/wallet.js +43 -0
- package/dist/gateway/auth/wallet.js.map +1 -0
- package/dist/gateway/bundle.d.ts +127 -0
- package/dist/gateway/bundle.d.ts.map +1 -0
- package/dist/gateway/bundle.js +604 -0
- package/dist/gateway/bundle.js.map +1 -0
- package/dist/gateway/bundle.test.d.ts +2 -0
- package/dist/gateway/bundle.test.d.ts.map +1 -0
- package/dist/gateway/bundle.test.js +277 -0
- package/dist/gateway/bundle.test.js.map +1 -0
- package/dist/gateway/buyer-control.d.ts +33 -0
- package/dist/gateway/buyer-control.d.ts.map +1 -0
- package/dist/gateway/buyer-control.js +93 -0
- package/dist/gateway/buyer-control.js.map +1 -0
- package/dist/gateway/buyer-policy-probe.d.ts +41 -0
- package/dist/gateway/buyer-policy-probe.d.ts.map +1 -0
- package/dist/gateway/buyer-policy-probe.js +99 -0
- package/dist/gateway/buyer-policy-probe.js.map +1 -0
- package/dist/gateway/buyer-policy-probe.test.d.ts +2 -0
- package/dist/gateway/buyer-policy-probe.test.d.ts.map +1 -0
- package/dist/gateway/buyer-policy-probe.test.js +128 -0
- package/dist/gateway/buyer-policy-probe.test.js.map +1 -0
- package/dist/gateway/buyer-process.d.ts +30 -0
- package/dist/gateway/buyer-process.d.ts.map +1 -0
- package/dist/gateway/buyer-process.js +101 -0
- package/dist/gateway/buyer-process.js.map +1 -0
- package/dist/gateway/buyer-process.test.d.ts +2 -0
- package/dist/gateway/buyer-process.test.d.ts.map +1 -0
- package/dist/gateway/buyer-process.test.js +112 -0
- package/dist/gateway/buyer-process.test.js.map +1 -0
- package/dist/gateway/chat/routes.d.ts +45 -0
- package/dist/gateway/chat/routes.d.ts.map +1 -0
- package/dist/gateway/chat/routes.js +439 -0
- package/dist/gateway/chat/routes.js.map +1 -0
- package/dist/gateway/chat/routes.test.d.ts +2 -0
- package/dist/gateway/chat/routes.test.d.ts.map +1 -0
- package/dist/gateway/chat/routes.test.js +304 -0
- package/dist/gateway/chat/routes.test.js.map +1 -0
- package/dist/gateway/chat/tools.d.ts +35 -0
- package/dist/gateway/chat/tools.d.ts.map +1 -0
- package/dist/gateway/chat/tools.js +347 -0
- package/dist/gateway/chat/tools.js.map +1 -0
- package/dist/gateway/chat/tools.test.d.ts +2 -0
- package/dist/gateway/chat/tools.test.d.ts.map +1 -0
- package/dist/gateway/chat/tools.test.js +136 -0
- package/dist/gateway/chat/tools.test.js.map +1 -0
- package/dist/gateway/console-api/access.d.ts +52 -0
- package/dist/gateway/console-api/access.d.ts.map +1 -0
- package/dist/gateway/console-api/access.js +171 -0
- package/dist/gateway/console-api/access.js.map +1 -0
- package/dist/gateway/console-api/deps.d.ts +52 -0
- package/dist/gateway/console-api/deps.d.ts.map +1 -0
- package/dist/gateway/console-api/deps.js +2 -0
- package/dist/gateway/console-api/deps.js.map +1 -0
- package/dist/gateway/console-api/handlers/admin-tokens.d.ts +8 -0
- package/dist/gateway/console-api/handlers/admin-tokens.d.ts.map +1 -0
- package/dist/gateway/console-api/handlers/admin-tokens.js +48 -0
- package/dist/gateway/console-api/handlers/admin-tokens.js.map +1 -0
- package/dist/gateway/console-api/handlers/audit.d.ts +8 -0
- package/dist/gateway/console-api/handlers/audit.d.ts.map +1 -0
- package/dist/gateway/console-api/handlers/audit.js +19 -0
- package/dist/gateway/console-api/handlers/audit.js.map +1 -0
- package/dist/gateway/console-api/handlers/audit.test.d.ts +2 -0
- package/dist/gateway/console-api/handlers/audit.test.d.ts.map +1 -0
- package/dist/gateway/console-api/handlers/audit.test.js +241 -0
- package/dist/gateway/console-api/handlers/audit.test.js.map +1 -0
- package/dist/gateway/console-api/handlers/data-settings.test.d.ts +2 -0
- package/dist/gateway/console-api/handlers/data-settings.test.d.ts.map +1 -0
- package/dist/gateway/console-api/handlers/data-settings.test.js +264 -0
- package/dist/gateway/console-api/handlers/data-settings.test.js.map +1 -0
- package/dist/gateway/console-api/handlers/index.d.ts +4 -0
- package/dist/gateway/console-api/handlers/index.d.ts.map +1 -0
- package/dist/gateway/console-api/handlers/index.js +24 -0
- package/dist/gateway/console-api/handlers/index.js.map +1 -0
- package/dist/gateway/console-api/handlers/keys.d.ts +13 -0
- package/dist/gateway/console-api/handlers/keys.d.ts.map +1 -0
- package/dist/gateway/console-api/handlers/keys.js +128 -0
- package/dist/gateway/console-api/handlers/keys.js.map +1 -0
- package/dist/gateway/console-api/handlers/keys.test.d.ts +2 -0
- package/dist/gateway/console-api/handlers/keys.test.d.ts.map +1 -0
- package/dist/gateway/console-api/handlers/keys.test.js +166 -0
- package/dist/gateway/console-api/handlers/keys.test.js.map +1 -0
- package/dist/gateway/console-api/handlers/network-buyer.d.ts +22 -0
- package/dist/gateway/console-api/handlers/network-buyer.d.ts.map +1 -0
- package/dist/gateway/console-api/handlers/network-buyer.js +39 -0
- package/dist/gateway/console-api/handlers/network-buyer.js.map +1 -0
- package/dist/gateway/console-api/handlers/network-mapping.d.ts +33 -0
- package/dist/gateway/console-api/handlers/network-mapping.d.ts.map +1 -0
- package/dist/gateway/console-api/handlers/network-mapping.js +219 -0
- package/dist/gateway/console-api/handlers/network-mapping.js.map +1 -0
- package/dist/gateway/console-api/handlers/network-test-helpers.d.ts +35 -0
- package/dist/gateway/console-api/handlers/network-test-helpers.d.ts.map +1 -0
- package/dist/gateway/console-api/handlers/network-test-helpers.js +121 -0
- package/dist/gateway/console-api/handlers/network-test-helpers.js.map +1 -0
- package/dist/gateway/console-api/handlers/network.d.ts +15 -0
- package/dist/gateway/console-api/handlers/network.d.ts.map +1 -0
- package/dist/gateway/console-api/handlers/network.js +57 -0
- package/dist/gateway/console-api/handlers/network.js.map +1 -0
- package/dist/gateway/console-api/handlers/network.test.d.ts +2 -0
- package/dist/gateway/console-api/handlers/network.test.d.ts.map +1 -0
- package/dist/gateway/console-api/handlers/network.test.js +383 -0
- package/dist/gateway/console-api/handlers/network.test.js.map +1 -0
- package/dist/gateway/console-api/handlers/org.d.ts +10 -0
- package/dist/gateway/console-api/handlers/org.d.ts.map +1 -0
- package/dist/gateway/console-api/handlers/org.js +150 -0
- package/dist/gateway/console-api/handlers/org.js.map +1 -0
- package/dist/gateway/console-api/handlers/peer-lists.d.ts +5 -0
- package/dist/gateway/console-api/handlers/peer-lists.d.ts.map +1 -0
- package/dist/gateway/console-api/handlers/peer-lists.js +43 -0
- package/dist/gateway/console-api/handlers/peer-lists.js.map +1 -0
- package/dist/gateway/console-api/handlers/presets.d.ts +9 -0
- package/dist/gateway/console-api/handlers/presets.d.ts.map +1 -0
- package/dist/gateway/console-api/handlers/presets.js +79 -0
- package/dist/gateway/console-api/handlers/presets.js.map +1 -0
- package/dist/gateway/console-api/handlers/routing.d.ts +5 -0
- package/dist/gateway/console-api/handlers/routing.d.ts.map +1 -0
- package/dist/gateway/console-api/handlers/routing.js +20 -0
- package/dist/gateway/console-api/handlers/routing.js.map +1 -0
- package/dist/gateway/console-api/handlers/settings.d.ts +10 -0
- package/dist/gateway/console-api/handlers/settings.d.ts.map +1 -0
- package/dist/gateway/console-api/handlers/settings.js +38 -0
- package/dist/gateway/console-api/handlers/settings.js.map +1 -0
- package/dist/gateway/console-api/handlers/status.d.ts +9 -0
- package/dist/gateway/console-api/handlers/status.d.ts.map +1 -0
- package/dist/gateway/console-api/handlers/status.js +47 -0
- package/dist/gateway/console-api/handlers/status.js.map +1 -0
- package/dist/gateway/console-api/handlers/status.test.d.ts +2 -0
- package/dist/gateway/console-api/handlers/status.test.d.ts.map +1 -0
- package/dist/gateway/console-api/handlers/status.test.js +82 -0
- package/dist/gateway/console-api/handlers/status.test.js.map +1 -0
- package/dist/gateway/console-api/handlers/usage.d.ts +10 -0
- package/dist/gateway/console-api/handlers/usage.d.ts.map +1 -0
- package/dist/gateway/console-api/handlers/usage.js +68 -0
- package/dist/gateway/console-api/handlers/usage.js.map +1 -0
- package/dist/gateway/console-api/handlers/wallet-card-link.d.ts +29 -0
- package/dist/gateway/console-api/handlers/wallet-card-link.d.ts.map +1 -0
- package/dist/gateway/console-api/handlers/wallet-card-link.js +46 -0
- package/dist/gateway/console-api/handlers/wallet-card-link.js.map +1 -0
- package/dist/gateway/console-api/handlers/wallet-chain.d.ts +26 -0
- package/dist/gateway/console-api/handlers/wallet-chain.d.ts.map +1 -0
- package/dist/gateway/console-api/handlers/wallet-chain.js +80 -0
- package/dist/gateway/console-api/handlers/wallet-chain.js.map +1 -0
- package/dist/gateway/console-api/handlers/wallet-mapping.d.ts +45 -0
- package/dist/gateway/console-api/handlers/wallet-mapping.d.ts.map +1 -0
- package/dist/gateway/console-api/handlers/wallet-mapping.js +202 -0
- package/dist/gateway/console-api/handlers/wallet-mapping.js.map +1 -0
- package/dist/gateway/console-api/handlers/wallet-operator.d.ts +41 -0
- package/dist/gateway/console-api/handlers/wallet-operator.d.ts.map +1 -0
- package/dist/gateway/console-api/handlers/wallet-operator.js +198 -0
- package/dist/gateway/console-api/handlers/wallet-operator.js.map +1 -0
- package/dist/gateway/console-api/handlers/wallet-operator.test.d.ts +2 -0
- package/dist/gateway/console-api/handlers/wallet-operator.test.d.ts.map +1 -0
- package/dist/gateway/console-api/handlers/wallet-operator.test.js +195 -0
- package/dist/gateway/console-api/handlers/wallet-operator.test.js.map +1 -0
- package/dist/gateway/console-api/handlers/wallet.d.ts +61 -0
- package/dist/gateway/console-api/handlers/wallet.d.ts.map +1 -0
- package/dist/gateway/console-api/handlers/wallet.js +221 -0
- package/dist/gateway/console-api/handlers/wallet.js.map +1 -0
- package/dist/gateway/console-api/handlers/wallet.test.d.ts +2 -0
- package/dist/gateway/console-api/handlers/wallet.test.d.ts.map +1 -0
- package/dist/gateway/console-api/handlers/wallet.test.js +581 -0
- package/dist/gateway/console-api/handlers/wallet.test.js.map +1 -0
- package/dist/gateway/console-api/handlers/workspaces.d.ts +12 -0
- package/dist/gateway/console-api/handlers/workspaces.d.ts.map +1 -0
- package/dist/gateway/console-api/handlers/workspaces.js +96 -0
- package/dist/gateway/console-api/handlers/workspaces.js.map +1 -0
- package/dist/gateway/console-api/operator-types.d.ts +68 -0
- package/dist/gateway/console-api/operator-types.d.ts.map +1 -0
- package/dist/gateway/console-api/operator-types.js +21 -0
- package/dist/gateway/console-api/operator-types.js.map +1 -0
- package/dist/gateway/console-api/router.d.ts +97 -0
- package/dist/gateway/console-api/router.d.ts.map +1 -0
- package/dist/gateway/console-api/router.js +69 -0
- package/dist/gateway/console-api/router.js.map +1 -0
- package/dist/gateway/console-api/routes.test.d.ts +2 -0
- package/dist/gateway/console-api/routes.test.d.ts.map +1 -0
- package/dist/gateway/console-api/routes.test.js +331 -0
- package/dist/gateway/console-api/routes.test.js.map +1 -0
- package/dist/gateway/console-api/serialize.d.ts +33 -0
- package/dist/gateway/console-api/serialize.d.ts.map +1 -0
- package/dist/gateway/console-api/serialize.js +179 -0
- package/dist/gateway/console-api/serialize.js.map +1 -0
- package/dist/gateway/console-api/server.d.ts +38 -0
- package/dist/gateway/console-api/server.d.ts.map +1 -0
- package/dist/gateway/console-api/server.js +308 -0
- package/dist/gateway/console-api/server.js.map +1 -0
- package/dist/gateway/console-api/server.test.d.ts +2 -0
- package/dist/gateway/console-api/server.test.d.ts.map +1 -0
- package/dist/gateway/console-api/server.test.js +149 -0
- package/dist/gateway/console-api/server.test.js.map +1 -0
- package/dist/gateway/console-api/test-support.d.ts +59 -0
- package/dist/gateway/console-api/test-support.d.ts.map +1 -0
- package/dist/gateway/console-api/test-support.js +120 -0
- package/dist/gateway/console-api/test-support.js.map +1 -0
- package/dist/gateway/console-api/types.d.ts +779 -0
- package/dist/gateway/console-api/types.d.ts.map +1 -0
- package/dist/gateway/console-api/types.js +6 -0
- package/dist/gateway/console-api/types.js.map +1 -0
- package/dist/gateway/console-location.d.ts +21 -0
- package/dist/gateway/console-location.d.ts.map +1 -0
- package/dist/gateway/console-location.js +41 -0
- package/dist/gateway/console-location.js.map +1 -0
- package/dist/gateway/console-recovery.d.ts +34 -0
- package/dist/gateway/console-recovery.d.ts.map +1 -0
- package/dist/gateway/console-recovery.js +94 -0
- package/dist/gateway/console-recovery.js.map +1 -0
- package/dist/gateway/console-recovery.test.d.ts +2 -0
- package/dist/gateway/console-recovery.test.d.ts.map +1 -0
- package/dist/gateway/console-recovery.test.js +106 -0
- package/dist/gateway/console-recovery.test.js.map +1 -0
- package/dist/gateway/console.d.ts +18 -0
- package/dist/gateway/console.d.ts.map +1 -0
- package/dist/gateway/console.js +101 -0
- package/dist/gateway/console.js.map +1 -0
- package/dist/gateway/console.test.d.ts +2 -0
- package/dist/gateway/console.test.d.ts.map +1 -0
- package/dist/gateway/console.test.js +165 -0
- package/dist/gateway/console.test.js.map +1 -0
- package/dist/gateway/errors.d.ts +3 -0
- package/dist/gateway/errors.d.ts.map +1 -0
- package/dist/gateway/errors.js +5 -0
- package/dist/gateway/errors.js.map +1 -0
- package/dist/gateway/exposure.d.ts +33 -0
- package/dist/gateway/exposure.d.ts.map +1 -0
- package/dist/gateway/exposure.js +146 -0
- package/dist/gateway/exposure.js.map +1 -0
- package/dist/gateway/exposure.test.d.ts +2 -0
- package/dist/gateway/exposure.test.d.ts.map +1 -0
- package/dist/gateway/exposure.test.js +93 -0
- package/dist/gateway/exposure.test.js.map +1 -0
- package/dist/gateway/gateway-policy.test.d.ts +2 -0
- package/dist/gateway/gateway-policy.test.d.ts.map +1 -0
- package/dist/gateway/gateway-policy.test.js +404 -0
- package/dist/gateway/gateway-policy.test.js.map +1 -0
- package/dist/gateway/gateway.test.js +77 -24
- package/dist/gateway/gateway.test.js.map +1 -1
- package/dist/gateway/keys.d.ts +2 -0
- package/dist/gateway/keys.d.ts.map +1 -1
- package/dist/gateway/keys.js +2 -0
- package/dist/gateway/keys.js.map +1 -1
- package/dist/gateway/limits.d.ts +32 -8
- package/dist/gateway/limits.d.ts.map +1 -1
- package/dist/gateway/limits.js +27 -11
- package/dist/gateway/limits.js.map +1 -1
- package/dist/gateway/observability.d.ts +51 -0
- package/dist/gateway/observability.d.ts.map +1 -0
- package/dist/gateway/observability.js +136 -0
- package/dist/gateway/observability.js.map +1 -0
- package/dist/gateway/policy-resolver.d.ts +73 -0
- package/dist/gateway/policy-resolver.d.ts.map +1 -0
- package/dist/gateway/policy-resolver.js +142 -0
- package/dist/gateway/policy-resolver.js.map +1 -0
- package/dist/gateway/policy-resolver.test.d.ts +2 -0
- package/dist/gateway/policy-resolver.test.d.ts.map +1 -0
- package/dist/gateway/policy-resolver.test.js +273 -0
- package/dist/gateway/policy-resolver.test.js.map +1 -0
- package/dist/gateway/request-errors.test.d.ts +2 -0
- package/dist/gateway/request-errors.test.d.ts.map +1 -0
- package/dist/gateway/request-errors.test.js +108 -0
- package/dist/gateway/request-errors.test.js.map +1 -0
- package/dist/gateway/request-shaping.d.ts +25 -0
- package/dist/gateway/request-shaping.d.ts.map +1 -0
- package/dist/gateway/request-shaping.js +66 -0
- package/dist/gateway/request-shaping.js.map +1 -0
- package/dist/gateway/response-usage.d.ts +35 -0
- package/dist/gateway/response-usage.d.ts.map +1 -0
- package/dist/gateway/response-usage.js +167 -0
- package/dist/gateway/response-usage.js.map +1 -0
- package/dist/gateway/response-usage.test.d.ts +2 -0
- package/dist/gateway/response-usage.test.d.ts.map +1 -0
- package/dist/gateway/response-usage.test.js +78 -0
- package/dist/gateway/response-usage.test.js.map +1 -0
- package/dist/gateway/runtime.d.ts +25 -0
- package/dist/gateway/runtime.d.ts.map +1 -1
- package/dist/gateway/runtime.js +39 -19
- package/dist/gateway/runtime.js.map +1 -1
- package/dist/gateway/server.d.ts +68 -2
- package/dist/gateway/server.d.ts.map +1 -1
- package/dist/gateway/server.js +533 -114
- package/dist/gateway/server.js.map +1 -1
- package/dist/gateway/services/audit.d.ts +16 -0
- package/dist/gateway/services/audit.d.ts.map +1 -0
- package/dist/gateway/services/audit.js +18 -0
- package/dist/gateway/services/audit.js.map +1 -0
- package/dist/gateway/services/context.d.ts +66 -0
- package/dist/gateway/services/context.d.ts.map +1 -0
- package/dist/gateway/services/context.js +52 -0
- package/dist/gateway/services/context.js.map +1 -0
- package/dist/gateway/services/keys.d.ts +78 -0
- package/dist/gateway/services/keys.d.ts.map +1 -0
- package/dist/gateway/services/keys.js +232 -0
- package/dist/gateway/services/keys.js.map +1 -0
- package/dist/gateway/services/members.d.ts +72 -0
- package/dist/gateway/services/members.d.ts.map +1 -0
- package/dist/gateway/services/members.js +161 -0
- package/dist/gateway/services/members.js.map +1 -0
- package/dist/gateway/services/network.d.ts +36 -0
- package/dist/gateway/services/network.d.ts.map +1 -0
- package/dist/gateway/services/network.js +147 -0
- package/dist/gateway/services/network.js.map +1 -0
- package/dist/gateway/services/operator.d.ts +98 -0
- package/dist/gateway/services/operator.d.ts.map +1 -0
- package/dist/gateway/services/operator.js +170 -0
- package/dist/gateway/services/operator.js.map +1 -0
- package/dist/gateway/services/operator.test.d.ts +2 -0
- package/dist/gateway/services/operator.test.d.ts.map +1 -0
- package/dist/gateway/services/operator.test.js +184 -0
- package/dist/gateway/services/operator.test.js.map +1 -0
- package/dist/gateway/services/peer-lists.d.ts +20 -0
- package/dist/gateway/services/peer-lists.d.ts.map +1 -0
- package/dist/gateway/services/peer-lists.js +134 -0
- package/dist/gateway/services/peer-lists.js.map +1 -0
- package/dist/gateway/services/presets.d.ts +34 -0
- package/dist/gateway/services/presets.d.ts.map +1 -0
- package/dist/gateway/services/presets.js +134 -0
- package/dist/gateway/services/presets.js.map +1 -0
- package/dist/gateway/services/routing.d.ts +13 -0
- package/dist/gateway/services/routing.d.ts.map +1 -0
- package/dist/gateway/services/routing.js +18 -0
- package/dist/gateway/services/routing.js.map +1 -0
- package/dist/gateway/services/services.test.d.ts +2 -0
- package/dist/gateway/services/services.test.d.ts.map +1 -0
- package/dist/gateway/services/services.test.js +476 -0
- package/dist/gateway/services/services.test.js.map +1 -0
- package/dist/gateway/services/settings.d.ts +68 -0
- package/dist/gateway/services/settings.d.ts.map +1 -0
- package/dist/gateway/services/settings.js +580 -0
- package/dist/gateway/services/settings.js.map +1 -0
- package/dist/gateway/services/tokens.d.ts +29 -0
- package/dist/gateway/services/tokens.d.ts.map +1 -0
- package/dist/gateway/services/tokens.js +48 -0
- package/dist/gateway/services/tokens.js.map +1 -0
- package/dist/gateway/services/usage.d.ts +55 -0
- package/dist/gateway/services/usage.d.ts.map +1 -0
- package/dist/gateway/services/usage.js +225 -0
- package/dist/gateway/services/usage.js.map +1 -0
- package/dist/gateway/services/wallet-address-env.test.d.ts +2 -0
- package/dist/gateway/services/wallet-address-env.test.d.ts.map +1 -0
- package/dist/gateway/services/wallet-address-env.test.js +119 -0
- package/dist/gateway/services/wallet-address-env.test.js.map +1 -0
- package/dist/gateway/services/wallet-address.d.ts +40 -0
- package/dist/gateway/services/wallet-address.d.ts.map +1 -0
- package/dist/gateway/services/wallet-address.js +116 -0
- package/dist/gateway/services/wallet-address.js.map +1 -0
- package/dist/gateway/services/wallet-address.test.d.ts +2 -0
- package/dist/gateway/services/wallet-address.test.d.ts.map +1 -0
- package/dist/gateway/services/wallet-address.test.js +84 -0
- package/dist/gateway/services/wallet-address.test.js.map +1 -0
- package/dist/gateway/services/workspaces.d.ts +75 -0
- package/dist/gateway/services/workspaces.d.ts.map +1 -0
- package/dist/gateway/services/workspaces.js +228 -0
- package/dist/gateway/services/workspaces.js.map +1 -0
- package/dist/gateway/spend-durability.test.d.ts +2 -0
- package/dist/gateway/spend-durability.test.d.ts.map +1 -0
- package/dist/gateway/spend-durability.test.js +330 -0
- package/dist/gateway/spend-durability.test.js.map +1 -0
- package/dist/gateway/spend-feed.d.ts +11 -1
- package/dist/gateway/spend-feed.d.ts.map +1 -1
- package/dist/gateway/spend-feed.js +17 -4
- package/dist/gateway/spend-feed.js.map +1 -1
- package/dist/gateway/spend-feed.test.d.ts +2 -0
- package/dist/gateway/spend-feed.test.d.ts.map +1 -0
- package/dist/gateway/spend-feed.test.js +34 -0
- package/dist/gateway/spend-feed.test.js.map +1 -0
- package/dist/gateway/store-data.test.d.ts +2 -0
- package/dist/gateway/store-data.test.d.ts.map +1 -0
- package/dist/gateway/store-data.test.js +346 -0
- package/dist/gateway/store-data.test.js.map +1 -0
- package/dist/gateway/store-migrations.d.ts +6 -0
- package/dist/gateway/store-migrations.d.ts.map +1 -0
- package/dist/gateway/store-migrations.js +301 -0
- package/dist/gateway/store-migrations.js.map +1 -0
- package/dist/gateway/store.d.ts +595 -10
- package/dist/gateway/store.d.ts.map +1 -1
- package/dist/gateway/store.js +1242 -120
- package/dist/gateway/store.js.map +1 -1
- package/dist/gateway/store.test.d.ts +2 -0
- package/dist/gateway/store.test.d.ts.map +1 -0
- package/dist/gateway/store.test.js +185 -0
- package/dist/gateway/store.test.js.map +1 -0
- package/dist/proxy/buyer-chain-reader.d.ts +68 -0
- package/dist/proxy/buyer-chain-reader.d.ts.map +1 -0
- package/dist/proxy/buyer-chain-reader.js +152 -0
- package/dist/proxy/buyer-chain-reader.js.map +1 -0
- package/dist/proxy/buyer-chain-reader.test.d.ts +2 -0
- package/dist/proxy/buyer-chain-reader.test.d.ts.map +1 -0
- package/dist/proxy/buyer-chain-reader.test.js +102 -0
- package/dist/proxy/buyer-chain-reader.test.js.map +1 -0
- package/dist/proxy/buyer-proxy.d.ts +169 -3
- package/dist/proxy/buyer-proxy.d.ts.map +1 -1
- package/dist/proxy/buyer-proxy.js +882 -118
- package/dist/proxy/buyer-proxy.js.map +1 -1
- package/dist/proxy/buyer-proxy.test.js +108 -0
- package/dist/proxy/buyer-proxy.test.js.map +1 -1
- package/dist/proxy/chain-read-cache.d.ts +47 -0
- package/dist/proxy/chain-read-cache.d.ts.map +1 -0
- package/dist/proxy/chain-read-cache.js +110 -0
- package/dist/proxy/chain-read-cache.js.map +1 -0
- package/dist/proxy/chain-read-cache.test.d.ts +2 -0
- package/dist/proxy/chain-read-cache.test.d.ts.map +1 -0
- package/dist/proxy/chain-read-cache.test.js +75 -0
- package/dist/proxy/chain-read-cache.test.js.map +1 -0
- package/dist/proxy/chain-rpc-test-support.d.ts +31 -0
- package/dist/proxy/chain-rpc-test-support.d.ts.map +1 -0
- package/dist/proxy/chain-rpc-test-support.js +136 -0
- package/dist/proxy/chain-rpc-test-support.js.map +1 -0
- package/dist/proxy/chain-rpc.d.ts +121 -0
- package/dist/proxy/chain-rpc.d.ts.map +1 -0
- package/dist/proxy/chain-rpc.js +420 -0
- package/dist/proxy/chain-rpc.js.map +1 -0
- package/dist/proxy/chain-rpc.test.d.ts +2 -0
- package/dist/proxy/chain-rpc.test.d.ts.map +1 -0
- package/dist/proxy/chain-rpc.test.js +180 -0
- package/dist/proxy/chain-rpc.test.js.map +1 -0
- package/dist/proxy/credential-headers.d.ts +17 -0
- package/dist/proxy/credential-headers.d.ts.map +1 -0
- package/dist/proxy/credential-headers.js +29 -0
- package/dist/proxy/credential-headers.js.map +1 -0
- package/dist/proxy/deposit-watch-hub.d.ts +47 -0
- package/dist/proxy/deposit-watch-hub.d.ts.map +1 -0
- package/dist/proxy/deposit-watch-hub.js +111 -0
- package/dist/proxy/deposit-watch-hub.js.map +1 -0
- package/dist/proxy/deposit-watch-hub.test.d.ts +2 -0
- package/dist/proxy/deposit-watch-hub.test.d.ts.map +1 -0
- package/dist/proxy/deposit-watch-hub.test.js +133 -0
- package/dist/proxy/deposit-watch-hub.test.js.map +1 -0
- package/dist/proxy/deposit-watcher.d.ts +63 -4
- package/dist/proxy/deposit-watcher.d.ts.map +1 -1
- package/dist/proxy/deposit-watcher.js +120 -19
- package/dist/proxy/deposit-watcher.js.map +1 -1
- package/dist/proxy/deposit-watcher.test.js +81 -5
- package/dist/proxy/deposit-watcher.test.js.map +1 -1
- package/dist/proxy/gateway-policy.test.d.ts +2 -0
- package/dist/proxy/gateway-policy.test.d.ts.map +1 -0
- package/dist/proxy/gateway-policy.test.js +576 -0
- package/dist/proxy/gateway-policy.test.js.map +1 -0
- package/dist/proxy/network-models.d.ts +2 -0
- package/dist/proxy/network-models.d.ts.map +1 -1
- package/dist/proxy/network-models.js +3 -1
- package/dist/proxy/network-models.js.map +1 -1
- package/dist/proxy/route-policy.d.ts +97 -0
- package/dist/proxy/route-policy.d.ts.map +1 -0
- package/dist/proxy/route-policy.js +230 -0
- package/dist/proxy/route-policy.js.map +1 -0
- package/dist/proxy/route-policy.test.d.ts +2 -0
- package/dist/proxy/route-policy.test.d.ts.map +1 -0
- package/dist/proxy/route-policy.test.js +120 -0
- package/dist/proxy/route-policy.test.js.map +1 -0
- package/dist/proxy/spend-attribution.d.ts +41 -10
- package/dist/proxy/spend-attribution.d.ts.map +1 -1
- package/dist/proxy/spend-attribution.js +133 -37
- package/dist/proxy/spend-attribution.js.map +1 -1
- package/dist/proxy/tee-control.d.ts +3 -1
- package/dist/proxy/tee-control.d.ts.map +1 -1
- package/dist/proxy/tee-control.js +5 -3
- package/dist/proxy/tee-control.js.map +1 -1
- package/dist/proxy/telemetry.d.ts +2 -1
- package/dist/proxy/telemetry.d.ts.map +1 -1
- package/dist/proxy/telemetry.js +10 -5
- package/dist/proxy/telemetry.js.map +1 -1
- package/dist/routing-policy/policy.d.ts +149 -0
- package/dist/routing-policy/policy.d.ts.map +1 -0
- package/dist/routing-policy/policy.js +450 -0
- package/dist/routing-policy/policy.js.map +1 -0
- package/dist/routing-policy/policy.test.d.ts +2 -0
- package/dist/routing-policy/policy.test.d.ts.map +1 -0
- package/dist/routing-policy/policy.test.js +134 -0
- package/dist/routing-policy/policy.test.js.map +1 -0
- package/dist/system-proxy/proxy-server.js +2 -2
- package/dist/system-proxy/proxy-server.js.map +1 -1
- package/dist/system-proxy/proxy-server.test.js +40 -0
- package/dist/system-proxy/proxy-server.test.js.map +1 -1
- package/package.json +16 -7
package/dist/gateway/store.d.ts
CHANGED
|
@@ -1,15 +1,33 @@
|
|
|
1
|
-
import
|
|
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
|
-
|
|
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
|
|
61
|
-
*
|
|
62
|
-
*
|
|
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
|
|
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(
|
|
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
|
-
/**
|
|
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
|
-
|
|
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
|