@aotter/mantle 0.2.1-alpha.1 → 0.2.1-alpha.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +16 -177
- package/dist/build/compiler.d.ts +4 -4
- package/dist/build/compiler.js +3 -3
- package/dist/domain/describe/{chunk-P6PP6VVV.js → chunk-CW7X5Q5T.js} +1 -1
- package/dist/domain/describe/index.js +1 -1
- package/dist/domain/describe/public.d.ts +3 -0
- package/dist/domain/describe/public.js +1 -0
- package/dist/infrastructure/help.js +1 -3
- package/dist/kernel/mcp-apps.d.ts +3 -2
- package/dist/kernel/mcp-apps.js +7 -2
- package/dist/kernel/mcp-handler.js +20 -8
- package/dist/kernel/mcp.d.ts +18 -0
- package/dist/kernel/mcp.js +1 -0
- package/dist/usecase/adminDescriptors.js +1 -1
- package/dist/usecase/generate.js +20 -4
- package/dist/usecase/rest.js +2 -4
- package/docs/examples/README.md +2 -2
- package/docs/examples/app-shell/README.md +1 -1
- package/docs/examples/app-shell/accept.mjs +12 -2
- package/docs/examples/app-shell/package.json +3 -3
- package/docs/handbook/cloudflare/authentication.md +1 -1
- package/docs/handbook/cloudflare/deploy-and-operate.md +20 -8
- package/docs/handbook/cloudflare/media-r2.md +31 -0
- package/docs/handbook/examples/hub.md +1 -1
- package/docs/handbook/guides/agent-setup.md +25 -67
- package/docs/handbook/guides/agent-workflow-acceptance.md +32 -5
- package/docs/handbook/guides/mcp-apps.md +43 -1
- package/docs/{skills/performance/SKILL.md → handbook/guides/performance.md} +53 -32
- package/docs/handbook/guides/size-and-startup.md +2 -2
- package/docs/handbook/guides/typed-queries.md +12 -0
- package/docs/handbook/navigation.json +4 -0
- package/docs/handbook/reference/describe.md +16 -6
- package/docs/handbook/reference/surface.md +10 -0
- package/docs/handbook/releases/index.md +85 -2
- package/docs/{upgrade-0.1-to-0.2.md → handbook/releases/upgrade-0.1-to-0.2.md} +13 -13
- package/docs/handbook/start/agents.md +25 -4
- package/docs/handbook/start/quickstart-worker.md +1 -1
- package/package.json +2 -3
- package/skills/README.md +7 -69
- package/skills/mantle/SKILL.md +15 -81
- package/dist/domain/describe/target-hash.js +0 -1
- package/docs/skills/develop/SKILL.md +0 -100
- package/docs/skills/integrate/SKILL.md +0 -51
- package/docs/skills/media-gc/SKILL.md +0 -109
- package/docs/skills/provision/SKILL.md +0 -44
- package/docs/skills/update/SKILL.md +0 -42
|
@@ -1,109 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: media-gc
|
|
3
|
-
description: Audit and safely remove stale, uncommitted media uploads from a Mantle 0.2 Cloudflare R2 bucket. Use when an operator asks to inspect or clean objects left under uploads/ by an upload that was created but never committed.
|
|
4
|
-
metadata:
|
|
5
|
-
source: "@aotter/mantle"
|
|
6
|
-
sourcePath: docs/skills/media-gc/SKILL.md
|
|
7
|
-
applies_to: mantle 0.2
|
|
8
|
-
projection: package
|
|
9
|
-
projectionReason: Destructive remote object deletion and Cloudflare-specific; opt-in only.
|
|
10
|
-
---
|
|
11
|
-
|
|
12
|
-
# Mantle Media GC
|
|
13
|
-
|
|
14
|
-
## Generated native applications (alpha.7 and later)
|
|
15
|
-
|
|
16
|
-
If the installed README describes generated native queries, read
|
|
17
|
-
`docs/handbook/cloudflare/media-r2.md` and app-owned site/media wiring instead of Core storage
|
|
18
|
-
options. Resolve the exact configured bucket and declared purposes. The
|
|
19
|
-
`uploads/` candidate audit below still applies. Committed copies live under
|
|
20
|
-
`committed/` and must never be candidates. Attempt-isolated committed copies
|
|
21
|
-
retained after an uncertain DB outcome require reconciliation with live DB
|
|
22
|
-
references before any separately authorized cleanup.
|
|
23
|
-
|
|
24
|
-
Use the connected Cloudflare API. Audit by default; delete only the exact
|
|
25
|
-
objects approved by the user.
|
|
26
|
-
|
|
27
|
-
## Preflight
|
|
28
|
-
|
|
29
|
-
1. Read `wrangler.jsonc`, the app-owned entry (`src/worker.ts` by default,
|
|
30
|
-
or the generation command's `--entry`) and its media wiring. Resolve the R2
|
|
31
|
-
bucket that `r2MediaStorage` uses and the media purpose names in
|
|
32
|
-
`siteDefaults.media.purposes` selected by `--site`.
|
|
33
|
-
2. Confirm the exact Cloudflare account and bucket. If either is ambiguous,
|
|
34
|
-
ask; never choose by name similarity.
|
|
35
|
-
3. Use the Cloudflare OpenAPI search before execution to resolve the current
|
|
36
|
-
R2 List Objects and Delete Objects endpoints. If the connected account lacks
|
|
37
|
-
access, stop. Do not create, request, or store credentials.
|
|
38
|
-
4. Stop when the service passes no `r2MediaStorage` or declares no purpose.
|
|
39
|
-
|
|
40
|
-
## How 0.2 lays out media
|
|
41
|
-
|
|
42
|
-
`POST /admin/api/media/uploads` issues presigned PUT URLs that expire after 15
|
|
43
|
-
minutes, for keys under `uploads/<purpose>/<group>/<role>.<ext>`. Commit
|
|
44
|
-
copies each checked object to `committed/<group>/<attempt>/<role>.<ext>` (with
|
|
45
|
-
`committedAt` metadata); the attempt UUID isolates concurrent commits. Upload
|
|
46
|
-
keys are removed after the database commit succeeds, or when a group is
|
|
47
|
-
rejected. An old upload key may also be leftover cleanup from a successful or
|
|
48
|
-
uncertain commit: it is not evidence that the media row is absent. Once expired,
|
|
49
|
-
it cannot create a new asset. Objects outside `uploads/` are never candidates;
|
|
50
|
-
reconcile attempt copies separately with live database references.
|
|
51
|
-
|
|
52
|
-
## Audit
|
|
53
|
-
|
|
54
|
-
For each declared purpose, list up to 1,000 objects per page under the exact
|
|
55
|
-
`uploads/<purpose>/` prefix. Use the API cursor until `is_truncated` is false.
|
|
56
|
-
|
|
57
|
-
An object is a deletion candidate only when all conditions hold:
|
|
58
|
-
|
|
59
|
-
- `last_modified` is more than 24 hours old;
|
|
60
|
-
- `custom_metadata.committedAt` is absent or empty;
|
|
61
|
-
- the key matches the exact upload layout
|
|
62
|
-
`uploads/<purpose>/<group>/(primary|alternate|fallback).(png|jpg|webp|avif|gif|bin)`,
|
|
63
|
-
where `<purpose>` is declared by this project and `<group>` contains only
|
|
64
|
-
letters, digits, `_`, or `-`.
|
|
65
|
-
|
|
66
|
-
Skip committed, unknown-prefix, unprefixed, malformed, or ambiguous objects.
|
|
67
|
-
Delete only an uncommitted variant, never its whole group.
|
|
68
|
-
|
|
69
|
-
Report the account, bucket, purpose prefixes, UTC cutoff, candidate object and
|
|
70
|
-
group counts, total bytes, skipped count, and a SHA-256 digest of the sorted
|
|
71
|
-
`key + etag` candidate set. Do not print object keys, upload group IDs,
|
|
72
|
-
filenames, public URLs, signed URLs, or secrets.
|
|
73
|
-
|
|
74
|
-
## Apply
|
|
75
|
-
|
|
76
|
-
1. Show the audit summary and get explicit confirmation for that exact account,
|
|
77
|
-
bucket, cutoff, count, byte total, and candidate-set digest.
|
|
78
|
-
2. Re-run the complete audit with the same UTC cutoff. If the candidate count,
|
|
79
|
-
bytes, or digest changed, stop and present the new audit for confirmation.
|
|
80
|
-
3. Call Delete Objects with JSON arrays of exact keys, at most 1,000 keys per
|
|
81
|
-
request. Never send the `prefix` query parameter: an empty prefix can empty
|
|
82
|
-
the bucket.
|
|
83
|
-
4. Do not automatically retry failed keys. Report safe API error codes and
|
|
84
|
-
counts; a later invocation can audit and retry what remains.
|
|
85
|
-
5. Re-list every inspected purpose prefix and report the remaining candidate
|
|
86
|
-
count and bytes.
|
|
87
|
-
|
|
88
|
-
## Don't
|
|
89
|
-
|
|
90
|
-
- Don't create a Worker, Cron Trigger, lifecycle rule, D1 table, or local script.
|
|
91
|
-
- Don't use prefix deletion or empty-bucket operations.
|
|
92
|
-
- Don't delete objects outside `uploads/<declared purpose>/`, and never
|
|
93
|
-
committed media.
|
|
94
|
-
- Don't treat missing pagination pages, metadata, or permissions as an empty
|
|
95
|
-
result.
|
|
96
|
-
|
|
97
|
-
## Diagnostics
|
|
98
|
-
|
|
99
|
-
| Symptom | Action |
|
|
100
|
-
|---|---|
|
|
101
|
-
| Multiple matching accounts or buckets | Stop and ask the user to select the exact target. |
|
|
102
|
-
| A page is truncated without a cursor | Stop; do not delete from a partial audit. |
|
|
103
|
-
| A candidate has an unexpected key or metadata shape | Skip it and include it only in the aggregate skipped count. |
|
|
104
|
-
| A delete request partially fails | Report safe error codes and leave the remaining objects for a later audit. |
|
|
105
|
-
|
|
106
|
-
## When You're Done
|
|
107
|
-
|
|
108
|
-
Return whether the run was audit-only or applied, the aggregate before/after
|
|
109
|
-
counts and bytes, and any safely redacted failures.
|
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: provision
|
|
3
|
-
description: Ship a Mantle 0.2 project to production — Cloudflare Workers with D1, production sign-in and secrets, or ChatGPT Sites through its guide — and verify the deployed service.
|
|
4
|
-
metadata:
|
|
5
|
-
source: "@aotter/mantle"
|
|
6
|
-
sourcePath: docs/skills/provision/SKILL.md
|
|
7
|
-
applies_to: mantle 0.2
|
|
8
|
-
projection: package
|
|
9
|
-
projectionReason: Creates remote resources and handles production secrets; opt-in only.
|
|
10
|
-
---
|
|
11
|
-
|
|
12
|
-
# Provision a Mantle project
|
|
13
|
-
|
|
14
|
-
## Workflow
|
|
15
|
-
|
|
16
|
-
Read the installed SDK README, then follow the version-matched [project and CLI
|
|
17
|
-
workflow](../../handbook/start/project-and-cli.md) before editing.
|
|
18
|
-
|
|
19
|
-
Deploy/create resources only within the user's authorization; reuse configured
|
|
20
|
-
host resources. Apply reviewed and rehearsed migrations before routing traffic;
|
|
21
|
-
imports/first requests perform no DDL or schema checks. Keep auth dynamic, production
|
|
22
|
-
secrets in the host store, trusted HTTPS origin and verified bootstrap rule,
|
|
23
|
-
production email and selected media wiring. Configure Admin ASSETS worker-first
|
|
24
|
-
as in [Workers assets and secrets](../../handbook/cloudflare/service-entry.md#workers-assets-and-secrets). Hyperdrive caching stays off; PG settings are deployment-owned.
|
|
25
|
-
Keep the Workers [public-fetch flags](../../handbook/cloudflare/deploy-and-operate.md#public-fetch-routing),
|
|
26
|
-
including environment overrides; verify deployed MCP with a real OAuth bearer
|
|
27
|
-
(`initialize` and `tools/list`), not only a browser session cookie.
|
|
28
|
-
For MCP Apps, also follow [deployed host acceptance](../../handbook/guides/mcp-apps.md#verify-a-deployed-app-in-chatgpt):
|
|
29
|
-
compare the current resource URI and visibly verify a newly invoked render tool.
|
|
30
|
-
Archive deployed Admin pages using the guide's `previous` recipe and carry them
|
|
31
|
-
through clean builds. Test the same old conversation after changing the UI build,
|
|
32
|
-
without reconnecting, refreshing host tools or clearing caches. A deliberate tool
|
|
33
|
-
contract change has its own migration/host rediscovery step. OAuth renewal, `tools/call` success and a
|
|
34
|
-
local official-host replay do not establish that the deployed App rendered.
|
|
35
|
-
Bun uses native Database/SQL, an app server and scheduler. Verify admin sign-in
|
|
36
|
-
(role admin), denied access, public reads, a persisted write, MCP and selected UI.
|
|
37
|
-
Report artifact/resources/checks and keep rollback artifacts.
|
|
38
|
-
|
|
39
|
-
For ChatGPT Sites, follow [Mantle on ChatGPT Sites](../../handbook/cloudflare/chatgpt-sites.md).
|
|
40
|
-
|
|
41
|
-
The app builds Admin with `mantle bundle`; serve it as [Native
|
|
42
|
-
Admin](../../handbook/guides/native-admin.md) describes. Verify both member and
|
|
43
|
-
admin OTP/UI flows. Deployment of an authorized application does not authorize
|
|
44
|
-
SDK publication; a workspace preview remains a preview.
|
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: update
|
|
3
|
-
description: Upgrade a Mantle project's @aotter/mantle packages to a new exact version, including the move from 0.1.x to 0.2, without overwriting application-owned code.
|
|
4
|
-
metadata:
|
|
5
|
-
source: "@aotter/mantle"
|
|
6
|
-
sourcePath: docs/skills/update/SKILL.md
|
|
7
|
-
applies_to: mantle 0.2
|
|
8
|
-
projection: package
|
|
9
|
-
---
|
|
10
|
-
|
|
11
|
-
# Mantle Update
|
|
12
|
-
|
|
13
|
-
## Workflow
|
|
14
|
-
|
|
15
|
-
Read the installed SDK README, then follow the version-matched [project and CLI
|
|
16
|
-
workflow](../../handbook/start/project-and-cli.md) before editing.
|
|
17
|
-
|
|
18
|
-
For 0.1.x, follow [Upgrade 0.1 to 0.2](../../upgrade-0.1-to-0.2.md). Mantle
|
|
19
|
-
ships no migration tool: plan the data move from
|
|
20
|
-
[Moving data from 0.1.x](../../upgrade-0.1-to-0.2.md#moving-data-from-01x),
|
|
21
|
-
verify each fact against the generated `schema.sql` and the 0.1.4 export, and
|
|
22
|
-
have the plan reviewed. Give the 0.2 service a new database, rehearse the load
|
|
23
|
-
on a copy, never boot 0.2 against a 0.1.x database, and keep exports out of the
|
|
24
|
-
repository. The guide's appendix is historical; do not follow it. Between 0.2
|
|
25
|
-
versions, apply reviewed migrations rehearsed on a copy.
|
|
26
|
-
|
|
27
|
-
For the stable 0.2 line, pin every selected Mantle package to `0.2.0`; to try the 0.2.1 prerelease, pin all of them to `0.2.1-alpha.1` and read its release notes. Do not upgrade an existing application by following a moving dist-tag.
|
|
28
|
-
|
|
29
|
-
Pin exact target SDK/peer versions and read its release notes and Admin build
|
|
30
|
-
instructions. Core-to-native replaces app imports/wiring; it is not
|
|
31
|
-
a package-only update. For 0.2-to-0.2 updates, preserve users, sessions, content
|
|
32
|
-
and application code; review emitted SQL/policy diffs and rehearse explicit
|
|
33
|
-
data-preserving schema/auth/role migrations on a copy. Initial schema.sql never
|
|
34
|
-
authorizes rebuilding production tables. Verify auth/Admin/MCP/REST, locks and
|
|
35
|
-
persistence before authorized cutover.
|
|
36
|
-
|
|
37
|
-
Follow [Customising Admin](../../handbook/guides/native-admin.md#customising-admin)
|
|
38
|
-
for the current application-built Admin; old UI subpaths have no compatibility
|
|
39
|
-
aliases. Pin only actually published versions, or explicitly use a matching
|
|
40
|
-
workspace preview. Recheck member and Admin OTP, all affected native routes,
|
|
41
|
-
private field visibility, OCC and unknown outcomes. Do not publish a package as
|
|
42
|
-
part of an application dependency update.
|