xytara 1.27.0 → 2.0.0

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/.env.example CHANGED
@@ -1,3 +1,23 @@
1
1
  XYTARA_HOST=127.0.0.1
2
2
  XYTARA_PORT=4320
3
3
  XYTARA_BASE_URL=http://127.0.0.1:4320
4
+ XYTARA_PAYMENT_VERIFICATION_MODE=presence
5
+ XYTARA_PAYMENT_MAX_AGE_SECONDS=300
6
+ XYTARA_WALLET_REGISTRY_JSON=[]
7
+ XYTARA_TREASURY_DESTINATION_ID=
8
+ XYTARA_TREASURY_DESTINATION_KIND=
9
+ XYTARA_TREASURY_ACCOUNT_ID=
10
+ XYTARA_TREASURY_EXTERNAL_REF=
11
+ XYTARA_TREASURY_DESTINATIONS_JSON={}
12
+ XYTARA_BSV_TERANODE_NETWORK=mainnet
13
+ XYTARA_BSV_TERANODE_RPC_URL=
14
+ XYTARA_BSV_TERANODE_MODE=opreturn
15
+ XYTARA_BSV_TERANODE_REQUIRED_CONFIRMATIONS=1
16
+ XYTARA_BSV_TERANODE_MERCHANT_ADDRESS=
17
+ XYTARA_BSV_TERANODE_MERCHANT_PAYMAIL=
18
+ XYTARA_BSV_TERANODE_MERCHANT_LABEL=naxytra-runtime
19
+ XYTARA_BSV_TERANODE_USE_METANET=false
20
+ XYTARA_BSV_TERANODE_SATS_PER_USD_CENT=100
21
+ XYTARA_BSV_TERANODE_SETTLEMENT_RUNTIME_MODE=mock
22
+ XYTARA_CREDIT_BRIDGE_BEARER_TOKEN=
23
+ XYTARA_ACCOUNT_AUTH_BEARER_TOKEN=
@@ -0,0 +1,76 @@
1
+ # BSV Teranode Setup
2
+
3
+ `xytara` now treats `bsv_teranode` as the native first-party settlement base for the default machine payment path.
4
+
5
+ Use this guide when you want the public package to emit BSV/Teranode-aware payment and settlement posture instead of only generic treasury bookkeeping.
6
+
7
+ ## What This Gives You
8
+
9
+ - quotes expose native `bsv_teranode` settlement hints
10
+ - signed payment payloads can carry BSV/Teranode merchant details and settlement reference data
11
+ - accepted payments and resulting receipts preserve BSV/Teranode settlement metadata
12
+ - treasury routing can point directly at a BSV/Teranode merchant address or paymail
13
+
14
+ This is still a runtime-side settlement contract, not a bundled bank or broadcaster. Real external custody still depends on the BSV/Teranode infrastructure you configure behind it.
15
+
16
+ ## Recommended Environment
17
+
18
+ ```env
19
+ XYTARA_PAYMENT_VERIFICATION_MODE=local_signed
20
+ XYTARA_BSV_TERANODE_NETWORK=mainnet
21
+ XYTARA_BSV_TERANODE_MODE=opreturn
22
+ XYTARA_BSV_TERANODE_REQUIRED_CONFIRMATIONS=1
23
+ XYTARA_BSV_TERANODE_MERCHANT_ADDRESS=
24
+ XYTARA_BSV_TERANODE_MERCHANT_PAYMAIL=
25
+ XYTARA_BSV_TERANODE_MERCHANT_LABEL=naxytra-runtime
26
+ XYTARA_BSV_TERANODE_USE_METANET=false
27
+ XYTARA_BSV_TERANODE_SATS_PER_USD_CENT=100
28
+ XYTARA_BSV_TERANODE_SETTLEMENT_RUNTIME_MODE=mock
29
+ ```
30
+
31
+ Optional:
32
+
33
+ - `XYTARA_BSV_TERANODE_RPC_URL`
34
+ - present when you have a Teranode-facing endpoint available and want the runtime to know that the live transport is configured
35
+
36
+ ## Merchant Destination Routing
37
+
38
+ If you set:
39
+
40
+ - `XYTARA_BSV_TERANODE_MERCHANT_ADDRESS`
41
+ or
42
+ - `XYTARA_BSV_TERANODE_MERCHANT_PAYMAIL`
43
+
44
+ then `xytara` can derive a BSV/Teranode treasury destination automatically for `bsv_teranode` settlement quotes.
45
+
46
+ If you need more explicit destination control, use:
47
+
48
+ - `XYTARA_TREASURY_DESTINATIONS_JSON`
49
+
50
+ with a `bsv_teranode` entry.
51
+
52
+ ## Runtime Behavior
53
+
54
+ For a native `bsv_teranode` quote:
55
+
56
+ - settlement mode defaults to `bsv_teranode`
57
+ - quote settlement hints include:
58
+ - rail
59
+ - network
60
+ - merchant address or paymail
61
+ - amount in satoshis
62
+ - settlement reference
63
+ - signed client payment payloads can carry the same BSV/Teranode hints back to the runtime
64
+ - resulting transactions/receipts preserve BSV/Teranode settlement metadata for later reconciliation and proof follow-through
65
+
66
+ For live settlement follow-through after payment acceptance, use:
67
+
68
+ - `GET /v1/settlement/bsv-teranode`
69
+ - `GET /v1/settlement/bsv-teranode/:settlement_id`
70
+ - `POST /v1/settlement/bsv-teranode/:settlement_id/submit`
71
+ - `POST /v1/settlement/bsv-teranode/:settlement_id/refresh`
72
+
73
+ ## Notes
74
+
75
+ - `bsv_teranode` is the canonical public settlement name
76
+ - Metanet remains optional support infrastructure, not a required dependency
package/README.md CHANGED
@@ -31,16 +31,125 @@ If you are building adapters, continue with:
31
31
  - [adapters/ONBOARDING_POSTURE.md](C:/Users/Yoga/Desktop/workspace/vscode_workspace_public/naxytra/xytara/adapters/ONBOARDING_POSTURE.md)
