@arbol-ai/maximus 7.2.1 → 7.2.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (35) hide show
  1. package/dist/analytics/analytics.d.ts +1 -1
  2. package/dist/analytics/analytics.js +2 -2
  3. package/dist/body.d.ts +1 -1
  4. package/dist/capture/index.d.ts +40 -0
  5. package/dist/capture/index.js +182 -0
  6. package/dist/chunks/delay-B9YcAv-2.js +25 -0
  7. package/dist/chunks/{record-D2H3cg8S.js → exact-length-CNFWdMzi.js} +1 -11
  8. package/dist/chunks/{execution-C-ZHm0Ya.js → execution-DxGsKvjA.js} +201 -21
  9. package/dist/chunks/{schemas-q-51wBMQ.js → schemas-CldDAUy1.js} +1 -1
  10. package/dist/chunks/{src-D-JmAzlF.js → src-Ct4fEN4z.js} +58 -13
  11. package/dist/chunks/{telemetry-DvZgrzZn.js → telemetry-Bcq3GquK.js} +4 -4
  12. package/dist/chunks/{types-B1C3Ogo5.d.ts → types-D_QnYxPM.d.ts} +247 -30
  13. package/dist/chunks/{validation-DWxKk1Js.js → validation-B8XH1b_o.js} +276 -14
  14. package/dist/client/client.d.ts +1 -1
  15. package/dist/client/client.js +2 -1
  16. package/dist/diagnostics.d.ts +1 -1
  17. package/dist/diagnostics.js +1 -1
  18. package/dist/errors.d.ts +1 -1
  19. package/dist/errors.js +1 -1
  20. package/dist/http-paths.d.ts +1 -1
  21. package/dist/index.d.ts +1 -1
  22. package/dist/index.js +5 -5
  23. package/dist/internals.d.ts +2 -2
  24. package/dist/internals.js +3 -3
  25. package/dist/mcp/index.d.ts +1 -1
  26. package/dist/mcp/index.js +22 -12
  27. package/dist/schemas.d.ts +2 -2
  28. package/dist/schemas.js +3 -3
  29. package/dist/webhooks.d.ts +1 -1
  30. package/dist/workers/runtime.d.ts +1 -1
  31. package/dist/workers/runtime.js +36 -7
  32. package/package.json +5 -1
  33. package/skills/maximus/SKILL.md +5 -0
  34. package/skills/maximus/references/adding-an-operation.md +2 -0
  35. package/skills/maximus/references/building-a-service.md +1 -1
@@ -1,9 +1,9 @@
1
- import { r as parseInput } from "../chunks/validation-DWxKk1Js.js";
1
+ import { i as parseInput } from "../chunks/validation-B8XH1b_o.js";
2
2
  import { r as isRequestId } from "../chunks/correlation-gaiEoMBr.js";
3
3
  import { standardErrors } from "../errors.js";
4
- import { d as err, p as ok, r as PrincipalSchema, t as executeOperation } from "../chunks/execution-C-ZHm0Ya.js";
5
- import { r as createHttpHandler } from "../chunks/src-D-JmAzlF.js";
6
- import { a as telemetryEnabled, r as recordExecution, s as withTelemetry } from "../chunks/telemetry-DvZgrzZn.js";
4
+ import { f as err, i as PrincipalSchema, m as ok, n as recordCapture, t as executeOperation } from "../chunks/execution-DxGsKvjA.js";
5
+ import { r as createHttpHandler } from "../chunks/src-Ct4fEN4z.js";
6
+ import { a as recordExecution, l as withTelemetry, s as telemetryEnabled } from "../chunks/telemetry-Bcq3GquK.js";
7
7
  import { DurableObject, WorkerEntrypoint, tracing } from "cloudflare:workers";
8
8
 
9
9
  //#region src/workers/assets.ts
