@arbol-ai/maximus 8.0.0 → 8.1.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 (57) 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 +37 -0
  5. package/dist/capture/index.js +182 -0
  6. package/dist/chunks/{define-app-CfVZBt7D.js → define-app-BxGZdNmS.js} +20 -4
  7. package/dist/chunks/delay-BsKQP_lF.js +12 -0
  8. package/dist/chunks/digest-C7UGt760.js +13 -0
  9. package/dist/chunks/{errors-WfyKhiyk.js → errors-CWgE9uvM.js} +2 -2
  10. package/dist/chunks/execution-BTiAWA4n.js +264 -0
  11. package/dist/chunks/{handler-DWTGoduQ.js → handler-iebR-urt.js} +1 -0
  12. package/dist/chunks/{http-layout-_h7xwgPC.js → http-layout-BvlbD__1.js} +1 -1
  13. package/dist/chunks/{openapi-CV0KmJpS.js → openapi-BF3eCpux.js} +12 -21
  14. package/dist/chunks/{openapi-file-OjSs9mRv.js → openapi-file-RcXoq0AF.js} +1 -1
  15. package/dist/chunks/{pages-DyC0m8Zb.js → pages-BCksUeRf.js} +1 -1
  16. package/dist/chunks/{runtime-CVVf5hmp.js → runtime-D5eR9-Es.js} +38 -9
  17. package/dist/chunks/{schemas-p_aRcMC1.js → schemas-BOFxZP1c.js} +1 -1
  18. package/dist/chunks/{server-CCc7fil4.js → server-B9C8KPwa.js} +5 -4
  19. package/dist/chunks/{src--HZrH1U9.js → src-C-4z443M.js} +67 -16
  20. package/dist/chunks/{standard-failures-CLjxS2ea.js → standard-failures-Lh4mSfwG.js} +1 -1
  21. package/dist/chunks/{telemetry-C3LfZcOB.js → telemetry-BtxJh69Q.js} +4 -4
  22. package/dist/chunks/{types-BQYB4Ads.d.ts → types-Dqo3oGig.d.ts} +245 -34
  23. package/dist/chunks/{validation-fTohBT6R.js → validation-DMu0rkMQ.js} +266 -16
  24. package/dist/chunks/{workers-types-iONp32T4.d.ts → workers-types-BgjyDtGd.d.ts} +1 -1
  25. package/dist/diagnostics.d.ts +1 -1
  26. package/dist/diagnostics.js +1 -1
  27. package/dist/errors.d.ts +1 -1
  28. package/dist/errors.js +1 -1
  29. package/dist/http-paths.d.ts +1 -1
  30. package/dist/index.d.ts +1 -1
  31. package/dist/index.js +7 -7
  32. package/dist/internals.d.ts +2 -2
  33. package/dist/internals.js +5 -5
  34. package/dist/mcp/index.d.ts +1 -1
  35. package/dist/mcp/index.js +1 -1
  36. package/dist/project/config.d.ts +1 -1
  37. package/dist/project/config.js +1 -1
  38. package/dist/project/index.d.ts +2 -2
  39. package/dist/project/index.js +3 -3
  40. package/dist/schemas.d.ts +2 -2
  41. package/dist/schemas.js +3 -3
  42. package/dist/standard-failures.d.ts +1 -1
  43. package/dist/standard-failures.js +1 -1
  44. package/dist/tooling/cli.js +1 -1
  45. package/dist/vite/index.d.ts +3 -3
  46. package/dist/vite/index.js +12 -7
  47. package/dist/webhooks.d.ts +1 -1
  48. package/dist/workers/runtime.d.ts +1 -1
  49. package/dist/workers/runtime.js +1 -1
  50. package/package.json +5 -1
  51. package/skills/maximus/SKILL.md +7 -0
  52. package/skills/maximus/references/project.md +4 -0
  53. package/skills/maximus/references/routes-and-tools.md +2 -0
  54. package/templates/project/CLAUDE.md.template +3 -3
  55. package/templates/project/README.md.template +1 -0
  56. package/templates/project/tsconfig.json.template +1 -0
  57. package/dist/chunks/execution-CfZEx_JP.js +0 -84
