@arbol-ai/maximus 7.4.0 → 8.0.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.
Files changed (135) hide show
  1. package/README.md +36 -38
  2. package/bin/maximus.js +4 -0
  3. package/config/oxfmt.mjs +1 -0
  4. package/config/oxlint.mjs +10 -0
  5. package/dist/analytics/analytics.d.ts +21 -9
  6. package/dist/analytics/analytics.js +19 -5
  7. package/dist/body.d.ts +1 -1
  8. package/dist/body.js +2 -2
  9. package/dist/chunks/agent-skills-Ef65jTf_.js +49 -0
  10. package/dist/chunks/agent-skills-m7y1EUch.js +3 -0
  11. package/dist/chunks/{body-6LichrQm.js → body-DOIHwIIl.js} +14 -7
  12. package/dist/chunks/{correlation-BEkcFFGT.js → correlation-4b23a-a4.js} +8 -5
  13. package/dist/chunks/define-app-CfVZBt7D.js +336 -0
  14. package/dist/chunks/{errors-D7zG9kx9.js → errors-WfyKhiyk.js} +9 -4
  15. package/dist/chunks/{execution-kVUJPy1A.js → execution-CfZEx_JP.js} +28 -15
  16. package/dist/chunks/generate-C-9FKW0o.js +197 -0
  17. package/dist/chunks/handler-DWTGoduQ.js +140 -0
  18. package/dist/chunks/http-layout-_h7xwgPC.js +128 -0
  19. package/dist/chunks/{http-paths-yKD6TSNJ.js → http-paths-DMBxwpp6.js} +50 -31
  20. package/dist/chunks/{json-Bu4BLT25.js → json-B14evE6-.js} +21 -5
  21. package/dist/chunks/names-ncD7A3DV.js +280 -0
  22. package/dist/chunks/openapi-CV0KmJpS.js +1588 -0
  23. package/dist/chunks/openapi-file-OjSs9mRv.js +83 -0
  24. package/dist/chunks/pages-DyC0m8Zb.js +14 -0
  25. package/dist/chunks/prepare-configured-BmRJLg6J.js +3 -0
  26. package/dist/chunks/prepare-configured-Cithjf80.js +52 -0
  27. package/dist/chunks/project-files-C0OX7MQQ.js +130 -0
  28. package/dist/chunks/query-kind-CWKAXEME.js +40 -0
  29. package/dist/chunks/record-DQUDTpEA.js +10 -0
  30. package/dist/chunks/result-CKgZHrnj.js +56 -0
  31. package/dist/chunks/{runtime-DlqA7J38.js → runtime-CVVf5hmp.js} +50 -26
  32. package/dist/chunks/scaffold-DGrcjR3h.js +3 -0
  33. package/dist/chunks/scaffold-DZD6dfoZ.js +138 -0
  34. package/dist/chunks/{schemas-CzTvbXb6.js → schemas-p_aRcMC1.js} +30 -14
  35. package/dist/chunks/server-CCc7fil4.js +410 -0
  36. package/dist/chunks/src--HZrH1U9.js +568 -0
  37. package/dist/chunks/{telemetry-BTwB68m5.js → telemetry-C3LfZcOB.js} +32 -11
  38. package/dist/chunks/{types-DQdfRF3f.d.ts → types-BQYB4Ads.d.ts} +993 -341
  39. package/dist/chunks/{validation-r-sgmsqb.js → validation-fTohBT6R.js} +69 -28
  40. package/dist/chunks/workers-types-iONp32T4.d.ts +143 -0
  41. package/dist/chunks/yaml-Dk2L24yQ.js +74 -0
  42. package/dist/diagnostics.d.ts +6 -4
  43. package/dist/diagnostics.js +2 -2
  44. package/dist/errors.d.ts +2 -2
  45. package/dist/errors.js +2 -2
  46. package/dist/http-paths.d.ts +1 -1
  47. package/dist/http-paths.js +1 -1
  48. package/dist/index.d.ts +2 -2
  49. package/dist/index.js +12 -11
  50. package/dist/internals.d.ts +1 -1
  51. package/dist/internals.js +5 -4
  52. package/dist/mcp/index.d.ts +3 -2
  53. package/dist/mcp/index.js +5 -387
  54. package/dist/postgres/index.d.ts +25 -8
  55. package/dist/postgres/index.js +17 -8
  56. package/dist/project/config.d.ts +110 -72
  57. package/dist/project/config.js +161 -45
  58. package/dist/project/index.d.ts +17 -4
  59. package/dist/project/index.js +44 -9
  60. package/dist/projection.d.ts +14 -13
  61. package/dist/projection.js +8 -32
  62. package/dist/schemas.d.ts +1 -1
  63. package/dist/schemas.js +2 -2
  64. package/dist/standard-failures.d.ts +2 -89
  65. package/dist/tooling/cli.js +149 -105
  66. package/dist/tooling/testing.js +2 -2
  67. package/dist/vite/cloudflare-workers.js +25 -0
  68. package/dist/vite/index.d.ts +157 -0
  69. package/dist/vite/index.js +1477 -0
  70. package/dist/webhooks.d.ts +12 -10
  71. package/dist/webhooks.js +26 -12
  72. package/dist/workers/runtime.d.ts +1 -1
  73. package/dist/workers/runtime.js +1 -1
  74. package/package.json +26 -22
  75. package/skills/maximus/SKILL.md +165 -68
  76. package/skills/maximus/references/deploying.md +73 -0
  77. package/skills/maximus/references/errors-and-results.md +114 -55
  78. package/skills/maximus/references/project.md +202 -0
  79. package/skills/maximus/references/routes-and-tools.md +256 -0
  80. package/skills/maximus/references/testing.md +137 -50
  81. package/skills/maximus/references/transports.md +113 -100
  82. package/skills/maximus/references/writing-code.md +84 -0
  83. package/templates/mcp/mcp/instructions.md.template +2 -0
  84. package/templates/mcp/routes/v1/greeting.get.ts.template +12 -0
  85. package/templates/mcp/tests/mcp.test.ts.template +36 -0
  86. package/templates/project/.agents/skills/project/SKILL.md.template +21 -12
  87. package/templates/project/.github/workflows/ci.yml.template +4 -1
  88. package/templates/project/CLAUDE.md.template +41 -25
  89. package/templates/project/README.md.template +54 -48
  90. package/templates/project/middleware/10-response.ts.template +5 -2
  91. package/templates/project/package.json.template +13 -9
  92. package/templates/project/pages/index.ts.template +2 -4
  93. package/templates/project/routes/v1/greeting.get.ts.template +10 -0
  94. package/templates/project/routes/v1/greeting.post.ts.template +12 -0
  95. package/templates/project/tests/greeting.test.ts.template +45 -0
  96. package/templates/project/tsconfig.json.template +8 -6
  97. package/templates/project/vite.config.ts.template +15 -7
  98. package/templates/web/app/main.tsx.template +16 -0
  99. package/templates/web/app/root.tsx.template +17 -0
  100. package/templates/web/app/routes/index.tsx.template +9 -0
  101. package/templates/web/index.html.template +12 -0
  102. package/templates/web/package.json.template +12 -0
  103. package/templates/web/tsconfig.json.template +7 -0
  104. package/templates/web/vite.config.ts.template +22 -0
  105. package/dist/chunks/builder-BiXv7d2v.js +0 -100
  106. package/dist/chunks/define-app-DvD_1jUE.js +0 -625
  107. package/dist/chunks/prepare-project-CMyGSEtI.js +0 -236
  108. package/dist/chunks/prepare-project-MtS0-W_n.js +0 -3
  109. package/dist/chunks/record-DY-lX9w1.js +0 -34
  110. package/dist/chunks/src-N3oyx5QF.js +0 -1091
  111. package/dist/client/client.d.ts +0 -129
  112. package/dist/client/client.js +0 -321
  113. package/dist/tooling/vite.d.ts +0 -3
  114. package/dist/tooling/vite.js +0 -57
  115. package/skills/maximus/references/adding-an-operation.md +0 -179
  116. package/skills/maximus/references/building-a-service.md +0 -167
  117. package/skills/maximus/references/migration-from-v2.md +0 -62
  118. package/skills/maximus/references/migration-to-v5.md +0 -37
  119. package/skills/maximus/references/publishing-and-verification.md +0 -42
  120. package/templates/project/cloudflare.config.ts.template +0 -24
  121. package/templates/project/maximus.config.ts.template +0 -20
  122. package/templates/project/routes/v1/greeting.ts.template +0 -38
  123. package/templates/service/.agents/skills/project/SKILL.md.template +0 -10
  124. package/templates/service/.github/workflows/ci.yml.template +0 -21
  125. package/templates/service/.gitignore.template +0 -9
  126. package/templates/service/CLAUDE.md.template +0 -5
  127. package/templates/service/README.md.template +0 -45
  128. package/templates/service/cloudflare.config.ts.template +0 -30
  129. package/templates/service/package.json.template +0 -36
  130. package/templates/service/src/app.ts.template +0 -30
  131. package/templates/service/src/index.ts.template +0 -13
  132. package/templates/service/tests/contract.test.ts.template +0 -12
  133. package/templates/service/tsconfig.json.template +0 -16
  134. package/templates/service/vite.config.ts.template +0 -13
  135. package/templates/service/vitest.config.ts.template +0 -10
