@arbol-ai/maximus 8.8.0 → 8.9.0
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/config/oxfmt.mjs +2 -0
- package/config/oxlint.mjs +3 -0
- package/dist/analytics/analytics.d.ts +1 -1
- package/dist/body.d.ts +1 -1
- package/dist/capture/index.d.ts +1 -1
- package/dist/chunks/{define-app-Bd6sRVHj.js → define-app-IhSbBWTD.js} +1 -1
- package/dist/chunks/{http-layout-DqE7LBsS.js → http-layout-B-9NbM5M.js} +1 -1
- package/dist/chunks/{meter-dTMGs_lr.js → meter-BpzCC7J3.js} +1 -1
- package/dist/chunks/{openapi-BX_eqRLX.js → openapi-Ye_Ypx-d.js} +1 -1
- package/dist/chunks/{openapi-file-BV-f_Wij.js → openapi-file-2fUP4JLw.js} +2 -2
- package/dist/chunks/{pages-DVORVVEZ.js → pages-BJKV04-G.js} +1 -1
- package/dist/chunks/{prepare-configured-Cithjf80.js → prepare-configured-DjCFAqdH.js} +6 -2
- package/dist/chunks/{prepare-configured-BmRJLg6J.js → prepare-configured-Dw3-u-b3.js} +1 -1
- package/dist/chunks/{runtime-CWORw_TD.js → runtime-Bg729nOQ.js} +3 -3
- package/dist/chunks/{server-DCwV3d2Y.js → server-ZGiWOeAp.js} +1 -1
- package/dist/chunks/{src-Bcl6xrV7.js → src-8mwPVI5H.js} +10 -6
- package/dist/chunks/{tokens-D0OMoQWV.js → tokens-CBQO5lc0.js} +35 -1
- package/dist/chunks/{types-t_09KY-x.d.ts → types-Dmw37bhl.d.ts} +27 -0
- package/dist/chunks/{workers-types-DyQBrA49.d.ts → workers-types-CYOvun0Q.d.ts} +1 -1
- package/dist/client.d.ts +1 -1
- package/dist/diagnostics.d.ts +1 -1
- package/dist/errors.d.ts +1 -1
- package/dist/http-paths.d.ts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +3 -3
- package/dist/internals.d.ts +1 -1
- package/dist/internals.js +2 -2
- package/dist/mcp/index.d.ts +1 -1
- package/dist/mcp/index.js +1 -1
- package/dist/mcp/tasks.d.ts +1 -1
- package/dist/project/config.d.ts +1 -1
- package/dist/project/index.d.ts +2 -2
- package/dist/project/index.js +2 -2
- package/dist/schemas.d.ts +1 -1
- package/dist/standard-failures.d.ts +1 -1
- package/dist/tooling/cli.js +3 -4
- package/dist/vite/index.d.ts +85 -7
- package/dist/vite/index.js +279 -34
- package/dist/webhooks.d.ts +1 -1
- package/dist/workers/runtime.d.ts +1 -1
- package/dist/workers/runtime.js +1 -1
- package/package.json +1 -1
- package/skills/maximus/SKILL.md +4 -0
- package/skills/maximus/references/deploying.md +9 -0
- package/skills/maximus/references/project.md +46 -3
package/skills/maximus/SKILL.md
CHANGED
|
@@ -90,7 +90,11 @@ Every `maximus` command says what it did in a sentence; `--json` prints it as JS
|
|
|
90
90
|
| A rule for every operation, on every transport | `defineOperationMiddleware` in `middleware/`. |
|
|
91
91
|
| Headers or an early answer around every request | `defineMiddleware` in `middleware/`. It runs before admission and sees no principal. |
|
|
92
92
|
| Access tokens Auth0 issues | `tokens: auth0({ domain, audience })` from `@arbol-ai/maximus/vite`, with RBAC and permissions in the access token turned on. See [references/project.md](references/project.md#tokens). |
|
|
93
|
+
| Access tokens Arbol's Identity issues | `tokens: arbolIdentity({ audience, clients, people })` from `@arbol-ai/maximus/vite`. See [references/project.md](references/project.md#tokens). |
|
|
94
|
+
| Admit only some clients, only people, or every member of the organization | `clients`, `actorKinds` and `people: 'all'` in `tokens`: no `auth.ts`. See [references/project.md](references/project.md#tokens). |
|
|
93
95
|
| An application behind Cloudflare Access | `tokens: cloudflareAccess({ team, aud, organizationId, scopes })` from `@arbol-ai/maximus/vite`. MCP needs `managedOAuth: true` and Managed OAuth at the edge. See [references/project.md](references/project.md#tokens). |
|
|
96
|
+
| Production, previews and other environments | `environments: { preview: { … } }` in `maximus()`, built with `vp build --mode preview`. See [references/project.md](references/project.md#environments). |
|
|
97
|
+
| A web app with its own router | `webApp: { pages: ['/', '/notes/$noteId'] }`. See [references/project.md](references/project.md#the-workers-other-parts). |
|
|
94
98
|
| Tokens your authorization server does not issue | `auth.ts` with `defineAuth({ resolve })`, which verifies cryptographically. |
|
|
95
99
|
| A provider's webhook, without a token | A page named for its method, `pages/webhooks/<provider>.post.ts`, which verifies the signature on the exact bytes with `@arbol-ai/maximus/webhooks`. See [references/project.md](references/project.md). |
|
|
96
100
|
| Many items in one answer | `output: Page(Item, { $id: 'ItemPage' })` with `input: PageQueryFields`. |
|
|
@@ -21,6 +21,13 @@ bun run preview # the production bu
|
|
|
21
21
|
|
|
22
22
|
`vp build` writes the Build Output to `.cloudflare/output/`; `cf deploy --prebuilt` deploys it as it is.
|
|
23
23
|
|
|
24
|
+
An [environment](project.md#environments) is built and deployed by its name:
|
|
25
|
+
|
|
26
|
+
```sh
|
|
27
|
+
vp build --mode preview && bunx cf previews deploy --prebuilt --mode preview --preview-name pr-12 # a preview of the Worker
|
|
28
|
+
vp build --mode staging && bunx cf deploy --prebuilt --mode staging # the Worker <name>-staging
|
|
29
|
+
```
|
|
30
|
+
|
|
24
31
|
## Secrets
|
|
25
32
|
|
|
26
33
|
- Declare each one as `bindings.secret()` in `env`. Under `vp dev` its value comes from `.dev.vars`.
|
|
@@ -29,6 +36,8 @@ bun run preview # the production bu
|
|
|
29
36
|
`The following required secrets have not been set`.
|
|
30
37
|
- Later deployments keep each value unless their secrets file brings a new one.
|
|
31
38
|
`bunx cf workers secrets update <NAME> --worker <name>` changes one alone, as a new version.
|
|
39
|
+
- A secret of the account's Secrets Store is `storeSecret()` in `env`, with `secretsStore: '<store id>'` in
|
|
40
|
+
`maximus()`; read it with `await env.NAME.get()`.
|
|
32
41
|
- Never put a secret in `bindings.text()`, code, the repository or a log. Never set `DEVELOPMENT_TOKEN` on a
|
|
33
42
|
deployed Worker; `maximus()` refuses to declare it.
|
|
34
43
|
|
|
@@ -37,7 +37,9 @@ export default defineConfig({
|
|
|
37
37
|
| `rateLimit` | `{ binding, retryAfter }`: a rate limiting binding every HTTP and MCP call passes, per organization and actor. |
|
|
38
38
|
| `meter` | `{ binding }`: the binding of the billing service that routes and tools declaring `meter` report to. Type it with `BillingService<Feature>` from `@arbol-ai/maximus`, whose `Feature` names the facts they may report. See [Metering](https://github.com/getarbol/maximus/blob/main/docs/guides/metering.md). |
|
|
39
39
|
| `env` | The Worker's bindings, from `cf/config`'s `bindings`. |
|
|
40
|
-
| `webApp`
|
|
40
|
+
| `webApp` | `{ headers, pages }`: the headers of a web app's pages and files, and the pages of an app whose own router declares them, `pages: ['/', '/notes/$noteId']`. |
|
|
41
|
+
| `secretsStore` | The account's Secrets Store, by its id: `storeSecret()` from `@arbol-ai/maximus/vite` then binds a secret of it, named as its binding. |
|
|
42
|
+
| `environments` | What each environment changes, by its name, the Vite mode that builds it: `{ preview: { env: { DB: … } } }`. See [Environments](#environments). |
|
|
41
43
|
| Any other key | A Worker setting as Cloudflare names it: `compatibilityDate`, `compatibilityFlags`, `triggers`, `exports`, `observability`, `placement`, `limits`, `domains`, `workersDev`, `previewUrls`. |
|
|
42
44
|
|
|
43
45
|
`maximus()` owns the Worker's entry (`.maximus/entry.ts`) and a web app's assets, always adds
|
|
@@ -51,8 +53,8 @@ cron and queue module, and declares the development token under `vp dev` alone.
|
|
|
51
53
|
## Tokens
|
|
52
54
|
|
|
53
55
|
`tokens` states which tokens the API admits: by default, OAuth access tokens of the `issuer` it names, for
|
|
54
|
-
the `origin` as their audience. `auth0()` and `cloudflareAccess()` from
|
|
55
|
-
options for those providers, as plain data:
|
|
56
|
+
the `origin` as their audience. `auth0()`, `arbolIdentity()` and `cloudflareAccess()` from
|
|
57
|
+
`@arbol-ai/maximus/vite` state the options for those providers, as plain data:
|
|
56
58
|
|
|
57
59
|
```ts
|
|
58
60
|
import { auth0, cloudflareAccess, maximus } from '@arbol-ai/maximus/vite';
|
|
@@ -89,7 +91,15 @@ tokens: cloudflareAccess({
|
|
|
89
91
|
is absent. The Worker serves no OAuth discovery. If Cloudflare Access serves Managed OAuth at the edge,
|
|
90
92
|
set `managedOAuth: true` in `cloudflareAccess()` to serve MCP with the same verified assertions and
|
|
91
93
|
scopes. Under `vp dev` and in tests, the development token still signs in as a bearer token.
|
|
94
|
+
- `arbolIdentity({ audience?, issuer?, clients?, people? })`: a service whose tokens Arbol's Identity
|
|
95
|
+
(`https://id.getarbol.com`) issues. It answers Identity's issuer, JWKS and endpoints, `requireType: 'at+jwt'`
|
|
96
|
+
and machines named by their client id. `clients` admits only those clients' tokens, a list or each
|
|
97
|
+
environment's own, `{ production: '…', preview: '…' }`; `people: 'all'` lets their people call every public
|
|
98
|
+
route when Identity grants none of the service's scopes yet, and needs `clients`.
|
|
92
99
|
- Spread a preset to add what it leaves out: `tokens: { ...auth0({ domain, audience }), development: false }`.
|
|
100
|
+
- Any OAuth policy may state who it admits without an `auth.ts`: `clients` (by client id), `actorKinds`
|
|
101
|
+
(`['user']`, `['service']`) and `people` (`'token'`, the default, or `'all'`). Never write an `auth.ts` only
|
|
102
|
+
to check a client, refuse machines or grant every member the public scopes.
|
|
93
103
|
|
|
94
104
|
Tokens that no issuer signs, such as keys the service issues itself, are verified by `auth.ts`. See
|
|
95
105
|
[Authentication and scopes](https://github.com/getarbol/maximus/blob/main/docs/guides/authentication-and-scopes.md).
|
|
@@ -188,6 +198,37 @@ output. `.maximus/` is in `.gitignore`.
|
|
|
188
198
|
A project is prepared for `development` under `vp dev` and `vp test`, and for `production` in every build and
|
|
189
199
|
preview. A module named `<name>.dev.ts` exists in development alone, `<name>.prod.ts` in production alone.
|
|
190
200
|
|
|
201
|
+
## Environments
|
|
202
|
+
|
|
203
|
+
`environments` states what each place the service runs changes over the shared options, by its name, which
|
|
204
|
+
is the Vite mode of its build: `vp build --mode preview` builds `preview`. State only what differs: `env`
|
|
205
|
+
and `tokens` merge key by key, every other option replaces the shared one.
|
|
206
|
+
|
|
207
|
+
```ts
|
|
208
|
+
maximus({
|
|
209
|
+
origin: 'https://notes.example.com',
|
|
210
|
+
tokens: arbolIdentity({ clients: { production: '…', preview: '…' }, people: 'all' }),
|
|
211
|
+
env: { DB: bindings.hyperdrive({ id: '<production>' }), DOCUMENTS: bindings.r2({ name: 'notes-documents' }) },
|
|
212
|
+
environments: { preview: { env: { DB: bindings.hyperdrive({ id: '<preview>' }) } } },
|
|
213
|
+
}),
|
|
214
|
+
```
|
|
215
|
+
|
|
216
|
+
`production` and `development` only override. Any other environment is apart from production, and Maximus
|
|
217
|
+
keeps production out of it:
|
|
218
|
+
|
|
219
|
+
- `preview` is the Worker's previews (`cf previews deploy --prebuilt --mode preview`), at its preview URLs.
|
|
220
|
+
Any other environment is a Worker of its own, `<name>-<environment>`, at the `origin` it states or at
|
|
221
|
+
`workers.dev`. Neither takes the shared `domains`.
|
|
222
|
+
- It runs only the `triggers` it states: no shared route, no schedule of a cron module, no consumer of a
|
|
223
|
+
queue module.
|
|
224
|
+
- A shared R2 bucket becomes `<bucket>-<environment>`. A shared D1, KV or Hyperdrive bound by its id, and a
|
|
225
|
+
shared queue, are refused until the environment declares its own in its `env`. Never work around the
|
|
226
|
+
refusal by repeating production's id unless the person asks to share that store.
|
|
227
|
+
- `tokens.clients` by environment admits each environment's own clients.
|
|
228
|
+
|
|
229
|
+
Never read `process.env` or the Vite mode in `vite.config.ts` to tell environments apart: declare the
|
|
230
|
+
environment.
|
|
231
|
+
|
|
191
232
|
## The Worker's other parts
|
|
192
233
|
|
|
193
234
|
| Folder | A file |
|
|
@@ -200,6 +241,8 @@ preview. A module named `<name>.dev.ts` exists in development alone, `<name>.pro
|
|
|
200
241
|
|
|
201
242
|
A web app is `index.html` at the root, with its pages in `app/routes/` (React Router), its layout in
|
|
202
243
|
`app/root.tsx` and its static files in `public/`. The same Worker serves it, and the API stays below `/api`.
|
|
244
|
+
An app with another router, such as TanStack Router, lists its pages in `webApp.pages` instead, and the
|
|
245
|
+
Worker answers them with `index.html`: never a middleware that serves the shell.
|
|
203
246
|
|
|
204
247
|
Each topic has a guide: [Project structure](https://github.com/getarbol/maximus/blob/main/docs/guides/project-structure.md),
|
|
205
248
|
[Bindings](https://github.com/getarbol/maximus/blob/main/docs/guides/bindings.md),
|