@arbol-ai/maximus 8.5.2 → 8.7.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 +1 -1
- package/dist/body.d.ts +1 -1
- package/dist/body.js +1 -1
- package/dist/capture/index.d.ts +1 -1
- package/dist/capture/index.js +2 -2
- package/dist/chunks/{define-app-CvTei9a8.js → define-app-CRKaiTzi.js} +46 -5
- package/dist/chunks/{http-layout-pnmGxDOY.js → http-layout-CB6MdZOO.js} +4 -5
- package/dist/chunks/{execution-BJGx5Kxb.js → meter-Mddtgv9_.js} +64 -3
- package/dist/chunks/{openapi-file-Crm9fT4U.js → openapi-file-D1Fz9-oO.js} +2 -2
- package/dist/chunks/{openapi-CoKhMm1C.js → openapi-tJeJfq1G.js} +7 -5
- package/dist/chunks/{pages-D0zdaO0w.js → pages-DzAPVx2p.js} +1 -1
- package/dist/chunks/{runtime-CUhyce4d.js → runtime-D-yNrgEP.js} +18 -6
- package/dist/chunks/{scaffold-DZD6dfoZ.js → scaffold-BfrJN0Yk.js} +1 -1
- package/dist/chunks/{scaffold-DGrcjR3h.js → scaffold-C16tbL7M.js} +1 -1
- package/dist/chunks/{server-tygU8dw_.js → server-D49V-Sd4.js} +5 -5
- package/dist/chunks/{src-DfMzoKE_.js → src-DPB9t4u0.js} +17 -10
- package/dist/chunks/{tasks-DYdY-dBI.js → tasks-CD-B6_nv.js} +2 -2
- package/dist/chunks/{tasks-C873C3le.js → tasks-DELqUSq8.js} +1 -1
- package/dist/chunks/{tokens-D4gRyyPu.js → tokens-CS3E9OGg.js} +83 -2
- package/dist/chunks/{types-BfGa2aJT.d.ts → types-hP7p4Rsp.d.ts} +233 -9
- package/dist/chunks/{workers-types-Cxf-5cH7.d.ts → workers-types-qWuu8LZ0.d.ts} +1 -1
- package/dist/client.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/http-paths.d.ts +1 -1
- package/dist/index.d.ts +2 -2
- package/dist/index.js +5 -5
- 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/mcp/tasks.d.ts +1 -1
- package/dist/mcp/tasks.js +1 -1
- package/dist/project/config.d.ts +5 -3
- package/dist/project/config.js +1 -1
- package/dist/project/index.d.ts +2 -2
- package/dist/project/index.js +2 -2
- package/dist/schemas.d.ts +1 -1
- package/dist/standard-failures.d.ts +1 -1
- package/dist/tooling/cli.js +2 -2
- package/dist/vite/index.d.ts +17 -2
- package/dist/vite/index.js +22 -10
- 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 +10 -10
- package/skills/maximus/SKILL.md +9 -7
- package/skills/maximus/references/project.md +6 -4
- package/skills/maximus/references/routes-and-tools.md +22 -0
- package/skills/maximus/references/testing.md +1 -1
- package/templates/project/.github/workflows/ci.yml.template +23 -2
- package/templates/project/CLAUDE.md.template +1 -1
- package/templates/project/README.md.template +3 -3
- package/templates/project/package.json.template +13 -13
|
@@ -492,6 +492,8 @@ type TokenSource = 'authorization' | 'cloudflare-access';
|
|
|
492
492
|
* once, as `organizationId` or as the claim `claims.organization` names.
|
|
493
493
|
*/
|
|
494
494
|
interface TokenAccess {
|
|
495
|
+
/** Cloudflare's edge serves Managed OAuth for this application's MCP transport. Off by default. */
|
|
496
|
+
managedOAuth?: boolean;
|
|
495
497
|
/** The organization every caller acts in, when the tokens carry none: an application of one tenant. */
|
|
496
498
|
organizationId?: string;
|
|
497
499
|
/** The scopes every person Access lets through holds, each of the application's namespace. */
|
|
@@ -617,8 +619,8 @@ interface TokenPolicy<E = unknown> {
|
|
|
617
619
|
* `cloudflare-access`, as the application token Cloudflare Access sets in `Cf-Access-Jwt-Assertion`, which
|
|
618
620
|
* is then the only place a token is read: never `Authorization`, never the `CF_Authorization` cookie. The
|
|
619
621
|
* development token is a bearer token from localhost under either source. Under `cloudflare-access`, no
|
|
620
|
-
* OAuth discovery is served, a 401 challenges with a plain `Bearer`, writes a browser
|
|
621
|
-
* site are refused
|
|
622
|
+
* OAuth discovery is served by the Worker, a 401 challenges with a plain `Bearer`, and writes a browser
|
|
623
|
+
* sends for another site are refused. MCP requires `access.managedOAuth` and discovery at the edge.
|
|
622
624
|
*/
|
|
623
625
|
source?: TokenSource;
|
|
624
626
|
/**
|
|
@@ -982,6 +984,186 @@ interface CapturedCall {
|
|
|
982
984
|
* or while capture is off, whether telemetry is on or not.
|
|
983
985
|
*/
|
|
984
986
|
declare function recordCapture<E>(application: CaptureApplication<E>, env: E, background: BackgroundContext | undefined, captured: CapturedCall): void;
|
|
987
|
+
/**
|
|
988
|
+
* One fact a service measured, as its billing service takes it: what happened and how many of its units,
|
|
989
|
+
* never a price, which the organization's plan decides. Only `feature` is required.
|
|
990
|
+
*/
|
|
991
|
+
interface UsageEvent<Feature extends string = string> {
|
|
992
|
+
/** The fact, by the name the billing service gives it. */
|
|
993
|
+
feature: Feature;
|
|
994
|
+
/** How many of the fact's units; 1 when omitted. */
|
|
995
|
+
value?: number;
|
|
996
|
+
/**
|
|
997
|
+
* Unique to the fact, so the fact sent again is counted once. Omit it when every call is a new fact, such as a
|
|
998
|
+
* lookup, and the billing service makes one.
|
|
999
|
+
*/
|
|
1000
|
+
idempotencyKey?: string;
|
|
1001
|
+
/** When the fact happened, an RFC 3339 instant; when it is reported, unless given. */
|
|
1002
|
+
occurredAt?: string;
|
|
1003
|
+
/** Its labels: ids and short codes, such as a connection's id, never text a person wrote. */
|
|
1004
|
+
properties?: Readonly<Record<string, string>>;
|
|
1005
|
+
/** What the service paid a provider for this fact, which the billing service keeps beside it as a cost. */
|
|
1006
|
+
cost?: number;
|
|
1007
|
+
}
|
|
1008
|
+
/** One model call, as a billing service prices it: the model that answered and what it used, in its units. */
|
|
1009
|
+
interface TokenUsage {
|
|
1010
|
+
/** The model that answered, as its provider names it. */
|
|
1011
|
+
model: string;
|
|
1012
|
+
/** Prompt tokens no cache served. */
|
|
1013
|
+
inputTokens?: number;
|
|
1014
|
+
/** Tokens the model wrote. */
|
|
1015
|
+
outputTokens?: number;
|
|
1016
|
+
/** Prompt tokens a cache served. */
|
|
1017
|
+
cacheReadTokens?: number;
|
|
1018
|
+
/** Prompt tokens written to a cache. */
|
|
1019
|
+
cacheWriteTokens?: number;
|
|
1020
|
+
/** Pages read, for a model priced by the page. */
|
|
1021
|
+
pages?: number;
|
|
1022
|
+
/** Seconds of audio, for a model priced by the second. */
|
|
1023
|
+
audioSeconds?: number;
|
|
1024
|
+
/** Unique to the call, so the call sent again is counted once. */
|
|
1025
|
+
idempotencyKey?: string;
|
|
1026
|
+
/** When the call happened, an RFC 3339 instant; when it is reported, unless given. */
|
|
1027
|
+
occurredAt?: string;
|
|
1028
|
+
/** Its labels: ids and short codes, never text a person wrote. */
|
|
1029
|
+
properties?: Readonly<Record<string, string>>;
|
|
1030
|
+
}
|
|
1031
|
+
/**
|
|
1032
|
+
* What became of a report. `recorded`: the billing service took it and delivers it on its own, so the caller
|
|
1033
|
+
* never sends it again. `unpriced`: recorded at no price. `unavailable`: the billing service could not take it,
|
|
1034
|
+
* and only a caller that keeps its own record of the fact sends it again, with the same key. `duplicate` and
|
|
1035
|
+
* `refused`: a key already counted, and a fact the billing service turned down.
|
|
1036
|
+
*/
|
|
1037
|
+
interface UsageReceipt {
|
|
1038
|
+
/** What became of the report. */
|
|
1039
|
+
status: 'recorded' | 'duplicate' | 'refused' | 'unpriced' | 'unavailable';
|
|
1040
|
+
/** The fact's value at the organization's rates, when the billing service read them in time. */
|
|
1041
|
+
credits?: number;
|
|
1042
|
+
}
|
|
1043
|
+
/** Whether an organization may spend now. While a refusal stops nothing, `allowed` stays true. */
|
|
1044
|
+
interface SpendVerdict {
|
|
1045
|
+
/** Whether to go on. */
|
|
1046
|
+
allowed: boolean;
|
|
1047
|
+
/** Whether a refusal stops service now, or is only recorded. */
|
|
1048
|
+
enforced: boolean;
|
|
1049
|
+
/** The billing service did not answer in time, so the call was let through without knowing the balance. */
|
|
1050
|
+
degraded: boolean;
|
|
1051
|
+
/** Why it would refuse: no credits left, or a plan that does not include the fact. */
|
|
1052
|
+
reason?: 'no_credits' | 'not_in_plan';
|
|
1053
|
+
/** The credits left, when the billing service answered. */
|
|
1054
|
+
balance?: number;
|
|
1055
|
+
}
|
|
1056
|
+
/** Whether one more of a counted fact fits what the organization's plan includes. */
|
|
1057
|
+
interface LimitVerdict {
|
|
1058
|
+
/** Whether to add one more. */
|
|
1059
|
+
allowed: boolean;
|
|
1060
|
+
/** Whether a refusal stops service now, or is only recorded. */
|
|
1061
|
+
enforced: boolean;
|
|
1062
|
+
/** The billing service did not answer in time, so one more was let through. */
|
|
1063
|
+
degraded: boolean;
|
|
1064
|
+
/** How many the plan includes, or null when it grants no fixed number. */
|
|
1065
|
+
limit: number | null;
|
|
1066
|
+
}
|
|
1067
|
+
/**
|
|
1068
|
+
* A billing service's native RPC entrypoint, as a Service Binding reaches it: the binding an application names
|
|
1069
|
+
* with `meter: { binding }`, which a handler may also call itself. `Feature` names the facts this service
|
|
1070
|
+
* reports, `BillingService<'lookups' | 'provider_cost'>`, so a fact it does not report does not compile. The
|
|
1071
|
+
* billing service prices each fact: a service reports facts, never prices.
|
|
1072
|
+
*/
|
|
1073
|
+
interface BillingService<Feature extends string = string> {
|
|
1074
|
+
/** Records one fact for the organization, once per idempotency key, and answers what became of it. */
|
|
1075
|
+
reportUsage: (organizationId: string, event: UsageEvent<Feature>) => Promise<UsageReceipt>;
|
|
1076
|
+
/** Records one model call for the organization, priced by what it used. */
|
|
1077
|
+
reportTokens: (organizationId: string, usage: TokenUsage) => Promise<UsageReceipt>;
|
|
1078
|
+
/** Without a fact, whether the organization holds any credits; with one, whether it can pay one unit. */
|
|
1079
|
+
canSpend: (organizationId: string, feature?: Feature, properties?: Readonly<Record<string, string>>) => Promise<SpendVerdict>;
|
|
1080
|
+
/** Whether one more of a counted fact fits what the plan includes, given how many there are now. */
|
|
1081
|
+
checkLimit: (organizationId: string, feature: Feature, currentCount: number) => Promise<LimitVerdict>;
|
|
1082
|
+
}
|
|
1083
|
+
/**
|
|
1084
|
+
* The fact a billable call of an operation is, as its contract declares it:
|
|
1085
|
+
* `meter: { feature: 'lookups', when: (output) => output.verified }`. Once a call has answered with its checked
|
|
1086
|
+
* output, the fact is reported to the application's billing service for the verified organization, as
|
|
1087
|
+
* background work: never before the answer, never changing it, never failing it.
|
|
1088
|
+
*/
|
|
1089
|
+
interface OperationMeter<Output = never, Input = never, Feature extends string = string> {
|
|
1090
|
+
/** The fact one billable call is, by the name the billing service gives it. */
|
|
1091
|
+
feature: Feature;
|
|
1092
|
+
/** Whether this answer is billable, from its output and its input; every successful answer when omitted. */
|
|
1093
|
+
when?: (output: Output, input: Input) => boolean;
|
|
1094
|
+
/** How many of the fact's units this answer is; 1 when omitted. */
|
|
1095
|
+
value?: (output: Output, input: Input) => number;
|
|
1096
|
+
/** The fact's labels for this answer: ids and short codes, never text a person wrote. */
|
|
1097
|
+
properties?: (output: Output, input: Input) => Readonly<Record<string, string>>;
|
|
1098
|
+
}
|
|
1099
|
+
/** One call that answered, as a transport hands it to `recordMeter`. */
|
|
1100
|
+
interface MeteredCall {
|
|
1101
|
+
/** The operation's name. */
|
|
1102
|
+
operation: string;
|
|
1103
|
+
/** The verified caller, whose organization the fact belongs to. */
|
|
1104
|
+
principal: Principal;
|
|
1105
|
+
/** What the caller received. */
|
|
1106
|
+
result: Result<unknown, Failure>;
|
|
1107
|
+
/** Where execution left the admitted input. */
|
|
1108
|
+
call?: ExecutionCall;
|
|
1109
|
+
}
|
|
1110
|
+
/** What the recording point reads of the application: its operations and its billing service's binding. */
|
|
1111
|
+
interface MeterApplication<E> {
|
|
1112
|
+
operations: Readonly<Record<string, OperationShape>>;
|
|
1113
|
+
meter?: {
|
|
1114
|
+
binding: keyof E;
|
|
1115
|
+
};
|
|
1116
|
+
}
|
|
1117
|
+
/**
|
|
1118
|
+
* Reports the fact a successful call is, beside `recordCapture`, when its operation declares `meter`: to the
|
|
1119
|
+
* billing service the application names, for the verified organization, as background work after the answer,
|
|
1120
|
+
* once and never retried. It never throws, and never delays or changes the answer. Nothing is reported for a
|
|
1121
|
+
* failure, without a background context, or while the env has no such binding, as in a preview.
|
|
1122
|
+
*/
|
|
1123
|
+
declare function recordMeter<E>(application: MeterApplication<E>, env: E, background: BackgroundContext | undefined, metered: MeteredCall): void;
|
|
1124
|
+
/** The most roles a service declares: few enough that each is explained in one sentence. */
|
|
1125
|
+
declare const MAX_ROLES = 3;
|
|
1126
|
+
/** One role of a service. */
|
|
1127
|
+
interface RoleDefinition<Name extends string = string> {
|
|
1128
|
+
/** What the role is for, in a sentence a person reads before giving it. */
|
|
1129
|
+
description: string;
|
|
1130
|
+
/** Another role of the service this one includes: whatever that role may do, this one may too. */
|
|
1131
|
+
extends?: Name;
|
|
1132
|
+
/**
|
|
1133
|
+
* What the role may do, by action: `{ read: ['notes'], write: ['notes'] }` holds `<namespace>:notes:read`
|
|
1134
|
+
* and `<namespace>:notes:write`. Each scope it names is one a public operation takes.
|
|
1135
|
+
*/
|
|
1136
|
+
can?: Readonly<Record<string, readonly string[]>>;
|
|
1137
|
+
/** Every scope a public operation takes. A role with it declares neither `can` nor `extends`. */
|
|
1138
|
+
all?: true;
|
|
1139
|
+
}
|
|
1140
|
+
/** A service's roles by name: a lowercase kebab-case word, such as `viewer`. At most `MAX_ROLES`. */
|
|
1141
|
+
type RoleDefinitions = Readonly<Record<string, RoleDefinition>>;
|
|
1142
|
+
/** A role as it is published: what it is for and every scope it holds, the ones it extends included. */
|
|
1143
|
+
interface ResolvedRole {
|
|
1144
|
+
description: string;
|
|
1145
|
+
/** In name order, each once. */
|
|
1146
|
+
permissions: readonly string[];
|
|
1147
|
+
}
|
|
1148
|
+
/** Refuses, in the type, a role field no role has, such as a misspelled one, which would do nothing. */
|
|
1149
|
+
type KnownRoleFields<R> = Readonly<Record<Exclude<keyof R, keyof RoleDefinition>, never>>;
|
|
1150
|
+
/**
|
|
1151
|
+
* Declares a service's roles for its application's `roles`. It returns them unchanged: what it adds is the
|
|
1152
|
+
* type check that a role extends another declared role and never itself. `.build()` checks the rest
|
|
1153
|
+
* against the application's operations.
|
|
1154
|
+
*/
|
|
1155
|
+
declare function defineRoles<const R extends { readonly [K in keyof R]: RoleDefinition<Exclude<Extract<keyof R, string>, K>> & KnownRoleFields<R[K]>; }>(roles: R): R;
|
|
1156
|
+
/** What `resolveRoles` and `checkRoles` read of an application. */
|
|
1157
|
+
interface RoleSource {
|
|
1158
|
+
namespace: string;
|
|
1159
|
+
operations: Readonly<Record<string, OperationShape>>;
|
|
1160
|
+
roles?: RoleDefinitions;
|
|
1161
|
+
}
|
|
1162
|
+
/**
|
|
1163
|
+
* Each role of an application with every scope it holds; an application without roles has none. Call it on
|
|
1164
|
+
* a built application: `.build()` has then checked the roles, and this only expands them.
|
|
1165
|
+
*/
|
|
1166
|
+
declare function resolveRoles(application: RoleSource): Record<string, ResolvedRole>;
|
|
985
1167
|
/**
|
|
986
1168
|
* A schema's JSON Schema keywords, as Maximus reads them to publish, route and check a contract. TypeBox 1.x
|
|
987
1169
|
* types a schema without its options, so a service reads one through this view:
|
|
@@ -1223,6 +1405,11 @@ interface OperationShape extends Exposure {
|
|
|
1223
1405
|
* server's error, `INTERNAL_ERROR`.
|
|
1224
1406
|
*/
|
|
1225
1407
|
maxOutputBytes?: number;
|
|
1408
|
+
/**
|
|
1409
|
+
* The fact a billable call is, which the application's billing service records once the call has answered
|
|
1410
|
+
* with its checked output: `{ feature, when?, value?, properties? }`. It needs the application's `meter`.
|
|
1411
|
+
*/
|
|
1412
|
+
meter?: OperationMeter;
|
|
1226
1413
|
/** The handler: it receives the prepared context and the decoded input and returns a `Result`. */
|
|
1227
1414
|
execute: (context: never, input: never) => unknown;
|
|
1228
1415
|
/**
|
|
@@ -1238,11 +1425,13 @@ interface OperationShape extends Exposure {
|
|
|
1238
1425
|
}
|
|
1239
1426
|
/**
|
|
1240
1427
|
* The fields of an operation's definition besides its exposure, as `.operation()` takes them: its scope,
|
|
1241
|
-
* words, effect, failures, schemas and
|
|
1428
|
+
* words, effect, failures, schemas, limits and meter.
|
|
1242
1429
|
*/
|
|
1243
|
-
type OperationFields<I extends TSchema, O extends TSchema> = Omit<OperationShape, keyof Exposure | 'input' | 'output' | 'execute' | 'pipeline'> & {
|
|
1430
|
+
type OperationFields<I extends TSchema, O extends TSchema> = Omit<OperationShape, keyof Exposure | 'input' | 'output' | 'execute' | 'pipeline' | 'meter'> & {
|
|
1244
1431
|
input: I;
|
|
1245
1432
|
output: O;
|
|
1433
|
+
/** The fact a billable call is, its functions typed by the operation's output and decoded input. */
|
|
1434
|
+
meter?: OperationMeter<Static<O>, StaticDecode<I>>;
|
|
1246
1435
|
};
|
|
1247
1436
|
/** A definition with the exposure its declaration names, keeping that exposure's literal types. */
|
|
1248
1437
|
type OperationDefinition<I extends TSchema, O extends TSchema, X> = X & OperationFields<I, O>;
|
|
@@ -1262,9 +1451,11 @@ type OperationHandler<C, I extends TSchema, O extends TSchema, X> = (context: Op
|
|
|
1262
1451
|
*/
|
|
1263
1452
|
declare function operation<C, I extends TSchema, O extends TSchema, const X extends Exposure>(definition: OperationDefinition<I, O, X> & {
|
|
1264
1453
|
execute: OperationHandler<C, I, O, X>;
|
|
1265
|
-
}): X & Omit<OperationShape, "execute" | "input" | "output" | "pipeline" | keyof Exposure> & {
|
|
1454
|
+
}): X & Omit<OperationShape, "execute" | "input" | "meter" | "output" | "pipeline" | keyof Exposure> & {
|
|
1266
1455
|
input: I;
|
|
1267
1456
|
output: O;
|
|
1457
|
+
/** The fact a billable call is, its functions typed by the operation's output and decoded input. */
|
|
1458
|
+
meter?: OperationMeter<Static<O>, StaticDecode<I>, string> | undefined;
|
|
1268
1459
|
} & {
|
|
1269
1460
|
execute: OperationHandler<C, I, O, X>;
|
|
1270
1461
|
};
|
|
@@ -1344,6 +1535,13 @@ interface AppManifest<Env, C, Ops extends Record<string, OperationShape>> {
|
|
|
1344
1535
|
* `{ Notes: "The notes of the caller's organization." }`: the description of its OpenAPI tag.
|
|
1345
1536
|
*/
|
|
1346
1537
|
groups?: Readonly<Record<string, string>>;
|
|
1538
|
+
/**
|
|
1539
|
+
* The service's roles, from `defineRoles()`: at most three, each saying what it may do with the service's
|
|
1540
|
+
* resources. `.build()` refuses a role that names a scope no public operation takes and a public operation
|
|
1541
|
+
* no role may call; the OpenAPI document publishes each role with the scopes it holds. Omitted, the service
|
|
1542
|
+
* declares no roles and who holds its scopes is decided elsewhere.
|
|
1543
|
+
*/
|
|
1544
|
+
roles?: RoleDefinitions;
|
|
1347
1545
|
/**
|
|
1348
1546
|
* The service's version: OpenAPI `info.version`, the MCP server version and the `version` that `/health`
|
|
1349
1547
|
* reports.
|
|
@@ -1389,6 +1587,13 @@ interface AppManifest<Env, C, Ops extends Record<string, OperationShape>> {
|
|
|
1389
1587
|
* telemetry: `defineCapture` from `@arbol-ai/maximus/capture`.
|
|
1390
1588
|
*/
|
|
1391
1589
|
capture?: CaptureConfig<Env>;
|
|
1590
|
+
/**
|
|
1591
|
+
* The billing service the operations that declare `meter` report to: its Service Binding in the env, typed
|
|
1592
|
+
* with `BillingService`. An env without that binding, such as a preview's, reports nothing.
|
|
1593
|
+
*/
|
|
1594
|
+
meter?: {
|
|
1595
|
+
binding: keyof Env;
|
|
1596
|
+
};
|
|
1392
1597
|
/**
|
|
1393
1598
|
* A Workers rate limiting binding each HTTP and MCP call must pass, per organization and actor; each
|
|
1394
1599
|
* message of an MCP batch counts as a call. A refusal answers `RATE_LIMITED`.
|
|
@@ -1705,6 +1910,12 @@ declare global {
|
|
|
1705
1910
|
type Registered<K extends string, Fallback> = K extends keyof MaximusRegister ? MaximusRegister[K] : Fallback;
|
|
1706
1911
|
/** The registered Worker's bindings. */
|
|
1707
1912
|
type RegisteredEnv = Registered<'env', unknown>;
|
|
1913
|
+
/**
|
|
1914
|
+
* The facts the registered billing service takes, as its binding's `BillingService<Feature>` names them: what a
|
|
1915
|
+
* contract's `meter` may name. Any name when the project registers no billing service, or types it otherwise.
|
|
1916
|
+
* A binding a preview leaves out is optional in `Env`, and still names its facts.
|
|
1917
|
+
*/
|
|
1918
|
+
type RegisteredFeature = [NonNullable<Registered<'meter', unknown>>] extends [Pick<BillingService<infer Feature>, 'reportUsage'>] ? Feature : string;
|
|
1708
1919
|
/** The context every handler receives: what the registered base prepares. */
|
|
1709
1920
|
type RegisteredContext = Registered<'base', never> extends ApplicationBuilder<infer _E, infer C, infer _O> ? C : Invocation<unknown>;
|
|
1710
1921
|
/** The definitions of the registered error catalog. */
|
|
@@ -1897,6 +2108,11 @@ interface HandlerOptions {
|
|
|
1897
2108
|
maxBodyBytes?: number;
|
|
1898
2109
|
/** The largest output it answers, in bytes. By default, the application's limit. */
|
|
1899
2110
|
maxOutputBytes?: number;
|
|
2111
|
+
/**
|
|
2112
|
+
* The fact a billable call is, reported to the application's billing service once the call has answered:
|
|
2113
|
+
* `{ feature: 'lookups', when: (output) => output.verified }`. None by default.
|
|
2114
|
+
*/
|
|
2115
|
+
meter?: OperationMeter<never, never, RegisteredFeature>;
|
|
1900
2116
|
}
|
|
1901
2117
|
/**
|
|
1902
2118
|
* A route as `defineHandler` declares it, before binding gives it a path and a method. `X` holds the fields
|
|
@@ -1913,8 +2129,13 @@ interface HandlerDeclaration<I extends TSchema, O extends TSchema, X, C = Regist
|
|
|
1913
2129
|
/** Answers one call. */
|
|
1914
2130
|
readonly handler: (args: HandlerArguments<C, I, X>) => HandlerAnswer<O, X>;
|
|
1915
2131
|
}
|
|
2132
|
+
/**
|
|
2133
|
+
* A contract's `meter`: a fact the registered billing service takes, and functions of the contract's own output
|
|
2134
|
+
* and decoded input.
|
|
2135
|
+
*/
|
|
2136
|
+
type ContractMeter<I, O> = OperationMeter<Static<OutputSchema<O>>, StaticDecode<SchemaOf<I>>, RegisteredFeature>;
|
|
1916
2137
|
/** The fields `defineHandler` types from its contract, as the contract names them. */
|
|
1917
|
-
type HandlerContract<I, O, F, H, M, R, E, V, N> = Omit<HandlerOptions, 'input' | 'output' | 'failures' | 'http' | 'mcp' | 'rpc' | 'effect' | 'visibility' | 'operationId'> & {
|
|
2138
|
+
type HandlerContract<I, O, F, H, M, R, E, V, N> = Omit<HandlerOptions, 'input' | 'output' | 'failures' | 'http' | 'mcp' | 'rpc' | 'effect' | 'visibility' | 'operationId' | 'meter'> & {
|
|
1918
2139
|
input?: I;
|
|
1919
2140
|
output?: O;
|
|
1920
2141
|
failures?: F;
|
|
@@ -1924,6 +2145,7 @@ type HandlerContract<I, O, F, H, M, R, E, V, N> = Omit<HandlerOptions, 'input' |
|
|
|
1924
2145
|
effect?: E;
|
|
1925
2146
|
visibility?: V;
|
|
1926
2147
|
operationId?: N;
|
|
2148
|
+
meter?: ContractMeter<I, O>;
|
|
1927
2149
|
} & ([M] extends [never] ? unknown : {
|
|
1928
2150
|
description: string;
|
|
1929
2151
|
});
|
|
@@ -1971,11 +2193,12 @@ interface ToolDeclaration<I extends TSchema, O extends TSchema, X, C = Registere
|
|
|
1971
2193
|
*/
|
|
1972
2194
|
declare function defineTool<const E extends OperationShape['effect'] = never, O extends SchemaOrFields = never, I extends SchemaOrFields = TObject<Record<never, never>>, const F extends readonly DomainCode[] = never, const R extends NonNullable<Exposure['rpc']> = never>(
|
|
1973
2195
|
/** Answers one call: its output, or `fail(code)`. */
|
|
1974
|
-
handler: (args: HandlerArguments<RegisteredContext, SchemaOf<I>, DeclaredFields<F, never, never, R, E, never, never>>) => Answer<OutputValue<O>, DeclaredFields<F, never, never, R, E, never, never>>, contract: Omit<ToolOptions, 'input' | 'output' | 'effect' | 'failures' | 'rpc'> & {
|
|
2196
|
+
handler: (args: HandlerArguments<RegisteredContext, SchemaOf<I>, DeclaredFields<F, never, never, R, E, never, never>>) => Answer<OutputValue<O>, DeclaredFields<F, never, never, R, E, never, never>>, contract: Omit<ToolOptions, 'input' | 'output' | 'effect' | 'failures' | 'rpc' | 'meter'> & {
|
|
1975
2197
|
input?: I;
|
|
1976
2198
|
output?: O;
|
|
1977
2199
|
failures?: F;
|
|
1978
2200
|
rpc?: R;
|
|
2201
|
+
meter?: ContractMeter<I, O>;
|
|
1979
2202
|
} & ([E] extends [never] ? {
|
|
1980
2203
|
effect: OperationShape['effect'];
|
|
1981
2204
|
} : {
|
|
@@ -2741,7 +2964,8 @@ declare function retryAfterSeconds(value: string | null, nowMs: number, maximum?
|
|
|
2741
2964
|
* The document the origin serves at `/openapi.json`: every public operation that declares an HTTP route,
|
|
2742
2965
|
* never an internal one, under one tag per group. Each request body, success envelope and failure is a named
|
|
2743
2966
|
* component, which a generated client names its types after; each operation also carries its scopes,
|
|
2744
|
-
* effect, limits in force, MCP tool hints and native RPC as `x-*` extensions.
|
|
2967
|
+
* effect, limits in force, MCP tool hints and native RPC as `x-*` extensions. An application that declares
|
|
2968
|
+
* roles publishes each with the scopes it holds, as `x-maximus-roles`.
|
|
2745
2969
|
*
|
|
2746
2970
|
* Every schema reference in it is a local `#/components/schemas/<name>` pointer: the `$id`-named
|
|
2747
2971
|
* schemas of its paths and components (TypeBox Cyclic/Ref) become components, as `bundleSchemas`
|
|
@@ -2771,4 +2995,4 @@ declare function createRpcOpenApi<E, C, O extends Record<string, OperationShape>
|
|
|
2771
2995
|
* the argument.
|
|
2772
2996
|
*/
|
|
2773
2997
|
declare function defineApp<Env, C>(): <const Ops extends Record<string, OperationShape>>(manifest: AppManifest<Env, C, Ops>) => AppManifest<Env, C, Ops>;
|
|
2774
|
-
export { PageInfo as $,
|
|
2998
|
+
export { PageInfo as $, executeOperation as $n, TraceParent as $r, defineContext as $t, TransportContext as A, ResolvedRole as An, CaptureRecordSchema as Ar, decodeSchema as At, DeletedObject as B, TokenUsage as Bn, AttachmentOutputSchema as Br, HandlerArguments as Bt, isPathParameterValue as C, isPublicOperation as Cn, Principal as Cr, stripObject as Ct, HttpRoute as D, SchemaKeywords as Dn, OAuthResource as Dr, SchemaValidationError as Dt, HttpOptions as E, operationScopes as En, TokenPrincipal as Er, SchemaIssue as Et, Static$2 as F, BillingService as Fn, Success as Fr, ContextDeclaration as Ft, NamedReference as G, CaptureConfig as Gn, ErrorFactory as Gr, PreparedContext as Gt, EmailAddressSchema as H, UsageReceipt as Hn, DefinedErrors as Hr, HandlerHttp as Ht, TSchema$2 as I, LimitVerdict as In, err as Ir, DomainCode as It, PostalAddress as J, CaptureSink as Jn, FailureSchema as Jr, SchemaOf as Jt, NamedReferenceSchema as K, CaptureDimensions as Kn, Failure as Kr, RegisteredEnv as Kt, Type$2 as L, MeteredCall as Ln, isResult as Lr, Fail as Lt, projectAccessToken as M, RoleDefinitions as Mn, BodyFailure as Mr, parseSchema as Mt, EmptyInputSchema as N, defineRoles as Nn, FailureResult as Nr, AuthOptions as Nt, HttpTransport as O, StaticDecode as On, protectedResourceMetadata as Or, InputIssue as Ot, OrganizationIdSchema as P, resolveRoles as Pn, Result as Pr, ContextArguments as Pt, Page as Q, ExecutionCall as Qn, DurableCorrelation as Qr, defineAuth as Qt, UuidSchema as R, OperationMeter as Rn, ok as Rr, Failed as Rt, isInputHeaderName as S, composeOperations as Sn, matchesScopes as Sr, strictObject as St, HttpMiddleware as T, operationMatchesScopes as Tn, TokenClient as Tr, urlSchema as Tt, HexColorSchema as U, recordMeter as Un, ErrorCatalog as Ur, HandlerMcp as Ut, DeletedObjectSchema as V, UsageEvent as Vn, CreateArguments as Vr, HandlerDeclaration as Vt, HttpsUrlSchema as W, AnyContext as Wn, ErrorDefinition as Wr, HandlerOptions as Wt, SignedUrl as X, VerifiedCaller as Xn, resultSchema as Xr, ToolDeclaration as Xt, PostalAddressSchema as Y, CapturedCall as Yn, defineErrors as Yr, SchemaOrFields as Yt, SignedUrlSchema as Z, recordCapture as Zn, standardErrors as Zr, ToolOptions as Zt, readBodyText as _, McpSkill as _n, TokenSource as _r, literalUnion as _t, t as a, ApplicationBuilder as an, diagnosticsEnabled as ar, cursorKey as at, createHttpRouteResolver as b, OperationScope as bn, projectToken as br, pipeSchema as bt, isJsonMediaType as c, TaskAccess as cn, telemetryEnabled as cr, withoutSecrets as ct, retryAfterSeconds as d, AppManifest as dn, TokenAlgorithm as dr, readSchema as dt, createRequestId as ei, defineHandler as en, AdmissionObservation as er, PageInfoSchema as et, publicDestination as f, Exposure as fn, TokenClaims as fr, SchemaInput as ft, readBodyBytes as g, McpGuide as gn, TokenScheme as gr, inspectSchema as gt, HttpBodyFailureReason as h, McpConfiguration as hn, TokenResolutionContext as hr, inputSchema as ht, Type$1 as i, StandardFailure as in, TelemetryConfig as ir, TPage as it, createHttpHandler as j, RoleDefinition as jn, BinaryBody as jr, parseInput as jt, RouteContext as k, MAX_ROLES as kn, CaptureRecord as kr, decodeInput as kt, readJsonBody as l, TaskRecord as ln, withDiagnostics as lr, Checked as lt, HttpBodyFailure as m, InvocationAuthority as mn, TokenPolicy as mr, extendObject as mt, Static$1 as n, isRequestId as ni, defineTool as nn, ExecutionObservation as nr, PageQuery as nt, createOpenApi as o, ApplicationConfiguration as on, recordExecution as or, cutPage as ot, BodyReadOptions as p, Invocation as pn, TokenDevelopment as pr, defaultSchema as pt, PhoneNumberSchema as q, CaptureInvocation as qn, FailureData as qr, RouteBody as qt, TSchema$1 as r, parseTraceParent as ri, STANDARD_FAILURES as rn, Observer as rr, PageQueryFields as rt, createRpcOpenApi as s, maximus as sn, reportUnexpected as sr, pageLimit as st, defineApp as t, durableCorrelation as ti, defineTelemetry as tn, BackgroundContext as tr, PageOrder as tt, readJsonResponse as u, TaskStore as un, TokenAccess as ur, checkSchema as ut, HttpRouteDefinition as v, OperationHandler as vn, createTokenAuthorization as vr, looseObject as vt, operationPathParameters as w, operation as wn, PrincipalSchema as wr, transformSchema as wt, decodePathParameter as x, OperationShape as xn, ScopeMatch as xr, refineSchema as xt, HttpRouteMatch as y, OperationMiddleware as yn, createTokenVerifier as yr, normalizeSchema as yt, t$1 as z, SpendVerdict as zn, Attachment as zr, HandlerAnswer as zt };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { D as HttpRoute, E as HttpOptions,
|
|
1
|
+
import { Cr as Principal, D as HttpRoute, E as HttpOptions, Kr as Failure, Pr as Result, dn as AppManifest, n as Static, r as TSchema, un as TaskStore, xn as OperationShape } from "./types-hP7p4Rsp.js";
|
|
2
2
|
import { DurableObject, WorkerEntrypoint } from "cloudflare:workers";
|
|
3
3
|
/** A Workers static-assets binding; product stores and secrets never satisfy this capability. */
|
|
4
4
|
interface AssetBinding {
|
package/dist/client.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { F as Static,
|
|
1
|
+
import { F as Static, Kr as Failure, xn as OperationShape } from "./chunks/types-hP7p4Rsp.js";
|
|
2
2
|
/** What every HTTP operation answers: its data on success, its failure otherwise, and the request id. */
|
|
3
3
|
export type Envelope<T> = {
|
|
4
4
|
success: true;
|
package/dist/diagnostics.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { $r as TraceParent, Qr as DurableCorrelation, ar as diagnosticsEnabled, cr as telemetryEnabled, ei as createRequestId, ir as TelemetryConfig, lr as withDiagnostics, ni as isRequestId, nr as ExecutionObservation, or as recordExecution, ri as parseTraceParent, rr as Observer, sr as reportUnexpected, ti as durableCorrelation, tr as BackgroundContext } from "./chunks/types-hP7p4Rsp.js";
|
|
2
2
|
/**
|
|
3
3
|
* What diagnostics may say about an error: its name, its causes' names, its issue count and its stack
|
|
4
4
|
* locations.
|
package/dist/diagnostics.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { i as parseTraceParent, n as durableCorrelation, r as isRequestId, t as createRequestId } from "./chunks/correlation-4b23a-a4.js";
|
|
2
1
|
import { a as recordExecution, c as withDiagnostics, n as diagnosticsEnabled, o as reportUnexpected, s as telemetryEnabled, u as createDiagnostics } from "./chunks/telemetry-BtxJh69Q.js";
|
|
2
|
+
import { i as parseTraceParent, n as durableCorrelation, r as isRequestId, t as createRequestId } from "./chunks/correlation-4b23a-a4.js";
|
|
3
3
|
|
|
4
4
|
export { createDiagnostics, createRequestId, diagnosticsEnabled, durableCorrelation, isRequestId, parseTraceParent, recordExecution, reportUnexpected, telemetryEnabled, withDiagnostics };
|
package/dist/errors.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Gr as ErrorFactory, Hr as DefinedErrors, Jr as FailureSchema, Kr as Failure, Ur as ErrorCatalog, Vr as CreateArguments, Wr as ErrorDefinition, Xr as resultSchema, Yr as defineErrors, Zr as standardErrors, ni as isRequestId, qr as FailureData } from "./chunks/types-hP7p4Rsp.js";
|
|
2
2
|
export { CreateArguments, DefinedErrors, ErrorCatalog, ErrorDefinition, ErrorFactory, Failure, FailureData, FailureSchema, defineErrors, isRequestId, resultSchema, standardErrors };
|
package/dist/http-paths.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { C as isPathParameterValue, S as isInputHeaderName, b as createHttpRouteResolver, v as HttpRouteDefinition, w as operationPathParameters, x as decodePathParameter, y as HttpRouteMatch } from "./chunks/types-
|
|
1
|
+
import { C as isPathParameterValue, S as isInputHeaderName, b as createHttpRouteResolver, v as HttpRouteDefinition, w as operationPathParameters, x as decodePathParameter, y as HttpRouteMatch } from "./chunks/types-hP7p4Rsp.js";
|
|
2
2
|
export { HttpRouteDefinition, HttpRouteMatch, createHttpRouteResolver, decodePathParameter, isInputHeaderName, isPathParameterValue, operationPathParameters };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { $ as PageInfo, $
|
|
2
|
-
export { type AdmissionObservation, type AppManifest, type ApplicationBuilder, type ApplicationConfiguration, type Attachment, AttachmentOutputSchema, type AuthOptions, type BackgroundContext, type BinaryBody, type BodyFailure, type BodyReadOptions, type ContextArguments, type ContextDeclaration, type DefinedErrors, type DeletedObject, DeletedObjectSchema, type DomainCode, EmailAddressSchema, EmptyInputSchema, type ErrorCatalog, type ErrorDefinition, type ErrorFactory, type ExecutionObservation, type Exposure, type Fail, type Failed, type Failure, type FailureData, type FailureResult, FailureSchema, type HandlerAnswer, type HandlerArguments, type HandlerDeclaration, type HandlerHttp, type HandlerMcp, type HandlerOptions, HexColorSchema, type HttpBodyFailure, type HttpBodyFailureReason, type HttpMiddleware, type HttpOptions, type HttpRoute, type HttpRouteDefinition, type HttpRouteMatch, type HttpTransport, HttpsUrlSchema, type Invocation, type InvocationAuthority, type McpConfiguration, type McpGuide, type McpSkill, type NamedReference, NamedReferenceSchema, type OAuthResource, type Observer, type OperationMiddleware, type OperationScope, type OperationShape, OrganizationIdSchema, Page, type PageInfo, PageInfoSchema, type PageOrder, type PageQuery, PageQueryFields, PhoneNumberSchema, type PostalAddress, PostalAddressSchema, type PreparedContext, type Principal, PrincipalSchema, type Result, type RouteBody, type RouteContext, type SchemaKeywords, type SchemaOf, type SchemaOrFields, type ScopeMatch, type SignedUrl, SignedUrlSchema, type Static, type Success, type TPage, type TSchema, type TelemetryConfig, type TokenAccess, type TokenAlgorithm, type TokenClaims, type TokenClient, type TokenDevelopment, type TokenPolicy, type TokenPrincipal, type TokenResolutionContext, type TokenScheme, type TokenSource, type ToolDeclaration, type ToolOptions, type TransportContext, Type, UuidSchema, createHttpHandler, createHttpRouteResolver, createOpenApi, createRpcOpenApi, createTokenAuthorization, createTokenVerifier, cursorKey, cutPage, defineAuth, defineContext, defineErrors, defineHandler, defineTelemetry, defineTool, err, isJsonMediaType, isPublicOperation, isResult, matchesScopes, maximus, ok, operationMatchesScopes, operationScopes, pageLimit, parseInput, parseSchema, projectAccessToken, projectToken, protectedResourceMetadata, publicDestination, readBodyBytes, readBodyText, readJsonBody, readJsonResponse, reportUnexpected, resultSchema, retryAfterSeconds, standardErrors, t };
|
|
1
|
+
import { $ as PageInfo, $t as defineContext, A as TransportContext, An as ResolvedRole, B as DeletedObject, Bn as TokenUsage, Br as AttachmentOutputSchema, Bt as HandlerArguments, Cn as isPublicOperation, Cr as Principal, D as HttpRoute, Dn as SchemaKeywords, Dr as OAuthResource, E as HttpOptions, En as operationScopes, Er as TokenPrincipal, Fn as BillingService, Fr as Success, Ft as ContextDeclaration, G as NamedReference, Gr as ErrorFactory, Gt as PreparedContext, H as EmailAddressSchema, Hn as UsageReceipt, Hr as DefinedErrors, Ht as HandlerHttp, In as LimitVerdict, Ir as err, It as DomainCode, J as PostalAddress, Jr as FailureSchema, Jt as SchemaOf, K as NamedReferenceSchema, Kr as Failure, Lr as isResult, Lt as Fail, M as projectAccessToken, Mn as RoleDefinitions, Mr as BodyFailure, Mt as parseSchema, N as EmptyInputSchema, Nn as defineRoles, Nr as FailureResult, Nt as AuthOptions, O as HttpTransport, Or as protectedResourceMetadata, P as OrganizationIdSchema, Pn as resolveRoles, Pr as Result, Pt as ContextArguments, Q as Page, Qt as defineAuth, R as UuidSchema, Rn as OperationMeter, Rr as ok, Rt as Failed, Sr as matchesScopes, T as HttpMiddleware, Tn as operationMatchesScopes, Tr as TokenClient, U as HexColorSchema, Ur as ErrorCatalog, Ut as HandlerMcp, V as DeletedObjectSchema, Vn as UsageEvent, Vt as HandlerDeclaration, W as HttpsUrlSchema, Wr as ErrorDefinition, Wt as HandlerOptions, X as SignedUrl, Xr as resultSchema, Xt as ToolDeclaration, Y as PostalAddressSchema, Yr as defineErrors, Yt as SchemaOrFields, Z as SignedUrlSchema, Zr as standardErrors, Zt as ToolOptions, _ as readBodyText, _n as McpSkill, _r as TokenSource, a as t, an as ApplicationBuilder, at as cursorKey, b as createHttpRouteResolver, bn as OperationScope, br as projectToken, c as isJsonMediaType, d as retryAfterSeconds, dn as AppManifest, dr as TokenAlgorithm, en as defineHandler, er as AdmissionObservation, et as PageInfoSchema, f as publicDestination, fn as Exposure, fr as TokenClaims, g as readBodyBytes, gn as McpGuide, gr as TokenScheme, h as HttpBodyFailureReason, hn as McpConfiguration, hr as TokenResolutionContext, i as Type, ir as TelemetryConfig, it as TPage, j as createHttpHandler, jn as RoleDefinition, jr as BinaryBody, jt as parseInput, k as RouteContext, kn as MAX_ROLES, l as readJsonBody, m as HttpBodyFailure, mn as InvocationAuthority, mr as TokenPolicy, n as Static, nn as defineTool, nr as ExecutionObservation, nt as PageQuery, o as createOpenApi, on as ApplicationConfiguration, ot as cutPage, p as BodyReadOptions, pn as Invocation, pr as TokenDevelopment, q as PhoneNumberSchema, qr as FailureData, qt as RouteBody, r as TSchema, rr as Observer, rt as PageQueryFields, s as createRpcOpenApi, sn as maximus, sr as reportUnexpected, st as pageLimit, tn as defineTelemetry, tr as BackgroundContext, tt as PageOrder, u as readJsonResponse, ur as TokenAccess, v as HttpRouteDefinition, vr as createTokenAuthorization, wr as PrincipalSchema, xn as OperationShape, xr as ScopeMatch, y as HttpRouteMatch, yn as OperationMiddleware, yr as createTokenVerifier, zn as SpendVerdict, zr as Attachment, zt as HandlerAnswer } from "./chunks/types-hP7p4Rsp.js";
|
|
2
|
+
export { type AdmissionObservation, type AppManifest, type ApplicationBuilder, type ApplicationConfiguration, type Attachment, AttachmentOutputSchema, type AuthOptions, type BackgroundContext, type BillingService, type BinaryBody, type BodyFailure, type BodyReadOptions, type ContextArguments, type ContextDeclaration, type DefinedErrors, type DeletedObject, DeletedObjectSchema, type DomainCode, EmailAddressSchema, EmptyInputSchema, type ErrorCatalog, type ErrorDefinition, type ErrorFactory, type ExecutionObservation, type Exposure, type Fail, type Failed, type Failure, type FailureData, type FailureResult, FailureSchema, type HandlerAnswer, type HandlerArguments, type HandlerDeclaration, type HandlerHttp, type HandlerMcp, type HandlerOptions, HexColorSchema, type HttpBodyFailure, type HttpBodyFailureReason, type HttpMiddleware, type HttpOptions, type HttpRoute, type HttpRouteDefinition, type HttpRouteMatch, type HttpTransport, HttpsUrlSchema, type Invocation, type InvocationAuthority, type LimitVerdict, MAX_ROLES, type McpConfiguration, type McpGuide, type McpSkill, type NamedReference, NamedReferenceSchema, type OAuthResource, type Observer, type OperationMeter, type OperationMiddleware, type OperationScope, type OperationShape, OrganizationIdSchema, Page, type PageInfo, PageInfoSchema, type PageOrder, type PageQuery, PageQueryFields, PhoneNumberSchema, type PostalAddress, PostalAddressSchema, type PreparedContext, type Principal, PrincipalSchema, type ResolvedRole, type Result, type RoleDefinition, type RoleDefinitions, type RouteBody, type RouteContext, type SchemaKeywords, type SchemaOf, type SchemaOrFields, type ScopeMatch, type SignedUrl, SignedUrlSchema, type SpendVerdict, type Static, type Success, type TPage, type TSchema, type TelemetryConfig, type TokenAccess, type TokenAlgorithm, type TokenClaims, type TokenClient, type TokenDevelopment, type TokenPolicy, type TokenPrincipal, type TokenResolutionContext, type TokenScheme, type TokenSource, type TokenUsage, type ToolDeclaration, type ToolOptions, type TransportContext, Type, type UsageEvent, type UsageReceipt, UuidSchema, createHttpHandler, createHttpRouteResolver, createOpenApi, createRpcOpenApi, createTokenAuthorization, createTokenVerifier, cursorKey, cutPage, defineAuth, defineContext, defineErrors, defineHandler, defineRoles, defineTelemetry, defineTool, err, isJsonMediaType, isPublicOperation, isResult, matchesScopes, maximus, ok, operationMatchesScopes, operationScopes, pageLimit, parseInput, parseSchema, projectAccessToken, projectToken, protectedResourceMetadata, publicDestination, readBodyBytes, readBodyText, readJsonBody, readJsonResponse, reportUnexpected, resolveRoles, resultSchema, retryAfterSeconds, standardErrors, t };
|
package/dist/index.js
CHANGED
|
@@ -3,14 +3,14 @@ import { _ as cursorKey, b as AttachmentOutputSchema, c as HexColorSchema, d as
|
|
|
3
3
|
import { i as standardErrors, n as defineErrors, r as resultSchema, t as FailureSchema } from "./chunks/errors-BoutSmiy.js";
|
|
4
4
|
import { n as readBodyBytes, r as readBodyText } from "./chunks/body-DOIHwIIl.js";
|
|
5
5
|
import { t as createHttpRouteResolver } from "./chunks/http-paths-D043DkJv.js";
|
|
6
|
-
import { S as matchesScopes, b as operationScopes, m as isPublicOperation, v as operationMatchesScopes } from "./chunks/tasks-
|
|
7
|
-
import { a as projectToken, d as projectAccessToken, n as createTokenAuthorization, p as PrincipalSchema, r as createTokenVerifier } from "./chunks/tokens-
|
|
6
|
+
import { S as matchesScopes, b as operationScopes, m as isPublicOperation, v as operationMatchesScopes } from "./chunks/tasks-CD-B6_nv.js";
|
|
7
|
+
import { S as resolveRoles, a as projectToken, d as projectAccessToken, n as createTokenAuthorization, p as PrincipalSchema, r as createTokenVerifier, x as defineRoles, y as MAX_ROLES } from "./chunks/tokens-CS3E9OGg.js";
|
|
8
8
|
import { n as isResult, r as ok, t as err } from "./chunks/result-CF4OzG9O.js";
|
|
9
|
-
import { a as maximus, i as protectedResourceMetadata, n as t, r as createHttpHandler, t as Type } from "./chunks/src-
|
|
9
|
+
import { a as maximus, i as protectedResourceMetadata, n as t, r as createHttpHandler, t as Type } from "./chunks/src-DPB9t4u0.js";
|
|
10
10
|
import { a as defineTelemetry, i as defineHandler, n as defineAuth, o as defineTool, r as defineContext } from "./chunks/handler-DSpyrWc-.js";
|
|
11
11
|
import { o as reportUnexpected } from "./chunks/telemetry-BtxJh69Q.js";
|
|
12
|
-
import { n as createRpcOpenApi, t as createOpenApi } from "./chunks/openapi-
|
|
12
|
+
import { n as createRpcOpenApi, t as createOpenApi } from "./chunks/openapi-tJeJfq1G.js";
|
|
13
13
|
import { a as retryAfterSeconds, i as readJsonResponse, r as readJsonBody, t as isJsonMediaType } from "./chunks/json-B14evE6-.js";
|
|
14
14
|
import { t as publicDestination } from "./chunks/destination-5xTX0b7E.js";
|
|
15
15
|
|
|
16
|
-
export { AttachmentOutputSchema, DeletedObjectSchema, EmailAddressSchema, EmptyInputSchema, FailureSchema, HexColorSchema, HttpsUrlSchema, NamedReferenceSchema, OrganizationIdSchema, Page, PageInfoSchema, PageQueryFields, PhoneNumberSchema, PostalAddressSchema, PrincipalSchema, SignedUrlSchema, Type, UuidSchema, createHttpHandler, createHttpRouteResolver, createOpenApi, createRpcOpenApi, createTokenAuthorization, createTokenVerifier, cursorKey, cutPage, defineAuth, defineContext, defineErrors, defineHandler, defineTelemetry, defineTool, err, isJsonMediaType, isPublicOperation, isResult, matchesScopes, maximus, ok, operationMatchesScopes, operationScopes, pageLimit, parseInput, parseSchema, projectAccessToken, projectToken, protectedResourceMetadata, publicDestination, readBodyBytes, readBodyText, readJsonBody, readJsonResponse, reportUnexpected, resultSchema, retryAfterSeconds, standardErrors, t };
|
|
16
|
+
export { AttachmentOutputSchema, DeletedObjectSchema, EmailAddressSchema, EmptyInputSchema, FailureSchema, HexColorSchema, HttpsUrlSchema, MAX_ROLES, NamedReferenceSchema, OrganizationIdSchema, Page, PageInfoSchema, PageQueryFields, PhoneNumberSchema, PostalAddressSchema, PrincipalSchema, SignedUrlSchema, Type, UuidSchema, createHttpHandler, createHttpRouteResolver, createOpenApi, createRpcOpenApi, createTokenAuthorization, createTokenVerifier, cursorKey, cutPage, defineAuth, defineContext, defineErrors, defineHandler, defineRoles, defineTelemetry, defineTool, err, isJsonMediaType, isPublicOperation, isResult, matchesScopes, maximus, ok, operationMatchesScopes, operationScopes, pageLimit, parseInput, parseSchema, projectAccessToken, projectToken, protectedResourceMetadata, publicDestination, readBodyBytes, readBodyText, readJsonBody, readJsonResponse, reportUnexpected, resolveRoles, resultSchema, retryAfterSeconds, standardErrors, t };
|
package/dist/internals.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { A as TransportContext,
|
|
2
|
-
export { type AppManifest, type BackgroundContext, type CaptureConfig, type CapturedCall, type ExecutionCall, type HttpOptions, type HttpRouteDefinition, type HttpRouteMatch, type HttpTransport, type Invocation, type InvocationAuthority, type OperationMiddleware, type OperationShape, type TelemetryConfig, type TransportContext, type VerifiedCaller, composeOperations, createHttpRouteResolver, defineApp, executeOperation, operation, operationScopes, recordCapture, recordExecution, telemetryEnabled, withDiagnostics };
|
|
1
|
+
import { $n as executeOperation, A as TransportContext, E as HttpOptions, En as operationScopes, Gn as CaptureConfig, Ln as MeteredCall, O as HttpTransport, Qn as ExecutionCall, Sn as composeOperations, Un as recordMeter, Xn as VerifiedCaller, Yn as CapturedCall, Zn as recordCapture, b as createHttpRouteResolver, cr as telemetryEnabled, dn as AppManifest, ir as TelemetryConfig, lr as withDiagnostics, mn as InvocationAuthority, or as recordExecution, pn as Invocation, t as defineApp, tr as BackgroundContext, v as HttpRouteDefinition, wn as operation, xn as OperationShape, y as HttpRouteMatch, yn as OperationMiddleware } from "./chunks/types-hP7p4Rsp.js";
|
|
2
|
+
export { type AppManifest, type BackgroundContext, type CaptureConfig, type CapturedCall, type ExecutionCall, type HttpOptions, type HttpRouteDefinition, type HttpRouteMatch, type HttpTransport, type Invocation, type InvocationAuthority, type MeteredCall, type OperationMiddleware, type OperationShape, type TelemetryConfig, type TransportContext, type VerifiedCaller, composeOperations, createHttpRouteResolver, defineApp, executeOperation, operation, operationScopes, recordCapture, recordExecution, recordMeter, telemetryEnabled, withDiagnostics };
|
package/dist/internals.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { n as
|
|
2
|
-
import {
|
|
3
|
-
import { b as operationScopes, g as operation, p as composeOperations } from "./chunks/tasks-
|
|
1
|
+
import { n as executeOperation, r as recordCapture, t as recordMeter } from "./chunks/meter-Mddtgv9_.js";
|
|
2
|
+
import { n as defineApp } from "./chunks/define-app-CRKaiTzi.js";
|
|
3
|
+
import { b as operationScopes, g as operation, p as composeOperations } from "./chunks/tasks-CD-B6_nv.js";
|
|
4
4
|
import { a as recordExecution, c as withDiagnostics, s as telemetryEnabled } from "./chunks/telemetry-BtxJh69Q.js";
|
|
5
|
-
import {
|
|
5
|
+
import { t as createHttpRouteResolver } from "./chunks/http-paths-D043DkJv.js";
|
|
6
6
|
|
|
7
|
-
export { composeOperations, createHttpRouteResolver, defineApp, executeOperation, operation, operationScopes, recordCapture, recordExecution, telemetryEnabled, withDiagnostics };
|
|
7
|
+
export { composeOperations, createHttpRouteResolver, defineApp, executeOperation, operation, operationScopes, recordCapture, recordExecution, recordMeter, telemetryEnabled, withDiagnostics };
|
package/dist/mcp/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { O as HttpTransport } from "../chunks/types-
|
|
1
|
+
import { O as HttpTransport } from "../chunks/types-hP7p4Rsp.js";
|
|
2
2
|
/**
|
|
3
3
|
* The MCP transport, for `createWorker(app, { transports: [mcp()] })`: serves the operations that declare
|
|
4
4
|
* `mcp` as tools over Streamable HTTP at `/mcp` (or `path`), with the OpenAPI document and guides as
|
package/dist/mcp/index.js
CHANGED
|
@@ -13,7 +13,7 @@ function mcp(options = {}) {
|
|
|
13
13
|
scope: (namespace) => `${namespace}:mcp:use`,
|
|
14
14
|
maxBodyBytes: (operations, fallback) => Math.max(fallback, ...operations.flatMap(([, op]) => op.mcp ? [op.maxBodyBytes ?? fallback] : [])),
|
|
15
15
|
async handle(context) {
|
|
16
|
-
const { handleMcp } = await import("../chunks/server-
|
|
16
|
+
const { handleMcp } = await import("../chunks/server-D49V-Sd4.js");
|
|
17
17
|
return handleMcp(context);
|
|
18
18
|
}
|
|
19
19
|
};
|
package/dist/mcp/tasks.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Kr as Failure, Pr as Result, cn as TaskAccess, ln as TaskRecord } from "../chunks/types-hP7p4Rsp.js";
|
|
2
2
|
import { CallToolResult, McpServer } from "@modelcontextprotocol/server";
|
|
3
3
|
/** The Tasks extension's id, which a client declares on each request and a server among its capabilities. */
|
|
4
4
|
export declare const TASKS_EXTENSION = "io.modelcontextprotocol/tasks";
|
package/dist/mcp/tasks.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { a as mcpTask, i as isTaskResult, n as attachTasks, o as toolResult, r as declaresTasks, t as TASKS_EXTENSION } from "../chunks/tasks-
|
|
1
|
+
import { a as mcpTask, i as isTaskResult, n as attachTasks, o as toolResult, r as declaresTasks, t as TASKS_EXTENSION } from "../chunks/tasks-DELqUSq8.js";
|
|
2
2
|
|
|
3
3
|
export { TASKS_EXTENSION, attachTasks, declaresTasks, isTaskResult, mcpTask, toolResult };
|
package/dist/project/config.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Ft as ContextDeclaration, T as HttpMiddleware, Vt as HandlerDeclaration, Xt as ToolDeclaration, an as ApplicationBuilder, dn as AppManifest, fn as Exposure, pn as Invocation, vn as OperationHandler, xn as OperationShape, yn as OperationMiddleware } from "../chunks/types-
|
|
1
|
+
import { Ft as ContextDeclaration, Rn as OperationMeter, T as HttpMiddleware, Vt as HandlerDeclaration, Xt as ToolDeclaration, an as ApplicationBuilder, dn as AppManifest, fn as Exposure, pn as Invocation, vn as OperationHandler, xn as OperationShape, yn as OperationMiddleware } from "../chunks/types-hP7p4Rsp.js";
|
|
2
2
|
import { TSchema } from "typebox";
|
|
3
3
|
/** A route's HTTP method. */
|
|
4
4
|
type HttpMethod = 'GET' | 'POST' | 'PUT' | 'PATCH' | 'DELETE';
|
|
@@ -73,9 +73,10 @@ export declare function bindRoute<E, C, I extends TSchema, O extends TSchema, X,
|
|
|
73
73
|
mcp: T & {
|
|
74
74
|
idempotent: boolean;
|
|
75
75
|
};
|
|
76
|
-
} : unknown) & Omit<OperationShape, "execute" | "input" | "output" | "pipeline" | keyof Exposure> & {
|
|
76
|
+
} : unknown) & Omit<OperationShape, "execute" | "input" | "meter" | "output" | "pipeline" | keyof Exposure> & {
|
|
77
77
|
input: I;
|
|
78
78
|
output: O;
|
|
79
|
+
meter?: OperationMeter<import("typebox").Static<O>, import("typebox").StaticDecode<I>, string> | undefined;
|
|
79
80
|
} & {
|
|
80
81
|
execute: OperationHandler<C, I, O, BoundRoute<X, M, P>>;
|
|
81
82
|
}>>;
|
|
@@ -89,9 +90,10 @@ export declare function bindTool<E, C, I extends TSchema, O extends TSchema, X,
|
|
|
89
90
|
idempotent: boolean;
|
|
90
91
|
openWorld?: boolean;
|
|
91
92
|
};
|
|
92
|
-
} & Omit<OperationShape, "execute" | "input" | "output" | "pipeline" | keyof Exposure> & {
|
|
93
|
+
} & Omit<OperationShape, "execute" | "input" | "meter" | "output" | "pipeline" | keyof Exposure> & {
|
|
93
94
|
input: I;
|
|
94
95
|
output: O;
|
|
96
|
+
meter?: OperationMeter<import("typebox").Static<O>, import("typebox").StaticDecode<I>, string> | undefined;
|
|
95
97
|
} & {
|
|
96
98
|
execute: OperationHandler<C, I, O, BoundTool<X, F>>;
|
|
97
99
|
}>>;
|
package/dist/project/config.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { n as routeGroup } from "../chunks/http-routes-B6tCsnxB.js";
|
|
2
|
-
import { r as ok, t as err } from "../chunks/result-CF4OzG9O.js";
|
|
3
2
|
import { c as isHandlerDeclaration, l as isToolDeclaration, s as isContextDeclaration, t as Failed } from "../chunks/handler-DSpyrWc-.js";
|
|
3
|
+
import { r as ok, t as err } from "../chunks/result-CF4OzG9O.js";
|
|
4
4
|
import { n as routeTitle, t as routeName } from "../chunks/names-ncD7A3DV.js";
|
|
5
5
|
|
|
6
6
|
// src/project/bind.ts
|
package/dist/project/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { D as HttpRoute, dn as AppManifest, xn as OperationShape } from "../chunks/types-
|
|
2
|
-
import { n as WorkerOptions, r as WorkerRuntime } from "../chunks/workers-types-
|
|
1
|
+
import { D as HttpRoute, dn as AppManifest, xn as OperationShape } from "../chunks/types-hP7p4Rsp.js";
|
|
2
|
+
import { n as WorkerOptions, r as WorkerRuntime } from "../chunks/workers-types-qWuu8LZ0.js";
|
|
3
3
|
/** File modules use native Workers handlers; unmatched events fail instead of disappearing. */
|
|
4
4
|
type Handlers<E> = Omit<ExportedHandler<E>, 'fetch'>;
|
|
5
5
|
/** One schedule, declared beside the code it runs. Configure its trigger in Cloudflare as well. */
|
package/dist/project/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { i as standardErrors } from "../chunks/errors-BoutSmiy.js";
|
|
2
|
-
import { r as createAssetHandler, t as createWorker } from "../chunks/runtime-
|
|
3
|
-
import { t as checkPagePaths } from "../chunks/pages-
|
|
2
|
+
import { r as createAssetHandler, t as createWorker } from "../chunks/runtime-D-yNrgEP.js";
|
|
3
|
+
import { t as checkPagePaths } from "../chunks/pages-DzAPVx2p.js";
|
|
4
4
|
|
|
5
5
|
// src/project/handlers.ts
|
|
6
6
|
/** Compose file handlers with explicit fallbacks, preserving the platform's execution context. */
|
package/dist/schemas.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { $ as PageInfo, At as decodeSchema, B as DeletedObject, Ct as stripObject, Dn as SchemaKeywords, Dt as SchemaValidationError, Et as SchemaIssue, F as Static, G as NamedReference, H as EmailAddressSchema, I as TSchema, J as PostalAddress, K as NamedReferenceSchema, L as Type, Mt as parseSchema, N as EmptyInputSchema, On as StaticDecode, Ot as InputIssue, P as OrganizationIdSchema, Q as Page, R as UuidSchema, St as strictObject,
|
|
1
|
+
import { $ as PageInfo, At as decodeSchema, B as DeletedObject, Br as AttachmentOutputSchema, Ct as stripObject, Dn as SchemaKeywords, Dt as SchemaValidationError, Et as SchemaIssue, F as Static, G as NamedReference, H as EmailAddressSchema, I as TSchema, J as PostalAddress, K as NamedReferenceSchema, L as Type, Mt as parseSchema, N as EmptyInputSchema, On as StaticDecode, Ot as InputIssue, P as OrganizationIdSchema, Q as Page, R as UuidSchema, St as strictObject, Tt as urlSchema, U as HexColorSchema, V as DeletedObjectSchema, W as HttpsUrlSchema, X as SignedUrl, Y as PostalAddressSchema, Z as SignedUrlSchema, _t as literalUnion, at as cursorKey, bt as pipeSchema, ct as withoutSecrets, dt as readSchema, et as PageInfoSchema, ft as SchemaInput, gt as inspectSchema, ht as inputSchema, it as TPage, jt as parseInput, kt as decodeInput, lt as Checked, mt as extendObject, nt as PageQuery, ot as cutPage, pt as defaultSchema, q as PhoneNumberSchema, rt as PageQueryFields, st as pageLimit, tt as PageOrder, ut as checkSchema, vt as looseObject, wt as transformSchema, xt as refineSchema, yt as normalizeSchema, z as t, zr as Attachment } from "./chunks/types-hP7p4Rsp.js";
|
|
2
2
|
export { type Attachment, AttachmentOutputSchema, type Checked, type DeletedObject, DeletedObjectSchema, EmailAddressSchema, EmptyInputSchema, HexColorSchema, HttpsUrlSchema, type InputIssue, type NamedReference, NamedReferenceSchema, OrganizationIdSchema, Page, type PageInfo, PageInfoSchema, type PageOrder, type PageQuery, PageQueryFields, PhoneNumberSchema, type PostalAddress, PostalAddressSchema, type SchemaInput, type SchemaIssue, type SchemaKeywords, SchemaValidationError, type SignedUrl, SignedUrlSchema, type Static, type StaticDecode, type TPage, type TSchema, Type, UuidSchema, checkSchema, cursorKey, cutPage, decodeInput, decodeSchema, defaultSchema, extendObject, inputSchema, inspectSchema, literalUnion, looseObject, normalizeSchema, pageLimit, parseInput, parseSchema, pipeSchema, readSchema, refineSchema, strictObject, stripObject, t, transformSchema, urlSchema, withoutSecrets };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { in as StandardFailure, rn as STANDARD_FAILURES } from "./chunks/types-
|
|
1
|
+
import { in as StandardFailure, rn as STANDARD_FAILURES } from "./chunks/types-hP7p4Rsp.js";
|
|
2
2
|
export { STANDARD_FAILURES, StandardFailure };
|