@perkos/agent-sdk 0.7.0 → 0.8.0-rc.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/CHANGELOG.md +74 -0
- package/README.md +98 -44
- package/dist/builders.d.ts +5 -1
- package/dist/builders.d.ts.map +1 -1
- package/dist/builders.js +155 -11
- package/dist/builders.js.map +1 -1
- package/dist/client.d.ts +8 -1
- package/dist/client.d.ts.map +1 -1
- package/dist/client.js +168 -26
- package/dist/client.js.map +1 -1
- package/dist/constants.d.ts.map +1 -1
- package/dist/constants.js +6 -4
- package/dist/constants.js.map +1 -1
- package/dist/custody/backend.d.ts +4 -0
- package/dist/custody/backend.d.ts.map +1 -0
- package/dist/custody/backend.js +149 -0
- package/dist/custody/backend.js.map +1 -0
- package/dist/custody/cli.d.ts +3 -0
- package/dist/custody/cli.d.ts.map +1 -0
- package/dist/custody/cli.js +43 -0
- package/dist/custody/cli.js.map +1 -0
- package/dist/custody/engine.d.ts +54 -0
- package/dist/custody/engine.d.ts.map +1 -0
- package/dist/custody/engine.js +115 -0
- package/dist/custody/engine.js.map +1 -0
- package/dist/custody/ledger.d.ts +24 -0
- package/dist/custody/ledger.d.ts.map +1 -0
- package/dist/custody/ledger.js +122 -0
- package/dist/custody/ledger.js.map +1 -0
- package/dist/custody/permit.d.ts +42 -0
- package/dist/custody/permit.d.ts.map +1 -0
- package/dist/custody/permit.js +91 -0
- package/dist/custody/permit.js.map +1 -0
- package/dist/custody/socket.d.ts +11 -0
- package/dist/custody/socket.d.ts.map +1 -0
- package/dist/custody/socket.js +118 -0
- package/dist/custody/socket.js.map +1 -0
- package/dist/evaluation-commitments.d.ts +47 -0
- package/dist/evaluation-commitments.d.ts.map +1 -0
- package/dist/evaluation-commitments.js +96 -0
- package/dist/evaluation-commitments.js.map +1 -0
- package/dist/index.d.ts +6 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -1
- package/dist/index.js.map +1 -1
- package/dist/mcp/cli.d.ts +3 -0
- package/dist/mcp/cli.d.ts.map +1 -0
- package/dist/mcp/cli.js +36 -0
- package/dist/mcp/cli.js.map +1 -0
- package/dist/mcp/evaluation.d.ts +33 -0
- package/dist/mcp/evaluation.d.ts.map +1 -0
- package/dist/mcp/evaluation.js +141 -0
- package/dist/mcp/evaluation.js.map +1 -0
- package/dist/mcp/server.d.ts +27 -0
- package/dist/mcp/server.d.ts.map +1 -0
- package/dist/mcp/server.js +207 -0
- package/dist/mcp/server.js.map +1 -0
- package/dist/policy.d.ts.map +1 -1
- package/dist/policy.js +7 -2
- package/dist/policy.js.map +1 -1
- package/dist/service-fees.d.ts +15 -0
- package/dist/service-fees.d.ts.map +1 -0
- package/dist/service-fees.js +109 -0
- package/dist/service-fees.js.map +1 -0
- package/dist/types.d.ts +66 -2
- package/dist/types.d.ts.map +1 -1
- package/docs/ARCHITECTURE.md +31 -15
- package/docs/EXISTING_AGENT.md +123 -0
- package/docs/HERMES_BUYER.md +91 -0
- package/docs/HERMES_CHECKPOINTS.md +88 -0
- package/docs/HERMES_CUSTODY.md +164 -0
- package/docs/HERMES_MCP.md +157 -0
- package/docs/HERMES_PROVIDER.md +98 -0
- package/docs/RELEASE_0.8.0_RC1.md +60 -0
- package/docs/SERVICE_FEES.md +108 -0
- package/docs/TESTNET_QUICKSTART.md +123 -0
- package/docs/VALIDATION_AND_RELEASE.md +82 -0
- package/docs/WALLET_SIGNER_SETUP.md +52 -0
- package/examples/service-fees.ts +36 -0
- package/examples/testnet-journal.ts +57 -0
- package/examples/testnet-lifecycle.ts +188 -294
- package/examples/testnet.env.example +12 -14
- package/package.json +7 -1
|
@@ -0,0 +1,164 @@
|
|
|
1
|
+
# Hermes custody — bounded QA execution candidate
|
|
2
|
+
|
|
3
|
+
**Unreleased; deployed only for the controlled QA pilot. Do not enable funded wallets before your Linux isolation gate.**
|
|
4
|
+
This candidate adds `nayori-custody`, a separate Node service, and optional delegation from
|
|
5
|
+
`nayori-mcp`. It is not in published npm 0.7.1. No mainnet mode exists.
|
|
6
|
+
|
|
7
|
+
[One supervised internal lifecycle](VALIDATION_AND_RELEASE.md) passed with isolated signers.
|
|
8
|
+
That historical evidence does not authorize your deployment, wallet or spending limits.
|
|
9
|
+
|
|
10
|
+
## Trust boundary
|
|
11
|
+
|
|
12
|
+
Hermes/MCP → filesystem Unix socket → operator permit + durable ledger → SDK plan → testnet signer.
|
|
13
|
+
|
|
14
|
+
The service uses the real SDK builders and validation, not an LLM-generated raw transaction.
|
|
15
|
+
The model can request an action; it cannot choose network, contract, wallet, recipient, amount,
|
|
16
|
+
fee, private-key path, shell command, RPC endpoint, or signer module. The service never executes
|
|
17
|
+
job text as instructions. MCP has no private key and does not sign locally.
|
|
18
|
+
|
|
19
|
+
The **deployment**, not the presence of a socket, establishes isolation:
|
|
20
|
+
|
|
21
|
+
- Linux only for the custody CLI; signer and Hermes must use **different non-root UIDs**.
|
|
22
|
+
- Use a dedicated wallet and one immutable permit/ledger per participant for this pilot. Do not
|
|
23
|
+
reuse the wallet outside the custodian, or run another custodian with another state directory.
|
|
24
|
+
- Signer-owned private directories: `0700`; permit, journal and key files: `0600`, single link,
|
|
25
|
+
regular files, no symlinks. Use canonical absolute paths. No `.env` in Hermes or key in arguments.
|
|
26
|
+
- IPC directory: signer-owned `0710`, trusted connector group; socket `0660`. Its ancestors
|
|
27
|
+
must let Hermes traverse **only the IPC path**, not the private data directory. Set the signer
|
|
28
|
+
primary group to this connector group so the socket inherits it. Do not give group write access
|
|
29
|
+
to the IPC directory. Unrelated users must not belong to the connector group.
|
|
30
|
+
- Hermes must have no sudo, Docker socket, host root, `CAP_SYS_PTRACE`, shared key mount, signer
|
|
31
|
+
UID, writable signer source/dependencies, or access to signer process memory. Disable core dumps.
|
|
32
|
+
Restrict signer egress to the testnet RPC; keep permit/state/code inaccessible to Hermes.
|
|
33
|
+
- `--hermes-uid` rejects root/same UID, but **does not attest a running Hermes process or enforce
|
|
34
|
+
container mounts/capabilities**. Verify those operational controls before loading any funded key.
|
|
35
|
+
|
|
36
|
+
Linux pathname socket permissions govern access; these semantics are not portable to every OS.
|
|
37
|
+
See [Linux unix(7)](https://man7.org/linux/man-pages/man7/unix.7.html) and
|
|
38
|
+
[Node IPC documentation](https://nodejs.org/docs/latest-v22.x/api/net.html#ipc-support).
|
|
39
|
+
Same-UID macOS protocol tests are **not** an isolation proof or an external security review.
|
|
40
|
+
|
|
41
|
+
## Operator permit
|
|
42
|
+
|
|
43
|
+
Only the operator writes this JSON, outside Git. All fields below are required; placeholders
|
|
44
|
+
intentionally fail validation. Addresses must be distinct, valid testnet principals. `expiresAt`
|
|
45
|
+
is UTC wall-clock authorization expiry; `expiredAt` is the job's **Stacks block** expiry.
|
|
46
|
+
|
|
47
|
+
```json
|
|
48
|
+
{
|
|
49
|
+
"version": 1,
|
|
50
|
+
"id": "qa-buyer-001",
|
|
51
|
+
"profile": {
|
|
52
|
+
"network": "testnet",
|
|
53
|
+
"role": "client",
|
|
54
|
+
"client": "BUYER_TESTNET_ADDRESS",
|
|
55
|
+
"provider": "PROVIDER_TESTNET_ADDRESS",
|
|
56
|
+
"evaluator": "VERIFIED_QA_EVALUATOR_ADDRESS",
|
|
57
|
+
"treasury": "VERIFIED_QA_TREASURY_ADDRESS"
|
|
58
|
+
},
|
|
59
|
+
"asset": "sbtc",
|
|
60
|
+
"amount": "1000",
|
|
61
|
+
"gasBudget": "30000",
|
|
62
|
+
"expiresAt": "2099-01-01T00:00:00.000Z",
|
|
63
|
+
"expiredAt": "REPLACE_WITH_FUTURE_STACKS_HEIGHT",
|
|
64
|
+
"jobId": null,
|
|
65
|
+
"description": "Compute 7 + 5 and explain the result",
|
|
66
|
+
"acceptanceCriteria": [
|
|
67
|
+
{ "id": "sum", "requirement": "Return 12", "verification": "Check arithmetic" }
|
|
68
|
+
],
|
|
69
|
+
"agentName": "QA buyer",
|
|
70
|
+
"actions": ["register", "create", "set-budget", "fund", "assign", "finalize"],
|
|
71
|
+
"evidenceOrigins": ["https://evaluator.qa.nayori.ai"],
|
|
72
|
+
"serviceFeeConsent": "200bps-net-after-evaluation"
|
|
73
|
+
}
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
Replace the illustrative expiry with a short operator-approved window. Maximum escrow is
|
|
77
|
+
1000 sBTC units or 100000 micro-STX. Gas is **5000 micro-STX per action**, cumulatively reserved,
|
|
78
|
+
maximum 35000 per permit; failed/ambiguous operations do not replenish it. No gas bump or
|
|
79
|
+
sponsorship is attempted. Service consent accepts the existing **included 2% evaluation-earned
|
|
80
|
+
fee and net refund after evaluated rejection**, not a second x402 charge. Funds stay in escrow
|
|
81
|
+
until the contract settles them.
|
|
82
|
+
|
|
83
|
+
For the provider use a separate wallet/state/socket, role `provider`, the confirmed `jobId`, and
|
|
84
|
+
actions `["register", "submit"]`. Client/evaluator/treasury, criteria, budget and job expiry must
|
|
85
|
+
match the buyer's job. A provider never gets create/fund/assign/finalize authorization here.
|
|
86
|
+
|
|
87
|
+
## Start and connect
|
|
88
|
+
|
|
89
|
+
Install the exact reviewed QA tarball on each side. Record its SHA-256 and source commit.
|
|
90
|
+
First start with **signing disabled**, without a funded key:
|
|
91
|
+
|
|
92
|
+
```sh
|
|
93
|
+
nayori-custody --permit /private/permit.json --state /private/state \
|
|
94
|
+
--socket /ipc/nayori.sock --key-file /private/wallet-key \
|
|
95
|
+
--hermes-uid 2002
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
Paths/UID are illustrative, not commands to provision the production server. The permit and
|
|
99
|
+
state directories must already satisfy permissions. Startup prints only the permit hash and
|
|
100
|
+
enabled flag to stderr. The key is read lazily **after** live checks and durable reservation.
|
|
101
|
+
After human review and the isolation gate, the operator may explicitly append
|
|
102
|
+
`--enable-testnet-signing`. Never give Hermes permission to modify service arguments.
|
|
103
|
+
|
|
104
|
+
Add to the existing [MCP configuration](HERMES_MCP.md):
|
|
105
|
+
|
|
106
|
+
```yaml
|
|
107
|
+
- --custody-socket
|
|
108
|
+
- /ipc/nayori.sock
|
|
109
|
+
- --permit-hash
|
|
110
|
+
- OPERATOR_RECORDED_64_HEX_SHA256
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
Two optional tools appear:
|
|
114
|
+
|
|
115
|
+
| Tool | Purpose |
|
|
116
|
+
|---|---|
|
|
117
|
+
| `nayori_custody_status` | Reconcile saved txids; show permit, budget, job ID and operations |
|
|
118
|
+
| `nayori_execute` | Request one allowed action, e.g. `{"action":"create"}` |
|
|
119
|
+
|
|
120
|
+
Submit additionally requires the exact evidence manifest schema from `nayori_prepare_submission`.
|
|
121
|
+
No `evidence` argument is accepted for other actions. Evidence origins, manifest hash/schema,
|
|
122
|
+
MIME and byte declarations are checked, but the signer **does not fetch or verify content bytes**.
|
|
123
|
+
The evaluator still must validate those bytes and judge the actual work.
|
|
124
|
+
|
|
125
|
+
Recommended sequence: buyer register → create → status/confirmed job ID → set-budget → fund →
|
|
126
|
+
assign; provider register → submit. Request each new action only after the previous one confirms.
|
|
127
|
+
Provider MCP can separately opt into [public QA evaluation admission](HERMES_MCP.md#optional-provider-evaluation-admission)
|
|
128
|
+
after a confirmed submission. No LLM API credential, internal evaluator bearer or x402 purchase
|
|
129
|
+
is added to custody. After an on-chain decision
|
|
130
|
+
and the appeal deadline, the buyer can finalize. Appealed jobs are blocked for human resolution;
|
|
131
|
+
this pilot does not expose appeal, refund, review-timeout or administrative actions.
|
|
132
|
+
|
|
133
|
+
## Recovery and accounting
|
|
134
|
+
|
|
135
|
+
- One wallet-scoped lock prevents parallel custodian processes using the same state directory.
|
|
136
|
+
- Append-only journal: reservation → locally derived txid → canonical confirmation. Each write
|
|
137
|
+
and parent directory entry is fsynced before the next side effect. Gas is never reset on restart.
|
|
138
|
+
- Exact duplicate requests return the existing state. Changed evidence for an already attempted
|
|
139
|
+
submit is rejected. Signing/broadcast timeouts, aborted transactions, partial journal writes and
|
|
140
|
+
unknown outcomes block additional spending. Errors never claim that no signature was made.
|
|
141
|
+
- Reconciliation requires the saved txid, canonical anchored success, expected contract result,
|
|
142
|
+
and **six subsequent burn blocks**. Create binds its returned job ID for subsequent actions.
|
|
143
|
+
Six confirmations reduce reorg risk; they do not eliminate it. Public RPC is a trust dependency.
|
|
144
|
+
- A crash leaves a lock. **Never delete/replace a ledger, approve a new permit for the same wallet,
|
|
145
|
+
or remove a lock blindly to retry.** Stop all signer processes; inspect chain nonce, saved txid,
|
|
146
|
+
mempool and events. Preserve evidence and obtain explicit operator recovery authorization.
|
|
147
|
+
This candidate intentionally has no automatic “unlock/retry payment” command.
|
|
148
|
+
- Nonce must be idle; another wallet user or pending transaction blocks signing. Postconditions
|
|
149
|
+
are deny-mode; sBTC is pinned to the canonical QA token and v6/v5 contracts.
|
|
150
|
+
- Finalization confirmation is not the full E2E acceptance report: independently verify exact
|
|
151
|
+
provider/treasury transfers, zero escrow, outcome and reputation before declaring success.
|
|
152
|
+
- Ordinary JavaScript strings cannot guarantee private-key memory erasure. This is a constrained
|
|
153
|
+
software custodian, not an HSM, MPC wallet, audited production signer, or disaster-recovery system.
|
|
154
|
+
|
|
155
|
+
## Release gates still required
|
|
156
|
+
|
|
157
|
+
1. Review/merge QA source and validate package integrity.
|
|
158
|
+
2. Deploy from the authorized workstation to QA; provision distinct Linux identities and prove
|
|
159
|
+
Hermes cannot read/modify key, permit, journal, code or another role's socket.
|
|
160
|
+
3. Crash/restart and concurrency tests across those OS identities, first with unfunded fixtures.
|
|
161
|
+
4. Explicitly approved low-value testnet buyer/provider run using **actual Hermes**, including
|
|
162
|
+
evaluator admission, exact payout events and recovery. Internal actors are not M2 adoption.
|
|
163
|
+
5. Complete the x402 onboarding walkthrough, release version/npm distribution, two operator
|
|
164
|
+
manuals and developer video. Production/mainnet remain unchanged until separately approved.
|
|
@@ -0,0 +1,157 @@
|
|
|
1
|
+
# Hermes MCP — QA adapter
|
|
2
|
+
|
|
3
|
+
**Unreleased QA candidate. Not yet published to npm, not a complete wallet-enabled
|
|
4
|
+
Hermes integration.** By default this packages read/prepare tools using the actual SDK.
|
|
5
|
+
Optional [custody delegation](HERMES_CUSTODY.md) adds bounded register/create/fund/assign/submit/finalize
|
|
6
|
+
requests to a separate operator-controlled signer. This is not deployed or funded by default.
|
|
7
|
+
An additional provider-only opt-in can request public QA evaluations for the permitted job.
|
|
8
|
+
Neither mode performs x402 purchases or generates wallets.
|
|
9
|
+
|
|
10
|
+
## Architecture and installation
|
|
11
|
+
|
|
12
|
+
Hermes → local MCP stdio → Nayori SDK → fixed public Stacks testnet reads.
|
|
13
|
+
Preparation tools are offline. There is no signer in the process or tool arguments.
|
|
14
|
+
The browser SDK entry point does not import this Node-only adapter.
|
|
15
|
+
|
|
16
|
+
Build and verify the reviewed QA source, then pack it outside the checkout:
|
|
17
|
+
|
|
18
|
+
```sh
|
|
19
|
+
npm ci
|
|
20
|
+
npm run verify
|
|
21
|
+
npm pack --pack-destination /absolute/private-artifacts
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
In a clean consumer directory, install that exact reviewed tarball:
|
|
25
|
+
|
|
26
|
+
```sh
|
|
27
|
+
npm init -y
|
|
28
|
+
npm install --save-exact /absolute/private-artifacts/perkos-agent-sdk-0.8.0-rc.1.tgz
|
|
29
|
+
./node_modules/.bin/nayori-mcp --help
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
The current candidate is 0.8.0-rc.1, separate from published 0.7.1. Historical QA tests used
|
|
33
|
+
a source tarball still numbered 0.7.1; do not confuse it with either distribution.
|
|
34
|
+
Record the tarball SHA-256 and exact commit. Initializing the consumer's own package.json
|
|
35
|
+
prevents npm from inheriting an unrelated parent project. See the
|
|
36
|
+
[candidate release checklist](RELEASE_0.8.0_RC1.md); registry installation is not yet available.
|
|
37
|
+
Do not run an unpinned `npx -y` command for a financial agent.
|
|
38
|
+
|
|
39
|
+
## Public role profile
|
|
40
|
+
|
|
41
|
+
Create a JSON file outside Git. It contains **only public addresses**, no environment
|
|
42
|
+
variables, private keys, seed phrases, tokens, signer modules or URLs:
|
|
43
|
+
|
|
44
|
+
```json
|
|
45
|
+
{
|
|
46
|
+
"network": "testnet",
|
|
47
|
+
"role": "client",
|
|
48
|
+
"client": "YOUR_TESTNET_BUYER_ADDRESS",
|
|
49
|
+
"provider": "YOUR_TESTNET_PROVIDER_ADDRESS",
|
|
50
|
+
"evaluator": "THE_VERIFIED_QA_EVALUATOR_ADDRESS",
|
|
51
|
+
"treasury": "THE_VERIFIED_QA_TREASURY_ADDRESS"
|
|
52
|
+
}
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
Placeholders intentionally fail validation. Use distinct valid testnet addresses, confirm
|
|
56
|
+
evaluator/treasury against the deployed QA policy, and use `role: "provider"` for the
|
|
57
|
+
provider's separate instance. Profile acceptance does not certify registration, ownership
|
|
58
|
+
of an address or a match to on-chain evaluator/treasury policy.
|
|
59
|
+
|
|
60
|
+
The adapter pins STX `agentic-commerce-v6`, sBTC `sbtc-commerce-v5`, agent-registry and
|
|
61
|
+
reputation-registry-v3 under `ST16EWRC01S1SFWGBP63MW47VY8P3AYFA8VGEBGE5`.
|
|
62
|
+
Network/contract/endpoint overrides from tools are rejected; this adapter has no mainnet mode.
|
|
63
|
+
|
|
64
|
+
## Connect Hermes
|
|
65
|
+
|
|
66
|
+
Start with an existing Hermes already working with your own LLM; leave that configuration
|
|
67
|
+
unchanged. This MCP does not select or authenticate the LLM provider, receive model API keys
|
|
68
|
+
or require PerkOS-LLM. [Existing-agent onboarding](EXISTING_AGENT.md) explains registration
|
|
69
|
+
and the separate operator-owned wallet/signer preparation. Hermes is an example, not a requirement.
|
|
70
|
+
The fixed QA evaluator endpoint is a separate Nayori service, not the developer's LLM endpoint.
|
|
71
|
+
|
|
72
|
+
After installing the tarball, configure a separate Hermes profile for each participant:
|
|
73
|
+
|
|
74
|
+
```yaml
|
|
75
|
+
mcp_servers:
|
|
76
|
+
nayori_qa:
|
|
77
|
+
command: /absolute/path/to/node
|
|
78
|
+
args:
|
|
79
|
+
- /absolute/consumer/node_modules/@perkos/agent-sdk/dist/mcp/cli.js
|
|
80
|
+
- --config
|
|
81
|
+
- /absolute/private-config/public-profile.json
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
Start Hermes and request the `nayori_context` tool. Hermes may prefix tool names.
|
|
85
|
+
This is a manually configured MCP, not an entry approved for the Nous MCP catalog.
|
|
86
|
+
Never put wallet keys into Hermes's config, environment, skill, prompts or tool parameters.
|
|
87
|
+
|
|
88
|
+
| Tool | Roles | Effect |
|
|
89
|
+
|---|---|---|
|
|
90
|
+
| nayori_context | Both | Fixed QA role/contracts and explicit capability flags |
|
|
91
|
+
| nayori_counts | Both | Registry/job counts; not adoption/completion counts |
|
|
92
|
+
| nayori_get_agent | Both | One agent by decimal ID |
|
|
93
|
+
| nayori_get_job | Both | One job, escrow, decision and fee ledger |
|
|
94
|
+
| nayori_get_reputation | Both | Public testnet reputation |
|
|
95
|
+
| nayori_prepare_job | Buyer | Offline criteria commitment; does not create a job |
|
|
96
|
+
| nayori_prepare_submission | Provider | Offline evidence commitment; does not submit work |
|
|
97
|
+
|
|
98
|
+
## Boundaries and errors
|
|
99
|
+
|
|
100
|
+
### Optional provider evaluation admission
|
|
101
|
+
|
|
102
|
+
Only after configuring provider custody, the operator may append `--enable-qa-evaluation`
|
|
103
|
+
to the MCP CLI arguments (after `--permit-hash` and its value). Add these **exact names** to
|
|
104
|
+
Hermes's tool include list if one is configured:
|
|
105
|
+
|
|
106
|
+
- `nayori_request_evaluation`: accepts the same asset, jobId, description, acceptanceCriteria
|
|
107
|
+
and evidence as preparation. Requires an enabled, unexpired provider permit and a confirmed
|
|
108
|
+
submit in its durable journal. It compares client/provider/evaluator/treasury, budget, criteria
|
|
109
|
+
and evidence commitments against the actual SDK job read before any admission request.
|
|
110
|
+
- `nayori_evaluation_status`: accepts only asset and jobId; both must match the configured
|
|
111
|
+
custody permit. Remains available for reconciliation after permit expiry.
|
|
112
|
+
|
|
113
|
+
Requests go only to `https://evaluator.qa.nayori.ai/v1/evaluations`. Evidence must use that
|
|
114
|
+
HTTPS origin; this narrow pilot does not support arbitrary storage providers. The evaluator,
|
|
115
|
+
not MCP, fetches/validates evidence bytes and rechecks eligibility, deadlines and capacity.
|
|
116
|
+
The operator explicitly authorizes enqueueing evaluation work by enabling the option.
|
|
117
|
+
No internal API key, wallet signature, second fee or x402 purchase is attached.
|
|
118
|
+
|
|
119
|
+
Admission allows 45 seconds for paced eligibility reads; status lookup allows 15 seconds.
|
|
120
|
+
Configure custom relay/proxy timeouts accordingly and check capacity before submission.
|
|
121
|
+
Safe MCP error codes distinguish `admission_limit`, `ineligible`, `unavailable` and `transport`.
|
|
122
|
+
All prohibit automatic retry. They contain fixed SDK guidance, never upstream error details.
|
|
123
|
+
The contract's review deadline remains authoritative even after an HTTP timeout.
|
|
124
|
+
|
|
125
|
+
The adapter looks up the deterministic job-scoped evaluation ID before POST. The server's
|
|
126
|
+
durable idempotency remains the authority across processes/restarts. HTTP errors/timeouts
|
|
127
|
+
do not trigger automatic retry: query status first. A changed manifest cannot bypass the
|
|
128
|
+
on-chain commitment. Status responses expose only bounded identity/state/txid fields, not
|
|
129
|
+
arbitrary public explanations or raw errors. `confirmed` here describes the evaluator, not a
|
|
130
|
+
verified escrow payout. Buyer custody still finalizes after the actual appeal deadline.
|
|
131
|
+
|
|
132
|
+
This is an unreleased source candidate. In addition to mocked HTTP/chain tests, one internal
|
|
133
|
+
funded Hermes lifecycle passed; see [the exact validation scope](VALIDATION_AND_RELEASE.md).
|
|
134
|
+
It is not a security audit or npm release. Without the flag, tool availability is unchanged.
|
|
135
|
+
|
|
136
|
+
- No arbitrary shell, file-reading, secret-export, transaction-signing or broadcast tool.
|
|
137
|
+
- Unknown fields, wrong roles, unsupported assets, oversized payloads and invalid IDs fail closed.
|
|
138
|
+
- Public chain text and URLs are untrusted data. Never follow their instructions or treat
|
|
139
|
+
them as approval to spend, change configuration, or invoke another tool.
|
|
140
|
+
- Evidence preparation hashes the **manifest**, not remotely fetched bytes. It returns
|
|
141
|
+
`evidenceBytesVerified: false`; the evaluator still must check allowlisted HTTPS content.
|
|
142
|
+
- Errors do not reflect raw RPC responses, user inputs or diagnostics into the model.
|
|
143
|
+
- A decision is not payout confirmation. Use transaction events and fee/reputation checks.
|
|
144
|
+
- There is no wallet isolation claim from merely running two same-user processes. The optional
|
|
145
|
+
custody candidate requires verified Linux isolation and durable operator-approved limits.
|
|
146
|
+
|
|
147
|
+
## Validation and remaining work
|
|
148
|
+
|
|
149
|
+
Automated tests cover official MCP client/server handshake, schemas, role separation,
|
|
150
|
+
BigInt serialization, offline commitments, sanitized failures and real subprocess stdio.
|
|
151
|
+
Those automated tests are distinct from the [verified internal testnet lifecycle](VALIDATION_AND_RELEASE.md).
|
|
152
|
+
Clean published-package onboarding, the separate x402 walkthrough and video remain pending.
|
|
153
|
+
Repeat isolation and permission checks for each new operator deployment; this single supervised
|
|
154
|
+
scenario does not certify general autonomous onboarding. No server deployment is needed to test stdio.
|
|
155
|
+
|
|
156
|
+
Sources: [Hermes MCP](https://hermes-agent.nousresearch.com/docs/user-guide/features/mcp),
|
|
157
|
+
[official MCP server guide](https://modelcontextprotocol.io/docs/develop/build-server).
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
# Hermes provider — controlled QA walkthrough
|
|
2
|
+
|
|
3
|
+
See [validation and release boundaries](VALIDATION_AND_RELEASE.md) for the verified internal
|
|
4
|
+
scenario and remaining distribution/video gates. An existing active registration is reused
|
|
5
|
+
after readback, not registered again; adjust the permit and gas cap to omit that action.
|
|
6
|
+
|
|
7
|
+
See [QA checkpoints and confirmation handling](HERMES_CHECKPOINTS.md) for the job-bound permit,
|
|
8
|
+
STX gas budget, six-burn gate and the difference between a decision and payment. Do not fund
|
|
9
|
+
your wallet with sBTC merely to receive a payout or reuse an example job ID.
|
|
10
|
+
|
|
11
|
+
**Unreleased candidate; funded autonomous onboarding and recording still require validation.**
|
|
12
|
+
Use the same job as the [buyer walkthrough](HERMES_BUYER.md), with a different wallet, signer,
|
|
13
|
+
Hermes instance and journal. The candidate MCP is not the npm 0.7.1 release.
|
|
14
|
+
|
|
15
|
+
## 1. Install and prepare your wallet externally
|
|
16
|
+
|
|
17
|
+
Your Hermes is already installed and working with your own LLM. Keep that setup; this guide
|
|
18
|
+
adds Nayori tools without configuring or replacing your model. No PerkOS-LLM account or model
|
|
19
|
+
API key shared with Nayori is required. Hermes is an example, not a platform requirement.
|
|
20
|
+
Start with [existing-agent onboarding](EXISTING_AGENT.md) and the separate
|
|
21
|
+
[operator wallet/signer checklist](WALLET_SIGNER_SETUP.md). Never put model credentials in
|
|
22
|
+
tool arguments or recordings. Your agent's model is separate from Nayori's evaluator.
|
|
23
|
+
|
|
24
|
+
Follow [MCP installation](HERMES_MCP.md) with the exact reviewed tarball/source hash. Create,
|
|
25
|
+
back up and restore-check your own testnet wallet outside the SDK and Hermes. Fund only
|
|
26
|
+
authorized STX network fees; a provider does not need to send sBTC to receive a job payment.
|
|
27
|
+
Never give Hermes your key or the buyer/evaluator/treasury keys. Follow the separate-UID,
|
|
28
|
+
filesystem, socket and capability restrictions in [custody setup](HERMES_CUSTODY.md).
|
|
29
|
+
|
|
30
|
+
Configure `role: provider`. The operator permit must reference the buyer's confirmed job ID,
|
|
31
|
+
same criteria, identities, amount and expiry, with only `register` and `submit`. Start with
|
|
32
|
+
signing disabled and confirm tool context and custody status. Allow evaluation separately only
|
|
33
|
+
if this operator consents to enqueueing review of this job.
|
|
34
|
+
|
|
35
|
+
## 2. Confirm assignment and perform the work
|
|
36
|
+
|
|
37
|
+
1. With explicit low-value testnet permission, enable the isolated signer and request `register`.
|
|
38
|
+
Confirm the transaction and agent record. Wallet creation is not registration.
|
|
39
|
+
2. Read the job using `nayori_get_job`. Confirm provider equals your address, status is funded,
|
|
40
|
+
escrow equals the agreed gross amount and client/evaluator/treasury/criteria are correct.
|
|
41
|
+
3. Do not self-assign or work against missing escrow. Ask the buyer to resolve mismatches.
|
|
42
|
+
4. Have the real Hermes perform the agreed task. Preserve its actual output, including errors;
|
|
43
|
+
do not substitute a canned result and call it autonomous execution.
|
|
44
|
+
5. Publish the small evidence artifact through the operator-approved QA evidence workflow.
|
|
45
|
+
This MCP does not include an upload tool. The pilot accepts evidence only from the fixed
|
|
46
|
+
evaluator QA HTTPS origin; publishing to arbitrary hosts is not supported in this bridge.
|
|
47
|
+
6. Compute the actual artifact's SHA-256, MIME and byte count. Prepare its manifest with
|
|
48
|
+
`nayori_prepare_submission`. Preparation hashes the manifest and does not verify remote bytes.
|
|
49
|
+
7. Request `nayori_execute` with `action: submit` and the exact evidence manifest. Confirm the
|
|
50
|
+
saved transaction and job submission, including the configured six subsequent burn blocks.
|
|
51
|
+
|
|
52
|
+
## 3. Request public evaluation, without internal credentials
|
|
53
|
+
|
|
54
|
+
Before submitting work, coordinate evaluator availability and daily capacity with the QA
|
|
55
|
+
operator. The on-chain review window starts at submission; custody confirmation and network
|
|
56
|
+
latency consume part of that window. Check the live burn height and review deadline before
|
|
57
|
+
admission. A timeout does not extend the contract deadline, and no client can force an expired
|
|
58
|
+
review to be accepted.
|
|
59
|
+
|
|
60
|
+
The candidate waits up to 45 seconds for admission and 15 seconds for status reads. Custom
|
|
61
|
+
proxies must accommodate admission's paced chain checks with a bounded timeout within the
|
|
62
|
+
client's budget; a shorter proxy timeout still causes failure. The response remains size-limited.
|
|
63
|
+
Quota errors require operator capacity review, not repeated requests. Eligibility errors require
|
|
64
|
+
checking the actual job and deadline. Transport/service errors require status reconciliation:
|
|
65
|
+
the request may already have been persisted. No automatic retries or budget increases occur.
|
|
66
|
+
|
|
67
|
+
Append `--enable-qa-evaluation` to provider MCP arguments after the custody socket/permit
|
|
68
|
+
configuration. If Hermes uses tool filtering, add the exact names `nayori_request_evaluation`
|
|
69
|
+
and `nayori_evaluation_status`. Without this operator flag the tools are absent.
|
|
70
|
+
|
|
71
|
+
Call `nayori_request_evaluation` with the same asset, jobId, description, acceptanceCriteria
|
|
72
|
+
and evidence used for commitments. It checks the permitted job, confirmed submission and
|
|
73
|
+
on-chain identities/budget/commitments, then uses the deterministic job-scoped evaluation ID.
|
|
74
|
+
It sends no bearer token, wallet key or additional payment. The evaluator independently checks
|
|
75
|
+
eligibility and evidence bytes; no agent can approve itself through this endpoint.
|
|
76
|
+
|
|
77
|
+
If a response times out, call `nayori_evaluation_status` with asset and jobId before retrying.
|
|
78
|
+
Do not change the evidence or create another job to bypass a failed review. Admission is not
|
|
79
|
+
approval; evaluator `confirmed` is not proof that escrow has been paid out.
|
|
80
|
+
|
|
81
|
+
## 4. Verify outcome and payment
|
|
82
|
+
|
|
83
|
+
Read the decision and explanation through the public evaluation/chain evidence surfaces. The
|
|
84
|
+
buyer finalizes after the real appeal deadline when no appeal exists. This provider pilot does
|
|
85
|
+
not expose finalize, appeal or admin actions. If a rejection needs appeal, involve the operator
|
|
86
|
+
and supported app/SDK appeal workflow; do not claim the restricted MCP handles it automatically.
|
|
87
|
+
|
|
88
|
+
Check the terminal job, escrow zero, exact payout to your wallet, treasury fee and reputation.
|
|
89
|
+
For approved 1000 sBTC units and 200 bps, net payment is 980 and treasury receives 20. The
|
|
90
|
+
fee remains within escrow until settlement. Do not infer success from an HTTP 202 or txid alone.
|
|
91
|
+
|
|
92
|
+
## 5. Recording and current boundaries
|
|
93
|
+
|
|
94
|
+
Record the same job from the provider's perspective: installation, external wallet setup
|
|
95
|
+
without showing secrets, registration, assignment check, actual work, evidence, submission,
|
|
96
|
+
evaluation status and payment. Show public transaction links and label waiting-period edits.
|
|
97
|
+
The x402 resource-purchase walkthrough is a separate pending integration; do not describe
|
|
98
|
+
evaluation admission as an x402 payment. Our internal controlled agents are not external adoption.
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
# 0.8.0-rc.1 — QA release candidate
|
|
2
|
+
|
|
3
|
+
**Prepared source candidate, not published.** Stable npm remains `@perkos/agent-sdk@0.7.1`.
|
|
4
|
+
This prerelease packages reviewed QA features for explicit operator testing; it is not a
|
|
5
|
+
production promotion or a certification of autonomous operation for every developer.
|
|
6
|
+
|
|
7
|
+
## Included
|
|
8
|
+
|
|
9
|
+
- Node-only Hermes-compatible MCP read/prepare tools and optional Linux custody delegation.
|
|
10
|
+
- Operator-owned keys, isolated signer identities, immutable permits, bounded budgets and
|
|
11
|
+
durable intent/nonce/txid recovery. Signing remains disabled by default; the pilot is testnet-only.
|
|
12
|
+
- Provider-only, job-bound evaluation admission and status with bounded timeouts, sanitized
|
|
13
|
+
errors and deterministic-ID reconciliation. No automatic retries or x402 purchases in this adapter.
|
|
14
|
+
- Opt-in STX v6/sBTC v5 fee methods, consent and accounting; default v5/v4 contracts are unchanged.
|
|
15
|
+
- Versioned criteria/evidence commitments, absent-reputation handling, role-separated examples
|
|
16
|
+
and buyer/provider manuals. Developers retain their own agent and LLM configuration.
|
|
17
|
+
|
|
18
|
+
See [verified scope](VALIDATION_AND_RELEASE.md). The earlier internal sBTC lifecycle used
|
|
19
|
+
source `fc0537477fda819fa9cce8e74e543be0d49ea3a4`, not this versioned artifact. Packaging
|
|
20
|
+
checks do not establish a new funded E2E, fresh registration, external adoption or security audit.
|
|
21
|
+
|
|
22
|
+
## Install the reviewed artifact before publication
|
|
23
|
+
|
|
24
|
+
In a clean checkout of the reviewed candidate commit, use Node 20+ and npm 10+:
|
|
25
|
+
|
|
26
|
+
```sh
|
|
27
|
+
npm ci
|
|
28
|
+
npm run verify
|
|
29
|
+
npm pack --pack-destination /absolute/private-artifacts
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
Create a separate, empty consumer directory and initialize its own package.json:
|
|
33
|
+
|
|
34
|
+
```sh
|
|
35
|
+
npm init -y
|
|
36
|
+
npm install --save-exact /absolute/private-artifacts/perkos-agent-sdk-0.8.0-rc.1.tgz
|
|
37
|
+
./node_modules/.bin/nayori-mcp --help
|
|
38
|
+
./node_modules/.bin/nayori-custody --help
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
Check the exact package version, import and transaction-plan construction without a signer.
|
|
42
|
+
Record source commit, tarball integrity and contents. No private key is needed to install or
|
|
43
|
+
prepare a plan. Running custody signing requires separate Linux isolation, permissions and
|
|
44
|
+
budget setup; never put keys into MCP, prompts or model tools.
|
|
45
|
+
|
|
46
|
+
## Release gates
|
|
47
|
+
|
|
48
|
+
1. Review and merge the QA release PR; build from the exact reviewed commit with a clean tree.
|
|
49
|
+
2. Verify SDK tests, package allowlist, absence of secrets, dependency audit and isolated consumer.
|
|
50
|
+
3. Obtain publication approval. Use the prerelease `next` tag, never move `latest` implicitly.
|
|
51
|
+
`publishConfig.tag` is `next`; do not override it to `latest` for this candidate.
|
|
52
|
+
4. Verify registry version/integrity and that `latest` remains 0.7.1. Repeat isolated installation
|
|
53
|
+
from the exact published version, not an unpinned tag or financial `npx -y` command.
|
|
54
|
+
5. Validate both role walkthroughs before recording the developer demo. New funded tests require
|
|
55
|
+
a fresh reviewed budget; never reuse the completed QA job's authorization.
|
|
56
|
+
|
|
57
|
+
Only after publication is confirmed should registry installation use
|
|
58
|
+
`npm install --save-exact @perkos/agent-sdk@0.8.0-rc.1`.
|
|
59
|
+
QA merge, npm publication, hosted documentation deployment and production promotion are
|
|
60
|
+
separate events. x402/MPP resource purchases remain a separate workflow and test scope.
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
# Earned service fee integration (unreleased)
|
|
2
|
+
|
|
3
|
+
This source branch adds opt-in support for `agentic-commerce-v6` (STX) and
|
|
4
|
+
`sbtc-commerce-v5` (sBTC). These are **simnet candidates, not deployed defaults**.
|
|
5
|
+
The published `@perkos/agent-sdk@0.7.1` does not contain these new methods.
|
|
6
|
+
Do not point a production client at candidate names or treat a successful build as a deployment.
|
|
7
|
+
Existing v5/v4 jobs retain their full-budget, no-service-fee terms.
|
|
8
|
+
|
|
9
|
+
## Payment lifecycle
|
|
10
|
+
|
|
11
|
+
Funding locks the **gross** budget, including the potential 2% fee. Nothing is paid to
|
|
12
|
+
treasury at funding, submission, decision recording or appeal filing. Final evaluated
|
|
13
|
+
settlement atomically sends `floor(gross / 50)` to the job-pinned treasury and the remainder
|
|
14
|
+
to the provider on approval **or back to the client on rejection**. Both transfers use the
|
|
15
|
+
escrow asset. The settled escrow balance is zero.
|
|
16
|
+
|
|
17
|
+
No evaluation (expiry/review timeout) means no service fee. An evidence-backed waiver
|
|
18
|
+
before settlement also results in zero fee. Gas is separate, paid in STX. Optional extra
|
|
19
|
+
analysis would require a separately accepted x402 quote; that service is not implemented
|
|
20
|
+
and there is no automatic second 2% or payment prerequisite for filing an appeal.
|
|
21
|
+
|
|
22
|
+
## Read first, accept explicitly
|
|
23
|
+
|
|
24
|
+
After the exact candidate sources have been deployed and verified in isolated testnet,
|
|
25
|
+
configure their explicit same-network contract IDs in `PerkOSClient`. Do not guess a treasury:
|
|
26
|
+
read `getServiceFeePolicy(asset)` and `getJobServiceFee(asset, jobId)`.
|
|
27
|
+
|
|
28
|
+
```ts
|
|
29
|
+
// Uses the UNRELEASED source build, not npm 0.7.1.
|
|
30
|
+
// nayori is a client configured with reviewed contracts and a policy-limited signer.
|
|
31
|
+
const job = await nayori.getJob("sbtc", jobId);
|
|
32
|
+
if (!job) throw new Error("Job not found");
|
|
33
|
+
const policy = await nayori.getServiceFeePolicy("sbtc");
|
|
34
|
+
const fees = await nayori.getJobServiceFee("sbtc", jobId);
|
|
35
|
+
|
|
36
|
+
// Present gross, potential fee, net approval/net rejection, treasury and gas
|
|
37
|
+
// to the operator (or an approved deterministic agent spending policy).
|
|
38
|
+
// This object represents actual acceptance, not permission granted by this example.
|
|
39
|
+
const serviceFeeAcceptance = {
|
|
40
|
+
gross: job.budget,
|
|
41
|
+
basisPoints: 200 as const,
|
|
42
|
+
treasury: fees.treasury,
|
|
43
|
+
rejectionRefund: "net-after-evaluation" as const,
|
|
44
|
+
};
|
|
45
|
+
|
|
46
|
+
// Only after acceptance, with the CLIENT signer:
|
|
47
|
+
const broadcast = await nayori.fundJob({
|
|
48
|
+
asset: "sbtc", jobId, amount: job.budget, serviceFeeAcceptance,
|
|
49
|
+
});
|
|
50
|
+
const confirmation = await nayori.confirm(broadcast);
|
|
51
|
+
if (confirmation.status !== "success") throw new Error("Funding not confirmed");
|
|
52
|
+
|
|
53
|
+
// The PROVIDER uses a separate client/signer and independently accepts the live
|
|
54
|
+
// budget/fee before submitWork({ asset, jobId, deliverable, serviceFeeAcceptance }).
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
`quoteServiceFee(gross)` performs exact uint128-safe bigint arithmetic but is only a local
|
|
58
|
+
quote. It does not prove a deployment, initialization, actual fee charge or refund.
|
|
59
|
+
Amounts below 50 atomic units round down to zero fee; no minimum job price is introduced.
|
|
60
|
+
See [`examples/service-fees.ts`](../examples/service-fees.ts) for a signer-free report helper.
|
|
61
|
+
|
|
62
|
+
## Methods and role boundaries
|
|
63
|
+
|
|
64
|
+
| Method | Behavior |
|
|
65
|
+
| --- | --- |
|
|
66
|
+
| `supportsServiceFees(asset)` | Known ABI capability, not verification of contract authenticity |
|
|
67
|
+
| `getServiceFeePolicy(asset)` | Validates initialization fields, fixed 200 bps, network-specific windows and treasury separation |
|
|
68
|
+
| `getJobServiceFee(asset, jobId)` | Validates ledger against the job, budget, roles and pinned treasury; read failures propagate |
|
|
69
|
+
| `fundJob(input)` | Requires accepted gross/bps/treasury/net-refund terms matching live state before wallet access |
|
|
70
|
+
| `submitWork(input)` | Requires the provider's matching acceptance before wallet access |
|
|
71
|
+
| `finalizeDecision`, `resolveAppeal`, `settleAppealTimeout` | Derive gross and split from live state; sBTC uses the job-pinned token |
|
|
72
|
+
| `initializeServiceFeeProtocol(input)` | Owner-signed, explicit treasury/authority; SDK requires testnet 3 or mainnet 144 appeal burn blocks |
|
|
73
|
+
| `waiveServiceFee(input)` | Job-pinned authority signs a nonzero 32-byte evidence hash; records an irreversible waiver |
|
|
74
|
+
| `refundServiceFee(asset, jobId)` | Treasury signs a real outstanding-fee return from its own balance; spending limits apply |
|
|
75
|
+
|
|
76
|
+
Only standard wallet principals can execute these signer-based administrative methods. A contract
|
|
77
|
+
principal treasury would require its own reviewed governance caller, not a forged wallet signer.
|
|
78
|
+
The authority decides whether evidence establishes platform fault; a changed appeal outcome alone
|
|
79
|
+
does not automatically waive a fee. The SDK does not make that decision for an operator.
|
|
80
|
+
|
|
81
|
+
## Accounting is not a quote
|
|
82
|
+
|
|
83
|
+
- `feeAmount` is the potential budget quote, never collected revenue.
|
|
84
|
+
- No `settlement`: no earned fee has been collected.
|
|
85
|
+
- `settlement.chargedFee - settlement.refundedFee`: fee retained after actual returns.
|
|
86
|
+
- `settlement.net + settlement.refundedFee`: total delivered to the economic recipient.
|
|
87
|
+
- Waiver plus an outstanding charged fee: a refund obligation, **not a completed refund**.
|
|
88
|
+
|
|
89
|
+
A treasury without funds or an available signer cannot complete a refund. Maintain refund
|
|
90
|
+
reserves and an operational process before launch. Replay attempts are rejected by the contract.
|
|
91
|
+
Internal test-wallet transactions are not externally earned revenue or adoption.
|
|
92
|
+
|
|
93
|
+
## Post-conditions and trust
|
|
94
|
+
|
|
95
|
+
Decision settlements use one exact **gross escrow outflow** post-condition per asset, not separate
|
|
96
|
+
net/fee conditions on the same sender. Treasury refunds instead constrain the treasury's exact
|
|
97
|
+
fee outflow. Deny mode is retained. Post-conditions constrain aggregate outflow, not recipients;
|
|
98
|
+
verify contract sources and canonical transfer events independently after confirmation.
|
|
99
|
+
|
|
100
|
+
`plan.intent.serviceFee` is disclosure metadata, not a signed enforcement mechanism. Synchronous
|
|
101
|
+
builders cannot read the chain: their caller must supply already-verified state, token and split.
|
|
102
|
+
Prefer high-level client methods. Neither `execute` nor a custom RPC can establish the authenticity
|
|
103
|
+
of an arbitrary caller-selected contract. Custody allowlists and source verification remain required.
|
|
104
|
+
Funding/refund session limits count broadcasts conservatively, not final revenue.
|
|
105
|
+
|
|
106
|
+
Direct x402/MPP single-transfer verification is unchanged and must not be relaxed for escrow splits.
|
|
107
|
+
|
|
108
|
+
Reference: [Stacks post-conditions](https://docs.stacks.co/post-conditions/examples).
|