@q00bs/agent-sdk 1.0.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 (85) hide show
  1. package/dist/Q00bsAgent.d.ts +331 -0
  2. package/dist/Q00bsAgent.d.ts.map +1 -0
  3. package/dist/Q00bsAgent.js +695 -0
  4. package/dist/Q00bsAgent.js.map +1 -0
  5. package/dist/abis/AgentEscrow.d.ts +336 -0
  6. package/dist/abis/AgentEscrow.d.ts.map +1 -0
  7. package/dist/abis/AgentEscrow.js +206 -0
  8. package/dist/abis/AgentEscrow.js.map +1 -0
  9. package/dist/abis/AgentRegistry.d.ts +496 -0
  10. package/dist/abis/AgentRegistry.d.ts.map +1 -0
  11. package/dist/abis/AgentRegistry.js +280 -0
  12. package/dist/abis/AgentRegistry.js.map +1 -0
  13. package/dist/abis/ConsensusModule.d.ts +270 -0
  14. package/dist/abis/ConsensusModule.d.ts.map +1 -0
  15. package/dist/abis/ConsensusModule.js +157 -0
  16. package/dist/abis/ConsensusModule.js.map +1 -0
  17. package/dist/abis/ERC8004Identity.d.ts +293 -0
  18. package/dist/abis/ERC8004Identity.d.ts.map +1 -0
  19. package/dist/abis/ERC8004Identity.js +223 -0
  20. package/dist/abis/ERC8004Identity.js.map +1 -0
  21. package/dist/abis/ERC8004Reputation.d.ts +362 -0
  22. package/dist/abis/ERC8004Reputation.d.ts.map +1 -0
  23. package/dist/abis/ERC8004Reputation.js +229 -0
  24. package/dist/abis/ERC8004Reputation.js.map +1 -0
  25. package/dist/abis/ERC8004Validation.d.ts +234 -0
  26. package/dist/abis/ERC8004Validation.d.ts.map +1 -0
  27. package/dist/abis/ERC8004Validation.js +162 -0
  28. package/dist/abis/ERC8004Validation.js.map +1 -0
  29. package/dist/abis/Q00bFactory.d.ts +123 -0
  30. package/dist/abis/Q00bFactory.d.ts.map +1 -0
  31. package/dist/abis/Q00bFactory.js +65 -0
  32. package/dist/abis/Q00bFactory.js.map +1 -0
  33. package/dist/abis/TheQ00bs.d.ts +119 -0
  34. package/dist/abis/TheQ00bs.d.ts.map +1 -0
  35. package/dist/abis/TheQ00bs.js +73 -0
  36. package/dist/abis/TheQ00bs.js.map +1 -0
  37. package/dist/abis/index.d.ts +9 -0
  38. package/dist/abis/index.d.ts.map +1 -0
  39. package/dist/abis/index.js +17 -0
  40. package/dist/abis/index.js.map +1 -0
  41. package/dist/client.d.ts +111 -0
  42. package/dist/client.d.ts.map +1 -0
  43. package/dist/client.js +134 -0
  44. package/dist/client.js.map +1 -0
  45. package/dist/consensus.d.ts +85 -0
  46. package/dist/consensus.d.ts.map +1 -0
  47. package/dist/consensus.js +227 -0
  48. package/dist/consensus.js.map +1 -0
  49. package/dist/constants.d.ts +85 -0
  50. package/dist/constants.d.ts.map +1 -0
  51. package/dist/constants.js +113 -0
  52. package/dist/constants.js.map +1 -0
  53. package/dist/discovery.d.ts +70 -0
  54. package/dist/discovery.d.ts.map +1 -0
  55. package/dist/discovery.js +214 -0
  56. package/dist/discovery.js.map +1 -0
  57. package/dist/erc8004.d.ts +311 -0
  58. package/dist/erc8004.d.ts.map +1 -0
  59. package/dist/erc8004.js +824 -0
  60. package/dist/erc8004.js.map +1 -0
  61. package/dist/errors.d.ts +107 -0
  62. package/dist/errors.d.ts.map +1 -0
  63. package/dist/errors.js +210 -0
  64. package/dist/errors.js.map +1 -0
  65. package/dist/escrow.d.ts +86 -0
  66. package/dist/escrow.d.ts.map +1 -0
  67. package/dist/escrow.js +267 -0
  68. package/dist/escrow.js.map +1 -0
  69. package/dist/index.d.ts +51 -0
  70. package/dist/index.d.ts.map +1 -0
  71. package/dist/index.js +118 -0
  72. package/dist/index.js.map +1 -0
  73. package/dist/privy.d.ts +197 -0
  74. package/dist/privy.d.ts.map +1 -0
  75. package/dist/privy.js +524 -0
  76. package/dist/privy.js.map +1 -0
  77. package/dist/trust.d.ts +49 -0
  78. package/dist/trust.d.ts.map +1 -0
  79. package/dist/trust.js +117 -0
  80. package/dist/trust.js.map +1 -0
  81. package/dist/types.d.ts +472 -0
  82. package/dist/types.d.ts.map +1 -0
  83. package/dist/types.js +36 -0
  84. package/dist/types.js.map +1 -0
  85. package/package.json +30 -0