@@ -1,4 +1,4 @@
1
- import { Rn as Failure, kn as Result } from "./chunks/types-DQdfRF3f.js";
1
+ import { Qn as Result, ur as Failure } from "./chunks/types-BQYB4Ads.js";
2
2
  /** Why a webhook signature was refused: absent, malformed, outside the time tolerance, or not matching. */
3
3
  export declare const WEBHOOK_SIGNATURE_FAILURES: readonly ['missing', 'malformed', 'expired', 'mismatch'];
4
4
  /** Why a webhook signature was refused. */
@@ -23,8 +23,9 @@ export declare const DEFAULT_TOLERANCE_SECONDS = 300;
23
23
  */
24
24
  export declare const MAX_SIGNATURES = 8;
25
25
  /**
26
- * Verify an HMAC-SHA256 of the raw body. `signature` is the header value,
27
- * optionally with a scheme prefix such as `sha256=` (removed with `prefix`).
26
+ * Verifies an HMAC-SHA256 of the raw body. `signature` is the header value, hex or base64 as `encoding`
27
+ * says, optionally with a scheme prefix such as `sha256=` (removed with `prefix`). An absent signature fails
28
+ * as `missing`, one that does not decode as `malformed`, and one that does not match as `mismatch`.
28
29
  */
29
30
  export declare function verifyHmacSignature(options: {
30
31
  body: string | Uint8Array;
@@ -34,9 +35,10 @@ export declare function verifyHmacSignature(options: {
34
35
  signature: string | null | undefined;
35
36
  }): Promise<Result<null, WebhookSignatureFailure>>;
36
37
  /**
37
- * Verify a `t=<unix seconds>,v0=<hex>` header (several `v0`/`v1` values may be
38
- * present during secret rotation, up to {@link MAX_SIGNATURES}; one match is
39
- * enough) signing `<t>.<body>`.
38
+ * Verifies a `t=<unix seconds>,<label>=<hex>` header, an HMAC-SHA256 of `<t>.<body>`. Every hex signature
39
+ * under one of `labels` is tried, up to {@link MAX_SIGNATURES} (a provider rotating its secret sends several;
40
+ * one match is enough), and the timestamp must be within `toleranceSeconds` (300 by default) of `now`, in
41
+ * milliseconds, in either direction. Answers the signed timestamp.
40
42
  */
41
43
  export declare function verifyTimestampedSignature(options: {
42
44
  body: string | Uint8Array;
@@ -50,10 +52,10 @@ export declare function verifyTimestampedSignature(options: {
50
52
  timestamp: number;
51
53
  }, WebhookSignatureFailure>>;
52
54
  /**
53
- * Verify a Standard Webhooks delivery. The secret is the provider's
54
- * `whsec_<base64>` value (the prefix is optional), and the signature header may
55
- * list up to {@link MAX_SIGNATURES} signatures. Returns the message id, the
56
- * idempotency key of the delivery, and its timestamp.
55
+ * Verifies a Standard Webhooks delivery. The secret is the provider's `whsec_<base64>` value (the prefix is
56
+ * optional), the signature header may list up to {@link MAX_SIGNATURES} `v1` signatures, and the timestamp
57
+ * must be within `toleranceSeconds` (300 by default) of `now`, in either direction. Answers the message id,
58
+ * which is the delivery's idempotency key, and its timestamp.
57
59
  */
58
60
  export declare function verifyStandardWebhook(options: {
59
61
  body: string | Uint8Array;
package/dist/webhooks.js CHANGED
@@ -60,6 +60,14 @@ function fromBase64(value) {
60
60
  return null;
61
61
  }
62
62
  }
63
+ /**
64
+ * The secret a verifier was given. A missing or empty one is a configuration error, such as a secret binding
65
+ * the deployment lacks, never a refusal: anyone could sign with it, so no verifier runs without one.
66
+ */
67
+ function requireSecret(secret) {
68
+ if (typeof secret !== "string" && !(secret instanceof Uint8Array) || secret.length === 0) throw new TypeError("A webhook secret is required; check the binding that holds it.");
69
+ return secret;
70
+ }
63
71
  /** An HMAC-SHA256 key that can only verify. */
64
72
  async function hmacKey(secret) {
65
73
  return await crypto.subtle.importKey("raw", secret, {
@@ -77,25 +85,29 @@ const failure = (reason) => ({
77
85
  error: webhookSignatureFailure(reason)
78
86
  });
79
87
  /**
80
- * Verify an HMAC-SHA256 of the raw body. `signature` is the header value,
81
- * optionally with a scheme prefix such as `sha256=` (removed with `prefix`).
88
+ * Verifies an HMAC-SHA256 of the raw body. `signature` is the header value, hex or base64 as `encoding`
89
+ * says, optionally with a scheme prefix such as `sha256=` (removed with `prefix`). An absent signature fails
90
+ * as `missing`, one that does not decode as `malformed`, and one that does not match as `mismatch`.
82
91
  */
83
92
  async function verifyHmacSignature(options) {
93
+ const secret = requireSecret(options.secret);
84
94
  if (!options.signature) return failure("missing");
85
95
  const value = options.prefix && options.signature.startsWith(options.prefix) ? options.signature.slice(options.prefix.length) : options.signature;
86
96
  const signature = options.encoding === "hex" ? fromHex(value.trim()) : fromBase64(value.trim());
87
97
  if (!signature) return failure("malformed");
88
- return await crypto.subtle.verify("HMAC", await hmacKey(bytes(options.secret)), signature, bytes(options.body)) ? {
98
+ return await crypto.subtle.verify("HMAC", await hmacKey(bytes(secret)), signature, bytes(options.body)) ? {
89
99
  ok: true,
90
100
  value: null
91
101
  } : failure("mismatch");
92
102
  }
93
103
  /**
94
- * Verify a `t=<unix seconds>,v0=<hex>` header (several `v0`/`v1` values may be
95
- * present during secret rotation, up to {@link MAX_SIGNATURES}; one match is
96
- * enough) signing `<t>.<body>`.
104
+ * Verifies a `t=<unix seconds>,<label>=<hex>` header, an HMAC-SHA256 of `<t>.<body>`. Every hex signature
105
+ * under one of `labels` is tried, up to {@link MAX_SIGNATURES} (a provider rotating its secret sends several;
106
+ * one match is enough), and the timestamp must be within `toleranceSeconds` (300 by default) of `now`, in
107
+ * milliseconds, in either direction. Answers the signed timestamp.
97
108
  */
98
109
  async function verifyTimestampedSignature(options) {
110
+ const secret = requireSecret(options.secret);
99
111
  if (!options.header) return failure("missing");
100
112
  let timestamp = null;
101
113
  const signatures = [];
@@ -113,7 +125,7 @@ async function verifyTimestampedSignature(options) {
113
125
  if (timestamp === null || signatures.length === 0 || signatures.length > 8) return failure("malformed");
114
126
  const now = options.now?.() ?? Date.now();
115
127
  if (!withinTolerance(timestamp, options.toleranceSeconds ?? 300, now)) return failure("expired");
116
- const key = await hmacKey(bytes(options.secret));
128
+ const key = await hmacKey(bytes(secret));
117
129
  const message = concat(encoder.encode(`${timestamp}.`), bytes(options.body));
118
130
  for (const signature of signatures) if (await crypto.subtle.verify("HMAC", key, signature, message)) return {
119
131
  ok: true,
@@ -122,12 +134,14 @@ async function verifyTimestampedSignature(options) {
122
134
  return failure("mismatch");
123
135
  }
124
136
  /**
125
- * Verify a Standard Webhooks delivery. The secret is the provider's
126
- * `whsec_<base64>` value (the prefix is optional), and the signature header may
127
- * list up to {@link MAX_SIGNATURES} signatures. Returns the message id, the
128
- * idempotency key of the delivery, and its timestamp.
137
+ * Verifies a Standard Webhooks delivery. The secret is the provider's `whsec_<base64>` value (the prefix is
138
+ * optional), the signature header may list up to {@link MAX_SIGNATURES} `v1` signatures, and the timestamp
139
+ * must be within `toleranceSeconds` (300 by default) of `now`, in either direction. Answers the message id,
140
+ * which is the delivery's idempotency key, and its timestamp.
129
141
  */
130
142
  async function verifyStandardWebhook(options) {
143
+ const given = requireSecret(options.secret);
144
+ const encoded = requireSecret(given.startsWith("whsec_") ? given.slice(6) : given);
131
145
  /** A Standard Webhooks header, or its `svix-` spelling. */
132
146
  const header = (name) => options.headers.get(`webhook-${name}`) ?? options.headers.get(`svix-${name}`);
133
147
  const id = header("id");
@@ -138,7 +152,7 @@ async function verifyStandardWebhook(options) {
138
152
  const timestamp = Number(timestampValue);
139
153
  const now = options.now?.() ?? Date.now();
140
154
  if (!withinTolerance(timestamp, options.toleranceSeconds ?? 300, now)) return failure("expired");
141
- const secret = fromBase64(options.secret.startsWith("whsec_") ? options.secret.slice(6) : options.secret);
155
+ const secret = fromBase64(encoded);
142
156
  if (!secret) return failure("malformed");
143
157
  const signatures = signatureValue.split(" ").flatMap((entry) => {
144
158
  const [version, value] = entry.split(",", 2);
@@ -1,2 +1,2 @@
1
- import { a as credentials, i as createWorker, n as WorkerOptions, o as WorkerAssetsOptions, r as WorkerRuntime, t as RpcMethods } from "../chunks/types-DQdfRF3f.js";
1
+ import { a as credentials, i as createWorker, n as WorkerOptions, o as WorkerAssetsOptions, r as WorkerRuntime, t as RpcMethods } from "../chunks/workers-types-iONp32T4.js";
2
2
  export { RpcMethods, type WorkerAssetsOptions, WorkerOptions, WorkerRuntime, createWorker, credentials };
@@ -1,3 +1,3 @@
1
- import { n as credentials, t as createWorker } from "../chunks/runtime-DlqA7J38.js";
1
+ import { n as credentials, t as createWorker } from "../chunks/runtime-CVVf5hmp.js";
2
2
 
3
3
  export { createWorker, credentials };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@arbol-ai/maximus",
3
- "version": "7.4.0",
4
- "description": "Maximus: define a service once and serve it over HTTP, MCP and Worker RPC on Cloudflare Workers, with its OpenAPI, typed client and CLI.",
3
+ "version": "8.0.0",
4
+ "description": "Maximus: define a service once and serve it over HTTP, MCP and Worker RPC on Cloudflare Workers, configured in vite.config.ts, with its OpenAPI and CLI.",
5
5
  "keywords": [
6
6
  "api",
7
7
  "cloudflare",
@@ -12,7 +12,10 @@
12
12
  "multi-tenant",
13
13
  "openapi",
14
14
  "rpc",
15
- "typebox"
15
+ "typebox",
16
+ "vite",
17
+ "vite-plugin",
18
+ "vite-plus"
16
19
  ],
17
20
  "homepage": "https://github.com/getarbol/maximus#readme",
18
21
  "bugs": {
@@ -26,9 +29,10 @@
26
29
  "directory": "packages/maximus"
27
30
  },
28
31
  "bin": {
29
- "maximus": "dist/tooling/cli.js"
32
+ "maximus": "bin/maximus.js"
30
33
  },
31
34
  "files": [
35
+ "bin",
32
36
  "dist",
33
37
  "config",
34
38
  "templates",
@@ -87,10 +91,6 @@
87
91
  "types": "./dist/mcp/index.d.ts",
88
92
  "import": "./dist/mcp/index.js"
89
93
  },
90
- "./client": {
91
- "types": "./dist/client/client.d.ts",
92
- "import": "./dist/client/client.js"
93
- },
94
94
  "./analytics": {
95
95
  "types": "./dist/analytics/analytics.d.ts",
96
96
  "import": "./dist/analytics/analytics.js"
@@ -116,8 +116,8 @@
116
116
  "import": "./dist/project/index.js"
117
117
  },
118
118
  "./vite": {
119
- "types": "./dist/tooling/vite.d.ts",
120
- "import": "./dist/tooling/vite.js"
119
+ "types": "./dist/vite/index.d.ts",
120
+ "import": "./dist/vite/index.js"
121
121
  },
122
122
  "./config": {
123
123
  "types": "./dist/project/config.d.ts",
@@ -128,35 +128,39 @@
128
128
  "access": "public",
129
129
  "registry": "https://registry.npmjs.org/"
130
130
  },
131
- "scripts": {
132
- "typecheck": "tsc --noEmit",
133
- "build": "vp pack",
134
- "test": "vp test run --exclude \"**/*.integration.test.ts\"",
135
- "test:integration": "vp test run --config vitest.integration.config.ts"
136
- },
137
131
  "dependencies": {
138
- "@modelcontextprotocol/server": "2.3.1",
132
+ "@modelcontextprotocol/server": "2.4.0",
139
133
  "@sinclair/typebox": "0.34.52",
140
134
  "ajv-formats": "3.0.1",
141
- "jose": "6.2.12",
142
- "yaml": "2.9.1"
135
+ "jose": "6.2.13"
143
136
  },
144
137
  "devDependencies": {
138
+ "@cloudflare/vite-plugin": "2.0.0-beta.v.5",
145
139
  "@types/pg": "8.23.1",
146
140
  "ajv": "8.20.0",
147
- "miniflare": "5.20261012.1-beta",
141
+ "cf": "1.0.0-beta.23",
142
+ "miniflare": "5.20261023.0-beta",
148
143
  "pg": "8.23.1",
149
144
  "vite": "npm:@voidzero-dev/vite-plus-core@1.4.0",
150
- "vite-plus": "1.4.0"
145
+ "vite-plus": "1.4.0",
146
+ "yaml": "2.9.1"
151
147
  },
152
148
  "peerDependencies": {
149
+ "@cloudflare/vite-plugin": ">=2.0.0-beta.v.5",
150
+ "cf": ">=1.0.0-beta.23",
153
151
  "oxfmt": ">=0.71.0 <1",
154
152
  "oxlint": "^1.86.0",
155
153
  "pg": "^8.23.1",
156
- "ultracite": "^8.0.0",
154
+ "ultracite": "^8.1.0",
157
155
  "vite": "^8.3.4"
158
156
  },
159
157
  "peerDependenciesMeta": {
158
+ "@cloudflare/vite-plugin": {
159
+ "optional": true
160
+ },
161
+ "cf": {
162
+ "optional": true
163
+ },
160
164
  "oxfmt": {
161
165
  "optional": true
162
166
  },
@@ -1,88 +1,185 @@
1
1
  ---
2
2
  name: maximus
3
- description: Build, extend, test, migrate and release services with the Maximus framework (@arbol-ai/maximus*), which declares schema-first, organization-scoped operations once and serves them over HTTP/OpenAPI, MCP and Cloudflare Worker RPC. Use when code imports @arbol-ai/maximus or a task involves Maximus operations, scopes, error catalogs, derive/use middleware, MCP tools, RPC entrypoints, OpenAPI documents or the maximus CLI.
3
+ description: Build, extend, test, upgrade and deploy services with the Maximus framework (@arbol-ai/maximus, whose /vite entry configures a project), organization-scoped APIs on Cloudflare Workers whose route files declare each contract once and are served over HTTP with OpenAPI, as MCP tools and over Worker RPC. Use when a project configures maximus() in vite.config.ts or imports @arbol-ai/maximus, or a task involves Maximus routes, MCP tools, scopes, error catalogs, context.ts, middleware, bindings, Worker RPC, OpenAPI, tests, the maximus CLI or deploying with cf.
4
4
  ---
5
5
 
6
6
  # Maximus
7
7
 
8
- Maximus services declare each operation once (schemas, scope, effect, exposure, handler) on one
9
- fluent application. Each transport admits the caller its own way, then every call runs the same
10
- pipeline: input decoding, preparation, middleware, handler, output validation. Work with that
11
- pipeline, never around it.
8
+ A Maximus service is a project. `vite.config.ts` configures it with `maximus()` from `@arbol-ai/maximus/vite`,
9
+ and its files declare the rest. A route file declares one operation, its handler and its contract; Maximus
10
+ serves it over HTTP with an OpenAPI document, as an MCP tool when the contract names one, and over native
11
+ RPC when the contract says so. Each transport admits its caller (an access token holding the operation's
12
+ scope, or a Service Binding the service trusts), then every call runs one pipeline: input decoding,
13
+ `context.ts`, middleware, the handler, the output check. Work with that pipeline, never around it.
14
+
15
+ ## The project
16
+
17
+ ```text
18
+ vite.config.ts maximus(): origin, tokens.issuer, env (bindings), compatibilityDate, Worker settings
19
+ routes/v1/notes/[noteId].get.ts GET /api/v1/notes/{noteId}: export default defineHandler(handler, contract)
20
+ mcp/tools/summarize-notes.ts The MCP tool summarize_notes: export default defineTool(handler, contract)
21
+ mcp/instructions.md What MCP clients read when they connect; mcp/guides/ and mcp/skills/ too
22
+ context.ts export default defineContext(({ env, principal }) => ({ … }))
23
+ errors.ts export default defineErrors({ … }): the service's own failure codes
24
+ auth.ts export default defineAuth({ resolve }): tokens the service verifies itself
25
+ telemetry.ts export default defineTelemetry({ observers }): observers such as analytics()
26
+ middleware/ defineMiddleware (before admission) or defineOperationMiddleware (after it)
27
+ pages/ crons/ queues/ email/ Public pages and webhooks (pages/webhooks/x.post.ts), event handlers
28
+ durable-objects/ Durable Object classes, one per file
29
+ src/ Domain code: schemas, stores, clients of other services
30
+ tests/ vp test suites that call handler from #maximus/http in Node
31
+ .maximus/ Generated by maximus prepare: never edit it, never commit it
32
+ ```
33
+
34
+ Every file but `vite.config.ts` is optional. [references/project.md](references/project.md) describes
35
+ each one.
12
36
 
13
37
  ## Workflow
14
38
 
15
- 1. **Read the service first.** For a project layout, start with `maximus.config.ts` and the project-structure guide; `src/` is optional and routes/middleware are discovered. For explicit composition, find `maximus<Env>(…)` (usually `src/application.ts`), the resource
16
- modules (`src/api/<resource>/operations.ts`), the composition (`src/app.ts`) and the Worker
17
- (`src/index.ts`). Keep the project's existing folders and named domain functions.
18
- 2. **Declare, don't wire.** Add an operation to its resource module with strict schemas, a namespaced
19
- scope, a truthful effect and only the transports it needs (`http`, `mcp`, `rpc`). Project routes are discovered; explicit service layouts mount modules in `app.ts`. See `references/adding-an-operation.md`.
20
- 3. **Return Results.** Expected failures are `err(catalog.x.create())` from the application's own
21
- catalog; throw only for the unexpected. See `references/errors-and-results.md`.
22
- 4. **Prepare context with `.derive()`** in the group that needs it, and wrap with `.use()` only for
23
- cross-cutting behavior after authorization.
24
- 5. **Verify** with the project's typecheck, lint and Vite+ build, then a dry-run deploy. Run tests only on an explicit human request. Use
25
- `cf deploy --prebuilt --mode production --dry-run`. See `references/testing.md` and
26
- `references/publishing-and-verification.md`.
39
+ 1. **Read before you write.** Read `vite.config.ts`, `errors.ts`, `context.ts`, the route closest to the
40
+ task and its tests. Keep the project's folders and its named domain functions.
41
+ 2. **Generate, then fill in.** `bunx maximus gen route <method> <path>` writes a route file, a tool too with
42
+ `--tool <snake_name>`; `bunx maximus gen tool <kebab-name>` writes a tool only agents call. Replace the
43
+ placeholder handler and description, and declare strict `input` and `output` schemas and the
44
+ `failures`. Declare `scope`, `effect` or `operationId` only where the derived one is wrong. See
45
+ [references/routes-and-tools.md](references/routes-and-tools.md).
46
+ 3. **Write it to be read.** A handler is a few statements that call named functions of `src/`, imported as
47
+ `#src/<module>.ts`; names are whole English words. See
48
+ [references/writing-code.md](references/writing-code.md).
49
+ 4. **Scope by organization in the context.** What every handler needs, such as a store, belongs in
50
+ `context.ts`, built from `principal.organizationId`.
51
+ 5. **Answer failures from the catalog.** `fail(code)` with a code of `errors.ts`, listed in the route's
52
+ `failures`; throw only for what should never happen. See
53
+ [references/errors-and-results.md](references/errors-and-results.md).
54
+ 6. **Declare bindings in `maximus()`.** `env: { NOTES: bindings.kv() }`, with `bindings` from `cf/config`,
55
+ and another Worker's RPC methods in `services`; the generated `Env` types them.
56
+ 7. **Test** each route in `tests/` through `handler` from `#maximus/http`: its answer, its refusals and that
57
+ one organization never reaches another's data. See [references/testing.md](references/testing.md).
58
+ 8. **Verify** with `bun run verify` before you finish.
59
+
60
+ ## Commands
61
+
62
+ | Command | Does |
63
+ | --------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------- |
64
+ | `bun run dev` | `vp dev`: the Worker in workerd at `http://localhost:5173`. The development token in `.dev.vars` signs in from localhost. |
65
+ | `bunx maximus gen route get /v1/notes/{noteId} --tool get_note` | Writes `routes/v1/notes/[noteId].get.ts`, which is also the MCP tool `get_note`. |
66
+ | `bunx maximus gen tool summarize-notes` | Writes `mcp/tools/summarize-notes.ts`, the tool `summarize_notes`. |
67
+ | `bunx maximus prepare` | Writes `.maximus/` for production, or with `--mode development` as `vp dev` does. `vp dev`, `vp build` and `vp test` prepare by themselves. |
68
+ | `bunx maximus openapi` | Writes `openapi.json`, and `openapi.rpc.json` when a route declares `rpc`; `--check` fails when they differ from the routes. |
69
+ | `bun run test` | `vp test run`: the tests, in Node. |
70
+ | `bun run typecheck` | `maximus prepare`, then `tsc`, which also checks type tests. |
71
+ | `bun run check`, `bun run fix` | Lint and format; with fixes. |
72
+ | `bun run verify` | Types, lint and format, tests and the build. CI runs it. |
73
+ | `bun run deploy` | `bun run verify`, then `cf deploy --prebuilt --mode production`. |
74
+ | `bunx maximus skills` | Links this skill into the project's `.agents/skills`, `.claude/skills` and `.codex/skills`. |
75
+
76
+ Every `maximus` command says what it did in a sentence; `--json` prints it as JSON instead.
27
77
 
28
78
  ## Decisions
29
79
 
30
- | Question | Choose |
31
- | --- | --- |
32
- | Who calls it? People or external services over the network | `http` (and `mcp` for agents) with OAuth tokens |
33
- | Another Worker in the same account, trusted deployment | `rpc` with `rpc.callers`; see `references/transports.md` |
34
- | Documents that list only the failures it can answer | `failures` (its domain codes); any other becomes `INTERNAL_ERROR`; see `references/adding-an-operation.md` |
35
- | A gateway in front of the service, forwarding each caller's own token | Nothing special: list its audience in `tokens.audience` after the service's own; it calls the origin's own routes |
36
- | Staff operations hidden from documents and clients | `visibility: 'internal'`: still routed and decided by scope on the origin |
37
- | Verifying a provider webhook | `@arbol-ai/maximus/webhooks` on the raw body, in a plain route |
38
- | Callers without bearer tokens (webhooks, signed links) | A plain route that verifies its own signature |
39
- | Tokens that are not organization-bound OAuth access tokens | `tokens.resolve`, verifying cryptographically |
40
- | SDKs or a catalog generated from the contract | The origin's `/openapi.json`, or `createOpenApi(app)` at build time; see `references/transports.md` |
41
- | A new service from scratch | `references/building-a-service.md`; `maximus init --layout project` adds optional file conventions |
42
- | Upgrading from 4.x | `references/migration-to-v5.md` |
43
- | Upgrading from 2.x | `references/migration-from-v2.md` |
80
+ | Need | Choose |
81
+ | ----------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
82
+ | An endpoint for people and services | A route file. Every route is served over HTTP. |
83
+ | The same endpoint for agents | `mcp: { name: 'get_note' }` in its contract, which then needs a `description`. |
84
+ | A capability only agents call | A file of `mcp/tools/` with `defineTool`, which needs a `description` and an `effect`. |
85
+ | Another Worker of the account calls it | `rpc: true` in its contract and the caller's name in `rpc.callers`; commit the `openapi.rpc.json` that `bunx maximus openapi` writes. See [references/transports.md](references/transports.md). |
86
+ | Call another Worker of the account | `services: { PRICING: { worker: 'example-pricing', openapi: '../pricing/openapi.rpc.json' } }` in `maximus()`; import its types from `#maximus/services/pricing`. |
87
+ | Out of the public OpenAPI document | `visibility: 'internal'`: still routed, still checked against its scope. |
88
+ | Setup every call needs: stores, clients | `context.ts`. |
89
+ | A rule for every operation, on every transport | `defineOperationMiddleware` in `middleware/`. |
90
+ | Headers or an early answer around every request | `defineMiddleware` in `middleware/`. It runs before admission and sees no principal. |
91
+ | 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). |
92
+ | An application behind Cloudflare Access | `tokens: cloudflareAccess({ team, aud, organizationId, scopes })` from `@arbol-ai/maximus/vite`. It serves no MCP and no OAuth discovery. See [references/project.md](references/project.md#tokens). |
93
+ | Tokens your authorization server does not issue | `auth.ts` with `defineAuth({ resolve })`, which verifies cryptographically. |
94
+ | 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). |
95
+ | Many items in one answer | `output: Page(Item, { $id: 'ItemPage' })` with `input: PageQueryFields`. |
96
+ | A file upload or download | `http: { body: 'bytes' }` with `body.read()`; `output: AttachmentOutputSchema` with `http: { response: 'attachment' }`. |
97
+ | Data in Postgres | `withTenantTransaction` from `@arbol-ai/maximus/postgres`. |
98
+ | Guidance agents read over MCP | `mcp/instructions.md`, `mcp/guides/<name>.md`, `mcp/skills/<name>.md`: static text for every caller, never tenant data. |
99
+ | A 7.x service | [Upgrading to 8.0](https://github.com/getarbol/maximus/blob/main/docs/upgrading-to-8.md). |
44
100
 
45
101
  ## Rules that are never broken
46
102
 
47
- - **Tenancy:** every tenant query uses `context.principal.organizationId`. Never take an
48
- organization from input, a header or a path.
49
- - **Strict schemas:** inputs and outputs are `t.Object({...}, { additionalProperties: false })` or
50
- unions of such objects; a GET input is one object, each field read from the query string as its
51
- kind (integer, number, boolean, comma-separated string list, otherwise string).
52
- - **Validation ownership:** the framework validates operation input and output once. Do not re-parse
53
- inputs in handlers or helpers; do validate provider responses, stored records and model output with
54
- `checkSchema`/`readSchema`. No casts, trust flags or no-op validators.
55
- - **Codecs need `inputSchema()`:** an input using `normalizeSchema`, `refineSchema`,
56
- `transformSchema`, `inspectSchema`, `pipeSchema` or `stripObject` must be wrapped in
57
- `inputSchema(...)`; `.build()` refuses it otherwise, because a plain decode would skip the codecs.
58
- - **Authorization is scopes plus your checks:** effects, `visibility: 'internal'`, descriptions and
59
- MCP annotations never authorize. Ordinary RPC checks no scopes.
60
- - **Failures are honest:** an outage is a failure, never an empty success. A write whose outcome is
61
- lost answers `OUTCOME_UNKNOWN` and is reconciled, never retried blindly.
62
- - **Outbound calls:** in a Worker, `fetch(..., { redirect: 'error' })` throws before any request
63
- (only `follow` and `manual` exist). Send credentials with `redirect: 'manual'` and refuse a `3xx`.
64
- - **Privacy:** never log or return request bodies, credentials or submitted values in failure
65
- `data`, refinement messages, MCP skills or examples. Skills and guides hold no tenant data.
66
- - **Collections are pages:** an operation that returns many items answers `Page(Item, { $id })` with
67
- `PageQueryFields`; one that reads, creates or updates an item answers the named entity (the list's
68
- item); a delete answers `DeletedObjectSchema`. Use the shared schemas (`UuidSchema`,
69
- `EmailAddressSchema`, …) instead of local copies.
70
- - **Construction errors are guidance:** `.build()` throws a `TypeError` stating the rule (usually with
71
- the operation's name); fix the definition rather than loosening checks.
103
+ - **The organization comes from the principal.** Every store, key, query and Durable Object name starts from
104
+ `principal.organizationId`. Never take an organization from input, a header or a path.
105
+ - **Schemas are strict.** Inputs and outputs are strict objects or unions of strict objects: fields given as
106
+ `input: { … }` make one; a `t.Object` needs `{ additionalProperties: false }`. A shared entity has a
107
+ PascalCase `$id`. Use the shared schemas (`UuidSchema`, `EmailAddressSchema`, …) rather than copies.
108
+ - **Each value is checked once, where it enters.** Maximus checks an operation's input and output; a handler
109
+ never parses its input again. Data from outside the pipeline, such as a stored record, a provider's
110
+ answer or a model's output, goes through `readSchema` or `checkSchema`. No casts, trust flags or no-op
111
+ validators in their place.
112
+ - **Failures are declared and honest.** Answer `fail(code)` with a code of `errors.ts`, listed in
113
+ `failures`; the standard failures need no listing. An outage is a failure, never an empty success. A
114
+ write whose outcome is lost answers `OUTCOME_UNKNOWN` and is reconciled, never retried blindly.
115
+ - **Exposure is explicit.** A route is a tool only with `mcp` and an RPC method only with `rpc`. Effects,
116
+ `visibility`, descriptions and MCP hints never authorize: scopes and your own checks do.
117
+ - **No private data in logs or errors.** Request bodies, input values, credentials, tokens, personal or
118
+ clinical data never go in a log line, a failure's `data` or message, a refinement message, an MCP guide or
119
+ skill, or an example. Report a caught error with `reportUnexpected(error, surface)`, which keeps its name
120
+ and drops its message.
121
+ - **Worker code reads `env`, never `process.env`.** A secret is `bindings.secret()`. The development token is
122
+ never declared in `env` and never set on a deployed Worker.
123
+ - **Outbound calls:** a Worker's `fetch(…, { redirect: 'error' })` throws before it sends anything. Send with
124
+ `redirect: 'manual'` and refuse a `3xx`.
125
+ - **Generated code stays generated.** Never edit `.maximus/`: change the source files or `vite.config.ts`.
126
+ - **Refusals are guidance.** `maximus prepare`, `maximus()` and the application's `.build()` refuse a broken
127
+ project with a message that names the rule and the file or operation. Fix the declaration; never loosen
128
+ the check.
72
129
 
73
130
  ## References
74
131
 
75
- Load the one that matches the task:
132
+ Load the one the task needs:
133
+
134
+ - [references/project.md](references/project.md): `vite.config.ts`, tokens from Auth0 or Cloudflare Access,
135
+ the root modules, bindings and `Env`, the development token, what `prepare` generates, pages, background
136
+ work, Durable Objects and web apps.
137
+ - [references/routes-and-tools.md](references/routes-and-tools.md): file names and what they derive, every
138
+ contract field, input, schemas and codecs, lists, byte bodies, tools, context and middleware.
139
+ - [references/errors-and-results.md](references/errors-and-results.md): the catalog, `fail`, declared
140
+ failures, the standard failures, uncertain outcomes and other services' failures.
141
+ - [references/transports.md](references/transports.md): HTTP and OpenAPI, MCP, Worker RPC, and Workers
142
+ composed by hand.
143
+ - [references/testing.md](references/testing.md): tests in Node, stand-ins for bindings, MCP, RPC documents
144
+ and bindings, the contract check and suites against a running Worker.
145
+ - [references/deploying.md](references/deploying.md): the origin and the issuer, secrets, resources,
146
+ `bun run deploy`, the CI workflow and checking a deployment.
147
+ - [references/writing-code.md](references/writing-code.md): the house style for every file you write:
148
+ handlers as statements, `#src/` imports, names, comments, failures and tests.
149
+
150
+ ## Documentation
151
+
152
+ The documentation is in the Maximus repository, indexed by
153
+ [docs/README.md](https://github.com/getarbol/maximus/blob/main/docs/README.md):
76
154
 
77
- - `references/building-a-service.md`: project layout, configuration, tokens, Worker, local run.
78
- - `references/adding-an-operation.md`: every definition field, routes, schemas, codecs, middleware.
79
- - `references/transports.md`: HTTP and OpenAPI, MCP, native RPC, plain routes and Worker composition.
80
- - `references/errors-and-results.md`: catalogs, standard failures, presentation, uncertain outcomes.
81
- - `references/testing.md`: handler tests, the `verify` seam, MCP, `executeOperation`, RPC types.
82
- - `references/migration-to-v5.md`: what 5.0 removed and what to change.
83
- - `references/migration-from-v2.md`: 3.0.0 breaking changes and classifying older services.
84
- - `references/publishing-and-verification.md`: `maximus init`, deploying, verifying a deployment and
85
- releasing Maximus itself.
155
+ - [Getting started](https://github.com/getarbol/maximus/blob/main/docs/getting-started.md) and
156
+ [Concepts](https://github.com/getarbol/maximus/blob/main/docs/concepts.md).
157
+ - Build the API: [Write code people and agents read easily](https://github.com/getarbol/maximus/blob/main/docs/guides/writing-code.md),
158
+ [Project structure](https://github.com/getarbol/maximus/blob/main/docs/guides/project-structure.md),
159
+ [Routes](https://github.com/getarbol/maximus/blob/main/docs/guides/routes.md),
160
+ [Schemas and validation](https://github.com/getarbol/maximus/blob/main/docs/guides/schemas-and-validation.md),
161
+ [Errors and results](https://github.com/getarbol/maximus/blob/main/docs/guides/errors-and-results.md),
162
+ [Authentication and scopes](https://github.com/getarbol/maximus/blob/main/docs/guides/authentication-and-scopes.md),
163
+ [Context and middleware](https://github.com/getarbol/maximus/blob/main/docs/guides/middleware-and-context.md).
164
+ - Reach it: [MCP](https://github.com/getarbol/maximus/blob/main/docs/guides/mcp.md),
165
+ [Worker RPC](https://github.com/getarbol/maximus/blob/main/docs/guides/worker-rpc.md),
166
+ [Web apps](https://github.com/getarbol/maximus/blob/main/docs/guides/web-apps.md),
167
+ [Worker composition](https://github.com/getarbol/maximus/blob/main/docs/guides/worker-composition.md).
168
+ - Use the platform: [Bindings](https://github.com/getarbol/maximus/blob/main/docs/guides/bindings.md),
169
+ [Background work](https://github.com/getarbol/maximus/blob/main/docs/guides/background-work.md),
170
+ [Durable Objects](https://github.com/getarbol/maximus/blob/main/docs/guides/durable-objects.md),
171
+ [Postgres transactions](https://github.com/getarbol/maximus/blob/main/docs/guides/postgres.md).
172
+ - Ship it: [Testing](https://github.com/getarbol/maximus/blob/main/docs/guides/testing.md),
173
+ [Observability](https://github.com/getarbol/maximus/blob/main/docs/guides/observability.md),
174
+ [Deploying](https://github.com/getarbol/maximus/blob/main/docs/guides/deploying.md),
175
+ [Lint and format](https://github.com/getarbol/maximus/blob/main/docs/guides/lint-and-format.md).
176
+ - Reference: [Configuration](https://github.com/getarbol/maximus/blob/main/docs/reference/configuration.md),
177
+ [Route and operation options](https://github.com/getarbol/maximus/blob/main/docs/reference/operations.md),
178
+ [CLI](https://github.com/getarbol/maximus/blob/main/docs/reference/cli.md),
179
+ [Wire formats](https://github.com/getarbol/maximus/blob/main/docs/reference/wire-formats.md),
180
+ [Standard failures](https://github.com/getarbol/maximus/blob/main/docs/reference/standard-failures.md),
181
+ [Package exports](https://github.com/getarbol/maximus/blob/main/docs/reference/exports.md).
182
+ - Design: [Architecture](https://github.com/getarbol/maximus/blob/main/docs/architecture.md).
86
183
 
87
- The full documentation is in the Maximus repository under `docs/`; this skill ships in
88
- `@arbol-ai/maximus` at `skills/maximus/`.
184
+ This skill ships in `@arbol-ai/maximus`, at `skills/maximus/`; a project links the copy of the release it
185
+ installed.
@@ -0,0 +1,73 @@
1
+ # Deploying
2
+
3
+ ## Before the first deployment
4
+
5
+ - `origin`: the Worker's public HTTPS URL. A `workers.dev` origin,
6
+ `https://<name>.<subdomain>.workers.dev`, is served there; any other host becomes the Worker's custom
7
+ domain, in a zone of the same account, unless `domains` or a fetch trigger route the Worker. Tokens must
8
+ carry the origin as their audience unless `tokens.audience` says otherwise.
9
+ - `tokens.issuer`: the OAuth authorization server whose access tokens the deployed Worker accepts. It
10
+ accepts no development token.
11
+ - `bunx cf auth login` once on a machine; CI sets `CLOUDFLARE_API_TOKEN` and `CLOUDFLARE_ACCOUNT_ID`.
12
+
13
+ ## Deploy
14
+
15
+ ```sh
16
+ bun run deploy # bun run verify, then cf deploy --prebuilt --mode production
17
+ bun run deploy --tag "$(git rev-parse --short HEAD)" # records what the version is
18
+ bunx cf deploy --prebuilt --mode production --dry-run # checks the build and lists its bindings, uploads nothing
19
+ bun run preview # the production build, locally
20
+ ```
21
+
22
+ `vp build` writes the Build Output to `.cloudflare/output/`; `cf deploy --prebuilt` deploys it as it is.
23
+
24
+ ## Secrets
25
+
26
+ - Declare each one as `bindings.secret()` in `env`. Under `vp dev` its value comes from `.dev.vars`.
27
+ - The first deployment supplies every declared secret, from a file outside the repository (`NAME=value`
28
+ lines or JSON): `bun run deploy --secrets-file .env.production`. Without it, the deployment stops with
29
+ `The following required secrets have not been set`.
30
+ - Later deployments keep each value unless their secrets file brings a new one.
31
+ `bunx cf workers secrets update <NAME> --worker <name>` changes one alone, as a new version.
32
+ - Never put a secret in `bindings.text()`, code, the repository or a log. Never set `DEVELOPMENT_TOKEN` on a
33
+ deployed Worker; `maximus()` refuses to declare it.
34
+
35
+ ## Resources
36
+
37
+ - The deployment creates a KV namespace without an id, an R2 bucket and a queue by their names, the queue
38
+ consumers and cron triggers, the storage of each exported Durable Object class and the custom domain. It
39
+ does not write ids back into `vite.config.ts`.
40
+ - You create a D1 database and apply its migrations before deploying the Worker that reads them:
41
+ `bunx cf d1 create --name notes` prints the id the binding names, and
42
+ `bunx cf d1 migrations apply <database-id>` applies `migrations/*.sql` not yet applied.
43
+ - A Worker that another binds deploys first.
44
+ - A Durable Object class's name is its storage's: renaming or removing it is a migration declared in
45
+ `exports`.
46
+
47
+ ## CI
48
+
49
+ The starter's `.github/workflows/ci.yml` runs on every pull request, on every push to `main` and on demand:
50
+ it installs from the lockfile without install scripts, runs `bun run verify` and a deploy dry run, and on a
51
+ push to `main` deploys with the repository secrets `CLOUDFLARE_API_TOKEN` and `CLOUDFLARE_ACCOUNT_ID`, which
52
+ only that step receives. It passes no secrets file: deploy a Worker's first version, with its secrets, from a
53
+ machine.
54
+
55
+ ## Check the deployment
56
+
57
+ A suite over stand-ins proves nothing about a deployment, and a mock is never evidence of one. Check the
58
+ deployed Worker:
59
+
60
+ 1. `GET /health` answers `200` with the version you deployed.
61
+ 2. `/api/openapi.json` lists the operations you expect; `verifyContract(fetch, '<origin>/api')` also checks
62
+ the YAML document.
63
+ 3. A route without a token answers `401` with `www-authenticate: Bearer resource_metadata="<origin>/api/.well-known/oauth-protected-resource"`,
64
+ whose document names the issuer.
65
+ 4. `/mcp` without a token answers `401`.
66
+ 5. A real access token for a test organization succeeds.
67
+ 6. RPC methods answer a real calling Worker.
68
+
69
+ Keep tokens and raw responses out of the repository and of shared logs (the starter ignores `.private/`). A
70
+ failure of another service during a check is a failure, never evidence that there is no data. Stop when it is
71
+ unclear which account or credential a check uses.
72
+
73
+ See [Deploying](https://github.com/getarbol/maximus/blob/main/docs/guides/deploying.md).