tenzro-sdk 0.1.0

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.
Files changed (151) hide show
  1. package/LICENSE +201 -0
  2. package/README.md +107 -0
  3. package/dist/agent-payments.d.ts +47 -0
  4. package/dist/agent-payments.d.ts.map +1 -0
  5. package/dist/agent-payments.js +76 -0
  6. package/dist/agent-payments.js.map +1 -0
  7. package/dist/agent.d.ts +177 -0
  8. package/dist/agent.d.ts.map +1 -0
  9. package/dist/agent.js +300 -0
  10. package/dist/agent.js.map +1 -0
  11. package/dist/ap2.d.ts +54 -0
  12. package/dist/ap2.d.ts.map +1 -0
  13. package/dist/ap2.js +88 -0
  14. package/dist/ap2.js.map +1 -0
  15. package/dist/app.d.ts +186 -0
  16. package/dist/app.d.ts.map +1 -0
  17. package/dist/app.js +317 -0
  18. package/dist/app.js.map +1 -0
  19. package/dist/bridge.d.ts +64 -0
  20. package/dist/bridge.d.ts.map +1 -0
  21. package/dist/bridge.js +93 -0
  22. package/dist/bridge.js.map +1 -0
  23. package/dist/canton.d.ts +36 -0
  24. package/dist/canton.d.ts.map +1 -0
  25. package/dist/canton.js +46 -0
  26. package/dist/canton.js.map +1 -0
  27. package/dist/circuit-breaker.d.ts +35 -0
  28. package/dist/circuit-breaker.d.ts.map +1 -0
  29. package/dist/circuit-breaker.js +53 -0
  30. package/dist/circuit-breaker.js.map +1 -0
  31. package/dist/client.d.ts +134 -0
  32. package/dist/client.d.ts.map +1 -0
  33. package/dist/client.js +265 -0
  34. package/dist/client.js.map +1 -0
  35. package/dist/compliance.d.ts +83 -0
  36. package/dist/compliance.d.ts.map +1 -0
  37. package/dist/compliance.js +74 -0
  38. package/dist/compliance.js.map +1 -0
  39. package/dist/config.d.ts +10 -0
  40. package/dist/config.d.ts.map +1 -0
  41. package/dist/config.js +24 -0
  42. package/dist/config.js.map +1 -0
  43. package/dist/contract.d.ts +68 -0
  44. package/dist/contract.d.ts.map +1 -0
  45. package/dist/contract.js +59 -0
  46. package/dist/contract.js.map +1 -0
  47. package/dist/crypto.d.ts +112 -0
  48. package/dist/crypto.d.ts.map +1 -0
  49. package/dist/crypto.js +97 -0
  50. package/dist/crypto.js.map +1 -0
  51. package/dist/custody.d.ts +114 -0
  52. package/dist/custody.d.ts.map +1 -0
  53. package/dist/custody.js +96 -0
  54. package/dist/custody.js.map +1 -0
  55. package/dist/debridge.d.ts +129 -0
  56. package/dist/debridge.d.ts.map +1 -0
  57. package/dist/debridge.js +93 -0
  58. package/dist/debridge.js.map +1 -0
  59. package/dist/erc7802.d.ts +36 -0
  60. package/dist/erc7802.d.ts.map +1 -0
  61. package/dist/erc7802.js +52 -0
  62. package/dist/erc7802.js.map +1 -0
  63. package/dist/events.d.ts +112 -0
  64. package/dist/events.d.ts.map +1 -0
  65. package/dist/events.js +70 -0
  66. package/dist/events.js.map +1 -0
  67. package/dist/governance.d.ts +55 -0
  68. package/dist/governance.d.ts.map +1 -0
  69. package/dist/governance.js +77 -0
  70. package/dist/governance.js.map +1 -0
  71. package/dist/identity.d.ts +102 -0
  72. package/dist/identity.d.ts.map +1 -0
  73. package/dist/identity.js +147 -0
  74. package/dist/identity.js.map +1 -0
  75. package/dist/index.d.ts +67 -0
  76. package/dist/index.d.ts.map +1 -0
  77. package/dist/index.js +85 -0
  78. package/dist/index.js.map +1 -0
  79. package/dist/inference.d.ts +27 -0
  80. package/dist/inference.d.ts.map +1 -0
  81. package/dist/inference.js +43 -0
  82. package/dist/inference.js.map +1 -0
  83. package/dist/marketplace.d.ts +44 -0
  84. package/dist/marketplace.d.ts.map +1 -0
  85. package/dist/marketplace.js +74 -0
  86. package/dist/marketplace.js.map +1 -0
  87. package/dist/nanopayment.d.ts +53 -0
  88. package/dist/nanopayment.d.ts.map +1 -0
  89. package/dist/nanopayment.js +81 -0
  90. package/dist/nanopayment.js.map +1 -0
  91. package/dist/nft.d.ts +127 -0
  92. package/dist/nft.d.ts.map +1 -0
  93. package/dist/nft.js +99 -0
  94. package/dist/nft.js.map +1 -0
  95. package/dist/payment.d.ts +71 -0
  96. package/dist/payment.d.ts.map +1 -0
  97. package/dist/payment.js +105 -0
  98. package/dist/payment.js.map +1 -0
  99. package/dist/provider.d.ts +351 -0
  100. package/dist/provider.d.ts.map +1 -0
  101. package/dist/provider.js +368 -0
  102. package/dist/provider.js.map +1 -0
  103. package/dist/rpc.d.ts +35 -0
  104. package/dist/rpc.d.ts.map +1 -0
  105. package/dist/rpc.js +127 -0
  106. package/dist/rpc.js.map +1 -0
  107. package/dist/settlement.d.ts +52 -0
  108. package/dist/settlement.d.ts.map +1 -0
  109. package/dist/settlement.js +86 -0
  110. package/dist/settlement.js.map +1 -0
  111. package/dist/skill.d.ts +55 -0
  112. package/dist/skill.d.ts.map +1 -0
  113. package/dist/skill.js +79 -0
  114. package/dist/skill.js.map +1 -0
  115. package/dist/staking.d.ts +42 -0
  116. package/dist/staking.d.ts.map +1 -0
  117. package/dist/staking.js +62 -0
  118. package/dist/staking.js.map +1 -0
  119. package/dist/streaming.d.ts +83 -0
  120. package/dist/streaming.d.ts.map +1 -0
  121. package/dist/streaming.js +193 -0
  122. package/dist/streaming.js.map +1 -0
  123. package/dist/task.d.ts +46 -0
  124. package/dist/task.d.ts.map +1 -0
  125. package/dist/task.js +76 -0
  126. package/dist/task.js.map +1 -0
  127. package/dist/tee.d.ts +88 -0
  128. package/dist/tee.d.ts.map +1 -0
  129. package/dist/tee.js +62 -0
  130. package/dist/tee.js.map +1 -0
  131. package/dist/token.d.ts +165 -0
  132. package/dist/token.d.ts.map +1 -0
  133. package/dist/token.js +80 -0
  134. package/dist/token.js.map +1 -0
  135. package/dist/tool.d.ts +55 -0
  136. package/dist/tool.d.ts.map +1 -0
  137. package/dist/tool.js +79 -0
  138. package/dist/tool.js.map +1 -0
  139. package/dist/types.d.ts +1318 -0
  140. package/dist/types.d.ts.map +1 -0
  141. package/dist/types.js +117 -0
  142. package/dist/types.js.map +1 -0
  143. package/dist/wallet.d.ts +44 -0
  144. package/dist/wallet.d.ts.map +1 -0
  145. package/dist/wallet.js +75 -0
  146. package/dist/wallet.js.map +1 -0
  147. package/dist/zk.d.ts +66 -0
  148. package/dist/zk.d.ts.map +1 -0
  149. package/dist/zk.js +58 -0
  150. package/dist/zk.js.map +1 -0
  151. package/package.json +41 -0
