@arbol-ai/maximus 7.4.0 → 8.0.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.
- package/README.md +36 -38
- package/bin/maximus.js +4 -0
- package/config/oxfmt.mjs +1 -0
- package/config/oxlint.mjs +10 -0
- package/dist/analytics/analytics.d.ts +21 -9
- package/dist/analytics/analytics.js +19 -5
- package/dist/body.d.ts +1 -1
- package/dist/body.js +2 -2
- package/dist/chunks/agent-skills-Ef65jTf_.js +49 -0
- package/dist/chunks/agent-skills-m7y1EUch.js +3 -0
- package/dist/chunks/{body-6LichrQm.js → body-DOIHwIIl.js} +14 -7
- package/dist/chunks/{correlation-BEkcFFGT.js → correlation-4b23a-a4.js} +8 -5
- package/dist/chunks/define-app-x7uY70_1.js +341 -0
- package/dist/chunks/{errors-D7zG9kx9.js → errors-C5w9WY1l.js} +10 -5
- package/dist/chunks/{execution-kVUJPy1A.js → execution-rOiLo8VG.js} +28 -15
- package/dist/chunks/generate-C-9FKW0o.js +197 -0
- package/dist/chunks/handler-iebR-urt.js +141 -0
- package/dist/chunks/http-layout-DS8DnPyu.js +128 -0
- package/dist/chunks/{http-paths-yKD6TSNJ.js → http-paths-DMBxwpp6.js} +50 -31
- package/dist/chunks/{json-Bu4BLT25.js → json-B14evE6-.js} +21 -5
- package/dist/chunks/names-ncD7A3DV.js +280 -0
- package/dist/chunks/openapi-CeolxIqa.js +1588 -0
- package/dist/chunks/openapi-file-Bz9FRaE6.js +83 -0
- package/dist/chunks/pages-iZTvFs5a.js +14 -0
- package/dist/chunks/prepare-configured-BmRJLg6J.js +3 -0
- package/dist/chunks/prepare-configured-Cithjf80.js +52 -0
- package/dist/chunks/project-files-C0OX7MQQ.js +130 -0
- package/dist/chunks/query-kind-CWKAXEME.js +40 -0
- package/dist/chunks/record-DQUDTpEA.js +10 -0
- package/dist/chunks/result-CKgZHrnj.js +56 -0
- package/dist/chunks/{runtime-DlqA7J38.js → runtime-D94vx21X.js} +50 -26
- package/dist/chunks/scaffold-DGrcjR3h.js +3 -0
- package/dist/chunks/scaffold-DZD6dfoZ.js +138 -0
- package/dist/chunks/{schemas-CzTvbXb6.js → schemas-p_aRcMC1.js} +30 -14
- package/dist/chunks/server-Bzf1Q1_4.js +410 -0
- package/dist/chunks/src-CPrJpbOM.js +573 -0
- package/dist/chunks/{standard-failures-CLjxS2ea.js → standard-failures-Lh4mSfwG.js} +1 -1
- package/dist/chunks/{telemetry-BTwB68m5.js → telemetry-C3LfZcOB.js} +32 -11
- package/dist/chunks/{types-DQdfRF3f.d.ts → types-DTIuIEJ-.d.ts} +1000 -342
- package/dist/chunks/{validation-r-sgmsqb.js → validation-fTohBT6R.js} +69 -28
- package/dist/chunks/workers-types-BRk_Xa_5.d.ts +143 -0
- package/dist/chunks/yaml-Dk2L24yQ.js +74 -0
- package/dist/diagnostics.d.ts +6 -4
- package/dist/diagnostics.js +2 -2
- package/dist/errors.d.ts +2 -2
- package/dist/errors.js +2 -2
- package/dist/http-paths.d.ts +1 -1
- package/dist/http-paths.js +1 -1
- package/dist/index.d.ts +2 -2
- package/dist/index.js +12 -11
- package/dist/internals.d.ts +1 -1
- package/dist/internals.js +5 -4
- package/dist/mcp/index.d.ts +3 -2
- package/dist/mcp/index.js +5 -387
- package/dist/postgres/index.d.ts +25 -8
- package/dist/postgres/index.js +17 -8
- package/dist/project/config.d.ts +110 -72
- package/dist/project/config.js +161 -45
- package/dist/project/index.d.ts +17 -4
- package/dist/project/index.js +44 -9
- package/dist/projection.d.ts +14 -13
- package/dist/projection.js +8 -32
- package/dist/schemas.d.ts +1 -1
- package/dist/schemas.js +2 -2
- package/dist/standard-failures.d.ts +2 -89
- package/dist/standard-failures.js +1 -1
- package/dist/tooling/cli.js +149 -105
- package/dist/tooling/testing.js +2 -2
- package/dist/vite/cloudflare-workers.js +25 -0
- package/dist/vite/index.d.ts +157 -0
- package/dist/vite/index.js +1477 -0
- package/dist/webhooks.d.ts +12 -10
- package/dist/webhooks.js +26 -12
- package/dist/workers/runtime.d.ts +1 -1
- package/dist/workers/runtime.js +1 -1
- package/package.json +26 -22
- package/skills/maximus/SKILL.md +165 -68
- package/skills/maximus/references/deploying.md +73 -0
- package/skills/maximus/references/errors-and-results.md +114 -55
- package/skills/maximus/references/project.md +202 -0
- package/skills/maximus/references/routes-and-tools.md +256 -0
- package/skills/maximus/references/testing.md +137 -50
- package/skills/maximus/references/transports.md +113 -100
- package/skills/maximus/references/writing-code.md +84 -0
- package/templates/mcp/mcp/instructions.md.template +2 -0
- package/templates/mcp/routes/v1/greeting.get.ts.template +12 -0
- package/templates/mcp/tests/mcp.test.ts.template +36 -0
- package/templates/project/.agents/skills/project/SKILL.md.template +21 -12
- package/templates/project/.github/workflows/ci.yml.template +4 -1
- package/templates/project/CLAUDE.md.template +41 -25
- package/templates/project/README.md.template +54 -48
- package/templates/project/middleware/10-response.ts.template +5 -2
- package/templates/project/package.json.template +13 -9
- package/templates/project/pages/index.ts.template +2 -4
- package/templates/project/routes/v1/greeting.get.ts.template +10 -0
- package/templates/project/routes/v1/greeting.post.ts.template +12 -0
- package/templates/project/tests/greeting.test.ts.template +45 -0
- package/templates/project/tsconfig.json.template +8 -6
- package/templates/project/vite.config.ts.template +15 -7
- package/templates/web/app/main.tsx.template +16 -0
- package/templates/web/app/root.tsx.template +17 -0
- package/templates/web/app/routes/index.tsx.template +9 -0
- package/templates/web/index.html.template +12 -0
- package/templates/web/package.json.template +12 -0
- package/templates/web/tsconfig.json.template +7 -0
- package/templates/web/vite.config.ts.template +22 -0
- package/dist/chunks/builder-BiXv7d2v.js +0 -100
- package/dist/chunks/define-app-DvD_1jUE.js +0 -625
- package/dist/chunks/prepare-project-CMyGSEtI.js +0 -236
- package/dist/chunks/prepare-project-MtS0-W_n.js +0 -3
- package/dist/chunks/record-DY-lX9w1.js +0 -34
- package/dist/chunks/src-N3oyx5QF.js +0 -1091
- package/dist/client/client.d.ts +0 -129
- package/dist/client/client.js +0 -321
- package/dist/tooling/vite.d.ts +0 -3
- package/dist/tooling/vite.js +0 -57
- package/skills/maximus/references/adding-an-operation.md +0 -179
- package/skills/maximus/references/building-a-service.md +0 -167
- package/skills/maximus/references/migration-from-v2.md +0 -62
- package/skills/maximus/references/migration-to-v5.md +0 -37
- package/skills/maximus/references/publishing-and-verification.md +0 -42
- package/templates/project/cloudflare.config.ts.template +0 -24
- package/templates/project/maximus.config.ts.template +0 -20
- package/templates/project/routes/v1/greeting.ts.template +0 -38
- package/templates/service/.agents/skills/project/SKILL.md.template +0 -10
- package/templates/service/.github/workflows/ci.yml.template +0 -21
- package/templates/service/.gitignore.template +0 -9
- package/templates/service/CLAUDE.md.template +0 -5
- package/templates/service/README.md.template +0 -45
- package/templates/service/cloudflare.config.ts.template +0 -30
- package/templates/service/package.json.template +0 -36
- package/templates/service/src/app.ts.template +0 -30
- package/templates/service/src/index.ts.template +0 -13
- package/templates/service/tests/contract.test.ts.template +0 -12
- package/templates/service/tsconfig.json.template +0 -16
- package/templates/service/vite.config.ts.template +0 -13
- package/templates/service/vitest.config.ts.template +0 -10
|
@@ -1,179 +0,0 @@
|
|
|
1
|
-
# Adding an operation
|
|
2
|
-
|
|
3
|
-
## Template
|
|
4
|
-
|
|
5
|
-
```ts
|
|
6
|
-
import { err, ok, t, UuidSchema } from '@arbol-ai/maximus';
|
|
7
|
-
|
|
8
|
-
import { base, errors } from '../../application';
|
|
9
|
-
|
|
10
|
-
export const notes = base.operation(
|
|
11
|
-
'getNote', // camelCase, unique; also the OpenAPI operationId and RPC method name
|
|
12
|
-
{
|
|
13
|
-
scope: ['notes:notes:read', 'notes:notes:write'], // any one admits; scopeMatch: 'all' for every one
|
|
14
|
-
effect: 'read', // 'read' | 'write' | 'delete' — truthful; only reads may use GET
|
|
15
|
-
group: 'Notes', // OpenAPI tag
|
|
16
|
-
title: 'Get a note',
|
|
17
|
-
description: 'Read one note by its identifier.', // written for people and models
|
|
18
|
-
input: t.Object({ noteId: UuidSchema }, { additionalProperties: false }),
|
|
19
|
-
output: NoteSchema,
|
|
20
|
-
http: { method: 'GET', path: '/v1/notes/{noteId}' },
|
|
21
|
-
mcp: { name: 'get_note', idempotent: true },
|
|
22
|
-
// rpc: true,
|
|
23
|
-
},
|
|
24
|
-
async ({ env, principal }, input) => {
|
|
25
|
-
const note = await readNote(env.NOTES, principal.organizationId, input.noteId);
|
|
26
|
-
return note ? ok(note) : err(errors.noteNotFound.create());
|
|
27
|
-
}
|
|
28
|
-
);
|
|
29
|
-
```
|
|
30
|
-
|
|
31
|
-
### Declared failures
|
|
32
|
-
|
|
33
|
-
Declare `failures` (the domain codes it may answer) so its documents list only those and any other
|
|
34
|
-
domain failure it returns becomes `INTERNAL_ERROR`, reported. Omitted, every failure of the catalog is
|
|
35
|
-
listed and allowed; standard failures are always allowed.
|
|
36
|
-
|
|
37
|
-
```ts
|
|
38
|
-
base.operation(
|
|
39
|
-
'archiveNote',
|
|
40
|
-
{
|
|
41
|
-
scope: 'notes:notes:write',
|
|
42
|
-
effect: 'write',
|
|
43
|
-
actorKinds: ['user'],
|
|
44
|
-
title: 'Archive a note',
|
|
45
|
-
description: 'Moves a note out of the active list; it stays readable.',
|
|
46
|
-
input: t.Object({ noteId: UuidSchema }, { additionalProperties: false }),
|
|
47
|
-
output: NoteSchema,
|
|
48
|
-
http: { method: 'POST', path: '/v1/notes/{noteId}/archive' },
|
|
49
|
-
mcp: { name: 'archive_note', idempotent: true },
|
|
50
|
-
failures: ['NOTE_NOT_FOUND'], // the only domain failure it may answer
|
|
51
|
-
},
|
|
52
|
-
async ({ env, principal }, input) => archiveNote(env.NOTES, principal.organizationId, input.noteId)
|
|
53
|
-
);
|
|
54
|
-
```
|
|
55
|
-
|
|
56
|
-
Reserved names: `fetch`, `connect`, `constructor`, `then`, `scheduled`, `queue`, `alarm`,
|
|
57
|
-
`__proto__`, `prototype`.
|
|
58
|
-
|
|
59
|
-
## Fields
|
|
60
|
-
|
|
61
|
-
An inline definition with a field no operation has (a misspelling, a retired `api` name) does not
|
|
62
|
-
compile.
|
|
63
|
-
|
|
64
|
-
| Field | Rule |
|
|
65
|
-
| --- | --- |
|
|
66
|
-
| `scope` | `<namespace>:<resource>:<action>` with the app's namespace; a list is any-of unless `scopeMatch: 'all'`. |
|
|
67
|
-
| `conditionalScopes` | Extra namespaced scopes the handler checks via `context.authority?.scopes`; calls without authority (ordinary RPC) are refused. |
|
|
68
|
-
| `actorKinds` | `['user']`, `['service']` or both; omitted, either is admitted. Required on every documented operation under the `oauth+bearer` token scheme. |
|
|
69
|
-
| `visibility` | `'internal'`: routed and scope-checked, hidden from OpenAPI, `scopes_supported` and the client. Give it a staff-only scope. |
|
|
70
|
-
| `maxBodyBytes` | Per-operation body limit, up to 16 MiB, never on GET. App default 32 KiB. |
|
|
71
|
-
| `maxOutputBytes` | Up to 16 MiB. Default 256 KiB. Over the limit → `INTERNAL_ERROR`. |
|
|
72
|
-
| `http.method`, `http.path` | `/v<n>/…`, static segments `[A-Za-z0-9_-]+`, whole-segment `{param}`; unique `METHOD path`. |
|
|
73
|
-
| `http.successStatus` | `200`, `201` or `202`. |
|
|
74
|
-
| `mcp.name` | `^[a-z][A-Za-z0-9_]{0,63}$`, unique; `idempotent` required; `openWorld` defaults to `true`. Served once the Worker mounts `transports: [mcp()]`. |
|
|
75
|
-
| `rpc` | `true` (all app callers) or `{ callers }` (a subset). |
|
|
76
|
-
|
|
77
|
-
## HTTP input rules
|
|
78
|
-
|
|
79
|
-
- GET input comes from the query string: each declared field is read as its kind (integer, number,
|
|
80
|
-
boolean, comma-separated string list, otherwise string); repeated keys are refused. The typed
|
|
81
|
-
client writes those values the same way.
|
|
82
|
-
- POST, PUT, PATCH and DELETE read a JSON body with `content-type: application/json` (415
|
|
83
|
-
otherwise); a DELETE with no body and no `content-type` is the empty input.
|
|
84
|
-
- A `{param}` must be a required `string` field of the input (of each union member). The query or
|
|
85
|
-
body may not repeat it.
|
|
86
|
-
- Unknown routes and methods are 404 before authentication; no trailing-slash normalization.
|
|
87
|
-
|
|
88
|
-
## Schemas
|
|
89
|
-
|
|
90
|
-
- Strict objects or unions of strict objects (discriminated by a field). A GET input is one object.
|
|
91
|
-
- Shared, each a named component: `OrganizationIdSchema`, `UuidSchema`, `EmailAddressSchema`,
|
|
92
|
-
`PhoneNumberSchema` (E.164), `HttpsUrlSchema`, `HexColorSchema`, `DeletedObjectSchema`,
|
|
93
|
-
`SignedUrlSchema`, `NamedReferenceSchema`, `PostalAddressSchema`; `EmptyInputSchema` (unnamed). Ids
|
|
94
|
-
are strings; use `organizationId` and `requestId`, never aliases. Name your own entities with a
|
|
95
|
-
PascalCase `$id`, one shape per name: it becomes a public SDK type.
|
|
96
|
-
- Lists: `input: inputSchema(t.Object({ ...PageQueryFields, ...filters }, { additionalProperties: false }))`
|
|
97
|
-
(`cursor`, `direction`, `limit`; `limit: pageLimit({ maximum })` to lower it) and
|
|
98
|
-
`output: Page(Item, { $id: 'ItemPage' })`, answering `{ object: 'list', data, pageInfo }`.
|
|
99
|
-
- Formats: `date`, `time`, `date-time` (time zone required), `email`, `uuid`, `uri`.
|
|
100
|
-
- Use `t.Union([X, t.Null()])` for absent values in outputs; present every field.
|
|
101
|
-
|
|
102
|
-
## Codecs (from `@arbol-ai/maximus/schemas`)
|
|
103
|
-
|
|
104
|
-
```ts
|
|
105
|
-
import { defaultSchema, inputSchema, normalizeSchema, refineSchema, t } from '@arbol-ai/maximus/schemas';
|
|
106
|
-
|
|
107
|
-
input: inputSchema(
|
|
108
|
-
refineSchema(
|
|
109
|
-
t.Object(
|
|
110
|
-
{
|
|
111
|
-
query: normalizeSchema(t.String({ minLength: 1, maxLength: 100 }), (value) => value.trim()),
|
|
112
|
-
limit: defaultSchema(t.Integer({ minimum: 1, maximum: 50 }), 20),
|
|
113
|
-
from: t.String({ format: 'date' }),
|
|
114
|
-
to: t.String({ format: 'date' }),
|
|
115
|
-
},
|
|
116
|
-
{ additionalProperties: false }
|
|
117
|
-
),
|
|
118
|
-
(value) => value.from <= value.to,
|
|
119
|
-
{ message: 'The range must not end before it starts.', path: ['to'] }
|
|
120
|
-
)
|
|
121
|
-
),
|
|
122
|
-
```
|
|
123
|
-
|
|
124
|
-
- Without `inputSchema(...)` around the input, normalizers, transforms, refinements and stripping do
|
|
125
|
-
not run.
|
|
126
|
-
- Handlers receive `StaticDecode<typeof input>`; clients and OpenAPI see `Static<typeof input>`.
|
|
127
|
-
- Refinement messages travel to callers in `INVALID_INPUT` issues: never include input values.
|
|
128
|
-
- Other helpers: `transformSchema`, `inspectSchema` (several issues via `addIssue`), `pipeSchema`,
|
|
129
|
-
`stripObject` / `strictObject` / `looseObject` / `extendObject`, `literalUnion`, `urlSchema`.
|
|
130
|
-
|
|
131
|
-
Numbers in a GET query need a wire schema:
|
|
132
|
-
|
|
133
|
-
```ts
|
|
134
|
-
const Query = t.Object(
|
|
135
|
-
{
|
|
136
|
-
limit: t.Optional(
|
|
137
|
-
t.Transform(t.String({ pattern: '^[1-9][0-9]{0,2}$' })).Decode((v) => Number(v)).Encode((v) => String(v))
|
|
138
|
-
),
|
|
139
|
-
},
|
|
140
|
-
{ additionalProperties: false }
|
|
141
|
-
);
|
|
142
|
-
const Canonical = t.Object({ limit: t.Optional(t.Integer({ minimum: 1, maximum: 100 })) }, { additionalProperties: false });
|
|
143
|
-
// input: inputSchema(Canonical, Query)
|
|
144
|
-
```
|
|
145
|
-
|
|
146
|
-
## Context, derive and use
|
|
147
|
-
|
|
148
|
-
Handler context: `env`, `principal` (`actorId`, `actorKind`, `organizationId`, `requestId`),
|
|
149
|
-
`authority` (`{ surface, scopes, client, token? }`, frozen; absent over ordinary RPC), `input`,
|
|
150
|
-
`operation`, `background` (`waitUntil`, best effort), and `body` for byte uploads.
|
|
151
|
-
|
|
152
|
-
```ts
|
|
153
|
-
const connected = base.derive(async ({ env, principal }) => {
|
|
154
|
-
const account = await loadAccount(env, principal.organizationId);
|
|
155
|
-
return account ? ok({ account }) : err(errors.accountNotConnected.create());
|
|
156
|
-
});
|
|
157
|
-
export const reports = connected.operation('listReports', definition, async ({ account }, input) => …);
|
|
158
|
-
```
|
|
159
|
-
|
|
160
|
-
- `.derive()` must precede `.operation()` on its chain (it throws otherwise); it runs after
|
|
161
|
-
admission and input validation; its failure ends the call.
|
|
162
|
-
- `.use(async (context, proceed) => …)`: call `proceed()` at most once and return its `Result`, or
|
|
163
|
-
return your own. Results are validated. Applies to operations declared after it.
|
|
164
|
-
- Operations that set something up (a connection) must not sit in the group that requires it.
|
|
165
|
-
- `mount` only builders from the same `maximus()` base.
|
|
166
|
-
|
|
167
|
-
## Files
|
|
168
|
-
|
|
169
|
-
Upload: `http: { method: 'PUT', path: '/v1/notes/{noteId}/attachment', body: 'bytes', headers: { contentType: 'content-type' } }`,
|
|
170
|
-
a `maxBodyBytes`, and `const bytes = await context.body.read()` (a `Result`, read once) after checking
|
|
171
|
-
the target resource. Download: `output: AttachmentOutputSchema`, `http: { …, response: 'attachment' }`,
|
|
172
|
-
return `ok({ body, contentType, filename, byteLength })`. Both are HTTP-only.
|
|
173
|
-
|
|
174
|
-
## Before you finish
|
|
175
|
-
|
|
176
|
-
- Scopes namespaced; effect truthful; strict schemas; every failure from the app's catalog.
|
|
177
|
-
- No organization in the input; tenant keys built from `principal.organizationId`.
|
|
178
|
-
- Provider and storage reads go through `checkSchema`/`readSchema`.
|
|
179
|
-
- Typecheck, tests and lint pass; `.build()` raises no `TypeError`.
|
|
@@ -1,167 +0,0 @@
|
|
|
1
|
-
# Building a service
|
|
2
|
-
|
|
3
|
-
For the API-first project layout, use `maximus init <directory> --name <name> --layout project`.
|
|
4
|
-
Configure the application in `maximus.config.ts`; `src/` is optional domain code. Routes export
|
|
5
|
-
`GET`, `POST`, `PUT`, `PATCH` or `DELETE` through `defineRoute` from the generated `#maximus/routes` alias.
|
|
6
|
-
`defineMiddleware` (also named `defineRequestMiddleware`) wraps HTTP requests; `defineOperationMiddleware` runs after native admission on
|
|
7
|
-
HTTP, MCP and RPC. Middleware files run in filename order. The Vite+ plugin reconciles entries on
|
|
8
|
-
builds and source changes. Configure infrastructure explicitly in `cloudflare.config.ts`, importing
|
|
9
|
-
`.maximus/entry.ts` as its entrypoint. Legacy route factories and explicit service composition below
|
|
10
|
-
remain supported. Read `docs/guides/project-structure.md` for configuration, migration and conventions.
|
|
11
|
-
|
|
12
|
-
## Packages
|
|
13
|
-
|
|
14
|
-
```sh
|
|
15
|
-
bun add @arbol-ai/maximus # everything: /workers, /mcp, /client, the maximus CLI, …
|
|
16
|
-
bun add -d cf vite @cloudflare/vite-plugin@beta typescript @cloudflare/workers-types
|
|
17
|
-
```
|
|
18
|
-
|
|
19
|
-
## Layout
|
|
20
|
-
|
|
21
|
-
```text
|
|
22
|
-
src/
|
|
23
|
-
application.ts export const base = maximus<Env>({ ... })
|
|
24
|
-
tokens.ts the TokenPolicy (issuer, audience, optional resolve)
|
|
25
|
-
env.ts Env: the bindings, typed by the narrow interfaces the code uses
|
|
26
|
-
api/<resource>/
|
|
27
|
-
schemas.ts TypeBox schemas
|
|
28
|
-
<resource>.ts named domain functions
|
|
29
|
-
operations.ts export const <resource> = base.operation(...)...
|
|
30
|
-
app.ts export const app = base.mount(a).mount(b).build() (no cloudflare:workers import)
|
|
31
|
-
index.ts createWorker(app, ...) and the exports
|
|
32
|
-
cloudflare.config.ts the Worker for cf: name, runtime, entrypoint, bindings, triggers, exports
|
|
33
|
-
vite.config.ts cloudflare() from @cloudflare/vite-plugin, which cf builds and runs with
|
|
34
|
-
```
|
|
35
|
-
|
|
36
|
-
`app.ts` must stay importable outside workerd so tests and scripts can load it.
|
|
37
|
-
|
|
38
|
-
## Configuration
|
|
39
|
-
|
|
40
|
-
```ts
|
|
41
|
-
import { defineErrors, maximus } from '@arbol-ai/maximus';
|
|
42
|
-
|
|
43
|
-
export const errors = defineErrors({
|
|
44
|
-
noteNotFound: { code: 'NOTE_NOT_FOUND', status: 404, message: 'The note does not exist.' },
|
|
45
|
-
});
|
|
46
|
-
|
|
47
|
-
export const base = maximus<Env>({
|
|
48
|
-
name: 'notes', // lowercase; health, MCP server name, telemetry
|
|
49
|
-
namespace: 'notes', // ^[a-z][a-z0-9-]{1,63}$, prefixes every scope
|
|
50
|
-
title: 'Notes',
|
|
51
|
-
version: '1.0.0',
|
|
52
|
-
origin: 'https://notes.example.com', // must be https:, the public URL
|
|
53
|
-
tokens: { issuer: 'https://auth.example.com/', audience: 'https://notes.example.com' },
|
|
54
|
-
errors,
|
|
55
|
-
rpc: { callers: [] }, // deployments allowed over native RPC
|
|
56
|
-
// optional: mcp, telemetry, rateLimit, maxBodyBytes, maxOutputBytes
|
|
57
|
-
});
|
|
58
|
-
```
|
|
59
|
-
|
|
60
|
-
- `tokens.issuer` has no default. Without it the app builds, but OAuth tokens are refused and
|
|
61
|
-
`/openapi.json` answers 500.
|
|
62
|
-
- `mcp` configuration requires `transports: [mcp()]` in `createWorker`, or the Worker fails to start.
|
|
63
|
-
|
|
64
|
-
## Tokens
|
|
65
|
-
|
|
66
|
-
Default: OAuth access tokens from any provider, RS256 (or `tokens.algorithms`) from
|
|
67
|
-
`<issuer>.well-known/jwks.json` (or `tokens.jwksUri`), exact issuer and audience (`tokens.audience`
|
|
68
|
-
may list several, any one accepted; the first is the discovery `resource`). Standard claims: `sub`
|
|
69
|
-
(actor; `<client>@clients` is a machine), `org_id` (required; 1-128 letters, digits, `_`, `-`),
|
|
70
|
-
`azp`/`client_id` (optional), `scope`; a person holds only the scopes their `permissions` claim also
|
|
71
|
-
lists, none without it (Auth0 with RBAC and permissions in the token). `tokens.claims` maps providers
|
|
72
|
-
that name them differently: `{ scopes: 'scp', client: 'cid', permissions: false, machineSubject:
|
|
73
|
-
'{client}' }` (Okta), `{ scopes: 'permissions' }` (WorkOS session tokens). Set `permissions: false`
|
|
74
|
-
only when the authorization server grants each person no more than they may hold, and
|
|
75
|
-
`machineSubject: '{client}'` only when it assigns every client id. OpenAPI's OAuth flows use
|
|
76
|
-
`tokens.authorizationEndpoint` and `tokens.tokenEndpoint` (Auth0's `authorize` and `oauth/token` by
|
|
77
|
-
default); for other providers copy them and `jwksUri` from the server's
|
|
78
|
-
`/.well-known/oauth-authorization-server` metadata.
|
|
79
|
-
|
|
80
|
-
Other credentials: `tokens.resolve(token, context)` verifies cryptographically and returns a
|
|
81
|
-
`TokenPrincipal` (`{ actorId, actorKind, organizationId, scopes, client? }`) or a `Result`
|
|
82
|
-
(`FORBIDDEN` → 403, any other failure or a throw → 401). `context` has `env`, `request`, `surface`,
|
|
83
|
-
`applicationScopes`, `background`. Return a `client` so calls carry `authority`.
|
|
84
|
-
|
|
85
|
-
`tokens.scheme`: `{ type: 'bearer', description }` for application-issued tokens (needs `resolve`, no
|
|
86
|
-
OAuth discovery, cannot mount MCP); `{ type: 'oauth+bearer', description }` for OAuth people plus
|
|
87
|
-
resolver-verified workload keys (every operation in the OpenAPI document declares `actorKinds`).
|
|
88
|
-
|
|
89
|
-
Local development (`examples/minimal-http/src/tokens.ts`): `tokens.development: { binding:
|
|
90
|
-
'DEVELOPMENT_TOKEN' }` accepts that token, at least 32 characters, from `.dev.vars` only from
|
|
91
|
-
`localhost`/`127.0.0.1`/`[::1]`, as `local-developer` holding every declared scope; every other token is
|
|
92
|
-
verified as usual. Never write that resolver by hand.
|
|
93
|
-
|
|
94
|
-
## Env
|
|
95
|
-
|
|
96
|
-
Type bindings by what the code uses, so tests can fake them without casts:
|
|
97
|
-
|
|
98
|
-
```ts
|
|
99
|
-
export interface NoteStore {
|
|
100
|
-
get: (key: string) => Promise<string | null>;
|
|
101
|
-
put: (key: string, value: string) => Promise<void>;
|
|
102
|
-
}
|
|
103
|
-
export interface Env {
|
|
104
|
-
NOTES: NoteStore; // a KVNamespace satisfies it
|
|
105
|
-
PRICING: Service<typeof PricingService>; // RPC binding typed from the owner's entrypoint
|
|
106
|
-
}
|
|
107
|
-
```
|
|
108
|
-
|
|
109
|
-
## The Worker
|
|
110
|
-
|
|
111
|
-
```ts
|
|
112
|
-
import { mcp } from '@arbol-ai/maximus/mcp';
|
|
113
|
-
import { createWorker } from '@arbol-ai/maximus/workers';
|
|
114
|
-
|
|
115
|
-
import { app } from './app';
|
|
116
|
-
|
|
117
|
-
const worker = createWorker(app, {
|
|
118
|
-
transports: [mcp()], // serves the MCP tools; required by app mcp configuration
|
|
119
|
-
// routes, http: { basePath, origins, mounts, before, aroundOperation, fallback, healthPath },
|
|
120
|
-
// assets, handlers: { scheduled, queue }
|
|
121
|
-
});
|
|
122
|
-
|
|
123
|
-
export default worker.handler;
|
|
124
|
-
export const NotesService = worker.entrypoint; // if any operation declares rpc
|
|
125
|
-
```
|
|
126
|
-
|
|
127
|
-
## cloudflare.config.ts
|
|
128
|
-
|
|
129
|
-
```ts
|
|
130
|
-
import { bindings, defineConfig } from 'cf/config';
|
|
131
|
-
|
|
132
|
-
import * as entrypoint from './src/index.ts' with { type: 'cf-worker' };
|
|
133
|
-
|
|
134
|
-
export default defineConfig(({ mode }) => ({
|
|
135
|
-
worker: {
|
|
136
|
-
name: 'notes',
|
|
137
|
-
compatibilityDate: '2026-10-12',
|
|
138
|
-
compatibilityFlags: ['nodejs_compat'], // required: node:async_hooks
|
|
139
|
-
entrypoint,
|
|
140
|
-
observability: { enabled: true },
|
|
141
|
-
env: {
|
|
142
|
-
NOTES: bindings.kv(), // no id: cf deploy provisions it
|
|
143
|
-
DEVELOPMENT_TOKEN: mode === 'development' && bindings.secret(), // cf dev only, from .dev.vars
|
|
144
|
-
},
|
|
145
|
-
},
|
|
146
|
-
}));
|
|
147
|
-
```
|
|
148
|
-
|
|
149
|
-
`cf` is in beta and needs Node 22+. Wrangler files are not read: convert one with `cf migrate`.
|
|
150
|
-
|
|
151
|
-
## Run locally
|
|
152
|
-
|
|
153
|
-
```sh
|
|
154
|
-
echo "DEVELOPMENT_TOKEN=$(openssl rand -hex 32)" > .dev.vars
|
|
155
|
-
bunx cf dev # Vite on http://localhost:5173
|
|
156
|
-
curl -s http://localhost:5173/health
|
|
157
|
-
curl -s http://localhost:5173/openapi.json
|
|
158
|
-
curl -s http://localhost:5173/v1/notes -H "authorization: Bearer $(sed 's/^DEVELOPMENT_TOKEN=//' .dev.vars)"
|
|
159
|
-
```
|
|
160
|
-
|
|
161
|
-
Several Workers together: the caller's `vite.config.ts` runs the others as auxiliary Workers,
|
|
162
|
-
`cloudflare({ auxiliaryWorkers: [{ config: otherWorker, devOnly: true }] })`.
|
|
163
|
-
|
|
164
|
-
## Native endpoints (served automatically)
|
|
165
|
-
|
|
166
|
-
`/` (name, OpenAPI path, MCP path), `/health`, `/openapi.json`, `/openapi.yaml`, `/openapi.yml`,
|
|
167
|
-
`/.well-known/oauth-protected-resource` and `…/mcp`. They are reserved paths.
|
|
@@ -1,62 +0,0 @@
|
|
|
1
|
-
# Migrating from 2.x
|
|
2
|
-
|
|
3
|
-
Move every `@getarbol/maximus*` dependency to the same 3.x version together.
|
|
4
|
-
(`@getarbol/maximus-postgres` is versioned on its own and unaffected.) Signed admission, unsigned
|
|
5
|
-
delegation and the service artifact below describe 3.x and 4.x; 5.0 removed them (see
|
|
6
|
-
`migration-to-v5.md`).
|
|
7
|
-
|
|
8
|
-
## Breaking changes in 3.0.0
|
|
9
|
-
|
|
10
|
-
| Area | 2.x | 3.x | Do |
|
|
11
|
-
| --- | --- | --- | --- |
|
|
12
|
-
| Issuer | `tokens.issuer` had a built-in default | No default | Set `tokens.issuer` everywhere OAuth tokens are verified or documented. Missing → every OAuth token is 401 and `/openapi.json` is 500. |
|
|
13
|
-
| Proof type | `arbol-admission+jwt` | `maximus-admission+jwt` | Release signer and all owners together. |
|
|
14
|
-
| OpenAPI extensions | `x-arbol-service-id`, `-publication`, `-publish`, `-input-schema`, `-actor-kinds` | `x-maximus-…` | Update readers of classified documents. |
|
|
15
|
-
| Security schemes | `arbolToken`, `arbolHuman`, `arbolMachine` | `oauth2`, `bearer` | Update clients and generators. |
|
|
16
|
-
| Service owner | `'arbol'` | `'platform'` | Replace in `service.owner`. |
|
|
17
|
-
| `maximus token` | `ARBOL_CLIENT_ID`, `ARBOL_CLIENT_SECRET`, `ARBOL_ISSUER` | `--issuer` (required), `MAXIMUS_CLIENT_ID`, `MAXIMUS_CLIENT_SECRET` | Removed in 4.0: drop it from operator scripts. |
|
|
18
|
-
|
|
19
|
-
## Notable 3.x additions
|
|
20
|
-
|
|
21
|
-
- 3.1.0: `@getarbol/maximus/projection`, `callAdmitted`, admission service schemas, `OUTCOME_UNKNOWN`.
|
|
22
|
-
- 3.2.0: `checkSchema`, `readSchema`.
|
|
23
|
-
- 3.3.0: `INVALID_INPUT` carries `data.issues` everywhere; clients expecting `data: {}` must accept it.
|
|
24
|
-
- 3.3.1: plain routes beneath a transport path.
|
|
25
|
-
- 3.4.0: `admission.attachments`; `describe` for an internal runtime's agent.
|
|
26
|
-
- 3.4.1: `callAdmitted` fixed for real Service Binding stubs; upgrade dispatchers from 3.4.0.
|
|
27
|
-
- 3.5.0: runtime-free `@getarbol/maximus/admitted` and `@getarbol/maximus/failures`.
|
|
28
|
-
- 3.6.0: `.build()` refuses a missing or non-HTTPS `tokens.issuer` and input codecs outside
|
|
29
|
-
`inputSchema()`.
|
|
30
|
-
|
|
31
|
-
## Classifying an unclassified (pre-2.13) service
|
|
32
|
-
|
|
33
|
-
1. `publication: 'private' | 'selected'`.
|
|
34
|
-
2. `publish: { rest, mcp }` on every operation (`true` only with the transport declared, never for
|
|
35
|
-
internal operations or in a private service).
|
|
36
|
-
3. `actorKinds` on every operation.
|
|
37
|
-
4. `api: { resource, verb, id? }` on every published or admitted operation.
|
|
38
|
-
5. `service: { kind, owner, publicName?, dependencies?, connections?, roles? }`.
|
|
39
|
-
6. `bun --bun maximus check`, then `bun --bun maximus export --allow-dirty --out artifact.json`.
|
|
40
|
-
|
|
41
|
-
`.build()` names the next operation and rule to fix.
|
|
42
|
-
|
|
43
|
-
## Unsigned delegation → signed admission
|
|
44
|
-
|
|
45
|
-
| | Before | After |
|
|
46
|
-
| --- | --- | --- |
|
|
47
|
-
| Operation | `delegated: { surfaces, actorKinds, clientClasses }` | `admission: { callers, ingresses }`, `actorKinds` |
|
|
48
|
-
| Application | `delegation: { authorize(env, grant) }` | `admission: { verification, authorize }` |
|
|
49
|
-
| Props | `{ caller: 'gateway', mode: 'delegated' }` | `{ caller: '<dispatcher>', mode: 'admitted' }` |
|
|
50
|
-
|
|
51
|
-
Same `worker.delegatedEntrypoint`. Unsigned grants are refused once `publication` is set.
|
|
52
|
-
|
|
53
|
-
## From 1.x
|
|
54
|
-
|
|
55
|
-
Explicit packages instead of Elysia/Eden; one fluent base with mounted resource modules; opt-in MCP
|
|
56
|
-
and telemetry; remove `Function` test shims; check consumers' RPC types against `Service<T>` with a
|
|
57
|
-
`never` control; keep Durable Object class names, migration tags and durable keys.
|
|
58
|
-
|
|
59
|
-
## Verify
|
|
60
|
-
|
|
61
|
-
Typecheck, tests, dry-run bundle, `maximus check` for classified services, then verify the deployed
|
|
62
|
-
Worker (health, OpenAPI, a 401 without token, a real call).
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
# Migrating to 5.0
|
|
2
|
-
|
|
3
|
-
The platform Gateway is a proxy to each service's own origin; services call each other over native
|
|
4
|
-
RPC. 5.0 removes what nothing calls anymore. TypeScript names each removed option that remains.
|
|
5
|
-
|
|
6
|
-
## Remove from the application
|
|
7
|
-
|
|
8
|
-
- `gateway: { audience, issuer, … }`: list the platform audience in `tokens.audience` instead
|
|
9
|
-
(`[OWN, PLATFORM]`); the origin verifies the forwarded token like any other. Move rules that
|
|
10
|
-
`gateway.authorize` applied into context or middleware.
|
|
11
|
-
- `originRoutes`: a selected service's origin serves and documents every declared route (as
|
|
12
|
-
`'declared'` did). With `'none'` it now also serves `/`, `/openapi.json` and `/health`; a web app
|
|
13
|
-
that needs `/` sets `http.basePath`.
|
|
14
|
-
- `contract`, `admission`, `delegation`.
|
|
15
|
-
- `service.kind`, `service.owner`, `service.dependencies`, `service.connections` (keep
|
|
16
|
-
`publicName`, `permissions`, `roles`).
|
|
17
|
-
- On operations: `admission`, `delegated`, `resourceSlots`, `execution`.
|
|
18
|
-
|
|
19
|
-
## Remove from the Worker
|
|
20
|
-
|
|
21
|
-
- `worker.delegatedEntrypoint` and its export (and the export declared in `cloudflare.config.ts` or
|
|
22
|
-
Wrangler), and bindings with props `mode: 'token' | 'admitted' | 'delegated'`.
|
|
23
|
-
- `maximus publish`, `maximus export`, `maximus permissions` steps in CI.
|
|
24
|
-
|
|
25
|
-
## Imports
|
|
26
|
-
|
|
27
|
-
- `isResult`: from `@getarbol/maximus` (was `/admitted`).
|
|
28
|
-
- Gone: `/admitted` (`callAdmitted`), `/delegation` (everything), `exportServiceContract`,
|
|
29
|
-
`ContractBuild`, `gatewayServes`, `GatewayPolicy`, `GatewayCall`, `OriginRoutes`, and from
|
|
30
|
-
`/projection` `publicName`, `cliCommand`, `restRoute`, `encodeQuery`, `decodeQuery`.
|
|
31
|
-
- `originServes(publication, operation, surface)` lost its `originRoutes` argument.
|
|
32
|
-
- `authority.admission` is gone; `authority.token` remains.
|
|
33
|
-
|
|
34
|
-
## OpenAPI
|
|
35
|
-
|
|
36
|
-
`x-maximus-gateway`, `x-maximus-failures` and `x-maximus-service.kind` are gone; `x-maximus-tokens:
|
|
37
|
-
{ issuer, audiences }` names whose tokens the service verifies. The `artifact` projection is gone.
|
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
# Deploying and verifying
|
|
2
|
-
|
|
3
|
-
## A new service (`@arbol-ai/maximus`)
|
|
4
|
-
|
|
5
|
-
Run `bunx @arbol-ai/maximus init <dir> --name <name> --layout project` for a Vite+ project on the CLI's
|
|
6
|
-
own release. Configure its origin and token policy in `maximus.config.ts`. The compatible service
|
|
7
|
-
layout is still available and keeps `src/app.ts`. Use the generated package scripts: Vite+ owns
|
|
8
|
-
development, builds and checks; Cloudflare owns types and deployment. Maximus prepares the source
|
|
9
|
-
graph before Vite loads the generated Worker.
|
|
10
|
-
|
|
11
|
-
`createOpenApi(app)` builds the document the origin serves at `/openapi.json`, for SDKs or a contract
|
|
12
|
-
check at build time. Nothing is published from the service: deploying it is the release.
|
|
13
|
-
|
|
14
|
-
## Before deploying
|
|
15
|
-
|
|
16
|
-
```sh
|
|
17
|
-
bun run verify # preparation, types, lint/format and build; no tests
|
|
18
|
-
# Read .cloudflare/output/v0/workers/default/worker.config.json: no development token.
|
|
19
|
-
cf deploy --prebuilt --mode production --dry-run
|
|
20
|
-
cf deploy --prebuilt --mode production # --dry-run first; cf auth login or CLOUDFLARE_API_TOKEN
|
|
21
|
-
```
|
|
22
|
-
|
|
23
|
-
`nodejs_compat` on; secrets as `bindings.secret()`, uploaded with `cf deploy --secrets-file` or kept
|
|
24
|
-
in Secrets Store, never in `bindings.text()`; `.dev.vars` local only, and the development token
|
|
25
|
-
declared for development mode alone; Durable Object class names unchanged and declared as exports; preview
|
|
26
|
-
environments use their own audience, state and credentials.
|
|
27
|
-
|
|
28
|
-
## After deploying
|
|
29
|
-
|
|
30
|
-
Verify the real Worker: `/health` version; `/openapi.json` operations (`verifyContract`); `401`
|
|
31
|
-
without a token; a real token call for a test organization; MCP `tools/list`;
|
|
32
|
-
RPC calls through a real caller. Keep tokens and raw responses in an ignored `.private/`
|
|
33
|
-
(0700/0600) and never print sensitive bodies to shared logs. Mocks are never evidence of a live
|
|
34
|
-
deployment.
|
|
35
|
-
|
|
36
|
-
## Releasing Maximus itself (framework repository)
|
|
37
|
-
|
|
38
|
-
Run `bun run verify` for builds, workspace types, lint and format. Inspect a packed tarball and build
|
|
39
|
-
consumers from it; never publish `workspace:` or `file:` dependencies. After publication, install from
|
|
40
|
-
the registry, produce the consumer's dry bundle and verify the deployed service. Test suites and
|
|
41
|
-
package smoke tests are separate: run them only after an explicit human request. Neither release
|
|
42
|
-
authorization nor a successful build is evidence that tests were authorized or passed.
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import { bindings, defineConfig } from 'cf/config';
|
|
2
|
-
|
|
3
|
-
import * as entrypoint from './.maximus/entry.ts' with { type: 'cf-worker' };
|
|
4
|
-
|
|
5
|
-
export default defineConfig(({ mode }) => ({
|
|
6
|
-
worker: {
|
|
7
|
-
name: '__PROJECT_NAME__',
|
|
8
|
-
compatibilityDate: '__COMPATIBILITY_DATE__',
|
|
9
|
-
// Maximus keeps request diagnostics in AsyncLocalStorage.
|
|
10
|
-
compatibilityFlags: ['nodejs_compat'],
|
|
11
|
-
entrypoint,
|
|
12
|
-
workersDev: true,
|
|
13
|
-
previewUrls: false,
|
|
14
|
-
observability: {
|
|
15
|
-
enabled: true,
|
|
16
|
-
redactQueryString: true,
|
|
17
|
-
logs: { enabled: true, invocationLogs: true },
|
|
18
|
-
traces: { enabled: true },
|
|
19
|
-
},
|
|
20
|
-
env: {
|
|
21
|
-
DEVELOPMENT_TOKEN: mode === 'development' && bindings.secret(),
|
|
22
|
-
},
|
|
23
|
-
},
|
|
24
|
-
}));
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import { defineErrors, err, standardErrors } from '@arbol-ai/maximus';
|
|
2
|
-
import { defineConfig } from '@arbol-ai/maximus/config';
|
|
3
|
-
|
|
4
|
-
export default defineConfig<Env>({
|
|
5
|
-
name: '__PROJECT_NAME__',
|
|
6
|
-
namespace: '__PROJECT_NAME__',
|
|
7
|
-
title: '__PROJECT_NAME__',
|
|
8
|
-
version: '0.1.0',
|
|
9
|
-
origin: 'https://__PROJECT_NAME__.example.com',
|
|
10
|
-
tokens: {
|
|
11
|
-
audience: 'https://__PROJECT_NAME__.example.com',
|
|
12
|
-
scheme: { type: 'bearer', description: 'Production authentication has not been configured.' },
|
|
13
|
-
// Fail closed until the application configures its identity provider or verified token resolver.
|
|
14
|
-
resolve: () => Promise.resolve(err(standardErrors.unauthorized.create())),
|
|
15
|
-
development: { binding: 'DEVELOPMENT_TOKEN' },
|
|
16
|
-
},
|
|
17
|
-
errors: defineErrors({}),
|
|
18
|
-
rpc: { callers: [] },
|
|
19
|
-
worker: { http: { basePath: '/api', healthPath: '/health' } },
|
|
20
|
-
});
|
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
import { EmptyInputSchema, ok, t } from '@arbol-ai/maximus';
|
|
2
|
-
|
|
3
|
-
import { defineRoute } from '#maximus/routes';
|
|
4
|
-
|
|
5
|
-
const GreetingSchema = t.Object({ message: t.String() }, { $id: 'Greeting', additionalProperties: false });
|
|
6
|
-
|
|
7
|
-
/** The filename supplies the path and this export supplies the method. */
|
|
8
|
-
export const GET = defineRoute(
|
|
9
|
-
'getGreeting',
|
|
10
|
-
{
|
|
11
|
-
title: 'Get a greeting',
|
|
12
|
-
description: 'Return a greeting to an authenticated caller.',
|
|
13
|
-
scope: '__PROJECT_NAME__:greeting:read',
|
|
14
|
-
effect: 'read',
|
|
15
|
-
input: EmptyInputSchema,
|
|
16
|
-
output: GreetingSchema,
|
|
17
|
-
},
|
|
18
|
-
() => Promise.resolve(ok({ message: 'Hello World' }))
|
|
19
|
-
);
|
|
20
|
-
|
|
21
|
-
const EchoInputSchema = t.Object(
|
|
22
|
-
{ message: t.String({ minLength: 1, maxLength: 200 }) },
|
|
23
|
-
{ additionalProperties: false }
|
|
24
|
-
);
|
|
25
|
-
|
|
26
|
-
/** A POST can expose a read operation; its effect remains truthful because no state changes. */
|
|
27
|
-
export const POST = defineRoute(
|
|
28
|
-
'echoGreeting',
|
|
29
|
-
{
|
|
30
|
-
title: 'Echo a greeting',
|
|
31
|
-
description: 'Return the authenticated caller’s greeting without storing it.',
|
|
32
|
-
scope: '__PROJECT_NAME__:greeting:read',
|
|
33
|
-
effect: 'read',
|
|
34
|
-
input: EchoInputSchema,
|
|
35
|
-
output: GreetingSchema,
|
|
36
|
-
},
|
|
37
|
-
(_context, input) => Promise.resolve(ok(input))
|
|
38
|
-
);
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: __PROJECT_NAME__-development
|
|
3
|
-
description: Add and verify operations in the __PROJECT_NAME__ service.
|
|
4
|
-
---
|
|
5
|
-
|
|
6
|
-
Read CLAUDE.md and the Maximus skill at node_modules/@arbol-ai/maximus/skills/maximus/SKILL.md.
|
|
7
|
-
Declare strict input/output, effect and scope in src/api/<resource>/operations.ts and mount the
|
|
8
|
-
module in src/app.ts. Expose only the transports a caller needs (http, mcp, rpc). Keep upstream
|
|
9
|
-
protocols and state in this project. Use @arbol-ai/maximus/testing for the contract smoke and add
|
|
10
|
-
domain tests for the risks unique to this service.
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
name: Verify
|
|
2
|
-
on: [push, pull_request]
|
|
3
|
-
permissions:
|
|
4
|
-
contents: read
|
|
5
|
-
packages: read
|
|
6
|
-
jobs:
|
|
7
|
-
verify:
|
|
8
|
-
runs-on: ubuntu-latest
|
|
9
|
-
steps:
|
|
10
|
-
- uses: actions/checkout@v7
|
|
11
|
-
- uses: oven-sh/setup-bun@v2
|
|
12
|
-
with:
|
|
13
|
-
bun-version: 1.4.3
|
|
14
|
-
# cf runs on Node 22 or later.
|
|
15
|
-
- uses: actions/setup-node@v7
|
|
16
|
-
with:
|
|
17
|
-
node-version: 24
|
|
18
|
-
- run: bun install --frozen-lockfile --ignore-scripts
|
|
19
|
-
env:
|
|
20
|
-
NODE_AUTH_TOKEN: ${{ secrets.PACKAGES_TOKEN || github.token }}
|
|
21
|
-
- run: bun run verify
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
# Agent guide
|
|
2
|
-
|
|
3
|
-
Read .agents/skills/project/SKILL.md and the installed Maximus skill (node_modules/@arbol-ai/maximus/skills/maximus/SKILL.md). Code/docs are English. Use organizationId, strict schemas and namespaced scopes. Keep credentials and provider evidence in ignored .private/ (0700/0600). Add operations in resource modules; compose once in app.ts. Domain functions are shared with scripts. Tests own provider behavior, not framework JWT/protocol matrices. Run bun run verify. Never call live providers in CI. Configure audience, issuer, callers and deployment resources before release.
|
|
4
|
-
|
|
5
|
-
The root vite.config.ts owns the Vite+ toolchain. Use vp dev, vp build and vp check. Tests require an explicit human request; verify and deployment do not run them.
|