Import app route manifests

This commit is contained in:
jwinterm
2026-07-06 03:49:34 -04:00
parent cf0b89b572
commit 2ca73ca431
9 changed files with 315 additions and 25 deletions
+33
View File
@@ -163,6 +163,7 @@ openapi = "http://127.0.0.1:9000/openapi.json"
[site.interactions]
default_tier = "interactive-lite"
route_manifest = "./routes.json"
session_policy = "http-only-cookie"
deny_routes = ["/admin/*", "/api/internal/*", "/webhooks/*"]
@@ -196,6 +197,38 @@ max_tier = "interactive-lite"
`max_tier` is a hard cap. If a route needs a higher tier than the protocol allows, AMPG
omits it or renders a safe alternate page.
## Route manifests
Applications can generate a JSON route manifest instead of hand-maintaining every route
group in TOML. Paths are resolved relative to `gateway.toml`; inline TOML routes are
appended after manifest routes.
```json
{
"schema": "ampg.route-manifest.v1",
"default_tier": "interactive-lite",
"deny_routes": ["/admin/*", "/api/internal/*", "/webhooks/*"],
"routes": [
{"match": "/play/*"},
{
"match": "/checkout/*",
"tier": "transactional",
"identity": "http-session",
"payments": "server-invoice"
},
{
"match": "/webhooks/*",
"tier": "internal",
"public_allowed": false
}
]
}
```
Route entries use the same fields as `[[site.interactions.route]]`. The manifest should
describe public intent only; credentials, keys, deployment notes, and private hostnames do
not belong in it.
## Protocol-only deployments
Enabled protocols are independent. A config can omit clearnet entirely and publish only
+4 -2
View File
@@ -57,9 +57,11 @@ Fixture interaction policy defaults to:
}
```
Route-group overrides will be added separately. Until then, protocol-level options can
declare the fixture-level policy that AMPB should check.
Protocol-level options can declare the base fixture policy that AMPB should check.
When `[[site.interactions.route]]` entries are configured, AMPG emits additional fixtures
for public route groups. Routes with `tier = "internal"` or `public_allowed = false` are
not emitted.
Routes imported from `site.interactions.route_manifest` are treated the same way as inline
TOML routes.
+3
View File
@@ -15,10 +15,13 @@ This file is generated from code. Do not edit it by hand.
| site.outputs | `plan_root` | path | no | ../dist/ampg-plan | Generated plan artifact root. |
| site.interactions | `default_tier` | enum | no | static | Default interaction tier for routes. |
| site.interactions | `deny_routes` | array<string> | no | [] | Route patterns that must not be published. |
| site.interactions | `route_manifest` | path | no | - | JSON route manifest generated or maintained by the application. |
| site.interactions.route | `match` | glob | no | - | Route pattern for an explicit interaction policy. |
| site.interactions.route | `tier` | enum | no | site.interactions.default_tier | Interaction tier for a route group. |
| site.interactions.route | `identity` | enum | no | none | Identity adapter required by a route group. |
| site.interactions.route | `payments` | enum | no | none | Payment adapter required by a route group. |
| site.interactions.route | `realtime` | boolean | no | false | Whether a route group requires live state or streaming updates. |
| site.interactions.route | `public_allowed` | boolean | no | true | Whether this route group may be emitted into public protocol outputs. |
| site.protocols.<name> | `enabled` | boolean | no | false | Whether this protocol target is built and planned. |
| site.protocols.<name> | `renderer` | enum | no | <protocol> | Renderer profile to use for this protocol. |
| site.protocols.<name> | `daemon` | enum | no | protocol default | Ingress daemon adapter. |
+17
View File
@@ -49,6 +49,23 @@ Configured public route groups are emitted into fixture manifests so AMPB can ve
route and interaction policy for each selected transport. Internal route groups are not
emitted.
## Route Manifest Contract
Apps may provide `ampg.route-manifest.v1` JSON. AMPG imports it from
`site.interactions.route_manifest`, merges its denylist with inline TOML, and appends any
inline TOML route entries after the imported route entries.
Required top-level fields:
- `schema`: must be `ampg.route-manifest.v1`.
- `routes`: route policy objects using `match`, `tier`, `identity`, `payments`,
`realtime`, and `public_allowed`.
Optional top-level fields:
- `default_tier`: inherited by route entries without a `tier`.
- `deny_routes`: route patterns that must not be published.
## Protocol Mapping
| Tier | Clearnet | Tor/I2P | Gemini | IPFS | Reticulum |