@cascade-fyi/sati-sdk 0.7.0 → 0.8.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 +14 -0
- package/dist/index.cjs +65 -51
- package/dist/index.d.cts +68 -49
- package/dist/index.d.cts.map +1 -1
- package/dist/index.d.mts +68 -49
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +65 -51
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -5,6 +5,19 @@ All notable changes to this project will be documented in this file.
|
|
|
5
5
|
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
|
|
6
6
|
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
7
7
|
|
|
8
|
+
## [0.8.0] - 2026-02-12
|
|
9
|
+
|
|
10
|
+
### Breaking Changes
|
|
11
|
+
|
|
12
|
+
- **Feedback content fields renamed for ERC-8004 alignment**: `score` -> `value`, `tags` -> `tag1`/`tag2`, added `valueDecimals`
|
|
13
|
+
- `GiveFeedbackParams`: `score?` -> `value?`, `tags?` -> `tag1?`/`tag2?`, added `valueDecimals?`
|
|
14
|
+
- `ParsedFeedback`: `score?` -> `value?`, `tags` -> `tag1?`/`tag2?`, added `valueDecimals?`
|
|
15
|
+
- `FeedbackSearchOptions`: `minScore`/`maxScore` -> `minValue`/`maxValue`, `tags?` -> `tag1?`/`tag2?`
|
|
16
|
+
- `ReputationSummary`: `averageScore` -> `averageValue`
|
|
17
|
+
- `FeedbackContent`: `score?` -> `value?`, `tags?` -> `tag1?`/`tag2?`, added `valueDecimals?`
|
|
18
|
+
- **`getReputationSummary` signature changed**: `(agentMint, tags?)` -> `(agentMint, tag1?, tag2?)`
|
|
19
|
+
- **Registration file fields renamed**: `endpoints` -> `services`, `x402support` -> `x402Support`
|
|
20
|
+
|
|
8
21
|
## [0.7.0] - 2026-02-12
|
|
9
22
|
|
|
10
23
|
### Added
|
|
@@ -144,6 +157,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
144
157
|
- Compressed attestation storage via Light Protocol
|
|
145
158
|
- Basic querying via Photon RPC
|
|
146
159
|
|
|
160
|
+
[0.8.0]: https://github.com/cascade-protocol/sati/compare/@cascade-fyi/sati-sdk@0.7.0...@cascade-fyi/sati-sdk@0.8.0
|
|
147
161
|
[0.7.0]: https://github.com/cascade-protocol/sati/compare/@cascade-fyi/sati-sdk@0.6.0...@cascade-fyi/sati-sdk@0.7.0
|
|
148
162
|
[0.6.0]: https://github.com/cascade-protocol/sati/compare/@cascade-fyi/sati-sdk@0.5.0...@cascade-fyi/sati-sdk@0.6.0
|
|
149
163
|
[0.5.0]: https://github.com/cascade-protocol/sati/compare/@cascade-fyi/sati-sdk@0.4.2...@cascade-fyi/sati-sdk@0.5.0
|
package/dist/index.cjs
CHANGED
|
@@ -2937,17 +2937,17 @@ let DataType = /* @__PURE__ */ function(DataType$1) {
|
|
|
2937
2937
|
/**
|
|
2938
2938
|
* Feedback outcome values (ERC-8004 compatible)
|
|
2939
2939
|
*
|
|
2940
|
-
*
|
|
2941
|
-
* - Negative(0)
|
|
2942
|
-
* - Neutral(1)
|
|
2943
|
-
* - Positive(2)
|
|
2940
|
+
* Maps to ERC-8004 outcome semantics:
|
|
2941
|
+
* - Negative(0) - unfavorable interaction
|
|
2942
|
+
* - Neutral(1) - default / no strong signal
|
|
2943
|
+
* - Positive(2) - favorable interaction
|
|
2944
2944
|
*/
|
|
2945
2945
|
let Outcome = /* @__PURE__ */ function(Outcome$1) {
|
|
2946
|
-
/** Negative feedback
|
|
2946
|
+
/** Negative feedback */
|
|
2947
2947
|
Outcome$1[Outcome$1["Negative"] = 0] = "Negative";
|
|
2948
|
-
/** Neutral feedback (
|
|
2948
|
+
/** Neutral feedback (default) */
|
|
2949
2949
|
Outcome$1[Outcome$1["Neutral"] = 1] = "Neutral";
|
|
2950
|
-
/** Positive feedback
|
|
2950
|
+
/** Positive feedback */
|
|
2951
2951
|
Outcome$1[Outcome$1["Positive"] = 2] = "Positive";
|
|
2952
2952
|
return Outcome$1;
|
|
2953
2953
|
}({});
|
|
@@ -4323,7 +4323,7 @@ function bytesToHex(bytes) {
|
|
|
4323
4323
|
* outcome: Outcome.Positive,
|
|
4324
4324
|
* dataHash: dataHash,
|
|
4325
4325
|
* contentType: ContentType.JSON,
|
|
4326
|
-
* content: new TextEncoder().encode('{"
|
|
4326
|
+
* content: new TextEncoder().encode('{"value": 95, "valueDecimals": 0, "tag1": "quality"}'),
|
|
4327
4327
|
* });
|
|
4328
4328
|
*
|
|
4329
4329
|
* // Build counterparty message
|
|
@@ -4842,11 +4842,11 @@ const RegistrationFileSchema = zod.object({
|
|
|
4842
4842
|
image: zod.url(),
|
|
4843
4843
|
properties: PropertiesSchema,
|
|
4844
4844
|
external_url: zod.url().optional(),
|
|
4845
|
-
|
|
4845
|
+
services: zod.array(EndpointSchema).optional(),
|
|
4846
4846
|
registrations: zod.array(RegistrationEntrySchema).optional(),
|
|
4847
4847
|
supportedTrust: zod.array(TrustMechanismSchema).optional(),
|
|
4848
4848
|
active: zod.boolean().optional().default(true),
|
|
4849
|
-
|
|
4849
|
+
x402Support: zod.boolean().optional()
|
|
4850
4850
|
});
|
|
4851
4851
|
const MIME_TYPES = {
|
|
4852
4852
|
png: "image/png",
|
|
@@ -4889,11 +4889,11 @@ function buildRegistrationFile(params) {
|
|
|
4889
4889
|
category: "image"
|
|
4890
4890
|
},
|
|
4891
4891
|
...params.externalUrl && { external_url: params.externalUrl },
|
|
4892
|
-
...params.
|
|
4892
|
+
...params.services?.length && { services: params.services },
|
|
4893
4893
|
...params.registrations?.length && { registrations: params.registrations },
|
|
4894
4894
|
...params.supportedTrust?.length && { supportedTrust: params.supportedTrust },
|
|
4895
4895
|
active: params.active ?? true,
|
|
4896
|
-
...params.
|
|
4896
|
+
...params.x402Support !== void 0 && { x402Support: params.x402Support }
|
|
4897
4897
|
};
|
|
4898
4898
|
return RegistrationFileSchema.parse(file);
|
|
4899
4899
|
}
|
|
@@ -5029,7 +5029,7 @@ var SatiAgentBuilder = class {
|
|
|
5029
5029
|
name,
|
|
5030
5030
|
description,
|
|
5031
5031
|
image,
|
|
5032
|
-
|
|
5032
|
+
services: [],
|
|
5033
5033
|
active: true
|
|
5034
5034
|
};
|
|
5035
5035
|
}
|
|
@@ -5043,9 +5043,9 @@ var SatiAgentBuilder = class {
|
|
|
5043
5043
|
}
|
|
5044
5044
|
/** Set a generic endpoint. */
|
|
5045
5045
|
setEndpoint(endpoint) {
|
|
5046
|
-
if (!this._params.
|
|
5047
|
-
this._params.
|
|
5048
|
-
this._params.
|
|
5046
|
+
if (!this._params.services) this._params.services = [];
|
|
5047
|
+
this._params.services = this._params.services.filter((ep) => ep.name !== endpoint.name);
|
|
5048
|
+
this._params.services.push(endpoint);
|
|
5049
5049
|
return this;
|
|
5050
5050
|
}
|
|
5051
5051
|
/**
|
|
@@ -5082,7 +5082,7 @@ var SatiAgentBuilder = class {
|
|
|
5082
5082
|
}
|
|
5083
5083
|
/** Remove an endpoint by name. */
|
|
5084
5084
|
removeEndpoint(name) {
|
|
5085
|
-
if (this._params.
|
|
5085
|
+
if (this._params.services) this._params.services = this._params.services.filter((ep) => ep.name !== name);
|
|
5086
5086
|
return this;
|
|
5087
5087
|
}
|
|
5088
5088
|
/** Set agent active status. */
|
|
@@ -5092,7 +5092,7 @@ var SatiAgentBuilder = class {
|
|
|
5092
5092
|
}
|
|
5093
5093
|
/** Set x402 payment support. */
|
|
5094
5094
|
setX402Support(x402) {
|
|
5095
|
-
this._params.
|
|
5095
|
+
this._params.x402Support = x402;
|
|
5096
5096
|
return this;
|
|
5097
5097
|
}
|
|
5098
5098
|
/** Set supported trust mechanisms. */
|
|
@@ -6447,8 +6447,9 @@ var Sati = class {
|
|
|
6447
6447
|
* const result = await sati.giveFeedback({
|
|
6448
6448
|
* payer: myKeypair,
|
|
6449
6449
|
* agentMint: address("Agent..."),
|
|
6450
|
-
*
|
|
6451
|
-
*
|
|
6450
|
+
* value: 87,
|
|
6451
|
+
* valueDecimals: 0,
|
|
6452
|
+
* tag1: "starred",
|
|
6452
6453
|
* message: "Great response time",
|
|
6453
6454
|
* });
|
|
6454
6455
|
* ```
|
|
@@ -6456,10 +6457,13 @@ var Sati = class {
|
|
|
6456
6457
|
async giveFeedback(params) {
|
|
6457
6458
|
const schema = this._requireFeedbackPublicSchema();
|
|
6458
6459
|
const payer = params.payer;
|
|
6459
|
-
if (params.
|
|
6460
|
+
if (params.value !== void 0 && !Number.isFinite(params.value)) throw new Error(`Feedback value must be a finite number, got: ${params.value}`);
|
|
6461
|
+
if (params.valueDecimals !== void 0 && (params.valueDecimals < 0 || params.valueDecimals > 18)) throw new Error(`valueDecimals must be 0-18, got: ${params.valueDecimals}`);
|
|
6460
6462
|
const contentObj = {};
|
|
6461
|
-
if (params.
|
|
6462
|
-
if (params.
|
|
6463
|
+
if (params.value !== void 0) contentObj.value = params.value;
|
|
6464
|
+
if (params.valueDecimals !== void 0) contentObj.valueDecimals = params.valueDecimals;
|
|
6465
|
+
if (params.tag1) contentObj.tag1 = params.tag1;
|
|
6466
|
+
if (params.tag2) contentObj.tag2 = params.tag2;
|
|
6463
6467
|
if (params.endpoint) contentObj.endpoint = params.endpoint;
|
|
6464
6468
|
if (params.message) contentObj.m = params.message;
|
|
6465
6469
|
const content = Object.keys(contentObj).length > 0 ? new TextEncoder().encode(JSON.stringify(contentObj)) : new Uint8Array(0);
|
|
@@ -6510,10 +6514,13 @@ var Sati = class {
|
|
|
6510
6514
|
*/
|
|
6511
6515
|
async prepareFeedback(params) {
|
|
6512
6516
|
const schema = this._requireFeedbackPublicSchema();
|
|
6513
|
-
if (params.
|
|
6517
|
+
if (params.value !== void 0 && !Number.isFinite(params.value)) throw new Error(`Feedback value must be a finite number, got: ${params.value}`);
|
|
6518
|
+
if (params.valueDecimals !== void 0 && (params.valueDecimals < 0 || params.valueDecimals > 18)) throw new Error(`valueDecimals must be 0-18, got: ${params.valueDecimals}`);
|
|
6514
6519
|
const contentObj = {};
|
|
6515
|
-
if (params.
|
|
6516
|
-
if (params.
|
|
6520
|
+
if (params.value !== void 0) contentObj.value = params.value;
|
|
6521
|
+
if (params.valueDecimals !== void 0) contentObj.valueDecimals = params.valueDecimals;
|
|
6522
|
+
if (params.tag1) contentObj.tag1 = params.tag1;
|
|
6523
|
+
if (params.tag2) contentObj.tag2 = params.tag2;
|
|
6517
6524
|
if (params.endpoint) contentObj.endpoint = params.endpoint;
|
|
6518
6525
|
if (params.message) contentObj.m = params.message;
|
|
6519
6526
|
const content = Object.keys(contentObj).length > 0 ? new TextEncoder().encode(JSON.stringify(contentObj)) : new Uint8Array(0);
|
|
@@ -6544,8 +6551,10 @@ var Sati = class {
|
|
|
6544
6551
|
sasSchema: schema,
|
|
6545
6552
|
lookupTable: this._deployedConfig?.lookupTable,
|
|
6546
6553
|
meta: {
|
|
6547
|
-
|
|
6548
|
-
|
|
6554
|
+
value: params.value,
|
|
6555
|
+
valueDecimals: params.valueDecimals,
|
|
6556
|
+
tag1: params.tag1,
|
|
6557
|
+
tag2: params.tag2,
|
|
6549
6558
|
message: params.message,
|
|
6550
6559
|
endpoint: params.endpoint
|
|
6551
6560
|
}
|
|
@@ -6611,8 +6620,8 @@ var Sati = class {
|
|
|
6611
6620
|
* ```typescript
|
|
6612
6621
|
* const feedbacks = await sati.searchFeedback({
|
|
6613
6622
|
* agentMint: address("Agent..."),
|
|
6614
|
-
*
|
|
6615
|
-
*
|
|
6623
|
+
* tag1: "starred",
|
|
6624
|
+
* minValue: 70,
|
|
6616
6625
|
* });
|
|
6617
6626
|
* ```
|
|
6618
6627
|
*/
|
|
@@ -6631,15 +6640,16 @@ var Sati = class {
|
|
|
6631
6640
|
const feedbacks = [];
|
|
6632
6641
|
for (const item of result.items) {
|
|
6633
6642
|
const rawContent = this._parseContentJson(item.data.content, item.data.contentType);
|
|
6634
|
-
const
|
|
6635
|
-
const
|
|
6643
|
+
const value = rawContent?.value;
|
|
6644
|
+
const valueDecimals = rawContent?.valueDecimals;
|
|
6645
|
+
const tag1 = rawContent?.tag1;
|
|
6646
|
+
const tag2 = rawContent?.tag2;
|
|
6636
6647
|
const message = rawContent?.m;
|
|
6637
6648
|
const endpoint = rawContent?.endpoint;
|
|
6638
|
-
if (options?.
|
|
6639
|
-
|
|
6640
|
-
|
|
6641
|
-
if (options?.
|
|
6642
|
-
if (options?.maxScore !== void 0 && (score === void 0 || score > options.maxScore)) continue;
|
|
6649
|
+
if (options?.tag1 !== void 0 && tag1 !== options.tag1) continue;
|
|
6650
|
+
if (options?.tag2 !== void 0 && tag2 !== options.tag2) continue;
|
|
6651
|
+
if (options?.minValue !== void 0 && (value === void 0 || value < options.minValue)) continue;
|
|
6652
|
+
if (options?.maxValue !== void 0 && (value === void 0 || value > options.maxValue)) continue;
|
|
6643
6653
|
const slotDiff = Number(BigInt(currentSlot) - item.raw.slotCreated);
|
|
6644
6654
|
const createdAt = nowSec - Math.floor(slotDiff * .4);
|
|
6645
6655
|
const [compressedAddress] = (0, __solana_kit.getAddressDecoder)().read(item.address, 0);
|
|
@@ -6648,8 +6658,10 @@ var Sati = class {
|
|
|
6648
6658
|
agentMint: item.data.agentMint,
|
|
6649
6659
|
counterparty: item.data.counterparty,
|
|
6650
6660
|
outcome: item.data.outcome,
|
|
6651
|
-
|
|
6652
|
-
|
|
6661
|
+
value,
|
|
6662
|
+
valueDecimals,
|
|
6663
|
+
tag1,
|
|
6664
|
+
tag2,
|
|
6653
6665
|
message,
|
|
6654
6666
|
endpoint,
|
|
6655
6667
|
createdAt
|
|
@@ -6675,15 +6687,15 @@ var Sati = class {
|
|
|
6675
6687
|
/**
|
|
6676
6688
|
* Get reputation summary for an agent.
|
|
6677
6689
|
*
|
|
6678
|
-
* Aggregates feedback
|
|
6690
|
+
* Aggregates feedback values, optionally filtered by tag1 and/or tag2.
|
|
6679
6691
|
*
|
|
6680
6692
|
* @example
|
|
6681
6693
|
* ```typescript
|
|
6682
6694
|
* const summary = await sati.getReputationSummary(address("Agent..."));
|
|
6683
|
-
* console.log(`${summary.count} reviews, avg ${summary.
|
|
6695
|
+
* console.log(`${summary.count} reviews, avg ${summary.averageValue}`);
|
|
6684
6696
|
* ```
|
|
6685
6697
|
*/
|
|
6686
|
-
async getReputationSummary(agentMint,
|
|
6698
|
+
async getReputationSummary(agentMint, tag1, tag2) {
|
|
6687
6699
|
const schema = this._deployedConfig?.schemas.feedbackPublic ?? this._deployedConfig?.schemas.feedback;
|
|
6688
6700
|
if (!schema) throw new Error(`No feedback schema deployed for network "${this.network}"`);
|
|
6689
6701
|
const cacheKey = FeedbackCache.cacheKey(schema, agentMint);
|
|
@@ -6695,23 +6707,25 @@ var Sati = class {
|
|
|
6695
6707
|
if (!cached) this._feedbackCache.set(cacheKey, result);
|
|
6696
6708
|
if (result.items.length === 0) return {
|
|
6697
6709
|
count: 0,
|
|
6698
|
-
|
|
6710
|
+
averageValue: 0
|
|
6699
6711
|
};
|
|
6700
6712
|
let sum = 0;
|
|
6701
6713
|
let count = 0;
|
|
6702
6714
|
for (const item of result.items) {
|
|
6703
6715
|
const rawContent = this._parseContentJson(item.data.content, item.data.contentType);
|
|
6704
|
-
const
|
|
6705
|
-
const
|
|
6706
|
-
|
|
6707
|
-
if (
|
|
6708
|
-
|
|
6716
|
+
const value = rawContent?.value;
|
|
6717
|
+
const itemTag1 = rawContent?.tag1;
|
|
6718
|
+
const itemTag2 = rawContent?.tag2;
|
|
6719
|
+
if (tag1 !== void 0 && itemTag1 !== tag1) continue;
|
|
6720
|
+
if (tag2 !== void 0 && itemTag2 !== tag2) continue;
|
|
6721
|
+
if (value !== void 0) {
|
|
6722
|
+
sum += value;
|
|
6709
6723
|
count++;
|
|
6710
6724
|
}
|
|
6711
6725
|
}
|
|
6712
6726
|
return {
|
|
6713
6727
|
count,
|
|
6714
|
-
|
|
6728
|
+
averageValue: count > 0 ? sum / count : 0
|
|
6715
6729
|
};
|
|
6716
6730
|
}
|
|
6717
6731
|
/**
|
|
@@ -6777,10 +6791,10 @@ var Sati = class {
|
|
|
6777
6791
|
for (let i = 0; i < agents.length; i++) {
|
|
6778
6792
|
const identity = agents[i];
|
|
6779
6793
|
const regFile = regFiles[i];
|
|
6780
|
-
const
|
|
6794
|
+
const services = regFile?.services ?? [];
|
|
6781
6795
|
if (options?.active !== void 0 && (regFile?.active ?? true) !== options.active) continue;
|
|
6782
6796
|
if (options?.endpointTypes?.length) {
|
|
6783
|
-
if (!options.endpointTypes.every((type) =>
|
|
6797
|
+
if (!options.endpointTypes.every((type) => services.some((e) => e.name.toUpperCase() === type.toUpperCase()))) continue;
|
|
6784
6798
|
}
|
|
6785
6799
|
filtered.push({
|
|
6786
6800
|
identity,
|
package/dist/index.d.cts
CHANGED
|
@@ -1627,17 +1627,17 @@ declare enum DataType {
|
|
|
1627
1627
|
/**
|
|
1628
1628
|
* Feedback outcome values (ERC-8004 compatible)
|
|
1629
1629
|
*
|
|
1630
|
-
*
|
|
1631
|
-
* - Negative(0)
|
|
1632
|
-
* - Neutral(1)
|
|
1633
|
-
* - Positive(2)
|
|
1630
|
+
* Maps to ERC-8004 outcome semantics:
|
|
1631
|
+
* - Negative(0) - unfavorable interaction
|
|
1632
|
+
* - Neutral(1) - default / no strong signal
|
|
1633
|
+
* - Positive(2) - favorable interaction
|
|
1634
1634
|
*/
|
|
1635
1635
|
declare enum Outcome {
|
|
1636
|
-
/** Negative feedback
|
|
1636
|
+
/** Negative feedback */
|
|
1637
1637
|
Negative = 0,
|
|
1638
|
-
/** Neutral feedback (
|
|
1638
|
+
/** Neutral feedback (default) */
|
|
1639
1639
|
Neutral = 1,
|
|
1640
|
-
/** Positive feedback
|
|
1640
|
+
/** Positive feedback */
|
|
1641
1641
|
Positive = 2,
|
|
1642
1642
|
}
|
|
1643
1643
|
/**
|
|
@@ -1698,18 +1698,24 @@ interface BaseLayout {
|
|
|
1698
1698
|
/**
|
|
1699
1699
|
* Feedback schema - uses universal base layout
|
|
1700
1700
|
*
|
|
1701
|
-
* Schema-specific fields (
|
|
1702
|
-
* { "
|
|
1701
|
+
* Schema-specific fields (value, tags, message) go in JSON content:
|
|
1702
|
+
* { "value": 85, "valueDecimals": 0, "tag1": "quality", "tag2": "latency", "m": "Great response!" }
|
|
1703
1703
|
*/
|
|
1704
1704
|
interface FeedbackData extends BaseLayout {}
|
|
1705
1705
|
/**
|
|
1706
1706
|
* Feedback JSON content structure (optional fields in content)
|
|
1707
1707
|
*/
|
|
1708
1708
|
interface FeedbackContent {
|
|
1709
|
-
/** ERC-8004
|
|
1710
|
-
|
|
1711
|
-
/**
|
|
1712
|
-
|
|
1709
|
+
/** ERC-8004 signed fixed-point value */
|
|
1710
|
+
value?: number;
|
|
1711
|
+
/** Decimal places for value (0-18) */
|
|
1712
|
+
valueDecimals?: number;
|
|
1713
|
+
/** First tag dimension */
|
|
1714
|
+
tag1?: string;
|
|
1715
|
+
/** Second tag dimension */
|
|
1716
|
+
tag2?: string;
|
|
1717
|
+
/** Endpoint URI being reviewed */
|
|
1718
|
+
endpoint?: string;
|
|
1713
1719
|
/** Feedback message */
|
|
1714
1720
|
m?: string;
|
|
1715
1721
|
}
|
|
@@ -1805,8 +1811,8 @@ declare function parseValidationContent(content: Uint8Array, contentType: Conten
|
|
|
1805
1811
|
*
|
|
1806
1812
|
* Note: task_ref is deterministic: keccak256(counterparty, agent_mint)
|
|
1807
1813
|
*
|
|
1808
|
-
* Schema-specific fields
|
|
1809
|
-
* { "score": 85, "methodology": "weighted_average", "
|
|
1814
|
+
* Schema-specific fields go in JSON content:
|
|
1815
|
+
* { "score": 85, "methodology": "weighted_average", "feedbackCount": 42 }
|
|
1810
1816
|
*/
|
|
1811
1817
|
interface ReputationScoreData extends BaseLayout {}
|
|
1812
1818
|
/**
|
|
@@ -2541,7 +2547,7 @@ interface CounterpartyMessageParams {
|
|
|
2541
2547
|
* outcome: Outcome.Positive,
|
|
2542
2548
|
* dataHash: dataHash,
|
|
2543
2549
|
* contentType: ContentType.JSON,
|
|
2544
|
-
* content: new TextEncoder().encode('{"
|
|
2550
|
+
* content: new TextEncoder().encode('{"value": 95, "valueDecimals": 0, "tag1": "quality"}'),
|
|
2545
2551
|
* });
|
|
2546
2552
|
*
|
|
2547
2553
|
* // Build counterparty message
|
|
@@ -3248,8 +3254,8 @@ interface RegistrationFile {
|
|
|
3248
3254
|
properties: Properties;
|
|
3249
3255
|
/** Project website URL */
|
|
3250
3256
|
external_url?: string;
|
|
3251
|
-
/** Service endpoints (A2A, MCP, agentWallet) */
|
|
3252
|
-
|
|
3257
|
+
/** Service endpoints (A2A, MCP, agentWallet) - ERC-8004 "services" array */
|
|
3258
|
+
services?: Endpoint[];
|
|
3253
3259
|
/** Cross-chain registration entries */
|
|
3254
3260
|
registrations?: RegistrationEntry[];
|
|
3255
3261
|
/** Supported trust mechanisms */
|
|
@@ -3257,7 +3263,7 @@ interface RegistrationFile {
|
|
|
3257
3263
|
/** Agent operational status */
|
|
3258
3264
|
active?: boolean;
|
|
3259
3265
|
/** Accepts x402 payments */
|
|
3260
|
-
|
|
3266
|
+
x402Support?: boolean;
|
|
3261
3267
|
}
|
|
3262
3268
|
/** Input parameters for buildRegistrationFile */
|
|
3263
3269
|
interface RegistrationFileParams {
|
|
@@ -3266,11 +3272,11 @@ interface RegistrationFileParams {
|
|
|
3266
3272
|
image: string;
|
|
3267
3273
|
imageMimeType?: string;
|
|
3268
3274
|
externalUrl?: string;
|
|
3269
|
-
|
|
3275
|
+
services?: Endpoint[];
|
|
3270
3276
|
registrations?: RegistrationEntry[];
|
|
3271
3277
|
supportedTrust?: TrustMechanism[];
|
|
3272
3278
|
active?: boolean;
|
|
3273
|
-
|
|
3279
|
+
x402Support?: boolean;
|
|
3274
3280
|
}
|
|
3275
3281
|
/**
|
|
3276
3282
|
* Infer MIME type from image URL extension.
|
|
@@ -3445,13 +3451,17 @@ interface GiveFeedbackParams {
|
|
|
3445
3451
|
payer: KeyPairSigner;
|
|
3446
3452
|
/** Agent mint address to review */
|
|
3447
3453
|
agentMint: Address$1;
|
|
3448
|
-
/**
|
|
3449
|
-
|
|
3450
|
-
/**
|
|
3451
|
-
|
|
3454
|
+
/** ERC-8004 signed fixed-point value (e.g. 87 for score, -32 for -3.2% yield) */
|
|
3455
|
+
value?: number;
|
|
3456
|
+
/** Decimal places for value (0-18). E.g. valueDecimals=0 means integer, =2 means 2 decimal places. Default 0. */
|
|
3457
|
+
valueDecimals?: number;
|
|
3458
|
+
/** First tag dimension (e.g. "starred", "uptime", "successRate") */
|
|
3459
|
+
tag1?: string;
|
|
3460
|
+
/** Second tag dimension (optional sub-category) */
|
|
3461
|
+
tag2?: string;
|
|
3452
3462
|
/** Human-readable feedback message */
|
|
3453
3463
|
message?: string;
|
|
3454
|
-
/** Endpoint being reviewed */
|
|
3464
|
+
/** Endpoint URI being reviewed */
|
|
3455
3465
|
endpoint?: string;
|
|
3456
3466
|
/** Explicit outcome (defaults to Neutral if not set) */
|
|
3457
3467
|
outcome?: Outcome;
|
|
@@ -3489,8 +3499,10 @@ interface PreparedFeedbackData {
|
|
|
3489
3499
|
lookupTable?: Address$1;
|
|
3490
3500
|
/** Original input values for reconstructing display data */
|
|
3491
3501
|
meta: {
|
|
3492
|
-
|
|
3493
|
-
|
|
3502
|
+
value?: number;
|
|
3503
|
+
valueDecimals?: number;
|
|
3504
|
+
tag1?: string;
|
|
3505
|
+
tag2?: string;
|
|
3494
3506
|
message?: string;
|
|
3495
3507
|
endpoint?: string;
|
|
3496
3508
|
};
|
|
@@ -3501,12 +3513,14 @@ interface FeedbackSearchOptions {
|
|
|
3501
3513
|
agentMint?: Address$1;
|
|
3502
3514
|
/** Filter by counterparty (reviewer) */
|
|
3503
3515
|
counterparty?: Address$1;
|
|
3504
|
-
/** Filter by
|
|
3505
|
-
|
|
3506
|
-
/**
|
|
3507
|
-
|
|
3508
|
-
/**
|
|
3509
|
-
|
|
3516
|
+
/** Filter by tag1 */
|
|
3517
|
+
tag1?: string;
|
|
3518
|
+
/** Filter by tag2 */
|
|
3519
|
+
tag2?: string;
|
|
3520
|
+
/** Minimum value (inclusive) */
|
|
3521
|
+
minValue?: number;
|
|
3522
|
+
/** Maximum value (inclusive) */
|
|
3523
|
+
maxValue?: number;
|
|
3510
3524
|
/** Include transaction hash in results (extra RPC call) */
|
|
3511
3525
|
includeTxHash?: boolean;
|
|
3512
3526
|
}
|
|
@@ -3520,10 +3534,14 @@ interface ParsedFeedback {
|
|
|
3520
3534
|
counterparty: Address$1;
|
|
3521
3535
|
/** Feedback outcome */
|
|
3522
3536
|
outcome: Outcome;
|
|
3523
|
-
/**
|
|
3524
|
-
|
|
3525
|
-
/**
|
|
3526
|
-
|
|
3537
|
+
/** ERC-8004 signed fixed-point value */
|
|
3538
|
+
value?: number;
|
|
3539
|
+
/** Decimal places for value (0-18) */
|
|
3540
|
+
valueDecimals?: number;
|
|
3541
|
+
/** First tag dimension */
|
|
3542
|
+
tag1?: string;
|
|
3543
|
+
/** Second tag dimension */
|
|
3544
|
+
tag2?: string;
|
|
3527
3545
|
/** Feedback message */
|
|
3528
3546
|
message?: string;
|
|
3529
3547
|
/** Endpoint reviewed */
|
|
@@ -3535,10 +3553,10 @@ interface ParsedFeedback {
|
|
|
3535
3553
|
}
|
|
3536
3554
|
/** Reputation summary aggregated from feedback. */
|
|
3537
3555
|
interface ReputationSummary {
|
|
3538
|
-
/** Number of feedback attestations */
|
|
3556
|
+
/** Number of feedback attestations with values */
|
|
3539
3557
|
count: number;
|
|
3540
|
-
/** Average
|
|
3541
|
-
|
|
3558
|
+
/** Average value across attestations (raw, not adjusted for valueDecimals) */
|
|
3559
|
+
averageValue: number;
|
|
3542
3560
|
}
|
|
3543
3561
|
/** Options for searching registered agents. */
|
|
3544
3562
|
interface AgentSearchOptions {
|
|
@@ -3651,7 +3669,7 @@ interface CreateFeedbackParams {
|
|
|
3651
3669
|
* @example
|
|
3652
3670
|
* ```typescript
|
|
3653
3671
|
* // Small content (fits in DualSignature)
|
|
3654
|
-
* content: new TextEncoder().encode('{"
|
|
3672
|
+
* content: new TextEncoder().encode('{"value":85,"valueDecimals":0,"tag1":"starred"}')
|
|
3655
3673
|
*
|
|
3656
3674
|
* // Large content (use IPFS reference)
|
|
3657
3675
|
* contentType: ContentType.IPFS,
|
|
@@ -4232,8 +4250,9 @@ declare class Sati {
|
|
|
4232
4250
|
* const result = await sati.giveFeedback({
|
|
4233
4251
|
* payer: myKeypair,
|
|
4234
4252
|
* agentMint: address("Agent..."),
|
|
4235
|
-
*
|
|
4236
|
-
*
|
|
4253
|
+
* value: 87,
|
|
4254
|
+
* valueDecimals: 0,
|
|
4255
|
+
* tag1: "starred",
|
|
4237
4256
|
* message: "Great response time",
|
|
4238
4257
|
* });
|
|
4239
4258
|
* ```
|
|
@@ -4281,8 +4300,8 @@ declare class Sati {
|
|
|
4281
4300
|
* ```typescript
|
|
4282
4301
|
* const feedbacks = await sati.searchFeedback({
|
|
4283
4302
|
* agentMint: address("Agent..."),
|
|
4284
|
-
*
|
|
4285
|
-
*
|
|
4303
|
+
* tag1: "starred",
|
|
4304
|
+
* minValue: 70,
|
|
4286
4305
|
* });
|
|
4287
4306
|
* ```
|
|
4288
4307
|
*/
|
|
@@ -4290,15 +4309,15 @@ declare class Sati {
|
|
|
4290
4309
|
/**
|
|
4291
4310
|
* Get reputation summary for an agent.
|
|
4292
4311
|
*
|
|
4293
|
-
* Aggregates feedback
|
|
4312
|
+
* Aggregates feedback values, optionally filtered by tag1 and/or tag2.
|
|
4294
4313
|
*
|
|
4295
4314
|
* @example
|
|
4296
4315
|
* ```typescript
|
|
4297
4316
|
* const summary = await sati.getReputationSummary(address("Agent..."));
|
|
4298
|
-
* console.log(`${summary.count} reviews, avg ${summary.
|
|
4317
|
+
* console.log(`${summary.count} reviews, avg ${summary.averageValue}`);
|
|
4299
4318
|
* ```
|
|
4300
4319
|
*/
|
|
4301
|
-
getReputationSummary(agentMint: Address$1,
|
|
4320
|
+
getReputationSummary(agentMint: Address$1, tag1?: string, tag2?: string): Promise<ReputationSummary>;
|
|
4302
4321
|
/**
|
|
4303
4322
|
* Search validation attestations for an agent.
|
|
4304
4323
|
*
|