@@ -104,7 +104,7 @@ declare const STANDARD: {
104
104
  readonly notFound: {
105
105
  readonly code: 'NOT_FOUND';
106
106
  readonly status: 404;
107
- readonly message: 'The requested operation does not exist.';
107
+ readonly message: 'The requested resource does not exist.';
108
108
  };
109
109
  readonly methodNotAllowed: {
110
110
  readonly code: 'HTTP_METHOD_NOT_ALLOWED';
@@ -315,24 +315,54 @@ interface BinaryBody {
315
315
  */
316
316
  read: () => Promise<Result<Uint8Array<ArrayBuffer>, BodyFailure>>;
317
317
  }
318
- /** Opaque owner codecs already carry their decoded static type; only native transforms need traversal. */
319
- type HasNativeTransform<S extends TSchema> = typeof TransformKind extends keyof S ? true : string extends S[typeof Kind] ? false : S extends TObject<infer P> ? true extends { [K in keyof P]: HasNativeTransform<P[K]>; }[keyof P] ? true : false : S extends TArray<infer I> ? HasNativeTransform<I> : S extends TUnion<infer U> | TTuple<infer U> ? HasNativeTransform<U[number]> : S extends TRecord<TSchema, infer V> ? HasNativeTransform<V> : false;
320
- /**
321
- * A schema's decoded value. TypeBox's deep decoder can recurse indefinitely through opaque owner
322
- * codecs; a schema without native transforms already has exactly its decoded `Static` type.
323
- */
324
- type StaticDecode$1<S extends TSchema> = true extends HasNativeTransform<S> ? StaticDecode<S> : Static<S>;
325
318
  /**
326
- * Scope names and matching: the namespaced form every scope takes, and whether granted scopes admit a
327
- * request.
319
+ * One complete record of a call: who called which operation over which transport, when and for how long, what
320
+ * it answered, and, under `payloads: 'all'`, its input and output without what their schemas mark
321
+ * `secret: true`. A refusal before the operation ran has `stage: 'admission'` and null wherever admission had
322
+ * not learned the value: a token is never read before it is verified.
328
323
  */
329
- /** Whether a caller needs any one of several scopes (`any`, the default) or all of them. */
330
- type ScopeMatch = 'any' | 'all';
331
- /**
332
- * Whether granted scopes admit a requirement: any one of the required scopes, or all of them with `all`.
333
- * An empty requirement admits nobody.
334
- */
335
- declare function matchesScopes(required: readonly string[], granted: readonly string[], match?: ScopeMatch): boolean;
324
+ declare const CaptureRecordSchema: import("@sinclair/typebox").TObject<{
325
+ id: import("@sinclair/typebox").TString;
326
+ service: import("@sinclair/typebox").TString;
327
+ operation: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TString, import("@sinclair/typebox").TNull]>;
328
+ organizationId: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TString, import("@sinclair/typebox").TNull]>;
329
+ actorId: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TString, import("@sinclair/typebox").TNull]>;
330
+ actorKind: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TLiteral<"user">, import("@sinclair/typebox").TLiteral<"service">]>, import("@sinclair/typebox").TNull]>;
331
+ requestId: import("@sinclair/typebox").TString;
332
+ traceId: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TString, import("@sinclair/typebox").TNull]>;
333
+ surface: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TLiteral<"http">, import("@sinclair/typebox").TLiteral<"mcp">, import("@sinclair/typebox").TLiteral<"rpc">]>;
334
+ occurredAt: import("@sinclair/typebox").TInteger;
335
+ durationMicros: import("@sinclair/typebox").TInteger;
336
+ outcome: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TLiteral<"success">, import("@sinclair/typebox").TLiteral<"failure">]>;
337
+ errorCode: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TString, import("@sinclair/typebox").TNull]>;
338
+ stage: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TLiteral<"execution">, import("@sinclair/typebox").TLiteral<"admission">]>;
339
+ version: import("@sinclair/typebox").TString;
340
+ effect: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TLiteral<"read">, import("@sinclair/typebox").TLiteral<"write">, import("@sinclair/typebox").TLiteral<"delete">]>, import("@sinclair/typebox").TNull]>;
341
+ scopes: import("@sinclair/typebox").TArray<import("@sinclair/typebox").TString>;
342
+ visibility: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TLiteral<"public">, import("@sinclair/typebox").TLiteral<"internal">]>, import("@sinclair/typebox").TNull]>;
343
+ httpMethod: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TString, import("@sinclair/typebox").TNull]>;
344
+ httpPath: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TString, import("@sinclair/typebox").TNull]>;
345
+ mcpTool: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TString, import("@sinclair/typebox").TNull]>;
346
+ rpcCaller: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TString, import("@sinclair/typebox").TNull]>;
347
+ clientId: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TString, import("@sinclair/typebox").TNull]>;
348
+ clientClass: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TLiteral<"human">, import("@sinclair/typebox").TLiteral<"machine">, import("@sinclair/typebox").TLiteral<"dcr">]>, import("@sinclair/typebox").TNull]>;
349
+ grantedScopes: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TArray<import("@sinclair/typebox").TString>, import("@sinclair/typebox").TNull]>;
350
+ userAgent: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TString, import("@sinclair/typebox").TNull]>;
351
+ tokenSha256: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TString, import("@sinclair/typebox").TNull]>;
352
+ dimensions: import("@sinclair/typebox").TRecord<import("@sinclair/typebox").TString, import("@sinclair/typebox").TString>;
353
+ startedAt: import("@sinclair/typebox").TInteger;
354
+ admissionMicros: import("@sinclair/typebox").TInteger;
355
+ input: import("@sinclair/typebox").TUnknown;
356
+ output: import("@sinclair/typebox").TUnknown;
357
+ failureData: import("@sinclair/typebox").TUnknown;
358
+ payloadRef: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TObject<{
359
+ $ref: import("@sinclair/typebox").TString;
360
+ bytes: import("@sinclair/typebox").TInteger;
361
+ sha256: import("@sinclair/typebox").TString;
362
+ }>, import("@sinclair/typebox").TNull]>;
363
+ }>;
364
+ /** One capture record. */
365
+ type CaptureRecord = Static<typeof CaptureRecordSchema>;
336
366
  /**
337
367
  * OAuth protected-resource metadata (RFC 9728): the resources an application publishes and the document
338
368
  * that describes each one.
@@ -406,6 +436,17 @@ declare const TokenPrincipalSchema: import("@sinclair/typebox").TObject<{
406
436
  }>;
407
437
  /** What a verified token grants. */
