@supercuts-walrus/sdk 0.1.1 → 0.1.3
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 +96 -2
- package/dist/index.d.ts +28 -0
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -9,12 +9,106 @@ mandate and verifies payment evidence.
|
|
|
9
9
|
subprocess seam. Wallet keys, state keys, witnesses, and service credentials stay
|
|
10
10
|
inside the Supercuts process; the SDK receives intents and verified receipts.
|
|
11
11
|
|
|
12
|
-
|
|
12
|
+
## Quick start: a new buyer on Testnet
|
|
13
|
+
|
|
14
|
+
You need Node 22.13 or later and a Tatum API key. To use Walrus Memory you also need a Walrus Memory
|
|
15
|
+
account (a delegate key, an account ID, and a Sui private key for client-side encryption) and
|
|
16
|
+
[Ollama](https://ollama.com) with `embeddinggemma`.
|
|
17
|
+
|
|
18
|
+
**1. Install.** The SDK installs the matching backend runtime. pnpm 10 and later block dependency build
|
|
19
|
+
scripts by default, so allow `blake-hash` once. Its JavaScript fallback also works, but with pnpm 11 the
|
|
20
|
+
blocked build makes `pnpm exec` refuse to run.
|
|
21
|
+
|
|
22
|
+
```sh
|
|
23
|
+
mkdir my-buyer && cd my-buyer && pnpm init
|
|
24
|
+
printf 'allowBuilds:\n blake-hash: true\n' > pnpm-workspace.yaml
|
|
25
|
+
pnpm add @supercuts-walrus/sdk@0.1.3
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
With npm, run `npm install @supercuts-walrus/sdk@0.1.3` instead; npm needs no build approval.
|
|
29
|
+
|
|
30
|
+
**2. Store credentials in owner-only files.** Never paste them into an agent.
|
|
31
|
+
|
|
32
|
+
```sh
|
|
33
|
+
umask 077 && mkdir -p credentials
|
|
34
|
+
printf '%s\n' "$TATUM_API_KEY" > credentials/tatum.key
|
|
35
|
+
cat > credentials/memory.json <<JSON
|
|
36
|
+
{ "key": "$MEMWAL_DELEGATE_KEY", "accountId": "$MEMWAL_ACCOUNT_ID", "suiPrivateKey": "$MEMWAL_SUI_PRIVATE_KEY" }
|
|
37
|
+
JSON
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
Those three fields are all the Memory config needs. Supercuts fills in the Mainnet relayer, package,
|
|
41
|
+
registry, and local adapter defaults, and gives each role its own namespace.
|
|
42
|
+
|
|
43
|
+
**3. Start the embedding adapter** and leave it running. It pads local 768-dimensional vectors to the
|
|
44
|
+
1536 dimensions that Walrus Memory requires:
|
|
45
|
+
|
|
46
|
+
```sh
|
|
47
|
+
ollama pull embeddinggemma
|
|
48
|
+
pnpm exec supercuts-embedding-adapter
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
**4. Onboard the buyer.** Leave out any endpoint to use the public Testnet defaults and the shared
|
|
52
|
+
seller directory:
|
|
53
|
+
|
|
54
|
+
```sh
|
|
55
|
+
cat > buyer-setup.json <<JSON
|
|
56
|
+
{ "tatumKeyFile": "credentials/tatum.key", "memoryConfigFile": "credentials/memory.json",
|
|
57
|
+
"perDealCeiling": "2000000", "totalBudget": "10000000",
|
|
58
|
+
"expiresAt": $(( $(date +%s) * 1000 + 14 * 86400000 )), "allowPublicX402": true }
|
|
59
|
+
JSON
|
|
60
|
+
pnpm exec supercuts onboard buyer --home ./buyer --config buyer-setup.json
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
The output prints the generated buyer address and `nextSteps`. Fund only that address with Testnet SUI,
|
|
64
|
+
using `supercuts funding execute … --request-faucet --confirm` or <https://faucet.sui.io>. Then review the
|
|
65
|
+
directory and approve sellers:
|
|
13
66
|
|
|
14
67
|
```sh
|
|
15
|
-
|
|
68
|
+
curl -s https://supercuts-sellers-testnet.onrender.com/v2/directory/catalog
|
|
69
|
+
pnpm exec supercuts policy approve-seller --home ./buyer --capability-id market-brief-public-v2
|
|
70
|
+
pnpm exec supercuts onboarding doctor --home ./buyer
|
|
16
71
|
```
|
|
17
72
|
|
|
73
|
+
The npm package has everything public x402 payments need. Shielded payments additionally require the
|
|
74
|
+
hash-pinned proving artifacts. Until those are installed, the doctor reports `shielded-proofs` as
|
|
75
|
+
`unavailable`.
|
|
76
|
+
|
|
77
|
+
**5. Run a deal.**
|
|
78
|
+
|
|
79
|
+
```ts
|
|
80
|
+
import { BuyerClient } from "@supercuts-walrus/sdk";
|
|
81
|
+
|
|
82
|
+
const buyer = await BuyerClient.connect({ home: "./buyer", timeoutMs: 180_000 });
|
|
83
|
+
const deal = await buyer.executeDeal({
|
|
84
|
+
operationId: "first-brief", // stable: reuse it to resume, never to pay twice
|
|
85
|
+
capabilityClass: "sui.market-brief", // Walrus Memory ranks the matching sellers
|
|
86
|
+
input: { query: "Sui DeFi liquidity risks" }, // must fit the seller's signed input schema
|
|
87
|
+
budget: { asset: "0x2::sui::SUI", maximum: "1000000" },
|
|
88
|
+
requestedRail: "x402",
|
|
89
|
+
});
|
|
90
|
+
const evidence = await buyer.getDealEvidence(deal.dealId); // includes memoryInfluence
|
|
91
|
+
const delivery = await buyer.getDealDelivery(deal.dealId);
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
Pick `input` from the seller's signed `inputSchema` (`buyer.listDealCapabilities()`). Discovery ignores
|
|
95
|
+
sellers whose schema rejects your input. If a payment hits a transient seller-side outage, the error is
|
|
96
|
+
`retryable`: call `executeDeal` or `resumeDeal` again with the **same** `operationId`. Never start a second
|
|
97
|
+
payment.
|
|
98
|
+
|
|
99
|
+
An MCP agent session flushes outcome memories in the background. An SDK-only host keeps the worker running
|
|
100
|
+
next to the adapter, otherwise deals stay at `outcomeMemory: "pending"`:
|
|
101
|
+
|
|
102
|
+
```sh
|
|
103
|
+
pnpm exec supercuts-memory-worker ./buyer
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
Each finished deal writes a verified outcome to Walrus Memory. The next deal recalls it when choosing a
|
|
107
|
+
seller, a rail, and a spend ceiling. `pnpm exec supercuts memory insights --home ./buyer` shows what the
|
|
108
|
+
buyer has learned.
|
|
109
|
+
|
|
110
|
+
## Lower-level API
|
|
111
|
+
|
|
18
112
|
```ts
|
|
19
113
|
import { BuyerClient, initializeProfile } from "@supercuts-walrus/sdk";
|
|
20
114
|
|
package/dist/index.d.ts
CHANGED
|
@@ -62,6 +62,34 @@ export interface DealEvidenceView {
|
|
|
62
62
|
inventory: "pending" | "indexed" | "missing" | "unresolved";
|
|
63
63
|
paymentFinalized: boolean;
|
|
64
64
|
paymentDigest?: string;
|
|
65
|
+
memoryInfluence?: {
|
|
66
|
+
changedSeller: boolean;
|
|
67
|
+
changedRail: boolean;
|
|
68
|
+
changedRisk: boolean;
|
|
69
|
+
changedMaximum: boolean;
|
|
70
|
+
withoutMemory?: MemoryDecision;
|
|
71
|
+
withMemory: MemoryDecision;
|
|
72
|
+
citedBlobIds: string[];
|
|
73
|
+
};
|
|
74
|
+
memoryRanking?: Array<{
|
|
75
|
+
capabilityId: string;
|
|
76
|
+
counterparty: string;
|
|
77
|
+
reliability: number;
|
|
78
|
+
observations: number;
|
|
79
|
+
successes: number;
|
|
80
|
+
failures: number;
|
|
81
|
+
unresolved: number;
|
|
82
|
+
lastOutcome?: string;
|
|
83
|
+
medianLatencyMs?: number;
|
|
84
|
+
priceMinimum: string;
|
|
85
|
+
}>;
|
|
86
|
+
}
|
|
87
|
+
export interface MemoryDecision {
|
|
88
|
+
sellerId: string;
|
|
89
|
+
capabilityId: string;
|
|
90
|
+
rail: string;
|
|
91
|
+
riskLevel: string;
|
|
92
|
+
maximumAmount: string;
|
|
65
93
|
}
|
|
66
94
|
export interface DealDelivery {
|
|
67
95
|
dealId: string;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@supercuts-walrus/sdk",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.3",
|
|
4
4
|
"description": "Typed, role-scoped TypeScript SDK for Supercuts",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"type": "module",
|
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
"node": ">=22.13"
|
|
21
21
|
},
|
|
22
22
|
"dependencies": {
|
|
23
|
-
"@supercuts-walrus/backend": "0.1.
|
|
23
|
+
"@supercuts-walrus/backend": "0.1.3"
|
|
24
24
|
},
|
|
25
25
|
"devDependencies": {
|
|
26
26
|
"@types/node": "^22.10.0",
|