@mysten-incubation/sui-agent-pass 0.1.11 → 0.1.12
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/deployments/README.md +5 -7
- package/deployments/mainnet.json +6 -6
- package/deployments/testnet.json +20 -20
- package/dist/agent.js +1 -1
- package/dist/describe.js +1 -2
- package/dist/explorer.js +20 -47
- package/dist/owner.js +2 -8
- package/dist/plugin.js +5 -25
- package/docs/AGENT.md +14 -11
- package/package.json +1 -1
- package/web-dist/assets/{index-7G6YmGOW.js → index-CYxzH4KP.js} +68 -68
- package/web-dist/assets/{mount-62qnVZBM.js → mount-s6BTZhm6.js} +1 -1
- package/web-dist/deployments/mainnet.json +6 -6
- package/web-dist/deployments/testnet.json +20 -20
- package/web-dist/index.html +1 -1
package/deployments/README.md
CHANGED
|
@@ -9,13 +9,11 @@ and the chain identifier for that network. The stdio server loads one of these w
|
|
|
9
9
|
the agent names a `network` in `propose_authorization`, so an installed client needs no local
|
|
10
10
|
publish; a private `deployment.json` under `~/.sui-agent-pass` or a `deployment` path overrides.
|
|
11
11
|
|
|
12
|
-
`mainnet.json` is the mainnet test copy of the package (`
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
`
|
|
17
|
-
the version gate and the per-coin deployment shape (`coins`, `pools`, NAVI `reserves`, the demo
|
|
18
|
-
faucet). The shipped copy lists no pools and no reserves on purpose: the testnet markets are
|
|
12
|
+
`mainnet.json` is the mainnet test copy of the package (`0x4736026b…0a22`, published
|
|
13
|
+
2026-10-28 from the code that will launch, caps with its publisher), for dogfooding with small
|
|
14
|
+
sums; the real launch will be a fresh publish and a new file here. Its `siteUrl` sends owners to
|
|
15
|
+
the hosted site. `testnet.json` is the same code, published to testnet on 2026-10-28
|
|
16
|
+
(`0x52017f8e…17b6`) with its stand-in markets and the demo faucet. The shipped copy lists no pools and no reserves on purpose: the testnet markets are
|
|
19
17
|
stand-ins with 2 SUI of depth, so dogfooders get transfers and staking there and trade on
|
|
20
18
|
mainnet. The stand-in pools stay on chain, and the previous revision of this file in git keeps
|
|
21
19
|
their ids; the tests publish their own stand-ins. Any Move change means a new publish and a new
|
package/deployments/mainnet.json
CHANGED
|
@@ -2,11 +2,9 @@
|
|
|
2
2
|
"network": "mainnet",
|
|
3
3
|
"grpcUrl": "https://fullnode.mainnet.sui.io:443",
|
|
4
4
|
"chainIdentifier": "4btiuiMPvEENsttpZC7CZ53DruC3MAgfznDbASZ7DR6S",
|
|
5
|
-
"packageId": "
|
|
6
|
-
"publishedAt": "
|
|
7
|
-
"configId": "
|
|
8
|
-
"maxTermDays": 30,
|
|
9
|
-
"siteUrl": "https://sui-agent-pass.vercel.app",
|
|
5
|
+
"packageId": "0x4736026bde8ef425b243013e6e25431a9b5c9c5ccf62ff87ceb0d4e67c700a22",
|
|
6
|
+
"publishedAt": "0x4736026bde8ef425b243013e6e25431a9b5c9c5ccf62ff87ceb0d4e67c700a22",
|
|
7
|
+
"configId": "0x7d472b14c833c4d8442ac3a176e25d47e946847f293af58934ff2e3fb3109f7c",
|
|
10
8
|
"coins": [
|
|
11
9
|
{
|
|
12
10
|
"type": "0x0000000000000000000000000000000000000000000000000000000000000002::sui::SUI",
|
|
@@ -33,6 +31,7 @@
|
|
|
33
31
|
"coinB": "0x0000000000000000000000000000000000000000000000000000000000000002::sui::SUI"
|
|
34
32
|
}
|
|
35
33
|
],
|
|
34
|
+
"maxTermDays": 365,
|
|
36
35
|
"protocols": {
|
|
37
36
|
"deepbook": {
|
|
38
37
|
"packageId": "0x2c8d603bc51326b8c13cef9dd07031a408a48dddb541963357661df5d3204809",
|
|
@@ -64,5 +63,6 @@
|
|
|
64
63
|
}
|
|
65
64
|
}
|
|
66
65
|
}
|
|
67
|
-
}
|
|
66
|
+
},
|
|
67
|
+
"siteUrl": "https://sui-agent-pass.vercel.app"
|
|
68
68
|
}
|
package/deployments/testnet.json
CHANGED
|
@@ -2,10 +2,9 @@
|
|
|
2
2
|
"network": "testnet",
|
|
3
3
|
"grpcUrl": "https://fullnode.testnet.sui.io:443",
|
|
4
4
|
"chainIdentifier": "69WiPg3DAQiwdxfncX6wYQ2siKwAe6L9BZthQea3JNMD",
|
|
5
|
-
"packageId": "
|
|
6
|
-
"publishedAt": "
|
|
7
|
-
"configId": "
|
|
8
|
-
"maxTermDays": 30,
|
|
5
|
+
"packageId": "0x52017f8e68e133c6dc84c8733a9f52de0d2a9fb5e2c63b8949b0f7c0c47917b6",
|
|
6
|
+
"publishedAt": "0x52017f8e68e133c6dc84c8733a9f52de0d2a9fb5e2c63b8949b0f7c0c47917b6",
|
|
7
|
+
"configId": "0xe58594af166a1280f9ab04d0e615ceb7209211bc9bee6780a4b00878b023a65b",
|
|
9
8
|
"coins": [
|
|
10
9
|
{
|
|
11
10
|
"type": "0x0000000000000000000000000000000000000000000000000000000000000002::sui::SUI",
|
|
@@ -13,35 +12,36 @@
|
|
|
13
12
|
"decimals": 9
|
|
14
13
|
},
|
|
15
14
|
{
|
|
16
|
-
"type": "
|
|
15
|
+
"type": "0xd85020ee4adfa8137605184ad876c96ca293577533a37bff43ac2778b97f2938::usdc::USDC",
|
|
17
16
|
"symbol": "USDC",
|
|
18
17
|
"decimals": 6
|
|
19
18
|
}
|
|
20
19
|
],
|
|
21
20
|
"pools": [],
|
|
21
|
+
"maxTermDays": 365,
|
|
22
22
|
"demoFaucet": {
|
|
23
|
-
"packageId": "
|
|
24
|
-
"faucetId": "
|
|
25
|
-
"coin": "
|
|
23
|
+
"packageId": "0xd85020ee4adfa8137605184ad876c96ca293577533a37bff43ac2778b97f2938",
|
|
24
|
+
"faucetId": "0x853a8e316634215fc297f07a3d23a98b4d40222a7819a07068737689d6c8fc00",
|
|
25
|
+
"coin": "0xd85020ee4adfa8137605184ad876c96ca293577533a37bff43ac2778b97f2938::usdc::USDC"
|
|
26
26
|
},
|
|
27
27
|
"protocols": {
|
|
28
28
|
"deepbook": {
|
|
29
|
-
"packageId": "
|
|
30
|
-
"publishedAt": "
|
|
29
|
+
"packageId": "0xf6331717135b1e7edc75ba2cfb3b08a9ec8549884cfc18abc534e4a0bbada9e8",
|
|
30
|
+
"publishedAt": "0xf6331717135b1e7edc75ba2cfb3b08a9ec8549884cfc18abc534e4a0bbada9e8"
|
|
31
31
|
},
|
|
32
32
|
"cetus": {
|
|
33
|
-
"packageId": "
|
|
34
|
-
"publishedAt": "
|
|
35
|
-
"configId": "
|
|
33
|
+
"packageId": "0xffa6ea563e395f3fd3d86e227a59bdd0ed98ad23c2940822bf9c30c70ce1f167",
|
|
34
|
+
"publishedAt": "0xffa6ea563e395f3fd3d86e227a59bdd0ed98ad23c2940822bf9c30c70ce1f167",
|
|
35
|
+
"configId": "0x2105734227e38828ba69289d4cce4edc1e45666a717c692a9575b6d467ee3bef"
|
|
36
36
|
},
|
|
37
37
|
"navi": {
|
|
38
|
-
"packageId": "
|
|
39
|
-
"publishedAt": "
|
|
40
|
-
"oraclePackageId": "
|
|
41
|
-
"storageId": "
|
|
42
|
-
"oracleId": "
|
|
43
|
-
"incentiveV2Id": "
|
|
44
|
-
"incentiveV3Id": "
|
|
38
|
+
"packageId": "0x5cacd4bed4e0502280b0fe94eb51e02244dea86b584e1f91d9ded493c72eebb5",
|
|
39
|
+
"publishedAt": "0x5cacd4bed4e0502280b0fe94eb51e02244dea86b584e1f91d9ded493c72eebb5",
|
|
40
|
+
"oraclePackageId": "0x4891910b7259bff2f220f017c7e7e4628f5c26efff47eeb75453cf997387a56b",
|
|
41
|
+
"storageId": "0x37d8af65a9ac8ae7c4e99304ae8347ef72dcd30759f509f8c4376e86107087bc",
|
|
42
|
+
"oracleId": "0x3730ff06112853476c9b8c6121206776c6ed912ecc61ce8ffe25b697250f0131",
|
|
43
|
+
"incentiveV2Id": "0xb776dbb5e7a27a766d8fb4087000d58831eec3061a30c95edc5c728ef1508407",
|
|
44
|
+
"incentiveV3Id": "0xbafebe7c1a71f024f304f626215f6706c40cff72c45163e09d62d97cadea4f9e",
|
|
45
45
|
"reserves": {}
|
|
46
46
|
}
|
|
47
47
|
}
|
package/dist/agent.js
CHANGED
|
@@ -342,7 +342,7 @@ async function naviAmount(i, entry, coin, amount) {
|
|
|
342
342
|
await refreshNaviPrices(tx, d);
|
|
343
343
|
// NAVI's SUI pool stakes idle SUI and may unstake to pay out, hence the system state.
|
|
344
344
|
tx.moveCall({
|
|
345
|
-
target: `${d.publishedAt}::pass::${entry}
|
|
345
|
+
target: `${d.publishedAt}::pass::${entry}`,
|
|
346
346
|
typeArguments: [coin],
|
|
347
347
|
arguments: [
|
|
348
348
|
...pass(tx, i),
|
package/dist/describe.js
CHANGED
package/dist/explorer.js
CHANGED
|
@@ -1,6 +1,11 @@
|
|
|
1
1
|
// Copyright (c) Mysten Labs, Inc.
|
|
2
2
|
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
-
|
|
3
|
+
/**
|
|
4
|
+
* Reads for the hosted explorer: everything about a pass from the chain alone, with no local
|
|
5
|
+
* session state. Browser-safe: no Node imports.
|
|
6
|
+
*/
|
|
7
|
+
import { bcs } from '@mysten/sui/bcs';
|
|
8
|
+
import { deriveObjectID, normalizeSuiAddress } from '@mysten/sui/utils';
|
|
4
9
|
import { createdEventType, discoverAllowances, parseCreated, readControl, } from './chain.js';
|
|
5
10
|
import { describeAttempt } from './describe.js';
|
|
6
11
|
async function createdEvents(client, d, limit, before = null) {
|
|
@@ -23,55 +28,23 @@ async function createdEvents(client, d, limit, before = null) {
|
|
|
23
28
|
return { summaries, hasNextPage: page.hasNextPage, endCursor: page.endCursor };
|
|
24
29
|
}
|
|
25
30
|
/**
|
|
26
|
-
* The
|
|
27
|
-
*
|
|
31
|
+
* The ID a pass for an agent key has, whether or not the owner has created it: the contract
|
|
32
|
+
* derives it from the config and the key (`pass::pass_of`), so a key has at most one pass.
|
|
28
33
|
*/
|
|
29
|
-
export
|
|
30
|
-
const wanted = normalizeSuiAddress(agent);
|
|
31
|
-
let cursor = null;
|
|
32
|
-
for (let pages = 0; pages < 10; pages++) {
|
|
33
|
-
const page = await client.listEvents({
|
|
34
|
-
filter: { eventType: createdEventType(d) },
|
|
35
|
-
order: 'descending',
|
|
36
|
-
limit: 50,
|
|
37
|
-
...(cursor ? { before: cursor } : {}),
|
|
38
|
-
});
|
|
39
|
-
for (const e of page.events) {
|
|
40
|
-
const created = parseCreated(e.bcs);
|
|
41
|
-
if (created.agent === wanted)
|
|
42
|
-
return { ...created, digest: e.transactionDigest };
|
|
43
|
-
}
|
|
44
|
-
if (!page.hasNextPage || !page.endCursor)
|
|
45
|
-
return null;
|
|
46
|
-
cursor = page.endCursor;
|
|
47
|
-
}
|
|
48
|
-
return null;
|
|
49
|
-
}
|
|
34
|
+
export const passIdOf = (d, agent) => deriveObjectID(d.configId, `${d.packageId}::pass::AgentKey`, bcs.Address.serialize(normalizeSuiAddress(agent)).toBytes());
|
|
50
35
|
/**
|
|
51
|
-
*
|
|
52
|
-
*
|
|
53
|
-
* signed again.
|
|
36
|
+
* The pass of an agent key once the owner has created it, with its owner and the transaction
|
|
37
|
+
* that last changed it, which before the agent's first action is the authorization itself.
|
|
54
38
|
*/
|
|
55
|
-
export async function
|
|
56
|
-
const
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
});
|
|
65
|
-
for (const e of page.events) {
|
|
66
|
-
const created = parseCreated(e.bcs);
|
|
67
|
-
if (created.agent === wanted)
|
|
68
|
-
found.push({ ...created, digest: e.transactionDigest });
|
|
69
|
-
}
|
|
70
|
-
if (!page.hasNextPage || !page.endCursor)
|
|
71
|
-
break;
|
|
72
|
-
cursor = page.endCursor;
|
|
73
|
-
}
|
|
74
|
-
return found;
|
|
39
|
+
export async function findPassByAgent(client, d, agent) {
|
|
40
|
+
const id = passIdOf(d, agent);
|
|
41
|
+
const found = await client
|
|
42
|
+
.getObject({ objectId: id, include: { previousTransaction: true } })
|
|
43
|
+
.catch(() => null);
|
|
44
|
+
if (!found?.object.previousTransaction)
|
|
45
|
+
return null;
|
|
46
|
+
const { owner } = await readControl(client, d, id);
|
|
47
|
+
return { id, owner, digest: found.object.previousTransaction };
|
|
75
48
|
}
|
|
76
49
|
/** The most recently created passes on this package. */
|
|
77
50
|
export async function listPasses(client, d, limit = 50) {
|
package/dist/owner.js
CHANGED
|
@@ -254,14 +254,8 @@ export function buildAmendment(d, current, next, owner) {
|
|
|
254
254
|
const { active, control } = current, pass = tx.object(active.passId), session = control.agent;
|
|
255
255
|
if (String(next.expiresMs) !== control.agentExpiresMs)
|
|
256
256
|
tx.moveCall({
|
|
257
|
-
target: `${d.publishedAt}::pass::
|
|
258
|
-
arguments: [
|
|
259
|
-
pass,
|
|
260
|
-
tx.object(d.configId),
|
|
261
|
-
tx.pure.address(session),
|
|
262
|
-
tx.pure.u64(next.expiresMs),
|
|
263
|
-
tx.object(CLOCK),
|
|
264
|
-
],
|
|
257
|
+
target: `${d.publishedAt}::pass::set_term`,
|
|
258
|
+
arguments: [pass, tx.object(d.configId), tx.pure.u64(next.expiresMs), tx.object(CLOCK)],
|
|
265
259
|
});
|
|
266
260
|
removePolicies(tx, d, pass, control.policies);
|
|
267
261
|
installPolicies(tx, d, pass, next.policy, next.policy.lending.length > 0 && !control.naviPosition);
|
package/dist/plugin.js
CHANGED
|
@@ -23,7 +23,7 @@ import { z } from 'zod';
|
|
|
23
23
|
import { clientFor, deepbookSizes, findPools, quoteSwap, readAllHoldings, readHoldings, readStatus, withMarketFacts, } from './chain.js';
|
|
24
24
|
import { describePolicy, describeSetup, renderRows } from './describe.js';
|
|
25
25
|
import { address, coinBySymbol, coinInfo, DAY_MS, defaultGasDaily, DeploymentSchema, display, isStable, limitUnits, MAX_TERM_DAYS, poolsFor, recipientName, requiredSui, sameCoin, SetupSchema, showCoin, SUI, uncovered, units, VenueSchema, } from './domain.js';
|
|
26
|
-
import {
|
|
26
|
+
import { passIdOf } from './explorer.js';
|
|
27
27
|
import { passEnded, returnGasFloat } from './float.js';
|
|
28
28
|
import { failure, INSTRUCTIONS, keyAlert, MAX_TOOL_INPUT_ELEMENTS, registerDocs, result, serverInfo, sessionInfo, SIGN_ANNOTATIONS, SIGN_DESCRIPTION, } from './mcp.js';
|
|
29
29
|
import { authenticated, body, ownerPageUrl, startServer } from './server.js';
|
|
@@ -365,24 +365,12 @@ function summary(s) {
|
|
|
365
365
|
directory: s.store.directory,
|
|
366
366
|
};
|
|
367
367
|
}
|
|
368
|
-
/**
|
|
369
|
-
* The summary plus what the chain says about the key: every pass created for it. A key is
|
|
370
|
-
* meant to sign one authorization, so a second pass here is a proposal signed twice, live on
|
|
371
|
-
* chain with its own allowances, which the session file knows nothing about.
|
|
372
|
-
*/
|
|
368
|
+
/** The summary plus what the chain says: whether the key's pass still exists, and a key alert. */
|
|
373
369
|
async function summaryWithChain(s) {
|
|
374
370
|
const base = summary(s), { state } = s.store, client = clientFor(state.deployment);
|
|
375
|
-
const
|
|
376
|
-
|
|
377
|
-
const
|
|
378
|
-
? await Promise.all(created.map(async (c) => ({
|
|
379
|
-
id: c.id,
|
|
380
|
-
live: await client.getObject({ objectId: c.id }).then(() => true, () => false),
|
|
381
|
-
})))
|
|
382
|
-
: null;
|
|
383
|
-
const own = onChain?.find((c) => c.id === state.active?.passId);
|
|
384
|
-
const closed = !!state.active && !!onChain && !own?.live;
|
|
385
|
-
const extra = onChain?.filter((c) => c.live && c.id !== state.active?.passId) ?? [];
|
|
371
|
+
const passId = passIdOf(state.deployment, state.sessionAddress);
|
|
372
|
+
const live = await client.getObject({ objectId: passId }).then(() => true, () => false);
|
|
373
|
+
const closed = !!state.active && !live;
|
|
386
374
|
return {
|
|
387
375
|
...base,
|
|
388
376
|
...(state.active && !closed
|
|
@@ -394,14 +382,6 @@ async function summaryWithChain(s) {
|
|
|
394
382
|
note: 'The owner closed this pass; its key has nothing left to act on.',
|
|
395
383
|
}
|
|
396
384
|
: {}),
|
|
397
|
-
passesOnChain: onChain,
|
|
398
|
-
...(extra.length
|
|
399
|
-
? {
|
|
400
|
-
warning: `This key is the agent of ${extra.length + (own?.live ? 1 : 0)} live passes, not one: ${extra
|
|
401
|
-
.map((c) => c.id)
|
|
402
|
-
.join(', ')} were created by signing the same proposal again. Each is live with its own allowances and gas until the owner stops or closes it from its pass page (#/pass/<id>).`,
|
|
403
|
-
}
|
|
404
|
-
: {}),
|
|
405
385
|
};
|
|
406
386
|
}
|
|
407
387
|
/** `forget_pass` for one session directory, from outside the MCP: the CLI and tests. */
|
package/docs/AGENT.md
CHANGED
|
@@ -167,17 +167,20 @@ window; `0x3::validator_set` 10 below the 1 SUI minimum stake.
|
|
|
167
167
|
|
|
168
168
|
## The pass
|
|
169
169
|
|
|
170
|
-
| Function
|
|
171
|
-
|
|
|
172
|
-
| `pass::transfer`
|
|
173
|
-
| `pass::deepbook_base_to_quote` / `deepbook_quote_to_base`
|
|
174
|
-
| `pass::cetus_a_to_b` / `cetus_b_to_a`
|
|
175
|
-
| `pass::navi_supply`
|
|
176
|
-
| `pass::
|
|
177
|
-
| `pass::navi_repay`
|
|
178
|
-
| `pass::stake`
|
|
179
|
-
| `pass::unstake`
|
|
180
|
-
| `pass::add_policy`, `remove_policy`, `
|
|
170
|
+
| Function | Type arguments | Explicit arguments |
|
|
171
|
+
| ---------------------------------------------------------------------------------------------------------------------------- | --------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
172
|
+
| `pass::transfer` | `[coin]` | pass, config, allowance, withdrawal, recipient name, clock |
|
|
173
|
+
| `pass::deepbook_base_to_quote` / `deepbook_quote_to_base` | `[base, quote]` | pass, config, allowance, withdrawal, a DeepBook pool from `deployment.pools` (`coinA` is base, `coinB` quote), min_out, clock |
|
|
174
|
+
| `pass::cetus_a_to_b` / `cetus_b_to_a` | `[a, b]` | pass, config, allowance, withdrawal, `protocols.cetus.configId`, a Cetus pool from `deployment.pools`, min_out, clock |
|
|
175
|
+
| `pass::navi_supply` | `[coin]` | pass, config, allowance, withdrawal, `navi.storageId`, `navi.reserves[coin].poolId`, `navi.reserves[coin].assetId`, `navi.incentiveV2Id`, `navi.incentiveV3Id`, clock |
|
|
176
|
+
| `pass::navi_withdraw` / `navi_borrow` | `[coin]` | pass, config, `navi.oracleId`, storage, pool, asset, incentiveV2, incentiveV3, `0x5`, amount, clock |
|
|
177
|
+
| `pass::navi_repay` | `[coin]` | pass, config, allowance, withdrawal, oracle, storage, pool, asset, incentiveV2, incentiveV3, clock |
|
|
178
|
+
| `pass::stake` | | pass, config, SUI allowance, withdrawal, `0x5`, validator address, clock; returns the stake's ID |
|
|
179
|
+
| `pass::unstake` | | pass, config, `0x5`, stake ID, clock |
|
|
180
|
+
| `pass::add_policy`, `remove_policy`, `set_term`, `revoke_agent`, `deposit_object`, `withdraw_object`, `navi_open`, `destroy` | | **owner sender only**; installs take `config` after the pass, exits do not |
|
|
181
|
+
|
|
182
|
+
A pass's ID is derived from the `Config` and its agent key: `pass::pass_of(config, agent)` on
|
|
183
|
+
chain, `passIdOf(deployment, agent)` in the client. A key has one pass, ever.
|
|
181
184
|
|
|
182
185
|
The agent's actions and the owner's calls on a live pass are `entry` functions: a transaction
|
|
183
186
|
calls them directly, and other packages cannot. The calls that run while a new pass is still
|