@aotter/mantle 0.2.0-alpha.7 → 0.2.0-alpha.9

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 (126) hide show
  1. package/README.md +27 -5
  2. package/dist/auth/adapter.js +9 -6
  3. package/dist/auth/caller.js +2 -1
  4. package/dist/auth/identity.d.ts +2 -2
  5. package/dist/auth/oauth.d.ts +33 -1
  6. package/dist/auth/oauth.js +121 -28
  7. package/dist/auth/routes.js +6 -4
  8. package/dist/build/compiler.d.ts +44 -122
  9. package/dist/build/compiler.js +202 -277
  10. package/dist/build/spec/domain/model/ManifestGrammar.d.ts +6 -5
  11. package/dist/build/spec/domain/model/SqlIr.d.ts +2 -0
  12. package/dist/build/spec/domain/service/PlanFingerprint.d.ts +2 -0
  13. package/dist/build/spec/kernel/diagnostic.d.ts +1 -1
  14. package/dist/domain/describe/{chunk-ZIQVLA7X.js → chunk-ZVXBGP7Y.js} +69 -8
  15. package/dist/domain/describe/index.js +1 -1
  16. package/dist/domain/describe/target-hash.js +1 -1
  17. package/dist/domain/describe/targets.d.ts +1 -1
  18. package/dist/domain/generated-tools.js +2 -0
  19. package/dist/domain/paging.js +41 -15
  20. package/dist/infrastructure/bundle.js +118 -15
  21. package/dist/infrastructure/cli.js +11 -15
  22. package/dist/infrastructure/generate.d.ts +1 -3
  23. package/dist/infrastructure/generate.js +11 -3
  24. package/dist/infrastructure/generateAuth.js +57 -0
  25. package/dist/infrastructure/inputs.js +8 -3
  26. package/dist/infrastructure/wrangler.js +50 -12
  27. package/dist/kernel/binds.d.ts +0 -3
  28. package/dist/kernel/contracts.d.ts +1 -1
  29. package/dist/kernel/contracts.js +4 -4
  30. package/dist/kernel/dialect/common.d.ts +0 -1
  31. package/dist/kernel/drain.d.ts +5 -0
  32. package/dist/kernel/drain.js +35 -0
  33. package/dist/kernel/driver/postgres.js +6 -2
  34. package/dist/kernel/host-caller.d.ts +1 -0
  35. package/dist/kernel/host-caller.js +1 -0
  36. package/dist/kernel/mcp-apps.d.ts +29 -9
  37. package/dist/kernel/mcp-apps.js +3 -3
  38. package/dist/kernel/mcp-handler.js +101 -18
  39. package/dist/kernel/mcp.d.ts +12 -3
  40. package/dist/kernel/mcp.js +31 -6
  41. package/dist/kernel/rest-router.js +3 -2
  42. package/dist/kernel/scalars.js +3 -2
  43. package/dist/kernel/site.d.ts +1 -3
  44. package/dist/kernel/site.js +2 -2
  45. package/dist/kernel/web-index.js +40 -0
  46. package/dist/kernel/web.d.ts +3 -1
  47. package/dist/kernel/web.js +6 -37
  48. package/dist/usecase/adminBindings.js +2 -3
  49. package/dist/usecase/adminClient.js +87 -0
  50. package/dist/usecase/adminDescriptors.js +19 -65
  51. package/dist/usecase/generate.js +5 -4
  52. package/dist/usecase/mcp-media.js +2 -2
  53. package/dist/usecase/mcp.js +16 -12
  54. package/dist/usecase/paging.js +2 -3
  55. package/dist/usecase/publishing.js +3 -3
  56. package/dist/usecase/site.js +0 -1
  57. package/dist/usecase/tool-version.js +9 -0
  58. package/dist/usecase/translations.js +1 -1
  59. package/dist/usecase/validation.js +128 -19
  60. package/dist/usecase/web.js +3 -2
  61. package/docs/examples/README.md +1 -1
  62. package/docs/examples/app-shell/README.md +45 -3
  63. package/docs/examples/app-shell/package.json +14 -6
  64. package/docs/examples/app-shell/smoke-kit.mjs +54 -0
  65. package/docs/examples/app-shell/src/auth.ts +6 -3
  66. package/docs/examples/app-shell/src/service.ts +3 -3
  67. package/docs/examples/app-shell/tsconfig.json +4 -1
  68. package/docs/examples/app-shell/worker-configuration.d.ts +2 -2
  69. package/docs/examples/app-shell/wrangler.jsonc +5 -4
  70. package/docs/examples/club-events/manifests/club-events.yaml +7 -0
  71. package/docs/examples/club-events/src/handlers.ts +1 -1
  72. package/docs/examples/generated-web/README.md +6 -2
  73. package/docs/examples/generated-web/wrangler.jsonc +1 -0
  74. package/docs/examples/purchasing/README.md +1 -1
  75. package/docs/examples/purchasing/manifests/purchasing.yaml +17 -1
  76. package/docs/examples/purchasing/smoke.mjs +10 -4
  77. package/docs/examples/purchasing/src/admin.tsx +13 -0
  78. package/docs/examples/purchasing/src/handlers.ts +1 -1
  79. package/docs/examples/purchasing/wrangler.jsonc +5 -4
  80. package/docs/examples/recipes/wrangler.jsonc +5 -4
  81. package/docs/handbook/cloudflare/authentication.md +43 -6
  82. package/docs/handbook/cloudflare/chatgpt-sites.md +4 -2
  83. package/docs/handbook/cloudflare/deploy-and-operate.md +45 -1
  84. package/docs/handbook/cloudflare/media-r2.md +2 -3
  85. package/docs/handbook/cloudflare/service-entry.md +68 -31
  86. package/docs/handbook/concepts/authorization.md +1 -1
  87. package/docs/handbook/concepts/mcp-and-agents.md +19 -0
  88. package/docs/handbook/concepts/runtime-and-adapters.md +1 -1
  89. package/docs/handbook/examples/hub.md +1 -1
  90. package/docs/handbook/guides/admin-ui.md +107 -1
  91. package/docs/handbook/guides/agent-setup.md +27 -9
  92. package/docs/handbook/guides/agent-workflow-acceptance.md +222 -0
  93. package/docs/handbook/guides/mcp-apps.md +522 -6
  94. package/docs/handbook/guides/native-admin.md +300 -51
  95. package/docs/handbook/guides/oauth.md +119 -5
  96. package/docs/handbook/guides/public-pages.md +2 -2
  97. package/docs/handbook/guides/size-and-startup.md +1 -1
  98. package/docs/handbook/guides/typed-queries.md +35 -0
  99. package/docs/handbook/navigation.json +0 -4
  100. package/docs/handbook/reference/admin-descriptors.md +0 -35
  101. package/docs/handbook/reference/procedure.md +6 -2
  102. package/docs/handbook/reference/schema.md +13 -3
  103. package/docs/handbook/reference/surface.md +129 -15
  104. package/docs/handbook/reference/trigger.md +43 -1
  105. package/docs/handbook/reference/view.md +1 -1
  106. package/docs/handbook/releases/index.md +74 -2
  107. package/docs/handbook/start/overview.md +1 -1
  108. package/docs/handbook/start/project-and-cli.md +16 -8
  109. package/docs/handbook/start/quickstart-worker.md +1 -1
  110. package/docs/skills/develop/SKILL.md +46 -18
  111. package/docs/skills/integrate/SKILL.md +4 -9
  112. package/docs/skills/media-gc/SKILL.md +7 -5
  113. package/docs/skills/provision/SKILL.md +18 -12
  114. package/docs/skills/update/SKILL.md +19 -18
  115. package/docs/upgrade-0.1-to-0.2.md +6 -6
  116. package/package.json +2 -1
  117. package/skills/README.md +11 -16
  118. package/skills/mantle/SKILL.md +39 -17
  119. package/skills/mantle/references/local-testing.md +9 -0
  120. package/skills/mantle/references/web.md +1 -1
  121. package/skills/mantle/references/website.md +26 -22
  122. package/docs/examples/app-shell/src/admin.ts +0 -10
  123. package/docs/examples/purchasing/src/admin.ts +0 -12
  124. package/docs/handbook/guides/admin-extensions.md +0 -20
  125. package/docs/skills/develop/mcp-app.md +0 -39
  126. package/skills/.keep +0 -0
