agentex-creator-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.
- package/CHANGELOG.md +36 -0
- package/LICENSE +21 -0
- package/README.md +195 -0
- package/dist/packages/contracts/src/deployer-investigation.d.ts +1015 -0
- package/dist/packages/contracts/src/deployer-investigation.js +101 -0
- package/dist/packages/contracts/src/index.d.ts +1701 -0
- package/dist/packages/contracts/src/index.js +380 -0
- package/dist/packages/contracts/src/indexed-activity.d.ts +684 -0
- package/dist/packages/contracts/src/indexed-activity.js +71 -0
- package/dist/packages/contracts/src/indexed-agents.d.ts +299 -0
- package/dist/packages/contracts/src/indexed-agents.js +131 -0
- package/dist/packages/contracts/src/inspection.d.ts +906 -0
- package/dist/packages/contracts/src/inspection.js +114 -0
- package/dist/packages/contracts/src/kinds.d.ts +5398 -0
- package/dist/packages/contracts/src/kinds.js +156 -0
- package/dist/packages/contracts/src/report-presentation.d.ts +346 -0
- package/dist/packages/contracts/src/report-presentation.js +120 -0
- package/dist/packages/contracts/src/solana-inspection.d.ts +451 -0
- package/dist/packages/contracts/src/solana-inspection.js +94 -0
- package/dist/packages/contracts/src/token-market.d.ts +193 -0
- package/dist/packages/contracts/src/token-market.js +335 -0
- package/dist/packages/contracts/src/wallet-analysis.d.ts +866 -0
- package/dist/packages/contracts/src/wallet-analysis.js +89 -0
- package/dist/packages/contracts/src/watchtower.d.ts +1141 -0
- package/dist/packages/contracts/src/watchtower.js +196 -0
- package/dist/packages/contracts/src/workflow.d.ts +1568 -0
- package/dist/packages/contracts/src/workflow.js +651 -0
- package/dist/packages/inspector/src/decode.d.ts +23 -0
- package/dist/packages/inspector/src/decode.js +150 -0
- package/dist/packages/inspector/src/scope.d.ts +87 -0
- package/dist/packages/inspector/src/scope.js +64 -0
- package/dist/packages/model/src/analysis.d.ts +149 -0
- package/dist/packages/model/src/analysis.js +387 -0
- package/dist/packages/model/src/pricing.d.ts +38 -0
- package/dist/packages/model/src/pricing.js +49 -0
- package/dist/packages/model/src/retry.d.ts +20 -0
- package/dist/packages/model/src/retry.js +31 -0
- package/dist/packages/model/src/schema.d.ts +10 -0
- package/dist/packages/model/src/schema.js +51 -0
- package/dist/packages/model/src/summary.d.ts +91 -0
- package/dist/packages/model/src/summary.js +177 -0
- package/dist/packages/model/src/types.d.ts +81 -0
- package/dist/packages/model/src/types.js +19 -0
- package/dist/packages/monitoring/src/delivery.d.ts +32 -0
- package/dist/packages/monitoring/src/delivery.js +53 -0
- package/dist/packages/providers/src/chain-transport.d.ts +42 -0
- package/dist/packages/providers/src/chain-transport.js +57 -0
- package/dist/packages/providers/src/coverage.d.ts +105 -0
- package/dist/packages/providers/src/coverage.js +260 -0
- package/dist/packages/providers/src/health.d.ts +273 -0
- package/dist/packages/providers/src/health.js +505 -0
- package/dist/packages/providers/src/keyed.d.ts +96 -0
- package/dist/packages/providers/src/keyed.js +240 -0
- package/dist/packages/providers/src/snapshot.d.ts +61 -0
- package/dist/packages/providers/src/snapshot.js +77 -0
- package/dist/packages/publication/src/fixtures.d.ts +45 -0
- package/dist/packages/publication/src/fixtures.js +350 -0
- package/dist/packages/research/src/index.d.ts +188 -0
- package/dist/packages/research/src/index.js +829 -0
- package/dist/packages/runtime/src/checkpoints.d.ts +65 -0
- package/dist/packages/runtime/src/checkpoints.js +214 -0
- package/dist/packages/runtime/src/policy.d.ts +57 -0
- package/dist/packages/runtime/src/policy.js +296 -0
- package/dist/packages/sdk/src/bin/agentex-buyer.d.ts +2 -0
- package/dist/packages/sdk/src/bin/agentex-buyer.js +4 -0
- package/dist/packages/sdk/src/bin/agentex.d.ts +2 -0
- package/dist/packages/sdk/src/bin/agentex.js +3 -0
- package/dist/packages/sdk/src/buyer-cli.d.ts +10 -0
- package/dist/packages/sdk/src/buyer-cli.js +210 -0
- package/dist/packages/sdk/src/buyer.d.ts +534 -0
- package/dist/packages/sdk/src/buyer.js +441 -0
- package/dist/packages/sdk/src/cli.d.ts +14 -0
- package/dist/packages/sdk/src/cli.js +149 -0
- package/dist/packages/sdk/src/errors.d.ts +31 -0
- package/dist/packages/sdk/src/errors.js +24 -0
- package/dist/packages/sdk/src/index.d.ts +236 -0
- package/dist/packages/sdk/src/index.js +150 -0
- package/dist/packages/sdk/src/local.d.ts +11 -0
- package/dist/packages/sdk/src/local.js +110 -0
- package/dist/packages/sdk/src/rails.d.ts +59 -0
- package/dist/packages/sdk/src/rails.js +96 -0
- package/dist/packages/sdk/src/report.d.ts +121 -0
- package/dist/packages/sdk/src/report.js +114 -0
- package/dist/packages/sdk/src/version.d.ts +2 -0
- package/dist/packages/sdk/src/version.js +2 -0
- package/dist/packages/watchtower/src/index.d.ts +150 -0
- package/dist/packages/watchtower/src/index.js +786 -0
- package/dist/packages/workflow/src/registry.d.ts +61 -0
- package/dist/packages/workflow/src/registry.js +76 -0
- package/examples/README.md +34 -0
- package/examples/cli-usage.sh +30 -0
- package/examples/fixtures/base-weth-input.json +4 -0
- package/examples/focused-researcher.json +127 -0
- package/examples/pay-with-eth-robinhood.mts +37 -0
- package/examples/pay-with-usdc.mts +41 -0
- package/examples/quickstart.mts +73 -0
- package/package.json +50 -0
|
@@ -0,0 +1,451 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
/**
|
|
3
|
+
* Solana Transaction Inspector contract (P05, Solana half). A proposed legacy/v0 payload is decoded offline, address
|
|
4
|
+
* lookup tables are resolved at `confirmed` commitment with a lower-bound slot (`minContextSlot`; the report field keeps its
|
|
5
|
+
* historical name `finalizedSlotLowerBound`) and `simulateTransaction` runs with `sigVerify: false` and
|
|
6
|
+
* `replaceRecentBlockhash: true`. Nothing is signed or broadcast and no key is requested. `analysisChain` is independent
|
|
7
|
+
* of the account's EVM sign-in and funding network, so an EVM-funded user needs no Solana signature (C04).
|
|
8
|
+
*/
|
|
9
|
+
export declare const SOLANA_INSPECTION_SCHEMA_ID: "agentex.solana-transaction-inspection.v1";
|
|
10
|
+
export declare const SOLANA_INSPECTION_TOOL: "solana.inspect-transaction@0.1.0";
|
|
11
|
+
export declare const SOLANA_INSPECTION_RPC_CEILING = 6;
|
|
12
|
+
export declare const SOLANA_INSPECTION_RPC_METHODS: readonly ["getGenesisHash", "getSlot", "getMultipleAccounts", "simulateTransaction"];
|
|
13
|
+
export declare const SolanaNetworkSchema: z.ZodEnum<{
|
|
14
|
+
"mainnet-beta": "mainnet-beta";
|
|
15
|
+
devnet: "devnet";
|
|
16
|
+
}>;
|
|
17
|
+
/** There is deliberately no keypair, signer secret, RPC URL, commitment override or broadcast field. */
|
|
18
|
+
export declare const SolanaTransactionInspectionInputSchema: z.ZodObject<{
|
|
19
|
+
analysisChain: z.ZodLiteral<"solana">;
|
|
20
|
+
network: z.ZodEnum<{
|
|
21
|
+
"mainnet-beta": "mainnet-beta";
|
|
22
|
+
devnet: "devnet";
|
|
23
|
+
}>;
|
|
24
|
+
encoding: z.ZodEnum<{
|
|
25
|
+
message: "message";
|
|
26
|
+
transaction: "transaction";
|
|
27
|
+
}>;
|
|
28
|
+
payloadBase64: z.ZodString;
|
|
29
|
+
simulate: z.ZodDefault<z.ZodBoolean>;
|
|
30
|
+
accounts: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
31
|
+
}, z.core.$strict>;
|
|
32
|
+
export type SolanaTransactionInspectionInput = z.infer<typeof SolanaTransactionInspectionInputSchema>;
|
|
33
|
+
export declare const SolanaPermissionEffectSchema: z.ZodObject<{
|
|
34
|
+
kind: z.ZodEnum<{
|
|
35
|
+
"sol-transfer": "sol-transfer";
|
|
36
|
+
"token-transfer": "token-transfer";
|
|
37
|
+
"token-approval": "token-approval";
|
|
38
|
+
"token-approval-revoked": "token-approval-revoked";
|
|
39
|
+
"authority-change": "authority-change";
|
|
40
|
+
"account-close": "account-close";
|
|
41
|
+
"account-owner-assigned": "account-owner-assigned";
|
|
42
|
+
"account-creation": "account-creation";
|
|
43
|
+
mint: "mint";
|
|
44
|
+
burn: "burn";
|
|
45
|
+
freeze: "freeze";
|
|
46
|
+
thaw: "thaw";
|
|
47
|
+
"nonce-advance": "nonce-advance";
|
|
48
|
+
"nonce-authority-change": "nonce-authority-change";
|
|
49
|
+
"nonce-withdraw": "nonce-withdraw";
|
|
50
|
+
"permanent-delegate": "permanent-delegate";
|
|
51
|
+
"mint-authorities-declared": "mint-authorities-declared";
|
|
52
|
+
}>;
|
|
53
|
+
account: z.ZodNullable<z.ZodString>;
|
|
54
|
+
counterparty: z.ZodNullable<z.ZodString>;
|
|
55
|
+
authority: z.ZodNullable<z.ZodString>;
|
|
56
|
+
amountAtomic: z.ZodNullable<z.ZodString>;
|
|
57
|
+
decimals: z.ZodNullable<z.ZodNumber>;
|
|
58
|
+
amountFormatted: z.ZodNullable<z.ZodString>;
|
|
59
|
+
note: z.ZodString;
|
|
60
|
+
}, z.core.$strict>;
|
|
61
|
+
export declare const SolanaInspectionFindingCodeSchema: z.ZodEnum<{
|
|
62
|
+
"sol-transfer": "sol-transfer";
|
|
63
|
+
"token-approval": "token-approval";
|
|
64
|
+
"authority-change": "authority-change";
|
|
65
|
+
"account-close": "account-close";
|
|
66
|
+
"account-owner-assigned": "account-owner-assigned";
|
|
67
|
+
"permanent-delegate": "permanent-delegate";
|
|
68
|
+
"unknown-instruction": "unknown-instruction";
|
|
69
|
+
"invalid-instruction": "invalid-instruction";
|
|
70
|
+
"unresolved-account": "unresolved-account";
|
|
71
|
+
"unlimited-token-approval": "unlimited-token-approval";
|
|
72
|
+
"authority-removed": "authority-removed";
|
|
73
|
+
"durable-nonce-lifetime": "durable-nonce-lifetime";
|
|
74
|
+
"associated-account-mismatch": "associated-account-mismatch";
|
|
75
|
+
"deactivated-lookup-table": "deactivated-lookup-table";
|
|
76
|
+
"simulation-failed": "simulation-failed";
|
|
77
|
+
"simulation-not-run": "simulation-not-run";
|
|
78
|
+
"duplicate-compute-budget": "duplicate-compute-budget";
|
|
79
|
+
"signatures-present-not-verified": "signatures-present-not-verified";
|
|
80
|
+
}>;
|
|
81
|
+
export declare const SolanaTransactionInspectionReportSchema: z.ZodObject<{
|
|
82
|
+
schemaVersion: z.ZodLiteral<"agentex.solana-transaction-inspection.v1">;
|
|
83
|
+
agentVersion: z.ZodString;
|
|
84
|
+
parserVersion: z.ZodString;
|
|
85
|
+
input: z.ZodObject<{
|
|
86
|
+
analysisChain: z.ZodLiteral<"solana">;
|
|
87
|
+
network: z.ZodEnum<{
|
|
88
|
+
"mainnet-beta": "mainnet-beta";
|
|
89
|
+
devnet: "devnet";
|
|
90
|
+
}>;
|
|
91
|
+
encoding: z.ZodEnum<{
|
|
92
|
+
message: "message";
|
|
93
|
+
transaction: "transaction";
|
|
94
|
+
}>;
|
|
95
|
+
payloadBase64: z.ZodString;
|
|
96
|
+
simulate: z.ZodDefault<z.ZodBoolean>;
|
|
97
|
+
accounts: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
98
|
+
}, z.core.$strict>;
|
|
99
|
+
status: z.ZodEnum<{
|
|
100
|
+
complete: "complete";
|
|
101
|
+
partial: "partial";
|
|
102
|
+
failed: "failed";
|
|
103
|
+
}>;
|
|
104
|
+
generatedAt: z.ZodISODateTime;
|
|
105
|
+
network: z.ZodEnum<{
|
|
106
|
+
"mainnet-beta": "mainnet-beta";
|
|
107
|
+
devnet: "devnet";
|
|
108
|
+
}>;
|
|
109
|
+
genesisHash: z.ZodNullable<z.ZodString>;
|
|
110
|
+
finalizedSlotLowerBound: z.ZodNullable<z.ZodString>;
|
|
111
|
+
payload: z.ZodObject<{
|
|
112
|
+
encoding: z.ZodEnum<{
|
|
113
|
+
message: "message";
|
|
114
|
+
transaction: "transaction";
|
|
115
|
+
}>;
|
|
116
|
+
version: z.ZodNullable<z.ZodUnion<readonly [z.ZodLiteral<"legacy">, z.ZodLiteral<0>]>>;
|
|
117
|
+
bytes: z.ZodNumber;
|
|
118
|
+
sha256: z.ZodString;
|
|
119
|
+
messageSha256: z.ZodNullable<z.ZodString>;
|
|
120
|
+
feePayer: z.ZodNullable<z.ZodString>;
|
|
121
|
+
recentBlockhashOrNonce: z.ZodNullable<z.ZodString>;
|
|
122
|
+
lifetime: z.ZodEnum<{
|
|
123
|
+
unknown: "unknown";
|
|
124
|
+
"recent-blockhash": "recent-blockhash";
|
|
125
|
+
"durable-nonce": "durable-nonce";
|
|
126
|
+
}>;
|
|
127
|
+
header: z.ZodNullable<z.ZodObject<{
|
|
128
|
+
numRequiredSignatures: z.ZodNumber;
|
|
129
|
+
numReadonlySigned: z.ZodNumber;
|
|
130
|
+
numReadonlyUnsigned: z.ZodNumber;
|
|
131
|
+
}, z.core.$strict>>;
|
|
132
|
+
signatures: z.ZodArray<z.ZodObject<{
|
|
133
|
+
signer: z.ZodString;
|
|
134
|
+
present: z.ZodBoolean;
|
|
135
|
+
}, z.core.$strict>>;
|
|
136
|
+
signaturesVerified: z.ZodLiteral<false>;
|
|
137
|
+
}, z.core.$strict>;
|
|
138
|
+
lookupTables: z.ZodArray<z.ZodObject<{
|
|
139
|
+
address: z.ZodString;
|
|
140
|
+
status: z.ZodEnum<{
|
|
141
|
+
unavailable: "unavailable";
|
|
142
|
+
resolved: "resolved";
|
|
143
|
+
"not-found": "not-found";
|
|
144
|
+
"not-a-lookup-table": "not-a-lookup-table";
|
|
145
|
+
"invalid-index": "invalid-index";
|
|
146
|
+
}>;
|
|
147
|
+
active: z.ZodNullable<z.ZodBoolean>;
|
|
148
|
+
authority: z.ZodNullable<z.ZodString>;
|
|
149
|
+
addressCount: z.ZodNullable<z.ZodNumber>;
|
|
150
|
+
loadedWritable: z.ZodArray<z.ZodNullable<z.ZodString>>;
|
|
151
|
+
loadedReadonly: z.ZodArray<z.ZodNullable<z.ZodString>>;
|
|
152
|
+
evidenceIds: z.ZodArray<z.ZodString>;
|
|
153
|
+
}, z.core.$strict>>;
|
|
154
|
+
accounts: z.ZodArray<z.ZodObject<{
|
|
155
|
+
index: z.ZodNumber;
|
|
156
|
+
address: z.ZodNullable<z.ZodString>;
|
|
157
|
+
source: z.ZodEnum<{
|
|
158
|
+
unresolved: "unresolved";
|
|
159
|
+
static: "static";
|
|
160
|
+
"lookup-table": "lookup-table";
|
|
161
|
+
}>;
|
|
162
|
+
signer: z.ZodBoolean;
|
|
163
|
+
writable: z.ZodBoolean;
|
|
164
|
+
label: z.ZodNullable<z.ZodString>;
|
|
165
|
+
isPerson: z.ZodLiteral<false>;
|
|
166
|
+
}, z.core.$strict>>;
|
|
167
|
+
instructions: z.ZodArray<z.ZodObject<{
|
|
168
|
+
index: z.ZodNumber;
|
|
169
|
+
programId: z.ZodNullable<z.ZodString>;
|
|
170
|
+
program: z.ZodEnum<{
|
|
171
|
+
unknown: "unknown";
|
|
172
|
+
system: "system";
|
|
173
|
+
"spl-token": "spl-token";
|
|
174
|
+
"token-2022": "token-2022";
|
|
175
|
+
"associated-token-account": "associated-token-account";
|
|
176
|
+
memo: "memo";
|
|
177
|
+
"compute-budget": "compute-budget";
|
|
178
|
+
}>;
|
|
179
|
+
status: z.ZodEnum<{
|
|
180
|
+
unknown: "unknown";
|
|
181
|
+
decoded: "decoded";
|
|
182
|
+
invalid: "invalid";
|
|
183
|
+
"unresolved-program": "unresolved-program";
|
|
184
|
+
}>;
|
|
185
|
+
type: z.ZodNullable<z.ZodString>;
|
|
186
|
+
arguments: z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean, z.ZodNull]>>;
|
|
187
|
+
accounts: z.ZodArray<z.ZodObject<{
|
|
188
|
+
role: z.ZodString;
|
|
189
|
+
address: z.ZodNullable<z.ZodString>;
|
|
190
|
+
signer: z.ZodBoolean;
|
|
191
|
+
writable: z.ZodBoolean;
|
|
192
|
+
source: z.ZodEnum<{
|
|
193
|
+
unresolved: "unresolved";
|
|
194
|
+
static: "static";
|
|
195
|
+
"lookup-table": "lookup-table";
|
|
196
|
+
}>;
|
|
197
|
+
}, z.core.$strict>>;
|
|
198
|
+
effects: z.ZodArray<z.ZodObject<{
|
|
199
|
+
kind: z.ZodEnum<{
|
|
200
|
+
"sol-transfer": "sol-transfer";
|
|
201
|
+
"token-transfer": "token-transfer";
|
|
202
|
+
"token-approval": "token-approval";
|
|
203
|
+
"token-approval-revoked": "token-approval-revoked";
|
|
204
|
+
"authority-change": "authority-change";
|
|
205
|
+
"account-close": "account-close";
|
|
206
|
+
"account-owner-assigned": "account-owner-assigned";
|
|
207
|
+
"account-creation": "account-creation";
|
|
208
|
+
mint: "mint";
|
|
209
|
+
burn: "burn";
|
|
210
|
+
freeze: "freeze";
|
|
211
|
+
thaw: "thaw";
|
|
212
|
+
"nonce-advance": "nonce-advance";
|
|
213
|
+
"nonce-authority-change": "nonce-authority-change";
|
|
214
|
+
"nonce-withdraw": "nonce-withdraw";
|
|
215
|
+
"permanent-delegate": "permanent-delegate";
|
|
216
|
+
"mint-authorities-declared": "mint-authorities-declared";
|
|
217
|
+
}>;
|
|
218
|
+
account: z.ZodNullable<z.ZodString>;
|
|
219
|
+
counterparty: z.ZodNullable<z.ZodString>;
|
|
220
|
+
authority: z.ZodNullable<z.ZodString>;
|
|
221
|
+
amountAtomic: z.ZodNullable<z.ZodString>;
|
|
222
|
+
decimals: z.ZodNullable<z.ZodNumber>;
|
|
223
|
+
amountFormatted: z.ZodNullable<z.ZodString>;
|
|
224
|
+
note: z.ZodString;
|
|
225
|
+
}, z.core.$strict>>;
|
|
226
|
+
notes: z.ZodArray<z.ZodString>;
|
|
227
|
+
dataBytes: z.ZodNumber;
|
|
228
|
+
dataSha256: z.ZodString;
|
|
229
|
+
associatedAccountCheck: z.ZodEnum<{
|
|
230
|
+
"not-applicable": "not-applicable";
|
|
231
|
+
unresolved: "unresolved";
|
|
232
|
+
matches: "matches";
|
|
233
|
+
mismatch: "mismatch";
|
|
234
|
+
}>;
|
|
235
|
+
}, z.core.$strict>>;
|
|
236
|
+
permissions: z.ZodArray<z.ZodObject<{
|
|
237
|
+
kind: z.ZodEnum<{
|
|
238
|
+
"sol-transfer": "sol-transfer";
|
|
239
|
+
"token-transfer": "token-transfer";
|
|
240
|
+
"token-approval": "token-approval";
|
|
241
|
+
"token-approval-revoked": "token-approval-revoked";
|
|
242
|
+
"authority-change": "authority-change";
|
|
243
|
+
"account-close": "account-close";
|
|
244
|
+
"account-owner-assigned": "account-owner-assigned";
|
|
245
|
+
"account-creation": "account-creation";
|
|
246
|
+
mint: "mint";
|
|
247
|
+
burn: "burn";
|
|
248
|
+
freeze: "freeze";
|
|
249
|
+
thaw: "thaw";
|
|
250
|
+
"nonce-advance": "nonce-advance";
|
|
251
|
+
"nonce-authority-change": "nonce-authority-change";
|
|
252
|
+
"nonce-withdraw": "nonce-withdraw";
|
|
253
|
+
"permanent-delegate": "permanent-delegate";
|
|
254
|
+
"mint-authorities-declared": "mint-authorities-declared";
|
|
255
|
+
}>;
|
|
256
|
+
account: z.ZodNullable<z.ZodString>;
|
|
257
|
+
counterparty: z.ZodNullable<z.ZodString>;
|
|
258
|
+
authority: z.ZodNullable<z.ZodString>;
|
|
259
|
+
amountAtomic: z.ZodNullable<z.ZodString>;
|
|
260
|
+
decimals: z.ZodNullable<z.ZodNumber>;
|
|
261
|
+
amountFormatted: z.ZodNullable<z.ZodString>;
|
|
262
|
+
note: z.ZodString;
|
|
263
|
+
instructionIndex: z.ZodNumber;
|
|
264
|
+
}, z.core.$strict>>;
|
|
265
|
+
computeBudget: z.ZodObject<{
|
|
266
|
+
unitLimit: z.ZodNullable<z.ZodString>;
|
|
267
|
+
unitPriceMicroLamports: z.ZodNullable<z.ZodString>;
|
|
268
|
+
priorityFeeLamportsAtLimit: z.ZodNullable<z.ZodString>;
|
|
269
|
+
heapBytes: z.ZodNullable<z.ZodString>;
|
|
270
|
+
loadedAccountsDataSizeLimit: z.ZodNullable<z.ZodString>;
|
|
271
|
+
duplicateInstructions: z.ZodBoolean;
|
|
272
|
+
note: z.ZodString;
|
|
273
|
+
}, z.core.$strict>;
|
|
274
|
+
simulation: z.ZodObject<{
|
|
275
|
+
semantics: z.ZodLiteral<"simulateTransaction-at-context-slot-not-a-guarantee">;
|
|
276
|
+
status: z.ZodEnum<{
|
|
277
|
+
error: "error";
|
|
278
|
+
failed: "failed";
|
|
279
|
+
"not-run": "not-run";
|
|
280
|
+
succeeded: "succeeded";
|
|
281
|
+
}>;
|
|
282
|
+
reason: z.ZodString;
|
|
283
|
+
slot: z.ZodNullable<z.ZodString>;
|
|
284
|
+
error: z.ZodNullable<z.ZodJSONSchema>;
|
|
285
|
+
logs: z.ZodNullable<z.ZodArray<z.ZodString>>;
|
|
286
|
+
unitsConsumed: z.ZodNullable<z.ZodString>;
|
|
287
|
+
replacementBlockhash: z.ZodNullable<z.ZodString>;
|
|
288
|
+
signaturesVerified: z.ZodLiteral<false>;
|
|
289
|
+
recentBlockhashReplaced: z.ZodBoolean;
|
|
290
|
+
broadcast: z.ZodLiteral<false>;
|
|
291
|
+
accounts: z.ZodArray<z.ZodObject<{
|
|
292
|
+
address: z.ZodString;
|
|
293
|
+
status: z.ZodEnum<{
|
|
294
|
+
observed: "observed";
|
|
295
|
+
absent: "absent";
|
|
296
|
+
"not-returned": "not-returned";
|
|
297
|
+
}>;
|
|
298
|
+
owner: z.ZodNullable<z.ZodString>;
|
|
299
|
+
lamports: z.ZodNullable<z.ZodString>;
|
|
300
|
+
dataBytes: z.ZodNullable<z.ZodNumber>;
|
|
301
|
+
dataSha256: z.ZodNullable<z.ZodString>;
|
|
302
|
+
}, z.core.$strict>>;
|
|
303
|
+
innerInstructionGroups: z.ZodNullable<z.ZodNumber>;
|
|
304
|
+
returnData: z.ZodNullable<z.ZodObject<{
|
|
305
|
+
programId: z.ZodString;
|
|
306
|
+
dataBase64: z.ZodString;
|
|
307
|
+
}, z.core.$strict>>;
|
|
308
|
+
evidenceIds: z.ZodArray<z.ZodString>;
|
|
309
|
+
}, z.core.$strict>;
|
|
310
|
+
findings: z.ZodArray<z.ZodObject<{
|
|
311
|
+
code: z.ZodEnum<{
|
|
312
|
+
"sol-transfer": "sol-transfer";
|
|
313
|
+
"token-approval": "token-approval";
|
|
314
|
+
"authority-change": "authority-change";
|
|
315
|
+
"account-close": "account-close";
|
|
316
|
+
"account-owner-assigned": "account-owner-assigned";
|
|
317
|
+
"permanent-delegate": "permanent-delegate";
|
|
318
|
+
"unknown-instruction": "unknown-instruction";
|
|
319
|
+
"invalid-instruction": "invalid-instruction";
|
|
320
|
+
"unresolved-account": "unresolved-account";
|
|
321
|
+
"unlimited-token-approval": "unlimited-token-approval";
|
|
322
|
+
"authority-removed": "authority-removed";
|
|
323
|
+
"durable-nonce-lifetime": "durable-nonce-lifetime";
|
|
324
|
+
"associated-account-mismatch": "associated-account-mismatch";
|
|
325
|
+
"deactivated-lookup-table": "deactivated-lookup-table";
|
|
326
|
+
"simulation-failed": "simulation-failed";
|
|
327
|
+
"simulation-not-run": "simulation-not-run";
|
|
328
|
+
"duplicate-compute-budget": "duplicate-compute-budget";
|
|
329
|
+
"signatures-present-not-verified": "signatures-present-not-verified";
|
|
330
|
+
}>;
|
|
331
|
+
message: z.ZodString;
|
|
332
|
+
instructionIndexes: z.ZodArray<z.ZodNumber>;
|
|
333
|
+
evidenceIds: z.ZodArray<z.ZodString>;
|
|
334
|
+
}, z.core.$strict>>;
|
|
335
|
+
limitations: z.ZodArray<z.ZodString>;
|
|
336
|
+
errors: z.ZodArray<z.ZodObject<{
|
|
337
|
+
category: z.ZodString;
|
|
338
|
+
message: z.ZodString;
|
|
339
|
+
step: z.ZodString;
|
|
340
|
+
evidenceId: z.ZodOptional<z.ZodString>;
|
|
341
|
+
}, z.core.$strict>>;
|
|
342
|
+
evidence: z.ZodArray<z.ZodObject<{
|
|
343
|
+
schemaVersion: z.ZodLiteral<"agentex.tool-evidence.v1">;
|
|
344
|
+
id: z.ZodString;
|
|
345
|
+
tool: z.ZodString;
|
|
346
|
+
capability: z.ZodEnum<{
|
|
347
|
+
"evm.read": "evm.read";
|
|
348
|
+
"http.read": "http.read";
|
|
349
|
+
"solana.read": "solana.read";
|
|
350
|
+
}>;
|
|
351
|
+
source: z.ZodObject<{
|
|
352
|
+
kind: z.ZodEnum<{
|
|
353
|
+
rpc: "rpc";
|
|
354
|
+
http: "http";
|
|
355
|
+
offline: "offline";
|
|
356
|
+
}>;
|
|
357
|
+
provider: z.ZodString;
|
|
358
|
+
method: z.ZodString;
|
|
359
|
+
documentationUrl: z.ZodNullable<z.ZodURL>;
|
|
360
|
+
}, z.core.$strict>;
|
|
361
|
+
chain: z.ZodString;
|
|
362
|
+
scope: z.ZodObject<{
|
|
363
|
+
subjects: z.ZodArray<z.ZodString>;
|
|
364
|
+
window: z.ZodNullable<z.ZodObject<{
|
|
365
|
+
unit: z.ZodEnum<{
|
|
366
|
+
block: "block";
|
|
367
|
+
slot: "slot";
|
|
368
|
+
}>;
|
|
369
|
+
from: z.ZodString;
|
|
370
|
+
to: z.ZodString;
|
|
371
|
+
}, z.core.$strict>>;
|
|
372
|
+
page: z.ZodNullable<z.ZodObject<{
|
|
373
|
+
index: z.ZodNumber;
|
|
374
|
+
size: z.ZodNumber;
|
|
375
|
+
cursor: z.ZodNullable<z.ZodString>;
|
|
376
|
+
}, z.core.$strict>>;
|
|
377
|
+
}, z.core.$strict>;
|
|
378
|
+
request: z.ZodJSONSchema;
|
|
379
|
+
snapshot: z.ZodNullable<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
380
|
+
kind: z.ZodLiteral<"evm-block">;
|
|
381
|
+
chainId: z.ZodNumber;
|
|
382
|
+
blockNumber: z.ZodString;
|
|
383
|
+
blockHash: z.ZodString;
|
|
384
|
+
timestamp: z.ZodNullable<z.ZodString>;
|
|
385
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
386
|
+
kind: z.ZodLiteral<"solana-slot">;
|
|
387
|
+
genesisHash: z.ZodString;
|
|
388
|
+
slot: z.ZodString;
|
|
389
|
+
commitment: z.ZodEnum<{
|
|
390
|
+
finalized: "finalized";
|
|
391
|
+
confirmed: "confirmed";
|
|
392
|
+
}>;
|
|
393
|
+
exactness: z.ZodEnum<{
|
|
394
|
+
"observed-context": "observed-context";
|
|
395
|
+
"lower-bound": "lower-bound";
|
|
396
|
+
}>;
|
|
397
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
398
|
+
kind: z.ZodLiteral<"http-retrieval">;
|
|
399
|
+
retrievedAt: z.ZodISODateTime;
|
|
400
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
401
|
+
kind: z.ZodLiteral<"offline-input">;
|
|
402
|
+
inputHash: z.ZodString;
|
|
403
|
+
}, z.core.$strict>], "kind">>;
|
|
404
|
+
observedAt: z.ZodISODateTime;
|
|
405
|
+
finality: z.ZodEnum<{
|
|
406
|
+
finalized: "finalized";
|
|
407
|
+
"sequencer-confirmed": "sequencer-confirmed";
|
|
408
|
+
unverified: "unverified";
|
|
409
|
+
"not-applicable": "not-applicable";
|
|
410
|
+
confirmed: "confirmed";
|
|
411
|
+
"finalized-lower-bound": "finalized-lower-bound";
|
|
412
|
+
"confirmed-lower-bound": "confirmed-lower-bound";
|
|
413
|
+
}>;
|
|
414
|
+
canonicality: z.ZodEnum<{
|
|
415
|
+
"verified-at-completion": "verified-at-completion";
|
|
416
|
+
unchecked: "unchecked";
|
|
417
|
+
changed: "changed";
|
|
418
|
+
"not-applicable": "not-applicable";
|
|
419
|
+
}>;
|
|
420
|
+
completeness: z.ZodEnum<{
|
|
421
|
+
error: "error";
|
|
422
|
+
"complete-for-request": "complete-for-request";
|
|
423
|
+
unavailable: "unavailable";
|
|
424
|
+
truncated: "truncated";
|
|
425
|
+
"empty-result": "empty-result";
|
|
426
|
+
}>;
|
|
427
|
+
errorCategory: z.ZodNullable<z.ZodString>;
|
|
428
|
+
result: z.ZodJSONSchema;
|
|
429
|
+
contentHash: z.ZodString;
|
|
430
|
+
artifactHash: z.ZodString;
|
|
431
|
+
privacy: z.ZodEnum<{
|
|
432
|
+
"public-chain-data": "public-chain-data";
|
|
433
|
+
"public-web-content": "public-web-content";
|
|
434
|
+
"private-input": "private-input";
|
|
435
|
+
}>;
|
|
436
|
+
trust: z.ZodEnum<{
|
|
437
|
+
"chain-state": "chain-state";
|
|
438
|
+
"provider-assertion": "provider-assertion";
|
|
439
|
+
"untrusted-third-party-content": "untrusted-third-party-content";
|
|
440
|
+
"offline-decoding": "offline-decoding";
|
|
441
|
+
}>;
|
|
442
|
+
}, z.core.$strict>>;
|
|
443
|
+
usage: z.ZodObject<{
|
|
444
|
+
rpcCalls: z.ZodNumber;
|
|
445
|
+
maximumRpcCalls: z.ZodNumber;
|
|
446
|
+
elapsedMs: z.ZodNumber;
|
|
447
|
+
modelTokens: z.ZodLiteral<0>;
|
|
448
|
+
providerCostStatus: z.ZodLiteral<"unpriced">;
|
|
449
|
+
}, z.core.$strict>;
|
|
450
|
+
}, z.core.$strict>;
|
|
451
|
+
export type SolanaTransactionInspectionReport = z.infer<typeof SolanaTransactionInspectionReportSchema>;
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { ToolEvidenceItemSchema } from './workflow.js';
|
|
3
|
+
/**
|
|
4
|
+
* Solana Transaction Inspector contract (P05, Solana half). A proposed legacy/v0 payload is decoded offline, address
|
|
5
|
+
* lookup tables are resolved at `confirmed` commitment with a lower-bound slot (`minContextSlot`; the report field keeps its
|
|
6
|
+
* historical name `finalizedSlotLowerBound`) and `simulateTransaction` runs with `sigVerify: false` and
|
|
7
|
+
* `replaceRecentBlockhash: true`. Nothing is signed or broadcast and no key is requested. `analysisChain` is independent
|
|
8
|
+
* of the account's EVM sign-in and funding network, so an EVM-funded user needs no Solana signature (C04).
|
|
9
|
+
*/
|
|
10
|
+
export const SOLANA_INSPECTION_SCHEMA_ID = 'agentex.solana-transaction-inspection.v1';
|
|
11
|
+
export const SOLANA_INSPECTION_TOOL = 'solana.inspect-transaction@0.1.0';
|
|
12
|
+
export const SOLANA_INSPECTION_RPC_CEILING = 6;
|
|
13
|
+
export const SOLANA_INSPECTION_RPC_METHODS = ['getGenesisHash', 'getSlot', 'getMultipleAccounts', 'simulateTransaction'];
|
|
14
|
+
export const SolanaNetworkSchema = z.enum(['mainnet-beta', 'devnet']);
|
|
15
|
+
const Base58Key = z.string().regex(/^[1-9A-HJ-NP-Za-km-z]{32,44}$/);
|
|
16
|
+
const Hash = z.string().regex(/^[a-f0-9]{64}$/);
|
|
17
|
+
const Exact = z.string().regex(/^(0|[1-9][0-9]{0,77})$/);
|
|
18
|
+
const Canonical64 = z.string().min(4).max(1644).regex(/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/, 'Expected canonical base64');
|
|
19
|
+
/** There is deliberately no keypair, signer secret, RPC URL, commitment override or broadcast field. */
|
|
20
|
+
export const SolanaTransactionInspectionInputSchema = z.strictObject({
|
|
21
|
+
analysisChain: z.literal('solana'), network: SolanaNetworkSchema, encoding: z.enum(['transaction', 'message']), payloadBase64: Canonical64,
|
|
22
|
+
simulate: z.boolean().default(true), accounts: z.array(Base58Key).max(8).default([]),
|
|
23
|
+
});
|
|
24
|
+
const Value = z.union([z.string().max(1024), z.number(), z.boolean(), z.null()]);
|
|
25
|
+
const Program = z.enum(['system', 'spl-token', 'token-2022', 'associated-token-account', 'memo', 'compute-budget', 'unknown']);
|
|
26
|
+
export const SolanaPermissionEffectSchema = z.strictObject({
|
|
27
|
+
kind: z.enum(['sol-transfer', 'token-transfer', 'token-approval', 'token-approval-revoked', 'authority-change', 'account-close', 'account-owner-assigned', 'account-creation', 'mint', 'burn', 'freeze', 'thaw', 'nonce-advance', 'nonce-authority-change', 'nonce-withdraw', 'permanent-delegate', 'mint-authorities-declared']),
|
|
28
|
+
account: Base58Key.nullable(), counterparty: Base58Key.nullable(), authority: Base58Key.nullable(), amountAtomic: Exact.nullable(), decimals: z.number().int().min(0).max(255).nullable(), amountFormatted: z.string().max(100).nullable(), note: z.string().max(500),
|
|
29
|
+
});
|
|
30
|
+
const AccountSource = z.enum(['static', 'lookup-table', 'unresolved']);
|
|
31
|
+
export const SolanaInspectionFindingCodeSchema = z.enum(['unknown-instruction', 'invalid-instruction', 'unresolved-account', 'token-approval', 'unlimited-token-approval', 'authority-change', 'authority-removed', 'account-close',
|
|
32
|
+
'account-owner-assigned', 'sol-transfer', 'durable-nonce-lifetime', 'permanent-delegate', 'associated-account-mismatch', 'deactivated-lookup-table', 'simulation-failed', 'simulation-not-run', 'duplicate-compute-budget', 'signatures-present-not-verified']);
|
|
33
|
+
export const SolanaTransactionInspectionReportSchema = z.strictObject({
|
|
34
|
+
schemaVersion: z.literal(SOLANA_INSPECTION_SCHEMA_ID), agentVersion: z.string().regex(/^\d+\.\d+\.\d+$/), parserVersion: z.string().regex(/^\d+\.\d+\.\d+$/),
|
|
35
|
+
input: SolanaTransactionInspectionInputSchema, status: z.enum(['complete', 'partial', 'failed']), generatedAt: z.iso.datetime(),
|
|
36
|
+
network: SolanaNetworkSchema, genesisHash: z.string().nullable(), finalizedSlotLowerBound: Exact.nullable(),
|
|
37
|
+
payload: z.strictObject({
|
|
38
|
+
encoding: z.enum(['transaction', 'message']), version: z.union([z.literal('legacy'), z.literal(0)]).nullable(), bytes: z.number().int().min(0).max(1232), sha256: Hash, messageSha256: Hash.nullable(),
|
|
39
|
+
feePayer: Base58Key.nullable(), recentBlockhashOrNonce: Base58Key.nullable(), lifetime: z.enum(['recent-blockhash', 'durable-nonce', 'unknown']),
|
|
40
|
+
header: z.strictObject({ numRequiredSignatures: z.number().int(), numReadonlySigned: z.number().int(), numReadonlyUnsigned: z.number().int() }).nullable(),
|
|
41
|
+
signatures: z.array(z.strictObject({ signer: Base58Key, present: z.boolean() })).max(64), signaturesVerified: z.literal(false),
|
|
42
|
+
}),
|
|
43
|
+
lookupTables: z.array(z.strictObject({ address: Base58Key, status: z.enum(['resolved', 'not-found', 'not-a-lookup-table', 'invalid-index', 'unavailable']), active: z.boolean().nullable(), authority: Base58Key.nullable(), addressCount: z.number().int().nullable(),
|
|
44
|
+
loadedWritable: z.array(Base58Key.nullable()).max(64), loadedReadonly: z.array(Base58Key.nullable()).max(64), evidenceIds: z.array(z.string()) })).max(16),
|
|
45
|
+
accounts: z.array(z.strictObject({ index: z.number().int().min(0).max(255), address: Base58Key.nullable(), source: AccountSource, signer: z.boolean(), writable: z.boolean(), label: z.string().max(100).nullable(), isPerson: z.literal(false) })).max(256),
|
|
46
|
+
instructions: z.array(z.strictObject({
|
|
47
|
+
index: z.number().int().min(0).max(63), programId: Base58Key.nullable(), program: Program, status: z.enum(['decoded', 'unknown', 'invalid', 'unresolved-program']), type: z.string().max(64).nullable(),
|
|
48
|
+
arguments: z.record(z.string().max(96), Value), accounts: z.array(z.strictObject({ role: z.string().max(64), address: Base58Key.nullable(), signer: z.boolean(), writable: z.boolean(), source: AccountSource })).max(64),
|
|
49
|
+
effects: z.array(SolanaPermissionEffectSchema).max(8), notes: z.array(z.string().max(600)).max(8), dataBytes: z.number().int().min(0).max(1232), dataSha256: Hash,
|
|
50
|
+
associatedAccountCheck: z.enum(['matches', 'mismatch', 'not-applicable', 'unresolved']),
|
|
51
|
+
})).max(64),
|
|
52
|
+
permissions: z.array(SolanaPermissionEffectSchema.extend({ instructionIndex: z.number().int().min(0).max(63) })).max(128),
|
|
53
|
+
computeBudget: z.strictObject({ unitLimit: Exact.nullable(), unitPriceMicroLamports: Exact.nullable(), priorityFeeLamportsAtLimit: Exact.nullable(), heapBytes: Exact.nullable(), loadedAccountsDataSizeLimit: Exact.nullable(), duplicateInstructions: z.boolean(), note: z.string().max(500) }),
|
|
54
|
+
simulation: z.strictObject({
|
|
55
|
+
semantics: z.literal('simulateTransaction-at-context-slot-not-a-guarantee'), status: z.enum(['succeeded', 'failed', 'error', 'not-run']), reason: z.string().max(1000), slot: Exact.nullable(),
|
|
56
|
+
error: z.json().nullable(), logs: z.array(z.string().max(2048)).max(250).nullable(), unitsConsumed: Exact.nullable(), replacementBlockhash: z.string().max(44).nullable(),
|
|
57
|
+
signaturesVerified: z.literal(false), recentBlockhashReplaced: z.boolean(), broadcast: z.literal(false),
|
|
58
|
+
accounts: z.array(z.strictObject({ address: Base58Key, status: z.enum(['observed', 'absent', 'not-returned']), owner: Base58Key.nullable(), lamports: Exact.nullable(), dataBytes: z.number().int().nullable(), dataSha256: Hash.nullable() })).max(8),
|
|
59
|
+
innerInstructionGroups: z.number().int().nullable(), returnData: z.strictObject({ programId: Base58Key, dataBase64: z.string().max(1644) }).nullable(), evidenceIds: z.array(z.string()),
|
|
60
|
+
}),
|
|
61
|
+
findings: z.array(z.strictObject({ code: SolanaInspectionFindingCodeSchema, message: z.string().max(1000), instructionIndexes: z.array(z.number().int()).max(64), evidenceIds: z.array(z.string()) })).max(64),
|
|
62
|
+
limitations: z.array(z.string().max(1000)).max(24), errors: z.array(z.strictObject({ category: z.string().regex(/^[a-z][a-z-]{1,63}$/), message: z.string().max(1000), step: z.string().max(64), evidenceId: z.string().optional() })).max(32),
|
|
63
|
+
evidence: z.array(ToolEvidenceItemSchema).max(SOLANA_INSPECTION_RPC_CEILING),
|
|
64
|
+
usage: z.strictObject({ rpcCalls: z.number().int().nonnegative(), maximumRpcCalls: z.number().int().positive().max(SOLANA_INSPECTION_RPC_CEILING), elapsedMs: z.number().int().nonnegative(), modelTokens: z.literal(0), providerCostStatus: z.literal('unpriced') }),
|
|
65
|
+
}).superRefine((report, ctx) => {
|
|
66
|
+
const issue = (message) => ctx.addIssue({ code: 'custom', message });
|
|
67
|
+
const ids = new Set(report.evidence.map((item) => item.id));
|
|
68
|
+
if (ids.size !== report.evidence.length)
|
|
69
|
+
issue('Duplicate evidence id');
|
|
70
|
+
if (report.usage.rpcCalls > report.usage.maximumRpcCalls || report.evidence.length > report.usage.rpcCalls)
|
|
71
|
+
issue('RPC usage or evidence count exceeds the recorded budget.');
|
|
72
|
+
for (const item of report.evidence) {
|
|
73
|
+
if (item.tool !== SOLANA_INSPECTION_TOOL || item.capability !== 'solana.read')
|
|
74
|
+
issue(`Evidence ${item.id} was not produced by ${SOLANA_INSPECTION_TOOL}.`);
|
|
75
|
+
// Read-method allowlist: sending, airdrop and signing methods can never appear in a valid report.
|
|
76
|
+
if (!SOLANA_INSPECTION_RPC_METHODS.includes(item.source.method))
|
|
77
|
+
issue(`Unsupported Solana inspector RPC method ${item.source.method}`);
|
|
78
|
+
if (item.source.method === 'simulateTransaction' && item.privacy !== 'private-input')
|
|
79
|
+
issue('Simulation receipts carry the private proposed payload.');
|
|
80
|
+
}
|
|
81
|
+
const references = [...report.lookupTables.flatMap((table) => table.evidenceIds), ...report.simulation.evidenceIds, ...report.findings.flatMap((finding) => finding.evidenceIds), ...report.errors.flatMap((error) => error.evidenceId ? [error.evidenceId] : [])];
|
|
82
|
+
for (const id of references)
|
|
83
|
+
if (!ids.has(id))
|
|
84
|
+
issue(`Unknown evidence reference ${id}`);
|
|
85
|
+
const indexes = new Set(report.instructions.map((item) => item.index));
|
|
86
|
+
for (const finding of report.findings)
|
|
87
|
+
for (const index of finding.instructionIndexes)
|
|
88
|
+
if (!indexes.has(index))
|
|
89
|
+
issue(`Unknown instruction reference ${index}`);
|
|
90
|
+
if (['succeeded', 'failed'].includes(report.simulation.status) && !report.simulation.evidenceIds.length)
|
|
91
|
+
issue('A simulation outcome needs its captured simulateTransaction receipt.');
|
|
92
|
+
if (report.simulation.status === 'not-run' && report.simulation.evidenceIds.length)
|
|
93
|
+
issue('A simulation that did not run cannot cite receipts.');
|
|
94
|
+
});
|