@aotter/mantle 0.1.3 → 0.1.5-alpha.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (105) hide show
  1. package/README.md +20 -20
  2. package/dist/cli/generate-cloudflare.d.ts +7 -0
  3. package/dist/cli/generate-cloudflare.d.ts.map +1 -0
  4. package/dist/cli/generate-cloudflare.js +123 -0
  5. package/dist/cli/generate-cloudflare.js.map +1 -0
  6. package/dist/cli/generate-project.d.ts +25 -0
  7. package/dist/cli/generate-project.d.ts.map +1 -0
  8. package/dist/cli/generate-project.js +282 -0
  9. package/dist/cli/generate-project.js.map +1 -0
  10. package/dist/cli/generate-sites.d.ts +8 -0
  11. package/dist/cli/generate-sites.d.ts.map +1 -0
  12. package/dist/cli/generate-sites.js +273 -0
  13. package/dist/cli/generate-sites.js.map +1 -0
  14. package/dist/cli/generate.d.ts.map +1 -1
  15. package/dist/cli/generate.js +121 -10
  16. package/dist/cli/generate.js.map +1 -1
  17. package/dist/cli/main.d.ts +1 -1
  18. package/dist/cli/main.d.ts.map +1 -1
  19. package/dist/cli/main.js +11 -11
  20. package/dist/cli/skills.js +1 -1
  21. package/dist/cli/skills.js.map +1 -1
  22. package/docs/adr/0001-four-atom-manifest-model.md +3 -2
  23. package/docs/adr/0013-agent-provisioned-consumer-projects.md +4 -4
  24. package/docs/adr/0016-site-semantic-layer.md +5 -4
  25. package/docs/adr/0018-core-starters-repository-boundary.md +1 -1
  26. package/docs/adr/0021-retire-starter-scaffolding.md +1 -1
  27. package/docs/adr/0026-progressive-generate.md +36 -0
  28. package/docs/adr/0027-scheduled-procedure-triggers.md +31 -0
  29. package/docs/adr/0028-schema-ttl-expiry.md +33 -0
  30. package/docs/adr/README.md +7 -4
  31. package/docs/agent-prompts.md +41 -78
  32. package/docs/assets/mantle-admin-developer.png +0 -0
  33. package/docs/examples/README.md +1 -1
  34. package/docs/examples/host-chatgpt-sites/README.md +29 -12
  35. package/docs/examples/host-chatgpt-sites/drizzle/0003_store_instance_id.sql +1 -0
  36. package/docs/examples/host-chatgpt-sites/drizzle/0004_mantle.sql +10 -0
  37. package/docs/examples/host-chatgpt-sites/drizzle/0005_mantle.sql +24 -0
  38. package/docs/examples/host-chatgpt-sites/drizzle/meta/_journal.json +1 -1
  39. package/docs/examples/host-chatgpt-sites/drizzle/meta/mantle-state.json +60 -0
  40. package/docs/examples/host-chatgpt-sites/package.json +1 -1
  41. package/docs/examples/host-chatgpt-sites/public/site.css +1 -1
  42. package/docs/examples/host-chatgpt-sites/scripts/build.mjs +2 -1
  43. package/docs/examples/host-chatgpt-sites/scripts/check.mjs +2 -0
  44. package/docs/examples/host-chatgpt-sites/scripts/migration.mjs +42 -8
  45. package/docs/examples/host-chatgpt-sites/src/chatgpt-auth.ts +9 -6
  46. package/docs/examples/host-chatgpt-sites/src/index.ts +1 -1
  47. package/docs/examples/host-chatgpt-sites/src/web.ts +1 -1
  48. package/docs/examples/host-local-admin-otp/package.json +2 -2
  49. package/docs/examples/host-minimal-worker/README.md +5 -5
  50. package/docs/examples/host-minimal-worker/package.json +2 -2
  51. package/docs/handbook/{sites → chatgpt-sites}/equipment-checkout.md +1 -1
  52. package/docs/handbook/chatgpt-sites/generated-app.md +84 -0
  53. package/docs/handbook/{sites → chatgpt-sites}/index.md +35 -13
  54. package/docs/handbook/cloudflare/authentication.md +19 -2
  55. package/docs/handbook/cloudflare/bindings.md +4 -11
  56. package/docs/handbook/cloudflare/chatgpt-sites.md +6 -6
  57. package/docs/handbook/cloudflare/conventional-worker.md +7 -3
  58. package/docs/handbook/cloudflare/deploy-and-operate.md +4 -3
  59. package/docs/handbook/cloudflare/media-r2.md +2 -2
  60. package/docs/handbook/concepts/four-atoms.md +1 -1
  61. package/docs/handbook/concepts/lifecycle-and-locales.md +1 -1
  62. package/docs/handbook/concepts/mcp-and-agents.md +24 -4
  63. package/docs/handbook/concepts/procedures-and-triggers.md +1 -1
  64. package/docs/handbook/concepts/runtime-and-adapters.md +8 -1
  65. package/docs/handbook/concepts/views.md +1 -1
  66. package/docs/handbook/guides/agent-setup.md +8 -7
  67. package/docs/handbook/navigation.json +7 -6
  68. package/docs/handbook/reference/diagnostics.md +5 -0
  69. package/docs/handbook/reference/procedure.md +52 -1
  70. package/docs/handbook/reference/schema.md +27 -1
  71. package/docs/handbook/reference/surface.md +3 -3
  72. package/docs/handbook/reference/trigger.md +21 -1
  73. package/docs/handbook/releases/index.md +81 -1
  74. package/docs/handbook/start/overview.md +6 -3
  75. package/docs/handbook/start/project-and-cli.md +103 -119
  76. package/docs/handbook/start/quickstart-admin.md +6 -4
  77. package/docs/handbook/start/quickstart-worker.md +17 -11
  78. package/docs/release-process.md +3 -2
  79. package/docs/sealed-pipeline-ownership.md +1 -1
  80. package/docs/skills/develop/SKILL.md +258 -0
  81. package/docs/skills/integrate/SKILL.md +60 -0
  82. package/docs/skills/media-gc/SKILL.md +85 -0
  83. package/docs/skills/plugin/SKILL.md +132 -0
  84. package/docs/skills/provision/SKILL.md +194 -0
  85. package/docs/skills/theme/SKILL.md +77 -0
  86. package/docs/skills/update/SKILL.md +51 -0
  87. package/docs/spec-only-host-adoption.md +1 -1
  88. package/package.json +19 -18
  89. package/skills/README.md +28 -21
  90. package/skills/develop/SKILL.md +16 -8
  91. package/skills/install/SKILL.md +103 -128
  92. package/skills/integrate/SKILL.md +60 -0
  93. package/skills/media-gc/SKILL.md +2 -2
  94. package/skills/plugin/SKILL.md +2 -2
  95. package/skills/provision/SKILL.md +3 -3
  96. package/skills/theme/SKILL.md +2 -2
  97. package/skills/update/SKILL.md +2 -2
  98. package/templates/chatgpt-sites/auth.ts +66 -0
  99. package/templates/chatgpt-sites/build.mjs +14 -0
  100. package/templates/chatgpt-sites/env.ts +1 -0
  101. package/templates/chatgpt-sites/mcp.ts +48 -0
  102. package/templates/chatgpt-sites/public-mcp.ts +29 -0
  103. package/templates/chatgpt-sites/smoke-local.mjs +20 -0
  104. package/skills/.keep +0 -0
  105. /package/docs/handbook/{sites → chatgpt-sites}/host-reference.md +0 -0