32
32
  - [adapters/THIRD_PARTY_SUBMISSION_PROCESS.md](C:/Users/Yoga/Desktop/workspace/vscode_workspace_public/naxytra/xytara/adapters/THIRD_PARTY_SUBMISSION_PROCESS.md)
33
33
 
34
+ If you are wiring the native BSV settlement base, continue with:
35
+
36
+ - [BSV_TERANODE_SETUP.md](C:/Users/Yoga/Desktop/workspace/vscode_workspace_public/naxytra/xytara/BSV_TERANODE_SETUP.md)
37
+ - [REAL_PAYMENT_SETUP.md](C:/Users/Yoga/Desktop/workspace/vscode_workspace_public/naxytra/xytara/REAL_PAYMENT_SETUP.md)
38
+
39
+ If you are wiring the first human checkout path, continue with:
40
+
41
+ - [HUMAN_CHECKOUT_AND_RUNTIME_BRIDGE_PATTERN.md](C:/Users/Yoga/Desktop/workspace/vscode_workspace_public/naxytra/HUMAN_CHECKOUT_AND_RUNTIME_BRIDGE_PATTERN.md)
42
+ - [RUNTIME_BRIDGE_CONTRACT.md](C:/Users/Yoga/Desktop/workspace/vscode_workspace_public/naxytra/RUNTIME_BRIDGE_CONTRACT.md)
43
+ - [HOSTED_CHECKOUT_CONTRACT.md](C:/Users/Yoga/Desktop/workspace/vscode_workspace_public/naxytra/HOSTED_CHECKOUT_CONTRACT.md)
44
+ - [CHECKOUT_TO_CREDITS_AND_DISPATCH_PLAN.md](C:/Users/Yoga/Desktop/workspace/vscode_workspace_public/naxytra/CHECKOUT_TO_CREDITS_AND_DISPATCH_PLAN.md)
45
+
34
46
  ## Production Path
35
47
 
36
48
  The intended production-facing default path is now:
37
49
 
38
50
  1. discover a capability
39
51
  2. preview or quote the transaction path
