@mysten-incubation/sui-agent-pass 0.1.0 → 0.1.2

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 CHANGED
@@ -50,11 +50,11 @@ replacements. See `move/protocols/README.md`.
50
50
  This repository is fully self-contained. There is no broker, authorization database,
51
51
  intent adapter, or transaction builder inside MCP.
52
52
 
53
- ## Install (planned distribution)
53
+ ## Install
54
54
 
55
- Not published yet. Once the package is on npm and the immutable contracts are published on chain,
56
- a user needs no clone, no build, and no toolchain. The client ships the per-network deployment IDs
57
- (`deployments/<network>.json`) and resolves them with `--network`:
55
+ The package is on npm as `@mysten-incubation/sui-agent-pass` (the incubation scope, for the
56
+ dogfood; the launch release will follow). A user needs no clone, no build, and no toolchain. The
57
+ client ships the per-network deployment IDs (`deployments/<network>.json`):
58
58
 
59
59
  ```sh
60
60
  npm install -g @mysten-incubation/sui-agent-pass
@@ -274,7 +274,8 @@ package and a live feed of every call into it, refreshing every four seconds.
274
274
  The pages use the Sui brand fonts, which are licensed and not in git: put the brand kit under
275
275
  `.local/brand/` and run `npm run brand` before building, or the pages fall back to system fonts.
276
276
  The build bundles `deployments/<network>.json`; `?network=testnet` picks one, otherwise the
277
- first of testnet, devnet, localnet, mainnet that exists. To host it, serve `web-dist/` as static
277
+ first of mainnet, testnet, devnet, localnet that exists. `#/` is the home page with the setup
278
+ steps, `#/guide` the longer guide, `#/explorer` the search and the wallet's own passes. To host it, serve `web-dist/` as static
278
279
  files at a fixed origin and set `siteUrl` in the deployment file. To run it locally against any
279
280
  deployment:
280
281
 
@@ -15,7 +15,11 @@ process with small sums; the real launch will be a fresh publish and a new file
15
15
  `siteUrl` to it once the hosted site has its address, so the plugin sends owners there.
16
16
  `testnet.json` is the current package (Sui Agent Pass), published to testnet on 2026-10-20 with
17
17
  the version gate and the per-coin deployment shape (`coins`, `pools`, NAVI `reserves`, the demo
18
- faucet). Any Move change means a new publish and a new file here. `npm run devnet` publishes to devnet and writes its
18
+ faucet). The shipped copy lists no pools and no reserves on purpose: the testnet markets are
19
+ stand-ins with 2 SUI of depth, so dogfooders get transfers and staking there and trade on
20
+ mainnet. The stand-in pools stay on chain, and the previous revision of this file in git keeps
21
+ their ids; the tests publish their own stand-ins. Any Move change means a new publish and a new
22
+ file here. `npm run devnet` publishes to devnet and writes its
19
23
  `deployment.json` for the plugin; `npm run deploy -- create --network <name>` publishes to
20
24
  testnet or devnet. At launch, commit the resulting `deployment.json` here as `<name>.json`.
21
25
 
@@ -17,20 +17,7 @@
17
17
  "decimals": 6
18
18
  }
19
19
  ],
20
- "pools": [
21
- {
22
- "venue": "deepbook",
23
- "poolId": "0xf95b10ec49e92a4afaa81ff679ebfd8b7e9371984d8c214b26783d9fdfc02a29",
24
- "coinA": "0x0000000000000000000000000000000000000000000000000000000000000002::sui::SUI",
25
- "coinB": "0x7ffc375a2bebedcec3753cfe4687f3bb104074eb55b014f8185ccc8ee8bf47fa::usdc::USDC"
26
- },
27
- {
28
- "venue": "cetus",
29
- "poolId": "0x3c779cab1582156a06aca223690bcd23f781ff3fbdda99747659ebddc2059e88",
30
- "coinA": "0x0000000000000000000000000000000000000000000000000000000000000002::sui::SUI",
31
- "coinB": "0x7ffc375a2bebedcec3753cfe4687f3bb104074eb55b014f8185ccc8ee8bf47fa::usdc::USDC"
32
- }
33
- ],
20
+ "pools": [],
34
21
  "demoFaucet": {
35
22
  "packageId": "0x7ffc375a2bebedcec3753cfe4687f3bb104074eb55b014f8185ccc8ee8bf47fa",
36
23
  "faucetId": "0x14d07fd3eff80c868c0bab116cbc2f65c8903c77fcb41721ad6db4ba0c6480cf",
@@ -54,16 +41,7 @@
54
41
  "oracleId": "0xc962d8795540426c4dce1fea621d89f12f00766a6d4b0d00087fde6fefb2d343",
55
42
  "incentiveV2Id": "0x679e3525405bb43ba27b0839dcaae2469d59225856cd6c2e8318a094efe593c5",
56
43
  "incentiveV3Id": "0x9488d70edbfd67babcc72b8eb1f3fbf60dd47f080d830e2af27abcecdd6771c6",
57
- "reserves": {
58
- "0x0000000000000000000000000000000000000000000000000000000000000002::sui::SUI": {
59
- "poolId": "0x3bdcd67ca6465324f0977d7912dbfb7a25cad759e03744aa760e0fa5baa31812",
60
- "assetId": 0
61
- },
62
- "0x7ffc375a2bebedcec3753cfe4687f3bb104074eb55b014f8185ccc8ee8bf47fa::usdc::USDC": {
63
- "poolId": "0x7f05ed3b912e6e1b573f8d3095cf3c437fb0fcf78d09669c504c66bceb3bf9a3",
64
- "assetId": 1
65
- }
66
- }
44
+ "reserves": {}
67
45
  }
