@silvana-one/coordination 1.0.15 → 1.0.16
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/dist/node/agent.d.ts +17 -0
- package/dist/node/agent.js +35 -4
- package/dist/node/agent.js.map +1 -1
- package/dist/node/index.cjs +38 -7
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/tsconfig.web.tsbuildinfo +1 -1
- package/dist/web/agent.d.ts +17 -0
- package/dist/web/agent.js +35 -4
- package/dist/web/agent.js.map +1 -1
- package/package.json +3 -3
- package/src/agent.ts +71 -3
package/src/agent.ts
CHANGED
|
@@ -2,6 +2,26 @@ import { Transaction } from "@mysten/sui/transactions";
|
|
|
2
2
|
import { SUI_CLOCK_OBJECT_ID } from "@mysten/sui/utils";
|
|
3
3
|
import { fetchSuiDynamicField } from "./fetch.js";
|
|
4
4
|
|
|
5
|
+
type AgentChain =
|
|
6
|
+
| "ethereum-mainnet"
|
|
7
|
+
| "ethereum-seplolia"
|
|
8
|
+
| "ethereum-holesky"
|
|
9
|
+
| "ethereum-hoodi"
|
|
10
|
+
| "mina-mainnet"
|
|
11
|
+
| "mina-devnet"
|
|
12
|
+
| "zeko-testnet"
|
|
13
|
+
| "zeko-alphanet"
|
|
14
|
+
| "sui-mainnet"
|
|
15
|
+
| "sui-testnet"
|
|
16
|
+
| "sui-devnet"
|
|
17
|
+
| "solana-mainnet"
|
|
18
|
+
| "solana-testnet"
|
|
19
|
+
| "solana-devnet"
|
|
20
|
+
| "solana-devnet"
|
|
21
|
+
| "walrus-mainnet"
|
|
22
|
+
| "walrus-testnet"
|
|
23
|
+
| string; // other chains
|
|
24
|
+
|
|
5
25
|
export interface Agent {
|
|
6
26
|
id: string;
|
|
7
27
|
name: string;
|
|
@@ -13,8 +33,10 @@ export interface Agent {
|
|
|
13
33
|
minMemoryGb: number;
|
|
14
34
|
minCpuCores: number;
|
|
15
35
|
supportsTEE: boolean;
|
|
36
|
+
chains: AgentChain[];
|
|
16
37
|
createdAt: number;
|
|
17
38
|
updatedAt: number;
|
|
39
|
+
version: number;
|
|
18
40
|
}
|
|
19
41
|
|
|
20
42
|
export interface Developer {
|
|
@@ -27,6 +49,14 @@ export interface Developer {
|
|
|
27
49
|
owner: string;
|
|
28
50
|
createdAt: number;
|
|
29
51
|
updatedAt: number;
|
|
52
|
+
version: number;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
export interface DeveloperNames {
|
|
56
|
+
id: string;
|
|
57
|
+
developer_address: string;
|
|
58
|
+
names: string[];
|
|
59
|
+
version: number;
|
|
30
60
|
}
|
|
31
61
|
|
|
32
62
|
export class AgentRegistry {
|
|
@@ -99,13 +129,18 @@ export class AgentRegistry {
|
|
|
99
129
|
return tx;
|
|
100
130
|
}
|
|
101
131
|
|
|
102
|
-
removeDeveloper(params: { name: string }): Transaction {
|
|
103
|
-
const { name } = params;
|
|
132
|
+
removeDeveloper(params: { name: string; agentNames: string[] }): Transaction {
|
|
133
|
+
const { name, agentNames } = params;
|
|
104
134
|
const tx = new Transaction();
|
|
105
135
|
|
|
106
136
|
tx.moveCall({
|
|
107
137
|
target: `@silvana/agent::registry::remove_developer`,
|
|
108
|
-
arguments: [
|
|
138
|
+
arguments: [
|
|
139
|
+
tx.object(this.registry),
|
|
140
|
+
tx.pure.string(name),
|
|
141
|
+
tx.pure.vector("string", agentNames),
|
|
142
|
+
tx.object(SUI_CLOCK_OBJECT_ID),
|
|
143
|
+
],
|
|
109
144
|
});
|
|
110
145
|
|
|
111
146
|
return tx;
|
|
@@ -122,6 +157,7 @@ export class AgentRegistry {
|
|
|
122
157
|
min_memory_gb: number;
|
|
123
158
|
min_cpu_cores: number;
|
|
124
159
|
supports_tee: boolean;
|
|
160
|
+
chains: AgentChain[];
|
|
125
161
|
}): Transaction {
|
|
126
162
|
const {
|
|
127
163
|
developer,
|
|
@@ -134,6 +170,7 @@ export class AgentRegistry {
|
|
|
134
170
|
min_memory_gb,
|
|
135
171
|
min_cpu_cores,
|
|
136
172
|
supports_tee,
|
|
173
|
+
chains,
|
|
137
174
|
} = params;
|
|
138
175
|
const tx = new Transaction();
|
|
139
176
|
|
|
@@ -151,6 +188,7 @@ export class AgentRegistry {
|
|
|
151
188
|
tx.pure.u16(min_memory_gb),
|
|
152
189
|
tx.pure.u16(min_cpu_cores),
|
|
153
190
|
tx.pure.bool(supports_tee),
|
|
191
|
+
tx.pure.vector("string", chains),
|
|
154
192
|
tx.object(SUI_CLOCK_OBJECT_ID),
|
|
155
193
|
],
|
|
156
194
|
});
|
|
@@ -169,6 +207,7 @@ export class AgentRegistry {
|
|
|
169
207
|
min_memory_gb: number;
|
|
170
208
|
min_cpu_cores: number;
|
|
171
209
|
supports_tee: boolean;
|
|
210
|
+
chains: AgentChain[];
|
|
172
211
|
}): Transaction {
|
|
173
212
|
const {
|
|
174
213
|
developer,
|
|
@@ -181,6 +220,7 @@ export class AgentRegistry {
|
|
|
181
220
|
min_memory_gb,
|
|
182
221
|
min_cpu_cores,
|
|
183
222
|
supports_tee,
|
|
223
|
+
chains,
|
|
184
224
|
} = params;
|
|
185
225
|
const tx = new Transaction();
|
|
186
226
|
|
|
@@ -198,6 +238,7 @@ export class AgentRegistry {
|
|
|
198
238
|
tx.pure.u16(min_memory_gb),
|
|
199
239
|
tx.pure.u16(min_cpu_cores),
|
|
200
240
|
tx.pure.bool(supports_tee),
|
|
241
|
+
tx.pure.vector("string", chains),
|
|
201
242
|
tx.object(SUI_CLOCK_OBJECT_ID),
|
|
202
243
|
],
|
|
203
244
|
});
|
|
@@ -215,6 +256,7 @@ export class AgentRegistry {
|
|
|
215
256
|
tx.object(this.registry),
|
|
216
257
|
tx.pure.string(developer),
|
|
217
258
|
tx.pure.string(agent),
|
|
259
|
+
tx.object(SUI_CLOCK_OBJECT_ID),
|
|
218
260
|
],
|
|
219
261
|
});
|
|
220
262
|
|
|
@@ -241,6 +283,7 @@ export class AgentRegistry {
|
|
|
241
283
|
owner: (developerObject as any).owner,
|
|
242
284
|
createdAt: Number((developerObject as any).created_at),
|
|
243
285
|
updatedAt: Number((developerObject as any).updated_at),
|
|
286
|
+
version: Number((developerObject as any).version),
|
|
244
287
|
};
|
|
245
288
|
if (
|
|
246
289
|
!developer.id ||
|
|
@@ -255,6 +298,30 @@ export class AgentRegistry {
|
|
|
255
298
|
return developer as Developer;
|
|
256
299
|
}
|
|
257
300
|
|
|
301
|
+
async getDeveloperNames(params: {
|
|
302
|
+
developerAddress: string;
|
|
303
|
+
}): Promise<DeveloperNames | undefined> {
|
|
304
|
+
const developerObject = await fetchSuiDynamicField({
|
|
305
|
+
objectID: this.registry,
|
|
306
|
+
fieldName: "developers_index",
|
|
307
|
+
type: "address",
|
|
308
|
+
key: params.developerAddress,
|
|
309
|
+
});
|
|
310
|
+
if (!developerObject) {
|
|
311
|
+
return undefined;
|
|
312
|
+
}
|
|
313
|
+
const developer = {
|
|
314
|
+
id: (developerObject as any)?.id?.id,
|
|
315
|
+
developer_address: (developerObject as any).developer,
|
|
316
|
+
names: (developerObject as any).names,
|
|
317
|
+
version: Number((developerObject as any).version),
|
|
318
|
+
};
|
|
319
|
+
if (!developer.id || !developer.developer_address || !developer.names) {
|
|
320
|
+
return undefined;
|
|
321
|
+
}
|
|
322
|
+
return developer as DeveloperNames;
|
|
323
|
+
}
|
|
324
|
+
|
|
258
325
|
async getAgent(params: {
|
|
259
326
|
developer: string;
|
|
260
327
|
agent: string;
|
|
@@ -293,6 +360,7 @@ export class AgentRegistry {
|
|
|
293
360
|
supportsTEE: Boolean((agentObject as any).supports_tee),
|
|
294
361
|
createdAt: Number((agentObject as any).created_at),
|
|
295
362
|
updatedAt: Number((agentObject as any).updated_at),
|
|
363
|
+
version: Number((agentObject as any).version),
|
|
296
364
|
};
|
|
297
365
|
if (
|
|
298
366
|
!agent.id ||
|