@cascade-fyi/sati-sdk 0.6.0 → 0.7.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 +29 -0
- package/README.md +11 -9
- package/dist/index.cjs +644 -14
- package/dist/index.d.cts +410 -3
- package/dist/index.d.cts.map +1 -1
- package/dist/index.d.mts +410 -3
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +643 -15
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -4679,8 +4679,7 @@ function createPinataUploader(jwt) {
|
|
|
4679
4679
|
const verifyResponse = await fetch(`https://gateway.pinata.cloud/ipfs/${cid}`, { signal: AbortSignal.timeout(5e3) });
|
|
4680
4680
|
if (!verifyResponse.ok && verifyResponse.status !== 429) throw new Error(`Pinata returned CID ${cid} but content not accessible on gateway (HTTP ${verifyResponse.status})`);
|
|
4681
4681
|
} catch (verifyError) {
|
|
4682
|
-
if (verifyError instanceof Error &&
|
|
4683
|
-
else throw verifyError;
|
|
4682
|
+
if (verifyError instanceof Error && verifyError.message.includes("not accessible")) throw verifyError;
|
|
4684
4683
|
}
|
|
4685
4684
|
return `ipfs://${cid}`;
|
|
4686
4685
|
} };
|
|
@@ -4874,8 +4873,8 @@ function buildRegistrationFile(params) {
|
|
|
4874
4873
|
* Fetch and parse a registration file from URI.
|
|
4875
4874
|
*
|
|
4876
4875
|
* - Returns null on network errors or invalid URIs
|
|
4877
|
-
* - Validates structure,
|
|
4878
|
-
* - Never throws
|
|
4876
|
+
* - Validates structure, returns raw data for non-conforming files
|
|
4877
|
+
* - Never throws, never logs to console
|
|
4879
4878
|
*/
|
|
4880
4879
|
async function fetchRegistrationFile(uri) {
|
|
4881
4880
|
if (!uri) return null;
|
|
@@ -4885,19 +4884,12 @@ async function fetchRegistrationFile(uri) {
|
|
|
4885
4884
|
else if (!uri.startsWith("http://") && !uri.startsWith("https://")) return null;
|
|
4886
4885
|
try {
|
|
4887
4886
|
const response = await fetch(url);
|
|
4888
|
-
if (!response.ok)
|
|
4889
|
-
console.warn(`[SATI] Failed to fetch metadata from ${url}: ${response.status}`);
|
|
4890
|
-
return null;
|
|
4891
|
-
}
|
|
4887
|
+
if (!response.ok) return null;
|
|
4892
4888
|
const data = await response.json();
|
|
4893
4889
|
const result = RegistrationFileSchema.safeParse(data);
|
|
4894
|
-
if (!result.success)
|
|
4895
|
-
console.warn(`[SATI] Registration file validation issues:`, result.error.issues);
|
|
4896
|
-
return data;
|
|
4897
|
-
}
|
|
4890
|
+
if (!result.success) return data;
|
|
4898
4891
|
return result.data;
|
|
4899
|
-
} catch
|
|
4900
|
-
console.warn(`[SATI] Failed to fetch metadata from ${uri}:`, error);
|
|
4892
|
+
} catch {
|
|
4901
4893
|
return null;
|
|
4902
4894
|
}
|
|
4903
4895
|
}
|
|
@@ -4963,6 +4955,211 @@ function getSatiAgentIds(file) {
|
|
|
4963
4955
|
return file.registrations?.filter((r) => typeof r.agentRegistry === "string" && r.agentRegistry.startsWith(SATI_CHAIN_ID)).map((r) => String(r.agentId)) ?? [];
|
|
4964
4956
|
}
|
|
4965
4957
|
|
|
4958
|
+
//#endregion
|
|
4959
|
+
//#region src/cache.ts
|
|
4960
|
+
var FeedbackCache = class {
|
|
4961
|
+
cache = /* @__PURE__ */ new Map();
|
|
4962
|
+
constructor(ttlMs = 3e4) {
|
|
4963
|
+
this.ttlMs = ttlMs;
|
|
4964
|
+
}
|
|
4965
|
+
/** Get cached data or null if expired/missing. */
|
|
4966
|
+
get(key) {
|
|
4967
|
+
const entry = this.cache.get(key);
|
|
4968
|
+
if (!entry || Date.now() > entry.expires) {
|
|
4969
|
+
if (entry) this.cache.delete(key);
|
|
4970
|
+
return null;
|
|
4971
|
+
}
|
|
4972
|
+
return entry.data;
|
|
4973
|
+
}
|
|
4974
|
+
/** Store data with TTL. */
|
|
4975
|
+
set(key, data) {
|
|
4976
|
+
this.cache.set(key, {
|
|
4977
|
+
data,
|
|
4978
|
+
expires: Date.now() + this.ttlMs
|
|
4979
|
+
});
|
|
4980
|
+
}
|
|
4981
|
+
/** Invalidate a specific key, or all entries if no key given. */
|
|
4982
|
+
invalidate(key) {
|
|
4983
|
+
if (key) this.cache.delete(key);
|
|
4984
|
+
else this.cache.clear();
|
|
4985
|
+
}
|
|
4986
|
+
/** Build a cache key from schema and optional agent mint. */
|
|
4987
|
+
static cacheKey(sasSchema, agentMint) {
|
|
4988
|
+
return `${sasSchema}:${agentMint ?? "*"}`;
|
|
4989
|
+
}
|
|
4990
|
+
};
|
|
4991
|
+
|
|
4992
|
+
//#endregion
|
|
4993
|
+
//#region src/agent-builder.ts
|
|
4994
|
+
var SatiAgentBuilder = class {
|
|
4995
|
+
_params;
|
|
4996
|
+
_identity;
|
|
4997
|
+
_sati;
|
|
4998
|
+
constructor(sati, name, description, image) {
|
|
4999
|
+
this._sati = sati;
|
|
5000
|
+
this._params = {
|
|
5001
|
+
name,
|
|
5002
|
+
description,
|
|
5003
|
+
image,
|
|
5004
|
+
endpoints: [],
|
|
5005
|
+
active: true
|
|
5006
|
+
};
|
|
5007
|
+
}
|
|
5008
|
+
/** Current registration file parameters. */
|
|
5009
|
+
get params() {
|
|
5010
|
+
return this._params;
|
|
5011
|
+
}
|
|
5012
|
+
/** On-chain identity (available after register/load). */
|
|
5013
|
+
get identity() {
|
|
5014
|
+
return this._identity;
|
|
5015
|
+
}
|
|
5016
|
+
/** Set a generic endpoint. */
|
|
5017
|
+
setEndpoint(endpoint) {
|
|
5018
|
+
if (!this._params.endpoints) this._params.endpoints = [];
|
|
5019
|
+
this._params.endpoints = this._params.endpoints.filter((ep) => ep.name !== endpoint.name);
|
|
5020
|
+
this._params.endpoints.push(endpoint);
|
|
5021
|
+
return this;
|
|
5022
|
+
}
|
|
5023
|
+
/**
|
|
5024
|
+
* Set MCP endpoint.
|
|
5025
|
+
*
|
|
5026
|
+
* Unlike agent0-sdk's `SatiAgent.setMCP()`, this does NOT auto-fetch capabilities.
|
|
5027
|
+
* Pass tools/prompts/resources explicitly via the `meta` parameter.
|
|
5028
|
+
*/
|
|
5029
|
+
setMCP(url, version, meta) {
|
|
5030
|
+
return this.setEndpoint({
|
|
5031
|
+
name: "MCP",
|
|
5032
|
+
endpoint: url,
|
|
5033
|
+
...version && { version },
|
|
5034
|
+
...meta?.tools?.length && { mcpTools: meta.tools },
|
|
5035
|
+
...meta?.prompts?.length && { mcpPrompts: meta.prompts },
|
|
5036
|
+
...meta?.resources?.length && { mcpResources: meta.resources }
|
|
5037
|
+
});
|
|
5038
|
+
}
|
|
5039
|
+
/** Set A2A endpoint. */
|
|
5040
|
+
setA2A(url, version, meta) {
|
|
5041
|
+
return this.setEndpoint({
|
|
5042
|
+
name: "A2A",
|
|
5043
|
+
endpoint: url,
|
|
5044
|
+
...version && { version },
|
|
5045
|
+
...meta?.skills?.length && { a2aSkills: meta.skills }
|
|
5046
|
+
});
|
|
5047
|
+
}
|
|
5048
|
+
/** Set wallet endpoint. */
|
|
5049
|
+
setWallet(address$2) {
|
|
5050
|
+
return this.setEndpoint({
|
|
5051
|
+
name: "agentWallet",
|
|
5052
|
+
endpoint: address$2
|
|
5053
|
+
});
|
|
5054
|
+
}
|
|
5055
|
+
/** Remove an endpoint by name. */
|
|
5056
|
+
removeEndpoint(name) {
|
|
5057
|
+
if (this._params.endpoints) this._params.endpoints = this._params.endpoints.filter((ep) => ep.name !== name);
|
|
5058
|
+
return this;
|
|
5059
|
+
}
|
|
5060
|
+
/** Set agent active status. */
|
|
5061
|
+
setActive(active) {
|
|
5062
|
+
this._params.active = active;
|
|
5063
|
+
return this;
|
|
5064
|
+
}
|
|
5065
|
+
/** Set x402 payment support. */
|
|
5066
|
+
setX402Support(x402) {
|
|
5067
|
+
this._params.x402support = x402;
|
|
5068
|
+
return this;
|
|
5069
|
+
}
|
|
5070
|
+
/** Set supported trust mechanisms. */
|
|
5071
|
+
setSupportedTrust(trusts) {
|
|
5072
|
+
this._params.supportedTrust = trusts;
|
|
5073
|
+
return this;
|
|
5074
|
+
}
|
|
5075
|
+
/** Set external URL. */
|
|
5076
|
+
setExternalUrl(url) {
|
|
5077
|
+
this._params.externalUrl = url;
|
|
5078
|
+
return this;
|
|
5079
|
+
}
|
|
5080
|
+
/** Update basic info. */
|
|
5081
|
+
updateInfo(opts) {
|
|
5082
|
+
if (opts.name !== void 0) this._params.name = opts.name;
|
|
5083
|
+
if (opts.description !== void 0) this._params.description = opts.description;
|
|
5084
|
+
if (opts.image !== void 0) this._params.image = opts.image;
|
|
5085
|
+
return this;
|
|
5086
|
+
}
|
|
5087
|
+
/**
|
|
5088
|
+
* Upload registration file and register agent on-chain.
|
|
5089
|
+
*
|
|
5090
|
+
* @returns Registration result with mint address, member number, and signature
|
|
5091
|
+
*/
|
|
5092
|
+
async register(opts) {
|
|
5093
|
+
const uri = await this._sati.uploadRegistrationFile(this._params, opts.uploader);
|
|
5094
|
+
return this._registerWithUri(uri, opts);
|
|
5095
|
+
}
|
|
5096
|
+
/**
|
|
5097
|
+
* Register agent on-chain with a pre-existing URI.
|
|
5098
|
+
*
|
|
5099
|
+
* Use when you already have a hosted registration file.
|
|
5100
|
+
*/
|
|
5101
|
+
async registerWithUri(opts) {
|
|
5102
|
+
return this._registerWithUri(opts.uri, opts);
|
|
5103
|
+
}
|
|
5104
|
+
/**
|
|
5105
|
+
* Re-upload registration file and update the on-chain URI.
|
|
5106
|
+
*
|
|
5107
|
+
* Use after modifying the builder via fluent setters.
|
|
5108
|
+
*/
|
|
5109
|
+
async update(opts) {
|
|
5110
|
+
if (!this._identity) throw new Error("Agent not registered on-chain. Call register() first.");
|
|
5111
|
+
const uri = await this._sati.uploadRegistrationFile(this._params, opts.uploader);
|
|
5112
|
+
return this._updateUri(uri, opts);
|
|
5113
|
+
}
|
|
5114
|
+
/**
|
|
5115
|
+
* Update the on-chain URI to point to a new registration file.
|
|
5116
|
+
*/
|
|
5117
|
+
async updateUri(opts) {
|
|
5118
|
+
if (!this._identity) throw new Error("Agent not registered on-chain. Call register() first.");
|
|
5119
|
+
return this._updateUri(opts.uri, opts);
|
|
5120
|
+
}
|
|
5121
|
+
/**
|
|
5122
|
+
* Load existing on-chain identity into this builder.
|
|
5123
|
+
* Useful for wrapping an already-registered agent.
|
|
5124
|
+
*/
|
|
5125
|
+
setIdentity(identity) {
|
|
5126
|
+
this._identity = identity;
|
|
5127
|
+
return this;
|
|
5128
|
+
}
|
|
5129
|
+
async _registerWithUri(uri, opts) {
|
|
5130
|
+
if (this._identity) throw new Error("Agent is already registered on-chain. Use update() instead.");
|
|
5131
|
+
const result = await this._sati.registerAgent({
|
|
5132
|
+
payer: opts.payer,
|
|
5133
|
+
name: this._params.name,
|
|
5134
|
+
uri,
|
|
5135
|
+
nonTransferable: opts.nonTransferable,
|
|
5136
|
+
owner: opts.owner
|
|
5137
|
+
});
|
|
5138
|
+
this._identity = {
|
|
5139
|
+
mint: result.mint,
|
|
5140
|
+
owner: opts.owner ?? opts.payer.address,
|
|
5141
|
+
name: this._params.name,
|
|
5142
|
+
uri,
|
|
5143
|
+
memberNumber: result.memberNumber,
|
|
5144
|
+
additionalMetadata: {},
|
|
5145
|
+
nonTransferable: opts.nonTransferable ?? false
|
|
5146
|
+
};
|
|
5147
|
+
return result;
|
|
5148
|
+
}
|
|
5149
|
+
async _updateUri(uri, opts) {
|
|
5150
|
+
const identity = this._identity;
|
|
5151
|
+
if (!identity) throw new Error("Agent not registered on-chain. Call register() first.");
|
|
5152
|
+
const result = await this._sati.updateAgentMetadata({
|
|
5153
|
+
payer: opts.payer,
|
|
5154
|
+
owner: opts.owner,
|
|
5155
|
+
mint: identity.mint,
|
|
5156
|
+
updates: { uri }
|
|
5157
|
+
});
|
|
5158
|
+
identity.uri = uri;
|
|
5159
|
+
return { signature: result.signature };
|
|
5160
|
+
}
|
|
5161
|
+
};
|
|
5162
|
+
|
|
4966
5163
|
//#endregion
|
|
4967
5164
|
//#region src/client.ts
|
|
4968
5165
|
/**
|
|
@@ -5054,6 +5251,9 @@ var Sati = class {
|
|
|
5054
5251
|
rpcSubscriptions;
|
|
5055
5252
|
sendAndConfirm;
|
|
5056
5253
|
lightClient;
|
|
5254
|
+
_deployedConfig;
|
|
5255
|
+
_feedbackCache = new FeedbackCache();
|
|
5256
|
+
_onWarning;
|
|
5057
5257
|
/** Network configuration */
|
|
5058
5258
|
network;
|
|
5059
5259
|
constructor(options) {
|
|
@@ -5067,6 +5267,8 @@ var Sati = class {
|
|
|
5067
5267
|
rpcSubscriptions: this.rpcSubscriptions
|
|
5068
5268
|
});
|
|
5069
5269
|
this.lightClient = createSATILightClient(options.photonRpcUrl ?? PHOTON_URLS[options.network]);
|
|
5270
|
+
this._deployedConfig = loadDeployedConfig(options.network);
|
|
5271
|
+
this._onWarning = options.onWarning;
|
|
5070
5272
|
}
|
|
5071
5273
|
/** @internal */
|
|
5072
5274
|
getRpc() {
|
|
@@ -6186,6 +6388,432 @@ var Sati = class {
|
|
|
6186
6388
|
await this.sendAndConfirm(signedTx, { commitment: "confirmed" });
|
|
6187
6389
|
return signature;
|
|
6188
6390
|
}
|
|
6391
|
+
/** Deployed SAS configuration for this network (null for localnet unless deployed). */
|
|
6392
|
+
get deployedConfig() {
|
|
6393
|
+
return this._deployedConfig;
|
|
6394
|
+
}
|
|
6395
|
+
/** FeedbackPublic schema address (CounterpartySigned mode). */
|
|
6396
|
+
get feedbackPublicSchema() {
|
|
6397
|
+
return this._deployedConfig?.schemas.feedbackPublic;
|
|
6398
|
+
}
|
|
6399
|
+
/** Feedback schema address (DualSignature mode). */
|
|
6400
|
+
get feedbackSchema() {
|
|
6401
|
+
return this._deployedConfig?.schemas.feedback;
|
|
6402
|
+
}
|
|
6403
|
+
/** Validation schema address. */
|
|
6404
|
+
get validationSchema() {
|
|
6405
|
+
return this._deployedConfig?.schemas.validation;
|
|
6406
|
+
}
|
|
6407
|
+
/** Address Lookup Table for transaction compression. */
|
|
6408
|
+
get lookupTable() {
|
|
6409
|
+
return this._deployedConfig?.lookupTable;
|
|
6410
|
+
}
|
|
6411
|
+
/**
|
|
6412
|
+
* Give feedback to an agent (simplified).
|
|
6413
|
+
*
|
|
6414
|
+
* Uses FeedbackPublicV1 schema (CounterpartySigned mode).
|
|
6415
|
+
* Automatically handles SIWS message construction and signing.
|
|
6416
|
+
*
|
|
6417
|
+
* @example
|
|
6418
|
+
* ```typescript
|
|
6419
|
+
* const result = await sati.giveFeedback({
|
|
6420
|
+
* payer: myKeypair,
|
|
6421
|
+
* agentMint: address("Agent..."),
|
|
6422
|
+
* score: 85,
|
|
6423
|
+
* tags: ["quality", "speed"],
|
|
6424
|
+
* message: "Great response time",
|
|
6425
|
+
* });
|
|
6426
|
+
* ```
|
|
6427
|
+
*/
|
|
6428
|
+
async giveFeedback(params) {
|
|
6429
|
+
const schema = this._requireFeedbackPublicSchema();
|
|
6430
|
+
const payer = params.payer;
|
|
6431
|
+
if (params.score !== void 0 && (!Number.isFinite(params.score) || params.score < 0 || params.score > 100)) throw new Error(`Feedback score must be a finite number between 0 and 100, got: ${params.score}`);
|
|
6432
|
+
const contentObj = {};
|
|
6433
|
+
if (params.score !== void 0) contentObj.score = params.score;
|
|
6434
|
+
if (params.tags?.length) contentObj.tags = params.tags;
|
|
6435
|
+
if (params.endpoint) contentObj.endpoint = params.endpoint;
|
|
6436
|
+
if (params.message) contentObj.m = params.message;
|
|
6437
|
+
const content = Object.keys(contentObj).length > 0 ? new TextEncoder().encode(JSON.stringify(contentObj)) : new Uint8Array(0);
|
|
6438
|
+
const contentType = content.length > 0 ? ContentType.JSON : ContentType.None;
|
|
6439
|
+
const taskRef = params.taskRef ?? globalThis.crypto.getRandomValues(new Uint8Array(32));
|
|
6440
|
+
const outcome = params.outcome ?? Outcome.Neutral;
|
|
6441
|
+
const { messageBytes } = buildCounterpartyMessage({
|
|
6442
|
+
schemaName: "FeedbackPublicV1",
|
|
6443
|
+
data: serializeFeedback({
|
|
6444
|
+
taskRef,
|
|
6445
|
+
agentMint: params.agentMint,
|
|
6446
|
+
counterparty: payer.address,
|
|
6447
|
+
dataHash: zeroDataHash$1(),
|
|
6448
|
+
outcome,
|
|
6449
|
+
contentType,
|
|
6450
|
+
content
|
|
6451
|
+
})
|
|
6452
|
+
});
|
|
6453
|
+
const sig = await signBytes(payer.keyPair.privateKey, messageBytes);
|
|
6454
|
+
const result = await this.createFeedback({
|
|
6455
|
+
payer,
|
|
6456
|
+
sasSchema: schema,
|
|
6457
|
+
taskRef,
|
|
6458
|
+
agentMint: params.agentMint,
|
|
6459
|
+
counterparty: payer.address,
|
|
6460
|
+
dataHash: zeroDataHash$1(),
|
|
6461
|
+
outcome,
|
|
6462
|
+
contentType,
|
|
6463
|
+
content,
|
|
6464
|
+
agentSignature: {
|
|
6465
|
+
pubkey: payer.address,
|
|
6466
|
+
signature: new Uint8Array(sig)
|
|
6467
|
+
},
|
|
6468
|
+
counterpartyMessage: messageBytes,
|
|
6469
|
+
lookupTableAddress: this._deployedConfig?.lookupTable
|
|
6470
|
+
});
|
|
6471
|
+
this._feedbackCache.invalidate();
|
|
6472
|
+
return {
|
|
6473
|
+
signature: result.signature,
|
|
6474
|
+
attestationAddress: result.address
|
|
6475
|
+
};
|
|
6476
|
+
}
|
|
6477
|
+
/**
|
|
6478
|
+
* Prepare feedback for browser wallet signing.
|
|
6479
|
+
*
|
|
6480
|
+
* Returns SIWS message bytes that the counterparty must sign externally.
|
|
6481
|
+
* Pass the result + signature to `submitPreparedFeedback()`.
|
|
6482
|
+
*/
|
|
6483
|
+
async prepareFeedback(params) {
|
|
6484
|
+
const schema = this._requireFeedbackPublicSchema();
|
|
6485
|
+
if (params.score !== void 0 && (!Number.isFinite(params.score) || params.score < 0 || params.score > 100)) throw new Error(`Feedback score must be a finite number between 0 and 100, got: ${params.score}`);
|
|
6486
|
+
const contentObj = {};
|
|
6487
|
+
if (params.score !== void 0) contentObj.score = params.score;
|
|
6488
|
+
if (params.tags?.length) contentObj.tags = params.tags;
|
|
6489
|
+
if (params.endpoint) contentObj.endpoint = params.endpoint;
|
|
6490
|
+
if (params.message) contentObj.m = params.message;
|
|
6491
|
+
const content = Object.keys(contentObj).length > 0 ? new TextEncoder().encode(JSON.stringify(contentObj)) : new Uint8Array(0);
|
|
6492
|
+
const contentType = content.length > 0 ? ContentType.JSON : ContentType.None;
|
|
6493
|
+
const taskRef = params.taskRef ?? globalThis.crypto.getRandomValues(new Uint8Array(32));
|
|
6494
|
+
const outcome = params.outcome ?? Outcome.Neutral;
|
|
6495
|
+
const { messageBytes } = buildCounterpartyMessage({
|
|
6496
|
+
schemaName: "FeedbackPublicV1",
|
|
6497
|
+
data: serializeFeedback({
|
|
6498
|
+
taskRef,
|
|
6499
|
+
agentMint: params.agentMint,
|
|
6500
|
+
counterparty: params.counterparty,
|
|
6501
|
+
dataHash: zeroDataHash$1(),
|
|
6502
|
+
outcome,
|
|
6503
|
+
contentType,
|
|
6504
|
+
content
|
|
6505
|
+
})
|
|
6506
|
+
});
|
|
6507
|
+
return {
|
|
6508
|
+
messageBytes,
|
|
6509
|
+
agentMint: params.agentMint,
|
|
6510
|
+
counterparty: params.counterparty,
|
|
6511
|
+
taskRef,
|
|
6512
|
+
dataHash: zeroDataHash$1(),
|
|
6513
|
+
outcome,
|
|
6514
|
+
contentType,
|
|
6515
|
+
content,
|
|
6516
|
+
sasSchema: schema,
|
|
6517
|
+
lookupTable: this._deployedConfig?.lookupTable,
|
|
6518
|
+
meta: {
|
|
6519
|
+
score: params.score,
|
|
6520
|
+
tags: params.tags ? [...params.tags] : void 0,
|
|
6521
|
+
message: params.message,
|
|
6522
|
+
endpoint: params.endpoint
|
|
6523
|
+
}
|
|
6524
|
+
};
|
|
6525
|
+
}
|
|
6526
|
+
/**
|
|
6527
|
+
* Submit prepared feedback with an externally-obtained wallet signature.
|
|
6528
|
+
*
|
|
6529
|
+
* The payer signs the transaction and pays gas. The counterparty's SIWS
|
|
6530
|
+
* signature (from wallet) proves consent.
|
|
6531
|
+
*/
|
|
6532
|
+
async submitPreparedFeedback(params) {
|
|
6533
|
+
const { payer, prepared, counterpartySignature } = params;
|
|
6534
|
+
const result = await this.createFeedback({
|
|
6535
|
+
payer,
|
|
6536
|
+
sasSchema: prepared.sasSchema,
|
|
6537
|
+
taskRef: prepared.taskRef,
|
|
6538
|
+
agentMint: prepared.agentMint,
|
|
6539
|
+
counterparty: prepared.counterparty,
|
|
6540
|
+
dataHash: prepared.dataHash,
|
|
6541
|
+
outcome: prepared.outcome,
|
|
6542
|
+
contentType: prepared.contentType,
|
|
6543
|
+
content: prepared.content,
|
|
6544
|
+
agentSignature: {
|
|
6545
|
+
pubkey: prepared.counterparty,
|
|
6546
|
+
signature: new Uint8Array(counterpartySignature)
|
|
6547
|
+
},
|
|
6548
|
+
counterpartyMessage: prepared.messageBytes,
|
|
6549
|
+
lookupTableAddress: prepared.lookupTable
|
|
6550
|
+
});
|
|
6551
|
+
this._feedbackCache.invalidate();
|
|
6552
|
+
return {
|
|
6553
|
+
signature: result.signature,
|
|
6554
|
+
attestationAddress: result.address
|
|
6555
|
+
};
|
|
6556
|
+
}
|
|
6557
|
+
/**
|
|
6558
|
+
* Revoke (close) a feedback attestation by its compressed account address.
|
|
6559
|
+
*
|
|
6560
|
+
* The payer must be the counterparty who originally submitted the feedback.
|
|
6561
|
+
* Closed attestations are permanently deleted.
|
|
6562
|
+
*/
|
|
6563
|
+
async revokeFeedback(params) {
|
|
6564
|
+
const schema = this._deployedConfig?.schemas.feedbackPublic ?? this._deployedConfig?.schemas.feedback;
|
|
6565
|
+
if (!schema) throw new Error(`No feedback schema deployed for network "${this.network}"`);
|
|
6566
|
+
const result = await this.closeCompressedAttestation({
|
|
6567
|
+
payer: params.payer,
|
|
6568
|
+
counterparty: params.payer,
|
|
6569
|
+
sasSchema: schema,
|
|
6570
|
+
attestationAddress: params.attestationAddress,
|
|
6571
|
+
lookupTableAddress: this._deployedConfig?.lookupTable
|
|
6572
|
+
});
|
|
6573
|
+
this._feedbackCache.invalidate();
|
|
6574
|
+
return { signature: result.signature };
|
|
6575
|
+
}
|
|
6576
|
+
/**
|
|
6577
|
+
* Search feedback attestations with client-side filtering.
|
|
6578
|
+
*
|
|
6579
|
+
* Note: `createdAt` timestamps are approximate - derived from Solana slot
|
|
6580
|
+
* numbers using ~400ms/slot estimate.
|
|
6581
|
+
*
|
|
6582
|
+
* @example
|
|
6583
|
+
* ```typescript
|
|
6584
|
+
* const feedbacks = await sati.searchFeedback({
|
|
6585
|
+
* agentMint: address("Agent..."),
|
|
6586
|
+
* tags: ["quality"],
|
|
6587
|
+
* minScore: 70,
|
|
6588
|
+
* });
|
|
6589
|
+
* ```
|
|
6590
|
+
*/
|
|
6591
|
+
async searchFeedback(options) {
|
|
6592
|
+
const schema = this._deployedConfig?.schemas.feedbackPublic ?? this._deployedConfig?.schemas.feedback;
|
|
6593
|
+
if (!schema) throw new Error(`No feedback schema deployed for network "${this.network}"`);
|
|
6594
|
+
const filter = { sasSchema: schema };
|
|
6595
|
+
if (options?.agentMint) filter.agentMint = options.agentMint;
|
|
6596
|
+
if (options?.counterparty) filter.counterparty = options.counterparty;
|
|
6597
|
+
const cacheKey = FeedbackCache.cacheKey(schema, options?.agentMint);
|
|
6598
|
+
const cached = this._feedbackCache.get(cacheKey);
|
|
6599
|
+
const result = cached ?? await this.listFeedbacks(filter);
|
|
6600
|
+
if (!cached) this._feedbackCache.set(cacheKey, result);
|
|
6601
|
+
const currentSlot = await this.rpc.getSlot({ commitment: "confirmed" }).send();
|
|
6602
|
+
const nowSec = Math.floor(Date.now() / 1e3);
|
|
6603
|
+
const feedbacks = [];
|
|
6604
|
+
for (const item of result.items) {
|
|
6605
|
+
const rawContent = this._parseContentJson(item.data.content, item.data.contentType);
|
|
6606
|
+
const score = rawContent?.score;
|
|
6607
|
+
const tags = rawContent?.tags ?? [];
|
|
6608
|
+
const message = rawContent?.m;
|
|
6609
|
+
const endpoint = rawContent?.endpoint;
|
|
6610
|
+
if (options?.tags?.length) {
|
|
6611
|
+
if (!options.tags.every((t) => tags.includes(t))) continue;
|
|
6612
|
+
}
|
|
6613
|
+
if (options?.minScore !== void 0 && (score === void 0 || score < options.minScore)) continue;
|
|
6614
|
+
if (options?.maxScore !== void 0 && (score === void 0 || score > options.maxScore)) continue;
|
|
6615
|
+
const slotDiff = Number(BigInt(currentSlot) - item.raw.slotCreated);
|
|
6616
|
+
const createdAt = nowSec - Math.floor(slotDiff * .4);
|
|
6617
|
+
const [compressedAddress] = getAddressDecoder().read(item.address, 0);
|
|
6618
|
+
feedbacks.push({
|
|
6619
|
+
compressedAddress,
|
|
6620
|
+
agentMint: item.data.agentMint,
|
|
6621
|
+
counterparty: item.data.counterparty,
|
|
6622
|
+
outcome: item.data.outcome,
|
|
6623
|
+
score,
|
|
6624
|
+
tags,
|
|
6625
|
+
message,
|
|
6626
|
+
endpoint,
|
|
6627
|
+
createdAt
|
|
6628
|
+
});
|
|
6629
|
+
}
|
|
6630
|
+
if (options?.includeTxHash) {
|
|
6631
|
+
const photon = this.getLightClient().getRpc();
|
|
6632
|
+
await Promise.all(feedbacks.map(async (fb) => {
|
|
6633
|
+
try {
|
|
6634
|
+
fb.txSignature = (await photon.getCompressionSignaturesForAddress(fb.compressedAddress, { limit: 1 })).items[0]?.signature;
|
|
6635
|
+
} catch (error) {
|
|
6636
|
+
this._warn({
|
|
6637
|
+
code: "SIGNATURE_LOOKUP_FAILED",
|
|
6638
|
+
message: "Failed to fetch tx signature",
|
|
6639
|
+
context: fb.compressedAddress,
|
|
6640
|
+
cause: error
|
|
6641
|
+
});
|
|
6642
|
+
}
|
|
6643
|
+
}));
|
|
6644
|
+
}
|
|
6645
|
+
return feedbacks;
|
|
6646
|
+
}
|
|
6647
|
+
/**
|
|
6648
|
+
* Get reputation summary for an agent.
|
|
6649
|
+
*
|
|
6650
|
+
* Aggregates feedback scores, optionally filtered by tags.
|
|
6651
|
+
*
|
|
6652
|
+
* @example
|
|
6653
|
+
* ```typescript
|
|
6654
|
+
* const summary = await sati.getReputationSummary(address("Agent..."));
|
|
6655
|
+
* console.log(`${summary.count} reviews, avg ${summary.averageScore}`);
|
|
6656
|
+
* ```
|
|
6657
|
+
*/
|
|
6658
|
+
async getReputationSummary(agentMint, tags) {
|
|
6659
|
+
const schema = this._deployedConfig?.schemas.feedbackPublic ?? this._deployedConfig?.schemas.feedback;
|
|
6660
|
+
if (!schema) throw new Error(`No feedback schema deployed for network "${this.network}"`);
|
|
6661
|
+
const cacheKey = FeedbackCache.cacheKey(schema, agentMint);
|
|
6662
|
+
const cached = this._feedbackCache.get(cacheKey);
|
|
6663
|
+
const result = cached ?? await this.listFeedbacks({
|
|
6664
|
+
sasSchema: schema,
|
|
6665
|
+
agentMint
|
|
6666
|
+
});
|
|
6667
|
+
if (!cached) this._feedbackCache.set(cacheKey, result);
|
|
6668
|
+
if (result.items.length === 0) return {
|
|
6669
|
+
count: 0,
|
|
6670
|
+
averageScore: 0
|
|
6671
|
+
};
|
|
6672
|
+
let sum = 0;
|
|
6673
|
+
let count = 0;
|
|
6674
|
+
for (const item of result.items) {
|
|
6675
|
+
const rawContent = this._parseContentJson(item.data.content, item.data.contentType);
|
|
6676
|
+
const score = rawContent?.score;
|
|
6677
|
+
const itemTags = rawContent?.tags ?? [];
|
|
6678
|
+
if (tags?.length && !tags.every((t) => itemTags.includes(t))) continue;
|
|
6679
|
+
if (score !== void 0) {
|
|
6680
|
+
sum += score;
|
|
6681
|
+
count++;
|
|
6682
|
+
}
|
|
6683
|
+
}
|
|
6684
|
+
return {
|
|
6685
|
+
count,
|
|
6686
|
+
averageScore: count > 0 ? sum / count : 0
|
|
6687
|
+
};
|
|
6688
|
+
}
|
|
6689
|
+
/**
|
|
6690
|
+
* Search validation attestations for an agent.
|
|
6691
|
+
*
|
|
6692
|
+
* Note: `createdAt` timestamps are approximate.
|
|
6693
|
+
*/
|
|
6694
|
+
async searchValidations(agentMint) {
|
|
6695
|
+
const validationSchema = this._deployedConfig?.schemas.validation;
|
|
6696
|
+
if (!validationSchema) throw new Error(`No validation schema deployed for network "${this.network}"`);
|
|
6697
|
+
const result = await this.listValidations({
|
|
6698
|
+
sasSchema: validationSchema,
|
|
6699
|
+
agentMint
|
|
6700
|
+
});
|
|
6701
|
+
const currentSlot = await this.rpc.getSlot({ commitment: "confirmed" }).send();
|
|
6702
|
+
const nowSec = Math.floor(Date.now() / 1e3);
|
|
6703
|
+
return result.items.map((item) => {
|
|
6704
|
+
const slotDiff = Number(BigInt(currentSlot) - item.raw.slotCreated);
|
|
6705
|
+
const createdAt = nowSec - Math.floor(slotDiff * .4);
|
|
6706
|
+
const [compressedAddress] = getAddressDecoder().read(item.address, 0);
|
|
6707
|
+
return {
|
|
6708
|
+
compressedAddress,
|
|
6709
|
+
agentMint: item.data.agentMint,
|
|
6710
|
+
counterparty: item.data.counterparty,
|
|
6711
|
+
outcome: item.data.outcome,
|
|
6712
|
+
createdAt
|
|
6713
|
+
};
|
|
6714
|
+
});
|
|
6715
|
+
}
|
|
6716
|
+
/**
|
|
6717
|
+
* Search registered agents with filtering and optional feedback stats.
|
|
6718
|
+
*
|
|
6719
|
+
* @example
|
|
6720
|
+
* ```typescript
|
|
6721
|
+
* const agents = await sati.searchAgents({
|
|
6722
|
+
* endpointTypes: ["MCP"],
|
|
6723
|
+
* active: true,
|
|
6724
|
+
* includeFeedbackStats: true,
|
|
6725
|
+
* });
|
|
6726
|
+
* ```
|
|
6727
|
+
*/
|
|
6728
|
+
async searchAgents(options) {
|
|
6729
|
+
const limit = options?.limit ?? 100;
|
|
6730
|
+
const offset = options?.offset;
|
|
6731
|
+
let agents;
|
|
6732
|
+
if (options?.owner) agents = await this.listAgentsByOwner(options.owner);
|
|
6733
|
+
else agents = await this.listAllAgents({
|
|
6734
|
+
limit,
|
|
6735
|
+
offset
|
|
6736
|
+
});
|
|
6737
|
+
if (options?.name) {
|
|
6738
|
+
const lower = options.name.toLowerCase();
|
|
6739
|
+
agents = agents.filter((a) => a.name.toLowerCase().includes(lower));
|
|
6740
|
+
}
|
|
6741
|
+
const regFiles = !!(options?.active !== void 0 || options?.endpointTypes?.length) || options?.includeFeedbackStats ? await Promise.all(agents.map(async (a) => {
|
|
6742
|
+
try {
|
|
6743
|
+
return await fetchRegistrationFile(a.uri);
|
|
6744
|
+
} catch {
|
|
6745
|
+
return null;
|
|
6746
|
+
}
|
|
6747
|
+
})) : agents.map(() => null);
|
|
6748
|
+
const filtered = [];
|
|
6749
|
+
for (let i = 0; i < agents.length; i++) {
|
|
6750
|
+
const identity = agents[i];
|
|
6751
|
+
const regFile = regFiles[i];
|
|
6752
|
+
const endpoints = regFile?.endpoints ?? [];
|
|
6753
|
+
if (options?.active !== void 0 && (regFile?.active ?? true) !== options.active) continue;
|
|
6754
|
+
if (options?.endpointTypes?.length) {
|
|
6755
|
+
if (!options.endpointTypes.every((type) => endpoints.some((e) => e.name.toUpperCase() === type.toUpperCase()))) continue;
|
|
6756
|
+
}
|
|
6757
|
+
filtered.push({
|
|
6758
|
+
identity,
|
|
6759
|
+
regFile
|
|
6760
|
+
});
|
|
6761
|
+
}
|
|
6762
|
+
let statsMap = null;
|
|
6763
|
+
if (options?.includeFeedbackStats && this._deployedConfig && filtered.length > 0) {
|
|
6764
|
+
statsMap = /* @__PURE__ */ new Map();
|
|
6765
|
+
await Promise.all(filtered.map(async ({ identity }) => {
|
|
6766
|
+
try {
|
|
6767
|
+
const summary = await this.getReputationSummary(identity.mint);
|
|
6768
|
+
statsMap?.set(identity.mint, summary);
|
|
6769
|
+
} catch (error) {
|
|
6770
|
+
this._warn({
|
|
6771
|
+
code: "RPC_ERROR",
|
|
6772
|
+
message: "Failed to fetch feedback stats",
|
|
6773
|
+
context: identity.mint,
|
|
6774
|
+
cause: error
|
|
6775
|
+
});
|
|
6776
|
+
}
|
|
6777
|
+
}));
|
|
6778
|
+
}
|
|
6779
|
+
return filtered.map(({ identity, regFile }) => ({
|
|
6780
|
+
identity,
|
|
6781
|
+
registrationFile: regFile,
|
|
6782
|
+
...statsMap && { feedbackStats: statsMap.get(identity.mint) }
|
|
6783
|
+
}));
|
|
6784
|
+
}
|
|
6785
|
+
/**
|
|
6786
|
+
* Create a fluent builder for agent registration.
|
|
6787
|
+
*
|
|
6788
|
+
* @example
|
|
6789
|
+
* ```typescript
|
|
6790
|
+
* const builder = sati.createAgentBuilder("MyAgent", "AI assistant", "https://example.com/avatar.png");
|
|
6791
|
+
* builder.setMCP("https://mcp.example.com").setActive(true);
|
|
6792
|
+
* const result = await builder.register({ payer, uploader: createSatiUploader() });
|
|
6793
|
+
* ```
|
|
6794
|
+
*/
|
|
6795
|
+
createAgentBuilder(name, description, image) {
|
|
6796
|
+
return new SatiAgentBuilder(this, name, description, image);
|
|
6797
|
+
}
|
|
6798
|
+
/** Safely parse JSON content from an attestation. */
|
|
6799
|
+
_parseContentJson(content, contentType) {
|
|
6800
|
+
if (contentType !== ContentType.JSON || content.length === 0) return null;
|
|
6801
|
+
try {
|
|
6802
|
+
return JSON.parse(new TextDecoder().decode(content));
|
|
6803
|
+
} catch {
|
|
6804
|
+
return null;
|
|
6805
|
+
}
|
|
6806
|
+
}
|
|
6807
|
+
/** Fire a non-fatal warning. */
|
|
6808
|
+
_warn(warning) {
|
|
6809
|
+
this._onWarning?.(warning);
|
|
6810
|
+
}
|
|
6811
|
+
/** Get the FeedbackPublic schema address or throw. */
|
|
6812
|
+
_requireFeedbackPublicSchema() {
|
|
6813
|
+
const schema = this._deployedConfig?.schemas.feedbackPublic;
|
|
6814
|
+
if (!schema) throw new Error(`No FeedbackPublic schema deployed for network "${this.network}". Pass sasSchema explicitly via the low-level createFeedback() method.`);
|
|
6815
|
+
return schema;
|
|
6816
|
+
}
|
|
6189
6817
|
};
|
|
6190
6818
|
|
|
6191
6819
|
//#endregion
|
|
@@ -6352,5 +6980,5 @@ function handleTransactionError(error) {
|
|
|
6352
6980
|
}
|
|
6353
6981
|
|
|
6354
6982
|
//#endregion
|
|
6355
|
-
export { AGENT_INDEX_DISCRIMINATOR, ASSOCIATED_TOKEN_PROGRAM_ADDRESS, ATTESTATION_SEED, AgentNotFoundError, BASE_OFFSETS, CLOSE_COMPRESSED_ATTESTATION_DISCRIMINATOR, CLOSE_REGULAR_ATTESTATION_DISCRIMINATOR, COMPRESSED_OFFSETS, CREATE_COMPRESSED_ATTESTATION_DISCRIMINATOR, CREATE_REGULAR_ATTESTATION_DISCRIMINATOR, CREDENTIAL_SEED, ContentType, DOMAINS, DataType, DuplicateAttestationError, ED25519_PROGRAM_ADDRESS, ENCRYPTION_VERSION, FEEDBACK_OFFSETS, INITIALIZE_DISCRIMINATOR, LIGHT_ERROR_CODES, LINK_EVM_ADDRESS_DISCRIMINATOR, MAX_CONTENT_SIZE, MAX_DUAL_SIGNATURE_CONTENT_SIZE, MAX_PLAINTEXT_SIZE, MAX_SINGLE_SIGNATURE_CONTENT_SIZE, MIN_BASE_LAYOUT_SIZE, MIN_ENCRYPTED_SIZE, NONCE_SIZE, OFFSETS, Outcome, PRIVKEY_SIZE, PUBKEY_SIZE, REGISTER_AGENT_DISCRIMINATOR, REGISTER_SCHEMA_CONFIG_DISCRIMINATOR, REGISTRY_CONFIG_DISCRIMINATOR, REPUTATION_SCHEMA_NAME, REPUTATION_SCHEMA_VERSION, REPUTATION_SCORE_OFFSETS, SAS_DATA_LEN_OFFSET, SAS_HEADER_SIZE, SAS_PROGRAM_ADDRESS, SATILightClientImpl, SATI_ATTESTATION_SEED, SATI_CHAIN_ID, SATI_ERROR__AGENT_ATA_EMPTY, SATI_ERROR__AGENT_ATA_MINT_MISMATCH, SATI_ERROR__AGENT_ATA_REQUIRED, SATI_ERROR__AGENT_MINT_ACCOUNT_MISMATCH, SATI_ERROR__AGENT_MINT_MISMATCH, SATI_ERROR__AGENT_SIGNATURE_NOT_FOUND, SATI_ERROR__ATTESTATION_DATA_TOO_LARGE, SATI_ERROR__ATTESTATION_DATA_TOO_SMALL, SATI_ERROR__ATTESTATION_NOT_CLOSEABLE, SATI_ERROR__CONTENT_TOO_LARGE, SATI_ERROR__COUNTERPARTY_SIGNATURE_NOT_FOUND, SATI_ERROR__DELEGATE_MISMATCH, SATI_ERROR__DELEGATION_ATTESTATION_REQUIRED, SATI_ERROR__DELEGATION_EXPIRED, SATI_ERROR__DELEGATION_OWNER_MISMATCH, SATI_ERROR__DUPLICATE_SIGNERS, SATI_ERROR__ED25519_INSTRUCTION_NOT_FOUND, SATI_ERROR__EVM_ADDRESS_MISMATCH, SATI_ERROR__IMMUTABLE_AUTHORITY, SATI_ERROR__INVALID_AUTHORITY, SATI_ERROR__INVALID_CONTENT_TYPE, SATI_ERROR__INVALID_DELEGATION_P_D_A, SATI_ERROR__INVALID_ED25519_INSTRUCTION, SATI_ERROR__INVALID_EVM_ADDRESS_RECOVERY, SATI_ERROR__INVALID_GROUP_MINT, SATI_ERROR__INVALID_INSTRUCTIONS_SYSVAR, SATI_ERROR__INVALID_OUTCOME, SATI_ERROR__INVALID_SECP256K1_SIGNATURE, SATI_ERROR__INVALID_SIGNATURE, SATI_ERROR__INVALID_SIGNATURE_COUNT, SATI_ERROR__LIGHT_CPI_INVOCATION_FAILED, SATI_ERROR__MESSAGE_MISMATCH, SATI_ERROR__METADATA_KEY_TOO_LONG, SATI_ERROR__METADATA_VALUE_TOO_LONG, SATI_ERROR__MINT_AUTHORITY_NOT_RENOUNCED, SATI_ERROR__MISSING_SIGNATURES, SATI_ERROR__NAME_TOO_LONG, SATI_ERROR__OVERFLOW, SATI_ERROR__OWNER_ONLY, SATI_ERROR__SCHEMA_CONFIG_NOT_FOUND, SATI_ERROR__SECP256K1_RECOVERY_FAILED, SATI_ERROR__SELF_ATTESTATION_NOT_ALLOWED, SATI_ERROR__SIGNATURE_MISMATCH, SATI_ERROR__STORAGE_TYPE_MISMATCH, SATI_ERROR__STORAGE_TYPE_NOT_SUPPORTED, SATI_ERROR__SYMBOL_TOO_LONG, SATI_ERROR__TOO_MANY_METADATA_ENTRIES, SATI_ERROR__UNAUTHORIZED_CLOSE, SATI_ERROR__UNSUPPORTED_LAYOUT_VERSION, SATI_ERROR__URI_TOO_LONG, SATI_PROGRAM_ADDRESS, SATI_PROGRAM_ID, SCHEMA_CONFIG_DISCRIMINATOR, SCHEMA_SEED, SOLANA_CHAIN_REFS, Sati, SatiAccount, SatiError, SatiInstruction, SchemaNotFoundError, SignatureMode, StorageType, TAG_SIZE, TOKEN_2022_PROGRAM_ADDRESS, UPDATE_REGISTRY_AUTHORITY_DISCRIMINATOR, VALIDATION_OFFSETS, ValidationType, address, addressToBytes, buildCounterpartyMessage, buildFeedbackSigningMessage, buildRegistrationFile, buildSatiRegistrationEntry, bytesToAddress, computeAttestationNonce, computeDataHash, computeDataHashFromHashes, computeDataHashFromStrings, computeEvmLinkHash, computeInteractionHash, computeReputationNonce, createBatchEd25519Instruction, createEd25519Instruction, createJsonContent, createPinataUploader, createSATILightClient, createSatiUploader, decodeAgentIndex, decodeRegistryConfig, decodeSchemaConfig, decryptContent, deriveEncryptionKeypair, deriveEncryptionPublicKey, deriveReputationAttestationPda, deriveReputationSchemaPda, deriveSasEventAuthorityPda, deriveSatiPda, deriveSatiProgramCredentialPda, deserializeEncryptedPayload, deserializeFeedback, deserializeReputationScore, deserializeUniversalLayout, deserializeValidation, duplicateAttestationMessage, encryptContent, fetchAgentIndex, fetchAllAgentIndex, fetchAllMaybeAgentIndex, fetchAllMaybeRegistryConfig, fetchAllMaybeSchemaConfig, fetchAllRegistryConfig, fetchAllSchemaConfig, fetchMaybeAgentIndex, fetchMaybeRegistryConfig, fetchMaybeSchemaConfig, fetchRegistrationFile, fetchRegistryConfig, fetchSchemaConfig, findAgentIndexPda, findAssociatedTokenAddress, findRegistryConfigPda, findSchemaConfigPda, formatCaip10, getAgentIndexCodec, getAgentIndexDecoder, getAgentIndexDiscriminatorBytes, getAgentIndexEncoder, getAgentIndexSize, getAgentRegisteredCodec, getAgentRegisteredDecoder, getAgentRegisteredEncoder, getAttestationClosedCodec, getAttestationClosedDecoder, getAttestationClosedEncoder, getAttestationCreatedCodec, getAttestationCreatedDecoder, getAttestationCreatedEncoder, getCloseCompressedAttestationDiscriminatorBytes, getCloseCompressedAttestationInstruction, getCloseCompressedAttestationInstructionAsync, getCloseCompressedAttestationInstructionDataCodec, getCloseCompressedAttestationInstructionDataDecoder, getCloseCompressedAttestationInstructionDataEncoder, getCloseRegularAttestationDiscriminatorBytes, getCloseRegularAttestationInstruction, getCloseRegularAttestationInstructionAsync, getCloseRegularAttestationInstructionDataCodec, getCloseRegularAttestationInstructionDataDecoder, getCloseRegularAttestationInstructionDataEncoder, getCompressedAccountMetaCodec, getCompressedAccountMetaDecoder, getCompressedAccountMetaEncoder, getCompressedProofCodec, getCompressedProofDecoder, getCompressedProofEncoder, getContentTypeLabel, getCreateCompressedAttestationDiscriminatorBytes, getCreateCompressedAttestationInstruction, getCreateCompressedAttestationInstructionAsync, getCreateCompressedAttestationInstructionDataCodec, getCreateCompressedAttestationInstructionDataDecoder, getCreateCompressedAttestationInstructionDataEncoder, getCreateRegularAttestationDiscriminatorBytes, getCreateRegularAttestationInstruction, getCreateRegularAttestationInstructionAsync, getCreateRegularAttestationInstructionDataCodec, getCreateRegularAttestationInstructionDataDecoder, getCreateRegularAttestationInstructionDataEncoder, getDeployedNetworks, getEvmAddressLinkedCodec, getEvmAddressLinkedDecoder, getEvmAddressLinkedEncoder, getImageUrl, getInitializeDiscriminatorBytes, getInitializeInstruction, getInitializeInstructionAsync, getInitializeInstructionDataCodec, getInitializeInstructionDataDecoder, getInitializeInstructionDataEncoder, getLinkEvmAddressDiscriminatorBytes, getLinkEvmAddressInstruction, getLinkEvmAddressInstructionAsync, getLinkEvmAddressInstructionDataCodec, getLinkEvmAddressInstructionDataDecoder, getLinkEvmAddressInstructionDataEncoder, getMaxContentSize, getMetadataEntryCodec, getMetadataEntryDecoder, getMetadataEntryEncoder, getOutcomeLabel, getPackedAddressTreeInfoCodec, getPackedAddressTreeInfoDecoder, getPackedAddressTreeInfoEncoder, getPackedStateTreeInfoCodec, getPackedStateTreeInfoDecoder, getPackedStateTreeInfoEncoder, getRegisterAgentDiscriminatorBytes, getRegisterAgentInstruction, getRegisterAgentInstructionAsync, getRegisterAgentInstructionDataCodec, getRegisterAgentInstructionDataDecoder, getRegisterAgentInstructionDataEncoder, getRegisterSchemaConfigDiscriminatorBytes, getRegisterSchemaConfigInstruction, getRegisterSchemaConfigInstructionAsync, getRegisterSchemaConfigInstructionDataCodec, getRegisterSchemaConfigInstructionDataDecoder, getRegisterSchemaConfigInstructionDataEncoder, getRegistryAuthorityUpdatedCodec, getRegistryAuthorityUpdatedDecoder, getRegistryAuthorityUpdatedEncoder, getRegistryConfigCodec, getRegistryConfigDecoder, getRegistryConfigDiscriminatorBytes, getRegistryConfigEncoder, getRegistryConfigSize, getRegistryInitializedCodec, getRegistryInitializedDecoder, getRegistryInitializedEncoder, getSatiAgentIds, getSatiErrorMessage, getSchemaConfigCodec, getSchemaConfigDecoder, getSchemaConfigDiscriminatorBytes, getSchemaConfigEncoder, getSchemaConfigRegisteredCodec, getSchemaConfigRegisteredDecoder, getSchemaConfigRegisteredEncoder, getSignatureModeCodec, getSignatureModeDecoder, getSignatureModeEncoder, getStorageTypeCodec, getStorageTypeDecoder, getStorageTypeEncoder, getUpdateRegistryAuthorityDiscriminatorBytes, getUpdateRegistryAuthorityInstruction, getUpdateRegistryAuthorityInstructionAsync, getUpdateRegistryAuthorityInstructionDataCodec, getUpdateRegistryAuthorityInstructionDataDecoder, getUpdateRegistryAuthorityInstructionDataEncoder, getValidityProofCodec, getValidityProofDecoder, getValidityProofEncoder, handleTransactionError, hasDeployedConfig, hasSatiRegistration, identifySatiAccount, identifySatiInstruction, inferMimeType, isSatiError, loadDeployedConfig, networkErrorMessage, outcomeToScore, parseCloseCompressedAttestationInstruction, parseCloseRegularAttestationInstruction, parseCreateCompressedAttestationInstruction, parseCreateRegularAttestationInstruction, parseFeedbackContent, parseInitializeInstruction, parseLinkEvmAddressInstruction, parseRegisterAgentInstruction, parseRegisterSchemaConfigInstruction, parseReputationScoreContent, parseUpdateRegistryAuthorityInstruction, parseValidationContent, serializeEncryptedPayload, serializeFeedback, serializeReputationScore, serializeUniversalLayout, serializeValidation, stringifyRegistrationFile, transactionExpiredMessage, transactionFailedMessage, validateBaseLayout, validateContentSize, validateReputationScoreContent, walletDisconnectedMessage, walletRejectedMessage, zeroDataHash };
|
|
6983
|
+
export { AGENT_INDEX_DISCRIMINATOR, ASSOCIATED_TOKEN_PROGRAM_ADDRESS, ATTESTATION_SEED, AgentNotFoundError, BASE_OFFSETS, CLOSE_COMPRESSED_ATTESTATION_DISCRIMINATOR, CLOSE_REGULAR_ATTESTATION_DISCRIMINATOR, COMPRESSED_OFFSETS, CREATE_COMPRESSED_ATTESTATION_DISCRIMINATOR, CREATE_REGULAR_ATTESTATION_DISCRIMINATOR, CREDENTIAL_SEED, ContentType, DOMAINS, DataType, DuplicateAttestationError, ED25519_PROGRAM_ADDRESS, ENCRYPTION_VERSION, FEEDBACK_OFFSETS, FeedbackCache, INITIALIZE_DISCRIMINATOR, LIGHT_ERROR_CODES, LINK_EVM_ADDRESS_DISCRIMINATOR, MAX_CONTENT_SIZE, MAX_DUAL_SIGNATURE_CONTENT_SIZE, MAX_PLAINTEXT_SIZE, MAX_SINGLE_SIGNATURE_CONTENT_SIZE, MIN_BASE_LAYOUT_SIZE, MIN_ENCRYPTED_SIZE, NONCE_SIZE, OFFSETS, Outcome, PRIVKEY_SIZE, PUBKEY_SIZE, REGISTER_AGENT_DISCRIMINATOR, REGISTER_SCHEMA_CONFIG_DISCRIMINATOR, REGISTRY_CONFIG_DISCRIMINATOR, REPUTATION_SCHEMA_NAME, REPUTATION_SCHEMA_VERSION, REPUTATION_SCORE_OFFSETS, SAS_DATA_LEN_OFFSET, SAS_HEADER_SIZE, SAS_PROGRAM_ADDRESS, SATILightClientImpl, SATI_ATTESTATION_SEED, SATI_CHAIN_ID, SATI_ERROR__AGENT_ATA_EMPTY, SATI_ERROR__AGENT_ATA_MINT_MISMATCH, SATI_ERROR__AGENT_ATA_REQUIRED, SATI_ERROR__AGENT_MINT_ACCOUNT_MISMATCH, SATI_ERROR__AGENT_MINT_MISMATCH, SATI_ERROR__AGENT_SIGNATURE_NOT_FOUND, SATI_ERROR__ATTESTATION_DATA_TOO_LARGE, SATI_ERROR__ATTESTATION_DATA_TOO_SMALL, SATI_ERROR__ATTESTATION_NOT_CLOSEABLE, SATI_ERROR__CONTENT_TOO_LARGE, SATI_ERROR__COUNTERPARTY_SIGNATURE_NOT_FOUND, SATI_ERROR__DELEGATE_MISMATCH, SATI_ERROR__DELEGATION_ATTESTATION_REQUIRED, SATI_ERROR__DELEGATION_EXPIRED, SATI_ERROR__DELEGATION_OWNER_MISMATCH, SATI_ERROR__DUPLICATE_SIGNERS, SATI_ERROR__ED25519_INSTRUCTION_NOT_FOUND, SATI_ERROR__EVM_ADDRESS_MISMATCH, SATI_ERROR__IMMUTABLE_AUTHORITY, SATI_ERROR__INVALID_AUTHORITY, SATI_ERROR__INVALID_CONTENT_TYPE, SATI_ERROR__INVALID_DELEGATION_P_D_A, SATI_ERROR__INVALID_ED25519_INSTRUCTION, SATI_ERROR__INVALID_EVM_ADDRESS_RECOVERY, SATI_ERROR__INVALID_GROUP_MINT, SATI_ERROR__INVALID_INSTRUCTIONS_SYSVAR, SATI_ERROR__INVALID_OUTCOME, SATI_ERROR__INVALID_SECP256K1_SIGNATURE, SATI_ERROR__INVALID_SIGNATURE, SATI_ERROR__INVALID_SIGNATURE_COUNT, SATI_ERROR__LIGHT_CPI_INVOCATION_FAILED, SATI_ERROR__MESSAGE_MISMATCH, SATI_ERROR__METADATA_KEY_TOO_LONG, SATI_ERROR__METADATA_VALUE_TOO_LONG, SATI_ERROR__MINT_AUTHORITY_NOT_RENOUNCED, SATI_ERROR__MISSING_SIGNATURES, SATI_ERROR__NAME_TOO_LONG, SATI_ERROR__OVERFLOW, SATI_ERROR__OWNER_ONLY, SATI_ERROR__SCHEMA_CONFIG_NOT_FOUND, SATI_ERROR__SECP256K1_RECOVERY_FAILED, SATI_ERROR__SELF_ATTESTATION_NOT_ALLOWED, SATI_ERROR__SIGNATURE_MISMATCH, SATI_ERROR__STORAGE_TYPE_MISMATCH, SATI_ERROR__STORAGE_TYPE_NOT_SUPPORTED, SATI_ERROR__SYMBOL_TOO_LONG, SATI_ERROR__TOO_MANY_METADATA_ENTRIES, SATI_ERROR__UNAUTHORIZED_CLOSE, SATI_ERROR__UNSUPPORTED_LAYOUT_VERSION, SATI_ERROR__URI_TOO_LONG, SATI_PROGRAM_ADDRESS, SATI_PROGRAM_ID, SCHEMA_CONFIG_DISCRIMINATOR, SCHEMA_SEED, SOLANA_CHAIN_REFS, Sati, SatiAccount, SatiAgentBuilder, SatiError, SatiInstruction, SchemaNotFoundError, SignatureMode, StorageType, TAG_SIZE, TOKEN_2022_PROGRAM_ADDRESS, UPDATE_REGISTRY_AUTHORITY_DISCRIMINATOR, VALIDATION_OFFSETS, ValidationType, address, addressToBytes, buildCounterpartyMessage, buildFeedbackSigningMessage, buildRegistrationFile, buildSatiRegistrationEntry, bytesToAddress, computeAttestationNonce, computeDataHash, computeDataHashFromHashes, computeDataHashFromStrings, computeEvmLinkHash, computeInteractionHash, computeReputationNonce, createBatchEd25519Instruction, createEd25519Instruction, createJsonContent, createPinataUploader, createSATILightClient, createSatiUploader, decodeAgentIndex, decodeRegistryConfig, decodeSchemaConfig, decryptContent, deriveEncryptionKeypair, deriveEncryptionPublicKey, deriveReputationAttestationPda, deriveReputationSchemaPda, deriveSasEventAuthorityPda, deriveSatiPda, deriveSatiProgramCredentialPda, deserializeEncryptedPayload, deserializeFeedback, deserializeReputationScore, deserializeUniversalLayout, deserializeValidation, duplicateAttestationMessage, encryptContent, fetchAgentIndex, fetchAllAgentIndex, fetchAllMaybeAgentIndex, fetchAllMaybeRegistryConfig, fetchAllMaybeSchemaConfig, fetchAllRegistryConfig, fetchAllSchemaConfig, fetchMaybeAgentIndex, fetchMaybeRegistryConfig, fetchMaybeSchemaConfig, fetchRegistrationFile, fetchRegistryConfig, fetchSchemaConfig, findAgentIndexPda, findAssociatedTokenAddress, findRegistryConfigPda, findSchemaConfigPda, formatCaip10, getAgentIndexCodec, getAgentIndexDecoder, getAgentIndexDiscriminatorBytes, getAgentIndexEncoder, getAgentIndexSize, getAgentRegisteredCodec, getAgentRegisteredDecoder, getAgentRegisteredEncoder, getAttestationClosedCodec, getAttestationClosedDecoder, getAttestationClosedEncoder, getAttestationCreatedCodec, getAttestationCreatedDecoder, getAttestationCreatedEncoder, getCloseCompressedAttestationDiscriminatorBytes, getCloseCompressedAttestationInstruction, getCloseCompressedAttestationInstructionAsync, getCloseCompressedAttestationInstructionDataCodec, getCloseCompressedAttestationInstructionDataDecoder, getCloseCompressedAttestationInstructionDataEncoder, getCloseRegularAttestationDiscriminatorBytes, getCloseRegularAttestationInstruction, getCloseRegularAttestationInstructionAsync, getCloseRegularAttestationInstructionDataCodec, getCloseRegularAttestationInstructionDataDecoder, getCloseRegularAttestationInstructionDataEncoder, getCompressedAccountMetaCodec, getCompressedAccountMetaDecoder, getCompressedAccountMetaEncoder, getCompressedProofCodec, getCompressedProofDecoder, getCompressedProofEncoder, getContentTypeLabel, getCreateCompressedAttestationDiscriminatorBytes, getCreateCompressedAttestationInstruction, getCreateCompressedAttestationInstructionAsync, getCreateCompressedAttestationInstructionDataCodec, getCreateCompressedAttestationInstructionDataDecoder, getCreateCompressedAttestationInstructionDataEncoder, getCreateRegularAttestationDiscriminatorBytes, getCreateRegularAttestationInstruction, getCreateRegularAttestationInstructionAsync, getCreateRegularAttestationInstructionDataCodec, getCreateRegularAttestationInstructionDataDecoder, getCreateRegularAttestationInstructionDataEncoder, getDeployedNetworks, getEvmAddressLinkedCodec, getEvmAddressLinkedDecoder, getEvmAddressLinkedEncoder, getImageUrl, getInitializeDiscriminatorBytes, getInitializeInstruction, getInitializeInstructionAsync, getInitializeInstructionDataCodec, getInitializeInstructionDataDecoder, getInitializeInstructionDataEncoder, getLinkEvmAddressDiscriminatorBytes, getLinkEvmAddressInstruction, getLinkEvmAddressInstructionAsync, getLinkEvmAddressInstructionDataCodec, getLinkEvmAddressInstructionDataDecoder, getLinkEvmAddressInstructionDataEncoder, getMaxContentSize, getMetadataEntryCodec, getMetadataEntryDecoder, getMetadataEntryEncoder, getOutcomeLabel, getPackedAddressTreeInfoCodec, getPackedAddressTreeInfoDecoder, getPackedAddressTreeInfoEncoder, getPackedStateTreeInfoCodec, getPackedStateTreeInfoDecoder, getPackedStateTreeInfoEncoder, getRegisterAgentDiscriminatorBytes, getRegisterAgentInstruction, getRegisterAgentInstructionAsync, getRegisterAgentInstructionDataCodec, getRegisterAgentInstructionDataDecoder, getRegisterAgentInstructionDataEncoder, getRegisterSchemaConfigDiscriminatorBytes, getRegisterSchemaConfigInstruction, getRegisterSchemaConfigInstructionAsync, getRegisterSchemaConfigInstructionDataCodec, getRegisterSchemaConfigInstructionDataDecoder, getRegisterSchemaConfigInstructionDataEncoder, getRegistryAuthorityUpdatedCodec, getRegistryAuthorityUpdatedDecoder, getRegistryAuthorityUpdatedEncoder, getRegistryConfigCodec, getRegistryConfigDecoder, getRegistryConfigDiscriminatorBytes, getRegistryConfigEncoder, getRegistryConfigSize, getRegistryInitializedCodec, getRegistryInitializedDecoder, getRegistryInitializedEncoder, getSatiAgentIds, getSatiErrorMessage, getSchemaConfigCodec, getSchemaConfigDecoder, getSchemaConfigDiscriminatorBytes, getSchemaConfigEncoder, getSchemaConfigRegisteredCodec, getSchemaConfigRegisteredDecoder, getSchemaConfigRegisteredEncoder, getSignatureModeCodec, getSignatureModeDecoder, getSignatureModeEncoder, getStorageTypeCodec, getStorageTypeDecoder, getStorageTypeEncoder, getUpdateRegistryAuthorityDiscriminatorBytes, getUpdateRegistryAuthorityInstruction, getUpdateRegistryAuthorityInstructionAsync, getUpdateRegistryAuthorityInstructionDataCodec, getUpdateRegistryAuthorityInstructionDataDecoder, getUpdateRegistryAuthorityInstructionDataEncoder, getValidityProofCodec, getValidityProofDecoder, getValidityProofEncoder, handleTransactionError, hasDeployedConfig, hasSatiRegistration, identifySatiAccount, identifySatiInstruction, inferMimeType, isSatiError, loadDeployedConfig, networkErrorMessage, outcomeToScore, parseCloseCompressedAttestationInstruction, parseCloseRegularAttestationInstruction, parseCreateCompressedAttestationInstruction, parseCreateRegularAttestationInstruction, parseFeedbackContent, parseInitializeInstruction, parseLinkEvmAddressInstruction, parseRegisterAgentInstruction, parseRegisterSchemaConfigInstruction, parseReputationScoreContent, parseUpdateRegistryAuthorityInstruction, parseValidationContent, serializeEncryptedPayload, serializeFeedback, serializeReputationScore, serializeUniversalLayout, serializeValidation, stringifyRegistrationFile, transactionExpiredMessage, transactionFailedMessage, validateBaseLayout, validateContentSize, validateReputationScoreContent, walletDisconnectedMessage, walletRejectedMessage, zeroDataHash };
|
|
6356
6984
|
//# sourceMappingURL=index.mjs.map
|