@agenttrust-sdk/mcp 0.2.6 → 0.3.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.
Files changed (49) hide show
  1. package/dist/embedded-data/devnet-smoke.json +4 -4
  2. package/dist/embedded-docs/architecture.mdx +174 -0
  3. package/dist/embedded-docs/getting-started/quickstart.mdx +79 -56
  4. package/dist/embedded-docs/index.mdx +54 -37
  5. package/dist/embedded-docs/integration-guides/capability-namespaces.mdx +135 -8
  6. package/dist/embedded-docs/integration-guides/custom-attestor.mdx +169 -8
  7. package/dist/embedded-docs/integration-guides/dexter-adapter.mdx +76 -0
  8. package/dist/embedded-docs/integration-guides/facilitator-adapters.mdx +85 -41
  9. package/dist/embedded-docs/integration-guides/pay-sh-adapter.mdx +90 -54
  10. package/dist/embedded-docs/integration-guides/x402-facilitator.mdx +55 -24
  11. package/dist/embedded-docs/mcp/hosted-endpoint.mdx +197 -0
  12. package/dist/embedded-docs/mcp/index.mdx +108 -0
  13. package/dist/embedded-docs/mcp/install.mdx +183 -0
  14. package/dist/embedded-docs/mcp/prompts.mdx +90 -0
  15. package/dist/embedded-docs/mcp/resources.mdx +115 -0
  16. package/dist/embedded-docs/mcp/tools.mdx +156 -0
  17. package/dist/embedded-docs/programs/policy-vault/composer.mdx +117 -0
  18. package/dist/embedded-docs/programs/policy-vault/counterparty-tier-policy.mdx +81 -9
  19. package/dist/embedded-docs/programs/policy-vault/index.mdx +77 -47
  20. package/dist/embedded-docs/programs/policy-vault/kill-switch-policy.mdx +65 -8
  21. package/dist/embedded-docs/programs/policy-vault/require-validation-policy.mdx +76 -8
  22. package/dist/embedded-docs/programs/policy-vault/spending-policy.mdx +83 -8
  23. package/dist/embedded-docs/programs/policy-vault/velocity-policy.mdx +85 -8
  24. package/dist/embedded-docs/programs/trustgate.mdx +112 -30
  25. package/dist/embedded-docs/programs/validation-registry.mdx +139 -32
  26. package/dist/embedded-docs/reference/byte-offset-reference.mdx +102 -13
  27. package/dist/embedded-docs/reference/capability-namespaces.mdx +56 -0
  28. package/dist/embedded-docs/reference/changelog.mdx +230 -13
  29. package/dist/embedded-docs/reference/deny-reason-codes.mdx +86 -0
  30. package/dist/embedded-docs/reference/devnet-program-ids.mdx +50 -8
  31. package/dist/embedded-docs/reference/discriminator-constants.mdx +104 -10
  32. package/dist/embedded-docs/reference/mainnet-program-ids.mdx +89 -5
  33. package/dist/embedded-docs/reference/quantu-agent-registry.mdx +104 -9
  34. package/dist/embedded-docs/sdk/exports-reference.mdx +239 -0
  35. package/dist/embedded-docs/sdk/gate-payment.mdx +99 -14
  36. package/dist/embedded-docs/sdk/index.mdx +141 -40
  37. package/dist/embedded-docs/sdk/mount-trustgate.mdx +178 -8
  38. package/dist/embedded-docs/verification/adversarial-harness.mdx +88 -0
  39. package/dist/embedded-docs/verification/atomic-tx-invariant.mdx +141 -0
  40. package/dist/embedded-docs/verification/chained-validation.mdx +87 -0
  41. package/dist/embedded-docs/verification/devnet-smoke.mdx +85 -0
  42. package/dist/embedded-docs/verification/index.mdx +31 -0
  43. package/dist/embedded-docs/verification/kani-proofs.mdx +144 -0
  44. package/dist/embedded-docs/verification/live-evidence.mdx +180 -0
  45. package/dist/tools/write/emit-feedback.d.ts +6 -0
  46. package/dist/tools/write/emit-feedback.js +12 -1
  47. package/dist/tools/write/emit-feedback.js.map +1 -1
  48. package/package.json +16 -15
  49. package/scripts/install-claude-desktop.sh +0 -0
@@ -1,19 +1,236 @@
1
1
  ---
2
2
  title: Changelog
3
- description: Documentation-facing release notes for the Frontier build.
3
+ description: Release notes for @agenttrust-sdk/trustgate and @agenttrust-sdk/mcp — auto-generated from each package's CHANGELOG.md.
4
4
  ---
5
5
 