40
- 3. execute through the default machine path
41
- 4. inspect the transaction-side result and lifecycle state
42
- 5. hand the result into `xoonya`
43
- 6. review and run the proof-side completion path
52
+ 3. spend existing credits first when the caller prefers the reusable account path
53
+ 4. fall back to direct machine payment when credits are not available or not preferred
54
+ 5. execute through the default machine path
55
+ 6. inspect the transaction-side result and lifecycle state
56
+ 7. hand the result into `xoonya`
57
+ 8. review and run the proof-side completion path
58
+
59
+ The machine-facing execution surface now also supports a first-class reusable balance posture:
60
+
61
+ - set `payment_preference: "credits_first"` on `POST /v1/commands/execute` when the caller wants to spend existing account credits before requesting a fresh payment
62
+ - default spend posture is `open_spend`: if the funded caller can pay, `xytara` should spend and execute without extra runtime ceremony
63
+ - bounded spend posture is optional and only applies when the caller intentionally uses an `agent_id` and/or `budget_id`
64
+ - inspect account credit state with `GET /v1/economics/accounts/:account_id/credit-balance`
65
+ - inspect deterministic usage metering state with `GET /v1/economics/accounts/:account_id/metering-summary`, `GET /v1/economics/accounts/:account_id/usage-meters`, and `GET /v1/economics/accounts/:account_id/usage-meters/:usage_meter_id`
66
+ - expect reconciliation and operator-export surfaces to carry the same metering trail for audit visibility
67
+ - export a canonical cross-repo economic handoff bundle with `POST /v1/economics/handoff-bundles/economic-consequence`
68
+ - expect `POST /v1/transaction-center/result-packages/export` and result-package continuation export/prepare surfaces to auto-carry that same canonical economic bundle whenever the execution path spent credits and produced a deterministic usage meter
69
+ - inspect pack-backed entitlement pools with `GET /v1/economics/accounts/:account_id/entitlements` and `GET /v1/economics/accounts/:account_id/entitlements/summary`
70
+ - inspect low-balance and replenishment posture with `GET /v1/economics/accounts/:account_id/entitlements/replenishment-summary`
71
+ - inspect one pool’s replenishment view with `GET /v1/economics/accounts/:account_id/entitlements/:entitlement_id/replenishment-view`
72
+ - inspect effective account spend posture with `GET /v1/economics/accounts/:account_id/policy-pack`
73
+ - inspect effective agent spend posture with `GET /v1/economics/accounts/:account_id/agents/:agent_id/policy-view`
74
+ - preflight a proposed credit spend with `POST /v1/economics/rails/credits/preview-spend`
75
+ - record explicit bounded credit consumption with `POST /v1/economics/rails/credits/consume`
76
+ - issue externally verified top-up grants with `POST /v1/credit-bridge/grants`
77
+ - inspect externally issued grants with `GET /v1/credit-bridge/grants` and `GET /v1/credit-bridge/grants/:grant_id`
78
+ - discover reusable funding posture through `GET /v1/credit-packs`, `GET /v1/credit-packs/summary`, and `GET /v1/credit-pack?ref=<pack_id>`
79
+ - external grant callers can now fund a named public pack such as `credits.agent`, and `xytara` will validate and record that pack identity directly
80
+
81
+ The SDK now exposes the same posture directly for agent callers:
82
+
83
+ - `client.getCreditPackSummary()`
84
+ - `client.getCreditBalance(accountId)`
85
+ - `client.previewUsageMetering({ account_id, task_ref?, workflow_ref?, units? })`
86
+ - `client.getUsageMeteringSummary(accountId)`
87
+ - `client.listUsageMeters(accountId)`
88
+ - `client.getUsageMeter(usageMeterId, accountId?)`
89
+ - `client.exportEconomicConsequenceHandoffBundle({ account_id, usage_meter_id, credit_spend_id, meter_profile_ref? })`
90
+ - `client.listEntitlements(accountId)`
91
+ - `client.getEntitlementSummary(accountId)`
92
+ - `client.getEntitlement(entitlementId, accountId?)`
93
+ - `client.getEntitlementReplenishmentSummary(accountId)`
94
+ - `client.getEntitlementReplenishmentView(entitlementId, accountId?)`
95
+ - `client.updateEntitlementReplenishmentPreference(entitlementId, payload, accountId?)`
96
+ - `client.previewCreditSpend({ account_id, task_ref, units, agent_id?, budget_id? })`
97
+ - `client.getCreditSpendPolicyPack(accountId)`
98
+ - `client.getAgentCreditSpendPolicyView(agentId, accountId?)`
99
+ - `client.executeWithCreditsFirst(payload, options?)`
100
+
101
+ The runtime now also supports a bounded delegated spend path for repeat-use automation:
102
+
103
+ - issue a spend credential through `POST /v1/account-auth/spend-credentials`
104
+ - use that credential as `authorization: Bearer <spend_credential>`
105
+ - optionally bind the credential to a `pack_id` or `entitlement_id` when spend should stay inside one value pool
106
+ - execute through the same `credits_first` path without sharing broad operator secrets
107
+ - revoke it through `POST /v1/account-auth/spend-credentials/:credential_id/revoke`
108
+
109
+ SDK helpers now include:
110
+
111
+ - `client.createSpendCredential(payload, { bearerToken })`
112
+ - `client.listSpendCredentials(filters?, { bearerToken? })`
113
+ - `client.getSpendCredential(credentialId, { bearerToken? })`
114
+ - `client.revokeSpendCredential(credentialId, payload, { bearerToken })`
115
+ - `client.executeWithSpendCredential(payload, { spendToken })`
116
+
117
+ This keeps one-off usage and repeat usage on the same public spine:
118
+
119
+ - direct pay when the caller is using the stack once
120
+ - credit balance when the caller is already funded and wants low-friction repeat execution
121
+ - optional agent and budget controls can still bound that spend without changing the execution surface
122
+
123
+ It also keeps the human checkout boundary clean:
124
+
125
+ - an external merchant-facing system can verify a purchase and issue a bounded credit grant into `xytara`
126
+ - `xytara` records the granted value and consumes it during later runtime operations
127
+ - the runtime does not need to absorb provider-specific checkout semantics to support repeat usage
128
+ - in production, `POST /v1/credit-bridge/grants` should normally be protected with `XYTARA_CREDIT_BRIDGE_BEARER_TOKEN`
129
+
130
+ The first human-facing convenience path now follows a parallel narrow route:
131
+
132
+ 1. create hosted purchase intent
133
+ 2. create checkout session
134
+ 3. normalize payment success
135
+ 4. issue credits or entitlement
136
+ 5. dispatch through the runtime bridge when needed
137
+ 6. converge back into the same `xytara` and `xoonya` spine
138
+
139
+ The first direct hosted execution path now also has a public runtime bridge surface:
140
+
141
+ - `POST /v1/runtime-bridge/dispatch`
142
+ - `GET /v1/runtime-bridge/dispatches`
143
+ - `GET /v1/runtime-bridge/dispatches/:request_id`
144
+
145
+ The hosted payment side is intentionally asymmetric:
146
+
147
+ - pay-in should be simple and fast
148
+ - execution and delivery should follow immediately after valid payment
149
+ - refund or reversal requests should enter review first
150
+ - no autonomous payout path should exist outside explicit operator review and completion
151
+
152
+ The operator shell now also carries hosted checkout visibility so purchase, dispatch, and refund-review load can be monitored from the same public control surface.
44
153
 
