@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,183 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @module ai/persistence/helpers
|
|
3
|
+
* @description Serialization utilities, key builders, and PostgreSQL schema
|
|
4
|
+
* for the Synapse AI persistence layer.
|
|
5
|
+
*
|
|
6
|
+
* @since 1.2.2
|
|
7
|
+
*/
|
|
8
|
+
import { toJsonSafe } from '../../utils/helpers.js';
|
|
9
|
+
/* ═══════════════════════════════════════════════════════════════
|
|
10
|
+
* Serialization
|
|
11
|
+
* ═══════════════════════════════════════════════════════════════ */
|
|
12
|
+
/**
|
|
13
|
+
* Serialize a value to a JSON string, converting `BigInt` to strings.
|
|
14
|
+
*
|
|
15
|
+
* @param value - Any value (may contain `BigInt`, `Map`, nested objects).
|
|
16
|
+
* @returns JSON string safe for storage.
|
|
17
|
+
* @since 1.2.2
|
|
18
|
+
*/
|
|
19
|
+
export function serialize(value) {
|
|
20
|
+
return JSON.stringify(toJsonSafe(value));
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Deserialize a JSON string back to a typed value.
|
|
24
|
+
*
|
|
25
|
+
* @typeParam T - Expected return type.
|
|
26
|
+
* @param json - JSON string from the store.
|
|
27
|
+
* @returns Parsed value.
|
|
28
|
+
* @since 1.2.2
|
|
29
|
+
*/
|
|
30
|
+
export function deserialize(json) {
|
|
31
|
+
return JSON.parse(json);
|
|
32
|
+
}
|
|
33
|
+
/* ═══════════════════════════════════════════════════════════════
|
|
34
|
+
* Redis key builders
|
|
35
|
+
* ═══════════════════════════════════════════════════════════════ */
|
|
36
|
+
/**
|
|
37
|
+
* Build a namespaced Redis key from segments.
|
|
38
|
+
*
|
|
39
|
+
* @example
|
|
40
|
+
* ```ts
|
|
41
|
+
* buildKey('synapse', 'agent', 'did:agent:1');
|
|
42
|
+
* // → 'synapse:agent:did:agent:1'
|
|
43
|
+
* ```
|
|
44
|
+
*
|
|
45
|
+
* @param parts - Key segments joined by `:`.
|
|
46
|
+
* @returns Colon-delimited key string.
|
|
47
|
+
* @since 1.2.2
|
|
48
|
+
*/
|
|
49
|
+
export function buildKey(...parts) {
|
|
50
|
+
return parts.join(':');
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* Strip a prefix from a Redis key and return the remaining segments.
|
|
54
|
+
*
|
|
55
|
+
* @param prefix - The prefix to strip (e.g. `'synapse'`).
|
|
56
|
+
* @param key - Full key (e.g. `'synapse:agent:id1'`).
|
|
57
|
+
* @returns Remaining segments after the prefix (e.g. `['agent', 'id1']`).
|
|
58
|
+
* @since 1.2.2
|
|
59
|
+
*/
|
|
60
|
+
export function parseKey(prefix, key) {
|
|
61
|
+
const stripped = key.startsWith(prefix + ':') ? key.slice(prefix.length + 1) : key;
|
|
62
|
+
return stripped.split(':');
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* Extract the agent ID from a namespaced Redis key.
|
|
66
|
+
*
|
|
67
|
+
* @param prefix - Key prefix (e.g. `'synapse'`).
|
|
68
|
+
* @param key - Full key (e.g. `'synapse:agent:my-agent'`).
|
|
69
|
+
* @returns The agent ID segment, or the full key if pattern doesn't match.
|
|
70
|
+
* @since 1.2.2
|
|
71
|
+
*/
|
|
72
|
+
export function extractAgentId(prefix, key) {
|
|
73
|
+
const parts = parseKey(prefix, key);
|
|
74
|
+
// Keys are: agent:{id}, session:{agentId}:{sessionId}, etc.
|
|
75
|
+
return parts.length >= 2 ? parts[1] : key;
|
|
76
|
+
}
|
|
77
|
+
/* ═══════════════════════════════════════════════════════════════
|
|
78
|
+
* PostgreSQL schema
|
|
79
|
+
* ═══════════════════════════════════════════════════════════════ */
|
|
80
|
+
/** Current schema version. Bump when adding migrations. */
|
|
81
|
+
export const SCHEMA_VERSION = 1;
|
|
82
|
+
/**
|
|
83
|
+
* Generate the full PostgreSQL DDL for a given table prefix.
|
|
84
|
+
*
|
|
85
|
+
* Creates tables:
|
|
86
|
+
* - `{prefix}_agents` — agent snapshots (JSONB)
|
|
87
|
+
* - `{prefix}_sessions` — session records (JSONB)
|
|
88
|
+
* - `{prefix}_receipts` — payment receipts (JSONB)
|
|
89
|
+
* - `{prefix}_metrics` — time-series metric points
|
|
90
|
+
* - `{prefix}_kv` — generic key-value store
|
|
91
|
+
* - `{prefix}_schema_version` — migration tracking
|
|
92
|
+
*
|
|
93
|
+
* @param prefix - Table name prefix (default: `'synapse'`).
|
|
94
|
+
* @returns SQL DDL string ready for `client.query()`.
|
|
95
|
+
* @since 1.2.2
|
|
96
|
+
*/
|
|
97
|
+
export function buildSchema(prefix = 'synapse') {
|
|
98
|
+
const p = prefix;
|
|
99
|
+
return `
|
|
100
|
+
-- ═══════════════════════════════════════════════════════════════
|
|
101
|
+
-- Synapse AI Persistence — Schema v${SCHEMA_VERSION}
|
|
102
|
+
-- Prefix: ${p}
|
|
103
|
+
-- ═══════════════════════════════════════════════════════════════
|
|
104
|
+
|
|
105
|
+
-- Agent snapshots
|
|
106
|
+
CREATE TABLE IF NOT EXISTS ${p}_agents (
|
|
107
|
+
agent_id TEXT PRIMARY KEY,
|
|
108
|
+
snapshot JSONB NOT NULL,
|
|
109
|
+
created_at TIMESTAMPTZ NOT NULL DEFAULT NOW(),
|
|
110
|
+
updated_at TIMESTAMPTZ NOT NULL DEFAULT NOW()
|
|
111
|
+
);
|
|
112
|
+
|
|
113
|
+
-- Session records
|
|
114
|
+
CREATE TABLE IF NOT EXISTS ${p}_sessions (
|
|
115
|
+
id TEXT NOT NULL,
|
|
116
|
+
agent_id TEXT NOT NULL,
|
|
117
|
+
state JSONB NOT NULL,
|
|
118
|
+
status TEXT NOT NULL DEFAULT 'active',
|
|
119
|
+
created_at TIMESTAMPTZ NOT NULL DEFAULT NOW(),
|
|
120
|
+
updated_at TIMESTAMPTZ NOT NULL DEFAULT NOW(),
|
|
121
|
+
PRIMARY KEY (agent_id, id)
|
|
122
|
+
);
|
|
123
|
+
CREATE INDEX IF NOT EXISTS idx_${p}_sessions_agent
|
|
124
|
+
ON ${p}_sessions (agent_id);
|
|
125
|
+
CREATE INDEX IF NOT EXISTS idx_${p}_sessions_status
|
|
126
|
+
ON ${p}_sessions (status);
|
|
127
|
+
|
|
128
|
+
-- Payment receipts
|
|
129
|
+
CREATE TABLE IF NOT EXISTS ${p}_receipts (
|
|
130
|
+
id TEXT PRIMARY KEY,
|
|
131
|
+
agent_id TEXT NOT NULL,
|
|
132
|
+
session_id TEXT,
|
|
133
|
+
receipt JSONB NOT NULL,
|
|
134
|
+
amount_charged TEXT NOT NULL DEFAULT '0',
|
|
135
|
+
settled_at TIMESTAMPTZ NOT NULL DEFAULT NOW()
|
|
136
|
+
);
|
|
137
|
+
CREATE INDEX IF NOT EXISTS idx_${p}_receipts_agent
|
|
138
|
+
ON ${p}_receipts (agent_id);
|
|
139
|
+
CREATE INDEX IF NOT EXISTS idx_${p}_receipts_settled
|
|
140
|
+
ON ${p}_receipts (settled_at DESC);
|
|
141
|
+
|
|
142
|
+
-- Metric time-series
|
|
143
|
+
CREATE TABLE IF NOT EXISTS ${p}_metrics (
|
|
144
|
+
id BIGSERIAL PRIMARY KEY,
|
|
145
|
+
agent_id TEXT NOT NULL,
|
|
146
|
+
metric_key TEXT NOT NULL,
|
|
147
|
+
value DOUBLE PRECISION NOT NULL,
|
|
148
|
+
labels JSONB DEFAULT '{}',
|
|
149
|
+
recorded_at TIMESTAMPTZ NOT NULL DEFAULT NOW()
|
|
150
|
+
);
|
|
151
|
+
CREATE INDEX IF NOT EXISTS idx_${p}_metrics_agent_key
|
|
152
|
+
ON ${p}_metrics (agent_id, metric_key);
|
|
153
|
+
CREATE INDEX IF NOT EXISTS idx_${p}_metrics_time
|
|
154
|
+
ON ${p}_metrics (recorded_at DESC);
|
|
155
|
+
|
|
156
|
+
-- Generic key-value store
|
|
157
|
+
CREATE TABLE IF NOT EXISTS ${p}_kv (
|
|
158
|
+
key TEXT PRIMARY KEY,
|
|
159
|
+
value JSONB NOT NULL,
|
|
160
|
+
expires_at TIMESTAMPTZ,
|
|
161
|
+
created_at TIMESTAMPTZ NOT NULL DEFAULT NOW()
|
|
162
|
+
);
|
|
163
|
+
|
|
164
|
+
-- Schema version tracking
|
|
165
|
+
CREATE TABLE IF NOT EXISTS ${p}_schema_version (
|
|
166
|
+
version INTEGER PRIMARY KEY,
|
|
167
|
+
applied_at TIMESTAMPTZ NOT NULL DEFAULT NOW()
|
|
168
|
+
);
|
|
169
|
+
INSERT INTO ${p}_schema_version (version) VALUES (${SCHEMA_VERSION})
|
|
170
|
+
ON CONFLICT (version) DO NOTHING;
|
|
171
|
+
`.trim();
|
|
172
|
+
}
|
|
173
|
+
/**
|
|
174
|
+
* SQL to clean up expired rows from the KV table.
|
|
175
|
+
*
|
|
176
|
+
* @param prefix - Table name prefix.
|
|
177
|
+
* @returns DELETE statement string.
|
|
178
|
+
* @since 1.2.2
|
|
179
|
+
*/
|
|
180
|
+
export function buildKvCleanupSql(prefix = 'synapse') {
|
|
181
|
+
return `DELETE FROM ${prefix}_kv WHERE expires_at IS NOT NULL AND expires_at < NOW()`;
|
|
182
|
+
}
|
|
183
|
+
//# sourceMappingURL=helpers.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"helpers.js","sourceRoot":"","sources":["../../../../src/ai/persistence/helpers.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AAEjD;;qEAEqE;AAErE;;;;;;GAMG;AACH,MAAM,UAAU,SAAS,CAAC,KAAc;IACtC,OAAO,IAAI,CAAC,SAAS,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC,CAAC;AAC3C,CAAC;AAED;;;;;;;GAOG;AACH,MAAM,UAAU,WAAW,CAAc,IAAY;IACnD,OAAO,IAAI,CAAC,KAAK,CAAC,IAAI,CAAM,CAAC;AAC/B,CAAC;AAED;;qEAEqE;AAErE;;;;;;;;;;;;GAYG;AACH,MAAM,UAAU,QAAQ,CAAC,GAAG,KAAe;IACzC,OAAO,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AACzB,CAAC;AAED;;;;;;;GAOG;AACH,MAAM,UAAU,QAAQ,CAAC,MAAc,EAAE,GAAW;IAClD,MAAM,QAAQ,GAAG,GAAG,CAAC,UAAU,CAAC,MAAM,GAAG,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,KAAK,CAAC,MAAM,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC;IACnF,OAAO,QAAQ,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;AAC7B,CAAC;AAED;;;;;;;GAOG;AACH,MAAM,UAAU,cAAc,CAAC,MAAc,EAAE,GAAW;IACxD,MAAM,KAAK,GAAG,QAAQ,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;IACpC,4DAA4D;IAC5D,OAAO,KAAK,CAAC,MAAM,IAAI,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC;AAC5C,CAAC;AAED;;qEAEqE;AAErE,2DAA2D;AAC3D,MAAM,CAAC,MAAM,cAAc,GAAG,CAAC,CAAC;AAEhC;;;;;;;;;;;;;;GAcG;AACH,MAAM,UAAU,WAAW,CAAC,SAAiB,SAAS;IACpD,MAAM,CAAC,GAAG,MAAM,CAAC;IACjB,OAAO;;uCAE8B,cAAc;cACvC,CAAC;;;;6BAIc,CAAC;;;;;;;;6BAQD,CAAC;;;;;;;;;iCASG,CAAC;OAC3B,CAAC;iCACyB,CAAC;OAC3B,CAAC;;;6BAGqB,CAAC;;;;;;;;iCAQG,CAAC;OAC3B,CAAC;iCACyB,CAAC;OAC3B,CAAC;;;6BAGqB,CAAC;;;;;;;;iCAQG,CAAC;OAC3B,CAAC;iCACyB,CAAC;OAC3B,CAAC;;;6BAGqB,CAAC;;;;;;;;6BAQD,CAAC;;;;cAIhB,CAAC,qCAAqC,cAAc;;CAEjE,CAAC,IAAI,EAAE,CAAC;AACT,CAAC;AAED;;;;;;GAMG;AACH,MAAM,UAAU,iBAAiB,CAAC,SAAiB,SAAS;IAC1D,OAAO,eAAe,MAAM,yDAAyD,CAAC;AACxF,CAAC"}
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @module ai/persistence
|
|
3
|
+
* @description Synapse AI Persistence Layer — Redis, PostgreSQL, and in-memory
|
|
4
|
+
* adapters for long-term storage of agent snapshots, sessions, receipts,
|
|
5
|
+
* and metrics.
|
|
6
|
+
*
|
|
7
|
+
* ## Architecture
|
|
8
|
+
*
|
|
9
|
+
* All adapters implement the universal {@link PersistenceStore} interface
|
|
10
|
+
* **and** the `PersistenceAdapter` interface from {@link AgentRegistry},
|
|
11
|
+
* so they work everywhere:
|
|
12
|
+
*
|
|
13
|
+
* ```ts
|
|
14
|
+
* // As a standalone store
|
|
15
|
+
* const store = new RedisPersistence({ client: redis });
|
|
16
|
+
* await store.saveAgent(snapshot);
|
|
17
|
+
*
|
|
18
|
+
* // As AgentRegistry backend
|
|
19
|
+
* const registry = new AgentRegistry({ persistence: store });
|
|
20
|
+
* ```
|
|
21
|
+
*
|
|
22
|
+
* ## Adapters
|
|
23
|
+
*
|
|
24
|
+
* | Adapter | Backing store | Best for |
|
|
25
|
+
* |---|---|---|
|
|
26
|
+
* | {@link MemoryStore} | In-process `Map` | Testing, dev, CLI tools |
|
|
27
|
+
* | {@link RedisPersistence} | Redis / Valkey | Sessions, caching, pub/sub |
|
|
28
|
+
* | {@link PostgresPersistence} | PostgreSQL | Analytics, receipts, audit |
|
|
29
|
+
*
|
|
30
|
+
* ## Dependency injection
|
|
31
|
+
*
|
|
32
|
+
* Redis and PostgreSQL adapters accept a pre-configured client instance
|
|
33
|
+
* via their constructor config. No runtime dependencies are bundled —
|
|
34
|
+
* install `ioredis` or `pg` as needed.
|
|
35
|
+
*
|
|
36
|
+
* @example Redis quick start
|
|
37
|
+
* ```ts
|
|
38
|
+
* import Redis from 'ioredis';
|
|
39
|
+
* import { RedisPersistence } from '@oobe-protocol-labs/synapse-client-sdk/ai';
|
|
40
|
+
*
|
|
41
|
+
* const redis = new Redis(process.env.REDIS_URL);
|
|
42
|
+
* const store = new RedisPersistence({ client: redis, defaultTtl: 3600 });
|
|
43
|
+
* await store.connect();
|
|
44
|
+
*
|
|
45
|
+
* await store.saveAgent(gateway.snapshot());
|
|
46
|
+
* await store.saveSession(sessionRecord);
|
|
47
|
+
* await store.recordMetric('agent-1', 'calls', 42);
|
|
48
|
+
* ```
|
|
49
|
+
*
|
|
50
|
+
* @example PostgreSQL quick start
|
|
51
|
+
* ```ts
|
|
52
|
+
* import { Pool } from 'pg';
|
|
53
|
+
* import { PostgresPersistence } from '@oobe-protocol-labs/synapse-client-sdk/ai';
|
|
54
|
+
*
|
|
55
|
+
* const pool = new Pool({ connectionString: process.env.DATABASE_URL });
|
|
56
|
+
* const store = new PostgresPersistence({ client: pool });
|
|
57
|
+
* await store.connect(); // auto-creates tables
|
|
58
|
+
*
|
|
59
|
+
* await store.saveAgent(gateway.snapshot());
|
|
60
|
+
* const receipts = await store.listReceipts('agent-1', { limit: 50 });
|
|
61
|
+
* const stats = await store.getTableStats();
|
|
62
|
+
* ```
|
|
63
|
+
*
|
|
64
|
+
* @example Dual-store pattern (Redis cache + PostgreSQL archive)
|
|
65
|
+
* ```ts
|
|
66
|
+
* import Redis from 'ioredis';
|
|
67
|
+
* import { Pool } from 'pg';
|
|
68
|
+
* import { RedisPersistence, PostgresPersistence } from '@oobe-protocol-labs/synapse-client-sdk/ai';
|
|
69
|
+
*
|
|
70
|
+
* const cache = new RedisPersistence({ client: new Redis(), defaultTtl: 300 });
|
|
71
|
+
* const archive = new PostgresPersistence({ client: new Pool() });
|
|
72
|
+
* await Promise.all([cache.connect(), archive.connect()]);
|
|
73
|
+
*
|
|
74
|
+
* // Write to both, read from cache first
|
|
75
|
+
* async function saveAgent(snapshot) {
|
|
76
|
+
* await Promise.all([cache.saveAgent(snapshot), archive.saveAgent(snapshot)]);
|
|
77
|
+
* }
|
|
78
|
+
*
|
|
79
|
+
* async function loadAgent(id) {
|
|
80
|
+
* return (await cache.loadAgent(id)) ?? archive.loadAgent(id);
|
|
81
|
+
* }
|
|
82
|
+
* ```
|
|
83
|
+
*
|
|
84
|
+
* @since 1.2.2
|
|
85
|
+
*/
|
|
86
|
+
export { PersistenceError, type PersistenceStore, type RedisLike, type PgLike, type SessionRecord, type ReceiptRecord, type MetricPoint, type SetOptions, type ListOptions, type MetricQueryOpts, type StoreConfig, type RedisStoreConfig, type PostgresStoreConfig, type MemoryStoreConfig, } from './types';
|
|
87
|
+
export { serialize, deserialize, buildKey, parseKey, extractAgentId, buildSchema, buildKvCleanupSql, SCHEMA_VERSION, } from './helpers';
|
|
88
|
+
export { MemoryStore } from './memory';
|
|
89
|
+
export { RedisPersistence } from './redis';
|
|
90
|
+
export { PostgresPersistence } from './postgresql';
|
|
91
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/ai/persistence/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoFG;AAGH,OAAO,EACL,gBAAgB,EAChB,KAAK,gBAAgB,EACrB,KAAK,SAAS,EACd,KAAK,MAAM,EACX,KAAK,aAAa,EAClB,KAAK,aAAa,EAClB,KAAK,WAAW,EAChB,KAAK,UAAU,EACf,KAAK,WAAW,EAChB,KAAK,eAAe,EACpB,KAAK,WAAW,EAChB,KAAK,gBAAgB,EACrB,KAAK,mBAAmB,EACxB,KAAK,iBAAiB,GACvB,MAAM,SAAS,CAAC;AAGjB,OAAO,EACL,SAAS,EACT,WAAW,EACX,QAAQ,EACR,QAAQ,EACR,cAAc,EACd,WAAW,EACX,iBAAiB,EACjB,cAAc,GACf,MAAM,WAAW,CAAC;AAGnB,OAAO,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AACvC,OAAO,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAC;AAC3C,OAAO,EAAE,mBAAmB,EAAE,MAAM,cAAc,CAAC"}
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @module ai/persistence
|
|
3
|
+
* @description Synapse AI Persistence Layer — Redis, PostgreSQL, and in-memory
|
|
4
|
+
* adapters for long-term storage of agent snapshots, sessions, receipts,
|
|
5
|
+
* and metrics.
|
|
6
|
+
*
|
|
7
|
+
* ## Architecture
|
|
8
|
+
*
|
|
9
|
+
* All adapters implement the universal {@link PersistenceStore} interface
|
|
10
|
+
* **and** the `PersistenceAdapter` interface from {@link AgentRegistry},
|
|
11
|
+
* so they work everywhere:
|
|
12
|
+
*
|
|
13
|
+
* ```ts
|
|
14
|
+
* // As a standalone store
|
|
15
|
+
* const store = new RedisPersistence({ client: redis });
|
|
16
|
+
* await store.saveAgent(snapshot);
|
|
17
|
+
*
|
|
18
|
+
* // As AgentRegistry backend
|
|
19
|
+
* const registry = new AgentRegistry({ persistence: store });
|
|
20
|
+
* ```
|
|
21
|
+
*
|
|
22
|
+
* ## Adapters
|
|
23
|
+
*
|
|
24
|
+
* | Adapter | Backing store | Best for |
|
|
25
|
+
* |---|---|---|
|
|
26
|
+
* | {@link MemoryStore} | In-process `Map` | Testing, dev, CLI tools |
|
|
27
|
+
* | {@link RedisPersistence} | Redis / Valkey | Sessions, caching, pub/sub |
|
|
28
|
+
* | {@link PostgresPersistence} | PostgreSQL | Analytics, receipts, audit |
|
|
29
|
+
*
|
|
30
|
+
* ## Dependency injection
|
|
31
|
+
*
|
|
32
|
+
* Redis and PostgreSQL adapters accept a pre-configured client instance
|
|
33
|
+
* via their constructor config. No runtime dependencies are bundled —
|
|
34
|
+
* install `ioredis` or `pg` as needed.
|
|
35
|
+
*
|
|
36
|
+
* @example Redis quick start
|
|
37
|
+
* ```ts
|
|
38
|
+
* import Redis from 'ioredis';
|
|
39
|
+
* import { RedisPersistence } from '@oobe-protocol-labs/synapse-client-sdk/ai';
|
|
40
|
+
*
|
|
41
|
+
* const redis = new Redis(process.env.REDIS_URL);
|
|
42
|
+
* const store = new RedisPersistence({ client: redis, defaultTtl: 3600 });
|
|
43
|
+
* await store.connect();
|
|
44
|
+
*
|
|
45
|
+
* await store.saveAgent(gateway.snapshot());
|
|
46
|
+
* await store.saveSession(sessionRecord);
|
|
47
|
+
* await store.recordMetric('agent-1', 'calls', 42);
|
|
48
|
+
* ```
|
|
49
|
+
*
|
|
50
|
+
* @example PostgreSQL quick start
|
|
51
|
+
* ```ts
|
|
52
|
+
* import { Pool } from 'pg';
|
|
53
|
+
* import { PostgresPersistence } from '@oobe-protocol-labs/synapse-client-sdk/ai';
|
|
54
|
+
*
|
|
55
|
+
* const pool = new Pool({ connectionString: process.env.DATABASE_URL });
|
|
56
|
+
* const store = new PostgresPersistence({ client: pool });
|
|
57
|
+
* await store.connect(); // auto-creates tables
|
|
58
|
+
*
|
|
59
|
+
* await store.saveAgent(gateway.snapshot());
|
|
60
|
+
* const receipts = await store.listReceipts('agent-1', { limit: 50 });
|
|
61
|
+
* const stats = await store.getTableStats();
|
|
62
|
+
* ```
|
|
63
|
+
*
|
|
64
|
+
* @example Dual-store pattern (Redis cache + PostgreSQL archive)
|
|
65
|
+
* ```ts
|
|
66
|
+
* import Redis from 'ioredis';
|
|
67
|
+
* import { Pool } from 'pg';
|
|
68
|
+
* import { RedisPersistence, PostgresPersistence } from '@oobe-protocol-labs/synapse-client-sdk/ai';
|
|
69
|
+
*
|
|
70
|
+
* const cache = new RedisPersistence({ client: new Redis(), defaultTtl: 300 });
|
|
71
|
+
* const archive = new PostgresPersistence({ client: new Pool() });
|
|
72
|
+
* await Promise.all([cache.connect(), archive.connect()]);
|
|
73
|
+
*
|
|
74
|
+
* // Write to both, read from cache first
|
|
75
|
+
* async function saveAgent(snapshot) {
|
|
76
|
+
* await Promise.all([cache.saveAgent(snapshot), archive.saveAgent(snapshot)]);
|
|
77
|
+
* }
|
|
78
|
+
*
|
|
79
|
+
* async function loadAgent(id) {
|
|
80
|
+
* return (await cache.loadAgent(id)) ?? archive.loadAgent(id);
|
|
81
|
+
* }
|
|
82
|
+
* ```
|
|
83
|
+
*
|
|
84
|
+
* @since 1.2.2
|
|
85
|
+
*/
|
|
86
|
+
/* ── Types ───────────────────────────────────────────────────── */
|
|
87
|
+
export { PersistenceError, } from './types.js';
|
|
88
|
+
/* ── Helpers ─────────────────────────────────────────────────── */
|
|
89
|
+
export { serialize, deserialize, buildKey, parseKey, extractAgentId, buildSchema, buildKvCleanupSql, SCHEMA_VERSION, } from './helpers.js';
|
|
90
|
+
/* ── Adapters ────────────────────────────────────────────────── */
|
|
91
|
+
export { MemoryStore } from './memory.js';
|
|
92
|
+
export { RedisPersistence } from './redis.js';
|
|
93
|
+
export { PostgresPersistence } from './postgresql.js';
|
|
94
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/ai/persistence/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoFG;AAEH,oEAAoE;AACpE,OAAO,EACL,gBAAgB,GAcjB,MAAM,SAAS,CAAC;AAEjB,oEAAoE;AACpE,OAAO,EACL,SAAS,EACT,WAAW,EACX,QAAQ,EACR,QAAQ,EACR,cAAc,EACd,WAAW,EACX,iBAAiB,EACjB,cAAc,GACf,MAAM,WAAW,CAAC;AAEnB,oEAAoE;AACpE,OAAO,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AACvC,OAAO,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAC;AAC3C,OAAO,EAAE,mBAAmB,EAAE,MAAM,cAAc,CAAC"}
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @module ai/persistence/memory
|
|
3
|
+
* @description In-memory persistence store for Synapse AI gateway data.
|
|
4
|
+
*
|
|
5
|
+
* Ideal for testing, local development, and single-process deployments
|
|
6
|
+
* where external database infrastructure is unnecessary.
|
|
7
|
+
*
|
|
8
|
+
* Features:
|
|
9
|
+
* - TTL support on generic key-value entries
|
|
10
|
+
* - Optional max-entries eviction (FIFO)
|
|
11
|
+
* - Full {@link PersistenceStore} API
|
|
12
|
+
* - Drop-in `PersistenceAdapter` for {@link AgentRegistry}
|
|
13
|
+
*
|
|
14
|
+
* @since 1.2.2
|
|
15
|
+
*
|
|
16
|
+
* @example
|
|
17
|
+
* ```ts
|
|
18
|
+
* import { MemoryStore } from '@oobe-protocol-labs/synapse-client-sdk/ai';
|
|
19
|
+
*
|
|
20
|
+
* const store = new MemoryStore();
|
|
21
|
+
* await store.connect();
|
|
22
|
+
*
|
|
23
|
+
* await store.saveAgent(gateway.snapshot());
|
|
24
|
+
* const snap = await store.loadAgent('agent-1');
|
|
25
|
+
* ```
|
|
26
|
+
*/
|
|
27
|
+
import type { PersistenceStore, MemoryStoreConfig, SetOptions, ListOptions, MetricQueryOpts, SessionRecord, ReceiptRecord, MetricPoint } from './types';
|
|
28
|
+
import type { GatewaySnapshot } from '../gateway/types';
|
|
29
|
+
/**
|
|
30
|
+
* @description In-memory implementation of {@link PersistenceStore}.
|
|
31
|
+
*
|
|
32
|
+
* Data is stored in `Map` instances and does **not** survive process restarts.
|
|
33
|
+
* TTL is checked lazily on read (no background timers).
|
|
34
|
+
*
|
|
35
|
+
* @since 1.2.2
|
|
36
|
+
*/
|
|
37
|
+
export declare class MemoryStore implements PersistenceStore {
|
|
38
|
+
readonly name = "memory";
|
|
39
|
+
private readonly maxEntries;
|
|
40
|
+
private readonly kv;
|
|
41
|
+
private readonly agents;
|
|
42
|
+
private readonly sessions;
|
|
43
|
+
private readonly receipts;
|
|
44
|
+
private readonly metrics;
|
|
45
|
+
constructor(config?: MemoryStoreConfig);
|
|
46
|
+
connect(): Promise<void>;
|
|
47
|
+
disconnect(): Promise<void>;
|
|
48
|
+
ping(): Promise<boolean>;
|
|
49
|
+
get<T = unknown>(key: string): Promise<T | null>;
|
|
50
|
+
set(key: string, value: unknown, opts?: SetOptions): Promise<void>;
|
|
51
|
+
del(key: string): Promise<boolean>;
|
|
52
|
+
has(key: string): Promise<boolean>;
|
|
53
|
+
saveAgent(snapshot: GatewaySnapshot): Promise<void>;
|
|
54
|
+
loadAgent(agentId: string): Promise<GatewaySnapshot | null>;
|
|
55
|
+
deleteAgent(agentId: string): Promise<boolean>;
|
|
56
|
+
listAgents(): Promise<string[]>;
|
|
57
|
+
saveSession(record: SessionRecord): Promise<void>;
|
|
58
|
+
loadSession(agentId: string, sessionId: string): Promise<SessionRecord | null>;
|
|
59
|
+
deleteSessions(agentId: string): Promise<number>;
|
|
60
|
+
listSessions(agentId: string, opts?: ListOptions): Promise<SessionRecord[]>;
|
|
61
|
+
saveReceipt(record: ReceiptRecord): Promise<void>;
|
|
62
|
+
listReceipts(agentId: string, opts?: ListOptions): Promise<ReceiptRecord[]>;
|
|
63
|
+
recordMetric(agentId: string, key: string, value: number, labels?: Record<string, string>): Promise<void>;
|
|
64
|
+
queryMetrics(agentId: string, key: string, opts?: MetricQueryOpts): Promise<MetricPoint[]>;
|
|
65
|
+
save(agentId: string, snapshot: GatewaySnapshot): Promise<void>;
|
|
66
|
+
load(agentId: string): Promise<GatewaySnapshot | null>;
|
|
67
|
+
delete(agentId: string): Promise<void>;
|
|
68
|
+
keys(): Promise<string[]>;
|
|
69
|
+
private enforceEviction;
|
|
70
|
+
}
|
|
71
|
+
//# sourceMappingURL=memory.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"memory.d.ts","sourceRoot":"","sources":["../../../../src/ai/persistence/memory.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AAEH,OAAO,KAAK,EACV,gBAAgB,EAChB,iBAAiB,EACjB,UAAU,EACV,WAAW,EACX,eAAe,EACf,aAAa,EACb,aAAa,EACb,WAAW,EACZ,MAAM,SAAS,CAAC;AACjB,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AASxD;;;;;;;GAOG;AACH,qBAAa,WAAY,YAAW,gBAAgB;IAClD,QAAQ,CAAC,IAAI,YAAY;IAEzB,OAAO,CAAC,QAAQ,CAAC,UAAU,CAAS;IAGpC,OAAO,CAAC,QAAQ,CAAC,EAAE,CAAoC;IACvD,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAwC;IAC/D,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAoC;IAC7D,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAsC;IAC/D,OAAO,CAAC,QAAQ,CA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,MAAM,EAAE,IAAI,GAAE,WAAgB,GAAG,OAAO,CAAC,aAAa,EAAE,CAAC;IAW/E,YAAY,CAChB,OAAO,EAAE,MAAM,EACf,GAAG,EAAE,MAAM,EACX,KAAK,EAAE,MAAM,EACb,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAC9B,OAAO,CAAC,IAAI,CAAC;IAOV,YAAY,CAChB,OAAO,EAAE,MAAM,EACf,GAAG,EAAE,MAAM,EACX,IAAI,GAAE,eAAoB,GACzB,OAAO,CAAC,WAAW,EAAE,CAAC;IAgBnB,IAAI,CAAC,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,eAAe,GAAG,OAAO,CAAC,IAAI,CAAC;IAI/D,IAAI,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,eAAe,GAAG,IAAI,CAAC;IAItD,MAAM,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAItC,IAAI,IAAI,OAAO,CAAC,MAAM,EAAE,CAAC;IAM/B,OAAO,CAAC,eAAe;CAOxB"}
|
|
@@ -0,0 +1,188 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @module ai/persistence/memory
|
|
3
|
+
* @description In-memory persistence store for Synapse AI gateway data.
|
|
4
|
+
*
|
|
5
|
+
* Ideal for testing, local development, and single-process deployments
|
|
6
|
+
* where external database infrastructure is unnecessary.
|
|
7
|
+
*
|
|
8
|
+
* Features:
|
|
9
|
+
* - TTL support on generic key-value entries
|
|
10
|
+
* - Optional max-entries eviction (FIFO)
|
|
11
|
+
* - Full {@link PersistenceStore} API
|
|
12
|
+
* - Drop-in `PersistenceAdapter` for {@link AgentRegistry}
|
|
13
|
+
*
|
|
14
|
+
* @since 1.2.2
|
|
15
|
+
*
|
|
16
|
+
* @example
|
|
17
|
+
* ```ts
|
|
18
|
+
* import { MemoryStore } from '@oobe-protocol-labs/synapse-client-sdk/ai';
|
|
19
|
+
*
|
|
20
|
+
* const store = new MemoryStore();
|
|
21
|
+
* await store.connect();
|
|
22
|
+
*
|
|
23
|
+
* await store.saveAgent(gateway.snapshot());
|
|
24
|
+
* const snap = await store.loadAgent('agent-1');
|
|
25
|
+
* ```
|
|
26
|
+
*/
|
|
27
|
+
import { serialize, deserialize } from './helpers.js';
|
|
28
|
+
/**
|
|
29
|
+
* @description In-memory implementation of {@link PersistenceStore}.
|
|
30
|
+
*
|
|
31
|
+
* Data is stored in `Map` instances and does **not** survive process restarts.
|
|
32
|
+
* TTL is checked lazily on read (no background timers).
|
|
33
|
+
*
|
|
34
|
+
* @since 1.2.2
|
|
35
|
+
*/
|
|
36
|
+
export class MemoryStore {
|
|
37
|
+
name = 'memory';
|
|
38
|
+
maxEntries;
|
|
39
|
+
/* ── Storage maps ──────────────────────────────────────── */
|
|
40
|
+
kv = new Map();
|
|
41
|
+
agents = new Map();
|
|
42
|
+
sessions = new Map(); // key = agentId:sessionId
|
|
43
|
+
receipts = new Map(); // key = agentId
|
|
44
|
+
metrics = new Map(); // key = agentId:metricKey
|
|
45
|
+
constructor(config = {}) {
|
|
46
|
+
this.maxEntries = config.maxEntries ?? 0;
|
|
47
|
+
}
|
|
48
|
+
/* ── Lifecycle ─────────────────────────────────────────── */
|
|
49
|
+
async connect() { }
|
|
50
|
+
async disconnect() { }
|
|
51
|
+
async ping() { return true; }
|
|
52
|
+
/* ── Generic KV ────────────────────────────────────────── */
|
|
53
|
+
async get(key) {
|
|
54
|
+
const entry = this.kv.get(key);
|
|
55
|
+
if (!entry)
|
|
56
|
+
return null;
|
|
57
|
+
if (entry.expiresAt && Date.now() > entry.expiresAt) {
|
|
58
|
+
this.kv.delete(key);
|
|
59
|
+
return null;
|
|
60
|
+
}
|
|
61
|
+
return deserialize(entry.json);
|
|
62
|
+
}
|
|
63
|
+
async set(key, value, opts) {
|
|
64
|
+
this.enforceEviction();
|
|
65
|
+
const entry = { json: serialize(value) };
|
|
66
|
+
if (opts?.ttl && opts.ttl > 0) {
|
|
67
|
+
entry.expiresAt = Date.now() + opts.ttl * 1000;
|
|
68
|
+
}
|
|
69
|
+
this.kv.set(key, entry);
|
|
70
|
+
}
|
|
71
|
+
async del(key) {
|
|
72
|
+
return this.kv.delete(key);
|
|
73
|
+
}
|
|
74
|
+
async has(key) {
|
|
75
|
+
const entry = this.kv.get(key);
|
|
76
|
+
if (!entry)
|
|
77
|
+
return false;
|
|
78
|
+
if (entry.expiresAt && Date.now() > entry.expiresAt) {
|
|
79
|
+
this.kv.delete(key);
|
|
80
|
+
return false;
|
|
81
|
+
}
|
|
82
|
+
return true;
|
|
83
|
+
}
|
|
84
|
+
/* ── Agents ────────────────────────────────────────────── */
|
|
85
|
+
async saveAgent(snapshot) {
|
|
86
|
+
this.agents.set(snapshot.agentId, snapshot);
|
|
87
|
+
}
|
|
88
|
+
async loadAgent(agentId) {
|
|
89
|
+
return this.agents.get(agentId) ?? null;
|
|
90
|
+
}
|
|
91
|
+
async deleteAgent(agentId) {
|
|
92
|
+
return this.agents.delete(agentId);
|
|
93
|
+
}
|
|
94
|
+
async listAgents() {
|
|
95
|
+
return [...this.agents.keys()];
|
|
96
|
+
}
|
|
97
|
+
/* ── Sessions ──────────────────────────────────────────── */
|
|
98
|
+
async saveSession(record) {
|
|
99
|
+
this.sessions.set(`${record.agentId}:${record.id}`, record);
|
|
100
|
+
}
|
|
101
|
+
async loadSession(agentId, sessionId) {
|
|
102
|
+
return this.sessions.get(`${agentId}:${sessionId}`) ?? null;
|
|
103
|
+
}
|
|
104
|
+
async deleteSessions(agentId) {
|
|
105
|
+
const prefix = `${agentId}:`;
|
|
106
|
+
let count = 0;
|
|
107
|
+
for (const key of this.sessions.keys()) {
|
|
108
|
+
if (key.startsWith(prefix)) {
|
|
109
|
+
this.sessions.delete(key);
|
|
110
|
+
count++;
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
return count;
|
|
114
|
+
}
|
|
115
|
+
async listSessions(agentId, opts = {}) {
|
|
116
|
+
const prefix = `${agentId}:`;
|
|
117
|
+
let results = [];
|
|
118
|
+
for (const [key, rec] of this.sessions) {
|
|
119
|
+
if (key.startsWith(prefix)) {
|
|
120
|
+
if (opts.status && rec.status !== opts.status)
|
|
121
|
+
continue;
|
|
122
|
+
results.push(rec);
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
// Sort by createdAt descending
|
|
126
|
+
results.sort((a, b) => b.createdAt - a.createdAt);
|
|
127
|
+
const offset = opts.offset ?? 0;
|
|
128
|
+
const limit = opts.limit ?? results.length;
|
|
129
|
+
return results.slice(offset, offset + limit);
|
|
130
|
+
}
|
|
131
|
+
/* ── Receipts ──────────────────────────────────────────── */
|
|
132
|
+
async saveReceipt(record) {
|
|
133
|
+
const list = this.receipts.get(record.agentId) ?? [];
|
|
134
|
+
list.push(record);
|
|
135
|
+
this.receipts.set(record.agentId, list);
|
|
136
|
+
}
|
|
137
|
+
async listReceipts(agentId, opts = {}) {
|
|
138
|
+
const list = this.receipts.get(agentId) ?? [];
|
|
139
|
+
// Sort by settledAt descending (most recent first)
|
|
140
|
+
const sorted = [...list].sort((a, b) => b.settledAt - a.settledAt);
|
|
141
|
+
const offset = opts.offset ?? 0;
|
|
142
|
+
const limit = opts.limit ?? sorted.length;
|
|
143
|
+
return sorted.slice(offset, offset + limit);
|
|
144
|
+
}
|
|
145
|
+
/* ── Metrics ───────────────────────────────────────────── */
|
|
146
|
+
async recordMetric(agentId, key, value, labels) {
|
|
147
|
+
const mk = `${agentId}:${key}`;
|
|
148
|
+
const list = this.metrics.get(mk) ?? [];
|
|
149
|
+
list.push({ timestamp: Date.now(), value, labels });
|
|
150
|
+
this.metrics.set(mk, list);
|
|
151
|
+
}
|
|
152
|
+
async queryMetrics(agentId, key, opts = {}) {
|
|
153
|
+
const mk = `${agentId}:${key}`;
|
|
154
|
+
let points = this.metrics.get(mk) ?? [];
|
|
155
|
+
if (opts.from != null)
|
|
156
|
+
points = points.filter(p => p.timestamp >= opts.from);
|
|
157
|
+
if (opts.to != null)
|
|
158
|
+
points = points.filter(p => p.timestamp <= opts.to);
|
|
159
|
+
// Most recent first
|
|
160
|
+
points = [...points].sort((a, b) => b.timestamp - a.timestamp);
|
|
161
|
+
if (opts.limit != null)
|
|
162
|
+
points = points.slice(0, opts.limit);
|
|
163
|
+
return points;
|
|
164
|
+
}
|
|
165
|
+
/* ── PersistenceAdapter compat ─────────────────────────── */
|
|
166
|
+
async save(agentId, snapshot) {
|
|
167
|
+
return this.saveAgent(snapshot);
|
|
168
|
+
}
|
|
169
|
+
async load(agentId) {
|
|
170
|
+
return this.loadAgent(agentId);
|
|
171
|
+
}
|
|
172
|
+
async delete(agentId) {
|
|
173
|
+
this.agents.delete(agentId);
|
|
174
|
+
}
|
|
175
|
+
async keys() {
|
|
176
|
+
return this.listAgents();
|
|
177
|
+
}
|
|
178
|
+
/* ── Internals ─────────────────────────────────────────── */
|
|
179
|
+
enforceEviction() {
|
|
180
|
+
if (this.maxEntries > 0 && this.kv.size >= this.maxEntries) {
|
|
181
|
+
// FIFO: remove the oldest key
|
|
182
|
+
const firstKey = this.kv.keys().next().value;
|
|
183
|
+
if (firstKey)
|
|
184
|
+
this.kv.delete(firstKey);
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
//# sourceMappingURL=memory.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"memory.js","sourceRoot":"","sources":["../../../../src/ai/persistence/memory.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AAaH,OAAO,EAAE,SAAS,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AAQnD;;;;;;;GAOG;AACH,MAAM,OAAO,WAAW;IACb,IAAI,GAAG,QAAQ,CAAC;IAER,UAAU,CAAS;IAEpC,8DAA8D;IAC7C,EAAE,GAAS,IAAI,GAAG,EAAmB,CAAC;IACtC,MAAM,GAAK,IAAI,GAAG,EAA2B,CAAC;IAC9C,QAAQ,GAAG,IAA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