@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.
- package/README.md +27 -5
- package/dist/auth/adapter.js +9 -6
- package/dist/auth/caller.js +2 -1
- package/dist/auth/identity.d.ts +2 -2
- package/dist/auth/oauth.d.ts +33 -1
- package/dist/auth/oauth.js +121 -28
- package/dist/auth/routes.js +6 -4
- package/dist/build/compiler.d.ts +44 -122
- package/dist/build/compiler.js +202 -277
- package/dist/build/spec/domain/model/ManifestGrammar.d.ts +6 -5
- package/dist/build/spec/domain/model/SqlIr.d.ts +2 -0
- package/dist/build/spec/domain/service/PlanFingerprint.d.ts +2 -0
- package/dist/build/spec/kernel/diagnostic.d.ts +1 -1
- package/dist/domain/describe/{chunk-ZIQVLA7X.js → chunk-ZVXBGP7Y.js} +69 -8
- package/dist/domain/describe/index.js +1 -1
- package/dist/domain/describe/target-hash.js +1 -1
- package/dist/domain/describe/targets.d.ts +1 -1
- package/dist/domain/generated-tools.js +2 -0
- package/dist/domain/paging.js +41 -15
- package/dist/infrastructure/bundle.js +118 -15
- package/dist/infrastructure/cli.js +11 -15
- package/dist/infrastructure/generate.d.ts +1 -3
- package/dist/infrastructure/generate.js +11 -3
- package/dist/infrastructure/generateAuth.js +57 -0
- package/dist/infrastructure/inputs.js +8 -3
- package/dist/infrastructure/wrangler.js +50 -12
- package/dist/kernel/binds.d.ts +0 -3
- package/dist/kernel/contracts.d.ts +1 -1
- package/dist/kernel/contracts.js +4 -4
- package/dist/kernel/dialect/common.d.ts +0 -1
- package/dist/kernel/drain.d.ts +5 -0
- package/dist/kernel/drain.js +35 -0
- package/dist/kernel/driver/postgres.js +6 -2
- package/dist/kernel/host-caller.d.ts +1 -0
- package/dist/kernel/host-caller.js +1 -0
- package/dist/kernel/mcp-apps.d.ts +29 -9
- package/dist/kernel/mcp-apps.js +3 -3
- package/dist/kernel/mcp-handler.js +101 -18
- package/dist/kernel/mcp.d.ts +12 -3
- package/dist/kernel/mcp.js +31 -6
- package/dist/kernel/rest-router.js +3 -2
- package/dist/kernel/scalars.js +3 -2
- package/dist/kernel/site.d.ts +1 -3
- package/dist/kernel/site.js +2 -2
- package/dist/kernel/web-index.js +40 -0
- package/dist/kernel/web.d.ts +3 -1
- package/dist/kernel/web.js +6 -37
- package/dist/usecase/adminBindings.js +2 -3
- package/dist/usecase/adminClient.js +87 -0
- package/dist/usecase/adminDescriptors.js +19 -65
- package/dist/usecase/generate.js +5 -4
- package/dist/usecase/mcp-media.js +2 -2
- package/dist/usecase/mcp.js +16 -12
- package/dist/usecase/paging.js +2 -3
- package/dist/usecase/publishing.js +3 -3
- package/dist/usecase/site.js +0 -1
- package/dist/usecase/tool-version.js +9 -0
- package/dist/usecase/translations.js +1 -1
- package/dist/usecase/validation.js +128 -19
- package/dist/usecase/web.js +3 -2
- package/docs/examples/README.md +1 -1
- package/docs/examples/app-shell/README.md +45 -3
- package/docs/examples/app-shell/package.json +14 -6
- package/docs/examples/app-shell/smoke-kit.mjs +54 -0
- package/docs/examples/app-shell/src/auth.ts +6 -3
- package/docs/examples/app-shell/src/service.ts +3 -3
- package/docs/examples/app-shell/tsconfig.json +4 -1
- package/docs/examples/app-shell/worker-configuration.d.ts +2 -2
- package/docs/examples/app-shell/wrangler.jsonc +5 -4
- package/docs/examples/club-events/manifests/club-events.yaml +7 -0
- package/docs/examples/club-events/src/handlers.ts +1 -1
- package/docs/examples/generated-web/README.md +6 -2
- package/docs/examples/generated-web/wrangler.jsonc +1 -0
- package/docs/examples/purchasing/README.md +1 -1
- package/docs/examples/purchasing/manifests/purchasing.yaml +17 -1
- package/docs/examples/purchasing/smoke.mjs +10 -4
- package/docs/examples/purchasing/src/admin.tsx +13 -0
- package/docs/examples/purchasing/src/handlers.ts +1 -1
- package/docs/examples/purchasing/wrangler.jsonc +5 -4
- package/docs/examples/recipes/wrangler.jsonc +5 -4
- package/docs/handbook/cloudflare/authentication.md +43 -6
- package/docs/handbook/cloudflare/chatgpt-sites.md +4 -2
- package/docs/handbook/cloudflare/deploy-and-operate.md +45 -1
- package/docs/handbook/cloudflare/media-r2.md +2 -3
- package/docs/handbook/cloudflare/service-entry.md +68 -31
- package/docs/handbook/concepts/authorization.md +1 -1
- package/docs/handbook/concepts/mcp-and-agents.md +19 -0
- package/docs/handbook/concepts/runtime-and-adapters.md +1 -1
- package/docs/handbook/examples/hub.md +1 -1
- package/docs/handbook/guides/admin-ui.md +107 -1
- package/docs/handbook/guides/agent-setup.md +27 -9
- package/docs/handbook/guides/agent-workflow-acceptance.md +222 -0
- package/docs/handbook/guides/mcp-apps.md +522 -6
- package/docs/handbook/guides/native-admin.md +300 -51
- package/docs/handbook/guides/oauth.md +119 -5
- package/docs/handbook/guides/public-pages.md +2 -2
- package/docs/handbook/guides/size-and-startup.md +1 -1
- package/docs/handbook/guides/typed-queries.md +35 -0
- package/docs/handbook/navigation.json +0 -4
- package/docs/handbook/reference/admin-descriptors.md +0 -35
- package/docs/handbook/reference/procedure.md +6 -2
- package/docs/handbook/reference/schema.md +13 -3
- package/docs/handbook/reference/surface.md +129 -15
- package/docs/handbook/reference/trigger.md +43 -1
- package/docs/handbook/reference/view.md +1 -1
- package/docs/handbook/releases/index.md +74 -2
- package/docs/handbook/start/overview.md +1 -1
- package/docs/handbook/start/project-and-cli.md +16 -8
- package/docs/handbook/start/quickstart-worker.md +1 -1
- package/docs/skills/develop/SKILL.md +46 -18
- package/docs/skills/integrate/SKILL.md +4 -9
- package/docs/skills/media-gc/SKILL.md +7 -5
- package/docs/skills/provision/SKILL.md +18 -12
- package/docs/skills/update/SKILL.md +19 -18
- package/docs/upgrade-0.1-to-0.2.md +6 -6
- package/package.json +2 -1
- package/skills/README.md +11 -16
- package/skills/mantle/SKILL.md +39 -17
- package/skills/mantle/references/local-testing.md +9 -0
- package/skills/mantle/references/web.md +1 -1
- package/skills/mantle/references/website.md +26 -22
- package/docs/examples/app-shell/src/admin.ts +0 -10
- package/docs/examples/purchasing/src/admin.ts +0 -12
- package/docs/handbook/guides/admin-extensions.md +0 -20
- package/docs/skills/develop/mcp-app.md +0 -39
- package/skills/.keep +0 -0
|
@@ -7,19 +7,21 @@ selected host's frontend kit before choosing APIs. Native applications use
|
|
|
7
7
|
their installed `docs/handbook/guides/native-admin.md` and the
|
|
8
8
|
[web contract](web.md).
|
|
9
9
|
|
|
10
|
-
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
10
|
+
- For self-hosted applications, build Admin with `mantle bundle` and serve it as
|
|
11
|
+
the installed `docs/handbook/guides/native-admin.md` describes. The application
|
|
12
|
+
owns auth, OTP delivery and verified Caller wiring; use a console/test sender
|
|
13
|
+
locally and configure production email for deployment. If a host already
|
|
14
|
+
supplies identity/Admin, reuse its explicit contract and reserved routes.
|
|
15
|
+
Add visitor sign-in where needed. Backend permissions enforce roles and data
|
|
16
|
+
access; host membership alone is not application admin authority.
|
|
14
17
|
- Integrate image selection/upload into content editing through the existing
|
|
15
|
-
Admin media library and
|
|
16
|
-
contract and `x-mantle-ref: media_assets` plus `x-mcp-hint: media-image`; store committed asset IDs, resolve permanent variants in the frontend, never use an ID as an image URL.
|
|
17
|
-
uses admin); host project credentials are not application credentials. Upload capability URLs are temporary,
|
|
18
|
+
Admin media library and the application's selected storage. Follow the pinned Core upload/PUT/commit
|
|
19
|
+
contract and `x-mantle-ref: media_assets` plus `x-mcp-hint: media-image`; store committed asset IDs, resolve permanent variants in the frontend, never use an ID as an image URL. The application's `/mcp/admin` supplies `get_media_upload_policy` → `create_media_upload` → direct HTTP PUT → `commit_media_upload` when its shared media adapter is wired. Follow the installed media authentication contract; host project credentials are not application credentials. Upload capability URLs are temporary,
|
|
18
20
|
not committed public images; anonymous visitors must not gain admin media access.
|
|
19
21
|
- Generate an accessible, responsive public frontend by reading the installed
|
|
20
|
-
|
|
22
|
+
generated `web.ts` and REST contracts; browser code on static hosts uses
|
|
21
23
|
same-origin fetch, not a server surface imported into the browser. Do not install the historical standalone
|
|
22
|
-
`@aotter/mantle-web` or claim Core supplies an HTML renderer.
|
|
24
|
+
`@aotter/mantle-web` or claim Core supplies an HTML renderer. The application-owned Fetch entry renders HTML; follow the selected host's static/template restrictions.
|
|
23
25
|
- Public content follows the installed `docs/handbook/guides/public-pages.md`
|
|
24
26
|
(the one list of head tags, JSON-LD, languages, Markdown, sitemap, robots and
|
|
25
27
|
`llms.txt`). For public content on static hosts disable SPA fallback and check unknown URLs
|
|
@@ -32,16 +34,18 @@ uses admin); host project credentials are not application credentials. Upload ca
|
|
|
32
34
|
dependency; a dynamic blog is blocked until that path exists. Do not silently
|
|
33
35
|
substitute build-time sample content for live tenant content.
|
|
34
36
|
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
block
|
|
37
|
+
Follow the [local HTTP acceptance](local-testing.md) before reporting local
|
|
38
|
+
readiness: inspect HTML without JavaScript, check metadata/sitemap and anonymous
|
|
39
|
+
draft/permission refusal, and exercise OTP and editing with isolated synthetic
|
|
40
|
+
accounts. Local readiness does not require publication, a hosted tenant or a
|
|
41
|
+
candidate preview. Scripted local acceptance does not replace the installed
|
|
42
|
+
independent acceptance guide, which is required before reporting the pages done.
|
|
43
|
+
Report production email, public origin and real object-store upload/commit checks
|
|
44
|
+
separately when local capabilities cannot exercise them.
|
|
45
|
+
|
|
46
|
+
For an explicitly requested deployment, use the selected host's native workflow
|
|
47
|
+
and any preview it provides. Verify disabled preview capabilities on an already
|
|
48
|
+
authorized live target; synthetic writes and cleanup stay within that scope.
|
|
49
|
+
Pending production checks block a production-readiness claim, not an otherwise
|
|
50
|
+
passing local-development handoff. Preserve preview isolation and permissions;
|
|
51
|
+
report passed, failed and blocked checks for each environment separately.
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import type { AdminExtension, AdminNavGroup } from "@aotter/mantle-admin/server/extensions";
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* Admin presentation, read by `mantle generate --admin-extensions src/admin.ts` (no runtime code).
|
|
5
|
-
* AGENT: to group the sidebar for how staff work, declare groups here and place Schemas and admin Views in them with
|
|
6
|
-
* `uiSchema.nav: { group, order, hidden }` (docs/handbook/guides/native-admin.md, "Sidebar"). Built-in groups need no
|
|
7
|
-
* declaration: content, operations, reports, more. Admin extensions also go here.
|
|
8
|
-
*/
|
|
9
|
-
export const navGroups: AdminNavGroup[] = [];
|
|
10
|
-
export const adminExtensions: AdminExtension[] = [];
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import type { AdminExtension, AdminNavGroup } from "@aotter/mantle-admin/server/extensions";
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* Admin presentation, read by `mantle generate --admin-extensions src/admin.ts` (no runtime code).
|
|
5
|
-
* The approver's daily work gets its own sidebar group above Admin's built-in ones (content 10, operations 20,
|
|
6
|
-
* reports 30; More stays last); manifests place `pending-requests` and `requests` in it with `uiSchema.nav`.
|
|
7
|
-
* AGENT: add groups for how the staff work; titles take one string or a { locale: text } map.
|
|
8
|
-
*/
|
|
9
|
-
export const navGroups: AdminNavGroup[] = [
|
|
10
|
-
{ id: "approvals", title: { en: "Approvals", "zh-TW": "簽核" }, order: 5 },
|
|
11
|
-
];
|
|
12
|
-
export const adminExtensions: AdminExtension[] = [];
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
# Extend Admin
|
|
2
|
-
|
|
3
|
-
Native Admin accepts app-owned extension declarations, executable server handlers and optional same-origin client modules. Import client `defineAdminExtension` from `@aotter/mantle-admin/extension` and UI primitives from `@aotter/mantle-ui/kit`. Server types live in `@aotter/mantle-admin/server`.
|
|
4
|
-
|
|
5
|
-
| Contribution | Placement |
|
|
6
|
-
| --- | --- |
|
|
7
|
-
| pages/settings | Extension page; settings forms are generated from the supported form subset |
|
|
8
|
-
| actions | record, list selection or list toolbar |
|
|
9
|
-
| panels | record sidebar or home |
|
|
10
|
-
| fields | field input or cell |
|
|
11
|
-
|
|
12
|
-
Admin contributions sit behind the admin-layer gate; optional field roles default to `admin`. Server authorization is checked on every route. Handlers own finer business permissions.
|
|
13
|
-
|
|
14
|
-
Pass full declarations to `mantle generate … --admin --admin-extensions <module>` (named/default `adminExtensions` array). Generation checks contributions, manifest uiSchema references and settings schemas, then emits `extensionMetadata` and compiled `extensionBindings` in `admin-extensions.ts`. Bind the same runtime definitions with `extensionBindings(adminExtensions)` and merge its extensions/routes into `admin()` options. Drift is refused before execution.
|
|
15
|
-
|
|
16
|
-
Serve each `module` at a same-origin absolute path and install its integrity in the host shell's import map. Native Admin does not serve `source` modules or inject integrity; generation rejects source. Share React and the UI kit via the built import map, rather than bundling a second React. Canonical Admin refuses framing; use its separate same-origin preview contract.
|
|
17
|
-
|
|
18
|
-
Raw API handlers receive the original Request. Declared `bodyLimit` checks Content-Length before DB access, but the app must bound unknown-length streams. Built-in JSON routes use the shared bounded reader after caller/origin checks. Do not lose exact OCC or uncertain-outcome handling in custom actions.
|
|
19
|
-
|
|
20
|
-
See [native Admin](native-admin.md) for mounting and acceptance and [generated descriptors](../reference/admin-descriptors.md) for build-time metadata.
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
# Recipe: an MCP App for members
|
|
2
|
-
|
|
3
|
-
## Native applications
|
|
4
|
-
|
|
5
|
-
Read the installed MCP App contract. The SDK's generic hook attaches only the resources the app selects;
|
|
6
|
-
only selected modules enter the service.
|
|
7
|
-
|
|
8
|
-
```ts
|
|
9
|
-
import type { McpApps } from '@aotter/mantle/mcp';
|
|
10
|
-
import { mcp } from '../generated/mcp.js';
|
|
11
|
-
const memberApp: McpApps = { resources: [{
|
|
12
|
-
uri: 'ui://shop/my-orders',
|
|
13
|
-
name: 'my-orders-app',
|
|
14
|
-
renders: ['my_orders'], // the tool for the declared public View my-orders
|
|
15
|
-
html: async () => (await import('./member-app.js')).memberHtml,
|
|
16
|
-
}] };
|
|
17
|
-
const tools = mcp({ db, caller, handlers, apps: { public: memberApp } });
|
|
18
|
-
```
|
|
19
|
-
|
|
20
|
-
Each endpoint accepts one contributor or an array. The separate
|
|
21
|
-
`@aotter/mantle-admin` package contributes its admin App through this same
|
|
22
|
-
`apps.admin` hook; it owns `ui://mantle-admin/…`. App resources use their own
|
|
23
|
-
`ui://<app>/…` namespace. Duplicate resource URI/name, conflicting `renders`,
|
|
24
|
-
or `renders`/`appOnly` naming an unavailable endpoint tool (or a Procedure for
|
|
25
|
-
`appOnly`) fail when `mcp(...)` is built; with a request-bound tool table, the
|
|
26
|
-
tool names are checked on the first matching request. Only clients that
|
|
27
|
-
declare no MCP Apps support see no UI resources; a request that advertises no
|
|
28
|
-
capabilities at all is treated as supported.
|
|
29
|
-
|
|
30
|
-
Use `renders` for a declared tool; `appOnly` optionally hides it from non-UI
|
|
31
|
-
clients. Import HTML lazily; it carries no secrets or caller data. Tool results
|
|
32
|
-
use the caller's SQL policy, and an App cannot authorize a hidden admin tool.
|
|
33
|
-
Generic interaction components and controllers remain in `@aotter/mantle-ui`;
|
|
34
|
-
Admin-specific controllers/catalogues belong to `@aotter/mantle-admin`.
|
|
35
|
-
|
|
36
|
-
Verify tools/list metadata, resources/read, actual tool calls and a host-rendered
|
|
37
|
-
member App. Test anonymous/member isolation and resource conflicts. Never retry
|
|
38
|
-
unknown writes blindly; retain OCC and re-read state after an uncertain outcome.
|
|
39
|
-
Commit generated output and run generation with `--check` before deployment.
|
package/skills/.keep
DELETED
|
File without changes
|