68
46
  }
69
47
  }
package/dist/cli.js CHANGED
@@ -2,9 +2,11 @@
2
2
  // Copyright (c) Mysten Labs, Inc.
3
3
  // SPDX-License-Identifier: Apache-2.0
4
4
  import { spawn } from 'node:child_process';
5
+ import { realpathSync } from 'node:fs';
5
6
  import { access, mkdir, readFile, writeFile } from 'node:fs/promises';
6
7
  import { homedir } from 'node:os';
7
8
  import { dirname, join, resolve } from 'node:path';
9
+ import { fileURLToPath } from 'node:url';
8
10
  import { select } from '@inquirer/prompts';
9
11
  import { Command } from 'commander';
10
12
  import { clientFor, readStatus } from './chain.js';
@@ -237,7 +239,10 @@ program
237
239
  if (!http)
238
240
  console.log('\nDone. Open the agent and tell it what to do with your money; it proposes the pass, you review and sign in your wallet, and it acts within the rules. Restart the agent after upgrading this package so it loads the new server.');
239
241
  });
240
- if (process.argv[1] && /(?:^|\/)cli\.(?:ts|js)$/.test(process.argv[1])) {
242
+ // Run only when this file is the entry: directly, through tsx in development, or through the
243
+ // package's `agent-pass` bin, which is a symlink to it.
244
+ const entry = process.argv[1] ? realpathSync(process.argv[1]) : '';
245
+ if (entry === fileURLToPath(import.meta.url) || /(?:^|\/)cli\.(?:ts|js)$/.test(entry)) {
241
246
  program.parseAsync().catch((error) => {
242
247
  console.error(error.message);
243
248
  process.exitCode = 1;
package/dist/plugin.js CHANGED
@@ -310,7 +310,9 @@ async function toSetup(client, d0, input) {
310
310
  const pools = poolsFor(d, coinIn, coinOut).filter((p) => (!sw.venues || sw.venues.includes(p.venue)) &&
311
311
  (!sw.pools || sw.pools.some((id) => normalizeSuiAddress(id) === p.poolId)));
312
312
  if (!pools.length)
313
- throw new Error(`No pool trades ${sw.sell} for ${sw.buy}${sw.venues ? ` on ${sw.venues.join(', ')}` : ''}${sw.pools ? ` among ${sw.pools.join(', ')}` : ''}; name a DeepBook or Cetus pool id for this pair in pools`);
313
+ throw new Error(d.pools.length
314
+ ? `No pool trades ${sw.sell} for ${sw.buy}${sw.venues ? ` on ${sw.venues.join(', ')}` : ''}${sw.pools ? ` among ${sw.pools.join(', ')}` : ''}; name a DeepBook or Cetus pool id for this pair in pools`
315
+ : `Swaps are not offered on ${d.network}: it lists no pools. Propose a pass on a network that does, or leave swaps out`);
314
316
  return {
315
317
  coinIn,
316
318
  coinOut,
@@ -320,13 +322,20 @@ async function toSetup(client, d0, input) {
320
322
  minPrice: priceUnits(d, coinIn, coinOut, sw.minPrice),
321
323
  };
322
324
  }),
323
- lending: input.lending.map((l) => ({
324
- coin: coin(l.coin).type,
325
- allowBorrow: l.allowBorrow,
326
- perAction: inUnits(l.coin, l.perAction),
327
- daily: inUnits(l.coin, l.daily),
328
- minHealthFactor: l.minHealthFactor,
329
- })),
325
+ lending: input.lending.map((l) => {
326
+ const type = coin(l.coin).type;
327
+ if (!d.protocols.navi.reserves[type])
328
+ throw new Error(Object.keys(d.protocols.navi.reserves).length
329
+ ? `NAVI has no reserve for ${l.coin} on ${d.network}`
330
+ : `Lending is not offered on ${d.network}: it lists no NAVI reserves. Propose a pass on a network that does, or leave lending out`);
331
+ return {
332
+ coin: type,
333
+ allowBorrow: l.allowBorrow,
334
+ perAction: inUnits(l.coin, l.perAction),
335
+ daily: inUnits(l.coin, l.daily),
336
+ minHealthFactor: l.minHealthFactor,
337
+ };
338
+ }),
330
339
  staking: input.staking && {
331
340
  validators: input.staking.validators,
332
341
  perStake: sui(input.staking.perStake),
@@ -415,6 +424,11 @@ export function createPluginMcp(registry) {
415
424
  pair: `${coinInfo(d, p.coinA).symbol}/${coinInfo(d, p.coinB).symbol}`,
416
425
  })),
417
426
  lending: Object.keys(d.protocols.navi.reserves).map((c) => coinInfo(d, c).symbol),
427
+ ...(d.pools.length || Object.keys(d.protocols.navi.reserves).length
428
+ ? {}
429
+ : {
430
+ note: 'Transfers and staking only: this network lists no pools and no NAVI reserves, so swap and lending rules are refused here.',
431
+ }),
418
432
  });
419
433
  const own = (await exists(path)) ? [await markets(await registry.deployment())] : [];
420
434
  const bundled = await Promise.all((await registry.bundledNetworks()).map(async (n) => markets(await registry.bundled(n))));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mysten-incubation/sui-agent-pass",
3
- "version": "0.1.0",
3
+ "version": "0.1.2",
4
4
  "type": "module",
5
5
  "description": "AI builds transactions. A session signer signs. Your pass enforces the rules.",
6
6
  "repository": {