408
438
  type TokenPrincipal = Static<typeof TokenPrincipalSchema>;
439
+ /**
440
+ * Scope names and matching: the namespaced form every scope takes, and whether granted scopes admit a
441
+ * request.
442
+ */
443
+ /** Whether a caller needs any one of several scopes (`any`, the default) or all of them. */
444
+ type ScopeMatch = 'any' | 'all';
445
+ /**
446
+ * Whether granted scopes admit a requirement: any one of the required scopes, or all of them with `all`.
447
+ * An empty requirement admits nobody.
448
+ */
449
+ declare function matchesScopes(required: readonly string[], granted: readonly string[], match?: ScopeMatch): boolean;
409
450
  /**
410
451
  * How callers obtain and present the access token, as published in OpenAPI
411
452
  * and OAuth discovery.
@@ -605,6 +646,12 @@ interface TokenPolicy<E = unknown> {
605
646
  * resource have different origins or paths, and whenever `resources` lists any.
606
647
  */
607
648
  resourceMetadataUrl?: string | null | ((context: TokenResolutionContext<E>) => string | null);
649
+ /**
650
+ * Optional WWW-Authenticate value for a 401 or 403 refusal, including a resolver's missing-scope
651
+ * failure. Null keeps the default 401 challenge and leaves a 403 without a challenge. This hook
652
+ * changes response metadata only; it cannot admit a refused request.
653
+ */
654
+ challenge?: (failure: Failure, context: TokenResolutionContext<E>) => string | null;
608
655
  /**
609
656
  * Protected-resource metadata documents (RFC 9728) to serve instead of the default one, by absolute path
610
657
  * at or below `/.well-known/oauth-protected-resource`, one per resource. When set, the default document
@@ -791,6 +838,151 @@ declare function recordExecution<E>(manifest: {
791
838
  started: number;
792
839
  result: Result<unknown, Failure>;
793
840
  }): void;
841
+ /**
842
+ * What a transport knows of one call beyond its principal and token, and where execution leaves what the
843
+ * recording points read once the call has answered.
844
+ */
845
+ interface ExecutionCall {
846
+ /** Over native RPC, the caller admission checked: `Invocation.rpcCaller`. */
847
+ readonly rpcCaller?: string;
848
+ /** On HTTP and MCP, the request's user agent: `Invocation.userAgent`. */
849
+ readonly userAgent?: string;
850
+ /** Set once the input is admitted: what its schema checked, and the decoded value the handler receives. */
851
+ admitted?: {
852
+ readonly checked: unknown;
853
+ readonly decoded: unknown;
854
+ };
855
+ /** Set once preparation answers: the context the handler receives. */
856
+ context?: unknown;
857
+ }
858
+ /**
859
+ * The execution path every transport shares: checks that the caller may run the operation (its scopes when
860
+ * `authority` is given, its actor kind, and `authority` itself when the operation has conditional scopes),
861
+ * decodes the input, prepares the context, runs the middleware and the handler, then checks the result
862
+ * against the catalog, the declared failures, the output schema and the output limit. A refused caller
863
+ * answers `FORBIDDEN` and a refused input `INVALID_INPUT`. An unexpected error becomes `INTERNAL_ERROR`,
864
+ * reported while telemetry is on, and is never thrown. `call` hands the admitted input and the prepared context
865
+ * to the recording points, which only the Result would otherwise reach.
866
+ */
867
+ declare function executeOperation<E, C, O extends Record<string, OperationShape>>(manifest: AppManifest<E, C, O>, operation: OperationShape, env: E, principal: Principal, input: unknown, authority?: InvocationAuthority, background?: BackgroundContext, body?: BinaryBody, call?: ExecutionCall): Promise<Result<unknown, Failure>>;
868
+ /** What a context is read as unless `defineCapture` names its type. */
869
+ type AnyContext = Record<string, any>;
870
+ /**
871
+ * What a `dimensions` callback learns of a call. It belongs to that call: read what it already knows, and start
872
+ * nothing.
873
+ */
874
+ interface CaptureInvocation<E, C = AnyContext> {
875
+ /** The Worker's bindings. */
876
+ readonly env: E;
877
+ /** The operation's name; null when a refusal names none. */
878
+ readonly operation: string | null;
879
+ /** The transport that admitted the call. */
880
+ readonly surface: CaptureRecord['surface'];
881
+ /** The verified caller; null when the refusal came before it was verified. */
882
+ readonly principal: Principal | null;
883
+ /** What admission verified about the token, without the token. Absent as `Invocation.authority` is. */
884
+ readonly authority?: Omit<InvocationAuthority, 'token'>;
885
+ /** Over RPC, the caller admission checked. */
886
+ readonly rpcCaller?: string;
887
+ /** On HTTP and MCP, the request's user agent. What the caller claims. */
888
+ readonly userAgent?: string;
889
+ /** What the handler received, when the call got that far; empty before its context was prepared. */
890
+ readonly context: Partial<C>;
891
+ /** The decoded input, secrets included, for the callback to read ids from; absent for a refused input. */
892
+ readonly input?: unknown;
893
+ }
894
+ /**
895
+ * What a call is about, in the service's own words: `{ agentId, conversationId }`. Each value is an identifier
896
+ * of up to 256 characters that the record may carry; any other value is left out.
897
+ */
898
+ type CaptureDimensions = Readonly<Record<string, string | null | undefined>>;
899
+ /** Where records go. */
900
+ interface CaptureSink<E> {
901
+ /**
902
+ * Keeps one record; a rejection is a failed delivery. Capture itself never retries: a sink retries what it
903
+ * can safely repeat, as `pipeline` does, and one that cannot, an append whose outcome may be lost, does not.
904
+ */
905
+ send: (record: CaptureRecord, env: E) => Promise<unknown>;
906
+ /**
907
+ * Whether this env can take records at all, such as a binding that exists in production and not in a preview.
908
+ * When it answers false, the call builds no record and logs nothing. Always when omitted.
909
+ */
910
+ available?: (env: E) => boolean;
911
+ }
912
+ /** What a project's `capture.ts` declares, and what `maximus()` takes as `capture`. */
913
+ interface CaptureConfig<E = unknown, C = AnyContext> {
914
+ /**
915
+ * Whether calls are captured: a boolean, or a function that decides for each env; on by default. It is apart
916
+ * from `telemetry.enabled`. A function that throws turns capture off for that call and logs
917
+ * `maximus.capture.switch_failed`.
918
+ */
919
+ enabled?: boolean | ((env: E) => boolean);
920
+ /** Where records go. */
921
+ sink: CaptureSink<E>;
922
+ /**
923
+ * `all` also records each decoded input, checked output and failure data, without what their schemas mark
924
+ * `secret: true`; `none`, the default, records the metadata alone.
925
+ */
926
+ payloads?: 'all' | 'none';
927
+ /**
928
+ * What the call is about, as `record.dimensions`. It runs as background work, and one that throws leaves the
929
+ * record without dimensions and logs `maximus.capture.dimensions_failed`.
930
+ */
931
+ dimensions?: (invocation: CaptureInvocation<E, C>) => CaptureDimensions;
932
+ }
933
+ /** What a recording point reads of the application. */
934
+ interface CaptureApplication<E> {
935
+ name: string;
936
+ version: string;
937
+ operations: Readonly<Record<string, OperationShape>>;
938
+ errors: ErrorCatalog;
939
+ capture?: CaptureConfig<E>;
940
+ telemetry?: TelemetryConfig<E>;
941
+ }
942
+ /** What admission verified about a token, once it has. */
943
+ interface VerifiedCaller {
944
+ /** The scopes the token grants. */
945
+ readonly scopes: readonly string[];
946
+ /** The OAuth client it was issued to, when it names one. */
947
+ readonly client?: TokenClient;
948
+ /** The token as presented, which only its digest leaves this module as. */
949
+ readonly token?: string;
950
+ }
951
+ /** One call, or one refusal, as a transport hands it to `recordCapture`. */
952
+ interface CapturedCall {
953
+ /** The operation's name; null when a refusal names none. */
954
+ operation: string | null;
955
+ /** The transport that admitted the call. */
956
+ surface: CaptureRecord['surface'];
957
+ /** The request's id. */
958
+ requestId: string;
959
+ /** The verified caller; null before it was verified. */
960
+ principal: Principal | null;
961
+ /** What admission verified about the token; absent before it did, and over RPC. */
962
+ verified?: VerifiedCaller;
963
+ /** A `performance.now()` reading when the transport began admitting the call. */
964
+ requestStarted: number;
965
+ /** A `performance.now()` reading when execution began; absent for a refusal before it. */
966
+ executionStarted?: number;
967
+ /** What the caller received. */
968
+ result: Result<unknown, Failure>;
969
+ /** What the transport knows of the call beyond this, and what execution left for the record. */
970
+ call?: ExecutionCall;
971
+ }
972
+ /**
973
+ * Captures one call beside `recordExecution` or `recordAdmission`, as background work: it never throws, never
974
+ * delays or changes the response and never affects an observer. A failed delivery logs
975
+ * `maximus.capture.delivery_failed` with the request id alone. Nothing is recorded without a background context,
976
+ * or while capture is off, whether telemetry is on or not.
977
+ */
978
+ declare function recordCapture<E>(application: CaptureApplication<E>, env: E, background: BackgroundContext | undefined, captured: CapturedCall): void;
979
+ /** Opaque owner codecs already carry their decoded static type; only native transforms need traversal. */
980
+ type HasNativeTransform<S extends TSchema> = typeof TransformKind extends keyof S ? true : string extends S[typeof Kind] ? false : S extends TObject<infer P> ? true extends { [K in keyof P]: HasNativeTransform<P[K]>; }[keyof P] ? true : false : S extends TArray<infer I> ? HasNativeTransform<I> : S extends TUnion<infer U> | TTuple<infer U> ? HasNativeTransform<U[number]> : S extends TRecord<TSchema, infer V> ? HasNativeTransform<V> : false;
981
+ /**
982
+ * A schema's decoded value. TypeBox's deep decoder can recurse indefinitely through opaque owner
983
+ * codecs; a schema without native transforms already has exactly its decoded `Static` type.
984
+ */
985
+ type StaticDecode$1<S extends TSchema> = true extends HasNativeTransform<S> ? StaticDecode<S> : Static<S>;
794
986
  /**
795
987
  * What the transport verified about a call's token, kept apart from the principal: the surface, the granted
796
988
  * scopes, the OAuth client and the token itself. Context preparation and handlers receive a frozen copy.
@@ -830,6 +1022,16 @@ interface Invocation<Env> {
830
1022
  * absent over RPC and for a token that names no client.
831
1023
  */
