@supercuts-walrus/sdk 0.1.2 → 0.1.4

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
@@ -9,12 +9,108 @@ 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
- Install the SDK. It installs the matching backend runtime automatically:
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.4 @supercuts-walrus/backend@0.1.4
26
+ ```
27
+
28
+ Add the backend explicitly. It provides the `supercuts`, `supercuts-embedding-adapter`, and
29
+ `supercuts-memory-worker` commands, and pnpm only links commands from direct dependencies. With npm, run
30
+ `npm install @supercuts-walrus/sdk@0.1.4 @supercuts-walrus/backend@0.1.4` instead; npm needs no build approval.
31
+
32
+ **2. Store credentials in owner-only files.** Never paste them into an agent.
33
+
34
+ ```sh
35
+ umask 077 && mkdir -p credentials
36
+ printf '%s\n' "$TATUM_API_KEY" > credentials/tatum.key
37
+ cat > credentials/memory.json <<JSON
38
+ { "key": "$MEMWAL_DELEGATE_KEY", "accountId": "$MEMWAL_ACCOUNT_ID", "suiPrivateKey": "$MEMWAL_SUI_PRIVATE_KEY" }
39
+ JSON
40
+ ```
41
+
42
+ Those three fields are all the Memory config needs. Supercuts fills in the Mainnet relayer, package,
43
+ registry, and local adapter defaults, and gives each role its own namespace.
44
+
45
+ **3. Start the embedding adapter** and leave it running. It pads local 768-dimensional vectors to the
46
+ 1536 dimensions that Walrus Memory requires:
47
+
48
+ ```sh
49
+ ollama pull embeddinggemma
50
+ pnpm exec supercuts-embedding-adapter
51
+ ```
52
+
53
+ **4. Onboard the buyer.** Leave out any endpoint to use the public Testnet defaults and the shared
54
+ seller directory:
55
+
56
+ ```sh
57
+ cat > buyer-setup.json <<JSON
58
+ { "tatumKeyFile": "credentials/tatum.key", "memoryConfigFile": "credentials/memory.json",
59
+ "perDealCeiling": "2000000", "totalBudget": "10000000",
60
+ "expiresAt": $(( $(date +%s) * 1000 + 14 * 86400000 )), "allowPublicX402": true }
61
+ JSON
62
+ pnpm exec supercuts onboard buyer --home ./buyer --config buyer-setup.json
63
+ ```
64
+
65
+ The output prints the generated buyer address and `nextSteps`. Fund only that address with Testnet SUI,
66
+ using `supercuts funding execute … --request-faucet --confirm` or <https://faucet.sui.io>. Then review the
67
+ directory and approve sellers:
13
68
 
14
69
  ```sh
15
- pnpm add @supercuts-walrus/sdk@0.1.2
70
+ curl -s https://supercuts-sellers-testnet.onrender.com/v2/directory/catalog
71
+ pnpm exec supercuts policy approve-seller --home ./buyer --capability-id market-brief-public-v2
72
+ pnpm exec supercuts onboarding doctor --home ./buyer
16
73
  ```
17
74
 
75
+ The npm package has everything public x402 payments need. Shielded payments additionally require the
76
+ hash-pinned proving artifacts. Until those are installed, the doctor reports `shielded-proofs` as
77
+ `unavailable`.
78
+
79
+ **5. Run a deal.**
80
+
81
+ ```ts
82
+ import { BuyerClient } from "@supercuts-walrus/sdk";
83
+
84
+ const buyer = await BuyerClient.connect({ home: "./buyer", timeoutMs: 180_000 });
85
+ const deal = await buyer.executeDeal({
86
+ operationId: "first-brief", // stable: reuse it to resume, never to pay twice
87
+ capabilityClass: "sui.market-brief", // Walrus Memory ranks the matching sellers
88
+ input: { query: "Sui DeFi liquidity risks" }, // must fit the seller's signed input schema
89
+ budget: { asset: "0x2::sui::SUI", maximum: "1000000" },
90
+ requestedRail: "x402",
91
+ });
92
+ const evidence = await buyer.getDealEvidence(deal.dealId); // includes memoryInfluence
93
+ const delivery = await buyer.getDealDelivery(deal.dealId);
94
+ ```
95
+
96
+ Pick `input` from the seller's signed `inputSchema` (`buyer.listDealCapabilities()`). Discovery ignores
97
+ sellers whose schema rejects your input. If a payment hits a transient seller-side outage, the error is
98
+ `retryable`: call `executeDeal` or `resumeDeal` again with the **same** `operationId`. Never start a second
99
+ payment.
100
+
101
+ An MCP agent session flushes outcome memories in the background. An SDK-only host keeps the worker running
102
+ next to the adapter, otherwise deals stay at `outcomeMemory: "pending"`:
103
+
104
+ ```sh
105
+ pnpm exec supercuts-memory-worker ./buyer
106
+ ```
107
+
108
+ Each finished deal writes a verified outcome to Walrus Memory. The next deal recalls it when choosing a
109
+ seller, a rail, and a spend ceiling. `pnpm exec supercuts memory insights --home ./buyer` shows what the
110
+ buyer has learned.
111
+
112
+ ## Lower-level API
113
+
18
114
  ```ts
19
115
  import { BuyerClient, initializeProfile } from "@supercuts-walrus/sdk";
20
116
 
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.2",
3
+ "version": "0.1.4",
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.2"
23
+ "@supercuts-walrus/backend": "0.1.4"
24
24
  },
25
25
  "devDependencies": {
26
26
  "@types/node": "^22.10.0",