@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.
Files changed (38) hide show
  1. package/LICENSE +158 -0
  2. package/README.md +365 -0
  3. package/dist/action-production-proof-evidence.js +553 -0
  4. package/dist/adapter-catalog.d.ts +29 -0
  5. package/dist/adapter-catalog.js +146 -0
  6. package/dist/adapter-core.d.ts +48 -0
  7. package/dist/adapter-core.js +249 -0
  8. package/dist/approval-signature.js +197 -0
  9. package/dist/base58.js +69 -0
  10. package/dist/bot-auth.js +50 -0
  11. package/dist/bot-certification-evidence.js +342 -0
  12. package/dist/bot-first-action-runbook.js +299 -0
  13. package/dist/bot-integration-contract.js +41 -0
  14. package/dist/certified-submit-status.js +176 -0
  15. package/dist/common.d.ts +1135 -0
  16. package/dist/elizaos.d.ts +43 -0
  17. package/dist/elizaos.js +227 -0
  18. package/dist/goat.d.ts +47 -0
  19. package/dist/goat.js +261 -0
  20. package/dist/index.d.ts +330 -0
  21. package/dist/index.js +128 -0
  22. package/dist/protocol.d.ts +205 -0
  23. package/dist/protocol.js +900 -0
  24. package/dist/receipt.js +51 -0
  25. package/dist/signed-proof-read-protection.js +495 -0
  26. package/dist/solana-agent-kit.d.ts +35 -0
  27. package/dist/solana-agent-kit.js +151 -0
  28. package/dist/svs-client.js +1232 -0
  29. package/dist/vercel-ai.d.ts +47 -0
  30. package/dist/vercel-ai.js +266 -0
  31. package/dist/verified-agent-adoption-kit.js +471 -0
  32. package/dist/verified-agent-profile.js +329 -0
  33. package/dist/verified-agent-registry-consumer.js +421 -0
  34. package/dist/verified-agent-registry.d.ts +36 -0
  35. package/dist/verified-agent-registry.js +826 -0
  36. package/dist/verified-agent-trust-score.js +335 -0
  37. package/dist/webhooks.js +834 -0
  38. package/package.json +72 -0