45
154
  The rest of this README explains the full surface area and milestone trail, but the public starting posture should now be understandable from that one default path.
46
155
 
@@ -98,7 +207,7 @@ The package and service also expose a default transaction center surface so the
98
207
 
99
208
  - default protocol lane: `mcp`
100
209
  - default payment protocol: `x402`
101
- - default settlement center: built-in chain settlement across the canonical bundled settlement modes
210
+ - default settlement center: built-in chain settlement with `bsv_teranode` as the native default across the canonical bundled settlement modes
102
211
  - default treasury landing posture: account treasury destination by settlement mode
103
212
 
104
213
  That same default center is also reflected in direct helper paths for default MCP usage, so the default path can be previewed or quoted without repeating the full integration-selection story each time.
@@ -560,6 +669,13 @@ Environment example:
560
669
 
561
670
  - [`.env.example`](C:/Users/Yoga/Desktop/workspace/vscode_workspace_public/naxytra/xytara/.env.example)
562
671
 
672
+ Production payment note:
673
+
674
+ - set `XYTARA_PAYMENT_VERIFICATION_MODE=local_signed` to enforce verifiable signed payment acceptance instead of plain header presence
675
+ - provide buyer wallet verification material through `XYTARA_WALLET_REGISTRY_JSON` or `XYTARA_WALLET_REGISTRY_PATH`
676
+ - set `XYTARA_TREASURY_DESTINATION_ID` and related treasury env vars so accepted payments land in your merchant treasury posture instead of the default local account placeholder
677
+ - built-in `x402` is the admission lane; real external payout/custody still depends on the payment rail and treasury destination you configure behind that lane
678
+
563
679
  Primary service routes:
564
680
 
565
681
  - `GET /health`
@@ -0,0 +1,101 @@
1
+ # Real Payment Setup
2
+
3
+ This guide explains how to move `xytara` from local placeholder payment acceptance into a production-usable payment posture.
4
+
5
+ ## What Changed
6
+
7
+ `xytara` now supports two payment-acceptance modes:
8
+
9
+ - `presence`
10
+ - development/demo mode
11
+ - payment headers are required, but not cryptographically verified
12
+
13
+ - `local_signed`
14
+ - production-oriented built-in mode
15
+ - signed payment payloads are cryptographically verified against a configured wallet registry
16
+ - quote replay and nonce replay are blocked
17
+ - accepted payments are routed into your configured merchant treasury destination posture
18
+
19
+ ## Minimum Production-Oriented Configuration
20
+
21
+ Set these environment variables:
22
+
23
+ ```env
24
+ XYTARA_PAYMENT_VERIFICATION_MODE=local_signed
25
+ XYTARA_PAYMENT_MAX_AGE_SECONDS=300
26
+ XYTARA_WALLET_REGISTRY_JSON=[{"wallet_id":"<wallet-id>","secret":"<shared-secret>","account_id":"<account-id>"}]
27
+ XYTARA_TREASURY_DESTINATION_ID=merchant_treasury_primary
28
+ XYTARA_TREASURY_DESTINATION_KIND=merchant_treasury
29
+ XYTARA_TREASURY_ACCOUNT_ID=merchant-main
30
+ XYTARA_TREASURY_EXTERNAL_REF=merchant-usd-main
31
+ ```
32
+
33
+ You can also load the wallet registry and treasury map from files through:
34
+
35
+ - `XYTARA_WALLET_REGISTRY_PATH`
36
+ - `XYTARA_TREASURY_DESTINATIONS_PATH`
37
+
38
+ ## What This Gives You
39
+
40
+ With `local_signed` enabled:
41
+
42
+ - `POST /x402/commands/execute` challenges for payment
43
+ - the client signs the exact payment payload
44
+ - if the quote is using native `bsv_teranode`, the payment payload can also carry BSV/Teranode merchant and settlement-reference hints
45
+ - the server verifies:
46
+ - wallet registration
47
+ - HMAC signature validity
48
+ - quote id
49
+ - amount
50
+ - currency
51
+ - settlement binding
52
+ - timestamp freshness
53
+ - nonce uniqueness
54
+ - accepted payments are recorded into:
55
+ - `payment-ledger`
56
+ - `treasury-summary`
57
+ - `rail-summary`
58
+ - `reconciliation-report`
59
+
60
+ ## What It Does Not Do By Itself
61
+
62
+ The built-in path gives you verifiable payment acceptance and merchant treasury routing posture inside `xytara`.
63
+
64
+ It does not by itself:
65
+
66
+ - move fiat into a bank account
67
+ - broadcast on-chain settlement
68
+ - replace an external processor or custodian
69
+
70
+ For actual external custody, connect `xytara` to the real rail you want behind the payment and settlement boundary.
71
+
72
+ That is where:
73
+
74
+ - your payment rail integration
75
+ - your settlement integration
76
+ - your merchant treasury destination
77
+
78
+ become the actual real-world landing point for accepted funds.
79
+
80
+ ## Best Current Public Model
81
+
82
+ Use the stack like this:
83
+
84
+ - `x402` route = payment admission lane
85
+ - `local_signed` = real verifiable acceptance posture in the public package
86
+ - `bsv_teranode` = native first-party settlement base when you want the public stack to expose BSV/Teranode-aware payout posture
87
+ - configured treasury destination = merchant-facing landing posture in the runtime
88
+ - external rail / settlement integration = actual custody and payout layer
89
+
90
+ If you want the native BSV path specifically, continue with [BSV_TERANODE_SETUP.md](C:/Users/Yoga/Desktop/workspace/vscode_workspace_public/naxytra/xytara/BSV_TERANODE_SETUP.md).
91
+
92
+ ## Operator Visibility
93
+
94
+ After acceptance, inspect:
95
+
96
+ - `GET /v1/payment-ledger`
97
+ - `GET /v1/economics/accounts/:account_id/treasury-summary`
98
+ - `GET /v1/economics/accounts/:account_id/rail-summary`
99
+ - `GET /v1/reconciliation-report`
100
+
101
+ These tell you what was accepted, where it was routed in the runtime model, and what still needs reconciliation against the underlying real-world rail.
@@ -12,10 +12,25 @@ Core routes:
12
12
  - `GET /v1/catalog/task?ref=<task_ref_or_alias>`