package/dist/cli/main.js CHANGED
@@ -25,15 +25,16 @@ async function main() {
25
25
  return 2;
26
26
  }
27
27
  }
28
- export const MANTLE_OVERVIEW = `mantle — compile manifests into a RuntimePlan and typed binding
28
+ export const MANTLE_OVERVIEW = `mantle — compile manifests and assemble selected application features
29
29
 
30
30
  Overview
31
- Optional surfaces — take only what you need. Admin is opt-in. You can ship a
32
- complete service with no Dev UI, no visitor frontend, and no extra packages.
31
+ New applications default to Spec, Runtime, API, MCP, Admin, and a blank Web
32
+ home. Pass --host cf or --host chatgpt-sites, or use --features for a smaller
33
+ positive selection. Existing authored applications keep compile-only mode.
33
34
 
34
- Minimal — Spec + generate
35
- validate + generate compile manifests into a sealed plan and typed binding.
36
- Embed that binding in an existing host. No Admin, no visitor UI.
35
+ Host-free — Spec only
36
+ mantle generate --features spec compiles a sealed plan and typed binding
37
+ without Runtime, Admin, visitor UI, or a host.
37
38
 
38
39
  Runtime / adapter
39
40
  Bind Runtime through an adapter (Cloudflare Worker, Bun, Vercel, or yours).
@@ -41,10 +42,9 @@ Overview
41
42
  See docs/examples/host-minimal-worker or
42
43
  node_modules/@aotter/mantle/docs/examples/host-minimal-worker.
43
44
 
44
- Opt-in — Admin / Dev UI
45
- Add @aotter/mantle-admin and @aotter/mantle-admin-ui only when humans need
46
- a console. Then re-run generate, bind wrangler ASSETS, and open
47
- /admin/sign-in (local email OTP via ConsoleEmailSender).
45
+ Selected Admin / Dev UI
46
+ New full applications include the prebuilt UI. Reduced applications can
47
+ omit it; selected packages must be installed before generation completes.
48
48
  See docs/examples/host-local-admin-otp or
49
49
  node_modules/@aotter/mantle/docs/examples/host-local-admin-otp.
50
50
 
@@ -66,7 +66,7 @@ Documentation:
66
66
  Features: node_modules/@aotter/mantle/docs/handbook/reference/features.md
67
67
  Admin UI: node_modules/@aotter/mantle/docs/handbook/guides/admin-ui.md
68
68
  Online: https://mantle.tools/
