@hashgraphonline/standards-sdk 0.1.185 → 0.1.187
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +3 -0
- package/dist/browser/hcs-25/adapters/acp.d.ts +20 -0
- package/dist/browser/hcs-25/adapters/acp.d.ts.map +1 -0
- package/dist/browser/hcs-25/adapters/agentverse.d.ts +34 -0
- package/dist/browser/hcs-25/adapters/agentverse.d.ts.map +1 -0
- package/dist/browser/hcs-25/adapters/availability.d.ts +22 -0
- package/dist/browser/hcs-25/adapters/availability.d.ts.map +1 -0
- package/dist/browser/hcs-25/adapters/connectivity.d.ts +25 -0
- package/dist/browser/hcs-25/adapters/connectivity.d.ts.map +1 -0
- package/dist/browser/hcs-25/adapters/erc8004-feedback.d.ts +19 -0
- package/dist/browser/hcs-25/adapters/erc8004-feedback.d.ts.map +1 -0
- package/dist/browser/hcs-25/adapters/ethos.d.ts +21 -0
- package/dist/browser/hcs-25/adapters/ethos.d.ts.map +1 -0
- package/dist/browser/hcs-25/adapters/index.d.ts +21 -0
- package/dist/browser/hcs-25/adapters/index.d.ts.map +1 -0
- package/dist/browser/hcs-25/adapters/model-evals.d.ts +61 -0
- package/dist/browser/hcs-25/adapters/model-evals.d.ts.map +1 -0
- package/dist/browser/hcs-25/adapters/normalization.d.ts +20 -0
- package/dist/browser/hcs-25/adapters/normalization.d.ts.map +1 -0
- package/dist/browser/hcs-25/adapters/oss-popularity.d.ts +22 -0
- package/dist/browser/hcs-25/adapters/oss-popularity.d.ts.map +1 -0
- package/dist/browser/hcs-25/adapters/output-verification.d.ts +27 -0
- package/dist/browser/hcs-25/adapters/output-verification.d.ts.map +1 -0
- package/dist/browser/hcs-25/adapters/simple-evals.d.ts +14 -0
- package/dist/browser/hcs-25/adapters/simple-evals.d.ts.map +1 -0
- package/dist/browser/hcs-25/adapters/x402.d.ts +18 -0
- package/dist/browser/hcs-25/adapters/x402.d.ts.map +1 -0
- package/dist/browser/hcs-25/identifiers.d.ts +2 -2
- package/dist/browser/hcs-25/identifiers.d.ts.map +1 -1
- package/dist/browser/hcs-25/index.d.ts +2 -0
- package/dist/browser/hcs-25/index.d.ts.map +1 -1
- package/dist/browser/hcs-25/scoring.d.ts.map +1 -1
- package/dist/browser/hcs-25/signals/index.d.ts +20 -0
- package/dist/browser/hcs-25/signals/index.d.ts.map +1 -0
- package/dist/browser/hcs-25/signals/marketplace.d.ts +296 -0
- package/dist/browser/hcs-25/signals/marketplace.d.ts.map +1 -0
- package/dist/browser/hcs-25/signals/metadata.d.ts +40 -0
- package/dist/browser/hcs-25/signals/metadata.d.ts.map +1 -0
- package/dist/browser/hcs-25/signals/model-evals.d.ts +127 -0
- package/dist/browser/hcs-25/signals/model-evals.d.ts.map +1 -0
- package/dist/browser/hcs-25/signals/operational.d.ts +757 -0
- package/dist/browser/hcs-25/signals/operational.d.ts.map +1 -0
- package/dist/browser/hcs-25/signals/simple-evals.d.ts +156 -0
- package/dist/browser/hcs-25/signals/simple-evals.d.ts.map +1 -0
- package/dist/browser-root/hcs-25/adapters/acp.d.ts +20 -0
- package/dist/browser-root/hcs-25/adapters/acp.d.ts.map +1 -0
- package/dist/browser-root/hcs-25/adapters/agentverse.d.ts +34 -0
- package/dist/browser-root/hcs-25/adapters/agentverse.d.ts.map +1 -0
- package/dist/browser-root/hcs-25/adapters/availability.d.ts +22 -0
- package/dist/browser-root/hcs-25/adapters/availability.d.ts.map +1 -0
- package/dist/browser-root/hcs-25/adapters/connectivity.d.ts +25 -0
- package/dist/browser-root/hcs-25/adapters/connectivity.d.ts.map +1 -0
- package/dist/browser-root/hcs-25/adapters/erc8004-feedback.d.ts +19 -0
- package/dist/browser-root/hcs-25/adapters/erc8004-feedback.d.ts.map +1 -0
- package/dist/browser-root/hcs-25/adapters/ethos.d.ts +21 -0
- package/dist/browser-root/hcs-25/adapters/ethos.d.ts.map +1 -0
- package/dist/browser-root/hcs-25/adapters/index.d.ts +21 -0
- package/dist/browser-root/hcs-25/adapters/index.d.ts.map +1 -0
- package/dist/browser-root/hcs-25/adapters/model-evals.d.ts +61 -0
- package/dist/browser-root/hcs-25/adapters/model-evals.d.ts.map +1 -0
- package/dist/browser-root/hcs-25/adapters/normalization.d.ts +20 -0
- package/dist/browser-root/hcs-25/adapters/normalization.d.ts.map +1 -0
- package/dist/browser-root/hcs-25/adapters/oss-popularity.d.ts +22 -0
- package/dist/browser-root/hcs-25/adapters/oss-popularity.d.ts.map +1 -0
- package/dist/browser-root/hcs-25/adapters/output-verification.d.ts +27 -0
- package/dist/browser-root/hcs-25/adapters/output-verification.d.ts.map +1 -0
- package/dist/browser-root/hcs-25/adapters/simple-evals.d.ts +14 -0
- package/dist/browser-root/hcs-25/adapters/simple-evals.d.ts.map +1 -0
- package/dist/browser-root/hcs-25/adapters/x402.d.ts +18 -0
- package/dist/browser-root/hcs-25/adapters/x402.d.ts.map +1 -0
- package/dist/browser-root/hcs-25/identifiers.d.ts +2 -2
- package/dist/browser-root/hcs-25/identifiers.d.ts.map +1 -1
- package/dist/browser-root/hcs-25/index.d.ts +2 -0
- package/dist/browser-root/hcs-25/index.d.ts.map +1 -1
- package/dist/browser-root/hcs-25/scoring.d.ts.map +1 -1
- package/dist/browser-root/hcs-25/signals/index.d.ts +20 -0
- package/dist/browser-root/hcs-25/signals/index.d.ts.map +1 -0
- package/dist/browser-root/hcs-25/signals/marketplace.d.ts +296 -0
- package/dist/browser-root/hcs-25/signals/marketplace.d.ts.map +1 -0
- package/dist/browser-root/hcs-25/signals/metadata.d.ts +40 -0
- package/dist/browser-root/hcs-25/signals/metadata.d.ts.map +1 -0
- package/dist/browser-root/hcs-25/signals/model-evals.d.ts +127 -0
- package/dist/browser-root/hcs-25/signals/model-evals.d.ts.map +1 -0
- package/dist/browser-root/hcs-25/signals/operational.d.ts +757 -0
- package/dist/browser-root/hcs-25/signals/operational.d.ts.map +1 -0
- package/dist/browser-root/hcs-25/signals/simple-evals.d.ts +156 -0
- package/dist/browser-root/hcs-25/signals/simple-evals.d.ts.map +1 -0
- package/dist/cjs/hcs-25/adapters/acp.d.ts +20 -0
- package/dist/cjs/hcs-25/adapters/acp.d.ts.map +1 -0
- package/dist/cjs/hcs-25/adapters/agentverse.d.ts +34 -0
- package/dist/cjs/hcs-25/adapters/agentverse.d.ts.map +1 -0
- package/dist/cjs/hcs-25/adapters/availability.d.ts +22 -0
- package/dist/cjs/hcs-25/adapters/availability.d.ts.map +1 -0
- package/dist/cjs/hcs-25/adapters/connectivity.d.ts +25 -0
- package/dist/cjs/hcs-25/adapters/connectivity.d.ts.map +1 -0
- package/dist/cjs/hcs-25/adapters/erc8004-feedback.d.ts +19 -0
- package/dist/cjs/hcs-25/adapters/erc8004-feedback.d.ts.map +1 -0
- package/dist/cjs/hcs-25/adapters/ethos.d.ts +21 -0
- package/dist/cjs/hcs-25/adapters/ethos.d.ts.map +1 -0
- package/dist/cjs/hcs-25/adapters/index.d.ts +21 -0
- package/dist/cjs/hcs-25/adapters/index.d.ts.map +1 -0
- package/dist/cjs/hcs-25/adapters/model-evals.d.ts +61 -0
- package/dist/cjs/hcs-25/adapters/model-evals.d.ts.map +1 -0
- package/dist/cjs/hcs-25/adapters/normalization.d.ts +20 -0
- package/dist/cjs/hcs-25/adapters/normalization.d.ts.map +1 -0
- package/dist/cjs/hcs-25/adapters/oss-popularity.d.ts +22 -0
- package/dist/cjs/hcs-25/adapters/oss-popularity.d.ts.map +1 -0
- package/dist/cjs/hcs-25/adapters/output-verification.d.ts +27 -0
- package/dist/cjs/hcs-25/adapters/output-verification.d.ts.map +1 -0
- package/dist/cjs/hcs-25/adapters/simple-evals.d.ts +14 -0
- package/dist/cjs/hcs-25/adapters/simple-evals.d.ts.map +1 -0
- package/dist/cjs/hcs-25/adapters/x402.d.ts +18 -0
- package/dist/cjs/hcs-25/adapters/x402.d.ts.map +1 -0
- package/dist/cjs/hcs-25/identifiers.d.ts +2 -2
- package/dist/cjs/hcs-25/identifiers.d.ts.map +1 -1
- package/dist/cjs/hcs-25/index.d.ts +2 -0
- package/dist/cjs/hcs-25/index.d.ts.map +1 -1
- package/dist/cjs/hcs-25/scoring.d.ts.map +1 -1
- package/dist/cjs/hcs-25/signals/index.d.ts +20 -0
- package/dist/cjs/hcs-25/signals/index.d.ts.map +1 -0
- package/dist/cjs/hcs-25/signals/marketplace.d.ts +296 -0
- package/dist/cjs/hcs-25/signals/marketplace.d.ts.map +1 -0
- package/dist/cjs/hcs-25/signals/metadata.d.ts +40 -0
- package/dist/cjs/hcs-25/signals/metadata.d.ts.map +1 -0
- package/dist/cjs/hcs-25/signals/model-evals.d.ts +127 -0
- package/dist/cjs/hcs-25/signals/model-evals.d.ts.map +1 -0
- package/dist/cjs/hcs-25/signals/operational.d.ts +757 -0
- package/dist/cjs/hcs-25/signals/operational.d.ts.map +1 -0
- package/dist/cjs/hcs-25/signals/simple-evals.d.ts +156 -0
- package/dist/cjs/hcs-25/signals/simple-evals.d.ts.map +1 -0
- package/dist/cjs/standards-sdk.cjs +2 -2
- package/dist/cjs/standards-sdk.cjs.map +1 -1
- package/dist/es/hcs-25/adapters/acp.d.ts +20 -0
- package/dist/es/hcs-25/adapters/acp.d.ts.map +1 -0
- package/dist/es/hcs-25/adapters/agentverse.d.ts +34 -0
- package/dist/es/hcs-25/adapters/agentverse.d.ts.map +1 -0
- package/dist/es/hcs-25/adapters/availability.d.ts +22 -0
- package/dist/es/hcs-25/adapters/availability.d.ts.map +1 -0
- package/dist/es/hcs-25/adapters/connectivity.d.ts +25 -0
- package/dist/es/hcs-25/adapters/connectivity.d.ts.map +1 -0
- package/dist/es/hcs-25/adapters/erc8004-feedback.d.ts +19 -0
- package/dist/es/hcs-25/adapters/erc8004-feedback.d.ts.map +1 -0
- package/dist/es/hcs-25/adapters/ethos.d.ts +21 -0
- package/dist/es/hcs-25/adapters/ethos.d.ts.map +1 -0
- package/dist/es/hcs-25/adapters/index.d.ts +21 -0
- package/dist/es/hcs-25/adapters/index.d.ts.map +1 -0
- package/dist/es/hcs-25/adapters/model-evals.d.ts +61 -0
- package/dist/es/hcs-25/adapters/model-evals.d.ts.map +1 -0
- package/dist/es/hcs-25/adapters/normalization.d.ts +20 -0
- package/dist/es/hcs-25/adapters/normalization.d.ts.map +1 -0
- package/dist/es/hcs-25/adapters/oss-popularity.d.ts +22 -0
- package/dist/es/hcs-25/adapters/oss-popularity.d.ts.map +1 -0
- package/dist/es/hcs-25/adapters/output-verification.d.ts +27 -0
- package/dist/es/hcs-25/adapters/output-verification.d.ts.map +1 -0
- package/dist/es/hcs-25/adapters/simple-evals.d.ts +14 -0
- package/dist/es/hcs-25/adapters/simple-evals.d.ts.map +1 -0
- package/dist/es/hcs-25/adapters/x402.d.ts +18 -0
- package/dist/es/hcs-25/adapters/x402.d.ts.map +1 -0
- package/dist/es/hcs-25/identifiers.d.ts +2 -2
- package/dist/es/hcs-25/identifiers.d.ts.map +1 -1
- package/dist/es/hcs-25/index.d.ts +2 -0
- package/dist/es/hcs-25/index.d.ts.map +1 -1
- package/dist/es/hcs-25/scoring.d.ts.map +1 -1
- package/dist/es/hcs-25/signals/index.d.ts +20 -0
- package/dist/es/hcs-25/signals/index.d.ts.map +1 -0
- package/dist/es/hcs-25/signals/marketplace.d.ts +296 -0
- package/dist/es/hcs-25/signals/marketplace.d.ts.map +1 -0
- package/dist/es/hcs-25/signals/metadata.d.ts +40 -0
- package/dist/es/hcs-25/signals/metadata.d.ts.map +1 -0
- package/dist/es/hcs-25/signals/model-evals.d.ts +127 -0
- package/dist/es/hcs-25/signals/model-evals.d.ts.map +1 -0
- package/dist/es/hcs-25/signals/operational.d.ts +757 -0
- package/dist/es/hcs-25/signals/operational.d.ts.map +1 -0
- package/dist/es/hcs-25/signals/simple-evals.d.ts +156 -0
- package/dist/es/hcs-25/signals/simple-evals.d.ts.map +1 -0
- package/dist/es/standards-sdk.es.js +109 -40
- package/dist/es/standards-sdk.es.js.map +1 -1
- package/dist/es/standards-sdk.es101.js +2 -2
- package/dist/es/standards-sdk.es103.js +2 -2
- package/dist/es/standards-sdk.es104.js +1 -1
- package/dist/es/standards-sdk.es106.js +1 -1
- package/dist/es/standards-sdk.es108.js +2 -2
- package/dist/es/standards-sdk.es11.js +1 -1
- package/dist/es/standards-sdk.es110.js +1 -1
- package/dist/es/standards-sdk.es111.js +2 -2
- package/dist/es/standards-sdk.es115.js +3 -3
- package/dist/es/standards-sdk.es116.js +4 -4
- package/dist/es/standards-sdk.es117.js +1 -1
- package/dist/es/standards-sdk.es117.js.map +1 -1
- package/dist/es/standards-sdk.es119.js +10 -9
- package/dist/es/standards-sdk.es119.js.map +1 -1
- package/dist/es/standards-sdk.es12.js +1 -1
- package/dist/es/standards-sdk.es120.js +225 -251
- package/dist/es/standards-sdk.es120.js.map +1 -1
- package/dist/es/standards-sdk.es121.js +50 -477
- package/dist/es/standards-sdk.es121.js.map +1 -1
- package/dist/es/standards-sdk.es122.js +244 -97
- package/dist/es/standards-sdk.es122.js.map +1 -1
- package/dist/es/standards-sdk.es123.js +451 -133
- package/dist/es/standards-sdk.es123.js.map +1 -1
- package/dist/es/standards-sdk.es124.js +98 -27
- package/dist/es/standards-sdk.es124.js.map +1 -1
- package/dist/es/standards-sdk.es125.js +156 -8
- package/dist/es/standards-sdk.es125.js.map +1 -1
- package/dist/es/standards-sdk.es126.js +29 -177
- package/dist/es/standards-sdk.es126.js.map +1 -1
- package/dist/es/standards-sdk.es127.js +10 -27
- package/dist/es/standards-sdk.es127.js.map +1 -1
- package/dist/es/standards-sdk.es128.js +179 -19
- package/dist/es/standards-sdk.es128.js.map +1 -1
- package/dist/es/standards-sdk.es129.js +27 -158
- package/dist/es/standards-sdk.es129.js.map +1 -1
- package/dist/es/standards-sdk.es13.js +1 -1
- package/dist/es/standards-sdk.es130.js +16 -195
- package/dist/es/standards-sdk.es130.js.map +1 -1
- package/dist/es/standards-sdk.es131.js +133 -763
- package/dist/es/standards-sdk.es131.js.map +1 -1
- package/dist/es/standards-sdk.es132.js +198 -10
- package/dist/es/standards-sdk.es132.js.map +1 -1
- package/dist/es/standards-sdk.es133.js +762 -539
- package/dist/es/standards-sdk.es133.js.map +1 -1
- package/dist/es/standards-sdk.es134.js +10 -623
- package/dist/es/standards-sdk.es134.js.map +1 -1
- package/dist/es/standards-sdk.es135.js +567 -13
- package/dist/es/standards-sdk.es135.js.map +1 -1
- package/dist/es/standards-sdk.es136.js +626 -2
- package/dist/es/standards-sdk.es136.js.map +1 -1
- package/dist/es/standards-sdk.es137.js +12 -86
- package/dist/es/standards-sdk.es137.js.map +1 -1
- package/dist/es/standards-sdk.es138.js +2 -40
- package/dist/es/standards-sdk.es138.js.map +1 -1
- package/dist/es/standards-sdk.es139.js +87 -2
- package/dist/es/standards-sdk.es139.js.map +1 -1
- package/dist/es/standards-sdk.es14.js +1 -1
- package/dist/es/standards-sdk.es140.js +37 -232
- package/dist/es/standards-sdk.es140.js.map +1 -1
- package/dist/es/standards-sdk.es141.js +2 -1140
- package/dist/es/standards-sdk.es141.js.map +1 -1
- package/dist/es/standards-sdk.es142.js +213 -284
- package/dist/es/standards-sdk.es142.js.map +1 -1
- package/dist/es/standards-sdk.es143.js +1138 -420
- package/dist/es/standards-sdk.es143.js.map +1 -1
- package/dist/es/standards-sdk.es144.js +301 -350
- package/dist/es/standards-sdk.es144.js.map +1 -1
- package/dist/es/standards-sdk.es145.js +417 -1117
- package/dist/es/standards-sdk.es145.js.map +1 -1
- package/dist/es/standards-sdk.es146.js +348 -201
- package/dist/es/standards-sdk.es146.js.map +1 -1
- package/dist/es/standards-sdk.es147.js +1035 -1480
- package/dist/es/standards-sdk.es147.js.map +1 -1
- package/dist/es/standards-sdk.es148.js +181 -1130
- package/dist/es/standards-sdk.es148.js.map +1 -1
- package/dist/es/standards-sdk.es149.js +1564 -14
- package/dist/es/standards-sdk.es149.js.map +1 -1
- package/dist/es/standards-sdk.es15.js +1 -1
- package/dist/es/standards-sdk.es150.js +1122 -224
- package/dist/es/standards-sdk.es150.js.map +1 -1
- package/dist/es/standards-sdk.es151.js +17 -4
- package/dist/es/standards-sdk.es151.js.map +1 -1
- package/dist/es/standards-sdk.es152.js +252 -74
- package/dist/es/standards-sdk.es152.js.map +1 -1
- package/dist/es/standards-sdk.es153.js +4 -87
- package/dist/es/standards-sdk.es153.js.map +1 -1
- package/dist/es/standards-sdk.es154.js +73 -52
- package/dist/es/standards-sdk.es154.js.map +1 -1
- package/dist/es/standards-sdk.es155.js +86 -2546
- package/dist/es/standards-sdk.es155.js.map +1 -1
- package/dist/es/standards-sdk.es156.js +53 -152
- package/dist/es/standards-sdk.es156.js.map +1 -1
- package/dist/es/standards-sdk.es157.js +2547 -7
- package/dist/es/standards-sdk.es157.js.map +1 -1
- package/dist/es/standards-sdk.es158.js +138 -65
- package/dist/es/standards-sdk.es158.js.map +1 -1
- package/dist/es/standards-sdk.es159.js +7 -65
- package/dist/es/standards-sdk.es159.js.map +1 -1
- package/dist/es/standards-sdk.es16.js +4 -4
- package/dist/es/standards-sdk.es160.js +86 -30
- package/dist/es/standards-sdk.es160.js.map +1 -1
- package/dist/es/standards-sdk.es161.js +65 -34
- package/dist/es/standards-sdk.es161.js.map +1 -1
- package/dist/es/standards-sdk.es162.js +194 -48
- package/dist/es/standards-sdk.es162.js.map +1 -1
- package/dist/es/standards-sdk.es163.js +17 -12473
- package/dist/es/standards-sdk.es163.js.map +1 -1
- package/dist/es/standards-sdk.es164.js +53 -133
- package/dist/es/standards-sdk.es164.js.map +1 -1
- package/dist/es/standards-sdk.es165.js +91 -38
- package/dist/es/standards-sdk.es165.js.map +1 -1
- package/dist/es/standards-sdk.es166.js +47 -15
- package/dist/es/standards-sdk.es166.js.map +1 -1
- package/dist/es/standards-sdk.es167.js +201 -53
- package/dist/es/standards-sdk.es167.js.map +1 -1
- package/dist/es/standards-sdk.es168.js +53 -108
- package/dist/es/standards-sdk.es168.js.map +1 -1
- package/dist/es/standards-sdk.es169.js +47 -79
- package/dist/es/standards-sdk.es169.js.map +1 -1
- package/dist/es/standards-sdk.es170.js +48 -192
- package/dist/es/standards-sdk.es170.js.map +1 -1
- package/dist/es/standards-sdk.es171.js +47 -670
- package/dist/es/standards-sdk.es171.js.map +1 -1
- package/dist/es/standards-sdk.es172.js +110 -61
- package/dist/es/standards-sdk.es172.js.map +1 -1
- package/dist/es/standards-sdk.es173.js +51 -169
- package/dist/es/standards-sdk.es173.js.map +1 -1
- package/dist/es/standards-sdk.es174.js +39 -317
- package/dist/es/standards-sdk.es174.js.map +1 -1
- package/dist/es/standards-sdk.es175.js +72 -346
- package/dist/es/standards-sdk.es175.js.map +1 -1
- package/dist/es/standards-sdk.es176.js +68 -453
- package/dist/es/standards-sdk.es176.js.map +1 -1
- package/dist/es/standards-sdk.es177.js +44 -331
- package/dist/es/standards-sdk.es177.js.map +1 -1
- package/dist/es/standards-sdk.es178.js +31 -71
- package/dist/es/standards-sdk.es178.js.map +1 -1
- package/dist/es/standards-sdk.es179.js +30 -139
- package/dist/es/standards-sdk.es179.js.map +1 -1
- package/dist/es/standards-sdk.es18.js +11 -11
- package/dist/es/standards-sdk.es180.js +34 -517
- package/dist/es/standards-sdk.es180.js.map +1 -1
- package/dist/es/standards-sdk.es181.js +48 -259
- package/dist/es/standards-sdk.es181.js.map +1 -1
- package/dist/es/standards-sdk.es182.js +127 -185
- package/dist/es/standards-sdk.es182.js.map +1 -1
- package/dist/es/standards-sdk.es183.js +36 -113
- package/dist/es/standards-sdk.es183.js.map +1 -1
- package/dist/es/standards-sdk.es184.js +12464 -134
- package/dist/es/standards-sdk.es184.js.map +1 -1
- package/dist/es/standards-sdk.es185.js +629 -141
- package/dist/es/standards-sdk.es185.js.map +1 -1
- package/dist/es/standards-sdk.es186.js +83 -656
- package/dist/es/standards-sdk.es186.js.map +1 -1
- package/dist/es/standards-sdk.es187.js +61 -173
- package/dist/es/standards-sdk.es187.js.map +1 -1
- package/dist/es/standards-sdk.es188.js +49 -228
- package/dist/es/standards-sdk.es188.js.map +1 -1
- package/dist/es/standards-sdk.es189.js +68 -226
- package/dist/es/standards-sdk.es189.js.map +1 -1
- package/dist/es/standards-sdk.es19.js +8 -8
- package/dist/es/standards-sdk.es190.js +203 -0
- package/dist/es/standards-sdk.es190.js.map +1 -0
- package/dist/es/standards-sdk.es191.js +175 -0
- package/dist/es/standards-sdk.es191.js.map +1 -0
- package/dist/es/standards-sdk.es192.js +325 -0
- package/dist/es/standards-sdk.es192.js.map +1 -0
- package/dist/es/standards-sdk.es193.js +349 -0
- package/dist/es/standards-sdk.es193.js.map +1 -0
- package/dist/es/standards-sdk.es194.js +456 -0
- package/dist/es/standards-sdk.es194.js.map +1 -0
- package/dist/es/standards-sdk.es195.js +334 -0
- package/dist/es/standards-sdk.es195.js.map +1 -0
- package/dist/es/standards-sdk.es196.js +79 -0
- package/dist/es/standards-sdk.es196.js.map +1 -0
- package/dist/es/standards-sdk.es197.js +20 -0
- package/dist/es/standards-sdk.es197.js.map +1 -0
- package/dist/es/standards-sdk.es198.js +142 -0
- package/dist/es/standards-sdk.es198.js.map +1 -0
- package/dist/es/standards-sdk.es199.js +520 -0
- package/dist/es/standards-sdk.es199.js.map +1 -0
- package/dist/es/standards-sdk.es2.js +2 -2
- package/dist/es/standards-sdk.es20.js +1 -1
- package/dist/es/standards-sdk.es200.js +262 -0
- package/dist/es/standards-sdk.es200.js.map +1 -0
- package/dist/es/standards-sdk.es201.js +199 -0
- package/dist/es/standards-sdk.es201.js.map +1 -0
- package/dist/es/standards-sdk.es202.js +122 -0
- package/dist/es/standards-sdk.es202.js.map +1 -0
- package/dist/es/standards-sdk.es203.js +155 -0
- package/dist/es/standards-sdk.es203.js.map +1 -0
- package/dist/es/standards-sdk.es204.js +187 -0
- package/dist/es/standards-sdk.es204.js.map +1 -0
- package/dist/es/standards-sdk.es205.js +687 -0
- package/dist/es/standards-sdk.es205.js.map +1 -0
- package/dist/es/standards-sdk.es206.js +188 -0
- package/dist/es/standards-sdk.es206.js.map +1 -0
- package/dist/es/standards-sdk.es207.js +238 -0
- package/dist/es/standards-sdk.es207.js.map +1 -0
- package/dist/es/standards-sdk.es208.js +242 -0
- package/dist/es/standards-sdk.es208.js.map +1 -0
- package/dist/es/standards-sdk.es21.js +1 -1
- package/dist/es/standards-sdk.es22.js +1 -1
- package/dist/es/standards-sdk.es23.js +1 -1
- package/dist/es/standards-sdk.es24.js +1 -1
- package/dist/es/standards-sdk.es25.js +1 -1
- package/dist/es/standards-sdk.es26.js +1 -1
- package/dist/es/standards-sdk.es27.js +11 -11
- package/dist/es/standards-sdk.es30.js +2 -2
- package/dist/es/standards-sdk.es31.js +4 -4
- package/dist/es/standards-sdk.es32.js +1 -1
- package/dist/es/standards-sdk.es35.js +5 -5
- package/dist/es/standards-sdk.es36.js +4 -4
- package/dist/es/standards-sdk.es37.js +2 -2
- package/dist/es/standards-sdk.es38.js +2 -2
- package/dist/es/standards-sdk.es39.js +1 -1
- package/dist/es/standards-sdk.es4.js +2 -2
- package/dist/es/standards-sdk.es40.js +1 -1
- package/dist/es/standards-sdk.es41.js +2 -2
- package/dist/es/standards-sdk.es46.js +1 -1
- package/dist/es/standards-sdk.es5.js +2 -2
- package/dist/es/standards-sdk.es51.js +1 -1
- package/dist/es/standards-sdk.es53.js +1 -1
- package/dist/es/standards-sdk.es56.js +2 -2
- package/dist/es/standards-sdk.es59.js +1 -1
- package/dist/es/standards-sdk.es6.js +2 -2
- package/dist/es/standards-sdk.es60.js +1 -1
- package/dist/es/standards-sdk.es62.js +1 -1
- package/dist/es/standards-sdk.es63.js +2 -2
- package/dist/es/standards-sdk.es64.js +1 -1
- package/dist/es/standards-sdk.es65.js +1 -1
- package/dist/es/standards-sdk.es66.js +1 -1
- package/dist/es/standards-sdk.es67.js +6 -6
- package/dist/es/standards-sdk.es69.js +1 -1
- package/dist/es/standards-sdk.es7.js +1 -1
- package/dist/es/standards-sdk.es71.js +2 -2
- package/dist/es/standards-sdk.es72.js +3 -3
- package/dist/es/standards-sdk.es75.js +5 -5
- package/dist/es/standards-sdk.es76.js +3 -3
- package/dist/es/standards-sdk.es77.js +2 -2
- package/dist/es/standards-sdk.es78.js +1 -1
- package/dist/es/standards-sdk.es81.js +2 -2
- package/dist/es/standards-sdk.es83.js +2 -2
- package/dist/es/standards-sdk.es84.js +3 -3
- package/dist/es/standards-sdk.es85.js +1 -1
- package/dist/es/standards-sdk.es88.js +1 -1
- package/dist/es/standards-sdk.es89.js +2 -2
- package/dist/es/standards-sdk.es9.js +2 -2
- package/dist/es/standards-sdk.es90.js +4 -4
- package/dist/es/standards-sdk.es94.js +3 -3
- package/dist/es/standards-sdk.es96.js +2 -2
- package/dist/es/standards-sdk.es98.js +1 -1
- package/dist/es/standards-sdk.es99.js +3 -3
- package/package.json +1 -1
|
@@ -1,1160 +1,211 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
} = options;
|
|
38
|
-
this.baseUrl = normaliseBaseUrl(baseUrl);
|
|
39
|
-
const resolvedFetch = fetchImplementation ?? (typeof globalThis.fetch === "function" ? globalThis.fetch : null);
|
|
40
|
-
if (!resolvedFetch) {
|
|
41
|
-
throw new Error(
|
|
42
|
-
"A fetch implementation is required for RegistryBrokerClient"
|
|
43
|
-
);
|
|
44
|
-
}
|
|
45
|
-
this.fetchImpl = resolvedFetch;
|
|
46
|
-
this.defaultHeaders = {
|
|
47
|
-
...defaultHeaders ?? {}
|
|
1
|
+
import { InscriptionSDK } from "./standards-sdk.es184.js";
|
|
2
|
+
class QuoteCache {
|
|
3
|
+
constructor() {
|
|
4
|
+
this.cache = /* @__PURE__ */ new Map();
|
|
5
|
+
this.maxSize = 100;
|
|
6
|
+
this.defaultTtlMs = 5 * 60 * 1e3;
|
|
7
|
+
}
|
|
8
|
+
// 5 minutes
|
|
9
|
+
/**
|
|
10
|
+
* Generate cache key from input parameters
|
|
11
|
+
*/
|
|
12
|
+
generateKey(key) {
|
|
13
|
+
return `${key.inputHash}-${key.clientConfigHash}-${key.optionsHash}`;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Hash object to string for cache key
|
|
17
|
+
*/
|
|
18
|
+
hashObject(obj) {
|
|
19
|
+
return Buffer.from(JSON.stringify(obj)).toString("base64").slice(0, 16);
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Create cache key from parameters
|
|
23
|
+
*/
|
|
24
|
+
createCacheKey(input, clientConfig, options) {
|
|
25
|
+
return {
|
|
26
|
+
inputHash: this.hashObject(input),
|
|
27
|
+
clientConfigHash: this.hashObject({
|
|
28
|
+
accountId: clientConfig.accountId,
|
|
29
|
+
network: clientConfig.network
|
|
30
|
+
}),
|
|
31
|
+
optionsHash: this.hashObject({
|
|
32
|
+
mode: options.mode,
|
|
33
|
+
apiKey: options.apiKey ? "present" : "absent",
|
|
34
|
+
network: options.network,
|
|
35
|
+
metadata: options.metadata
|
|
36
|
+
})
|
|
48
37
|
};
|
|
49
|
-
Object.entries(this.defaultHeaders).forEach(([key, value]) => {
|
|
50
|
-
const headerName = normaliseHeaderName(key);
|
|
51
|
-
if (headerName !== key) {
|
|
52
|
-
delete this.defaultHeaders[key];
|
|
53
|
-
this.defaultHeaders[headerName] = value;
|
|
54
|
-
}
|
|
55
|
-
});
|
|
56
|
-
const existingLedgerHeader = this.defaultHeaders["x-ledger-api-key"]?.trim();
|
|
57
|
-
if (!this.defaultHeaders["x-api-key"] && existingLedgerHeader) {
|
|
58
|
-
this.defaultHeaders["x-api-key"] = existingLedgerHeader;
|
|
59
|
-
}
|
|
60
|
-
if (apiKey) {
|
|
61
|
-
this.defaultHeaders["x-api-key"] = apiKey;
|
|
62
|
-
}
|
|
63
|
-
if (typeof accountId === "string" && accountId.trim().length > 0) {
|
|
64
|
-
this.defaultHeaders["x-account-id"] = accountId.trim();
|
|
65
|
-
}
|
|
66
|
-
if (ledgerApiKey) {
|
|
67
|
-
if (!this.defaultHeaders["x-api-key"]) {
|
|
68
|
-
this.defaultHeaders["x-api-key"] = ledgerApiKey;
|
|
69
|
-
}
|
|
70
|
-
}
|
|
71
|
-
this.registrationAutoTopUp = registrationAutoTopUp;
|
|
72
|
-
this.historyAutoTopUp = historyAutoTopUp;
|
|
73
|
-
this.encryptionOptions = encryption;
|
|
74
|
-
if (this.encryptionOptions) {
|
|
75
|
-
this.encryptionBootstrapPromise = this.initializeEncryptionBootstrap(
|
|
76
|
-
this.encryptionOptions
|
|
77
|
-
);
|
|
78
|
-
}
|
|
79
|
-
}
|
|
80
|
-
static async initializeAgent(options) {
|
|
81
|
-
const { uaid, ensureEncryptionKey = true, ...clientOptions } = options;
|
|
82
|
-
const client = new RegistryBrokerClient(clientOptions);
|
|
83
|
-
let encryption = null;
|
|
84
|
-
if (ensureEncryptionKey) {
|
|
85
|
-
const ensureOptions = typeof ensureEncryptionKey === "object" ? ensureEncryptionKey : { generateIfMissing: true };
|
|
86
|
-
encryption = await client.encryption.ensureAgentKey({
|
|
87
|
-
uaid,
|
|
88
|
-
...ensureOptions
|
|
89
|
-
});
|
|
90
|
-
}
|
|
91
|
-
return { client, encryption };
|
|
92
|
-
}
|
|
93
|
-
get chat() {
|
|
94
|
-
if (this.chatApi) {
|
|
95
|
-
return this.chatApi;
|
|
96
|
-
}
|
|
97
|
-
const api = createChatApi(this, this.getEncryptedChatManager());
|
|
98
|
-
this.chatApi = api;
|
|
99
|
-
return api;
|
|
100
|
-
}
|
|
101
|
-
get encryption() {
|
|
102
|
-
if (this.encryptionApi) {
|
|
103
|
-
return this.encryptionApi;
|
|
104
|
-
}
|
|
105
|
-
const api = createEncryptionApi(this);
|
|
106
|
-
this.encryptionApi = api;
|
|
107
|
-
return api;
|
|
108
38
|
}
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
this.
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
if (!name || name.trim().length === 0) {
|
|
118
|
-
return;
|
|
119
|
-
}
|
|
120
|
-
const headerName = normaliseHeaderName(name);
|
|
121
|
-
if (!value || value.trim().length === 0) {
|
|
122
|
-
delete this.defaultHeaders[headerName];
|
|
123
|
-
return;
|
|
124
|
-
}
|
|
125
|
-
this.defaultHeaders[headerName] = value.trim();
|
|
126
|
-
}
|
|
127
|
-
getDefaultHeaders() {
|
|
128
|
-
return { ...this.defaultHeaders };
|
|
129
|
-
}
|
|
130
|
-
async encryptionReady() {
|
|
131
|
-
if (!this.encryptionBootstrapPromise) {
|
|
132
|
-
return;
|
|
133
|
-
}
|
|
134
|
-
await this.encryptionBootstrapPromise;
|
|
135
|
-
}
|
|
136
|
-
buildUrl(path) {
|
|
137
|
-
const normalisedPath = path.startsWith("/") ? path : `/${path}`;
|
|
138
|
-
return `${this.baseUrl}${normalisedPath}`;
|
|
139
|
-
}
|
|
140
|
-
buildRequestInit(config) {
|
|
141
|
-
const headers = new Headers();
|
|
142
|
-
Object.entries(this.defaultHeaders).forEach(([key, value]) => {
|
|
143
|
-
headers.set(key, value);
|
|
144
|
-
});
|
|
145
|
-
if (config.headers) {
|
|
146
|
-
Object.entries(config.headers).forEach(([key, value]) => {
|
|
147
|
-
headers.set(key, value);
|
|
148
|
-
});
|
|
149
|
-
}
|
|
150
|
-
if (!headers.has("accept")) {
|
|
151
|
-
headers.set("accept", "application/json");
|
|
39
|
+
/**
|
|
40
|
+
* Get cached quote if available and not expired
|
|
41
|
+
*/
|
|
42
|
+
get(key) {
|
|
43
|
+
const cacheKey = this.generateKey(key);
|
|
44
|
+
const entry = this.cache.get(cacheKey);
|
|
45
|
+
if (!entry) {
|
|
46
|
+
return null;
|
|
152
47
|
}
|
|
153
|
-
|
|
154
|
-
|
|
48
|
+
const now = Date.now();
|
|
49
|
+
if (now - entry.timestamp > entry.ttlMs) {
|
|
50
|
+
this.cache.delete(cacheKey);
|
|
51
|
+
return null;
|
|
155
52
|
}
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
53
|
+
this.cache.delete(cacheKey);
|
|
54
|
+
this.cache.set(cacheKey, entry);
|
|
55
|
+
return entry.quote;
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* Store quote in cache
|
|
59
|
+
*/
|
|
60
|
+
set(key, quote, ttlMs = this.defaultTtlMs) {
|
|
61
|
+
const cacheKey = this.generateKey(key);
|
|
62
|
+
if (this.cache.size >= this.maxSize) {
|
|
63
|
+
const firstKey = this.cache.keys().next().value;
|
|
64
|
+
if (firstKey) {
|
|
65
|
+
this.cache.delete(firstKey);
|
|
164
66
|
}
|
|
165
67
|
}
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
const response = await this.fetchImpl(this.buildUrl(path), init);
|
|
171
|
-
if (response.ok) {
|
|
172
|
-
return response;
|
|
173
|
-
}
|
|
174
|
-
const errorBody = await this.extractErrorBody(response);
|
|
175
|
-
throw new RegistryBrokerError("Registry broker request failed", {
|
|
176
|
-
status: response.status,
|
|
177
|
-
statusText: response.statusText,
|
|
178
|
-
body: errorBody
|
|
179
|
-
});
|
|
180
|
-
}
|
|
181
|
-
async requestAbsolute(url, config) {
|
|
182
|
-
const init = this.buildRequestInit(config);
|
|
183
|
-
const response = await this.fetchImpl(url, init);
|
|
184
|
-
if (response.ok) {
|
|
185
|
-
return response;
|
|
186
|
-
}
|
|
187
|
-
const errorBody = await this.extractErrorBody(response);
|
|
188
|
-
throw new RegistryBrokerError("Registry broker request failed", {
|
|
189
|
-
status: response.status,
|
|
190
|
-
statusText: response.statusText,
|
|
191
|
-
body: errorBody
|
|
68
|
+
this.cache.set(cacheKey, {
|
|
69
|
+
quote,
|
|
70
|
+
timestamp: Date.now(),
|
|
71
|
+
ttlMs
|
|
192
72
|
});
|
|
193
73
|
}
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
throw new RegistryBrokerParseError(
|
|
200
|
-
"Expected JSON response from registry broker",
|
|
201
|
-
body
|
|
202
|
-
);
|
|
203
|
-
}
|
|
204
|
-
return await response.json();
|
|
205
|
-
}
|
|
206
|
-
async requestAbsoluteJson(url, config) {
|
|
207
|
-
const response = await this.requestAbsolute(url, config);
|
|
208
|
-
const contentType = response.headers?.get("content-type") ?? "";
|
|
209
|
-
if (!JSON_CONTENT_TYPE.test(contentType)) {
|
|
210
|
-
const body = await response.text();
|
|
211
|
-
throw new RegistryBrokerParseError(
|
|
212
|
-
"Expected JSON response from registry broker",
|
|
213
|
-
body
|
|
214
|
-
);
|
|
215
|
-
}
|
|
216
|
-
return await response.json();
|
|
217
|
-
}
|
|
218
|
-
async getAgentFeedback(uaid, options = {}) {
|
|
219
|
-
const normalized = uaid.trim();
|
|
220
|
-
if (!normalized) {
|
|
221
|
-
throw new Error("uaid is required");
|
|
222
|
-
}
|
|
223
|
-
const query = options.includeRevoked === true ? "?includeRevoked=true" : "";
|
|
224
|
-
const raw = await this.requestJson(
|
|
225
|
-
`/agents/${encodeURIComponent(normalized)}/feedback${query}`,
|
|
226
|
-
{ method: "GET" }
|
|
227
|
-
);
|
|
228
|
-
return this.parseWithSchema(
|
|
229
|
-
raw,
|
|
230
|
-
agentFeedbackResponseSchema,
|
|
231
|
-
"agent feedback response"
|
|
232
|
-
);
|
|
233
|
-
}
|
|
234
|
-
async listAgentFeedbackIndex(options = {}) {
|
|
235
|
-
const params = new URLSearchParams();
|
|
236
|
-
if (typeof options.page === "number" && Number.isFinite(options.page)) {
|
|
237
|
-
params.set("page", String(Math.trunc(options.page)));
|
|
238
|
-
}
|
|
239
|
-
if (typeof options.limit === "number" && Number.isFinite(options.limit)) {
|
|
240
|
-
params.set("limit", String(Math.trunc(options.limit)));
|
|
241
|
-
}
|
|
242
|
-
if (options.registries?.length) {
|
|
243
|
-
params.set("registry", options.registries.join(","));
|
|
244
|
-
}
|
|
245
|
-
const suffix = params.size > 0 ? `?${params.toString()}` : "";
|
|
246
|
-
const raw = await this.requestJson(`/agents/feedback${suffix}`, {
|
|
247
|
-
method: "GET"
|
|
248
|
-
});
|
|
249
|
-
return this.parseWithSchema(
|
|
250
|
-
raw,
|
|
251
|
-
agentFeedbackIndexResponseSchema,
|
|
252
|
-
"agent feedback index response"
|
|
253
|
-
);
|
|
254
|
-
}
|
|
255
|
-
async listAgentFeedbackEntriesIndex(options = {}) {
|
|
256
|
-
const params = new URLSearchParams();
|
|
257
|
-
if (typeof options.page === "number" && Number.isFinite(options.page)) {
|
|
258
|
-
params.set("page", String(Math.trunc(options.page)));
|
|
259
|
-
}
|
|
260
|
-
if (typeof options.limit === "number" && Number.isFinite(options.limit)) {
|
|
261
|
-
params.set("limit", String(Math.trunc(options.limit)));
|
|
262
|
-
}
|
|
263
|
-
if (options.registries?.length) {
|
|
264
|
-
params.set("registry", options.registries.join(","));
|
|
265
|
-
}
|
|
266
|
-
const suffix = params.size > 0 ? `?${params.toString()}` : "";
|
|
267
|
-
const raw = await this.requestJson(
|
|
268
|
-
`/agents/feedback/entries${suffix}`,
|
|
269
|
-
{ method: "GET" }
|
|
270
|
-
);
|
|
271
|
-
return this.parseWithSchema(
|
|
272
|
-
raw,
|
|
273
|
-
agentFeedbackEntriesIndexResponseSchema,
|
|
274
|
-
"agent feedback entries index response"
|
|
275
|
-
);
|
|
74
|
+
/**
|
|
75
|
+
* Clear all cached entries
|
|
76
|
+
*/
|
|
77
|
+
clear() {
|
|
78
|
+
this.cache.clear();
|
|
276
79
|
}
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
80
|
+
}
|
|
81
|
+
class SDKCache {
|
|
82
|
+
constructor() {
|
|
83
|
+
this.cache = /* @__PURE__ */ new Map();
|
|
84
|
+
this.maxSize = 10;
|
|
85
|
+
this.defaultTtlMs = 30 * 60 * 1e3;
|
|
86
|
+
}
|
|
87
|
+
// 30 minutes
|
|
88
|
+
/**
|
|
89
|
+
* Generate config key for SDK instance
|
|
90
|
+
*/
|
|
91
|
+
generateConfigKey(config) {
|
|
92
|
+
return Buffer.from(JSON.stringify(config)).toString("base64");
|
|
93
|
+
}
|
|
94
|
+
/**
|
|
95
|
+
* Get cached SDK instance
|
|
96
|
+
*/
|
|
97
|
+
get(config) {
|
|
98
|
+
const configKey = this.generateConfigKey(config);
|
|
99
|
+
const entry = this.cache.get(configKey);
|
|
100
|
+
if (!entry) {
|
|
101
|
+
return null;
|
|
281
102
|
}
|
|
282
|
-
const
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
body: payload,
|
|
287
|
-
headers: { "content-type": "application/json" }
|
|
288
|
-
}
|
|
289
|
-
);
|
|
290
|
-
return this.parseWithSchema(
|
|
291
|
-
raw,
|
|
292
|
-
agentFeedbackEligibilityResponseSchema,
|
|
293
|
-
"agent feedback eligibility response"
|
|
294
|
-
);
|
|
295
|
-
}
|
|
296
|
-
async submitAgentFeedback(uaid, payload) {
|
|
297
|
-
const normalized = uaid.trim();
|
|
298
|
-
if (!normalized) {
|
|
299
|
-
throw new Error("uaid is required");
|
|
103
|
+
const now = Date.now();
|
|
104
|
+
if (now - entry.timestamp > this.defaultTtlMs) {
|
|
105
|
+
this.cache.delete(configKey);
|
|
106
|
+
return null;
|
|
300
107
|
}
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
108
|
+
return entry.sdk;
|
|
109
|
+
}
|
|
110
|
+
/**
|
|
111
|
+
* Store SDK instance in cache
|
|
112
|
+
*/
|
|
113
|
+
set(config, sdk) {
|
|
114
|
+
const configKey = this.generateConfigKey(config);
|
|
115
|
+
if (this.cache.size >= this.maxSize) {
|
|
116
|
+
const firstKey = this.cache.keys().next().value;
|
|
117
|
+
if (firstKey) {
|
|
118
|
+
this.cache.delete(firstKey);
|
|
307
119
|
}
|
|
308
|
-
);
|
|
309
|
-
return this.parseWithSchema(
|
|
310
|
-
raw,
|
|
311
|
-
agentFeedbackSubmissionResponseSchema,
|
|
312
|
-
"agent feedback submission response"
|
|
313
|
-
);
|
|
314
|
-
}
|
|
315
|
-
async search(params = {}) {
|
|
316
|
-
return search(this, params);
|
|
317
|
-
}
|
|
318
|
-
async delegate(request) {
|
|
319
|
-
return delegate(this, request);
|
|
320
|
-
}
|
|
321
|
-
async searchErc8004ByAgentId(params) {
|
|
322
|
-
const chainId = Math.floor(params.chainId);
|
|
323
|
-
if (!Number.isFinite(chainId) || chainId <= 0) {
|
|
324
|
-
throw new Error("chainId must be a positive integer");
|
|
325
|
-
}
|
|
326
|
-
const rawAgentId = typeof params.agentId === "bigint" ? params.agentId.toString() : String(params.agentId);
|
|
327
|
-
const agentId = rawAgentId.trim();
|
|
328
|
-
if (!agentId) {
|
|
329
|
-
throw new Error("agentId is required");
|
|
330
120
|
}
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
...typeof params.page === "number" ? { page: params.page } : {},
|
|
336
|
-
...typeof params.sortBy === "string" ? { sortBy: params.sortBy } : {},
|
|
337
|
-
...typeof params.sortOrder === "string" ? { sortOrder: params.sortOrder } : {},
|
|
338
|
-
metadata: {
|
|
339
|
-
nativeId: [nativeId],
|
|
340
|
-
networkKey: [`eip155:${chainId}`]
|
|
341
|
-
}
|
|
121
|
+
this.cache.set(configKey, {
|
|
122
|
+
sdk,
|
|
123
|
+
timestamp: Date.now(),
|
|
124
|
+
config: configKey
|
|
342
125
|
});
|
|
343
126
|
}
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
}
|
|
350
|
-
async getAdditionalRegistries() {
|
|
351
|
-
return getAdditionalRegistries(this);
|
|
352
|
-
}
|
|
353
|
-
async popularSearches() {
|
|
354
|
-
return popularSearches(this);
|
|
127
|
+
/**
|
|
128
|
+
* Clear all cached SDK instances
|
|
129
|
+
*/
|
|
130
|
+
clear() {
|
|
131
|
+
this.cache.clear();
|
|
355
132
|
}
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
}
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
}
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
async getSkillsCatalog(options) {
|
|
390
|
-
return getSkillsCatalog(this, options);
|
|
391
|
-
}
|
|
392
|
-
async listSkillVersions(params) {
|
|
393
|
-
return listSkillVersions(this, params);
|
|
394
|
-
}
|
|
395
|
-
async listMySkills(params) {
|
|
396
|
-
return listMySkills(this, params);
|
|
397
|
-
}
|
|
398
|
-
async getMySkillsList(params) {
|
|
399
|
-
return getMySkillsList(this, params);
|
|
400
|
-
}
|
|
401
|
-
async quoteSkillPublish(payload) {
|
|
402
|
-
return quoteSkillPublish(this, payload);
|
|
403
|
-
}
|
|
404
|
-
async quoteSkillPublishPreview(payload) {
|
|
405
|
-
return quoteSkillPublishPreview(this, payload);
|
|
406
|
-
}
|
|
407
|
-
async publishSkill(payload) {
|
|
408
|
-
return publishSkill(this, payload);
|
|
409
|
-
}
|
|
410
|
-
async getSkillPublishJob(jobId, params) {
|
|
411
|
-
return getSkillPublishJob(this, jobId, params);
|
|
412
|
-
}
|
|
413
|
-
async getSkillOwnership(params) {
|
|
414
|
-
return getSkillOwnership(this, params);
|
|
415
|
-
}
|
|
416
|
-
async getRecommendedSkillVersion(params) {
|
|
417
|
-
return getRecommendedSkillVersion(this, params);
|
|
418
|
-
}
|
|
419
|
-
async setRecommendedSkillVersion(payload) {
|
|
420
|
-
return setRecommendedSkillVersion(this, payload);
|
|
421
|
-
}
|
|
422
|
-
async getSkillDeprecations(params) {
|
|
423
|
-
return getSkillDeprecations(this, params);
|
|
424
|
-
}
|
|
425
|
-
async setSkillDeprecation(payload) {
|
|
426
|
-
return setSkillDeprecation(this, payload);
|
|
427
|
-
}
|
|
428
|
-
async getSkillBadge(params) {
|
|
429
|
-
return getSkillBadge(this, params);
|
|
430
|
-
}
|
|
431
|
-
async getSkillStatus(params) {
|
|
432
|
-
return getSkillStatus(this, params);
|
|
433
|
-
}
|
|
434
|
-
async getSkillSecurityBreakdown(params) {
|
|
435
|
-
return getSkillSecurityBreakdown(this, params);
|
|
436
|
-
}
|
|
437
|
-
async getSkillStatusByRepo(params) {
|
|
438
|
-
return getSkillStatusByRepo(this, params);
|
|
439
|
-
}
|
|
440
|
-
async getSkillConversionSignalsByRepo(params) {
|
|
441
|
-
return getSkillConversionSignalsByRepo(this, params);
|
|
442
|
-
}
|
|
443
|
-
async uploadSkillPreviewFromGithubOidc(payload) {
|
|
444
|
-
return uploadSkillPreviewFromGithubOidc(this, payload);
|
|
445
|
-
}
|
|
446
|
-
async getSkillPreview(params) {
|
|
447
|
-
return getSkillPreview(this, params);
|
|
448
|
-
}
|
|
449
|
-
async getSkillPreviewByRepo(params) {
|
|
450
|
-
return getSkillPreviewByRepo(this, params);
|
|
451
|
-
}
|
|
452
|
-
async getSkillPreviewById(previewId) {
|
|
453
|
-
return getSkillPreviewById(this, previewId);
|
|
454
|
-
}
|
|
455
|
-
async getSkillInstall(skillRef) {
|
|
456
|
-
return getSkillInstall(this, skillRef);
|
|
457
|
-
}
|
|
458
|
-
async recordSkillInstallCopy(skillRef, payload) {
|
|
459
|
-
return recordSkillInstallCopy(this, skillRef, payload);
|
|
460
|
-
}
|
|
461
|
-
async listSkillTags() {
|
|
462
|
-
return listSkillTags(this);
|
|
463
|
-
}
|
|
464
|
-
async listSkillCategories() {
|
|
465
|
-
return listSkillCategories(this);
|
|
466
|
-
}
|
|
467
|
-
async resolveSkillMarkdown(skillRef) {
|
|
468
|
-
return resolveSkillMarkdown(this, skillRef);
|
|
469
|
-
}
|
|
470
|
-
async resolveSkillManifest(skillRef) {
|
|
471
|
-
return resolveSkillManifest(this, skillRef);
|
|
472
|
-
}
|
|
473
|
-
async getSkillVoteStatus(params) {
|
|
474
|
-
return getSkillVoteStatus(this, params);
|
|
475
|
-
}
|
|
476
|
-
async setSkillVote(payload) {
|
|
477
|
-
return setSkillVote(this, payload);
|
|
478
|
-
}
|
|
479
|
-
async requestSkillVerification(payload) {
|
|
480
|
-
return requestSkillVerification(this, payload);
|
|
481
|
-
}
|
|
482
|
-
async getSkillVerificationStatus(params) {
|
|
483
|
-
return getSkillVerificationStatus(this, params);
|
|
484
|
-
}
|
|
485
|
-
async createSkillDomainProofChallenge(payload) {
|
|
486
|
-
return createSkillDomainProofChallenge(this, payload);
|
|
487
|
-
}
|
|
488
|
-
async verifySkillDomainProof(payload) {
|
|
489
|
-
return verifySkillDomainProof(this, payload);
|
|
490
|
-
}
|
|
491
|
-
async adaptersDetailed() {
|
|
492
|
-
return adaptersDetailed(this);
|
|
493
|
-
}
|
|
494
|
-
async adapterRegistryCategories() {
|
|
495
|
-
return adapterRegistryCategories(this);
|
|
496
|
-
}
|
|
497
|
-
async adapterRegistryAdapters(filters) {
|
|
498
|
-
return adapterRegistryAdapters(this, filters);
|
|
499
|
-
}
|
|
500
|
-
async createAdapterRegistryCategory(payload) {
|
|
501
|
-
return createAdapterRegistryCategory(this, payload);
|
|
502
|
-
}
|
|
503
|
-
async submitAdapterRegistryAdapter(payload) {
|
|
504
|
-
return submitAdapterRegistryAdapter(this, payload);
|
|
505
|
-
}
|
|
506
|
-
async adapterRegistrySubmissionStatus(submissionId) {
|
|
507
|
-
return adapterRegistrySubmissionStatus(this, submissionId);
|
|
508
|
-
}
|
|
509
|
-
async resolveUaid(uaid) {
|
|
510
|
-
return resolveUaid(this, uaid);
|
|
511
|
-
}
|
|
512
|
-
async performRegisterAgent(payload) {
|
|
513
|
-
const raw = await this.requestJson("/register", {
|
|
514
|
-
method: "POST",
|
|
515
|
-
body: serialiseAgentRegistrationRequest(payload),
|
|
516
|
-
headers: { "content-type": "application/json" }
|
|
133
|
+
}
|
|
134
|
+
const quoteCache = new QuoteCache();
|
|
135
|
+
const sdkCache = new SDKCache();
|
|
136
|
+
async function getOrCreateSDK(clientConfig, options, existingSDK) {
|
|
137
|
+
if (existingSDK) {
|
|
138
|
+
return existingSDK;
|
|
139
|
+
}
|
|
140
|
+
const connectionMode = options.connectionMode ?? "websocket";
|
|
141
|
+
const cacheConfig = {
|
|
142
|
+
apiKey: options.apiKey,
|
|
143
|
+
accountId: clientConfig.accountId,
|
|
144
|
+
network: clientConfig.network || "mainnet",
|
|
145
|
+
authType: options.apiKey ? "api" : "server",
|
|
146
|
+
connectionMode
|
|
147
|
+
};
|
|
148
|
+
const cachedSDK = sdkCache.get(cacheConfig);
|
|
149
|
+
if (cachedSDK) {
|
|
150
|
+
return cachedSDK;
|
|
151
|
+
}
|
|
152
|
+
let sdk;
|
|
153
|
+
if (options.apiKey) {
|
|
154
|
+
sdk = new InscriptionSDK({
|
|
155
|
+
apiKey: options.apiKey,
|
|
156
|
+
network: clientConfig.network || "mainnet",
|
|
157
|
+
connectionMode
|
|
158
|
+
});
|
|
159
|
+
} else {
|
|
160
|
+
sdk = await InscriptionSDK.createWithAuth({
|
|
161
|
+
type: "server",
|
|
162
|
+
accountId: clientConfig.accountId,
|
|
163
|
+
privateKey: typeof clientConfig.privateKey === "string" ? clientConfig.privateKey : clientConfig.privateKey.toString(),
|
|
164
|
+
network: clientConfig.network || "mainnet",
|
|
165
|
+
connectionMode
|
|
517
166
|
});
|
|
518
|
-
return this.parseWithSchema(
|
|
519
|
-
raw,
|
|
520
|
-
registerAgentResponseSchema,
|
|
521
|
-
"register agent response"
|
|
522
|
-
);
|
|
523
167
|
}
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
168
|
+
sdkCache.set(cacheConfig, sdk);
|
|
169
|
+
return sdk;
|
|
170
|
+
}
|
|
171
|
+
function getCachedQuote(input, clientConfig, options) {
|
|
172
|
+
const cacheKey = quoteCache.createCacheKey(input, clientConfig, options);
|
|
173
|
+
return quoteCache.get(cacheKey);
|
|
174
|
+
}
|
|
175
|
+
function cacheQuote(input, clientConfig, options, quote) {
|
|
176
|
+
const cacheKey = quoteCache.createCacheKey(input, clientConfig, options);
|
|
177
|
+
const quoteTtlMs = 10 * 60 * 1e3;
|
|
178
|
+
quoteCache.set(cacheKey, quote, quoteTtlMs);
|
|
179
|
+
}
|
|
180
|
+
function validateQuoteParameters(input, clientConfig, options) {
|
|
181
|
+
if (!input || typeof input !== "object" || !("type" in input)) {
|
|
182
|
+
throw new Error("Invalid inscription input: type is required");
|
|
534
183
|
}
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
return 0;
|
|
538
|
-
}
|
|
539
|
-
return Math.max(
|
|
540
|
-
Math.ceil(shortfallCredits),
|
|
541
|
-
MINIMUM_REGISTRATION_AUTO_TOP_UP_CREDITS
|
|
542
|
-
);
|
|
184
|
+
if (!clientConfig || !clientConfig.accountId) {
|
|
185
|
+
throw new Error("Invalid client config: accountId is required");
|
|
543
186
|
}
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
if (!details) {
|
|
547
|
-
return;
|
|
548
|
-
}
|
|
549
|
-
if (!details.accountId || !details.accountId.trim()) {
|
|
550
|
-
throw new Error("autoTopUp.accountId is required");
|
|
551
|
-
}
|
|
552
|
-
if (!details.privateKey || !details.privateKey.trim()) {
|
|
553
|
-
throw new Error("autoTopUp.privateKey is required");
|
|
554
|
-
}
|
|
555
|
-
for (let attempt = 0; attempt < 3; attempt += 1) {
|
|
556
|
-
const quote = await this.getRegistrationQuote(payload);
|
|
557
|
-
const shortfall = quote.shortfallCredits ?? 0;
|
|
558
|
-
if (shortfall <= 0) {
|
|
559
|
-
return;
|
|
560
|
-
}
|
|
561
|
-
const creditsToPurchase = this.resolveCreditsToPurchase(shortfall);
|
|
562
|
-
if (creditsToPurchase <= 0) {
|
|
563
|
-
return;
|
|
564
|
-
}
|
|
565
|
-
const creditsPerHbar = quote.creditsPerHbar ?? null;
|
|
566
|
-
if (!creditsPerHbar || creditsPerHbar <= 0) {
|
|
567
|
-
throw new Error("Unable to determine credits per HBAR for auto top-up");
|
|
568
|
-
}
|
|
569
|
-
const hbarAmount = this.calculateHbarAmount(
|
|
570
|
-
creditsToPurchase,
|
|
571
|
-
creditsPerHbar
|
|
572
|
-
);
|
|
573
|
-
await this.purchaseCreditsWithHbar({
|
|
574
|
-
accountId: details.accountId.trim(),
|
|
575
|
-
privateKey: details.privateKey.trim(),
|
|
576
|
-
hbarAmount,
|
|
577
|
-
memo: details.memo ?? "Registry Broker auto top-up",
|
|
578
|
-
metadata: {
|
|
579
|
-
shortfallCredits: shortfall,
|
|
580
|
-
requiredCredits: quote.requiredCredits,
|
|
581
|
-
purchasedCredits: creditsToPurchase
|
|
582
|
-
}
|
|
583
|
-
});
|
|
584
|
-
}
|
|
585
|
-
const finalQuote = await this.getRegistrationQuote(payload);
|
|
586
|
-
if ((finalQuote.shortfallCredits ?? 0) > 0) {
|
|
587
|
-
throw new Error("Unable to purchase sufficient credits for registration");
|
|
588
|
-
}
|
|
187
|
+
if (!options) {
|
|
188
|
+
throw new Error("Options are required");
|
|
589
189
|
}
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
return this.performRegisterAgent(payload);
|
|
190
|
+
if (options.mode === "hashinal") {
|
|
191
|
+
if (!options.metadata) {
|
|
192
|
+
throw new Error("Hashinal mode requires metadata");
|
|
594
193
|
}
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
try {
|
|
599
|
-
return await this.performRegisterAgent(payload);
|
|
600
|
-
} catch (error) {
|
|
601
|
-
const shortfall = this.extractInsufficientCreditsDetails(error);
|
|
602
|
-
if (shortfall && !retried) {
|
|
603
|
-
await this.ensureCreditsForRegistration(payload, autoTopUp);
|
|
604
|
-
retried = true;
|
|
605
|
-
continue;
|
|
606
|
-
}
|
|
607
|
-
throw error;
|
|
608
|
-
}
|
|
609
|
-
}
|
|
610
|
-
}
|
|
611
|
-
async getRegistrationQuote(payload) {
|
|
612
|
-
return getRegistrationQuote(this, payload);
|
|
613
|
-
}
|
|
614
|
-
async updateAgent(uaid, payload) {
|
|
615
|
-
return updateAgent(this, uaid, payload);
|
|
616
|
-
}
|
|
617
|
-
async getRegisterStatus(uaid) {
|
|
618
|
-
return getRegisterStatus(this, uaid);
|
|
619
|
-
}
|
|
620
|
-
async registerOwnedMoltbookAgent(uaid, payload) {
|
|
621
|
-
return registerOwnedMoltbookAgent(this, uaid, payload);
|
|
622
|
-
}
|
|
623
|
-
async getRegistrationProgress(attemptId) {
|
|
624
|
-
return getRegistrationProgress(this, attemptId);
|
|
625
|
-
}
|
|
626
|
-
async waitForRegistrationCompletion(attemptId, options) {
|
|
627
|
-
return waitForRegistrationCompletion(this, attemptId, options);
|
|
628
|
-
}
|
|
629
|
-
async validateUaid(uaid) {
|
|
630
|
-
return validateUaid(this, uaid);
|
|
631
|
-
}
|
|
632
|
-
async getUaidConnectionStatus(uaid) {
|
|
633
|
-
return getUaidConnectionStatus(this, uaid);
|
|
634
|
-
}
|
|
635
|
-
async closeUaidConnection(uaid) {
|
|
636
|
-
return closeUaidConnection(this, uaid);
|
|
637
|
-
}
|
|
638
|
-
async dashboardStats() {
|
|
639
|
-
return dashboardStats(this);
|
|
640
|
-
}
|
|
641
|
-
async getCreditsBalance(params = {}) {
|
|
642
|
-
return getCreditsBalance(this, params);
|
|
643
|
-
}
|
|
644
|
-
async getCreditProviders() {
|
|
645
|
-
return getCreditProviders(this);
|
|
646
|
-
}
|
|
647
|
-
async getGuardSession() {
|
|
648
|
-
return getGuardSession(this);
|
|
649
|
-
}
|
|
650
|
-
async getGuardEntitlements() {
|
|
651
|
-
return getGuardEntitlements(this);
|
|
652
|
-
}
|
|
653
|
-
async getGuardBillingBalance() {
|
|
654
|
-
return getGuardBillingBalance(this);
|
|
655
|
-
}
|
|
656
|
-
async getGuardFeed(limit) {
|
|
657
|
-
return getGuardFeed(this, limit);
|
|
658
|
-
}
|
|
659
|
-
async getGuardOverview() {
|
|
660
|
-
return getGuardOverview(this);
|
|
661
|
-
}
|
|
662
|
-
async getGuardTrustByHash(sha256) {
|
|
663
|
-
return getGuardTrustByHash(this, sha256);
|
|
664
|
-
}
|
|
665
|
-
async resolveGuardTrust(query) {
|
|
666
|
-
return resolveGuardTrust(this, query);
|
|
667
|
-
}
|
|
668
|
-
async getGuardRevocations() {
|
|
669
|
-
return getGuardRevocations(this);
|
|
670
|
-
}
|
|
671
|
-
async fetchGuardAdvisories() {
|
|
672
|
-
return fetchGuardAdvisories(this);
|
|
673
|
-
}
|
|
674
|
-
async fetchGuardPolicy() {
|
|
675
|
-
return fetchGuardPolicy(this);
|
|
676
|
-
}
|
|
677
|
-
async getGuardInventory() {
|
|
678
|
-
return getGuardInventory(this);
|
|
679
|
-
}
|
|
680
|
-
async getGuardReceiptHistory() {
|
|
681
|
-
return getGuardReceiptHistory(this);
|
|
682
|
-
}
|
|
683
|
-
async getGuardArtifactTimeline(artifactId) {
|
|
684
|
-
return getGuardArtifactTimeline(this, artifactId);
|
|
685
|
-
}
|
|
686
|
-
async getGuardInventoryDiff() {
|
|
687
|
-
return getGuardInventoryDiff(this);
|
|
688
|
-
}
|
|
689
|
-
async exportGuardAbom() {
|
|
690
|
-
return exportGuardAbom(this);
|
|
691
|
-
}
|
|
692
|
-
async exportGuardArtifactAbom(artifactId) {
|
|
693
|
-
return exportGuardArtifactAbom(this, artifactId);
|
|
694
|
-
}
|
|
695
|
-
async exportGuardReceipts() {
|
|
696
|
-
return exportGuardReceipts(this);
|
|
697
|
-
}
|
|
698
|
-
async getGuardDevices() {
|
|
699
|
-
return getGuardDevices(this);
|
|
700
|
-
}
|
|
701
|
-
async getGuardAlertPreferences() {
|
|
702
|
-
return getGuardAlertPreferences(this);
|
|
703
|
-
}
|
|
704
|
-
async updateGuardAlertPreferences(payload) {
|
|
705
|
-
return updateGuardAlertPreferences(this, payload);
|
|
706
|
-
}
|
|
707
|
-
async getGuardExceptions() {
|
|
708
|
-
return getGuardExceptions(this);
|
|
709
|
-
}
|
|
710
|
-
async getGuardWatchlist() {
|
|
711
|
-
return getGuardWatchlist(this);
|
|
712
|
-
}
|
|
713
|
-
async lookupGuardWatchlist(payload) {
|
|
714
|
-
return lookupGuardWatchlist(this, payload);
|
|
715
|
-
}
|
|
716
|
-
async getGuardPainSignals() {
|
|
717
|
-
return getGuardPainSignals(this);
|
|
718
|
-
}
|
|
719
|
-
async getGuardAggregatedPainSignals() {
|
|
720
|
-
return getGuardAggregatedPainSignals(this);
|
|
721
|
-
}
|
|
722
|
-
async getGuardPreInstallVerdict(payload) {
|
|
723
|
-
return getGuardPreInstallVerdict(this, payload);
|
|
724
|
-
}
|
|
725
|
-
async getGuardPreExecutionVerdict(payload) {
|
|
726
|
-
return getGuardPreExecutionVerdict(this, payload);
|
|
727
|
-
}
|
|
728
|
-
async addGuardWatchlistItem(payload) {
|
|
729
|
-
return addGuardWatchlistItem(this, payload);
|
|
730
|
-
}
|
|
731
|
-
async removeGuardWatchlistItem(artifactId) {
|
|
732
|
-
return removeGuardWatchlistItem(this, artifactId);
|
|
733
|
-
}
|
|
734
|
-
async addGuardException(payload) {
|
|
735
|
-
return addGuardException(this, payload);
|
|
736
|
-
}
|
|
737
|
-
async requestGuardException(payload) {
|
|
738
|
-
return requestGuardException(this, payload);
|
|
739
|
-
}
|
|
740
|
-
async removeGuardException(exceptionId) {
|
|
741
|
-
return removeGuardException(this, exceptionId);
|
|
742
|
-
}
|
|
743
|
-
async ingestGuardPainSignals(items) {
|
|
744
|
-
return ingestGuardPainSignals(this, items);
|
|
745
|
-
}
|
|
746
|
-
async syncGuardReceipts(payload) {
|
|
747
|
-
return syncGuardReceipts(this, payload);
|
|
748
|
-
}
|
|
749
|
-
async syncGuardInventory(payload) {
|
|
750
|
-
return syncGuardInventory(this, payload);
|
|
751
|
-
}
|
|
752
|
-
async submitGuardReceipts(payload) {
|
|
753
|
-
return submitGuardReceipts(this, payload);
|
|
754
|
-
}
|
|
755
|
-
async getGuardTeamPolicyPack() {
|
|
756
|
-
return getGuardTeamPolicyPack(this);
|
|
757
|
-
}
|
|
758
|
-
async updateGuardTeamPolicyPack(payload) {
|
|
759
|
-
return updateGuardTeamPolicyPack(this, payload);
|
|
760
|
-
}
|
|
761
|
-
async createHbarPurchaseIntent(payload) {
|
|
762
|
-
return createHbarPurchaseIntent(this, payload);
|
|
763
|
-
}
|
|
764
|
-
async purchaseCreditsWithHbar(params) {
|
|
765
|
-
return purchaseCreditsWithHbar(this, params);
|
|
766
|
-
}
|
|
767
|
-
async getX402Minimums() {
|
|
768
|
-
return getX402Minimums(this);
|
|
769
|
-
}
|
|
770
|
-
async purchaseCreditsWithX402(params) {
|
|
771
|
-
return purchaseCreditsWithX402(this, params);
|
|
772
|
-
}
|
|
773
|
-
async buyCreditsWithX402(params) {
|
|
774
|
-
return buyCreditsWithX402(this, params);
|
|
775
|
-
}
|
|
776
|
-
async generateEncryptionKeyPair(options = {}) {
|
|
777
|
-
return generateEncryptionKeyPair(this, options);
|
|
778
|
-
}
|
|
779
|
-
async createLedgerChallenge(payload) {
|
|
780
|
-
return createLedgerChallenge(this, payload);
|
|
781
|
-
}
|
|
782
|
-
async verifyLedgerChallenge(payload) {
|
|
783
|
-
return verifyLedgerChallenge(this, payload);
|
|
784
|
-
}
|
|
785
|
-
async authenticateWithLedger(options) {
|
|
786
|
-
return authenticateWithLedger(this, options);
|
|
787
|
-
}
|
|
788
|
-
async authenticateWithLedgerCredentials(options) {
|
|
789
|
-
return authenticateWithLedgerCredentials(this, options);
|
|
790
|
-
}
|
|
791
|
-
async getVerificationStatus(uaid) {
|
|
792
|
-
return getVerificationStatus(this, uaid);
|
|
793
|
-
}
|
|
794
|
-
async createVerificationChallenge(uaid) {
|
|
795
|
-
return createVerificationChallenge(this, uaid);
|
|
796
|
-
}
|
|
797
|
-
async getVerificationChallenge(challengeId) {
|
|
798
|
-
return getVerificationChallenge(this, challengeId);
|
|
799
|
-
}
|
|
800
|
-
async verifyVerificationChallenge(params) {
|
|
801
|
-
return verifyVerificationChallenge(this, params);
|
|
802
|
-
}
|
|
803
|
-
async getVerificationOwnership(uaid) {
|
|
804
|
-
return getVerificationOwnership(this, uaid);
|
|
805
|
-
}
|
|
806
|
-
async verifySenderOwnership(uaid) {
|
|
807
|
-
return verifySenderOwnership(this, uaid);
|
|
808
|
-
}
|
|
809
|
-
async verifyUaidDnsTxt(payload) {
|
|
810
|
-
return verifyUaidDnsTxt(this, payload);
|
|
811
|
-
}
|
|
812
|
-
async getVerificationDnsStatus(uaid, query) {
|
|
813
|
-
return getVerificationDnsStatus(this, uaid, query);
|
|
814
|
-
}
|
|
815
|
-
async fetchHistorySnapshot(sessionId, options) {
|
|
816
|
-
return fetchHistorySnapshot(
|
|
817
|
-
this.conversationContexts,
|
|
818
|
-
this,
|
|
819
|
-
sessionId,
|
|
820
|
-
options
|
|
194
|
+
const requiredFields = ["name", "creator", "description", "type"];
|
|
195
|
+
const missingFields = requiredFields.filter(
|
|
196
|
+
(field) => !options.metadata || !options.metadata[field]
|
|
821
197
|
);
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
this.conversationContexts,
|
|
826
|
-
this,
|
|
827
|
-
sessionId,
|
|
828
|
-
snapshot,
|
|
829
|
-
options
|
|
830
|
-
);
|
|
831
|
-
}
|
|
832
|
-
registerConversationContextForEncryption(context) {
|
|
833
|
-
registerConversationContextForEncryption(
|
|
834
|
-
this.conversationContexts,
|
|
835
|
-
context
|
|
836
|
-
);
|
|
837
|
-
}
|
|
838
|
-
resolveDecryptionContext(sessionId, options) {
|
|
839
|
-
return resolveDecryptionContext(
|
|
840
|
-
this.conversationContexts,
|
|
841
|
-
this,
|
|
842
|
-
sessionId,
|
|
843
|
-
options
|
|
844
|
-
);
|
|
845
|
-
}
|
|
846
|
-
decryptHistoryEntryFromContext(_sessionId, entry, context) {
|
|
847
|
-
return decryptHistoryEntryFromContext(this, entry, context);
|
|
848
|
-
}
|
|
849
|
-
async createSession(payload, allowHistoryAutoTopUp = true) {
|
|
850
|
-
return createSession(this, payload, allowHistoryAutoTopUp);
|
|
851
|
-
}
|
|
852
|
-
async resumeSession(sessionId) {
|
|
853
|
-
return resumeSession(this, sessionId);
|
|
854
|
-
}
|
|
855
|
-
async checkChatReadiness(payload) {
|
|
856
|
-
return checkChatReadiness(this, payload);
|
|
857
|
-
}
|
|
858
|
-
async startChat(options) {
|
|
859
|
-
return startChat(this, this.getEncryptedChatManager(), options);
|
|
860
|
-
}
|
|
861
|
-
async startConversation(options) {
|
|
862
|
-
return startConversation(this, this.getEncryptedChatManager(), options);
|
|
863
|
-
}
|
|
864
|
-
async acceptConversation(options) {
|
|
865
|
-
return acceptConversation(
|
|
866
|
-
this,
|
|
867
|
-
this.getEncryptedChatManager(),
|
|
868
|
-
options
|
|
869
|
-
);
|
|
870
|
-
}
|
|
871
|
-
compactHistory(payload) {
|
|
872
|
-
return compactHistory(this, payload);
|
|
873
|
-
}
|
|
874
|
-
fetchEncryptionStatus(sessionId) {
|
|
875
|
-
return fetchEncryptionStatus(this, sessionId);
|
|
876
|
-
}
|
|
877
|
-
postEncryptionHandshake(sessionId, payload) {
|
|
878
|
-
return postEncryptionHandshake(this, sessionId, payload);
|
|
879
|
-
}
|
|
880
|
-
sendMessage(payload) {
|
|
881
|
-
return sendMessage(this, payload);
|
|
882
|
-
}
|
|
883
|
-
retryMessage(messageId, payload) {
|
|
884
|
-
return retryMessage(this, messageId, payload);
|
|
885
|
-
}
|
|
886
|
-
cancelSession(sessionId) {
|
|
887
|
-
return cancelSession(this, sessionId);
|
|
888
|
-
}
|
|
889
|
-
endSession(sessionId) {
|
|
890
|
-
return endSession(this, sessionId);
|
|
891
|
-
}
|
|
892
|
-
createPlaintextConversationHandle(sessionId, summary, defaultAuth, context) {
|
|
893
|
-
return createPlaintextConversationHandle(
|
|
894
|
-
this,
|
|
895
|
-
sessionId,
|
|
896
|
-
summary,
|
|
897
|
-
defaultAuth,
|
|
898
|
-
context
|
|
899
|
-
);
|
|
900
|
-
}
|
|
901
|
-
getEncryptedChatManager() {
|
|
902
|
-
if (this.encryptedChatManager) {
|
|
903
|
-
return this.encryptedChatManager;
|
|
904
|
-
}
|
|
905
|
-
const manager = new EncryptedChatManager(this);
|
|
906
|
-
this.encryptedChatManager = manager;
|
|
907
|
-
return manager;
|
|
908
|
-
}
|
|
909
|
-
async extractErrorBody(response) {
|
|
910
|
-
const contentType = response.headers?.get("content-type") ?? "";
|
|
911
|
-
if (JSON_CONTENT_TYPE.test(contentType)) {
|
|
912
|
-
try {
|
|
913
|
-
return await response.json();
|
|
914
|
-
} catch (error) {
|
|
915
|
-
return { parseError: String(error) };
|
|
916
|
-
}
|
|
917
|
-
}
|
|
918
|
-
try {
|
|
919
|
-
return await response.text();
|
|
920
|
-
} catch (error) {
|
|
921
|
-
return { parseError: String(error) };
|
|
922
|
-
}
|
|
923
|
-
}
|
|
924
|
-
parseWithSchema(value, schema, context) {
|
|
925
|
-
try {
|
|
926
|
-
return schema.parse(value);
|
|
927
|
-
} catch (error) {
|
|
928
|
-
throw new RegistryBrokerParseError(
|
|
929
|
-
`Failed to parse ${context}`,
|
|
930
|
-
error instanceof ZodError || error instanceof Error ? error : String(error),
|
|
931
|
-
value
|
|
198
|
+
if (missingFields.length > 0) {
|
|
199
|
+
throw new Error(
|
|
200
|
+
`Missing required Hashinal metadata fields: ${missingFields.join(", ")}`
|
|
932
201
|
);
|
|
933
202
|
}
|
|
934
203
|
}
|
|
935
|
-
async delay(ms, signal) {
|
|
936
|
-
if (ms <= 0) {
|
|
937
|
-
if (signal?.aborted) {
|
|
938
|
-
throw createAbortError();
|
|
939
|
-
}
|
|
940
|
-
return;
|
|
941
|
-
}
|
|
942
|
-
await new Promise((resolve, reject) => {
|
|
943
|
-
const timer = setTimeout(() => {
|
|
944
|
-
if (signal) {
|
|
945
|
-
signal.removeEventListener("abort", onAbort);
|
|
946
|
-
}
|
|
947
|
-
resolve();
|
|
948
|
-
}, ms);
|
|
949
|
-
const onAbort = () => {
|
|
950
|
-
clearTimeout(timer);
|
|
951
|
-
signal?.removeEventListener("abort", onAbort);
|
|
952
|
-
reject(createAbortError());
|
|
953
|
-
};
|
|
954
|
-
if (signal) {
|
|
955
|
-
if (signal.aborted) {
|
|
956
|
-
clearTimeout(timer);
|
|
957
|
-
reject(createAbortError());
|
|
958
|
-
return;
|
|
959
|
-
}
|
|
960
|
-
signal.addEventListener("abort", onAbort, { once: true });
|
|
961
|
-
}
|
|
962
|
-
});
|
|
963
|
-
}
|
|
964
|
-
assertNodeRuntime(feature) {
|
|
965
|
-
if (typeof process === "undefined" || !process.versions?.node) {
|
|
966
|
-
throw new Error(`${feature} is only available in Node.js environments`);
|
|
967
|
-
}
|
|
968
|
-
}
|
|
969
|
-
getNodeCrypto(feature) {
|
|
970
|
-
this.assertNodeRuntime(feature);
|
|
971
|
-
const nodeCrypto = optionalImportSync("node:crypto") ?? optionalImportSync("crypto");
|
|
972
|
-
if (!nodeCrypto) {
|
|
973
|
-
throw new Error(`${feature} requires the Node.js crypto module`);
|
|
974
|
-
}
|
|
975
|
-
return nodeCrypto;
|
|
976
|
-
}
|
|
977
|
-
getSecureRandomBytes(size, feature) {
|
|
978
|
-
const webCrypto = globalThis.crypto;
|
|
979
|
-
if (webCrypto && typeof webCrypto.getRandomValues === "function") {
|
|
980
|
-
const bytes = new Uint8Array(size);
|
|
981
|
-
webCrypto.getRandomValues(bytes);
|
|
982
|
-
return bytes;
|
|
983
|
-
}
|
|
984
|
-
return this.getNodeCrypto(feature).randomBytes(size);
|
|
985
|
-
}
|
|
986
|
-
createEphemeralKeyPair() {
|
|
987
|
-
const privateKeyBytes = this.getSecureRandomBytes(
|
|
988
|
-
32,
|
|
989
|
-
"generateEphemeralKeyPair"
|
|
990
|
-
);
|
|
991
|
-
const publicKey = secp256k1.getPublicKey(privateKeyBytes, true);
|
|
992
|
-
return {
|
|
993
|
-
privateKey: Buffer.from(privateKeyBytes).toString("hex"),
|
|
994
|
-
publicKey: Buffer.from(publicKey).toString("hex")
|
|
995
|
-
};
|
|
996
|
-
}
|
|
997
|
-
deriveSharedSecret(options) {
|
|
998
|
-
const { createHash } = this.getNodeCrypto("deriveSharedSecret");
|
|
999
|
-
const privateKey = this.hexToBuffer(options.privateKey);
|
|
1000
|
-
const peerPublicKey = this.hexToBuffer(options.peerPublicKey);
|
|
1001
|
-
const shared = secp256k1.getSharedSecret(privateKey, peerPublicKey, true);
|
|
1002
|
-
return createHash("sha256").update(Buffer.from(shared)).digest();
|
|
1003
|
-
}
|
|
1004
|
-
buildCipherEnvelope(options) {
|
|
1005
|
-
const { createCipheriv, randomBytes } = this.getNodeCrypto(
|
|
1006
|
-
"encryptCipherEnvelope"
|
|
1007
|
-
);
|
|
1008
|
-
const sharedSecret = this.normalizeSharedSecret(options.sharedSecret);
|
|
1009
|
-
const iv = randomBytes(12);
|
|
1010
|
-
const cipher = createCipheriv("aes-256-gcm", sharedSecret, iv);
|
|
1011
|
-
const aadSource = options.associatedData ?? options.sessionId;
|
|
1012
|
-
const associatedDataEncoded = aadSource ? Buffer.from(aadSource, "utf8").toString("base64") : void 0;
|
|
1013
|
-
if (aadSource) {
|
|
1014
|
-
cipher.setAAD(Buffer.from(aadSource, "utf8"));
|
|
1015
|
-
}
|
|
1016
|
-
const ciphertext = Buffer.concat([
|
|
1017
|
-
cipher.update(Buffer.from(options.plaintext, "utf8")),
|
|
1018
|
-
cipher.final()
|
|
1019
|
-
]);
|
|
1020
|
-
const tag = cipher.getAuthTag();
|
|
1021
|
-
const payload = Buffer.concat([ciphertext, tag]);
|
|
1022
|
-
return {
|
|
1023
|
-
algorithm: "aes-256-gcm",
|
|
1024
|
-
ciphertext: payload.toString("base64"),
|
|
1025
|
-
nonce: iv.toString("base64"),
|
|
1026
|
-
associatedData: associatedDataEncoded,
|
|
1027
|
-
keyLocator: {
|
|
1028
|
-
sessionId: options.sessionId,
|
|
1029
|
-
revision: options.revision ?? 1
|
|
1030
|
-
},
|
|
1031
|
-
recipients: options.recipients.map((recipient) => ({
|
|
1032
|
-
...recipient,
|
|
1033
|
-
encryptedShare: ""
|
|
1034
|
-
}))
|
|
1035
|
-
};
|
|
1036
|
-
}
|
|
1037
|
-
openCipherEnvelope(options) {
|
|
1038
|
-
const { createDecipheriv } = this.getNodeCrypto("decryptCipherEnvelope");
|
|
1039
|
-
const sharedSecret = this.normalizeSharedSecret(options.sharedSecret);
|
|
1040
|
-
const payload = Buffer.from(options.envelope.ciphertext, "base64");
|
|
1041
|
-
const nonce = Buffer.from(options.envelope.nonce, "base64");
|
|
1042
|
-
const ciphertext = payload.slice(0, payload.length - 16);
|
|
1043
|
-
const tag = payload.slice(payload.length - 16);
|
|
1044
|
-
const decipher = createDecipheriv("aes-256-gcm", sharedSecret, nonce);
|
|
1045
|
-
if (options.envelope.associatedData) {
|
|
1046
|
-
decipher.setAAD(Buffer.from(options.envelope.associatedData, "base64"));
|
|
1047
|
-
}
|
|
1048
|
-
decipher.setAuthTag(tag);
|
|
1049
|
-
const plaintext = Buffer.concat([
|
|
1050
|
-
decipher.update(ciphertext),
|
|
1051
|
-
decipher.final()
|
|
1052
|
-
]);
|
|
1053
|
-
return plaintext.toString(options.encoding ?? "utf8");
|
|
1054
|
-
}
|
|
1055
|
-
normalizeSharedSecret(input) {
|
|
1056
|
-
if (Buffer.isBuffer(input)) {
|
|
1057
|
-
return Buffer.from(input);
|
|
1058
|
-
}
|
|
1059
|
-
if (input instanceof Uint8Array) {
|
|
1060
|
-
return Buffer.from(input);
|
|
1061
|
-
}
|
|
1062
|
-
if (typeof input === "string") {
|
|
1063
|
-
return this.bufferFromString(input);
|
|
1064
|
-
}
|
|
1065
|
-
throw new Error("Unsupported shared secret input");
|
|
1066
|
-
}
|
|
1067
|
-
bufferFromString(value) {
|
|
1068
|
-
const trimmed = value.trim();
|
|
1069
|
-
if (!trimmed) {
|
|
1070
|
-
throw new Error("sharedSecret string cannot be empty");
|
|
1071
|
-
}
|
|
1072
|
-
const normalized = trimmed.startsWith("0x") ? trimmed.slice(2) : trimmed;
|
|
1073
|
-
if (/^[0-9a-fA-F]+$/.test(normalized) && normalized.length % 2 === 0) {
|
|
1074
|
-
return Buffer.from(normalized, "hex");
|
|
1075
|
-
}
|
|
1076
|
-
return Buffer.from(trimmed, "base64");
|
|
1077
|
-
}
|
|
1078
|
-
hexToBuffer(value) {
|
|
1079
|
-
const normalized = value.startsWith("0x") ? value.slice(2) : value;
|
|
1080
|
-
if (!/^[0-9a-fA-F]+$/.test(normalized) || normalized.length % 2 !== 0) {
|
|
1081
|
-
throw new Error("Expected hex-encoded value");
|
|
1082
|
-
}
|
|
1083
|
-
return Buffer.from(normalized, "hex");
|
|
1084
|
-
}
|
|
1085
|
-
extractInsufficientCreditsDetails(error) {
|
|
1086
|
-
if (!(error instanceof RegistryBrokerError) || error.status !== 402) {
|
|
1087
|
-
return null;
|
|
1088
|
-
}
|
|
1089
|
-
const body = error.body;
|
|
1090
|
-
if (!body || typeof body !== "object" || Array.isArray(body)) {
|
|
1091
|
-
return null;
|
|
1092
|
-
}
|
|
1093
|
-
const maybeShortfall = body["shortfallCredits"];
|
|
1094
|
-
if (typeof maybeShortfall !== "number" || maybeShortfall <= 0) {
|
|
1095
|
-
return null;
|
|
1096
|
-
}
|
|
1097
|
-
return { shortfallCredits: maybeShortfall };
|
|
1098
|
-
}
|
|
1099
|
-
extractErrorMessage(body) {
|
|
1100
|
-
if (typeof body === "string") {
|
|
1101
|
-
return body;
|
|
1102
|
-
}
|
|
1103
|
-
if (isJsonObject(body) && typeof body.error === "string") {
|
|
1104
|
-
return body.error;
|
|
1105
|
-
}
|
|
1106
|
-
if (isJsonObject(body) && typeof body.message === "string") {
|
|
1107
|
-
return body.message;
|
|
1108
|
-
}
|
|
1109
|
-
return void 0;
|
|
1110
|
-
}
|
|
1111
|
-
shouldAutoTopUpHistory(payload, error) {
|
|
1112
|
-
if (!this.historyAutoTopUp || payload.historyTtlSeconds === void 0) {
|
|
1113
|
-
return false;
|
|
1114
|
-
}
|
|
1115
|
-
if (!(error instanceof RegistryBrokerError)) {
|
|
1116
|
-
return false;
|
|
1117
|
-
}
|
|
1118
|
-
if (error.status !== 402) {
|
|
1119
|
-
return false;
|
|
1120
|
-
}
|
|
1121
|
-
const message = this.extractErrorMessage(error.body);
|
|
1122
|
-
if (!message) {
|
|
1123
|
-
return true;
|
|
1124
|
-
}
|
|
1125
|
-
const normalised = message.toLowerCase();
|
|
1126
|
-
return normalised.includes("history") || normalised.includes("chat history");
|
|
1127
|
-
}
|
|
1128
|
-
async executeHistoryAutoTopUp(reason) {
|
|
1129
|
-
if (!this.historyAutoTopUp) {
|
|
1130
|
-
return;
|
|
1131
|
-
}
|
|
1132
|
-
const hbarAmount = this.historyAutoTopUp.hbarAmount && this.historyAutoTopUp.hbarAmount > 0 ? this.historyAutoTopUp.hbarAmount : DEFAULT_HISTORY_TOP_UP_HBAR;
|
|
1133
|
-
await this.purchaseCreditsWithHbar({
|
|
1134
|
-
accountId: this.historyAutoTopUp.accountId,
|
|
1135
|
-
privateKey: this.historyAutoTopUp.privateKey,
|
|
1136
|
-
hbarAmount,
|
|
1137
|
-
memo: this.historyAutoTopUp.memo ?? "registry-broker-client:chat-history-topup",
|
|
1138
|
-
metadata: {
|
|
1139
|
-
purpose: "chat-history",
|
|
1140
|
-
reason
|
|
1141
|
-
}
|
|
1142
|
-
});
|
|
1143
|
-
}
|
|
1144
|
-
initializeEncryptionBootstrap(options) {
|
|
1145
|
-
return this.bootstrapEncryptionOptions(options).then(() => void 0);
|
|
1146
|
-
}
|
|
1147
|
-
bootstrapEncryptionOptions(options) {
|
|
1148
|
-
return bootstrapEncryptionOptions(this, options);
|
|
1149
|
-
}
|
|
1150
204
|
}
|
|
1151
|
-
const isPendingRegisterAgentResponse = (response) => response.status === "pending";
|
|
1152
|
-
const isPartialRegisterAgentResponse = (response) => response.status === "partial" && response.success === false;
|
|
1153
|
-
const isSuccessRegisterAgentResponse = (response) => response.success === true && response.status !== "pending";
|
|
1154
205
|
export {
|
|
1155
|
-
|
|
1156
|
-
|
|
1157
|
-
|
|
1158
|
-
|
|
206
|
+
cacheQuote,
|
|
207
|
+
getCachedQuote,
|
|
208
|
+
getOrCreateSDK,
|
|
209
|
+
validateQuoteParameters
|
|
1159
210
|
};
|
|
1160
211
|
//# sourceMappingURL=standards-sdk.es148.js.map
|