@esseyonsui/sui-mcp-v3 0.1.8 → 0.2.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/README.md +37 -7
- package/dist/agent.d.ts.map +1 -1
- package/dist/agent.js +2 -2
- package/dist/args.d.ts +11 -2
- package/dist/args.d.ts.map +1 -1
- package/dist/args.js +37 -10
- package/dist/artifact-cache.d.ts +14 -0
- package/dist/artifact-cache.d.ts.map +1 -0
- package/dist/artifact-cache.js +48 -0
- package/dist/client.d.ts +1 -1
- package/dist/client.d.ts.map +1 -1
- package/dist/client.js +5 -3
- package/dist/config.d.ts +2 -0
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js +5 -0
- package/dist/fund.d.ts.map +1 -1
- package/dist/fund.js +2 -2
- package/dist/handles.d.ts +23 -0
- package/dist/handles.d.ts.map +1 -0
- package/dist/handles.js +142 -0
- package/dist/http.d.ts +6 -0
- package/dist/http.d.ts.map +1 -0
- package/dist/http.js +5 -0
- package/dist/init.d.ts +7 -0
- package/dist/init.d.ts.map +1 -1
- package/dist/init.js +18 -11
- package/dist/io.d.ts +22 -12
- package/dist/io.d.ts.map +1 -1
- package/dist/io.js +194 -142
- package/dist/keys.d.ts +2 -0
- package/dist/keys.d.ts.map +1 -1
- package/dist/keys.js +14 -1
- package/dist/main.js +21 -9
- package/dist/records.d.ts +21 -4
- package/dist/records.d.ts.map +1 -1
- package/dist/records.js +74 -21
- package/dist/reveal.d.ts +7 -0
- package/dist/reveal.d.ts.map +1 -0
- package/dist/reveal.js +40 -0
- package/dist/snapshot.d.ts +13 -0
- package/dist/snapshot.d.ts.map +1 -0
- package/dist/snapshot.js +29 -0
- package/dist/tools-badge.js +3 -3
- package/dist/tools-more.d.ts +9 -5
- package/dist/tools-more.d.ts.map +1 -1
- package/dist/tools-more.js +56 -12
- package/dist/tools-sales.d.ts.map +1 -1
- package/dist/tools-sales.js +34 -24
- package/dist/tools.d.ts +3 -0
- package/dist/tools.d.ts.map +1 -1
- package/dist/tools.js +64 -30
- package/package.json +4 -3
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"http.d.ts","sourceRoot":"","sources":["../src/http.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AAIvD,MAAM,MAAM,KAAK,GAAG,CAAC,GAAG,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,WAAW,KAAK,OAAO,CAAC,QAAQ,CAAC,CAAC;AAE3E,qFAAqF;AACrF,eAAO,MAAM,UAAU,EAAE,KAAgE,CAAC;AAE1F,eAAO,MAAM,aAAa,GAAI,KAAK,MAAM,EAAE,QAAO,KAAkB,yBACwB,CAAC"}
|
package/dist/http.js
ADDED
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { SuiGraphQLClient } from "@mysten/sui/graphql";
|
|
2
|
+
import { fixedHeaders } from "@esseyonsui/sui-sdk-v3";
|
|
3
|
+
/** PRV-32: every request this server sends goes out with the SDK's fixed headers. */
|
|
4
|
+
export const plainFetch = fixedHeaders((url, init) => globalThis.fetch(url, init));
|
|
5
|
+
export const graphqlClient = (url, fetch = plainFetch) => new SuiGraphQLClient({ url, network: "testnet", fetch: fetch });
|
package/dist/init.d.ts
CHANGED
|
@@ -7,5 +7,12 @@ export type InitResult = {
|
|
|
7
7
|
ok: false;
|
|
8
8
|
error: string;
|
|
9
9
|
};
|
|
10
|
+
/** PRV-36b: keys in `<dir>/keys`, state and sealed records in `<dir>/state`, so a copy of `state/` alone opens nothing. */
|
|
10
11
|
export declare function init(dir: string, configUrl?: string): InitResult;
|
|
12
|
+
/** PRV-14: the client starts this exact release, never whatever the registry serves that day. */
|
|
13
|
+
export declare function serverEntry(env: Record<string, string>, version?: string): {
|
|
14
|
+
command: string;
|
|
15
|
+
args: string[];
|
|
16
|
+
env: Record<string, string>;
|
|
17
|
+
};
|
|
11
18
|
//# sourceMappingURL=init.d.ts.map
|
package/dist/init.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"init.d.ts","sourceRoot":"","sources":["../src/init.ts"],"names":[],"mappings":";AASA,eAAO,MAAM,kBAAkB,yDAAyD,CAAC;AAEzF,MAAM,MAAM,UAAU,GAAG;IAAE,EAAE,EAAE,IAAI,CAAC;IAAC,GAAG,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;CAAE,GAAG;IAAE,EAAE,EAAE,KAAK,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,CAAC;AAElG,wBAAgB,IAAI,CAAC,GAAG,EAAE,MAAM,EAAE,SAAS,SAAqB,GAAG,UAAU,
|
|
1
|
+
{"version":3,"file":"init.d.ts","sourceRoot":"","sources":["../src/init.ts"],"names":[],"mappings":";AASA,eAAO,MAAM,kBAAkB,yDAAyD,CAAC;AAEzF,MAAM,MAAM,UAAU,GAAG;IAAE,EAAE,EAAE,IAAI,CAAC;IAAC,GAAG,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;CAAE,GAAG;IAAE,EAAE,EAAE,KAAK,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,CAAC;AAElG,2HAA2H;AAC3H,wBAAgB,IAAI,CAAC,GAAG,EAAE,MAAM,EAAE,SAAS,SAAqB,GAAG,UAAU,CAsB5E;AAKD,iGAAiG;AACjG,wBAAgB,WAAW,CAAC,GAAG,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,EAAE,OAAO,SAAU;;;;EAEzE"}
|
package/dist/init.js
CHANGED
|
@@ -1,18 +1,23 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { randomBytes } from "node:crypto";
|
|
3
|
-
import { chmodSync, existsSync, mkdirSync, realpathSync, writeFileSync } from "node:fs";
|
|
3
|
+
import { chmodSync, existsSync, mkdirSync, readFileSync, realpathSync, writeFileSync } from "node:fs";
|
|
4
4
|
import { homedir } from "node:os";
|
|
5
5
|
import { resolve } from "node:path";
|
|
6
6
|
import { fileURLToPath } from "node:url";
|
|
7
7
|
import { Ed25519Keypair } from "@mysten/sui/keypairs/ed25519";
|
|
8
8
|
export const DEFAULT_CONFIG_URL = "https://essey-v3-production.up.railway.app/v3/config";
|
|
9
|
+
/** PRV-36b: keys in `<dir>/keys`, state and sealed records in `<dir>/state`, so a copy of `state/` alone opens nothing. */
|
|
9
10
|
export function init(dir, configUrl = DEFAULT_CONFIG_URL) {
|
|
10
|
-
const
|
|
11
|
-
const
|
|
11
|
+
const keys = `${dir}/keys`;
|
|
12
|
+
const state = `${dir}/state`;
|
|
13
|
+
const files = { note: `${keys}/note.key`, agent: `${keys}/agent.key` };
|
|
14
|
+
const taken = [...Object.values(files), `${state}/state.json`].find((f) => existsSync(f));
|
|
12
15
|
if (taken)
|
|
13
16
|
return { ok: false, error: `${taken} already exists; pick an empty directory` };
|
|
14
|
-
|
|
15
|
-
|
|
17
|
+
for (const d of [dir, keys, state]) {
|
|
18
|
+
mkdirSync(d, { recursive: true, mode: 0o700 });
|
|
19
|
+
chmodSync(d, 0o700);
|
|
20
|
+
}
|
|
16
21
|
writeFileSync(files.note, randomBytes(32).toString("hex"), { mode: 0o600, flag: "wx" });
|
|
17
22
|
writeFileSync(files.agent, Ed25519Keypair.generate().getSecretKey(), { mode: 0o600, flag: "wx" });
|
|
18
23
|
return {
|
|
@@ -20,12 +25,18 @@ export function init(dir, configUrl = DEFAULT_CONFIG_URL) {
|
|
|
20
25
|
env: {
|
|
21
26
|
ESSEY_NETWORK: "testnet",
|
|
22
27
|
ESSEY_V3_CONFIG: configUrl,
|
|
23
|
-
ESSEY_STATE_FILE: `${
|
|
28
|
+
ESSEY_STATE_FILE: `${state}/state.json`,
|
|
24
29
|
ESSEY_NOTE_KEY_FILE: files.note,
|
|
25
30
|
ESSEY_AGENT_KEY_FILE: files.agent,
|
|
26
31
|
},
|
|
27
32
|
};
|
|
28
33
|
}
|
|
34
|
+
const VERSION = JSON.parse(readFileSync(new URL("../package.json", import.meta.url), "utf8"))
|
|
35
|
+
.version;
|
|
36
|
+
/** PRV-14: the client starts this exact release, never whatever the registry serves that day. */
|
|
37
|
+
export function serverEntry(env, version = VERSION) {
|
|
38
|
+
return { command: "npx", args: ["-y", "-p", `@esseyonsui/sui-mcp-v3@${version}`, "essey-sui-mcp-v3"], env };
|
|
39
|
+
}
|
|
29
40
|
function main() {
|
|
30
41
|
const dir = resolve(process.argv[2] ?? `${homedir()}/.essey-v3`);
|
|
31
42
|
const r = init(dir, process.env.ESSEY_V3_CONFIG ?? DEFAULT_CONFIG_URL);
|
|
@@ -33,11 +44,7 @@ function main() {
|
|
|
33
44
|
console.error(r.error);
|
|
34
45
|
process.exit(1);
|
|
35
46
|
}
|
|
36
|
-
const server =
|
|
37
|
-
command: "npx",
|
|
38
|
-
args: ["-y", "-p", "@esseyonsui/sui-mcp-v3", "essey-sui-mcp-v3"],
|
|
39
|
-
env: r.env,
|
|
40
|
-
};
|
|
47
|
+
const server = serverEntry(r.env);
|
|
41
48
|
console.log(`Wrote mode-600 key files in ${dir}. Add this server to your MCP client:\n`);
|
|
42
49
|
console.log(JSON.stringify({ mcpServers: { "essey-v3": server } }, null, 2));
|
|
43
50
|
}
|
package/dist/io.d.ts
CHANGED
|
@@ -1,19 +1,23 @@
|
|
|
1
1
|
import type { Signer } from "@mysten/sui/cryptography";
|
|
2
2
|
import { v3, type EsseyIo } from "@esseyonsui/sui-sdk-v3";
|
|
3
|
+
import { type Fetch } from "./http.ts";
|
|
3
4
|
export { TESTNET_GRAPHQL } from "./config.ts";
|
|
4
5
|
type Json = any;
|
|
5
|
-
type Fetch = (url: string, init?: RequestInit) => Promise<Response>;
|
|
6
6
|
type Gql = (query: string, variables: Record<string, unknown>) => Promise<Json>;
|
|
7
7
|
export type ChainIoOptions = {
|
|
8
8
|
graphql: string;
|
|
9
9
|
fetch?: Fetch;
|
|
10
10
|
/** Pause between index polls after a step lands; tests pass 0. */
|
|
11
11
|
indexPauseMs?: number;
|
|
12
|
+
/** How long one walk of the loan, room and vault sets serves lookups (PRV-32); 0 walks for every lookup. */
|
|
13
|
+
snapshotMs?: number;
|
|
12
14
|
/** Circuit name to local `{ wasm, zkey }` paths, for a circuit `/v3/config` does not serve yet. */
|
|
13
15
|
localArtifacts?: Record<string, {
|
|
14
16
|
wasm: string;
|
|
15
17
|
zkey: string;
|
|
16
18
|
}>;
|
|
19
|
+
/** PRV-05: where every circuit's files are kept, fetched once; without it each is fetched on first use. */
|
|
20
|
+
artifactDir?: string;
|
|
17
21
|
/** Test only: seal random bytes of the same length for the plaintexts it picks. */
|
|
18
22
|
garble?: (data: Uint8Array) => boolean;
|
|
19
23
|
fundDeposit?: EsseyIo["fundDeposit"];
|
|
@@ -49,6 +53,8 @@ type SealRequest = {
|
|
|
49
53
|
signer?: Signer;
|
|
50
54
|
};
|
|
51
55
|
export declare function chainIo(config: Json, o: ChainIoOptions): {
|
|
56
|
+
prefetchArtifacts: () => Promise<void> | undefined;
|
|
57
|
+
/** A landed step makes every held walk stale. */
|
|
52
58
|
waitIndexed: (landedAtMs: number) => Promise<boolean>;
|
|
53
59
|
prover: v3.Prover;
|
|
54
60
|
readPrice: (market: string) => Promise<{
|
|
@@ -71,14 +77,12 @@ export declare function chainIo(config: Json, o: ChainIoOptions): {
|
|
|
71
77
|
readSettleTime: (loanId: string) => Promise<bigint>;
|
|
72
78
|
readTopupDelivery: (loanId: string) => Promise<[bigint, bigint, bigint] | null>;
|
|
73
79
|
readKeeperCt: (loanId: string) => Promise<Uint8Array<ArrayBufferLike>>;
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
room: string;
|
|
81
|
-
vault: string;
|
|
80
|
+
readBadges: (cursor: string | null) => Promise<{
|
|
81
|
+
badges: {
|
|
82
|
+
id: string;
|
|
83
|
+
json: any;
|
|
84
|
+
}[];
|
|
85
|
+
next: string | null;
|
|
82
86
|
}>;
|
|
83
87
|
readObjectRef: (id: string) => Promise<{
|
|
84
88
|
version: string;
|
|
@@ -89,7 +93,10 @@ export declare function chainIo(config: Json, o: ChainIoOptions): {
|
|
|
89
93
|
json: any;
|
|
90
94
|
}>;
|
|
91
95
|
readRooms: (cursor: string | null) => Promise<{
|
|
92
|
-
rooms:
|
|
96
|
+
rooms: {
|
|
97
|
+
id: string;
|
|
98
|
+
json: any;
|
|
99
|
+
}[];
|
|
93
100
|
next: string | null;
|
|
94
101
|
}>;
|
|
95
102
|
readVaultOf: (room: string) => Promise<string>;
|
|
@@ -115,7 +122,10 @@ export declare function chainIo(config: Json, o: ChainIoOptions): {
|
|
|
115
122
|
round: any;
|
|
116
123
|
}>;
|
|
117
124
|
readLoans: (cursor: string | null) => Promise<{
|
|
118
|
-
loans:
|
|
125
|
+
loans: {
|
|
126
|
+
id: string;
|
|
127
|
+
json: any;
|
|
128
|
+
}[];
|
|
119
129
|
next: string | null;
|
|
120
130
|
}>;
|
|
121
131
|
priceUpdate: () => Promise<Uint8Array<ArrayBuffer>>;
|
|
@@ -124,7 +134,7 @@ export declare function chainIo(config: Json, o: ChainIoOptions): {
|
|
|
124
134
|
value: bigint;
|
|
125
135
|
sender: string;
|
|
126
136
|
}) => Promise<void>) | undefined;
|
|
127
|
-
readFeeCommit: (coin: string) => Promise<bigint>;
|
|
137
|
+
readFeeCommit: (coin: string, lane: string) => Promise<bigint>;
|
|
128
138
|
readSharedVersion: (id: string) => Promise<string>;
|
|
129
139
|
readPool: (coin: string) => Promise<{
|
|
130
140
|
commitments: {
|
package/dist/io.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"io.d.ts","sourceRoot":"","sources":["../src/io.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,0BAA0B,CAAC;
|
|
1
|
+
{"version":3,"file":"io.d.ts","sourceRoot":"","sources":["../src/io.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,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