69
- Install skill: npx skills add aotter/mantle --skill install
69
+ Install skill: npx skills add aotter/mantle
70
70
  `;
71
71
  main().then((code) => {
72
72
  process.exitCode = code;
@@ -116,7 +116,7 @@ export function projectionScopes(skillMarkdown) {
116
116
  }
117
117
  async function skillSourceRoot() {
118
118
  const packageRoot = resolve(dirname(fileURLToPath(import.meta.url)), "../..");
119
- for (const candidate of [join(packageRoot, "skills"), resolve(packageRoot, "../../skills")]) {
119
+ for (const candidate of [join(packageRoot, "skills"), resolve(packageRoot, "../../docs/skills")]) {
120
120
  if ((await stat(candidate).catch(() => null))?.isDirectory())
121
121
  return candidate;
122
122
  }
@@ -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,QAAQ,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAC7D,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AACzC,OAAO,EAAE,GAAG,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AACnD,OAAO,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AAEtC;;;;;GAKG;AACH,MAAM,yBAAyB,GAAG,CAAC,SAAS,EAAE,SAAS,CAAU,CAAC;AAElE,MAAM,CAAC,KAAK,UAAU,SAAS,CAAC,OAA0B;IACxD,IAAI,KAAc,CAAC;IACnB,IAAI,CAAC;QACH,MAAM,EAAE,MAAM,EAAE,GAAG,SAAS,CAAC;YAC3B,IAAI,EAAE,CAAC,GAAG,OAAO,CAAC;YAClB,OAAO,EAAE;gBACP,KAAK,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE;gBAC1B,IAAI,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE,KAAK,EAAE,GAAG,EAAE;aACtC;SACF,CAAC,CAAC;QACH,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,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,OAAO,CAAC,CAAC;IAC9E,KAAK,MAAM,SAAS,IAAI,CAAC,IAAI,CAAC,WAAW,EAAE,QAAQ,CAAC,EAAE,OAAO,CAAC,WAAW,EAAE,mBAAmB,CAAC,CAAC,EAAE,CAAC;QACjG,IAAI,CAAC,MAAM,IAAI,CAAC,SAAS,CAAC,CAAC,KAAK,CAAC,GAAG,EAAE,CAAC,IAAI,CAAC,CAAC,EAAE,WAAW,EAAE;YAAE,OAAO,SAAS,CAAC;IACjF,CAAC;IACD,MAAM,IAAI,KAAK,CAAC,oDAAoD,CAAC,CAAC;AACxE,CAAC;AAED,SAAS,OAAO,CAAC,KAAc;IAC7B,OAAO,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;AAChE,CAAC"}
@@ -214,8 +214,9 @@ See § Authoring shape below for the full retirement rationale.
214
214
  Names + PG-1:1 framing are documented in this ADR and the manifest grammar
215
215
  reference. Manifest TS types live in `packages/mantle-spec/`. The external
216
216
  [`aotter/mantle-starters`](https://github.com/aotter/mantle-starters)
217
- repository declares consumer instances of each atom. Runtime dispatcher, View
218
- executor, and Procedure dispatcher live in this repository.
217
+ repository declared alpha-era consumer instances of each atom; new applications
218
+ are authored directly under [ADR-0021](0021-retire-starter-scaffolding.md).
219
+ Runtime dispatcher, View executor, and Procedure dispatcher live in this repository.
219
220
 
220
221
  ---
221
222
 
@@ -2,8 +2,8 @@
2
2
 
3
3
  ## Status
4
4
 
5
- Superseded for first launch by provisioning v2 (2026-06-27). Historical
6
- record only.
5
+ Superseded by [ADR-0021](0021-retire-starter-scaffolding.md) for 0.1.2 and
6
+ later. Historical pre-stable install flow only.
7
7
 
8
8
  ## Date
9
9
 
@@ -11,7 +11,7 @@ record only.
11
11
 
12
12
  ## Context
13
13
 
14
- > **Current direction:** Mantle landing creates the GitHub repo from
14
+ > **Historical 2026-06-27 direction, no longer current:** Mantle landing creates the GitHub repo from
15
15
  > `mantle-starters` `provision-bundles/<type>.json`, commits the blank
16
16
  > or type bundle, and connects Cloudflare Workers CI when possible.
17
17
  > Do not extend the old `create-mantle launch --session` or
@@ -144,7 +144,7 @@ they are debugging a failed provision.
144
144
 
145
145
  ## Implementation status
146
146
 
147
- - `skills/install/SKILL.md` and `skills/provision/SKILL.md` encode the
147
+ - `skills/install/SKILL.md` and `docs/skills/provision/SKILL.md` encode the
148
148
  current agent workflow, including the launch-session fast path.
149
149
  - `aotter/mantle-starters` hosts `packages/create-mantle`, whose
150
150
  `launch --session` mode validates the session before writing files.
@@ -2,9 +2,10 @@
2
2
 
3
3
  ## Status
4
4
 
5
- Accepted (slimmed 2026-05-12 per Epic #116; `mantle/site.md` letter
6
- surface suspended 2026-06-19 and removed from first-run scaffolds;
7
- amended 2026-06-27 for landing provision bundles).
5
+ Superseded by [ADR-0021](0021-retire-starter-scaffolding.md) for 0.1.2 and
6
+ later. The launch-state and provision-bundle rules below describe the legacy
7
+ Starter/Landing flow; new applications are authored directly from the installed
8
+ SDK's skill and handbook.
8
9
 
9
10
  ## Decision
10
11
 
@@ -65,5 +66,5 @@ and to the landing substitution pass.
65
66
  generated `.mantle/*.template` bundle files.
66
67
  - Substitution: Mantle landing provision-bundle substitution.
67
68
  - Install handoff: `skills/install/SKILL.md` describes how agents continue from the landing-provisioned repo.
68
- - Provision update: `skills/provision/SKILL.md` describes the `AGENTS.md` public-site rewrite after deploy.
69
+ - Provision update: `docs/skills/provision/SKILL.md` describes the `AGENTS.md` public-site rewrite after deploy.
69
70
  - Type overlays are applied while building `provision-bundles/<type>.json`; generated repos should not need a second overlay step.
@@ -3,7 +3,7 @@
3
3
  > Superseded for 0.1.2 by [ADR-0021](0021-retire-starter-scaffolding.md).
4
4
  > The contract below is retained as alpha.17 history, not current launch/release guidance.
5
5
 
6
- **Status:** Accepted for now; revisit only under the triggers below
6
+ **Status:** Superseded by ADR-0021 for 0.1.2 and later. Historical alpha.17 decision only.
7
7
 
8
8
  **Date:** 2026-08-02
9
9
 
@@ -1,6 +1,6 @@
1
1
  # ADR-0021: Author applications directly; retire Starter scaffolding
2
2
 
3
- Status: Accepted by owner, 2026-09-08 (#786). Supersedes ADR-0018 for the 0.1.2 line.
3
+ Status: Accepted by owner, 2026-09-08 (#786). Supersedes ADR-0018 for the 0.1.2 line. Its no-initialization clause is superseded by [ADR-0026](0026-progressive-generate.md) for 0.1.5.
4
4
 
5
5
  Core is an embeddable manifest engine. Applications own package manifests,
6
6
  Worker entries, provider configuration, business manifests and visitor UI.
@@ -0,0 +1,36 @@
1
+ # ADR-0026: Progressive application generation
2
+
3
+ **Status:** Accepted by owner for the 0.1.5 line (#1081–#1086). Supersedes the no-initialization clause of ADR-0021; direct authorship and optional package boundaries remain.
4
+
5
+ Mantle is progressive. A new application defaults to Spec, Runtime, API, MCP, Admin, and an editable blank Web home so an agent does not forget the optional Admin composition. `--features` is a positive replacement list over `spec,runtime,api,mcp,admin,web`; dependencies are closed automatically. `spec` alone is host-free. The first generated hosts are `cf` and `chatgpt-sites`. Only host-dependent selections require `--host`; a TTY may prompt, while headless use must pass it explicitly.
6
+
7
+ | Feature | Required features | Direct package additions |
8
+ | --- | --- | --- |
9
+ | `spec` | — | `@aotter/mantle`, `zod` peer |
10
+ | `runtime` | `spec` | Host adapter; current CF adapter also brings Admin/Auth/Web transitively |
11
+ | `api` | `runtime` | Host route composition and `hono` peer |
12
+ | `mcp` | `runtime` | Host MCP route composition |
13
+ | `admin` | `runtime,api,mcp` | `@aotter/mantle-admin`, `@aotter/mantle-admin-ui`; CF owner auth also uses `@aotter/mantle-auth` |
14
+ | `web` | `runtime` | `@aotter/mantle-web` and a user-owned blank home |
15
+
16
+ The host adapter's declared peers (`better-auth`, `hono`, `zod`, `aws4fetch`) are installed for host-dependent selections until its package dependency graph is split. A reduced selection still omits unselected routes and assets; it does not claim smaller transitive installation today.
17
+
18
+ An application with only Git, installed skills, package metadata, a lockfile, README, and installed dependencies is new. Existing manifests or application code remain in direct-authoring compile mode. A saved `mantle.config.json` decides subsequent runs before that heuristic. V1 refuses host changes and feature-list changes after selection; application owners can make an explicit migration rather than have generation delete routes or data. An explicitly named missing manifest path is an error. A new default manifest directory may be absent or empty, yielding a valid empty plan without a fake business Schema.
19
+
20
+ Generation preflights selection, manifest validity, package/script conflicts, file ownership, and symlink escapes before writing. It saves the selection and adds only absent package declarations and scripts; it does not run a package manager. Selected Mantle packages use the running CLI's exact version. Missing selected packages produce an incomplete, nonzero result and an explicit install-and-rerun instruction. `--check` never writes, installs, prompts, or provisions. Generated code and assets remain CLI-owned; the editable frontend, host config, identity, secrets, handlers, and historical migrations are application-owned. A later SDK upgrade does not overwrite them. Clean builds remove only copied output.
21
+
22
+ Cloudflare currently has a facade with transitive Admin/Auth/Web dependencies and mounts OAuth/MCP unconditionally. Host generation must use a lower-level composition for reduced selections or change that facade; omitting dependencies from a manifest does not prove route omission. Cloudflare D1 remains runtime-managed. ChatGPT Sites uses reviewed, append-only managed migrations with applied-state checks (owned by #1086). Neither host generator provisions resources or deploys.
23
+
24
+ This decision restores a convenient default while keeping the sealed Manifest-to-RuntimePlan pipeline and user-owned application source. It does not reintroduce a remote Starter catalog or a `mantle create` command.
25
+
26
+ ## 2026-09-25 amendment — existing application integration
27
+
28
+ The original implementation added `--adopt` to convert an existing authored
29
+ application into the generated-project layout. This amendment removes that
30
+ mode. Applications with their own host shape continue direct authoring;
31
+ integrating Mantle is guided by the version-matched `integrate` consumer skill.
32
+ The agent may embed selected capabilities, replace one part at a time, or
33
+ build a fresh Mantle application and migrate frontend and data. The CLI owns
34
+ only deterministic generation and its declared checks; it does not certify
35
+ arbitrary user-owned host wiring. A saved generated project still reruns from
36
+ its own configuration, with file ownership and migration safeguards intact.
@@ -0,0 +1,31 @@
1
+ # ADR-0027: Scheduled Procedure Triggers
2
+
3
+ **Status:** Accepted for 0.1.5 (#1087). Revises the closed Trigger-source grammar from ADR-0001 and the host-only cron guidance of #322.
4
+
5
+ **Date:** 2026-09-25
6
+
7
+ ## Context
8
+
9
+ The earlier contract kept cron outside the Manifest graph. That forced an application Worker to invoke a Procedure by name with its own caller context, leaving scheduling invisible to validation and the compiled plan. A portable declaration is needed without pretending that every host can register a cron event.
10
+
11
+ ## Decision
12
+
13
+ `Trigger.spec.source` gains `kind: schedule`, a five-field Cloudflare UTC `cron` (weekday 1=Sunday), and optional `enabled` (default true). It targets one Procedure whose input accepts `{}` and requires no user or staff authorization. The compiled plan carries Trigger identity, expression, target, enabled state, and the required `cloudflare` host. No HTTP route or user identity is granted.
14
+
15
+ Cloudflare's `scheduled` entry finds enabled plan entries with the exact incoming expression and invokes them in Trigger-name order through the existing Procedure pipeline, continuing after individual failures and reporting them together. The system context has null user and staff, no credential, and `ctx.schedule` with stable `${trigger}:${scheduledTime}` identity. The application registers exact expressions with Wrangler. Cloudflare Cron Triggers do not document automatic retries; handlers still use the identity for possible duplicate/manual replay. Other hosts reject enabled schedules rather than silently omit them.
16
+
17
+ ## Consequences
18
+
19
+ The grammar and sealed plan version advance. Applications must rerun `mantle generate` after upgrading. A Procedure needing staff authorization cannot run from a schedule. Cron provisioning, retries, retention and exactly-once execution remain host/operator responsibilities; the runtime does not claim them.
20
+
21
+ ## Alternatives
22
+
23
+ Keeping host-only calls would preserve the old grammar but fail static validation and omit the feature from introspection. A general background-job framework would add storage and scheduling responsibilities without a second host implementation.
24
+
25
+ ## How to apply
26
+
27
+ Declare a schedule Trigger, export `worker.scheduled`, and register its expression in `wrangler.jsonc`. Use `ctx.schedule.id` to deduplicate writes. See [Trigger reference](../handbook/reference/trigger.md#schedule-source).
28
+
29
+ ## Implementation status
30
+
31
+ Implemented in the 0.1.5 scheduled Procedure PR, with parser, linker, compiler, runtime and Cloudflare adapter tests.
@@ -0,0 +1,33 @@
1
+ # ADR-0028: Logical Schema TTL before explicit physical cleanup
2
+
3
+ **Status:** Accepted for 0.1.5 (#1088).
4
+
5
+ **Date:** 2026-09-25
6
+
7
+ ## Context
8
+
9
+ An application needs a portable expiry rule across D1 and Bun SQLite. A cron-only delete task cannot guarantee that readers stop seeing expired data if it runs late or fails. Applying a new policy to a populated table must not silently bulk-delete rows.
10
+
11
+ ## Decision
12
+
13
+ `Schema.spec.ttl` names one top-level date-time field and a nonnegative `expireAfterSeconds`. At `timestamp + duration <= now`, semantic reads exclude the row. Missing, null and unparseable legacy dates never expire. Declarative Views include the same predicate. Native SQL Views are rejected while any TTL Schema exists, and shared caching of a TTL View is rejected. The compiled plan and introspection expose the policy. Public Cloudflare pages derived from TTL collections use `no-store` rather than shared caching.
14
+
15
+ SQLite storage implements an optional bounded `ExpirySweeper`. A sweep previews by default; `delete: true` is required for physical removal. It returns counts and a cursor, selects at most 100 expired IDs in stable order, and rechecks expiry in one bounded delete statement. A failed page can be retried with the previous cursor. Ref Procedures can call the semantic capability, including from a scheduled Trigger. No host automatically invokes it.
16
+
17
+ Physical TTL removal does not fire before/after entry lifecycle hooks. Expiry already changed logical visibility; cleanup reclaims storage rather than representing an editorial deletion. Consumers needing business actions at expiry must implement them in an idempotent scheduled Procedure before calling the sweep.
18
+
19
+ ## Consequences
20
+
21
+ Adding or shortening TTL changes read visibility immediately but never starts physical deletion. Owners preview counts and choose when to sweep; expired rows can still occupy unique indexes until removal. Other adapters must implement equivalent read filtering and a sweep or fail closed for TTL plans. The runtime does not promise an exact deletion time.
22
+
23
+ ## Alternatives
24
+
25
+ Scheduler-driven deletion alone leaves a visibility gap. Implicit migration-time cleanup risks irreversible bulk deletion. Firing ordinary deletion hooks during storage reclamation would cause delayed, retry-sensitive business effects after the row was already logically gone.
26
+
27
+ ## How to apply
28
+
29
+ Declare `ttl` on a Schema, use declarative Views, preview with `runtime.sweepExpired`, then explicitly request deletion page by page. See [Schema TTL](../handbook/reference/schema.md#ttl).
30
+
31
+ ## Implementation status
32
+
33
+ Implemented in the 0.1.5 TTL PR for the SQLite family, with Bun and local D1 conformance checks.
@@ -14,17 +14,20 @@ Records of *why* mantle ended up shaped this way. The numbering preserves POC AD
14
14
  | [0010](0010-locale-and-translates.md) | Locale 3-layer (manifest / D1 site_config / data field) + translates pattern. Boot decoupled from `site_config` (issue #60 fix). | Accepted (refreshed) |
15
15
  | [0011](0011-adapter-port-spec.md) | Adapter port spec. Required runtime ports plus optional feature ports. | Accepted (new) |
16
16
  | [0012](0012-views-as-public-rest.md) | Views auto-expose matching REST and `query_view_*` MCP reads on their declared `public` or `staff` surface. Schemas never get a public REST endpoint. | Accepted + amended |
17
- | [0013](0013-agent-provisioned-consumer-projects.md) | Historical agent-provisioned consumer projects path. Superseded for first launch by landing provision bundles. | Superseded |
17
+ | [0013](0013-agent-provisioned-consumer-projects.md) | Historical agent-provisioned consumer projects path. | Superseded by 0021 |
18
18
  | [0014](0014-auth-better-auth-and-multi-tenant-mcp.md) | The Cloudflare adapter owns one Better Auth 1.7 identity/OAuth/MCP authority with native method options and CIMD discovery. Verified callers are normalized into runtime context; mutable staff role and target authorization are re-evaluated per call. | Accepted + amended |
19
- | [0016](0016-site-semantic-layer.md) | Site semantic layer: `AGENTS.md` (cross-tool entry) + `.mantle/launch-state.json` (deterministic install context). The older `mantle/site.md` letter surface is suspended from first-run scaffolds. | Accepted (slimmed) |
19
+ | [0016](0016-site-semantic-layer.md) | Historical Starter/Landing `AGENTS.md` and launch-state contract. | Superseded by 0021 |
20
20
  | [0017](0017-media-multi-variant-agent-side-optimization.md) | Multi-variant media assets with agent-side optimization and asset-id entry references. | Accepted |
21
21
  | [0018](0018-core-starters-repository-boundary.md) | Core produces published SDK artifacts; the separate starters repository validates them as an external consumer. Revisit after release-contract simplification. | Superseded by 0021 |
22
22
  | [0019](0019-sealed-manifest-runtime-pipeline.md) | One sealed source-to-runtime pipeline, semantic storage seam, and optional Web/Admin/platform dependency direction. | Accepted |
23
23
  | [0020](0020-builtin-handler-contracts-and-matched-upsert.md) | Static builtin handler contracts and natural-key matched upsert (`handler.match`). | Accepted + amended by 0022 |
24
- | [0021](0021-retire-starter-scaffolding.md) | Direct authoring; retire Starter scaffolding. | Accepted; supersedes 0018 |
24
+ | [0021](0021-retire-starter-scaffolding.md) | Direct authoring; retire Starter scaffolding. | Accepted; no-initialization clause superseded by 0026 |
25
25
  | [0022](0022-caller-observed-version-occ.md) | Caller-observed `expectedVersion` for Admin bind and builtin upsert OCC. | Accepted |
26
26
  | [0024](0024-manifest-native-schema-tables.md) | Materialize each Schema as a native storage table and deploy reviewed migration artifacts. | Accepted; authored-native-name clauses superseded by 0025 |
27
27
  | [0025](0025-reserved-native-columns-and-published-only-public-views.md) | Reserve the six native column names, let `indexes` reference them, and compile public publishing Views published-only. | Accepted |
28
+ | [0026](0026-progressive-generate.md) | Progressive `mantle generate` with a full default, positive features, saved host selection, and user-owned source. | Accepted; supersedes part of 0021 |
29
+ | [0027](0027-scheduled-procedure-triggers.md) | Schedule Triggers in the sealed plan with Cloudflare-hosted invocation and system identity. | Accepted for 0.1.5 |
30
+ | [0028](0028-schema-ttl-expiry.md) | Logical TTL on Schema reads with preview-first, explicit bounded cleanup. | Accepted for 0.1.5 |
28
31
 
29
32
  ## Reading order
30
33
 
@@ -36,7 +39,7 @@ If you're new to the codebase:
36
39
  4. **0007** — what running the SDK feels like as an AI author (and as the operator agent).
37
40
  5. **0011** — the boundary between the runtime and the adapter.
38
41
  6. **0010** — how locale flows through the system.
39
- 7. **0021** — current direct-authoring boundary; **0013** is historical install-session context.
42
+ 7. **0026** — current progressive generation boundary; **0021** retains the direct-authoring history and **0013** is historical install-session context.
40
43
  8. **0002, 0008** — the two ADRs that touch every diagnostic and every binding.
41
44
 
42
45
  ## What's NOT here (and why)
@@ -1,101 +1,64 @@
1
1
  # Task-specific agent prompts
2
2
 
3
- Cold start from GitHub or a marketplace host is the install skill:
3
+ First install the small bootstrap skill:
4
4
 
5
5
  ```sh
6
- npx skills add aotter/mantle --skill install
6
+ npx skills add aotter/mantle
7
7
  ```
8
8
 
9
- Copy one block into a coding agent after that skill is present. Paths below
10
- are relative to the Mantle docs root: `node_modules/@aotter/mantle/docs/`
11
- after `@aotter/mantle` is installed. A standalone `skills add` installation
12
- contains only the selected skill, not these docs.
13
- `npx --no-install mantle --help` is the layered CLI overview; it mirrors the
14
- authoring docs. A live `/mcp` catalog mirrors the Manifest → RuntimePlan, not
15
- the CLI. Resolve only missing requirements first; do not assume a host. There is no `mantle create`. Empty `generate` fails until
16
- manifests exist. Admin is opt-in.
9
+ The installed skill locates the target project, resolves its actual SDK
10
+ version, and sends the agent to that package's CLI and docs. A GitHub skill
11
+ may be newer than npm: published 0.1.4 uses the direct-authoring path;
12
+ 0.1.5-alpha.1 adds full generated projects. Never assume a new flag exists without
13
+ checking the installed CLI.
17
14
 
18
- ### Interview then build
15
+ ## New full Cloudflare app
19
16
 
20
17
  ```text
21
- Interview me about the service: host, who uses it, whether humans need a
22
- Dev UI, and whether we only embed Spec/Runtime. If the install skill is
23
- missing, run npx skills add aotter/mantle --skill install. Read the
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.
27
- Use examples/README.md as the examples index; copy builtin-* Manifests only
28
- (not cf-primitives-*). Implement locally first. Take only the surfaces we
29
- chose. For Spec-only use, skip Runtime and code generation. For a Worker
30
- without Admin, follow examples/host-minimal-worker/. For a Worker with
31
- Dev UI, follow examples/host-local-admin-otp/README.md. ChatGPT Sites only
32
- if I name that host. No mantle create. Pin all @aotter/mantle* packages
33
- to one exact version.
18
+ Build a Mantle app on Cloudflare. Follow the installed mantle skill, pin one
19
+ exact stable SDK version, and use its project-generation path if supported.
20
+ Select the full default Spec, Runtime, API, MCP, Admin and blank home. Install
21
+ the CLI-declared dependencies and rerun generation. Ask for my actual data and
22
+ workflow before adding Manifests. For local Admin, copy .dev.vars.example,
23
+ set the real owner email and a random secret, and verify OTP, Admin assets,
24
+ unauthorized access, public API and MCP. Do not claim production Auth is set
25
+ up from a local OTP test.
34
26
  ```
35
27
 
36
- ### Embed Runtime with typed APIs
28
+ ## Small API or Spec-only app
37
29
 
38
30
  ```text
39
- Read handbook/start/project-and-cli.md and npx --no-install mantle --help.
40
- Pin @aotter/mantle at the exact version we agree, author manifests for
41
- this existing host, then run mantle generate. Embed
42
- the typed binding from .mantle/generated/mantle.ts into the current
43
- system. Do not add Admin, mantle-admin-ui, a visitor frontend, or a
44
- Cloudflare adapter unless I ask. Do not invent a default Schema.
31
+ Use the installed Mantle CLI and version-matched docs. For a Cloudflare API,
32
+ select --host cf --features spec,api if that CLI supports project generation.
33
+ For manifest parsing only, use --features spec without a host. Keep unselected
34
+ Admin, Web and MCP packages out. Author the Schema and View I request, then
35
+ run generate, validate, typecheck and a real route probe when a host exists.
36
+ Preserve an existing direct-authored application instead of regenerating it.
45
37
  ```
46
38
 
47
- ### Minimal API service locally
39
+ ## ChatGPT Sites
48
40
 
49
41
  ```text
50
- Read handbook/start/quickstart-worker.md and examples/host-minimal-worker/.
51
- Author a Cloudflare Worker from that official example or from scratch:
52
- one Schema, one public View (copy the contract, not the tree wholesale).
53
- Pin every @aotter/mantle* package to the same exact version. Run
54
- pnpm install && pnpm generate && pnpm dev (or wrangler dev --local).
55
- Probe GET /api/views/<name> with curl. GET / may 404. Do not install
56
- Admin or wrangler ASSETS unless I ask.
42
+ Build with ChatGPT Sites and Mantle. Start from the installed SDK's generated
43
+ blank app when supported; otherwise follow that version's Sites reference.
44
+ Pin all selected Mantle packages exactly, install declared dependencies,
45
+ review and apply the initial local D1 migration, then add my Manifests and
46
+ review each appended migration. Configure OWNER_EMAIL and PUBLIC_ORIGIN. The
47
+ local owner smoke simulates Sites identity; deployed ChatGPT sign-in needs a
48
+ separate check. Show how I will maintain content through Admin, browser
49
+ WebMCP, public MCP and Sites-session staff MCP. Add R2 only if my workflow
50
+ requires uploads. Never deploy the Worker directly or claim remote staff OAuth
51
+ MCP from a Sites browser session.
57
52
  ```
58
53
 
59
- ### Full local Dev UI (opt-in)
54
+ ## Existing project with typed queries
60
55
 
61
56
  ```text
62
- I want the optional Admin / Dev UI. Read examples/host-local-admin-otp/README.md
63
- (the procedural SSOT) and the thin pointer at handbook/start/quickstart-admin.md.
64
- Interview me for a bootstrap owner email, then follow that example locally.
65
- Prefer 127.0.0.1 over localhost. After pnpm check / smoke, restore .dev.vars
66
- from .dev.vars.example before pnpm dev.
57
+ Read this project's package.json, lockfile, installed Mantle package and
58
+ projected develop skill. Keep its host and selected surfaces. Use the installed
59
+ CLI's help and handbook to add the requested Schema/View/Procedure, then run
60
+ its generate/check, validation, TypeScript and host smoke. Do not use another
61
+ checkout's SDK docs or overwrite user-owned files.
67
62
  ```
68
63
 
69
- ### Later layer: MCP or public web (opt-in)
70
-
71
- ```text
72
- Do not add Admin unless it is already in this project. Read
73
- handbook/concepts/mcp-and-agents.md and/or
74
- handbook/cloudflare/public-web.md. Add only the surface I name: MCP
75
- Triggers at /mcp or /mcp/staff, or optional @aotter/mantle-web
76
- composition. Keep Core adapter-neutral. Probe the new route; do not
77
- claim Auth or Admin works from a public 200.
78
- ```
79
-
80
- ### Mantle on ChatGPT Sites, including media
81
-
82
- Use only when the user names ChatGPT Sites as the host.
83
-
84
- ```text
85
- Build with ChatGPT Sites; use Mantle for content management and publishing.
86
- Read handbook/sites/index.md and examples/host-chatgpt-sites/README.md.
87
- Use that runnable host as a reference and install its pinned
88
- dependencies from the registry. Derive Schema, View,
89
- Procedure and Trigger from my requirements and check the Admin editor/picker and public
90
- projections against them. Request both Sites D1 and R2 when my workflow
91
- includes uploads. Bind the R2 media port, declare media.purposes, and keep
92
- the same-origin PUT and committed-only public GET checks. Pin every
93
- @aotter/mantle* dependency to one exact version. Run the local smoke,
94
- show a draft-to-publish walkthrough, then save and deploy through Sites when
95
- requested. Verify the deployed owner/member role, R2 upload, published page, and anonymous draft 404. Treat public read-only
96
- MCP, Admin WebMCP, and staff OAuth MCP as separate acceptance gates; never
97
- claim staff MCP from a working browser session or connector URL alone.
98
- ```
99
-
100
-
101
- [Back to the Core README](../README.md#for-engineers-and-agents).
64
+ [Back to the Core README](../README.md).
@@ -19,4 +19,4 @@ Drop a `builtin-*` YAML block into `host-local-admin-otp/manifests/` (or `host-m
19
19
  | [`cf-primitives-guarded-api.md`](./cf-primitives-guarded-api.md) | API keys, scopes, live entitlement `ref` guards over REST and MCP | cf-primitives | no | none | `host-minimal-worker` plus credential resolver |
20
20
  | [`host-minimal-worker/`](./host-minimal-worker/README.md) | Executable Spec + adapter without Admin | host | no | none | itself |
21
21
  | [`host-local-admin-otp/`](./host-local-admin-otp/README.md) | Executable opt-in Admin / Dev UI with email OTP | host | no | required | itself |
22
- | [Mantle on ChatGPT Sites](../handbook/sites/index.md) · [runnable reference](./host-chatgpt-sites/README.md) | Runnable Sites D1/R2, ChatGPT identity, Admin media, published web and public read-only MCP | host | no | required | itself |
22
+ | [Mantle on ChatGPT Sites](../handbook/chatgpt-sites/index.md) · [runnable reference](./host-chatgpt-sites/README.md) | Runnable Sites D1/R2, ChatGPT identity, Admin media, published web and public read-only MCP | host | no | required | itself |
@@ -1,8 +1,8 @@
1
1
  # Mantle on ChatGPT Sites: runnable reference
2
2
 
3
- The runnable application for [Mantle on ChatGPT Sites](../../handbook/sites/index.md) connects Sites D1 + R2 bindings, Sign in with ChatGPT identity, Mantle Admin and staff roles, same-origin media upload, a published-only article frontend, anonymous read-only `/api/mcp`, and Sites-session staff tools at `/api/mcp/staff`. Remote OAuth MCP remains a separate integration; see [MCP support](../../handbook/sites/host-reference.md#remote-mcp-is-a-separate-gate).
3
+ The runnable application for [Mantle on ChatGPT Sites](../../handbook/chatgpt-sites/index.md) connects Sites D1 + R2 bindings, Sign in with ChatGPT identity, Mantle Admin and staff roles, same-origin media upload, a published-only article frontend, anonymous read-only `/api/mcp`, and Sites-session staff tools at `/api/mcp/staff`. Remote OAuth MCP remains a separate integration; see [MCP support](../../handbook/chatgpt-sites/host-reference.md#remote-mcp-is-a-separate-gate).
4
4
 
5
- After setup, follow [Publish your first article](../../handbook/sites/index.md#publish-your-first-article) to verify the editorial workflow in Admin.
5
+ After setup, follow [Publish your first article](../../handbook/chatgpt-sites/index.md#publish-your-first-article) to verify the editorial workflow in Admin, then [maintain content with an agent](../../handbook/chatgpt-sites/index.md#maintain-content-with-an-agent). Article pages advertise their Markdown mirror through an HTML `rel="alternate"` link; the example does not add a visible Markdown button to the reader UI.
6
6
 
7
7
  ## Before writing code
8
8
 
@@ -10,7 +10,7 @@ Read the user's business request and author the manifest for **their** records a
10
10
 
11
11
  ## Install and run
12
12
 
13
- Requires Mantle 0.1.2 or newer. Copy this directory outside the SDK checkout, then:
13
+ Requires Mantle 0.1.2 or newer. Copy this directory from the selected installed SDK version into a new application directory. Replace every `@aotter/mantle*` `latest` dependency in `package.json` with that same exact version, then:
14
14
 
15
15
  ```bash
16
16
  npm install # or: bun install
@@ -21,24 +21,41 @@ npm run dev -- --port 4174 # leave running
21
21
  npm test # smoke, in a second terminal
22
22
  ```
23
23
 
24
- `npm install` resolves `@aotter/mantle*` from the `latest` dist-tag; this
25
- example does not commit a lockfile, so every fresh install picks up the
26
- current stable release. `bun install` works too, resolving from
27
- `package.json` the same way.
24
+ This example does not commit a lockfile. Commit the lockfile created by your
25
+ first install and use `npm ci` for subsequent installs. `bun install` also
26
+ works when you use Bun's lockfile consistently.
27
+
28
+ ## Add a manifest HTTP Trigger
29
+
30
+ Mounting Admin does not register a manifest HTTP Trigger on the Site's Hono
31
+ router. For an anonymous JSON form whose Trigger declares `POST /api/rsvp`, add
32
+ the corresponding route inside `assemble` in `src/index.ts`:
33
+
34
+ ```ts
35
+ import { createMantleRequestHandler } from '@aotter/mantle/runtime';
36
+
37
+ const handleHttp = createMantleRequestHandler({ plan, getRuntime: get });
38
+ app.post('/api/rsvp', async c =>
39
+ (await handleHttp(c.req.raw, { user: null, staff: null, env: c.env }))
40
+ ?? new Response('Not found', { status: 404 }));
41
+ ```
42
+
43
+ Return the handler's `Response` directly: it validates the JSON body and maps
44
+ Mantle diagnostics to HTTP status codes. If the Trigger requires a signed-in
45
+ user or staff role, derive that context from the verified Sites session instead
46
+ of copying the anonymous context above. See [Procedures and Triggers](../../handbook/concepts/procedures-and-triggers.md#the-http-envelope).
28
47
 
29
48
  Keep `.openai/hosting.json`; do not copy an existing Site's `project_id`. To use another port, also set the Worker's `PUBLIC_ORIGIN` and the test's `MANTLE_TEST_ORIGIN` to that same localhost origin. Local test headers simulate Sites' trusted dispatcher; they do **not** prove deployed ChatGPT login.
30
49
 
31
50
  Review the entire [smoke script](./scripts/check.mjs) before adapting it. It covers D1 CRUD/version conflict, owner/member/role revocation, R2 read/write/delete, media create → PUT → commit → public read, both advertised MCP URLs, public MCP `initialize`/`tools/list`/View call, staff MCP authentication/catalog, draft isolation, published article HTML/Markdown/SEO, and negative auth/Origin/size checks. It creates and deletes only its own test records and objects.
32
51
 
33
- To run this example against an unreleased Mantle checkout instead of the registry, use `node scripts/check-packed-consumer.mjs --project docs/examples/host-chatgpt-sites --output <new dir> -- pnpm build` from a clean SDK checkout and work in its `consumer/`. That path is for SDK development only.
34
-
35
- The checked-in `drizzle/` migrations and `src/storage-fingerprint.json` match the example manifest. `scripts/migration.mjs` shows the one-time generation mechanism; do **not** run it against a deployed database or overwrite an applied migration. For a new business manifest, generate/review an initial migration before the first deployment; for a later change, generate an additive migration from the previous schema state.
52
+ The checked-in `drizzle/` migrations and `src/storage-fingerprint.json` match the example manifest and runtime. Apply all pending D1 migrations before deploying updated code; managed storage refuses to boot against an older database. After changing a Schema, first apply the current migrations to local D1, then run `npm run generate` and `npm run migrate:generate`. Review the newly appended SQL and apply it with `wrangler d1 migrations apply mantle-sites-reference-local --local`. Commit the new migration, `drizzle/meta/mantle-state.json`, journal, and fingerprint together. The generator checks the local database fingerprint before appending; it never changes an applied SQL file or applies D1 migrations itself. Deploy the reviewed migration before deploying code that expects its fingerprint.
36
53
 
37
54
  ## Publish with Sites
38
55
 
39
56
  1. Create a new Site through Sites and request **both D1 and R2**. Confirm its saved hosting manifest has `d1: "DB"` and `r2: "MEDIA_BUCKET"`; the local example intentionally omits `project_id` until Sites provisions one. A missing R2 binding cannot be repaired by adding an R2 type to TypeScript. Sites controls provisioning and publishing, not `wrangler deploy`.
40
57
  2. In Sites settings, set `PUBLIC_ORIGIN` to the exact production origin and `OWNER_EMAIL` to the intended first owner. Do not commit hosted secrets or identity headers. Keep the Site audience narrow until verification. A Site Viewer is not automatically a Mantle staff member.
41
- 3. Review the D1 migration, save a Sites version, then deploy that version. Every deployment URL is production. Confirm the deployed artifact includes `dist/server/index.js`, `dist/client/`, `dist/.openai/hosting.json` and `dist/.openai/drizzle/`; `npm run build` prepares those artifacts.
58
+ 3. Review the D1 migration, save a Sites version, then deploy that version. Every deployment URL is production. Confirm the deployed artifact includes `dist/server/index.js`, `dist/client/`, `dist/.openai/hosting.json` and `dist/.openai/drizzle/`; `npm run build` replaces `dist` before preparing those artifacts, so removed migrations cannot remain in a later build.
42
59
  4. On the deployed Site, check `/health`, `/admin/sign-in`, one `/_mantle/admin/assets/*` file, owner login and staff revocation, Admin media upload and committed public image URL, then publish an article with that asset as its cover. Anonymous draft and uncommitted image URLs must return 404. Check public HTML, Markdown, canonical/JSON-LD, sitemap and `llms.txt`; POST `/api/mcp` should discover only the public View tool, while `/api/mcp/staff` must reject anonymous/member requests and expose staff tools to a current staff session. The root `/mcp` path was intercepted in the lab and is not used by this reference.
43
60
 
44
61
  The media path uses only the R2 binding: `ports.mediaStorage` + `media.purposes` + authenticated same-origin PUT + committed-only public GET. It does not need an R2 S3 endpoint or API keys. The upload route is browser-session authenticated, so it is **not** an MCP agent upload route. Do not expose the Worker outside Sites' identity-stripping ingress: `src/chatgpt-auth.ts` trusts the `oai-*` headers only under that condition.
@@ -50,4 +67,4 @@ The media path uses only the R2 binding: `ports.mediaStorage` + `media.purposes`
50
67
  - `/api/mcp/staff` uses the Sites-injected browser identity and re-reads the Mantle staff role. It is mounted and advertised in Admin, but it is not an OAuth resource server. Do not register it as a remote ChatGPT connector until OAuth discovery, a standards-compliant bearer challenge and token verification are implemented and tested.
51
68
  - OAuth discovery returns sign-in HTML: Sites' page session is not an OAuth bearer challenge. Do not bypass Sites auth or trust browser cookies as remote MCP credentials.
52
69
 
53
- See the [Sites host reference](../../handbook/sites/host-reference.md) and [OpenAI Sites documentation](https://learn.chatgpt.com/docs/sites).
70
+ See the [Sites host reference](../../handbook/chatgpt-sites/host-reference.md) and [OpenAI Sites documentation](https://learn.chatgpt.com/docs/sites).
@@ -0,0 +1 @@
1
+ ALTER TABLE _mantle_boot_state ADD COLUMN store_instance_id TEXT;
@@ -0,0 +1,10 @@
1
+ CREATE TABLE IF NOT EXISTS _mantle_managed_runtime_state (
2
+ id INTEGER PRIMARY KEY CHECK (id = 1),
3
+ canonical_version TEXT NOT NULL
4
+ );
5
+ --> statement-breakpoint
6
+ INSERT INTO _mantle_schema_tables(name,projection) VALUES ('articles','{"columns":[["body","TEXT","string",false],["coverAssetId","TEXT","string",false],["summary","TEXT","string",false],["title","TEXT","string",false]],"indexes":[]}') ON CONFLICT(name) DO UPDATE SET projection=excluded.projection;
7
+ --> statement-breakpoint
8
+ INSERT INTO _mantle_managed_runtime_state(id,canonical_version) VALUES (1,'0006-managed-runtime-version') ON CONFLICT(id) DO UPDATE SET canonical_version=excluded.canonical_version;
9
+ --> statement-breakpoint
10
+ INSERT INTO _mantle_storage_state(id,fingerprint) VALUES (1,(SELECT CASE WHEN fingerprint='9ef85f9933e22328140e924045820af6be2a6985ed8ecc19b63a4f2a37826618' THEN '9ef85f9933e22328140e924045820af6be2a6985ed8ecc19b63a4f2a37826618' ELSE NULL END FROM _mantle_storage_state WHERE id=1)) ON CONFLICT(id) DO UPDATE SET fingerprint=excluded.fingerprint;
@@ -0,0 +1,24 @@
1
+ CREATE TABLE IF NOT EXISTS _mantle_schedule_runs (
2
+ run_id TEXT NOT NULL,
3
+ attempt INTEGER NOT NULL,
4
+ schedule_id TEXT NOT NULL,
5
+ scheduled_at INTEGER NOT NULL,
6
+ started_at INTEGER NOT NULL,
7
+ finished_at INTEGER,
8
+ status TEXT NOT NULL,
9
+ error_summary TEXT,
10
+ counts TEXT,
11
+ PRIMARY KEY (run_id, attempt)
12
+ );
13
+ --> statement-breakpoint
14
+ CREATE INDEX IF NOT EXISTS _mantle_schedule_runs_recent
15
+ ON _mantle_schedule_runs (started_at DESC);
16
+ --> statement-breakpoint
17
+ CREATE INDEX IF NOT EXISTS _mantle_schedule_runs_schedule_recent
18
+ ON _mantle_schedule_runs (schedule_id, started_at DESC);
19
+ --> statement-breakpoint
20
+ INSERT INTO _mantle_schema_tables(name,projection) VALUES ('articles','{"columns":[["body","TEXT","string",false],["coverAssetId","TEXT","string",false],["summary","TEXT","string",false],["title","TEXT","string",false]],"indexes":[]}') ON CONFLICT(name) DO UPDATE SET projection=excluded.projection;
21
+ --> statement-breakpoint
22
+ INSERT INTO _mantle_managed_runtime_state(id,canonical_version) VALUES (1,(SELECT CASE WHEN canonical_version='0006-managed-runtime-version' THEN '0007-schedule-run-observations' ELSE NULL END FROM _mantle_managed_runtime_state WHERE id=1)) ON CONFLICT(id) DO UPDATE SET canonical_version=excluded.canonical_version;
23
+ --> statement-breakpoint
24
+ INSERT INTO _mantle_storage_state(id,fingerprint) VALUES (1,(SELECT CASE WHEN fingerprint='9ef85f9933e22328140e924045820af6be2a6985ed8ecc19b63a4f2a37826618' THEN '9ef85f9933e22328140e924045820af6be2a6985ed8ecc19b63a4f2a37826618' ELSE NULL END FROM _mantle_storage_state WHERE id=1)) ON CONFLICT(id) DO UPDATE SET fingerprint=excluded.fingerprint;
@@ -1 +1 @@
1
- {"version":"7","dialect":"sqlite","entries":[{"idx":0,"version":"6","when":1790000000000,"tag":"0000_sites_users","breakpoints":true},{"idx":1,"version":"6","when":1790000000001,"tag":"0001_mantle","breakpoints":true},{"idx":2,"version":"6","when":1790000000002,"tag":"0002_article_cover","breakpoints":true}]}
1
+ {"version":"7","dialect":"sqlite","entries":[{"idx":0,"version":"6","when":1790000000000,"tag":"0000_sites_users","breakpoints":true},{"idx":1,"version":"6","when":1790000000001,"tag":"0001_mantle","breakpoints":true},{"idx":2,"version":"6","when":1790000000002,"tag":"0002_article_cover","breakpoints":true},{"idx":3,"version":"6","when":1790000000003,"tag":"0003_store_instance_id","breakpoints":true},{"idx":4,"version":"6","when":1790000000004,"tag":"0004_mantle","breakpoints":true},{"idx":5,"version":"6","when":1790300000000,"tag":"0005_mantle","breakpoints":true}]}