settld 0.1.5 → 0.2.1
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 +32 -0
- package/SETTLD_VERSION +1 -1
- package/bin/settld.js +63 -0
- package/docs/CIRCLE_SANDBOX_E2E.md +12 -0
- package/docs/QUICKSTART_MCP.md +41 -1
- package/docs/QUICKSTART_MCP_HOSTS.md +172 -89
- package/docs/QUICKSTART_POLICY_PACKS.md +65 -0
- package/docs/QUICKSTART_PROFILES.md +198 -0
- package/docs/README.md +18 -0
- package/docs/RELEASE_CHECKLIST.md +26 -0
- package/docs/RELEASING.md +1 -0
- package/docs/SLO.md +62 -1
- package/docs/SUMMARY.md +1 -0
- package/docs/gitbook/README.md +13 -1
- package/docs/gitbook/quickstart.md +57 -58
- package/docs/integrations/README.md +1 -0
- package/docs/integrations/openclaw/PUBLIC_QUICKSTART.md +108 -0
- package/docs/ops/DISPUTE_FINANCE_RECONCILIATION_PACKET.md +56 -0
- package/docs/ops/KERNEL_V0_SHIP_GATE.md +3 -1
- package/docs/ops/MCP_COMPATIBILITY_MATRIX.md +8 -6
- package/docs/ops/PRODUCTION_DEPLOYMENT_CHECKLIST.md +46 -9
- package/docs/ops/TRUST_CONFIG_WIZARD.md +37 -24
- package/docs/ops/VERCEL_MONOREPO_DEPLOY.md +42 -0
- package/docs/plans/2026-02-20-trust-os-v1-jira-backlog.md +348 -0
- package/docs/plans/2026-02-21-agent-economic-actor-operating-model.md +169 -0
- package/docs/plans/2026-02-21-trust-os-v1-strategy.md +241 -0
- package/docs/research/2026-02-21-agent-spend-host-landscape.md +57 -0
- package/docs/spec/ArbitrationOutcomeMapping.v1.md +62 -0
- package/docs/spec/DisputeCaseLifecycle.v1.md +51 -0
- package/docs/spec/OperatorAction.v1.md +90 -0
- package/docs/spec/PolicyDecision.v1.md +83 -0
- package/docs/spec/README.md +5 -0
- package/docs/spec/SettlementDecisionRecord.v2.md +2 -0
- package/docs/spec/schemas/OperatorAction.v1.schema.json +113 -0
- package/docs/spec/schemas/PolicyDecision.v1.schema.json +74 -0
- package/docs/spec/schemas/SettlementDecisionRecord.v2.schema.json +1 -0
- package/docs/spec/x402-error-codes.v1.txt +14 -0
- package/package.json +14 -1
- package/scripts/ci/build-launch-cutover-packet.mjs +177 -21
- package/scripts/ci/run-10x-throughput-drill.mjs +76 -4
- package/scripts/ci/run-10x-throughput-incident-rehearsal.mjs +49 -6
- package/scripts/ci/run-mcp-host-cert-matrix.mjs +201 -0
- package/scripts/ci/run-mcp-host-smoke.mjs +203 -5
- package/scripts/ci/run-offline-verification-parity-gate.mjs +762 -0
- package/scripts/ci/run-onboarding-host-success-gate.mjs +516 -0
- package/scripts/ci/run-onboarding-policy-slo-gate.mjs +537 -0
- package/scripts/ci/run-production-cutover-gate.mjs +540 -0
- package/scripts/ci/run-public-openclaw-npx-smoke.mjs +148 -0
- package/scripts/ci/run-release-promotion-guard.mjs +756 -0
- package/scripts/doctor/mcp-host.mjs +120 -0
- package/scripts/mcp/settld-mcp-server.mjs +330 -20
- package/scripts/ops/dispute-finance-reconciliation-packet.mjs +313 -0
- package/scripts/ops/hosted-baseline-evidence.mjs +286 -77
- package/scripts/ops/run-x402-hitl-smoke.mjs +607 -0
- package/scripts/policy/cli.mjs +600 -0
- package/scripts/profile/cli.mjs +1324 -0
- package/scripts/register-entity-secret.mjs +102 -0
- package/scripts/setup/circle-bootstrap.mjs +310 -0
- package/scripts/setup/host-config.mjs +617 -0
- package/scripts/setup/login.mjs +299 -0
- package/scripts/setup/onboard.mjs +1578 -0
- package/scripts/setup/openclaw-onboard.mjs +423 -0
- package/scripts/setup/session-store.mjs +65 -0
- package/scripts/setup/wizard.mjs +986 -0
- package/scripts/slo/check.mjs +123 -62
- package/scripts/spec/generate-protocol-vectors.mjs +88 -0
- package/scripts/test/run.sh +23 -9
- package/scripts/vercel/ignore-dashboard.sh +23 -0
- package/scripts/vercel/ignore-mkdocs.sh +2 -0
- package/services/x402-gateway/src/server.js +147 -36
- package/src/api/app.js +2345 -267
- package/src/api/middleware/trust-kernel.js +114 -0
- package/src/api/openapi.js +598 -3
- package/src/api/persistence.js +184 -0
- package/src/api/store.js +277 -0
- package/src/core/agent-wallets.js +134 -0
- package/src/core/event-policy.js +21 -2
- package/src/core/operator-action.js +303 -0
- package/src/core/policy-decision.js +322 -0
- package/src/core/policy-packs.js +207 -0
- package/src/core/profile-fingerprint.js +27 -0
- package/src/core/profile-simulation-reasons.js +84 -0
- package/src/core/profile-templates.js +242 -0
- package/src/core/settlement-kernel.js +27 -1
- package/src/core/wallet-assignment-resolver.js +129 -0
- package/src/core/wallet-provider-bootstrap.js +365 -0
- package/src/db/store-pg.js +631 -0
package/README.md
CHANGED
|
@@ -67,6 +67,31 @@ The core mental model in this repo:
|
|
|
67
67
|
|
|
68
68
|
## Quick start
|
|
69
69
|
|
|
70
|
+
Agent host onboarding (Codex / Claude / Cursor / OpenClaw), with guided wallet + policy setup:
|
|
71
|
+
|
|
72
|
+
```sh
|
|
73
|
+
npx -y settld setup
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
Preflight-only check (no host config write), with JSON report:
|
|
77
|
+
|
|
78
|
+
```sh
|
|
79
|
+
npx -y settld setup --preflight-only --report-path ./.tmp/setup-preflight.json
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
If you prefer global install:
|
|
83
|
+
|
|
84
|
+
```sh
|
|
85
|
+
npm install -g settld
|
|
86
|
+
settld setup
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
Legacy setup wizard (advanced / old flags):
|
|
90
|
+
|
|
91
|
+
```sh
|
|
92
|
+
settld setup legacy
|
|
93
|
+
```
|
|
94
|
+
|
|
70
95
|
Start the API:
|
|
71
96
|
|
|
72
97
|
```sh
|
|
@@ -157,6 +182,12 @@ Run conformance (kernel control plane, disputes + holdback):
|
|
|
157
182
|
./bin/settld.js conformance kernel --ops-token tok_ops
|
|
158
183
|
```
|
|
159
184
|
|
|
185
|
+
Run local MCP host compatibility checks:
|
|
186
|
+
|
|
187
|
+
```sh
|
|
188
|
+
./bin/settld.js doctor
|
|
189
|
+
```
|
|
190
|
+
|
|
160
191
|
No-clone registry flow:
|
|
161
192
|
|
|
162
193
|
```sh
|
|
@@ -194,6 +225,7 @@ Ops workspaces (HTML):
|
|
|
194
225
|
- `docs/QUICKSTART_PRODUCE.md`
|
|
195
226
|
- `docs/QUICKSTART_SDK.md`
|
|
196
227
|
- `docs/QUICKSTART_SDK_PYTHON.md`
|
|
228
|
+
- `docs/QUICKSTART_POLICY_PACKS.md`
|
|
197
229
|
- `docs/QUICKSTART_MCP.md`
|
|
198
230
|
- `docs/QUICKSTART_MCP_HOSTS.md`
|
|
199
231
|
- `docs/ADOPTION_CHECKLIST.md`
|
package/SETTLD_VERSION
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
0.1
|
|
1
|
+
0.2.1
|
package/bin/settld.js
CHANGED
|
@@ -8,6 +8,13 @@ function usage() {
|
|
|
8
8
|
// eslint-disable-next-line no-console
|
|
9
9
|
console.error("usage:");
|
|
10
10
|
console.error(" settld --version");
|
|
11
|
+
console.error(" settld onboard [--help]");
|
|
12
|
+
console.error(" settld login [--help]");
|
|
13
|
+
console.error(" settld setup [--help]");
|
|
14
|
+
console.error(" settld setup legacy [--help]");
|
|
15
|
+
console.error(" settld setup circle [--help]");
|
|
16
|
+
console.error(" settld setup openclaw [--help]");
|
|
17
|
+
console.error(" settld doctor [--help] [--report <path>]");
|
|
11
18
|
console.error(" settld conformance test [--case <id>] [--bin settld-verify] [--node-bin <path/to/settld-verify.js>] [--keep-temp]");
|
|
12
19
|
console.error(" settld conformance list");
|
|
13
20
|
console.error(" settld conformance kernel --ops-token <tok_opsw> [--base-url http://127.0.0.1:3000] [--tenant-id tenant_default] [--protocol 1.0] [--case <id>]");
|
|
@@ -15,12 +22,34 @@ function usage() {
|
|
|
15
22
|
console.error(" settld closepack export --agreement-hash <sha256> --out <path.zip> [--ops-token tok_ops] [--base-url http://127.0.0.1:3000] [--tenant-id tenant_default] [--protocol 1.0]");
|
|
16
23
|
console.error(" settld closepack verify <path.zip> [--json-out <path.json>]");
|
|
17
24
|
console.error(" settld x402 receipt verify <receipt.json|-> [--strict] [--format json|text] [--json-out <path>]");
|
|
25
|
+
console.error(" settld profile list [--format json|text] [--json-out <path>]");
|
|
26
|
+
console.error(" settld profile init <profile-id> [--out <path>] [--force] [--format json|text] [--json-out <path>]");
|
|
27
|
+
console.error(
|
|
28
|
+
" settld profile wizard [--template <profile-id>] [--non-interactive] [--profile-id <id>] [--name <text>] [--vertical <text>] [--description <text>] [--currency <code>] [--per-request-usd-cents <int>] [--monthly-usd-cents <int>] [--providers <csv>] [--tools <csv>] [--out <path>] [--force] [--format json|text] [--json-out <path>]"
|
|
29
|
+
);
|
|
30
|
+
console.error(" settld profile validate <profile.json|-> [--format json|text] [--json-out <path>]");
|
|
31
|
+
console.error(
|
|
32
|
+
" settld profile simulate <profile.json|-> [--scenario <scenario.json|->|--scenario-json <json>] [--format json|text] [--json-out <path>]"
|
|
33
|
+
);
|
|
34
|
+
console.error(" settld policy init <pack-id> [--out <path>] [--force] [--format json|text] [--json-out <path>]");
|
|
35
|
+
console.error(
|
|
36
|
+
" settld policy simulate <policy-pack.json|-> [--scenario <scenario.json|->|--scenario-json <json>] [--format json|text] [--json-out <path>]"
|
|
37
|
+
);
|
|
38
|
+
console.error(
|
|
39
|
+
" settld policy publish <policy-pack.json|-> [--out <path>] [--force] [--channel <name>] [--owner <id>] [--format json|text] [--json-out <path>]"
|
|
40
|
+
);
|
|
18
41
|
console.error(" settld dev up [--no-build] [--foreground]");
|
|
19
42
|
console.error(" settld dev down [--wipe]");
|
|
20
43
|
console.error(" settld dev ps");
|
|
21
44
|
console.error(" settld dev logs [--follow] [--service api]");
|
|
22
45
|
console.error(" settld dev info");
|
|
23
46
|
console.error(" settld init capability <name> [--out <dir>] [--force]");
|
|
47
|
+
console.error("");
|
|
48
|
+
console.error("onboarding:");
|
|
49
|
+
console.error(" settld onboard");
|
|
50
|
+
console.error(" settld setup");
|
|
51
|
+
console.error(" settld setup --help");
|
|
52
|
+
console.error(" settld dev up");
|
|
24
53
|
}
|
|
25
54
|
|
|
26
55
|
function repoRoot() {
|
|
@@ -92,6 +121,32 @@ function main() {
|
|
|
92
121
|
process.exit(0);
|
|
93
122
|
}
|
|
94
123
|
|
|
124
|
+
if (cmd === "setup") {
|
|
125
|
+
const setupSubcommand = String(argv[1] ?? "").trim();
|
|
126
|
+
if (setupSubcommand === "openclaw") {
|
|
127
|
+
return runNodeScript("scripts/setup/openclaw-onboard.mjs", argv.slice(2));
|
|
128
|
+
}
|
|
129
|
+
if (setupSubcommand === "circle") {
|
|
130
|
+
return runNodeScript("scripts/setup/circle-bootstrap.mjs", argv.slice(2));
|
|
131
|
+
}
|
|
132
|
+
if (setupSubcommand === "legacy") {
|
|
133
|
+
return runNodeScript("scripts/setup/wizard.mjs", argv.slice(2));
|
|
134
|
+
}
|
|
135
|
+
return runNodeScript("scripts/setup/onboard.mjs", argv.slice(1));
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
if (cmd === "onboard") {
|
|
139
|
+
return runNodeScript("scripts/setup/onboard.mjs", argv.slice(1));
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
if (cmd === "login") {
|
|
143
|
+
return runNodeScript("scripts/setup/login.mjs", argv.slice(1));
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
if (cmd === "doctor") {
|
|
147
|
+
return runNodeScript("scripts/doctor/mcp-host.mjs", argv.slice(1));
|
|
148
|
+
}
|
|
149
|
+
|
|
95
150
|
if (cmd === "conformance") {
|
|
96
151
|
const sub = argv[1] ? String(argv[1]) : "test";
|
|
97
152
|
if (sub === "test") return runNodeScript("conformance/v1/run.mjs", argv.slice(2));
|
|
@@ -216,6 +271,14 @@ function main() {
|
|
|
216
271
|
process.exit(1);
|
|
217
272
|
}
|
|
218
273
|
|
|
274
|
+
if (cmd === "profile") {
|
|
275
|
+
return runNodeScript("scripts/profile/cli.mjs", argv.slice(1));
|
|
276
|
+
}
|
|
277
|
+
|
|
278
|
+
if (cmd === "policy") {
|
|
279
|
+
return runNodeScript("scripts/policy/cli.mjs", argv.slice(1));
|
|
280
|
+
}
|
|
281
|
+
|
|
219
282
|
usage();
|
|
220
283
|
// eslint-disable-next-line no-console
|
|
221
284
|
console.error(`unknown command: ${cmd}`);
|
|
@@ -34,6 +34,18 @@ Set these for sandbox runs:
|
|
|
34
34
|
- `CIRCLE_WALLET_ID_ESCROW`
|
|
35
35
|
- `CIRCLE_TOKEN_ID_USDC`
|
|
36
36
|
|
|
37
|
+
Fastest way to generate these from your Circle account:
|
|
38
|
+
|
|
39
|
+
```bash
|
|
40
|
+
settld setup circle --api-key 'TEST_API_KEY:...' --mode auto --out-env ./.tmp/circle.env
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
Then load them:
|
|
44
|
+
|
|
45
|
+
```bash
|
|
46
|
+
set -a; source ./.tmp/circle.env; set +a
|
|
47
|
+
```
|
|
48
|
+
|
|
37
49
|
If your environment uses a different naming convention, map these into the adapter config before running tests.
|
|
38
50
|
|
|
39
51
|
## Suggested test flow
|
package/docs/QUICKSTART_MCP.md
CHANGED
|
@@ -10,6 +10,22 @@ For host-specific setup (Claude, Cursor, Codex, OpenClaw), see `docs/QUICKSTART_
|
|
|
10
10
|
- A Settld API key with appropriate scopes (`keyId.secret` format)
|
|
11
11
|
- Settld API reachable (local `npm run dev:api` or hosted)
|
|
12
12
|
|
|
13
|
+
## Fast Path (Recommended)
|
|
14
|
+
|
|
15
|
+
Run guided setup first:
|
|
16
|
+
|
|
17
|
+
```bash
|
|
18
|
+
npx -y settld setup
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
Then run a smoke probe:
|
|
22
|
+
|
|
23
|
+
```bash
|
|
24
|
+
npm run mcp:probe
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
If you prefer to wire everything manually, use the fallback steps in `Run The MCP Server` below.
|
|
28
|
+
|
|
13
29
|
## One-Command Local Demo (Paid MCP Exa Flow)
|
|
14
30
|
|
|
15
31
|
Boots local API + provider wrapper + x402 gateway, runs MCP `settld.exa_search_paid`, verifies signatures/tokens, and writes an artifact bundle.
|
|
@@ -91,6 +107,23 @@ Artifact bundle includes:
|
|
|
91
107
|
- `batch-worker-state.json` (when `SETTLD_DEMO_RUN_BATCH_SETTLEMENT=1`)
|
|
92
108
|
- `batch-settlement.json` (when `SETTLD_DEMO_RUN_BATCH_SETTLEMENT=1`)
|
|
93
109
|
|
|
110
|
+
## First verified receipt (keep this artifact)
|
|
111
|
+
|
|
112
|
+
The demo exports receipts to:
|
|
113
|
+
|
|
114
|
+
- `<artifactDir>/x402-receipts.export.jsonl`
|
|
115
|
+
- `<artifactDir>/x402-receipts.sample-verification.json`
|
|
116
|
+
|
|
117
|
+
Convert the first exported receipt row into a standalone JSON file and verify it:
|
|
118
|
+
|
|
119
|
+
```bash
|
|
120
|
+
jq -c 'first' <artifactDir>/x402-receipts.export.jsonl > /tmp/settld-first-receipt.json
|
|
121
|
+
settld x402 receipt verify /tmp/settld-first-receipt.json --format json --json-out /tmp/settld-first-receipt.verify.json
|
|
122
|
+
```
|
|
123
|
+
|
|
124
|
+
Keep `/tmp/settld-first-receipt.verify.json` (or check in an equivalent artifact path in CI). This is the deterministic
|
|
125
|
+
proof packet for the first paid action.
|
|
126
|
+
|
|
94
127
|
## Authority + Pinning Notes
|
|
95
128
|
|
|
96
129
|
- Authority enforcement in this flow is API key scope + tenant-bound policy checks at Settld API/gateway surfaces.
|
|
@@ -107,7 +140,14 @@ Reference specs:
|
|
|
107
140
|
|
|
108
141
|
## Run The MCP Server
|
|
109
142
|
|
|
110
|
-
|
|
143
|
+
Primary path:
|
|
144
|
+
|
|
145
|
+
```bash
|
|
146
|
+
settld setup
|
|
147
|
+
npm run mcp:server
|
|
148
|
+
```
|
|
149
|
+
|
|
150
|
+
Manual fallback (if you skip setup):
|
|
111
151
|
|
|
112
152
|
```bash
|
|
113
153
|
export SETTLD_BASE_URL='https://api.settld.work' # or http://127.0.0.1:3000
|
|
@@ -1,143 +1,226 @@
|
|
|
1
|
-
# Quickstart: MCP Host Integrations (Claude, Cursor,
|
|
1
|
+
# Quickstart: MCP Host Integrations (Codex, Claude, Cursor, OpenClaw)
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
This guide is the fastest path to wire Settld into an agent host and confirm a first verified paid action.
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
Target outcome:
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
1. Host can call `settld.*` MCP tools.
|
|
8
|
+
2. Wallet mode is configured (`managed`, `byo`, or `none`).
|
|
9
|
+
3. Policy profile is applied.
|
|
10
|
+
4. Smoke call and first paid receipt are green.
|
|
8
11
|
|
|
12
|
+
For deeper tool-level examples, see `docs/QUICKSTART_MCP.md`.
|
|
13
|
+
|
|
14
|
+
## 1) Before you run `settld setup`
|
|
15
|
+
|
|
16
|
+
Required inputs:
|
|
17
|
+
|
|
18
|
+
- `SETTLD_BASE_URL` (local or hosted API URL)
|
|
19
|
+
- `SETTLD_TENANT_ID`
|
|
20
|
+
- one of:
|
|
21
|
+
- `SETTLD_API_KEY` (`keyId.secret`), or
|
|
22
|
+
- `SETTLD_BOOTSTRAP_API_KEY` (onboarding bootstrap key that mints `SETTLD_API_KEY` during setup)
|
|
9
23
|
- Node.js 20+
|
|
10
|
-
- Settld API reachable (`http://127.0.0.1:3000` for local or your hosted API)
|
|
11
|
-
- A tenant-scoped Settld API key (`keyId.secret` format)
|
|
12
24
|
|
|
13
|
-
|
|
25
|
+
Recommended non-interactive pattern:
|
|
14
26
|
|
|
15
27
|
```bash
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
28
|
+
settld setup --non-interactive \
|
|
29
|
+
--host openclaw \
|
|
30
|
+
--base-url https://api.settld.work \
|
|
31
|
+
--tenant-id tenant_default \
|
|
32
|
+
--settld-api-key 'sk_live_xxx.yyy' \
|
|
33
|
+
--wallet-mode managed \
|
|
34
|
+
--wallet-bootstrap remote \
|
|
35
|
+
--profile-id engineering-spend \
|
|
36
|
+
--smoke \
|
|
37
|
+
--out-env ./.tmp/settld-openclaw.env
|
|
20
38
|
```
|
|
21
39
|
|
|
22
|
-
|
|
40
|
+
If you want setup to generate the tenant API key for you:
|
|
23
41
|
|
|
24
42
|
```bash
|
|
25
|
-
|
|
43
|
+
settld setup --non-interactive \
|
|
44
|
+
--host openclaw \
|
|
45
|
+
--base-url https://api.settld.work \
|
|
46
|
+
--tenant-id tenant_default \
|
|
47
|
+
--bootstrap-api-key 'ml_admin_xxx' \
|
|
48
|
+
--wallet-mode managed \
|
|
49
|
+
--wallet-bootstrap remote \
|
|
50
|
+
--profile-id engineering-spend \
|
|
51
|
+
--smoke
|
|
26
52
|
```
|
|
27
53
|
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
"SETTLD_TENANT_ID": "tenant_default",
|
|
41
|
-
"SETTLD_API_KEY": "sk_live_xxx.yyy",
|
|
42
|
-
"SETTLD_PAID_TOOLS_BASE_URL": "http://127.0.0.1:8402"
|
|
43
|
-
}
|
|
44
|
-
}
|
|
54
|
+
If you want validation only (no config writes):
|
|
55
|
+
|
|
56
|
+
```bash
|
|
57
|
+
settld setup --non-interactive \
|
|
58
|
+
--host openclaw \
|
|
59
|
+
--base-url https://api.settld.work \
|
|
60
|
+
--tenant-id tenant_default \
|
|
61
|
+
--settld-api-key 'sk_live_xxx.yyy' \
|
|
62
|
+
--wallet-mode none \
|
|
63
|
+
--preflight-only \
|
|
64
|
+
--report-path ./.tmp/setup-preflight.json \
|
|
65
|
+
--format json
|
|
45
66
|
```
|
|
46
67
|
|
|
47
|
-
|
|
68
|
+
## 2) Host setup flows
|
|
69
|
+
|
|
70
|
+
Unified setup command:
|
|
48
71
|
|
|
49
72
|
```bash
|
|
50
|
-
|
|
73
|
+
settld setup
|
|
51
74
|
```
|
|
52
75
|
|
|
53
|
-
|
|
76
|
+
The wizard handles:
|
|
54
77
|
|
|
55
|
-
-
|
|
56
|
-
-
|
|
78
|
+
- host selection (`codex|claude|cursor|openclaw`)
|
|
79
|
+
- wallet mode selection (`managed|byo|none`)
|
|
80
|
+
- preflight checks (API health, tenant auth, profile baseline, host config path)
|
|
81
|
+
- policy apply + optional smoke
|
|
82
|
+
- interactive menus with arrow keys (Up/Down + Enter) for choice steps
|
|
57
83
|
|
|
58
|
-
|
|
84
|
+
Host-specific non-interactive examples:
|
|
59
85
|
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
4. Ask Claude to call:
|
|
64
|
-
- `settld.about`
|
|
65
|
-
- `settld.exa_search_paid` with `{"query":"dentist near me chicago","numResults":3}`
|
|
86
|
+
```bash
|
|
87
|
+
# Codex
|
|
88
|
+
settld setup --non-interactive --host codex --base-url http://127.0.0.1:3000 --tenant-id tenant_default --settld-api-key sk_live_xxx.yyy --wallet-mode none --profile-id engineering-spend --smoke
|
|
66
89
|
|
|
67
|
-
|
|
90
|
+
# Claude
|
|
91
|
+
settld setup --non-interactive --host claude --base-url http://127.0.0.1:3000 --tenant-id tenant_default --settld-api-key sk_live_xxx.yyy --wallet-mode none --profile-id engineering-spend --smoke
|
|
68
92
|
|
|
69
|
-
|
|
70
|
-
-
|
|
93
|
+
# Cursor
|
|
94
|
+
settld setup --non-interactive --host cursor --base-url http://127.0.0.1:3000 --tenant-id tenant_default --settld-api-key sk_live_xxx.yyy --wallet-mode none --profile-id engineering-spend --smoke
|
|
71
95
|
|
|
72
|
-
|
|
96
|
+
# OpenClaw
|
|
97
|
+
settld setup --non-interactive --host openclaw --base-url http://127.0.0.1:3000 --tenant-id tenant_default --settld-api-key sk_live_xxx.yyy --wallet-mode none --profile-id engineering-spend --smoke
|
|
98
|
+
```
|
|
73
99
|
|
|
74
|
-
|
|
75
|
-
2. Add an MCP server using the same canonical stdio definition.
|
|
76
|
-
3. Reconnect tools.
|
|
77
|
-
4. Run:
|
|
78
|
-
- `settld.about`
|
|
79
|
-
- `settld.weather_current_paid` with `{"city":"Chicago","unit":"f"}`
|
|
100
|
+
## 3) Wallet modes: managed vs BYO
|
|
80
101
|
|
|
81
|
-
|
|
102
|
+
### Managed (`--wallet-mode managed`)
|
|
82
103
|
|
|
83
|
-
|
|
104
|
+
Managed is the default and recommended first path.
|
|
84
105
|
|
|
85
|
-
|
|
106
|
+
`--wallet-bootstrap auto` behavior:
|
|
86
107
|
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
3. Reload tool discovery.
|
|
90
|
-
4. Run:
|
|
91
|
-
- `settld.about`
|
|
92
|
-
- `settld.exa_search_paid`
|
|
108
|
+
- If `--circle-api-key` (or `CIRCLE_API_KEY`) is present: local Circle bootstrap.
|
|
109
|
+
- If not present: remote onboarding bootstrap (`/v1/tenants/{tenantId}/onboarding/wallet-bootstrap`).
|
|
93
110
|
|
|
94
|
-
|
|
111
|
+
Force the path explicitly when needed:
|
|
95
112
|
|
|
96
|
-
|
|
113
|
+
```bash
|
|
114
|
+
# force remote wallet creation
|
|
115
|
+
settld setup --non-interactive --host openclaw --base-url https://api.settld.work --tenant-id tenant_default --settld-api-key 'sk_live_xxx.yyy' --wallet-mode managed --wallet-bootstrap remote --profile-id engineering-spend --smoke
|
|
97
116
|
|
|
98
|
-
|
|
117
|
+
# force local wallet creation with Circle credentials
|
|
118
|
+
settld setup --non-interactive --host openclaw --base-url https://api.settld.work --tenant-id tenant_default --settld-api-key 'sk_live_xxx.yyy' --wallet-mode managed --wallet-bootstrap local --circle-api-key 'TEST_API_KEY:...' --profile-id engineering-spend --smoke
|
|
119
|
+
```
|
|
99
120
|
|
|
100
|
-
|
|
101
|
-
Reference skill payload:
|
|
121
|
+
### BYO (`--wallet-mode byo`)
|
|
102
122
|
|
|
103
|
-
|
|
104
|
-
- `docs/integrations/openclaw/settld-mcp-skill/mcp-server.example.json`
|
|
105
|
-
- `docs/integrations/openclaw/CLAWHUB_PUBLISH_CHECKLIST.md`
|
|
123
|
+
Provide your own existing wallet values. Required keys:
|
|
106
124
|
|
|
107
|
-
|
|
125
|
+
- `CIRCLE_BASE_URL`
|
|
126
|
+
- `CIRCLE_BLOCKCHAIN`
|
|
127
|
+
- `CIRCLE_WALLET_ID_SPEND`
|
|
128
|
+
- `CIRCLE_WALLET_ID_ESCROW`
|
|
129
|
+
- `CIRCLE_TOKEN_ID_USDC`
|
|
130
|
+
- `CIRCLE_ENTITY_SECRET_HEX`
|
|
108
131
|
|
|
109
|
-
-
|
|
110
|
-
- MCP server command (`npx -y settld-mcp`)
|
|
111
|
-
- Required env vars (`SETTLD_BASE_URL`, `SETTLD_TENANT_ID`, `SETTLD_API_KEY`, optional `SETTLD_PAID_TOOLS_BASE_URL`)
|
|
112
|
-
- A smoke prompt using `settld.about`
|
|
132
|
+
Pass as env or repeated `--wallet-env KEY=VALUE` flags:
|
|
113
133
|
|
|
114
|
-
|
|
134
|
+
```bash
|
|
135
|
+
settld setup --non-interactive \
|
|
136
|
+
--host openclaw \
|
|
137
|
+
--base-url https://api.settld.work \
|
|
138
|
+
--tenant-id tenant_default \
|
|
139
|
+
--settld-api-key 'sk_live_xxx.yyy' \
|
|
140
|
+
--wallet-mode byo \
|
|
141
|
+
--wallet-env CIRCLE_BASE_URL=https://api-sandbox.circle.com \
|
|
142
|
+
--wallet-env CIRCLE_BLOCKCHAIN=BASE-SEPOLIA \
|
|
143
|
+
--wallet-env CIRCLE_WALLET_ID_SPEND=wid_spend \
|
|
144
|
+
--wallet-env CIRCLE_WALLET_ID_ESCROW=wid_escrow \
|
|
145
|
+
--wallet-env CIRCLE_TOKEN_ID_USDC=token_usdc \
|
|
146
|
+
--wallet-env CIRCLE_ENTITY_SECRET_HEX=$(openssl rand -hex 32) \
|
|
147
|
+
--profile-id engineering-spend \
|
|
148
|
+
--smoke
|
|
149
|
+
```
|
|
150
|
+
|
|
151
|
+
### None (`--wallet-mode none`)
|
|
152
|
+
|
|
153
|
+
Use this for policy/tooling setup without payment rails yet.
|
|
154
|
+
|
|
155
|
+
## 4) Activation after setup
|
|
156
|
+
|
|
157
|
+
`settld setup` writes host MCP config and prints `Combined exports`.
|
|
158
|
+
|
|
159
|
+
If you used `--out-env`, source it before running tools:
|
|
160
|
+
|
|
161
|
+
```bash
|
|
162
|
+
source ./.tmp/settld-openclaw.env
|
|
163
|
+
```
|
|
164
|
+
|
|
165
|
+
Then activate host-side:
|
|
166
|
+
|
|
167
|
+
- `codex`: restart Codex.
|
|
168
|
+
- `claude`: restart Claude Desktop.
|
|
169
|
+
- `cursor`: restart Cursor.
|
|
170
|
+
- `openclaw`: run `openclaw doctor`, ensure OpenClaw onboarding is complete (`openclaw onboard --install-daemon`), then run `openclaw tui`.
|
|
171
|
+
|
|
172
|
+
## 5) How the agent uses Settld after activation
|
|
173
|
+
|
|
174
|
+
After host activation, the agent interacts with Settld through MCP `settld.*` tools.
|
|
175
|
+
|
|
176
|
+
Typical flow:
|
|
177
|
+
|
|
178
|
+
1. Connectivity check: `settld.about`
|
|
179
|
+
2. Paid action: `settld.exa_search_paid` or `settld.weather_current_paid`
|
|
180
|
+
3. Policy gate + authorization happen server-side in Settld.
|
|
181
|
+
4. Settld records evidence/decision/receipt artifacts.
|
|
182
|
+
5. You can verify receipts offline (`settld x402 receipt verify`).
|
|
183
|
+
|
|
184
|
+
Quick local smoke:
|
|
115
185
|
|
|
116
186
|
```bash
|
|
117
187
|
npm run mcp:probe -- --call settld.about '{}'
|
|
118
188
|
```
|
|
119
189
|
|
|
120
|
-
|
|
190
|
+
First paid run + artifacts:
|
|
191
|
+
|
|
192
|
+
```bash
|
|
193
|
+
npm run demo:mcp-paid-exa
|
|
194
|
+
```
|
|
195
|
+
|
|
196
|
+
Verify first receipt from artifacts:
|
|
197
|
+
|
|
198
|
+
```bash
|
|
199
|
+
# replace <artifactDir> with the printed directory from demo output
|
|
200
|
+
settld x402 receipt verify <artifactDir>/x402-receipt.json --json-out /tmp/settld-first-receipt.json
|
|
201
|
+
```
|
|
202
|
+
|
|
203
|
+
## 6) Host config helper customization
|
|
204
|
+
|
|
205
|
+
Default host configuration logic is in:
|
|
206
|
+
|
|
207
|
+
- `scripts/setup/host-config.mjs`
|
|
121
208
|
|
|
122
|
-
|
|
209
|
+
If you need a custom resolver/writer, pass:
|
|
123
210
|
|
|
124
211
|
```bash
|
|
125
|
-
|
|
212
|
+
settld setup --host-config ./path/to/custom-host-config.mjs
|
|
126
213
|
```
|
|
127
214
|
|
|
128
|
-
|
|
129
|
-
2. Host discovers Settld tools (`tools/list` includes `settld.*`).
|
|
130
|
-
3. `settld.about` succeeds.
|
|
131
|
-
4. One paid tool call succeeds (`settld.exa_search_paid` or `settld.weather_current_paid`).
|
|
132
|
-
5. You can see a resulting artifact bundle from paid demo runs:
|
|
133
|
-
- `artifacts/mcp-paid-exa/.../summary.json`
|
|
134
|
-
- `artifacts/mcp-paid-weather/.../summary.json`
|
|
215
|
+
Your helper should provide resolver/setup exports compatible with `scripts/setup/wizard.mjs`.
|
|
135
216
|
|
|
136
217
|
## 7) Troubleshooting
|
|
137
218
|
|
|
219
|
+
- `BYO wallet mode missing required env keys`
|
|
220
|
+
- Provide all required Circle keys in section 3.
|
|
221
|
+
- `host config helper missing`
|
|
222
|
+
- Add `scripts/setup/host-config.mjs` or pass `--host-config`.
|
|
138
223
|
- `SETTLD_API_KEY must be a non-empty string`
|
|
139
|
-
-
|
|
224
|
+
- Ensure key is present in shell or setup flags.
|
|
140
225
|
- Host cannot run `npx`
|
|
141
|
-
- Install Node 20+ and ensure `npx` is
|
|
142
|
-
- Paid tool returns gateway/connectivity errors
|
|
143
|
-
- Confirm `SETTLD_PAID_TOOLS_BASE_URL` points to a running gateway.
|
|
226
|
+
- Install Node.js 20+ and ensure `npx` is in `PATH`.
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
# Quickstart: Policy Packs CLI (v1)
|
|
2
|
+
|
|
3
|
+
Goal: initialize, simulate, and publish deterministic local policy pack artifacts with `settld policy`.
|
|
4
|
+
|
|
5
|
+
## Starter policy packs
|
|
6
|
+
|
|
7
|
+
- `engineering-spend`
|
|
8
|
+
- `procurement-enterprise`
|
|
9
|
+
- `data-api-buyer`
|
|
10
|
+
- `support-automation`
|
|
11
|
+
- `finance-controls`
|
|
12
|
+
|
|
13
|
+
## 1) Initialize a starter pack
|
|
14
|
+
|
|
15
|
+
Installed CLI:
|
|
16
|
+
|
|
17
|
+
```bash
|
|
18
|
+
npx settld policy init engineering-spend --out ./policies/engineering.policy-pack.json
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
Repo checkout:
|
|
22
|
+
|
|
23
|
+
```bash
|
|
24
|
+
./bin/settld.js policy init engineering-spend --out ./policies/engineering.policy-pack.json
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
## 2) Simulate a decision
|
|
28
|
+
|
|
29
|
+
Default scenario (first allowlisted provider/tool, zero spend):
|
|
30
|
+
|
|
31
|
+
```bash
|
|
32
|
+
./bin/settld.js policy simulate ./policies/engineering.policy-pack.json --format json
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
Explicit scenario:
|
|
36
|
+
|
|
37
|
+
```bash
|
|
38
|
+
./bin/settld.js policy simulate ./policies/engineering.policy-pack.json \
|
|
39
|
+
--scenario-json '{"providerId":"openai","toolId":"llm.inference","amountUsdCents":25000,"monthToDateSpendUsdCents":100000,"approvalsProvided":1,"receiptSigned":true,"toolManifestHashPresent":true,"toolVersionKnown":true}' \
|
|
40
|
+
--format json
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
## 3) Publish locally (deterministic report artifact)
|
|
44
|
+
|
|
45
|
+
```bash
|
|
46
|
+
./bin/settld.js policy publish ./policies/engineering.policy-pack.json --format json
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
`publish` has no remote dependency. It writes a local `SettldPolicyPublication.v1` artifact and returns a `SettldPolicyPublishReport.v1` with:
|
|
50
|
+
|
|
51
|
+
- deterministic `policyFingerprint` (canonical JSON SHA-256)
|
|
52
|
+
- deterministic `publicationRef` (`<channel>:<packId>:<fingerprint-prefix>`)
|
|
53
|
+
- `artifactPath` + `artifactSha256`
|
|
54
|
+
|
|
55
|
+
## Output modes
|
|
56
|
+
|
|
57
|
+
All commands support:
|
|
58
|
+
|
|
59
|
+
- `--format text|json` (default `text`)
|
|
60
|
+
- `--json-out <path>` for machine output files
|
|
61
|
+
|
|
62
|
+
`init` and `publish` also support:
|
|
63
|
+
|
|
64
|
+
- `--out <path>`
|
|
65
|
+
- `--force` to overwrite an existing path
|