@arbol-ai/maximus 7.2.0 → 7.3.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/config/oxfmt.mjs +1 -0
- package/config/oxlint.mjs +1 -0
- package/dist/analytics/analytics.d.ts +2 -4
- package/dist/analytics/analytics.js +3 -4
- package/dist/body.d.ts +1 -1
- package/dist/body.js +2 -2
- package/dist/chunks/{body-BcMbreNd.js → body-6LichrQm.js} +1 -2
- package/dist/chunks/{correlation-gaiEoMBr.js → correlation-BEkcFFGT.js} +1 -2
- package/dist/chunks/{execution-qfZuMSIu.js → execution-B-yy4C7N.js} +14 -23
- package/dist/chunks/{json-Dwni3u4c.js → json-Bu4BLT25.js} +2 -3
- package/dist/chunks/prepare-project-zi106pWF.js +146 -0
- package/dist/chunks/{record-D2H3cg8S.js → record-DY-lX9w1.js} +2 -4
- package/dist/chunks/runtime-BPnaa-NK.js +223 -0
- package/dist/chunks/{schemas-q-51wBMQ.js → schemas-CzTvbXb6.js} +6 -11
- package/dist/chunks/{src-Bqznd6Dd.js → src-DPSpGNnT.js} +13 -20
- package/dist/chunks/{telemetry-DvZgrzZn.js → telemetry-BTwB68m5.js} +2 -4
- package/dist/chunks/{types-BCPe0fok.d.ts → types-BWxDd3tY.d.ts} +105 -51
- package/dist/chunks/{validation-DWxKk1Js.js → validation-r-sgmsqb.js} +3 -6
- package/dist/client/client.d.ts +1 -3
- package/dist/client/client.js +7 -11
- package/dist/diagnostics.d.ts +1 -3
- package/dist/diagnostics.js +2 -2
- package/dist/errors.d.ts +1 -1
- package/dist/errors.js +3 -4
- package/dist/http-paths.d.ts +1 -1
- package/dist/http-paths.js +1 -2
- package/dist/index.d.ts +1 -1
- package/dist/index.js +7 -7
- package/dist/internals.d.ts +1 -1
- package/dist/internals.js +2 -2
- package/dist/mcp/index.d.ts +2 -4
- package/dist/mcp/index.js +5 -7
- package/dist/postgres/index.d.ts +0 -4
- package/dist/postgres/index.js +2 -4
- package/dist/project/index.d.ts +24 -0
- package/dist/project/index.js +82 -0
- package/dist/projection.d.ts +1 -3
- package/dist/projection.js +1 -2
- package/dist/schemas.d.ts +1 -1
- package/dist/schemas.js +2 -2
- package/dist/standard-failures.d.ts +1 -3
- package/dist/standard-failures.js +1 -2
- package/dist/tooling/cli.js +41 -24
- package/dist/tooling/testing.d.ts +1 -3
- package/dist/tooling/testing.js +1 -2
- package/dist/tooling/vite.d.ts +3 -0
- package/dist/tooling/vite.js +44 -0
- package/dist/webhooks.d.ts +2 -4
- package/dist/webhooks.js +1 -2
- package/dist/workers/runtime.d.ts +2 -112
- package/dist/workers/runtime.js +1 -226
- package/package.json +19 -6
- package/skills/maximus/SKILL.md +1 -1
- package/skills/maximus/references/building-a-service.md +9 -0
- package/templates/project/.agents/skills/project/SKILL.md.template +17 -0
- package/templates/project/.github/workflows/ci.yml.template +36 -0
- package/templates/project/.gitignore.template +10 -0
- package/templates/project/CLAUDE.md.template +34 -0
- package/templates/project/README.md.template +47 -0
- package/templates/project/cloudflare.config.ts.template +24 -0
- package/templates/project/package.json.template +38 -0
- package/templates/project/pages/index.ts.template +11 -0
- package/templates/project/routes/v1/greeting.ts.template +22 -0
- package/templates/project/src/app.ts.template +2 -0
- package/templates/project/src/application.ts.template +26 -0
- package/templates/project/src/index.ts.template +3 -0
- package/templates/project/src/worker.ts.template +6 -0
- package/templates/project/tsconfig.json.template +30 -0
- package/templates/project/vite.config.ts.template +11 -0
- package/templates/service/.github/workflows/ci.yml.template +1 -1
- package/templates/service/.gitignore.template +1 -0
- package/templates/service/CLAUDE.md.template +2 -0
- package/templates/service/README.md.template +7 -7
- package/templates/service/package.json.template +14 -9
- package/templates/service/tests/contract.test.ts.template +1 -1
- package/templates/service/vite.config.ts.template +8 -2
- package/templates/service/vitest.config.ts.template +1 -1
- package/templates/service/oxfmt.config.ts.template +0 -1
- package/templates/service/oxlint.config.ts.template +0 -1
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { EmptyInputSchema, ok, t } from '@arbol-ai/maximus';
|
|
2
|
+
|
|
3
|
+
import { base } from '../../src/application';
|
|
4
|
+
|
|
5
|
+
const GreetingSchema = t.Object({ message: t.String() }, { $id: 'Greeting', additionalProperties: false });
|
|
6
|
+
|
|
7
|
+
/** The filename supplies the versioned path; Maximus still owns admission and schema validation. */
|
|
8
|
+
export default function greeting(path: string) {
|
|
9
|
+
return base.operation(
|
|
10
|
+
'getGreeting',
|
|
11
|
+
{
|
|
12
|
+
title: 'Get a greeting',
|
|
13
|
+
description: 'Return a greeting to an authenticated caller.',
|
|
14
|
+
scope: '__PROJECT_NAME__:greeting:read',
|
|
15
|
+
effect: 'read',
|
|
16
|
+
http: { method: 'GET', path },
|
|
17
|
+
input: EmptyInputSchema,
|
|
18
|
+
output: GreetingSchema,
|
|
19
|
+
},
|
|
20
|
+
() => Promise.resolve(ok({ message: 'Hello World' }))
|
|
21
|
+
);
|
|
22
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { defineErrors, err, maximus, standardErrors } from '@arbol-ai/maximus';
|
|
2
|
+
|
|
3
|
+
import { middleware } from '../.maximus/middleware';
|
|
4
|
+
|
|
5
|
+
let application = maximus<Env>({
|
|
6
|
+
name: '__PROJECT_NAME__',
|
|
7
|
+
namespace: '__PROJECT_NAME__',
|
|
8
|
+
title: '__PROJECT_NAME__',
|
|
9
|
+
version: '0.1.0',
|
|
10
|
+
origin: 'https://__PROJECT_NAME__.example.com',
|
|
11
|
+
tokens: {
|
|
12
|
+
audience: 'https://__PROJECT_NAME__.example.com',
|
|
13
|
+
scheme: { type: 'bearer', description: 'Production authentication has not been configured.' },
|
|
14
|
+
// Fail closed until the application configures its identity provider or verified token resolver.
|
|
15
|
+
resolve: () => Promise.resolve(err(standardErrors.unauthorized.create())),
|
|
16
|
+
development: { binding: 'DEVELOPMENT_TOKEN' },
|
|
17
|
+
},
|
|
18
|
+
errors: defineErrors({}),
|
|
19
|
+
rpc: { callers: [] },
|
|
20
|
+
});
|
|
21
|
+
|
|
22
|
+
/** All discovered operations share middleware that runs after native authentication and scope checks. */
|
|
23
|
+
for (const handler of middleware) {
|
|
24
|
+
application = application.use(handler);
|
|
25
|
+
}
|
|
26
|
+
export const base = application;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { WorkerOptions } from '@arbol-ai/maximus/workers';
|
|
2
|
+
|
|
3
|
+
/** Keep API ownership separate from public pages. Bindings and triggers belong in cloudflare.config.ts. */
|
|
4
|
+
export const options: WorkerOptions<Env> = {
|
|
5
|
+
http: { basePath: '/api', healthPath: '/health' },
|
|
6
|
+
};
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
"target": "ES2024",
|
|
4
|
+
"lib": ["ES2024"],
|
|
5
|
+
"module": "preserve",
|
|
6
|
+
"moduleResolution": "bundler",
|
|
7
|
+
"types": ["node"],
|
|
8
|
+
"strict": true,
|
|
9
|
+
"noEmit": true,
|
|
10
|
+
"allowImportingTsExtensions": true,
|
|
11
|
+
"isolatedModules": true,
|
|
12
|
+
"verbatimModuleSyntax": true,
|
|
13
|
+
"skipLibCheck": true
|
|
14
|
+
},
|
|
15
|
+
"include": [
|
|
16
|
+
"src",
|
|
17
|
+
"routes",
|
|
18
|
+
"pages",
|
|
19
|
+
"middleware",
|
|
20
|
+
"crons",
|
|
21
|
+
"queues",
|
|
22
|
+
"email",
|
|
23
|
+
"durable-objects",
|
|
24
|
+
"db",
|
|
25
|
+
"cloudflare.config.ts",
|
|
26
|
+
"vite.config.ts",
|
|
27
|
+
".maximus",
|
|
28
|
+
".cloudflare/types"
|
|
29
|
+
]
|
|
30
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import fmt from '@arbol-ai/maximus/oxfmt';
|
|
2
|
+
import lint from '@arbol-ai/maximus/oxlint';
|
|
3
|
+
import { maximusProject } from '@arbol-ai/maximus/vite';
|
|
4
|
+
import { cloudflare } from '@cloudflare/vite-plugin';
|
|
5
|
+
import { defineConfig } from 'vite-plus';
|
|
6
|
+
|
|
7
|
+
export default defineConfig({
|
|
8
|
+
lint: { ...lint, options: { typeAware: false } },
|
|
9
|
+
fmt,
|
|
10
|
+
plugins: [maximusProject(), cloudflare()],
|
|
11
|
+
});
|
|
@@ -15,7 +15,7 @@ jobs:
|
|
|
15
15
|
- uses: actions/setup-node@v7
|
|
16
16
|
with:
|
|
17
17
|
node-version: 24
|
|
18
|
-
- run: bun install --frozen-lockfile
|
|
18
|
+
- run: bun install --frozen-lockfile --ignore-scripts
|
|
19
19
|
env:
|
|
20
20
|
NODE_AUTH_TOKEN: ${{ secrets.PACKAGES_TOKEN || github.token }}
|
|
21
21
|
- run: bun run verify
|
|
@@ -1,3 +1,5 @@
|
|
|
1
1
|
# Agent guide
|
|
2
2
|
|
|
3
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.
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
# __PROJECT_NAME__
|
|
1
|
+
# `__PROJECT_NAME__`
|
|
2
2
|
|
|
3
3
|
A [Maximus](https://github.com/getarbol/maximus) service on Cloudflare Workers. It
|
|
4
4
|
declares each operation once and serves it over HTTP with its OpenAPI document, and, when an
|
|
@@ -12,8 +12,8 @@ them. The starter declares no operation, so it serves only its discovery documen
|
|
|
12
12
|
|
|
13
13
|
## Run it locally
|
|
14
14
|
|
|
15
|
-
`bun run dev` serves the Worker on `localhost` with `
|
|
16
|
-
token to `.dev.vars`, which Git ignores and `cloudflare.config.ts` declares for `
|
|
15
|
+
`bun run dev` serves the Worker on `localhost` with `vp dev`. `maximus init` wrote a random development
|
|
16
|
+
token to `.dev.vars`, which Git ignores and `cloudflare.config.ts` declares for `vp dev` alone, so no
|
|
17
17
|
deployed build carries it. From `localhost` it is a developer holding every scope the service declares:
|
|
18
18
|
|
|
19
19
|
```sh
|
|
@@ -26,12 +26,12 @@ curl -H "authorization: Bearer $TOKEN" http://localhost:5173/v1/<your operation'
|
|
|
26
26
|
| Command | Runs |
|
|
27
27
|
| ------------------------------- | -------------------------------------------------------------------------------------------- |
|
|
28
28
|
| `bun install` | Installs the dependencies. |
|
|
29
|
-
| `bun run dev` | The Worker locally, with `
|
|
29
|
+
| `bun run dev` | The Worker locally, with `vp dev`. |
|
|
30
30
|
| `bun run typecheck` | Generates the binding and runtime types with `cf workers types`, then TypeScript. |
|
|
31
|
-
| `bun run check` / `bun run fix` |
|
|
31
|
+
| `bun run check` / `bun run fix` | Vite+ lint and format with the Maximus presets. |
|
|
32
32
|
| `bun run test` | The tests, in the Workers runtime. |
|
|
33
|
-
| `bun run build` | `
|
|
34
|
-
| `bun run verify` |
|
|
33
|
+
| `bun run build` | `vp build`, which writes the build `cf deploy` uploads. |
|
|
34
|
+
| `bun run verify` | Type generation, TypeScript, Vite+ lint/format and build; no tests. |
|
|
35
35
|
| `bun run deploy` | `verify`, then deploys that same build with `cf deploy`. Sign in with `cf auth login` first. |
|
|
36
36
|
|
|
37
37
|
## Layout
|
|
@@ -3,13 +3,13 @@
|
|
|
3
3
|
"private": true,
|
|
4
4
|
"type": "module",
|
|
5
5
|
"scripts": {
|
|
6
|
-
"dev": "
|
|
6
|
+
"dev": "vp dev",
|
|
7
7
|
"typecheck": "cf workers types && tsc",
|
|
8
|
-
"check": "
|
|
9
|
-
"fix": "
|
|
10
|
-
"test": "
|
|
11
|
-
"build": "
|
|
12
|
-
"verify": "bun run typecheck && bun run check && bun run
|
|
8
|
+
"check": "vp check",
|
|
9
|
+
"fix": "vp check --fix",
|
|
10
|
+
"test": "vp test run",
|
|
11
|
+
"build": "vp build",
|
|
12
|
+
"verify": "bun run typecheck && bun run check && bun run build",
|
|
13
13
|
"deploy": "bun run verify && cf deploy --prebuilt --mode production"
|
|
14
14
|
},
|
|
15
15
|
"dependencies": {
|
|
@@ -20,12 +20,17 @@
|
|
|
20
20
|
"@cloudflare/vitest-plugin": "^1.4.4",
|
|
21
21
|
"@types/node": "^26.6.5",
|
|
22
22
|
"cf": "^1.0.0-beta.18",
|
|
23
|
-
"oxfmt": "
|
|
24
|
-
"oxlint": "
|
|
23
|
+
"oxfmt": "0.74.0",
|
|
24
|
+
"oxlint": "1.89.0",
|
|
25
25
|
"typescript": "^7.0.2",
|
|
26
26
|
"ultracite": "^8.0.1",
|
|
27
|
-
"vite": "
|
|
27
|
+
"vite": "npm:@voidzero-dev/vite-plus-core@1.4.0",
|
|
28
|
+
"vite-plus": "1.4.0",
|
|
28
29
|
"vitest": "^5.0.5"
|
|
29
30
|
},
|
|
31
|
+
"overrides": {
|
|
32
|
+
"vite": "npm:@voidzero-dev/vite-plus-core@1.4.0",
|
|
33
|
+
"vitest": "5.0.5"
|
|
34
|
+
},
|
|
30
35
|
"packageManager": "bun@1.4.3"
|
|
31
36
|
}
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
*/
|
|
4
4
|
import { verifyContract } from '@arbol-ai/maximus/testing';
|
|
5
5
|
import { exports } from 'cloudflare:workers';
|
|
6
|
-
import { expect, it } from '
|
|
6
|
+
import { expect, it } from 'vite-plus/test';
|
|
7
7
|
|
|
8
8
|
it('publishes one runtime contract', async () => {
|
|
9
9
|
const contract = await verifyContract((request) => exports.default.fetch(request), 'https://example.test');
|
|
@@ -1,7 +1,13 @@
|
|
|
1
|
+
import fmt from '@arbol-ai/maximus/oxfmt';
|
|
2
|
+
import lint from '@arbol-ai/maximus/oxlint';
|
|
1
3
|
/**
|
|
2
4
|
* The build `cf` runs: Cloudflare's Vite plugin bundles the Worker and, under `cf dev`, runs it in workerd.
|
|
3
5
|
*/
|
|
4
6
|
import { cloudflare } from '@cloudflare/vite-plugin';
|
|
5
|
-
import { defineConfig } from 'vite';
|
|
7
|
+
import { defineConfig } from 'vite-plus';
|
|
6
8
|
|
|
7
|
-
export default defineConfig({
|
|
9
|
+
export default defineConfig({
|
|
10
|
+
lint: { ...lint, options: { typeAware: false } },
|
|
11
|
+
fmt,
|
|
12
|
+
plugins: [cloudflare()],
|
|
13
|
+
});
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* The tests run in workerd, with the Worker and the bindings cloudflare.config.ts declares.
|
|
3
3
|
*/
|
|
4
4
|
import { cloudflareTest } from '@cloudflare/vitest-plugin';
|
|
5
|
-
import { defineConfig } from '
|
|
5
|
+
import { defineConfig } from 'vite-plus/test/config';
|
|
6
6
|
|
|
7
7
|
export default defineConfig({
|
|
8
8
|
plugins: [cloudflareTest({ remoteBindings: false, experimental: { newConfig: true } })],
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { default } from '@arbol-ai/maximus/oxfmt';
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { default } from '@arbol-ai/maximus/oxlint';
|