package/LICENSE ADDED
@@ -0,0 +1,201 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship, whether in Source or
36
+ Object form, made available under the License, as indicated by a
37
+ copyright notice that is included in or attached to the work
38
+ (an example is provided in the Appendix below).
39
+
40
+ "Derivative Works" shall mean any work, whether in Source or Object
41
+ form, that is based on (or derived from) the Work and for which the
42
+ editorial revisions, annotations, elaborations, or other modifications
43
+ represent, as a whole, an original work of authorship. For the purposes
44
+ of this License, Derivative Works shall not include works that remain
45
+ separable from, or merely link (or bind by name) to the interfaces of,
46
+ the Work and Derivative Works thereof.
47
+
48
+ "Contribution" shall mean any work of authorship, including
49
+ the original version of the Work and any modifications or additions
50
+ to that Work or Derivative Works thereof, that is intentionally
51
+ submitted to Licensor for inclusion in the Work by the copyright owner
52
+ or by an individual or Legal Entity authorized to submit on behalf of
53
+ the copyright owner. For the purposes of this definition, "submitted"
54
+ means any form of electronic, verbal, or written communication sent
55
+ to the Licensor or its representatives, including but not limited to
56
+ communication on electronic mailing lists, source code control systems,
57
+ and issue tracking systems that are managed by, or on behalf of, the
58
+ Licensor for the purpose of discussing and improving the Work, but
59
+ excluding communication that is conspicuously marked or otherwise
60
+ designated in writing by the copyright owner as "Not a Contribution."
61
+
62
+ "Contributor" shall mean Licensor and any individual or Legal Entity
63
+ on behalf of whom a Contribution has been received by Licensor and
64
+ subsequently incorporated within the Work.
65
+
66
+ 2. Grant of Copyright License. Subject to the terms and conditions of
67
+ this License, each Contributor hereby grants to You a perpetual,
68
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
+ copyright license to reproduce, prepare Derivative Works of,
70
+ publicly display, publicly perform, sublicense, and distribute the
71
+ Work and such Derivative Works in Source or Object form.
72
+
73
+ 3. Grant of Patent License. Subject to the terms and conditions of
74
+ this License, each Contributor hereby grants to You a perpetual,
75
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
+ (except as stated in this section) patent license to make, have made,
77
+ use, offer to sell, sell, import, and otherwise transfer the Work,
78
+ where such license applies only to those patent claims licensable
79
+ by such Contributor that are necessarily infringed by their
80
+ Contribution(s) alone or by combination of their Contribution(s)
81
+ with the Work to which such Contribution(s) was submitted. If You
82
+ institute patent litigation against any entity (including a
83
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
84
+ or a Contribution incorporated within the Work constitutes direct
85
+ or contributory patent infringement, then any patent licenses
86
+ granted to You under this License for that Work shall terminate
87
+ as of the date such litigation is filed.
88
+
89
+ 4. Redistribution. You may reproduce and distribute copies of the
90
+ Work or Derivative Works thereof in any medium, with or without
91
+ modifications, and in Source or Object form, provided that You
92
+ meet the following conditions:
93
+
94
+ (a) You must give any other recipients of the Work or
95
+ Derivative Works a copy of this License; and
96
+
97
+ (b) You must cause any modified files to carry prominent notices
98
+ stating that You changed the files; and
99
+
100
+ (c) You must retain, in the Source form of any Derivative Works
101
+ that You distribute, all copyright, patent, trademark, and
102
+ attribution notices from the Source form of the Work,
103
+ excluding those notices that do not pertain to any part of
104
+ the Derivative Works; and
105
+
106
+ (d) If the Work includes a "NOTICE" text file as part of its
107
+ distribution, then any Derivative Works that You distribute must
108
+ include a readable copy of the attribution notices contained
109
+ within such NOTICE file, excluding those notices that do not
110
+ pertain to any part of the Derivative Works, in at least one
111
+ of the following places: within a NOTICE text file distributed
112
+ as part of the Derivative Works; within the Source form or
113
+ documentation, if provided along with the Derivative Works; or,
114
+ within a display generated by the Derivative Works, if and
115
+ wherever such third-party notices normally appear. The contents
116
+ of the NOTICE file are for informational purposes only and
117
+ do not modify the License. You may add Your own attribution
118
+ notices within Derivative Works that You distribute, alongside
119
+ or as an addendum to the NOTICE text from the Work, provided
120
+ that such additional attribution notices cannot be construed
121
+ as modifying the License.
122
+
123
+ You may add Your own copyright statement to Your modifications and
124
+ may provide additional or different license terms and conditions
125
+ for use, reproduction, or distribution of Your modifications, or
126
+ for any such Derivative Works as a whole, provided Your use,
127
+ reproduction, and distribution of the Work otherwise complies with
128
+ the conditions stated in this License.
129
+
130
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
131
+ any Contribution intentionally submitted for inclusion in the Work
132
+ by You to the Licensor shall be under the terms and conditions of
133
+ this License, without any additional terms or conditions.
134
+ Notwithstanding the above, nothing herein shall supersede or modify
135
+ the terms of any separate license agreement you may have executed
136
+ with Licensor regarding such Contributions.
137
+
138
+ 6. Trademarks. This License does not grant permission to use the trade
139
+ names, trademarks, service marks, or product names of the Licensor,
140
+ except as required for reasonable and customary use in describing the
141
+ origin of the Work and reproducing the content of the NOTICE file.
142
+
143
+ 7. Disclaimer of Warranty. Unless required by applicable law or
144
+ agreed to in writing, Licensor provides the Work (and each
145
+ Contributor provides its Contributions) on an "AS IS" BASIS,
146
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
+ implied, including, without limitation, any warranties or conditions
148
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
+ PARTICULAR PURPOSE. You are solely responsible for determining the
150
+ appropriateness of using or redistributing the Work and assume any
151
+ risks associated with Your exercise of permissions under this License.
152
+
153
+ 8. Limitation of Liability. In no event and under no legal theory,
154
+ whether in tort (including negligence), contract, or otherwise,
155
+ unless required by applicable law (such as deliberate and grossly
156
+ negligent acts) or agreed to in writing, shall any Contributor be
157
+ liable to You for damages, including any direct, indirect, special,
158
+ incidental, or consequential damages of any character arising as a
159
+ result of this License or out of the use or inability to use the
160
+ Work (including but not limited to damages for loss of goodwill,
161
+ work stoppage, computer failure or malfunction, or any and all
162
+ other commercial damages or losses), even if such Contributor
163
+ has been advised of the possibility of such damages.
164
+
165
+ 9. Accepting Warranty or Additional Liability. While redistributing
166
+ the Work or Derivative Works thereof, You may choose to offer,
167
+ and charge a fee for, acceptance of support, warranty, indemnity,
168
+ or other liability obligations and/or rights consistent with this
169
+ License. However, in accepting such obligations, You may act only
170
+ on Your own behalf and on Your sole responsibility, not on behalf
171
+ of any other Contributor, and only if You agree to indemnify,
172
+ defend, and hold each Contributor harmless for any liability
173
+ incurred by, or claims asserted against, such Contributor by reason
174
+ of your accepting any such warranty or additional liability.
175
+
176
+ END OF TERMS AND CONDITIONS
177
+
178
+ APPENDIX: How to apply the Apache License to your work.
179
+
180
+ To apply the Apache License to your work, attach the following
181
+ boilerplate notice, with the fields enclosed by brackets "[]"
182
+ replaced with your own identifying information. (Don't include
183
+ the brackets!) The text should be enclosed in the appropriate
184
+ comment syntax for the file format. We also recommend that a
185
+ file or class name and description of purpose be included on the
186
+ same "printed page" as the copyright notice for easier
187
+ identification within third-party archives.
188
+
189
+ Copyright [yyyy] [name of copyright owner]
190
+
191
+ Licensed under the Apache License, Version 2.0 (the "License");
192
+ you may not use this file except in compliance with the License.
193
+ You may obtain a copy of the License at
194
+
195
+ http://www.apache.org/licenses/LICENSE-2.0
196
+
197
+ Unless required by applicable law or agreed to in writing, software
198
+ distributed under the License is distributed on an "AS IS" BASIS,
199
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200
+ See the License for the specific language governing permissions and
201
+ limitations under the License.
package/README.md ADDED
@@ -0,0 +1,107 @@
1
+ # Tenzro SDK for TypeScript
2
+
3
+ [![npm](https://img.shields.io/npm/v/tenzro-sdk)](https://www.npmjs.com/package/tenzro-sdk)
4
+ [![License](https://img.shields.io/badge/license-Apache--2.0-green)](LICENSE)
5
+ [![Docs](https://img.shields.io/badge/docs-tenzro.com-blue)](https://tenzro.com/docs/typescript-sdk)
6
+
7
+ The official TypeScript/JavaScript SDK for [Tenzro Network](https://tenzro.com) -- build AI-native applications with wallets, identity, agents, inference, cross-chain bridge, crypto, TEE, ZK proofs, and settlement.
8
+
9
+ ## Installation
10
+
11
+ ```bash
12
+ npm install tenzro-sdk
13
+ ```
14
+
15
+ ## Quick Start
16
+
17
+ ```typescript
18
+ import { TenzroClient, TESTNET_CONFIG } from 'tenzro-sdk';
19
+
20
+ const client = new TenzroClient(TESTNET_CONFIG);
21
+
22
+ // Create wallet
23
+ const wallet = await client.wallet.createWallet();
24
+ console.log('Address:', wallet.address);
25
+
26
+ // Register identity
27
+ const identity = await client.identity.registerHuman('Alice');
28
+ console.log('DID:', identity.did);
29
+
30
+ // List AI models
31
+ const models = await client.inference.listModels();
32
+ console.log(`${models.length} models available`);
33
+
34
+ // Run inference
35
+ const result = await client.inference.request('gemma3-270m', 'Hello!', 100);
36
+ console.log(result.output);
37
+ ```
38
+
39
+ ## AppClient (Developer Pattern)
40
+
41
+ ```typescript
42
+ import { AppClient } from 'tenzro-sdk';
43
+
44
+ // Developer funds a master wallet, users never see gas
45
+ const app = await AppClient.create('https://rpc.tenzro.network', process.env.MASTER_KEY!);
46
+
47
+ // Create user wallet (funded from master)
48
+ const user = await app.createUserWallet('alice', 1000000000000000000n);
49
+
50
+ // Sponsor inference (master pays)
51
+ const result = await app.sponsorInference(user.address, 'gemma3-270m', 'Hello');
52
+ ```
53
+
54
+ ## Modules
55
+
56
+ | Module | Key Methods |
57
+ |--------|------------|
58
+ | `wallet` | `createWallet()`, `getBalance()`, `sendTransaction()` |
59
+ | `identity` | `registerHuman()`, `resolveDid()`, `setUsername()` |
60
+ | `agent` | `register()`, `spawnAgent()`, `createSwarm()`, `delegateTask()` |
61
+ | `inference` | `listModels()`, `request()`, `estimateCost()` |
62
+ | `token` | `createToken()`, `listTokens()`, `crossVmTransfer()` |
63
+ | `nft` | `createCollection()`, `mintNft()`, `transferNft()` |
64
+ | `bridge` | `bridgeTokens()`, `getRoutes()`, `getBridgeStatus()` |
65
+ | `settlement` | `createEscrow()`, `releaseEscrow()`, `openPaymentChannel()` |
66
+ | `payment` | `createChallenge()`, `payMpp()`, `payX402()` |
67
+ | `compliance` | `registerCompliance()`, `checkCompliance()`, `freezeAddress()` |
68
+ | `crypto` | `signMessage()`, `encrypt()`, `decrypt()`, `hashSha256()` |
69
+ | `tee` | `detectTee()`, `getAttestation()`, `sealData()` |
70
+ | `zk` | `createProof()`, `verifyProof()`, `listCircuits()` |
71
+ | `custody` | `createMpcWallet()`, `exportKeystore()`, `authorizeSession()` |
72
+ | `streaming` | `chatStream()`, `subscribeEvents()` |
73
+ | `app` | `AppClient` -- master wallet, paymaster, user management |
74
+ | `governance` | `listProposals()`, `vote()`, `getVotingPower()` |
75
+ | `staking` | `stake()`, `unstake()`, `getRewards()` |
76
+ | `task` | `postTask()`, `listTasks()`, `completeTask()` |
77
+ | `marketplace` | `registerAgentTemplate()`, `spawnAgentFromTemplate()` |
78
+ | `contract` | `deployContract()`, `callContract()`, `encodeFunction()` |
79
+ | `debridge` | `searchTokens()`, `getChains()`, `createTx()` |
80
+ | `events` | `getEvents()`, `subscribeEvents()`, `registerWebhook()` |
81
+ | `canton` | `listDomains()`, `submitCommand()` |
82
+ | `skill` | `listSkills()`, `registerSkill()` |
83
+ | `tool` | `listTools()`, `registerTool()` |
84
+
85
+ ## Live Testnet
86
+
87
+ | Endpoint | URL |
88
+ |----------|-----|
89
+ | JSON-RPC | `https://rpc.tenzro.network` |
90
+ | MCP Server | `https://mcp.tenzro.network/mcp` |
91
+ | A2A Server | `https://a2a.tenzro.network` |
92
+
93
+ ## Documentation
94
+
95
+ - [TypeScript SDK Reference](https://tenzro.com/docs/typescript-sdk)
96
+ - [Tutorials](https://tenzro.com/tutorials)
97
+ - [Cookbook](https://github.com/tenzro/tenzro-cookbook)
98
+
99
+ ## Contact
100
+
101
+ - Website: [tenzro.com](https://tenzro.com)
102
+ - Engineering: [eng@tenzro.com](mailto:eng@tenzro.com)
103
+ - GitHub: [github.com/tenzro](https://github.com/tenzro)
104
+
105
+ ## License
106
+
107
+ Apache 2.0. See [LICENSE](LICENSE).
@@ -0,0 +1,47 @@
1
+ import type { RpcClient } from './rpc';
2
+ import type { SpendingPolicy, PolicyResult, AgentPaymentReceipt, DailySpend, AgentTransaction } from './types';
3
+ /**
4
+ * Client for agent transaction execution and spending policy management.
5
+ * Allows agents to make payments for services within configurable spending limits.
6
+ */
7
+ export declare class AgentPaymentClient {
8
+ private readonly rpc;
9
+ constructor(rpc: RpcClient);
10
+ /**
11
+ * Set a spending policy for an agent.
12
+ * @param agentDid - The agent's DID
13
+ * @param policy - Spending policy configuration
14
+ * @returns Policy update result
15
+ */
16
+ setSpendingPolicy(agentDid: string, policy: Omit<SpendingPolicy, 'agent_did'>): Promise<PolicyResult>;
17
+ /**
18
+ * Get the current spending policy for an agent.
19
+ * @param agentDid - The agent's DID
20
+ * @returns Current spending policy
21
+ */
22
+ getSpendingPolicy(agentDid: string): Promise<SpendingPolicy>;
23
+ /**
24
+ * Pay for a service on behalf of an agent.
25
+ * The payment is validated against the agent's spending policy.
26
+ * @param agentDid - The agent's DID
27
+ * @param provider - Provider address to pay
28
+ * @param amount - Payment amount (decimal string)
29
+ * @param serviceType - Type of service being paid for
30
+ * @returns Payment receipt
31
+ */
32
+ payForService(agentDid: string, provider: string, amount: string, serviceType: string): Promise<AgentPaymentReceipt>;
33
+ /**
34
+ * Get the daily spend summary for an agent.
35
+ * @param agentDid - The agent's DID
36
+ * @returns Daily spend summary with limits and remaining allowance
37
+ */
38
+ getDailySpend(agentDid: string): Promise<DailySpend>;
39
+ /**
40
+ * List recent transactions for an agent.
41
+ * @param agentDid - The agent's DID
42
+ * @param limit - Optional maximum number of transactions to return
43
+ * @returns Array of agent transactions
44
+ */
45
+ listAgentTransactions(agentDid: string, limit?: number): Promise<AgentTransaction[]>;
46
+ }
47
+ //# sourceMappingURL=agent-payments.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"agent-payments.d.ts","sourceRoot":"","sources":["../src/agent-payments.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AACvC,OAAO,KAAK,EACV,cAAc,EACd,YAAY,EACZ,mBAAmB,EACnB,UAAU,EACV,gBAAgB,EACjB,MAAM,SAAS,CAAC;AAEjB;;;GAGG;AACH,qBAAa,kBAAkB;IACjB,OAAO,CAAC,QAAQ,CAAC,GAAG;gBAAH,GAAG,EAAE,SAAS;IAE3C;;;;;OAKG;IACG,iBAAiB,CACrB,QAAQ,EAAE,MAAM,EAChB,MAAM,EAAE,IAAI,CAAC,cAAc,EAAE,WAAW,CAAC,GACxC,OAAO,CAAC,YAAY,CAAC;IAMxB;;;;OAIG;IACG,iBAAiB,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,cAAc,CAAC;IAMlE;;;;;;;;OAQG;IACG,aAAa,CACjB,QAAQ,EAAE,MAAM,EAChB,QAAQ,EAAE,MAAM,EAChB,MAAM,EAAE,MAAM,EACd,WAAW,EAAE,MAAM,GAClB,OAAO,CAAC,mBAAmB,CAAC;IAW/B;;;;OAIG;IACG,aAAa,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,UAAU,CAAC;IAM1D;;;;;OAKG;IACG,qBAAqB,CACzB,QAAQ,EAAE,MAAM,EAChB,KAAK,CAAC,EAAE,MAAM,GACb,OAAO,CAAC,gBAAgB,EAAE,CAAC;CAK/B"}
@@ -0,0 +1,76 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.AgentPaymentClient = void 0;
4
+ /**
5
+ * Client for agent transaction execution and spending policy management.
6
+ * Allows agents to make payments for services within configurable spending limits.
7
+ */
8
+ class AgentPaymentClient {
9
+ rpc;
10
+ constructor(rpc) {
11
+ this.rpc = rpc;
12
+ }
13
+ /**
14
+ * Set a spending policy for an agent.
15
+ * @param agentDid - The agent's DID
16
+ * @param policy - Spending policy configuration
17
+ * @returns Policy update result
18
+ */
19
+ async setSpendingPolicy(agentDid, policy) {
20
+ return this.rpc.call('tenzro_setSpendingPolicy', [
21
+ { agent_did: agentDid, ...policy },
22
+ ]);
23
+ }
24
+ /**
25
+ * Get the current spending policy for an agent.
26
+ * @param agentDid - The agent's DID
27
+ * @returns Current spending policy
28
+ */
29
+ async getSpendingPolicy(agentDid) {
30
+ return this.rpc.call('tenzro_getSpendingPolicy', [
31
+ { agent_did: agentDid },
32
+ ]);
33
+ }
34
+ /**
35
+ * Pay for a service on behalf of an agent.
36
+ * The payment is validated against the agent's spending policy.
37
+ * @param agentDid - The agent's DID
38
+ * @param provider - Provider address to pay
39
+ * @param amount - Payment amount (decimal string)
40
+ * @param serviceType - Type of service being paid for
41
+ * @returns Payment receipt
42
+ */
43
+ async payForService(agentDid, provider, amount, serviceType) {
44
+ return this.rpc.call('tenzro_agentPayForService', [
45
+ {
46
+ agent_did: agentDid,
47
+ provider,
48
+ amount,
49
+ service_type: serviceType,
50
+ },
51
+ ]);
52
+ }
53
+ /**
54
+ * Get the daily spend summary for an agent.
55
+ * @param agentDid - The agent's DID
56
+ * @returns Daily spend summary with limits and remaining allowance
57
+ */
58
+ async getDailySpend(agentDid) {
59
+ return this.rpc.call('tenzro_getAgentDailySpend', [
60
+ { agent_did: agentDid },
61
+ ]);
62
+ }
63
+ /**
64
+ * List recent transactions for an agent.
65
+ * @param agentDid - The agent's DID
66
+ * @param limit - Optional maximum number of transactions to return
67
+ * @returns Array of agent transactions
68
+ */
69
+ async listAgentTransactions(agentDid, limit) {
70
+ return this.rpc.call('tenzro_listAgentTransactions', [
71
+ { agent_did: agentDid, limit },
72
+ ]);
73
+ }
74
+ }
75
+ exports.AgentPaymentClient = AgentPaymentClient;
76
+ //# sourceMappingURL=agent-payments.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"agent-payments.js","sourceRoot":"","sources":["../src/agent-payments.ts"],"names":[],"mappings":";;;AASA;;;GAGG;AACH,MAAa,kBAAkB;IACA;IAA7B,YAA6B,GAAc;QAAd,QAAG,GAAH,GAAG,CAAW;IAAG,CAAC;IAE/C;;;;;OAKG;IACH,KAAK,CAAC,iBAAiB,CACrB,QAAgB,EAChB,MAAyC;QAEzC,OAAO,IAAI,CAAC,GAAG,CAAC,IAAI,CAAe,0BAA0B,EAAE;YAC7D,EAAE,SAAS,EAAE,QAAQ,EAAE,GAAG,MAAM,EAAE;SACnC,CAAC,CAAC;IACL,CAAC;IAED;;;;OAIG;IACH,KAAK,CAAC,iBAAiB,CAAC,QAAgB;QACtC,OAAO,IAAI,CAAC,GAAG,CAAC,IAAI,CAAiB,0BAA0B,EAAE;YAC/D,EAAE,SAAS,EAAE,QAAQ,EAAE;SACxB,CAAC,CAAC;IACL,CAAC;IAED;;;;;;;;OAQG;IACH,KAAK,CAAC,aAAa,CACjB,QAAgB,EAChB,QAAgB,EAChB,MAAc,EACd,WAAmB;QAEnB,OAAO,IAAI,CAAC,GAAG,CAAC,IAAI,CAAsB,2BAA2B,EAAE;YACrE;gBACE,SAAS,EAAE,QAAQ;gBACnB,QAAQ;gBACR,MAAM;gBACN,YAAY,EAAE,WAAW;aAC1B;SACF,CAAC,CAAC;IACL,CAAC;IAED;;;;OAIG;IACH,KAAK,CAAC,aAAa,CAAC,QAAgB;QAClC,OAAO,IAAI,CAAC,GAAG,CAAC,IAAI,CAAa,2BAA2B,EAAE;YAC5D,EAAE,SAAS,EAAE,QAAQ,EAAE;SACxB,CAAC,CAAC;IACL,CAAC;IAED;;;;;OAKG;IACH,KAAK,CAAC,qBAAqB,CACzB,QAAgB,EAChB,KAAc;QAEd,OAAO,IAAI,CAAC,GAAG,CAAC,IAAI,CAAqB,8BAA8B,EAAE;YACvE,EAAE,SAAS,EAAE,QAAQ,EAAE,KAAK,EAAE;SAC/B,CAAC,CAAC;IACL,CAAC;CACF;AA/ED,gDA+EC"}
@@ -0,0 +1,177 @@
1
+ import { RpcClient } from "./rpc";
2
+ import { AgentIdentity, AgentTemplate, RegisterAgentResponse, AgentMessageResponse, DelegateTaskResponse, SpawnAgentResponse, SpawnAgentTemplateResponse, RunAgentTemplateReport, RunAgentTaskResponse, CreateSwarmResponse, SwarmStatus, TerminateSwarmResponse, UpdateAgentTemplateParams, GasPolicy } from "./types";
3
+ /**
4
+ * Client for AI agent operations.
5
+ * Supports agent registration, messaging, and task delegation.
6
+ */
7
+ export declare class AgentClient {
8
+ private rpc;
9
+ constructor(rpc: RpcClient);
10
+ /**
11
+ * Register a new AI agent on the network.
12
+ * @param agentId - Unique identifier for the agent
13
+ * @param name - Human-readable name
14
+ * @param capabilities - List of agent capabilities
15
+ * @returns Registration response with agent ID and status
16
+ */
17
+ register(agentId: string, name: string, capabilities: string[]): Promise<RegisterAgentResponse>;
18
+ /**
19
+ * Send a message to another agent.
20
+ * @param agentId - Target agent identifier
21
+ * @param message - Message content
22
+ * @returns Message response with payload and message ID
23
+ */
24
+ sendMessage(agentId: string, message: string): Promise<AgentMessageResponse>;
25
+ /**
26
+ * Delegate a task to an agent using the A2A protocol.
27
+ * @param agentId - Target agent identifier
28
+ * @param taskDescription - Description of the task to delegate
29
+ * @returns Task delegation response with ID and status
30
+ */
31
+ delegateTask(agentId: string, taskDescription: string): Promise<DelegateTaskResponse>;
32
+ /**
33
+ * List all registered agents on the network.
34
+ * @returns Array of agent identities
35
+ */
36
+ listAgents(): Promise<AgentIdentity[]>;
37
+ /**
38
+ * Spawn a child agent under a parent agent.
39
+ * @param parentId - The parent agent's ID
40
+ * @param name - Name for the new child agent
41
+ * @param capabilities - List of capability strings for the child agent
42
+ * @returns Spawned agent info with agent_id, parent_id, and name
43
+ */
44
+ spawnAgent(parentId: string, name: string, capabilities: string[]): Promise<SpawnAgentResponse>;
45
+ /**
46
+ * Run an agentic task loop for an agent.
47
+ * The agent calls an LLM with built-in tools (spawn_agent, delegate_task,
48
+ * collect_results, complete) and executes them iteratively until done.
49
+ * @param agentId - The agent that will execute the task
50
+ * @param task - Task description
51
+ * @param inferenceUrl - Optional URL of the inference endpoint (default: localhost)
52
+ * @returns Final task result
53
+ */
54
+ runAgentTask(agentId: string, task: string, inferenceUrl?: string): Promise<RunAgentTaskResponse>;
55
+ /**
56
+ * Create a swarm of member agents under an orchestrator.
57
+ * @param orchestratorId - The orchestrator agent's ID
58
+ * @param members - Array of member specs (name + capabilities)
59
+ * @param options - Optional swarm configuration
60
+ * @returns Swarm ID and orchestrator ID
61
+ */
62
+ createSwarm(orchestratorId: string, members: Array<{
63
+ name: string;
64
+ capabilities: string[];
65
+ }>, options?: {
66
+ max_members?: number;
67
+ task_timeout_secs?: number;
68
+ parallel?: boolean;
69
+ }): Promise<CreateSwarmResponse>;
70
+ /**
71
+ * Get the current status of a swarm.
72
+ * @param swarmId - The swarm's ID
73
+ * @returns Swarm status including member statuses
74
+ */
75
+ getSwarmStatus(swarmId: string): Promise<SwarmStatus>;
76
+ /**
77
+ * Terminate a swarm and all its member agents.
78
+ * @param swarmId - The swarm's ID
79
+ * @returns Confirmation with swarm_id and status "terminated"
80
+ */
81
+ terminateSwarm(swarmId: string): Promise<TerminateSwarmResponse>;
82
+ /**
83
+ * Spawn a new agent from a registered template.
84
+ * @param templateId - The template to instantiate
85
+ * @param displayName - Optional human-readable name for the spawned agent
86
+ * @param context - Optional key-value context passed to the agent at boot
87
+ * @returns Spawned agent info with agent_id, template_id, name, and status
88
+ */
89
+ spawnAgentTemplate(templateId: string, displayName?: string, context?: Record<string, string>): Promise<SpawnAgentTemplateResponse>;
90
+ /**
91
+ * Run an already-spawned template agent through its task loop.
92
+ * @param agentId - The agent to run
93
+ * @param maxIterations - Optional cap on loop iterations (default: server-side default)
94
+ * @param dryRun - If true, simulate execution without side effects
95
+ * @returns Execution report with iterations, status, result, and duration
96
+ */
97
+ runAgentTemplate(agentId: string, maxIterations?: number, dryRun?: boolean): Promise<RunAgentTemplateReport>;
98
+ /**
99
+ * Download a template's full definition for offline inspection or forking.
100
+ * @param templateId - The template to download
101
+ * @returns Full agent template
102
+ */
103
+ downloadAgentTemplate(templateId: string): Promise<AgentTemplate>;
104
+ /**
105
+ * Update a registered agent template (must be the creator).
106
+ * @param templateId - The template to update
107
+ * @param params - Fields to update (partial — only provided fields are changed)
108
+ * @returns Updated agent template
109
+ */
110
+ updateAgentTemplate(templateId: string, params: UpdateAgentTemplateParams): Promise<AgentTemplate>;
111
+ /**
112
+ * Discover available models with optional filters.
113
+ * @param options - Optional filters: modality, servingOnly, query
114
+ * @returns Array of discovered models
115
+ */
116
+ discoverModels(options?: {
117
+ modality?: string;
118
+ servingOnly?: boolean;
119
+ query?: string;
120
+ }): Promise<any>;
121
+ /**
122
+ * Discover available agents with optional capability filter.
123
+ * @param capability - Optional capability to filter by
124
+ * @returns Array of discovered agents
125
+ */
126
+ discoverAgents(capability?: string): Promise<any>;
127
+ /**
128
+ * Spawn an agent with a specific skill attached.
129
+ * @param parentId - The parent agent's ID
130
+ * @param name - Name for the new agent
131
+ * @param skillId - Skill to attach to the agent
132
+ * @param capabilities - Optional list of capabilities
133
+ * @returns Spawned agent info
134
+ */
135
+ spawnAgentWithSkill(parentId: string, name: string, skillId: string, capabilities?: string[]): Promise<any>;
136
+ /**
137
+ * Fund an agent's wallet.
138
+ * @param agentId - The agent to fund
139
+ * @param fromAddress - Source address for the funds
140
+ * @param amountTnzo - Amount of TNZO to transfer
141
+ * @returns Funding result
142
+ */
143
+ fundAgent(agentId: string, fromAddress: string, amountTnzo: number): Promise<any>;
144
+ /**
145
+ * Swap tokens for an agent.
146
+ * @param agentId - The agent performing the swap
147
+ * @param fromToken - Source token identifier
148
+ * @param toToken - Destination token identifier
149
+ * @param amount - Amount to swap
150
+ * @param chain - Optional chain for the swap
151
+ * @returns Swap result
152
+ */
153
+ swapToken(agentId: string, fromToken: string, toToken: string, amount: string, chain?: string): Promise<any>;
154
+ /**
155
+ * Run the full agent payment pipeline for inference.
156
+ * @param agentId - The agent paying for inference
157
+ * @param modelId - The model to use
158
+ * @param prompt - The prompt to send
159
+ * @param maxTokens - Optional max tokens for the response
160
+ * @returns Inference result with payment details
161
+ */
162
+ agentPayForInference(agentId: string, modelId: string, prompt: string, maxTokens?: number): Promise<any>;
163
+ /**
164
+ * Set the gas policy for an agent's on-chain operations.
165
+ * @param agentId - The agent identifier
166
+ * @param policy - Gas policy configuration
167
+ * @returns Updated gas policy
168
+ */
169
+ setGasPolicy(agentId: string, policy: GasPolicy): Promise<GasPolicy>;
170
+ /**
171
+ * Get the current gas policy for an agent.
172
+ * @param agentId - The agent identifier
173
+ * @returns Current gas policy
174
+ */
175
+ getGasPolicy(agentId: string): Promise<GasPolicy>;
176
+ }
177
+ //# sourceMappingURL=agent.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"agent.d.ts","sourceRoot":"","sources":["../src/agent.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAClC,OAAO,EACL,aAAa,EACb,aAAa,EACb,qBAAqB,EACrB,oBAAoB,EACpB,oBAAoB,EACpB,kBAAkB,EAClB,0BAA0B,EAC1B,sBAAsB,EACtB,oBAAoB,EACpB,mBAAmB,EAC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