@wlfi-agent/cli 1.4.13 → 1.4.15
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/Cargo.lock +3968 -0
- package/Cargo.toml +50 -0
- package/README.md +426 -6
- package/crates/vault-cli-admin/Cargo.toml +26 -0
- package/crates/vault-cli-admin/src/io_utils.rs +500 -0
- package/crates/vault-cli-admin/src/main.rs +3990 -0
- package/crates/vault-cli-admin/src/shared_config.rs +624 -0
- package/crates/vault-cli-admin/src/tui/amounts.rs +180 -0
- package/crates/vault-cli-admin/src/tui/token_rpc.rs +250 -0
- package/crates/vault-cli-admin/src/tui/utils.rs +82 -0
- package/crates/vault-cli-admin/src/tui.rs +3410 -0
- package/crates/vault-cli-agent/Cargo.toml +24 -0
- package/crates/vault-cli-agent/src/io_utils.rs +576 -0
- package/crates/vault-cli-agent/src/main.rs +833 -0
- package/crates/vault-cli-daemon/Cargo.toml +28 -0
- package/crates/vault-cli-daemon/src/bin/wlfi-agent-system-keychain.rs +216 -0
- package/crates/vault-cli-daemon/src/main.rs +644 -0
- package/crates/vault-cli-daemon/src/relay_sync.rs +894 -0
- package/crates/vault-cli-daemon/tests/system_keychain_helper_acl.rs +167 -0
- package/crates/vault-daemon/Cargo.toml +32 -0
- package/crates/vault-daemon/src/daemon_parts/api_impl_and_utils.rs +1041 -0
- package/crates/vault-daemon/src/daemon_parts/core_helpers.rs +1256 -0
- package/crates/vault-daemon/src/daemon_parts/types_api_rpc.rs +622 -0
- package/crates/vault-daemon/src/lib.rs +54 -0
- package/crates/vault-daemon/src/persistence.rs +441 -0
- package/crates/vault-daemon/src/tests.rs +237 -0
- package/crates/vault-daemon/src/tests_parts/part1.rs +1224 -0
- package/crates/vault-daemon/src/tests_parts/part2.rs +1021 -0
- package/crates/vault-daemon/src/tests_parts/part3.rs +835 -0
- package/crates/vault-daemon/src/tests_parts/part4.rs +604 -0
- package/crates/vault-domain/Cargo.toml +20 -0
- package/crates/vault-domain/src/action.rs +849 -0
- package/crates/vault-domain/src/address.rs +51 -0
- package/crates/vault-domain/src/approval.rs +90 -0
- package/crates/vault-domain/src/constants.rs +4 -0
- package/crates/vault-domain/src/error.rs +54 -0
- package/crates/vault-domain/src/keys.rs +71 -0
- package/crates/vault-domain/src/lib.rs +42 -0
- package/crates/vault-domain/src/nonce.rs +102 -0
- package/crates/vault-domain/src/policy.rs +172 -0
- package/crates/vault-domain/src/request.rs +53 -0
- package/crates/vault-domain/src/scope.rs +24 -0
- package/crates/vault-domain/src/session.rs +50 -0
- package/crates/vault-domain/src/signature.rs +34 -0
- package/crates/vault-domain/src/tests.rs +651 -0
- package/crates/vault-domain/src/u128_as_decimal_string.rs +44 -0
- package/crates/vault-policy/Cargo.toml +17 -0
- package/crates/vault-policy/src/engine.rs +301 -0
- package/crates/vault-policy/src/error.rs +81 -0
- package/crates/vault-policy/src/lib.rs +17 -0
- package/crates/vault-policy/src/report.rs +34 -0
- package/crates/vault-policy/src/tests.rs +891 -0
- package/crates/vault-policy/src/tests_explain.rs +78 -0
- package/crates/vault-sdk-agent/Cargo.toml +21 -0
- package/crates/vault-sdk-agent/src/lib.rs +711 -0
- package/crates/vault-signer/Cargo.toml +25 -0
- package/crates/vault-signer/src/lib.rs +731 -0
- package/crates/vault-signer/tests/secure_enclave_acl.rs +54 -0
- package/crates/vault-transport-unix/Cargo.toml +24 -0
- package/crates/vault-transport-unix/src/lib.rs +1640 -0
- package/crates/vault-transport-xpc/Cargo.toml +25 -0
- package/crates/vault-transport-xpc/src/client_codec_api.rs +635 -0
- package/crates/vault-transport-xpc/src/lib.rs +680 -0
- package/crates/vault-transport-xpc/src/tests.rs +818 -0
- package/crates/vault-transport-xpc/tests/e2e_flow.rs +773 -0
- package/dist/cli.cjs +35088 -0
- package/dist/cli.cjs.map +1 -0
- package/package.json +45 -41
- package/packages/cache/.turbo/turbo-build.log +52 -0
- package/packages/cache/dist/chunk-2QFWMUXT.cjs +43 -0
- package/packages/cache/dist/chunk-2QFWMUXT.cjs.map +1 -0
- package/packages/cache/dist/chunk-4U63TZTQ.js +43 -0
- package/packages/cache/dist/chunk-4U63TZTQ.js.map +1 -0
- package/packages/cache/dist/chunk-ALQ6H7KG.cjs +404 -0
- package/packages/cache/dist/chunk-ALQ6H7KG.cjs.map +1 -0
- package/packages/cache/dist/chunk-FGJEEF5N.js +404 -0
- package/packages/cache/dist/chunk-FGJEEF5N.js.map +1 -0
- package/packages/cache/dist/chunk-UYNEHZHB.cjs +45 -0
- package/packages/cache/dist/chunk-UYNEHZHB.cjs.map +1 -0
- package/packages/cache/dist/chunk-VXVMPG3W.js +45 -0
- package/packages/cache/dist/chunk-VXVMPG3W.js.map +1 -0
- package/packages/cache/dist/client/index.cjs +11 -0
- package/packages/cache/dist/client/index.cjs.map +1 -0
- package/packages/cache/dist/client/index.d.cts +15 -0
- package/packages/cache/dist/client/index.d.ts +15 -0
- package/packages/cache/dist/client/index.js +11 -0
- package/packages/cache/dist/client/index.js.map +1 -0
- package/packages/cache/dist/errors/index.cjs +11 -0
- package/packages/cache/dist/errors/index.cjs.map +1 -0
- package/packages/cache/dist/errors/index.d.cts +26 -0
- package/packages/cache/dist/errors/index.d.ts +26 -0
- package/packages/cache/dist/errors/index.js +11 -0
- package/packages/cache/dist/errors/index.js.map +1 -0
- package/packages/cache/dist/index.cjs +29 -0
- package/packages/cache/dist/index.cjs.map +1 -0
- package/packages/cache/dist/index.d.cts +4 -0
- package/packages/cache/dist/index.d.ts +4 -0
- package/packages/cache/dist/index.js +29 -0
- package/packages/cache/dist/index.js.map +1 -0
- package/packages/cache/dist/service/index.cjs +15 -0
- package/packages/cache/dist/service/index.cjs.map +1 -0
- package/packages/cache/dist/service/index.d.cts +184 -0
- package/packages/cache/dist/service/index.d.ts +184 -0
- package/packages/cache/dist/service/index.js +15 -0
- package/packages/cache/dist/service/index.js.map +1 -0
- package/packages/cache/node_modules/.bin/jiti +17 -0
- package/packages/cache/node_modules/.bin/tsc +17 -0
- package/packages/cache/node_modules/.bin/tsserver +17 -0
- package/packages/cache/node_modules/.bin/tsup +17 -0
- package/packages/cache/node_modules/.bin/tsup-node +17 -0
- package/packages/cache/node_modules/.bin/tsx +17 -0
- package/packages/cache/node_modules/.bin/vitest +17 -0
- package/packages/cache/package.json +48 -0
- package/packages/cache/src/client/index.ts +56 -0
- package/packages/cache/src/errors/index.ts +53 -0
- package/packages/cache/src/index.ts +3 -0
- package/packages/cache/src/service/index.test.ts +263 -0
- package/packages/cache/src/service/index.ts +678 -0
- package/packages/cache/tsconfig.json +13 -0
- package/packages/cache/tsup.config.ts +13 -0
- package/packages/cache/vitest.config.ts +16 -0
- package/packages/config/.turbo/turbo-build.log +18 -0
- package/packages/config/dist/index.cjs +1037 -0
- package/packages/config/dist/index.cjs.map +1 -0
- package/packages/config/dist/index.d.ts +131 -0
- package/packages/config/node_modules/.bin/jiti +17 -0
- package/packages/config/node_modules/.bin/tsc +17 -0
- package/packages/config/node_modules/.bin/tsserver +17 -0
- package/packages/config/node_modules/.bin/tsup +17 -0
- package/packages/config/node_modules/.bin/tsup-node +17 -0
- package/packages/config/node_modules/.bin/tsx +17 -0
- package/packages/config/package.json +21 -0
- package/packages/config/src/index.js +1 -0
- package/packages/config/src/index.ts +1282 -0
- package/packages/config/tsconfig.json +4 -0
- package/packages/rpc/.turbo/turbo-build.log +32 -0
- package/packages/rpc/dist/_esm-BCLXDO2R.cjs +3660 -0
- package/packages/rpc/dist/_esm-BCLXDO2R.cjs.map +1 -0
- package/packages/rpc/dist/ccip-OWJLAW55.cjs +16 -0
- package/packages/rpc/dist/ccip-OWJLAW55.cjs.map +1 -0
- package/packages/rpc/dist/chunk-APQIFZ3B.cjs +6247 -0
- package/packages/rpc/dist/chunk-APQIFZ3B.cjs.map +1 -0
- package/packages/rpc/dist/chunk-CDO2GWRD.cjs +410 -0
- package/packages/rpc/dist/chunk-CDO2GWRD.cjs.map +1 -0
- package/packages/rpc/dist/chunk-QGTNTFJ7.cjs +2249 -0
- package/packages/rpc/dist/chunk-QGTNTFJ7.cjs.map +1 -0
- package/packages/rpc/dist/chunk-TZDTAHWR.cjs +44 -0
- package/packages/rpc/dist/chunk-TZDTAHWR.cjs.map +1 -0
- package/packages/rpc/dist/index.cjs +7342 -0
- package/packages/rpc/dist/index.cjs.map +1 -0
- package/packages/rpc/dist/index.d.ts +3857 -0
- package/packages/rpc/dist/secp256k1-WCNM675D.cjs +18 -0
- package/packages/rpc/dist/secp256k1-WCNM675D.cjs.map +1 -0
- package/packages/rpc/node_modules/.bin/jiti +17 -0
- package/packages/rpc/node_modules/.bin/tsc +17 -0
- package/packages/rpc/node_modules/.bin/tsserver +17 -0
- package/packages/rpc/node_modules/.bin/tsup +17 -0
- package/packages/rpc/node_modules/.bin/tsup-node +17 -0
- package/packages/rpc/node_modules/.bin/tsx +17 -0
- package/packages/rpc/package.json +25 -0
- package/packages/rpc/src/index.ts +206 -0
- package/packages/rpc/tsconfig.json +4 -0
- package/packages/typescript/base.json +36 -0
- package/packages/typescript/nextjs.json +17 -0
- package/packages/typescript/package.json +10 -0
- package/packages/ui/.turbo/turbo-build.log +44 -0
- package/packages/ui/dist/chunk-MOAFBKSA.js +11 -0
- package/packages/ui/dist/chunk-MOAFBKSA.js.map +1 -0
- package/packages/ui/dist/components/badge.d.ts +12 -0
- package/packages/ui/dist/components/badge.js +31 -0
- package/packages/ui/dist/components/badge.js.map +1 -0
- package/packages/ui/dist/components/button.d.ts +13 -0
- package/packages/ui/dist/components/button.js +40 -0
- package/packages/ui/dist/components/button.js.map +1 -0
- package/packages/ui/dist/components/card.d.ts +10 -0
- package/packages/ui/dist/components/card.js +39 -0
- package/packages/ui/dist/components/card.js.map +1 -0
- package/packages/ui/dist/components/input.d.ts +5 -0
- package/packages/ui/dist/components/input.js +28 -0
- package/packages/ui/dist/components/input.js.map +1 -0
- package/packages/ui/dist/components/label.d.ts +5 -0
- package/packages/ui/dist/components/label.js +13 -0
- package/packages/ui/dist/components/label.js.map +1 -0
- package/packages/ui/dist/components/separator.d.ts +5 -0
- package/packages/ui/dist/components/separator.js +13 -0
- package/packages/ui/dist/components/separator.js.map +1 -0
- package/packages/ui/dist/components/textarea.d.ts +5 -0
- package/packages/ui/dist/components/textarea.js +27 -0
- package/packages/ui/dist/components/textarea.js.map +1 -0
- package/packages/ui/dist/tailwind.d.ts +56 -0
- package/packages/ui/dist/tailwind.js +60 -0
- package/packages/ui/dist/tailwind.js.map +1 -0
- package/packages/ui/dist/utils/cn.d.ts +5 -0
- package/packages/ui/dist/utils/cn.js +7 -0
- package/packages/ui/dist/utils/cn.js.map +1 -0
- package/packages/ui/node_modules/.bin/jiti +17 -0
- package/packages/ui/node_modules/.bin/tsc +17 -0
- package/packages/ui/node_modules/.bin/tsserver +17 -0
- package/packages/ui/node_modules/.bin/tsup +17 -0
- package/packages/ui/node_modules/.bin/tsup-node +17 -0
- package/packages/ui/node_modules/.bin/tsx +17 -0
- package/packages/ui/package.json +69 -0
- package/packages/ui/src/components/badge.tsx +27 -0
- package/packages/ui/src/components/button.tsx +40 -0
- package/packages/ui/src/components/card.tsx +31 -0
- package/packages/ui/src/components/input.tsx +21 -0
- package/packages/ui/src/components/label.tsx +6 -0
- package/packages/ui/src/components/separator.tsx +6 -0
- package/packages/ui/src/components/textarea.tsx +20 -0
- package/packages/ui/src/globals.css +70 -0
- package/packages/ui/src/tailwind.ts +56 -0
- package/packages/ui/src/utils/cn.ts +6 -0
- package/packages/ui/tsconfig.json +20 -0
- package/packages/ui/tsup.config.ts +20 -0
- package/pnpm-workspace.yaml +4 -0
- package/scripts/install-rust-binaries.mjs +84 -0
- package/scripts/launchd/install-user-daemon.sh +358 -0
- package/scripts/launchd/run-vault-daemon.sh +5 -0
- package/scripts/launchd/run-wlfi-agent-daemon.sh +73 -0
- package/scripts/launchd/uninstall-user-daemon.sh +103 -0
- package/src/cli.ts +2121 -0
- package/src/lib/admin-guard.js +1 -0
- package/src/lib/admin-guard.ts +185 -0
- package/src/lib/admin-passthrough.ts +33 -0
- package/src/lib/admin-reset.ts +751 -0
- package/src/lib/admin-setup.ts +1612 -0
- package/src/lib/agent-auth-clear.js +1 -0
- package/src/lib/agent-auth-clear.ts +58 -0
- package/src/lib/agent-auth-forwarding.js +1 -0
- package/src/lib/agent-auth-forwarding.ts +149 -0
- package/src/lib/agent-auth-migrate.js +1 -0
- package/src/lib/agent-auth-migrate.ts +150 -0
- package/src/lib/agent-auth-revoke.ts +103 -0
- package/src/lib/agent-auth-rotate.ts +107 -0
- package/src/lib/agent-auth-token.js +1 -0
- package/src/lib/agent-auth-token.ts +25 -0
- package/src/lib/agent-auth.ts +89 -0
- package/src/lib/asset-broadcast.js +1 -0
- package/src/lib/asset-broadcast.ts +285 -0
- package/src/lib/bootstrap-artifacts.js +1 -0
- package/src/lib/bootstrap-artifacts.ts +205 -0
- package/src/lib/bootstrap-credentials.js +1 -0
- package/src/lib/bootstrap-credentials.ts +832 -0
- package/src/lib/config-amounts.js +1 -0
- package/src/lib/config-amounts.ts +189 -0
- package/src/lib/config-mutation.ts +27 -0
- package/src/lib/fs-trust.js +1 -0
- package/src/lib/fs-trust.ts +537 -0
- package/src/lib/keychain.js +1 -0
- package/src/lib/keychain.ts +225 -0
- package/src/lib/local-admin-access.ts +106 -0
- package/src/lib/network-selection.js +1 -0
- package/src/lib/network-selection.ts +71 -0
- package/src/lib/passthrough-security.js +1 -0
- package/src/lib/passthrough-security.ts +114 -0
- package/src/lib/rpc-guard.js +1 -0
- package/src/lib/rpc-guard.ts +7 -0
- package/src/lib/rust-spawn-options.js +1 -0
- package/src/lib/rust-spawn-options.ts +98 -0
- package/src/lib/rust.js +1 -0
- package/src/lib/rust.ts +143 -0
- package/src/lib/signed-tx.js +1 -0
- package/src/lib/signed-tx.ts +116 -0
- package/src/lib/status-repair-cli.ts +116 -0
- package/src/lib/sudo.js +1 -0
- package/src/lib/sudo.ts +172 -0
- package/src/lib/vault-password-forwarding.js +1 -0
- package/src/lib/vault-password-forwarding.ts +155 -0
- package/src/lib/wallet-profile.js +1 -0
- package/src/lib/wallet-profile.ts +332 -0
- package/src/lib/wallet-repair.js +1 -0
- package/src/lib/wallet-repair.ts +304 -0
- package/src/lib/wallet-setup.js +1 -0
- package/src/lib/wallet-setup.ts +1466 -0
- package/src/lib/wallet-status.js +1 -0
- package/src/lib/wallet-status.ts +640 -0
- package/tsconfig.base.json +17 -0
- package/tsconfig.json +10 -0
- package/tsup.config.ts +25 -0
- package/turbo.json +41 -0
- package/LICENSE.md +0 -1
- package/dist/wlfa/index.cjs +0 -250
- package/dist/wlfa/index.d.cts +0 -1
- package/dist/wlfa/index.d.ts +0 -1
- package/dist/wlfa/index.js +0 -250
- package/dist/wlfc/index.cjs +0 -1839
- package/dist/wlfc/index.d.cts +0 -1
- package/dist/wlfc/index.d.ts +0 -1
- package/dist/wlfc/index.js +0 -1839
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
// src/client/index.ts
|
|
2
|
+
import Redis from "ioredis";
|
|
3
|
+
var singletonClient = null;
|
|
4
|
+
var getDefaultCacheUrl = () => {
|
|
5
|
+
const explicitUrl = process.env.CACHE_URL?.trim();
|
|
6
|
+
if (explicitUrl) {
|
|
7
|
+
return explicitUrl;
|
|
8
|
+
}
|
|
9
|
+
const host = process.env.CACHE_HOST?.trim() || "127.0.0.1";
|
|
10
|
+
const port = Number(process.env.CACHE_PORT?.trim() || "6379");
|
|
11
|
+
return `redis://${host}:${port}`;
|
|
12
|
+
};
|
|
13
|
+
var createCacheClient = (options = {}) => {
|
|
14
|
+
return new Redis(options.url ?? getDefaultCacheUrl(), {
|
|
15
|
+
connectTimeout: options.connectTimeoutMs ?? 5e3,
|
|
16
|
+
enableOfflineQueue: options.enableOfflineQueue ?? true,
|
|
17
|
+
keyPrefix: options.keyPrefix,
|
|
18
|
+
lazyConnect: options.lazyConnect ?? false,
|
|
19
|
+
maxRetriesPerRequest: options.maxRetriesPerRequest ?? 2,
|
|
20
|
+
reconnectOnError(error) {
|
|
21
|
+
return error.message.includes("READONLY") || error.message.includes("ETIMEDOUT");
|
|
22
|
+
}
|
|
23
|
+
});
|
|
24
|
+
};
|
|
25
|
+
var getCacheClient = (options = {}) => {
|
|
26
|
+
if (!singletonClient) {
|
|
27
|
+
singletonClient = createCacheClient(options);
|
|
28
|
+
}
|
|
29
|
+
return singletonClient;
|
|
30
|
+
};
|
|
31
|
+
var closeCacheClient = async () => {
|
|
32
|
+
if (!singletonClient) {
|
|
33
|
+
return;
|
|
34
|
+
}
|
|
35
|
+
const client = singletonClient;
|
|
36
|
+
singletonClient = null;
|
|
37
|
+
await client.quit();
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
export {
|
|
41
|
+
createCacheClient,
|
|
42
|
+
getCacheClient,
|
|
43
|
+
closeCacheClient
|
|
44
|
+
};
|
|
45
|
+
//# sourceMappingURL=chunk-VXVMPG3W.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/client/index.ts"],"sourcesContent":["/** biome-ignore-all lint/style/noProcessEnv: relay cache config is environment driven */\nimport Redis from 'ioredis';\n\nexport interface CacheClientOptions {\n connectTimeoutMs?: number;\n enableOfflineQueue?: boolean;\n keyPrefix?: string;\n lazyConnect?: boolean;\n maxRetriesPerRequest?: number | null;\n url?: string;\n}\n\nlet singletonClient: Redis | null = null;\n\nconst getDefaultCacheUrl = (): string => {\n const explicitUrl = process.env.CACHE_URL?.trim();\n if (explicitUrl) {\n return explicitUrl;\n }\n\n const host = process.env.CACHE_HOST?.trim() || '127.0.0.1';\n const port = Number(process.env.CACHE_PORT?.trim() || '6379');\n\n return `redis://${host}:${port}`;\n};\n\nexport const createCacheClient = (options: CacheClientOptions = {}): Redis => {\n return new Redis(options.url ?? getDefaultCacheUrl(), {\n connectTimeout: options.connectTimeoutMs ?? 5_000,\n enableOfflineQueue: options.enableOfflineQueue ?? true,\n keyPrefix: options.keyPrefix,\n lazyConnect: options.lazyConnect ?? false,\n maxRetriesPerRequest: options.maxRetriesPerRequest ?? 2,\n reconnectOnError(error) {\n return error.message.includes('READONLY') || error.message.includes('ETIMEDOUT');\n },\n });\n};\n\nexport const getCacheClient = (options: CacheClientOptions = {}): Redis => {\n if (!singletonClient) {\n singletonClient = createCacheClient(options);\n }\n\n return singletonClient;\n};\n\nexport const closeCacheClient = async (): Promise<void> => {\n if (!singletonClient) {\n return;\n }\n\n const client = singletonClient;\n singletonClient = null;\n await client.quit();\n};\n"],"mappings":";AACA,OAAO,WAAW;AAWlB,IAAI,kBAAgC;AAEpC,IAAM,qBAAqB,MAAc;AACvC,QAAM,cAAc,QAAQ,IAAI,WAAW,KAAK;AAChD,MAAI,aAAa;AACf,WAAO;AAAA,EACT;AAEA,QAAM,OAAO,QAAQ,IAAI,YAAY,KAAK,KAAK;AAC/C,QAAM,OAAO,OAAO,QAAQ,IAAI,YAAY,KAAK,KAAK,MAAM;AAE5D,SAAO,WAAW,IAAI,IAAI,IAAI;AAChC;AAEO,IAAM,oBAAoB,CAAC,UAA8B,CAAC,MAAa;AAC5E,SAAO,IAAI,MAAM,QAAQ,OAAO,mBAAmB,GAAG;AAAA,IACpD,gBAAgB,QAAQ,oBAAoB;AAAA,IAC5C,oBAAoB,QAAQ,sBAAsB;AAAA,IAClD,WAAW,QAAQ;AAAA,IACnB,aAAa,QAAQ,eAAe;AAAA,IACpC,sBAAsB,QAAQ,wBAAwB;AAAA,IACtD,iBAAiB,OAAO;AACtB,aAAO,MAAM,QAAQ,SAAS,UAAU,KAAK,MAAM,QAAQ,SAAS,WAAW;AAAA,IACjF;AAAA,EACF,CAAC;AACH;AAEO,IAAM,iBAAiB,CAAC,UAA8B,CAAC,MAAa;AACzE,MAAI,CAAC,iBAAiB;AACpB,sBAAkB,kBAAkB,OAAO;AAAA,EAC7C;AAEA,SAAO;AACT;AAEO,IAAM,mBAAmB,YAA2B;AACzD,MAAI,CAAC,iBAAiB;AACpB;AAAA,EACF;AAEA,QAAM,SAAS;AACf,oBAAkB;AAClB,QAAM,OAAO,KAAK;AACpB;","names":[]}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
var _chunkUYNEHZHBcjs = require('../chunk-UYNEHZHB.cjs');
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
exports.closeCacheClient = _chunkUYNEHZHBcjs.closeCacheClient; exports.createCacheClient = _chunkUYNEHZHBcjs.createCacheClient; exports.getCacheClient = _chunkUYNEHZHBcjs.getCacheClient;
|
|
11
|
+
//# sourceMappingURL=index.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["/Users/hanzhi/Documents/WLFI/wlfi-agent-sdk/packages/cache/dist/client/index.cjs"],"names":[],"mappings":"AAAA;AACE;AACA;AACA;AACF,yDAA8B;AAC9B;AACE;AACA;AACA;AACF,0LAAC","file":"/Users/hanzhi/Documents/WLFI/wlfi-agent-sdk/packages/cache/dist/client/index.cjs"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import Redis from 'ioredis';
|
|
2
|
+
|
|
3
|
+
interface CacheClientOptions {
|
|
4
|
+
connectTimeoutMs?: number;
|
|
5
|
+
enableOfflineQueue?: boolean;
|
|
6
|
+
keyPrefix?: string;
|
|
7
|
+
lazyConnect?: boolean;
|
|
8
|
+
maxRetriesPerRequest?: number | null;
|
|
9
|
+
url?: string;
|
|
10
|
+
}
|
|
11
|
+
declare const createCacheClient: (options?: CacheClientOptions) => Redis;
|
|
12
|
+
declare const getCacheClient: (options?: CacheClientOptions) => Redis;
|
|
13
|
+
declare const closeCacheClient: () => Promise<void>;
|
|
14
|
+
|
|
15
|
+
export { type CacheClientOptions, closeCacheClient, createCacheClient, getCacheClient };
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import Redis from 'ioredis';
|
|
2
|
+
|
|
3
|
+
interface CacheClientOptions {
|
|
4
|
+
connectTimeoutMs?: number;
|
|
5
|
+
enableOfflineQueue?: boolean;
|
|
6
|
+
keyPrefix?: string;
|
|
7
|
+
lazyConnect?: boolean;
|
|
8
|
+
maxRetriesPerRequest?: number | null;
|
|
9
|
+
url?: string;
|
|
10
|
+
}
|
|
11
|
+
declare const createCacheClient: (options?: CacheClientOptions) => Redis;
|
|
12
|
+
declare const getCacheClient: (options?: CacheClientOptions) => Redis;
|
|
13
|
+
declare const closeCacheClient: () => Promise<void>;
|
|
14
|
+
|
|
15
|
+
export { type CacheClientOptions, closeCacheClient, createCacheClient, getCacheClient };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
var _chunk2QFWMUXTcjs = require('../chunk-2QFWMUXT.cjs');
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
exports.CacheError = _chunk2QFWMUXTcjs.CacheError; exports.cacheErrorCodes = _chunk2QFWMUXTcjs.cacheErrorCodes; exports.toCacheError = _chunk2QFWMUXTcjs.toCacheError;
|
|
11
|
+
//# sourceMappingURL=index.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["/Users/hanzhi/Documents/WLFI/wlfi-agent-sdk/packages/cache/dist/errors/index.cjs"],"names":[],"mappings":"AAAA;AACE;AACA;AACA;AACF,yDAA8B;AAC9B;AACE;AACA;AACA;AACF,sKAAC","file":"/Users/hanzhi/Documents/WLFI/wlfi-agent-sdk/packages/cache/dist/errors/index.cjs"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
declare const cacheErrorCodes: {
|
|
2
|
+
readonly connectionFailed: "CACHE_CONNECTION_FAILED";
|
|
3
|
+
readonly invalidPayload: "CACHE_INVALID_PAYLOAD";
|
|
4
|
+
readonly notFound: "CACHE_NOT_FOUND";
|
|
5
|
+
readonly unknown: "CACHE_UNKNOWN";
|
|
6
|
+
};
|
|
7
|
+
type CacheErrorCode = (typeof cacheErrorCodes)[keyof typeof cacheErrorCodes];
|
|
8
|
+
declare class CacheError extends Error {
|
|
9
|
+
readonly code: CacheErrorCode;
|
|
10
|
+
readonly key?: string;
|
|
11
|
+
readonly operation?: string;
|
|
12
|
+
readonly cause?: unknown;
|
|
13
|
+
constructor(options: {
|
|
14
|
+
cause?: unknown;
|
|
15
|
+
code: CacheErrorCode;
|
|
16
|
+
key?: string;
|
|
17
|
+
message: string;
|
|
18
|
+
operation?: string;
|
|
19
|
+
});
|
|
20
|
+
}
|
|
21
|
+
declare const toCacheError: (error: unknown, context?: {
|
|
22
|
+
key?: string;
|
|
23
|
+
operation?: string;
|
|
24
|
+
}) => CacheError;
|
|
25
|
+
|
|
26
|
+
export { CacheError, type CacheErrorCode, cacheErrorCodes, toCacheError };
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
declare const cacheErrorCodes: {
|
|
2
|
+
readonly connectionFailed: "CACHE_CONNECTION_FAILED";
|
|
3
|
+
readonly invalidPayload: "CACHE_INVALID_PAYLOAD";
|
|
4
|
+
readonly notFound: "CACHE_NOT_FOUND";
|
|
5
|
+
readonly unknown: "CACHE_UNKNOWN";
|
|
6
|
+
};
|
|
7
|
+
type CacheErrorCode = (typeof cacheErrorCodes)[keyof typeof cacheErrorCodes];
|
|
8
|
+
declare class CacheError extends Error {
|
|
9
|
+
readonly code: CacheErrorCode;
|
|
10
|
+
readonly key?: string;
|
|
11
|
+
readonly operation?: string;
|
|
12
|
+
readonly cause?: unknown;
|
|
13
|
+
constructor(options: {
|
|
14
|
+
cause?: unknown;
|
|
15
|
+
code: CacheErrorCode;
|
|
16
|
+
key?: string;
|
|
17
|
+
message: string;
|
|
18
|
+
operation?: string;
|
|
19
|
+
});
|
|
20
|
+
}
|
|
21
|
+
declare const toCacheError: (error: unknown, context?: {
|
|
22
|
+
key?: string;
|
|
23
|
+
operation?: string;
|
|
24
|
+
}) => CacheError;
|
|
25
|
+
|
|
26
|
+
export { CacheError, type CacheErrorCode, cacheErrorCodes, toCacheError };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
var _chunkALQ6H7KGcjs = require('./chunk-ALQ6H7KG.cjs');
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
var _chunkUYNEHZHBcjs = require('./chunk-UYNEHZHB.cjs');
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
var _chunk2QFWMUXTcjs = require('./chunk-2QFWMUXT.cjs');
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
exports.CacheError = _chunk2QFWMUXTcjs.CacheError; exports.RelayCacheService = _chunkALQ6H7KGcjs.RelayCacheService; exports.cacheErrorCodes = _chunk2QFWMUXTcjs.cacheErrorCodes; exports.closeCacheClient = _chunkUYNEHZHBcjs.closeCacheClient; exports.createCacheClient = _chunkUYNEHZHBcjs.createCacheClient; exports.createRelayCacheService = _chunkALQ6H7KGcjs.createRelayCacheService; exports.getCacheClient = _chunkUYNEHZHBcjs.getCacheClient; exports.relayApprovalStatuses = _chunkALQ6H7KGcjs.relayApprovalStatuses; exports.relayUpdateStatuses = _chunkALQ6H7KGcjs.relayUpdateStatuses; exports.toCacheError = _chunk2QFWMUXTcjs.toCacheError;
|
|
29
|
+
//# sourceMappingURL=index.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["/Users/hanzhi/Documents/WLFI/wlfi-agent-sdk/packages/cache/dist/index.cjs"],"names":[],"mappings":"AAAA;AACE;AACA;AACA;AACA;AACF,wDAA6B;AAC7B;AACE;AACA;AACA;AACF,wDAA6B;AAC7B;AACE;AACA;AACA;AACF,wDAA6B;AAC7B;AACE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACF,6nBAAC","file":"/Users/hanzhi/Documents/WLFI/wlfi-agent-sdk/packages/cache/dist/index.cjs"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export { CacheClientOptions, closeCacheClient, createCacheClient, getCacheClient } from './client/index.cjs';
|
|
2
|
+
export { CacheError, CacheErrorCode, cacheErrorCodes, toCacheError } from './errors/index.cjs';
|
|
3
|
+
export { ApprovalCapabilityFailureRecord, ApprovalRequestFilters, ClaimEncryptedUpdatesInput, CreateEncryptedUpdateInput, RecordApprovalCapabilityFailureResult, RelayAgentKeyRecord, RelayApprovalRequestRecord, RelayApprovalStatus, RelayCacheService, RelayDaemonProfile, RelayEncryptedPayload, RelayEncryptedUpdateRecord, RelayPolicyRecord, RelayUpdateFeedbackRecord, RelayUpdateStatus, SubmitUpdateFeedbackInput, SyncDaemonRegistrationInput, createRelayCacheService, relayApprovalStatuses, relayUpdateStatuses } from './service/index.cjs';
|
|
4
|
+
import 'ioredis';
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export { CacheClientOptions, closeCacheClient, createCacheClient, getCacheClient } from './client/index.js';
|
|
2
|
+
export { CacheError, CacheErrorCode, cacheErrorCodes, toCacheError } from './errors/index.js';
|
|
3
|
+
export { ApprovalCapabilityFailureRecord, ApprovalRequestFilters, ClaimEncryptedUpdatesInput, CreateEncryptedUpdateInput, RecordApprovalCapabilityFailureResult, RelayAgentKeyRecord, RelayApprovalRequestRecord, RelayApprovalStatus, RelayCacheService, RelayDaemonProfile, RelayEncryptedPayload, RelayEncryptedUpdateRecord, RelayPolicyRecord, RelayUpdateFeedbackRecord, RelayUpdateStatus, SubmitUpdateFeedbackInput, SyncDaemonRegistrationInput, createRelayCacheService, relayApprovalStatuses, relayUpdateStatuses } from './service/index.js';
|
|
4
|
+
import 'ioredis';
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import {
|
|
2
|
+
RelayCacheService,
|
|
3
|
+
createRelayCacheService,
|
|
4
|
+
relayApprovalStatuses,
|
|
5
|
+
relayUpdateStatuses
|
|
6
|
+
} from "./chunk-FGJEEF5N.js";
|
|
7
|
+
import {
|
|
8
|
+
closeCacheClient,
|
|
9
|
+
createCacheClient,
|
|
10
|
+
getCacheClient
|
|
11
|
+
} from "./chunk-VXVMPG3W.js";
|
|
12
|
+
import {
|
|
13
|
+
CacheError,
|
|
14
|
+
cacheErrorCodes,
|
|
15
|
+
toCacheError
|
|
16
|
+
} from "./chunk-4U63TZTQ.js";
|
|
17
|
+
export {
|
|
18
|
+
CacheError,
|
|
19
|
+
RelayCacheService,
|
|
20
|
+
cacheErrorCodes,
|
|
21
|
+
closeCacheClient,
|
|
22
|
+
createCacheClient,
|
|
23
|
+
createRelayCacheService,
|
|
24
|
+
getCacheClient,
|
|
25
|
+
relayApprovalStatuses,
|
|
26
|
+
relayUpdateStatuses,
|
|
27
|
+
toCacheError
|
|
28
|
+
};
|
|
29
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
var _chunkALQ6H7KGcjs = require('../chunk-ALQ6H7KG.cjs');
|
|
7
|
+
require('../chunk-UYNEHZHB.cjs');
|
|
8
|
+
require('../chunk-2QFWMUXT.cjs');
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
exports.RelayCacheService = _chunkALQ6H7KGcjs.RelayCacheService; exports.createRelayCacheService = _chunkALQ6H7KGcjs.createRelayCacheService; exports.relayApprovalStatuses = _chunkALQ6H7KGcjs.relayApprovalStatuses; exports.relayUpdateStatuses = _chunkALQ6H7KGcjs.relayUpdateStatuses;
|
|
15
|
+
//# sourceMappingURL=index.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["/Users/hanzhi/Documents/WLFI/wlfi-agent-sdk/packages/cache/dist/service/index.cjs"],"names":[],"mappings":"AAAA;AACE;AACA;AACA;AACA;AACF,yDAA8B;AAC9B,iCAA8B;AAC9B,iCAA8B;AAC9B;AACE;AACA;AACA;AACA;AACF,2RAAC","file":"/Users/hanzhi/Documents/WLFI/wlfi-agent-sdk/packages/cache/dist/service/index.cjs"}
|
|
@@ -0,0 +1,184 @@
|
|
|
1
|
+
import Redis from 'ioredis';
|
|
2
|
+
|
|
3
|
+
declare const relayApprovalStatuses: readonly ["pending", "approved", "rejected", "completed", "expired"];
|
|
4
|
+
type RelayApprovalStatus = (typeof relayApprovalStatuses)[number];
|
|
5
|
+
declare const relayUpdateStatuses: readonly ["pending", "inflight", "applied", "rejected", "failed"];
|
|
6
|
+
type RelayUpdateStatus = (typeof relayUpdateStatuses)[number];
|
|
7
|
+
interface RelayDaemonProfile {
|
|
8
|
+
daemonId: string;
|
|
9
|
+
daemonPublicKey: string;
|
|
10
|
+
ethereumAddress: string;
|
|
11
|
+
label?: string;
|
|
12
|
+
lastSeenAt: string;
|
|
13
|
+
registeredAt: string;
|
|
14
|
+
relayUrl?: string;
|
|
15
|
+
signerBackend?: string;
|
|
16
|
+
status: 'active' | 'paused';
|
|
17
|
+
updatedAt: string;
|
|
18
|
+
version?: string;
|
|
19
|
+
}
|
|
20
|
+
interface RelayPolicyRecord {
|
|
21
|
+
action: string;
|
|
22
|
+
amountMaxWei?: string;
|
|
23
|
+
amountMinWei?: string;
|
|
24
|
+
chainId?: number;
|
|
25
|
+
daemonId: string;
|
|
26
|
+
destination: string;
|
|
27
|
+
metadata?: Record<string, string>;
|
|
28
|
+
policyId: string;
|
|
29
|
+
requiresManualApproval: boolean;
|
|
30
|
+
scope: 'default' | 'override';
|
|
31
|
+
tokenAddress?: string;
|
|
32
|
+
updatedAt: string;
|
|
33
|
+
}
|
|
34
|
+
interface RelayAgentKeyRecord {
|
|
35
|
+
agentKeyId: string;
|
|
36
|
+
createdAt?: string;
|
|
37
|
+
daemonId: string;
|
|
38
|
+
label?: string;
|
|
39
|
+
metadata?: Record<string, string>;
|
|
40
|
+
status: 'active' | 'revoked';
|
|
41
|
+
updatedAt: string;
|
|
42
|
+
}
|
|
43
|
+
interface RelayApprovalRequestRecord {
|
|
44
|
+
agentKeyId?: string;
|
|
45
|
+
amountWei?: string;
|
|
46
|
+
approvalRequestId: string;
|
|
47
|
+
chainId?: number;
|
|
48
|
+
daemonId: string;
|
|
49
|
+
destination: string;
|
|
50
|
+
metadata?: Record<string, string>;
|
|
51
|
+
network?: string;
|
|
52
|
+
reason?: string;
|
|
53
|
+
requestedAt: string;
|
|
54
|
+
status: RelayApprovalStatus;
|
|
55
|
+
tokenAddress?: string;
|
|
56
|
+
transactionType: string;
|
|
57
|
+
updatedAt: string;
|
|
58
|
+
}
|
|
59
|
+
interface RelayEncryptedPayload {
|
|
60
|
+
aadBase64?: string;
|
|
61
|
+
algorithm: string;
|
|
62
|
+
ciphertextBase64: string;
|
|
63
|
+
contentSha256Hex?: string;
|
|
64
|
+
encapsulatedKeyBase64: string;
|
|
65
|
+
nonceBase64: string;
|
|
66
|
+
schemaVersion: number;
|
|
67
|
+
}
|
|
68
|
+
interface RelayUpdateFeedbackRecord {
|
|
69
|
+
daemonId: string;
|
|
70
|
+
details?: Record<string, string>;
|
|
71
|
+
feedbackAt: string;
|
|
72
|
+
message?: string;
|
|
73
|
+
status: Extract<RelayUpdateStatus, 'applied' | 'failed' | 'rejected'>;
|
|
74
|
+
updateId: string;
|
|
75
|
+
}
|
|
76
|
+
interface RelayEncryptedUpdateRecord {
|
|
77
|
+
claimToken?: string;
|
|
78
|
+
claimUntil?: string;
|
|
79
|
+
createdAt: string;
|
|
80
|
+
daemonId: string;
|
|
81
|
+
feedback?: RelayUpdateFeedbackRecord;
|
|
82
|
+
lastDeliveredAt?: string;
|
|
83
|
+
metadata?: Record<string, string>;
|
|
84
|
+
payload: RelayEncryptedPayload;
|
|
85
|
+
status: RelayUpdateStatus;
|
|
86
|
+
targetApprovalRequestId?: string;
|
|
87
|
+
type: string;
|
|
88
|
+
updateId: string;
|
|
89
|
+
updatedAt: string;
|
|
90
|
+
}
|
|
91
|
+
interface SyncDaemonRegistrationInput {
|
|
92
|
+
agentKeys?: RelayAgentKeyRecord[];
|
|
93
|
+
approvalRequests?: RelayApprovalRequestRecord[];
|
|
94
|
+
daemon: RelayDaemonProfile;
|
|
95
|
+
policies?: RelayPolicyRecord[];
|
|
96
|
+
}
|
|
97
|
+
interface ApprovalRequestFilters {
|
|
98
|
+
daemonId?: string;
|
|
99
|
+
destination?: string;
|
|
100
|
+
limit?: number;
|
|
101
|
+
status?: RelayApprovalStatus;
|
|
102
|
+
tokenAddress?: string;
|
|
103
|
+
}
|
|
104
|
+
interface CreateEncryptedUpdateInput {
|
|
105
|
+
daemonId: string;
|
|
106
|
+
metadata?: Record<string, string>;
|
|
107
|
+
payload: RelayEncryptedPayload;
|
|
108
|
+
targetApprovalRequestId?: string;
|
|
109
|
+
type: string;
|
|
110
|
+
updateId?: string;
|
|
111
|
+
}
|
|
112
|
+
interface ClaimEncryptedUpdatesInput {
|
|
113
|
+
daemonId: string;
|
|
114
|
+
leaseSeconds?: number;
|
|
115
|
+
limit?: number;
|
|
116
|
+
}
|
|
117
|
+
interface SubmitUpdateFeedbackInput {
|
|
118
|
+
claimToken: string;
|
|
119
|
+
daemonId: string;
|
|
120
|
+
details?: Record<string, string>;
|
|
121
|
+
message?: string;
|
|
122
|
+
status: Extract<RelayUpdateStatus, 'applied' | 'failed' | 'rejected'>;
|
|
123
|
+
updateId: string;
|
|
124
|
+
}
|
|
125
|
+
interface ApprovalCapabilityFailureRecord {
|
|
126
|
+
attempts: number;
|
|
127
|
+
blockedUntil?: string;
|
|
128
|
+
firstFailedAt: string;
|
|
129
|
+
lastFailedAt: string;
|
|
130
|
+
}
|
|
131
|
+
interface RecordApprovalCapabilityFailureResult {
|
|
132
|
+
attempts: number;
|
|
133
|
+
blocked: boolean;
|
|
134
|
+
blockedUntil: string | null;
|
|
135
|
+
}
|
|
136
|
+
declare class RelayCacheService {
|
|
137
|
+
private readonly client;
|
|
138
|
+
private readonly namespace;
|
|
139
|
+
constructor(options?: {
|
|
140
|
+
client?: Redis;
|
|
141
|
+
namespace?: string;
|
|
142
|
+
});
|
|
143
|
+
ping(): Promise<string>;
|
|
144
|
+
syncDaemonRegistration(input: SyncDaemonRegistrationInput): Promise<{
|
|
145
|
+
agentKeyCount: number;
|
|
146
|
+
approvalRequestCount: number;
|
|
147
|
+
policyCount: number;
|
|
148
|
+
}>;
|
|
149
|
+
listDaemons(): Promise<RelayDaemonProfile[]>;
|
|
150
|
+
getDaemonProfile(daemonId: string): Promise<RelayDaemonProfile | null>;
|
|
151
|
+
getDaemonPolicies(daemonId: string): Promise<RelayPolicyRecord[]>;
|
|
152
|
+
getDaemonAgentKeys(daemonId: string): Promise<RelayAgentKeyRecord[]>;
|
|
153
|
+
getApprovalRequest(approvalRequestId: string): Promise<RelayApprovalRequestRecord | null>;
|
|
154
|
+
listApprovalRequests(filters?: ApprovalRequestFilters): Promise<RelayApprovalRequestRecord[]>;
|
|
155
|
+
createEncryptedUpdate(input: CreateEncryptedUpdateInput): Promise<RelayEncryptedUpdateRecord>;
|
|
156
|
+
hasActiveApprovalUpdate(daemonId: string, approvalRequestId: string): Promise<boolean>;
|
|
157
|
+
consumeApprovalCapability(approvalRequestId: string, capabilityHash: string): Promise<boolean>;
|
|
158
|
+
releaseApprovalCapabilityConsumption(approvalRequestId: string, capabilityHash: string): Promise<void>;
|
|
159
|
+
clearApprovalCapabilityFailures(approvalRequestId: string): Promise<void>;
|
|
160
|
+
recordApprovalCapabilityFailure(approvalRequestId: string): Promise<RecordApprovalCapabilityFailureResult>;
|
|
161
|
+
rotateApprovalCapability(approvalRequestId: string): Promise<RelayApprovalRequestRecord>;
|
|
162
|
+
claimEncryptedUpdates(input: ClaimEncryptedUpdatesInput): Promise<RelayEncryptedUpdateRecord[]>;
|
|
163
|
+
submitUpdateFeedback(input: SubmitUpdateFeedbackInput): Promise<RelayEncryptedUpdateRecord>;
|
|
164
|
+
getEncryptedUpdate(updateId: string): Promise<RelayEncryptedUpdateRecord | null>;
|
|
165
|
+
removeEncryptedUpdate(daemonId: string, updateId: string): Promise<void>;
|
|
166
|
+
private readonly daemonIndexKey;
|
|
167
|
+
private readonly daemonProfileKey;
|
|
168
|
+
private readonly daemonPoliciesKey;
|
|
169
|
+
private readonly daemonAgentKeysKey;
|
|
170
|
+
private readonly daemonApprovalsKey;
|
|
171
|
+
private readonly daemonUpdatesKey;
|
|
172
|
+
private readonly approvalKey;
|
|
173
|
+
private readonly approvalCapabilityConsumedKey;
|
|
174
|
+
private readonly approvalCapabilityFailuresKey;
|
|
175
|
+
private readonly updateKey;
|
|
176
|
+
private readJson;
|
|
177
|
+
private writeJson;
|
|
178
|
+
}
|
|
179
|
+
declare const createRelayCacheService: (options?: {
|
|
180
|
+
client?: Redis;
|
|
181
|
+
namespace?: string;
|
|
182
|
+
}) => RelayCacheService;
|
|
183
|
+
|
|
184
|
+
export { type ApprovalCapabilityFailureRecord, type ApprovalRequestFilters, type ClaimEncryptedUpdatesInput, type CreateEncryptedUpdateInput, type RecordApprovalCapabilityFailureResult, type RelayAgentKeyRecord, type RelayApprovalRequestRecord, type RelayApprovalStatus, RelayCacheService, type RelayDaemonProfile, type RelayEncryptedPayload, type RelayEncryptedUpdateRecord, type RelayPolicyRecord, type RelayUpdateFeedbackRecord, type RelayUpdateStatus, type SubmitUpdateFeedbackInput, type SyncDaemonRegistrationInput, createRelayCacheService, relayApprovalStatuses, relayUpdateStatuses };
|
|
@@ -0,0 +1,184 @@
|
|
|
1
|
+
import Redis from 'ioredis';
|
|
2
|
+
|
|
3
|
+
declare const relayApprovalStatuses: readonly ["pending", "approved", "rejected", "completed", "expired"];
|
|
4
|
+
type RelayApprovalStatus = (typeof relayApprovalStatuses)[number];
|
|
5
|
+
declare const relayUpdateStatuses: readonly ["pending", "inflight", "applied", "rejected", "failed"];
|
|
6
|
+
type RelayUpdateStatus = (typeof relayUpdateStatuses)[number];
|
|
7
|
+
interface RelayDaemonProfile {
|
|
8
|
+
daemonId: string;
|
|
9
|
+
daemonPublicKey: string;
|
|
10
|
+
ethereumAddress: string;
|
|
11
|
+
label?: string;
|
|
12
|
+
lastSeenAt: string;
|
|
13
|
+
registeredAt: string;
|
|
14
|
+
relayUrl?: string;
|
|
15
|
+
signerBackend?: string;
|
|
16
|
+
status: 'active' | 'paused';
|
|
17
|
+
updatedAt: string;
|
|
18
|
+
version?: string;
|
|
19
|
+
}
|
|
20
|
+
interface RelayPolicyRecord {
|
|
21
|
+
action: string;
|
|
22
|
+
amountMaxWei?: string;
|
|
23
|
+
amountMinWei?: string;
|
|
24
|
+
chainId?: number;
|
|
25
|
+
daemonId: string;
|
|
26
|
+
destination: string;
|
|
27
|
+
metadata?: Record<string, string>;
|
|
28
|
+
policyId: string;
|
|
29
|
+
requiresManualApproval: boolean;
|
|
30
|
+
scope: 'default' | 'override';
|
|
31
|
+
tokenAddress?: string;
|
|
32
|
+
updatedAt: string;
|
|
33
|
+
}
|
|
34
|
+
interface RelayAgentKeyRecord {
|
|
35
|
+
agentKeyId: string;
|
|
36
|
+
createdAt?: string;
|
|
37
|
+
daemonId: string;
|
|
38
|
+
label?: string;
|
|
39
|
+
metadata?: Record<string, string>;
|
|
40
|
+
status: 'active' | 'revoked';
|
|
41
|
+
updatedAt: string;
|
|
42
|
+
}
|
|
43
|
+
interface RelayApprovalRequestRecord {
|
|
44
|
+
agentKeyId?: string;
|
|
45
|
+
amountWei?: string;
|
|
46
|
+
approvalRequestId: string;
|
|
47
|
+
chainId?: number;
|
|
48
|
+
daemonId: string;
|
|
49
|
+
destination: string;
|
|
50
|
+
metadata?: Record<string, string>;
|
|
51
|
+
network?: string;
|
|
52
|
+
reason?: string;
|
|
53
|
+
requestedAt: string;
|
|
54
|
+
status: RelayApprovalStatus;
|
|
55
|
+
tokenAddress?: string;
|
|
56
|
+
transactionType: string;
|
|
57
|
+
updatedAt: string;
|
|
58
|
+
}
|
|
59
|
+
interface RelayEncryptedPayload {
|
|
60
|
+
aadBase64?: string;
|
|
61
|
+
algorithm: string;
|
|
62
|
+
ciphertextBase64: string;
|
|
63
|
+
contentSha256Hex?: string;
|
|
64
|
+
encapsulatedKeyBase64: string;
|
|
65
|
+
nonceBase64: string;
|
|
66
|
+
schemaVersion: number;
|
|
67
|
+
}
|
|
68
|
+
interface RelayUpdateFeedbackRecord {
|
|
69
|
+
daemonId: string;
|
|
70
|
+
details?: Record<string, string>;
|
|
71
|
+
feedbackAt: string;
|
|
72
|
+
message?: string;
|
|
73
|
+
status: Extract<RelayUpdateStatus, 'applied' | 'failed' | 'rejected'>;
|
|
74
|
+
updateId: string;
|
|
75
|
+
}
|
|
76
|
+
interface RelayEncryptedUpdateRecord {
|
|
77
|
+
claimToken?: string;
|
|
78
|
+
claimUntil?: string;
|
|
79
|
+
createdAt: string;
|
|
80
|
+
daemonId: string;
|
|
81
|
+
feedback?: RelayUpdateFeedbackRecord;
|
|
82
|
+
lastDeliveredAt?: string;
|
|
83
|
+
metadata?: Record<string, string>;
|
|
84
|
+
payload: RelayEncryptedPayload;
|
|
85
|
+
status: RelayUpdateStatus;
|
|
86
|
+
targetApprovalRequestId?: string;
|
|
87
|
+
type: string;
|
|
88
|
+
updateId: string;
|
|
89
|
+
updatedAt: string;
|
|
90
|
+
}
|
|
91
|
+
interface SyncDaemonRegistrationInput {
|
|
92
|
+
agentKeys?: RelayAgentKeyRecord[];
|
|
93
|
+
approvalRequests?: RelayApprovalRequestRecord[];
|
|
94
|
+
daemon: RelayDaemonProfile;
|
|
95
|
+
policies?: RelayPolicyRecord[];
|
|
96
|
+
}
|
|
97
|
+
interface ApprovalRequestFilters {
|
|
98
|
+
daemonId?: string;
|
|
99
|
+
destination?: string;
|
|
100
|
+
limit?: number;
|
|
101
|
+
status?: RelayApprovalStatus;
|
|
102
|
+
tokenAddress?: string;
|
|
103
|
+
}
|
|
104
|
+
interface CreateEncryptedUpdateInput {
|
|
105
|
+
daemonId: string;
|
|
106
|
+
metadata?: Record<string, string>;
|
|
107
|
+
payload: RelayEncryptedPayload;
|
|
108
|
+
targetApprovalRequestId?: string;
|
|
109
|
+
type: string;
|
|
110
|
+
updateId?: string;
|
|
111
|
+
}
|
|
112
|
+
interface ClaimEncryptedUpdatesInput {
|
|
113
|
+
daemonId: string;
|
|
114
|
+
leaseSeconds?: number;
|
|
115
|
+
limit?: number;
|
|
116
|
+
}
|
|
117
|
+
interface SubmitUpdateFeedbackInput {
|
|
118
|
+
claimToken: string;
|
|
119
|
+
daemonId: string;
|
|
120
|
+
details?: Record<string, string>;
|
|
121
|
+
message?: string;
|
|
122
|
+
status: Extract<RelayUpdateStatus, 'applied' | 'failed' | 'rejected'>;
|
|
123
|
+
updateId: string;
|
|
124
|
+
}
|
|
125
|
+
interface ApprovalCapabilityFailureRecord {
|
|
126
|
+
attempts: number;
|
|
127
|
+
blockedUntil?: string;
|
|
128
|
+
firstFailedAt: string;
|
|
129
|
+
lastFailedAt: string;
|
|
130
|
+
}
|
|
131
|
+
interface RecordApprovalCapabilityFailureResult {
|
|
132
|
+
attempts: number;
|
|
133
|
+
blocked: boolean;
|
|
134
|
+
blockedUntil: string | null;
|
|
135
|
+
}
|
|
136
|
+
declare class RelayCacheService {
|
|
137
|
+
private readonly client;
|
|
138
|
+
private readonly namespace;
|
|
139
|
+
constructor(options?: {
|
|
140
|
+
client?: Redis;
|
|
141
|
+
namespace?: string;
|
|
142
|
+
});
|
|
143
|
+
ping(): Promise<string>;
|
|
144
|
+
syncDaemonRegistration(input: SyncDaemonRegistrationInput): Promise<{
|
|
145
|
+
agentKeyCount: number;
|
|
146
|
+
approvalRequestCount: number;
|
|
147
|
+
policyCount: number;
|
|
148
|
+
}>;
|
|
149
|
+
listDaemons(): Promise<RelayDaemonProfile[]>;
|
|
150
|
+
getDaemonProfile(daemonId: string): Promise<RelayDaemonProfile | null>;
|
|
151
|
+
getDaemonPolicies(daemonId: string): Promise<RelayPolicyRecord[]>;
|
|
152
|
+
getDaemonAgentKeys(daemonId: string): Promise<RelayAgentKeyRecord[]>;
|
|
153
|
+
getApprovalRequest(approvalRequestId: string): Promise<RelayApprovalRequestRecord | null>;
|
|
154
|
+
listApprovalRequests(filters?: ApprovalRequestFilters): Promise<RelayApprovalRequestRecord[]>;
|
|
155
|
+
createEncryptedUpdate(input: CreateEncryptedUpdateInput): Promise<RelayEncryptedUpdateRecord>;
|
|
156
|
+
hasActiveApprovalUpdate(daemonId: string, approvalRequestId: string): Promise<boolean>;
|
|
157
|
+
consumeApprovalCapability(approvalRequestId: string, capabilityHash: string): Promise<boolean>;
|
|
158
|
+
releaseApprovalCapabilityConsumption(approvalRequestId: string, capabilityHash: string): Promise<void>;
|
|
159
|
+
clearApprovalCapabilityFailures(approvalRequestId: string): Promise<void>;
|
|
160
|
+
recordApprovalCapabilityFailure(approvalRequestId: string): Promise<RecordApprovalCapabilityFailureResult>;
|
|
161
|
+
rotateApprovalCapability(approvalRequestId: string): Promise<RelayApprovalRequestRecord>;
|
|
162
|
+
claimEncryptedUpdates(input: ClaimEncryptedUpdatesInput): Promise<RelayEncryptedUpdateRecord[]>;
|
|
163
|
+
submitUpdateFeedback(input: SubmitUpdateFeedbackInput): Promise<RelayEncryptedUpdateRecord>;
|
|
164
|
+
getEncryptedUpdate(updateId: string): Promise<RelayEncryptedUpdateRecord | null>;
|
|
165
|
+
removeEncryptedUpdate(daemonId: string, updateId: string): Promise<void>;
|
|
166
|
+
private readonly daemonIndexKey;
|
|
167
|
+
private readonly daemonProfileKey;
|
|
168
|
+
private readonly daemonPoliciesKey;
|
|
169
|
+
private readonly daemonAgentKeysKey;
|
|
170
|
+
private readonly daemonApprovalsKey;
|
|
171
|
+
private readonly daemonUpdatesKey;
|
|
172
|
+
private readonly approvalKey;
|
|
173
|
+
private readonly approvalCapabilityConsumedKey;
|
|
174
|
+
private readonly approvalCapabilityFailuresKey;
|
|
175
|
+
private readonly updateKey;
|
|
176
|
+
private readJson;
|
|
177
|
+
private writeJson;
|
|
178
|
+
}
|
|
179
|
+
declare const createRelayCacheService: (options?: {
|
|
180
|
+
client?: Redis;
|
|
181
|
+
namespace?: string;
|
|
182
|
+
}) => RelayCacheService;
|
|
183
|
+
|
|
184
|
+
export { type ApprovalCapabilityFailureRecord, type ApprovalRequestFilters, type ClaimEncryptedUpdatesInput, type CreateEncryptedUpdateInput, type RecordApprovalCapabilityFailureResult, type RelayAgentKeyRecord, type RelayApprovalRequestRecord, type RelayApprovalStatus, RelayCacheService, type RelayDaemonProfile, type RelayEncryptedPayload, type RelayEncryptedUpdateRecord, type RelayPolicyRecord, type RelayUpdateFeedbackRecord, type RelayUpdateStatus, type SubmitUpdateFeedbackInput, type SyncDaemonRegistrationInput, createRelayCacheService, relayApprovalStatuses, relayUpdateStatuses };
|