@oobe-protocol-labs/synapse-client-sdk 1.2.0 → 1.2.2
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/CHANGELOG.md +117 -0
- package/dist/cjs/ai/gateway/index.d.ts +86 -5
- package/dist/cjs/ai/gateway/index.d.ts.map +1 -1
- package/dist/cjs/ai/gateway/index.js +278 -40
- package/dist/cjs/ai/gateway/index.js.map +1 -1
- package/dist/cjs/ai/gateway/registry.d.ts +223 -0
- package/dist/cjs/ai/gateway/registry.d.ts.map +1 -0
- package/dist/cjs/ai/gateway/registry.js +290 -0
- package/dist/cjs/ai/gateway/registry.js.map +1 -0
- package/dist/cjs/ai/gateway/types.d.ts +107 -1
- package/dist/cjs/ai/gateway/types.d.ts.map +1 -1
- package/dist/cjs/ai/gateway/x402/index.d.ts +2 -4
- package/dist/cjs/ai/gateway/x402/index.d.ts.map +1 -1
- package/dist/cjs/ai/gateway/x402/index.js +2 -1
- package/dist/cjs/ai/gateway/x402/index.js.map +1 -1
- package/dist/cjs/ai/gateway/x402/registry.d.ts +131 -1
- package/dist/cjs/ai/gateway/x402/registry.d.ts.map +1 -1
- package/dist/cjs/ai/gateway/x402/registry.js +229 -1
- package/dist/cjs/ai/gateway/x402/registry.js.map +1 -1
- package/dist/cjs/ai/index.d.ts +2 -1
- package/dist/cjs/ai/index.d.ts.map +1 -1
- package/dist/cjs/ai/index.js +21 -2
- package/dist/cjs/ai/index.js.map +1 -1
- package/dist/cjs/ai/persistence/helpers.d.ts +83 -0
- package/dist/cjs/ai/persistence/helpers.d.ts.map +1 -0
- package/dist/cjs/ai/persistence/helpers.js +193 -0
- package/dist/cjs/ai/persistence/helpers.js.map +1 -0
- package/dist/cjs/ai/persistence/index.d.ts +91 -0
- package/dist/cjs/ai/persistence/index.d.ts.map +1 -0
- package/dist/cjs/ai/persistence/index.js +109 -0
- package/dist/cjs/ai/persistence/index.js.map +1 -0
- package/dist/cjs/ai/persistence/memory.d.ts +71 -0
- package/dist/cjs/ai/persistence/memory.d.ts.map +1 -0
- package/dist/cjs/ai/persistence/memory.js +192 -0
- package/dist/cjs/ai/persistence/memory.js.map +1 -0
- package/dist/cjs/ai/persistence/postgresql.d.ts +119 -0
- package/dist/cjs/ai/persistence/postgresql.d.ts.map +1 -0
- package/dist/cjs/ai/persistence/postgresql.js +310 -0
- package/dist/cjs/ai/persistence/postgresql.js.map +1 -0
- package/dist/cjs/ai/persistence/redis.d.ts +84 -0
- package/dist/cjs/ai/persistence/redis.d.ts.map +1 -0
- package/dist/cjs/ai/persistence/redis.js +241 -0
- package/dist/cjs/ai/persistence/redis.js.map +1 -0
- package/dist/cjs/ai/persistence/types.d.ts +267 -0
- package/dist/cjs/ai/persistence/types.d.ts.map +1 -0
- package/dist/cjs/ai/persistence/types.js +40 -0
- package/dist/cjs/ai/persistence/types.js.map +1 -0
- package/dist/cjs/ai/tools/protocols/metaplex/tools.d.ts.map +1 -1
- package/dist/cjs/ai/tools/protocols/metaplex/tools.js +13 -19
- package/dist/cjs/ai/tools/protocols/metaplex/tools.js.map +1 -1
- package/dist/cjs/core/client.d.ts +16 -0
- package/dist/cjs/core/client.d.ts.map +1 -1
- package/dist/cjs/core/client.js +18 -0
- package/dist/cjs/core/client.js.map +1 -1
- package/dist/cjs/core/transport.d.ts +1 -1
- package/dist/cjs/core/transport.d.ts.map +1 -1
- package/dist/cjs/core/transport.js.map +1 -1
- package/dist/cjs/core/types.d.ts +5 -1
- package/dist/cjs/core/types.d.ts.map +1 -1
- package/dist/cjs/das/methods/get-asset-batch.js +1 -1
- package/dist/cjs/das/methods/get-asset-batch.js.map +1 -1
- package/dist/cjs/das/methods/get-asset-proof-batch.js +1 -1
- package/dist/cjs/das/methods/get-asset-proof-batch.js.map +1 -1
- package/dist/cjs/das/methods/get-asset-proof.js +1 -1
- package/dist/cjs/das/methods/get-asset-proof.js.map +1 -1
- package/dist/cjs/das/methods/get-asset.js +1 -1
- package/dist/cjs/das/methods/get-asset.js.map +1 -1
- package/dist/cjs/das/methods/get-assets-by-authority.js +1 -1
- package/dist/cjs/das/methods/get-assets-by-authority.js.map +1 -1
- package/dist/cjs/das/methods/get-assets-by-creator.js +1 -1
- package/dist/cjs/das/methods/get-assets-by-creator.js.map +1 -1
- package/dist/cjs/das/methods/get-assets-by-group.js +1 -1
- package/dist/cjs/das/methods/get-assets-by-group.js.map +1 -1
- package/dist/cjs/das/methods/get-assets-by-owner.js +1 -1
- package/dist/cjs/das/methods/get-assets-by-owner.js.map +1 -1
- package/dist/cjs/das/methods/get-signatures-for-asset.js +1 -1
- package/dist/cjs/das/methods/get-signatures-for-asset.js.map +1 -1
- package/dist/cjs/das/methods/get-token-accounts.js +1 -1
- package/dist/cjs/das/methods/get-token-accounts.js.map +1 -1
- package/dist/cjs/das/methods/search-assets.js +1 -1
- package/dist/cjs/das/methods/search-assets.js.map +1 -1
- package/dist/cjs/next/index.d.ts +141 -0
- package/dist/cjs/next/index.d.ts.map +1 -0
- package/dist/cjs/next/index.js +177 -0
- package/dist/cjs/next/index.js.map +1 -0
- package/dist/cjs/utils/helpers.d.ts +79 -1
- package/dist/cjs/utils/helpers.d.ts.map +1 -1
- package/dist/cjs/utils/helpers.js +109 -0
- package/dist/cjs/utils/helpers.js.map +1 -1
- package/dist/docs/assets/navigation.js +1 -1
- package/dist/docs/assets/search.js +1 -1
- package/dist/docs/classes/AccountReader.html +18 -18
- package/dist/docs/classes/AccountsClient.html +10 -10
- package/dist/docs/classes/AsyncProviderError.html +4 -4
- package/dist/docs/classes/CircularDependencyError.html +4 -4
- package/dist/docs/classes/DasClient.html +13 -13
- package/dist/docs/classes/GeyserParser.html +17 -17
- package/dist/docs/classes/GrpcTransport.html +6 -6
- package/dist/docs/classes/HttpTransport.html +5 -5
- package/dist/docs/classes/InstructionWriter.html +11 -11
- package/dist/docs/classes/MemoryGuard.html +9 -9
- package/dist/docs/classes/NetworkError.html +5 -5
- package/dist/docs/classes/RefRegistry.html +11 -11
- package/dist/docs/classes/RefReleasedError.html +4 -4
- package/dist/docs/classes/RpcMethodNotFoundError.html +4 -4
- package/dist/docs/classes/ServiceNotFoundError.html +4 -4
- package/dist/docs/classes/ServiceRef.html +13 -13
- package/dist/docs/classes/SolanaRpc.html +55 -55
- package/dist/docs/classes/SynapseClient.html +25 -15
- package/dist/docs/classes/SynapseContext.html +27 -27
- package/dist/docs/classes/SynapseError.html +4 -4
- package/dist/docs/classes/TimeoutError.html +4 -4
- package/dist/docs/classes/UpstreamError.html +6 -6
- package/dist/docs/classes/WeakServiceRef.html +4 -4
- package/dist/docs/classes/WsClient.html +10 -10
- package/dist/docs/enums/SynapseNetwork.html +2 -2
- package/dist/docs/enums/SynapseRegion.html +2 -2
- package/dist/docs/enums/TokenExtensionType.html +2 -2
- package/dist/docs/functions/Epoch-1.html +1 -1
- package/dist/docs/functions/Lamports-2.html +1 -1
- package/dist/docs/functions/Pubkey-1.html +1 -1
- package/dist/docs/functions/Sig.html +1 -1
- package/dist/docs/functions/Slot-1.html +1 -1
- package/dist/docs/functions/UnixTs.html +1 -1
- package/dist/docs/functions/autoSelectRegion.html +1 -1
- package/dist/docs/functions/autoWire.html +1 -1
- package/dist/docs/functions/base58Encode.html +1 -1
- package/dist/docs/functions/base64ToBytes.html +1 -1
- package/dist/docs/functions/bigIntReplacer.html +6 -0
- package/dist/docs/functions/chunk.html +1 -1
- package/dist/docs/functions/computeBalanceChanges.html +1 -1
- package/dist/docs/functions/computeTokenBalanceChanges.html +1 -1
- package/dist/docs/functions/createBareContext.html +1 -1
- package/dist/docs/functions/createBinding.html +1 -1
- package/dist/docs/functions/createBoundHook.html +1 -1
- package/dist/docs/functions/createReactAdapter.html +1 -1
- package/dist/docs/functions/createRefHook.html +1 -1
- package/dist/docs/functions/createServerMiddleware.html +1 -1
- package/dist/docs/functions/createServiceHook.html +1 -1
- package/dist/docs/functions/createSingleton.html +15 -0
- package/dist/docs/functions/createSynapse.html +1 -1
- package/dist/docs/functions/createSynapseContext.html +1 -1
- package/dist/docs/functions/createToken.html +1 -1
- package/dist/docs/functions/decodeBase58.html +1 -1
- package/dist/docs/functions/decodeLookupTable.html +1 -1
- package/dist/docs/functions/decodeMint.html +1 -1
- package/dist/docs/functions/decodeMultisig.html +1 -1
- package/dist/docs/functions/decodeNonceAccount.html +1 -1
- package/dist/docs/functions/decodeStakeAccount.html +1 -1
- package/dist/docs/functions/decodeToken2022Account.html +1 -1
- package/dist/docs/functions/decodeToken2022Mint.html +1 -1
- package/dist/docs/functions/decodeTokenAccount.html +1 -1
- package/dist/docs/functions/encodeBase58.html +1 -1
- package/dist/docs/functions/fetchLookupTable.html +1 -1
- package/dist/docs/functions/fetchMint.html +1 -1
- package/dist/docs/functions/fetchNonceAccount.html +1 -1
- package/dist/docs/functions/fetchStakeAccount.html +1 -1
- package/dist/docs/functions/fetchTokenAccount.html +1 -1
- package/dist/docs/functions/fetchTokenAccountsByOwner.html +1 -1
- package/dist/docs/functions/fromKitAddress.html +1 -1
- package/dist/docs/functions/getAccountInfo.html +1 -1
- package/dist/docs/functions/getAsset.html +1 -1
- package/dist/docs/functions/getAssetBatch.html +1 -1
- package/dist/docs/functions/getAssetProof.html +1 -1
- package/dist/docs/functions/getAssetProofBatch.html +1 -1
- package/dist/docs/functions/getAssetsByAuthority.html +1 -1
- package/dist/docs/functions/getAssetsByCreator.html +1 -1
- package/dist/docs/functions/getAssetsByGroup.html +1 -1
- package/dist/docs/functions/getAssetsByOwner.html +1 -1
- package/dist/docs/functions/getBalance.html +1 -1
- package/dist/docs/functions/getBlock.html +1 -1
- package/dist/docs/functions/getBlockCommitment.html +1 -1
- package/dist/docs/functions/getBlockHeight.html +1 -1
- package/dist/docs/functions/getBlockProduction.html +1 -1
- package/dist/docs/functions/getBlockTime.html +1 -1
- package/dist/docs/functions/getBlocks.html +1 -1
- package/dist/docs/functions/getBlocksWithLimit.html +1 -1
- package/dist/docs/functions/getClusterNodes.html +1 -1
- package/dist/docs/functions/getContext.html +1 -1
- package/dist/docs/functions/getDecodedAccount.html +1 -1
- package/dist/docs/functions/getDecodedAccounts.html +1 -1
- package/dist/docs/functions/getEnvironment.html +1 -1
- package/dist/docs/functions/getEpochInfo.html +1 -1
- package/dist/docs/functions/getEpochSchedule.html +1 -1
- package/dist/docs/functions/getFeeForMessage.html +1 -1
- package/dist/docs/functions/getFirstAvailableBlock.html +1 -1
- package/dist/docs/functions/getGenesisHash.html +1 -1
- package/dist/docs/functions/getHealth.html +1 -1
- package/dist/docs/functions/getHighestSnapshotSlot.html +1 -1
- package/dist/docs/functions/getIdentity.html +1 -1
- package/dist/docs/functions/getInflationGovernor.html +1 -1
- package/dist/docs/functions/getInflationRate.html +1 -1
- package/dist/docs/functions/getInflationReward.html +1 -1
- package/dist/docs/functions/getLargestAccounts.html +1 -1
- package/dist/docs/functions/getLatestBlockhash.html +1 -1
- package/dist/docs/functions/getLeaderSchedule.html +1 -1
- package/dist/docs/functions/getMaxRetransmitSlot.html +1 -1
- package/dist/docs/functions/getMaxShredInsertSlot.html +1 -1
- package/dist/docs/functions/getMinimumBalanceForRentExemption.html +1 -1
- package/dist/docs/functions/getMultipleAccounts.html +1 -1
- package/dist/docs/functions/getProgramAccounts.html +1 -1
- package/dist/docs/functions/getProgramCategory.html +1 -1
- package/dist/docs/functions/getRecentPerformanceSamples.html +1 -1
- package/dist/docs/functions/getRecentPrioritizationFees.html +1 -1
- package/dist/docs/functions/getSignatureStatuses.html +1 -1
- package/dist/docs/functions/getSignaturesForAddress.html +1 -1
- package/dist/docs/functions/getSignaturesForAsset.html +1 -1
- package/dist/docs/functions/getSlot.html +1 -1
- package/dist/docs/functions/getSlotLeader.html +1 -1
- package/dist/docs/functions/getSlotLeaders.html +1 -1
- package/dist/docs/functions/getStakeActivation.html +1 -1
- package/dist/docs/functions/getStakeMinimumDelegation.html +1 -1
- package/dist/docs/functions/getSupply.html +1 -1
- package/dist/docs/functions/getTokenAccountBalance.html +1 -1
- package/dist/docs/functions/getTokenAccounts.html +1 -1
- package/dist/docs/functions/getTokenAccountsByDelegate.html +1 -1
- package/dist/docs/functions/getTokenAccountsByOwner.html +1 -1
- package/dist/docs/functions/getTokenLargestAccounts.html +1 -1
- package/dist/docs/functions/getTokenSupply.html +1 -1
- package/dist/docs/functions/getTransaction.html +1 -1
- package/dist/docs/functions/getTransactionCount.html +1 -1
- package/dist/docs/functions/getVersion.html +1 -1
- package/dist/docs/functions/getVoteAccounts.html +1 -1
- package/dist/docs/functions/isBlockhashValid.html +1 -1
- package/dist/docs/functions/isBrowser.html +1 -1
- package/dist/docs/functions/isDisposable.html +1 -1
- package/dist/docs/functions/isProgramInCategory.html +1 -1
- package/dist/docs/functions/isServer.html +1 -1
- package/dist/docs/functions/isValidPubkey.html +1 -1
- package/dist/docs/functions/isValidSignature.html +1 -1
- package/dist/docs/functions/lamportsToSol.html +1 -1
- package/dist/docs/functions/listEndpoints.html +1 -1
- package/dist/docs/functions/listNetworks.html +1 -1
- package/dist/docs/functions/listRegions.html +1 -1
- package/dist/docs/functions/minimumLedgerSlot.html +1 -1
- package/dist/docs/functions/parseAccountUpdate.html +1 -1
- package/dist/docs/functions/parseBlockMeta.html +1 -1
- package/dist/docs/functions/parseEntry.html +1 -1
- package/dist/docs/functions/parseGeyserUpdate.html +1 -1
- package/dist/docs/functions/parseSlotUpdate.html +1 -1
- package/dist/docs/functions/parseTimestamp.html +1 -1
- package/dist/docs/functions/parseTransaction.html +1 -1
- package/dist/docs/functions/probeLatency.html +1 -1
- package/dist/docs/functions/rawBufferToBase58.html +1 -1
- package/dist/docs/functions/rawBufferToBase64.html +1 -1
- package/dist/docs/functions/rawBufferToBytes.html +1 -1
- package/dist/docs/functions/rawBufferToHex.html +1 -1
- package/dist/docs/functions/readonly.html +1 -1
- package/dist/docs/functions/readonlySigner.html +1 -1
- package/dist/docs/functions/requestAirdrop.html +1 -1
- package/dist/docs/functions/resolveEndpoint.html +1 -1
- package/dist/docs/functions/resolveProgram.html +1 -1
- package/dist/docs/functions/resolveProgramBatch.html +1 -1
- package/dist/docs/functions/retry.html +1 -1
- package/dist/docs/functions/searchAssets.html +1 -1
- package/dist/docs/functions/sendTransaction.html +1 -1
- package/dist/docs/functions/setGlobalContext.html +1 -1
- package/dist/docs/functions/simulateTransaction.html +1 -1
- package/dist/docs/functions/sleep.html +1 -1
- package/dist/docs/functions/solToLamports.html +1 -1
- package/dist/docs/functions/toClientConfig.html +1 -1
- package/dist/docs/functions/toJsonSafe.html +13 -0
- package/dist/docs/functions/toKitAddress.html +1 -1
- package/dist/docs/functions/toKitInstruction.html +1 -1
- package/dist/docs/functions/toKitLamports.html +1 -1
- package/dist/docs/functions/toKitSignatureString.html +1 -1
- package/dist/docs/functions/tryGetContext.html +1 -1
- package/dist/docs/functions/tryUseService.html +1 -1
- package/dist/docs/functions/useBoundServices.html +1 -1
- package/dist/docs/functions/useService.html +1 -1
- package/dist/docs/functions/useSharedRef.html +1 -1
- package/dist/docs/functions/withRef.html +1 -1
- package/dist/docs/functions/withRefAsync.html +1 -1
- package/dist/docs/functions/writable.html +1 -1
- package/dist/docs/functions/writableSigner.html +1 -1
- package/dist/docs/interfaces/AccountInfo.html +7 -7
- package/dist/docs/interfaces/AccountMeta.html +4 -4
- package/dist/docs/interfaces/AccountNotification.html +2 -2
- package/dist/docs/interfaces/AccountSubParams.html +2 -2
- package/dist/docs/interfaces/AddMemoParams.html +5 -5
- package/dist/docs/interfaces/AdvanceNonceParams.html +3 -3
- package/dist/docs/interfaces/AliasProvider.html +2 -2
- package/dist/docs/interfaces/AllocateParams.html +3 -3
- package/dist/docs/interfaces/ApproveCheckedParams.html +9 -9
- package/dist/docs/interfaces/ApproveParams.html +7 -7
- package/dist/docs/interfaces/AssetSignatureInfo.html +2 -2
- package/dist/docs/interfaces/AssetSignaturesPage.html +2 -2
- package/dist/docs/interfaces/AssignParams.html +3 -3
- package/dist/docs/interfaces/AsyncFactoryProvider.html +2 -2
- package/dist/docs/interfaces/AuthorizeNonceParams.html +4 -4
- package/dist/docs/interfaces/BalanceChange.html +6 -6
- package/dist/docs/interfaces/BlockProduction.html +3 -3
- package/dist/docs/interfaces/BlockResult.html +2 -2
- package/dist/docs/interfaces/BlockReward.html +2 -2
- package/dist/docs/interfaces/BlockhashResult.html +2 -2
- package/dist/docs/interfaces/BurnCheckedParams.html +8 -8
- package/dist/docs/interfaces/BurnParams.html +7 -7
- package/dist/docs/interfaces/CallOptions.html +6 -6
- package/dist/docs/interfaces/ClassProvider.html +2 -2
- package/dist/docs/interfaces/CloseAccountParams.html +6 -6
- package/dist/docs/interfaces/ConfirmedTransaction.html +6 -6
- package/dist/docs/interfaces/ContactInfo.html +2 -2
- package/dist/docs/interfaces/ContextAdapter.html +5 -5
- package/dist/docs/interfaces/ContextEvents.html +6 -6
- package/dist/docs/interfaces/ContextModule.html +3 -3
- package/dist/docs/interfaces/CreateATAParams.html +6 -6
- package/dist/docs/interfaces/CreateAccountParams.html +6 -6
- package/dist/docs/interfaces/CreateAccountWithSeedParams.html +8 -8
- package/dist/docs/interfaces/CreateSynapseContextOpts.html +4 -4
- package/dist/docs/interfaces/DasAsset.html +2 -2
- package/dist/docs/interfaces/DasAssetProof.html +2 -2
- package/dist/docs/interfaces/DasAuthority.html +2 -2
- package/dist/docs/interfaces/DasCompression.html +2 -2
- package/dist/docs/interfaces/DasContent.html +2 -2
- package/dist/docs/interfaces/DasCreator.html +2 -2
- package/dist/docs/interfaces/DasFile.html +2 -2
- package/dist/docs/interfaces/DasGrouping.html +2 -2
- package/dist/docs/interfaces/DasOpts.html +2 -2
- package/dist/docs/interfaces/DasOwnership.html +2 -2
- package/dist/docs/interfaces/DasPage.html +2 -2
- package/dist/docs/interfaces/DasRoyalty.html +2 -2
- package/dist/docs/interfaces/DasSearchParams.html +2 -2
- package/dist/docs/interfaces/DasSupply.html +2 -2
- package/dist/docs/interfaces/DataSlice.html +3 -3
- package/dist/docs/interfaces/DecodedAccountResult.html +4 -4
- package/dist/docs/interfaces/DecodedLookupTable.html +8 -8
- package/dist/docs/interfaces/DecodedMint.html +6 -6
- package/dist/docs/interfaces/DecodedMultisig.html +5 -5
- package/dist/docs/interfaces/DecodedNonceAccount.html +6 -6
- package/dist/docs/interfaces/DecodedStakeAccount.html +2 -2
- package/dist/docs/interfaces/DecodedToken2022Account.html +9 -9
- package/dist/docs/interfaces/DecodedToken2022Mint.html +6 -6
- package/dist/docs/interfaces/DecodedTokenAccount.html +9 -9
- package/dist/docs/interfaces/DefaultAccountStateExt.html +2 -2
- package/dist/docs/interfaces/Disposable.html +2 -2
- package/dist/docs/interfaces/EndpointConnectConfig.html +5 -5
- package/dist/docs/interfaces/EpochInfo.html +7 -7
- package/dist/docs/interfaces/EpochSchedule.html +2 -2
- package/dist/docs/interfaces/FactoryProvider.html +2 -2
- package/dist/docs/interfaces/FetchedMint.html +6 -6
- package/dist/docs/interfaces/FetchedTokenAccount.html +6 -6
- package/dist/docs/interfaces/FreezeThawParams.html +6 -6
- package/dist/docs/interfaces/GetAccountInfoOpts.html +6 -6
- package/dist/docs/interfaces/GetAssetsByAuthorityParams.html +2 -2
- package/dist/docs/interfaces/GetAssetsByCreatorParams.html +2 -2
- package/dist/docs/interfaces/GetAssetsByGroupParams.html +2 -2
- package/dist/docs/interfaces/GetAssetsByOwnerParams.html +2 -2
- package/dist/docs/interfaces/GetBlockOpts.html +6 -6
- package/dist/docs/interfaces/GetBlockProductionOpts.html +6 -6
- package/dist/docs/interfaces/GetMultipleAccountsOpts.html +6 -6
- package/dist/docs/interfaces/GetProgramAccountsOpts.html +6 -6
- package/dist/docs/interfaces/GetSignatureStatusesOpts.html +6 -6
- package/dist/docs/interfaces/GetSignaturesOpts.html +7 -7
- package/dist/docs/interfaces/GetTokenAccountsParams.html +2 -2
- package/dist/docs/interfaces/GetTransactionOpts.html +6 -6
- package/dist/docs/interfaces/GeyserParserConfig.html +6 -6
- package/dist/docs/interfaces/GeyserParserEvents.html +9 -9
- package/dist/docs/interfaces/GeyserParserStats.html +2 -2
- package/dist/docs/interfaces/GrpcCallOptions.html +2 -2
- package/dist/docs/interfaces/GrpcTransportConfig.html +6 -6
- package/dist/docs/interfaces/ImmutableOwnerExt.html +2 -2
- package/dist/docs/interfaces/InflationGovernor.html +2 -2
- package/dist/docs/interfaces/InflationRate.html +2 -2
- package/dist/docs/interfaces/InflationReward.html +2 -2
- package/dist/docs/interfaces/InitializeAccountParams.html +5 -5
- package/dist/docs/interfaces/InitializeMintParams.html +6 -6
- package/dist/docs/interfaces/InitializeNonceParams.html +3 -3
- package/dist/docs/interfaces/InterestBearingConfigExt.html +2 -2
- package/dist/docs/interfaces/LatencyProbeResult.html +2 -2
- package/dist/docs/interfaces/LeakReport.html +5 -5
- package/dist/docs/interfaces/LogsNotification.html +2 -2
- package/dist/docs/interfaces/LogsSubParams.html +2 -2
- package/dist/docs/interfaces/MemoTransferExt.html +2 -2
- package/dist/docs/interfaces/MemoryGuardConfig.html +4 -4
- package/dist/docs/interfaces/MetadataPointerExt.html +2 -2
- package/dist/docs/interfaces/MintCloseAuthorityExt.html +2 -2
- package/dist/docs/interfaces/MintToCheckedParams.html +8 -8
- package/dist/docs/interfaces/MintToParams.html +7 -7
- package/dist/docs/interfaces/NonTransferableExt.html +2 -2
- package/dist/docs/interfaces/PaginationOpts.html +2 -2
- package/dist/docs/interfaces/ParsedAccountUpdate.html +16 -16
- package/dist/docs/interfaces/ParsedBlockMeta.html +2 -2
- package/dist/docs/interfaces/ParsedEntry.html +2 -2
- package/dist/docs/interfaces/ParsedInstruction.html +9 -9
- package/dist/docs/interfaces/ParsedSlotUpdate.html +3 -3
- package/dist/docs/interfaces/ParsedTransaction.html +19 -19
- package/dist/docs/interfaces/PerfSample.html +2 -2
- package/dist/docs/interfaces/PermanentDelegateExt.html +2 -2
- package/dist/docs/interfaces/ProgramAccount.html +2 -2
- package/dist/docs/interfaces/ProgramNotification.html +2 -2
- package/dist/docs/interfaces/ProgramSubParams.html +2 -2
- package/dist/docs/interfaces/ProgramsBundle.html +33 -33
- package/dist/docs/interfaces/RawAccountInfo.html +2 -2
- package/dist/docs/interfaces/RawBlockMeta.html +2 -2
- package/dist/docs/interfaces/RawBuffer.html +2 -2
- package/dist/docs/interfaces/RawCompiledInstruction.html +2 -2
- package/dist/docs/interfaces/RawEntry.html +2 -2
- package/dist/docs/interfaces/RawGeyserUpdate.html +2 -2
- package/dist/docs/interfaces/RawInnerInstruction.html +2 -2
- package/dist/docs/interfaces/RawSlotInfo.html +2 -2
- package/dist/docs/interfaces/RawTimestamp.html +2 -2
- package/dist/docs/interfaces/RawTokenBalance.html +2 -2
- package/dist/docs/interfaces/RawTransactionInfo.html +2 -2
- package/dist/docs/interfaces/ReactAdapterConfig.html +2 -2
- package/dist/docs/interfaces/RecoverNestedParams.html +7 -7
- package/dist/docs/interfaces/RefRegistryConfig.html +2 -2
- package/dist/docs/interfaces/RefStats.html +7 -7
- package/dist/docs/interfaces/RequestHeapFrameParams.html +2 -2
- package/dist/docs/interfaces/ResolveMiddleware.html +1 -1
- package/dist/docs/interfaces/RevokeParams.html +5 -5
- package/dist/docs/interfaces/RootNotification.html +2 -2
- package/dist/docs/interfaces/RootSubParams.html +1 -1
- package/dist/docs/interfaces/RpcContext.html +2 -2
- package/dist/docs/interfaces/RpcError.html +4 -4
- package/dist/docs/interfaces/RpcRequest.html +4 -2
- package/dist/docs/interfaces/RpcResponse.html +2 -2
- package/dist/docs/interfaces/SendTransactionOpts.html +6 -6
- package/dist/docs/interfaces/ServerAdapterConfig.html +3 -3
- package/dist/docs/interfaces/ServiceBinding.html +6 -6
- package/dist/docs/interfaces/ServiceRegistration.html +3 -3
- package/dist/docs/interfaces/ServiceResolver.html +6 -6
- package/dist/docs/interfaces/ServiceToken.html +4 -4
- package/dist/docs/interfaces/SetComputeUnitLimitParams.html +2 -2
- package/dist/docs/interfaces/SetComputeUnitPriceParams.html +2 -2
- package/dist/docs/interfaces/SetLoadedAccountsDataSizeLimitParams.html +2 -2
- package/dist/docs/interfaces/SignatureInfo.html +7 -7
- package/dist/docs/interfaces/SignatureNotification.html +2 -2
- package/dist/docs/interfaces/SignatureStatus.html +5 -5
- package/dist/docs/interfaces/SignatureSubParams.html +2 -2
- package/dist/docs/interfaces/SignaturesForAssetParams.html +2 -2
- package/dist/docs/interfaces/SimulateResult.html +2 -2
- package/dist/docs/interfaces/SimulateTransactionOpts.html +7 -7
- package/dist/docs/interfaces/SingletonOptions.html +7 -0
- package/dist/docs/interfaces/SlotNotification.html +2 -2
- package/dist/docs/interfaces/SlotSubParams.html +1 -1
- package/dist/docs/interfaces/SortOpts.html +2 -2
- package/dist/docs/interfaces/StakeAuthorized.html +2 -2
- package/dist/docs/interfaces/StakeDelegation.html +3 -3
- package/dist/docs/interfaces/StakeLockup.html +4 -4
- package/dist/docs/interfaces/StakeMeta.html +2 -2
- package/dist/docs/interfaces/Supply.html +5 -5
- package/dist/docs/interfaces/SynapseClientConfig.html +9 -9
- package/dist/docs/interfaces/SynapseClientLike.html +2 -2
- package/dist/docs/interfaces/SynapseEndpoint.html +7 -7
- package/dist/docs/interfaces/SyncNativeParams.html +3 -3
- package/dist/docs/interfaces/SystemTransferParams.html +4 -4
- package/dist/docs/interfaces/TokenAccount.html +3 -3
- package/dist/docs/interfaces/TokenAccountsByOwnerResult.html +2 -2
- package/dist/docs/interfaces/TokenAmount.html +5 -5
- package/dist/docs/interfaces/TokenBalanceChange.html +2 -2
- package/dist/docs/interfaces/TokenTransferParams.html +7 -7
- package/dist/docs/interfaces/TransactionInstruction.html +4 -4
- package/dist/docs/interfaces/TransactionMeta.html +11 -11
- package/dist/docs/interfaces/TransferCheckedParams.html +9 -9
- package/dist/docs/interfaces/TransferFeeAmount.html +2 -2
- package/dist/docs/interfaces/TransferFeeConfig.html +2 -2
- package/dist/docs/interfaces/TransportConfig.html +7 -7
- package/dist/docs/interfaces/UnknownExtension.html +2 -2
- package/dist/docs/interfaces/ValueProvider.html +2 -2
- package/dist/docs/interfaces/VoteAccount.html +9 -9
- package/dist/docs/interfaces/VoteAccountsResult.html +3 -3
- package/dist/docs/interfaces/WithdrawNonceParams.html +5 -5
- package/dist/docs/interfaces/WsConfig.html +6 -6
- package/dist/docs/media/CHANGELOG.md +117 -0
- package/dist/docs/modules.html +4 -0
- package/dist/docs/types/AccountFetchOpts.html +1 -1
- package/dist/docs/types/AccountFilter.html +1 -1
- package/dist/docs/types/Base58.html +1 -1
- package/dist/docs/types/Brand.html +1 -1
- package/dist/docs/types/Commitment.html +1 -1
- package/dist/docs/types/DasSortBy.html +1 -1
- package/dist/docs/types/DasSortDirection.html +1 -1
- package/dist/docs/types/DataSizeFilter.html +1 -1
- package/dist/docs/types/DecodedExtension.html +1 -1
- package/dist/docs/types/Encoding.html +1 -1
- package/dist/docs/types/Epoch.html +1 -1
- package/dist/docs/types/Lamports.html +1 -1
- package/dist/docs/types/LogsFilter.html +1 -1
- package/dist/docs/types/MemcmpFilter.html +1 -1
- package/dist/docs/types/NonceState.html +1 -1
- package/dist/docs/types/ParsedGeyserUpdate.html +1 -1
- package/dist/docs/types/Pubkey.html +1 -1
- package/dist/docs/types/RuntimeEnv.html +1 -1
- package/dist/docs/types/ServiceLifecycle.html +1 -1
- package/dist/docs/types/ServiceProvider.html +1 -1
- package/dist/docs/types/Signature.html +1 -1
- package/dist/docs/types/Slot.html +1 -1
- package/dist/docs/types/StakeAccountType.html +1 -1
- package/dist/docs/types/SubscriptionId.html +1 -1
- package/dist/docs/types/TokenAccountState.html +1 -1
- package/dist/docs/types/TransactionDetail.html +1 -1
- package/dist/docs/types/UnaryMethod.html +1 -1
- package/dist/docs/types/UnixTimestamp.html +1 -1
- package/dist/docs/types/WsNotification.html +1 -1
- package/dist/docs/variables/ASSOCIATED_TOKEN_PROGRAM.html +1 -1
- package/dist/docs/variables/AssociatedToken.html +4 -4
- package/dist/docs/variables/COMPUTE_BUDGET_PROGRAM.html +1 -1
- package/dist/docs/variables/ComputeBudget.html +5 -5
- package/dist/docs/variables/JUPITER_PROGRAMS.html +1 -1
- package/dist/docs/variables/KNOWN_PROGRAMS.html +1 -1
- package/dist/docs/variables/KNOWN_PROGRAMS_COUNT.html +1 -1
- package/dist/docs/variables/LOOKUP_TABLE_HEADER_SIZE.html +1 -1
- package/dist/docs/variables/LOOKUP_TABLE_PROGRAM_ID.html +1 -1
- package/dist/docs/variables/MARINADE_PROGRAMS.html +1 -1
- package/dist/docs/variables/MAX_MULTISIG_SIGNERS.html +1 -1
- package/dist/docs/variables/MEMO_PROGRAM_V1.html +1 -1
- package/dist/docs/variables/MEMO_PROGRAM_V2.html +1 -1
- package/dist/docs/variables/METAPLEX_PROGRAMS.html +1 -1
- package/dist/docs/variables/METEORA_PROGRAMS.html +1 -1
- package/dist/docs/variables/MINT_SIZE.html +1 -1
- package/dist/docs/variables/MULTISIG_SIZE.html +1 -1
- package/dist/docs/variables/Memo.html +2 -2
- package/dist/docs/variables/NONCE_ACCOUNT_SIZE.html +1 -1
- package/dist/docs/variables/ORCA_PROGRAMS.html +1 -1
- package/dist/docs/variables/OTHER_PROGRAMS.html +1 -1
- package/dist/docs/variables/RAYDIUM_PROGRAMS.html +1 -1
- package/dist/docs/variables/SDK_USER_AGENT.html +1 -1
- package/dist/docs/variables/SPL_PROGRAMS.html +1 -1
- package/dist/docs/variables/STAKE_PROGRAM_ID.html +1 -1
- package/dist/docs/variables/SYNAPSE_DEVNET_EU.html +1 -1
- package/dist/docs/variables/SYNAPSE_DEVNET_US.html +1 -1
- package/dist/docs/variables/SYNAPSE_ENDPOINTS.html +1 -1
- package/dist/docs/variables/SYNAPSE_MAINNET_EU.html +1 -1
- package/dist/docs/variables/SYNAPSE_MAINNET_US.html +1 -1
- package/dist/docs/variables/SYSTEM_PROGRAM.html +1 -1
- package/dist/docs/variables/SYSTEM_PROGRAMS.html +1 -1
- package/dist/docs/variables/SYSTEM_PROGRAM_ID.html +1 -1
- package/dist/docs/variables/SplToken.html +16 -16
- package/dist/docs/variables/SystemProgram.html +10 -10
- package/dist/docs/variables/TOKEN_2022_PROGRAM.html +1 -1
- package/dist/docs/variables/TOKEN_2022_PROGRAM_ID.html +1 -1
- package/dist/docs/variables/TOKEN_ACCOUNT_SIZE.html +1 -1
- package/dist/docs/variables/TOKEN_PROGRAM.html +1 -1
- package/dist/docs/variables/TOKEN_PROGRAM_ID.html +1 -1
- package/dist/docs/variables/Tokens.html +1 -1
- package/dist/esm/ai/gateway/index.d.ts +86 -5
- package/dist/esm/ai/gateway/index.d.ts.map +1 -1
- package/dist/esm/ai/gateway/index.js +275 -39
- package/dist/esm/ai/gateway/index.js.map +1 -1
- package/dist/esm/ai/gateway/registry.d.ts +223 -0
- package/dist/esm/ai/gateway/registry.d.ts.map +1 -0
- package/dist/esm/ai/gateway/registry.js +285 -0
- package/dist/esm/ai/gateway/registry.js.map +1 -0
- package/dist/esm/ai/gateway/types.d.ts +107 -1
- package/dist/esm/ai/gateway/types.d.ts.map +1 -1
- package/dist/esm/ai/gateway/x402/index.d.ts +2 -4
- package/dist/esm/ai/gateway/x402/index.d.ts.map +1 -1
- package/dist/esm/ai/gateway/x402/index.js +2 -3
- package/dist/esm/ai/gateway/x402/index.js.map +1 -1
- package/dist/esm/ai/gateway/x402/registry.d.ts +131 -1
- package/dist/esm/ai/gateway/x402/registry.d.ts.map +1 -1
- package/dist/esm/ai/gateway/x402/registry.js +227 -0
- package/dist/esm/ai/gateway/x402/registry.js.map +1 -1
- package/dist/esm/ai/index.d.ts +2 -1
- package/dist/esm/ai/index.d.ts.map +1 -1
- package/dist/esm/ai/index.js +13 -1
- package/dist/esm/ai/index.js.map +1 -1
- package/dist/esm/ai/persistence/helpers.d.ts +83 -0
- package/dist/esm/ai/persistence/helpers.d.ts.map +1 -0
- package/dist/esm/ai/persistence/helpers.js +183 -0
- package/dist/esm/ai/persistence/helpers.js.map +1 -0
- package/dist/esm/ai/persistence/index.d.ts +91 -0
- package/dist/esm/ai/persistence/index.d.ts.map +1 -0
- package/dist/esm/ai/persistence/index.js +94 -0
- package/dist/esm/ai/persistence/index.js.map +1 -0
- package/dist/esm/ai/persistence/memory.d.ts +71 -0
- package/dist/esm/ai/persistence/memory.d.ts.map +1 -0
- package/dist/esm/ai/persistence/memory.js +188 -0
- package/dist/esm/ai/persistence/memory.js.map +1 -0
- package/dist/esm/ai/persistence/postgresql.d.ts +119 -0
- package/dist/esm/ai/persistence/postgresql.d.ts.map +1 -0
- package/dist/esm/ai/persistence/postgresql.js +306 -0
- package/dist/esm/ai/persistence/postgresql.js.map +1 -0
- package/dist/esm/ai/persistence/redis.d.ts +84 -0
- package/dist/esm/ai/persistence/redis.d.ts.map +1 -0
- package/dist/esm/ai/persistence/redis.js +237 -0
- package/dist/esm/ai/persistence/redis.js.map +1 -0
- package/dist/esm/ai/persistence/types.d.ts +267 -0
- package/dist/esm/ai/persistence/types.d.ts.map +1 -0
- package/dist/esm/ai/persistence/types.js +36 -0
- package/dist/esm/ai/persistence/types.js.map +1 -0
- package/dist/esm/ai/tools/protocols/metaplex/tools.d.ts.map +1 -1
- package/dist/esm/ai/tools/protocols/metaplex/tools.js +13 -19
- package/dist/esm/ai/tools/protocols/metaplex/tools.js.map +1 -1
- package/dist/esm/core/client.d.ts +16 -0
- package/dist/esm/core/client.d.ts.map +1 -1
- package/dist/esm/core/client.js +18 -0
- package/dist/esm/core/client.js.map +1 -1
- package/dist/esm/core/transport.d.ts +1 -1
- package/dist/esm/core/transport.d.ts.map +1 -1
- package/dist/esm/core/transport.js.map +1 -1
- package/dist/esm/core/types.d.ts +5 -1
- package/dist/esm/core/types.d.ts.map +1 -1
- package/dist/esm/das/methods/get-asset-batch.js +1 -1
- package/dist/esm/das/methods/get-asset-batch.js.map +1 -1
- package/dist/esm/das/methods/get-asset-proof-batch.js +1 -1
- package/dist/esm/das/methods/get-asset-proof-batch.js.map +1 -1
- package/dist/esm/das/methods/get-asset-proof.js +1 -1
- package/dist/esm/das/methods/get-asset-proof.js.map +1 -1
- package/dist/esm/das/methods/get-asset.js +1 -1
- package/dist/esm/das/methods/get-asset.js.map +1 -1
- package/dist/esm/das/methods/get-assets-by-authority.js +1 -1
- package/dist/esm/das/methods/get-assets-by-authority.js.map +1 -1
- package/dist/esm/das/methods/get-assets-by-creator.js +1 -1
- package/dist/esm/das/methods/get-assets-by-creator.js.map +1 -1
- package/dist/esm/das/methods/get-assets-by-group.js +1 -1
- package/dist/esm/das/methods/get-assets-by-group.js.map +1 -1
- package/dist/esm/das/methods/get-assets-by-owner.js +1 -1
- package/dist/esm/das/methods/get-assets-by-owner.js.map +1 -1
- package/dist/esm/das/methods/get-signatures-for-asset.js +1 -1
- package/dist/esm/das/methods/get-signatures-for-asset.js.map +1 -1
- package/dist/esm/das/methods/get-token-accounts.js +1 -1
- package/dist/esm/das/methods/get-token-accounts.js.map +1 -1
- package/dist/esm/das/methods/search-assets.js +1 -1
- package/dist/esm/das/methods/search-assets.js.map +1 -1
- package/dist/esm/next/index.d.ts +141 -0
- package/dist/esm/next/index.d.ts.map +1 -0
- package/dist/esm/next/index.js +171 -0
- package/dist/esm/next/index.js.map +1 -0
- package/dist/esm/utils/helpers.d.ts +79 -1
- package/dist/esm/utils/helpers.d.ts.map +1 -1
- package/dist/esm/utils/helpers.js +106 -0
- package/dist/esm/utils/helpers.js.map +1 -1
- package/package.json +20 -2
|
@@ -0,0 +1,223 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @module ai/gateway/registry
|
|
3
|
+
* @description AgentRegistry — Multi-agent lifecycle management.
|
|
4
|
+
*
|
|
5
|
+
* Provides a centralised registry for creating, discovering, and managing
|
|
6
|
+
* multiple {@link AgentGateway} instances. Ideal for platforms that host
|
|
7
|
+
* many agents (e.g. marketplace back-ends, orchestrators, multi-tenant SaaS).
|
|
8
|
+
*
|
|
9
|
+
* Includes:
|
|
10
|
+
* - `create()` / `get()` / `remove()` / `clear()` — CRUD
|
|
11
|
+
* - `list()` / `filter()` — discovery
|
|
12
|
+
* - `searchMarketplace()` — cross-agent tool search
|
|
13
|
+
* - `getAggregateMetrics()` — rolled-up stats
|
|
14
|
+
* - Pluggable persistence via `PersistenceAdapter` (memory adapter built-in)
|
|
15
|
+
*
|
|
16
|
+
* @since 1.2.2
|
|
17
|
+
*
|
|
18
|
+
* @example
|
|
19
|
+
* ```ts
|
|
20
|
+
* import { AgentRegistry, AgentGateway } from '@oobe-protocol-labs/synapse-client-sdk/ai';
|
|
21
|
+
*
|
|
22
|
+
* const registry = new AgentRegistry();
|
|
23
|
+
*
|
|
24
|
+
* const gateway = registry.create(client, {
|
|
25
|
+
* identity: { id: AgentId('agent-1'), name: 'Alice', walletPubkey: '...', createdAt: Date.now() },
|
|
26
|
+
* defaultTiers: DEFAULT_TIERS,
|
|
27
|
+
* });
|
|
28
|
+
*
|
|
29
|
+
* const all = registry.list();
|
|
30
|
+
* const defi = registry.filter(g => g.identity.tags?.includes('defi'));
|
|
31
|
+
* ```
|
|
32
|
+
*/
|
|
33
|
+
import type { SynapseClientLike } from '../../core/client';
|
|
34
|
+
import type { AgentId, GatewayConfig } from './types';
|
|
35
|
+
import { AgentGateway } from './index';
|
|
36
|
+
import type { GatewaySnapshot, SnapshotDepth } from './types';
|
|
37
|
+
import type { MarketplaceQuery } from './marketplace';
|
|
38
|
+
/**
|
|
39
|
+
* @description Pluggable persistence layer for the registry.
|
|
40
|
+
* Implement this interface to back the registry with Redis, SQLite, etc.
|
|
41
|
+
* @since 1.2.2
|
|
42
|
+
*/
|
|
43
|
+
export interface PersistenceAdapter {
|
|
44
|
+
/** Save a snapshot keyed by agent ID. */
|
|
45
|
+
save(agentId: string, snapshot: GatewaySnapshot): void | Promise<void>;
|
|
46
|
+
/** Load a snapshot by agent ID (returns `null` if not found). */
|
|
47
|
+
load(agentId: string): GatewaySnapshot | null | Promise<GatewaySnapshot | null>;
|
|
48
|
+
/** Delete a snapshot by agent ID. */
|
|
49
|
+
delete(agentId: string): void | Promise<void>;
|
|
50
|
+
/** List all stored agent IDs. */
|
|
51
|
+
keys(): string[] | Promise<string[]>;
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* @description Default in-memory persistence adapter.
|
|
55
|
+
* @since 1.2.2
|
|
56
|
+
*/
|
|
57
|
+
export declare class MemoryAdapter implements PersistenceAdapter {
|
|
58
|
+
private readonly store;
|
|
59
|
+
save(agentId: string, snapshot: GatewaySnapshot): void;
|
|
60
|
+
load(agentId: string): GatewaySnapshot | null;
|
|
61
|
+
delete(agentId: string): void;
|
|
62
|
+
keys(): string[];
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* @description Configuration for {@link AgentRegistry}.
|
|
66
|
+
* @since 1.2.2
|
|
67
|
+
*/
|
|
68
|
+
export interface AgentRegistryConfig {
|
|
69
|
+
/** Maximum number of agents allowed in the registry (default: unlimited). */
|
|
70
|
+
maxAgents?: number;
|
|
71
|
+
/** Optional persistence adapter (default: in-memory). */
|
|
72
|
+
persistence?: PersistenceAdapter;
|
|
73
|
+
/** Gateway config template — merged with per-agent overrides in `create()`. */
|
|
74
|
+
defaultConfig?: Partial<GatewayConfig>;
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* @description Multi-agent lifecycle manager.
|
|
78
|
+
*
|
|
79
|
+
* Manages a collection of {@link AgentGateway} instances with CRUD
|
|
80
|
+
* operations, discovery, aggregate metrics, and optional persistence.
|
|
81
|
+
*
|
|
82
|
+
* @since 1.2.2
|
|
83
|
+
*/
|
|
84
|
+
export declare class AgentRegistry {
|
|
85
|
+
private readonly agents;
|
|
86
|
+
private readonly config;
|
|
87
|
+
private readonly persistence;
|
|
88
|
+
/**
|
|
89
|
+
* @param {AgentRegistryConfig} [config] - Optional registry configuration.
|
|
90
|
+
*/
|
|
91
|
+
constructor(config?: AgentRegistryConfig);
|
|
92
|
+
/**
|
|
93
|
+
* @description Create and register a new agent gateway.
|
|
94
|
+
*
|
|
95
|
+
* @param {SynapseClientLike} client - Synapse client (or client-like transport wrapper)
|
|
96
|
+
* @param {GatewayConfig} config - Gateway configuration (merged with `defaultConfig`)
|
|
97
|
+
* @returns {AgentGateway} The newly created and registered gateway
|
|
98
|
+
* @throws {Error} If an agent with the same ID already exists or the max limit is reached
|
|
99
|
+
* @since 1.2.2
|
|
100
|
+
*/
|
|
101
|
+
create(client: SynapseClientLike, config: GatewayConfig): AgentGateway;
|
|
102
|
+
/**
|
|
103
|
+
* @description Register an existing gateway in the registry.
|
|
104
|
+
*
|
|
105
|
+
* @param {AgentGateway} gateway - An already-constructed gateway
|
|
106
|
+
* @throws {Error} If an agent with the same ID already exists
|
|
107
|
+
* @since 1.2.2
|
|
108
|
+
*/
|
|
109
|
+
register(gateway: AgentGateway): void;
|
|
110
|
+
/**
|
|
111
|
+
* @description Get a gateway by agent ID.
|
|
112
|
+
* @param {AgentId | string} agentId - The agent ID
|
|
113
|
+
* @returns {AgentGateway | undefined} The gateway or undefined
|
|
114
|
+
* @since 1.2.2
|
|
115
|
+
*/
|
|
116
|
+
get(agentId: AgentId | string): AgentGateway | undefined;
|
|
117
|
+
/**
|
|
118
|
+
* @description Remove an agent from the registry.
|
|
119
|
+
* @param {AgentId | string} agentId - The agent ID to remove
|
|
120
|
+
* @returns {boolean} `true` if the agent was found and removed
|
|
121
|
+
* @since 1.2.2
|
|
122
|
+
*/
|
|
123
|
+
remove(agentId: AgentId | string): boolean;
|
|
124
|
+
/**
|
|
125
|
+
* @description Remove all agents from the registry.
|
|
126
|
+
* @since 1.2.2
|
|
127
|
+
*/
|
|
128
|
+
clear(): void;
|
|
129
|
+
/**
|
|
130
|
+
* @description Check if an agent exists in the registry.
|
|
131
|
+
* @param {AgentId | string} agentId - The agent ID to check
|
|
132
|
+
* @returns {boolean} `true` if registered
|
|
133
|
+
* @since 1.2.2
|
|
134
|
+
*/
|
|
135
|
+
has(agentId: AgentId | string): boolean;
|
|
136
|
+
/**
|
|
137
|
+
* @description Get the number of registered agents.
|
|
138
|
+
* @since 1.2.2
|
|
139
|
+
*/
|
|
140
|
+
get size(): number;
|
|
141
|
+
/**
|
|
142
|
+
* @description List all registered gateways.
|
|
143
|
+
* @returns {AgentGateway[]} Array of all gateways
|
|
144
|
+
* @since 1.2.2
|
|
145
|
+
*/
|
|
146
|
+
list(): AgentGateway[];
|
|
147
|
+
/**
|
|
148
|
+
* @description Filter gateways by a predicate.
|
|
149
|
+
*
|
|
150
|
+
* @param {(gateway: AgentGateway) => boolean} predicate - Filter function
|
|
151
|
+
* @returns {AgentGateway[]} Matching gateways
|
|
152
|
+
* @since 1.2.2
|
|
153
|
+
*
|
|
154
|
+
* @example
|
|
155
|
+
* ```ts
|
|
156
|
+
* const defiAgents = registry.filter(g => g.identity.tags?.includes('defi'));
|
|
157
|
+
* ```
|
|
158
|
+
*/
|
|
159
|
+
filter(predicate: (gateway: AgentGateway) => boolean): AgentGateway[];
|
|
160
|
+
/**
|
|
161
|
+
* @description Search tool listings across all registered gateways.
|
|
162
|
+
*
|
|
163
|
+
* @param {MarketplaceQuery} query - Marketplace search query
|
|
164
|
+
* @returns {{ agent: AgentGateway; listings: import('./marketplace').ToolListing[] }[]}
|
|
165
|
+
* @since 1.2.2
|
|
166
|
+
*/
|
|
167
|
+
searchMarketplace(query: MarketplaceQuery): {
|
|
168
|
+
agent: AgentGateway;
|
|
169
|
+
listings: ReturnType<AgentGateway['marketplace']['search']>;
|
|
170
|
+
}[];
|
|
171
|
+
/**
|
|
172
|
+
* @description Get aggregate metrics across all registered agents.
|
|
173
|
+
*
|
|
174
|
+
* @returns {object} Rolled-up metrics
|
|
175
|
+
* @since 1.2.2
|
|
176
|
+
*/
|
|
177
|
+
getAggregateMetrics(): {
|
|
178
|
+
totalAgents: number;
|
|
179
|
+
totalCallsServed: number;
|
|
180
|
+
totalRevenue: string;
|
|
181
|
+
totalActiveSessions: number;
|
|
182
|
+
totalSessions: number;
|
|
183
|
+
avgLatencyMs: number;
|
|
184
|
+
};
|
|
185
|
+
/**
|
|
186
|
+
* @description Snapshot all agents in the registry.
|
|
187
|
+
*
|
|
188
|
+
* @param {{ depth?: SnapshotDepth }} [opts] - Snapshot options
|
|
189
|
+
* @returns {GatewaySnapshot[]} Array of JSON-safe snapshots
|
|
190
|
+
* @since 1.2.2
|
|
191
|
+
*/
|
|
192
|
+
snapshot(opts?: {
|
|
193
|
+
depth?: SnapshotDepth;
|
|
194
|
+
}): GatewaySnapshot[];
|
|
195
|
+
/**
|
|
196
|
+
* Enables `JSON.stringify(registry)`.
|
|
197
|
+
* @since 1.2.2
|
|
198
|
+
*/
|
|
199
|
+
toJSON(): GatewaySnapshot[];
|
|
200
|
+
/**
|
|
201
|
+
* @description Persist all current agent snapshots via the configured adapter.
|
|
202
|
+
* @since 1.2.2
|
|
203
|
+
*/
|
|
204
|
+
persist(): Promise<void>;
|
|
205
|
+
/**
|
|
206
|
+
* @description Load a snapshot from the persistence layer.
|
|
207
|
+
* @param {string} agentId - The agent ID to load
|
|
208
|
+
* @returns {Promise<GatewaySnapshot | null>} The stored snapshot or null
|
|
209
|
+
* @since 1.2.2
|
|
210
|
+
*/
|
|
211
|
+
loadSnapshot(agentId: string): Promise<GatewaySnapshot | null>;
|
|
212
|
+
/**
|
|
213
|
+
* @description Iterate over all registered gateways.
|
|
214
|
+
* @since 1.2.2
|
|
215
|
+
*/
|
|
216
|
+
[Symbol.iterator](): IterableIterator<AgentGateway>;
|
|
217
|
+
/**
|
|
218
|
+
* @description Iterate over `[agentId, gateway]` pairs.
|
|
219
|
+
* @since 1.2.2
|
|
220
|
+
*/
|
|
221
|
+
entries(): IterableIterator<[string, AgentGateway]>;
|
|
222
|
+
}
|
|
223
|
+
//# sourceMappingURL=registry.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"registry.d.ts","sourceRoot":"","sources":["../../../../src/ai/gateway/registry.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AAEH,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AAC3D,OAAO,KAAK,EAAE,OAAO,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AACtD,OAAO,EAAE,YAAY,EAAE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ACH,QAAQ,CAAC,IAAI,GAAE;QAAE,KAAK,CAAC,EAAE,aAAa,CAAA;KAAO,GAAG,eAAe,EAAE;IAIjE;;;OAGG;IACH,MAAM,IAAI,eAAe,EAAE;IAM3B;;;OAGG;IACG,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC;IAO9B;;;;;OAKG;IACG,YAAY,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,eAAe,GAAG,IAAI,CAAC;IAMpE;;;OAGG;IACH,CAAC,MAAM,CAAC,QAAQ,CAAC,IAAI,gBAAgB,CAAC,YAAY,CAAC;IAInD;;;OAGG;IACH,OAAO,IAAI,gBAAgB,CAAC,CAAC,MAAM,EAAE,YAAY,CAAC,CAAC;CAGpD"}
|
|
@@ -0,0 +1,290 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* @module ai/gateway/registry
|
|
4
|
+
* @description AgentRegistry — Multi-agent lifecycle management.
|
|
5
|
+
*
|
|
6
|
+
* Provides a centralised registry for creating, discovering, and managing
|
|
7
|
+
* multiple {@link AgentGateway} instances. Ideal for platforms that host
|
|
8
|
+
* many agents (e.g. marketplace back-ends, orchestrators, multi-tenant SaaS).
|
|
9
|
+
*
|
|
10
|
+
* Includes:
|
|
11
|
+
* - `create()` / `get()` / `remove()` / `clear()` — CRUD
|
|
12
|
+
* - `list()` / `filter()` — discovery
|
|
13
|
+
* - `searchMarketplace()` — cross-agent tool search
|
|
14
|
+
* - `getAggregateMetrics()` — rolled-up stats
|
|
15
|
+
* - Pluggable persistence via `PersistenceAdapter` (memory adapter built-in)
|
|
16
|
+
*
|
|
17
|
+
* @since 1.2.2
|
|
18
|
+
*
|
|
19
|
+
* @example
|
|
20
|
+
* ```ts
|
|
21
|
+
* import { AgentRegistry, AgentGateway } from '@oobe-protocol-labs/synapse-client-sdk/ai';
|
|
22
|
+
*
|
|
23
|
+
* const registry = new AgentRegistry();
|
|
24
|
+
*
|
|
25
|
+
* const gateway = registry.create(client, {
|
|
26
|
+
* identity: { id: AgentId('agent-1'), name: 'Alice', walletPubkey: '...', createdAt: Date.now() },
|
|
27
|
+
* defaultTiers: DEFAULT_TIERS,
|
|
28
|
+
* });
|
|
29
|
+
*
|
|
30
|
+
* const all = registry.list();
|
|
31
|
+
* const defi = registry.filter(g => g.identity.tags?.includes('defi'));
|
|
32
|
+
* ```
|
|
33
|
+
*/
|
|
34
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
35
|
+
exports.AgentRegistry = exports.MemoryAdapter = void 0;
|
|
36
|
+
const index_1 = require("./index");
|
|
37
|
+
/**
|
|
38
|
+
* @description Default in-memory persistence adapter.
|
|
39
|
+
* @since 1.2.2
|
|
40
|
+
*/
|
|
41
|
+
class MemoryAdapter {
|
|
42
|
+
store = new Map();
|
|
43
|
+
save(agentId, snapshot) {
|
|
44
|
+
this.store.set(agentId, snapshot);
|
|
45
|
+
}
|
|
46
|
+
load(agentId) {
|
|
47
|
+
return this.store.get(agentId) ?? null;
|
|
48
|
+
}
|
|
49
|
+
delete(agentId) {
|
|
50
|
+
this.store.delete(agentId);
|
|
51
|
+
}
|
|
52
|
+
keys() {
|
|
53
|
+
return [...this.store.keys()];
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
exports.MemoryAdapter = MemoryAdapter;
|
|
57
|
+
/* ═══════════════════════════════════════════════════════════════
|
|
58
|
+
* AgentRegistry
|
|
59
|
+
* ═══════════════════════════════════════════════════════════════ */
|
|
60
|
+
/**
|
|
61
|
+
* @description Multi-agent lifecycle manager.
|
|
62
|
+
*
|
|
63
|
+
* Manages a collection of {@link AgentGateway} instances with CRUD
|
|
64
|
+
* operations, discovery, aggregate metrics, and optional persistence.
|
|
65
|
+
*
|
|
66
|
+
* @since 1.2.2
|
|
67
|
+
*/
|
|
68
|
+
class AgentRegistry {
|
|
69
|
+
agents = new Map();
|
|
70
|
+
config;
|
|
71
|
+
persistence;
|
|
72
|
+
/**
|
|
73
|
+
* @param {AgentRegistryConfig} [config] - Optional registry configuration.
|
|
74
|
+
*/
|
|
75
|
+
constructor(config = {}) {
|
|
76
|
+
this.config = config;
|
|
77
|
+
this.persistence = config.persistence ?? new MemoryAdapter();
|
|
78
|
+
}
|
|
79
|
+
/* ── CRUD ──────────────────────────────────────────────── */
|
|
80
|
+
/**
|
|
81
|
+
* @description Create and register a new agent gateway.
|
|
82
|
+
*
|
|
83
|
+
* @param {SynapseClientLike} client - Synapse client (or client-like transport wrapper)
|
|
84
|
+
* @param {GatewayConfig} config - Gateway configuration (merged with `defaultConfig`)
|
|
85
|
+
* @returns {AgentGateway} The newly created and registered gateway
|
|
86
|
+
* @throws {Error} If an agent with the same ID already exists or the max limit is reached
|
|
87
|
+
* @since 1.2.2
|
|
88
|
+
*/
|
|
89
|
+
create(client, config) {
|
|
90
|
+
const merged = { ...this.config.defaultConfig, ...config };
|
|
91
|
+
const gateway = new index_1.AgentGateway(client, merged);
|
|
92
|
+
const id = gateway.agentId;
|
|
93
|
+
if (this.agents.has(id)) {
|
|
94
|
+
throw new Error(`Agent '${id}' already exists in the registry`);
|
|
95
|
+
}
|
|
96
|
+
if (this.config.maxAgents != null && this.agents.size >= this.config.maxAgents) {
|
|
97
|
+
throw new Error(`Registry limit reached (max ${this.config.maxAgents} agents)`);
|
|
98
|
+
}
|
|
99
|
+
this.agents.set(id, gateway);
|
|
100
|
+
return gateway;
|
|
101
|
+
}
|
|
102
|
+
/**
|
|
103
|
+
* @description Register an existing gateway in the registry.
|
|
104
|
+
*
|
|
105
|
+
* @param {AgentGateway} gateway - An already-constructed gateway
|
|
106
|
+
* @throws {Error} If an agent with the same ID already exists
|
|
107
|
+
* @since 1.2.2
|
|
108
|
+
*/
|
|
109
|
+
register(gateway) {
|
|
110
|
+
const id = gateway.agentId;
|
|
111
|
+
if (this.agents.has(id)) {
|
|
112
|
+
throw new Error(`Agent '${id}' already exists in the registry`);
|
|
113
|
+
}
|
|
114
|
+
if (this.config.maxAgents != null && this.agents.size >= this.config.maxAgents) {
|
|
115
|
+
throw new Error(`Registry limit reached (max ${this.config.maxAgents} agents)`);
|
|
116
|
+
}
|
|
117
|
+
this.agents.set(id, gateway);
|
|
118
|
+
}
|
|
119
|
+
/**
|
|
120
|
+
* @description Get a gateway by agent ID.
|
|
121
|
+
* @param {AgentId | string} agentId - The agent ID
|
|
122
|
+
* @returns {AgentGateway | undefined} The gateway or undefined
|
|
123
|
+
* @since 1.2.2
|
|
124
|
+
*/
|
|
125
|
+
get(agentId) {
|
|
126
|
+
return this.agents.get(agentId);
|
|
127
|
+
}
|
|
128
|
+
/**
|
|
129
|
+
* @description Remove an agent from the registry.
|
|
130
|
+
* @param {AgentId | string} agentId - The agent ID to remove
|
|
131
|
+
* @returns {boolean} `true` if the agent was found and removed
|
|
132
|
+
* @since 1.2.2
|
|
133
|
+
*/
|
|
134
|
+
remove(agentId) {
|
|
135
|
+
return this.agents.delete(agentId);
|
|
136
|
+
}
|
|
137
|
+
/**
|
|
138
|
+
* @description Remove all agents from the registry.
|
|
139
|
+
* @since 1.2.2
|
|
140
|
+
*/
|
|
141
|
+
clear() {
|
|
142
|
+
this.agents.clear();
|
|
143
|
+
}
|
|
144
|
+
/**
|
|
145
|
+
* @description Check if an agent exists in the registry.
|
|
146
|
+
* @param {AgentId | string} agentId - The agent ID to check
|
|
147
|
+
* @returns {boolean} `true` if registered
|
|
148
|
+
* @since 1.2.2
|
|
149
|
+
*/
|
|
150
|
+
has(agentId) {
|
|
151
|
+
return this.agents.has(agentId);
|
|
152
|
+
}
|
|
153
|
+
/**
|
|
154
|
+
* @description Get the number of registered agents.
|
|
155
|
+
* @since 1.2.2
|
|
156
|
+
*/
|
|
157
|
+
get size() {
|
|
158
|
+
return this.agents.size;
|
|
159
|
+
}
|
|
160
|
+
/* ── Discovery ─────────────────────────────────────────── */
|
|
161
|
+
/**
|
|
162
|
+
* @description List all registered gateways.
|
|
163
|
+
* @returns {AgentGateway[]} Array of all gateways
|
|
164
|
+
* @since 1.2.2
|
|
165
|
+
*/
|
|
166
|
+
list() {
|
|
167
|
+
return [...this.agents.values()];
|
|
168
|
+
}
|
|
169
|
+
/**
|
|
170
|
+
* @description Filter gateways by a predicate.
|
|
171
|
+
*
|
|
172
|
+
* @param {(gateway: AgentGateway) => boolean} predicate - Filter function
|
|
173
|
+
* @returns {AgentGateway[]} Matching gateways
|
|
174
|
+
* @since 1.2.2
|
|
175
|
+
*
|
|
176
|
+
* @example
|
|
177
|
+
* ```ts
|
|
178
|
+
* const defiAgents = registry.filter(g => g.identity.tags?.includes('defi'));
|
|
179
|
+
* ```
|
|
180
|
+
*/
|
|
181
|
+
filter(predicate) {
|
|
182
|
+
return [...this.agents.values()].filter(predicate);
|
|
183
|
+
}
|
|
184
|
+
/**
|
|
185
|
+
* @description Search tool listings across all registered gateways.
|
|
186
|
+
*
|
|
187
|
+
* @param {MarketplaceQuery} query - Marketplace search query
|
|
188
|
+
* @returns {{ agent: AgentGateway; listings: import('./marketplace').ToolListing[] }[]}
|
|
189
|
+
* @since 1.2.2
|
|
190
|
+
*/
|
|
191
|
+
searchMarketplace(query) {
|
|
192
|
+
const results = [];
|
|
193
|
+
for (const gateway of this.agents.values()) {
|
|
194
|
+
const listings = gateway.marketplace.search(query);
|
|
195
|
+
if (listings.length > 0) {
|
|
196
|
+
results.push({ agent: gateway, listings });
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
return results;
|
|
200
|
+
}
|
|
201
|
+
/* ── Metrics ───────────────────────────────────────────── */
|
|
202
|
+
/**
|
|
203
|
+
* @description Get aggregate metrics across all registered agents.
|
|
204
|
+
*
|
|
205
|
+
* @returns {object} Rolled-up metrics
|
|
206
|
+
* @since 1.2.2
|
|
207
|
+
*/
|
|
208
|
+
getAggregateMetrics() {
|
|
209
|
+
let totalCalls = 0;
|
|
210
|
+
let totalRevenue = 0n;
|
|
211
|
+
let totalActiveSessions = 0;
|
|
212
|
+
let totalSessions = 0;
|
|
213
|
+
let latencySum = 0;
|
|
214
|
+
let latencyCount = 0;
|
|
215
|
+
for (const gateway of this.agents.values()) {
|
|
216
|
+
const m = gateway.getMetrics();
|
|
217
|
+
totalCalls += m.totalCallsServed;
|
|
218
|
+
totalRevenue += BigInt(m.totalRevenue);
|
|
219
|
+
totalActiveSessions += m.activeSessions;
|
|
220
|
+
totalSessions += m.totalSessions;
|
|
221
|
+
if (m.avgLatencyMs > 0) {
|
|
222
|
+
latencySum += m.avgLatencyMs;
|
|
223
|
+
latencyCount++;
|
|
224
|
+
}
|
|
225
|
+
}
|
|
226
|
+
return {
|
|
227
|
+
totalAgents: this.agents.size,
|
|
228
|
+
totalCallsServed: totalCalls,
|
|
229
|
+
totalRevenue: totalRevenue.toString(),
|
|
230
|
+
totalActiveSessions,
|
|
231
|
+
totalSessions,
|
|
232
|
+
avgLatencyMs: latencyCount > 0 ? Math.round(latencySum / latencyCount) : 0,
|
|
233
|
+
};
|
|
234
|
+
}
|
|
235
|
+
/* ── Snapshot & serialization ──────────────────────────── */
|
|
236
|
+
/**
|
|
237
|
+
* @description Snapshot all agents in the registry.
|
|
238
|
+
*
|
|
239
|
+
* @param {{ depth?: SnapshotDepth }} [opts] - Snapshot options
|
|
240
|
+
* @returns {GatewaySnapshot[]} Array of JSON-safe snapshots
|
|
241
|
+
* @since 1.2.2
|
|
242
|
+
*/
|
|
243
|
+
snapshot(opts = {}) {
|
|
244
|
+
return [...this.agents.values()].map(g => g.snapshot(opts));
|
|
245
|
+
}
|
|
246
|
+
/**
|
|
247
|
+
* Enables `JSON.stringify(registry)`.
|
|
248
|
+
* @since 1.2.2
|
|
249
|
+
*/
|
|
250
|
+
toJSON() {
|
|
251
|
+
return this.snapshot({ depth: 'standard' });
|
|
252
|
+
}
|
|
253
|
+
/* ── Persistence helpers ───────────────────────────────── */
|
|
254
|
+
/**
|
|
255
|
+
* @description Persist all current agent snapshots via the configured adapter.
|
|
256
|
+
* @since 1.2.2
|
|
257
|
+
*/
|
|
258
|
+
async persist() {
|
|
259
|
+
for (const gateway of this.agents.values()) {
|
|
260
|
+
const snap = gateway.snapshot({ depth: 'full' });
|
|
261
|
+
await this.persistence.save(snap.agentId, snap);
|
|
262
|
+
}
|
|
263
|
+
}
|
|
264
|
+
/**
|
|
265
|
+
* @description Load a snapshot from the persistence layer.
|
|
266
|
+
* @param {string} agentId - The agent ID to load
|
|
267
|
+
* @returns {Promise<GatewaySnapshot | null>} The stored snapshot or null
|
|
268
|
+
* @since 1.2.2
|
|
269
|
+
*/
|
|
270
|
+
async loadSnapshot(agentId) {
|
|
271
|
+
return this.persistence.load(agentId);
|
|
272
|
+
}
|
|
273
|
+
/* ── Iteration ─────────────────────────────────────────── */
|
|
274
|
+
/**
|
|
275
|
+
* @description Iterate over all registered gateways.
|
|
276
|
+
* @since 1.2.2
|
|
277
|
+
*/
|
|
278
|
+
[Symbol.iterator]() {
|
|
279
|
+
return this.agents.values();
|
|
280
|
+
}
|
|
281
|
+
/**
|
|
282
|
+
* @description Iterate over `[agentId, gateway]` pairs.
|
|
283
|
+
* @since 1.2.2
|
|
284
|
+
*/
|
|
285
|
+
entries() {
|
|
286
|
+
return this.agents.entries();
|
|
287
|
+
}
|
|
288
|
+
}
|
|
289
|
+
exports.AgentRegistry = AgentRegistry;
|
|
290
|
+
//# sourceMappingURL=registry.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"registry.js","sourceRoot":"","sources":["../../../../src/ai/gateway/registry.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;;;AAIH,mCAAuC;AAwBvC;;;GAGG;AACH,MAAa,aAAa;IACP,KAAK,GAAG,IAAI,GAAG,EAA2B,CAAC;IAE5D,IAAI,CAAC,OAAe,EAAE,QAAyB;QAC7C,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,OAAO,EAAE,QAAQ,CAAC,CAAC;IACpC,CAAC;IAED,IAAI,CAAC,OAAe;QAClB,OAAO,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,O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CAAC,YAAY,CAAC,OAAe;QAChC,OAAO,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;IACxC,CAAC;IAED,8DAA8D;IAE9D;;;OAGG;IACH,CAAC,MAAM,CAAC,QAAQ,CAAC;QACf,OAAO,IAAI,CAAC,MAAM,CAAC,MAAM,EAAE,CAAC;IAC9B,CAAC;IAED;;;OAGG;IACH,OAAO;QACL,OAAO,IAAI,CAAC,MAAM,CAAC,OAAO,EAAE,CAAC;IAC/B,CAAC;CACF;AA3QD,sCA2QC"}
|
|
@@ -267,7 +267,7 @@ export interface ToolBundle {
|
|
|
267
267
|
* @description Union type of all observable gateway event types.
|
|
268
268
|
* @since 1.0.0
|
|
269
269
|
*/
|
|
270
|
-
export type GatewayEventType = 'session:created' | 'session:activated' | 'session:paused' | 'session:exhausted' | 'session:settled' | 'session:expired' | 'call:before' | 'call:after' | 'call:error' | 'call:attested' | 'payment:intent' | 'payment:settled' | 'ratelimit:exceeded' | 'budget:warning' | 'budget:exhausted' | 'x402:payment-required' | 'x402:payment-verified' | 'x402:payment-settled' | 'x402:payment-sent';
|
|
270
|
+
export type GatewayEventType = 'session:created' | 'session:activated' | 'session:paused' | 'session:exhausted' | 'session:settled' | 'session:expired' | 'call:before' | 'call:after' | 'call:error' | 'call:attested' | 'call:retry' | 'payment:intent' | 'payment:settled' | 'ratelimit:exceeded' | 'budget:warning' | 'budget:exhausted' | 'x402:payment-required' | 'x402:payment-verified' | 'x402:payment-settled' | 'x402:payment-sent' | 'x402:pipeline:paywall' | 'x402:pipeline:verify' | 'x402:pipeline:execute' | 'x402:pipeline:settle' | 'x402:pipeline:complete' | 'x402:pipeline:error';
|
|
271
271
|
/**
|
|
272
272
|
* @description Event object emitted by the gateway event bus.
|
|
273
273
|
* @template T The type of the event data payload
|
|
@@ -287,6 +287,106 @@ export interface GatewayEvent<T = unknown> {
|
|
|
287
287
|
export type GatewayEventHandler<T = unknown> = (event: GatewayEvent<T>) => void | Promise<void>;
|
|
288
288
|
import type { X402Config } from './x402/types';
|
|
289
289
|
import type { X402ClientConfig } from './x402/client';
|
|
290
|
+
/**
|
|
291
|
+
* @description Retry configuration for `gateway.execute()`.
|
|
292
|
+
* @since 1.2.2
|
|
293
|
+
*/
|
|
294
|
+
export interface RetryConfig {
|
|
295
|
+
/** Maximum number of attempts (including the first call). Default: 1 (no retry). */
|
|
296
|
+
maxAttempts?: number;
|
|
297
|
+
/** Base delay in ms before retrying. Doubles each attempt (exponential backoff). Default: 500. */
|
|
298
|
+
backoffMs?: number;
|
|
299
|
+
/** Multiplier applied to backoffMs on each retry. Default: 2. */
|
|
300
|
+
backoffMultiplier?: number;
|
|
301
|
+
/**
|
|
302
|
+
* Error messages or substrings that are considered transient and retryable.
|
|
303
|
+
* Default: `['fetch failed', 'ECONNRESET', 'ETIMEDOUT', 'ENOTFOUND', 'socket hang up']`.
|
|
304
|
+
*/
|
|
305
|
+
retryableErrors?: string[];
|
|
306
|
+
/**
|
|
307
|
+
* If `true`, falls back to a raw `client.call()` on the last retry attempt.
|
|
308
|
+
* Useful when the gateway transport is behind a proxy that may be down.
|
|
309
|
+
* Default: `false`.
|
|
310
|
+
*/
|
|
311
|
+
fallbackToDirectRpc?: boolean;
|
|
312
|
+
}
|
|
313
|
+
/**
|
|
314
|
+
* @description Depth option for {@link AgentGateway.snapshot}.
|
|
315
|
+
* @since 1.2.2
|
|
316
|
+
*/
|
|
317
|
+
export type SnapshotDepth = 'minimal' | 'standard' | 'full';
|
|
318
|
+
/**
|
|
319
|
+
* @description JSON-safe snapshot of an AgentGateway's state.
|
|
320
|
+
* All BigInt values are serialized as strings.
|
|
321
|
+
* @since 1.2.2
|
|
322
|
+
*/
|
|
323
|
+
export interface GatewaySnapshot {
|
|
324
|
+
agentId: string;
|
|
325
|
+
identity: {
|
|
326
|
+
name: string;
|
|
327
|
+
walletPubkey: string;
|
|
328
|
+
description?: string;
|
|
329
|
+
tags?: string[];
|
|
330
|
+
createdAt: number;
|
|
331
|
+
};
|
|
332
|
+
metrics: {
|
|
333
|
+
totalCallsServed: number;
|
|
334
|
+
totalRevenue: string;
|
|
335
|
+
activeSessions: number;
|
|
336
|
+
totalSessions: number;
|
|
337
|
+
avgLatencyMs: number;
|
|
338
|
+
totalAttestations: number;
|
|
339
|
+
};
|
|
340
|
+
sessions: {
|
|
341
|
+
id: string;
|
|
342
|
+
status: string;
|
|
343
|
+
buyer: string;
|
|
344
|
+
budgetRemaining?: string;
|
|
345
|
+
callsMade?: number;
|
|
346
|
+
createdAt?: number;
|
|
347
|
+
}[];
|
|
348
|
+
tiers: {
|
|
349
|
+
id: string;
|
|
350
|
+
label: string;
|
|
351
|
+
pricePerCall: string;
|
|
352
|
+
maxCallsPerSession: number;
|
|
353
|
+
rateLimit: number;
|
|
354
|
+
includesAttestation: boolean;
|
|
355
|
+
}[];
|
|
356
|
+
marketplace: {
|
|
357
|
+
totalListings: number;
|
|
358
|
+
totalBundles: number;
|
|
359
|
+
};
|
|
360
|
+
x402: {
|
|
361
|
+
paywallEnabled: boolean;
|
|
362
|
+
clientEnabled: boolean;
|
|
363
|
+
clientPayments: number;
|
|
364
|
+
};
|
|
365
|
+
}
|
|
366
|
+
/**
|
|
367
|
+
* @description Step data emitted during the x402 pipeline.
|
|
368
|
+
* @since 1.2.2
|
|
369
|
+
*/
|
|
370
|
+
export interface X402PipelineStep {
|
|
371
|
+
/** Sequential step number (1-based). */
|
|
372
|
+
id: number;
|
|
373
|
+
/** Total number of steps in the pipeline. */
|
|
374
|
+
totalSteps: number;
|
|
375
|
+
/** Which actor performed this step. */
|
|
376
|
+
actor: 'seller' | 'buyer' | 'facilitator';
|
|
377
|
+
/** Short action label. */
|
|
378
|
+
action: string;
|
|
379
|
+
/** Human-readable description. */
|
|
380
|
+
detail: string;
|
|
381
|
+
/** Arbitrary step-specific data. */
|
|
382
|
+
data: Record<string, unknown>;
|
|
383
|
+
/** How long this step took in milliseconds. */
|
|
384
|
+
durationMs: number;
|
|
385
|
+
/** Whether the step was a real execution or simulated. */
|
|
386
|
+
status: 'real' | 'simulated';
|
|
387
|
+
/** Error that occurred during the step, if any. */
|
|
388
|
+
error?: string;
|
|
389
|
+
}
|
|
290
390
|
/**
|
|
291
391
|
* @description Full configuration for an AgentGateway instance.
|
|
292
392
|
* @since 1.0.0
|
|
@@ -320,5 +420,11 @@ export interface GatewayConfig {
|
|
|
320
420
|
* x402-enabled servers.
|
|
321
421
|
*/
|
|
322
422
|
x402Client?: X402ClientConfig;
|
|
423
|
+
/**
|
|
424
|
+
* Retry configuration for `execute()` and `executeWithX402()`.
|
|
425
|
+
* When set, transient RPC errors are retried with exponential backoff.
|
|
426
|
+
* @since 1.2.2
|
|
427
|
+
*/
|
|
428
|
+
retry?: RetryConfig;
|
|
323
429
|
}
|
|
324
430
|
//# sourceMappingURL=types.d.ts.map
|