13
13
  - `GET /v1/catalog/workflows`
14
14
  - `GET /v1/catalog/workflow?ref=<workflow_ref_or_alias>`
15
+ - `GET /v1/credit-packs`
16
+ - `GET /v1/credit-packs/summary`
17
+ - `GET /v1/credit-pack?ref=<pack_id>`
18
+ - `GET /v1/account-auth/spend-credentials`
19
+ - `POST /v1/account-auth/spend-credentials`
20
+ - `GET /v1/account-auth/spend-credentials/:credential_id`
21
+ - `POST /v1/account-auth/spend-credentials/:credential_id/revoke`
15
22
  - `POST /v1/payment-quotes`
16
23
  - `POST /v1/commands/execute`
17
24
  - `POST /x402/commands/execute`
18
25
 
26
+ Operational note:
27
+
28
+ - for production acceptance, `POST /x402/commands/execute` and `POST /x402/mcp/tools/invoke` should normally run with `XYTARA_PAYMENT_VERIFICATION_MODE=local_signed` or a stronger verifier mode
29
+ - accepted payments then flow into payment-ledger, treasury-summary, rail-summary, and reconciliation surfaces
30
+ - the default first-party settlement posture is now `bsv_teranode`, and `x402` challenge quotes carry native BSV/Teranode settlement hints when that default path is in use
31
+ - in production, `POST /v1/credit-bridge/grants` should normally require `authorization: Bearer <token>` backed by `XYTARA_CREDIT_BRIDGE_BEARER_TOKEN`
32
+ - in production, spend-credential issuance/revoke should normally require `authorization: Bearer <token>` backed by `XYTARA_ACCOUNT_AUTH_BEARER_TOKEN`
33
+
19
34
  Named first-class lanes:
20
35
 
21
36
  - `POST /v1/trust/handoffs/emit`
@@ -50,6 +65,10 @@ Named first-class lanes:
50
65
  - `POST /v1/coordination-center/zones-dashboard-pack`
51
66
  - `POST /v1/mcp/tools/invoke`
52
67
  - `POST /x402/mcp/tools/invoke`
68
+ - `GET /v1/settlement/bsv-teranode`
69
+ - `GET /v1/settlement/bsv-teranode/:settlement_id`
70
+ - `POST /v1/settlement/bsv-teranode/:settlement_id/submit`
71
+ - `POST /v1/settlement/bsv-teranode/:settlement_id/refresh`
53
72
 
54
73
  Lifecycle and operator routes:
55
74
 
@@ -98,6 +117,26 @@ Lifecycle and operator routes:
98
117
  - `POST /v1/economics/allocations/reverse`
99
118
  - `POST /v1/economics/rails/credits/preview`
100
119
  - `POST /v1/economics/rails/credits/apply`
120
+ - `POST /v1/economics/metering/preview`
121
+ - `POST /v1/economics/handoff-bundles/economic-consequence`
122
+ - `POST /v1/economics/rails/credits/preview-spend`
123
+ - `POST /v1/economics/rails/credits/consume`
124
+ - `GET /v1/credit-bridge/grants`
125
+ - `POST /v1/credit-bridge/grants`
126
+ - `GET /v1/credit-bridge/grants/:grant_id`
127
+ - `GET /v1/checkout/purchase-intents`
128
+ - `POST /v1/checkout/purchase-intents`
129
+ - `GET /v1/checkout/purchase-intents/:purchase_intent_id`
130
+ - `GET /v1/checkout/purchase-intents/:purchase_intent_id/sessions`
131
+ - `POST /v1/checkout/purchase-intents/:purchase_intent_id/session`
132
+ - `GET /v1/checkout/purchase-intents/:purchase_intent_id/refunds`
133
+ - `POST /v1/checkout/purchase-intents/:purchase_intent_id/refund-request`
134
+ - `GET /v1/checkout/sessions/:checkout_session_id`
135
+ - `POST /v1/checkout/events/normalize`
136
+ - `GET /v1/checkout/events/:event_id`
137
+ - `POST /v1/runtime-bridge/dispatch`
138
+ - `GET /v1/runtime-bridge/dispatches`
139
+ - `GET /v1/runtime-bridge/dispatches/:request_id`
101
140
  - `POST /v1/economics/receipt-ledger/validate`