@@ -0,0 +1,41 @@
1
+ import { hashObject } from "./receipt.js";
2
+
3
+ export const BOT_INTEGRATION_CONTRACT_VERSION = "svs.bot-integration-contract.v1";
4
+ export const BOT_INTEGRATION_QUICKSTART_VERSION = "svs.bot-integration-quickstart.v1";
5
+
6
+ export function hashBotIntegrationContract(contract) {
7
+ if (!contract || typeof contract !== "object") {
8
+ return null;
9
+ }
10
+
11
+ return hashObject(normalizeBotIntegrationContractForHash(contract));
12
+ }
13
+
14
+ export function normalizeBotIntegrationContractForHash(value) {
15
+ if (Array.isArray(value)) {
16
+ return value.map(normalizeBotIntegrationContractForHash);
17
+ }
18
+
19
+ if (value && typeof value === "object") {
20
+ return Object.keys(value)
21
+ .filter((key) => key !== "generatedAt")
22
+ .sort()
23
+ .reduce((result, key) => {
24
+ result[key] = normalizeBotIntegrationContractForHash(value[key]);
25
+ return result;
26
+ }, {});
27
+ }
28
+
29
+ if (typeof value === "string") {
30
+ return value.replace(/https?:\/\/[^\s"'<>]+/g, (match) => {
31
+ try {
32
+ const parsed = new URL(match);
33
+ return `<baseUrl>${parsed.pathname}${parsed.search}${parsed.hash}`;
34
+ } catch {
35
+ return "<baseUrl>";
36
+ }
37
+ });
38
+ }
39
+
40
+ return value;
41
+ }
@@ -0,0 +1,176 @@
1
+ export const CERTIFIED_SUBMIT_OPERATOR_STATUS_VERSION = "svs.certified-submit-operator-status.v1";
2
+ export const CERTIFIED_SUBMIT_OPERATOR_READY_STATUSES = Object.freeze([
3
+ "ready",
4
+ "production_ready"
5
+ ]);
6
+
7
+ export function isCertifiedSubmitOperatorStatusReady(certifiedSubmitStatus) {
8
+ return certifiedSubmitStatus?.checkOk === true &&
9
+ certifiedSubmitStatus?.ok === true &&
10
+ CERTIFIED_SUBMIT_OPERATOR_READY_STATUSES.includes(certifiedSubmitStatus?.status);
11
+ }
12
+
13
+ export function createCertifiedSubmitOperatorStatus({
14
+ response,
15
+ serverUrl = null,
16
+ staleAfterMs = null,
17
+ evidenceEndpoint = "/api/bots/certified-submit-evidence",
18
+ statusEndpoint = "/api/bots/certified-submit-status"
19
+ } = {}) {
20
+ const evidence = response?.evidence ?? null;
21
+ const candidate = normalizeCertifiedSubmitOperatorCandidate({
22
+ candidate: response?.candidate ?? null,
23
+ productionActionId: evidence?.actionId ?? null,
24
+ productionReady: response?.ok === true && response?.productionReady === true
25
+ });
26
+ const lifecycle = candidate?.actionLifecycle ?? response?.actionLifecycle ?? evidence?.actionLifecycle ?? null;
27
+ const nextAction = selectCertifiedSubmitNextAction({ response, evidence, candidate, lifecycle });
28
+
29
+ return {
30
+ version: CERTIFIED_SUBMIT_OPERATOR_STATUS_VERSION,
31
+ ok: response?.ok === true,
32
+ status: response?.status ?? "unknown",
33
+ serverUrl,
34
+ staleAfterMs,
35
+ endpoints: {
36
+ status: statusEndpoint,
37
+ evidence: evidenceEndpoint
38
+ },
39
+ production: evidence
40
+ ? summarizeCertifiedSubmitEvidence({
41
+ ...evidence,
42
+ ok: response?.ok,
43
+ productionReady: response?.productionReady,
44
+ proofValidityStatus: response?.proofValidityStatus,
45
+ actionLifecycle: response?.actionLifecycle ?? evidence.actionLifecycle
46
+ })
47
+ : null,
48
+ candidate: candidate?.found
49
+ ? summarizeCertifiedSubmitEvidence(candidate)
50
+ : null,
51
+ nextAction
52
+ };
53
+ }
54
+
55
+ export function normalizeCertifiedSubmitOperatorCandidate({
56
+ candidate,
57
+ productionActionId = null,
58
+ productionReady = false
59
+ } = {}) {
60
+ if (!candidate?.found || !productionReady || !productionActionId || candidate.actionId !== productionActionId) {
61
+ return candidate;
62
+ }
63
+
64
+ return {
65
+ ...candidate,
66
+ ok: true,
67
+ status: "current_production_proof",
68
+ promotionReady: false,
69
+ productionReady: true,
70
+ alreadyPromoted: true,
71
+ nextAction: {
72
+ code: "none",
73
+ message: "Candidate is already the current production certified-submit proof."
74
+ }
75
+ };
76
+ }
77
+
78
+ export function summarizeCertifiedSubmitEvidence(evidence) {
79
+ return {
80
+ ok: evidence?.ok === true || evidence?.productionReady === true,
81
+ status: evidence?.status ?? null,
82
+ botId: evidence?.botId ?? null,
83
+ actionId: evidence?.actionId ?? null,
84
+ evidenceHash: evidence?.evidenceHash ?? null,
85
+ proofValidityStatus: evidence?.proofValidityStatus ?? null,
86
+ productionReady: evidence?.productionReady ?? evidence?.productionProofReady ?? null,
87
+ promotionReady: evidence?.promotionReady ?? null,
88
+ alreadyPromoted: evidence?.alreadyPromoted === true,
89
+ proofWait: {
90
+ enabled: evidence?.productionProofWait?.enabled === true,
91
+ ok: evidence?.productionProofWait?.ok === true,
92
+ status: evidence?.productionProofWait?.status ?? null,
93
+ ready: evidence?.productionProofWait?.ready ?? null,
94
+ proofFetched: evidence?.productionProofWait?.proofFetched ?? null,
95
+ verificationSetHash: evidence?.productionProofWait?.verificationSetHash ?? null,
96
+ helper: evidence?.productionProofWait?.helper ?? null
97
+ },
98
+ actionLifecycle: evidence?.actionLifecycle
99
+ ? {
100
+ ok: evidence.actionLifecycle.ok === true,
101
+ status: evidence.actionLifecycle.status ?? null,
102
+ nextAction: evidence.actionLifecycle.nextAction ?? null,
103
+ humanApproval: evidence.actionLifecycle.humanApproval?.approved ?? null,
104
+ broadcast: evidence.actionLifecycle.broadcast?.confirmed ?? null,
105
+ registry: evidence.actionLifecycle.registry?.confirmed ?? null,
106
+ independentVerification: evidence.actionLifecycle.independentVerification?.verified ?? null
107
+ }
108
+ : null
109
+ };
110
+ }
111
+
112
+ export function selectCertifiedSubmitNextAction({ response, evidence, candidate, lifecycle } = {}) {
113
+ const productionActionId = evidence?.actionId ?? null;
114
+ const promotedCandidateCurrent = response?.ok === true &&
115
+ response?.productionReady === true &&
116
+ candidate?.found === true &&
117
+ candidate?.actionId &&
118
+ candidate.actionId === productionActionId;
119
+
120
+ if (promotedCandidateCurrent) {
121
+ return {
122
+ code: "none",
123
+ message: "Certified-submit production evidence is ready for the latest candidate action."
124
+ };
125
+ }
126
+
127
+ if (candidate?.promotionReady === true) {
128
+ return {
129
+ code: "promote_certified_submit_evidence",
130
+ message: "Candidate action is production verified. Run npm run bot:certified-submit:promote."
131
+ };
132
+ }
133
+
134
+ if (candidate?.found && (
135
+ candidate.proofValidityStatus === "failed" ||
136
+ candidate.status === "failed"
137
+ )) {
138
+ return {
139
+ code: "run_certified_submit",
140
+ message: "Certified-submit candidate evidence is not valid for the current integration contract. Run npm run bot:certified-submit -- --wait-production-proof true --production-proof-check-receipt-registry-chain true."
141
+ };
142
+ }
143
+
144
+ if (candidate?.found && lifecycle?.nextAction) {
145
+ return {
146
+ code: "complete_candidate_action",
147
+ message: lifecycle.nextAction
148
+ };
149
+ }
150
+
151
+ if (response?.proofValidityStatus === "failed" || response?.status === "failed") {
152
+ return {
153
+ code: "run_certified_submit",
154
+ message: "Certified-submit production evidence is not ready. Run npm run bot:certified-submit -- --wait-production-proof true --production-proof-check-receipt-registry-chain true."
155
+ };
156
+ }
157
+
158
+ if (response?.ok === true && response?.productionReady === true) {
159
+ return {
160
+ code: "none",
161
+ message: "Certified-submit production evidence is ready."
162
+ };
163
+ }
164
+
165
+ if (response?.summary) {
166
+ return {
167
+ code: "review_certified_submit_status",
168
+ message: response.summary
169
+ };
170
+ }
171
+
172
+ return {
173
+ code: "run_certified_submit",
174
+ message: "Run npm run bot:certified-submit -- --wait-production-proof true --production-proof-check-receipt-registry-chain true."
175
+ };
176
+ }