@@ -8,4 +8,110 @@ Admin Views provide custom read lists; their SELECT outputs, column lineage and
8
8
 
9
9
  Generic publishing edits apply to drafts; publishing transitions retain their atomic guards and OCC. Read-only collections refuse generic edits while declared Procedures can still run. Ref operations receive the caller/transaction-bound Store.
10
10
 
11
- Use [extensions](admin-extensions.md) for app-owned pages, actions, panels or field renderers. Keep exact conflict/uncertain-outcome handling in the shared UI controller.
11
+ Use [`defineAdmin` components](native-admin.md#customising-admin) for app-owned cells, inputs, record asides and actions; server work is a Procedure, a View or an application route. Keep exact conflict/uncertain-outcome handling in the shared UI controller.
12
+
13
+ ## Theme
14
+
15
+ Admin is themed with CSS variables. Import your own stylesheet from `src/admin.tsx` (`import "./admin.css"`) and override the public tokens on `:root` for light and on `.dark` for dark:
16
+
17
+ ```css
18
+ :root {
19
+ --primary: #0f766e;
20
+ --primary-foreground: #ffffff;
21
+ --radius: 0.5rem;
22
+ }
23
+ .dark {
24
+ --primary: #2dd4bf;
25
+ --primary-foreground: #042f2e;
26
+ }
27
+ ```
28
+
29
+ Admin marks the active theme as both the `.dark` class and `data-theme="dark"` (or `"light"`) on the root. Dark tokens and Tailwind's `dark:` variant apply when either is present, so `[data-theme="dark"] {}` is equivalent to `.dark {}`. Your overrides apply in the browser Admin and, because the entry imports your CSS, in the [MCP App](mcp-apps.md#theme) too, where the host's neutral colours are laid over them.
30
+
31
+ | Token | Meaning |
32
+ | --- | --- |
33
+ | `--background` | Page background |
34
+ | `--foreground` | Default text |
35
+ | `--card` | Card and panel surface |
36
+ | `--card-foreground` | Text on a card |
37
+ | `--popover` | Menu, popover and dialog surface |
38
+ | `--popover-foreground` | Text on a popover |
39
+ | `--primary` | Brand color: primary buttons, active states |
40
+ | `--primary-foreground` | Text on `--primary` |
41
+ | `--secondary` | Secondary button surface |
42
+ | `--secondary-foreground` | Text on `--secondary` |
43
+ | `--muted` | Subtle surface: table stripes, disabled areas |
44
+ | `--muted-foreground` | Secondary text |
45
+ | `--accent` | Hover and selected surface |
46
+ | `--accent-foreground` | Text on `--accent` |
47
+ | `--destructive` | Destructive actions and errors |
48
+ | `--border` | Borders and dividers |
49
+ | `--input` | Form control borders |
50
+ | `--ring` | Focus ring |
51
+ | `--radius` | Base corner radius; the other radii derive from it |
52
+ | `--success` | Success status color |
53
+ | `--warning` | Warning status color |
54
+ | `--info` | Informational status color |
55
+ | `--chart-1` | Chart series 1 |
56
+ | `--chart-2` | Chart series 2 |
57
+ | `--chart-3` | Chart series 3 |
58
+ | `--chart-4` | Chart series 4 |
59
+ | `--chart-5` | Chart series 5 |
60
+ | `--sidebar` | Sidebar surface |
61
+ | `--sidebar-foreground` | Sidebar text |
62
+ | `--sidebar-primary` | Sidebar active item |
63
+ | `--sidebar-primary-foreground` | Text on `--sidebar-primary` |
64
+ | `--sidebar-accent` | Sidebar hover surface |
65
+ | `--sidebar-accent-foreground` | Text on `--sidebar-accent` |
66
+ | `--sidebar-border` | Sidebar borders |
67
+ | `--sidebar-ring` | Sidebar focus ring |
68
+ | `--app-base` | Solid color behind the page |
69
+ | `--app-background` | Page backdrop (any CSS background, such as a gradient) |
70
+
71
+ Every other variable, including `--mantle-blue-*` and `--chrome-glass`, is internal and may change without notice.
72
+
73
+ ## Eject a component
74
+
75
+ `@aotter/mantle-admin` ships a [shadcn registry](https://ui.shadcn.com/docs/registry) of starting-point components for the `defineAdmin` slots. Ejecting copies one into your source: you own that file and edit it freely, while the hooks it calls (`@aotter/mantle-admin/hooks`) and the slot prop types (`@aotter/mantle-admin/app`) keep upgrading with the package. The registry is inside the installed package, so the copy matches the version you run and no registry host is involved (the shadcn CLI itself downloads from npm and needs network). Install from the package, in the app's root:
76
+
77
+ ```bash
78
+ npx shadcn@4 add ./node_modules/@aotter/mantle-admin/dist/registry/admin-cell.json
79
+ ```
80
+
81
+ The file lands in `src/admin/<item>.tsx` (the item's `target` ignores aliases). The CLI needs a `tsconfig.json` and a `components.json` in the app's root; this minimal one works, because no alias or stylesheet is used:
82
+
83
+ ```json
84
+ {
85
+ "$schema": "https://ui.shadcn.com/schema.json",
86
+ "style": "new-york",
87
+ "rsc": false,
88
+ "tsx": true,
89
+ "tailwind": { "config": "", "css": "", "baseColor": "neutral", "cssVariables": true },
90
+ "aliases": { "components": "@/components", "utils": "@/lib/utils" }
91
+ }
92
+ ```
93
+
94
+ The CLI removes a comment above a file's first import, so each item keeps its header below the imports. Import it in `src/admin.tsx` and name the slot, replacing the sample collection, field, View and operation with your own:
95
+
96
+ ```tsx
97
+ import { AdminCell } from "./admin/admin-cell";
98
+
99
+ export default defineAdmin(admin, { components: { "cell:requests.status": AdminCell } });
100
+ ```
101
+
102
+ | Item | Slots | Surface |
103
+ | --- | --- | --- |
104
+ | `admin-cell` | `cell:view:<view>.<column>` | both (also reusable as a browser collection cell) |
105
+ | `admin-input` | `input:<schema>.<field>` | browser |
106
+ | `admin-record-actions` | `record.actions:<schema>` (runs an operation with `useOperation`) | browser |
107
+ | `admin-record-aside` | `record.aside:<schema>` (lists a View's rows with `useView`) | browser |
108
+ | `admin-sidebar` | `Sidebar` (`renderDefault` with a footer link) | browser |
109
+ | `admin-home` | `Home` (`renderDefault` under a section that reads a View) | browser |
110
+
111
+ Each file starts with a comment naming its surface and rules, and imports only `react`, `@aotter/mantle-admin/app` and `@aotter/mantle-admin/hooks`. A `both` component also renders in the Admin MCP App, inside a host's sandboxed iframe, so keep it to these rules:
112
+
113
+ - Read data only through `useView` and `useOperation`; `useEntries`, `useEntry`, `useCollectionTotal`, `useMe` and `useBadges` read `unavailable` there. Declare what a card needs as an admin View.
114
+ - Link only with `<AdminLink>` or `useOpenLink()`; never `window.open` or `target="_blank"`.
115
+ - No `fetch`, no `document.cookie` or `localStorage` authentication, no remote origin that the host's CSP does not allow, and no assumed width.
116
+ - Where `useOperation` returns no `run` (a host without server tools), show the control disabled with a note rather than throwing or vanishing.
117
+ - Branch on `useAdminSurface()` (or the `surface` prop) if you must, and render something sensible in both branches.
@@ -12,24 +12,42 @@ carries.
12
12
 
13
13
  The Mantle plugin carries one OSS authoring skill, `mantle`, and local
14
14
  acceptance references. It does not configure a hosted-service connection.
15
+ Install from the Git tag matching the exact SDK version you selected (currently
16
+ `v0.2.0-alpha.9`). Alpha releases integrate on `develop`; an unqualified
17
+ `aotter/mantle` source follows `main` and can install older, incompatible
18
+ instructions. A skill install does not upgrade the application's SDK.
15
19
 
16
- ```bash
17
- # Claude Code: two separate prompts
18
- /plugin marketplace add aotter/mantle
19
- /plugin install mantle@mantle
20
+ For Codex, pin the marketplace checkout:
20
21
 
21
- # Codex
22
- codex plugin marketplace add aotter/mantle
22
+ ```sh
23
+ codex plugin marketplace add aotter/mantle --ref v0.2.0-alpha.9
23
24
  codex plugin add mantle@mantle
24
25
  ```
25
26
 
26
- Cursor and GitHub Copilot read the plugin manifests from the repository.
27
- Without a plugin host, install the skill alone:
27
+ For Claude Code, first clone the release into a directory you will keep:
28
+
29
+ ```sh
30
+ git clone --depth 1 --branch v0.2.0-alpha.9 https://github.com/aotter/mantle.git mantle-plugin
31
+ ```
32
+
33
+ Then, in Claude Code, use that checkout's absolute path:
34
+
35
+ ```text
36
+ /plugin marketplace add /absolute/path/to/mantle-plugin
37
+ /plugin install mantle@mantle
38
+ ```
39
+
40
+ Cursor and GitHub Copilot use their plugin manifests from the same tagged
41
+ checkout. Without a plugin host, install only the consumer skill by name:
28
42
 
29
43
  ```sh
30
- npx skills add aotter/mantle
44
+ npx skills add https://github.com/aotter/mantle/tree/v0.2.0-alpha.9 --skill mantle
31
45
  ```
32
46
 
47
+ When upgrading the SDK, update the marketplace ref or local tagged checkout and
48
+ refresh/reinstall the plugin using the host's native workflow. Verify the loaded
49
+ manifest version and skill source. Do not reset a checkout containing local edits.
50
+
33
51
  Read the path the installer prints (for project-local Codex,
34
52
  `.agents/skills/mantle/SKILL.md`). The skill installs no SDK, creates no
35
53
  project and copies no handbook.
@@ -0,0 +1,222 @@
1
+ # Independently accept a user-facing workflow
2
+
3
+ Before reporting any user-facing deliverable as done, exercise it from the
4
+ user's position with a fresh end-user agent. This applies to Admin pages and
5
+ customisations, application pages and web routes, REST APIs used by clients,
6
+ MCP tools and MCP Apps. Generation, typechecking, scripted smoke tests and an
7
+ author's replay remain useful; they do not establish independent acceptance. A
8
+ fresh context is not enough if the author still chooses a workflow that mirrors
9
+ the implementation. Every acceptance round gives the evaluator responsibility
10
+ for choosing realistic tasks and judging the result, not just following a
11
+ prescribed sequence.
12
+ If independent acceptance is not run, report `UNVERIFIED`; if a fresh evaluator
13
+ or authorized test transport is unavailable, report `BLOCKED`; neither outcome
14
+ is done.
15
+
16
+ Use the surface the intended user actually uses: a real browser session for
17
+ Admin and application pages; for REST, an HTTP client plus the public API
18
+ reference and base URL a real client developer receives; an MCP client for
19
+ tools; and the real MCP App host/AppBridge flow for Apps. This is an
20
+ application-authoring practice, not an SDK runtime service or a new test runner.
21
+ Use the project's existing local setup, normal authorized sign-in and isolated
22
+ fixtures. Setup hands over the role's established browser session or client
23
+ token; the evaluator never acquires or widens credentials. Give it only its
24
+ authorized surface. Do not enable extra routes, roles or generic writes to make
25
+ the exercise pass.
26
+
27
+ ## Audit MCP tool design before implementation
28
+
29
+ Start with the original user brief, business role and explicit requirements,
30
+ not a list of CRUD endpoints or a task derived from what you implemented.
31
+ Before writing manifests or handlers, record the intended jobs and assumptions
32
+ in the existing design note. Keep the author's capability map separate from
33
+ the brief an evaluator receives: the evaluator chooses its own tasks and
34
+ observable success criteria. Do not expand application scope or authority
35
+ merely to satisfy an evaluator's newly inferred product wish.
36
+
37
+ In the application's existing design note or issue, map each goal step to its
38
+ proposed public capability: discovery inputs, returned IDs and evidence, allowed
39
+ caller, write/transaction boundary and recovery. Mark missing capabilities or
40
+ unresolved contracts as gaps before writing manifests or handlers. Review the
41
+ following rubric against that map:
42
+
43
+ | Design question | Required contract or explicit gap |
44
+ | --- | --- |
45
+ | Can the agent locate the right record? | Bounded search/filter inputs, stable IDs, deterministic cursor paging and sensible limits. It must not scan every list or guess an ID from a display label. |
46
+ | Can it choose an eligible relation? | Finding an ID is not proof of business eligibility: verify the role, state and ownership required by the relationship. Return enough labels to distinguish same-name choices before writing. |
47
+ | Can it correct an ordinary mistake? | State how to amend, clear or replace optional fields and relations, and how duplicate records are detected or reconciled. Test omitted, null and empty inputs against that contract; existence and type checks alone do not establish business validity. Express conditional-required inputs with the supported [input rules](../reference/surface.md) before writing handler checks. |
48
+ | Can it read a complete business result? | ID-based detail/readback under the intended caller, including every relation the goal creates or changes. A parent list is not proof of its child/contact/state details. Distinguish absent/inaccessible from incomplete evidence. |
49
+ | Can it verify a create or update? | Return the backend entity ID, actual committed version where applicable, and a safe result summary or a documented authorized readback. State the exact result nesting. Echoed input or the submitted `expectedVersion` is not proof of committed state. Specify PATCH versus full replacement and omitted/null-field semantics so an update cannot erase unseen fields. |
50
+ | What does a version protect? | Name its entity/snapshot scope; a parent version does not imply child rows or aggregates are unchanged. Use the reviewed observed version for OCC, define conflict behavior and preserve the user's proposed changes without silently rebinding/retrying. |
51
+ | Can it complete a business transition? | Name permitted source/destination states, preconditions, related effects and final readback. Prefer an outcome-oriented operation when arbitrary field updates would leave the workflow unfinished. |
52
+ | What commits together? | Define the native Procedure/Store atomic boundary. Separate tool calls are independent; describe partial success and deliberate compensation. Do not imply that an agent can roll back earlier calls or that compensation is always possible. |
53
+ | Can it interpret refusal and failure? | Document success and structured diagnostic/error envelopes, including MCP `isError`; HTTP 200 or a wrapper's transport success is insufficient. Inspect raw MCP diagnostics separately from host-visible wrapper errors; a wrapper label alone does not locate a runtime defect or require global error normalization. Missing relations, stale versions and denied callers need meaningful refusals without leaking another caller's records or native internals. |
54
+ | What happens after a duplicate or uncertain write? | State whether idempotency exists, its key/scope/lifetime when supported, or that repeated successful calls may repeat effects. Provide an authorized reconciliation route for timeout/unknown outcomes; never automatically retry an uncertain write. |
55
+ | Can it explain amounts correctly? | Declare currency, stored/wire units, exact-value representation, rounding and whether null means unknown. Label every ratio's numerator and denominator: cost/budget, sales/budget and gross/sales are different measures. |
56
+ | Does data remain usable without an App? | Keep ordinary reads data-only; attach a renderer deliberately for interactive inspection, with structured/text fallback. Rendering must not write or imply approval. Host catalog refresh, OAuth and real client/UI behavior have separate acceptance; descriptions cannot force generative UI layout. |
57
+ | Does every step respect the user's authority? | Verify least privilege, tenant/owner scope, allowed fields, relation access and negative cases on the server. Tool visibility, annotations, descriptions and UI confirmation never grant permission. Use authorized disposable fixtures and a cleanup owner without widening production writes/deletes. |
58
+
59
+ A design passes this audit only when each required goal step has a supported
60
+ capability and verifiable output/recovery; preserve unresolved gaps and owners.
61
+ The audit is a design review, not execution evidence. Record intentional
62
+ exclusions, but keep an unmet explicit user requirement unresolved until the
63
+ user changes its scope; do not redefine it as optional to make a round pass.
64
+ Reuse the installed version's Views,
65
+ Procedures, Store and surface contracts; a missing business tool is not by
66
+ itself an SDK runtime defect.
67
+
68
+ For simple creates/partial updates, prefer a declared Store-backed `ref`
69
+ Procedure: await the caller-bound Store write, return a safe allowlist with its
70
+ actual returned ID/version, and keep `requires` plus generated input validation
71
+ at invocation. A transaction-bound write result remains provisional until the
72
+ outer transaction commits; publish success only after that boundary completes. Store row policy alone is not Procedure authorization. Define
73
+ omitted versus null patch semantics; never fill unseen fields with defaults.
74
+ Keep SQL Procedures for atomic stock changes, conditional state transitions and
75
+ related writes. A TypeScript pre-read does not replace an atomic WHERE/CHECK;
76
+ D1 supports batch, not an interactive transaction or consuming an earlier batch
77
+ result. See the [Store write guide](typed-queries.md#prefer-store-backed-ref-procedures-for-simple-writes).
78
+
79
+ Then implement the minimum contract and run generated/type, authorization,
80
+ atomicity and other relevant regressions. Follow the independent acceptance
81
+ rounds below before claiming the user-facing work is done. Keep the author's
82
+ capability map and worked call sequence out of the fresh agent's prompt: an MCP
83
+ evaluator must discover the workflow from public tool descriptions and results.
84
+
85
+ ## Run independent acceptance rounds until they converge
86
+
87
+ 1. **Freeze scope and revision, not the evaluator's itinerary.** Supply the
88
+ original user brief, business role, explicit requirements and exclusions,
89
+ exact application/SDK revision, authorized transport, permitted fake-data
90
+ actions, per-round interaction/time/write budgets, a user-set total round cap of at
91
+ least three (default four) and a fixture cleanup owner. Seed fixtures with
92
+ realistic volume and variety: other owners' records, several states and more
93
+ than one page of results, so evaluators' own goals reach discovery, paging
94
+ and authority. Explicitly authorize synthetic writes only where the user has
95
+ authorized testing. Production writes and external side effects need their
96
+ own authorization.
97
+ 2. **Use a new end-user subagent in every round.** Start without inherited
98
+ implementation history. Withhold source, SQL, internal docs, capability maps,
99
+ precomputed IDs, hidden routes or tool names, prescribed interaction order
100
+ and previous reports or fixes. Ask
101
+ the agent to state its own realistic goals and observable success criteria
102
+ before execution, use or discover the user-facing surface and assess whether
103
+ it supports the work. Ask whether it can make the decisions needed for its
104
+ goals, not merely issue successful calls. Do not prescribe the author's
105
+ happy path or require a minimum number of defects. Zero findings is a valid
106
+ observation. Run the evaluator outside the project directory, without Mantle
107
+ skills or project instruction files, with only the intended browser, HTTP
108
+ client, MCP client or MCP App host/AppBridge available, and record that
109
+ isolation in the evidence. For a multi-role workflow, run one
110
+ fresh agent per role in the same round on shared live data in the brief's
111
+ natural order; the later role finds earlier records through the service, and
112
+ the first agent may take a resumed turn to observe the outcome. Each agent
113
+ still chooses its own goals.
114
+ 3. **Keep evidence and scope judgments.** Require PASS/FAIL/BLOCKED per chosen
115
+ goal, actual readbacks, rejected writes, recovery, interaction costs and
116
+ design findings with materiality, evidence and the smallest suggested repair.
117
+ Separate a violated explicit requirement, a demonstrated defect and a newly
118
+ inferred product need. Missing capability is a finding, not permission to
119
+ invent interfaces or automatically expand the product. A rendered page,
120
+ HTTP 200, successful tool result or creation ID alone does not prove a
121
+ complete business result. Preserve setup assistance
122
+ and label any coached attempt; do not count it as a clean independent round.
123
+ 4. **Repair outside the evaluator's context.** The author retains the full
124
+ findings ledger, classifies application design, SDK/runtime, docs, transport
125
+ setup and host issues separately, then makes the smallest in-scope repair.
126
+ Turn reproduced failures into focused regression checks and run them with
127
+ relevant authorization, OCC and atomicity checks. Keep native guards; do not
128
+ shim away errors or retry uncertain writes. A runtime change needs a minimal
129
+ supported-contract reproduction. Record optional product suggestions and
130
+ unresolved scope questions rather than silently dropping findings.
131
+ 5. **Repeat the whole evaluation with a fresh agent.** Freeze the new revision
132
+ and supply the same original brief and authority, with new fixtures. Let
133
+ this evaluator choose its own goals again; do not pass the ledger or steer
134
+ it toward the previous repair. Replaying a known failure remains an author's
135
+ regression check and does not replace independent design evaluation.
136
+ 6. **Judge convergence across rounds.** Converge only after two consecutive
137
+ unassisted fresh rounds on the same revision with no new material in-scope
138
+ finding and no unresolved material defect. A finding is material when it
139
+ violates an explicit requirement, makes an evaluator's goal FAIL or BLOCKED,
140
+ or exposes an authority, data-integrity or uncertain-write defect; record
141
+ why any finding was judged non-material. Every repair creates a new revision
142
+ and resets the streak, so hold non-material repairs until after the verdict.
143
+ Each explicit requirement observable from the evaluator's role needs
144
+ evaluator-observed evidence; requirements outside that role's view (another
145
+ caller's isolation or hidden state) are verified by author regressions and
146
+ reported under that label. A role-observable requirement no evaluator reached
147
+ is UNVERIFIED and blocks CONVERGED. If fresh evaluators never reach a required
148
+ path, vary the fixtures, not the brief or the steps, or report that path as
149
+ UNVERIFIED. Repeated success on one narrow path cannot establish broader
150
+ readiness. Keep optional wishes, non-material suggestions and external
151
+ BLOCKED gates visible; no finding count proves absence of defects. When the
152
+ round cap or an external blocker stops the loop, report NOT CONVERGED or
153
+ BLOCKED with the remaining work, not acceptance. Setup cleans isolated
154
+ fixtures in `finally` after every round, including failed/aborted rounds.
155
+
156
+ If a fresh agent or authorized test transport is unavailable, record independent
157
+ acceptance as BLOCKED and report the scripted checks separately. Do not invent
158
+ an independent result. Do not deploy or publish merely to obtain acceptance.
159
+
160
+ ## Give the agent a role and the user's brief
161
+
162
+ Fill in a brief like this using the actual user's request and authorized
163
+ scope. Do not replace it with a sequence tailored to existing tools:
164
+
165
+ > You are a [business role] working in [business context]. The user requested:
166
+ > [original brief, explicit requirements and exclusions]. You are authorized
167
+ > to test with fictional data through [user-facing surface and entry point]
168
+ > within [allowed actions and interaction/time/write budgets]; [owner] will clean up
169
+ > the fixtures.
170
+ > Independently define realistic acceptance goals and observable success
171
+ > criteria before testing. Use or discover the supplied interface and assess
172
+ > whether it lets you make the decisions your goals require, not merely perform
173
+ > successful interactions. Report per-goal PASS/FAIL/BLOCKED with readback
174
+ > evidence, design shortcomings, interaction costs and minimal improvements.
175
+ > Distinguish failures within the requested scope from newly inferred product
176
+ > needs; do not invent unsupported interfaces or change the product. Do not inspect
177
+ > source, internal docs or a database, blindly retry uncertain writes, or act
178
+ > outside the supplied authority. Finding no defects is acceptable; report
179
+ > what you actually covered and what remains unverified.
180
+
181
+ The author separately verifies isolation between callers, stale-version
182
+ refusal, unknown-outcome handling and effects hidden from the evaluator's role
183
+ through authorized test fixtures. Do not grant the evaluator extra authority
184
+ just to observe hidden state. Keep author regressions distinct from what the
185
+ fresh agent actually observed.
186
+
187
+ ## Record evidence in the existing issue or handoff
188
+
189
+ Use ordinary Markdown; no new receipt schema or framework is required:
190
+
191
+ - Original brief, explicit requirements and exclusions, role, environment,
192
+ per-round budgets and round cap.
193
+ - Setup assistance and what each agent could access; identify distinct rounds.
194
+ - Per round: revision, the evaluator's own goals and criteria, per-goal
195
+ PASS/FAIL/BLOCKED, actual readbacks and interaction references,
196
+ request/page/tool counts
197
+ and negative/recovery attempts, with their differing scope stated.
198
+ - Findings ledger with materiality, owner, disposition, minimal repair and
199
+ regression commands/results.
200
+ - Streak and reset history; coverage of each explicit requirement
201
+ (evaluator-observed, author regression only, or UNVERIFIED); the final
202
+ CONVERGED / NOT CONVERGED / BLOCKED / UNVERIFIED verdict and rounds used. Retain every
203
+ failed report.
204
+ - Fixture cleanup result and every remaining limitation.
205
+
206
+ Keep credentials, raw auth logs, full resource HTML and private operational
207
+ details local/private; publish only sanitized contract evidence. Do not claim a
208
+ call-cost improvement when rounds exercise different negative/discovery cases.
209
+ Version fields usually describe an entity row, not all related aggregates;
210
+ state money units and the denominator of any budget or margin calculation.
211
+
212
+ ## Keep surface evidence distinct
213
+
214
+ Evidence from one surface does not prove another. Tool metadata and protocol
215
+ discovery do not prove that an MCP App rendered in its real host through
216
+ AppBridge; a REST response does not prove the Admin or application page; and a
217
+ browser rendering does not prove an external client can use the REST contract.
218
+ Record the actual browser, client or host version, identity, observed interface
219
+ and behavior for the deliverable under acceptance. Keep data results available
220
+ without Apps; descriptions cannot force a host's generative UI layout. Local
221
+ cookie-session acceptance, OAuth client integration and long-term renewal
222
+ likewise require their own evidence when they are part of the requested work.