@aotter/mantle 0.1.3-alpha.5 → 0.1.3
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/cli/main.d.ts +1 -1
- package/dist/cli/main.d.ts.map +1 -1
- package/dist/cli/main.js +3 -1
- package/dist/cli/main.js.map +1 -1
- package/dist/cli/skills.js +1 -1
- package/dist/cli/skills.js.map +1 -1
- 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 +2 -1
- package/docs/agent-prompts.md +6 -5
- package/docs/consumer-onboarding-audit.md +65 -0
- package/docs/handbook/cloudflare/authentication.md +16 -0
- package/docs/handbook/cloudflare/bindings.md +5 -3
- package/docs/handbook/cloudflare/deploy-and-operate.md +4 -0
- package/docs/handbook/concepts/mcp-and-agents.md +1 -1
- package/docs/handbook/concepts/runtime-and-adapters.md +1 -1
- package/docs/handbook/concepts/views.md +8 -7
- package/docs/handbook/guides/admin-ui.md +135 -0
- package/docs/handbook/guides/agent-setup.md +96 -0
- package/docs/handbook/guides/typed-queries.md +161 -0
- package/docs/handbook/navigation.json +24 -14
- package/docs/handbook/reference/features.md +55 -0
- package/docs/handbook/reference/manifest.md +3 -1
- package/docs/handbook/reference/schema.md +1 -1
- package/docs/handbook/reference/surface.md +2 -2
- package/docs/handbook/reference/view.md +8 -3
- package/docs/handbook/releases/index.md +45 -1
- package/docs/handbook/start/overview.md +52 -0
- package/docs/handbook/start/project-and-cli.md +2 -2
- package/docs/handbook/start/quickstart-worker.md +8 -3
- package/docs/performance-harness.md +7 -0
- package/docs/spec-only-host-adoption.md +1 -1
- package/package.json +17 -17
- package/skills/README.md +5 -1
- package/skills/develop/SKILL.md +19 -2
- package/skills/install/SKILL.md +23 -3
- package/skills/plugin/SKILL.md +17 -5
- package/skills/theme/SKILL.md +8 -1
- package/skills/update/SKILL.md +7 -2
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
|
|
19
|
+
from `package.json` (currently `0.1.3`):
|
|
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";
|
package/dist/cli/main.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
export declare const MANTLE_OVERVIEW = "mantle \u2014 compile manifests into a RuntimePlan and typed binding\n\nOverview\n Optional surfaces \u2014 take only what you need. Admin is opt-in. You can ship a\n complete service with no Dev UI, no visitor frontend, and no extra packages.\n\n Minimal \u2014 Spec + generate\n validate + generate compile manifests into a sealed plan and typed binding.\n Embed that binding in an existing host. No Admin, no visitor UI.\n\n Runtime / adapter\n Bind Runtime through an adapter (Cloudflare Worker, Bun, Vercel, or yours).\n HTTP Views, MCP, and Auth work without Admin.\n See docs/examples/host-minimal-worker or\n node_modules/@aotter/mantle/docs/examples/host-minimal-worker.\n\n Opt-in \u2014 Admin / Dev UI\n Add @aotter/mantle-admin and @aotter/mantle-admin-ui only when humans need\n a console. Then re-run generate, bind wrangler ASSETS, and open\n /admin/sign-in (local email OTP via ConsoleEmailSender).\n See docs/examples/host-local-admin-otp or\n node_modules/@aotter/mantle/docs/examples/host-local-admin-otp.\n\n Further (ask the subcommand for details)\n skills project version-matched agent instructions\n emit-openapi OpenAPI 3.1 from HTTP Triggers and Views\n mantle-harness measure indexes and live HTTP (separate binary)\n\nUsage: mantle <subcommand> [options]\n\nSubcommands:\n generate Compile manifests into a typed runtime binding\n validate Static manifest and handler-source validation\n skills Project version-matched Core skills\n emit-openapi Emit OpenAPI 3.1 from Triggers and Views\n\nDocumentation:\n
|
|
2
|
+
export declare const MANTLE_OVERVIEW = "mantle \u2014 compile manifests into a RuntimePlan and typed binding\n\nOverview\n Optional surfaces \u2014 take only what you need. Admin is opt-in. You can ship a\n complete service with no Dev UI, no visitor frontend, and no extra packages.\n\n Minimal \u2014 Spec + generate\n validate + generate compile manifests into a sealed plan and typed binding.\n Embed that binding in an existing host. No Admin, no visitor UI.\n\n Runtime / adapter\n Bind Runtime through an adapter (Cloudflare Worker, Bun, Vercel, or yours).\n HTTP Views, MCP, and Auth work without Admin.\n See docs/examples/host-minimal-worker or\n node_modules/@aotter/mantle/docs/examples/host-minimal-worker.\n\n Opt-in \u2014 Admin / Dev UI\n Add @aotter/mantle-admin and @aotter/mantle-admin-ui only when humans need\n a console. Then re-run generate, bind wrangler ASSETS, and open\n /admin/sign-in (local email OTP via ConsoleEmailSender).\n See docs/examples/host-local-admin-otp or\n node_modules/@aotter/mantle/docs/examples/host-local-admin-otp.\n\n Further (ask the subcommand for details)\n skills project version-matched agent instructions\n emit-openapi OpenAPI 3.1 from HTTP Triggers and Views\n mantle-harness measure indexes and live HTTP (separate binary)\n\nUsage: mantle <subcommand> [options]\n\nSubcommands:\n generate Compile manifests into a typed runtime binding\n validate Static manifest and handler-source validation\n skills Project version-matched Core skills\n emit-openapi Emit OpenAPI 3.1 from Triggers and Views\n\nDocumentation:\n Start: node_modules/@aotter/mantle/docs/handbook/start/overview.md\n Features: node_modules/@aotter/mantle/docs/handbook/reference/features.md\n Admin UI: node_modules/@aotter/mantle/docs/handbook/guides/admin-ui.md\n Online: https://mantle.tools/\n Install skill: npx skills add aotter/mantle --skill install\n";
|
|
3
3
|
//# sourceMappingURL=main.d.ts.map
|
package/dist/cli/main.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"main.d.ts","sourceRoot":"","sources":["../../src/cli/main.ts"],"names":[],"mappings":";AAgCA,eAAO,MAAM,eAAe,
|
|
1
|
+
{"version":3,"file":"main.d.ts","sourceRoot":"","sources":["../../src/cli/main.ts"],"names":[],"mappings":";AAgCA,eAAO,MAAM,eAAe,g7DA0C3B,CAAC"}
|
package/dist/cli/main.js
CHANGED
|
@@ -62,7 +62,9 @@ Subcommands:
|
|
|
62
62
|
emit-openapi Emit OpenAPI 3.1 from Triggers and Views
|
|
63
63
|
|
|
64
64
|
Documentation:
|
|
65
|
-
|
|
65
|
+
Start: node_modules/@aotter/mantle/docs/handbook/start/overview.md
|
|
66
|
+
Features: node_modules/@aotter/mantle/docs/handbook/reference/features.md
|
|
67
|
+
Admin UI: node_modules/@aotter/mantle/docs/handbook/guides/admin-ui.md
|
|
66
68
|
Online: https://mantle.tools/
|
|
67
69
|
Install skill: npx skills add aotter/mantle --skill install
|
|
68
70
|
`;
|
package/dist/cli/main.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"main.js","sourceRoot":"","sources":["../../src/cli/main.ts"],"names":[],"mappings":";AACA,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AACpD,OAAO,EACL,cAAc,EACd,WAAW,GACZ,MAAM,yBAAyB,CAAC;AACjC,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC5C,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAExC,KAAK,UAAU,IAAI;IACjB,MAAM,OAAO,GAAG,IAAI,CAAC,CAAC,CAAC,CAAC;IACxB,IAAI,CAAC,OAAO,IAAI,OAAO,KAAK,QAAQ,IAAI,OAAO,KAAK,IAAI,EAAE,CAAC;QACzD,MAAM,CAAC,KAAK,CAAC,GAAG,eAAe;CAClC,CAAC,CAAC;QACC,OAAO,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;IACzB,CAAC;IACD,MAAM,IAAI,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;IAC3B,QAAQ,OAAO,EAAE,CAAC;QAChB,KAAK,UAAU;YACb,OAAO,WAAW,CAAC,IAAI,CAAC,CAAC;QAC3B,KAAK,QAAQ;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,CAAC,IAAI,CAAC,CAAC;QAC9B;YACE,MAAM,CAAC,KAAK,CAAC,uBAAuB,OAAO,IAAI,CAAC,CAAC;YACjD,OAAO,CAAC,CAAC;IACb,CAAC;AACH,CAAC;AAED,MAAM,CAAC,MAAM,eAAe,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA0C9B,CAAC;AAEF,IAAI,EAAE,CAAC,IAAI,CACT,CAAC,IAAI,EAAE,EAAE;IACP,OAAO,CAAC,QAAQ,GAAG,IAAI,CAAC;AAC1B,CAAC,EACD,CAAC,KAAK,EAAE,EAAE;IACR,MAAM,CAAC,KAAK,CAAC,mBAAmB,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,KAAK,IAAI,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;IAC3G,OAAO,CAAC,QAAQ,GAAG,CAAC,CAAC;AACvB,CAAC,CACF,CAAC"}
|
package/dist/cli/skills.js
CHANGED
|
@@ -59,7 +59,7 @@ export async function runSkills(rawArgs) {
|
|
|
59
59
|
return 1;
|
|
60
60
|
}
|
|
61
61
|
if (!check)
|
|
62
|
-
stdout.write(`Mantle skills projected: ${skills.join(", ")}.\n`);
|
|
62
|
+
stdout.write(`Mantle skills projected: ${skills.join(", ")}.\nRead .agents/skills/mantle-develop/SKILL.md and node_modules/@aotter/mantle/docs/handbook/start/overview.md.\n`);
|
|
63
63
|
return 0;
|
|
64
64
|
}
|
|
65
65
|
catch (error) {
|
package/dist/cli/skills.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"skills.js","sourceRoot":"","sources":["../../src/cli/skills.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,QAAQ,EAAE,IAAI,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAC7E,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE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,CAAC"}
|
|
@@ -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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I,EAAE,KAAK,EAAE,EAAE,CACvC,KAAK,KAAK,CAAC;QACT,CAAC,CAAC,IAAI,CAAC,CAAC,CAAE,CAAC,WAAW,EAAE,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC;QACxC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAE,CAAC,WAAW,EAAE,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAC3C,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;IACX,OAAO,aAAa,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,IAAI,MAAM,EAAE,CAAC;AAC5D,CAAC"}
|
|
@@ -724,7 +724,8 @@ Cloudflare deployments may pass their deployment-owned KV namespace as
|
|
|
724
724
|
keeping the canonical session row in D1. OTP verification remains D1-backed
|
|
725
725
|
and rate limiting remains isolate-local because Workers KV does not provide
|
|
726
726
|
the atomic consume or increment operations those paths require. Auth keys use
|
|
727
|
-
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.
|
|
728
729
|
Session revocation and user updates use Better Auth's cache invalidation and
|
|
729
730
|
therefore follow Workers KV's propagation model.
|
|
730
731
|
|
package/docs/agent-prompts.md
CHANGED
|
@@ -8,11 +8,11 @@ npx skills add aotter/mantle --skill install
|
|
|
8
8
|
|
|
9
9
|
Copy one block into a coding agent after that skill is present. Paths below
|
|
10
10
|
are relative to the Mantle docs root: `node_modules/@aotter/mantle/docs/`
|
|
11
|
-
after `@aotter/mantle` is installed
|
|
11
|
+
after `@aotter/mantle` is installed. A standalone `skills add` installation
|
|
12
|
+
contains only the selected skill, not these docs.
|
|
12
13
|
`npx --no-install mantle --help` is the layered CLI overview; it mirrors the
|
|
13
14
|
authoring docs. A live `/mcp` catalog mirrors the Manifest → RuntimePlan, not
|
|
14
|
-
the CLI.
|
|
15
|
-
ChatGPT Sites. There is no `mantle create`. Empty `generate` fails until
|
|
15
|
+
the CLI. Resolve only missing requirements first; do not assume a host. There is no `mantle create`. Empty `generate` fails until
|
|
16
16
|
manifests exist. Admin is opt-in.
|
|
17
17
|
|
|
18
18
|
### Interview then build
|
|
@@ -21,8 +21,9 @@ manifests exist. Admin is opt-in.
|
|
|
21
21
|
Interview me about the service: host, who uses it, whether humans need a
|
|
22
22
|
Dev UI, and whether we only embed Spec/Runtime. If the install skill is
|
|
23
23
|
missing, run npx skills add aotter/mantle --skill install. Read the
|
|
24
|
-
|
|
25
|
-
|
|
24
|
+
installer-reported skill, choose and install an exact SDK version, then read
|
|
25
|
+
its embedded skills/install/SKILL.md, run npx --no-install mantle --help, and
|
|
26
|
+
read handbook/start/overview.md.
|
|
26
27
|
Use examples/README.md as the examples index; copy builtin-* Manifests only
|
|
27
28
|
(not cf-primitives-*). Implement locally first. Take only the surfaces we
|
|
28
29
|
chose. For Spec-only use, skip Runtime and code generation. For a Worker
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
# Consumer onboarding audit for 0.1.3
|
|
2
|
+
|
|
3
|
+
Scope: source skill install → pinned npm package → CLI → generated skills and
|
|
4
|
+
handbook → application manifest and Admin customization. This is maintainer
|
|
5
|
+
evidence, not a release announcement. Baseline: develop `b90cebbd`, package
|
|
6
|
+
version `0.1.3-alpha.5`; the package version alone does not identify unreleased
|
|
7
|
+
commits on develop. Tracking: [#1042](https://github.com/aotter/mantle/issues/1042).
|
|
8
|
+
|
|
9
|
+
## Clean source install
|
|
10
|
+
|
|
11
|
+
Executed in an empty temporary directory:
|
|
12
|
+
|
|
13
|
+
```sh
|
|
14
|
+
npx --yes skills add aotter/mantle --skill install --agent codex --yes
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
Observed output: repository cloned, **7 skills found**, **1 selected**, copied
|
|
18
|
+
to `./.agents/skills/install`. `skills-lock.json` records source `aotter/mantle`,
|
|
19
|
+
source type `github`, and source path `skills/install/SKILL.md`. The installed
|
|
20
|
+
file's hash in that lock was
|
|
21
|
+
`8a6fd26aea97ae8bdf3e05fef22196c247b3f95aa049204a6ac51259d87e4e29`.
|
|
22
|
+
No SDK, handbook or application is installed by that command. The explicit
|
|
23
|
+
Codex and noninteractive flags make the audited destination reproducible;
|
|
24
|
+
other selected agents/global scope can use another destination.
|
|
25
|
+
|
|
26
|
+
This source install follows the repository's default ref. It does not test the
|
|
27
|
+
unreleased edits in this PR or establish an npm version. The packed-consumer
|
|
28
|
+
check below tests this branch's shipped instructions separately.
|
|
29
|
+
|
|
30
|
+
## White-box path and fixes
|
|
31
|
+
|
|
32
|
+
| Stage / owner | Finding before this change | Correction |
|
|
33
|
+
|---|---|---|
|
|
34
|
+
| README → external skills installer | Prompt told the agent to read `skills/install/SKILL.md` and `docs/agent-prompts.md`, neither installed there. | Read the installer-reported destination, then the installed SDK's embedded docs. |
|
|
35
|
+
| `skills/install/SKILL.md` | Bootstrap Git instructions did not explicitly hand off to the installed package's own install skill; `docs/...` root was implicit. Host interview was repeated. | Explicit package-root resolution and version authority; ask only for missing requirements. |
|
|
36
|
+
| Install → CLI | It was possible to try the local CLI before installing Core; `generate` in an empty directory fails rather than creating a project. | Spell out package installation before CLI and manifest authoring before generation. |
|
|
37
|
+
| Quickstart versions | Floating `latest` dependency examples contradicted exact-pin advice. | Resolve the requested channel once and save exact Mantle versions before the first build. |
|
|
38
|
+
| `mantle skills` | Correctly projected four project skills, but success output did not tell the agent what to read next. | Print the projected develop skill and installed handbook entry. Document overwrite, drift and opt-in behavior. |
|
|
39
|
+
| `sync-package-docs.mjs` → npm `files` | Docs and all seven skills already shipped; presence checks did not protect the new entry paths or exercise projection from the tarball. | Assert handbook/skill files and byte-identical `.agents`/`.claude` projection in the existing packed-consumer check. |
|
|
40
|
+
| View concepts → grammar/runtime | Concepts denied internal Views and recommended SQL for every new View; reference `surface` table omitted `internal`. SQL admission text was stale. | Match implemented surfaces, typed declarative reads, SQLite admission sandbox and native-dialect limits. |
|
|
41
|
+
| Manifest reference | View's allowed spec keys omitted `cache`; Schema list-column prose omitted native columns. | Reconcile with parser and Admin UI checker. |
|
|
42
|
+
| Plugin/update skills | Assumed conventional source paths, missed regeneration after plugin manifest edits, and treated every View as publicly callable. | Use actual project paths, regenerate the plan, verify the declared surface and distinguish stable index from target prerelease docs. |
|
|
43
|
+
| Feature discovery | No task-to-manifest capability map or usable human entry; reference was buried after host-specific sections. | Add overview, capability table and task guides; move reference before host guides without breaking existing URLs. |
|
|
44
|
+
| Typed query discovery | APIs existed but lacked a complete internal-View calling example or clear reader authorization distinction. | Explain generated params/results, runtime `result` versus REST `data`, SQL `unknown`, indexed reader limits and plan-based emission. |
|
|
45
|
+
| Admin requests → theme/develop skills | Theme skill targeted visitor source; no routing from an Admin request to manifest-controlled presentation. | Route to Admin guide, with Schema/View/Procedure rendering table and supported customization ceiling. |
|
|
46
|
+
| Auth operations | Store-bound session cache behavior existed in code/ADR but was missing from the handbook. | Explain store identity, preparation order and KV propagation limits. |
|
|
47
|
+
|
|
48
|
+
## Verification and regression coverage
|
|
49
|
+
|
|
50
|
+
- `packages/mantle-spec/test/handbook-contract.test.ts`: complete handbook YAML
|
|
51
|
+
examples parse and validate; navigation covers pages; relative links resolve.
|
|
52
|
+
- `packages/mantle/test/cli/generate.test.ts`: extracts the new internal-View
|
|
53
|
+
YAML and TypeScript directly from the handbook, generates bindings and runs
|
|
54
|
+
strict TypeScript checking on the real example.
|
|
55
|
+
- CLI surface/projection tests assert the concrete next-read destinations;
|
|
56
|
+
existing drift checks verify `--check` is read-only.
|
|
57
|
+
- `scripts/check-optional-packages.mjs`: packs and installs the actual Core
|
|
58
|
+
tarball, checks embedded entry pages/skills, runs `skills` and `skills --check`,
|
|
59
|
+
and compares each project projection byte-for-byte with the installed package.
|
|
60
|
+
- Repository gate: `pnpm check`. Exact execution results and any environment
|
|
61
|
+
limitations are recorded in the PR, rather than frozen as a future guarantee.
|
|
62
|
+
|
|
63
|
+
No npm publish, tag, deployment or grammar change is part of this audit. Source
|
|
64
|
+
skill consumers receive the corrections only once they reach the installed Git
|
|
65
|
+
ref; npm consumers receive them only in a package built from the corrected tree.
|
|
@@ -84,6 +84,22 @@ The staff role is re-read from D1 on every protected REST and MCP call; a revoke
|
|
|
84
84
|
|
|
85
85
|
MCP tokens are session-bound: signing out of Admin ends MCP access. See [MCP and agents](../concepts/mcp-and-agents.md).
|
|
86
86
|
|
|
87
|
+
## Session cache and database replacement
|
|
88
|
+
|
|
89
|
+
When optional session caching is enabled, the cache is derived from the
|
|
90
|
+
canonical store, not a second identity authority. Auth prefixes keys with
|
|
91
|
+
`better-auth:<store-instance-id>:`. Preparing a new store gives it a distinct
|
|
92
|
+
identity, so reusing the same KV namespace after replacing D1 cannot resurrect
|
|
93
|
+
the previous store's cached sessions. Ordinary preparation of the same store
|
|
94
|
+
preserves its identity.
|
|
95
|
+
|
|
96
|
+
Custom low-level Auth composition must prepare the Mantle store before cached
|
|
97
|
+
Auth operations; do not construct cache keys or seed the identity yourself.
|
|
98
|
+
OTP verification remains in the primary database and rate limiting remains
|
|
99
|
+
isolate-local. Revocation/user-update cache invalidation still follows KV
|
|
100
|
+
propagation; the namespace change is isolation across stores, not a promise of
|
|
101
|
+
instant global invalidation. See the [Auth decision](../../adr/0014-auth-better-auth-and-multi-tenant-mcp.md).
|
|
102
|
+
|
|
87
103
|
## Better Auth configuration
|
|
88
104
|
|
|
89
105
|
`createAuth()` owns the Worker lifecycle, Admin metadata, sender integration,
|
|
@@ -141,9 +141,11 @@ origin, the only column Analytics Engine filters cheaply. Columns, in order:
|
|
|
141
141
|
whatever identity the gate established. Its body goes through the same 1 MiB
|
|
142
142
|
bounded reader as an admitted call; a denied request whose body is oversized
|
|
143
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
|
|
145
|
-
|
|
146
|
-
|
|
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
|
|
147
149
|
[SQL API](https://developers.cloudflare.com/analytics/analytics-engine/sql-api/):
|
|
148
150
|
|
|
149
151
|
```sql
|
|
@@ -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
|
|
@@ -20,7 +20,7 @@ A tool name is derived from a manifest name by `mcpToolNameSegment`: lowercased,
|
|
|
20
20
|
|
|
21
21
|
| Tool | Produced by | Surface |
|
|
22
22
|
|---|---|---|
|
|
23
|
-
| `query_view_<segment>` |
|
|
23
|
+
| `query_view_<segment>` | Public or staff View (never internal) | The View's own `surface` |
|
|
24
24
|
| `create_draft_<schema>`, `update_draft_<schema>` | A Schema with `lifecycle: publishing` | Staff |
|
|
25
25
|
| `create_record_<schema>`, `update_record_<schema>` | A Schema with `lifecycle: operational` | Staff |
|
|
26
26
|
| `request_publish`, `unpublish_entry`, `archive_entry`, `delete_entry` | Present when an applicable Schema exists | Staff |
|
|
@@ -51,7 +51,7 @@ const bound = bindMantle(runtime);
|
|
|
51
51
|
await bound.runtime.archive.execute({ id, ctx });
|
|
52
52
|
```
|
|
53
53
|
|
|
54
|
-
Generated property names are deterministic lower-camel identifiers; calls keep the authored wire names internally, and a collision is an error (`CODEGEN_IDENTIFIER_COLLISION`). Code generation is a pure projection: it never caches, retries, mounts routes or owns host lifecycle, and the typed API keeps its raw `runtime` so it hides nothing. Skipping generation is valid — call `runtime.executeView({ view: "published-notes" })` by name.
|
|
54
|
+
Generated property names are deterministic lower-camel identifiers; calls keep the authored wire names internally, and a collision is an error (`CODEGEN_IDENTIFIER_COLLISION`). The emitter accepts either `emitMantleModule({ linked })` or `emitMantleModule({ plan })` for hosts that already compiled the plan; see [Typed queries](../guides/typed-queries.md). Code generation is a pure projection: it never caches, retries, mounts routes or owns host lifecycle, and the typed API keeps its raw `runtime` so it hides nothing. Skipping generation is valid — call `runtime.executeView({ view: "published-notes" })` by name.
|
|
55
55
|
|
|
56
56
|
## Core, optional products, adapters
|
|
57
57
|
|
|
@@ -3,24 +3,25 @@ description: Views are the only public read surface — surfaces, declarative ve
|
|
|
3
3
|
---
|
|
4
4
|
# Reads: Views, REST and MCP
|
|
5
5
|
|
|
6
|
-
|
|
6
|
+
Views declare reusable queries and their transport visibility. This page explains why, how a View is shaped, and what it costs at query time. Field-level rules are in the [View reference](../reference/view.md).
|
|
7
7
|
|
|
8
8
|
## One read surface, not two
|
|
9
9
|
|
|
10
|
-
A View is a named, read-only query over Schemas.
|
|
10
|
+
A View is a named, read-only query over Schemas. Public and staff Views mount on supported transports with no [Trigger](./procedures-and-triggers.md) involved. Schemas are never publicly readable on their own.
|
|
11
11
|
|
|
12
12
|
Exposing collections directly — a `Schema.spec.expose.rest` flag, or a `GET /api/<collection>` shortcut — was considered and rejected. A Schema declares the storage shape. Its entries carry drafts, internal status, server-stamped fields and per-row data the author never intended to publish; `contact-messages` is the canonical example, where a direct collection route would be a privacy bug by default. A View already has the right semantics — a named query with explicit fields, filter, ordering and limit — so auto-exposing it only ratifies what the manifest already says.
|
|
13
13
|
|
|
14
|
-
|
|
14
|
+
Use `surface: internal` for a named query callable only by host code. It remains in the plan and generated bindings, but is absent from REST, MCP, WebMCP and Admin reports. Its `requires` and guards still run. See [Typed queries](../guides/typed-queries.md).
|
|
15
15
|
|
|
16
16
|
## Surfaces
|
|
17
17
|
|
|
18
|
-
`spec.surface` is required and closed to
|
|
18
|
+
`spec.surface` is required and closed to three values.
|
|
19
19
|
|
|
20
20
|
| `surface` | REST | MCP | Extra |
|
|
21
21
|
|---|---|---|---|
|
|
22
22
|
| `public` | `GET /api/views/<name>` | `query_view_<segment>` on `/mcp` | Listed by `GET /api/views` |
|
|
23
23
|
| `staff` | `GET /admin/api/views/<name>` | `query_view_<segment>` on `/mcp/staff` | `GET /admin/api/views/<name>/export`, Admin report sidebar |
|
|
24
|
+
| `internal` | None | None | Host calls through `executeView` or generated `views` bindings |
|
|
24
25
|
|
|
25
26
|
The adapter filters the View set before building each MCP dispatcher, so a guessed public tool call cannot reach a staff View. Surface decides transport visibility; `spec.requires` decides whether the verified caller may execute the View, on REST and MCP alike. See [Authorization](./authorization.md).
|
|
26
27
|
|
|
@@ -31,7 +32,7 @@ A View declares exactly one of `from` or `sql`; declaring both or neither is rej
|
|
|
31
32
|
- **`from`** names a Schema and pairs with `fields`, `filter`, `orderBy` and `limit`. The filter is a closed AST: `eq`, `gt`, `gte`, `lt`, `lte`, combined with `and` and `or`. Field-to-field comparison and arithmetic are not expressible.
|
|
32
33
|
- **`sql`** is a single `SELECT` with no semicolon. Every Schema is available as a logical table named after its `metadata.name`, with data properties projected as columns; quote names containing hyphens (`"post-translations"`). Combining `sql` with `fields`, `filter` or `orderBy` is rejected.
|
|
33
34
|
|
|
34
|
-
|
|
35
|
+
Use `from` for portable single-Schema queries, typed result rows and eligible public caching. Use `sql` for joins, aggregation or JSON expansion that the declarative form cannot express. SQL Views require a SQLite-capable adapter (`VIEW_DIALECT_UNSUPPORTED` otherwise), and generated SQL row types are `unknown`. The CLI validates SQL against an empty database of declared Schema tables; programmatic validation needs the `sqlViewSandbox` port for the same check. Exercise data-dependent behavior on your adapter or with `mantle-harness indexes`.
|
|
35
36
|
|
|
36
37
|
## Params
|
|
37
38
|
|
|
@@ -88,7 +89,7 @@ These names are output field names — SQL aliases for a `sql` View, Schema prop
|
|
|
88
89
|
|
|
89
90
|
## The MCP mirror
|
|
90
91
|
|
|
91
|
-
Every View is also a tool. The name is the View name lowercased with hyphens replaced by underscores, prefixed `query_view_`. Its input schema is `params.properties` plus `page` and `show`, and it is annotated `readOnlyHint: true`. One executor and one response shape serve REST and MCP, so an agent and a downstream service read exactly the same rows. See [MCP and agents](./mcp-and-agents.md).
|
|
92
|
+
Every public or staff View is also a tool on its matching MCP surface; internal Views are never tools. The name is the View name lowercased with hyphens replaced by underscores, prefixed `query_view_`. Its input schema is `params.properties` plus `page` and `show`, and it is annotated `readOnlyHint: true`. One executor and one response shape serve REST and MCP, so an agent and a downstream service read exactly the same rows. See [MCP and agents](./mcp-and-agents.md).
|
|
92
93
|
|
|
93
94
|
## Performance: declare the index the query needs
|
|
94
95
|
|
|
@@ -97,7 +98,7 @@ a native column. Declared `indexes` and `uniqueIndexes` become B-tree indexes
|
|
|
97
98
|
over those columns; Core-compiled projections, filters and ordering reference
|
|
98
99
|
the same columns directly.
|
|
99
100
|
|
|
100
|
-
Declare the **smallest ordered index justified by the measured path**, and respect SQLite's leftmost-prefix rule. Equality columns go first, the ordered column last. A public View over a publishing Schema always carries `status = published`, so its index leads with `status`: `[status, locale, publishedAt]` serves `WHERE status = ? AND locale = ?`, `… AND publishedAt > ?`, and `… ORDER BY publishedAt`. It does not serve `WHERE publishedAt > ?` alone, and `[publishedAt]` alone does not serve the published list — without planner statistics SQLite prefers the status equality and sorts in a temporary B-tree. If a second hot path needs a different leading field, that is a second index — not a reason to enumerate every permutation, since each index costs storage and slows every write.
|
|
101
|
+
Declare the **smallest ordered index justified by the measured path**, and respect SQLite's leftmost-prefix rule. Equality columns go first, the ordered column last. A public declarative View over a publishing Schema always carries `status = published`, so its index leads with `status`: `[status, locale, publishedAt]` serves `WHERE status = ? AND locale = ?`, `… AND publishedAt > ?`, and `… ORDER BY publishedAt`. It does not serve `WHERE publishedAt > ?` alone, and `[publishedAt]` alone does not serve the published list — without planner statistics SQLite prefers the status equality and sorts in a temporary B-tree. If a second hot path needs a different leading field, that is a second index — not a reason to enumerate every permutation, since each index costs storage and slows every write.
|
|
101
102
|
|
|
102
103
|
```sh
|
|
103
104
|
pnpm exec mantle-harness indexes --require-public --format text
|