@@ -186,13 +186,32 @@ function createWorker(application, options = {}) {
186
186
  Object.defineProperty(Entrypoint.prototype, name, {
187
187
  configurable: true,
188
188
  async value(principal, input) {
189
+ const requestStarted = performance.now();
189
190
  const props = this.ctx.props;
190
- if (!props || Object.keys(props).length !== 1 || typeof props.caller !== "string" || !callers.includes(props.caller)) return err(standardErrors.unauthorized.create());
191
191
  const parsed = parseInput(PrincipalSchema, principal);
192
- if (!parsed.ok) return err(standardErrors.unauthorized.create());
192
+ /**
193
+ * Refuses the call, and captures the refusal: the principal it names is unverified, so the record keeps
194
+ * its request id, for correlation, and never its organization or actor.
195
+ */
196
+ const refuse = () => {
197
+ const refusal = err(standardErrors.unauthorized.create());
198
+ recordCapture(manifest, this.env, this.ctx, {
199
+ operation: name,
200
+ surface: "rpc",
201
+ requestId: parsed.ok ? parsed.value.requestId : crypto.randomUUID(),
202
+ principal: null,
203
+ requestStarted,
204
+ result: refusal,
205
+ call: typeof props?.caller === "string" ? { rpcCaller: props.caller.slice(0, 64) } : {}
206
+ });
207
+ return refusal;
208
+ };
209
+ if (!props || Object.keys(props).length !== 1 || typeof props.caller !== "string" || !callers.includes(props.caller)) return refuse();
210
+ if (!parsed.ok) return refuse();
193
211
  if (telemetryEnabled(manifest.telemetry, this.env)) annotateInvocation(manifest.name, name, parsed.value.requestId);
212
+ const call = { rpcCaller: props.caller };
194
213
  const started = performance.now();
195
- const result = await withTelemetry(manifest.telemetry, this.env, () => executeOperation(manifest, op, this.env, parsed.value, input, void 0, this.ctx));
214
+ const result = await withTelemetry(manifest.telemetry, this.env, () => executeOperation(manifest, op, this.env, parsed.value, input, void 0, this.ctx, void 0, call));
196
215
  recordExecution(manifest, this.env, this.ctx, {
197
216
  principal: parsed.value,
198
217
  operation: name,
@@ -200,6 +219,16 @@ function createWorker(application, options = {}) {
200
219
  started,
201
220
  result
202
221
  });
222
+ recordCapture(manifest, this.env, this.ctx, {
223
+ operation: name,
224
+ surface: "rpc",
225
+ requestId: parsed.value.requestId,
226
+ principal: parsed.value,
227
+ requestStarted,
228
+ executionStarted: started,
229
+ result,
230
+ call
231
+ });
203
232
  return result;
204
233
  }
205
234
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@arbol-ai/maximus",
3
- "version": "7.2.1",
3
+ "version": "7.2.3",
4
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.",
5
5
  "keywords": [
6
6
  "api",
@@ -95,6 +95,10 @@
95
95
  "types": "./dist/analytics/analytics.d.ts",
96
96
  "import": "./dist/analytics/analytics.js"
97
97
  },
98
+ "./capture": {
99
+ "types": "./dist/capture/index.d.ts",
100
+ "import": "./dist/capture/index.js"
101
+ },
98
102
  "./postgres": {
99
103
  "types": "./dist/postgres/index.d.ts",
100
104
  "import": "./dist/postgres/index.js"
@@ -38,6 +38,7 @@ pipeline, never around it.
38
38
  | Verifying a provider webhook | `@arbol-ai/maximus/webhooks` on the raw body, in a plain route |
39
39
  | Callers without bearer tokens (webhooks, signed links) | A plain route that verifies its own signature |
40
40
  | Tokens that are not organization-bound OAuth access tokens | `tokens.resolve`, verifying cryptographically |
41
+ | A record of every call, for audit or a lake | `capture` in `maximus<Env>({ … })`, with `defineCapture` and `pipeline` from `@arbol-ai/maximus/capture`; mark credential fields `secret: true`; see `docs/guides/capture.md` |
41
42
  | SDKs or a catalog generated from the contract | The origin's `/openapi.json`, or `createOpenApi(app)` at build time; see `references/transports.md` |
42
43
  | A new service from scratch | `references/building-a-service.md` |
43
44
  | Upgrading from 4.x | `references/migration-to-v5.md` |
@@ -64,6 +65,10 @@ pipeline, never around it.
64
65
  (only `follow` and `manual` exist). Send credentials with `redirect: 'manual'` and refuse a `3xx`.
65
66
  - **Privacy:** never log or return request bodies, credentials or submitted values in failure
66
67
  `data`, refinement messages, MCP skills or examples. Skills and guides hold no tenant data.
68
+ - **Content leaves only through capture:** observers still receive metadata alone, never input, output or
69
+ credentials. Capture (the `capture` option) is a separate, declared destination, which the owner authorized on
70
+ 3 November 2026: content reaches a store through it, never through a log line, an observer or a failure. Mark
71
+ every credential field `secret: true`, where the wire carries it, before turning capture on.
67
72
  - **Collections are pages:** an operation that returns many items answers `Page(Item, { $id })` with
68
73
  `PageQueryFields`; one that reads, creates or updates an item answers the named entity (the list's
69
74
  item); a delete answers `DeletedObjectSchema`. Use the shared schemas (`UuidSchema`,
@@ -93,6 +93,8 @@ compile.
93
93
  `SignedUrlSchema`, `NamedReferenceSchema`, `PostalAddressSchema`; `EmptyInputSchema` (unnamed). Ids
94
94
  are strings; use `organizationId` and `requestId`, never aliases. Name your own entities with a
95
95
  PascalCase `$id`, one shape per name: it becomes a public SDK type.
96
+ - `secret: true` on a schema marks a value capture never records, such as `t.String({ secret: true })`. It
97
+ changes nothing a caller or a handler sees.
96
98
  - Lists: `input: inputSchema(t.Object({ ...PageQueryFields, ...filters }, { additionalProperties: false }))`
97
99
  (`cursor`, `direction`, `limit`; `limit: pageLimit({ maximum })` to lower it) and
98
100
  `output: Page(Item, { $id: 'ItemPage' })`, answering `{ object: 'list', data, pageInfo }`.
@@ -44,7 +44,7 @@ export const base = maximus<Env>({
44
44
  tokens: { issuer: 'https://auth.example.com/', audience: 'https://notes.example.com' },
45
45
  errors,
46
46
  rpc: { callers: [] }, // deployments allowed over native RPC
47
- // optional: mcp, telemetry, rateLimit, maxBodyBytes, maxOutputBytes
47
+ // optional: mcp, telemetry, capture, rateLimit, maxBodyBytes, maxOutputBytes
48
48
  });
49
49
  ```
50
50