102
141
  - `POST /v1/economics/interpretation-handoff`
103
142
  - `POST /v1/economics/markets/preview`
@@ -108,6 +147,16 @@ Lifecycle and operator routes:
108
147
  - `GET /v1/economics/accounts/:account_id/agents`
109
148
  - `GET /v1/economics/accounts/:account_id/receipts`
110
149
  - `GET /v1/economics/accounts/:account_id`
150
+ - `GET /v1/economics/accounts/:account_id/credit-balance`
151
+ - `GET /v1/economics/accounts/:account_id/metering-summary`
152
+ - `GET /v1/economics/accounts/:account_id/usage-meters`
153
+ - `GET /v1/economics/accounts/:account_id/usage-meters/:usage_meter_id`
154
+ - `GET /v1/economics/accounts/:account_id/entitlements`
155
+ - `GET /v1/economics/accounts/:account_id/entitlements/summary`
156
+ - `GET /v1/economics/accounts/:account_id/entitlements/replenishment-summary`
157
+ - `GET /v1/economics/accounts/:account_id/entitlements/:entitlement_id`
158
+ - `GET /v1/economics/accounts/:account_id/entitlements/:entitlement_id/replenishment-view`
159
+ - `POST /v1/economics/accounts/:account_id/entitlements/:entitlement_id/replenishment-preference`
111
160
  - `GET /v1/economics/accounts/:account_id/operator-view`
112
161
  - `GET /v1/economics/accounts/:account_id/operator-dashboard`
113
162
  - `GET /v1/economics/accounts/:account_id/treasury-summary`
@@ -117,6 +166,8 @@ Lifecycle and operator routes:
117
166
  - `GET /v1/economics/accounts/:account_id/treasury-workflow-pack`
118
167
  - `GET /v1/economics/accounts/:account_id/treasury-signoff-pack`
119
168
  - `GET /v1/economics/accounts/:account_id/policy-summary`
169
+ - `GET /v1/economics/accounts/:account_id/policy-pack`
170
+ - `GET /v1/economics/accounts/:account_id/agents/:agent_id/policy-view`
120
171
  - `GET /v1/economics/accounts/:account_id/rail-summary`
121
172
  - `GET /v1/economics/accounts/:account_id/rail-workflow-pack`
122
173
  - `GET /v1/economics/accounts/:account_id/rail-signoff-pack`
@@ -154,11 +205,89 @@ The constitutional commerce loop for `xytara` is:
154
205
 
155
206
  1. discover
156
207
  2. quote