package/dist/trust.js ADDED
@@ -0,0 +1,117 @@
1
+ "use strict";
2
+ /**
3
+ * @q00bs/agent-sdk — Trust Module
4
+ *
5
+ * Resolves trust paths between agents through the q00b graph.
6
+ *
7
+ * HOW TRUST WORKS:
8
+ * 1. Every agent is registered on one side (0-5) of its owner's q00b.
9
+ * 2. Q00bs are connected through shared tokens (holder of a side token = connected).
10
+ * 3. "Hops" = how many q00b-to-q00b links separate two agents' owners.
11
+ * 4. Trust decays 15% per hop, with a 10% floor.
12
+ * 5. Agents can only communicate within their configured max-hop limit.
13
+ *
14
+ * The on-chain AgentRegistry provides canCommunicate() and getEffectiveTrust().
15
+ * This module wraps those calls with caching and friendly return types.
16
+ */
17
+ Object.defineProperty(exports, "__esModule", { value: true });
18
+ exports.TrustResolver = void 0;
19
+ const AgentRegistry_1 = require("./abis/AgentRegistry");
20
+ const constants_1 = require("./constants");
21
+ const errors_1 = require("./errors");
22
+ // ─────────────────────────────────────────────────────────────
23
+ // TRUST RESOLVER
24
+ // ─────────────────────────────────────────────────────────────
25
+ class TrustResolver {
26
+ client;
27
+ registryAddress;
28
+ logger;
29
+ /** Simple in-memory cache: "agentA-agentB" → { result, timestamp } */
30
+ cache = new Map();
31
+ cacheTtlMs = 60_000; // 1 minute default
32
+ constructor(client, registryAddress, logger) {
33
+ this.client = client;
34
+ this.registryAddress = registryAddress;
35
+ this.logger = logger;
36
+ }
37
+ /**
38
+ * Check whether two agents have a trust path and how strong it is.
39
+ *
40
+ * @param agentA - First agent's on-chain ID.
41
+ * @param agentB - Second agent's on-chain ID.
42
+ * @returns TrustPath with connection status, path length, and effective trust.
43
+ * @throws TrustPathNotFoundError if agents are not connected.
44
+ */
45
+ async resolve(agentA, agentB) {
46
+ const cacheKey = `${agentA}-${agentB}`;
47
+ const cached = this.cache.get(cacheKey);
48
+ if (cached && cached.expiresAt > Date.now()) {
49
+ this.logger.debug(`Trust cache hit: ${cacheKey}`);
50
+ return cached.result;
51
+ }
52
+ this.logger.debug(`Resolving trust path: agent ${agentA} ↔ agent ${agentB}`);
53
+ try {
54
+ // Call canCommunicate(agentA, agentB) on the AgentRegistry
55
+ const [connected, pathLength] = await this.client.readContract({
56
+ address: this.registryAddress,
57
+ abi: AgentRegistry_1.AGENT_REGISTRY_ABI,
58
+ functionName: 'canCommunicate',
59
+ args: [BigInt(agentA), BigInt(agentB)],
60
+ });
61
+ if (!connected) {
62
+ throw new errors_1.TrustPathNotFoundError(agentA, agentB);
63
+ }
64
+ // Call getEffectiveTrust(agentA, agentB)
65
+ const effectiveTrustRaw = await this.client.readContract({
66
+ address: this.registryAddress,
67
+ abi: AgentRegistry_1.AGENT_REGISTRY_ABI,
68
+ functionName: 'getEffectiveTrust',
69
+ args: [BigInt(agentA), BigInt(agentB)],
70
+ });
71
+ const result = {
72
+ connected: true,
73
+ pathLength: Number(pathLength),
74
+ effectiveTrust: Number(effectiveTrustRaw),
75
+ };
76
+ // Cache the result
77
+ this.cache.set(cacheKey, {
78
+ result,
79
+ expiresAt: Date.now() + this.cacheTtlMs,
80
+ });
81
+ this.logger.info(`Trust path resolved: ${agentA} ↔ ${agentB} = ${result.pathLength} hops, ` +
82
+ `${(result.effectiveTrust / 100).toFixed(1)}% trust`);
83
+ return result;
84
+ }
85
+ catch (error) {
86
+ if (error instanceof errors_1.TrustPathNotFoundError)
87
+ throw error;
88
+ throw new errors_1.ContractCallError(this.registryAddress, 'canCommunicate/getEffectiveTrust', error instanceof Error ? error.message : String(error));
89
+ }
90
+ }
91
+ /**
92
+ * Calculate effective trust locally (without a contract call).
93
+ * Useful for UI previews before committing to a transaction.
94
+ *
95
+ * @param baseTrustScore - Agent's raw trust score (0-10000).
96
+ * @param hops - Number of hops between the two agents' owners.
97
+ * @returns Effective trust score (0-10000).
98
+ */
99
+ static calculateLocally(baseTrustScore, hops) {
100
+ if (hops === 0)
101
+ return 0; // Not connected
102
+ const decay = 100 - hops * constants_1.TRUST_DECAY_PER_HOP_PERCENT;
103
+ const multiplier = Math.max(decay, constants_1.MIN_TRUST_FLOOR_PERCENT);
104
+ return Math.min(Math.floor((baseTrustScore * multiplier) / 100), constants_1.MAX_TRUST_SCORE);
105
+ }
106
+ /** Clear the trust cache (useful after on-chain state changes). */
107
+ clearCache() {
108
+ this.cache.clear();
109
+ this.logger.debug('Trust cache cleared');
110
+ }
111
+ /** Set cache TTL in milliseconds. */
112
+ setCacheTtl(ms) {
113
+ this.cacheTtlMs = ms;
114
+ }
115
+ }
116
+ exports.TrustResolver = TrustResolver;
117
+ //# sourceMappingURL=trust.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"trust.js","sourceRoot":"","sources":["../src/trust.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;GAcG;;;AAGH,wDAA0D;AAC1D,2CAIqB;AACrB,qCAAqE;AAGrE,gEAAgE;AAChE,iBAAiB;AACjB,gEAAgE;AAEhE,MAAa,aAAa;IAChB,MAAM,CAAiC;IACvC,eAAe,CAAgB;IAC/B,MAAM,CAAS;IAEvB,sEAAsE;IAC9D,KAAK,GAAG,IAAI,GAAG,EAAoD,CAAC;IACpE,UAAU,GAAG,MAAM,CAAC,CAAC,mBAAmB;IAEhD,YACE,MAAsC,EACtC,eAAuB,EACvB,MAAc;QAEd,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;QACrB,IAAI,CAAC,eAAe,GAAG,eAAgC,CAAC;QACxD,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;IACvB,CAAC;IAED;;;;;;;OAOG;IACH,KAAK,CAAC,OAAO,CAAC,MAAc,EAAE,MAAc;QAC1C,MAAM,QAAQ,GAAG,GAAG,MAAM,IAAI,MAAM,EAAE,CAAC;QACvC,MAAM,MAAM,GAAG,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;QACxC,I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ACpB,IAAI,CAAC,UAAU,GAAG,EAAE,CAAC;IACvB,CAAC;CACF;AA/GD,sCA+GC"}
@@ -0,0 +1,472 @@
1
+ /**
2
+ * @q00bs/agent-sdk — Type Definitions
3
+ *
4
+ * Every interface and type used across the SDK lives here.
5
+ * This keeps types centralized and prevents circular imports.
6
+ */
7
+ /**
8
+ * Configuration passed to the Q00bsAgent constructor.
9
+ *
10
+ * TWO WALLET MODES — use ONE of:
11
+ * - `privateKey` (Mode 1): Direct private key management via viem.
12
+ * - `privy` (Mode 2): Privy server wallet with spending policies (recommended for ClawBots).
13
+ *
14
+ * If both are provided, `privy` takes precedence (safer default).
15
+ */
16
+ export interface AgentConfig {
17
+ /**
18
+ * Mode 1: Agent wallet private key (hex string starting with 0x).
19
+ * NEVER hardcode — use env vars. Ignored if `privy` is set.
20
+ */
21
+ privateKey?: string;
22
+ /**
23
+ * Mode 2: Privy server wallet configuration (RECOMMENDED for ClawBot agents).
24
+ * Wallet key material is held by Privy — never in your code.
25
+ * See: https://privy.io/blog/securely-equipping-openclaw-agents-with-privy-wallets
26
+ */
27
+ privy?: PrivyConfig;
28
+ /** Base mainnet RPC URL (e.g. https://mainnet.base.org or your Alchemy/Infura endpoint). */
29
+ rpcUrl: string;
30
+ /** AgentRegistry contract address on Base. */
31
+ registryAddress: string;
32
+ /** AgentEscrow contract address on Base (optional if not using payments). */
33
+ escrowAddress?: string;
34
+ /** ConsensusModule contract address on Base (optional if not using consensus). */
35
+ consensusAddress?: string;
36
+ /** If this agent is already registered on-chain, pass its numeric ID. */
37
+ agentId?: number;
38
+ /** Human-readable capabilities this agent advertises (e.g. ['data_analysis', 'web_scraping']). */
39
+ capabilities?: string[];
40
+ /** Maximum trust-path hops this agent will communicate across. Default: 3. */
41
+ maxHops?: number;
42
+ /** Maximum value (in ETH as string) this agent can spend per transaction. Default: '0.1'. */
43
+ maxTransactionValue?: string;
44
+ /** Maximum value (in ETH as string) this agent can spend per day. Default: '1'. */
45
+ dailySpendLimit?: string;
46
+ /**
47
+ * ERC-8004 Trustless Agents configuration.
48
+ * If provided, enables interoperable identity and reputation
49
+ * via the ERC-8004 registries on Base mainnet.
50
+ */
51
+ erc8004?: ERC8004Config;
52
+ /** Log level for SDK internal logging. Default: 'info'. */
53
+ logLevel?: 'debug' | 'info' | 'warn' | 'error';
54
+ }
55
+ /** On-chain agent record as stored in AgentRegistry. */
56
+ export interface AgentRecord {
57
+ /** The agent's autonomous wallet address. */
58
+ wallet: string;
59
+ /** The q00b contract address owned by the agent's human owner. */
60
+ ownerQ00b: string;
61
+ /** Which side (0-5) of the owner's q00b this agent occupies. */
62
+ sidePosition: number;
63
+ /** IPFS hash (bytes32) of the agent's capabilities JSON. */
64
+ capabilitiesHash: string;
65
+ /** Trust score 0-10000 (divide by 100 for percentage). */
66
+ trustScore: number;
67
+ /** Unix timestamp when agent was registered. */
68
+ registeredAt: number;
69
+ /** Unix timestamp of agent's last transaction. */
70
+ lastActiveAt: number;
71
+ /** Whether the agent is active. */
72
+ active: boolean;
73
+ /** Whether the agent has been emergency-frozen by its owner. */
74
+ frozen: boolean;
75
+ }
76
+ /** Permissions set by the agent's owner. */
77
+ export interface AgentPermissions {
78
+ /** Maximum single transaction value in wei. */
79
+ maxTransactionValue: bigint;
80
+ /** Daily spend limit in wei. */
81
+ dailySpendLimit: bigint;
82
+ /** Amount spent today in wei. */
83
+ dailySpent: bigint;
84
+ /** Timestamp of last daily-spend reset. */
85
+ lastSpendReset: number;
86
+ /** Max hops for outbound communication. */
87
+ maxOutboundHops: number;
88
+ /** Max hops for inbound communication. */
89
+ maxInboundHops: number;
90
+ /** Whether this agent can delegate authority. */
91
+ canDelegate: boolean;
92
+ /** Whether high-value actions require consensus. */
93
+ requiresConsensusForHigh: boolean;
94
+ }
95
+ /** Result of a trust-path query between two agents. */
96
+ export interface TrustPath {
97
+ /** Whether a path exists at all. */
98
+ connected: boolean;
99
+ /** Number of hops between the two agents' owners in the q00b graph. */
100
+ pathLength: number;
101
+ /** Effective trust score (0-10000) accounting for distance decay. */
102
+ effectiveTrust: number;
103
+ }
104
+ /** Query filters for finding agents. */
105
+ export interface AgentQuery {
106
+ /** Filter by a single required capability. */
107
+ capability?: string;
108
+ /** Minimum trust score (0-100). */
109
+ minTrustScore?: number;
110
+ /** Maximum hops from the querying agent's owner. */
111
+ maxHops?: number;
112
+ /** Maximum results to return. Default: 20. */
113
+ limit?: number;
114
+ /** Sort order. Default: 'trust'. */
115
+ sortBy?: 'trust' | 'recent' | 'active';
116
+ }
117
+ /** An agent returned from a discovery query. */
118
+ export interface DiscoveredAgent {
119
+ /** On-chain agent ID. */
120
+ id: number;
121
+ /** Agent wallet address. */
122
+ wallet: string;
123
+ /** Owner's q00b address. */
124
+ ownerQ00b: string;
125
+ /** Trust score (0-100 as float). */
126
+ trustScore: number;
127
+ /** Hops from the querying agent's owner. */
128
+ hops: number;
129
+ /** Effective trust considering distance. */
130
+ effectiveTrust: number;
131
+ /** Whether agent is active and not frozen. */
132
+ active: boolean;
133
+ /** Capabilities hash for off-chain lookup. */
134
+ capabilitiesHash: string;
135
+ }
136
+ /** Current state of an escrow. */
137
+ export declare enum EscrowState {
138
+ CREATED = 0,
139
+ ACCEPTED = 1,
140
+ COMPLETED = 2,
141
+ RELEASED = 3,
142
+ REFUNDED = 4,
143
+ DISPUTED = 5,
144
+ RESOLVED = 6
145
+ }
146
+ /** On-chain escrow record. */
147
+ export interface EscrowRecord {
148
+ /** Escrow ID on-chain. */
149
+ id: number;
150
+ /** Agent ID of the client (payer). */
151
+ clientAgentId: number;
152
+ /** Agent ID of the service provider (payee). */
153
+ serviceAgentId: number;
154
+ /** Escrowed amount in wei (after protocol fee). */
155
+ amount: bigint;
156
+ /** Protocol fee in wei. */
157
+ protocolFee: bigint;
158
+ /** Keccak256 hash of the task description. */
159
+ taskHash: string;
160
+ /** Keccak256 hash of the expected deliverable. */
161
+ deliverableHash: string;
162
+ /** Current state. */
163
+ state: EscrowState;
164
+ /** Unix timestamp of creation. */
165
+ createdAt: number;
166
+ /** Unix timestamp deadline. */
167
+ deadline: number;
168
+ /** Unix timestamp of completion (0 if not complete). */
169
+ completedAt: number;
170
+ }
171
+ /** Parameters for creating a new escrow. */
172
+ export interface CreateEscrowParams {
173
+ /** On-chain ID of the service agent to pay. */
174
+ serviceAgentId: number;
175
+ /** Task description (will be hashed on-chain). */
176
+ taskDescription: string;
177
+ /** Expected deliverable description (will be hashed on-chain). */
178
+ deliverableDescription?: string;
179
+ /** Payment amount in ETH as a string (e.g. '0.01'). */
180
+ paymentEth: string;
181
+ /** Deadline as Unix timestamp in milliseconds. */
182
+ deadlineMs: number;
183
+ }
184
+ /** Current state of a consensus request. */
185
+ export declare enum ConsensusState {
186
+ PENDING = 0,
187
+ APPROVED = 1,
188
+ REJECTED = 2,
189
+ EXPIRED = 3,
190
+ EXECUTED = 4
191
+ }
192
+ /** On-chain consensus request. */
193
+ export interface ConsensusRecord {
194
+ /** Request ID. */
195
+ id: number;
196
+ /** Agent ID that initiated the request. */
197
+ initiatorAgentId: number;
198
+ /** Keccak256 hash of the action details. */
199
+ actionHash: string;
200
+ /** Value involved in the action (wei). */
201
+ value: bigint;
202
+ /** Number of approvals required. */
203
+ requiredApprovals: number;
204
+ /** Current approval count. */
205
+ currentApprovals: number;
206
+ /** Current rejection count. */
207
+ currentRejections: number;
208
+ /** Current state. */
209
+ state: ConsensusState;
210
+ /** Unix timestamp of creation. */
211
+ createdAt: number;
212
+ /** Unix timestamp of expiration. */
213
+ expiresAt: number;
214
+ /** Whether human (owner) approval is required. */
215
+ humanApprovalRequired: boolean;
216
+ /** Whether human has approved. */
217
+ humanApproved: boolean;
218
+ }
219
+ /** Parameters for requesting consensus. */
220
+ export interface ConsensusParams {
221
+ /** Description of the action (will be hashed). */
222
+ actionDescription: string;
223
+ /** Value in ETH as a string. */
224
+ valueEth: string;
225
+ /** Timeout in milliseconds. Default: 1 hour. */
226
+ timeoutMs?: number;
227
+ }
228
+ /** Result returned after consensus completes or times out. */
229
+ export interface ConsensusResult {
230
+ /** On-chain request ID. */
231
+ requestId: number;
232
+ /** Whether consensus was reached. */
233
+ approved: boolean;
234
+ /** Number of approvals received. */
235
+ approvals: number;
236
+ /** Number of rejections received. */
237
+ rejections: number;
238
+ /** Whether human approved (if required). */
239
+ humanApproved: boolean;
240
+ }
241
+ /**
242
+ * Privy wallet configuration for agent SDK.
243
+ *
244
+ * WHY PRIVY?
245
+ * Instead of managing raw private keys (risky for autonomous agents),
246
+ * Privy holds key material server-side and enforces spending policies
247
+ * BEFORE any transaction leaves the server. This is exactly how
248
+ * OpenClaw agents use Privy wallets — as described in:
249
+ * https://privy.io/blog/securely-equipping-openclaw-agents-with-privy-wallets
250
+ *
251
+ * HOW IT WORKS:
252
+ * 1. Your Q00bs app (Privy App ID) creates a server wallet for each agent.
253
+ * 2. A policy is attached at creation with spending limits that match
254
+ * the on-chain AgentPermissions.
255
+ * 3. The agent SDK sends transactions via Privy's API — Privy validates
256
+ * against the policy and signs with the key it custodies.
257
+ * 4. Private keys NEVER appear in agent code, env vars, or memory.
258
+ */
259
+ export interface PrivyConfig {
260
+ /** Your Privy App ID (same one used in the Q00bs Next.js frontend). */
261
+ appId: string;
262
+ /** Your Privy App Secret (server-side only — from Privy dashboard). */
263
+ appSecret: string;
264
+ /**
265
+ * If this agent already has a Privy wallet, pass its wallet ID here.
266
+ * Otherwise the SDK will create a new wallet on initialize().
267
+ */
268
+ walletId?: string;
269
+ /**
270
+ * The Privy user ID this wallet belongs to (links agent to human owner).
271
+ * If provided, the wallet is associated with the owner's Privy account.
272
+ */
273
+ userId?: string;
274
+ }
275
+ /**
276
+ * Transaction policy attached to every Privy agent wallet.
277
+ * These mirror the on-chain AgentPermissions but are enforced
278
+ * server-side by Privy BEFORE the transaction even reaches Base.
279
+ *
280
+ * DEFENSE IN DEPTH:
281
+ * Layer 1: Privy policy check (server-side, instant rejection)
282
+ * Layer 2: SDK pre-check (local validation before API call)
283
+ * Layer 3: Smart contract modifier (on-chain, final authority)
284
+ */
285
+ export interface PrivyWalletPolicy {
286
+ /** Human-readable name for this policy (e.g. "Q00bs Agent Limits"). */
287
+ name: string;
288
+ /** Policy rules — each rule restricts one dimension of transactions. */
289
+ rules: PrivyPolicyRule[];
290
+ }
291
+ /** A single rule within a Privy wallet policy. */
292
+ export interface PrivyPolicyRule {
293
+ /** What this rule controls. */
294
+ type: 'max_transaction_value' | 'daily_spend_limit' | 'allowed_contracts' | 'allowed_chains' | 'allowed_functions' | 'require_human_approval';
295
+ /** Rule value — semantics depend on `type`. */
296
+ value: string | string[] | number | boolean;
297
+ /** Optional human-readable description. */
298
+ description?: string;
299
+ }
300
+ /** Result of creating or retrieving a Privy wallet. */
301
+ export interface PrivyWalletInfo {
302
+ /** Privy's internal wallet ID (used for API calls). */
303
+ walletId: string;
304
+ /** The Ethereum address of this wallet (on Base). */
305
+ address: string;
306
+ /** Chain ID the wallet is configured for. */
307
+ chainId: number;
308
+ /** The policy attached to this wallet (if any). */
309
+ policy?: PrivyWalletPolicy;
310
+ /** Whether this wallet was freshly created or already existed. */
311
+ isNew: boolean;
312
+ }
313
+ /** Privy transaction request (what the agent SDK sends to Privy). */
314
+ export interface PrivyTransactionRequest {
315
+ /** Destination contract or wallet address. */
316
+ to: string;
317
+ /** ETH value in wei (as hex string). */
318
+ value?: string;
319
+ /** Encoded calldata for contract interactions. */
320
+ data?: string;
321
+ /** Chain ID. Default: 8453 (Base). */
322
+ chainId?: number;
323
+ /** Optional gas limit override. */
324
+ gasLimit?: string;
325
+ }
326
+ /** Privy transaction result (what Privy returns after signing + broadcasting). */
327
+ export interface PrivyTransactionResult {
328
+ /** The transaction hash on-chain. */
329
+ hash: string;
330
+ /** Whether Privy's policy check passed. */
331
+ policyPassed: boolean;
332
+ /** If policy check failed, the reason. */
333
+ policyFailureReason?: string;
334
+ }
335
+ /**
336
+ * Configuration for ERC-8004 registry addresses.
337
+ *
338
+ * Pass this in AgentConfig to enable ERC-8004 interoperability.
339
+ * If omitted, the SDK uses the canonical Base mainnet addresses.
340
+ */
341
+ export interface ERC8004Config {
342
+ /** ERC-8004 IdentityRegistry contract address. */
343
+ identityRegistryAddress?: string;
344
+ /** ERC-8004 ReputationRegistry contract address. */
345
+ reputationRegistryAddress?: string;
346
+ /** ERC-8004 ValidationRegistry contract address (optional, still evolving). */
347
+ validationRegistryAddress?: string;
348
+ }
349
+ /**
350
+ * An ERC-8004 agent identifier.
351
+ *
352
+ * Format: {namespace}:{chainId}:{identityRegistryAddress}:{agentId}
353
+ * Example: "q00bs:8453:0x8004A169FB4a3325136EB29fA0ceB6D2e539a432:42"
354
+ */
355
+ export interface ERC8004AgentIdentifier {
356
+ /** The namespace for this agent ecosystem (e.g. "q00bs"). */
357
+ namespace: string;
358
+ /** The chain ID where the identity is registered (8453 for Base). */
359
+ chainId: number;
360
+ /** The IdentityRegistry contract address. */
361
+ identityRegistry: string;
362
+ /** The agent's tokenId in the IdentityRegistry. */
363
+ agentId: number;
364
+ }
365
+ /**
366
+ * An ERC-8004 agent identity as stored on-chain.
367
+ */
368
+ export interface ERC8004Identity {
369
+ /** The agent's ERC-8004 tokenId (agentId in the IdentityRegistry). */
370
+ agentId: number;
371
+ /** The owner of this identity NFT. */
372
+ owner: string;
373
+ /** The agent's URI (tokenURI) pointing to the agent registration file. */
374
+ agentURI: string;
375
+ /** The agent's wallet address (set via EIP-712/ERC-1271 proof). */
376
+ agentWallet: string;
377
+ /** Full agent identifier string. */
378
+ identifier: string;
379
+ }
380
+ /**
381
+ * A single feedback entry from the ERC-8004 ReputationRegistry.
382
+ *
383
+ * Feedback is a signed fixed-point number:
384
+ * value=350, valueDecimals=2 → +3.50
385
+ * value=-100, valueDecimals=2 → -1.00
386
+ */
387
+ export interface ERC8004Feedback {
388
+ /** The identity registry of the feedback provider. */
389
+ fromIdentityRegistry: string;
390
+ /** The agentId of the feedback provider. */
391
+ fromAgentId: number;
392
+ /** Signed integer feedback value. */
393
+ value: number;
394
+ /** Number of decimal places in the value. */
395
+ valueDecimals: number;
396
+ /** Unix timestamp when feedback was given. */
397
+ timestamp: number;
398
+ /** Whether this feedback has been revoked. */
399
+ revoked: boolean;
400
+ /** Response from the subject (if any). */
401
+ response: string;
402
+ }
403
+ /**
404
+ * Aggregate reputation summary from the ERC-8004 ReputationRegistry.
405
+ */
406
+ export interface ERC8004ReputationSummary {
407
+ /** Total number of feedback entries (including revoked). */
408
+ count: number;
409
+ /** Sum of all non-revoked feedback values. */
410
+ sum: number;
411
+ /** Number of decimal places used in the values. */
412
+ decimals: number;
413
+ /** Computed average feedback value (sum / count). */
414
+ average: number;
415
+ }
416
+ /**
417
+ * A validation result from the ERC-8004 ValidationRegistry.
418
+ */
419
+ export interface ERC8004ValidationResult {
420
+ /** The validator contract address. */
421
+ validatorContract: string;
422
+ /** Unix timestamp when validation was requested. */
423
+ requestedAt: number;
424
+ /** Unix timestamp when validator responded (0 if pending). */
425
+ respondedAt: number;
426
+ /** Whether the validator has responded. */
427
+ responded: boolean;
428
+ /** Whether the validation passed (only meaningful if responded). */
429
+ passed: boolean;
430
+ /** Human-readable details about the validation. */
431
+ details: string;
432
+ }
433
+ /**
434
+ * Validation summary for an agent.
435
+ */
436
+ export interface ERC8004ValidationSummary {
437
+ /** Total validation requests. */
438
+ totalRequests: number;
439
+ /** Total passed validations. */
440
+ totalPassed: number;
441
+ /** Total failed validations. */
442
+ totalFailed: number;
443
+ /** Total pending validations. */
444
+ totalPending: number;
445
+ }
446
+ /**
447
+ * Parameters for giving ERC-8004 feedback.
448
+ */
449
+ export interface GiveFeedbackParams {
450
+ /** The ERC-8004 agentId of the subject receiving feedback. */
451
+ subjectAgentId: number;
452
+ /**
453
+ * Feedback value as a number (e.g. 3.5 for positive, -1.0 for negative).
454
+ * Will be converted to signed fixed-point automatically.
455
+ */
456
+ value: number;
457
+ /** Number of decimal places. Default: 2. */
458
+ decimals?: number;
459
+ /**
460
+ * The identity registry of the subject.
461
+ * Defaults to the canonical ERC-8004 IdentityRegistry on Base.
462
+ */
463
+ subjectIdentityRegistry?: string;
464
+ }
465
+ /** Internal logger interface used throughout the SDK. */
466
+ export interface Logger {
467
+ debug: (msg: string, ...args: unknown[]) => void;
468
+ info: (msg: string, ...args: unknown[]) => void;
469
+ warn: (msg: string, ...args: unknown[]) => void;
470
+ error: (msg: string, ...args: unknown[]) => void;
471
+ }
472
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAMH;;;;;;;;GAQG;AACH,MAAM,WAAW,WAAW;IAC1B;;;OAGG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;IAEpB;;;;OAIG;IACH,KAAK,CAAC,EAAE,WAAW,CAAC;IAEpB,4FAA4F;IAC5F,MAAM,EAAE,MAAM,CAAC;IAEf,8CAA8C;IAC9C,eAAe,EAAE,MAAM,CAAC;IAExB,6EAA6E;IAC7E,aAAa,CAAC,EAAE,MAAM,CAAC;IAEvB,kFAAkF;IAClF,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAE1B,yEAAyE;IACzE,OAAO,CAAC,EAAE,MAAM,CAAC;IAEjB,kGAAkG;IAClG,YAAY,CAAC,EAAE,MAAM,EAAE,CAAC;IAExB,8EAA8E;IAC9E,OAAO,CAAC,EAAE,MAAM,CAAC;IAEjB,6FAA6F;IAC7F,mBAAmB,CAAC,EAAE,MAAM,CAAC;IAE7B,mFAAmF;IACnF,eAAe,CAAC,EAAE,MAAM,CAAC;IAEzB;;;;OAIG;IACH,OAAO,CAAC,EAAE,aAAa,CAAC;IAExB,2DAA2D;IAC3D,QAAQ,CAAC,EAAE,OAAO,GAAG,MAAM,GAAG,MAAM,GAAG,OAAO,CAAC;CAChD;AAMD,wDAAwD;AACxD,MAAM,WAAW,WAAW;IAC1B,6CAA6C;IAC7C,MAAM,EAAE,MAAM,CAAC;IAEf,kEAAkE;IAClE,SAAS,EAAE,MAAM,CAAC;IAElB,gEAAgE;I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BAAuB,CAAC,EAAE,MAAM,CAAC;CAClC;AAMD,yDAAyD;AACzD,MAAM,WAAW,MAAM;IACrB,KAAK,EAAE,CAAC,GAAG,EAAE,MAAM,EAAE,GAAG,IAAI,EAAE,OAAO,EAAE,KAAK,IAAI,CAAC;IACjD,IAAI,EAAE,CAAC,GAAG,EAAE,MAAM,EAAE,GAAG,IAAI,EAAE,OAAO,EAAE,KAAK,IAAI,CAAC;IAChD,IAAI,EAAE,CAAC,GAAG,EAAE,MAAM,EAAE,GAAG,IAAI,EAAE,OAAO,EAAE,KAAK,IAAI,CAAC;IAChD,KAAK,EAAE,CAAC,GAAG,EAAE,MAAM,EAAE,GAAG,IAAI,EAAE,OAAO,EAAE,KAAK,IAAI,CAAC;CAClD"}
package/dist/types.js ADDED
@@ -0,0 +1,36 @@
1
+ "use strict";
2
+ /**
3
+ * @q00bs/agent-sdk — Type Definitions
4
+ *
5
+ * Every interface and type used across the SDK lives here.
6
+ * This keeps types centralized and prevents circular imports.
7
+ */
8
+ Object.defineProperty(exports, "__esModule", { value: true });
9
+ exports.ConsensusState = exports.EscrowState = void 0;
10
+ // ─────────────────────────────────────────────────────────────
11
+ // ESCROW
12
+ // ─────────────────────────────────────────────────────────────
13
+ /** Current state of an escrow. */
14
+ var EscrowState;
15
+ (function (EscrowState) {
16
+ EscrowState[EscrowState["CREATED"] = 0] = "CREATED";
17
+ EscrowState[EscrowState["ACCEPTED"] = 1] = "ACCEPTED";
18
+ EscrowState[EscrowState["COMPLETED"] = 2] = "COMPLETED";
19
+ EscrowState[EscrowState["RELEASED"] = 3] = "RELEASED";
20
+ EscrowState[EscrowState["REFUNDED"] = 4] = "REFUNDED";
21
+ EscrowState[EscrowState["DISPUTED"] = 5] = "DISPUTED";
22
+ EscrowState[EscrowState["RESOLVED"] = 6] = "RESOLVED";
23
+ })(EscrowState || (exports.EscrowState = EscrowState = {}));
24
+ // ─────────────────────────────────────────────────────────────
25
+ // CONSENSUS
26
+ // ─────────────────────────────────────────────────────────────
27
+ /** Current state of a consensus request. */
28
+ var ConsensusState;
29
+ (function (ConsensusState) {
30
+ ConsensusState[ConsensusState["PENDING"] = 0] = "PENDING";
31
+ ConsensusState[ConsensusState["APPROVED"] = 1] = "APPROVED";
32
+ ConsensusState[ConsensusState["REJECTED"] = 2] = "REJECTED";
33
+ ConsensusState[ConsensusState["EXPIRED"] = 3] = "EXPIRED";
34
+ ConsensusState[ConsensusState["EXECUTED"] = 4] = "EXECUTED";
35
+ })(ConsensusState || (exports.ConsensusState = ConsensusState = {}));
36
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;;AAiMH,gEAAgE;AAChE,SAAS;AACT,gEAAgE;AAEhE,kCAAkC;AAClC,IAAY,WAQX;AARD,WAAY,WAAW;IACrB,mDAAW,CAAA;IACX,qDAAY,CAAA;IACZ,uDAAa,CAAA;IACb,qDAAY,CAAA;IACZ,qDAAY,CAAA;IACZ,qDAAY,CAAA;IACZ,qDAAY,CAAA;AACd,CAAC,EARW,WAAW,2BAAX,WAAW,QAQtB;AAwDD,gEAAgE;AAChE,YAAY;AACZ,gEAAgE;AAEhE,4CAA4C;AAC5C,IAAY,cAMX;AAND,WAAY,cAAc;IACxB,yDAAW,CAAA;IACX,2DAAY,CAAA;IACZ,2DAAY,CAAA;IACZ,yDAAW,CAAA;IACX,2DAAY,CAAA;AACd,CAAC,EANW,cAAc,8BAAd,cAAc,QAMzB"}