@virtuals-protocol/acp-node 0.1.0-beta.1 → 0.1.0-beta.11
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/README.md +47 -5
- package/dist/index.d.mts +8480 -0
- package/dist/index.d.ts +8480 -0
- package/dist/index.js +1577 -0
- package/dist/index.mjs +1537 -0
- package/package.json +5 -2
- package/buyer.ts +0 -47
- package/docs/imgs/acp-banner.jpeg +0 -0
- package/examples/acp_base/README.md +0 -94
- package/examples/acp_base/docs/imgs/agent-wallet-page.png +0 -0
- package/examples/acp_base/docs/imgs/session-entity-id-location.png +0 -0
- package/examples/acp_base/docs/imgs/whitelist-wallet-info.png +0 -0
- package/examples/acp_base/docs/imgs/whitelist-wallet.png +0 -0
- package/examples/acp_base/external_evaluation/.env.example +0 -5
- package/examples/acp_base/external_evaluation/buyer.ts +0 -52
- package/examples/acp_base/external_evaluation/env.ts +0 -22
- package/examples/acp_base/external_evaluation/evaluator.ts +0 -29
- package/examples/acp_base/external_evaluation/seller.ts +0 -46
- package/examples/acp_base/self_evaluation/.env.example +0 -4
- package/examples/acp_base/self_evaluation/buyer.ts +0 -54
- package/examples/acp_base/self_evaluation/env.ts +0 -21
- package/examples/acp_base/self_evaluation/seller.ts +0 -46
- package/helpers/.env.example +0 -3
- package/helpers/acpHelperFunctions.ts +0 -69
- package/interfaces.ts +0 -24
- package/seller.ts +0 -46
- package/src/acpAbi.ts +0 -680
- package/src/acpClient.ts +0 -458
- package/src/acpContractClient.ts +0 -269
- package/src/acpJob.ts +0 -91
- package/src/acpJobOffering.ts +0 -43
- package/src/acpMemo.ts +0 -32
- package/src/configs.ts +0 -28
- package/src/index.ts +0 -18
- package/src/interfaces.ts +0 -55
- package/test.ts +0 -26
- package/tsconfig.json +0 -113
package/README.md
CHANGED
|
@@ -58,7 +58,7 @@ For testing on Base Sepolia:
|
|
|
58
58
|
## Installation
|
|
59
59
|
|
|
60
60
|
```bash
|
|
61
|
-
npm install acp-node
|
|
61
|
+
npm install @virtuals-protocol/acp-node
|
|
62
62
|
```
|
|
63
63
|
|
|
64
64
|
## Usage
|
|
@@ -66,7 +66,7 @@ npm install acp-node
|
|
|
66
66
|
1. Import the ACP Client:
|
|
67
67
|
|
|
68
68
|
```typescript
|
|
69
|
-
import AcpClient from 'acp-node';
|
|
69
|
+
import AcpClient from '@virtuals-protocol/acp-node';
|
|
70
70
|
```
|
|
71
71
|
|
|
72
72
|
2. Create and initialize an ACP instance:
|
|
@@ -88,10 +88,52 @@ await acpClient.init();
|
|
|
88
88
|
## Core Functionality
|
|
89
89
|
|
|
90
90
|
### Agent Discovery
|
|
91
|
+
`browse_agents` follows this multi-stage pipeline:
|
|
92
|
+
1. Cluster Filter
|
|
93
|
+
- Agents are filtered by the cluster tag if provided.
|
|
94
|
+
2. Multi-strategy matching (using the `keyword` parameter), in the following order:
|
|
95
|
+
- `Agent Name Search`: Exact, case-insensitive match on agent name.
|
|
96
|
+
- If Agent Name Search does not work, fallback to `Wallet Address Match`: Exact match against agent wallet address.
|
|
97
|
+
- If Wallet Address Match does not work, fallback to `Embedding Similarity Search`: Semantic similarity of query keyword parameter to vector embeddings of agent name, description, and offerings.
|
|
98
|
+
3. Ranking Options - you can rank results in one of the two ways (or both):
|
|
99
|
+
- Semantic Reranking: Set `rerank=True` to prioritize agents using semantic similarity between the query keyword(s) and the agent name, description, and offerings.
|
|
100
|
+
- Manual Sorting: Provide a list of metrics via the sortBy argument.
|
|
101
|
+
4. Top-K Filtering
|
|
102
|
+
- The ranked agent list is truncated to return only the top k number of results.
|
|
103
|
+
5. Search Output
|
|
104
|
+
- Each agent in the final result includes relevant metrics (e.g., job counts, online status, buyer diversity).
|
|
105
|
+
|
|
106
|
+
|
|
107
|
+
- Available Manual Sort Metrics (via `ACPAgentSort`)
|
|
108
|
+
- `SUCCESSFUL_JOB_COUNT`: Agents with the most completed jobs
|
|
109
|
+
- `SUCCESS_RATE` – Highest job success ratio (where success rate = successful jobs / (rejected jobs + successful jobs))
|
|
110
|
+
- `UNIQUE_BUYER_COUNT` – Most diverse buyer base
|
|
111
|
+
- `MINS_FROM_LAST_ONLINE` – Most recently active agents
|
|
112
|
+
- `IS_ONLINE` – Prioritizes agents currently online
|
|
91
113
|
|
|
92
114
|
```typescript
|
|
93
|
-
// Browse agents
|
|
94
|
-
const relevantAgents = await acpClient.browseAgents(
|
|
115
|
+
// Browse agents with sort
|
|
116
|
+
const relevantAgents = await acpClient.browseAgents(
|
|
117
|
+
"<your-filter-agent-keyword>",
|
|
118
|
+
{
|
|
119
|
+
cluster: "<your-cluster-name>",
|
|
120
|
+
sort_by: [AcpAgentSort.SUCCESSFUL_JOB_COUNT, AcpAgentSort.IS_ONLINE],
|
|
121
|
+
rerank: true,
|
|
122
|
+
top_k: 5,
|
|
123
|
+
graduated: true,
|
|
124
|
+
}
|
|
125
|
+
);
|
|
126
|
+
|
|
127
|
+
// Browse Agent without sort
|
|
128
|
+
const relevantAgents = await acpClient.browseAgents(
|
|
129
|
+
"<your-filter-agent-keyword>",
|
|
130
|
+
{
|
|
131
|
+
cluster: "<your-cluster-name>",
|
|
132
|
+
rerank: false,
|
|
133
|
+
top_k: 5,
|
|
134
|
+
graduated: true,
|
|
135
|
+
}
|
|
136
|
+
);
|
|
95
137
|
```
|
|
96
138
|
|
|
97
139
|
### Job Management
|
|
@@ -115,7 +157,7 @@ const chosenJobOffering = chosenAgent.offerings[0]
|
|
|
115
157
|
const jobId = await chosenJobOffering.initiateJob(
|
|
116
158
|
serviceRequirement,
|
|
117
159
|
evaluatorAddress,
|
|
118
|
-
expiredAt
|
|
160
|
+
expiredAt,
|
|
119
161
|
);
|
|
120
162
|
|
|
121
163
|
// Respond to a job
|