@aotter/mantle 0.1.3-alpha.4 → 0.1.3-alpha.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +11 -3
- package/dist/codegen/emitMantleModule.d.ts +8 -2
- package/dist/codegen/emitMantleModule.d.ts.map +1 -1
- package/dist/codegen/emitMantleModule.js +42 -12
- package/dist/codegen/emitMantleModule.js.map +1 -1
- package/docs/adr/0014-auth-better-auth-and-multi-tenant-mcp.md +39 -3
- package/docs/handbook/cloudflare/authentication.md +45 -0
- package/docs/handbook/cloudflare/bindings.md +60 -0
- package/docs/handbook/cloudflare/conventional-worker.md +1 -1
- package/docs/handbook/cloudflare/deploy-and-operate.md +4 -0
- package/docs/handbook/reference/surface.md +1 -1
- package/docs/handbook/reference/view.md +4 -1
- package/docs/performance-harness.md +7 -0
- package/docs/spec-only-host-adoption.md +1 -1
- package/package.json +17 -17
package/README.md
CHANGED
|
@@ -16,7 +16,7 @@ npx skills add aotter/mantle --skill install
|
|
|
16
16
|
```
|
|
17
17
|
|
|
18
18
|
To depend on this package in an existing project, pin the exact version
|
|
19
|
-
from `package.json` (currently `0.1.3-alpha.
|
|
19
|
+
from `package.json` (currently `0.1.3-alpha.6`):
|
|
20
20
|
|
|
21
21
|
```bash
|
|
22
22
|
npm install @aotter/mantle
|
|
@@ -35,7 +35,7 @@ subpath. Every sub-package also remains directly installable.
|
|
|
35
35
|
| `@aotter/mantle/spec` (or root) | Manifest grammar, validators, JSON-Schema→Zod, diagnostic catalog (no env / no IO) |
|
|
36
36
|
| `@aotter/mantle/runtime` | Hexagonal runtime: domain ports, use cases, infrastructure helpers (no adapter deps) |
|
|
37
37
|
| `@aotter/mantle/runtime/testing` | Node-only crowded SQLite planner and HTTP sampling helpers |
|
|
38
|
-
| `@aotter/mantle/codegen` | Pure linked manifests → typed runtime module emitter (no IO) |
|
|
38
|
+
| `@aotter/mantle/codegen` | Pure linked manifests or compiled plan → typed runtime module emitter (no IO) |
|
|
39
39
|
| `@aotter/mantle/web` | Optional HTML, Markdown, `llms.txt`, sitemap, SEO, and preview composition (no routes or platform deps) |
|
|
40
40
|
| `@aotter/mantle/admin` | Optional Admin API, auth routes, and static-asset composition |
|
|
41
41
|
| `@aotter/mantle/auth` | Optional host-neutral Better Auth identity; adapters own IP headers and storage bindings |
|
|
@@ -73,7 +73,15 @@ installed, it also syncs the Admin SPA to `public/_mantle/admin/` (excluding
|
|
|
73
73
|
`server.*` package exports). Core-only installs skip that copy. It performs no
|
|
74
74
|
skill sync, package update, styling, provisioning, or deployment.
|
|
75
75
|
The same pure emitter is available from `@aotter/mantle/codegen` when a host
|
|
76
|
-
wants to own parsing and filesystem IO.
|
|
76
|
+
wants to own parsing and filesystem IO. TypeScript-authored manifests can pass
|
|
77
|
+
their already-compiled `plan` directly:
|
|
78
|
+
|
|
79
|
+
```ts
|
|
80
|
+
import { emitMantleModule } from "@aotter/mantle/codegen";
|
|
81
|
+
|
|
82
|
+
const emitted = emitMantleModule({ plan });
|
|
83
|
+
if (!emitted.ok) throw new Error(emitted.diagnostics.map(({ message }) => message).join("\n"));
|
|
84
|
+
```
|
|
77
85
|
|
|
78
86
|
```ts
|
|
79
87
|
import { createMantle } from "../.mantle/generated/mantle.js";
|
|
@@ -1,8 +1,14 @@
|
|
|
1
1
|
import { type Diagnostic, type LinkedManifestSet } from "@aotter/mantle-spec";
|
|
2
|
-
|
|
2
|
+
import { type RuntimePlan } from "@aotter/mantle-runtime";
|
|
3
|
+
export type EmitMantleModuleRequest = {
|
|
3
4
|
readonly linked: LinkedManifestSet;
|
|
5
|
+
readonly plan?: never;
|
|
4
6
|
readonly namespace?: string;
|
|
5
|
-
}
|
|
7
|
+
} | {
|
|
8
|
+
readonly plan: RuntimePlan;
|
|
9
|
+
readonly linked?: never;
|
|
10
|
+
readonly namespace?: string;
|
|
11
|
+
};
|
|
6
12
|
export type EmitMantleModuleResult = {
|
|
7
13
|
readonly ok: true;
|
|
8
14
|
readonly source: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"emitMantleModule.d.ts","sourceRoot":"","sources":["../../src/codegen/emitMantleModule.ts"],"names":[],"mappings":"AAAA,OAAO,EAIL,KAAK,UAAU,EACf,KAAK,iBAAiB,EACvB,MAAM,qBAAqB,CAAC;
|
|
1
|
+
{"version":3,"file":"emitMantleModule.d.ts","sourceRoot":"","sources":["../../src/codegen/emitMantleModule.ts"],"names":[],"mappings":"AAAA,OAAO,EAIL,KAAK,UAAU,EACf,KAAK,iBAAiB,EACvB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAsB,KAAK,WAAW,EAAE,MAAM,wBAAwB,CAAC;AAE9E,MAAM,MAAM,uBAAuB,GAAG;IACpC,QAAQ,CAAC,MAAM,EAAE,iBAAiB,CAAC;IACnC,QAAQ,CAAC,IAAI,CAAC,EAAE,KAAK,CAAC;IACtB,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,CAAC;CAC7B,GAAG;IACF,QAAQ,CAAC,IAAI,EAAE,WAAW,CAAC;IAC3B,QAAQ,CAAC,MAAM,CAAC,EAAE,KAAK,CAAC;IACxB,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,CAAC;CAC7B,CAAC;AAEF,MAAM,MAAM,sBAAsB,GAC9B;IAAE,QAAQ,CAAC,EAAE,EAAE,IAAI,CAAC;IAAC,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAA;CAAE,GAC9C;IAAE,QAAQ,CAAC,EAAE,EAAE,KAAK,CAAC;IAAC,QAAQ,CAAC,WAAW,EAAE,SAAS,UAAU,EAAE,CAAA;CAAE,CAAC;AAoBxE,wBAAgB,qBAAqB,CAAC,SAAS,EAAE,MAAM,EAAE,KAAK,SAAc,GAAG,IAAI,CAIlF;AAED,6EAA6E;AAC7E,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,uBAAuB,GAAG,sBAAsB,CA6HzF"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { emitTypesFromManifests, manifestTypeIdentifier, validateDiagnostic, } from "@aotter/mantle-spec";
|
|
2
2
|
import { compileRuntimePlan } from "@aotter/mantle-runtime";
|
|
3
3
|
const GENERATED_NAMES = new Set([
|
|
4
4
|
"BootMantleRuntimeArgs",
|
|
@@ -26,18 +26,41 @@ export function assertMantleNamespace(namespace, label = "namespace") {
|
|
|
26
26
|
export function emitMantleModule(request) {
|
|
27
27
|
const namespace = request.namespace ?? "Mantle";
|
|
28
28
|
assertMantleNamespace(namespace);
|
|
29
|
-
const
|
|
29
|
+
const entries = "linked" in request && request.linked
|
|
30
|
+
? request.linked
|
|
31
|
+
: request.plan;
|
|
32
|
+
const collision = findIdentifierCollision(entries);
|
|
30
33
|
if (collision)
|
|
31
34
|
return { ok: false, diagnostics: [collision] };
|
|
32
|
-
|
|
33
|
-
if (
|
|
34
|
-
|
|
35
|
-
|
|
35
|
+
let plan;
|
|
36
|
+
if ("plan" in request && request.plan) {
|
|
37
|
+
plan = request.plan;
|
|
38
|
+
}
|
|
39
|
+
else {
|
|
40
|
+
const compiled = compileRuntimePlan(request.linked);
|
|
41
|
+
if (!compiled.ok)
|
|
42
|
+
return { ok: false, diagnostics: compiled.diagnostics };
|
|
43
|
+
plan = compiled.value;
|
|
44
|
+
}
|
|
36
45
|
const schemas = sortedValues(plan.schemas);
|
|
37
46
|
const views = sortedValues(plan.views);
|
|
38
47
|
const procedures = sortedValues(plan.procedures);
|
|
39
48
|
const triggers = sortedValues(plan.triggers);
|
|
40
|
-
const
|
|
49
|
+
const typeSchemas = "linked" in request && request.linked
|
|
50
|
+
? request.linked.schemas.map(({ manifest }) => manifest)
|
|
51
|
+
: Object.values(plan.schemas).map(({ manifest }) => manifest);
|
|
52
|
+
const typeProcedures = "linked" in request && request.linked
|
|
53
|
+
? request.linked.procedures.map(({ manifest }) => manifest)
|
|
54
|
+
: Object.values(plan.procedures).map(({ manifest }) => manifest);
|
|
55
|
+
const typeViews = "linked" in request && request.linked
|
|
56
|
+
? request.linked.views.map(({ manifest }) => manifest)
|
|
57
|
+
: Object.values(plan.views).map(({ manifest }) => manifest);
|
|
58
|
+
const generatedTypes = emitTypesFromManifests({
|
|
59
|
+
schemas: typeSchemas,
|
|
60
|
+
procedures: typeProcedures,
|
|
61
|
+
views: typeViews,
|
|
62
|
+
namespace,
|
|
63
|
+
}).source
|
|
41
64
|
.replace(/^\/\/ Generated by `mantle-spec emit-types`\. Do not edit by hand\.\n\n/, "")
|
|
42
65
|
.trimEnd();
|
|
43
66
|
const handlerTypes = handlerContractLines(procedures, namespace);
|
|
@@ -215,10 +238,10 @@ function handlerContractLines(procedures, namespace) {
|
|
|
215
238
|
}
|
|
216
239
|
function findIdentifierCollision(linked) {
|
|
217
240
|
const groups = [
|
|
218
|
-
["entries", linked.schemas],
|
|
219
|
-
["views", linked.views],
|
|
220
|
-
["procedures", linked.procedures],
|
|
221
|
-
["triggers", linked.triggers],
|
|
241
|
+
["entries", values(linked.schemas)],
|
|
242
|
+
["views", values(linked.views)],
|
|
243
|
+
["procedures", values(linked.procedures)],
|
|
244
|
+
["triggers", values(linked.triggers)],
|
|
222
245
|
];
|
|
223
246
|
for (const [group, entries] of groups) {
|
|
224
247
|
const seen = new Map();
|
|
@@ -230,7 +253,11 @@ function findIdentifierCollision(linked) {
|
|
|
230
253
|
seen.set(identifier, name);
|
|
231
254
|
continue;
|
|
232
255
|
}
|
|
233
|
-
const
|
|
256
|
+
const authoredSource = "source" in entry ? entry.source : undefined;
|
|
257
|
+
const source = {
|
|
258
|
+
...(authoredSource ?? { sourceId: "runtime-plan", documentIndex: 0 }),
|
|
259
|
+
path: "/metadata/name",
|
|
260
|
+
};
|
|
234
261
|
return validateDiagnostic({
|
|
235
262
|
code: "CODEGEN_IDENTIFIER_COLLISION",
|
|
236
263
|
severity: "error",
|
|
@@ -245,6 +272,9 @@ function findIdentifierCollision(linked) {
|
|
|
245
272
|
}
|
|
246
273
|
return undefined;
|
|
247
274
|
}
|
|
275
|
+
function values(entries) {
|
|
276
|
+
return Array.isArray(entries) ? entries : Object.values(entries);
|
|
277
|
+
}
|
|
248
278
|
function sortedValues(record) {
|
|
249
279
|
return Object.values(record).sort((a, b) => compareText(a.name, b.name));
|
|
250
280
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"emitMantleModule.js","sourceRoot":"","sources":["../../src/codegen/emitMantleModule.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,gBAAgB,EAChB,sBAAsB,EACtB,kBAAkB,GAGnB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,kBAAkB,EAAoB,MAAM,wBAAwB,CAAC;AAW9E,MAAM,eAAe,GAAG,IAAI,GAAG,CAAC;IAC9B,uBAAuB;IACvB,mBAAmB;IACnB,qBAAqB;IACrB,iBAAiB;IACjB,aAAa;IACb,kBAAkB;IAClB,gBAAgB;IAChB,mBAAmB;IACnB,uBAAuB;IACvB,kBAAkB;IAClB,YAAY;IACZ,mBAAmB;IACnB,cAAc;IACd,MAAM;IACN,iBAAiB;CAClB,CAAC,CAAC;AAEH,MAAM,UAAU,qBAAqB,CAAC,SAAiB,EAAE,KAAK,GAAG,WAAW;IAC1E,IAAI,CAAC,4BAA4B,CAAC,IAAI,CAAC,SAAS,CAAC,IAAI,eAAe,CAAC,GAAG,CAAC,SAAS,CAAC,EAAE,CAAC;QACpF,MAAM,IAAI,KAAK,CAAC,GAAG,KAAK,sDAAsD,IAAI,CAAC,SAAS,CAAC,SAAS,CAAC,EAAE,CAAC,CAAC;IAC7G,CAAC;AACH,CAAC;AAED,6EAA6E;AAC7E,MAAM,UAAU,gBAAgB,CAAC,OAAgC;IAC/D,MAAM,SAAS,GAAG,OAAO,CAAC,SAAS,IAAI,QAAQ,CAAC;IAChD,qBAAqB,CAAC,SAAS,CAAC,CAAC;IACjC,MAAM,SAAS,GAAG,uBAAuB,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;IAC1D,IAAI,SAAS;QAAE,OAAO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
3
3
|
## Status
|
|
4
4
|
|
|
5
5
|
Accepted. Amended 2026-05-14, 2026-05-15, 2026-06-30, 2026-07-15,
|
|
6
|
-
2026-08-03, 2026-08-22, 2026-09-18, and 2026-09-
|
|
6
|
+
2026-08-03, 2026-08-22, 2026-09-18, 2026-09-21, and 2026-09-22.
|
|
7
7
|
|
|
8
8
|
## Date
|
|
9
9
|
|
|
10
|
-
2026-05-09 (last amended 2026-09-
|
|
10
|
+
2026-05-09 (last amended 2026-09-22)
|
|
11
11
|
|
|
12
12
|
> **Current authority:** the original decision below records the rejected
|
|
13
13
|
> Better-Auth-for-MCP design. The 2026-08-22 Better Auth 1.7 amendment is
|
|
@@ -168,6 +168,8 @@ The internal consumers of `Auth` (post-#193: `mountServerEndpoints`, `createMcpA
|
|
|
168
168
|
|
|
169
169
|
**Anti-pattern to refuse in review: Better Auth-field pass-through.**
|
|
170
170
|
|
|
171
|
+
> **Narrowed by the 2026-09-22 amendment** for `OAuthProviderConfig.extensions`, Better Auth's declared OAuth-provider composition point. See § "2026-09-22 amendment" below.
|
|
172
|
+
|
|
171
173
|
If a future PR's only effect is to rename a Better Auth field into our `CreateAuthConfig` and forward it verbatim, refuse it. **Picking a different literal default for an existing Better Auth field does NOT, by itself, justify a new field on `CreateAuthConfig` — that's the same pass-through dressed up.** The SDK adds load-bearing surface area only when the new field exists for at least one of these concrete reasons:
|
|
172
174
|
|
|
173
175
|
- **Workers-aware behavior** that Better Auth doesn't supply (e.g. `rateLimit` flipped on by default when an email-shaped method registers — Better Auth's per-route limits gate on `process.env.NODE_ENV === "production"` which is unset on Workers; `advanced.backgroundTasks.handler` wired to fire-and-forget — closes the timing-oracle on OTP send).
|
|
@@ -722,7 +724,8 @@ Cloudflare deployments may pass their deployment-owned KV namespace as
|
|
|
722
724
|
keeping the canonical session row in D1. OTP verification remains D1-backed
|
|
723
725
|
and rate limiting remains isolate-local because Workers KV does not provide
|
|
724
726
|
the atomic consume or increment operations those paths require. Auth keys use
|
|
725
|
-
the `better-auth
|
|
727
|
+
the `better-auth:<store-instance-id>:` prefix so replacing D1 makes the old
|
|
728
|
+
store's cached sessions unreachable while the namespace can still hold Mantle projections.
|
|
726
729
|
Session revocation and user updates use Better Auth's cache invalidation and
|
|
727
730
|
therefore follow Workers KV's propagation model.
|
|
728
731
|
|
|
@@ -862,3 +865,36 @@ in a later refactor:
|
|
|
862
865
|
`415` to anything else, so an HTML form (whose enctypes cannot produce that
|
|
863
866
|
header) can never drive a cookie session on `/mcp`; the same-origin guard
|
|
864
867
|
remains the second layer.
|
|
868
|
+
|
|
869
|
+
## 2026-09-22 amendment — OAuth provider extensions are an adopter seam
|
|
870
|
+
|
|
871
|
+
Issue #1016 supersedes the 2026-05-14 "Better Auth-field pass-through"
|
|
872
|
+
prohibition for one field: `OAuthProviderConfig.extensions`, forwarded to
|
|
873
|
+
`@better-auth/oauth-provider`'s `extensions` option. It follows the 2026-09-18
|
|
874
|
+
line that already exposes official Better Auth options and plugin instances
|
|
875
|
+
rather than copying them.
|
|
876
|
+
|
|
877
|
+
Why this is not the refused pattern: an `OAuthProviderExtension` is Better
|
|
878
|
+
Auth's declared composition point for token grants, client-authentication
|
|
879
|
+
strategies, discovery metadata and additional claims. MCP Enterprise-Managed
|
|
880
|
+
Authorization needs a `jwt-bearer` (ID-JAG) grant whose issuer and JWKS belong
|
|
881
|
+
to one enterprise IdP; that is adopter configuration, not an SDK default, and
|
|
882
|
+
Core has no business knowing the issuer. Curating a first-class
|
|
883
|
+
`enterpriseIdp` field would put an IdP contract inside Core and still forward
|
|
884
|
+
it verbatim underneath. The reference implementation lives outside Core
|
|
885
|
+
(`@aotterclam/id-jag`).
|
|
886
|
+
|
|
887
|
+
Boundaries that stay:
|
|
888
|
+
|
|
889
|
+
- Core's own claims extension (`mantle_consent_id`) is always first on the
|
|
890
|
+
`mcpResource` branch; adopter extensions append after it and cannot replace
|
|
891
|
+
it. Better Auth's contract makes claims contributors additive, so an
|
|
892
|
+
extension cannot overwrite identity or AS-owned claims either way.
|
|
893
|
+
- `createMantleAuth` still owns login and consent pages, CIMD/DCR policy,
|
|
894
|
+
`mcpResource`, scopes and resources. `extensions` adds grants and strategies
|
|
895
|
+
beside those; it is not a `Partial<OAuthOptions>` merge and cannot change
|
|
896
|
+
them.
|
|
897
|
+
- Tokens an extension issues go through the provider's shared token path, so
|
|
898
|
+
`verifyOAuthAccessToken`, DPoP binding and the MCP challenge are unchanged.
|
|
899
|
+
- No other Better Auth field gains a passthrough by this amendment. The
|
|
900
|
+
2026-05-14 test still applies to the next proposal.
|
|
@@ -262,6 +262,51 @@ request—DPoP proof binding with database-backed replay protection. It returns
|
|
|
262
262
|
only `userId`, `clientId`, `credentialId`, and scopes. Opaque tokens are
|
|
263
263
|
rejected; there is no introspection fallback.
|
|
264
264
|
|
|
265
|
+
## Enterprise-Managed Authorization
|
|
266
|
+
|
|
267
|
+
MCP's [Enterprise-Managed Authorization](https://modelcontextprotocol.io/extensions/auth/enterprise-managed-authorization)
|
|
268
|
+
extension lets an enterprise IdP decide which employees may reach an MCP
|
|
269
|
+
server. The MCP client exchanges the user's IdP login for an ID-JAG (identity
|
|
270
|
+
assertion authorization grant) and presents it to the server's token endpoint
|
|
271
|
+
as `grant_type=urn:ietf:params:oauth:grant-type:jwt-bearer`; no consent page
|
|
272
|
+
is shown. Everything after that is an ordinary access token.
|
|
273
|
+
|
|
274
|
+
Core does not know any issuer or JWKS. The token grant is a
|
|
275
|
+
`@better-auth/oauth-provider` extension supplied by the adopter through
|
|
276
|
+
`oauthProvider.extensions`, appended after Core's own claims extension:
|
|
277
|
+
|
|
278
|
+
```ts
|
|
279
|
+
import { identityAssertionAuthorizationGrant } from "@aotterclam/id-jag";
|
|
280
|
+
|
|
281
|
+
const auth = createAuth({
|
|
282
|
+
// database, baseURL, secret, methods...
|
|
283
|
+
oauthProvider: {
|
|
284
|
+
loginPage: "/admin/sign-in",
|
|
285
|
+
consentPage: "/oauth/consent",
|
|
286
|
+
scopes: ["mcp", "offline_access"],
|
|
287
|
+
mcpResource: env.PUBLIC_ORIGIN + "/mcp",
|
|
288
|
+
extensions: [
|
|
289
|
+
identityAssertionAuthorizationGrant({
|
|
290
|
+
issuer: env.ENTERPRISE_IDP_ISSUER,
|
|
291
|
+
jwksUrl: env.ENTERPRISE_IDP_JWKS_URL,
|
|
292
|
+
authorizationServer: env.PUBLIC_ORIGIN,
|
|
293
|
+
resource: env.PUBLIC_ORIGIN + "/mcp",
|
|
294
|
+
scopes: ["mcp"],
|
|
295
|
+
fetchJwks: (input, init) => fetch(input, { ...init, redirect: "manual" }),
|
|
296
|
+
}),
|
|
297
|
+
],
|
|
298
|
+
},
|
|
299
|
+
});
|
|
300
|
+
```
|
|
301
|
+
|
|
302
|
+
The extension validates the assertion's signature, issuer, audience and
|
|
303
|
+
lifetime, maps its subject to a user, and issues tokens through the provider's
|
|
304
|
+
shared token path, so `verifyOAuthAccessToken`, DPoP and the MCP challenge
|
|
305
|
+
behave exactly as for interactive grants. `@aotterclam/id-jag` is a reference
|
|
306
|
+
implementation, not a Core dependency; any `OAuthProviderExtension` works.
|
|
307
|
+
Extensions may also add client-authentication strategies, discovery metadata
|
|
308
|
+
and additional claims. The same passthrough applies without `mcpResource`.
|
|
309
|
+
|
|
265
310
|
## Source
|
|
266
311
|
- [`packages/adapters/cloudflare/README.md`](../../../packages/adapters/cloudflare/README.md)
|
|
267
312
|
- [`packages/adapters/cloudflare/src/auth/conventionalAuth.ts`](../../../packages/adapters/cloudflare/src/auth/conventionalAuth.ts)
|
|
@@ -40,6 +40,7 @@ export interface Env extends MantleCloudflareEnv {
|
|
|
40
40
|
readonly R2_ACCESS_KEY_ID?: string;
|
|
41
41
|
readonly R2_SECRET_ACCESS_KEY?: string;
|
|
42
42
|
readonly MEDIA_PUBLIC_URL_BASE?: string;
|
|
43
|
+
readonly AUDIT?: AnalyticsEngineDataset; // optional MCP tools/call audit trail
|
|
43
44
|
readonly MANTLE_INTERNAL_QUEUE?: Queue<DeferredHookEnvelope>; // optional deferred hooks
|
|
44
45
|
readonly ORDER_EXPIRY_QUEUE?: Queue<{ type: "expire-order"; orderToken: string }>; // application queue
|
|
45
46
|
readonly INVENTORY_COORDINATOR?: DurableObjectNamespace; // application-owned
|
|
@@ -101,6 +102,65 @@ A deployment-owned namespace that caches the caller-independent MCP catalog proj
|
|
|
101
102
|
|
|
102
103
|
Staff media uploads through Staff MCP presigned PUT. The binding alone cannot sign URLs; you also need `R2_ACCOUNT_ID`, `MEDIA_PUBLIC_URL_BASE` and the two S3 credential secrets. See [Media uploads with R2](./media-r2.md).
|
|
103
104
|
|
|
105
|
+
## Analytics Engine: `AUDIT` (optional)
|
|
106
|
+
|
|
107
|
+
```jsonc
|
|
108
|
+
"analytics_engine_datasets": [{ "binding": "AUDIT", "dataset": "mantle_mcp_audit" }]
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
An MCP `tools/call` audit trail: who called which tool on which surface, with
|
|
112
|
+
what outcome and how long it took. The runtime's `McpJsonRpcDispatcher` is the
|
|
113
|
+
single write point; it records nothing unless the composition root passes an
|
|
114
|
+
`AuditSink`, and the write happens through `waitUntil`, off the response path.
|
|
115
|
+
Request and response payloads are never recorded.
|
|
116
|
+
|
|
117
|
+
```ts
|
|
118
|
+
import { analyticsEngineAuditSink, createMantleWorker } from "@aotter/mantle/cloudflare";
|
|
119
|
+
|
|
120
|
+
export default createMantleWorker<Env>({
|
|
121
|
+
plan,
|
|
122
|
+
audit: (env) => env.AUDIT
|
|
123
|
+
? analyticsEngineAuditSink(env.AUDIT, { index: env.PUBLIC_ORIGIN })
|
|
124
|
+
: undefined,
|
|
125
|
+
});
|
|
126
|
+
```
|
|
127
|
+
|
|
128
|
+
One dataset may hold many deployments: `index` is the deployment's public
|
|
129
|
+
origin, the only column Analytics Engine filters cheaply. Columns, in order:
|
|
130
|
+
|
|
131
|
+
| Column | Field |
|
|
132
|
+
|---|---|
|
|
133
|
+
| `index1` | the configured `index` |
|
|
134
|
+
| `blob1` … `blob7` | `surface`, `callerId`, `clientId`, `credential`, `tool`, `outcome`, `operationId` |
|
|
135
|
+
| `double1`, `double2` | `at` (epoch ms), `durationMs` |
|
|
136
|
+
|
|
137
|
+
`outcome` is `ok`, a runtime Diagnostic code such as `UNAUTHENTICATED` or
|
|
138
|
+
`AUTH_DENIED`, `UNKNOWN_TOOL`, `INVALID_PARAMS`, `INTERNAL`, or a transport gate denial
|
|
139
|
+
(`INVALID_TOKEN`, `INSUFFICIENT_SCOPE`, `INSUFFICIENT_ROLE`, `CROSS_ORIGIN`): a
|
|
140
|
+
`tools/call` refused before it reaches the dispatcher is recorded too, with
|
|
141
|
+
whatever identity the gate established. Its body goes through the same 1 MiB
|
|
142
|
+
bounded reader as an admitted call; a denied request whose body is oversized
|
|
143
|
+
or not JSON is still recorded, with `tool` set to `(unreadable)`, so padding a
|
|
144
|
+
body cannot hide a credential probe. `operationId` is the string argument whose
|
|
145
|
+
schema declares `x-mcp-hint: idempotency-key`, falling back to the conventional
|
|
146
|
+
`operationId` argument when the tool declares no hint. It is empty when that
|
|
147
|
+
argument is absent and is resolved the same way on admitted and denied calls.
|
|
148
|
+
Read it with the
|
|
149
|
+
[SQL API](https://developers.cloudflare.com/analytics/analytics-engine/sql-api/):
|
|
150
|
+
|
|
151
|
+
```sql
|
|
152
|
+
SELECT timestamp, blob2 AS caller, blob5 AS tool, blob6 AS outcome, double2 AS ms
|
|
153
|
+
FROM mantle_mcp_audit
|
|
154
|
+
WHERE index1 IN ('https://site-a.example', 'https://site-b.example')
|
|
155
|
+
AND timestamp > NOW() - INTERVAL '7' DAY
|
|
156
|
+
ORDER BY timestamp DESC
|
|
157
|
+
```
|
|
158
|
+
|
|
159
|
+
Analytics Engine keeps data for a bounded window and samples under very high
|
|
160
|
+
write rates. Longer retention or a tamper-evident trail is an export job on top
|
|
161
|
+
of this dataset. Self-hosted runtimes may implement `AuditSink` over any store;
|
|
162
|
+
the interface is one `record(event)` method.
|
|
163
|
+
|
|
104
164
|
## Queues
|
|
105
165
|
|
|
106
166
|
```jsonc
|
|
@@ -51,7 +51,7 @@ Once per isolate, `createMantleWorker` assembles and memoizes:
|
|
|
51
51
|
- Conventional bindings: `DB` becomes the D1 driver, `ASSETS` serves the Admin bundle, `MANTLE_KV` (when bound) becomes the MCP catalog projection. See [Bindings](./bindings.md).
|
|
52
52
|
- Conventional Auth chosen by `MANTLE_AUTH_MODE`, or your `auth` factory. See [Authentication](./authentication.md).
|
|
53
53
|
- Runtime endpoints: manifest HTTP Triggers, `GET /api/views` and `GET /api/views/<name>` for public Views.
|
|
54
|
-
- Admin at `/admin` when Admin assets are present, OAuth consent and discovery, and MCP at `/mcp` and `/mcp/staff`.
|
|
54
|
+
- Admin at `/admin` when Admin assets are present, OAuth consent and discovery, and MCP at `/mcp` and `/mcp/staff`. The MCP transport is Streamable HTTP, POST-only: no session header, no server-initiated stream (`GET` answers `405`), and `tools/call` answers `401` with an OAuth challenge so a client can authenticate mid-session and retry. Verified against the official TypeScript client SDK `@modelcontextprotocol/client` 2.0.0 in the adapter's conformance test; that pin is the gate when the SDK is upgraded.
|
|
55
55
|
- A `/favicon.ico` route derived from `siteDefaults.icons`. This is a convention, not a reserved path; an existing host route wins.
|
|
56
56
|
- The final cache policy on every response, and best-effort purge of the deployment-scoped public tag after publishing-content and site-setting writes.
|
|
57
57
|
- A redacted error boundary: an unexpected failure returns `500` with `{ "ok": false, "error": "internal_error" }` and `private, no-store`.
|
|
@@ -36,6 +36,10 @@ pnpm exec mantle-harness indexes --require-public --format text
|
|
|
36
36
|
|
|
37
37
|
A required path fails on a required Schema-table scan, a temporary sort or an unindexed data-field predicate. Then dry-run and deploy:
|
|
38
38
|
|
|
39
|
+
This local SQLite check intentionally runs without planner statistics. Treat it
|
|
40
|
+
as a conservative preflight; use post-deploy D1 metrics for production cost and
|
|
41
|
+
latency claims.
|
|
42
|
+
|
|
39
43
|
```sh
|
|
40
44
|
wrangler deploy --dry-run
|
|
41
45
|
wrangler deploy
|
|
@@ -165,7 +165,7 @@ The umbrella installs Spec and Runtime only. Web, Admin, Auth, Admin UI, Bun, Ve
|
|
|
165
165
|
| `@aotter/mantle-spec` | `/spec` | Manifest grammar, parser, validators, JSON Schema to zod, site-config contract, diagnostic catalog. No environment, no IO. |
|
|
166
166
|
| `@aotter/mantle-runtime` | `/runtime` | Hexagonal runtime: domain ports, use cases, MCP catalog, storage helpers. No adapter dependencies. |
|
|
167
167
|
| — | `/runtime/testing` | Node-only crowded-SQLite planner and HTTP sampling helpers used by `mantle-harness`. |
|
|
168
|
-
| — | `/codegen` | The pure linked-manifests to typed-module emitter, with no IO. |
|
|
168
|
+
| — | `/codegen` | The pure linked-manifests or compiled-plan to typed-module emitter, with no IO. |
|
|
169
169
|
| `@aotter/mantle-web` | `/web` | HTML, Markdown, `llms.txt`, sitemap, SEO and preview composition. No routes, no platform dependencies. |
|
|
170
170
|
| `@aotter/mantle-admin` | `/admin` | Admin API, auth route mounting, OAuth pages, static-asset composition. |
|
|
171
171
|
| `@aotter/mantle-auth` | `/auth` | Host-neutral Better Auth identity, staff roles, and OAuth 2.1 / MCP authorization. Adapters own IP headers and storage bindings. |
|
|
@@ -154,7 +154,7 @@ One statement, read-only, compiled and bound by the runtime.
|
|
|
154
154
|
Bound params are passed as positional values; caller input is never interpolated into the statement. SQLite JSON functions are available, so `json_each` and `json_extract` can unnest and project array or object members of `data` — the SQL example above does both.
|
|
155
155
|
|
|
156
156
|
> **Warning**
|
|
157
|
-
> `sql` Views are native SQLite.
|
|
157
|
+
> `sql` Views are native SQLite. `mantle validate` prepares each statement against an empty SQLite database containing only the declared Schema tables; an undeclared table, syntax error or unknown column is `INVALID_MANIFEST_ENVELOPE` at `/spec/sql`. Programmatic validation runs the same check when the host supplies `sqlViewSandbox`; without that port it is deferred to the host's admission gate. On a storage adapter that does not support the native dialect the View fails at prepare time with `VIEW_DIALECT_UNSUPPORTED`, naming the dialects that adapter does support.
|
|
158
158
|
|
|
159
159
|
## `params`
|
|
160
160
|
|
|
@@ -205,6 +205,9 @@ Admin applies search and filters before pagination, rejecting a search term or f
|
|
|
205
205
|
|---|---|---|---|
|
|
206
206
|
| `public` | `GET /api/views/<name>`, plus a catalog at `GET /api/views` | `query_view_<segment>` on `/mcp` | Also mounted at `GET /admin/api/views/<name>` and `/export` behind the staff gate |
|
|
207
207
|
| `staff` | `GET /admin/api/views/<name>` and `/admin/api/views/<name>/export` — not mounted publicly | `query_view_<segment>` on `/mcp/staff` | Report sidebar |
|
|
208
|
+
| `internal` | Not mounted | Not mounted | Not listed or mounted |
|
|
209
|
+
|
|
210
|
+
An `internal` View remains in the compiled plan for host code to call through `MantleRuntime.executeView`. It is an exposure policy, not an authorization bypass: `requires` and guards still evaluate against the `ctx` supplied by the host. Shared HTTP caching is invalid because no adapter owns an HTTP response for the View.
|
|
208
211
|
|
|
209
212
|
A `public` declarative View over a `publishing` Schema reads **published rows only**, on every transport. The runtime adds `status = published` to the compiled query whether or not the filter spells it out; writing it is allowed and redundant, and comparing `status` to any other value is rejected at validate time (`VIEW_PUBLIC_STATUS_INVALID`). Staff Views see every status. `operational` Schemas create rows as `published`, so nothing is added. SQL Views (`spec.sql`) are the author's own statement and receive no injected predicate. Decision record: ADR-0025.
|
|
210
213
|
|
|
@@ -55,6 +55,13 @@ data-field predicate/order that does not use a declared Schema index.
|
|
|
55
55
|
Projection alone does not require an index. `mantle validate` remains a pure
|
|
56
56
|
correctness check; no performance grammar or manifest atom was added.
|
|
57
57
|
|
|
58
|
+
The fixture follows each Schema lifecycle: operational rows are immediately
|
|
59
|
+
published, while publishing Schemas contain both draft and published rows. The
|
|
60
|
+
harness deliberately does not run `ANALYZE` or `PRAGMA optimize`, so it cannot
|
|
61
|
+
turn an unprepared production plan into a local pass. This is a conservative
|
|
62
|
+
SQLite preflight, not proof of D1 rows-read, Worker CPU, or IndexedDB behavior;
|
|
63
|
+
measure those on the target backend before making a performance claim.
|
|
64
|
+
|
|
58
65
|
Use the machine report in CI. It includes the compiled SQL and parameters,
|
|
59
66
|
query-plan details, named indexes, scan/sort flags, result count, SQLite
|
|
60
67
|
version, fixture row count, and required-failure summary.
|
|
@@ -6,7 +6,7 @@ Runtime. This Spec-only path is allowed by
|
|
|
6
6
|
[ADR-0019](adr/0019-sealed-manifest-runtime-pipeline.md), not a new adapter,
|
|
7
7
|
manifest grammar, or fork of Core.
|
|
8
8
|
|
|
9
|
-
This recipe targets `0.1.3-alpha.
|
|
9
|
+
This recipe targets `0.1.3-alpha.6`. Pin the package, record the tested version, and
|
|
10
10
|
rerun compatibility checks when upgrading.
|
|
11
11
|
|
|
12
12
|
## What stays with the host
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aotter/mantle",
|
|
3
|
-
"version": "0.1.3-alpha.
|
|
3
|
+
"version": "0.1.3-alpha.6",
|
|
4
4
|
"description": "Embeddable Mantle Core umbrella with Spec and Runtime; Web, Admin, Auth, Bun, Vercel, Cloudflare, and Admin UI are optional peer packages.",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"homepage": "https://mantle.tools/",
|
|
@@ -83,8 +83,8 @@
|
|
|
83
83
|
"README.md"
|
|
84
84
|
],
|
|
85
85
|
"dependencies": {
|
|
86
|
-
"@aotter/mantle-runtime": "0.1.3-alpha.
|
|
87
|
-
"@aotter/mantle-spec": "0.1.3-alpha.
|
|
86
|
+
"@aotter/mantle-runtime": "0.1.3-alpha.6",
|
|
87
|
+
"@aotter/mantle-spec": "0.1.3-alpha.6"
|
|
88
88
|
},
|
|
89
89
|
"peerDependencies": {
|
|
90
90
|
"aws4fetch": "^1.0.20",
|
|
@@ -92,13 +92,13 @@
|
|
|
92
92
|
"hono": "^4.12.0",
|
|
93
93
|
"@libsql/client": "^0.17.4",
|
|
94
94
|
"zod": "^4.5.0",
|
|
95
|
-
"@aotter/mantle-admin
|
|
96
|
-
"@aotter/mantle-
|
|
97
|
-
"@aotter/mantle-
|
|
98
|
-
"@aotter/mantle-bun": "0.1.3-alpha.
|
|
99
|
-
"@aotter/mantle-vercel": "0.1.3-alpha.
|
|
100
|
-
"@aotter/mantle-
|
|
101
|
-
"@aotter/mantle-
|
|
95
|
+
"@aotter/mantle-admin": "0.1.3-alpha.6",
|
|
96
|
+
"@aotter/mantle-auth": "0.1.3-alpha.6",
|
|
97
|
+
"@aotter/mantle-admin-ui": "0.1.3-alpha.6",
|
|
98
|
+
"@aotter/mantle-bun": "0.1.3-alpha.6",
|
|
99
|
+
"@aotter/mantle-vercel": "0.1.3-alpha.6",
|
|
100
|
+
"@aotter/mantle-cloudflare": "0.1.3-alpha.6",
|
|
101
|
+
"@aotter/mantle-web": "0.1.3-alpha.6"
|
|
102
102
|
},
|
|
103
103
|
"peerDependenciesMeta": {
|
|
104
104
|
"@aotter/mantle-admin": {
|
|
@@ -144,13 +144,13 @@
|
|
|
144
144
|
"typescript": "^6.0.3",
|
|
145
145
|
"vitest": "^4.1.11",
|
|
146
146
|
"zod": "^4.5.4",
|
|
147
|
-
"@aotter/mantle-admin": "0.1.3-alpha.
|
|
148
|
-
"@aotter/mantle-admin-ui": "0.1.3-alpha.
|
|
149
|
-
"@aotter/mantle-auth": "0.1.3-alpha.
|
|
150
|
-
"@aotter/mantle-bun": "0.1.3-alpha.
|
|
151
|
-
"@aotter/mantle-
|
|
152
|
-
"@aotter/mantle-
|
|
153
|
-
"@aotter/mantle-
|
|
147
|
+
"@aotter/mantle-admin": "0.1.3-alpha.6",
|
|
148
|
+
"@aotter/mantle-admin-ui": "0.1.3-alpha.6",
|
|
149
|
+
"@aotter/mantle-auth": "0.1.3-alpha.6",
|
|
150
|
+
"@aotter/mantle-bun": "0.1.3-alpha.6",
|
|
151
|
+
"@aotter/mantle-cloudflare": "0.1.3-alpha.6",
|
|
152
|
+
"@aotter/mantle-web": "0.1.3-alpha.6",
|
|
153
|
+
"@aotter/mantle-vercel": "0.1.3-alpha.6"
|
|
154
154
|
},
|
|
155
155
|
"engines": {
|
|
156
156
|
"node": ">=22"
|