@svsprotocol/solana 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.
- package/LICENSE +158 -0
- package/README.md +365 -0
- package/dist/action-production-proof-evidence.js +553 -0
- package/dist/adapter-catalog.d.ts +29 -0
- package/dist/adapter-catalog.js +146 -0
- package/dist/adapter-core.d.ts +48 -0
- package/dist/adapter-core.js +249 -0
- package/dist/approval-signature.js +197 -0
- package/dist/base58.js +69 -0
- package/dist/bot-auth.js +50 -0
- package/dist/bot-certification-evidence.js +342 -0
- package/dist/bot-first-action-runbook.js +299 -0
- package/dist/bot-integration-contract.js +41 -0
- package/dist/certified-submit-status.js +176 -0
- package/dist/common.d.ts +1135 -0
- package/dist/elizaos.d.ts +43 -0
- package/dist/elizaos.js +227 -0
- package/dist/goat.d.ts +47 -0
- package/dist/goat.js +261 -0
- package/dist/index.d.ts +330 -0
- package/dist/index.js +128 -0
- package/dist/protocol.d.ts +205 -0
- package/dist/protocol.js +900 -0
- package/dist/receipt.js +51 -0
- package/dist/signed-proof-read-protection.js +495 -0
- package/dist/solana-agent-kit.d.ts +35 -0
- package/dist/solana-agent-kit.js +151 -0
- package/dist/svs-client.js +1232 -0
- package/dist/vercel-ai.d.ts +47 -0
- package/dist/vercel-ai.js +266 -0
- package/dist/verified-agent-adoption-kit.js +471 -0
- package/dist/verified-agent-profile.js +329 -0
- package/dist/verified-agent-registry-consumer.js +421 -0
- package/dist/verified-agent-registry.d.ts +36 -0
- package/dist/verified-agent-registry.js +826 -0
- package/dist/verified-agent-trust-score.js +335 -0
- package/dist/webhooks.js +834 -0
- package/package.json +72 -0
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import type {
|
|
2
|
+
SvsAdapterActionInput,
|
|
3
|
+
SvsAdapterActionResult,
|
|
4
|
+
SvsAdapterOptions,
|
|
5
|
+
SvsAdapterReadinessResult,
|
|
6
|
+
JsonObject
|
|
7
|
+
} from "./common.js";
|
|
8
|
+
import { SvsAdapterCoreError } from "./adapter-core.js";
|
|
9
|
+
|
|
10
|
+
export const VERCEL_AI_SDK_ADAPTER_VERSION: "svs.vercel-ai-sdk-adapter.v1";
|
|
11
|
+
export const VERCEL_AI_SDK_TOOL_NAME: "svsVerifyAndSubmitSolanaAction";
|
|
12
|
+
|
|
13
|
+
export class SvsVercelAiSdkAdapterError extends SvsAdapterCoreError {}
|
|
14
|
+
|
|
15
|
+
export interface SvsVercelAiSdkTool {
|
|
16
|
+
version?: typeof VERCEL_AI_SDK_ADAPTER_VERSION;
|
|
17
|
+
name?: typeof VERCEL_AI_SDK_TOOL_NAME;
|
|
18
|
+
title: string;
|
|
19
|
+
description: string;
|
|
20
|
+
inputSchema: unknown;
|
|
21
|
+
inputExamples: unknown[];
|
|
22
|
+
needsApproval?: unknown;
|
|
23
|
+
execute(input: SvsAdapterActionInput): Promise<SvsAdapterActionResult>;
|
|
24
|
+
handler?: (input: SvsAdapterActionInput) => Promise<SvsAdapterActionResult>;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
export interface SvsVercelAiSdkTools {
|
|
28
|
+
version: typeof VERCEL_AI_SDK_ADAPTER_VERSION;
|
|
29
|
+
name: "svs-vercel-ai-sdk-tools";
|
|
30
|
+
description: string;
|
|
31
|
+
botId: string;
|
|
32
|
+
policyId: string | null;
|
|
33
|
+
rpcUrl: string | null;
|
|
34
|
+
client: unknown;
|
|
35
|
+
tool: SvsVercelAiSdkTool | unknown;
|
|
36
|
+
tools: Record<typeof VERCEL_AI_SDK_TOOL_NAME, SvsVercelAiSdkTool | unknown>;
|
|
37
|
+
requireSvsProductionReady(options?: Partial<SvsAdapterOptions>): Promise<SvsAdapterReadinessResult>;
|
|
38
|
+
verifyAndSubmitSolanaAction(input: SvsAdapterActionInput, options?: Partial<SvsAdapterOptions>): Promise<SvsAdapterActionResult>;
|
|
39
|
+
getTools(): Record<typeof VERCEL_AI_SDK_TOOL_NAME, SvsVercelAiSdkTool | unknown>;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
export function createSvsVercelAiSdkTools(options: SvsAdapterOptions & { tool?: Function | null; z?: unknown; needsApproval?: unknown }): SvsVercelAiSdkTools;
|
|
43
|
+
export function createSvsVercelAiSdkTool(options?: { client?: unknown; defaults?: Partial<SvsAdapterOptions>; tool?: Function | null; z?: unknown; needsApproval?: unknown }): SvsVercelAiSdkTool | unknown;
|
|
44
|
+
export function createVercelAiSdkToolMetadata(options?: { z?: unknown; needsApproval?: unknown }): JsonObject;
|
|
45
|
+
export function createVercelAiSdkInputSchema(options?: { z?: unknown }): unknown;
|
|
46
|
+
export function requireSvsVercelAiSdkProductionReady(options: SvsAdapterOptions): Promise<SvsAdapterReadinessResult>;
|
|
47
|
+
export function verifyAndSubmitVercelAiSdkSolanaAction(options: SvsAdapterOptions & SvsAdapterActionInput): Promise<SvsAdapterActionResult>;
|
|
@@ -0,0 +1,266 @@
|
|
|
1
|
+
import {
|
|
2
|
+
SvsAdapterCoreError,
|
|
3
|
+
createSvsAdapterClient,
|
|
4
|
+
requireSvsAdapterProductionReady,
|
|
5
|
+
verifyAndSubmitSvsAdapterSolanaAction
|
|
6
|
+
} from "./adapter-core.js";
|
|
7
|
+
|
|
8
|
+
export const VERCEL_AI_SDK_ADAPTER_VERSION = "svs.vercel-ai-sdk-adapter.v1";
|
|
9
|
+
export const VERCEL_AI_SDK_TOOL_NAME = "svsVerifyAndSubmitSolanaAction";
|
|
10
|
+
|
|
11
|
+
export class SvsVercelAiSdkAdapterError extends SvsAdapterCoreError {
|
|
12
|
+
constructor(message, details = {}) {
|
|
13
|
+
super(message, details);
|
|
14
|
+
this.name = "SvsVercelAiSdkAdapterError";
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export function createSvsVercelAiSdkTools({
|
|
19
|
+
client = null,
|
|
20
|
+
baseUrl,
|
|
21
|
+
apiKey,
|
|
22
|
+
requestSigningSecret,
|
|
23
|
+
expectedIntegrationContractHash,
|
|
24
|
+
botId,
|
|
25
|
+
policyId = null,
|
|
26
|
+
rpcUrl = null,
|
|
27
|
+
certificationStaleAfterMs = undefined,
|
|
28
|
+
requireCurrentIntegrationContract = true,
|
|
29
|
+
waitForProof = false,
|
|
30
|
+
waitAttempts = 12,
|
|
31
|
+
waitIntervalMs = 5000,
|
|
32
|
+
fetchProof = true,
|
|
33
|
+
checkReceiptRegistryChain = true,
|
|
34
|
+
requireReadinessOnSubmit = true,
|
|
35
|
+
tool = null,
|
|
36
|
+
z = null,
|
|
37
|
+
needsApproval = undefined
|
|
38
|
+
} = {}) {
|
|
39
|
+
if (!botId) {
|
|
40
|
+
throw new Error("botId is required.");
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
const svs = createSvsAdapterClient({
|
|
44
|
+
client,
|
|
45
|
+
baseUrl,
|
|
46
|
+
apiKey,
|
|
47
|
+
requestSigningSecret,
|
|
48
|
+
expectedIntegrationContractHash
|
|
49
|
+
});
|
|
50
|
+
const defaults = {
|
|
51
|
+
botId,
|
|
52
|
+
policyId,
|
|
53
|
+
rpcUrl,
|
|
54
|
+
certificationStaleAfterMs,
|
|
55
|
+
requireCurrentIntegrationContract,
|
|
56
|
+
waitForProof,
|
|
57
|
+
waitAttempts,
|
|
58
|
+
waitIntervalMs,
|
|
59
|
+
fetchProof,
|
|
60
|
+
checkReceiptRegistryChain,
|
|
61
|
+
requireReadinessOnSubmit
|
|
62
|
+
};
|
|
63
|
+
const svsTool = createSvsVercelAiSdkTool({
|
|
64
|
+
client: svs,
|
|
65
|
+
defaults,
|
|
66
|
+
tool,
|
|
67
|
+
z,
|
|
68
|
+
needsApproval
|
|
69
|
+
});
|
|
70
|
+
const tools = {
|
|
71
|
+
[VERCEL_AI_SDK_TOOL_NAME]: svsTool
|
|
72
|
+
};
|
|
73
|
+
|
|
74
|
+
return {
|
|
75
|
+
version: VERCEL_AI_SDK_ADAPTER_VERSION,
|
|
76
|
+
name: "svs-vercel-ai-sdk-tools",
|
|
77
|
+
description: "SVS Agent Verification tools for Vercel AI SDK Solana agents.",
|
|
78
|
+
botId,
|
|
79
|
+
policyId,
|
|
80
|
+
rpcUrl,
|
|
81
|
+
client: svs,
|
|
82
|
+
tool: svsTool,
|
|
83
|
+
tools,
|
|
84
|
+
async requireSvsProductionReady(options = {}) {
|
|
85
|
+
return requireSvsVercelAiSdkProductionReady({
|
|
86
|
+
client: svs,
|
|
87
|
+
...defaults,
|
|
88
|
+
...options
|
|
89
|
+
});
|
|
90
|
+
},
|
|
91
|
+
async verifyAndSubmitSolanaAction(input = {}, options = {}) {
|
|
92
|
+
return verifyAndSubmitVercelAiSdkSolanaAction({
|
|
93
|
+
client: svs,
|
|
94
|
+
...defaults,
|
|
95
|
+
...input,
|
|
96
|
+
...options
|
|
97
|
+
});
|
|
98
|
+
},
|
|
99
|
+
getTools() {
|
|
100
|
+
return tools;
|
|
101
|
+
}
|
|
102
|
+
};
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
export function createSvsVercelAiSdkTool({
|
|
106
|
+
client,
|
|
107
|
+
defaults = {},
|
|
108
|
+
tool = null,
|
|
109
|
+
z = null,
|
|
110
|
+
needsApproval = undefined
|
|
111
|
+
} = {}) {
|
|
112
|
+
const metadata = createVercelAiSdkToolMetadata({ z, needsApproval });
|
|
113
|
+
const execute = async (input = {}) => verifyAndSubmitVercelAiSdkSolanaAction({
|
|
114
|
+
client,
|
|
115
|
+
...defaults,
|
|
116
|
+
...input
|
|
117
|
+
});
|
|
118
|
+
const definition = {
|
|
119
|
+
...metadata,
|
|
120
|
+
execute
|
|
121
|
+
};
|
|
122
|
+
|
|
123
|
+
if (typeof tool === "function") {
|
|
124
|
+
return tool(definition);
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
return {
|
|
128
|
+
version: VERCEL_AI_SDK_ADAPTER_VERSION,
|
|
129
|
+
name: VERCEL_AI_SDK_TOOL_NAME,
|
|
130
|
+
...definition,
|
|
131
|
+
handler: execute
|
|
132
|
+
};
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
export function createVercelAiSdkToolMetadata({
|
|
136
|
+
z = null,
|
|
137
|
+
needsApproval = undefined
|
|
138
|
+
} = {}) {
|
|
139
|
+
const metadata = {
|
|
140
|
+
title: "SVS verified Solana action",
|
|
141
|
+
description: "Submit a Solana action through SVS so signed bot identity, production certification, human wallet approval, policy enforcement, and portable production proof are required before the action is trusted.",
|
|
142
|
+
inputSchema: createVercelAiSdkInputSchema({ z }),
|
|
143
|
+
inputExamples: [{
|
|
144
|
+
input: {
|
|
145
|
+
requestId: "agent-action-001",
|
|
146
|
+
intent: {
|
|
147
|
+
type: "memo",
|
|
148
|
+
summary: "Write a devnet memo after human approval"
|
|
149
|
+
},
|
|
150
|
+
serializedTransaction: "<base64-solana-transaction>"
|
|
151
|
+
}
|
|
152
|
+
}]
|
|
153
|
+
};
|
|
154
|
+
|
|
155
|
+
if (needsApproval !== undefined) {
|
|
156
|
+
metadata.needsApproval = needsApproval;
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
return metadata;
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
export function createVercelAiSdkInputSchema({ z = null } = {}) {
|
|
163
|
+
if (z?.object && z?.string && z?.boolean && z?.number && z?.unknown) {
|
|
164
|
+
return z.object({
|
|
165
|
+
requestId: z.string().optional(),
|
|
166
|
+
idempotencyKey: z.string().optional(),
|
|
167
|
+
intent: z.unknown(),
|
|
168
|
+
policyId: z.string().optional(),
|
|
169
|
+
serializedTransaction: z.string(),
|
|
170
|
+
rpcUrl: z.string().optional(),
|
|
171
|
+
simulation: z.unknown().optional(),
|
|
172
|
+
metadata: z.unknown().optional(),
|
|
173
|
+
waitForProof: z.boolean().optional(),
|
|
174
|
+
waitAttempts: z.number().optional(),
|
|
175
|
+
waitIntervalMs: z.number().optional(),
|
|
176
|
+
fetchProof: z.boolean().optional(),
|
|
177
|
+
checkReceiptRegistryChain: z.boolean().optional()
|
|
178
|
+
});
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
return {
|
|
182
|
+
type: "object",
|
|
183
|
+
required: ["intent", "serializedTransaction"],
|
|
184
|
+
properties: {
|
|
185
|
+
requestId: {
|
|
186
|
+
type: "string",
|
|
187
|
+
description: "Stable idempotency key for this AI SDK tool call."
|
|
188
|
+
},
|
|
189
|
+
idempotencyKey: {
|
|
190
|
+
type: "string",
|
|
191
|
+
description: "Optional idempotency override. Defaults to requestId."
|
|
192
|
+
},
|
|
193
|
+
intent: {
|
|
194
|
+
type: "object",
|
|
195
|
+
description: "Human-readable Solana action intent shown to the SVS operator."
|
|
196
|
+
},
|
|
197
|
+
policyId: {
|
|
198
|
+
type: "string",
|
|
199
|
+
description: "SVS policy id to enforce for this action."
|
|
200
|
+
},
|
|
201
|
+
serializedTransaction: {
|
|
202
|
+
type: "string",
|
|
203
|
+
description: "Serialized Solana transaction prepared by the agent."
|
|
204
|
+
},
|
|
205
|
+
rpcUrl: {
|
|
206
|
+
type: "string",
|
|
207
|
+
description: "Solana RPC URL used to simulate or verify the action."
|
|
208
|
+
},
|
|
209
|
+
simulation: {
|
|
210
|
+
type: "object",
|
|
211
|
+
description: "Optional Solana simulation result produced before submitting."
|
|
212
|
+
},
|
|
213
|
+
metadata: {
|
|
214
|
+
type: "object",
|
|
215
|
+
description: "Optional non-secret metadata to include in the approval record."
|
|
216
|
+
},
|
|
217
|
+
waitForProof: {
|
|
218
|
+
type: "boolean",
|
|
219
|
+
description: "Wait for the human/operator path to produce a production proof."
|
|
220
|
+
},
|
|
221
|
+
waitAttempts: {
|
|
222
|
+
type: "number",
|
|
223
|
+
description: "Maximum proof polling attempts."
|
|
224
|
+
},
|
|
225
|
+
waitIntervalMs: {
|
|
226
|
+
type: "number",
|
|
227
|
+
description: "Delay between proof polling attempts."
|
|
228
|
+
},
|
|
229
|
+
fetchProof: {
|
|
230
|
+
type: "boolean",
|
|
231
|
+
description: "Fetch the proof package after proof status becomes ready."
|
|
232
|
+
},
|
|
233
|
+
checkReceiptRegistryChain: {
|
|
234
|
+
type: "boolean",
|
|
235
|
+
description: "Ask SVS to independently check the custom registry proof on-chain."
|
|
236
|
+
}
|
|
237
|
+
}
|
|
238
|
+
};
|
|
239
|
+
}
|
|
240
|
+
|
|
241
|
+
export async function requireSvsVercelAiSdkProductionReady({
|
|
242
|
+
...options
|
|
243
|
+
} = {}) {
|
|
244
|
+
return requireSvsAdapterProductionReady({
|
|
245
|
+
...options,
|
|
246
|
+
readinessVersion: "svs.vercel-ai-sdk-readiness.v1",
|
|
247
|
+
readyMessage: "SVS Vercel AI SDK tool readiness and production certification passed.",
|
|
248
|
+
adapterLabel: "Vercel AI SDK adapter",
|
|
249
|
+
ErrorClass: SvsVercelAiSdkAdapterError
|
|
250
|
+
});
|
|
251
|
+
}
|
|
252
|
+
|
|
253
|
+
export async function verifyAndSubmitVercelAiSdkSolanaAction({
|
|
254
|
+
...options
|
|
255
|
+
} = {}) {
|
|
256
|
+
return verifyAndSubmitSvsAdapterSolanaAction({
|
|
257
|
+
...options,
|
|
258
|
+
adapterVersion: VERCEL_AI_SDK_ADAPTER_VERSION,
|
|
259
|
+
agentFramework: "vercel-ai-sdk",
|
|
260
|
+
resultVersion: "svs.vercel-ai-sdk-action-result.v1",
|
|
261
|
+
readinessVersion: "svs.vercel-ai-sdk-readiness.v1",
|
|
262
|
+
readyMessage: "SVS Vercel AI SDK tool readiness and production certification passed.",
|
|
263
|
+
adapterLabel: "Vercel AI SDK adapter",
|
|
264
|
+
ErrorClass: SvsVercelAiSdkAdapterError
|
|
265
|
+
});
|
|
266
|
+
}
|