6
- `In progress`
6
+ The published packages keep their own `CHANGELOG.md` (Keep-a-Changelog format) under [`trustgate/sdk/`](https://github.com/agenttrust-labs/agenttrust/blob/main/trustgate/sdk/CHANGELOG.md) and [`mcp/`](https://github.com/agenttrust-labs/agenttrust/blob/main/mcp/CHANGELOG.md). This page is built from those files at lint time so the docs never drift.
7
7
 
8
- | Date | Change |
9
- | --- | --- |
10
- | 2026-05-06 | Pay.sh adapter layer documented with SERVICE-signed challenges and proof validation. |
11
- | 2026-05-06 | `examples/pay-sh-demo` added as the Pay.sh + AgentTrust x402 walkthrough. |
12
- | 2026-05-06 | FacilitatorAdapter contract added for Pay.sh today and Dexter / atxp_ai / MCPay roadmap adapters. |
13
- | 2026-05-06 | Atomic settlement narrative updated: policy check, SPL transfer, and feedback stay tied to one settlement path. |
14
- | 2026-05-02 | PolicyVault composer and all five policies completed. |
15
- | 2026-05-02 | Five Kani invariants proved green in CI. |
16
- | 2026-05-02 | TrustGate Anchor program and Express x402 service shipped. |
17
- | 2026-05-02 | `@agenttrust-sdk/trustgate@0.1.0` published. |
8
+ Phase reports (Phase F → Phase Q) live separately under [`docs/proofs/`](https://github.com/agenttrust-labs/agenttrust/tree/main/docs/proofs); the [Live evidence](/verification/live-evidence) page indexes them.
18
9
 
19
- Source: [`execution.md`](https://github.com/agenttrust-labs/agenttrust/blob/main/execution.md)
10
+ {/* BEGIN AUTO-GEN: changelog */}
11
+
12
+ > Auto-generated from upstream package `CHANGELOG.md` files at build time.
13
+ > If you spot drift, the `mcp/` and `trustgate/sdk/` sources are authoritative.
14
+
15
+ ## @agenttrust-sdk/trustgate
16
+
17
+ Source of truth: [`trustgate/sdk/CHANGELOG.md`](https://github.com/agenttrust-labs/agenttrust/blob/main/trustgate/sdk/CHANGELOG.md).
18
+
19
+ ### [Unreleased]
20
+
21
+ ### [0.2.0] — 2026-05-07
22
+
23
+ Tag: [`sdk-v0.2.0`](https://github.com/agenttrust-labs/agenttrust/releases/tag/sdk-v0.2.0)
24
+ · Commit: `00ca222`
25
+
26
+ #### Changed (breaking)
27
+
28
+ - `ProgramIds.trustgate` renamed to `ProgramIds.trustGate` (camelCase,
29
+ matches `policyVault`). Same value (the deployed-devnet trustgate
30
+ program ID) — only the field name changed. One-line consumer
31
+ migration: `.trustgate` → `.trustGate`.
32
+
33
+ #### Added
34
+
35
+ - `ProgramIds.validationRegistry` — populated by default with the
36
+ deployed-devnet validation-registry program ID
37
+ `Cx4RFa6ysw3qXYhugPkF8pFSWBkmKq59h2dWgF2tKhtv`. Previously consumers
38
+ had to import `VALIDATION_REGISTRY_DEVNET_ID` separately; that import
39
+ still works but `DEFAULT_DEVNET_PROGRAM_IDS.validationRegistry` is the
40
+ preferred entry point.
41
+
42
+ ### [0.1.1] — 2026-05-04
43
+
44
+ Tag: [`sdk-v0.1.1`](https://github.com/agenttrust-labs/agenttrust/releases/tag/sdk-v0.1.1)
45
+ · Commit: `64fe14d`
46
+
47
+ #### Changed
48
+
49
+ - Metadata refresh after the org rebrand to
50
+ [`agenttrust-labs`](https://github.com/agenttrust-labs). `homepage`,
51
+ `repository`, and `bugs` URLs now point at the new repo. No code
52
+ changes.
53
+
54
+ ### [0.1.0] — 2026-05-02
55
+
56
+ Tag: [`sdk-v0.1.0`](https://github.com/agenttrust-labs/agenttrust/releases/tag/sdk-v0.1.0)
57
+ · Commit: `29f9961`
58
+
59
+ #### Added
60
+
61
+ - Initial publish of the TrustGate SDK as a drop-in middleware for x402
62
+ facilitators on Solana.
63
+ - Express middleware: `mountTrustGate(app, …)` adds `POST /verify`,
64
+ `POST /settle`, `POST /dispute`, `GET /receipt/:hash`.
65
+ - Client helpers: `gatePayment`, `settle`, `dispute`.
66
+ - Atomic-tx invariant: `AtomicityEnforced` literal-true marker +
67
+ `assertAtomicityEnforced` runtime guard + `composeAtomicSettleTx`
68
+ that bundles `gate_payment_strict + SPL transferChecked +
69
+ emit_feedback` into one Solana transaction.
70
+ - ValidationRegistry surface: `register_namespace` / `register_attestor`
71
+ / `request_validation` / `respond_to_validation` / `revoke_validation`
72
+ instruction builders + PDA derivers + read fetchers.
73
+ - PolicyVault surface: `simulateGatePayment`, `parseGateDecision`, all
74
+ PDA derivers (`derivePolicyPda`, `deriveVelocityPda`,
75
+ `deriveKillSwitchPda`, `deriveFeedbackLogPda`,
76
+ `deriveTrustGateAuthorityPda`).
77
+ - Quantu helpers: `deriveAgentAccountPda`, `deriveAtomStatsPda`,
78
+ `deriveQuantuFeedbackAccounts`, `DEFAULT_DEVNET_QUANTU_IDS`,
79
+ `MAINNET_QUANTU_IDS`.
80
+ - Production factories: `makeValidateOnChainTx`, `makeEmitFeedbackCpi`,
81
+ `makePriorEmissionLookup`.
82
+
83
+ ## @agenttrust-sdk/mcp
84
+
85
+ Source of truth: [`mcp/CHANGELOG.md`](https://github.com/agenttrust-labs/agenttrust/blob/main/mcp/CHANGELOG.md).
86
+
87
+ ### [Unreleased]
88
+
89
+ #### Planned
90
+
91
+ - `agenttrust_lookup_feedback_by_tx({ tx_signature })` — resolve a Solana
92
+ transaction signature to its `emit_feedback` payment_id_hash by parsing
93
+ the tx's inner instructions. Useful when an integrator has the settle
94
+ signature but not the digest. Targeted for v0.3.0.
95
+
96
+ ### [0.2.6] — 2026-05-08
97
+
98
+ Tag: `mcp-v0.2.6` · Phase Q1 — fixes the only data-correctness bug Phase P uncovered. The MCP catalog now produces correct on-chain values for every tool that returns data.
99
+
100
+ #### Fixed
101
+
102
+ - `agenttrust_get_quantu_reputation` was reading Quantu `AtomStats` at fabricated byte offsets (`40 / 41 / 49 / 50 / 51`) and returning bogus values — Phase P E2E showed `tier: 164` for an actually-tier-0 agent, plus a u64-max-ish `feedbackCount` that was junk re-interpretation of the asset-pubkey region. The PDA address, owner, and account size were correct; only the field decoding was wrong.
103
+
104
+ 0.2.6 mirrors the canonical offsets from `programs/policy-vault/src/ext/atom_engine.rs` verbatim:
105
+
106
+ | offset | width | field |
107
+ |-------:|------:|------------------|
108
+ | 549 | u8 | `risk_score` |
109
+ | 551 | u8 | `tier_immediate` |
110
+ | 555 | u8 | `tier_confirmed` |
111
+ | 557 | u16 LE | `confidence` |
112
+ | 560 | u8 | `schema_version` (canary, must equal 1) |
113
+
114
+ Adds the schema-version canary at byte 560 and the `tier ≤ ATOM_TIER_MAX = 4` range check the on-chain parser uses, so a future Quantu layout change fails loud rather than silently emitting garbage.
115
+
116
+ #### Changed (breaking, response shape)
117
+
118
+ - `agenttrust_get_quantu_reputation` response `reputation` block now contains:
119
+ - `tierImmediate` (number, 0..=4) — v1 fast-path tier; what `CounterpartyTier` reads in v1 demo mode
120
+ - `tierConfirmed` (number, 0..=4) — post-vesting tier; production policies prefer this
121
+ - `riskScore` (number, 0..=255 — lower is better)
122
+ - `confidence` (number, 0..=10_000 basis points)
123
+ - `schemaVersion` (number, always 1 in v1)
124
+ - Removed `feedbackCount` and `averageScore` — those fields were not in the canonical `AtomStats` struct; values were nonsense reinterpretations of unrelated bytes.
125
+ - Added an `error` field on the top-level response when the schema-version canary or size check fails — populated in place of `reputation`.
126
+
127
+ #### Tests
128
+
129
+ - `mcp/test/tools/read/get-quantu-reputation.test.ts` now asserts the canonical offsets match the on-chain Rust source exactly, plus 8 byte-level decode cases (zero-state, populated state, undersized buffer, schema-version mismatch, tier overflow on both fields, boundary case at `ATOM_TIER_MAX`, u16-LE confidence reads in the correct byte order).
130
+
131
+ ### [0.2.5] — 2026-05-08
132
+
133
+ Tag: `mcp-v0.2.5` · Phase O — description copy polish surfaced by the Phase N+ real-user UX pass.
134
+
135
+ #### Changed
136
+
137
+ - Tool descriptions no longer reference internal repo paths. `agenttrust_demo_state`, `agenttrust_docs`, and `agenttrust_emit_feedback`'s `base_collection` arg now read as standalone product copy without `examples/pay-sh-demo/...` / `docs-site/content/docs/...` leaks. Resource `name` fields under `agenttrust://examples/*` use human-readable labels ("pay-sh-demo README" instead of `examples/pay-sh-demo/README.md`).
138
+ - `agenttrust_emit_feedback.base_collection` description now points production integrators at their Quantu agent-registry collection address (the value passed to `agent_registry::register_agent`), not just at demo state.
139
+ - `agenttrust_demo_state` error message — when the bundled snapshot is unreachable — drops the internal path and explains that the published package bundles it; only mentions `PAY_SH_DEMO_STATE_FILE` as the override hook.
140
+
141
+ No behaviour changes; tools/list output cleaner for Claude Desktop / Cursor / any LLM doing tool-routing from natural-language questions.
142
+
143
+ ### [0.2.4] — 2026-05-07
144
+
145
+ Tag: `mcp-v0.2.4` · UX-pass fix: real-user audit found `agenttrust_get_validation_attestation` requires a 64-char hex `capability_hash` while its sibling `agenttrust_request_validation` accepts the friendly `capability_name`. Real users / LLMs typically have the human-readable capability name; requiring the digest was a Claude-Desktop-level friction point.
146
+
147
+ #### Added
148
+
149
+ - `agenttrust_get_validation_attestation` now accepts either `capability_name` (preferred — the SDK computes SHA256(name)) or `capability_hash`. At least one is required; `capability_name` wins when both are passed. Mirrors the existing `agenttrust_request_validation` ergonomics.
150
+
151
+ ### [0.2.3] — 2026-05-07
152
+
153
+ Tag: `mcp-v0.2.3` · Path-resolution fix follow-up to 0.2.2.
154
+
155
+ #### Fixed
156
+
157
+ - 0.2.2 bundled the embedded-docs / embedded-examples assets correctly but the consumer `path.resolve(__dirname, "…")` had an off-by-one — `dist/tools/discovery/__dirname + "../../../embedded-docs"` resolved to `<package-root>/embedded-docs`, missing the `dist/` segment. Files were in the tarball but the loaders couldn't find them. Three relative paths corrected (discovery/docs.ts, discovery/facilitator-walkthrough.ts, resources/docs.ts). Fresh `npx` install now returns full corpus + walkthrough content.
158
+
159
+ ### [0.2.2] — 2026-05-07
160
+
161
+ Tag: `mcp-v0.2.2` · Phase N — Phase M E2E surfaced three bugs; this release closes all three plus the SERVER_VERSION fix that landed in 0.2.1.
162
+
163
+ #### Fixed
164
+
165
+ - `agenttrust_demo_state` no longer reports `available: false` on a fresh `npx` install. The build script now bundles the live devnet JSON snapshots (counterparties, demo-policies, smoke, attestor-trace, namespaces, chained-validation) into `dist/embedded-data/`. The tool prefers the bundled path; a local clone still wins the source-of-truth `examples/.../...json` lookup. (Phase M Bug #2)
166
+ - `agenttrust_docs` now returns ranked hits from the full MDX corpus (27 pages) on `npx` installs. The build script materialises `docs-site/content/docs/**/*.mdx` into `dist/embedded-docs/`; the doc loader prefers that directory and falls back to the live tree on a local clone. The `agenttrust://docs/*` resource scheme works the same way. (Phase M Bug #3)
167
+ - `agenttrust_facilitator_walkthrough` reads its source MDX + the trustgate facilitators README from `dist/embedded-docs/` first; no more "no walkthrough bundled" responses. (Phase M Bug #3)
168
+ - The `agenttrust://examples/*` resource scheme now reads from `dist/embedded-examples/` (READMEs + `src/*.ts` for both pay-sh-demo and attestor-demo). (Phase M Bug #3)
169
+ - HTTP transport now spins up one `Server` + `StreamableHTTPServerTransport` pair per `Mcp-Session-Id` instead of a singleton. Concurrent clients no longer interfere; second `initialize` no longer errors `-32600 Server already initialized`. Idle sessions evict after 30 minutes. (Phase M Bug #4)
170
+
171
+ #### Changed
172
+
173
+ - Build pipeline: `pnpm --filter ./mcp run build` now runs `tsc && node scripts/copy-embedded-assets.js`. The copy script prints a per-bucket count summary so regressions in the bundled set are visible at build time.
174
+
175
+ #### Note
176
+
177
+ The bundled `dist/embedded-docs/` is a **publish-time snapshot**. The live docs at `docs.agenttrust.tech` evolve independently — clients that need fresh docs should set `MCP_DOCS_DIR` to a checkout's `docs-site/content/docs/` directory, or use the hosted MCP at `mcp.agenttrust.tech` (redeployed on every `main` push).
178
+
179
+ ### [0.2.1] — 2026-05-07
180
+
181
+ Tag: `mcp-v0.2.1` · `simulate_payment` clearer error when no caller / KEYPAIR_B58 set.
182
+
183
+ #### Fixed
184
+
185
+ - `agenttrust_simulate_payment` returns an actionable error ("requires a funded fee-payer on devnet — pass `caller` or set `KEYPAIR_B58`") instead of cryptic `AccountNotFound` when neither input is provided. Phase M E2E driver verified the fix via stdio + HTTP.
186
+ - `serverInfo.version` now reads from `package.json` so MCP clients see the same version as `npm view`. Previously hardcoded to `0.1.0` — drifted across 0.1.0 → 0.2.0 → 0.2.1.
187
+
188
+ ### [0.2.0] — 2026-05-07
189
+
190
+ Tag: [`mcp-v0.2.0`](https://github.com/agenttrust-labs/agenttrust/releases/tag/mcp-v0.2.0)
191
+ · Commit: `00ca222`
192
+
193
+ #### Changed
194
+
195
+ - Re-pinned the `@agenttrust-sdk/trustgate` dep from `workspace:*` to
196
+ `workspace:^`, so the published tarball ranges to `^0.2.0` (matches
197
+ the SDK's own 0.2.0 bump). MCP code itself swept to the renamed
198
+ `programs.trustGate` field + the new `programs.validationRegistry`
199
+ field that the SDK 0.2.0 release added.
200
+ - `AgentTrustConfig.validationRegistryId` (top-level field) folded into
201
+ `AgentTrustConfig.programs.validationRegistry` — single source of
202
+ truth, matches the SDK's `ProgramIds` shape. The
203
+ `VALIDATION_REGISTRY_PROGRAM_ID` env override is unchanged.
204
+
205
+ No new tools, no protocol-conformance changes — every MCP tool surface
206
+ behaves identically to 0.1.0. 76 unit tests + 21 protocol-conformance
207
+ checks still green.
208
+
209
+ ### [0.1.0] — 2026-05-04
210
+
211
+ Tag: [`mcp-v0.1.0`](https://github.com/agenttrust-labs/agenttrust/releases/tag/mcp-v0.1.0)
212
+ · Commit: `66d4f04`
213
+
214
+ #### Added
215
+
216
+ - Initial publish of the AgentTrust MCP server. 18 tools across three
217
+ categories:
218
+ - **Read** (10): `get_policy`, `get_velocity_ledger`, `get_killswitch`,
219
+ `get_authority`, `get_feedback_log`, `get_capability_namespace`,
220
+ `get_attestor_profile`, `get_validation_request`,
221
+ `get_validation_attestation`, `simulate_gate_payment`.
222
+ - **Write** (5): `init_authority`, `init_killswitch`, `set_killswitch`,
223
+ `request_validation`, `respond_to_validation`, `emit_feedback`.
224
+ - **Discovery** (3): `list_facilitators`, `health`, plus an MCP
225
+ resource at `agenttrust://programs` exposing program IDs and
226
+ explorer URLs.
227
+ - Two transports: stdio (default; `npx -y @agenttrust-sdk/mcp`) and
228
+ HTTP (`MCP_TRANSPORT=http MCP_HTTP_PORT=8765`).
229
+ - Bundled IDLs for `policy_vault`, `trustgate`, `validation_registry`
230
+ so the server boots against a freshly-redeployed program before
231
+ `anchor idl init` lands.
232
+ - Optional signer via `KEYPAIR_B58` for write tools; read tools work
233
+ with no env beyond defaults.
234
+ - Network selection via `NETWORK=solana-devnet | solana-mainnet`.
235
+
236
+ {/* END AUTO-GEN: changelog */}
@@ -0,0 +1,86 @@
1
+ ---
2
+ title: DenyReason codes
3
+ description: All fifteen DenyReason discriminants the gate can return — code, name, originating policy, remediation hint.
4
+ ---
5
+
6
+ `DenyReason` is the enum returned in the `Deny` arm of `GateDecision`. The Borsh wire format follows declaration order, but clients consume the stable numeric `code()` instead — it is decoupled from Borsh field order.
7
+
8
+ ```rust
9
+ pub enum GateDecision {
10
+ Allow,
11
+ Deny(DenyReason),
12
+ RequireValidation([u8; 32]),
13
+ }
14
+ ```
15
+
16
+ Source: [`programs/policy-vault/src/state/decision.rs`](https://github.com/agenttrust-labs/agenttrust/blob/main/programs/policy-vault/src/state/decision.rs).
17
+
18
+ ## All fifteen codes
19
+
20
+ | Code | Variant | Originating policy | What triggered it | Remediation |
21
+ |---:|---|---|---|---|
22
+ | 1 | `KillSwitchEngaged` | [KillSwitch](/programs/policy-vault/kill-switch-policy) | Agent's `KillSwitchState.paused == true` | Multisig-call `set_killswitch(paused=false)` |
23
+ | 2 | `SpendingPerTxExceeded` | [Spending](/programs/policy-vault/spending-policy) | `amount > spending_per_tx_max` | Lower the amount or raise the per-tx cap |
24
+ | 3 | `SpendingDailyExceeded` | Spending | `today_used + amount > spending_daily_max` (UTC midnight rollover) | Wait for daily reset or raise the daily cap |
25
+ | 4 | `SpendingWeeklyExceeded` | Spending | `week_used + amount > spending_weekly_max` (ISO Monday rollover) | Wait for weekly reset or raise the weekly cap |
26
+ | 5 | `VelocityWindowExceeded` | [Velocity](/programs/policy-vault/velocity-policy) | `cumulative_amount + amount > velocity_max_in_window` (within sliding window) | Wait for window expiry (`window_secs × tier_decay × 2 slots/sec`) or raise the cap |
27
+ | 6 | `CounterpartyTierBelowMin` | [CounterpartyTier](/programs/policy-vault/counterparty-tier-policy) | Payee's `tier < min_counterparty_tier` (per `gate_mode`) | Build payee reputation via Quantu's `give_feedback`, or lower `min_tier`, or switch from `IMMEDIATE` to `CONFIRMED` |
28
+ | 7 | `CounterpartyRiskAboveMax` | CounterpartyTier | Payee's `risk_score > max_risk_score` (when constraint active) | Use a different payee or relax `max_risk_score` |
29
+ | 8 | `CounterpartyConfidenceBelow` | CounterpartyTier | Payee's `confidence < min_confidence` (basis points; when constraint active) | Wait for more reputation samples on the payee, or relax `min_confidence` |
30
+ | 9 | `AtomStatsWrongOwner` | CounterpartyTier (defensive) | Payee's `AtomStats` PDA is not owned by Quantu's `atom-engine` | Check the program ID; this is fail-loud against tampering or the wrong cluster |
31
+ | 10 | `AtomStatsSchemaMismatch` | CounterpartyTier (defensive) | Size mismatch (`!= 561`), schema-version canary (`byte 560 != 1`), OR tier byte > `ATOM_TIER_MAX = 4` | Quantu may have bumped its layout — check `bfb09ad` pin |
32
+ | 11 | `AttestationMissing` | [RequireValidation](/programs/policy-vault/require-validation-policy) | Attestation PDA's `subject_asset` or `capability_hash` doesn't match the expected values | Re-issue the attestation against the correct subject/capability |
33
+ | 12 | `AttestationExpired` | RequireValidation | `expires_at != 0 AND expires_at <= now_slot` | Refresh the attestation via `respond_to_validation` with a future `expires_at` |
34
+ | 13 | `AttestationRevoked` | RequireValidation | Attestation's `revoked == true` | Re-attest if appropriate, or use a different attestor |
35
+ | 14 | `AttestationAttestorRejected` | RequireValidation | Attestation issued by an attestor not in the policy's `accepted_attestors[]` | Use an attestor on the whitelist, or update the policy's whitelist |
36
+ | 15 | `UnratedTreatmentDeny` | CounterpartyTier (Unrated → Deny resolution) | Payee's `AtomStats` is uninitialised AND policy's `default_unrated_treatment == UNRATED_DENY` | Initialise the payee's `AtomStats` (typically by routing one feedback through them), or change the policy's `default_unrated_treatment` to `UNRATED_ALLOW` or `UNRATED_REQUIRE_VALIDATION` |
37
+
38
+ ## SDK consumption
39
+
40
+ ```ts
41
+ import type { GateDecision, DenyReasonCode } from "@agenttrust-sdk/trustgate";
42
+ import { denyReasonName } from "@agenttrust-sdk/trustgate";
43
+
44
+ const decision: GateDecision = await gatePayment(/* … */);
45
+
46
+ if (decision.kind === "Deny") {
47
+ // decision.reasonCode: DenyReasonCode (number, 1..=15)
48
+ // decision.reasonName: string (e.g., "CounterpartyTierBelowMin")
49
+ // Both populated automatically; reasonName == denyReasonName(reasonCode).
50
+ }
51
+ ```
52
+
53
+ The decision union is documented in [SDK → gatePayment](/sdk/gate-payment).
54
+
55
+ ## x402 response shape
56
+
57
+ For a `Deny`, the SDK's `mountTrustGate` middleware emits:
58
+
59
+ ```http
60
+ HTTP/1.1 402 Payment Required
61
+ X-Agent-Trust-Decision: Deny
62
+ X-Payment-Required: denied
63
+ X-Payment-Reason-Code: 6
64
+ X-Payment-Reason-Name: CounterpartyTierBelowMin
65
+ X-Payment-Network: solana-devnet
66
+ ```
67
+
68
+ Headers are built via `buildHeadersForDecision` in [`trustgate/sdk/src/x402.ts`](https://github.com/agenttrust-labs/agenttrust/blob/main/trustgate/sdk/src/x402.ts).
69
+
70
+ ## MCP tool
71
+
72
+ The MCP server exposes `agenttrust_explain_decision({ reason_code })` — translates `1..15` into the canonical name + remediation hint. Same data as this page, but tool-shaped for LLM consumption: [MCP → Tools](/mcp/tools#agenttrust_explain_decision).
73
+
74
+ ## Read next
75
+
76
+ <Cards>
77
+ <Card title="Composer" href="/programs/policy-vault/composer">
78
+ The fail-fast order that determines which reason code surfaces.
79
+ </Card>
80
+ <Card title="gatePayment" href="/sdk/gate-payment">
81
+ The SDK call that returns the decision union.
82
+ </Card>
83
+ <Card title="Adversarial harness" href="/verification/adversarial-harness">
84
+ Hostile-scenario tests asserting each defensive reason code.
85
+ </Card>
86
+ </Cards>
@@ -1,9 +1,9 @@
1
1
  ---
2
2
  title: Devnet program IDs
3
- description: Current AgentTrust devnet deployment addresses.
3
+ description: Deployed AgentTrust program addresses on Solana devnet, with Explorer links and Anchor IDL fetch instructions.
4
4
  ---
5
5
 
6
- These are the pinned devnet program IDs for the Frontier build.
6
+ The pinned devnet deployment of the three AgentTrust programs. The SDK ships these as `DEFAULT_DEVNET_PROGRAM_IDS`.
7
7
 
8
8
  <ProgramIdsTable />
9
9
 
@@ -11,14 +11,56 @@ These are the pinned devnet program IDs for the Frontier build.
11
11
 
12
12
  ```ts
13
13
  import { DEFAULT_DEVNET_PROGRAM_IDS } from "@agenttrust-sdk/trustgate";
14
+
15
+ DEFAULT_DEVNET_PROGRAM_IDS.policyVault; // PublicKey
16
+ DEFAULT_DEVNET_PROGRAM_IDS.trustGate; // PublicKey (camelCase as of 0.2.0)
17
+ DEFAULT_DEVNET_PROGRAM_IDS.validationRegistry; // PublicKey (new in 0.2.0)
14
18
  ```
15
19
 
16
- The SDK currently exposes PolicyVault and TrustGate by default. ValidationRegistry is read by PolicyVault through its account parser and is listed here for deploy verification.
20
+ Note: as of SDK 0.2.0, `ProgramIds.trustgate` (lowercase) was renamed to `ProgramIds.trustGate` (camelCase) to match `policyVault`. The new `validationRegistry` field is populated by default. Migration: search-and-replace `.trustgate` `.trustGate`. See [Reference → Changelog](/reference/changelog).
17
21
 
18
22
  ## Anchor declarations
19
23
 
20
- | Program | Source |
21
- | --- | --- |
22
- | `policy_vault` | `programs/policy-vault/src/lib.rs` |
23
- | `trustgate` | `programs/trustgate/src/lib.rs` |
24
- | `validation_registry` | `programs/validation-registry/src/lib.rs` |
24
+ | Program | Source | Devnet ID |
25
+ |---|---|---|
26
+ | `policy_vault` | [`programs/policy-vault/src/lib.rs`](https://github.com/agenttrust-labs/agenttrust/blob/main/programs/policy-vault/src/lib.rs) | `8Y6fGeNEHgmWmbt8JsRcF72jxbeBfJhomMjG6SuoJQTR` |
27
+ | `trustgate` | [`programs/trustgate/src/lib.rs`](https://github.com/agenttrust-labs/agenttrust/blob/main/programs/trustgate/src/lib.rs) | `HF8zHfoyA7b5mhLViopTnRMprc6ZT5KActHTdkFrih2N` |
28
+ | `validation_registry` | [`programs/validation-registry/src/lib.rs`](https://github.com/agenttrust-labs/agenttrust/blob/main/programs/validation-registry/src/lib.rs) | `Cx4RFa6ysw3qXYhugPkF8pFSWBkmKq59h2dWgF2tKhtv` |
29
+
30
+ ## Verify executable status
31
+
32
+ ```bash
33
+ for p in 8Y6fGeNEHgmWmbt8JsRcF72jxbeBfJhomMjG6SuoJQTR \
34
+ HF8zHfoyA7b5mhLViopTnRMprc6ZT5KActHTdkFrih2N \
35
+ Cx4RFa6ysw3qXYhugPkF8pFSWBkmKq59h2dWgF2tKhtv; do
36
+ solana program show "$p" --url devnet | grep Executable
37
+ done
38
+ ```
39
+
40
+ ## Fetch IDLs
41
+
42
+ All three Anchor IDLs are published on devnet:
43
+
44
+ ```bash
45
+ anchor idl fetch 8Y6fGeNEHgmWmbt8JsRcF72jxbeBfJhomMjG6SuoJQTR --provider.cluster devnet # policy_vault
46
+ anchor idl fetch HF8zHfoyA7b5mhLViopTnRMprc6ZT5KActHTdkFrih2N --provider.cluster devnet # trustgate
47
+ anchor idl fetch Cx4RFa6ysw3qXYhugPkF8pFSWBkmKq59h2dWgF2tKhtv --provider.cluster devnet # validation_registry
48
+ ```
49
+
50
+ The SDK's `loadPolicyVault` / `loadTrustGate` / `loadValidationRegistry` fetch the IDL from chain by default. Pass an explicit `idl` argument to use a bundled snapshot — useful for latency-sensitive paths or freshly-redeployed programs.
51
+
52
+ Latest evidence snapshot (SHA-256 hashes + instruction counts): [`docs/proofs/idl-on-chain.json`](https://github.com/agenttrust-labs/agenttrust/blob/main/docs/proofs/idl-on-chain.json).
53
+
54
+ ## Read next
55
+
56
+ <Cards>
57
+ <Card title="Mainnet program IDs" href="/reference/mainnet-program-ids">
58
+ Quantu's pinned mainnet IDs that PolicyVault reads from.
59
+ </Card>
60
+ <Card title="Discriminator constants" href="/reference/discriminator-constants">
61
+ PDA seed prefixes + give_feedback discriminator.
62
+ </Card>
63
+ <Card title="Live evidence" href="/verification/live-evidence">
64
+ Every load-bearing claim with an Explorer URL.
65
+ </Card>
66
+ </Cards>
@@ -1,16 +1,110 @@
1
1
  ---
2
2
  title: Discriminator constants
3
- description: Pinned instruction and account constants used across AgentTrust.
3
+ description: Pinned instruction discriminators, PDA seed prefixes, and account size canaries used across AgentTrust.
4
4
  ---
5
5
 
6
- `In progress`
6
+ The constants below are the load-bearing discriminators and seeds AgentTrust depends on. Anything that drifts here breaks downstream tooling.
7
7
 
8
- | Constant | Value |
9
- | --- | --- |
10
- | Quantu `give_feedback` discriminator | `[145, 136, 123, 3, 215, 165, 98, 41]` |
11
- | TrustGate authority seed | `trustgate_auth` |
12
- | Feedback log seed | `feedback_log` |
13
- | Capability namespace seed | `capability` |
14
- | Validation attestation parser size | `290` bytes |
8
+ ## Quantu CPI discriminator
15
9
 
16
- Sources: [`programs/trustgate/src/ext/agent_registry.rs`](https://github.com/agenttrust-labs/agenttrust/blob/main/programs/trustgate/src/ext/agent_registry.rs), [`programs/validation-registry/src/state`](https://github.com/agenttrust-labs/agenttrust/tree/main/programs/validation-registry/src/state)
10
+ | Value | Notes |
11
+ |---|---|
12
+ | `[145, 136, 123, 3, 215, 165, 98, 41]` | `agent_registry_8004::give_feedback` 8-byte instruction discriminator. TrustGate's `emit_feedback` and `dispute_payment` invoke this via `invoke_signed`. |
13
+
14
+ Source: [`programs/trustgate/src/ext/agent_registry.rs`](https://github.com/agenttrust-labs/agenttrust/blob/main/programs/trustgate/src/ext/agent_registry.rs). Pinned to Quantu commit `bfb09ad`.
15
+
16
+ ## AgentTrust PDA seed prefixes
17
+
18
+ | Program | Seed prefix | Seeds | What it identifies |
19
+ |---|---|---|---|
20
+ | `policy_vault` | `b"policy"` | `["policy", agent_asset, policy_id_le]` | `PolicyAccount` |
21
+ | `policy_vault` | `b"velocity"` | `["velocity", agent_asset, policy_id_le]` | `VelocityLedger` |
22
+ | `policy_vault` | `b"killswitch"` | `["killswitch", &[scope_kind], scope_key]` | `KillSwitchState` |
23
+ | `policy_vault` | `b"policy_authority"` | `["policy_authority", agent_asset]` | `PolicyAuthority` |
24
+ | `trustgate` | `b"trustgate_auth"` | `["trustgate_auth", facilitator]` | `TrustGateAuthority` |
25
+ | `trustgate` | `b"feedback_log"` | `["feedback_log", payment_id_hash]` | `FeedbackEmissionLog` |
26
+ | `validation_registry` | `b"capability"` | `["capability", capability_hash]` | `CapabilityNamespace` |
27
+ | `validation_registry` | `b"attestor"` | `["attestor", attestor_pubkey]` | `AttestorProfile` |
28
+ | `validation_registry` | `b"request"` | `["request", subject_asset, capability_hash, requester]` | `ValidationRequest` |
29
+ | `validation_registry` | `b"attestation"` | `["attestation", subject_asset, capability_hash, attestor]` | `ValidationAttestation` |
30
+
31
+ The SDK exposes derivers for every PDA: [SDK → Exports reference](/sdk/exports-reference#pda-derivers--anchor-loaders).
32
+
33
+ ## Account size canaries
34
+
35
+ | Account | Size | Source |
36
+ |---|---:|---|
37
+ | `PolicyAccount` | 240 | [`policy_account.rs`](https://github.com/agenttrust-labs/agenttrust/blob/main/programs/policy-vault/src/state/policy_account.rs) |
38
+ | `VelocityLedger` | 80 | [`velocity_ledger.rs`](https://github.com/agenttrust-labs/agenttrust/blob/main/programs/policy-vault/src/state/velocity_ledger.rs) |
39
+ | `KillSwitchState` | 96 | [`kill_switch_state.rs`](https://github.com/agenttrust-labs/agenttrust/blob/main/programs/policy-vault/src/state/kill_switch_state.rs) |
40
+ | `PolicyAuthority` | 272 | [`policy_authority.rs`](https://github.com/agenttrust-labs/agenttrust/blob/main/programs/policy-vault/src/state/policy_authority.rs) |
41
+ | `TrustGateAuthority` | 104 | [`trustgate_authority.rs`](https://github.com/agenttrust-labs/agenttrust/blob/main/programs/trustgate/src/state/trustgate_authority.rs) |
42
+ | `FeedbackEmissionLog` | 72 | [`feedback_emission_log.rs`](https://github.com/agenttrust-labs/agenttrust/blob/main/programs/trustgate/src/state/feedback_emission_log.rs) |
43
+ | `ValidationAttestation` | 290 | [`validation_attestation.rs`](https://github.com/agenttrust-labs/agenttrust/blob/main/programs/validation-registry/src/state/validation_attestation.rs) |
44
+ | `AtomStats` (Quantu) | 561 | upstream-pinned at commit `bfb09ad`; canary at byte 560 |
45
+
46
+ Sizes are validated at parse time — a size mismatch fails loud rather than silently misread.
47
+
48
+ ## TrustGate `emit_feedback` field bounds
49
+
50
+ | Field | Limit | Error |
51
+ |---|---:|---|
52
+ | `score` | ≤ 100 | `ScoreOutOfRange` |
53
+ | `tag1` | ≤ 32 bytes | `TagTooLong` |
54
+ | `tag2` | ≤ 32 bytes | `TagTooLong` |
55
+ | `endpoint` | ≤ 64 bytes | `EndpointTooLong` |
56
+ | `feedback_uri` | ≤ 256 bytes | `UriTooLong` |
57
+
58
+ `DISPUTE_SCORE` (the score `dispute_payment` hard-codes for negative feedback) lives at [`programs/trustgate/src/constants.rs`](https://github.com/agenttrust-labs/agenttrust/blob/main/programs/trustgate/src/constants.rs).
59
+
60
+ ## ValidationRegistry name + URI bounds
61
+
62
+ | Field | Limit | Error |
63
+ |---|---:|---|
64
+ | `CapabilityNamespace.name` | min 3, max 32 bytes; no `':'` | `NameTooShort` / `NameTooLong` / `NamespaceColonForbidden` |
65
+ | `CapabilityNamespace.version` | ≤ 16 bytes | `VersionTooLong` |
66
+ | `CapabilityNamespace.schema_uri` | ≤ 160 bytes | `UriTooLong` |
67
+ | `AttestorProfile.display_name_uri` | ≤ 100 bytes | `UriTooLong` |
68
+
69
+ ## PolicyVault constants module
70
+
71
+ Bitmask flags for `PolicyAccount.enabled_kinds_bitmask`:
72
+
73
+ | Flag | Value | Policy |
74
+ |---|---:|---|
75
+ | `KIND_KILLSWITCH` | `0b00001` (1) | KillSwitch |
76
+ | `KIND_SPENDING` | `0b00010` (2) | Spending |
77
+ | `KIND_VELOCITY` | `0b00100` (4) | Velocity |
78
+ | `KIND_COUNTERPARTY_TIER` | `0b01000` (8) | CounterpartyTier |
79
+ | `KIND_REQUIRE_VALIDATION` | `0b10000` (16) | RequireValidation |
80
+
81
+ `gate_mode` enum:
82
+
83
+ | Value | Constant | Reads |
84
+ |---:|---|---|
85
+ | `0` | `GATE_MODE_IMMEDIATE` | `AtomStats.tier_immediate` (byte 551) |
86
+ | `1` | `GATE_MODE_CONFIRMED` | `AtomStats.tier_confirmed` (byte 555) |
87
+
88
+ `default_unrated_treatment` enum:
89
+
90
+ | Value | Constant | Composer maps to |
91
+ |---:|---|---|
92
+ | `0` | `UNRATED_DENY` | `Deny(UnratedTreatmentDeny)` (code 15) |
93
+ | `1` | `UNRATED_ALLOW` | `Allow` |
94
+ | `2` | `UNRATED_REQUIRE_VALIDATION` | `RequireValidation(capability_hash)` |
95
+
96
+ Constants module: [`programs/policy-vault/src/constants.rs`](https://github.com/agenttrust-labs/agenttrust/blob/main/programs/policy-vault/src/constants.rs).
97
+
98
+ ## Read next
99
+
100
+ <Cards>
101
+ <Card title="Byte-offset reference" href="/reference/byte-offset-reference">
102
+ Per-account byte-offset tables.
103
+ </Card>
104
+ <Card title="Devnet program IDs" href="/reference/devnet-program-ids">
105
+ Deployed program addresses on devnet.
106
+ </Card>
107
+ <Card title="DenyReason codes" href="/reference/deny-reason-codes">
108
+ The 15 reason codes the gate can return.
109
+ </Card>
110
+ </Cards>
@@ -1,16 +1,100 @@
1
1
  ---
2
2
  title: Mainnet program IDs
3
- description: Quantu program IDs used by AgentTrust on Solana mainnet.
3
+ description: Quantu's pinned mainnet program IDs that PolicyVault reads via byte-offset parsers — and AgentTrust's mainnet deployment posture.
4
4
  ---
5
5
 
6
- `In progress`
6
+ AgentTrust's three programs are deployed on Solana **devnet** for v1 (the Frontier 2026 build). Mainnet deployment is post-hackathon. PolicyVault reads Quantu's mainnet program IDs via the byte-offset parser pinned to commit `bfb09ad`.
7
7
 
8
- AgentTrust currently targets its own programs on devnet and reads Quantu trust data from the Quantu registry and Atom engine IDs below.
8
+ ## Quantu mainnet IDs
9
9
 
10
10
  | Program | Mainnet ID |
11
- | --- | --- |
11
+ |---|---|
12
12
  | `agent-registry-8004` | `8oo4dC4JvBLwy5tGgiH3WwK4B9PWxL9Z4XjA2jzkQMbQ` |
13
13
  | `atom-engine` | `AToMw53aiPQ8j7iHVb4fGt6nzUNxUhcPc3tbPBZuzVVb` |
14
14
 
15
- Source: [`docs/plan/research/02-quantu-erc8004-archaeology.md`](https://github.com/agenttrust-labs/agenttrust/blob/main/docs/plan/research/02-quantu-erc8004-archaeology.md)
15
+ These are the addresses Quantu Labs published in their `8004-solana` repository. Both programs are MIT-licensed. AgentTrust pins to commit `bfb09ad` for the byte-offset reads — bumping that commit pin is documented inline at [`programs/policy-vault/src/ext/atom_engine.rs`](https://github.com/agenttrust-labs/agenttrust/blob/main/programs/policy-vault/src/ext/atom_engine.rs).
16
16
 
17
+ ## TypeScript constants
18
+
19
+ ```ts
20
+ import { MAINNET_QUANTU_IDS } from "@agenttrust-sdk/trustgate";
21
+
22
+ MAINNET_QUANTU_IDS.agentRegistry8004; // PublicKey
23
+ MAINNET_QUANTU_IDS.atomEngine; // PublicKey
24
+ ```
25
+
26
+ For devnet:
27
+
28
+ ```ts
29
+ import { DEFAULT_DEVNET_QUANTU_IDS } from "@agenttrust-sdk/trustgate";
30
+ ```
31
+
32
+ Source: [`trustgate/sdk/src/quantu.ts`](https://github.com/agenttrust-labs/agenttrust/blob/main/trustgate/sdk/src/quantu.ts).
33
+
34
+ ## AgentTrust mainnet posture
35
+
36
+ The AgentTrust programs target mainnet redeploy as a post-Frontier deliverable. The byte-offset parsers and the SDK's `ProgramIds` config already accept mainnet overrides — the SDK is mainnet-ready; the programs aren't deployed there yet.
37
+
38
+ Override the program IDs for a mainnet redeploy:
39
+
40
+ ```ts
41
+ import { mountTrustGate } from "@agenttrust-sdk/trustgate/express";
42
+ import { PublicKey } from "@solana/web3.js";
43
+
44
+ await mountTrustGate(app, {
45
+ rpcUrl: "https://api.mainnet-beta.solana.com",
46
+ facilitatorKeypair: /* … */,
47
+ programIds: {
48
+ policyVault: new PublicKey("<your mainnet policy_vault>"),
49
+ trustGate: new PublicKey("<your mainnet trustgate>"),
50
+ validationRegistry: new PublicKey("<your mainnet validation_registry>"),
51
+ },
52
+ network: "solana-mainnet",
53
+ atomicityEnforced: true,
54
+ });
55
+ ```
56
+
57
+ Each program is `cluster`-agnostic — the build artefact is the same; only the deploy target changes.
58
+
59
+ ## Verifying Quantu's mainnet deployment
60
+
61
+ ```bash
62
+ solana program show 8oo4dC4JvBLwy5tGgiH3WwK4B9PWxL9Z4XjA2jzkQMbQ --url mainnet-beta | grep Executable
63
+ solana program show AToMw53aiPQ8j7iHVb4fGt6nzUNxUhcPc3tbPBZuzVVb --url mainnet-beta | grep Executable
64
+ ```
65
+
66
+ PolicyVault's mainnet `AtomStats` reads target `AToMw53aiPQ8j7iHVb4fGt6nzUNxUhcPc3tbPBZuzVVb`. Devnet uses `AToMufS4QD6hEXvcvBDg9m1AHeCLpmZQsyfYa5h9MwAF` (different ID). The byte layout (561 bytes, schema-version canary at byte 560) is identical across clusters.
67
+
68
+ Reference: [`programs/policy-vault/src/ext/atom_engine.rs`](https://github.com/agenttrust-labs/agenttrust/blob/main/programs/policy-vault/src/ext/atom_engine.rs).
69
+
70
+ ## Localnet validator clones
71
+
72
+ For local testing, the Anchor validator clones Quantu's mainnet programs into the localnet:
73
+
74
+ ```toml
75
+ # Anchor.toml
76
+ [test.validator]
77
+ url = "https://api.mainnet-beta.solana.com"
78
+
79
+ [[test.validator.clone]]
80
+ address = "8oo4dC4JvBLwy5tGgiH3WwK4B9PWxL9Z4XjA2jzkQMbQ"
81
+
82
+ [[test.validator.clone]]
83
+ address = "AToMw53aiPQ8j7iHVb4fGt6nzUNxUhcPc3tbPBZuzVVb"
84
+ ```
85
+
86
+ `anchor test --validator legacy` then exercises the full flow against real Quantu state without devnet RPC dependencies.
87
+
88
+ ## Read next
89
+
90
+ <Cards>
91
+ <Card title="Devnet program IDs" href="/reference/devnet-program-ids">
92
+ Deployed AgentTrust + Quantu IDs on devnet.
93
+ </Card>
94
+ <Card title="Quantu agent registry" href="/reference/quantu-agent-registry">
95
+ The CPI surface PolicyVault + TrustGate consume.
96
+ </Card>
97
+ <Card title="Byte-offset reference" href="/reference/byte-offset-reference">
98
+ The byte-precise reads PolicyVault performs.
99
+ </Card>
100
+ </Cards>