@arbol-ai/maximus 8.0.1 → 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.
- package/dist/analytics/analytics.d.ts +1 -1
- package/dist/analytics/analytics.js +2 -2
- package/dist/body.d.ts +1 -1
- package/dist/capture/index.d.ts +37 -0
- package/dist/capture/index.js +182 -0
- package/dist/chunks/{define-app-x7uY70_1.js → define-app-BxGZdNmS.js} +14 -3
- package/dist/chunks/delay-BsKQP_lF.js +12 -0
- package/dist/chunks/digest-C7UGt760.js +13 -0
- package/dist/chunks/{errors-C5w9WY1l.js → errors-CWgE9uvM.js} +1 -1
- package/dist/chunks/execution-BTiAWA4n.js +264 -0
- package/dist/chunks/{http-layout-DS8DnPyu.js → http-layout-BvlbD__1.js} +1 -1
- package/dist/chunks/{openapi-CeolxIqa.js → openapi-BF3eCpux.js} +11 -20
- package/dist/chunks/{openapi-file-Bz9FRaE6.js → openapi-file-RcXoq0AF.js} +1 -1
- package/dist/chunks/{pages-iZTvFs5a.js → pages-BCksUeRf.js} +1 -1
- package/dist/chunks/{runtime-D94vx21X.js → runtime-D5eR9-Es.js} +38 -9
- package/dist/chunks/{schemas-p_aRcMC1.js → schemas-BOFxZP1c.js} +1 -1
- package/dist/chunks/{server-Bzf1Q1_4.js → server-B9C8KPwa.js} +5 -4
- package/dist/chunks/{src-CPrJpbOM.js → src-C-4z443M.js} +61 -15
- package/dist/chunks/{telemetry-C3LfZcOB.js → telemetry-BtxJh69Q.js} +4 -4
- package/dist/chunks/{types-DTIuIEJ-.d.ts → types-Dqo3oGig.d.ts} +236 -31
- package/dist/chunks/{validation-fTohBT6R.js → validation-DMu0rkMQ.js} +266 -16
- package/dist/chunks/{workers-types-BRk_Xa_5.d.ts → workers-types-BgjyDtGd.d.ts} +1 -1
- package/dist/diagnostics.d.ts +1 -1
- package/dist/diagnostics.js +1 -1
- package/dist/errors.d.ts +1 -1
- package/dist/errors.js +1 -1
- package/dist/http-paths.d.ts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +6 -6
- package/dist/internals.d.ts +2 -2
- package/dist/internals.js +5 -5
- package/dist/mcp/index.d.ts +1 -1
- package/dist/mcp/index.js +1 -1
- package/dist/project/config.d.ts +1 -1
- package/dist/project/index.d.ts +2 -2
- package/dist/project/index.js +3 -3
- package/dist/schemas.d.ts +2 -2
- package/dist/schemas.js +3 -3
- package/dist/standard-failures.d.ts +1 -1
- package/dist/tooling/cli.js +1 -1
- package/dist/vite/index.d.ts +2 -2
- package/dist/vite/index.js +12 -7
- package/dist/webhooks.d.ts +1 -1
- package/dist/workers/runtime.d.ts +1 -1
- package/dist/workers/runtime.js +1 -1
- package/package.json +5 -1
- package/skills/maximus/SKILL.md +7 -0
- package/skills/maximus/references/project.md +4 -0
- package/skills/maximus/references/routes-and-tools.md +2 -0
- package/templates/project/CLAUDE.md.template +3 -3
- package/templates/project/README.md.template +1 -0
- package/templates/project/tsconfig.json.template +1 -0
- package/dist/chunks/execution-rOiLo8VG.js +0 -84
|
@@ -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
|
-
*
|
|
327
|
-
*
|
|
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
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
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.
|
|
@@ -797,6 +838,151 @@ declare function recordExecution<E>(manifest: {
|
|
|
797
838
|
started: number;
|
|
798
839
|
result: Result<unknown, Failure>;
|
|
799
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>;
|
|
800
986
|
/**
|
|
801
987
|
* What the transport verified about a call's token, kept apart from the principal: the surface, the granted
|
|
802
988
|
* scopes, the OAuth client and the token itself. Context preparation and handlers receive a frozen copy.
|
|
@@ -836,6 +1022,16 @@ interface Invocation<Env> {
|
|
|
836
1022
|
* absent over RPC and for a token that names no client.
|
|
837
1023
|
*/
|
|
838
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;
|
|
839
1035
|
/** The operation's input, decoded and checked once; preparation must neither check it again nor log it. */
|
|
840
1036
|
readonly input?: unknown;
|
|
841
1037
|
/** The name of the operation being called, which the builder sets; never taken from caller input. */
|
|
@@ -1147,6 +1343,11 @@ interface AppManifest<Env, C, Ops extends Record<string, OperationShape>> {
|
|
|
1147
1343
|
* where the trace id comes from.
|
|
1148
1344
|
*/
|
|
1149
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>;
|
|
1150
1351
|
/**
|
|
1151
1352
|
* A Workers rate limiting binding each HTTP and MCP call must pass, per organization and actor; each
|
|
1152
1353
|
* message of an MCP batch counts as a call. A refusal answers `RATE_LIMITED`.
|
|
@@ -1688,6 +1889,9 @@ interface InputIssue {
|
|
|
1688
1889
|
* error that refuses nothing, is thrown for the caller to report: it is the server's failure, not the input's.
|
|
1689
1890
|
*/
|
|
1690
1891
|
declare function decodeInput<Schema extends TSchema>(schema: Schema, input: unknown): {
|
|
1892
|
+
ok: true;
|
|
1893
|
+
value: StaticDecode$1<Schema>;
|
|
1894
|
+
} | {
|
|
1691
1895
|
value?: undefined;
|
|
1692
1896
|
ok: false;
|
|
1693
1897
|
error: {
|
|
@@ -1698,10 +1902,7 @@ declare function decodeInput<Schema extends TSchema>(schema: Schema, input: unkn
|
|
|
1698
1902
|
issues: InputIssue[];
|
|
1699
1903
|
};
|
|
1700
1904
|
};
|
|
1701
|
-
|
|
1702
|
-
error?: undefined;
|
|
1703
|
-
ok: true;
|
|
1704
|
-
value: StaticDecode$1<Schema>;
|
|
1905
|
+
checked?: undefined;
|
|
1705
1906
|
};
|
|
1706
1907
|
/** Type-only: the key under which a codec's schema type carries its wire type. No schema object has it. */
|
|
1707
1908
|
declare const WIRE: unique symbol;
|
|
@@ -1789,7 +1990,8 @@ declare const transformSchema: <S extends TSchema, O>(schema: S, transform: (val
|
|
|
1789
1990
|
} : Record<never, never>);
|
|
1790
1991
|
/**
|
|
1791
1992
|
* Admits a value as `source`, then checks and decodes the result as `target`: a wire shape read into its
|
|
1792
|
-
* 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.
|
|
1793
1995
|
*/
|
|
1794
1996
|
declare const pipeSchema: <S extends TSchema, O extends TSchema>(source: S, target: O) => O & WireType<SchemaInput<S>>;
|
|
1795
1997
|
/**
|
|
@@ -1850,6 +2052,18 @@ type Checked<S extends TSchema> = {
|
|
|
1850
2052
|
declare function checkSchema<S extends TSchema>(schema: S, input: unknown): Checked<S>;
|
|
1851
2053
|
/** `checkSchema`, throwing its SchemaValidationError on refusal. */
|
|
1852
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;
|
|
1853
2067
|
/**
|
|
1854
2068
|
* How to reach a list's neighboring pages: whether they exist and their opaque cursors, named `PageInfo`.
|
|
1855
2069
|
*/
|
|
@@ -2343,19 +2557,10 @@ declare function createOpenApi<E, C, O extends Record<string, OperationShape>>(m
|
|
|
2343
2557
|
* `services` option types its binding from it.
|
|
2344
2558
|
*/
|
|
2345
2559
|
declare function createRpcOpenApi<E, C, O extends Record<string, OperationShape>>(manifest: AppManifest<E, C, O>): Record<string, unknown>;
|
|
2346
|
-
/**
|
|
2347
|
-
* The execution path every transport shares: checks that the caller may run the operation (its scopes when
|
|
2348
|
-
* `authority` is given, its actor kind, and `authority` itself when the operation has conditional scopes),
|
|
2349
|
-
* decodes the input, prepares the context, runs the middleware and the handler, then checks the result
|
|
2350
|
-
* against the catalog, the declared failures, the output schema and the output limit. A refused caller
|
|
2351
|
-
* answers `FORBIDDEN` and a refused input `INVALID_INPUT`. An unexpected error becomes `INTERNAL_ERROR`,
|
|
2352
|
-
* reported while telemetry is on, and is never thrown.
|
|
2353
|
-
*/
|
|
2354
|
-
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>>;
|
|
2355
2560
|
/**
|
|
2356
2561
|
* Checks an application against every rule `.build()` enforces, then hands it back unchanged; a refusal is a
|
|
2357
2562
|
* TypeError. Curried, so `Env` and `C` can be given explicitly while the operations' types are inferred from
|
|
2358
2563
|
* the argument.
|
|
2359
2564
|
*/
|
|
2360
2565
|
declare function defineApp<Env, C>(): <const Ops extends Record<string, OperationShape>>(manifest: AppManifest<Env, C, Ops>) => AppManifest<Env, C, Ops>;
|
|
2361
|
-
export {
|
|
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 };
|