832
1024
  readonly authority?: InvocationAuthority;
1025
+ /**
1026
+ * Over native RPC, the `caller` of the Service Binding, which admission checked against the operation's
1027
+ * callers; absent on HTTP and MCP.
1028
+ */
1029
+ readonly rpcCaller?: string;
1030
+ /**
1031
+ * On HTTP and MCP, the request's `user-agent`, cut to 200 characters; absent over RPC. It is what the caller
1032
+ * claims, for an audit to read: never authorization.
1033
+ */
1034
+ readonly userAgent?: string;
833
1035
  /** The operation's input, decoded and checked once; preparation must neither check it again nor log it. */
834
1036
  readonly input?: unknown;
835
1037
  /** The name of the operation being called, which the builder sets; never taken from caller input. */
@@ -1141,6 +1343,11 @@ interface AppManifest<Env, C, Ops extends Record<string, OperationShape>> {
1141
1343
  * where the trace id comes from.
1142
1344
  */
1143
1345
  telemetry?: TelemetryConfig<Env>;
1346
+ /**
1347
+ * One complete record of every operation call and refusal for a store the application declares, apart from
1348
+ * telemetry: `defineCapture` from `@arbol-ai/maximus/capture`.
1349
+ */
1350
+ capture?: CaptureConfig<Env>;
1144
1351
  /**
1145
1352
  * A Workers rate limiting binding each HTTP and MCP call must pass, per organization and actor; each
1146
1353
  * message of an MCP batch counts as a call. A refusal answers `RATE_LIMITED`.
@@ -1267,7 +1474,7 @@ declare const STANDARD_FAILURES: {
1267
1474
  readonly notFound: {
1268
1475
  readonly code: 'NOT_FOUND';
1269
1476
  readonly status: 404;
1270
- readonly message: 'The requested operation does not exist.';
1477
+ readonly message: 'The requested resource does not exist.';
1271
1478
  };
1272
1479
  readonly methodNotAllowed: {
1273
1480
  readonly code: 'HTTP_METHOD_NOT_ALLOWED';
@@ -1623,7 +1830,7 @@ declare function defineContext<D extends object>(prepare: (args: ContextArgument
1623
1830
  */
1624
1831
  type PreparedContext<T> = T extends ContextDeclaration<infer D, infer E> ? Invocation<E> & Exclude<D, Failed> : never;
1625
1832
  /** The token fields an application states in code, as `auth.ts` declares them; the rest are configuration. */
1626
- type AuthOptions<E = RegisteredEnv> = Pick<TokenPolicy<E>, 'resolve' | 'resourceMetadataUrl' | 'resources'>;
1833
+ type AuthOptions<E = RegisteredEnv> = Pick<TokenPolicy<E>, 'resolve' | 'challenge' | 'resourceMetadataUrl' | 'resources'>;
1627
1834
  /**
1628
1835
  * Declares, as `auth.ts`'s default export, how the application verifies tokens itself: `resolve`, which
1629
1836
  * replaces the default OAuth verification for every token but the development token (for credentials the
@@ -1682,6 +1889,9 @@ interface InputIssue {
1682
1889
  * error that refuses nothing, is thrown for the caller to report: it is the server's failure, not the input's.
1683
1890
  */
1684
1891
  declare function decodeInput<Schema extends TSchema>(schema: Schema, input: unknown): {
1892
+ ok: true;
1893
+ value: StaticDecode$1<Schema>;
1894
+ } | {
1685
1895
  value?: undefined;
1686
1896
  ok: false;
1687
1897
  error: {
@@ -1692,10 +1902,7 @@ declare function decodeInput<Schema extends TSchema>(schema: Schema, input: unkn
1692
1902
  issues: InputIssue[];
1693
1903
  };
1694
1904
  };
1695
- } | {
1696
- error?: undefined;
1697
- ok: true;
1698
- value: StaticDecode$1<Schema>;
1905
+ checked?: undefined;
1699
1906
  };
1700
1907
  /** Type-only: the key under which a codec's schema type carries its wire type. No schema object has it. */
1701
1908
  declare const WIRE: unique symbol;
@@ -1783,7 +1990,8 @@ declare const transformSchema: <S extends TSchema, O>(schema: S, transform: (val
1783
1990
  } : Record<never, never>);
1784
1991
  /**
1785
1992
  * Admits a value as `source`, then checks and decodes the result as `target`: a wire shape read into its
1786
- * canonical one. Runs inside `inputSchema()`.
1993
+ * canonical one. Runs inside `inputSchema()`. A `target` that marks a field `secret: true` needs `source` to
1994
+ * mark it too, or it throws a TypeError.
1787
1995
  */
1788
1996
  declare const pipeSchema: <S extends TSchema, O extends TSchema>(source: S, target: O) => O & WireType<SchemaInput<S>>;
1789
1997
  /**
@@ -1844,6 +2052,18 @@ type Checked<S extends TSchema> = {
1844
2052
  declare function checkSchema<S extends TSchema>(schema: S, input: unknown): Checked<S>;
1845
2053
  /** `checkSchema`, throwing its SchemaValidationError on refusal. */
1846
2054
  declare function readSchema<S extends TSchema>(schema: S, input: unknown): StaticDecode$1<S>;
2055
+ /**
2056
+ * A copy of a value without every field its schema marks with `secret: true`, at any depth: through objects,
2057
+ * records, arrays, tuples, unions, intersections, optional fields and references. The input is never changed.
2058
+ * A marked list element goes with its value, a marked tuple position becomes `null`, and a schema marked at
2059
+ * its root answers `undefined`.
2060
+ *
2061
+ * Pass a value of the shape the schema describes: what it checked, before any codec ran. It fails closed where
2062
+ * a schema cannot speak for a value: a name marked in any member of a union is removed from all of them, a
2063
+ * key a strict object refuses is removed, as is a value of another type, or one under a `$ref` the schema does
2064
+ * not define.
2065
+ */
2066
+ declare function withoutSecrets(schema: TSchema, value: unknown): unknown;
1847
2067
  /**
1848
2068
  * How to reach a list's neighboring pages: whether they exist and their opaque cursors, named `PageInfo`.
1849
2069
  */
@@ -2337,19 +2557,10 @@ declare function createOpenApi<E, C, O extends Record<string, OperationShape>>(m
2337
2557
  * `services` option types its binding from it.
2338
2558
  */
2339
2559
  declare function createRpcOpenApi<E, C, O extends Record<string, OperationShape>>(manifest: AppManifest<E, C, O>): Record<string, unknown>;
2340
- /**
2341
- * The execution path every transport shares: checks that the caller may run the operation (its scopes when
2342
- * `authority` is given, its actor kind, and `authority` itself when the operation has conditional scopes),
2343
- * decodes the input, prepares the context, runs the middleware and the handler, then checks the result
2344
- * against the catalog, the declared failures, the output schema and the output limit. A refused caller
2345
- * answers `FORBIDDEN` and a refused input `INVALID_INPUT`. An unexpected error becomes `INTERNAL_ERROR`,
2346
- * reported while telemetry is on, and is never thrown.
2347
- */
2348
- declare function executeOperation<E, C, O extends Record<string, OperationShape>>(manifest: AppManifest<E, C, O>, operation: OperationShape, env: E, principal: Principal, input: unknown, authority?: InvocationAuthority, background?: BackgroundContext, body?: BinaryBody): Promise<Result<unknown, Failure>>;
2349
2560
  /**
2350
2561
  * Checks an application against every rule `.build()` enforces, then hands it back unchanged; a refusal is a
2351
2562
  * TypeError. Curried, so `Env` and `C` can be given explicitly while the operations' types are inferred from
2352
2563
  * the argument.
2353
2564
  */
2354
2565
  declare function defineApp<Env, C>(): <const Ops extends Record<string, OperationShape>>(manifest: AppManifest<Env, C, Ops>) => AppManifest<Env, C, Ops>;
2355
- export { PageInfo as $, Success as $n, StandardFailure as $t, TransportContext as A, TokenAlgorithm as An, ContextArguments as At, DeletedObject as B, Principal as Bn, HandlerOptions as Bt, isPathParameterValue as C, TelemetryConfig as Cn, urlSchema as Ct, HttpRoute as D, telemetryEnabled as Dn, parseInput as Dt, HttpOptions as E, reportUnexpected as En, decodeSchema as Et, Static$2 as F, TokenScheme as Fn, HandlerAnswer as Ft, NamedReference as G, protectedResourceMetadata as Gn, ToolDeclaration as Gt, EmailAddressSchema as H, TokenClient as Hn, RouteBody as Ht, TSchema$2 as I, TokenSource as In, HandlerArguments as It, PostalAddress as J, StaticDecode$1 as Jn, defineContext as Jt, NamedReferenceSchema as K, ScopeMatch as Kn, ToolOptions as Kt, Type$2 as L, createTokenAuthorization as Ln, HandlerDeclaration as Lt, projectAccessToken as M, TokenDevelopment as Mn, DomainCode as Mt, EmptyInputSchema as N, TokenPolicy as Nn, Fail as Nt, HttpTransport as O, withDiagnostics as On, parseSchema as Ot, OrganizationIdSchema as P, TokenResolutionContext as Pn, Failed as Pt, Page as Q, Result as Qn, STANDARD_FAILURES as Qt, UuidSchema as R, createTokenVerifier as Rn, HandlerHttp as Rt, isInputHeaderName as S, Observer as Sn, transformSchema as St, HttpMiddleware as T, recordExecution as Tn, decodeInput as Tt, HexColorSchema as U, TokenPrincipal as Un, SchemaOf as Ut, DeletedObjectSchema as V, PrincipalSchema as Vn, PreparedContext as Vt, HttpsUrlSchema as W, OAuthResource as Wn, SchemaOrFields as Wt, SignedUrl as X, BodyFailure as Xn, defineTelemetry as Xt, PostalAddressSchema as Y, BinaryBody as Yn, defineHandler as Yt, SignedUrlSchema as Z, FailureResult as Zn, defineTool as Zt, readBodyText as _, operationMatchesScopes as _n, TraceParent as _r, normalizeSchema as _t, Type$1 as a, Invocation as an, CreateArguments as ar, Checked as at, createHttpRouteResolver as b, BackgroundContext as bn, isRequestId as br, strictObject as bt, createRpcOpenApi as c, McpGuide as cn, ErrorDefinition as cr, SchemaInput as ct, readJsonResponse as d, OperationMiddleware as dn, FailureData as dr, defaultSchema as dt, ApplicationBuilder as en, err as er, PageInfoSchema as et, retryAfterSeconds as f, OperationScope as fn, FailureSchema as fr, extendObject as ft, readBodyBytes as g, operation as gn, DurableCorrelation as gr, looseObject as gt, HttpBodyFailureReason as h, isPublicOperation as hn, standardErrors as hr, literalUnion as ht, TSchema$1 as i, Exposure as in, AttachmentOutputSchema as ir, pageLimit as it, createHttpHandler as j, TokenClaims as jn, ContextDeclaration as jt, RouteContext as k, TokenAccess as kn, AuthOptions as kt, isJsonMediaType as l, McpSkill as ln, ErrorFactory as lr, SchemaIssue as lt, HttpBodyFailure as m, composeOperations as mn, resultSchema as mr, inspectSchema as mt, executeOperation as n, maximus as nn, ok as nr, PageQueryFields as nt, t as o, InvocationAuthority as on, DefinedErrors as or, checkSchema as ot, BodyReadOptions as p, OperationShape as pn, defineErrors as pr, inputSchema as pt, PhoneNumberSchema as q, matchesScopes as qn, defineAuth as qt, Static$1 as r, AppManifest as rn, Attachment as rr, TPage as rt, createOpenApi as s, McpConfiguration as sn, ErrorCatalog as sr, readSchema as st, defineApp as t, ApplicationConfiguration as tn, isResult as tr, PageQuery as tt, readJsonBody as u, OperationHandler as un, Failure as ur, SchemaValidationError as ut, HttpRouteDefinition as v, operationScopes as vn, createRequestId as vr, pipeSchema as vt, operationPathParameters as w, diagnosticsEnabled as wn, InputIssue as wt, decodePathParameter as x, ExecutionObservation as xn, parseTraceParent as xr, stripObject as xt, HttpRouteMatch as y, AdmissionObservation as yn, durableCorrelation as yr, refineSchema as yt, t$1 as z, projectToken as zn, HandlerMcp as zt };
2566
+ export { PageInfoSchema as $, matchesScopes as $n, STANDARD_FAILURES as $t, createHttpHandler as A, executeOperation as An, TraceParent as Ar, ContextArguments as At, DeletedObjectSchema as B, withDiagnostics as Bn, HandlerOptions as Bt, operationPathParameters as C, CaptureDimensions as Cn, Failure as Cr, urlSchema as Ct, HttpTransport as D, VerifiedCaller as Dn, resultSchema as Dr, parseInput as Dt, HttpRoute as E, CapturedCall as En, defineErrors as Er, decodeSchema as Et, TSchema$2 as F, TelemetryConfig as Fn, HandlerAnswer as Ft, NamedReferenceSchema as G, TokenPolicy as Gn, SchemaOrFields as Gt, HexColorSchema as H, TokenAlgorithm as Hn, RegisteredEnv as Ht, Type$2 as I, diagnosticsEnabled as In, HandlerArguments as It, PostalAddressSchema as J, TokenSource as Jn, defineAuth as Jt, PhoneNumberSchema as K, TokenResolutionContext as Kn, ToolDeclaration as Kt, UuidSchema as L, recordExecution as Ln, HandlerDeclaration as Lt, EmptyInputSchema as M, BackgroundContext as Mn, durableCorrelation as Mr, DomainCode as Mt, OrganizationIdSchema as N, ExecutionObservation as Nn, isRequestId as Nr, Fail as Nt, RouteContext as O, recordCapture as On, standardErrors as Or, parseSchema as Ot, Static$2 as P, Observer as Pn, parseTraceParent as Pr, Failed as Pt, PageInfo as Q, ScopeMatch as Qn, defineTool as Qt, t$1 as R, reportUnexpected as Rn, HandlerHttp as Rt, isPathParameterValue as S, CaptureConfig as Sn, ErrorFactory as Sr, transformSchema as St, HttpOptions as T, CaptureSink as Tn, FailureSchema as Tr, decodeInput as Tt, HttpsUrlSchema as U, TokenClaims as Un, RouteBody as Ut, EmailAddressSchema as V, TokenAccess as Vn, PreparedContext as Vt, NamedReference as W, TokenDevelopment as Wn, SchemaOf as Wt, SignedUrlSchema as X, createTokenVerifier as Xn, defineHandler as Xt, SignedUrl as Y, createTokenAuthorization as Yn, defineContext as Yt, Page as Z, projectToken as Zn, defineTelemetry as Zt, HttpRouteDefinition as _, operation as _n, AttachmentOutputSchema as _r, normalizeSchema as _t, t as a, Exposure as an, protectedResourceMetadata as ar, Checked as at, decodePathParameter as b, StaticDecode$1 as bn, ErrorCatalog as br, strictObject as bt, isJsonMediaType as c, McpConfiguration as cn, BinaryBody as cr, SchemaInput as ct, retryAfterSeconds as d, OperationHandler as dn, Result as dr, defaultSchema as dt, StandardFailure as en, Principal as er, PageQuery as et, BodyReadOptions as f, OperationMiddleware as fn, Success as fr, extendObject as ft, readBodyText as g, isPublicOperation as gn, Attachment as gr, looseObject as gt, readBodyBytes as h, composeOperations as hn, ok as hr, literalUnion as ht, Type$1 as i, AppManifest as in, OAuthResource as ir, withoutSecrets as it, projectAccessToken as j, AdmissionObservation as jn, createRequestId as jr, ContextDeclaration as jt, TransportContext as k, ExecutionCall as kn, DurableCorrelation as kr, AuthOptions as kt, readJsonBody as l, McpGuide as ln, BodyFailure as lr, SchemaIssue as lt, HttpBodyFailureReason as m, OperationShape as mn, isResult as mr, inspectSchema as mt, Static$1 as n, ApplicationConfiguration as nn, TokenClient as nr, TPage as nt, createOpenApi as o, Invocation as on, CaptureRecord as or, checkSchema as ot, HttpBodyFailure as p, OperationScope as pn, err as pr, inputSchema as pt, PostalAddress as q, TokenScheme as qn, ToolOptions as qt, TSchema$1 as r, maximus as rn, TokenPrincipal as rr, pageLimit as rt, createRpcOpenApi as s, InvocationAuthority as sn, CaptureRecordSchema as sr, readSchema as st, defineApp as t, ApplicationBuilder as tn, PrincipalSchema as tr, PageQueryFields as tt, readJsonResponse as u, McpSkill as un, FailureResult as ur, SchemaValidationError as ut, HttpRouteMatch as v, operationMatchesScopes as vn, CreateArguments as vr, pipeSchema as vt, HttpMiddleware as w, CaptureInvocation as wn, FailureData as wr, InputIssue as wt, isInputHeaderName as x, AnyContext as xn, ErrorDefinition as xr, stripObject as xt, createHttpRouteResolver as y, operationScopes as yn, DefinedErrors as yr, refineSchema as yt, DeletedObject as z, telemetryEnabled as zn, HandlerMcp as zt };