157
- 3. pay or receive payment challenge
158
- 4. execute
159
- 5. deliver
160
- 6. inspect
161
- 7. prove or reference proof-compatible facts
208
+ 3. spend credits first when the caller chooses the reusable-balance path
209
+ 4. otherwise pay or receive payment challenge
210
+ 5. execute
211
+ 6. deliver
212
+ 7. inspect
213
+ 8. prove or reference proof-compatible facts
214
+
215
+ Credit-first execution should use:
216
+
217
+ 1. fund an account through credit issuance or hosted checkout
218
+ 2. inspect `GET /v1/economics/accounts/:account_id/credit-balance`
219
+ 3. default to `open_spend`: if the funded caller can pay, the runtime should spend and execute without extra policy ceremony
220
+ 4. call `POST /v1/commands/execute` with `payment_preference: "credits_first"`
221
+ 5. optionally include `agent_id` and/or `budget_id` only when runtime spend should stay inside explicit policy bounds
222
+ 6. treat agent and budget controls as optional bounded-spend posture, not as the default burden on every caller
223
+ 7. consume credits on successful execution
224
+ 8. receive `402 insufficient_credits` plus a quote when the balance is not enough
225
+ 9. receive a bounded policy failure when agent or budget controls deny the spend
226
+ 10. fall back to direct payment or top up credits without changing the execution surface
227
+
228
+ Deterministic usage metering should use:
229
+
230
+ 1. preview the expected unit profile through `POST /v1/economics/metering/preview`
231
+ 2. let successful credit spend create a linked usage-meter record automatically
232
+ 3. inspect account-level metering state through `GET /v1/economics/accounts/:account_id/metering-summary`
233
+ 4. inspect concrete meter records through `GET /v1/economics/accounts/:account_id/usage-meters`
234
+ 5. expect reconciliation and operator-export surfaces to expose the same metering trail for audit and operator review
235
+ 6. export the same deterministic consequence as a canonical cross-repo handoff bundle through `POST /v1/economics/handoff-bundles/economic-consequence`
236
+ 7. expect `POST /v1/transaction-center/result-packages/export` and result-package continuation run/prepare surfaces to auto-carry that same canonical bundle whenever credit-first execution produced the linked usage meter and credit spend
237
+
238
+ External top-up and pack issuance should use:
239
+
240
+ 1. verify the human-facing purchase outside the runtime
241
+ 2. issue a bounded grant through `POST /v1/credit-bridge/grants`
242
+ 3. inspect grants through `GET /v1/credit-bridge/grants`
243
+ 4. rely on the same account credit balance and credit-first execution path afterward
244
+
245
+ When using pack-backed issuance:
246
+
247
+ - `pack_id` should reference a real public credit pack from `GET /v1/credit-packs`
248
+ - unknown pack ids should fail cleanly
249
+ - pack-backed grants may derive default units and nominal amount from the referenced public pack
250
+
251
+ Delegated spend should use:
252
+
253
+ 1. issue a narrow spend credential for the target account
254
+ 2. optionally bind it to an `agent_id` and/or `budget_id`
255
+ 3. optionally bind it to a `pack_id` or `entitlement_id` when value should stay inside one pool
256
+ 4. call the normal execution surface with `authorization: Bearer <spend_credential>`
257
+ 5. use `payment_preference: "credits_first"` for the repeat-use path
258
+ 6. revoke the credential without affecting account ownership or payout posture
259
+
260
+ The first human-facing hosted path now follows:
261
+
262
+ 1. create purchase intent
263
+ 2. create checkout session
264
+ 3. receive normalized payment status
265
+ 4. issue credits or execution entitlement
266
+ 5. converge into the runtime spine
267
+
268
+ Direct single-task hosted execution should use:
269
+
270
+ 1. hosted checkout purchase intent
271
+ 2. normalized `paid` event
272
+ 3. runtime bridge dispatch
273
+ 4. normal transaction, receipt, treasury, and proof follow-through
274
+
275
+ Hosted checkout payout posture should use:
276
+
277
+ 1. refund request enters review
278
+ 2. operator review updates refund state
279
+ 3. approval is explicit
280
+ 4. completion is manual and bounded
281
+
282
+ Provider or customer refund-shaped signals may be recorded, but they should not become autonomous payout authority inside the public stack.
283
+
284
+ Operator-shell posture should now also expose hosted checkout visibility:
285
+
286
+ - purchase intent counts
287
+ - runtime bridge dispatch counts
288
+ - refund review queue counts
289
+
290
+ so the human payment path remains operationally visible without introducing a second control plane.
162
291
 
163
292
  This loop is exercised through:
164
293
 
package/START_HERE.md CHANGED
@@ -40,6 +40,8 @@ For long-term product understanding, read:
40
40
 
41
41
  - [FINAL_CONTRACT.md](C:/Users/Yoga/Desktop/workspace/vscode_workspace_public/naxytra/xytara/FINAL_CONTRACT.md)
42
42
  - [SERVICE_CONTRACT.md](C:/Users/Yoga/Desktop/workspace/vscode_workspace_public/naxytra/xytara/SERVICE_CONTRACT.md)
43
+ - [BSV_TERANODE_SETUP.md](C:/Users/Yoga/Desktop/workspace/vscode_workspace_public/naxytra/xytara/BSV_TERANODE_SETUP.md)
44
+ - [REAL_PAYMENT_SETUP.md](C:/Users/Yoga/Desktop/workspace/vscode_workspace_public/naxytra/xytara/REAL_PAYMENT_SETUP.md)
43
45
  - [TERMINOLOGY.md](C:/Users/Yoga/Desktop/workspace/vscode_workspace_public/naxytra/xytara/TERMINOLOGY.md)
44
46
 
45
47
  ## 5. If You Are Building Adapters